@tap-payments/apple-pay-button 0.0.82-development → 0.0.84-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.
Files changed (43) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +240 -240
  3. package/build/@types/ApplePayButtonProps.d.ts +129 -129
  4. package/build/@types/ApplePayButtonProps.js +1 -1
  5. package/build/@types/charge.d.ts +57 -57
  6. package/build/@types/charge.js +1 -1
  7. package/build/@types/checkoutProfile.d.ts +216 -195
  8. package/build/@types/checkoutProfile.js +1 -1
  9. package/build/@types/enums.d.ts +65 -65
  10. package/build/@types/enums.js +76 -76
  11. package/build/@types/index.d.ts +6 -6
  12. package/build/@types/index.js +6 -6
  13. package/build/@types/tapLocalisation.d.ts +193 -193
  14. package/build/@types/tapLocalisation.js +1 -1
  15. package/build/@types/tapTheme.d.ts +842 -842
  16. package/build/@types/tapTheme.js +1 -1
  17. package/build/api.d.ts +29 -29
  18. package/build/api.js +244 -244
  19. package/build/constants/index.d.ts +3 -3
  20. package/build/constants/index.js +3 -3
  21. package/build/features/ApplePayButton/ApplePayButton.d.ts +4 -4
  22. package/build/features/ApplePayButton/ApplePayButton.js +49 -49
  23. package/build/features/ApplePayButton/index.d.ts +3 -3
  24. package/build/features/ApplePayButton/index.js +2 -2
  25. package/build/hooks/index.d.ts +1 -1
  26. package/build/hooks/index.js +1 -1
  27. package/build/hooks/useApplePay.d.ts +93 -93
  28. package/build/hooks/useApplePay.js +447 -447
  29. package/build/hooks/useMerchantApplePay.d.ts +20 -20
  30. package/build/hooks/useMerchantApplePay.js +188 -176
  31. package/build/index.d.ts +4 -4
  32. package/build/index.js +13 -13
  33. package/build/utils/config.d.ts +14 -14
  34. package/build/utils/config.js +65 -65
  35. package/build/utils/defaultValues.d.ts +2 -2
  36. package/build/utils/defaultValues.js +27 -27
  37. package/build/utils/html.d.ts +1 -1
  38. package/build/utils/html.js +9 -9
  39. package/build/utils/index.d.ts +4 -4
  40. package/build/utils/index.js +4 -4
  41. package/build/utils/theme.d.ts +12 -12
  42. package/build/utils/theme.js +61 -61
  43. package/package.json +109 -109
@@ -1,49 +1,49 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import * as React from 'react';
14
- import { createRoot } from 'react-dom/client';
15
- import { findOrCreateElementAndInject } from '../../utils';
16
- import { useApplePay } from '../../hooks/useApplePay';
17
- import { Locale, PayButton } from '@tap-payments/acceptance-sdk';
18
- var ApplePay = React.memo(function (props) {
19
- var _a, _b, _c;
20
- var _d = useApplePay({ buttonProps: props }), onClick = _d.onClick, initialLoading = _d.initialLoading, mappedProps = _d.mappedProps, theme = _d.theme, isRounded = _d.isRounded, success = _d.success, error = _d.error, applePayPaymentMethodOptions = _d.applePayPaymentMethodOptions, profileData = _d.profileData;
21
- React.useEffect(function () {
22
- if (props.debug) {
23
- console.log('ApplePayButtonProps', props);
24
- }
25
- }, []);
26
- return (_jsx("div", __assign({ style: {
27
- width: '100%',
28
- display: 'flex',
29
- justifyContent: 'center'
30
- } }, { children: _jsx(PayButton, { shimmerLoader: !profileData || initialLoading || !applePayPaymentMethodOptions, locale: ((_a = mappedProps.interface) === null || _a === void 0 ? void 0 : _a.locale) || Locale.EN, theme: theme, edges: (_b = mappedProps.interface) === null || _b === void 0 ? void 0 : _b.edges, colorStyle: (_c = mappedProps.interface) === null || _c === void 0 ? void 0 : _c.colorStyle, isFailed: error, isRounded: isRounded, isSuccess: success, onClick: onClick, buttonStyle: applePayPaymentMethodOptions === null || applePayPaymentMethodOptions === void 0 ? void 0 : applePayPaymentMethodOptions.button_style }) })));
31
- });
32
- export function ApplePayButton(props) {
33
- return _jsx(ApplePay, __assign({}, props));
34
- }
35
- var tapConnectInstance = null;
36
- export var renderApplePayButton = function (props, elementId) {
37
- if (tapConnectInstance) {
38
- return tapConnectInstance;
39
- }
40
- var el = findOrCreateElementAndInject(elementId);
41
- var root = createRoot(el);
42
- root.render(_jsx(ApplePayButton, __assign({}, props)));
43
- var unmount = function () {
44
- root.unmount();
45
- tapConnectInstance = null;
46
- };
47
- tapConnectInstance = { unmount: unmount };
48
- return tapConnectInstance;
49
- };
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import * as React from 'react';
14
+ import { createRoot } from 'react-dom/client';
15
+ import { findOrCreateElementAndInject } from '../../utils';
16
+ import { useApplePay } from '../../hooks/useApplePay';
17
+ import { Locale, PayButton } from '@tap-payments/acceptance-sdk';
18
+ var ApplePay = React.memo(function (props) {
19
+ var _a, _b, _c;
20
+ var _d = useApplePay({ buttonProps: props }), onClick = _d.onClick, initialLoading = _d.initialLoading, mappedProps = _d.mappedProps, theme = _d.theme, isRounded = _d.isRounded, success = _d.success, error = _d.error, applePayPaymentMethodOptions = _d.applePayPaymentMethodOptions, profileData = _d.profileData;
21
+ React.useEffect(function () {
22
+ if (props.debug) {
23
+ console.log('ApplePayButtonProps', props);
24
+ }
25
+ }, []);
26
+ return (_jsx("div", __assign({ style: {
27
+ width: '100%',
28
+ display: 'flex',
29
+ justifyContent: 'center'
30
+ } }, { children: _jsx(PayButton, { shimmerLoader: !profileData || initialLoading || !applePayPaymentMethodOptions, locale: ((_a = mappedProps.interface) === null || _a === void 0 ? void 0 : _a.locale) || Locale.EN, theme: theme, edges: (_b = mappedProps.interface) === null || _b === void 0 ? void 0 : _b.edges, colorStyle: (_c = mappedProps.interface) === null || _c === void 0 ? void 0 : _c.colorStyle, isFailed: error, isRounded: isRounded, isSuccess: success, onClick: onClick, buttonStyle: applePayPaymentMethodOptions === null || applePayPaymentMethodOptions === void 0 ? void 0 : applePayPaymentMethodOptions.button_style }) })));
31
+ });
32
+ export function ApplePayButton(props) {
33
+ return _jsx(ApplePay, __assign({}, props));
34
+ }
35
+ var tapConnectInstance = null;
36
+ export var renderApplePayButton = function (props, elementId) {
37
+ if (tapConnectInstance) {
38
+ return tapConnectInstance;
39
+ }
40
+ var el = findOrCreateElementAndInject(elementId);
41
+ var root = createRoot(el);
42
+ root.render(_jsx(ApplePayButton, __assign({}, props)));
43
+ var unmount = function () {
44
+ root.unmount();
45
+ tapConnectInstance = null;
46
+ };
47
+ tapConnectInstance = { unmount: unmount };
48
+ return tapConnectInstance;
49
+ };
@@ -1,3 +1,3 @@
1
- import { ApplePayButtonProps, ApplePayButton, renderApplePayButton, ApplePayRequestData } from './ApplePayButton';
2
- export { ApplePayButton, renderApplePayButton };
3
- export type { ApplePayButtonProps, ApplePayRequestData };
1
+ import { ApplePayButtonProps, ApplePayButton, renderApplePayButton, ApplePayRequestData } from './ApplePayButton';
2
+ export { ApplePayButton, renderApplePayButton };
3
+ export type { ApplePayButtonProps, ApplePayRequestData };
@@ -1,2 +1,2 @@
1
- import { ApplePayButton, renderApplePayButton } from './ApplePayButton';
2
- export { ApplePayButton, renderApplePayButton };
1
+ import { ApplePayButton, renderApplePayButton } from './ApplePayButton';
2
+ export { ApplePayButton, renderApplePayButton };
@@ -1 +1 @@
1
- export * from './useApplePay';
1
+ export * from './useApplePay';
@@ -1 +1 @@
1
- export * from './useApplePay';
1
+ export * from './useApplePay';
@@ -1,93 +1,93 @@
1
- import { ApplePayButtonProps, ApplePayDataToLunchSDKFromMerchantSide, ApplePayRequestData, MetaData, Scope } from '../@types';
2
- interface UsaApplePayProps {
3
- buttonProps: ApplePayButtonProps;
4
- }
5
- export declare const useApplePay: ({ buttonProps }: UsaApplePayProps) => {
6
- onClick: () => void;
7
- loading: boolean;
8
- isIframeIntegration: boolean;
9
- onApplePayButtonClicked: () => Promise<void>;
10
- disabled: boolean;
11
- applePayRequestData: ApplePayRequestData | undefined;
12
- applePayRequestConfiguration: Omit<ApplePayDataToLunchSDKFromMerchantSide, "applePayRequestData"> | undefined;
13
- mappedProps: {
14
- interface: {
15
- locale?: import("@tap-payments/acceptance-sdk").Locale | undefined;
16
- theme?: import("@tap-payments/acceptance-sdk").ThemeMode | undefined;
17
- edges?: import("@tap-payments/acceptance-sdk").Edges | undefined;
18
- colorStyle?: import("@tap-payments/acceptance-sdk").ColorStyle | undefined;
19
- loader?: boolean | undefined;
20
- userExperience?: "popup" | "page" | undefined;
21
- powered?: boolean | undefined;
22
- direction?: import("@tap-payments/acceptance-sdk").Direction | undefined;
23
- cardDirection?: import("@tap-payments/acceptance-sdk").Direction | undefined;
24
- } | undefined;
25
- operator: {
26
- publicKey: string;
27
- hashstring?: string | undefined;
28
- };
29
- merchant: {
30
- id: string;
31
- identifier?: string | undefined;
32
- };
33
- scope: Scope;
34
- customer?: import("../@types").Customer | undefined;
35
- acceptance?: import("../@types").Acceptance | undefined;
36
- transaction?: {
37
- authentication?: boolean | undefined;
38
- authorize?: {
39
- auto: {
40
- type: string;
41
- time: number;
42
- };
43
- } | undefined;
44
- metadata?: Record<string, string> | undefined;
45
- reference?: string | undefined;
46
- paymentAgreement?: {
47
- id: string;
48
- contract?: {
49
- id: string;
50
- } | undefined;
51
- } | undefined;
52
- destinations?: Record<string, any> | undefined;
53
- } | undefined;
54
- invoice?: {
55
- id: string;
56
- } | undefined;
57
- order: {
58
- amount: number;
59
- currency: string;
60
- id?: string | undefined;
61
- description?: string | undefined;
62
- metadata?: Record<string, string> | undefined;
63
- reference?: string | undefined;
64
- };
65
- post?: {
66
- url: string;
67
- } | undefined;
68
- redirect?: {
69
- url: string;
70
- } | undefined;
71
- onOrderCreated?: ((orderId: string) => void) | undefined;
72
- onCancel?: (() => void) | undefined;
73
- onError?: ((error: any) => void) | undefined;
74
- onSuccess?: ((data: Record<string, any>) => Promise<void>) | undefined;
75
- onClick?: ((data?: ApplePayDataToLunchSDKFromMerchantSide | undefined) => void) | undefined;
76
- onReady?: (() => void) | undefined;
77
- metaData?: MetaData | undefined;
78
- debug?: boolean | undefined;
79
- integration?: "iframe" | "sdk" | undefined;
80
- headers?: {
81
- mdn: string;
82
- application: string;
83
- } | undefined;
84
- };
85
- theme: import("../@types").ThemeMode;
86
- initialLoading: boolean;
87
- isRounded: boolean;
88
- success: boolean;
89
- error: boolean;
90
- applePayPaymentMethodOptions: import("../@types").PaymentMethod | null;
91
- profileData: Pick<MetaData, "merchant" | "payment_options"> | undefined;
92
- };
93
- export {};
1
+ import { ApplePayButtonProps, ApplePayDataToLunchSDKFromMerchantSide, ApplePayRequestData, MetaData, Scope } from '../@types';
2
+ interface UsaApplePayProps {
3
+ buttonProps: ApplePayButtonProps;
4
+ }
5
+ export declare const useApplePay: ({ buttonProps }: UsaApplePayProps) => {
6
+ onClick: () => void;
7
+ loading: boolean;
8
+ isIframeIntegration: boolean;
9
+ onApplePayButtonClicked: () => Promise<void>;
10
+ disabled: boolean;
11
+ applePayRequestData: ApplePayRequestData | undefined;
12
+ applePayRequestConfiguration: Omit<ApplePayDataToLunchSDKFromMerchantSide, "applePayRequestData"> | undefined;
13
+ mappedProps: {
14
+ interface: {
15
+ locale?: import("@tap-payments/acceptance-sdk").Locale | undefined;
16
+ theme?: import("@tap-payments/acceptance-sdk").ThemeMode | undefined;
17
+ edges?: import("@tap-payments/acceptance-sdk").Edges | undefined;
18
+ colorStyle?: import("@tap-payments/acceptance-sdk").ColorStyle | undefined;
19
+ loader?: boolean | undefined;
20
+ userExperience?: "popup" | "page" | undefined;
21
+ powered?: boolean | undefined;
22
+ direction?: import("@tap-payments/acceptance-sdk").Direction | undefined;
23
+ cardDirection?: import("@tap-payments/acceptance-sdk").Direction | undefined;
24
+ } | undefined;
25
+ operator: {
26
+ publicKey: string;
27
+ hashstring?: string | undefined;
28
+ };
29
+ merchant: {
30
+ id: string;
31
+ identifier?: string | undefined;
32
+ };
33
+ scope: Scope;
34
+ customer?: import("../@types").Customer | undefined;
35
+ acceptance?: import("../@types").Acceptance | undefined;
36
+ transaction?: {
37
+ authentication?: boolean | undefined;
38
+ authorize?: {
39
+ auto: {
40
+ type: string;
41
+ time: number;
42
+ };
43
+ } | undefined;
44
+ metadata?: Record<string, string> | undefined;
45
+ reference?: string | undefined;
46
+ paymentAgreement?: {
47
+ id: string;
48
+ contract?: {
49
+ id: string;
50
+ } | undefined;
51
+ } | undefined;
52
+ destinations?: Record<string, any> | undefined;
53
+ } | undefined;
54
+ invoice?: {
55
+ id: string;
56
+ } | undefined;
57
+ order: {
58
+ amount: number;
59
+ currency: string;
60
+ id?: string | undefined;
61
+ description?: string | undefined;
62
+ metadata?: Record<string, string> | undefined;
63
+ reference?: string | undefined;
64
+ };
65
+ post?: {
66
+ url: string;
67
+ } | undefined;
68
+ redirect?: {
69
+ url: string;
70
+ } | undefined;
71
+ onOrderCreated?: ((orderId: string) => void) | undefined;
72
+ onCancel?: (() => void) | undefined;
73
+ onError?: ((error: any) => void) | undefined;
74
+ onSuccess?: ((data: Record<string, any>) => Promise<void>) | undefined;
75
+ onClick?: ((data?: ApplePayDataToLunchSDKFromMerchantSide | undefined) => void) | undefined;
76
+ onReady?: (() => void) | undefined;
77
+ metaData?: MetaData | undefined;
78
+ debug?: boolean | undefined;
79
+ integration?: "iframe" | "sdk" | undefined;
80
+ headers?: {
81
+ mdn: string;
82
+ application: string;
83
+ } | undefined;
84
+ };
85
+ theme: import("../@types").ThemeMode;
86
+ initialLoading: boolean;
87
+ isRounded: boolean;
88
+ success: boolean;
89
+ error: boolean;
90
+ applePayPaymentMethodOptions: import("../@types").PaymentMethod | null;
91
+ profileData: Pick<MetaData, "merchant" | "payment_options"> | undefined;
92
+ };
93
+ export {};