import React, { useState, useEffect } from 'react' const ActionPerformer = ({ actionHook, LoadingButton, SuccessButton, ErrorButton, errorCallback, completeCallback }) => { // Call our useFetch() hook to start performing our action (i.e. importing a template) const { loading, data, error } = actionHook() // Check if we've successfully completed out action: if (!loading && !error) { // We've successfully imported the template, bubble up a success call after a short timeout // so we can show an "imported" state on the button briefly: setTimeout(() => { completeCallback(data) }, 500) return SuccessButton } // Check if we had an error performing the action: if (error) { setTimeout(() => { errorCallback(data) }, 100) return ErrorButton } // The default state of this component is loading, so we show that loading button here.. return LoadingButton } /** * Generic user action provider. * Used for things like "Import Template" and "Import Photo" buttons * * @param DefaultButton * @param CompletedButton * @param ProcessingButton * @param isAlreadyCompleted * @param completedCallback * @param actionConfirmationMessage * * @returns {*} * @constructor */ const ButtonActionProvider = ({ DefaultButton, CompletedButton, LoadingButton, ErrorButton, SuccessButton, actionHook, isAlreadyCompleted = false, completedCallback = null, errorCallback = null, actionConfirmationMessage = null }) => { const [isProcessing, setIsProcessing] = useState(false) const [isCompleted, setIsCompleted] = useState(isAlreadyCompleted) const [error, setError] = useState(null) useEffect(() => { if (isCompleted && completedCallback && !isAlreadyCompleted) { // We fire off an optional completed callback, if the component didn't start in the completed state. completedCallback(isCompleted) } }, [isCompleted]) useEffect(() => { if (error && errorCallback) { // We fire off an optional error callback, with the error data set below errorCallback(error) } }, [error]) useEffect(() => { // If our parent component resets our completed status prop, we update our local state to reflect this: setIsCompleted(isAlreadyCompleted) }, [isAlreadyCompleted]) // Check if this action has been completed: if (isCompleted) { return CompletedButton } // Check if we're currently performing the action: if (isProcessing) { // As soon as this "Processing" component renders we expect the ajax action to start running. // We provide a "completeCallback" that this "Processing" component can call once it's done it's thing. return ( { // If our action returns an error, we swap back to our default state so the user can try again setTimeout(() => { setIsProcessing(false) }, 500) setError(data) }} completeCallback={(data) => { setIsProcessing(false) setIsCompleted(data) }} /> ) } // Default state is not processing/completed, so we show a default button return React.cloneElement(DefaultButton, { onClick: (event) => { if (actionConfirmationMessage) { if (!confirm(actionConfirmationMessage)) { // user has denied the confirmation dialog, prevent calling our processing action. event.preventDefault() return false } } setIsProcessing(true) } }) } export default ButtonActionProvider Privacy Policy - TranslationSUB
TranslationSUB

Privacy Policy

TranslationSub (hereinafter referred to as “the Business”), recognizes the importance of protecting personal information, and in the provision of translation and any other services, endeavors to the appropriate use and management, as well as the correct and safe protection, of all personal information.

Security Measures

The Business works to prevent the breach of personal information held by the Business through the act of taking necessary and appropriate security measures.

Inquiries Related To Handling Of Personal Information

The Business responds appropriately to inquiries or complaints from persons regarding either the handling of personal information or the Business’ management system regarding personal information management. Requests from persons for the disclosure, correction, deletion, or suspension of the use of personal information will be accepted and dealt with promptly

The Purpose Of Collecting Personal Information

The Business collects personal information of persons for the following purposes:

  1. Handling and responding to requests for quotations and inquiries regarding the Business’ services.
  2. Contacting users of the Business’ services and providing information regarding the Business’ services (newsletters, mailing lists, etc.).
  3. Accepting applications and contacting applicants for employment or staffing.
  4. Understanding and analyzing access of the Business’ website.
  5. Developing a database for the Business’ production of business documents (used after transformation into data from which it is impossible to identify any particular name).

    Notification will be given at the time of collection in case that other collection purposes relating to the Business’ services arise.

Disclosure Of Personal Information

The Business does not disclose personal information to third parties other than those for which it has received prior permission from the persons concerned. However, in the following circumstances, there are cases where those responsible for the protection of personal information have a responsibility to make the disclosure.

  1. When disclosure is demanded by public agencies requiring disclosure for the public good, or by public agencies such as the police, or when there has been a governmental or judicial request or order.
  2. In cases recognized as legal exceptions.
  3. When an emergency threatens human health or property.

Disclosure Of Personal Information And Related Inquiries

Inquiries regarding the notice of purposes of use, disclosure, corrections, additions, suspension of use, deletions, and suspension of provision to third parties, are handled at the address indicated below. For questions or comments regarding the Business’s privacy policy or protection of personal information, please contact the below address.

Contact

Contact

contact@translationsub.com

contact@translationsub.com

TranslationSUB

TranslationSUB