@foxy.io/elements 1.38.0 → 1.39.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/cdn/foxy-admin-subscription-card.js +1 -1
  2. package/dist/cdn/foxy-admin-subscription-form.js +1 -1
  3. package/dist/cdn/foxy-customer-portal.js +1 -1
  4. package/dist/cdn/foxy-customer.js +1 -1
  5. package/dist/cdn/foxy-subscription-card.js +1 -1
  6. package/dist/cdn/foxy-subscription-form.js +1 -1
  7. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  8. package/dist/cdn/foxy-webhook-card.js +1 -1
  9. package/dist/cdn/foxy-webhook-form.js +1 -1
  10. package/dist/cdn/{shared-0ed075f9.js → shared-56d70cc2.js} +7 -7
  11. package/dist/cdn/shared-e2675ed0.js +1 -0
  12. package/dist/cdn/translations/admin-subscription-card/en.json +9 -7
  13. package/dist/cdn/translations/admin-subscription-form/en.json +7 -2
  14. package/dist/cdn/translations/customer/en.json +16 -12
  15. package/dist/cdn/translations/customer-portal/en.json +16 -12
  16. package/dist/cdn/translations/subscription-card/en.json +9 -8
  17. package/dist/cdn/translations/subscription-form/en.json +8 -6
  18. package/dist/cdn/translations/subscriptions-table/en.json +9 -7
  19. package/dist/cdn/translations/transaction/en.json +4 -2
  20. package/dist/cdn/translations/webhook-card/en.json +2 -0
  21. package/dist/cdn/translations/webhook-form/en.json +16 -2
  22. package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.d.ts +0 -2
  23. package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.js +5 -37
  24. package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.js.map +1 -1
  25. package/dist/elements/public/AdminSubscriptionForm/AdminSubscriptionForm.d.ts +1 -1
  26. package/dist/elements/public/AdminSubscriptionForm/AdminSubscriptionForm.js +4 -3
  27. package/dist/elements/public/AdminSubscriptionForm/AdminSubscriptionForm.js.map +1 -1
  28. package/dist/elements/public/SubscriptionCard/SubscriptionCard.d.ts +0 -2
  29. package/dist/elements/public/SubscriptionCard/SubscriptionCard.js +17 -44
  30. package/dist/elements/public/SubscriptionCard/SubscriptionCard.js.map +1 -1
  31. package/dist/elements/public/SubscriptionForm/SubscriptionForm.d.ts +1 -1
  32. package/dist/elements/public/SubscriptionForm/SubscriptionForm.js +4 -25
  33. package/dist/elements/public/SubscriptionForm/SubscriptionForm.js.map +1 -1
  34. package/dist/elements/public/SubscriptionsTable/SubscriptionsTable.js +14 -29
  35. package/dist/elements/public/SubscriptionsTable/SubscriptionsTable.js.map +1 -1
  36. package/dist/elements/public/WebhookCard/WebhookCard.d.ts +1 -0
  37. package/dist/elements/public/WebhookCard/WebhookCard.js +25 -19
  38. package/dist/elements/public/WebhookCard/WebhookCard.js.map +1 -1
  39. package/dist/elements/public/WebhookCard/types.d.ts +3 -1
  40. package/dist/elements/public/WebhookCard/types.js.map +1 -1
  41. package/dist/elements/public/WebhookForm/WebhookForm.js +12 -6
  42. package/dist/elements/public/WebhookForm/WebhookForm.js.map +1 -1
  43. package/dist/elements/public/WebhookForm/index.d.ts +1 -0
  44. package/dist/elements/public/WebhookForm/index.js +1 -0
  45. package/dist/elements/public/WebhookForm/index.js.map +1 -1
  46. package/dist/utils/get-subscription-status.d.ts +6 -0
  47. package/dist/utils/get-subscription-status.js +29 -0
  48. package/dist/utils/get-subscription-status.js.map +1 -0
  49. package/package.json +1 -1
@@ -1 +1 @@
1
- import"./shared-3661a086.js";import"./foxy-nucleon-element.js";import"./shared-4d32d19e.js";import{_ as e}from"./shared-cb58dfcd.js";import{a as t}from"./shared-11351c00.js";import{C as r}from"./shared-5afb584d.js";import{p as i}from"./shared-8eeddc22.js";import{I as s}from"./shared-f1a70f51.js";import{i as a}from"./shared-53e42a77.js";import{h as o}from"./shared-ba5c42c7.js";import"./foxy-spinner.js";import"./shared-37348820.js";import"./shared-21e68b72.js";import"./shared-c18f681b.js";import"./shared-2aa23b5f.js";import"./shared-343d1fd7.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.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`&ZeroWidthSpace;`)),h&&s?o(_||(_=f`<foxy-i18n infer="" key="${0}" .options="${0}"></foxy-i18n>`),s,h):o(c||(c=f`&ZeroWidthSpace;`)),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`&ZeroWidthSpace;`)),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
+ import"./shared-3661a086.js";import"./foxy-nucleon-element.js";import"./shared-4d32d19e.js";import{_ as e}from"./shared-cb58dfcd.js";import{g as t}from"./shared-e2675ed0.js";import{a as r}from"./shared-11351c00.js";import{C as s}from"./shared-5afb584d.js";import{p as o}from"./shared-8eeddc22.js";import{I as i}from"./shared-f1a70f51.js";import{i as d}from"./shared-53e42a77.js";import{h as a}from"./shared-ba5c42c7.js";import"./foxy-spinner.js";import"./shared-37348820.js";import"./shared-21e68b72.js";import"./shared-c18f681b.js";import"./shared-2aa23b5f.js";import"./shared-343d1fd7.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";import"./shared-4e709717.js";let n,l,_,u,c,m,h,f=e=>e;const p=s(r(i,"admin-subscription-card"));class v extends p{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(){const e=this.__customer,r=this.__transactionTemplate,s=this.__priceKey,o=this.__priceOptions,i=this.__summaryOptions,p=this.__summaryKey,v=t(this.data);return a(n||(n=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> `),d(this.__transactionTemplateHref),this.__transactionTemplateLoaderId,(()=>this.requestUpdate()),d(this.__defaultTemplateSetHref),this.__defaultTemplateSetLoaderId,(()=>this.requestUpdate()),d(this.__localeCodesHelperHref),this.__localeCodesHelperLoaderId,(()=>this.requestUpdate()),d(this.__templateSetHref),this.__templateSetLoaderId,(()=>this.requestUpdate()),d(this.__customerHref),this.__customerLoaderId,(()=>this.requestUpdate()),d(this.__itemsHref),this.__itemsLoaderId,(()=>this.requestUpdate()),d(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),i&&p?a(l||(l=f`<foxy-i18n infer="" key="${0}" .options="${0}"></foxy-i18n>`),p,i):a(_||(_=f`&ZeroWidthSpace;`)),o&&s?a(u||(u=f`<foxy-i18n infer="" key="${0}" .options="${0}"></foxy-i18n>`),s,o):a(c||(c=f`&ZeroWidthSpace;`)),"failed"===v?"text-error":"text-secondary",this.data&&v?a(m||(m=f`<foxy-i18n infer="" key="status_${0}" .options="${0}"></foxy-i18n>`),v,this.data):a(h||(h=f`&ZeroWidthSpace;`)),null==e?void 0:e.first_name,null==e?void 0:e.last_name,null==r?void 0:r.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 s=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:transaction_template"].href)&&void 0!==t?t:"");return s.searchParams.set("zoom","items"),s.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,s;if(!("fx:customer"in(null!==(t=null===(e=this.data)||void 0===e?void 0:e._embedded)&&void 0!==t?t:{})))return null===(s=null===(r=this.data)||void 0===r?void 0:r._links["fx:customer"])||void 0===s?void 0:s.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}`,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 __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 __currencyCode(){var e,t,r;const s=this.__transactionTemplate;if(null==s?void 0:s.currency_code)return s.currency_code;{const s=this.__localeCodesHelper,o=null===(t=null!==(e=this.__templateSet)&&void 0!==e?e:this.__defaultTemplateSet)||void 0===t?void 0:t.locale_code,i=o?null==s?void 0:s.values[o]:void 0;if(i)return null===(r=/Currency: ([A-Z]{3})/g.exec(i))||void 0===r?void 0:r[1]}}get __priceOptions(){var t,r;const s=this.__currencyDisplay;if(void 0===s)return;const i=this.__currencyCode;if(void 0===i)return;const d=null===(t=this.__transactionTemplate)||void 0===t?void 0:t.total_order;if(void 0===d)return;const a=null===(r=this.data)||void 0===r?void 0:r.frequency;return void 0!==a?e(e({},o(a)),{},{amount:`${d} ${i}`,currencyDisplay:s}):void 0}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",v);export{v as AdminSubscriptionCard};
@@ -1 +1 @@
1
- import"./shared-0c134ce7.js";import"./shared-2ab1e9eb.js";import"./shared-c05643e6.js";import"./shared-e4119ddc.js";import{b as r,I as e}from"./shared-5b4e2567.js";import"./foxy-transaction-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-transaction.js";import"./foxy-copy-to-clipboard.js";import"./shared-4d32d19e.js";import{_ as t,B as o}from"./shared-cb58dfcd.js";import{R as s,a as i}from"./shared-11351c00.js";import{h as a,s as n}from"./shared-ba5c42c7.js";import{i as d}from"./shared-53e42a77.js";import"./shared-f9ac8763.js";import"./shared-21e68b72.js";import"./shared-37348820.js";import"./shared-315d7620.js";import"./shared-6957b8e6.js";import"./shared-8ef0ca65.js";import"./shared-3556f4b7.js";import"./shared-7dc9c80b.js";import"./shared-c25538f1.js";import"./shared-80a1bf6f.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-c18f681b.js";import"./shared-2aa23b5f.js";import"./shared-343d1fd7.js";import"./shared-5afb584d.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-e5546d55.js";import"./shared-048d5cae.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-b65d169b.js";import"./shared-8b0f00fa.js";import"./shared-be442f26.js";import"./shared-edeeb089.js";import"./shared-f989c70e.js";import"./shared-83c5e004.js";import"./shared-6683daed.js";import"./shared-243456aa.js";import"./shared-c1e86ea4.js";import"./shared-651c44fa.js";import"./shared-1c355fac.js";import"./shared-cf12f33b.js";import"./shared-29f60d2f.js";import"./shared-a587fd4b.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-5212ef4f.js";import"./shared-bab2ea2c.js";import"./shared-d807cb20.js";import"./shared-360d6a20.js";import"./shared-3661a086.js";import"./shared-f1a70f51.js";import"./shared-cc7e1dc6.js";import"./shared-3a952968.js";import"./foxy-billing-address-card.js";import"./foxy-custom-field-form.js";import"./shared-9e8ed3af.js";import"./foxy-custom-field-card.js";import"./shared-0df46275.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./shared-eb963ba3.js";import"./foxy-payment-card.js";import"./shared-cf613436.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./shared-4a4f6eb9.js";import"./shared-8b25a098.js";import"./shared-eea8debb.js";import"./shared-afe24913.js";import"./shared-d0aed1c1.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./foxy-address-form.js";import"./foxy-item-card.js";import"./shared-8eeddc22.js";import"./foxy-item-form.js";import"./shared-27cfa174.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-63c32024.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./shared-2c81b7df.js";import"./foxy-customer-card.js";let c,m=r=>r;class l extends(s(r)){constructor(){super(...arguments),this.search=null}static get properties(){return t(t({},super.properties),{},{search:{}})}renderControl(){var r,e;const t=this.nucleon;let o;try{const s=new URL(null!==(e=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r._links["fx:sub_token_url"].href)&&void 0!==e?e:"");if(this.search){const r=new URLSearchParams(s.search);s.search=this.search,r.forEach(((r,e)=>s.searchParams.set(e,r)))}o=s.toString()}catch(r){o=void 0}return a(c||(c=m` <div class="leading-xs flex items-center gap-xs"> <foxy-i18n class="truncate min-w-0" infer="" key="label"></foxy-i18n> <span class="text-tertiary"> &bull; </span> <foxy-copy-to-clipboard layout="complete" theme="tertiary-inline" infer="copy-to-clipboard" text="${0}"> </foxy-copy-to-clipboard> </div> <foxy-i18n class="leading-xs block text-xs text-secondary" infer="" key="helper_text"> </foxy-i18n> `),o)}}customElements.define("foxy-internal-admin-subscription-form-link-control",l);let f,p,h=r=>r;customElements.define("foxy-internal-admin-subscription-form-error",class extends r{renderControl(){var r,e;return a(f||(f=h` <p class="flex items-start gap-ds p-ds rounded border border-error-50" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <span>${0}</span> </p> `),n(p||(p=h`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-error" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)),null===(e=null===(r=this.nucleon)||void 0===r?void 0:r.data)||void 0===e?void 0:e.error_message)}});let u,y,x,j=r=>r;const b=i(e,"admin-subscription-form");class v extends b{constructor(){super(...arguments),this.uoeSettingsPage=null}static get properties(){return t(t({},super.properties),{},{uoeSettingsPage:{attribute:"uoe-settings-page"}})}get hiddenSelector(){var r,e;const t=["delete",super.hiddenSelector.toString()];return(null===(r=this.data)||void 0===r?void 0:r.error_message)||t.unshift("error-message"),(null===(e=this.data)||void 0===e?void 0:e.is_active)||t.unshift("view-action","cancel-action"),new o(t.join(" ").trim())}get headerSubtitleOptions(){var r;return{context:(null===(r=this.data)||void 0===r?void 0:r.is_active)?"active":"inactive"}}renderBody(){var r,e,t,o,s;let i;try{const t=new URL(null!==(e=null===(r=this.data)||void 0===r?void 0:r._links["fx:transactions"].href)&&void 0!==e?e:"");t.searchParams.set("zoom","items"),i=t.toString()}catch(r){i=void 0}return a(u||(u=j` ${0} <foxy-internal-admin-subscription-form-error infer="error-message"> </foxy-internal-admin-subscription-form-error> <foxy-internal-summary-control infer="general"> <foxy-internal-date-control layout="summary-item" infer="start-date"> </foxy-internal-date-control> <foxy-internal-frequency-control layout="summary-item" infer="frequency" allow-twice-a-month> </foxy-internal-frequency-control> <foxy-internal-date-control layout="summary-item" infer="next-transaction-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="overdue"> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="past-due-amount" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="self-service-links"> <foxy-internal-admin-subscription-form-link-control infer="load-in-cart"> </foxy-internal-admin-subscription-form-link-control> <foxy-internal-admin-subscription-form-link-control search="cart=checkout" infer="load-on-checkout"> </foxy-internal-admin-subscription-form-link-control> <foxy-internal-admin-subscription-form-link-control search="sub_cancel=next_transaction_date" infer="cancel-at-end-of-billing-period"> </foxy-internal-admin-subscription-form-link-control> <foxy-internal-admin-subscription-form-link-control search="sub_cancel=true" infer="cancel-next-day"> </foxy-internal-admin-subscription-form-link-control> <div class="flex items-start leading-xs text-xs text-secondary" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="" key="uoe_hint_text"></foxy-i18n> ${0} </p> </div> </foxy-internal-summary-control> ${0} <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="transactions" class="min-w-0" first="${0}" item="foxy-transaction-card" form="foxy-transaction" hide-create-button hide-delete-button alert wide> </foxy-internal-async-list-control> ${0} `),this.renderHeader(),d(null===(t=this.data)||void 0===t?void 0:t._embedded["fx:transaction_template"].currency_code),n(y||(y=j`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" class="flex-shrink-0" style="width: 1.25em"><path fill-rule="evenodd" d="M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0ZM9 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM6.75 8a.75.75 0 0 0 0 1.5h.75v1.75a.75.75 0 0 0 1.5 0v-2.5A.75.75 0 0 0 8.25 8h-1.5Z" clip-rule="evenodd" /></svg>`)),this.uoeSettingsPage?a(x||(x=j` <a target="_blank" class="inline-block rounded font-medium text-body cursor-pointer hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="" key="uoe_link_text"></foxy-i18n> </a> `),this.uoeSettingsPage):"",this.renderTemplateOrSlot(),d(null===(s=null===(o=this.data)||void 0===o?void 0:o._links)||void 0===s?void 0:s["fx:attributes"].href),d(i),super.renderBody())}}customElements.define("foxy-admin-subscription-form",v);export{v as AdminSubscriptionForm};
1
+ import"./shared-0c134ce7.js";import"./shared-2ab1e9eb.js";import"./shared-c05643e6.js";import"./shared-e4119ddc.js";import{b as r,I as e}from"./shared-5b4e2567.js";import"./foxy-transaction-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-transaction.js";import"./foxy-copy-to-clipboard.js";import"./shared-4d32d19e.js";import{_ as t,B as o}from"./shared-cb58dfcd.js";import{R as s,a as i}from"./shared-11351c00.js";import{h as a,s as n}from"./shared-ba5c42c7.js";import{g as d}from"./shared-e2675ed0.js";import{i as m}from"./shared-53e42a77.js";import"./shared-f9ac8763.js";import"./shared-21e68b72.js";import"./shared-37348820.js";import"./shared-315d7620.js";import"./shared-6957b8e6.js";import"./shared-8ef0ca65.js";import"./shared-3556f4b7.js";import"./shared-7dc9c80b.js";import"./shared-c25538f1.js";import"./shared-80a1bf6f.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-c18f681b.js";import"./shared-2aa23b5f.js";import"./shared-343d1fd7.js";import"./shared-5afb584d.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-e5546d55.js";import"./shared-048d5cae.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-b65d169b.js";import"./shared-8b0f00fa.js";import"./shared-be442f26.js";import"./shared-edeeb089.js";import"./shared-f989c70e.js";import"./shared-83c5e004.js";import"./shared-6683daed.js";import"./shared-243456aa.js";import"./shared-c1e86ea4.js";import"./shared-651c44fa.js";import"./shared-1c355fac.js";import"./shared-cf12f33b.js";import"./shared-29f60d2f.js";import"./shared-a587fd4b.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./shared-5212ef4f.js";import"./shared-bab2ea2c.js";import"./shared-d807cb20.js";import"./shared-360d6a20.js";import"./shared-3661a086.js";import"./shared-f1a70f51.js";import"./shared-cc7e1dc6.js";import"./shared-3a952968.js";import"./foxy-billing-address-card.js";import"./foxy-custom-field-form.js";import"./shared-9e8ed3af.js";import"./foxy-custom-field-card.js";import"./shared-0df46275.js";import"./foxy-nucleon-element.js";import"./foxy-shipment-card.js";import"./shared-eb963ba3.js";import"./foxy-payment-card.js";import"./shared-cf613436.js";import"./foxy-webhook-card.js";import"./foxy-webhook-form.js";import"./shared-4a4f6eb9.js";import"./shared-8b25a098.js";import"./shared-eea8debb.js";import"./shared-2c81b7df.js";import"./shared-afe24913.js";import"./shared-d0aed1c1.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import"./foxy-address-form.js";import"./foxy-item-card.js";import"./shared-8eeddc22.js";import"./foxy-item-form.js";import"./shared-27cfa174.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-category-card.js";import"./foxy-discount-builder.js";import"./shared-63c32024.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-customer-card.js";let c,l=r=>r;class f extends(s(r)){constructor(){super(...arguments),this.search=null}static get properties(){return t(t({},super.properties),{},{search:{}})}renderControl(){var r,e;const t=this.nucleon;let o;try{const s=new URL(null!==(e=null===(r=null==t?void 0:t.data)||void 0===r?void 0:r._links["fx:sub_token_url"].href)&&void 0!==e?e:"");if(this.search){const r=new URLSearchParams(s.search);s.search=this.search,r.forEach(((r,e)=>s.searchParams.set(e,r)))}o=s.toString()}catch(r){o=void 0}return a(c||(c=l` <div class="leading-xs flex items-center gap-xs"> <foxy-i18n class="truncate min-w-0" infer="" key="label"></foxy-i18n> <span class="text-tertiary"> &bull; </span> <foxy-copy-to-clipboard layout="complete" theme="tertiary-inline" infer="copy-to-clipboard" text="${0}"> </foxy-copy-to-clipboard> </div> <foxy-i18n class="leading-xs block text-xs text-secondary" infer="" key="helper_text"> </foxy-i18n> `),o)}}customElements.define("foxy-internal-admin-subscription-form-link-control",f);let p,h,u=r=>r;customElements.define("foxy-internal-admin-subscription-form-error",class extends r{renderControl(){var r,e;return a(p||(p=u` <p class="flex items-start gap-ds p-ds rounded border border-error-50" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px);gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <span>${0}</span> </p> `),n(h||(h=u`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="flex-shrink-0 text-error" style="width: 1.25em"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z" clip-rule="evenodd"></path></svg>`)),null===(e=null===(r=this.nucleon)||void 0===r?void 0:r.data)||void 0===e?void 0:e.error_message)}});let y,x,j,b=r=>r;const v=i(e,"admin-subscription-form");class g extends v{constructor(){super(...arguments),this.uoeSettingsPage=null}static get properties(){return t(t({},super.properties),{},{uoeSettingsPage:{attribute:"uoe-settings-page"}})}get hiddenSelector(){var r,e;const t=["delete",super.hiddenSelector.toString()];return(null===(r=this.data)||void 0===r?void 0:r.error_message)||t.unshift("error-message"),(null===(e=this.data)||void 0===e?void 0:e.is_active)||t.unshift("view-action","cancel-action"),new o(t.join(" ").trim())}get headerSubtitleKey(){const r=d(this.data);return r?`subtitle_${r}`:super.headerSubtitleKey}renderBody(){var r,e,t,o,s;let i;try{const t=new URL(null!==(e=null===(r=this.data)||void 0===r?void 0:r._links["fx:transactions"].href)&&void 0!==e?e:"");t.searchParams.set("zoom","items"),i=t.toString()}catch(r){i=void 0}return a(y||(y=b` ${0} <foxy-internal-admin-subscription-form-error infer="error-message"> </foxy-internal-admin-subscription-form-error> <foxy-internal-summary-control infer="general"> <foxy-internal-date-control layout="summary-item" infer="start-date"> </foxy-internal-date-control> <foxy-internal-frequency-control layout="summary-item" infer="frequency" allow-twice-a-month> </foxy-internal-frequency-control> <foxy-internal-date-control layout="summary-item" infer="next-transaction-date"> </foxy-internal-date-control> <foxy-internal-date-control layout="summary-item" infer="end-date"> </foxy-internal-date-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="overdue"> <foxy-internal-number-control layout="summary-item" suffix="${0}" infer="past-due-amount" min="0"> </foxy-internal-number-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="self-service-links"> <foxy-internal-admin-subscription-form-link-control infer="load-in-cart"> </foxy-internal-admin-subscription-form-link-control> <foxy-internal-admin-subscription-form-link-control search="cart=checkout" infer="load-on-checkout"> </foxy-internal-admin-subscription-form-link-control> <foxy-internal-admin-subscription-form-link-control search="sub_cancel=next_transaction_date" infer="cancel-at-end-of-billing-period"> </foxy-internal-admin-subscription-form-link-control> <foxy-internal-admin-subscription-form-link-control search="sub_cancel=true" infer="cancel-next-day"> </foxy-internal-admin-subscription-form-link-control> <div class="flex items-start leading-xs text-xs text-secondary" style="gap:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> ${0} <p> <foxy-i18n infer="" key="uoe_hint_text"></foxy-i18n> ${0} </p> </div> </foxy-internal-summary-control> ${0} <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" item="foxy-attribute-card" form="foxy-attribute-form" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="transactions" class="min-w-0" first="${0}" item="foxy-transaction-card" form="foxy-transaction" hide-create-button hide-delete-button alert wide> </foxy-internal-async-list-control> ${0} `),this.renderHeader(),m(null===(t=this.data)||void 0===t?void 0:t._embedded["fx:transaction_template"].currency_code),n(x||(x=b`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true" class="flex-shrink-0" style="width: 1.25em"><path fill-rule="evenodd" d="M15 8A7 7 0 1 1 1 8a7 7 0 0 1 14 0ZM9 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM6.75 8a.75.75 0 0 0 0 1.5h.75v1.75a.75.75 0 0 0 1.5 0v-2.5A.75.75 0 0 0 8.25 8h-1.5Z" clip-rule="evenodd" /></svg>`)),this.uoeSettingsPage?a(j||(j=b` <a target="_blank" class="inline-block rounded font-medium text-body cursor-pointer hover-underline focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="" key="uoe_link_text"></foxy-i18n> </a> `),this.uoeSettingsPage):"",this.renderTemplateOrSlot(),m(null===(s=null===(o=this.data)||void 0===o?void 0:o._links)||void 0===s?void 0:s["fx:attributes"].href),m(i),super.renderBody())}}customElements.define("foxy-admin-subscription-form",g);export{g as AdminSubscriptionForm};
@@ -1,4 +1,4 @@
1
- import"./foxy-customer.js";import"./shared-8ef0ca65.js";import"./shared-c18f681b.js";import"./shared-37348820.js";import"./shared-4a4f6eb9.js";import"./shared-5212ef4f.js";import{I as e}from"./shared-5b4e2567.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{u as s}from"./shared-2508187b.js";import"./foxy-sign-in-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import"./shared-4d32d19e.js";import{_ as r,B as o,aH as i}from"./shared-cb58dfcd.js";import{h as a,L as n,c as d}from"./shared-ba5c42c7.js";import{A as l}from"./shared-99a8889a.js";import"./shared-673d668a.js";import{C as c}from"./shared-1d0839af.js";import{a as m,T as u}from"./shared-11351c00.js";import{U as p}from"./shared-cd96ff03.js";import{i as h}from"./shared-53e42a77.js";import{c as f}from"./shared-4e709717.js";import{A as g}from"./shared-5592ec6e.js";import{C as y}from"./shared-5afb584d.js";import{I as $}from"./shared-2aa23b5f.js";import"./shared-21e68b72.js";import"./foxy-update-payment-method-form.js";import"./shared-27cfa174.js";import"./shared-0c134ce7.js";import"./shared-f9ac8763.js";import"./shared-315d7620.js";import"./shared-6957b8e6.js";import"./shared-3556f4b7.js";import"./shared-7dc9c80b.js";import"./shared-c25538f1.js";import"./shared-80a1bf6f.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-f83207fb.js";import"./shared-343d1fd7.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";import"./shared-e5546d55.js";import"./shared-048d5cae.js";import"./foxy-copy-to-clipboard.js";import"./shared-d807cb20.js";import"./shared-360d6a20.js";import"./foxy-nucleon-element.js";import"./shared-53e476fd.js";import"./shared-bab2ea2c.js";import"./foxy-template-set-card.js";import"./shared-0df46275.js";import"./shared-f1a70f51.js";import"./foxy-payment-card-embed.js";import"./shared-be442f26.js";import"./shared-8b0f00fa.js";import"./shared-c1e86ea4.js";import"./shared-f989c70e.js";import"./shared-bd5285ff.js";import"./shared-5fd5805c.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./shared-cc7e1dc6.js";import"./shared-3a952968.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./shared-9e8ed3af.js";import"./shared-eea8debb.js";import"./shared-243456aa.js";import"./shared-651c44fa.js";import"./shared-edeeb089.js";import"./shared-1c355fac.js";import"./shared-cf12f33b.js";import"./shared-afe24913.js";import"./shared-d0aed1c1.js";import"./foxy-table.js";import"./shared-e3421ca1.js";import"./shared-c46affa4.js";import"./shared-b65d169b.js";import"./shared-83c5e004.js";import"./shared-495860b4.js";import"./shared-6683daed.js";import"./shared-a03facdf.js";import"./shared-a587fd4b.js";import"./shared-4f64c35e.js";import"./shared-0ed075f9.js";import"./shared-8eeddc22.js";import"./shared-cf613436.js";import"./shared-c05643e6.js";import"./shared-f69aacbc.js";import"./shared-43e2c3f6.js";import"./shared-79d0699c.js";import"./foxy-transaction-card.js";import"./shared-3661a086.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-eb963ba3.js";import"./shared-a6b2bd14.js";import"./shared-8b25a098.js";import"./shared-b738ee96.js";import"./shared-f1033d78.js";
1
+ import"./foxy-customer.js";import"./shared-8ef0ca65.js";import"./shared-c18f681b.js";import"./shared-37348820.js";import"./shared-4a4f6eb9.js";import"./shared-5212ef4f.js";import{I as e}from"./shared-5b4e2567.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{u as s}from"./shared-2508187b.js";import"./foxy-sign-in-form.js";import"./foxy-form-dialog.js";import"./foxy-spinner.js";import"./shared-4d32d19e.js";import{_ as r,B as o,aH as i}from"./shared-cb58dfcd.js";import{h as a,L as n,c as d}from"./shared-ba5c42c7.js";import{A as l}from"./shared-99a8889a.js";import"./shared-673d668a.js";import{C as c}from"./shared-1d0839af.js";import{a as m,T as u}from"./shared-11351c00.js";import{U as p}from"./shared-cd96ff03.js";import{i as h}from"./shared-53e42a77.js";import{c as f}from"./shared-4e709717.js";import{A as g}from"./shared-5592ec6e.js";import{C as y}from"./shared-5afb584d.js";import{I as $}from"./shared-2aa23b5f.js";import"./shared-21e68b72.js";import"./foxy-update-payment-method-form.js";import"./shared-27cfa174.js";import"./shared-0c134ce7.js";import"./shared-f9ac8763.js";import"./shared-315d7620.js";import"./shared-6957b8e6.js";import"./shared-3556f4b7.js";import"./shared-7dc9c80b.js";import"./shared-c25538f1.js";import"./shared-80a1bf6f.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-f83207fb.js";import"./shared-343d1fd7.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";import"./shared-e5546d55.js";import"./shared-048d5cae.js";import"./foxy-copy-to-clipboard.js";import"./shared-d807cb20.js";import"./shared-360d6a20.js";import"./foxy-nucleon-element.js";import"./shared-53e476fd.js";import"./shared-bab2ea2c.js";import"./foxy-template-set-card.js";import"./shared-0df46275.js";import"./shared-f1a70f51.js";import"./foxy-payment-card-embed.js";import"./shared-be442f26.js";import"./shared-8b0f00fa.js";import"./shared-c1e86ea4.js";import"./shared-f989c70e.js";import"./shared-bd5285ff.js";import"./shared-5fd5805c.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./shared-cc7e1dc6.js";import"./shared-3a952968.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./shared-9e8ed3af.js";import"./shared-eea8debb.js";import"./shared-243456aa.js";import"./shared-651c44fa.js";import"./shared-edeeb089.js";import"./shared-1c355fac.js";import"./shared-cf12f33b.js";import"./shared-afe24913.js";import"./shared-d0aed1c1.js";import"./foxy-table.js";import"./shared-e3421ca1.js";import"./shared-c46affa4.js";import"./shared-b65d169b.js";import"./shared-83c5e004.js";import"./shared-495860b4.js";import"./shared-6683daed.js";import"./shared-a03facdf.js";import"./shared-a587fd4b.js";import"./shared-4f64c35e.js";import"./shared-56d70cc2.js";import"./shared-8eeddc22.js";import"./shared-e2675ed0.js";import"./shared-cf613436.js";import"./shared-c05643e6.js";import"./shared-f69aacbc.js";import"./shared-43e2c3f6.js";import"./shared-79d0699c.js";import"./foxy-transaction-card.js";import"./shared-3661a086.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-eb963ba3.js";import"./shared-a6b2bd14.js";import"./shared-8b25a098.js";import"./shared-b738ee96.js";import"./shared-f1033d78.js";
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -1,4 +1,4 @@
1
- import"./shared-37348820.js";import"./shared-c18f681b.js";import{h as t}from"./shared-21e68b72.js";import"./shared-8ef0ca65.js";import"./shared-5212ef4f.js";import"./foxy-payment-method-card.js";import"./foxy-update-payment-method-form.js";import"./foxy-subscription-form.js";import"./foxy-form-dialog.js";import"./foxy-transactions-table.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./shared-2508187b.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./foxy-spinner.js";import"./foxy-table.js";import"./shared-4d32d19e.js";import{aH as e,_ as s}from"./shared-cb58dfcd.js";import{L as r,h as a,c as o}from"./shared-ba5c42c7.js";import{C as i}from"./shared-5afb584d.js";import"./shared-f9ac8763.js";import"./shared-360d6a20.js";import{z as h,S as d,T as n,a as l}from"./shared-11351c00.js";import{c as m}from"./shared-4e709717.js";import{S as c}from"./shared-c46affa4.js";import"./shared-048d5cae.js";import{G as v}from"./shared-4f64c35e.js";import"./shared-be442f26.js";import"./shared-c1e86ea4.js";import"./shared-7dc9c80b.js";import"./shared-f989c70e.js";import"./shared-bd5285ff.js";import"./shared-8b0f00fa.js";import{N as p}from"./shared-f83207fb.js";import{S as f}from"./shared-0ed075f9.js";import{i as g}from"./shared-53e42a77.js";import"./shared-315d7620.js";import"./shared-e5546d55.js";import"./shared-cf613436.js";import"./foxy-nucleon-element.js";import"./shared-5592ec6e.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-2aa23b5f.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";import"./shared-27cfa174.js";import"./shared-0c134ce7.js";import"./shared-6957b8e6.js";import"./shared-3556f4b7.js";import"./shared-c25538f1.js";import"./shared-80a1bf6f.js";import"./shared-5b4e2567.js";import"./foxy-copy-to-clipboard.js";import"./shared-d807cb20.js";import"./shared-bab2ea2c.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-53e476fd.js";import"./foxy-template-set-card.js";import"./shared-0df46275.js";import"./shared-f1a70f51.js";import"./foxy-payment-card-embed.js";import"./shared-99a8889a.js";import"./shared-673d668a.js";import"./shared-5fd5805c.js";import"./shared-243456aa.js";import"./shared-651c44fa.js";import"./shared-edeeb089.js";import"./shared-1c355fac.js";import"./shared-cf12f33b.js";import"./shared-c05643e6.js";import"./shared-b65d169b.js";import"./shared-f69aacbc.js";import"./shared-43e2c3f6.js";import"./shared-79d0699c.js";import"./foxy-transaction-card.js";import"./shared-3661a086.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-8eeddc22.js";import"./shared-eb963ba3.js";import"./shared-e3421ca1.js";import"./shared-cc7e1dc6.js";import"./shared-3a952968.js";import"./shared-a6b2bd14.js";import"./shared-4a4f6eb9.js";import"./shared-8b25a098.js";import"./shared-afe24913.js";import"./shared-d0aed1c1.js";import"./shared-b738ee96.js";import"./shared-9e8ed3af.js";import"./shared-eea8debb.js";import"./shared-83c5e004.js";import"./shared-495860b4.js";import"./shared-6683daed.js";import"./shared-a03facdf.js";import"./shared-a587fd4b.js";let z,u,b,$=t=>t;class H extends r{constructor(){super(...arguments),this.value=0,this.size=0}static get properties(){return{value:{type:Number},size:{type:Number}}}static get styles(){return h.styles}render(){const t=[],e=[];for(let s=0;s<this.size;++s)t.push(a(z||(z=$` <button id="tab-${0}" role="tab" class="${0}" aria-controls="panel-${0}" aria-selected="${0}" @click="${0}" @keydown="${0}"> <slot name="tab-${0}"></slot> </button> `),s,m({"text-l font-medium px-s rounded focus-outline-none focus-shadow-outline":!0,"text-tertiary hover-text-body focus-text-body":this.value!==s}),s,this.value===s,(()=>this.value=s),this.__handleKeyDown,s)),e.push(a(u||(u=$` <slot id="panel-${0}" role="tabpanel" name="panel-${0}" class="${0}" aria-hidden="${0}" aria-labelledby="tab-${0}"> </slot> `),s,s,m({hidden:this.value!==s}),this.value!==s,s));return a(b||(b=$` <div role="tablist" aria-orientation="horizontal" class="-mx-s mb-s">${0}</div> ${0} `),t,e)}__handleKeyDown(t){if(t.key.startsWith("Arrow")){t.preventDefault();const e=t.target;let s=null;"ArrowRight"===t.key||"ArrowDown"===t.key?s=e.nextElementSibling:"ArrowLeft"!==t.key&&"ArrowUp"!==t.key||(s=e.previousElementSibling),null==s||s.click(),null==s||s.focus()}}}
1
+ import"./shared-37348820.js";import"./shared-c18f681b.js";import{h as t}from"./shared-21e68b72.js";import"./shared-8ef0ca65.js";import"./shared-5212ef4f.js";import"./foxy-payment-method-card.js";import"./foxy-update-payment-method-form.js";import"./foxy-subscription-form.js";import"./foxy-form-dialog.js";import"./foxy-transactions-table.js";import"./foxy-collection-pages.js";import"./foxy-collection-page.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./shared-2508187b.js";import"./foxy-address-card.js";import"./foxy-address-form.js";import"./foxy-spinner.js";import"./foxy-table.js";import"./shared-4d32d19e.js";import{aH as e,_ as s}from"./shared-cb58dfcd.js";import{L as r,h as a,c as o}from"./shared-ba5c42c7.js";import{C as i}from"./shared-5afb584d.js";import"./shared-f9ac8763.js";import"./shared-360d6a20.js";import{z as h,S as d,T as n,a as l}from"./shared-11351c00.js";import{c as m}from"./shared-4e709717.js";import{S as c}from"./shared-c46affa4.js";import"./shared-048d5cae.js";import{G as v}from"./shared-4f64c35e.js";import"./shared-be442f26.js";import"./shared-c1e86ea4.js";import"./shared-7dc9c80b.js";import"./shared-f989c70e.js";import"./shared-bd5285ff.js";import"./shared-8b0f00fa.js";import{N as p}from"./shared-f83207fb.js";import{S as f}from"./shared-56d70cc2.js";import{i as g}from"./shared-53e42a77.js";import"./shared-315d7620.js";import"./shared-e5546d55.js";import"./shared-cf613436.js";import"./foxy-nucleon-element.js";import"./shared-5592ec6e.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-2aa23b5f.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";import"./shared-27cfa174.js";import"./shared-0c134ce7.js";import"./shared-6957b8e6.js";import"./shared-3556f4b7.js";import"./shared-c25538f1.js";import"./shared-80a1bf6f.js";import"./shared-5b4e2567.js";import"./foxy-copy-to-clipboard.js";import"./shared-d807cb20.js";import"./shared-bab2ea2c.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./shared-53e476fd.js";import"./foxy-template-set-card.js";import"./shared-0df46275.js";import"./shared-f1a70f51.js";import"./foxy-payment-card-embed.js";import"./shared-99a8889a.js";import"./shared-673d668a.js";import"./shared-5fd5805c.js";import"./shared-243456aa.js";import"./shared-651c44fa.js";import"./shared-edeeb089.js";import"./shared-1c355fac.js";import"./shared-cf12f33b.js";import"./shared-c05643e6.js";import"./shared-b65d169b.js";import"./shared-f69aacbc.js";import"./shared-43e2c3f6.js";import"./shared-79d0699c.js";import"./foxy-transaction-card.js";import"./shared-3661a086.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-8eeddc22.js";import"./shared-eb963ba3.js";import"./shared-e2675ed0.js";import"./shared-e3421ca1.js";import"./shared-cc7e1dc6.js";import"./shared-3a952968.js";import"./shared-a6b2bd14.js";import"./shared-4a4f6eb9.js";import"./shared-8b25a098.js";import"./shared-afe24913.js";import"./shared-d0aed1c1.js";import"./shared-b738ee96.js";import"./shared-9e8ed3af.js";import"./shared-eea8debb.js";import"./shared-83c5e004.js";import"./shared-495860b4.js";import"./shared-6683daed.js";import"./shared-a03facdf.js";import"./shared-a587fd4b.js";let z,u,b,$=t=>t;class H extends r{constructor(){super(...arguments),this.value=0,this.size=0}static get properties(){return{value:{type:Number},size:{type:Number}}}static get styles(){return h.styles}render(){const t=[],e=[];for(let s=0;s<this.size;++s)t.push(a(z||(z=$` <button id="tab-${0}" role="tab" class="${0}" aria-controls="panel-${0}" aria-selected="${0}" @click="${0}" @keydown="${0}"> <slot name="tab-${0}"></slot> </button> `),s,m({"text-l font-medium px-s rounded focus-outline-none focus-shadow-outline":!0,"text-tertiary hover-text-body focus-text-body":this.value!==s}),s,this.value===s,(()=>this.value=s),this.__handleKeyDown,s)),e.push(a(u||(u=$` <slot id="panel-${0}" role="tabpanel" name="panel-${0}" class="${0}" aria-hidden="${0}" aria-labelledby="tab-${0}"> </slot> `),s,s,m({hidden:this.value!==s}),this.value!==s,s));return a(b||(b=$` <div role="tablist" aria-orientation="horizontal" class="-mx-s mb-s">${0}</div> ${0} `),t,e)}__handleKeyDown(t){if(t.key.startsWith("Arrow")){t.preventDefault();const e=t.target;let s=null;"ArrowRight"===t.key||"ArrowDown"===t.key?s=e.nextElementSibling:"ArrowLeft"!==t.key&&"ArrowUp"!==t.key||(s=e.previousElementSibling),null==s||s.click(),null==s||s.focus()}}}
2
2
  /**
3
3
  @license
4
4
  Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
@@ -1 +1 @@
1
- import"./shared-d807cb20.js";import"./shared-c18f681b.js";import"./shared-37348820.js";import"./shared-5212ef4f.js";import"./foxy-spinner.js";import"./shared-4d32d19e.js";import{_ as t}from"./shared-cb58dfcd.js";import{h as s}from"./shared-ba5c42c7.js";import{C as e}from"./shared-5afb584d.js";import{N as i}from"./shared-f83207fb.js";import{R as a,T as n,a as r}from"./shared-11351c00.js";import{c as o}from"./shared-4e709717.js";import{p as d}from"./shared-8eeddc22.js";import"./shared-21e68b72.js";import"./shared-315d7620.js";import"./shared-f9ac8763.js";import"./shared-360d6a20.js";import"./shared-2aa23b5f.js";import"./shared-343d1fd7.js";import"./shared-53e42a77.js";import"./shared-5592ec6e.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";let c,l=t=>t;const m=e(a(n(r(i,"subscription-card"))));class p extends m{render(){var t,e,i,a,n;const r=!!(null===(t=this.data)||void 0===t?void 0:t.is_active),d=!!(null===(e=this.data)||void 0===e?void 0:e.first_failed_transaction_date);return s(c||(c=l` <div class="relative text-left"> <div class="${0}"> <div class="${0}"> <iron-icon class="m-auto" icon="${0}"> </iron-icon> </div> <div class="flex-1 min-w-0 leading-xs flex flex-col sm-flex-row sm-items-center"> <div class="order-1 sm-order-0"> <div class="text-body font-medium origin-top-left text-m"> <foxy-i18n data-testid="summary" options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> &#8203; </div> <div class="${0}"> <foxy-i18n data-testid="status" options="${0}" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> &#8203; </div> </div> <div class="flex-1 leading-xs mb-xs sm-mb-0 sm-text-right order-0 sm-order-1"> <foxy-i18n data-testid="price" options="${0}" class="text-xxs sm-text-l font-tnum tracking-wide sm-tracking-normal uppercase sm-normal-case font-medium text-secondary sm-text-body sm-block" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> <span class="text-secondary font-medium sm-font-normal sm-block text-xxs sm-text-s"> <span class="sm-hidden">(</span><span class="hidden sm-inline">*</span><foxy-i18n infer="" key="fees_hint"></foxy-i18n><span class="sm-hidden">)</span> <iron-icon id="hint" icon="icons:info-outline" class="icon-inline"></iron-icon> <vcf-tooltip for="hint" position="bottom"> <span class="text-s"><foxy-i18n infer="" key="fees_explainer"></foxy-i18n></span> </vcf-tooltip> <span> &#8203; </span></span></div> </div> </div> <div data-testid="spinner" class="${0}"> <foxy-spinner state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> ${0} `),o({"flex items-start sm-items-center space-x-m transition duration-150 ease-in-out":!0,"opacity-0":!this.in({idle:"snapshot"})}),o({"min-w-0 flex-shrink-0 rounded-full relative flex p-s":!0,"text-success bg-success-10":r&&!d,"text-body bg-contrast-5":!r&&!d,"text-error bg-error-10":d}),d?"error-outline":r?"done":"done-all",JSON.stringify(this.__getSummaryOptions()),this.lang,this.ns,o({"text-m":!0,"text-tertiary":!r&&!d,"text-success":r&&!d,"text-error":d}),JSON.stringify(this.__getStatusOptions()),this.lang,this.__getStatusKey(),this.ns,JSON.stringify(this.__getPriceOptions()),this.lang,".5m"===(null===(i=this.data)||void 0===i?void 0:i.frequency)?"twice_a_month":"recurring",this.ns,o({"pointer-events-none absolute inset-0 flex transition ease-in-out duration-150":!0,"opacity-0":this.in({idle:"snapshot"})}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(n=null===(a=customElements.get("foxy-spinner"))||void 0===a?void 0:a.defaultNS)&&void 0!==n?n:"",this.renderTemplateOrSlot())}__getSummaryOptions(){if(null===this.data)return{};const t=this.data._embedded["fx:transaction_template"]._embedded["fx:items"];return{most_expensive_item:[...t].sort(((t,s)=>t.price-s.price))[0],count_minus_one:t.length-1,count:t.length}}__getStatusOptions(){const t=this.data;return null===t?{}:t.first_failed_transaction_date?{date:t.first_failed_transaction_date}:t.end_date?{date:t.end_date}:!1===t.is_active?{}:new Date(t.start_date)>new Date?{date:t.start_date}:{date:t.next_transaction_date}}__getPriceOptions(){if(null===this.data)return{};const s=this.data._embedded["fx:transaction_template"],e=`${s.total_order} ${s.currency_code}`;return t(t({},d(this.data.frequency)),{},{amount:e})}__getStatusKey(){const t=this.data;if(null!==t){if(t.first_failed_transaction_date)return"subscription_failed";if(t.end_date){return new Date(t.end_date).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}return!1===t.is_active?"subscription_inactive":new Date(t.start_date)>new Date?"subscription_will_be_active":"subscription_active"}}}customElements.define("foxy-subscription-card",p);export{p as SubscriptionCard};
1
+ import"./shared-d807cb20.js";import"./shared-c18f681b.js";import"./shared-37348820.js";import"./shared-5212ef4f.js";import"./foxy-spinner.js";import"./shared-4d32d19e.js";import{_ as s}from"./shared-cb58dfcd.js";import{h as t}from"./shared-ba5c42c7.js";import{C as e}from"./shared-5afb584d.js";import{N as i}from"./shared-f83207fb.js";import{R as n,T as r,a}from"./shared-11351c00.js";import{c as o}from"./shared-4e709717.js";import{p as d}from"./shared-8eeddc22.js";import{g as m}from"./shared-e2675ed0.js";import"./shared-21e68b72.js";import"./shared-315d7620.js";import"./shared-f9ac8763.js";import"./shared-360d6a20.js";import"./shared-2aa23b5f.js";import"./shared-343d1fd7.js";import"./shared-53e42a77.js";import"./shared-5592ec6e.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";let l,c=s=>s;const p=e(n(r(a(i,"subscription-card"))));class f extends p{render(){var s,e,i;const n=m(this.data),r="failed"===n,a="next_payment"===n||!!(null==n?void 0:n.startsWith("will_end")),d=!a&&!r;return t(l||(l=c` <div class="relative text-left"> <div class="${0}"> <div class="${0}"> <iron-icon class="m-auto" icon="${0}"> </iron-icon> </div> <div class="flex-1 min-w-0 leading-xs flex flex-col sm-flex-row sm-items-center"> <div class="order-1 sm-order-0"> <div class="text-body font-medium origin-top-left text-m"> <foxy-i18n data-testid="summary" options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> &#8203; </div> <div class="${0}"> <foxy-i18n data-testid="status" lang="${0}" key="status_${0}" ns="${0}" .options="${0}"> </foxy-i18n> &#8203; </div> </div> <div class="flex-1 leading-xs mb-xs sm-mb-0 sm-text-right order-0 sm-order-1"> <foxy-i18n data-testid="price" options="${0}" class="text-xxs sm-text-l font-tnum tracking-wide sm-tracking-normal uppercase sm-normal-case font-medium text-secondary sm-text-body sm-block" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> <span class="text-secondary font-medium sm-font-normal sm-block text-xxs sm-text-s"> <span class="sm-hidden">(</span><span class="hidden sm-inline">*</span><foxy-i18n infer="" key="fees_hint"></foxy-i18n><span class="sm-hidden">)</span> <iron-icon id="hint" icon="icons:info-outline" class="icon-inline"></iron-icon> <vcf-tooltip for="hint" position="bottom"> <span class="text-s"><foxy-i18n infer="" key="fees_explainer"></foxy-i18n></span> </vcf-tooltip> <span> &#8203; </span></span></div> </div> </div> <div data-testid="spinner" class="${0}"> <foxy-spinner state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> ${0} `),o({"flex items-start sm-items-center space-x-m transition duration-150 ease-in-out":!0,"opacity-0":!this.in({idle:"snapshot"})}),o({"min-w-0 flex-shrink-0 rounded-full relative flex p-s":!0,"text-success bg-success-10":a,"text-body bg-contrast-5":d,"text-error bg-error-10":r}),r?"error-outline":a?"done":"done-all",JSON.stringify(this.__getSummaryOptions()),this.lang,this.ns,o({"text-m":!0,"text-tertiary":d,"text-success":a,"text-error":r}),this.lang,n,this.ns,this.data,JSON.stringify(this.__getPriceOptions()),this.lang,".5m"===(null===(s=this.data)||void 0===s?void 0:s.frequency)?"twice_a_month":"recurring",this.ns,o({"pointer-events-none absolute inset-0 flex transition ease-in-out duration-150":!0,"opacity-0":this.in({idle:"snapshot"})}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(i=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==i?i:"",this.renderTemplateOrSlot())}__getSummaryOptions(){if(null===this.data)return{};const s=this.data._embedded["fx:transaction_template"]._embedded["fx:items"];return{most_expensive_item:[...s].sort(((s,t)=>s.price-t.price))[0],count_minus_one:s.length-1,count:s.length}}__getPriceOptions(){if(null===this.data)return{};const t=this.data._embedded["fx:transaction_template"],e=`${t.total_order} ${t.currency_code}`;return s(s({},d(this.data.frequency)),{},{amount:e})}}customElements.define("foxy-subscription-card",f);export{f as SubscriptionCard};
@@ -1 +1 @@
1
- import"./shared-d807cb20.js";import"./shared-243456aa.js";import"./shared-8ef0ca65.js";import"./shared-c18f681b.js";import"./shared-37348820.js";import{I as e}from"./shared-5b4e2567.js";import"./shared-0c134ce7.js";import"./shared-c05643e6.js";import"./shared-f69aacbc.js";import"./shared-5212ef4f.js";import"./foxy-transaction-card.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-4d32d19e.js";import{_ as t,B as a}from"./shared-cb58dfcd.js";import"./shared-f9ac8763.js";import"./shared-360d6a20.js";import{h as s}from"./shared-ba5c42c7.js";import{S as i,R as r,a as n}from"./shared-11351c00.js";import{c as o}from"./shared-4e709717.js";import{S as d,C as l}from"./shared-c46affa4.js";import"./shared-048d5cae.js";import{G as c}from"./shared-4f64c35e.js";import"./shared-be442f26.js";import"./shared-c1e86ea4.js";import"./shared-7dc9c80b.js";import"./shared-f989c70e.js";import"./shared-bd5285ff.js";import"./shared-8b0f00fa.js";import{p as u}from"./shared-8eeddc22.js";import{s as m}from"./shared-79d0699c.js";import{i as h}from"./shared-53e42a77.js";import{p as f}from"./shared-99a8889a.js";import{j as _}from"./shared-673d668a.js";import"./shared-21e68b72.js";import"./shared-315d7620.js";import"./shared-3556f4b7.js";import"./shared-c25538f1.js";import"./shared-651c44fa.js";import"./shared-edeeb089.js";import"./shared-1c355fac.js";import"./shared-cf12f33b.js";import"./shared-0aedd809.js";import"./shared-7594e563.js";import"./shared-5afb584d.js";import"./shared-2aa23b5f.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-5ef40e86.js";import"./shared-e5546d55.js";import"./foxy-copy-to-clipboard.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-6957b8e6.js";import"./shared-80a1bf6f.js";import"./foxy-collection-page.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-b65d169b.js";import"./shared-43e2c3f6.js";import"./shared-3661a086.js";import"./shared-f1a70f51.js";import"./shared-cc7e1dc6.js";import"./shared-3a952968.js";import"./shared-eb963ba3.js";import"./shared-83c5e004.js";import"./shared-495860b4.js";import"./shared-6683daed.js";import"./shared-a03facdf.js";import"./shared-a587fd4b.js";function p(e){return function*(e){const t=[];for(const a of e.settings.subscriptions.allowFrequencyModification)if(_(a.jsonataQuery).evaluate(e.subscription))for(const e of a.values)!t.includes(e)&&(t.push(e),yield e)}({settings:{subscriptions:{allowFrequencyModification:e.settings.subscriptions.allow_frequency_modification.map((e=>({jsonataQuery:e.jsonata_query,values:e.values})))}},subscription:e.subscription})}class y extends Error{constructor(e){super(`Invalid frequency "${e}".`)}}function v(e){const t=864e5,a=31*t;if(".5m"===e)return a/2;const s=parseInt(e.substring(0,e.length-1));if(isNaN(s))throw new y(e);if(e.endsWith("y"))return 31536e6*s;if(e.endsWith("m"))return s*a;if(e.endsWith("w"))return 6048e5*s;if(e.endsWith("d"))return s*t;throw new y(e)}function x(e,t){if("boolean"==typeof t)return t;const a=t.filter((t=>Boolean(_(t.jsonataQuery).evaluate(e)))).reduce(((e,t)=>{var a,s,i,r,n;if(t.min){const a=e.min?v(e.min):1/0;v(t.min)<a&&(e.min=t.min)}if(t.max){const a=e.max?v(e.max):-1/0;v(t.max)>a&&(e.max=t.max)}if("day"===(null===(a=t.allowedDays)||void 0===a?void 0:a.type)){const a=[...null!==(s=e.allowedDaysOfWeek)&&void 0!==s?s:[],...t.allowedDays.days];e.allowedDaysOfWeek=Array.from(new Set(a))}if("month"===(null===(i=t.allowedDays)||void 0===i?void 0:i.type)){const a=[...null!==(r=e.allowedDaysOfMonth)&&void 0!==r?r:[],...t.allowedDays.days];e.allowedDaysOfMonth=Array.from(new Set(a))}if(t.disallowedDates){const a=[...null!==(n=e.disallowedDates)&&void 0!==n?n:[],...t.disallowedDates];e.disallowedDates=Array.from(new Set(a))}return e}),{});return 0!==Object.keys(a).length&&a}function g(e){const[t,a,s]=e.split("-").map((e=>parseInt(e)));return new Date(t,a-1,s)}function b(e){const t=e.settings.subscriptions.allow_next_date_modification;let a;return a="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),function(e){var t,a;const s=g(e.value),i=s.getTime(),r=x(e.subscription,e.settings.subscriptions.allowNextDateModification);if("boolean"==typeof r)return r;if(!1===(null===(t=r.allowedDaysOfMonth)||void 0===t?void 0:t.includes(s.getDate())))return!1;if(!1===(null===(a=r.allowedDaysOfWeek)||void 0===a?void 0:a.includes(s.getDay())))return!1;if(r.disallowedDates&&r.disallowedDates.find((e=>{const[t,a]=e.split("..").map((e=>g(e).getTime()));return i===t||void 0!==a&&i>=t&&i<=a})))return!1;if(r.min){const e=f(r.min);if(null!==e&&Date.now()+e>=i)return!1}if(r.max){const e=f(r.max);if(null!==e&&Date.now()+e<=i)return!1}return!0}({settings:{subscriptions:{allowNextDateModification:a}},subscription:e.subscription,value:e.value})}let $,j,D,w,S,T,q,E,k,H,C,L=e=>e;const A=i(r(n(e,"subscription-form")));class I extends A{constructor(){super(...arguments),this.getTransactionPageHref=(e,t)=>null==t?void 0:t._links["fx:receipt"].href,this.getCustomerPageHref=null,this.customerAddresses=null,this.itemCategories=null,this.localeCodes=null,this.settings=null,this.coupons=null,this.__transactionTemplateLoaderId="transactionTemplateLoader",this.__defaultTemplateSetLoaderId="defaultTemplateSetLoader",this.__localeCodesHelperLoaderId="localeCodesLoader",this.__templateSetLoaderId="templateSetLoader",this.__storeLoaderId="storeLoader",this.__renderItemsActions=()=>s($||($=L` <div class="flex" data-testid="items:actions"> ${0} <foxy-i18n data-testid="items:actions-label" class="flex-1 text-s font-medium text-secondary" lang="${0}" key="item_plural" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("items:actions:before"),this.lang,this.ns,this.renderTemplateOrSlot("items:actions:after")),this.__renderItems=()=>{var e;let t;try{const a=this.__transactionTemplate,s=new URL(null!==(e=null==a?void 0:a._links["fx:items"].href)&&void 0!==e?e:"");s.searchParams.set("zoom","item_options"),t=s.toString()}catch(e){t=void 0}return s(j||(j=L` <div data-testid="items" class="space-y-xs sm-col-span-2"> ${0} <foxy-internal-async-list-control first="${0}" infer="items" item="foxy-item-card" .itemProps="${0}"> </foxy-internal-async-list-control> </div> `),this.hiddenSelector.matches("items:actions",!0)?"":this.__renderItemsActions(),h(t),{"locale-codes":this.localeCodes})},this.__renderEndDate=()=>{var e;const{data:t,lang:a,ns:i}=this;return s(D||(D=L` <div data-testid="end-date"> ${0} <x-group frame> <foxy-i18n key="end_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("end-date:before"),i,a,h(null===(e=null==t?void 0:t.end_date)||void 0===e?void 0:e.substr(0,10)),h(null==t?void 0:t.end_date),a,!this.__isEndDateEditable,this.disabledSelector.matches("end-date",!0),this.__checkEndDateAvailability,(e=>{const t=e.target;this.edit({end_date:t.value})}),this.renderTemplateOrSlot("end-date:after"))},this.__checkNextTransactionDateAvailability=e=>{const{settings:t,data:a}=this;if(t&&a){return b({value:m(e),settings:t,subscription:a})}return e.getTime()>=Date.now()},this.__checkStartDateAvailability=e=>e.getTime()>=Date.now(),this.__checkEndDateAvailability=e=>{const t=new Date;return t.setDate(t.getDate()+1),t.setHours(0,0,0,0),e.getTime()>=t.getTime()},this.__renderStartDate=()=>{const{data:e,lang:t,ns:a}=this;return s(w||(w=L` <div data-testid="start-date"> ${0} <x-group frame> <foxy-i18n key="start_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("start-date:before"),a,t,h(null==e?void 0:e.start_date.substr(0,10)),h(null==e?void 0:e.start_date),t,!this.__isStartDateEditable,this.disabledSelector.matches("start-date",!0),this.__checkStartDateAvailability,(e=>{const t=e.target;this.edit({start_date:t.value})}),this.renderTemplateOrSlot("start-date:after"))},this.__renderNextTransactionDate=()=>{const{data:e,lang:t,ns:a}=this,i=!!(null==e?void 0:e.is_active);return s(S||(S=L` <div data-testid="next-transaction-date"> ${0} <x-group frame> <foxy-i18n key="next_transaction_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("next-transaction-date:before"),a,t,h(null==e?void 0:e.next_transaction_date.substr(0,10)),h(null==e?void 0:e.next_transaction_date),t,!i||this.readonlySelector.matches("next-transaction-date",!0),!e||this.disabledSelector.matches("next-transaction-date",!0),this.__checkNextTransactionDateAvailability,(e=>{const t=e.target;this.edit({next_transaction_date:t.value})}),this.renderTemplateOrSlot("next-transaction-date:after"))},this.__renderFrequencyAsDropdown=()=>{const{data:e}=this,t=!!(null==e?void 0:e.is_active),a=this.__frequencies.map((e=>({label:this.t(".5m"===e?"twice_a_month":"frequency",u(e)),value:e})));return s(T||(T=L` <vaadin-combo-box item-value-path="value" item-label-path="label" data-testid="frequency" ?disabled="${0}" ?readonly="${0}" class="w-full" label="${0}" value="${0}" .items="${0}" @change="${0}"> </vaadin-combo-box> `),!e||this.disabledSelector.matches("frequency",!0),e&&(!t||this.readonlySelector.matches("frequency",!0)),this.t("frequency_label").toString(),h(this.form.frequency),a,(e=>{this.edit({frequency:e.target.value})}))},this.__renderFrequencyAsRadioList=()=>{var e;const{data:t,lang:a,ns:i}=this;return s(q||(q=L` <x-group frame> <foxy-i18n key="frequency_label" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <x-choice default-custom-value="1d" data-testid="frequency" type="frequency" ns="${0}" ?custom="${0}" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} </x-choice> </x-group> `),i,a,i,null===this.settings,this.__frequencies,null!==(e=this.form.frequency)&&void 0!==e?e:null,!t||this.disabledSelector.matches("frequency",!0),t&&(!t.is_active||this.readonlySelector.matches("frequency",!0)),(e=>{this.edit({frequency:e.target.value})}),this.__frequencies.map((e=>s(E||(E=L` <foxy-i18n options="${0}" slot="${0}-label" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify(u(e)),e,a,".5m"===e?"twice_a_month":"frequency",i))))},this.__renderFrequency=()=>s(k||(k=L` <div class="sm-col-span-2"> ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("frequency:before"),this.settings&&this.__frequencies.length>4?this.__renderFrequencyAsDropdown():this.__renderFrequencyAsRadioList(),this.renderTemplateOrSlot("frequency:after")),this.__renderCustomer=()=>{var e,t;const a=null===(e=this.data)||void 0===e?void 0:e._links["fx:customer"].href,i=a?null===(t=this.getCustomerPageHref)||void 0===t?void 0:t.call(this,a):void 0;return s(H||(H=L` <div data-testid="customer" class="sm-col-span-2"> ${0} <foxy-i18n infer="customer" class="block text-s font-medium leading-xs mb-xs" key="label"> </foxy-i18n> <a class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" href="${0}"> <foxy-customer-card infer="customer" href="${0}"></foxy-customer-card> </a> ${0} </div> `),this.renderTemplateOrSlot("customer:before"),o({"block rounded transition-colors":!0,"ring-1 ring-contrast-10":!i,"cursor-pointer bg-contrast-5 hover-bg-contrast-10":!!i,"focus-outline-none focus-ring-2 focus-ring-primary-50":!!i}),h(i),h(a),this.renderTemplateOrSlot("customer:after"))}}static get scopedElements(){return{"foxy-internal-timestamps-control":customElements.get("foxy-internal-timestamps-control"),"foxy-internal-async-list-control":customElements.get("foxy-internal-async-list-control"),"foxy-internal-number-control":customElements.get("foxy-internal-number-control"),"foxy-internal-submit-control":customElements.get("foxy-internal-submit-control"),"foxy-internal-delete-control":customElements.get("foxy-internal-delete-control"),"foxy-internal-undo-control":customElements.get("foxy-internal-undo-control"),"foxy-copy-to-clipboard":customElements.get("foxy-copy-to-clipboard"),"foxy-internal-calendar":customElements.get("foxy-internal-calendar"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-customer-card":customElements.get("foxy-customer-card"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-nucleon":customElements.get("foxy-nucleon"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-i18n":customElements.get("foxy-i18n"),"iron-icon":customElements.get("iron-icon"),"x-skeleton":d,"x-choice":l,"x-group":c}}static get properties(){return t(t({},super.properties),{},{getTransactionPageHref:{attribute:!1},getCustomerPageHref:{attribute:!1},customerAddresses:{attribute:"customer-addresses"},itemCategories:{attribute:"item-categories"},localeCodes:{attribute:"locale-codes"},settings:{type:Object},coupons:{}})}get hiddenSelector(){return new a(`items:pagination:card:autorenew-icon ${super.hiddenSelector}`)}get headerTitleOptions(){if(this.data&&this.__currencyCode){const e=u(this.data.frequency),a=this.__transactionTemplate,s=`${null==a?void 0:a.total_order} ${this.__currencyCode}`,i=this.__currencyDisplay,r=this.__currencyCode?".5m"===this.data.frequency?"twice_a_month":"recurring":"existing";return t(t({},e),{},{amount:s,currencyDisplay:i,context:r})}return{}}get headerSubtitleOptions(){var e,t,a;let s,i=null;if(null===(e=this.data)||void 0===e?void 0:e.first_failed_transaction_date)s="failed",i=this.data.first_failed_transaction_date;else if(null===(t=this.data)||void 0===t?void 0:t.end_date){s=new Date(this.data.end_date).getTime()>Date.now()?"will_be_cancelled":"cancelled",i=this.data.end_date}else(null===(a=this.data)||void 0===a?void 0:a.is_active)?new Date(this.data.start_date)>new Date?(s="will_be_active",i=this.data.start_date):(s="active",i=this.data.next_transaction_date):s="inactive";return{date:i,context:s}}renderBody(){var e,t,a,i,r;let n;try{const a=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:transactions"].href)&&void 0!==t?t:"");a.searchParams.set("order","transaction_date desc"),a.searchParams.set("zoom","items"),n=a.toString()}catch(e){n=void 0}return s(C||(C=L` ${0} <div class="relative grid grid-cols-1 sm-grid-cols-2 gap-l"> <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> ${0} ${0} ${0} ${0} ${0} ${0} <foxy-internal-number-control suffix="${0}" infer="past-due-amount" class="sm-col-span-2" min="0"> </foxy-internal-number-control> <foxy-internal-async-list-control first="${0}" class="sm-col-span-2" infer="attributes" limit="5" form="foxy-attribute-form" item="foxy-attribute-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control first="${0}" class="sm-col-span-2" infer="transactions" limit="5" item="foxy-transaction-card" hide-delete-button .getPageHref="${0}"> </foxy-internal-async-list-control> <foxy-internal-timestamps-control infer="timestamps" class="sm-col-span-2"> </foxy-internal-timestamps-control> </div> `),this.renderHeader(),h(this.__transactionTemplateHref),this.__transactionTemplateLoaderId,(()=>this.requestUpdate()),h(this.__defaultTemplateSetHref),this.__defaultTemplateSetLoaderId,(()=>this.requestUpdate()),h(this.__localeCodesHelperHref),this.__localeCodesHelperLoaderId,(()=>this.requestUpdate()),h(this.__templateSetHref),this.__templateSetLoaderId,(()=>this.requestUpdate()),h(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.hiddenSelector.matches("customer",!0)?"":this.__renderCustomer(),this.hiddenSelector.matches("items",!0)?"":this.__renderItems(),this.__isFrequencyVisible?this.__renderFrequency():"",this.__isStartDateVisible?this.__renderStartDate():"",this.__isNextTransactionDateVisible?this.__renderNextTransactionDate():"",this.__isEndDateVisible?this.__renderEndDate():"",h(null!==(a=this.__currencyCode)&&void 0!==a?a:void 0),h(null===(r=null===(i=this.data)||void 0===i?void 0:i._links["fx:attributes"])||void 0===r?void 0:r.href),h(n),this.getTransactionPageHref)}get __transactionTemplateHref(){var e;const t=this.data;return(null===(e=null==t?void 0:t._embedded)||void 0===e?void 0:e["fx:transaction_template"])||null==t?void 0:t._links["fx:transaction_template"].href}get __defaultTemplateSetHref(){var e,t,a;if(""===(null===(e=this.__transactionTemplate)||void 0===e?void 0:e.template_set_uri))try{const e=new URL(null!==(a=null===(t=this.__store)||void 0===t?void 0:t._links["fx:template_sets"].href)&&void 0!==a?a:"");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 __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,a;const s=this.data,i=null===(e=null==s?void 0:s._embedded)||void 0===e?void 0:e["fx:transaction_template"],r=`#${this.__transactionTemplateLoaderId}`;return null!==(a=null!=i?i:null===(t=this.renderRoot.querySelector(r))||void 0===t?void 0:t.data)&&void 0!==a?a:null}get __defaultTemplateSet(){var e,t;const a=`#${this.__defaultTemplateSetLoaderId}`,s=this.renderRoot.querySelector(a);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 a=`#${this.__localeCodesHelperLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(a))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __templateSet(){var e,t;const a=`#${this.__templateSetLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(a))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __store(){var e,t;const a=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(a))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __isNextTransactionDateVisible(){if(this.hiddenSelector.matches("next-transaction-date",!0))return!1;if(null===this.data)return!1;if(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())return!1;if(!1===this.data.is_active)return!1;if(null===this.settings)return!0;const e=this.settings.subscriptions.allow_next_date_modification;return!!function(e,t){let a;return a="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),x(e,a)}(this.data,e)}get __isStartDateVisible(){return!this.hiddenSelector.matches("start-date",!0)&&this.__isNextTransactionDateVisible}get __isEndDateVisible(){return!this.hiddenSelector.matches("end-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())&&(!1!==this.data.is_active&&!this.settings)))}get __isStartDateEditable(){return!this.readonlySelector.matches("start-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date)<=new Date)&&(!1!==this.data.is_active&&(!(this.data.start_date&&new Date(this.data.start_date)<=new Date)&&null===this.settings))))}get __isEndDateEditable(){return!this.readonlySelector.matches("end-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date)<=new Date)&&(!1!==this.data.is_active&&null===this.settings)))}get __isFrequencyVisible(){if(this.hiddenSelector.matches("frequency",!0))return!1;if(null===this.data)return!1;if(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())return!1;if(!1===this.data.is_active)return!1;if(null===this.settings)return!0;return!p({subscription:this.data,settings:this.settings}).next().done}get __frequencies(){if(!this.settings||!this.data)return[".5m","1m","1y"];const e=p({subscription:this.data,settings:this.settings});return Array.from(e)}get __currencyCode(){var e,t,a,s;const i=this.__transactionTemplate;if(null==i?void 0:i.currency_code)return i.currency_code;const r=this.__localeCodesHelper,n=null===(t=null!==(e=this.__templateSet)&&void 0!==e?e:this.__defaultTemplateSet)||void 0===t?void 0:t.locale_code,o=n?null==r?void 0:r.values[n]:void 0;return o&&null!==(s=null===(a=/Currency: ([A-Z]{3})/g.exec(o))||void 0===a?void 0:a[1])&&void 0!==s?s:null}get __currencyDisplay(){var e;return(null===(e=this.__store)||void 0===e?void 0:e.use_international_currency_symbol)?"code":"symbol"}}customElements.define("foxy-subscription-form",I);export{I as SubscriptionForm};
1
+ import"./shared-d807cb20.js";import"./shared-243456aa.js";import"./shared-8ef0ca65.js";import"./shared-c18f681b.js";import"./shared-37348820.js";import{I as e}from"./shared-5b4e2567.js";import"./shared-0c134ce7.js";import"./shared-c05643e6.js";import"./shared-f69aacbc.js";import"./shared-5212ef4f.js";import"./foxy-transaction-card.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-customer-card.js";import"./foxy-item-card.js";import"./shared-4d32d19e.js";import{_ as t,B as s}from"./shared-cb58dfcd.js";import"./shared-f9ac8763.js";import"./shared-360d6a20.js";import{h as a}from"./shared-ba5c42c7.js";import{S as r,R as i,a as n}from"./shared-11351c00.js";import{c as o}from"./shared-4e709717.js";import{S as d,C as l}from"./shared-c46affa4.js";import"./shared-048d5cae.js";import{G as c}from"./shared-4f64c35e.js";import"./shared-be442f26.js";import"./shared-c1e86ea4.js";import"./shared-7dc9c80b.js";import"./shared-f989c70e.js";import"./shared-bd5285ff.js";import"./shared-8b0f00fa.js";import{g as u}from"./shared-e2675ed0.js";import{p as m}from"./shared-8eeddc22.js";import{s as h}from"./shared-79d0699c.js";import{i as f}from"./shared-53e42a77.js";import{p as _}from"./shared-99a8889a.js";import{j as p}from"./shared-673d668a.js";import"./shared-21e68b72.js";import"./shared-315d7620.js";import"./shared-3556f4b7.js";import"./shared-c25538f1.js";import"./shared-651c44fa.js";import"./shared-edeeb089.js";import"./shared-1c355fac.js";import"./shared-cf12f33b.js";import"./shared-0aedd809.js";import"./shared-7594e563.js";import"./shared-5afb584d.js";import"./shared-2aa23b5f.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-343d1fd7.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-5ef40e86.js";import"./shared-e5546d55.js";import"./foxy-copy-to-clipboard.js";import"./foxy-spinner.js";import"./shared-bab2ea2c.js";import"./shared-6957b8e6.js";import"./shared-80a1bf6f.js";import"./foxy-collection-page.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";import"./shared-b65d169b.js";import"./shared-43e2c3f6.js";import"./shared-3661a086.js";import"./shared-f1a70f51.js";import"./shared-cc7e1dc6.js";import"./shared-3a952968.js";import"./shared-eb963ba3.js";import"./shared-83c5e004.js";import"./shared-495860b4.js";import"./shared-6683daed.js";import"./shared-a03facdf.js";import"./shared-a587fd4b.js";function y(e){return function*(e){const t=[];for(const s of e.settings.subscriptions.allowFrequencyModification)if(p(s.jsonataQuery).evaluate(e.subscription))for(const e of s.values)!t.includes(e)&&(t.push(e),yield e)}({settings:{subscriptions:{allowFrequencyModification:e.settings.subscriptions.allow_frequency_modification.map((e=>({jsonataQuery:e.jsonata_query,values:e.values})))}},subscription:e.subscription})}class v extends Error{constructor(e){super(`Invalid frequency "${e}".`)}}function x(e){const t=864e5,s=31*t;if(".5m"===e)return s/2;const a=parseInt(e.substring(0,e.length-1));if(isNaN(a))throw new v(e);if(e.endsWith("y"))return 31536e6*a;if(e.endsWith("m"))return a*s;if(e.endsWith("w"))return 6048e5*a;if(e.endsWith("d"))return a*t;throw new v(e)}function g(e,t){if("boolean"==typeof t)return t;const s=t.filter((t=>Boolean(p(t.jsonataQuery).evaluate(e)))).reduce(((e,t)=>{var s,a,r,i,n;if(t.min){const s=e.min?x(e.min):1/0;x(t.min)<s&&(e.min=t.min)}if(t.max){const s=e.max?x(e.max):-1/0;x(t.max)>s&&(e.max=t.max)}if("day"===(null===(s=t.allowedDays)||void 0===s?void 0:s.type)){const s=[...null!==(a=e.allowedDaysOfWeek)&&void 0!==a?a:[],...t.allowedDays.days];e.allowedDaysOfWeek=Array.from(new Set(s))}if("month"===(null===(r=t.allowedDays)||void 0===r?void 0:r.type)){const s=[...null!==(i=e.allowedDaysOfMonth)&&void 0!==i?i:[],...t.allowedDays.days];e.allowedDaysOfMonth=Array.from(new Set(s))}if(t.disallowedDates){const s=[...null!==(n=e.disallowedDates)&&void 0!==n?n:[],...t.disallowedDates];e.disallowedDates=Array.from(new Set(s))}return e}),{});return 0!==Object.keys(s).length&&s}function b(e){const[t,s,a]=e.split("-").map((e=>parseInt(e)));return new Date(t,s-1,a)}function $(e){const t=e.settings.subscriptions.allow_next_date_modification;let s;return s="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),function(e){var t,s;const a=b(e.value),r=a.getTime(),i=g(e.subscription,e.settings.subscriptions.allowNextDateModification);if("boolean"==typeof i)return i;if(!1===(null===(t=i.allowedDaysOfMonth)||void 0===t?void 0:t.includes(a.getDate())))return!1;if(!1===(null===(s=i.allowedDaysOfWeek)||void 0===s?void 0:s.includes(a.getDay())))return!1;if(i.disallowedDates&&i.disallowedDates.find((e=>{const[t,s]=e.split("..").map((e=>b(e).getTime()));return r===t||void 0!==s&&r>=t&&r<=s})))return!1;if(i.min){const e=_(i.min);if(null!==e&&Date.now()+e>=r)return!1}if(i.max){const e=_(i.max);if(null!==e&&Date.now()+e<=r)return!1}return!0}({settings:{subscriptions:{allowNextDateModification:s}},subscription:e.subscription,value:e.value})}let j,S,D,w,T,q,E,k,H,C,L,A=e=>e;const I=r(i(n(e,"subscription-form")));class O extends I{constructor(){super(...arguments),this.getTransactionPageHref=(e,t)=>null==t?void 0:t._links["fx:receipt"].href,this.getCustomerPageHref=null,this.customerAddresses=null,this.itemCategories=null,this.localeCodes=null,this.settings=null,this.coupons=null,this.__transactionTemplateLoaderId="transactionTemplateLoader",this.__defaultTemplateSetLoaderId="defaultTemplateSetLoader",this.__localeCodesHelperLoaderId="localeCodesLoader",this.__templateSetLoaderId="templateSetLoader",this.__storeLoaderId="storeLoader",this.__renderItemsActions=()=>a(j||(j=A` <div class="flex" data-testid="items:actions"> ${0} <foxy-i18n data-testid="items:actions-label" class="flex-1 text-s font-medium text-secondary" lang="${0}" key="item_plural" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("items:actions:before"),this.lang,this.ns,this.renderTemplateOrSlot("items:actions:after")),this.__renderItems=()=>{var e;let t;try{const s=this.__transactionTemplate,a=new URL(null!==(e=null==s?void 0:s._links["fx:items"].href)&&void 0!==e?e:"");a.searchParams.set("zoom","item_options"),t=a.toString()}catch(e){t=void 0}return a(S||(S=A` <div data-testid="items" class="space-y-xs sm-col-span-2"> ${0} <foxy-internal-async-list-control first="${0}" infer="items" item="foxy-item-card" .itemProps="${0}"> </foxy-internal-async-list-control> </div> `),this.hiddenSelector.matches("items:actions",!0)?"":this.__renderItemsActions(),f(t),{"locale-codes":this.localeCodes})},this.__renderEndDate=()=>{var e;const{data:t,lang:s,ns:r}=this;return a(D||(D=A` <div data-testid="end-date"> ${0} <x-group frame> <foxy-i18n key="end_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("end-date:before"),r,s,f(null===(e=null==t?void 0:t.end_date)||void 0===e?void 0:e.substr(0,10)),f(null==t?void 0:t.end_date),s,!this.__isEndDateEditable,this.disabledSelector.matches("end-date",!0),this.__checkEndDateAvailability,(e=>{const t=e.target;this.edit({end_date:t.value})}),this.renderTemplateOrSlot("end-date:after"))},this.__checkNextTransactionDateAvailability=e=>{const{settings:t,data:s}=this;if(t&&s){return $({value:h(e),settings:t,subscription:s})}return e.getTime()>=Date.now()},this.__checkStartDateAvailability=e=>e.getTime()>=Date.now(),this.__checkEndDateAvailability=e=>{const t=new Date;return t.setDate(t.getDate()+1),t.setHours(0,0,0,0),e.getTime()>=t.getTime()},this.__renderStartDate=()=>{const{data:e,lang:t,ns:s}=this;return a(w||(w=A` <div data-testid="start-date"> ${0} <x-group frame> <foxy-i18n key="start_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("start-date:before"),s,t,f(null==e?void 0:e.start_date.substr(0,10)),f(null==e?void 0:e.start_date),t,!this.__isStartDateEditable,this.disabledSelector.matches("start-date",!0),this.__checkStartDateAvailability,(e=>{const t=e.target;this.edit({start_date:t.value})}),this.renderTemplateOrSlot("start-date:after"))},this.__renderNextTransactionDate=()=>{const{data:e,lang:t,ns:s}=this,r=!!(null==e?void 0:e.is_active);return a(T||(T=A` <div data-testid="next-transaction-date"> ${0} <x-group frame> <foxy-i18n key="next_transaction_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("next-transaction-date:before"),s,t,f(null==e?void 0:e.next_transaction_date.substr(0,10)),f(null==e?void 0:e.next_transaction_date),t,!r||this.readonlySelector.matches("next-transaction-date",!0),!e||this.disabledSelector.matches("next-transaction-date",!0),this.__checkNextTransactionDateAvailability,(e=>{const t=e.target;this.edit({next_transaction_date:t.value})}),this.renderTemplateOrSlot("next-transaction-date:after"))},this.__renderFrequencyAsDropdown=()=>{const{data:e}=this,t=!!(null==e?void 0:e.is_active),s=this.__frequencies.map((e=>({label:this.t(".5m"===e?"twice_a_month":"frequency",m(e)),value:e})));return a(q||(q=A` <vaadin-combo-box item-value-path="value" item-label-path="label" data-testid="frequency" ?disabled="${0}" ?readonly="${0}" class="w-full" label="${0}" value="${0}" .items="${0}" @change="${0}"> </vaadin-combo-box> `),!e||this.disabledSelector.matches("frequency",!0),e&&(!t||this.readonlySelector.matches("frequency",!0)),this.t("frequency_label").toString(),f(this.form.frequency),s,(e=>{this.edit({frequency:e.target.value})}))},this.__renderFrequencyAsRadioList=()=>{var e;const{data:t,lang:s,ns:r}=this;return a(E||(E=A` <x-group frame> <foxy-i18n key="frequency_label" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <x-choice default-custom-value="1d" data-testid="frequency" type="frequency" ns="${0}" ?custom="${0}" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} </x-choice> </x-group> `),r,s,r,null===this.settings,this.__frequencies,null!==(e=this.form.frequency)&&void 0!==e?e:null,!t||this.disabledSelector.matches("frequency",!0),t&&(!t.is_active||this.readonlySelector.matches("frequency",!0)),(e=>{this.edit({frequency:e.target.value})}),this.__frequencies.map((e=>a(k||(k=A` <foxy-i18n options="${0}" slot="${0}-label" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify(m(e)),e,s,".5m"===e?"twice_a_month":"frequency",r))))},this.__renderFrequency=()=>a(H||(H=A` <div class="sm-col-span-2"> ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("frequency:before"),this.settings&&this.__frequencies.length>4?this.__renderFrequencyAsDropdown():this.__renderFrequencyAsRadioList(),this.renderTemplateOrSlot("frequency:after")),this.__renderCustomer=()=>{var e,t;const s=null===(e=this.data)||void 0===e?void 0:e._links["fx:customer"].href,r=s?null===(t=this.getCustomerPageHref)||void 0===t?void 0:t.call(this,s):void 0;return a(C||(C=A` <div data-testid="customer" class="sm-col-span-2"> ${0} <foxy-i18n infer="customer" class="block text-s font-medium leading-xs mb-xs" key="label"> </foxy-i18n> <a class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" href="${0}"> <foxy-customer-card infer="customer" href="${0}"></foxy-customer-card> </a> ${0} </div> `),this.renderTemplateOrSlot("customer:before"),o({"block rounded transition-colors":!0,"ring-1 ring-contrast-10":!r,"cursor-pointer bg-contrast-5 hover-bg-contrast-10":!!r,"focus-outline-none focus-ring-2 focus-ring-primary-50":!!r}),f(r),f(s),this.renderTemplateOrSlot("customer:after"))}}static get scopedElements(){return{"foxy-internal-timestamps-control":customElements.get("foxy-internal-timestamps-control"),"foxy-internal-async-list-control":customElements.get("foxy-internal-async-list-control"),"foxy-internal-number-control":customElements.get("foxy-internal-number-control"),"foxy-internal-submit-control":customElements.get("foxy-internal-submit-control"),"foxy-internal-delete-control":customElements.get("foxy-internal-delete-control"),"foxy-internal-undo-control":customElements.get("foxy-internal-undo-control"),"foxy-copy-to-clipboard":customElements.get("foxy-copy-to-clipboard"),"foxy-internal-calendar":customElements.get("foxy-internal-calendar"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-customer-card":customElements.get("foxy-customer-card"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-nucleon":customElements.get("foxy-nucleon"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-i18n":customElements.get("foxy-i18n"),"iron-icon":customElements.get("iron-icon"),"x-skeleton":d,"x-choice":l,"x-group":c}}static get properties(){return t(t({},super.properties),{},{getTransactionPageHref:{attribute:!1},getCustomerPageHref:{attribute:!1},customerAddresses:{attribute:"customer-addresses"},itemCategories:{attribute:"item-categories"},localeCodes:{attribute:"locale-codes"},settings:{type:Object},coupons:{}})}get hiddenSelector(){return new s(`items:pagination:card:autorenew-icon ${super.hiddenSelector}`)}get headerTitleOptions(){if(this.data&&this.__currencyCode){const e=m(this.data.frequency),s=this.__transactionTemplate,a=`${null==s?void 0:s.total_order} ${this.__currencyCode}`,r=this.__currencyDisplay,i=this.__currencyCode?".5m"===this.data.frequency?"twice_a_month":"recurring":"existing";return t(t({},e),{},{amount:a,currencyDisplay:r,context:i})}return{}}get headerSubtitleKey(){const e=u(this.data);return e?`subtitle_${e}`:super.headerSubtitleKey}renderBody(){var e,t,s,r,i;let n;try{const s=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:transactions"].href)&&void 0!==t?t:"");s.searchParams.set("order","transaction_date desc"),s.searchParams.set("zoom","items"),n=s.toString()}catch(e){n=void 0}return a(L||(L=A` ${0} <div class="relative grid grid-cols-1 sm-grid-cols-2 gap-l"> <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> ${0} ${0} ${0} ${0} ${0} ${0} <foxy-internal-number-control suffix="${0}" infer="past-due-amount" class="sm-col-span-2" min="0"> </foxy-internal-number-control> <foxy-internal-async-list-control first="${0}" class="sm-col-span-2" infer="attributes" limit="5" form="foxy-attribute-form" item="foxy-attribute-card"> </foxy-internal-async-list-control> <foxy-internal-async-list-control first="${0}" class="sm-col-span-2" infer="transactions" limit="5" item="foxy-transaction-card" hide-delete-button .getPageHref="${0}"> </foxy-internal-async-list-control> <foxy-internal-timestamps-control infer="timestamps" class="sm-col-span-2"> </foxy-internal-timestamps-control> </div> `),this.renderHeader(),f(this.__transactionTemplateHref),this.__transactionTemplateLoaderId,(()=>this.requestUpdate()),f(this.__defaultTemplateSetHref),this.__defaultTemplateSetLoaderId,(()=>this.requestUpdate()),f(this.__localeCodesHelperHref),this.__localeCodesHelperLoaderId,(()=>this.requestUpdate()),f(this.__templateSetHref),this.__templateSetLoaderId,(()=>this.requestUpdate()),f(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.hiddenSelector.matches("customer",!0)?"":this.__renderCustomer(),this.hiddenSelector.matches("items",!0)?"":this.__renderItems(),this.__isFrequencyVisible?this.__renderFrequency():"",this.__isStartDateVisible?this.__renderStartDate():"",this.__isNextTransactionDateVisible?this.__renderNextTransactionDate():"",this.__isEndDateVisible?this.__renderEndDate():"",f(null!==(s=this.__currencyCode)&&void 0!==s?s:void 0),f(null===(i=null===(r=this.data)||void 0===r?void 0:r._links["fx:attributes"])||void 0===i?void 0:i.href),f(n),this.getTransactionPageHref)}get __transactionTemplateHref(){var e;const t=this.data;return(null===(e=null==t?void 0:t._embedded)||void 0===e?void 0:e["fx:transaction_template"])||null==t?void 0:t._links["fx:transaction_template"].href}get __defaultTemplateSetHref(){var e,t,s;if(""===(null===(e=this.__transactionTemplate)||void 0===e?void 0:e.template_set_uri))try{const e=new URL(null!==(s=null===(t=this.__store)||void 0===t?void 0:t._links["fx:template_sets"].href)&&void 0!==s?s:"");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 __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,s;const a=this.data,r=null===(e=null==a?void 0:a._embedded)||void 0===e?void 0:e["fx:transaction_template"],i=`#${this.__transactionTemplateLoaderId}`;return null!==(s=null!=r?r:null===(t=this.renderRoot.querySelector(i))||void 0===t?void 0:t.data)&&void 0!==s?s:null}get __defaultTemplateSet(){var e,t;const s=`#${this.__defaultTemplateSetLoaderId}`,a=this.renderRoot.querySelector(s);return null!==(t=null===(e=null==a?void 0:a.data)||void 0===e?void 0:e._embedded["fx:template_sets"][0])&&void 0!==t?t:null}get __localeCodesHelper(){var e,t;const s=`#${this.__localeCodesHelperLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(s))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __templateSet(){var e,t;const s=`#${this.__templateSetLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(s))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __store(){var e,t;const s=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(s))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __isNextTransactionDateVisible(){if(this.hiddenSelector.matches("next-transaction-date",!0))return!1;if(null===this.data)return!1;if(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())return!1;if(!1===this.data.is_active)return!1;if(null===this.settings)return!0;const e=this.settings.subscriptions.allow_next_date_modification;return!!function(e,t){let s;return s="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),g(e,s)}(this.data,e)}get __isStartDateVisible(){return!this.hiddenSelector.matches("start-date",!0)&&this.__isNextTransactionDateVisible}get __isEndDateVisible(){return!this.hiddenSelector.matches("end-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())&&(!1!==this.data.is_active&&!this.settings)))}get __isStartDateEditable(){return!this.readonlySelector.matches("start-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date)<=new Date)&&(!1!==this.data.is_active&&(!(this.data.start_date&&new Date(this.data.start_date)<=new Date)&&null===this.settings))))}get __isEndDateEditable(){return!this.readonlySelector.matches("end-date",!0)&&(null!==this.data&&(!(this.data.end_date&&new Date(this.data.end_date)<=new Date)&&(!1!==this.data.is_active&&null===this.settings)))}get __isFrequencyVisible(){if(this.hiddenSelector.matches("frequency",!0))return!1;if(null===this.data)return!1;if(this.data.end_date&&new Date(this.data.end_date).getTime()<=Date.now())return!1;if(!1===this.data.is_active)return!1;if(null===this.settings)return!0;return!y({subscription:this.data,settings:this.settings}).next().done}get __frequencies(){if(!this.settings||!this.data)return[".5m","1m","1y"];const e=y({subscription:this.data,settings:this.settings});return Array.from(e)}get __currencyCode(){var e,t,s,a;const r=this.__transactionTemplate;if(null==r?void 0:r.currency_code)return r.currency_code;const i=this.__localeCodesHelper,n=null===(t=null!==(e=this.__templateSet)&&void 0!==e?e:this.__defaultTemplateSet)||void 0===t?void 0:t.locale_code,o=n?null==i?void 0:i.values[n]:void 0;return o&&null!==(a=null===(s=/Currency: ([A-Z]{3})/g.exec(o))||void 0===s?void 0:s[1])&&void 0!==a?a:null}get __currencyDisplay(){var e;return(null===(e=this.__store)||void 0===e?void 0:e.use_international_currency_symbol)?"code":"symbol"}}customElements.define("foxy-subscription-form",O);export{O as SubscriptionForm};
@@ -1 +1 @@
1
- import"./foxy-spinner.js";import"./shared-4d32d19e.js";import{S as s}from"./shared-0ed075f9.js";export{S as SubscriptionsTable}from"./shared-0ed075f9.js";import"./shared-37348820.js";import"./shared-21e68b72.js";import"./shared-11351c00.js";import"./shared-cb58dfcd.js";import"./shared-ba5c42c7.js";import"./shared-c18f681b.js";import"./shared-2aa23b5f.js";import"./shared-343d1fd7.js";import"./shared-e3421ca1.js";import"./shared-5afb584d.js";import"./shared-53e42a77.js";import"./foxy-nucleon-element.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";import"./shared-4e709717.js";import"./shared-8eeddc22.js";customElements.define("foxy-subscriptions-table",s);
1
+ import"./foxy-spinner.js";import"./shared-4d32d19e.js";import{S as s}from"./shared-56d70cc2.js";export{S as SubscriptionsTable}from"./shared-56d70cc2.js";import"./shared-37348820.js";import"./shared-21e68b72.js";import"./shared-11351c00.js";import"./shared-cb58dfcd.js";import"./shared-ba5c42c7.js";import"./shared-c18f681b.js";import"./shared-2aa23b5f.js";import"./shared-343d1fd7.js";import"./shared-e3421ca1.js";import"./shared-5afb584d.js";import"./shared-53e42a77.js";import"./foxy-nucleon-element.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";import"./shared-4e709717.js";import"./shared-8eeddc22.js";import"./shared-e2675ed0.js";customElements.define("foxy-subscriptions-table",s);
@@ -1 +1 @@
1
- import"./shared-3661a086.js";import"./foxy-nucleon-element.js";import"./shared-4d32d19e.js";import{_ as e}from"./shared-cb58dfcd.js";import{a as s}from"./shared-11351c00.js";import{g as t}from"./shared-bab2ea2c.js";import{I as r}from"./shared-f1a70f51.js";import{i as a}from"./shared-53e42a77.js";import{c as o}from"./shared-4e709717.js";import{h as d}from"./shared-ba5c42c7.js";import"./foxy-spinner.js";import"./shared-37348820.js";import"./shared-21e68b72.js";import"./shared-c18f681b.js";import"./shared-2aa23b5f.js";import"./shared-343d1fd7.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";let i,n,l=e=>e;class u extends(s(r,"webhook-card")){constructor(){super(...arguments),this.resourceUri=null}static get properties(){return e(e({},super.properties),{},{resourceUri:{attribute:"resource-uri"}})}renderBody(){var e,s,r,u,c,h,p,m,f;let j;try{const a=t(null!==(e=this.resourceUri)&&void 0!==e?e:""),o=new URL(null!==(r=null===(s=this.data)||void 0===s?void 0:s._links["fx:statuses"].href)&&void 0!==r?r:"");null!==a&&(o.searchParams.set("resource_id",String(a)),o.searchParams.set("order","date_created desc"),o.searchParams.set("limit","1"),j=o.toString())}catch(e){}const v=this.__statusesLoader,x=null===(u=null==v?void 0:v.data)||void 0===u?void 0:u._embedded["fx:webhook_statuses"][0];return d(i||(i=l` <div class="grid grid-cols-1 leading-s -my-xs"> <p class="flex items-center gap-s justify-between"> <span class="text-m truncate text-body font-medium"> ${0}&ZeroWidthSpace; </span> <foxy-i18n class="${0}" infer="" key="status_${0}"> </foxy-i18n> </p> <p class="text-s truncate text-secondary">${0}&ZeroWidthSpace;</p> ${0} </div> <foxy-nucleon class="hidden" infer="" href="${0}" id="statusesLoader" @update="${0}"> </foxy-nucleon> `),null===(c=this.data)||void 0===c?void 0:c.name,o({"text-tertiary":!x||"pending"===x.status,"text-success":"successful"===(null==x?void 0:x.status),"text-error":"failed"===(null==x?void 0:x.status),hidden:!(null==v?void 0:v.data),"text-s":!0}),null!==(h=null==x?void 0:x.status)&&void 0!==h?h:"none",null===(p=this.data)||void 0===p?void 0:p.url,null===this.resourceUri?d(n||(n=l` <p class="text-s truncate text-tertiary"> ${0} &bull; ${0}&ZeroWidthSpace; </p> `),null===(m=this.data)||void 0===m?void 0:m.format,null===(f=this.data)||void 0===f?void 0:f.event_resource):"",a(j),(()=>this.requestUpdate()))}get __statusesLoader(){return this.renderRoot.querySelector("#statusesLoader")}}customElements.define("foxy-webhook-card",u);export{u as WebhookCard};
1
+ import"./shared-3661a086.js";import"./foxy-nucleon-element.js";import"./shared-4d32d19e.js";import{_ as e}from"./shared-cb58dfcd.js";import{a as s}from"./shared-11351c00.js";import{g as t}from"./shared-bab2ea2c.js";import{I as r}from"./shared-f1a70f51.js";import{i as a}from"./shared-53e42a77.js";import{c as o}from"./shared-4e709717.js";import{h as i}from"./shared-ba5c42c7.js";import"./foxy-spinner.js";import"./shared-37348820.js";import"./shared-21e68b72.js";import"./shared-c18f681b.js";import"./shared-2aa23b5f.js";import"./shared-343d1fd7.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";let d,n,l=e=>e;class c extends(s(r,"webhook-card")){constructor(){super(...arguments),this.resourceUri=null}static get properties(){return e(e({},super.properties),{},{resourceUri:{attribute:"resource-uri"}})}get isBodyReady(){var e;return!!(null===(e=this.__statusesLoader)||void 0===e?void 0:e.data)&&super.isBodyReady}renderBody(){var e,s,r,c,u,h,p,m,f,v,j;const x=t(null!==(e=this.resourceUri)&&void 0!==e?e:"");let y=null===(s=this.data)||void 0===s?void 0:s._links["fx:statuses"].href;if(null!==x)try{const e=new URL(null!=y?y:"");e.searchParams.set("resource_id",String(x)),e.searchParams.set("order","date_created desc"),e.searchParams.set("limit","1"),y=e.toString()}catch(e){}const b=null===(r=this.data)||void 0===r?void 0:r.is_active,_=null===(u=null===(c=this.__statusesLoader)||void 0===c?void 0:c.data)||void 0===u?void 0:u._embedded["fx:webhook_statuses"],g=b?_?null!==(p=null===(h=null==_?void 0:_[0])||void 0===h?void 0:h.status)&&void 0!==p?p:"none":"loading":"inactive",$="failed"===g,L="successful"===g;return i(d||(d=l` <div class="grid grid-cols-1 leading-s -my-xs"> <p class="flex items-center gap-s justify-between"> <span class="text-m truncate text-body font-medium"> ${0}&ZeroWidthSpace; </span> <foxy-i18n class="${0}" infer="" key="status_${0}"> </foxy-i18n> </p> <p class="text-s truncate text-secondary">${0}&ZeroWidthSpace;</p> ${0} </div> <foxy-nucleon class="hidden" infer="" href="${0}" id="statusesLoader" @update="${0}"> </foxy-nucleon> `),null===(m=this.data)||void 0===m?void 0:m.name,o({"text-tertiary":!L&&!$,"text-success":L,"text-error":$,"text-s":!0}),g,null===(f=this.data)||void 0===f?void 0:f.url,null===this.resourceUri?i(n||(n=l` <p class="text-s truncate text-tertiary"> ${0} &bull; ${0}&ZeroWidthSpace; </p> `),null===(v=this.data)||void 0===v?void 0:v.format,null===(j=this.data)||void 0===j?void 0:j.event_resource):"",a(y),(()=>this.requestUpdate()))}get __statusesLoader(){return this.renderRoot.querySelector("#statusesLoader")}}customElements.define("foxy-webhook-card",c);export{c as WebhookCard};
@@ -1 +1 @@
1
- import"./shared-0c134ce7.js";import"./shared-4a4f6eb9.js";import"./shared-80a1bf6f.js";import"./shared-eea8debb.js";import"./shared-afe24913.js";import{I as e}from"./shared-5b4e2567.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import{_ as r,B as t}from"./shared-cb58dfcd.js";import{g as o}from"./shared-bab2ea2c.js";import{a as s}from"./shared-11351c00.js";import{i as a}from"./shared-53e42a77.js";import{h as i}from"./shared-ba5c42c7.js";import"./shared-f9ac8763.js";import"./shared-21e68b72.js";import"./shared-37348820.js";import"./shared-315d7620.js";import"./shared-6957b8e6.js";import"./shared-8ef0ca65.js";import"./shared-3556f4b7.js";import"./shared-7dc9c80b.js";import"./shared-c25538f1.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-c18f681b.js";import"./shared-4d32d19e.js";import"./shared-343d1fd7.js";import"./shared-2aa23b5f.js";import"./shared-5afb584d.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-e5546d55.js";import"./shared-048d5cae.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-8b25a098.js";import"./shared-8b0f00fa.js";import"./shared-edeeb089.js";import"./shared-f989c70e.js";import"./shared-be442f26.js";import"./shared-243456aa.js";import"./shared-c1e86ea4.js";import"./shared-651c44fa.js";import"./shared-1c355fac.js";import"./shared-cf12f33b.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./foxy-copy-to-clipboard.js";import"./shared-d807cb20.js";import"./shared-360d6a20.js";import"./shared-3661a086.js";import"./shared-f1a70f51.js";let n,d=e=>e;class c extends(s(e,"webhook-form")){constructor(){super(...arguments),this.getStatusPageHref=null,this.getLogPageHref=null,this.resourceUri=null,this.__encryptionKeyGeneratorOptions={separator:"",length:512},this.__eventResources=[{value:"subscription",label:"event_resource_subscription"},{value:"transaction",label:"event_resource_transaction"},{value:"customer",label:"event_resource_customer"}]}static get properties(){return r(r({},super.properties),{},{getStatusPageHref:{attribute:!1},getLogPageHref:{attribute:!1},resourceUri:{attribute:"resource-uri"}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!!e&&e.length<=255||"name:v8n_too_long",({url:e})=>!e||e.length<=1e3||"url:v8n_too_long",({query:e})=>!e||e.length<=1e3||"query:v8n_too_long",({encryption_key:e})=>!!e||"encryption-key:v8n_required",({encryption_key:e})=>!e||e.length<=1e3||"encryption-key:v8n_too_long"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.data?e.unshift("general:event-resource"):e.unshift("logs","statuses"),new t(e.join(" ").trim())}get headerSubtitleOptions(){var e,r;const t=null===(e=this.data)||void 0===e?void 0:e.format;return{context:"json"===t?null===(r=this.data)||void 0===r?void 0:r.event_resource:t}}edit(e){super.edit(e),this.form.format||super.edit({format:"json"}),this.form.version||super.edit({version:2})}renderBody(){var e,r,t,s;const c=this.resourceUri?o(this.resourceUri):null;let l,m;try{const t=new URL(null!==(r=null===(e=this.data)||void 0===e?void 0:e._links["fx:statuses"].href)&&void 0!==r?r:"");null!==c&&t.searchParams.set("resource_id",String(c)),t.searchParams.set("order","date_created desc"),l=t.toString()}catch(e){l=void 0}try{const e=new URL(null!==(s=null===(t=this.data)||void 0===t?void 0:t._links["fx:logs"].href)&&void 0!==s?s:"");null!==c&&e.searchParams.set("resource_id",String(c)),e.searchParams.set("order","date_created desc"),m=e.toString()}catch(e){m=void 0}return i(n||(n=d` ${0} <foxy-internal-summary-control infer="general"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> <foxy-internal-select-control layout="summary-item" infer="event-resource" .options="${0}"> </foxy-internal-select-control> <foxy-internal-password-control layout="summary-item" infer="encryption-key" show-generator .generatorOptions="${0}"> </foxy-internal-password-control> <foxy-internal-text-control layout="summary-item" infer="query"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="url"></foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-async-list-control first="${0}" infer="statuses" limit="10" item="foxy-webhook-status-card" hide-delete-button .getPageHref="${0}" .itemProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control first="${0}" infer="logs" limit="10" item="foxy-webhook-log-card" hide-delete-button .getPageHref="${0}" .itemProps="${0}"> </foxy-internal-async-list-control> ${0} `),this.renderHeader(),this.__eventResources,this.__encryptionKeyGeneratorOptions,a(l),this.getStatusPageHref,this.resourceUri?{layout:"resource"}:{},a(m),this.getLogPageHref,this.resourceUri?{layout:"resource"}:{},super.renderBody())}}customElements.define("foxy-webhook-form",c);export{c as WebhookForm};
1
+ import"./shared-0c134ce7.js";import"./shared-4a4f6eb9.js";import"./shared-80a1bf6f.js";import"./shared-eea8debb.js";import"./shared-2c81b7df.js";import"./shared-afe24913.js";import{I as e}from"./shared-5b4e2567.js";import"./foxy-webhook-status-card.js";import"./foxy-webhook-log-card.js";import{_ as r,B as t}from"./shared-cb58dfcd.js";import{g as o}from"./shared-bab2ea2c.js";import{a as s}from"./shared-11351c00.js";import{i as a}from"./shared-53e42a77.js";import{h as i}from"./shared-ba5c42c7.js";import"./shared-f9ac8763.js";import"./shared-21e68b72.js";import"./shared-37348820.js";import"./shared-315d7620.js";import"./shared-6957b8e6.js";import"./shared-8ef0ca65.js";import"./shared-3556f4b7.js";import"./shared-7dc9c80b.js";import"./shared-c25538f1.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-c18f681b.js";import"./shared-4d32d19e.js";import"./shared-343d1fd7.js";import"./shared-2aa23b5f.js";import"./shared-5afb584d.js";import"./shared-f83207fb.js";import"./shared-5592ec6e.js";import"./shared-cd96ff03.js";import"./shared-5e4a03d1.js";import"./shared-7594e563.js";import"./shared-0aedd809.js";import"./shared-5ef40e86.js";import"./shared-5fd5805c.js";import"./shared-53e476fd.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-e5546d55.js";import"./shared-048d5cae.js";import"./shared-4e709717.js";import"./foxy-pagination.js";import"./shared-8b25a098.js";import"./shared-8b0f00fa.js";import"./shared-edeeb089.js";import"./shared-f989c70e.js";import"./shared-be442f26.js";import"./shared-243456aa.js";import"./shared-c1e86ea4.js";import"./shared-651c44fa.js";import"./shared-1c355fac.js";import"./shared-cf12f33b.js";import"./shared-d807cb20.js";import"./shared-360d6a20.js";import"./shared-d0aed1c1.js";import"./shared-5212ef4f.js";import"./foxy-copy-to-clipboard.js";import"./shared-3661a086.js";import"./shared-f1a70f51.js";let n,d=e=>e;class c extends(s(e,"webhook-form")){constructor(){super(...arguments),this.getStatusPageHref=null,this.getLogPageHref=null,this.resourceUri=null,this.__encryptionKeyGeneratorOptions={separator:"",length:512},this.__eventResources=[{value:"subscription",label:"event_resource_subscription"},{value:"transaction",label:"event_resource_transaction"},{value:"customer",label:"event_resource_customer"}]}static get properties(){return r(r({},super.properties),{},{getStatusPageHref:{attribute:!1},getLogPageHref:{attribute:!1},resourceUri:{attribute:"resource-uri"}})}static get v8n(){return[({name:e})=>!!e||"name:v8n_required",({name:e})=>!!e&&e.length<=255||"name:v8n_too_long",({url:e})=>!e||e.length<=1e3||"url:v8n_too_long",({query:e})=>!e||e.length<=1e3||"query:v8n_too_long",({encryption_key:e})=>!!e||"encryption-key:v8n_required",({encryption_key:e})=>!e||e.length<=1e3||"encryption-key:v8n_too_long"]}get hiddenSelector(){const e=[super.hiddenSelector.toString()];return this.data?e.unshift("group-two:event-resource"):e.unshift("logs","statuses"),new t(e.join(" ").trim())}get headerSubtitleOptions(){var e,r;const t=null===(e=this.data)||void 0===e?void 0:e.format;return{context:"json"===t?null===(r=this.data)||void 0===r?void 0:r.event_resource:t}}edit(e){super.edit(e),this.form.format||super.edit({format:"json"}),this.form.version||super.edit({version:2})}renderBody(){var e,r,t,s;const c=this.resourceUri?o(this.resourceUri):null;let l,m;try{const t=new URL(null!==(r=null===(e=this.data)||void 0===e?void 0:e._links["fx:statuses"].href)&&void 0!==r?r:"");null!==c&&t.searchParams.set("resource_id",String(c)),t.searchParams.set("order","date_created desc"),l=t.toString()}catch(e){l=void 0}try{const e=new URL(null!==(s=null===(t=this.data)||void 0===t?void 0:t._links["fx:logs"].href)&&void 0!==s?s:"");null!==c&&e.searchParams.set("resource_id",String(c)),e.searchParams.set("order","date_created desc"),m=e.toString()}catch(e){m=void 0}return i(n||(n=d` ${0} <foxy-internal-summary-control infer="group-one"> <foxy-internal-text-control layout="summary-item" infer="name"></foxy-internal-text-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="group-two"> <foxy-internal-select-control layout="summary-item" infer="event-resource" .options="${0}"> </foxy-internal-select-control> <foxy-internal-text-control layout="summary-item" infer="query"> </foxy-internal-text-control> <foxy-internal-text-control layout="summary-item" infer="url"></foxy-internal-text-control> <foxy-internal-password-control layout="summary-item" infer="encryption-key" show-generator .generatorOptions="${0}"> </foxy-internal-password-control> </foxy-internal-summary-control> <foxy-internal-summary-control infer="group-three"> <foxy-internal-switch-control infer="is-active"></foxy-internal-switch-control> </foxy-internal-summary-control> <foxy-internal-async-list-control first="${0}" infer="statuses" limit="10" item="foxy-webhook-status-card" hide-delete-button .getPageHref="${0}" .itemProps="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control first="${0}" infer="logs" limit="10" item="foxy-webhook-log-card" hide-delete-button .getPageHref="${0}" .itemProps="${0}"> </foxy-internal-async-list-control> ${0} `),this.renderHeader(),this.__eventResources,this.__encryptionKeyGeneratorOptions,a(l),this.getStatusPageHref,this.resourceUri?{layout:"resource"}:{},a(m),this.getLogPageHref,this.resourceUri?{layout:"resource"}:{},super.renderBody())}}customElements.define("foxy-webhook-form",c);export{c as WebhookForm};
@@ -1,4 +1,4 @@
1
- import{_ as e}from"./shared-cb58dfcd.js";import{T as t}from"./shared-e3421ca1.js";import{a as s}from"./shared-11351c00.js";import{p as n}from"./shared-8eeddc22.js";let a,o,i,r,c=e=>e;class l extends(s(t,"subscriptions-table")){constructor(){super(...arguments),this.columns=[l.priceColumn,l.summaryColumn,l.statusColumn,l.subTokenURLColumn]}}l.priceColumn={cell:t=>{const s=t.data._embedded["fx:transaction_template"],o=`${s.total_order} ${s.currency_code}`;return t.html(a||(a=c`
1
+ import{_ as e}from"./shared-cb58dfcd.js";import{T as t}from"./shared-e3421ca1.js";import{a as s}from"./shared-11351c00.js";import{p as n}from"./shared-8eeddc22.js";import{g as a}from"./shared-e2675ed0.js";import{c as o}from"./shared-4e709717.js";let r,l,m,i,c=e=>e;class u extends(s(t,"subscriptions-table")){constructor(){super(...arguments),this.columns=[u.priceColumn,u.summaryColumn,u.statusColumn,u.subTokenURLColumn]}}u.priceColumn={cell:t=>{const s=t.data._embedded["fx:transaction_template"],a=`${s.total_order} ${s.currency_code}`;return t.html(r||(r=c`
2
2
  <foxy-i18n
3
3
  data-testclass="i18n frequencies"
4
4
  class="font-medium text-m font-tnum"
@@ -8,7 +8,7 @@ import{_ as e}from"./shared-cb58dfcd.js";import{T as t}from"./shared-e3421ca1.js
8
8
  .options=${0}
9
9
  >
10
10
  </foxy-i18n>
11
- `),t.lang,".5m"===t.data.frequency?"twice_a_month":"recurring",t.ns,e(e({},n(t.data.frequency)),{},{amount:o}))}},l.summaryColumn={cell:e=>{const t=e.data._embedded["fx:transaction_template"]._embedded["fx:items"],s={most_expensive_item:[...t].sort(((e,t)=>e.price-t.price))[0],count_minus_one:t.length-1,count:t.length};return e.html(o||(o=c`
11
+ `),t.lang,".5m"===t.data.frequency?"twice_a_month":"recurring",t.ns,e(e({},n(t.data.frequency)),{},{amount:a}))}},u.summaryColumn={cell:e=>{const t=e.data._embedded["fx:transaction_template"]._embedded["fx:items"],s={most_expensive_item:[...t].sort(((e,t)=>e.price-t.price))[0],count_minus_one:t.length-1,count:t.length};return e.html(l||(l=c`
12
12
  <foxy-i18n
13
13
  data-testclass="i18n summaries"
14
14
  class="text-m"
@@ -18,17 +18,17 @@ import{_ as e}from"./shared-cb58dfcd.js";import{T as t}from"./shared-e3421ca1.js
18
18
  .options=${0}
19
19
  >
20
20
  </foxy-i18n>
21
- `),e.lang,e.ns,s)}},l.statusColumn={hideBelow:"sm",cell:({ns:e,lang:t,data:s,html:n})=>{let a,o,r="bg-contrast-5 text-secondary";if(s.first_failed_transaction_date)r="bg-error-10 text-error",a=s.first_failed_transaction_date,o="subscription_failed";else if(s.end_date){a=s.end_date;o=new Date(s.end_date).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}else s.is_active?new Date(s.start_date)>new Date?(a=s.start_date,o="subscription_will_be_active"):(r="bg-success-10 text-success",a=s.next_transaction_date,o="subscription_active"):(a="",o="subscription_inactive");return n(i||(i=c`
21
+ `),e.lang,e.ns,s)}},u.statusColumn={hideBelow:"sm",cell:({ns:e,lang:t,data:s,html:n})=>{const r=a(s),l="failed"===r,i="next_payment"===r||!!(null==r?void 0:r.startsWith("will_end"));return n(m||(m=c`
22
22
  <foxy-i18n
23
23
  data-testclass="i18n statuses"
24
- class="px-s py-xs text-m font-medium block whitespace-normal rounded ${0}"
24
+ class=${0}
25
25
  lang=${0}
26
- key=${0}
26
+ key="status_${0}"
27
27
  ns=${0}
28
28
  .options=${0}
29
29
  >
30
30
  </foxy-i18n>
31
- `),r,t,o,e,{date:a})}},l.subTokenURLColumn={cell:e=>e.html(r||(r=c`
31
+ `),o({"px-s py-xs text-m font-medium inline-block whitespace-normal rounded":!0,"text-secondary bg-contrast-5":!i&&!l,"text-success bg-success-10":i,"text-error bg-error-10":l}),t,r,e,s)}},u.subTokenURLColumn={cell:e=>e.html(i||(i=c`
32
32
  <a
33
33
  data-testclass="links"
34
34
  target="_blank"
@@ -43,4 +43,4 @@ import{_ as e}from"./shared-cb58dfcd.js";import{T as t}from"./shared-e3421ca1.js
43
43
  >
44
44
  </foxy-i18n>
45
45
  </a>
46
- `),e.data._links["fx:sub_token_url"].href,e.lang,e.ns)};export{l as S};
46
+ `),e.data._links["fx:sub_token_url"].href,e.lang,e.ns)};export{u as S};
@@ -0,0 +1 @@
1
+ function e(e){if(null===e)return null;const n=e=>e&&"0000-00-00"!==e?new Date(e).getTime():null,t=e.is_active,l=n(e.first_failed_transaction_date),a=n(e.start_date),d=n(e.next_transaction_date),i=n(e.end_date),_=Date.now();return l?i&&i<=_?"failed_and_ended":"failed":null===a?null:t&&a>_?"will_start":null===d?null:t&&i&&i>_?d<=i?"will_end_after_payment":"will_end":t?i?"ended":"next_payment":a<=_&&i&&i<=_?"ended":"inactive"}export{e as g};
@@ -6,12 +6,14 @@
6
6
  "monthly_plural": "/ {{count}} months",
7
7
  "price_recurring": "{{amount, price}} $t(frequency, { \"count\": \"{{count}}\", \"units\": \"{{units}}\", \"ns\": \"admin-subscription-card\" })",
8
8
  "price_twice_a_month": "{{amount, price}} $t(twice_a_month, { \"ns\": \"admin-subscription-card\" })",
9
- "subscription_active": "Next payment on {{date, date}}",
10
- "subscription_cancelled": "Ended on {{date, date}}",
11
- "subscription_failed": "Payment failed on {{date, date}}",
12
- "subscription_inactive": "Inactive",
13
- "subscription_will_be_cancelled": "Ends on {{date, date}}",
14
- "subscription_will_be_active": "Starts on {{date, date}}",
9
+ "status_failed_and_ended": "Ended on {{ end_date, date }} (failed on {{ first_failed_transaction_date, date }})",
10
+ "status_failed": "Failed on {{ first_failed_transaction_date, date }}",
11
+ "status_will_start": "Starts on {{ start_date, date }}",
12
+ "status_will_end_after_payment": "Next payment on {{ next_transaction_date, date }}, ending {{ end_date, date }}",
13
+ "status_will_end": "Ends on {{ end_date, date }}",
14
+ "status_ended": "Ended on {{ end_date, date }}",
15
+ "status_next_payment": "Next payment on {{ next_transaction_date, date }}",
16
+ "status_inactive": "Inactive",
15
17
  "summary": "{{ firstItem.name }}",
16
18
  "summary_plural": "{{ firstItem.name }} + {{ countMinus1 }} more",
17
19
  "summary_approximate": "{{ firstItem.name }} + more",
@@ -25,4 +27,4 @@
25
27
  "loading_empty": "No data",
26
28
  "loading_error": "Unknown error"
27
29
  }
28
- }
30
+ }
@@ -2,8 +2,13 @@
2
2
  "header": {
3
3
  "title_existing": "Subscription #{{ id }}",
4
4
  "title_new": "",
5
- "subtitle_inactive": "Inactive",
6
- "subtitle_active": "Active",
5
+ "subtitle_failed_and_ended": "Ended on {{ end_date, date }} (failed on {{ first_failed_transaction_date, date }})",
6
+ "subtitle_failed": "Failed on {{ first_failed_transaction_date, date }}",
7
+ "subtitle_will_start": "Starts on {{ start_date, date }}",
8
+ "subtitle_will_end_after_payment": "Next payment on {{ next_transaction_date, date }}, ending {{ end_date, date }}",
9
+ "subtitle_will_end": "Ends on {{ end_date, date }}",
10
+ "subtitle_ended": "Ended on {{ end_date, date }}",
11
+ "subtitle_next_payment": "Next payment on {{ next_transaction_date, date }}",
7
12
  "subtitle": "",
8
13
  "copy-id": {
9
14
  "failed_to_copy": "Failed to copy",
@@ -1080,12 +1080,14 @@
1080
1080
  "title_existing": "Subscription",
1081
1081
  "title_recurring": "{{amount, price}} $t(frequency, { \"count\": \"{{count}}\", \"units\": \"{{units}}\", \"ns\": \"subscription-form\" })",
1082
1082
  "title_twice_a_month": "{{amount, price}} $t(twice_a_month, { \"ns\": \"subscription-form\" })",
1083
- "subtitle_active": "Including shipping, taxes, etc. Next payment on {{date, date}}.",
1084
- "subtitle_cancelled": "Including shipping, taxes, etc. Ended on {{date, date}}.",
1085
- "subtitle_failed": "Including shipping, taxes, etc. Payment failed on {{date, date}}.",
1086
- "subtitle_inactive": "Including shipping, taxes, etc. Inactive.",
1087
- "subtitle_will_be_cancelled": "Including shipping, taxes, etc. Ends on {{date, date}}.",
1088
- "subtitle_will_be_active": "Including shipping, taxes, etc. Starts on {{date, date}}.",
1083
+ "subtitle_failed_and_ended": "Including shipping, taxes, etc. Ended on {{ end_date, date }} (failed on {{ first_failed_transaction_date, date }})",
1084
+ "subtitle_failed": "Including shipping, taxes, etc. Failed on {{ first_failed_transaction_date, date }}",
1085
+ "subtitle_will_start": "Including shipping, taxes, etc. Starts on {{ start_date, date }}",
1086
+ "subtitle_will_end_after_payment": "Including shipping, taxes, etc. Next payment on {{ next_transaction_date, date }}, ending {{ end_date, date }}",
1087
+ "subtitle_will_end": "Including shipping, taxes, etc. Ends on {{ end_date, date }}",
1088
+ "subtitle_ended": "Including shipping, taxes, etc. Ended on {{ end_date, date }}",
1089
+ "subtitle_next_payment": "Including shipping, taxes, etc. Next payment on {{ next_transaction_date, date }}",
1090
+ "subtitle": "Including shipping, taxes, etc.",
1089
1091
  "copy-id": {
1090
1092
  "failed_to_copy": "Failed to copy",
1091
1093
  "click_to_copy": "Copy ID",
@@ -1293,12 +1295,14 @@
1293
1295
  "monthly_plural": "Every {{count}} months",
1294
1296
  "price_recurring": "{{amount, price}} $t(subscriptions-table.frequency, { \"count\": \"{{count}}\", \"units\": \"{{units}}\", \"ns\": \"customer\" })",
1295
1297
  "price_twice_a_month": "{{amount, price}} $t(subscriptions-table.twice_a_month, { \"ns\": \"customer\" })",
1296
- "subscription_active": "Next payment on {{date, date}}",
1297
- "subscription_cancelled": "Ended on {{date, date}}",
1298
- "subscription_failed": "Payment failed on {{date, date}}",
1299
- "subscription_inactive": "Inactive",
1300
- "subscription_will_be_cancelled": "Ends on {{date, date}}",
1301
- "subscription_will_be_active": "Starts on {{date, date}}",
1298
+ "status_failed_and_ended": "Ended on {{ end_date, date }} (failed on {{ first_failed_transaction_date, date }})",
1299
+ "status_failed": "Failed on {{ first_failed_transaction_date, date }}",
1300
+ "status_will_start": "Starts on {{ start_date, date }}",
1301
+ "status_will_end_after_payment": "Next payment on {{ next_transaction_date, date }}, ending {{ end_date, date }}",
1302
+ "status_will_end": "Ends on {{ end_date, date }}",
1303
+ "status_ended": "Ended on {{ end_date, date }}",
1304
+ "status_next_payment": "Next payment on {{ next_transaction_date, date }}",
1305
+ "status_inactive": "Inactive",
1302
1306
  "transaction_summary": "{{most_expensive_item.name}}",
1303
1307
  "twice_a_month": "Twice a month",
1304
1308
  "update": "Update",