@solvimon/solvimon-web 0.1.0-alpha.1 → 0.1.0-alpha.10

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 (196) hide show
  1. package/README.md +196 -44
  2. package/dist/ApiStatus-CyNDp_op.mjs +9 -0
  3. package/dist/ApiStatus-oqvUEWJx.js +1 -0
  4. package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-B42EzZ97.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-CX8vlY2Z.mjs} +9 -6
  5. package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-DGisvmez.js +1 -0
  6. package/dist/ContentWithAsideLayout-B5B8Kwaw.js +1 -0
  7. package/dist/{ContentWithAsideLayout-BC-C5Gjt.mjs → ContentWithAsideLayout-DhfUkZZg.mjs} +10 -16
  8. package/dist/{useCustomerPaymentMethodOptions-Fe_dLxfv.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-Bus-5gC3.mjs} +29 -37
  9. package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CkRsyMlJ.js +1 -0
  10. package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-5yBnSRap.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-Bc2hkpTb.mjs} +20 -9
  11. package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-D0vVUHuY.js +1 -0
  12. package/dist/PaymentHistoryBlock-BiiFJkpT.js +1 -0
  13. package/dist/PaymentHistoryBlock-D_B099M7.mjs +4 -0
  14. package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CknZKCmY.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CaMDtHrL.mjs} +19 -12
  15. package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-DWTEfLrE.js +1 -0
  16. package/dist/PaymentIntegrationForm-D1ZaHCTm.js +1 -0
  17. package/dist/PaymentIntegrationForm-Dmmhqqn1.mjs +4 -0
  18. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CSPZRvMV.js +1 -0
  19. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-Do2KIVKH.mjs +962 -0
  20. package/dist/PricingGroupContent.vue_vue_type_script_setup_true_lang-BChVMzCj.mjs +50 -0
  21. package/dist/PricingGroupContent.vue_vue_type_script_setup_true_lang-Br3bEUlP.js +1 -0
  22. package/dist/{Skeleton.vue_vue_type_script_setup_true_lang-BFFJw-5h.mjs → Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs} +24 -8
  23. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js +1 -0
  24. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-AHw3iTfi.js +1 -0
  25. package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-DfB5BqiH.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-BkzLj8n2.mjs} +42 -36
  26. package/dist/adyen-51SvcyqV.mjs +4 -0
  27. package/dist/adyen-Bwewy3HC.mjs +172 -0
  28. package/dist/adyen-DZsyEXkw.js +1 -0
  29. package/dist/adyen-R6aSZ0Yf.js +1 -0
  30. package/dist/component-BOqPDAVk.js +1 -0
  31. package/dist/component-Djrf1L-Z.mjs +889 -0
  32. package/dist/components/BillingInformation/BillingInformation.ce.d.ts +1 -1
  33. package/dist/components/BillingInformation/BillingInformation.cjs.js +1 -1
  34. package/dist/components/BillingInformation/BillingInformation.es.js +99 -5
  35. package/dist/components/BillingInformationForm/BillingInformationForm.ce.d.ts +1 -1
  36. package/dist/components/BillingInformationForm/BillingInformationForm.cjs.js +1 -1
  37. package/dist/components/BillingInformationForm/BillingInformationForm.es.js +582 -5
  38. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.ce.d.ts +1 -1
  39. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js +1 -1
  40. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js +126 -5
  41. package/dist/components/Invoice/Invoice.ce.d.ts +1 -1
  42. package/dist/components/Invoice/Invoice.cjs.js +1 -1
  43. package/dist/components/Invoice/Invoice.es.js +538 -5
  44. package/dist/components/InvoiceDetails/InvoiceDetails.ce.d.ts +1 -1
  45. package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -1
  46. package/dist/components/InvoiceDetails/InvoiceDetails.es.js +127 -5
  47. package/dist/components/InvoicesList/InvoicesList.ce.d.ts +1 -1
  48. package/dist/components/InvoicesList/InvoicesList.cjs.js +1 -1
  49. package/dist/components/InvoicesList/InvoicesList.es.js +106 -5
  50. package/dist/components/PaymentHistory/PaymentHistory.ce.d.ts +1 -1
  51. package/dist/components/PaymentHistory/PaymentHistory.cjs.js +1 -1
  52. package/dist/components/PaymentHistory/PaymentHistory.es.js +131 -5
  53. package/dist/components/PaymentMethodForm/PaymentMethodForm.ce.d.ts +1 -1
  54. package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +1 -1
  55. package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +217 -5
  56. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.ce.d.ts +1 -1
  57. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs.js +1 -1
  58. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.es.js +154 -5
  59. package/dist/components/SubscriptionsList/SubscriptionsList.ce.d.ts +1 -1
  60. package/dist/components/SubscriptionsList/SubscriptionsList.cjs.js +1 -1
  61. package/dist/components/SubscriptionsList/SubscriptionsList.es.js +132 -5
  62. package/dist/components/WalletBalances/WalletBalances.ce.d.ts +3 -0
  63. package/dist/components/WalletBalances/WalletBalances.cjs.js +1 -0
  64. package/dist/components/WalletBalances/WalletBalances.es.js +120 -0
  65. package/dist/core/configuration.d.ts +2 -1
  66. package/dist/core/index.cjs.js +1 -1
  67. package/dist/core/index.d.ts +1 -0
  68. package/dist/core/index.es.js +1 -1
  69. package/dist/core/registry.d.ts +1 -1
  70. package/dist/core/types.d.ts +10 -2
  71. package/dist/customer-B31QzznT.mjs +32 -0
  72. package/dist/customer-hDxW1Dbp.js +1 -0
  73. package/dist/en-US-CgPY97Vq.js +1 -0
  74. package/dist/en-US-N3CUCsVy.mjs +179 -0
  75. package/dist/index-DIFK3mcJ.js +6 -0
  76. package/dist/index-DyvRdSR7.mjs +9673 -0
  77. package/dist/index.cjs.js +1 -1
  78. package/dist/index.d.ts +3 -0
  79. package/dist/index.es.js +43 -34
  80. package/dist/{invoices-C31Wz1Bu.mjs → invoices-DIYPN2j_.mjs} +2 -1
  81. package/dist/invoices-DzkA1jDc.js +1 -0
  82. package/dist/nl-NL-B8U9b85I.mjs +197 -0
  83. package/dist/nl-NL-qMRaTRrM.js +1 -0
  84. package/dist/{paymentMethods-CrU4G_2Y.mjs → paymentMethods-67b3UlTZ.mjs} +2 -1
  85. package/dist/paymentMethods-C_sdTkSF.js +1 -0
  86. package/dist/{payments-C3LPk9k9.js → payments-DkHhTHto.js} +1 -1
  87. package/dist/{payments-NtWI8KlU.mjs → payments-Dq6R37Fz.mjs} +1 -1
  88. package/dist/registry-BkViv4tv.js +1 -0
  89. package/dist/registry-Df_26rJy.mjs +144 -0
  90. package/dist/screens/Checkout/Checkout.ce.d.ts +1 -1
  91. package/dist/screens/Checkout/Checkout.cjs.js +1 -1
  92. package/dist/screens/Checkout/Checkout.es.js +4935 -5
  93. package/dist/screens/CustomerOverview/CustomerOverview.ce.d.ts +1 -1
  94. package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -1
  95. package/dist/screens/CustomerOverview/CustomerOverview.es.js +154 -5
  96. package/dist/screens/PayInvoice/PayInvoice.ce.d.ts +3 -0
  97. package/dist/screens/PayInvoice/PayInvoice.cjs.js +1 -0
  98. package/dist/screens/PayInvoice/PayInvoice.es.js +458 -0
  99. package/dist/screens/UpgradeSubscription/UpgradeSubscription.ce.d.ts +3 -0
  100. package/dist/screens/UpgradeSubscription/UpgradeSubscription.cjs.js +1 -0
  101. package/dist/screens/UpgradeSubscription/UpgradeSubscription.es.js +1066 -0
  102. package/dist/solvimon-web.css +1 -1
  103. package/dist/{subscriptions-3R7aMoky.mjs → subscriptions-ClGIr_aS.mjs} +2 -1
  104. package/dist/subscriptions-jelITJcX.js +1 -0
  105. package/dist/{useActionDispatchProvider-CBo_Hwu5.mjs → useActionDispatchProvider-BC57-Ufn.mjs} +1 -1
  106. package/dist/useActionDispatchProvider-rw9kWeE0.js +1 -0
  107. package/dist/useCustomer-Ba9WRtuT.mjs +25 -0
  108. package/dist/useCustomer-CUcaeQn_.js +1 -0
  109. package/dist/{useIncrementalLoading-fHCizCSo.mjs → useIncrementalLoading-Cnzh2mAz.mjs} +11 -10
  110. package/dist/useIncrementalLoading-DoTTXM2Y.js +1 -0
  111. package/dist/{useInvoiceData-dyvoDwFF.mjs → useInvoiceData-BJwwDur7.mjs} +6 -12
  112. package/dist/useInvoiceData-D2jkdmlA.js +1 -0
  113. package/dist/{useInvoicesList-rDvRzMqe.mjs → useInvoicesList-CFzAxyae.mjs} +34 -30
  114. package/dist/useInvoicesList-CaBCGs4h.js +1 -0
  115. package/dist/{useLoadInitialData-Dm48tlSO.mjs → useLoadInitialData-5sgImpzc.mjs} +5 -0
  116. package/dist/useLoadInitialData-DjwRHcAH.js +1 -0
  117. package/dist/usePaymentMethodOptions-C2k4npCQ.mjs +26 -0
  118. package/dist/usePaymentMethodOptions-DYO6xr3-.js +1 -0
  119. package/dist/{usePaymentMethods-Bq5fWl1Q.mjs → usePaymentMethods-CRWbH48K.mjs} +2 -2
  120. package/dist/{usePaymentMethods-Dbimodf0.js → usePaymentMethods-ryN_YohI.js} +1 -1
  121. package/dist/usePayments-Cw5PPEJa.mjs +36 -0
  122. package/dist/usePayments-DWXPGFvp.js +1 -0
  123. package/dist/usePortal-CxX4nrE4.js +1 -0
  124. package/dist/usePortal-cmE08vYs.mjs +12 -0
  125. package/dist/useService-Bb9r_sOQ.js +1 -0
  126. package/dist/useService-BsSEI8DZ.mjs +53 -0
  127. package/dist/useViewport-Bu0cyeSi.mjs +38 -0
  128. package/dist/useViewport-CKRY1CKR.js +1 -0
  129. package/dist/useWalletBalanceItems-CkDqmk36.mjs +109 -0
  130. package/dist/useWalletBalanceItems-CpZ1NWPr.js +1 -0
  131. package/dist/useWatchDebounced-2ZLnfgvG.js +1 -0
  132. package/dist/useWatchDebounced-D1xuIX6_.mjs +12 -0
  133. package/dist/vendor-ui-5pJF5KBP.js +1 -0
  134. package/dist/vendor-ui-C0K3osvz.mjs +27645 -0
  135. package/package.json +47 -20
  136. package/dist/BillingInformation.entry.ce-1xVdsWlL.mjs +0 -99
  137. package/dist/BillingInformation.entry.ce-DkrfEvK_.js +0 -1
  138. package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-VMlVPI4O.js +0 -1
  139. package/dist/BillingInformationForm.entry.ce-MPMirEsk.js +0 -1
  140. package/dist/BillingInformationForm.entry.ce-xfT0Jqps.mjs +0 -579
  141. package/dist/Checkout.entry.ce-Bif6vR1K.mjs +0 -5185
  142. package/dist/Checkout.entry.ce-CkQnLAn4.js +0 -1
  143. package/dist/ContentWithAsideLayout-CIVSoqFr.js +0 -1
  144. package/dist/CustomerOverview.entry.ce-C__omsVl.js +0 -1
  145. package/dist/CustomerOverview.entry.ce-Ce_Yk8-i.mjs +0 -231
  146. package/dist/CustomerPaymentMethods.entry.ce-CZwy8Aqq.mjs +0 -135
  147. package/dist/CustomerPaymentMethods.entry.ce-DnjlRHPA.js +0 -1
  148. package/dist/Invoice.entry.ce-CdJ9TPZe.mjs +0 -583
  149. package/dist/Invoice.entry.ce-Cgr43ome.js +0 -1
  150. package/dist/InvoiceDetails.entry.ce-Cnpz8CLJ.mjs +0 -130
  151. package/dist/InvoiceDetails.entry.ce-jHDyWra2.js +0 -1
  152. package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-t6E9_dWJ.js +0 -1
  153. package/dist/InvoicesList.entry.ce-38iOW5qh.js +0 -1
  154. package/dist/InvoicesList.entry.ce-BBaHEtAD.mjs +0 -105
  155. package/dist/PaymentHistory.entry.ce-DDeHMhK_.js +0 -1
  156. package/dist/PaymentHistory.entry.ce-Dw2NiP4l.mjs +0 -134
  157. package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-8UxAr2hU.js +0 -1
  158. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BCdv5DbH.mjs +0 -6568
  159. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-xJ8kJbRo.js +0 -1
  160. package/dist/PaymentMethodForm.entry.ce-f4cFExKc.mjs +0 -238
  161. package/dist/PaymentMethodForm.entry.ce-zxeBXZW6.js +0 -1
  162. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-CQqTurIt.js +0 -1
  163. package/dist/SubscriptionSchedules.entry.ce-B4T_yQC1.js +0 -1
  164. package/dist/SubscriptionSchedules.entry.ce-B4vQ7QLk.mjs +0 -153
  165. package/dist/SubscriptionsList.entry.ce-B5SJCQW0.js +0 -1
  166. package/dist/SubscriptionsList.entry.ce-cNYuQZZj.mjs +0 -135
  167. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-DqZLFDCv.js +0 -1
  168. package/dist/_Uint8Array-DHE03FZr.mjs +0 -507
  169. package/dist/_Uint8Array-DxISR7XF.js +0 -1
  170. package/dist/auto-B_36W1Fc.js +0 -6
  171. package/dist/auto-BfMZdgp-.mjs +0 -14207
  172. package/dist/cloneDeep-Hs8Pp07F.js +0 -1
  173. package/dist/cloneDeep-sm9cY-u2.mjs +0 -212
  174. package/dist/component-BkmcE85U.mjs +0 -58654
  175. package/dist/component-Df5eNqYX.js +0 -1
  176. package/dist/index-2jo9BSPM.js +0 -1
  177. package/dist/index-BFZ0dPh9.mjs +0 -179
  178. package/dist/index-CWSXne1Q.js +0 -1
  179. package/dist/index-D3v7hAtc.mjs +0 -253
  180. package/dist/invoices-8M_3ur_U.js +0 -1
  181. package/dist/paymentMethods-CzUqDlvc.js +0 -1
  182. package/dist/registry-By94DXE2.js +0 -1
  183. package/dist/registry-shRKDl3K.mjs +0 -127
  184. package/dist/sprite-i5T7eZnk-C55G-dBo.js +0 -1
  185. package/dist/sprite-i5T7eZnk-i5T7eZnk.mjs +0 -4
  186. package/dist/subscriptions-CqK7t-fF.js +0 -1
  187. package/dist/useActionDispatchProvider-DsIljrhi.js +0 -1
  188. package/dist/useCustomer-BRY0tuBH.mjs +0 -45
  189. package/dist/useCustomer-Dp8sGHI0.js +0 -1
  190. package/dist/useCustomerPaymentMethodOptions-DYpMDnJR.js +0 -1
  191. package/dist/useIncrementalLoading-D8oKNxX7.js +0 -1
  192. package/dist/useInvoiceData-DImEH1ca.js +0 -1
  193. package/dist/useInvoicesList-BZQ9Y0qN.js +0 -1
  194. package/dist/useLoadInitialData-BRg7IWqW.js +0 -1
  195. package/dist/useService-Dz13Nxbi.mjs +0 -272
  196. package/dist/useService-bNNi4GB8.js +0 -1
@@ -0,0 +1,962 @@
1
+ import { defineComponent, computed, openBlock, createBlock, withCtx, unref, createVNode, createTextVNode, toDisplayString, createCommentVNode, createElementVNode, inject, ref, onMounted, onBeforeUnmount, watch, createElementBlock, Fragment, renderList } from "vue";
2
+ import { u as useIntl, _ as _sfc_main$5, l as _sfc_main$6, x as formatAmount, e as _sfc_main$7, k as isEqual, R as _sfc_main$8 } from "./vendor-ui-C0K3osvz.mjs";
3
+ import { _ as _sfc_main$4, g as getQueryParam, t as transformToAdyenAmount, m as mapAdyenPaymentMethods, a as getAdyenEnvironmentFromPaymentMethodOptionsResponse, b as getAdyenClientKeyFromPaymentMethodOptionsResponse, R as REDIRECT_RESULT_QUERY_STRING, P as PAYMENT_ACCEPTOR_ID_QUERY_STRING, c as transformObjectToAdyenObject, d as createReturnUrl } from "./adyen-Bwewy3HC.mjs";
4
+ import { c as createPaymentsService } from "./payments-Dq6R37Fz.mjs";
5
+ import { c as createPaymentMethodsService } from "./paymentMethods-67b3UlTZ.mjs";
6
+ import { E as EXPERIMENTAL_FEATURE_INJECTION_KEY, a as useLogger } from "./component-Djrf1L-Z.mjs";
7
+ const getOverriddenTranslations = (variant) => {
8
+ let result = {};
9
+ if (variant === "TOKENIZE") {
10
+ result = {
11
+ "en-US": {
12
+ payButton: "Add payment method",
13
+ confirmPurchase: "Add payment method"
14
+ },
15
+ "fr-FR": {
16
+ payButton: "Ajouter un moyen de paiement",
17
+ confirmPurchase: "Ajouter un moyen de paiement"
18
+ },
19
+ "de-DE": {
20
+ payButton: "Zahlungsmethode hinzufügen",
21
+ confirmPurchase: "Zahlungsmethode hinzufügen"
22
+ },
23
+ "it-IT": {
24
+ payButton: "Aggiungi metodo di pagamento",
25
+ confirmPurchase: "Aggiungi metodo di pagamento"
26
+ },
27
+ "es-ES": {
28
+ payButton: "Añadir método de pago",
29
+ confirmPurchase: "Añadir método de pago"
30
+ },
31
+ "nl-NL": {
32
+ payButton: "Betaalmethode toevoegen",
33
+ confirmPurchase: "Betaalmethode toevoegen"
34
+ },
35
+ "pt-BR": {
36
+ payButton: "Adicionar método de pagamento",
37
+ confirmPurchase: "Adicionar método de pagamento"
38
+ },
39
+ "pt-PT": {
40
+ payButton: "Adicionar método de pagamento",
41
+ confirmPurchase: "Adicionar método de pagamento"
42
+ },
43
+ "pl-PL": {
44
+ payButton: "Dodaj metodę płatności",
45
+ confirmPurchase: "Dodaj metodę płatności"
46
+ },
47
+ "ru-RU": {
48
+ payButton: "Добавить способ оплаты",
49
+ confirmPurchase: "Добавить способ оплаты"
50
+ },
51
+ "sv-SE": {
52
+ payButton: "Lägg till betalningsmetod",
53
+ confirmPurchase: "Lägg till betalningsmetod"
54
+ },
55
+ "da-DK": {
56
+ payButton: "Tilføj betalingsmetode",
57
+ confirmPurchase: "Tilføj betalingsmetode"
58
+ },
59
+ "fi-FI": {
60
+ payButton: "Lisää maksutapa",
61
+ confirmPurchase: "Lisää maksutapa"
62
+ },
63
+ "no-NO": {
64
+ payButton: "Legg til betalingsmetode",
65
+ confirmPurchase: "Legg til betalingsmetode"
66
+ },
67
+ "cs-CZ": {
68
+ payButton: "Přidat platební metodu",
69
+ confirmPurchase: "Přidat platební metodu"
70
+ },
71
+ "hu-HU": {
72
+ payButton: "Fizetési mód hozzáadása",
73
+ confirmPurchase: "Fizetési mód hozzáadása"
74
+ },
75
+ "ro-RO": {
76
+ payButton: "Adăugați metodă de plată",
77
+ confirmPurchase: "Adăugați metodă de plată"
78
+ },
79
+ "ja-JP": {
80
+ payButton: "支払い方法を追加",
81
+ confirmPurchase: "支払い方法を追加"
82
+ },
83
+ "ko-KR": {
84
+ payButton: "결제 수단 추가",
85
+ confirmPurchase: "결제 수단 추가"
86
+ },
87
+ "zh-CN": {
88
+ payButton: "添加支付方式",
89
+ confirmPurchase: "添加支付方式"
90
+ },
91
+ "zh-TW": {
92
+ payButton: "新增付款方式",
93
+ confirmPurchase: "新增付款方式"
94
+ },
95
+ ar: {
96
+ payButton: "إضافة وسيلة دفع",
97
+ confirmPurchase: "إضافة وسيلة دفع"
98
+ },
99
+ "hr-HR": {
100
+ payButton: "Dodajte način plačanja",
101
+ confirmPurchase: "Dodajte način plačanja"
102
+ },
103
+ "el-GR": {
104
+ payButton: "Προσθήκη μεθόδου πληρωμής",
105
+ confirmPurchase: "Προσθήκη μεθόδου πληρωμής"
106
+ },
107
+ "sk-SK": {
108
+ payButton: "Pridať spôsob platby",
109
+ confirmPurchase: "Pridať spôsob platby"
110
+ },
111
+ "sl-SI": {
112
+ payButton: "Dodajte način plačanja",
113
+ confirmPurchase: "Dodajte način plačanja"
114
+ },
115
+ "bg-BG": {
116
+ payButton: "Добавяне на начин на плащане",
117
+ confirmPurchase: "Добавяне на начин на плащане"
118
+ },
119
+ "ca-ES": {
120
+ payButton: "Afegir mètode de pagament",
121
+ confirmPurchase: "Afegir mètode de pagament"
122
+ },
123
+ "et-EE": {
124
+ payButton: "Lisa makseviis",
125
+ confirmPurchase: "Lisa makseviis"
126
+ },
127
+ "lv-LV": {
128
+ payButton: "Pievienot maksājuma veidu",
129
+ confirmPurchase: "Pievienot maksājuma veidu"
130
+ },
131
+ "lt-LT": {
132
+ payButton: "Pridėti mokėjimo metodą",
133
+ confirmPurchase: "Pridėti mokėjimo metodą"
134
+ }
135
+ };
136
+ }
137
+ return result;
138
+ };
139
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
140
+ __name: "PaymentCompletedCard",
141
+ props: {
142
+ amount: { type: Object },
143
+ variant: { type: String }
144
+ },
145
+ setup(__props) {
146
+ const props = __props;
147
+ const { $t } = useIntl();
148
+ const title = computed(
149
+ () => props.variant === "AUTHORIZE" ? $t({
150
+ defaultMessage: "Payment successful",
151
+ description: "The title for when a payment has been successful",
152
+ id: "payment_completed_card.title.authorize"
153
+ }) : $t({
154
+ defaultMessage: "Your payment method is added",
155
+ description: "The title for when a payment method was successfully added",
156
+ id: "payment_completed_card.title.tokenize"
157
+ })
158
+ );
159
+ return (_ctx, _cache) => {
160
+ return openBlock(), createBlock(_sfc_main$4, {
161
+ status: "success",
162
+ title: title.value
163
+ }, {
164
+ default: withCtx(() => [
165
+ __props.amount ? (openBlock(), createBlock(unref(_sfc_main$5), {
166
+ key: 0,
167
+ variant: "body-sm",
168
+ class: "mt-1"
169
+ }, {
170
+ default: withCtx(() => [
171
+ createVNode(unref(_sfc_main$6), { icon: "check" }),
172
+ createTextVNode(toDisplayString(unref(formatAmount)(__props.amount)), 1)
173
+ ]),
174
+ _: 1
175
+ })) : createCommentVNode("", true),
176
+ createVNode(unref(_sfc_main$5), {
177
+ variant: "body-xs",
178
+ shade: "lighter"
179
+ }, {
180
+ default: withCtx(() => [
181
+ createTextVNode(toDisplayString(unref($t)({
182
+ defaultMessage: "You are being redirected...",
183
+ description: "The text shown after a successful message before a redirect",
184
+ id: "payment_completed_card.redirect_message"
185
+ })), 1)
186
+ ]),
187
+ _: 1
188
+ })
189
+ ]),
190
+ _: 1
191
+ }, 8, ["title"]);
192
+ };
193
+ }
194
+ });
195
+ const ErrorMap = {
196
+ UNKNOWN_ERROR: {
197
+ title: "Something went wrong",
198
+ message: "An unknown error has occurred",
199
+ isReloadButtonVisible: true
200
+ },
201
+ AUTHORIZATION_FAILED: {
202
+ title: "Payment failed",
203
+ message: "The payment failed"
204
+ },
205
+ PAYMENT_DETAILS_CALL_FAILED: {
206
+ title: "Payment details call failed",
207
+ message: "There was a problem getting the payment details"
208
+ },
209
+ PAYMENT_METHOD_STORAGE_FAILED: {
210
+ title: "Failed storing payment method",
211
+ message: "Something went wrong with storing the payment method"
212
+ },
213
+ REDIRECT_RESULT_PAYMENT_ACCEPTOR_MISSING: {
214
+ title: "Missing payment acceptor",
215
+ message: "A redirect result is set, but a payment acceptor is missing in the url"
216
+ },
217
+ TOKENIZE_FAILED: {
218
+ title: "Tokenization failed",
219
+ message: "The tokenization of the payment method has failed"
220
+ },
221
+ PAYMENT_INTEGRATION_INITIALIZATION_FAILED: {
222
+ title: "Failed loading payment methods",
223
+ message: "Failed loading payment integration",
224
+ isReloadButtonVisible: true
225
+ },
226
+ RESOURCE_REVOKED: {
227
+ title: "Resource revoked",
228
+ message: "The resource has been revoked",
229
+ isReloadButtonVisible: true
230
+ }
231
+ };
232
+ const _hoisted_1 = { class: "flex flex-col items-center gap-6" };
233
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
234
+ __name: "PaymentErrorCard",
235
+ props: {
236
+ error: { type: Object }
237
+ },
238
+ setup(__props) {
239
+ const props = __props;
240
+ const { $t } = useIntl();
241
+ const errorConfig = computed(() => ErrorMap[props.error.code]);
242
+ const reload = () => {
243
+ window.location.reload();
244
+ };
245
+ return (_ctx, _cache) => {
246
+ return openBlock(), createBlock(_sfc_main$4, {
247
+ status: "error",
248
+ title: errorConfig.value.title
249
+ }, {
250
+ default: withCtx(() => [
251
+ createElementVNode("div", _hoisted_1, [
252
+ createVNode(unref(_sfc_main$5), {
253
+ variant: "body-xs",
254
+ shade: "lighter",
255
+ class: "mt-3"
256
+ }, {
257
+ default: withCtx(() => [
258
+ createTextVNode(toDisplayString(errorConfig.value.message), 1)
259
+ ]),
260
+ _: 1
261
+ }),
262
+ errorConfig.value.isReloadButtonVisible ? (openBlock(), createBlock(unref(_sfc_main$7), {
263
+ key: 0,
264
+ type: "button",
265
+ color: "gray",
266
+ variant: "outline",
267
+ onClick: reload
268
+ }, {
269
+ default: withCtx(() => [
270
+ createTextVNode(toDisplayString(unref($t)({
271
+ defaultMessage: "Try again",
272
+ description: "Retry button text when an error has happened during a payment",
273
+ id: "payments.retry_button.label"
274
+ })), 1)
275
+ ]),
276
+ _: 1
277
+ })) : createCommentVNode("", true)
278
+ ])
279
+ ]),
280
+ _: 1
281
+ }, 8, ["title"]);
282
+ };
283
+ }
284
+ });
285
+ const useExperimentalFeature = () => {
286
+ const experimentalFeature = inject(EXPERIMENTAL_FEATURE_INJECTION_KEY);
287
+ return experimentalFeature;
288
+ };
289
+ const EXPRESS_PAYMENT_METHOD_TYPES = ["applepay"];
290
+ function filterOutExpressPaymentMethods(paymentMethods) {
291
+ return paymentMethods.filter(
292
+ (method) => !EXPRESS_PAYMENT_METHOD_TYPES.some((type) => {
293
+ var _a;
294
+ return type === ((_a = method.type) == null ? void 0 : _a.toLowerCase());
295
+ })
296
+ );
297
+ }
298
+ const PAYMENT_GATEWAY_VARIANT_ADYEN = "ADYEN";
299
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
300
+ __name: "PaymentIntegrationFormAdyen",
301
+ props: {
302
+ countryCode: { type: String },
303
+ customerId: { type: String },
304
+ invoiceId: { type: String },
305
+ paymentMethodOptionResponseEntry: { type: Object },
306
+ variant: { type: String },
307
+ selected: { type: Boolean },
308
+ amount: { type: Object },
309
+ validateOnSubmit: { type: Function, default: () => Promise.resolve(true) },
310
+ context: { type: Object },
311
+ forceStorePaymentMethod: { type: Boolean }
312
+ },
313
+ emits: ["select", "payment-failed", "payment-success", "ready"],
314
+ setup(__props, { expose: __expose, emit: __emit }) {
315
+ let dropInInstance = null;
316
+ let checkoutInstance = null;
317
+ const props = __props;
318
+ const emit = __emit;
319
+ __expose({ submit });
320
+ const dropInContainerRef = ref();
321
+ const showPaymentSuccess = ref(false);
322
+ const integrationError = ref();
323
+ const logger = useLogger();
324
+ const { locale } = useIntl();
325
+ const { authorizePayment, getPaymentDetails } = createPaymentsService();
326
+ const { tokenizePaymentMethod } = createPaymentMethodsService();
327
+ const experimentalFeatures = useExperimentalFeature();
328
+ const showPayButton = computed(() => props.variant === "TOKENIZE");
329
+ function submit() {
330
+ try {
331
+ dropInInstance == null ? void 0 : dropInInstance.submit();
332
+ } catch (error) {
333
+ logger.error("ADYEN_SUBMIT_FAILED", "Failed to submit Adyen drop-in", {}, error);
334
+ }
335
+ }
336
+ async function getConfiguration() {
337
+ var _a;
338
+ const adyenAmount = transformToAdyenAmount(props.amount);
339
+ const paymentMethods = ((_a = experimentalFeatures == null ? void 0 : experimentalFeatures.value) == null ? void 0 : _a["express-checkout"]) ? filterOutExpressPaymentMethods(
340
+ mapAdyenPaymentMethods(props.paymentMethodOptionResponseEntry)
341
+ ) : mapAdyenPaymentMethods(props.paymentMethodOptionResponseEntry);
342
+ return {
343
+ checkoutConfig: {
344
+ amount: adyenAmount,
345
+ clientKey: getAdyenClientKeyFromPaymentMethodOptionsResponse(
346
+ props.paymentMethodOptionResponseEntry
347
+ ),
348
+ environment: getAdyenEnvironmentFromPaymentMethodOptionsResponse(
349
+ props.paymentMethodOptionResponseEntry,
350
+ logger
351
+ ),
352
+ locale,
353
+ translations: getOverriddenTranslations(props.variant),
354
+ countryCode: props.countryCode,
355
+ analytics: { enabled: false },
356
+ paymentMethodsResponse: { paymentMethods },
357
+ onSubmit: handleOnSubmit,
358
+ onAdditionalDetails: handleOnAdditionalDetails,
359
+ onPaymentCompleted: handleOnPaymentCompleted,
360
+ onPaymentFailed: handleOnPaymentFailed,
361
+ onError: handleOnError,
362
+ showPayButton: showPayButton.value
363
+ },
364
+ dropInConfig: {
365
+ disableFinalAnimation: true,
366
+ paymentMethodsConfiguration: {
367
+ card: {
368
+ hasHolderName: true,
369
+ holderNameRequired: true,
370
+ enableStoreDetails: !props.forceStorePaymentMethod && props.variant === "AUTHORIZE"
371
+ },
372
+ paypal: {
373
+ intent: adyenAmount.value > 0 ? "authorize" : "tokenize",
374
+ showPayButton: true
375
+ }
376
+ },
377
+ openFirstPaymentMethod: props.selected,
378
+ onSelect: ({ props: { type } }) => {
379
+ if (!type) return;
380
+ emit("select", { paymentMethodType: type, paymentGatewayVariant: "ADYEN" });
381
+ },
382
+ onReady: () => emit("ready")
383
+ }
384
+ };
385
+ }
386
+ async function mountDropIn() {
387
+ if (!dropInContainerRef.value) return;
388
+ try {
389
+ await unmountDropIn();
390
+ const [adyenModule, { default: adyenCss }] = await Promise.all([
391
+ import("./index-DyvRdSR7.mjs"),
392
+ import("./adyen-51SvcyqV.mjs")
393
+ ]);
394
+ const {
395
+ AdyenCheckout,
396
+ Dropin,
397
+ Card,
398
+ Bancontact,
399
+ Ach,
400
+ AmazonPay,
401
+ ApplePay,
402
+ BcmcMobile,
403
+ BacsDirectDebit,
404
+ CashAppPay,
405
+ EPS,
406
+ GooglePay,
407
+ Klarna,
408
+ PayByBank,
409
+ PayPal,
410
+ SepaDirectDebit,
411
+ Trustly,
412
+ Twint,
413
+ PayByBankUS,
414
+ Redirect
415
+ } = adyenModule;
416
+ const { checkoutConfig, dropInConfig } = await getConfiguration();
417
+ checkoutInstance = await AdyenCheckout(checkoutConfig);
418
+ dropInInstance = new Dropin(checkoutInstance, {
419
+ ...dropInConfig,
420
+ paymentMethodComponents: [
421
+ Card,
422
+ Bancontact,
423
+ Ach,
424
+ AmazonPay,
425
+ ApplePay,
426
+ BcmcMobile,
427
+ BacsDirectDebit,
428
+ CashAppPay,
429
+ EPS,
430
+ GooglePay,
431
+ Klarna,
432
+ PayByBank,
433
+ PayPal,
434
+ SepaDirectDebit,
435
+ Trustly,
436
+ Twint,
437
+ PayByBankUS,
438
+ Redirect
439
+ ]
440
+ }).mount(dropInContainerRef.value);
441
+ injectStylesToShadowRoot(adyenCss);
442
+ } catch (error) {
443
+ logger.error(
444
+ "PAYMENT_INTEGRATION_INITIALIZATION_FAILED",
445
+ "Failed to mount Adyen web drop-in",
446
+ { error }
447
+ );
448
+ }
449
+ }
450
+ async function unmountDropIn() {
451
+ if (dropInInstance) {
452
+ dropInInstance.unmount();
453
+ dropInInstance = null;
454
+ }
455
+ if (dropInContainerRef.value) {
456
+ dropInContainerRef.value.innerHTML = "";
457
+ }
458
+ }
459
+ function injectStylesToShadowRoot(adyenCss) {
460
+ var _a;
461
+ const root = (_a = dropInContainerRef.value) == null ? void 0 : _a.getRootNode();
462
+ if (root instanceof ShadowRoot) {
463
+ const adyenStyle = document.createElement("style");
464
+ adyenStyle.textContent = adyenCss;
465
+ root.appendChild(adyenStyle);
466
+ const style = document.createElement("style");
467
+ style.textContent = `
468
+ :host {
469
+ --adyen-sdk-color-background-secondary: transparent;
470
+ --adyen-sdk-color-background-primary: rgb(243 244 246 / 0.5);
471
+ --adyen-sdk-color-outline-secondary: #e5e7eb;
472
+ --adyen-sdk-color-outline-primary: transparent;
473
+ --adyen-sdk-color-background-always-dark: var(--color-primary-500);
474
+ --adyen-sdk-color-background-inverse-primary-hover: var(--color-primary-600);
475
+ }
476
+
477
+ .adyen-checkout__payment-method__image__wrapper {
478
+ width: 32px;
479
+ height: 32px;
480
+ }
481
+
482
+ .adyen-checkout__payment-method__image {
483
+ height: 32px;
484
+ }
485
+
486
+ .adyen-checkout__input-wrapper,
487
+ .adyen-checkout__input {
488
+ border-color: rgb(229, 231, 235);
489
+ border-radius: var(--adyen-sdk-border-radius-s, 4px);
490
+ }
491
+
492
+ .adyen-checkout__button,
493
+ .adyen-checkout__payment-method {
494
+ border-radius: var(--adyen-sdk-border-radius-s, 4px);
495
+ }
496
+
497
+ .adyen-checkout__payment-method {
498
+ border-color: rgb(229, 231, 235);
499
+ box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
500
+ transition: box-shadow 0.2s ease-in-out;
501
+ }
502
+
503
+ .adyen-checkout__payment-method--selected {
504
+ box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
505
+ }
506
+
507
+ .adyen-checkout__payment-method:after {
508
+ transform: scale(0%);
509
+ }
510
+
511
+ .adyen-checkout__paypal__button {
512
+ display: block !important;
513
+ }
514
+
515
+ .adyen-checkout__payment-methods-list {
516
+ gap: 4px;
517
+ }
518
+
519
+ .adyen-checkout__dropdown__list {
520
+ background-color: white;
521
+ border-radius: var(--adyen-sdk-border-radius-s, 4px);
522
+ }
523
+
524
+ .adyen-checkout__payment-method.adyen-checkout__payment-method--selected:after {
525
+ content: '✓';
526
+ width: 20px;
527
+ height: 20px;
528
+ border-radius: 10px;
529
+ background-color: var(--color-primary-600);
530
+ position: absolute;
531
+ top: 14px;
532
+ right: 14px;
533
+ text-align: center;
534
+ line-height: 20px;
535
+ color: white;
536
+ transform: scale(100%);
537
+ font-size: 12px;
538
+ }
539
+
540
+ .adyen-checkout__payment-method__header {
541
+ padding: 8px 16px !important;
542
+ }
543
+
544
+ .adyen-checkout__payment-method__brands {
545
+ align-items: center;
546
+ }
547
+ .adyen-checkout__payment-method__brand-number {
548
+ line-height: 1;
549
+ }
550
+ .adyen-checkout__button__text {
551
+ font-size: 14px;
552
+ }
553
+ .adyen-checkout__store-details {
554
+ background: transparent;
555
+ padding: 0;
556
+ }
557
+ .adyen-checkout__checkbox__input + .adyen-checkout__checkbox__label:after {
558
+ border-color: rgb(229, 231, 235);
559
+ }
560
+ `;
561
+ if (props.variant === "AUTHORIZE") {
562
+ style.textContent += `
563
+ .adyen-checkout__payment-method--cashapp .adyen-checkout-pm-details-wrapper {
564
+ display: none;
565
+ }
566
+ `;
567
+ }
568
+ root.appendChild(style);
569
+ }
570
+ }
571
+ function handleOnSubmit(...args) {
572
+ const [state, _component, actions] = args;
573
+ props.validateOnSubmit().then((isValid) => {
574
+ if (!isValid) {
575
+ return;
576
+ }
577
+ const paymentAcceptorId = props.paymentMethodOptionResponseEntry.payment_acceptor.id;
578
+ const adyen = {
579
+ risk_data: transformObjectToAdyenObject(state.data.riskData),
580
+ payment_method: transformObjectToAdyenObject(state.data.paymentMethod),
581
+ browser_info: transformObjectToAdyenObject(state.data.browserInfo)
582
+ };
583
+ if (props.variant === "AUTHORIZE") {
584
+ const returnUrl = createReturnUrl({
585
+ paymentAcceptorId: props.paymentMethodOptionResponseEntry.payment_acceptor.id,
586
+ redirectUrl: window.location.href
587
+ });
588
+ authorizePayment({
589
+ payment_acceptor_id: paymentAcceptorId,
590
+ ...props.customerId ? { customer_id: props.customerId } : {},
591
+ payment_gateway_variant: PAYMENT_GATEWAY_VARIANT_ADYEN,
592
+ adyen: {
593
+ ...adyen,
594
+ store_payment_method: props.forceStorePaymentMethod || state.data.storePaymentMethod
595
+ },
596
+ amount: props.amount,
597
+ ...props.context ? { context: props.context } : {},
598
+ return_url: returnUrl
599
+ }).then((paymentResult) => {
600
+ const paymentMethodType = state.data.paymentMethod.type;
601
+ if (["FAILURE", "REFUSED"].includes(paymentResult.status)) {
602
+ logger.error(
603
+ "PAYMENT_AUTHORIZATION_FAILED",
604
+ `Failed payment authorization for payment acceptor with id ${paymentAcceptorId}`,
605
+ { error: paymentResult }
606
+ );
607
+ actions.resolve({ resultCode: "Error" });
608
+ return;
609
+ }
610
+ if (paymentResult.status === "ACTION_REQUIRED" && paymentResult.action.payment_gateway_variant === PAYMENT_GATEWAY_VARIANT_ADYEN) {
611
+ const requiredAction = handleActionRequiredPaymentAction(
612
+ paymentResult,
613
+ paymentMethodType
614
+ );
615
+ if (!requiredAction) {
616
+ logger.error(
617
+ "PAYMENT_AUTHORIZATION_FAILED",
618
+ `Failed payment authorization for payment acceptor with id ${paymentAcceptorId}`,
619
+ { error: paymentResult }
620
+ );
621
+ return;
622
+ }
623
+ dropInInstance.handleAction(requiredAction);
624
+ actions.resolve({
625
+ resultCode: paymentResult.action.adyen.result_code,
626
+ action: requiredAction
627
+ });
628
+ return;
629
+ }
630
+ showPaymentSuccess.value = true;
631
+ actions.resolve({ resultCode: "Authorised" });
632
+ }).catch((error) => {
633
+ logger.error(
634
+ "PAYMENT_AUTHORIZATION_FAILED",
635
+ `Failed payment authorization for payment acceptor with id ${paymentAcceptorId}`,
636
+ { error }
637
+ );
638
+ actions.resolve({ resultCode: "Error" });
639
+ });
640
+ return;
641
+ }
642
+ if (props.variant === "TOKENIZE") {
643
+ const returnUrl = createReturnUrl({
644
+ paymentAcceptorId: props.paymentMethodOptionResponseEntry.payment_acceptor.id,
645
+ redirectUrl: window.location.href
646
+ });
647
+ if (!props.customerId) {
648
+ logger.error(
649
+ "TOKENIZATION_FAILED",
650
+ `Missing customer id for payment acceptor with id ${paymentAcceptorId}`
651
+ );
652
+ return;
653
+ }
654
+ tokenizePaymentMethod({
655
+ customer_id: props.customerId,
656
+ payment_acceptor_id: paymentAcceptorId,
657
+ payment_gateway_variant: PAYMENT_GATEWAY_VARIANT_ADYEN,
658
+ adyen,
659
+ return_url: returnUrl
660
+ }).then((paymentResult) => {
661
+ const paymentMethodType = state.data.paymentMethod.type;
662
+ if (["FAILURE", "REFUSED"].includes(paymentResult.status)) {
663
+ logger.error(
664
+ "TOKENIZATION_FAILED",
665
+ `Tokenization failed for payment acceptor with id ${paymentAcceptorId}`,
666
+ { error: paymentResult }
667
+ );
668
+ actions.resolve({ resultCode: "Error" });
669
+ return;
670
+ }
671
+ if (paymentResult.status === "ACTION_REQUIRED" && paymentResult.action.payment_gateway_variant === PAYMENT_GATEWAY_VARIANT_ADYEN) {
672
+ const requiredAction = handleActionRequiredPaymentAction(
673
+ paymentResult,
674
+ paymentMethodType
675
+ );
676
+ if (!requiredAction) {
677
+ logger.error(
678
+ "TOKENIZATION_FAILED",
679
+ `Tokenization failed for payment acceptor with id ${paymentAcceptorId}`,
680
+ { error: paymentResult }
681
+ );
682
+ return;
683
+ }
684
+ dropInInstance.handleAction(requiredAction);
685
+ actions.resolve({
686
+ resultCode: paymentResult.action.adyen.result_code,
687
+ action: requiredAction
688
+ });
689
+ return;
690
+ }
691
+ showPaymentSuccess.value = true;
692
+ actions.resolve({ resultCode: "Authorised" });
693
+ }).catch((error) => {
694
+ logger.error(
695
+ "TOKENIZATION_FAILED",
696
+ `Tokenization failed for payment acceptor with id ${paymentAcceptorId}`,
697
+ { error }
698
+ );
699
+ actions.resolve({ resultCode: "Error" });
700
+ });
701
+ }
702
+ }).catch((error) => {
703
+ logger.error(
704
+ "INTEGRATION_ERROR",
705
+ "Unhandled error in payment submission flow",
706
+ {},
707
+ error
708
+ );
709
+ });
710
+ }
711
+ function handleActionRequiredPaymentAction(response, paymentMethodType) {
712
+ if (response.status !== "ACTION_REQUIRED") {
713
+ return void 0;
714
+ }
715
+ const action = response.action;
716
+ if (action.payment_gateway_variant != "ADYEN") {
717
+ return void 0;
718
+ }
719
+ const adyenRequiredAction = action.adyen;
720
+ return {
721
+ paymentMethodType: (adyenRequiredAction == null ? void 0 : adyenRequiredAction.payment_method_type) ?? paymentMethodType,
722
+ method: action.method,
723
+ url: action.url,
724
+ data: action.data,
725
+ type: adyenRequiredAction == null ? void 0 : adyenRequiredAction.action_type,
726
+ paymentData: adyenRequiredAction == null ? void 0 : adyenRequiredAction.payment_data,
727
+ sdkData: adyenRequiredAction == null ? void 0 : adyenRequiredAction.sdk_data
728
+ };
729
+ }
730
+ function handleOnAdditionalDetails(...args) {
731
+ const [state] = args;
732
+ const detailsResult = state.data.details;
733
+ const paymentDataResult = state.data.paymentData;
734
+ if (props.paymentMethodOptionResponseEntry.payment_acceptor.id) {
735
+ handlePaymentDetails({
736
+ // For the moment: Adyen gives a null value back which is not accepted by Solvimon API, so filter that out
737
+ detailsResult: detailsResult ? removeEmptyValues(detailsResult) : void 0,
738
+ paymentDataResult,
739
+ paymentAcceptorId: props.paymentMethodOptionResponseEntry.payment_acceptor.id
740
+ });
741
+ return;
742
+ }
743
+ const error = {
744
+ code: "UNKNOWN_ERROR",
745
+ message: "Payment failed",
746
+ error: args
747
+ };
748
+ emit("payment-failed", error);
749
+ integrationError.value = error;
750
+ }
751
+ function removeEmptyValues(obj) {
752
+ return Object.fromEntries(
753
+ Object.entries(obj).filter(([, value]) => value !== null && value !== void 0)
754
+ );
755
+ }
756
+ function handleOnPaymentFailed(...args) {
757
+ const [data] = args;
758
+ const error = {
759
+ code: "UNKNOWN_ERROR",
760
+ message: "Payment failed",
761
+ error: data
762
+ };
763
+ emit("payment-failed", error);
764
+ integrationError.value = error;
765
+ }
766
+ function handleOnPaymentCompleted(...args) {
767
+ const [, component] = args;
768
+ component == null ? void 0 : component.unmount();
769
+ emit("payment-success");
770
+ }
771
+ function handleOnError(...args) {
772
+ const [data, component] = args;
773
+ if (data.name === "CANCEL") {
774
+ return;
775
+ }
776
+ const error = {
777
+ code: "UNKNOWN_ERROR",
778
+ message: "Something went wrong",
779
+ error: data
780
+ };
781
+ logger.error("INTEGRATION_ERROR", "Something went wrong", { error: data });
782
+ integrationError.value = error;
783
+ component == null ? void 0 : component.unmount();
784
+ }
785
+ function handlePaymentDetails({
786
+ detailsResult,
787
+ threeDSResult,
788
+ redirectResult,
789
+ paymentDataResult,
790
+ paymentAcceptorId
791
+ }) {
792
+ getPaymentDetails({
793
+ paymentAcceptorId,
794
+ paymentGatewayVariant: PAYMENT_GATEWAY_VARIANT_ADYEN,
795
+ adyen: {
796
+ ...detailsResult ? { details: detailsResult } : {},
797
+ ...redirectResult ? { redirect_result: redirectResult } : {},
798
+ ...threeDSResult ? { threeds_result: threeDSResult } : {},
799
+ ...paymentDataResult ? { payment_data: paymentDataResult } : {}
800
+ }
801
+ }).then((result) => {
802
+ if (result.payment_status === "FAILURE") {
803
+ emit("payment-failed", {
804
+ code: "UNKNOWN_ERROR",
805
+ message: "Failed getting payment details",
806
+ error: result
807
+ });
808
+ return;
809
+ }
810
+ if (result.payment_status === "SUCCESS") {
811
+ emit("payment-success");
812
+ return;
813
+ }
814
+ }).catch((error) => {
815
+ logger.error("PAYMENT_DETAILS_CALL_FAILED", "Failed fetching payment details", {
816
+ error
817
+ });
818
+ });
819
+ }
820
+ function handleRedirectResult() {
821
+ const redirectResult = getQueryParam(REDIRECT_RESULT_QUERY_STRING);
822
+ const paymentAcceptorId = getQueryParam(PAYMENT_ACCEPTOR_ID_QUERY_STRING);
823
+ if (!redirectResult) {
824
+ return;
825
+ }
826
+ if (!paymentAcceptorId) {
827
+ logger.error(
828
+ "INVALID_REDIRECT_RESULT",
829
+ "Redirect result is set but payment acceptor id is missing",
830
+ { context: { redirectResult } }
831
+ );
832
+ return;
833
+ }
834
+ handlePaymentDetails({
835
+ paymentAcceptorId,
836
+ detailsResult: {
837
+ redirectResult: decodeURI(redirectResult)
838
+ }
839
+ });
840
+ }
841
+ onMounted(() => {
842
+ void mountDropIn();
843
+ handleRedirectResult();
844
+ });
845
+ onBeforeUnmount(() => {
846
+ void unmountDropIn();
847
+ });
848
+ watch(
849
+ () => props.paymentMethodOptionResponseEntry,
850
+ (newValue, oldValue) => {
851
+ if (isEqual(newValue, oldValue)) return;
852
+ void mountDropIn();
853
+ },
854
+ { deep: true }
855
+ );
856
+ return (_ctx, _cache) => {
857
+ return openBlock(), createElementBlock(Fragment, null, [
858
+ showPaymentSuccess.value ? (openBlock(), createBlock(_sfc_main$3, {
859
+ key: 0,
860
+ variant: __props.variant
861
+ }, null, 8, ["variant"])) : integrationError.value ? (openBlock(), createBlock(_sfc_main$2, {
862
+ key: 1,
863
+ error: integrationError.value
864
+ }, null, 8, ["error"])) : createCommentVNode("", true),
865
+ createElementVNode("div", {
866
+ ref_key: "dropInContainerRef",
867
+ ref: dropInContainerRef
868
+ }, null, 512)
869
+ ], 64);
870
+ };
871
+ }
872
+ });
873
+ const _sfc_main = /* @__PURE__ */ defineComponent({
874
+ __name: "PaymentIntegrationForm",
875
+ props: {
876
+ customerId: { type: String },
877
+ variant: { type: String },
878
+ context: { type: Object },
879
+ paymentMethodOptions: { type: Array },
880
+ countryCode: { type: String },
881
+ invoiceId: { type: String },
882
+ amount: { type: Object },
883
+ selectedOption: { type: String },
884
+ validateOnSubmit: { type: Function },
885
+ forceStorePaymentMethod: { type: Boolean }
886
+ },
887
+ emits: ["select", "payment-failed", "payment-success", "ready"],
888
+ setup(__props, { expose: __expose, emit: __emit }) {
889
+ const props = __props;
890
+ const emit = __emit;
891
+ __expose({ submit });
892
+ const { $t } = useIntl();
893
+ const selectedIntegration = ref();
894
+ const integrationRefs = ref(/* @__PURE__ */ new Map());
895
+ const showIntegrationError = ref(false);
896
+ function handleSelect({
897
+ paymentGatewayVariant,
898
+ paymentMethodType
899
+ }) {
900
+ showIntegrationError.value = false;
901
+ emit("select", { paymentGatewayVariant, paymentMethodType });
902
+ }
903
+ function submit() {
904
+ var _a, _b;
905
+ if (!selectedIntegration.value) {
906
+ showIntegrationError.value = true;
907
+ void ((_a = props.validateOnSubmit) == null ? void 0 : _a.call(props));
908
+ }
909
+ (_b = integrationRefs.value.get(selectedIntegration.value)) == null ? void 0 : _b.submit();
910
+ }
911
+ return (_ctx, _cache) => {
912
+ return openBlock(), createElementBlock(Fragment, null, [
913
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.paymentMethodOptions, (paymentMethodOption) => {
914
+ var _a;
915
+ return openBlock(), createElementBlock(Fragment, {
916
+ key: paymentMethodOption.integration.id
917
+ }, [
918
+ ((_a = paymentMethodOption.integration.payment_gateway) == null ? void 0 : _a.variant) === "ADYEN" ? (openBlock(), createBlock(_sfc_main$1, {
919
+ key: 0,
920
+ ref_for: true,
921
+ ref: (el) => integrationRefs.value.set(
922
+ paymentMethodOption.integration.payment_gateway.variant,
923
+ el
924
+ ),
925
+ context: __props.context,
926
+ "payment-method-option-response-entry": paymentMethodOption,
927
+ "country-code": __props.countryCode,
928
+ "customer-id": __props.customerId,
929
+ variant: __props.variant,
930
+ amount: __props.amount,
931
+ "invoice-id": __props.invoiceId,
932
+ selected: selectedIntegration.value === paymentMethodOption.integration.payment_gateway.variant,
933
+ "validate-on-submit": __props.validateOnSubmit,
934
+ "force-store-payment-method": __props.forceStorePaymentMethod,
935
+ onSelect: handleSelect,
936
+ onPaymentFailed: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("payment-failed", $event)),
937
+ onPaymentSuccess: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("payment-success")),
938
+ onReady: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("ready"))
939
+ }, null, 8, ["context", "payment-method-option-response-entry", "country-code", "customer-id", "variant", "amount", "invoice-id", "selected", "validate-on-submit", "force-store-payment-method"])) : createCommentVNode("", true)
940
+ ], 64);
941
+ }), 128)),
942
+ showIntegrationError.value ? (openBlock(), createBlock(unref(_sfc_main$8), {
943
+ key: 0,
944
+ variant: "error",
945
+ class: "mt-2"
946
+ }, {
947
+ default: withCtx(() => [
948
+ createTextVNode(toDisplayString(unref($t)({
949
+ defaultMessage: "Select a payment method",
950
+ id: "payment_integration_form.select_payment_method_error",
951
+ description: "Error shown when no payment method is selected"
952
+ })), 1)
953
+ ]),
954
+ _: 1
955
+ })) : createCommentVNode("", true)
956
+ ], 64);
957
+ };
958
+ }
959
+ });
960
+ export {
961
+ _sfc_main as _
962
+ };