@justifi/webcomponents 6.0.0-rc.7 → 6.0.0-rc.8

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 (103) hide show
  1. package/dist/cjs/{check-pkg-version-CO2TpemN.js → check-pkg-version-BJaFyEGj.js} +1 -1
  2. package/dist/cjs/checkout.store-MSwLBCby.js +71 -0
  3. package/dist/cjs/hidden-input_2.cjs.entry.js +1 -1
  4. package/dist/cjs/justifi-apple-pay.cjs.entry.js +1 -1
  5. package/dist/cjs/justifi-bank-account-billing-form-simple_9.cjs.entry.js +3 -3
  6. package/dist/cjs/justifi-business-details.cjs.entry.js +2 -2
  7. package/dist/cjs/justifi-business-form.cjs.entry.js +2 -2
  8. package/dist/cjs/justifi-checkout-summary_7.cjs.entry.js +39 -66
  9. package/dist/cjs/justifi-checkout.cjs.entry.js +3 -3
  10. package/dist/cjs/justifi-checkouts-list.cjs.entry.js +2 -2
  11. package/dist/cjs/justifi-dispute-management.cjs.entry.js +2 -2
  12. package/dist/cjs/justifi-dispute-notification_3.cjs.entry.js +2 -2
  13. package/dist/cjs/justifi-gross-payment-chart.cjs.entry.js +2 -2
  14. package/dist/cjs/justifi-order-terminals.cjs.entry.js +2 -2
  15. package/dist/cjs/justifi-payment-details.cjs.entry.js +2 -2
  16. package/dist/cjs/justifi-payment-provisioning.cjs.entry.js +2 -2
  17. package/dist/cjs/justifi-payment-transactions-list.cjs.entry.js +2 -2
  18. package/dist/cjs/justifi-payments-list.cjs.entry.js +2 -2
  19. package/dist/cjs/justifi-payout-details.cjs.entry.js +2 -2
  20. package/dist/cjs/justifi-payout-transactions-list.cjs.entry.js +2 -2
  21. package/dist/cjs/justifi-payouts-list.cjs.entry.js +2 -2
  22. package/dist/cjs/justifi-refund-payment.cjs.entry.js +2 -2
  23. package/dist/cjs/justifi-season-interruption-insurance.cjs.entry.js +3 -3
  24. package/dist/cjs/justifi-terminal-orders-list.cjs.entry.js +2 -2
  25. package/dist/cjs/justifi-terminals-list.cjs.entry.js +2 -2
  26. package/dist/cjs/loader.cjs.js +1 -1
  27. package/dist/cjs/{package-k4ZKuvRG.js → package-DqvfEWsE.js} +1 -1
  28. package/dist/cjs/webcomponents.cjs.js +1 -1
  29. package/dist/collection/components/tokenize-payment-method/tokenize-payment-method.js +3 -1
  30. package/dist/collection/store/checkout.store.js +2 -1
  31. package/dist/docs.json +1 -1
  32. package/dist/esm/{check-pkg-version-ggwQhM0h.js → check-pkg-version-ucd96eu6.js} +1 -1
  33. package/dist/{module/ModularCheckout.js → esm/checkout.store-UMe84fjY.js} +39 -1
  34. package/dist/esm/hidden-input_2.entry.js +1 -1
  35. package/dist/esm/justifi-apple-pay.entry.js +1 -1
  36. package/dist/esm/justifi-bank-account-billing-form-simple_9.entry.js +3 -3
  37. package/dist/esm/justifi-business-details.entry.js +2 -2
  38. package/dist/esm/justifi-business-form.entry.js +2 -2
  39. package/dist/esm/justifi-checkout-summary_7.entry.js +6 -33
  40. package/dist/esm/justifi-checkout.entry.js +3 -3
  41. package/dist/esm/justifi-checkouts-list.entry.js +2 -2
  42. package/dist/esm/justifi-dispute-management.entry.js +2 -2
  43. package/dist/esm/justifi-dispute-notification_3.entry.js +2 -2
  44. package/dist/esm/justifi-gross-payment-chart.entry.js +2 -2
  45. package/dist/esm/justifi-order-terminals.entry.js +2 -2
  46. package/dist/esm/justifi-payment-details.entry.js +2 -2
  47. package/dist/esm/justifi-payment-provisioning.entry.js +2 -2
  48. package/dist/esm/justifi-payment-transactions-list.entry.js +2 -2
  49. package/dist/esm/justifi-payments-list.entry.js +2 -2
  50. package/dist/esm/justifi-payout-details.entry.js +2 -2
  51. package/dist/esm/justifi-payout-transactions-list.entry.js +2 -2
  52. package/dist/esm/justifi-payouts-list.entry.js +2 -2
  53. package/dist/esm/justifi-refund-payment.entry.js +2 -2
  54. package/dist/esm/justifi-season-interruption-insurance.entry.js +3 -3
  55. package/dist/esm/justifi-terminal-orders-list.entry.js +2 -2
  56. package/dist/esm/justifi-terminals-list.entry.js +2 -2
  57. package/dist/esm/loader.js +1 -1
  58. package/dist/esm/{package-VsM6ERNV.js → package-D51QuD44.js} +1 -1
  59. package/dist/esm/webcomponents.js +1 -1
  60. package/dist/module/checkout.store.js +31 -2
  61. package/dist/module/modular-checkout.js +1 -2
  62. package/dist/module/package.js +1 -1
  63. package/dist/module/plaid-payment-method.js +1 -2
  64. package/dist/module/saved-payment-methods.js +1 -2
  65. package/dist/module/sezzle-payment-method.js +1 -2
  66. package/dist/module/tokenize-payment-method.js +4 -3
  67. package/dist/types/store/checkout.store.d.ts +1 -1
  68. package/dist/webcomponents/{p-b4e5470a.entry.js → p-00a845e5.entry.js} +1 -1
  69. package/dist/webcomponents/{p-c7f61bcb.entry.js → p-053c183b.entry.js} +1 -1
  70. package/dist/webcomponents/p-0f42c89d.entry.js +1 -0
  71. package/dist/webcomponents/{p-4723f35b.entry.js → p-1288fda5.entry.js} +1 -1
  72. package/dist/webcomponents/{p-3c6fa232.entry.js → p-17896a6d.entry.js} +1 -1
  73. package/dist/webcomponents/{p-0eba50d0.entry.js → p-2a3c59d4.entry.js} +1 -1
  74. package/dist/webcomponents/{p-eae6bfe7.entry.js → p-2b5da0dc.entry.js} +1 -1
  75. package/dist/webcomponents/p-724e57e1.entry.js +1 -0
  76. package/dist/webcomponents/{p-22ac6133.entry.js → p-72f3bbfc.entry.js} +1 -1
  77. package/dist/webcomponents/{p-3caa786e.entry.js → p-84d2025d.entry.js} +1 -1
  78. package/dist/webcomponents/{p-4d9fe160.entry.js → p-851a418e.entry.js} +1 -1
  79. package/dist/webcomponents/{p-d53004c8.entry.js → p-8d891445.entry.js} +1 -1
  80. package/dist/webcomponents/{p-0ea1e5e6.entry.js → p-9b0f0f53.entry.js} +1 -1
  81. package/dist/webcomponents/p-C6c6Q0E7.js +1 -0
  82. package/dist/webcomponents/p-D51QuD44.js +1 -0
  83. package/dist/webcomponents/{p-884fce8b.entry.js → p-a0cc3d92.entry.js} +1 -1
  84. package/dist/webcomponents/{p-6d610c1e.entry.js → p-bcb1d661.entry.js} +1 -1
  85. package/dist/webcomponents/{p-0490c0f4.entry.js → p-c65bcc0c.entry.js} +1 -1
  86. package/dist/webcomponents/{p-b2bbf609.entry.js → p-d17e2531.entry.js} +1 -1
  87. package/dist/webcomponents/{p-dd81b598.entry.js → p-d277cc68.entry.js} +1 -1
  88. package/dist/webcomponents/p-ed7dfcf3.entry.js +1 -0
  89. package/dist/webcomponents/{p-08270def.entry.js → p-ef353e3d.entry.js} +1 -1
  90. package/dist/webcomponents/{p-82a15155.entry.js → p-f04c79f2.entry.js} +1 -1
  91. package/dist/webcomponents/p-fa1aba4e.entry.js +1 -0
  92. package/dist/webcomponents/{p-7890f311.entry.js → p-fb16d889.entry.js} +1 -1
  93. package/dist/webcomponents/{p-CxqAv6yr.js → p-tkZEz3MG.js} +1 -1
  94. package/dist/webcomponents/webcomponents.esm.js +1 -1
  95. package/package.json +1 -1
  96. package/dist/cjs/checkout.store-Ctwy9ahZ.js +0 -42
  97. package/dist/esm/checkout.store-sQSQqMAD.js +0 -39
  98. package/dist/webcomponents/p-071208e4.entry.js +0 -1
  99. package/dist/webcomponents/p-1f55a465.entry.js +0 -1
  100. package/dist/webcomponents/p-4150309d.entry.js +0 -1
  101. package/dist/webcomponents/p-728c60b4.entry.js +0 -1
  102. package/dist/webcomponents/p-DAED83Ew.js +0 -1
  103. package/dist/webcomponents/p-VsM6ERNV.js +0 -1
@@ -9,8 +9,7 @@ import './dinero.js';
9
9
  import { a as ComponentErrorCodes, C as ComponentErrorSeverity } from './Refund.js';
10
10
  import './Pagination.js';
11
11
  import './Business.js';
12
- import { c as checkoutStore } from './checkout.store.js';
13
- import { P as PAYMENT_METHODS } from './ModularCheckout.js';
12
+ import { c as checkoutStore, P as PAYMENT_METHODS } from './checkout.store.js';
14
13
  import { d as defineCustomElement$i } from './custom-popper2.js';
15
14
  import { d as defineCustomElement$h } from './form-control-checkbox2.js';
16
15
  import { d as defineCustomElement$g } from './form-control-help-text2.js';
@@ -162,9 +161,11 @@ const TokenizePaymentMethod = /*@__PURE__*/ proxyCustomElement(class TokenizePay
162
161
  }
163
162
  if (!this.disableCreditCard) {
164
163
  this.selectedPaymentMethod = PAYMENT_METHODS.NEW_CARD;
164
+ checkoutStore.selectedPaymentMethod = PAYMENT_METHODS.NEW_CARD;
165
165
  }
166
166
  else if (!this.disableBankAccount) {
167
167
  this.selectedPaymentMethod = PAYMENT_METHODS.NEW_BANK_ACCOUNT;
168
+ checkoutStore.selectedPaymentMethod = PAYMENT_METHODS.NEW_BANK_ACCOUNT;
168
169
  }
169
170
  }
170
171
  setComputedHideSubmitButton() {
@@ -273,7 +274,7 @@ const TokenizePaymentMethod = /*@__PURE__*/ proxyCustomElement(class TokenizePay
273
274
  return paymentMethodId === PAYMENT_METHODS.NEW_CARD ? (h("justifi-card-form", { ref: (el) => (this.paymentMethodFormRef = el) })) : (h("justifi-bank-account-form", { ref: (el) => (this.paymentMethodFormRef = el) }));
274
275
  }
275
276
  render() {
276
- return (h(StyledHost, { key: 'a11012d80460057b0dc16dc6a470ad57bad12ca2' }, h("form", { key: '76c8f50a5394f80b171295337a4382a4713d5ec1' }, h("fieldset", { key: '955f99016cb495628afe016037a154fcc39f5ac3' }, h("div", { key: 'a80324943093aa2df3804f5358fb904b5540d92c', class: "row gy-3" }, h("div", { key: 'b5fc2d063e2a859f52c4914ea669b35134d7d256', class: "col-12" }, this.availablePaymentMethods.map((method) => this.renderPaymentMethodOption(method))), h("div", { key: 'f2a759d16742c346bd7833c72916b2a058a1be34', class: "col-12" }, h("justifi-button", { key: 'ab6238aa25cc9dae2851b4156b7c2ac88802b4fd', text: this.submitButtonText, variant: "primary", type: "submit", clickHandler: (e) => this.tokenizePaymentMethod(e), isLoading: this.isLoading, "data-testid": "submit-button", hidden: this.computedHideSubmitButton })))))));
277
+ return (h(StyledHost, { key: '86f4eb7ae1ee329384e6bde2fdf1d7035a341488' }, h("form", { key: 'e3433176ea56ca9cbf831c9c4a8c2cfb3e41707a' }, h("fieldset", { key: 'c130d134bc8e5642881250586e8099e8eee7090b' }, h("div", { key: '0ff386b78ce610a22ddeed10b29a170259197f10', class: "row gy-3" }, h("div", { key: '020e8750dd774723083a84a4a4dc0637644ccd25', class: "col-12" }, this.availablePaymentMethods.map((method) => this.renderPaymentMethodOption(method))), h("div", { key: 'b3b53bca5369986e892913a87d7f77a463706015', class: "col-12" }, h("justifi-button", { key: '5f7a195926440cf5fba38b4f5781d45b6959ad6d', text: this.submitButtonText, variant: "primary", type: "submit", clickHandler: (e) => this.tokenizePaymentMethod(e), isLoading: this.isLoading, "data-testid": "submit-button", hidden: this.computedHideSubmitButton })))))));
277
278
  }
278
279
  get host() { return this; }
279
280
  static get watchers() { return {
@@ -24,7 +24,7 @@ interface IInitialState {
24
24
  paymentMethods: ICheckoutPaymentMethod[];
25
25
  paymentToken?: string;
26
26
  savePaymentMethod: boolean;
27
- selectedPaymentMethod: PAYMENT_METHODS | undefined;
27
+ selectedPaymentMethod: PAYMENT_METHODS;
28
28
  totalAmount: number;
29
29
  }
30
30
  declare const checkoutStore: IInitialState, onChange: import("@stencil/store/dist/types").OnChangeHandler<IInitialState>;
@@ -1 +1 @@
1
- import{r as e,c as t,h as s}from"./p-Bn7inNWG.js";import{f as i}from"./p-zdIeCUeh.js";import{z as a,ai as r}from"./p-RvUQ__Pq.js";import{B as d}from"./p-DD0Mvpeu.js";import{S as o}from"./p-DxqCFDtF.js";import{S as c}from"./p-CaAVuW6B.js";import"./p-CZfYo5-1.js";import{C as n,a as h}from"./p-Cjcsf8ku.js";import{g as p,a as f}from"./p-D2muobcE.js";import{D as l}from"./p-D2_iJUrZ.js";import{D as u}from"./p-Bg2SZArf.js";import{c as b,J as y}from"./p-CxqAv6yr.js";import"./p-HXpYMWUU.js";import"./p-BPtcGAzB.js";import"./p-DhGNCW2f.js";import"./p-CpaS1Lex.js";import"./p-BP7op0vq.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-VsM6ERNV.js";const m=({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var o;try{const d=await s.submitDisputeResponse(t,e,i);if(d.error){return r({error:f(d.error),code:p(null===(o=d.error)||void 0===o?void 0:o.code),severity:n.ERROR})}a(d)}catch(e){const t=p(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:n.ERROR})}finally{return d()}},v=class{constructor(s){e(this,s),this.clickEvent=t(this,"click-event"),this.errorEvent=t(this,"error-event"),this.submitEvent=t(this,"submit-event")}acceptDispute(){m({disputeId:this.dispute.id,authToken:this.authToken,service:new l})({payload:{forfeit:!0},onSuccess:e=>{this.submitEvent.emit({response:e})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}})}initiateRespondToDispute(){this.clickEvent.emit({name:u.respondToDispute})}render(){var e,t,n,h,p,f,l;return s(o,{key:"90d2506d5bde2ea478fa3575fc162bb356b67fac"},this.isLoading&&s("div",{key:"4877ae22d3d8e312640b122c9107b6bdd8f924cb",style:{marginBottom:"8px"}},s(c,{key:"31fa0717949bbc6aa49db1c6ae0e324099ae1de2",height:"28px",width:"70%",styles:{marginBottom:"16px"}}),s(c,{key:"ac5179232cb9ee33d3f3e16d9f93536ecfbf46a5",height:"18px",styles:{marginBottom:"8px"}}),s(c,{key:"c22a5e3b257d01f92de7f6188fa0758861abc747",height:"18px",styles:{marginBottom:"8px"}})),(null===(e=this.dispute)||void 0===e?void 0:e.needsResponse)&&s("div",{key:"be331b1a5e2fa0baf46bc593ef7ce4f5872abcff",part:a},s("h1",{key:"8094c16d3b375f28ffe314613f21ae25b63e59ef",class:"h4",part:r},"This payment is disputed"),s("p",{key:"d89ae665e1f9bd99c9338e2132c1dc56e5386696"},"The cardholder is disputing this payment. You may accept this dispute, or proceed to provide evidence in a counter dispute."),s("h2",{key:"2786733eac76628019993e13473d1f43c0c395ed",class:"h5"},"Dispute details"),s("div",{key:"663c28c46136bd56889b6ad0b9bfce9e5adbb590",class:"d-table gap-2"},s("div",{key:"dc688fad875d1591dcb7f31d423b61a3df2ff954",class:"d-table-row gap-2"},s("span",{key:"442db7a6e95524ca6b092794c7a4a4d987c9866e",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Amount"),s("span",{key:"0a31de8692c9b00f43fcf3c0508e4d00a221d096",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},i(null===(t=this.dispute)||void 0===t?void 0:t.amount))),s("div",{key:"9fe0c1a3d3350c36fca190ae748dafe24d41b5fc",class:"d-table-row gap-2"},s("span",{key:"12165cb6671519130a5f2e0d8938aaa55e7e3ead",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Reason"),s("span",{key:"4a37ca8a7d64b97142997bb50ec11d737ac6a882",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(n=this.dispute)||void 0===n?void 0:n.reason)),s("div",{key:"4d9cf74a8ed26dd84e4ce7325d4b8703352362a4",class:"d-table-row gap-2"},s("span",{key:"8c0eaa24ebec7703eb18384b0b1f2eae8a684b55",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Dispute ID"),s("span",{key:"238813abf2ea0848e1fe817d5798b9b0d0b78ffc",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(h=this.dispute)||void 0===h?void 0:h.id))),s("div",{key:"d156a7e9bf0e7214ff2164fc09b12c0b8f1d2b36",class:"d-flex gap-2 mt-4 justify-content-end"},s(d,{key:"7822fd12dfc39bd2aced043956d012fd34cc1b01",variant:"secondary",onClick:()=>this.acceptDispute()},"Accept dispute"),s(d,{key:"05132b3a6d1fc3d136dc227008ea1999330cdb96",variant:"primary",onClick:()=>this.initiateRespondToDispute()},"Counter dispute"))),(null===(p=this.dispute)||void 0===p?void 0:p.underReview)&&s("div",{key:"b04dd0c34f608b75ea3997a9c28ce948fa9dba5c"},s("h1",{key:"ac2a13373315703e86247b6707097af7cf2e6757",class:"h4"},"This payment is disputed and under review"),s("p",{key:"203aed553e01bbaebe44bb370a1d088c149cda06"},"The cardholder is disputing this payment. A counter dispute has been submitted and is under review.")),(null===(f=this.dispute)||void 0===f?void 0:f.won)&&s("div",{key:"6325264f8ad7b6678825878ed59f03f90eee421a"},s("h1",{key:"7b647ed77373884e0751de4fc39403211c249db6",class:"h4"},"This payment was disputed"),s("p",{key:"2a5c1560d341af9b743234a058a1187f245a2ae8"},"The cardholder disputed this payment and the card issuer has settled it in your favor.")),(null===(l=this.dispute)||void 0===l?void 0:l.lost)&&s("div",{key:"a89e7f4d7e8926ed052023c7dbbbaf076a03ed9c"},s("h1",{key:"534b560aa35dd43ba0eba668904ef70dc1a6954f",class:"h4"},"This payment was disputed"),s("p",{key:"2381f2f6418b47dce67c498c56d5f3789add57dc"},"The cardholder disputed this payment and the card issuer has settled it in their favor.")))}},k=class{constructor(s){e(this,s),this.errorEvent=t(this,"error-event"),this.errorMessage=null,this.apiOrigin="https://wc-proxy.justifi.ai",this.handleErrorEvent=e=>{this.errorMessage=e.detail.message,this.errorEvent.emit(e.detail)}}componentWillLoad(){b(),this.analytics=new y(this),this.initializeDisputeServiceMethods()}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}propChanged(){this.initializeDisputeServiceMethods()}initializeDisputeServiceMethods(){this.disputeId&&this.authToken?(this.updateDisputeResponse=(({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var o;try{const d=await s.updateDisputeResponse(t,e,i);if(d.error)return r({error:f(d.error),code:p(null===(o=d.error)||void 0===o?void 0:o.code),severity:n.ERROR});a(d)}catch(e){const t=p(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:n.ERROR})}finally{return d()}})({disputeId:this.disputeId,authToken:this.authToken,service:new l}),this.createDisputeEvidence=(({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var o;try{const d=await s.createDisputeEvidence(t,e,i);if(d.error)return r({error:f(d.error),code:p(null===(o=d.error)||void 0===o?void 0:o.code),severity:n.ERROR});a(d)}catch(e){const t=p(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:n.ERROR})}finally{return d()}})({disputeId:this.disputeId,authToken:this.authToken,service:new l}),this.submitDisputeResponse=m({disputeId:this.disputeId,authToken:this.authToken,service:new l})):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:h.MISSING_PROPS,message:this.errorMessage,severity:n.ERROR}))}render(){return s(o,{key:"b90f636418c3e11b046d36dee9accf345756b407"},s("justifi-dispute-response-core",{key:"ff6e510faad54506eda24b1d8dc94b67afc18014","onError-event":this.handleErrorEvent,"dispute-id":this.disputeId,disputeResponse:this.disputeResponse,createDisputeEvidence:this.createDisputeEvidence,updateDisputeResponse:this.updateDisputeResponse,submitDisputeResponse:this.submitDisputeResponse}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}},j=class{constructor(i){e(this,i),this.clickEvent=t(this,"click-event"),this.errorEvent=t(this,"error-event"),this.stepCompleteEvent=t(this,"complete-form-step-event"),this.submitEvent=t(this,"submit-event"),this.disputeResponse={},this.isLoading=!1,this.documentList=[],this.documentErrors={},this.currentStep=0,this.componentStepMapping=[()=>s("justifi-product-or-service",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-customer-details",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-cancellation-policy",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-refund-policy",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-duplicate-charge",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-electronic-evidence",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-shipping-details",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-additional-statement",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors})],this.saveData=async(e,t)=>{if(Object.keys(e).length)return this.isLastStep?this.submitDisputeResponse({payload:e,onSuccess:e=>{this.submitEvent.emit({response:e}),this.stepCompleteEvent.emit({response:e,formStep:t})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}}):this.updateDisputeResponse({payload:e,onSuccess:e=>{this.disputeResponse=Object.assign({},e.data),this.stepCompleteEvent.emit({response:e,formStep:t})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}});this.stepCompleteEvent.emit({response:null,formStep:t})},this.initializeMakePresignedURLs=async()=>{const e=this.documentList.map((e=>this.getPresignedFileUrl(e)));return await Promise.all(e)},this.initializeFileUploads=async()=>{const e=this.documentList.map((e=>this.uploadDocument(e)));return Promise.all(e)},this.getPresignedFileUrl=async e=>this.createDisputeEvidence({payload:{file_name:e.file_name,file_type:e.file_type,dispute_evidence_type:e.dispute_evidence_type},onSuccess:t=>{e.presignedUrl=t.data.presigned_url},onError:({error:t,code:s,severity:i})=>{const a={[e.dispute_evidence_type]:t};this.documentErrors=Object.assign(Object.assign({},this.documentErrors),a),this.errorEvent.emit({errorCode:s,message:t,severity:i})}}),this.uploadDocument=async e=>{const t=await e.getFileString();if(!e.presignedUrl)throw new Error("Presigned URL is not set");return await fetch(e.presignedUrl,{method:"PUT",body:t})},this.handleSubmit=async(e,t,s)=>{if(this.isLoading=!0,t.length){if(this.documentErrors={},this.documentList=t,await this.initializeMakePresignedURLs(),Object.keys(this.documentErrors).length)throw this.isLoading=!1,new Error("Could not presign all documents");await this.initializeFileUploads()}await this.saveData(e,s),this.isLoading=!1},this.onCancel=()=>{this.clickEvent.emit({name:u.cancelDispute})},this.onBack=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.previousStep}),await this.handleSubmit(e,t,s),this.currentStep--}))},this.onNext=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.nextStep}),await this.handleSubmit(e,t,s),this.currentStep++}))},this.onSubmit=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.submit});const i=Object.assign(Object.assign({},e),{forfeit:!1});await this.handleSubmit(i,t,s)}))}}get currentStepComponent(){return this.componentStepMapping[this.currentStep]()}get isLastStep(){return this.currentStep===this.componentStepMapping.length-1}get isFirstStep(){return 0===this.currentStep}render(){return s("div",{key:"09b09843d54a2dbced9788d16e244b2e59a3a78f",class:"row gy-3"},s("div",{key:"6a3fe32d65ea1a74161d9ba9984543cf950e47ea",class:"col-12"},s("h1",{key:"bbb6f1334fd6b120e592117ba191d90b628e620f",class:"h4",part:r},"Counter dispute")),s("div",{key:"19cbc45842294e9344dbffb725f5f053bf370af7",class:"col-12"},this.currentStepComponent),s("div",{key:"fa875ca152ea77fc4c8363216d8ba16c7699b597",class:"col-12"},s("div",{key:"fa7b62fff0cbac81c19ebad919f5dd54c3679e84",class:"d-flex gap-2 mt-4 justify-content-end"},this.isFirstStep?s(d,{variant:"secondary",onClick:()=>this.onCancel(),disabled:this.isLoading,isLoading:this.isLoading},"Cancel"):s(d,{variant:"secondary",onClick:()=>this.onBack(),disabled:this.isLoading,isLoading:this.isLoading},"Back"),this.isLastStep?s(d,{variant:"primary",onClick:()=>this.onSubmit(),disabled:this.isLoading,isLoading:this.isLoading},"Submit Counter Dispute"):s(d,{variant:"primary",onClick:()=>this.onNext(),disabled:this.isLoading,isLoading:this.isLoading},"Next"))))}};export{v as justifi_dispute_notification,k as justifi_dispute_response,j as justifi_dispute_response_core}
1
+ import{r as e,c as t,h as s}from"./p-Bn7inNWG.js";import{f as i}from"./p-zdIeCUeh.js";import{z as a,ai as r}from"./p-RvUQ__Pq.js";import{B as d}from"./p-DD0Mvpeu.js";import{S as o}from"./p-DxqCFDtF.js";import{S as c}from"./p-CaAVuW6B.js";import"./p-CZfYo5-1.js";import{C as n,a as h}from"./p-Cjcsf8ku.js";import{g as p,a as f}from"./p-D2muobcE.js";import{D as l}from"./p-D2_iJUrZ.js";import{D as u}from"./p-Bg2SZArf.js";import{c as b,J as y}from"./p-tkZEz3MG.js";import"./p-HXpYMWUU.js";import"./p-BPtcGAzB.js";import"./p-DhGNCW2f.js";import"./p-CpaS1Lex.js";import"./p-BP7op0vq.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-D51QuD44.js";const m=({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var o;try{const d=await s.submitDisputeResponse(t,e,i);if(d.error){return r({error:f(d.error),code:p(null===(o=d.error)||void 0===o?void 0:o.code),severity:n.ERROR})}a(d)}catch(e){const t=p(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:n.ERROR})}finally{return d()}},v=class{constructor(s){e(this,s),this.clickEvent=t(this,"click-event"),this.errorEvent=t(this,"error-event"),this.submitEvent=t(this,"submit-event")}acceptDispute(){m({disputeId:this.dispute.id,authToken:this.authToken,service:new l})({payload:{forfeit:!0},onSuccess:e=>{this.submitEvent.emit({response:e})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}})}initiateRespondToDispute(){this.clickEvent.emit({name:u.respondToDispute})}render(){var e,t,n,h,p,f,l;return s(o,{key:"90d2506d5bde2ea478fa3575fc162bb356b67fac"},this.isLoading&&s("div",{key:"4877ae22d3d8e312640b122c9107b6bdd8f924cb",style:{marginBottom:"8px"}},s(c,{key:"31fa0717949bbc6aa49db1c6ae0e324099ae1de2",height:"28px",width:"70%",styles:{marginBottom:"16px"}}),s(c,{key:"ac5179232cb9ee33d3f3e16d9f93536ecfbf46a5",height:"18px",styles:{marginBottom:"8px"}}),s(c,{key:"c22a5e3b257d01f92de7f6188fa0758861abc747",height:"18px",styles:{marginBottom:"8px"}})),(null===(e=this.dispute)||void 0===e?void 0:e.needsResponse)&&s("div",{key:"be331b1a5e2fa0baf46bc593ef7ce4f5872abcff",part:a},s("h1",{key:"8094c16d3b375f28ffe314613f21ae25b63e59ef",class:"h4",part:r},"This payment is disputed"),s("p",{key:"d89ae665e1f9bd99c9338e2132c1dc56e5386696"},"The cardholder is disputing this payment. You may accept this dispute, or proceed to provide evidence in a counter dispute."),s("h2",{key:"2786733eac76628019993e13473d1f43c0c395ed",class:"h5"},"Dispute details"),s("div",{key:"663c28c46136bd56889b6ad0b9bfce9e5adbb590",class:"d-table gap-2"},s("div",{key:"dc688fad875d1591dcb7f31d423b61a3df2ff954",class:"d-table-row gap-2"},s("span",{key:"442db7a6e95524ca6b092794c7a4a4d987c9866e",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Amount"),s("span",{key:"0a31de8692c9b00f43fcf3c0508e4d00a221d096",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},i(null===(t=this.dispute)||void 0===t?void 0:t.amount))),s("div",{key:"9fe0c1a3d3350c36fca190ae748dafe24d41b5fc",class:"d-table-row gap-2"},s("span",{key:"12165cb6671519130a5f2e0d8938aaa55e7e3ead",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Reason"),s("span",{key:"4a37ca8a7d64b97142997bb50ec11d737ac6a882",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(n=this.dispute)||void 0===n?void 0:n.reason)),s("div",{key:"4d9cf74a8ed26dd84e4ce7325d4b8703352362a4",class:"d-table-row gap-2"},s("span",{key:"8c0eaa24ebec7703eb18384b0b1f2eae8a684b55",part:"detail-section-item-title",class:"fw-bold d-table-cell pe-4"},"Dispute ID"),s("span",{key:"238813abf2ea0848e1fe817d5798b9b0d0b78ffc",part:"detail-section-item-data",class:"flex-1 d-table-cell text-wrap"},null===(h=this.dispute)||void 0===h?void 0:h.id))),s("div",{key:"d156a7e9bf0e7214ff2164fc09b12c0b8f1d2b36",class:"d-flex gap-2 mt-4 justify-content-end"},s(d,{key:"7822fd12dfc39bd2aced043956d012fd34cc1b01",variant:"secondary",onClick:()=>this.acceptDispute()},"Accept dispute"),s(d,{key:"05132b3a6d1fc3d136dc227008ea1999330cdb96",variant:"primary",onClick:()=>this.initiateRespondToDispute()},"Counter dispute"))),(null===(p=this.dispute)||void 0===p?void 0:p.underReview)&&s("div",{key:"b04dd0c34f608b75ea3997a9c28ce948fa9dba5c"},s("h1",{key:"ac2a13373315703e86247b6707097af7cf2e6757",class:"h4"},"This payment is disputed and under review"),s("p",{key:"203aed553e01bbaebe44bb370a1d088c149cda06"},"The cardholder is disputing this payment. A counter dispute has been submitted and is under review.")),(null===(f=this.dispute)||void 0===f?void 0:f.won)&&s("div",{key:"6325264f8ad7b6678825878ed59f03f90eee421a"},s("h1",{key:"7b647ed77373884e0751de4fc39403211c249db6",class:"h4"},"This payment was disputed"),s("p",{key:"2a5c1560d341af9b743234a058a1187f245a2ae8"},"The cardholder disputed this payment and the card issuer has settled it in your favor.")),(null===(l=this.dispute)||void 0===l?void 0:l.lost)&&s("div",{key:"a89e7f4d7e8926ed052023c7dbbbaf076a03ed9c"},s("h1",{key:"534b560aa35dd43ba0eba668904ef70dc1a6954f",class:"h4"},"This payment was disputed"),s("p",{key:"2381f2f6418b47dce67c498c56d5f3789add57dc"},"The cardholder disputed this payment and the card issuer has settled it in their favor.")))}},k=class{constructor(s){e(this,s),this.errorEvent=t(this,"error-event"),this.errorMessage=null,this.apiOrigin="https://wc-proxy.justifi.ai",this.handleErrorEvent=e=>{this.errorMessage=e.detail.message,this.errorEvent.emit(e.detail)}}componentWillLoad(){b(),this.analytics=new y(this),this.initializeDisputeServiceMethods()}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}propChanged(){this.initializeDisputeServiceMethods()}initializeDisputeServiceMethods(){this.disputeId&&this.authToken?(this.updateDisputeResponse=(({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var o;try{const d=await s.updateDisputeResponse(t,e,i);if(d.error)return r({error:f(d.error),code:p(null===(o=d.error)||void 0===o?void 0:o.code),severity:n.ERROR});a(d)}catch(e){const t=p(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:n.ERROR})}finally{return d()}})({disputeId:this.disputeId,authToken:this.authToken,service:new l}),this.createDisputeEvidence=(({authToken:e,disputeId:t,service:s})=>async({payload:i,onSuccess:a,onError:r,final:d=()=>{}})=>{var o;try{const d=await s.createDisputeEvidence(t,e,i);if(d.error)return r({error:f(d.error),code:p(null===(o=d.error)||void 0===o?void 0:o.code),severity:n.ERROR});a(d)}catch(e){const t=p(null==e?void 0:e.code);return r({error:e.message||e,code:t,severity:n.ERROR})}finally{return d()}})({disputeId:this.disputeId,authToken:this.authToken,service:new l}),this.submitDisputeResponse=m({disputeId:this.disputeId,authToken:this.authToken,service:new l})):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:h.MISSING_PROPS,message:this.errorMessage,severity:n.ERROR}))}render(){return s(o,{key:"b90f636418c3e11b046d36dee9accf345756b407"},s("justifi-dispute-response-core",{key:"ff6e510faad54506eda24b1d8dc94b67afc18014","onError-event":this.handleErrorEvent,"dispute-id":this.disputeId,disputeResponse:this.disputeResponse,createDisputeEvidence:this.createDisputeEvidence,updateDisputeResponse:this.updateDisputeResponse,submitDisputeResponse:this.submitDisputeResponse}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}},j=class{constructor(i){e(this,i),this.clickEvent=t(this,"click-event"),this.errorEvent=t(this,"error-event"),this.stepCompleteEvent=t(this,"complete-form-step-event"),this.submitEvent=t(this,"submit-event"),this.disputeResponse={},this.isLoading=!1,this.documentList=[],this.documentErrors={},this.currentStep=0,this.componentStepMapping=[()=>s("justifi-product-or-service",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-customer-details",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-cancellation-policy",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-refund-policy",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-duplicate-charge",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-electronic-evidence",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-shipping-details",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors}),()=>s("justifi-additional-statement",{ref:e=>this.currentStepComponentRef=e,disputeResponse:this.disputeResponse,documentErrors:this.documentErrors})],this.saveData=async(e,t)=>{if(Object.keys(e).length)return this.isLastStep?this.submitDisputeResponse({payload:e,onSuccess:e=>{this.submitEvent.emit({response:e}),this.stepCompleteEvent.emit({response:e,formStep:t})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}}):this.updateDisputeResponse({payload:e,onSuccess:e=>{this.disputeResponse=Object.assign({},e.data),this.stepCompleteEvent.emit({response:e,formStep:t})},onError:({error:e,code:t,severity:s})=>{this.errorEvent.emit({errorCode:t,message:e,severity:s})}});this.stepCompleteEvent.emit({response:null,formStep:t})},this.initializeMakePresignedURLs=async()=>{const e=this.documentList.map((e=>this.getPresignedFileUrl(e)));return await Promise.all(e)},this.initializeFileUploads=async()=>{const e=this.documentList.map((e=>this.uploadDocument(e)));return Promise.all(e)},this.getPresignedFileUrl=async e=>this.createDisputeEvidence({payload:{file_name:e.file_name,file_type:e.file_type,dispute_evidence_type:e.dispute_evidence_type},onSuccess:t=>{e.presignedUrl=t.data.presigned_url},onError:({error:t,code:s,severity:i})=>{const a={[e.dispute_evidence_type]:t};this.documentErrors=Object.assign(Object.assign({},this.documentErrors),a),this.errorEvent.emit({errorCode:s,message:t,severity:i})}}),this.uploadDocument=async e=>{const t=await e.getFileString();if(!e.presignedUrl)throw new Error("Presigned URL is not set");return await fetch(e.presignedUrl,{method:"PUT",body:t})},this.handleSubmit=async(e,t,s)=>{if(this.isLoading=!0,t.length){if(this.documentErrors={},this.documentList=t,await this.initializeMakePresignedURLs(),Object.keys(this.documentErrors).length)throw this.isLoading=!1,new Error("Could not presign all documents");await this.initializeFileUploads()}await this.saveData(e,s),this.isLoading=!1},this.onCancel=()=>{this.clickEvent.emit({name:u.cancelDispute})},this.onBack=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.previousStep}),await this.handleSubmit(e,t,s),this.currentStep--}))},this.onNext=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.nextStep}),await this.handleSubmit(e,t,s),this.currentStep++}))},this.onSubmit=async()=>{await this.currentStepComponentRef.validateAndSubmit((async(e,t,s)=>{this.clickEvent.emit({name:u.submit});const i=Object.assign(Object.assign({},e),{forfeit:!1});await this.handleSubmit(i,t,s)}))}}get currentStepComponent(){return this.componentStepMapping[this.currentStep]()}get isLastStep(){return this.currentStep===this.componentStepMapping.length-1}get isFirstStep(){return 0===this.currentStep}render(){return s("div",{key:"09b09843d54a2dbced9788d16e244b2e59a3a78f",class:"row gy-3"},s("div",{key:"6a3fe32d65ea1a74161d9ba9984543cf950e47ea",class:"col-12"},s("h1",{key:"bbb6f1334fd6b120e592117ba191d90b628e620f",class:"h4",part:r},"Counter dispute")),s("div",{key:"19cbc45842294e9344dbffb725f5f053bf370af7",class:"col-12"},this.currentStepComponent),s("div",{key:"fa875ca152ea77fc4c8363216d8ba16c7699b597",class:"col-12"},s("div",{key:"fa7b62fff0cbac81c19ebad919f5dd54c3679e84",class:"d-flex gap-2 mt-4 justify-content-end"},this.isFirstStep?s(d,{variant:"secondary",onClick:()=>this.onCancel(),disabled:this.isLoading,isLoading:this.isLoading},"Cancel"):s(d,{variant:"secondary",onClick:()=>this.onBack(),disabled:this.isLoading,isLoading:this.isLoading},"Back"),this.isLastStep?s(d,{variant:"primary",onClick:()=>this.onSubmit(),disabled:this.isLoading,isLoading:this.isLoading},"Submit Counter Dispute"):s(d,{variant:"primary",onClick:()=>this.onNext(),disabled:this.isLoading,isLoading:this.isLoading},"Next"))))}};export{v as justifi_dispute_notification,k as justifi_dispute_response,j as justifi_dispute_response_core}
@@ -1 +1 @@
1
- import{r as s,c as i,h as t}from"./p-Bn7inNWG.js";import{E as r}from"./p-DNo0OPOP.js";import{B as o}from"./p-0mMX1Zv4.js";import{m as p}from"./p-DH8F0bsw.js";import{C as e,a as m}from"./p-Cjcsf8ku.js";import{c as n,J as h}from"./p-CxqAv6yr.js";import"./p-RvUQ__Pq.js";import"./p-BPtcGAzB.js";import"./p-DhGNCW2f.js";import"./p-CpaS1Lex.js";import"./p-zdIeCUeh.js";import"./p-HXpYMWUU.js";import"./p-BP7op0vq.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-D2muobcE.js";import"./p-VsM6ERNV.js";const a=class{constructor(t){s(this,t),this.errorEvent=i(this,"error-event"),this.errorMessage=null,this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)}}componentWillLoad(){n(),this.analytics=new h(this),this.initializeGetBusiness()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}initializeGetBusiness(){if(!this.businessId||!this.authToken)return this.errorMessage="Invalid business id or auth token",void this.errorEvent.emit({errorCode:m.MISSING_PROPS,message:this.errorMessage,severity:e.ERROR});this.getBusiness=p({id:this.businessId,authToken:this.authToken,service:new o})}render(){return this.errorMessage?r(this.errorMessage):t("business-details-core",{getBusiness:this.getBusiness,"onError-event":this.handleErrorEvent})}};export{a as justifi_business_details}
1
+ import{r as s,c as i,h as t}from"./p-Bn7inNWG.js";import{E as r}from"./p-DNo0OPOP.js";import{B as o}from"./p-0mMX1Zv4.js";import{m as p}from"./p-DH8F0bsw.js";import{C as e,a as m}from"./p-Cjcsf8ku.js";import{c as n,J as h}from"./p-tkZEz3MG.js";import"./p-RvUQ__Pq.js";import"./p-BPtcGAzB.js";import"./p-DhGNCW2f.js";import"./p-CpaS1Lex.js";import"./p-zdIeCUeh.js";import"./p-HXpYMWUU.js";import"./p-BP7op0vq.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-D2muobcE.js";import"./p-D51QuD44.js";const a=class{constructor(t){s(this,t),this.errorEvent=i(this,"error-event"),this.errorMessage=null,this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)}}componentWillLoad(){n(),this.analytics=new h(this),this.initializeGetBusiness()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}initializeGetBusiness(){if(!this.businessId||!this.authToken)return this.errorMessage="Invalid business id or auth token",void this.errorEvent.emit({errorCode:m.MISSING_PROPS,message:this.errorMessage,severity:e.ERROR});this.getBusiness=p({id:this.businessId,authToken:this.authToken,service:new o})}render(){return this.errorMessage?r(this.errorMessage):t("business-details-core",{getBusiness:this.getBusiness,"onError-event":this.handleErrorEvent})}};export{a as justifi_business_details}
@@ -0,0 +1 @@
1
+ import{r as t,h as e,c as i,H as s,g as a}from"./p-Bn7inNWG.js";import{z as n,r as o}from"./p-RvUQ__Pq.js";import{f as r}from"./p-zdIeCUeh.js";import{c as h,P as l,o as c,a as d,b as u}from"./p-C6c6Q0E7.js";import{S as y}from"./p-DxqCFDtF.js";import"./p-CZfYo5-1.js";import{H as m}from"./p-DIDloHpm.js";import{H as p,b as M,h as v,i as g}from"./p-B71k50jz.js";import{H as f}from"./p-BSt6p1oq.js";import{J as k,c as j}from"./p-tkZEz3MG.js";import"./p-DhGNCW2f.js";import"./p-HXpYMWUU.js";import{C as b,a as T,b as N}from"./p-Cjcsf8ku.js";import{I as w}from"./p-BP7op0vq.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{g as D,a as I}from"./p-D2muobcE.js";import{C}from"./p-B8iBcmNu.js";import{A}from"./p-BPtcGAzB.js";import{C as E}from"./p-ZpPDShvP.js";import"./p-CpaS1Lex.js";import"./p-D51QuD44.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";const x=class{constructor(e){t(this,e)}render(){return e(y,{key:"db0b903a05629cd6197bb14336fd91881373cbf1"},e("section",{key:"2e1213c4be75677a98fdf98de077201ebff1d3a6"},e("div",{key:"26c3bfc8672511dd5af823426e69b6c0d28dd274"},e("div",{key:"8c9a282d63903b66cf3f93e316bd56f245b9bc1f",part:n},null==h?void 0:h.paymentDescription),e("div",{key:"0729b8adef6ae7bb7a536ad4b5443ed24608ce56"},e("span",{key:"863ee5dc8a0c662a8074a69d388081ec9fc3fb89",part:n},"Total")," ",e("span",{key:"05bf10634b2a166c6b5720beaf0ab76accb8befe",part:n},r(+(null==h?void 0:h.totalAmount)))))))}},P=class{constructor(e){t(this,e),this.levels={h1:m,h2:p,h3:f},this.level="h1"}render(){return e(y,{key:"002dfd5dd8fa47304d9e468e28bdbeb56723913b"},e(this.levels[this.level],{key:"63110d45f87268510cc309d8081f191ef8d4cd8b",text:this.text,class:this.class}))}},z=class{constructor(e){t(this,e),this.errorEvent=i(this,"error-event"),this.submitEvent=i(this,"submit-event"),this.paymentMethodChangedEvent=i(this,"payment-method-changed"),this.savePaymentMethod=!1,this.handleApplePayCompleted=t=>{const{success:e,token:i,paymentMethodId:s,error:a}=t.detail;e&&i?(h.paymentToken=s,h.selectedPaymentMethod=l.APPLE_PAY,this.submitCheckout()):(console.error("Apple Pay completed but failed:",a),this.errorEvent.emit({message:(null==a?void 0:a.message)||"Apple Pay payment failed",errorCode:T.TOKENIZE_ERROR,severity:b.ERROR}))},this.handleApplePayError=t=>{const{error:e}=t.detail;console.error("Apple Pay error:",e),this.errorEvent.emit({message:e||"Apple Pay error occurred",errorCode:T.TOKENIZE_ERROR,severity:b.ERROR})},this.handleApplePayCancelled=()=>{h.paymentToken=void 0,h.selectedPaymentMethod=void 0}}savePaymentMethodChanged(t){h.savePaymentMethod=t}connectedCallback(){this.observer=new MutationObserver((()=>{this.queryFormRefs(),this.setupApplePayListeners()})),this.observer.observe(this.hostEl,{childList:!0,subtree:!0}),h.checkoutId=this.checkoutId;const t={authToken:this.authToken,checkoutId:this.checkoutId,service:new C};this.getCheckout=(({authToken:t,checkoutId:e,service:i})=>async({onSuccess:s,onError:a})=>{var n;try{const o=await i.fetchCheckout(t,e);if(o.error)return a({error:I(o.error),code:D(null===(n=o.error)||void 0===n?void 0:n.code),severity:b.ERROR});s({checkout:o.data})}catch(t){const e=D(null==t?void 0:t.code);return a({error:t.message||t,code:e,severity:b.ERROR})}})(t),this.completeCheckout=(({authToken:t,checkoutId:e,service:i})=>async({payment:s,onSuccess:a,onError:n})=>{var o;try{const r=await i.complete(t,e,s);if(r.error)return n({error:I(r.error),code:D(null===(o=r.error)||void 0===o?void 0:o.code),severity:b.ERROR});a({checkout:r.data})}catch(t){const e=D(null==t?void 0:t.code);return n({error:t.message||t,code:e,severity:b.ERROR})}})(t),c("selectedPaymentMethod",(t=>{this.paymentMethodChangedEvent.emit(t)}))}componentWillLoad(){this.analytics=new k(this),j(),h.authToken=this.authToken,h.savePaymentMethod=this.savePaymentMethod,this.fetchCheckout(),M("set",(t=>{const e=g[t];void 0!==e&&v(t,e)&&this.fetchCheckout()}))}componentDidLoad(){this.queryFormRefs(),this.setupApplePayListeners()}disconnectedCallback(){var t;null===(t=this.observer)||void 0===t||t.disconnect(),this.removeApplePayListeners()}fetchCheckout(){this.authToken&&this.checkoutId?this.getCheckout&&this.getCheckout({onSuccess:({checkout:t})=>{t.status!==w.completed?t.status!==w.expired?this.updateStore(t):this.errorEvent.emit({message:N.CHECKOUT_EXPIRED,errorCode:T.CHECKOUT_EXPIRED,severity:b.ERROR}):this.errorEvent.emit({message:N.CHECKOUT_ALREADY_COMPLETED,errorCode:T.CHECKOUT_ALREADY_COMPLETED,severity:b.ERROR})},onError:t=>{this.errorEvent.emit({message:t.message,errorCode:T.FETCH_ERROR,severity:b.ERROR})}}):this.errorEvent.emit({message:N.NOT_AUTHENTICATED,errorCode:T.NOT_AUTHENTICATED,severity:b.ERROR})}updateStore(t){var e,i,s,a,n;h.accountId=t.account_id,h.paymentMethods=t.payment_methods,h.paymentMethodGroupId=t.payment_method_group_id,h.paymentDescription=t.payment_description,h.totalAmount=t.total_amount,h.paymentAmount=t.payment_amount,h.bnplEnabled=t.payment_settings.bnpl_payments,h.insuranceEnabled=t.payment_settings.insurance_payments,h.bankAccountVerification=null===(e=t.payment_settings)||void 0===e?void 0:e.bank_account_verification,h.bnplProviderClientId=null===(i=null==t?void 0:t.bnpl)||void 0===i?void 0:i.provider_client_id,h.bnplProviderMode=null===(s=null==t?void 0:t.bnpl)||void 0===s?void 0:s.provider_mode,h.bnplProviderApiVersion=null===(a=null==t?void 0:t.bnpl)||void 0===a?void 0:a.provider_api_version,h.bnplProviderCheckoutUrl=null===(n=null==t?void 0:t.bnpl)||void 0===n?void 0:n.provider_checkout_url}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.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))}async tokenizePaymentMethod(t){var e,i,s;const a=null!==(i=await(null===(e=this.billingFormRef)||void 0===e?void 0:e.getValues()))&&void 0!==i?i:{},n=Object.assign(Object.assign({},t),a),o=Object.assign({accountId:h.accountId,payment_method_group_id:void 0},n);h.savePaymentMethod&&(o.payment_method_group_id=h.paymentMethodGroupId);const r=await(null===(s=this.paymentMethodFormRef)||void 0===s?void 0:s.tokenize({clientId:this.authToken,paymentMethodMetadata:o,account:h.accountId}));return r.error?r:(h.paymentToken=r.id,r.id)}async validate(){const t=[];if(h.insuranceEnabled&&this.insuranceFormRef&&t.push(this.insuranceFormRef.validate()),h.selectedPaymentMethod!==l.NEW_CARD&&h.selectedPaymentMethod!==l.NEW_BANK_ACCOUNT||(this.paymentMethodFormRef&&t.push(this.paymentMethodFormRef.validate()),this.billingFormRef&&t.push(this.billingFormRef.validate())),0===t.length)return!0;try{return!!(await Promise.all(t)).every((t=>"boolean"==typeof t?t:!1!==(null==t?void 0:t.isValid)))||(this.errorEvent.emit({message:"Validation error",errorCode:T.VALIDATION_ERROR,severity:b.ERROR}),!1)}catch(t){return!1}}async submitCheckout(t){const e=await this.validate();if(h.selectedPaymentMethod===l.NEW_CARD||h.selectedPaymentMethod===l.NEW_BANK_ACCOUNT){const e=await this.tokenizePaymentMethod(t);if(e.error)return void this.errorEvent.emit({message:e.error.message,errorCode:T.TOKENIZE_ERROR,severity:b.ERROR})}if(!e)return void this.errorEvent.emit({message:"Please fill in all required fields.",errorCode:T.VALIDATION_ERROR,severity:b.ERROR});let i;h.paymentToken||this.errorEvent.emit({message:"Payment token not found.",errorCode:T.TOKENIZE_ERROR,severity:b.ERROR}),i={payment_mode:{[l.NEW_CARD]:d.ECOM,[l.NEW_BANK_ACCOUNT]:d.ECOM,[l.SAVED_BANK_ACCOUNT]:d.ECOM,[l.SAVED_CARD]:d.ECOM,[l.SEZZLE]:d.BNPL,[l.PLAID]:d.ECOM,[l.APPLE_PAY]:d.APPLE_PAY}[h.selectedPaymentMethod],payment_token:h.paymentToken},this.completeCheckout({payment:i,onSuccess:({checkout:t})=>{this.submitEvent.emit({checkout:t,message:"Checkout completed successfully"})},onError:t=>{this.errorEvent.emit({message:t.message,errorCode:T.COMPLETE_CHECKOUT_ERROR,severity:b.ERROR})}})}render(){return e(s,{key:"7c698fd98c705a66564b649d3488239ca51c6165"})}get hostEl(){return a(this)}static get watchers(){return{savePaymentMethod:["savePaymentMethodChanged"]}}},L=A();class O{async getLinkToken(t,e,i,s){return L.post({endpoint:`plaid/${e}/link`,body:{checkout_id:i},authToken:t,signal:s})}async tokenizeBankAccount(t,e,i,s,a,n){const o=`plaid/${e}/tokenize`,r={public_token:i};return s&&(r.link_token_id=s),a&&(r.payment_method_group_id=a),L.post({endpoint:o,body:r,authToken:t,signal:n})}}var S;!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"}(S||(S={}));const _={[S.PLAID_SDK_LOAD_FAILED]:"Unable to load Plaid. Please refresh the page and try again.",[S.PLAID_LINK_INIT_FAILED]:"Unable to initialize bank connection. Please try again.",[S.PLAID_LINK_TOKEN_FAILED]:"Unable to connect to bank service. Please try again.",[S.PLAID_AUTHENTICATION_FAILED]:"Bank authentication failed. Please try again.",[S.PLAID_BANK_NOT_SUPPORTED]:"Your bank is not currently supported. Please try a different payment method.",[S.PLAID_TOKEN_EXPIRED]:"Your bank session has expired. Please reconnect your account.",[S.PLAID_NETWORK_ERROR]:"Network connection issue. Please check your internet connection and try again.",[S.PLAID_USER_CANCELLED]:"Bank connection was cancelled. Click to try again.",[S.PLAID_TIMEOUT]:"Bank connection timed out. Please try again.",[S.PLAID_INVALID_CREDENTIALS]:"Invalid bank credentials. Please check your username and password.",[S.PLAID_ACCOUNT_LOCKED]:"Your bank account is temporarily locked. Please contact your bank.",[S.PLAID_MAINTENANCE]:"Bank service is temporarily unavailable. Please try again later.",[S.PLAID_RATE_LIMITED]:"Too many connection attempts. Please wait a moment and try again."},R={[S.PLAID_SDK_LOAD_FAILED]:b.ERROR,[S.PLAID_LINK_INIT_FAILED]:b.ERROR,[S.PLAID_LINK_TOKEN_FAILED]:b.ERROR,[S.PLAID_AUTHENTICATION_FAILED]:b.ERROR,[S.PLAID_BANK_NOT_SUPPORTED]:b.WARNING,[S.PLAID_TOKEN_EXPIRED]:b.WARNING,[S.PLAID_NETWORK_ERROR]:b.WARNING,[S.PLAID_USER_CANCELLED]:b.INFO,[S.PLAID_TIMEOUT]:b.WARNING,[S.PLAID_INVALID_CREDENTIALS]:b.ERROR,[S.PLAID_ACCOUNT_LOCKED]:b.ERROR,[S.PLAID_MAINTENANCE]:b.WARNING,[S.PLAID_RATE_LIMITED]:b.WARNING},U=class{constructor(e){t(this,e),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 O,this.maxRetries=3,this.retryDelay=2e3,this.timeoutId=null,this.abortController=null,this.hasLoggedDisabledWarning=!1,this.waitForStoreAndInitialize=()=>{h.authToken&&h.accountId&&h.checkoutId?this.initializePlaidLink():setTimeout((()=>{this.waitForStoreAndInitialize()}),100)},this.onPaymentMethodOptionClick=t=>{if(t.preventDefault(),this.isSelected=!0,h.selectedPaymentMethod=l.PLAID,this.paymentMethodOptionSelected.emit(l.PLAID),this.error)return this.clearError(),void this.waitForStoreAndInitialize();!this.plaidLink||this.publicToken||this.isAuthenticating||this.openPlaidLink()},this.initializePlaidLink=async()=>{try{if(void 0===window.Plaid)return void this.handleError({code:S.PLAID_SDK_LOAD_FAILED,message:_[S.PLAID_SDK_LOAD_FAILED],severity:R[S.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"});if(await this.getLinkToken(),!this.linkToken)return void this.handleError({code:S.PLAID_LINK_TOKEN_FAILED,message:_[S.PLAID_LINK_TOKEN_FAILED],severity:R[S.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:S.PLAID_LINK_INIT_FAILED,message:_[S.PLAID_LINK_INIT_FAILED],severity:R[S.PLAID_LINK_INIT_FAILED],originalError:t,retryable:!0,userAction:"Click to try again"})}},this.getLinkToken=async()=>{var t,e,i,s,a;try{if(!h.authToken||!h.accountId)return void this.handleError({code:S.PLAID_LINK_TOKEN_FAILED,message:"Missing authentication. Please refresh the page and try again.",severity:b.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(h.authToken,h.accountId,h.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}catch(t){this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null);let n=S.PLAID_LINK_TOKEN_FAILED,o=_[n],r=!0;"AbortError"===t.name?(n=S.PLAID_TIMEOUT,o=_[n],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"))?(n=S.PLAID_NETWORK_ERROR,o=_[n],r=!0):((null===(s=t.message)||void 0===s?void 0:s.includes("401"))||(null===(a=t.message)||void 0===a?void 0:a.includes("unauthorized")))&&(n=S.PLAID_INVALID_CREDENTIALS,o="Authentication failed. Please refresh the page and try again.",r=!1),this.handleError({code:n,message:o,severity:R[n],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 S.PLAID_RATE_LIMITED;if(t.includes("maintenance"))return S.PLAID_MAINTENANCE;if(t.includes("not_authenticated"))return S.PLAID_INVALID_CREDENTIALS}if(null==t?void 0:t.code)switch(t.code){case"rate_limited":return S.PLAID_RATE_LIMITED;case"maintenance":return S.PLAID_MAINTENANCE;case"not_authenticated":return S.PLAID_INVALID_CREDENTIALS;default:return S.PLAID_LINK_TOKEN_FAILED}return S.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,h.selectedPaymentMethod=l.PLAID),this.plaidErrorRecovered.emit({code:"plaid-success",message:"Bank account connected successfully",severity:b.INFO}),this.exchangePublicTokenForPaymentMethod()},this.exchangePublicTokenForPaymentMethod=async()=>{var t;if(this.publicToken)if(h.authToken&&h.accountId)try{const e=await this.plaidService.tokenizeBankAccount(h.authToken,h.accountId,this.publicToken,this.linkTokenId||void 0,h.savePaymentMethod?h.paymentMethodGroupId:void 0);if(null==e?void 0:e.error)return void console.error("[PlaidPaymentMethod] exchange: backend error",e.error);const i=null==e?void 0:e.data,s=(null===(t=null==i?void 0:i.bank_account)||void 0===t?void 0:t.token)||(null==i?void 0:i.token)||(null==i?void 0:i.id);if(!s)return void console.error("[PlaidPaymentMethod] exchange: no token in response");h.paymentToken=s}catch(t){console.error("[PlaidPaymentMethod] exchange: exception",{message:(null==t?void 0:t.message)||String(t)})}else console.error("[PlaidPaymentMethod] exchange: missing auth/account context");else console.error("[PlaidPaymentMethod] exchange: missing publicToken")},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=S.PLAID_AUTHENTICATION_FAILED,i=_[e],s=!0,a="Click to try again";if(t.error_code)switch(t.error_code){case"INVALID_CREDENTIALS":e=S.PLAID_INVALID_CREDENTIALS,i=_[e],s=!0;break;case"ITEM_LOGIN_REQUIRED":e=S.PLAID_INVALID_CREDENTIALS,i="Your bank requires re-authentication. Please try again.",s=!0;break;case"ITEM_LOCKED":e=S.PLAID_ACCOUNT_LOCKED,i=_[e],s=!1,a="Contact your bank";break;case"INSTITUTION_NOT_RESPONDING":e=S.PLAID_MAINTENANCE,i=_[e],s=!0;break;case"RATE_LIMIT_EXCEEDED":e=S.PLAID_RATE_LIMITED,i=_[e],s=!0;break;case"INVALID_REQUEST":e=S.PLAID_AUTHENTICATION_FAILED,i="Invalid request. Please try again.",s=!0;break;case"PLAID_ERROR":e=S.PLAID_AUTHENTICATION_FAILED,i=t.error_message||"Bank authentication failed. Please try again.",s=!0;break;default:t.error_message&&(i=t.error_message)}if(t.error_message){const n=t.error_message.toLowerCase();n.includes("not supported")||n.includes("unsupported")?(e=S.PLAID_BANK_NOT_SUPPORTED,i=_[e],s=!1,a="Try a different payment method"):(n.includes("expired")||n.includes("timeout"))&&(e=S.PLAID_TOKEN_EXPIRED,i=_[e],s=!0)}this.handleError({code:e,message:i,severity:R[e],originalError:t,retryable:s,userAction:a}),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=()=>{const t=h.selectedPaymentMethod===l.PLAID;this.isSelected!==t&&(this.isSelected=t)}}onSelectionChange(t){t&&h.selectedPaymentMethod!==l.PLAID&&(h.selectedPaymentMethod=l.PLAID)}componentDidRender(){this.scriptRef&&(this.scriptRef.onload=()=>{this.waitForStoreAndInitialize()},this.scriptRef.onerror=()=>{this.handleError({code:S.PLAID_SDK_LOAD_FAILED,message:_[S.PLAID_SDK_LOAD_FAILED],severity:R[S.PLAID_SDK_LOAD_FAILED],retryable:!0,userAction:"Refresh the page and try again"})})}componentWillLoad(){this.isSelected=h.selectedPaymentMethod===l.PLAID}async resolvePaymentMethod(){return this.publicToken?{token:this.publicToken,data:{type:"bank_account",plaid_public_token:this.publicToken}}:{validationError:!0}}async getPaymentToken(){return h.paymentToken||await this.exchangePublicTokenForPaymentMethod(),h.paymentToken}async setSelected(t){this.isSelected=t,t&&(h.selectedPaymentMethod=l.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=c("selectedPaymentMethod",this.syncWithStore);this.unsubscribeFromStore=t}disconnectedCallback(){this.unsubscribeFromStore&&this.unsubscribeFromStore(),this.timeoutId&&clearTimeout(this.timeoutId),this.abortController&&this.abortController.abort()}render(){if(!0!==h.bankAccountVerification)return this.hasLoggedDisabledWarning||(console.warn("[PlaidPaymentMethod] bank_account_verification is disabled. Component will not render."),this.hasLoggedDisabledWarning=!0),null;const t=e("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 e(y,{class:"payment-method"},e("script",{src:"https://cdn.plaid.com/link/v2/stable/link-initialize.js",async:!0,ref:t=>this.scriptRef=t}),e("div",{class:"radio-list-item p-3",part:o,onClick:this.onPaymentMethodOptionClick,title:"Pay with Plaid"},e("form-control-radio",{name:"paymentMethodType",value:l.PLAID,checked:this.isSelected,label:e("div",null,e("div",null,"Pay with Bank Account ",t," "),(()=>this.error?e("div",{class:(this.error.severity===b.ERROR?"text-danger":this.error.severity===b.WARNING?"text-warning":"text-info")+" mt-2"},e("small",null,this.error.message),e("br",null),e("small",{class:"text-muted"},this.error.userAction,this.error.retryable&&this.retryCount<this.maxRetries&&e("span",null," • Auto-retry in progress..."))):null)(),(()=>this.error?null:this.isAuthenticating?e("div",{class:"text-info mt-2"},e("small",null,"Connecting to your bank...")):this.publicToken?e("div",{class:"text-success mt-2"},e("small",null,"✓ Bank account connected successfully")):!this.isSelected||this.publicToken||this.error||this.isAuthenticating?null:e("div",{class:"text-muted mt-2"},e("small",null,"Click to connect your bank account")))())})))}static get watchers(){return{isSelected:["onSelectionChange"]}}},B=class{constructor(e){t(this,e),this.onPaymentMethodOptionClick=t=>e=>{e.preventDefault(),h.selectedPaymentMethod={[u.CARD]:l.SAVED_CARD,[u.BANK_ACCOUNT]:l.SAVED_BANK_ACCOUNT}[t.type],h.paymentToken=t.id},this.isAllowedPaymentMethod=t=>!(t.type===u.CARD&&h.disableCreditCard||t.type===u.BANK_ACCOUNT&&h.disableBankAccount)}componentWillLoad(){h.paymentMethods.length||console.warn("No saved payment methods available."),h.disablePaymentMethodGroup&&console.warn("Payment method group is disabled.")}render(){return h.disablePaymentMethodGroup?null:e(y,null,e("div",{class:"saved-payment-methods"},h.paymentMethods.length?h.paymentMethods.filter(this.isAllowedPaymentMethod).map((t=>e("div",{class:"radio-list-item p-3",part:o,onClick:this.onPaymentMethodOptionClick(t)},e("form-control-radio",{name:"paymentMethodType",value:null==t?void 0:t.id,checked:h.paymentToken===(null==t?void 0:t.id),label:`${E[null==t?void 0:t.brand]||""} *${null==t?void 0:t.acct_last_four}`})))):null))}},Q=e("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"}}),Y=class{constructor(e){t(this,e),this.paymentMethodOptionSelected=i(this,"paymentMethodOptionSelected"),this.paymentMethodOptionId=l.SEZZLE,this.onPaymentMethodOptionClick=t=>{t.preventDefault(),h.selectedPaymentMethod=this.paymentMethodOptionId,this.paymentMethodOptionSelected.emit(this.paymentMethodOptionId)},this.initializeSezzleCheckout=()=>{let t;this.sezzlePromise=new Promise((e=>{t=e}));const e=Number(h.paymentAmount),i=new(0,window.Checkout)({mode:"popup",publicKey:h.bnplProviderClientId,apiMode:h.bnplProviderMode,apiVersion:h.bnplProviderApiVersion});i.sezzleButtonElement=this.sezzleButtonRef,i.init({onClick:function(t){t.preventDefault(),i.startCheckout({checkout_url:h.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}}render(){var t,i;return!h.bnplEnabled||h.disableBnpl?(console.warn("justifi-sezzle-payment-method: BNPL is not enabled for this account."),null):e(y,{class:"payment-method"},e("script",{src:"https://checkout-sdk.sezzle.com/checkout.min.js",async:!0,ref:t=>this.scriptRef=t}),e("div",{class:"radio-list-item p-3",part:o,onClick:this.onPaymentMethodOptionClick},e("form-control-radio",{name:"paymentMethodType",value:this.paymentMethodOptionId,checked:h.selectedPaymentMethod===l.SEZZLE,label:e("div",null,e("div",null,"Buy now, pay later with ",Q),this.installmentPlan&&e("small",null,e("span",null,null===(t=this.installmentPlan)||void 0===t?void 0:t.installments.length)," ",e("span",null,this.installmentPlan.schedule," payments of")," ",e("span",{class:"fw-bold"},r(null===(i=this.installmentPlan)||void 0===i?void 0:i.installments[0].amountInCents))))})))}},F={[l.NEW_BANK_ACCOUNT]:"New bank account",[l.NEW_CARD]:"New credit or debit card"},H="Payment form not ready",V="Validation error",W=class{constructor(e){t(this,e),this.errorEvent=i(this,"error-event"),this.submitEvent=i(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(){j(),this.analytics=new k(this)}handleRadioClick(t){this.selectedPaymentMethod=t.detail,h.selectedPaymentMethod=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:T.TOKENIZE_ERROR,message:V}),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(T.TOKENIZE_ERROR,t.message);return this.emitError({errorCode:T.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:H}};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||h.authToken,account:this.accountId||h.accountId,paymentMethodMetadata:this.buildPaymentMethodMetadata(t)};return await this.paymentMethodFormRef.tokenize(e)}catch(t){return t}}validateRequiredProps(){this.authToken||h.authToken||this.emitError({errorCode:T.TOKENIZE_ERROR,message:"Auth token is required when using the tokenize-payment-method component not slotted in justifi-modular-checkout"}),this.accountId||h.accountId||this.emitError({errorCode:T.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=l.NEW_BANK_ACCOUNT,h.selectedPaymentMethod=l.NEW_BANK_ACCOUNT):(this.selectedPaymentMethod=l.NEW_CARD,h.selectedPaymentMethod=l.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(l.NEW_CARD),this.disableBankAccount||t.push(l.NEW_BANK_ACCOUNT),t}areFormsReady(){return!(!this.billingFormRef||!this.paymentMethodFormRef)}emitError(t){this.errorEvent.emit(Object.assign(Object.assign({},t),{severity:b.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",H);try{const e=await this.validate();if(!e.isValid||!t.isValid){const t=Object.values(e.errors)[0]||V;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||h.paymentMethodGroupId}get shouldSavePaymentMethod(){return!(!this.paymentMethodGroupId&&!h.savePaymentMethod)}get shouldHideRadioInput(){return this.disableCreditCard||this.disableBankAccount}renderPaymentMethodOption(t){const i=this.selectedPaymentMethod===t;return e("div",{class:"payment-method"},e("justifi-radio-list-item",{name:"paymentMethodType",value:t,checked:i,label:F[t],hidden:this.shouldHideRadioInput}),i&&this.renderSelectedPaymentMethodForm(t))}renderSelectedPaymentMethodForm(t){return e("div",{class:"mt-4 pb-4"},this.renderPaymentMethodForm(t),e("div",{class:"mt-4"},e("justifi-billing-form",{ref:t=>this.billingFormRef=t,hideCardBillingForm:this.hideCardBillingForm,hideBankAccountBillingForm:this.hideBankAccountBillingForm,paymentMethodType:t})),e("div",{class:"mt-4"},e("justifi-save-new-payment-method",{hidden:!this.paymentMethodGroupID})))}renderPaymentMethodForm(t){return e(t===l.NEW_CARD?"justifi-card-form":"justifi-bank-account-form",{ref:t=>this.paymentMethodFormRef=t})}render(){return e(y,{key:"86f4eb7ae1ee329384e6bde2fdf1d7035a341488"},e("form",{key:"e3433176ea56ca9cbf831c9c4a8c2cfb3e41707a"},e("fieldset",{key:"c130d134bc8e5642881250586e8099e8eee7090b"},e("div",{key:"0ff386b78ce610a22ddeed10b29a170259197f10",class:"row gy-3"},e("div",{key:"020e8750dd774723083a84a4a4dc0637644ccd25",class:"col-12"},this.availablePaymentMethods.map((t=>this.renderPaymentMethodOption(t)))),e("div",{key:"b3b53bca5369986e892913a87d7f77a463706015",class:"col-12"},e("justifi-button",{key:"5f7a195926440cf5fba38b4f5781d45b6959ad6d",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 a(this)}static get watchers(){return{disableCreditCard:["paymentMethodsChanged"],disableBankAccount:["paymentMethodsChanged"]}}};export{x as justifi_checkout_summary,P as justifi_header,z as justifi_modular_checkout,U as justifi_plaid_payment_method,B as justifi_saved_payment_methods,Y as justifi_sezzle_payment_method,W as justifi_tokenize_payment_method}
@@ -1 +1 @@
1
- import{h as t,r as e,c as i}from"./p-Bn7inNWG.js";import{A as n}from"./p-BPtcGAzB.js";import{S as s}from"./p-DxqCFDtF.js";import"./p-CZfYo5-1.js";import{S as a}from"./p-CaAVuW6B.js";import{c as o,o as r}from"./p-DAED83Ew.js";import"./p-DhGNCW2f.js";import"./p-CpaS1Lex.js";import"./p-zdIeCUeh.js";import"./p-HXpYMWUU.js";import"./p-RvUQ__Pq.js";var p,c,l,h;!function(t){t.STATUS_SUCCESS="STATUS_SUCCESS",t.STATUS_FAILURE="STATUS_FAILURE"}(p||(p={})),function(t){t.PLAIN="plain",t.BUY="buy",t.SET_UP="set-up",t.DONATE="donate",t.CHECK_OUT="check-out",t.BOOK="book",t.SUBSCRIBE="subscribe"}(c||(c={})),function(t){t.BLACK="black",t.WHITE="white",t.WHITE_OUTLINE="white-outline"}(l||(l={})),function(t){t.SUPPORTS_3DS="supports3DS",t.SUPPORTS_EMV="supportsEMV",t.SUPPORTS_CREDIT="supportsCredit",t.SUPPORTS_DEBIT="supportsDebit"}(h||(h={}));class d{constructor(t){this.merchantIdentifier=t.merchantIdentifier,this.displayName=t.displayName,this.initiative=t.initiative,this.initiativeContext=t.initiativeContext,this.buttonType=t.buttonType||c.PLAIN,this.buttonStyle=t.buttonStyle||l.BLACK,this.buttonLocale=t.buttonLocale||"en-US"}get isValid(){return!!(this.merchantIdentifier&&this.displayName&&this.initiative&&this.initiativeContext)}}class u{constructor(t){this.countryCode=t.countryCode,this.currencyCode=t.currencyCode,this.merchantCapabilities=t.merchantCapabilities,this.supportedNetworks=t.supportedNetworks,this.total=t.total,this.lineItems=t.lineItems,this.shippingMethods=t.shippingMethods,this.applicationData=t.applicationData,this.supportedCountries=t.supportedCountries}get isValid(){var t,e,i,n;return!!(this.countryCode&&this.currencyCode&&(null===(t=this.merchantCapabilities)||void 0===t?void 0:t.length)&&(null===(e=this.supportedNetworks)||void 0===e?void 0:e.length)&&(null===(i=this.total)||void 0===i?void 0:i.label)&&(null===(n=this.total)||void 0===n?void 0:n.amount))}}class y{static isApplePaySupported(){var t;return"undefined"!=typeof window&&"ApplePaySession"in window&&(null===(t=window.ApplePaySession)||void 0===t?void 0:t.supportsVersion(3))}static canMakePayments(){var t;return this.isApplePaySupported()&&(null===(t=window.ApplePaySession)||void 0===t?void 0:t.canMakePayments())||!1}static async canMakePaymentsWithActiveCard(t){var e;if(!this.isApplePaySupported())return!1;try{return await(null===(e=window.ApplePaySession)||void 0===e?void 0:e.canMakePaymentsWithActiveCard(t))||!1}catch(t){return console.error("Error checking Apple Pay active card:",t),!1}}static formatAmount(t){return(t/100).toFixed(2)}static parseAmount(t){return Math.round(100*parseFloat(t))}static createLineItem(t,e,i="final"){return{label:t,amount:this.formatAmount(e),type:i}}static getDefaultSupportedNetworks(){return["amex","discover","masterCard","visa"]}static getDefaultMerchantCapabilities(){return[h.SUPPORTS_3DS,h.SUPPORTS_EMV,h.SUPPORTS_CREDIT,h.SUPPORTS_DEBIT]}}class b{constructor(){this.api=n()}initialize(t){if(this.applePayConfig=new d(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}})}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 y.isApplePaySupported()&&y.canMakePayments()}async canMakePaymentsWithActiveCard(){if(!this.applePayConfig)throw new Error("Apple Pay not initialized. Call initialize() first.");return await y.canMakePaymentsWithActiveCard(this.applePayConfig.merchantIdentifier)}async startPaymentSession(t,e,i){if(!this.applePayConfig)throw new Error("Apple Pay not initialized. Call initialize() first.");const n=new u(t);if(!n.isValid)throw new Error("Invalid payment request provided");return this.currentPaymentRequest=n,new Promise(((t,s)=>{try{this.currentSession=new window.ApplePaySession(3,n),this.setupSessionEventHandlers(t,s,e,i),this.currentSession.begin()}catch(t){s({success:!1,error:{code:"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 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),console.error("Error stack:",t.stack),this.currentSession.abort(),e({success:!1,error:{code:"MERCHANT_VALIDATION_ERROR",message:t instanceof Error?t.message:"Merchant validation failed"}})}},this.currentSession.onpaymentauthorized=async s=>{try{const a=s.payment,o=Object.assign(Object.assign({},a.token),{product_details:{name:this.currentPaymentRequest.total.label,price:y.parseAmount(this.currentPaymentRequest.total.amount),description:this.currentPaymentRequest.total.label}}),r=await this.processPayment(i,n,o);r.success?(this.currentSession.completePayment({status:p.STATUS_SUCCESS}),t({success:!0,token:a.token,paymentMethodId:r.data.id})):(console.error("PSP reported payment failure:",r.data),this.currentSession.completePayment({status:p.STATUS_FAILURE}),e({success:!1,error:{code:"PAYMENT_PROCESSING_ERROR",message:"Payment processing failed"}}))}catch(t){console.error("=== PAYMENT PROCESSING ERROR ==="),console.error("Error processing payment:",t),console.error("Error stack:",t.stack),this.currentSession.completePayment({status:p.STATUS_FAILURE}),e({success:!1,error:{code:"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:p.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:"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:"SESSION_ERROR",message:"Apple Pay session error occurred"}})}))}static createPaymentRequest(t,e,i="US",n="USD"){return{countryCode:i,currencyCode:n,merchantCapabilities:y.getDefaultMerchantCapabilities(),supportedNetworks:y.getDefaultSupportedNetworks(),total:y.createLineItem(e,t)}}getApplePayConfig(){return this.applePayConfig}}const f=e=>{const{isReady:i}=e;return i?null: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"}}))))},m=e=>t("div",{class:"apple-pay-button-container"},t("button",Object.assign({class:(()=>{let t="apple-pay-button";switch(e.buttonStyle){case l.WHITE:t+=" apple-pay-button-white";break;case l.WHITE_OUTLINE:t+=" apple-pay-button-white-outline";break;default:t+=" apple-pay-button-black"}switch(e.buttonType){case c.BUY:t+=" apple-pay-button-type-buy";break;case c.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||"200px",height:e.height||"48px"},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: inline-block;\n position: relative;\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 ")),v=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=c.PLAIN,this.buttonStyle=l.BLACK,this.disabled=!1,this.showSkeleton=!0,this.isLoading=!0,this.isProcessing=!1,this.isAvailable=!1,this.canMakePayments=!1,this.error=null,this.handleApplePayClick=async()=>{var t;if(!this.isProcessing&&!this.disabled&&this.isAvailable)try{this.isProcessing=!0,this.error=null,this.applePayStarted.emit();const e={countryCode:this.countryCode,currencyCode:o.paymentCurrency,merchantCapabilities:y.getDefaultMerchantCapabilities(),supportedNetworks:y.getDefaultSupportedNetworks(),total:y.createLineItem(o.paymentDescription,o.paymentAmount)},i=await this.applePayService.startPaymentSession(e,o.authToken,o.accountId);i.success?this.applePayCompleted.emit({success:!0,token:i.token,paymentMethodId:i.paymentMethodId}):(this.applePayCompleted.emit({success:!1,error:i.error}),this.applePayError.emit({error:(null===(t=i.error)||void 0===t?void 0:t.message)||"Payment failed"}))}catch(t){console.error("Apple Pay payment error:",t);const e=t instanceof Error?t.message:"Payment failed";this.error=e,this.applePayError.emit({error:e}),this.applePayCompleted.emit({success:!1,error:e})}finally{this.isProcessing=!1}}}componentWillLoad(){this.applePayService=new b,this.initializeApplePay()}componentDidLoad(){r("paymentAmount",(()=>{this.initializeApplePay()})),r("authToken",(()=>{this.initializeApplePay()}))}watchPropsChange(){this.initializeApplePay()}async initializeApplePay(){try{if(this.isLoading=!0,this.error=null,!o.paymentAmount)return this.error="Missing required Apple Pay configuration",void(this.isLoading=!1);if(this.isAvailable=y.isApplePaySupported(),this.canMakePayments=y.canMakePayments(),!this.isAvailable)return this.error="Apple Pay is not supported on this device",void(this.isLoading=!1);if(!this.canMakePayments)return this.error="Apple Pay is not available",void(this.isLoading=!1);this.applePayService.initialize({merchantIdentifier:this.merchantIdentifier,displayName:this.merchantDisplayName,initiative:"web",initiativeContext:this.initiativeContext,buttonType:this.buttonType,buttonStyle:this.buttonStyle}),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"}finally{this.isLoading=!1}}async isSupported(){return this.isAvailable&&this.canMakePayments}async getPaymentMethods(){return this.isAvailable?y.getDefaultSupportedNetworks():[]}async abort(){this.applePayService.abortPaymentSession(),this.isProcessing=!1,this.applePayCancelled.emit()}render(){const e=!this.isLoading&&this.isAvailable&&this.canMakePayments&&!this.error;return t(s,{key:"d07bd5b228a761fe021830823b410805b44c6829"},t("script",{key:"59ca72df49c6210c3122df6328e3b9798ff3440f",async:!0,src:"https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js"}),t("div",{key:"69010db6e3e59ffb1ad9d7cc5af0680934c61207",class:"apple-pay-container"},t(f,{key:"f25d2ae58d6730c9dbf9a02ac14cf5800e3ca6ed",isReady:e}),!this.isLoading&&this.error&&t("div",{key:"0460b10f967df69f04984c17b6b1641db3dfd582",class:"apple-pay-error",role:"alert"},t("span",{key:"a194317367175498c098c522cc2ee77ae0848e25",class:"error-icon"},"⚠️"),t("span",{key:"8eb5cb96fb00f2deb9b76796d09979d488f5d922",class:"error-message"},this.error)),!this.isLoading&&!this.error&&!this.isAvailable&&t("div",{key:"97fd0863a893a98b01b9886dc94a088cb87419e4",class:"apple-pay-unavailable"},t("span",{key:"fde1d32be78fc35024bea1c4f81b02a9d792b41e",class:"unavailable-message"},"Apple Pay is not available on this device")),!this.isLoading&&!this.error&&this.isAvailable&&this.canMakePayments&&t(m,{key:"1e445d7b72f378f7bac6f62e069a526f1d9ae9ba",buttonType:this.buttonType,buttonStyle:this.buttonStyle,disabled:this.disabled,isProcessing:this.isProcessing,isAvailable:this.isAvailable,clickHandler:this.handleApplePayClick})),t("style",{key:"d552fd4b0726a63ed9a242b3b2204dc6339ef590"},"\n .apple-pay-container {\n width: 100%;\n }\n\n .apple-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 .apple-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 "))}static get watchers(){return{merchantIdentifier:["watchPropsChange"],buttonType:["watchPropsChange"],buttonStyle:["watchPropsChange"],disabled:["watchPropsChange"]}}};export{v as justifi_apple_pay}
1
+ import{h as t,r as e,c as i}from"./p-Bn7inNWG.js";import{A as n}from"./p-BPtcGAzB.js";import{S as s}from"./p-DxqCFDtF.js";import"./p-CZfYo5-1.js";import{S as a}from"./p-CaAVuW6B.js";import{c as o,o as r}from"./p-C6c6Q0E7.js";import"./p-DhGNCW2f.js";import"./p-CpaS1Lex.js";import"./p-zdIeCUeh.js";import"./p-HXpYMWUU.js";import"./p-RvUQ__Pq.js";var p,c,l,h;!function(t){t.STATUS_SUCCESS="STATUS_SUCCESS",t.STATUS_FAILURE="STATUS_FAILURE"}(p||(p={})),function(t){t.PLAIN="plain",t.BUY="buy",t.SET_UP="set-up",t.DONATE="donate",t.CHECK_OUT="check-out",t.BOOK="book",t.SUBSCRIBE="subscribe"}(c||(c={})),function(t){t.BLACK="black",t.WHITE="white",t.WHITE_OUTLINE="white-outline"}(l||(l={})),function(t){t.SUPPORTS_3DS="supports3DS",t.SUPPORTS_EMV="supportsEMV",t.SUPPORTS_CREDIT="supportsCredit",t.SUPPORTS_DEBIT="supportsDebit"}(h||(h={}));class d{constructor(t){this.merchantIdentifier=t.merchantIdentifier,this.displayName=t.displayName,this.initiative=t.initiative,this.initiativeContext=t.initiativeContext,this.buttonType=t.buttonType||c.PLAIN,this.buttonStyle=t.buttonStyle||l.BLACK,this.buttonLocale=t.buttonLocale||"en-US"}get isValid(){return!!(this.merchantIdentifier&&this.displayName&&this.initiative&&this.initiativeContext)}}class u{constructor(t){this.countryCode=t.countryCode,this.currencyCode=t.currencyCode,this.merchantCapabilities=t.merchantCapabilities,this.supportedNetworks=t.supportedNetworks,this.total=t.total,this.lineItems=t.lineItems,this.shippingMethods=t.shippingMethods,this.applicationData=t.applicationData,this.supportedCountries=t.supportedCountries}get isValid(){var t,e,i,n;return!!(this.countryCode&&this.currencyCode&&(null===(t=this.merchantCapabilities)||void 0===t?void 0:t.length)&&(null===(e=this.supportedNetworks)||void 0===e?void 0:e.length)&&(null===(i=this.total)||void 0===i?void 0:i.label)&&(null===(n=this.total)||void 0===n?void 0:n.amount))}}class y{static isApplePaySupported(){var t;return"undefined"!=typeof window&&"ApplePaySession"in window&&(null===(t=window.ApplePaySession)||void 0===t?void 0:t.supportsVersion(3))}static canMakePayments(){var t;return this.isApplePaySupported()&&(null===(t=window.ApplePaySession)||void 0===t?void 0:t.canMakePayments())||!1}static async canMakePaymentsWithActiveCard(t){var e;if(!this.isApplePaySupported())return!1;try{return await(null===(e=window.ApplePaySession)||void 0===e?void 0:e.canMakePaymentsWithActiveCard(t))||!1}catch(t){return console.error("Error checking Apple Pay active card:",t),!1}}static formatAmount(t){return(t/100).toFixed(2)}static parseAmount(t){return Math.round(100*parseFloat(t))}static createLineItem(t,e,i="final"){return{label:t,amount:this.formatAmount(e),type:i}}static getDefaultSupportedNetworks(){return["amex","discover","masterCard","visa"]}static getDefaultMerchantCapabilities(){return[h.SUPPORTS_3DS,h.SUPPORTS_EMV,h.SUPPORTS_CREDIT,h.SUPPORTS_DEBIT]}}class b{constructor(){this.api=n()}initialize(t){if(this.applePayConfig=new d(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}})}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 y.isApplePaySupported()&&y.canMakePayments()}async canMakePaymentsWithActiveCard(){if(!this.applePayConfig)throw new Error("Apple Pay not initialized. Call initialize() first.");return await y.canMakePaymentsWithActiveCard(this.applePayConfig.merchantIdentifier)}async startPaymentSession(t,e,i){if(!this.applePayConfig)throw new Error("Apple Pay not initialized. Call initialize() first.");const n=new u(t);if(!n.isValid)throw new Error("Invalid payment request provided");return this.currentPaymentRequest=n,new Promise(((t,s)=>{try{this.currentSession=new window.ApplePaySession(3,n),this.setupSessionEventHandlers(t,s,e,i),this.currentSession.begin()}catch(t){s({success:!1,error:{code:"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 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),console.error("Error stack:",t.stack),this.currentSession.abort(),e({success:!1,error:{code:"MERCHANT_VALIDATION_ERROR",message:t instanceof Error?t.message:"Merchant validation failed"}})}},this.currentSession.onpaymentauthorized=async s=>{try{const a=s.payment,o=Object.assign(Object.assign({},a.token),{product_details:{name:this.currentPaymentRequest.total.label,price:y.parseAmount(this.currentPaymentRequest.total.amount),description:this.currentPaymentRequest.total.label}}),r=await this.processPayment(i,n,o);r.success?(this.currentSession.completePayment({status:p.STATUS_SUCCESS}),t({success:!0,token:a.token,paymentMethodId:r.data.id})):(console.error("PSP reported payment failure:",r.data),this.currentSession.completePayment({status:p.STATUS_FAILURE}),e({success:!1,error:{code:"PAYMENT_PROCESSING_ERROR",message:"Payment processing failed"}}))}catch(t){console.error("=== PAYMENT PROCESSING ERROR ==="),console.error("Error processing payment:",t),console.error("Error stack:",t.stack),this.currentSession.completePayment({status:p.STATUS_FAILURE}),e({success:!1,error:{code:"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:p.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:"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:"SESSION_ERROR",message:"Apple Pay session error occurred"}})}))}static createPaymentRequest(t,e,i="US",n="USD"){return{countryCode:i,currencyCode:n,merchantCapabilities:y.getDefaultMerchantCapabilities(),supportedNetworks:y.getDefaultSupportedNetworks(),total:y.createLineItem(e,t)}}getApplePayConfig(){return this.applePayConfig}}const f=e=>{const{isReady:i}=e;return i?null: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"}}))))},m=e=>t("div",{class:"apple-pay-button-container"},t("button",Object.assign({class:(()=>{let t="apple-pay-button";switch(e.buttonStyle){case l.WHITE:t+=" apple-pay-button-white";break;case l.WHITE_OUTLINE:t+=" apple-pay-button-white-outline";break;default:t+=" apple-pay-button-black"}switch(e.buttonType){case c.BUY:t+=" apple-pay-button-type-buy";break;case c.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||"200px",height:e.height||"48px"},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: inline-block;\n position: relative;\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 ")),v=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=c.PLAIN,this.buttonStyle=l.BLACK,this.disabled=!1,this.showSkeleton=!0,this.isLoading=!0,this.isProcessing=!1,this.isAvailable=!1,this.canMakePayments=!1,this.error=null,this.handleApplePayClick=async()=>{var t;if(!this.isProcessing&&!this.disabled&&this.isAvailable)try{this.isProcessing=!0,this.error=null,this.applePayStarted.emit();const e={countryCode:this.countryCode,currencyCode:o.paymentCurrency,merchantCapabilities:y.getDefaultMerchantCapabilities(),supportedNetworks:y.getDefaultSupportedNetworks(),total:y.createLineItem(o.paymentDescription,o.paymentAmount)},i=await this.applePayService.startPaymentSession(e,o.authToken,o.accountId);i.success?this.applePayCompleted.emit({success:!0,token:i.token,paymentMethodId:i.paymentMethodId}):(this.applePayCompleted.emit({success:!1,error:i.error}),this.applePayError.emit({error:(null===(t=i.error)||void 0===t?void 0:t.message)||"Payment failed"}))}catch(t){console.error("Apple Pay payment error:",t);const e=t instanceof Error?t.message:"Payment failed";this.error=e,this.applePayError.emit({error:e}),this.applePayCompleted.emit({success:!1,error:e})}finally{this.isProcessing=!1}}}componentWillLoad(){this.applePayService=new b,this.initializeApplePay()}componentDidLoad(){r("paymentAmount",(()=>{this.initializeApplePay()})),r("authToken",(()=>{this.initializeApplePay()}))}watchPropsChange(){this.initializeApplePay()}async initializeApplePay(){try{if(this.isLoading=!0,this.error=null,!o.paymentAmount)return this.error="Missing required Apple Pay configuration",void(this.isLoading=!1);if(this.isAvailable=y.isApplePaySupported(),this.canMakePayments=y.canMakePayments(),!this.isAvailable)return this.error="Apple Pay is not supported on this device",void(this.isLoading=!1);if(!this.canMakePayments)return this.error="Apple Pay is not available",void(this.isLoading=!1);this.applePayService.initialize({merchantIdentifier:this.merchantIdentifier,displayName:this.merchantDisplayName,initiative:"web",initiativeContext:this.initiativeContext,buttonType:this.buttonType,buttonStyle:this.buttonStyle}),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"}finally{this.isLoading=!1}}async isSupported(){return this.isAvailable&&this.canMakePayments}async getPaymentMethods(){return this.isAvailable?y.getDefaultSupportedNetworks():[]}async abort(){this.applePayService.abortPaymentSession(),this.isProcessing=!1,this.applePayCancelled.emit()}render(){const e=!this.isLoading&&this.isAvailable&&this.canMakePayments&&!this.error;return t(s,{key:"d07bd5b228a761fe021830823b410805b44c6829"},t("script",{key:"59ca72df49c6210c3122df6328e3b9798ff3440f",async:!0,src:"https://applepay.cdn-apple.com/jsapi/1.latest/apple-pay-sdk.js"}),t("div",{key:"69010db6e3e59ffb1ad9d7cc5af0680934c61207",class:"apple-pay-container"},t(f,{key:"f25d2ae58d6730c9dbf9a02ac14cf5800e3ca6ed",isReady:e}),!this.isLoading&&this.error&&t("div",{key:"0460b10f967df69f04984c17b6b1641db3dfd582",class:"apple-pay-error",role:"alert"},t("span",{key:"a194317367175498c098c522cc2ee77ae0848e25",class:"error-icon"},"⚠️"),t("span",{key:"8eb5cb96fb00f2deb9b76796d09979d488f5d922",class:"error-message"},this.error)),!this.isLoading&&!this.error&&!this.isAvailable&&t("div",{key:"97fd0863a893a98b01b9886dc94a088cb87419e4",class:"apple-pay-unavailable"},t("span",{key:"fde1d32be78fc35024bea1c4f81b02a9d792b41e",class:"unavailable-message"},"Apple Pay is not available on this device")),!this.isLoading&&!this.error&&this.isAvailable&&this.canMakePayments&&t(m,{key:"1e445d7b72f378f7bac6f62e069a526f1d9ae9ba",buttonType:this.buttonType,buttonStyle:this.buttonStyle,disabled:this.disabled,isProcessing:this.isProcessing,isAvailable:this.isAvailable,clickHandler:this.handleApplePayClick})),t("style",{key:"d552fd4b0726a63ed9a242b3b2204dc6339ef590"},"\n .apple-pay-container {\n width: 100%;\n }\n\n .apple-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 .apple-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 "))}static get watchers(){return{merchantIdentifier:["watchPropsChange"],buttonType:["watchPropsChange"],buttonStyle:["watchPropsChange"],disabled:["watchPropsChange"]}}};export{v as justifi_apple_pay}
@@ -1 +1 @@
1
- import{r as t,c as s,h as i}from"./p-Bn7inNWG.js";import{C as o,a as r}from"./p-Cjcsf8ku.js";import{c as e,J as p}from"./p-CxqAv6yr.js";import{P as a}from"./p-BEPUC3Po.js";import"./p-DhGNCW2f.js";import"./p-HXpYMWUU.js";import{d as n}from"./p-BP7op0vq.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{g as c,a as h}from"./p-D2muobcE.js";import{m}from"./p-DYGIC0QH.js";import{m as u,S as d}from"./p-CvG-itHC.js";import{S as j}from"./p-DxqCFDtF.js";import"./p-CZfYo5-1.js";import{d as l}from"./p-qWQmu-fb.js";import"./p-VsM6ERNV.js";import"./p-BPtcGAzB.js";import"./p-zdIeCUeh.js";import"./p-CpaS1Lex.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-C5id7s_l.js";import"./p-DDUmOl3v.js";import"./p-RvUQ__Pq.js";const v=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event"),this.errorMessage=null,this.columns=l,this.handleOnError=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){e(),this.analytics=new p(this),this.initializeGetData()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetData()}initializeGetData(){this.initializePayoutsServices(),this.initializeGetSubAccounts()}initializePayoutsServices(){if(this.accountId&&this.authToken){const t={id:this.accountId,authToken:this.authToken,service:new a};this.getPayouts=(({id:t,authToken:s,service:i})=>async({params:r,onSuccess:e,onError:p})=>{var a,m;try{const u=await i.fetchPayouts(t,s,r);if(u.error)return p({error:h(u.error),code:c(null===(m=u.error)||void 0===m?void 0:m.code),severity:o.ERROR});{const t=Object.assign({},u.page_info);e({payouts:(null===(a=u.data)||void 0===a?void 0:a.map((t=>new n(t))))||[],pagingInfo:t})}}catch(t){const s=c(null==t?void 0:t.code);return p({error:t.message||t,code:s,severity:o.ERROR})}})(t),this.getPayoutCSV=m(t)}else 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=u({accountId:this.accountId,authToken:this.authToken,service:new d}))}render(){return i(j,{key:"3634ad59f6812d546780dd367c4ccb8e886283ed"},i("payouts-list-core",{key:"3172f765100e19c25f717256e5e7ed0b139c1bc1",getPayouts:this.getPayouts,getPayoutCSV:this.getPayoutCSV,getSubAccounts:this.getSubAccounts,"onError-event":this.handleOnError,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{v as justifi_payouts_list}
1
+ import{r as t,c as s,h as i}from"./p-Bn7inNWG.js";import{C as o,a as r}from"./p-Cjcsf8ku.js";import{c as e,J as p}from"./p-tkZEz3MG.js";import{P as a}from"./p-BEPUC3Po.js";import"./p-DhGNCW2f.js";import"./p-HXpYMWUU.js";import{d as n}from"./p-BP7op0vq.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{g as c,a as h}from"./p-D2muobcE.js";import{m}from"./p-DYGIC0QH.js";import{m as u,S as d}from"./p-CvG-itHC.js";import{S as j}from"./p-DxqCFDtF.js";import"./p-CZfYo5-1.js";import{d as l}from"./p-qWQmu-fb.js";import"./p-D51QuD44.js";import"./p-BPtcGAzB.js";import"./p-zdIeCUeh.js";import"./p-CpaS1Lex.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-C5id7s_l.js";import"./p-DDUmOl3v.js";import"./p-RvUQ__Pq.js";const v=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event"),this.errorMessage=null,this.columns=l,this.handleOnError=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){e(),this.analytics=new p(this),this.initializeGetData()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetData()}initializeGetData(){this.initializePayoutsServices(),this.initializeGetSubAccounts()}initializePayoutsServices(){if(this.accountId&&this.authToken){const t={id:this.accountId,authToken:this.authToken,service:new a};this.getPayouts=(({id:t,authToken:s,service:i})=>async({params:r,onSuccess:e,onError:p})=>{var a,m;try{const u=await i.fetchPayouts(t,s,r);if(u.error)return p({error:h(u.error),code:c(null===(m=u.error)||void 0===m?void 0:m.code),severity:o.ERROR});{const t=Object.assign({},u.page_info);e({payouts:(null===(a=u.data)||void 0===a?void 0:a.map((t=>new n(t))))||[],pagingInfo:t})}}catch(t){const s=c(null==t?void 0:t.code);return p({error:t.message||t,code:s,severity:o.ERROR})}})(t),this.getPayoutCSV=m(t)}else 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=u({accountId:this.accountId,authToken:this.authToken,service:new d}))}render(){return i(j,{key:"3634ad59f6812d546780dd367c4ccb8e886283ed"},i("payouts-list-core",{key:"3172f765100e19c25f717256e5e7ed0b139c1bc1",getPayouts:this.getPayouts,getPayoutCSV:this.getPayoutCSV,getSubAccounts:this.getSubAccounts,"onError-event":this.handleOnError,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{v as justifi_payouts_list}
@@ -1 +1 @@
1
- import{r as s,c as i,h as t}from"./p-Bn7inNWG.js";import{c as o,J as e}from"./p-CxqAv6yr.js";import{C as r,a as p}from"./p-Cjcsf8ku.js";import{m as n,a}from"./p-5aA7gjr5.js";import{B as h}from"./p-0mMX1Zv4.js";import{A as m}from"./p-BPtcGAzB.js";import"./p-BP7op0vq.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import"./p-VsM6ERNV.js";import"./p-D2muobcE.js";import"./p-DhGNCW2f.js";import"./p-CpaS1Lex.js";import"./p-zdIeCUeh.js";import"./p-HXpYMWUU.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";const u=m();class d{async postProvisioning(s,i,t){return u.post({endpoint:"entities/provisioning",body:{business_id:i,product_category:t},authToken:s})}}const c=class{constructor(t){s(this,t),this.errorEvent=i(this,"error-event"),this.allowOptionalFields=!1,this.formTitle="Business Information"}propChanged(){this.initializeApi()}componentWillLoad(){o(),this.analytics=new e(this),this.initializeApi()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=n({authToken:this.authToken,businessId:this.businessId,service:new h}),this.postProvisioning=a({authToken:this.authToken,businessId:this.businessId,product:"payment",service:new d})):this.errorEvent.emit({message:"auth-token and business-id are required",errorCode:p.MISSING_PROPS,severity:r.ERROR})}render(){return t("justifi-payment-provisioning-core",{key:"6d77016584f204fdc4be5fd554b4eb1639e856ab",businessId:this.businessId,authToken:this.authToken,allowOptionalFields:this.allowOptionalFields,formTitle:this.formTitle,getBusiness:this.getBusiness,postProvisioning:this.postProvisioning})}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}};export{c as justifi_payment_provisioning}
1
+ import{r as s,c as i,h as t}from"./p-Bn7inNWG.js";import{c as o,J as e}from"./p-tkZEz3MG.js";import{C as r,a as p}from"./p-Cjcsf8ku.js";import{m as n,a}from"./p-5aA7gjr5.js";import{B as h}from"./p-0mMX1Zv4.js";import{A as m}from"./p-BPtcGAzB.js";import"./p-BP7op0vq.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import"./p-D51QuD44.js";import"./p-D2muobcE.js";import"./p-DhGNCW2f.js";import"./p-CpaS1Lex.js";import"./p-zdIeCUeh.js";import"./p-HXpYMWUU.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";const u=m();class d{async postProvisioning(s,i,t){return u.post({endpoint:"entities/provisioning",body:{business_id:i,product_category:t},authToken:s})}}const c=class{constructor(t){s(this,t),this.errorEvent=i(this,"error-event"),this.allowOptionalFields=!1,this.formTitle="Business Information"}propChanged(){this.initializeApi()}componentWillLoad(){o(),this.analytics=new e(this),this.initializeApi()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}initializeApi(){this.authToken&&this.businessId?(this.getBusiness=n({authToken:this.authToken,businessId:this.businessId,service:new h}),this.postProvisioning=a({authToken:this.authToken,businessId:this.businessId,product:"payment",service:new d})):this.errorEvent.emit({message:"auth-token and business-id are required",errorCode:p.MISSING_PROPS,severity:r.ERROR})}render(){return t("justifi-payment-provisioning-core",{key:"6d77016584f204fdc4be5fd554b4eb1639e856ab",businessId:this.businessId,authToken:this.authToken,allowOptionalFields:this.allowOptionalFields,formTitle:this.formTitle,getBusiness:this.getBusiness,postProvisioning:this.postProvisioning})}static get watchers(){return{authToken:["propChanged"],businessId:["propChanged"]}}};export{c as justifi_payment_provisioning}
@@ -1 +1 @@
1
- import{r as t,c as s,h as i}from"./p-Bn7inNWG.js";import{C as e,a as r}from"./p-Cjcsf8ku.js";import{c as o,J as p}from"./p-CxqAv6yr.js";import{D as a}from"./p-BH0Xfn-F.js";import{g as n,a as h}from"./p-D2muobcE.js";import{D as c}from"./p-D2_iJUrZ.js";import"./p-VsM6ERNV.js";import"./p-BPtcGAzB.js";import"./p-DhGNCW2f.js";import"./p-CpaS1Lex.js";import"./p-zdIeCUeh.js";import"./p-HXpYMWUU.js";import"./p-BP7op0vq.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";const m=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event"),this.errorMessage=null,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){o(),this.analytics=new p(this),this.initializeGetDispute()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetDispute()}initializeGetDispute(){this.disputeId&&this.authToken?this.getDispute=(({id:t,authToken:s,service:i})=>async({onSuccess:r,onError:o})=>{var p;try{const c=await i.fetchDispute(t,s);if(c.error)return o({error:h(c.error),code:n(null===(p=c.error)||void 0===p?void 0:p.code),severity:e.ERROR});{const t=Object.assign({},c.page_info);r({dispute:new a(c.data),pagingInfo:t})}}catch(t){const s=n(null==t?void 0:t.code);return o({error:t.message||t,code:s,severity:e.ERROR})}})({id:this.disputeId,authToken:this.authToken,service:new c}):(this.errorMessage="Dispute ID and Auth Token are required",this.errorEvent.emit({message:this.errorMessage,errorCode:r.MISSING_PROPS,severity:e.ERROR}))}render(){return i("justifi-dispute-management-core",{key:"8c800827aaa9d549a734ea05698763685e160a98",getDispute:this.getDispute,disputeId:this.disputeId,authToken:this.authToken,"onError-event":this.handleErrorEvent})}static get watchers(){return{disputeId:["propChanged"],authToken:["propChanged"]}}};export{m as justifi_dispute_management}
1
+ import{r as t,c as s,h as i}from"./p-Bn7inNWG.js";import{C as e,a as r}from"./p-Cjcsf8ku.js";import{c as o,J as p}from"./p-tkZEz3MG.js";import{D as a}from"./p-BH0Xfn-F.js";import{g as n,a as h}from"./p-D2muobcE.js";import{D as u}from"./p-D2_iJUrZ.js";import"./p-D51QuD44.js";import"./p-BPtcGAzB.js";import"./p-DhGNCW2f.js";import"./p-CpaS1Lex.js";import"./p-zdIeCUeh.js";import"./p-HXpYMWUU.js";import"./p-BP7op0vq.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";const c=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event"),this.errorMessage=null,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){o(),this.analytics=new p(this),this.initializeGetDispute()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetDispute()}initializeGetDispute(){this.disputeId&&this.authToken?this.getDispute=(({id:t,authToken:s,service:i})=>async({onSuccess:r,onError:o})=>{var p;try{const u=await i.fetchDispute(t,s);if(u.error)return o({error:h(u.error),code:n(null===(p=u.error)||void 0===p?void 0:p.code),severity:e.ERROR});{const t=Object.assign({},u.page_info);r({dispute:new a(u.data),pagingInfo:t})}}catch(t){const s=n(null==t?void 0:t.code);return o({error:t.message||t,code:s,severity:e.ERROR})}})({id:this.disputeId,authToken:this.authToken,service:new u}):(this.errorMessage="Dispute ID and Auth Token are required",this.errorEvent.emit({message:this.errorMessage,errorCode:r.MISSING_PROPS,severity:e.ERROR}))}render(){return i("justifi-dispute-management-core",{key:"8c800827aaa9d549a734ea05698763685e160a98",getDispute:this.getDispute,disputeId:this.disputeId,authToken:this.authToken,"onError-event":this.handleErrorEvent})}static get watchers(){return{disputeId:["propChanged"],authToken:["propChanged"]}}};export{c as justifi_dispute_management}
@@ -0,0 +1 @@
1
+ import{h as t,r as e,c as a}from"./p-Bn7inNWG.js";import{c as i}from"./p-DhGNCW2f.js";import"./p-HXpYMWUU.js";import{C as s,a as o}from"./p-Cjcsf8ku.js";import{g as r}from"./p-BP7op0vq.js";import{p as n}from"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{c,J as p}from"./p-tkZEz3MG.js";import{g as d,a as h}from"./p-D2muobcE.js";import{P as l}from"./p-BEPUC3Po.js";import{T as f,l as u,a as m,b,c as y,d as _,e as w,f as j,g as v,h as T,i as g,j as k,k as C}from"./p-CB0mCq1M.js";import{S as D}from"./p-DxqCFDtF.js";import{T as P}from"./p-CZfYo5-1.js";import{a as I}from"./p-zdIeCUeh.js";import{N as S,O as q}from"./p-RvUQ__Pq.js";import"./p-CpaS1Lex.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-D51QuD44.js";import"./p-BPtcGAzB.js";import"./p-BbZwa5UI.js";const B={id:()=>t("th",{part:S,scope:"col",title:"The unique identifier of each transaction"},"ID"),account_id:()=>t("th",{part:S,scope:"col",title:"The unique identifier of the account associated with each transaction"},"Account ID"),payout_id:()=>t("th",{part:S,scope:"col",title:"The unique identifier of the payout associated with each transaction"},"Payout ID"),financial_transaction_id:()=>t("th",{part:S,scope:"col",title:"The unique identifier of the financial transaction associated with the payment balance transaction"},"Financial Transaction ID"),amount:()=>t("th",{part:S,scope:"col",title:"The dollar amount of each transaction"},"Amount"),fee:()=>t("th",{part:S,scope:"col",title:"The fee associated with each transaction"},"Fee"),net:()=>t("th",{part:S,scope:"col",title:"The net amount of each transaction"},"Net"),currency:()=>t("th",{part:S,scope:"col",title:"The currency of each transaction"},"Currency"),description:()=>t("th",{part:S,scope:"col",title:"The description of each transaction"},"Description"),source_id:()=>t("th",{part:S,scope:"col",title:"The unique identifier of the source object associated with the payment balance transaction"},"Source ID"),txn_type:()=>t("th",{part:S,scope:"col",title:"The type of each transaction"},"Type"),created_at:()=>t("th",{part:S,scope:"col",title:"The date and time each transaction was made"},"Processed On"),available_on:()=>t("th",{part:S,scope:"col",title:"The date and time each transaction will be available"},"Available On"),updated_at:()=>t("th",{part:S,scope:"col",title:"The date and time each transaction was last updated"},"Updated On")},E={fee:"Fee",payment:"Payment",payout:"Payout",seller_payment_refund:"Seller Payment Refund",dispute_amount_collected:"Dispute Amount Collected",dispute_fee_collected:"Dispute Fee Collected",seller_payment:"Seller Payment",transfer:"Transfer",partner_platform_proceeds_credit:"Partner Platform Proceeds Credit"},O={id:e=>t("td",{part:q(e.id)},e.id),account_id:e=>t("td",{part:q(e.account_id)},e.account_id),payout_id:e=>t("td",{part:q(e.payout_id)},e.payout_id),financial_transaction_id:e=>t("td",{part:q(e.financial_transaction_id)},e.financial_transaction_id),amount:e=>t("td",{part:q(e.amount)},e.formattedPaymentAmount(e.amount)),fee:e=>t("td",{part:q(e.fee)},e.formattedPaymentAmount(e.fee)),net:e=>t("td",{part:q(e.net)},e.formattedPaymentAmount(e.net)),currency:e=>t("td",{part:q(e.currency)},e.currency),description:e=>t("td",{part:q(e.description)},e.description),source_id:e=>t("td",{part:q(e.source_id)},e.source_id),txn_type:e=>t("td",{part:q(e.txn_type)},E[e.txn_type]),created_at:e=>t("td",{part:q(e.created_at)},t("div",{class:"fw-bold"},I(e.created_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},I(e.created_at,{showTime:!0}))),available_on:e=>t("td",{part:q(e.available_on)},t("div",{class:"fw-bold"},I(e.available_on,{showDisplayDate:!0})),t("div",{class:"fw-bold"},I(e.available_on,{showTime:!0}))),updated_at:e=>t("td",{part:q(e.updated_at)},t("div",{class:"fw-bold"},I(e.updated_at,{showDisplayDate:!0})),t("div",{class:"fw-bold"},I(e.updated_at,{showTime:!0})))},x=class{constructor(t){e(this,t),this.clickEvent=a(this,"click-event"),this.errorEvent=a(this,"error-event"),this.balanceTransactions=[],this.isLoading=!0,this.errorMessage=null,this.paging=n,this.pagingParams={},this.columns="created_at,txn_type,description,amount,fee,net",this.handleClickPrevious=t=>{this.pagingParams={before_cursor:t},this.clickEvent.emit({name:P.previous})},this.handleClickNext=t=>{this.pagingParams={after_cursor:t},this.clickEvent.emit({name:P.next})},this.rowClickHandler=t=>{const e=t.target.closest("tr").dataset.rowEntityId;if(!e)return;const a=this.balanceTransactions.find((t=>t.id===e));this.clickEvent.emit({name:P.row,data:a})}}componentWillLoad(){this.transactionsTable=new f(this.balanceTransactions,this.columns,B,O),c(),this.analytics=new p(this),this.initializeApi()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeApi()}handleError(t,e,a){this.isLoading=!1,this.errorEvent.emit({errorCode:t,message:e,severity:a})}initializeApi(){this.payoutId&&this.authToken?(({accountId:t,authToken:e,service:a})=>async({params:i,onSuccess:o,onError:n,final:c})=>{var p;try{const c=await a.fetchPayoutTransactions(t,e,i);c.error?n({error:h(c.error),code:d(null===(p=c.error)||void 0===p?void 0:p.code),severity:s.ERROR}):o({balanceTransactions:c.data.map((t=>new r(t))),pagingInfo:Object.assign({},c.page_info)})}catch(t){const e=d(null==t?void 0:t.code);n({error:h(t),code:e,severity:s.ERROR})}finally{c()}})({accountId:i.accountId,authToken:this.authToken,service:new l})({params:this.requestParams,onSuccess:({balanceTransactions:t,pagingInfo:e})=>{this.balanceTransactions=t,this.paging=e,this.transactionsTable.collectionData=this.balanceTransactions},onError:({error:t,code:e,severity:a})=>{this.errorMessage=t.message,this.handleError(t,e,a)},final:()=>{this.isLoading=!1}}):(this.errorMessage="payout-id and auth-token props are required",this.handleError(o.MISSING_PROPS,this.errorMessage,s.ERROR))}get entityId(){return this.balanceTransactions.map((t=>t.id))}get showEmptyState(){return!this.isLoading&&!this.errorMessage&&this.transactionsTable.rowData.length<1}get showErrorState(){return!this.isLoading&&!!this.errorMessage}get showRowData(){return!this.showEmptyState&&!this.showErrorState&&!this.isLoading}get requestParams(){return Object.assign({payout_id:this.payoutId,limit:"15"},this.pagingParams)}render(){return t(D,{key:"0627b879f2139685ebdbb879d6e13ef99a466654"},t(u,{key:"33fa60d6acc25540e81465500c454f69a2e132ad"},t(m,{key:"5bce0713f04022cbfad1c7e053e60a6a340a37e2"},t(b,{key:"226dda187d5002c9bd48c64d9396ae3736dbbeb2"},t(y,{key:"d7726ab935ce064696fb017b10829120f2e8717f"},this.transactionsTable.columnData.map((t=>t)))),t(_,{key:"a6d46402bd1ba1f4bd820b0badd74d038b82e9ba"},t(w,{key:"5958446a6844c2134d8ae8608b1222a5ade9dc88",columnSpan:this.transactionsTable.columnKeys.length,isLoading:this.isLoading}),t(j,{key:"f64911e09fa1d587dbbdf755ae7b9aabc4b31448",isEmpty:this.showEmptyState,columnSpan:this.transactionsTable.columnKeys.length}),t(v,{key:"8c1422f9ab251ad648396bf42e6751a50a8a9810",columnSpan:this.transactionsTable.columnKeys.length,errorMessage:this.errorMessage}),this.showRowData&&this.transactionsTable.rowData.map(((e,a)=>t(T,{"data-test-id":"table-row","data-row-entity-id":this.entityId[a],onClick:this.rowClickHandler},e)))),this.paging&&t(g,{key:"4538b7850a81a7c17cf4a7b39248d1c29552c9ee"},t(k,{key:"bf332e1eef41f832aff8fb3d84de891c6fc44cb4"},t(C,{key:"823e4ce33a986a57aa29f41ec3f09987d8a03a22",colSpan:this.transactionsTable.columnData.length},t("pagination-menu",{key:"37aa4a533e9ebdf8df92660b6ebbb1f8dba96eea",paging:Object.assign(Object.assign({},this.paging),{handleClickPrevious:this.handleClickPrevious,handleClickNext:this.handleClickNext})})))))))}static get watchers(){return{pagingParams:["propChanged"],payoutId:["propChanged"],authToken:["propChanged"]}}};export{x as justifi_payout_transactions_list}
@@ -1 +1 @@
1
- import{r as s,c as t,h as r}from"./p-Bn7inNWG.js";import{A as o}from"./p-BPtcGAzB.js";import{C as i,a as e}from"./p-Cjcsf8ku.js";import"./p-BP7op0vq.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{g as p,a}from"./p-D2muobcE.js";import{E as n}from"./p-DNo0OPOP.js";import{c as h,J as c}from"./p-CxqAv6yr.js";import"./p-DhGNCW2f.js";import"./p-CpaS1Lex.js";import"./p-zdIeCUeh.js";import"./p-HXpYMWUU.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-RvUQ__Pq.js";import"./p-VsM6ERNV.js";const m=o();class u{async fetchGrossVolumeChartData(s,t){return m.get({endpoint:`account/${s}/reports/gross_volume`,authToken:t})}}const d=class{constructor(r){s(this,r),this.errorEvent=t(this,"error-event"),this.errorMessage=null,this.handleErrorEvent=s=>{this.errorMessage=s.detail.message,this.errorEvent.emit(s.detail)}}componentWillLoad(){h(),this.analytics=new c(this),this.initializeGetGrossPayment()}disconnectedCallback(){var s;null===(s=this.analytics)||void 0===s||s.cleanup()}propChanged(){this.initializeGetGrossPayment()}initializeGetGrossPayment(){this.accountId&&this.authToken?this.getGrossPayment=(({id:s,authToken:t,service:r})=>async({onSuccess:o,onError:e})=>{var n;try{const h=await r.fetchGrossVolumeChartData(s,t);h.error?e({error:a(h.error),code:p(null===(n=h.error)||void 0===n?void 0:n.code),severity:i.ERROR}):o(h.data)}catch(s){const t=p(null==s?void 0:s.code);e({error:a(s),code:t,severity:i.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new u}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:e.MISSING_PROPS,message:this.errorMessage,severity:i.ERROR}))}render(){return this.errorMessage?n(this.errorMessage):r("gross-payment-chart-core",{getGrossPayment:this.getGrossPayment,"onError-event":this.handleErrorEvent})}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{d as justifi_gross_payment_chart}
1
+ import{r as t,c as s,h as r}from"./p-Bn7inNWG.js";import{A as o}from"./p-BPtcGAzB.js";import{C as i,a as e}from"./p-Cjcsf8ku.js";import"./p-BP7op0vq.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{g as p,a}from"./p-D2muobcE.js";import{E as n}from"./p-DNo0OPOP.js";import{c as h,J as c}from"./p-tkZEz3MG.js";import"./p-DhGNCW2f.js";import"./p-CpaS1Lex.js";import"./p-zdIeCUeh.js";import"./p-HXpYMWUU.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-RvUQ__Pq.js";import"./p-D51QuD44.js";const m=o();class u{async fetchGrossVolumeChartData(t,s){return m.get({endpoint:`account/${t}/reports/gross_volume`,authToken:s})}}const d=class{constructor(r){t(this,r),this.errorEvent=s(this,"error-event"),this.errorMessage=null,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){h(),this.analytics=new c(this),this.initializeGetGrossPayment()}disconnectedCallback(){var t;null===(t=this.analytics)||void 0===t||t.cleanup()}propChanged(){this.initializeGetGrossPayment()}initializeGetGrossPayment(){this.accountId&&this.authToken?this.getGrossPayment=(({id:t,authToken:s,service:r})=>async({onSuccess:o,onError:e})=>{var n;try{const h=await r.fetchGrossVolumeChartData(t,s);h.error?e({error:a(h.error),code:p(null===(n=h.error)||void 0===n?void 0:n.code),severity:i.ERROR}):o(h.data)}catch(t){const s=p(null==t?void 0:t.code);e({error:a(t),code:s,severity:i.ERROR})}})({id:this.accountId,authToken:this.authToken,service:new u}):(this.errorMessage="Account ID and Auth Token are required",this.errorEvent.emit({errorCode:e.MISSING_PROPS,message:this.errorMessage,severity:i.ERROR}))}render(){return this.errorMessage?n(this.errorMessage):r("gross-payment-chart-core",{getGrossPayment:this.getGrossPayment,"onError-event":this.handleErrorEvent})}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{d as justifi_gross_payment_chart}
@@ -1 +1 @@
1
- import{r as e,c as t,h as a,H as i}from"./p-Bn7inNWG.js";import{c as s,F as c}from"./p-CR9D6mKt.js";import{k as r,l as d,m as n,n as l,q as o,y as h}from"./p-CYBR4K2p.js";import{r as f,av as b}from"./p-RvUQ__Pq.js";import{S as u}from"./p-DxqCFDtF.js";import"./p-CZfYo5-1.js";import{S as m}from"./p-CaAVuW6B.js";import{c as p,J as y}from"./p-CxqAv6yr.js";import{w as v,c as k}from"./p-DhGNCW2f.js";import{H as g}from"./p-BSt6p1oq.js";import{n as _}from"./p-BnjCmwMr.js";import{S as j}from"./p-BX8GieXu.js";import{B as x}from"./p-DD0Mvpeu.js";import{c as w}from"./p-DAED83Ew.js";import"./p-BFTU3MAI.js";import"./p-yH3TC3ZQ.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-VsM6ERNV.js";import"./p-BPtcGAzB.js";import"./p-zdIeCUeh.js";import"./p-HXpYMWUU.js";import"./p-Cjcsf8ku.js";import"./p-BP7op0vq.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-CpaS1Lex.js";const V=class{constructor(a){e(this,a),this.radioClick=t(this,"radio-click"),this.checked=!1,this.hidden=!1,this.handleClick=()=>{this.radioClick.emit(this.value)}}render(){return a(u,{key:"492a73e2bab02c04aa8733ce0b9ab801e5ff8875"},a("div",{key:"c095a98ba11739b85ece4c7bb0e0c30e7e08ec7b",class:`radio-list-item p-3 ${this.class||""}`,part:f,onClick:this.handleClick,hidden:this.hidden},a("form-control-radio",{key:"050ed9e552c4a8bf4462e544d3496bed356e7c06",name:this.name,value:this.value,checked:this.checked,label:this.label,inputHandler:()=>null})))}},C=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new c(s({name:h.required("Enter full name"),address_line1:o.nullable(),address_line2:l.nullable(),address_city:n.nullable(),address_state:d.nullable(),address_postal_code:r.nullable()}))}componentDidLoad(){this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)}))}async getValues(){return this.formController.values.getValue()}async fill(e){this.formController.setInitialValues(e)}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){const e=this.formController.getInitialValues();return a(u,{key:"81a8511265b4813817b4cf183aa176b464645e85"},a("div",{key:"7dddd3ec7822077268c73da7d0f34a691ddde1cb",part:b,class:"mt-4"},a("form",{key:"1c9000a4b022209129cf511d79a77cf3dc44b77e"},a("fieldset",{key:"134c349c5745197b5ebb79b31748bf480e1cab7a"},this.legend&&a("legend",{key:"fb8e12086fd6fb51f7456d8fc6e82a9184514d4f"},this.legend),a("div",{key:"a49ae2d182e442efbe44aae7c2e0a4e40dabe7d7",class:"row gy-3"},a("div",{key:"2be4b2aab266d0fc17f32237693dea8578c7545d",class:"col-12"},a("form-control-text",{key:"92d1b3b05ba04212e46feecfd886f7dcc912e4fe",name:"name",label:"Full Name",defaultValue:e.name,errorText:this.errors.name,inputHandler:this.inputHandler})))))))}},H=e=>{const{isReady:t}=e;return t?null:a("div",{class:"container-fluid p-0"},a("div",{class:"row mb-3"},a("div",{class:"col-12 align-content-end"},a(m,{height:"18px",width:"120px"}),a(m,{height:"36px"}))),a("div",{class:"row"},a("div",{class:"col-12 align-content-end"},a(m,{height:"18px",width:"110px"}),a(m,{height:"36px"}))))},O=class{constructor(t){e(this,t),this.isReady=!1}async componentWillLoad(){await v(),this.iframeOrigin=k.iframeOrigin,p(),this.analytics=new y(this)}componentDidRender(){Promise.all([this.accountNumberIframeElement,this.routingNumberIframeElement].map((e=>new Promise((t=>{e.addEventListener("iframeLoaded",(()=>{t()}))}))))).then((()=>{this.isReady=!0}))}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}async validate(){const e=await this.accountNumberIframeElement.validate(),t=await this.routingNumberIframeElement.validate();return e&&t}async tokenize({clientId:e,paymentMethodMetadata:t,account:a}){return this.accountNumberIframeElement.tokenize(e,t,a)}render(){return a(u,{key:"f7b088f8dd8a977f3843183fb444f28862644fb3"},a(H,{key:"63179b2a1616ac98e9647bc8a6cf8f32cf159c24",isReady:this.isReady}),a("hidden-input",{key:"bc2427c6ae7ca231f444cac83789682c5b7f252b"}),a("div",{key:"d7b8ad011f441f35130a8836d5a9998aeed5ef6f",class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},a("div",{key:"87c14b39416411432109fa477a45905824986a5d",class:"row mb-3"},a("iframe-input",{key:"aa63db40e7dcff302c804b6f772a8903ac53a588",inputId:"accountNumber",ref:e=>this.accountNumberIframeElement=e,label:"Account Number",iframeOrigin:`${this.iframeOrigin}/v2/accountNumber`})),a("div",{key:"683ff288ff835321c364b4af64524dbf183da030",class:"row"},a("iframe-input",{key:"46653b74876dfc02916b7d2842ab793b8658e8b2",inputId:"routingNumber",ref:e=>this.routingNumberIframeElement=e,label:"Routing Number",iframeOrigin:`${this.iframeOrigin}/v2/routingNumber`}))))}},B=class{constructor(t){e(this,t)}get showSimpleCardBillingForm(){return"card"===this.paymentMethodType&&this.hideCardBillingForm}get showSimpleBankAccountBillingForm(){return"bankAccount"===this.paymentMethodType&&this.hideBankAccountBillingForm}async getValues(){var e;return null===(e=this.selectedFormRef)||void 0===e?void 0:e.getValues()}async fill(e){var t;null===(t=this.selectedFormRef)||void 0===t||t.fill(e)}async validate(){var e;return null===(e=this.selectedFormRef)||void 0===e?void 0:e.validate()}render(){return a(i,null,a(this.showSimpleBankAccountBillingForm?"justifi-bank-account-billing-form-simple":this.showSimpleCardBillingForm?"justifi-card-billing-form-simple":"justifi-billing-form-full",{legend:this.legend,ref:e=>this.selectedFormRef=e}))}},N=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new c(s({name:h.required("Enter full name"),address_line1:o.required("Enter street address"),address_line2:l.nullable(),address_city:n.required("Enter city"),address_state:d.required("Select state"),address_postal_code:r.required("Enter postal code")})),this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)}))}async getValues(){return this.formController.values.getValue()}async fill(e){this.formController.setInitialValues(e)}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){if(!this.formController)return null;const e=this.formController.getInitialValues();return a(u,null,a("div",{part:b,class:"mt-4"},a(g,{text:"Billing address",class:"fs-6 fw-bold lh-lg mb-4"}),a("form",null,a("fieldset",null,this.legend&&a("legend",null,this.legend),a("div",{class:"row gy-3"},a("div",{class:"col-12"},a("form-control-text",{name:"name",label:"Full Name",defaultValue:e.name,errorText:this.errors.name,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-text",{name:"address_line1",label:"Street Address",defaultValue:e.address_line1,errorText:this.errors.address_line1,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-text",{name:"address_line2",label:"Apartment, Suite, etc. (optional)",defaultValue:e.address_line2,errorText:this.errors.address_line2,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-text",{name:"address_city",label:"City",defaultValue:e.address_city,errorText:this.errors.address_city,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-select",{name:"address_state",label:"State",options:j,defaultValue:e.address_state,errorText:this.errors.address_state,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-text",{name:"address_postal_code",label:"ZIP",defaultValue:e.address_postal_code,errorText:this.errors.address_postal_code,inputHandler:this.inputHandler,maxLength:5,keyDownHandler:_})))))))}},D=class{constructor(t){e(this,t),this.variant="primary",this.type="button"}render(){return a(u,{key:"b9a4be42df1dbeca39a2c310ab6375cc2c1946f3"},a(x,{key:"04bfb3aaa6af8b2dafa07dbcebaf6b7a03a07442",variant:this.variant,isLoading:this.isLoading,clickHandler:this.clickHandler,class:this.class,type:this.type,disabled:this.disabled,style:this.customStyle},this.text))}},L=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new c(s({name:h.nullable(),address_line1:o.nullable(),address_line2:l.nullable(),address_city:n.nullable(),address_state:d.nullable(),address_postal_code:r.required("Enter postal code")}))}componentDidLoad(){this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)}))}async getValues(){return this.formController.values.getValue()}async fill(e){this.formController.setInitialValues(e)}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){const e=this.formController.getInitialValues();return a(u,{key:"a88ea2aa0b1cc2fccda7c169aad9c061e106ecfe"},a("div",{key:"414df056d92819bf646886ca8e15f2ed10e6ab18",part:b},a("form",{key:"c11f6eb5c7c5c1ecbeb8cc8f644a3b3ba72254c7"},a("fieldset",{key:"dd69c65ff7f36da3954c01ca2401e8ede6799f14"},this.legend&&a("legend",{key:"25a86a61452b84237cc58c047916de22c35b764d"},this.legend),a("div",{key:"2fa8445fcf4ac0500f357d92480f18ccac655689",class:"row gy-3"},a("div",{key:"b7ac75fcab43435a03ad919757541f74661ce5b4",class:"col-12"},a("form-control-text",{key:"fd9e84c9605edf1a987c7243409eb0182f79a803",name:"address_postal_code",label:"ZIP",defaultValue:e.address_postal_code,errorText:this.errors.address_postal_code,inputHandler:this.inputHandler,maxLength:5,keyDownHandler:_})))))))}},M=e=>{const{isReady:t}=e;return t?null:a("div",{class:"container-fluid p-0"},a("div",{class:"mb-3"},a(m,{height:"18px",width:"100px"}),a(m,{height:"36px"})),a("div",{class:"row"},a("div",{class:"col-4 align-content-end"},a(m,{height:"18px",width:"80px"}),a(m,{height:"36px"})),a("div",{class:"col-4 align-content-end"},a(m,{height:"36px"})),a("div",{class:"col-4 align-content-end"},a(m,{height:"18px",width:"30px"}),a(m,{height:"36px"}))))},I=class{constructor(t){e(this,t),this.isReady=!1}async componentWillLoad(){await v(),this.iframeOrigin=k.iframeOrigin,p(),this.analytics=new y(this)}componentDidRender(){Promise.all([this.cardNumberIframeElement,this.expirationMonthIframeElement,this.expirationYearIframeElement,this.cvvIframeElement].map((e=>new Promise((t=>{e.addEventListener("iframeLoaded",(()=>{t()}))}))))).then((()=>{this.isReady=!0}))}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}async validate(){const e=await this.cardNumberIframeElement.validate(),t=await this.expirationMonthIframeElement.validate(),a=await this.expirationYearIframeElement.validate(),i=await this.cvvIframeElement.validate();return e&&t&&a&&i}async tokenize({clientId:e,paymentMethodMetadata:t,account:a}){return this.cardNumberIframeElement.tokenize(e,t,a)}render(){return a(u,{key:"75938c15dce1b5b078773f28c689c8f7d4ad5059"},a(M,{key:"fa27e1cb7262b012e69c6c88580bfa432edb13f0",isReady:this.isReady}),a("hidden-input",{key:"305afc644870ea4c5e11ade42e6f8b5504b0a299"}),a("div",{key:"fc87adbea2130fd4334f2f7a8dbc666ad9b84f76",class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},a("div",{key:"b426b711813d401e181c833c06f440adc2998f4a",class:"mb-3"},a("iframe-input",{key:"1c81cac902a472ffe841340de40c8aa80688d908",inputId:"cardNumber",ref:e=>this.cardNumberIframeElement=e,label:"Card Number",iframeOrigin:`${this.iframeOrigin}/v2/cardNumber`})),a("div",{key:"370fb4bd7951ea6948b57923141842da07575bd3",class:"row"},a("div",{key:"7912c07831d685c0f30d103537933c4ec0e41726",class:"col-4 align-content-end"},a("iframe-input",{key:"a892fead0333523eecd1a6e02fb6cd3807e1b0ad",inputId:"expirationMonth",ref:e=>this.expirationMonthIframeElement=e,label:"Expiration",iframeOrigin:`${this.iframeOrigin}/v2/expirationMonth`})),a("div",{key:"699f614dcada9748525afe53cd461a5dd4f96847",class:"col-4 align-content-end"},a("iframe-input",{key:"0c65a7fbb4bf1fa35fc645de62723f8d130217de",inputId:"expirationYear",ref:e=>this.expirationYearIframeElement=e,label:"",iframeOrigin:`${this.iframeOrigin}/v2/expirationYear`})),a("div",{key:"b25d6322892f5a3313db2592193552f34e364103",class:"col-4 align-content-end"},a("iframe-input",{key:"279646b3bfa68f8e03d0118e2de86668471f5821",inputId:"CVV",ref:e=>this.cvvIframeElement=e,label:"CVV",iframeOrigin:`${this.iframeOrigin}/v2/CVV`})))))}},S=class{constructor(a){e(this,a),this.checkboxChanged=t(this,"checkboxChanged"),this.isChecked=!1,this.handleCheckboxChange=(e,t)=>{this.isChecked=t,w.savePaymentMethod=t,this.checkboxChanged.emit(this.isChecked)}}render(){return a(u,{key:"407e24ad9cd84378dab6a85ed813a8040f93942a"},a("form-control-checkbox",{key:"73dc01e01c4ca57e26c6897c06a0280fda8c98db",label:"Save New Payment Method",name:"saveNewPaymentMethod",checked:this.isChecked,inputHandler:this.handleCheckboxChange}))}};export{C as justifi_bank_account_billing_form_simple,O as justifi_bank_account_form,B as justifi_billing_form,N as justifi_billing_form_full,D as justifi_button,L as justifi_card_billing_form_simple,I as justifi_card_form,V as justifi_radio_list_item,S as justifi_save_new_payment_method}
1
+ import{r as e,c as t,h as a,H as i}from"./p-Bn7inNWG.js";import{c as s,F as c}from"./p-CR9D6mKt.js";import{k as r,l as d,m as n,n as l,q as o,y as h}from"./p-CYBR4K2p.js";import{r as f,av as b}from"./p-RvUQ__Pq.js";import{S as u}from"./p-DxqCFDtF.js";import"./p-CZfYo5-1.js";import{S as m}from"./p-CaAVuW6B.js";import{c as p,J as y}from"./p-tkZEz3MG.js";import{w as v,c as k}from"./p-DhGNCW2f.js";import{H as g}from"./p-BSt6p1oq.js";import{n as _}from"./p-BnjCmwMr.js";import{S as j}from"./p-BX8GieXu.js";import{B as x}from"./p-DD0Mvpeu.js";import{c as w}from"./p-C6c6Q0E7.js";import"./p-BFTU3MAI.js";import"./p-yH3TC3ZQ.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-D51QuD44.js";import"./p-BPtcGAzB.js";import"./p-zdIeCUeh.js";import"./p-HXpYMWUU.js";import"./p-Cjcsf8ku.js";import"./p-BP7op0vq.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-CpaS1Lex.js";const C=class{constructor(a){e(this,a),this.radioClick=t(this,"radio-click"),this.checked=!1,this.hidden=!1,this.handleClick=()=>{this.radioClick.emit(this.value)}}render(){return a(u,{key:"492a73e2bab02c04aa8733ce0b9ab801e5ff8875"},a("div",{key:"c095a98ba11739b85ece4c7bb0e0c30e7e08ec7b",class:`radio-list-item p-3 ${this.class||""}`,part:f,onClick:this.handleClick,hidden:this.hidden},a("form-control-radio",{key:"050ed9e552c4a8bf4462e544d3496bed356e7c06",name:this.name,value:this.value,checked:this.checked,label:this.label,inputHandler:()=>null})))}},V=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new c(s({name:h.required("Enter full name"),address_line1:o.nullable(),address_line2:l.nullable(),address_city:n.nullable(),address_state:d.nullable(),address_postal_code:r.nullable()}))}componentDidLoad(){this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)}))}async getValues(){return this.formController.values.getValue()}async fill(e){this.formController.setInitialValues(e)}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){const e=this.formController.getInitialValues();return a(u,{key:"81a8511265b4813817b4cf183aa176b464645e85"},a("div",{key:"7dddd3ec7822077268c73da7d0f34a691ddde1cb",part:b,class:"mt-4"},a("form",{key:"1c9000a4b022209129cf511d79a77cf3dc44b77e"},a("fieldset",{key:"134c349c5745197b5ebb79b31748bf480e1cab7a"},this.legend&&a("legend",{key:"fb8e12086fd6fb51f7456d8fc6e82a9184514d4f"},this.legend),a("div",{key:"a49ae2d182e442efbe44aae7c2e0a4e40dabe7d7",class:"row gy-3"},a("div",{key:"2be4b2aab266d0fc17f32237693dea8578c7545d",class:"col-12"},a("form-control-text",{key:"92d1b3b05ba04212e46feecfd886f7dcc912e4fe",name:"name",label:"Full Name",defaultValue:e.name,errorText:this.errors.name,inputHandler:this.inputHandler})))))))}},H=e=>{const{isReady:t}=e;return t?null:a("div",{class:"container-fluid p-0"},a("div",{class:"row mb-3"},a("div",{class:"col-12 align-content-end"},a(m,{height:"18px",width:"120px"}),a(m,{height:"36px"}))),a("div",{class:"row"},a("div",{class:"col-12 align-content-end"},a(m,{height:"18px",width:"110px"}),a(m,{height:"36px"}))))},O=class{constructor(t){e(this,t),this.isReady=!1}async componentWillLoad(){await v(),this.iframeOrigin=k.iframeOrigin,p(),this.analytics=new y(this)}componentDidRender(){Promise.all([this.accountNumberIframeElement,this.routingNumberIframeElement].map((e=>new Promise((t=>{e.addEventListener("iframeLoaded",(()=>{t()}))}))))).then((()=>{this.isReady=!0}))}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}async validate(){const e=await this.accountNumberIframeElement.validate(),t=await this.routingNumberIframeElement.validate();return e&&t}async tokenize({clientId:e,paymentMethodMetadata:t,account:a}){return this.accountNumberIframeElement.tokenize(e,t,a)}render(){return a(u,{key:"f7b088f8dd8a977f3843183fb444f28862644fb3"},a(H,{key:"63179b2a1616ac98e9647bc8a6cf8f32cf159c24",isReady:this.isReady}),a("hidden-input",{key:"bc2427c6ae7ca231f444cac83789682c5b7f252b"}),a("div",{key:"d7b8ad011f441f35130a8836d5a9998aeed5ef6f",class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},a("div",{key:"87c14b39416411432109fa477a45905824986a5d",class:"row mb-3"},a("iframe-input",{key:"aa63db40e7dcff302c804b6f772a8903ac53a588",inputId:"accountNumber",ref:e=>this.accountNumberIframeElement=e,label:"Account Number",iframeOrigin:`${this.iframeOrigin}/v2/accountNumber`})),a("div",{key:"683ff288ff835321c364b4af64524dbf183da030",class:"row"},a("iframe-input",{key:"46653b74876dfc02916b7d2842ab793b8658e8b2",inputId:"routingNumber",ref:e=>this.routingNumberIframeElement=e,label:"Routing Number",iframeOrigin:`${this.iframeOrigin}/v2/routingNumber`}))))}},B=class{constructor(t){e(this,t)}get showSimpleCardBillingForm(){return"card"===this.paymentMethodType&&this.hideCardBillingForm}get showSimpleBankAccountBillingForm(){return"bankAccount"===this.paymentMethodType&&this.hideBankAccountBillingForm}async getValues(){var e;return null===(e=this.selectedFormRef)||void 0===e?void 0:e.getValues()}async fill(e){var t;null===(t=this.selectedFormRef)||void 0===t||t.fill(e)}async validate(){var e;return null===(e=this.selectedFormRef)||void 0===e?void 0:e.validate()}render(){return a(i,null,a(this.showSimpleBankAccountBillingForm?"justifi-bank-account-billing-form-simple":this.showSimpleCardBillingForm?"justifi-card-billing-form-simple":"justifi-billing-form-full",{legend:this.legend,ref:e=>this.selectedFormRef=e}))}},D=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new c(s({name:h.required("Enter full name"),address_line1:o.required("Enter street address"),address_line2:l.nullable(),address_city:n.required("Enter city"),address_state:d.required("Select state"),address_postal_code:r.required("Enter postal code")})),this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)}))}async getValues(){return this.formController.values.getValue()}async fill(e){this.formController.setInitialValues(e)}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){if(!this.formController)return null;const e=this.formController.getInitialValues();return a(u,null,a("div",{part:b,class:"mt-4"},a(g,{text:"Billing address",class:"fs-6 fw-bold lh-lg mb-4"}),a("form",null,a("fieldset",null,this.legend&&a("legend",null,this.legend),a("div",{class:"row gy-3"},a("div",{class:"col-12"},a("form-control-text",{name:"name",label:"Full Name",defaultValue:e.name,errorText:this.errors.name,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-text",{name:"address_line1",label:"Street Address",defaultValue:e.address_line1,errorText:this.errors.address_line1,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-text",{name:"address_line2",label:"Apartment, Suite, etc. (optional)",defaultValue:e.address_line2,errorText:this.errors.address_line2,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-text",{name:"address_city",label:"City",defaultValue:e.address_city,errorText:this.errors.address_city,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-select",{name:"address_state",label:"State",options:j,defaultValue:e.address_state,errorText:this.errors.address_state,inputHandler:this.inputHandler})),a("div",{class:"col-12"},a("form-control-text",{name:"address_postal_code",label:"ZIP",defaultValue:e.address_postal_code,errorText:this.errors.address_postal_code,inputHandler:this.inputHandler,maxLength:5,keyDownHandler:_})))))))}},L=class{constructor(t){e(this,t),this.variant="primary",this.type="button"}render(){return a(u,{key:"b9a4be42df1dbeca39a2c310ab6375cc2c1946f3"},a(x,{key:"04bfb3aaa6af8b2dafa07dbcebaf6b7a03a07442",variant:this.variant,isLoading:this.isLoading,clickHandler:this.clickHandler,class:this.class,type:this.type,disabled:this.disabled,style:this.customStyle},this.text))}},N=class{constructor(t){e(this,t),this.errors={},this.inputHandler=(e,t)=>{this.formController.setValues(Object.assign(Object.assign({},this.formController.values.getValue()),{[e]:t}))}}componentWillLoad(){this.formController=new c(s({name:h.nullable(),address_line1:o.nullable(),address_line2:l.nullable(),address_city:n.nullable(),address_state:d.nullable(),address_postal_code:r.required("Enter postal code")}))}componentDidLoad(){this.formController.values.subscribe((e=>this.billingInfo=Object.assign({},e))),this.formController.errors.subscribe((e=>{this.errors=Object.assign({},e)}))}async getValues(){return this.formController.values.getValue()}async fill(e){this.formController.setInitialValues(e)}async validate(){return{isValid:await this.formController.validate(),errors:this.formController.errors.getValue()}}render(){const e=this.formController.getInitialValues();return a(u,{key:"a88ea2aa0b1cc2fccda7c169aad9c061e106ecfe"},a("div",{key:"414df056d92819bf646886ca8e15f2ed10e6ab18",part:b},a("form",{key:"c11f6eb5c7c5c1ecbeb8cc8f644a3b3ba72254c7"},a("fieldset",{key:"dd69c65ff7f36da3954c01ca2401e8ede6799f14"},this.legend&&a("legend",{key:"25a86a61452b84237cc58c047916de22c35b764d"},this.legend),a("div",{key:"2fa8445fcf4ac0500f357d92480f18ccac655689",class:"row gy-3"},a("div",{key:"b7ac75fcab43435a03ad919757541f74661ce5b4",class:"col-12"},a("form-control-text",{key:"fd9e84c9605edf1a987c7243409eb0182f79a803",name:"address_postal_code",label:"ZIP",defaultValue:e.address_postal_code,errorText:this.errors.address_postal_code,inputHandler:this.inputHandler,maxLength:5,keyDownHandler:_})))))))}},M=e=>{const{isReady:t}=e;return t?null:a("div",{class:"container-fluid p-0"},a("div",{class:"mb-3"},a(m,{height:"18px",width:"100px"}),a(m,{height:"36px"})),a("div",{class:"row"},a("div",{class:"col-4 align-content-end"},a(m,{height:"18px",width:"80px"}),a(m,{height:"36px"})),a("div",{class:"col-4 align-content-end"},a(m,{height:"36px"})),a("div",{class:"col-4 align-content-end"},a(m,{height:"18px",width:"30px"}),a(m,{height:"36px"}))))},I=class{constructor(t){e(this,t),this.isReady=!1}async componentWillLoad(){await v(),this.iframeOrigin=k.iframeOrigin,p(),this.analytics=new y(this)}componentDidRender(){Promise.all([this.cardNumberIframeElement,this.expirationMonthIframeElement,this.expirationYearIframeElement,this.cvvIframeElement].map((e=>new Promise((t=>{e.addEventListener("iframeLoaded",(()=>{t()}))}))))).then((()=>{this.isReady=!0}))}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}async validate(){const e=await this.cardNumberIframeElement.validate(),t=await this.expirationMonthIframeElement.validate(),a=await this.expirationYearIframeElement.validate(),i=await this.cvvIframeElement.validate();return e&&t&&a&&i}async tokenize({clientId:e,paymentMethodMetadata:t,account:a}){return this.cardNumberIframeElement.tokenize(e,t,a)}render(){return a(u,{key:"75938c15dce1b5b078773f28c689c8f7d4ad5059"},a(M,{key:"fa27e1cb7262b012e69c6c88580bfa432edb13f0",isReady:this.isReady}),a("hidden-input",{key:"305afc644870ea4c5e11ade42e6f8b5504b0a299"}),a("div",{key:"fc87adbea2130fd4334f2f7a8dbc666ad9b84f76",class:"container-fluid p-0",style:{opacity:this.isReady?"1":"0",height:this.isReady?"auto":"0"}},a("div",{key:"b426b711813d401e181c833c06f440adc2998f4a",class:"mb-3"},a("iframe-input",{key:"1c81cac902a472ffe841340de40c8aa80688d908",inputId:"cardNumber",ref:e=>this.cardNumberIframeElement=e,label:"Card Number",iframeOrigin:`${this.iframeOrigin}/v2/cardNumber`})),a("div",{key:"370fb4bd7951ea6948b57923141842da07575bd3",class:"row"},a("div",{key:"7912c07831d685c0f30d103537933c4ec0e41726",class:"col-4 align-content-end"},a("iframe-input",{key:"a892fead0333523eecd1a6e02fb6cd3807e1b0ad",inputId:"expirationMonth",ref:e=>this.expirationMonthIframeElement=e,label:"Expiration",iframeOrigin:`${this.iframeOrigin}/v2/expirationMonth`})),a("div",{key:"699f614dcada9748525afe53cd461a5dd4f96847",class:"col-4 align-content-end"},a("iframe-input",{key:"0c65a7fbb4bf1fa35fc645de62723f8d130217de",inputId:"expirationYear",ref:e=>this.expirationYearIframeElement=e,label:"",iframeOrigin:`${this.iframeOrigin}/v2/expirationYear`})),a("div",{key:"b25d6322892f5a3313db2592193552f34e364103",class:"col-4 align-content-end"},a("iframe-input",{key:"279646b3bfa68f8e03d0118e2de86668471f5821",inputId:"CVV",ref:e=>this.cvvIframeElement=e,label:"CVV",iframeOrigin:`${this.iframeOrigin}/v2/CVV`})))))}},S=class{constructor(a){e(this,a),this.checkboxChanged=t(this,"checkboxChanged"),this.isChecked=!1,this.handleCheckboxChange=(e,t)=>{this.isChecked=t,w.savePaymentMethod=t,this.checkboxChanged.emit(this.isChecked)}}render(){return a(u,{key:"407e24ad9cd84378dab6a85ed813a8040f93942a"},a("form-control-checkbox",{key:"73dc01e01c4ca57e26c6897c06a0280fda8c98db",label:"Save New Payment Method",name:"saveNewPaymentMethod",checked:this.isChecked,inputHandler:this.handleCheckboxChange}))}};export{V as justifi_bank_account_billing_form_simple,O as justifi_bank_account_form,B as justifi_billing_form,D as justifi_billing_form_full,L as justifi_button,N as justifi_card_billing_form_simple,I as justifi_card_form,C as justifi_radio_list_item,S as justifi_save_new_payment_method}
@@ -1 +1 @@
1
- import{r as e,c as t,h as a}from"./p-Bn7inNWG.js";import{c as i,J as s}from"./p-CxqAv6yr.js";import{c}from"./p-DAED83Ew.js";import{d}from"./p-RvUQ__Pq.js";import{S as o}from"./p-DxqCFDtF.js";import"./p-CZfYo5-1.js";import"./p-VsM6ERNV.js";import"./p-BPtcGAzB.js";import"./p-DhGNCW2f.js";import"./p-CpaS1Lex.js";import"./p-zdIeCUeh.js";import"./p-HXpYMWUU.js";import"./p-Cjcsf8ku.js";import"./p-BP7op0vq.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";const h=class{constructor(a){e(this,a),this.errorEvent=t(this,"error-event"),this.loadedEvent=t(this,"loaded"),this.submitEvent=t(this,"submit-event"),this.errorMessage="",this.insuranceToggled=!1,this.isSubmitting=!1,this.disableBankAccount=!1,this.disableBnpl=!1,this.disableCreditCard=!1,this.disablePaymentMethodGroup=!1,this.hideBankAccountBillingForm=!1,this.hideCardBillingForm=!1}propChanged(){this.updateStore()}connectedCallback(){this.authToken&&this.checkoutId&&this.updateStore()}componentWillLoad(){i(),this.analytics=new s(this)}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}checkoutComplete(e){this.isSubmitting=!1}checkoutError(e){this.isSubmitting=!1}async fillBillingForm(e){var t;c.billingFormFields=e,null===(t=this.tokenizePaymentMethodRef)||void 0===t||t.fillBillingForm(e)}async validate(){var e;return{isValid:await(null===(e=this.modularCheckoutRef)||void 0===e?void 0:e.validate())}}updateStore(){c.checkoutId=this.checkoutId,c.authToken=this.authToken,c.disableCreditCard=this.disableCreditCard,c.disableBankAccount=this.disableBankAccount,c.disableBnpl=this.disableBnpl,c.disablePaymentMethodGroup=this.disablePaymentMethodGroup}async submit(e){var t;this.isSubmitting=!0,null===(t=this.modularCheckoutRef)||void 0===t||t.submitCheckout(c.billingFormFields)}get showPaymentTypeHeader(){return!this.disableCreditCard&&!this.disableBankAccount}render(){return a(o,{key:"9f4a7eca05e031eca99c30bfedd3073855c73529"},a("justifi-modular-checkout",{key:"bd15f818c0b214d540c0a17b26701a09c9ad0e3c",ref:e=>this.modularCheckoutRef=e,authToken:this.authToken,checkoutId:this.checkoutId,savePaymentMethod:c.savePaymentMethod},a("div",{key:"b12acaab9fd003f97bf99e75066e0b8b46dce89e",class:"row gy-3 jfi-checkout-core"},a("div",{key:"6a8618155c0822bf8c997e8542ecf78a68cbc1c7",class:"col-12",part:d},a("justifi-header",{key:"f60d7dbe6115443c313122dfccb6dcb9e0b974c5",text:"Summary",level:"h2",class:"fs-5 fw-bold pb-3"}),a("section",{key:"ef2583dd15bf25f344a68ac43cefda0d845438c9"},a("justifi-checkout-summary",{key:"23b1818736c79e126ae79d8ff1951e44bc84facb"}))),a("div",{key:"d86495b7da53b9ce7c5a3d65d618e4be3079338f",class:"col-12 mt-4"},a("slot",{key:"85e34415fa3191a185a0a8da50c16338583e7392",name:"insurance"})),a("div",{key:"8cff610ad6e3535438546aeec85b128ee752f4bb",class:"col-12 mt-4"},a("justifi-header",{key:"a2b1c31d40e0c5b7a4f3802312c50cb718b80dbc",text:"Payment",level:"h2",class:"fs-5 fw-bold pb-3"}),this.showPaymentTypeHeader&&a("justifi-header",{key:"6bff6394a243c0a3cb643e0704c44b36001393c3",text:"Select payment type",level:"h3",class:"fs-6 fw-bold lh-lg"}),a("div",{key:"deecdfb1d74a74af62c31f1fb88767986c8f142c",class:"d-flex flex-column"},a("section",{key:"47bc56f1ad8418c65bb1b3f7eba3aedd22d1df0e"},a("div",{key:"4aac99bba9fbe8acebc652c3c510157f6623dd1e"},a("justifi-saved-payment-methods",{key:"62fe7c65f1528828bd07746881f3a64e5c8c3f3a"}),a("justifi-sezzle-payment-method",{key:"81fa1dcea2fabf9a1555dc4e9bdb278f09921f01"}),a("justifi-plaid-payment-method",{key:"6e9f782bfe9fbc098084fac5f6effc5d09c3de97"}),a("justifi-tokenize-payment-method",{key:"53616f11a7ec79d9334da2705d85206dd6260b63",ref:e=>this.tokenizePaymentMethodRef=e,authToken:this.authToken,accountId:c.accountId,disableCreditCard:this.disableCreditCard,disableBankAccount:this.disableBankAccount,hideCardBillingForm:this.hideCardBillingForm,hideBankAccountBillingForm:this.hideBankAccountBillingForm,hideSubmitButton:!0,paymentMethodGroupId:c.paymentMethodGroupId}))))),a("div",{key:"4b61246ea605254aa0e329c3803b9fb725709158",class:"mt-4"},a("justifi-button",{key:"0e5f46931aa558cea5a81d9ea9c9627a1feeca50",text:"Pay",type:"submit",variant:"primary",clickHandler:e=>this.submit(e),disabled:this.isSubmitting,isLoading:this.isSubmitting,customStyle:{width:"100%",textAlign:"center"}})))))}static get watchers(){return{authToken:["propChanged"],checkoutId:["propChanged"],disableCreditCard:["propChanged"],disableBankAccount:["propChanged"],disableBnpl:["propChanged"],disablePaymentMethodGroup:["propChanged"]}}};export{h as justifi_checkout}
1
+ import{r as e,c as t,h as a}from"./p-Bn7inNWG.js";import{c as i,J as s}from"./p-tkZEz3MG.js";import{c}from"./p-C6c6Q0E7.js";import{d}from"./p-RvUQ__Pq.js";import{S as o}from"./p-DxqCFDtF.js";import"./p-CZfYo5-1.js";import"./p-D51QuD44.js";import"./p-BPtcGAzB.js";import"./p-DhGNCW2f.js";import"./p-CpaS1Lex.js";import"./p-zdIeCUeh.js";import"./p-HXpYMWUU.js";import"./p-Cjcsf8ku.js";import"./p-BP7op0vq.js";import"./p-BH0Xfn-F.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";const h=class{constructor(a){e(this,a),this.errorEvent=t(this,"error-event"),this.loadedEvent=t(this,"loaded"),this.submitEvent=t(this,"submit-event"),this.errorMessage="",this.insuranceToggled=!1,this.isSubmitting=!1,this.disableBankAccount=!1,this.disableBnpl=!1,this.disableCreditCard=!1,this.disablePaymentMethodGroup=!1,this.hideBankAccountBillingForm=!1,this.hideCardBillingForm=!1}propChanged(){this.updateStore()}connectedCallback(){this.authToken&&this.checkoutId&&this.updateStore()}componentWillLoad(){i(),this.analytics=new s(this)}disconnectedCallback(){var e;null===(e=this.analytics)||void 0===e||e.cleanup()}checkoutComplete(e){this.isSubmitting=!1}checkoutError(e){this.isSubmitting=!1}async fillBillingForm(e){var t;c.billingFormFields=e,null===(t=this.tokenizePaymentMethodRef)||void 0===t||t.fillBillingForm(e)}async validate(){var e;return{isValid:await(null===(e=this.modularCheckoutRef)||void 0===e?void 0:e.validate())}}updateStore(){c.checkoutId=this.checkoutId,c.authToken=this.authToken,c.disableCreditCard=this.disableCreditCard,c.disableBankAccount=this.disableBankAccount,c.disableBnpl=this.disableBnpl,c.disablePaymentMethodGroup=this.disablePaymentMethodGroup}async submit(e){var t;this.isSubmitting=!0,null===(t=this.modularCheckoutRef)||void 0===t||t.submitCheckout(c.billingFormFields)}get showPaymentTypeHeader(){return!this.disableCreditCard&&!this.disableBankAccount}render(){return a(o,{key:"9f4a7eca05e031eca99c30bfedd3073855c73529"},a("justifi-modular-checkout",{key:"bd15f818c0b214d540c0a17b26701a09c9ad0e3c",ref:e=>this.modularCheckoutRef=e,authToken:this.authToken,checkoutId:this.checkoutId,savePaymentMethod:c.savePaymentMethod},a("div",{key:"b12acaab9fd003f97bf99e75066e0b8b46dce89e",class:"row gy-3 jfi-checkout-core"},a("div",{key:"6a8618155c0822bf8c997e8542ecf78a68cbc1c7",class:"col-12",part:d},a("justifi-header",{key:"f60d7dbe6115443c313122dfccb6dcb9e0b974c5",text:"Summary",level:"h2",class:"fs-5 fw-bold pb-3"}),a("section",{key:"ef2583dd15bf25f344a68ac43cefda0d845438c9"},a("justifi-checkout-summary",{key:"23b1818736c79e126ae79d8ff1951e44bc84facb"}))),a("div",{key:"d86495b7da53b9ce7c5a3d65d618e4be3079338f",class:"col-12 mt-4"},a("slot",{key:"85e34415fa3191a185a0a8da50c16338583e7392",name:"insurance"})),a("div",{key:"8cff610ad6e3535438546aeec85b128ee752f4bb",class:"col-12 mt-4"},a("justifi-header",{key:"a2b1c31d40e0c5b7a4f3802312c50cb718b80dbc",text:"Payment",level:"h2",class:"fs-5 fw-bold pb-3"}),this.showPaymentTypeHeader&&a("justifi-header",{key:"6bff6394a243c0a3cb643e0704c44b36001393c3",text:"Select payment type",level:"h3",class:"fs-6 fw-bold lh-lg"}),a("div",{key:"deecdfb1d74a74af62c31f1fb88767986c8f142c",class:"d-flex flex-column"},a("section",{key:"47bc56f1ad8418c65bb1b3f7eba3aedd22d1df0e"},a("div",{key:"4aac99bba9fbe8acebc652c3c510157f6623dd1e"},a("justifi-saved-payment-methods",{key:"62fe7c65f1528828bd07746881f3a64e5c8c3f3a"}),a("justifi-sezzle-payment-method",{key:"81fa1dcea2fabf9a1555dc4e9bdb278f09921f01"}),a("justifi-plaid-payment-method",{key:"6e9f782bfe9fbc098084fac5f6effc5d09c3de97"}),a("justifi-tokenize-payment-method",{key:"53616f11a7ec79d9334da2705d85206dd6260b63",ref:e=>this.tokenizePaymentMethodRef=e,authToken:this.authToken,accountId:c.accountId,disableCreditCard:this.disableCreditCard,disableBankAccount:this.disableBankAccount,hideCardBillingForm:this.hideCardBillingForm,hideBankAccountBillingForm:this.hideBankAccountBillingForm,hideSubmitButton:!0,paymentMethodGroupId:c.paymentMethodGroupId}))))),a("div",{key:"4b61246ea605254aa0e329c3803b9fb725709158",class:"mt-4"},a("justifi-button",{key:"0e5f46931aa558cea5a81d9ea9c9627a1feeca50",text:"Pay",type:"submit",variant:"primary",clickHandler:e=>this.submit(e),disabled:this.isSubmitting,isLoading:this.isSubmitting,customStyle:{width:"100%",textAlign:"center"}})))))}static get watchers(){return{authToken:["propChanged"],checkoutId:["propChanged"],disableCreditCard:["propChanged"],disableBankAccount:["propChanged"],disableBnpl:["propChanged"],disablePaymentMethodGroup:["propChanged"]}}};export{h as justifi_checkout}
@@ -1 +1 @@
1
- import{r as t,c as s,h as i}from"./p-Bn7inNWG.js";import"./p-DhGNCW2f.js";import"./p-HXpYMWUU.js";import{C as o,a as r}from"./p-Cjcsf8ku.js";import{C as e}from"./p-BP7op0vq.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{g as c,a as p}from"./p-D2muobcE.js";import{c as a,J as n}from"./p-CxqAv6yr.js";import{C as h}from"./p-B8iBcmNu.js";import{m,S as u}from"./p-CvG-itHC.js";import{S as d}from"./p-DxqCFDtF.js";import"./p-CZfYo5-1.js";import{d as j}from"./p-DVBbk00Z.js";import"./p-CpaS1Lex.js";import"./p-zdIeCUeh.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-VsM6ERNV.js";import"./p-BPtcGAzB.js";import"./p-DDUmOl3v.js";import"./p-RvUQ__Pq.js";const f=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event"),this.errorMessage=null,this.columns=j,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){a(),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:a,onError:n})=>{var h,m;try{const u=await i.fetchCheckouts(t,s,r);if(u.error)return n({error:p(u.error),code:c(null===(m=u.error)||void 0===m?void 0:m.code),severity:o.ERROR});{const t=Object.assign({},u.page_info);a({checkouts:(null===(h=u.data)||void 0===h?void 0:h.map((t=>new e(t))))||[],pagingInfo:t})}}catch(t){const s=c(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:"b0c774c4f56f94cd6b4a3dc8651938f9f33ca94e"},i("checkouts-list-core",{key:"d524423a791f70c234044f5ba27d7bc3648fc988",getCheckouts:this.getCheckouts,getSubAccounts:this.getSubAccounts,"onError-event":this.handleErrorEvent,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{f as justifi_checkouts_list}
1
+ import{r as t,c as s,h as i}from"./p-Bn7inNWG.js";import"./p-DhGNCW2f.js";import"./p-HXpYMWUU.js";import{C as o,a as r}from"./p-Cjcsf8ku.js";import{C as e}from"./p-BP7op0vq.js";import"./p-CLHwhyvu.js";import"./p-BlJnA265.js";import"./p-BH0Xfn-F.js";import{g as c,a as p}from"./p-D2muobcE.js";import{c as a,J as n}from"./p-tkZEz3MG.js";import{C as h}from"./p-B8iBcmNu.js";import{m,S as u}from"./p-CvG-itHC.js";import{S as d}from"./p-DxqCFDtF.js";import"./p-CZfYo5-1.js";import{d as j}from"./p-DVBbk00Z.js";import"./p-CpaS1Lex.js";import"./p-zdIeCUeh.js";import"./p-Dt-vy9Le.js";import"./p-BX8GieXu.js";import"./p-D51QuD44.js";import"./p-BPtcGAzB.js";import"./p-DDUmOl3v.js";import"./p-RvUQ__Pq.js";const f=class{constructor(i){t(this,i),this.errorEvent=s(this,"error-event"),this.errorMessage=null,this.columns=j,this.handleErrorEvent=t=>{this.errorMessage=t.detail.message,this.errorEvent.emit(t.detail)}}componentWillLoad(){a(),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:a,onError:n})=>{var h,m;try{const u=await i.fetchCheckouts(t,s,r);if(u.error)return n({error:p(u.error),code:c(null===(m=u.error)||void 0===m?void 0:m.code),severity:o.ERROR});{const t=Object.assign({},u.page_info);a({checkouts:(null===(h=u.data)||void 0===h?void 0:h.map((t=>new e(t))))||[],pagingInfo:t})}}catch(t){const s=c(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:"b0c774c4f56f94cd6b4a3dc8651938f9f33ca94e"},i("checkouts-list-core",{key:"d524423a791f70c234044f5ba27d7bc3648fc988",getCheckouts:this.getCheckouts,getSubAccounts:this.getSubAccounts,"onError-event":this.handleErrorEvent,columns:this.columns}))}static get watchers(){return{accountId:["propChanged"],authToken:["propChanged"]}}};export{f as justifi_checkouts_list}