@foxy.io/elements 1.25.0 → 1.26.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-admin-subscription-card.js +1 -1
- package/dist/cdn/foxy-cart-card.js +1 -1
- package/dist/cdn/foxy-customer-portal.js +3 -3
- package/dist/cdn/foxy-payments-api.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +1 -1
- package/dist/cdn/translations/cart-card/en.json +1 -3
- package/dist/cdn/translations/store-form/en.json +1 -1
- package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.d.ts +3 -0
- package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.js +36 -3
- package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.js.map +1 -1
- package/dist/elements/public/AdminSubscriptionCard/types.d.ts +5 -3
- package/dist/elements/public/AdminSubscriptionCard/types.js.map +1 -1
- package/dist/elements/public/CartCard/CartCard.d.ts +0 -1
- package/dist/elements/public/CartCard/CartCard.js +13 -10
- package/dist/elements/public/CartCard/CartCard.js.map +1 -1
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js +0 -4
- package/dist/elements/public/CustomerPortal/InternalCustomerPortalLoggedOutView.js.map +1 -1
- package/dist/elements/public/PaymentsApi/api/composers/available_fraud_protections.js +1 -1
- package/dist/elements/public/PaymentsApi/api/composers/available_fraud_protections.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.d.ts +5 -0
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +13 -0
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/types.d.ts +2 -0
- package/dist/elements/public/TemplateConfigForm/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-2cf08dd4.js";import"./foxy-nucleon-element.js";import"./shared-029816d7.js";import{_ as e}from"./shared-1522d76f.js";import{a as t}from"./shared-5fa697c4.js";import{C as r}from"./shared-b23c903e.js";import{p as i}from"./shared-4c650e5c.js";import{I as s}from"./shared-e91453df.js";import{i as a}from"./shared-d3bf9ac0.js";import{h as o}from"./shared-7f33a83a.js";import"./foxy-spinner.js";import"./shared-ff9791cf.js";import"./shared-43f449bb.js";import"./shared-30d00b64.js";import"./shared-30cbf0a6.js";import"./shared-343d1fd7.js";import"./shared-6a7f96c4.js";import"./shared-07e9d1fb.js";import"./shared-3ab0306f.js";import"./shared-eb116b3e.js";import"./shared-4e709717.js";let n,
|
|
1
|
+
import"./shared-2cf08dd4.js";import"./foxy-nucleon-element.js";import"./shared-029816d7.js";import{_ as e}from"./shared-1522d76f.js";import{a as t}from"./shared-5fa697c4.js";import{C as r}from"./shared-b23c903e.js";import{p as i}from"./shared-4c650e5c.js";import{I as s}from"./shared-e91453df.js";import{i as a}from"./shared-d3bf9ac0.js";import{h as o}from"./shared-7f33a83a.js";import"./foxy-spinner.js";import"./shared-ff9791cf.js";import"./shared-43f449bb.js";import"./shared-30d00b64.js";import"./shared-30cbf0a6.js";import"./shared-343d1fd7.js";import"./shared-6a7f96c4.js";import"./shared-07e9d1fb.js";import"./shared-3ab0306f.js";import"./shared-eb116b3e.js";import"./shared-4e709717.js";let d,n,l,_,c,u,m,f=e=>e;const h=r(t(s,"admin-subscription-card"));class p extends h{constructor(){super(...arguments),this.localeCodes=null,this.__transactionTemplateLoaderId="transactionTemplateLoader",this.__defaultTemplateSetLoaderId="defaultTemplateSetLoader",this.__localeCodesHelperLoaderId="localeCodesLoader",this.__templateSetLoaderId="templateSetLoader",this.__customerLoaderId="customerLoader",this.__itemsLoaderId="itemsLoader",this.__storeLoaderId="storeLoader"}static get properties(){return e(e({},super.properties),{},{localeCodes:{attribute:"locale-codes"}})}renderBody(){var e;const t=!!(null===(e=this.data)||void 0===e?void 0:e.first_failed_transaction_date),r=this.__customer,i=this.__transactionTemplate,s=this.__priceKey,h=this.__priceOptions,p=this.__summaryOptions,v=this.__summaryKey,y=this.__statusKey,x=this.__statusOptions;return o(d||(d=f` <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> <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> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <div class="text-left leading-s text-tertiary"> <div class="flex items-center space-x-s"> <span class="block flex-1 font-medium text-body truncate"> ${0} </span> <span class="text-s"> ${0} </span> </div> <div class="truncate text-s ${0}"> ${0} </div> <div class="text-tertiary truncate text-s"> ${0} ${0} (${0}) </div> </div> `),a(this.__transactionTemplateHref),this.__transactionTemplateLoaderId,(()=>this.requestUpdate()),a(this.__defaultTemplateSetHref),this.__defaultTemplateSetLoaderId,(()=>this.requestUpdate()),a(this.__localeCodesHelperHref),this.__localeCodesHelperLoaderId,(()=>this.requestUpdate()),a(this.__templateSetHref),this.__templateSetLoaderId,(()=>this.requestUpdate()),a(this.__customerHref),this.__customerLoaderId,(()=>this.requestUpdate()),a(this.__itemsHref),this.__itemsLoaderId,(()=>this.requestUpdate()),a(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),p&&v?o(n||(n=f`<foxy-i18n infer="" key="${0}" .options="${0}"></foxy-i18n>`),v,p):o(l||(l=f`​`)),h&&s?o(_||(_=f`<foxy-i18n infer="" key="${0}" .options="${0}"></foxy-i18n>`),s,h):o(c||(c=f`​`)),t?"text-error":"text-secondary",x&&y?o(u||(u=f`<foxy-i18n infer="" key="${0}" .options="${0}"></foxy-i18n>`),y,x):o(m||(m=f`​`)),null==r?void 0:r.first_name,null==r?void 0:r.last_name,null==i?void 0:i.customer_email)}get isBodyReady(){return super.isBodyReady&&!!this.__items&&!!this.__currencyCode&&!!this.__currencyDisplay&&!!this.__customer}get __transactionTemplateHref(){var e,t;const r=this.data;if(!r)return;if("_embedded"in r&&"fx:transaction_template"in r._embedded)return;const i=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:transaction_template"].href)&&void 0!==t?t:"");return i.searchParams.set("zoom","items"),i.toString()}get __defaultTemplateSetHref(){var e,t,r;if(""===(null===(e=this.__transactionTemplate)||void 0===e?void 0:e.template_set_uri))try{const e=new URL(null!==(r=null===(t=this.__store)||void 0===t?void 0:t._links["fx:template_sets"].href)&&void 0!==r?r:"");return e.searchParams.set("code","DEFAULT"),e.toString()}catch(e){}}get __localeCodesHelperHref(){var e;if(this.__defaultTemplateSetHref||this.__templateSetHref)return null!==(e=this.localeCodes)&&void 0!==e?e:void 0}get __templateSetHref(){const e=this.__transactionTemplate;if(!(null==e?void 0:e.currency_code))return(null==e?void 0:e.template_set_uri)||void 0}get __customerHref(){var e,t,r,i;if(!("fx:customer"in(null!==(t=null===(e=this.data)||void 0===e?void 0:e._embedded)&&void 0!==t?t:{})))return null===(i=null===(r=this.data)||void 0===r?void 0:r._links["fx:customer"])||void 0===i?void 0:i.href}get __itemsHref(){const e=this.__transactionTemplate;if(!e)return;if("_embedded"in e&&"fx:items"in e._embedded)return;const t=new URL(e._links["fx:items"].href);return t.searchParams.set("limit","1"),t.toString()}get __storeHref(){var e,t;return null===(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:store"])||void 0===t?void 0:t.href}get __transactionTemplate(){var e,t;const r=this.data;if(r&&"_embedded"in r&&"fx:transaction_template"in r._embedded)return r._embedded["fx:transaction_template"];{const r=`#${this.__transactionTemplateLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}}get __defaultTemplateSet(){var e,t;const r=`#${this.__defaultTemplateSetLoaderId}`,i=this.renderRoot.querySelector(r);return null!==(t=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e._embedded["fx:template_sets"][0])&&void 0!==t?t:null}get __localeCodesHelper(){var e,t;const r=`#${this.__localeCodesHelperLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __templateSet(){var e,t;const r=`#${this.__templateSetLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __customer(){var e,t;const r=this.data;if(r&&"_embedded"in r&&"fx:customer"in r._embedded)return r._embedded["fx:customer"];{const r=`#${this.__customerLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}}get __items(){const e=this.__transactionTemplate;if(e&&"_embedded"in e&&"fx:items"in e._embedded){const t=e._embedded["fx:items"];return{array:t,count:t.length,isApproximateCount:20===t.length}}const t=this.renderRoot.querySelector(`#${this.__itemsLoaderId}`);return(null==t?void 0:t.data)?{array:t.data._embedded["fx:items"],count:t.data.total_items,isApproximateCount:!1}:null}get __store(){var e,t;const r=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __currencyDisplay(){var e;const t=null===(e=this.__store)||void 0===e?void 0:e.use_international_currency_symbol;return!0===t?"code":!1===t?"symbol":void 0}get __summaryOptions(){var e;const{array:t,count:r}=null!==(e=this.__items)&&void 0!==e?e:{};if(t&&r)return{firstItem:t[0],count:r,countMinus1:r-1}}get __summaryKey(){const e=this.__items;if(e)return e.isApproximateCount?"summary_approximate":"summary"}get __statusOptions(){const e=this.data;if(null!==e)return e.first_failed_transaction_date?{date:e.first_failed_transaction_date}:e.end_date?{date:e.end_date}:!1===e.is_active?{}:new Date(e.start_date)>new Date?{date:e.start_date}:{date:e.next_transaction_date}}get __currencyCode(){var e,t,r;const i=this.__transactionTemplate;if(null==i?void 0:i.currency_code)return i.currency_code;{const i=this.__localeCodesHelper,s=null===(t=null!==(e=this.__templateSet)&&void 0!==e?e:this.__defaultTemplateSet)||void 0===t?void 0:t.locale_code,a=s?null==i?void 0:i.values[s]:void 0;if(a)return null===(r=/Currency: ([A-Z]{3})/g.exec(a))||void 0===r?void 0:r[1]}}get __priceOptions(){var t,r;const s=this.__currencyDisplay;if(void 0===s)return;const a=this.__currencyCode;if(void 0===a)return;const o=null===(t=this.__transactionTemplate)||void 0===t?void 0:t.total_order;if(void 0===o)return;const d=null===(r=this.data)||void 0===r?void 0:r.frequency;return void 0!==d?e(e({},i(d)),{},{amount:`${o} ${a}`,currencyDisplay:s}):void 0}get __statusKey(){const e=this.data;if(null!==e){if(e.first_failed_transaction_date)return"subscription_failed";if(e.end_date){return new Date(e.end_date).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}return!1===e.is_active?"subscription_inactive":new Date(e.start_date)>new Date?"subscription_will_be_active":"subscription_active"}}get __priceKey(){var e;const t=null===(e=this.data)||void 0===e?void 0:e.frequency;if(t)return"price_"+(".5m"===t?"twice_a_month":"recurring")}}customElements.define("foxy-admin-subscription-card",p);export{p as AdminSubscriptionCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-2cf08dd4.js";import"./foxy-nucleon-element.js";import"./shared-029816d7.js";import{_ as e}from"./shared-1522d76f.js";import{
|
|
1
|
+
import"./shared-2cf08dd4.js";import"./foxy-nucleon-element.js";import"./shared-029816d7.js";import{_ as e}from"./shared-1522d76f.js";import{g as t}from"./shared-bab2ea2c.js";import{a as r}from"./shared-5fa697c4.js";import{C as s}from"./shared-b23c903e.js";import{I as i}from"./shared-e91453df.js";import{i as o}from"./shared-d3bf9ac0.js";import{h as d}from"./shared-7f33a83a.js";import"./foxy-spinner.js";import"./shared-ff9791cf.js";import"./shared-43f449bb.js";import"./shared-30d00b64.js";import"./shared-30cbf0a6.js";import"./shared-343d1fd7.js";import"./shared-6a7f96c4.js";import"./shared-07e9d1fb.js";import"./shared-3ab0306f.js";import"./shared-eb116b3e.js";import"./shared-4e709717.js";let a,n,l,_,u,c,f,h,p,m,v=e=>e;const y=s(r(i,"cart-card"));class x extends y{constructor(){super(...arguments),this.localeCodes=null,this.__defaultTemplateSetLoaderId="defaultTemplateSetLoader",this.__localeCodesHelperLoaderId="localeCodesLoader",this.__templateSetLoaderId="templateSetLoader",this.__itemsLoaderId="itemsLoader",this.__storeLoaderId="storeLoader"}static get properties(){return e(e({},super.properties),{},{localeCodes:{type:String,attribute:"locale-codes"}})}renderBody(){const e=this.__statusOptions,t=this.__line1Options,r=this.__line2Options,s=this.__line2Key,i=this.data;return d(a||(a=v` <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> <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> <div class="text-left leading-s"> <div class="flex items-center space-x-s"> <span class="flex-1 font-medium text-body truncate"> ${0} </span> <span class="text-s text-tertiary"> ${0} </span> </div> <div class="truncate text-s text-secondary"> ${0} </div> <div class="text-tertiary truncate text-s"> ${0} </div> </div> `),o(this.__itemsHref),this.__itemsLoaderId,(()=>this.requestUpdate()),o(this.__defaultTemplateSetHref),this.__defaultTemplateSetLoaderId,(()=>this.requestUpdate()),o(this.__localeCodesHelperHref),this.__localeCodesHelperLoaderId,(()=>this.requestUpdate()),o(this.__templateSetHref),this.__templateSetLoaderId,(()=>this.requestUpdate()),o(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),t?d(n||(n=v`<foxy-i18n infer="" key="line_1" .options="${0}"></foxy-i18n>`),t):d(l||(l=v`​`)),i?d(_||(_=v`<foxy-i18n infer="" key="status" .options="${0}"></foxy-i18n>`),e):d(u||(u=v`​`)),s?d(c||(c=v`<foxy-i18n infer="" key="${0}" .options="${0}"></foxy-i18n>`),s,r):d(f||(f=v`​`)),i?i.customer_email?d(h||(h=v`${0}`),i.customer_email):d(p||(p=v`<foxy-i18n infer="" key="no_customer"></foxy-i18n>`)):d(m||(m=v`​`)))}get isBodyReady(){const e=!!this.__line1Options&&!!this.__statusOptions&&!!this.__line2Key;return super.isBodyReady&&e}get __defaultTemplateSetHref(){var e,t,r;if(""===(null===(e=this.data)||void 0===e?void 0:e.template_set_uri))try{const e=new URL(null!==(r=null===(t=this.__store)||void 0===t?void 0:t._links["fx:template_sets"].href)&&void 0!==r?r:"");return e.searchParams.set("code","DEFAULT"),e.toString()}catch(e){}}get __localeCodesHelperHref(){var e;if(this.__defaultTemplateSetHref||this.__templateSetHref)return null!==(e=this.localeCodes)&&void 0!==e?e:void 0}get __templateSetHref(){var e,t;if(!(null===(e=this.data)||void 0===e?void 0:e.currency_code))return(null===(t=this.data)||void 0===t?void 0:t.template_set_uri)||void 0}get __itemsHref(){const e=this.data;if(!e)return;if("_embedded"in e&&"fx:items"in e._embedded)return;const t=new URL(e._links["fx:items"].href);return t.searchParams.set("order","price desc"),t.searchParams.set("limit","1"),t.toString()}get __storeHref(){var e,t;return null===(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:store"])||void 0===t?void 0:t.href}get __defaultTemplateSet(){var e,t;const r=`#${this.__defaultTemplateSetLoaderId}`,s=this.renderRoot.querySelector(r);return null!==(t=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e._embedded["fx:template_sets"][0])&&void 0!==t?t:null}get __localeCodesHelper(){var e,t;const r=`#${this.__localeCodesHelperLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __templateSet(){var e,t;const r=`#${this.__templateSetLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __items(){const e=this.data;if(e&&"_embedded"in e&&"fx:items"in e._embedded){const t=e._embedded["fx:items"];return{array:t,count:t.length,isApproximateCount:20===t.length}}const t=this.renderRoot.querySelector(`#${this.__itemsLoaderId}`);if(null==t?void 0:t.data)return{array:t.data._embedded["fx:items"],count:t.data.total_items,isApproximateCount:!1}}get __store(){var e,t;const r=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __currencyDisplay(){var e;const t=null===(e=this.__store)||void 0===e?void 0:e.use_international_currency_symbol;return!0===t?"code":!1===t?"symbol":void 0}get __currencyCode(){var e,t,r;const s=this.data;if(null==s?void 0:s.currency_code)return s.currency_code;{const s=this.__localeCodesHelper,i=null===(t=null!==(e=this.__templateSet)&&void 0!==e?e:this.__defaultTemplateSet)||void 0===t?void 0:t.locale_code,o=i?null==s?void 0:s.values[i]:void 0;if(o)return null===(r=/Currency: ([A-Z]{3})/g.exec(o))||void 0===r?void 0:r[1]}}get __line1Options(){var e,r,s;const i=null===(e=this.data)||void 0===e?void 0:e.total_order;if(void 0===i)return;const o=this.__currencyDisplay;if(void 0===o)return;const d=this.__currencyCode;if(void 0===d)return;const a=null===(r=this.__items)||void 0===r?void 0:r.count;if(void 0===a)return;const n=null===(s=this.data)||void 0===s?void 0:s._links.self.href;return void 0!==n?{currencyDisplay:o,amount:`${i} ${d}`,count:a,id:t(n)}:void 0}get __line2Options(){var e;return null===(e=this.__items)||void 0===e?void 0:e.array[0]}get __line2Key(){const e=this.__items;if(void 0!==e)return 0===e.count?"line_2_empty":1===e.count?"line_2_one":e.count>1?"line_2_many":void 0}get __statusOptions(){const e=this.data;if(e)return{dateCreated:e.date_created}}}customElements.define("foxy-cart-card",x);export{x as CartCard};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./foxy-customer.js";import"./shared-c7b3d22b.js";import"./shared-30d00b64.js";import"./shared-ff9791cf.js";import"./shared-f9180815.js";import{I as e}from"./shared-ff8ca16b.js";import"./foxy-access-recovery-form.js";import"./foxy-payment-method-card.js";import{TransactionsTable as t}from"./foxy-transactions-table.js";import"./foxy-subscription-card.js";import"./foxy-subscription-form.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-customer-form.js";import"./foxy-sign-in-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import{_ as s,B as r,aj as o}from"./shared-1522d76f.js";import{h as i,L as n,c as a}from"./shared-7f33a83a.js";import{A as d}from"./shared-f1e743df.js";import"./shared-250a399a.js";import{C as l}from"./shared-e8621807.js";import{a as c,T as m}from"./shared-5fa697c4.js";import{i as u}from"./shared-d3bf9ac0.js";import{c as h}from"./shared-4e709717.js";import{A as p}from"./shared-07e9d1fb.js";import{C as f}from"./shared-b23c903e.js";import{I as g}from"./shared-30cbf0a6.js";import"./shared-43f449bb.js";import"./foxy-attribute-card.js";import"./shared-6a7f96c4.js";import"./shared-343d1fd7.js";import"./shared-3ab0306f.js";import"./shared-eb116b3e.js";import"./shared-029816d7.js";import"./foxy-attribute-form.js";import"./shared-9df8f842.js";import"./shared-f9a3d1ff.js";import"./shared-c9ba1b64.js";import"./shared-b509bc2c.js";import"./shared-61ade33e.js";import"./shared-d21fa1a6.js";import"./shared-268571df.js";import"./shared-9c08cfab.js";import"./shared-e39807f8.js";import"./shared-ea527e98.js";import"./shared-99c0ae04.js";import"./shared-ad34b6db.js";import"./shared-4e59fd48.js";import"./shared-2c8c4b43.js";import"./shared-11c2efc8.js";import"./shared-4c124efc.js";import"./shared-2b27e2e7.js";import"./shared-a8dc23f1.js";import"./shared-2bdc99f4.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./foxy-table.js";import"./shared-00c2793e.js";import"./foxy-nucleon-element.js";import"./shared-02bc0368.js";import"./shared-4c650e5c.js";import"./shared-d7be11de.js";import"./foxy-transaction-card.js";import"./shared-2cf08dd4.js";import"./shared-e91453df.js";import"./shared-bab2ea2c.js";import"./shared-fc15a882.js";import"./shared-8201d0b5.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-bed7aae1.js";import"./shared-6a9ae42e.js";import"./foxy-cancellation-form.js";import"./shared-43e2c3f6.js";import"./shared-79d0699c.js";import"./shared-be7bfbb0.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-d519a301.js";import"./shared-2f09d4df.js";import"./shared-ca4c5f0f.js";import"./shared-d57fac94.js";import"./shared-20ba4cdc.js";import"./shared-b738ee96.js";import"./shared-174f37e9.js";import"./shared-4462dc70.js";let $,y,v=e=>e;class b extends(c(m(l),"customer-portal")){constructor(){super(...arguments),this.transactionsTableColumns=[t.priceColumn,t.summaryColumn,t.statusColumn,t.idColumn,t.dateColumn,t.receiptColumn],this.group=""}static get properties(){return s(s({},super.properties),{},{transactionsTableColumns:{attribute:!1},group:{type:String}})}render(){let e;try{e=new URL("./customer_portal_settings",this.base).toString()}catch(t){e=void 0}return this.api.storage.getItem(d.SESSION)?i($||($=v` <foxy-internal-customer-portal-logged-in-view customer="${0}" class="h-full" infer="" href="${0}" .transactionsTableColumns="${0}"> </foxy-internal-customer-portal-logged-in-view> `),this.base,u(e),this.transactionsTableColumns):i(y||(y=v` <foxy-internal-customer-portal-logged-out-view class="h-full" infer="" href="${0}"> </foxy-internal-customer-portal-logged-out-view> `),u(e))}}let S,x,_,j,T=e=>e;class
|
|
1
|
+
import"./foxy-customer.js";import"./shared-c7b3d22b.js";import"./shared-30d00b64.js";import"./shared-ff9791cf.js";import"./shared-f9180815.js";import{I as e}from"./shared-ff8ca16b.js";import"./foxy-access-recovery-form.js";import"./foxy-payment-method-card.js";import{TransactionsTable as t}from"./foxy-transactions-table.js";import"./foxy-subscription-card.js";import"./foxy-subscription-form.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-customer-form.js";import"./foxy-sign-in-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import{_ as s,B as r,aj as o}from"./shared-1522d76f.js";import{h as i,L as n,c as a}from"./shared-7f33a83a.js";import{A as d}from"./shared-f1e743df.js";import"./shared-250a399a.js";import{C as l}from"./shared-e8621807.js";import{a as c,T as m}from"./shared-5fa697c4.js";import{i as u}from"./shared-d3bf9ac0.js";import{c as h}from"./shared-4e709717.js";import{A as p}from"./shared-07e9d1fb.js";import{C as f}from"./shared-b23c903e.js";import{I as g}from"./shared-30cbf0a6.js";import"./shared-43f449bb.js";import"./foxy-attribute-card.js";import"./shared-6a7f96c4.js";import"./shared-343d1fd7.js";import"./shared-3ab0306f.js";import"./shared-eb116b3e.js";import"./shared-029816d7.js";import"./foxy-attribute-form.js";import"./shared-9df8f842.js";import"./shared-f9a3d1ff.js";import"./shared-c9ba1b64.js";import"./shared-b509bc2c.js";import"./shared-61ade33e.js";import"./shared-d21fa1a6.js";import"./shared-268571df.js";import"./shared-9c08cfab.js";import"./shared-e39807f8.js";import"./shared-ea527e98.js";import"./shared-99c0ae04.js";import"./shared-ad34b6db.js";import"./shared-4e59fd48.js";import"./shared-2c8c4b43.js";import"./shared-11c2efc8.js";import"./shared-4c124efc.js";import"./shared-2b27e2e7.js";import"./shared-a8dc23f1.js";import"./shared-2bdc99f4.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./foxy-table.js";import"./shared-00c2793e.js";import"./foxy-nucleon-element.js";import"./shared-02bc0368.js";import"./shared-4c650e5c.js";import"./shared-d7be11de.js";import"./foxy-transaction-card.js";import"./shared-2cf08dd4.js";import"./shared-e91453df.js";import"./shared-bab2ea2c.js";import"./shared-fc15a882.js";import"./shared-8201d0b5.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-bed7aae1.js";import"./shared-6a9ae42e.js";import"./foxy-cancellation-form.js";import"./shared-43e2c3f6.js";import"./shared-79d0699c.js";import"./shared-be7bfbb0.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-d519a301.js";import"./shared-2f09d4df.js";import"./shared-ca4c5f0f.js";import"./shared-d57fac94.js";import"./shared-20ba4cdc.js";import"./shared-b738ee96.js";import"./shared-174f37e9.js";import"./shared-4462dc70.js";let $,y,v=e=>e;class b extends(c(m(l),"customer-portal")){constructor(){super(...arguments),this.transactionsTableColumns=[t.priceColumn,t.summaryColumn,t.statusColumn,t.idColumn,t.dateColumn,t.receiptColumn],this.group=""}static get properties(){return s(s({},super.properties),{},{transactionsTableColumns:{attribute:!1},group:{type:String}})}render(){let e;try{e=new URL("./customer_portal_settings",this.base).toString()}catch(t){e=void 0}return this.api.storage.getItem(d.SESSION)?i($||($=v` <foxy-internal-customer-portal-logged-in-view customer="${0}" class="h-full" infer="" href="${0}" .transactionsTableColumns="${0}"> </foxy-internal-customer-portal-logged-in-view> `),this.base,u(e),this.transactionsTableColumns):i(y||(y=v` <foxy-internal-customer-portal-logged-out-view class="h-full" infer="" href="${0}"> </foxy-internal-customer-portal-logged-out-view> `),u(e))}}let S,x,_,j,T=e=>e;class O extends(m(n)){constructor(){super(...arguments),this.disabled=!1,this.href="",this.icon=""}static get properties(){return s(s({},super.properties),{},{disabled:{type:Boolean},href:{type:String},icon:{type:String}})}render(){const e=h({"flex-auto font-medium tracking-wide text-s rounded-s transition-colors":!0,"hover-text-primary hover-cursor-pointer":!this.disabled,"focus-outline-none focus-ring-2 ring-primary-50 ring-offset-2":!this.disabled,"text-disabled cursor-default":this.disabled}),t=i(S||(S=T` ${0} <slot></slot> `),this.icon?i(x||(x=T`<iron-icon icon="${0}" class="icon-inline"></iron-icon>`),this.icon):"");return this.disabled?i(_||(_=T`<button class="${0}" disabled="disabled">${0}</button>`),e,t):i(j||(j=T` <a class="${0}" href="${0}" rel="nofollow noopener">${0}</a> `),e,this.href,t)}}let k,w,z,R,E,U,N,A,C=e=>e;const H=c(e);let I,F,L,q,P,B,D,G,J,K,M,Q,V,W,X,Y=e=>e;const Z=c(e);const ee=["html"],te=["html"];let se,re,oe,ie,ne,ae,de,le,ce,me,ue,he,pe=e=>e;const fe=c(f(m(g(n))));let ge,$e,ye,ve=e=>e;const be=f(m(c(g(n),"customer-portal")));customElements.define("foxy-internal-customer-portal-logged-in-view",class extends H{constructor(){var e;super(...arguments),e=this,this.templates={},this.customer="",this.loggingOutState="idle",this.transactionsTableColumns=[],this.loggingOutStateResetTimeout=null,this.__renderHeaderActionsSignOut=()=>{var t,s,r,o,n;const a="customer:header:actions:sign-out",d=this.loggingOutState,l=this.disabledSelector.matches(a)||!(null===(t=this.__customerElement)||void 0===t?void 0:t.in({idle:"snapshot"}))||"idle"!==d,c={"border-radius":"100%",padding:"var(--lumo-space-xs)",display:"flex",margin:"0",cursor:l?"default":"pointer"};return i(k||(k=C` <div style="display:flex;margin-left:var(--lumo-space-m)"> ${0} <vaadin-button data-testid="sign-out" aria-label="${0}" style="${0}" theme="icon" ?disabled="${0}" @click="${0}"> ${0} </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot(`${a}:before`),this.t("sign_out").toString(),Object.entries(c).reduce(((e,[t,s])=>`${e}${t}:${s};`),""),l,(async function(){try{e.loggingOutState="busy",await new p(e).fetch("foxy://customer-api/session",{method:"DELETE"}),e.loggingOutState="idle"}catch(t){e.loggingOutState="fail",e.loggingOutStateResetTimeout=setTimeout((()=>{e.loggingOutState="idle",e.loggingOutStateResetTimeout=null}),1e3)}}),"idle"===d?i(w||(w=C`<iron-icon icon="icons:exit-to-app"></iron-icon>`)):i(z||(z=C` <foxy-spinner layout="no-label" state="${0}" style="margin:auto" lang="${0}" ns="${0}"> </foxy-spinner> `),"fail"===d?"error":"busy",this.lang,[this.ns,null!==(r=null===(s=customElements.get("foxy-customer"))||void 0===s?void 0:s.defaultNS)&&void 0!==r?r:"",null!==(n=null===(o=customElements.get("foxy-spinner"))||void 0===o?void 0:o.defaultNS)&&void 0!==n?n:""].join(" ")),this.renderTemplateOrSlot(`${a}:after`))},this.__renderSubscriptions=(e,t)=>{const s="customer:subscriptions";return e(R||(R=C`
|
|
2
2
|
${0}
|
|
3
3
|
|
|
4
4
|
<foxy-internal-customer-portal-subscriptions
|
|
@@ -52,7 +52,7 @@ import"./foxy-customer.js";import"./shared-c7b3d22b.js";import"./shared-30d00b64
|
|
|
52
52
|
${0}
|
|
53
53
|
${0}
|
|
54
54
|
</div>
|
|
55
|
-
`),s.matches("default",!0)?"":null==d?void 0:d(e,t),s.matches("subscriptions",!0)?"":r(e,t),s.matches("transactions",!0)?"":o(e,t))},i(A||(A=C` <foxy-customer readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="customer" group="${0}" href="${0}" lang="${0}" ns="${0} ${0}" id="customer" .templates="${0}" .settings="${0}" @update="${0}"> </foxy-customer> `),this.readonlySelector.zoom("customer").toString(),this.disabledSelector.zoom("customer").toString(),o,this.group,this.customer,this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-customer"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",n,this.data,(()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.loggingOutStateResetTimeout&&clearTimeout(this.loggingOutStateResetTimeout)}get __customerElement(){return this.renderRoot.querySelector("#customer")}}),customElements.define("foxy-internal-customer-portal-logged-out-view",class extends Z{constructor(){super(...arguments),this.page="sign-in",this.__renderAccessRecoveryHeader=()=>{var e,t,s,r;const{lang:o,ns:n}=this,a=this.renderRoot.querySelector("#access-recovery-form"),d=!!(null==a?void 0:a.in("busy"));return i(I||(I=Y` <div class="flex flex-col leading-s font-lumo" data-testid="access-recovery:header"> ${0} <foxy-i18n class="text-xxl font-medium ${0}" lang="${0}" key="recover_access" ns="${0} ${0}"> </foxy-i18n> <foxy-i18n class="text-l ${0}" lang="${0}" key="recover_access_hint" ns="${0} ${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("access-recovery:header:before"),d?"text-disabled":"text-body",o,n,null!==(t=null===(e=customElements.get("foxy-access-recovery-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",d?"text-disabled":"text-secondary",o,n,null!==(r=null===(s=customElements.get("foxy-access-recovery-form"))||void 0===s?void 0:s.defaultNS)&&void 0!==r?r:"",this.renderTemplateOrSlot("access-recovery:header:after"))},this.__renderAccessRecoveryBack=()=>{var e,t;const s=this.renderRoot.querySelector("#access-recovery-form"),r=this.disabledSelector.zoom("access-recovery");return i(F||(F=Y` <div> ${0} <vaadin-button data-testid="access-recovery:back" class="w-full" theme="tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="back" ns="${0} ${0}"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("access-recovery:back:before"),!!(null==s?void 0:s.in("busy"))||r.matches("back",!0),(()=>this.page="sign-in"),this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-access-recovery-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.renderTemplateOrSlot("access-recovery:back:after"))},this.__renderAccessRecoveryForm=()=>{var e,t;const s="access-recovery:form",r=this.hiddenSelector.zoom(s);return i(L||(L=Y` <div> ${0} <foxy-access-recovery-form readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="access-recovery:form" parent="foxy://customer-api/recover" group="${0}" lang="${0}" ns="${0} ${0}" id="access-recovery-form" .templates="${0}" @update="${0}"> </foxy-access-recovery-form> ${0} </div> `),this.renderTemplateOrSlot(`${s}:before`),this.readonlySelector.zoom(s).toString(),this.disabledSelector.zoom(s).toString(),r.toString(),this.group,this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-access-recovery-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.getNestedTemplates(s),(()=>this.requestUpdate()),this.renderTemplateOrSlot(`${s}:after`))},this.__renderAccessRecovery=()=>{const e="access-recovery",t=this.hiddenSelector.zoom(e);return i(q||(q=Y` <div class="h-full flex" data-testid="access-recovery"> <div class="m-auto max-w-25rem flex-1"> ${0} <div class="space-y-m"> ${0} <div class="space-y-s"> ${0} ${0} </div> </div> ${0} </div> </div> `),this.renderTemplateOrSlot(`${e}:before`),t.matches("header",!0)?"":this.__renderAccessRecoveryHeader(),t.matches("form",!0)?"":this.__renderAccessRecoveryForm(),t.matches("back",!0)?"":this.__renderAccessRecoveryBack(),this.renderTemplateOrSlot(`${e}:after`))},this.__renderSignInHeader=()=>{var e,t,s,r;const{lang:o,ns:n}=this,a=this.renderRoot.querySelector("#sign-in-form"),d=!!(null==a?void 0:a.in("busy"));return i(P||(P=Y` <div class="flex flex-col leading-s font-lumo" data-testid="sign-in:header"> ${0} <foxy-i18n class="text-xxl font-medium ${0}" lang="${0}" key="sign_in" ns="${0} ${0}"> </foxy-i18n> <foxy-i18n class="text-l ${0}" lang="${0}" key="sign_in_hint" ns="${0} ${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("sign-in:header:before"),d?"text-disabled":"text-body",o,n,null!==(t=null===(e=customElements.get("foxy-sign-in-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",d?"text-disabled":"text-secondary",o,n,null!==(r=null===(s=customElements.get("foxy-sign-in-form"))||void 0===s?void 0:s.defaultNS)&&void 0!==r?r:"",this.renderTemplateOrSlot("sign-in:header:after"))},this.__renderSignInRecover=()=>{var e,t;const s=this.renderRoot.querySelector("#sign-in-form"),r=this.disabledSelector.zoom("sign-in");return i(B||(B=Y` <div> ${0} <vaadin-button data-testid="sign-in:recover" class="w-full" theme="tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="recover_access" ns="${0} ${0}"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("sign-in:recover:before"),!!(null==s?void 0:s.in("busy"))||r.matches("recover",!0),(()=>this.page="access-recovery"),this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-sign-in-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.renderTemplateOrSlot("sign-in:recover:after"))},this.__renderSignInSignUp=()=>{const e=this.renderRoot.querySelector("#sign-in-form"),t=this.disabledSelector.zoom("sign-in");return i(D||(D=Y` <div> ${0} <vaadin-button data-testid="sign-in:signup" class="w-full" theme="tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="sign_up" ns="${0} sign-in-form"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("sign-in:signup:before"),!!(null==e?void 0:e.in("busy"))||t.matches("signup",!0),(()=>this.page="sign-up"),this.lang,this.ns,this.renderTemplateOrSlot("sign-in:signup:after"))},this.__renderSignInForm=()=>{var e,t;const s="sign-in:form",r=this.hiddenSelector.zoom(s);return i(G||(G=Y` <div> ${0} <foxy-sign-in-form readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="sign-in:form" parent="foxy://customer-api/session" group="${0}" lang="${0}" id="sign-in-form" ns="${0} ${0}" .templates="${0}" @update="${0}"> </foxy-sign-in-form> ${0} </div> `),this.renderTemplateOrSlot(`${s}:before`),this.readonlySelector.zoom(s).toString(),this.disabledSelector.zoom(s).toString(),r.toString(),this.group,this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-sign-in-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.getNestedTemplates("sign-in:form"),(()=>this.requestUpdate()),this.renderTemplateOrSlot(`${s}:after`))},this.__renderSignIn=()=>{var e,t;const s="sign-in",r=this.hiddenSelector.zoom(s),o=!0===(null===(t=null===(e=this.data)||void 0===e?void 0:e.sign_up)||void 0===t?void 0:t.enabled),n=r.matches("signup",!0)||!o;return i(J||(J=Y` <div class="h-full flex" data-testid="sign-in"> <div class="m-auto max-w-25rem flex-1"> ${0} <div class="space-y-m"> ${0} <div class="space-y-s"> ${0} <div class="flex justify-center gap-s"> ${0} ${0} </div> </div> </div> ${0} </div> </div> `),this.renderTemplateOrSlot(`${s}:before`),r.matches("header",!0)?"":this.__renderSignInHeader(),r.matches("form",!0)?"":this.__renderSignInForm(),n?"":this.__renderSignInSignUp(),r.matches("recover",!0)?"":this.__renderSignInRecover(),this.renderTemplateOrSlot(`${s}:after`))},this.__renderSignUpHeader=()=>{const{lang:e,ns:t}=this,s=this.renderRoot.querySelector("#sign-up-form"),r=!!(null==s?void 0:s.in("busy"));return i(K||(K=Y` <div class="flex flex-col leading-s font-lumo" data-testid="sign-up:header"> ${0} <foxy-i18n class="text-xxl font-medium ${0}" lang="${0}" key="sign_up" ns="${0} sign-up-form"> </foxy-i18n> <foxy-i18n class="text-l ${0}" lang="${0}" key="sign_up_hint" ns="${0} sign-up-form"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("sign-up:header:before"),r?"text-disabled":"text-body",e,t,r?"text-disabled":"text-secondary",e,t,this.renderTemplateOrSlot("sign-up:header:after"))},this.__renderSignUpGoBack=()=>{const e=this.renderRoot.querySelector("#sign-up-form"),t=this.disabledSelector.zoom("sign-up");return i(M||(M=Y` <div> ${0} <vaadin-button data-testid="sign-up:go-back" class="w-full" theme="tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="go_back" ns="${0} sign-up-form"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("sign-up:go-back:before"),!!(null==e?void 0:e.in("busy"))||t.matches("go-back",!0),(()=>this.page="sign-in"),this.lang,this.ns,this.renderTemplateOrSlot("sign-up:go-back:after"))},this.__renderSignUpForm=()=>{var e,t,s;const o=null===(t=null===(e=this.data)||void 0===e?void 0:e.sign_up)||void 0===t?void 0:t.verification.site_key,n="sign-up:form",a=["tax-id","is-anonymous","password-old","forgot-password","timestamps","delete",this.hiddenSelector.zoom(n).toString()];return i(Q||(Q=Y` <div> ${0} <foxy-customer-form readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="sign-up:form" parent="foxy://customer-api/signup" group="${0}" lang="${0}" id="sign-up-form" ns="${0} sign-up-form" .tosCheckboxSettings="${0}" .verification="${0}" .templates="${0}" .settings="${0}" @update="${0}"> </foxy-customer-form> ${0} </div> `),this.renderTemplateOrSlot(`${n}:before`),this.readonlySelector.zoom(n).toString(),this.disabledSelector.zoom(n).toString(),new r(a.join(" ").trim()),this.group,this.lang,this.ns,null===(s=this.data)||void 0===s?void 0:s.tos_checkbox_settings,o?{type:"hcaptcha",siteKey:o}:null,this.getNestedTemplates("sign-up:form"),this.data,(()=>this.requestUpdate()),this.renderTemplateOrSlot(`${n}:after`))},this.__renderSignUp=()=>{const e="sign-up",t=this.hiddenSelector.zoom(e);return i(V||(V=Y` <div class="h-full flex" data-testid="sign-up"> <div class="m-auto max-w-25rem flex-1"> ${0} <div class="space-y-m"> ${0} ${0} ${0} </div> ${0} </div> </div> `),this.renderTemplateOrSlot(`${e}:before`),t.matches("header",!0)?"":this.__renderSignUpHeader(),t.matches("form",!0)?"":this.__renderSignUpForm(),t.matches("go-back",!0)?"":this.__renderSignUpGoBack(),this.renderTemplateOrSlot(`${e}:after`))}}static get properties(){return s(s({},super.properties),{},{group:{type:String},page:{type:String}})}static get styles(){return[super.styles,a(W||(W=Y`.max-w-25rem{max-width:25rem}`))]}renderBody(){const{page:e,hiddenSelector:t}=this;return"access-recovery"!==e||t.matches("access-recovery",!0)?"sign-in"!==e||t.matches("sign-in",!0)?"sign-up"!==e||t.matches("sign-up",!0)?i(X||(X=Y``)):this.__renderSignUp():this.__renderSignIn():this.__renderAccessRecovery()}}),customElements.define("foxy-internal-customer-portal-subscriptions",class extends fe{constructor(){super(...arguments),this.settings=null,this.customer=null,this.group="",this.__renderFormHeaderActionsUpdate=(e,t)=>{var s;const r=!!(null===(s=t.data)||void 0===s?void 0:s.end_date)&&new Date(t.data.end_date).getTime()<=Date.now();let o="";if(!r&&t.in({idle:"snapshot"})){const e=t.data._links["fx:sub_token_url"].href,s=new URL(e);s.searchParams.set("cart","checkout"),s.searchParams.set("sub_restart","auto"),o=s.toString()}return e(se||(se=pe`
|
|
55
|
+
`),s.matches("default",!0)?"":null==d?void 0:d(e,t),s.matches("subscriptions",!0)?"":r(e,t),s.matches("transactions",!0)?"":o(e,t))},i(A||(A=C` <foxy-customer readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="customer" group="${0}" href="${0}" lang="${0}" ns="${0} ${0}" id="customer" .templates="${0}" .settings="${0}" @update="${0}"> </foxy-customer> `),this.readonlySelector.zoom("customer").toString(),this.disabledSelector.zoom("customer").toString(),o,this.group,this.customer,this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-customer"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",n,this.data,(()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.loggingOutStateResetTimeout&&clearTimeout(this.loggingOutStateResetTimeout)}get __customerElement(){return this.renderRoot.querySelector("#customer")}}),customElements.define("foxy-internal-customer-portal-logged-out-view",class extends Z{constructor(){super(...arguments),this.page="sign-in",this.__renderAccessRecoveryHeader=()=>{var e,t,s,r;const{lang:o,ns:n}=this,a=this.renderRoot.querySelector("#access-recovery-form"),d=!!(null==a?void 0:a.in("busy"));return i(I||(I=Y` <div class="flex flex-col leading-s font-lumo" data-testid="access-recovery:header"> ${0} <foxy-i18n class="text-xxl font-medium ${0}" lang="${0}" key="recover_access" ns="${0} ${0}"> </foxy-i18n> <foxy-i18n class="text-l ${0}" lang="${0}" key="recover_access_hint" ns="${0} ${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("access-recovery:header:before"),d?"text-disabled":"text-body",o,n,null!==(t=null===(e=customElements.get("foxy-access-recovery-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",d?"text-disabled":"text-secondary",o,n,null!==(r=null===(s=customElements.get("foxy-access-recovery-form"))||void 0===s?void 0:s.defaultNS)&&void 0!==r?r:"",this.renderTemplateOrSlot("access-recovery:header:after"))},this.__renderAccessRecoveryBack=()=>{var e,t;const s=this.renderRoot.querySelector("#access-recovery-form"),r=this.disabledSelector.zoom("access-recovery");return i(F||(F=Y` <div> ${0} <vaadin-button data-testid="access-recovery:back" class="w-full" theme="tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="back" ns="${0} ${0}"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("access-recovery:back:before"),!!(null==s?void 0:s.in("busy"))||r.matches("back",!0),(()=>this.page="sign-in"),this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-access-recovery-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.renderTemplateOrSlot("access-recovery:back:after"))},this.__renderAccessRecoveryForm=()=>{var e,t;const s="access-recovery:form",r=this.hiddenSelector.zoom(s);return i(L||(L=Y` <div> ${0} <foxy-access-recovery-form readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="access-recovery:form" parent="foxy://customer-api/recover" group="${0}" lang="${0}" ns="${0} ${0}" id="access-recovery-form" .templates="${0}" @update="${0}"> </foxy-access-recovery-form> ${0} </div> `),this.renderTemplateOrSlot(`${s}:before`),this.readonlySelector.zoom(s).toString(),this.disabledSelector.zoom(s).toString(),r.toString(),this.group,this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-access-recovery-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.getNestedTemplates(s),(()=>this.requestUpdate()),this.renderTemplateOrSlot(`${s}:after`))},this.__renderAccessRecovery=()=>{const e="access-recovery",t=this.hiddenSelector.zoom(e);return i(q||(q=Y` <div class="h-full flex" data-testid="access-recovery"> <div class="m-auto max-w-25rem flex-1"> ${0} <div class="space-y-m"> ${0} <div class="space-y-s"> ${0} ${0} </div> </div> ${0} </div> </div> `),this.renderTemplateOrSlot(`${e}:before`),t.matches("header",!0)?"":this.__renderAccessRecoveryHeader(),t.matches("form",!0)?"":this.__renderAccessRecoveryForm(),t.matches("back",!0)?"":this.__renderAccessRecoveryBack(),this.renderTemplateOrSlot(`${e}:after`))},this.__renderSignInHeader=()=>{var e,t,s,r;const{lang:o,ns:n}=this,a=this.renderRoot.querySelector("#sign-in-form"),d=!!(null==a?void 0:a.in("busy"));return i(P||(P=Y` <div class="flex flex-col leading-s font-lumo" data-testid="sign-in:header"> ${0} <foxy-i18n class="text-xxl font-medium ${0}" lang="${0}" key="sign_in" ns="${0} ${0}"> </foxy-i18n> <foxy-i18n class="text-l ${0}" lang="${0}" key="sign_in_hint" ns="${0} ${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("sign-in:header:before"),d?"text-disabled":"text-body",o,n,null!==(t=null===(e=customElements.get("foxy-sign-in-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",d?"text-disabled":"text-secondary",o,n,null!==(r=null===(s=customElements.get("foxy-sign-in-form"))||void 0===s?void 0:s.defaultNS)&&void 0!==r?r:"",this.renderTemplateOrSlot("sign-in:header:after"))},this.__renderSignInRecover=()=>{var e,t;const s=this.renderRoot.querySelector("#sign-in-form"),r=this.disabledSelector.zoom("sign-in");return i(B||(B=Y` <div> ${0} <vaadin-button data-testid="sign-in:recover" class="w-full" theme="tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="recover_access" ns="${0} ${0}"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("sign-in:recover:before"),!!(null==s?void 0:s.in("busy"))||r.matches("recover",!0),(()=>this.page="access-recovery"),this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-sign-in-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.renderTemplateOrSlot("sign-in:recover:after"))},this.__renderSignInSignUp=()=>{const e=this.renderRoot.querySelector("#sign-in-form"),t=this.disabledSelector.zoom("sign-in");return i(D||(D=Y` <div> ${0} <vaadin-button data-testid="sign-in:signup" class="w-full" theme="tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="sign_up" ns="${0} sign-in-form"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("sign-in:signup:before"),!!(null==e?void 0:e.in("busy"))||t.matches("signup",!0),(()=>this.page="sign-up"),this.lang,this.ns,this.renderTemplateOrSlot("sign-in:signup:after"))},this.__renderSignInForm=()=>{var e,t;const s="sign-in:form",r=this.hiddenSelector.zoom(s);return i(G||(G=Y` <div> ${0} <foxy-sign-in-form readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="sign-in:form" parent="foxy://customer-api/session" group="${0}" lang="${0}" id="sign-in-form" ns="${0} ${0}" .templates="${0}" @update="${0}"> </foxy-sign-in-form> ${0} </div> `),this.renderTemplateOrSlot(`${s}:before`),this.readonlySelector.zoom(s).toString(),this.disabledSelector.zoom(s).toString(),r.toString(),this.group,this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-sign-in-form"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"",this.getNestedTemplates("sign-in:form"),(()=>this.requestUpdate()),this.renderTemplateOrSlot(`${s}:after`))},this.__renderSignIn=()=>{var e,t;const s="sign-in",r=this.hiddenSelector.zoom(s),o=!0===(null===(t=null===(e=this.data)||void 0===e?void 0:e.sign_up)||void 0===t?void 0:t.enabled),n=r.matches("signup",!0)||!o;return i(J||(J=Y` <div class="h-full flex" data-testid="sign-in"> <div class="m-auto max-w-25rem flex-1"> ${0} <div class="space-y-m"> ${0} <div class="space-y-s"> ${0} <div class="flex justify-center gap-s"> ${0} ${0} </div> </div> </div> ${0} </div> </div> `),this.renderTemplateOrSlot(`${s}:before`),r.matches("header",!0)?"":this.__renderSignInHeader(),r.matches("form",!0)?"":this.__renderSignInForm(),n?"":this.__renderSignInSignUp(),r.matches("recover",!0)?"":this.__renderSignInRecover(),this.renderTemplateOrSlot(`${s}:after`))},this.__renderSignUpHeader=()=>{const{lang:e,ns:t}=this,s=this.renderRoot.querySelector("#sign-up-form"),r=!!(null==s?void 0:s.in("busy"));return i(K||(K=Y` <div class="flex flex-col leading-s font-lumo" data-testid="sign-up:header"> ${0} <foxy-i18n class="text-xxl font-medium ${0}" lang="${0}" key="sign_up" ns="${0} sign-up-form"> </foxy-i18n> <foxy-i18n class="text-l ${0}" lang="${0}" key="sign_up_hint" ns="${0} sign-up-form"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("sign-up:header:before"),r?"text-disabled":"text-body",e,t,r?"text-disabled":"text-secondary",e,t,this.renderTemplateOrSlot("sign-up:header:after"))},this.__renderSignUpGoBack=()=>{const e=this.renderRoot.querySelector("#sign-up-form"),t=this.disabledSelector.zoom("sign-up");return i(M||(M=Y` <div> ${0} <vaadin-button data-testid="sign-up:go-back" class="w-full" theme="tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n lang="${0}" key="go_back" ns="${0} sign-up-form"> </foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("sign-up:go-back:before"),!!(null==e?void 0:e.in("busy"))||t.matches("go-back",!0),(()=>this.page="sign-in"),this.lang,this.ns,this.renderTemplateOrSlot("sign-up:go-back:after"))},this.__renderSignUpForm=()=>{const e="sign-up:form",t=["tax-id","is-anonymous","password-old","forgot-password","timestamps","delete",this.hiddenSelector.zoom(e).toString()];return i(Q||(Q=Y` <div> ${0} <foxy-customer-form readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" data-testid="sign-up:form" parent="foxy://customer-api/signup" group="${0}" lang="${0}" id="sign-up-form" ns="${0} sign-up-form" .templates="${0}" .settings="${0}" @update="${0}"> </foxy-customer-form> ${0} </div> `),this.renderTemplateOrSlot(`${e}:before`),this.readonlySelector.zoom(e).toString(),this.disabledSelector.zoom(e).toString(),new r(t.join(" ").trim()),this.group,this.lang,this.ns,this.getNestedTemplates("sign-up:form"),this.data,(()=>this.requestUpdate()),this.renderTemplateOrSlot(`${e}:after`))},this.__renderSignUp=()=>{const e="sign-up",t=this.hiddenSelector.zoom(e);return i(V||(V=Y` <div class="h-full flex" data-testid="sign-up"> <div class="m-auto max-w-25rem flex-1"> ${0} <div class="space-y-m"> ${0} ${0} ${0} </div> ${0} </div> </div> `),this.renderTemplateOrSlot(`${e}:before`),t.matches("header",!0)?"":this.__renderSignUpHeader(),t.matches("form",!0)?"":this.__renderSignUpForm(),t.matches("go-back",!0)?"":this.__renderSignUpGoBack(),this.renderTemplateOrSlot(`${e}:after`))}}static get properties(){return s(s({},super.properties),{},{group:{type:String},page:{type:String}})}static get styles(){return[super.styles,a(W||(W=Y`.max-w-25rem{max-width:25rem}`))]}renderBody(){const{page:e,hiddenSelector:t}=this;return"access-recovery"!==e||t.matches("access-recovery",!0)?"sign-in"!==e||t.matches("sign-in",!0)?"sign-up"!==e||t.matches("sign-up",!0)?i(X||(X=Y``)):this.__renderSignUp():this.__renderSignIn():this.__renderAccessRecovery()}}),customElements.define("foxy-internal-customer-portal-subscriptions",class extends fe{constructor(){super(...arguments),this.settings=null,this.customer=null,this.group="",this.__renderFormHeaderActionsUpdate=(e,t)=>{var s;const r=!!(null===(s=t.data)||void 0===s?void 0:s.end_date)&&new Date(t.data.end_date).getTime()<=Date.now();let o="";if(!r&&t.in({idle:"snapshot"})){const e=t.data._links["fx:sub_token_url"].href,s=new URL(e);s.searchParams.set("cart","checkout"),s.searchParams.set("sub_restart","auto"),o=s.toString()}return e(se||(se=pe`
|
|
56
56
|
${0}
|
|
57
57
|
|
|
58
58
|
<foxy-internal-customer-portal-link
|
|
@@ -145,4 +145,4 @@ import"./foxy-customer.js";import"./shared-c7b3d22b.js";import"./shared-30d00b64
|
|
|
145
145
|
.templates=${0}
|
|
146
146
|
>
|
|
147
147
|
</foxy-collection-page>
|
|
148
|
-
`),s.ns,s.href,s.lang,s.group,this.__renderPageItem,s.templates)},this.__renderHeader=()=>i(me||(me=pe` ${0} <foxy-i18n class="block text-l font-medium" lang="${0}" key="subscription_plural" ns="${0}"> </foxy-i18n> ${0} `),this.renderTemplateOrSlot("header:before"),this.lang,this.ns,this.renderTemplateOrSlot("header:after")),this.__renderList=()=>{var e;const t=this.disabledSelector.zoom("list"),s=this.readonlySelector.zoom("list"),r=[this.hiddenSelector.zoom("list").zoom("form").toString(),"end-date"];return i(ue||(ue=pe` ${0} <foxy-form-dialog readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" header="update" parent="${0}" group="${0}" lang="${0}" ns="${0}" id="subscription-dialog" .form="${0}" .templates="${0}"> </foxy-form-dialog> <foxy-collection-pages class="block space-y-m" first="${0}" group="${0}" lang="${0}" ns="${0}" manual .page="${0}" .templates="${0}"> </foxy-collection-pages> ${0} `),this.renderTemplateOrSlot("list:before"),s.zoom("form").toString(),t.zoom("form").toString(),r.join(" ").trim(),u(null===(e=this.customer)||void 0===e?void 0:e._links["fx:subscriptions"].href),this.group,this.lang,this.ns,this.__renderForm,this.getNestedTemplates("list:form"),this.__activeSubscriptionsLink,this.group,this.lang,this.ns,this.__renderPage,this.getNestedTemplates("list:card"),this.renderTemplateOrSlot("list:after"))}}static get properties(){return s(s({},super.properties),{},{settings:{attribute:!1},customer:{attribute:!1},group:{type:String}})}render(){return i(he||(he=pe` <div class="space-y-s" data-testid="subscriptions"> ${0} ${0} </div> `),this.hiddenSelector.matches("header",!0)?"":this.__renderHeader(),this.hiddenSelector.matches("list",!0)?"":this.__renderList())}get __subscriptionDialog(){return this.renderRoot.querySelector("#subscription-dialog")}get __activeSubscriptionsLink(){try{const e=new URL(this.customer._links["fx:subscriptions"].href);return e.searchParams.set("zoom","transaction_template:items"),e.toString()}catch(e){return""}}}),customElements.define("foxy-internal-customer-portal-transactions",class extends be{constructor(){super(...arguments),this.customer=null,this.columns=[],this.group="",this.__renderHeader=()=>i(ge||(ge=ve` <div> ${0} <foxy-i18n class="text-l font-medium" lang="${0}" key="transaction_plural" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("header:before"),this.lang,this.ns,this.renderTemplateOrSlot("header:after")),this.__renderList=()=>{let e="";if(this.customer){const t=new URL(this.customer._links["fx:transactions"].href);t.searchParams.set("zoom","items"),e=t.toString()}return i($e||($e=ve` <div> ${0} <foxy-collection-pages spinner="foxy-spinner" group="${0}" first="${0}" class="block divide-y divide-contrast-10 px-m border border-contrast-10 rounded-t-l rounded-b-l" page="foxy-transactions-table" lang="${0}" ns="${0}" manual .templates="${0}" .props="${0}"> </foxy-collection-pages> ${0} </div> `),this.renderTemplateOrSlot("list:before"),this.group,e,this.lang,this.ns,this.getNestedTemplates("table"),{".columns":this.columns},this.renderTemplateOrSlot("list:after"))}}static get properties(){return s(s({},super.properties),{},{customer:{attribute:!1},columns:{attribute:!1},group:{type:String}})}render(){return i(ye||(ye=ve` <div class="space-y-s" data-testid="transactions"> ${0} ${0} </div> `),this.hiddenSelector.matches("header")?"":this.__renderHeader(),this.hiddenSelector.matches("list")?"":this.__renderList())}}),customElements.define("foxy-internal-customer-portal-link",
|
|
148
|
+
`),s.ns,s.href,s.lang,s.group,this.__renderPageItem,s.templates)},this.__renderHeader=()=>i(me||(me=pe` ${0} <foxy-i18n class="block text-l font-medium" lang="${0}" key="subscription_plural" ns="${0}"> </foxy-i18n> ${0} `),this.renderTemplateOrSlot("header:before"),this.lang,this.ns,this.renderTemplateOrSlot("header:after")),this.__renderList=()=>{var e;const t=this.disabledSelector.zoom("list"),s=this.readonlySelector.zoom("list"),r=[this.hiddenSelector.zoom("list").zoom("form").toString(),"end-date"];return i(ue||(ue=pe` ${0} <foxy-form-dialog readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" header="update" parent="${0}" group="${0}" lang="${0}" ns="${0}" id="subscription-dialog" .form="${0}" .templates="${0}"> </foxy-form-dialog> <foxy-collection-pages class="block space-y-m" first="${0}" group="${0}" lang="${0}" ns="${0}" manual .page="${0}" .templates="${0}"> </foxy-collection-pages> ${0} `),this.renderTemplateOrSlot("list:before"),s.zoom("form").toString(),t.zoom("form").toString(),r.join(" ").trim(),u(null===(e=this.customer)||void 0===e?void 0:e._links["fx:subscriptions"].href),this.group,this.lang,this.ns,this.__renderForm,this.getNestedTemplates("list:form"),this.__activeSubscriptionsLink,this.group,this.lang,this.ns,this.__renderPage,this.getNestedTemplates("list:card"),this.renderTemplateOrSlot("list:after"))}}static get properties(){return s(s({},super.properties),{},{settings:{attribute:!1},customer:{attribute:!1},group:{type:String}})}render(){return i(he||(he=pe` <div class="space-y-s" data-testid="subscriptions"> ${0} ${0} </div> `),this.hiddenSelector.matches("header",!0)?"":this.__renderHeader(),this.hiddenSelector.matches("list",!0)?"":this.__renderList())}get __subscriptionDialog(){return this.renderRoot.querySelector("#subscription-dialog")}get __activeSubscriptionsLink(){try{const e=new URL(this.customer._links["fx:subscriptions"].href);return e.searchParams.set("zoom","transaction_template:items"),e.toString()}catch(e){return""}}}),customElements.define("foxy-internal-customer-portal-transactions",class extends be{constructor(){super(...arguments),this.customer=null,this.columns=[],this.group="",this.__renderHeader=()=>i(ge||(ge=ve` <div> ${0} <foxy-i18n class="text-l font-medium" lang="${0}" key="transaction_plural" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("header:before"),this.lang,this.ns,this.renderTemplateOrSlot("header:after")),this.__renderList=()=>{let e="";if(this.customer){const t=new URL(this.customer._links["fx:transactions"].href);t.searchParams.set("zoom","items"),e=t.toString()}return i($e||($e=ve` <div> ${0} <foxy-collection-pages spinner="foxy-spinner" group="${0}" first="${0}" class="block divide-y divide-contrast-10 px-m border border-contrast-10 rounded-t-l rounded-b-l" page="foxy-transactions-table" lang="${0}" ns="${0}" manual .templates="${0}" .props="${0}"> </foxy-collection-pages> ${0} </div> `),this.renderTemplateOrSlot("list:before"),this.group,e,this.lang,this.ns,this.getNestedTemplates("table"),{".columns":this.columns},this.renderTemplateOrSlot("list:after"))}}static get properties(){return s(s({},super.properties),{},{customer:{attribute:!1},columns:{attribute:!1},group:{type:String}})}render(){return i(ye||(ye=ve` <div class="space-y-s" data-testid="transactions"> ${0} ${0} </div> `),this.hiddenSelector.matches("header")?"":this.__renderHeader(),this.hiddenSelector.matches("list")?"":this.__renderList())}}),customElements.define("foxy-internal-customer-portal-link",O),customElements.define("foxy-customer-portal",b);export{b as CustomerPortal};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{L as e}from"./shared-7f33a83a.js";import{F as t}from"./shared-343d1fd7.js";import{aJ as a,aj as s,_ as n}from"./shared-1522d76f.js";import{A as r}from"./shared-07e9d1fb.js";async function o(e){const t=await e;if(!t.ok)throw new Error(await t.text());return t.json()}async function i(e){var t;let s,n;try{const{hostedPaymentGatewaysHelperUrl:r,paymentGatewaysHelperUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if("GET"!==d.method)throw s=405,new Error("Method not allowed. Allowed methods: GET.");const p=a(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}).exec(new URL(d.url).pathname).groups.presetId,h=o(m(r)),y=o(m(i)),f=null===(t=(await o(m(l(p))))._links["fx:payment_gateway"])||void 0===t?void 0:t.href,u=f?await o(m(f)):void 0,c=function(e){const{hostedPaymentGatewaysHelper:t,paymentGatewaysHelper:a,paymentPresetId:s,paymentGateway:n,base:r}=e,o=new URL(`./payment_presets/${s}/available_payment_methods`,r),i={};return Object.entries(t.values).forEach((([e,t])=>{i[e]=t})),Object.entries(a.values).forEach((([e,t])=>{i[e]=t,n&&(i[e].conflict={type:n.type,name:n.description})})),{_links:{self:{href:o.toString()}},values:i}}({hostedPaymentGatewaysHelper:await h,paymentGatewaysHelper:await y,paymentPresetId:p,paymentGateway:u,base:new URL(d.url).origin});n=JSON.stringify(c),s=200}catch(e){n=e instanceof Error?e.message:String(e),s=null!=s?s:500}return new Response(n,{status:s})}function l(e){const{paymentPresetId:t,base:a}=e;return{_links:{self:{href:new URL(`./payment_presets/${t}/available_fraud_protections`,a).toString()}},values:{minfraud:{name:"MaxMind minFraud",uses_rejection_threshold:!0,json:null},google_recaptcha:{name:"Google reCAPTCHA",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"config",name:"Configuration",type:"select",description:"Determines how reCAPTCHA is configured to operate.",default_value:"disabled",options:[{name:"Disabled",value:"disabled"},{name:"Always enabled",value:"enabled_always"},{name:"Enabled by errors",value:"enabled_by_errors"}]},{id:"private_key",name:"Private Key",type:"text",optional:!0,description:"If using a custom subdomain, enter your Private Key here.",default_value:""},{id:"site_key",name:"Site Key",type:"text",optional:!0,description:"If using a custom subdomain, enter your Site Key here.",default_value:""}]}]}},custom_precheckout_hook:{name:"Pre-Checkout Webhook",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"enabled",name:"Enabled",type:"checkbox",default_value:!1},{id:"url",name:"URL",type:"text",description:"Url of your Pre-Checkout Hook",default_value:""},{id:"failure_handling",name:"Failure handling",type:"select",description:"Determines what happens to the checkout if your webhook fails.",default_value:"",options:[{name:"Reject",value:"reject"},{name:"Approve",value:"approve"}]}]}]}}}}}async function d(e){let t,s;try{const{request:n}=e;if("GET"!==n.method)throw t=405,new Error("Method not allowed. Allowed methods: GET.");const r=l({paymentPresetId:a(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}).exec(new URL(n.url).pathname).groups.presetId,base:new URL(n.url).origin});s=JSON.stringify(r),t=200}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}const m=["_links"];function p(e){const{paymentMethodSetFraudProtectionId:t,paymentPresetId:a,fraudProtection:r,base:o}=e,{_links:i}=r,d=s(r,m),p=l({paymentPresetId:a,base:o}),h=`${new URL(i.self.href).pathname.split("/").pop()}C${t}`,y=new URL(`./payment_presets/${a}`,o),f=new URL(`./payment_presets/${a}/fraud_protections/${h}`,o);return n(n({_links:{self:{href:f.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:y.toString()}}},d),{},{helper:p.values[r.type]})}async function h(e){var t,s;let n,r;try{const{fraudProtectionsUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if(!["GET","POST"].includes(d.method))throw n=405,new Error("Method not allowed. Allowed methods: GET, POST.");const h=new URL(d.url),y=a(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}).exec(h.pathname).groups.presetId,f=await o(m(l(y)));if("GET"===d.method){const e=parseInt(null!==(t=h.searchParams.get("offset"))&&void 0!==t?t:"0"),a=parseInt(null!==(s=h.searchParams.get("limit"))&&void 0!==s?s:"20"),i=new URL(f._links["fx:payment_method_set_fraud_protections"].href);i.searchParams.set("offset",String(Math.max(0,e-1))),i.searchParams.set("limit",String(a));const l=await o(m(i.toString())),u=await Promise.all(l._embedded["fx:payment_method_set_fraud_protections"].map((async e=>o(m(e._links["fx:fraud_protection"].href))))),c=function(e){const{paymentMethodSetFraudProtections:t,fraudProtections:a,paymentPresetId:s,base:n}=e,r=new URL(`/payment_presets/${s}/fraud_protections`,n);r.search=new URL(t._links.self.href).search;const o=new URL(r.toString());o.search=new URL(t._links.first.href).search;const i=new URL(r.toString());i.search=new URL(t._links.last.href).search;const l=new URL(r.toString());l.search=new URL(t._links.prev.href).search;const d=new URL(r.toString());d.search=new URL(t._links.next.href).search;const m=a.map((e=>{const a=t._embedded["fx:payment_method_set_fraud_protections"].find((t=>t.fraud_protection_uri===e._links.self.href));return p({paymentMethodSetFraudProtectionId:new URL(a._links.self.href).pathname.split("/").pop(),fraudProtection:e,paymentPresetId:s,base:n})}));return{_links:{first:{href:o.toString()},last:{href:i.toString()},prev:{href:l.toString()},next:{href:d.toString()},self:{href:r.toString()}},_embedded:{"fx:fraud_protections":m},returned_items:t.returned_items,total_items:t.total_items,offset:t.offset,limit:t.limit}}({paymentMethodSetFraudProtections:l,fraudProtections:u,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(c)}else{const e=await d.json();delete e.helper;const t=m(i,{method:"POST",body:JSON.stringify(e)}),a=await o(t),s=await o(m(f._links["fx:payment_method_set_fraud_protections"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:f._links.self.href,fraud_protection_uri:a._links.self.href})})),l=p({paymentMethodSetFraudProtectionId:new URL(s._links.self.href).pathname.split("/").pop(),fraudProtection:a,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(l)}}catch(e){r=e instanceof Error?e.message:String(e),n=null!=n?n:500}return new Response(r,{status:n})}async function y(e){let t,s;try{const{getPaymentMethodSetUrl:n,getFraudProtectionUrl:r,request:i,fetch:l}=e;if(!["GET","PATCH","DELETE"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const d=a(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),{presetId:m,protectionId:h}=d.exec(i.url).groups,y=n(m),f=h.substring(0,h.indexOf("C"));if("DELETE"===i.method){const e=(await o(l(y)))._links["fx:payment_method_set_fraud_protections"].href,t=new URL(e);t.searchParams.set("fraud_protection_id",f);const a=await o(l(t.toString())),s=a._embedded["fx:payment_method_set_fraud_protections"].map((e=>o(l(e._links.self.href,{method:"DELETE"}))));await Promise.all(s)}let u=await i.text();try{const e=JSON.parse(u);delete e.helper,u=JSON.stringify(e)}catch(e){}const c=l(r(f),{method:i.method,body:"PATCH"===i.method?u:null}),w=await o(c);s="DELETE"===i.method?JSON.stringify({message:"Fraud protection was successfully deleted."}):JSON.stringify(p({paymentMethodSetFraudProtectionId:h.substring(h.indexOf("C")+1),fraudProtection:w,paymentPresetId:m,base:new URL(i.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}const f=["_links"];function u(e){const{paymentPresetId:t,helper:a,base:r}=e,o="paymentGateway"in e?e.paymentGateway:e.hostedPaymentGateway,{_links:i}=o,l=s(o,f),d=new URL(i.self.href).pathname.split("/").pop();let m;m="paymentMethodSetHostedPaymentGatewayId"in e?`H${d}C${e.paymentMethodSetHostedPaymentGatewayId}`:`R${d}`;const p=new URL(`./payment_presets/${t}`,r),h=new URL(`./payment_presets/${t}/payment_methods/${m}`,r);return n(n({_links:{self:{href:h.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:p.toString()}}},l),{},{helper:a})}async function c(e){var t,s,n,r;let i,l;try{const{hostedPaymentGatewaysHelperUrl:d,paymentGatewaysHelperUrl:m,hostedPaymentGatewaysUrl:p,getPaymentMethodSetUrl:h,paymentGatewaysUrl:y,request:f,fetch:c}=e;if(!["GET","POST"].includes(f.method))throw i=405,new Error("Method not allowed. Allowed methods: GET, POST.");const w=new URL(f.url),_=a(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}).exec(w.pathname).groups.presetId,[g,P,S]=await Promise.all([o(c(d)),o(c(m)),o(c(h(_)))]);if("GET"===f.method){const e=parseInt(null!==(t=w.searchParams.get("offset"))&&void 0!==t?t:"0"),a=parseInt(null!==(s=w.searchParams.get("limit"))&&void 0!==s?s:"20"),r=new URL(S._links["fx:payment_method_set_hosted_payment_gateways"].href);r.searchParams.set("offset",String(Math.max(0,e-1))),r.searchParams.set("limit",String(a));const d=null===(n=S._links["fx:payment_gateway"])||void 0===n?void 0:n.href,[m,p]=await Promise.all([d&&0===e?o(c(d)):null,o(c(r.toString()))]),h=await Promise.all(p._embedded["fx:payment_method_set_hosted_payment_gateways"].map((async e=>o(c(e._links["fx:hosted_payment_gateway"].href))))),y=function(e){var t,a;const{paymentMethodSetHostedPaymentGateways:s,hostedPaymentGatewaysHelper:n,hostedPaymentGateways:r,paymentGatewaysHelper:o,paymentPresetId:i,paymentGateway:l,query:d,base:m}=e,p=new URLSearchParams(d),h=parseInt(null!==(t=p.get("offset"))&&void 0!==t?t:"0"),y=parseInt(null!==(a=p.get("limit"))&&void 0!==a?a:"20"),f=s.total_items+(l?1:0),c=s.returned_items+(l&&"not-on-page"!==l?1:0),w=new URL(`/payment_presets/${i}/payment_methods`,m);w.search=d;const _=new URL(w.toString()),g=new URL(w.toString()),P=new URL(w.toString()),S=new URL(w.toString());_.searchParams.set("limit",String(y)),_.searchParams.set("offset",String(h)),g.searchParams.set("limit",String(y)),g.searchParams.set("offset",String(Math.max(0,f-y))),P.searchParams.set("limit",String(y)),P.searchParams.set("offset",String(Math.max(0,h-y))),S.searchParams.set("limit",String(y)),S.searchParams.set("offset",String(Math.min(h+y,Math.max(0,f-y))));const U=[...l&&"not-on-page"!==l?[l]:[],...r].map((e=>{const t=s._embedded["fx:payment_method_set_hosted_payment_gateways"].find((t=>t.hosted_payment_gateway_uri===e._links.self.href));return u(t?{paymentMethodSetHostedPaymentGatewayId:new URL(t._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:e,paymentPresetId:i,helper:n.values[e.type],base:m}:{paymentPresetId:i,paymentGateway:e,helper:o.values[e.type],base:m})}));return{_links:{first:{href:_.toString()},last:{href:g.toString()},prev:{href:P.toString()},next:{href:S.toString()},self:{href:w.toString()}},_embedded:{"fx:payment_methods":U},returned_items:c,total_items:f,offset:h,limit:y}}({paymentMethodSetHostedPaymentGateways:p,hostedPaymentGatewaysHelper:g,paymentGatewaysHelper:P,hostedPaymentGateways:h,paymentPresetId:_,paymentGateway:m||(d?"not-on-page":void 0),query:new URL(f.url).search,base:new URL(f.url).origin});i=200,l=JSON.stringify(y)}else{const e=await f.clone().json(),t=!!g.values[null!==(r=e.type)&&void 0!==r?r:""];if(delete e.helper,t){const t=await o(c(p,{method:"POST",body:JSON.stringify(e)})),a=await o(c(S._links["fx:payment_method_set_hosted_payment_gateways"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:S._links.self.href,hosted_payment_gateway_uri:t._links.self.href})})),s=u({paymentMethodSetHostedPaymentGatewayId:new URL(a._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:t,paymentPresetId:_,helper:g.values[t.type],base:new URL(f.url).origin});i=200,l=JSON.stringify(s)}else{const t=c(y,{method:f.method,body:JSON.stringify(e)}),a=await o(t),s={gateway_uri:a._links.self.href};await Promise.all([o(c(S._links.self.href,{method:"PATCH",body:JSON.stringify(s)})),S.gateway_uri?o(c(S.gateway_uri,{method:"DELETE"})):null]);const n=u({paymentPresetId:_,paymentGateway:a,helper:P.values[a.type],base:new URL(f.url).origin});i=200,l=JSON.stringify(n)}}}catch(e){l=e instanceof Error?e.message:String(e),i=null!=i?i:500}return new Response(l,{status:i})}const w=["_links"];function _(e){const{paymentMethodSet:t,base:a}=e,{_links:r}=t,o=s(t,w),i=new URL(t._links.self.href).pathname.split("/").pop(),l=new URL(`./payment_presets/${i}`,a),d=new URL(`./payment_presets/${i}/payment_methods`,a),m=new URL(`./payment_presets/${i}/fraud_protections`,a),p=new URL(`./payment_presets/${i}/available_payment_methods`,a),h=new URL(`./payment_presets/${i}/available_fraud_protections`,a);return n({_links:{self:{href:l.toString()},"fx:store":r["fx:store"],"fx:payment_methods":{href:d.toString()},"fx:fraud_protections":{href:m.toString()},"fx:available_payment_methods":{href:p.toString()},"fx:available_fraud_protections":{href:h.toString()}}},o)}const g=["_embedded","_links"];async function P(e){let t,a;try{const{paymentMethodSetsUrl:r,request:i,fetch:l}=e;if(!["GET","POST"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, POST.");const d=new URL(i.url),m=new URL(r);let p;if(m.search=d.search,"POST"===i.method){const e=l(m.toString(),{method:"POST",body:await i.text()});p=_({paymentMethodSet:await o(e),base:d.origin})}else p=function(e){const{paymentMethodSets:t,base:a}=e,{_embedded:r,_links:o}=t,i=s(t,g),l=new URL("./payment_presets",a),d=new URL(o.first.href);l.search=d.search;const m=new URL("./payment_presets",a),p=new URL(o.last.href);m.search=p.search;const h=new URL("./payment_presets",a),y=new URL(o.prev.href);h.search=y.search;const f=new URL("./payment_presets",a),u=new URL(o.next.href);f.search=u.search;const c=new URL("./payment_presets",a),w=new URL(o.self.href);return c.search=w.search,n(n({},i),{},{_links:{first:{href:l.toString()},last:{href:m.toString()},prev:{href:h.toString()},next:{href:f.toString()},self:{href:c.toString()}},_embedded:{"fx:payment_presets":r["fx:payment_method_sets"].map((e=>_({paymentMethodSet:e,base:a})))}})}({paymentMethodSets:await o(l(m.toString())),base:d.origin});a=JSON.stringify(p),t=200}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}async function S(e){let t,s;try{const{getPaymentMethodSetUrl:n,request:r,fetch:i}=e;if(!["GET","PATCH","DELETE"].includes(r.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const l=a(/payment_presets\/(.+)/,{presetId:1}).exec(r.url).groups.presetId,d=new URL(r.url),m=new URL(n(l));m.search=d.search;const p=await o(i(m.toString(),{method:r.method,body:"PATCH"===r.method?await r.text():null}));s="DELETE"===r.method?JSON.stringify({message:"Payment preset was successfully deleted."}):JSON.stringify(_({paymentMethodSet:p,base:new URL(r.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}async function U(e){let t,s;try{const{hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,getPaymentMethodSetHostedPaymentGatewayUrl:i,getHostedPaymentGatewayUrl:l,getPaymentMethodSetUrl:d,getPaymentGatewayUrl:m,request:p,fetch:h}=e;if(!["GET","PATCH","DELETE"].includes(p.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const y=a(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),{presetId:f,methodId:c}=y.exec(p.url).groups,w=c.startsWith("H"),_=d(f),g=c.substring(1,w?c.indexOf("C"):void 0),P=o(h(n)),S=o(h(r));if("DELETE"===p.method)if(w){const e=i(c.substring(c.indexOf("C")+1));await o(h(e,{method:"DELETE"}))}else{const e={gateway_uri:""},t=JSON.stringify(e);await o(h(_,{method:"PATCH",body:t}))}let U=await p.text();try{const e=JSON.parse(U);delete e.helper,U=JSON.stringify(e)}catch(e){}if(w){const e=h(l(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await P,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(u({paymentMethodSetHostedPaymentGatewayId:c.substring(c.indexOf("C")+1),hostedPaymentGateway:a,paymentPresetId:f,helper:t.values[a.type],base:new URL(p.url).origin}))}else{const e=h(m(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await S,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(u({paymentGateway:a,paymentPresetId:f,helper:t.values[a.type],base:new URL(p.url).origin}))}}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}class b extends e{constructor(){super(...arguments),this.paymentMethodSetHostedPaymentGatewayBaseUrl=null,this.paymentMethodSetHostedPaymentGatewaysUrl=null,this.hostedPaymentGatewaysHelperUrl=null,this.hostedPaymentGatewayBaseUrl=null,this.hostedPaymentGatewaysUrl=null,this.paymentGatewaysHelperUrl=null,this.paymentMethodSetBaseUrl=null,this.paymentMethodSetsUrl=null,this.fraudProtectionBaseUrl=null,this.fraudProtectionsUrl=null,this.paymentGatewayBaseUrl=null,this.paymentGatewaysUrl=null,this.__api=new r(this),this.__fetch=this.__api.fetch.bind(this.__api),this.__handleFetch=e=>{var s,n,r,o,l;if(!(e instanceof t))return;if(!e.request.url.startsWith("https://foxy-payments-api.element/"))return;if(e.defaultPrevented)return;const{paymentMethodSetHostedPaymentGatewaysUrl:m,hostedPaymentGatewaysHelperUrl:p,paymentGatewaysHelperUrl:f,hostedPaymentGatewaysUrl:u,paymentMethodSetsUrl:w,fraudProtectionsUrl:_,paymentGatewaysUrl:g}=this,b=null!==(s=this.paymentMethodSetHostedPaymentGatewayBaseUrl)&&void 0!==s?s:this.paymentMethodSetHostedPaymentGatewaysUrl,G=null!==(n=this.hostedPaymentGatewayBaseUrl)&&void 0!==n?n:this.hostedPaymentGatewaysUrl,L=null!==(r=this.paymentMethodSetBaseUrl)&&void 0!==r?r:this.paymentMethodSetsUrl,E=null!==(o=this.fraudProtectionBaseUrl)&&void 0!==o?o:this.fraudProtectionsUrl,R=null!==(l=this.paymentGatewayBaseUrl)&&void 0!==l?l:this.paymentGatewaysUrl;if(null===m)return;if(null===b)return;if(null===p)return;if(null===f)return;if(null===u)return;if(null===G)return;if(null===w)return;if(null===L)return;if(null===_)return;if(null===E)return;if(null===g)return;if(null===R)return;const v=e=>t=>{const a=new URL(e);return a.pathname.endsWith("/")||(a.pathname+="/"),a.pathname+=t,a.toString()},x=function(e){const t=[[a(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),U],[a(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}),d],[a(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}),i],[a(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),y],[a(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}),h],[a(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}),c],[a(/\/payment_presets\/(.+)/,{presetId:1}),S],[/\/payment_presets/,P]];for(const[a,s]of t)if(a.test(new URL(e.request.url).pathname))return s(e);return null}({hostedPaymentGatewaysHelperUrl:p,paymentGatewaysHelperUrl:f,hostedPaymentGatewaysUrl:u,paymentMethodSetsUrl:w,fraudProtectionsUrl:_,paymentGatewaysUrl:g,getPaymentMethodSetHostedPaymentGatewayUrl:v(m),getHostedPaymentGatewayUrl:v(G),getPaymentMethodSetUrl:v(L),getFraudProtectionUrl:v(E),getPaymentGatewayUrl:v(R),request:e.request,fetch:this.__fetch});x&&(e.preventDefault(),e.respondWith(x))}}static get properties(){return{paymentMethodSetHostedPaymentGatewayBaseUrl:{attribute:"payment-method-set-hosted-payment-gateway-base-url"},paymentMethodSetHostedPaymentGatewaysUrl:{attribute:"payment-method-set-hosted-payment-gateways-url"},hostedPaymentGatewaysHelperUrl:{attribute:"hosted-payment-gateways-helper-url"},hostedPaymentGatewayBaseUrl:{attribute:"hosted-payment-gateway-base-url"},hostedPaymentGatewaysUrl:{attribute:"hosted-payment-gateways-url"},paymentGatewaysHelperUrl:{attribute:"payment-gateways-helper-url"},paymentMethodSetBaseUrl:{attribute:"payment-method-set-base-url"},paymentMethodSetsUrl:{attribute:"payment-method-sets-url"},fraudProtectionBaseUrl:{attribute:"fraud-protection-base-url"},fraudProtectionsUrl:{attribute:"fraud-protections-url"},paymentGatewayBaseUrl:{attribute:"payment-gateway-base-url"},paymentGatewaysUrl:{attribute:"payment-gateways-url"}}}connectedCallback(){super.connectedCallback(),this.addEventListener("fetch",this.__handleFetch)}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("fetch",this.__handleFetch)}}customElements.define("foxy-payments-api",b);export{b as PaymentsApi};
|
|
1
|
+
import{L as e}from"./shared-7f33a83a.js";import{F as t}from"./shared-343d1fd7.js";import{aJ as a,aj as s,_ as n}from"./shared-1522d76f.js";import{A as r}from"./shared-07e9d1fb.js";async function o(e){const t=await e;if(!t.ok)throw new Error(await t.text());return t.json()}async function i(e){var t;let s,n;try{const{hostedPaymentGatewaysHelperUrl:r,paymentGatewaysHelperUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if("GET"!==d.method)throw s=405,new Error("Method not allowed. Allowed methods: GET.");const p=a(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}).exec(new URL(d.url).pathname).groups.presetId,h=o(m(r)),y=o(m(i)),f=null===(t=(await o(m(l(p))))._links["fx:payment_gateway"])||void 0===t?void 0:t.href,u=f?await o(m(f)):void 0,c=function(e){const{hostedPaymentGatewaysHelper:t,paymentGatewaysHelper:a,paymentPresetId:s,paymentGateway:n,base:r}=e,o=new URL(`./payment_presets/${s}/available_payment_methods`,r),i={};return Object.entries(t.values).forEach((([e,t])=>{i[e]=t})),Object.entries(a.values).forEach((([e,t])=>{i[e]=t,n&&(i[e].conflict={type:n.type,name:n.description})})),{_links:{self:{href:o.toString()}},values:i}}({hostedPaymentGatewaysHelper:await h,paymentGatewaysHelper:await y,paymentPresetId:p,paymentGateway:u,base:new URL(d.url).origin});n=JSON.stringify(c),s=200}catch(e){n=e instanceof Error?e.message:String(e),s=null!=s?s:500}return new Response(n,{status:s})}function l(e){const{paymentPresetId:t,base:a}=e;return{_links:{self:{href:new URL(`./payment_presets/${t}/available_fraud_protections`,a).toString()}},values:{minfraud:{name:"MaxMind minFraud",uses_rejection_threshold:!0,json:null},google_recaptcha:{name:"Google reCAPTCHA",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"config",name:"Configuration",type:"select",description:"Determines how reCAPTCHA is configured to operate.",default_value:"disabled",options:[{name:"Disabled",value:"disabled"},{name:"Always enabled",value:"enabled_always"},{name:"Enabled by errors",value:"enabled_by_errors"}]},{id:"private_key",name:"Private Key",type:"text",optional:!0,description:"If using a custom subdomain, enter your Private Key here.",default_value:""},{id:"site_key",name:"Site Key",type:"text",optional:!0,description:"If using a custom subdomain, enter your Site Key here.",default_value:""}]}]}},custom_precheckout_hook:{name:"Pre-Checkout Webhook",uses_rejection_threshold:!1,json:{blocks:[{id:"",parent_id:"",fields:[{id:"enabled",name:"Enabled",type:"checkbox",default_value:!1},{id:"url",name:"URL",type:"text",description:"Url of your Pre-Checkout Hook",default_value:""},{id:"failure_handling",name:"Failure handling",type:"select",description:"Determines what happens to the checkout submission if your webhook fails to respond correctly.",default_value:"",options:[{name:"Reject",value:"reject"},{name:"Approve",value:"approve"}]}]}]}}}}}async function d(e){let t,s;try{const{request:n}=e;if("GET"!==n.method)throw t=405,new Error("Method not allowed. Allowed methods: GET.");const r=l({paymentPresetId:a(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}).exec(new URL(n.url).pathname).groups.presetId,base:new URL(n.url).origin});s=JSON.stringify(r),t=200}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}const m=["_links"];function p(e){const{paymentMethodSetFraudProtectionId:t,paymentPresetId:a,fraudProtection:r,base:o}=e,{_links:i}=r,d=s(r,m),p=l({paymentPresetId:a,base:o}),h=`${new URL(i.self.href).pathname.split("/").pop()}C${t}`,y=new URL(`./payment_presets/${a}`,o),f=new URL(`./payment_presets/${a}/fraud_protections/${h}`,o);return n(n({_links:{self:{href:f.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:y.toString()}}},d),{},{helper:p.values[r.type]})}async function h(e){var t,s;let n,r;try{const{fraudProtectionsUrl:i,getPaymentMethodSetUrl:l,request:d,fetch:m}=e;if(!["GET","POST"].includes(d.method))throw n=405,new Error("Method not allowed. Allowed methods: GET, POST.");const h=new URL(d.url),y=a(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}).exec(h.pathname).groups.presetId,f=await o(m(l(y)));if("GET"===d.method){const e=parseInt(null!==(t=h.searchParams.get("offset"))&&void 0!==t?t:"0"),a=parseInt(null!==(s=h.searchParams.get("limit"))&&void 0!==s?s:"20"),i=new URL(f._links["fx:payment_method_set_fraud_protections"].href);i.searchParams.set("offset",String(Math.max(0,e-1))),i.searchParams.set("limit",String(a));const l=await o(m(i.toString())),u=await Promise.all(l._embedded["fx:payment_method_set_fraud_protections"].map((async e=>o(m(e._links["fx:fraud_protection"].href))))),c=function(e){const{paymentMethodSetFraudProtections:t,fraudProtections:a,paymentPresetId:s,base:n}=e,r=new URL(`/payment_presets/${s}/fraud_protections`,n);r.search=new URL(t._links.self.href).search;const o=new URL(r.toString());o.search=new URL(t._links.first.href).search;const i=new URL(r.toString());i.search=new URL(t._links.last.href).search;const l=new URL(r.toString());l.search=new URL(t._links.prev.href).search;const d=new URL(r.toString());d.search=new URL(t._links.next.href).search;const m=a.map((e=>{const a=t._embedded["fx:payment_method_set_fraud_protections"].find((t=>t.fraud_protection_uri===e._links.self.href));return p({paymentMethodSetFraudProtectionId:new URL(a._links.self.href).pathname.split("/").pop(),fraudProtection:e,paymentPresetId:s,base:n})}));return{_links:{first:{href:o.toString()},last:{href:i.toString()},prev:{href:l.toString()},next:{href:d.toString()},self:{href:r.toString()}},_embedded:{"fx:fraud_protections":m},returned_items:t.returned_items,total_items:t.total_items,offset:t.offset,limit:t.limit}}({paymentMethodSetFraudProtections:l,fraudProtections:u,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(c)}else{const e=await d.json();delete e.helper;const t=m(i,{method:"POST",body:JSON.stringify(e)}),a=await o(t),s=await o(m(f._links["fx:payment_method_set_fraud_protections"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:f._links.self.href,fraud_protection_uri:a._links.self.href})})),l=p({paymentMethodSetFraudProtectionId:new URL(s._links.self.href).pathname.split("/").pop(),fraudProtection:a,paymentPresetId:y,base:new URL(d.url).origin});n=200,r=JSON.stringify(l)}}catch(e){r=e instanceof Error?e.message:String(e),n=null!=n?n:500}return new Response(r,{status:n})}async function y(e){let t,s;try{const{getPaymentMethodSetUrl:n,getFraudProtectionUrl:r,request:i,fetch:l}=e;if(!["GET","PATCH","DELETE"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const d=a(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),{presetId:m,protectionId:h}=d.exec(i.url).groups,y=n(m),f=h.substring(0,h.indexOf("C"));if("DELETE"===i.method){const e=(await o(l(y)))._links["fx:payment_method_set_fraud_protections"].href,t=new URL(e);t.searchParams.set("fraud_protection_id",f);const a=await o(l(t.toString())),s=a._embedded["fx:payment_method_set_fraud_protections"].map((e=>o(l(e._links.self.href,{method:"DELETE"}))));await Promise.all(s)}let u=await i.text();try{const e=JSON.parse(u);delete e.helper,u=JSON.stringify(e)}catch(e){}const c=l(r(f),{method:i.method,body:"PATCH"===i.method?u:null}),w=await o(c);s="DELETE"===i.method?JSON.stringify({message:"Fraud protection was successfully deleted."}):JSON.stringify(p({paymentMethodSetFraudProtectionId:h.substring(h.indexOf("C")+1),fraudProtection:w,paymentPresetId:m,base:new URL(i.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}const f=["_links"];function u(e){const{paymentPresetId:t,helper:a,base:r}=e,o="paymentGateway"in e?e.paymentGateway:e.hostedPaymentGateway,{_links:i}=o,l=s(o,f),d=new URL(i.self.href).pathname.split("/").pop();let m;m="paymentMethodSetHostedPaymentGatewayId"in e?`H${d}C${e.paymentMethodSetHostedPaymentGatewayId}`:`R${d}`;const p=new URL(`./payment_presets/${t}`,r),h=new URL(`./payment_presets/${t}/payment_methods/${m}`,r);return n(n({_links:{self:{href:h.toString()},"fx:store":i["fx:store"],"fx:payment_preset":{href:p.toString()}}},l),{},{helper:a})}async function c(e){var t,s,n,r;let i,l;try{const{hostedPaymentGatewaysHelperUrl:d,paymentGatewaysHelperUrl:m,hostedPaymentGatewaysUrl:p,getPaymentMethodSetUrl:h,paymentGatewaysUrl:y,request:f,fetch:c}=e;if(!["GET","POST"].includes(f.method))throw i=405,new Error("Method not allowed. Allowed methods: GET, POST.");const w=new URL(f.url),_=a(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}).exec(w.pathname).groups.presetId,[g,P,S]=await Promise.all([o(c(d)),o(c(m)),o(c(h(_)))]);if("GET"===f.method){const e=parseInt(null!==(t=w.searchParams.get("offset"))&&void 0!==t?t:"0"),a=parseInt(null!==(s=w.searchParams.get("limit"))&&void 0!==s?s:"20"),r=new URL(S._links["fx:payment_method_set_hosted_payment_gateways"].href);r.searchParams.set("offset",String(Math.max(0,e-1))),r.searchParams.set("limit",String(a));const d=null===(n=S._links["fx:payment_gateway"])||void 0===n?void 0:n.href,[m,p]=await Promise.all([d&&0===e?o(c(d)):null,o(c(r.toString()))]),h=await Promise.all(p._embedded["fx:payment_method_set_hosted_payment_gateways"].map((async e=>o(c(e._links["fx:hosted_payment_gateway"].href))))),y=function(e){var t,a;const{paymentMethodSetHostedPaymentGateways:s,hostedPaymentGatewaysHelper:n,hostedPaymentGateways:r,paymentGatewaysHelper:o,paymentPresetId:i,paymentGateway:l,query:d,base:m}=e,p=new URLSearchParams(d),h=parseInt(null!==(t=p.get("offset"))&&void 0!==t?t:"0"),y=parseInt(null!==(a=p.get("limit"))&&void 0!==a?a:"20"),f=s.total_items+(l?1:0),c=s.returned_items+(l&&"not-on-page"!==l?1:0),w=new URL(`/payment_presets/${i}/payment_methods`,m);w.search=d;const _=new URL(w.toString()),g=new URL(w.toString()),P=new URL(w.toString()),S=new URL(w.toString());_.searchParams.set("limit",String(y)),_.searchParams.set("offset",String(h)),g.searchParams.set("limit",String(y)),g.searchParams.set("offset",String(Math.max(0,f-y))),P.searchParams.set("limit",String(y)),P.searchParams.set("offset",String(Math.max(0,h-y))),S.searchParams.set("limit",String(y)),S.searchParams.set("offset",String(Math.min(h+y,Math.max(0,f-y))));const U=[...l&&"not-on-page"!==l?[l]:[],...r].map((e=>{const t=s._embedded["fx:payment_method_set_hosted_payment_gateways"].find((t=>t.hosted_payment_gateway_uri===e._links.self.href));return u(t?{paymentMethodSetHostedPaymentGatewayId:new URL(t._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:e,paymentPresetId:i,helper:n.values[e.type],base:m}:{paymentPresetId:i,paymentGateway:e,helper:o.values[e.type],base:m})}));return{_links:{first:{href:_.toString()},last:{href:g.toString()},prev:{href:P.toString()},next:{href:S.toString()},self:{href:w.toString()}},_embedded:{"fx:payment_methods":U},returned_items:c,total_items:f,offset:h,limit:y}}({paymentMethodSetHostedPaymentGateways:p,hostedPaymentGatewaysHelper:g,paymentGatewaysHelper:P,hostedPaymentGateways:h,paymentPresetId:_,paymentGateway:m||(d?"not-on-page":void 0),query:new URL(f.url).search,base:new URL(f.url).origin});i=200,l=JSON.stringify(y)}else{const e=await f.clone().json(),t=!!g.values[null!==(r=e.type)&&void 0!==r?r:""];if(delete e.helper,t){const t=await o(c(p,{method:"POST",body:JSON.stringify(e)})),a=await o(c(S._links["fx:payment_method_set_hosted_payment_gateways"].href,{method:"POST",body:JSON.stringify({payment_method_set_uri:S._links.self.href,hosted_payment_gateway_uri:t._links.self.href})})),s=u({paymentMethodSetHostedPaymentGatewayId:new URL(a._links.self.href).pathname.split("/").pop(),hostedPaymentGateway:t,paymentPresetId:_,helper:g.values[t.type],base:new URL(f.url).origin});i=200,l=JSON.stringify(s)}else{const t=c(y,{method:f.method,body:JSON.stringify(e)}),a=await o(t),s={gateway_uri:a._links.self.href};await Promise.all([o(c(S._links.self.href,{method:"PATCH",body:JSON.stringify(s)})),S.gateway_uri?o(c(S.gateway_uri,{method:"DELETE"})):null]);const n=u({paymentPresetId:_,paymentGateway:a,helper:P.values[a.type],base:new URL(f.url).origin});i=200,l=JSON.stringify(n)}}}catch(e){l=e instanceof Error?e.message:String(e),i=null!=i?i:500}return new Response(l,{status:i})}const w=["_links"];function _(e){const{paymentMethodSet:t,base:a}=e,{_links:r}=t,o=s(t,w),i=new URL(t._links.self.href).pathname.split("/").pop(),l=new URL(`./payment_presets/${i}`,a),d=new URL(`./payment_presets/${i}/payment_methods`,a),m=new URL(`./payment_presets/${i}/fraud_protections`,a),p=new URL(`./payment_presets/${i}/available_payment_methods`,a),h=new URL(`./payment_presets/${i}/available_fraud_protections`,a);return n({_links:{self:{href:l.toString()},"fx:store":r["fx:store"],"fx:payment_methods":{href:d.toString()},"fx:fraud_protections":{href:m.toString()},"fx:available_payment_methods":{href:p.toString()},"fx:available_fraud_protections":{href:h.toString()}}},o)}const g=["_embedded","_links"];async function P(e){let t,a;try{const{paymentMethodSetsUrl:r,request:i,fetch:l}=e;if(!["GET","POST"].includes(i.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, POST.");const d=new URL(i.url),m=new URL(r);let p;if(m.search=d.search,"POST"===i.method){const e=l(m.toString(),{method:"POST",body:await i.text()});p=_({paymentMethodSet:await o(e),base:d.origin})}else p=function(e){const{paymentMethodSets:t,base:a}=e,{_embedded:r,_links:o}=t,i=s(t,g),l=new URL("./payment_presets",a),d=new URL(o.first.href);l.search=d.search;const m=new URL("./payment_presets",a),p=new URL(o.last.href);m.search=p.search;const h=new URL("./payment_presets",a),y=new URL(o.prev.href);h.search=y.search;const f=new URL("./payment_presets",a),u=new URL(o.next.href);f.search=u.search;const c=new URL("./payment_presets",a),w=new URL(o.self.href);return c.search=w.search,n(n({},i),{},{_links:{first:{href:l.toString()},last:{href:m.toString()},prev:{href:h.toString()},next:{href:f.toString()},self:{href:c.toString()}},_embedded:{"fx:payment_presets":r["fx:payment_method_sets"].map((e=>_({paymentMethodSet:e,base:a})))}})}({paymentMethodSets:await o(l(m.toString())),base:d.origin});a=JSON.stringify(p),t=200}catch(e){a=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(a,{status:t})}async function S(e){let t,s;try{const{getPaymentMethodSetUrl:n,request:r,fetch:i}=e;if(!["GET","PATCH","DELETE"].includes(r.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const l=a(/payment_presets\/(.+)/,{presetId:1}).exec(r.url).groups.presetId,d=new URL(r.url),m=new URL(n(l));m.search=d.search;const p=await o(i(m.toString(),{method:r.method,body:"PATCH"===r.method?await r.text():null}));s="DELETE"===r.method?JSON.stringify({message:"Payment preset was successfully deleted."}):JSON.stringify(_({paymentMethodSet:p,base:new URL(r.url).origin}))}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}async function U(e){let t,s;try{const{hostedPaymentGatewaysHelperUrl:n,paymentGatewaysHelperUrl:r,getPaymentMethodSetHostedPaymentGatewayUrl:i,getHostedPaymentGatewayUrl:l,getPaymentMethodSetUrl:d,getPaymentGatewayUrl:m,request:p,fetch:h}=e;if(!["GET","PATCH","DELETE"].includes(p.method))throw t=405,new Error("Method not allowed. Allowed methods: GET, PATCH, DELETE.");const y=a(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),{presetId:f,methodId:c}=y.exec(p.url).groups,w=c.startsWith("H"),_=d(f),g=c.substring(1,w?c.indexOf("C"):void 0),P=o(h(n)),S=o(h(r));if("DELETE"===p.method)if(w){const e=i(c.substring(c.indexOf("C")+1));await o(h(e,{method:"DELETE"}))}else{const e={gateway_uri:""},t=JSON.stringify(e);await o(h(_,{method:"PATCH",body:t}))}let U=await p.text();try{const e=JSON.parse(U);delete e.helper,U=JSON.stringify(e)}catch(e){}if(w){const e=h(l(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await P,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(u({paymentMethodSetHostedPaymentGatewayId:c.substring(c.indexOf("C")+1),hostedPaymentGateway:a,paymentPresetId:f,helper:t.values[a.type],base:new URL(p.url).origin}))}else{const e=h(m(g),{method:p.method,body:"PATCH"===p.method?U:null}),t=await S,a=await o(e);s="DELETE"===p.method?JSON.stringify({message:"Payment method was successfully deleted."}):JSON.stringify(u({paymentGateway:a,paymentPresetId:f,helper:t.values[a.type],base:new URL(p.url).origin}))}}catch(e){s=e instanceof Error?e.message:String(e),t=null!=t?t:500}return new Response(s,{status:t})}class b extends e{constructor(){super(...arguments),this.paymentMethodSetHostedPaymentGatewayBaseUrl=null,this.paymentMethodSetHostedPaymentGatewaysUrl=null,this.hostedPaymentGatewaysHelperUrl=null,this.hostedPaymentGatewayBaseUrl=null,this.hostedPaymentGatewaysUrl=null,this.paymentGatewaysHelperUrl=null,this.paymentMethodSetBaseUrl=null,this.paymentMethodSetsUrl=null,this.fraudProtectionBaseUrl=null,this.fraudProtectionsUrl=null,this.paymentGatewayBaseUrl=null,this.paymentGatewaysUrl=null,this.__api=new r(this),this.__fetch=this.__api.fetch.bind(this.__api),this.__handleFetch=e=>{var s,n,r,o,l;if(!(e instanceof t))return;if(!e.request.url.startsWith("https://foxy-payments-api.element/"))return;if(e.defaultPrevented)return;const{paymentMethodSetHostedPaymentGatewaysUrl:m,hostedPaymentGatewaysHelperUrl:p,paymentGatewaysHelperUrl:f,hostedPaymentGatewaysUrl:u,paymentMethodSetsUrl:w,fraudProtectionsUrl:_,paymentGatewaysUrl:g}=this,b=null!==(s=this.paymentMethodSetHostedPaymentGatewayBaseUrl)&&void 0!==s?s:this.paymentMethodSetHostedPaymentGatewaysUrl,G=null!==(n=this.hostedPaymentGatewayBaseUrl)&&void 0!==n?n:this.hostedPaymentGatewaysUrl,L=null!==(r=this.paymentMethodSetBaseUrl)&&void 0!==r?r:this.paymentMethodSetsUrl,E=null!==(o=this.fraudProtectionBaseUrl)&&void 0!==o?o:this.fraudProtectionsUrl,R=null!==(l=this.paymentGatewayBaseUrl)&&void 0!==l?l:this.paymentGatewaysUrl;if(null===m)return;if(null===b)return;if(null===p)return;if(null===f)return;if(null===u)return;if(null===G)return;if(null===w)return;if(null===L)return;if(null===_)return;if(null===E)return;if(null===g)return;if(null===R)return;const v=e=>t=>{const a=new URL(e);return a.pathname.endsWith("/")||(a.pathname+="/"),a.pathname+=t,a.toString()},x=function(e){const t=[[a(/\/payment_presets\/(.+)\/payment_methods\/(.+)/,{presetId:1,methodId:2}),U],[a(/\/payment_presets\/(.+)\/available_fraud_protections/,{presetId:1}),d],[a(/\/payment_presets\/(.+)\/available_payment_methods/,{presetId:1}),i],[a(/\/payment_presets\/(.+)\/fraud_protections\/(.+)/,{presetId:1,protectionId:2}),y],[a(/\/payment_presets\/(.+)\/fraud_protections/,{presetId:1}),h],[a(/\/payment_presets\/(.+)\/payment_methods/,{presetId:1}),c],[a(/\/payment_presets\/(.+)/,{presetId:1}),S],[/\/payment_presets/,P]];for(const[a,s]of t)if(a.test(new URL(e.request.url).pathname))return s(e);return null}({hostedPaymentGatewaysHelperUrl:p,paymentGatewaysHelperUrl:f,hostedPaymentGatewaysUrl:u,paymentMethodSetsUrl:w,fraudProtectionsUrl:_,paymentGatewaysUrl:g,getPaymentMethodSetHostedPaymentGatewayUrl:v(m),getHostedPaymentGatewayUrl:v(G),getPaymentMethodSetUrl:v(L),getFraudProtectionUrl:v(E),getPaymentGatewayUrl:v(R),request:e.request,fetch:this.__fetch});x&&(e.preventDefault(),e.respondWith(x))}}static get properties(){return{paymentMethodSetHostedPaymentGatewayBaseUrl:{attribute:"payment-method-set-hosted-payment-gateway-base-url"},paymentMethodSetHostedPaymentGatewaysUrl:{attribute:"payment-method-set-hosted-payment-gateways-url"},hostedPaymentGatewaysHelperUrl:{attribute:"hosted-payment-gateways-helper-url"},hostedPaymentGatewayBaseUrl:{attribute:"hosted-payment-gateway-base-url"},hostedPaymentGatewaysUrl:{attribute:"hosted-payment-gateways-url"},paymentGatewaysHelperUrl:{attribute:"payment-gateways-helper-url"},paymentMethodSetBaseUrl:{attribute:"payment-method-set-base-url"},paymentMethodSetsUrl:{attribute:"payment-method-sets-url"},fraudProtectionBaseUrl:{attribute:"fraud-protection-base-url"},fraudProtectionsUrl:{attribute:"fraud-protections-url"},paymentGatewayBaseUrl:{attribute:"payment-gateway-base-url"},paymentGatewaysUrl:{attribute:"payment-gateways-url"}}}connectedCallback(){super.connectedCallback(),this.addEventListener("fetch",this.__handleFetch)}createRenderRoot(){return this}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("fetch",this.__handleFetch)}}customElements.define("foxy-payments-api",b);export{b as PaymentsApi};
|