@justifi/webcomponents 6.0.0-rc.16 → 6.0.0-rc.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/cjs/{check-pkg-version-DfzaKEDg.js → check-pkg-version-BIRpFWjW.js} +1 -1
  2. package/dist/cjs/hidden-input_2.cjs.entry.js +1 -1
  3. package/dist/cjs/justifi-apple-pay.cjs.entry.js +341 -35
  4. package/dist/cjs/justifi-bank-account-billing-form-simple_9.cjs.entry.js +2 -2
  5. package/dist/cjs/justifi-business-details.cjs.entry.js +2 -2
  6. package/dist/cjs/justifi-business-form.cjs.entry.js +2 -2
  7. package/dist/cjs/justifi-checkout-summary_7.cjs.entry.js +3 -4
  8. package/dist/cjs/justifi-checkout.cjs.entry.js +2 -2
  9. package/dist/cjs/justifi-checkouts-list.cjs.entry.js +2 -2
  10. package/dist/cjs/justifi-dispute-management.cjs.entry.js +2 -2
  11. package/dist/cjs/justifi-dispute-notification_3.cjs.entry.js +2 -2
  12. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +2 -2
  13. package/dist/cjs/justifi-order-terminals.cjs.entry.js +2 -2
  14. package/dist/cjs/justifi-payment-details.cjs.entry.js +2 -2
  15. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +2 -2
  16. package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +2 -2
  17. package/dist/cjs/justifi-payments-list.cjs.entry.js +2 -2
  18. package/dist/cjs/justifi-payout-details.cjs.entry.js +2 -2
  19. package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +2 -2
  20. package/dist/cjs/justifi-payouts-list.cjs.entry.js +2 -2
  21. package/dist/cjs/justifi-refund-payment.cjs.entry.js +2 -2
  22. package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +2 -2
  23. package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +2 -2
  24. package/dist/cjs/justifi-terminals-list.cjs.entry.js +2 -2
  25. package/dist/cjs/{package-CHNXn8wx.js → package-BVAhjheJ.js} +1 -1
  26. package/dist/collection/components/modular-checkout/modular-checkout.js +1 -2
  27. package/dist/collection/components/modular-checkout/sub-components/apple-pay.js +8 -35
  28. package/dist/docs.json +1 -1
  29. package/dist/esm/{check-pkg-version-Cz8T6Ux8.js → check-pkg-version-DHG-pLKx.js} +1 -1
  30. package/dist/esm/hidden-input_2.entry.js +1 -1
  31. package/dist/esm/justifi-apple-pay.entry.js +341 -35
  32. package/dist/esm/justifi-bank-account-billing-form-simple_9.entry.js +2 -2
  33. package/dist/esm/justifi-business-details.entry.js +2 -2
  34. package/dist/esm/justifi-business-form.entry.js +2 -2
  35. package/dist/esm/justifi-checkout-summary_7.entry.js +3 -4
  36. package/dist/esm/justifi-checkout.entry.js +2 -2
  37. package/dist/esm/justifi-checkouts-list.entry.js +2 -2
  38. package/dist/esm/justifi-dispute-management.entry.js +2 -2
  39. package/dist/esm/justifi-dispute-notification_3.entry.js +2 -2
  40. package/dist/esm/justifi-gross-payment-chart.entry.js +2 -2
  41. package/dist/esm/justifi-order-terminals.entry.js +2 -2
  42. package/dist/esm/justifi-payment-details.entry.js +2 -2
  43. package/dist/esm/justifi-payment-provisioning.entry.js +2 -2
  44. package/dist/esm/justifi-payment-transactions-list.entry.js +2 -2
  45. package/dist/esm/justifi-payments-list.entry.js +2 -2
  46. package/dist/esm/justifi-payout-details.entry.js +2 -2
  47. package/dist/esm/justifi-payout-transactions-list.entry.js +2 -2
  48. package/dist/esm/justifi-payouts-list.entry.js +2 -2
  49. package/dist/esm/justifi-refund-payment.entry.js +2 -2
  50. package/dist/esm/justifi-season-interruption-insurance.entry.js +2 -2
  51. package/dist/esm/justifi-terminal-orders-list.entry.js +2 -2
  52. package/dist/esm/justifi-terminals-list.entry.js +2 -2
  53. package/dist/esm/{package-BiTF1__F.js → package-D34B0fIu.js} +1 -1
  54. package/dist/module/justifi-apple-pay.js +338 -32
  55. package/dist/module/modular-checkout.js +1 -2
  56. package/dist/module/package.js +1 -1
  57. package/dist/webcomponents/{p-c3cfcd4b.entry.js → p-00ce804c.entry.js} +1 -1
  58. package/dist/webcomponents/{p-2b47ddd8.entry.js → p-1a00ae1a.entry.js} +1 -1
  59. package/dist/webcomponents/p-387951b7.entry.js +1 -0
  60. package/dist/webcomponents/{p-3d94c845.entry.js → p-39caca63.entry.js} +1 -1
  61. package/dist/webcomponents/{p-3a34e4f9.entry.js → p-43929b3f.entry.js} +1 -1
  62. package/dist/webcomponents/{p-0913a57b.entry.js → p-52453823.entry.js} +1 -1
  63. package/dist/webcomponents/{p-a65d751d.entry.js → p-5d604178.entry.js} +1 -1
  64. package/dist/webcomponents/{p-995c2cbf.entry.js → p-5fbcf154.entry.js} +1 -1
  65. package/dist/webcomponents/{p-07c3c25e.entry.js → p-611a013a.entry.js} +1 -1
  66. package/dist/webcomponents/p-66b1a1be.entry.js +1 -0
  67. package/dist/webcomponents/p-857ed314.entry.js +1 -0
  68. package/dist/webcomponents/{p-225da0b5.entry.js → p-8e3be834.entry.js} +1 -1
  69. package/dist/webcomponents/{p-eabaeaf6.entry.js → p-9080a91c.entry.js} +1 -1
  70. package/dist/webcomponents/{p-ce272d8a.entry.js → p-91110a56.entry.js} +1 -1
  71. package/dist/webcomponents/{p-f6e3f1ca.entry.js → p-91753cd0.entry.js} +1 -1
  72. package/dist/webcomponents/{p-a53710c4.entry.js → p-95279d6b.entry.js} +1 -1
  73. package/dist/webcomponents/p-D34B0fIu.js +1 -0
  74. package/dist/webcomponents/{p-BcAsEqa5.js → p-DWOdLN23.js} +1 -1
  75. package/dist/webcomponents/p-ad6df3f2.entry.js +1 -0
  76. package/dist/webcomponents/p-b37c187c.entry.js +1 -0
  77. package/dist/webcomponents/{p-e7921c1f.entry.js → p-b4cb8091.entry.js} +1 -1
  78. package/dist/webcomponents/{p-3caee9d2.entry.js → p-ccc932f5.entry.js} +1 -1
  79. package/dist/webcomponents/{p-0bba0dd0.entry.js → p-cef742c4.entry.js} +1 -1
  80. package/dist/webcomponents/{p-b9ab3803.entry.js → p-dd481752.entry.js} +1 -1
  81. package/dist/webcomponents/p-eab855aa.entry.js +1 -0
  82. package/dist/webcomponents/webcomponents.esm.js +1 -1
  83. package/package.json +1 -1
  84. package/dist/webcomponents/p-099e96ba.entry.js +0 -1
  85. package/dist/webcomponents/p-4abf0877.entry.js +0 -1
  86. package/dist/webcomponents/p-5a3fc339.entry.js +0 -1
  87. package/dist/webcomponents/p-69bf5e32.entry.js +0 -1
  88. package/dist/webcomponents/p-73dd0306.entry.js +0 -1
  89. package/dist/webcomponents/p-BiTF1__F.js +0 -1
  90. package/dist/webcomponents/p-a7712cea.entry.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-Bn7inNWG.js';
2
- import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-Cz8T6Ux8.js';
2
+ import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-DHG-pLKx.js';
3
3
  import { C as ComponentErrorSeverity, a as ComponentErrorCodes } from './ComponentError-Cjcsf8ku.js';
4
4
  import { m as makeGetBusiness, a as makePostProvisioning } from './payment-provisioning-actions-ONP8lDnV.js';
5
5
  import { B as BusinessService } from './business.service-cQrH5BqF.js';
@@ -8,7 +8,7 @@ import './Refund-CVh70dXA.js';
8
8
  import './Pagination-CLHwhyvu.js';
9
9
  import './Business-BCoP0TAV.js';
10
10
  import './Dispute-BH0Xfn-F.js';
11
- import './package-BiTF1__F.js';
11
+ import './package-D34B0fIu.js';
12
12
  import './utils-BeQLScSm.js';
13
13
  import './config-state-DZeVYerv.js';
14
14
  import './index-B_KxSZIF.js';
@@ -6,7 +6,7 @@ import { g as PaymentBalanceTransaction } from './Refund-CVh70dXA.js';
6
6
  import { p as pagingDefaults } from './Pagination-CLHwhyvu.js';
7
7
  import './Business-BCoP0TAV.js';
8
8
  import './Dispute-BH0Xfn-F.js';
9
- import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-Cz8T6Ux8.js';
9
+ import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-DHG-pLKx.js';
10
10
  import { g as getErrorCode, a as getErrorMessage } from './utils-BeQLScSm.js';
11
11
  import { P as PaymentService } from './payment.service-TxyxCg0E.js';
12
12
  import { T as Table, l as TableWrapper, a as TableComponent, b as TableHead, c as TableHeadRow, d as TableBody, e as TableLoadingState, f as TableEmptyState, g as TableErrorState, h as TableRow, i as TableFoot, j as TableFootRow, k as TableFootCell } from './table-Br3n9Xu-.js';
@@ -17,7 +17,7 @@ import { N as tableHeadCell, O as getAlternateTableCellPart } from './parts-RvUQ
17
17
  import './index-B_KxSZIF.js';
18
18
  import './helpers-Mu7LQT-w.js';
19
19
  import './state-options-BX8GieXu.js';
20
- import './package-BiTF1__F.js';
20
+ import './package-D34B0fIu.js';
21
21
  import './Api-DAWuvzbl.js';
22
22
  import './spinner-DUzyWLhj.js';
23
23
 
@@ -8,7 +8,7 @@ import './Pagination-CLHwhyvu.js';
8
8
  import './Business-BCoP0TAV.js';
9
9
  import './Dispute-BH0Xfn-F.js';
10
10
  import { g as getErrorCode, a as getErrorMessage } from './utils-BeQLScSm.js';
11
- import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-Cz8T6Ux8.js';
11
+ import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-DHG-pLKx.js';
12
12
  import { S as StyledHost } from './styled-host-CTAGIN84.js';
13
13
  import './event-types-CZfYo5-1.js';
14
14
  import { d as defaultColumnsKeys } from './payments-table-gkJV5GNK.js';
@@ -17,7 +17,7 @@ import './utils-BscIVFn8.js';
17
17
  import './index-B_KxSZIF.js';
18
18
  import './helpers-Mu7LQT-w.js';
19
19
  import './state-options-BX8GieXu.js';
20
- import './package-BiTF1__F.js';
20
+ import './package-D34B0fIu.js';
21
21
  import './payments-status-5orNU2Rd.js';
22
22
  import './badge-DSYSJcRy.js';
23
23
  import './parts-RvUQ__Pq.js';
@@ -9,7 +9,7 @@ import './Business-BCoP0TAV.js';
9
9
  import './Dispute-BH0Xfn-F.js';
10
10
  import { g as getErrorCode, a as getErrorMessage } from './utils-BeQLScSm.js';
11
11
  import { E as ErrorState } from './utils-Dg6gMUTv.js';
12
- import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-Cz8T6Ux8.js';
12
+ import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-DHG-pLKx.js';
13
13
  import { m as makeGetPayoutCSV } from './get-payout-csv-D-Lnooki.js';
14
14
  import './Api-DAWuvzbl.js';
15
15
  import './utils-BscIVFn8.js';
@@ -17,7 +17,7 @@ import './index-B_KxSZIF.js';
17
17
  import './helpers-Mu7LQT-w.js';
18
18
  import './state-options-BX8GieXu.js';
19
19
  import './parts-RvUQ__Pq.js';
20
- import './package-BiTF1__F.js';
20
+ import './package-D34B0fIu.js';
21
21
 
22
22
  const makeGetPayoutDetails = ({ id, authToken, service }) => async ({ onSuccess, onError }) => {
23
23
  var _a;
@@ -6,7 +6,7 @@ import { h as PayoutBalanceTransaction } from './Refund-CVh70dXA.js';
6
6
  import { p as pagingDefaults } from './Pagination-CLHwhyvu.js';
7
7
  import './Business-BCoP0TAV.js';
8
8
  import './Dispute-BH0Xfn-F.js';
9
- import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-Cz8T6Ux8.js';
9
+ import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-DHG-pLKx.js';
10
10
  import { g as getErrorCode, a as getErrorMessage } from './utils-BeQLScSm.js';
11
11
  import { P as PayoutService } from './payout.service-BOwZ4wWh.js';
12
12
  import { T as Table, l as TableWrapper, a as TableComponent, b as TableHead, c as TableHeadRow, d as TableBody, e as TableLoadingState, f as TableEmptyState, g as TableErrorState, h as TableRow, i as TableFoot, j as TableFootRow, k as TableFootCell } from './table-Br3n9Xu-.js';
@@ -17,7 +17,7 @@ import { N as tableHeadCell, O as getAlternateTableCellPart } from './parts-RvUQ
17
17
  import './index-B_KxSZIF.js';
18
18
  import './helpers-Mu7LQT-w.js';
19
19
  import './state-options-BX8GieXu.js';
20
- import './package-BiTF1__F.js';
20
+ import './package-D34B0fIu.js';
21
21
  import './Api-DAWuvzbl.js';
22
22
  import './spinner-DUzyWLhj.js';
23
23
 
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-Bn7inNWG.js';
2
2
  import { C as ComponentErrorSeverity, a as ComponentErrorCodes } from './ComponentError-Cjcsf8ku.js';
3
- import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-Cz8T6Ux8.js';
3
+ import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-DHG-pLKx.js';
4
4
  import { P as PayoutService } from './payout.service-BOwZ4wWh.js';
5
5
  import './config-state-DZeVYerv.js';
6
6
  import './dinero-HXpYMWUU.js';
@@ -14,7 +14,7 @@ import { m as makeGetSubAccounts, S as SubAccountService } from './get-subaccoun
14
14
  import { S as StyledHost } from './styled-host-CTAGIN84.js';
15
15
  import './event-types-CZfYo5-1.js';
16
16
  import { d as defaultColumnsKeys } from './payouts-table-0PtktGRd.js';
17
- import './package-BiTF1__F.js';
17
+ import './package-D34B0fIu.js';
18
18
  import './Api-DAWuvzbl.js';
19
19
  import './utils-BscIVFn8.js';
20
20
  import './index-B_KxSZIF.js';
@@ -12,7 +12,7 @@ import { S as StyledHost } from './styled-host-CTAGIN84.js';
12
12
  import './event-types-CZfYo5-1.js';
13
13
  import { P as PaymentService } from './payment.service-TxyxCg0E.js';
14
14
  import { m as makeGetPaymentDetails } from './get-payment-details-0VzpMNY9.js';
15
- import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-Cz8T6Ux8.js';
15
+ import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-DHG-pLKx.js';
16
16
  import { g as getErrorCode, a as getErrorMessage } from './utils-BeQLScSm.js';
17
17
  import { A as Api } from './Api-DAWuvzbl.js';
18
18
  import { S as Skeleton } from './skeleton-qMb0_Cjy.js';
@@ -22,7 +22,7 @@ import './index-B_KxSZIF.js';
22
22
  import './helpers-Mu7LQT-w.js';
23
23
  import './state-options-BX8GieXu.js';
24
24
  import './parts-RvUQ__Pq.js';
25
- import './package-BiTF1__F.js';
25
+ import './package-D34B0fIu.js';
26
26
 
27
27
  const amountValidation = (maxAmount) => {
28
28
  const max = +maxAmount;
@@ -6,7 +6,7 @@ import './Pagination-CLHwhyvu.js';
6
6
  import './Business-BCoP0TAV.js';
7
7
  import './Dispute-BH0Xfn-F.js';
8
8
  import { g as getErrorCode, a as getErrorMessage } from './utils-BeQLScSm.js';
9
- import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-Cz8T6Ux8.js';
9
+ import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-DHG-pLKx.js';
10
10
  import { c as checkoutStore } from './checkout.store-OD-OX5On.js';
11
11
  import { p as processHTML, f as formatCurrency, r as removeAttribute, i as addAttribute } from './utils-BscIVFn8.js';
12
12
  import { v as validateInsuranceValues, i as insuranceValues, a as insuranceErrors, H as Header2 } from './insurance-state-CTalqbNa.js';
@@ -18,7 +18,7 @@ import './config-state-DZeVYerv.js';
18
18
  import './index-B_KxSZIF.js';
19
19
  import './helpers-Mu7LQT-w.js';
20
20
  import './state-options-BX8GieXu.js';
21
- import './package-BiTF1__F.js';
21
+ import './package-D34B0fIu.js';
22
22
  import './dinero-HXpYMWUU.js';
23
23
  import './index-CbL73B6U.js';
24
24
 
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-Bn7inNWG.js';
2
2
  import { S as StyledHost } from './styled-host-CTAGIN84.js';
3
3
  import './event-types-CZfYo5-1.js';
4
- import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-Cz8T6Ux8.js';
4
+ import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-DHG-pLKx.js';
5
5
  import { d as defaultColumnsKeys } from './terminal-orders-table-DTBSIMlJ.js';
6
6
  import './config-state-DZeVYerv.js';
7
7
  import './dinero-HXpYMWUU.js';
@@ -12,7 +12,7 @@ import './Business-BCoP0TAV.js';
12
12
  import './Dispute-BH0Xfn-F.js';
13
13
  import { g as getErrorCode, a as getErrorMessage } from './utils-BeQLScSm.js';
14
14
  import { A as Api } from './Api-DAWuvzbl.js';
15
- import './package-BiTF1__F.js';
15
+ import './package-D34B0fIu.js';
16
16
  import './parts-RvUQ__Pq.js';
17
17
  import './utils-BscIVFn8.js';
18
18
  import './badge-DSYSJcRy.js';
@@ -1,6 +1,6 @@
1
1
  import { r as registerInstance, c as createEvent, h } from './index-Bn7inNWG.js';
2
2
  import { C as ComponentErrorSeverity, a as ComponentErrorCodes } from './ComponentError-Cjcsf8ku.js';
3
- import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-Cz8T6Ux8.js';
3
+ import { c as checkPkgVersion, J as JustifiAnalytics } from './check-pkg-version-DHG-pLKx.js';
4
4
  import { T as TerminalService } from './terminal.service-E6dZlM43.js';
5
5
  import './config-state-DZeVYerv.js';
6
6
  import './dinero-HXpYMWUU.js';
@@ -13,7 +13,7 @@ import { m as makeGetSubAccounts, S as SubAccountService } from './get-subaccoun
13
13
  import { S as StyledHost } from './styled-host-CTAGIN84.js';
14
14
  import './event-types-CZfYo5-1.js';
15
15
  import { d as defaultColumnsKeys } from './terminals-table-TGUKTi7I.js';
16
- import './package-BiTF1__F.js';
16
+ import './package-D34B0fIu.js';
17
17
  import './Api-DAWuvzbl.js';
18
18
  import './utils-BscIVFn8.js';
19
19
  import './index-B_KxSZIF.js';
@@ -1,5 +1,5 @@
1
1
  const name = "@justifi/webcomponents";
2
- const version = "6.0.0-rc.16";
2
+ const version = "6.0.0-rc.18";
3
3
  var packageJson = {
4
4
  name: name,
5
5
  version: version};
@@ -1,4 +1,5 @@
1
1
  import { h, proxyCustomElement, HTMLElement, createEvent } from '@stencil/core/internal/client';
2
+ import { A as Api } from './Api.js';
2
3
  import { S as StyledHost } from './styled-host.js';
3
4
  import './details.js';
4
5
  import './event-types.js';
@@ -34,6 +35,45 @@ var ApplePayMerchantCapability;
34
35
  ApplePayMerchantCapability["SUPPORTS_CREDIT"] = "supportsCredit";
35
36
  ApplePayMerchantCapability["SUPPORTS_DEBIT"] = "supportsDebit";
36
37
  })(ApplePayMerchantCapability || (ApplePayMerchantCapability = {}));
38
+ class ApplePayConfig {
39
+ constructor(data) {
40
+ this.merchantIdentifier = data.merchantIdentifier;
41
+ this.displayName = data.displayName;
42
+ this.initiative = data.initiative;
43
+ this.initiativeContext = data.initiativeContext;
44
+ this.buttonType = data.buttonType || ApplePayButtonType.PLAIN;
45
+ this.buttonStyle = data.buttonStyle || ApplePayButtonStyle.BLACK;
46
+ this.buttonLocale = data.buttonLocale || 'en-US';
47
+ }
48
+ get isValid() {
49
+ return !!(this.merchantIdentifier &&
50
+ this.displayName &&
51
+ this.initiative &&
52
+ this.initiativeContext);
53
+ }
54
+ }
55
+ class ApplePayPaymentRequest {
56
+ constructor(data) {
57
+ this.countryCode = data.countryCode;
58
+ this.currencyCode = data.currencyCode;
59
+ this.merchantCapabilities = data.merchantCapabilities;
60
+ this.supportedNetworks = data.supportedNetworks;
61
+ this.total = data.total;
62
+ this.lineItems = data.lineItems;
63
+ this.shippingMethods = data.shippingMethods;
64
+ this.applicationData = data.applicationData;
65
+ this.supportedCountries = data.supportedCountries;
66
+ }
67
+ get isValid() {
68
+ var _a, _b, _c, _d;
69
+ return !!(this.countryCode &&
70
+ this.currencyCode &&
71
+ ((_a = this.merchantCapabilities) === null || _a === void 0 ? void 0 : _a.length) &&
72
+ ((_b = this.supportedNetworks) === null || _b === void 0 ? void 0 : _b.length) &&
73
+ ((_c = this.total) === null || _c === void 0 ? void 0 : _c.label) &&
74
+ ((_d = this.total) === null || _d === void 0 ? void 0 : _d.amount));
75
+ }
76
+ }
37
77
  class ApplePayHelpers {
38
78
  static isApplePaySupported() {
39
79
  var _a;
@@ -87,6 +127,298 @@ class ApplePayHelpers {
87
127
  }
88
128
  }
89
129
 
130
+ class ApplePayService {
131
+ constructor() {
132
+ this.api = Api();
133
+ }
134
+ /**
135
+ * Initialize Apple Pay configuration
136
+ */
137
+ initialize(applePayConfig) {
138
+ this.applePayConfig = new ApplePayConfig(applePayConfig);
139
+ if (!this.applePayConfig.isValid) {
140
+ throw new Error('Invalid Apple Pay configuration provided');
141
+ }
142
+ }
143
+ /**
144
+ * Validate merchant with Apple Pay servers via API
145
+ */
146
+ async validateMerchant(authToken, accountId) {
147
+ const endpoint = 'apple_pay/merchant_session';
148
+ try {
149
+ const response = await this.api.post({
150
+ endpoint,
151
+ authToken,
152
+ headers: {
153
+ 'Sub-Account': accountId,
154
+ },
155
+ });
156
+ return response;
157
+ }
158
+ catch (error) {
159
+ console.error('Backend validation failed:', error);
160
+ throw new Error('Merchant validation failed');
161
+ }
162
+ }
163
+ /**
164
+ * Process Apple Pay payment via API (fixed to match original logic)
165
+ */
166
+ async processPayment(authToken, accountId, payload) {
167
+ const endpoint = 'apple_pay/process_token';
168
+ const result = await this.api.post({
169
+ endpoint,
170
+ authToken,
171
+ body: payload,
172
+ headers: {
173
+ 'Sub-Account': accountId,
174
+ },
175
+ });
176
+ return {
177
+ success: result.id && !!result.data.token,
178
+ data: result,
179
+ };
180
+ }
181
+ /**
182
+ * Check if Apple Pay is available on this device/browser
183
+ */
184
+ isAvailable() {
185
+ return (ApplePayHelpers.isApplePaySupported() && ApplePayHelpers.canMakePayments());
186
+ }
187
+ /**
188
+ * Check if the user has an active card for the merchant
189
+ */
190
+ async canMakePaymentsWithActiveCard() {
191
+ if (!this.applePayConfig) {
192
+ throw new Error('Apple Pay not initialized. Call initialize() first.');
193
+ }
194
+ return await ApplePayHelpers.canMakePaymentsWithActiveCard(this.applePayConfig.merchantIdentifier);
195
+ }
196
+ /**
197
+ * Start Apple Pay session
198
+ */
199
+ async startPaymentSession(paymentRequest, authToken, accountId) {
200
+ if (!this.applePayConfig) {
201
+ throw new Error('Apple Pay not initialized. Call initialize() first.');
202
+ }
203
+ // if (!this.isAvailable()) {
204
+ // throw new Error('Apple Pay is not available on this device/browser');
205
+ // }
206
+ const request = new ApplePayPaymentRequest(paymentRequest);
207
+ if (!request.isValid) {
208
+ throw new Error('Invalid payment request provided');
209
+ }
210
+ this.currentPaymentRequest = request;
211
+ return new Promise((resolve, reject) => {
212
+ try {
213
+ this.currentSession = new window.ApplePaySession(3, request);
214
+ this.setupSessionEventHandlers(resolve, reject, authToken, accountId);
215
+ this.currentSession.begin();
216
+ }
217
+ catch (error) {
218
+ reject({
219
+ success: false,
220
+ error: {
221
+ code: 'SESSION_ERROR',
222
+ message: error instanceof Error
223
+ ? error.message
224
+ : 'Failed to start Apple Pay session',
225
+ },
226
+ });
227
+ }
228
+ });
229
+ }
230
+ /**
231
+ * Abort current Apple Pay session
232
+ */
233
+ abortPaymentSession() {
234
+ if (this.currentSession) {
235
+ this.currentSession.abort();
236
+ this.currentSession = undefined;
237
+ this.currentPaymentRequest = undefined;
238
+ }
239
+ }
240
+ /**
241
+ * Setup Apple Pay session event handlers
242
+ */
243
+ setupSessionEventHandlers(resolve, reject, authToken, accountId) {
244
+ if (!this.currentSession ||
245
+ !this.applePayConfig ||
246
+ !this.currentPaymentRequest) {
247
+ return;
248
+ }
249
+ this.currentSession.onvalidatemerchant = async () => {
250
+ try {
251
+ if (!authToken) {
252
+ throw new Error('Authentication token not provided.');
253
+ }
254
+ const merchantSession = await this.validateMerchant(authToken, accountId);
255
+ try {
256
+ this.currentSession.completeMerchantValidation(merchantSession);
257
+ }
258
+ catch (completionError) {
259
+ console.error('Error calling completeMerchantValidation:', completionError);
260
+ throw completionError;
261
+ }
262
+ }
263
+ catch (error) {
264
+ console.error('=== MERCHANT VALIDATION ERROR ===');
265
+ console.error('Error during merchant validation:', error);
266
+ console.error('Error stack:', error.stack);
267
+ this.currentSession.abort();
268
+ reject({
269
+ success: false,
270
+ error: {
271
+ code: 'MERCHANT_VALIDATION_ERROR',
272
+ message: error instanceof Error
273
+ ? error.message
274
+ : 'Merchant validation failed',
275
+ },
276
+ });
277
+ }
278
+ };
279
+ this.currentSession.onpaymentauthorized = async (event) => {
280
+ try {
281
+ const payment = event.payment;
282
+ const paymentPayload = Object.assign(Object.assign({}, payment.token), { product_details: {
283
+ name: this.currentPaymentRequest.total.label,
284
+ price: ApplePayHelpers.parseAmount(this.currentPaymentRequest.total.amount),
285
+ description: this.currentPaymentRequest.total.label,
286
+ } });
287
+ const paymentResult = await this.processPayment(authToken, accountId, paymentPayload);
288
+ if (paymentResult.success) {
289
+ this.currentSession.completePayment({
290
+ status: ApplePaySessionStatus.STATUS_SUCCESS,
291
+ });
292
+ resolve({
293
+ success: true,
294
+ token: payment.token,
295
+ paymentMethodId: paymentResult.data.id,
296
+ });
297
+ }
298
+ else {
299
+ console.error('PSP reported payment failure:', paymentResult.data);
300
+ this.currentSession.completePayment({
301
+ status: ApplePaySessionStatus.STATUS_FAILURE,
302
+ });
303
+ reject({
304
+ success: false,
305
+ error: {
306
+ code: 'PAYMENT_PROCESSING_ERROR',
307
+ message: 'Payment processing failed',
308
+ },
309
+ });
310
+ }
311
+ }
312
+ catch (error) {
313
+ console.error('=== PAYMENT PROCESSING ERROR ===');
314
+ console.error('Error processing payment:', error);
315
+ console.error('Error stack:', error.stack);
316
+ this.currentSession.completePayment({
317
+ status: ApplePaySessionStatus.STATUS_FAILURE,
318
+ });
319
+ reject({
320
+ success: false,
321
+ error: {
322
+ code: 'PAYMENT_PROCESSING_ERROR',
323
+ message: error instanceof Error
324
+ ? error.message
325
+ : 'Payment processing failed',
326
+ },
327
+ });
328
+ }
329
+ finally {
330
+ this.currentSession = undefined;
331
+ this.currentPaymentRequest = undefined;
332
+ }
333
+ };
334
+ this.currentSession.onpaymentmethodselected = () => {
335
+ const paymentUpdate = {
336
+ newTotal: this.currentPaymentRequest.total,
337
+ newLineItems: this.currentPaymentRequest.lineItems || [],
338
+ };
339
+ try {
340
+ this.currentSession.completePaymentMethodSelection(paymentUpdate);
341
+ }
342
+ catch (error) {
343
+ console.error('Error completing payment method selection:', error);
344
+ this.currentSession.abort();
345
+ }
346
+ };
347
+ this.currentSession.onshippingmethodselected = () => {
348
+ this.currentSession.completeShippingMethodSelection({
349
+ status: ApplePaySessionStatus.STATUS_SUCCESS,
350
+ newTotal: this.currentPaymentRequest.total,
351
+ newLineItems: this.currentPaymentRequest.lineItems || [],
352
+ });
353
+ };
354
+ this.currentSession.oncancel = (event) => {
355
+ if (event.sessionError) {
356
+ console.error(event.sessionError);
357
+ switch (event.sessionError.code) {
358
+ case 'unknown':
359
+ console.error('Unknown error - likely merchant validation issue');
360
+ console.error('This usually means:');
361
+ console.error('1. Merchant certificate is invalid or expired');
362
+ console.error('2. Merchant identifier mismatch');
363
+ console.error('3. Backend validation endpoint issues');
364
+ break;
365
+ case 'invalidMerchantSession':
366
+ console.error('Invalid merchant session provided');
367
+ console.error('Check that the merchant session from backend is valid');
368
+ break;
369
+ case 'userCancel':
370
+ console.error('User cancelled the payment');
371
+ break;
372
+ default:
373
+ console.error('Other error code:', event.sessionError.code);
374
+ }
375
+ }
376
+ this.currentSession = undefined;
377
+ this.currentPaymentRequest = undefined;
378
+ reject({
379
+ success: false,
380
+ error: {
381
+ code: 'USER_CANCELLED',
382
+ message: 'User cancelled the Apple Pay session',
383
+ },
384
+ });
385
+ };
386
+ if ('onerror' in this.currentSession) {
387
+ this.currentSession.onerror = (error) => {
388
+ console.error('=== APPLE PAY SESSION ERROR ===');
389
+ console.error('Session error:', error);
390
+ this.currentSession = undefined;
391
+ this.currentPaymentRequest = undefined;
392
+ reject({
393
+ success: false,
394
+ error: {
395
+ code: 'SESSION_ERROR',
396
+ message: 'Apple Pay session error occurred',
397
+ },
398
+ });
399
+ };
400
+ }
401
+ }
402
+ /**
403
+ * Create a basic payment request
404
+ */
405
+ static createPaymentRequest(amount, label, countryCode = 'US', currencyCode = 'USD') {
406
+ return {
407
+ countryCode,
408
+ currencyCode,
409
+ merchantCapabilities: ApplePayHelpers.getDefaultMerchantCapabilities(),
410
+ supportedNetworks: ApplePayHelpers.getDefaultSupportedNetworks(),
411
+ total: ApplePayHelpers.createLineItem(label, amount),
412
+ };
413
+ }
414
+ /**
415
+ * Get current configuration
416
+ */
417
+ getApplePayConfig() {
418
+ return this.applePayConfig;
419
+ }
420
+ }
421
+
90
422
  const ApplePaySkeleton = (props) => {
91
423
  const { isReady } = props;
92
424
  if (isReady) {
@@ -286,6 +618,7 @@ const ApplePay = /*@__PURE__*/ proxyCustomElement(class ApplePay extends HTMLEle
286
618
  supportedNetworks: ApplePayHelpers.getDefaultSupportedNetworks(),
287
619
  total: ApplePayHelpers.createLineItem(checkoutStore.paymentDescription, checkoutStore.paymentAmount),
288
620
  };
621
+ console.log("paymentRequest", paymentRequest);
289
622
  const result = await this.applePayService.startPaymentSession(paymentRequest, checkoutStore.authToken, checkoutStore.accountId);
290
623
  if (result.success) {
291
624
  this.applePayCompleted.emit({
@@ -319,29 +652,7 @@ const ApplePay = /*@__PURE__*/ proxyCustomElement(class ApplePay extends HTMLEle
319
652
  }
320
653
  };
321
654
  }
322
- // private unsubscribeCheckoutLoaded?: () => void;
323
- // componentWillLoad() {
324
- // this.unsubscribeCheckoutLoaded = onChange("checkoutLoaded", (loaded) => {
325
- // this.applePayService = new ApplePayService();
326
- // console.log("checkoutLoaded", loaded);
327
- // if (loaded) {
328
- // this.initializeApplePay();
329
- // }
330
- // });
331
- // }
332
- // disconnectedCallback() {
333
- // this.unsubscribeCheckoutLoaded?.();
334
- // this.unsubscribeCheckoutLoaded = undefined;
335
- // }
336
- // @Watch("merchantIdentifier")
337
- // @Watch("buttonType")
338
- // @Watch("buttonStyle")
339
- // @Watch("disabled")
340
- // watchPropsChange() {
341
- // this.initializeApplePay();
342
- // }
343
655
  async initializeApplePay() {
344
- console.log("initializeApplePay", checkoutStore.checkoutLoaded);
345
656
  try {
346
657
  this.isLoading = true;
347
658
  this.error = null;
@@ -350,9 +661,9 @@ const ApplePay = /*@__PURE__*/ proxyCustomElement(class ApplePay extends HTMLEle
350
661
  Boolean(checkoutStore.paymentCurrency) &&
351
662
  Boolean(checkoutStore.authToken);
352
663
  if (!hasRequiredConfig) {
353
- this.error = "Missing required Apple Pay configuration blabla blabla 2";
664
+ this.error = "Missing required Apple Pay configuration";
354
665
  this.isConfigValid = false;
355
- console.error("Apple Pay config error: missing required values blabla blabla 2", {
666
+ console.error("Apple Pay config error: missing required values", {
356
667
  paymentAmount: checkoutStore.paymentAmount,
357
668
  paymentCurrency: checkoutStore.paymentCurrency,
358
669
  hasAuthToken: Boolean(checkoutStore.authToken),
@@ -385,6 +696,7 @@ const ApplePay = /*@__PURE__*/ proxyCustomElement(class ApplePay extends HTMLEle
385
696
  buttonType: this.buttonType,
386
697
  buttonStyle: this.buttonStyle,
387
698
  };
699
+ this.applePayService = new ApplePayService();
388
700
  this.applePayService.initialize(applePayConfig);
389
701
  const hasActiveCard = await this.applePayService.canMakePaymentsWithActiveCard();
390
702
  if (!hasActiveCard) {
@@ -418,19 +730,13 @@ const ApplePay = /*@__PURE__*/ proxyCustomElement(class ApplePay extends HTMLEle
418
730
  this.applePayCancelled.emit();
419
731
  }
420
732
  render() {
421
- // const shouldHide =
422
- // !this.isLoading &&
423
- // (!this.isConfigValid || !this.isAvailable || !this.canMakePayments || !checkoutStore.checkoutLoaded);
424
- // if (shouldHide) {
425
- // return null;
426
- // }
427
733
  const isReady = !this.isLoading &&
428
734
  this.isAvailable &&
429
735
  this.canMakePayments &&
430
736
  this.isConfigValid;
431
- return (h(StyledHost, { key: 'ea33bc759d2849cf013cb6f98367c8d78c799acb' }, checkoutStore.checkoutLoaded && (h("script", { key: '9ed6140223a8788ca194a8978a9ca8e1e30eb10e', async: true, src: 'https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js', onLoad: () => {
737
+ return (h(StyledHost, { key: '89555e4ca332762a2212d1ef447c9890fa9dc154' }, checkoutStore.checkoutLoaded && (h("script", { key: '0770cdfd74b354262215f651713e92cc3a4cc2a0', async: true, src: 'https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js', onLoad: () => {
432
738
  this.initializeApplePay();
433
- } })), h("div", { key: '6501d8cb4c4119eadf9112db4fca876437138bcc', class: 'apple-pay-container' }, h(ApplePaySkeleton, { key: '1aee83e3deac0d0f68d2788f65401a1d7c48047f', isReady: isReady }), isReady && (h(ApplePayButton, { key: 'eb05dde5789f5f1bb83e75127c222996a38c8fef', buttonType: this.buttonType, buttonStyle: this.buttonStyle, disabled: this.disabled, isProcessing: this.isProcessing, isAvailable: this.isAvailable, clickHandler: this.handleApplePayClick }))), h("style", { key: '8060bf6771c12f47d482f0a774e4fd6547e50a2e' }, `
739
+ } })), h("div", { key: '8e97c5c22626c24d81b7fe1114b35808f3ba0758', class: 'apple-pay-container' }, h(ApplePaySkeleton, { key: '8c3859ab8a7b5c215366667692c84841c34a96de', isReady: isReady }), isReady && (h(ApplePayButton, { key: 'ab9e158a240c81530f693a6272c974a0c62fe317', buttonType: this.buttonType, buttonStyle: this.buttonStyle, disabled: this.disabled, isProcessing: this.isProcessing, isAvailable: this.isAvailable, clickHandler: this.handleApplePayClick }))), h("style", { key: '4182e97979dcb25b9e5e0f13fa176037fe0300e0' }, `
434
740
  .apple-pay-container {
435
741
  width: 100%;
436
742
  }
@@ -262,7 +262,6 @@ const ModularCheckout = /*@__PURE__*/ proxyCustomElement(class ModularCheckout e
262
262
  checkoutStore.selectedPaymentMethod = paymentMethod;
263
263
  checkoutStore.paymentToken = paymentMethod.id || undefined;
264
264
  }
265
- // getAvailablePaymentMethods removed in favor of checkout-changed event
266
265
  // if validation fails, the error will be emitted by the component
267
266
  async validate() {
268
267
  const promises = [];
@@ -410,7 +409,7 @@ const ModularCheckout = /*@__PURE__*/ proxyCustomElement(class ModularCheckout e
410
409
  });
411
410
  }
412
411
  render() {
413
- return h(Host, { key: '7ee5bc2bb0a8c1ed497440c7b1f90d1a2fb3c8bb' });
412
+ return h(Host, { key: '2cbac33c57dd2cad327f156a4630b1dba9bf3252' });
414
413
  }
415
414
  get hostEl() { return this; }
416
415
  }, [256, "justifi-modular-checkout", {
@@ -1,5 +1,5 @@
1
1
  const name = "@justifi/webcomponents";
2
- const version = "6.0.0-rc.16";
2
+ const version = "6.0.0-rc.18";
3
3
  var webcomponentsPackageJson = {
4
4
  name: name,
5
5
  version: version};