@foxy.io/elements 1.35.0 → 1.36.0-beta.2
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-admin-subscription-form.js +1 -1
- package/dist/cdn/foxy-api-browser.js +1 -1
- 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-billing-address-card.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-client-card.js +1 -1
- package/dist/cdn/foxy-client-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-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-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-experimental-add-to-cart-builder.js +1 -1
- package/dist/cdn/foxy-filter-attribute-card.js +1 -1
- package/dist/cdn/foxy-filter-attribute-form.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-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 +1 -1
- 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-native-integration-card.js +1 -1
- package/dist/cdn/foxy-native-integration-form.js +1 -1
- package/dist/cdn/foxy-nucleon-element.js +1 -1
- package/dist/cdn/foxy-pagination.js +1 -1
- package/dist/cdn/foxy-passkey-card.js +1 -1
- package/dist/cdn/foxy-passkey-form.js +1 -1
- package/dist/cdn/foxy-payment-card-embed.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 +15 -15
- package/dist/cdn/foxy-reports-table.js +1 -1
- package/dist/cdn/foxy-shipment-card.js +1 -1
- package/dist/cdn/foxy-shipping-container-card.js +1 -1
- package/dist/cdn/foxy-shipping-drop-type-card.js +1 -1
- package/dist/cdn/foxy-shipping-method-card.js +1 -1
- package/dist/cdn/foxy-shipping-service-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 +1 -1
- 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-update-payment-method-form.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-user-invitation-card.js +1 -1
- package/dist/cdn/foxy-user-invitation-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-4bcb2368.js → shared-0053cf93.js} +1 -1
- package/dist/cdn/{shared-3149ab8d.js → shared-01bb183b.js} +1 -1
- package/dist/cdn/{shared-a4d773a3.js → shared-03355bd1.js} +1 -1
- package/dist/cdn/{shared-6cb26d12.js → shared-0b00883f.js} +1 -1
- package/dist/cdn/{shared-6b06d5c1.js → shared-0b1b1c14.js} +1 -1
- package/dist/cdn/{shared-d9f38239.js → shared-0d8e7067.js} +1 -1
- package/dist/cdn/{shared-2256b8b1.js → shared-10b54c49.js} +1 -1
- package/dist/cdn/{shared-84ada96e.js → shared-133fc37b.js} +1 -1
- package/dist/cdn/{shared-0e59bad9.js → shared-1482d5dd.js} +1 -1
- package/dist/cdn/{shared-db92bb31.js → shared-1a49f70b.js} +1 -1
- package/dist/cdn/shared-1c07cd7f.js +1 -0
- package/dist/cdn/{shared-602ed877.js → shared-22dd6cbe.js} +1 -1
- package/dist/cdn/{shared-7439665e.js → shared-2503aefc.js} +1 -1
- package/dist/cdn/{shared-bf7baab5.js → shared-25893d83.js} +1 -1
- package/dist/cdn/{shared-56271b15.js → shared-2879b67f.js} +1 -1
- package/dist/cdn/{shared-2b25aedd.js → shared-2d11750b.js} +1 -1
- package/dist/cdn/{shared-f0a38941.js → shared-2e8361e1.js} +1 -1
- package/dist/cdn/{shared-831f5042.js → shared-3aaf64e6.js} +1 -1
- package/dist/cdn/{shared-059d1e79.js → shared-40e4854e.js} +1 -1
- package/dist/cdn/{shared-303cf36c.js → shared-42bb9e8e.js} +1 -1
- package/dist/cdn/{shared-a81a1cc3.js → shared-43e551f2.js} +1 -1
- package/dist/cdn/{shared-19ebb715.js → shared-4666b6aa.js} +5 -5
- package/dist/cdn/{shared-2868b35f.js → shared-48970bb4.js} +1 -1
- package/dist/cdn/{shared-e14930ce.js → shared-4c90701b.js} +1 -1
- package/dist/cdn/{shared-35a2aabc.js → shared-4cf87721.js} +1 -1
- package/dist/cdn/{shared-2565fed8.js → shared-4e8a5b95.js} +1 -1
- package/dist/cdn/{shared-afa402dc.js → shared-528b3bdb.js} +1 -1
- package/dist/cdn/{shared-481eb635.js → shared-5f1a4329.js} +1 -1
- package/dist/cdn/{shared-8d92dd6e.js → shared-5f43aa36.js} +1 -1
- package/dist/cdn/{shared-37dc0b85.js → shared-60150977.js} +1 -1
- package/dist/cdn/{shared-acdf3166.js → shared-61ef8001.js} +1 -1
- package/dist/cdn/{shared-9c82e27f.js → shared-6a45a781.js} +2 -2
- package/dist/cdn/{shared-0e1d094b.js → shared-6b76afc2.js} +1 -1
- package/dist/cdn/{shared-927f1a51.js → shared-6d11190a.js} +1 -1
- package/dist/cdn/{shared-61e50856.js → shared-76dcc864.js} +1 -1
- package/dist/cdn/{shared-40bed8c1.js → shared-7cb8722a.js} +1 -1
- package/dist/cdn/{shared-544b7d4b.js → shared-7ce74b42.js} +1 -1
- package/dist/cdn/shared-7e9fdf64.js +1 -0
- package/dist/cdn/{shared-2ca4d459.js → shared-8521017c.js} +1 -1
- package/dist/cdn/{shared-2eebd7bc.js → shared-85475a4e.js} +1 -1
- package/dist/cdn/{shared-c5972323.js → shared-8676e5c0.js} +1 -1
- package/dist/cdn/{shared-4fdc63d9.js → shared-86aa139c.js} +1 -1
- package/dist/cdn/{shared-59d9d6ca.js → shared-89d09114.js} +1 -1
- package/dist/cdn/{shared-21254863.js → shared-901b41cf.js} +1 -1
- package/dist/cdn/{shared-50f2497c.js → shared-9092b247.js} +1 -1
- package/dist/cdn/{shared-5741ba29.js → shared-93774efe.js} +1 -1
- package/dist/cdn/shared-9d7ae4aa.js +1 -0
- package/dist/cdn/{shared-3023dfb2.js → shared-b927be75.js} +3 -3
- package/dist/cdn/{shared-247297ce.js → shared-c1ade7a9.js} +1 -1
- package/dist/cdn/{shared-120413cd.js → shared-c52295d5.js} +1 -1
- package/dist/cdn/{shared-7f68743e.js → shared-c5cf889e.js} +1 -1
- package/dist/cdn/{shared-2676836d.js → shared-cbd1fab7.js} +1 -1
- package/dist/cdn/{shared-751c9f1e.js → shared-cc76a917.js} +1 -1
- package/dist/cdn/{shared-ebd077b5.js → shared-cd652fd0.js} +1 -1
- package/dist/cdn/{shared-a5bd0da6.js → shared-cf28d2c8.js} +1 -1
- package/dist/cdn/{shared-33ed0fe7.js → shared-d1dfac4d.js} +1 -1
- package/dist/cdn/{shared-900fd54f.js → shared-d2340faa.js} +1 -1
- package/dist/cdn/{shared-37c52c4c.js → shared-d279baa5.js} +1 -1
- package/dist/cdn/{shared-64d48bc6.js → shared-d784b79a.js} +1 -1
- package/dist/cdn/{shared-349a42e1.js → shared-e0d1856d.js} +1 -1
- package/dist/cdn/{shared-6fa216e7.js → shared-e622d8cf.js} +1 -1
- package/dist/cdn/{shared-939f50c2.js → shared-f20eefdd.js} +1 -1
- package/dist/cdn/{shared-d4e7383e.js → shared-f316780a.js} +1 -1
- package/dist/cdn/{shared-aa54bc96.js → shared-f72d82a9.js} +1 -1
- package/dist/cdn/{shared-cdb5ad48.js → shared-f92b9842.js} +1 -1
- package/dist/cdn/{shared-639dbd3f.js → shared-fea2714e.js} +1 -1
- package/dist/cdn/translations/native-integration-form/en.json +344 -214
- package/dist/cdn/translations/payments-api-payment-method-form/en.json +6 -0
- package/dist/cdn/translations/payments-api-payment-preset-form/en.json +6 -0
- package/dist/cdn/translations/tax-card/en.json +6 -4
- package/dist/cdn/translations/tax-form/en.json +161 -32
- package/dist/elements/internal/InternalForm/InternalForm.js +2 -2
- package/dist/elements/internal/InternalForm/InternalForm.js.map +1 -1
- package/dist/elements/public/NativeIntegrationForm/NativeIntegrationForm.d.ts +4 -5
- package/dist/elements/public/NativeIntegrationForm/NativeIntegrationForm.js +415 -292
- package/dist/elements/public/NativeIntegrationForm/NativeIntegrationForm.js.map +1 -1
- package/dist/elements/public/NativeIntegrationForm/defaults.d.ts +9 -68
- package/dist/elements/public/NativeIntegrationForm/defaults.js +18 -18
- package/dist/elements/public/NativeIntegrationForm/defaults.js.map +1 -1
- package/dist/elements/public/NativeIntegrationForm/index.d.ts +4 -3
- package/dist/elements/public/NativeIntegrationForm/index.js +4 -3
- package/dist/elements/public/NativeIntegrationForm/index.js.map +1 -1
- package/dist/elements/public/NucleonElement/API.js +8 -2
- package/dist/elements/public/NucleonElement/API.js.map +1 -1
- package/dist/elements/public/PaymentsApiPaymentMethodForm/PaymentsApiPaymentMethodForm.js +11 -6
- package/dist/elements/public/PaymentsApiPaymentMethodForm/PaymentsApiPaymentMethodForm.js.map +1 -1
- package/dist/elements/public/PaymentsApiPaymentMethodForm/index.d.ts +1 -0
- package/dist/elements/public/PaymentsApiPaymentMethodForm/index.js +1 -0
- package/dist/elements/public/PaymentsApiPaymentMethodForm/index.js.map +1 -1
- package/dist/elements/public/TaxCard/TaxCard.js +4 -0
- package/dist/elements/public/TaxCard/TaxCard.js.map +1 -1
- package/dist/elements/public/TaxForm/TaxForm.d.ts +31 -51
- package/dist/elements/public/TaxForm/TaxForm.js +260 -634
- package/dist/elements/public/TaxForm/TaxForm.js.map +1 -1
- package/dist/elements/public/TaxForm/index.d.ts +9 -9
- package/dist/elements/public/TaxForm/index.js +9 -9
- package/dist/elements/public/TaxForm/index.js.map +1 -1
- package/dist/mixins/themeable.js +4 -0
- package/dist/mixins/themeable.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-139024d1.js +0 -1
- package/dist/cdn/shared-3b1fc10b.js +0 -1
- package/dist/cdn/shared-433b15f9.js +0 -1
- package/dist/cdn/shared-67898669.js +0 -1
- package/dist/cdn/shared-d9393c31.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-5212ef4f.js";import"./foxy-spinner.js";import"./shared-
|
|
1
|
+
import"./shared-5212ef4f.js";import"./foxy-spinner.js";import"./shared-4e8a5b95.js";import{_ as r}from"./shared-d1195c27.js";import{a as e}from"./shared-f72d82a9.js";import{T as s}from"./shared-25893d83.js";import{h as t}from"./shared-ba5c42c7.js";import"./shared-01bb183b.js";import"./shared-c52295d5.js";import"./shared-5f43aa36.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-eeb2bd18.js";import"./shared-53e42a77.js";import"./shared-93774efe.js";import"./shared-d1dfac4d.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-4e709717.js";let a,i,d,o=r=>r;const m=e(s,"payments-api-fraud-protection-card");class p 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=o`${0}`),r.helper.name),subtitle:r=>t(i||(i=o`${0}`),r.description)});if(!this.in({idle:"snapshot"}))return s;const m=p.defaultImageSrc,l=this.data;return t(d||(d=o` <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=l?null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,l.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",p);export{p as PaymentsApiFraudProtectionCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-0b1b1c14.js";import"./shared-42bb9e8e.js";import"./shared-8521017c.js";import"./shared-528b3bdb.js";import"./shared-cf28d2c8.js";import"./shared-133fc37b.js";import{I as e}from"./shared-d784b79a.js";import"./foxy-nucleon-element.js";import"./shared-4e8a5b95.js";import{_ as t,B as r,aM as o,l as a}from"./shared-d1195c27.js";import{a as i}from"./shared-f72d82a9.js";import{i as s}from"./shared-53e42a77.js";import{c as n}from"./shared-4e709717.js";import{h as l}from"./shared-ba5c42c7.js";import{s as d}from"./shared-1aff7995.js";import{h as c}from"./shared-56ba2d28.js";import"./shared-1482d5dd.js";import"./shared-c52295d5.js";import"./shared-c1ade7a9.js";import"./shared-2503aefc.js";import"./shared-01bb183b.js";import"./shared-89d09114.js";import"./shared-d279baa5.js";import"./shared-fea2714e.js";import"./shared-cd652fd0.js";import"./shared-2e8361e1.js";import"./shared-6b76afc2.js";import"./shared-10b54c49.js";import"./shared-2879b67f.js";import"./shared-d2340faa.js";import"./shared-6a45a781.js";import"./shared-6d11190a.js";import"./shared-651c44fa.js";import"./shared-3aaf64e6.js";import"./shared-76dcc864.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./shared-eeb2bd18.js";import"./shared-17a61265.js";import"./shared-d1dfac4d.js";import"./shared-7e9fdf64.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-fcdb896f.js";import"./shared-4c90701b.js";import"./shared-1a49f70b.js";import"./foxy-copy-to-clipboard.js";import"./shared-5f43aa36.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";let f,p,h,u,m,v,b,y,j,_,g,$,x,L,w,F,P=e=>e;const S=i(e,"payments-api-fraud-protection-form");class I extends S{constructor(){super(...arguments),this.getImageSrc=null,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,a;const i=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!==(a=e.json)&&void 0!==a?a:"{}")}catch(e){s={}}for(const e of i)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(!c(s,r)&&"checkbox"!==t.type)return"json:v8n_invalid"}return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}get headerTitleOptions(){var e;return t(t({},this.data),{},{context:null!==(e=this.form.type)&&void 0!==e?e:"new"})}get headerSubtitleOptions(){return{id:this.headerCopyIdValue}}renderHeader(...e){var t;return l(f||(f=P` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?l(p||(p=P``)):l(h||(h=P` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}renderBody(){const e=l(u||(u=P` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),s(this.__availableFraudProtectionsHref),this.__availableFraudProtectionsLoaderId,(()=>this.requestUpdate()));return l(m||(m=P`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderFraudProtectionConfig():this.__renderFraudProtectionSelector(),e)}get __availableFraudProtectionsLoader(){return this.renderRoot.querySelector(`#${this.__availableFraudProtectionsLoaderId}`)}get __availableFraudProtectionsHref(){try{const e=o(/\/payment_presets\/(.+)\//,{presetId:1}),t=new URL(this.href||this.parent).pathname,r=e.exec(t).groups.presetId;return new URL(`/payment_presets/${r}/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=this.__availableFraudProtectionsLoader;return l(v||(v=P` ${0} `),(null==t?void 0:t.data)?l(b||(b=P` <div class="grid grid-cols-2 gap-m" data-testid="select-protection-list"> ${0} </div> `),Object.entries(null!==(e=this.__availableFraudProtections)&&void 0!==e?e:{}).map((([e,t])=>this.__renderFraudProtectionButton({type:e,helper:t})))):l(y||(y=P` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==t?void 0:t.in("fail"))?"error":"busy"))}__renderFraudProtectionButton({type:e,helper:t}){var r,o;const a=I.defaultImageSrc,i=null!==(o=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==o?o:a,d=e=>e.currentTarget.src=a;return l(j||(j=P` <button class="${0}" ?disabled="${0}" title="${0}" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" ?hidden="${0}" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}​</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),n({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,s(t.conflict?this.t("conflict_message"):void 0),(()=>this.edit({type:e,helper:t})),i,!!t.conflict,d,n({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),i,d,n({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderFraudProtectionConfig(){var e,t,r;return l(_||(_=P` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="setup"> ${0} ${0} </foxy-internal-summary-control> ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.uses_rejection_threshold)?l(g||(g=P` <foxy-internal-number-control layout="summary-item" infer="score-threshold-reject"> </foxy-internal-number-control> `)):"",null===(r=null===(t=this.form.helper)||void 0===t?void 0:t.json)||void 0===r?void 0:r.blocks.map((e=>this.__renderBlock(e))),super.renderBody())}__renderBlock(e){return l($||($=P`${0}`),e.fields.map((t=>{var r,o,i;const s=()=>{var r,o;let i;try{i=JSON.parse(null!==(r=this.form.json)&&void 0!==r?r:"")}catch(e){i={}}const s=[e.parent_id,e.id,t.id].filter((e=>!!e));return null!==(o=a(i,s))&&void 0!==o?o:i.default_value},n=r=>{var o;let a;try{a=JSON.parse(null!==(o=this.form.json)&&void 0!==o?o:"")}catch(e){a={}}const i=[e.parent_id,e.id,t.id].filter((e=>!!e));this.edit({json:JSON.stringify(d(a,i,r))})},c=t.options,f=["json",...[e.parent_id,e.id,t.id].filter((e=>!!e))].join("-").replace(/_/g,"-");return l(x||(x=P` ${0} `),"checkbox"===t.type?l(L||(L=P` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(r=t.description)&&void 0!==r?r:"",t.name,f,s,n):"select"===t.type?l(w||(w=P` <foxy-internal-select-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),null!==(o=t.description)&&void 0!==o?o:"",this.t("default_additional_field_placeholder"),t.name,f,c.map((({name:e,value:t})=>({label:e,value:t}))),s,n):l(F||(F=P` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(i=t.description)&&void 0!==i?i:"",t.default_value||this.t("default_additional_field_placeholder"),t.name,f,s,n))})))}}customElements.define("foxy-payments-api-fraud-protection-form",I);export{I as PaymentsApiFraudProtectionForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-5212ef4f.js";import"./foxy-spinner.js";import"./shared-
|
|
1
|
+
import"./shared-5212ef4f.js";import"./foxy-spinner.js";import"./shared-4e8a5b95.js";import{_ as e}from"./shared-d1195c27.js";import{a as r}from"./shared-f72d82a9.js";import{T as s}from"./shared-25893d83.js";import{h as t}from"./shared-ba5c42c7.js";import"./shared-01bb183b.js";import"./shared-c52295d5.js";import"./shared-5f43aa36.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-eeb2bd18.js";import"./shared-53e42a77.js";import"./shared-93774efe.js";import"./shared-d1dfac4d.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-4e709717.js";let a,i,d,o=e=>e;const m=r(s,"payments-api-payment-method-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='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=o`${0}`),e.helper.name),subtitle:e=>t(i||(i=o`${0}`),e.description)});if(!this.in({idle:"snapshot"}))return s;const m=l.defaultImageSrc,p=this.data;return t(d||(d=o` <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:m,this.t("image_alt"),(e=>e.currentTarget.src=m),s)}}customElements.define("foxy-payments-api-payment-method-card",l);export{l as PaymentsApiPaymentMethodCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-6b06d5c1.js";import"./shared-303cf36c.js";import"./shared-2ca4d459.js";import"./shared-a5bd0da6.js";import"./shared-84ada96e.js";import{I as e}from"./shared-64d48bc6.js";import"./foxy-nucleon-element.js";import"./foxy-spinner.js";import"./shared-2565fed8.js";import{_ as t,B as r,l as i}from"./shared-d1195c27.js";import{g as o}from"./shared-bab2ea2c.js";import{a}from"./shared-aa54bc96.js";import{i as s}from"./shared-53e42a77.js";import{h as l,s as n}from"./shared-ba5c42c7.js";import{c as d}from"./shared-4e709717.js";import{h as c}from"./shared-56ba2d28.js";import{s as h}from"./shared-1aff7995.js";import"./shared-0e59bad9.js";import"./shared-120413cd.js";import"./shared-247297ce.js";import"./shared-7439665e.js";import"./shared-3149ab8d.js";import"./shared-59d9d6ca.js";import"./shared-2256b8b1.js";import"./shared-56271b15.js";import"./shared-900fd54f.js";import"./shared-9c82e27f.js";import"./shared-927f1a51.js";import"./shared-639dbd3f.js";import"./shared-651c44fa.js";import"./shared-ebd077b5.js";import"./shared-f0a38941.js";import"./shared-0e1d094b.js";import"./shared-831f5042.js";import"./shared-61e50856.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./shared-eeb2bd18.js";import"./shared-17a61265.js";import"./shared-33ed0fe7.js";import"./shared-67898669.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-fcdb896f.js";import"./shared-e14930ce.js";import"./shared-db92bb31.js";import"./foxy-copy-to-clipboard.js";import"./shared-8d92dd6e.js";let u,m,p,f,_,v,y,g,x,$,b,j,L,S,k,w,P,V,M,I,B,C,q,Z,H,D,O,R=e=>e;const T=a(e,"payments-api-payment-method-form");class W extends T{constructor(){super(...arguments),this.paymentPreset=null,this.getImageSrc=null,this.store=null,this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__paymentPresetLoaderId="paymentPresetLoader",this.__storeLoaderId="storeLoader",this.__threeDSecureResponseGetValue=()=>{var e;return null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response")},this.__threeDSecureResponseSetValue=e=>{const t=e?"_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.__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"}]}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),{},{paymentPreset:{attribute:"payment-preset"},getImageSrc:{attribute:!1},store:{}})}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 s;try{s=JSON.parse(null!==(o=e.additional_fields)&&void 0!==o?o:"{}")}catch(e){s={}}for(const e of a)for(const t of e.fields)if("optional"in t&&!t.optional&&!c(s,t.id)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid";return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}renderHeader(...e){var t;return l(u||(u=R` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?l(m||(m=R``)):l(p||(p=R` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}get headerTitleOptions(){var e;return{context:this.form.type?"selected":"new",name:null===(e=this.form.helper)||void 0===e?void 0:e.name}}get headerSubtitleOptions(){if(this.href){const e=o(this.href),t=this.headerCopyIdValue;return e.startsWith("R")?{context:"regular",id:t}:{context:"hosted",id:t}}return{}}get headerCopyIdValue(){if(this.href){const e=o(this.href);return e.startsWith("R")?e.slice(1):e.slice(1).split("C")[0]}return""}renderBody(){var e;const t=null===(e=this.__paymentPresetLoader)||void 0===e?void 0:e.data,r=l(f||(f=R` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),s(null==t?void 0:t._links["fx:available_payment_methods"].href),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),s(this.store),this.__storeLoaderId,(()=>this.requestUpdate()),s(this.paymentPreset),this.__paymentPresetLoaderId,(()=>this.requestUpdate()));return l(_||(_=R`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderPaymentMethodConfig():this.__renderPaymentMethodSelector(),r)}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])=>{if(r.is_deprecated)return e;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 __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 __paymentPresetLoader(){return this.renderRoot.querySelector(`#${this.__paymentPresetLoaderId}`)}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}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(){const e=this.__availablePaymentMethodsLoader;return(null==e?void 0:e.data)?l(y||(y=R` <div> <section data-testid="select-method-list" class="-mt-m"> ${0} </section> </div> `),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>l(g||(g=R` <p class="font-medium text-tertiary py-m">${0}</p> <ul class="grid grid-cols-2 gap-m"> ${0} </ul> `),e,t.map((e=>l(x||(x=R`<li>${0}</li>`),this.__renderPaymentMethodButton(e)))))))):l(v||(v=R` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==e?void 0:e.in("fail"))?"error":"busy")}__renderPaymentMethodConfig(){var e;return this.form.type&&["stripe_connect","square_up","quickbook_payments","amazon_mws","paypal_platform"].includes(this.form.type)?l($||($=R` <div class="flex items-start rounded border border-primary" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="" key="no_oauth_support_message"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-primary transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> admin.foxycart.com </a> </p> </div> `),n(b||(b=R`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`))):l(j||(j=R` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> ${0} </foxy-internal-summary-control> ${0} ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.supports_3d_secure)?l(L||(L=R` <foxy-internal-select-control layout="summary-item" infer="three-d-secure-toggle" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-select-control> ${0} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?l(S||(S=R` <foxy-internal-switch-control layout="summary-item" infer="three-d-secure-response" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue):""):"",["live","test"].map(((e,t)=>{var r,i,o,a,d,c,h,u,m,p,f,_;const v=0===t?"":`${e}-`,y=0===t?this.__liveBlocks:this.__testBlocks,g=`${e}-group`;if("live"===e&&!(null===(r=this.__storeLoader)||void 0===r?void 0:r.data))return l(k||(k=R``));if("live"===e&&!(null===(o=null===(i=this.__storeLoader)||void 0===i?void 0:i.data)||void 0===o?void 0:o.is_active))return l(w||(w=R` <foxy-internal-summary-control infer="${0}-group"> <div class="flex items-start" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p><foxy-i18n infer="" key="inactive_message"></foxy-i18n></p> </div> </foxy-internal-summary-control> `),e,n(P||(P=R`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)));const x=!0===(null===(d=null===(a=this.__storeLoader)||void 0===a?void 0:a.data)||void 0===d?void 0:d.is_active)&&("test"===e&&!0===(null===(h=null===(c=this.__paymentPresetLoader)||void 0===c?void 0:c.data)||void 0===h?void 0:h.is_live)||"live"===e&&!1===(null===(m=null===(u=this.__paymentPresetLoader)||void 0===u?void 0:u.data)||void 0===m?void 0:m.is_live));return l(V||(V=R` <foxy-internal-summary-control helper-text="${0}" label="${0}" infer="${0}"> ${0} ${0} ${0} ${0} </foxy-internal-summary-control> `),s(x?this.t(`${g}.helper_text_inactive`):void 0),s(x?this.t(`${g}.label_inactive`):void 0),g,(null===(p=this.form.helper)||void 0===p?void 0:p.id_description)?l(M||(M=R` <foxy-internal-text-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,v):"",(null===(f=this.form.helper)||void 0===f?void 0:f.third_party_key_description)?l(I||(I=R` <foxy-internal-text-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}third-party-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,v):"",(null===(_=this.form.helper)||void 0===_?void 0:_.key_description)?l(B||(B=R` <foxy-internal-text-control placeholder="${0}" layout="summary-item" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,v):"",y.map((e=>this.__renderBlock(e))))})),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t}){var r,i;const o=W.defaultImageSrc,a=null!==(i=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==i?i:o,s=e=>e.currentTarget.src=o;return l(C||(C=R` <button class="${0}" ?disabled="${0}" title="${0}" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" ?hidden="${0}" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}​</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),d({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,t.conflict?this.t("conflict_message",t.conflict):"",(()=>this.edit({type:e,helper:t})),a,!!t.conflict,s,d({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),a,s,d({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderBlock(e){return l(q||(q=R`${0}`),e.fields.map((e=>{var t,r,o;if("hidden"===e.type)return;const a=["additional-fields",e.id].join("-").replace(/_/g,"-"),s=()=>{var t,r;try{const o=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");return null!==(r=i(o,e.id))&&void 0!==r?r:o.default_value}catch(t){return e.default_value}},n=t=>{var r;let i={};try{i=JSON.parse(null!==(r=this.form.additional_fields)&&void 0!==r?r:"")}catch(e){}this.edit({additional_fields:JSON.stringify(h(i,e.id,t))})},d=e.options;return l(Z||(Z=R` ${0} `),"checkbox"===e.type?l(H||(H=R` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" helper-text-as-tooltip .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(t=e.description)&&void 0!==t?t:"",e.name,a,s,n):"select"===e.type?l(D||(D=R` <foxy-internal-select-control placeholder="${0}" helper-text="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),this.t("default_additional_field_select_placeholder"),null!==(r=e.description)&&void 0!==r?r:"",e.name,a,d.map((({name:e,value:t})=>({label:e,value:t}))),s,n):l(O||(O=R` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(o=e.description)&&void 0!==o?o:"",e.default_value||this.t("default_additional_field_placeholder"),e.name,a,s,n))})))}}customElements.define("foxy-payments-api-payment-method-form",W);export{W as PaymentsApiPaymentMethodForm};
|
|
1
|
+
import"./shared-0b1b1c14.js";import"./shared-901b41cf.js";import"./shared-42bb9e8e.js";import"./shared-8521017c.js";import"./shared-cf28d2c8.js";import"./shared-133fc37b.js";import{I as e}from"./shared-d784b79a.js";import"./foxy-nucleon-element.js";import"./foxy-spinner.js";import"./shared-4e8a5b95.js";import{_ as t,B as r,l as o}from"./shared-d1195c27.js";import{g as i}from"./shared-bab2ea2c.js";import{a}from"./shared-f72d82a9.js";import{i as s}from"./shared-53e42a77.js";import{h as l,s as n}from"./shared-ba5c42c7.js";import{c as d}from"./shared-4e709717.js";import{h as c}from"./shared-56ba2d28.js";import{s as h}from"./shared-1aff7995.js";import"./shared-1482d5dd.js";import"./shared-c52295d5.js";import"./shared-c1ade7a9.js";import"./shared-f20eefdd.js";import"./shared-fea2714e.js";import"./shared-2e8361e1.js";import"./shared-6b76afc2.js";import"./shared-cd652fd0.js";import"./shared-2503aefc.js";import"./shared-01bb183b.js";import"./shared-89d09114.js";import"./shared-10b54c49.js";import"./shared-2879b67f.js";import"./shared-d2340faa.js";import"./shared-6a45a781.js";import"./shared-6d11190a.js";import"./shared-651c44fa.js";import"./shared-3aaf64e6.js";import"./shared-76dcc864.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./shared-eeb2bd18.js";import"./shared-17a61265.js";import"./shared-d1dfac4d.js";import"./shared-7e9fdf64.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-fcdb896f.js";import"./shared-4c90701b.js";import"./shared-1a49f70b.js";import"./foxy-copy-to-clipboard.js";import"./shared-5f43aa36.js";let u,p,m,f,_,v,y,g,x,$,b,j,w,L,S,k,P,V,M,I,B,C,q,Z,H,D,O,R,T=e=>e;const W=a(e,"payments-api-payment-method-form");class z extends W{constructor(){super(...arguments),this.paymentPreset=null,this.getImageSrc=null,this.store=null,this.__availablePaymentMethodsLoaderId="availablePaymentMethodsLoader",this.__paymentPresetLoaderId="paymentPresetLoader",this.__storeLoaderId="storeLoader",this.__threeDSecureResponseGetValue=()=>{var e;return null===(e=this.form.config_3d_secure)||void 0===e?void 0:e.endsWith("require_valid_response")},this.__threeDSecureResponseSetValue=e=>{const t=e?"_require_valid_response":"",r=this.form.config_3d_secure,o=(null==r?void 0:r.startsWith("all_cards"))?"all_cards":"maestro_only";this.edit({config_3d_secure:`${o}${t}`})},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"}]}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),{},{paymentPreset:{attribute:"payment-preset"},getImageSrc:{attribute:!1},store:{}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",e=>{var t,r,o,i;const a=null!==(o=null===(r=null===(t=e.helper)||void 0===t?void 0:t.additional_fields)||void 0===r?void 0:r.blocks)&&void 0!==o?o:[];let s;try{s=JSON.parse(null!==(i=e.additional_fields)&&void 0!==i?i:"{}")}catch(e){s={}}for(const e of a)for(const t of e.fields)if("optional"in t&&!t.optional&&!c(s,t.id)&&"checkbox"!==t.type)return"additional-fields:v8n_invalid";return!0}]}get hiddenSelector(){return new r(`header:copy-json ${super.hiddenSelector}`.trimEnd())}renderHeader(...e){var t;return l(u||(u=T` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?l(p||(p=T``)):l(m||(m=T` <vaadin-button data-testid="select-another-button" theme="tertiary-inline" @click="${0}"> <foxy-i18n infer="" key="select_another_button_label"></foxy-i18n> </vaadin-button> `),(()=>this.undo())))}get headerTitleOptions(){var e;return{context:this.form.type?"selected":"new",name:null===(e=this.form.helper)||void 0===e?void 0:e.name}}get headerSubtitleOptions(){if(this.href){const e=i(this.href),t=this.headerCopyIdValue;return e.startsWith("R")?{context:"regular",id:t}:{context:"hosted",id:t}}return{}}get headerCopyIdValue(){if(this.href){const e=i(this.href);return e.startsWith("R")?e.slice(1):e.slice(1).split("C")[0]}return""}renderBody(){var e;const t=null===(e=this.__paymentPresetLoader)||void 0===e?void 0:e.data,r=l(f||(f=T` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),s(null==t?void 0:t._links["fx:available_payment_methods"].href),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),s(this.store),this.__storeLoaderId,(()=>this.requestUpdate()),s(this.paymentPreset),this.__paymentPresetLoaderId,(()=>this.requestUpdate()));return l(_||(_=T`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderPaymentMethodConfig():this.__renderPaymentMethodSelector(),r)}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])=>{if(r.is_deprecated)return e;const o=t.charAt(0).toUpperCase(),i=!/\w/.test(o)?"#":o,a=e.find((e=>e.name===i));return a?a.items.push({type:t,helper:r}):e.push({name:i,items:[{type:t,helper:r}]}),e}),[])}get __availablePaymentMethodsLoader(){return this.renderRoot.querySelector(`#${this.__availablePaymentMethodsLoaderId}`)}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 __paymentPresetLoader(){return this.renderRoot.querySelector(`#${this.__paymentPresetLoaderId}`)}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}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(){const e=this.__availablePaymentMethodsLoader;return(null==e?void 0:e.data)?l(y||(y=T` <div> <section data-testid="select-method-list" class="-mt-m"> ${0} </section> </div> `),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>l(g||(g=T` <p class="font-medium text-tertiary py-m">${0}</p> <ul class="grid grid-cols-2 gap-m"> ${0} </ul> `),e,t.map((e=>l(x||(x=T`<li>${0}</li>`),this.__renderPaymentMethodButton(e)))))))):l(v||(v=T` <foxy-spinner infer="list-spinner" state="${0}"> </foxy-spinner> `),(null==e?void 0:e.in("fail"))?"error":"busy")}__renderPaymentMethodConfig(){var e,t;return this.form.type&&["stripe_connect","square_up","quickbook_payments","amazon_mws","paypal_platform"].includes(this.form.type)?l($||($=T` <div class="flex items-start rounded border border-primary" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="" key="no_oauth_support_message"></foxy-i18n> <br> <a target="_blank" class="mt-xs inline-block rounded font-medium text-primary transition-colors cursor-pointer hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="https://admin.foxycart.com"> admin.foxycart.com </a> </p> </div> `),n(b||(b=T`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`))):l(j||(j=T` <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> ${0} ${0} </foxy-internal-summary-control> ${0} ${0} `),(null===(e=this.form.helper)||void 0===e?void 0:e.supports_auth_only)?l(w||(w=T` <foxy-internal-switch-control infer="use-auth-only" helper-text-as-tooltip> </foxy-internal-switch-control> `)):"",(null===(t=this.form.helper)||void 0===t?void 0:t.supports_3d_secure)?l(L||(L=T` <foxy-internal-select-control layout="summary-item" infer="three-d-secure-toggle" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-select-control> ${0} `),this.__threeDSecureToggleGetValue,this.__threeDSecureToggleSetValue,this.__threeDSecureToggleOptions,this.form.config_3d_secure?l(S||(S=T` <foxy-internal-switch-control layout="summary-item" infer="three-d-secure-response" .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),this.__threeDSecureResponseGetValue,this.__threeDSecureResponseSetValue):""):"",["live","test"].map(((e,t)=>{var r,o,i,a,d,c,h,u,p,m,f,_;const v=0===t?"":`${e}-`,y=0===t?this.__liveBlocks:this.__testBlocks,g=`${e}-group`;if("live"===e&&!(null===(r=this.__storeLoader)||void 0===r?void 0:r.data))return l(k||(k=T``));if("live"===e&&!(null===(i=null===(o=this.__storeLoader)||void 0===o?void 0:o.data)||void 0===i?void 0:i.is_active))return l(P||(P=T` <foxy-internal-summary-control infer="${0}-group"> <div class="flex items-start" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p><foxy-i18n infer="" key="inactive_message"></foxy-i18n></p> </div> </foxy-internal-summary-control> `),e,n(V||(V=T`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-primary" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)));const x=!0===(null===(d=null===(a=this.__storeLoader)||void 0===a?void 0:a.data)||void 0===d?void 0:d.is_active)&&("test"===e&&!0===(null===(h=null===(c=this.__paymentPresetLoader)||void 0===c?void 0:c.data)||void 0===h?void 0:h.is_live)||"live"===e&&!1===(null===(p=null===(u=this.__paymentPresetLoader)||void 0===u?void 0:u.data)||void 0===p?void 0:p.is_live));return l(M||(M=T` <foxy-internal-summary-control helper-text="${0}" label="${0}" infer="${0}"> ${0} ${0} ${0} ${0} </foxy-internal-summary-control> `),s(x?this.t(`${g}.helper_text_inactive`):void 0),s(x?this.t(`${g}.label_inactive`):void 0),g,(null===(m=this.form.helper)||void 0===m?void 0:m.id_description)?l(I||(I=T` <foxy-internal-text-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}account-id"> </foxy-internal-text-control> `),this.t("default_additional_field_placeholder"),this.form.helper.id_description,v):"",(null===(f=this.form.helper)||void 0===f?void 0:f.third_party_key_description)?l(B||(B=T` <foxy-internal-password-control placeholder="${0}" helper-text="" layout="summary-item" label="${0}" infer="${0}third-party-key"> </foxy-internal-password-control> `),this.t("default_additional_field_placeholder"),this.form.helper.third_party_key_description,v):"",(null===(_=this.form.helper)||void 0===_?void 0:_.key_description)?l(C||(C=T` <foxy-internal-password-control placeholder="${0}" layout="summary-item" helper-text="" label="${0}" infer="${0}account-key"> </foxy-internal-password-control> `),this.t("default_additional_field_placeholder"),this.form.helper.key_description,v):"",y.map((e=>this.__renderBlock(e))))})),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t}){var r,o;const i=z.defaultImageSrc,a=null!==(o=null===(r=this.getImageSrc)||void 0===r?void 0:r.call(this,e))&&void 0!==o?o:i,s=e=>e.currentTarget.src=i;return l(q||(q=T` <button class="${0}" ?disabled="${0}" title="${0}" @click="${0}"> <img class="absolute top-0 left-0 w-1-2 h-full object-cover bg-center filter saturate-200 blur-3xl" style="transform:translate3d(0,0,0)" src="${0}" alt="" ?hidden="${0}" @error="${0}"> <figure class="relative flex flex-col gap-m"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <div class="font-medium">${0}​</div> <div class="text-xs ${0}">${0}</div> </figcaption> </figure> </button> `),d({"relative w-full block text-left p-s rounded bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict}),!!t.conflict,t.conflict?this.t("conflict_message",t.conflict):"",(()=>this.edit({type:e,helper:t})),a,!!t.conflict,s,d({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),a,s,d({"min-w-0 flex-1 truncate leading-s":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?"":"text-secondary",e)}__renderBlock(e){return l(Z||(Z=T`${0}`),e.fields.map((e=>{var t,r,i;if("hidden"===e.type)return;const a=["additional-fields",e.id].join("-").replace(/_/g,"-"),s=()=>{var t,r;try{const i=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");return null!==(r=o(i,e.id))&&void 0!==r?r:i.default_value}catch(t){return e.default_value}},n=t=>{var r;let o={};try{o=JSON.parse(null!==(r=this.form.additional_fields)&&void 0!==r?r:"")}catch(e){}this.edit({additional_fields:JSON.stringify(h(o,e.id,t))})},d=e.options;return l(H||(H=T` ${0} `),"checkbox"===e.type?l(D||(D=T` <foxy-internal-switch-control helper-text="${0}" label="${0}" infer="${0}" helper-text-as-tooltip .getValue="${0}" .setValue="${0}"> </foxy-internal-switch-control> `),null!==(t=e.description)&&void 0!==t?t:"",e.name,a,s,n):"select"===e.type?l(O||(O=T` <foxy-internal-select-control placeholder="${0}" helper-text="${0}" layout="summary-item" label="${0}" infer="${0}" .options="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> `),this.t("default_additional_field_select_placeholder"),null!==(r=e.description)&&void 0!==r?r:"",e.name,a,d.map((({name:e,value:t})=>({label:e,value:t}))),s,n):l(R||(R=T` <foxy-internal-text-control helper-text="${0}" placeholder="${0}" layout="summary-item" label="${0}" infer="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-text-control> `),null!==(i=e.description)&&void 0!==i?i:"",e.default_value||this.t("default_additional_field_placeholder"),e.name,a,s,n))})))}}customElements.define("foxy-payments-api-payment-method-form",z);export{z as PaymentsApiPaymentMethodForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-5212ef4f.js";import"./foxy-spinner.js";import"./shared-
|
|
1
|
+
import"./shared-5212ef4f.js";import"./foxy-spinner.js";import"./shared-4e8a5b95.js";import{a as s}from"./shared-f72d82a9.js";import{T as e}from"./shared-25893d83.js";import{c as r}from"./shared-4e709717.js";import{h as a}from"./shared-ba5c42c7.js";import"./shared-01bb183b.js";import"./shared-c52295d5.js";import"./shared-5f43aa36.js";import"./shared-d1195c27.js";import"./shared-17a61265.js";import"./shared-343d1fd7.js";import"./shared-eeb2bd18.js";import"./shared-53e42a77.js";import"./shared-93774efe.js";import"./shared-d1dfac4d.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.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-7ce74b42.js";import"./shared-42bb9e8e.js";import"./shared-8521017c.js";import"./shared-133fc37b.js";import{I as e}from"./shared-d784b79a.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 r,B as t}from"./shared-d1195c27.js";import{a as o}from"./shared-f72d82a9.js";import{i as s}from"./shared-53e42a77.js";import{h as a}from"./shared-ba5c42c7.js";import"./shared-1482d5dd.js";import"./shared-c52295d5.js";import"./shared-01bb183b.js";import"./shared-c1ade7a9.js";import"./shared-0b00883f.js";import"./shared-0b1b1c14.js";import"./shared-2879b67f.js";import"./shared-d2340faa.js";import"./shared-6a45a781.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-5f43aa36.js";import"./shared-4e8a5b95.js";import"./shared-343d1fd7.js";import"./shared-17a61265.js";import"./shared-eeb2bd18.js";import"./shared-d1dfac4d.js";import"./shared-7e9fdf64.js";import"./shared-cd96ff03.js";import"./shared-9cf15285.js";import"./shared-019348d7.js";import"./shared-1aff7995.js";import"./shared-fcdb896f.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-4c90701b.js";import"./shared-1a49f70b.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-2503aefc.js";import"./shared-89d09114.js";import"./shared-2e8361e1.js";import"./shared-6b76afc2.js";import"./shared-fea2714e.js";import"./shared-cd652fd0.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-25893d83.js";import"./shared-93774efe.js";import"./shared-528b3bdb.js";import"./shared-d279baa5.js";import"./shared-cf28d2c8.js";import"./shared-10b54c49.js";import"./shared-6d11190a.js";import"./shared-651c44fa.js";import"./shared-3aaf64e6.js";import"./shared-76dcc864.js";import"./foxy-nucleon-element.js";import"./shared-56ba2d28.js";import"./shared-901b41cf.js";import"./shared-f20eefdd.js";let i,d=e=>e;const n=o(e,"payments-api-payment-preset-form");class p extends n{constructor(){super(...arguments),this.getFraudProtectionImageSrc=null,this.getPaymentMethodImageSrc=null,this.__isPurchaseOrderEnabledGetValue=()=>{var e,r;return!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)&&this.form.is_purchase_order_enabled},this.__isLiveGetValue=()=>{var e,r;return!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)&&this.form.is_live},this.__storeLoaderId="storeLoader"}static get properties(){return r(r({},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"]}get readonlySelector(){var e,r;const o=[super.hiddenSelector.toString()];return(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)||o.unshift("general:is-live","general:is-purchase-order-enabled"),new t(o.join(" ").trim())}get hiddenSelector(){var e;const r=["header:copy-json",super.hiddenSelector.toString()],o=null===(e=this.__storeLoader)||void 0===e?void 0:e.data;return this.data||r.unshift("payment-methods","fraud-protections"),o||r.unshift("general:is-live","general:is-purchase-order-enabled"),new t(r.join(" ").trim())}renderBody(){var e,r,t,o,n,p;const m=!!(null===(r=null===(e=this.__storeLoader)||void 0===e?void 0:e.data)||void 0===r?void 0:r.is_active)?"":"_inactive_store";return a(i||(i=d` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="description"> </foxy-internal-text-control> <foxy-internal-switch-control helper-text="${0}" infer="is-live" helper-text-as-tooltip .getValue="${0}"> </foxy-internal-switch-control> <foxy-internal-switch-control helper-text="${0}" infer="is-purchase-order-enabled" helper-text-as-tooltip .getValue="${0}"> </foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control infer="payment-methods" first="${0}" limit="5" item="foxy-payments-api-payment-method-card" form="foxy-payments-api-payment-method-form" alert .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="fraud-protections" first="${0}" limit="5" item="foxy-payments-api-fraud-protection-card" form="foxy-payments-api-fraud-protection-form" alert .itemProps="${0}" .formProps="${0}"> </foxy-internal-async-list-control> ${0} <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> `),this.renderHeader(),this.t(`general.is-live.helper_text${m}`),this.__isLiveGetValue,this.t(`general.is-purchase-order-enabled.helper_text${m}`),this.__isPurchaseOrderEnabledGetValue,s(null===(t=this.data)||void 0===t?void 0:t._links["fx:payment_methods"].href),{".getImageSrc":this.getPaymentMethodImageSrc},{".getImageSrc":this.getPaymentMethodImageSrc,"payment-preset":this.href,store:null===(o=this.data)||void 0===o?void 0:o._links["fx:store"].href},s(null===(n=this.data)||void 0===n?void 0:n._links["fx:fraud_protections"].href),{".getImageSrc":this.getFraudProtectionImageSrc},{".getImageSrc":this.getFraudProtectionImageSrc},super.renderBody(),s(null===(p=this.data)||void 0===p?void 0:p._links["fx:store"].href),this.__storeLoaderId,(()=>this.requestUpdate()))}get __storeLoader(){return this.renderRoot.querySelector(`#${this.__storeLoaderId}`)}}customElements.define("foxy-payments-api-payment-preset-form",p);export{p as PaymentsApiPaymentPresetForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L as e}from"./shared-ba5c42c7.js";import{F as t}from"./shared-343d1fd7.js";import{aM as a,aH as s,_ as n}from"./shared-d1195c27.js";import{A as r}from"./shared-67898669.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=await o(m(l(p))),c=(async()=>{const e=[];for(;;){const t=new URL(d.url).origin,a=new URL(`${t}/payment_presets/${p}/payment_methods`);a.searchParams.set("offset",e.length.toString()),a.searchParams.set("limit","200");const s=await o(m(a.toString()));if(e.push(...s._embedded["fx:payment_methods"]),s._embedded["fx:payment_methods"].length<200)break}return e})(),u=null===(t=f._links["fx:payment_gateway"])||void 0===t?void 0:t.href,w=u?await o(m(u)):void 0,_=function(e){const{hostedPaymentGatewaysHelper:t,paymentGatewaysHelper:a,paymentPresetId:s,paymentMethods:n,paymentGateway:r,base:o}=e,i=new URL(`./payment_presets/${s}/available_payment_methods`,o),l={};return Object.entries(t.values).forEach((([e,t])=>{l[e]=t;const a=n.find((t=>t.type===e));a&&(l[e].conflict={type:a.type,name:a.description})})),Object.entries(a.values).forEach((([e,t])=>{l[e]=t,r&&(l[e].conflict={type:r.type,name:r.description})})),{_links:{self:{href:i.toString()}},values:l}}({hostedPaymentGatewaysHelper:await h,paymentGatewaysHelper:await y,paymentPresetId:p,paymentGateway:w,paymentMethods:await c,base:new URL(d.url).origin});n=JSON.stringify(_),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,fraudProtections:a,base:s}=e,n=new URL(`./payment_presets/${t}/available_fraud_protections`,s),r={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 submission if your webhook fails to respond correctly.",default_value:"",options:[{name:"Reject",value:"reject"},{name:"Approve",value:"approve"}]}]}]}}};for(const e in r){const t=null==a?void 0:a.find((t=>t.type===e));t&&(r[e].conflict={type:t.type,name:t.description})}return{_links:{self:{href:n.toString()}},values:r}}async function d(e){let t,s;try{const{request:n,fetch:r}=e;if("GET"!==n.method)throw t=405,new Error("Method not allowed. Allowed methods: GET.");const i=a(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}).exec(new URL(n.url).pathname).groups.presetId,d=(async()=>{const e=[];for(;;){const t=new URL(n.url).origin,a=new URL(`${t}/payment_presets/${i}/fraud_protections`);a.searchParams.set("offset",e.length.toString()),a.searchParams.set("limit","200");const s=await o(r(a.toString()));if(e.push(...s._embedded["fx:fraud_protections"]),s._embedded["fx:fraud_protections"].length<200)break}return e})(),m=l({fraudProtections:await d,paymentPresetId:i,base:new URL(n.url).origin});s=JSON.stringify(m),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=s(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 n(n({_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}),w=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: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 c(e){const{paymentPresetId:t,helper:a,base:r}=e,o="paymentGateway"in e?e.paymentGateway:e.hostedPaymentGateway,{_links:i}=o,l=s(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 n(n({_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 w=new URL(f.url),_=a(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}).exec(w.pathname).groups.presetId,[g,P,S]=await Promise.all([o(u(d)),o(u(m)),o(u(h(_)))]);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(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),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(y)),_.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:_.toString()},last:{href:g.toString()},prev:{href:P.toString()},next:{href:S.toString()},self:{href:w.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:_,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:_,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:_,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=s(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),h=new URL(`./payment_presets/${i}/available_fraud_protections`,a);return n({_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=_({paymentMethodSet:await o(e),base:d.origin})}else p=function(e){const{paymentMethodSets:t,base:a}=e,{_embedded:r,_links:o}=t,i=s(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),w=new URL(o.self.href);return u.search=w.search,n(n({},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=>_({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: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,w=u.startsWith("H"),_=d(f),g=u.substring(1,w?u.indexOf("C"):void 0),P=o(h(n)),S=o(h(r));if("DELETE"===p.method)if(w){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(_,{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=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.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=>{var s,n,r,o,l;if(!(e instanceof t))return;if(!e.request.url.startsWith("https://foxy-payments-api.element/"))return;if(e.defaultPrevented)return;const{paymentMethodSetHostedPaymentGatewaysUrl:m,hostedPaymentGatewaysHelperUrl:p,paymentGatewaysHelperUrl:f,hostedPaymentGatewaysUrl:c,paymentMethodSetsUrl:w,fraudProtectionsUrl:_,paymentGatewaysUrl:g}=this,b=null!==(s=this.paymentMethodSetHostedPaymentGatewayBaseUrl)&&void 0!==s?s:this.paymentMethodSetHostedPaymentGatewaysUrl,G=null!==(n=this.hostedPaymentGatewayBaseUrl)&&void 0!==n?n:this.hostedPaymentGatewaysUrl,L=null!==(r=this.paymentMethodSetBaseUrl)&&void 0!==r?r:this.paymentMethodSetsUrl,E=null!==(o=this.fraudProtectionBaseUrl)&&void 0!==o?o:this.fraudProtectionsUrl,R=null!==(l=this.paymentGatewayBaseUrl)&&void 0!==l?l:this.paymentGatewaysUrl;if(null===m)return;if(null===b)return;if(null===p)return;if(null===f)return;if(null===c)return;if(null===G)return;if(null===w)return;if(null===L)return;if(null===_)return;if(null===E)return;if(null===g)return;if(null===R)return;const v=e=>t=>{const a=new URL(e);return a.pathname.endsWith("/")||(a.pathname+="/"),a.pathname+=t,a.toString()},x=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:p,paymentGatewaysHelperUrl:f,hostedPaymentGatewaysUrl:c,paymentMethodSetsUrl:w,fraudProtectionsUrl:_,paymentGatewaysUrl:g,getPaymentMethodSetHostedPaymentGatewayUrl:v(m),getHostedPaymentGatewayUrl:v(G),getPaymentMethodSetUrl:v(L),getFraudProtectionUrl:v(E),getPaymentGatewayUrl:v(R),request:e.request,fetch:this.__fetch});x&&(e.preventDefault(),e.respondWith(x))}}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
|
+
import{L as e}from"./shared-ba5c42c7.js";import{F as t}from"./shared-343d1fd7.js";import{aM as a,aH as s,_ as n}from"./shared-d1195c27.js";import{A as r}from"./shared-7e9fdf64.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=await o(m(l(p))),c=(async()=>{const e=[];for(;;){const t=new URL(d.url).origin,a=new URL(`${t}/payment_presets/${p}/payment_methods`);a.searchParams.set("offset",e.length.toString()),a.searchParams.set("limit","200");const s=await o(m(a.toString()));if(e.push(...s._embedded["fx:payment_methods"]),s._embedded["fx:payment_methods"].length<200)break}return e})(),u=null===(t=f._links["fx:payment_gateway"])||void 0===t?void 0:t.href,w=u?await o(m(u)):void 0,_=function(e){const{hostedPaymentGatewaysHelper:t,paymentGatewaysHelper:a,paymentPresetId:s,paymentMethods:n,paymentGateway:r,base:o}=e,i=new URL(`./payment_presets/${s}/available_payment_methods`,o),l={};return Object.entries(t.values).forEach((([e,t])=>{l[e]=t;const a=n.find((t=>t.type===e));a&&(l[e].conflict={type:a.type,name:a.description})})),Object.entries(a.values).forEach((([e,t])=>{l[e]=t,r&&(l[e].conflict={type:r.type,name:r.description})})),{_links:{self:{href:i.toString()}},values:l}}({hostedPaymentGatewaysHelper:await h,paymentGatewaysHelper:await y,paymentPresetId:p,paymentGateway:w,paymentMethods:await c,base:new URL(d.url).origin});n=JSON.stringify(_),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,fraudProtections:a,base:s}=e,n=new URL(`./payment_presets/${t}/available_fraud_protections`,s),r={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 submission if your webhook fails to respond correctly.",default_value:"",options:[{name:"Reject",value:"reject"},{name:"Approve",value:"approve"}]}]}]}}};for(const e in r){const t=null==a?void 0:a.find((t=>t.type===e));t&&(r[e].conflict={type:t.type,name:t.description})}return{_links:{self:{href:n.toString()}},values:r}}async function d(e){let t,s;try{const{request:n,fetch:r}=e;if("GET"!==n.method)throw t=405,new Error("Method not allowed. Allowed methods: GET.");const i=a(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}).exec(new URL(n.url).pathname).groups.presetId,d=(async()=>{const e=[];for(;;){const t=new URL(n.url).origin,a=new URL(`${t}/payment_presets/${i}/fraud_protections`);a.searchParams.set("offset",e.length.toString()),a.searchParams.set("limit","200");const s=await o(r(a.toString()));if(e.push(...s._embedded["fx:fraud_protections"]),s._embedded["fx:fraud_protections"].length<200)break}return e})(),m=l({fraudProtections:await d,paymentPresetId:i,base:new URL(n.url).origin});s=JSON.stringify(m),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=s(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 n(n({_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}),w=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: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 c(e){const{paymentPresetId:t,helper:a,base:r}=e,o="paymentGateway"in e?e.paymentGateway:e.hostedPaymentGateway,{_links:i}=o,l=s(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 n(n({_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 w=new URL(f.url),_=a(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}).exec(w.pathname).groups.presetId,[g,P,S]=await Promise.all([o(u(d)),o(u(m)),o(u(h(_)))]);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(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),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(y)),_.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:_.toString()},last:{href:g.toString()},prev:{href:P.toString()},next:{href:S.toString()},self:{href:w.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:_,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:_,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:_,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=s(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),h=new URL(`./payment_presets/${i}/available_fraud_protections`,a);return n({_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=_({paymentMethodSet:await o(e),base:d.origin})}else p=function(e){const{paymentMethodSets:t,base:a}=e,{_embedded:r,_links:o}=t,i=s(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),w=new URL(o.self.href);return u.search=w.search,n(n({},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=>_({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: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,w=u.startsWith("H"),_=d(f),g=u.substring(1,w?u.indexOf("C"):void 0),P=o(h(n)),S=o(h(r));if("DELETE"===p.method)if(w){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(_,{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=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.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=>{var s,n,r,o,l;if(!(e instanceof t))return;if(!e.request.url.startsWith("https://foxy-payments-api.element/"))return;if(e.defaultPrevented)return;const{paymentMethodSetHostedPaymentGatewaysUrl:m,hostedPaymentGatewaysHelperUrl:p,paymentGatewaysHelperUrl:f,hostedPaymentGatewaysUrl:c,paymentMethodSetsUrl:w,fraudProtectionsUrl:_,paymentGatewaysUrl:g}=this,b=null!==(s=this.paymentMethodSetHostedPaymentGatewayBaseUrl)&&void 0!==s?s:this.paymentMethodSetHostedPaymentGatewaysUrl,G=null!==(n=this.hostedPaymentGatewayBaseUrl)&&void 0!==n?n:this.hostedPaymentGatewaysUrl,L=null!==(r=this.paymentMethodSetBaseUrl)&&void 0!==r?r:this.paymentMethodSetsUrl,E=null!==(o=this.fraudProtectionBaseUrl)&&void 0!==o?o:this.fraudProtectionsUrl,R=null!==(l=this.paymentGatewayBaseUrl)&&void 0!==l?l:this.paymentGatewaysUrl;if(null===m)return;if(null===b)return;if(null===p)return;if(null===f)return;if(null===c)return;if(null===G)return;if(null===w)return;if(null===L)return;if(null===_)return;if(null===E)return;if(null===g)return;if(null===R)return;const v=e=>t=>{const a=new URL(e);return a.pathname.endsWith("/")||(a.pathname+="/"),a.pathname+=t,a.toString()},x=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:p,paymentGatewaysHelperUrl:f,hostedPaymentGatewaysUrl:c,paymentMethodSetsUrl:w,fraudProtectionsUrl:_,paymentGatewaysUrl:g,getPaymentMethodSetHostedPaymentGatewayUrl:v(m),getHostedPaymentGatewayUrl:v(G),getPaymentMethodSetUrl:v(L),getFraudProtectionUrl:v(E),getPaymentGatewayUrl:v(R),request:e.request,fetch:this.__fetch});x&&(e.preventDefault(),e.respondWith(x))}}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-5f43aa36.js";import"./shared-01bb183b.js";export{Q as QueryBuilder}from"./shared-f316780a.js";import"./shared-c52295d5.js";import"./shared-f72d82a9.js";import"./shared-d1195c27.js";import"./shared-ba5c42c7.js";import"./shared-8874ec69.js";import"./shared-63c32024.js";import"./shared-4e709717.js";import"./shared-53e42a77.js";import"./shared-79d0699c.js";import"./shared-5fd5805c.js";import"./shared-17a61265.js";import"./shared-eeb2bd18.js";
|