@foxy.io/elements 1.44.0-beta.1 → 1.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (17) hide show
  1. package/dist/cdn/foxy-admin-subscription-form.js +1 -1
  2. package/dist/cdn/foxy-payments-api-payment-method-card.js +1 -1
  3. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  4. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  5. package/dist/cdn/translations/admin-subscription-form/en.json +2 -2
  6. package/dist/elements/public/AdminSubscriptionForm/internal/InternalAdminSubscriptionFormStatusActionForm/InternalAdminSubscriptionFormStatusActionForm.d.ts +1 -1
  7. package/dist/elements/public/AdminSubscriptionForm/internal/InternalAdminSubscriptionFormStatusActionForm/InternalAdminSubscriptionFormStatusActionForm.js +3 -2
  8. package/dist/elements/public/AdminSubscriptionForm/internal/InternalAdminSubscriptionFormStatusActionForm/InternalAdminSubscriptionFormStatusActionForm.js.map +1 -1
  9. package/dist/elements/public/PaymentsApiPaymentMethodCard/PaymentsApiPaymentMethodCard.d.ts +2 -2
  10. package/dist/elements/public/PaymentsApiPaymentMethodCard/PaymentsApiPaymentMethodCard.js +5 -10
  11. package/dist/elements/public/PaymentsApiPaymentMethodCard/PaymentsApiPaymentMethodCard.js.map +1 -1
  12. package/dist/elements/public/PaymentsApiPaymentMethodCard/index.d.ts +1 -3
  13. package/dist/elements/public/PaymentsApiPaymentMethodCard/index.js +1 -3
  14. package/dist/elements/public/PaymentsApiPaymentMethodCard/index.js.map +1 -1
  15. package/dist/elements/public/PaymentsApiPaymentMethodForm/PaymentsApiPaymentMethodForm.js +3 -1
  16. package/dist/elements/public/PaymentsApiPaymentMethodForm/PaymentsApiPaymentMethodForm.js.map +1 -1
  17. package/package.json +1 -1
@@ -1 +1 @@
1
- import"./foxy-transaction.js";import"./shared-597fffaa.js";import"./shared-64c855e5.js";import"./shared-9b599205.js";import"./shared-d525b69b.js";import{I as e}from"./shared-e6559d84.js";import"./foxy-transaction-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./shared-24998349.js";import"./shared-25a9d87d.js";import{a as t}from"./shared-6c2a7d2f.js";import"./foxy-form-dialog.js";import"./shared-64210e53.js";import"./shared-438e41ab.js";import"./shared-a1f181bf.js";import{B as r,_ as a}from"./shared-7fec42f2.js";import{s as o}from"./shared-2061be9a.js";import{p as s}from"./shared-f0fa0a88.js";import{h as n,s as i}from"./shared-ba5c42c7.js";import{i as d}from"./shared-53e42a77.js";import"./foxy-copy-to-clipboard.js";import{R as l,a as c}from"./shared-387d7254.js";import{g as m}from"./shared-ada5e9f5.js";import"./foxy-billing-address-card.js";import"./shared-02dd05dd.js";import"./foxy-spinner.js";import"./shared-c1b71162.js";import"./shared-3db3f3c3.js";import"./shared-3bc9eaf7.js";import"./shared-a1cfe9d5.js";import"./shared-0ea750af.js";import"./shared-264fb8a2.js";import"./shared-da95bb48.js";import"./shared-65b2760f.js";import"./shared-cd96ff03.js";import"./shared-37869bac.js";import"./shared-d6a0954b.js";import"./shared-1da47f50.js";import"./shared-e1e4d8f5.js";import"./shared-4e709717.js";import"./foxy-custom-field-form.js";import"./shared-5b93d193.js";import"./shared-297155d9.js";import"./shared-a6cf5b1f.js";import"./shared-46efbc40.js";import"./shared-dc357e9d.js";import"./shared-da4f539a.js";import"./shared-5fd5805c.js";import"./foxy-custom-field-card.js";import"./shared-5212ef4f.js";import"./shared-15a7e329.js";import"./shared-c782b9fa.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./shared-12973e93.js";import"./foxy-payment-card.js";import"./shared-cf613436.js";import"./foxy-webhook-card.js";import"./shared-bab2ea2c.js";import"./foxy-webhook-form.js";import"./shared-af39ffd8.js";import"./shared-1d03ea56.js";import"./shared-db758d3b.js";import"./shared-ac44a3a5.js";import"./shared-ab9dfa48.js";import"./shared-c4df3a2a.js";import"./shared-1d6ed748.js";import"./shared-ed24a3f9.js";import"./shared-b56949d3.js";import"./shared-d0aed1c1.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./foxy-address-form.js";import"./shared-1abfcf87.js";import"./shared-d35ed355.js";import"./shared-c3d1d247.js";import"./shared-e275989e.js";import"./foxy-item-card.js";import"./shared-47269bb6.js";import"./foxy-item-form.js";import"./shared-090ee4eb.js";import"./shared-53e476fd.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-63c32024.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-customer-card.js";import"./foxy-swipe-actions.js";import"./foxy-collection-page.js";import"./foxy-pagination.js";import"./shared-5574ea83.js";import"./shared-caac6517.js";import"./shared-0d01cd66.js";import"./shared-2d6478b0.js";import"./shared-7fa24559.js";import"./shared-f00cd094.js";let f,h,u,p,x,y,v,_,g,b,j,w=e=>e;customElements.define("foxy-internal-admin-subscription-form-status-action-form",class extends e{constructor(){super(...arguments),this.__endDatePresetOptions=JSON.stringify([{value:"tomorrow",label:"option_tomorrow"},{value:"next_transaction_date",label:"option_next_transaction_date"},{value:"custom_date",label:"option_custom_date"}]),this.__endDatePresetGetValue=()=>{var e;return null!==(e=this.form.end_date_preset)&&void 0!==e?e:"next_transaction_date"},this.__endDatePresetSetValue=e=>{if(this.edit({end_date_preset:e}),"tomorrow"===e){const e=new Date;e.setDate(e.getDate()+1),e.setHours(0,0,0,0),this.edit({end_date:o(e)})}else"next_transaction_date"===e?this.edit({end_date:this.form.next_transaction_date}):this.edit({end_date:""})},this.__endDateGetValue=()=>this.form.end_date_preset?this.form.end_date:this.form.next_transaction_date,this.__nextTransactionDateGetValue=()=>{const e=new Date;e.setDate(e.getDate()+1),e.setHours(0,0,0,0);const t=o(e);if(!this.form.next_transaction_date)return t;const r=s(this.form.next_transaction_date.substring(0,10));return!r||r<e?t:this.form.next_transaction_date}}static get v8n(){return[({next_transaction_date:e,end_date:t,is_active:r})=>{if(r){if(!t||"0000-00-00"===t)return"end-date:v8n_required"}else if(!e)return"next-transaction-date:v8n_required";return!0}]}get readonlySelector(){const e=[super.readonlySelector.toString()];return"custom_date"!==this.form.end_date_preset&&e.push("end-date"),new r(e.join(" ").trim())}renderBody(){var e;const t=new Date;t.setDate(t.getDate()+1),t.setHours(0,0,0,0);const r=!!(null===(e=this.data)||void 0===e?void 0:e.is_active),a=r?"cancel":"reactivate",s=r?"bg-error-10":"bg-success-10",d=i(r?f||(f=w`<svg class="text-error" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width: 2rem; height: 2rem;"><path stroke-linecap="round" stroke-linejoin="round" d="M5.25 7.5A2.25 2.25 0 0 1 7.5 5.25h9a2.25 2.25 0 0 1 2.25 2.25v9a2.25 2.25 0 0 1-2.25 2.25h-9a2.25 2.25 0 0 1-2.25-2.25v-9Z" /></svg>`):h||(h=w`<svg class="text-success" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width: 2rem; height: 2rem;"><path stroke-linecap="round" stroke-linejoin="round" d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99" /></svg>`));return n(u||(u=w` <foxy-internal-summary-control infer="" label="" helper-text=""> <div class="text-center flex flex-col items-center bg-transparent"> <div class="rounded-full ${0} p-m mb-s mx-auto">${0}</div> <p class="font-medium text-xl leading-m"> <foxy-i18n infer="" key="${0}_title"></foxy-i18n> </p> <p class="text-secondary leading-s"> <foxy-i18n infer="" key="${0}_subtitle"></foxy-i18n> </p> </div> </foxy-internal-summary-control> <foxy-internal-summary-control infer="" label="" helper-text=""> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="" label="" helper-text=""> ${0} </foxy-internal-summary-control> <vaadin-button theme="primary ${0} large" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="${0}_submit"></foxy-i18n> </vaadin-button> `),s,d,a,a,r?n(p||(p=w` <foxy-internal-select-control options="${0}" layout="summary-item" infer="end-date-preset" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> <foxy-internal-date-control layout="summary-item" infer="end-date" min="${0}" hide-clear-button .getValue="${0}"> </foxy-internal-date-control> `),this.__endDatePresetOptions,this.__endDatePresetGetValue,this.__endDatePresetSetValue,o(t),this.__endDateGetValue):n(x||(x=w` <foxy-internal-date-control layout="summary-item" infer="next-transaction-date" min="${0}" hide-clear-button .getValue="${0}"> </foxy-internal-date-control> `),o(t),this.__nextTransactionDateGetValue),r?[this.__renderFaq("cancel_why_not_today",i(y||(y=w`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="text-error flex-shrink-0" style="width: 1.25em; height: 1.25em;"><path d="M5.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H6a.75.75 0 0 1-.75-.75V12ZM6 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H6ZM7.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H8a.75.75 0 0 1-.75-.75V12ZM8 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H8ZM9.25 10a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H10a.75.75 0 0 1-.75-.75V10ZM10 11.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V12a.75.75 0 0 0-.75-.75H10ZM9.25 14a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H10a.75.75 0 0 1-.75-.75V14ZM12 9.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V10a.75.75 0 0 0-.75-.75H12ZM11.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H12a.75.75 0 0 1-.75-.75V12ZM12 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H12ZM13.25 10a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H14a.75.75 0 0 1-.75-.75V10ZM14 11.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V12a.75.75 0 0 0-.75-.75H14Z" /><path fill-rule="evenodd" d="M5.75 2a.75.75 0 0 1 .75.75V4h7V2.75a.75.75 0 0 1 1.5 0V4h.25A2.75 2.75 0 0 1 18 6.75v8.5A2.75 2.75 0 0 1 15.25 18H4.75A2.75 2.75 0 0 1 2 15.25v-8.5A2.75 2.75 0 0 1 4.75 4H5V2.75A.75.75 0 0 1 5.75 2Zm-1 5.5c-.69 0-1.25.56-1.25 1.25v6.5c0 .69.56 1.25 1.25 1.25h10.5c.69 0 1.25-.56 1.25-1.25v-6.5c0-.69-.56-1.25-1.25-1.25H4.75Z" clip-rule="evenodd" /></svg>`))),this.__renderFaq("cancel_whats_next",i(v||(v=w`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="text-error flex-shrink-0" style="width: 1.25em; height: 1.25em;"><path d="M3.288 4.818A1.5 1.5 0 0 0 1 6.095v7.81a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905c.155-.096.285-.213.389-.344v2.973a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905a1.5 1.5 0 0 0 0-2.552l-6.323-3.906A1.5 1.5 0 0 0 10 6.095v2.972a1.506 1.506 0 0 0-.389-.343L3.288 4.818Z" /></svg>`))),this.__renderFaq("cancel_how_to_reactivate",i(_||(_=w`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="text-error flex-shrink-0" style="width: 1.25em; height: 1.25em;"><path d="M6.111 11.89A5.5 5.5 0 1 1 15.501 8 .75.75 0 0 0 17 8a7 7 0 1 0-11.95 4.95.75.75 0 0 0 1.06-1.06Z" /><path d="M8.232 6.232a2.5 2.5 0 0 0 0 3.536.75.75 0 1 1-1.06 1.06A4 4 0 1 1 14 8a.75.75 0 0 1-1.5 0 2.5 2.5 0 0 0-4.268-1.768Z" /><path d="M10.766 7.51a.75.75 0 0 0-1.37.365l-.492 6.861a.75.75 0 0 0 1.204.65l1.043-.799.985 3.678a.75.75 0 0 0 1.45-.388l-.978-3.646 1.292.204a.75.75 0 0 0 .74-1.16l-3.874-5.764Z" /></svg>`)))]:[this.__renderFaq("reactivate_why_not_today",i(g||(g=w`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="text-success flex-shrink-0" style="width: 1.25em; height: 1.25em;"><path d="M5.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H6a.75.75 0 0 1-.75-.75V12ZM6 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H6ZM7.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H8a.75.75 0 0 1-.75-.75V12ZM8 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H8ZM9.25 10a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H10a.75.75 0 0 1-.75-.75V10ZM10 11.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V12a.75.75 0 0 0-.75-.75H10ZM9.25 14a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H10a.75.75 0 0 1-.75-.75V14ZM12 9.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V10a.75.75 0 0 0-.75-.75H12ZM11.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H12a.75.75 0 0 1-.75-.75V12ZM12 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H12ZM13.25 10a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H14a.75.75 0 0 1-.75-.75V10ZM14 11.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V12a.75.75 0 0 0-.75-.75H14Z" /><path fill-rule="evenodd" d="M5.75 2a.75.75 0 0 1 .75.75V4h7V2.75a.75.75 0 0 1 1.5 0V4h.25A2.75 2.75 0 0 1 18 6.75v8.5A2.75 2.75 0 0 1 15.25 18H4.75A2.75 2.75 0 0 1 2 15.25v-8.5A2.75 2.75 0 0 1 4.75 4H5V2.75A.75.75 0 0 1 5.75 2Zm-1 5.5c-.69 0-1.25.56-1.25 1.25v6.5c0 .69.56 1.25 1.25 1.25h10.5c.69 0 1.25-.56 1.25-1.25v-6.5c0-.69-.56-1.25-1.25-1.25H4.75Z" clip-rule="evenodd" /></svg>`))),this.__renderFaq("reactivate_whats_next",i(b||(b=w`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="text-success flex-shrink-0" style="width: 1.25em; height: 1.25em;"><path d="M3.288 4.818A1.5 1.5 0 0 0 1 6.095v7.81a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905c.155-.096.285-.213.389-.344v2.973a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905a1.5 1.5 0 0 0 0-2.552l-6.323-3.906A1.5 1.5 0 0 0 10 6.095v2.972a1.506 1.506 0 0 0-.389-.343L3.288 4.818Z" /></svg>`)))],r?"error":"success",this.disabled,(()=>this.submit()),a)}submit(){var e;(null===(e=this.data)||void 0===e?void 0:e.is_active)?"next_transaction_date"===this.__endDatePresetGetValue()&&this.edit({end_date:this.form.next_transaction_date}):this.edit({next_transaction_date:this.__nextTransactionDateGetValue(),is_active:!0,end_date:"0000-00-00"}),super.submit()}async _sendPatch(e){return delete e.end_date_preset,super._sendPatch(e)}__renderFaq(e,t){return n(j||(j=w` <div class="bg-transparent flex leading-xs" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p class="grid"> <foxy-i18n class="leading-m text-s font-medium" infer="" key="${0}_title"> </foxy-i18n> <foxy-i18n class="leading-xs text-secondary text-xs" infer="" key="${0}_text"> </foxy-i18n> </p> </div> `),t,e,e)}});let k,$,V,M=e=>e;customElements.define("foxy-internal-admin-subscription-form-status-action",class extends t{get hiddenSelector(){const e=[super.hiddenSelector.toString()];return e.unshift("form:save-button"),new r(e.join(" ").trim())}renderControl(){var e,t;const r=this.nucleon,a=null===(e=null==r?void 0:r.data)||void 0===e?void 0:e.end_date,o=null===(t=null==r?void 0:r.data)||void 0===t?void 0:t.is_active,s=!o||!a||"0000-00-00"===a;return n(k||(k=M` <vaadin-button theme="tertiary-inline${0}" @click="${0}"> <foxy-i18n infer="" key="caption_${0}"></foxy-i18n> </vaadin-button> ${0} `),s?o?" error":" success":"",(e=>{var t;const r=e.currentTarget;null===(t=this.renderRoot.querySelector("#dialog"))||void 0===t||t.show(r)}),o?a&&"0000-00-00"!==a?"uncancel":"cancel":"reactivate",s?n($||($=M` <foxy-form-dialog infer="form" form="foxy-internal-admin-subscription-form-status-action-form" href="${0}" no-confirm-when-dirty close-on-patch alert id="dialog"> </foxy-form-dialog> `),d(null==r?void 0:r.href)):n(V||(V=M` <foxy-internal-confirm-dialog message="uncancel_message" confirm="uncancel_confirm" cancel="uncancel_cancel" header="uncancel_header" infer="" id="dialog" @hide="${0}"> </foxy-internal-confirm-dialog> `),(e=>{var t,r;e.detail.cancelled||(null===(t=this.nucleon)||void 0===t||t.edit({end_date:"0000-00-00"}),null===(r=this.nucleon)||void 0===r||r.submit())})))}});let Z,H=e=>e;class S extends(l(t)){constructor(){super(...arguments),this.search=null}static get properties(){return a(a({},super.properties),{},{search:{}})}renderControl(){var e,t;const r=this.nucleon;let a;try{const o=new URL(null!==(t=null===(e=null==r?void 0:r.data)||void 0===e?void 0:e._links["fx:sub_token_url"].href)&&void 0!==t?t:"");if(this.search){const e=new URLSearchParams(o.search);o.search=this.search,e.forEach(((e,t)=>o.searchParams.set(t,e)))}a=o.toString()}catch(e){a=void 0}return n(Z||(Z=H` <div class="leading-xs flex items-center gap-xs"> <foxy-i18n class="truncate min-w-0" infer="" key="label"></foxy-i18n> <span class="text-tertiary"> &bull; </span> <foxy-copy-to-clipboard layout="complete" theme="tertiary-inline" infer="copy-to-clipboard" text="${0}"> </foxy-copy-to-clipboard> </div> <foxy-i18n class="leading-xs block text-xs text-secondary" infer="" key="helper_text"> </foxy-i18n> `),a)}}customElements.define("foxy-internal-admin-subscription-form-link-control",S);let A,D,P=e=>e;customElements.define("foxy-internal-admin-subscription-form-error",class extends t{renderControl(){var e,t;return n(A||(A=P` <p class="flex items-start gap-ds p-ds rounded border border-error-50" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <span>${0}</span> </p> `),i(D||(D=P`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-error" 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>`)),null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t.error_message)}});let B,C,q,G,E,F,z,L=e=>e;const O=c(e,"admin-subscription-form");class R extends O{constructor(){super(...arguments),this.uoeSettingsPage=null}static get properties(){return a(a({},super.properties),{},{uoeSettingsPage:{attribute:"uoe-settings-page"}})}get hiddenSelector(){const e=["delete",super.hiddenSelector.toString()],t=this.data;return(null==t?void 0:t.error_message)&&t.past_due_amount||e.unshift("error-message"),new r(e.join(" ").trim())}get headerSubtitleKey(){const e=m(this.data);return e?`subtitle_${e}`:super.headerSubtitleKey}renderHeaderActions(){return n(B||(B=L` <foxy-internal-admin-subscription-form-status-action infer="status-action"> </foxy-internal-admin-subscription-form-status-action> `))}renderBody(){var e,t,r,a,o,s,l,c,m;let f;try{const r=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:transactions"].href)&&void 0!==t?t:"");r.searchParams.set("zoom","items"),f=r.toString()}catch(e){f=void 0}const h=null===(a=null===(r=this.data)||void 0===r?void 0:r._links["fx:charge_past_due"])||void 0===a?void 0:a.href,u=null===(o=this.data)||void 0===o?void 0:o.past_due_amount,p=null===(s=this.data)||void 0===s?void 0:s.error_message,x=null===(l=this.data)||void 0===l?void 0:l._embedded["fx:transaction_template"].currency_code;return n(C||(C=L` ${0} <foxy-internal-admin-subscription-form-error infer="error-message"> </foxy-internal-admin-subscription-form-error> <foxy-internal-summary-control infer="general"> <foxy-internal-date-control layout="summary-item" infer="start-date"> </foxy-internal-date-control> <foxy-internal-frequency-control layout="summary-item" infer="frequency" allow-twice-a-month> </foxy-internal-frequency-control> <foxy-internal-date-control layout="summary-item" infer="next-transaction-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="overdue"> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="past-due-amount" min="0"> </foxy-internal-number-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="self-service-links"> <foxy-internal-admin-subscription-form-link-control infer="load-in-cart"> </foxy-internal-admin-subscription-form-link-control> <foxy-internal-admin-subscription-form-link-control search="cart=checkout" infer="load-on-checkout"> </foxy-internal-admin-subscription-form-link-control> <foxy-internal-admin-subscription-form-link-control search="sub_cancel=next_transaction_date" infer="cancel-at-end-of-billing-period"> </foxy-internal-admin-subscription-form-link-control> <foxy-internal-admin-subscription-form-link-control search="sub_cancel=true" infer="cancel-next-day"> </foxy-internal-admin-subscription-form-link-control> <div class="flex items-start leading-xs text-xs text-secondary" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="" key="uoe_hint_text"></foxy-i18n> ${0} </p> </div> </foxy-internal-summary-control> ${0} <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="transactions" class="min-w-0" first="${0}" item="foxy-transaction-card" form="foxy-transaction" hide-create-button hide-delete-button alert wide> </foxy-internal-async-list-control> ${0} `),this.renderHeader(),d(x),h&&x&&u?n(q||(q=L` <foxy-internal-post-action-control message-options="${0}" theme="tertiary-inline" infer="charge-past-due" href="${0}" @success="${0}"> </foxy-internal-post-action-control> `),JSON.stringify({amount:`${u} ${x}`}),h,(()=>this.refresh())):p&&!u?n(G||(G=L` <details class="leading-xs text-xs text-secondary rounded-b focus-within-ring-2 focus-within-ring-inset focus-within-ring-primary-50" style="--gap:calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)"> <summary class="cursor-pointer transition-colors hover-text-body focus-outline-none"> <span class="flex items-start" style="gap:var(--gap)"> ${0} <foxy-i18n infer="" key="error_with_zero_past_due_hint"></foxy-i18n> </span> </summary> <p style="padding-left:calc(1.25em + var(--gap))" class="pt-xs"> <span class="whitespace-pre-line">${0}</span> </p> </details> `),i(E||(E=L`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" class="flex-shrink-0" style="width: 1.25em"><path fill-rule="evenodd" d="M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0ZM9 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM6.75 8a.75.75 0 0 0 0 1.5h.75v1.75a.75.75 0 0 0 1.5 0v-2.5A.75.75 0 0 0 8.25 8h-1.5Z" clip-rule="evenodd" /></svg>`)),p):"",i(F||(F=L`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" class="flex-shrink-0" style="width: 1.25em"><path fill-rule="evenodd" d="M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0ZM9 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM6.75 8a.75.75 0 0 0 0 1.5h.75v1.75a.75.75 0 0 0 1.5 0v-2.5A.75.75 0 0 0 8.25 8h-1.5Z" clip-rule="evenodd" /></svg>`)),this.uoeSettingsPage?n(z||(z=L` <a target="_blank" class="inline-block rounded font-medium text-body cursor-pointer hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="" key="uoe_link_text"></foxy-i18n> </a> `),this.uoeSettingsPage):"",this.renderTemplateOrSlot(),d(null===(m=null===(c=this.data)||void 0===c?void 0:c._links)||void 0===m?void 0:m["fx:attributes"].href),d(f),super.renderBody())}}customElements.define("foxy-admin-subscription-form",R);export{R as AdminSubscriptionForm};
1
+ import"./foxy-transaction.js";import"./shared-597fffaa.js";import"./shared-64c855e5.js";import"./shared-9b599205.js";import"./shared-d525b69b.js";import{I as e}from"./shared-e6559d84.js";import"./foxy-transaction-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./shared-24998349.js";import"./shared-25a9d87d.js";import{a as t}from"./shared-6c2a7d2f.js";import"./foxy-form-dialog.js";import"./shared-64210e53.js";import"./shared-438e41ab.js";import"./shared-a1f181bf.js";import{B as r,_ as a}from"./shared-7fec42f2.js";import{s as o}from"./shared-2061be9a.js";import{p as s}from"./shared-f0fa0a88.js";import{h as i,s as n}from"./shared-ba5c42c7.js";import{i as d}from"./shared-53e42a77.js";import"./foxy-copy-to-clipboard.js";import{R as l,a as c}from"./shared-387d7254.js";import{g as m}from"./shared-ada5e9f5.js";import"./foxy-billing-address-card.js";import"./shared-02dd05dd.js";import"./foxy-spinner.js";import"./shared-c1b71162.js";import"./shared-3db3f3c3.js";import"./shared-3bc9eaf7.js";import"./shared-a1cfe9d5.js";import"./shared-0ea750af.js";import"./shared-264fb8a2.js";import"./shared-da95bb48.js";import"./shared-65b2760f.js";import"./shared-cd96ff03.js";import"./shared-37869bac.js";import"./shared-d6a0954b.js";import"./shared-1da47f50.js";import"./shared-e1e4d8f5.js";import"./shared-4e709717.js";import"./foxy-custom-field-form.js";import"./shared-5b93d193.js";import"./shared-297155d9.js";import"./shared-a6cf5b1f.js";import"./shared-46efbc40.js";import"./shared-dc357e9d.js";import"./shared-da4f539a.js";import"./shared-5fd5805c.js";import"./foxy-custom-field-card.js";import"./shared-5212ef4f.js";import"./shared-15a7e329.js";import"./shared-c782b9fa.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./shared-12973e93.js";import"./foxy-payment-card.js";import"./shared-cf613436.js";import"./foxy-webhook-card.js";import"./shared-bab2ea2c.js";import"./foxy-webhook-form.js";import"./shared-af39ffd8.js";import"./shared-1d03ea56.js";import"./shared-db758d3b.js";import"./shared-ac44a3a5.js";import"./shared-ab9dfa48.js";import"./shared-c4df3a2a.js";import"./shared-1d6ed748.js";import"./shared-ed24a3f9.js";import"./shared-b56949d3.js";import"./shared-d0aed1c1.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./foxy-address-form.js";import"./shared-1abfcf87.js";import"./shared-d35ed355.js";import"./shared-c3d1d247.js";import"./shared-e275989e.js";import"./foxy-item-card.js";import"./shared-47269bb6.js";import"./foxy-item-form.js";import"./shared-090ee4eb.js";import"./shared-53e476fd.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-63c32024.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-customer-card.js";import"./foxy-swipe-actions.js";import"./foxy-collection-page.js";import"./foxy-pagination.js";import"./shared-5574ea83.js";import"./shared-caac6517.js";import"./shared-0d01cd66.js";import"./shared-2d6478b0.js";import"./shared-7fa24559.js";import"./shared-f00cd094.js";let f,h,u,p,x,y,v,_,g,b,j,w=e=>e;customElements.define("foxy-internal-admin-subscription-form-status-action-form",class extends e{constructor(){super(...arguments),this.__endDatePresetOptions=JSON.stringify([{value:"tomorrow",label:"option_tomorrow"},{value:"next_transaction_date",label:"option_next_transaction_date"},{value:"custom_date",label:"option_custom_date"}]),this.__endDatePresetGetValue=()=>{var e;return null!==(e=this.form.end_date_preset)&&void 0!==e?e:"next_transaction_date"},this.__endDatePresetSetValue=e=>{if(this.edit({end_date_preset:e}),"tomorrow"===e){const e=new Date;e.setDate(e.getDate()+1),e.setHours(0,0,0,0),this.edit({end_date:o(e)})}else"next_transaction_date"===e?this.edit({end_date:this.form.next_transaction_date}):this.edit({end_date:""})},this.__endDateGetValue=()=>this.form.end_date_preset?this.form.end_date:this.form.next_transaction_date,this.__nextTransactionDateGetValue=()=>{const e=new Date;e.setDate(e.getDate()+1),e.setHours(0,0,0,0);const t=o(e);if(!this.form.next_transaction_date)return t;const r=s(this.form.next_transaction_date.substring(0,10));return!r||r<e?t:this.form.next_transaction_date}}static get v8n(){return[({next_transaction_date:e,end_date:t},r)=>{var a;if(null===(a=r.data)||void 0===a?void 0:a.is_active){if(!t||"0000-00-00"===t)return"end-date:v8n_required"}else if(!e)return"next-transaction-date:v8n_required";return!0}]}get readonlySelector(){const e=[super.readonlySelector.toString()];return"custom_date"!==this.form.end_date_preset&&e.push("end-date"),new r(e.join(" ").trim())}renderBody(){var e;const t=new Date;t.setDate(t.getDate()+1),t.setHours(0,0,0,0);const r=!!(null===(e=this.data)||void 0===e?void 0:e.is_active),a=r?"cancel":"reactivate",s=r?"bg-error-10":"bg-success-10",d=n(r?f||(f=w`<svg class="text-error" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width: 2rem; height: 2rem;"><path stroke-linecap="round" stroke-linejoin="round" d="M5.25 7.5A2.25 2.25 0 0 1 7.5 5.25h9a2.25 2.25 0 0 1 2.25 2.25v9a2.25 2.25 0 0 1-2.25 2.25h-9a2.25 2.25 0 0 1-2.25-2.25v-9Z" /></svg>`):h||(h=w`<svg class="text-success" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" style="width: 2rem; height: 2rem;"><path stroke-linecap="round" stroke-linejoin="round" d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99" /></svg>`));return i(u||(u=w` <foxy-internal-summary-control infer="" label="" helper-text=""> <div class="text-center flex flex-col items-center bg-transparent"> <div class="rounded-full ${0} p-m mb-s mx-auto">${0}</div> <p class="font-medium text-xl leading-m"> <foxy-i18n infer="" key="${0}_title"></foxy-i18n> </p> <p class="text-secondary leading-s"> <foxy-i18n infer="" key="${0}_subtitle"></foxy-i18n> </p> </div> </foxy-internal-summary-control> <foxy-internal-summary-control infer="" label="" helper-text=""> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="" label="" helper-text=""> ${0} </foxy-internal-summary-control> <vaadin-button theme="primary ${0} large" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n infer="" key="${0}_submit"></foxy-i18n> </vaadin-button> `),s,d,a,a,r?i(p||(p=w` <foxy-internal-select-control options="${0}" layout="summary-item" infer="end-date-preset" .getValue="${0}" .setValue="${0}"> </foxy-internal-select-control> <foxy-internal-date-control layout="summary-item" infer="end-date" min="${0}" hide-clear-button .getValue="${0}"> </foxy-internal-date-control> `),this.__endDatePresetOptions,this.__endDatePresetGetValue,this.__endDatePresetSetValue,o(t),this.__endDateGetValue):i(x||(x=w` <foxy-internal-date-control layout="summary-item" infer="next-transaction-date" min="${0}" hide-clear-button .getValue="${0}"> </foxy-internal-date-control> `),o(t),this.__nextTransactionDateGetValue),r?[this.__renderFaq("cancel_why_not_today",n(y||(y=w`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="text-error flex-shrink-0" style="width: 1.25em; height: 1.25em;"><path d="M5.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H6a.75.75 0 0 1-.75-.75V12ZM6 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H6ZM7.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H8a.75.75 0 0 1-.75-.75V12ZM8 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H8ZM9.25 10a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H10a.75.75 0 0 1-.75-.75V10ZM10 11.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V12a.75.75 0 0 0-.75-.75H10ZM9.25 14a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H10a.75.75 0 0 1-.75-.75V14ZM12 9.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V10a.75.75 0 0 0-.75-.75H12ZM11.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H12a.75.75 0 0 1-.75-.75V12ZM12 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H12ZM13.25 10a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H14a.75.75 0 0 1-.75-.75V10ZM14 11.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V12a.75.75 0 0 0-.75-.75H14Z" /><path fill-rule="evenodd" d="M5.75 2a.75.75 0 0 1 .75.75V4h7V2.75a.75.75 0 0 1 1.5 0V4h.25A2.75 2.75 0 0 1 18 6.75v8.5A2.75 2.75 0 0 1 15.25 18H4.75A2.75 2.75 0 0 1 2 15.25v-8.5A2.75 2.75 0 0 1 4.75 4H5V2.75A.75.75 0 0 1 5.75 2Zm-1 5.5c-.69 0-1.25.56-1.25 1.25v6.5c0 .69.56 1.25 1.25 1.25h10.5c.69 0 1.25-.56 1.25-1.25v-6.5c0-.69-.56-1.25-1.25-1.25H4.75Z" clip-rule="evenodd" /></svg>`))),this.__renderFaq("cancel_whats_next",n(v||(v=w`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="text-error flex-shrink-0" style="width: 1.25em; height: 1.25em;"><path d="M3.288 4.818A1.5 1.5 0 0 0 1 6.095v7.81a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905c.155-.096.285-.213.389-.344v2.973a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905a1.5 1.5 0 0 0 0-2.552l-6.323-3.906A1.5 1.5 0 0 0 10 6.095v2.972a1.506 1.506 0 0 0-.389-.343L3.288 4.818Z" /></svg>`))),this.__renderFaq("cancel_how_to_reactivate",n(_||(_=w`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="text-error flex-shrink-0" style="width: 1.25em; height: 1.25em;"><path d="M6.111 11.89A5.5 5.5 0 1 1 15.501 8 .75.75 0 0 0 17 8a7 7 0 1 0-11.95 4.95.75.75 0 0 0 1.06-1.06Z" /><path d="M8.232 6.232a2.5 2.5 0 0 0 0 3.536.75.75 0 1 1-1.06 1.06A4 4 0 1 1 14 8a.75.75 0 0 1-1.5 0 2.5 2.5 0 0 0-4.268-1.768Z" /><path d="M10.766 7.51a.75.75 0 0 0-1.37.365l-.492 6.861a.75.75 0 0 0 1.204.65l1.043-.799.985 3.678a.75.75 0 0 0 1.45-.388l-.978-3.646 1.292.204a.75.75 0 0 0 .74-1.16l-3.874-5.764Z" /></svg>`)))]:[this.__renderFaq("reactivate_why_not_today",n(g||(g=w`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="text-success flex-shrink-0" style="width: 1.25em; height: 1.25em;"><path d="M5.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H6a.75.75 0 0 1-.75-.75V12ZM6 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H6ZM7.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H8a.75.75 0 0 1-.75-.75V12ZM8 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H8ZM9.25 10a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H10a.75.75 0 0 1-.75-.75V10ZM10 11.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V12a.75.75 0 0 0-.75-.75H10ZM9.25 14a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H10a.75.75 0 0 1-.75-.75V14ZM12 9.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V10a.75.75 0 0 0-.75-.75H12ZM11.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H12a.75.75 0 0 1-.75-.75V12ZM12 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H12ZM13.25 10a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H14a.75.75 0 0 1-.75-.75V10ZM14 11.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V12a.75.75 0 0 0-.75-.75H14Z" /><path fill-rule="evenodd" d="M5.75 2a.75.75 0 0 1 .75.75V4h7V2.75a.75.75 0 0 1 1.5 0V4h.25A2.75 2.75 0 0 1 18 6.75v8.5A2.75 2.75 0 0 1 15.25 18H4.75A2.75 2.75 0 0 1 2 15.25v-8.5A2.75 2.75 0 0 1 4.75 4H5V2.75A.75.75 0 0 1 5.75 2Zm-1 5.5c-.69 0-1.25.56-1.25 1.25v6.5c0 .69.56 1.25 1.25 1.25h10.5c.69 0 1.25-.56 1.25-1.25v-6.5c0-.69-.56-1.25-1.25-1.25H4.75Z" clip-rule="evenodd" /></svg>`))),this.__renderFaq("reactivate_whats_next",n(b||(b=w`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="text-success flex-shrink-0" style="width: 1.25em; height: 1.25em;"><path d="M3.288 4.818A1.5 1.5 0 0 0 1 6.095v7.81a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905c.155-.096.285-.213.389-.344v2.973a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905a1.5 1.5 0 0 0 0-2.552l-6.323-3.906A1.5 1.5 0 0 0 10 6.095v2.972a1.506 1.506 0 0 0-.389-.343L3.288 4.818Z" /></svg>`)))],r?"error":"success",this.disabled,(()=>this.submit()),a)}submit(){var e;(null===(e=this.data)||void 0===e?void 0:e.is_active)?"next_transaction_date"===this.__endDatePresetGetValue()&&this.edit({end_date:this.form.next_transaction_date}):this.edit({next_transaction_date:this.__nextTransactionDateGetValue(),is_active:!0,end_date:"0000-00-00"}),super.submit()}async _sendPatch(e){return delete e.end_date_preset,super._sendPatch(e)}__renderFaq(e,t){return i(j||(j=w` <div class="bg-transparent flex leading-xs" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p class="grid"> <foxy-i18n class="leading-m text-s font-medium" infer="" key="${0}_title"> </foxy-i18n> <foxy-i18n class="leading-xs text-secondary text-xs" infer="" key="${0}_text"> </foxy-i18n> </p> </div> `),t,e,e)}});let k,$,V,M=e=>e;customElements.define("foxy-internal-admin-subscription-form-status-action",class extends t{get hiddenSelector(){const e=[super.hiddenSelector.toString()];return e.unshift("form:save-button"),new r(e.join(" ").trim())}renderControl(){var e,t;const r=this.nucleon,a=null===(e=null==r?void 0:r.data)||void 0===e?void 0:e.end_date,o=null===(t=null==r?void 0:r.data)||void 0===t?void 0:t.is_active,s=!o||!a||"0000-00-00"===a;return i(k||(k=M` <vaadin-button theme="tertiary-inline${0}" @click="${0}"> <foxy-i18n infer="" key="caption_${0}"></foxy-i18n> </vaadin-button> ${0} `),s?o?" error":" success":"",(e=>{var t;const r=e.currentTarget;null===(t=this.renderRoot.querySelector("#dialog"))||void 0===t||t.show(r)}),o?a&&"0000-00-00"!==a?"uncancel":"cancel":"reactivate",s?i($||($=M` <foxy-form-dialog infer="form" form="foxy-internal-admin-subscription-form-status-action-form" href="${0}" no-confirm-when-dirty close-on-patch alert id="dialog"> </foxy-form-dialog> `),d(null==r?void 0:r.href)):i(V||(V=M` <foxy-internal-confirm-dialog message="uncancel_message" confirm="uncancel_confirm" cancel="uncancel_cancel" header="uncancel_header" infer="" id="dialog" @hide="${0}"> </foxy-internal-confirm-dialog> `),(e=>{var t,r;e.detail.cancelled||(null===(t=this.nucleon)||void 0===t||t.edit({end_date:"0000-00-00"}),null===(r=this.nucleon)||void 0===r||r.submit())})))}});let Z,H=e=>e;class S extends(l(t)){constructor(){super(...arguments),this.search=null}static get properties(){return a(a({},super.properties),{},{search:{}})}renderControl(){var e,t;const r=this.nucleon;let a;try{const o=new URL(null!==(t=null===(e=null==r?void 0:r.data)||void 0===e?void 0:e._links["fx:sub_token_url"].href)&&void 0!==t?t:"");if(this.search){const e=new URLSearchParams(o.search);o.search=this.search,e.forEach(((e,t)=>o.searchParams.set(t,e)))}a=o.toString()}catch(e){a=void 0}return i(Z||(Z=H` <div class="leading-xs flex items-center gap-xs"> <foxy-i18n class="truncate min-w-0" infer="" key="label"></foxy-i18n> <span class="text-tertiary"> &bull; </span> <foxy-copy-to-clipboard layout="complete" theme="tertiary-inline" infer="copy-to-clipboard" text="${0}"> </foxy-copy-to-clipboard> </div> <foxy-i18n class="leading-xs block text-xs text-secondary" infer="" key="helper_text"> </foxy-i18n> `),a)}}customElements.define("foxy-internal-admin-subscription-form-link-control",S);let A,D,P=e=>e;customElements.define("foxy-internal-admin-subscription-form-error",class extends t{renderControl(){var e,t;return i(A||(A=P` <p class="flex items-start gap-ds p-ds rounded border border-error-50" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <span>${0}</span> </p> `),n(D||(D=P`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-error" 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>`)),null===(t=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===t?void 0:t.error_message)}});let B,C,q,G,E,F,z,L=e=>e;const O=c(e,"admin-subscription-form");class R extends O{constructor(){super(...arguments),this.uoeSettingsPage=null}static get properties(){return a(a({},super.properties),{},{uoeSettingsPage:{attribute:"uoe-settings-page"}})}get hiddenSelector(){const e=["delete",super.hiddenSelector.toString()],t=this.data;return(null==t?void 0:t.error_message)&&t.past_due_amount||e.unshift("error-message"),new r(e.join(" ").trim())}get headerSubtitleKey(){const e=m(this.data);return e?`subtitle_${e}`:super.headerSubtitleKey}renderHeaderActions(){return i(B||(B=L` <foxy-internal-admin-subscription-form-status-action infer="status-action"> </foxy-internal-admin-subscription-form-status-action> `))}renderBody(){var e,t,r,a,o,s,l,c,m;let f;try{const r=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:transactions"].href)&&void 0!==t?t:"");r.searchParams.set("zoom","items"),f=r.toString()}catch(e){f=void 0}const h=null===(a=null===(r=this.data)||void 0===r?void 0:r._links["fx:charge_past_due"])||void 0===a?void 0:a.href,u=null===(o=this.data)||void 0===o?void 0:o.past_due_amount,p=null===(s=this.data)||void 0===s?void 0:s.error_message,x=null===(l=this.data)||void 0===l?void 0:l._embedded["fx:transaction_template"].currency_code;return i(C||(C=L` ${0} <foxy-internal-admin-subscription-form-error infer="error-message"> </foxy-internal-admin-subscription-form-error> <foxy-internal-summary-control infer="general"> <foxy-internal-date-control layout="summary-item" infer="start-date"> </foxy-internal-date-control> <foxy-internal-frequency-control layout="summary-item" infer="frequency" allow-twice-a-month> </foxy-internal-frequency-control> <foxy-internal-date-control layout="summary-item" infer="next-transaction-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="overdue"> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="past-due-amount" min="0"> </foxy-internal-number-control> ${0} </foxy-internal-summary-control> <foxy-internal-summary-control infer="self-service-links"> <foxy-internal-admin-subscription-form-link-control infer="load-in-cart"> </foxy-internal-admin-subscription-form-link-control> <foxy-internal-admin-subscription-form-link-control search="cart=checkout" infer="load-on-checkout"> </foxy-internal-admin-subscription-form-link-control> <foxy-internal-admin-subscription-form-link-control search="sub_cancel=next_transaction_date" infer="cancel-at-end-of-billing-period"> </foxy-internal-admin-subscription-form-link-control> <foxy-internal-admin-subscription-form-link-control search="sub_cancel=true" infer="cancel-next-day"> </foxy-internal-admin-subscription-form-link-control> <div class="flex items-start leading-xs text-xs text-secondary" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="" key="uoe_hint_text"></foxy-i18n> ${0} </p> </div> </foxy-internal-summary-control> ${0} <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="transactions" class="min-w-0" first="${0}" item="foxy-transaction-card" form="foxy-transaction" hide-create-button hide-delete-button alert wide> </foxy-internal-async-list-control> ${0} `),this.renderHeader(),d(x),h&&x&&u?i(q||(q=L` <foxy-internal-post-action-control message-options="${0}" theme="tertiary-inline" infer="charge-past-due" href="${0}" @success="${0}"> </foxy-internal-post-action-control> `),JSON.stringify({amount:`${u} ${x}`}),h,(()=>this.refresh())):p&&!u?i(G||(G=L` <details class="leading-xs text-xs text-secondary rounded-b focus-within-ring-2 focus-within-ring-inset focus-within-ring-primary-50" style="--gap:calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)"> <summary class="cursor-pointer transition-colors hover-text-body focus-outline-none"> <span class="flex items-start" style="gap:var(--gap)"> ${0} <foxy-i18n infer="" key="error_with_zero_past_due_hint"></foxy-i18n> </span> </summary> <p style="padding-left:calc(1.25em + var(--gap))" class="pt-xs"> <span class="whitespace-pre-line">${0}</span> </p> </details> `),n(E||(E=L`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" class="flex-shrink-0" style="width: 1.25em"><path fill-rule="evenodd" d="M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0ZM9 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM6.75 8a.75.75 0 0 0 0 1.5h.75v1.75a.75.75 0 0 0 1.5 0v-2.5A.75.75 0 0 0 8.25 8h-1.5Z" clip-rule="evenodd" /></svg>`)),p):"",n(F||(F=L`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" class="flex-shrink-0" style="width: 1.25em"><path fill-rule="evenodd" d="M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0ZM9 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM6.75 8a.75.75 0 0 0 0 1.5h.75v1.75a.75.75 0 0 0 1.5 0v-2.5A.75.75 0 0 0 8.25 8h-1.5Z" clip-rule="evenodd" /></svg>`)),this.uoeSettingsPage?i(z||(z=L` <a target="_blank" class="inline-block rounded font-medium text-body cursor-pointer hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="" key="uoe_link_text"></foxy-i18n> </a> `),this.uoeSettingsPage):"",this.renderTemplateOrSlot(),d(null===(m=null===(c=this.data)||void 0===c?void 0:c._links)||void 0===m?void 0:m["fx:attributes"].href),d(f),super.renderBody())}}customElements.define("foxy-admin-subscription-form",R);export{R as AdminSubscriptionForm};
@@ -1 +1 @@
1
- import"./shared-5212ef4f.js";import"./foxy-spinner.js";import"./shared-64210e53.js";import{_ as e}from"./shared-7fec42f2.js";import{a as r}from"./shared-387d7254.js";import{T as s}from"./shared-15a7e329.js";import{h as t}from"./shared-ba5c42c7.js";import"./shared-c1b71162.js";import"./shared-3db3f3c3.js";import"./shared-3bc9eaf7.js";import"./shared-a1cfe9d5.js";import"./shared-0ea750af.js";import"./shared-c782b9fa.js";import"./shared-53e42a77.js";import"./shared-264fb8a2.js";import"./shared-da95bb48.js";import"./shared-65b2760f.js";import"./shared-cd96ff03.js";import"./shared-37869bac.js";import"./shared-d6a0954b.js";import"./shared-1da47f50.js";import"./shared-e1e4d8f5.js";import"./shared-4e709717.js";let a,i,o,d=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=d`${0}`),e.helper.name),subtitle:e=>t(i||(i=d`${0}`),e.description)});if(!this.in({idle:"snapshot"}))return s;const m=l.defaultImageSrc,p=this.data;return t(o||(o=d` <figure class="flex items-center" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <img class="relative h-s w-s object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs" src="${0}" alt="${0}" @error="${0}"> <figcaption class="min-w-0 flex-1">${0}</figcaption> </figure> `),null!==(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
+ import"./shared-02dd05dd.js";import{_ as e}from"./shared-7fec42f2.js";import{a as r}from"./shared-387d7254.js";import{I as s}from"./shared-264fb8a2.js";import{h as t}from"./shared-ba5c42c7.js";import"./foxy-spinner.js";import"./shared-c1b71162.js";import"./shared-3db3f3c3.js";import"./shared-3bc9eaf7.js";import"./shared-a1cfe9d5.js";import"./shared-64210e53.js";import"./shared-0ea750af.js";import"./shared-da95bb48.js";import"./shared-65b2760f.js";import"./shared-cd96ff03.js";import"./shared-37869bac.js";import"./shared-d6a0954b.js";import"./shared-1da47f50.js";import"./shared-e1e4d8f5.js";import"./shared-4e709717.js";let a,i=e=>e;const d=r(s,"payments-api-payment-method-card");class o extends d{constructor(){super(...arguments),this.getImageSrc=null}static get defaultImageSrc(){return"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 44 44'%3E%3Cpath fill='%23fff' d='m29.3 14 14-14H32.1l-14 14h11.2Zm2.7 9.9 12-12V.7L30.62 14.1A2 2 0 0 1 32 16v7.9ZM13.31 44h11.18L44 24.5V13.3l-12 12V28a2 2 0 0 1-2 2h-2.69l-14 14Zm-1.41 0H.7l14-14h11.2l-14 14Zm14 0h11.2l6.9-6.9V25.9L25.9 44Zm12.6 0H44v-5.5L38.5 44Z'/%3E%3Cpath fill='%23fff' d='M30 28H14v-6h16v6Zm0-10v-2H14v2h16ZM0 43.3l13.4-13.4A2 2 0 0 1 12 28v-7.9L0 32.12V43.3Z'/%3E%3Cpath fill='%23fff' d='M16.7 14H14c-1.11 0-1.99.89-1.99 2v2.7L0 30.7V19.52L19.52 0H30.7l-14 14Zm1.4-14H6.92L0 6.92V18.1L18.1 0ZM5.5 0H0v5.5L5.5 0Z'/%3E%3C/svg%3E"}static get properties(){return e(e({},super.properties),{},{getImageSrc:{attribute:!1}})}renderBody(){var e,r;const s=o.defaultImageSrc,d=this.data;return t(a||(a=i` <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" data-testid="title"> ${0}&ZeroWidthSpace; </figcaption> </figure> `),null!==(r=d?null===(e=this.getImageSrc)||void 0===e?void 0:e.call(this,d.type):null)&&void 0!==r?r:s,this.t("image_alt"),(e=>e.currentTarget.src=s),null==d?void 0:d.helper.name)}}customElements.define("foxy-payments-api-payment-method-card",o);export{o as PaymentsApiPaymentMethodCard};
@@ -1 +1 @@
1
- import"./shared-24998349.js";import"./shared-af39ffd8.js";import"./shared-438e41ab.js";import"./shared-c4df3a2a.js";import"./shared-a1f181bf.js";import"./shared-9b599205.js";import"./shared-b56949d3.js";import{I as e}from"./shared-e6559d84.js";import"./foxy-nucleon-element.js";import"./foxy-spinner.js";import"./shared-64210e53.js";import{_ as t,B as r,l as i}from"./shared-7fec42f2.js";import{g as s}from"./shared-bab2ea2c.js";import{a as n}from"./shared-387d7254.js";import{i as o}from"./shared-53e42a77.js";import{h as a,s as l}from"./shared-ba5c42c7.js";import{c}from"./shared-4e709717.js";import{h as u}from"./shared-5905fca4.js";import{s as h}from"./shared-1da47f50.js";import"./shared-a6cf5b1f.js";import"./shared-3bc9eaf7.js";import"./shared-46efbc40.js";import"./shared-1d03ea56.js";import"./shared-db758d3b.js";import"./shared-ac44a3a5.js";import"./shared-dc357e9d.js";import"./shared-ab9dfa48.js";import"./shared-6c2a7d2f.js";import"./shared-5212ef4f.js";import"./shared-c782b9fa.js";import"./shared-0ea750af.js";import"./shared-da95bb48.js";import"./shared-65b2760f.js";import"./shared-cd96ff03.js";import"./shared-37869bac.js";import"./shared-d6a0954b.js";import"./shared-e1e4d8f5.js";import"./shared-1d6ed748.js";import"./shared-c1b71162.js";import"./shared-3db3f3c3.js";import"./shared-ed24a3f9.js";import"./shared-1abfcf87.js";import"./shared-d35ed355.js";import"./shared-c3d1d247.js";import"./shared-5574ea83.js";import"./shared-d0aed1c1.js";import"./shared-25a9d87d.js";import"./shared-e275989e.js";import"./foxy-copy-to-clipboard.js";import"./shared-a1cfe9d5.js";function d(e){return Array.isArray?Array.isArray(e):"[object Array]"===A(e)}const f=1/0;function p(e){return null==e?"":function(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-f?"-0":t}(e)}function m(e){return"string"==typeof e}function g(e){return"number"==typeof e}function _(e){return!0===e||!1===e||function(e){return y(e)&&null!==e}(e)&&"[object Boolean]"==A(e)}function y(e){return"object"==typeof e}function v(e){return null!=e}function x(e){return!e.trim().length}function A(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const $=e=>`Missing ${e} property in key`,C=e=>`Property 'weight' in key '${e}' must be a positive integer`,b=Object.prototype.hasOwnProperty;class M{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((e=>{let r=B(e);this._keys.push(r),this._keyMap[r.id]=r,t+=r.weight})),this._keys.forEach((e=>{e.weight/=t}))}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function B(e){let t=null,r=null,i=null,s=1,n=null;if(m(e)||d(e))i=e,t=D(e),r=E(e);else{if(!b.call(e,"name"))throw new Error($("name"));const o=e.name;if(i=o,b.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(C(o));t=D(o),r=E(o),n=e.getFn}return{path:t,id:r,weight:s,src:i,getFn:n}}function D(e){return d(e)?e:e.split(".")}function E(e){return d(e)?e.join("."):e}var F={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,...{useExtendedSearch:!1,getFn:function(e,t){let r=[],i=!1;const s=(e,t,n)=>{if(v(e))if(t[n]){const o=e[t[n]];if(!v(o))return;if(n===t.length-1&&(m(o)||g(o)||_(o)))r.push(p(o));else if(d(o)){i=!0;for(let e=0,r=o.length;e<r;e+=1)s(o[e],t,n+1)}else t.length&&s(o,t,n+1)}else r.push(e)};return s(e,m(t)?t.split("."):t,0),i?r:r[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}};const L=/[^ ]+/g;class k{constructor({getFn:e=F.getFn,fieldNormWeight:t=F.fieldNormWeight}={}){this.norm=function(e=1,t=3){const r=new Map,i=Math.pow(10,t);return{get(t){const s=t.match(L).length;if(r.has(s))return r.get(s);const n=1/Math.pow(s,.5*e),o=parseFloat(Math.round(n*i)/i);return r.set(s,o),o},clear(){r.clear()}}}(t,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach(((e,t)=>{this._keysMap[e.id]=t}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,m(this.docs[0])?this.docs.forEach(((e,t)=>{this._addString(e,t)})):this.docs.forEach(((e,t)=>{this._addObject(e,t)})),this.norm.clear())}add(e){const t=this.size();m(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,r=this.size();t<r;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!v(e)||x(e))return;let r={v:e,i:t,n:this.norm.get(e)};this.records.push(r)}_addObject(e,t){let r={i:t,$:{}};this.keys.forEach(((t,i)=>{let s=t.getFn?t.getFn(e):this.getFn(e,t.path);if(v(s))if(d(s)){let e=[];const t=[{nestedArrIndex:-1,value:s}];for(;t.length;){const{nestedArrIndex:r,value:i}=t.pop();if(v(i))if(m(i)&&!x(i)){let t={v:i,i:r,n:this.norm.get(i)};e.push(t)}else d(i)&&i.forEach(((e,r)=>{t.push({nestedArrIndex:r,value:e})}))}r.$[i]=e}else if(m(s)&&!x(s)){let e={v:s,n:this.norm.get(s)};r.$[i]=e}})),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}}function S(e,t,{getFn:r=F.getFn,fieldNormWeight:i=F.fieldNormWeight}={}){const s=new k({getFn:r,fieldNormWeight:i});return s.setKeys(e.map(B)),s.setSources(t),s.create(),s}function w(e,{errors:t=0,currentLocation:r=0,expectedLocation:i=0,distance:s=F.distance,ignoreLocation:n=F.ignoreLocation}={}){const o=t/e.length;if(n)return o;const a=Math.abs(i-r);return s?o+a/s:a?1:o}const j=32;function I(e,t,r,{location:i=F.location,distance:s=F.distance,threshold:n=F.threshold,findAllMatches:o=F.findAllMatches,minMatchCharLength:a=F.minMatchCharLength,includeMatches:l=F.includeMatches,ignoreLocation:c=F.ignoreLocation}={}){if(t.length>j)throw new Error(`Pattern length exceeds max of ${j}.`);const u=t.length,h=e.length,d=Math.max(0,Math.min(i,h));let f=n,p=d;const m=a>1||l,g=m?Array(h):[];let _;for(;(_=e.indexOf(t,p))>-1;){let e=w(t,{currentLocation:_,expectedLocation:d,distance:s,ignoreLocation:c});if(f=Math.min(e,f),p=_+u,m){let e=0;for(;e<u;)g[_+e]=1,e+=1}}p=-1;let y=[],v=1,x=u+h;const A=1<<u-1;for(let i=0;i<u;i+=1){let n=0,a=x;for(;n<a;){w(t,{errors:i,currentLocation:d+a,expectedLocation:d,distance:s,ignoreLocation:c})<=f?n=a:x=a,a=Math.floor((x-n)/2+n)}x=a;let l=Math.max(1,d-a+1),_=o?h:Math.min(d+a,h)+u,$=Array(_+2);$[_+1]=(1<<i)-1;for(let n=_;n>=l;n-=1){let o=n-1,a=r[e.charAt(o)];if(m&&(g[o]=+!!a),$[n]=($[n+1]<<1|1)&a,i&&($[n]|=(y[n+1]|y[n])<<1|1|y[n+1]),$[n]&A&&(v=w(t,{errors:i,currentLocation:o,expectedLocation:d,distance:s,ignoreLocation:c}),v<=f)){if(f=v,p=o,p<=d)break;l=Math.max(1,2*d-p)}}if(w(t,{errors:i+1,currentLocation:d,expectedLocation:d,distance:s,ignoreLocation:c})>f)break;y=$}const $={isMatch:p>=0,score:Math.max(.001,v)};if(m){const e=function(e=[],t=F.minMatchCharLength){let r=[],i=-1,s=-1,n=0;for(let o=e.length;n<o;n+=1){let o=e[n];o&&-1===i?i=n:o||-1===i||(s=n-1,s-i+1>=t&&r.push([i,s]),i=-1)}return e[n-1]&&n-i>=t&&r.push([i,n-1]),r}(g,a);e.length?l&&($.indices=e):$.isMatch=!1}return $}function P(e){let t={};for(let r=0,i=e.length;r<i;r+=1){const s=e.charAt(r);t[s]=(t[s]||0)|1<<i-r-1}return t}const V=String.prototype.normalize?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e;class R{constructor(e,{location:t=F.location,threshold:r=F.threshold,distance:i=F.distance,includeMatches:s=F.includeMatches,findAllMatches:n=F.findAllMatches,minMatchCharLength:o=F.minMatchCharLength,isCaseSensitive:a=F.isCaseSensitive,ignoreDiacritics:l=F.ignoreDiacritics,ignoreLocation:c=F.ignoreLocation}={}){if(this.options={location:t,threshold:r,distance:i,includeMatches:s,findAllMatches:n,minMatchCharLength:o,isCaseSensitive:a,ignoreDiacritics:l,ignoreLocation:c},e=a?e:e.toLowerCase(),e=l?V(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const u=(e,t)=>{this.chunks.push({pattern:e,alphabet:P(e),startIndex:t})},h=this.pattern.length;if(h>j){let e=0;const t=h%j,r=h-t;for(;e<r;)u(this.pattern.substr(e,j),e),e+=j;if(t){const e=h-j;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,ignoreDiacritics:r,includeMatches:i}=this.options;if(e=t?e:e.toLowerCase(),e=r?V(e):e,this.pattern===e){let t={isMatch:!0,score:0};return i&&(t.indices=[[0,e.length-1]]),t}const{location:s,distance:n,threshold:o,findAllMatches:a,minMatchCharLength:l,ignoreLocation:c}=this.options;let u=[],h=0,d=!1;this.chunks.forEach((({pattern:t,alphabet:r,startIndex:f})=>{const{isMatch:p,score:m,indices:g}=I(e,t,r,{location:s+f,distance:n,threshold:o,findAllMatches:a,minMatchCharLength:l,includeMatches:i,ignoreLocation:c});p&&(d=!0),h+=m,p&&g&&(u=[...u,...g])}));let f={isMatch:d,score:d?h/this.chunks.length:1};return d&&i&&(f.indices=u),f}}class O{constructor(e){this.pattern=e}static isMultiMatch(e){return N(e,this.multiRegex)}static isSingleMatch(e){return N(e,this.singleRegex)}search(){}}function N(e,t){const r=e.match(t);return r?r[1]:null}class W extends O{constructor(e,{location:t=F.location,threshold:r=F.threshold,distance:i=F.distance,includeMatches:s=F.includeMatches,findAllMatches:n=F.findAllMatches,minMatchCharLength:o=F.minMatchCharLength,isCaseSensitive:a=F.isCaseSensitive,ignoreDiacritics:l=F.ignoreDiacritics,ignoreLocation:c=F.ignoreLocation}={}){super(e),this._bitapSearch=new R(e,{location:t,threshold:r,distance:i,includeMatches:s,findAllMatches:n,minMatchCharLength:o,isCaseSensitive:a,ignoreDiacritics:l,ignoreLocation:c})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class q extends O{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,r=0;const i=[],s=this.pattern.length;for(;(t=e.indexOf(this.pattern,r))>-1;)r=t+s,i.push([t,r-1]);const n=!!i.length;return{isMatch:n,score:n?0:1,indices:i}}}const z=[class extends O{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},q,class extends O{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},W],Z=z.length,H=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const T=new Set([W.type,q.type]);class J{constructor(e,{isCaseSensitive:t=F.isCaseSensitive,ignoreDiacritics:r=F.ignoreDiacritics,includeMatches:i=F.includeMatches,minMatchCharLength:s=F.minMatchCharLength,ignoreLocation:n=F.ignoreLocation,findAllMatches:o=F.findAllMatches,location:a=F.location,threshold:l=F.threshold,distance:c=F.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:r,includeMatches:i,minMatchCharLength:s,findAllMatches:o,ignoreLocation:n,location:a,threshold:l,distance:c},e=t?e:e.toLowerCase(),e=r?V(e):e,this.pattern=e,this.query=function(e,t={}){return e.split("|").map((e=>{let r=e.trim().split(H).filter((e=>e&&!!e.trim())),i=[];for(let e=0,s=r.length;e<s;e+=1){const s=r[e];let n=!1,o=-1;for(;!n&&++o<Z;){const e=z[o];let r=e.isMultiMatch(s);r&&(i.push(new e(r,t)),n=!0)}if(!n)for(o=-1;++o<Z;){const e=z[o];let r=e.isSingleMatch(s);if(r){i.push(new e(r,t));break}}}return i}))}(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){const t=this.query;if(!t)return{isMatch:!1,score:1};const{includeMatches:r,isCaseSensitive:i,ignoreDiacritics:s}=this.options;e=i?e:e.toLowerCase(),e=s?V(e):e;let n=0,o=[],a=0;for(let i=0,s=t.length;i<s;i+=1){const s=t[i];o.length=0,n=0;for(let t=0,i=s.length;t<i;t+=1){const i=s[t],{isMatch:l,indices:c,score:u}=i.search(e);if(!l){a=0,n=0,o.length=0;break}if(n+=1,a+=u,r){const e=i.constructor.type;T.has(e)?o=[...o,...c]:o.push(c)}}if(n){let e={isMatch:!0,score:a/n};return r&&(e.indices=o),e}}return{isMatch:!1,score:1}}}const K=[];function U(e,t){for(let r=0,i=K.length;r<i;r+=1){let i=K[r];if(i.condition(e,t))return new i(e,t)}return new R(e,t)}const G="$and",Q="$or",X="$path",Y="$val",ee=e=>!(!e[G]&&!e[Q]),te=e=>({[G]:Object.keys(e).map((t=>({[t]:e[t]})))});function re(e,t,{auto:r=!0}={}){const i=e=>{let s=Object.keys(e);const n=(e=>!!e[X])(e);if(!n&&s.length>1&&!ee(e))return i(te(e));if((e=>!d(e)&&y(e)&&!ee(e))(e)){const i=n?e[X]:s[0],o=n?e[Y]:e[i];if(!m(o))throw new Error((e=>`Invalid value for key ${e}`)(i));const a={keyId:E(i),pattern:o};return r&&(a.searcher=U(o,t)),a}let o={children:[],operator:s[0]};return s.forEach((t=>{const r=e[t];d(r)&&r.forEach((e=>{o.children.push(i(e))}))})),o};return ee(e)||(e=te(e)),i(e)}function ie(e,t){const r=e.matches;t.matches=[],v(r)&&r.forEach((e=>{if(!v(e.indices)||!e.indices.length)return;const{indices:r,value:i}=e;let s={indices:r,value:i};e.key&&(s.key=e.key.src),e.idx>-1&&(s.refIndex=e.idx),t.matches.push(s)}))}function se(e,t){t.score=e.score}class ne{constructor(e,t={},r){this.options={...F,...t},this.options.useExtendedSearch,this._keyStore=new M(this.options.keys),this.setCollection(e,r)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof k))throw new Error("Incorrect 'index' type");this._myIndex=t||S(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){v(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=(()=>!1)){const t=[];for(let r=0,i=this._docs.length;r<i;r+=1){const s=this._docs[r];e(s,r)&&(this.removeAt(r),r-=1,i-=1,t.push(s))}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){const{includeMatches:r,includeScore:i,shouldSort:s,sortFn:n,ignoreFieldNorm:o}=this.options;let a=m(e)?m(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return function(e,{ignoreFieldNorm:t=F.ignoreFieldNorm}){e.forEach((e=>{let r=1;e.matches.forEach((({key:e,norm:i,score:s})=>{const n=e?e.weight:null;r*=Math.pow(0===s&&n?Number.EPSILON:s,(n||1)*(t?1:i))})),e.score=r}))}(a,{ignoreFieldNorm:o}),s&&a.sort(n),g(t)&&t>-1&&(a=a.slice(0,t)),function(e,t,{includeMatches:r=F.includeMatches,includeScore:i=F.includeScore}={}){const s=[];return r&&s.push(ie),i&&s.push(se),e.map((e=>{const{idx:r}=e,i={item:t[r],refIndex:r};return s.length&&s.forEach((t=>{t(e,i)})),i}))}(a,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e){const t=U(e,this.options),{records:r}=this._myIndex,i=[];return r.forEach((({v:e,i:r,n:s})=>{if(!v(e))return;const{isMatch:n,score:o,indices:a}=t.searchIn(e);n&&i.push({item:e,idx:r,matches:[{score:o,value:e,norm:s,indices:a}]})})),i}_searchLogical(e){const t=re(e,this.options),r=(e,t,i)=>{if(!e.children){const{keyId:r,searcher:s}=e,n=this._findMatches({key:this._keyStore.get(r),value:this._myIndex.getValueForItemAtKeyId(t,r),searcher:s});return n&&n.length?[{idx:i,item:t,matches:n}]:[]}const s=[];for(let n=0,o=e.children.length;n<o;n+=1){const o=e.children[n],a=r(o,t,i);if(a.length)s.push(...a);else if(e.operator===G)return[]}return s},i=this._myIndex.records,s={},n=[];return i.forEach((({$:e,i:i})=>{if(v(e)){let o=r(t,e,i);o.length&&(s[i]||(s[i]={idx:i,item:e,matches:[]},n.push(s[i])),o.forEach((({matches:e})=>{s[i].matches.push(...e)})))}})),n}_searchObjectList(e){const t=U(e,this.options),{keys:r,records:i}=this._myIndex,s=[];return i.forEach((({$:e,i:i})=>{if(!v(e))return;let n=[];r.forEach(((r,i)=>{n.push(...this._findMatches({key:r,value:e[i],searcher:t}))})),n.length&&s.push({idx:i,item:e,matches:n})})),s}_findMatches({key:e,value:t,searcher:r}){if(!v(t))return[];let i=[];if(d(t))t.forEach((({v:t,i:s,n:n})=>{if(!v(t))return;const{isMatch:o,score:a,indices:l}=r.searchIn(t);o&&i.push({score:a,key:e,value:t,idx:s,norm:n,indices:l})}));else{const{v:s,n:n}=t,{isMatch:o,score:a,indices:l}=r.searchIn(s);o&&i.push({score:a,key:e,value:s,norm:n,indices:l})}return i}}ne.version="7.1.0",ne.createIndex=S,ne.parseIndex=function(e,{getFn:t=F.getFn,fieldNormWeight:r=F.fieldNormWeight}={}){const{keys:i,records:s}=e,n=new k({getFn:t,fieldNormWeight:r});return n.setKeys(i),n.setIndexRecords(s),n},ne.config=F,ne.parseQuery=re,function(...e){K.push(...e)}(J);let oe,ae,le,ce,ue,he,de,fe,pe,me,ge,_e,ye,ve,xe,Ae,$e,Ce,be,Me,Be,De,Ee,Fe,Le,ke,Se,we,je,Ie,Pe,Ve=e=>e;const Re=n(e,"payments-api-payment-method-form");class Oe extends Re{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"}],this.__cardVerificationOptions=[{label:"option_disabled",value:"disabled"},{label:"option_enabled_automatically",value:"enabled_automatically"},{label:"option_enabled_override",value:"enabled_override"}],this.__search=""}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:{},__search:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",e=>{var t,r,i,s;const n=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 o;try{o=JSON.parse(null!==(s=e.additional_fields)&&void 0!==s?s:"{}")}catch(e){o={}}for(const e of n)for(const t of e.fields)if("optional"in t&&!t.optional&&!u(o,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 a(oe||(oe=Ve` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?a(ae||(ae=Ve``)):a(le||(le=Ve` <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=s(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=s(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=a(ce||(ce=Ve` <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> `),o(null==t?void 0:t._links["fx:available_payment_methods"].href),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),o(this.store),this.__storeLoaderId,(()=>this.requestUpdate()),o(this.paymentPreset),this.__paymentPresetLoaderId,(()=>this.requestUpdate()));return a(ue||(ue=Ve`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderPaymentMethodConfig():this.__renderPaymentMethodSelector(),r)}get __groupedAvailablePaymentMethods(){var e;const t=Object.entries(null!==(e=this.__availablePaymentMethods)&&void 0!==e?e:{});return(this.__search?new ne(t,{keys:["1.name"]}).search(this.__search).map((e=>e.item)):t).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(),s=!/\w/.test(i)?"#":i,n=e.find((e=>e.name===s));return n?n.items.push({type:t,helper:r}):e.push({name:s,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)?a(de||(de=Ve` <div> <input placeholder="${0}" class="w-full leading-m font-medium bg-contrast-5 rounded text-body transition-colors hover-bg-contrast-10 focus-bg-contrast-10 focus-outline-none focus-ring-2 focus-ring-primary-50" style="padding:var(--lumo-space-xs) calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" type="search" .value="${0}" @input="${0}"> <section data-testid="select-method-list"> ${0} </section> </div> `),this.t("search_placeholder"),this.__search,(e=>{this.__search=e.currentTarget.value}),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>a(fe||(fe=Ve` <p class="font-medium text-tertiary py-m">${0}</p> <foxy-internal-summary-control infer="" label="" helper-text=""> ${0} </foxy-internal-summary-control> `),e,t.map(((e,r)=>this.__renderPaymentMethodButton(e,r,t.length))))))):a(he||(he=Ve` <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)?a(pe||(pe=Ve` <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> `),l(me||(me=Ve`<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>`))):a(ge||(ge=Ve` <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)?a(_e||(_e=Ve` <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)?a(ye||(ye=Ve` <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?a(ve||(ve=Ve` <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,s,n,c,u,h,d,f,p,m,g,_,y,v;const x=0===t?"":`${e}_`,A=0===t?"":`${e}-`,$=0===t?this.__liveBlocks:this.__testBlocks,C=`${e}-group`;if("live"===e&&!(null===(r=this.__storeLoader)||void 0===r?void 0:r.data))return a(xe||(xe=Ve``));if("live"===e&&!(null===(s=null===(i=this.__storeLoader)||void 0===i?void 0:i.data)||void 0===s?void 0:s.is_active))return a(Ae||(Ae=Ve` <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,l($e||($e=Ve`<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 b=!0===(null===(c=null===(n=this.__storeLoader)||void 0===n?void 0:n.data)||void 0===c?void 0:c.is_active)&&("test"===e&&!0===(null===(h=null===(u=this.__paymentPresetLoader)||void 0===u?void 0:u.data)||void 0===h?void 0:h.is_live)||"live"===e&&!1===(null===(f=null===(d=this.__paymentPresetLoader)||void 0===d?void 0:d.data)||void 0===f?void 0:f.is_live));return a(Ce||(Ce=Ve` <foxy-internal-summary-control helper-text="${0}" layout="section" label="${0}" infer="${0}"> <foxy-internal-summary-control infer="" label="" helper-text=""> ${0} ${0} ${0} ${0} ${0} </foxy-internal-summary-control> ${0} </foxy-internal-summary-control> `),o(b?this.t(`${C}.helper_text_inactive`):void 0),o(b?this.t(`${C}.label_inactive`):void 0),C,(null===(p=this.form.helper)||void 0===p?void 0:p.id_description)?a(be||(be=Ve` <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,A):"",(null===(m=this.form.helper)||void 0===m?void 0:m.third_party_key_description)?a(Me||(Me=Ve` <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,A):"",(null===(g=this.form.helper)||void 0===g?void 0:g.key_description)?a(Be||(Be=Ve` <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,A):"",$.map((e=>this.__renderBlock(e))),(null===(_=this.form.helper)||void 0===_?void 0:_.supports_card_verification)?a(De||(De=Ve` <foxy-internal-select-control helper-text="${0}" layout="summary-item" infer="${0}card-verification" .options="${0}" .getValue="${0}"> </foxy-internal-select-control> `),this.t(`${C}.${A}card-verification.helper_text_${this.form[`${x}card_verification`]||"disabled"}`),A,this.__cardVerificationOptions,(()=>this.form[`${x}card_verification`]||"disabled")):"",(null===(y=this.form.helper)||void 0===y?void 0:y.supports_card_verification)&&(null===(v=this.form[`${x}card_verification`])||void 0===v?void 0:v.startsWith("enabled_"))?a(Ee||(Ee=Ve` <foxy-internal-summary-control layout="details" class="mt-s" infer="${0}card-verification-config"> ${0} </foxy-internal-summary-control> `),A,["visa","mastercard","american-express","discover","default"].map((e=>{var t;return a(Fe||(Fe=Ve` <foxy-internal-number-control json-template="${0}" json-path="verification_amounts.${0}" property="${0}card_verification_config" layout="summary-item" suffix="¤" infer="${0}card-verification-config-verification-amounts-${0}" step="0.01" min="0"> </foxy-internal-number-control> `),o(null===(t=this.form.helper)||void 0===t?void 0:t.card_verification_config),e.replace(/-/g,"_"),x,A,e)}))):"")})),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t},r,i){var s,n;const o=Oe.defaultImageSrc,l=null!==(n=null===(s=this.getImageSrc)||void 0===s?void 0:s.call(this,e))&&void 0!==n?n:o;return a(Le||(Le=Ve` <button class="${0}" ?disabled="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" @click="${0}"> <figure class="relative flex items-center" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <span class="font-medium">${0}&ZeroWidthSpace;</span> ${0} </figcaption> </figure> </button> `),c({"relative w-full block text-left bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-inset focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict,"rounded-t":0===r,"rounded-b":r===i-1}),!!t.conflict,(()=>this.edit({type:e,helper:t})),c({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),l,(e=>e.currentTarget.src=o),c({"min-w-0 flex-1 grid leading-xs":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?a(ke||(ke=Ve`<span class="text-xs"> ${0}</span>`),this.t("conflict_message",t.conflict)):"")}__renderBlock(e){return a(Se||(Se=Ve`${0}`),e.fields.map((e=>{var t,r,s;if("hidden"===e.type)return;const n=["additional-fields",e.id].join("-").replace(/_/g,"-"),o=()=>{var t,r;try{const s=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");return null!==(r=i(s,e.id))&&void 0!==r?r:s.default_value}catch(t){return e.default_value}},l=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))})},c=e.options;return a(we||(we=Ve` ${0} `),"checkbox"===e.type?a(je||(je=Ve` <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,n,o,l):"select"===e.type?a(Ie||(Ie=Ve` <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,n,c.map((({name:e,value:t})=>({label:e,value:t}))),o,l):a(Pe||(Pe=Ve` <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!==(s=e.description)&&void 0!==s?s:"",e.default_value||this.t("default_additional_field_placeholder"),e.name,n,o,l))})))}}customElements.define("foxy-payments-api-payment-method-form",Oe);export{Oe as PaymentsApiPaymentMethodForm};
1
+ import"./shared-24998349.js";import"./shared-af39ffd8.js";import"./shared-438e41ab.js";import"./shared-c4df3a2a.js";import"./shared-a1f181bf.js";import"./shared-9b599205.js";import"./shared-b56949d3.js";import{I as e}from"./shared-e6559d84.js";import"./foxy-nucleon-element.js";import"./foxy-spinner.js";import"./shared-64210e53.js";import{_ as t,B as r,l as i}from"./shared-7fec42f2.js";import{g as s}from"./shared-bab2ea2c.js";import{a as n}from"./shared-387d7254.js";import{i as o}from"./shared-53e42a77.js";import{h as a,s as l}from"./shared-ba5c42c7.js";import{c}from"./shared-4e709717.js";import{h as u}from"./shared-5905fca4.js";import{s as h}from"./shared-1da47f50.js";import"./shared-a6cf5b1f.js";import"./shared-3bc9eaf7.js";import"./shared-46efbc40.js";import"./shared-1d03ea56.js";import"./shared-db758d3b.js";import"./shared-ac44a3a5.js";import"./shared-dc357e9d.js";import"./shared-ab9dfa48.js";import"./shared-6c2a7d2f.js";import"./shared-5212ef4f.js";import"./shared-c782b9fa.js";import"./shared-0ea750af.js";import"./shared-da95bb48.js";import"./shared-65b2760f.js";import"./shared-cd96ff03.js";import"./shared-37869bac.js";import"./shared-d6a0954b.js";import"./shared-e1e4d8f5.js";import"./shared-1d6ed748.js";import"./shared-c1b71162.js";import"./shared-3db3f3c3.js";import"./shared-ed24a3f9.js";import"./shared-1abfcf87.js";import"./shared-d35ed355.js";import"./shared-c3d1d247.js";import"./shared-5574ea83.js";import"./shared-d0aed1c1.js";import"./shared-25a9d87d.js";import"./shared-e275989e.js";import"./foxy-copy-to-clipboard.js";import"./shared-a1cfe9d5.js";function d(e){return Array.isArray?Array.isArray(e):"[object Array]"===A(e)}const f=1/0;function p(e){return null==e?"":function(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-f?"-0":t}(e)}function m(e){return"string"==typeof e}function g(e){return"number"==typeof e}function _(e){return!0===e||!1===e||function(e){return y(e)&&null!==e}(e)&&"[object Boolean]"==A(e)}function y(e){return"object"==typeof e}function v(e){return null!=e}function x(e){return!e.trim().length}function A(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}const $=e=>`Missing ${e} property in key`,C=e=>`Property 'weight' in key '${e}' must be a positive integer`,b=Object.prototype.hasOwnProperty;class M{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((e=>{let r=B(e);this._keys.push(r),this._keyMap[r.id]=r,t+=r.weight})),this._keys.forEach((e=>{e.weight/=t}))}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function B(e){let t=null,r=null,i=null,s=1,n=null;if(m(e)||d(e))i=e,t=D(e),r=E(e);else{if(!b.call(e,"name"))throw new Error($("name"));const o=e.name;if(i=o,b.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(C(o));t=D(o),r=E(o),n=e.getFn}return{path:t,id:r,weight:s,src:i,getFn:n}}function D(e){return d(e)?e:e.split(".")}function E(e){return d(e)?e.join("."):e}var F={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,...{useExtendedSearch:!1,getFn:function(e,t){let r=[],i=!1;const s=(e,t,n)=>{if(v(e))if(t[n]){const o=e[t[n]];if(!v(o))return;if(n===t.length-1&&(m(o)||g(o)||_(o)))r.push(p(o));else if(d(o)){i=!0;for(let e=0,r=o.length;e<r;e+=1)s(o[e],t,n+1)}else t.length&&s(o,t,n+1)}else r.push(e)};return s(e,m(t)?t.split("."):t,0),i?r:r[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}};const L=/[^ ]+/g;class k{constructor({getFn:e=F.getFn,fieldNormWeight:t=F.fieldNormWeight}={}){this.norm=function(e=1,t=3){const r=new Map,i=Math.pow(10,t);return{get(t){const s=t.match(L).length;if(r.has(s))return r.get(s);const n=1/Math.pow(s,.5*e),o=parseFloat(Math.round(n*i)/i);return r.set(s,o),o},clear(){r.clear()}}}(t,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach(((e,t)=>{this._keysMap[e.id]=t}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,m(this.docs[0])?this.docs.forEach(((e,t)=>{this._addString(e,t)})):this.docs.forEach(((e,t)=>{this._addObject(e,t)})),this.norm.clear())}add(e){const t=this.size();m(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,r=this.size();t<r;t+=1)this.records[t].i-=1}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_addString(e,t){if(!v(e)||x(e))return;let r={v:e,i:t,n:this.norm.get(e)};this.records.push(r)}_addObject(e,t){let r={i:t,$:{}};this.keys.forEach(((t,i)=>{let s=t.getFn?t.getFn(e):this.getFn(e,t.path);if(v(s))if(d(s)){let e=[];const t=[{nestedArrIndex:-1,value:s}];for(;t.length;){const{nestedArrIndex:r,value:i}=t.pop();if(v(i))if(m(i)&&!x(i)){let t={v:i,i:r,n:this.norm.get(i)};e.push(t)}else d(i)&&i.forEach(((e,r)=>{t.push({nestedArrIndex:r,value:e})}))}r.$[i]=e}else if(m(s)&&!x(s)){let e={v:s,n:this.norm.get(s)};r.$[i]=e}})),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}}function S(e,t,{getFn:r=F.getFn,fieldNormWeight:i=F.fieldNormWeight}={}){const s=new k({getFn:r,fieldNormWeight:i});return s.setKeys(e.map(B)),s.setSources(t),s.create(),s}function w(e,{errors:t=0,currentLocation:r=0,expectedLocation:i=0,distance:s=F.distance,ignoreLocation:n=F.ignoreLocation}={}){const o=t/e.length;if(n)return o;const a=Math.abs(i-r);return s?o+a/s:a?1:o}const j=32;function I(e,t,r,{location:i=F.location,distance:s=F.distance,threshold:n=F.threshold,findAllMatches:o=F.findAllMatches,minMatchCharLength:a=F.minMatchCharLength,includeMatches:l=F.includeMatches,ignoreLocation:c=F.ignoreLocation}={}){if(t.length>j)throw new Error(`Pattern length exceeds max of ${j}.`);const u=t.length,h=e.length,d=Math.max(0,Math.min(i,h));let f=n,p=d;const m=a>1||l,g=m?Array(h):[];let _;for(;(_=e.indexOf(t,p))>-1;){let e=w(t,{currentLocation:_,expectedLocation:d,distance:s,ignoreLocation:c});if(f=Math.min(e,f),p=_+u,m){let e=0;for(;e<u;)g[_+e]=1,e+=1}}p=-1;let y=[],v=1,x=u+h;const A=1<<u-1;for(let i=0;i<u;i+=1){let n=0,a=x;for(;n<a;){w(t,{errors:i,currentLocation:d+a,expectedLocation:d,distance:s,ignoreLocation:c})<=f?n=a:x=a,a=Math.floor((x-n)/2+n)}x=a;let l=Math.max(1,d-a+1),_=o?h:Math.min(d+a,h)+u,$=Array(_+2);$[_+1]=(1<<i)-1;for(let n=_;n>=l;n-=1){let o=n-1,a=r[e.charAt(o)];if(m&&(g[o]=+!!a),$[n]=($[n+1]<<1|1)&a,i&&($[n]|=(y[n+1]|y[n])<<1|1|y[n+1]),$[n]&A&&(v=w(t,{errors:i,currentLocation:o,expectedLocation:d,distance:s,ignoreLocation:c}),v<=f)){if(f=v,p=o,p<=d)break;l=Math.max(1,2*d-p)}}if(w(t,{errors:i+1,currentLocation:d,expectedLocation:d,distance:s,ignoreLocation:c})>f)break;y=$}const $={isMatch:p>=0,score:Math.max(.001,v)};if(m){const e=function(e=[],t=F.minMatchCharLength){let r=[],i=-1,s=-1,n=0;for(let o=e.length;n<o;n+=1){let o=e[n];o&&-1===i?i=n:o||-1===i||(s=n-1,s-i+1>=t&&r.push([i,s]),i=-1)}return e[n-1]&&n-i>=t&&r.push([i,n-1]),r}(g,a);e.length?l&&($.indices=e):$.isMatch=!1}return $}function P(e){let t={};for(let r=0,i=e.length;r<i;r+=1){const s=e.charAt(r);t[s]=(t[s]||0)|1<<i-r-1}return t}const V=String.prototype.normalize?e=>e.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e;class R{constructor(e,{location:t=F.location,threshold:r=F.threshold,distance:i=F.distance,includeMatches:s=F.includeMatches,findAllMatches:n=F.findAllMatches,minMatchCharLength:o=F.minMatchCharLength,isCaseSensitive:a=F.isCaseSensitive,ignoreDiacritics:l=F.ignoreDiacritics,ignoreLocation:c=F.ignoreLocation}={}){if(this.options={location:t,threshold:r,distance:i,includeMatches:s,findAllMatches:n,minMatchCharLength:o,isCaseSensitive:a,ignoreDiacritics:l,ignoreLocation:c},e=a?e:e.toLowerCase(),e=l?V(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;const u=(e,t)=>{this.chunks.push({pattern:e,alphabet:P(e),startIndex:t})},h=this.pattern.length;if(h>j){let e=0;const t=h%j,r=h-t;for(;e<r;)u(this.pattern.substr(e,j),e),e+=j;if(t){const e=h-j;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){const{isCaseSensitive:t,ignoreDiacritics:r,includeMatches:i}=this.options;if(e=t?e:e.toLowerCase(),e=r?V(e):e,this.pattern===e){let t={isMatch:!0,score:0};return i&&(t.indices=[[0,e.length-1]]),t}const{location:s,distance:n,threshold:o,findAllMatches:a,minMatchCharLength:l,ignoreLocation:c}=this.options;let u=[],h=0,d=!1;this.chunks.forEach((({pattern:t,alphabet:r,startIndex:f})=>{const{isMatch:p,score:m,indices:g}=I(e,t,r,{location:s+f,distance:n,threshold:o,findAllMatches:a,minMatchCharLength:l,includeMatches:i,ignoreLocation:c});p&&(d=!0),h+=m,p&&g&&(u=[...u,...g])}));let f={isMatch:d,score:d?h/this.chunks.length:1};return d&&i&&(f.indices=u),f}}class O{constructor(e){this.pattern=e}static isMultiMatch(e){return N(e,this.multiRegex)}static isSingleMatch(e){return N(e,this.singleRegex)}search(){}}function N(e,t){const r=e.match(t);return r?r[1]:null}class W extends O{constructor(e,{location:t=F.location,threshold:r=F.threshold,distance:i=F.distance,includeMatches:s=F.includeMatches,findAllMatches:n=F.findAllMatches,minMatchCharLength:o=F.minMatchCharLength,isCaseSensitive:a=F.isCaseSensitive,ignoreDiacritics:l=F.ignoreDiacritics,ignoreLocation:c=F.ignoreLocation}={}){super(e),this._bitapSearch=new R(e,{location:t,threshold:r,distance:i,includeMatches:s,findAllMatches:n,minMatchCharLength:o,isCaseSensitive:a,ignoreDiacritics:l,ignoreLocation:c})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class q extends O{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,r=0;const i=[],s=this.pattern.length;for(;(t=e.indexOf(this.pattern,r))>-1;)r=t+s,i.push([t,r-1]);const n=!!i.length;return{isMatch:n,score:n?0:1,indices:i}}}const z=[class extends O{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},q,class extends O{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends O{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},W],Z=z.length,H=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const T=new Set([W.type,q.type]);class J{constructor(e,{isCaseSensitive:t=F.isCaseSensitive,ignoreDiacritics:r=F.ignoreDiacritics,includeMatches:i=F.includeMatches,minMatchCharLength:s=F.minMatchCharLength,ignoreLocation:n=F.ignoreLocation,findAllMatches:o=F.findAllMatches,location:a=F.location,threshold:l=F.threshold,distance:c=F.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:r,includeMatches:i,minMatchCharLength:s,findAllMatches:o,ignoreLocation:n,location:a,threshold:l,distance:c},e=t?e:e.toLowerCase(),e=r?V(e):e,this.pattern=e,this.query=function(e,t={}){return e.split("|").map((e=>{let r=e.trim().split(H).filter((e=>e&&!!e.trim())),i=[];for(let e=0,s=r.length;e<s;e+=1){const s=r[e];let n=!1,o=-1;for(;!n&&++o<Z;){const e=z[o];let r=e.isMultiMatch(s);r&&(i.push(new e(r,t)),n=!0)}if(!n)for(o=-1;++o<Z;){const e=z[o];let r=e.isSingleMatch(s);if(r){i.push(new e(r,t));break}}}return i}))}(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){const t=this.query;if(!t)return{isMatch:!1,score:1};const{includeMatches:r,isCaseSensitive:i,ignoreDiacritics:s}=this.options;e=i?e:e.toLowerCase(),e=s?V(e):e;let n=0,o=[],a=0;for(let i=0,s=t.length;i<s;i+=1){const s=t[i];o.length=0,n=0;for(let t=0,i=s.length;t<i;t+=1){const i=s[t],{isMatch:l,indices:c,score:u}=i.search(e);if(!l){a=0,n=0,o.length=0;break}if(n+=1,a+=u,r){const e=i.constructor.type;T.has(e)?o=[...o,...c]:o.push(c)}}if(n){let e={isMatch:!0,score:a/n};return r&&(e.indices=o),e}}return{isMatch:!1,score:1}}}const K=[];function U(e,t){for(let r=0,i=K.length;r<i;r+=1){let i=K[r];if(i.condition(e,t))return new i(e,t)}return new R(e,t)}const G="$and",Q="$or",X="$path",Y="$val",ee=e=>!(!e[G]&&!e[Q]),te=e=>({[G]:Object.keys(e).map((t=>({[t]:e[t]})))});function re(e,t,{auto:r=!0}={}){const i=e=>{let s=Object.keys(e);const n=(e=>!!e[X])(e);if(!n&&s.length>1&&!ee(e))return i(te(e));if((e=>!d(e)&&y(e)&&!ee(e))(e)){const i=n?e[X]:s[0],o=n?e[Y]:e[i];if(!m(o))throw new Error((e=>`Invalid value for key ${e}`)(i));const a={keyId:E(i),pattern:o};return r&&(a.searcher=U(o,t)),a}let o={children:[],operator:s[0]};return s.forEach((t=>{const r=e[t];d(r)&&r.forEach((e=>{o.children.push(i(e))}))})),o};return ee(e)||(e=te(e)),i(e)}function ie(e,t){const r=e.matches;t.matches=[],v(r)&&r.forEach((e=>{if(!v(e.indices)||!e.indices.length)return;const{indices:r,value:i}=e;let s={indices:r,value:i};e.key&&(s.key=e.key.src),e.idx>-1&&(s.refIndex=e.idx),t.matches.push(s)}))}function se(e,t){t.score=e.score}class ne{constructor(e,t={},r){this.options={...F,...t},this.options.useExtendedSearch,this._keyStore=new M(this.options.keys),this.setCollection(e,r)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof k))throw new Error("Incorrect 'index' type");this._myIndex=t||S(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){v(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=(()=>!1)){const t=[];for(let r=0,i=this._docs.length;r<i;r+=1){const s=this._docs[r];e(s,r)&&(this.removeAt(r),r-=1,i-=1,t.push(s))}return t}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:t=-1}={}){const{includeMatches:r,includeScore:i,shouldSort:s,sortFn:n,ignoreFieldNorm:o}=this.options;let a=m(e)?m(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return function(e,{ignoreFieldNorm:t=F.ignoreFieldNorm}){e.forEach((e=>{let r=1;e.matches.forEach((({key:e,norm:i,score:s})=>{const n=e?e.weight:null;r*=Math.pow(0===s&&n?Number.EPSILON:s,(n||1)*(t?1:i))})),e.score=r}))}(a,{ignoreFieldNorm:o}),s&&a.sort(n),g(t)&&t>-1&&(a=a.slice(0,t)),function(e,t,{includeMatches:r=F.includeMatches,includeScore:i=F.includeScore}={}){const s=[];return r&&s.push(ie),i&&s.push(se),e.map((e=>{const{idx:r}=e,i={item:t[r],refIndex:r};return s.length&&s.forEach((t=>{t(e,i)})),i}))}(a,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e){const t=U(e,this.options),{records:r}=this._myIndex,i=[];return r.forEach((({v:e,i:r,n:s})=>{if(!v(e))return;const{isMatch:n,score:o,indices:a}=t.searchIn(e);n&&i.push({item:e,idx:r,matches:[{score:o,value:e,norm:s,indices:a}]})})),i}_searchLogical(e){const t=re(e,this.options),r=(e,t,i)=>{if(!e.children){const{keyId:r,searcher:s}=e,n=this._findMatches({key:this._keyStore.get(r),value:this._myIndex.getValueForItemAtKeyId(t,r),searcher:s});return n&&n.length?[{idx:i,item:t,matches:n}]:[]}const s=[];for(let n=0,o=e.children.length;n<o;n+=1){const o=e.children[n],a=r(o,t,i);if(a.length)s.push(...a);else if(e.operator===G)return[]}return s},i=this._myIndex.records,s={},n=[];return i.forEach((({$:e,i:i})=>{if(v(e)){let o=r(t,e,i);o.length&&(s[i]||(s[i]={idx:i,item:e,matches:[]},n.push(s[i])),o.forEach((({matches:e})=>{s[i].matches.push(...e)})))}})),n}_searchObjectList(e){const t=U(e,this.options),{keys:r,records:i}=this._myIndex,s=[];return i.forEach((({$:e,i:i})=>{if(!v(e))return;let n=[];r.forEach(((r,i)=>{n.push(...this._findMatches({key:r,value:e[i],searcher:t}))})),n.length&&s.push({idx:i,item:e,matches:n})})),s}_findMatches({key:e,value:t,searcher:r}){if(!v(t))return[];let i=[];if(d(t))t.forEach((({v:t,i:s,n:n})=>{if(!v(t))return;const{isMatch:o,score:a,indices:l}=r.searchIn(t);o&&i.push({score:a,key:e,value:t,idx:s,norm:n,indices:l})}));else{const{v:s,n:n}=t,{isMatch:o,score:a,indices:l}=r.searchIn(s);o&&i.push({score:a,key:e,value:s,norm:n,indices:l})}return i}}ne.version="7.1.0",ne.createIndex=S,ne.parseIndex=function(e,{getFn:t=F.getFn,fieldNormWeight:r=F.fieldNormWeight}={}){const{keys:i,records:s}=e,n=new k({getFn:t,fieldNormWeight:r});return n.setKeys(i),n.setIndexRecords(s),n},ne.config=F,ne.parseQuery=re,function(...e){K.push(...e)}(J);let oe,ae,le,ce,ue,he,de,fe,pe,me,ge,_e,ye,ve,xe,Ae,$e,Ce,be,Me,Be,De,Ee,Fe,Le,ke,Se,we,je,Ie,Pe,Ve=e=>e;const Re=n(e,"payments-api-payment-method-form");class Oe extends Re{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"}],this.__cardVerificationOptions=[{label:"option_disabled",value:"disabled"},{label:"option_enabled_automatically",value:"enabled_automatically"},{label:"option_enabled_override",value:"enabled_override"}],this.__search=""}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:{},__search:{attribute:!1}})}static get v8n(){return[({description:e})=>!e||e.length<=100||"description:v8n_too_long",({type:e})=>!!e||"type:v8n_required",e=>{var t,r,i,s;const n=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 o;try{o=JSON.parse(null!==(s=e.additional_fields)&&void 0!==s?s:"{}")}catch(e){o={}}for(const e of n)for(const t of e.fields)if("optional"in t&&!t.optional&&!u(o,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 a(oe||(oe=Ve` <div> ${0} ${0} </div> `),super.renderHeader(...e),(null===(t=this.data)||void 0===t?void 0:t.type)||!this.form.type?a(ae||(ae=Ve``)):a(le||(le=Ve` <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=s(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=s(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=a(ce||(ce=Ve` <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> `),o(null==t?void 0:t._links["fx:available_payment_methods"].href),this.__availablePaymentMethodsLoaderId,(()=>this.requestUpdate()),o(this.store),this.__storeLoaderId,(()=>this.requestUpdate()),o(this.paymentPreset),this.__paymentPresetLoaderId,(()=>this.requestUpdate()));return a(ue||(ue=Ve`${0}${0}${0}`),this.renderHeader(),this.form.type?this.__renderPaymentMethodConfig():this.__renderPaymentMethodSelector(),r)}get __groupedAvailablePaymentMethods(){var e;const t=Object.entries(null!==(e=this.__availablePaymentMethods)&&void 0!==e?e:{});return(this.__search?new ne(t,{keys:["1.name"],threshold:.25}).search(this.__search).map((e=>e.item)):t).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(),s=!/\w/.test(i)?"#":i,n=e.find((e=>e.name===s));return n?n.items.push({type:t,helper:r}):e.push({name:s,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)?a(de||(de=Ve` <div> <input placeholder="${0}" class="w-full leading-m font-medium bg-contrast-5 rounded text-body transition-colors hover-bg-contrast-10 focus-bg-contrast-10 focus-outline-none focus-ring-2 focus-ring-primary-50" style="padding:var(--lumo-space-xs) calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" type="search" .value="${0}" @input="${0}"> <section data-testid="select-method-list"> ${0} </section> </div> `),this.t("search_placeholder"),this.__search,(e=>{this.__search=e.currentTarget.value}),this.__groupedAvailablePaymentMethods.map((({name:e,items:t})=>a(fe||(fe=Ve` <p class="font-medium text-tertiary py-m">${0}</p> <foxy-internal-summary-control infer="" label="" helper-text=""> ${0} </foxy-internal-summary-control> `),e,t.map(((e,r)=>this.__renderPaymentMethodButton(e,r,t.length))))))):a(he||(he=Ve` <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)?a(pe||(pe=Ve` <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> `),l(me||(me=Ve`<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>`))):a(ge||(ge=Ve` <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)?a(_e||(_e=Ve` <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)?a(ye||(ye=Ve` <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?a(ve||(ve=Ve` <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,s,n,c,u,h,d,f,p,m,g,_,y,v;const x=0===t?"":`${e}_`,A=0===t?"":`${e}-`,$=0===t?this.__liveBlocks:this.__testBlocks,C=`${e}-group`;if("live"===e&&!(null===(r=this.__storeLoader)||void 0===r?void 0:r.data))return a(xe||(xe=Ve``));if("live"===e&&!(null===(s=null===(i=this.__storeLoader)||void 0===i?void 0:i.data)||void 0===s?void 0:s.is_active))return a(Ae||(Ae=Ve` <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,l($e||($e=Ve`<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 b=!0===(null===(c=null===(n=this.__storeLoader)||void 0===n?void 0:n.data)||void 0===c?void 0:c.is_active)&&("test"===e&&!0===(null===(h=null===(u=this.__paymentPresetLoader)||void 0===u?void 0:u.data)||void 0===h?void 0:h.is_live)||"live"===e&&!1===(null===(f=null===(d=this.__paymentPresetLoader)||void 0===d?void 0:d.data)||void 0===f?void 0:f.is_live));return a(Ce||(Ce=Ve` <foxy-internal-summary-control helper-text="${0}" layout="section" label="${0}" infer="${0}"> <foxy-internal-summary-control infer="" label="" helper-text=""> ${0} ${0} ${0} ${0} ${0} </foxy-internal-summary-control> ${0} </foxy-internal-summary-control> `),o(b?this.t(`${C}.helper_text_inactive`):void 0),o(b?this.t(`${C}.label_inactive`):void 0),C,(null===(p=this.form.helper)||void 0===p?void 0:p.id_description)?a(be||(be=Ve` <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,A):"",(null===(m=this.form.helper)||void 0===m?void 0:m.third_party_key_description)?a(Me||(Me=Ve` <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,A):"",(null===(g=this.form.helper)||void 0===g?void 0:g.key_description)?a(Be||(Be=Ve` <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,A):"",$.map((e=>this.__renderBlock(e))),(null===(_=this.form.helper)||void 0===_?void 0:_.supports_card_verification)?a(De||(De=Ve` <foxy-internal-select-control helper-text="${0}" layout="summary-item" infer="${0}card-verification" .options="${0}" .getValue="${0}"> </foxy-internal-select-control> `),this.t(`${C}.${A}card-verification.helper_text_${this.form[`${x}card_verification`]||"disabled"}`),A,this.__cardVerificationOptions,(()=>this.form[`${x}card_verification`]||"disabled")):"",(null===(y=this.form.helper)||void 0===y?void 0:y.supports_card_verification)&&(null===(v=this.form[`${x}card_verification`])||void 0===v?void 0:v.startsWith("enabled_"))?a(Ee||(Ee=Ve` <foxy-internal-summary-control layout="details" class="mt-s" infer="${0}card-verification-config"> ${0} </foxy-internal-summary-control> `),A,["visa","mastercard","american-express","discover","default"].map((e=>{var t;return a(Fe||(Fe=Ve` <foxy-internal-number-control json-template="${0}" json-path="verification_amounts.${0}" property="${0}card_verification_config" layout="summary-item" suffix="¤" infer="${0}card-verification-config-verification-amounts-${0}" step="0.01" min="0"> </foxy-internal-number-control> `),o(null===(t=this.form.helper)||void 0===t?void 0:t.card_verification_config),e.replace(/-/g,"_"),x,A,e)}))):"")})),super.renderBody())}__renderPaymentMethodButton({type:e,helper:t},r,i){var s,n;const o=Oe.defaultImageSrc,l=null!==(n=null===(s=this.getImageSrc)||void 0===s?void 0:s.call(this,e))&&void 0!==n?n:o;return a(Le||(Le=Ve` <button class="${0}" ?disabled="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" @click="${0}"> <figure class="relative flex items-center" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <img class="${0}" src="${0}" alt="" @error="${0}"> <figcaption class="${0}"> <span class="font-medium">${0}&ZeroWidthSpace;</span> ${0} </figcaption> </figure> </button> `),c({"relative w-full block text-left bg-contrast-5 overflow-hidden":!0,"focus-outline-none focus-ring-inset focus-ring-2 focus-ring-primary-50":!0,"transition-colors hover-bg-contrast-10":!t.conflict,"cursor-default":!!t.conflict,"rounded-t":0===r,"rounded-b":r===i-1}),!!t.conflict,(()=>this.edit({type:e,helper:t})),c({"h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs":!0,"filter grayscale":!!t.conflict}),l,(e=>e.currentTarget.src=o),c({"min-w-0 flex-1 grid leading-xs":!0,"text-disabled":!!t.conflict}),t.name,t.conflict?a(ke||(ke=Ve`<span class="text-xs"> ${0}</span>`),this.t("conflict_message",t.conflict)):"")}__renderBlock(e){return a(Se||(Se=Ve`${0}`),e.fields.map((e=>{var t,r,s;if("hidden"===e.type)return;const n=["additional-fields",e.id].join("-").replace(/_/g,"-"),o=()=>{var t,r;try{const s=JSON.parse(null!==(t=this.form.additional_fields)&&void 0!==t?t:"{}");return null!==(r=i(s,e.id))&&void 0!==r?r:s.default_value}catch(t){return e.default_value}},l=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))})},c=e.options;return a(we||(we=Ve` ${0} `),"checkbox"===e.type?a(je||(je=Ve` <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,n,o,l):"select"===e.type?a(Ie||(Ie=Ve` <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,n,c.map((({name:e,value:t})=>({label:e,value:t}))),o,l):a(Pe||(Pe=Ve` <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!==(s=e.description)&&void 0!==s?s:"",e.default_value||this.t("default_additional_field_placeholder"),e.name,n,o,l))})))}}customElements.define("foxy-payments-api-payment-method-form",Oe);export{Oe as PaymentsApiPaymentMethodForm};
@@ -1 +1 @@
1
- import"./shared-597fffaa.js";import"./shared-438e41ab.js";import"./shared-c4df3a2a.js";import"./shared-b56949d3.js";import{I as e}from"./shared-e6559d84.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-7fec42f2.js";import{a as o}from"./shared-387d7254.js";import{i as s}from"./shared-53e42a77.js";import{h as a}from"./shared-ba5c42c7.js";import"./shared-a6cf5b1f.js";import"./shared-3bc9eaf7.js";import"./shared-3db3f3c3.js";import"./shared-46efbc40.js";import"./shared-297155d9.js";import"./shared-24998349.js";import"./shared-1abfcf87.js";import"./shared-d35ed355.js";import"./shared-db758d3b.js";import"./shared-c3d1d247.js";import"./shared-ab9dfa48.js";import"./shared-ac44a3a5.js";import"./shared-dc357e9d.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-c1b71162.js";import"./shared-a1cfe9d5.js";import"./shared-64210e53.js";import"./shared-0ea750af.js";import"./shared-c782b9fa.js";import"./shared-da95bb48.js";import"./shared-65b2760f.js";import"./shared-cd96ff03.js";import"./shared-37869bac.js";import"./shared-d6a0954b.js";import"./shared-1da47f50.js";import"./shared-e1e4d8f5.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-25a9d87d.js";import"./shared-e275989e.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-9b599205.js";import"./shared-5574ea83.js";import"./shared-6c2a7d2f.js";import"./shared-5212ef4f.js";import"./shared-a1f181bf.js";import"./shared-1d6ed748.js";import"./shared-ed24a3f9.js";import"./shared-d0aed1c1.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-15a7e329.js";import"./shared-264fb8a2.js";import"./foxy-nucleon-element.js";import"./shared-5905fca4.js";import"./shared-af39ffd8.js";import"./shared-1d03ea56.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 wide .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
+ import"./shared-597fffaa.js";import"./shared-438e41ab.js";import"./shared-c4df3a2a.js";import"./shared-b56949d3.js";import{I as e}from"./shared-e6559d84.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-7fec42f2.js";import{a as o}from"./shared-387d7254.js";import{i as s}from"./shared-53e42a77.js";import{h as a}from"./shared-ba5c42c7.js";import"./shared-a6cf5b1f.js";import"./shared-3bc9eaf7.js";import"./shared-3db3f3c3.js";import"./shared-46efbc40.js";import"./shared-297155d9.js";import"./shared-24998349.js";import"./shared-1abfcf87.js";import"./shared-d35ed355.js";import"./shared-db758d3b.js";import"./shared-c3d1d247.js";import"./shared-ab9dfa48.js";import"./shared-ac44a3a5.js";import"./shared-dc357e9d.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-c1b71162.js";import"./shared-a1cfe9d5.js";import"./shared-64210e53.js";import"./shared-0ea750af.js";import"./shared-c782b9fa.js";import"./shared-da95bb48.js";import"./shared-65b2760f.js";import"./shared-cd96ff03.js";import"./shared-37869bac.js";import"./shared-d6a0954b.js";import"./shared-1da47f50.js";import"./shared-e1e4d8f5.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-25a9d87d.js";import"./shared-e275989e.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-9b599205.js";import"./shared-5574ea83.js";import"./shared-6c2a7d2f.js";import"./shared-5212ef4f.js";import"./shared-a1f181bf.js";import"./shared-1d6ed748.js";import"./shared-ed24a3f9.js";import"./shared-d0aed1c1.js";import"./foxy-copy-to-clipboard.js";import"./shared-bab2ea2c.js";import"./shared-15a7e329.js";import"./shared-264fb8a2.js";import"./foxy-nucleon-element.js";import"./shared-5905fca4.js";import"./shared-02dd05dd.js";import"./shared-af39ffd8.js";import"./shared-1d03ea56.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 wide .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};
@@ -40,9 +40,9 @@
40
40
  "cancel_why_not_today_title": "Why can't I select today as the end date?",
41
41
  "cancel_why_not_today_text": "Same-day cancellations may disrupt billing due to ongoing payment processing. Advance notice ensures that all transactions are completed before cancellation.",
42
42
  "cancel_whats_next_title": "What happens next?",
43
- "cancel_whats_next_text": "The subscription will remain active and all payments will be processed as usual before the end date. Payments scheduled on or after the end date will be cancelled.",
43
+ "cancel_whats_next_text": "The subscription will remain active and all payments will be processed as usual until the end date. On the end date, the subscription will be cancelled and no further payments will be taken. If the end date is the same as a normal renewal date, no payments will be taken, but the subscription will simply be cancelled.",
44
44
  "cancel_how_to_reactivate_title": "Can I reactivate this subscription later?",
45
- "cancel_how_to_reactivate_text": "Yes, you will be able to clear the pending cancellation before the end date and reactivate the subscription after the end date on this page.",
45
+ "cancel_how_to_reactivate_text": "Yes, you will be able to clear the pending cancellation before the end date, or reactivate the subscription after the end date on this page.",
46
46
  "cancel_submit": "Cancel this subscription",
47
47
  "reactivate_title": "Reactivate this subscription",
48
48
  "reactivate_subtitle": "Set the next payment date to reactivate this subscription. You can select any date in the future, starting from tomorrow.",
@@ -4,7 +4,7 @@ import type { Data } from './types';
4
4
  import { BooleanSelector } from '@foxy.io/sdk/core';
5
5
  import { InternalForm } from '../../../../internal/InternalForm/InternalForm';
6
6
  export declare class InternalAdminSubscriptionFormStatusActionForm extends InternalForm<Data> {
7
- static get v8n(): NucleonV8N<Data>;
7
+ static get v8n(): NucleonV8N<Data, InternalAdminSubscriptionFormStatusActionForm>;
8
8
  private readonly __endDatePresetOptions;
9
9
  private readonly __endDatePresetGetValue;
10
10
  private readonly __endDatePresetSetValue;
@@ -45,8 +45,9 @@ export class InternalAdminSubscriptionFormStatusActionForm extends InternalForm
45
45
  }
46
46
  static get v8n() {
47
47
  return [
48
- ({ next_transaction_date, end_date, is_active }) => {
49
- if (is_active) {
48
+ ({ next_transaction_date, end_date }, host) => {
49
+ var _a;
50
+ if ((_a = host.data) === null || _a === void 0 ? void 0 : _a.is_active) {
50
51
  if (!end_date || end_date === '0000-00-00')
51
52
  return 'end-date:v8n_required';
52
53
  }
@@ -1 +1 @@
1
- {"version":3,"file":"InternalAdminSubscriptionFormStatusActionForm.js","sourceRoot":"","sources":["../../../../../../src/elements/public/AdminSubscriptionForm/internal/InternalAdminSubscriptionFormStatusActionForm/InternalAdminSubscriptionFormStatusActionForm.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,+CAA4C;AACpE,OAAO,EAAE,YAAY,EAAE,0DAAuD;AAC9E,OAAO,EAAE,SAAS,EAAE,2CAAwC;AAC5D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,OAAO,6CAA8C,SAAQ,YAAkB;IAArF;;QAemB,2BAAsB,GAAG,IAAI,CAAC,SAAS,CAAC;YACvD,EAAE,KAAK,EAA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../../NucleonElement/types';\nimport type { Data } from './types';\n\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { serializeDate } from '../../../../../utils/serialize-date';\nimport { InternalForm } from '../../../../internal/InternalForm/InternalForm';\nimport { parseDate } from '../../../../../utils/parse-date';\nimport { html, svg } from 'lit-html';\n\nexport class InternalAdminSubscriptionFormStatusActionForm extends InternalForm<Data> {\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ next_transaction_date, end_date, is_active }) => {\n if (is_active) {\n if (!end_date || end_date === '0000-00-00') return 'end-date:v8n_required';\n } else {\n if (!next_transaction_date) return 'next-transaction-date:v8n_required';\n }\n\n return true;\n },\n ];\n }\n\n private readonly __endDatePresetOptions = JSON.stringify([\n { value: 'tomorrow', label: 'option_tomorrow' },\n { value: 'next_transaction_date', label: 'option_next_transaction_date' },\n { value: 'custom_date', label: 'option_custom_date' },\n ]);\n\n private readonly __endDatePresetGetValue = () =>\n this.form.end_date_preset ?? 'next_transaction_date';\n\n private readonly __endDatePresetSetValue = (newValue: string) => {\n this.edit({ end_date_preset: newValue });\n\n if (newValue === 'tomorrow') {\n const tomorrowDate = new Date();\n tomorrowDate.setDate(tomorrowDate.getDate() + 1);\n tomorrowDate.setHours(0, 0, 0, 0);\n this.edit({ end_date: serializeDate(tomorrowDate) });\n } else if (newValue === 'next_transaction_date') {\n this.edit({ end_date: this.form.next_transaction_date });\n } else {\n this.edit({ end_date: '' });\n }\n };\n\n private readonly __endDateGetValue = () => {\n return this.form.end_date_preset ? this.form.end_date : this.form.next_transaction_date;\n };\n\n private readonly __nextTransactionDateGetValue = () => {\n const tomorrowDate = new Date();\n tomorrowDate.setDate(tomorrowDate.getDate() + 1);\n tomorrowDate.setHours(0, 0, 0, 0);\n\n const tomorrow = serializeDate(tomorrowDate);\n if (!this.form.next_transaction_date) return tomorrow;\n\n const currentNextDate = parseDate(this.form.next_transaction_date.substring(0, 10));\n if (!currentNextDate || currentNextDate < tomorrowDate) return tomorrow;\n\n return this.form.next_transaction_date;\n };\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [super.readonlySelector.toString()];\n if (this.form.end_date_preset !== 'custom_date') alwaysMatch.push('end-date');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n renderBody(): TemplateResult {\n const tomorrowDate = new Date();\n tomorrowDate.setDate(tomorrowDate.getDate() + 1);\n tomorrowDate.setHours(0, 0, 0, 0);\n\n const isActive = !!this.data?.is_active;\n const action = isActive ? 'cancel' : 'reactivate';\n const color = isActive ? 'bg-error-10' : 'bg-success-10';\n const icon = isActive\n ? svg`<svg class=\"text-error\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" style=\"width: 2rem; height: 2rem;\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M5.25 7.5A2.25 2.25 0 0 1 7.5 5.25h9a2.25 2.25 0 0 1 2.25 2.25v9a2.25 2.25 0 0 1-2.25 2.25h-9a2.25 2.25 0 0 1-2.25-2.25v-9Z\" /></svg>`\n : svg`<svg class=\"text-success\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" style=\"width: 2rem; height: 2rem;\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99\" /></svg>`;\n\n return html`\n <foxy-internal-summary-control infer=\"\" label=\"\" helper-text=\"\">\n <div class=\"text-center flex flex-col items-center bg-transparent\">\n <div class=\"rounded-full ${color} p-m mb-s mx-auto\">${icon}</div>\n <p class=\"font-medium text-xl leading-m\">\n <foxy-i18n infer=\"\" key=\"${action}_title\"></foxy-i18n>\n </p>\n <p class=\"text-secondary leading-s\">\n <foxy-i18n infer=\"\" key=\"${action}_subtitle\"></foxy-i18n>\n </p>\n </div>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"\" label=\"\" helper-text=\"\">\n ${isActive\n ? html`\n <foxy-internal-select-control\n options=${this.__endDatePresetOptions}\n layout=\"summary-item\"\n infer=\"end-date-preset\"\n .getValue=${this.__endDatePresetGetValue}\n .setValue=${this.__endDatePresetSetValue}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-date-control\n layout=\"summary-item\"\n infer=\"end-date\"\n min=${serializeDate(tomorrowDate)}\n hide-clear-button\n .getValue=${this.__endDateGetValue}\n >\n </foxy-internal-date-control>\n `\n : html`\n <foxy-internal-date-control\n layout=\"summary-item\"\n infer=\"next-transaction-date\"\n min=${serializeDate(tomorrowDate)}\n hide-clear-button\n .getValue=${this.__nextTransactionDateGetValue}\n >\n </foxy-internal-date-control>\n `}\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"\" label=\"\" helper-text=\"\">\n ${isActive\n ? [\n this.__renderFaq(\n 'cancel_why_not_today',\n svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"text-error flex-shrink-0\" style=\"width: 1.25em; height: 1.25em;\"><path d=\"M5.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H6a.75.75 0 0 1-.75-.75V12ZM6 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H6ZM7.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H8a.75.75 0 0 1-.75-.75V12ZM8 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H8ZM9.25 10a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H10a.75.75 0 0 1-.75-.75V10ZM10 11.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V12a.75.75 0 0 0-.75-.75H10ZM9.25 14a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H10a.75.75 0 0 1-.75-.75V14ZM12 9.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V10a.75.75 0 0 0-.75-.75H12ZM11.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H12a.75.75 0 0 1-.75-.75V12ZM12 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H12ZM13.25 10a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H14a.75.75 0 0 1-.75-.75V10ZM14 11.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V12a.75.75 0 0 0-.75-.75H14Z\" /><path fill-rule=\"evenodd\" d=\"M5.75 2a.75.75 0 0 1 .75.75V4h7V2.75a.75.75 0 0 1 1.5 0V4h.25A2.75 2.75 0 0 1 18 6.75v8.5A2.75 2.75 0 0 1 15.25 18H4.75A2.75 2.75 0 0 1 2 15.25v-8.5A2.75 2.75 0 0 1 4.75 4H5V2.75A.75.75 0 0 1 5.75 2Zm-1 5.5c-.69 0-1.25.56-1.25 1.25v6.5c0 .69.56 1.25 1.25 1.25h10.5c.69 0 1.25-.56 1.25-1.25v-6.5c0-.69-.56-1.25-1.25-1.25H4.75Z\" clip-rule=\"evenodd\" /></svg>`\n ),\n this.__renderFaq(\n 'cancel_whats_next',\n svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"text-error flex-shrink-0\" style=\"width: 1.25em; height: 1.25em;\"><path d=\"M3.288 4.818A1.5 1.5 0 0 0 1 6.095v7.81a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905c.155-.096.285-.213.389-.344v2.973a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905a1.5 1.5 0 0 0 0-2.552l-6.323-3.906A1.5 1.5 0 0 0 10 6.095v2.972a1.506 1.506 0 0 0-.389-.343L3.288 4.818Z\" /></svg>`\n ),\n this.__renderFaq(\n 'cancel_how_to_reactivate',\n svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"text-error flex-shrink-0\" style=\"width: 1.25em; height: 1.25em;\"><path d=\"M6.111 11.89A5.5 5.5 0 1 1 15.501 8 .75.75 0 0 0 17 8a7 7 0 1 0-11.95 4.95.75.75 0 0 0 1.06-1.06Z\" /><path d=\"M8.232 6.232a2.5 2.5 0 0 0 0 3.536.75.75 0 1 1-1.06 1.06A4 4 0 1 1 14 8a.75.75 0 0 1-1.5 0 2.5 2.5 0 0 0-4.268-1.768Z\" /><path d=\"M10.766 7.51a.75.75 0 0 0-1.37.365l-.492 6.861a.75.75 0 0 0 1.204.65l1.043-.799.985 3.678a.75.75 0 0 0 1.45-.388l-.978-3.646 1.292.204a.75.75 0 0 0 .74-1.16l-3.874-5.764Z\" /></svg>`\n ),\n ]\n : [\n this.__renderFaq(\n 'reactivate_why_not_today',\n svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"text-success flex-shrink-0\" style=\"width: 1.25em; height: 1.25em;\"><path d=\"M5.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H6a.75.75 0 0 1-.75-.75V12ZM6 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H6ZM7.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H8a.75.75 0 0 1-.75-.75V12ZM8 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H8ZM9.25 10a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H10a.75.75 0 0 1-.75-.75V10ZM10 11.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V12a.75.75 0 0 0-.75-.75H10ZM9.25 14a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H10a.75.75 0 0 1-.75-.75V14ZM12 9.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V10a.75.75 0 0 0-.75-.75H12ZM11.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H12a.75.75 0 0 1-.75-.75V12ZM12 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H12ZM13.25 10a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H14a.75.75 0 0 1-.75-.75V10ZM14 11.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V12a.75.75 0 0 0-.75-.75H14Z\" /><path fill-rule=\"evenodd\" d=\"M5.75 2a.75.75 0 0 1 .75.75V4h7V2.75a.75.75 0 0 1 1.5 0V4h.25A2.75 2.75 0 0 1 18 6.75v8.5A2.75 2.75 0 0 1 15.25 18H4.75A2.75 2.75 0 0 1 2 15.25v-8.5A2.75 2.75 0 0 1 4.75 4H5V2.75A.75.75 0 0 1 5.75 2Zm-1 5.5c-.69 0-1.25.56-1.25 1.25v6.5c0 .69.56 1.25 1.25 1.25h10.5c.69 0 1.25-.56 1.25-1.25v-6.5c0-.69-.56-1.25-1.25-1.25H4.75Z\" clip-rule=\"evenodd\" /></svg>`\n ),\n this.__renderFaq(\n 'reactivate_whats_next',\n svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"text-success flex-shrink-0\" style=\"width: 1.25em; height: 1.25em;\"><path d=\"M3.288 4.818A1.5 1.5 0 0 0 1 6.095v7.81a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905c.155-.096.285-.213.389-.344v2.973a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905a1.5 1.5 0 0 0 0-2.552l-6.323-3.906A1.5 1.5 0 0 0 10 6.095v2.972a1.506 1.506 0 0 0-.389-.343L3.288 4.818Z\" /></svg>`\n ),\n ]}\n </foxy-internal-summary-control>\n\n <vaadin-button\n theme=\"primary ${isActive ? 'error' : 'success'} large\"\n class=\"w-full\"\n ?disabled=${this.disabled}\n @click=${() => this.submit()}\n >\n <foxy-i18n infer=\"\" key=\"${action}_submit\"></foxy-i18n>\n </vaadin-button>\n `;\n }\n\n submit(): void {\n if (this.data?.is_active) {\n if (this.__endDatePresetGetValue() === 'next_transaction_date') {\n this.edit({ end_date: this.form.next_transaction_date });\n }\n } else {\n this.edit({\n next_transaction_date: this.__nextTransactionDateGetValue(),\n is_active: true,\n end_date: '0000-00-00',\n });\n }\n\n super.submit();\n }\n\n protected async _sendPatch(edits: Partial<Data>): Promise<Data> {\n delete edits.end_date_preset;\n return super._sendPatch(edits);\n }\n\n private __renderFaq(prefix: string, icon: SVGTemplateResult) {\n return html`\n <div\n class=\"bg-transparent flex leading-xs\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n ${icon}\n <p class=\"grid\">\n <foxy-i18n class=\"leading-m text-s font-medium\" infer=\"\" key=\"${prefix}_title\">\n </foxy-i18n>\n <foxy-i18n class=\"leading-xs text-secondary text-xs\" infer=\"\" key=\"${prefix}_text\">\n </foxy-i18n>\n </p>\n </div>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"InternalAdminSubscriptionFormStatusActionForm.js","sourceRoot":"","sources":["../../../../../../src/elements/public/AdminSubscriptionForm/internal/InternalAdminSubscriptionFormStatusActionForm/InternalAdminSubscriptionFormStatusActionForm.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,+CAA4C;AACpE,OAAO,EAAE,YAAY,EAAE,0DAAuD;AAC9E,OAAO,EAAE,SAAS,EAAE,2CAAwC;AAC5D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,OAAO,6CAA8C,SAAQ,YAAkB;IAArF;;QAemB,2BAAsB,GAAG,IAAI,CAAC,SAAS,CAAC;YACvD,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,iBAAiB,EAAE;YAC/C,EAAE,KAAK,EAAE,uBAAuB,EAAE,KAAK,EAAE,8BAA8B,EAAE;YACzE,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,oBAAoB,EAAE;SACtD,CAAC,CAAC;QAEc,4BAAuB,GAAG,GAAG,EAAE,wBAC9C,IAAI,CAAC,IAAI,CAAC,eAAe,mCAAI,uBAAuB,GAAA,CAAC;QAEtC,4BAAuB,GAAG,CAAC,QAAgB,EAAE,EAAE;YAC9D,IAAI,CAAC,IAAI,CAAC,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC,CAAC;YAEzC,IAAI,QAAQ,KAAK,UAAU,EAAE;gBAC3B,MAAM,YAAY,GAAG,IAAI,IAAI,EAAE,CAAC;gBAChC,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;gBACjD,YAAY,CAAC,QAAQ,CAAC,CAAC,EAAE,CA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CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;aAC1D;SACF;aAAM;YACL,IAAI,CAAC,IAAI,CAAC;gBACR,qBAAqB,EAAE,IAAI,CAAC,6BAA6B,EAAE;gBAC3D,SAAS,EAAE,IAAI;gBACf,QAAQ,EAAE,YAAY;aACvB,CAAC,CAAC;SACJ;QAED,KAAK,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC;IAES,KAAK,CAAC,UAAU,CAAC,KAAoB;QAC7C,OAAO,KAAK,CAAC,eAAe,CAAC;QAC7B,OAAO,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAEO,WAAW,CAAC,MAAc,EAAE,IAAuB;QACzD,OAAO,IAAI,CAAA;;;;;UAKL,IAAI;;0EAE4D,MAAM;;+EAED,MAAM;;;;KAIhF,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { SVGTemplateResult, TemplateResult } from 'lit-html';\nimport type { NucleonV8N } from '../../../NucleonElement/types';\nimport type { Data } from './types';\n\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { serializeDate } from '../../../../../utils/serialize-date';\nimport { InternalForm } from '../../../../internal/InternalForm/InternalForm';\nimport { parseDate } from '../../../../../utils/parse-date';\nimport { html, svg } from 'lit-html';\n\nexport class InternalAdminSubscriptionFormStatusActionForm extends InternalForm<Data> {\n static get v8n(): NucleonV8N<Data, InternalAdminSubscriptionFormStatusActionForm> {\n return [\n ({ next_transaction_date, end_date }, host) => {\n if (host.data?.is_active) {\n if (!end_date || end_date === '0000-00-00') return 'end-date:v8n_required';\n } else {\n if (!next_transaction_date) return 'next-transaction-date:v8n_required';\n }\n\n return true;\n },\n ];\n }\n\n private readonly __endDatePresetOptions = JSON.stringify([\n { value: 'tomorrow', label: 'option_tomorrow' },\n { value: 'next_transaction_date', label: 'option_next_transaction_date' },\n { value: 'custom_date', label: 'option_custom_date' },\n ]);\n\n private readonly __endDatePresetGetValue = () =>\n this.form.end_date_preset ?? 'next_transaction_date';\n\n private readonly __endDatePresetSetValue = (newValue: string) => {\n this.edit({ end_date_preset: newValue });\n\n if (newValue === 'tomorrow') {\n const tomorrowDate = new Date();\n tomorrowDate.setDate(tomorrowDate.getDate() + 1);\n tomorrowDate.setHours(0, 0, 0, 0);\n this.edit({ end_date: serializeDate(tomorrowDate) });\n } else if (newValue === 'next_transaction_date') {\n this.edit({ end_date: this.form.next_transaction_date });\n } else {\n this.edit({ end_date: '' });\n }\n };\n\n private readonly __endDateGetValue = () => {\n return this.form.end_date_preset ? this.form.end_date : this.form.next_transaction_date;\n };\n\n private readonly __nextTransactionDateGetValue = () => {\n const tomorrowDate = new Date();\n tomorrowDate.setDate(tomorrowDate.getDate() + 1);\n tomorrowDate.setHours(0, 0, 0, 0);\n\n const tomorrow = serializeDate(tomorrowDate);\n if (!this.form.next_transaction_date) return tomorrow;\n\n const currentNextDate = parseDate(this.form.next_transaction_date.substring(0, 10));\n if (!currentNextDate || currentNextDate < tomorrowDate) return tomorrow;\n\n return this.form.next_transaction_date;\n };\n\n get readonlySelector(): BooleanSelector {\n const alwaysMatch = [super.readonlySelector.toString()];\n if (this.form.end_date_preset !== 'custom_date') alwaysMatch.push('end-date');\n return new BooleanSelector(alwaysMatch.join(' ').trim());\n }\n\n renderBody(): TemplateResult {\n const tomorrowDate = new Date();\n tomorrowDate.setDate(tomorrowDate.getDate() + 1);\n tomorrowDate.setHours(0, 0, 0, 0);\n\n const isActive = !!this.data?.is_active;\n const action = isActive ? 'cancel' : 'reactivate';\n const color = isActive ? 'bg-error-10' : 'bg-success-10';\n const icon = isActive\n ? svg`<svg class=\"text-error\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" style=\"width: 2rem; height: 2rem;\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M5.25 7.5A2.25 2.25 0 0 1 7.5 5.25h9a2.25 2.25 0 0 1 2.25 2.25v9a2.25 2.25 0 0 1-2.25 2.25h-9a2.25 2.25 0 0 1-2.25-2.25v-9Z\" /></svg>`\n : svg`<svg class=\"text-success\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" style=\"width: 2rem; height: 2rem;\"><path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182m0-4.991v4.99\" /></svg>`;\n\n return html`\n <foxy-internal-summary-control infer=\"\" label=\"\" helper-text=\"\">\n <div class=\"text-center flex flex-col items-center bg-transparent\">\n <div class=\"rounded-full ${color} p-m mb-s mx-auto\">${icon}</div>\n <p class=\"font-medium text-xl leading-m\">\n <foxy-i18n infer=\"\" key=\"${action}_title\"></foxy-i18n>\n </p>\n <p class=\"text-secondary leading-s\">\n <foxy-i18n infer=\"\" key=\"${action}_subtitle\"></foxy-i18n>\n </p>\n </div>\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"\" label=\"\" helper-text=\"\">\n ${isActive\n ? html`\n <foxy-internal-select-control\n options=${this.__endDatePresetOptions}\n layout=\"summary-item\"\n infer=\"end-date-preset\"\n .getValue=${this.__endDatePresetGetValue}\n .setValue=${this.__endDatePresetSetValue}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-date-control\n layout=\"summary-item\"\n infer=\"end-date\"\n min=${serializeDate(tomorrowDate)}\n hide-clear-button\n .getValue=${this.__endDateGetValue}\n >\n </foxy-internal-date-control>\n `\n : html`\n <foxy-internal-date-control\n layout=\"summary-item\"\n infer=\"next-transaction-date\"\n min=${serializeDate(tomorrowDate)}\n hide-clear-button\n .getValue=${this.__nextTransactionDateGetValue}\n >\n </foxy-internal-date-control>\n `}\n </foxy-internal-summary-control>\n\n <foxy-internal-summary-control infer=\"\" label=\"\" helper-text=\"\">\n ${isActive\n ? [\n this.__renderFaq(\n 'cancel_why_not_today',\n svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"text-error flex-shrink-0\" style=\"width: 1.25em; height: 1.25em;\"><path d=\"M5.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H6a.75.75 0 0 1-.75-.75V12ZM6 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H6ZM7.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H8a.75.75 0 0 1-.75-.75V12ZM8 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H8ZM9.25 10a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H10a.75.75 0 0 1-.75-.75V10ZM10 11.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V12a.75.75 0 0 0-.75-.75H10ZM9.25 14a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H10a.75.75 0 0 1-.75-.75V14ZM12 9.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V10a.75.75 0 0 0-.75-.75H12ZM11.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H12a.75.75 0 0 1-.75-.75V12ZM12 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H12ZM13.25 10a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H14a.75.75 0 0 1-.75-.75V10ZM14 11.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V12a.75.75 0 0 0-.75-.75H14Z\" /><path fill-rule=\"evenodd\" d=\"M5.75 2a.75.75 0 0 1 .75.75V4h7V2.75a.75.75 0 0 1 1.5 0V4h.25A2.75 2.75 0 0 1 18 6.75v8.5A2.75 2.75 0 0 1 15.25 18H4.75A2.75 2.75 0 0 1 2 15.25v-8.5A2.75 2.75 0 0 1 4.75 4H5V2.75A.75.75 0 0 1 5.75 2Zm-1 5.5c-.69 0-1.25.56-1.25 1.25v6.5c0 .69.56 1.25 1.25 1.25h10.5c.69 0 1.25-.56 1.25-1.25v-6.5c0-.69-.56-1.25-1.25-1.25H4.75Z\" clip-rule=\"evenodd\" /></svg>`\n ),\n this.__renderFaq(\n 'cancel_whats_next',\n svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"text-error flex-shrink-0\" style=\"width: 1.25em; height: 1.25em;\"><path d=\"M3.288 4.818A1.5 1.5 0 0 0 1 6.095v7.81a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905c.155-.096.285-.213.389-.344v2.973a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905a1.5 1.5 0 0 0 0-2.552l-6.323-3.906A1.5 1.5 0 0 0 10 6.095v2.972a1.506 1.506 0 0 0-.389-.343L3.288 4.818Z\" /></svg>`\n ),\n this.__renderFaq(\n 'cancel_how_to_reactivate',\n svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"text-error flex-shrink-0\" style=\"width: 1.25em; height: 1.25em;\"><path d=\"M6.111 11.89A5.5 5.5 0 1 1 15.501 8 .75.75 0 0 0 17 8a7 7 0 1 0-11.95 4.95.75.75 0 0 0 1.06-1.06Z\" /><path d=\"M8.232 6.232a2.5 2.5 0 0 0 0 3.536.75.75 0 1 1-1.06 1.06A4 4 0 1 1 14 8a.75.75 0 0 1-1.5 0 2.5 2.5 0 0 0-4.268-1.768Z\" /><path d=\"M10.766 7.51a.75.75 0 0 0-1.37.365l-.492 6.861a.75.75 0 0 0 1.204.65l1.043-.799.985 3.678a.75.75 0 0 0 1.45-.388l-.978-3.646 1.292.204a.75.75 0 0 0 .74-1.16l-3.874-5.764Z\" /></svg>`\n ),\n ]\n : [\n this.__renderFaq(\n 'reactivate_why_not_today',\n svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"text-success flex-shrink-0\" style=\"width: 1.25em; height: 1.25em;\"><path d=\"M5.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H6a.75.75 0 0 1-.75-.75V12ZM6 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H6ZM7.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H8a.75.75 0 0 1-.75-.75V12ZM8 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H8ZM9.25 10a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H10a.75.75 0 0 1-.75-.75V10ZM10 11.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V12a.75.75 0 0 0-.75-.75H10ZM9.25 14a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H10a.75.75 0 0 1-.75-.75V14ZM12 9.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V10a.75.75 0 0 0-.75-.75H12ZM11.25 12a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H12a.75.75 0 0 1-.75-.75V12ZM12 13.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V14a.75.75 0 0 0-.75-.75H12ZM13.25 10a.75.75 0 0 1 .75-.75h.01a.75.75 0 0 1 .75.75v.01a.75.75 0 0 1-.75.75H14a.75.75 0 0 1-.75-.75V10ZM14 11.25a.75.75 0 0 0-.75.75v.01c0 .414.336.75.75.75h.01a.75.75 0 0 0 .75-.75V12a.75.75 0 0 0-.75-.75H14Z\" /><path fill-rule=\"evenodd\" d=\"M5.75 2a.75.75 0 0 1 .75.75V4h7V2.75a.75.75 0 0 1 1.5 0V4h.25A2.75 2.75 0 0 1 18 6.75v8.5A2.75 2.75 0 0 1 15.25 18H4.75A2.75 2.75 0 0 1 2 15.25v-8.5A2.75 2.75 0 0 1 4.75 4H5V2.75A.75.75 0 0 1 5.75 2Zm-1 5.5c-.69 0-1.25.56-1.25 1.25v6.5c0 .69.56 1.25 1.25 1.25h10.5c.69 0 1.25-.56 1.25-1.25v-6.5c0-.69-.56-1.25-1.25-1.25H4.75Z\" clip-rule=\"evenodd\" /></svg>`\n ),\n this.__renderFaq(\n 'reactivate_whats_next',\n svg`<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 20 20\" fill=\"currentColor\" class=\"text-success flex-shrink-0\" style=\"width: 1.25em; height: 1.25em;\"><path d=\"M3.288 4.818A1.5 1.5 0 0 0 1 6.095v7.81a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905c.155-.096.285-.213.389-.344v2.973a1.5 1.5 0 0 0 2.288 1.276l6.323-3.905a1.5 1.5 0 0 0 0-2.552l-6.323-3.906A1.5 1.5 0 0 0 10 6.095v2.972a1.506 1.506 0 0 0-.389-.343L3.288 4.818Z\" /></svg>`\n ),\n ]}\n </foxy-internal-summary-control>\n\n <vaadin-button\n theme=\"primary ${isActive ? 'error' : 'success'} large\"\n class=\"w-full\"\n ?disabled=${this.disabled}\n @click=${() => this.submit()}\n >\n <foxy-i18n infer=\"\" key=\"${action}_submit\"></foxy-i18n>\n </vaadin-button>\n `;\n }\n\n submit(): void {\n if (this.data?.is_active) {\n if (this.__endDatePresetGetValue() === 'next_transaction_date') {\n this.edit({ end_date: this.form.next_transaction_date });\n }\n } else {\n this.edit({\n next_transaction_date: this.__nextTransactionDateGetValue(),\n is_active: true,\n end_date: '0000-00-00',\n });\n }\n\n super.submit();\n }\n\n protected async _sendPatch(edits: Partial<Data>): Promise<Data> {\n delete edits.end_date_preset;\n return super._sendPatch(edits);\n }\n\n private __renderFaq(prefix: string, icon: SVGTemplateResult) {\n return html`\n <div\n class=\"bg-transparent flex leading-xs\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n ${icon}\n <p class=\"grid\">\n <foxy-i18n class=\"leading-m text-s font-medium\" infer=\"\" key=\"${prefix}_title\">\n </foxy-i18n>\n <foxy-i18n class=\"leading-xs text-secondary text-xs\" infer=\"\" key=\"${prefix}_text\">\n </foxy-i18n>\n </p>\n </div>\n `;\n }\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  import type { PropertyDeclarations } from 'lit-element';
2
2
  import type { TemplateResult } from 'lit-html';
3
3
  import type { Data } from './types';
4
- import { TwoLineCard } from '../CustomFieldCard/TwoLineCard';
5
- declare const Base: typeof TwoLineCard & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
4
+ import { InternalCard } from '../../internal/InternalCard/InternalCard';
5
+ declare const Base: typeof InternalCard & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
6
6
  defaultNS: string;
7
7
  };
8
8
  /**
@@ -1,8 +1,8 @@
1
1
  import { TranslatableMixin } from "../../../mixins/translatable.js";
2
- import { TwoLineCard } from "../CustomFieldCard/TwoLineCard.js";
2
+ import { InternalCard } from "../../internal/InternalCard/InternalCard.js";
3
3
  import { html } from 'lit-html';
4
4
  const NS = 'payments-api-payment-method-card';
5
- const Base = TranslatableMixin(TwoLineCard, NS);
5
+ const Base = TranslatableMixin(InternalCard, NS);
6
6
  /**
7
7
  * Card element representing a `fx:payment_method` resource of Payments API.
8
8
  *
@@ -34,12 +34,6 @@ export class PaymentsApiPaymentMethodCard extends Base {
34
34
  }
35
35
  renderBody() {
36
36
  var _a, _b;
37
- const defaultLayout = super.renderBody({
38
- title: data => html `${data.helper.name}`,
39
- subtitle: data => html `${data.description}`,
40
- });
41
- if (!this.in({ idle: 'snapshot' }))
42
- return defaultLayout;
43
37
  const defaultSrc = PaymentsApiPaymentMethodCard.defaultImageSrc;
44
38
  const data = this.data;
45
39
  return html `
@@ -53,8 +47,9 @@ export class PaymentsApiPaymentMethodCard extends Base {
53
47
  alt=${this.t('image_alt')}
54
48
  @error=${(evt) => (evt.currentTarget.src = defaultSrc)}
55
49
  />
56
-
57
- <figcaption class="min-w-0 flex-1">${defaultLayout}</figcaption>
50
+ <figcaption class="min-w-0 flex-1" data-testid="title">
51
+ ${data === null || data === void 0 ? void 0 : data.helper.name}&ZeroWidthSpace;
52
+ </figcaption>
58
53
  </figure>
59
54
  `;
60
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentsApiPaymentMethodCard.js","sourceRoot":"","sources":["../../../../src/elements/public/PaymentsApiPaymentMethodCard/PaymentsApiPaymentMethodCard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,WAAW,EAAE,0CAAuC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,kCAAkC,CAAC;AAC9C,MAAM,IAAI,GAAG,iBAAiB,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AAEhD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,4BAA6B,SAAQ,IAAU;IAA5D;;QAYE;;;WAGG;QACH,gBAAW,GAAsC,IAAI,CAAC;IA6BxD,CAAC;IA5CC,MAAM,KAAK,eAAe;QACxB,OAAO,goBAAgoB,CAAC;IAC1oB,CAAC;IAED,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,WAAW,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;SAClC,CAAC;IACJ,CAAC;IAQD,UAAU;;QACR,MAAM,aAAa,GAAG,KAAK,CAAC,UAAU,CAAC;YACrC,KAAK,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAA,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;YACxC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAA,GAAG,IAAI,CAAC,WAAW,EAAE;SAC5C,CAAC,CAAC;QAEH,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;YAAE,OAAO,aAAa,CAAC;QAEzD,MAAM,UAAU,GAAG,4BAA4B,CAAC,eAAe,CAAC;QAChE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,OAAO,IAAI,CAAA;;;;;;;gBAOC,MAAA,CAAC,IAAI,CAAC,CAAC,OAAC,IAAI,CAAC,WAAW,+CAAhB,IAAI,EAAe,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,mCAAI,UAAU;gBAC3D,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC;mBAChB,CAAC,GAAU,EAAE,EAAE,CAAC,CAAE,GAAG,CAAC,aAAkC,CAAC,GAAG,GAAG,UAAU,CAAC;;;6CAGhD,aAAa;;KAErD,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { TwoLineCard } from '../CustomFieldCard/TwoLineCard';\nimport { html } from 'lit-html';\n\nconst NS = 'payments-api-payment-method-card';\nconst Base = TranslatableMixin(TwoLineCard, NS);\n\n/**\n * Card element representing a `fx:payment_method` resource of Payments API.\n *\n * _Payments API is a client-side virtual API layer built on top of hAPI\n * in an attempt to streamline access to stores' payment method settings\n * that is currently a bit quirky due to the legacy functionality. To use\n * this element with hAPI, wrap it into a foxy-payments-api node._\n *\n * @element foxy-payments-api-payment-method-card\n * @since 1.21.0\n */\nexport class PaymentsApiPaymentMethodCard extends Base<Data> {\n static get defaultImageSrc(): string {\n 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\";\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getImageSrc: { attribute: false },\n };\n }\n\n /**\n * Payment method image/logo URL getter.\n * If left `null`, the card will display the default image.\n */\n getImageSrc: ((type: string) => string) | null = null;\n\n renderBody(): TemplateResult {\n const defaultLayout = super.renderBody({\n title: data => html`${data.helper.name}`,\n subtitle: data => html`${data.description}`,\n });\n\n if (!this.in({ idle: 'snapshot' })) return defaultLayout;\n\n const defaultSrc = PaymentsApiPaymentMethodCard.defaultImageSrc;\n const data = this.data;\n\n return html`\n <figure\n class=\"flex items-center\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <img\n class=\"relative h-s w-s object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs\"\n src=${(data ? this.getImageSrc?.(data.type) : null) ?? defaultSrc}\n alt=${this.t('image_alt')}\n @error=${(evt: Event) => ((evt.currentTarget as HTMLImageElement).src = defaultSrc)}\n />\n\n <figcaption class=\"min-w-0 flex-1\">${defaultLayout}</figcaption>\n </figure>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"PaymentsApiPaymentMethodCard.js","sourceRoot":"","sources":["../../../../src/elements/public/PaymentsApiPaymentMethodCard/PaymentsApiPaymentMethodCard.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,kCAAkC,CAAC;AAC9C,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,4BAA6B,SAAQ,IAAU;IAA5D;;QAYE;;;WAGG;QACH,gBAAW,GAAsC,IAAI,CAAC;IAuBxD,CAAC;IAtCC,MAAM,KAAK,eAAe;QACxB,OAAO,goBAAgoB,CAAC;IAC1oB,CAAC;IAED,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,WAAW,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;SAClC,CAAC;IACJ,CAAC;IAQD,UAAU;;QACR,MAAM,UAAU,GAAG,4BAA4B,CAAC,eAAe,CAAC;QAChE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QAEvB,OAAO,IAAI,CAAA;;;;;;;gBAOC,MAAA,CAAC,IAAI,CAAC,CAAC,OAAC,IAAI,CAAC,WAAW,+CAAhB,IAAI,EAAe,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,mCAAI,UAAU;gBAC3D,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC;mBAChB,CAAC,GAAU,EAAE,EAAE,CAAC,CAAE,GAAG,CAAC,aAAkC,CAAC,GAAG,GAAG,UAAU,CAAC;;;YAGjF,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAC,IAAI;;;KAGxB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { html } from 'lit-html';\n\nconst NS = 'payments-api-payment-method-card';\nconst Base = TranslatableMixin(InternalCard, NS);\n\n/**\n * Card element representing a `fx:payment_method` resource of Payments API.\n *\n * _Payments API is a client-side virtual API layer built on top of hAPI\n * in an attempt to streamline access to stores' payment method settings\n * that is currently a bit quirky due to the legacy functionality. To use\n * this element with hAPI, wrap it into a foxy-payments-api node._\n *\n * @element foxy-payments-api-payment-method-card\n * @since 1.21.0\n */\nexport class PaymentsApiPaymentMethodCard extends Base<Data> {\n static get defaultImageSrc(): string {\n 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\";\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getImageSrc: { attribute: false },\n };\n }\n\n /**\n * Payment method image/logo URL getter.\n * If left `null`, the card will display the default image.\n */\n getImageSrc: ((type: string) => string) | null = null;\n\n renderBody(): TemplateResult {\n const defaultSrc = PaymentsApiPaymentMethodCard.defaultImageSrc;\n const data = this.data;\n\n return html`\n <figure\n class=\"flex items-center\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <img\n class=\"relative h-s w-s object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs\"\n src=${(data ? this.getImageSrc?.(data.type) : null) ?? defaultSrc}\n alt=${this.t('image_alt')}\n @error=${(evt: Event) => ((evt.currentTarget as HTMLImageElement).src = defaultSrc)}\n />\n <figcaption class=\"min-w-0 flex-1\" data-testid=\"title\">\n ${data?.helper.name}&ZeroWidthSpace;\n </figcaption>\n </figure>\n `;\n }\n}\n"]}
@@ -1,5 +1,3 @@
1
- import '../../internal/InternalSandbox/index';
2
- import '../Spinner/index';
3
- import '../I18n/index';
1
+ import '../../internal/InternalCard/index';
4
2
  import { PaymentsApiPaymentMethodCard } from './PaymentsApiPaymentMethodCard';
5
3
  export { PaymentsApiPaymentMethodCard };
@@ -1,6 +1,4 @@
1
- import "../../internal/InternalSandbox/index.js";
2
- import "../Spinner/index.js";
3
- import "../I18n/index.js";
1
+ import "../../internal/InternalCard/index.js";
4
2
  import { PaymentsApiPaymentMethodCard } from "./PaymentsApiPaymentMethodCard.js";
5
3
  customElements.define('foxy-payments-api-payment-method-card', PaymentsApiPaymentMethodCard);
6
4
  export { PaymentsApiPaymentMethodCard };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/PaymentsApiPaymentMethodCard/index.ts"],"names":[],"mappings":"AAAA,iDAA8C;AAE9C,6BAA0B;AAC1B,0BAAuB;AAEvB,OAAO,EAAE,4BAA4B,EAAE,0CAAuC;AAE9E,cAAc,CAAC,MAAM,CAAC,uCAAuC,EAAE,4BAA4B,CAAC,CAAC;AAE7F,OAAO,EAAE,4BAA4B,EAAE,CAAC","sourcesContent":["import '../../internal/InternalSandbox/index';\n\nimport '../Spinner/index';\nimport '../I18n/index';\n\nimport { PaymentsApiPaymentMethodCard } from './PaymentsApiPaymentMethodCard';\n\ncustomElements.define('foxy-payments-api-payment-method-card', PaymentsApiPaymentMethodCard);\n\nexport { PaymentsApiPaymentMethodCard };\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/PaymentsApiPaymentMethodCard/index.ts"],"names":[],"mappings":"AAAA,8CAA2C;AAE3C,OAAO,EAAE,4BAA4B,EAAE,0CAAuC;AAE9E,cAAc,CAAC,MAAM,CAAC,uCAAuC,EAAE,4BAA4B,CAAC,CAAC;AAE7F,OAAO,EAAE,4BAA4B,EAAE,CAAC","sourcesContent":["import '../../internal/InternalCard/index';\n\nimport { PaymentsApiPaymentMethodCard } from './PaymentsApiPaymentMethodCard';\n\ncustomElements.define('foxy-payments-api-payment-method-card', PaymentsApiPaymentMethodCard);\n\nexport { PaymentsApiPaymentMethodCard };\n"]}
@@ -206,7 +206,9 @@ export class PaymentsApiPaymentMethodForm extends Base {
206
206
  var _a;
207
207
  const allMethods = Object.entries((_a = this.__availablePaymentMethods) !== null && _a !== void 0 ? _a : {});
208
208
  const filteredMethods = this.__search
209
- ? new Fuse(allMethods, { keys: ['1.name'] }).search(this.__search).map(v => v.item)
209
+ ? new Fuse(allMethods, { keys: ['1.name'], threshold: 0.25 })
210
+ .search(this.__search)
211
+ .map(v => v.item)
210
212
  : allMethods;
211
213
  return filteredMethods
212
214
  .sort((a, b) => a[0].localeCompare(b[0], 'en'))
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentsApiPaymentMethodForm.js","sourceRoot":"","sources":["../../../../src/elements/public/PaymentsApiPaymentMethodForm/PaymentsApiPaymentMethodForm.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,OAAO,IAAI,MAAM,SAAS,CAAC;AAC3B,OAAO,GAAG,MAAM,eAAe,CAAC;AAChC,OAAO,GAAG,MAAM,eAAe,CAAC;AAChC,OAAO,GAAG,MAAM,eAAe,CAAC;AAOhC,MAAM,EAAE,GAAG,kCAAkC,CAAC;AAC9C,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,4BAA6B,SAAQ,IAAU;IAA5D;;QAiDE,oFAAoF;QACpF,kBAAa,GAAkB,IAAI,CAAC;QAEpC,sFAAsF;QACtF,gBAAW,GAAsC,IAAI,CAAC;QAEtD,6CAA6C;QAC7C,UAAK,GAAkB,IAAI,CAAC;QAEX,sCAAiC,GAAG,+BAA+B,CAAC;QAEpE,4BAAuB,GAAG,qBAAqB,CAAC;QAEhD,oBAAe,GAAG,aAAa,CAAC;QAEhC,mCAA8B,GAAG,GAAG,EAAE;;YACrD,aAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,0CAAE,QAAQ,CAAC,wBAAwB,EAAE;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AAC,SAAS,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;YACpF,CAAC,CAAC;YAGF,MAAM,OAAO,GAAI,KAAgC,CAAC,OAAO,CAAC;YAE1D,OAAO,IAAI,CAAA;UACP,KAAK,CAAC,IAAI,KAAK,UAAU;gBACzB,CAAC,CAAC,IAAI,CAAA;;8BAEc,MAAA,KAAK,CAAC,WAAW,mCAAI,EAAE;wBAC7B,KAAK,CAAC,IAAI;wBACV,KAAK;;4BAED,QAAQ;4BACR,QAAQ;;;aAGvB;gBACH,CAAC,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ;oBACzB,CAAC,CAAC,IAAI,CAAA;;8BAEc,IAAI,CAAC,CAAC,CAAC,6CAA6C,CAAC;8BACrD,MAAA,KAAK,CAAC,WAAW,mCAAI,EAAE;;wBAE7B,KAAK,CAAC,IAAI;wBACV,KAAK;2BACF,OAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;4BAC1D,QAAQ;4BACR,QAAQ;;;aAGvB;oBACH,CAAC,CAAC,IAAI,CAAA;;8BAEc,MAAA,KAAK,CAAC,WAAW,mCAAI,EAAE;8BACvB,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC,CAAC,CAAC,sCAAsC,CAAC;;wBAE3E,KAAK,CAAC,IAAI;wBACV,KAAK;4BACD,QAAQ;4BACR,QAAQ;;;aAGvB;OACN,CAAC;QACJ,CAAC,CAAC,EAAE,CAAC;IACP,CAAC;CACF","sourcesContent":["import type { AvailablePaymentMethods, PaymentPreset } from '../PaymentsApi/api/types';\nimport type { Block, Data } from './types';\nimport type { PropertyDeclarations } from 'lit-element';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { BooleanSelector, getResourceId } from '@foxy.io/sdk/core';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-html';\nimport { classMap } from '../../../utils/class-map';\n\nimport Fuse from 'fuse.js';\nimport has from 'lodash-es/has';\nimport get from 'lodash-es/get';\nimport set from 'lodash-es/set';\n\ntype PaymentMethod = {\n helper: AvailablePaymentMethods['values'][string];\n type: string;\n};\n\nconst NS = 'payments-api-payment-method-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\n/**\n * Form element for the `fx:payment_method` resource of Payments API.\n *\n * _Payments API is a client-side virtual API layer built on top of hAPI\n * in an attempt to streamline access to stores' payment method settings\n * that is currently a bit quirky due to the legacy functionality. To use\n * this element with hAPI, wrap it into a foxy-payments-api node._\n *\n * @element foxy-payments-api-payment-method-form\n * @since 1.21.0\n */\nexport class PaymentsApiPaymentMethodForm extends Base<Data> {\n static get defaultImageSrc(): string {\n 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\";\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n paymentPreset: { attribute: 'payment-preset' },\n getImageSrc: { attribute: false },\n store: {},\n __search: { attribute: false },\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ description: v }) => !v || v.length <= 100 || 'description:v8n_too_long',\n ({ type: v }) => !!v || 'type:v8n_required',\n\n form => {\n const blocks = form.helper?.additional_fields?.blocks ?? [];\n let additionalFields: Record<string, unknown>;\n\n try {\n additionalFields = JSON.parse(form.additional_fields ?? '{}');\n } catch {\n additionalFields = {};\n }\n\n for (const block of blocks) {\n for (const field of block.fields) {\n if ('optional' in (field as Record<string, unknown>)) {\n if (!(field as Record<string, unknown>).optional) {\n if (!has(additionalFields, field.id)) {\n if (field.type !== 'checkbox') {\n return 'additional-fields:v8n_invalid';\n }\n }\n }\n }\n }\n }\n\n return true;\n },\n ];\n }\n\n /** URL of the linked `fx:payment_preset` resource from the virtual Payments API. */\n paymentPreset: string | null = null;\n\n /** A function that returns a URL of a payment method icon based on the given type. */\n getImageSrc: ((type: string) => string) | null = null;\n\n /** URL of the linked `fx:store` resource. */\n store: string | null = null;\n\n private readonly __availablePaymentMethodsLoaderId = 'availablePaymentMethodsLoader';\n\n private readonly __paymentPresetLoaderId = 'paymentPresetLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\n\n private readonly __threeDSecureResponseGetValue = () => {\n return this.form.config_3d_secure?.endsWith('require_valid_response');\n };\n\n private readonly __threeDSecureResponseSetValue = (newValue: boolean) => {\n const postfix = newValue ? '_require_valid_response' : '';\n const config = this.form.config_3d_secure;\n const type = config?.startsWith('all_cards') ? 'all_cards' : 'maestro_only';\n\n this.edit({ config_3d_secure: `${type}${postfix}` as Data['config_3d_secure'] });\n };\n\n private readonly __threeDSecureToggleGetValue = () => {\n const config = this.form.config_3d_secure;\n\n if (config?.startsWith('all_cards')) return 'all_cards';\n if (config?.startsWith('maestro_only')) return 'maestro_only';\n\n return 'off';\n };\n\n private readonly __threeDSecureToggleSetValue = (\n newValue: 'off' | 'all_cards' | 'maestro_only'\n ) => {\n let newFormValue = '';\n\n if (newValue === 'all_cards' || newValue === 'maestro_only') {\n if (this.form.config_3d_secure?.endsWith('require_valid_response')) {\n newFormValue = `${newValue}_require_valid_response`;\n } else {\n newFormValue = newValue;\n }\n }\n\n this.edit({ config_3d_secure: newFormValue as Data['config_3d_secure'] });\n };\n\n private readonly __threeDSecureToggleOptions = [\n { value: 'off', label: 'option_off' },\n { value: 'all_cards', label: 'option_all_cards' },\n { value: 'maestro_only', label: 'option_maestro_only' },\n ];\n\n private readonly __cardVerificationOptions = [\n { label: 'option_disabled', value: 'disabled' },\n { label: 'option_enabled_automatically', value: 'enabled_automatically' },\n { label: 'option_enabled_override', value: 'enabled_override' },\n ];\n\n private __search = '';\n\n get hiddenSelector(): BooleanSelector {\n return new BooleanSelector(`header:copy-json ${super.hiddenSelector}`.trimEnd());\n }\n\n renderHeader(...params: Parameters<InternalForm<Data>['renderHeader']>): TemplateResult {\n return html`\n <div>\n ${super.renderHeader(...params)}\n ${this.data?.type || !this.form.type\n ? html``\n : html`\n <vaadin-button\n data-testid=\"select-another-button\"\n theme=\"tertiary-inline\"\n @click=${() => this.undo()}\n >\n <foxy-i18n infer=\"\" key=\"select_another_button_label\"></foxy-i18n>\n </vaadin-button>\n `}\n </div>\n `;\n }\n\n get headerTitleOptions(): Record<string, unknown> {\n return {\n context: this.form.type ? 'selected' : 'new',\n name: this.form.helper?.name,\n };\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n if (this.href) {\n const vId = getResourceId(this.href) as string;\n const id = this.headerCopyIdValue;\n if (vId.startsWith('R')) return { context: 'regular', id };\n return { context: 'hosted', id };\n }\n\n return {};\n }\n\n get headerCopyIdValue(): string | number {\n if (this.href) {\n const id = getResourceId(this.href) as string;\n return id.startsWith('R') ? id.slice(1) : id.slice(1).split('C')[0];\n } else {\n return '';\n }\n }\n\n renderBody(): TemplateResult {\n const paymentPreset = this.__paymentPresetLoader?.data;\n\n const loaders = html`\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(paymentPreset?._links['fx:available_payment_methods'].href)}\n id=${this.__availablePaymentMethodsLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.store)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.paymentPreset)}\n id=${this.__paymentPresetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n\n return html`${this.renderHeader()}${this.form.type\n ? this.__renderPaymentMethodConfig()\n : this.__renderPaymentMethodSelector()}${loaders}`;\n }\n\n private get __groupedAvailablePaymentMethods() {\n const allMethods = Object.entries(this.__availablePaymentMethods ?? {});\n const filteredMethods = this.__search\n ? new Fuse(allMethods, { keys: ['1.name'] }).search(this.__search).map(v => v.item)\n : allMethods;\n\n return filteredMethods\n .sort((a, b) => a[0].localeCompare(b[0], 'en'))\n .reduce((groups, [type, helper]) => {\n if (helper.is_deprecated) return groups;\n\n const firstChar = type.charAt(0).toUpperCase();\n const isSpecialCharacter = !/\\w/.test(firstChar);\n const name = isSpecialCharacter ? '#' : firstChar;\n const group = groups.find(group => group.name === name);\n\n if (group) {\n group.items.push({ type, helper });\n } else {\n groups.push({ name, items: [{ type, helper }] });\n }\n\n return groups;\n }, [] as { name: string; items: PaymentMethod[] }[]);\n }\n\n private get __availablePaymentMethodsLoader() {\n type Loader = NucleonElement<AvailablePaymentMethods>;\n return this.renderRoot.querySelector<Loader>(`#${this.__availablePaymentMethodsLoaderId}`);\n }\n\n private get __availablePaymentMethods() {\n return this.__availablePaymentMethodsLoader?.data?.values;\n }\n\n private get __paymentPresetLoader() {\n type Loader = NucleonElement<PaymentPreset>;\n return this.renderRoot.querySelector<Loader>(`#${this.__paymentPresetLoaderId}`);\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__storeLoaderId}`);\n }\n\n private get __liveBlocks() {\n return this.form.helper?.additional_fields?.blocks.filter(block => block.is_live) ?? [];\n }\n\n private get __testBlocks() {\n return this.form.helper?.additional_fields?.blocks.filter(block => !block.is_live) ?? [];\n }\n\n private __renderPaymentMethodSelector() {\n const loader = this.__availablePaymentMethodsLoader;\n\n if (!loader?.data) {\n return html`\n <foxy-spinner infer=\"list-spinner\" state=${loader?.in('fail') ? 'error' : 'busy'}>\n </foxy-spinner>\n `;\n }\n\n return html`\n <div>\n <input\n placeholder=${this.t('search_placeholder')}\n class=\"w-full leading-m font-medium bg-contrast-5 rounded text-body transition-colors hover-bg-contrast-10 focus-bg-contrast-10 focus-outline-none focus-ring-2 focus-ring-primary-50\"\n style=\"padding: var(--lumo-space-xs) calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n type=\"search\"\n .value=${this.__search}\n @input=${(evt: Event) => {\n this.__search = (evt.currentTarget as HTMLInputElement).value;\n }}\n />\n\n <section data-testid=\"select-method-list\">\n ${this.__groupedAvailablePaymentMethods.map(({ name, items }) => {\n return html`\n <p class=\"font-medium text-tertiary py-m\">${name}</p>\n <foxy-internal-summary-control infer=\"\" label=\"\" helper-text=\"\">\n ${items.map((item, index) =>\n this.__renderPaymentMethodButton(item, index, items.length)\n )}\n </foxy-internal-summary-control>\n `;\n })}\n </section>\n </div>\n `;\n }\n\n private __renderPaymentMethodConfig() {\n const oauthGateways = [\n 'stripe_connect',\n 'square_up',\n 'quickbook_payments',\n 'amazon_mws',\n 'paypal_platform',\n ];\n\n if (this.form.type && oauthGateways.includes(this.form.type)) {\n return html`\n <div\n class=\"flex items-start rounded border border-primary\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px); padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n ${svg`<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>`}\n <p>\n <foxy-i18n infer=\"\" key=\"no_oauth_support_message\"></foxy-i18n>\n <br />\n <a\n target=\"_blank\"\n 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\"\n href=\"https://admin.foxycart.com\"\n >\n admin.foxycart.com\n </a>\n </p>\n </div>\n `;\n }\n\n return html`\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"description\">\n </foxy-internal-text-control>\n\n ${this.form.helper?.supports_auth_only\n ? html`\n <foxy-internal-switch-control infer=\"use-auth-only\" helper-text-as-tooltip>\n </foxy-internal-switch-control>\n `\n : ''}\n ${this.form.helper?.supports_3d_secure\n ? html`\n <foxy-internal-select-control\n layout=\"summary-item\"\n infer=\"three-d-secure-toggle\"\n .getValue=${this.__threeDSecureToggleGetValue}\n .setValue=${this.__threeDSecureToggleSetValue}\n .options=${this.__threeDSecureToggleOptions}\n >\n </foxy-internal-select-control>\n\n ${this.form.config_3d_secure\n ? html`\n <foxy-internal-switch-control\n layout=\"summary-item\"\n infer=\"three-d-secure-response\"\n .getValue=${this.__threeDSecureResponseGetValue}\n .setValue=${this.__threeDSecureResponseSetValue}\n >\n </foxy-internal-switch-control>\n `\n : ''}\n `\n : ''}\n </foxy-internal-summary-control>\n\n ${['live', 'test'].map((type, index) => {\n const propertyPrefix = index === 0 ? '' : `${type}_`;\n const inferPrefix = index === 0 ? '' : `${type}-`;\n const blocks = index === 0 ? this.__liveBlocks : this.__testBlocks;\n const scope = `${type}-group`;\n\n if (type === 'live' && !this.__storeLoader?.data) return html``;\n if (type === 'live' && !this.__storeLoader?.data?.is_active) {\n return html`\n <foxy-internal-summary-control infer=\"${type}-group\">\n <div\n class=\"flex items-start\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n ${svg`<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>`}\n <p><foxy-i18n infer=\"\" key=\"inactive_message\"></foxy-i18n></p>\n </div>\n </foxy-internal-summary-control>\n `;\n }\n\n const showInactiveSetText =\n this.__storeLoader?.data?.is_active === true &&\n ((type === 'test' && this.__paymentPresetLoader?.data?.is_live === true) ||\n (type === 'live' && this.__paymentPresetLoader?.data?.is_live === false));\n\n return html`\n <foxy-internal-summary-control\n helper-text=${ifDefined(\n showInactiveSetText ? this.t(`${scope}.helper_text_inactive`) : void 0\n )}\n layout=\"section\"\n label=${ifDefined(showInactiveSetText ? this.t(`${scope}.label_inactive`) : void 0)}\n infer=${scope}\n >\n <foxy-internal-summary-control infer=\"\" label=\"\" helper-text=\"\">\n ${this.form.helper?.id_description\n ? html`\n <foxy-internal-text-control\n placeholder=${this.t('default_additional_field_placeholder')}\n helper-text=\"\"\n layout=\"summary-item\"\n label=${this.form.helper.id_description}\n infer=\"${inferPrefix}account-id\"\n >\n </foxy-internal-text-control>\n `\n : ''}\n ${this.form.helper?.third_party_key_description\n ? html`\n <foxy-internal-password-control\n placeholder=${this.t('default_additional_field_placeholder')}\n helper-text=\"\"\n layout=\"summary-item\"\n label=${this.form.helper.third_party_key_description}\n infer=\"${inferPrefix}third-party-key\"\n >\n </foxy-internal-password-control>\n `\n : ''}\n ${this.form.helper?.key_description\n ? html`\n <foxy-internal-password-control\n placeholder=${this.t('default_additional_field_placeholder')}\n layout=\"summary-item\"\n helper-text=\"\"\n label=${this.form.helper.key_description}\n infer=\"${inferPrefix}account-key\"\n >\n </foxy-internal-password-control>\n `\n : ''}\n ${blocks.map(block => this.__renderBlock(block))}\n ${\n // @ts-expect-error SDK typings are incomplete\n this.form.helper?.supports_card_verification\n ? html`\n <foxy-internal-select-control\n helper-text=${this.t(\n `${scope}.${inferPrefix}card-verification.helper_text_${\n // @ts-expect-error SDK typings are incomplete\n this.form[`${propertyPrefix}card_verification`] || 'disabled'\n }`\n )}\n layout=\"summary-item\"\n infer=\"${inferPrefix}card-verification\"\n .options=${this.__cardVerificationOptions}\n .getValue=${() => {\n // @ts-expect-error SDK typings are incomplete\n return this.form[`${propertyPrefix}card_verification`] || 'disabled';\n }}\n >\n </foxy-internal-select-control>\n `\n : ''\n }\n </foxy-internal-summary-control>\n\n ${\n // @ts-expect-error SDK typings are incomplete\n this.form.helper?.supports_card_verification &&\n // @ts-expect-error SDK typings are incomplete\n this.form[`${propertyPrefix}card_verification`]?.startsWith('enabled_')\n ? html`\n <foxy-internal-summary-control\n layout=\"details\"\n class=\"mt-s\"\n infer=\"${inferPrefix}card-verification-config\"\n >\n ${['visa', 'mastercard', 'american-express', 'discover', 'default'].map(\n type => {\n return html`\n <foxy-internal-number-control\n json-template=${ifDefined(\n // @ts-expect-error SDK typings are incomplete\n this.form.helper?.card_verification_config\n )}\n json-path=\"verification_amounts.${type.replace(/-/g, '_')}\"\n property=\"${propertyPrefix}card_verification_config\"\n layout=\"summary-item\"\n suffix=\"¤\"\n infer=\"${inferPrefix}card-verification-config-verification-amounts-${type}\"\n step=\"0.01\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n `;\n }\n )}\n </foxy-internal-summary-control>\n `\n : ''\n }\n </foxy-internal-summary-control>\n `;\n })}\n ${super.renderBody()}\n `;\n }\n\n private __renderPaymentMethodButton(\n { type, helper }: PaymentMethod,\n index: number,\n total: number\n ) {\n const defaultSrc = PaymentsApiPaymentMethodForm.defaultImageSrc;\n const src = this.getImageSrc?.(type) ?? defaultSrc;\n const onError = (evt: Event) => ((evt.currentTarget as HTMLImageElement).src = defaultSrc);\n\n return html`\n <button\n class=${classMap({\n 'relative w-full block text-left bg-contrast-5 overflow-hidden': true,\n 'focus-outline-none focus-ring-inset focus-ring-2 focus-ring-primary-50': true,\n 'transition-colors hover-bg-contrast-10': !helper.conflict,\n 'cursor-default': !!helper.conflict,\n 'rounded-t': index === 0,\n 'rounded-b': index === total - 1,\n })}\n ?disabled=${!!helper.conflict}\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n @click=${() => this.edit({ type, helper })}\n >\n <figure\n class=\"relative flex items-center\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <img\n class=${classMap({\n 'h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs': true,\n 'filter grayscale': !!helper.conflict,\n })}\n src=${src}\n alt=\"\"\n @error=${onError}\n />\n <figcaption\n class=${classMap({\n 'min-w-0 flex-1 grid leading-xs': true,\n 'text-disabled': !!helper.conflict,\n })}\n >\n <span class=\"font-medium\">${helper.name}&ZeroWidthSpace;</span>\n ${helper.conflict\n ? html`<span class=\"text-xs\"> ${this.t('conflict_message', helper.conflict)}</span>`\n : ''}\n </figcaption>\n </figure>\n </button>\n `;\n }\n\n private __renderBlock(block: Block) {\n return html`${block.fields.map(field => {\n if (field.type === 'hidden') return;\n const scope = ['additional-fields', field.id].join('-').replace(/_/g, '-');\n\n const getValue = () => {\n try {\n const config = JSON.parse(this.form.additional_fields ?? '{}');\n return get(config, field.id) ?? config.default_value;\n } catch {\n return field.default_value;\n }\n };\n\n const setValue = (newValue: unknown) => {\n let config: Record<string, unknown> = {};\n\n try {\n config = JSON.parse(this.form.additional_fields ?? '');\n } catch {\n // ignore\n }\n\n this.edit({ additional_fields: JSON.stringify(set(config, field.id, newValue)) });\n };\n\n type Option = { name: string; value: string };\n const options = (field as { options?: Option[] }).options;\n\n return html`\n ${field.type === 'checkbox'\n ? html`\n <foxy-internal-switch-control\n helper-text=${field.description ?? ''}\n label=${field.name}\n infer=${scope}\n helper-text-as-tooltip\n .getValue=${getValue}\n .setValue=${setValue}\n >\n </foxy-internal-switch-control>\n `\n : field.type === 'select'\n ? html`\n <foxy-internal-select-control\n placeholder=${this.t('default_additional_field_select_placeholder')}\n helper-text=${field.description ?? ''}\n layout=\"summary-item\"\n label=${field.name}\n infer=${scope}\n .options=${options!.map(({ name, value }) => ({ label: name, value }))}\n .getValue=${getValue}\n .setValue=${setValue}\n >\n </foxy-internal-select-control>\n `\n : html`\n <foxy-internal-text-control\n helper-text=${field.description ?? ''}\n placeholder=${field.default_value || this.t('default_additional_field_placeholder')}\n layout=\"summary-item\"\n label=${field.name}\n infer=${scope}\n .getValue=${getValue}\n .setValue=${setValue}\n >\n </foxy-internal-text-control>\n `}\n `;\n })}`;\n }\n}\n"]}
1
+ {"version":3,"file":"PaymentsApiPaymentMethodForm.js","sourceRoot":"","sources":["../../../../src/elements/public/PaymentsApiPaymentMethodForm/PaymentsApiPaymentMethodForm.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EA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CAAC,6CAA6C,CAAC;8BACrD,MAAA,KAAK,CAAC,WAAW,mCAAI,EAAE;;wBAE7B,KAAK,CAAC,IAAI;wBACV,KAAK;2BACF,OAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;4BAC1D,QAAQ;4BACR,QAAQ;;;aAGvB;oBACH,CAAC,CAAC,IAAI,CAAA;;8BAEc,MAAA,KAAK,CAAC,WAAW,mCAAI,EAAE;8BACvB,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC,CAAC,CAAC,sCAAsC,CAAC;;wBAE3E,KAAK,CAAC,IAAI;wBACV,KAAK;4BACD,QAAQ;4BACR,QAAQ;;;aAGvB;OACN,CAAC;QACJ,CAAC,CAAC,EAAE,CAAC;IACP,CAAC;CACF","sourcesContent":["import type { AvailablePaymentMethods, PaymentPreset } from '../PaymentsApi/api/types';\nimport type { Block, Data } from './types';\nimport type { PropertyDeclarations } from 'lit-element';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { BooleanSelector, getResourceId } from '@foxy.io/sdk/core';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html, svg } from 'lit-html';\nimport { classMap } from '../../../utils/class-map';\n\nimport Fuse from 'fuse.js';\nimport has from 'lodash-es/has';\nimport get from 'lodash-es/get';\nimport set from 'lodash-es/set';\n\ntype PaymentMethod = {\n helper: AvailablePaymentMethods['values'][string];\n type: string;\n};\n\nconst NS = 'payments-api-payment-method-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\n/**\n * Form element for the `fx:payment_method` resource of Payments API.\n *\n * _Payments API is a client-side virtual API layer built on top of hAPI\n * in an attempt to streamline access to stores' payment method settings\n * that is currently a bit quirky due to the legacy functionality. To use\n * this element with hAPI, wrap it into a foxy-payments-api node._\n *\n * @element foxy-payments-api-payment-method-form\n * @since 1.21.0\n */\nexport class PaymentsApiPaymentMethodForm extends Base<Data> {\n static get defaultImageSrc(): string {\n 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\";\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n paymentPreset: { attribute: 'payment-preset' },\n getImageSrc: { attribute: false },\n store: {},\n __search: { attribute: false },\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ description: v }) => !v || v.length <= 100 || 'description:v8n_too_long',\n ({ type: v }) => !!v || 'type:v8n_required',\n\n form => {\n const blocks = form.helper?.additional_fields?.blocks ?? [];\n let additionalFields: Record<string, unknown>;\n\n try {\n additionalFields = JSON.parse(form.additional_fields ?? '{}');\n } catch {\n additionalFields = {};\n }\n\n for (const block of blocks) {\n for (const field of block.fields) {\n if ('optional' in (field as Record<string, unknown>)) {\n if (!(field as Record<string, unknown>).optional) {\n if (!has(additionalFields, field.id)) {\n if (field.type !== 'checkbox') {\n return 'additional-fields:v8n_invalid';\n }\n }\n }\n }\n }\n }\n\n return true;\n },\n ];\n }\n\n /** URL of the linked `fx:payment_preset` resource from the virtual Payments API. */\n paymentPreset: string | null = null;\n\n /** A function that returns a URL of a payment method icon based on the given type. */\n getImageSrc: ((type: string) => string) | null = null;\n\n /** URL of the linked `fx:store` resource. */\n store: string | null = null;\n\n private readonly __availablePaymentMethodsLoaderId = 'availablePaymentMethodsLoader';\n\n private readonly __paymentPresetLoaderId = 'paymentPresetLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\n\n private readonly __threeDSecureResponseGetValue = () => {\n return this.form.config_3d_secure?.endsWith('require_valid_response');\n };\n\n private readonly __threeDSecureResponseSetValue = (newValue: boolean) => {\n const postfix = newValue ? '_require_valid_response' : '';\n const config = this.form.config_3d_secure;\n const type = config?.startsWith('all_cards') ? 'all_cards' : 'maestro_only';\n\n this.edit({ config_3d_secure: `${type}${postfix}` as Data['config_3d_secure'] });\n };\n\n private readonly __threeDSecureToggleGetValue = () => {\n const config = this.form.config_3d_secure;\n\n if (config?.startsWith('all_cards')) return 'all_cards';\n if (config?.startsWith('maestro_only')) return 'maestro_only';\n\n return 'off';\n };\n\n private readonly __threeDSecureToggleSetValue = (\n newValue: 'off' | 'all_cards' | 'maestro_only'\n ) => {\n let newFormValue = '';\n\n if (newValue === 'all_cards' || newValue === 'maestro_only') {\n if (this.form.config_3d_secure?.endsWith('require_valid_response')) {\n newFormValue = `${newValue}_require_valid_response`;\n } else {\n newFormValue = newValue;\n }\n }\n\n this.edit({ config_3d_secure: newFormValue as Data['config_3d_secure'] });\n };\n\n private readonly __threeDSecureToggleOptions = [\n { value: 'off', label: 'option_off' },\n { value: 'all_cards', label: 'option_all_cards' },\n { value: 'maestro_only', label: 'option_maestro_only' },\n ];\n\n private readonly __cardVerificationOptions = [\n { label: 'option_disabled', value: 'disabled' },\n { label: 'option_enabled_automatically', value: 'enabled_automatically' },\n { label: 'option_enabled_override', value: 'enabled_override' },\n ];\n\n private __search = '';\n\n get hiddenSelector(): BooleanSelector {\n return new BooleanSelector(`header:copy-json ${super.hiddenSelector}`.trimEnd());\n }\n\n renderHeader(...params: Parameters<InternalForm<Data>['renderHeader']>): TemplateResult {\n return html`\n <div>\n ${super.renderHeader(...params)}\n ${this.data?.type || !this.form.type\n ? html``\n : html`\n <vaadin-button\n data-testid=\"select-another-button\"\n theme=\"tertiary-inline\"\n @click=${() => this.undo()}\n >\n <foxy-i18n infer=\"\" key=\"select_another_button_label\"></foxy-i18n>\n </vaadin-button>\n `}\n </div>\n `;\n }\n\n get headerTitleOptions(): Record<string, unknown> {\n return {\n context: this.form.type ? 'selected' : 'new',\n name: this.form.helper?.name,\n };\n }\n\n get headerSubtitleOptions(): Record<string, unknown> {\n if (this.href) {\n const vId = getResourceId(this.href) as string;\n const id = this.headerCopyIdValue;\n if (vId.startsWith('R')) return { context: 'regular', id };\n return { context: 'hosted', id };\n }\n\n return {};\n }\n\n get headerCopyIdValue(): string | number {\n if (this.href) {\n const id = getResourceId(this.href) as string;\n return id.startsWith('R') ? id.slice(1) : id.slice(1).split('C')[0];\n } else {\n return '';\n }\n }\n\n renderBody(): TemplateResult {\n const paymentPreset = this.__paymentPresetLoader?.data;\n\n const loaders = html`\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(paymentPreset?._links['fx:available_payment_methods'].href)}\n id=${this.__availablePaymentMethodsLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.store)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.paymentPreset)}\n id=${this.__paymentPresetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n `;\n\n return html`${this.renderHeader()}${this.form.type\n ? this.__renderPaymentMethodConfig()\n : this.__renderPaymentMethodSelector()}${loaders}`;\n }\n\n private get __groupedAvailablePaymentMethods() {\n const allMethods = Object.entries(this.__availablePaymentMethods ?? {});\n const filteredMethods = this.__search\n ? new Fuse(allMethods, { keys: ['1.name'], threshold: 0.25 })\n .search(this.__search)\n .map(v => v.item)\n : allMethods;\n\n return filteredMethods\n .sort((a, b) => a[0].localeCompare(b[0], 'en'))\n .reduce((groups, [type, helper]) => {\n if (helper.is_deprecated) return groups;\n\n const firstChar = type.charAt(0).toUpperCase();\n const isSpecialCharacter = !/\\w/.test(firstChar);\n const name = isSpecialCharacter ? '#' : firstChar;\n const group = groups.find(group => group.name === name);\n\n if (group) {\n group.items.push({ type, helper });\n } else {\n groups.push({ name, items: [{ type, helper }] });\n }\n\n return groups;\n }, [] as { name: string; items: PaymentMethod[] }[]);\n }\n\n private get __availablePaymentMethodsLoader() {\n type Loader = NucleonElement<AvailablePaymentMethods>;\n return this.renderRoot.querySelector<Loader>(`#${this.__availablePaymentMethodsLoaderId}`);\n }\n\n private get __availablePaymentMethods() {\n return this.__availablePaymentMethodsLoader?.data?.values;\n }\n\n private get __paymentPresetLoader() {\n type Loader = NucleonElement<PaymentPreset>;\n return this.renderRoot.querySelector<Loader>(`#${this.__paymentPresetLoaderId}`);\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__storeLoaderId}`);\n }\n\n private get __liveBlocks() {\n return this.form.helper?.additional_fields?.blocks.filter(block => block.is_live) ?? [];\n }\n\n private get __testBlocks() {\n return this.form.helper?.additional_fields?.blocks.filter(block => !block.is_live) ?? [];\n }\n\n private __renderPaymentMethodSelector() {\n const loader = this.__availablePaymentMethodsLoader;\n\n if (!loader?.data) {\n return html`\n <foxy-spinner infer=\"list-spinner\" state=${loader?.in('fail') ? 'error' : 'busy'}>\n </foxy-spinner>\n `;\n }\n\n return html`\n <div>\n <input\n placeholder=${this.t('search_placeholder')}\n class=\"w-full leading-m font-medium bg-contrast-5 rounded text-body transition-colors hover-bg-contrast-10 focus-bg-contrast-10 focus-outline-none focus-ring-2 focus-ring-primary-50\"\n style=\"padding: var(--lumo-space-xs) calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n type=\"search\"\n .value=${this.__search}\n @input=${(evt: Event) => {\n this.__search = (evt.currentTarget as HTMLInputElement).value;\n }}\n />\n\n <section data-testid=\"select-method-list\">\n ${this.__groupedAvailablePaymentMethods.map(({ name, items }) => {\n return html`\n <p class=\"font-medium text-tertiary py-m\">${name}</p>\n <foxy-internal-summary-control infer=\"\" label=\"\" helper-text=\"\">\n ${items.map((item, index) =>\n this.__renderPaymentMethodButton(item, index, items.length)\n )}\n </foxy-internal-summary-control>\n `;\n })}\n </section>\n </div>\n `;\n }\n\n private __renderPaymentMethodConfig() {\n const oauthGateways = [\n 'stripe_connect',\n 'square_up',\n 'quickbook_payments',\n 'amazon_mws',\n 'paypal_platform',\n ];\n\n if (this.form.type && oauthGateways.includes(this.form.type)) {\n return html`\n <div\n class=\"flex items-start rounded border border-primary\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px); padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n ${svg`<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>`}\n <p>\n <foxy-i18n infer=\"\" key=\"no_oauth_support_message\"></foxy-i18n>\n <br />\n <a\n target=\"_blank\"\n 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\"\n href=\"https://admin.foxycart.com\"\n >\n admin.foxycart.com\n </a>\n </p>\n </div>\n `;\n }\n\n return html`\n <foxy-internal-summary-control infer=\"general\">\n <foxy-internal-text-control layout=\"summary-item\" infer=\"description\">\n </foxy-internal-text-control>\n\n ${this.form.helper?.supports_auth_only\n ? html`\n <foxy-internal-switch-control infer=\"use-auth-only\" helper-text-as-tooltip>\n </foxy-internal-switch-control>\n `\n : ''}\n ${this.form.helper?.supports_3d_secure\n ? html`\n <foxy-internal-select-control\n layout=\"summary-item\"\n infer=\"three-d-secure-toggle\"\n .getValue=${this.__threeDSecureToggleGetValue}\n .setValue=${this.__threeDSecureToggleSetValue}\n .options=${this.__threeDSecureToggleOptions}\n >\n </foxy-internal-select-control>\n\n ${this.form.config_3d_secure\n ? html`\n <foxy-internal-switch-control\n layout=\"summary-item\"\n infer=\"three-d-secure-response\"\n .getValue=${this.__threeDSecureResponseGetValue}\n .setValue=${this.__threeDSecureResponseSetValue}\n >\n </foxy-internal-switch-control>\n `\n : ''}\n `\n : ''}\n </foxy-internal-summary-control>\n\n ${['live', 'test'].map((type, index) => {\n const propertyPrefix = index === 0 ? '' : `${type}_`;\n const inferPrefix = index === 0 ? '' : `${type}-`;\n const blocks = index === 0 ? this.__liveBlocks : this.__testBlocks;\n const scope = `${type}-group`;\n\n if (type === 'live' && !this.__storeLoader?.data) return html``;\n if (type === 'live' && !this.__storeLoader?.data?.is_active) {\n return html`\n <foxy-internal-summary-control infer=\"${type}-group\">\n <div\n class=\"flex items-start\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n ${svg`<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>`}\n <p><foxy-i18n infer=\"\" key=\"inactive_message\"></foxy-i18n></p>\n </div>\n </foxy-internal-summary-control>\n `;\n }\n\n const showInactiveSetText =\n this.__storeLoader?.data?.is_active === true &&\n ((type === 'test' && this.__paymentPresetLoader?.data?.is_live === true) ||\n (type === 'live' && this.__paymentPresetLoader?.data?.is_live === false));\n\n return html`\n <foxy-internal-summary-control\n helper-text=${ifDefined(\n showInactiveSetText ? this.t(`${scope}.helper_text_inactive`) : void 0\n )}\n layout=\"section\"\n label=${ifDefined(showInactiveSetText ? this.t(`${scope}.label_inactive`) : void 0)}\n infer=${scope}\n >\n <foxy-internal-summary-control infer=\"\" label=\"\" helper-text=\"\">\n ${this.form.helper?.id_description\n ? html`\n <foxy-internal-text-control\n placeholder=${this.t('default_additional_field_placeholder')}\n helper-text=\"\"\n layout=\"summary-item\"\n label=${this.form.helper.id_description}\n infer=\"${inferPrefix}account-id\"\n >\n </foxy-internal-text-control>\n `\n : ''}\n ${this.form.helper?.third_party_key_description\n ? html`\n <foxy-internal-password-control\n placeholder=${this.t('default_additional_field_placeholder')}\n helper-text=\"\"\n layout=\"summary-item\"\n label=${this.form.helper.third_party_key_description}\n infer=\"${inferPrefix}third-party-key\"\n >\n </foxy-internal-password-control>\n `\n : ''}\n ${this.form.helper?.key_description\n ? html`\n <foxy-internal-password-control\n placeholder=${this.t('default_additional_field_placeholder')}\n layout=\"summary-item\"\n helper-text=\"\"\n label=${this.form.helper.key_description}\n infer=\"${inferPrefix}account-key\"\n >\n </foxy-internal-password-control>\n `\n : ''}\n ${blocks.map(block => this.__renderBlock(block))}\n ${\n // @ts-expect-error SDK typings are incomplete\n this.form.helper?.supports_card_verification\n ? html`\n <foxy-internal-select-control\n helper-text=${this.t(\n `${scope}.${inferPrefix}card-verification.helper_text_${\n // @ts-expect-error SDK typings are incomplete\n this.form[`${propertyPrefix}card_verification`] || 'disabled'\n }`\n )}\n layout=\"summary-item\"\n infer=\"${inferPrefix}card-verification\"\n .options=${this.__cardVerificationOptions}\n .getValue=${() => {\n // @ts-expect-error SDK typings are incomplete\n return this.form[`${propertyPrefix}card_verification`] || 'disabled';\n }}\n >\n </foxy-internal-select-control>\n `\n : ''\n }\n </foxy-internal-summary-control>\n\n ${\n // @ts-expect-error SDK typings are incomplete\n this.form.helper?.supports_card_verification &&\n // @ts-expect-error SDK typings are incomplete\n this.form[`${propertyPrefix}card_verification`]?.startsWith('enabled_')\n ? html`\n <foxy-internal-summary-control\n layout=\"details\"\n class=\"mt-s\"\n infer=\"${inferPrefix}card-verification-config\"\n >\n ${['visa', 'mastercard', 'american-express', 'discover', 'default'].map(\n type => {\n return html`\n <foxy-internal-number-control\n json-template=${ifDefined(\n // @ts-expect-error SDK typings are incomplete\n this.form.helper?.card_verification_config\n )}\n json-path=\"verification_amounts.${type.replace(/-/g, '_')}\"\n property=\"${propertyPrefix}card_verification_config\"\n layout=\"summary-item\"\n suffix=\"¤\"\n infer=\"${inferPrefix}card-verification-config-verification-amounts-${type}\"\n step=\"0.01\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n `;\n }\n )}\n </foxy-internal-summary-control>\n `\n : ''\n }\n </foxy-internal-summary-control>\n `;\n })}\n ${super.renderBody()}\n `;\n }\n\n private __renderPaymentMethodButton(\n { type, helper }: PaymentMethod,\n index: number,\n total: number\n ) {\n const defaultSrc = PaymentsApiPaymentMethodForm.defaultImageSrc;\n const src = this.getImageSrc?.(type) ?? defaultSrc;\n const onError = (evt: Event) => ((evt.currentTarget as HTMLImageElement).src = defaultSrc);\n\n return html`\n <button\n class=${classMap({\n 'relative w-full block text-left bg-contrast-5 overflow-hidden': true,\n 'focus-outline-none focus-ring-inset focus-ring-2 focus-ring-primary-50': true,\n 'transition-colors hover-bg-contrast-10': !helper.conflict,\n 'cursor-default': !!helper.conflict,\n 'rounded-t': index === 0,\n 'rounded-b': index === total - 1,\n })}\n ?disabled=${!!helper.conflict}\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n @click=${() => this.edit({ type, helper })}\n >\n <figure\n class=\"relative flex items-center\"\n style=\"gap: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <img\n class=${classMap({\n 'h-m w-m object-cover rounded-full bg-contrast-20 flex-shrink-0 shadow-xs': true,\n 'filter grayscale': !!helper.conflict,\n })}\n src=${src}\n alt=\"\"\n @error=${onError}\n />\n <figcaption\n class=${classMap({\n 'min-w-0 flex-1 grid leading-xs': true,\n 'text-disabled': !!helper.conflict,\n })}\n >\n <span class=\"font-medium\">${helper.name}&ZeroWidthSpace;</span>\n ${helper.conflict\n ? html`<span class=\"text-xs\"> ${this.t('conflict_message', helper.conflict)}</span>`\n : ''}\n </figcaption>\n </figure>\n </button>\n `;\n }\n\n private __renderBlock(block: Block) {\n return html`${block.fields.map(field => {\n if (field.type === 'hidden') return;\n const scope = ['additional-fields', field.id].join('-').replace(/_/g, '-');\n\n const getValue = () => {\n try {\n const config = JSON.parse(this.form.additional_fields ?? '{}');\n return get(config, field.id) ?? config.default_value;\n } catch {\n return field.default_value;\n }\n };\n\n const setValue = (newValue: unknown) => {\n let config: Record<string, unknown> = {};\n\n try {\n config = JSON.parse(this.form.additional_fields ?? '');\n } catch {\n // ignore\n }\n\n this.edit({ additional_fields: JSON.stringify(set(config, field.id, newValue)) });\n };\n\n type Option = { name: string; value: string };\n const options = (field as { options?: Option[] }).options;\n\n return html`\n ${field.type === 'checkbox'\n ? html`\n <foxy-internal-switch-control\n helper-text=${field.description ?? ''}\n label=${field.name}\n infer=${scope}\n helper-text-as-tooltip\n .getValue=${getValue}\n .setValue=${setValue}\n >\n </foxy-internal-switch-control>\n `\n : field.type === 'select'\n ? html`\n <foxy-internal-select-control\n placeholder=${this.t('default_additional_field_select_placeholder')}\n helper-text=${field.description ?? ''}\n layout=\"summary-item\"\n label=${field.name}\n infer=${scope}\n .options=${options!.map(({ name, value }) => ({ label: name, value }))}\n .getValue=${getValue}\n .setValue=${setValue}\n >\n </foxy-internal-select-control>\n `\n : html`\n <foxy-internal-text-control\n helper-text=${field.description ?? ''}\n placeholder=${field.default_value || this.t('default_additional_field_placeholder')}\n layout=\"summary-item\"\n label=${field.name}\n infer=${scope}\n .getValue=${getValue}\n .setValue=${setValue}\n >\n </foxy-internal-text-control>\n `}\n `;\n })}`;\n }\n}\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foxy.io/elements",
3
3
  "type": "module",
4
- "version": "1.44.0-beta.1",
4
+ "version": "1.44.0",
5
5
  "description": "E-commerce web components by Foxy.",
6
6
  "repository": {
7
7
  "type": "git",