@tap-payments/apple-pay-button 0.0.55-development → 0.0.57-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 (59) hide show
  1. package/build/@types/ApplePayButtonProps.d.ts +129 -0
  2. package/build/@types/ApplePayButtonProps.js +1 -0
  3. package/build/@types/charge.d.ts +57 -0
  4. package/build/@types/charge.js +1 -0
  5. package/build/@types/checkoutProfile.d.ts +194 -0
  6. package/build/@types/checkoutProfile.js +1 -0
  7. package/build/@types/enums.d.ts +71 -0
  8. package/build/@types/enums.js +83 -0
  9. package/build/@types/index.d.ts +6 -233
  10. package/build/@types/index.js +6 -1
  11. package/build/@types/tapLocalisation.d.ts +193 -0
  12. package/build/@types/tapLocalisation.js +1 -0
  13. package/build/@types/tapTheme.d.ts +842 -0
  14. package/build/@types/tapTheme.js +1 -0
  15. package/build/api/app.service.d.ts +1 -1
  16. package/build/api/app.service.js +2 -1
  17. package/build/api/httpClient.d.ts +1 -1
  18. package/build/assets/lottie/Dark_Mode_Loader.json +255 -0
  19. package/build/assets/lottie/Light_Mode_Loader.json +255 -0
  20. package/build/components/ActionButton/ActionButton.d.ts +24 -0
  21. package/build/components/ActionButton/ActionButton.js +61 -0
  22. package/build/components/ActionButton/index.d.ts +2 -0
  23. package/build/components/ActionButton/index.js +2 -0
  24. package/build/components/InitialLoader/InitialLoader.d.ts +9 -0
  25. package/build/components/InitialLoader/InitialLoader.js +29 -0
  26. package/build/components/InitialLoader/index.d.ts +2 -0
  27. package/build/components/InitialLoader/index.js +2 -0
  28. package/build/components/Loader/Loader.d.ts +24 -0
  29. package/build/components/Loader/Loader.js +48 -0
  30. package/build/components/Loader/index.d.ts +2 -0
  31. package/build/components/Loader/index.js +2 -0
  32. package/build/components/PayButton/PayButton.d.ts +15 -0
  33. package/build/components/PayButton/PayButton.js +40 -0
  34. package/build/components/PayButton/index.d.ts +2 -0
  35. package/build/components/PayButton/index.js +2 -0
  36. package/build/components/PayButton/style.d.ts +11 -0
  37. package/build/components/PayButton/style.js +41 -0
  38. package/build/constants/index.d.ts +2 -66
  39. package/build/constants/index.js +2 -66
  40. package/build/features/ApplePayButton/ApplePayButton.js +7 -19
  41. package/build/features/ApplePayButton/style.d.ts +2 -0
  42. package/build/features/ApplePayButton/style.js +12 -0
  43. package/build/hooks/useApplePay.d.ts +87 -7
  44. package/build/hooks/useApplePay.js +93 -12
  45. package/build/hooks/useMerchantApplePay.d.ts +1 -2
  46. package/build/hooks/useMerchantApplePay.js +1 -1
  47. package/build/hooks/useScript.d.ts +3 -1
  48. package/build/hooks/useScript.js +3 -2
  49. package/build/index.d.ts +1 -1
  50. package/build/index.js +1 -1
  51. package/build/utils/config.d.ts +1 -1
  52. package/build/utils/config.js +10 -10
  53. package/build/utils/defaultValues.d.ts +10 -7
  54. package/build/utils/defaultValues.js +1 -1
  55. package/build/utils/index.d.ts +3 -0
  56. package/build/utils/index.js +3 -0
  57. package/build/utils/theme.d.ts +12 -0
  58. package/build/utils/theme.js +61 -0
  59. package/package.json +16 -10
@@ -0,0 +1,29 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import Lottie from 'lottie-react';
3
+ import DarkLoader from '../../assets/lottie/Dark_Mode_Loader.json';
4
+ import LightLoader from '../../assets/lottie/Light_Mode_Loader.json';
5
+ import { Edges, ThemeMode } from '../../@types/enums';
6
+ import { styled } from '@mui/material/styles';
7
+ var StyledLottie = styled(Lottie, {
8
+ shouldForwardProp: function (prop) { return !['edges'].includes(prop); }
9
+ })(function (_a) {
10
+ var edges = _a.edges;
11
+ return ({
12
+ border: 'none',
13
+ width: '100%',
14
+ borderRadius: edges === Edges.STRAIGHT ? '0' : '10px',
15
+ overflow: 'hidden',
16
+ height: '48px',
17
+ maxWidth: '360px',
18
+ minWidth: '170px',
19
+ '& svg': {
20
+ width: '100%'
21
+ }
22
+ });
23
+ });
24
+ export default function InitialLoader(_a) {
25
+ var open = _a.open, themeMode = _a.themeMode, edges = _a.edges;
26
+ if (!open)
27
+ return null;
28
+ return (_jsx(StyledLottie, { animationData: themeMode === ThemeMode.DARK ? DarkLoader : LightLoader, edges: edges, loop: true }));
29
+ }
@@ -0,0 +1,2 @@
1
+ import InitialLoader from './InitialLoader';
2
+ export default InitialLoader;
@@ -0,0 +1,2 @@
1
+ import InitialLoader from './InitialLoader';
2
+ export default InitialLoader;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ export interface LoaderProps {
3
+ outerColor?: string;
4
+ innerColor?: string;
5
+ duration?: number;
6
+ toggleAnimation?: boolean;
7
+ size?: number | string;
8
+ style?: React.CSSProperties;
9
+ className?: string;
10
+ }
11
+ declare function Loader({ duration, innerColor, outerColor, size, style, toggleAnimation }: LoaderProps): JSX.Element;
12
+ declare namespace Loader {
13
+ var defaultProps: {
14
+ outerColor: string;
15
+ innerColor: string;
16
+ duration: number;
17
+ toggleAnimation: boolean;
18
+ size: number;
19
+ style: null;
20
+ className: string;
21
+ };
22
+ }
23
+ declare const _default: React.MemoExoticComponent<typeof Loader>;
24
+ export default _default;
@@ -0,0 +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, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import React from 'react';
14
+ import { styled } from '@mui/material/styles';
15
+ var RootStyled = styled('div')(function (_a) {
16
+ var size = _a.size;
17
+ return (__assign({ '&:before': {
18
+ content: '""',
19
+ display: 'block',
20
+ paddingTop: '100%'
21
+ }, position: 'relative', margin: '0px auto', width: '30px', height: '30px' }, (size && {
22
+ width: size,
23
+ height: size
24
+ })));
25
+ });
26
+ var LoaderBoxStyled = styled('svg')(function () { return ({
27
+ height: '100%',
28
+ transformOrigin: 'center center',
29
+ width: '100%',
30
+ position: 'absolute',
31
+ top: 0,
32
+ left: 0,
33
+ margin: 'auto'
34
+ }); });
35
+ function Loader(_a) {
36
+ var duration = _a.duration, innerColor = _a.innerColor, outerColor = _a.outerColor, size = _a.size, style = _a.style, toggleAnimation = _a.toggleAnimation;
37
+ return (_jsx(RootStyled, __assign({ className: 'loader', style: style, size: size }, { children: _jsxs(LoaderBoxStyled, __assign({ className: 'circular-loader', viewBox: '25 25 50 50' }, { children: [_jsx("circle", __assign({ cx: '50', cy: '50', r: '20', fill: 'none', stroke: outerColor || 'black', strokeWidth: '3.6px', strokeLinecap: 'round', strokeDasharray: ' 125, 124' }, { children: toggleAnimation && (_jsxs(_Fragment, { children: [_jsx("animateTransform", { attributeName: 'transform', type: 'rotate', from: '0 50 50', to: '360 50 50', dur: "".concat(duration || 0 / 3, "s"), repeatCount: 'indefinite' }), _jsx("animate", { attributeName: 'stroke-dashoffset', values: '0; 122; 122; 0; 0', keyTimes: '0; 0.45; 0.55; 0.9; 1', dur: "".concat(duration, "s"), repeatCount: 'indefinite' })] })) })), _jsx("circle", __assign({ cx: '50', cy: '50', r: '14', fill: 'none', stroke: innerColor || 'black', strokeWidth: ' 3.6px', strokeLinecap: 'round', strokeDasharray: ' 88, 124' }, { children: toggleAnimation && (_jsxs(_Fragment, { children: [_jsx("animateTransform", { attributeName: 'transform', type: 'rotate', from: '360 50 50', to: '0 50 50', dur: "".concat(duration || 0 / 3, "s"), repeatCount: 'indefinite' }), _jsx("animate", { attributeName: 'stroke-dashoffset', values: '0; -85; -85; 0; 0', keyTimes: '0; 0.45; 0.55; 0.9; 1', dur: "".concat(duration, "s"), repeatCount: 'indefinite' })] })) }))] })) })));
38
+ }
39
+ Loader.defaultProps = {
40
+ outerColor: '#423e3c',
41
+ innerColor: '#423e3c',
42
+ duration: 5,
43
+ toggleAnimation: false,
44
+ size: 50,
45
+ style: null,
46
+ className: ''
47
+ };
48
+ export default React.memo(Loader);
@@ -0,0 +1,2 @@
1
+ import Loader from './Loader';
2
+ export default Loader;
@@ -0,0 +1,2 @@
1
+ import Loader from './Loader';
2
+ export default Loader;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { Edges, ThemeMode } from '../../@types/enums';
3
+ export interface PayButtonProps {
4
+ theme: ThemeMode;
5
+ isRounded?: boolean;
6
+ isFailed?: boolean;
7
+ isSuccess?: boolean;
8
+ bgColor?: string;
9
+ gradientColor?: string;
10
+ edges?: Edges;
11
+ titleAsset?: string;
12
+ onClick: () => void;
13
+ }
14
+ declare const _default: React.NamedExoticComponent<PayButtonProps>;
15
+ export default _default;
@@ -0,0 +1,40 @@
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 { memo } from 'react';
14
+ import Loader from '../Loader';
15
+ import ActionButton from '../ActionButton';
16
+ import WhiteSuccessGif from '../../assets/gif/success-white.gif';
17
+ import WhiteErrorGif from '../../assets/gif/error-white.gif';
18
+ import BlackSuccessGif from '../../assets/gif/success-black.gif';
19
+ import BlackErrorGif from '../../assets/gif/error-black.gif';
20
+ import { StyledContainerLoader } from './style';
21
+ import { Edges, ThemeMode } from '../../@types/enums';
22
+ var PayButton = function (_a) {
23
+ var theme = _a.theme, isRounded = _a.isRounded, isFailed = _a.isFailed, isSuccess = _a.isSuccess, bgColor = _a.bgColor, gradientColor = _a.gradientColor, edges = _a.edges, titleAsset = _a.titleAsset, onClick = _a.onClick;
24
+ var renderButtonLabel = function () {
25
+ if (isFailed) {
26
+ return _jsx("img", { src: theme === ThemeMode.DARK ? BlackErrorGif : WhiteErrorGif, alt: 'error', width: 30, height: 30 });
27
+ }
28
+ if (isSuccess) {
29
+ return (_jsx("img", { src: theme === ThemeMode.DARK ? BlackSuccessGif : WhiteSuccessGif, alt: 'success', width: 30, height: 30 }));
30
+ }
31
+ if (isRounded) {
32
+ return (_jsx(Loader, { toggleAnimation: true, size: 28, outerColor: theme === ThemeMode.DARK ? 'black' : 'white', innerColor: theme === ThemeMode.DARK ? 'black' : 'white' }));
33
+ }
34
+ return _jsx("img", { src: titleAsset, alt: 'logo' });
35
+ };
36
+ return (_jsx(StyledContainerLoader, __assign({ "data-testid": 'PayButton', "data-src": 'apple-pay-button-element', "data-is-rounded": isRounded, "data-is-error": isFailed, "data-is-success": isSuccess, edges: edges }, { children: _jsx(ActionButton, __assign({ "data-testid": 'PayButton-ActionButton', "data-src": 'apple-pay-button-element', "data-is-error": isFailed, "data-is-success": isSuccess, gradientColor: gradientColor, bgColor: bgColor, rounded: isRounded, onClick: onClick, style: {
37
+ borderRadius: edges === Edges.STRAIGHT ? '0px' : '30px'
38
+ } }, { children: renderButtonLabel() })) })));
39
+ };
40
+ export default memo(PayButton);
@@ -0,0 +1,2 @@
1
+ import PayButton from './PayButton';
2
+ export default PayButton;
@@ -0,0 +1,2 @@
1
+ import PayButton from './PayButton';
2
+ export default PayButton;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { Edges } from '../../@types';
3
+ export declare const StyledContainerLoader: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
4
+ edges?: Edges | undefined;
5
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
6
+ export declare const DisabledButton: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
7
+ edges?: Edges | undefined;
8
+ backgroundColor?: string | undefined;
9
+ color?: string | undefined;
10
+ font?: string | undefined;
11
+ }, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
@@ -0,0 +1,41 @@
1
+ import { styled } from '@mui/material/styles';
2
+ import { Edges } from '../../@types';
3
+ export var StyledContainerLoader = styled('section', {
4
+ shouldForwardProp: function (prop) { return prop !== 'edges'; }
5
+ })(function (_a) {
6
+ var edges = _a.edges;
7
+ return ({
8
+ width: '100%',
9
+ height: '48px',
10
+ maxWidth: '360px',
11
+ justifyContent: 'center',
12
+ display: 'flex',
13
+ background: 'transparent',
14
+ borderRadius: edges === Edges.STRAIGHT ? '0px' : '30px',
15
+ padding: 0,
16
+ margin: 0,
17
+ overflow: 'hidden'
18
+ });
19
+ });
20
+ export var DisabledButton = styled('button', {
21
+ shouldForwardProp: function (prop) { return !['edges', 'backgroundColor', 'color', 'font'].includes(prop); }
22
+ })(function (_a) {
23
+ var edges = _a.edges, backgroundColor = _a.backgroundColor, color = _a.color, font = _a.font;
24
+ return ({
25
+ border: 'none',
26
+ width: 'calc(100% - 16px)',
27
+ borderRadius: edges === Edges.STRAIGHT ? '0px' : '30px',
28
+ overflow: 'hidden',
29
+ height: '48px',
30
+ color: color,
31
+ backgroundColor: backgroundColor,
32
+ maxWidth: '360px',
33
+ minWidth: '170px',
34
+ pointerEvents: 'none',
35
+ cursor: 'not-allowed',
36
+ display: 'flex',
37
+ justifyContent: 'center',
38
+ alignItems: 'center',
39
+ font: font
40
+ });
41
+ });
@@ -1,72 +1,8 @@
1
- export declare const Scope: {
2
- readonly CHARGE: "charge";
3
- readonly AUTHORIZE: "authorize";
4
- readonly TAP_TOKEN: "taptoken";
5
- readonly APPLE_PAY_TOKEN: "applepaytoken";
6
- };
7
- export declare const ButtonStyle: {
8
- readonly Black: "black";
9
- readonly White: "white";
10
- readonly WhiteOutline: "white-outline";
11
- };
12
- export declare const Locale: {
13
- readonly EN: "en";
14
- readonly AR: "ar";
15
- readonly DYNAMIC: "dynamic";
16
- };
17
- export declare const ColorStyle: {
18
- readonly COLORED: "colored";
19
- readonly MONOCHROME: "monochrome";
20
- };
21
- export declare const FullThemeMode: {
22
- readonly DARK: "dark";
23
- readonly LIGHT: "light";
24
- readonly LIGHT_MONO: "light_mono";
25
- readonly DARK_COLORED: "dark_colored";
26
- };
27
- export declare const ButtonType: {
28
- readonly BOOK: "book";
29
- readonly BUY: "buy";
30
- readonly CHECK_OUT: "check-out";
31
- readonly PAY: "pay";
32
- readonly PLAIN: "plain";
33
- readonly SUBSCRIBE: "subscribe";
34
- };
35
- export declare const ThemeMode: {
36
- readonly DARK: "dark";
37
- readonly LIGHT: "light";
38
- readonly DYNAMIC: "dynamic";
39
- };
40
- export declare const Edges: {
41
- readonly STRAIGHT: "straight";
42
- readonly CURVED: "curved";
43
- };
44
- export declare const MerchantCapabilities: {
45
- readonly Supports3DS: "supports3DS";
46
- readonly SupportsCredit: "supportsCredit";
47
- readonly SupportsDebit: "supportsDebit";
48
- };
49
- export declare const SupportedNetworks: {
50
- readonly Amex: "amex";
51
- readonly Mada: "mada";
52
- readonly MasterCard: "masterCard";
53
- readonly Visa: "visa";
54
- readonly ChinaUnionPay: "chinaUnionPay";
55
- readonly Discover: "discover";
56
- readonly Electron: "electron";
57
- readonly Jcb: "jcb";
58
- readonly Maestro: "maestro";
59
- };
60
1
  export declare const ApplePayVersion = 5;
61
- export declare const Environment: {
62
- readonly Production: "production";
63
- readonly Sandbox: "sandbox";
64
- readonly Beta: "beta";
65
- readonly Development: "development";
66
- readonly Staging: "staging";
67
- };
68
2
  export declare const RSA_DEV_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8AX++RtxPZFtns4XzXFlDIxPBh0umN4qRXZaKDIlb6a3MknaB7psJWmf2l+e4Cfh9b5tey/+rZqpQ065eXTZfGCAuBLt+fYLQBhLfjRpk8S6hlIzc1Kdjg65uqzMwcTd0p7I4KLwHk1I0oXzuEu53fU1LSZhWp4Mnd6wjVgXAsQIDAQAB\n-----END PUBLIC KEY-----";
69
3
  export declare const RSA_SANDBOX_MW_PUBLIC_KEY = "";
70
4
  export declare const RSA_PRODUCTION_MW_PUBLIC_KEY = "";
71
5
  export declare const RSA_BETA_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9hSRms7Ir1HmzdZxGXFYgmpi3\nez7VBFje0f8wwrxYS9oVoBtN4iAt0DOs3DbeuqtueI31wtpFVUMGg8W7R0SbtkZd\nGzszQNqt/wyqxpDC9q+97XdXwkWQFA72s76ud7eMXQlsWKsvgwhY+Ywzt0KlpNC3\nHj+N6UWFOYK98Xi+sQIDAQAB\n-----END PUBLIC KEY-----";
72
6
  export declare const RSA_STAGING_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCi9W5jyTvA4Iwv3V5sfNQ7VdSz\n7WqwBbnWFbIUL/GjaaE93mvDv4zbgRSznHaHQPH6pxrMhMh0tV58njkvjHvQ/tvg\npwM8SemNPKEEAPl69tnMvCrJRPh2dWL3OHY8yCW4c38Hyx4fy56Zd5cdoVWfCReu\njCsvASLGz+cfRrj2swIDAQAB\n-----END PUBLIC KEY-----";
7
+ export declare const MW_BASE_DEV_URL = "https://mw-sdk.dev.tap.company/v2/checkout";
8
+ export declare const MW_BASE_BETA_URL = "https://mw-sdk.beta.tap.company/v2/checkout";
@@ -1,72 +1,8 @@
1
- export var Scope = {
2
- CHARGE: 'charge',
3
- AUTHORIZE: 'authorize',
4
- TAP_TOKEN: 'taptoken',
5
- APPLE_PAY_TOKEN: 'applepaytoken'
6
- };
7
- export var ButtonStyle = {
8
- Black: 'black',
9
- White: 'white',
10
- WhiteOutline: 'white-outline'
11
- };
12
- export var Locale = {
13
- EN: 'en',
14
- AR: 'ar',
15
- DYNAMIC: 'dynamic'
16
- };
17
- export var ColorStyle = {
18
- COLORED: 'colored',
19
- MONOCHROME: 'monochrome'
20
- };
21
- export var FullThemeMode = {
22
- DARK: 'dark',
23
- LIGHT: 'light',
24
- LIGHT_MONO: 'light_mono',
25
- DARK_COLORED: 'dark_colored'
26
- };
27
- export var ButtonType = {
28
- BOOK: 'book',
29
- BUY: 'buy',
30
- CHECK_OUT: 'check-out',
31
- PAY: 'pay',
32
- PLAIN: 'plain',
33
- SUBSCRIBE: 'subscribe'
34
- };
35
- export var ThemeMode = {
36
- DARK: 'dark',
37
- LIGHT: 'light',
38
- DYNAMIC: 'dynamic'
39
- };
40
- export var Edges = {
41
- STRAIGHT: 'straight',
42
- CURVED: 'curved'
43
- };
44
- export var MerchantCapabilities = {
45
- Supports3DS: 'supports3DS',
46
- SupportsCredit: 'supportsCredit',
47
- SupportsDebit: 'supportsDebit'
48
- };
49
- export var SupportedNetworks = {
50
- Amex: 'amex',
51
- Mada: 'mada',
52
- MasterCard: 'masterCard',
53
- Visa: 'visa',
54
- ChinaUnionPay: 'chinaUnionPay',
55
- Discover: 'discover',
56
- Electron: 'electron',
57
- Jcb: 'jcb',
58
- Maestro: 'maestro'
59
- };
60
1
  export var ApplePayVersion = 5;
61
- export var Environment = {
62
- Production: 'production',
63
- Sandbox: 'sandbox',
64
- Beta: 'beta',
65
- Development: 'development',
66
- Staging: 'staging'
67
- };
68
2
  export var RSA_DEV_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC8AX++RtxPZFtns4XzXFlDIxPBh0umN4qRXZaKDIlb6a3MknaB7psJWmf2l+e4Cfh9b5tey/+rZqpQ065eXTZfGCAuBLt+fYLQBhLfjRpk8S6hlIzc1Kdjg65uqzMwcTd0p7I4KLwHk1I0oXzuEu53fU1LSZhWp4Mnd6wjVgXAsQIDAQAB\n-----END PUBLIC KEY-----";
69
3
  export var RSA_SANDBOX_MW_PUBLIC_KEY = "";
70
4
  export var RSA_PRODUCTION_MW_PUBLIC_KEY = "";
71
5
  export var RSA_BETA_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC9hSRms7Ir1HmzdZxGXFYgmpi3\nez7VBFje0f8wwrxYS9oVoBtN4iAt0DOs3DbeuqtueI31wtpFVUMGg8W7R0SbtkZd\nGzszQNqt/wyqxpDC9q+97XdXwkWQFA72s76ud7eMXQlsWKsvgwhY+Ywzt0KlpNC3\nHj+N6UWFOYK98Xi+sQIDAQAB\n-----END PUBLIC KEY-----";
72
6
  export var RSA_STAGING_MW_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCi9W5jyTvA4Iwv3V5sfNQ7VdSz\n7WqwBbnWFbIUL/GjaaE93mvDv4zbgRSznHaHQPH6pxrMhMh0tV58njkvjHvQ/tvg\npwM8SemNPKEEAPl69tnMvCrJRPh2dWL3OHY8yCW4c38Hyx4fy56Zd5cdoVWfCReu\njCsvASLGz+cfRrj2swIDAQAB\n-----END PUBLIC KEY-----";
7
+ export var MW_BASE_DEV_URL = 'https://mw-sdk.dev.tap.company/v2/checkout';
8
+ export var MW_BASE_BETA_URL = 'https://mw-sdk.beta.tap.company/v2/checkout';
@@ -9,36 +9,24 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
13
13
  import * as React from 'react';
14
14
  import { createRoot } from 'react-dom/client';
15
15
  import { findOrCreateElementAndInject } from '../../utils';
16
16
  import { useApplePay } from '../../hooks/useApplePay';
17
- import { getDefaultValues } from '../../utils/defaultValues';
18
- import { ButtonStyle, Edges, ThemeMode } from '../../constants';
17
+ import InitialLoader from '../../components/InitialLoader';
19
18
  import './ApplePayButton.css';
19
+ import { StyledContainer } from './style';
20
+ import PayButton from '../../components/PayButton';
20
21
  var ApplePay = React.memo(function (props) {
21
- var mappedProps = getDefaultValues(props);
22
- var _a = useApplePay(mappedProps), loading = _a.loading, onApplePayButtonClicked = _a.onApplePayButtonClicked, disabled = _a.disabled, applePayRequestData = _a.applePayRequestData, applePayRequestConfiguration = _a.applePayRequestConfiguration;
23
- var isIframeIntegration = props.integration === 'iframe';
22
+ var _a, _b, _c;
23
+ var _d = useApplePay({ buttonProps: props }), onClick = _d.onClick, loading = _d.loading, onApplePayButtonClicked = _d.onApplePayButtonClicked, disabled = _d.disabled, applePayRequestData = _d.applePayRequestData, isIframeIntegration = _d.isIframeIntegration, applePayRequestConfiguration = _d.applePayRequestConfiguration, mappedProps = _d.mappedProps, theme = _d.theme, isRounded = _d.isRounded, success = _d.success, error = _d.error, backgroundColor = _d.backgroundColor, gradientColor = _d.gradientColor, titleAsset = _d.titleAsset;
24
24
  React.useEffect(function () {
25
25
  if (props.debug) {
26
26
  console.log('ApplePayButtonProps', props);
27
27
  }
28
28
  }, []);
29
- return (_jsx("button", { className: 'button-applepay-tap', style: {
30
- ApplePayButtonType: mappedProps.interface.type,
31
- ApplePayButtonStyle: mappedProps.interface.theme === ThemeMode.DARK ? ButtonStyle.Black : ButtonStyle.White,
32
- borderRadius: mappedProps.interface.edges === Edges.STRAIGHT ? '0' : '10px'
33
- }, onClick: function () {
34
- var _a, _b;
35
- if (isIframeIntegration) {
36
- (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, __assign(__assign({}, applePayRequestConfiguration), { applePayRequestData: applePayRequestData }));
37
- return;
38
- }
39
- onApplePayButtonClicked();
40
- (_b = props.onClick) === null || _b === void 0 ? void 0 : _b.call(props);
41
- }, lang: mappedProps.interface.locale, disabled: loading || disabled }));
29
+ return (_jsx(StyledContainer, __assign({ "data-src": 'apple-pay-button-element', "data-testid": 'ApplePayButton-section' }, { children: loading ? (_jsx(InitialLoader, { open: true, themeMode: (_a = mappedProps.interface) === null || _a === void 0 ? void 0 : _a.theme, edges: (_b = mappedProps.interface) === null || _b === void 0 ? void 0 : _b.edges })) : (_jsx(_Fragment, { children: _jsx(PayButton, { "data-src": 'apple-pay-button-element', "data-testid": 'ApplePayButton', theme: theme, isRounded: isRounded, isSuccess: success, isFailed: error, bgColor: backgroundColor, gradientColor: gradientColor, titleAsset: titleAsset, edges: (_c = mappedProps.interface) === null || _c === void 0 ? void 0 : _c.edges, onClick: onClick }) })) })));
42
30
  });
43
31
  export function ApplePayButton(props) {
44
32
  return _jsx(ApplePay, __assign({}, props));
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledContainer: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
@@ -0,0 +1,12 @@
1
+ import { styled } from '@mui/material';
2
+ export var StyledContainer = styled('section')(function () { return ({
3
+ width: '100%',
4
+ display: 'flex',
5
+ justifyContent: 'center',
6
+ alignItems: 'center',
7
+ flexDirection: 'column',
8
+ margin: '0 auto',
9
+ height: '48px',
10
+ maxWidth: '360px',
11
+ minWidth: '170px'
12
+ }); });
@@ -1,11 +1,91 @@
1
- import { ApplePayButtonProps, ApplePayDataToLunchSDKFromMerchantSide, ApplePayRequestData } from '../@types';
2
- declare type UseApplePayProps = Omit<ApplePayButtonProps, 'buttonStyle'>;
3
- interface UseApplePayReturnProps {
1
+ import { Locale, Scope } from '../@types/enums';
2
+ import { ApplePayButtonProps, ApplePayDataToLunchSDKFromMerchantSide, ApplePayRequestData, MetaData } from '../@types';
3
+ interface UsaApplePayProps {
4
+ buttonProps: ApplePayButtonProps;
5
+ }
6
+ export declare const useApplePay: ({ buttonProps }: UsaApplePayProps) => {
7
+ onClick: () => void;
4
8
  loading: boolean;
9
+ isIframeIntegration: boolean;
5
10
  onApplePayButtonClicked: () => Promise<void>;
6
11
  disabled: boolean;
7
- applePayRequestData?: ApplePayRequestData;
8
- applePayRequestConfiguration?: Omit<ApplePayDataToLunchSDKFromMerchantSide, 'applePayRequestData'>;
9
- }
10
- export declare const useApplePay: ({ environment, interface: interfaceObj, merchant, customer, acceptance, scope, debug, onError, onSuccess, onCancel, onReady, metaData, headers, operator, order, onOrderCreated, integration, transaction, post, redirect }: UseApplePayProps) => UseApplePayReturnProps;
12
+ applePayRequestData: ApplePayRequestData | undefined;
13
+ applePayRequestConfiguration: Omit<ApplePayDataToLunchSDKFromMerchantSide, "applePayRequestData"> | undefined;
14
+ mappedProps: {
15
+ interface: {
16
+ locale?: Locale | undefined;
17
+ theme?: import("../@types").ThemeMode | undefined;
18
+ edges?: import("../@types").Edges | undefined;
19
+ type?: import("../@types").ButtonType | undefined;
20
+ colorStyle?: import("../@types").ColorStyle | undefined;
21
+ loader?: boolean | undefined;
22
+ };
23
+ operator: {
24
+ publicKey: string;
25
+ hashstring?: string | undefined;
26
+ };
27
+ merchant: {
28
+ id: string;
29
+ };
30
+ scope: Scope;
31
+ environment: import("../@types").Environment;
32
+ customer?: import("../@types").Customer | undefined;
33
+ acceptance?: import("../@types").Acceptance | undefined;
34
+ transaction?: {
35
+ authentication?: boolean | undefined;
36
+ authorize?: {
37
+ auto: {
38
+ type: string;
39
+ time: number;
40
+ };
41
+ } | undefined;
42
+ metadata?: Record<string, string> | undefined;
43
+ reference?: string | undefined;
44
+ paymentAgreement?: {
45
+ id: string;
46
+ contract?: {
47
+ id: string;
48
+ } | undefined;
49
+ } | undefined;
50
+ destinations?: Record<string, any> | undefined;
51
+ } | undefined;
52
+ invoice?: {
53
+ id: string;
54
+ } | undefined;
55
+ order: {
56
+ amount: number;
57
+ currency: string;
58
+ id?: string | undefined;
59
+ description?: string | undefined;
60
+ metadata?: Record<string, string> | undefined;
61
+ reference?: string | undefined;
62
+ };
63
+ post?: {
64
+ url: string;
65
+ } | undefined;
66
+ redirect?: {
67
+ url: string;
68
+ } | undefined;
69
+ onOrderCreated?: ((orderId: string) => void) | undefined;
70
+ onCancel?: (() => void) | undefined;
71
+ onError?: ((error: any) => void) | undefined;
72
+ onSuccess?: ((data: Record<string, any>) => void) | undefined;
73
+ onClick?: ((data?: ApplePayDataToLunchSDKFromMerchantSide | undefined) => void) | undefined;
74
+ onReady?: (() => void) | undefined;
75
+ metaData?: MetaData | undefined;
76
+ debug?: boolean | undefined;
77
+ integration?: "sdk" | "iframe" | undefined;
78
+ headers?: {
79
+ mdn: string;
80
+ application: string;
81
+ } | undefined;
82
+ };
83
+ theme: import("../@types").ThemeMode;
84
+ isRounded: boolean;
85
+ success: boolean;
86
+ error: boolean;
87
+ backgroundColor: string | undefined;
88
+ gradientColor: string | undefined;
89
+ titleAsset: string | undefined;
90
+ };
11
91
  export {};