@tap-payments/apple-pay-button 0.0.90-development → 0.0.92-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 (41) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +240 -240
  3. package/build/@types/ApplePayButtonProps.d.ts +56 -56
  4. package/build/@types/ApplePayButtonProps.js +1 -1
  5. package/build/@types/charge.d.ts +56 -56
  6. package/build/@types/charge.js +1 -1
  7. package/build/@types/checkoutProfile.d.ts +216 -216
  8. package/build/@types/checkoutProfile.js +1 -1
  9. package/build/@types/enums.d.ts +44 -45
  10. package/build/@types/enums.js +51 -52
  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 +31 -31
  18. package/build/api.js +236 -236
  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 +48 -48
  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 +81 -81
  28. package/build/hooks/useApplePay.js +424 -425
  29. package/build/hooks/useMerchantApplePay.d.ts +22 -22
  30. package/build/hooks/useMerchantApplePay.js +190 -190
  31. package/build/index.d.ts +5 -5
  32. package/build/index.js +14 -14
  33. package/build/utils/config.d.ts +14 -14
  34. package/build/utils/config.js +59 -57
  35. package/build/utils/defaultValues.d.ts +2 -2
  36. package/build/utils/defaultValues.js +27 -27
  37. package/build/utils/index.d.ts +3 -3
  38. package/build/utils/index.js +3 -3
  39. package/build/utils/theme.d.ts +13 -13
  40. package/build/utils/theme.js +62 -62
  41. package/package.json +109 -109
@@ -1,48 +1,48 @@
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 { useApplePay } from '../../hooks/useApplePay';
16
- import { findOrCreateElementAndInject, Locale, PayButton } from '@tap-payments/acceptance-sdk';
17
- var ApplePay = React.memo(function (props) {
18
- var _a, _b, _c;
19
- var _d = useApplePay({ buttonProps: props }), onClick = _d.onClick, mappedProps = _d.mappedProps, theme = _d.theme, isRounded = _d.isRounded, success = _d.success, error = _d.error, applePayPaymentMethodOptions = _d.applePayPaymentMethodOptions, profileData = _d.profileData;
20
- React.useEffect(function () {
21
- if (props.debug) {
22
- console.log('ApplePayButtonProps', props);
23
- }
24
- }, []);
25
- return (_jsx("div", __assign({ style: {
26
- width: '100%',
27
- display: 'flex',
28
- justifyContent: 'center'
29
- } }, { children: _jsx(PayButton, { shimmerLoader: !profileData || !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 }) })));
30
- });
31
- export function ApplePayButton(props) {
32
- return _jsx(ApplePay, __assign({}, props));
33
- }
34
- var tapConnectInstance = null;
35
- export var renderApplePayButton = function (props, elementId) {
36
- if (tapConnectInstance) {
37
- return tapConnectInstance;
38
- }
39
- var el = findOrCreateElementAndInject(elementId);
40
- var root = createRoot(el);
41
- root.render(_jsx(ApplePayButton, __assign({}, props)));
42
- var unmount = function () {
43
- root.unmount();
44
- tapConnectInstance = null;
45
- };
46
- tapConnectInstance = { unmount: unmount };
47
- return tapConnectInstance;
48
- };
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 { useApplePay } from '../../hooks/useApplePay';
16
+ import { findOrCreateElementAndInject, Locale, PayButton } from '@tap-payments/acceptance-sdk';
17
+ var ApplePay = React.memo(function (props) {
18
+ var _a, _b, _c;
19
+ var _d = useApplePay({ buttonProps: props }), onClick = _d.onClick, mappedProps = _d.mappedProps, theme = _d.theme, isRounded = _d.isRounded, success = _d.success, error = _d.error, applePayPaymentMethodOptions = _d.applePayPaymentMethodOptions, profileData = _d.profileData;
20
+ React.useEffect(function () {
21
+ if (props.debug) {
22
+ console.log('ApplePayButtonProps', props);
23
+ }
24
+ }, []);
25
+ return (_jsx("div", __assign({ style: {
26
+ width: '100%',
27
+ display: 'flex',
28
+ justifyContent: 'center'
29
+ } }, { children: _jsx(PayButton, { shimmerLoader: !profileData || !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 }) })));
30
+ });
31
+ export function ApplePayButton(props) {
32
+ return _jsx(ApplePay, __assign({}, props));
33
+ }
34
+ var tapConnectInstance = null;
35
+ export var renderApplePayButton = function (props, elementId) {
36
+ if (tapConnectInstance) {
37
+ return tapConnectInstance;
38
+ }
39
+ var el = findOrCreateElementAndInject(elementId);
40
+ var root = createRoot(el);
41
+ root.render(_jsx(ApplePayButton, __assign({}, props)));
42
+ var unmount = function () {
43
+ root.unmount();
44
+ tapConnectInstance = null;
45
+ };
46
+ tapConnectInstance = { unmount: unmount };
47
+ return tapConnectInstance;
48
+ };
@@ -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,81 +1,81 @@
1
- import { ApplePayButtonProps, ApplePayDataToLunchSDKFromMerchantSide, ApplePayRequestData, IntegrationType } from '../@types';
2
- import { Scope } from '@tap-payments/acceptance-sdk';
3
- interface UseApplePayParams {
4
- buttonProps: ApplePayButtonProps;
5
- }
6
- export declare const useApplePay: ({ buttonProps }: UseApplePayParams) => {
7
- onClick: () => void;
8
- loading: boolean;
9
- isIframeIntegration: boolean;
10
- onApplePayButtonClicked: () => Promise<void>;
11
- disabled: boolean;
12
- applePayRequestData: ApplePayRequestData | undefined;
13
- applePayRequestConfiguration: Omit<ApplePayDataToLunchSDKFromMerchantSide, "applePayRequestData"> | undefined;
14
- mappedProps: {
15
- interface: {
16
- locale?: import("@tap-payments/acceptance-sdk").Locale | undefined;
17
- theme?: import("@tap-payments/acceptance-sdk").ThemeMode | undefined;
18
- edges?: import("@tap-payments/acceptance-sdk").Edges | undefined;
19
- colorStyle?: import("@tap-payments/acceptance-sdk").ColorStyle | undefined;
20
- loader?: boolean | undefined;
21
- userExperience?: (string & {}) | "popup" | "page" | undefined;
22
- powered?: boolean | undefined;
23
- direction?: import("@tap-payments/acceptance-sdk").Direction | undefined;
24
- cardDirection?: import("@tap-payments/acceptance-sdk").Direction | undefined;
25
- } | undefined;
26
- merchant: import("@tap-payments/acceptance-sdk/build/@types").Merchant & {
27
- identifier?: string | undefined;
28
- };
29
- onClick?: ((data?: ApplePayDataToLunchSDKFromMerchantSide | undefined) => void) | undefined;
30
- integration?: IntegrationType | undefined;
31
- debug?: boolean | undefined;
32
- scope: Scope;
33
- order: import("@tap-payments/acceptance-sdk/build/@types").Order;
34
- invoice?: import("@tap-payments/acceptance-sdk/build/@types").Invoice | undefined;
35
- operator: import("@tap-payments/acceptance-sdk/build/@types").Operator;
36
- customer: import("@tap-payments/acceptance-sdk").CustomerWithNameOnCard;
37
- features?: import("@tap-payments/acceptance-sdk/build/@types").Features | undefined;
38
- acceptance?: import("@tap-payments/acceptance-sdk/build/@types").Acceptance | undefined;
39
- transaction?: import("@tap-payments/acceptance-sdk/build/@types").Transaction | undefined;
40
- fieldVisibility?: import("@tap-payments/acceptance-sdk/build/@types").FieldVisibility | undefined;
41
- post?: {
42
- [key: string]: any;
43
- url: string;
44
- } | undefined;
45
- redirect?: {
46
- [key: string]: any;
47
- url: string;
48
- } | undefined;
49
- metadata?: ({
50
- headers?: ({
51
- authorization: string;
52
- mdn: string;
53
- application: string;
54
- ip?: string | undefined;
55
- session?: string | undefined;
56
- } & {
57
- [x: string]: any;
58
- }) | undefined;
59
- profileData?: import("@tap-payments/acceptance-sdk").CheckoutProfileResponse | undefined;
60
- } & {
61
- [x: string]: any;
62
- }) | undefined;
63
- platform?: {
64
- id: string;
65
- } | undefined;
66
- onReady?: (() => void) | undefined;
67
- onError?: ((error: any) => void) | undefined;
68
- onCancel?: (() => void) | undefined;
69
- onSuccess?: ((data: any) => void) | undefined;
70
- onBinIdentification?: ((data: any) => void) | undefined;
71
- onChargeCreated?: ((charge: Record<string, any>) => void) | undefined;
72
- onOrderCreated?: ((orderId: string) => void) | undefined;
73
- };
74
- theme: import("@tap-payments/acceptance-sdk").ThemeMode;
75
- isRounded: boolean;
76
- success: boolean;
77
- error: boolean;
78
- applePayPaymentMethodOptions: import("@tap-payments/acceptance-sdk").PaymentMethod | null | undefined;
79
- profileData: import("@tap-payments/acceptance-sdk").CheckoutProfileResponse | undefined;
80
- };
81
- export {};
1
+ import { ApplePayButtonProps, ApplePayDataToLunchSDKFromMerchantSide, ApplePayRequestData, IntegrationType } from '../@types';
2
+ import { Scope } from '@tap-payments/acceptance-sdk';
3
+ interface UseApplePayParams {
4
+ buttonProps: ApplePayButtonProps;
5
+ }
6
+ export declare const useApplePay: ({ buttonProps }: UseApplePayParams) => {
7
+ onClick: () => void;
8
+ loading: boolean;
9
+ isIframeIntegration: boolean;
10
+ onApplePayButtonClicked: () => Promise<void>;
11
+ disabled: boolean;
12
+ applePayRequestData: ApplePayRequestData | undefined;
13
+ applePayRequestConfiguration: Omit<ApplePayDataToLunchSDKFromMerchantSide, "applePayRequestData"> | undefined;
14
+ mappedProps: {
15
+ interface: {
16
+ locale?: import("@tap-payments/acceptance-sdk").Locale | undefined;
17
+ theme?: import("@tap-payments/acceptance-sdk").ThemeMode | undefined;
18
+ edges?: import("@tap-payments/acceptance-sdk").Edges | undefined;
19
+ colorStyle?: import("@tap-payments/acceptance-sdk").ColorStyle | undefined;
20
+ loader?: boolean | undefined;
21
+ userExperience?: (string & {}) | "popup" | "page" | undefined;
22
+ powered?: boolean | undefined;
23
+ direction?: import("@tap-payments/acceptance-sdk").Direction | undefined;
24
+ cardDirection?: import("@tap-payments/acceptance-sdk").Direction | undefined;
25
+ } | undefined;
26
+ merchant: import("@tap-payments/acceptance-sdk/build/@types").Merchant & {
27
+ identifier?: string | undefined;
28
+ };
29
+ onClick?: ((data?: ApplePayDataToLunchSDKFromMerchantSide | undefined) => void) | undefined;
30
+ integration?: IntegrationType | undefined;
31
+ debug?: boolean | undefined;
32
+ scope: Scope;
33
+ order: import("@tap-payments/acceptance-sdk/build/@types").Order;
34
+ invoice?: import("@tap-payments/acceptance-sdk/build/@types").Invoice | undefined;
35
+ operator: import("@tap-payments/acceptance-sdk/build/@types").Operator;
36
+ customer: import("@tap-payments/acceptance-sdk").CustomerWithNameOnCard;
37
+ features?: import("@tap-payments/acceptance-sdk/build/@types").Features | undefined;
38
+ acceptance?: import("@tap-payments/acceptance-sdk/build/@types").Acceptance | undefined;
39
+ transaction?: import("@tap-payments/acceptance-sdk/build/@types").Transaction | undefined;
40
+ fieldVisibility?: import("@tap-payments/acceptance-sdk/build/@types").FieldVisibility | undefined;
41
+ post?: {
42
+ [key: string]: any;
43
+ url: string;
44
+ } | undefined;
45
+ redirect?: {
46
+ [key: string]: any;
47
+ url: string;
48
+ } | undefined;
49
+ metadata?: ({
50
+ headers?: ({
51
+ authorization: string;
52
+ mdn: string;
53
+ application: string;
54
+ ip?: string | undefined;
55
+ session?: string | undefined;
56
+ } & {
57
+ [x: string]: any;
58
+ }) | undefined;
59
+ profileData?: import("@tap-payments/acceptance-sdk").CheckoutProfileResponse | undefined;
60
+ } & {
61
+ [x: string]: any;
62
+ }) | undefined;
63
+ platform?: {
64
+ id: string;
65
+ } | undefined;
66
+ onReady?: (() => void) | undefined;
67
+ onError?: ((error: any) => void) | undefined;
68
+ onCancel?: (() => void) | undefined;
69
+ onSuccess?: ((data: any) => void) | undefined;
70
+ onBinIdentification?: ((data: any) => void) | undefined;
71
+ onChargeCreated?: ((charge: Record<string, any>) => void) | undefined;
72
+ onOrderCreated?: ((orderId: string) => void) | undefined;
73
+ };
74
+ theme: import("@tap-payments/acceptance-sdk").ThemeMode;
75
+ isRounded: boolean;
76
+ success: boolean;
77
+ error: boolean;
78
+ applePayPaymentMethodOptions: import("@tap-payments/acceptance-sdk").PaymentMethod | undefined;
79
+ profileData: import("@tap-payments/acceptance-sdk").CheckoutProfileResponse | undefined;
80
+ };
81
+ export {};