@solvimon/solvimon-web 0.1.0-alpha.30 → 0.1.0-alpha.31

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 (257) hide show
  1. package/README.md +152 -91
  2. package/dist/AddPaymentMethodModal-Bs_aOOCX.mjs +97 -0
  3. package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-DF4PIR-A.mjs +89 -0
  4. package/dist/{Alert.vue.es-ZPG49yR_.mjs → Alert.vue.es-xhsk_7Gn.mjs} +1 -1
  5. package/dist/AuthProvider.handle-CUO6Qj-5.mjs +46 -0
  6. package/dist/{Avatar.vue.es-geDQsZwu.mjs → Avatar.vue.es-DrbtUiLO.mjs} +1 -1
  7. package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-C3JYNZuR.mjs +64 -0
  8. package/dist/BillingInformationForm.lib-ad8B2Y1O.mjs +32 -0
  9. package/dist/BillingInformationForm.vue_vue_type_script_setup_true_lang-BUdcXy0H.mjs +340 -0
  10. package/dist/BillingInformationModal-crgTNGf4.mjs +85 -0
  11. package/dist/{Button.vue.es-j7iYlqtJ.mjs → Button.vue.es-BHbanjR0.mjs} +1 -1
  12. package/dist/{ChargeOnDemandModal-CR01PkP_.mjs → ChargeOnDemandModal-DYiFtw1n.mjs} +44 -43
  13. package/dist/{Chip.vue.es-Dxx_0dte.mjs → Chip.vue.es-Dc6-PjEn.mjs} +2 -2
  14. package/dist/{ContentWithAsideLayout-Bnbsq8_5.mjs → ContentWithAsideLayout-C2kFcft1.mjs} +1 -1
  15. package/dist/{ContextMenu.vue.es-BJO4U47Q.mjs → ContextMenu.vue.es-CvX6O2IM.mjs} +10 -10
  16. package/dist/{CustomerBillingInformation.vue.es-CmNpqcBw.mjs → CustomerBillingInformation.vue.es-DQWt9osz.mjs} +3 -3
  17. package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-hNVtamwL.mjs +217 -0
  18. package/dist/CustomerShippingAddresses-C0c-4D2W.mjs +282 -0
  19. package/dist/{CustomerWalletBalances.vue_vue_type_script_setup_true_lang-DJnr5D56.mjs → CustomerWalletBalances.vue_vue_type_script_setup_true_lang-C50vGUvw.mjs} +992 -1100
  20. package/dist/{DividerText.vue.es-BusbyeAI.mjs → DividerText.vue.es-ChN6fnrH.mjs} +1 -1
  21. package/dist/{EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-wPma8Os-.mjs → EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-DCUml1W4.mjs} +3 -3
  22. package/dist/{ErrorNotification.vue.es-F068p7PY.mjs → ErrorNotification.vue.es-CWIVt5q9.mjs} +2 -2
  23. package/dist/{FormMessage.vue.es-CwMQpIAW.mjs → FormMessage.vue.es-CQ64C8dt.mjs} +1 -1
  24. package/dist/{IconButton.vue.es-D8DtBW9i.mjs → IconButton.vue.es-BXzwMvVk.mjs} +2 -2
  25. package/dist/{IconTitle.vue.es-6VJtjJX2.mjs → IconTitle.vue.es-GyanM-JQ.mjs} +3 -3
  26. package/dist/{Input.vue.es-BLyHcmu4.mjs → Input.vue.es-CxiwRZYs.mjs} +4 -4
  27. package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-Dl1vTzQD.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-Ca0qflBR.mjs} +2 -2
  28. package/dist/{InvoiceEntryView.vue_vue_type_script_setup_true_lang-DYskT3r7.mjs → InvoiceEntryView.vue_vue_type_script_setup_true_lang-Dw73a5Yt.mjs} +7 -7
  29. package/dist/{InvoicePreview.vue.es-Cpf66_xV.mjs → InvoicePreview.vue.es-BvnikfEH.mjs} +6 -6
  30. package/dist/{InvoicePricingClauseChip.vue.es-CDrAE901.mjs → InvoicePricingClauseChip.vue.es-DxcyTRGr.mjs} +3 -3
  31. package/dist/{Label.vue.es-es7ZUBSP.mjs → Label.vue.es-3ACRco55.mjs} +3 -3
  32. package/dist/LoadFailedNotice.vue_vue_type_script_setup_true_lang-1qpRh-0S.mjs +20 -0
  33. package/dist/{Modal.vue.es-eeR9FmvQ.mjs → Modal.vue.es-CDjfZDDx.mjs} +138 -127
  34. package/dist/OrderSummaryInvoice.vue_vue_type_script_setup_true_lang-CnZwxJ5b.mjs +789 -0
  35. package/dist/{PaymentCompletedCard.vue_vue_type_script_setup_true_lang-CrjVPks0.mjs → PaymentCompletedCard.vue_vue_type_script_setup_true_lang-PICpXmC3.mjs} +2 -2
  36. package/dist/{PaymentErrorCard.vue_vue_type_script_setup_true_lang-DyjzaTK1.mjs → PaymentErrorCard.vue_vue_type_script_setup_true_lang-DpZtYBfM.mjs} +4 -4
  37. package/dist/{PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-BHQrWy6r.mjs → PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-Co5qBQa8.mjs} +3 -3
  38. package/dist/{PaymentHistoryBlock-CN42ewCn.mjs → PaymentHistoryBlock-HUazLER6.mjs} +1 -1
  39. package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-C3Y5fHvA.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-DdmUoiet.mjs} +4 -4
  40. package/dist/{PaymentIntegrationForm-D3Ye7LZ5.mjs → PaymentIntegrationForm-ZnIjTyda.mjs} +1 -1
  41. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-DU5wu66t.mjs +161 -0
  42. package/dist/{PaymentIntegrationFormAdyen-Fm-diCCO.mjs → PaymentIntegrationFormAdyen-sbw3AoKS.mjs} +302 -282
  43. package/dist/{PaymentIntegrationFormStripe-BANBL6za.mjs → PaymentIntegrationFormStripe-4JmKEwbS.mjs} +126 -117
  44. package/dist/{PaymentMethod.vue.es-t3-VyoE8.mjs → PaymentMethod.vue.es-DAabE41t.mjs} +23 -21
  45. package/dist/{PaymentMethodForm-CqP3GoNj.mjs → PaymentMethodForm-MmCUSJLE.mjs} +1 -1
  46. package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-DyiXLYRj.mjs +165 -0
  47. package/dist/{PaymentMethodSelector.vue_vue_type_script_setup_true_lang-D5wmRuCf.mjs → PaymentMethodSelector.vue_vue_type_script_setup_true_lang-Bv34aiZ6.mjs} +6 -6
  48. package/dist/{PaymentMethodsList.vue_vue_type_script_setup_true_lang-DhkkiJaQ.mjs → PaymentMethodsList.vue_vue_type_script_setup_true_lang-DZ2Z-RMv.mjs} +28 -26
  49. package/dist/PaymentMethodsModal-CjpNw4kX.mjs +192 -0
  50. package/dist/PlanCustomizationEditor-BDWm_z2w.mjs +864 -0
  51. package/dist/{PortalLinkUnverified-Cp60_kRJ.mjs → PortalLinkUnverified-B7YYhv97.mjs} +3 -3
  52. package/dist/{PortalNotAvailable-DzSQnfzw.mjs → PortalNotAvailable-DIyeKrAp.mjs} +2 -2
  53. package/dist/{PricingGroupRangeInput.vue.es-Srq_3cga.mjs → PricingGroupRangeInput.vue.es-C6J8C7JS.mjs} +7 -7
  54. package/dist/{PricingGroupSingleEditor.vue_vue_type_script_setup_true_lang-oRijnVnZ.mjs → PricingGroupSingleEditor.vue_vue_type_script_setup_true_lang-CiQ-C9Hh.mjs} +16 -15
  55. package/dist/{RadioGroupExtended.vue.es-BbBMDf6l.mjs → RadioGroupExtended.vue.es-hDmUAKIA.mjs} +5 -5
  56. package/dist/{Section.vue.es-Oqn1wGPZ.mjs → Section.vue.es-CwKTCeZ1.mjs} +1 -1
  57. package/dist/{SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-OM19NPBh.mjs → SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-Gn1aE60E.mjs} +2 -2
  58. package/dist/ShippingAddressForm.vue_vue_type_script_setup_true_lang-y7yOKwR3.mjs +144 -0
  59. package/dist/ShippingAddressesModal-CNXxkxnJ.mjs +283 -0
  60. package/dist/{StepInput.vue.es-ieh4EuJ7.mjs → StepInput.vue.es-GkrOtOVa.mjs} +4 -4
  61. package/dist/SubscriptionCancellationModal-C_xFPx1I.mjs +4 -0
  62. package/dist/SubscriptionCancellationModal.vue_vue_type_script_setup_true_lang-DdTC33Qh.mjs +240 -0
  63. package/dist/SubscriptionCancellationSuccess.vue_vue_type_script_setup_true_lang-CQ-ZOzVI.mjs +64 -0
  64. package/dist/SubscriptionDetails.entry.ce-DuP8TtKu.mjs +764 -0
  65. package/dist/{SubscriptionSchedules-DMxX3GpK.mjs → SubscriptionSchedules-DosBeXD7.mjs} +1 -1
  66. package/dist/{SubscriptionSchedules.vue_vue_type_script_setup_true_lang-DXro_64f.mjs → SubscriptionSchedules.vue_vue_type_script_setup_true_lang-5tyDFxEh.mjs} +1948 -1965
  67. package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-C26HShPu.mjs +90 -0
  68. package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-CHlXP_2x.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-BUDuQk2e.mjs} +133 -108
  69. package/dist/Toggle.vue.es-S2g8WGY_.mjs +99 -0
  70. package/dist/{TooltipParagraph.vue.es-BES3zsYN.mjs → TooltipParagraph.vue.es-4HaXi8RP.mjs} +18 -18
  71. package/dist/{TranslationOverride.vue_vue_type_script_setup_true_lang-BJmlNrXT.mjs → TranslationOverride.vue_vue_type_script_setup_true_lang-C5Y6Kg-_.mjs} +1 -1
  72. package/dist/TrialChip.vue.es-CUfJ4SK3.mjs +47 -0
  73. package/dist/addonQuantity-BvoYTajN.mjs +128 -0
  74. package/dist/adyen-D4em6EgU.mjs +99 -0
  75. package/dist/adyenSdk-DUTO7xkT.mjs +63 -0
  76. package/dist/{api.es-qgvzNMU-.mjs → api.es-QaC926Xu.mjs} +2 -2
  77. package/dist/components/BillingInformation/BillingInformation.mjs +37 -41
  78. package/dist/components/BillingInformationForm/BillingInformationForm.mjs +45 -462
  79. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.mjs +33 -42
  80. package/dist/components/Invoice/Invoice.mjs +426 -426
  81. package/dist/components/InvoiceDetails/InvoiceDetails.mjs +38 -47
  82. package/dist/components/InvoiceHeader/InvoiceHeader.mjs +29 -34
  83. package/dist/components/InvoicesList/InvoicesList.mjs +33 -42
  84. package/dist/components/PaymentHistory/PaymentHistory.mjs +39 -48
  85. package/dist/components/PaymentMethodForm/PaymentMethodForm.mjs +56 -64
  86. package/dist/components/ShippingAddressForm/ShippingAddressForm.ce.d.ts +1 -0
  87. package/dist/components/ShippingAddressForm/ShippingAddressForm.mjs +212 -0
  88. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.mjs +34 -42
  89. package/dist/components/SubscriptionsList/SubscriptionsList.mjs +41 -50
  90. package/dist/components/WalletBalances/WalletBalances.mjs +46 -55
  91. package/dist/core/events.types.d.ts +1 -0
  92. package/dist/core/index.mjs +51 -34
  93. package/dist/{customElements-DK4GKNJG.mjs → customElements-d7Bhfqi_.mjs} +773 -746
  94. package/dist/{customer-lf6S5DBR.mjs → customer-CNCSN_G5.mjs} +1 -1
  95. package/dist/{de-DE-UJ6X6jXu.mjs → de-DE-D-sV3avS.mjs} +8 -5
  96. package/dist/{de-DE-Cyj_NtiI.mjs → de-DE-wZp39RC-.mjs} +68 -5
  97. package/dist/{fr-FR-Cvvbkwlj.mjs → fr-FR-BYHycSxz.mjs} +3 -0
  98. package/dist/{fr-FR-CRFoWQ7J.mjs → fr-FR-BrNXJ7gR.mjs} +68 -5
  99. package/dist/{countryData.es-BegoD-cZ.mjs → getCountryNameByCode.es-OGxn_zT0.mjs} +7 -2
  100. package/dist/index.es-BEZ2mumY.mjs +633 -0
  101. package/dist/{index.es-BrVTOW5D.mjs → index.es-C7J3WGGo.mjs} +4 -4
  102. package/dist/index.mjs +37 -33
  103. package/dist/invoices-CXvL8KQx.mjs +143 -0
  104. package/dist/{it-IT-DObZEc-U.mjs → it-IT-Bd1qsMVU.mjs} +68 -5
  105. package/dist/{it-IT-DnJP5URH.mjs → it-IT-zpPyT9PH.mjs} +8 -5
  106. package/dist/{nl-NL-q9xfTZF0.mjs → nl-NL-BOr4MR7L.mjs} +8 -5
  107. package/dist/{nl-NL-C02xHilF.mjs → nl-NL-C6Y6fqaW.mjs} +68 -5
  108. package/dist/paymentIntegrationFormLoaders-wi1vMgf_.mjs +31 -0
  109. package/dist/{paymentMethods-8w-ccfY_.mjs → paymentMethods-CG1fcG2v.mjs} +22 -21
  110. package/dist/{paymentOutcome-B6sW1eCV.mjs → paymentOutcome-D59QkGfm.mjs} +1 -1
  111. package/dist/paymentRedirect-DaS8Kccc.mjs +66 -0
  112. package/dist/payments-Dy81gmkC.mjs +71 -0
  113. package/dist/preloadPaymentIntegrationForms-C_9p7Jbi.mjs +9 -0
  114. package/dist/pricing-CBJT8C6L.mjs +42 -0
  115. package/dist/{pricingItem.es-bCPArbTa.mjs → pricingItem.es-AYq_hYeD.mjs} +1 -1
  116. package/dist/pricingPlanScheduleOverrides-GON_34ep.mjs +291 -0
  117. package/dist/randomUuid-BE_IQ-aq.mjs +10 -0
  118. package/dist/screens/Checkout/Checkout.mjs +1098 -3
  119. package/dist/screens/CheckoutSession/CheckoutSession.ce.d.ts +1 -0
  120. package/dist/screens/CheckoutSession/CheckoutSession.mjs +1316 -0
  121. package/dist/screens/CustomerOverview/CustomerOverview.mjs +209 -133
  122. package/dist/screens/PayInvoice/PayInvoice.mjs +282 -274
  123. package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.mjs +92 -97
  124. package/dist/screens/SubscriptionDetails/SubscriptionDetails.mjs +2 -2
  125. package/dist/screens/SubscriptionManagement/SubscriptionManagement.mjs +915 -404
  126. package/dist/{sorting.es-C0pdMgX0.mjs → sorting.es-kM0f1VX0.mjs} +1 -1
  127. package/dist/{subscription-BwzkagDI.mjs → subscription-DQ5mRp_e.mjs} +10 -10
  128. package/dist/subscriptions-Bm1eu9wc.mjs +99 -0
  129. package/dist/taxId.es-Zu2Ff1gL.mjs +510 -0
  130. package/dist/timePeriod.es-R9U0wLlB.mjs +13 -0
  131. package/dist/types/components/customer/BillingInformationForm/BillingInformationForm.types.d.ts +11 -14
  132. package/dist/types/components/customer/CheckoutForm/CheckoutAddressFields.types.d.ts +2 -9
  133. package/dist/types/components/customer/CheckoutForm/CheckoutForm.types.d.ts +10 -0
  134. package/dist/types/components/customer/CustomerPaymentMethodsBlock/CustomerPaymentMethodsBlock.types.d.ts +6 -0
  135. package/dist/types/components/payments/AddPaymentMethodModal/AddPaymentMethodModal.types.d.ts +17 -0
  136. package/dist/types/components/payments/ExpressPaymentMethod/ExpressPaymentMethodApplePay.types.d.ts +3 -2
  137. package/dist/types/components/payments/ExpressPaymentMethods/ExpressPaymentMethods.types.d.ts +3 -2
  138. package/dist/types/components/payments/OnDemandPaymentModalShell/OnDemandPaymentModalShell.types.d.ts +2 -0
  139. package/dist/types/components/payments/PaymentIntegrationForm/PaymentIntegrationForm.types.d.ts +12 -1
  140. package/dist/types/components/payments/PaymentMethodsList/PaymentMethodsList.types.d.ts +2 -0
  141. package/dist/types/components/payments/PaymentMethodsModal/PaymentMethodsModal.types.d.ts +22 -0
  142. package/dist/types/components/providers/ActionDispatchProvider/ActionDispatchProvider.lib.types.d.ts +1 -1
  143. package/dist/types/components/providers/AuthProvider/AuthProvider.vue.d.ts +7 -1
  144. package/dist/types/components/providers/EntryProvider/EntryProvider.types.d.ts +2 -2
  145. package/dist/types/components/providers/EntryProvider/EntryProvider.vue.d.ts +3 -11
  146. package/dist/types/components/providers/ErrorBoundary/ErrorBoundary.vue.d.ts +1 -5
  147. package/dist/types/components/providers/HostElementProvider/HostElementProvider.lib.d.ts +11 -0
  148. package/dist/types/components/providers/HostElementProvider/composables/useHostEvent.d.ts +12 -0
  149. package/dist/types/components/providers/LoggerProvider/LoggerProvider.types.d.ts +5 -4
  150. package/dist/types/components/providers/PortalProvider/PortalProvider.lib.d.ts +3 -3
  151. package/dist/types/components/providers/PortalProvider/PortalProvider.types.d.ts +3 -3
  152. package/dist/types/components/providers/PortalProvider/PortalProvider.vue.d.ts +6 -1
  153. package/dist/types/components/providers/PortalProvider/composables/usePortal.d.ts +1 -0
  154. package/dist/types/components/providers/Provider/Provider.types.d.ts +10 -3
  155. package/dist/types/components/providers/Provider/Provider.vue.d.ts +3 -14
  156. package/dist/types/components/subscriptions/ChargeOnDemandModal/ChargeOnDemandModal.types.d.ts +1 -1
  157. package/dist/types/components/subscriptions/OrderSummary.types.d.ts +14 -0
  158. package/dist/types/components/subscriptions/OrderSummaryInvoice.types.d.ts +14 -1
  159. package/dist/types/components/subscriptions/PlanCustomizationForm/PlanCustomizationEditor.types.d.ts +9 -0
  160. package/dist/types/components/subscriptions/PlanCustomizationForm/SeatsEditor.types.d.ts +4 -0
  161. package/dist/types/components/subscriptions/PlanCustomizationForm/SeatsEditorItem.types.d.ts +2 -0
  162. package/dist/types/components/subscriptions/PlanCustomizationForm/UnitsEditor.types.d.ts +4 -0
  163. package/dist/types/components/subscriptions/PlanCustomizationForm/UnitsEditorItem.types.d.ts +2 -0
  164. package/dist/types/components/subscriptions/SubscriptionCancellationSuccess/SubscriptionCancellationSuccess.types.d.ts +4 -0
  165. package/dist/types/components/subscriptions/SubscriptionManagement/SubscriptionManagementForm.types.d.ts +10 -9
  166. package/dist/types/components/subscriptions/SubscriptionManagement/SubscriptionManagementSuccess.types.d.ts +5 -0
  167. package/dist/types/components/subscriptions/SubscriptionManagement/SubscriptionManagementSummary.types.d.ts +3 -0
  168. package/dist/types/components/subscriptions/SubscriptionManagement/SubscriptionPlanChangeSummary.types.d.ts +4 -0
  169. package/dist/types/components/subscriptions/SubscriptionManagement/SubscriptionPlanSelector.types.d.ts +7 -0
  170. package/dist/types/components/subscriptions/SubscriptionsList/SubscriptionsList.types.d.ts +1 -0
  171. package/dist/types/components/subscriptions/SubscriptionsList/SubscriptionsListItem.types.d.ts +1 -0
  172. package/dist/types/index.d.ts +5 -1
  173. package/dist/types/public/components/BillingInformation/BillingInformation.types.d.ts +5 -0
  174. package/dist/types/public/components/BillingInformationForm/BillingInformationForm.entry.types.d.ts +1 -2
  175. package/dist/types/public/components/CustomerPaymentMethods/CustomerPaymentMethods.types.d.ts +6 -2
  176. package/dist/types/public/components/Invoice/Invoice.types.d.ts +7 -7
  177. package/dist/types/public/components/InvoiceHeader/InvoiceHeader.types.d.ts +2 -2
  178. package/dist/types/public/components/InvoicesList/InvoicesList.types.d.ts +6 -7
  179. package/dist/types/public/components/PaymentMethodForm/PaymentMethodForm.entry.types.d.ts +1 -1
  180. package/dist/types/public/components/PaymentMethodForm/PaymentMethodForm.types.d.ts +19 -14
  181. package/dist/types/public/components/ShippingAddressForm/ShippingAddressForm.entry.ce.d.ts +1 -0
  182. package/dist/types/public/components/ShippingAddressForm/ShippingAddressForm.entry.types.d.ts +6 -0
  183. package/dist/types/public/components/ShippingAddressForm/ShippingAddressForm.types.d.ts +5 -0
  184. package/dist/types/public/components/SubscriptionsList/SubscriptionsList.types.d.ts +10 -1
  185. package/dist/types/public/core/action-request.types.d.ts +18 -24
  186. package/dist/types/public/core/events.types.d.ts +99 -0
  187. package/dist/types/public/core/index.d.ts +3 -1
  188. package/dist/types/public/core/types.d.ts +11 -2
  189. package/dist/types/public/screens/Checkout/Checkout.entry.types.d.ts +1 -7
  190. package/dist/types/public/screens/Checkout/Checkout.source.types.d.ts +151 -0
  191. package/dist/types/public/screens/Checkout/Checkout.types.d.ts +7 -30
  192. package/dist/types/public/screens/CheckoutSession/CheckoutSession.entry.ce.d.ts +1 -0
  193. package/dist/types/public/screens/CheckoutSession/CheckoutSession.entry.types.d.ts +3 -0
  194. package/dist/types/public/screens/CustomerOverview/CustomerOverview.types.d.ts +8 -2
  195. package/dist/types/public/screens/PayInvoice/PayInvoice.types.d.ts +0 -6
  196. package/dist/types/public/screens/SubscriptionDetails/SubscriptionDetails.configuration.types.d.ts +2 -19
  197. package/dist/types/public/screens/SubscriptionDetails/SubscriptionDetails.types.d.ts +2 -3
  198. package/dist/types/public/screens/SubscriptionManagement/SubscriptionManagement.types.d.ts +2 -1
  199. package/dist/types/services/paymentMethods.types.d.ts +12 -1
  200. package/dist/types/types/EntryBaseProps.d.ts +10 -6
  201. package/dist/types/types/branding.d.ts +15 -0
  202. package/dist/types/types/checkoutSession.d.ts +189 -0
  203. package/dist/types/types/errors.d.ts +2 -0
  204. package/dist/types/types/pricingPlanGroup.d.ts +25 -0
  205. package/dist/{useActionDispatchProvider-ChAHdwR8.mjs → useActionDispatchProvider-BWna0S6N.mjs} +1 -1
  206. package/dist/useAddressFormats-Dw7IEdxg.mjs +1997 -0
  207. package/dist/useCheckoutForm-BaV2j_ob.mjs +3310 -0
  208. package/dist/{useCustomer-CTMhg1nd.mjs → useCustomer-RUtEzDOY.mjs} +2 -2
  209. package/dist/useDefaultPaymentMethod-Dliq6_Yw.mjs +39 -0
  210. package/dist/useExperimentalFeature-DAKAF_a2.mjs +6 -0
  211. package/dist/useHostEvent-pjoWJ7ZH.mjs +12 -0
  212. package/dist/{useIncrementalLoading-CBVutPH8.mjs → useIncrementalLoading-B3gp58X-.mjs} +2 -2
  213. package/dist/{useInvoiceData-qUGbBAQK.mjs → useInvoiceData-Dya4mmvf.mjs} +2 -2
  214. package/dist/{useInvoicesList-wJvZAJpW.mjs → useInvoicesList-Dp3c_cb3.mjs} +9 -9
  215. package/dist/{useLoadInitialData-UvfYXgbi.mjs → useLoadInitialData-CwySdYZM.mjs} +1 -1
  216. package/dist/usePaymentFormHold-CYZ4BdOw.mjs +19 -0
  217. package/dist/{usePaymentMethodAvailability-35l4pWdH.mjs → usePaymentMethodAvailability-B7NV0ZtX.mjs} +4 -4
  218. package/dist/usePaymentMethodOptions-DDRjVvDJ.mjs +67 -0
  219. package/dist/{usePaymentMethods-De7hlLHo.mjs → usePaymentMethods-DBGyQA_I.mjs} +2 -2
  220. package/dist/{usePayments-hWS7fnOx.mjs → usePayments-ChGtK_As.mjs} +9 -9
  221. package/dist/usePortal--Uzbpbgr.mjs +14 -0
  222. package/dist/{useService-BwzIBIRp.mjs → useService-DayNZhPh.mjs} +1 -1
  223. package/dist/useShippingAddresses-TXVeGFPm.mjs +122 -0
  224. package/dist/useSubscription-lIGMFLG1.mjs +35 -0
  225. package/dist/useSubscriptionActions-BSlJVB4p.mjs +44 -0
  226. package/dist/useWatchDebounced-DkXgKe0E.mjs +20 -0
  227. package/package.json +12 -5
  228. package/dist/AuthProvider.handle-SRR_04XS.mjs +0 -50
  229. package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-nqKbgY7G.mjs +0 -58
  230. package/dist/Checkout.entry.ce-CopWuLJC.mjs +0 -4169
  231. package/dist/CheckoutAddressFields.vue_vue_type_script_setup_true_lang-CEnM1uxK.mjs +0 -828
  232. package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-Jyb5ZN3s.mjs +0 -136
  233. package/dist/CustomerShippingAddresses-BRPukhRI.mjs +0 -397
  234. package/dist/OrderSummaryInvoice.vue_vue_type_script_setup_true_lang-B_FpibLA.mjs +0 -441
  235. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-D07SEP8a.mjs +0 -181
  236. package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-CMRMbL3d.mjs +0 -161
  237. package/dist/PlanCustomizationEditor-B76UNEMm.mjs +0 -791
  238. package/dist/ShippingAddressesModal-c7nqf4Ny.mjs +0 -418
  239. package/dist/SubscriptionDetails.entry.ce-uYv45FGH.mjs +0 -1044
  240. package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-BZNsqN4G.mjs +0 -203
  241. package/dist/TrialChip.vue.es-C51z1ZiA.mjs +0 -35
  242. package/dist/addonQuantity-CCVaA3e-.mjs +0 -758
  243. package/dist/adyenSdk-B01MB9Ia.mjs +0 -58
  244. package/dist/getCountryNameByCode.es-BDHua7VM.mjs +0 -8
  245. package/dist/invoices-DdREPDXV.mjs +0 -123
  246. package/dist/paymentMethods-Goa25rTs.mjs +0 -61
  247. package/dist/payments-CKpU1K3t.mjs +0 -68
  248. package/dist/pricing-CEaZGgKe.mjs +0 -29
  249. package/dist/pricingPlanScheduleOverrides-BBp-DmpV.mjs +0 -233
  250. package/dist/pricingPlanSchedules-DSMptcAh.mjs +0 -38
  251. package/dist/subscriptions-B5bH8hsI.mjs +0 -66
  252. package/dist/taxId.es-e6NEvprh.mjs +0 -243
  253. package/dist/types/components/payments/ExpressPaymentMethodButton/ExpressPaymentMethodButton.types.d.ts +0 -3
  254. package/dist/useCustomerFormLabels-D4oDnfxA.mjs +0 -1173
  255. package/dist/usePaymentFormHold-Cwdr-vyc.mjs +0 -181
  256. package/dist/usePortal-DUfD6hrA.mjs +0 -7
  257. package/dist/useTimePeriod.es-BUorDLVK.mjs +0 -93
@@ -0,0 +1,1316 @@
1
+ import { shallowRef as G, ref as I, computed as m, effectScope as us, reactive as dt, onScopeDispose as ls, watch as te, onMounted as ds, defineComponent as xe, openBlock as R, createElementBlock as ps, createElementVNode as ms, createVNode as Nt, unref as x, withCtx as re, createTextVNode as pt, toDisplayString as mt, createBlock as $, mergeProps as vs, createCommentVNode as _s } from "vue";
2
+ import { u as fs, c as hs, b as gs, e as It, a as Pt, L as ys, f as A, d as vt, j as Es, k as Ss, l as Os } from "../../customElements-d7Bhfqi_.mjs";
3
+ import { D as ks, h as Cs, g as _t } from "../../useAddressFormats-Dw7IEdxg.mjs";
4
+ import { u as bs } from "../../useHostEvent-pjoWJ7ZH.mjs";
5
+ import { u as Ns, _ as wt, a as Is } from "../../useCheckoutForm-BaV2j_ob.mjs";
6
+ import { u as Ps } from "../../useWatchDebounced-DkXgKe0E.mjs";
7
+ import { u as ws } from "../../usePaymentMethodOptions-DDRjVvDJ.mjs";
8
+ import { c as Ts } from "../../subscriptions-Bm1eu9wc.mjs";
9
+ import { j as Ds, c as xs } from "../../subscription-DQ5mRp_e.mjs";
10
+ import { s as Ms } from "../../OrderSummaryInvoice.vue_vue_type_script_setup_true_lang-CnZwxJ5b.mjs";
11
+ import { b as ft, s as Ls } from "../../paymentRedirect-DaS8Kccc.mjs";
12
+ const Tt = ["line1", "line2", "city", "state", "postal_code", "country"], As = (n) => Cs(n);
13
+ function ce(n) {
14
+ var p, g, E, b, P, _;
15
+ if (!n) return {};
16
+ const o = n.type === "ORGANIZATION" ? (p = n.organization) == null ? void 0 : p.registered_address : (g = n.individual) == null ? void 0 : g.residential_address, a = (E = n.individual) == null ? void 0 : E.name, c = n.organization, l = (P = (b = c == null ? void 0 : c.tax_ids) == null ? void 0 : b[0]) == null ? void 0 : P.id, u = o == null ? void 0 : o.country;
17
+ return {
18
+ type: n.type,
19
+ ...n.email && { email: n.email },
20
+ ...((_ = n.organization) == null ? void 0 : _.legal_name) && {
21
+ companyLegalName: n.organization.legal_name
22
+ },
23
+ ...(a == null ? void 0 : a.first_name) && { firstName: a.first_name },
24
+ ...(a == null ? void 0 : a.infix) && { infix: a.infix },
25
+ ...(a == null ? void 0 : a.last_name) && { lastName: a.last_name },
26
+ ...l && { companyVatNumber: l },
27
+ ...(c == null ? void 0 : c.registration_number) && {
28
+ companyRegistrationNumber: c.registration_number
29
+ },
30
+ ...typeof (c == null ? void 0 : c.tax_exempt) == "boolean" && {
31
+ taxExempt: c.tax_exempt
32
+ },
33
+ ...(c == null ? void 0 : c.tax_exempt_note) && { taxExemptNote: c.tax_exempt_note },
34
+ ...(o == null ? void 0 : o.line1) && { addressLine1: o.line1 },
35
+ ...(o == null ? void 0 : o.line2) && { addressLine2: o.line2 },
36
+ ...(o == null ? void 0 : o.postal_code) && { postalCode: o.postal_code },
37
+ ...(o == null ? void 0 : o.city) && { city: o.city },
38
+ ...(o == null ? void 0 : o.state) && { state: o.state },
39
+ ...u && As(u) && { country: u }
40
+ };
41
+ }
42
+ const Pe = {
43
+ line1: "addressLine1",
44
+ line2: "addressLine2",
45
+ city: "city",
46
+ postal_code: "postalCode",
47
+ state: "state",
48
+ country: "country"
49
+ }, Dt = ["first_name", "infix", "last_name"], we = {
50
+ first_name: "firstName",
51
+ infix: "infix",
52
+ last_name: "lastName"
53
+ }, Rs = {
54
+ email: ["email"],
55
+ "organization.legal_name": ["companyLegalName"],
56
+ "organization.registration_number": ["companyRegistrationNumber"],
57
+ "organization.tax_id": ["companyVatNumber"],
58
+ "organization.tax_ids": ["companyVatNumber"],
59
+ "individual.name": ["firstName", "lastName"],
60
+ ...Object.fromEntries(
61
+ Dt.map((n) => [`individual.name.${n}`, [we[n]]])
62
+ ),
63
+ ...Object.fromEntries(
64
+ ["organization.registered_address", "individual.residential_address"].flatMap(
65
+ (n) => Tt.map((o) => [`${n}.${o}`, [Pe[o]]])
66
+ )
67
+ )
68
+ };
69
+ function Fs(n, o) {
70
+ var c;
71
+ const a = Array.from({ length: o }, () => []);
72
+ for (const l of n) {
73
+ const u = /^checkout_session\.customers\.(\d+)\.customer\.(.+)$/.exec(l), p = u && Rs[u[2]];
74
+ p && ((c = a[Number(u[1])]) == null || c.push(...p));
75
+ }
76
+ return a;
77
+ }
78
+ const ue = (n) => (n == null ? void 0 : n.trim()) || void 0;
79
+ function Us(n, o, a, c = () => !1) {
80
+ const l = ce(o), u = [], p = (O, C) => a[O] === "EDITABLE" && !C.some(c), g = (O) => {
81
+ const C = ue(n[O]);
82
+ if (!(!C || C === ue(l[O])))
83
+ return u.push(O), C;
84
+ }, E = () => {
85
+ const O = {};
86
+ for (const C of Tt) {
87
+ const w = g(Pe[C]);
88
+ w && (O[C] = w);
89
+ }
90
+ return Object.keys(O).length ? O : void 0;
91
+ }, b = () => {
92
+ const O = {};
93
+ for (const C of Dt) {
94
+ const w = g(we[C]);
95
+ w && (O[C] = w);
96
+ }
97
+ return Object.keys(O).length ? O : void 0;
98
+ }, P = {}, _ = p("email", ["email"]) ? g("email") : void 0;
99
+ _ && (P.email = _);
100
+ const N = p("address", Object.values(Pe)) ? E() : void 0;
101
+ if (o.type === "INDIVIDUAL") {
102
+ const O = p("customer_details", Object.values(we)) ? b() : void 0;
103
+ (O || N) && (P.individual = {
104
+ ...O && { name: O },
105
+ ...N && { residential_address: N }
106
+ });
107
+ } else {
108
+ const O = p("customer_details", ["companyLegalName"]) ? g("companyLegalName") : void 0, C = p("customer_details", ["companyRegistrationNumber"]) ? g("companyRegistrationNumber") : void 0, w = p("tax_ids", ["companyVatNumber"]) ? $s(n.companyVatNumber, o) : void 0;
109
+ w !== void 0 && u.push("companyVatNumber");
110
+ const J = p("tax_ids", []) && !!n.taxExempt != !!l.taxExempt ? !!n.taxExempt : void 0;
111
+ J !== void 0 && u.push("taxExempt");
112
+ const Z = p("tax_ids", ["taxExemptNote"]) && n.taxExempt ? g("taxExemptNote") : void 0, X = {
113
+ ...O && { legal_name: O },
114
+ ...C && { registration_number: C },
115
+ ...N && { registered_address: N },
116
+ ...w !== void 0 && { tax_ids: w },
117
+ ...J !== void 0 && { tax_exempt: J },
118
+ ...Z && { tax_exempt_note: Z }
119
+ };
120
+ Object.keys(X).length && (P.organization = X);
121
+ }
122
+ return Object.keys(P).length ? { patch: P, fields: u } : void 0;
123
+ }
124
+ function $s(n, o) {
125
+ var g, E;
126
+ const a = ((g = o.organization) == null ? void 0 : g.tax_ids) ?? [], c = ue(n);
127
+ if (c === ue((E = a[0]) == null ? void 0 : E.id)) return;
128
+ const [l, ...u] = a.map(({ id: b, type: P }) => ({ id: b, type: P })), p = c ? [{ id: c, type: (l == null ? void 0 : l.type) ?? ks }, ...u] : u;
129
+ return p.length ? p : null;
130
+ }
131
+ function Vs(n, o) {
132
+ var a, c, l, u;
133
+ return ((c = (a = n.pricing_plan_schedule_customizations) == null ? void 0 : a[0]) == null ? void 0 : c.pricing_plan_schedule_id) ?? ((u = (l = n.starting_values) == null ? void 0 : l[0]) == null ? void 0 : u.pricing_plan_schedule_id) ?? o;
134
+ }
135
+ function ht(n, o, a) {
136
+ var p, g;
137
+ const c = (p = n.pricing_plan_schedule_customizations) == null ? void 0 : p.find(
138
+ (E) => E.pricing_plan_schedule_id === o
139
+ ), l = (g = n.starting_values) == null ? void 0 : g.find(
140
+ (E) => E.pricing_plan_schedule_id === o
141
+ );
142
+ return [...new Map(
143
+ [...(l == null ? void 0 : l[a]) ?? [], ...(c == null ? void 0 : c[a]) ?? []].map(
144
+ ({ pricing_item_config_id: E, number: b }) => [E, b]
145
+ )
146
+ )].map(([E, b]) => ({
147
+ pricing_item_config_id: E,
148
+ number: b
149
+ }));
150
+ }
151
+ function gt(n, o) {
152
+ const a = (n ?? []).filter(
153
+ ({ pricing_item_config_id: l }) => !o.some((u) => u.pricing_item_config_id === l)
154
+ ), c = (l) => (n ?? []).map((u) => ({
155
+ pricing_item_config_id: u.pricing_item_config_id,
156
+ number: u[l].number
157
+ }));
158
+ return {
159
+ // Only what the buyer may change: a fixed quantity already shows in the order summary.
160
+ values: [
161
+ ...o.filter(
162
+ ({ pricing_item_config_id: l }) => (n ?? []).some(
163
+ (u) => u.pricing_item_config_id === l
164
+ )
165
+ ),
166
+ ...a.map(({ pricing_item_config_id: l, min: u }) => ({
167
+ pricing_item_config_id: l,
168
+ number: u.number
169
+ }))
170
+ ],
171
+ minimums: c("min"),
172
+ maximums: c("max")
173
+ };
174
+ }
175
+ const Hs = (n, o, a) => {
176
+ const c = Number(n);
177
+ return Number.isFinite(c) && (!a || Number.isInteger(c)) && c >= Number(o.min.number) && c <= Number(o.max.number);
178
+ };
179
+ function yt(n, o, a, { wholeOnly: c }) {
180
+ const l = (n ?? []).filter(({ pricing_item_config_id: u, number: p }) => {
181
+ const g = o == null ? void 0 : o.find(
182
+ (b) => b.pricing_item_config_id === u
183
+ ), E = a.find(
184
+ (b) => b.pricing_item_config_id === u
185
+ );
186
+ return !!g && Hs(p, g, c) && Number(p) !== Number(E == null ? void 0 : E.number);
187
+ });
188
+ return l.length ? l : void 0;
189
+ }
190
+ function Et(n, o) {
191
+ var a, c;
192
+ return (c = (a = n.pricing_plan_schedule_customizations) == null ? void 0 : a.find(
193
+ (l) => l.pricing_plan_schedule_id === o
194
+ )) == null ? void 0 : c.promotion_codes;
195
+ }
196
+ const js = ["email", "custom_fields", "individual", "organization"], zs = ["name", "residential_address"], Ks = ["first_name", "last_name", "infix"], Bs = ["line1", "line2", "city", "postal_code", "state", "country"], Ys = [
197
+ "legal_name",
198
+ "tax_id",
199
+ "tax_ids",
200
+ "registration_number",
201
+ "tax_exempt",
202
+ "tax_exempt_note",
203
+ "registered_address",
204
+ "tax_registrations"
205
+ ], Gs = [
206
+ "pricing_plan_schedule_id",
207
+ "seats_values",
208
+ "units",
209
+ "promotion_codes"
210
+ ];
211
+ function q(n, o, a = []) {
212
+ const c = {};
213
+ for (const l of o) {
214
+ const u = n[l];
215
+ u === void 0 || u === null && !a.includes(l) || (c[l] = u);
216
+ }
217
+ return c;
218
+ }
219
+ const St = (n) => q(n, Bs), Ws = (n) => {
220
+ const { individual: o, organization: a, ...c } = q(n, js, [
221
+ "custom_fields"
222
+ ]), l = o && q(o, zs), u = a && q(a, Ys, ["tax_ids", "tax_registrations"]);
223
+ return {
224
+ ...c,
225
+ ...l && {
226
+ individual: {
227
+ ...l.name && { name: q(l.name, Ks) },
228
+ ...l.residential_address && {
229
+ residential_address: St(l.residential_address)
230
+ }
231
+ }
232
+ },
233
+ ...u && {
234
+ organization: {
235
+ ...u,
236
+ ...u.registered_address && {
237
+ registered_address: St(u.registered_address)
238
+ },
239
+ // A stored id carries read-only keys, such as its validation result.
240
+ ...u.tax_ids && {
241
+ tax_ids: u.tax_ids.map(({ id: p, type: g }) => ({ id: p, type: g }))
242
+ }
243
+ }
244
+ }
245
+ };
246
+ }, qs = (n) => ({
247
+ ...q(n, Gs, ["promotion_codes"]),
248
+ pricing_plan_schedule_id: n.pricing_plan_schedule_id
249
+ }), Te = {}, Ot = (n, o) => {
250
+ const a = (n ?? []).map((c) => c ? o(c) : Te);
251
+ for (; a.length && Object.keys(a[a.length - 1]).length === 0; ) a.pop();
252
+ return a.length ? a : void 0;
253
+ };
254
+ function Ie(n, o) {
255
+ const a = Ot(o.customers, (l) => {
256
+ const u = Ws(l);
257
+ return Object.keys(u).length ? { customer: u } : Te;
258
+ }), c = Ot(
259
+ o.pricing_plan_subscriptions,
260
+ (l) => l.length ? { pricing_plan_schedule_customizations: l.map(qs) } : Te
261
+ );
262
+ return {
263
+ checkout_session: {
264
+ expected_version: n,
265
+ ...a && { customers: a },
266
+ ...c && { pricing_plan_subscriptions: c }
267
+ }
268
+ };
269
+ }
270
+ function Js(n) {
271
+ return !n.checkout_session.customers && !n.checkout_session.pricing_plan_subscriptions;
272
+ }
273
+ function Zs() {
274
+ const n = fs(), o = hs(), a = (c, ...l) => gs(n.apiUrls.transaction, "portal", "portal-urls", c, ...l);
275
+ return {
276
+ getCheckoutSession(c) {
277
+ return o({ url: a(c) });
278
+ },
279
+ /** A stale `expected_version` or a refused promotion code is a 400 the caller handles. */
280
+ updateCheckoutSession(c, l) {
281
+ return o({
282
+ url: a(c),
283
+ data: l,
284
+ options: { method: "PATCH", expectedStatusCodes: [400] }
285
+ });
286
+ },
287
+ previewCheckoutSession(c) {
288
+ return o({
289
+ url: a(c, "preview"),
290
+ options: { method: "POST" }
291
+ });
292
+ }
293
+ };
294
+ }
295
+ const Xs = 400, Qs = 3, eo = 250, kt = [1e3, 2e3, 4e3, 8e3, 16e3], to = "{CHECKOUT_SESSION_ID}", so = 1e3, oo = 15e3, no = 6e4, io = [
296
+ "email",
297
+ "companyLegalName",
298
+ "companyRegistrationNumber",
299
+ "taxExempt",
300
+ "taxExemptNote",
301
+ "firstName",
302
+ "infix",
303
+ "lastName",
304
+ "companyVatNumber",
305
+ "addressLine1",
306
+ "addressLine2",
307
+ "postalCode",
308
+ "city",
309
+ "state",
310
+ "country"
311
+ ], ao = (n, o, a) => {
312
+ n[a] = o[a];
313
+ }, co = (n, o) => {
314
+ const a = {};
315
+ for (const c in n)
316
+ o(c, n[c]) && (a[c] = n[c]);
317
+ return a;
318
+ }, ro = {
319
+ customer_details: "HIDDEN",
320
+ address: "HIDDEN",
321
+ tax_ids: "HIDDEN",
322
+ email: "HIDDEN",
323
+ custom_fields: "HIDDEN"
324
+ }, Ct = (n, o) => {
325
+ const a = Reflect.get(n.validation.value, o);
326
+ return typeof a == "object" && a !== null ? a : void 0;
327
+ }, bt = (n) => {
328
+ var a, c;
329
+ const o = (a = n.individual) == null ? void 0 : a.name;
330
+ return (n.type === "ORGANIZATION" ? (c = n.organization) == null ? void 0 : c.legal_name : [o == null ? void 0 : o.first_name, o == null ? void 0 : o.infix, o == null ? void 0 : o.last_name].filter(Boolean).join(" ")) || n.reference;
331
+ }, W = (n, o) => {
332
+ var a;
333
+ return A(n) && n.statusCode === 400 && !!((a = n.field) != null && a.endsWith(o));
334
+ }, ae = (n) => {
335
+ if (!W(n, "promotion_codes") || !A(n)) return;
336
+ const o = /pricing_plan_subscriptions\.(\d+)\./.exec(n.field ?? "");
337
+ return o ? Number(o[1]) : -1;
338
+ };
339
+ function uo({ portalUrlId: n }) {
340
+ const o = It(), { $t: a } = Pt(), c = Zs(), { getSubscription: l } = Ts(), u = G(), p = G(), g = G([]), E = I(!1), b = I(!1), P = I(!1), _ = m(() => {
341
+ var e;
342
+ return (e = u.value) == null ? void 0 : e.checkout_session;
343
+ }), N = m(
344
+ () => {
345
+ var e, t;
346
+ return ((e = u.value) == null ? void 0 : e.status) === "PUBLISHED" && ((t = _.value) == null ? void 0 : t.status) === "OPEN";
347
+ }
348
+ ), O = m(
349
+ () => {
350
+ var e;
351
+ return !!_.value && (((e = p.value) == null ? void 0 : e.checkout_session.version) ?? -1) < _.value.version;
352
+ }
353
+ ), C = m(() => {
354
+ var e, t;
355
+ return [
356
+ .../* @__PURE__ */ new Set([
357
+ ...((e = _.value) == null ? void 0 : e.missing_fields) ?? [],
358
+ ...O.value ? [] : ((t = p.value) == null ? void 0 : t.checkout_session.missing_fields) ?? []
359
+ ])
360
+ ];
361
+ }), w = m(
362
+ () => {
363
+ var e;
364
+ return Fs(C.value, ((e = _.value) == null ? void 0 : e.customers.length) ?? 0);
365
+ }
366
+ ), J = (e) => {
367
+ var s;
368
+ const t = (s = _.value) == null ? void 0 : s.customers[e];
369
+ if (t)
370
+ return t.customer ? t.effective_display : ro;
371
+ }, Z = (e) => Ns({
372
+ initialState: {},
373
+ // Every change is saved to the session, not only those that move the price.
374
+ onRequiredFieldChange: () => {
375
+ },
376
+ display: () => J(e),
377
+ alsoRequired: () => w.value[e] ?? [],
378
+ // A guess would be saved into the merchant's session as the customer's country.
379
+ guessCountry: !1
380
+ }), X = Z(0), T = G([X]), xt = us(), Mt = (e) => {
381
+ const t = xt.run(
382
+ () => Array.from(
383
+ { length: e - T.value.length },
384
+ (s, i) => Z(T.value.length + i)
385
+ )
386
+ );
387
+ t != null && t.length && (T.value = [...T.value, ...t]);
388
+ }, se = (e) => {
389
+ var i, r;
390
+ const t = (i = _.value) == null ? void 0 : i.pricing_plan_subscriptions[e], s = g.value[e];
391
+ if (t)
392
+ return Vs(
393
+ t,
394
+ s && ((r = Ds({
395
+ pricingPlanScheduleInfos: s.pricing_plan_schedule_infos,
396
+ type: "DEFAULT"
397
+ })) == null ? void 0 : r.id)
398
+ );
399
+ }, z = m(
400
+ () => {
401
+ var e;
402
+ return (((e = _.value) == null ? void 0 : e.pricing_plan_subscriptions) ?? []).flatMap(
403
+ (t, s) => {
404
+ var i;
405
+ return ((i = t.options) == null ? void 0 : i.allow_promotion_codes) === "SINGLE" ? [s] : [];
406
+ }
407
+ );
408
+ }
409
+ ), F = dt(/* @__PURE__ */ new Map()), Q = G([]), Me = (e, t, s, i) => {
410
+ var r;
411
+ return gt(
412
+ (r = e.options) == null ? void 0 : r[i],
413
+ ht(e, t, s)
414
+ ).values;
415
+ }, Le = (e) => {
416
+ var i;
417
+ const t = (i = _.value) == null ? void 0 : i.customers[e], s = T.value[e];
418
+ return t != null && t.customer && s ? Us(
419
+ s.form.value,
420
+ t.customer,
421
+ t.effective_display,
422
+ (r) => Reflect.get(Ct(s, r) ?? {}, "$invalid") === !0
423
+ ) : void 0;
424
+ }, Ae = dt(/* @__PURE__ */ new Map()), Re = (e, t) => Ae.get(e) === JSON.stringify(t), Lt = (e, t) => {
425
+ if (!e) return;
426
+ const s = `customers.${t}`, { individual: i, organization: r, ...d } = e, v = (S, k) => {
427
+ if (!S) return;
428
+ const L = co(S, (D, M) => !Re(`${k}.${D}`, M));
429
+ return Object.keys(L).length ? L : void 0;
430
+ }, y = v(i, `${s}.individual`), h = v(r, `${s}.organization`), f = {
431
+ ...v(d, s),
432
+ ...y && { individual: y },
433
+ ...h && { organization: h }
434
+ };
435
+ return Object.keys(f).length ? f : void 0;
436
+ }, At = (e) => [
437
+ ...(e.customers ?? []).flatMap(
438
+ (t, s) => Object.entries(t ?? {}).flatMap(
439
+ ([i, r]) => i === "individual" || i === "organization" ? Object.entries(r ?? {}).map(([d, v]) => [
440
+ `customers.${s}.${i}.${d}`,
441
+ v
442
+ ]) : [[`customers.${s}.${i}`, r]]
443
+ )
444
+ ),
445
+ ...(e.pricing_plan_subscriptions ?? []).flatMap(
446
+ (t, s) => (t ?? []).flatMap(
447
+ (i) => ["seats_values", "units"].flatMap(
448
+ (r) => (i[r] ?? []).map(
449
+ ({ pricing_item_config_id: d, number: v }) => [
450
+ `subs.${s}.${r}.${d}`,
451
+ v
452
+ ]
453
+ )
454
+ )
455
+ )
456
+ )
457
+ ], Rt = (e, t) => {
458
+ const [s, i, ...r] = (t ?? "").replace(/^checkout_session\./, "").split("."), d = s === "customers" && /^\d+$/.test(i ?? "") ? [["customers", i, ...r.slice(1, 3)].join("."), `customers.${i}`] : s === "pricing_plan_subscriptions" && /^\d+$/.test(i ?? "") ? [["subs", i, ...r.slice(2, 3)].join("."), `subs.${i}`] : [], v = At(e), y = (f, S) => f === S || f.startsWith(`${S}.`), h = d.find(
459
+ (f) => v.some(([S]) => y(S, f))
460
+ );
461
+ for (const [f, S] of v)
462
+ (h === void 0 || y(f, h)) && Ae.set(f, JSON.stringify(S));
463
+ }, le = () => {
464
+ const e = _.value;
465
+ if (!e) return {};
466
+ const t = e.pricing_plan_subscriptions.map((s, i) => {
467
+ var h, f;
468
+ const r = se(i);
469
+ if (!r) return;
470
+ const d = {
471
+ pricing_plan_schedule_id: r
472
+ }, v = Q.value[i];
473
+ if (v) {
474
+ const S = yt(
475
+ v.seatsValues.value,
476
+ (h = s.options) == null ? void 0 : h.edit_seats,
477
+ Me(s, r, "seats_values", "edit_seats"),
478
+ { wholeOnly: !0 }
479
+ ), k = yt(
480
+ v.unitsValues.value,
481
+ (f = s.options) == null ? void 0 : f.edit_units,
482
+ Me(s, r, "units", "edit_units"),
483
+ { wholeOnly: !1 }
484
+ ), L = (K, B) => B == null ? void 0 : B.filter(
485
+ ({ pricing_item_config_id: Y, number: j }) => !Re(`subs.${i}.${K}.${Y}`, j)
486
+ ), D = L("seats_values", S), M = L("units", k);
487
+ D != null && D.length && (d.seats_values = D), M != null && M.length && (d.units = M);
488
+ }
489
+ const y = F.get(i);
490
+ if (y !== void 0 && z.value.includes(i)) {
491
+ const S = y ? [y] : null, k = Et(s, r);
492
+ ((S == null ? void 0 : S[0]) ?? null) !== ((k == null ? void 0 : k[0]) ?? null) && (d.promotion_codes = S);
493
+ }
494
+ return Object.keys(d).length > 1 ? [d] : void 0;
495
+ });
496
+ return {
497
+ customers: T.value.map(
498
+ (s, i) => {
499
+ var r;
500
+ return Lt((r = Le(i)) == null ? void 0 : r.patch, i);
501
+ }
502
+ ),
503
+ pricing_plan_subscriptions: t
504
+ };
505
+ }, de = (e) => {
506
+ const t = Ie(0, e);
507
+ return Js(t) ? "" : JSON.stringify(t);
508
+ }, pe = m(() => _.value && N.value ? de(le()) : ""), me = I(), Ft = m(
509
+ () => !!pe.value && pe.value !== me.value
510
+ );
511
+ let Fe = !1;
512
+ const ve = /* @__PURE__ */ new Set();
513
+ ls(() => {
514
+ Fe = !0, ve.forEach(clearTimeout);
515
+ });
516
+ const _e = (e) => new Promise((t) => {
517
+ const s = setTimeout(() => {
518
+ ve.delete(s), t();
519
+ }, e);
520
+ ve.add(s);
521
+ }), fe = I(0), Ut = m(() => fe.value > 0), he = I(!1), Ue = (e) => o.error("INVOICE_PREVIEW_FAILED", "Failed to preview the checkout session", {}, e), V = async ({ onFailure: e = Ue } = {}) => {
522
+ var t;
523
+ fe.value++;
524
+ try {
525
+ for (let s = 0; s < Qs; s++) {
526
+ s > 0 && await _e(eo * 2 ** (s - 1));
527
+ const i = await c.previewCheckoutSession(n);
528
+ if ((!p.value || i.checkout_session.version >= p.value.checkout_session.version) && (p.value = i), he.value = !1, i.checkout_session.version >= (((t = _.value) == null ? void 0 : t.version) ?? 0)) return;
529
+ }
530
+ } catch (s) {
531
+ he.value = !0, e(s);
532
+ } finally {
533
+ fe.value--;
534
+ }
535
+ }, $t = (e, t, s, i) => {
536
+ var y, h;
537
+ const r = _t(ce(t)), d = _t(ce((h = (y = _.value) == null ? void 0 : y.customers[e]) == null ? void 0 : h.customer)), v = T.value[e].form.value;
538
+ for (const f of io) {
539
+ const S = v[f] === s[f], k = i.includes(f) || s[f] === r[f];
540
+ S && k && v[f] !== d[f] && ao(v, d, f);
541
+ }
542
+ }, $e = (e) => T.value.map((t, s) => {
543
+ var i, r, d;
544
+ return {
545
+ before: (r = (i = _.value) == null ? void 0 : i.customers[s]) == null ? void 0 : r.customer,
546
+ form: { ...t.form.value },
547
+ fields: e ? ((d = Le(s)) == null ? void 0 : d.fields) ?? [] : []
548
+ };
549
+ }), Ve = (e) => e.forEach(
550
+ ({ before: t, form: s, fields: i }, r) => $t(r, t, s, i)
551
+ ), Vt = async () => {
552
+ if (!_.value || !N.value) return;
553
+ const e = le(), t = de(e);
554
+ if (!t || t === me.value) return;
555
+ const s = $e(!0), i = new Map(F);
556
+ E.value = !0;
557
+ try {
558
+ try {
559
+ u.value = await c.updateCheckoutSession(
560
+ n,
561
+ Ie(_.value.version, e)
562
+ );
563
+ } catch (r) {
564
+ if (!W(r, "expected_version")) throw r;
565
+ if (u.value = await c.getCheckoutSession(n), !N.value) return;
566
+ u.value = await c.updateCheckoutSession(
567
+ n,
568
+ Ie(u.value.checkout_session.version, e)
569
+ );
570
+ }
571
+ Ve(s);
572
+ for (const [r, d] of i)
573
+ F.get(r) === d && F.delete(r);
574
+ de(le()) === t && (me.value = t, o.warn(
575
+ "CHECKOUT_SESSION_EDIT_NOT_APPLIED",
576
+ "The checkout session was saved but kept a value the customer changed"
577
+ ));
578
+ } catch (r) {
579
+ throw A(r) && r.statusCode === 400 && !W(r, "expected_version") && ae(r) === void 0 && Rt(e, r.field), jt(r), r;
580
+ } finally {
581
+ E.value = !1;
582
+ }
583
+ await V();
584
+ };
585
+ let He = Promise.resolve();
586
+ const ge = () => {
587
+ const e = He.then(Vt);
588
+ return He = e.catch(() => {
589
+ }), e;
590
+ }, je = (e) => A(e) && e.statusCode === 400;
591
+ let oe = 0, ye = !1;
592
+ const Ht = (e) => {
593
+ !(!A(e) || e.statusCode >= 500) || ye || oe >= kt.length || (ye = !0, _e(kt[oe++]).then(() => (ye = !1, Ee())));
594
+ }, Ee = () => ge().then(
595
+ () => {
596
+ oe = 0;
597
+ },
598
+ (e) => {
599
+ if (Ht(e), je(e)) {
600
+ o.warn(
601
+ "CHECKOUT_SESSION_UPDATE_REFUSED",
602
+ "The API refused a change to the checkout session",
603
+ { field: A(e) ? e.field : void 0 },
604
+ e
605
+ );
606
+ return;
607
+ }
608
+ o.error(
609
+ "CHECKOUT_SESSION_UPDATE_FAILED",
610
+ "Failed to save the checkout session",
611
+ {},
612
+ e
613
+ );
614
+ }
615
+ );
616
+ Ps(
617
+ () => pe.value,
618
+ () => {
619
+ oe = 0, Ee();
620
+ },
621
+ { debounce: Xs }
622
+ );
623
+ const ze = /* @__PURE__ */ new Map(), ne = (e) => {
624
+ let t = ze.get(e);
625
+ return t || (t = { code: I(null), isPending: I(!1), errorMessage: I(null) }, ze.set(e, t)), t;
626
+ }, Ke = (e) => {
627
+ var s, i;
628
+ const t = (s = _.value) == null ? void 0 : s.pricing_plan_subscriptions[e];
629
+ return t ? ((i = Et(t, se(e))) == null ? void 0 : i[0]) ?? null : null;
630
+ };
631
+ te(_, () => {
632
+ for (const e of z.value) {
633
+ const t = ne(e);
634
+ t.isPending.value || (t.code.value = Ke(e));
635
+ }
636
+ });
637
+ const Be = (e) => a(e === "apply" ? {
638
+ defaultMessage: "Promotion code could not be applied. Please try again.",
639
+ id: "checkout.promotion_code.apply_failed",
640
+ description: "Error message when applying a promotion code in checkout failed"
641
+ } : {
642
+ defaultMessage: "Promotion code could not be removed. Please try again.",
643
+ id: "checkout.promotion_code.remove_failed",
644
+ description: "Error message when removing a promotion code in checkout failed"
645
+ });
646
+ function jt(e) {
647
+ const t = ae(e);
648
+ if (t !== void 0)
649
+ for (const [s, i] of [...F])
650
+ t !== -1 && t !== s || (F.delete(s), ne(s).errorMessage.value = i ? a({
651
+ defaultMessage: "This promotion code is not valid.",
652
+ id: "checkout_session.promotion_code.rejected",
653
+ description: "Error shown under the promotion code field when the code the customer entered was not accepted"
654
+ }) : Be("remove"), o.warn(
655
+ "PROMOTION_CODE_REJECTED",
656
+ "The promotion code was not accepted",
657
+ {},
658
+ e
659
+ ));
660
+ }
661
+ const Ye = async (e, t, s) => {
662
+ const i = ne(e);
663
+ F.set(e, t), i.errorMessage.value = null, i.isPending.value = !0;
664
+ try {
665
+ for (let r = 0; ; r++)
666
+ try {
667
+ await ge();
668
+ break;
669
+ } catch (d) {
670
+ const v = ae(d);
671
+ if (!(v !== void 0 && v !== -1 && v !== e) || r >= z.value.length)
672
+ throw d;
673
+ }
674
+ } catch (r) {
675
+ ae(r) === void 0 && (je(r) ? o.warn(
676
+ "CHECKOUT_SESSION_UPDATE_REFUSED",
677
+ "The API refused a change to the checkout session",
678
+ { field: A(r) ? r.field : void 0 },
679
+ r
680
+ ) : o.capture(r, {
681
+ code: s === "apply" ? "PROMOTION_CODE_APPLY_FAILED" : "PROMOTION_CODE_REMOVE_FAILED",
682
+ message: "Failed to change the promotion code of the checkout session"
683
+ }), i.errorMessage.value = Be(s)), F.delete(e), Ee();
684
+ } finally {
685
+ i.isPending.value = !1, i.code.value = Ke(e);
686
+ }
687
+ }, Ge = (e) => {
688
+ const t = () => ne(e());
689
+ return {
690
+ isAllowed: m(() => N.value && e() !== -1),
691
+ code: m({
692
+ get: () => t().code.value,
693
+ set: (s) => t().code.value = s
694
+ }),
695
+ isPending: m(() => t().isPending.value),
696
+ errorMessage: m({
697
+ get: () => t().errorMessage.value,
698
+ set: (s) => t().errorMessage.value = s
699
+ }),
700
+ apply: (s) => {
701
+ const i = s == null ? void 0 : s.trim();
702
+ return i ? Ye(e(), i, "apply") : void 0;
703
+ },
704
+ remove: () => Ye(e(), null, "remove")
705
+ };
706
+ }, We = m(
707
+ () => z.value.length === 1 ? z.value[0] : -1
708
+ ), zt = async (e) => {
709
+ g.value = await Promise.all(
710
+ e.checkout_session.pricing_plan_subscriptions.map(
711
+ ({ template_pricing_plan_subscription_id: t }) => l({ id: t, expanded: !0 }).catch((s) => {
712
+ o.error(
713
+ "SUBSCRIPTION_LOAD_FAILED",
714
+ "Failed to load the plan of a checkout session subscription",
715
+ {},
716
+ s
717
+ );
718
+ })
719
+ )
720
+ );
721
+ }, Kt = () => {
722
+ const e = _.value, t = (e == null ? void 0 : e.pricing_plan_subscriptions) ?? [];
723
+ Q.value = t.map((s, i) => {
724
+ const r = g.value[i], d = se(i);
725
+ if (!r) return;
726
+ const v = {
727
+ ...r,
728
+ name: s.pricing_plan_subscription.name ?? r.name
729
+ }, y = (k, L) => {
730
+ var D;
731
+ return gt(
732
+ (D = s.options) == null ? void 0 : D[L],
733
+ d ? ht(s, d, k) : []
734
+ );
735
+ }, h = y("seats_values", "edit_seats"), f = y("units", "edit_units"), S = z.value.includes(i) && We.value === -1;
736
+ return {
737
+ key: `${i}`,
738
+ subscription: v,
739
+ ...t.length > 1 && {
740
+ title: xs({
741
+ subscription: v,
742
+ fallback: a({
743
+ defaultMessage: "Subscription",
744
+ description: "The fallback name for when no subscription name can be determined",
745
+ id: "customer_overview.subscriptions_block.fallback_subscription_name"
746
+ })
747
+ })
748
+ },
749
+ seatsValues: I(h.values),
750
+ unitsValues: I(f.values),
751
+ minimums: { seatsValues: h.minimums, unitsValues: f.minimums },
752
+ maximums: { seatsValues: h.maximums, unitsValues: f.maximums },
753
+ editableConfigIds: [...h.minimums, ...f.minimums].map(
754
+ ({ pricing_item_config_id: k }) => k
755
+ ),
756
+ ...S && { promotionCode: Ge(() => i) }
757
+ };
758
+ }), T.value.forEach(
759
+ (s, i) => {
760
+ var r;
761
+ return s.updateInitialState(ce((r = e == null ? void 0 : e.customers[i]) == null ? void 0 : r.customer));
762
+ }
763
+ );
764
+ }, Bt = m(() => {
765
+ const e = /* @__PURE__ */ new Map();
766
+ return g.value.forEach((t, s) => {
767
+ var y;
768
+ if (!t) return;
769
+ const i = se(s), r = t.pricing_plan_schedule_infos.find(
770
+ ({ id: h }) => h === i
771
+ ), d = (((y = r == null ? void 0 : r.pricing_plan_schedule) == null ? void 0 : y.enabled_pricings) ?? []).map(({ pricing_id: h }) => h), v = {
772
+ scheduleInfo: r,
773
+ enabledPricingIds: d,
774
+ billingPeriod: t.billing_period
775
+ };
776
+ e.set(
777
+ JSON.stringify([i, d, t.billing_period]),
778
+ v
779
+ );
780
+ }), [...e.values()];
781
+ }), ee = I(!1);
782
+ te([ee, w], () => {
783
+ ee.value && T.value.forEach((e, t) => {
784
+ for (const s of w.value[t] ?? []) {
785
+ const i = Reflect.get(Ct(e, s) ?? {}, "$touch");
786
+ typeof i == "function" && i();
787
+ }
788
+ });
789
+ });
790
+ const qe = m(() => {
791
+ if (!u.value) return;
792
+ if (N.value) return P.value ? "PROCESSING" : void 0;
793
+ const { status: e } = u.value.checkout_session;
794
+ return e === "OPEN" ? "CLOSED" : e;
795
+ }), Je = (e) => e == null ? void 0 : e.replaceAll(to, encodeURIComponent(n)), Ze = m(() => {
796
+ var e;
797
+ return Je((e = _.value) == null ? void 0 : e.success_url);
798
+ }), Xe = I(!1), { dispatch: Yt, componentName: Gt } = bs(), Qe = I(!1);
799
+ let et = !1;
800
+ te(
801
+ qe,
802
+ (e) => {
803
+ const t = e === "COMPLETED" && !Qe.value ? ft(Ze.value ?? "") : "";
804
+ Xe.value = !!t, t && Ls(t);
805
+ },
806
+ { immediate: !0 }
807
+ );
808
+ const Wt = async () => {
809
+ var s;
810
+ let e;
811
+ const [t] = await Promise.all([
812
+ c.getCheckoutSession(n),
813
+ V({ onFailure: (i) => e = i })
814
+ ]);
815
+ if (e !== void 0 && Ue(e), t.status !== "PUBLISHED" || t.checkout_session.status !== "OPEN") {
816
+ u.value = t, t.checkout_session.status === "PROCESSING" && be({ isPaid: !0, isRead: !0 });
817
+ return;
818
+ }
819
+ await zt(t), Mt(t.checkout_session.customers.length), u.value = t, Kt(), ee.value = !0, (((s = p.value) == null ? void 0 : s.checkout_session.version) ?? -1) < t.checkout_session.version && await V();
820
+ }, Se = G();
821
+ ds(async () => {
822
+ try {
823
+ await Wt();
824
+ } catch (e) {
825
+ Se.value = A(e) && e.statusCode === 410 ? {
826
+ reason: ys[e.errorCode ?? ""] ?? "expired",
827
+ status: e.checkoutSessionStatus
828
+ } : {}, o.error(
829
+ "CHECKOUT_SESSION_LOAD_FAILED",
830
+ "Failed to load the checkout session",
831
+ {},
832
+ e
833
+ );
834
+ }
835
+ });
836
+ const H = m(
837
+ () => {
838
+ var e, t, s;
839
+ return (s = (t = (e = p.value) == null ? void 0 : e.invoices) == null ? void 0 : t[0]) == null ? void 0 : s.invoice;
840
+ }
841
+ ), qt = m(() => {
842
+ var s, i, r, d, v, y, h, f, S, k, L, D;
843
+ const e = (r = (i = (s = p.value) == null ? void 0 : s.invoices) == null ? void 0 : i[0]) == null ? void 0 : r.pricing_plan_subscription_references;
844
+ if (!e || e.length < 2) return;
845
+ const t = /* @__PURE__ */ new Map();
846
+ for (const M of e) {
847
+ const K = (y = (v = (d = p.value) == null ? void 0 : d.per_subscription) == null ? void 0 : v.find((U) => U.pricing_plan_subscription_reference === M)) == null ? void 0 : y.invoice_infos.flatMap((U) => U.invoices.slice(0, 1)), B = ((h = _.value) == null ? void 0 : h.pricing_plan_subscriptions.findIndex(
848
+ (U) => U.pricing_plan_subscription.reference === M
849
+ )) ?? -1, Y = (S = (f = _.value) == null ? void 0 : f.pricing_plan_subscriptions[B]) == null ? void 0 : S.pricing_plan_subscription;
850
+ if (!(K != null && K.length) || !Y) return;
851
+ const j = Y.customer_reference ?? Y.customer_id ?? M, rt = (L = (k = _.value) == null ? void 0 : k.customers.find(
852
+ (U) => {
853
+ var lt;
854
+ return ((lt = U.customer) == null ? void 0 : lt.reference) === j || U.customer_id === j;
855
+ }
856
+ )) == null ? void 0 : L.customer, Ne = t.get(j) ?? {
857
+ key: j,
858
+ title: rt ? bt(rt) : Y.name ?? M,
859
+ invoices: [],
860
+ subscriptions: []
861
+ };
862
+ Ne.invoices.push(...K);
863
+ const ut = (D = Q.value[B]) == null ? void 0 : D.subscription;
864
+ ut && Ne.subscriptions.push(ut), t.set(j, Ne);
865
+ }
866
+ return t.size > 1 ? [...t.values()] : void 0;
867
+ }), Jt = te(p, (e) => {
868
+ var t, s;
869
+ (((t = e == null ? void 0 : e.invoices) == null ? void 0 : t.length) ?? 0) <= 1 || (o.warn(
870
+ "CHECKOUT_SESSION_SEVERAL_INVOICES",
871
+ "The checkout session previewed several invoices; only the first is shown",
872
+ { count: (s = e == null ? void 0 : e.invoices) == null ? void 0 : s.length }
873
+ ), Jt());
874
+ }), tt = m(() => {
875
+ var t;
876
+ const e = (t = p.value) == null ? void 0 : t.total;
877
+ return e ? { quantity: e.amount_incl_tax, currency: e.currency } : void 0;
878
+ }), st = m(
879
+ () => H.value ? Ms(H.value) : void 0
880
+ ), Zt = m(() => {
881
+ var t;
882
+ const e = st.value;
883
+ if (e)
884
+ return e.hasOneOff ? e.hasUnattributed ? void 0 : e.recurring.includingTax : (t = H.value) == null ? void 0 : t.invoice_amount_including_tax;
885
+ }), Oe = m(() => Ft.value || O.value), Xt = m(
886
+ () => N.value && !!tt.value && !Oe.value && C.value.length === 0
887
+ ), Qt = async () => {
888
+ try {
889
+ await ge();
890
+ } catch {
891
+ return "FAILED";
892
+ }
893
+ return O.value && await V(), Oe.value ? "CHANGED" : "SETTLED";
894
+ }, {
895
+ paymentMethodOptions: ot,
896
+ get: es,
897
+ isPending: ts,
898
+ error: ss
899
+ } = ws(), ke = I(), nt = () => {
900
+ var e, t;
901
+ return JSON.stringify([ie.value, (t = (e = H.value) == null ? void 0 : e.billing_entity) == null ? void 0 : t.id]);
902
+ };
903
+ let it = 0;
904
+ const Ce = () => {
905
+ const e = nt(), t = ++it;
906
+ return es({ portalUrlId: n }, { fresh: !0 }).then(
907
+ () => {
908
+ t === it && (ke.value = e);
909
+ },
910
+ (s) => {
911
+ o.error(
912
+ "PAYMENT_METHOD_OPTIONS_LOAD_FAILED",
913
+ "Failed to load the payment methods that can be offered",
914
+ { flow: "CHECKOUT_SESSION" },
915
+ s
916
+ );
917
+ }
918
+ );
919
+ }, os = m(
920
+ () => ss.value !== null && !(ot.value.length && ke.value === nt())
921
+ ), ns = async (e) => {
922
+ try {
923
+ const t = await c.getCheckoutSession(n);
924
+ e && t.checkout_session.status === "COMPLETED" && !et && (et = !0, Qe.value = !Yt("solvimon-payment-succeeded", {
925
+ componentName: Gt
926
+ })), (t.status !== "PUBLISHED" || t.checkout_session.status !== "OPEN") && (u.value = t);
927
+ const { status: s } = t.checkout_session;
928
+ return s === "COMPLETED" || s === "FAILED" || t.status !== "PUBLISHED";
929
+ } catch (t) {
930
+ return o.warn(
931
+ "CHECKOUT_SESSION_COMPLETION_CHECK_FAILED",
932
+ "Failed to read the checkout session while waiting for it to complete",
933
+ {},
934
+ t
935
+ ), !1;
936
+ }
937
+ };
938
+ let at = 0;
939
+ const be = async ({
940
+ isPaid: e,
941
+ isRead: t = !1
942
+ }) => {
943
+ const s = ++at, i = () => !Fe && s === at;
944
+ let r = 0;
945
+ for (let d = 0; i(); d++) {
946
+ if ((d > 0 || !t) && await ns(e)) return;
947
+ const v = Math.min(
948
+ so * 2 ** d,
949
+ oo
950
+ );
951
+ if (!i() || r + v > no) break;
952
+ r += v, await _e(v);
953
+ }
954
+ e && i() && (P.value = !0);
955
+ }, is = async () => {
956
+ try {
957
+ const e = $e(!1);
958
+ u.value = await c.getCheckoutSession(n), Ve(e);
959
+ } catch (e) {
960
+ o.error(
961
+ "CHECKOUT_SESSION_LOAD_FAILED",
962
+ "Failed to load the checkout session",
963
+ {},
964
+ e
965
+ );
966
+ }
967
+ await V();
968
+ }, as = (e) => {
969
+ const t = [e == null ? void 0 : e.apiError, e == null ? void 0 : e.error].find(A);
970
+ if (t) {
971
+ if (W(t, "checkout_session.status")) {
972
+ be({ isPaid: !1 });
973
+ return;
974
+ }
975
+ if (t.statusCode === 409) {
976
+ is();
977
+ return;
978
+ }
979
+ if (W(t, "payment_acceptor_id")) {
980
+ ke.value = void 0, Ce();
981
+ return;
982
+ }
983
+ if (W(t, "checkout_session.version"))
984
+ return V(), "PRICE_CHANGED";
985
+ }
986
+ }, ct = m(() => {
987
+ var i, r, d, v, y, h, f;
988
+ const e = (r = (i = p.value) == null ? void 0 : i.invoices) == null ? void 0 : r[0], t = ((v = (d = _.value) == null ? void 0 : d.payment) == null ? void 0 : v.customer_reference) ?? (e == null ? void 0 : e.customer_reference), s = ((h = (y = _.value) == null ? void 0 : y.payment) == null ? void 0 : h.customer_id) ?? (e == null ? void 0 : e.customer_id);
989
+ return (f = _.value) == null ? void 0 : f.customers.find(
990
+ (S) => {
991
+ var k;
992
+ return !!t && ((k = S.customer) == null ? void 0 : k.reference) === t || !!s && S.customer_id === s;
993
+ }
994
+ );
995
+ }), ie = m(() => {
996
+ var r, d, v, y, h;
997
+ const e = ct.value, t = e == null ? void 0 : e.customer;
998
+ if (t) {
999
+ const f = ((r = t.organization) == null ? void 0 : r.registered_address) ?? ((d = t.individual) == null ? void 0 : d.residential_address);
1000
+ return (f == null ? void 0 : f.country) || void 0;
1001
+ }
1002
+ if (!e) return;
1003
+ const s = (v = H.value) == null ? void 0 : v.customer;
1004
+ if (!s) return;
1005
+ const i = "organization" in s ? (y = s.organization) == null ? void 0 : y.registered_address : (h = s.individual) == null ? void 0 : h.residential_address;
1006
+ return (i == null ? void 0 : i.country) || void 0;
1007
+ }), cs = m(() => {
1008
+ var s;
1009
+ const e = ct.value;
1010
+ if (e && !e.customer) return ie.value;
1011
+ const t = T.value[e ? ((s = _.value) == null ? void 0 : s.customers.indexOf(e)) ?? 0 : 0];
1012
+ return (t == null ? void 0 : t.form.value.country) || ie.value;
1013
+ });
1014
+ te(
1015
+ [
1016
+ ee,
1017
+ N,
1018
+ ie,
1019
+ () => {
1020
+ var e, t;
1021
+ return (t = (e = H.value) == null ? void 0 : e.billing_entity) == null ? void 0 : t.id;
1022
+ },
1023
+ () => {
1024
+ var e, t;
1025
+ return (t = (e = p.value) == null ? void 0 : e.total) == null ? void 0 : t.amount_incl_tax;
1026
+ },
1027
+ () => {
1028
+ var e, t;
1029
+ return (t = (e = p.value) == null ? void 0 : e.total) == null ? void 0 : t.currency;
1030
+ }
1031
+ ],
1032
+ () => {
1033
+ ee.value && N.value && Ce();
1034
+ }
1035
+ );
1036
+ const rs = {
1037
+ paymentMethodOptions: ot,
1038
+ isPaymentMethodsPending: ts,
1039
+ hasPaymentMethodOptionsError: os,
1040
+ retryPaymentMethodOptions: () => void Ce(),
1041
+ countryCode: cs,
1042
+ authorizationContext: m(
1043
+ () => p.value ? {
1044
+ type: "CHECKOUT_SESSION",
1045
+ checkout_session: {
1046
+ portal_url_id: n,
1047
+ version: p.value.checkout_session.version
1048
+ }
1049
+ } : void 0
1050
+ ),
1051
+ awaitCompletion: () => void be({ isPaid: !0 }),
1052
+ recoverPaymentFailure: as
1053
+ };
1054
+ return {
1055
+ source: {
1056
+ // The first section's copy, under the name the session gives it.
1057
+ subscription: m(() => {
1058
+ var e;
1059
+ return ((e = Q.value[0]) == null ? void 0 : e.subscription) ?? g.value[0];
1060
+ }),
1061
+ hasSubscriptionLoadFailed: m(() => !!Se.value),
1062
+ orderMeterValues: m(() => ({})),
1063
+ chargedSchedules: Bt,
1064
+ planCustomizations: m(
1065
+ () => Q.value.filter((e) => e !== void 0)
1066
+ ),
1067
+ checkoutForm: X,
1068
+ customerForms: m(() => {
1069
+ var s;
1070
+ const e = ((s = _.value) == null ? void 0 : s.customers) ?? [], t = e.filter(
1071
+ ({ effective_display: i }) => !Object.values(i).every((r) => r === "HIDDEN")
1072
+ );
1073
+ return e.flatMap((i, r) => {
1074
+ const d = T.value[r];
1075
+ return !i.customer || !d || !t.includes(i) ? [] : [
1076
+ {
1077
+ key: `${r}`,
1078
+ form: d,
1079
+ display: i.effective_display,
1080
+ isTypeLocked: !0,
1081
+ ...t.length > 1 && { title: bt(i.customer) }
1082
+ }
1083
+ ];
1084
+ });
1085
+ }),
1086
+ isShippingAddressRequired: !1,
1087
+ invoicePreview: H,
1088
+ invoiceSections: qt,
1089
+ invoicePreviewByBillingPeriod: m(() => ({})),
1090
+ trialInvoicePreview: m(() => {
1091
+ }),
1092
+ trialPeriod: m(() => {
1093
+ }),
1094
+ isInvoicePreviewPending: m(() => Ut.value || E.value),
1095
+ isInvoicePreviewStale: Oe,
1096
+ isInvoicePreviewFailed: he,
1097
+ loadInvoicePreview: () => V(),
1098
+ settleInvoicePreview: Qt,
1099
+ amount: tt,
1100
+ recurringAmount: Zt,
1101
+ hasOneOffCharges: m(() => {
1102
+ var e;
1103
+ return ((e = st.value) == null ? void 0 : e.hasOneOff) ?? !1;
1104
+ }),
1105
+ pricingCurrency: m(() => {
1106
+ var e, t;
1107
+ return (t = (e = p.value) == null ? void 0 : e.total) == null ? void 0 : t.currency;
1108
+ }),
1109
+ promotionCode: Ge(() => We.value),
1110
+ payment: rs,
1111
+ canPay: Xt,
1112
+ isPaid: b,
1113
+ successUrl: Ze,
1114
+ cancelUrl: m(
1115
+ () => {
1116
+ var e;
1117
+ return ft(Je((e = _.value) == null ? void 0 : e.cancel_url) ?? "") || void 0;
1118
+ }
1119
+ ),
1120
+ note: m(() => {
1121
+ var e;
1122
+ return (e = _.value) == null ? void 0 : e.note;
1123
+ })
1124
+ },
1125
+ /** What the screen that lists every customer and subscription reads. */
1126
+ portalUrl: u,
1127
+ session: _,
1128
+ preview: p,
1129
+ templates: g,
1130
+ isOpen: N,
1131
+ missingFields: C,
1132
+ endState: qe,
1133
+ isRedirecting: Xe,
1134
+ loadFailure: Se
1135
+ };
1136
+ }
1137
+ const lo = { class: "sv-checkout-ended flex min-h-96 w-full items-center justify-center" }, po = { class: "max-w-sm" }, De = /* @__PURE__ */ xe({
1138
+ __name: "CheckoutSessionEnded",
1139
+ props: {
1140
+ reason: { type: String },
1141
+ status: { type: String },
1142
+ isRedirecting: { type: Boolean }
1143
+ },
1144
+ setup(n) {
1145
+ const o = n, { $t: a } = Pt(), c = () => a({
1146
+ defaultMessage: "Contact customer support if you think this is a mistake.",
1147
+ description: "Shown below the notice that an element is no longer available",
1148
+ id: "portal.not_available.description"
1149
+ }), l = m(() => o.status === "COMPLETED" ? {
1150
+ title: a({
1151
+ defaultMessage: "This checkout has been completed",
1152
+ id: "checkout_session.ended.completed_title",
1153
+ description: "Shown in place of a checkout that the customer already paid for"
1154
+ }),
1155
+ message: o.isRedirecting ? a({
1156
+ defaultMessage: "Taking you back…",
1157
+ id: "checkout_session.ended.redirecting_message",
1158
+ description: "Shown under the completed checkout notice while the page goes to the shop"
1159
+ }) : void 0
1160
+ } : o.status === "FAILED" ? {
1161
+ title: a({
1162
+ defaultMessage: "We received your payment",
1163
+ id: "checkout_session.ended.failed_title",
1164
+ description: "Shown in place of a checkout that was paid for but whose account could not be set up yet"
1165
+ }),
1166
+ message: a({
1167
+ defaultMessage: "We are finishing your account. There is nothing more you need to do.",
1168
+ id: "checkout_session.ended.failed_message",
1169
+ description: "Shown under the notice that the payment was received while the account is being set up"
1170
+ })
1171
+ } : o.status === "PROCESSING" ? {
1172
+ title: a({
1173
+ defaultMessage: "We are processing your payment",
1174
+ id: "checkout_session.ended.processing_title",
1175
+ description: "Shown in place of a checkout whose payment is still being processed"
1176
+ }),
1177
+ message: a({
1178
+ defaultMessage: "This can take a few minutes. You do not need to pay again.",
1179
+ id: "checkout_session.ended.processing_message",
1180
+ description: "Shown under the notice that the payment is still being processed"
1181
+ })
1182
+ } : o.reason === "expired" ? {
1183
+ title: a({
1184
+ defaultMessage: "This checkout link has expired",
1185
+ id: "checkout_session.ended.expired_title",
1186
+ description: "Shown in place of a checkout whose link has expired"
1187
+ }),
1188
+ message: c()
1189
+ } : o.reason === "revoked" ? {
1190
+ title: a({
1191
+ defaultMessage: "This checkout is no longer available",
1192
+ id: "checkout_session.ended.revoked_title",
1193
+ description: "Shown in place of a checkout whose link the merchant revoked"
1194
+ }),
1195
+ message: c()
1196
+ } : {
1197
+ title: a({
1198
+ defaultMessage: "This checkout is closed",
1199
+ id: "checkout_session.ended.closed_title",
1200
+ description: "Shown in place of a checkout that can no longer be used"
1201
+ }),
1202
+ message: c()
1203
+ });
1204
+ return (u, p) => (R(), ps("div", lo, [
1205
+ ms("div", po, [
1206
+ Nt(x(vt), {
1207
+ variant: "heading-1",
1208
+ class: "sv-checkout-ended__title"
1209
+ }, {
1210
+ default: re(() => [
1211
+ pt(mt(l.value.title), 1)
1212
+ ]),
1213
+ _: 1
1214
+ }),
1215
+ l.value.message ? (R(), $(x(vt), vs({
1216
+ key: 0,
1217
+ variant: "body-sm",
1218
+ color: "subtle",
1219
+ class: "sv-checkout-ended__message"
1220
+ }, n.isRedirecting && n.status === "COMPLETED" ? { role: "status" } : {}), {
1221
+ default: re(() => [
1222
+ pt(mt(l.value.message), 1)
1223
+ ]),
1224
+ _: 1
1225
+ }, 16)) : _s("", !0)
1226
+ ])
1227
+ ]));
1228
+ }
1229
+ }), mo = /* @__PURE__ */ xe({
1230
+ __name: "SessionCheckout",
1231
+ props: {
1232
+ configuration: { type: Object },
1233
+ portalUrlId: { type: String },
1234
+ avatar: { type: String }
1235
+ },
1236
+ setup(n) {
1237
+ const o = n;
1238
+ It().info("COMPONENT_INITIALIZED", "Checkout session component initialized");
1239
+ const { source: a, endState: c, isRedirecting: l, loadFailure: u } = uo({
1240
+ portalUrlId: o.portalUrlId
1241
+ });
1242
+ return (p, g) => {
1243
+ var E;
1244
+ return (E = x(u)) != null && E.reason ? (R(), $(De, {
1245
+ key: 0,
1246
+ class: "sv-checkout sv-root sv-screen",
1247
+ reason: x(u).reason,
1248
+ status: x(u).status
1249
+ }, null, 8, ["reason", "status"])) : x(u) ? (R(), $(wt, {
1250
+ key: 1,
1251
+ class: "sv-checkout sv-root sv-screen sv-checkout--error"
1252
+ })) : x(c) ? (R(), $(De, {
1253
+ key: 2,
1254
+ class: "sv-checkout sv-root sv-screen",
1255
+ status: x(c),
1256
+ "is-redirecting": x(l)
1257
+ }, null, 8, ["status", "is-redirecting"])) : (R(), $(Is, {
1258
+ key: 3,
1259
+ source: x(a),
1260
+ configuration: n.configuration,
1261
+ avatar: n.avatar
1262
+ }, null, 8, ["source", "configuration", "avatar"]));
1263
+ };
1264
+ }
1265
+ }), vo = /* @__PURE__ */ xe({
1266
+ __name: "CheckoutSession.entry",
1267
+ props: {
1268
+ environment: { type: String },
1269
+ locale: { type: String },
1270
+ dateLocale: { type: String },
1271
+ messages: { type: Object },
1272
+ portalToken: { type: Object },
1273
+ experimentalFeatures: { type: Array },
1274
+ logLevel: { type: String },
1275
+ onLog: { type: Function },
1276
+ cssOverrides: { type: [String, Array] },
1277
+ branding: { type: Object },
1278
+ portalObject: { type: null }
1279
+ },
1280
+ setup(n) {
1281
+ const o = Ss("checkout-session");
1282
+ return (a, c) => (R(), $(x(Es), {
1283
+ entry: a.$props,
1284
+ "component-name": x(o),
1285
+ "allowed-portal-types": ["CHECKOUT_SESSION"]
1286
+ }, {
1287
+ "portal-unavailable": re(({ ending: l }) => [
1288
+ l ? (R(), $(De, {
1289
+ key: 0,
1290
+ class: "sv-checkout sv-root sv-screen",
1291
+ reason: l.reason,
1292
+ status: l.checkoutSessionStatus
1293
+ }, null, 8, ["reason", "status"])) : (R(), $(wt, {
1294
+ key: 1,
1295
+ class: "sv-checkout sv-root sv-screen sv-checkout--error"
1296
+ }))
1297
+ ]),
1298
+ default: re(() => {
1299
+ var l, u;
1300
+ return [
1301
+ Nt(mo, {
1302
+ "portal-url-id": n.portalObject.id,
1303
+ avatar: ((u = (l = n.branding) == null ? void 0 : l.emblem) == null ? void 0 : u.public_url) ?? void 0
1304
+ }, null, 8, ["portal-url-id", "avatar"])
1305
+ ];
1306
+ }),
1307
+ _: 1
1308
+ }, 8, ["entry", "component-name"]));
1309
+ }
1310
+ }), { define: Io } = Os(
1311
+ vo,
1312
+ "checkout-session"
1313
+ );
1314
+ export {
1315
+ Io as defineSolvimonCheckoutSession
1316
+ };