@paydock/client-sdk 1.104.3-beta → 1.105.1
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/.nvmrc +1 -0
- package/README.md +572 -290
- package/api.d.ts +1 -0
- package/api.js +1 -0
- package/bundles/widget.umd.js +9130 -8655
- package/bundles/widget.umd.min.js +1 -2
- package/canvas3ds.d.ts +1 -0
- package/canvas3ds.js +1 -0
- package/checkout-button.d.ts +1 -0
- package/checkout-button.js +1 -0
- package/inicialization-guide.md +7 -0
- package/{bundles/types → lib}/api/api-base.d.ts +1 -2
- package/lib/api/api-base.js +101 -0
- package/lib/api/api-base.js.map +1 -0
- package/{bundles/types → lib}/api/api-charge-internal.d.ts +0 -1
- package/lib/api/api-charge-internal.js +30 -0
- package/lib/api/api-charge-internal.js.map +1 -0
- package/{bundles/types → lib}/api/api-charge.d.ts +0 -1
- package/lib/api/api-charge.js +49 -0
- package/lib/api/api-charge.js.map +1 -0
- package/{bundles/types → lib}/api/api-internal.d.ts +0 -1
- package/lib/api/api-internal.js +13 -0
- package/lib/api/api-internal.js.map +1 -0
- package/{bundles/types → lib}/api/api-service-internal.d.ts +0 -1
- package/lib/api/api-service-internal.js +18 -0
- package/lib/api/api-service-internal.js.map +1 -0
- package/{bundles/types → lib}/api/api.d.ts +1 -2
- package/lib/api/api.js +62 -0
- package/lib/api/api.js.map +1 -0
- package/lib/api/index.d.ts +1 -0
- package/lib/api/index.js +2 -0
- package/lib/api/index.js.map +1 -0
- package/{bundles/types → lib}/canvas-3ds/canvas-3ds.d.ts +1 -2
- package/lib/canvas-3ds/canvas-3ds.js +157 -0
- package/lib/canvas-3ds/canvas-3ds.js.map +1 -0
- package/{bundles/types → lib}/canvas-3ds/index.d.ts +0 -1
- package/lib/canvas-3ds/index.js +2 -0
- package/lib/canvas-3ds/index.js.map +1 -0
- package/{bundles/types → lib}/canvas-3ds/services/gpayments-service.d.ts +0 -1
- package/lib/canvas-3ds/services/gpayments-service.js +181 -0
- package/lib/canvas-3ds/services/gpayments-service.js.map +1 -0
- package/{bundles/types → lib}/canvas-3ds/services/index.d.ts +0 -1
- package/lib/canvas-3ds/services/index.js +2 -0
- package/lib/canvas-3ds/services/index.js.map +1 -0
- package/{bundles/types → lib}/canvas-3ds/services/standalone3ds-service.d.ts +0 -1
- package/lib/canvas-3ds/services/standalone3ds-service.js +32 -0
- package/lib/canvas-3ds/services/standalone3ds-service.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/afterpay/afterpay-checkout-button.d.ts +1 -2
- package/lib/checkout-button/afterpay/afterpay-checkout-button.js +50 -0
- package/lib/checkout-button/afterpay/afterpay-checkout-button.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/afterpay/afterpay.runner.d.ts +0 -1
- package/lib/checkout-button/afterpay/afterpay.runner.js +41 -0
- package/lib/checkout-button/afterpay/afterpay.runner.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/checkout-button.d.ts +1 -2
- package/{bundles/types → lib}/checkout-button/checkout-button.interface.d.ts +0 -1
- package/lib/checkout-button/checkout-button.interface.js +45 -0
- package/lib/checkout-button/checkout-button.interface.js.map +1 -0
- package/lib/checkout-button/checkout-button.js +266 -0
- package/lib/checkout-button/checkout-button.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/checkout-contextual-handler.d.ts +0 -1
- package/lib/checkout-button/checkout-contextual-handler.js +75 -0
- package/lib/checkout-button/checkout-contextual-handler.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/index.d.ts +1 -2
- package/lib/checkout-button/index.js +85 -0
- package/lib/checkout-button/index.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/paypal/paypal-checkout-button.d.ts +1 -2
- package/lib/checkout-button/paypal/paypal-checkout-button.js +25 -0
- package/lib/checkout-button/paypal/paypal-checkout-button.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/paypal/paypal.runner.d.ts +0 -1
- package/lib/checkout-button/paypal/paypal.runner.js +14 -0
- package/lib/checkout-button/paypal/paypal.runner.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/runner/base.runner.d.ts +3 -4
- package/lib/checkout-button/runner/base.runner.js +13 -0
- package/lib/checkout-button/runner/base.runner.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/runner/contextual.runner.d.ts +1 -2
- package/lib/checkout-button/runner/contextual.runner.js +40 -0
- package/lib/checkout-button/runner/contextual.runner.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/runner/index.d.ts +0 -1
- package/lib/checkout-button/runner/index.js +11 -0
- package/lib/checkout-button/runner/index.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/runner/popup.runner.d.ts +1 -2
- package/lib/checkout-button/runner/popup.runner.js +68 -0
- package/lib/checkout-button/runner/popup.runner.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/runner/redirect.runner.d.ts +1 -2
- package/lib/checkout-button/runner/redirect.runner.js +15 -0
- package/lib/checkout-button/runner/redirect.runner.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/zipmoney/zipmoney-checkout-button.d.ts +1 -2
- package/lib/checkout-button/zipmoney/zipmoney-checkout-button.js +64 -0
- package/lib/checkout-button/zipmoney/zipmoney-checkout-button.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/zipmoney/zipmoney-contextual.runner.d.ts +1 -2
- package/lib/checkout-button/zipmoney/zipmoney-contextual.runner.js +78 -0
- package/lib/checkout-button/zipmoney/zipmoney-contextual.runner.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/zipmoney/zipmoney-redirect.runner.d.ts +1 -2
- package/lib/checkout-button/zipmoney/zipmoney-redirect.runner.js +49 -0
- package/lib/checkout-button/zipmoney/zipmoney-redirect.runner.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/zipmoney/zipmoney.config.d.ts +0 -1
- package/lib/checkout-button/zipmoney/zipmoney.config.js +4 -0
- package/lib/checkout-button/zipmoney/zipmoney.config.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/zipmoney/zipmoney.runner.d.ts +1 -2
- package/lib/checkout-button/zipmoney/zipmoney.runner.js +23 -0
- package/lib/checkout-button/zipmoney/zipmoney.runner.js.map +1 -0
- package/{bundles/types → lib}/checkout-button/zipmoney/zipmoney.types.d.ts +0 -1
- package/lib/checkout-button/zipmoney/zipmoney.types.js +1 -0
- package/lib/checkout-button/zipmoney/zipmoney.types.js.map +1 -0
- package/{bundles/types → lib}/components/ability-guard.d.ts +0 -1
- package/lib/components/ability-guard.js +44 -0
- package/lib/components/ability-guard.js.map +1 -0
- package/{bundles/types → lib}/components/background.d.ts +0 -1
- package/lib/components/background.js +193 -0
- package/lib/components/background.js.map +1 -0
- package/{bundles/types → lib}/components/container.d.ts +1 -1
- package/lib/components/container.js +63 -0
- package/lib/components/container.js.map +1 -0
- package/{bundles/types → lib}/components/dispatcher.d.ts +1 -2
- package/lib/components/dispatcher.js +39 -0
- package/lib/components/dispatcher.js.map +1 -0
- package/{bundles/types → lib}/components/element-style.d.ts +1 -2
- package/lib/components/element-style.js +52 -0
- package/lib/components/element-style.js.map +1 -0
- package/{bundles/types → lib}/components/flypay-iframe-event.d.ts +0 -1
- package/lib/components/flypay-iframe-event.js +28 -0
- package/lib/components/flypay-iframe-event.js.map +1 -0
- package/{bundles/types/components/form-interceptor.d.ts → lib/components/form-Interceptor.d.ts} +0 -1
- package/lib/components/form-Interceptor.js +38 -0
- package/lib/components/form-Interceptor.js.map +1 -0
- package/{bundles/types → lib}/components/http-core.d.ts +0 -1
- package/lib/components/http-core.js +57 -0
- package/lib/components/http-core.js.map +1 -0
- package/{bundles/types → lib}/components/iframe-event.d.ts +15 -13
- package/lib/components/iframe-event.js +75 -0
- package/lib/components/iframe-event.js.map +1 -0
- package/{bundles/types → lib}/components/iframe.d.ts +0 -1
- package/lib/components/iframe.js +62 -0
- package/lib/components/iframe.js.map +1 -0
- package/{bundles/types → lib}/components/link.d.ts +1 -2
- package/lib/components/link.js +59 -0
- package/lib/components/link.js.map +1 -0
- package/{bundles/types → lib}/components/loader.d.ts +0 -1
- package/lib/components/loader.js +234 -0
- package/lib/components/loader.js.map +1 -0
- package/{bundles/types → lib}/components/param.d.ts +9 -12
- package/lib/components/param.js +147 -0
- package/lib/components/param.js.map +1 -0
- package/{bundles/types → lib}/components/popup.d.ts +0 -1
- package/lib/components/popup.js +104 -0
- package/lib/components/popup.js.map +1 -0
- package/{bundles/types → lib}/components/storage-dispatcher.d.ts +0 -1
- package/lib/components/storage-dispatcher.js +75 -0
- package/lib/components/storage-dispatcher.js.map +1 -0
- package/{bundles/types → lib}/components/trigger.d.ts +0 -1
- package/lib/components/trigger.js +49 -0
- package/lib/components/trigger.js.map +1 -0
- package/{bundles/types → lib}/components/vault-display-iframe-event.d.ts +0 -1
- package/lib/components/vault-display-iframe-event.js +27 -0
- package/lib/components/vault-display-iframe-event.js.map +1 -0
- package/{bundles/types → lib}/components/wallet-background.d.ts +2 -2
- package/lib/components/wallet-background.js +63 -0
- package/lib/components/wallet-background.js.map +1 -0
- package/{bundles/types → lib}/components/wallet-trigger.d.ts +0 -1
- package/lib/components/wallet-trigger.js +27 -0
- package/lib/components/wallet-trigger.js.map +1 -0
- package/{bundles/types/configs/env/environment.paydock.d.ts → lib/configs/env/env.d.ts} +8 -5
- package/lib/configs/env/env.js +117 -0
- package/lib/configs/env/env.js.map +1 -0
- package/{bundles/types → lib}/configs/sdk.d.ts +2 -3
- package/lib/configs/sdk.js +16 -0
- package/lib/configs/sdk.js.map +1 -0
- package/lib/constants/validators.d.ts +44 -0
- package/lib/constants/validators.js +42 -0
- package/lib/constants/validators.js.map +1 -0
- package/{bundles/types → lib}/external-checkout/builder.d.ts +0 -1
- package/lib/external-checkout/builder.js +45 -0
- package/lib/external-checkout/builder.js.map +1 -0
- package/{bundles/types → lib}/external-checkout/checker.d.ts +0 -1
- package/lib/external-checkout/checker.js +22 -0
- package/lib/external-checkout/checker.js.map +1 -0
- package/lib/external-checkout/index.d.ts +2 -0
- package/lib/external-checkout/index.js +3 -0
- package/lib/external-checkout/index.js.map +1 -0
- package/{bundles/types → lib}/helper/access-token.d.ts +0 -1
- package/lib/helper/access-token.js +44 -0
- package/lib/helper/access-token.js.map +1 -0
- package/{bundles/types → lib}/helper/browser.d.ts +0 -1
- package/lib/helper/browser.js +79 -0
- package/lib/helper/browser.js.map +1 -0
- package/{bundles/types → lib}/helper/event-emitter.d.ts +0 -1
- package/lib/helper/event-emitter.js +23 -0
- package/lib/helper/event-emitter.js.map +1 -0
- package/{bundles/types → lib}/helper/event.d.ts +0 -1
- package/lib/helper/event.js +23 -0
- package/lib/helper/event.js.map +1 -0
- package/{bundles/types → lib}/helper/ms.d.ts +0 -1
- package/lib/helper/ms.js +32 -0
- package/lib/helper/ms.js.map +1 -0
- package/{bundles/types → lib}/helper/object.d.ts +0 -1
- package/lib/helper/object.js +6 -0
- package/lib/helper/object.js.map +1 -0
- package/{bundles/types → lib}/helper/url.d.ts +0 -1
- package/lib/helper/url.js +11 -0
- package/lib/helper/url.js.map +1 -0
- package/{bundles/types → lib}/helper/uuid.d.ts +0 -1
- package/lib/helper/uuid.js +26 -0
- package/lib/helper/uuid.js.map +1 -0
- package/lib/index.d.ts +15 -0
- package/lib/index.js +15 -0
- package/lib/index.js.map +1 -0
- package/{bundles/types → lib}/payment-source/builder.d.ts +0 -1
- package/lib/payment-source/builder.js +49 -0
- package/lib/payment-source/builder.js.map +1 -0
- package/{bundles/types → lib}/payment-source/index.d.ts +0 -1
- package/lib/payment-source/index.js +2 -0
- package/lib/payment-source/index.js.map +1 -0
- package/{bundles/types → lib}/payment-source-widget/html-payment-source-widget.d.ts +17 -14
- package/lib/payment-source-widget/html-payment-source-widget.js +172 -0
- package/lib/payment-source-widget/html-payment-source-widget.js.map +1 -0
- package/{bundles/types → lib}/payment-source-widget/index.d.ts +0 -1
- package/lib/payment-source-widget/index.js +35 -0
- package/lib/payment-source-widget/index.js.map +1 -0
- package/{bundles/types → lib}/payment-source-widget/interfaces.d.ts +0 -1
- package/lib/payment-source-widget/interfaces.js +2 -0
- package/lib/payment-source-widget/interfaces.js.map +1 -0
- package/{bundles/types → lib}/payment-source-widget/payment-source-widget.d.ts +1 -2
- package/lib/payment-source-widget/payment-source-widget.js +142 -0
- package/lib/payment-source-widget/payment-source-widget.js.map +1 -0
- package/{bundles/types → lib}/secure-remote-commerce/index.d.ts +0 -1
- package/lib/secure-remote-commerce/index.js +2 -0
- package/lib/secure-remote-commerce/index.js.map +1 -0
- package/{bundles/types → lib}/secure-remote-commerce/interfaces.d.ts +5 -6
- package/lib/secure-remote-commerce/interfaces.js +28 -0
- package/lib/secure-remote-commerce/interfaces.js.map +1 -0
- package/{bundles/types → lib}/secure-remote-commerce/providers/src-provider.d.ts +0 -1
- package/lib/secure-remote-commerce/providers/src-provider.js +1 -0
- package/lib/secure-remote-commerce/providers/src-provider.js.map +1 -0
- package/{bundles/types → lib}/secure-remote-commerce/providers/visa-src/helper.d.ts +0 -1
- package/lib/secure-remote-commerce/providers/visa-src/helper.js +36 -0
- package/lib/secure-remote-commerce/providers/visa-src/helper.js.map +1 -0
- package/{bundles/types → lib}/secure-remote-commerce/providers/visa-src/index.d.ts +0 -1
- package/lib/secure-remote-commerce/providers/visa-src/index.js +2 -0
- package/lib/secure-remote-commerce/providers/visa-src/index.js.map +1 -0
- package/{bundles/types → lib}/secure-remote-commerce/providers/visa-src/visa-src.d.ts +0 -1
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.js +113 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.js.map +1 -0
- package/{bundles/types → lib}/secure-remote-commerce/providers/visa-src/visa-src.styles.d.ts +0 -1
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.js +10 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.js.map +1 -0
- package/{bundles/types → lib}/secure-remote-commerce/secure-remote-commerce.d.ts +1 -2
- package/lib/secure-remote-commerce/secure-remote-commerce.js +239 -0
- package/lib/secure-remote-commerce/secure-remote-commerce.js.map +1 -0
- package/{bundles/types → lib}/vault-display-widget/index.d.ts +0 -1
- package/lib/vault-display-widget/index.js +14 -0
- package/lib/vault-display-widget/index.js.map +1 -0
- package/{bundles/types → lib}/vault-display-widget/vault-display-widget.d.ts +1 -2
- package/lib/vault-display-widget/vault-display-widget.js +99 -0
- package/lib/vault-display-widget/vault-display-widget.js.map +1 -0
- package/{bundles/types → lib}/wallet-buttons/afterpay.wallet-service.d.ts +0 -1
- package/lib/wallet-buttons/afterpay.wallet-service.js +152 -0
- package/lib/wallet-buttons/afterpay.wallet-service.js.map +1 -0
- package/{bundles/types → lib}/wallet-buttons/apple.wallet-service.d.ts +2 -1
- package/lib/wallet-buttons/apple.wallet-service.js +324 -0
- package/lib/wallet-buttons/apple.wallet-service.js.map +1 -0
- package/{bundles/types → lib}/wallet-buttons/flypay-v2.wallet-service.d.ts +9 -2
- package/lib/wallet-buttons/flypay-v2.wallet-service.js +165 -0
- package/lib/wallet-buttons/flypay-v2.wallet-service.js.map +1 -0
- package/{bundles/types → lib}/wallet-buttons/flypay.wallet-service.d.ts +0 -1
- package/lib/wallet-buttons/flypay.wallet-service.js +117 -0
- package/lib/wallet-buttons/flypay.wallet-service.js.map +1 -0
- package/{bundles/types → lib}/wallet-buttons/google.wallet-service.d.ts +3 -1
- package/lib/wallet-buttons/google.wallet-service.js +301 -0
- package/lib/wallet-buttons/google.wallet-service.js.map +1 -0
- package/lib/wallet-buttons/helpers/flypay-v2.helper.d.ts +3 -0
- package/lib/wallet-buttons/helpers/flypay-v2.helper.js +151 -0
- package/lib/wallet-buttons/helpers/flypay-v2.helper.js.map +1 -0
- package/lib/wallet-buttons/index.d.ts +127 -0
- package/lib/wallet-buttons/index.js +128 -0
- package/lib/wallet-buttons/index.js.map +1 -0
- package/{bundles/types → lib}/wallet-buttons/interfaces.d.ts +3 -1
- package/lib/wallet-buttons/interfaces.js +1 -0
- package/lib/wallet-buttons/interfaces.js.map +1 -0
- package/{bundles/types → lib}/wallet-buttons/mastercard.wallet-service.d.ts +0 -1
- package/lib/wallet-buttons/mastercard.wallet-service.js +27 -0
- package/lib/wallet-buttons/mastercard.wallet-service.js.map +1 -0
- package/{bundles/types → lib}/wallet-buttons/paypal.wallet-service.d.ts +0 -1
- package/lib/wallet-buttons/paypal.wallet-service.js +144 -0
- package/lib/wallet-buttons/paypal.wallet-service.js.map +1 -0
- package/{bundles/types → lib}/wallet-buttons/stripe.wallet-service.d.ts +0 -1
- package/lib/wallet-buttons/stripe.wallet-service.js +100 -0
- package/lib/wallet-buttons/stripe.wallet-service.js.map +1 -0
- package/{bundles/types/wallet-buttons/wallet-cba-buttons.d.ts → lib/wallet-buttons/wallet-buttons.d.ts} +92 -115
- package/lib/wallet-buttons/wallet-buttons.js +479 -0
- package/lib/wallet-buttons/wallet-buttons.js.map +1 -0
- package/{bundles/types → lib}/wallet-buttons/wallet-service.d.ts +7 -1
- package/lib/wallet-buttons/wallet-service.js +60 -0
- package/lib/wallet-buttons/wallet-service.js.map +1 -0
- package/{bundles/types → lib}/widget/configuration.d.ts +2 -3
- package/lib/widget/configuration.js +260 -0
- package/lib/widget/configuration.js.map +1 -0
- package/lib/widget/html-multi-widget.d.ts +336 -0
- package/lib/widget/html-multi-widget.js +422 -0
- package/lib/widget/html-multi-widget.js.map +1 -0
- package/{bundles/types → lib}/widget/html-widget.d.ts +1 -2
- package/lib/widget/html-widget.js +127 -0
- package/lib/widget/html-widget.js.map +1 -0
- package/{bundles/types → lib}/widget/index.d.ts +1 -2
- package/lib/widget/index.js +132 -0
- package/lib/widget/index.js.map +1 -0
- package/{bundles/types → lib}/widget/meta.d.ts +0 -1
- package/lib/widget/meta.js +8 -0
- package/lib/widget/meta.js.map +1 -0
- package/{bundles/types → lib}/widget/multi-widget.d.ts +1 -2
- package/lib/widget/multi-widget.js +437 -0
- package/lib/widget/multi-widget.js.map +1 -0
- package/{bundles/types → lib}/widget/style.d.ts +0 -1
- package/lib/widget/style.js +204 -0
- package/lib/widget/style.js.map +1 -0
- package/package.json +42 -164
- package/payment-source-widget.d.ts +1 -0
- package/payment-source-widget.js +1 -0
- package/slate.md +136 -107
- package/tslint.json +129 -0
- package/typings/globals/@auspayplus/open-payments-checkout/index.d.ts +43 -0
- package/typings/globals/jasmine/index.d.ts +576 -0
- package/typings/globals/jasmine-ajax/index.d.ts +83 -0
- package/typings/globals/jquery/index.d.ts +3759 -0
- package/typings/index.d.ts +4 -0
- package/vault-display-widget.d.ts +1 -0
- package/vault-display-widget.js +1 -0
- package/vendors/zipmoney.d.ts +18 -0
- package/vendors/zipmoney.js +2 -0
- package/widget.d.ts +1 -0
- package/widget.js +1 -0
- package/bundles/index.cjs +0 -10674
- package/bundles/index.cjs.d.ts +0 -3163
- package/bundles/index.cjs.map +0 -1
- package/bundles/index.mjs +0 -10642
- package/bundles/index.mjs.d.ts +0 -3163
- package/bundles/index.mjs.map +0 -1
- package/bundles/types/api/api-base.d.ts.map +0 -1
- package/bundles/types/api/api-charge-internal.d.ts.map +0 -1
- package/bundles/types/api/api-charge.d.ts.map +0 -1
- package/bundles/types/api/api-internal.d.ts.map +0 -1
- package/bundles/types/api/api-service-internal.d.ts.map +0 -1
- package/bundles/types/api/api.d.ts.map +0 -1
- package/bundles/types/api/index.d.ts +0 -2
- package/bundles/types/api/index.d.ts.map +0 -1
- package/bundles/types/canvas-3ds/canvas-3ds.d.ts.map +0 -1
- package/bundles/types/canvas-3ds/index.d.ts.map +0 -1
- package/bundles/types/canvas-3ds/services/gpayments-service.d.ts.map +0 -1
- package/bundles/types/canvas-3ds/services/index.d.ts.map +0 -1
- package/bundles/types/canvas-3ds/services/standalone3ds-service.d.ts.map +0 -1
- package/bundles/types/checkout-button/afterpay/afterpay-checkout-button.d.ts.map +0 -1
- package/bundles/types/checkout-button/afterpay/afterpay.runner.d.ts.map +0 -1
- package/bundles/types/checkout-button/checkout-button.d.ts.map +0 -1
- package/bundles/types/checkout-button/checkout-button.interface.d.ts.map +0 -1
- package/bundles/types/checkout-button/checkout-contextual-handler.d.ts.map +0 -1
- package/bundles/types/checkout-button/index.d.ts.map +0 -1
- package/bundles/types/checkout-button/paypal/paypal-checkout-button.d.ts.map +0 -1
- package/bundles/types/checkout-button/paypal/paypal.runner.d.ts.map +0 -1
- package/bundles/types/checkout-button/runner/base.runner.d.ts.map +0 -1
- package/bundles/types/checkout-button/runner/contextual.runner.d.ts.map +0 -1
- package/bundles/types/checkout-button/runner/index.d.ts.map +0 -1
- package/bundles/types/checkout-button/runner/popup.runner.d.ts.map +0 -1
- package/bundles/types/checkout-button/runner/redirect.runner.d.ts.map +0 -1
- package/bundles/types/checkout-button/zipmoney/index.d.ts +0 -4
- package/bundles/types/checkout-button/zipmoney/index.d.ts.map +0 -1
- package/bundles/types/checkout-button/zipmoney/zipmoney-checkout-button.d.ts.map +0 -1
- package/bundles/types/checkout-button/zipmoney/zipmoney-contextual.runner.d.ts.map +0 -1
- package/bundles/types/checkout-button/zipmoney/zipmoney-redirect.runner.d.ts.map +0 -1
- package/bundles/types/checkout-button/zipmoney/zipmoney.config.d.ts.map +0 -1
- package/bundles/types/checkout-button/zipmoney/zipmoney.runner.d.ts.map +0 -1
- package/bundles/types/checkout-button/zipmoney/zipmoney.types.d.ts.map +0 -1
- package/bundles/types/components/ability-guard.d.ts.map +0 -1
- package/bundles/types/components/background.d.ts.map +0 -1
- package/bundles/types/components/container.d.ts.map +0 -1
- package/bundles/types/components/dispatcher.d.ts.map +0 -1
- package/bundles/types/components/element-style.d.ts.map +0 -1
- package/bundles/types/components/flypay-iframe-event.d.ts.map +0 -1
- package/bundles/types/components/form-interceptor.d.ts.map +0 -1
- package/bundles/types/components/http-core.d.ts.map +0 -1
- package/bundles/types/components/iframe-event.d.ts.map +0 -1
- package/bundles/types/components/iframe.d.ts.map +0 -1
- package/bundles/types/components/link.d.ts.map +0 -1
- package/bundles/types/components/loader.d.ts.map +0 -1
- package/bundles/types/components/param.d.ts.map +0 -1
- package/bundles/types/components/popup.d.ts.map +0 -1
- package/bundles/types/components/storage-dispatcher.d.ts.map +0 -1
- package/bundles/types/components/trigger.d.ts.map +0 -1
- package/bundles/types/components/vault-display-iframe-event.d.ts.map +0 -1
- package/bundles/types/components/wallet-background.d.ts.map +0 -1
- package/bundles/types/components/wallet-trigger.d.ts.map +0 -1
- package/bundles/types/configs/env/environment.cba.d.ts +0 -29
- package/bundles/types/configs/env/environment.cba.d.ts.map +0 -1
- package/bundles/types/configs/env/environment.interface.d.ts +0 -12
- package/bundles/types/configs/env/environment.interface.d.ts.map +0 -1
- package/bundles/types/configs/env/environment.paydock.d.ts.map +0 -1
- package/bundles/types/configs/env/index.d.ts +0 -3
- package/bundles/types/configs/env/index.d.ts.map +0 -1
- package/bundles/types/configs/sdk.d.ts.map +0 -1
- package/bundles/types/external-checkout/builder.d.ts.map +0 -1
- package/bundles/types/external-checkout/checker.d.ts.map +0 -1
- package/bundles/types/external-checkout/index.d.ts +0 -3
- package/bundles/types/external-checkout/index.d.ts.map +0 -1
- package/bundles/types/helper/access-token.d.ts.map +0 -1
- package/bundles/types/helper/browser.d.ts.map +0 -1
- package/bundles/types/helper/event-emitter.d.ts.map +0 -1
- package/bundles/types/helper/event.d.ts.map +0 -1
- package/bundles/types/helper/ms.d.ts.map +0 -1
- package/bundles/types/helper/object.d.ts.map +0 -1
- package/bundles/types/helper/url.d.ts.map +0 -1
- package/bundles/types/helper/uuid.d.ts.map +0 -1
- package/bundles/types/index-cba.d.ts +0 -13
- package/bundles/types/index-cba.d.ts.map +0 -1
- package/bundles/types/index.d.ts +0 -14
- package/bundles/types/index.d.ts.map +0 -1
- package/bundles/types/payment-source/builder.d.ts.map +0 -1
- package/bundles/types/payment-source/index.d.ts.map +0 -1
- package/bundles/types/payment-source-widget/html-payment-source-widget.d.ts.map +0 -1
- package/bundles/types/payment-source-widget/index.d.ts.map +0 -1
- package/bundles/types/payment-source-widget/interfaces.d.ts.map +0 -1
- package/bundles/types/payment-source-widget/payment-source-widget.d.ts.map +0 -1
- package/bundles/types/secure-remote-commerce/index.d.ts.map +0 -1
- package/bundles/types/secure-remote-commerce/interfaces.d.ts.map +0 -1
- package/bundles/types/secure-remote-commerce/providers/src-provider.d.ts.map +0 -1
- package/bundles/types/secure-remote-commerce/providers/visa-src/helper.d.ts.map +0 -1
- package/bundles/types/secure-remote-commerce/providers/visa-src/index.d.ts.map +0 -1
- package/bundles/types/secure-remote-commerce/providers/visa-src/visa-src.d.ts.map +0 -1
- package/bundles/types/secure-remote-commerce/providers/visa-src/visa-src.styles.d.ts.map +0 -1
- package/bundles/types/secure-remote-commerce/secure-remote-commerce.d.ts.map +0 -1
- package/bundles/types/vault-display-widget/index.d.ts.map +0 -1
- package/bundles/types/vault-display-widget/vault-display-widget.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/afterpay.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/apple.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/flypay-v2.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/flypay.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/google.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/index-cba.d.ts +0 -2
- package/bundles/types/wallet-buttons/index-cba.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/index.d.ts +0 -2
- package/bundles/types/wallet-buttons/index.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/interfaces.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/mastercard.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/paypal.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/stripe.wallet-service.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts +0 -366
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts.map +0 -1
- package/bundles/types/wallet-buttons/wallet-service.d.ts.map +0 -1
- package/bundles/types/widget/configuration.d.ts.map +0 -1
- package/bundles/types/widget/html-multi-widget.d.ts +0 -266
- package/bundles/types/widget/html-multi-widget.d.ts.map +0 -1
- package/bundles/types/widget/html-widget.d.ts.map +0 -1
- package/bundles/types/widget/index.d.ts.map +0 -1
- package/bundles/types/widget/meta.d.ts.map +0 -1
- package/bundles/types/widget/multi-widget.d.ts.map +0 -1
- package/bundles/types/widget/style.d.ts.map +0 -1
- package/bundles/widget.umd.js.d.ts +0 -3163
- package/bundles/widget.umd.js.map +0 -1
- package/bundles/widget.umd.js.min.d.ts +0 -3163
- package/bundles/widget.umd.min.js.map +0 -1
- package/docs/api-canvas3ds.md +0 -158
- package/docs/api-checkout-button.md +0 -912
- package/docs/api-examples.md +0 -65
- package/docs/api-ps-widget.md +0 -585
- package/docs/api-vault-display.md +0 -94
- package/docs/api-widget.md +0 -2444
- package/docs/api-wrapper.md +0 -78
- package/docs/canvas3ds-examples.md +0 -242
- package/docs/cba-header.md +0 -13
- package/docs/cba-license.md +0 -2
- package/docs/checkout-examples.md +0 -248
- package/docs/header.md +0 -15
- package/docs/html/layout.html +0 -78
- package/docs/html/marked.js +0 -23
- package/docs/html/style.css +0 -365
- package/docs/install/npm.content.md +0 -16
- package/docs/install/npm.example.md +0 -24
- package/docs/install/umd.content.md +0 -20
- package/docs/install/umd.example.md +0 -6
- package/docs/install.md +0 -43
- package/docs/install.readme.t.md +0 -17
- package/docs/install.slate.t.md +0 -17
- package/docs/license.md +0 -2
- package/docs/partials/header.hbs +0 -3
- package/docs/ps-examples.md +0 -129
- package/docs/secure-remote-commerce-examples.md +0 -258
- package/docs/secure-remote-commerce.md +0 -265
- package/docs/vault-display-example.md +0 -132
- package/docs/wallet-buttons-examples.md +0 -580
- package/docs/wallet-buttons.md +0 -424
- package/docs/wallet-cba-buttons-examples.md +0 -388
- package/docs/widget-examples.md +0 -134
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
export { WalletButtons } from "./wallet-buttons";
|
|
2
|
+
/**
|
|
3
|
+
* Interface of data from events.
|
|
4
|
+
* @interface IEventData
|
|
5
|
+
*
|
|
6
|
+
* @param {string} event
|
|
7
|
+
* @param {void | IWalletPaymentSuccessful | IWalletUpdate | IWalletUnavailable | IWalletOnClick | any} data
|
|
8
|
+
**/
|
|
9
|
+
/**
|
|
10
|
+
* Interface of data from a successful payment result.
|
|
11
|
+
* @interface IWalletPaymentSuccessful
|
|
12
|
+
*
|
|
13
|
+
* @param {string} id
|
|
14
|
+
* @param {number} amount
|
|
15
|
+
* @param {string} currency
|
|
16
|
+
* @param {string} status
|
|
17
|
+
* @param {string} [payer_name]
|
|
18
|
+
* @param {string} [payer_email]
|
|
19
|
+
* @param {string} [payer_phone]
|
|
20
|
+
**/
|
|
21
|
+
/**
|
|
22
|
+
* Interface of data from an update event.
|
|
23
|
+
* @interface IWalletUpdate
|
|
24
|
+
*
|
|
25
|
+
* @param {string} [wallet_response_code]
|
|
26
|
+
* @param {string} [wallet_session_id]
|
|
27
|
+
* @param {object} [payment_source]
|
|
28
|
+
* @param {string} [payment_source.wallet_payment_method_id]
|
|
29
|
+
* @param {string} [payment_source.card_number_last4]
|
|
30
|
+
* @param {string} [payment_source.card_scheme]
|
|
31
|
+
* @param {object} [wallet_loyalty_account]
|
|
32
|
+
* @param {string} [wallet_loyalty_account.id]
|
|
33
|
+
* @param {string} [wallet_loyalty_account.barcode]
|
|
34
|
+
* @param {object} [shipping]
|
|
35
|
+
* @param {string} [shipping.address_line1]
|
|
36
|
+
* @param {string} [shipping.address_line2]
|
|
37
|
+
* @param {string} [shipping.address_postcode]
|
|
38
|
+
* @param {string} [shipping.address_city]
|
|
39
|
+
* @param {string} [shipping.address_state]
|
|
40
|
+
* @param {string} [shipping.address_country]
|
|
41
|
+
* @param {string} [shipping.address_company]
|
|
42
|
+
* @param {string} [shipping.post_office_box_number]
|
|
43
|
+
* @param {string} [shipping.wallet_address_id]
|
|
44
|
+
* @param {string} [shipping.wallet_address_name]
|
|
45
|
+
* @param {string} [shipping.wallet_address_created_timestamp]
|
|
46
|
+
* @param {string} [shipping.wallet_address_updated_timestamp]
|
|
47
|
+
**/
|
|
48
|
+
/**
|
|
49
|
+
* Interface of data from a wallet onClick event.
|
|
50
|
+
* @interface IWalletOnClick
|
|
51
|
+
*
|
|
52
|
+
* @param attachResult - Method to be called that attaches a result to the wallet onClick operation.
|
|
53
|
+
* When handler is synchronous, this method is optionally called with a boolean flag indicating validation result.
|
|
54
|
+
* When handler executes asynchronous operations, this method must be called with the Promise to have the wallet process wait for its completion or rejection.
|
|
55
|
+
**/
|
|
56
|
+
/**
|
|
57
|
+
* Interface of data from an unavailable event.
|
|
58
|
+
* @interface IWalletUnavailable
|
|
59
|
+
*
|
|
60
|
+
* @param {string} [wallet] For gateways with more than one wallet button available (e.g: MPGS with ApplePay and GooglePay). Possible values for wallet are 'apple' or 'google'.
|
|
61
|
+
**/
|
|
62
|
+
/**
|
|
63
|
+
* Interface of data for wallet button `update` call.
|
|
64
|
+
* @interface IWalletUpdateData
|
|
65
|
+
*
|
|
66
|
+
* @param {boolean} success
|
|
67
|
+
**/
|
|
68
|
+
/**
|
|
69
|
+
* Interface of data used by the wallet checkout and payment proccess.
|
|
70
|
+
* @interface IWalletMeta
|
|
71
|
+
*
|
|
72
|
+
* @type {object}
|
|
73
|
+
* @param {string} [amount_label] Label shown next to the total amount to be paid. Required for [Stripe, ApplePay, GooglePay]. N/A for [FlyPay, Flypay V2, PayPal, Afterpay].
|
|
74
|
+
* @param {string} [country] Country of the user. 2 letter ISO code format. Required for [Stripe, ApplePay, GooglePay, Afterpay]. N/A for [FlyPay, Flypay V2, PayPal].
|
|
75
|
+
* @param {boolean} [pay_later] Used to enable Pay Later feature in PayPal Smart Checkout WalletButton integration when available. Optional for [PayPal]. N/A for other wallets.
|
|
76
|
+
* @param {boolean} [standalone] Used to enable Standalone Buttons feature in PayPal Smart Checkout WalletButton integration. Used together with `pay_later`. Optional for [PayPal]. N/A for other wallets.
|
|
77
|
+
* @param {boolean} [show_billing_address] Used to hide/show the billing address on ApplePay and GooglePay popups. Default value is false. Optional for [ApplePay, GooglePay]. N/A for other wallets.
|
|
78
|
+
* @param {boolean} [request_payer_name] Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets.
|
|
79
|
+
* @param {boolean} [request_payer_email] Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets.
|
|
80
|
+
* @param {boolean} [request_payer_phone] Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets.
|
|
81
|
+
* @param {string} [access_token] Used for Flypay V2 express flow. Optional for [Flypay V2]. N/A for other wallets.
|
|
82
|
+
* @param {string} [refresh_token] Used for Flypay V2 express flow. Optional for [Flypay V2]. N/A for other wallets.
|
|
83
|
+
* @param {boolean} [request_shipping] Used to request or not shipping address in the Wallet checkout, being able to handle amount changes via the `update` event. Optional for [FlyPay, PayPal, ApplePay, GooglePay]. N/A for [Flypay V2, Stripe, Afterpay].
|
|
84
|
+
* @param {IApplePayShippingOption[] | IPayPalShippingOption[]} [shipping_options] Used to provide available shipping options.(To use shipping_options the request_shipping flag should be true). Optional for [ApplePay]. N/A for the other wallets.
|
|
85
|
+
* @param {string} [merchant_name] Merchant Name used for GooglePay integration via MPGS. Required for [GooglePay]. N/A for other wallets.
|
|
86
|
+
* @param {object} [raw_data_initialization] Used to provide values to initialize wallet with raw data. Optional for [ApplePay]. N/A for the other wallets.
|
|
87
|
+
* @param {object} [style] For **Paypal**: used to style the buttons, check possible values in the [style guide](https://developer.paypal.com/docs/business/checkout/reference/style-guide).
|
|
88
|
+
* When `standalone` and `pay_later`, extra options can be provided in `style.messages` with the [messages style options](https://developer.paypal.com/docs/checkout/pay-later/us/integrate/reference/#stylelayout).
|
|
89
|
+
* Also used at **ApplePay**, **GooglePay** and **Afterpay** to select button type.
|
|
90
|
+
* Optional for [PayPal, ApplePay, GooglePay, Afterpay]. N/A for [Stripe, FlyPay, Flypay V2].
|
|
91
|
+
* @param {object} [style.button_type] Used to select ApplePay button type (e.g: 'buy','donate', etc), check possible values at https://developer.apple.com/documentation/apple_pay_on_the_web/displaying_apple_pay_buttons_using_css.
|
|
92
|
+
* Also select button type for GooglePay (check GooglePayStyles) and Afterpay (check AfterpayStyles). Optional for [ApplePay, GooglePay, Afterpay]. N/A for other wallets.
|
|
93
|
+
* @param {object} [style.height] Used to select Afterpay button height. Optional for [Afterpay]. N/A for other wallets.
|
|
94
|
+
* @param {array} [wallets] By default if this is not sent or empty, we will try to show either Apple Pay or Google Pay buttons. This can be limited sending the following array in this field: ['apple','google]. Optional for [Stripe, ApplePay, GooglePay]. N/A for other wallets.
|
|
95
|
+
**/
|
|
96
|
+
/**
|
|
97
|
+
* Interface of Shipping Options for ApplePay
|
|
98
|
+
* @interface IApplePayShippingOption
|
|
99
|
+
*
|
|
100
|
+
* @type {object}
|
|
101
|
+
* @param {string} [id] Identifier of the Shipping Option. Required.
|
|
102
|
+
* @param {string} [label] Identifier of the Shipping Option. Required.
|
|
103
|
+
* @param {string} [amount] Amount of the Shipping Option. Required.
|
|
104
|
+
* @param {string} [detail] Details of the Shipping Option. Required.
|
|
105
|
+
* @param {string} [type] Type of the Shipping Option. Values can be 'ELECTRONIC', 'GROUND', 'NOT_SHIPPED', 'OVERNIGHT', 'PICKUP', 'PRIORITY', 'SAME_DAY'. Optional.
|
|
106
|
+
**/
|
|
107
|
+
/**
|
|
108
|
+
* Interface of Shipping Options for GooglePay
|
|
109
|
+
* @interface IGooglePayShippingOption
|
|
110
|
+
*
|
|
111
|
+
* @type {object}
|
|
112
|
+
* @param {string} [id] Identifier of the Shipping Option. Required.
|
|
113
|
+
* @param {string} [label] Identifier of the Shipping Option. Required.
|
|
114
|
+
* @param {string} [detail] Details of the Shipping Option. Optional.
|
|
115
|
+
* @param {string} [type] Type of the Shipping Option. Values can be 'ELECTRONIC', 'GROUND', 'NOT_SHIPPED', 'OVERNIGHT', 'PICKUP', 'PRIORITY', 'SAME_DAY'. Optional.
|
|
116
|
+
**/
|
|
117
|
+
/**
|
|
118
|
+
* Interface of Shipping Options for PayPal
|
|
119
|
+
* @interface IPayPalShippingOption
|
|
120
|
+
*
|
|
121
|
+
* @type {object}
|
|
122
|
+
* @param {string} [id] Identifier of the Shipping Option. Required.
|
|
123
|
+
* @param {string} [label] Identifier of the Shipping Option. Required.
|
|
124
|
+
* @param {string} [amount] Amount of the Shipping Option. Required.
|
|
125
|
+
* @param {string} [currency] Currency of the Shipping Option. Required.
|
|
126
|
+
* @param {string} [type] Type of the Shipping Option. Values can be 'SHIPPING' or 'PICKUP'. Required.
|
|
127
|
+
**/
|
|
128
|
+
//# sourceMappingURL=../../src/lib/wallet-buttons/index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../wallet-buttons/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;;;;;IAMI;AAEJ;;;;;;;;;;;IAWI;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;IA0BI;AAEJ;;;;;;;IAOI;AAEJ;;;;;IAKI;AAEJ;;;;;IAKI;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;;;;IA2BI;AAEJ;;;;;;;;;;IAUI;AAEJ;;;;;;;;;IASI;AAEJ;;;;;;;;;;IAUI"}
|
|
@@ -11,6 +11,9 @@ export interface IWalletPaymentSuccessful {
|
|
|
11
11
|
export interface IWalletUnavailable {
|
|
12
12
|
wallet?: WALLET_TYPE;
|
|
13
13
|
}
|
|
14
|
+
export interface IWalletOnClick {
|
|
15
|
+
attachResult: (result: Promise<void> | boolean) => void;
|
|
16
|
+
}
|
|
14
17
|
export interface IWalletUpdate {
|
|
15
18
|
wallet_response_code?: string;
|
|
16
19
|
wallet_order_id?: string;
|
|
@@ -122,4 +125,3 @@ export interface IPaypalUpdate {
|
|
|
122
125
|
};
|
|
123
126
|
}
|
|
124
127
|
export {};
|
|
125
|
-
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=../../src/lib/wallet-buttons/interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../wallet-buttons/interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { WALLET_GATEWAY, WALLET_TYPE } from "../components/param";
|
|
2
|
+
import { AppleWalletService } from "./apple.wallet-service";
|
|
3
|
+
import { GoogleWalletService } from "./google.wallet-service";
|
|
4
|
+
import { WalletService } from "./wallet-service";
|
|
5
|
+
export class MastercardWalletService extends WalletService {
|
|
6
|
+
initializeChildWallets() {
|
|
7
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8
|
+
this.childWallets = [];
|
|
9
|
+
const hasAppleCredentials = !!((_c = (_b = (_a = this.meta) === null || _a === void 0 ? void 0 : _a.credentials) === null || _b === void 0 ? void 0 : _b.apple) === null || _c === void 0 ? void 0 : _c.merchant);
|
|
10
|
+
const hasGoogleCredentials = !!((_f = (_e = (_d = this.meta) === null || _d === void 0 ? void 0 : _d.credentials) === null || _e === void 0 ? void 0 : _e.google) === null || _f === void 0 ? void 0 : _f.merchant);
|
|
11
|
+
if (hasAppleCredentials && (!this.meta.wallets || this.meta.wallets.includes(WALLET_TYPE.APPLE)))
|
|
12
|
+
this.childWallets.push(new AppleWalletService(this.publicKey, this.meta, this.getGatewayName(), this.eventEmitter));
|
|
13
|
+
if (hasGoogleCredentials && (!this.meta.wallets || this.meta.wallets.includes(WALLET_TYPE.GOOGLE)))
|
|
14
|
+
this.childWallets.push(new GoogleWalletService(this.publicKey, this.meta, this.getGatewayName(), this.eventEmitter));
|
|
15
|
+
}
|
|
16
|
+
getGatewayName() {
|
|
17
|
+
return WALLET_GATEWAY.MASTERCARD;
|
|
18
|
+
}
|
|
19
|
+
setEnv(env) {
|
|
20
|
+
this.childWallets.forEach((child) => child.setEnv(env));
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
update(data) {
|
|
24
|
+
this.childWallets.forEach((child) => child.update(data));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=../../src/lib/wallet-buttons/mastercard.wallet-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mastercard.wallet-service.js","sourceRoot":"","sources":["../../wallet-buttons/mastercard.wallet-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAwC,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEvF,MAAM,OAAO,uBAAwB,SAAQ,aAAa;IAC5C,sBAAsB;;QAC5B,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QAEvB,MAAM,mBAAmB,GAAG,CAAC,CAAC,aAAE,MAAA,IAAI,CAAC,IAAI,0CAAE,WAAmB,0CAAE,KAAK,0CAAE,QAAQ,CAAC,CAAA;QAChF,MAAM,oBAAoB,GAAG,CAAC,CAAC,aAAE,MAAA,IAAI,CAAC,IAAI,0CAAE,WAAmB,0CAAE,MAAM,0CAAE,QAAQ,CAAC,CAAA;QAElF,IAAI,mBAAmB,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAC5F,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;QAExH,IAAI,oBAAoB,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YAC9F,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC;IAE7H,CAAC;IAES,cAAc;QACpB,OAAO,cAAc,CAAC,UAAU,CAAC;IACrC,CAAC;IAEM,MAAM,CAAC,GAAW;QACrB,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACxD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEM,MAAM,CAAC,IAA0B;QACpC,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7D,CAAC;CACJ"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { WalletService, WALLET_EVENT, } from "./wallet-service";
|
|
2
|
+
export class PaypalWalletService extends WalletService {
|
|
3
|
+
load(container) {
|
|
4
|
+
if (!window.Promise) {
|
|
5
|
+
// Given that this library does not rely in any polyfill for promises, and this integration depends on them, we early return if Promises are not supported for the browser (like I.E. 11).
|
|
6
|
+
this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, null);
|
|
7
|
+
return Promise.resolve();
|
|
8
|
+
}
|
|
9
|
+
if (this.meta.standalone === true) {
|
|
10
|
+
this.renderPaypalStandaloneComponent(container);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
this.renderPaypalCommonComponent(container);
|
|
14
|
+
}
|
|
15
|
+
return Promise.resolve();
|
|
16
|
+
}
|
|
17
|
+
update(data) {
|
|
18
|
+
if (!this.latestShippingChangePromiseResolve || !this.latestShippingChangePromiseReject)
|
|
19
|
+
return;
|
|
20
|
+
if (!data.success)
|
|
21
|
+
return this.latestShippingChangePromiseReject();
|
|
22
|
+
this.eventEmitter.emit(WALLET_EVENT.CALLBACK, {
|
|
23
|
+
data: { request_type: "UPDATE_TRANSACTION", shipping: this.latestShippingData },
|
|
24
|
+
onSuccess: (_res) => this.latestShippingChangePromiseResolve(true),
|
|
25
|
+
onError: () => this.latestShippingChangePromiseReject(),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
renderPaypalCommonComponent(container) {
|
|
29
|
+
var _a;
|
|
30
|
+
const buttonId = ((_a = container.getElement()) === null || _a === void 0 ? void 0 : _a.id) || '';
|
|
31
|
+
const paypalScript = document.createElement("script");
|
|
32
|
+
paypalScript.src = `https://www.paypal.com/sdk/js?client-id=${this.publicKey}¤cy=${this.meta.currency}${(this.meta.pay_later === true) ? '&enable-funding=paylater&disable-funding=card' : `&disable-funding=credit,card`}${!this.meta.capture ? `&intent=authorize` : ''}`;
|
|
33
|
+
paypalScript.async = true;
|
|
34
|
+
paypalScript.onload = () => {
|
|
35
|
+
if (window.paypal) {
|
|
36
|
+
this.paypal = window.paypal;
|
|
37
|
+
this.paypal.Buttons(Object.assign({}, this.paypalSharedProps())).render(`#${buttonId}`);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, null);
|
|
41
|
+
}
|
|
42
|
+
;
|
|
43
|
+
};
|
|
44
|
+
document.head.appendChild(paypalScript);
|
|
45
|
+
}
|
|
46
|
+
renderPaypalStandaloneComponent(container) {
|
|
47
|
+
var _a, _b;
|
|
48
|
+
const buttonId = ((_a = container.getElement()) === null || _a === void 0 ? void 0 : _a.id) || '';
|
|
49
|
+
const paypalScript = document.createElement("script");
|
|
50
|
+
// buyer-country is only used in Sandbox. It shouldn't be used in production. Based on buyer's geolocation this parameter determine which funding sources are eligible for a given buyer. Refer the link https://developer.paypal.com/sdk/js/configuration/#link-buyercountry
|
|
51
|
+
paypalScript.src = `https://www.paypal.com/sdk/js?client-id=${this.publicKey}¤cy=${this.meta.currency}&components=buttons,funding-eligibility,messages&enable-funding=paylater${!this.meta.capture ? `&intent=authorize` : ''}${((_b = this.meta) === null || _b === void 0 ? void 0 : _b.gateway_mode) === 'live' ? '' : '&buyer-country=AU'}`;
|
|
52
|
+
paypalScript.async = true;
|
|
53
|
+
paypalScript.onload = () => {
|
|
54
|
+
if (window.paypal) {
|
|
55
|
+
this.paypal = window.paypal;
|
|
56
|
+
const isPayLater = !!this.meta.pay_later;
|
|
57
|
+
const button = this.paypal.Buttons(Object.assign({ fundingSource: isPayLater ? this.paypal.FUNDING.PAYLATER : this.paypal.FUNDING.PAYPAL }, this.paypalSharedProps()));
|
|
58
|
+
if (button.isEligible()) {
|
|
59
|
+
button.render(`#${buttonId}`);
|
|
60
|
+
if (isPayLater) {
|
|
61
|
+
const messaging = this.paypal.Messages(Object.assign({ amount: this.meta.amount, currency: this.meta.currency, placement: 'payment' }, (this.meta.style && this.meta.style['messages'] && { style: this.meta.style['messages'] })));
|
|
62
|
+
messaging.render(`#${buttonId}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, null);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, null);
|
|
71
|
+
}
|
|
72
|
+
;
|
|
73
|
+
};
|
|
74
|
+
document.head.appendChild(paypalScript);
|
|
75
|
+
}
|
|
76
|
+
paypalSharedProps() {
|
|
77
|
+
return Object.assign(Object.assign({}, (this.meta.style && { style: this.meta.style })), { onClick: (_data, actions) => {
|
|
78
|
+
let responseValue;
|
|
79
|
+
this.eventEmitter.emit(WALLET_EVENT.BUTTON_CLICK, {
|
|
80
|
+
attachResult: (value) => {
|
|
81
|
+
if (value && value instanceof Promise) {
|
|
82
|
+
responseValue = value
|
|
83
|
+
.then(() => actions.resolve())
|
|
84
|
+
.catch(() => actions.reject());
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
responseValue = value;
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
return responseValue;
|
|
92
|
+
}, createOrder: () => new Promise((resolve, reject) => {
|
|
93
|
+
this.eventEmitter.emit(WALLET_EVENT.CALLBACK, {
|
|
94
|
+
data: Object.assign({ request_type: "CREATE_TRANSACTION" }, this.meta.request_shipping && { request_shipping: this.meta.request_shipping }),
|
|
95
|
+
onSuccess: (res) => resolve(res.id),
|
|
96
|
+
onError: (err) => reject(err),
|
|
97
|
+
});
|
|
98
|
+
}), onShippingChange: (data, _actions) => new Promise((resolve, reject) => {
|
|
99
|
+
const parsedCallbackData = this.parseUpdateData(data);
|
|
100
|
+
this.latestShippingData = parsedCallbackData.shipping;
|
|
101
|
+
this.latestShippingChangePromiseResolve = resolve;
|
|
102
|
+
this.latestShippingChangePromiseReject = reject;
|
|
103
|
+
this.eventEmitter.emit(WALLET_EVENT.UPDATE, parsedCallbackData);
|
|
104
|
+
}), onApprove: (data) => {
|
|
105
|
+
this.pendingApprovalPromise = this.pendingApprovalPromise || new Promise((resolve, reject) => this.eventEmitter.emit(WALLET_EVENT.PAYMENT_METHOD_SELECTED, {
|
|
106
|
+
data: { payment_method_id: data.orderID, customer: { payment_source: { external_payer_id: data.payerID } } },
|
|
107
|
+
onSuccess: () => {
|
|
108
|
+
this.pendingApprovalPromise = undefined;
|
|
109
|
+
resolve(true);
|
|
110
|
+
},
|
|
111
|
+
onError: (err) => {
|
|
112
|
+
this.pendingApprovalPromise = undefined;
|
|
113
|
+
reject(err);
|
|
114
|
+
},
|
|
115
|
+
}));
|
|
116
|
+
return this.pendingApprovalPromise;
|
|
117
|
+
}, onCancel: () => this.eventEmitter.emit(WALLET_EVENT.CHECKOUT_CLOSE), onError: (err) => {
|
|
118
|
+
// Error handling so that paypal does not throw an uncaught error
|
|
119
|
+
// We're already handling errors and notifying Merchants at "wallet-buttons.ts"
|
|
120
|
+
} });
|
|
121
|
+
}
|
|
122
|
+
parseUpdateData(data) {
|
|
123
|
+
var _a;
|
|
124
|
+
return Object.assign(Object.assign({ wallet_order_id: data.orderID, wallet_session_id: data.paymentID, payment_source: {
|
|
125
|
+
wallet_payment_method_id: data.paymentToken,
|
|
126
|
+
} }, data.shipping_address && {
|
|
127
|
+
shipping: {
|
|
128
|
+
address_city: data.shipping_address.city,
|
|
129
|
+
address_state: data.shipping_address.state,
|
|
130
|
+
address_postcode: data.shipping_address.postal_code,
|
|
131
|
+
address_country: data.shipping_address.country_code,
|
|
132
|
+
},
|
|
133
|
+
}), data.selected_shipping_option && {
|
|
134
|
+
selected_shipping_option: {
|
|
135
|
+
id: data.selected_shipping_option.id,
|
|
136
|
+
label: data.selected_shipping_option.label,
|
|
137
|
+
amount: data.selected_shipping_option.amount.value,
|
|
138
|
+
currency: data.selected_shipping_option.amount.currency_code,
|
|
139
|
+
type: (_a = data.selected_shipping_option) === null || _a === void 0 ? void 0 : _a.type,
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=../../src/lib/wallet-buttons/paypal.wallet-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paypal.wallet-service.js","sourceRoot":"","sources":["../../wallet-buttons/paypal.wallet-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,aAAa,EACb,YAAY,GACf,MAAM,kBAAkB,CAAC;AAU1B,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IAO3C,IAAI,CAAC,SAAoB;QAC5B,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACjB,0LAA0L;YAC1L,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;YACvD,OAAO,OAAO,CAAC,OAAO,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iEAAiE;gBACjE,+EAA+E;YACnF,CAAC,IACJ;IACL,CAAC;IAEO,eAAe,CAAC,IAAmB;;QACvC,qCACI,eAAe,EAAE,IAAI,CAAC,OAAO,EAC7B,iBAAiB,EAAE,IAAI,CAAC,SAAS,EACjC,cAAc,EAAE;gBACZ,wBAAwB,EAAE,IAAI,CAAC,YAAY;aAC9C,IACE,IAAI,CAAC,gBAAgB,IAAI;YACxB,QAAQ,EAAE;gBACN,YAAY,EAAE,IAAI,CAAC,gBAAgB,CAAC,IAAI;gBACxC,aAAa,EAAE,IAAI,CAAC,gBAAgB,CAAC,KAAK;gBAC1C,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,CAAC,WAAW;gBACnD,eAAe,EAAE,IAAI,CAAC,gBAAgB,CAAC,YAAY;aACtD;SACJ,GACE,IAAI,CAAC,wBAAwB,IAAI;YAChC,wBAAwB,EAAE;gBACtB,EAAE,EAAE,IAAI,CAAC,wBAAwB,CAAC,EAAE;gBACpC,KAAK,EAAE,IAAI,CAAC,wBAAwB,CAAC,KAAK;gBAC1C,MAAM,EAAE,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,KAAK;gBAClD,QAAQ,EAAE,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,aAAa;gBAC5D,IAAI,QAAE,IAAI,CAAC,wBAAwB,0CAAE,IAAI;aAC5C;SACJ,EACH;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { WALLET_TYPE } from "../components/param";
|
|
2
|
+
import { loadStripe } from "@stripe/stripe-js/pure";
|
|
3
|
+
import { WalletService, WALLET_EVENT, } from "./wallet-service";
|
|
4
|
+
export const UI_COMPLETION_STATE = {
|
|
5
|
+
SUCCESS: "success",
|
|
6
|
+
FAIL: "fail",
|
|
7
|
+
};
|
|
8
|
+
export class StripeWalletService extends WalletService {
|
|
9
|
+
initPaymentRequest() {
|
|
10
|
+
return this.stripe.paymentRequest({
|
|
11
|
+
country: this.meta.country.toUpperCase(),
|
|
12
|
+
currency: this.meta.currency.toLowerCase(),
|
|
13
|
+
total: {
|
|
14
|
+
label: this.meta.amount_label,
|
|
15
|
+
amount: Math.floor(this.meta.amount * 100),
|
|
16
|
+
},
|
|
17
|
+
requestPayerName: this.meta.request_payer_name === true,
|
|
18
|
+
requestPayerEmail: this.meta.request_payer_email === true,
|
|
19
|
+
requestPayerPhone: this.meta.request_payer_phone === true,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
createWalletButton() {
|
|
23
|
+
return this.stripe.elements().create("paymentRequestButton", {
|
|
24
|
+
paymentRequest: this.paymentRequest,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
load(container) {
|
|
28
|
+
return loadStripe(this.publicKey)
|
|
29
|
+
.then((stripe) => {
|
|
30
|
+
this.stripe = stripe;
|
|
31
|
+
this.paymentRequest = this.initPaymentRequest();
|
|
32
|
+
})
|
|
33
|
+
.then(() => this.checkAvailability())
|
|
34
|
+
.then((availability) => this.mount(container, availability))
|
|
35
|
+
.then(() => this.setOnPaymentMethodSelected());
|
|
36
|
+
}
|
|
37
|
+
checkAvailability() {
|
|
38
|
+
return this.paymentRequest
|
|
39
|
+
.canMakePayment()
|
|
40
|
+
.then((available) => {
|
|
41
|
+
if (available) {
|
|
42
|
+
const gpay_enabled = !this.meta.wallets ||
|
|
43
|
+
this.meta.wallets.includes(WALLET_TYPE.GOOGLE);
|
|
44
|
+
const applepay_enabled = !this.meta.wallets ||
|
|
45
|
+
this.meta.wallets.includes(WALLET_TYPE.APPLE);
|
|
46
|
+
// TODO: this isn't accurate. Discard Chrome saved cards and microsoft pay payment to show google pay button
|
|
47
|
+
return {
|
|
48
|
+
google_pay: gpay_enabled && !available.applePay,
|
|
49
|
+
apple_pay: applepay_enabled && available.applePay,
|
|
50
|
+
flypay: false,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
mount(container, availability) {
|
|
56
|
+
if (!availability || (!availability.apple_pay && !availability.google_pay))
|
|
57
|
+
return this.eventEmitter.emit(WALLET_EVENT.UNAVAILABLE, null);
|
|
58
|
+
this.createWalletButton().mount(container.getElement());
|
|
59
|
+
}
|
|
60
|
+
setOnPaymentMethodSelected() {
|
|
61
|
+
this.paymentRequest.on("paymentmethod", (event) => {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
const { paymentMethod: { id, card, billing_details: { name, address }, }, } = event;
|
|
64
|
+
const data = {
|
|
65
|
+
payment_method_id: id,
|
|
66
|
+
customer: {
|
|
67
|
+
payer_name: event.payerName,
|
|
68
|
+
payer_email: event.payerEmail,
|
|
69
|
+
payer_phone: event.payerPhone,
|
|
70
|
+
payment_source: {
|
|
71
|
+
wallet_type: this.getWalletType((_a = card === null || card === void 0 ? void 0 : card.wallet) === null || _a === void 0 ? void 0 : _a.type),
|
|
72
|
+
card_name: name,
|
|
73
|
+
type: (_b = card === null || card === void 0 ? void 0 : card.wallet) === null || _b === void 0 ? void 0 : _b.type,
|
|
74
|
+
card_scheme: card === null || card === void 0 ? void 0 : card.brand,
|
|
75
|
+
card_number_last4: card === null || card === void 0 ? void 0 : card.last4,
|
|
76
|
+
expire_month: card === null || card === void 0 ? void 0 : card.exp_month,
|
|
77
|
+
expire_year: card === null || card === void 0 ? void 0 : card.exp_year,
|
|
78
|
+
address_line1: address.line1,
|
|
79
|
+
address_line2: address.line2,
|
|
80
|
+
address_city: address.city,
|
|
81
|
+
address_postcode: address.postal_code,
|
|
82
|
+
address_state: address.state,
|
|
83
|
+
address_country: address.country,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
this.eventEmitter.emit(WALLET_EVENT.PAYMENT_METHOD_SELECTED, {
|
|
88
|
+
data,
|
|
89
|
+
onSuccess: () => event.complete(UI_COMPLETION_STATE.SUCCESS),
|
|
90
|
+
onError: (err) => event.complete(UI_COMPLETION_STATE.FAIL),
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
getWalletType(type) {
|
|
95
|
+
if (!type)
|
|
96
|
+
return null;
|
|
97
|
+
return type === 'google_pay' ? WALLET_TYPE.GOOGLE : WALLET_TYPE.APPLE;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=../../src/lib/wallet-buttons/stripe.wallet-service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripe.wallet-service.js","sourceRoot":"","sources":["../../wallet-buttons/stripe.wallet-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAQlD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAIH,aAAa,EACb,YAAY,GACf,MAAM,kBAAkB,CAAC;AAG1B,MAAM,CAAC,MAAM,mBAAmB,GAAG;IAC/B,OAAO,EAAE,SAAyC;IAClD,IAAI,EAAE,MAAsC;CAC/C,CAAC;AAEF,MAAM,OAAO,mBAAoB,SAAQ,aAAa;IAIxC,kBAAkB;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC;YAC9B,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE;YACxC,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE;YAC1C,KAAK,EAAE;gBACH,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY;gBAC7B,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC;aAC7C;YACD,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,kBAAkB,KAAK,IAAI;YACvD,iBAAiB,EAAE,IAAI,CAAC,IAAI,CAAC,mBAAmB,KAAK,IAAI;YACzD,iBAAiB,EAAE,IAAI,CAAC,IAAI,CAAC,mBAAmB,KAAK,IAAI;SAC5D,CAAC,CAAC;IACP,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