@foxy.io/elements 1.23.0-beta.1 → 1.23.0-beta.3
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.
- package/dist/cdn/foxy-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-card.js +1 -1
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-admin-subscription-card.js +1 -1
- package/dist/cdn/foxy-api-browser.js +2 -3
- package/dist/cdn/foxy-applied-coupon-code-card.js +1 -1
- package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-applied-tax-card.js +1 -1
- package/dist/cdn/foxy-attribute-card.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-cart-card.js +1 -1
- package/dist/cdn/foxy-cart-form.js +1 -1
- package/dist/cdn/foxy-collection-page.js +1 -1
- package/dist/cdn/foxy-collection-pages.js +1 -1
- package/dist/cdn/foxy-copy-to-clipboard.js +1 -1
- package/dist/cdn/foxy-coupon-card.js +1 -1
- package/dist/cdn/foxy-coupon-code-form.js +1 -1
- package/dist/cdn/foxy-coupon-codes-form.js +1 -1
- package/dist/cdn/foxy-coupon-detail-card.js +1 -1
- package/dist/cdn/foxy-coupon-form.js +1 -1
- package/dist/cdn/foxy-custom-field-card.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-card.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-builder.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-discount-detail-card.js +1 -1
- package/dist/cdn/foxy-donation.js +1 -1
- package/dist/cdn/foxy-downloadable-card.js +1 -1
- package/dist/cdn/foxy-downloadable-form.js +1 -1
- package/dist/cdn/foxy-email-template-card.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -1
- package/dist/cdn/foxy-error-entry-card.js +1 -1
- package/dist/cdn/foxy-form-dialog.js +1 -1
- package/dist/cdn/foxy-generate-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-card.js +1 -1
- package/dist/cdn/foxy-gift-card-code-form.js +1 -1
- package/dist/cdn/foxy-gift-card-code-log-card.js +1 -1
- package/dist/cdn/foxy-gift-card-codes-form.js +1 -1
- package/dist/cdn/foxy-gift-card-form.js +1 -1
- package/dist/cdn/foxy-i18n-editor.js +2 -2
- package/dist/cdn/foxy-i18n.js +1 -1
- package/dist/cdn/foxy-integration-card.js +1 -1
- package/dist/cdn/foxy-integration-form.js +1 -1
- package/dist/cdn/foxy-item-card.js +1 -1
- package/dist/cdn/foxy-item-category-card.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-item-form.js +1 -1
- package/dist/cdn/foxy-item-option-card.js +1 -1
- package/dist/cdn/foxy-item-option-form.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-pagination.js +1 -1
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-card.js +1 -1
- package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-card.js +1 -1
- package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
- package/dist/cdn/foxy-payments-api.js +1 -1
- package/dist/cdn/foxy-query-builder.js +1 -1
- package/dist/cdn/foxy-report-form.js +1 -1
- package/dist/cdn/foxy-reports-table.js +1 -1
- package/dist/cdn/foxy-shipment-card.js +1 -1
- package/dist/cdn/foxy-shipping-method-card.js +1 -1
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-spinner.js +1 -1
- package/dist/cdn/foxy-store-card.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +3 -3
- package/dist/cdn/foxy-subscription-settings-form.js +1 -1
- package/dist/cdn/foxy-subscriptions-table.js +1 -1
- package/dist/cdn/foxy-table.js +1 -1
- package/dist/cdn/foxy-tax-card.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -1
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-template-set-card.js +1 -1
- package/dist/cdn/foxy-template-set-form.js +1 -1
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +1 -1
- package/dist/cdn/foxy-user-card.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/foxy-webhook-card.js +1 -1
- package/dist/cdn/foxy-webhook-form.js +1 -1
- package/dist/cdn/foxy-webhook-log-card.js +1 -1
- package/dist/cdn/foxy-webhook-status-card.js +1 -1
- package/dist/cdn/{shared-5570ac69.js → shared-03b39ec4.js} +1 -1
- package/dist/cdn/{shared-df1816e8.js → shared-0543c6e0.js} +1 -1
- package/dist/cdn/{shared-14bb06d4.js → shared-068480a3.js} +1 -1
- package/dist/cdn/{shared-049d80d0.js → shared-08ff9a8d.js} +1 -1
- package/dist/cdn/{shared-b39fce1b.js → shared-0c02b4ee.js} +1 -1
- package/dist/cdn/{shared-3d6f0788.js → shared-0dc1d012.js} +1 -1
- package/dist/cdn/{shared-04634a6f.js → shared-16b542bc.js} +1 -1
- package/dist/cdn/{shared-0dd25feb.js → shared-1e5292a1.js} +1 -1
- package/dist/cdn/{shared-faad86eb.js → shared-23923638.js} +1 -1
- package/dist/cdn/{shared-bed220d3.js → shared-29aa4bca.js} +1 -1
- package/dist/cdn/{shared-a7347e96.js → shared-380db651.js} +1 -1
- package/dist/cdn/{shared-7fd77eed.js → shared-39761436.js} +1 -1
- package/dist/cdn/{shared-07e32de2.js → shared-3a252ccd.js} +1 -1
- package/dist/cdn/{shared-491c9063.js → shared-3a82d3f5.js} +1 -1
- package/dist/cdn/{shared-bb226a47.js → shared-43520428.js} +1 -1
- package/dist/cdn/shared-49d978e1.js +1 -0
- package/dist/cdn/{shared-ac05532a.js → shared-4abfda9b.js} +1 -1
- package/dist/cdn/{shared-98eec370.js → shared-4c9f96ec.js} +1 -1
- package/dist/cdn/{shared-40638f2c.js → shared-4db2c7b1.js} +4 -4
- package/dist/cdn/{shared-f19f05e1.js → shared-53fee01f.js} +1 -1
- package/dist/cdn/{shared-50908853.js → shared-5dd31b4e.js} +1 -1
- package/dist/cdn/{shared-cf65fcc7.js → shared-61a510d8.js} +1 -1
- package/dist/cdn/{shared-0237bfae.js → shared-6b53ef85.js} +2 -2
- package/dist/cdn/{shared-163e5fdb.js → shared-6bfa699d.js} +1 -1
- package/dist/cdn/{shared-ab69c97b.js → shared-6eb7dc77.js} +1 -1
- package/dist/cdn/{shared-4494ebfa.js → shared-6f465111.js} +1 -1
- package/dist/cdn/{shared-ec3332b9.js → shared-6fb923d5.js} +1 -1
- package/dist/cdn/{shared-f0c8a5bd.js → shared-7a290f36.js} +1 -1
- package/dist/cdn/{shared-394c2425.js → shared-7bf46d6d.js} +1 -1
- package/dist/cdn/{shared-c7954521.js → shared-7c5754a4.js} +1 -1
- package/dist/cdn/{shared-f23627ae.js → shared-8349938a.js} +1 -1
- package/dist/cdn/{shared-af7cde22.js → shared-85bc54a6.js} +1 -1
- package/dist/cdn/{shared-d1c45954.js → shared-86768244.js} +1 -1
- package/dist/cdn/{shared-a959c0d9.js → shared-8b73191b.js} +1 -1
- package/dist/cdn/{shared-726c0b56.js → shared-9048c076.js} +1 -1
- package/dist/cdn/{shared-539cde4d.js → shared-939fc890.js} +1 -1
- package/dist/cdn/{shared-80792dc8.js → shared-9e60ef60.js} +1 -1
- package/dist/cdn/{shared-bbb8ec69.js → shared-a6518411.js} +1 -1
- package/dist/cdn/{shared-ffd03d7b.js → shared-ad396f3c.js} +1 -1
- package/dist/cdn/{shared-64f2d6de.js → shared-aeec3cab.js} +1 -1
- package/dist/cdn/{shared-00b50abf.js → shared-b88e35b7.js} +1 -1
- package/dist/cdn/{shared-bdd5c908.js → shared-b95ef318.js} +1 -1
- package/dist/cdn/{shared-d2384b7b.js → shared-bb009254.js} +1 -1
- package/dist/cdn/{shared-694297c2.js → shared-bd81cc08.js} +1 -1
- package/dist/cdn/{shared-8ac00abe.js → shared-c3c67413.js} +1 -1
- package/dist/cdn/{shared-27d23dfd.js → shared-c40d85dc.js} +1 -1
- package/dist/cdn/{shared-313a39ef.js → shared-ca58ef47.js} +1 -1
- package/dist/cdn/{shared-025cab8b.js → shared-cb6f2388.js} +1 -1
- package/dist/cdn/{shared-520be2e9.js → shared-cd096e97.js} +1 -1
- package/dist/cdn/{shared-1e55acbb.js → shared-d493355a.js} +1 -1
- package/dist/cdn/{shared-797b6161.js → shared-dcbaa1c5.js} +1 -1
- package/dist/cdn/{shared-acda8da2.js → shared-e28f16db.js} +1 -1
- package/dist/cdn/{shared-77a700fe.js → shared-e5c19ea3.js} +1 -1
- package/dist/cdn/shared-e6066f46.js +2 -0
- package/dist/cdn/{shared-e7ce4e47.js → shared-eb4b4597.js} +1 -1
- package/dist/cdn/{shared-b34bef61.js → shared-ee13d1a6.js} +1 -1
- package/dist/cdn/{shared-7c761c65.js → shared-f3f5e87e.js} +1 -1
- package/dist/cdn/{shared-3206f265.js → shared-fbfb0943.js} +1 -1
- package/dist/cdn/translations/api-browser/en.json +4 -0
- package/dist/cdn/translations/email-template-form/en.json +9 -7
- package/dist/cdn/translations/template-form/en.json +9 -7
- package/dist/elements/internal/InternalSourceControl/InternalSourceControl.d.ts +18 -0
- package/dist/elements/internal/InternalSourceControl/InternalSourceControl.js +160 -0
- package/dist/elements/internal/InternalSourceControl/InternalSourceControl.js.map +1 -0
- package/dist/elements/internal/InternalSourceControl/index.d.ts +3 -0
- package/dist/elements/internal/InternalSourceControl/index.js +5 -0
- package/dist/elements/internal/InternalSourceControl/index.js.map +1 -0
- package/dist/elements/public/ApiBrowser/internal/InternalApiBrowserResourceForm/InternalApiBrowserResourceForm.d.ts +0 -2
- package/dist/elements/public/ApiBrowser/internal/InternalApiBrowserResourceForm/InternalApiBrowserResourceForm.js +27 -43
- package/dist/elements/public/ApiBrowser/internal/InternalApiBrowserResourceForm/InternalApiBrowserResourceForm.js.map +1 -1
- package/dist/elements/public/ApiBrowser/internal/InternalApiBrowserResourceForm/index.d.ts +1 -0
- package/dist/elements/public/ApiBrowser/internal/InternalApiBrowserResourceForm/index.js +1 -0
- package/dist/elements/public/ApiBrowser/internal/InternalApiBrowserResourceForm/index.js.map +1 -1
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.d.ts +9 -7
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js +66 -60
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js.map +1 -1
- package/dist/elements/public/EmailTemplateForm/index.d.ts +1 -1
- package/dist/elements/public/EmailTemplateForm/index.js +1 -1
- package/dist/elements/public/EmailTemplateForm/index.js.map +1 -1
- package/dist/elements/public/PaymentsApi/PaymentsApi.d.ts +53 -7
- package/dist/elements/public/PaymentsApi/PaymentsApi.js +75 -12
- package/dist/elements/public/PaymentsApi/PaymentsApi.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.d.ts +0 -4
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +66 -118
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/index.d.ts +1 -1
- package/dist/elements/public/TemplateConfigForm/index.js +1 -1
- package/dist/elements/public/TemplateConfigForm/index.js.map +1 -1
- package/dist/elements/public/TemplateForm/TemplateForm.d.ts +4 -3
- package/dist/elements/public/TemplateForm/TemplateForm.js +49 -50
- package/dist/elements/public/TemplateForm/TemplateForm.js.map +1 -1
- package/dist/elements/public/TemplateForm/index.d.ts +1 -1
- package/dist/elements/public/TemplateForm/index.js +1 -1
- package/dist/elements/public/TemplateForm/index.js.map +1 -1
- package/dist/mixins/themeable.js +14 -4
- package/dist/mixins/themeable.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-44594184.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-e28f16db.js";import"./shared-ca58ef47.js";import"./shared-cb6f2388.js";import"./shared-0dc1d012.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-86768244.js";import{l as e,u as t}from"./shared-99065f2a.js";import{u as s,h as i,c as a}from"./shared-7f33a83a.js";import{B as r}from"./shared-98755831.js";import{C as n}from"./shared-de790de9.js";import"./foxy-nucleon-element.js";import{T as d,a as o}from"./shared-16b542bc.js";import{c as l}from"./shared-4e709717.js";import{N as c}from"./shared-eb900735.js";import"./shared-7a290f36.js";import"./shared-c40d85dc.js";import"./shared-9e60ef60.js";import"./shared-509a2f52.js";import"./shared-64657919.js";import"./shared-a8cf402a.js";import"./shared-d3bf9ac0.js";import"./shared-d6276c83.js";import"./shared-a89cb472.js";const m=s("\n repeating-radial-gradient(\n circle at -100% 500%,\n rgba(255, 255, 255, 0),\n rgba(255, 255, 255, 0.05) 4px\n )\n"),h=s(Object.entries({unknown:"#797c85",amex:"#2557d6",diners:"#0079be",discover:"#4d4d4d",jcb:"#0e4c96",maestro:"#181818",mastercard:"#16366f",unionpay:"#0dadb5",visa:"#0e4595"}).map((([e,t])=>`.bg-${e} { background: ${t} ${m} }`)).join(" "));let p,f,u,b,v,y,_,g=e=>e;const j=d(n(o(c,"payment-method-card")));class $ extends j{constructor(){super(...arguments),this.templates={},this.__renderActionsDelete=()=>i(p||(p=g` <div class="flex"> ${0} <vaadin-button class="px-xs rounded" theme="icon" style="--lumo-primary-text-color:#fff;--lumo-primary-color-50pct:rgba(255, 255, 255, 0.5);--lumo-contrast-5pct:rgba(255, 255, 255, 0.05)" aria-label="${0}" data-testid="actions:delete" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:delete"></iron-icon> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("actions:delete:before"),this.t("delete").toString(),this.disabledSelector.matches("actions:delete",!0),this.__handleDelete,this.renderTemplateOrSlot("actions:delete:after")),this.__renderActions=()=>i(f||(f=g` <div class="flex" data-testid="actions"> ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("actions:before"),this.hiddenSelector.matches("actions:delete",!0)?"":this.__renderActionsDelete(),this.renderTemplateOrSlot("actions:after"))}static get styles(){return[super.styles,h,a(u||(u=g`.ratio-card{padding-top:63%;position:relative;height:0}.ratio-card>*{position:absolute;top:0;right:0;bottom:0;left:0}`))]}render(){var s,a,n,d,o,c;const{data:m,lang:h,ns:p}=this;if(this.in({idle:"template"})||!(null==m?void 0:m.save_cc)||!this.in("idle")){const e=this.in("fail")?"error":this.in("busy")?"busy":"empty";return i(b||(b=g` <div class="ratio-card" aria-live="polite" aria-busy="${0}" data-testid="wrapper"> <div class="h-full bg-contrast-5"></div> <div class="absolute inset-0 flex items-center justify-center"> <foxy-spinner data-testid="spinner" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.in("busy"),e,this.lang,p,null!==(a=null===(s=customElements.get("foxy-spinner"))||void 0===s?void 0:s.defaultNS)&&void 0!==a?a:"")}const f=null!==(d=null===(n=m.cc_type)||void 0===n?void 0:n.toLowerCase())&&void 0!==d?d:"unknown",u=null!==(o=e[f])&&void 0!==o?o:t,j=null===(c=m.cc_number_masked)||void 0===c?void 0:c.substring(m.cc_number_masked.length-4);return i(v||(v=g` <foxy-internal-confirm-dialog data-testid="confirm" message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <div class="ratio-card" data-testid="wrapper" aria-busy="${0}" aria-live="polite"> <div class="flex flex-col justify-between text-base text-m leading-m font-lumo p-m bg-unknown bg-${0}"> <div class="${0}"> ${0} <div class="ml-auto rounded h-m">${0}</div> </div> <div class="font-tnum leading-none flex justify-between"> <div data-testid="expiry"> ${0} </div> <div data-testid="number"> ${0} </div> </div> </div> </div> `),h,p,this.__handleConfirmHide,this.in("busy"),f,l({"flex items-start":!0,"justify-between":this.readonlyControls===r.False,"justify-end":this.readonlyControls===r.True}),this.hiddenSelector.matches("actions",!0)?"":this.__renderActions(),u,m.cc_exp_month&&m.cc_exp_year?i(y||(y=g` <span class="sr-only">${0} </span> <span>${0} / ${0}</span> `),this.t("expires").toString(),m.cc_exp_month,m.cc_exp_year):"",j?i(_||(_=g` <span class="sr-only">${0} </span> <span aria-hidden="true">••••</span> <span>${0}</span> `),this.t("last_4_digits").toString(),j):"")}async _sendDelete(){const e=JSON.stringify({save_cc:!1});await this._fetch(this.href,{method:"PATCH",body:e});return c.Rumour(this.group).share({data:null,source:this.href,related:[this.parent]}),null}__handleDelete(e){this.renderRoot.querySelector("#confirm").show(e.currentTarget)}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}customElements.define("foxy-payment-method-card",$);export{$ as PaymentMethodCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-
|
|
1
|
+
import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-86768244.js";import{_ as r}from"./shared-98755831.js";import{a as e}from"./shared-16b542bc.js";import{T as s}from"./shared-c3c67413.js";import{h as t}from"./shared-7f33a83a.js";import"./shared-e28f16db.js";import"./shared-7a290f36.js";import"./shared-ca58ef47.js";import"./shared-a8cf402a.js";import"./shared-64657919.js";import"./shared-de790de9.js";import"./shared-d3bf9ac0.js";import"./shared-3a252ccd.js";import"./shared-eb900735.js";import"./shared-509a2f52.js";import"./shared-d6276c83.js";import"./shared-a89cb472.js";import"./shared-4e709717.js";let a,i,o,d=r=>r;const m=e(s,"payments-api-fraud-protection-card");class l extends m{constructor(){super(...arguments),this.getImageSrc=null}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='M0 20.73v-9.9L10.83 0h9.9L0 20.73ZM0 0h9.41L0 9.41V0Zm0 22.14L22.14 0h9.9l-9.43 9.44-.61-.27-10.5 4.66v7-.29L0 32.04v-9.9Zm11.54-.23L0 33.46v9.9l14.14-14.14a15 15 0 0 1-2.6-7.3Zm3.2 8.12L.77 44h9.9l9.7-9.7a13.75 13.75 0 0 1-5.63-4.27Zm6.67 4.64L12.08 44h9.9L44 21.98v-9.9L32.16 23.92C31.01 29.15 27.05 33.6 22 34.83l-.59-.16Zm11.02-12.43L44 10.67V.77L31.42 13.35l1.08.48v7a13 13 0 0 1-.07 1.4Zm-1.99-9.32L43.35 0h-9.9l-9.87 9.87 6.86 3.05ZM23.4 44 44 23.4v9.9L33.3 44h-9.9Zm11.31 0L44 34.71V44h-9.29Z'/%3E%3Cpath fill='%23fff' d='M30.17 21.99H22V11.72l-8.17 3.63V22H22v10.42c4.34-1.34 7.55-5.63 8.17-10.43Z'/%3E%3C/svg%3E"}static get properties(){return r(r({},super.properties),{},{getImageSrc:{attribute:!1}})}renderBody(){var r,e;const s=super.renderBody({title:r=>t(a||(a=d`${0}`),r.helper.name),subtitle:r=>t(i||(i=d`${0}`),r.description)});if(!this.in({idle:"snapshot"}))return s;const m=l.defaultImageSrc,p=this.data;return t(o||(o=d` <figure class="flex items-center" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <img class="relative h-s w-s object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="${0}" @error="${0}"> <figcaption class="min-w-0 flex-1">${0}</figcaption> </figure> `),null!==(e=p?null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,p.type):null)&&void 0!==e?e:m,this.t("image_alt"),(r=>r.currentTarget.src=m),s)}}customElements.define("foxy-payments-api-fraud-protection-card",l);export{l as PaymentsApiFraudProtectionCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-cb6f2388.js";import"./shared-dcbaa1c5.js";import"./shared-b88e35b7.js";import"./shared-3a82d3f5.js";import"./shared-1e5292a1.js";import{I as e}from"./shared-6fb923d5.js";import"./foxy-nucleon-element.js";import"./shared-86768244.js";import{_ as t,aJ as r,$ as o}from"./shared-98755831.js";import{a as i}from"./shared-16b542bc.js";import{i as a}from"./shared-d3bf9ac0.js";import{h as s}from"./shared-7f33a83a.js";import{s as l}from"./shared-c7f56c90.js";import{h as n}from"./shared-ca5e1c6b.js";import"./shared-c40d85dc.js";import"./shared-7a290f36.js";import"./shared-d493355a.js";import"./shared-b95ef318.js";import"./shared-4c9f96ec.js";import"./shared-e28f16db.js";import"./shared-0c02b4ee.js";import"./shared-5dd31b4e.js";import"./shared-0479553e.js";import"./shared-de790de9.js";import"./shared-a8cf402a.js";import"./shared-eb900735.js";import"./shared-509a2f52.js";import"./shared-64657919.js";import"./shared-d6276c83.js";import"./shared-a89cb472.js";import"./shared-aeec3cab.js";import"./shared-f3f5e87e.js";import"./shared-0543c6e0.js";import"./shared-4db2c7b1.js";import"./shared-0dc1d012.js";import"./shared-9e60ef60.js";import"./shared-4e709717.js";import"./foxy-spinner.js";import"./shared-ca58ef47.js";import"./shared-bfdbd733.js";let d,c,h,p,f,u,m,v,_,b,g=e=>e;const j=i(e,"payments-api-fraud-protection-form");class x extends j{constructor(){super(...arguments),this.getImageSrc=null,this.templates={},this.__availableFraudProtectionsLoaderId="availableFraudProtections"}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='M0 20.73v-9.9L10.83 0h9.9L0 20.73ZM0 0h9.41L0 9.41V0Zm0 22.14L22.14 0h9.9l-9.43 9.44-.61-.27-10.5 4.66v7-.29L0 32.04v-9.9Zm11.54-.23L0 33.46v9.9l14.14-14.14a15 15 0 0 1-2.6-7.3Zm3.2 8.12L.77 44h9.9l9.7-9.7a13.75 13.75 0 0 1-5.63-4.27Zm6.67 4.64L12.08 44h9.9L44 21.98v-9.9L32.16 23.92C31.01 29.15 27.05 33.6 22 34.83l-.59-.16Zm11.02-12.43L44 10.67V.77L31.42 13.35l1.08.48v7a13 13 0 0 1-.07 1.4Zm-1.99-9.32L43.35 0h-9.9l-9.87 9.87 6.86 3.05ZM23.4 44 44 23.4v9.9L33.3 44h-9.9Zm11.31 0L44 34.71V44h-9.29Z'/%3E%3Cpath fill='%23fff' d='M30.17 21.99H22V11.72l-8.17 3.63V22H22v10.42c4.34-1.34 7.55-5.63 8.17-10.43Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{getImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",({score_threshold_reject:e})=>"number"!=typeof e||(e<=100&&e>=0||"score-threshold-reject:v8n_out_of_range"),e=>{var t,r,o,i;const a=null!==(o=null===(r=null===(t=e.helper)||void 0===t?void 0:t.json)||void 0===r?void 0:r.blocks)&&void 0!==o?o:[];let s;try{s=JSON.parse(null!==(i=e.json)&&void 0!==i?i:"{}")}catch(e){s={}}for(const e of a)for(const t of e.fields)if("optional"in t&&!t.optional){const r=[e.parent_id,e.id,t.id].filter((e=>!!e));if(!n(s,r)&&"checkbox"!==t.type)return"json:v8n_invalid"}return!0}]}renderBody(){return this.form.type?this.__renderFraudProtectionConfig(this.form.type):this.__renderFraudProtectionSelector()}get __availableFraudProtectionsLoader(){return this.renderRoot.querySelector(`#${this.__availableFraudProtectionsLoaderId}`)}get __availableFraudProtectionsHref(){try{const e=r(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,o=e.exec(t).groups.presetId;return new URL(`/payment_presets/${o}/available_fraud_protections`,this.href||this.parent).toString()}catch(e){}}get __availableFraudProtections(){var e,t;return null===(t=null===(e=this.__availableFraudProtectionsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}__renderFraudProtectionSelector(){var e;const t=x.defaultImageSrc;return s(d||(d=g` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-i18n class="block text-xxl font-medium border-b border-contrast-10 pb-m" infer="" key="select_protection_title"> </foxy-i18n> <div data-testid="select-protection-list"> <ul class="-my-s grid grid-cols-1"> ${0} </ul> </div> `),a(this.__availableFraudProtectionsHref),this.__availableFraudProtectionsLoaderId,(()=>this.requestUpdate()),Object.entries(null!==(e=this.__availableFraudProtections)&&void 0!==e?e:{}).map((([e,r])=>{var o,i;return s(c||(c=g` <li class="-mx-s"> <button class="w-full block text-left hover-bg-contrast-5 p-s rounded" @click="${0}"> <figure class="flex items-center gap-m h-m"> <img class="relative h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="" @error="${0}"> <figcaption class="min-w-0 flex-1 truncate leading-s font-medium"> ${0}​ </figcaption> </figure> </button> </li> `),(()=>this.edit({type:e,helper:r})),null!==(i=null===(o=this.getImageSrc)||void 0===o?void 0:o.call(this,e))&&void 0!==i?i:t,(e=>{e.currentTarget.src=t}),r.name)})))}__renderFraudProtectionConfig(e){var t,r,o,i,a,l,n,d;const c=x.defaultImageSrc;return s(h||(h=g` <figure data-testid="logo" class="relative flex flex-col gap-m p-m items-center"> <img class="relative h-xl w-xl object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="" @error="${0}"> <figcaption class="relative min-w-0 font-medium text-xl text-center"> ${0}​ </figcaption> </figure> <foxy-internal-text-control infer="description"></foxy-internal-text-control> ${0} ${0} ${0} ${0} `),null!==(r=null===(t=this.getImageSrc)||void 0===t?void 0:t.call(this,e))&&void 0!==r?r:c,(e=>e.currentTarget.src=c),null!==(i=null===(o=this.form.helper)||void 0===o?void 0:o.name)&&void 0!==i?i:this.form.type,(null===(a=this.form.helper)||void 0===a?void 0:a.uses_rejection_threshold)?s(p||(p=g` <foxy-internal-integer-control infer="score-threshold-reject"> </foxy-internal-integer-control> `)):"",null===(n=null===(l=this.form.helper)||void 0===l?void 0:l.json)||void 0===n?void 0:n.blocks.map((e=>this.__renderBlock(e))),(null===(d=this.data)||void 0===d?void 0:d.type)?"":s(f||(f=g` <vaadin-button data-testid="select-another-button" theme="contrast" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())),super.renderBody())}__renderBlock(e){return s(u||(u=g`${0}`),e.fields.map((t=>{var r,i,a,n,d,c;const h=()=>{var r,i;let a;try{a=JSON.parse(null!==(r=this.form.json)&&void 0!==r?r:"")}catch(e){a={}}const s=[e.parent_id,e.id,t.id].filter((e=>!!e));return null!==(i=o(a,s))&&void 0!==i?i:a.default_value},p=r=>{var o;let i;try{i=JSON.parse(null!==(o=this.form.json)&&void 0!==o?o:"")}catch(e){i={}}const a=[e.parent_id,e.id,t.id].filter((e=>!!e));this.edit({json:JSON.stringify(l(i,a,r))})},f=t.options,u=["json",...[e.parent_id,e.id,t.id].filter((e=>!!e))].join("-").replace(/_/g,"-");return s(m||(m=g` ${0} `),"checkbox"===t.type?s(v||(v=g` <foxy-internal-checkbox-group-control helper-text="${0}" label="" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> `),null!==(r=t.description)&&void 0!==r?r:"",u,[{label:t.name,value:"checked"}],(()=>h()?["checked"]:[]),(e=>p(e.includes("checked")))):"select"===t.type?s(_||(_=g` <foxy-internal-select-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(i=t.description)&&void 0!==i?i:"",null!==(d=null===(n=null===(a=t.options)||void 0===a?void 0:a.find((e=>e.value===t.default_value)))||void 0===n?void 0:n.name)&&void 0!==d?d:this.t("default_additional_field_placeholder"),t.name,u,f.map((({name:e,value:t})=>({label:e,value:t}))),h,p):s(b||(b=g` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(c=t.description)&&void 0!==c?c:"",t.default_value||this.t("default_additional_field_placeholder"),t.name,u,h,p))})))}}customElements.define("foxy-payments-api-fraud-protection-form",x);export{x as PaymentsApiFraudProtectionForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-
|
|
1
|
+
import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-86768244.js";import{_ as e}from"./shared-98755831.js";import{a as r}from"./shared-16b542bc.js";import{T as s}from"./shared-c3c67413.js";import{h as t}from"./shared-7f33a83a.js";import"./shared-e28f16db.js";import"./shared-7a290f36.js";import"./shared-ca58ef47.js";import"./shared-a8cf402a.js";import"./shared-64657919.js";import"./shared-de790de9.js";import"./shared-d3bf9ac0.js";import"./shared-3a252ccd.js";import"./shared-eb900735.js";import"./shared-509a2f52.js";import"./shared-d6276c83.js";import"./shared-a89cb472.js";import"./shared-4e709717.js";let a,i,o,m=e=>e;const d=r(s,"payments-api-payment-method-card");class l extends d{constructor(){super(...arguments),this.getImageSrc=null}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='m29.3 14 14-14H32.1l-14 14h11.2Zm2.7 9.9 12-12V.7L30.62 14.1A2 2 0 0 1 32 16v7.9ZM13.31 44h11.18L44 24.5V13.3l-12 12V28a2 2 0 0 1-2 2h-2.69l-14 14Zm-1.41 0H.7l14-14h11.2l-14 14Zm14 0h11.2l6.9-6.9V25.9L25.9 44Zm12.6 0H44v-5.5L38.5 44Z'/%3E%3Cpath fill='%23fff' d='M30 28H14v-6h16v6Zm0-10v-2H14v2h16ZM0 43.3l13.4-13.4A2 2 0 0 1 12 28v-7.9L0 32.12V43.3Z'/%3E%3Cpath fill='%23fff' d='M16.7 14H14c-1.11 0-1.99.89-1.99 2v2.7L0 30.7V19.52L19.52 0H30.7l-14 14Zm1.4-14H6.92L0 6.92V18.1L18.1 0ZM5.5 0H0v5.5L5.5 0Z'/%3E%3C/svg%3E"}static get properties(){return e(e({},super.properties),{},{getImageSrc:{attribute:!1}})}renderBody(){var e,r;const s=super.renderBody({title:e=>t(a||(a=m`${0}`),e.helper.name),subtitle:e=>t(i||(i=m`${0}`),e.description)});if(!this.in({idle:"snapshot"}))return s;const d=l.defaultImageSrc,p=this.data;return t(o||(o=m` <figure class="flex items-center" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <img class="relative h-s w-s object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="${0}" @error="${0}"> <figcaption class="min-w-0 flex-1">${0}</figcaption> </figure> `),null!==(r=p?null===(e=this.getImageSrc)||void 0===e?void 0:e.call(this,p.type):null)&&void 0!==r?r:d,this.t("image_alt"),(e=>e.currentTarget.src=d),s)}}customElements.define("foxy-payments-api-payment-method-card",l);export{l as PaymentsApiPaymentMethodCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-025cab8b.js";import"./shared-af7cde22.js";import"./shared-faad86eb.js";import"./shared-797b6161.js";import"./shared-bbb8ec69.js";import"./shared-491c9063.js";import"./shared-0dd25feb.js";import{I as e}from"./shared-ec3332b9.js";import"./foxy-nucleon-element.js";import"./shared-d1c45954.js";import{_ as t,aJ as r,$ as i}from"./shared-98755831.js";import{a as o}from"./shared-04634a6f.js";import{i as a}from"./shared-d3bf9ac0.js";import{c as l}from"./shared-4e709717.js";import{h as s}from"./shared-7f33a83a.js";import{h as n}from"./shared-ca5e1c6b.js";import{s as d}from"./shared-c7f56c90.js";import"./shared-27d23dfd.js";import"./shared-f0c8a5bd.js";import"./shared-98eec370.js";import"./shared-520be2e9.js";import"./shared-acda8da2.js";import"./shared-40638f2c.js";import"./shared-df1816e8.js";import"./shared-bdd5c908.js";import"./shared-b39fce1b.js";import"./shared-50908853.js";import"./shared-0479553e.js";import"./shared-de790de9.js";import"./shared-a8cf402a.js";import"./shared-eb900735.js";import"./shared-509a2f52.js";import"./shared-64657919.js";import"./shared-d6276c83.js";import"./shared-a89cb472.js";import"./shared-1e55acbb.js";import"./shared-3d6f0788.js";import"./shared-80792dc8.js";import"./foxy-spinner.js";import"./shared-313a39ef.js";import"./shared-bfdbd733.js";let c,h,p,f,u,m,_,v,y,b,g,x,$,j,k,S,V,M,w=e=>e;const L=o(e,"payments-api-payment-method-form");class P extends L{constructor(){super(...arguments),this.getImageSrc=null,this.templates={},this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__threeDSecureResponseGetValue=()=>{var e;return(null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response"))?["valid_only"]:[]},this.__threeDSecureResponseSetValue=e=>{const t=e.includes("valid_only")?"_require_valid_response":"",r=this.form.config_3d_secure,i=(null==r?void 0:r.startsWith("all_cards"))?"all_cards":"maestro_only";this.edit({config_3d_secure:`${i}${t}`})},this.__threeDSecureResponseOptions=[{value:"valid_only",label:"option_valid_only"}],this.__threeDSecureToggleGetValue=()=>{const e=this.form.config_3d_secure;return(null==e?void 0:e.startsWith("all_cards"))?"all_cards":(null==e?void 0:e.startsWith("maestro_only"))?"maestro_only":"off"},this.__threeDSecureToggleSetValue=e=>{var t;let r="";"all_cards"!==e&&"maestro_only"!==e||(r=(null===(t=this.form.config_3d_secure)||void 0===t?void 0:t.endsWith("require_valid_response"))?`${e}_require_valid_response`:e),this.edit({config_3d_secure:r})},this.__threeDSecureToggleOptions=[{value:"off",label:"option_off"},{value:"all_cards",label:"option_all_cards"},{value:"maestro_only",label:"option_maestro_only"}],this.__tab=0}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='m29.3 14 14-14H32.1l-14 14h11.2Zm2.7 9.9 12-12V.7L30.62 14.1A2 2 0 0 1 32 16v7.9ZM13.31 44h11.18L44 24.5V13.3l-12 12V28a2 2 0 0 1-2 2h-2.69l-14 14Zm-1.41 0H.7l14-14h11.2l-14 14Zm14 0h11.2l6.9-6.9V25.9L25.9 44Zm12.6 0H44v-5.5L38.5 44Z'/%3E%3Cpath fill='%23fff' d='M30 28H14v-6h16v6Zm0-10v-2H14v2h16ZM0 43.3l13.4-13.4A2 2 0 0 1 12 28v-7.9L0 32.12V43.3Z'/%3E%3Cpath fill='%23fff' d='M16.7 14H14c-1.11 0-1.99.89-1.99 2v2.7L0 30.7V19.52L19.52 0H30.7l-14 14Zm1.4-14H6.92L0 6.92V18.1L18.1 0ZM5.5 0H0v5.5L5.5 0Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{__tab:{attribute:!1},getImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",e=>{var t,r,i,o;const a=null!==(i=null===(r=null===(t=e.helper)||void 0===t?void 0:t.additional_fields)||void 0===r?void 0:r.blocks)&&void 0!==i?i:[];let l;try{l=JSON.parse(null!==(o=e.additional_fields)&&void 0!==o?o:"{}")}catch(e){l={}}for(const e of a)for(const t of e.fields)if("optional"in t&&!t.optional){const r=[e.parent_id,e.id,t.id].filter((e=>!!e));if(!n(l,r)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid"}return!0}]}renderBody(){return this.form.type?this.__renderPaymentMethodConfig(this.form.type):this.__renderPaymentMethodSelector()}get __groupedAvailablePaymentMethods(){var e;return Object.entries(null!==(e=this.__availablePaymentMethods)&&void 0!==e?e:{}).sort(((e,t)=>e[0].localeCompare(t[0],"en"))).reduce(((e,[t,r])=>{const i=t.charAt(0).toUpperCase(),o=!/\w/.test(i)?"#":i,a=e.find((e=>e.name===o));return a?a.items.push({type:t,helper:r}):e.push({name:o,items:[{type:t,helper:r}]}),e}),[])}get __availablePaymentMethodsLoader(){return this.renderRoot.querySelector(`#${this.__availablePaymentMethodsLoaderId}`)}get __availablePaymentMethodsHref(){try{const e=r(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,i=e.exec(t).groups.presetId;return new URL(`/payment_presets/${i}/available_payment_methods`,this.href||this.parent).toString()}catch(e){}}get __availablePaymentMethods(){var e,t;return null===(t=null===(e=this.__availablePaymentMethodsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}get __liveBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>e.is_live)))&&void 0!==r?r:[]}get __testBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>!e.is_live)))&&void 0!==r?r:[]}__renderPaymentMethodSelector(){return s(c||(c=w` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-i18n class="block text-xxl font-medium border-b border-contrast-10 pb-m" infer="" key="select_method_title"> </foxy-i18n> <section data-testid="select-method-list"> <div class="-my-s"> ${0} </div> </section> `),a(this.__availablePaymentMethodsHref),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>s(h||(h=w` <p class="w-m text-center font-medium text-tertiary py-s">${0}</p> <ul class="grid grid-cols-1"> ${0} </ul> `),e,t.map((e=>s(p||(p=w`<li>${0}</li>`),this.__renderPaymentMethodButton(e))))))))}__renderPaymentMethodConfig(e){var t,r,i,o,a,n;const d=P.defaultImageSrc;return s(f||(f=w` <figure data-testid="logo" class="relative flex flex-col gap-m p-m items-center"> <img class="relative h-xl w-xl object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="" @error="${0}"> <figcaption class="relative min-w-0 font-medium text-xl text-center"> ${0}​ </figcaption> </figure> <div class="rounded border border-contrast-10"> <vaadin-tabs selected="${0}" theme="centered" @selected-changed="${0}"> <vaadin-tab><foxy-i18n infer="" key="tab_live"></foxy-i18n></vaadin-tab> <vaadin-tab><foxy-i18n infer="" key="tab_test"></foxy-i18n></vaadin-tab> </vaadin-tabs> <div class="overflow-hidden" style="--lumo-border-radius:var(--lumo-border-radius-s)"> <div data-testid="tab-content" class="grid grid-cols-2 gap-m transition-transform transform duration-300" style="${0}"> ${0} </div> </div> </div> <foxy-internal-text-control infer="description"></foxy-internal-text-control> ${0} ${0} ${0} `),null!==(r=null===(t=this.getImageSrc)||void 0===t?void 0:t.call(this,e))&&void 0!==r?r:d,(e=>e.currentTarget.src=d),null!==(o=null===(i=this.form.helper)||void 0===i?void 0:i.name)&&void 0!==o?o:this.form.type,this.__tab,(e=>{var t;const r=e.currentTarget;this.__tab=null!==(t=r.selected)&&void 0!==t?t:0}),l({"width: calc(200% + var(--lumo-space-m));":!0,"--tw-translate-x: 0;":0===this.__tab,"--tw-translate-x: calc(-50% - (var(--lumo-space-m) / 2));":0!==this.__tab}),["live","test"].map(((e,t)=>{var r,i,o;const a=0===t?"":`-${e}`,n=0===t?this.__liveBlocks:this.__testBlocks;return s(u||(u=w` <div class="${0}"> ${0} ${0} ${0} ${0} </div> `),l({"grid grid-cols-1 gap-m p-m transition-opacity duration-300":!0,"opacity-100":this.__tab===t,"opacity-0":this.__tab!==t}),(null===(r=this.form.helper)||void 0===r?void 0:r.id_description)?s(m||(m=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,a):"",(null===(i=this.form.helper)||void 0===i?void 0:i.third_party_key_description)?s(_||(_=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}third-party-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,a):"",(null===(o=this.form.helper)||void 0===o?void 0:o.key_description)?s(v||(v=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,a):"",n.map((e=>this.__renderBlock(e))))})),(null===(a=this.form.helper)||void 0===a?void 0:a.supports_3d_secure)?s(y||(y=w` <foxy-internal-radio-group-control infer="three-d-secure-toggle" class="-mb-s" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> ${0} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?s(b||(b=w` <foxy-internal-checkbox-group-control infer="three-d-secure-response" class="-mb-s" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue,this.__threeDSecureResponseOptions):""):"",(null===(n=this.data)||void 0===n?void 0:n.type)?"":s(g||(g=w` <vaadin-button data-testid="select-another-button" theme="contrast" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t}){var r,i;const o=P.defaultImageSrc;return s(x||(x=w` <button class="${0}" ?disabled="${0}" @click="${0}"> <figure class="flex items-center gap-m h-m"> <img class="relative h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}​</div> ${0} </figcaption> </figure> </button> `),l({"w-full block text-left p-s rounded -mx-s":!0,"transition-colors hover-bg-contrast-5":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,(()=>this.edit({type:e,helper:t})),null!==(i=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==i?i:o,(e=>e.currentTarget.src=o),l({"min-w-0 flex-1 truncate leading-s":!0,"text-tertiary":!!t.conflict}),t.name,t.conflict?s($||($=w` <foxy-i18n class="block text-tertiary text-xs" infer="" key="conflict_message" .options="${0}"> </foxy-i18n> `),t.conflict):"")}__renderBlock(e){return s(j||(j=w`${0}`),e.fields.map((t=>{var r,o,a;const l=[e.parent_id,e.id,t.id].filter((e=>!!e)),n=["additional-fields",...l].join("-").replace(/_/g,"-"),c=()=>{var e,r;try{const t=JSON.parse(null!==(e=this.form.additional_fields)&&void 0!==e?e:"{}");return null!==(r=i(t,l))&&void 0!==r?r:t.default_value}catch(e){return t.default_value}},h=e=>{var t;try{const r=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");this.edit({additional_fields:JSON.stringify(d(r,l,e))})}catch(e){return""}},p=t.options;return s(k||(k=w` ${0} `),"checkbox"===t.type?s(S||(S=w` <foxy-internal-checkbox-group-control helper-text="${0}" label="" class="-mb-s" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> `),null!==(r=t.description)&&void 0!==r?r:"",n,[{label:t.name,value:"checked"}],(()=>c()?["checked"]:[]),(e=>{h(e.includes("checked"))})):"select"===t.type?s(V||(V=w` <foxy-internal-select-control helper-text="${0}" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=t.description)&&void 0!==o?o:"",t.name,n,p.map((({name:e,value:t})=>({label:e,value:t}))),c,h):s(M||(M=w` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(a=t.description)&&void 0!==a?a:"",t.default_value||this.t("default_additional_field_placeholder"),t.name,n,c,h))})))}}customElements.define("foxy-payments-api-payment-method-form",P);export{P as PaymentsApiPaymentMethodForm};
|
|
1
|
+
import"./shared-cb6f2388.js";import"./shared-85bc54a6.js";import"./shared-23923638.js";import"./shared-dcbaa1c5.js";import"./shared-a6518411.js";import"./shared-3a82d3f5.js";import"./shared-1e5292a1.js";import{I as e}from"./shared-6fb923d5.js";import"./foxy-nucleon-element.js";import"./shared-86768244.js";import{_ as t,aJ as r,$ as i}from"./shared-98755831.js";import{a as o}from"./shared-16b542bc.js";import{i as a}from"./shared-d3bf9ac0.js";import{c as l}from"./shared-4e709717.js";import{h as s}from"./shared-7f33a83a.js";import{h as n}from"./shared-ca5e1c6b.js";import{s as d}from"./shared-c7f56c90.js";import"./shared-c40d85dc.js";import"./shared-7a290f36.js";import"./shared-4c9f96ec.js";import"./shared-cd096e97.js";import"./shared-e28f16db.js";import"./shared-4db2c7b1.js";import"./shared-0543c6e0.js";import"./shared-b95ef318.js";import"./shared-0c02b4ee.js";import"./shared-5dd31b4e.js";import"./shared-0479553e.js";import"./shared-de790de9.js";import"./shared-a8cf402a.js";import"./shared-eb900735.js";import"./shared-509a2f52.js";import"./shared-64657919.js";import"./shared-d6276c83.js";import"./shared-a89cb472.js";import"./shared-d493355a.js";import"./shared-0dc1d012.js";import"./shared-9e60ef60.js";import"./foxy-spinner.js";import"./shared-ca58ef47.js";import"./shared-bfdbd733.js";let c,h,p,f,u,m,_,v,y,b,g,x,$,j,k,S,V,M,w=e=>e;const L=o(e,"payments-api-payment-method-form");class P extends L{constructor(){super(...arguments),this.getImageSrc=null,this.templates={},this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__threeDSecureResponseGetValue=()=>{var e;return(null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response"))?["valid_only"]:[]},this.__threeDSecureResponseSetValue=e=>{const t=e.includes("valid_only")?"_require_valid_response":"",r=this.form.config_3d_secure,i=(null==r?void 0:r.startsWith("all_cards"))?"all_cards":"maestro_only";this.edit({config_3d_secure:`${i}${t}`})},this.__threeDSecureResponseOptions=[{value:"valid_only",label:"option_valid_only"}],this.__threeDSecureToggleGetValue=()=>{const e=this.form.config_3d_secure;return(null==e?void 0:e.startsWith("all_cards"))?"all_cards":(null==e?void 0:e.startsWith("maestro_only"))?"maestro_only":"off"},this.__threeDSecureToggleSetValue=e=>{var t;let r="";"all_cards"!==e&&"maestro_only"!==e||(r=(null===(t=this.form.config_3d_secure)||void 0===t?void 0:t.endsWith("require_valid_response"))?`${e}_require_valid_response`:e),this.edit({config_3d_secure:r})},this.__threeDSecureToggleOptions=[{value:"off",label:"option_off"},{value:"all_cards",label:"option_all_cards"},{value:"maestro_only",label:"option_maestro_only"}],this.__tab=0}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='m29.3 14 14-14H32.1l-14 14h11.2Zm2.7 9.9 12-12V.7L30.62 14.1A2 2 0 0 1 32 16v7.9ZM13.31 44h11.18L44 24.5V13.3l-12 12V28a2 2 0 0 1-2 2h-2.69l-14 14Zm-1.41 0H.7l14-14h11.2l-14 14Zm14 0h11.2l6.9-6.9V25.9L25.9 44Zm12.6 0H44v-5.5L38.5 44Z'/%3E%3Cpath fill='%23fff' d='M30 28H14v-6h16v6Zm0-10v-2H14v2h16ZM0 43.3l13.4-13.4A2 2 0 0 1 12 28v-7.9L0 32.12V43.3Z'/%3E%3Cpath fill='%23fff' d='M16.7 14H14c-1.11 0-1.99.89-1.99 2v2.7L0 30.7V19.52L19.52 0H30.7l-14 14Zm1.4-14H6.92L0 6.92V18.1L18.1 0ZM5.5 0H0v5.5L5.5 0Z'/%3E%3C/svg%3E"}static get properties(){return t(t({},super.properties),{},{__tab:{attribute:!1},getImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",e=>{var t,r,i,o;const a=null!==(i=null===(r=null===(t=e.helper)||void 0===t?void 0:t.additional_fields)||void 0===r?void 0:r.blocks)&&void 0!==i?i:[];let l;try{l=JSON.parse(null!==(o=e.additional_fields)&&void 0!==o?o:"{}")}catch(e){l={}}for(const e of a)for(const t of e.fields)if("optional"in t&&!t.optional){const r=[e.parent_id,e.id,t.id].filter((e=>!!e));if(!n(l,r)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid"}return!0}]}renderBody(){return this.form.type?this.__renderPaymentMethodConfig(this.form.type):this.__renderPaymentMethodSelector()}get __groupedAvailablePaymentMethods(){var e;return Object.entries(null!==(e=this.__availablePaymentMethods)&&void 0!==e?e:{}).sort(((e,t)=>e[0].localeCompare(t[0],"en"))).reduce(((e,[t,r])=>{const i=t.charAt(0).toUpperCase(),o=!/\w/.test(i)?"#":i,a=e.find((e=>e.name===o));return a?a.items.push({type:t,helper:r}):e.push({name:o,items:[{type:t,helper:r}]}),e}),[])}get __availablePaymentMethodsLoader(){return this.renderRoot.querySelector(`#${this.__availablePaymentMethodsLoaderId}`)}get __availablePaymentMethodsHref(){try{const e=r(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,i=e.exec(t).groups.presetId;return new URL(`/payment_presets/${i}/available_payment_methods`,this.href||this.parent).toString()}catch(e){}}get __availablePaymentMethods(){var e,t;return null===(t=null===(e=this.__availablePaymentMethodsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t.values}get __liveBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>e.is_live)))&&void 0!==r?r:[]}get __testBlocks(){var e,t,r;return null!==(r=null===(t=null===(e=this.form.helper)||void 0===e?void 0:e.additional_fields)||void 0===t?void 0:t.blocks.filter((e=>!e.is_live)))&&void 0!==r?r:[]}__renderPaymentMethodSelector(){return s(c||(c=w` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-i18n class="block text-xxl font-medium border-b border-contrast-10 pb-m" infer="" key="select_method_title"> </foxy-i18n> <section data-testid="select-method-list"> <div class="-my-s"> ${0} </div> </section> `),a(this.__availablePaymentMethodsHref),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>s(h||(h=w` <p class="w-m text-center font-medium text-tertiary py-s">${0}</p> <ul class="grid grid-cols-1"> ${0} </ul> `),e,t.map((e=>s(p||(p=w`<li>${0}</li>`),this.__renderPaymentMethodButton(e))))))))}__renderPaymentMethodConfig(e){var t,r,i,o,a,n;const d=P.defaultImageSrc;return s(f||(f=w` <figure data-testid="logo" class="relative flex flex-col gap-m p-m items-center"> <img class="relative h-xl w-xl object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="" @error="${0}"> <figcaption class="relative min-w-0 font-medium text-xl text-center"> ${0}​ </figcaption> </figure> <div class="rounded border border-contrast-10"> <vaadin-tabs selected="${0}" theme="centered" @selected-changed="${0}"> <vaadin-tab><foxy-i18n infer="" key="tab_live"></foxy-i18n></vaadin-tab> <vaadin-tab><foxy-i18n infer="" key="tab_test"></foxy-i18n></vaadin-tab> </vaadin-tabs> <div class="overflow-hidden" style="--lumo-border-radius:var(--lumo-border-radius-s)"> <div data-testid="tab-content" class="grid grid-cols-2 gap-m transition-transform transform duration-300" style="${0}"> ${0} </div> </div> </div> <foxy-internal-text-control infer="description"></foxy-internal-text-control> ${0} ${0} ${0} `),null!==(r=null===(t=this.getImageSrc)||void 0===t?void 0:t.call(this,e))&&void 0!==r?r:d,(e=>e.currentTarget.src=d),null!==(o=null===(i=this.form.helper)||void 0===i?void 0:i.name)&&void 0!==o?o:this.form.type,this.__tab,(e=>{var t;const r=e.currentTarget;this.__tab=null!==(t=r.selected)&&void 0!==t?t:0}),l({"width: calc(200% + var(--lumo-space-m));":!0,"--tw-translate-x: 0;":0===this.__tab,"--tw-translate-x: calc(-50% - (var(--lumo-space-m) / 2));":0!==this.__tab}),["live","test"].map(((e,t)=>{var r,i,o;const a=0===t?"":`-${e}`,n=0===t?this.__liveBlocks:this.__testBlocks;return s(u||(u=w` <div class="${0}"> ${0} ${0} ${0} ${0} </div> `),l({"grid grid-cols-1 gap-m p-m transition-opacity duration-300":!0,"opacity-100":this.__tab===t,"opacity-0":this.__tab!==t}),(null===(r=this.form.helper)||void 0===r?void 0:r.id_description)?s(m||(m=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,a):"",(null===(i=this.form.helper)||void 0===i?void 0:i.third_party_key_description)?s(_||(_=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}third-party-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,a):"",(null===(o=this.form.helper)||void 0===o?void 0:o.key_description)?s(v||(v=w` <foxy-internal-text-control placeholder="${0}" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,a):"",n.map((e=>this.__renderBlock(e))))})),(null===(a=this.form.helper)||void 0===a?void 0:a.supports_3d_secure)?s(y||(y=w` <foxy-internal-radio-group-control infer="three-d-secure-toggle" class="-mb-s" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-radio-group-control> ${0} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?s(b||(b=w` <foxy-internal-checkbox-group-control infer="three-d-secure-response" class="-mb-s" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue,this.__threeDSecureResponseOptions):""):"",(null===(n=this.data)||void 0===n?void 0:n.type)?"":s(g||(g=w` <vaadin-button data-testid="select-another-button" theme="contrast" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t}){var r,i;const o=P.defaultImageSrc;return s(x||(x=w` <button class="${0}" ?disabled="${0}" @click="${0}"> <figure class="flex items-center gap-m h-m"> <img class="relative h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}​</div> ${0} </figcaption> </figure> </button> `),l({"w-full block text-left p-s rounded -mx-s":!0,"transition-colors hover-bg-contrast-5":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,(()=>this.edit({type:e,helper:t})),null!==(i=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==i?i:o,(e=>e.currentTarget.src=o),l({"min-w-0 flex-1 truncate leading-s":!0,"text-tertiary":!!t.conflict}),t.name,t.conflict?s($||($=w` <foxy-i18n class="block text-tertiary text-xs" infer="" key="conflict_message" .options="${0}"> </foxy-i18n> `),t.conflict):"")}__renderBlock(e){return s(j||(j=w`${0}`),e.fields.map((t=>{var r,o,a;const l=[e.parent_id,e.id,t.id].filter((e=>!!e)),n=["additional-fields",...l].join("-").replace(/_/g,"-"),c=()=>{var e,r;try{const t=JSON.parse(null!==(e=this.form.additional_fields)&&void 0!==e?e:"{}");return null!==(r=i(t,l))&&void 0!==r?r:t.default_value}catch(e){return t.default_value}},h=e=>{var t;try{const r=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");this.edit({additional_fields:JSON.stringify(d(r,l,e))})}catch(e){return""}},p=t.options;return s(k||(k=w` ${0} `),"checkbox"===t.type?s(S||(S=w` <foxy-internal-checkbox-group-control helper-text="${0}" label="" class="-mb-s" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-checkbox-group-control> `),null!==(r=t.description)&&void 0!==r?r:"",n,[{label:t.name,value:"checked"}],(()=>c()?["checked"]:[]),(e=>{h(e.includes("checked"))})):"select"===t.type?s(V||(V=w` <foxy-internal-select-control helper-text="${0}" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=t.description)&&void 0!==o?o:"",t.name,n,p.map((({name:e,value:t})=>({label:e,value:t}))),c,h):s(M||(M=w` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(a=t.description)&&void 0!==a?a:"",t.default_value||this.t("default_additional_field_placeholder"),t.name,n,c,h))})))}}customElements.define("foxy-payments-api-payment-method-form",P);export{P as PaymentsApiPaymentMethodForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-
|
|
1
|
+
import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-86768244.js";import{a as s}from"./shared-16b542bc.js";import{T as e}from"./shared-c3c67413.js";import{c as r}from"./shared-4e709717.js";import{h as a}from"./shared-7f33a83a.js";import"./shared-e28f16db.js";import"./shared-7a290f36.js";import"./shared-ca58ef47.js";import"./shared-98755831.js";import"./shared-a8cf402a.js";import"./shared-64657919.js";import"./shared-de790de9.js";import"./shared-d3bf9ac0.js";import"./shared-3a252ccd.js";import"./shared-eb900735.js";import"./shared-509a2f52.js";import"./shared-d6276c83.js";import"./shared-a89cb472.js";let t,d,i=s=>s;const o=s(e,"payments-api-payment-preset-card");class p extends o{renderBody(){return super.renderBody({title:s=>a(t||(t=i`${0}`),s.description),subtitle:({is_live:s})=>a(d||(d=i` <foxy-i18n class="${0}" infer="" key="status_${0}"> </foxy-i18n> `),r({"text-success":s}),s?"live":"test")})}}customElements.define("foxy-payments-api-payment-preset-card",p);export{p as PaymentsApiPaymentPresetCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-dcbaa1c5.js";import"./shared-03b39ec4.js";import"./shared-1e5292a1.js";import{I as e}from"./shared-6fb923d5.js";import"./foxy-payments-api-fraud-protection-card.js";import"./foxy-payments-api-fraud-protection-form.js";import"./foxy-payments-api-payment-method-card.js";import"./foxy-payments-api-payment-method-form.js";import{_ as t}from"./shared-98755831.js";import{a as r}from"./shared-16b542bc.js";import{h as a}from"./shared-7f33a83a.js";import"./shared-d493355a.js";import"./shared-c40d85dc.js";import"./shared-7a290f36.js";import"./shared-b95ef318.js";import"./shared-4c9f96ec.js";import"./shared-e28f16db.js";import"./shared-0c02b4ee.js";import"./shared-5dd31b4e.js";import"./shared-0479553e.js";import"./shared-86768244.js";import"./shared-64657919.js";import"./shared-a8cf402a.js";import"./shared-de790de9.js";import"./shared-d3bf9ac0.js";import"./shared-eb900735.js";import"./shared-509a2f52.js";import"./shared-d6276c83.js";import"./shared-a89cb472.js";import"./shared-cb6f2388.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-ca58ef47.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-0dc1d012.js";import"./shared-9e60ef60.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-c3c67413.js";import"./shared-3a252ccd.js";import"./shared-b88e35b7.js";import"./shared-aeec3cab.js";import"./shared-f3f5e87e.js";import"./shared-3a82d3f5.js";import"./shared-0543c6e0.js";import"./shared-4db2c7b1.js";import"./foxy-nucleon-element.js";import"./shared-c7f56c90.js";import"./shared-bfdbd733.js";import"./shared-ca5e1c6b.js";import"./shared-85bc54a6.js";import"./shared-cd096e97.js";import"./shared-23923638.js";import"./shared-a6518411.js";let s,o,i,p,n,d,m=e=>e;const c=r(e,"payments-api-payment-preset-form");class h extends c{constructor(){super(...arguments),this.getFraudProtectionImageSrc=null,this.getPaymentMethodImageSrc=null,this.templates={},this.__getIsPOEnabledValue=()=>this.form.is_purchase_order_enabled?["true"]:[],this.__setIsPOEnabledValue=e=>{this.edit({is_purchase_order_enabled:e.includes("true")})},this.__getIsLiveValue=()=>this.form.is_live?["live"]:["test"],this.__setIsLiveValue=e=>{this.edit({is_live:e.includes("live")})}}static get properties(){return t(t({},super.properties),{},{getFraudProtectionImageSrc:{attribute:!1},getPaymentMethodImageSrc:{attribute:!1}})}static get v8n(){return[({description:e})=>!!e||"description:v8n_required",({description:e})=>e&&e.length<=100||"description:v8n_too_long"]}renderBody(){const e=this.constructor;return a(s||(s=m` <foxy-internal-text-control infer="description"></foxy-internal-text-control> <div class="-mb-s"> <foxy-internal-checkbox-group-control infer="is-live" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> <foxy-internal-checkbox-group-control infer="is-purchase-order-enabled" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> </div> ${0} ${0} `),this.__getIsLiveValue,this.__setIsLiveValue,e.__isLiveOptions,this.__getIsPOEnabledValue,this.__setIsPOEnabledValue,e.__isPOEnabledOptions,this.data?a(o||(o=m` <foxy-internal-async-list-control infer="payment-methods" first="${0}" limit="5" .item="${0}" .form="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="fraud-protections" first="${0}" limit="5" .item="${0}" .form="${0}"> </foxy-internal-async-list-control> `),this.data._links["fx:payment_methods"].href,(e=>a(i||(i=m` <foxy-payments-api-payment-method-card parent="${0}" infer="payments-api-payment-method-card" href="${0}" .getImageSrc="${0}"> </foxy-payments-api-payment-method-card> `),e.parent,e.href,this.getPaymentMethodImageSrc)),(e=>a(p||(p=m` <foxy-payments-api-payment-method-form parent="${0}" infer="payments-api-payment-method-form" href="${0}" id="form" .getImageSrc="${0}" @fetch="${0}" @update="${0}"> </foxy-payments-api-payment-method-form> `),e.dialog.parent,e.dialog.href,this.getPaymentMethodImageSrc,e.handleFetch,e.handleUpdate)),this.data._links["fx:fraud_protections"].href,(e=>a(n||(n=m` <foxy-payments-api-fraud-protection-card parent="${0}" infer="payments-api-fraud-protection-card" href="${0}" .getImageSrc="${0}"> </foxy-payments-api-fraud-protection-card> `),e.parent,e.href,this.getFraudProtectionImageSrc)),(e=>a(d||(d=m` <foxy-payments-api-fraud-protection-form parent="${0}" infer="payments-api-fraud-protection-form" href="${0}" id="form" .getImageSrc="${0}" @fetch="${0}" @update="${0}"> </foxy-payments-api-fraud-protection-form> `),e.dialog.parent,e.dialog.href,this.getFraudProtectionImageSrc,e.handleFetch,e.handleUpdate))):"",super.renderBody())}}h.__isPOEnabledOptions=[{label:"option_true",value:"true"}],h.__isLiveOptions=[{label:"option_live",value:"live"}],customElements.define("foxy-payments-api-payment-preset-form",h);export{h as PaymentsApiPaymentPresetForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L as e}from"./shared-7f33a83a.js";import{F as t}from"./shared-64657919.js";import{aJ as a,_ as s,am as n}from"./shared-98755831.js";import{A as r}from"./shared-509a2f52.js";async function o(e){const t=await e;if(!t.ok)throw new Error(await t.text());return t.json()}async function i(e){var t;let s,n;try{const{hostedPaymentGatewaysHelperUrl:r,paymentGatewaysHelperUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if("GET"!==d.method)throw s=405,new Error("Method not allowed. Allowed methods: GET.");const p=a(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}).exec(new URL(d.url).pathname).groups.presetId,h=o(m(r)),y=o(m(i)),f=null===(t=(await o(m(l(p))))._links["fx:payment_gateway"])||void 0===t?void 0:t.href,c=f?await o(m(f)):void 0,u=function(e){const{hostedPaymentGatewaysHelper:t,paymentGatewaysHelper:a,paymentPresetId:s,paymentGateway:n,base:r}=e,o=new URL(`./payment_presets/${s}/available_payment_methods`,r),i={};return Object.entries(t.values).forEach((([e,t])=>{i[e]=t})),Object.entries(a.values).forEach((([e,t])=>{i[e]=t,n&&(i[e].conflict={type:n.type,name:n.description})})),{_links:{self:{href:o.toString()}},values:i}}({hostedPaymentGatewaysHelper:await h,paymentGatewaysHelper:await y,paymentPresetId:p,paymentGateway:c,base:new URL(d.url).origin});n=JSON.stringify(u),s=200}catch(e){n=e instanceof Error?e.message:String(e),s=null!=s?s:500}return new Response(n,{status:s})}function l(e){const{paymentPresetId:t,base:a}=e;return{_links:{self:{href:new URL(`./payment_presets/${t}/available_fraud_protections`,a).toString()}},values:{minfraud:{name:"MaxMind minFraud",uses_rejection_threshold:!0,json:null},google_recaptcha:{name:"Google reCAPTCHA",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"config",name:"Configuration",type:"select",description:"Determines how reCAPTCHA is configured to operate.",default_value:"disabled",options:[{name:"Disabled",value:"disabled"},{name:"Always enabled",value:"enabled_always"},{name:"Enabled by errors",value:"enabled_by_errors"}]},{id:"private_key",name:"Private Key",type:"text",optional:!0,description:"If using a custom subdomain, enter your Private Key here.",default_value:""},{id:"site_key",name:"Site Key",type:"text",optional:!0,description:"If using a custom subdomain, enter your Site Key here.",default_value:""}]}]}},custom_precheckout_hook:{name:"Pre-Checkout Webhook",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"enabled",name:"Enabled",type:"checkbox",default_value:!1},{id:"url",name:"URL",type:"text",description:"Url of your Pre-Checkout Hook",default_value:""},{id:"failure_handling",name:"Failure handling",type:"select",description:"Determines what happens to the checkout if your webhook fails.",default_value:"",options:[{name:"Reject",value:"reject"},{name:"Approve",value:"approve"}]}]}]}}}}}async function d(e){let t,s;try{const{request:n}=e;if("GET"!==n.method)throw t=405,new Error("Method not allowed. Allowed methods: GET.");const r=l({paymentPresetId:a(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}).exec(new URL(n.url).pathname).groups.presetId,base:new URL(n.url).origin});s=JSON.stringify(r),t=200}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}const m=["_links"];function p(e){const{paymentMethodSetFraudProtectionId:t,paymentPresetId:a,fraudProtection:r,base:o}=e,{_links:i}=r,d=n(r,m),p=l({paymentPresetId:a,base:o}),h=`${new URL(i.self.href).pathname.split("/").pop()}C${t}`,y=new URL(`./payment_presets/${a}`,o),f=new URL(`./payment_presets/${a}/fraud_protections/${h}`,o);return s(s({_links:{self:{href:f.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:y.toString()}}},d),{},{helper:p.values[r.type]})}async function h(e){var t,s;let n,r;try{const{fraudProtectionsUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if(!["GET","POST"].includes(d.method))throw n=405,new Error("Method not allowed. Allowed methods: GET, POST.");const h=new URL(d.url),y=a(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}).exec(h.pathname).groups.presetId,f=await o(m(l(y)));if("GET"===d.method){const e=parseInt(null!==(t=h.searchParams.get("offset"))&&void 0!==t?t:"0"),a=parseInt(null!==(s=h.searchParams.get("limit"))&&void 0!==s?s:"20"),i=new URL(f._links["fx:payment_method_set_fraud_protections"].href);i.searchParams.set("offset",String(Math.max(0,e-1))),i.searchParams.set("limit",String(a));const l=await o(m(i.toString())),c=await Promise.all(l._embedded["fx:payment_method_set_fraud_protections"].map((async e=>o(m(e._links["fx:fraud_protection"].href))))),u=function(e){const{paymentMethodSetFraudProtections:t,fraudProtections:a,paymentPresetId:s,base:n}=e,r=new URL(`/payment_presets/${s}/fraud_protections`,n);r.search=new URL(t._links.self.href).search;const o=new URL(r.toString());o.search=new URL(t._links.first.href).search;const i=new URL(r.toString());i.search=new URL(t._links.last.href).search;const l=new URL(r.toString());l.search=new URL(t._links.prev.href).search;const d=new URL(r.toString());d.search=new URL(t._links.next.href).search;const m=a.map((e=>{const a=t._embedded["fx:payment_method_set_fraud_protections"].find((t=>t.fraud_protection_uri===e._links.self.href));return p({paymentMethodSetFraudProtectionId:new URL(a._links.self.href).pathname.split("/").pop(),fraudProtection:e,paymentPresetId:s,base:n})}));return{_links:{first:{href:o.toString()},last:{href:i.toString()},prev:{href:l.toString()},next:{href:d.toString()},self:{href:r.toString()}},_embedded:{"fx:fraud_protections":m},returned_items:t.returned_items,total_items:t.total_items,offset:t.offset,limit:t.limit}}({paymentMethodSetFraudProtections:l,fraudProtections:c,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(u)}else{const e=await d.json();delete e.helper;const t=m(i,{method:"POST",body:JSON.stringify(e)}),a=await o(t),s=await o(m(f._links["fx:payment_method_set_fraud_protections"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:f._links.self.href,fraud_protection_uri:a._links.self.href})})),l=p({paymentMethodSetFraudProtectionId:new URL(s._links.self.href).pathname.split("/").pop(),fraudProtection:a,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(l)}}catch(e){r=e instanceof Error?e.message:String(e),n=null!=n?n:500}return new Response(r,{status:n})}async function y(e){let t,s;try{const{getPaymentMethodSetUrl:n,getFraudProtectionUrl:r,request:i,fetch:l}=e;if(!["GET","PATCH","DELETE"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const d=a(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),{presetId:m,protectionId:h}=d.exec(i.url).groups,y=n(m),f=h.substring(0,h.indexOf("C"));if("DELETE"===i.method){const e=(await o(l(y)))._links["fx:payment_method_set_fraud_protections"].href,t=new URL(e);t.searchParams.set("fraud_protection_id",f);const a=await o(l(t.toString())),s=a._embedded["fx:payment_method_set_fraud_protections"].map((e=>o(l(e._links.self.href,{method:"DELETE"}))));await Promise.all(s)}let c=await i.text();try{const e=JSON.parse(c);delete e.helper,c=JSON.stringify(e)}catch(e){}const u=l(r(f),{method:i.method,body:"PATCH"===i.method?c:null}),_=await o(u);s="DELETE"===i.method?JSON.stringify({message:"Fraud protection was successfully deleted."}):JSON.stringify(p({paymentMethodSetFraudProtectionId:h.substring(h.indexOf("C")+1),fraudProtection:_,paymentPresetId:m,base:new URL(i.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}const f=["_links"];function c(e){const{paymentPresetId:t,helper:a,base:r}=e,o="paymentGateway"in e?e.paymentGateway:e.hostedPaymentGateway,{_links:i}=o,l=n(o,f),d=new URL(i.self.href).pathname.split("/").pop();let m;m="paymentMethodSetHostedPaymentGatewayId"in e?`H${d}C${e.paymentMethodSetHostedPaymentGatewayId}`:`R${d}`;const p=new URL(`./payment_presets/${t}`,r),h=new URL(`./payment_presets/${t}/payment_methods/${m}`,r);return s(s({_links:{self:{href:h.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:p.toString()}}},l),{},{helper:a})}async function u(e){var t,s,n,r;let i,l;try{const{hostedPaymentGatewaysHelperUrl:d,paymentGatewaysHelperUrl:m,hostedPaymentGatewaysUrl:p,getPaymentMethodSetUrl:h,paymentGatewaysUrl:y,request:f,fetch:u}=e;if(!["GET","POST"].includes(f.method))throw i=405,new Error("Method not allowed. Allowed methods: GET, POST.");const _=new URL(f.url),w=a(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}).exec(_.pathname).groups.presetId,[g,P,S]=await Promise.all([o(u(d)),o(u(m)),o(u(h(w)))]);if("GET"===f.method){const e=parseInt(null!==(t=_.searchParams.get("offset"))&&void 0!==t?t:"0"),a=parseInt(null!==(s=_.searchParams.get("limit"))&&void 0!==s?s:"20"),r=new URL(S._links["fx:payment_method_set_hosted_payment_gateways"].href);r.searchParams.set("offset",String(Math.max(0,e-1))),r.searchParams.set("limit",String(a));const d=null===(n=S._links["fx:payment_gateway"])||void 0===n?void 0:n.href,[m,p]=await Promise.all([d&&0===e?o(u(d)):null,o(u(r.toString()))]),h=await Promise.all(p._embedded["fx:payment_method_set_hosted_payment_gateways"].map((async e=>o(u(e._links["fx:hosted_payment_gateway"].href))))),y=function(e){var t,a;const{paymentMethodSetHostedPaymentGateways:s,hostedPaymentGatewaysHelper:n,hostedPaymentGateways:r,paymentGatewaysHelper:o,paymentPresetId:i,paymentGateway:l,query:d,base:m}=e,p=new URLSearchParams(d),h=parseInt(null!==(t=p.get("offset"))&&void 0!==t?t:"0"),y=parseInt(null!==(a=p.get("limit"))&&void 0!==a?a:"20"),f=s.total_items+(l?1:0),u=s.returned_items+(l&&"not-on-page"!==l?1:0),_=new URL(`/payment_presets/${i}/payment_methods`,m);_.search=d;const w=new URL(_.toString()),g=new URL(_.toString()),P=new URL(_.toString()),S=new URL(_.toString());w.searchParams.set("limit",String(y)),w.searchParams.set("offset",String(h)),g.searchParams.set("limit",String(y)),g.searchParams.set("offset",String(Math.max(0,f-y))),P.searchParams.set("limit",String(y)),P.searchParams.set("offset",String(Math.max(0,h-y))),S.searchParams.set("limit",String(y)),S.searchParams.set("offset",String(Math.min(h+y,Math.max(0,f-y))));const U=[...l&&"not-on-page"!==l?[l]:[],...r].map((e=>{const t=s._embedded["fx:payment_method_set_hosted_payment_gateways"].find((t=>t.hosted_payment_gateway_uri===e._links.self.href));return c(t?{paymentMethodSetHostedPaymentGatewayId:new URL(t._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:e,paymentPresetId:i,helper:n.values[e.type],base:m}:{paymentPresetId:i,paymentGateway:e,helper:o.values[e.type],base:m})}));return{_links:{first:{href:w.toString()},last:{href:g.toString()},prev:{href:P.toString()},next:{href:S.toString()},self:{href:_.toString()}},_embedded:{"fx:payment_methods":U},returned_items:u,total_items:f,offset:h,limit:y}}({paymentMethodSetHostedPaymentGateways:p,hostedPaymentGatewaysHelper:g,paymentGatewaysHelper:P,hostedPaymentGateways:h,paymentPresetId:w,paymentGateway:m||(d?"not-on-page":void 0),query:new URL(f.url).search,base:new URL(f.url).origin});i=200,l=JSON.stringify(y)}else{const e=await f.clone().json(),t=!!g.values[null!==(r=e.type)&&void 0!==r?r:""];if(delete e.helper,t){const t=await o(u(p,{method:"POST",body:JSON.stringify(e)})),a=await o(u(S._links["fx:payment_method_set_hosted_payment_gateways"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:S._links.self.href,hosted_payment_gateway_uri:t._links.self.href})})),s=c({paymentMethodSetHostedPaymentGatewayId:new URL(a._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:t,paymentPresetId:w,helper:g.values[t.type],base:new URL(f.url).origin});i=200,l=JSON.stringify(s)}else{const t=u(y,{method:f.method,body:JSON.stringify(e)}),a=await o(t),s={gateway_uri:a._links.self.href};await Promise.all([o(u(S._links.self.href,{method:"PATCH",body:JSON.stringify(s)})),S.gateway_uri?o(u(S.gateway_uri,{method:"DELETE"})):null]);const n=c({paymentPresetId:w,paymentGateway:a,helper:P.values[a.type],base:new URL(f.url).origin});i=200,l=JSON.stringify(n)}}}catch(e){l=e instanceof Error?e.message:String(e),i=null!=i?i:500}return new Response(l,{status:i})}const _=["_links"];function w(e){const{paymentMethodSet:t,base:a}=e,{_links:r}=t,o=n(t,_),i=new URL(t._links.self.href).pathname.split("/").pop(),l=new URL(`./payment_presets/${i}`,a),d=new URL(`./payment_presets/${i}/payment_methods`,a),m=new URL(`./payment_presets/${i}/fraud_protections`,a),p=new URL(`./payment_presets/${i}/available_payment_methods`,a),h=new URL(`./payment_presets/${i}/available_fraud_protections`,a);return s({_links:{self:{href:l.toString()},"fx:store":r["fx:store"],"fx:payment_methods":{href:d.toString()},"fx:fraud_protections":{href:m.toString()},"fx:available_payment_methods":{href:p.toString()},"fx:available_fraud_protections":{href:h.toString()}}},o)}const g=["_embedded","_links"];async function P(e){let t,a;try{const{paymentMethodSetsUrl:r,request:i,fetch:l}=e;if(!["GET","POST"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, POST.");const d=new URL(i.url),m=new URL(r);let p;if(m.search=d.search,"POST"===i.method){const e=l(m.toString(),{method:"POST",body:await i.text()});p=w({paymentMethodSet:await o(e),base:d.origin})}else p=function(e){const{paymentMethodSets:t,base:a}=e,{_embedded:r,_links:o}=t,i=n(t,g),l=new URL("./payment_presets",a),d=new URL(o.first.href);l.search=d.search;const m=new URL("./payment_presets",a),p=new URL(o.last.href);m.search=p.search;const h=new URL("./payment_presets",a),y=new URL(o.prev.href);h.search=y.search;const f=new URL("./payment_presets",a),c=new URL(o.next.href);f.search=c.search;const u=new URL("./payment_presets",a),_=new URL(o.self.href);return u.search=_.search,s(s({},i),{},{_links:{first:{href:l.toString()},last:{href:m.toString()},prev:{href:h.toString()},next:{href:f.toString()},self:{href:u.toString()}},_embedded:{"fx:payment_presets":r["fx:payment_method_sets"].map((e=>w({paymentMethodSet:e,base:a})))}})}({paymentMethodSets:await o(l(m.toString())),base:d.origin});a=JSON.stringify(p),t=200}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}async function S(e){let t,s;try{const{getPaymentMethodSetUrl:n,request:r,fetch:i}=e;if(!["GET","PATCH","DELETE"].includes(r.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const l=a(/payment_presets\/(.+)/,{presetId:1}).exec(r.url).groups.presetId,d=new URL(r.url),m=new URL(n(l));m.search=d.search;const p=await o(i(m.toString(),{method:r.method,body:"PATCH"===r.method?await r.text():null}));s="DELETE"===r.method?JSON.stringify({message:"Payment preset was successfully deleted."}):JSON.stringify(w({paymentMethodSet:p,base:new URL(r.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}async function U(e){let t,s;try{const{hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,getPaymentMethodSetHostedPaymentGatewayUrl:i,getHostedPaymentGatewayUrl:l,getPaymentMethodSetUrl:d,getPaymentGatewayUrl:m,request:p,fetch:h}=e;if(!["GET","PATCH","DELETE"].includes(p.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const y=a(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),{presetId:f,methodId:u}=y.exec(p.url).groups,_=u.startsWith("H"),w=d(f),g=u.substring(1,_?u.indexOf("C"):void 0),P=o(h(n)),S=o(h(r));if("DELETE"===p.method)if(_){const e=i(u.substring(u.indexOf("C")+1));await o(h(e,{method:"DELETE"}))}else{const e={gateway_uri:""},t=JSON.stringify(e);await o(h(w,{method:"PATCH",body:t}))}let U=await p.text();try{const e=JSON.parse(U);delete e.helper,U=JSON.stringify(e)}catch(e){}if(_){const e=h(l(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await P,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(c({paymentMethodSetHostedPaymentGatewayId:u.substring(u.indexOf("C")+1),hostedPaymentGateway:a,paymentPresetId:f,helper:t.values[a.type],base:new URL(p.url).origin}))}else{const e=h(m(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await S,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(c({paymentGateway:a,paymentPresetId:f,helper:t.values[a.type],base:new URL(p.url).origin}))}}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}class b extends e{constructor(){super(...arguments),this.paymentMethodSetHostedPaymentGatewaysUrl=null,this.hostedPaymentGatewaysHelperUrl=null,this.hostedPaymentGatewaysUrl=null,this.paymentGatewaysHelperUrl=null,this.paymentMethodSetsUrl=null,this.fraudProtectionsUrl=null,this.paymentGatewaysUrl=null,this.__api=new r(this),this.__fetch=this.__api.fetch.bind(this.__api),this.__handleFetch=e=>{if(!(e instanceof t))return;if(!e.request.url.startsWith("https://foxy-payments-api.element/"))return;if(e.defaultPrevented)return;const{paymentMethodSetHostedPaymentGatewaysUrl:s,hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,hostedPaymentGatewaysUrl:o,paymentMethodSetsUrl:l,fraudProtectionsUrl:m,paymentGatewaysUrl:p}=this;if(null===s)return;if(null===n)return;if(null===r)return;if(null===o)return;if(null===l)return;if(null===m)return;if(null===p)return;const f=e=>t=>{const a=new URL(e);return a.pathname.endsWith("/")||(a.pathname+="/"),a.pathname+=t,a.toString()},c=function(e){const t=[[a(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),U],[a(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}),d],[a(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}),i],[a(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),y],[a(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}),h],[a(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}),u],[a(/\/payment_presets\/(.+)/,{presetId:1}),S],[/\/payment_presets/,P]];for(const[a,s]of t)if(a.test(new URL(e.request.url).pathname))return s(e);return null}({hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,hostedPaymentGatewaysUrl:o,paymentMethodSetsUrl:l,fraudProtectionsUrl:m,paymentGatewaysUrl:p,getPaymentMethodSetHostedPaymentGatewayUrl:f(s),getHostedPaymentGatewayUrl:f(o),getPaymentMethodSetUrl:f(l),getFraudProtectionUrl:f(m),getPaymentGatewayUrl:f(p),request:e.request,fetch:this.__fetch});c&&(e.preventDefault(),e.respondWith(c))}}static get properties(){return{paymentMethodSetHostedPaymentGatewaysUrl:{attribute:"payment-method-set-hosted-payment-gateways-url"},hostedPaymentGatewaysHelperUrl:{attribute:"hosted-payment-gateways-helper-url"},hostedPaymentGatewaysUrl:{attribute:"hosted-payment-gateways-url"},paymentGatewaysHelperUrl:{attribute:"payment-gateways-helper-url"},paymentMethodSetsUrl:{attribute:"payment-method-sets-url"},fraudProtectionsUrl:{attribute:"fraud-protections-url"},paymentGatewaysUrl:{attribute:"payment-gateways-url"}}}connectedCallback(){super.connectedCallback(),this.addEventListener("fetch",this.__handleFetch)}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("fetch",this.__handleFetch)}}customElements.define("foxy-payments-api",b);export{b as PaymentsApi};
|
|
1
|
+
import{L as e}from"./shared-7f33a83a.js";import{F as t}from"./shared-64657919.js";import{aJ as a,_ as s,am as n}from"./shared-98755831.js";import{A as r}from"./shared-509a2f52.js";async function o(e){const t=await e;if(!t.ok)throw new Error(await t.text());return t.json()}async function i(e){var t;let s,n;try{const{hostedPaymentGatewaysHelperUrl:r,paymentGatewaysHelperUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if("GET"!==d.method)throw s=405,new Error("Method not allowed. Allowed methods: GET.");const p=a(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}).exec(new URL(d.url).pathname).groups.presetId,y=o(m(r)),h=o(m(i)),f=null===(t=(await o(m(l(p))))._links["fx:payment_gateway"])||void 0===t?void 0:t.href,u=f?await o(m(f)):void 0,c=function(e){const{hostedPaymentGatewaysHelper:t,paymentGatewaysHelper:a,paymentPresetId:s,paymentGateway:n,base:r}=e,o=new URL(`./payment_presets/${s}/available_payment_methods`,r),i={};return Object.entries(t.values).forEach((([e,t])=>{i[e]=t})),Object.entries(a.values).forEach((([e,t])=>{i[e]=t,n&&(i[e].conflict={type:n.type,name:n.description})})),{_links:{self:{href:o.toString()}},values:i}}({hostedPaymentGatewaysHelper:await y,paymentGatewaysHelper:await h,paymentPresetId:p,paymentGateway:u,base:new URL(d.url).origin});n=JSON.stringify(c),s=200}catch(e){n=e instanceof Error?e.message:String(e),s=null!=s?s:500}return new Response(n,{status:s})}function l(e){const{paymentPresetId:t,base:a}=e;return{_links:{self:{href:new URL(`./payment_presets/${t}/available_fraud_protections`,a).toString()}},values:{minfraud:{name:"MaxMind minFraud",uses_rejection_threshold:!0,json:null},google_recaptcha:{name:"Google reCAPTCHA",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"config",name:"Configuration",type:"select",description:"Determines how reCAPTCHA is configured to operate.",default_value:"disabled",options:[{name:"Disabled",value:"disabled"},{name:"Always enabled",value:"enabled_always"},{name:"Enabled by errors",value:"enabled_by_errors"}]},{id:"private_key",name:"Private Key",type:"text",optional:!0,description:"If using a custom subdomain, enter your Private Key here.",default_value:""},{id:"site_key",name:"Site Key",type:"text",optional:!0,description:"If using a custom subdomain, enter your Site Key here.",default_value:""}]}]}},custom_precheckout_hook:{name:"Pre-Checkout Webhook",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"enabled",name:"Enabled",type:"checkbox",default_value:!1},{id:"url",name:"URL",type:"text",description:"Url of your Pre-Checkout Hook",default_value:""},{id:"failure_handling",name:"Failure handling",type:"select",description:"Determines what happens to the checkout if your webhook fails.",default_value:"",options:[{name:"Reject",value:"reject"},{name:"Approve",value:"approve"}]}]}]}}}}}async function d(e){let t,s;try{const{request:n}=e;if("GET"!==n.method)throw t=405,new Error("Method not allowed. Allowed methods: GET.");const r=l({paymentPresetId:a(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}).exec(new URL(n.url).pathname).groups.presetId,base:new URL(n.url).origin});s=JSON.stringify(r),t=200}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}const m=["_links"];function p(e){const{paymentMethodSetFraudProtectionId:t,paymentPresetId:a,fraudProtection:r,base:o}=e,{_links:i}=r,d=n(r,m),p=l({paymentPresetId:a,base:o}),y=`${new URL(i.self.href).pathname.split("/").pop()}C${t}`,h=new URL(`./payment_presets/${a}`,o),f=new URL(`./payment_presets/${a}/fraud_protections/${y}`,o);return s(s({_links:{self:{href:f.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:h.toString()}}},d),{},{helper:p.values[r.type]})}async function y(e){var t,s;let n,r;try{const{fraudProtectionsUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if(!["GET","POST"].includes(d.method))throw n=405,new Error("Method not allowed. Allowed methods: GET, POST.");const y=new URL(d.url),h=a(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}).exec(y.pathname).groups.presetId,f=await o(m(l(h)));if("GET"===d.method){const e=parseInt(null!==(t=y.searchParams.get("offset"))&&void 0!==t?t:"0"),a=parseInt(null!==(s=y.searchParams.get("limit"))&&void 0!==s?s:"20"),i=new URL(f._links["fx:payment_method_set_fraud_protections"].href);i.searchParams.set("offset",String(Math.max(0,e-1))),i.searchParams.set("limit",String(a));const l=await o(m(i.toString())),u=await Promise.all(l._embedded["fx:payment_method_set_fraud_protections"].map((async e=>o(m(e._links["fx:fraud_protection"].href))))),c=function(e){const{paymentMethodSetFraudProtections:t,fraudProtections:a,paymentPresetId:s,base:n}=e,r=new URL(`/payment_presets/${s}/fraud_protections`,n);r.search=new URL(t._links.self.href).search;const o=new URL(r.toString());o.search=new URL(t._links.first.href).search;const i=new URL(r.toString());i.search=new URL(t._links.last.href).search;const l=new URL(r.toString());l.search=new URL(t._links.prev.href).search;const d=new URL(r.toString());d.search=new URL(t._links.next.href).search;const m=a.map((e=>{const a=t._embedded["fx:payment_method_set_fraud_protections"].find((t=>t.fraud_protection_uri===e._links.self.href));return p({paymentMethodSetFraudProtectionId:new URL(a._links.self.href).pathname.split("/").pop(),fraudProtection:e,paymentPresetId:s,base:n})}));return{_links:{first:{href:o.toString()},last:{href:i.toString()},prev:{href:l.toString()},next:{href:d.toString()},self:{href:r.toString()}},_embedded:{"fx:fraud_protections":m},returned_items:t.returned_items,total_items:t.total_items,offset:t.offset,limit:t.limit}}({paymentMethodSetFraudProtections:l,fraudProtections:u,paymentPresetId:h,base:new URL(d.url).origin});n=200,r=JSON.stringify(c)}else{const e=await d.json();delete e.helper;const t=m(i,{method:"POST",body:JSON.stringify(e)}),a=await o(t),s=await o(m(f._links["fx:payment_method_set_fraud_protections"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:f._links.self.href,fraud_protection_uri:a._links.self.href})})),l=p({paymentMethodSetFraudProtectionId:new URL(s._links.self.href).pathname.split("/").pop(),fraudProtection:a,paymentPresetId:h,base:new URL(d.url).origin});n=200,r=JSON.stringify(l)}}catch(e){r=e instanceof Error?e.message:String(e),n=null!=n?n:500}return new Response(r,{status:n})}async function h(e){let t,s;try{const{getPaymentMethodSetUrl:n,getFraudProtectionUrl:r,request:i,fetch:l}=e;if(!["GET","PATCH","DELETE"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const d=a(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),{presetId:m,protectionId:y}=d.exec(i.url).groups,h=n(m),f=y.substring(0,y.indexOf("C"));if("DELETE"===i.method){const e=(await o(l(h)))._links["fx:payment_method_set_fraud_protections"].href,t=new URL(e);t.searchParams.set("fraud_protection_id",f);const a=await o(l(t.toString())),s=a._embedded["fx:payment_method_set_fraud_protections"].map((e=>o(l(e._links.self.href,{method:"DELETE"}))));await Promise.all(s)}let u=await i.text();try{const e=JSON.parse(u);delete e.helper,u=JSON.stringify(e)}catch(e){}const c=l(r(f),{method:i.method,body:"PATCH"===i.method?u:null}),w=await o(c);s="DELETE"===i.method?JSON.stringify({message:"Fraud protection was successfully deleted."}):JSON.stringify(p({paymentMethodSetFraudProtectionId:y.substring(y.indexOf("C")+1),fraudProtection:w,paymentPresetId:m,base:new URL(i.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}const f=["_links"];function u(e){const{paymentPresetId:t,helper:a,base:r}=e,o="paymentGateway"in e?e.paymentGateway:e.hostedPaymentGateway,{_links:i}=o,l=n(o,f),d=new URL(i.self.href).pathname.split("/").pop();let m;m="paymentMethodSetHostedPaymentGatewayId"in e?`H${d}C${e.paymentMethodSetHostedPaymentGatewayId}`:`R${d}`;const p=new URL(`./payment_presets/${t}`,r),y=new URL(`./payment_presets/${t}/payment_methods/${m}`,r);return s(s({_links:{self:{href:y.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:p.toString()}}},l),{},{helper:a})}async function c(e){var t,s,n,r;let i,l;try{const{hostedPaymentGatewaysHelperUrl:d,paymentGatewaysHelperUrl:m,hostedPaymentGatewaysUrl:p,getPaymentMethodSetUrl:y,paymentGatewaysUrl:h,request:f,fetch:c}=e;if(!["GET","POST"].includes(f.method))throw i=405,new Error("Method not allowed. Allowed methods: GET, POST.");const w=new URL(f.url),_=a(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}).exec(w.pathname).groups.presetId,[g,P,S]=await Promise.all([o(c(d)),o(c(m)),o(c(y(_)))]);if("GET"===f.method){const e=parseInt(null!==(t=w.searchParams.get("offset"))&&void 0!==t?t:"0"),a=parseInt(null!==(s=w.searchParams.get("limit"))&&void 0!==s?s:"20"),r=new URL(S._links["fx:payment_method_set_hosted_payment_gateways"].href);r.searchParams.set("offset",String(Math.max(0,e-1))),r.searchParams.set("limit",String(a));const d=null===(n=S._links["fx:payment_gateway"])||void 0===n?void 0:n.href,[m,p]=await Promise.all([d&&0===e?o(c(d)):null,o(c(r.toString()))]),y=await Promise.all(p._embedded["fx:payment_method_set_hosted_payment_gateways"].map((async e=>o(c(e._links["fx:hosted_payment_gateway"].href))))),h=function(e){var t,a;const{paymentMethodSetHostedPaymentGateways:s,hostedPaymentGatewaysHelper:n,hostedPaymentGateways:r,paymentGatewaysHelper:o,paymentPresetId:i,paymentGateway:l,query:d,base:m}=e,p=new URLSearchParams(d),y=parseInt(null!==(t=p.get("offset"))&&void 0!==t?t:"0"),h=parseInt(null!==(a=p.get("limit"))&&void 0!==a?a:"20"),f=s.total_items+(l?1:0),c=s.returned_items+(l&&"not-on-page"!==l?1:0),w=new URL(`/payment_presets/${i}/payment_methods`,m);w.search=d;const _=new URL(w.toString()),g=new URL(w.toString()),P=new URL(w.toString()),S=new URL(w.toString());_.searchParams.set("limit",String(h)),_.searchParams.set("offset",String(y)),g.searchParams.set("limit",String(h)),g.searchParams.set("offset",String(Math.max(0,f-h))),P.searchParams.set("limit",String(h)),P.searchParams.set("offset",String(Math.max(0,y-h))),S.searchParams.set("limit",String(h)),S.searchParams.set("offset",String(Math.min(y+h,Math.max(0,f-h))));const U=[...l&&"not-on-page"!==l?[l]:[],...r].map((e=>{const t=s._embedded["fx:payment_method_set_hosted_payment_gateways"].find((t=>t.hosted_payment_gateway_uri===e._links.self.href));return u(t?{paymentMethodSetHostedPaymentGatewayId:new URL(t._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:e,paymentPresetId:i,helper:n.values[e.type],base:m}:{paymentPresetId:i,paymentGateway:e,helper:o.values[e.type],base:m})}));return{_links:{first:{href:_.toString()},last:{href:g.toString()},prev:{href:P.toString()},next:{href:S.toString()},self:{href:w.toString()}},_embedded:{"fx:payment_methods":U},returned_items:c,total_items:f,offset:y,limit:h}}({paymentMethodSetHostedPaymentGateways:p,hostedPaymentGatewaysHelper:g,paymentGatewaysHelper:P,hostedPaymentGateways:y,paymentPresetId:_,paymentGateway:m||(d?"not-on-page":void 0),query:new URL(f.url).search,base:new URL(f.url).origin});i=200,l=JSON.stringify(h)}else{const e=await f.clone().json(),t=!!g.values[null!==(r=e.type)&&void 0!==r?r:""];if(delete e.helper,t){const t=await o(c(p,{method:"POST",body:JSON.stringify(e)})),a=await o(c(S._links["fx:payment_method_set_hosted_payment_gateways"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:S._links.self.href,hosted_payment_gateway_uri:t._links.self.href})})),s=u({paymentMethodSetHostedPaymentGatewayId:new URL(a._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:t,paymentPresetId:_,helper:g.values[t.type],base:new URL(f.url).origin});i=200,l=JSON.stringify(s)}else{const t=c(h,{method:f.method,body:JSON.stringify(e)}),a=await o(t),s={gateway_uri:a._links.self.href};await Promise.all([o(c(S._links.self.href,{method:"PATCH",body:JSON.stringify(s)})),S.gateway_uri?o(c(S.gateway_uri,{method:"DELETE"})):null]);const n=u({paymentPresetId:_,paymentGateway:a,helper:P.values[a.type],base:new URL(f.url).origin});i=200,l=JSON.stringify(n)}}}catch(e){l=e instanceof Error?e.message:String(e),i=null!=i?i:500}return new Response(l,{status:i})}const w=["_links"];function _(e){const{paymentMethodSet:t,base:a}=e,{_links:r}=t,o=n(t,w),i=new URL(t._links.self.href).pathname.split("/").pop(),l=new URL(`./payment_presets/${i}`,a),d=new URL(`./payment_presets/${i}/payment_methods`,a),m=new URL(`./payment_presets/${i}/fraud_protections`,a),p=new URL(`./payment_presets/${i}/available_payment_methods`,a),y=new URL(`./payment_presets/${i}/available_fraud_protections`,a);return s({_links:{self:{href:l.toString()},"fx:store":r["fx:store"],"fx:payment_methods":{href:d.toString()},"fx:fraud_protections":{href:m.toString()},"fx:available_payment_methods":{href:p.toString()},"fx:available_fraud_protections":{href:y.toString()}}},o)}const g=["_embedded","_links"];async function P(e){let t,a;try{const{paymentMethodSetsUrl:r,request:i,fetch:l}=e;if(!["GET","POST"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, POST.");const d=new URL(i.url),m=new URL(r);let p;if(m.search=d.search,"POST"===i.method){const e=l(m.toString(),{method:"POST",body:await i.text()});p=_({paymentMethodSet:await o(e),base:d.origin})}else p=function(e){const{paymentMethodSets:t,base:a}=e,{_embedded:r,_links:o}=t,i=n(t,g),l=new URL("./payment_presets",a),d=new URL(o.first.href);l.search=d.search;const m=new URL("./payment_presets",a),p=new URL(o.last.href);m.search=p.search;const y=new URL("./payment_presets",a),h=new URL(o.prev.href);y.search=h.search;const f=new URL("./payment_presets",a),u=new URL(o.next.href);f.search=u.search;const c=new URL("./payment_presets",a),w=new URL(o.self.href);return c.search=w.search,s(s({},i),{},{_links:{first:{href:l.toString()},last:{href:m.toString()},prev:{href:y.toString()},next:{href:f.toString()},self:{href:c.toString()}},_embedded:{"fx:payment_presets":r["fx:payment_method_sets"].map((e=>_({paymentMethodSet:e,base:a})))}})}({paymentMethodSets:await o(l(m.toString())),base:d.origin});a=JSON.stringify(p),t=200}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}async function S(e){let t,s;try{const{getPaymentMethodSetUrl:n,request:r,fetch:i}=e;if(!["GET","PATCH","DELETE"].includes(r.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const l=a(/payment_presets\/(.+)/,{presetId:1}).exec(r.url).groups.presetId,d=new URL(r.url),m=new URL(n(l));m.search=d.search;const p=await o(i(m.toString(),{method:r.method,body:"PATCH"===r.method?await r.text():null}));s="DELETE"===r.method?JSON.stringify({message:"Payment preset was successfully deleted."}):JSON.stringify(_({paymentMethodSet:p,base:new URL(r.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}async function U(e){let t,s;try{const{hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,getPaymentMethodSetHostedPaymentGatewayUrl:i,getHostedPaymentGatewayUrl:l,getPaymentMethodSetUrl:d,getPaymentGatewayUrl:m,request:p,fetch:y}=e;if(!["GET","PATCH","DELETE"].includes(p.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const h=a(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),{presetId:f,methodId:c}=h.exec(p.url).groups,w=c.startsWith("H"),_=d(f),g=c.substring(1,w?c.indexOf("C"):void 0),P=o(y(n)),S=o(y(r));if("DELETE"===p.method)if(w){const e=i(c.substring(c.indexOf("C")+1));await o(y(e,{method:"DELETE"}))}else{const e={gateway_uri:""},t=JSON.stringify(e);await o(y(_,{method:"PATCH",body:t}))}let U=await p.text();try{const e=JSON.parse(U);delete e.helper,U=JSON.stringify(e)}catch(e){}if(w){const e=y(l(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await P,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(u({paymentMethodSetHostedPaymentGatewayId:c.substring(c.indexOf("C")+1),hostedPaymentGateway:a,paymentPresetId:f,helper:t.values[a.type],base:new URL(p.url).origin}))}else{const e=y(m(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await S,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(u({paymentGateway:a,paymentPresetId:f,helper:t.values[a.type],base:new URL(p.url).origin}))}}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}class b extends e{constructor(){super(...arguments),this.paymentMethodSetHostedPaymentGatewayBaseUrl=null,this.paymentMethodSetHostedPaymentGatewaysUrl=null,this.hostedPaymentGatewaysHelperUrl=null,this.hostedPaymentGatewayBaseUrl=null,this.hostedPaymentGatewaysUrl=null,this.paymentGatewaysHelperUrl=null,this.paymentMethodSetBaseUrl=null,this.paymentMethodSetsUrl=null,this.fraudProtectionBaseUrl=null,this.fraudProtectionsUrl=null,this.paymentGatewayBaseUrl=null,this.paymentGatewaysUrl=null,this.__api=new r(this),this.__fetch=this.__api.fetch.bind(this.__api),this.__handleFetch=e=>{if(!(e instanceof t))return;if(!e.request.url.startsWith("https://foxy-payments-api.element/"))return;if(e.defaultPrevented)return;const{paymentMethodSetHostedPaymentGatewaysUrl:s,paymentMethodSetHostedPaymentGatewayBaseUrl:n=s,hostedPaymentGatewaysHelperUrl:r,paymentGatewaysHelperUrl:o,hostedPaymentGatewaysUrl:l,hostedPaymentGatewayBaseUrl:m=l,paymentMethodSetsUrl:p,paymentMethodSetBaseUrl:f=p,fraudProtectionsUrl:u,fraudProtectionBaseUrl:w=u,paymentGatewaysUrl:_,paymentGatewayBaseUrl:g=_}=this;if(null===s)return;if(null===n)return;if(null===r)return;if(null===o)return;if(null===l)return;if(null===m)return;if(null===p)return;if(null===f)return;if(null===u)return;if(null===w)return;if(null===_)return;if(null===g)return;const b=e=>t=>{const a=new URL(e);return a.pathname.endsWith("/")||(a.pathname+="/"),a.pathname+=t,a.toString()},G=function(e){const t=[[a(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),U],[a(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}),d],[a(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}),i],[a(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),h],[a(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}),y],[a(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}),c],[a(/\/payment_presets\/(.+)/,{presetId:1}),S],[/\/payment_presets/,P]];for(const[a,s]of t)if(a.test(new URL(e.request.url).pathname))return s(e);return null}({hostedPaymentGatewaysHelperUrl:r,paymentGatewaysHelperUrl:o,hostedPaymentGatewaysUrl:l,paymentMethodSetsUrl:p,fraudProtectionsUrl:u,paymentGatewaysUrl:_,getPaymentMethodSetHostedPaymentGatewayUrl:b(s),getHostedPaymentGatewayUrl:b(m),getPaymentMethodSetUrl:b(f),getFraudProtectionUrl:b(w),getPaymentGatewayUrl:b(g),request:e.request,fetch:this.__fetch});G&&(e.preventDefault(),e.respondWith(G))}}static get properties(){return{paymentMethodSetHostedPaymentGatewayBaseUrl:{attribute:"payment-method-set-hosted-payment-gateway-base-url"},paymentMethodSetHostedPaymentGatewaysUrl:{attribute:"payment-method-set-hosted-payment-gateways-url"},hostedPaymentGatewaysHelperUrl:{attribute:"hosted-payment-gateways-helper-url"},hostedPaymentGatewayBaseUrl:{attribute:"hosted-payment-gateway-base-url"},hostedPaymentGatewaysUrl:{attribute:"hosted-payment-gateways-url"},paymentGatewaysHelperUrl:{attribute:"payment-gateways-helper-url"},paymentMethodSetBaseUrl:{attribute:"payment-method-set-base-url"},paymentMethodSetsUrl:{attribute:"payment-method-sets-url"},fraudProtectionBaseUrl:{attribute:"fraud-protection-base-url"},fraudProtectionsUrl:{attribute:"fraud-protections-url"},paymentGatewayBaseUrl:{attribute:"payment-gateway-base-url"},paymentGatewaysUrl:{attribute:"payment-gateways-url"}}}connectedCallback(){super.connectedCallback(),this.addEventListener("fetch",this.__handleFetch)}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("fetch",this.__handleFetch)}}customElements.define("foxy-payments-api",b);export{b as PaymentsApi};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-ca58ef47.js";import"./shared-e28f16db.js";export{Q as QueryBuilder}from"./shared-29aa4bca.js";import"./shared-7a290f36.js";import"./shared-16b542bc.js";import"./shared-98755831.js";import"./shared-7f33a83a.js";import"./shared-e6f3e9f0.js";import"./shared-4e709717.js";import"./shared-d3bf9ac0.js";import"./shared-bc7f58ef.js";import"./shared-d519a301.js";import"./shared-a8cf402a.js";import"./shared-de790de9.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e}from"./shared-
|
|
1
|
+
import{C as e}from"./shared-068480a3.js";import{D as t,a as i}from"./shared-9048c076.js";import{C as a,b as s,a as n}from"./shared-0543c6e0.js";import{h as r,C as d,P as l}from"./shared-7a290f36.js";import{T as o,E as h,C as m}from"./shared-c40d85dc.js";import{T as _}from"./shared-b95ef318.js";import"./shared-4c9f96ec.js";import"./shared-d493355a.js";import"./shared-cb6f2388.js";import"./shared-6b53ef85.js";import"./shared-0dc1d012.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-86768244.js";import{_ as u}from"./shared-98755831.js";import"./shared-e28f16db.js";import"./shared-6f465111.js";import{h as c,f as p}from"./shared-7f33a83a.js";import{S as g,R as v,T as f,a as b}from"./shared-16b542bc.js";import{c as y}from"./shared-4e709717.js";import{C as k,a as T}from"./shared-ee13d1a6.js";import"./shared-9e60ef60.js";import"./shared-aeec3cab.js";import"./shared-f3f5e87e.js";import{G as x}from"./shared-08ff9a8d.js";import{P as $}from"./shared-7bf46d6d.js";import{C as D}from"./shared-de790de9.js";import{N as E}from"./shared-eb900735.js";import{i as w}from"./shared-d3bf9ac0.js";import{l as S}from"./shared-f3b35364.js";import"./shared-4db2c7b1.js";import"./shared-cd096e97.js";import"./shared-ca58ef47.js";import"./shared-a8cf402a.js";import"./shared-64657919.js";import"./shared-e5c19ea3.js";import"./shared-11c2efc8.js";import"./shared-a89cb472.js";import"./shared-509a2f52.js";import"./shared-d6276c83.js";
|
|
2
2
|
/**
|
|
3
3
|
@license
|
|
4
4
|
Copyright (c) 2017 Vaadin Ltd.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./foxy-spinner.js";import"./shared-
|
|
1
|
+
import"./foxy-spinner.js";import"./shared-86768244.js";import{T as n}from"./shared-6eb7dc77.js";import{a as e}from"./shared-16b542bc.js";import"./shared-e28f16db.js";import"./shared-7a290f36.js";import"./shared-ca58ef47.js";import"./shared-98755831.js";import"./shared-7f33a83a.js";import"./shared-a8cf402a.js";import"./shared-64657919.js";import"./shared-de790de9.js";import"./shared-d3bf9ac0.js";import"./foxy-nucleon-element.js";import"./shared-eb900735.js";import"./shared-509a2f52.js";import"./shared-d6276c83.js";import"./shared-a89cb472.js";import"./shared-4e709717.js";let a,s,o,r,t,l,i,d,m,f,y,h=n=>n;class p extends(e(n,"reports-table")){constructor(){super(...arguments),this.columns=[p.nameColumn,p.startColumn,p.endColumn,p.createdOnColumn,p.linkColumn]}}p.nameColumn={header:({html:n,lang:e,ns:s})=>n(a||(a=h`<foxy-i18n lang=${0} key="report_name" ns=${0}></foxy-i18n>`),e,s),cell:({html:n,data:e,lang:a,ns:o})=>{const r=`report_name_${e.name}`;return n(s||(s=h`<foxy-i18n class="font-medium" lang=${0} key=${0} ns=${0}></foxy-i18n>`),a,r,o)}},p.startColumn={hideBelow:"md",header:({html:n,lang:e,ns:a})=>n(o||(o=h`<foxy-i18n lang=${0} key="range_start" ns=${0}></foxy-i18n>`),e,a),cell:({html:n,data:e,lang:a,ns:s})=>n(r||(r=h`
|
|
2
2
|
<foxy-i18n
|
|
3
3
|
options=${0}
|
|
4
4
|
lang=${0}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-bd81cc08.js";import"./shared-e28f16db.js";import"./foxy-item-form.js";import"./foxy-item-card.js";import"./shared-86768244.js";import"./shared-939fc890.js";import"./shared-49d978e1.js";import{_ as s,B as r}from"./shared-98755831.js";import{h as e}from"./shared-7f33a83a.js";import{i as t}from"./shared-d3bf9ac0.js";import{a as i}from"./shared-16b542bc.js";import{I as o}from"./shared-3a252ccd.js";import{C as a}from"./shared-de790de9.js";import"./shared-7a290f36.js";import"./shared-b88e35b7.js";import"./shared-aeec3cab.js";import"./shared-4c9f96ec.js";import"./shared-c40d85dc.js";import"./shared-b95ef318.js";import"./shared-f3f5e87e.js";import"./shared-0c02b4ee.js";import"./shared-5dd31b4e.js";import"./shared-0479553e.js";import"./shared-a8cf402a.js";import"./shared-eb900735.js";import"./shared-509a2f52.js";import"./shared-64657919.js";import"./shared-d6276c83.js";import"./shared-a89cb472.js";import"./shared-61a510d8.js";import"./shared-1e5292a1.js";import"./shared-6fb923d5.js";import"./shared-cb6f2388.js";import"./shared-0dc1d012.js";import"./shared-9e60ef60.js";import"./shared-4e709717.js";import"./foxy-spinner.js";import"./shared-ca58ef47.js";import"./foxy-discount-detail-card.js";import"./shared-c3c67413.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-nucleon-element.js";import"./foxy-item-option-form.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./shared-e5c19ea3.js";import"./shared-6f465111.js";import"./shared-ee13d1a6.js";import"./shared-068480a3.js";import"./shared-0543c6e0.js";import"./shared-4db2c7b1.js";import"./shared-11c2efc8.js";import"./shared-6b53ef85.js";import"./shared-cd096e97.js";import"./shared-08ff9a8d.js";import"./shared-7bf46d6d.js";import"./foxy-coupon-card.js";import"./shared-23923638.js";import"./foxy-discount-builder.js";import"./shared-d519a301.js";import"./shared-e6f3e9f0.js";import"./shared-fbfb0943.js";import"./shared-9048c076.js";import"./shared-bc7f58ef.js";import"./shared-380db651.js";import"./foxy-subscription-card.js";import"./shared-bb009254.js";import"./foxy-subscription-form.js";import"./shared-03b39ec4.js";import"./foxy-collection-page.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./foxy-cancellation-form.js";import"./foxy-transaction-card.js";import"./foxy-customer-card.js";import"./shared-daf52401.js";import"./shared-b5517c1b.js";let d,c,m=s=>s;const p=a(i(o,"shipment-card"));class n extends p{constructor(){super(...arguments),this.__customerAddresses="",this.__currencyDisplay="",this.__itemCategories="",this.__editable=!1,this.__currency="",this.__coupons=""}static get properties(){return s(s({},super.properties),{},{__customerAddresses:{attribute:!1},__currencyDisplay:{attribute:!1},__itemCategories:{attribute:!1},__editable:{attribute:!1},__currency:{attribute:!1},__coupons:{attribute:!1}})}get readonlySelector(){return this.__editable?super.readonlySelector:r.True}renderBody(){var s,r,i;let o;if(this.data)try{const s=new URL(this.data._links["fx:items"].href);s.searchParams.set("zoom","item_options"),o=s.toString()}catch(s){}const{address_name:a,address1:p,address2:n,city:f,region:h,postal_code:l}=null!==(s=this.data)&&void 0!==s?s:{},j={address_name:a,address1:p,address2:n,city:f,region:h,postal_code:l},_={amount:`${null===(r=this.data)||void 0===r?void 0:r.total_shipping} ${this.__currency}`,currencyDisplay:this.__currencyDisplay};return e(c||(c=m` <div class="space-y-m"> <div> <div class="flex items-center text-m space-x-s text-secondary"> <iron-icon icon="maps:place" class="icon-inline flex-shrink-0"></iron-icon> <span class="truncate"> <foxy-i18n infer="address" key="full_address" .options="${0}"></foxy-i18n> </span> </div> <div class="flex items-center text-m space-x-s text-secondary"> <iron-icon icon="maps:local-shipping" class="icon-inline flex-shrink-0"></iron-icon> <span class="truncate"> ${0} • <foxy-i18n key="price" infer="address" .options="${0}"></foxy-i18n> </span> </div> </div> <foxy-internal-async-details-control infer="items" first="${0}" limit="5" item="foxy-item-card" open .form="${0}"> </foxy-internal-async-details-control> </div> `),j,null===(i=this.data)||void 0===i?void 0:i.shipping_service_description,_,t(o),(({html:s,dialog:r,handleFetch:e,handleUpdate:t})=>s(d||(d=m`
|
|
2
2
|
<foxy-item-form
|
|
3
3
|
customer-addresses=${0}
|
|
4
4
|
item-categories=${0}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-49d978e1.js";import"./foxy-nucleon-element.js";import"./shared-86768244.js";import{_ as e}from"./shared-98755831.js";import{a as t}from"./shared-16b542bc.js";import{I as s}from"./shared-3a252ccd.js";import{i as r}from"./shared-d3bf9ac0.js";import{h as i}from"./shared-7f33a83a.js";import"./foxy-spinner.js";import"./shared-e28f16db.js";import"./shared-7a290f36.js";import"./shared-ca58ef47.js";import"./shared-a8cf402a.js";import"./shared-64657919.js";import"./shared-eb900735.js";import"./shared-509a2f52.js";import"./shared-d6276c83.js";import"./shared-a89cb472.js";import"./shared-4e709717.js";let h,a,o=e=>e;const d=t(s,"shipping-method-card");class p extends d{constructor(){super(...arguments),this.storeShippingMethods=null,this.getImageSrc=null,this.__storeShippingMethodsLoaderId="storeShippingMethods"}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' fill='none' viewBox='0 0 40 40'%3E%3Cg clip-path='url(%23a)'%3E%3Cpath fill='%23E8E8E8' d='M0 0h40v40H0z'/%3E%3Cpath fill='%23fff' d='M0 14.81V7.88L7.88 0h6.93L0 14.81ZM0 0h6.47L0 6.47V0Zm16.22 0L0 16.22v6.93l9-9V14c0-.55.2-1.02.59-1.41.39-.4.86-.59 1.41-.59h.15l12-12h-6.93ZM9 15.57l-9 9v6.93l9-9v-6.93Zm.15 8.19L0 32.91v6.93l12.33-12.33a3.28 3.28 0 0 1-.46-.39A2.9 2.9 0 0 1 11 25c-.55 0-1.02-.2-1.41-.59a2 2 0 0 1-.44-.65Zm4.17 4.17L1.26 40h6.92L23 25.18V25h-6c0 .83-.3 1.54-.88 2.13A2.9 2.9 0 0 1 14 28a3.2 3.2 0 0 1-.68-.07Zm11.85-3.5.26-.26A.98.98 0 0 1 26 24c.28 0 .52.1.71.29.2.19.29.43.29.71 0 .28-.1.52-.29.71A.94.94 0 0 1 26 26a.97.97 0 0 1-.71-.29A.97.97 0 0 1 25 25a1 1 0 0 1 .17-.57Z'/%3E%3Cpath fill='%23fff' d='M23.29 26.31 9.59 40h6.94L40 16.53V9.6l-9.6 9.6.4.53c.07.08.12.17.15.27s.05.2.05.32V24c0 .28-.1.52-.29.71A.94.94 0 0 1 30 25h-1c0 .83-.3 1.54-.88 2.13A2.9 2.9 0 0 1 26 28a3 3 0 0 1-2.71-1.69Zm6.51-7.92L40 8.19V1.25L25.26 16h2.24a1 1 0 0 1 .45.1 1 1 0 0 1 .35.3l1.5 1.99ZM25 14.84 39.84 0h-6.93l-12 12H23c.55 0 1.02.2 1.41.59.4.39.59.86.59 1.41v.84ZM19.5 12l12-12h-6.93l-12 12h6.93Zm-1.56 28L40 17.94v6.93L24.87 40h-6.93ZM40 26.29 26.29 40h6.93L40 33.22v-6.93ZM34.63 40 40 34.63V40h-5.37ZM13 25c0 .28.1.52.29.71.19.2.43.29.71.29.28 0 .52-.1.71-.29.2-.19.29-.43.29-.71 0-.28-.1-.52-.29-.71A.97.97 0 0 0 14 24c-.07 0-.14 0-.2.02a.95.95 0 0 0-.51.27.95.95 0 0 0-.29.71Z'/%3E%3Cpath fill='%23fff' d='M25 18v3h4.21l-.85-1.18-.68-.91L27 18h-2Z'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='a'%3E%3Cpath fill='%23fff' d='M0 0h40v40H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E"}static get properties(){return e(e({},super.properties),{},{storeShippingMethods:{attribute:"store-shipping-methods"},getImageSrc:{attribute:!1}})}renderBody(){var e,t,s;const d=p.defaultImageSrc,n=1===(null===(e=this.__storeShippingMethodsItems)||void 0===e?void 0:e.length),l=this.data;return i(h||(h=o` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <figure class="flex items-center gap-m h-m"> <img class="relative h-s w-s object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="${0}" @error="${0}"> <figcaption class="min-w-0 flex-1 flex justify-between gap-s"> <span class="font-medium truncate flex-shrink-0">${0}​</span> ${0} </figcaption> </figure> `),r(this.__storeShippingMethodsHref),this.__storeShippingMethodsLoaderId,(()=>this.requestUpdate()),null!==(s=l?null===(t=this.getImageSrc)||void 0===t?void 0:t.call(this,l.code):null)&&void 0!==s?s:d,this.t("image_alt"),(e=>e.currentTarget.src=d),null==l?void 0:l.name,n?i(a||(a=o` <foxy-i18n infer="" class="truncate text-tertiary" key="status_active"></foxy-i18n> `)):"")}get isBodyReady(){return!!super.isBodyReady&&(!this.storeShippingMethods||!!this.__storeShippingMethodsItems)}get __storeShippingMethodsHref(){try{const e=new URL(this.storeShippingMethods);return e.searchParams.set("shipping_method_id",this.href.split("/").pop()),e.searchParams.set("limit","1"),e.toString()}catch(e){}}get __storeShippingMethodsLoader(){return this.renderRoot.querySelector(`#${this.__storeShippingMethodsLoaderId}`)}get __storeShippingMethodsItems(){var e,t;return null===(t=null===(e=this.__storeShippingMethodsLoader)||void 0===e?void 0:e.data)||void 0===t?void 0:t._embedded["fx:store_shipping_methods"]}}customElements.define("foxy-shipping-method-card",p);export{p as ShippingMethodCard};
|