@solvimon/solvimon-web 0.1.0-alpha.11 → 0.1.0-alpha.13

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 (19) hide show
  1. package/dist/{PaymentIntegrationForm-DFnwutjd.mjs → PaymentIntegrationForm-CkXYj9xs.mjs} +1 -1
  2. package/dist/{PaymentIntegrationForm-xkf4TUaD.js → PaymentIntegrationForm-bfGmfwQT.js} +1 -1
  3. package/dist/{PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-uk5MO0ce.mjs → PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BnMmcoAu.mjs} +1 -0
  4. package/dist/{PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-DTIY4s7C.js → PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CiyyUp4z.js} +1 -1
  5. package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -1
  6. package/dist/components/InvoiceDetails/InvoiceDetails.es.js +1 -1
  7. package/dist/components/PaymentHistory/PaymentHistory.cjs.js +1 -1
  8. package/dist/components/PaymentHistory/PaymentHistory.es.js +1 -1
  9. package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +1 -1
  10. package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +1 -1
  11. package/dist/screens/Checkout/Checkout.cjs.js +1 -1
  12. package/dist/screens/Checkout/Checkout.es.js +22 -16
  13. package/dist/screens/PayInvoice/PayInvoice.cjs.js +1 -1
  14. package/dist/screens/PayInvoice/PayInvoice.es.js +1 -1
  15. package/dist/{useInvoiceData-BJwwDur7.mjs → useInvoiceData-D7YN2SAd.mjs} +1 -1
  16. package/dist/{useInvoiceData-D2jkdmlA.js → useInvoiceData-lIMEwwMy.js} +1 -1
  17. package/dist/{useWatchDebounced-2ZLnfgvG.js → useWatchDebounced-C_YxgoQ6.js} +1 -1
  18. package/dist/{useWatchDebounced-D1xuIX6_.mjs → useWatchDebounced-Zmxd6InB.mjs} +8 -4
  19. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { _ as _sfc_main } from "./PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-uk5MO0ce.mjs";
1
+ import { _ as _sfc_main } from "./PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BnMmcoAu.mjs";
2
2
  export {
3
3
  _sfc_main as default
4
4
  };
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-DTIY4s7C.js");exports.default=e._sfc_main;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CiyyUp4z.js");exports.default=e._sfc_main;
@@ -898,6 +898,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
898
898
  paymentMethodType
899
899
  }) {
900
900
  showIntegrationError.value = false;
901
+ selectedIntegration.value = paymentGatewayVariant;
901
902
  emit("select", { paymentGatewayVariant, paymentMethodType });
902
903
  }
903
904
  function submit() {
@@ -1 +1 @@
1
- const e=require("vue"),t=require("./vendor-ui-5pJF5KBP.js"),n=require("./adyen-R6aSZ0Yf.js"),a=require("./payments-DkHhTHto.js"),o=require("./paymentMethods-C_sdTkSF.js"),r=require("./component-BOqPDAVk.js"),i=e=>{let t={};return"TOKENIZE"===e&&(t={"en-US":{payButton:"Add payment method",confirmPurchase:"Add payment method"},"fr-FR":{payButton:"Ajouter un moyen de paiement",confirmPurchase:"Ajouter un moyen de paiement"},"de-DE":{payButton:"Zahlungsmethode hinzufügen",confirmPurchase:"Zahlungsmethode hinzufügen"},"it-IT":{payButton:"Aggiungi metodo di pagamento",confirmPurchase:"Aggiungi metodo di pagamento"},"es-ES":{payButton:"Añadir método de pago",confirmPurchase:"Añadir método de pago"},"nl-NL":{payButton:"Betaalmethode toevoegen",confirmPurchase:"Betaalmethode toevoegen"},"pt-BR":{payButton:"Adicionar método de pagamento",confirmPurchase:"Adicionar método de pagamento"},"pt-PT":{payButton:"Adicionar método de pagamento",confirmPurchase:"Adicionar método de pagamento"},"pl-PL":{payButton:"Dodaj metodę płatności",confirmPurchase:"Dodaj metodę płatności"},"ru-RU":{payButton:"Добавить способ оплаты",confirmPurchase:"Добавить способ оплаты"},"sv-SE":{payButton:"Lägg till betalningsmetod",confirmPurchase:"Lägg till betalningsmetod"},"da-DK":{payButton:"Tilføj betalingsmetode",confirmPurchase:"Tilføj betalingsmetode"},"fi-FI":{payButton:"Lisää maksutapa",confirmPurchase:"Lisää maksutapa"},"no-NO":{payButton:"Legg til betalingsmetode",confirmPurchase:"Legg til betalingsmetode"},"cs-CZ":{payButton:"Přidat platební metodu",confirmPurchase:"Přidat platební metodu"},"hu-HU":{payButton:"Fizetési mód hozzáadása",confirmPurchase:"Fizetési mód hozzáadása"},"ro-RO":{payButton:"Adăugați metodă de plată",confirmPurchase:"Adăugați metodă de plată"},"ja-JP":{payButton:"支払い方法を追加",confirmPurchase:"支払い方法を追加"},"ko-KR":{payButton:"결제 수단 추가",confirmPurchase:"결제 수단 추가"},"zh-CN":{payButton:"添加支付方式",confirmPurchase:"添加支付方式"},"zh-TW":{payButton:"新增付款方式",confirmPurchase:"新增付款方式"},ar:{payButton:"إضافة وسيلة دفع",confirmPurchase:"إضافة وسيلة دفع"},"hr-HR":{payButton:"Dodajte način plačanja",confirmPurchase:"Dodajte način plačanja"},"el-GR":{payButton:"Προσθήκη μεθόδου πληρωμής",confirmPurchase:"Προσθήκη μεθόδου πληρωμής"},"sk-SK":{payButton:"Pridať spôsob platby",confirmPurchase:"Pridať spôsob platby"},"sl-SI":{payButton:"Dodajte način plačanja",confirmPurchase:"Dodajte način plačanja"},"bg-BG":{payButton:"Добавяне на начин на плащане",confirmPurchase:"Добавяне на начин на плащане"},"ca-ES":{payButton:"Afegir mètode de pagament",confirmPurchase:"Afegir mètode de pagament"},"et-EE":{payButton:"Lisa makseviis",confirmPurchase:"Lisa makseviis"},"lv-LV":{payButton:"Pievienot maksājuma veidu",confirmPurchase:"Pievienot maksājuma veidu"},"lt-LT":{payButton:"Pridėti mokėjimo metodą",confirmPurchase:"Pridėti mokėjimo metodą"}}),t},d=e.defineComponent({__name:"PaymentCompletedCard",props:{amount:{type:Object},variant:{type:String}},setup(a){const o=a,{$t:r}=t.useIntl(),i=e.computed(()=>"AUTHORIZE"===o.variant?r({defaultMessage:"Payment successful",description:"The title for when a payment has been successful",id:"payment_completed_card.title.authorize"}):r({defaultMessage:"Your payment method is added",description:"The title for when a payment method was successfully added",id:"payment_completed_card.title.tokenize"}));return(o,d)=>(e.openBlock(),e.createBlock(n._sfc_main,{status:"success",title:i.value},{default:e.withCtx(()=>[a.amount?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:0,variant:"body-sm",class:"mt-1"},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$6),{icon:"check"}),e.createTextVNode(e.toDisplayString(e.unref(t.formatAmount)(a.amount)),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(t._sfc_main),{variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"You are being redirected...",description:"The text shown after a successful message before a redirect",id:"payment_completed_card.redirect_message"})),1)]),_:1})]),_:1},8,["title"]))}}),c={UNKNOWN_ERROR:{title:"Something went wrong",message:"An unknown error has occurred",isReloadButtonVisible:!0},AUTHORIZATION_FAILED:{title:"Payment failed",message:"The payment failed"},PAYMENT_DETAILS_CALL_FAILED:{title:"Payment details call failed",message:"There was a problem getting the payment details"},PAYMENT_METHOD_STORAGE_FAILED:{title:"Failed storing payment method",message:"Something went wrong with storing the payment method"},REDIRECT_RESULT_PAYMENT_ACCEPTOR_MISSING:{title:"Missing payment acceptor",message:"A redirect result is set, but a payment acceptor is missing in the url"},TOKENIZE_FAILED:{title:"Tokenization failed",message:"The tokenization of the payment method has failed"},PAYMENT_INTEGRATION_INITIALIZATION_FAILED:{title:"Failed loading payment methods",message:"Failed loading payment integration",isReloadButtonVisible:!0},RESOURCE_REVOKED:{title:"Resource revoked",message:"The resource has been revoked",isReloadButtonVisible:!0}},s={class:"flex flex-col items-center gap-6"},m=e.defineComponent({__name:"PaymentErrorCard",props:{error:{type:Object}},setup(a){const o=a,{$t:r}=t.useIntl(),i=e.computed(()=>c[o.error.code]),d=()=>{window.location.reload()};return(a,o)=>(e.openBlock(),e.createBlock(n._sfc_main,{status:"error",title:i.value.title},{default:e.withCtx(()=>[e.createElementVNode("div",s,[e.createVNode(e.unref(t._sfc_main),{variant:"body-xs",shade:"lighter",class:"mt-3"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.value.message),1)]),_:1}),i.value.isReloadButtonVisible?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,type:"button",color:"gray",variant:"outline",onClick:d},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"Try again",description:"Retry button text when an error has happened during a payment",id:"payments.retry_button.label"})),1)]),_:1})):e.createCommentVNode("",!0)])]),_:1},8,["title"]))}}),p=["applepay"];const u="ADYEN",l=e.defineComponent({__name:"PaymentIntegrationFormAdyen",props:{countryCode:{type:String},customerId:{type:String},invoiceId:{type:String},paymentMethodOptionResponseEntry:{type:Object},variant:{type:String},selected:{type:Boolean},amount:{type:Object},validateOnSubmit:{type:Function,default:()=>Promise.resolve(!0)},context:{type:Object},forceStorePaymentMethod:{type:Boolean}},emits:["select","payment-failed","payment-success","ready"],setup(c,{expose:s,emit:l}){let y=null,h=null;const _=c,f=l;s({submit:function(){try{null==y||y.submit()}catch(e){A.error("ADYEN_SUBMIT_FAILED","Failed to submit Adyen drop-in",{},e)}}});const g=e.ref(),v=e.ref(!1),E=e.ref(),A=r.useLogger(),{locale:I}=t.useIntl(),{authorizePayment:R,getPaymentDetails:b}=a.createPaymentsService(),{tokenizePaymentMethod:k}=o.createPaymentMethodsService(),T=e.inject(r.EXPERIMENTAL_FEATURE_INJECTION_KEY),P=e.computed(()=>"TOKENIZE"===_.variant);async function O(){var e;const t=n.transformToAdyenAmount(_.amount),a=(null==(e=null==T?void 0:T.value)?void 0:e["express-checkout"])?function(e){return e.filter(e=>!p.some(t=>{var n;return t===(null==(n=e.type)?void 0:n.toLowerCase())}))}(n.mapAdyenPaymentMethods(_.paymentMethodOptionResponseEntry)):n.mapAdyenPaymentMethods(_.paymentMethodOptionResponseEntry);return{checkoutConfig:{amount:t,clientKey:n.getAdyenClientKeyFromPaymentMethodOptionsResponse(_.paymentMethodOptionResponseEntry),environment:n.getAdyenEnvironmentFromPaymentMethodOptionsResponse(_.paymentMethodOptionResponseEntry,A),locale:I,translations:i(_.variant),countryCode:_.countryCode,analytics:{enabled:!1},paymentMethodsResponse:{paymentMethods:a},onSubmit:B,onAdditionalDetails:x,onPaymentCompleted:S,onPaymentFailed:M,onError:D,showPayButton:P.value},dropInConfig:{disableFinalAnimation:!0,paymentMethodsConfiguration:{card:{hasHolderName:!0,holderNameRequired:!0,enableStoreDetails:!_.forceStorePaymentMethod&&"AUTHORIZE"===_.variant},paypal:{intent:t.value>0?"authorize":"tokenize",showPayButton:!0}},openFirstPaymentMethod:_.selected,onSelect:({props:{type:e}})=>{e&&f("select",{paymentMethodType:e,paymentGatewayVariant:"ADYEN"})},onReady:()=>f("ready")}}}async function N(){if(g.value)try{await w();const[e,{default:t}]=await Promise.all([Promise.resolve().then(()=>require("./index-DIFK3mcJ.js")),Promise.resolve().then(()=>require("./adyen-DZsyEXkw.js"))]),{AdyenCheckout:n,Dropin:a,Card:o,Bancontact:r,Ach:i,AmazonPay:d,ApplePay:c,BcmcMobile:s,BacsDirectDebit:m,CashAppPay:p,EPS:u,GooglePay:l,Klarna:f,PayByBank:v,PayPal:E,SepaDirectDebit:A,Trustly:I,Twint:R,PayByBankUS:b,Redirect:k}=e,{checkoutConfig:T,dropInConfig:P}=await O();h=await n(T),y=new a(h,{...P,paymentMethodComponents:[o,r,i,d,c,s,m,p,u,l,f,v,E,A,I,R,b,k]}).mount(g.value),function(e){var t;const n=null==(t=g.value)?void 0:t.getRootNode();if(n instanceof ShadowRoot){const t=document.createElement("style");t.textContent=e,n.appendChild(t);const a=document.createElement("style");a.textContent="\n :host {\n --adyen-sdk-color-background-secondary: transparent;\n --adyen-sdk-color-background-primary: rgb(243 244 246 / 0.5);\n --adyen-sdk-color-outline-secondary: #e5e7eb;\n --adyen-sdk-color-outline-primary: transparent;\n --adyen-sdk-color-background-always-dark: var(--color-primary-500);\n --adyen-sdk-color-background-inverse-primary-hover: var(--color-primary-600);\n }\n\n .adyen-checkout__payment-method__image__wrapper {\n width: 32px;\n height: 32px;\n }\n\n .adyen-checkout__payment-method__image {\n height: 32px;\n }\n\n .adyen-checkout__input-wrapper,\n .adyen-checkout__input {\n border-color: rgb(229, 231, 235);\n border-radius: var(--adyen-sdk-border-radius-s, 4px);\n }\n\n .adyen-checkout__button,\n .adyen-checkout__payment-method {\n border-radius: var(--adyen-sdk-border-radius-s, 4px);\n }\n\n .adyen-checkout__payment-method {\n border-color: rgb(229, 231, 235);\n box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);\n transition: box-shadow 0.2s ease-in-out;\n }\n\n .adyen-checkout__payment-method--selected {\n box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n }\n\n .adyen-checkout__payment-method:after {\n transform: scale(0%);\n }\n\n .adyen-checkout__paypal__button {\n display: block !important;\n }\n\n .adyen-checkout__payment-methods-list {\n gap: 4px;\n }\n\n .adyen-checkout__dropdown__list {\n background-color: white;\n border-radius: var(--adyen-sdk-border-radius-s, 4px);\n }\n\n .adyen-checkout__payment-method.adyen-checkout__payment-method--selected:after {\n content: '✓';\n width: 20px;\n height: 20px;\n border-radius: 10px;\n background-color: var(--color-primary-600);\n position: absolute;\n top: 14px;\n right: 14px;\n text-align: center;\n line-height: 20px;\n color: white;\n transform: scale(100%);\n font-size: 12px;\n }\n\n .adyen-checkout__payment-method__header {\n padding: 8px 16px !important;\n }\n\n .adyen-checkout__payment-method__brands {\n align-items: center;\n }\n .adyen-checkout__payment-method__brand-number {\n line-height: 1;\n }\n .adyen-checkout__button__text {\n font-size: 14px;\n }\n .adyen-checkout__store-details {\n background: transparent;\n padding: 0;\n }\n .adyen-checkout__checkbox__input + .adyen-checkout__checkbox__label:after {\n border-color: rgb(229, 231, 235);\n }\n ","AUTHORIZE"===_.variant&&(a.textContent+="\n .adyen-checkout__payment-method--cashapp .adyen-checkout-pm-details-wrapper {\n display: none;\n }\n "),n.appendChild(a)}}(t)}catch(e){A.error("PAYMENT_INTEGRATION_INITIALIZATION_FAILED","Failed to mount Adyen web drop-in",{error:e})}}async function w(){y&&(y.unmount(),y=null),g.value&&(g.value.innerHTML="")}function B(...e){const[t,a,o]=e;_.validateOnSubmit().then(e=>{if(!e)return;const a=_.paymentMethodOptionResponseEntry.payment_acceptor.id,r={risk_data:n.transformObjectToAdyenObject(t.data.riskData),payment_method:n.transformObjectToAdyenObject(t.data.paymentMethod),browser_info:n.transformObjectToAdyenObject(t.data.browserInfo)};if("AUTHORIZE"===_.variant){const e=n.createReturnUrl({paymentAcceptorId:_.paymentMethodOptionResponseEntry.payment_acceptor.id,redirectUrl:window.location.href});return void R({payment_acceptor_id:a,..._.customerId?{customer_id:_.customerId}:{},payment_gateway_variant:u,adyen:{...r,store_payment_method:_.forceStorePaymentMethod||t.data.storePaymentMethod},amount:_.amount,..._.context?{context:_.context}:{},return_url:e}).then(e=>{const n=t.data.paymentMethod.type;if("ACTION_REQUIRED"===e.status&&e.action.payment_gateway_variant===u){const t=C(e,n);return t?(y.handleAction(t),void o.resolve({resultCode:e.action.adyen.result_code,action:t})):void A.error("PAYMENT_AUTHORIZATION_FAILED",`Failed payment authorization for payment acceptor with id ${a}`,{error:e})}if("AUTHORIZED"===e.payment.result)return v.value=!0,void o.resolve({resultCode:"Authorised"});A.error("PAYMENT_AUTHORIZATION_FAILED",`Failed payment authorization for payment acceptor with id ${a}`,{error:e}),o.resolve({resultCode:"Error"})}).catch(e=>{A.error("PAYMENT_AUTHORIZATION_FAILED",`Failed payment authorization for payment acceptor with id ${a}`,{error:e}),o.resolve({resultCode:"Error"})})}if("TOKENIZE"===_.variant){const e=n.createReturnUrl({paymentAcceptorId:_.paymentMethodOptionResponseEntry.payment_acceptor.id,redirectUrl:window.location.href});if(!_.customerId)return void A.error("TOKENIZATION_FAILED",`Missing customer id for payment acceptor with id ${a}`);k({customer_id:_.customerId,payment_acceptor_id:a,payment_gateway_variant:u,adyen:r,return_url:e}).then(e=>{const n=t.data.paymentMethod.type;if("ACTION_REQUIRED"===e.status&&e.action.payment_gateway_variant===u){const t=C(e,n);return t?(y.handleAction(t),void o.resolve({resultCode:e.action.adyen.result_code,action:t})):void A.error("TOKENIZATION_FAILED",`Tokenization failed for payment acceptor with id ${a}`,{error:e})}if("AUTHORIZED"===e.payment.result)return v.value=!0,void o.resolve({resultCode:"Authorised"});A.error("TOKENIZATION_FAILED",`Tokenization failed for payment acceptor with id ${a}`,{error:e}),o.resolve({resultCode:"Error"})}).catch(e=>{A.error("TOKENIZATION_FAILED",`Tokenization failed for payment acceptor with id ${a}`,{error:e}),o.resolve({resultCode:"Error"})})}}).catch(e=>{A.error("INTEGRATION_ERROR","Unhandled error in payment submission flow",{},e)})}function C(e,t){if("ACTION_REQUIRED"!==e.status)return;const n=e.action;if("ADYEN"!=n.payment_gateway_variant)return;const a=n.adyen;return{paymentMethodType:(null==a?void 0:a.payment_method_type)??t,method:n.method,url:n.url,data:n.data,type:null==a?void 0:a.action_type,paymentData:null==a?void 0:a.payment_data,sdkData:null==a?void 0:a.sdk_data}}function x(...e){const[t]=e,n=t.data.details,a=t.data.paymentData;if(_.paymentMethodOptionResponseEntry.payment_acceptor.id)return void L({detailsResult:n?(o=n,Object.fromEntries(Object.entries(o).filter(([,e])=>null!=e))):void 0,paymentDataResult:a,paymentAcceptorId:_.paymentMethodOptionResponseEntry.payment_acceptor.id});var o;const r={code:"UNKNOWN_ERROR",message:"Payment failed",error:e};f("payment-failed",r),E.value=r}function M(...e){const[t]=e,n={code:"UNKNOWN_ERROR",message:"Payment failed",error:t};f("payment-failed",n),E.value=n}function S(...e){const[,t]=e;null==t||t.unmount(),f("payment-success")}function D(...e){const[t,n]=e;if("CANCEL"===t.name)return;const a={code:"UNKNOWN_ERROR",message:"Something went wrong",error:t};A.error("INTEGRATION_ERROR","Something went wrong",{error:t}),E.value=a,null==n||n.unmount()}function L({detailsResult:e,threeDSResult:t,redirectResult:n,paymentDataResult:a,paymentAcceptorId:o}){b({paymentAcceptorId:o,paymentGatewayVariant:u,adyen:{...e?{details:e}:{},...n?{redirect_result:n}:{},...t?{threeds_result:t}:{},...a?{payment_data:a}:{}}}).then(e=>{"FAILURE"!==e.payment_status?"SUCCESS"!==e.payment_status||f("payment-success"):f("payment-failed",{code:"UNKNOWN_ERROR",message:"Failed getting payment details",error:e})}).catch(e=>{A.error("PAYMENT_DETAILS_CALL_FAILED","Failed fetching payment details",{error:e})})}return e.onMounted(()=>{N(),function(){const e=n.getQueryParam(n.REDIRECT_RESULT_QUERY_STRING),t=n.getQueryParam(n.PAYMENT_ACCEPTOR_ID_QUERY_STRING);e&&(t?L({paymentAcceptorId:t,detailsResult:{redirectResult:decodeURI(e)}}):A.error("INVALID_REDIRECT_RESULT","Redirect result is set but payment acceptor id is missing",{context:{redirectResult:e}}))}()}),e.onBeforeUnmount(()=>{w()}),e.watch(()=>_.paymentMethodOptionResponseEntry,(e,n)=>{t.isEqual(e,n)||N()},{deep:!0}),(t,n)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[v.value?(e.openBlock(),e.createBlock(d,{key:0,variant:c.variant},null,8,["variant"])):E.value?(e.openBlock(),e.createBlock(m,{key:1,error:E.value},null,8,["error"])):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"dropInContainerRef",ref:g},null,512)],64))}}),y=e.defineComponent({__name:"PaymentIntegrationForm",props:{customerId:{type:String},variant:{type:String},context:{type:Object},paymentMethodOptions:{type:Array},countryCode:{type:String},invoiceId:{type:String},amount:{type:Object},selectedOption:{type:String},validateOnSubmit:{type:Function},forceStorePaymentMethod:{type:Boolean}},emits:["select","payment-failed","payment-success","ready"],setup(n,{expose:a,emit:o}){const r=n,i=o;a({submit:function(){var e,t;c.value||(m.value=!0,null==(e=r.validateOnSubmit)||e.call(r));null==(t=s.value.get(c.value))||t.submit()}});const{$t:d}=t.useIntl(),c=e.ref(),s=e.ref(new Map),m=e.ref(!1);function p({paymentGatewayVariant:e,paymentMethodType:t}){m.value=!1,i("select",{paymentGatewayVariant:e,paymentMethodType:t})}return(a,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.paymentMethodOptions,t=>{var r;return e.openBlock(),e.createElementBlock(e.Fragment,{key:t.integration.id},["ADYEN"===(null==(r=t.integration.payment_gateway)?void 0:r.variant)?(e.openBlock(),e.createBlock(l,{key:0,ref_for:!0,ref:e=>s.value.set(t.integration.payment_gateway.variant,e),context:n.context,"payment-method-option-response-entry":t,"country-code":n.countryCode,"customer-id":n.customerId,variant:n.variant,amount:n.amount,"invoice-id":n.invoiceId,selected:c.value===t.integration.payment_gateway.variant,"validate-on-submit":n.validateOnSubmit,"force-store-payment-method":n.forceStorePaymentMethod,onSelect:p,onPaymentFailed:o[0]||(o[0]=e=>a.$emit("payment-failed",e)),onPaymentSuccess:o[1]||(o[1]=e=>a.$emit("payment-success")),onReady:o[2]||(o[2]=e=>a.$emit("ready"))},null,8,["context","payment-method-option-response-entry","country-code","customer-id","variant","amount","invoice-id","selected","validate-on-submit","force-store-payment-method"])):e.createCommentVNode("",!0)],64)}),128)),m.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$23),{key:0,variant:"error",class:"mt-2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(d)({defaultMessage:"Select a payment method",id:"payment_integration_form.select_payment_method_error",description:"Error shown when no payment method is selected"})),1)]),_:1})):e.createCommentVNode("",!0)],64))}});exports._sfc_main=y;
1
+ const e=require("vue"),t=require("./vendor-ui-5pJF5KBP.js"),n=require("./adyen-R6aSZ0Yf.js"),a=require("./payments-DkHhTHto.js"),o=require("./paymentMethods-C_sdTkSF.js"),r=require("./component-BOqPDAVk.js"),i=e=>{let t={};return"TOKENIZE"===e&&(t={"en-US":{payButton:"Add payment method",confirmPurchase:"Add payment method"},"fr-FR":{payButton:"Ajouter un moyen de paiement",confirmPurchase:"Ajouter un moyen de paiement"},"de-DE":{payButton:"Zahlungsmethode hinzufügen",confirmPurchase:"Zahlungsmethode hinzufügen"},"it-IT":{payButton:"Aggiungi metodo di pagamento",confirmPurchase:"Aggiungi metodo di pagamento"},"es-ES":{payButton:"Añadir método de pago",confirmPurchase:"Añadir método de pago"},"nl-NL":{payButton:"Betaalmethode toevoegen",confirmPurchase:"Betaalmethode toevoegen"},"pt-BR":{payButton:"Adicionar método de pagamento",confirmPurchase:"Adicionar método de pagamento"},"pt-PT":{payButton:"Adicionar método de pagamento",confirmPurchase:"Adicionar método de pagamento"},"pl-PL":{payButton:"Dodaj metodę płatności",confirmPurchase:"Dodaj metodę płatności"},"ru-RU":{payButton:"Добавить способ оплаты",confirmPurchase:"Добавить способ оплаты"},"sv-SE":{payButton:"Lägg till betalningsmetod",confirmPurchase:"Lägg till betalningsmetod"},"da-DK":{payButton:"Tilføj betalingsmetode",confirmPurchase:"Tilføj betalingsmetode"},"fi-FI":{payButton:"Lisää maksutapa",confirmPurchase:"Lisää maksutapa"},"no-NO":{payButton:"Legg til betalingsmetode",confirmPurchase:"Legg til betalingsmetode"},"cs-CZ":{payButton:"Přidat platební metodu",confirmPurchase:"Přidat platební metodu"},"hu-HU":{payButton:"Fizetési mód hozzáadása",confirmPurchase:"Fizetési mód hozzáadása"},"ro-RO":{payButton:"Adăugați metodă de plată",confirmPurchase:"Adăugați metodă de plată"},"ja-JP":{payButton:"支払い方法を追加",confirmPurchase:"支払い方法を追加"},"ko-KR":{payButton:"결제 수단 추가",confirmPurchase:"결제 수단 추가"},"zh-CN":{payButton:"添加支付方式",confirmPurchase:"添加支付方式"},"zh-TW":{payButton:"新增付款方式",confirmPurchase:"新增付款方式"},ar:{payButton:"إضافة وسيلة دفع",confirmPurchase:"إضافة وسيلة دفع"},"hr-HR":{payButton:"Dodajte način plačanja",confirmPurchase:"Dodajte način plačanja"},"el-GR":{payButton:"Προσθήκη μεθόδου πληρωμής",confirmPurchase:"Προσθήκη μεθόδου πληρωμής"},"sk-SK":{payButton:"Pridať spôsob platby",confirmPurchase:"Pridať spôsob platby"},"sl-SI":{payButton:"Dodajte način plačanja",confirmPurchase:"Dodajte način plačanja"},"bg-BG":{payButton:"Добавяне на начин на плащане",confirmPurchase:"Добавяне на начин на плащане"},"ca-ES":{payButton:"Afegir mètode de pagament",confirmPurchase:"Afegir mètode de pagament"},"et-EE":{payButton:"Lisa makseviis",confirmPurchase:"Lisa makseviis"},"lv-LV":{payButton:"Pievienot maksājuma veidu",confirmPurchase:"Pievienot maksājuma veidu"},"lt-LT":{payButton:"Pridėti mokėjimo metodą",confirmPurchase:"Pridėti mokėjimo metodą"}}),t},d=e.defineComponent({__name:"PaymentCompletedCard",props:{amount:{type:Object},variant:{type:String}},setup(a){const o=a,{$t:r}=t.useIntl(),i=e.computed(()=>"AUTHORIZE"===o.variant?r({defaultMessage:"Payment successful",description:"The title for when a payment has been successful",id:"payment_completed_card.title.authorize"}):r({defaultMessage:"Your payment method is added",description:"The title for when a payment method was successfully added",id:"payment_completed_card.title.tokenize"}));return(o,d)=>(e.openBlock(),e.createBlock(n._sfc_main,{status:"success",title:i.value},{default:e.withCtx(()=>[a.amount?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:0,variant:"body-sm",class:"mt-1"},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$6),{icon:"check"}),e.createTextVNode(e.toDisplayString(e.unref(t.formatAmount)(a.amount)),1)]),_:1})):e.createCommentVNode("",!0),e.createVNode(e.unref(t._sfc_main),{variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"You are being redirected...",description:"The text shown after a successful message before a redirect",id:"payment_completed_card.redirect_message"})),1)]),_:1})]),_:1},8,["title"]))}}),c={UNKNOWN_ERROR:{title:"Something went wrong",message:"An unknown error has occurred",isReloadButtonVisible:!0},AUTHORIZATION_FAILED:{title:"Payment failed",message:"The payment failed"},PAYMENT_DETAILS_CALL_FAILED:{title:"Payment details call failed",message:"There was a problem getting the payment details"},PAYMENT_METHOD_STORAGE_FAILED:{title:"Failed storing payment method",message:"Something went wrong with storing the payment method"},REDIRECT_RESULT_PAYMENT_ACCEPTOR_MISSING:{title:"Missing payment acceptor",message:"A redirect result is set, but a payment acceptor is missing in the url"},TOKENIZE_FAILED:{title:"Tokenization failed",message:"The tokenization of the payment method has failed"},PAYMENT_INTEGRATION_INITIALIZATION_FAILED:{title:"Failed loading payment methods",message:"Failed loading payment integration",isReloadButtonVisible:!0},RESOURCE_REVOKED:{title:"Resource revoked",message:"The resource has been revoked",isReloadButtonVisible:!0}},s={class:"flex flex-col items-center gap-6"},m=e.defineComponent({__name:"PaymentErrorCard",props:{error:{type:Object}},setup(a){const o=a,{$t:r}=t.useIntl(),i=e.computed(()=>c[o.error.code]),d=()=>{window.location.reload()};return(a,o)=>(e.openBlock(),e.createBlock(n._sfc_main,{status:"error",title:i.value.title},{default:e.withCtx(()=>[e.createElementVNode("div",s,[e.createVNode(e.unref(t._sfc_main),{variant:"body-xs",shade:"lighter",class:"mt-3"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.value.message),1)]),_:1}),i.value.isReloadButtonVisible?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,type:"button",color:"gray",variant:"outline",onClick:d},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)({defaultMessage:"Try again",description:"Retry button text when an error has happened during a payment",id:"payments.retry_button.label"})),1)]),_:1})):e.createCommentVNode("",!0)])]),_:1},8,["title"]))}}),p=["applepay"];const u="ADYEN",l=e.defineComponent({__name:"PaymentIntegrationFormAdyen",props:{countryCode:{type:String},customerId:{type:String},invoiceId:{type:String},paymentMethodOptionResponseEntry:{type:Object},variant:{type:String},selected:{type:Boolean},amount:{type:Object},validateOnSubmit:{type:Function,default:()=>Promise.resolve(!0)},context:{type:Object},forceStorePaymentMethod:{type:Boolean}},emits:["select","payment-failed","payment-success","ready"],setup(c,{expose:s,emit:l}){let y=null,h=null;const _=c,f=l;s({submit:function(){try{null==y||y.submit()}catch(e){A.error("ADYEN_SUBMIT_FAILED","Failed to submit Adyen drop-in",{},e)}}});const g=e.ref(),v=e.ref(!1),E=e.ref(),A=r.useLogger(),{locale:I}=t.useIntl(),{authorizePayment:R,getPaymentDetails:b}=a.createPaymentsService(),{tokenizePaymentMethod:k}=o.createPaymentMethodsService(),T=e.inject(r.EXPERIMENTAL_FEATURE_INJECTION_KEY),P=e.computed(()=>"TOKENIZE"===_.variant);async function O(){var e;const t=n.transformToAdyenAmount(_.amount),a=(null==(e=null==T?void 0:T.value)?void 0:e["express-checkout"])?function(e){return e.filter(e=>!p.some(t=>{var n;return t===(null==(n=e.type)?void 0:n.toLowerCase())}))}(n.mapAdyenPaymentMethods(_.paymentMethodOptionResponseEntry)):n.mapAdyenPaymentMethods(_.paymentMethodOptionResponseEntry);return{checkoutConfig:{amount:t,clientKey:n.getAdyenClientKeyFromPaymentMethodOptionsResponse(_.paymentMethodOptionResponseEntry),environment:n.getAdyenEnvironmentFromPaymentMethodOptionsResponse(_.paymentMethodOptionResponseEntry,A),locale:I,translations:i(_.variant),countryCode:_.countryCode,analytics:{enabled:!1},paymentMethodsResponse:{paymentMethods:a},onSubmit:B,onAdditionalDetails:x,onPaymentCompleted:S,onPaymentFailed:M,onError:D,showPayButton:P.value},dropInConfig:{disableFinalAnimation:!0,paymentMethodsConfiguration:{card:{hasHolderName:!0,holderNameRequired:!0,enableStoreDetails:!_.forceStorePaymentMethod&&"AUTHORIZE"===_.variant},paypal:{intent:t.value>0?"authorize":"tokenize",showPayButton:!0}},openFirstPaymentMethod:_.selected,onSelect:({props:{type:e}})=>{e&&f("select",{paymentMethodType:e,paymentGatewayVariant:"ADYEN"})},onReady:()=>f("ready")}}}async function N(){if(g.value)try{await w();const[e,{default:t}]=await Promise.all([Promise.resolve().then(()=>require("./index-DIFK3mcJ.js")),Promise.resolve().then(()=>require("./adyen-DZsyEXkw.js"))]),{AdyenCheckout:n,Dropin:a,Card:o,Bancontact:r,Ach:i,AmazonPay:d,ApplePay:c,BcmcMobile:s,BacsDirectDebit:m,CashAppPay:p,EPS:u,GooglePay:l,Klarna:f,PayByBank:v,PayPal:E,SepaDirectDebit:A,Trustly:I,Twint:R,PayByBankUS:b,Redirect:k}=e,{checkoutConfig:T,dropInConfig:P}=await O();h=await n(T),y=new a(h,{...P,paymentMethodComponents:[o,r,i,d,c,s,m,p,u,l,f,v,E,A,I,R,b,k]}).mount(g.value),function(e){var t;const n=null==(t=g.value)?void 0:t.getRootNode();if(n instanceof ShadowRoot){const t=document.createElement("style");t.textContent=e,n.appendChild(t);const a=document.createElement("style");a.textContent="\n :host {\n --adyen-sdk-color-background-secondary: transparent;\n --adyen-sdk-color-background-primary: rgb(243 244 246 / 0.5);\n --adyen-sdk-color-outline-secondary: #e5e7eb;\n --adyen-sdk-color-outline-primary: transparent;\n --adyen-sdk-color-background-always-dark: var(--color-primary-500);\n --adyen-sdk-color-background-inverse-primary-hover: var(--color-primary-600);\n }\n\n .adyen-checkout__payment-method__image__wrapper {\n width: 32px;\n height: 32px;\n }\n\n .adyen-checkout__payment-method__image {\n height: 32px;\n }\n\n .adyen-checkout__input-wrapper,\n .adyen-checkout__input {\n border-color: rgb(229, 231, 235);\n border-radius: var(--adyen-sdk-border-radius-s, 4px);\n }\n\n .adyen-checkout__button,\n .adyen-checkout__payment-method {\n border-radius: var(--adyen-sdk-border-radius-s, 4px);\n }\n\n .adyen-checkout__payment-method {\n border-color: rgb(229, 231, 235);\n box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);\n transition: box-shadow 0.2s ease-in-out;\n }\n\n .adyen-checkout__payment-method--selected {\n box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);\n }\n\n .adyen-checkout__payment-method:after {\n transform: scale(0%);\n }\n\n .adyen-checkout__paypal__button {\n display: block !important;\n }\n\n .adyen-checkout__payment-methods-list {\n gap: 4px;\n }\n\n .adyen-checkout__dropdown__list {\n background-color: white;\n border-radius: var(--adyen-sdk-border-radius-s, 4px);\n }\n\n .adyen-checkout__payment-method.adyen-checkout__payment-method--selected:after {\n content: '✓';\n width: 20px;\n height: 20px;\n border-radius: 10px;\n background-color: var(--color-primary-600);\n position: absolute;\n top: 14px;\n right: 14px;\n text-align: center;\n line-height: 20px;\n color: white;\n transform: scale(100%);\n font-size: 12px;\n }\n\n .adyen-checkout__payment-method__header {\n padding: 8px 16px !important;\n }\n\n .adyen-checkout__payment-method__brands {\n align-items: center;\n }\n .adyen-checkout__payment-method__brand-number {\n line-height: 1;\n }\n .adyen-checkout__button__text {\n font-size: 14px;\n }\n .adyen-checkout__store-details {\n background: transparent;\n padding: 0;\n }\n .adyen-checkout__checkbox__input + .adyen-checkout__checkbox__label:after {\n border-color: rgb(229, 231, 235);\n }\n ","AUTHORIZE"===_.variant&&(a.textContent+="\n .adyen-checkout__payment-method--cashapp .adyen-checkout-pm-details-wrapper {\n display: none;\n }\n "),n.appendChild(a)}}(t)}catch(e){A.error("PAYMENT_INTEGRATION_INITIALIZATION_FAILED","Failed to mount Adyen web drop-in",{error:e})}}async function w(){y&&(y.unmount(),y=null),g.value&&(g.value.innerHTML="")}function B(...e){const[t,a,o]=e;_.validateOnSubmit().then(e=>{if(!e)return;const a=_.paymentMethodOptionResponseEntry.payment_acceptor.id,r={risk_data:n.transformObjectToAdyenObject(t.data.riskData),payment_method:n.transformObjectToAdyenObject(t.data.paymentMethod),browser_info:n.transformObjectToAdyenObject(t.data.browserInfo)};if("AUTHORIZE"===_.variant){const e=n.createReturnUrl({paymentAcceptorId:_.paymentMethodOptionResponseEntry.payment_acceptor.id,redirectUrl:window.location.href});return void R({payment_acceptor_id:a,..._.customerId?{customer_id:_.customerId}:{},payment_gateway_variant:u,adyen:{...r,store_payment_method:_.forceStorePaymentMethod||t.data.storePaymentMethod},amount:_.amount,..._.context?{context:_.context}:{},return_url:e}).then(e=>{const n=t.data.paymentMethod.type;if("ACTION_REQUIRED"===e.status&&e.action.payment_gateway_variant===u){const t=C(e,n);return t?(y.handleAction(t),void o.resolve({resultCode:e.action.adyen.result_code,action:t})):void A.error("PAYMENT_AUTHORIZATION_FAILED",`Failed payment authorization for payment acceptor with id ${a}`,{error:e})}if("AUTHORIZED"===e.payment.result)return v.value=!0,void o.resolve({resultCode:"Authorised"});A.error("PAYMENT_AUTHORIZATION_FAILED",`Failed payment authorization for payment acceptor with id ${a}`,{error:e}),o.resolve({resultCode:"Error"})}).catch(e=>{A.error("PAYMENT_AUTHORIZATION_FAILED",`Failed payment authorization for payment acceptor with id ${a}`,{error:e}),o.resolve({resultCode:"Error"})})}if("TOKENIZE"===_.variant){const e=n.createReturnUrl({paymentAcceptorId:_.paymentMethodOptionResponseEntry.payment_acceptor.id,redirectUrl:window.location.href});if(!_.customerId)return void A.error("TOKENIZATION_FAILED",`Missing customer id for payment acceptor with id ${a}`);k({customer_id:_.customerId,payment_acceptor_id:a,payment_gateway_variant:u,adyen:r,return_url:e}).then(e=>{const n=t.data.paymentMethod.type;if("ACTION_REQUIRED"===e.status&&e.action.payment_gateway_variant===u){const t=C(e,n);return t?(y.handleAction(t),void o.resolve({resultCode:e.action.adyen.result_code,action:t})):void A.error("TOKENIZATION_FAILED",`Tokenization failed for payment acceptor with id ${a}`,{error:e})}if("AUTHORIZED"===e.payment.result)return v.value=!0,void o.resolve({resultCode:"Authorised"});A.error("TOKENIZATION_FAILED",`Tokenization failed for payment acceptor with id ${a}`,{error:e}),o.resolve({resultCode:"Error"})}).catch(e=>{A.error("TOKENIZATION_FAILED",`Tokenization failed for payment acceptor with id ${a}`,{error:e}),o.resolve({resultCode:"Error"})})}}).catch(e=>{A.error("INTEGRATION_ERROR","Unhandled error in payment submission flow",{},e)})}function C(e,t){if("ACTION_REQUIRED"!==e.status)return;const n=e.action;if("ADYEN"!=n.payment_gateway_variant)return;const a=n.adyen;return{paymentMethodType:(null==a?void 0:a.payment_method_type)??t,method:n.method,url:n.url,data:n.data,type:null==a?void 0:a.action_type,paymentData:null==a?void 0:a.payment_data,sdkData:null==a?void 0:a.sdk_data}}function x(...e){const[t]=e,n=t.data.details,a=t.data.paymentData;if(_.paymentMethodOptionResponseEntry.payment_acceptor.id)return void L({detailsResult:n?(o=n,Object.fromEntries(Object.entries(o).filter(([,e])=>null!=e))):void 0,paymentDataResult:a,paymentAcceptorId:_.paymentMethodOptionResponseEntry.payment_acceptor.id});var o;const r={code:"UNKNOWN_ERROR",message:"Payment failed",error:e};f("payment-failed",r),E.value=r}function M(...e){const[t]=e,n={code:"UNKNOWN_ERROR",message:"Payment failed",error:t};f("payment-failed",n),E.value=n}function S(...e){const[,t]=e;null==t||t.unmount(),f("payment-success")}function D(...e){const[t,n]=e;if("CANCEL"===t.name)return;const a={code:"UNKNOWN_ERROR",message:"Something went wrong",error:t};A.error("INTEGRATION_ERROR","Something went wrong",{error:t}),E.value=a,null==n||n.unmount()}function L({detailsResult:e,threeDSResult:t,redirectResult:n,paymentDataResult:a,paymentAcceptorId:o}){b({paymentAcceptorId:o,paymentGatewayVariant:u,adyen:{...e?{details:e}:{},...n?{redirect_result:n}:{},...t?{threeds_result:t}:{},...a?{payment_data:a}:{}}}).then(e=>{"FAILURE"!==e.payment_status?"SUCCESS"!==e.payment_status||f("payment-success"):f("payment-failed",{code:"UNKNOWN_ERROR",message:"Failed getting payment details",error:e})}).catch(e=>{A.error("PAYMENT_DETAILS_CALL_FAILED","Failed fetching payment details",{error:e})})}return e.onMounted(()=>{N(),function(){const e=n.getQueryParam(n.REDIRECT_RESULT_QUERY_STRING),t=n.getQueryParam(n.PAYMENT_ACCEPTOR_ID_QUERY_STRING);e&&(t?L({paymentAcceptorId:t,detailsResult:{redirectResult:decodeURI(e)}}):A.error("INVALID_REDIRECT_RESULT","Redirect result is set but payment acceptor id is missing",{context:{redirectResult:e}}))}()}),e.onBeforeUnmount(()=>{w()}),e.watch(()=>_.paymentMethodOptionResponseEntry,(e,n)=>{t.isEqual(e,n)||N()},{deep:!0}),(t,n)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[v.value?(e.openBlock(),e.createBlock(d,{key:0,variant:c.variant},null,8,["variant"])):E.value?(e.openBlock(),e.createBlock(m,{key:1,error:E.value},null,8,["error"])):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"dropInContainerRef",ref:g},null,512)],64))}}),y=e.defineComponent({__name:"PaymentIntegrationForm",props:{customerId:{type:String},variant:{type:String},context:{type:Object},paymentMethodOptions:{type:Array},countryCode:{type:String},invoiceId:{type:String},amount:{type:Object},selectedOption:{type:String},validateOnSubmit:{type:Function},forceStorePaymentMethod:{type:Boolean}},emits:["select","payment-failed","payment-success","ready"],setup(n,{expose:a,emit:o}){const r=n,i=o;a({submit:function(){var e,t;c.value||(m.value=!0,null==(e=r.validateOnSubmit)||e.call(r));null==(t=s.value.get(c.value))||t.submit()}});const{$t:d}=t.useIntl(),c=e.ref(),s=e.ref(new Map),m=e.ref(!1);function p({paymentGatewayVariant:e,paymentMethodType:t}){m.value=!1,c.value=e,i("select",{paymentGatewayVariant:e,paymentMethodType:t})}return(a,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.paymentMethodOptions,t=>{var r;return e.openBlock(),e.createElementBlock(e.Fragment,{key:t.integration.id},["ADYEN"===(null==(r=t.integration.payment_gateway)?void 0:r.variant)?(e.openBlock(),e.createBlock(l,{key:0,ref_for:!0,ref:e=>s.value.set(t.integration.payment_gateway.variant,e),context:n.context,"payment-method-option-response-entry":t,"country-code":n.countryCode,"customer-id":n.customerId,variant:n.variant,amount:n.amount,"invoice-id":n.invoiceId,selected:c.value===t.integration.payment_gateway.variant,"validate-on-submit":n.validateOnSubmit,"force-store-payment-method":n.forceStorePaymentMethod,onSelect:p,onPaymentFailed:o[0]||(o[0]=e=>a.$emit("payment-failed",e)),onPaymentSuccess:o[1]||(o[1]=e=>a.$emit("payment-success")),onReady:o[2]||(o[2]=e=>a.$emit("ready"))},null,8,["context","payment-method-option-response-entry","country-code","customer-id","variant","amount","invoice-id","selected","validate-on-submit","force-store-payment-method"])):e.createCommentVNode("",!0)],64)}),128)),m.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$23),{key:0,variant:"error",class:"mt-2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(d)({defaultMessage:"Select a payment method",id:"payment_integration_form.select_payment_method_error",description:"Error shown when no payment method is selected"})),1)]),_:1})):e.createCommentVNode("",!0)],64))}});exports._sfc_main=y;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=require("../../InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-D0vVUHuY.js"),t=require("../../Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),n=require("../../useInvoiceData-D2jkdmlA.js"),i=require("../../component-BOqPDAVk.js"),r=e.defineComponent({__name:"InvoiceDetails",props:{invoice:{type:Object},isLoading:{type:Boolean},configuration:{type:Object}},setup:n=>(i,r)=>n.isLoading?(e.openBlock(),e.createBlock(t._sfc_main,{key:0,variant:"section",class:"sv-invoice-details sv-root sv-component sv-loading min-h-[100px]","data-testid":"invoice-details-skeleton"})):(e.openBlock(),e.createBlock(o._sfc_main,{key:1,class:"sv-invoice-details sv-root sv-component",invoice:n.invoice},null,8,["invoice"]))}),a=e.defineComponent({__name:"InvoiceDetails.entry.view",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup(o){const t=o,i=n.useInvoiceData(t.configuration.invoiceId);return(o,t)=>{var n;return e.renderSlot(o.$slots,"default",{invoice:null==(n=e.unref(i).data.value)?void 0:n.invoice,isLoading:e.unref(i).isPending.value})}}}),l=e.defineComponent({__name:"InvoiceDetails.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup(o){var t;if(!(null==(t=o.configuration)?void 0:t.invoiceId))throw new Error("Missing invoice id");return(t,n)=>{var l,s,p,v;return e.openBlock(),e.createBlock(e.unref(i._sfc_main),{"custom-element-name":e.unref(c),environment:o.environment,locale:o.locale,"portal-object":o.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(s=null==(l=o.branding)?void 0:l.colors)?void 0:s.primary,"secondary-color":null==(v=null==(p=o.branding)?void 0:p.colors)?void 0:v.secondary,"experimental-features":o.experimentalFeatures,"log-level":o.logLevel,"on-log":o.onLog,"css-overrides":o.cssOverrides,onError:n[0]||(n[0]=e=>t.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(a,e.normalizeProps(e.guardReactiveProps(t.$props)),{default:e.withCtx(({invoice:t,isLoading:n})=>[t?(e.openBlock(),e.createBlock(r,{key:0,"is-loading":n,invoice:t,configuration:o.configuration},null,8,["is-loading","invoice","configuration"])):e.createCommentVNode("",!0)]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log","css-overrides"])}}}),s=i.defineCustomElement(l),c=i.getComponentName("invoice-details");exports.COMPONENT_NAME=c,exports.SolvimonInvoiceDetails=s,exports.defineSolvimonInvoiceDetails=()=>{customElements.get(c)||customElements.define(c,s)};
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),o=require("../../InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-D0vVUHuY.js"),t=require("../../Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),n=require("../../useInvoiceData-lIMEwwMy.js"),i=require("../../component-BOqPDAVk.js"),r=e.defineComponent({__name:"InvoiceDetails",props:{invoice:{type:Object},isLoading:{type:Boolean},configuration:{type:Object}},setup:n=>(i,r)=>n.isLoading?(e.openBlock(),e.createBlock(t._sfc_main,{key:0,variant:"section",class:"sv-invoice-details sv-root sv-component sv-loading min-h-[100px]","data-testid":"invoice-details-skeleton"})):(e.openBlock(),e.createBlock(o._sfc_main,{key:1,class:"sv-invoice-details sv-root sv-component",invoice:n.invoice},null,8,["invoice"]))}),a=e.defineComponent({__name:"InvoiceDetails.entry.view",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup(o){const t=o,i=n.useInvoiceData(t.configuration.invoiceId);return(o,t)=>{var n;return e.renderSlot(o.$slots,"default",{invoice:null==(n=e.unref(i).data.value)?void 0:n.invoice,isLoading:e.unref(i).isPending.value})}}}),l=e.defineComponent({__name:"InvoiceDetails.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup(o){var t;if(!(null==(t=o.configuration)?void 0:t.invoiceId))throw new Error("Missing invoice id");return(t,n)=>{var l,s,p,v;return e.openBlock(),e.createBlock(e.unref(i._sfc_main),{"custom-element-name":e.unref(c),environment:o.environment,locale:o.locale,"portal-object":o.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(s=null==(l=o.branding)?void 0:l.colors)?void 0:s.primary,"secondary-color":null==(v=null==(p=o.branding)?void 0:p.colors)?void 0:v.secondary,"experimental-features":o.experimentalFeatures,"log-level":o.logLevel,"on-log":o.onLog,"css-overrides":o.cssOverrides,onError:n[0]||(n[0]=e=>t.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(a,e.normalizeProps(e.guardReactiveProps(t.$props)),{default:e.withCtx(({invoice:t,isLoading:n})=>[t?(e.openBlock(),e.createBlock(r,{key:0,"is-loading":n,invoice:t,configuration:o.configuration},null,8,["is-loading","invoice","configuration"])):e.createCommentVNode("",!0)]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log","css-overrides"])}}}),s=i.defineCustomElement(l),c=i.getComponentName("invoice-details");exports.COMPONENT_NAME=c,exports.SolvimonInvoiceDetails=s,exports.defineSolvimonInvoiceDetails=()=>{customElements.get(c)||customElements.define(c,s)};
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, openBlock, createBlock, renderSlot, unref, withCtx, createVNode, normalizeProps, guardReactiveProps, createCommentVNode } from "vue";
2
2
  import { _ as _sfc_main$4 } from "../../InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-Bc2hkpTb.mjs";
3
3
  import { _ as _sfc_main$3 } from "../../Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs";
4
- import { u as useInvoiceData } from "../../useInvoiceData-BJwwDur7.mjs";
4
+ import { u as useInvoiceData } from "../../useInvoiceData-D7YN2SAd.mjs";
5
5
  import { _ as _sfc_main$5, d as defineCustomElement, g as getComponentName } from "../../component-Djrf1L-Z.mjs";
6
6
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
7
7
  __name: "InvoiceDetails",
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-DWTEfLrE.js"),o=require("../../Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),n=require("../../useInvoiceData-D2jkdmlA.js"),r=require("../../component-BOqPDAVk.js"),a=e.defineComponent({__name:"PaymentHistory",props:{customer:{type:Object},paymentAttempts:{type:Array},isLoading:{type:Boolean},configuration:{type:Object}},setup:n=>(r,a)=>n.isLoading?(e.openBlock(),e.createBlock(o._sfc_main,{key:0,variant:"section",class:"sv-payment-history sv-root sv-component sv-loading min-h-[100px]","data-testid":"payment-history-skeleton"})):n.paymentAttempts.length?(e.openBlock(),e.createBlock(t._sfc_main,{key:1,class:"sv-payment-history sv-root sv-component","payment-attempts":n.paymentAttempts,customer:n.customer},null,8,["payment-attempts","customer"])):e.createCommentVNode("",!0)}),i=e.defineComponent({__name:"PaymentHistory.entry.view",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup(t){const o=t,r=n.useInvoiceData(o.configuration.invoiceId);return(t,o)=>{var n,a;return e.renderSlot(t.$slots,"default",{invoice:null==(n=e.unref(r).data.value)?void 0:n.invoice,paymentAttempts:null==(a=e.unref(r).data.value)?void 0:a.paymentAttempts.data,isLoading:e.unref(r).isPending.value})}}}),s=e.defineComponent({__name:"PaymentHistory.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup(t){var o;if(!(null==(o=t.configuration)?void 0:o.invoiceId))throw new Error("Missing invoice id");return(o,n)=>{var s,l,c,y;return e.openBlock(),e.createBlock(e.unref(r._sfc_main),{"custom-element-name":e.unref(p),environment:t.environment,locale:t.locale,"portal-object":t.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(l=null==(s=t.branding)?void 0:s.colors)?void 0:l.primary,"secondary-color":null==(y=null==(c=t.branding)?void 0:c.colors)?void 0:y.secondary,"experimental-features":t.experimentalFeatures,"log-level":t.logLevel,"on-log":t.onLog,"css-overrides":t.cssOverrides,onError:n[0]||(n[0]=e=>o.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(i,e.normalizeProps(e.guardReactiveProps(o.$props)),{default:e.withCtx(({invoice:o,paymentAttempts:n,isLoading:r})=>[o&&n?(e.openBlock(),e.createBlock(a,{key:0,"is-loading":r,customer:o.customer,"payment-attempts":n,configuration:t.configuration},null,8,["is-loading","customer","payment-attempts","configuration"])):e.createCommentVNode("",!0)]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log","css-overrides"])}}}),l=r.defineCustomElement(s),p=r.getComponentName("payment-history");exports.COMPONENT_NAME=p,exports.SolvimonPaymentHistory=l,exports.defineSolvimonPaymentHistory=()=>{customElements.get(p)||customElements.define(p,l)};
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-DWTEfLrE.js"),o=require("../../Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),n=require("../../useInvoiceData-lIMEwwMy.js"),r=require("../../component-BOqPDAVk.js"),a=e.defineComponent({__name:"PaymentHistory",props:{customer:{type:Object},paymentAttempts:{type:Array},isLoading:{type:Boolean},configuration:{type:Object}},setup:n=>(r,a)=>n.isLoading?(e.openBlock(),e.createBlock(o._sfc_main,{key:0,variant:"section",class:"sv-payment-history sv-root sv-component sv-loading min-h-[100px]","data-testid":"payment-history-skeleton"})):n.paymentAttempts.length?(e.openBlock(),e.createBlock(t._sfc_main,{key:1,class:"sv-payment-history sv-root sv-component","payment-attempts":n.paymentAttempts,customer:n.customer},null,8,["payment-attempts","customer"])):e.createCommentVNode("",!0)}),i=e.defineComponent({__name:"PaymentHistory.entry.view",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup(t){const o=t,r=n.useInvoiceData(o.configuration.invoiceId);return(t,o)=>{var n,a;return e.renderSlot(t.$slots,"default",{invoice:null==(n=e.unref(r).data.value)?void 0:n.invoice,paymentAttempts:null==(a=e.unref(r).data.value)?void 0:a.paymentAttempts.data,isLoading:e.unref(r).isPending.value})}}}),s=e.defineComponent({__name:"PaymentHistory.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup(t){var o;if(!(null==(o=t.configuration)?void 0:o.invoiceId))throw new Error("Missing invoice id");return(o,n)=>{var s,l,c,y;return e.openBlock(),e.createBlock(e.unref(r._sfc_main),{"custom-element-name":e.unref(p),environment:t.environment,locale:t.locale,"portal-object":t.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(l=null==(s=t.branding)?void 0:s.colors)?void 0:l.primary,"secondary-color":null==(y=null==(c=t.branding)?void 0:c.colors)?void 0:y.secondary,"experimental-features":t.experimentalFeatures,"log-level":t.logLevel,"on-log":t.onLog,"css-overrides":t.cssOverrides,onError:n[0]||(n[0]=e=>o.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(i,e.normalizeProps(e.guardReactiveProps(o.$props)),{default:e.withCtx(({invoice:o,paymentAttempts:n,isLoading:r})=>[o&&n?(e.openBlock(),e.createBlock(a,{key:0,"is-loading":r,customer:o.customer,"payment-attempts":n,configuration:t.configuration},null,8,["is-loading","customer","payment-attempts","configuration"])):e.createCommentVNode("",!0)]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log","css-overrides"])}}}),l=r.defineCustomElement(s),p=r.getComponentName("payment-history");exports.COMPONENT_NAME=p,exports.SolvimonPaymentHistory=l,exports.defineSolvimonPaymentHistory=()=>{customElements.get(p)||customElements.define(p,l)};
@@ -1,7 +1,7 @@
1
1
  import { defineComponent, openBlock, createBlock, createCommentVNode, renderSlot, unref, withCtx, createVNode, normalizeProps, guardReactiveProps } from "vue";
2
2
  import { _ as _sfc_main$4 } from "../../PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CaMDtHrL.mjs";
3
3
  import { _ as _sfc_main$3 } from "../../Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs";
4
- import { u as useInvoiceData } from "../../useInvoiceData-BJwwDur7.mjs";
4
+ import { u as useInvoiceData } from "../../useInvoiceData-D7YN2SAd.mjs";
5
5
  import { _ as _sfc_main$5, d as defineCustomElement, g as getComponentName } from "../../component-Djrf1L-Z.mjs";
6
6
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
7
7
  __name: "PaymentHistory",
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../component-BOqPDAVk.js"),o=require("../../vendor-ui-5pJF5KBP.js"),n=require("../../useLoadInitialData-DjwRHcAH.js"),r=require("../../useCustomer-CUcaeQn_.js"),a=require("../../usePaymentMethodOptions-DYO6xr3-.js"),i=require("../../Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),s=require("../../PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-DTIY4s7C.js"),l=e.defineComponent({__name:"PaymentMethodForm.entry.view",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object},countryCode:{type:String}},setup(t){const i=t,s=r.useCustomer({customerId:i.portalObject.customer_id}),l=a.usePaymentMethodOptions(),{isLoading:c}=n.useLoadInitialData((async()=>{var e;const t=await s.get.execute(),n=o.getCustomerCountry(t);await l.get({customerId:t.id,country:n,amount:null==(e=i.configuration)?void 0:e.amount})})());return(t,o)=>e.renderSlot(t.$slots,"default",{customer:e.unref(s).customer.value,paymentMethodOptions:e.unref(l),isLoading:e.unref(c)})}}),c=e.defineComponent({__name:"PaymentMethodForm",props:{customer:{type:Object},paymentMethodOptions:{type:Array},configuration:{type:Object},isLoading:{type:Boolean,default:!1},countryCode:{type:String}},setup(t){const n={currency:"EUR",quantity:"0"},r=t,{$t:a}=o.useIntl(),l=e.computed(()=>{return"AUTHORIZE"===(null==(e=r.configuration)?void 0:e.variant)?e:{...e,variant:"TOKENIZE"};var e}),c=e.computed(()=>{let e="NL";if(r.countryCode)return e=r.countryCode,e;if(r.customer){const t=o.getCustomerCountry(r.customer);if(t)return e=t,e}return"NL"}),u=e.computed(()=>"AUTHORIZE"===l.value.variant?{paymentMethodOptions:r.paymentMethodOptions,countryCode:c.value,variant:"AUTHORIZE",amount:l.value.amount,context:l.value.context,invoiceId:l.value.invoiceId,successRedirectUrl:l.value.successRedirectUrl,selectedOption:l.value.selectedOption,validateOnSubmit:l.value.validateOnSubmit,forceStorePaymentMethod:l.value.forceStorePaymentMethod}:{paymentMethodOptions:r.paymentMethodOptions,customerId:r.customer.id,countryCode:c.value,variant:"TOKENIZE",amount:l.value.amount??n,invoiceId:l.value.invoiceId,successRedirectUrl:l.value.successRedirectUrl,selectedOption:l.value.selectedOption,validateOnSubmit:l.value.validateOnSubmit,forceStorePaymentMethod:l.value.forceStorePaymentMethod});return(n,r)=>t.isLoading?(e.openBlock(),e.createBlock(i._sfc_main,{key:0,variant:"section",class:"sv-payment-method-form sv-root sv-component sv-loading min-h-[180px]","data-testid":"payment-method-form-skeleton"})):(e.openBlock(),e.createBlock(e.unref(o._sfc_main$1),{key:1,class:"sv-payment-method-form sv-root sv-component","no-border":"","no-spacing":"","content-background":"none",title:e.unref(a)({defaultMessage:"Available payment methods",description:"Title of the available payment methods form",id:"components.payment_method_form.section_title"})},{default:e.withCtx(()=>[e.createVNode(s._sfc_main,e.mergeProps({class:"sv-payment-method-form__integration"},u.value),null,16)]),_:1},8,["title"]))}}),u=e.defineComponent({__name:"PaymentMethodForm.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object},countryCode:{type:String}},setup(o){const n=o;return(r,a)=>{var i,s,u,m;return e.openBlock(),e.createBlock(e.unref(t._sfc_main),{"custom-element-name":e.unref(p),environment:o.environment,locale:o.locale,"portal-object":o.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(s=null==(i=o.branding)?void 0:i.colors)?void 0:s.primary,"secondary-color":null==(m=null==(u=o.branding)?void 0:u.colors)?void 0:m.secondary,"experimental-features":o.experimentalFeatures,"log-level":o.logLevel,"on-log":o.onLog,"css-overrides":o.cssOverrides,onError:a[0]||(a[0]=e=>r.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(l,e.normalizeProps(e.guardReactiveProps(n)),{default:e.withCtx(({customer:t,paymentMethodOptions:n,isLoading:r})=>[t?(e.openBlock(),e.createBlock(c,{key:0,customer:t,"payment-method-options":n.paymentMethodOptions.value,configuration:o.configuration,"is-loading":r},null,8,["customer","payment-method-options","configuration","is-loading"])):e.createCommentVNode("",!0)]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log","css-overrides"])}}}),m=t.defineCustomElement(u),p=t.getComponentName("payment-method-form");exports.COMPONENT_NAME=p,exports.SolvimonPaymentMethodForm=m,exports.defineSolvimonPaymentMethodForm=()=>{customElements.get(p)||customElements.define(p,m)};
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../component-BOqPDAVk.js"),o=require("../../vendor-ui-5pJF5KBP.js"),n=require("../../useLoadInitialData-DjwRHcAH.js"),r=require("../../useCustomer-CUcaeQn_.js"),a=require("../../usePaymentMethodOptions-DYO6xr3-.js"),i=require("../../Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),s=require("../../PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CiyyUp4z.js"),l=e.defineComponent({__name:"PaymentMethodForm.entry.view",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object},countryCode:{type:String}},setup(t){const i=t,s=r.useCustomer({customerId:i.portalObject.customer_id}),l=a.usePaymentMethodOptions(),{isLoading:c}=n.useLoadInitialData((async()=>{var e;const t=await s.get.execute(),n=o.getCustomerCountry(t);await l.get({customerId:t.id,country:n,amount:null==(e=i.configuration)?void 0:e.amount})})());return(t,o)=>e.renderSlot(t.$slots,"default",{customer:e.unref(s).customer.value,paymentMethodOptions:e.unref(l),isLoading:e.unref(c)})}}),c=e.defineComponent({__name:"PaymentMethodForm",props:{customer:{type:Object},paymentMethodOptions:{type:Array},configuration:{type:Object},isLoading:{type:Boolean,default:!1},countryCode:{type:String}},setup(t){const n={currency:"EUR",quantity:"0"},r=t,{$t:a}=o.useIntl(),l=e.computed(()=>{return"AUTHORIZE"===(null==(e=r.configuration)?void 0:e.variant)?e:{...e,variant:"TOKENIZE"};var e}),c=e.computed(()=>{let e="NL";if(r.countryCode)return e=r.countryCode,e;if(r.customer){const t=o.getCustomerCountry(r.customer);if(t)return e=t,e}return"NL"}),u=e.computed(()=>"AUTHORIZE"===l.value.variant?{paymentMethodOptions:r.paymentMethodOptions,countryCode:c.value,variant:"AUTHORIZE",amount:l.value.amount,context:l.value.context,invoiceId:l.value.invoiceId,successRedirectUrl:l.value.successRedirectUrl,selectedOption:l.value.selectedOption,validateOnSubmit:l.value.validateOnSubmit,forceStorePaymentMethod:l.value.forceStorePaymentMethod}:{paymentMethodOptions:r.paymentMethodOptions,customerId:r.customer.id,countryCode:c.value,variant:"TOKENIZE",amount:l.value.amount??n,invoiceId:l.value.invoiceId,successRedirectUrl:l.value.successRedirectUrl,selectedOption:l.value.selectedOption,validateOnSubmit:l.value.validateOnSubmit,forceStorePaymentMethod:l.value.forceStorePaymentMethod});return(n,r)=>t.isLoading?(e.openBlock(),e.createBlock(i._sfc_main,{key:0,variant:"section",class:"sv-payment-method-form sv-root sv-component sv-loading min-h-[180px]","data-testid":"payment-method-form-skeleton"})):(e.openBlock(),e.createBlock(e.unref(o._sfc_main$1),{key:1,class:"sv-payment-method-form sv-root sv-component","no-border":"","no-spacing":"","content-background":"none",title:e.unref(a)({defaultMessage:"Available payment methods",description:"Title of the available payment methods form",id:"components.payment_method_form.section_title"})},{default:e.withCtx(()=>[e.createVNode(s._sfc_main,e.mergeProps({class:"sv-payment-method-form__integration"},u.value),null,16)]),_:1},8,["title"]))}}),u=e.defineComponent({__name:"PaymentMethodForm.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object},countryCode:{type:String}},setup(o){const n=o;return(r,a)=>{var i,s,u,m;return e.openBlock(),e.createBlock(e.unref(t._sfc_main),{"custom-element-name":e.unref(p),environment:o.environment,locale:o.locale,"portal-object":o.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(s=null==(i=o.branding)?void 0:i.colors)?void 0:s.primary,"secondary-color":null==(m=null==(u=o.branding)?void 0:u.colors)?void 0:m.secondary,"experimental-features":o.experimentalFeatures,"log-level":o.logLevel,"on-log":o.onLog,"css-overrides":o.cssOverrides,onError:a[0]||(a[0]=e=>r.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(l,e.normalizeProps(e.guardReactiveProps(n)),{default:e.withCtx(({customer:t,paymentMethodOptions:n,isLoading:r})=>[t?(e.openBlock(),e.createBlock(c,{key:0,customer:t,"payment-method-options":n.paymentMethodOptions.value,configuration:o.configuration,"is-loading":r},null,8,["customer","payment-method-options","configuration","is-loading"])):e.createCommentVNode("",!0)]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log","css-overrides"])}}}),m=t.defineCustomElement(u),p=t.getComponentName("payment-method-form");exports.COMPONENT_NAME=p,exports.SolvimonPaymentMethodForm=m,exports.defineSolvimonPaymentMethodForm=()=>{customElements.get(p)||customElements.define(p,m)};
@@ -5,7 +5,7 @@ import { u as useLoadInitialData } from "../../useLoadInitialData-5sgImpzc.mjs";
5
5
  import { u as useCustomer } from "../../useCustomer-Ba9WRtuT.mjs";
6
6
  import { u as usePaymentMethodOptions } from "../../usePaymentMethodOptions-C2k4npCQ.mjs";
7
7
  import { _ as _sfc_main$3 } from "../../Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs";
8
- import { _ as _sfc_main$5 } from "../../PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-uk5MO0ce.mjs";
8
+ import { _ as _sfc_main$5 } from "../../PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BnMmcoAu.mjs";
9
9
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
10
10
  __name: "PaymentMethodForm.entry.view",
11
11
  props: {
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../vendor-ui-5pJF5KBP.js"),i=require("../../component-BOqPDAVk.js"),n=require("../../subscriptions-jelITJcX.js"),o=require("../../ApiStatus-oqvUEWJx.js"),a=require("../../invoices-DzkA1jDc.js"),l=require("../../index-DRdBmZ2-.js"),r=require("../../useWatchDebounced-2ZLnfgvG.js"),c=require("../../paymentMethods-C_sdTkSF.js"),u=require("../../useService-Bb9r_sOQ.js"),s=require("../../usePortal-CxX4nrE4.js"),d=require("../../customer-hDxW1Dbp.js"),p=require("../../adyen-R6aSZ0Yf.js"),m=require("../../PricingGroupContent.vue_vue_type_script_setup_true_lang-Br3bEUlP.js"),g=require("../../useViewport-CKRY1CKR.js"),v=require("../../Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),y=require("../../payments-DkHhTHto.js"),f=require("../../ContentWithAsideLayout-B5B8Kwaw.js");function _({pricingPlanScheduleInfos:e,type:t}){return e.find(e=>e.pricing_plan_schedule.type===t)}function h({enabledPricings:e,seatsValues:t,pricingPlanScheduleInfos:i,pricingCurrency:n,billingPeriod:o}){const a=_({pricingPlanScheduleInfos:i,type:"DEFAULT"});if(a&&(e||t))return[{pricing_plan_schedule_id:a.id,enabled_pricings:e,seats_values:null==t?void 0:t.map(({pricing_item_config_id:e,number:t})=>({pricing_item_config_id:e,number:t})),...n&&{pricing_currency:n},...o&&{billing_period:o}}]}const b={AD:"EUR",AE:"AED",AF:"AFN",AG:"XCD",AI:"XCD",AL:"ALL",AM:"AMD",AO:"AOA",AR:"ARS",AS:"USD",AT:"EUR",AU:"AUD",AW:"AWG",AX:"EUR",AZ:"AZN",BA:"BAM",BB:"BBD",BD:"BDT",BE:"EUR",BF:"XOF",BG:"BGN",BH:"BHD",BI:"BIF",BJ:"XOF",BL:"EUR",BM:"BMD",BN:"BND",BO:"BOB",BQ:"USD",BR:"BRL",BS:"BSD",BT:"BTN",BV:"NOK",BW:"BWP",BY:"BYN",BZ:"BZD",CA:"CAD",CC:"AUD",CD:"CDF",CF:"XAF",CG:"XAF",CH:"CHF",CI:"XOF",CK:"NZD",CL:"CLP",CM:"XAF",CN:"CNY",CO:"COP",CR:"CRC",CU:"CUP",CV:"CVE",CW:"ANG",CX:"AUD",CY:"EUR",CZ:"CZK",DE:"EUR",DJ:"DJF",DK:"DKK",DM:"XCD",DO:"DOP",DZ:"DZD",EC:"USD",EE:"EUR",EG:"EGP",EH:"MAD",ER:"ERN",ES:"EUR",ET:"ETB",FI:"EUR",FJ:"FJD",FK:"FKP",FM:"USD",FO:"DKK",FR:"EUR",GA:"XAF",GB:"GBP",GD:"XCD",GE:"GEL",GF:"EUR",GG:"GBP",GH:"GHS",GI:"GIP",GL:"DKK",GM:"GMD",GN:"GNF",GP:"EUR",GQ:"XAF",GR:"EUR",GS:"GBP",GT:"GTQ",GU:"USD",GW:"XOF",GY:"GYD",HK:"HKD",HM:"AUD",HN:"HNL",HR:"EUR",HT:"HTG",HU:"HUF",ID:"IDR",IE:"EUR",IL:"ILS",IM:"GBP",IN:"INR",IO:"USD",IQ:"IQD",IR:"IRR",IS:"ISK",IT:"EUR",JE:"GBP",JM:"JMD",JO:"JOD",JP:"JPY",KE:"KES",KG:"KGS",KH:"KHR",KI:"AUD",KM:"KMF",KN:"XCD",KP:"KPW",KR:"KRW",KW:"KWD",KY:"KYD",KZ:"KZT",LA:"LAK",LB:"LBP",LC:"XCD",LI:"CHF",LK:"LKR",LR:"LRD",LS:"LSL",LT:"EUR",LU:"EUR",LV:"EUR",LY:"LYD",MA:"MAD",MC:"EUR",MD:"MDL",ME:"EUR",MF:"EUR",MG:"MGA",MH:"USD",MK:"MKD",ML:"XOF",MM:"MMK",MN:"MNT",MO:"MOP",MP:"USD",MQ:"EUR",MR:"MRU",MS:"XCD",MT:"EUR",MU:"MUR",MV:"MVR",MW:"MWK",MX:"MXN",MY:"MYR",MZ:"MZN",NA:"NAD",NC:"XPF",NE:"XOF",NF:"AUD",NG:"NGN",NI:"NIO",NL:"EUR",NO:"NOK",NP:"NPR",NR:"AUD",NU:"NZD",NZ:"NZD",OM:"OMR",PA:"PAB",PE:"PEN",PF:"XPF",PG:"PGK",PH:"PHP",PK:"PKR",PL:"PLN",PM:"EUR",PN:"NZD",PR:"USD",PS:"ILS",PT:"EUR",PW:"USD",PY:"PYG",QA:"QAR",RE:"EUR",RO:"RON",RS:"RSD",RU:"RUB",RW:"RWF",SA:"SAR",SB:"SBD",SC:"SCR",SD:"SDG",SE:"SEK",SG:"SGD",SH:"SHP",SI:"EUR",SJ:"NOK",SK:"EUR",SL:"SLE",SM:"EUR",SN:"XOF",SO:"SOS",SR:"SRD",SS:"SSP",ST:"STN",SV:"USD",SX:"ANG",SY:"SYP",SZ:"SZL",TC:"USD",TD:"XAF",TF:"EUR",TG:"XOF",TH:"THB",TJ:"TJS",TK:"NZD",TL:"USD",TM:"TMT",TN:"TND",TO:"TOP",TR:"TRY",TT:"TTD",TV:"AUD",TW:"TWD",TZ:"TZS",UA:"UAH",UG:"UGX",US:"USD",UY:"UYU",UZ:"UZS",VA:"EUR",VC:"XCD",VE:"VES",VG:"USD",VI:"USD",VN:"VND",VU:"VUV",WF:"XPF",WS:"WST",YE:"YER",YT:"EUR",ZA:"ZAR",ZM:"ZMW",ZW:"ZWL"},M=({country:e,pricingCurrencySettings:t,fallbackCurrency:i})=>{const n=(e=>{if(e)return b[e]})(e),o=(null==t?void 0:t.pricing_currencies)??[];return n&&o.includes(n)?n:(null==t?void 0:t.default_pricing_currency)??i??n},N=["email","country"],I={US:["addressLine1","postalCode"],CA:["state"]};function k({initialState:i,onRequiredFieldChange:n}){const o=e.ref(C(i)),a=e.ref(C(i)),c=e.computed(()=>{return(e=o.value.country)&&I[e]?[...I[e],...N]:N;var e}),u=e=>c.value.includes(e),s=t.useValidation({email:{required:l.required,email:l.email},country:{required:l.required},state:{required:l.requiredIf(()=>u("state"))},addressLine1:{required:l.requiredIf(()=>u("addressLine1"))},postalCode:{required:l.requiredIf(()=>u("postalCode"))},companyLegalName:l.requiredIf("ORGANIZATION"===o.value.type),companyVatNumber:{taxId:t.taxId}},o),d=e=>{e||fetch("https://api.country.is/").then(e=>e.json()).then(({country:e})=>{o.value.country=e})};return e.onMounted(async()=>{await d(null==i?void 0:i.country)}),r.useWatchDebounced(()=>structuredClone(e.toRaw(o.value)),(e,i)=>{const o=t.objectDiff({from:i,to:e}),a=Object.keys(o).find(D);a&&(["type","companyVatNumber"].includes(a)?n(e):"seatsValues"!==a&&"enabledPricingIds"!==a?"email"!==a&&u(a)&&n(e):n(e))},{debounce:200}),{form:o,validation:s,getIsFieldRequired:u,updateInitialState:t=>{const i=C({...o.value,...t});o.value=i,a.value=structuredClone(e.toRaw(i))},initialState:a}}const C=(e={})=>({email:void 0,country:void 0,type:"INDIVIDUAL",companyLegalName:void 0,firstName:void 0,infix:void 0,lastName:void 0,addressLine1:void 0,addressLine2:void 0,postalCode:void 0,city:void 0,state:void 0,companyVatNumber:void 0,seatsValues:void 0,enabledPricingIds:void 0,...e});function D(e){return e in C()}function A(e){return e.pricing_plan_schedule_infos.flatMap(e=>{var t;return(null==(t=e.pricing_plan_version.pricing_categories)?void 0:t.flatMap(e=>e.pricing_groups??[]))??[]})}function E(e){var i,n;return t.isEmpty(e.name)?null==(n=null==(i=e.products)?void 0:i[0])?void 0:n.name:e.name}function w(e,t=void 0){const i=t??[],n=A(e);for(const o of n)if(["EXACTLY_ONE","AT_LEAST_ONE"].includes(o.selection_constraint)){const e=o.pricings.map(e=>e.id);if(null==t?void 0:t.some(t=>e.includes(t)))continue;i.push(o.pricings[0].id)}return i}function P({initialCountry:l,initialEmail:r,subscriptionId:s,enabledPricingIds:d}){const p=e.ref(!1),m=e.ref(),{getSubscription:g}=n.createSubscriptionsService(),v=(()=>{const{getInvoicePreview:n}=a.createInvoicesService(),l=i.useLogger(),r=e.ref(),c=e.ref(),u=e.ref(),s=e.ref({}),d=e.ref(o.ApiStatus.Initial),p=e.ref({}),m=e.ref(),g=e=>`${e.type}:${e.value}`;return{loadInvoicePreview:async({subscription:e,subscriptionStartAt:i,checkoutForm:a,enabledPricingIds:v,promotionCode:y})=>{var f,b,N,I,k;const C={...a.addressLine1&&{line1:a.addressLine1},...a.addressLine2&&{line2:a.addressLine2},...a.city&&{city:a.city},...a.state&&{state:a.state},...a.country?{country:a.country||"NL"}:{country:"NL"},...a.postalCode&&{postal_code:a.postalCode}};d.value=o.ApiStatus.Loading;const D=_({pricingPlanScheduleInfos:e.pricing_plan_schedule_infos,type:"DEFAULT"}),A=null==(f=null==D?void 0:D.pricing_plan_version)?void 0:f.pricing_currency_settings,E=((null==(b=null==A?void 0:A.pricing_currencies)?void 0:b.length)??0)>1,w=(null==(I=null==(N=null==D?void 0:D.pricing_plan_version)?void 0:N.billing_period_settings)?void 0:I.billing_periods)??[],P=w.length>1,V=w.length>0?w.map(({period:e})=>e):e.billing_period?[e.billing_period]:[],x=M({country:a.country,pricingCurrencySettings:A,fallbackCurrency:e.billing_currency});if(!V.length)return void(d.value=o.ApiStatus.Done);const B=e.billing_period?g(e.billing_period):g(V[0]),S=V.map(async o=>{var l;const r=g(o),c=h({enabledPricings:null==v?void 0:v.map(e=>({pricing_id:e})),seatsValues:a.seatsValues,pricingPlanScheduleInfos:e.pricing_plan_schedule_infos,pricingCurrency:E?x:void 0,billingPeriod:P?o:void 0})??[];if(y){const t=null==(l=e.pricing_plan_schedule_infos.find(({pricing_plan_schedule:e})=>"DEFAULT"===e.type))?void 0:l.id;if(t){const e=c.find(({pricing_plan_schedule_id:e})=>e===t);e?e.promotion_codes=[y]:c.push({pricing_plan_schedule_id:t,promotion_codes:[y]})}}const u={pricingPlanSubscriptionId:e.id,startAt:i,customizations:c,customer:{type:a.type||"INDIVIDUAL",..."INDIVIDUAL"===a.type&&{individual:{residential_address:C}},..."ORGANIZATION"===a.type&&{organization:{legal_name:a.companyLegalName||"preview",registered_address:C,...a.companyVatNumber&&{tax_id:t.taxId.$validator(a.companyVatNumber,{},{})?a.companyVatNumber:void 0}}}}},s=p.value[r];return s&&t.isEqual(u,s)?{periodKey:r,response:void 0}:(p.value={...p.value,[r]:u},{periodKey:r,response:await n(u)})});try{const i={...s.value},n=await Promise.all(S),o=e.pricing_plan_schedule_infos.find(({pricing_plan_schedule:e})=>"TRIAL"===e.type),a=null==(k=e.pricing_plan_schedule_infos.find(({pricing_plan_schedule:e})=>"DEFAULT"===e.type))?void 0:k.id;n.forEach(({periodKey:e,response:n})=>{var l;if(!n)return;m.value=null==(l=n.invoice_infos.at(-1))?void 0:l.pricing_plan_schedule_id,o&&(c.value=n.first_invoice,o.start_at&&o.end_at&&(r.value=t.convertDateRangeToTimePeriod(new Date(o.start_at),new Date(o.end_at))));const u=n.invoice_infos.find(({pricing_plan_schedule_id:e})=>e===a),s=null==u?void 0:u.invoices[0];s&&(i[e]=s)}),s.value=i,u.value=i[B]}catch(T){throw d.value=o.ApiStatus.Failed,l.error("INVOICE_PREVIEW_FAILED","Failed to load invoice preview",{},T),T}finally{d.value=o.ApiStatus.Done}},invoicePreview:u,invoicePreviewByBillingPeriod:s,trialInvoicePreview:c,trialPeriod:r,lastPreviewScheduleId:m,isPending:e.computed(()=>d.value===o.ApiStatus.Loading)}})(),y=e.computed(()=>m.value&&C.form.value.country&&A.value),{paymentMethodOptions:f,loadPaymentMethodOptions:b,isPending:N}=(()=>{const i=e.ref(),{getPaymentMethodOptions:n}=c.createPaymentMethodsService(),{data:o,execute:a,isPending:l}=u.useService({initialValue:[],service:n});return{loadPaymentMethodOptions:async({subscriptionId:e,country:n,amount:o})=>{const l={subscriptionId:e,country:n,amount:o};t.isEqual(l,i.value)||(i.value=l,await a(l))},paymentMethodOptions:o,isPending:l}})(),I=()=>{const e={subscription:m.value,checkoutForm:C.form.value,enabledPricingIds:d,promotionCode:C.form.value.promotionCode};return C.form.value.enabledPricingIds&&(e.enabledPricingIds=C.form.value.enabledPricingIds),v.loadInvoicePreview(e)},C=k({initialState:{country:l,email:r},onRequiredFieldChange:()=>{m.value&&I().catch(()=>{})}}),D=e.computed(()=>{var e,i,n,o,a,l,r,c,u;const d=C.form.value.firstName||C.form.value.infix||C.form.value.lastName?{...C.form.value.firstName?{first_name:C.form.value.firstName}:{},...C.form.value.infix?{infix:C.form.value.infix}:{},...C.form.value.lastName?{last_name:C.form.value.lastName}:{}}:{},p={...C.form.value.addressLine1&&{line1:C.form.value.addressLine1},...C.form.value.addressLine2&&{line2:C.form.value.addressLine2},...C.form.value.city&&{city:C.form.value.city},...C.form.value.postalCode&&{postal_code:C.form.value.postalCode},...C.form.value.state&&{state:C.form.value.state},country:C.form.value.country??""},g=_({pricingPlanScheduleInfos:(null==(e=m.value)?void 0:e.pricing_plan_schedule_infos)??[],type:"DEFAULT"}),v=null==(i=null==g?void 0:g.pricing_plan_version)?void 0:i.pricing_currency_settings,y=((null==(n=null==v?void 0:v.pricing_currencies)?void 0:n.length)??0)>1,f=((null==(a=null==(o=null==g?void 0:g.pricing_plan_version)?void 0:o.billing_period_settings)?void 0:a.billing_periods)??[]).length>1,b=h({enabledPricings:null==(l=C.form.value.enabledPricingIds)?void 0:l.map(e=>({pricing_id:e})),seatsValues:C.form.value.seatsValues,pricingPlanScheduleInfos:(null==(r=m.value)?void 0:r.pricing_plan_schedule_infos)??[],pricingCurrency:y?null==(c=m.value)?void 0:c.billing_currency:void 0,billingPeriod:f?null==(u=m.value)?void 0:u.billing_period:void 0}),M=C.form.value.promotionCode,N=M&&m.value?(()=>{var e,t,i;const n=b?[...b]:[],o=(null==(e=n[0])?void 0:e.pricing_plan_schedule_id)??(null==(i=_({pricingPlanScheduleInfos:(null==(t=m.value)?void 0:t.pricing_plan_schedule_infos)??[],type:"DEFAULT"}))?void 0:i.id);if(!o)return b;const a=n.find(({pricing_plan_schedule_id:e})=>e===o);if(a)a.promotion_codes=[M];else{const e=null==b?void 0:b[0];n.push({pricing_plan_schedule_id:o,...(null==e?void 0:e.enabled_pricings)&&{enabled_pricings:e.enabled_pricings},...(null==e?void 0:e.seats_values)&&{seats_values:e.seats_values},promotion_codes:[M]})}return n})():b;return{type:"INIT_PRICING_PLAN_SUBSCRIPTION",init_pricing_plan_subscription:{template_pricing_plan_subscription_id:s,...N&&{pricing_plan_schedule_customizations:N},customer_details:{email:C.form.value.email??"",type:C.form.value.type,..."INDIVIDUAL"===C.form.value.type?{individual:{residential_address:p,...d?{name:d}:{}}}:{organization:{registered_address:p,legal_name:C.form.value.companyLegalName??"",...C.form.value.companyVatNumber&&t.taxId.$validator(C.form.value.companyVatNumber,{},{})?{tax_ids:[{id:C.form.value.companyVatNumber,type:"GENERIC_TAX_ID"}]}:{}}}}}}}),A=e.computed(()=>{var e,t;return(null==(e=v.trialInvoicePreview.value)?void 0:e.invoice_amount_including_tax)??(null==(t=v.invoicePreview.value)?void 0:t.invoice_amount_including_tax)});return e.watch([()=>C.form.value.country,A],([e,t])=>{m.value&&e&&t&&b({subscriptionId:m.value.id,country:e,amount:t})}),e.onMounted(async()=>{await(async()=>{var e,t,i,n,o,a;const l=await g({id:s,expanded:!0}),r=_({pricingPlanScheduleInfos:l.pricing_plan_schedule_infos,type:"DEFAULT"}),c=null==(n=null==(i=null==(t=null==(e=null==r?void 0:r.pricing_plan_version)?void 0:e.billing_period_settings)?void 0:t.billing_periods)?void 0:i[0])?void 0:n.period;m.value={...l,billing_period:c??l.billing_period},C.updateInitialState({...C.form.value,enabledPricingIds:w(l,d),...(null==(o=null==r?void 0:r.pricing_plan_schedule)?void 0:o.seats_values)?{seatsValues:null==(a=null==r?void 0:r.pricing_plan_schedule)?void 0:a.seats_values.map(({pricing_item_config_id:e,number:t})=>({pricing_item_config_id:e,number:t}))}:{}})})();try{await I()}catch{}}),e.watch(y,e=>{e&&b({subscriptionId:m.value.id,country:C.form.value.country,amount:A.value})},{once:!0}),{invoicePreview:v.invoicePreview,invoicePreviewByBillingPeriod:v.invoicePreviewByBillingPeriod,trialInvoicePreview:v.trialInvoicePreview,trialPeriod:v.trialPeriod,loadInvoicePreview:I,updateInvoicePreviewOnBillingInformationChange:async e=>{const t=e.promotionCode??C.form.value.promotionCode,i=e.enabledPricingIds??C.form.value.enabledPricingIds;return await v.loadInvoicePreview({subscription:m.value,checkoutForm:{...C.form.value,...e},enabledPricingIds:i,promotionCode:t}),{trialInvoicePreview:v.trialInvoicePreview.value,invoicePreview:v.invoicePreview.value}},lastPreviewScheduleId:v.lastPreviewScheduleId,paymentMethodOptions:f,isPaymentMethodsPending:N,isInvoicePreviewPending:v.isPending,subscription:m,checkoutForm:C,authorizationContext:D,isPaid:p,amount:A}}const V={class:"flex items-center gap-2"},x=e.defineComponent({__name:"TaxIDCheckNotice",props:{taxIdValidationResult:{type:Object}},setup(i){const n=i,{formatMessage:o}=t.useIntl(),a=e.computed(()=>"VALID"===n.taxIdValidationResult.valid),l=e.computed(()=>a.value?o({defaultMessage:"VAT number is valid.",id:"tax_check.valid_vat_number",description:"The message shown when the VAT number is valid"}):o({defaultMessage:"VAT number is invalid.",id:"tax_check.invalid_vat_number",description:"The message shown when the VAT number is invalid"}));return(i,n)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$25),{type:a.value?"success":"danger",icon:!1},{default:e.withCtx(()=>[e.createElementVNode("div",V,[e.createVNode(e.unref(t._sfc_main),{variant:"body-xs"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value),1)]),_:1})])]),_:1},8,["type"]))}});const B={class:"grid grid-cols-1 gap-1"},S={class:"grid grid-cols-1 gap-2"},T={key:0},L={class:"mt-2 flex flex-col gap-3"},j={class:"grid grid-cols-3 gap-2"},z={class:"flex grow flex-col"},O={key:0},R={class:"mt-4 grid grid-cols-1 gap-3"},U=e.defineComponent({__name:"CheckoutForm",props:e.mergeModels({validation:{type:null},initialState:{type:Object},readOnlyEmail:{type:String},showCustomerInfoOnTop:{type:Boolean},isBillingInformationMandatory:{type:Boolean},getIsFieldRequired:{type:Function},readOnly:{type:Boolean}},{modelValue:{required:!0},modelModifiers:{}}),emits:e.mergeModels(["submit"],["update:modelValue"]),setup(i){const n=i,o=e.ref(!1),a=e.useModel(i,"modelValue"),l=e.computed({get:()=>"ORGANIZATION"===a.value.type,set:e=>{a.value.type=e?"ORGANIZATION":"INDIVIDUAL"}}),r=e.computed(()=>"ORGANIZATION"===a.value.type),c=e.computed({get:()=>a.value.country,set:e=>{a.value.country=e&&t.isValidCountryCode(e)?e:void 0}}),u=e.computed(()=>"US"!==a.value.country),{isTaxIDCheckEnabled:s,isTaxIDCheckPending:p,taxIdValidationData:m,runTaxIDCheck:g}=function(i){const{checkTaxID:n}=d.createCustomerService(),o=e.ref(void 0),a=e.computed(()=>{var e;return(null==(e=i.value.companyVatNumber)?void 0:e.trim())??""}),l=e.computed(()=>i.value.companyLegalName??""),r=e.computed(()=>i.value.country),c=e.ref(!1),u=e.computed(()=>t.isEUCountry(r.value??"")),s=e.computed(()=>!!(a.value&&l.value&&r.value)),p=e.computed(()=>u.value&&a.value);return{runTaxIDCheck:async function(){var e;if(s.value&&u.value&&r.value){c.value=!0;try{const t=await n({type:"ORGANIZATION",organization:{legal_name:l.value,tax_ids:[{id:a.value,type:"GENERIC_TAX_ID"}],registered_address:{country:r.value}}});(null==(e=null==t?void 0:t.data)?void 0:e.length)?o.value=t.data[0]:o.value=void 0}finally{c.value=!1}}},taxIdValidationData:o,isTaxIDCheckPending:c,isTaxIDCheckEnabled:s,showViesCheckNotice:p,isSelectedCountryEU:u}}(a),{$t:v}=t.useIntl(),y=e=>n.getIsFieldRequired(e)?"":" "+v({defaultMessage:"(optional)",id:"checkout.optional_suffix.label",description:"The suffix for optional fields in the checkout form"}),f=e.computed(()=>a.value.country?t.getCountryNameByCode(a.value.country):void 0);return(n,d)=>(e.openBlock(),e.createElementBlock("form",{id:"checkout-form",onSubmit:d[12]||(d[12]=e.withModifiers(e=>n.$emit("submit",a.value),["prevent"]))},[e.createElementVNode("div",B,[e.createVNode(e.unref(t._sfc_main$1),{title:e.unref(v)({defaultMessage:"Customer information",id:"checkout.contact_information_block.title",description:"The title of the contact information block in the checkout form"})},{default:e.withCtx(()=>[e.createElementVNode("div",S,[i.readOnly?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(t._sfc_main),{variant:"body",tag:"span",weight:"semibold","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.email),1)]),_:1}),e.createVNode(e.unref(t._sfc_main),{variant:"body-sm",tag:"span",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value),1)]),_:1})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(t._sfc_main$20),{modelValue:a.value.email,"onUpdate:modelValue":d[0]||(d[0]=e=>a.value.email=e),required:"",type:"email",name:"email",disabled:!!i.readOnlyEmail,label:e.unref(v)({defaultMessage:"Email address",id:"checkout.email_address.label",description:"The email address of the customer in the checkout form"}),placeholder:e.unref(v)({defaultMessage:"Email address...",id:"checkout.email_address.placeholder",description:"The email address of the customer in the checkout form"})+y("email"),error:i.validation.value.email.$errors},null,8,["modelValue","disabled","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$21),{"single-model-value":c.value,"onUpdate:singleModelValue":d[3]||(d[3]=e=>c.value=e),required:"",name:"country",label:e.unref(v)({defaultMessage:"Billing country",id:"checkout.country.label",description:"The country of the customer in the checkout form"})+y("country"),error:i.validation.value.country.$errors},{"label-suffix":e.withCtx(()=>[o.value||i.isBillingInformationMandatory?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,size:"xs",variant:"ghost","icon-prefix":"add",class:"py-0.5",onClick:d[1]||(d[1]=e=>o.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"More billing details",description:"Label of the button in the checkout that lets you fill out all billing details",id:"checkout.billing_details.add_billing_details_button.label"})),1)]),_:1})),o.value&&!i.isBillingInformationMandatory?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:1,size:"sm",variant:"ghost","icon-prefix":"close",class:"py-0.5",onClick:d[2]||(d[2]=e=>o.value=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"Remove billing details",id:"checkout.billing_details.remove_billing_details_button.label",description:"Label of the button in the checkout that lets you remove the billing details"})),1)]),_:1})):e.createCommentVNode("",!0)]),_:1},8,["single-model-value","label","error"])],64))]),e.createVNode(e.unref(t._sfc_main$26),null,{default:e.withCtx(()=>[o.value||i.isBillingInformationMandatory?(e.openBlock(),e.createElementBlock("div",T,[e.createElementVNode("div",L,[e.createVNode(e.unref(t._sfc_main$20),{modelValue:a.value.addressLine1,"onUpdate:modelValue":d[4]||(d[4]=e=>a.value.addressLine1=e),name:"address_line_1",label:e.unref(v)({defaultMessage:"Billing address",id:"checkout.address.title",description:"Address line 1 of the customer address in the checkout form"}),placeholder:e.unref(v)({defaultMessage:"Address line 1...",id:"checkout.address.line1.placeholder",description:"Address line 1 of the customer address in the checkout form"})+y("addressLine1"),required:"",error:i.validation.value.addressLine1.$errors},null,8,["modelValue","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$20),{modelValue:a.value.addressLine2,"onUpdate:modelValue":d[5]||(d[5]=e=>a.value.addressLine2=e),name:"address_line_2",placeholder:e.unref(v)({defaultMessage:"Address line 2...",id:"checkout.address.line2.placeholder",description:"Address line 2 of the customer address in the checkout form"})+y("addressLine2")},null,8,["modelValue","placeholder"]),e.createElementVNode("div",j,[e.createVNode(e.unref(t._sfc_main$20),{modelValue:a.value.postalCode,"onUpdate:modelValue":d[6]||(d[6]=e=>a.value.postalCode=e),name:"postal_code",placeholder:e.unref(v)({defaultMessage:"Postal code...",id:"checkout.address.portal_code.placeholder",description:"Postal code of the customer address in the checkout form"})+y("postalCode"),error:i.validation.value.addressLine1.$errors},null,8,["modelValue","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$20),{modelValue:a.value.city,"onUpdate:modelValue":d[7]||(d[7]=e=>a.value.city=e),name:"city",placeholder:e.unref(v)({defaultMessage:"City...",id:"checkout.address.city.placeholder",description:"City of the customer address in the checkout form"})+y("city")},null,8,["modelValue","placeholder"]),e.createVNode(e.unref(t._sfc_main$20),{modelValue:a.value.state,"onUpdate:modelValue":d[8]||(d[8]=e=>a.value.state=e),name:"state",placeholder:e.unref(v)({defaultMessage:"State...",id:"checkout.address.state.placeholder",description:"State of the customer address in the checkout form"})+y("state"),error:i.validation.value.state.$errors},null,8,["modelValue","placeholder","error"])])])])):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["title"]),i.readOnly?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$22),{modelValue:l.value,"onUpdate:modelValue":d[9]||(d[9]=e=>l.value=e),"no-spacing":"","label-position":"before",class:"!flex"},{"inline-label":e.withCtx(()=>[e.createElementVNode("div",z,[e.createVNode(e.unref(t._sfc_main),{tag:"span"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"Company purchase",id:"checkout.company_purchase_toggle.title",description:"The title of the company purchase toggle in the checkout"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"I am purchasing on behalf of a company",id:"checkout.company_purchase_toggle.sub_title",description:"The subtitle of the company purchase toggle in the checkout"})),1)]),_:1})])]),_:1},8,["modelValue"]),e.createVNode(e.unref(t._sfc_main$26),null,{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createElementBlock("div",O,[e.createElementVNode("div",R,[e.createVNode(e.unref(t._sfc_main$20),{modelValue:a.value.companyLegalName,"onUpdate:modelValue":d[10]||(d[10]=e=>a.value.companyLegalName=e),required:"",name:"legal_name",label:e.unref(v)({defaultMessage:"Legal entity name",id:"checkout.legal_name.label",description:"The legal name of the organization customer in the checkout form"}),placeholder:e.unref(v)({defaultMessage:"Legal entity name...",id:"checkout.legal_name.placeholder",description:"The legal name of the organization customer in the checkout form"})},null,8,["modelValue","label","placeholder"]),u.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$20),{key:0,modelValue:a.value.companyVatNumber,"onUpdate:modelValue":d[11]||(d[11]=e=>a.value.companyVatNumber=e),name:"vat_number","input-class":"focus:outline-none focus:ring-0",label:e.unref(v)({defaultMessage:"VAT number",id:"checkout.vat_number.label",description:"The label for the vat number in the checkout form"}),placeholder:e.unref(v)({defaultMessage:"VAT number...",id:"checkout.vat_number.placeholder",description:"The label for the vat number in the checkout form"}),error:i.validation.value.companyVatNumber.$errors,"suffix-class":"px-2 border-l-0"},e.createSlots({_:2},[e.unref(t.isEUCountry)(a.value.country??"")?{name:"suffix",fn:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$3),{type:"button",size:"sm",color:"green",disabled:!e.unref(s)||e.unref(p)||i.validation.value.companyVatNumber.$invalid,onClick:e.unref(g)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"Check",id:"checkout.vat_number.check_button.label",description:"The label for the check button in the checkout form"})),1)]),_:1},8,["disabled","onClick"])]),key:"0"}:void 0]),1032,["modelValue","label","placeholder","error"])):e.createCommentVNode("",!0),e.unref(m)?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass({"opacity-75":e.unref(p)})},[e.createVNode(x,{"tax-id-validation-result":e.unref(m)},null,8,["tax-id-validation-result"])],2)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)]),_:1})]),_:1}))])],32))}}),F={key:0,class:"flex items-center"},$=["innerHTML"],G=["innerHTML"],Y=e.defineComponent({__name:"CheckoutTitle",props:{trialPeriod:{type:Object},subscriptionName:{type:String},amount:{type:Object},billingPeriod:{type:Object},countryCode:{type:null},trialStartDate:{type:Date},subscriptionStartDate:{type:Date}},setup(i){const{$t:n}=t.useIntl();return(o,a)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",null,[e.createVNode(e.unref(t._sfc_main),{variant:"heading-1",class:"inline-block"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.trialStartDate?i.subscriptionName:e.unref(n)({defaultMessage:"Pay and subscribe",id:"checkout.page_title",description:"The title of the checkout page"}))+e.toDisplayString(" "),1),i.trialPeriod?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$27),{key:0,"trial-period":i.trialPeriod,size:"lg",class:"-translate-y-0.5"},null,8,["trial-period"])):e.createCommentVNode("",!0)]),_:1})]),e.createVNode(e.unref(t._sfc_main),{variant:"body-sm",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[i.countryCode?(e.openBlock(),e.createElementBlock("span",{key:1,innerHTML:i.trialStartDate?e.unref(n)({defaultMessage:"You will be billed <strong>{price}</strong> per {period_name}, starting {startDate, date, long}.",id:"checkout.trial_period_description",description:"The description of the trial period"},{price:e.unref(t.formatAmount)(i.amount),startDate:i.subscriptionStartDate,period_name:e.unref(t.formatBillingPeriod)(i.billingPeriod,{short:!0,hideValueForExactPeriods:!0}),strong:e=>`<strong>${e}</strong>`}):e.unref(n)({defaultMessage:"You will be billed <strong>{price}</strong> per {period_name}, starting today.",id:"checkout.subscription_description",description:"The description of the subscription"},{price:e.unref(t.formatAmount)(i.amount),period_name:e.unref(t.formatBillingPeriod)(i.billingPeriod,{short:!0,hideValueForExactPeriods:!0}),strong:e=>`<strong>${e}</strong>`})},null,8,G)):(e.openBlock(),e.createElementBlock("span",F,[e.createVNode(e.unref(t._sfc_main$28),{"is-dark-mode":""},{tooltip:e.withCtx(()=>[e.createVNode(e.unref(t.TooltipContent),null,{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$30),null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"Will be determined by billing information",description:"Tooltip content for the invoice preview when taxes are not determined by billing information",id:"invoice_preview.taxes_not_determined_by_billing_information_tooltip"})),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$29),{"width-class":"w-10","height-class":"h-4",shade:"darker",class:"inline-block mr-1.5"})]),_:1}),e.createElementVNode("span",{innerHTML:i.trialStartDate?e.unref(n)({defaultMessage:"per {period_name} starting, {startDate, date, long}",id:"checkout.trial_period_description",description:"The description of the trial period"},{startDate:i.subscriptionStartDate,period_name:e.unref(t.formatBillingPeriod)(i.billingPeriod,{short:!0,hideValueForExactPeriods:!0})}):e.unref(n)({defaultMessage:"per {period_name}, starting today",id:"checkout.subscription_description",description:"The description of the subscription"},{period_name:e.unref(t.formatBillingPeriod)(i.billingPeriod,{short:!0,hideValueForExactPeriods:!0})})},null,8,$)]))]),_:1})]))}}),q={class:"flex w-full min-h-96 justify-center items-center"},Q={class:"max-w-sm"},K=e.defineComponent({__name:"CheckoutNotAvailable",setup(i){const{$t:n}=t.useIntl(),o=()=>{window.location.reload()};return(i,a)=>(e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",Q,[e.createVNode(e.unref(t._sfc_main),{variant:"heading-1"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"Checkout not available",id:"checkout.not_available.title",description:"The title of the checkout not available page"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main),{variant:"body-sm",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"The checkout is currently not available.",id:"checkout.not_available.description",description:"The description of the checkout not available page"}))+" ",1),e.createElementVNode("a",{href:"#",class:"text-primary-900 hover:underline",onClick:e.withModifiers(o,["prevent"])},e.toDisplayString(e.unref(n)({defaultMessage:"Reload",id:"checkout.not_available.reload_button",description:"The label of the reload button"})),1),e.createTextVNode(" "+e.toDisplayString(e.unref(n)({defaultMessage:"this page to try again, or contact customer support.",id:"checkout.not_available.contact_support_message",description:"The message shown when the user wants to contact customer support"})),1)]),_:1})])]))}}),H=e.defineComponent({__name:"SubscriptionPaymentCompletedCard",emits:["continue-to-merchant"],setup(i){const{$t:n}=t.useIntl();return(i,o)=>(e.openBlock(),e.createBlock(p._sfc_main,{status:"success",title:e.unref(n)({defaultMessage:"Payment successful",id:"subscription_payment_completed_card.title",description:"The title for when a payment has been successful"})},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main),{variant:"body-xs",shade:"lighter",tag:"span"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"Thank you for subscribing.",id:"subscription_payment_completed_card.thank_you_for_subscribing",description:"The text shown after a successful message before a redirect"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$3),{color:"gray",variant:"outline",size:"xs",class:"align-center",onClick:o[0]||(o[0]=e=>i.$emit("continue-to-merchant"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"Continue to merchant",id:"subscription_payment_completed_card.continue",description:"The text for the continue button"})),1)]),_:1})]),_:1},8,["title"]))}}),Z={class:"flex flex-row gap-3 px-3 py-2"},X={class:"grow"},W=e.defineComponent({__name:"SubscriptionSummary",props:{subscription:{type:Object},invoice:{type:Object},loading:{type:Boolean},enabledPricingIds:{type:Array},avatar:{type:String},trialPeriod:{type:Object}},setup(i){const n=i,{$t:o}=t.useIntl(),a=e.computed(()=>{var e,t;return null==(t=null==(e=n.subscription.pricing_plan_schedule_infos)?void 0:e.at(-1))?void 0:t.pricing_plan_version.pricing_plan}),l=e.computed(()=>{var e;return(null==(e=a.value)?void 0:e.name)||n.subscription.name||o({defaultMessage:"Subscription",description:"The fallback name for when no subscription name can be determined",id:"customer_overview.subscriptions_block.fallback_subscription_name"})}),r=e.computed(()=>{var e;return n.subscription.description||(null==(e=a.value)?void 0:e.description)}),c=e.computed(()=>{if(!n.subscription||!n.enabledPricingIds)return;const e=function(e,t){const i=[];return function e(n){Array.isArray(n)?n.forEach(e):n&&"object"==typeof n&&("PRICING"===n.object_type&&t.includes(n.id)&&i.push(n),Object.values(n).forEach(e))}(e),i}(n.subscription,n.enabledPricingIds);return null==e?void 0:e.map(e=>{var t,i;return e.name??(null==(i=null==(t=e.products)?void 0:t[0])?void 0:i.name)}).join(" - ")});return(n,o)=>(e.openBlock(),e.createElementBlock("div",Z,[i.avatar?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$31),{key:0,"image-src":i.avatar,size:"lg",class:"my-1"},null,8,["image-src"])):e.createCommentVNode("",!0),e.createElementVNode("div",X,[e.createVNode(e.unref(t._sfc_main),{variant:"body",weight:"semibold","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value),1)]),_:1}),c.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:0,variant:"body-xs",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.value),1)]),_:1})):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:1,variant:"body-xs",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[c.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" • ")],64)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(r.value),1)]),_:1})):e.createCommentVNode("",!0)])]))}}),J={class:"sv-order-summary__body grid grid-cols-1 gap-1"},ee={class:"px-3 py-2"},te={class:"sv-order-summary__billing-period flex flex-col gap-3"},ie={class:"px-3 py-2"},ne={key:3,class:"sv-order-summary__items"},oe=e.defineComponent({__name:"OrderSummary",props:{subscription:{type:Object},invoice:{type:Object},invoicePreviewByBillingPeriod:{type:Object},trialInvoice:{type:Object},enabledPricingIds:{type:Array},trialPeriod:{type:Object},avatar:{type:String},isPaid:{type:Boolean},isUsageBased:{type:Boolean},isPreviewAndPaymentMethodsPending:{type:Boolean},collapsible:{type:String},noTitle:{type:Boolean},countryCode:{type:null},variant:{type:String}},emits:["billing-period-change"],setup(i,{emit:n}){const o=i,a=n,{$t:l}=t.useIntl(),{map:r,formatTimePeriod:c}=t.useTimePeriod(),{isMobileViewport:u}=g.useViewport(),s=e.computed(()=>u.value?"sm":"xs"),d=e=>`${e.type}:${e.value}`,p=["DAY","WEEK","MONTH","YEAR"],v=e=>p.includes(e),y=e=>{if(!e)return;const[t,i]=e.split(":"),n=Number(i);return n&&v(t)?{type:t,value:n}:void 0},f=e.computed({get:()=>{const e=o.subscription.billing_period;return e?`${e.type}:${e.value}`:void 0},set:e=>{if(!e)return;const[t,i]=e.split(":"),n=Number(i);n&&v(t)&&a("billing-period-change",{type:t,value:n})}}),h=e=>{var i,n,a,r;const u=null==(r=null==(a=null==(n=null==(i=o.invoicePreviewByBillingPeriod)?void 0:i[d(e)])?void 0:n.periods)?void 0:a[0])?void 0:r.amount_including_tax;if(!u)return;const s="MONTH"===e.type&&3===e.value?l({defaultMessage:"/quarter",id:"checkout.order_summary_block.billing_period.per_quarter",description:"Period label for quarterly billing"}):l({defaultMessage:"/{period}",id:"checkout.order_summary_block.billing_period.per_label",description:"Period label for billing cycles"},{period:c(e,{prefix:!1,hideValueForExactPeriods:!0})});return l({defaultMessage:"{amount}{period}",id:"checkout.order_summary_block.billing_period.sub_label",description:"Billing period option sublabel showing price per period"},{amount:t.formatAmount(u),period:s})},b=e=>{var t,i,n,a;return null==(a=null==(n=null==(i=null==(t=o.invoicePreviewByBillingPeriod)?void 0:t[d(e)])?void 0:i.periods)?void 0:n[0])?void 0:a.amount_including_tax},M=e=>Number(e.quantity),N=(e,t)=>{if(!t)return;const i={DAY:365,WEEK:52,MONTH:12,YEAR:1}[e.type]/Math.max(e.value??1,1),n=M(t)*i;return Number.isFinite(n)?{quantity:n.toFixed(2),currency:t.currency}:void 0},I=(e,t)=>{if(!e||!t)return;const i=M(e)-M(t);return!Number.isFinite(i)||i<=0?void 0:{quantity:i.toFixed(2),currency:e.currency}},k=e=>{if(!e)return;return`${l({defaultMessage:"Save {amount}",id:"checkout.order_summary_block.billing_period.save_badge.prefix",description:"First line for the savings badge label"},{amount:t.formatAmount(e)})}${l({defaultMessage:"/year",id:"checkout.order_summary_block.billing_period.save_badge.suffix",description:"Second line for the savings badge label"})}`},C=e.computed(()=>{var e,t,i;const n=_({pricingPlanScheduleInfos:o.subscription.pricing_plan_schedule_infos??[],type:"DEFAULT"}),a=(null==(t=null==(e=null==n?void 0:n.pricing_plan_version)?void 0:e.billing_period_settings)?void 0:t.billing_periods)??[],l=new Map,r=e=>{e&&l.set(d(e),e)},c=e=>{var t;null==(t=null==e?void 0:e.items)||t.forEach(e=>{var t,i,n;null==(t=e.configs)||t.forEach(e=>r(e.billing_period)),null==(i=e.billing_period_configs)||i.forEach(e=>r(e.billing_period)),null==(n=e.pricing_currency_configs)||n.forEach(e=>{var t,i;null==(t=e.configs)||t.forEach(e=>r(e.billing_period)),null==(i=e.billing_period_configs)||i.forEach(e=>r(e.billing_period))})})};if(((null==(i=null==n?void 0:n.pricing_plan_version)?void 0:i.pricing_categories)??[]).forEach(e=>{var t,i;null==(t=e.pricings)||t.forEach(e=>c(e)),null==(i=e.pricing_groups)||i.forEach(e=>{var t;return null==(t=e.pricings)?void 0:t.forEach(e=>c(e))})}),!l.size)return[];const u=a.map(e=>l.get(d(e.period))).filter(e=>!!e),s=new Set(u.map(d)),p=[...l.values()].filter(e=>!s.has(d(e)));return[...u,...p]}),D=e.computed(()=>{const e=C.value[C.value.length-1],i=e?N(e,b(e)):void 0;return C.value.map(n=>{const o="MONTH"===n.type&&3===n.value?l({defaultMessage:"Billed quarterly",id:"checkout.order_summary_block.billing_period.quarterly",description:"Billing period option label for quarterly billing"}):l({defaultMessage:"Billed {period}",id:"checkout.order_summary_block.billing_period.label",description:"Billing period option label for the selected period"},{period:r.value[n.type].full}),a=b(n),c=N(n,a),u=e&&n.type===e.type&&n.value===e.value?void 0:I(c,i),d=k(u);return{label:o,subLabel:h(n),labelSuffixComponent:d?{component:t._sfc_main$4,props:{color:"primary",content:d,size:s.value,class:"whitespace-nowrap text-left leading-tight"}}:void 0,hidden:f.value===`${n.type}:${n.value}`,value:`${n.type}:${n.value}`}})}),A=e.computed(()=>{const e=D.value,t=e[0],i=e[e.length-1];return{smallestPeriod:null==t?void 0:t.value,biggestPeriod:null==i?void 0:i.value}}),E=e.computed(()=>D.value.find(e=>e.value===A.value.biggestPeriod)),w=e.computed(()=>D.value.find(e=>e.value===f.value)),P=e.computed(()=>{var e,t,i,n,a,l,r,c;const u=D.value,s=u[u.length-1],d=f.value;if(!s||!d)return"";if(d===s.value)return"";const p=y(s.value);if(!p)return"";const m=null==(n=null==(i=null==(t=null==(e=o.invoicePreviewByBillingPeriod)?void 0:e[s.value])?void 0:t.periods)?void 0:i[0])?void 0:n.amount_including_tax,g=y(d),v=null==(c=null==(r=null==(l=null==(a=o.invoicePreviewByBillingPeriod)?void 0:a[d])?void 0:l.periods)?void 0:r[0])?void 0:c.amount_including_tax;if(!g||!v)return"";const _=N(g,v),h=N(p,m);return k(I(_,h))??""}),V=e=>{const{smallestPeriod:t,biggestPeriod:i}=A.value;f.value=e?i:t};return(n,o)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{class:"sv-order-summary","no-border":"","no-spacing":"","content-background":"none",title:i.noTitle?void 0:e.unref(l)({defaultMessage:"Order summary",id:"checkout.order_summary_block.title",description:"The title of the order summary block that lists the subscription cost in the checkout"})},{default:e.withCtx(()=>[e.createElementVNode("div",J,[e.createVNode(e.unref(t._sfc_main$1),{"no-spacing":"",class:"sv-order-summary__subscription"},{default:e.withCtx(()=>[i.subscription?(e.openBlock(),e.createBlock(W,{key:0,avatar:i.avatar,invoice:i.invoice,subscription:i.subscription,"enabled-pricing-ids":i.enabledPricingIds,loading:i.isPreviewAndPaymentMethodsPending,"trial-period":i.trialPeriod},null,8,["avatar","invoice","subscription","enabled-pricing-ids","loading","trial-period"])):e.createCommentVNode("",!0)]),_:1}),2===D.value.length?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0,"no-spacing":"","content-classes":f.value===A.value.biggestPeriod?"border-primary-500":void 0},{default:e.withCtx(()=>{var i;return[e.createElementVNode("div",ee,[e.createElementVNode("div",te,[E.value?(e.openBlock(),e.createBlock(m._sfc_main,{key:0,name:E.value.label,description:(null==(i=w.value)?void 0:i.subLabel)??""},e.createSlots({default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$22),{"model-value":f.value===A.value.biggestPeriod,"onUpdate:modelValue":V},null,8,["model-value"])]),_:2},[P.value?{name:"badge",fn:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$4),{color:"primary",content:P.value,size:s.value,class:"whitespace-nowrap text-left leading-tight"},null,8,["content","size"])]),key:"0"}:void 0]),1032,["name","description"])):e.createCommentVNode("",!0)])])]}),_:1},8,["content-classes"])):D.value.length>2?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$32),{key:1,"single-model-value":f.value,"onUpdate:singleModelValue":o[0]||(o[0]=e=>f.value=e),class:"sv-order-summary__billing-period",options:D.value,size:"xl","has-large-dropdown":"","show-sub-label-in-input":"","show-suffix-in-closed-input":""},null,8,["single-model-value","options"])):e.createCommentVNode("",!0),i.isUsageBased?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:2,"no-spacing":"",class:"sv-order-summary__usage"},{default:e.withCtx(()=>[e.createElementVNode("div",ie,[e.createVNode(e.unref(t._sfc_main),{"no-spacing":"",variant:"body-sm",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"+ Usage",id:"checkout.invoice_preview.usage_based_message",description:"The message shown for the usage based invoice preview"})),1)]),_:1})])]),_:1})):e.createCommentVNode("",!0),i.invoice&&"products-inline"!==i.variant?(e.openBlock(),e.createElementBlock("div",ne,[e.createVNode(e.unref(t._sfc_main$33),{invoice:i.invoice,"wrapper-component":e.unref(t._sfc_main$1)},null,8,["invoice","wrapper-component"])])):e.createCommentVNode("",!0),e.createVNode(e.unref(t._sfc_main$1),{class:"sv-order-summary__totals"},{default:e.withCtx(()=>[i.invoice?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$34),{key:0,class:"sv-order-summary__invoice-preview",variant:"products-inline"===i.variant?"default":"without-products",invoice:i.invoice,"trial-invoice":i.trialInvoice,"is-paid":i.isPaid,collapsible:i.collapsible,"is-preview-without-taxes":!i.countryCode,"is-customer-facing":""},null,8,["variant","invoice","trial-invoice","is-paid","collapsible","is-preview-without-taxes"])):(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:1,variant:"body-sm",shade:"lighter",class:"sv-order-summary__empty"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Please select a country first",description:"The message shown for the invoice preview when no country is set",id:"checkout.invoice_preview.no_country_selected_message"})),1)]),_:1}))]),_:1})])]),_:1},8,["title"]))}}),ae={class:"sv-empty-state__body flex flex-col items-center justify-center py-4"},le=e.defineComponent({__name:"EmptyStatePlaceholder",props:{icon:{type:null}},setup:i=>(n,o)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{class:"sv-empty-state"},{default:e.withCtx(()=>[e.createElementVNode("div",ae,[e.createVNode(e.unref(t._sfc_main$6),{icon:i.icon,size:"lg",class:"sv-empty-state__icon text-gray-500"},null,8,["icon"]),e.createVNode(e.unref(t._sfc_main),{center:"",tag:"span",variant:"body-sm",weight:"semibold",shade:"lighter",class:"sv-empty-state__title mt-2"},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"title")]),_:3}),e.createVNode(e.unref(t._sfc_main),{center:"",tag:"span",variant:"body-xs",shade:"lightest",class:"sv-empty-state__message mt-1"},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"message")]),_:3})])]),_:3}))}),re={key:0,id:"svg-logo",viewBox:"0 0 35 15",class:"h-[44px]"},ce={key:1,src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAxcHgiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAxMDEgMzIiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaW5ZTWluIG1lZXQiIHhtbG5zPSJodHRwOiYjeDJGOyYjeDJGO3d3dy53My5vcmcmI3gyRjsyMDAwJiN4MkY7c3ZnIj48cGF0aCBmaWxsPSIjMDAzMDg3IiBkPSJNIDEyLjIzNyAyLjggTCA0LjQzNyAyLjggQyAzLjkzNyAyLjggMy40MzcgMy4yIDMuMzM3IDMuNyBMIDAuMjM3IDIzLjcgQyAwLjEzNyAyNC4xIDAuNDM3IDI0LjQgMC44MzcgMjQuNCBMIDQuNTM3IDI0LjQgQyA1LjAzNyAyNC40IDUuNTM3IDI0IDUuNjM3IDIzLjUgTCA2LjQzNyAxOC4xIEMgNi41MzcgMTcuNiA2LjkzNyAxNy4yIDcuNTM3IDE3LjIgTCAxMC4wMzcgMTcuMiBDIDE1LjEzNyAxNy4yIDE4LjEzNyAxNC43IDE4LjkzNyA5LjggQyAxOS4yMzcgNy43IDE4LjkzNyA2IDE3LjkzNyA0LjggQyAxNi44MzcgMy41IDE0LjgzNyAyLjggMTIuMjM3IDIuOCBaIE0gMTMuMTM3IDEwLjEgQyAxMi43MzcgMTIuOSAxMC41MzcgMTIuOSA4LjUzNyAxMi45IEwgNy4zMzcgMTIuOSBMIDguMTM3IDcuNyBDIDguMTM3IDcuNCA4LjQzNyA3LjIgOC43MzcgNy4yIEwgOS4yMzcgNy4yIEMgMTAuNjM3IDcuMiAxMS45MzcgNy4yIDEyLjYzNyA4IEMgMTMuMTM3IDguNCAxMy4zMzcgOS4xIDEzLjEzNyAxMC4xIFoiPjwvcGF0aD48cGF0aCBmaWxsPSIjMDAzMDg3IiBkPSJNIDM1LjQzNyAxMCBMIDMxLjczNyAxMCBDIDMxLjQzNyAxMCAzMS4xMzcgMTAuMiAzMS4xMzcgMTAuNSBMIDMwLjkzNyAxMS41IEwgMzAuNjM3IDExLjEgQyAyOS44MzcgOS45IDI4LjAzNyA5LjUgMjYuMjM3IDkuNSBDIDIyLjEzNyA5LjUgMTguNjM3IDEyLjYgMTcuOTM3IDE3IEMgMTcuNTM3IDE5LjIgMTguMDM3IDIxLjMgMTkuMzM3IDIyLjcgQyAyMC40MzcgMjQgMjIuMTM3IDI0LjYgMjQuMDM3IDI0LjYgQyAyNy4zMzcgMjQuNiAyOS4yMzcgMjIuNSAyOS4yMzcgMjIuNSBMIDI5LjAzNyAyMy41IEMgMjguOTM3IDIzLjkgMjkuMjM3IDI0LjMgMjkuNjM3IDI0LjMgTCAzMy4wMzcgMjQuMyBDIDMzLjUzNyAyNC4zIDM0LjAzNyAyMy45IDM0LjEzNyAyMy40IEwgMzYuMTM3IDEwLjYgQyAzNi4yMzcgMTAuNCAzNS44MzcgMTAgMzUuNDM3IDEwIFogTSAzMC4zMzcgMTcuMiBDIDI5LjkzNyAxOS4zIDI4LjMzNyAyMC44IDI2LjEzNyAyMC44IEMgMjUuMDM3IDIwLjggMjQuMjM3IDIwLjUgMjMuNjM3IDE5LjggQyAyMy4wMzcgMTkuMSAyMi44MzcgMTguMiAyMy4wMzcgMTcuMiBDIDIzLjMzNyAxNS4xIDI1LjEzNyAxMy42IDI3LjIzNyAxMy42IEMgMjguMzM3IDEzLjYgMjkuMTM3IDE0IDI5LjczNyAxNC42IEMgMzAuMjM3IDE1LjMgMzAuNDM3IDE2LjIgMzAuMzM3IDE3LjIgWiI+PC9wYXRoPjxwYXRoIGZpbGw9IiMwMDMwODciIGQ9Ik0gNTUuMzM3IDEwIEwgNTEuNjM3IDEwIEMgNTEuMjM3IDEwIDUwLjkzNyAxMC4yIDUwLjczNyAxMC41IEwgNDUuNTM3IDE4LjEgTCA0My4zMzcgMTAuOCBDIDQzLjIzNyAxMC4zIDQyLjczNyAxMCA0Mi4zMzcgMTAgTCAzOC42MzcgMTAgQyAzOC4yMzcgMTAgMzcuODM3IDEwLjQgMzguMDM3IDEwLjkgTCA0Mi4xMzcgMjMgTCAzOC4yMzcgMjguNCBDIDM3LjkzNyAyOC44IDM4LjIzNyAyOS40IDM4LjczNyAyOS40IEwgNDIuNDM3IDI5LjQgQyA0Mi44MzcgMjkuNCA0My4xMzcgMjkuMiA0My4zMzcgMjguOSBMIDU1LjgzNyAxMC45IEMgNTYuMTM3IDEwLjYgNTUuODM3IDEwIDU1LjMzNyAxMCBaIj48L3BhdGg+PHBhdGggZmlsbD0iIzAwOWNkZSIgZD0iTSA2Ny43MzcgMi44IEwgNTkuOTM3IDIuOCBDIDU5LjQzNyAyLjggNTguOTM3IDMuMiA1OC44MzcgMy43IEwgNTUuNzM3IDIzLjYgQyA1NS42MzcgMjQgNTUuOTM3IDI0LjMgNTYuMzM3IDI0LjMgTCA2MC4zMzcgMjQuMyBDIDYwLjczNyAyNC4zIDYxLjAzNyAyNCA2MS4wMzcgMjMuNyBMIDYxLjkzNyAxOCBDIDYyLjAzNyAxNy41IDYyLjQzNyAxNy4xIDYzLjAzNyAxNy4xIEwgNjUuNTM3IDE3LjEgQyA3MC42MzcgMTcuMSA3My42MzcgMTQuNiA3NC40MzcgOS43IEMgNzQuNzM3IDcuNiA3NC40MzcgNS45IDczLjQzNyA0LjcgQyA3Mi4yMzcgMy41IDcwLjMzNyAyLjggNjcuNzM3IDIuOCBaIE0gNjguNjM3IDEwLjEgQyA2OC4yMzcgMTIuOSA2Ni4wMzcgMTIuOSA2NC4wMzcgMTIuOSBMIDYyLjgzNyAxMi45IEwgNjMuNjM3IDcuNyBDIDYzLjYzNyA3LjQgNjMuOTM3IDcuMiA2NC4yMzcgNy4yIEwgNjQuNzM3IDcuMiBDIDY2LjEzNyA3LjIgNjcuNDM3IDcuMiA2OC4xMzcgOCBDIDY4LjYzNyA4LjQgNjguNzM3IDkuMSA2OC42MzcgMTAuMSBaIj48L3BhdGg+PHBhdGggZmlsbD0iIzAwOWNkZSIgZD0iTSA5MC45MzcgMTAgTCA4Ny4yMzcgMTAgQyA4Ni45MzcgMTAgODYuNjM3IDEwLjIgODYuNjM3IDEwLjUgTCA4Ni40MzcgMTEuNSBMIDg2LjEzNyAxMS4xIEMgODUuMzM3IDkuOSA4My41MzcgOS41IDgxLjczNyA5LjUgQyA3Ny42MzcgOS41IDc0LjEzNyAxMi42IDczLjQzNyAxNyBDIDczLjAzNyAxOS4yIDczLjUzNyAyMS4zIDc0LjgzNyAyMi43IEMgNzUuOTM3IDI0IDc3LjYzNyAyNC42IDc5LjUzNyAyNC42IEMgODIuODM3IDI0LjYgODQuNzM3IDIyLjUgODQuNzM3IDIyLjUgTCA4NC41MzcgMjMuNSBDIDg0LjQzNyAyMy45IDg0LjczNyAyNC4zIDg1LjEzNyAyNC4zIEwgODguNTM3IDI0LjMgQyA4OS4wMzcgMjQuMyA4OS41MzcgMjMuOSA4OS42MzcgMjMuNCBMIDkxLjYzNyAxMC42IEMgOTEuNjM3IDEwLjQgOTEuMzM3IDEwIDkwLjkzNyAxMCBaIE0gODUuNzM3IDE3LjIgQyA4NS4zMzcgMTkuMyA4My43MzcgMjAuOCA4MS41MzcgMjAuOCBDIDgwLjQzNyAyMC44IDc5LjYzNyAyMC41IDc5LjAzNyAxOS44IEMgNzguNDM3IDE5LjEgNzguMjM3IDE4LjIgNzguNDM3IDE3LjIgQyA3OC43MzcgMTUuMSA4MC41MzcgMTMuNiA4Mi42MzcgMTMuNiBDIDgzLjczNyAxMy42IDg0LjUzNyAxNCA4NS4xMzcgMTQuNiBDIDg1LjczNyAxNS4zIDg1LjkzNyAxNi4yIDg1LjczNyAxNy4yIFoiPjwvcGF0aD48cGF0aCBmaWxsPSIjMDA5Y2RlIiBkPSJNIDk1LjMzNyAzLjMgTCA5Mi4xMzcgMjMuNiBDIDkyLjAzNyAyNCA5Mi4zMzcgMjQuMyA5Mi43MzcgMjQuMyBMIDk1LjkzNyAyNC4zIEMgOTYuNDM3IDI0LjMgOTYuOTM3IDIzLjkgOTcuMDM3IDIzLjQgTCAxMDAuMjM3IDMuNSBDIDEwMC4zMzcgMy4xIDEwMC4wMzcgMi44IDk5LjYzNyAyLjggTCA5Ni4wMzcgMi44IEMgOTUuNjM3IDIuOCA5NS40MzcgMyA5NS4zMzcgMy4zIFoiPjwvcGF0aD48L3N2Zz4",role:"presentation",class:"h-[22px]"},ue=e.defineComponent({__name:"ExpressPaymentMethodButton",props:{type:{type:String}},emits:["click"],setup(i,{emit:n}){const o=i,a=n,l=e.computed(()=>{switch(o.type){case"applepay":return"Apple Pay";case"googlepay":return"Google Pay";case"paypal":return"PayPal";default:return}}),r=e.computed(()=>{switch(o.type){case"applepay":return"!bg-black !py-0";case"googlepay":return"!bg-black bg-[url(https://www.gstatic.com/instantbuy/svg/dark_gpay.svg)] bg-[length:auto_42.5%]";case"paypal":return"!bg-[#ffc439]";default:return}});function c(){a("click")}return(i,n)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{size:"lg","aria-label":l.value,class:e.normalizeClass([r.value,"!block w-full h-11 bg-center bg-no-repeat"]),onClick:c},{default:e.withCtx(()=>["applepay"===o.type?(e.openBlock(),e.createElementBlock("svg",re,[...n[0]||(n[0]=[e.createElementVNode("svg",{id:"svg-logo",x:"0",y:"3.85",height:"7.3",width:"35",class:"logo",viewBox:"0 0 105 43",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("title",null,"Apple Logo"),e.createElementVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createElementVNode("g",{fill:"#FFF"},[e.createElementVNode("path",{d:"M19.4028,5.5674 C20.6008,4.0684 21.4138,2.0564 21.1998,0.0004 C19.4458,0.0874 17.3058,1.1574 16.0668,2.6564 C14.9538,3.9414 13.9688,6.0374 14.2258,8.0074 C16.1948,8.1784 18.1618,7.0244 19.4028,5.5674"}),e.createElementVNode("path",{d:"M21.1772,8.3926 C18.3182,8.2226 15.8872,10.0156 14.5212,10.0156 C13.1552,10.0156 11.0642,8.4786 8.8022,8.5196 C5.8592,8.5626 3.1282,10.2276 1.6342,12.8746 C-1.4378,18.1696 0.8232,26.0246 3.8112,30.3376 C5.2622,32.4716 7.0102,34.8206 9.3142,34.7366 C11.4912,34.6506 12.3442,33.3266 14.9902,33.3266 C17.6352,33.3266 18.4042,34.7366 20.7082,34.6936 C23.0972,34.6506 24.5922,32.5586 26.0422,30.4226 C27.7072,27.9906 28.3882,25.6426 28.4312,25.5126 C28.3882,25.4706 23.8232,23.7186 23.7812,18.4676 C23.7382,14.0706 27.3652,11.9786 27.5362,11.8496 C25.4882,8.8196 22.2872,8.4786 21.1772,8.3926"}),e.createElementVNode("path",{d:"M85.5508,43.0381 L85.5508,39.1991 C85.8628,39.2421 86.6158,39.2871 87.0158,39.2871 C89.2138,39.2871 90.4558,38.3551 91.2108,35.9581 L91.6548,34.5371 L83.2428,11.2321 L88.4368,11.2321 L94.2958,30.1421 L94.4068,30.1421 L100.2668,11.2321 L105.3278,11.2321 L96.6048,35.7141 C94.6078,41.3291 92.3208,43.1721 87.4828,43.1721 C87.1048,43.1721 85.8838,43.1271 85.5508,43.0381"}),e.createElementVNode("path",{d:"M42.6499,19.3555 L48.3549,19.3555 C52.6829,19.3555 55.1469,17.0255 55.1469,12.9855 C55.1469,8.9455 52.6829,6.6375 48.3769,6.6375 L42.6499,6.6375 L42.6499,19.3555 Z M49.6869,2.4425 C55.9009,2.4425 60.2289,6.7265 60.2289,12.9625 C60.2289,19.2225 55.8129,23.5285 49.5309,23.5285 L42.6499,23.5285 L42.6499,34.4705 L37.6779,34.4705 L37.6779,2.4425 L49.6869,2.4425 Z"}),e.createElementVNode("path",{d:"M76.5547,25.7705 L76.5547,23.9715 L71.0287,24.3275 C67.9207,24.5275 66.3007,25.6815 66.3007,27.7015 C66.3007,29.6545 67.9887,30.9195 70.6287,30.9195 C74.0027,30.9195 76.5547,28.7665 76.5547,25.7705 M61.4617,27.8345 C61.4617,23.7285 64.5917,21.3755 70.3627,21.0205 L76.5547,20.6425 L76.5547,18.8675 C76.5547,16.2705 74.8457,14.8495 71.8057,14.8495 C69.2967,14.8495 67.4777,16.1375 67.0997,18.1125 L62.6167,18.1125 C62.7497,13.9615 66.6567,10.9435 71.9387,10.9435 C77.6207,10.9435 81.3267,13.9175 81.3267,18.5345 L81.3267,34.4705 L76.7327,34.4705 L76.7327,30.6305 L76.6217,30.6305 C75.3127,33.1395 72.4267,34.7145 69.2967,34.7145 C64.6807,34.7145 61.4617,31.9625 61.4617,27.8345"})])])],-1)])])):"paypal"===o.type?(e.openBlock(),e.createElementBlock("img",ce)):e.createCommentVNode("",!0)]),_:1},8,["aria-label","class"]))}}),se={class:"absolute h-[1px] w-[1px] overflow-hidden opacity-0"},de=e.defineComponent({__name:"ExpressPaymentMethodApplePay",props:{onBillingInformationChange:{type:Function},amount:{type:Object},countryCode:{type:String},locale:{type:String},isVisible:{type:Boolean},paymentMethodOptionsResponse:{type:Object},billingInformation:{type:Object}},emits:["ready","update-billing-information"],setup(n,{emit:o}){const a=n,l=o,r=e.ref(),c=i.useLogger(),{authorizePayment:u}=y.createPaymentsService(),s=a.paymentMethodOptionsResponse.payment_acceptor.id,d=e=>{if(!e.value)return;let t=e.value??1,i=e.type.toLowerCase();return"WEEK"===e.type&&(i="day",t=7*e.value),"day"===i||"month"===i||"year"===i||"hour"===i||"minute"===i?{recurringPaymentIntervalUnit:i,recurringPaymentIntervalCount:t}:void 0},m=e=>({postal_code:e.postalCode,city:e.locality,country:e.countryCode}),g=e=>({postal_code:e.postalCode,city:e.city,country:e.country}),v=e=>e&&f(e)?e:void 0,f=e=>t.isValidCountryCode(e),_=()=>{var e;const t=null==(e=r.value)?void 0:e.querySelector("apple-pay-button");if(t){const e=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});t.dispatchEvent(e)}};return e.onMounted(()=>{(async()=>{const{AdyenCheckout:e,ApplePay:t}=await Promise.resolve().then(()=>require("../../index-DIFK3mcJ.js")),i=new t(await e(p.getAdyenExpressCheckoutConfiguration({amount:a.amount,locale:a.locale,countryCode:a.countryCode,paymentMethodOptionResponse:a.paymentMethodOptionsResponse,logger:c})),{isExpress:!0,recurringPaymentRequest:{paymentDescription:a.billingInformation.description,billingAgreement:a.billingInformation.agreement,managementURL:"https://www.google.com",...a.billingInformation.trial&&{trialBilling:{label:a.billingInformation.trial.label,amount:a.billingInformation.trial.amount.quantity.toString(),type:"final",paymentTiming:"recurring",recurringPaymentStartDate:a.billingInformation.trial.startDate,recurringPaymentEndDate:a.billingInformation.trial.endDate}},...a.billingInformation.regular&&{regularBilling:{label:a.billingInformation.regular.label,amount:a.billingInformation.regular.amount.quantity.toString(),type:"final",paymentTiming:"recurring",recurringPaymentStartDate:a.billingInformation.regular.startDate,...d(a.billingInformation.regular.interval??{type:"MONTH",value:1})}}},requiredBillingContactFields:["postalAddress"],requiredShippingContactFields:["email"],onPaymentMethodSelected:async(e,t,i)=>{var n,o,r,c,u,s,d;const{invoicePreview:p,trialInvoicePreview:m}=await a.onBillingInformationChange({...(null==(n=i.paymentMethod.billingContact)?void 0:n.postalCode)&&{postal_code:i.paymentMethod.billingContact.postalCode},...(null==(o=i.paymentMethod.billingContact)?void 0:o.locality)&&{city:i.paymentMethod.billingContact.locality},...v(null==(r=i.paymentMethod.billingContact)?void 0:r.countryCode)&&{country:v(null==(c=i.paymentMethod.billingContact)?void 0:c.countryCode)}}),g=m?m.invoice_amount_including_tax.quantity.toString():p.invoice_amount_including_tax.quantity.toString();l("update-billing-information",{postal_code:null==(u=i.paymentMethod.billingContact)?void 0:u.postalCode,city:null==(s=i.paymentMethod.billingContact)?void 0:s.locality,country:null==(d=i.paymentMethod.billingContact)?void 0:d.countryCode}),e({newTotal:{label:a.billingInformation.regular.label,amount:g,type:"final"}})},onError:e=>{c.error("APPLE_PAY_ERROR","Apple Pay error",{error:e})},onAuthorized:async(e,t)=>{try{c.info("APPLE_PAY_AUTHORIZED","Apple Pay authorized",{data:e});const i=e.authorizedEvent;c.info("APPLE_PAY_EVENT_DATA","Apple Pay event data structure",{eventData:i,hasPaymentMethod:!!i.payment.token.paymentMethod,hasBrowserInfo:!!i.payment.token.paymentData,billingAddress:e.billingAddress});const n=i.payment.billingContact,o=e.billingAddress;n?l("update-billing-information",m(n)):o&&l("update-billing-information",g(o));const r={payment_method:p.transformObjectToAdyenObject(i.payment.token.paymentMethod),browser_info:p.transformObjectToAdyenObject(i.payment.token.paymentData)};c.info("APPLE_PAY_ADYEN_PAYLOAD","Adyen payload prepared",{adyen:r});const d=p.createReturnUrl({paymentAcceptorId:s,redirectUrl:window.location.href});c.info("APPLE_PAY_CALLING_API","Calling authorizePayment API",{paymentAcceptorId:s,amount:a.amount});const v=await u({payment_acceptor_id:s,payment_gateway_variant:"ADYEN",adyen:{...r,store_payment_method:!0},amount:a.amount,return_url:d});if(c.info("APPLE_PAY_API_RESPONSE","Payment API response received",{status:v.status,paymentResult:v}),"FAILURE"===v.status)return c.error("APPLE_PAY_AUTHORIZATION_FAILED","Payment authorization failed",{error:v}),void t.reject();if("ACTION_REQUIRED"===v.status)return c.warn("APPLE_PAY_ACTION_REQUIRED","Payment requires additional action",{action:v.action}),void t.reject();c.info("APPLE_PAY_SUCCESS","Apple Pay payment successful, resolving"),t.resolve()}catch(i){c.error("APPLE_PAY_AUTHORIZATION_FAILED","Apple Pay authorization failed",{error:i}),t.reject()}}});if(r.value)try{await i.isAvailable(),i.mount(r.value),l("ready")}catch(n){c.error("APPLE_PAY_ERROR","Apple Pay not available on this device",{},n)}else c.error("APPLE_PAY_ERROR","Apple Pay button ref not found")})()}),(t,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[n.isVisible?(e.openBlock(),e.createBlock(ue,{key:0,type:"applepay",onClick:_})):e.createCommentVNode("",!0),e.createElementVNode("div",se,[e.createElementVNode("div",{ref_key:"applePayButtonRef",ref:r},null,512)])],64))}}),pe={class:"relative overflow-hidden"},me=e.defineComponent({__name:"ExpressPaymentMethodPaypal",props:{amount:{type:Object},countryCode:{type:String},locale:{type:String},isVisible:{type:Boolean},paymentMethodOptionsResponse:{type:Object},billingInformation:{type:Object}},emits:["ready","update-billing-information"],setup(t,{emit:n}){const o=t,a=n,l=e.ref(),r=i.useLogger();return e.onMounted(()=>{(async()=>{const{AdyenCheckout:e,PayPal:t}=await Promise.resolve().then(()=>require("../../index-DIFK3mcJ.js")),i=new t(await e(p.getAdyenExpressCheckoutConfiguration({locale:o.locale,amount:o.amount,countryCode:o.countryCode,paymentMethodOptionResponse:o.paymentMethodOptionsResponse,logger:r})),{isExpress:!0,blockPayPalPayLaterButton:!0,blockPayPalCreditButton:!0,blockPayPalVenmoButton:!0,style:{height:55},onInit:()=>{a("ready")}});if(l.value)try{await i.isAvailable(),i.mount(l.value)}catch(n){r.error("EXPRESS_CHECKOUT_PAYPAL_ERROR","Failed mounting PayPal express button",{error:n})}else r.error("EXPRESS_CHECKOUT_PAYPAL_ERROR","The PayPal button reference is not found and cannot be mounted")})()}),(i,n)=>(e.openBlock(),e.createElementBlock("div",pe,[t.isVisible?(e.openBlock(),e.createBlock(ue,{key:0,type:"paypal",class:"w-full"})):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"paypalButtonRef",ref:l,class:"absolute inset-0 opacity-[0.0001]"},null,512)]))}}),ge={class:"absolute h-[1px] w-[1px] overflow-hidden opacity-0"},ve=e.defineComponent({__name:"ExpressPaymentMethodGooglePay",props:{amount:{type:Object},countryCode:{type:String},locale:{type:String},isVisible:{type:Boolean},paymentMethodOptionsResponse:{type:Object},billingInformation:{type:Object}},emits:["ready","update-billing-information"],setup(t,{emit:n}){const o=t,a=n,l=e.ref(),r=i.useLogger(),c=()=>{var e;const t=null==(e=l.value)?void 0:e.querySelector("#gpay-button-online-api-id");if(t){const e=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});t.dispatchEvent(e)}};return e.onMounted(()=>{(async()=>{const{AdyenCheckout:e,GooglePay:t}=await Promise.resolve().then(()=>require("../../index-DIFK3mcJ.js")),i=new t(await e(p.getAdyenExpressCheckoutConfiguration({locale:o.locale,amount:o.amount,countryCode:o.countryCode,paymentMethodOptionResponse:o.paymentMethodOptionsResponse,logger:r})),{isExpress:!0});if(l.value)try{await i.isAvailable(),i.mount(l.value),a("ready")}catch(n){r.error("EXPRESS_CHECKOUT_GOOGLE_PAY_ERROR","Failed mounting Google Pay express button",{error:n})}else r.error("EXPRESS_CHECKOUT_GOOGLE_PAY_ERROR","The Google Pay button reference is not found and cannot be mounted")})()}),(i,n)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[t.isVisible?(e.openBlock(),e.createBlock(ue,{key:0,type:"googlepay",onClick:c})):e.createCommentVNode("",!0),e.createElementVNode("div",ge,[e.createElementVNode("div",{ref_key:"googlePayButtonRef",ref:l},null,512)])],64))}}),ye={key:0,class:"mt-4n"},fe={class:"mb-2"},_e={class:"grid grid-cols-6 gap-1 md:gap-2"},he={class:"h-4 mt-4"},be=e.defineComponent({__name:"ExpressPaymentMethods",props:{amount:{type:Object},countryCode:{type:String},locale:{type:String},paymentMethodsOptionsResponse:{type:null},billingInformation:{type:Object},onBillingInformationChange:{type:Function}},emits:["update-billing-information"],setup(i){const n=["applepay"],o=i,{$t:a}=t.useIntl(),l=e.ref(!1),r=e.ref(!1),c=e.ref(!1),u=e.computed(()=>{var e;if(n.includes("applepay"))return null==(e=o.paymentMethodsOptionsResponse)?void 0:e.find(e=>{var t;return null==(t=e.options)?void 0:t.some(e=>"apple pay"===e.name.toLowerCase())})}),s=e.computed(()=>{var e;if(n.includes("paypal"))return null==(e=o.paymentMethodsOptionsResponse)?void 0:e.find(e=>{var t;return null==(t=e.options)?void 0:t.some(e=>"paypal"===e.name.toLowerCase())})}),d=e.computed(()=>{var e;if(n.includes("googlepay"))return null==(e=o.paymentMethodsOptionsResponse)?void 0:e.find(e=>{var t;return null==(t=e.options)?void 0:t.some(e=>"google pay"===e.name.toLowerCase())})}),p=e.computed(()=>!!(u.value||d.value||s.value)),m=e.computed(()=>{var e;if(0===(null==(e=o.paymentMethodsOptionsResponse)?void 0:e.length))return!1;const t=!u.value||l.value,i=!d.value||r.value,n=!s.value||c.value;return t&&i&&n}),g=e.computed(()=>m.value?(u.value?1:0)+(d.value?1:0)+(s.value?1:0):2);return(n,o)=>p.value?(e.openBlock(),e.createElementBlock("div",ye,[e.createElementVNode("div",fe,[m.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:1,variant:"heading-3",tag:"h2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Subscribe instantly with",id:"checkout.express_payment_methods.title",description:"The title of the express payment methods block in the checkout form"})),1)]),_:1})):(e.openBlock(),e.createBlock(v._sfc_main,{key:0,variant:"title"}))]),e.createElementVNode("div",_e,[m.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(v._sfc_main,{class:"h-11 col-span-3"}),e.createVNode(v._sfc_main,{class:"h-11 col-span-3"})],64)),e.createElementVNode("div",{class:e.normalizeClass(["col-span-3 md:col-span-2",{hidden:!u.value,"!col-span-6":1===g.value,"md:!col-span-3":2===g.value,"!col-span-6 md:!col-span-2":3===g.value}])},[u.value?(e.openBlock(),e.createBlock(de,{key:0,amount:i.amount,"billing-information":i.billingInformation,"country-code":i.countryCode,locale:i.locale,"is-visible":m.value,"payment-method-options-response":u.value,"on-billing-information-change":i.onBillingInformationChange,onReady:o[0]||(o[0]=e=>l.value=!0),onUpdateBillingInformation:o[1]||(o[1]=e=>n.$emit("update-billing-information",e))},null,8,["amount","billing-information","country-code","locale","is-visible","payment-method-options-response","on-billing-information-change"])):e.createCommentVNode("",!0)],2),e.createElementVNode("div",{class:e.normalizeClass(["col-span-3 md:col-span-2",{hidden:!d.value,"col-span-6 md:col-span-6":1===g.value,"md:!col-span-3":2===g.value}])},[d.value?(e.openBlock(),e.createBlock(ve,{key:0,amount:i.amount,"billing-information":i.billingInformation,"country-code":i.countryCode,locale:i.locale,"is-visible":m.value,"payment-method-options-response":d.value,onReady:o[2]||(o[2]=e=>r.value=!0)},null,8,["amount","billing-information","country-code","locale","is-visible","payment-method-options-response"])):e.createCommentVNode("",!0)],2),e.createElementVNode("div",{class:e.normalizeClass(["col-span-3 md:col-span-2",{hidden:!s.value,"col-span-6 md:col-span-6":1===g.value,"md:!col-span-3":2===g.value}])},[s.value?(e.openBlock(),e.createBlock(me,{key:0,amount:i.amount,"billing-information":i.billingInformation,"country-code":i.countryCode,locale:i.locale,"is-visible":m.value,"payment-method-options-response":s.value,onReady:o[3]||(o[3]=e=>c.value=!0)},null,8,["amount","billing-information","country-code","locale","is-visible","payment-method-options-response"])):e.createCommentVNode("",!0)],2)]),e.createElementVNode("div",he,[m.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$16),{key:1,text:e.unref(a)({defaultMessage:"Or",id:"checkout.express_payment_methods.divider_text",description:"The text of the divider text in the express payment methods block in the checkout form"}),"text-position":"center"},null,8,["text"])):(e.openBlock(),e.createBlock(v._sfc_main,{key:0,variant:"divider-text"}))])])):e.createCommentVNode("",!0)}}),Me={class:"grid grid-cols-2 gap-2"},Ne=e.defineComponent({__name:"TieredTableRow",props:{band:{type:Object},previousBand:{type:Object},isFirst:{type:Boolean},period:{type:Object}},setup(i){const n=i,{$t:o}=t.useIntl(),{formatTimePeriod:a}=t.useTimePeriod(),l=e.computed(()=>{var e;return n.isFirst?"0":(null==(e=n.previousBand)?void 0:e.tier_top_bound)&&"number"in n.previousBand.tier_top_bound?n.previousBand.tier_top_bound.number:void 0}),r=e.computed(()=>{if(n.band.tier_top_bound&&"number"in n.band.tier_top_bound)return n.band.tier_top_bound.number});return(n,c)=>(e.openBlock(),e.createElementBlock("div",Me,[e.createVNode(e.unref(t._sfc_main),{variant:"body-xs",shade:"lighter",tag:"div"},{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"{lower_bound} - {upper_bound} seats",id:"seats.tiered_range_label",description:"The label showing the seat count range for a tiered pricing tier"},{lower_bound:l.value??"0",upper_bound:r.value})),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"> {lower_bound} seats",id:"seats.tiered_unbounded_range_label",description:"The label showing the unbounded seat count range (greater than) for a tiered pricing tier"},{lower_bound:l.value??"0"})),1)],64))]),_:1}),e.createVNode(e.unref(t._sfc_main),{variant:"body-xs",shade:"lighter",tag:"div",class:"text-right"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.band.amount&&e.unref(o)({defaultMessage:"{amount} per seat/{period}",id:"seats.tiered_price_per_seat_period",description:"The price per seat and billing period label for a tiered pricing tier"},{amount:e.unref(t.formatAmount)(i.band.amount),period:i.period?e.unref(a)(i.period,{short:!0,hideValueForExactPeriods:!0}):""})),1)]),_:1})]))}}),Ie={class:"grid grid-cols-1 gap-0.5 pt-1.5"},ke=e.defineComponent({__name:"TieredTable",props:{bands:{type:Array},period:{type:Object}},setup:t=>(i,n)=>(e.openBlock(),e.createElementBlock("div",Ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.bands,(i,n)=>(e.openBlock(),e.createBlock(Ne,{key:n,band:i,"is-first":0===n,"previous-band":n>0?t.bands[n-1]:void 0,period:t.period},null,8,["band","is-first","previous-band","period"]))),128))]))});const Ce={class:"flex flex-row-reverse md:flex-row gap-4"},De={class:"w-24 md:w-32 shrink-0 justify-start"},Ae=["tabindex"],Ee={key:0},we={key:0},Pe=e.defineComponent({__name:"SeatsEditorItem",props:e.mergeModels({modelValue:{type:Object},defaultValue:{type:Object},pricings:{type:Array}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const n=i,o=e.useModel(i,"modelValue"),{$t:a}=t.useIntl(),{formatTimePeriod:l}=t.useTimePeriod(),r=e.ref(!1),c=e.computed({get:()=>o.value.number?+o.value.number:1,set(e){o.value={...o.value,number:void 0!==e?e.toString():void 0}}}),u=function({pricings:t,pricingItemConfigId:i}){return e.computed(()=>{var e,n,o,a,l,r;const{config:c,productItem:u}=function({pricings:e,pricingItemConfigId:t}){var i,n;const o=e.flatMap(e=>e.items??[]).find(e=>{var i;return null==(i=e.configs)?void 0:i.some(e=>e.id===t)});return{config:null==(i=null==o?void 0:o.configs)?void 0:i.find(e=>e.id===t),productItem:null==(n=null==o?void 0:o.product_items)?void 0:n[0]}}({pricings:t,pricingItemConfigId:i});return{billing:{period:null==c?void 0:c.billing_period,billedInAdvance:null==c?void 0:c.billing_in_advance},product:{name:null==u?void 0:u.name,description:null==u?void 0:u.description},pricing:{..."FLAT"===(null==(e=null==c?void 0:c.details)?void 0:e.pricing_type)&&{amount:null==(a=null==(o=null==(n=c.details)?void 0:n.bands)?void 0:o[0])?void 0:a.amount},..."TIERED"===(null==(l=null==c?void 0:c.details)?void 0:l.pricing_type)&&{tiered:{bands:null==(r=c.details)?void 0:r.bands}}}}})}({pricings:n.pricings,pricingItemConfigId:o.value.pricing_item_config_id}),s=e.computed(()=>{var e,t;return!!(null==(t=null==(e=u.value.pricing)?void 0:e.tiered)?void 0:t.bands)});return(n,o)=>{var d,p,m;return e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Ce,[e.createElementVNode("div",De,[e.createVNode(e.unref(t._sfc_main$35),{modelValue:c.value,"onUpdate:modelValue":o[0]||(o[0]=e=>c.value=e),size:"sm",min:(null==(d=i.defaultValue)?void 0:d.number)?+i.defaultValue.number:void 0},null,8,["modelValue","min"])]),e.createElementVNode("div",{class:e.normalizeClass(["flex flex-col grow",{"hover:cursor-pointer":s.value}]),tabindex:s.value?0:void 0,onClick:o[1]||(o[1]=e=>s.value?r.value=!r.value:void 0)},[e.createVNode(e.unref(t._sfc_main),{tag:"span",variant:"body-sm",weight:"semibold"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).product.name||e.unref(a)({defaultMessage:"Seats",id:"seats.label",description:"The label for the seats input field"})),1)]),_:1}),e.unref(u).pricing.amount?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:0,tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"{amount} per seat/{period}",id:"seats.price_per_seat_period",description:"The price per seat and billing period label for seat-based pricing"},{amount:e.unref(t.formatAmount)(e.unref(u).pricing.amount),period:e.unref(u).billing.period?e.unref(l)(e.unref(u).billing.period,{short:!0,hideValueForExactPeriods:!0}):""})),1)]),_:1})):e.unref(u).pricing.tiered?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:1,tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Tiered pricing",id:"seats.tiered_pricing_label",description:"The label indicating tiered pricing structure for seats"}))+" ",1),e.createVNode(e.unref(t._sfc_main$6),{icon:"keyboard_arrow_down",size:"xs",class:e.normalizeClass(["absolute transition ease-in-out text-gray-400",{"rotate-0":!r.value,"rotate-180":r.value}])},null,8,["class"])]),_:1})):e.createCommentVNode("",!0)],10,Ae)]),(null==(m=null==(p=e.unref(u).pricing)?void 0:p.tiered)?void 0:m.bands)?(e.openBlock(),e.createElementBlock("div",Ee,[e.createVNode(e.unref(t._sfc_main$26),null,{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createElementBlock("div",we,[e.createVNode(ke,{bands:e.unref(u).pricing.tiered.bands,period:e.unref(u).billing.period},null,8,["bands","period"])])):e.createCommentVNode("",!0)]),_:1})])):e.createCommentVNode("",!0)])}}}),Ve=e.defineComponent({__name:"SeatsEditor",props:e.mergeModels({modelValue:{type:Array},initialSeatsValues:{type:Array},pricings:{type:Array}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const n=e.useModel(i,"modelValue"),o=t=>e.computed({get:()=>n.value[t],set:e=>{const i=n.value.slice();i[t]=e,n.value=i}});return(n,a)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.modelValue,(n,a)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:a},{default:e.withCtx(()=>{var t;return[n.pricing_item_config_id?(e.openBlock(),e.createBlock(Pe,{key:n.pricing_item_config_id,modelValue:o(a).value,"onUpdate:modelValue":e=>o(a).value=e,"default-value":null==(t=i.initialSeatsValues)?void 0:t[a],pricings:i.pricings},null,8,["modelValue","onUpdate:modelValue","default-value","pricings"])):e.createCommentVNode("",!0)]}),_:2},1024))),128))}}),xe={class:"flex gap-4 border-l-2 border-primary-600 px-2"},Be={class:"grow"},Se=e.defineComponent({__name:"PricingGroupTitle",setup:i=>(i,n)=>(e.openBlock(),e.createElementBlock("div",xe,[e.createElementVNode("div",Be,[e.createVNode(e.unref(t._sfc_main),{tag:"span",variant:"body-sm",weight:"semibold"},{default:e.withCtx(()=>[e.renderSlot(i.$slots,"title")]),_:3})]),e.createElementVNode("div",null,[e.createVNode(e.unref(t._sfc_main),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.renderSlot(i.$slots,"description")]),_:3})])]))}),Te={class:"p-1"},Le={class:"grid grid-cols-1 gap-1 pt-1"},je=e.defineComponent({__name:"AddonSingleEditor",props:e.mergeModels({constraint:{type:String},modelValue:{type:Array},pricings:{type:Array},billingPeriod:{type:Object},currency:{type:String},groupName:{type:String}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const n=i,o=e.useModel(i,"modelValue"),{$t:a}=t.useIntl(),{renderPricingForPricingItem:l}=t.usePricingItem({currency:e.toRef(n,"currency"),billingPeriod:e.toRef(n,"billingPeriod")}),r=n.pricings.map(e=>e.id),c=e.computed(()=>"AT_MOST_ONE"===n.constraint?a({defaultMessage:"Select up to one product",id:"addon_single_editor.description.at_most_one",description:"The description of the addon single editor for at most one product"}):"EXACTLY_ONE"===n.constraint?a({defaultMessage:"Select one product",id:"addon_single_editor.description.exactly_one",description:"The description of the addon single editor for exactly one product"}):"AT_LEAST_ONE"===n.constraint?a({defaultMessage:"Select at least one product",id:"addon_single_editor.description.at_least_one",description:"The description of the addon single editor for at least one product"}):""),u=e=>n.modelValue.includes(e);return(n,s)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{"no-spacing":""},{default:e.withCtx(()=>[e.createElementVNode("div",Te,[e.createVNode(Se,null,{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.groupName),1)]),description:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.value),1)]),_:1}),e.createElementVNode("div",Le,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.pricings,i=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:i.id,"content-background":"none",class:e.normalizeClass({"!bg-white":u(i.id)})},{default:e.withCtx(()=>{var n,c;return[e.createVNode(m._sfc_main,{name:e.unref(E)(i)??"",description:(null==(n=i.items)?void 0:n[0])?e.unref(l)({pricingItem:null==(c=i.items)?void 0:c[0]}):e.unref(a)({defaultMessage:"Unsupported pricing",id:"pricing_item_pricing.unsupported_pricing_error",description:"Text displayed when the pricing item pricing is unsupported"})},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$22),{"model-value":u(i.id),"onUpdate:modelValue":e=>(e=>{if(u(e))o.value=o.value.filter(t=>t!==e);else{const t=o.value.filter(e=>!r.includes(e));o.value=[...t,e]}})(i.id)},null,8,["model-value","onUpdate:modelValue"])]),_:2},1032,["name","description"])]}),_:2},1032,["class"]))),128))])])]),_:1}))}}),ze={class:"grid grid-cols-1 gap-1"},Oe=e.defineComponent({__name:"AddonMultipleEditor",props:e.mergeModels({modelValue:{type:Array},pricings:{type:Array},billingPeriod:{type:Object},currency:{type:String},groupName:{type:String}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const n=i,o=e.useModel(i,"modelValue"),{$t:a}=t.useIntl(),{renderPricingForPricingItem:l}=t.usePricingItem({currency:e.toRef(n,"currency"),billingPeriod:e.toRef(n,"billingPeriod")}),r=e=>o.value.includes(e),c=e=>{r(e)?o.value=o.value.filter(t=>t!==e):o.value=[...o.value,e]};return(n,o)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{"no-spacing":"","no-border":!i.groupName,"content-background":i.groupName?"gray":"none"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["grid grid-cols-1 gap-1",{"p-1":i.groupName}])},[i.groupName?(e.openBlock(),e.createBlock(Se,{key:0},{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.groupName),1)]),description:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Select any number of products",id:"addon_multiple_editor.description",description:"The description of the addon multiple editor"})),1)]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",ze,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.pricings,n=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:n.id,"content-background":i.groupName||r(n.id)?"none":"gray",class:e.normalizeClass({"!bg-white":r(n.id)})},{default:e.withCtx(()=>{var i,o;return[e.createVNode(m._sfc_main,{name:e.unref(E)(n)??"",description:(null==(i=n.items)?void 0:i[0])?e.unref(l)({pricingItem:null==(o=n.items)?void 0:o[0]}):e.unref(a)({defaultMessage:"Unsupported pricing",id:"addon_multiple_editor.unsupported_pricing_error",description:"Text displayed when the pricing item pricing is unsupported"})},{default:e.withCtx(()=>[r(n.id)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,color:"gray",variant:"outline",square:"",size:"sm","icon-prefix":"remove_shopping_cart",onClick:e=>c(n.id)},null,8,["onClick"])):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:1,color:"primary","icon-prefix":"add",size:"sm",onClick:e=>c(n.id)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Add to subscription ",id:"addon_multiple_editor.add_to_subscription_button",description:"The button to add a pricing to the subscription"})),1)]),_:1},8,["onClick"]))]),_:2},1032,["name","description"])]}),_:2},1032,["content-background","class"]))),128))])],2)]),_:1},8,["no-border","content-background"]))}}),Re={class:"p-1"},Ue={class:"pt-1"},Fe=e.defineComponent({__name:"PricingGroupSingleEditor",props:e.mergeModels({modelValue:{type:Array},pricings:{type:Array},billingPeriod:{type:Object},currency:{type:String},groupName:{type:String}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const n=i,o=e.useModel(i,"modelValue"),{$t:a}=t.useIntl(),{renderPricingForPricingItem:l}=t.usePricingItem({currency:e.toRef(n,"currency"),billingPeriod:e.toRef(n,"billingPeriod")}),{isMobileViewport:r}=g.useViewport(),c=e.computed(()=>n.pricings.map(e=>e.id)),u=e.computed({get:()=>o.value.find(e=>c.value.includes(e))??void 0,set:e=>{const t=o.value.filter(e=>!c.value.includes(e));o.value=e?[...t,e]:t}}),s=e.computed(()=>n.pricings.map(e=>{var t;const i=null==(t=e.items)?void 0:t[0];return{label:E(e)??"",value:e.id,description:i?l({pricingItem:i}):a({defaultMessage:"Unsupported pricing",id:"pricing_item_pricing.unsupported_pricing_error",description:"Text displayed when the pricing item pricing is unsupported"})}}));return(n,o)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{"no-spacing":""},{default:e.withCtx(()=>[e.createElementVNode("div",Re,[e.createVNode(Se,null,{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.groupName),1)]),_:1}),e.createElementVNode("div",Ue,[s.value.length<=3?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$36),{key:0,modelValue:u.value,"onUpdate:modelValue":o[0]||(o[0]=e=>u.value=e),options:s.value.slice(0,3),direction:e.unref(r)?"column":"row","show-radio":!1},null,8,["modelValue","options","direction"])):s.value.length<=6?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$32),{key:1,"single-model-value":u.value,"onUpdate:singleModelValue":o[1]||(o[1]=e=>u.value=e),options:s.value.map(({value:e,label:t,description:i})=>({label:t,subLabel:i,value:e})),size:"xl","show-sub-label-in-input":""},null,8,["single-model-value","options"])):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$37),{key:2,modelValue:u.value,"onUpdate:modelValue":o[2]||(o[2]=e=>u.value=e),options:s.value,name:`pricing-group-range-input-${i.groupName}`},null,8,["modelValue","options","name"]))])])]),_:1}))}});const $e={class:"sv-plan-customization__body grid grid-cols-1 gap-1"},Ge=e.defineComponent({__name:"PlanCustomizationEditor",props:e.mergeModels({subscription:{type:Object},enabledPricingIds:{type:Array},initialSeatsValues:{type:Array},billingPeriod:{type:Object},currency:{type:String}},{seatsValues:{required:!0},seatsValuesModifiers:{},enabledPricingIds:{required:!0},enabledPricingIdsModifiers:{}}),emits:["update:seatsValues","update:enabledPricingIds"],setup(i){const n=i,o=e.useModel(i,"seatsValues"),a=e.useModel(i,"enabledPricingIds"),{$t:l}=t.useIntl(),r=e.computed(()=>{var e;const t=null==(e=_({pricingPlanScheduleInfos:n.subscription.pricing_plan_schedule_infos,type:"DEFAULT"}))?void 0:e.pricing_plan_version;return t?function(e){var t;return((null==(t=e.pricing_categories)?void 0:t.flatMap(e=>e.pricings??[]))??[]).filter(e=>null!==e)}(t):[]}),c=e.computed(()=>r.value.filter(e=>"ADDON"===e.product_type)),u=e.computed(()=>A(n.subscription));return(n,s)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{class:"sv-plan-customization",title:e.unref(l)({defaultMessage:"Customize plan",id:"checkout.customize_plan_block.title",description:"The title of the customize plan block in the checkout form"}),"no-spacing":"","no-border":"","content-background":"none"},{default:e.withCtx(()=>[e.createElementVNode("div",$e,[e.createVNode(Ve,{modelValue:o.value,"onUpdate:modelValue":s[0]||(s[0]=e=>o.value=e),class:"sv-plan-customization__seats","initial-seats-values":i.initialSeatsValues,pricings:r.value},null,8,["modelValue","initial-seats-values","pricings"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.id},["DEFAULT"===t.product_type&&"EXACTLY_ONE"===t.selection_constraint?(e.openBlock(),e.createBlock(Fe,{key:0,modelValue:a.value,"onUpdate:modelValue":s[1]||(s[1]=e=>a.value=e),class:"sv-plan-customization__group","group-name":t.name,pricings:t.pricings,"billing-period":i.billingPeriod,currency:i.currency},null,8,["modelValue","group-name","pricings","billing-period","currency"])):"ADDON"===t.product_type&&"AT_MOST_ONE"===t.selection_constraint?(e.openBlock(),e.createBlock(je,{key:1,modelValue:a.value,"onUpdate:modelValue":s[2]||(s[2]=e=>a.value=e),class:"sv-plan-customization__group","group-name":t.name,pricings:t.pricings,constraint:t.selection_constraint,"billing-period":i.billingPeriod,currency:i.currency},null,8,["modelValue","group-name","pricings","constraint","billing-period","currency"])):"ADDON"===t.product_type&&"ANY"===t.selection_constraint?(e.openBlock(),e.createBlock(Oe,{key:2,modelValue:a.value,"onUpdate:modelValue":s[3]||(s[3]=e=>a.value=e),class:"sv-plan-customization__group",pricings:t.pricings,"group-name":t.name,"billing-period":i.billingPeriod,currency:i.currency},null,8,["modelValue","pricings","group-name","billing-period","currency"])):e.createCommentVNode("",!0)],64))),128)),e.createVNode(Oe,{modelValue:a.value,"onUpdate:modelValue":s[4]||(s[4]=e=>a.value=e),class:"sv-plan-customization__group",pricings:c.value,"billing-period":i.billingPeriod,currency:i.currency},null,8,["modelValue","pricings","billing-period","currency"])])]),_:1},8,["title"]))}}),Ye=["aria-expanded","aria-label"],qe={class:"flex w-full cursor-pointer flex-row items-center justify-between gap-3 px-3 py-2"},Qe={class:"flex flex-row items-center gap-2"},Ke=["onKeydown"],He=["aria-label"],Ze={class:"flex w-full cursor-pointer flex-row items-center justify-between gap-3 px-3 py-2"},Xe={class:"flex flex-row items-center gap-2"},We={class:"sr-only","aria-live":"polite"},Je=e.defineComponent({__name:"PromotionCodeSection",props:{promotionCode:{default:null,type:[String,null]}},emits:["update:appliedCode","apply","remove"],setup(i,{emit:n}){const{$t:o}=t.useIntl(),a=i,l=n,r=e.ref(!1),c=e.ref(""),u=e.ref(""),s=e.ref(null),d=e.ref(null),p=t.uniqueId("promotion-code-"),m=`${p}-label`,g=`${p}-panel`,v=e.computed(()=>null!==a.promotionCode&&""!==a.promotionCode),y=e.computed(()=>c.value.trim().length>0),f=e.computed(()=>a.promotionCode??o({defaultMessage:"Promotion applied",id:"checkout.promotion_code.applied_label",description:"Fallback label for an applied promotion code in checkout"})),_=e.computed(()=>o({defaultMessage:r.value?"Collapse promotion code input":"Expand promotion code input",id:r.value?"checkout.promotion_code.collapse_aria_label":"checkout.promotion_code.expand_aria_label",description:"Aria label for the promotion code toggle button in checkout"})),h=e.computed(()=>o({defaultMessage:"Apply promotion code",id:"checkout.promotion_code.apply_aria_label",description:"Aria label for the promotion code apply button in checkout"})),b=e.computed(()=>o({defaultMessage:"Remove promotion code",id:"checkout.promotion_code.remove_aria_label",description:"Aria label for the promotion code remove button in checkout"})),M=()=>{c.value=""},N=()=>{r.value&&(r.value=!1)},I=()=>{v.value||(r.value=!r.value)},k=()=>{if(!y.value)return;const e=c.value.trim();l("update:appliedCode",e),l("apply",e),u.value=o({defaultMessage:"Promotion code applied",id:"checkout.promotion_code.applied_status",description:"Aria live message when a promotion code is applied in checkout"}),r.value=!1},C=()=>{l("update:appliedCode",null),l("remove"),u.value=o({defaultMessage:"Promotion code removed",id:"checkout.promotion_code.removed_status",description:"Aria live message when a promotion code is removed in checkout"}),M(),e.nextTick(()=>{var e;null==(e=s.value)||e.focus()})};return e.watch(r,t=>{if(!t)return M(),void e.nextTick(()=>{var e;null==(e=s.value)||e.focus()});e.nextTick(()=>{(()=>{var e;const t=null==(e=d.value)?void 0:e.querySelector("input");t instanceof HTMLInputElement&&t.focus()})()})}),e.watch(()=>a.promotionCode,e=>{e||M()}),(i,n)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[v.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:1,"no-border":"","no-spacing":"","content-background":"none",class:"relative w-full"},{default:e.withCtx(()=>[e.createElementVNode("button",{type:"button",class:"w-full rounded border border-primary-900 bg-white","aria-label":b.value,onClick:C},[e.createElementVNode("div",Ze,[e.createElementVNode("div",Xe,[e.createVNode(e.unref(t._sfc_main$6),{icon:"local_activity"}),e.createVNode(e.unref(t._sfc_main),{variant:"body-sm",class:"font-semibold"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value),1)]),_:1})]),e.createVNode(e.unref(t._sfc_main$6),{icon:"close"})])],8,He)]),_:1})):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0,"no-spacing":"",class:"relative w-full"},{default:e.withCtx(()=>[e.createElementVNode("button",{ref_key:"toggleRef",ref:s,type:"button",class:"w-full","aria-expanded":r.value,"aria-controls":g,"aria-label":_.value,onClick:I},[e.createElementVNode("div",qe,[e.createElementVNode("div",Qe,[e.createVNode(e.unref(t._sfc_main$6),{icon:"local_activity"}),e.createVNode(e.unref(t._sfc_main),{id:m,variant:"body-sm"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"Add promotion code",id:"checkout.promotion_code.add_label",description:"Label for adding a promotion code in checkout"})),1)]),_:1})]),e.createVNode(e.unref(t._sfc_main$6),{icon:r.value?"remove":"add"},null,8,["icon"])])],8,Ye),e.withDirectives(e.createElementVNode("div",{id:g,ref_key:"panelRef",ref:d,role:"region","aria-labelledby":m,class:"flex w-full flex-row items-center gap-2 overflow-hidden border-t px-3 py-2",onKeydown:e.withKeys(e.withModifiers(N,["prevent"]),["esc"])},[e.createVNode(e.unref(t._sfc_main$20),{modelValue:c.value,"onUpdate:modelValue":n[0]||(n[0]=e=>c.value=e),placeholder:e.unref(o)({defaultMessage:"Promotion code",id:"checkout.promotion_code.placeholder",description:"Placeholder for promotion code input in checkout"}),"aria-label":e.unref(o)({defaultMessage:"Promotion code",id:"checkout.promotion_code.input_aria_label",description:"Aria label for promotion code input in checkout"}),class:"w-full",onKeydown:e.withKeys(e.withModifiers(k,["prevent"]),["enter"])},null,8,["modelValue","placeholder","aria-label","onKeydown"]),e.createVNode(e.unref(t._sfc_main$3),{type:"button",disabled:!y.value,"aria-label":h.value,"aria-disabled":!y.value,onClick:k},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"Apply",id:"checkout.promotion_code.apply_button",description:"Button label for applying a promotion code in checkout"})),1)]),_:1},8,["disabled","aria-label","aria-disabled"])],40,Ke),[[e.vShow,r.value]])]),_:1})),e.createElementVNode("span",We,e.toDisplayString(u.value),1)],64))}}),et={class:"flex justify-around"},tt={class:"flex items-center gap-0.5"},it={key:0,xmlns:"http://www.w3.org/2000/svg",width:"40",height:"15",fill:"none",viewBox:"0 0 40 15",class:"inline-block translate-y-[1px]"},nt=e.defineComponent({__name:"SecurePaymentsKPI",props:{paymentMethodOptions:{type:Array}},setup(i){const n=i,{$t:o}=t.useIntl(),a=e.computed(()=>n.paymentMethodOptions.find(({integration:e})=>{var t;return"ADYEN"===(null==(t=e.payment_gateway)?void 0:t.variant)})),l=e.computed(()=>a.value?o({defaultMessage:"Secure and encrypted payments by",description:"Secure encrypted payments KPI for a specific vendor, followed by a vendor logo",id:"secure_payments_kpi.specific_vendor"}):o({defaultMessage:"Secure and encrypted payments",description:"Secure encrypted payments KPI",id:"secure_payments_kpi.generic"}));return(i,n)=>(e.openBlock(),e.createElementBlock("div",et,[e.createElementVNode("div",tt,[e.createVNode(e.unref(t._sfc_main$6),{icon:"lock",size:"xs"}),e.createVNode(e.unref(t._sfc_main),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value)+" ",1),a.value?(e.openBlock(),e.createElementBlock("svg",it,[...n[0]||(n[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M.049 2.917h5.845c.646 0 1.17.522 1.17 1.166v5.834H1.217c-.646 0-1.17-.522-1.17-1.167V5.833h2.924v2.334H4.14v-3.5H.049zM32.784 2.917v7h2.922v-5.25h1.17v5.25h2.922V4.083c0-.644-.523-1.166-1.169-1.166zM16.417 12.833h5.845c.646 0 1.17-.522 1.17-1.166v-8.75h-2.924v5.25H19.34v-5.25h-2.922V8.75c0 .645.523 1.167 1.169 1.167h2.922v1.166h-4.091zM31.614 9.917H25.77c-.646 0-1.17-.522-1.17-1.167V2.917h5.846c.646 0 1.17.522 1.17 1.166V7h-2.923V4.667h-1.17v3.5h4.092zM15.248 0v9.917H9.402c-.646 0-1.17-.522-1.17-1.167V4.083c0-.644.524-1.166 1.17-1.166h1.754v5.25h1.169V0z"},null,-1)])])):e.createCommentVNode("",!0)]),_:1})])]))}}),ot={class:"sv-checkout__header"},at={key:5,class:"sv-checkout__payment-methods"},lt={key:0,class:"sv-checkout__payment-methods-body"},rt={key:2,class:"sv-checkout__payment-form"},ct={class:"sv-checkout__order-summary"},ut={class:"flex flex-col gap-2"},st=e.defineComponent({__name:"Checkout",props:{configuration:{type:Object}},emits:["error","ready"],setup(n,{emit:o}){var a,l,r,c,u,d,m,y;const h=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("../../PaymentIntegrationForm-xkf4TUaD.js"))),b=n,N=o,I=e.computed(()=>b.configuration),k=e.ref(),C=e.ref(),D=i.useLogger(),{$t:E,locale:w}=t.useIntl(),{formatTimePeriod:V}=t.useTimePeriod(),x=s.usePortal(),{isMobileViewport:B}=g.useViewport();if(D.info("COMPONENT_INITIALIZED","Checkout component initialized"),"INIT_PRICING_PLAN_SUBSCRIPTION"!==(null==(a=x.value)?void 0:a.type))throw D.error("INVALID_TOKEN","Invalid token"),Error("Invalid token");"REVOKED"===x.value.status&&(k.value={code:"RESOURCE_REVOKED",message:`Portal url with resource id "${x.value.id}" is revoked`},D.error("RESOURCE_REVOKED",`Portal url with resource id "${x.value.id}" is revoked`));const S=null==(r=null==(l=x.value)?void 0:l.init_pricing_plan_subscription)?void 0:r.pricing_plan_subscription_id,T=null==(u=null==(c=x.value)?void 0:c.init_pricing_plan_subscription)?void 0:u.success_url,{paymentMethodOptions:L,subscription:j,isPaymentMethodsPending:z,isInvoicePreviewPending:O,checkoutForm:R,invoicePreview:F,invoicePreviewByBillingPeriod:$,trialInvoicePreview:G,trialPeriod:q,authorizationContext:Q,isPaid:Z,amount:X,loadInvoicePreview:W,updateInvoicePreviewOnBillingInformationChange:J}=P({initialCountry:null==(d=b.configuration)?void 0:d.countryCode,initialEmail:null==(m=b.configuration)?void 0:m.email,subscriptionId:S,enabledPricingIds:null==(y=b.configuration)?void 0:y.enabledPricingIds}),ee=async()=>{var e;await R.validation.value.$validate(),R.validation.value.$invalid||null==(e=C.value)||e.submit()},te=async()=>(await R.validation.value.$validate(),!R.validation.value.$invalid),ie=e.computed(()=>!!G.value),ne=e.computed(()=>!!F.value&&(e=>{var t;return(null==(t=e.periods)?void 0:t.some(e=>e.groups.some(e=>{var t;return null==(t=e.lines)?void 0:t.some(e=>e.product_items.some(e=>"USAGE_BASED"===e.model_type))})))??!1})(F.value)),ae=e.computed(()=>R.form.value.country&&["US","CA"].includes(R.form.value.country)||!1),re=e.computed({get:()=>R.form.value.enabledPricingIds??[],set:e=>{R.form.value.enabledPricingIds=e}}),ce=e.computed(()=>j.value?_({pricingPlanScheduleInfos:j.value.pricing_plan_schedule_infos,type:"DEFAULT"}):void 0),ue=e.computed(()=>{var e,t;if(!j.value)return;const i=null==(t=null==(e=ce.value)?void 0:e.pricing_plan_version)?void 0:t.pricing_currency_settings;return M({country:R.form.value.country,pricingCurrencySettings:i,fallbackCurrency:j.value.billing_currency})}),se=e.computed(()=>{if(!ce.value||!j.value)return new Set;const e=function({pricingPlanScheduleInfo:e}){const t=new Map;return(e.pricing_plan_version.pricing_categories??[]).forEach(e=>{var i;null==(i=e.pricings)||i.forEach(e=>{var i;null==(i=e.items)||i.forEach(e=>{var i,n,o;null==(i=e.billing_period_configs)||i.forEach(e=>{var i;null==(i=e.configs)||i.forEach(i=>{var n,o,a,l;if(i.id){const r=null==(l=null==(a=null==(o=null==(n=i.details)?void 0:n.bands)?void 0:o.find(e=>{var t;return null==(t=e.amount)?void 0:t.currency}))?void 0:a.amount)?void 0:l.currency;t.set(i.id,{...r&&{currency:r},billingPeriod:e.billing_period})}})}),null==(n=e.configs)||n.forEach(e=>{var i,n,o,a;if(e.id){const l=null==(a=null==(o=null==(n=null==(i=e.details)?void 0:i.bands)?void 0:n.find(e=>{var t;return null==(t=e.amount)?void 0:t.currency}))?void 0:o.amount)?void 0:a.currency;t.set(e.id,{...l&&{currency:l}})}}),null==(o=e.pricing_currency_configs)||o.forEach(e=>{var i,n;const o=e.currency;null==(i=e.billing_period_configs)||i.forEach(e=>{var i;null==(i=e.configs)||i.forEach(i=>{i.id&&t.set(i.id,{currency:o,billingPeriod:e.billing_period})})}),null==(n=e.configs)||n.forEach(e=>{e.id&&t.set(e.id,{currency:o})})})})})}),t}({pricingPlanScheduleInfo:ce.value}),t=ue.value,i=j.value.billing_period,n=new Set;return e.forEach((e,o)=>{t&&e.currency!==t||i&&e.billingPeriod&&(e.billingPeriod.type!==i.type||e.billingPeriod.value!==i.value)||n.add(o)}),n}),de=e.computed({get:()=>{const e=R.form.value.seatsValues??[],t=se.value;return t.size?e.filter(({pricing_item_config_id:e})=>t.has(e)):e},set:e=>{const t=R.form.value.seatsValues??[],i=se.value;if(!i.size)return void(R.form.value.seatsValues=e);const n=t.filter(({pricing_item_config_id:e})=>!i.has(e));R.form.value.seatsValues=n.concat(e)}}),pe=e.computed(()=>{var e,i,n,o,a;return G.value?E({defaultMessage:"{discounted_amount} for {trial_period}, then {subscription_amount}/{billing_period} until canceled, starting {start_date, date, ::MMMMd}.",id:"checkout.agreement.trial",description:"The agreement for the trial period"},{discounted_amount:"0.00"===G.value.tax_summary.total_amount.quantity?E({defaultMessage:"Free",id:"checkout.agreement.trial.free",description:"The free amount for the trial period"}):t.formatAmount(G.value.tax_summary.total_amount),trial_period:V(q.value,{short:!0}),subscription_amount:t.formatAmount((null==(e=F.value)?void 0:e.tax_summary.total_amount)??{quantity:"0.00",currency:"EUR"}),billing_period:V((null==(i=F.value)?void 0:i.billing_period)??{type:"MONTH",value:1},{short:!0,singular:!0,hideValueForExactPeriods:!0}),start_date:new Date(Me.value)}):E({defaultMessage:"{subscription_amount}/{billing_period} until canceled, starting {start_date, date, long}.",id:"checkout.agreement.subscription",description:"The agreement for the subscription"},{subscription_amount:(null==(n=F.value)?void 0:n.tax_summary.total_amount)?t.formatAmount(null==(o=F.value)?void 0:o.tax_summary.total_amount):"",billing_period:V((null==(a=F.value)?void 0:a.billing_period)??{type:"MONTH",value:1},{short:!0,singular:!0,hideValueForExactPeriods:!0}),start_date:new Date(Me.value)})}),me=e.computed(()=>{var e,t,i,n,o,a;if(!F.value)return;const l=(null==(e=j.value)?void 0:e.name)??(null==(o=null==(n=null==(i=null==(t=j.value)?void 0:t.pricing_plan_schedule_infos)?void 0:i.at(-1))?void 0:n.pricing_plan_version.pricing_plan)?void 0:o.name)??"Subscription";return{description:l,managementURL:"https://www.solvimon.com/account/billing",agreement:pe.value,...G.value&&q.value&&{trial:{label:E({defaultMessage:"Trial",id:"checkout.trial.label",description:"The label of the trial"}),amount:G.value.tax_summary.total_amount,startDate:fe.value?new Date(fe.value):void 0,endDate:he.value?new Date(he.value):void 0}},regular:{label:l,amount:F.value.tax_summary.total_amount,startDate:Me.value?new Date(Me.value):void 0,interval:(null==(a=j.value)?void 0:a.billing_period)??{type:"MONTH",value:1}}}}),ge=e=>t.isValidCountryCode(e),ve=e=>{const{country:t,...i}=e;R.updateInitialState({...i,...t&&ge(t)?{country:t}:{}})},ye=e.computed(()=>{var e,t;return!((null==(e=b.configuration)?void 0:e.email)&&(null==(t=b.configuration)?void 0:t.countryCode))}),fe=e.computed(()=>{var e,t,i;const n=null==(t=null==(e=G.value)?void 0:e.periods)?void 0:t[0],o=null==(i=_e.value)?void 0:i.trialStartDate;return(null==n?void 0:n.start_at)?new Date(n.start_at):o}),_e=e.computed(()=>function(e){var t;const i={trialStartDate:void 0,trialEndDate:void 0,subscriptionStartDate:void 0,subscriptionEndDate:void 0};if(!(null==(t=null==e?void 0:e.pricing_plan_schedule_infos)?void 0:t.length))return i;const n=new Date,o=_({type:"TRIAL",pricingPlanScheduleInfos:e.pricing_plan_schedule_infos});if((null==o?void 0:o.start_at)&&(i.trialStartDate=n,o.end_at)){const e=new Date(o.end_at).getTime()-new Date(o.start_at).getTime();i.trialEndDate=new Date(n.getTime()+e)}const a=_({type:"DEFAULT",pricingPlanScheduleInfos:e.pricing_plan_schedule_infos});if((null==a?void 0:a.start_at)&&(i.trialEndDate?i.subscriptionStartDate=i.trialEndDate:i.subscriptionStartDate=n,a.end_at)){const e=new Date(a.end_at).getTime()-new Date(a.start_at).getTime();i.subscriptionEndDate=new Date(n.getTime()+e)}return i}(j.value)),he=e.computed(()=>{var e,t,i;const n=null==(t=null==(e=G.value)?void 0:e.periods)?void 0:t[0],o=null==(i=_e.value)?void 0:i.trialEndDate;return(null==n?void 0:n.end_at)?new Date(n.end_at):o}),Me=e.computed(()=>{var e,t,i;const n=null==(t=null==(e=F.value)?void 0:e.periods)?void 0:t[0],o=null==(i=_e.value)?void 0:i.subscriptionStartDate;return(null==n?void 0:n.start_at)?new Date(n.start_at):o}),Ne=e.computed(()=>!!(R.form.value.seatsValues&&R.form.value.seatsValues.length>0)||(!(!j.value||!function(e){return A(e).some(e=>"EXACTLY_ONE"===e.selection_constraint||"AT_LEAST_ONE"===e.selection_constraint)}(j.value))||!(!j.value||!function(e){const t=e.pricing_plan_schedule_infos.flatMap(e=>{var t;return(null==(t=e.pricing_plan_version.pricing_categories)?void 0:t.flatMap(e=>e.pricings??[]))??[]}),i=A(e);return t.some(e=>"ADDON"===e.product_type)||i.some(e=>"ADDON"===e.object_type)}(j.value)))),Ie=e.ref(null),{applyPromotionCode:ke,removePromotionCode:Ce,isPromotionCodePending:De,promotionCodeErrorMessage:Ae}=function({checkoutForm:t,updateInvoicePreviewOnBillingInformationChange:n,formatErrorMessage:o,onInvalidPromotionCode:a,onApplyError:l}){const r=i.useLogger(),c=e.ref(!1),u=e.ref(null),s=(e,t)=>{u.value=o?o({action:e,error:t}):"apply"===e?"Promotion code could not be applied. Please try again.":"Promotion code could not be removed. Please try again."},d=async({suppressError:e=!1,preserveErrorMessage:i=!1}={})=>{i||(u.value=null),delete t.form.value.promotionCode,c.value=!0;try{await n({})}catch(o){r.capture(o,{code:"PROMOTION_CODE_REMOVE_FAILED",message:"Failed to remove promotion code"}),e||s("remove",o)}finally{c.value=!1}};return{applyPromotionCode:async e=>{const i=null==e?void 0:e.trim();if(i){u.value=null,t.form.value.promotionCode=i,c.value=!0;try{await n({promotionCode:i})}catch(o){r.capture(o,{code:"PROMOTION_CODE_APPLY_FAILED",message:"Failed to apply promotion code"}),s("apply",o),null==l||l(),(e=>function(e){return"object"==typeof e&&null!==e&&"field"in e}(e)&&"promotion_codes"===e.field)(o)&&(null==a||a()),await d({suppressError:!0,preserveErrorMessage:!0})}finally{c.value=!1}}},removePromotionCode:d,isPromotionCodePending:c,promotionCodeErrorMessage:u}}({checkoutForm:R,updateInvoicePreviewOnBillingInformationChange:J,formatErrorMessage:({action:e})=>E("apply"===e?{defaultMessage:"Promotion code could not be applied. Please try again.",id:"checkout.promotion_code.apply_failed",description:"Error message when applying a promotion code in checkout failed"}:{defaultMessage:"Promotion code could not be removed. Please try again.",id:"checkout.promotion_code.remove_failed",description:"Error message when removing a promotion code in checkout failed"}),onInvalidPromotionCode:()=>{Ie.value=null},onApplyError:()=>{Ie.value=null}}),Ee=()=>{T&&p.safeUrlRedirect(T)},we=()=>{var e;Z.value=!0,Ae.value=null,(null==(e=b.configuration)?void 0:e.onPaymentSuccess)?b.configuration.onPaymentSuccess():T&&Ee()},Pe=e=>{j.value&&(j.value={...j.value,billing_period:e},W())};return e.onMounted(()=>{N("ready")}),(i,n)=>k.value?(e.openBlock(),e.createBlock(K,{key:0,class:"sv-checkout sv-root sv-screen sv-checkout--error"})):(e.openBlock(),e.createBlock(e.unref(f.ContentWithAsideLayout),{key:1,class:e.normalizeClass(["sv-checkout sv-root sv-screen",{"sv-checkout--paid":e.unref(Z)}])},{header:e.withCtx(()=>[e.createElementVNode("div",ot,[e.createVNode(v._sfc_main,{class:"min-h-[52px] w-96"},{default:e.withCtx(()=>{var t,i,n;return[e.unref(F)&&e.unref(j)&&Me.value?(e.openBlock(),e.createBlock(Y,{key:0,class:"sv-checkout__title","trial-start-date":fe.value,"trial-period":e.unref(q),"subscription-start-date":Me.value,"subscription-name":(null==(t=e.unref(j))?void 0:t.name)??"",amount:null==(i=e.unref(F))?void 0:i.invoice_amount_including_tax,"billing-period":null==(n=e.unref(j))?void 0:n.billing_period,"country-code":e.unref(R).form.value.country},null,8,["trial-start-date","trial-period","subscription-start-date","subscription-name","amount","billing-period","country-code"])):e.createCommentVNode("",!0)]}),_:1})])]),content:e.withCtx(()=>{var i,o,a;return[e.unref(j)&&e.unref(B)?(e.openBlock(),e.createBlock(oe,{key:0,class:"sv-checkout__mobile-order-summary",subscription:e.unref(j),invoice:e.unref(F),"invoice-preview-by-billing-period":e.unref($),"trial-invoice":e.unref(G),"enabled-pricing-ids":re.value,"trial-period":e.unref(q),avatar:null==(i=I.value)?void 0:i.avatar,"is-paid":e.unref(Z),"is-usage-based":ne.value,"is-preview-and-payment-methods-pending":e.unref(z)||e.unref(O),"country-code":e.unref(R).form.value.country,collapsible:"collapsed",variant:"products-inline",onBillingPeriodChange:Pe},null,8,["subscription","invoice","invoice-preview-by-billing-period","trial-invoice","enabled-pricing-ids","trial-period","avatar","is-paid","is-usage-based","is-preview-and-payment-methods-pending","country-code"])):e.createCommentVNode("",!0),Ne.value&&e.unref(j)?(e.openBlock(),e.createBlock(Ge,{key:1,"seats-values":de.value,"onUpdate:seatsValues":n[0]||(n[0]=e=>de.value=e),"enabled-pricing-ids":re.value,"onUpdate:enabledPricingIds":n[1]||(n[1]=e=>re.value=e),class:"sv-checkout__plan-customization",subscription:e.unref(j),"initial-seats-values":null==(o=e.unref(R).initialState)?void 0:o.value.seatsValues,"billing-period":e.unref(j).billing_period,currency:ue.value},null,8,["seats-values","enabled-pricing-ids","subscription","initial-seats-values","billing-period","currency"])):e.createCommentVNode("",!0),!e.unref(Z)&&e.unref(R).form.value.country&&e.unref(X)&&me.value?(e.openBlock(),e.createBlock(be,{key:2,class:"sv-checkout__express-payment-methods",amount:e.unref(X),"country-code":e.unref(R).form.value.country,locale:e.unref(w),"payment-methods-options-response":e.unref(L)??[],"billing-information":me.value,"on-billing-information-change":e.unref(J),onUpdateBillingInformation:ve},null,8,["amount","country-code","locale","payment-methods-options-response","billing-information","on-billing-information-change"])):e.createCommentVNode("",!0),e.unref(Z)?(e.openBlock(),e.createBlock(H,{key:3,class:"sv-checkout__completed-payment",onContinueToMerchant:Ee})):e.createCommentVNode("",!0),e.unref(Z)?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(U,{key:4,modelValue:e.unref(R).form.value,"onUpdate:modelValue":n[2]||(n[2]=t=>e.unref(R).form.value=t),class:"sv-checkout__customer-form",validation:e.unref(R).validation,"read-only-email":null==(a=b.configuration)?void 0:a.email,"show-customer-info-on-top":ye.value||e.unref(Z),"is-billing-information-mandatory":ae.value,"get-is-field-required":e.unref(R).getIsFieldRequired,"read-only":e.unref(Z)},null,8,["modelValue","validation","read-only-email","show-customer-info-on-top","is-billing-information-mandatory","get-is-field-required","read-only"])),e.unref(Z)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",at,[e.createVNode(v._sfc_main,{variant:"section",class:"min-h-[130px]"},{default:e.withCtx(()=>[!e.unref(z)||e.unref(z)&&e.unref(L).length>0?(e.openBlock(),e.createElementBlock("div",lt,[e.createVNode(e.unref(t._sfc_main),{variant:"heading-3",tag:"h2",class:"sv-checkout__payment-methods-title mb-2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(E)({defaultMessage:"Payment method",id:"checkout.payment_method_block.title",description:"The title of the payment method block in the checkout form"})),1)]),_:1}),e.unref(R).form.value.country?0===e.unref(L).length?(e.openBlock(),e.createBlock(le,{key:1,class:"sv-checkout__payment-methods-empty",icon:"credit_card_off"},{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(E)({defaultMessage:"No payment methods available",id:"checkout.payment_method_block.no_payment_methods_available_title",description:"The title shown when there are no available payment methods"})),1)]),message:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(E)({defaultMessage:"There are no available payment methods. Please contact support for more information.",id:"checkout.payment_method_block.no_payment_methods_available_message",description:"The message shown when there are no available payment methods"})),1)]),_:1})):e.unref(X)&&e.unref(R).form.value.country?(e.openBlock(),e.createElementBlock("div",rt,[e.createVNode(e.unref(h),{ref_key:"paymentIntegrationFormRef",ref:C,"country-code":e.unref(R).form.value.country,context:e.unref(Q),amount:e.unref(X),variant:"AUTHORIZE","payment-method-options":e.unref(L)??[],"validate-on-submit":te,"force-store-payment-method":"",onPaymentSuccess:we,onReady:n[3]||(n[3]=e=>N("ready"))},null,8,["country-code","context","amount","payment-method-options"])])):e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(le,{key:0,class:"sv-checkout__payment-methods-empty",icon:"captive_portal"},{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(E)({defaultMessage:"Select your billing country",id:"checkout.payment_method_block.no_country_selected_title",description:"The title shown when no country is selected"})),1)]),message:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(E)({defaultMessage:"Payment methods will be shown after you select the billing country.",id:"checkout.payment_method_block.no_country_selected_message",description:"The message shown when no country is selected"})),1)]),_:1}))])):e.createCommentVNode("",!0)]),_:1})]))]}),aside:e.withCtx(()=>[e.createElementVNode("div",ct,[e.createVNode(v._sfc_main,{variant:"section",class:"min-h-[220px]"},{default:e.withCtx(()=>{var t;return[e.unref(j)&&e.unref(F)?(e.openBlock(),e.createBlock(oe,{key:0,subscription:e.unref(j),invoice:e.unref(F),"invoice-preview-by-billing-period":e.unref($),"trial-invoice":e.unref(G),"enabled-pricing-ids":re.value,"trial-period":e.unref(q),"country-code":e.unref(R).form.value.country,avatar:null==(t=I.value)?void 0:t.avatar,"is-paid":e.unref(Z),"is-usage-based":ne.value,"is-preview-and-payment-methods-pending":e.unref(z)||e.unref(O),onBillingPeriodChange:Pe},null,8,["subscription","invoice","invoice-preview-by-billing-period","trial-invoice","enabled-pricing-ids","trial-period","country-code","avatar","is-paid","is-usage-based","is-preview-and-payment-methods-pending"])):e.createCommentVNode("",!0)]}),_:1})]),e.unref(Z)?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(Je,{key:0,class:"sv-checkout__promotion-code","promotion-code":Ie.value,"onUpdate:appliedCode":n[4]||(n[4]=e=>Ie.value=e),onRemove:e.unref(Ce),onApply:e.unref(ke)},null,8,["promotion-code","onRemove","onApply"])),e.unref(Ae)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$15),{key:1,class:"sv-checkout__promotion-error mt-2",title:e.unref(Ae)},null,8,["title"])):e.createCommentVNode("",!0),e.createElementVNode("div",ut,[e.unref(Z)?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(v._sfc_main,{key:0,class:"sv-checkout__submit-skeleton min-h-[44px]"},{default:e.withCtx(()=>[e.unref(F)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,type:"button",size:"lg",class:"sv-action sv-action--primary sv-action--full-width sv-checkout__submit w-full",disabled:e.unref(De)||0===e.unref(L).length,onClick:ee},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(ie.value?e.unref(E)({defaultMessage:"Start trial",id:"checkout.pay_and_subscribe_button_trial.label",description:"The label of the start trial button in the checkout form"}):e.unref(E)({defaultMessage:"Pay and subscribe",id:"checkout.pay_and_subscribe_button.label",description:"The label of the pay and subscribe button in the checkout form"})),1)]),_:1},8,["disabled"])):e.createCommentVNode("",!0)]),_:1})),e.createVNode(nt,{"payment-method-options":e.unref(L)},null,8,["payment-method-options"])])]),_:1},8,["class"]))}}),dt=e.defineComponent({__name:"Checkout.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},emits:["error","ready"],setup(n,{emit:o}){var a,l;const r=n,c=o,u=i.useLogger(),s=(e=>{if(e)return t.isValidCountryCode(e)?e:void u.error("INVALID_COUNTRY_CODE",`invalid country code provided: "${e}"`)})(null==(a=r.configuration)?void 0:a.countryCode),d=(e=>{if(e)return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?e:void u.error("INVALID_EMAIL",`invalid email provided: "${e}"`)})(null==(l=r.configuration)?void 0:l.email);return(t,o)=>{var a,l,r,u;return e.openBlock(),e.createBlock(i._sfc_main,{"custom-element-name":e.unref(mt),environment:n.environment,locale:n.locale,"portal-object":n.portalObject,"allowed-portal-types":["INIT_PRICING_PLAN_SUBSCRIPTION"],"primary-color":null==(l=null==(a=n.branding)?void 0:a.colors)?void 0:l.primary,"secondary-color":null==(u=null==(r=n.branding)?void 0:r.colors)?void 0:u.secondary,"experimental-features":n.experimentalFeatures,"log-level":n.logLevel,"on-log":n.onLog,"css-overrides":n.cssOverrides,onError:o[1]||(o[1]=e=>t.$emit("error",e))},{default:e.withCtx(()=>{var i,a,l;return[e.createVNode(st,{configuration:{avatar:null==(a=null==(i=n.branding)?void 0:i.emblem)?void 0:a.public_url,email:e.unref(d),countryCode:e.unref(s),enabledPricingIds:null==(l=n.configuration)?void 0:l.enabledPricingIds},onReady:o[0]||(o[0]=e=>c("ready"))},e.createSlots({_:2},[t.$slots["terms-and-conditions"]?{name:"terms-and-conditions",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"terms-and-conditions")]),key:"0"}:void 0]),1032,["configuration"])]}),_:3},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log","css-overrides"])}}}),pt=i.defineCustomElement(dt),mt=i.getComponentName("checkout");exports.COMPONENT_NAME=mt,exports.SolvimonCheckout=pt,exports.defineSolvimonCheckout=()=>{customElements.get(mt)||customElements.define(mt,pt)};
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../vendor-ui-5pJF5KBP.js"),i=require("../../component-BOqPDAVk.js"),n=require("../../subscriptions-jelITJcX.js"),o=require("../../ApiStatus-oqvUEWJx.js"),a=require("../../invoices-DzkA1jDc.js"),l=require("../../index-DRdBmZ2-.js"),r=require("../../useWatchDebounced-C_YxgoQ6.js"),c=require("../../paymentMethods-C_sdTkSF.js"),u=require("../../useService-Bb9r_sOQ.js"),s=require("../../usePortal-CxX4nrE4.js"),d=require("../../customer-hDxW1Dbp.js"),p=require("../../adyen-R6aSZ0Yf.js"),m=require("../../PricingGroupContent.vue_vue_type_script_setup_true_lang-Br3bEUlP.js"),g=require("../../useViewport-CKRY1CKR.js"),v=require("../../Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),y=require("../../payments-DkHhTHto.js"),f=require("../../ContentWithAsideLayout-B5B8Kwaw.js");function _({pricingPlanScheduleInfos:e,type:t}){return e.find(e=>e.pricing_plan_schedule.type===t)}function h({enabledPricings:e,seatsValues:t,pricingPlanScheduleInfos:i,pricingCurrency:n,billingPeriod:o}){const a=_({pricingPlanScheduleInfos:i,type:"DEFAULT"});if(a&&(e||t))return[{pricing_plan_schedule_id:a.id,enabled_pricings:e,seats_values:null==t?void 0:t.map(({pricing_item_config_id:e,number:t})=>({pricing_item_config_id:e,number:t})),...n&&{pricing_currency:n},...o&&{billing_period:o}}]}const b={AD:"EUR",AE:"AED",AF:"AFN",AG:"XCD",AI:"XCD",AL:"ALL",AM:"AMD",AO:"AOA",AR:"ARS",AS:"USD",AT:"EUR",AU:"AUD",AW:"AWG",AX:"EUR",AZ:"AZN",BA:"BAM",BB:"BBD",BD:"BDT",BE:"EUR",BF:"XOF",BG:"BGN",BH:"BHD",BI:"BIF",BJ:"XOF",BL:"EUR",BM:"BMD",BN:"BND",BO:"BOB",BQ:"USD",BR:"BRL",BS:"BSD",BT:"BTN",BV:"NOK",BW:"BWP",BY:"BYN",BZ:"BZD",CA:"CAD",CC:"AUD",CD:"CDF",CF:"XAF",CG:"XAF",CH:"CHF",CI:"XOF",CK:"NZD",CL:"CLP",CM:"XAF",CN:"CNY",CO:"COP",CR:"CRC",CU:"CUP",CV:"CVE",CW:"ANG",CX:"AUD",CY:"EUR",CZ:"CZK",DE:"EUR",DJ:"DJF",DK:"DKK",DM:"XCD",DO:"DOP",DZ:"DZD",EC:"USD",EE:"EUR",EG:"EGP",EH:"MAD",ER:"ERN",ES:"EUR",ET:"ETB",FI:"EUR",FJ:"FJD",FK:"FKP",FM:"USD",FO:"DKK",FR:"EUR",GA:"XAF",GB:"GBP",GD:"XCD",GE:"GEL",GF:"EUR",GG:"GBP",GH:"GHS",GI:"GIP",GL:"DKK",GM:"GMD",GN:"GNF",GP:"EUR",GQ:"XAF",GR:"EUR",GS:"GBP",GT:"GTQ",GU:"USD",GW:"XOF",GY:"GYD",HK:"HKD",HM:"AUD",HN:"HNL",HR:"EUR",HT:"HTG",HU:"HUF",ID:"IDR",IE:"EUR",IL:"ILS",IM:"GBP",IN:"INR",IO:"USD",IQ:"IQD",IR:"IRR",IS:"ISK",IT:"EUR",JE:"GBP",JM:"JMD",JO:"JOD",JP:"JPY",KE:"KES",KG:"KGS",KH:"KHR",KI:"AUD",KM:"KMF",KN:"XCD",KP:"KPW",KR:"KRW",KW:"KWD",KY:"KYD",KZ:"KZT",LA:"LAK",LB:"LBP",LC:"XCD",LI:"CHF",LK:"LKR",LR:"LRD",LS:"LSL",LT:"EUR",LU:"EUR",LV:"EUR",LY:"LYD",MA:"MAD",MC:"EUR",MD:"MDL",ME:"EUR",MF:"EUR",MG:"MGA",MH:"USD",MK:"MKD",ML:"XOF",MM:"MMK",MN:"MNT",MO:"MOP",MP:"USD",MQ:"EUR",MR:"MRU",MS:"XCD",MT:"EUR",MU:"MUR",MV:"MVR",MW:"MWK",MX:"MXN",MY:"MYR",MZ:"MZN",NA:"NAD",NC:"XPF",NE:"XOF",NF:"AUD",NG:"NGN",NI:"NIO",NL:"EUR",NO:"NOK",NP:"NPR",NR:"AUD",NU:"NZD",NZ:"NZD",OM:"OMR",PA:"PAB",PE:"PEN",PF:"XPF",PG:"PGK",PH:"PHP",PK:"PKR",PL:"PLN",PM:"EUR",PN:"NZD",PR:"USD",PS:"ILS",PT:"EUR",PW:"USD",PY:"PYG",QA:"QAR",RE:"EUR",RO:"RON",RS:"RSD",RU:"RUB",RW:"RWF",SA:"SAR",SB:"SBD",SC:"SCR",SD:"SDG",SE:"SEK",SG:"SGD",SH:"SHP",SI:"EUR",SJ:"NOK",SK:"EUR",SL:"SLE",SM:"EUR",SN:"XOF",SO:"SOS",SR:"SRD",SS:"SSP",ST:"STN",SV:"USD",SX:"ANG",SY:"SYP",SZ:"SZL",TC:"USD",TD:"XAF",TF:"EUR",TG:"XOF",TH:"THB",TJ:"TJS",TK:"NZD",TL:"USD",TM:"TMT",TN:"TND",TO:"TOP",TR:"TRY",TT:"TTD",TV:"AUD",TW:"TWD",TZ:"TZS",UA:"UAH",UG:"UGX",US:"USD",UY:"UYU",UZ:"UZS",VA:"EUR",VC:"XCD",VE:"VES",VG:"USD",VI:"USD",VN:"VND",VU:"VUV",WF:"XPF",WS:"WST",YE:"YER",YT:"EUR",ZA:"ZAR",ZM:"ZMW",ZW:"ZWL"},M=({country:e,pricingCurrencySettings:t,fallbackCurrency:i})=>{const n=(e=>{if(e)return b[e]})(e),o=(null==t?void 0:t.pricing_currencies)??[];return n&&o.includes(n)?n:(null==t?void 0:t.default_pricing_currency)??i??n},N=["email","country"],I={US:["addressLine1","postalCode"],CA:["state"]};function k({initialState:i,onRequiredFieldChange:n}){const o=e.ref(C(i)),a=e.ref(C(i)),c=e.computed(()=>{return(e=o.value.country)&&I[e]?[...I[e],...N]:N;var e}),u=e=>c.value.includes(e),s=t.useValidation({email:{required:l.required,email:l.email},country:{required:l.required},state:{required:l.requiredIf(()=>u("state"))},addressLine1:{required:l.requiredIf(()=>u("addressLine1"))},postalCode:{required:l.requiredIf(()=>u("postalCode"))},companyLegalName:l.requiredIf("ORGANIZATION"===o.value.type),companyVatNumber:{taxId:t.taxId}},o),d=e=>{e||fetch("https://api.country.is/").then(e=>e.json()).then(({country:e})=>{o.value.country=e})};return e.onMounted(async()=>{await d(null==i?void 0:i.country)}),r.useWatchDebounced(()=>JSON.parse(JSON.stringify(o.value)),(e,i)=>{const o=t.objectDiff({from:i,to:e}),a=Object.keys(o).find(D);a&&(["type","companyVatNumber"].includes(a)?n(e):"seatsValues"!==a&&"enabledPricingIds"!==a?"email"!==a&&u(a)&&n(e):n(e))},{debounce:200}),{form:o,validation:s,getIsFieldRequired:u,updateInitialState:e=>{const t=C({...o.value,...e});o.value=t,a.value=structuredClone(t)},initialState:a}}const C=(e={})=>({email:void 0,country:void 0,type:"INDIVIDUAL",companyLegalName:void 0,firstName:void 0,infix:void 0,lastName:void 0,addressLine1:void 0,addressLine2:void 0,postalCode:void 0,city:void 0,state:void 0,companyVatNumber:void 0,seatsValues:void 0,enabledPricingIds:void 0,...e});function D(e){return e in C()}function A(e){return e.pricing_plan_schedule_infos.flatMap(e=>{var t;return(null==(t=e.pricing_plan_version.pricing_categories)?void 0:t.flatMap(e=>e.pricing_groups??[]))??[]})}function E(e){var i,n;return t.isEmpty(e.name)?null==(n=null==(i=e.products)?void 0:i[0])?void 0:n.name:e.name}function P(e,t=void 0){const i=t??[],n=A(e);for(const o of n)if(["EXACTLY_ONE","AT_LEAST_ONE"].includes(o.selection_constraint)){const e=o.pricings.map(e=>e.id);if(null==t?void 0:t.some(t=>e.includes(t)))continue;i.push(o.pricings[0].id)}return i}function w({initialCountry:l,initialEmail:r,subscriptionId:s,enabledPricingIds:d}){const p=e.ref(!1),m=e.ref(),{getSubscription:g}=n.createSubscriptionsService(),v=(()=>{const{getInvoicePreview:n}=a.createInvoicesService(),l=i.useLogger(),r=e.ref(),c=e.ref(),u=e.ref(),s=e.ref({}),d=e.ref(o.ApiStatus.Initial),p=e.ref({}),m=e.ref(),g=e=>`${e.type}:${e.value}`;return{loadInvoicePreview:async({subscription:e,subscriptionStartAt:i,checkoutForm:a,enabledPricingIds:v,promotionCode:y})=>{var f,b,N,I,k;const C={...a.addressLine1&&{line1:a.addressLine1},...a.addressLine2&&{line2:a.addressLine2},...a.city&&{city:a.city},...a.state&&{state:a.state},...a.country?{country:a.country||"NL"}:{country:"NL"},...a.postalCode&&{postal_code:a.postalCode}};d.value=o.ApiStatus.Loading;const D=_({pricingPlanScheduleInfos:e.pricing_plan_schedule_infos,type:"DEFAULT"}),A=null==(f=null==D?void 0:D.pricing_plan_version)?void 0:f.pricing_currency_settings,E=((null==(b=null==A?void 0:A.pricing_currencies)?void 0:b.length)??0)>1,P=(null==(I=null==(N=null==D?void 0:D.pricing_plan_version)?void 0:N.billing_period_settings)?void 0:I.billing_periods)??[],w=P.length>1,V=P.length>0?P.map(({period:e})=>e):e.billing_period?[e.billing_period]:[],x=M({country:a.country,pricingCurrencySettings:A,fallbackCurrency:e.billing_currency});if(!V.length)return void(d.value=o.ApiStatus.Done);const B=e.billing_period?g(e.billing_period):g(V[0]),S=V.map(async o=>{var l;const r=g(o),c=h({enabledPricings:null==v?void 0:v.map(e=>({pricing_id:e})),seatsValues:a.seatsValues,pricingPlanScheduleInfos:e.pricing_plan_schedule_infos,pricingCurrency:E?x:void 0,billingPeriod:w?o:void 0})??[];if(y){const t=null==(l=e.pricing_plan_schedule_infos.find(({pricing_plan_schedule:e})=>"DEFAULT"===e.type))?void 0:l.id;if(t){const e=c.find(({pricing_plan_schedule_id:e})=>e===t);e?e.promotion_codes=[y]:c.push({pricing_plan_schedule_id:t,promotion_codes:[y]})}}const u={pricingPlanSubscriptionId:e.id,startAt:i,customizations:c,customer:{type:a.type||"INDIVIDUAL",..."INDIVIDUAL"===a.type&&{individual:{residential_address:C}},..."ORGANIZATION"===a.type&&{organization:{legal_name:a.companyLegalName||"preview",registered_address:C,...a.companyVatNumber&&{tax_id:t.taxId.$validator(a.companyVatNumber,{},{})?a.companyVatNumber:void 0}}}}},s=p.value[r];return s&&t.isEqual(u,s)?{periodKey:r,response:void 0}:(p.value={...p.value,[r]:u},{periodKey:r,response:await n(u)})});try{const i={...s.value},n=await Promise.all(S),o=e.pricing_plan_schedule_infos.find(({pricing_plan_schedule:e})=>"TRIAL"===e.type),a=null==(k=e.pricing_plan_schedule_infos.find(({pricing_plan_schedule:e})=>"DEFAULT"===e.type))?void 0:k.id;n.forEach(({periodKey:e,response:n})=>{var l;if(!n)return;m.value=null==(l=n.invoice_infos.at(-1))?void 0:l.pricing_plan_schedule_id,o&&(c.value=n.first_invoice,o.start_at&&o.end_at&&(r.value=t.convertDateRangeToTimePeriod(new Date(o.start_at),new Date(o.end_at))));const u=n.invoice_infos.find(({pricing_plan_schedule_id:e})=>e===a),s=null==u?void 0:u.invoices[0];s&&(i[e]=s)}),s.value=i,u.value=i[B]}catch(T){throw d.value=o.ApiStatus.Failed,l.error("INVOICE_PREVIEW_FAILED","Failed to load invoice preview",{},T),T}finally{d.value=o.ApiStatus.Done}},invoicePreview:u,invoicePreviewByBillingPeriod:s,trialInvoicePreview:c,trialPeriod:r,lastPreviewScheduleId:m,isPending:e.computed(()=>d.value===o.ApiStatus.Loading)}})(),y=e.computed(()=>m.value&&C.form.value.country&&A.value),{paymentMethodOptions:f,loadPaymentMethodOptions:b,isPending:N}=(()=>{const i=e.ref(),{getPaymentMethodOptions:n}=c.createPaymentMethodsService(),{data:o,execute:a,isPending:l}=u.useService({initialValue:[],service:n});return{loadPaymentMethodOptions:async({subscriptionId:e,country:n,amount:o})=>{const l={subscriptionId:e,country:n,amount:o};t.isEqual(l,i.value)||(i.value=l,await a(l))},paymentMethodOptions:o,isPending:l}})(),I=()=>{const e={subscription:m.value,checkoutForm:C.form.value,enabledPricingIds:d,promotionCode:C.form.value.promotionCode};return C.form.value.enabledPricingIds&&(e.enabledPricingIds=C.form.value.enabledPricingIds),v.loadInvoicePreview(e)},C=k({initialState:{country:l,email:r},onRequiredFieldChange:()=>{m.value&&I().catch(()=>{})}}),D=e.computed(()=>{var e,i,n,o,a,l,r,c,u;const d=C.form.value.firstName||C.form.value.infix||C.form.value.lastName?{...C.form.value.firstName?{first_name:C.form.value.firstName}:{},...C.form.value.infix?{infix:C.form.value.infix}:{},...C.form.value.lastName?{last_name:C.form.value.lastName}:{}}:{},p={...C.form.value.addressLine1&&{line1:C.form.value.addressLine1},...C.form.value.addressLine2&&{line2:C.form.value.addressLine2},...C.form.value.city&&{city:C.form.value.city},...C.form.value.postalCode&&{postal_code:C.form.value.postalCode},...C.form.value.state&&{state:C.form.value.state},country:C.form.value.country??""},g=_({pricingPlanScheduleInfos:(null==(e=m.value)?void 0:e.pricing_plan_schedule_infos)??[],type:"DEFAULT"}),v=null==(i=null==g?void 0:g.pricing_plan_version)?void 0:i.pricing_currency_settings,y=((null==(n=null==v?void 0:v.pricing_currencies)?void 0:n.length)??0)>1,f=((null==(a=null==(o=null==g?void 0:g.pricing_plan_version)?void 0:o.billing_period_settings)?void 0:a.billing_periods)??[]).length>1,b=h({enabledPricings:null==(l=C.form.value.enabledPricingIds)?void 0:l.map(e=>({pricing_id:e})),seatsValues:C.form.value.seatsValues,pricingPlanScheduleInfos:(null==(r=m.value)?void 0:r.pricing_plan_schedule_infos)??[],pricingCurrency:y?null==(c=m.value)?void 0:c.billing_currency:void 0,billingPeriod:f?null==(u=m.value)?void 0:u.billing_period:void 0}),M=C.form.value.promotionCode,N=M&&m.value?(()=>{var e,t,i;const n=b?[...b]:[],o=(null==(e=n[0])?void 0:e.pricing_plan_schedule_id)??(null==(i=_({pricingPlanScheduleInfos:(null==(t=m.value)?void 0:t.pricing_plan_schedule_infos)??[],type:"DEFAULT"}))?void 0:i.id);if(!o)return b;const a=n.find(({pricing_plan_schedule_id:e})=>e===o);if(a)a.promotion_codes=[M];else{const e=null==b?void 0:b[0];n.push({pricing_plan_schedule_id:o,...(null==e?void 0:e.enabled_pricings)&&{enabled_pricings:e.enabled_pricings},...(null==e?void 0:e.seats_values)&&{seats_values:e.seats_values},promotion_codes:[M]})}return n})():b;return{type:"INIT_PRICING_PLAN_SUBSCRIPTION",init_pricing_plan_subscription:{template_pricing_plan_subscription_id:s,...N&&{pricing_plan_schedule_customizations:N},customer_details:{email:C.form.value.email??"",type:C.form.value.type,..."INDIVIDUAL"===C.form.value.type?{individual:{residential_address:p,...d?{name:d}:{}}}:{organization:{registered_address:p,legal_name:C.form.value.companyLegalName??"",...C.form.value.companyVatNumber&&t.taxId.$validator(C.form.value.companyVatNumber,{},{})?{tax_ids:[{id:C.form.value.companyVatNumber,type:"GENERIC_TAX_ID"}]}:{}}}}}}}),A=e.computed(()=>{var e,t;return(null==(e=v.trialInvoicePreview.value)?void 0:e.invoice_amount_including_tax)??(null==(t=v.invoicePreview.value)?void 0:t.invoice_amount_including_tax)});return e.watch([()=>C.form.value.country,A],([e,t])=>{m.value&&e&&t&&b({subscriptionId:m.value.id,country:e,amount:t})}),e.onMounted(async()=>{await(async()=>{var e,t,i,n,o,a;const l=await g({id:s,expanded:!0}),r=_({pricingPlanScheduleInfos:l.pricing_plan_schedule_infos,type:"DEFAULT"}),c=null==(n=null==(i=null==(t=null==(e=null==r?void 0:r.pricing_plan_version)?void 0:e.billing_period_settings)?void 0:t.billing_periods)?void 0:i[0])?void 0:n.period;m.value={...l,billing_period:c??l.billing_period},C.updateInitialState({...C.form.value,enabledPricingIds:P(l,d),...(null==(o=null==r?void 0:r.pricing_plan_schedule)?void 0:o.seats_values)?{seatsValues:null==(a=null==r?void 0:r.pricing_plan_schedule)?void 0:a.seats_values.map(({pricing_item_config_id:e,number:t})=>({pricing_item_config_id:e,number:t}))}:{}})})();try{await I()}catch{}}),e.watch(y,e=>{e&&b({subscriptionId:m.value.id,country:C.form.value.country,amount:A.value})},{once:!0}),{invoicePreview:v.invoicePreview,invoicePreviewByBillingPeriod:v.invoicePreviewByBillingPeriod,trialInvoicePreview:v.trialInvoicePreview,trialPeriod:v.trialPeriod,loadInvoicePreview:I,updateInvoicePreviewOnBillingInformationChange:async e=>{const t=e.promotionCode??C.form.value.promotionCode,i=e.enabledPricingIds??C.form.value.enabledPricingIds;return await v.loadInvoicePreview({subscription:m.value,checkoutForm:{...C.form.value,...e},enabledPricingIds:i,promotionCode:t}),{trialInvoicePreview:v.trialInvoicePreview.value,invoicePreview:v.invoicePreview.value}},lastPreviewScheduleId:v.lastPreviewScheduleId,paymentMethodOptions:f,isPaymentMethodsPending:N,isInvoicePreviewPending:v.isPending,subscription:m,checkoutForm:C,authorizationContext:D,isPaid:p,amount:A}}const V={class:"flex items-center gap-2"},x=e.defineComponent({__name:"TaxIDCheckNotice",props:{taxIdValidationResult:{type:Object}},setup(i){const n=i,{formatMessage:o}=t.useIntl(),a=e.computed(()=>"VALID"===n.taxIdValidationResult.valid),l=e.computed(()=>a.value?o({defaultMessage:"VAT number is valid.",id:"tax_check.valid_vat_number",description:"The message shown when the VAT number is valid"}):o({defaultMessage:"VAT number is invalid.",id:"tax_check.invalid_vat_number",description:"The message shown when the VAT number is invalid"}));return(i,n)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$25),{type:a.value?"success":"danger",icon:!1},{default:e.withCtx(()=>[e.createElementVNode("div",V,[e.createVNode(e.unref(t._sfc_main),{variant:"body-xs"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value),1)]),_:1})])]),_:1},8,["type"]))}});const B={class:"grid grid-cols-1 gap-1"},S={class:"grid grid-cols-1 gap-2"},T={key:0},L={class:"mt-2 flex flex-col gap-3"},j={class:"grid grid-cols-3 gap-2"},z={class:"flex grow flex-col"},O={key:0},R={class:"mt-4 grid grid-cols-1 gap-3"},U=e.defineComponent({__name:"CheckoutForm",props:e.mergeModels({validation:{type:null},initialState:{type:Object},readOnlyEmail:{type:String},showCustomerInfoOnTop:{type:Boolean},isBillingInformationMandatory:{type:Boolean},getIsFieldRequired:{type:Function},readOnly:{type:Boolean}},{modelValue:{required:!0},modelModifiers:{}}),emits:e.mergeModels(["submit"],["update:modelValue"]),setup(i){const n=i,o=e.ref(!1),a=e.useModel(i,"modelValue"),l=e.computed({get:()=>"ORGANIZATION"===a.value.type,set:e=>{a.value.type=e?"ORGANIZATION":"INDIVIDUAL"}}),r=e.computed(()=>"ORGANIZATION"===a.value.type),c=e.computed({get:()=>a.value.country,set:e=>{a.value.country=e&&t.isValidCountryCode(e)?e:void 0}}),u=e.computed(()=>"US"!==a.value.country),{isTaxIDCheckEnabled:s,isTaxIDCheckPending:p,taxIdValidationData:m,runTaxIDCheck:g}=function(i){const{checkTaxID:n}=d.createCustomerService(),o=e.ref(void 0),a=e.computed(()=>{var e;return(null==(e=i.value.companyVatNumber)?void 0:e.trim())??""}),l=e.computed(()=>i.value.companyLegalName??""),r=e.computed(()=>i.value.country),c=e.ref(!1),u=e.computed(()=>t.isEUCountry(r.value??"")),s=e.computed(()=>!!(a.value&&l.value&&r.value)),p=e.computed(()=>u.value&&a.value);return{runTaxIDCheck:async function(){var e;if(s.value&&u.value&&r.value){c.value=!0;try{const t=await n({type:"ORGANIZATION",organization:{legal_name:l.value,tax_ids:[{id:a.value,type:"GENERIC_TAX_ID"}],registered_address:{country:r.value}}});(null==(e=null==t?void 0:t.data)?void 0:e.length)?o.value=t.data[0]:o.value=void 0}finally{c.value=!1}}},taxIdValidationData:o,isTaxIDCheckPending:c,isTaxIDCheckEnabled:s,showViesCheckNotice:p,isSelectedCountryEU:u}}(a),{$t:v}=t.useIntl(),y=e=>n.getIsFieldRequired(e)?"":" "+v({defaultMessage:"(optional)",id:"checkout.optional_suffix.label",description:"The suffix for optional fields in the checkout form"}),f=e.computed(()=>a.value.country?t.getCountryNameByCode(a.value.country):void 0);return(n,d)=>(e.openBlock(),e.createElementBlock("form",{id:"checkout-form",onSubmit:d[12]||(d[12]=e.withModifiers(e=>n.$emit("submit",a.value),["prevent"]))},[e.createElementVNode("div",B,[e.createVNode(e.unref(t._sfc_main$1),{title:e.unref(v)({defaultMessage:"Customer information",id:"checkout.contact_information_block.title",description:"The title of the contact information block in the checkout form"})},{default:e.withCtx(()=>[e.createElementVNode("div",S,[i.readOnly?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(t._sfc_main),{variant:"body",tag:"span",weight:"semibold","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(a.value.email),1)]),_:1}),e.createVNode(e.unref(t._sfc_main),{variant:"body-sm",tag:"span",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value),1)]),_:1})],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(e.unref(t._sfc_main$20),{modelValue:a.value.email,"onUpdate:modelValue":d[0]||(d[0]=e=>a.value.email=e),required:"",type:"email",name:"email",disabled:!!i.readOnlyEmail,label:e.unref(v)({defaultMessage:"Email address",id:"checkout.email_address.label",description:"The email address of the customer in the checkout form"}),placeholder:e.unref(v)({defaultMessage:"Email address...",id:"checkout.email_address.placeholder",description:"The email address of the customer in the checkout form"})+y("email"),error:i.validation.value.email.$errors},null,8,["modelValue","disabled","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$21),{"single-model-value":c.value,"onUpdate:singleModelValue":d[3]||(d[3]=e=>c.value=e),required:"",name:"country",label:e.unref(v)({defaultMessage:"Billing country",id:"checkout.country.label",description:"The country of the customer in the checkout form"})+y("country"),error:i.validation.value.country.$errors},{"label-suffix":e.withCtx(()=>[o.value||i.isBillingInformationMandatory?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,size:"xs",variant:"ghost","icon-prefix":"add",class:"py-0.5",onClick:d[1]||(d[1]=e=>o.value=!0)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"More billing details",description:"Label of the button in the checkout that lets you fill out all billing details",id:"checkout.billing_details.add_billing_details_button.label"})),1)]),_:1})),o.value&&!i.isBillingInformationMandatory?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:1,size:"sm",variant:"ghost","icon-prefix":"close",class:"py-0.5",onClick:d[2]||(d[2]=e=>o.value=!1)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"Remove billing details",id:"checkout.billing_details.remove_billing_details_button.label",description:"Label of the button in the checkout that lets you remove the billing details"})),1)]),_:1})):e.createCommentVNode("",!0)]),_:1},8,["single-model-value","label","error"])],64))]),e.createVNode(e.unref(t._sfc_main$26),null,{default:e.withCtx(()=>[o.value||i.isBillingInformationMandatory?(e.openBlock(),e.createElementBlock("div",T,[e.createElementVNode("div",L,[e.createVNode(e.unref(t._sfc_main$20),{modelValue:a.value.addressLine1,"onUpdate:modelValue":d[4]||(d[4]=e=>a.value.addressLine1=e),name:"address_line_1",label:e.unref(v)({defaultMessage:"Billing address",id:"checkout.address.title",description:"Address line 1 of the customer address in the checkout form"}),placeholder:e.unref(v)({defaultMessage:"Address line 1...",id:"checkout.address.line1.placeholder",description:"Address line 1 of the customer address in the checkout form"})+y("addressLine1"),required:"",error:i.validation.value.addressLine1.$errors},null,8,["modelValue","label","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$20),{modelValue:a.value.addressLine2,"onUpdate:modelValue":d[5]||(d[5]=e=>a.value.addressLine2=e),name:"address_line_2",placeholder:e.unref(v)({defaultMessage:"Address line 2...",id:"checkout.address.line2.placeholder",description:"Address line 2 of the customer address in the checkout form"})+y("addressLine2")},null,8,["modelValue","placeholder"]),e.createElementVNode("div",j,[e.createVNode(e.unref(t._sfc_main$20),{modelValue:a.value.postalCode,"onUpdate:modelValue":d[6]||(d[6]=e=>a.value.postalCode=e),name:"postal_code",placeholder:e.unref(v)({defaultMessage:"Postal code...",id:"checkout.address.portal_code.placeholder",description:"Postal code of the customer address in the checkout form"})+y("postalCode"),error:i.validation.value.addressLine1.$errors},null,8,["modelValue","placeholder","error"]),e.createVNode(e.unref(t._sfc_main$20),{modelValue:a.value.city,"onUpdate:modelValue":d[7]||(d[7]=e=>a.value.city=e),name:"city",placeholder:e.unref(v)({defaultMessage:"City...",id:"checkout.address.city.placeholder",description:"City of the customer address in the checkout form"})+y("city")},null,8,["modelValue","placeholder"]),e.createVNode(e.unref(t._sfc_main$20),{modelValue:a.value.state,"onUpdate:modelValue":d[8]||(d[8]=e=>a.value.state=e),name:"state",placeholder:e.unref(v)({defaultMessage:"State...",id:"checkout.address.state.placeholder",description:"State of the customer address in the checkout form"})+y("state"),error:i.validation.value.state.$errors},null,8,["modelValue","placeholder","error"])])])])):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["title"]),i.readOnly?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$22),{modelValue:l.value,"onUpdate:modelValue":d[9]||(d[9]=e=>l.value=e),"no-spacing":"","label-position":"before",class:"!flex"},{"inline-label":e.withCtx(()=>[e.createElementVNode("div",z,[e.createVNode(e.unref(t._sfc_main),{tag:"span"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"Company purchase",id:"checkout.company_purchase_toggle.title",description:"The title of the company purchase toggle in the checkout"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"I am purchasing on behalf of a company",id:"checkout.company_purchase_toggle.sub_title",description:"The subtitle of the company purchase toggle in the checkout"})),1)]),_:1})])]),_:1},8,["modelValue"]),e.createVNode(e.unref(t._sfc_main$26),null,{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createElementBlock("div",O,[e.createElementVNode("div",R,[e.createVNode(e.unref(t._sfc_main$20),{modelValue:a.value.companyLegalName,"onUpdate:modelValue":d[10]||(d[10]=e=>a.value.companyLegalName=e),required:"",name:"legal_name",label:e.unref(v)({defaultMessage:"Legal entity name",id:"checkout.legal_name.label",description:"The legal name of the organization customer in the checkout form"}),placeholder:e.unref(v)({defaultMessage:"Legal entity name...",id:"checkout.legal_name.placeholder",description:"The legal name of the organization customer in the checkout form"})},null,8,["modelValue","label","placeholder"]),u.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$20),{key:0,modelValue:a.value.companyVatNumber,"onUpdate:modelValue":d[11]||(d[11]=e=>a.value.companyVatNumber=e),name:"vat_number","input-class":"focus:outline-none focus:ring-0",label:e.unref(v)({defaultMessage:"VAT number",id:"checkout.vat_number.label",description:"The label for the vat number in the checkout form"}),placeholder:e.unref(v)({defaultMessage:"VAT number...",id:"checkout.vat_number.placeholder",description:"The label for the vat number in the checkout form"}),error:i.validation.value.companyVatNumber.$errors,"suffix-class":"px-2 border-l-0"},e.createSlots({_:2},[e.unref(t.isEUCountry)(a.value.country??"")?{name:"suffix",fn:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$3),{type:"button",size:"sm",color:"green",disabled:!e.unref(s)||e.unref(p)||i.validation.value.companyVatNumber.$invalid,onClick:e.unref(g)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(v)({defaultMessage:"Check",id:"checkout.vat_number.check_button.label",description:"The label for the check button in the checkout form"})),1)]),_:1},8,["disabled","onClick"])]),key:"0"}:void 0]),1032,["modelValue","label","placeholder","error"])):e.createCommentVNode("",!0),e.unref(m)?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass({"opacity-75":e.unref(p)})},[e.createVNode(x,{"tax-id-validation-result":e.unref(m)},null,8,["tax-id-validation-result"])],2)):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0)]),_:1})]),_:1}))])],32))}}),F={key:0,class:"flex items-center"},$=["innerHTML"],G=["innerHTML"],Y=e.defineComponent({__name:"CheckoutTitle",props:{trialPeriod:{type:Object},subscriptionName:{type:String},amount:{type:Object},billingPeriod:{type:Object},countryCode:{type:null},trialStartDate:{type:Date},subscriptionStartDate:{type:Date}},setup(i){const{$t:n}=t.useIntl();return(o,a)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",null,[e.createVNode(e.unref(t._sfc_main),{variant:"heading-1",class:"inline-block"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.trialStartDate?i.subscriptionName:e.unref(n)({defaultMessage:"Pay and subscribe",id:"checkout.page_title",description:"The title of the checkout page"}))+e.toDisplayString(" "),1),i.trialPeriod?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$27),{key:0,"trial-period":i.trialPeriod,size:"lg",class:"-translate-y-0.5"},null,8,["trial-period"])):e.createCommentVNode("",!0)]),_:1})]),e.createVNode(e.unref(t._sfc_main),{variant:"body-sm",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[i.countryCode?(e.openBlock(),e.createElementBlock("span",{key:1,innerHTML:i.trialStartDate?e.unref(n)({defaultMessage:"You will be billed <strong>{price}</strong> per {period_name}, starting {startDate, date, long}.",id:"checkout.trial_period_description",description:"The description of the trial period"},{price:e.unref(t.formatAmount)(i.amount),startDate:i.subscriptionStartDate,period_name:e.unref(t.formatBillingPeriod)(i.billingPeriod,{short:!0,hideValueForExactPeriods:!0}),strong:e=>`<strong>${e}</strong>`}):e.unref(n)({defaultMessage:"You will be billed <strong>{price}</strong> per {period_name}, starting today.",id:"checkout.subscription_description",description:"The description of the subscription"},{price:e.unref(t.formatAmount)(i.amount),period_name:e.unref(t.formatBillingPeriod)(i.billingPeriod,{short:!0,hideValueForExactPeriods:!0}),strong:e=>`<strong>${e}</strong>`})},null,8,G)):(e.openBlock(),e.createElementBlock("span",F,[e.createVNode(e.unref(t._sfc_main$28),{"is-dark-mode":""},{tooltip:e.withCtx(()=>[e.createVNode(e.unref(t.TooltipContent),null,{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$30),null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"Will be determined by billing information",description:"Tooltip content for the invoice preview when taxes are not determined by billing information",id:"invoice_preview.taxes_not_determined_by_billing_information_tooltip"})),1)]),_:1})]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$29),{"width-class":"w-10","height-class":"h-4",shade:"darker",class:"inline-block mr-1.5"})]),_:1}),e.createElementVNode("span",{innerHTML:i.trialStartDate?e.unref(n)({defaultMessage:"per {period_name} starting, {startDate, date, long}",id:"checkout.trial_period_description",description:"The description of the trial period"},{startDate:i.subscriptionStartDate,period_name:e.unref(t.formatBillingPeriod)(i.billingPeriod,{short:!0,hideValueForExactPeriods:!0})}):e.unref(n)({defaultMessage:"per {period_name}, starting today",id:"checkout.subscription_description",description:"The description of the subscription"},{period_name:e.unref(t.formatBillingPeriod)(i.billingPeriod,{short:!0,hideValueForExactPeriods:!0})})},null,8,$)]))]),_:1})]))}}),q={class:"flex w-full min-h-96 justify-center items-center"},Q={class:"max-w-sm"},K=e.defineComponent({__name:"CheckoutNotAvailable",setup(i){const{$t:n}=t.useIntl(),o=()=>{window.location.reload()};return(i,a)=>(e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",Q,[e.createVNode(e.unref(t._sfc_main),{variant:"heading-1"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"Checkout not available",id:"checkout.not_available.title",description:"The title of the checkout not available page"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main),{variant:"body-sm",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"The checkout is currently not available.",id:"checkout.not_available.description",description:"The description of the checkout not available page"}))+" ",1),e.createElementVNode("a",{href:"#",class:"text-primary-900 hover:underline",onClick:e.withModifiers(o,["prevent"])},e.toDisplayString(e.unref(n)({defaultMessage:"Reload",id:"checkout.not_available.reload_button",description:"The label of the reload button"})),1),e.createTextVNode(" "+e.toDisplayString(e.unref(n)({defaultMessage:"this page to try again, or contact customer support.",id:"checkout.not_available.contact_support_message",description:"The message shown when the user wants to contact customer support"})),1)]),_:1})])]))}}),H=e.defineComponent({__name:"SubscriptionPaymentCompletedCard",emits:["continue-to-merchant"],setup(i){const{$t:n}=t.useIntl();return(i,o)=>(e.openBlock(),e.createBlock(p._sfc_main,{status:"success",title:e.unref(n)({defaultMessage:"Payment successful",id:"subscription_payment_completed_card.title",description:"The title for when a payment has been successful"})},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main),{variant:"body-xs",shade:"lighter",tag:"span"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"Thank you for subscribing.",id:"subscription_payment_completed_card.thank_you_for_subscribing",description:"The text shown after a successful message before a redirect"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$3),{color:"gray",variant:"outline",size:"xs",class:"align-center",onClick:o[0]||(o[0]=e=>i.$emit("continue-to-merchant"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({defaultMessage:"Continue to merchant",id:"subscription_payment_completed_card.continue",description:"The text for the continue button"})),1)]),_:1})]),_:1},8,["title"]))}}),Z={class:"flex flex-row gap-3 px-3 py-2"},X={class:"grow"},W=e.defineComponent({__name:"SubscriptionSummary",props:{subscription:{type:Object},invoice:{type:Object},loading:{type:Boolean},enabledPricingIds:{type:Array},avatar:{type:String},trialPeriod:{type:Object}},setup(i){const n=i,{$t:o}=t.useIntl(),a=e.computed(()=>{var e,t;return null==(t=null==(e=n.subscription.pricing_plan_schedule_infos)?void 0:e.at(-1))?void 0:t.pricing_plan_version.pricing_plan}),l=e.computed(()=>{var e;return(null==(e=a.value)?void 0:e.name)||n.subscription.name||o({defaultMessage:"Subscription",description:"The fallback name for when no subscription name can be determined",id:"customer_overview.subscriptions_block.fallback_subscription_name"})}),r=e.computed(()=>{var e;return n.subscription.description||(null==(e=a.value)?void 0:e.description)}),c=e.computed(()=>{if(!n.subscription||!n.enabledPricingIds)return;const e=function(e,t){const i=[];return function e(n){Array.isArray(n)?n.forEach(e):n&&"object"==typeof n&&("PRICING"===n.object_type&&t.includes(n.id)&&i.push(n),Object.values(n).forEach(e))}(e),i}(n.subscription,n.enabledPricingIds);return null==e?void 0:e.map(e=>{var t,i;return e.name??(null==(i=null==(t=e.products)?void 0:t[0])?void 0:i.name)}).join(" - ")});return(n,o)=>(e.openBlock(),e.createElementBlock("div",Z,[i.avatar?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$31),{key:0,"image-src":i.avatar,size:"lg",class:"my-1"},null,8,["image-src"])):e.createCommentVNode("",!0),e.createElementVNode("div",X,[e.createVNode(e.unref(t._sfc_main),{variant:"body",weight:"semibold","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value),1)]),_:1}),c.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:0,variant:"body-xs",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.value),1)]),_:1})):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:1,variant:"body-xs",shade:"lighter","no-spacing":""},{default:e.withCtx(()=>[c.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(" • ")],64)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(r.value),1)]),_:1})):e.createCommentVNode("",!0)])]))}}),J={class:"sv-order-summary__body grid grid-cols-1 gap-1"},ee={class:"px-3 py-2"},te={class:"sv-order-summary__billing-period flex flex-col gap-3"},ie={class:"px-3 py-2"},ne={key:3,class:"sv-order-summary__items"},oe=e.defineComponent({__name:"OrderSummary",props:{subscription:{type:Object},invoice:{type:Object},invoicePreviewByBillingPeriod:{type:Object},trialInvoice:{type:Object},enabledPricingIds:{type:Array},trialPeriod:{type:Object},avatar:{type:String},isPaid:{type:Boolean},isUsageBased:{type:Boolean},isPreviewAndPaymentMethodsPending:{type:Boolean},collapsible:{type:String},noTitle:{type:Boolean},countryCode:{type:null},variant:{type:String}},emits:["billing-period-change"],setup(i,{emit:n}){const o=i,a=n,{$t:l}=t.useIntl(),{map:r,formatTimePeriod:c}=t.useTimePeriod(),{isMobileViewport:u}=g.useViewport(),s=e.computed(()=>u.value?"sm":"xs"),d=e=>`${e.type}:${e.value}`,p=["DAY","WEEK","MONTH","YEAR"],v=e=>p.includes(e),y=e=>{if(!e)return;const[t,i]=e.split(":"),n=Number(i);return n&&v(t)?{type:t,value:n}:void 0},f=e.computed({get:()=>{const e=o.subscription.billing_period;return e?`${e.type}:${e.value}`:void 0},set:e=>{if(!e)return;const[t,i]=e.split(":"),n=Number(i);n&&v(t)&&a("billing-period-change",{type:t,value:n})}}),h=e=>{var i,n,a,r;const u=null==(r=null==(a=null==(n=null==(i=o.invoicePreviewByBillingPeriod)?void 0:i[d(e)])?void 0:n.periods)?void 0:a[0])?void 0:r.amount_including_tax;if(!u)return;const s="MONTH"===e.type&&3===e.value?l({defaultMessage:"/quarter",id:"checkout.order_summary_block.billing_period.per_quarter",description:"Period label for quarterly billing"}):l({defaultMessage:"/{period}",id:"checkout.order_summary_block.billing_period.per_label",description:"Period label for billing cycles"},{period:c(e,{prefix:!1,hideValueForExactPeriods:!0})});return l({defaultMessage:"{amount}{period}",id:"checkout.order_summary_block.billing_period.sub_label",description:"Billing period option sublabel showing price per period"},{amount:t.formatAmount(u),period:s})},b=e=>{var t,i,n,a;return null==(a=null==(n=null==(i=null==(t=o.invoicePreviewByBillingPeriod)?void 0:t[d(e)])?void 0:i.periods)?void 0:n[0])?void 0:a.amount_including_tax},M=e=>Number(e.quantity),N=(e,t)=>{if(!t)return;const i={DAY:365,WEEK:52,MONTH:12,YEAR:1}[e.type]/Math.max(e.value??1,1),n=M(t)*i;return Number.isFinite(n)?{quantity:n.toFixed(2),currency:t.currency}:void 0},I=(e,t)=>{if(!e||!t)return;const i=M(e)-M(t);return!Number.isFinite(i)||i<=0?void 0:{quantity:i.toFixed(2),currency:e.currency}},k=e=>{if(!e)return;return`${l({defaultMessage:"Save {amount}",id:"checkout.order_summary_block.billing_period.save_badge.prefix",description:"First line for the savings badge label"},{amount:t.formatAmount(e)})}${l({defaultMessage:"/year",id:"checkout.order_summary_block.billing_period.save_badge.suffix",description:"Second line for the savings badge label"})}`},C=e.computed(()=>{var e,t,i;const n=_({pricingPlanScheduleInfos:o.subscription.pricing_plan_schedule_infos??[],type:"DEFAULT"}),a=(null==(t=null==(e=null==n?void 0:n.pricing_plan_version)?void 0:e.billing_period_settings)?void 0:t.billing_periods)??[],l=new Map,r=e=>{e&&l.set(d(e),e)},c=e=>{var t;null==(t=null==e?void 0:e.items)||t.forEach(e=>{var t,i,n;null==(t=e.configs)||t.forEach(e=>r(e.billing_period)),null==(i=e.billing_period_configs)||i.forEach(e=>r(e.billing_period)),null==(n=e.pricing_currency_configs)||n.forEach(e=>{var t,i;null==(t=e.configs)||t.forEach(e=>r(e.billing_period)),null==(i=e.billing_period_configs)||i.forEach(e=>r(e.billing_period))})})};if(((null==(i=null==n?void 0:n.pricing_plan_version)?void 0:i.pricing_categories)??[]).forEach(e=>{var t,i;null==(t=e.pricings)||t.forEach(e=>c(e)),null==(i=e.pricing_groups)||i.forEach(e=>{var t;return null==(t=e.pricings)?void 0:t.forEach(e=>c(e))})}),!l.size)return[];const u=a.map(e=>l.get(d(e.period))).filter(e=>!!e),s=new Set(u.map(d)),p=[...l.values()].filter(e=>!s.has(d(e)));return[...u,...p]}),D=e.computed(()=>{const e=C.value[C.value.length-1],i=e?N(e,b(e)):void 0;return C.value.map(n=>{const o="MONTH"===n.type&&3===n.value?l({defaultMessage:"Billed quarterly",id:"checkout.order_summary_block.billing_period.quarterly",description:"Billing period option label for quarterly billing"}):l({defaultMessage:"Billed {period}",id:"checkout.order_summary_block.billing_period.label",description:"Billing period option label for the selected period"},{period:r.value[n.type].full}),a=b(n),c=N(n,a),u=e&&n.type===e.type&&n.value===e.value?void 0:I(c,i),d=k(u);return{label:o,subLabel:h(n),labelSuffixComponent:d?{component:t._sfc_main$4,props:{color:"primary",content:d,size:s.value,class:"whitespace-nowrap text-left leading-tight"}}:void 0,hidden:f.value===`${n.type}:${n.value}`,value:`${n.type}:${n.value}`}})}),A=e.computed(()=>{const e=D.value,t=e[0],i=e[e.length-1];return{smallestPeriod:null==t?void 0:t.value,biggestPeriod:null==i?void 0:i.value}}),E=e.computed(()=>D.value.find(e=>e.value===A.value.biggestPeriod)),P=e.computed(()=>D.value.find(e=>e.value===f.value)),w=e.computed(()=>{var e,t,i,n,a,l,r,c;const u=D.value,s=u[u.length-1],d=f.value;if(!s||!d)return"";if(d===s.value)return"";const p=y(s.value);if(!p)return"";const m=null==(n=null==(i=null==(t=null==(e=o.invoicePreviewByBillingPeriod)?void 0:e[s.value])?void 0:t.periods)?void 0:i[0])?void 0:n.amount_including_tax,g=y(d),v=null==(c=null==(r=null==(l=null==(a=o.invoicePreviewByBillingPeriod)?void 0:a[d])?void 0:l.periods)?void 0:r[0])?void 0:c.amount_including_tax;if(!g||!v)return"";const _=N(g,v),h=N(p,m);return k(I(_,h))??""}),V=e=>{const{smallestPeriod:t,biggestPeriod:i}=A.value;f.value=e?i:t};return(n,o)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{class:"sv-order-summary","no-border":"","no-spacing":"","content-background":"none",title:i.noTitle?void 0:e.unref(l)({defaultMessage:"Order summary",id:"checkout.order_summary_block.title",description:"The title of the order summary block that lists the subscription cost in the checkout"})},{default:e.withCtx(()=>[e.createElementVNode("div",J,[e.createVNode(e.unref(t._sfc_main$1),{"no-spacing":"",class:"sv-order-summary__subscription"},{default:e.withCtx(()=>[i.subscription?(e.openBlock(),e.createBlock(W,{key:0,avatar:i.avatar,invoice:i.invoice,subscription:i.subscription,"enabled-pricing-ids":i.enabledPricingIds,loading:i.isPreviewAndPaymentMethodsPending,"trial-period":i.trialPeriod},null,8,["avatar","invoice","subscription","enabled-pricing-ids","loading","trial-period"])):e.createCommentVNode("",!0)]),_:1}),2===D.value.length?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0,"no-spacing":"","content-classes":f.value===A.value.biggestPeriod?"border-primary-500":void 0},{default:e.withCtx(()=>{var i;return[e.createElementVNode("div",ee,[e.createElementVNode("div",te,[E.value?(e.openBlock(),e.createBlock(m._sfc_main,{key:0,name:E.value.label,description:(null==(i=P.value)?void 0:i.subLabel)??""},e.createSlots({default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$22),{"model-value":f.value===A.value.biggestPeriod,"onUpdate:modelValue":V},null,8,["model-value"])]),_:2},[w.value?{name:"badge",fn:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$4),{color:"primary",content:w.value,size:s.value,class:"whitespace-nowrap text-left leading-tight"},null,8,["content","size"])]),key:"0"}:void 0]),1032,["name","description"])):e.createCommentVNode("",!0)])])]}),_:1},8,["content-classes"])):D.value.length>2?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$32),{key:1,"single-model-value":f.value,"onUpdate:singleModelValue":o[0]||(o[0]=e=>f.value=e),class:"sv-order-summary__billing-period",options:D.value,size:"xl","has-large-dropdown":"","show-sub-label-in-input":"","show-suffix-in-closed-input":""},null,8,["single-model-value","options"])):e.createCommentVNode("",!0),i.isUsageBased?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:2,"no-spacing":"",class:"sv-order-summary__usage"},{default:e.withCtx(()=>[e.createElementVNode("div",ie,[e.createVNode(e.unref(t._sfc_main),{"no-spacing":"",variant:"body-sm",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"+ Usage",id:"checkout.invoice_preview.usage_based_message",description:"The message shown for the usage based invoice preview"})),1)]),_:1})])]),_:1})):e.createCommentVNode("",!0),i.invoice&&"products-inline"!==i.variant?(e.openBlock(),e.createElementBlock("div",ne,[e.createVNode(e.unref(t._sfc_main$33),{invoice:i.invoice,"wrapper-component":e.unref(t._sfc_main$1)},null,8,["invoice","wrapper-component"])])):e.createCommentVNode("",!0),e.createVNode(e.unref(t._sfc_main$1),{class:"sv-order-summary__totals"},{default:e.withCtx(()=>[i.invoice?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$34),{key:0,class:"sv-order-summary__invoice-preview",variant:"products-inline"===i.variant?"default":"without-products",invoice:i.invoice,"trial-invoice":i.trialInvoice,"is-paid":i.isPaid,collapsible:i.collapsible,"is-preview-without-taxes":!i.countryCode,"is-customer-facing":""},null,8,["variant","invoice","trial-invoice","is-paid","collapsible","is-preview-without-taxes"])):(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:1,variant:"body-sm",shade:"lighter",class:"sv-order-summary__empty"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Please select a country first",description:"The message shown for the invoice preview when no country is set",id:"checkout.invoice_preview.no_country_selected_message"})),1)]),_:1}))]),_:1})])]),_:1},8,["title"]))}}),ae={class:"sv-empty-state__body flex flex-col items-center justify-center py-4"},le=e.defineComponent({__name:"EmptyStatePlaceholder",props:{icon:{type:null}},setup:i=>(n,o)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{class:"sv-empty-state"},{default:e.withCtx(()=>[e.createElementVNode("div",ae,[e.createVNode(e.unref(t._sfc_main$6),{icon:i.icon,size:"lg",class:"sv-empty-state__icon text-gray-500"},null,8,["icon"]),e.createVNode(e.unref(t._sfc_main),{center:"",tag:"span",variant:"body-sm",weight:"semibold",shade:"lighter",class:"sv-empty-state__title mt-2"},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"title")]),_:3}),e.createVNode(e.unref(t._sfc_main),{center:"",tag:"span",variant:"body-xs",shade:"lightest",class:"sv-empty-state__message mt-1"},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"message")]),_:3})])]),_:3}))}),re={key:0,id:"svg-logo",viewBox:"0 0 35 15",class:"h-[44px]"},ce={key:1,src:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAxcHgiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAxMDEgMzIiIHByZXNlcnZlQXNwZWN0UmF0aW89InhNaW5ZTWluIG1lZXQiIHhtbG5zPSJodHRwOiYjeDJGOyYjeDJGO3d3dy53My5vcmcmI3gyRjsyMDAwJiN4MkY7c3ZnIj48cGF0aCBmaWxsPSIjMDAzMDg3IiBkPSJNIDEyLjIzNyAyLjggTCA0LjQzNyAyLjggQyAzLjkzNyAyLjggMy40MzcgMy4yIDMuMzM3IDMuNyBMIDAuMjM3IDIzLjcgQyAwLjEzNyAyNC4xIDAuNDM3IDI0LjQgMC44MzcgMjQuNCBMIDQuNTM3IDI0LjQgQyA1LjAzNyAyNC40IDUuNTM3IDI0IDUuNjM3IDIzLjUgTCA2LjQzNyAxOC4xIEMgNi41MzcgMTcuNiA2LjkzNyAxNy4yIDcuNTM3IDE3LjIgTCAxMC4wMzcgMTcuMiBDIDE1LjEzNyAxNy4yIDE4LjEzNyAxNC43IDE4LjkzNyA5LjggQyAxOS4yMzcgNy43IDE4LjkzNyA2IDE3LjkzNyA0LjggQyAxNi44MzcgMy41IDE0LjgzNyAyLjggMTIuMjM3IDIuOCBaIE0gMTMuMTM3IDEwLjEgQyAxMi43MzcgMTIuOSAxMC41MzcgMTIuOSA4LjUzNyAxMi45IEwgNy4zMzcgMTIuOSBMIDguMTM3IDcuNyBDIDguMTM3IDcuNCA4LjQzNyA3LjIgOC43MzcgNy4yIEwgOS4yMzcgNy4yIEMgMTAuNjM3IDcuMiAxMS45MzcgNy4yIDEyLjYzNyA4IEMgMTMuMTM3IDguNCAxMy4zMzcgOS4xIDEzLjEzNyAxMC4xIFoiPjwvcGF0aD48cGF0aCBmaWxsPSIjMDAzMDg3IiBkPSJNIDM1LjQzNyAxMCBMIDMxLjczNyAxMCBDIDMxLjQzNyAxMCAzMS4xMzcgMTAuMiAzMS4xMzcgMTAuNSBMIDMwLjkzNyAxMS41IEwgMzAuNjM3IDExLjEgQyAyOS44MzcgOS45IDI4LjAzNyA5LjUgMjYuMjM3IDkuNSBDIDIyLjEzNyA5LjUgMTguNjM3IDEyLjYgMTcuOTM3IDE3IEMgMTcuNTM3IDE5LjIgMTguMDM3IDIxLjMgMTkuMzM3IDIyLjcgQyAyMC40MzcgMjQgMjIuMTM3IDI0LjYgMjQuMDM3IDI0LjYgQyAyNy4zMzcgMjQuNiAyOS4yMzcgMjIuNSAyOS4yMzcgMjIuNSBMIDI5LjAzNyAyMy41IEMgMjguOTM3IDIzLjkgMjkuMjM3IDI0LjMgMjkuNjM3IDI0LjMgTCAzMy4wMzcgMjQuMyBDIDMzLjUzNyAyNC4zIDM0LjAzNyAyMy45IDM0LjEzNyAyMy40IEwgMzYuMTM3IDEwLjYgQyAzNi4yMzcgMTAuNCAzNS44MzcgMTAgMzUuNDM3IDEwIFogTSAzMC4zMzcgMTcuMiBDIDI5LjkzNyAxOS4zIDI4LjMzNyAyMC44IDI2LjEzNyAyMC44IEMgMjUuMDM3IDIwLjggMjQuMjM3IDIwLjUgMjMuNjM3IDE5LjggQyAyMy4wMzcgMTkuMSAyMi44MzcgMTguMiAyMy4wMzcgMTcuMiBDIDIzLjMzNyAxNS4xIDI1LjEzNyAxMy42IDI3LjIzNyAxMy42IEMgMjguMzM3IDEzLjYgMjkuMTM3IDE0IDI5LjczNyAxNC42IEMgMzAuMjM3IDE1LjMgMzAuNDM3IDE2LjIgMzAuMzM3IDE3LjIgWiI+PC9wYXRoPjxwYXRoIGZpbGw9IiMwMDMwODciIGQ9Ik0gNTUuMzM3IDEwIEwgNTEuNjM3IDEwIEMgNTEuMjM3IDEwIDUwLjkzNyAxMC4yIDUwLjczNyAxMC41IEwgNDUuNTM3IDE4LjEgTCA0My4zMzcgMTAuOCBDIDQzLjIzNyAxMC4zIDQyLjczNyAxMCA0Mi4zMzcgMTAgTCAzOC42MzcgMTAgQyAzOC4yMzcgMTAgMzcuODM3IDEwLjQgMzguMDM3IDEwLjkgTCA0Mi4xMzcgMjMgTCAzOC4yMzcgMjguNCBDIDM3LjkzNyAyOC44IDM4LjIzNyAyOS40IDM4LjczNyAyOS40IEwgNDIuNDM3IDI5LjQgQyA0Mi44MzcgMjkuNCA0My4xMzcgMjkuMiA0My4zMzcgMjguOSBMIDU1LjgzNyAxMC45IEMgNTYuMTM3IDEwLjYgNTUuODM3IDEwIDU1LjMzNyAxMCBaIj48L3BhdGg+PHBhdGggZmlsbD0iIzAwOWNkZSIgZD0iTSA2Ny43MzcgMi44IEwgNTkuOTM3IDIuOCBDIDU5LjQzNyAyLjggNTguOTM3IDMuMiA1OC44MzcgMy43IEwgNTUuNzM3IDIzLjYgQyA1NS42MzcgMjQgNTUuOTM3IDI0LjMgNTYuMzM3IDI0LjMgTCA2MC4zMzcgMjQuMyBDIDYwLjczNyAyNC4zIDYxLjAzNyAyNCA2MS4wMzcgMjMuNyBMIDYxLjkzNyAxOCBDIDYyLjAzNyAxNy41IDYyLjQzNyAxNy4xIDYzLjAzNyAxNy4xIEwgNjUuNTM3IDE3LjEgQyA3MC42MzcgMTcuMSA3My42MzcgMTQuNiA3NC40MzcgOS43IEMgNzQuNzM3IDcuNiA3NC40MzcgNS45IDczLjQzNyA0LjcgQyA3Mi4yMzcgMy41IDcwLjMzNyAyLjggNjcuNzM3IDIuOCBaIE0gNjguNjM3IDEwLjEgQyA2OC4yMzcgMTIuOSA2Ni4wMzcgMTIuOSA2NC4wMzcgMTIuOSBMIDYyLjgzNyAxMi45IEwgNjMuNjM3IDcuNyBDIDYzLjYzNyA3LjQgNjMuOTM3IDcuMiA2NC4yMzcgNy4yIEwgNjQuNzM3IDcuMiBDIDY2LjEzNyA3LjIgNjcuNDM3IDcuMiA2OC4xMzcgOCBDIDY4LjYzNyA4LjQgNjguNzM3IDkuMSA2OC42MzcgMTAuMSBaIj48L3BhdGg+PHBhdGggZmlsbD0iIzAwOWNkZSIgZD0iTSA5MC45MzcgMTAgTCA4Ny4yMzcgMTAgQyA4Ni45MzcgMTAgODYuNjM3IDEwLjIgODYuNjM3IDEwLjUgTCA4Ni40MzcgMTEuNSBMIDg2LjEzNyAxMS4xIEMgODUuMzM3IDkuOSA4My41MzcgOS41IDgxLjczNyA5LjUgQyA3Ny42MzcgOS41IDc0LjEzNyAxMi42IDczLjQzNyAxNyBDIDczLjAzNyAxOS4yIDczLjUzNyAyMS4zIDc0LjgzNyAyMi43IEMgNzUuOTM3IDI0IDc3LjYzNyAyNC42IDc5LjUzNyAyNC42IEMgODIuODM3IDI0LjYgODQuNzM3IDIyLjUgODQuNzM3IDIyLjUgTCA4NC41MzcgMjMuNSBDIDg0LjQzNyAyMy45IDg0LjczNyAyNC4zIDg1LjEzNyAyNC4zIEwgODguNTM3IDI0LjMgQyA4OS4wMzcgMjQuMyA4OS41MzcgMjMuOSA4OS42MzcgMjMuNCBMIDkxLjYzNyAxMC42IEMgOTEuNjM3IDEwLjQgOTEuMzM3IDEwIDkwLjkzNyAxMCBaIE0gODUuNzM3IDE3LjIgQyA4NS4zMzcgMTkuMyA4My43MzcgMjAuOCA4MS41MzcgMjAuOCBDIDgwLjQzNyAyMC44IDc5LjYzNyAyMC41IDc5LjAzNyAxOS44IEMgNzguNDM3IDE5LjEgNzguMjM3IDE4LjIgNzguNDM3IDE3LjIgQyA3OC43MzcgMTUuMSA4MC41MzcgMTMuNiA4Mi42MzcgMTMuNiBDIDgzLjczNyAxMy42IDg0LjUzNyAxNCA4NS4xMzcgMTQuNiBDIDg1LjczNyAxNS4zIDg1LjkzNyAxNi4yIDg1LjczNyAxNy4yIFoiPjwvcGF0aD48cGF0aCBmaWxsPSIjMDA5Y2RlIiBkPSJNIDk1LjMzNyAzLjMgTCA5Mi4xMzcgMjMuNiBDIDkyLjAzNyAyNCA5Mi4zMzcgMjQuMyA5Mi43MzcgMjQuMyBMIDk1LjkzNyAyNC4zIEMgOTYuNDM3IDI0LjMgOTYuOTM3IDIzLjkgOTcuMDM3IDIzLjQgTCAxMDAuMjM3IDMuNSBDIDEwMC4zMzcgMy4xIDEwMC4wMzcgMi44IDk5LjYzNyAyLjggTCA5Ni4wMzcgMi44IEMgOTUuNjM3IDIuOCA5NS40MzcgMyA5NS4zMzcgMy4zIFoiPjwvcGF0aD48L3N2Zz4",role:"presentation",class:"h-[22px]"},ue=e.defineComponent({__name:"ExpressPaymentMethodButton",props:{type:{type:String}},emits:["click"],setup(i,{emit:n}){const o=i,a=n,l=e.computed(()=>{switch(o.type){case"applepay":return"Apple Pay";case"googlepay":return"Google Pay";case"paypal":return"PayPal";default:return}}),r=e.computed(()=>{switch(o.type){case"applepay":return"!bg-black !py-0";case"googlepay":return"!bg-black bg-[url(https://www.gstatic.com/instantbuy/svg/dark_gpay.svg)] bg-[length:auto_42.5%]";case"paypal":return"!bg-[#ffc439]";default:return}});function c(){a("click")}return(i,n)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{size:"lg","aria-label":l.value,class:e.normalizeClass([r.value,"!block w-full h-11 bg-center bg-no-repeat"]),onClick:c},{default:e.withCtx(()=>["applepay"===o.type?(e.openBlock(),e.createElementBlock("svg",re,[...n[0]||(n[0]=[e.createElementVNode("svg",{id:"svg-logo",x:"0",y:"3.85",height:"7.3",width:"35",class:"logo",viewBox:"0 0 105 43",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("title",null,"Apple Logo"),e.createElementVNode("g",{stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},[e.createElementVNode("g",{fill:"#FFF"},[e.createElementVNode("path",{d:"M19.4028,5.5674 C20.6008,4.0684 21.4138,2.0564 21.1998,0.0004 C19.4458,0.0874 17.3058,1.1574 16.0668,2.6564 C14.9538,3.9414 13.9688,6.0374 14.2258,8.0074 C16.1948,8.1784 18.1618,7.0244 19.4028,5.5674"}),e.createElementVNode("path",{d:"M21.1772,8.3926 C18.3182,8.2226 15.8872,10.0156 14.5212,10.0156 C13.1552,10.0156 11.0642,8.4786 8.8022,8.5196 C5.8592,8.5626 3.1282,10.2276 1.6342,12.8746 C-1.4378,18.1696 0.8232,26.0246 3.8112,30.3376 C5.2622,32.4716 7.0102,34.8206 9.3142,34.7366 C11.4912,34.6506 12.3442,33.3266 14.9902,33.3266 C17.6352,33.3266 18.4042,34.7366 20.7082,34.6936 C23.0972,34.6506 24.5922,32.5586 26.0422,30.4226 C27.7072,27.9906 28.3882,25.6426 28.4312,25.5126 C28.3882,25.4706 23.8232,23.7186 23.7812,18.4676 C23.7382,14.0706 27.3652,11.9786 27.5362,11.8496 C25.4882,8.8196 22.2872,8.4786 21.1772,8.3926"}),e.createElementVNode("path",{d:"M85.5508,43.0381 L85.5508,39.1991 C85.8628,39.2421 86.6158,39.2871 87.0158,39.2871 C89.2138,39.2871 90.4558,38.3551 91.2108,35.9581 L91.6548,34.5371 L83.2428,11.2321 L88.4368,11.2321 L94.2958,30.1421 L94.4068,30.1421 L100.2668,11.2321 L105.3278,11.2321 L96.6048,35.7141 C94.6078,41.3291 92.3208,43.1721 87.4828,43.1721 C87.1048,43.1721 85.8838,43.1271 85.5508,43.0381"}),e.createElementVNode("path",{d:"M42.6499,19.3555 L48.3549,19.3555 C52.6829,19.3555 55.1469,17.0255 55.1469,12.9855 C55.1469,8.9455 52.6829,6.6375 48.3769,6.6375 L42.6499,6.6375 L42.6499,19.3555 Z M49.6869,2.4425 C55.9009,2.4425 60.2289,6.7265 60.2289,12.9625 C60.2289,19.2225 55.8129,23.5285 49.5309,23.5285 L42.6499,23.5285 L42.6499,34.4705 L37.6779,34.4705 L37.6779,2.4425 L49.6869,2.4425 Z"}),e.createElementVNode("path",{d:"M76.5547,25.7705 L76.5547,23.9715 L71.0287,24.3275 C67.9207,24.5275 66.3007,25.6815 66.3007,27.7015 C66.3007,29.6545 67.9887,30.9195 70.6287,30.9195 C74.0027,30.9195 76.5547,28.7665 76.5547,25.7705 M61.4617,27.8345 C61.4617,23.7285 64.5917,21.3755 70.3627,21.0205 L76.5547,20.6425 L76.5547,18.8675 C76.5547,16.2705 74.8457,14.8495 71.8057,14.8495 C69.2967,14.8495 67.4777,16.1375 67.0997,18.1125 L62.6167,18.1125 C62.7497,13.9615 66.6567,10.9435 71.9387,10.9435 C77.6207,10.9435 81.3267,13.9175 81.3267,18.5345 L81.3267,34.4705 L76.7327,34.4705 L76.7327,30.6305 L76.6217,30.6305 C75.3127,33.1395 72.4267,34.7145 69.2967,34.7145 C64.6807,34.7145 61.4617,31.9625 61.4617,27.8345"})])])],-1)])])):"paypal"===o.type?(e.openBlock(),e.createElementBlock("img",ce)):e.createCommentVNode("",!0)]),_:1},8,["aria-label","class"]))}}),se={class:"absolute h-[1px] w-[1px] overflow-hidden opacity-0"},de=e.defineComponent({__name:"ExpressPaymentMethodApplePay",props:{onBillingInformationChange:{type:Function},amount:{type:Object},countryCode:{type:String},locale:{type:String},isVisible:{type:Boolean},paymentMethodOptionsResponse:{type:Object},billingInformation:{type:Object}},emits:["ready","update-billing-information"],setup(n,{emit:o}){const a=n,l=o,r=e.ref(),c=i.useLogger(),{authorizePayment:u}=y.createPaymentsService(),s=a.paymentMethodOptionsResponse.payment_acceptor.id,d=e=>{if(!e.value)return;let t=e.value??1,i=e.type.toLowerCase();return"WEEK"===e.type&&(i="day",t=7*e.value),"day"===i||"month"===i||"year"===i||"hour"===i||"minute"===i?{recurringPaymentIntervalUnit:i,recurringPaymentIntervalCount:t}:void 0},m=e=>({postal_code:e.postalCode,city:e.locality,country:e.countryCode}),g=e=>({postal_code:e.postalCode,city:e.city,country:e.country}),v=e=>e&&f(e)?e:void 0,f=e=>t.isValidCountryCode(e),_=()=>{var e;const t=null==(e=r.value)?void 0:e.querySelector("apple-pay-button");if(t){const e=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});t.dispatchEvent(e)}};return e.onMounted(()=>{(async()=>{const{AdyenCheckout:e,ApplePay:t}=await Promise.resolve().then(()=>require("../../index-DIFK3mcJ.js")),i=new t(await e(p.getAdyenExpressCheckoutConfiguration({amount:a.amount,locale:a.locale,countryCode:a.countryCode,paymentMethodOptionResponse:a.paymentMethodOptionsResponse,logger:c})),{isExpress:!0,recurringPaymentRequest:{paymentDescription:a.billingInformation.description,billingAgreement:a.billingInformation.agreement,managementURL:"https://www.google.com",...a.billingInformation.trial&&{trialBilling:{label:a.billingInformation.trial.label,amount:a.billingInformation.trial.amount.quantity.toString(),type:"final",paymentTiming:"recurring",recurringPaymentStartDate:a.billingInformation.trial.startDate,recurringPaymentEndDate:a.billingInformation.trial.endDate}},...a.billingInformation.regular&&{regularBilling:{label:a.billingInformation.regular.label,amount:a.billingInformation.regular.amount.quantity.toString(),type:"final",paymentTiming:"recurring",recurringPaymentStartDate:a.billingInformation.regular.startDate,...d(a.billingInformation.regular.interval??{type:"MONTH",value:1})}}},requiredBillingContactFields:["postalAddress"],requiredShippingContactFields:["email"],onPaymentMethodSelected:async(e,t,i)=>{var n,o,r,c,u,s,d;const{invoicePreview:p,trialInvoicePreview:m}=await a.onBillingInformationChange({...(null==(n=i.paymentMethod.billingContact)?void 0:n.postalCode)&&{postal_code:i.paymentMethod.billingContact.postalCode},...(null==(o=i.paymentMethod.billingContact)?void 0:o.locality)&&{city:i.paymentMethod.billingContact.locality},...v(null==(r=i.paymentMethod.billingContact)?void 0:r.countryCode)&&{country:v(null==(c=i.paymentMethod.billingContact)?void 0:c.countryCode)}}),g=m?m.invoice_amount_including_tax.quantity.toString():p.invoice_amount_including_tax.quantity.toString();l("update-billing-information",{postal_code:null==(u=i.paymentMethod.billingContact)?void 0:u.postalCode,city:null==(s=i.paymentMethod.billingContact)?void 0:s.locality,country:null==(d=i.paymentMethod.billingContact)?void 0:d.countryCode}),e({newTotal:{label:a.billingInformation.regular.label,amount:g,type:"final"}})},onError:e=>{c.error("APPLE_PAY_ERROR","Apple Pay error",{error:e})},onAuthorized:async(e,t)=>{try{c.info("APPLE_PAY_AUTHORIZED","Apple Pay authorized",{data:e});const i=e.authorizedEvent;c.info("APPLE_PAY_EVENT_DATA","Apple Pay event data structure",{eventData:i,hasPaymentMethod:!!i.payment.token.paymentMethod,hasBrowserInfo:!!i.payment.token.paymentData,billingAddress:e.billingAddress});const n=i.payment.billingContact,o=e.billingAddress;n?l("update-billing-information",m(n)):o&&l("update-billing-information",g(o));const r={payment_method:p.transformObjectToAdyenObject(i.payment.token.paymentMethod),browser_info:p.transformObjectToAdyenObject(i.payment.token.paymentData)};c.info("APPLE_PAY_ADYEN_PAYLOAD","Adyen payload prepared",{adyen:r});const d=p.createReturnUrl({paymentAcceptorId:s,redirectUrl:window.location.href});c.info("APPLE_PAY_CALLING_API","Calling authorizePayment API",{paymentAcceptorId:s,amount:a.amount});const v=await u({payment_acceptor_id:s,payment_gateway_variant:"ADYEN",adyen:{...r,store_payment_method:!0},amount:a.amount,return_url:d});if(c.info("APPLE_PAY_API_RESPONSE","Payment API response received",{status:v.status,paymentResult:v}),"FAILURE"===v.status)return c.error("APPLE_PAY_AUTHORIZATION_FAILED","Payment authorization failed",{error:v}),void t.reject();if("ACTION_REQUIRED"===v.status)return c.warn("APPLE_PAY_ACTION_REQUIRED","Payment requires additional action",{action:v.action}),void t.reject();c.info("APPLE_PAY_SUCCESS","Apple Pay payment successful, resolving"),t.resolve()}catch(i){c.error("APPLE_PAY_AUTHORIZATION_FAILED","Apple Pay authorization failed",{error:i}),t.reject()}}});if(r.value)try{await i.isAvailable(),i.mount(r.value),l("ready")}catch(n){c.error("APPLE_PAY_ERROR","Apple Pay not available on this device",{},n)}else c.error("APPLE_PAY_ERROR","Apple Pay button ref not found")})()}),(t,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[n.isVisible?(e.openBlock(),e.createBlock(ue,{key:0,type:"applepay",onClick:_})):e.createCommentVNode("",!0),e.createElementVNode("div",se,[e.createElementVNode("div",{ref_key:"applePayButtonRef",ref:r},null,512)])],64))}}),pe={class:"relative overflow-hidden"},me=e.defineComponent({__name:"ExpressPaymentMethodPaypal",props:{amount:{type:Object},countryCode:{type:String},locale:{type:String},isVisible:{type:Boolean},paymentMethodOptionsResponse:{type:Object},billingInformation:{type:Object}},emits:["ready","update-billing-information"],setup(t,{emit:n}){const o=t,a=n,l=e.ref(),r=i.useLogger();return e.onMounted(()=>{(async()=>{const{AdyenCheckout:e,PayPal:t}=await Promise.resolve().then(()=>require("../../index-DIFK3mcJ.js")),i=new t(await e(p.getAdyenExpressCheckoutConfiguration({locale:o.locale,amount:o.amount,countryCode:o.countryCode,paymentMethodOptionResponse:o.paymentMethodOptionsResponse,logger:r})),{isExpress:!0,blockPayPalPayLaterButton:!0,blockPayPalCreditButton:!0,blockPayPalVenmoButton:!0,style:{height:55},onInit:()=>{a("ready")}});if(l.value)try{await i.isAvailable(),i.mount(l.value)}catch(n){r.error("EXPRESS_CHECKOUT_PAYPAL_ERROR","Failed mounting PayPal express button",{error:n})}else r.error("EXPRESS_CHECKOUT_PAYPAL_ERROR","The PayPal button reference is not found and cannot be mounted")})()}),(i,n)=>(e.openBlock(),e.createElementBlock("div",pe,[t.isVisible?(e.openBlock(),e.createBlock(ue,{key:0,type:"paypal",class:"w-full"})):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"paypalButtonRef",ref:l,class:"absolute inset-0 opacity-[0.0001]"},null,512)]))}}),ge={class:"absolute h-[1px] w-[1px] overflow-hidden opacity-0"},ve=e.defineComponent({__name:"ExpressPaymentMethodGooglePay",props:{amount:{type:Object},countryCode:{type:String},locale:{type:String},isVisible:{type:Boolean},paymentMethodOptionsResponse:{type:Object},billingInformation:{type:Object}},emits:["ready","update-billing-information"],setup(t,{emit:n}){const o=t,a=n,l=e.ref(),r=i.useLogger(),c=()=>{var e;const t=null==(e=l.value)?void 0:e.querySelector("#gpay-button-online-api-id");if(t){const e=new MouseEvent("click",{bubbles:!0,cancelable:!0,view:window});t.dispatchEvent(e)}};return e.onMounted(()=>{(async()=>{const{AdyenCheckout:e,GooglePay:t}=await Promise.resolve().then(()=>require("../../index-DIFK3mcJ.js")),i=new t(await e(p.getAdyenExpressCheckoutConfiguration({locale:o.locale,amount:o.amount,countryCode:o.countryCode,paymentMethodOptionResponse:o.paymentMethodOptionsResponse,logger:r})),{isExpress:!0});if(l.value)try{await i.isAvailable(),i.mount(l.value),a("ready")}catch(n){r.error("EXPRESS_CHECKOUT_GOOGLE_PAY_ERROR","Failed mounting Google Pay express button",{error:n})}else r.error("EXPRESS_CHECKOUT_GOOGLE_PAY_ERROR","The Google Pay button reference is not found and cannot be mounted")})()}),(i,n)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[t.isVisible?(e.openBlock(),e.createBlock(ue,{key:0,type:"googlepay",onClick:c})):e.createCommentVNode("",!0),e.createElementVNode("div",ge,[e.createElementVNode("div",{ref_key:"googlePayButtonRef",ref:l},null,512)])],64))}}),ye={key:0,class:"mt-4n"},fe={class:"mb-2"},_e={class:"grid grid-cols-6 gap-1 md:gap-2"},he={class:"h-4 mt-4"},be=e.defineComponent({__name:"ExpressPaymentMethods",props:{amount:{type:Object},countryCode:{type:String},locale:{type:String},paymentMethodsOptionsResponse:{type:null},billingInformation:{type:Object},onBillingInformationChange:{type:Function}},emits:["update-billing-information"],setup(i){const n=["applepay"],o=i,{$t:a}=t.useIntl(),l=e.ref(!1),r=e.ref(!1),c=e.ref(!1),u=e.computed(()=>{var e;if(n.includes("applepay"))return null==(e=o.paymentMethodsOptionsResponse)?void 0:e.find(e=>{var t;return null==(t=e.options)?void 0:t.some(e=>"apple pay"===e.name.toLowerCase())})}),s=e.computed(()=>{var e;if(n.includes("paypal"))return null==(e=o.paymentMethodsOptionsResponse)?void 0:e.find(e=>{var t;return null==(t=e.options)?void 0:t.some(e=>"paypal"===e.name.toLowerCase())})}),d=e.computed(()=>{var e;if(n.includes("googlepay"))return null==(e=o.paymentMethodsOptionsResponse)?void 0:e.find(e=>{var t;return null==(t=e.options)?void 0:t.some(e=>"google pay"===e.name.toLowerCase())})}),p=e.computed(()=>!!(u.value||d.value||s.value)),m=e.computed(()=>{var e;if(0===(null==(e=o.paymentMethodsOptionsResponse)?void 0:e.length))return!1;const t=!u.value||l.value,i=!d.value||r.value,n=!s.value||c.value;return t&&i&&n}),g=e.computed(()=>m.value?(u.value?1:0)+(d.value?1:0)+(s.value?1:0):2);return(n,o)=>p.value?(e.openBlock(),e.createElementBlock("div",ye,[e.createElementVNode("div",fe,[m.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:1,variant:"heading-3",tag:"h2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Subscribe instantly with",id:"checkout.express_payment_methods.title",description:"The title of the express payment methods block in the checkout form"})),1)]),_:1})):(e.openBlock(),e.createBlock(v._sfc_main,{key:0,variant:"title"}))]),e.createElementVNode("div",_e,[m.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(v._sfc_main,{class:"h-11 col-span-3"}),e.createVNode(v._sfc_main,{class:"h-11 col-span-3"})],64)),e.createElementVNode("div",{class:e.normalizeClass(["col-span-3 md:col-span-2",{hidden:!u.value,"!col-span-6":1===g.value,"md:!col-span-3":2===g.value,"!col-span-6 md:!col-span-2":3===g.value}])},[u.value?(e.openBlock(),e.createBlock(de,{key:0,amount:i.amount,"billing-information":i.billingInformation,"country-code":i.countryCode,locale:i.locale,"is-visible":m.value,"payment-method-options-response":u.value,"on-billing-information-change":i.onBillingInformationChange,onReady:o[0]||(o[0]=e=>l.value=!0),onUpdateBillingInformation:o[1]||(o[1]=e=>n.$emit("update-billing-information",e))},null,8,["amount","billing-information","country-code","locale","is-visible","payment-method-options-response","on-billing-information-change"])):e.createCommentVNode("",!0)],2),e.createElementVNode("div",{class:e.normalizeClass(["col-span-3 md:col-span-2",{hidden:!d.value,"col-span-6 md:col-span-6":1===g.value,"md:!col-span-3":2===g.value}])},[d.value?(e.openBlock(),e.createBlock(ve,{key:0,amount:i.amount,"billing-information":i.billingInformation,"country-code":i.countryCode,locale:i.locale,"is-visible":m.value,"payment-method-options-response":d.value,onReady:o[2]||(o[2]=e=>r.value=!0)},null,8,["amount","billing-information","country-code","locale","is-visible","payment-method-options-response"])):e.createCommentVNode("",!0)],2),e.createElementVNode("div",{class:e.normalizeClass(["col-span-3 md:col-span-2",{hidden:!s.value,"col-span-6 md:col-span-6":1===g.value,"md:!col-span-3":2===g.value}])},[s.value?(e.openBlock(),e.createBlock(me,{key:0,amount:i.amount,"billing-information":i.billingInformation,"country-code":i.countryCode,locale:i.locale,"is-visible":m.value,"payment-method-options-response":s.value,onReady:o[3]||(o[3]=e=>c.value=!0)},null,8,["amount","billing-information","country-code","locale","is-visible","payment-method-options-response"])):e.createCommentVNode("",!0)],2)]),e.createElementVNode("div",he,[m.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$16),{key:1,text:e.unref(a)({defaultMessage:"Or",id:"checkout.express_payment_methods.divider_text",description:"The text of the divider text in the express payment methods block in the checkout form"}),"text-position":"center"},null,8,["text"])):(e.openBlock(),e.createBlock(v._sfc_main,{key:0,variant:"divider-text"}))])])):e.createCommentVNode("",!0)}}),Me={class:"grid grid-cols-2 gap-2"},Ne=e.defineComponent({__name:"TieredTableRow",props:{band:{type:Object},previousBand:{type:Object},isFirst:{type:Boolean},period:{type:Object}},setup(i){const n=i,{$t:o}=t.useIntl(),{formatTimePeriod:a}=t.useTimePeriod(),l=e.computed(()=>{var e;return n.isFirst?"0":(null==(e=n.previousBand)?void 0:e.tier_top_bound)&&"number"in n.previousBand.tier_top_bound?n.previousBand.tier_top_bound.number:void 0}),r=e.computed(()=>{if(n.band.tier_top_bound&&"number"in n.band.tier_top_bound)return n.band.tier_top_bound.number});return(n,c)=>(e.openBlock(),e.createElementBlock("div",Me,[e.createVNode(e.unref(t._sfc_main),{variant:"body-xs",shade:"lighter",tag:"div"},{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"{lower_bound} - {upper_bound} seats",id:"seats.tiered_range_label",description:"The label showing the seat count range for a tiered pricing tier"},{lower_bound:l.value??"0",upper_bound:r.value})),1)],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"> {lower_bound} seats",id:"seats.tiered_unbounded_range_label",description:"The label showing the unbounded seat count range (greater than) for a tiered pricing tier"},{lower_bound:l.value??"0"})),1)],64))]),_:1}),e.createVNode(e.unref(t._sfc_main),{variant:"body-xs",shade:"lighter",tag:"div",class:"text-right"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.band.amount&&e.unref(o)({defaultMessage:"{amount} per seat/{period}",id:"seats.tiered_price_per_seat_period",description:"The price per seat and billing period label for a tiered pricing tier"},{amount:e.unref(t.formatAmount)(i.band.amount),period:i.period?e.unref(a)(i.period,{short:!0,hideValueForExactPeriods:!0}):""})),1)]),_:1})]))}}),Ie={class:"grid grid-cols-1 gap-0.5 pt-1.5"},ke=e.defineComponent({__name:"TieredTable",props:{bands:{type:Array},period:{type:Object}},setup:t=>(i,n)=>(e.openBlock(),e.createElementBlock("div",Ie,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.bands,(i,n)=>(e.openBlock(),e.createBlock(Ne,{key:n,band:i,"is-first":0===n,"previous-band":n>0?t.bands[n-1]:void 0,period:t.period},null,8,["band","is-first","previous-band","period"]))),128))]))});const Ce={class:"flex flex-row-reverse md:flex-row gap-4"},De={class:"w-24 md:w-32 shrink-0 justify-start"},Ae=["tabindex"],Ee={key:0},Pe={key:0},we=e.defineComponent({__name:"SeatsEditorItem",props:e.mergeModels({modelValue:{type:Object},defaultValue:{type:Object},pricings:{type:Array}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const n=i,o=e.useModel(i,"modelValue"),{$t:a}=t.useIntl(),{formatTimePeriod:l}=t.useTimePeriod(),r=e.ref(!1),c=e.computed({get:()=>o.value.number?+o.value.number:1,set(e){o.value={...o.value,number:void 0!==e?e.toString():void 0}}}),u=function({pricings:t,pricingItemConfigId:i}){return e.computed(()=>{var e,n,o,a,l,r;const{config:c,productItem:u}=function({pricings:e,pricingItemConfigId:t}){var i,n;const o=e.flatMap(e=>e.items??[]).find(e=>{var i;return null==(i=e.configs)?void 0:i.some(e=>e.id===t)});return{config:null==(i=null==o?void 0:o.configs)?void 0:i.find(e=>e.id===t),productItem:null==(n=null==o?void 0:o.product_items)?void 0:n[0]}}({pricings:t,pricingItemConfigId:i});return{billing:{period:null==c?void 0:c.billing_period,billedInAdvance:null==c?void 0:c.billing_in_advance},product:{name:null==u?void 0:u.name,description:null==u?void 0:u.description},pricing:{..."FLAT"===(null==(e=null==c?void 0:c.details)?void 0:e.pricing_type)&&{amount:null==(a=null==(o=null==(n=c.details)?void 0:n.bands)?void 0:o[0])?void 0:a.amount},..."TIERED"===(null==(l=null==c?void 0:c.details)?void 0:l.pricing_type)&&{tiered:{bands:null==(r=c.details)?void 0:r.bands}}}}})}({pricings:n.pricings,pricingItemConfigId:o.value.pricing_item_config_id}),s=e.computed(()=>{var e,t;return!!(null==(t=null==(e=u.value.pricing)?void 0:e.tiered)?void 0:t.bands)});return(n,o)=>{var d,p,m;return e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Ce,[e.createElementVNode("div",De,[e.createVNode(e.unref(t._sfc_main$35),{modelValue:c.value,"onUpdate:modelValue":o[0]||(o[0]=e=>c.value=e),size:"sm",min:(null==(d=i.defaultValue)?void 0:d.number)?+i.defaultValue.number:void 0},null,8,["modelValue","min"])]),e.createElementVNode("div",{class:e.normalizeClass(["flex flex-col grow",{"hover:cursor-pointer":s.value}]),tabindex:s.value?0:void 0,onClick:o[1]||(o[1]=e=>s.value?r.value=!r.value:void 0)},[e.createVNode(e.unref(t._sfc_main),{tag:"span",variant:"body-sm",weight:"semibold"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(u).product.name||e.unref(a)({defaultMessage:"Seats",id:"seats.label",description:"The label for the seats input field"})),1)]),_:1}),e.unref(u).pricing.amount?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:0,tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"{amount} per seat/{period}",id:"seats.price_per_seat_period",description:"The price per seat and billing period label for seat-based pricing"},{amount:e.unref(t.formatAmount)(e.unref(u).pricing.amount),period:e.unref(u).billing.period?e.unref(l)(e.unref(u).billing.period,{short:!0,hideValueForExactPeriods:!0}):""})),1)]),_:1})):e.unref(u).pricing.tiered?(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:1,tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Tiered pricing",id:"seats.tiered_pricing_label",description:"The label indicating tiered pricing structure for seats"}))+" ",1),e.createVNode(e.unref(t._sfc_main$6),{icon:"keyboard_arrow_down",size:"xs",class:e.normalizeClass(["absolute transition ease-in-out text-gray-400",{"rotate-0":!r.value,"rotate-180":r.value}])},null,8,["class"])]),_:1})):e.createCommentVNode("",!0)],10,Ae)]),(null==(m=null==(p=e.unref(u).pricing)?void 0:p.tiered)?void 0:m.bands)?(e.openBlock(),e.createElementBlock("div",Ee,[e.createVNode(e.unref(t._sfc_main$26),null,{default:e.withCtx(()=>[r.value?(e.openBlock(),e.createElementBlock("div",Pe,[e.createVNode(ke,{bands:e.unref(u).pricing.tiered.bands,period:e.unref(u).billing.period},null,8,["bands","period"])])):e.createCommentVNode("",!0)]),_:1})])):e.createCommentVNode("",!0)])}}}),Ve=e.defineComponent({__name:"SeatsEditor",props:e.mergeModels({modelValue:{type:Array},initialSeatsValues:{type:Array},pricings:{type:Array}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const n=e.useModel(i,"modelValue"),o=t=>e.computed({get:()=>n.value[t],set:e=>{const i=n.value.slice();i[t]=e,n.value=i}});return(n,a)=>(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.modelValue,(n,a)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:a},{default:e.withCtx(()=>{var t;return[n.pricing_item_config_id?(e.openBlock(),e.createBlock(we,{key:n.pricing_item_config_id,modelValue:o(a).value,"onUpdate:modelValue":e=>o(a).value=e,"default-value":null==(t=i.initialSeatsValues)?void 0:t[a],pricings:i.pricings},null,8,["modelValue","onUpdate:modelValue","default-value","pricings"])):e.createCommentVNode("",!0)]}),_:2},1024))),128))}}),xe={class:"flex gap-4 border-l-2 border-primary-600 px-2"},Be={class:"grow"},Se=e.defineComponent({__name:"PricingGroupTitle",setup:i=>(i,n)=>(e.openBlock(),e.createElementBlock("div",xe,[e.createElementVNode("div",Be,[e.createVNode(e.unref(t._sfc_main),{tag:"span",variant:"body-sm",weight:"semibold"},{default:e.withCtx(()=>[e.renderSlot(i.$slots,"title")]),_:3})]),e.createElementVNode("div",null,[e.createVNode(e.unref(t._sfc_main),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.renderSlot(i.$slots,"description")]),_:3})])]))}),Te={class:"p-1"},Le={class:"grid grid-cols-1 gap-1 pt-1"},je=e.defineComponent({__name:"AddonSingleEditor",props:e.mergeModels({constraint:{type:String},modelValue:{type:Array},pricings:{type:Array},billingPeriod:{type:Object},currency:{type:String},groupName:{type:String}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const n=i,o=e.useModel(i,"modelValue"),{$t:a}=t.useIntl(),{renderPricingForPricingItem:l}=t.usePricingItem({currency:e.toRef(n,"currency"),billingPeriod:e.toRef(n,"billingPeriod")}),r=n.pricings.map(e=>e.id),c=e.computed(()=>"AT_MOST_ONE"===n.constraint?a({defaultMessage:"Select up to one product",id:"addon_single_editor.description.at_most_one",description:"The description of the addon single editor for at most one product"}):"EXACTLY_ONE"===n.constraint?a({defaultMessage:"Select one product",id:"addon_single_editor.description.exactly_one",description:"The description of the addon single editor for exactly one product"}):"AT_LEAST_ONE"===n.constraint?a({defaultMessage:"Select at least one product",id:"addon_single_editor.description.at_least_one",description:"The description of the addon single editor for at least one product"}):""),u=e=>n.modelValue.includes(e);return(n,s)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{"no-spacing":""},{default:e.withCtx(()=>[e.createElementVNode("div",Te,[e.createVNode(Se,null,{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.groupName),1)]),description:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.value),1)]),_:1}),e.createElementVNode("div",Le,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.pricings,i=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:i.id,"content-background":"none",class:e.normalizeClass({"!bg-white":u(i.id)})},{default:e.withCtx(()=>{var n,c;return[e.createVNode(m._sfc_main,{name:e.unref(E)(i)??"",description:(null==(n=i.items)?void 0:n[0])?e.unref(l)({pricingItem:null==(c=i.items)?void 0:c[0]}):e.unref(a)({defaultMessage:"Unsupported pricing",id:"pricing_item_pricing.unsupported_pricing_error",description:"Text displayed when the pricing item pricing is unsupported"})},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$22),{"model-value":u(i.id),"onUpdate:modelValue":e=>(e=>{if(u(e))o.value=o.value.filter(t=>t!==e);else{const t=o.value.filter(e=>!r.includes(e));o.value=[...t,e]}})(i.id)},null,8,["model-value","onUpdate:modelValue"])]),_:2},1032,["name","description"])]}),_:2},1032,["class"]))),128))])])]),_:1}))}}),ze={class:"grid grid-cols-1 gap-1"},Oe=e.defineComponent({__name:"AddonMultipleEditor",props:e.mergeModels({modelValue:{type:Array},pricings:{type:Array},billingPeriod:{type:Object},currency:{type:String},groupName:{type:String}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const n=i,o=e.useModel(i,"modelValue"),{$t:a}=t.useIntl(),{renderPricingForPricingItem:l}=t.usePricingItem({currency:e.toRef(n,"currency"),billingPeriod:e.toRef(n,"billingPeriod")}),r=e=>o.value.includes(e),c=e=>{r(e)?o.value=o.value.filter(t=>t!==e):o.value=[...o.value,e]};return(n,o)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{"no-spacing":"","no-border":!i.groupName,"content-background":i.groupName?"gray":"none"},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["grid grid-cols-1 gap-1",{"p-1":i.groupName}])},[i.groupName?(e.openBlock(),e.createBlock(Se,{key:0},{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.groupName),1)]),description:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Select any number of products",id:"addon_multiple_editor.description",description:"The description of the addon multiple editor"})),1)]),_:1})):e.createCommentVNode("",!0),e.createElementVNode("div",ze,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.pricings,n=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:n.id,"content-background":i.groupName||r(n.id)?"none":"gray",class:e.normalizeClass({"!bg-white":r(n.id)})},{default:e.withCtx(()=>{var i,o;return[e.createVNode(m._sfc_main,{name:e.unref(E)(n)??"",description:(null==(i=n.items)?void 0:i[0])?e.unref(l)({pricingItem:null==(o=n.items)?void 0:o[0]}):e.unref(a)({defaultMessage:"Unsupported pricing",id:"addon_multiple_editor.unsupported_pricing_error",description:"Text displayed when the pricing item pricing is unsupported"})},{default:e.withCtx(()=>[r(n.id)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,color:"gray",variant:"outline",square:"",size:"sm","icon-prefix":"remove_shopping_cart",onClick:e=>c(n.id)},null,8,["onClick"])):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:1,color:"primary","icon-prefix":"add",size:"sm",onClick:e=>c(n.id)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)({defaultMessage:"Add to subscription ",id:"addon_multiple_editor.add_to_subscription_button",description:"The button to add a pricing to the subscription"})),1)]),_:1},8,["onClick"]))]),_:2},1032,["name","description"])]}),_:2},1032,["content-background","class"]))),128))])],2)]),_:1},8,["no-border","content-background"]))}}),Re={class:"p-1"},Ue={class:"pt-1"},Fe=e.defineComponent({__name:"PricingGroupSingleEditor",props:e.mergeModels({modelValue:{type:Array},pricings:{type:Array},billingPeriod:{type:Object},currency:{type:String},groupName:{type:String}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(i){const n=i,o=e.useModel(i,"modelValue"),{$t:a}=t.useIntl(),{renderPricingForPricingItem:l}=t.usePricingItem({currency:e.toRef(n,"currency"),billingPeriod:e.toRef(n,"billingPeriod")}),{isMobileViewport:r}=g.useViewport(),c=e.computed(()=>n.pricings.map(e=>e.id)),u=e.computed({get:()=>o.value.find(e=>c.value.includes(e))??void 0,set:e=>{const t=o.value.filter(e=>!c.value.includes(e));o.value=e?[...t,e]:t}}),s=e.computed(()=>n.pricings.map(e=>{var t;const i=null==(t=e.items)?void 0:t[0];return{label:E(e)??"",value:e.id,description:i?l({pricingItem:i}):a({defaultMessage:"Unsupported pricing",id:"pricing_item_pricing.unsupported_pricing_error",description:"Text displayed when the pricing item pricing is unsupported"})}}));return(n,o)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{"no-spacing":""},{default:e.withCtx(()=>[e.createElementVNode("div",Re,[e.createVNode(Se,null,{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.groupName),1)]),_:1}),e.createElementVNode("div",Ue,[s.value.length<=3?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$36),{key:0,modelValue:u.value,"onUpdate:modelValue":o[0]||(o[0]=e=>u.value=e),options:s.value.slice(0,3),direction:e.unref(r)?"column":"row","show-radio":!1},null,8,["modelValue","options","direction"])):s.value.length<=6?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$32),{key:1,"single-model-value":u.value,"onUpdate:singleModelValue":o[1]||(o[1]=e=>u.value=e),options:s.value.map(({value:e,label:t,description:i})=>({label:t,subLabel:i,value:e})),size:"xl","show-sub-label-in-input":""},null,8,["single-model-value","options"])):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$37),{key:2,modelValue:u.value,"onUpdate:modelValue":o[2]||(o[2]=e=>u.value=e),options:s.value,name:`pricing-group-range-input-${i.groupName}`},null,8,["modelValue","options","name"]))])])]),_:1}))}});const $e={class:"sv-plan-customization__body grid grid-cols-1 gap-1"},Ge=e.defineComponent({__name:"PlanCustomizationEditor",props:e.mergeModels({subscription:{type:Object},enabledPricingIds:{type:Array},initialSeatsValues:{type:Array},billingPeriod:{type:Object},currency:{type:String}},{seatsValues:{required:!0},seatsValuesModifiers:{},enabledPricingIds:{required:!0},enabledPricingIdsModifiers:{}}),emits:["update:seatsValues","update:enabledPricingIds"],setup(i){const n=i,o=e.useModel(i,"seatsValues"),a=e.useModel(i,"enabledPricingIds"),{$t:l}=t.useIntl(),r=e.computed(()=>{var e;const t=null==(e=_({pricingPlanScheduleInfos:n.subscription.pricing_plan_schedule_infos,type:"DEFAULT"}))?void 0:e.pricing_plan_version;return t?function(e){var t;return((null==(t=e.pricing_categories)?void 0:t.flatMap(e=>e.pricings??[]))??[]).filter(e=>null!==e)}(t):[]}),c=e.computed(()=>r.value.filter(e=>"ADDON"===e.product_type)),u=e.computed(()=>A(n.subscription));return(n,s)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{class:"sv-plan-customization",title:e.unref(l)({defaultMessage:"Customize plan",id:"checkout.customize_plan_block.title",description:"The title of the customize plan block in the checkout form"}),"no-spacing":"","no-border":"","content-background":"none"},{default:e.withCtx(()=>[e.createElementVNode("div",$e,[e.createVNode(Ve,{modelValue:o.value,"onUpdate:modelValue":s[0]||(s[0]=e=>o.value=e),class:"sv-plan-customization__seats","initial-seats-values":i.initialSeatsValues,pricings:r.value},null,8,["modelValue","initial-seats-values","pricings"]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,t=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:t.id},["DEFAULT"===t.product_type&&"EXACTLY_ONE"===t.selection_constraint?(e.openBlock(),e.createBlock(Fe,{key:0,modelValue:a.value,"onUpdate:modelValue":s[1]||(s[1]=e=>a.value=e),class:"sv-plan-customization__group","group-name":t.name,pricings:t.pricings,"billing-period":i.billingPeriod,currency:i.currency},null,8,["modelValue","group-name","pricings","billing-period","currency"])):"ADDON"===t.product_type&&"AT_MOST_ONE"===t.selection_constraint?(e.openBlock(),e.createBlock(je,{key:1,modelValue:a.value,"onUpdate:modelValue":s[2]||(s[2]=e=>a.value=e),class:"sv-plan-customization__group","group-name":t.name,pricings:t.pricings,constraint:t.selection_constraint,"billing-period":i.billingPeriod,currency:i.currency},null,8,["modelValue","group-name","pricings","constraint","billing-period","currency"])):"ADDON"===t.product_type&&"ANY"===t.selection_constraint?(e.openBlock(),e.createBlock(Oe,{key:2,modelValue:a.value,"onUpdate:modelValue":s[3]||(s[3]=e=>a.value=e),class:"sv-plan-customization__group",pricings:t.pricings,"group-name":t.name,"billing-period":i.billingPeriod,currency:i.currency},null,8,["modelValue","pricings","group-name","billing-period","currency"])):e.createCommentVNode("",!0)],64))),128)),e.createVNode(Oe,{modelValue:a.value,"onUpdate:modelValue":s[4]||(s[4]=e=>a.value=e),class:"sv-plan-customization__group",pricings:c.value,"billing-period":i.billingPeriod,currency:i.currency},null,8,["modelValue","pricings","billing-period","currency"])])]),_:1},8,["title"]))}}),Ye=["aria-expanded","aria-label"],qe={class:"flex w-full cursor-pointer flex-row items-center justify-between gap-3 px-3 py-2"},Qe={class:"flex flex-row items-center gap-2"},Ke=["onKeydown"],He=["aria-label"],Ze={class:"flex w-full cursor-pointer flex-row items-center justify-between gap-3 px-3 py-2"},Xe={class:"flex flex-row items-center gap-2"},We={class:"sr-only","aria-live":"polite"},Je=e.defineComponent({__name:"PromotionCodeSection",props:{promotionCode:{default:null,type:[String,null]}},emits:["update:appliedCode","apply","remove"],setup(i,{emit:n}){const{$t:o}=t.useIntl(),a=i,l=n,r=e.ref(!1),c=e.ref(""),u=e.ref(""),s=e.ref(null),d=e.ref(null),p=t.uniqueId("promotion-code-"),m=`${p}-label`,g=`${p}-panel`,v=e.computed(()=>null!==a.promotionCode&&""!==a.promotionCode),y=e.computed(()=>c.value.trim().length>0),f=e.computed(()=>a.promotionCode??o({defaultMessage:"Promotion applied",id:"checkout.promotion_code.applied_label",description:"Fallback label for an applied promotion code in checkout"})),_=e.computed(()=>o({defaultMessage:r.value?"Collapse promotion code input":"Expand promotion code input",id:r.value?"checkout.promotion_code.collapse_aria_label":"checkout.promotion_code.expand_aria_label",description:"Aria label for the promotion code toggle button in checkout"})),h=e.computed(()=>o({defaultMessage:"Apply promotion code",id:"checkout.promotion_code.apply_aria_label",description:"Aria label for the promotion code apply button in checkout"})),b=e.computed(()=>o({defaultMessage:"Remove promotion code",id:"checkout.promotion_code.remove_aria_label",description:"Aria label for the promotion code remove button in checkout"})),M=()=>{c.value=""},N=()=>{r.value&&(r.value=!1)},I=()=>{v.value||(r.value=!r.value)},k=()=>{if(!y.value)return;const e=c.value.trim();l("update:appliedCode",e),l("apply",e),u.value=o({defaultMessage:"Promotion code applied",id:"checkout.promotion_code.applied_status",description:"Aria live message when a promotion code is applied in checkout"}),r.value=!1},C=()=>{l("update:appliedCode",null),l("remove"),u.value=o({defaultMessage:"Promotion code removed",id:"checkout.promotion_code.removed_status",description:"Aria live message when a promotion code is removed in checkout"}),M(),e.nextTick(()=>{var e;null==(e=s.value)||e.focus()})};return e.watch(r,t=>{if(!t)return M(),void e.nextTick(()=>{var e;null==(e=s.value)||e.focus()});e.nextTick(()=>{(()=>{var e;const t=null==(e=d.value)?void 0:e.querySelector("input");t instanceof HTMLInputElement&&t.focus()})()})}),e.watch(()=>a.promotionCode,e=>{e||M()}),(i,n)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[v.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:1,"no-border":"","no-spacing":"","content-background":"none",class:"relative w-full"},{default:e.withCtx(()=>[e.createElementVNode("button",{type:"button",class:"w-full rounded border border-primary-900 bg-white","aria-label":b.value,onClick:C},[e.createElementVNode("div",Ze,[e.createElementVNode("div",Xe,[e.createVNode(e.unref(t._sfc_main$6),{icon:"local_activity"}),e.createVNode(e.unref(t._sfc_main),{variant:"body-sm",class:"font-semibold"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.value),1)]),_:1})]),e.createVNode(e.unref(t._sfc_main$6),{icon:"close"})])],8,He)]),_:1})):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0,"no-spacing":"",class:"relative w-full"},{default:e.withCtx(()=>[e.createElementVNode("button",{ref_key:"toggleRef",ref:s,type:"button",class:"w-full","aria-expanded":r.value,"aria-controls":g,"aria-label":_.value,onClick:I},[e.createElementVNode("div",qe,[e.createElementVNode("div",Qe,[e.createVNode(e.unref(t._sfc_main$6),{icon:"local_activity"}),e.createVNode(e.unref(t._sfc_main),{id:m,variant:"body-sm"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"Add promotion code",id:"checkout.promotion_code.add_label",description:"Label for adding a promotion code in checkout"})),1)]),_:1})]),e.createVNode(e.unref(t._sfc_main$6),{icon:r.value?"remove":"add"},null,8,["icon"])])],8,Ye),e.withDirectives(e.createElementVNode("div",{id:g,ref_key:"panelRef",ref:d,role:"region","aria-labelledby":m,class:"flex w-full flex-row items-center gap-2 overflow-hidden border-t px-3 py-2",onKeydown:e.withKeys(e.withModifiers(N,["prevent"]),["esc"])},[e.createVNode(e.unref(t._sfc_main$20),{modelValue:c.value,"onUpdate:modelValue":n[0]||(n[0]=e=>c.value=e),placeholder:e.unref(o)({defaultMessage:"Promotion code",id:"checkout.promotion_code.placeholder",description:"Placeholder for promotion code input in checkout"}),"aria-label":e.unref(o)({defaultMessage:"Promotion code",id:"checkout.promotion_code.input_aria_label",description:"Aria label for promotion code input in checkout"}),class:"w-full",onKeydown:e.withKeys(e.withModifiers(k,["prevent"]),["enter"])},null,8,["modelValue","placeholder","aria-label","onKeydown"]),e.createVNode(e.unref(t._sfc_main$3),{type:"button",disabled:!y.value,"aria-label":h.value,"aria-disabled":!y.value,onClick:k},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)({defaultMessage:"Apply",id:"checkout.promotion_code.apply_button",description:"Button label for applying a promotion code in checkout"})),1)]),_:1},8,["disabled","aria-label","aria-disabled"])],40,Ke),[[e.vShow,r.value]])]),_:1})),e.createElementVNode("span",We,e.toDisplayString(u.value),1)],64))}}),et={class:"flex justify-around"},tt={class:"flex items-center gap-0.5"},it={key:0,xmlns:"http://www.w3.org/2000/svg",width:"40",height:"15",fill:"none",viewBox:"0 0 40 15",class:"inline-block translate-y-[1px]"},nt=e.defineComponent({__name:"SecurePaymentsKPI",props:{paymentMethodOptions:{type:Array}},setup(i){const n=i,{$t:o}=t.useIntl(),a=e.computed(()=>n.paymentMethodOptions.find(({integration:e})=>{var t;return"ADYEN"===(null==(t=e.payment_gateway)?void 0:t.variant)})),l=e.computed(()=>a.value?o({defaultMessage:"Secure and encrypted payments by",description:"Secure encrypted payments KPI for a specific vendor, followed by a vendor logo",id:"secure_payments_kpi.specific_vendor"}):o({defaultMessage:"Secure and encrypted payments",description:"Secure encrypted payments KPI",id:"secure_payments_kpi.generic"}));return(i,n)=>(e.openBlock(),e.createElementBlock("div",et,[e.createElementVNode("div",tt,[e.createVNode(e.unref(t._sfc_main$6),{icon:"lock",size:"xs"}),e.createVNode(e.unref(t._sfc_main),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.value)+" ",1),a.value?(e.openBlock(),e.createElementBlock("svg",it,[...n[0]||(n[0]=[e.createElementVNode("path",{fill:"currentColor",d:"M.049 2.917h5.845c.646 0 1.17.522 1.17 1.166v5.834H1.217c-.646 0-1.17-.522-1.17-1.167V5.833h2.924v2.334H4.14v-3.5H.049zM32.784 2.917v7h2.922v-5.25h1.17v5.25h2.922V4.083c0-.644-.523-1.166-1.169-1.166zM16.417 12.833h5.845c.646 0 1.17-.522 1.17-1.166v-8.75h-2.924v5.25H19.34v-5.25h-2.922V8.75c0 .645.523 1.167 1.169 1.167h2.922v1.166h-4.091zM31.614 9.917H25.77c-.646 0-1.17-.522-1.17-1.167V2.917h5.846c.646 0 1.17.522 1.17 1.166V7h-2.923V4.667h-1.17v3.5h4.092zM15.248 0v9.917H9.402c-.646 0-1.17-.522-1.17-1.167V4.083c0-.644.524-1.166 1.17-1.166h1.754v5.25h1.169V0z"},null,-1)])])):e.createCommentVNode("",!0)]),_:1})])]))}}),ot={class:"sv-checkout__header"},at={key:5,class:"sv-checkout__payment-methods"},lt={key:0,class:"sv-checkout__payment-methods-body"},rt={key:2,class:"sv-checkout__payment-form"},ct={class:"sv-checkout__order-summary"},ut={class:"flex flex-col gap-2"},st=e.defineComponent({__name:"Checkout",props:{configuration:{type:Object}},emits:["error","ready"],setup(n,{emit:o}){var a,l,r,c,u,d,m,y;const h=e.defineAsyncComponent(()=>Promise.resolve().then(()=>require("../../PaymentIntegrationForm-bfGmfwQT.js"))),b=n,N=o,I=e.computed(()=>b.configuration),k=e.ref(),C=e.ref(),D=i.useLogger(),{$t:E,locale:P}=t.useIntl(),{formatTimePeriod:V}=t.useTimePeriod(),x=s.usePortal(),{isMobileViewport:B}=g.useViewport();if(D.info("COMPONENT_INITIALIZED","Checkout component initialized"),"INIT_PRICING_PLAN_SUBSCRIPTION"!==(null==(a=x.value)?void 0:a.type))throw D.error("INVALID_TOKEN","Invalid token"),Error("Invalid token");"REVOKED"===x.value.status&&(k.value={code:"RESOURCE_REVOKED",message:`Portal url with resource id "${x.value.id}" is revoked`},D.error("RESOURCE_REVOKED",`Portal url with resource id "${x.value.id}" is revoked`));const S=null==(r=null==(l=x.value)?void 0:l.init_pricing_plan_subscription)?void 0:r.pricing_plan_subscription_id,T=null==(u=null==(c=x.value)?void 0:c.init_pricing_plan_subscription)?void 0:u.success_url,{paymentMethodOptions:L,subscription:j,isPaymentMethodsPending:z,isInvoicePreviewPending:O,checkoutForm:R,invoicePreview:F,invoicePreviewByBillingPeriod:$,trialInvoicePreview:G,trialPeriod:q,authorizationContext:Q,isPaid:Z,amount:X,loadInvoicePreview:W,updateInvoicePreviewOnBillingInformationChange:J}=w({initialCountry:null==(d=b.configuration)?void 0:d.countryCode,initialEmail:null==(m=b.configuration)?void 0:m.email,subscriptionId:S,enabledPricingIds:null==(y=b.configuration)?void 0:y.enabledPricingIds}),ee=async()=>{var e;await R.validation.value.$validate(),R.validation.value.$invalid||null==(e=C.value)||e.submit()},te=async()=>(await R.validation.value.$validate(),!R.validation.value.$invalid),ie=e.computed(()=>!!G.value),ne=e.computed(()=>!!F.value&&(e=>{var t;return(null==(t=e.periods)?void 0:t.some(e=>e.groups.some(e=>{var t;return null==(t=e.lines)?void 0:t.some(e=>e.product_items.some(e=>"USAGE_BASED"===e.model_type))})))??!1})(F.value)),ae=e.computed(()=>R.form.value.country&&["US","CA"].includes(R.form.value.country)||!1),re=e.computed({get:()=>R.form.value.enabledPricingIds??[],set:e=>{R.form.value.enabledPricingIds=e}}),ce=e.computed(()=>j.value?_({pricingPlanScheduleInfos:j.value.pricing_plan_schedule_infos,type:"DEFAULT"}):void 0),ue=e.computed(()=>{var e,t;if(!j.value)return;const i=null==(t=null==(e=ce.value)?void 0:e.pricing_plan_version)?void 0:t.pricing_currency_settings;return M({country:R.form.value.country,pricingCurrencySettings:i,fallbackCurrency:j.value.billing_currency})}),se=e.computed(()=>{if(!ce.value||!j.value)return new Set;const e=function({pricingPlanScheduleInfo:e}){const t=new Map;return(e.pricing_plan_version.pricing_categories??[]).forEach(e=>{var i;null==(i=e.pricings)||i.forEach(e=>{var i;null==(i=e.items)||i.forEach(e=>{var i,n,o;null==(i=e.billing_period_configs)||i.forEach(e=>{var i;null==(i=e.configs)||i.forEach(i=>{var n,o,a,l;if(i.id){const r=null==(l=null==(a=null==(o=null==(n=i.details)?void 0:n.bands)?void 0:o.find(e=>{var t;return null==(t=e.amount)?void 0:t.currency}))?void 0:a.amount)?void 0:l.currency;t.set(i.id,{...r&&{currency:r},billingPeriod:e.billing_period})}})}),null==(n=e.configs)||n.forEach(e=>{var i,n,o,a;if(e.id){const l=null==(a=null==(o=null==(n=null==(i=e.details)?void 0:i.bands)?void 0:n.find(e=>{var t;return null==(t=e.amount)?void 0:t.currency}))?void 0:o.amount)?void 0:a.currency;t.set(e.id,{...l&&{currency:l}})}}),null==(o=e.pricing_currency_configs)||o.forEach(e=>{var i,n;const o=e.currency;null==(i=e.billing_period_configs)||i.forEach(e=>{var i;null==(i=e.configs)||i.forEach(i=>{i.id&&t.set(i.id,{currency:o,billingPeriod:e.billing_period})})}),null==(n=e.configs)||n.forEach(e=>{e.id&&t.set(e.id,{currency:o})})})})})}),t}({pricingPlanScheduleInfo:ce.value}),t=ue.value,i=j.value.billing_period,n=new Set;return e.forEach((e,o)=>{t&&e.currency!==t||i&&e.billingPeriod&&(e.billingPeriod.type!==i.type||e.billingPeriod.value!==i.value)||n.add(o)}),n}),de=e.computed({get:()=>{const e=R.form.value.seatsValues??[],t=se.value;return t.size?e.filter(({pricing_item_config_id:e})=>t.has(e)):e},set:e=>{const t=R.form.value.seatsValues??[],i=se.value;if(!i.size)return void(R.form.value.seatsValues=e);const n=t.filter(({pricing_item_config_id:e})=>!i.has(e));R.form.value.seatsValues=n.concat(e)}}),pe=e.computed(()=>{var e,i,n,o,a;return G.value?E({defaultMessage:"{discounted_amount} for {trial_period}, then {subscription_amount}/{billing_period} until canceled, starting {start_date, date, ::MMMMd}.",id:"checkout.agreement.trial",description:"The agreement for the trial period"},{discounted_amount:"0.00"===G.value.tax_summary.total_amount.quantity?E({defaultMessage:"Free",id:"checkout.agreement.trial.free",description:"The free amount for the trial period"}):t.formatAmount(G.value.tax_summary.total_amount),trial_period:V(q.value,{short:!0}),subscription_amount:t.formatAmount((null==(e=F.value)?void 0:e.tax_summary.total_amount)??{quantity:"0.00",currency:"EUR"}),billing_period:V((null==(i=F.value)?void 0:i.billing_period)??{type:"MONTH",value:1},{short:!0,singular:!0,hideValueForExactPeriods:!0}),start_date:new Date(Me.value)}):E({defaultMessage:"{subscription_amount}/{billing_period} until canceled, starting {start_date, date, long}.",id:"checkout.agreement.subscription",description:"The agreement for the subscription"},{subscription_amount:(null==(n=F.value)?void 0:n.tax_summary.total_amount)?t.formatAmount(null==(o=F.value)?void 0:o.tax_summary.total_amount):"",billing_period:V((null==(a=F.value)?void 0:a.billing_period)??{type:"MONTH",value:1},{short:!0,singular:!0,hideValueForExactPeriods:!0}),start_date:new Date(Me.value)})}),me=e.computed(()=>{var e,t,i,n,o,a;if(!F.value)return;const l=(null==(e=j.value)?void 0:e.name)??(null==(o=null==(n=null==(i=null==(t=j.value)?void 0:t.pricing_plan_schedule_infos)?void 0:i.at(-1))?void 0:n.pricing_plan_version.pricing_plan)?void 0:o.name)??"Subscription";return{description:l,managementURL:"https://www.solvimon.com/account/billing",agreement:pe.value,...G.value&&q.value&&{trial:{label:E({defaultMessage:"Trial",id:"checkout.trial.label",description:"The label of the trial"}),amount:G.value.tax_summary.total_amount,startDate:fe.value?new Date(fe.value):void 0,endDate:he.value?new Date(he.value):void 0}},regular:{label:l,amount:F.value.tax_summary.total_amount,startDate:Me.value?new Date(Me.value):void 0,interval:(null==(a=j.value)?void 0:a.billing_period)??{type:"MONTH",value:1}}}}),ge=e=>t.isValidCountryCode(e),ve=e=>{const{country:t,...i}=e;R.updateInitialState({...i,...t&&ge(t)?{country:t}:{}})},ye=e.computed(()=>{var e,t;return!((null==(e=b.configuration)?void 0:e.email)&&(null==(t=b.configuration)?void 0:t.countryCode))}),fe=e.computed(()=>{var e,t,i;const n=null==(t=null==(e=G.value)?void 0:e.periods)?void 0:t[0],o=null==(i=_e.value)?void 0:i.trialStartDate;return(null==n?void 0:n.start_at)?new Date(n.start_at):o}),_e=e.computed(()=>function(e){var t;const i={trialStartDate:void 0,trialEndDate:void 0,subscriptionStartDate:void 0,subscriptionEndDate:void 0};if(!(null==(t=null==e?void 0:e.pricing_plan_schedule_infos)?void 0:t.length))return i;const n=new Date,o=_({type:"TRIAL",pricingPlanScheduleInfos:e.pricing_plan_schedule_infos});if((null==o?void 0:o.start_at)&&(i.trialStartDate=n,o.end_at)){const e=new Date(o.end_at).getTime()-new Date(o.start_at).getTime();i.trialEndDate=new Date(n.getTime()+e)}const a=_({type:"DEFAULT",pricingPlanScheduleInfos:e.pricing_plan_schedule_infos});if((null==a?void 0:a.start_at)&&(i.trialEndDate?i.subscriptionStartDate=i.trialEndDate:i.subscriptionStartDate=n,a.end_at)){const e=new Date(a.end_at).getTime()-new Date(a.start_at).getTime();i.subscriptionEndDate=new Date(n.getTime()+e)}return i}(j.value)),he=e.computed(()=>{var e,t,i;const n=null==(t=null==(e=G.value)?void 0:e.periods)?void 0:t[0],o=null==(i=_e.value)?void 0:i.trialEndDate;return(null==n?void 0:n.end_at)?new Date(n.end_at):o}),Me=e.computed(()=>{var e,t,i;const n=null==(t=null==(e=F.value)?void 0:e.periods)?void 0:t[0],o=null==(i=_e.value)?void 0:i.subscriptionStartDate;return(null==n?void 0:n.start_at)?new Date(n.start_at):o}),Ne=e.computed(()=>!!(R.form.value.seatsValues&&R.form.value.seatsValues.length>0)||(!(!j.value||!function(e){return A(e).some(e=>"EXACTLY_ONE"===e.selection_constraint||"AT_LEAST_ONE"===e.selection_constraint)}(j.value))||!(!j.value||!function(e){const t=e.pricing_plan_schedule_infos.flatMap(e=>{var t;return(null==(t=e.pricing_plan_version.pricing_categories)?void 0:t.flatMap(e=>e.pricings??[]))??[]}),i=A(e);return t.some(e=>"ADDON"===e.product_type)||i.some(e=>"ADDON"===e.object_type)}(j.value)))),Ie=e.ref(null),{applyPromotionCode:ke,removePromotionCode:Ce,isPromotionCodePending:De,promotionCodeErrorMessage:Ae}=function({checkoutForm:t,updateInvoicePreviewOnBillingInformationChange:n,formatErrorMessage:o,onInvalidPromotionCode:a,onApplyError:l}){const r=i.useLogger(),c=e.ref(!1),u=e.ref(null),s=(e,t)=>{u.value=o?o({action:e,error:t}):"apply"===e?"Promotion code could not be applied. Please try again.":"Promotion code could not be removed. Please try again."},d=async({suppressError:e=!1,preserveErrorMessage:i=!1}={})=>{i||(u.value=null),delete t.form.value.promotionCode,c.value=!0;try{await n({})}catch(o){r.capture(o,{code:"PROMOTION_CODE_REMOVE_FAILED",message:"Failed to remove promotion code"}),e||s("remove",o)}finally{c.value=!1}};return{applyPromotionCode:async e=>{const i=null==e?void 0:e.trim();if(i){u.value=null,t.form.value.promotionCode=i,c.value=!0;try{await n({promotionCode:i})}catch(o){r.capture(o,{code:"PROMOTION_CODE_APPLY_FAILED",message:"Failed to apply promotion code"}),s("apply",o),null==l||l(),(e=>function(e){return"object"==typeof e&&null!==e&&"field"in e}(e)&&"promotion_codes"===e.field)(o)&&(null==a||a()),await d({suppressError:!0,preserveErrorMessage:!0})}finally{c.value=!1}}},removePromotionCode:d,isPromotionCodePending:c,promotionCodeErrorMessage:u}}({checkoutForm:R,updateInvoicePreviewOnBillingInformationChange:J,formatErrorMessage:({action:e})=>E("apply"===e?{defaultMessage:"Promotion code could not be applied. Please try again.",id:"checkout.promotion_code.apply_failed",description:"Error message when applying a promotion code in checkout failed"}:{defaultMessage:"Promotion code could not be removed. Please try again.",id:"checkout.promotion_code.remove_failed",description:"Error message when removing a promotion code in checkout failed"}),onInvalidPromotionCode:()=>{Ie.value=null},onApplyError:()=>{Ie.value=null}}),Ee=()=>{T&&p.safeUrlRedirect(T)},Pe=()=>{var e;Z.value=!0,Ae.value=null,(null==(e=b.configuration)?void 0:e.onPaymentSuccess)?b.configuration.onPaymentSuccess():T&&Ee()},we=e=>{j.value&&(j.value={...j.value,billing_period:e},W())};return e.onMounted(()=>{N("ready")}),(i,n)=>k.value?(e.openBlock(),e.createBlock(K,{key:0,class:"sv-checkout sv-root sv-screen sv-checkout--error"})):(e.openBlock(),e.createBlock(e.unref(f.ContentWithAsideLayout),{key:1,class:e.normalizeClass(["sv-checkout sv-root sv-screen",{"sv-checkout--paid":e.unref(Z)}])},{header:e.withCtx(()=>[e.createElementVNode("div",ot,[e.createVNode(v._sfc_main,{class:"min-h-[52px] w-96"},{default:e.withCtx(()=>{var t,i,n;return[e.unref(F)&&e.unref(j)&&Me.value?(e.openBlock(),e.createBlock(Y,{key:0,class:"sv-checkout__title","trial-start-date":fe.value,"trial-period":e.unref(q),"subscription-start-date":Me.value,"subscription-name":(null==(t=e.unref(j))?void 0:t.name)??"",amount:null==(i=e.unref(F))?void 0:i.invoice_amount_including_tax,"billing-period":null==(n=e.unref(j))?void 0:n.billing_period,"country-code":e.unref(R).form.value.country},null,8,["trial-start-date","trial-period","subscription-start-date","subscription-name","amount","billing-period","country-code"])):e.createCommentVNode("",!0)]}),_:1})])]),content:e.withCtx(()=>{var i,o,a;return[e.unref(j)&&e.unref(B)?(e.openBlock(),e.createBlock(oe,{key:0,class:"sv-checkout__mobile-order-summary",subscription:e.unref(j),invoice:e.unref(F),"invoice-preview-by-billing-period":e.unref($),"trial-invoice":e.unref(G),"enabled-pricing-ids":re.value,"trial-period":e.unref(q),avatar:null==(i=I.value)?void 0:i.avatar,"is-paid":e.unref(Z),"is-usage-based":ne.value,"is-preview-and-payment-methods-pending":e.unref(z)||e.unref(O),"country-code":e.unref(R).form.value.country,collapsible:"collapsed",variant:"products-inline",onBillingPeriodChange:we},null,8,["subscription","invoice","invoice-preview-by-billing-period","trial-invoice","enabled-pricing-ids","trial-period","avatar","is-paid","is-usage-based","is-preview-and-payment-methods-pending","country-code"])):e.createCommentVNode("",!0),Ne.value&&e.unref(j)?(e.openBlock(),e.createBlock(Ge,{key:1,"seats-values":de.value,"onUpdate:seatsValues":n[0]||(n[0]=e=>de.value=e),"enabled-pricing-ids":re.value,"onUpdate:enabledPricingIds":n[1]||(n[1]=e=>re.value=e),class:"sv-checkout__plan-customization",subscription:e.unref(j),"initial-seats-values":null==(o=e.unref(R).initialState)?void 0:o.value.seatsValues,"billing-period":e.unref(j).billing_period,currency:ue.value},null,8,["seats-values","enabled-pricing-ids","subscription","initial-seats-values","billing-period","currency"])):e.createCommentVNode("",!0),!e.unref(Z)&&e.unref(R).form.value.country&&e.unref(X)&&me.value?(e.openBlock(),e.createBlock(be,{key:2,class:"sv-checkout__express-payment-methods",amount:e.unref(X),"country-code":e.unref(R).form.value.country,locale:e.unref(P),"payment-methods-options-response":e.unref(L)??[],"billing-information":me.value,"on-billing-information-change":e.unref(J),onUpdateBillingInformation:ve},null,8,["amount","country-code","locale","payment-methods-options-response","billing-information","on-billing-information-change"])):e.createCommentVNode("",!0),e.unref(Z)?(e.openBlock(),e.createBlock(H,{key:3,class:"sv-checkout__completed-payment",onContinueToMerchant:Ee})):e.createCommentVNode("",!0),e.unref(Z)?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(U,{key:4,modelValue:e.unref(R).form.value,"onUpdate:modelValue":n[2]||(n[2]=t=>e.unref(R).form.value=t),class:"sv-checkout__customer-form",validation:e.unref(R).validation,"read-only-email":null==(a=b.configuration)?void 0:a.email,"show-customer-info-on-top":ye.value||e.unref(Z),"is-billing-information-mandatory":ae.value,"get-is-field-required":e.unref(R).getIsFieldRequired,"read-only":e.unref(Z)},null,8,["modelValue","validation","read-only-email","show-customer-info-on-top","is-billing-information-mandatory","get-is-field-required","read-only"])),e.unref(Z)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",at,[e.createVNode(v._sfc_main,{variant:"section",class:"min-h-[130px]"},{default:e.withCtx(()=>[!e.unref(z)||e.unref(z)&&e.unref(L).length>0?(e.openBlock(),e.createElementBlock("div",lt,[e.createVNode(e.unref(t._sfc_main),{variant:"heading-3",tag:"h2",class:"sv-checkout__payment-methods-title mb-2"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(E)({defaultMessage:"Payment method",id:"checkout.payment_method_block.title",description:"The title of the payment method block in the checkout form"})),1)]),_:1}),e.unref(R).form.value.country?0===e.unref(L).length?(e.openBlock(),e.createBlock(le,{key:1,class:"sv-checkout__payment-methods-empty",icon:"credit_card_off"},{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(E)({defaultMessage:"No payment methods available",id:"checkout.payment_method_block.no_payment_methods_available_title",description:"The title shown when there are no available payment methods"})),1)]),message:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(E)({defaultMessage:"There are no available payment methods. Please contact support for more information.",id:"checkout.payment_method_block.no_payment_methods_available_message",description:"The message shown when there are no available payment methods"})),1)]),_:1})):e.unref(X)&&e.unref(R).form.value.country?(e.openBlock(),e.createElementBlock("div",rt,[e.createVNode(e.unref(h),{ref_key:"paymentIntegrationFormRef",ref:C,"country-code":e.unref(R).form.value.country,context:e.unref(Q),amount:e.unref(X),variant:"AUTHORIZE","payment-method-options":e.unref(L)??[],"validate-on-submit":te,"force-store-payment-method":"",onPaymentSuccess:Pe,onReady:n[3]||(n[3]=e=>N("ready"))},null,8,["country-code","context","amount","payment-method-options"])])):e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(le,{key:0,class:"sv-checkout__payment-methods-empty",icon:"captive_portal"},{title:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(E)({defaultMessage:"Select your billing country",id:"checkout.payment_method_block.no_country_selected_title",description:"The title shown when no country is selected"})),1)]),message:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(E)({defaultMessage:"Payment methods will be shown after you select the billing country.",id:"checkout.payment_method_block.no_country_selected_message",description:"The message shown when no country is selected"})),1)]),_:1}))])):e.createCommentVNode("",!0)]),_:1})]))]}),aside:e.withCtx(()=>[e.createElementVNode("div",ct,[e.createVNode(v._sfc_main,{variant:"section",class:"min-h-[220px]"},{default:e.withCtx(()=>{var t;return[e.unref(j)&&e.unref(F)?(e.openBlock(),e.createBlock(oe,{key:0,subscription:e.unref(j),invoice:e.unref(F),"invoice-preview-by-billing-period":e.unref($),"trial-invoice":e.unref(G),"enabled-pricing-ids":re.value,"trial-period":e.unref(q),"country-code":e.unref(R).form.value.country,avatar:null==(t=I.value)?void 0:t.avatar,"is-paid":e.unref(Z),"is-usage-based":ne.value,"is-preview-and-payment-methods-pending":e.unref(z)||e.unref(O),onBillingPeriodChange:we},null,8,["subscription","invoice","invoice-preview-by-billing-period","trial-invoice","enabled-pricing-ids","trial-period","country-code","avatar","is-paid","is-usage-based","is-preview-and-payment-methods-pending"])):e.createCommentVNode("",!0)]}),_:1})]),e.unref(Z)?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(Je,{key:0,class:"sv-checkout__promotion-code","promotion-code":Ie.value,"onUpdate:appliedCode":n[4]||(n[4]=e=>Ie.value=e),onRemove:e.unref(Ce),onApply:e.unref(ke)},null,8,["promotion-code","onRemove","onApply"])),e.unref(Ae)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$15),{key:1,class:"sv-checkout__promotion-error mt-2",title:e.unref(Ae)},null,8,["title"])):e.createCommentVNode("",!0),e.createElementVNode("div",ut,[e.unref(Z)?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(v._sfc_main,{key:0,class:"sv-checkout__submit-skeleton min-h-[44px]"},{default:e.withCtx(()=>[e.unref(F)?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,type:"button",size:"lg",class:"sv-action sv-action--primary sv-action--full-width sv-checkout__submit w-full",disabled:e.unref(De)||0===e.unref(L).length,onClick:ee},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(ie.value?e.unref(E)({defaultMessage:"Start trial",id:"checkout.pay_and_subscribe_button_trial.label",description:"The label of the start trial button in the checkout form"}):e.unref(E)({defaultMessage:"Pay and subscribe",id:"checkout.pay_and_subscribe_button.label",description:"The label of the pay and subscribe button in the checkout form"})),1)]),_:1},8,["disabled"])):e.createCommentVNode("",!0)]),_:1})),e.createVNode(nt,{"payment-method-options":e.unref(L)},null,8,["payment-method-options"])])]),_:1},8,["class"]))}}),dt=e.defineComponent({__name:"Checkout.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},emits:["error","ready"],setup(n,{emit:o}){var a,l;const r=n,c=o,u=i.useLogger(),s=(e=>{if(e)return t.isValidCountryCode(e)?e:void u.error("INVALID_COUNTRY_CODE",`invalid country code provided: "${e}"`)})(null==(a=r.configuration)?void 0:a.countryCode),d=(e=>{if(e)return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)?e:void u.error("INVALID_EMAIL",`invalid email provided: "${e}"`)})(null==(l=r.configuration)?void 0:l.email);return(t,o)=>{var a,l,r,u;return e.openBlock(),e.createBlock(i._sfc_main,{"custom-element-name":e.unref(mt),environment:n.environment,locale:n.locale,"portal-object":n.portalObject,"allowed-portal-types":["INIT_PRICING_PLAN_SUBSCRIPTION"],"primary-color":null==(l=null==(a=n.branding)?void 0:a.colors)?void 0:l.primary,"secondary-color":null==(u=null==(r=n.branding)?void 0:r.colors)?void 0:u.secondary,"experimental-features":n.experimentalFeatures,"log-level":n.logLevel,"on-log":n.onLog,"css-overrides":n.cssOverrides,onError:o[1]||(o[1]=e=>t.$emit("error",e))},{default:e.withCtx(()=>{var i,a,l;return[e.createVNode(st,{configuration:{avatar:null==(a=null==(i=n.branding)?void 0:i.emblem)?void 0:a.public_url,email:e.unref(d),countryCode:e.unref(s),enabledPricingIds:null==(l=n.configuration)?void 0:l.enabledPricingIds},onReady:o[0]||(o[0]=e=>c("ready"))},e.createSlots({_:2},[t.$slots["terms-and-conditions"]?{name:"terms-and-conditions",fn:e.withCtx(()=>[e.renderSlot(t.$slots,"terms-and-conditions")]),key:"0"}:void 0]),1032,["configuration"])]}),_:3},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log","css-overrides"])}}}),pt=i.defineCustomElement(dt),mt=i.getComponentName("checkout");exports.COMPONENT_NAME=mt,exports.SolvimonCheckout=pt,exports.defineSolvimonCheckout=()=>{customElements.get(mt)||customElements.define(mt,pt)};
@@ -1,11 +1,11 @@
1
- import { ref, computed, onMounted, toRaw, watch, defineComponent, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString, useModel, createElementBlock, withModifiers, Fragment, createCommentVNode, createSlots, normalizeClass, mergeModels, renderSlot, renderList, toRef, nextTick, withDirectives, withKeys, vShow, defineAsyncComponent } from "vue";
1
+ import { ref, computed, onMounted, watch, defineComponent, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString, useModel, createElementBlock, withModifiers, Fragment, createCommentVNode, createSlots, normalizeClass, mergeModels, renderSlot, renderList, toRef, nextTick, withDirectives, withKeys, vShow, defineAsyncComponent } from "vue";
2
2
  import { U as taxId, k as isEqual, V as convertDateRangeToTimePeriod, H as useValidation, J as objectDiff, W as isEmpty, u as useIntl, X as _sfc_main$q, _ as _sfc_main$r, Y as isEUCountry, Z as isValidCountryCode, $ as getCountryNameByCode, b as _sfc_main$s, M as _sfc_main$t, N as _sfc_main$u, e as _sfc_main$v, a0 as _sfc_main$w, O as _sfc_main$x, a1 as _sfc_main$y, a2 as _sfc_main$z, a3 as _sfc_main$A, a4 as TooltipContent, a5 as _sfc_main$B, a6 as formatBillingPeriod, x as formatAmount, a7 as _sfc_main$D, a8 as useTimePeriod, f as _sfc_main$E, a9 as _sfc_main$G, aa as _sfc_main$H, ab as _sfc_main$I, l as _sfc_main$J, D as _sfc_main$L, ac as _sfc_main$M, ad as usePricingItem, ae as _sfc_main$N, af as _sfc_main$O, ag as uniqueId, B as _sfc_main$P } from "../../vendor-ui-C0K3osvz.mjs";
3
3
  import { a as useLogger, _ as _sfc_main$Q, d as defineCustomElement, g as getComponentName } from "../../component-Djrf1L-Z.mjs";
4
4
  import { c as createSubscriptionsService } from "../../subscriptions-ClGIr_aS.mjs";
5
5
  import { A as ApiStatus } from "../../ApiStatus-CyNDp_op.mjs";
6
6
  import { c as createInvoicesService } from "../../invoices-DIYPN2j_.mjs";
7
7
  import { a as requiredIf, r as required, e as email } from "../../index-CzL1ZcGi.mjs";
8
- import { u as useWatchDebounced } from "../../useWatchDebounced-D1xuIX6_.mjs";
8
+ import { u as useWatchDebounced } from "../../useWatchDebounced-Zmxd6InB.mjs";
9
9
  import { c as createPaymentMethodsService } from "../../paymentMethods-67b3UlTZ.mjs";
10
10
  import { u as useService } from "../../useService-BsSEI8DZ.mjs";
11
11
  import { u as usePortal } from "../../usePortal-cmE08vYs.mjs";
@@ -576,7 +576,7 @@ function useCheckoutForm({
576
576
  const updateInitialState = (state) => {
577
577
  const newState = getInitialState({ ...form.value, ...state });
578
578
  form.value = newState;
579
- initialFormState.value = structuredClone(toRaw(newState));
579
+ initialFormState.value = structuredClone(newState);
580
580
  };
581
581
  const requiredFields = computed(
582
582
  () => getRequiredFieldsForCountry(form.value.country)
@@ -627,9 +627,11 @@ function useCheckoutForm({
627
627
  onMounted(async () => {
628
628
  await getCountryFromGeoLocationService(initialState == null ? void 0 : initialState.country);
629
629
  });
630
- useWatchDebounced(() => structuredClone(toRaw(form.value)), handleFormChange, {
631
- debounce: 200
632
- });
630
+ useWatchDebounced(
631
+ () => JSON.parse(JSON.stringify(form.value)),
632
+ handleFormChange,
633
+ { debounce: 200 }
634
+ );
633
635
  return {
634
636
  form,
635
637
  validation,
@@ -1011,15 +1013,19 @@ function useCheckoutView({
1011
1013
  } catch {
1012
1014
  }
1013
1015
  });
1014
- watch(shouldLoadPaymentMethodOptions, (shouldLoad) => {
1015
- if (shouldLoad) {
1016
- void loadPaymentMethodOptions({
1017
- subscriptionId: subscription.value.id,
1018
- country: checkoutForm.form.value.country,
1019
- amount: amount.value
1020
- });
1021
- }
1022
- }, { once: true });
1016
+ watch(
1017
+ shouldLoadPaymentMethodOptions,
1018
+ (shouldLoad) => {
1019
+ if (shouldLoad) {
1020
+ void loadPaymentMethodOptions({
1021
+ subscriptionId: subscription.value.id,
1022
+ country: checkoutForm.form.value.country,
1023
+ amount: amount.value
1024
+ });
1025
+ }
1026
+ },
1027
+ { once: true }
1028
+ );
1023
1029
  return {
1024
1030
  invoicePreview: invoicePreview.invoicePreview,
1025
1031
  invoicePreviewByBillingPeriod: invoicePreview.invoicePreviewByBillingPeriod,
@@ -4265,7 +4271,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
4265
4271
  setup(__props, { emit: __emit }) {
4266
4272
  var _a, _b, _c, _d, _e, _f, _g, _h;
4267
4273
  const PaymentIntegrationForm = defineAsyncComponent(
4268
- () => import("../../PaymentIntegrationForm-DFnwutjd.mjs")
4274
+ () => import("../../PaymentIntegrationForm-CkXYj9xs.mjs")
4269
4275
  );
4270
4276
  const props = __props;
4271
4277
  const emit = __emit;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../component-BOqPDAVk.js"),n=require("../../vendor-ui-5pJF5KBP.js"),o=require("../../ContentWithAsideLayout-B5B8Kwaw.js"),a=require("../../PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-DTIY4s7C.js"),r=require("../../Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),i=require("../../adyen-R6aSZ0Yf.js"),c=require("../../useLoadInitialData-DjwRHcAH.js"),l=require("../../usePayments-DWXPGFvp.js"),s=require("../../usePaymentMethodOptions-DYO6xr3-.js"),u=require("../../usePaymentMethods-ryN_YohI.js"),p=e.defineComponent({__name:"PayButton",props:{amount:{type:Object},paymentMethod:{type:Object},type:{type:String},variant:{type:String},color:{type:String},size:{type:String},pill:{type:Boolean},square:{type:Boolean},loading:{type:Boolean},disabled:{type:Boolean},iconPrefix:{type:null},iconSuffix:{type:null},tag:{type:String}},emits:["click"],setup(t){const o=t,{$t:a}=n.useIntl(),r=e.computed(()=>({color:o.color??"primary",disabled:o.disabled,iconPrefix:o.iconPrefix,iconSuffix:o.iconSuffix,loading:o.loading,pill:o.pill,size:o.size??"lg",square:o.square,tag:o.tag,type:o.type,variant:o.variant})),i=e.computed(()=>{var t,n,a;switch(null==(t=o.paymentMethod)?void 0:t.paymentMethodType){case"scheme":return"Credit Card";case"applepay":return"Apple Pay";case"googlepay":return"Google Pay";case"paypal":return"PayPal";case"ideal":return"iDeal";case"klarna":return"Klarna";case"bcmc":return"BCMC";case"sepadirectdebit":return"SEPA";case"twint":return"Twint";case"swish":return"Swish";case"vipps":return"Vipps";case"mbway":return"MBway";case"alipay":return"AliPay";case"wechatpayWeb":return"WeChatPay";case"afterpay_default":return"Afterpay";case"affirm":return"Affirm";case"ach":return"ACH";case"blik":return"Blik";case"cashapp":return"Cash App Pay";case"amazonpay":return"Amazon Pay";case"venmo":return"Venmo";case"clicktopay":return"Click to Pay";case"upi":return"UPI";case"revolutpay":return"Revolut Pay";case"ratepay":return"Ratepay";case"walley":return"Walley";case"alma":return"Alma";case"facilypay_3x":case"facilypay_4x":return"Oney";case"samsungpay":return"Samsung Pay";case"bizum":return"Bizum";case"pix":return"Pix";case"multibanco":return"Multibanco";case"openbanking_UK":return"Open Banking";default:return(null==(n=o.paymentMethod)?void 0:n.paymentMethodType)?e.capitalize(null==(a=o.paymentMethod)?void 0:a.paymentMethodType):""}}),c=e.computed(()=>o.amount&&o.paymentMethod?a({defaultMessage:"Pay {amount} with {type}",id:"pay_button.label.amount_and_payment_method",description:"The label for the pay button when both the amount and the payment method are known"},{amount:n.formatAmount(o.amount),type:i.value}):o.amount?a({defaultMessage:"Pay {amount}",id:"pay_button.label.amount_only",description:"The label for the pay button when only the amount is known"},{amount:n.formatAmount(o.amount),type:i.value}):a({defaultMessage:"Pay",id:"pay_button.label.default",description:"The default label for the pay button when no amount and payment method are known"}));return(t,o)=>(e.openBlock(),e.createBlock(e.unref(n._sfc_main$3),e.mergeProps(r.value,{class:"w-full",onClick:o[0]||(o[0]=e=>t.$emit("click",e))}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.value),1)]),_:1},16))}}),m={key:0},y=e.defineComponent({__name:"PayInvoice",props:{invoice:{type:Object},paymentMethodOptions:{type:Array},paymentAttempts:{default:()=>[],type:Array},countryCode:{type:String},amount:{type:Object},downloadService:{type:Function},configuration:{type:Object},isLoading:{type:Boolean},error:{type:null}},setup(t){const{$t:c}=n.useIntl(),l=t,s=e.ref(),u=e.ref();function y(){if(!u.value)throw new Error("payment integration form not found");u.value.submit()}const d=()=>{l.configuration.onPaymentSuccess&&l.configuration.onPaymentSuccess()};return(l,v)=>(e.openBlock(),e.createBlock(e.unref(o.ContentWithAsideLayout),null,{header:e.withCtx(()=>[e.createVNode(r._sfc_main,{class:"min-h-[52px] w-96"},{default:e.withCtx(()=>[t.invoice&&t.downloadService?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$13),{key:0,invoice:t.invoice,"payment-attempts":t.paymentAttempts,"download-service":()=>t.downloadService(t.invoice.id)},null,8,["invoice","payment-attempts","download-service"])):e.createCommentVNode("",!0)]),_:1})]),content:e.withCtx(()=>{var o,l;return[t.isLoading?(e.openBlock(),e.createBlock(r._sfc_main,{key:0,variant:"section",class:"min-h-[300px]"})):e.createCommentVNode("",!0),(null==(o=t.invoice)?void 0:o.paid)?(e.openBlock(),e.createBlock(i._sfc_main,{key:1,status:"success",title:e.unref(c)({id:"pay_invoice.paid.title",defaultMessage:"Thank you for your payment!",description:"Title shown when the invoice has already been paid"}),class:"mt-8"},{default:e.withCtx(()=>[e.createVNode(e.unref(n._sfc_main),{variant:"body-sm",class:"mt-1"},{default:e.withCtx(()=>[e.createVNode(e.unref(n._sfc_main$6),{icon:"check"}),e.createTextVNode(e.toDisplayString(e.unref(n.formatAmount)(t.invoice.tax_summary.total_amount)),1)]),_:1})]),_:1},8,["title"])):t.error?(e.openBlock(),e.createBlock(i._sfc_main,{key:2,status:"error",title:e.unref(c)({id:"pay_invoice.error.title",defaultMessage:"Something went wrong",description:"Title shown when the invoice payment fails to load"})},{default:e.withCtx(()=>[e.createVNode(e.unref(n._sfc_main),{variant:"body-sm",class:"mt-1"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)({id:"pay_invoice.error.description",defaultMessage:"Please try again or contact support.",description:"Body text shown when the invoice payment fails to load"})),1)]),_:1})]),_:1},8,["title"])):!t.isLoading&&t.countryCode&&t.amount&&t.invoice?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[(null==(l=t.paymentMethodOptions)?void 0:l.length)?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$1),{key:0,title:e.unref(c)({id:"pay_invoice.payment_methods.title",defaultMessage:"Payment methods",description:"Section title for the payment method selector on the pay invoice screen"}),"content-background":"none","no-border":"","no-spacing":""},{default:e.withCtx(()=>[e.createVNode(a._sfc_main,{ref_key:"paymentIntegrationFormRef",ref:u,amount:t.amount,"country-code":t.countryCode,context:{type:"INVOICE",related_resource_ids:[{type:"INVOICE",id:t.invoice.id}]},"customer-id":t.invoice.customer.id,"force-store-payment-method":"","invoice-id":t.invoice.id,"payment-method-options":t.paymentMethodOptions,variant:"AUTHORIZE",onPaymentSuccess:d,onSelect:v[0]||(v[0]=e=>s.value=e)},null,8,["amount","country-code","context","customer-id","invoice-id","payment-method-options"])]),_:1},8,["title"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)]}),aside:e.withCtx(()=>[e.createVNode(r._sfc_main,{variant:"section",class:"min-h-[200px]"},{default:e.withCtx(()=>[t.invoice?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$12),{key:0,invoice:t.invoice},null,8,["invoice"])):e.createCommentVNode("",!0)]),_:1}),t.invoice?(e.openBlock(),e.createElementBlock("div",m,[e.createVNode(p,{disabled:!s.value,amount:t.amount,"payment-method":s.value,onClick:y},null,8,["disabled","amount","payment-method"])])):e.createCommentVNode("",!0)]),_:1}))}}),d=e.defineComponent({__name:"PayInvoice.entry.view",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup(t){const o=t,{invoice:a,get:r,downloadInvoicePdf:i}=l.useInvoice({invoiceId:o.configuration.invoiceId}),{payments:p,get:m}=l.usePayments(),{fetchInitial:y}=u.usePaymentMethods({customerId:o.portalObject.customer_id}),{paymentMethodOptions:d,get:v}=s.usePaymentMethodOptions(),{isLoading:f}=c.useLoadInitialData((async()=>{const e=await r();await v({customerId:e.customer.id,amount:e.open_invoice_amount})})(),y(),m(o.configuration.invoiceId)),g=e.computed(()=>{var e;return(null==(e=a.value)?void 0:e.customer)?n.getCustomerCountry(a.value.customer):void 0});return(t,n)=>{var o;return e.renderSlot(t.$slots,"default",{invoice:e.unref(a),isLoading:e.unref(f),amount:null==(o=e.unref(a))?void 0:o.open_invoice_amount,countryCode:g.value,paymentMethodOptions:e.unref(d),paymentAttempts:e.unref(p),downloadService:e.unref(i)})}}}),v=e.defineComponent({__name:"PayInvoice.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup:n=>(o,a)=>{var r,i,c,l;return e.openBlock(),e.createBlock(e.unref(t._sfc_main),{"custom-element-name":e.unref(g),environment:n.environment,locale:n.locale,"portal-object":n.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(i=null==(r=n.branding)?void 0:r.colors)?void 0:i.primary,"secondary-color":null==(l=null==(c=n.branding)?void 0:c.colors)?void 0:l.secondary,"experimental-features":n.experimentalFeatures,"log-level":n.logLevel,"on-log":n.onLog,onError:a[0]||(a[0]=e=>o.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(d,e.normalizeProps(e.guardReactiveProps(o.$props)),{default:e.withCtx(({invoice:t,isLoading:o,amount:a,countryCode:r,paymentMethodOptions:i,paymentAttempts:c,downloadService:l})=>[e.createVNode(y,{"is-loading":o,invoice:t,amount:a,"country-code":r,"payment-method-options":i,configuration:n.configuration,"payment-attempts":c??[],"download-service":l},null,8,["is-loading","invoice","amount","country-code","payment-method-options","configuration","payment-attempts","download-service"])]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log"])}}),f=t.defineCustomElement(v),g=t.getComponentName("pay-invoice");exports.COMPONENT_NAME=g,exports.SolvimonPayInvoice=f,exports.defineSolvimonPayInvoice=()=>{customElements.get(g)||customElements.define(g,f)};
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../component-BOqPDAVk.js"),n=require("../../vendor-ui-5pJF5KBP.js"),o=require("../../ContentWithAsideLayout-B5B8Kwaw.js"),a=require("../../PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CiyyUp4z.js"),r=require("../../Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),i=require("../../adyen-R6aSZ0Yf.js"),c=require("../../useLoadInitialData-DjwRHcAH.js"),l=require("../../usePayments-DWXPGFvp.js"),s=require("../../usePaymentMethodOptions-DYO6xr3-.js"),u=require("../../usePaymentMethods-ryN_YohI.js"),p=e.defineComponent({__name:"PayButton",props:{amount:{type:Object},paymentMethod:{type:Object},type:{type:String},variant:{type:String},color:{type:String},size:{type:String},pill:{type:Boolean},square:{type:Boolean},loading:{type:Boolean},disabled:{type:Boolean},iconPrefix:{type:null},iconSuffix:{type:null},tag:{type:String}},emits:["click"],setup(t){const o=t,{$t:a}=n.useIntl(),r=e.computed(()=>({color:o.color??"primary",disabled:o.disabled,iconPrefix:o.iconPrefix,iconSuffix:o.iconSuffix,loading:o.loading,pill:o.pill,size:o.size??"lg",square:o.square,tag:o.tag,type:o.type,variant:o.variant})),i=e.computed(()=>{var t,n,a;switch(null==(t=o.paymentMethod)?void 0:t.paymentMethodType){case"scheme":return"Credit Card";case"applepay":return"Apple Pay";case"googlepay":return"Google Pay";case"paypal":return"PayPal";case"ideal":return"iDeal";case"klarna":return"Klarna";case"bcmc":return"BCMC";case"sepadirectdebit":return"SEPA";case"twint":return"Twint";case"swish":return"Swish";case"vipps":return"Vipps";case"mbway":return"MBway";case"alipay":return"AliPay";case"wechatpayWeb":return"WeChatPay";case"afterpay_default":return"Afterpay";case"affirm":return"Affirm";case"ach":return"ACH";case"blik":return"Blik";case"cashapp":return"Cash App Pay";case"amazonpay":return"Amazon Pay";case"venmo":return"Venmo";case"clicktopay":return"Click to Pay";case"upi":return"UPI";case"revolutpay":return"Revolut Pay";case"ratepay":return"Ratepay";case"walley":return"Walley";case"alma":return"Alma";case"facilypay_3x":case"facilypay_4x":return"Oney";case"samsungpay":return"Samsung Pay";case"bizum":return"Bizum";case"pix":return"Pix";case"multibanco":return"Multibanco";case"openbanking_UK":return"Open Banking";default:return(null==(n=o.paymentMethod)?void 0:n.paymentMethodType)?e.capitalize(null==(a=o.paymentMethod)?void 0:a.paymentMethodType):""}}),c=e.computed(()=>o.amount&&o.paymentMethod?a({defaultMessage:"Pay {amount} with {type}",id:"pay_button.label.amount_and_payment_method",description:"The label for the pay button when both the amount and the payment method are known"},{amount:n.formatAmount(o.amount),type:i.value}):o.amount?a({defaultMessage:"Pay {amount}",id:"pay_button.label.amount_only",description:"The label for the pay button when only the amount is known"},{amount:n.formatAmount(o.amount),type:i.value}):a({defaultMessage:"Pay",id:"pay_button.label.default",description:"The default label for the pay button when no amount and payment method are known"}));return(t,o)=>(e.openBlock(),e.createBlock(e.unref(n._sfc_main$3),e.mergeProps(r.value,{class:"w-full",onClick:o[0]||(o[0]=e=>t.$emit("click",e))}),{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.value),1)]),_:1},16))}}),m={key:0},y=e.defineComponent({__name:"PayInvoice",props:{invoice:{type:Object},paymentMethodOptions:{type:Array},paymentAttempts:{default:()=>[],type:Array},countryCode:{type:String},amount:{type:Object},downloadService:{type:Function},configuration:{type:Object},isLoading:{type:Boolean},error:{type:null}},setup(t){const{$t:c}=n.useIntl(),l=t,s=e.ref(),u=e.ref();function y(){if(!u.value)throw new Error("payment integration form not found");u.value.submit()}const d=()=>{l.configuration.onPaymentSuccess&&l.configuration.onPaymentSuccess()};return(l,v)=>(e.openBlock(),e.createBlock(e.unref(o.ContentWithAsideLayout),null,{header:e.withCtx(()=>[e.createVNode(r._sfc_main,{class:"min-h-[52px] w-96"},{default:e.withCtx(()=>[t.invoice&&t.downloadService?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$13),{key:0,invoice:t.invoice,"payment-attempts":t.paymentAttempts,"download-service":()=>t.downloadService(t.invoice.id)},null,8,["invoice","payment-attempts","download-service"])):e.createCommentVNode("",!0)]),_:1})]),content:e.withCtx(()=>{var o,l;return[t.isLoading?(e.openBlock(),e.createBlock(r._sfc_main,{key:0,variant:"section",class:"min-h-[300px]"})):e.createCommentVNode("",!0),(null==(o=t.invoice)?void 0:o.paid)?(e.openBlock(),e.createBlock(i._sfc_main,{key:1,status:"success",title:e.unref(c)({id:"pay_invoice.paid.title",defaultMessage:"Thank you for your payment!",description:"Title shown when the invoice has already been paid"}),class:"mt-8"},{default:e.withCtx(()=>[e.createVNode(e.unref(n._sfc_main),{variant:"body-sm",class:"mt-1"},{default:e.withCtx(()=>[e.createVNode(e.unref(n._sfc_main$6),{icon:"check"}),e.createTextVNode(e.toDisplayString(e.unref(n.formatAmount)(t.invoice.tax_summary.total_amount)),1)]),_:1})]),_:1},8,["title"])):t.error?(e.openBlock(),e.createBlock(i._sfc_main,{key:2,status:"error",title:e.unref(c)({id:"pay_invoice.error.title",defaultMessage:"Something went wrong",description:"Title shown when the invoice payment fails to load"})},{default:e.withCtx(()=>[e.createVNode(e.unref(n._sfc_main),{variant:"body-sm",class:"mt-1"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(c)({id:"pay_invoice.error.description",defaultMessage:"Please try again or contact support.",description:"Body text shown when the invoice payment fails to load"})),1)]),_:1})]),_:1},8,["title"])):!t.isLoading&&t.countryCode&&t.amount&&t.invoice?(e.openBlock(),e.createElementBlock(e.Fragment,{key:3},[(null==(l=t.paymentMethodOptions)?void 0:l.length)?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$1),{key:0,title:e.unref(c)({id:"pay_invoice.payment_methods.title",defaultMessage:"Payment methods",description:"Section title for the payment method selector on the pay invoice screen"}),"content-background":"none","no-border":"","no-spacing":""},{default:e.withCtx(()=>[e.createVNode(a._sfc_main,{ref_key:"paymentIntegrationFormRef",ref:u,amount:t.amount,"country-code":t.countryCode,context:{type:"INVOICE",related_resource_ids:[{type:"INVOICE",id:t.invoice.id}]},"customer-id":t.invoice.customer.id,"force-store-payment-method":"","invoice-id":t.invoice.id,"payment-method-options":t.paymentMethodOptions,variant:"AUTHORIZE",onPaymentSuccess:d,onSelect:v[0]||(v[0]=e=>s.value=e)},null,8,["amount","country-code","context","customer-id","invoice-id","payment-method-options"])]),_:1},8,["title"])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)]}),aside:e.withCtx(()=>[e.createVNode(r._sfc_main,{variant:"section",class:"min-h-[200px]"},{default:e.withCtx(()=>[t.invoice?(e.openBlock(),e.createBlock(e.unref(n._sfc_main$12),{key:0,invoice:t.invoice},null,8,["invoice"])):e.createCommentVNode("",!0)]),_:1}),t.invoice?(e.openBlock(),e.createElementBlock("div",m,[e.createVNode(p,{disabled:!s.value,amount:t.amount,"payment-method":s.value,onClick:y},null,8,["disabled","amount","payment-method"])])):e.createCommentVNode("",!0)]),_:1}))}}),d=e.defineComponent({__name:"PayInvoice.entry.view",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup(t){const o=t,{invoice:a,get:r,downloadInvoicePdf:i}=l.useInvoice({invoiceId:o.configuration.invoiceId}),{payments:p,get:m}=l.usePayments(),{fetchInitial:y}=u.usePaymentMethods({customerId:o.portalObject.customer_id}),{paymentMethodOptions:d,get:v}=s.usePaymentMethodOptions(),{isLoading:f}=c.useLoadInitialData((async()=>{const e=await r();await v({customerId:e.customer.id,amount:e.open_invoice_amount})})(),y(),m(o.configuration.invoiceId)),g=e.computed(()=>{var e;return(null==(e=a.value)?void 0:e.customer)?n.getCustomerCountry(a.value.customer):void 0});return(t,n)=>{var o;return e.renderSlot(t.$slots,"default",{invoice:e.unref(a),isLoading:e.unref(f),amount:null==(o=e.unref(a))?void 0:o.open_invoice_amount,countryCode:g.value,paymentMethodOptions:e.unref(d),paymentAttempts:e.unref(p),downloadService:e.unref(i)})}}}),v=e.defineComponent({__name:"PayInvoice.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup:n=>(o,a)=>{var r,i,c,l;return e.openBlock(),e.createBlock(e.unref(t._sfc_main),{"custom-element-name":e.unref(g),environment:n.environment,locale:n.locale,"portal-object":n.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(i=null==(r=n.branding)?void 0:r.colors)?void 0:i.primary,"secondary-color":null==(l=null==(c=n.branding)?void 0:c.colors)?void 0:l.secondary,"experimental-features":n.experimentalFeatures,"log-level":n.logLevel,"on-log":n.onLog,onError:a[0]||(a[0]=e=>o.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(d,e.normalizeProps(e.guardReactiveProps(o.$props)),{default:e.withCtx(({invoice:t,isLoading:o,amount:a,countryCode:r,paymentMethodOptions:i,paymentAttempts:c,downloadService:l})=>[e.createVNode(y,{"is-loading":o,invoice:t,amount:a,"country-code":r,"payment-method-options":i,configuration:n.configuration,"payment-attempts":c??[],"download-service":l},null,8,["is-loading","invoice","amount","country-code","payment-method-options","configuration","payment-attempts","download-service"])]),_:1},16)]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log"])}}),f=t.defineCustomElement(v),g=t.getComponentName("pay-invoice");exports.COMPONENT_NAME=g,exports.SolvimonPayInvoice=f,exports.defineSolvimonPayInvoice=()=>{customElements.get(g)||customElements.define(g,f)};
@@ -2,7 +2,7 @@ import { defineComponent, computed, capitalize, openBlock, createBlock, unref, m
2
2
  import { _ as _sfc_main$d, d as defineCustomElement, g as getComponentName } from "../../component-Djrf1L-Z.mjs";
3
3
  import { u as useIntl, x as formatAmount, e as _sfc_main$4, y as _sfc_main$6, _ as _sfc_main$8, l as _sfc_main$9, b as _sfc_main$a, z as _sfc_main$c, v as getCustomerCountry } from "../../vendor-ui-C0K3osvz.mjs";
4
4
  import { C as ContentWithAsideLayout } from "../../ContentWithAsideLayout-DhfUkZZg.mjs";
5
- import { _ as _sfc_main$b } from "../../PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-uk5MO0ce.mjs";
5
+ import { _ as _sfc_main$b } from "../../PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BnMmcoAu.mjs";
6
6
  import { _ as _sfc_main$5 } from "../../Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs";
7
7
  import { _ as _sfc_main$7 } from "../../adyen-Bwewy3HC.mjs";
8
8
  import { u as useLoadInitialData } from "../../useLoadInitialData-5sgImpzc.mjs";
@@ -1,7 +1,7 @@
1
1
  import { c as createInvoicesService } from "./invoices-DIYPN2j_.mjs";
2
2
  import { c as createPaymentsService } from "./payments-Dq6R37Fz.mjs";
3
3
  import { ref, onMounted } from "vue";
4
- import { u as useWatchDebounced } from "./useWatchDebounced-D1xuIX6_.mjs";
4
+ import { u as useWatchDebounced } from "./useWatchDebounced-Zmxd6InB.mjs";
5
5
  const useData = ({
6
6
  getData,
7
7
  onError,
@@ -1 +1 @@
1
- const e=require("./invoices-DzkA1jDc.js"),t=require("./payments-DkHhTHto.js"),n=require("vue"),a=require("./useWatchDebounced-2ZLnfgvG.js");exports.useInvoiceData=function(c){const{getInvoice:r}=e.createInvoicesService(),{getPayments:s}=t.createPaymentsService();return(({getData:e,onError:t,watchValue:c,debounce:r=200})=>{const s=n.ref(),u=n.ref(!0),i=async()=>{try{s.value=await e(c)}catch(n){null==t||t(n)}finally{u.value=!1}};return c&&a.useWatchDebounced(c,()=>{i()},{debounce:r}),n.onMounted(async()=>{i()}),{data:s,isPending:u}})({getData:async()=>{const[e,t]=await Promise.all([r(c),s(c)]);return{invoice:e,paymentAttempts:t}}})};
1
+ const e=require("./invoices-DzkA1jDc.js"),t=require("./payments-DkHhTHto.js"),n=require("vue"),a=require("./useWatchDebounced-C_YxgoQ6.js");exports.useInvoiceData=function(c){const{getInvoice:r}=e.createInvoicesService(),{getPayments:s}=t.createPaymentsService();return(({getData:e,onError:t,watchValue:c,debounce:r=200})=>{const s=n.ref(),u=n.ref(!0),i=async()=>{try{s.value=await e(c)}catch(n){null==t||t(n)}finally{u.value=!1}};return c&&a.useWatchDebounced(c,()=>{i()},{debounce:r}),n.onMounted(async()=>{i()}),{data:s,isPending:u}})({getData:async()=>{const[e,t]=await Promise.all([r(c),s(c)]);return{invoice:e,paymentAttempts:t}}})};
@@ -1 +1 @@
1
- const e=require("vue");exports.useWatchDebounced=function(t,o,u){let c;e.watch(t,(e,t)=>{clearTimeout(c),c=setTimeout(()=>o(e,t),u.debounce)}),e.onUnmounted(()=>clearTimeout(c))};
1
+ const e=require("vue");exports.useWatchDebounced=function(t,o,u){let c;e.watch(t,(e,t)=>{clearTimeout(c),c=setTimeout(()=>o(e,t),u.debounce)},{deep:u.deep}),e.onUnmounted(()=>clearTimeout(c))};
@@ -1,10 +1,14 @@
1
1
  import { watch, onUnmounted } from "vue";
2
2
  function useWatchDebounced(source, callback, options) {
3
3
  let timer;
4
- watch(source, (value, oldValue) => {
5
- clearTimeout(timer);
6
- timer = setTimeout(() => callback(value, oldValue), options.debounce);
7
- });
4
+ watch(
5
+ source,
6
+ (value, oldValue) => {
7
+ clearTimeout(timer);
8
+ timer = setTimeout(() => callback(value, oldValue), options.debounce);
9
+ },
10
+ { deep: options.deep }
11
+ );
8
12
  onUnmounted(() => clearTimeout(timer));
9
13
  }
10
14
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solvimon/solvimon-web",
3
- "version": "0.1.0-alpha.11",
3
+ "version": "0.1.0-alpha.13",
4
4
  "description": "Solvimon's Front-end SDK provides you with the building blocks to create a billing self serve experience",
5
5
  "private": false,
6
6
  "publishConfig": {