@tap-payments/apple-pay-button 0.0.65-development → 0.0.66-development
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/ApplePayButtonProps.d.ts +1 -2
- package/build/@types/enums.d.ts +2 -8
- package/build/@types/enums.js +1 -8
- package/build/api.d.ts +34 -0
- package/build/{api/app.service.js → api.js} +36 -107
- package/build/constants/index.d.ts +2 -7
- package/build/constants/index.js +2 -7
- package/build/features/ApplePayButton/ApplePayButton.d.ts +0 -1
- package/build/features/ApplePayButton/ApplePayButton.js +9 -8
- package/build/hooks/index.d.ts +0 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/useApplePay.d.ts +9 -13
- package/build/hooks/useApplePay.js +23 -57
- package/build/hooks/useMerchantApplePay.js +2 -2
- package/build/index.d.ts +2 -2
- package/build/index.js +2 -3
- package/build/utils/config.d.ts +0 -2
- package/build/utils/config.js +0 -18
- package/build/utils/defaultValues.d.ts +1 -71
- package/build/utils/defaultValues.js +1 -23
- package/package.json +3 -4
- package/build/api/app.service.d.ts +0 -27
- package/build/api/base.d.ts +0 -9
- package/build/api/base.js +0 -45
- package/build/api/httpClient.d.ts +0 -22
- package/build/api/httpClient.js +0 -36
- package/build/assets/gif/error-black.gif +0 -0
- package/build/assets/gif/error-white.gif +0 -0
- package/build/assets/gif/success-black.gif +0 -0
- package/build/assets/gif/success-white.gif +0 -0
- package/build/assets/lottie/Dark_Mode_Loader.json +0 -255
- package/build/assets/lottie/Light_Mode_Loader.json +0 -255
- package/build/components/ActionButton/ActionButton.d.ts +0 -24
- package/build/components/ActionButton/ActionButton.js +0 -62
- package/build/components/ActionButton/index.d.ts +0 -2
- package/build/components/ActionButton/index.js +0 -2
- package/build/components/InitialLoader/InitialLoader.d.ts +0 -9
- package/build/components/InitialLoader/InitialLoader.js +0 -26
- package/build/components/InitialLoader/index.d.ts +0 -2
- package/build/components/InitialLoader/index.js +0 -2
- package/build/components/Loader/Loader.d.ts +0 -24
- package/build/components/Loader/Loader.js +0 -48
- package/build/components/Loader/index.d.ts +0 -2
- package/build/components/Loader/index.js +0 -2
- package/build/components/PayButton/PayButton.d.ts +0 -16
- package/build/components/PayButton/PayButton.js +0 -40
- package/build/components/PayButton/index.d.ts +0 -2
- package/build/components/PayButton/index.js +0 -2
- package/build/components/PayButton/style.d.ts +0 -5
- package/build/components/PayButton/style.js +0 -19
- package/build/features/ApplePayButton/ApplePayButton.css +0 -21
- package/build/features/ApplePayButton/style.d.ts +0 -5
- package/build/features/ApplePayButton/style.js +0 -20
- package/build/hooks/useScript.d.ts +0 -3
- package/build/hooks/useScript.js +0 -40
package/build/hooks/useScript.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react';
|
|
2
|
-
export function useScript(src, async) {
|
|
3
|
-
if (async === void 0) { async = true; }
|
|
4
|
-
var _a = useState(src ? 'loading' : 'idle'), status = _a[0], setStatus = _a[1];
|
|
5
|
-
useEffect(function () {
|
|
6
|
-
if (!src) {
|
|
7
|
-
setStatus('idle');
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
var script = document.querySelector("script[src=\"".concat(src, "\"]"));
|
|
11
|
-
if (!script) {
|
|
12
|
-
script = document.createElement('script');
|
|
13
|
-
script.src = src;
|
|
14
|
-
script.async = async;
|
|
15
|
-
script.setAttribute('data-status', 'loading');
|
|
16
|
-
document.body.appendChild(script);
|
|
17
|
-
var setAttributeFromEvent = function (event) {
|
|
18
|
-
script === null || script === void 0 ? void 0 : script.setAttribute('data-status', event.type === 'load' ? 'ready' : 'error');
|
|
19
|
-
};
|
|
20
|
-
script.addEventListener('load', setAttributeFromEvent);
|
|
21
|
-
script.addEventListener('error', setAttributeFromEvent);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
var status_1 = script === null || script === void 0 ? void 0 : script.getAttribute('data-status');
|
|
25
|
-
setStatus(status_1);
|
|
26
|
-
}
|
|
27
|
-
var setStateFromEvent = function (event) {
|
|
28
|
-
setStatus(event.type === 'load' ? 'ready' : 'error');
|
|
29
|
-
};
|
|
30
|
-
script.addEventListener('load', setStateFromEvent);
|
|
31
|
-
script.addEventListener('error', setStateFromEvent);
|
|
32
|
-
return function () {
|
|
33
|
-
if (script) {
|
|
34
|
-
script.removeEventListener('load', setStateFromEvent);
|
|
35
|
-
script.removeEventListener('error', setStateFromEvent);
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}, [src]);
|
|
39
|
-
return status;
|
|
40
|
-
}
|