@justifi/webcomponents 6.7.0 → 6.7.2
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/dist/cjs/{check-pkg-version-nSgWWvdw.js → check-pkg-version-BG-Rfkh5.js} +1 -1
- package/dist/cjs/hidden-input_2.cjs.entry.js +1 -1
- package/dist/cjs/internal-tokenize-payment-method_7.cjs.entry.js +9 -7
- package/dist/cjs/justifi-apple-pay_8.cjs.entry.js +10 -8
- package/dist/cjs/justifi-business-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-business-form.cjs.entry.js +2 -2
- package/dist/cjs/justifi-checkout.cjs.entry.js +2 -2
- package/dist/cjs/justifi-checkouts-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-dispute-management.cjs.entry.js +2 -2
- package/dist/cjs/justifi-dispute-notification_3.cjs.entry.js +2 -2
- package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +2 -2
- package/dist/cjs/justifi-order-terminals.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payments-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payout-details.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-payouts-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-refund-payment.cjs.entry.js +98 -6
- package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +2 -2
- package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +2 -2
- package/dist/cjs/justifi-terminals-list.cjs.entry.js +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{package-B8gOzTFM.js → package-Df5lTFe6.js} +1 -1
- package/dist/cjs/webcomponents.cjs.js +1 -1
- package/dist/collection/actions/void/void-actions.js +31 -0
- package/dist/collection/api/services/google-pay.service.js +2 -1
- package/dist/collection/api/services/void.service.js +9 -0
- package/dist/collection/components/modular-checkout/modular-checkout.js +3 -2
- package/dist/collection/components/modular-checkout/sub-components/bank-account.js +6 -3
- package/dist/collection/components/modular-checkout/sub-components/card-form.js +6 -3
- package/dist/collection/components/modular-checkout/sub-components/google-pay.js +3 -3
- package/dist/collection/components/refund-payment/refund-payment.js +66 -10
- package/dist/docs.json +15 -10
- package/dist/esm/{check-pkg-version-CmkUoEAo.js → check-pkg-version-c_8fDHCB.js} +1 -1
- package/dist/esm/hidden-input_2.entry.js +1 -1
- package/dist/esm/internal-tokenize-payment-method_7.entry.js +9 -7
- package/dist/esm/justifi-apple-pay_8.entry.js +10 -8
- package/dist/esm/justifi-business-details.entry.js +2 -2
- package/dist/esm/justifi-business-form.entry.js +2 -2
- package/dist/esm/justifi-checkout.entry.js +2 -2
- package/dist/esm/justifi-checkouts-list.entry.js +2 -2
- package/dist/esm/justifi-dispute-management.entry.js +2 -2
- package/dist/esm/justifi-dispute-notification_3.entry.js +2 -2
- package/dist/esm/justifi-gross-payment-chart.entry.js +2 -2
- package/dist/esm/justifi-order-terminals.entry.js +2 -2
- package/dist/esm/justifi-payment-details.entry.js +2 -2
- package/dist/esm/justifi-payment-provisioning.entry.js +2 -2
- package/dist/esm/justifi-payment-transactions-list.entry.js +2 -2
- package/dist/esm/justifi-payments-list.entry.js +2 -2
- package/dist/esm/justifi-payout-details.entry.js +2 -2
- package/dist/esm/justifi-payout-transactions-list.entry.js +2 -2
- package/dist/esm/justifi-payouts-list.entry.js +2 -2
- package/dist/esm/justifi-refund-payment.entry.js +98 -6
- package/dist/esm/justifi-season-interruption-insurance.entry.js +2 -2
- package/dist/esm/justifi-terminal-orders-list.entry.js +2 -2
- package/dist/esm/justifi-terminals-list.entry.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{package-CsRppqXL.js → package-BzT9OxlN.js} +1 -1
- package/dist/esm/webcomponents.js +1 -1
- package/dist/module/bank-account-form.js +1 -1
- package/dist/module/bank-account.js +5 -2
- package/dist/module/card-form.js +1 -1
- package/dist/module/card-form2.js +5 -2
- package/dist/module/google-pay.js +5 -4
- package/dist/module/justifi-checkouts-list-filters.js +1 -1
- package/dist/module/justifi-payment-transactions-list.js +1 -1
- package/dist/module/justifi-payments-list-filters.js +1 -1
- package/dist/module/justifi-payout-transactions-list.js +1 -1
- package/dist/module/justifi-payouts-list-filters.js +1 -1
- package/dist/module/justifi-refund-payment.js +97 -4
- package/dist/module/justifi-terminal-orders-list-filters.js +1 -1
- package/dist/module/modular-checkout.js +3 -2
- package/dist/module/package.js +1 -1
- package/dist/module/payments-list-core2.js +1 -1
- package/dist/module/payout-details-core2.js +1 -1
- package/dist/module/payouts-list-core2.js +1 -1
- package/dist/module/terminal-orders-list-core2.js +1 -1
- package/dist/module/utils2.js +1 -1
- package/dist/types/actions/void/void-actions.d.ts +10 -0
- package/dist/types/api/services/google-pay.service.d.ts +1 -1
- package/dist/types/api/services/void.service.d.ts +7 -0
- package/dist/types/components/modular-checkout/sub-components/bank-account.d.ts +1 -0
- package/dist/types/components/modular-checkout/sub-components/card-form.d.ts +1 -0
- package/dist/types/components/refund-payment/refund-payment.d.ts +6 -2
- package/dist/types/components.d.ts +3 -3
- package/dist/webcomponents/{p-c0bd4e9a.entry.js → p-035a4adc.entry.js} +1 -1
- package/dist/webcomponents/{p-c4585b68.entry.js → p-0935600b.entry.js} +1 -1
- package/dist/webcomponents/{p-fc8f55d7.entry.js → p-0ab9a3ae.entry.js} +1 -1
- package/dist/webcomponents/{p-DISrhs4v.js → p-11wdbrqX.js} +1 -1
- package/dist/webcomponents/{p-fe73b09b.entry.js → p-138ada4a.entry.js} +1 -1
- package/dist/webcomponents/p-148d3327.entry.js +1 -0
- package/dist/webcomponents/p-2cb9edad.entry.js +1 -0
- package/dist/webcomponents/{p-04ec17bb.entry.js → p-2d4a2d26.entry.js} +1 -1
- package/dist/webcomponents/p-3f14d0c4.entry.js +1 -0
- package/dist/webcomponents/{p-d2981754.entry.js → p-5c6727ae.entry.js} +1 -1
- package/dist/webcomponents/{p-eada0422.entry.js → p-622af881.entry.js} +1 -1
- package/dist/webcomponents/{p-50400c5e.entry.js → p-64ebff16.entry.js} +1 -1
- package/dist/webcomponents/p-71577fa1.entry.js +1 -0
- package/dist/webcomponents/p-7ec4838f.entry.js +1 -0
- package/dist/webcomponents/p-BzT9OxlN.js +1 -0
- package/dist/webcomponents/p-af7c219d.entry.js +1 -0
- package/dist/webcomponents/{p-74fea39c.entry.js → p-b752c5bc.entry.js} +1 -1
- package/dist/webcomponents/{p-f23428da.entry.js → p-bbff6196.entry.js} +1 -1
- package/dist/webcomponents/p-c0c36187.entry.js +1 -0
- package/dist/webcomponents/{p-ff5981fb.entry.js → p-d077569e.entry.js} +1 -1
- package/dist/webcomponents/{p-87988b4d.entry.js → p-d7b1b7b5.entry.js} +1 -1
- package/dist/webcomponents/{p-095cedc5.entry.js → p-dc6c9c79.entry.js} +1 -1
- package/dist/webcomponents/p-ecbc83bf.entry.js +1 -0
- package/dist/webcomponents/{p-b2a0cbad.entry.js → p-f56d7b4c.entry.js} +1 -1
- package/dist/webcomponents/webcomponents.esm.js +1 -1
- package/docs/.eslintrc.cjs +17 -0
- package/docs/changelog/index.mdx +17 -0
- package/docs/entities/businessdetails/index.mdx +143 -0
- package/docs/entities/businessform/index.mdx +241 -0
- package/docs/entities/index.mdx +19 -0
- package/docs/entities/payment-provisioning/index.mdx +128 -0
- package/docs/frameworks/angular/index.mdx +112 -0
- package/docs/frameworks/index.mdx +18 -0
- package/docs/frameworks/react/index.mdx +125 -0
- package/docs/frameworks/vue/index.mdx +102 -0
- package/docs/helpers/PartsTable.js +50 -0
- package/docs/helpers/PropsTable.js +56 -0
- package/docs/helpers/index.ts +3 -0
- package/docs/helpers/version.js +32 -0
- package/docs/introduction/index.mdx +125 -0
- package/docs/merchant-tools/checkouts-list/index.mdx +97 -0
- package/docs/merchant-tools/gross-payments-chart/index.mdx +83 -0
- package/docs/merchant-tools/index.mdx +25 -0
- package/docs/merchant-tools/order-terminals/index.mdx +84 -0
- package/docs/merchant-tools/payment-details/index.mdx +132 -0
- package/docs/merchant-tools/payment-transactions-list/index.mdx +85 -0
- package/docs/merchant-tools/payments-list/index.mdx +109 -0
- package/docs/merchant-tools/payout-details/index.mdx +84 -0
- package/docs/merchant-tools/payout-transactions-list/index.mdx +84 -0
- package/docs/merchant-tools/payouts-list/index.mdx +92 -0
- package/docs/merchant-tools/terminal-orders-list/index.mdx +85 -0
- package/docs/merchant-tools/terminals-list/index.mdx +93 -0
- package/docs/modular-checkout/complete-examples/index.mdx +20 -0
- package/docs/modular-checkout/index.mdx +20 -0
- package/docs/modular-checkout/introduction/index.mdx +102 -0
- package/docs/modular-checkout/sub-components/apple-pay.mdx +106 -0
- package/docs/modular-checkout/sub-components/bank-account-form.mdx +167 -0
- package/docs/modular-checkout/sub-components/card-form.mdx +178 -0
- package/docs/modular-checkout/sub-components/index.mdx +23 -0
- package/docs/modular-checkout/sub-components/payment-method-options.mdx +87 -0
- package/docs/modular-checkout/sub-components/plaid-payment-method.mdx +158 -0
- package/docs/modular-checkout/sub-components/saved-payment-methods.mdx +183 -0
- package/docs/modular-checkout/sub-components/season-interruption-insurance.mdx +221 -0
- package/docs/modular-checkout/sub-components/sezzle-payment-method.mdx +183 -0
- package/docs/modular-checkout/sub-components/summary.mdx +111 -0
- package/docs/payment-facilitation/dispute-management/index.mdx +99 -0
- package/docs/payment-facilitation/index.mdx +21 -0
- package/docs/payment-facilitation/refund-payment/index.mdx +241 -0
- package/docs/payment-facilitation/tokenize-payment-method/index.mdx +350 -0
- package/docs/payment-facilitation/unified-fintech-checkout/342/204/242/index.mdx +150 -0
- package/package.json +21 -6
- package/dist/webcomponents/p-0e981c28.entry.js +0 -1
- package/dist/webcomponents/p-15ceeea7.entry.js +0 -1
- package/dist/webcomponents/p-9c1aa22d.entry.js +0 -1
- package/dist/webcomponents/p-CsRppqXL.js +0 -1
- package/dist/webcomponents/p-aa145996.entry.js +0 -1
- package/dist/webcomponents/p-b5b49e86.entry.js +0 -1
- package/dist/webcomponents/p-d9cdd873.entry.js +0 -1
- package/dist/webcomponents/p-ef04f334.entry.js +0 -1
- package/dist/webcomponents/p-f5dd3fa4.entry.js +0 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: payment-facilitation/unified-fintech-checkout™/index
|
|
3
|
+
title: Unified Fintech Checkout™
|
|
4
|
+
description: Unified Fintech Checkout™ component that orchestrates payment capture, verification, and confirmation states.
|
|
5
|
+
sidebar_position: 20
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
import { PropsTable, PartsTable } from '@justifi/webcomponents/docs/helpers';
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
`<justifi-checkout>` renders a complete checkout experience: payment method entry, order summary, error handling, and confirmation states. Use it when you want a turnkey experience without composing Modular Checkout subcomponents manually.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
<pre>
|
|
17
|
+
<code className="language-html">{`<justifi-checkout
|
|
18
|
+
account-id="acc_123"
|
|
19
|
+
auth-token="wct_checkout"
|
|
20
|
+
checkout-id="chk_456"
|
|
21
|
+
locale="en-US"
|
|
22
|
+
/>`}</code>
|
|
23
|
+
</pre>
|
|
24
|
+
|
|
25
|
+
## Props, Events & Methods
|
|
26
|
+
|
|
27
|
+
<div
|
|
28
|
+
dangerouslySetInnerHTML={{
|
|
29
|
+
__html: PropsTable([
|
|
30
|
+
{
|
|
31
|
+
name: 'account-id',
|
|
32
|
+
type: 'string',
|
|
33
|
+
required: true,
|
|
34
|
+
description:
|
|
35
|
+
'Owning platform account; determines branding + permissions.',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'auth-token',
|
|
39
|
+
type: 'string',
|
|
40
|
+
required: true,
|
|
41
|
+
description: 'Web Component Token with `write:checkout` scope.',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'checkout-id',
|
|
45
|
+
type: 'string',
|
|
46
|
+
required: true,
|
|
47
|
+
description:
|
|
48
|
+
'Server-generated checkout session controlling line items and totals.',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'require-save-payment-method',
|
|
52
|
+
type: 'boolean',
|
|
53
|
+
defaultValue: 'false',
|
|
54
|
+
description:
|
|
55
|
+
'When true, forces customers to save the payment method for future use.',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'locale',
|
|
59
|
+
type: 'string',
|
|
60
|
+
defaultValue: 'en-US',
|
|
61
|
+
description:
|
|
62
|
+
'Controls currency formatting, copy, and date presentation.',
|
|
63
|
+
},
|
|
64
|
+
]),
|
|
65
|
+
}}
|
|
66
|
+
/>
|
|
67
|
+
|
|
68
|
+
### Events
|
|
69
|
+
|
|
70
|
+
- `completed`: Emits when payment succeeds; payload includes `checkout_id`, `payment_method_token`, and receipt data.
|
|
71
|
+
- `error`: Fires if payment processing fails; includes error codes for analytics.
|
|
72
|
+
- `step-changed`: Useful when you pipe analytics or breadcrumbs for multi-step flows.
|
|
73
|
+
|
|
74
|
+
### Public methods
|
|
75
|
+
|
|
76
|
+
1. `submit()` – Programmatically trigger the pay button (helpful if you hide the built-in CTA).
|
|
77
|
+
2. `reset(checkoutId)` – Reload a different checkout session without re-mounting the component.
|
|
78
|
+
|
|
79
|
+
## Theming & Layout
|
|
80
|
+
|
|
81
|
+
<div
|
|
82
|
+
dangerouslySetInnerHTML={{
|
|
83
|
+
__html: PartsTable([
|
|
84
|
+
{
|
|
85
|
+
name: 'font-family',
|
|
86
|
+
description: 'Controls the font family for the component.',
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'color',
|
|
90
|
+
description: 'Controls the text color.',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'background-color',
|
|
94
|
+
description: 'Controls the background color.',
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'button',
|
|
98
|
+
description: 'Button styles.',
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'button-disabled',
|
|
102
|
+
description: 'Disabled button styles.',
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'input',
|
|
106
|
+
description: 'Input field styles.',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'input-focused',
|
|
110
|
+
description: 'Input styles when focused.',
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'input-invalid',
|
|
114
|
+
description: 'Input styles when invalid.',
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: 'input-invalid-and-focused',
|
|
118
|
+
description: 'Input styles when invalid and focused.',
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'input-radio',
|
|
122
|
+
description: 'Radio input styles.',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: 'input-checkbox',
|
|
126
|
+
description: 'Checkbox input styles.',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'input-checkbox-checked',
|
|
130
|
+
description: 'Checkbox input styles when checked.',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
name: 'input-checkbox-checked-focused',
|
|
134
|
+
description: 'Checkbox input styles when checked and focused.',
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: 'input-checkbox-focused',
|
|
138
|
+
description: 'Checkbox input styles when focused.',
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: 'button-primary',
|
|
142
|
+
description: 'Primary button styles.',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: 'radio-list-item',
|
|
146
|
+
description: 'Radio list item styles.',
|
|
147
|
+
},
|
|
148
|
+
]),
|
|
149
|
+
}}
|
|
150
|
+
/>
|
package/package.json
CHANGED
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justifi/webcomponents",
|
|
3
|
-
"version": "6.7.
|
|
3
|
+
"version": "6.7.2",
|
|
4
4
|
"description": "JustiFi Web Components",
|
|
5
5
|
"collection": "dist/collection/collection-manifest.json",
|
|
6
6
|
"main": "dist/index.cjs.js",
|
|
7
7
|
"module": "dist/module/index.js",
|
|
8
8
|
"types": "dist/types/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
12
|
+
"require": "./dist/index.cjs.js",
|
|
13
|
+
"import": "./dist/module/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./docs/*": "./docs/*",
|
|
16
|
+
"./docs/helpers": "./docs/helpers/index.ts",
|
|
17
|
+
"./docs/helpers/*": "./docs/helpers/*.js",
|
|
18
|
+
"./dist/module/*": "./dist/module/*.js",
|
|
19
|
+
"./dist/docs.json": "./dist/docs.json",
|
|
20
|
+
"./package.json": "./package.json"
|
|
21
|
+
},
|
|
9
22
|
"repository": {
|
|
10
23
|
"type": "git",
|
|
11
24
|
"url": "git+https://github.com/justifi-tech/web-component-library.git"
|
|
@@ -15,7 +28,8 @@
|
|
|
15
28
|
"registry": "https://registry.npmjs.org"
|
|
16
29
|
},
|
|
17
30
|
"files": [
|
|
18
|
-
"dist/"
|
|
31
|
+
"dist/",
|
|
32
|
+
"docs/"
|
|
19
33
|
],
|
|
20
34
|
"dependencies": {
|
|
21
35
|
"@popperjs/core": "^2.11.8",
|
|
@@ -34,14 +48,14 @@
|
|
|
34
48
|
},
|
|
35
49
|
"devDependencies": {
|
|
36
50
|
"@babel/preset-env": "^7.21.5",
|
|
37
|
-
"@babel/preset-react": "^7.18.6",
|
|
38
51
|
"@babel/preset-typescript": "^7.21.5",
|
|
52
|
+
"@eslint/eslintrc": "^3.3.1",
|
|
39
53
|
"@rollup/plugin-replace": "^6.0.1",
|
|
40
54
|
"@stencil/sass": "^3.0.1",
|
|
41
55
|
"@types/jest": "29.5.14",
|
|
42
|
-
"@types/react": "^19.0.12",
|
|
43
|
-
"@types/react-dom": "^19.0.4",
|
|
44
56
|
"dotenv": "^16.3.1",
|
|
57
|
+
"eslint": "^9.27.0",
|
|
58
|
+
"eslint-plugin-mdx": "^3.1.5",
|
|
45
59
|
"jest": "^29.7.0",
|
|
46
60
|
"jest-cli": "^29.7.0",
|
|
47
61
|
"jest-environment-node": "^29.7.0",
|
|
@@ -58,6 +72,7 @@
|
|
|
58
72
|
"generate": "stencil generate",
|
|
59
73
|
"test": "TZ=utc stencil test --spec",
|
|
60
74
|
"test:watch": "TZ=utc stencil test --spec --watchAll",
|
|
61
|
-
"test:file": "stencil test --spec --watch --"
|
|
75
|
+
"test:file": "stencil test --spec --watch --",
|
|
76
|
+
"docs:lint": "eslint --ext .md,.mdx --config docs/.eslintrc.cjs docs"
|
|
62
77
|
}
|
|
63
78
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,c as t,h as i}from"./p-DwYM91AU.js";import{C as r,a as o}from"./p-Cjcsf8ku.js";import{c as e,J as a}from"./p-DISrhs4v.js";import{T as p}from"./p-CCxsFwC4.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{f as n}from"./p-BrRsgB8S.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{g as c,a as h}from"./p-D2muobcE.js";import{m,S as d}from"./p-C9VmfRis.js";import{S as u}from"./p-BP2sTIQV.js";import"./p-CZfYo5-1.js";import{d as l}from"./p-CV8xqdt6.js";import"./p-CsRppqXL.js";import"./p-yyedWKWX.js";import"./p-B09GVew-.js";import"./p-BYsgavgS.js";import"./p-DkoufM1t.js";import"./p-U3nU15el.js";import"./p-sA8HBfkI.js";const f=class{constructor(i){s(this,i),this.errorEvent=t(this,"error-event"),this.errorMessage=null,this.columns=l,this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)}}componentWillLoad(){e(),this.analytics=new a(this),this.initializeGetData()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}propChanged(){this.initializeGetData()}initializeGetData(){this.initializeGetTerminals(),this.initializeGetSubAccounts()}initializeGetTerminals(){this.accountId&&this.authToken?this.getTerminals=(({id:s,authToken:t,service:i})=>async({params:o,onSuccess:e,onError:a})=>{var p,m;try{const d=await i.fetchTerminals(s,t,o);if(d.error)return a({error:h(d.error),code:c(null===(m=d.error)||void 0===m?void 0:m.code),severity:r.ERROR});{const s=Object.assign({},d.page_info);e({terminals:(null===(p=d.data)||void 0===p?void 0:p.map((s=>new n(s))))||[],pagingInfo:s})}}catch(s){const t=c(null==s?void 0:s.code);return a({error:s.message||s,code:t,severity:r.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new p}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:o.MISSING_PROPS,message:this.errorMessage,severity:r.ERROR}))}initializeGetSubAccounts(){this.accountId&&this.authToken&&(this.getSubAccounts=m({accountId:this.accountId,authToken:this.authToken,service:new d}))}render(){return i(u,{key:"9bf1797fc21c7fdf2b58aedab5819513338e714b"},i("terminals-list-core",{key:"46c5f5cc5a436d47e4813207cce07d28a4f20ef7",getTerminals:this.getTerminals,getSubAccounts:this.getSubAccounts,"onError-event":this.handleErrorEvent,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{f as justifi_terminals_list}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,c as r,h as t}from"./p-DwYM91AU.js";import{S as i}from"./p-BP2sTIQV.js";import"./p-CZfYo5-1.js";import{c as e,J as o}from"./p-DISrhs4v.js";import{d as a}from"./p-B4xdk4mG.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{C as n,a as p}from"./p-Cjcsf8ku.js";import{j as c}from"./p-BrRsgB8S.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{g as m,a as h}from"./p-D2muobcE.js";import{A as d}from"./p-yyedWKWX.js";import"./p-CsRppqXL.js";import"./p-sA8HBfkI.js";import"./p-B09GVew-.js";import"./p-U3nU15el.js";import"./p-BYsgavgS.js";import"./p-DkoufM1t.js";const l=d();class u{async fetchTerminalOrders(s,r,t){return l.get({endpoint:"terminals/orders",params:t,headers:{account:s},authToken:r})}}const f=class{constructor(t){s(this,t),this.errorEvent=r(this,"error-event"),this.errorMessage=null,this.columns=a,this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)}}componentWillLoad(){e(),this.analytics=new o(this),this.initializeGetData()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}initializeGetData(){this.accountId&&this.authToken?this.getTerminalOrders=(({id:s,authToken:r,service:t})=>async({params:i,onSuccess:e,onError:o,final:a})=>{var p,d;try{const a=await t.fetchTerminalOrders(s,r,i);if(a.error)return o({error:h(a.error),code:m(null===(d=a.error)||void 0===d?void 0:d.code),severity:n.ERROR});{const s=Object.assign({},a.page_info);e({terminalOrders:(null===(p=a.data)||void 0===p?void 0:p.map((s=>new c(s))))||[],pagingInfo:s})}}catch(s){const r=m(null==s?void 0:s.code);return o({error:s.message||s,code:r,severity:n.ERROR})}finally{return a()}})({id:this.accountId,authToken:this.authToken,service:new u}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:p.MISSING_PROPS,message:this.errorMessage,severity:n.ERROR}))}render(){return t(i,{key:"ff51026cc99afbe51442832292c46053ad0c538a"},t("terminal-orders-list-core",{key:"c99fe72d7ab55b4560b4af08b1152cec7a8d663b",getTerminalOrders:this.getTerminalOrders,"onError-event":this.handleErrorEvent,columns:this.columns}))}};export{f as justifi_terminal_orders_list}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as t,r as e,c as i,H as n,g as s}from"./p-DwYM91AU.js";import{A as o}from"./p-yyedWKWX.js";import{A as a,o as r,p as l,q as c,r as h,s as d,c as p,t as u,G as y,u as g,v as b,w as m,x as f,y as v,z as M,B as w,D as k,I as P,F as x,H as E}from"./p-BrRsgB8S.js";import{S as j}from"./p-BP2sTIQV.js";import"./p-CZfYo5-1.js";import{S as A}from"./p-CsgUIrv8.js";import{G as T,v as N}from"./p-sA8HBfkI.js";import{f as I}from"./p-B09GVew-.js";import{P as C,a as D,b as S}from"./p-DkoufM1t.js";import{H as L}from"./p-DmdEjScI.js";import{H as O,b as z,h as R,i as _}from"./p-BhqSAzpT.js";import{H as U}from"./p-CQGIjIgZ.js";import{J as B,c as G}from"./p-DISrhs4v.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{C as Y,a as F,b as Q}from"./p-Cjcsf8ku.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{g as V,a as H}from"./p-D2muobcE.js";import{C as q}from"./p-VRubcA-q.js";import{C as W}from"./p-ZpPDShvP.js";import"./p-BYsgavgS.js";import"./p-CsRppqXL.js";var Z;!function(t){t.UNAVAILABLE="UNAVAILABLE",t.SESSION_ERROR="SESSION_ERROR",t.MERCHANT_VALIDATION_ERROR="MERCHANT_VALIDATION_ERROR",t.PAYMENT_PROCESSING_ERROR="PAYMENT_PROCESSING_ERROR",t.USER_CANCELLED="USER_CANCELLED"}(Z||(Z={}));class X{constructor(){this.api=o()}initialize(t){if(this.applePayConfig=new a(t),!this.applePayConfig.isValid)throw new Error("Invalid Apple Pay configuration provided")}async validateMerchant(t,e){try{return await this.api.post({endpoint:"apple_pay/merchant_session",authToken:t,headers:{"Sub-Account":e},body:{domain:window.location.host,display_name:this.applePayConfig.displayName}})}catch(t){throw console.error("Backend validation failed:",t),new Error("Merchant validation failed")}}async processPayment(t,e,i){const n=await this.api.post({endpoint:"apple_pay/process_token",authToken:t,body:i,headers:{"Sub-Account":e}});return{success:n.id&&!!n.data.token,data:n}}isAvailable(){return r.isApplePaySupported()&&r.canMakePayments()}async canMakePaymentsWithActiveCard(){if(!this.applePayConfig)throw new Error("Apple Pay not initialized. Call initialize() first.");return await r.canMakePaymentsWithActiveCard(this.applePayConfig.merchantIdentifier)}async startPaymentSession(t,e,i){if(!this.applePayConfig)throw console.error("[ApplePayService] Missing applePayConfig. Did you call initialize()?"),new Error("Apple Pay not initialized. Call initialize() first.");const n=new l(t);if(!n.isValid){const t=[];throw n.countryCode||t.push("countryCode"),n.currencyCode||t.push("currencyCode"),n.merchantCapabilities&&0!==n.merchantCapabilities.length||t.push("merchantCapabilities"),n.supportedNetworks&&0!==n.supportedNetworks.length||t.push("supportedNetworks"),n.total&&n.total.label&&n.total.amount||t.push("total"),console.error("[ApplePayService] Payment request is invalid. Missing/invalid:",t),new Error("Invalid payment request provided")}return this.currentPaymentRequest=n,new Promise(((t,s)=>{try{if("undefined"==typeof window||!("ApplePaySession"in window))return console.error("[ApplePayService] ApplePaySession not available on window"),s({success:!1,error:{code:Z.UNAVAILABLE,message:"ApplePaySession API is not available in this environment"}});this.currentSession=new window.ApplePaySession(3,n),this.setupSessionEventHandlers(t,s,e,i),this.currentSession.begin()}catch(t){console.error("[ApplePayService] Exception while starting session:",t),s({success:!1,error:{code:Z.SESSION_ERROR,message:t instanceof Error?t.message:"Failed to start Apple Pay session"}})}}))}abortPaymentSession(){this.currentSession&&(this.currentSession.abort(),this.currentSession=void 0,this.currentPaymentRequest=void 0)}setupSessionEventHandlers(t,e,i,n){this.currentSession&&this.applePayConfig&&this.currentPaymentRequest?(this.currentSession.onvalidatemerchant=async()=>{try{if(!i)throw console.error("[ApplePayService] Missing authToken for merchant validation"),new Error("Authentication token not provided.");const t=await this.validateMerchant(i,n);try{this.currentSession.completeMerchantValidation(t)}catch(t){throw console.error("Error calling completeMerchantValidation:",t),t}}catch(t){console.error("=== MERCHANT VALIDATION ERROR ==="),console.error("Error during merchant validation:",t),t&&t.stack&&console.error("Error stack:",t.stack),this.currentSession.abort(),e({success:!1,error:{code:Z.MERCHANT_VALIDATION_ERROR,message:t instanceof Error?t.message:"Merchant validation failed"}})}},this.currentSession.onpaymentauthorized=async s=>{try{const o=s.payment,a=Object.assign(Object.assign({},o.token),{product_details:{name:this.currentPaymentRequest.total.label,price:r.parseAmount(this.currentPaymentRequest.total.amount),description:this.currentPaymentRequest.total.label}}),l=await this.processPayment(i,n,a);l.success?(this.currentSession.completePayment({status:c.STATUS_SUCCESS}),t({success:!0,token:o.token,paymentMethodId:l.data.id})):(console.error("PSP reported payment failure:",l.data),this.currentSession.completePayment({status:c.STATUS_FAILURE}),e({success:!1,error:{code:Z.PAYMENT_PROCESSING_ERROR,message:"Payment processing failed"}}))}catch(t){console.error("=== PAYMENT PROCESSING ERROR ==="),console.error("Error processing payment:",t),t&&t.stack&&console.error("Error stack:",t.stack),this.currentSession.completePayment({status:c.STATUS_FAILURE}),e({success:!1,error:{code:Z.PAYMENT_PROCESSING_ERROR,message:t instanceof Error?t.message:"Payment processing failed"}})}finally{this.currentSession=void 0,this.currentPaymentRequest=void 0}},this.currentSession.onpaymentmethodselected=()=>{const t={newTotal:this.currentPaymentRequest.total,newLineItems:this.currentPaymentRequest.lineItems||[]};try{this.currentSession.completePaymentMethodSelection(t)}catch(t){console.error("Error completing payment method selection:",t),this.currentSession.abort()}},this.currentSession.onshippingmethodselected=()=>{this.currentSession.completeShippingMethodSelection({status:c.STATUS_SUCCESS,newTotal:this.currentPaymentRequest.total,newLineItems:this.currentPaymentRequest.lineItems||[]})},this.currentSession.oncancel=t=>{if(t.sessionError)switch(console.error(t.sessionError),t.sessionError.code){case"unknown":console.error("Unknown error - likely merchant validation issue"),console.error("This usually means:"),console.error("1. Merchant certificate is invalid or expired"),console.error("2. Merchant identifier mismatch"),console.error("3. Backend validation endpoint issues");break;case"invalidMerchantSession":console.error("Invalid merchant session provided"),console.error("Check that the merchant session from backend is valid");break;case"userCancel":console.error("User cancelled the payment");break;default:console.error("Other error code:",t.sessionError.code)}this.currentSession=void 0,this.currentPaymentRequest=void 0,e({success:!1,error:{code:Z.USER_CANCELLED,message:"User cancelled the Apple Pay session"}})},"onerror"in this.currentSession&&(this.currentSession.onerror=t=>{console.error("=== APPLE PAY SESSION ERROR ==="),console.error("Session error:",t),this.currentSession=void 0,this.currentPaymentRequest=void 0,e({success:!1,error:{code:Z.SESSION_ERROR,message:"Apple Pay session error occurred"}})})):console.error("[ApplePayService] setupSessionEventHandlers called without required state",{hasSession:Boolean(this.currentSession),hasConfig:Boolean(this.applePayConfig),hasPaymentRequest:Boolean(this.currentPaymentRequest)})}static createPaymentRequest(t,e,i="US",n="USD"){return{countryCode:i,currencyCode:n,merchantCapabilities:r.getDefaultMerchantCapabilities(),supportedNetworks:r.getDefaultSupportedNetworks(),total:r.createLineItem(e,t)}}getApplePayConfig(){return this.applePayConfig}}const J=e=>{const{isLoading:i}=e;return i?t("div",{class:"container-fluid p-0"},t("div",{class:"row mb-3"},t("div",{class:"col-12 align-content-center"},t(A,{height:"44px",width:"100%",styles:{borderRadius:"8px"}})))):null},K=e=>t("div",{class:"apple-pay-button-container"},t("button",Object.assign({class:(()=>{let t="apple-pay-button";switch(e.buttonStyle){case h.WHITE:t+=" apple-pay-button-white";break;case h.WHITE_OUTLINE:t+=" apple-pay-button-white-outline";break;default:t+=" apple-pay-button-black"}switch(e.buttonType){case d.BUY:t+=" apple-pay-button-type-buy";break;case d.DONATE:t+=" apple-pay-button-type-donate";break;default:t+=" apple-pay-button-type-plain"}return(e.disabled||e.isProcessing||!e.isAvailable)&&(t+=" disabled"),t})(),style:{width:e.width,height:e.height},onClick:()=>{!e.disabled&&!e.isProcessing&&e.isAvailable&&e.clickHandler&&e.clickHandler()},disabled:e.disabled||e.isProcessing||!e.isAvailable,"aria-label":"Pay with Apple Pay",type:"button"},e),e.isProcessing&&t("div",{class:"processing-overlay"},t("div",{class:"spinner"}),t("span",null,"Processing..."))),t("style",null,"\n .apple-pay-button-container {\n display: block;\n position: relative;\n width: 100%;\n }\n\n /* Apple Pay CSS classes - these are the official Apple Pay button styles */\n .apple-pay-button {\n display: inline-block;\n -webkit-appearance: -apple-pay-button;\n -apple-pay-button-type: plain; /* default */\n -apple-pay-button-style: black; /* default */\n border-radius: 8px;\n cursor: pointer;\n border: none;\n outline: none;\n transition: opacity 0.2s ease;\n position: relative;\n }\n\n /* Button styles */\n .apple-pay-button.apple-pay-button-black {\n -apple-pay-button-style: black;\n }\n\n .apple-pay-button.apple-pay-button-white {\n -apple-pay-button-style: white;\n }\n\n .apple-pay-button.apple-pay-button-white-outline {\n -apple-pay-button-style: white-outline;\n }\n\n /* Button types */\n .apple-pay-button.apple-pay-button-type-plain {\n -apple-pay-button-type: plain;\n }\n\n .apple-pay-button.apple-pay-button-type-buy {\n -apple-pay-button-type: buy;\n }\n\n .apple-pay-button.apple-pay-button-type-donate {\n -apple-pay-button-type: donate;\n }\n\n /* Hover and disabled states */\n .apple-pay-button:hover:not(.disabled) {\n opacity: 0.9;\n }\n\n .apple-pay-button.disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n /* Processing overlay */\n .processing-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n background: rgba(0, 0, 0, 0.8);\n color: white;\n border-radius: 8px;\n font-size: 14px;\n font-weight: 500;\n }\n\n .spinner {\n width: 16px;\n height: 16px;\n border: 2px solid rgba(255, 255, 255, 0.3);\n border-top: 2px solid #fff;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n\n /* Responsive design */\n @media (max-width: 480px) {\n .apple-pay-button {\n width: 100% !important;\n min-width: 200px;\n }\n }\n ")),$=class{constructor(t){e(this,t),this.applePayStarted=i(this,"applePayStarted"),this.applePayCompleted=i(this,"applePayCompleted"),this.applePayCancelled=i(this,"applePayCancelled"),this.applePayError=i(this,"applePayError"),this.countryCode="US",this.merchantIdentifier="merchant.com.staging-justifi.checkout-dev",this.merchantDisplayName="JustiFi Checkout",this.initiativeContext="dev-checkout.justifi-staging.com",this.buttonType=d.PLAIN,this.buttonStyle=h.BLACK,this.disabled=!1,this.showSkeleton=!0,this.width="100%",this.height="48px",this.isLoading=!0,this.isProcessing=!1,this.isAvailable=!1,this.canMakePayments=!1,this.isConfigValid=!0,this.error=null,this.handleApplePayClick=async()=>{var t,e;if(!this.isProcessing&&!this.disabled&&this.isAvailable)try{this.isProcessing=!0,this.error=null,this.applePayStarted.emit();const i={countryCode:this.countryCode,currencyCode:p.paymentCurrency,merchantCapabilities:[u.SUPPORTS_3DS,u.SUPPORTS_CREDIT,u.SUPPORTS_DEBIT],supportedNetworks:r.getDefaultSupportedNetworks(),total:r.createLineItem(p.paymentDescription,p.paymentAmount)},n=await this.applePayService.startPaymentSession(i,p.authToken,p.accountId);n.success?this.applePayCompleted.emit({success:!0,token:n.token,paymentMethodId:n.paymentMethodId}):(this.applePayCompleted.emit({success:!1,error:n.error}),this.applePayError.emit({error:(null===(t=n.error)||void 0===t?void 0:t.message)||"Payment failed",code:(null===(e=n.error)||void 0===e?void 0:e.code)||$.ErrorCode.PAYMENT_FAILED}))}catch(t){const e=t instanceof Error?t.message:"Payment failed";this.error=e,this.applePayError.emit({error:e,code:$.ErrorCode.PAYMENT_FAILED}),this.applePayCompleted.emit({success:!1,error:e})}finally{this.isProcessing=!1}}}async initializeApplePay(){try{if(this.isLoading=!0,this.error=null,this.isConfigValid=!0,!(Boolean(p.paymentAmount)&&Boolean(p.paymentCurrency)&&Boolean(p.authToken)))return this.error="Missing required Apple Pay configuration",this.isConfigValid=!1,console.error("Apple Pay config error: missing required values",{paymentAmount:p.paymentAmount,paymentCurrency:p.paymentCurrency,hasAuthToken:Boolean(p.authToken),accountId:p.accountId}),this.applePayError.emit({error:this.error,code:$.ErrorCode.CONFIG_ERROR}),void(this.isLoading=!1);if(this.isAvailable=r.isApplePaySupported(),this.canMakePayments=r.canMakePayments(),!this.isAvailable)return this.error="Apple Pay is not supported on this device",console.error(this.error),this.applePayError.emit({error:this.error,code:$.ErrorCode.NOT_SUPPORTED}),void(this.isLoading=!1);if(!this.canMakePayments)return this.error="Apple Pay is not available",console.error(this.error),this.applePayError.emit({error:this.error,code:$.ErrorCode.NOT_AVAILABLE}),void(this.isLoading=!1);const t={merchantIdentifier:this.merchantIdentifier,displayName:this.merchantDisplayName,initiative:"web",initiativeContext:this.initiativeContext,buttonType:this.buttonType,buttonStyle:this.buttonStyle};this.applePayService=new X,this.applePayService.initialize(t),await this.applePayService.canMakePaymentsWithActiveCard()||console.warn("No Apple Pay cards available, but continuing...")}catch(t){console.error("Apple Pay initialization error:",t),this.error=t instanceof Error?t.message:"Failed to initialize Apple Pay",this.applePayError.emit({error:this.error,code:$.ErrorCode.INITIALIZATION_ERROR})}finally{this.isLoading=!1}}async isSupported(){return this.isAvailable&&this.canMakePayments}async getPaymentMethods(){return this.isAvailable?r.getDefaultSupportedNetworks():[]}async abort(){this.applePayService.abortPaymentSession(),this.isProcessing=!1,this.applePayCancelled.emit()}render(){if(!p.applePayEnabled)return null;const e=!this.isLoading&&this.isAvailable&&this.canMakePayments&&this.isConfigValid;return t(j,null,p.checkoutLoaded&&t("script",{async:!0,src:"https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js",onLoad:()=>{this.initializeApplePay()}}),t("div",{class:"apple-pay-container"},t(J,{isLoading:this.isLoading}),e&&t(K,{buttonType:this.buttonType,buttonStyle:this.buttonStyle,disabled:this.disabled,isProcessing:this.isProcessing,isAvailable:this.isAvailable,clickHandler:this.handleApplePayClick,width:this.width,height:this.height})),t("style",null,"\n .apple-pay-container {\n width: 100%;\n }\n "))}};$.ErrorCode={CONFIG_ERROR:"CONFIG_ERROR",NOT_SUPPORTED:"NOT_SUPPORTED",NOT_AVAILABLE:"NOT_AVAILABLE",INITIALIZATION_ERROR:"INITIALIZATION_ERROR",PAYMENT_FAILED:"PAYMENT_FAILED"};const tt=class{constructor(t){e(this,t)}render(){return t(j,{key:"38b0a855a7ad68b4c979d045a41efa20937cf476"},t("section",{key:"bbe4a0d26a95b0abd108370070fb861311724df8"},t("div",{key:"f322ecda85700c1e232b3f620b672f4eef103e97"},t("div",{key:"e59c6b19e0f27f7ab99380ead3f734a7e45cc1f1",part:T},null==p?void 0:p.paymentDescription),t("div",{key:"2fae7125889051d87571d9fb7c42ad3646e3ce07"},t("span",{key:"757941148dccea14941f6216f90af8721fbe6cb9",part:T},"Total")," ",t("span",{key:"ee50f026f64df4f73e0f6b087470a2154f4d0b4b",part:T},I(+(null==p?void 0:p.totalAmount)))))))}};class et{constructor(){this.api=o()}initialize(t){if(this.googlePayConfig=new y(t),!this.googlePayConfig.isValid)throw new Error("Invalid Google Pay configuration provided");if(this.googlePayClient=g.createGooglePayClient(this.googlePayConfig.environment),!this.googlePayClient)throw new Error("Failed to create Google Pay client")}async processPayment(t,e,i){try{const n=await this.api.post({endpoint:"google_pay/process_token",authToken:t,body:i,headers:{"sub-account":e}});return{success:n.id&&!!n.data.token,data:n}}catch(t){throw new Error("Google Pay payment processing failed")}}isAvailable(){return g.isGooglePaySupported()&&!!this.googlePayClient}async canMakePayments(){if(!this.googlePayClient||!this.googlePayConfig)return!1;try{const t=g.createBasePaymentDataRequest();return(await this.googlePayClient.isReadyToPay(t)).result}catch(t){return!1}}async startPaymentSession(t,e,i){var n;if(!this.googlePayConfig||!this.googlePayClient)throw new Error("Google Pay not initialized. Call initialize() first.");if(!this.isAvailable())throw new Error("Google Pay is not available on this device/browser");const s=new b(t);if(!s.isValid)throw new Error("Invalid payment data request provided");try{const t=await this.googlePayClient.loadPaymentData(s),o=null===(n=null==t?void 0:t.paymentMethodData)||void 0===n?void 0:n.tokenizationData,a=(()=>{if((null==o?void 0:o.token)&&"string"==typeof o.token)try{return JSON.parse(o.token)}catch(t){return o}return o})(),r={protocolVersion:null==a?void 0:a.protocolVersion,signature:null==a?void 0:a.signature,intermediateSigningKey:(null==a?void 0:a.intermediateSigningKey)?{signedKey:a.intermediateSigningKey.signedKey,signatures:a.intermediateSigningKey.signatures}:void 0,signedMessage:null==a?void 0:a.signedMessage},l=await this.processPayment(e,i,r);return l.success?{success:!0,paymentData:t,paymentMethodId:l.data.id}:{success:!1,error:{code:"PAYMENT_PROCESSING_ERROR",message:"Payment processing failed"}}}catch(t){if(t&&"object"==typeof t&&"statusCode"in t){const e=t;switch(e.statusCode){case"CANCELED":return{success:!1,error:{code:"USER_CANCELLED",message:"User cancelled the Google Pay session"}};case"DEVELOPER_ERROR":return{success:!1,error:{code:"DEVELOPER_ERROR",message:"Google Pay configuration error"}};default:return{success:!1,error:{code:"PAYMENT_ERROR",message:e.statusMessage||"Google Pay payment failed"}}}}return{success:!1,error:{code:"PAYMENT_ERROR",message:t instanceof Error?t.message:"Google Pay payment failed"}}}}createButton(t){if(!this.googlePayClient||!this.googlePayConfig)return null;try{return this.googlePayClient.createButton({onClick:t.onClick,buttonType:t.buttonType,buttonSizeMode:t.buttonSizeMode,buttonColor:t.buttonColor,buttonLocale:t.buttonLocale})}catch(t){return null}}prefetchPaymentData(t){if(!this.googlePayClient)return;const e=new b(t);if(e.isValid)try{this.googlePayClient.prefetchPaymentData(e)}catch(t){}}static createPaymentDataRequest(t,e,i="US",n="USD",s){return{apiVersion:2,apiVersionMinor:0,allowedPaymentMethods:[g.createPaymentMethodData()],transactionInfo:{countryCode:i,currencyCode:n,totalPriceStatus:"FINAL",totalPrice:g.formatAmount(t),totalPriceLabel:e},merchantInfo:{merchantName:s}}}getGooglePayConfig(){return this.googlePayConfig}getGooglePayClient(){return this.googlePayClient}}const it=e=>{const{isLoading:i}=e;return i?t("div",{class:"container-fluid p-0"},t("div",{class:"row mb-3"},t("div",{class:"col-12 align-content-center"},t(A,{height:"44px",width:"100%",styles:{borderRadius:"8px"}})))):null},nt=e=>t("div",{class:"google-pay-button-container"},t("button",Object.assign({class:(()=>{let t="google-pay-button";switch(t+=e.buttonStyle===f.WHITE?" google-pay-button-white":" google-pay-button-black",e.buttonType){case v.BUY:t+=" google-pay-button-type-buy";break;case v.BOOK:t+=" google-pay-button-type-book";break;case v.CHECKOUT:t+=" google-pay-button-type-checkout";break;case v.DONATE:t+=" google-pay-button-type-donate";break;case v.ORDER:t+=" google-pay-button-type-order";break;case v.PAY:t+=" google-pay-button-type-pay";break;case v.SUBSCRIBE:t+=" google-pay-button-type-subscribe";break;default:t+=" google-pay-button-type-plain"}return t+=e.buttonSizeMode===m.FILL?" google-pay-button-fill":" google-pay-button-static",(e.disabled||e.isProcessing||!e.isAvailable)&&(t+=" disabled"),t})(),style:(()=>{const t={};return e.buttonSizeMode===m.FILL?(t.width="100%",t.minWidth="200px"):t.width=e.width||"200px",t.height=e.height||"48px",t})(),onClick:()=>{!e.disabled&&!e.isProcessing&&e.isAvailable&&e.clickHandler&&e.clickHandler()},disabled:e.disabled||e.isProcessing||!e.isAvailable,"aria-label":"Google Pay",type:"button"},e),e.isProcessing&&t("div",{class:"processing-overlay"},t("div",{class:"spinner"}),t("span",null,"Processing...")),t("div",{class:"google-pay-button-content"},t("svg",{width:"41",height:"17",xmlns:"http://www.w3.org/2000/svg"},t("g",{fill:"none","fill-rule":"evenodd"},t("path",{d:"M19.526 2.635v4.083h2.518c.6 0 1.096-.202 1.488-.605.403-.402.605-.882.605-1.437 0-.544-.202-1.018-.605-1.422-.392-.413-.888-.62-1.488-.62h-2.518zm0 5.52v4.736h-1.504V1.198h3.99c1.013 0 1.873.337 2.582 1.012.72.675 1.08 1.497 1.08 2.466 0 .991-.36 1.819-1.08 2.482-.697.665-1.559.996-2.583.996h-2.485v.001zm7.668 2.287c0 .392.166.718.499.98.332.26.722.391 1.168.391.633 0 1.196-.234 1.692-.701.497-.469.744-1.019.744-1.65-.469-.37-1.123-.555-1.962-.555-.61 0-1.12.148-1.528.442-.409.294-.613.657-.613 1.093m1.946-5.815c1.112 0 1.989.297 2.633.89.642.594.964 1.408.964 2.442v4.932h-1.439v-1.11h-.065c-.622.914-1.45 1.372-2.486 1.372-.882 0-1.621-.262-2.215-.784-.594-.523-.891-1.176-.891-1.96 0-.828.313-1.486.94-1.976s1.463-.735 2.51-.735c.892 0 1.629.163 2.206.49v-.344c0-.522-.207-.966-.621-1.33a2.132 2.132 0 0 0-1.455-.547c-.84 0-1.504.353-1.995 1.062l-1.324-.834c.73-1.045 1.81-1.568 3.238-1.568m11.853.262l-5.02 11.53H34.42l1.864-4.034-3.302-7.496h1.635l2.387 5.749h.032l2.322-5.75z",fill:"#FFF"}),t("path",{d:"M13.448 7.134c0-.473-.04-.93-.116-1.366H6.988v2.588h3.634a3.11 3.11 0 0 1-1.344 2.042v1.68h2.169c1.27-1.17 2.001-2.9 2.001-4.944",fill:"#4285F4"}),t("path",{d:"M6.988 13.7c1.816 0 3.344-.595 4.459-1.621l-2.169-1.681c-.603.406-1.38.643-2.29.643-1.754 0-3.244-1.182-3.776-2.774H.978v1.731a6.728 6.728 0 0 0 6.01 3.703",fill:"#34A853"}),t("path",{d:"M3.212 8.267a4.034 4.034 0 0 1 0-2.572V3.964H.978A6.678 6.678 0 0 0 .261 6.98c0 1.085.26 2.11.717 3.017l2.234-1.731z",fill:"#FABB05"}),t("path",{d:"M6.988 2.921c.992 0 1.88.34 2.58 1.008v.001l1.92-1.918C10.324.928 8.804.262 6.989.262a6.728 6.728 0 0 0-6.01 3.702l2.234 1.731c.532-1.592 2.022-2.774 3.776-2.774",fill:"#E94235"}))))),t("style",null,"\n .google-pay-button-container {\n display: block;\n position: relative;\n }\n\n .google-pay-button {\n display: flex;\n align-items: center;\n justify-content: center;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 14px;\n font-weight: 500;\n letter-spacing: 0.25px;\n line-height: 16px;\n outline: none;\n padding: 0 20px;\n position: relative;\n min-width: 140px;\n min-height: 48px;\n }\n\n /* Button styles */\n .google-pay-button.google-pay-button-black {\n background-color: #000;\n color: #fff;\n }\n\n .google-pay-button.google-pay-button-white {\n background-color: #fff;\n color: #3c4043;\n }\n\n /* Button content */\n .google-pay-button-content {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n white-space: nowrap;\n }\n\n .google-g-logo {\n width: 20px;\n height: 20px;\n flex-shrink: 0;\n }\n\n .pay-text {\n font-family: 'Google Sans', arial, sans-serif;\n font-size: 14px;\n font-weight: 500;\n margin-left: 8px;\n }\n\n /* Button types - text content handled by ::before pseudo-element */\n .google-pay-button-type-buy .google-pay-button-content::before {\n content: 'Buy with';\n margin-right: 8px;\n }\n\n .google-pay-button-type-book .google-pay-button-content::before {\n content: 'Book with';\n margin-right: 8px;\n }\n\n .google-pay-button-type-checkout .google-pay-button-content::before {\n content: 'Checkout with';\n margin-right: 8px;\n }\n\n .google-pay-button-type-donate .google-pay-button-content::before {\n content: 'Donate with';\n margin-right: 8px;\n }\n\n .google-pay-button-type-order .google-pay-button-content::before {\n content: 'Order with';\n margin-right: 8px;\n }\n\n .google-pay-button-type-pay .google-pay-button-content::before {\n content: 'Pay with';\n margin-right: 8px;\n }\n\n .google-pay-button-type-subscribe .google-pay-button-content::before {\n content: 'Subscribe with';\n margin-right: 8px;\n }\n\n /* Size modes */\n .google-pay-button.google-pay-button-fill {\n width: 100%;\n min-width: 200px;\n }\n\n .google-pay-button.google-pay-button-static {\n width: auto;\n }\n\n /* Hover and focus states */\n .google-pay-button:hover:not(.disabled) {\n box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.15), 0 1px 3px 1px rgba(0, 0, 0, 0.30);\n }\n\n .google-pay-button:focus:not(.disabled) {\n box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.15), 0 1px 3px 1px rgba(0, 0, 0, 0.30);\n }\n\n .google-pay-button:active:not(.disabled) {\n box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.15), 0 1px 3px 1px rgba(0, 0, 0, 0.30);\n transform: translateY(1px);\n }\n\n /* Disabled state */\n .google-pay-button.disabled {\n opacity: 0.5;\n cursor: not-allowed;\n box-shadow: none;\n }\n\n .google-pay-button.disabled:hover,\n .google-pay-button.disabled:focus,\n .google-pay-button.disabled:active {\n box-shadow: none;\n transform: none;\n }\n\n /* Processing overlay */\n .processing-overlay {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n background: rgba(0, 0, 0, 0.8);\n color: white;\n border-radius: 4px;\n font-size: 14px;\n font-weight: 500;\n }\n\n .spinner {\n width: 16px;\n height: 16px;\n border: 2px solid rgba(255, 255, 255, 0.3);\n border-top: 2px solid #fff;\n border-radius: 50%;\n animation: spin 1s linear infinite;\n }\n\n @keyframes spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n\n /* Responsive design */\n @media (max-width: 480px) {\n .google-pay-button {\n width: 100% !important;\n min-width: 200px;\n }\n }\n ")),st=class{constructor(t){e(this,t),this.googlePayCancelled=i(this,"googlePayCancelled"),this.googlePayCompleted=i(this,"googlePayCompleted"),this.googlePayStarted=i(this,"googlePayStarted"),this.unsubscribes=[],this.canMakePayments=!1,this.error=null,this.isAvailable=!1,this.isLoading=!0,this.isProcessing=!1,this.buttonSizeMode=m.FILL,this.buttonStyle=f.BLACK,this.buttonType=v.PLAIN,this.countryCode="US",this.disabled=!1,this.environment=M.PRODUCTION,this.merchantId="gateway:justifi",this.merchantName="justifi",this.showSkeleton=!0,this.handleGooglePayClick=async()=>{var t;if(!this.isProcessing&&!this.disabled&&this.isAvailable&&this.canMakePayments)try{this.isProcessing=!0,this.error=null,this.googlePayStarted.emit();const e=this.createPaymentDataRequest(),i=await this.googlePayService.startPaymentSession(e,p.authToken,p.accountId);i.success?this.googlePayCompleted.emit({success:!0,paymentData:i.paymentData,paymentMethodId:i.paymentMethodId}):(this.googlePayCompleted.emit({success:!1,error:i.error}),"USER_CANCELLED"===(null===(t=i.error)||void 0===t?void 0:t.code)&&this.googlePayCancelled.emit())}catch(t){const e=t instanceof Error?t.message:"Payment failed";this.error=e,this.googlePayCompleted.emit({success:!1,error:e})}finally{this.isProcessing=!1}}}watchConfigChange(){this.initializeGooglePay()}componentWillLoad(){this.googlePayService=new et}componentDidLoad(){const t=w("paymentAmount",(()=>{this.prefetchPaymentData()}));"function"==typeof t&&this.unsubscribes.push(t);const e=w("paymentCurrency",(()=>{this.prefetchPaymentData()}));"function"==typeof e&&this.unsubscribes.push(e);const i=w("paymentDescription",(()=>{this.prefetchPaymentData()}));"function"==typeof i&&this.unsubscribes.push(i)}disconnectedCallback(){this.unsubscribes.forEach((t=>{try{t()}catch(t){}})),this.unsubscribes=[]}async getSupportedAuthMethods(){return this.isAvailable?g.getDefaultAuthMethods():[]}async getSupportedNetworks(){return this.isAvailable?g.getDefaultSupportedNetworks():[]}async handleSelectionClick(){p.selectedPaymentMethod={type:C.GOOGLE_PAY}}async isSupported(){return this.isAvailable&&this.canMakePayments}async prefetchPaymentData(){if(!this.isAvailable||!this.canMakePayments)return;const t=this.createPaymentDataRequest();this.googlePayService.prefetchPaymentData(t)}async initializeGooglePay(){try{if(this.isLoading=!0,this.error=null,!p.paymentAmount)return this.error="Missing required Google Pay configuration",void(this.isLoading=!1);if(this.googlePayService.initialize({environment:this.environment,merchantId:this.merchantId,merchantName:this.merchantName,buttonType:this.buttonType,buttonStyle:this.buttonStyle,buttonSizeMode:this.buttonSizeMode}),this.isAvailable=this.googlePayService.isAvailable(),!this.isAvailable)return this.error="Google Pay is not supported on this device",void(this.isLoading=!1);if(this.canMakePayments=await this.googlePayService.canMakePayments(),!this.canMakePayments)return this.error="Google Pay is not available for payments",void(this.isLoading=!1);const t=this.createPaymentDataRequest();this.googlePayService.prefetchPaymentData(t)}catch(t){this.error=t instanceof Error?t.message:"Failed to initialize Google Pay"}finally{this.isLoading=!1}}createPaymentDataRequest(){return et.createPaymentDataRequest(p.paymentAmount,p.paymentDescription,this.countryCode,p.paymentCurrency,this.merchantName)}render(){const e=!this.isLoading&&!!this.error,i=!this.isLoading&&!this.error&&!this.isAvailable,n=!this.isLoading&&!this.error&&this.isAvailable&&!this.canMakePayments,s=!this.isLoading&&!this.error&&this.isAvailable&&this.canMakePayments;return t(j,{key:"1f0b34c9821cc3442d470ffe63abce283f81fa89"},p.checkoutLoaded&&t("script",{key:"0d5e5f405b50629e6dc80a545a06a4dafc341e64",async:!0,src:"https://pay.google.com/gp/p/js/pay.js",onLoad:()=>{this.initializeGooglePay()}}),t("div",{key:"83a35cff20c0b1c4de521a845a6fb964c81dfcae",class:"google-pay-container"},t(it,{key:"245833ba9f530d3e9e35373cd8b22dff00451561",isLoading:this.isLoading}),e&&t("div",{key:"e47b0aeffae5b749fe1da9b8bd00e2aafe9d6616",class:"google-pay-error",role:"alert","data-testid":"gp-error"},t("span",{key:"d1dd1d928868b0917be696deecac2db51a8b2356",class:"error-icon"},"⚠️"),t("span",{key:"132c4a4fe9f635752f2c831f9fac46bf44f9414c",class:"error-message"},this.error)),i&&t("div",{key:"c376807e7b7d4eecf739ce2b7665c18cd36b7d6c",class:"google-pay-unavailable","data-testid":"gp-device-unavailable"},t("span",{key:"515f96d8a7edae2654ca900d4c6bdc31c0569dba",class:"unavailable-message"},"Google Pay is not available on this device")),n&&t("div",{key:"917571ced603e504034d155f1066b8a47ad7db5b",class:"google-pay-unavailable","data-testid":"gp-payments-unavailable"},t("span",{key:"d5a25481c52b9c781e7602014d41502a37ef41fb",class:"unavailable-message"},"Google Pay is not available for payments")),s&&t(nt,{key:"ac9f2d4cef0f9f5bab2042e327182edba310d6c8","data-testid":"gp-button",buttonType:this.buttonType,buttonStyle:this.buttonStyle,buttonSizeMode:this.buttonSizeMode,disabled:this.disabled,isProcessing:this.isProcessing,isAvailable:this.isAvailable,clickHandler:this.handleGooglePayClick})),t("style",{key:"ead06da7b7b599bd68829a95d2725339ec40f44d"},"\n .google-pay-container {\n width: 100%;\n }\n\n .google-pay-error {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px;\n background: #fef2f2;\n border: 1px solid #fecaca;\n border-radius: 8px;\n color: #dc2626;\n font-size: 14px;\n }\n\n .google-pay-unavailable {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 12px;\n background: #f9fafb;\n border: 1px solid #e5e7eb;\n border-radius: 8px;\n color: #6b7280;\n font-size: 14px;\n }\n\n .error-icon {\n font-size: 16px;\n }\n \n "))}static get watchers(){return{merchantId:["watchConfigChange"],environment:["watchConfigChange"]}}},ot=class{constructor(t){e(this,t),this.levels={h1:L,h2:O,h3:U},this.level="h1"}render(){return t(j,{key:"e448c85b2268df923662a0ff71bf4d178dcfc910"},t(this.levels[this.level],{key:"c76766a1ab006ea4b5eb7e0ad8a6b294d52283a0",text:this.text,class:this.class}))}},at=o();class rt{async getLinkToken(t,e,i,n){return at.post({endpoint:`plaid/${e}/link`,body:{checkout_id:i},authToken:t,signal:n})}async tokenizeBankAccount(t,e,i,n,s,o){const a=`plaid/${e}/tokenize`,r={public_token:i};return n&&(r.link_token_id=n),s&&(r.payment_method_group_id=s),at.post({endpoint:a,body:r,authToken:t,signal:o})}}const lt=class{constructor(t){e(this,t),this.errorEvent=i(this,"error-event"),this.submitEvent=i(this,"submit-event"),this.checkoutChangedEvent=i(this,"checkout-changed"),this.plaidService=new rt,this.handleGooglePayCompleted=t=>{const{success:e,paymentMethodId:i,error:n}=t.detail||{};e&&i?(p.paymentToken=i,p.selectedPaymentMethod={type:C.GOOGLE_PAY},this.submitCheckout()):this.errorEvent.emit({message:n&&n.message||"Google Pay payment failed",errorCode:F.TOKENIZE_ERROR,severity:Y.ERROR})},this.handleGooglePayCancelled=()=>{p.paymentToken=void 0,p.selectedPaymentMethod=void 0},this.handleApplePayCompleted=t=>{const{success:e,token:i,paymentMethodId:n,error:s}=t.detail;e&&i?(p.paymentToken=n,p.selectedPaymentMethod={type:C.APPLE_PAY},this.submitCheckout()):(console.error("Apple Pay completed but failed:",s),this.errorEvent.emit({message:(null==s?void 0:s.message)||"Apple Pay payment failed",errorCode:F.TOKENIZE_ERROR,severity:Y.ERROR}))},this.handleApplePayError=t=>{const{error:e,code:i}=t.detail;console.error("Apple Pay error:",e),this.errorEvent.emit({message:e||"Apple Pay error occurred",errorCode:`APPLE_PAY_${i}`,severity:Y.ERROR})},this.handleApplePayCancelled=()=>{p.paymentToken=void 0,p.selectedPaymentMethod=void 0}}connectedCallback(){this.observer=new MutationObserver((()=>{this.queryFormRefs(),this.setupApplePayListeners(),this.setupGooglePayListeners()})),this.observer.observe(this.hostEl,{childList:!0,subtree:!0}),p.checkoutId=this.checkoutId;const t={authToken:this.authToken,checkoutId:this.checkoutId,service:new q};this.getCheckout=(({authToken:t,checkoutId:e,service:i})=>async({onSuccess:n,onError:s})=>{var o;try{const a=await i.fetchCheckout(t,e);if(a.error)return s({error:H(a.error),code:V(null===(o=a.error)||void 0===o?void 0:o.code),severity:Y.ERROR});n({checkout:a.data})}catch(t){const e=V(null==t?void 0:t.code);return s({error:t.message||t,code:e,severity:Y.ERROR})}})(t),this.completeCheckout=(({authToken:t,checkoutId:e,service:i})=>async({payment:n,onSuccess:s,onError:o})=>{var a;try{const r=await i.complete(t,e,n);if(r.error)return o({error:H(r.error),code:V(null===(a=r.error)||void 0===a?void 0:a.code),severity:Y.ERROR});s({checkout:r.data})}catch(t){const e=V(null==t?void 0:t.code);return o({error:t.message||t,code:e,severity:Y.ERROR})}})(t),k((()=>{this.emitCheckoutChanged()}))}componentWillLoad(){this.analytics=new B(this),G(),p.authToken=this.authToken,this.fetchCheckout(),z("set",(t=>{const e=_[t];void 0!==e&&R(t,e)&&this.fetchCheckout()}))}componentDidLoad(){this.queryFormRefs(),this.setupApplePayListeners(),this.setupGooglePayListeners()}disconnectedCallback(){var t;null===(t=this.observer)||void 0===t||t.disconnect(),this.removeApplePayListeners(),this.removeGooglePayListeners()}fetchCheckout(){this.authToken&&this.checkoutId?this.getCheckout&&this.getCheckout({onSuccess:({checkout:t})=>{this.updateStore(t),t.status!==P.completed?t.status!==P.expired||this.errorEvent.emit({message:Q.CHECKOUT_EXPIRED,errorCode:F.CHECKOUT_EXPIRED,severity:Y.ERROR}):this.errorEvent.emit({message:Q.CHECKOUT_ALREADY_COMPLETED,errorCode:F.CHECKOUT_ALREADY_COMPLETED,severity:Y.ERROR})},onError:t=>{this.errorEvent.emit({message:t.message,errorCode:t.code,severity:t.severity})}}):this.errorEvent.emit({message:Q.NOT_AUTHENTICATED,errorCode:F.NOT_AUTHENTICATED,severity:Y.ERROR})}updateStore(t){var e,i,n,s,o,a,r;p.accountId=t.account_id,p.checkoutLoaded=!0,p.paymentMethods=t.payment_methods.map((t=>new D(t))),p.paymentMethodGroupId=t.payment_method_group_id,p.paymentDescription=t.payment_description,p.totalAmount=t.total_amount,p.paymentAmount=t.payment_amount,p.bnplEnabled=t.payment_settings.bnpl_payments,p.insuranceEnabled=t.payment_settings.insurance_payments,p.bankAccountVerification=null===(e=t.payment_settings)||void 0===e?void 0:e.bank_account_verification,p.applePayEnabled=null===(i=t.payment_settings)||void 0===i?void 0:i.apple_payments,p.googlePayEnabled=null===(n=t.payment_settings)||void 0===n?void 0:n.google_payments,p.bnplProviderClientId=null===(s=null==t?void 0:t.bnpl)||void 0===s?void 0:s.provider_client_id,p.bnplProviderMode=null===(o=null==t?void 0:t.bnpl)||void 0===o?void 0:o.provider_mode,p.bnplProviderApiVersion=null===(a=null==t?void 0:t.bnpl)||void 0===a?void 0:a.provider_api_version,p.bnplProviderCheckoutUrl=null===(r=null==t?void 0:t.bnpl)||void 0===r?void 0:r.provider_checkout_url}emitCheckoutChanged(){const t={availablePaymentMethodTypes:x(),selectedPaymentMethod:p.selectedPaymentMethod,savedPaymentMethods:p.paymentMethods};this.checkoutChangedEvent.emit(t)}queryFormRefs(){this.billingFormRef=this.hostEl.querySelector("justifi-billing-form, justifi-bank-account-billing-form-simple, justifi-card-billing-form-simple, justifi-billing-form-full"),this.applePayRef=this.hostEl.querySelector("justifi-apple-pay"),this.googlePayRef=this.hostEl.querySelector("justifi-google-pay"),this.paymentMethodFormRef=this.hostEl.querySelector("justifi-card-form, justifi-bank-account-form, justifi-tokenize-payment-method"),this.insuranceFormRef=this.hostEl.querySelector("justifi-season-interruption-insurance")}setupApplePayListeners(){this.applePayRef&&(this.applePayRef.addEventListener("applePayCompleted",this.handleApplePayCompleted),this.applePayRef.addEventListener("applePayError",this.handleApplePayError),this.applePayRef.addEventListener("applePayCancelled",this.handleApplePayCancelled))}removeApplePayListeners(){this.applePayRef&&(this.applePayRef.removeEventListener("applePayCompleted",this.handleApplePayCompleted),this.applePayRef.removeEventListener("applePayError",this.handleApplePayError),this.applePayRef.removeEventListener("applePayCancelled",this.handleApplePayCancelled))}setupGooglePayListeners(){this.googlePayRef&&(this.googlePayRef.addEventListener("googlePayCompleted",this.handleGooglePayCompleted),this.googlePayRef.addEventListener("googlePayCancelled",this.handleGooglePayCancelled))}removeGooglePayListeners(){this.googlePayRef&&(this.googlePayRef.removeEventListener("googlePayCompleted",this.handleGooglePayCompleted),this.googlePayRef.removeEventListener("googlePayCancelled",this.handleGooglePayCancelled))}async tokenizePaymentMethod(t){var e,i,n;const s=null!==(i=await(null===(e=this.billingFormRef)||void 0===e?void 0:e.getValues()))&&void 0!==i?i:{},o=Object.assign(Object.assign({},t),s),a=Object.assign({accountId:p.accountId,payment_method_group_id:void 0},o);p.savePaymentMethod&&(a.payment_method_group_id=p.paymentMethodGroupId);const r=await(null===(n=this.paymentMethodFormRef)||void 0===n?void 0:n.tokenize({clientId:this.authToken,paymentMethodMetadata:a,account:p.accountId}));return r.error?r:(p.paymentToken=r.id,r.id)}async setSelectedPaymentMethod(t){p.selectedPaymentMethod=t,p.paymentToken=t.id||void 0}async validate(){var t,e;const i=[];p.insuranceEnabled&&this.insuranceFormRef&&i.push(this.insuranceFormRef.validate());const n=(null===(t=p.selectedPaymentMethod)||void 0===t?void 0:t.type)===C.NEW_CARD,s=(null===(e=p.selectedPaymentMethod)||void 0===e?void 0:e.type)===C.NEW_BANK_ACCOUNT;if((n||s)&&(this.paymentMethodFormRef&&i.push(this.paymentMethodFormRef.validate()),this.billingFormRef&&i.push(this.billingFormRef.validate())),0===i.length)return!0;try{return!!(await Promise.all(i)).every((t=>"boolean"==typeof t?t:!1!==(null==t?void 0:t.isValid)))||(this.errorEvent.emit({message:"Validation error",errorCode:F.VALIDATION_ERROR,severity:Y.ERROR}),!1)}catch(t){return!1}}async submitCheckout(t){var e,i,n,s,o;const a=await this.validate();if(!p.selectedPaymentMethod)return void this.errorEvent.emit({message:"No payment method selected.",errorCode:F.VALIDATION_ERROR,severity:Y.ERROR});const r=(null===(e=p.selectedPaymentMethod)||void 0===e?void 0:e.type)===C.NEW_CARD,l=(null===(i=p.selectedPaymentMethod)||void 0===i?void 0:i.type)===C.NEW_BANK_ACCOUNT,c=(null===(n=p.selectedPaymentMethod)||void 0===n?void 0:n.type)===C.PLAID;if(r||l){const e=await this.tokenizePaymentMethod(t);if(null==e?void 0:e.error)return void this.errorEvent.emit({message:e.error.message,errorCode:F.TOKENIZE_ERROR,severity:Y.ERROR})}if(c&&!p.paymentToken){const t=p.plaidPublicToken,e=p.plaidLinkTokenId;if(!t)return void this.errorEvent.emit({message:"Missing Plaid public token. Please connect your bank.",errorCode:F.TOKENIZE_ERROR,severity:Y.ERROR});try{const i=await this.plaidService.tokenizeBankAccount(p.authToken,p.accountId,t,e||void 0,p.savePaymentMethod?p.paymentMethodGroupId:void 0);if(null==i?void 0:i.error)return void this.errorEvent.emit({message:"string"==typeof i.error?i.error:i.error.message||"Failed to tokenize bank account",errorCode:F.TOKENIZE_ERROR,severity:Y.ERROR});const n=null==i?void 0:i.data,o=(null===(s=null==n?void 0:n.bank_account)||void 0===s?void 0:s.token)||(null==n?void 0:n.token)||(null==n?void 0:n.id);p.paymentToken=o}catch(t){return void this.errorEvent.emit({message:(null==t?void 0:t.message)||"Plaid exchange error",errorCode:F.TOKENIZE_ERROR,severity:Y.ERROR})}}if(!a)return void this.errorEvent.emit({message:"Please fill in all required fields.",errorCode:F.VALIDATION_ERROR,severity:Y.ERROR});if(!p.paymentToken)return void this.errorEvent.emit({message:"Payment token not found.",errorCode:F.TOKENIZE_ERROR,severity:Y.ERROR});let h;if(h={payment_mode:(t=>{switch(t){case C.NEW_CARD:case C.SAVED_CARD:case C.NEW_BANK_ACCOUNT:case C.SAVED_BANK_ACCOUNT:case C.PLAID:return S.ECOM;case C.SEZZLE:return S.BNPL;case C.APPLE_PAY:return S.APPLE_PAY;case C.GOOGLE_PAY:return S.GOOGLE_PAY;default:return}})(null===(o=p.selectedPaymentMethod)||void 0===o?void 0:o.type),payment_token:p.paymentToken},this.preCompleteHook){const t=E();try{await new Promise(((e,i)=>{this.preCompleteHook(t,(()=>e()),(()=>i()))}))}catch(t){return}}this.completeCheckout({payment:h,onSuccess:({checkout:t})=>{this.submitEvent.emit({checkout:t,message:"Checkout completed successfully"})},onError:t=>{this.errorEvent.emit({message:t.message,errorCode:F.COMPLETE_CHECKOUT_ERROR,severity:Y.ERROR})}})}render(){return t(n,{key:"e771926ee79c47b09145bd44b47cbba3c21be3eb"})}get hostEl(){return s(this)}};var ct;!function(t){t.PLAID_SDK_LOAD_FAILED="plaid-sdk-load-failed",t.PLAID_LINK_INIT_FAILED="plaid-link-init-failed",t.PLAID_LINK_TOKEN_FAILED="plaid-link-token-failed",t.PLAID_AUTHENTICATION_FAILED="plaid-authentication-failed",t.PLAID_BANK_NOT_SUPPORTED="plaid-bank-not-supported",t.PLAID_TOKEN_EXPIRED="plaid-token-expired",t.PLAID_NETWORK_ERROR="plaid-network-error",t.PLAID_USER_CANCELLED="plaid-user-cancelled",t.PLAID_TIMEOUT="plaid-timeout",t.PLAID_INVALID_CREDENTIALS="plaid-invalid-credentials",t.PLAID_ACCOUNT_LOCKED="plaid-account-locked",t.PLAID_MAINTENANCE="plaid-maintenance",t.PLAID_RATE_LIMITED="plaid-rate-limited"}(ct||(ct={}));const ht={[ct.PLAID_SDK_LOAD_FAILED]:"Unable to load Plaid. Please refresh the page and try again.",[ct.PLAID_LINK_INIT_FAILED]:"Unable to initialize bank connection. Please try again.",[ct.PLAID_LINK_TOKEN_FAILED]:"Unable to connect to bank service. Please try again.",[ct.PLAID_AUTHENTICATION_FAILED]:"Bank authentication failed. Please try again.",[ct.PLAID_BANK_NOT_SUPPORTED]:"Your bank is not currently supported. Please try a different payment method.",[ct.PLAID_TOKEN_EXPIRED]:"Your bank session has expired. Please reconnect your account.",[ct.PLAID_NETWORK_ERROR]:"Network connection issue. Please check your internet connection and try again.",[ct.PLAID_USER_CANCELLED]:"Bank connection was cancelled. Click to try again.",[ct.PLAID_TIMEOUT]:"Bank connection timed out. Please try again.",[ct.PLAID_INVALID_CREDENTIALS]:"Invalid bank credentials. Please check your username and password.",[ct.PLAID_ACCOUNT_LOCKED]:"Your bank account is temporarily locked. Please contact your bank.",[ct.PLAID_MAINTENANCE]:"Bank service is temporarily unavailable. Please try again later.",[ct.PLAID_RATE_LIMITED]:"Too many connection attempts. Please wait a moment and try again."},dt={[ct.PLAID_SDK_LOAD_FAILED]:Y.ERROR,[ct.PLAID_LINK_INIT_FAILED]:Y.ERROR,[ct.PLAID_LINK_TOKEN_FAILED]:Y.ERROR,[ct.PLAID_AUTHENTICATION_FAILED]:Y.ERROR,[ct.PLAID_BANK_NOT_SUPPORTED]:Y.WARNING,[ct.PLAID_TOKEN_EXPIRED]:Y.WARNING,[ct.PLAID_NETWORK_ERROR]:Y.WARNING,[ct.PLAID_USER_CANCELLED]:Y.INFO,[ct.PLAID_TIMEOUT]:Y.WARNING,[ct.PLAID_INVALID_CREDENTIALS]:Y.ERROR,[ct.PLAID_ACCOUNT_LOCKED]:Y.ERROR,[ct.PLAID_MAINTENANCE]:Y.WARNING,[ct.PLAID_RATE_LIMITED]:Y.WARNING},pt=class{constructor(t){e(this,t),this.paymentMethodOptionSelected=i(this,"paymentMethodOptionSelected"),this.plaidError=i(this,"plaidError"),this.plaidErrorRecovered=i(this,"plaidErrorRecovered"),this.isAuthenticating=!1,this.publicToken=null,this.linkToken=null,this.linkTokenId=null,this.error=null,this.plaidLink=null,this.isSelected=!1,this.retryCount=0,this.isRetrying=!1,this.plaidService=new rt,this.maxRetries=3,this.retryDelay=2e3,this.timeoutId=null,this.abortController=null,this.hasLoggedDisabledWarning=!1,this.waitForStoreAndInitialize=()=>{p.authToken&&p.accountId&&p.checkoutId?this.initializePlaidLink():setTimeout((()=>{this.waitForStoreAndInitialize()}),100)},this.initializePlaidLink=async()=>{try{if(void 0===window.Plaid)return void this.handleError({code:ct.PLAID_SDK_LOAD_FAILED,message:ht[ct.PLAID_SDK_LOAD_FAILED],severity:dt[ct.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"});if(await this.getLinkToken(),!this.linkToken)return void this.handleError({code:ct.PLAID_LINK_TOKEN_FAILED,message:ht[ct.PLAID_LINK_TOKEN_FAILED],severity:dt[ct.PLAID_LINK_TOKEN_FAILED],retryable:!0,userAction:"Click to try again"});const t=window.Plaid;this.plaidLink=t.create({token:this.linkToken,onSuccess:this.handlePlaidSuccess,onExit:this.handlePlaidExit,onEvent:this.handlePlaidEvent,onLoad:this.handlePlaidLoad})}catch(t){this.handleError({code:ct.PLAID_LINK_INIT_FAILED,message:ht[ct.PLAID_LINK_INIT_FAILED],severity:dt[ct.PLAID_LINK_INIT_FAILED],originalError:t,retryable:!0,userAction:"Click to try again"})}},this.getLinkToken=async()=>{var t,e,i,n,s;try{if(!p.authToken||!p.accountId)return void this.handleError({code:ct.PLAID_LINK_TOKEN_FAILED,message:"Missing authentication. Please refresh the page and try again.",severity:Y.ERROR,retryable:!1,userAction:"Refresh the page"});this.abortController=new AbortController,this.timeoutId=setTimeout((()=>{var t;null===(t=this.abortController)||void 0===t||t.abort()}),3e4);const e=await this.plaidService.getLinkToken(p.authToken,p.accountId,p.checkoutId,this.abortController.signal);if(this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),e.error)throw new Error("string"==typeof e.error?e.error:e.error.message||"Failed to get link token");this.linkToken=e.data.link_token,this.linkTokenId=(null==e?void 0:e.id)||(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.id)||null,this.linkTokenId&&(p.plaidLinkTokenId=this.linkTokenId)}catch(t){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null);let o=ct.PLAID_LINK_TOKEN_FAILED,a=ht[o],r=!0;"AbortError"===t.name?(o=ct.PLAID_TIMEOUT,a=ht[o],r=!0):(null===(e=t.message)||void 0===e?void 0:e.includes("network"))||(null===(i=t.message)||void 0===i?void 0:i.includes("fetch"))?(o=ct.PLAID_NETWORK_ERROR,a=ht[o],r=!0):((null===(n=t.message)||void 0===n?void 0:n.includes("401"))||(null===(s=t.message)||void 0===s?void 0:s.includes("unauthorized")))&&(o=ct.PLAID_INVALID_CREDENTIALS,a="Authentication failed. Please refresh the page and try again.",r=!1),this.handleError({code:o,message:a,severity:dt[o],originalError:t,retryable:r,userAction:r?"Click to try again":"Refresh the page"})}},this.mapApiErrorToPlaidError=t=>{if("string"==typeof t){if(t.includes("rate_limit"))return ct.PLAID_RATE_LIMITED;if(t.includes("maintenance"))return ct.PLAID_MAINTENANCE;if(t.includes("not_authenticated"))return ct.PLAID_INVALID_CREDENTIALS}if(null==t?void 0:t.code)switch(t.code){case"rate_limited":return ct.PLAID_RATE_LIMITED;case"maintenance":return ct.PLAID_MAINTENANCE;case"not_authenticated":return ct.PLAID_INVALID_CREDENTIALS;default:return ct.PLAID_LINK_TOKEN_FAILED}return ct.PLAID_LINK_TOKEN_FAILED},this.openPlaidLink=()=>{this.plaidLink&&this.linkToken&&(this.isAuthenticating=!0,this.clearError(),this.plaidLink.open())},this.handlePlaidSuccess=t=>{this.publicToken=t,this.isAuthenticating=!1,this.clearError(),this.retryCount=0,this.isSelected||(this.isSelected=!0,p.selectedPaymentMethod={type:C.PLAID}),this.plaidErrorRecovered.emit({code:"plaid-success",message:"Bank account connected successfully",severity:Y.INFO}),p.plaidPublicToken=t},this.handlePlaidExit=t=>{this.isAuthenticating=!1,t&&this.handlePlaidError(t)},this.handlePlaidEvent=(t,e)=>{switch(t){case"OPEN":this.isAuthenticating=!0;break;case"CLOSE":this.isAuthenticating=!1;break;case"ERROR":this.handlePlaidError(e)}},this.handlePlaidLoad=()=>{},this.handlePlaidError=t=>{let e=ct.PLAID_AUTHENTICATION_FAILED,i=ht[e],n=!0,s="Click to try again";if(t.error_code)switch(t.error_code){case"INVALID_CREDENTIALS":e=ct.PLAID_INVALID_CREDENTIALS,i=ht[e],n=!0;break;case"ITEM_LOGIN_REQUIRED":e=ct.PLAID_INVALID_CREDENTIALS,i="Your bank requires re-authentication. Please try again.",n=!0;break;case"ITEM_LOCKED":e=ct.PLAID_ACCOUNT_LOCKED,i=ht[e],n=!1,s="Contact your bank";break;case"INSTITUTION_NOT_RESPONDING":e=ct.PLAID_MAINTENANCE,i=ht[e],n=!0;break;case"RATE_LIMIT_EXCEEDED":e=ct.PLAID_RATE_LIMITED,i=ht[e],n=!0;break;case"INVALID_REQUEST":e=ct.PLAID_AUTHENTICATION_FAILED,i="Invalid request. Please try again.",n=!0;break;case"PLAID_ERROR":e=ct.PLAID_AUTHENTICATION_FAILED,i=t.error_message||"Bank authentication failed. Please try again.",n=!0;break;default:t.error_message&&(i=t.error_message)}if(t.error_message){const o=t.error_message.toLowerCase();o.includes("not supported")||o.includes("unsupported")?(e=ct.PLAID_BANK_NOT_SUPPORTED,i=ht[e],n=!1,s="Try a different payment method"):(o.includes("expired")||o.includes("timeout"))&&(e=ct.PLAID_TOKEN_EXPIRED,i=ht[e],n=!0)}this.handleError({code:e,message:i,severity:dt[e],originalError:t,retryable:n,userAction:s}),this.isAuthenticating=!1},this.handleError=t=>{this.error=t,this.plaidError.emit({code:t.code,message:t.message,severity:t.severity,data:{originalError:t.originalError,retryable:t.retryable,userAction:t.userAction,retryCount:this.retryCount}}),console.error("Plaid error:",t),t.retryable&&this.retryCount<this.maxRetries&&this.scheduleRetry()},this.scheduleRetry=()=>{this.isRetrying||(this.isRetrying=!0,this.retryCount++,setTimeout((()=>{this.isRetrying=!1,this.clearError(),this.waitForStoreAndInitialize()}),this.retryDelay*this.retryCount))},this.clearError=()=>{this.error&&(this.error=null,this.retryCount=0)},this.syncWithStore=()=>{var t;const e=(null===(t=p.selectedPaymentMethod)||void 0===t?void 0:t.type)===C.PLAID;this.isSelected!==e&&(this.isSelected=e)}}onSelectionChange(t){var e;t&&(null===(e=p.selectedPaymentMethod)||void 0===e?void 0:e.type)!==C.PLAID&&(p.selectedPaymentMethod={type:C.PLAID}),!t||!this.plaidLink||this.publicToken||this.isAuthenticating||this.error||this.openPlaidLink()}componentDidRender(){this.scriptRef&&(this.scriptRef.onload=()=>{this.waitForStoreAndInitialize()},this.scriptRef.onerror=()=>{this.handleError({code:ct.PLAID_SDK_LOAD_FAILED,message:ht[ct.PLAID_SDK_LOAD_FAILED],severity:dt[ct.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"})})}componentWillLoad(){var t;this.isSelected=(null===(t=p.selectedPaymentMethod)||void 0===t?void 0:t.type)===C.PLAID}async resolvePaymentMethod(){return this.publicToken?{token:this.publicToken,data:{type:"bank_account",plaid_public_token:this.publicToken}}:{validationError:!0}}async getPaymentToken(){return p.paymentToken}async handleSelectionClick(){if(this.isSelected=!0,p.selectedPaymentMethod={type:C.PLAID},this.error)return this.clearError(),void this.waitForStoreAndInitialize();!this.plaidLink||this.publicToken||this.isAuthenticating||this.openPlaidLink()}async setSelected(t){this.isSelected=t,t&&(p.selectedPaymentMethod={type:C.PLAID})}async isCurrentlySelected(){return this.isSelected}async deselect(){this.isSelected=!1}async reset(){this.publicToken=null,this.clearError(),this.isAuthenticating=!1,this.linkToken=null,this.plaidLink=null,this.retryCount=0,this.isRetrying=!1,this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null),this.abortController&&(this.abortController.abort(),this.abortController=null)}async isReadyForAuthentication(){return!(!this.plaidLink||!this.linkToken||this.isAuthenticating)}async retry(){this.error&&this.error.retryable&&(this.clearError(),this.waitForStoreAndInitialize())}async getErrorInfo(){return this.error}componentDidLoad(){const t=w("selectedPaymentMethod",this.syncWithStore);this.unsubscribeFromStore=t}disconnectedCallback(){this.unsubscribeFromStore&&this.unsubscribeFromStore(),this.timeoutId&&clearTimeout(this.timeoutId),this.abortController&&this.abortController.abort()}render(){if(!0!==p.bankAccountVerification)return this.hasLoggedDisabledWarning||(console.warn("[PlaidPaymentMethod] bank_account_verification is disabled. Component will not render."),this.hasLoggedDisabledWarning=!0),null;const e=t("img",{class:"plaid-logo-img",src:"data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjQ4IiB2aWV3Qm94PSIwIDAgMjggMjkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgY2xhc3M9ImNzcy0xcmRhajhtIj48ZyBmaWxsPSIjMTExIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0yNS43NjI5IDI2LjI2MjhMMjggMTcuNTMwOUwyNC45NjkxIDE0LjUwMDFMMjcuOTk5OSAxMS40NjkxTDI1Ljc2MjggMi43MzcwNkwxNy4wMzA5IDAuNUwxNC4wMDAxIDMuNTMxTDEwLjk2OSAwLjUwMDE0TDIuMjM3MDYgMi43MzczNEwwIDExLjQ2OTFMMy4wMzEyOCAxNC40OTk5TDAuMDAwMTQgMTcuNTMxTDIuMjM3MiAyNi4yNjI5TDEwLjk2OTEgMjguNUwxNC4wMDAxIDI1LjQ2OUwxNy4wMzEgMjguNDk5OUwyNS43NjI5IDI2LjI2MjhaTTE1LjczMjEgMjMuNzM3MUwxOC42MTg2IDIwLjg1MDVMMjIuMjkxMiAyNC41MjMzTDE3LjY5NTYgMjUuNzAwN0wxNS43MzIxIDIzLjczNzFaTTExLjExMzYgOS44ODE1NEwxNC4wMDAzIDYuOTk1MDJMMTYuODg2OCA5Ljg4MTRMMTQuMDAwMSAxMi43Njc5TDExLjExMzYgOS44ODE1NFpNMTIuMjY4MiAxNC41TDkuMzgxNTQgMTcuMzg2NUw2LjQ5NTAyIDE0LjVMOS4zODE1NCAxMS42MTM1TDEyLjI2ODIgMTQuNVpNMTguNjE4NyAxMS42MTMzTDIxLjUwNTMgMTQuNUwxOC42MTg2IDE3LjM4NjVMMTUuNzMyMSAxNC41TDE4LjYxODcgMTEuNjEzM1pNMTYuODg2NyAxOS4xMTg2TDE0LjAwMDEgMjIuMDA1MUwxMS4xMTM1IDE5LjExODVMMTQuMDAwMSAxNi4yMzE5TDE2Ljg4NjcgMTkuMTE4NlpNMTAuMzA0NCAyNS43MDA3TDUuNzA4NjQgMjQuNTIzM0w5LjM4MTU0IDIwLjg1MDRMMTIuMjY4MiAyMy43MzcxTDEwLjMwNDQgMjUuNzAwN1pNNC43NjMwOCAxNi4yMzE5TDcuNjQ5NiAxOS4xMTg1TDMuOTc2NyAyMi43OTE0TDIuNzk5MyAxOC4xOTU3TDQuNzYzMDggMTYuMjMxOVpNMy45NzY3IDYuMjA4MzZMNy42NDk3NCA5Ljg4MTRMNC43NjMwOCAxMi43NjgxTDIuNzk5MyAxMC44MDQxTDMuOTc2NyA2LjIwODM2Wk0xMi4yNjgzIDUuMjYyOTRMOS4zODE2OCA4LjE0OTZMNS43MDg5MiA0LjQ3NjdMMTAuMzA0NyAzLjI5OTNMMTIuMjY4MyA1LjI2Mjk0Wk0xNy42OTU5IDMuMjk5M0wyMi4yOTE1IDQuNDc2N0wxOC42MTg2IDguMTQ5NDZMMTUuNzMyMSA1LjI2Mjk0TDE3LjY5NTkgMy4yOTkzWk0yMy4yMzcyIDEyLjc2ODFMMjAuMzUwNSA5Ljg4MTRMMjQuMDIzMyA2LjIwODc4TDI1LjIwMDcgMTAuODA0NkwyMy4yMzcyIDEyLjc2ODFaTTI0LjAyMzMgMjIuNzkxNEwyMC4zNTA1IDE5LjExODZMMjMuMjM3MiAxNi4yMzIxTDI1LjIwMDcgMTguMTk1N0wyNC4wMjMzIDIyLjc5MTRaIj48L3BhdGg+PC9nPjwvc3ZnPgo=",alt:"Plaid",title:"Plaid",style:{display:"inline",width:"20px",height:"20px",marginLeft:"5px",marginTop:"-2px"}});return t(j,{class:"payment-method"},t("script",{src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",async:!0,ref:t=>this.scriptRef=t}),t("div",{title:"Pay with Plaid"},t("div",{onClick:t=>{t.preventDefault(),this.handleSelectionClick()}},"Pay with Bank Account ",e," "),(()=>this.error?t("div",{class:(this.error.severity===Y.ERROR?"text-danger":this.error.severity===Y.WARNING?"text-warning":"text-info")+" mt-2"},t("small",null,this.error.message),t("br",null),t("small",{class:"text-muted"},this.error.userAction,this.error.retryable&&this.retryCount<this.maxRetries&&t("span",null," • Auto-retry in progress..."))):null)(),(()=>this.error?null:this.isAuthenticating?t("div",{class:"text-info mt-2"},t("small",null,"Connecting to your bank...")):this.publicToken?t("div",{class:"text-success mt-2"},t("small",null,"✓ Bank account connected successfully")):!this.isSelected||this.publicToken||this.error||this.isAuthenticating?null:t("div",{class:"text-muted mt-2"},t("small",null,"Click to connect your bank account")))()))}static get watchers(){return{isSelected:["onSelectionChange"]}}},ut=class{constructor(t){e(this,t),this.onPaymentMethodOptionClick=t=>e=>{e.preventDefault(),p.selectedPaymentMethod={id:t.id,type:t.type},p.paymentToken=t.id},this.isAllowedPaymentMethod=t=>!(t===C.SAVED_CARD&&p.disableCreditCard||t===C.SAVED_BANK_ACCOUNT&&p.disableBankAccount)}componentWillLoad(){p.paymentMethods.length||console.warn("No saved payment methods available."),p.disablePaymentMethodGroup&&console.warn("Payment method group is disabled.")}render(){return p.disablePaymentMethodGroup?null:t(j,null,t("div",{class:"saved-payment-methods"},p.paymentMethods.length?p.paymentMethods.filter((t=>this.isAllowedPaymentMethod(t.type))).map((e=>t("div",{class:"radio-list-item p-3",part:N,onClick:this.onPaymentMethodOptionClick(e)},t("form-control-radio",{name:"paymentMethodType",value:null==e?void 0:e.id,checked:p.paymentToken===(null==e?void 0:e.id),label:`${W[null==e?void 0:e.brand]||""} *${null==e?void 0:e.acct_last_four}`})))):null))}},yt=t("img",{class:"sezzle-smart-button-logo-img",src:"https://media.sezzle.com/branding/2.0/Sezzle_Logo_FullColor.svg",alt:"Sezzle",style:{display:"inline",width:"80px",marginLeft:"5px",marginTop:"-5px"}}),gt=class{constructor(t){e(this,t),this.paymentMethodOptionSelected=i(this,"paymentMethodOptionSelected"),this.paymentMethodOptionId=C.SEZZLE,this.initializeSezzleCheckout=()=>{let t;this.sezzlePromise=new Promise((e=>{t=e}));const e=Number(p.paymentAmount),i=new(0,window.Checkout)({mode:"popup",publicKey:p.bnplProviderClientId,apiMode:p.bnplProviderMode,apiVersion:p.bnplProviderApiVersion});i.sezzleButtonElement=this.sezzleButtonRef,i.init({onClick:function(t){t.preventDefault(),i.startCheckout({checkout_url:p.bnplProviderCheckoutUrl})},onComplete:e=>t({bnpl:e.data}),onCancel:e=>t({bnpl:e.data}),onFailure:e=>t({bnpl:e.data})}),this.sezzleCheckout=i,this.installmentPlan=this.sezzleCheckout.getInstallmentPlan(e)}}componentDidRender(){this.scriptRef&&(this.scriptRef.onload=()=>{this.sezzleButtonRef=document.createElement("button"),this.initializeSezzleCheckout()})}async resolvePaymentMethod(t){return t.isValid?(this.sezzleButtonRef.click(),this.sezzlePromise):{validationError:!0}}async handleSelectionClick(){p.selectedPaymentMethod={type:C.SEZZLE},this.paymentMethodOptionSelected.emit(this.paymentMethodOptionId)}render(){var e,i;return p.bnplEnabled?t(j,{class:"payment-method"},t("script",{src:"https://checkout-sdk.sezzle.com/checkout.min.js",async:!0,ref:t=>this.scriptRef=t}),t("div",null,t("div",null,"Buy now, pay later with ",yt),this.installmentPlan&&t("small",null,t("span",null,null===(e=this.installmentPlan)||void 0===e?void 0:e.installments.length)," ",t("span",null,this.installmentPlan.schedule," payments of")," ",t("span",{class:"fw-bold"},I(null===(i=this.installmentPlan)||void 0===i?void 0:i.installments[0].amountInCents))))):(console.warn("justifi-sezzle-payment-method: BNPL is not enabled for this account."),null)}};export{$ as justifi_apple_pay,tt as justifi_checkout_summary,st as justifi_google_pay,ot as justifi_header,lt as justifi_modular_checkout,pt as justifi_plaid_payment_method,ut as justifi_saved_payment_methods,gt as justifi_sezzle_payment_method}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e={name:"@justifi/webcomponents",version:"6.7.0"};export{e as p}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as s,c as t,h as r}from"./p-DwYM91AU.js";import{P as i}from"./p-DGGjRqDa.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{C as o,a as e}from"./p-Cjcsf8ku.js";import{P as p}from"./p-BrRsgB8S.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{g as a,a as n}from"./p-D2muobcE.js";import{c as m,J as h}from"./p-DISrhs4v.js";import{S as c}from"./p-BP2sTIQV.js";import"./p-CZfYo5-1.js";import{d}from"./p-RTAZ4tdd.js";import"./p-yyedWKWX.js";import"./p-B09GVew-.js";import"./p-BYsgavgS.js";import"./p-DkoufM1t.js";import"./p-CsRppqXL.js";import"./p-W9WWoLzT.js";import"./p-U3nU15el.js";import"./p-sA8HBfkI.js";const f=class{constructor(r){s(this,r),this.errorEvent=t(this,"error-event"),this.errorMessage=null,this.columns=d,this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)}}componentWillLoad(){m(),this.analytics=new h(this),this.initializeGetPayments()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}propChanged(){this.initializeGetPayments()}initializeGetPayments(){this.accountId&&this.authToken?this.getPayments=(({id:s,authToken:t,service:r})=>async({params:i,onSuccess:e,onError:m,final:h})=>{var c,d;try{const h=await r.fetchPayments(s,t,i);if(h.error)return m({error:n(h.error),code:a(null===(d=h.error)||void 0===d?void 0:d.code),severity:o.ERROR});{const s=Object.assign({},h.page_info);e({payments:(null===(c=h.data)||void 0===c?void 0:c.map((s=>new p(s))))||[],pagingInfo:s})}}catch(s){const t=a(null==s?void 0:s.code);return m({error:s.message||s,code:t,severity:o.ERROR})}finally{return h()}})({id:this.accountId,authToken:this.authToken,service:new i}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:e.MISSING_PROPS,message:this.errorMessage,severity:o.ERROR}))}render(){return r(c,{key:"171935cc29253ff76262498183fd0f3a0f4a7eef"},r("payments-list-core",{key:"71be865f5035b6db46f4b97a3a36f08391de4f58",getPayments:this.getPayments,"onError-event":this.handleErrorEvent,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{f as justifi_payments_list}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as t,r as s,c as e}from"./p-DwYM91AU.js";import{c as r,a as i,F as o}from"./p-DiJD6Iqx.js";import{f as n}from"./p-B09GVew-.js";import"./p-tGDdRx0W.js";import{C as a,a as u}from"./p-Cjcsf8ku.js";import{R as l,l as h}from"./p-BrRsgB8S.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{B as m}from"./p-Ty7R7tsw.js";import{S as p}from"./p-BP2sTIQV.js";import"./p-CZfYo5-1.js";import{P as c}from"./p-DGGjRqDa.js";import{m as d}from"./p-DATDsXcA.js";import{c as f,J as v}from"./p-DISrhs4v.js";import{g as j,a as y}from"./p-D2muobcE.js";import{A as b}from"./p-yyedWKWX.js";import{S as w}from"./p-CsgUIrv8.js";import"./p-BFTU3MAI.js";import"./p-HXpYMWUU.js";import"./p-BYsgavgS.js";import"./p-DkoufM1t.js";import"./p-sA8HBfkI.js";import"./p-CsRppqXL.js";const g=t=>{const s=+t;return i().required("Amount is required").test("max-amount",`Refund amount cannot be more than payment amount: ${n(s)}`,(function(t){return+t<=+s})).test("min-amount","Refund amount must be greater than 0",(function(t){return+t>0}))},R=t=>{if(t)return r({amount:g(t),description:i().optional(),reason:i().optional().oneOf([l.customerRequest,l.duplicate,l.fraudulent],"Select a reason")})},A=[{label:"Select a reason",value:""},{label:"Customer requested a refund",value:"customer_request"},{label:"Customer was double-charged",value:"duplicate"},{label:"Payment was reported as fraud",value:"fraudulent"}],x=b();class B{async postRefund(t,s,e,r){return x.post({endpoint:`payments/${t}/refunds`,headers:{"Sub-Account":s},body:r,authToken:e})}}const D=()=>t("div",{class:"row gap-3"},t("div",{class:"col-12"},t(w,{width:"100%",height:"40px"}))),I=()=>t(p,null,t("div",{class:"row gap-5"},t(D,null),t(D,null),t(D,null))),T=class{constructor(t){s(this,t),this.errorEvent=e(this,"error-event"),this.submitEvent=e(this,"submit-event"),this.refundPayload={},this.displayAmount="",this.errors={},this.paymentLoading=!0,this.refundLoading=!1,this.hideSubmitButton=!1,this.inputHandler=(t,s)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[t]:s}))}}componentWillLoad(){f(),this.analytics=new v(this),this.initializeApi(),this.formController=new o(R())}handleError(t,s,e){this.errorEvent.emit({errorCode:t,message:s,severity:e})}checkAmount(t){return t>0}handleInvalidAmount(){this.submitDisabled=!0,this.handleError(u.INVALID_REFUND_AMOUNT,"Refund amount must be greater than 0",a.ERROR)}initializeFormController(){const t=this.refundPayload.amount,s=t?t.toString():"0";this.formController=new o(R(s)),this.formController.setInitialValues({amount:s}),this.formController.values.subscribe((t=>{this.refundPayload=Object.assign({},t)})),this.formController.errors.subscribe((t=>{this.errors=Object.assign({},t)}))}initializeApi(){this.paymentId&&this.authToken?d({id:this.paymentId,authToken:this.authToken,service:new c})({onSuccess:({payment:t})=>{this.refundPayload=new h({amount:t.amount_refundable})},onError:({error:t,code:s,severity:e})=>{this.handleError(s,t,e)},final:()=>{this.checkAmount(this.refundPayload.amount)?this.initializeFormController():this.handleInvalidAmount(),this.paymentLoading=!1}}):this.handleError(u.MISSING_PROPS,"Payment ID and Auth Token are required",a.ERROR)}async refundPayment(t){if(t&&t.preventDefault(),!await this.formController.validate())return;const s=(({authToken:t,accountId:s,paymentId:e,service:r})=>async({refundBody:i,onSuccess:o,onError:n,final:u})=>{var l;try{const u=await r.postRefund(e,s,t,i);if(u.error)return n({error:y(u.error),code:j(null===(l=u.error)||void 0===l?void 0:l.code),severity:a.ERROR});o(u)}catch(t){const s=j(null==t?void 0:t.code);return n({error:t.message||t,code:s,severity:a.ERROR})}finally{return u()}})({authToken:this.authToken,accountId:this.accountId,paymentId:this.paymentId,service:new B}),e=this.formController.values.getValue();return this.refundLoading=!0,new Promise((t=>{let r;s({refundBody:e,onSuccess:t=>{r=t},onError:({error:t,code:s,severity:e})=>{r=t,this.handleError(t,s,e)},final:()=>{this.submitEvent.emit({response:r}),this.submitDisabled=!0,this.refundLoading=!1,t(r.data)}})}))}render(){if(this.paymentLoading)return t(I,null);const s=this.formController.getInitialValues(),e=this.refundPayload.amount;return t(p,null,t("form",null,t("fieldset",null,t("div",{class:"row gy-3"},t("div",{class:"col-12"},t("form-control-monetary",{name:"amount",label:"Refund Amount",defaultValue:s.amount,inputHandler:this.inputHandler,errorText:this.errors.amount})),t("div",{class:"col-12"},t("form-control-select",{name:"reason",label:"Reason for refund (optional)",defaultValue:s.reason,inputHandler:this.inputHandler,options:A,errorText:this.errors.reason})),t("div",{class:"col-12"},t("form-control-textarea",{name:"description",label:"Note (optional)",defaultValue:s.description,inputHandler:this.inputHandler,maxLength:250,errorText:this.errors.description})),t("div",{class:"form-group d-flex flex-row-reverse"},t(m,{variant:"primary",type:"submit",onClick:this.refundPayment.bind(this),isLoading:this.paymentLoading||this.refundLoading,hidden:this.hideSubmitButton,disabled:this.submitDisabled},`Refund ${n(+e)}`))))))}};export{T as justifi_refund_payment}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as s,r as i,c as t}from"./p-DwYM91AU.js";import{ao as e,am as r,ai as o,G as l}from"./p-sA8HBfkI.js";import{S as d}from"./p-BP2sTIQV.js";import"./p-CZfYo5-1.js";import{c as a,J as n}from"./p-DISrhs4v.js";import{C as h,a as c}from"./p-Cjcsf8ku.js";import{B as v}from"./p-Dlrq1iZf.js";import{B as u}from"./p-B5rtFhtR.js";import{m as p}from"./p-sCHf--Vc.js";import{S as m}from"./p-CsgUIrv8.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{k as f,j as w,b as g}from"./p-BrRsgB8S.js";import"./p-CLHwhyvu.js";import"./p-BH0Xfn-F.js";import{g as b,a as x}from"./p-D2muobcE.js";import{T as y}from"./p-CCxsFwC4.js";import{k as j}from"./p-B09GVew-.js";import"./p-CsRppqXL.js";import"./p-yyedWKWX.js";import"./p-BYsgavgS.js";import"./p-DkoufM1t.js";const k=()=>s("div",{class:"row gap-3"},s("div",{class:"col-12"},s(m,{width:"25%"})),s("div",{class:"col-12"},s(m,{width:"100%"})),s("div",{class:"col-12 d-flex gap-3"},s(m,{width:"50%"}),s(m,{width:"50%"})),s("div",{class:"col-12 d-flex gap-3"},s(m,{width:"65%"}),s(m,{width:"35%"}))),S=()=>s("div",{class:"row gap-5"},s("div",{class:"col-12"},s(m,{width:"40%",height:"40px"})),s(k,null)),C=()=>s("div",{class:"terminal-selector-skeleton mt-4 rounded shadow-sm"},s("div",{class:"d-flex align-items-center gap-3"},s(m,{width:"125px",height:"125px",styles:{borderRadius:"8px"}}),s("div",{class:"flex-grow-1"},s("div",{class:"d-flex row flex-row"},s("div",{class:"col-6 flex-column"},s(m,null),s(m,{width:"60%"})),s("div",{class:"d-flex justify-content-end align-items-center gap-2 col-6"},s(m,{width:"32px",height:"32px",styles:{borderRadius:"50%"}}),s(m,{width:"80px",height:"32px"}),s(m,{width:"32px",height:"32px",styles:{borderRadius:"50%"}}))),s("div",{class:"mt-4"},s("div",{class:"d-flex flex-column gap-2"},s(m,null),s(m,null)))))),B=class{constructor(s){i(this,s),this.errorEvent=t(this,"error-event"),this.submitted=t(this,"submit-event"),this.shipping=!1,this.submitButtonText="Submit Order",this.loading={business:!0,terminals:!0},this.submitting=!1,this.error=null,this.totalQuantity=0}componentWillLoad(){this.order=new w({business_id:this.businessId,sub_account_id:this.accountId,order_type:this.shipping?g.boardingShipping:g.boardingOnly}),a(),this.analytics=new n(this),this.loadData()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}handleError(s,i,t){this.error={message:s,code:i,severity:t},this.errorEvent.emit({errorCode:i,message:s,severity:t})}loadData(){this.businessId&&this.authToken?(this.initializeGetBusiness(),this.initializeGetTerminalModels()):this.handleError("Invalid business id or auth token",c.MISSING_PROPS,h.ERROR)}initializeGetBusiness(){p({id:this.businessId,authToken:this.authToken,service:new v})({onSuccess:({business:s})=>{this.business=new u(s),this.loading.business=!1},onError:({error:s,code:i,severity:t})=>{this.handleError(s,i,t),this.loading.business=!1}})}initializeGetTerminalModels(){(({id:s,authToken:i,service:t})=>async({onSuccess:e,onError:r})=>{var o,l,d,a;try{const n=await t.fetchTerminalModels(s,i);if(n.error)return r({error:x(n.error),code:b(null===(a=n.error)||void 0===a?void 0:a.code),severity:h.ERROR});e({terminals:(null===(l=null===(o=n.data)||void 0===o?void 0:o.terminal_order_models)||void 0===l?void 0:l.map((s=>new f(s))))||[],orderLimit:null===(d=n.data)||void 0===d?void 0:d.order_limit})}catch(s){const i=b(null==s?void 0:s.code);return r({error:s.message||s,code:i,severity:h.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new y})({onSuccess:({terminals:s,orderLimit:i})=>{this.terminalModels=s,this.orderLimit=i,this.loading.terminals=!1},onError:({error:s,code:i,severity:t})=>{this.handleError(s,i,t),this.loading.terminals=!1}})}submitOrder(){const s=(({authToken:s,service:i,apiOrigin:t="https://wc-proxy.justifi.ai"})=>async({terminalOrder:e,onSuccess:r,onError:o})=>{var l;try{const d=await i.orderTerminals(s,e,t);if(d.error)return o({error:x(d.error),code:b(null===(l=d.error)||void 0===l?void 0:l.code),severity:h.ERROR});{const{data:s}=d;r({data:s})}}catch(s){const i=b(null==s?void 0:s.code);return o({error:s.message||s,code:i,severity:h.ERROR})}})({authToken:this.authToken,service:new y});this.submitting=!0,s({terminalOrder:this.order.payload,onSuccess:({data:s})=>{this.submitted.emit(s),this.submitting=!1},onError:({error:s,code:i,severity:t})=>{this.handleError(s,i,t),this.submitting=!1}})}onSelectedQuantityChange(s){this.order.updateTerminal(s.detail.modelName,s.detail.quantity),this.totalQuantity=this.order.totalQuantity}renderLoading(){return s("div",null,this.loading.business&&s(S,null),this.loading.terminals&&s("div",{class:"mt-5"},s(C,null),s(C,null),s(C,null)))}renderBusinessDetails(){var i,t,o,l,d,a,n,h;if(!this.loading.business&&this.business)return s("div",{class:"d-flex flex-column gap-4 mb-5 pt-5"},s("div",{class:"row"},s("div",{class:"col-12"},s("h2",{part:r},this.business.legal_name))),s("div",{class:"row"},s("div",{class:"col-6"},s("h5",{part:e},"Representative:"),s("div",null,s("div",null,null===(t=null===(i=this.business)||void 0===i?void 0:i.representative)||void 0===t?void 0:t.name),s("div",null,null===(l=null===(o=this.business)||void 0===o?void 0:o.representative)||void 0===l?void 0:l.title),s("div",null,null===(a=null===(d=this.business)||void 0===d?void 0:d.representative)||void 0===a?void 0:a.email),s("div",null,j(null===(h=null===(n=this.business)||void 0===n?void 0:n.representative)||void 0===h?void 0:h.phone)))),s("div",{class:"col-6"},s("h5",{part:e},this.shipping?"Shipping Address:":"Business Address:"),s("div",null,this.business.legal_address.line1,this.business.legal_address.line2?`, ${this.business.legal_address.line2}`:"",s("br",null),this.business.legal_address.city,", ",this.business.legal_address.state," ",this.business.legal_address.postal_code))))}renderTerminals(){if(!this.loading.terminals&&this.terminalModels)return s("div",{class:"d-flex flex-column gap-2 mt-5"},this.terminalModels.map((i=>s("terminal-quantity-selector",{modelName:i.model_name,description:i.description,imageUrl:i.image_url,helpUrl:i.help_url,limit:this.orderLimit-this.order.totalQuantity,onSelectedQuantityChange:this.onSelectedQuantityChange.bind(this)}))))}renderOrderSection(){return s("div",{class:"mt-3"},s("div",{class:"text-end"},"Order limit: ",this.orderLimit),s("div",{class:"d-flex justify-content-end mt-3"},s("button",{class:"btn btn-primary submit-btn",onClick:this.submitOrder.bind(this),disabled:0===this.order.totalQuantity||this.submitting,part:o},this.submitting?"Submitting...":this.submitButtonText)))}render(){return s(d,{key:"aa60b46b6f455a6e925a835f1b558c88966b2a90"},s("div",{key:"33361446b5b2848a0d7d4af36ff54a3be76a5779",part:l},this.renderLoading(),this.renderBusinessDetails(),this.renderTerminals(),this.renderOrderSection()))}};export{B as justifi_order_terminals}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as s,h as i}from"./p-DwYM91AU.js";import"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{C as o,a as r}from"./p-Cjcsf8ku.js";import{C as e}from"./p-BrRsgB8S.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{g as a,a as p}from"./p-D2muobcE.js";import{c,J as n}from"./p-DISrhs4v.js";import{C as h}from"./p-VRubcA-q.js";import{m,S as u}from"./p-C9VmfRis.js";import{S as d}from"./p-BP2sTIQV.js";import"./p-CZfYo5-1.js";import{d as f}from"./p-CBbwdoSa.js";import"./p-BYsgavgS.js";import"./p-B09GVew-.js";import"./p-DkoufM1t.js";import"./p-CsRppqXL.js";import"./p-yyedWKWX.js";import"./p-U3nU15el.js";import"./p-sA8HBfkI.js";const j=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event"),this.errorMessage=null,this.columns=f,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){c(),this.analytics=new n(this),this.initializeGetData()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetData()}initializeGetData(){this.initializeGetCheckouts(),this.initializeGetSubAccounts()}initializeGetCheckouts(){this.accountId&&this.authToken?this.getCheckouts=(({accountId:t,authToken:s,service:i})=>async({params:r,onSuccess:c,onError:n})=>{var h,m;try{const u=await i.fetchCheckouts(t,s,r);if(u.error)return n({error:p(u.error),code:a(null===(m=u.error)||void 0===m?void 0:m.code),severity:o.ERROR});{const t=Object.assign({},u.page_info);c({checkouts:(null===(h=u.data)||void 0===h?void 0:h.map((t=>new e(t))))||[],pagingInfo:t})}}catch(t){const s=a(null==t?void 0:t.code);return n({error:t.message||t,code:s,severity:o.ERROR})}})({accountId:this.accountId,authToken:this.authToken,service:new h}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:r.MISSING_PROPS,message:this.errorMessage,severity:o.ERROR}))}initializeGetSubAccounts(){this.accountId&&this.authToken&&(this.getSubAccounts=m({accountId:this.accountId,authToken:this.authToken,service:new u}))}render(){return i(d,{key:"0e9e50e18983dad43cfab19f2271678d3f5e6abd"},i("checkouts-list-core",{key:"6f128cc756477ff64638625d9a9ff9a5b4533948",getCheckouts:this.getCheckouts,getSubAccounts:this.getSubAccounts,"onError-event":this.handleErrorEvent,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{j as justifi_checkouts_list}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as e,h as i,g as s,H as a}from"./p-DwYM91AU.js";import{S as r}from"./p-BP2sTIQV.js";import"./p-CZfYo5-1.js";import{c as n,J as d}from"./p-DISrhs4v.js";import{w as o,c}from"./p-tGDdRx0W.js";import"./p-HXpYMWUU.js";import{a as h,C as l}from"./p-Cjcsf8ku.js";import{c as u}from"./p-BrRsgB8S.js";import"./p-CLHwhyvu.js";import"./p-B5rtFhtR.js";import"./p-BH0Xfn-F.js";import{P as f}from"./p-DkoufM1t.js";import{S as m}from"./p-CsgUIrv8.js";import{B as b}from"./p-Ty7R7tsw.js";import{v as p}from"./p-sA8HBfkI.js";import"./p-CsRppqXL.js";import"./p-yyedWKWX.js";import"./p-B09GVew-.js";import"./p-BYsgavgS.js";const y=class{constructor(i){t(this,i),this.radioClick=e(this,"radio-click"),this.checked=!1,this.hidden=!1,this.handleClick=()=>{this.radioClick.emit(this.value)}}render(){return i(r,{key:"1ae40f787970160e38b72f917bda96f480d2a890"},i("div",{key:"2130596c8294cc38365e6126806735da0f93ef4a",class:`radio-list-item p-3 ${this.class||""}`,part:p,onClick:this.handleClick,hidden:this.hidden},i("form-control-radio",{key:"7d5524f518430f2bfd1c9863f354318929353cfb",name:this.name,value:this.value,checked:this.checked,label:this.label,inputHandler:()=>null})))}},v={[f.NEW_BANK_ACCOUNT]:"New bank account",[f.NEW_CARD]:"New credit or debit card"},g="Payment form not ready",k="Validation error",w=class{constructor(i){t(this,i),this.errorEvent=e(this,"error-event"),this.submitEvent=e(this,"submit-event"),this.computedHideSubmitButton=!1,this.isLoading=!1,this.submitButtonText="Submit"}paymentMethodsChanged(){this.setDefaultSelectedPaymentMethod()}connectedCallback(){this.setDefaultSelectedPaymentMethod(),this.setComputedHideSubmitButton()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup(),this.unsubscribeFromStore&&this.unsubscribeFromStore()}componentWillLoad(){n(),this.analytics=new d(this)}handleRadioClick(t){this.selectedPaymentMethod=t.detail,u.selectedPaymentMethod={type:t.detail}}async fillBillingForm(t){var e;null===(e=this.billingFormRef)||void 0===e||e.fill(t)}async tokenizePaymentMethod(t){null==t||t.preventDefault(),this.validateRequiredProps(),this.isLoading=!0;try{if(!(await this.validate()).isValid)return this.errorEvent.emit({errorCode:h.TOKENIZE_ERROR,message:k}),void(this.isLoading=!1);const t=await this.resolvePaymentMethod({isValid:!0});return t.error&&this.emitError({errorCode:t.error.code,message:t.error.message}),this.submitEvent.emit({response:t}),t}catch(t){const e=this.createErrorResponse(h.TOKENIZE_ERROR,t.message);return this.emitError({errorCode:h.TOKENIZE_ERROR,message:t.message}),this.submitEvent.emit({response:e}),e}finally{this.isLoading=!1}}async validate(){if(!this.areFormsReady())return{isValid:!1,errors:{general:g}};const[t,e]=await Promise.all([this.billingFormRef.validate(),this.paymentMethodFormRef.validate()]);return{isValid:t.isValid&&e.isValid,errors:Object.assign(Object.assign({},t.errors),e.errors)}}async tokenize(){try{const t=await this.billingFormRef.getValues(),e={clientId:this.authToken||u.authToken,account:this.accountId||u.accountId,paymentMethodMetadata:this.buildPaymentMethodMetadata(t)};return await this.paymentMethodFormRef.tokenize(e)}catch(t){return t}}validateRequiredProps(){this.authToken||u.authToken||this.emitError({errorCode:h.TOKENIZE_ERROR,message:"Auth token is required when using the tokenize-payment-method component not slotted in justifi-modular-checkout"}),this.accountId||u.accountId||this.emitError({errorCode:h.TOKENIZE_ERROR,message:"Account ID is required when using the tokenize-payment-method component not slotted in justifi-modular-checkout"})}setDefaultSelectedPaymentMethod(){this.selectedPaymentMethod||(this.disableCreditCard?this.disableBankAccount||(this.selectedPaymentMethod=f.NEW_BANK_ACCOUNT,u.selectedPaymentMethod={type:f.NEW_BANK_ACCOUNT}):(this.selectedPaymentMethod=f.NEW_CARD,u.selectedPaymentMethod={type:f.NEW_CARD}))}setComputedHideSubmitButton(){if(void 0!==this.hideSubmitButton)return void(this.computedHideSubmitButton=this.hideSubmitButton);const t=this.isSlottedWithinModularCheckout();this.computedHideSubmitButton=t}isSlottedWithinModularCheckout(){var t;let e=null===(t=this.host)||void 0===t?void 0:t.parentElement;for(;e;){if("JUSTIFI-MODULAR-CHECKOUT"===e.tagName)return!0;e=e.parentElement}return!1}get availablePaymentMethods(){const t=[];return this.disableCreditCard||t.push(f.NEW_CARD),this.disableBankAccount||t.push(f.NEW_BANK_ACCOUNT),t}areFormsReady(){return!(!this.billingFormRef||!this.paymentMethodFormRef)}emitError(t){this.errorEvent.emit(Object.assign(Object.assign({},t),{severity:l.ERROR}))}createErrorResponse(t,e){return{error:{code:t,message:e,decline_code:void 0}}}async resolvePaymentMethod(t){if(!this.areFormsReady())return this.createErrorResponse("form_not_ready",g);try{const e=await this.validate();if(!e.isValid||!t.isValid){const t=Object.values(e.errors)[0]||k;return{validationError:!0,error:{code:"validation_error",message:String(t),decline_code:void 0}}}return await this.performTokenization()}catch(t){return{error:t}}}async performTokenization(){var t,e;const i=await this.tokenize();if(i.error)return{error:i.error};const s=i.data;return{token:(null===(t=s.card)||void 0===t?void 0:t.token)||(null===(e=s.bank_account)||void 0===e?void 0:e.token),data:s}}buildPaymentMethodMetadata(t){return this.shouldSavePaymentMethod?Object.assign(Object.assign({},t),{payment_method_group_id:this.paymentMethodGroupID}):Object.assign({},t)}get paymentMethodGroupID(){return this.paymentMethodGroupId||u.paymentMethodGroupId}get shouldSavePaymentMethod(){return!(!this.paymentMethodGroupId&&!u.savePaymentMethod)}get shouldHideRadioInput(){return this.disableCreditCard||this.disableBankAccount}renderPaymentMethodOption(t){const e=this.selectedPaymentMethod===t&&void 0===u.selectedPaymentMethod.id;return i("div",{class:"payment-method"},i("justifi-radio-list-item",{name:"paymentMethodType",value:t,checked:e,label:v[t],hidden:this.shouldHideRadioInput}),e&&this.renderSelectedPaymentMethodForm(t))}renderSelectedPaymentMethodForm(t){return i("div",{class:"mt-4 pb-4"},this.renderPaymentMethodForm(t),i("div",{class:"mt-4"},i("justifi-billing-form",{ref:t=>this.billingFormRef=t,hideCardBillingForm:this.hideCardBillingForm,hideBankAccountBillingForm:this.hideBankAccountBillingForm,paymentMethodType:t})),i("div",{class:"mt-4"},i("justifi-save-new-payment-method",{hidden:!this.paymentMethodGroupID,label:this.savePaymentMethodLabel})))}renderPaymentMethodForm(t){return i(t===f.NEW_CARD?"justifi-card-form":"justifi-bank-account-form",{ref:t=>this.paymentMethodFormRef=t})}render(){return i(r,{key:"8017b0fe2b0e3045a097e30aadf6a54ed2c32e62"},i("form",{key:"c7b0ac690a66cfb693d28e7d0eabc93817de4659"},i("fieldset",{key:"fb29e26a4100985595c420024d2a5ff48c79043b"},i("div",{key:"589f51297059afda2e385281dcfeafd67fbd2268",class:"row gy-3"},i("div",{key:"bf067015fb3ff24e08501899e370f92dda774c2e",class:"col-12"},this.availablePaymentMethods.map((t=>this.renderPaymentMethodOption(t)))),i("div",{key:"28872ca9239e2f85cb83ad8e6f27dc10f84da151",class:"col-12"},i("justifi-button",{key:"1be3f46e34b42e69d065384dd195d7fdc09a0560",text:this.submitButtonText,variant:"primary",type:"submit",clickHandler:t=>this.tokenizePaymentMethod(t),isLoading:this.isLoading,"data-testid":"submit-button",hidden:this.computedHideSubmitButton}))))))}get host(){return s(this)}static get watchers(){return{disableCreditCard:["paymentMethodsChanged"],disableBankAccount:["paymentMethodsChanged"]}}},j=t=>{const{isReady:e}=t;return e?null:i("div",{class:"container-fluid p-0"},i("div",{class:"row mb-3"},i("div",{class:"col-12 align-content-end"},i(m,{height:"18px",width:"120px"}),i(m,{height:"36px"}))),i("div",{class:"row"},i("div",{class:"col-12 align-content-end"},i(m,{height:"18px",width:"110px"}),i(m,{height:"36px"}))))},C=class{constructor(e){t(this,e),this.isReady=!1}async componentWillLoad(){await o(),this.iframeOrigin=c.iframeOrigin,n(),this.analytics=new d(this)}componentDidRender(){Promise.all([this.accountNumberIframeElement,this.routingNumberIframeElement].map((t=>new Promise((e=>{t.addEventListener("iframeLoaded",(()=>{e()}))}))))).then((()=>{this.isReady=!0}))}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}async validate(){const t=await this.accountNumberIframeElement.validate(),e=await this.routingNumberIframeElement.validate();return t&&e}async tokenize({clientId:t,paymentMethodMetadata:e,account:i}){return this.accountNumberIframeElement.tokenize(t,e,i)}render(){return i(r,{key:"0daa12da1ca699a05ca499425c4a37e4d913b2dd"},i(j,{key:"9d4ee0af94759d71d52130781401d322fcb5e397",isReady:this.isReady}),i("hidden-input",{key:"dc4ee0054cbc7acb214a1c410f8fd387677f92dc"}),i("div",{key:"b489311f205e0ffdaa4680621b706322bd3fc4ca",class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},i("div",{key:"2d1b00b9705d1a94364f691d4ad705c339abbbce",class:"row mb-3"},i("iframe-input",{key:"21a66eb7d87b77c1ff1a1171a4cb84a4759853dd",inputId:"accountNumber",ref:t=>this.accountNumberIframeElement=t,label:"Account Number",iframeOrigin:`${this.iframeOrigin}/v2/accountNumber`})),i("div",{key:"1ff36d49f7304e203cdefea46010100ed750ed68",class:"row"},i("iframe-input",{key:"2211a638c875e504e7e25e0704788d7a437b5806",inputId:"routingNumber",ref:t=>this.routingNumberIframeElement=t,label:"Routing Number",iframeOrigin:`${this.iframeOrigin}/v2/routingNumber`}))))}},M=class{constructor(e){t(this,e)}get showSimpleCardBillingForm(){return this.paymentMethodType===f.NEW_CARD&&this.hideCardBillingForm}get showSimpleBankAccountBillingForm(){return this.paymentMethodType===f.NEW_BANK_ACCOUNT&&this.hideBankAccountBillingForm}async getValues(){var t;return null===(t=this.selectedFormRef)||void 0===t?void 0:t.getValues()}async fill(t){var e;null===(e=this.selectedFormRef)||void 0===e||e.fill(t)}async validate(){var t;return null===(t=this.selectedFormRef)||void 0===t?void 0:t.validate()}render(){return i(a,null,i(this.showSimpleBankAccountBillingForm?"justifi-bank-account-billing-form-simple":this.showSimpleCardBillingForm?"justifi-card-billing-form-simple":"justifi-billing-form-full",{legend:this.legend,ref:t=>this.selectedFormRef=t}))}},x=class{constructor(e){t(this,e),this.variant="primary",this.type="button"}render(){return i(r,{key:"7c8b76c4eaa412f2dc2ba59fd56cb7c28f46656c"},i(b,{key:"9440f90ebb380703b35b6c5d811e5d0780e80fd2",variant:this.variant,isLoading:this.isLoading,clickHandler:this.clickHandler,class:this.class,type:this.type,disabled:this.disabled,style:this.customStyle},this.text))}},_=t=>{const{isReady:e}=t;return e?null:i("div",{class:"container-fluid p-0"},i("div",{class:"mb-3"},i(m,{height:"18px",width:"100px"}),i(m,{height:"36px"})),i("div",{class:"row"},i("div",{class:"col-4 align-content-end"},i(m,{height:"18px",width:"80px"}),i(m,{height:"36px"})),i("div",{class:"col-4 align-content-end"},i(m,{height:"36px"})),i("div",{class:"col-4 align-content-end"},i(m,{height:"18px",width:"30px"}),i(m,{height:"36px"}))))},P=class{constructor(e){t(this,e),this.isReady=!1}async componentWillLoad(){await o(),this.iframeOrigin=c.iframeOrigin,n(),this.analytics=new d(this)}componentDidRender(){Promise.all([this.cardNumberIframeElement,this.expirationMonthIframeElement,this.expirationYearIframeElement,this.cvvIframeElement].map((t=>new Promise((e=>{t.addEventListener("iframeLoaded",(()=>{e()}))}))))).then((()=>{this.isReady=!0}))}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}async validate(){const t=await this.cardNumberIframeElement.validate(),e=await this.expirationMonthIframeElement.validate(),i=await this.expirationYearIframeElement.validate(),s=await this.cvvIframeElement.validate();return t&&e&&i&&s}async tokenize({clientId:t,paymentMethodMetadata:e,account:i}){return this.cardNumberIframeElement.tokenize(t,e,i)}render(){return i(r,{key:"b0b07a928be767102b59ec93ab0df6296b8418af"},i(_,{key:"03d37e42253a905ece1e6a9b1d654e84665470d6",isReady:this.isReady}),i("hidden-input",{key:"62f657a6c0a4d5b7a7bbf809abeb42eba0d22345"}),i("div",{key:"874cac5eac376c8c4e12d99f760cd3cd487a6521",class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},i("div",{key:"dcada2d72eebe506fe4cab8ad6eb959c551e9e2d",class:"mb-3"},i("iframe-input",{key:"7e784726f8dd0c8b35832646bc99e0d2131c08f9",inputId:"cardNumber",ref:t=>this.cardNumberIframeElement=t,label:"Card Number",iframeOrigin:`${this.iframeOrigin}/v2/cardNumber`})),i("div",{key:"2384099f3aa18b7d6bbc346f47ba9ff06e5b7e86",class:"row"},i("div",{key:"5fb523cd3f398894e5c7ee3e8a58d34581492410",class:"col-4 align-content-end"},i("iframe-input",{key:"a3b4aa06a5c85162d24e25a5261a9a2cc64a6b82",inputId:"expirationMonth",ref:t=>this.expirationMonthIframeElement=t,label:"Expiration",iframeOrigin:`${this.iframeOrigin}/v2/expirationMonth`})),i("div",{key:"3ccd6a19fce1c393a8c58534113239c518d51a4f",class:"col-4 align-content-end"},i("iframe-input",{key:"6d064b868c73b4431b476194602843b0f28729e0",inputId:"expirationYear",ref:t=>this.expirationYearIframeElement=t,label:"",iframeOrigin:`${this.iframeOrigin}/v2/expirationYear`})),i("div",{key:"26cd762bec43890e96ab5c6903943b0f4cfa9672",class:"col-4 align-content-end"},i("iframe-input",{key:"826dfe08347461bc5a94296b181826b70a7d1f6f",inputId:"CVV",ref:t=>this.cvvIframeElement=t,label:"CVV",iframeOrigin:`${this.iframeOrigin}/v2/CVV`})))))}},B=class{constructor(i){t(this,i),this.checkboxChanged=e(this,"checkboxChanged"),this.label="Save New Payment Method",this.isChecked=!1,this.handleCheckboxChange=(t,e)=>{this.isChecked=e,u.savePaymentMethod=e,this.checkboxChanged.emit(this.isChecked)}}render(){return i(r,{key:"7cc086e518b2defcea924398cd5957b44a893d94"},i("form-control-checkbox",{key:"523dd82fe06f0c0a6d259a84f320c0a335261232",label:this.label||"Save New Payment Method",name:"saveNewPaymentMethod",checked:this.isChecked,inputHandler:this.handleCheckboxChange}))}};export{w as internal_tokenize_payment_method,C as justifi_bank_account_form,M as justifi_billing_form,x as justifi_button,P as justifi_card_form,y as justifi_radio_list_item,B as justifi_save_new_payment_method}
|