@foxy.io/elements 1.21.1 → 1.21.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -92,7 +92,7 @@ import{P as t,h as e}from"./shared-0ce006b9.js";import{E as i,T as s}from"./shar
92
92
  <iron-icon icon="lumo:cross"></iron-icon>
93
93
  </vaadin-button>
94
94
  </div>
95
- `}static get is(){return"vcf-tooltip"}static get version(){return"1.3.15"}static get properties(){return{for:{type:String},position:{type:String,value:"top"},align:{type:String,value:"center"},hidden:{type:Boolean,value:!0,notify:!0,reflectToAttribute:!0,observer:"_hiddenChanged"},manual:{type:Boolean,value:!1,reflectToAttribute:!0},targetElement:{type:Object,observer:"_attachToTarget"},closeButton:{type:Boolean,value:!1,reflectToAttribute:!0},theme:{type:String,reflectToAttribute:!0}}}static get observers(){return["_setPosition(targetElement, hidden, position, align)","_updateTarget(for)","_manualObserver(manual)"]}constructor(){super(),this._boundShow=this.show.bind(this),this._boundHide=this.hide.bind(this),this._boundOnKeyup=this._onKeyup.bind(this)}connectedCallback(){super.connectedCallback(),this._attachToTarget(),this._setDefaultId()}ready(){super.ready(),window.addEventListener("resize",(()=>{clearTimeout(this._resizeTimeout),this._resizeTimeout=setTimeout((()=>{const{targetElement:t,hidden:e,position:i}=this;this.hidden||this._setPosition(t,e,i)}),100)})),this.getAttribute("theme")||this.setAttribute("theme","dark")}disconnectedCallback(){super.disconnectedCallback(),this._detachFromTarget()}_manualObserver(){this.manual?this._removeEvents():this._addEvents()}_attachToTarget(t,e){e&&(this._removeTargetEvents(e),e.describedby&&(e.removeAttribute("aria-describedby"),delete e.describedby)),t&&(this._addEvents(),t.getAttribute("aria-describedby")||(t.setAttribute("aria-describedby",this.id),t.describedby=!0))}_addEvents(){this.targetElement&&!this.manual&&(this.targetElement.addEventListener("mouseenter",this._boundShow),this.targetElement.addEventListener("focus",this._boundShow),this.targetElement.addEventListener("mouseleave",this._boundHide),this.targetElement.addEventListener("blur",this._boundHide),this.targetElement.addEventListener("tap",this._boundHide)),this.manual||(this.addEventListener("mouseenter",this._boundShow),this.addEventListener("mouseleave",this._boundHide))}_detachFromTarget(){this.manual||this._removeEvents(),this.targetElement&&this.targetElement.describedby&&(this.targetElement.removeAttribute("aria-describedby"),delete this.targetElement.describedby)}_removeEvents(){this.targetElement&&this._removeTargetEvents(this.targetElement),this.removeEventListener("mouseenter",this._boundShow),this.removeEventListener("mouseleave",this._boundHide)}_removeTargetEvents(t){t.removeEventListener("mouseenter",this._boundShow),t.removeEventListener("focus",this._boundShow),t.removeEventListener("mouseleave",this._boundHide),t.removeEventListener("blur",this._boundHide),t.removeEventListener("tap",this._boundHide)}_updateTarget(){this.targetElement=this.parentNode.querySelector(`#${this.for}`)}_setPosition(t,e,i){if(t&&!e){let t=window.innerHeight,e=window.innerWidth;this.offsetParent&&(t=this.offsetParent.scrollHeight,e=this.offsetParent.scrollWidth);const s=this.targetElement.getBoundingClientRect(),a=this.getBoundingClientRect(),n=(s.width-a.width)/2,o=(s.height-a.height)/2;let r,l,d=s.left,c=s.top,u=window.pageYOffset;switch(this._parentPostioned&&(c=this.targetElement.offsetTop,d=this.targetElement.offsetLeft,u=0),i){case"top":l=c-a.height+u,r=this._calculateLeft(d,s,a,n);break;case"bottom":l=c+s.height+u,r=this._calculateLeft(d,s,a,n);break;case"left":r=d-a.width,l=this._calculateTop(c,s,a,o,u);break;case"right":r=d+s.width,l=this._calculateTop(c,s,a,o,u)}this._setPositionInVisibleBounds(t,e,r,l,a)}}get _parentPostioned(){return"static"!==window.getComputedStyle(this.offsetParent).position}_setPositionInVisibleBounds(t,e,i,s,a){i+a.width>e?(this.style.right="0px",this.style.left="auto"):(this.style.left=Math.max(0,i)+"px",this.style.right="auto"),s+a.height>t?(this.style.bottom=t+"px",this.style.top="auto"):(this.style.top=Math.max(0,s)+"px",this.style.bottom="auto")}_calculateLeft(t,e,i,s){switch(this.align){case"left":return t;case"right":return e.left+e.width-i.width;default:return t+s}}_calculateTop(t,e,i,s,a){switch(this.align){case"top":return t+a;case"bottom":return t+e.height-i.height+a;default:return t+s+a}}show(){this.hidden=!1}hide(){this.hidden=!0}_hiddenChanged(t){t?(this.setAttribute("aria-hidden",!0),window.removeEventListener("keyup",this._boundOnKeyup)):(this.setAttribute("aria-hidden",!1),window.addEventListener("keyup",this._boundOnKeyup))}_onKeyup(t){27===t.keyCode&&this.hide()}_setDefaultId(){this.id||(Vaadin.tooltipIndex||(Vaadin.tooltipIndex=0),this.id="vcf-tooltip"+ ++Vaadin.tooltipIndex)}}function $(t){return function*(t){const e=[];for(const i of t.settings.subscriptions.allowFrequencyModification)if(g(i.jsonataQuery).evaluate(t.subscription))for(const t of i.values)!e.includes(t)&&(e.push(t),yield t)}({settings:{subscriptions:{allowFrequencyModification:t.settings.subscriptions.allow_frequency_modification.map((t=>({jsonataQuery:t.jsonata_query,values:t.values})))}},subscription:t.subscription})}customElements.define(x.is,x),window.Vaadin.VcfTooltip=x;class w extends Error{constructor(t){super(`Invalid frequency "${t}".`)}}function S(t){const e=864e5,i=31*e;if(".5m"===t)return i/2;const s=parseInt(t.substring(0,t.length-1));if(isNaN(s))throw new w(t);if(t.endsWith("y"))return 31536e6*s;if(t.endsWith("m"))return s*i;if(t.endsWith("w"))return 6048e5*s;if(t.endsWith("d"))return s*e;throw new w(t)}function T(t,e){if("boolean"==typeof e)return e;const i=e.filter((e=>Boolean(g(e.jsonataQuery).evaluate(t)))).reduce(((t,e)=>{var i,s,a,n,o;if(e.min){const i=t.min?S(t.min):1/0;S(e.min)<i&&(t.min=e.min)}if(e.max){const i=t.max?S(t.max):-1/0;S(e.max)>i&&(t.max=e.max)}if("day"===(null===(i=e.allowedDays)||void 0===i?void 0:i.type)){const i=[...null!==(s=t.allowedDaysOfWeek)&&void 0!==s?s:[],...e.allowedDays.days];t.allowedDaysOfWeek=Array.from(new Set(i))}if("month"===(null===(a=e.allowedDays)||void 0===a?void 0:a.type)){const i=[...null!==(n=t.allowedDaysOfMonth)&&void 0!==n?n:[],...e.allowedDays.days];t.allowedDaysOfMonth=Array.from(new Set(i))}if(e.disallowedDates){const i=[...null!==(o=t.disallowedDates)&&void 0!==o?o:[],...e.disallowedDates];t.disallowedDates=Array.from(new Set(i))}return t}),{});return 0!==Object.keys(i).length&&i}function j(t){const[e,i,s]=t.split("-").map((t=>parseInt(t)));return new Date(e,i-1,s)}function E(t){const e=t.settings.subscriptions.allow_next_date_modification;let i;return i="boolean"==typeof e?e:e.map((t=>({allowedDays:t.allowed_days,disallowedDates:t.disallowed_dates,jsonataQuery:t.jsonata_query,max:t.max,min:t.min}))),function(t){var e,i;const s=j(t.value),a=s.getTime(),n=T(t.subscription,t.settings.subscriptions.allowNextDateModification);if("boolean"==typeof n)return n;if(!1===(null===(e=n.allowedDaysOfMonth)||void 0===e?void 0:e.includes(s.getDate())))return!1;if(!1===(null===(i=n.allowedDaysOfWeek)||void 0===i?void 0:i.includes(s.getDay())))return!1;if(n.disallowedDates&&n.disallowedDates.find((t=>{const[e,i]=t.split("..").map((t=>j(t).getTime()));return a===e||void 0!==i&&a>=e&&a<=i})))return!1;if(n.min){const t=b(n.min);if(null!==t&&Date.now()+t>=a)return!1}if(n.max){const t=b(n.max);if(null!==t&&Date.now()+t<=a)return!1}return!0}({settings:{subscriptions:{allowNextDateModification:i}},subscription:t.subscription,value:t.value})}let D,q,k,L,H,I,A,O,C,z,P,N,F,R,V,B,M,U=t=>t;const W=n(o(r(c,"subscription-form")));class K extends W{constructor(){super(...arguments),this.getTransactionPageHref=(t,e)=>null==e?void 0:e._links["fx:receipt"].href,this.customerAddresses=null,this.itemCategories=null,this.localeCodes=null,this.templates={},this.settings=null,this.coupons=null,this.__transactionTemplateLoaderId="transactionTemplateLoader",this.__defaultTemplateSetLoaderId="defaultTemplateSetLoader",this.__localeCodesHelperLoaderId="localeCodesLoader",this.__templateSetLoaderId="templateSetLoader",this.__storeLoaderId="storeLoader",this.__renderHeaderSubtitle=()=>{var t;const{data:e,lang:i,ns:s}=this;if(e){let a,n,o="text-secondary";if(e.first_failed_transaction_date)o="text-error",a=e.first_failed_transaction_date,n="subscription_failed";else if(e.end_date){a=e.end_date;n=new Date(a).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}else a=null!==(t=e.next_transaction_date)&&void 0!==t?t:(new Date).toISOString(),n="subscription_"+(e.is_active?"active":"inactive");const r=d(D||(D=U` <foxy-i18n data-testid="header-subtitle" options="${0}" class="${0}" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify({date:a}),o,i,n,s);return e.first_failed_transaction_date?d(q||(q=U` <span id="status" class="flex items-center space-x-xs ${0}"> ${0}<iron-icon icon="icons:info-outline" class="icon-inline"></iron-icon> </span> <vcf-tooltip for="status" position="bottom"> <span class="text-s">${0}</span> </vcf-tooltip> `),o,r,e.error_message):r}return d(k||(k=U`<x-skeleton class="w-full" variant="static">&nbsp;</x-skeleton>`))},this.__renderHeaderTitle=(t,e)=>{const{data:i,lang:s,ns:a}=this;if(i){const n=_(i.frequency),o=this.__transactionTemplate,r=null==o?void 0:o.total_order;return"string"!=typeof t?d(L||(L=U`--`)):d(H||(H=U` <foxy-i18n data-testid="header-title" options="${0}" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify(u(u({},n),{},{amount:`${r} ${t}`,currencyDisplay:e})),s,".5m"===i.frequency?"twice_a_month":"recurring",a)}return d(I||(I=U`<x-skeleton class="w-full" variant="static">&nbsp;</x-skeleton>`))},this.__renderHeader=(t,e)=>d(A||(A=U` <div data-testid="header" class="sm-col-span-2"> ${0} <div class="leading-xs text-xxl font-bold truncate"> ${0} </div> <div class="leading-xs text-l">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("header:before"),this.__renderHeaderTitle(t,e),this.__renderHeaderSubtitle(),this.renderTemplateOrSlot("header:after")),this.__renderItemsActions=()=>d(O||(O=U` <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 t;let e;try{const i=this.__transactionTemplate,s=new URL(null!==(t=null==i?void 0:i._links["fx:items"].href)&&void 0!==t?t:"");s.searchParams.set("zoom","item_options"),e=s.toString()}catch(t){e=void 0}return d(C||(C=U` <div data-testid="items" class="space-y-xs sm-col-span-2"> ${0} <foxy-internal-async-list-control first="${0}" limit="5" infer="items" item="foxy-item-card"> </foxy-internal-async-list-control> </div> `),this.hiddenSelector.matches("items:actions",!0)?"":this.__renderItemsActions(),v(e))},this.__renderEndDate=()=>{const{disabledSelector:t,lang:e,ns:i}=this,s=this.hiddenSelector.zoom("end-date:form").toString();return d(z||(z=U` <div class="sm-col-span-2"> ${0} <foxy-form-dialog readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="save-button ${0}" data-testid="cancellation-form" parent="${0}" header="end_subscription" alert form="foxy-cancellation-form" href="${0}" lang="${0}" id="end-date-form" ns="${0}" .templates="${0}"> </foxy-form-dialog> <vaadin-button data-testid="end-date" theme="error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n key="end_subscription" ns="${0}" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("end-date:before"),this.readonlySelector.zoom("end-date:form").toString(),t.zoom("end-date:form").toString(),s,this.parent,this.href,e,i,this.getNestedTemplates("end-date:form"),!this.data||t.matches("end-date",!0),(t=>{this.renderRoot.querySelector("#end-date-form").show(t.currentTarget)}),i,e,this.renderTemplateOrSlot("end-date:after"))},this.__checkNextTransactionDateAvailability=t=>{const{settings:e,data:i}=this;if(e&&i){return E({value:y(t),settings:e,subscription:i})}return t.getTime()>=Date.now()},this.__checkStartDateAvailability=t=>t.getTime()>=Date.now(),this.__renderStartDate=()=>{const{data:t,lang:e,ns:i}=this;return d(P||(P=U` <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"),i,e,v(null==t?void 0:t.start_date.substr(0,10)),v(null==t?void 0:t.start_date),e,!this.__isStartDateEditable,this.disabledSelector.matches("start-date",!0),this.__checkStartDateAvailability,(t=>{const e=t.target;this.edit({start_date:e.value})}),this.renderTemplateOrSlot("start-date:after"))},this.__renderNextTransactionDate=()=>{const{data:t,lang:e,ns:i}=this,s=!!(null==t?void 0:t.is_active);return d(N||(N=U` <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"),i,e,v(null==t?void 0:t.next_transaction_date.substr(0,10)),v(null==t?void 0:t.next_transaction_date),e,!s||this.readonlySelector.matches("next-transaction-date",!0),!t||this.disabledSelector.matches("next-transaction-date",!0),this.__checkNextTransactionDateAvailability,(t=>{const e=t.target;this.edit({next_transaction_date:e.value})}),this.renderTemplateOrSlot("next-transaction-date:after"))},this.__renderFrequencyAsDropdown=()=>{const{data:t}=this,e=!!(null==t?void 0:t.is_active),i=this.__frequencies.map((t=>({label:this.t(".5m"===t?"twice_a_month":"frequency",_(t)),value:t})));return d(F||(F=U` <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> `),!t||this.disabledSelector.matches("frequency",!0),t&&(!e||this.readonlySelector.matches("frequency",!0)),this.t("frequency_label").toString(),v(this.form.frequency),i,(t=>{this.edit({frequency:t.target.value})}))},this.__renderFrequencyAsRadioList=()=>{var t;const{data:e,lang:i,ns:s}=this;return d(R||(R=U` <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> `),s,i,s,null===this.settings,this.__frequencies,null!==(t=this.form.frequency)&&void 0!==t?t:null,!e||this.disabledSelector.matches("frequency",!0),e&&(!e.is_active||this.readonlySelector.matches("frequency",!0)),(t=>{this.edit({frequency:t.target.value})}),this.__frequencies.map((t=>d(V||(V=U` <foxy-i18n options="${0}" slot="${0}-label" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify(_(t)),t,i,".5m"===t?"twice_a_month":"frequency",s))))},this.__renderFrequency=()=>d(B||(B=U` <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"))}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-calendar":customElements.get("foxy-internal-calendar"),"foxy-collection-pages":customElements.get("foxy-collection-pages"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"foxy-form-dialog":customElements.get("foxy-form-dialog"),"vaadin-button":customElements.get("vaadin-button"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-nucleon":customElements.get("foxy-nucleon"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-table":customElements.get("foxy-table"),"foxy-i18n":customElements.get("foxy-i18n"),"iron-icon":customElements.get("iron-icon"),"x-skeleton":m,"x-choice":h,"x-group":f}}static get properties(){return u(u({},super.properties),{},{getTransactionPageHref:{attribute:!1},customerAddresses:{attribute:"customer-addresses"},itemCategories:{attribute:"item-categories"},localeCodes:{attribute:"locale-codes"},settings:{type:Object},coupons:{}})}get hiddenSelector(){return new p(`items:pagination:card:autorenew-icon ${super.hiddenSelector}`)}renderBody(){var t,e,i,s,a,n,o,r;let l;try{const i=new URL(null!==(e=null===(t=this.data)||void 0===t?void 0:t._links["fx:transactions"].href)&&void 0!==e?e:"");i.searchParams.set("order","transaction_date desc"),i.searchParams.set("zoom","items"),l=i.toString()}catch(t){l=void 0}const c=(null===(i=this.__store)||void 0===i?void 0:i.use_international_currency_symbol)?"code":"symbol",u=this.__transactionTemplate;let h=null;if(null==u?void 0:u.currency_code)h=u.currency_code;else{const t=this.__localeCodesHelper,e=null===(a=null!==(s=this.__templateSet)&&void 0!==s?s:this.__defaultTemplateSet)||void 0===a?void 0:a.locale_code,i=e?null==t?void 0:t.values[e]:void 0;i&&(h=null!==(o=null===(n=/Currency: ([A-Z]{3})/g.exec(i))||void 0===n?void 0:n[1])&&void 0!==o?o:null)}return d(M||(M=U` <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="relative grid grid-cols-1 sm-grid-cols-2 gap-l"> ${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> ${0} </div> `),v(this.__transactionTemplateHref),this.__transactionTemplateLoaderId,(()=>this.requestUpdate()),v(this.__defaultTemplateSetHref),this.__defaultTemplateSetLoaderId,(()=>this.requestUpdate()),v(this.__localeCodesHelperHref),this.__localeCodesHelperLoaderId,(()=>this.requestUpdate()),v(this.__templateSetHref),this.__templateSetLoaderId,(()=>this.requestUpdate()),v(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.hiddenSelector.matches("header",!0)?"":this.__renderHeader(null!=h?h:void 0,c),this.hiddenSelector.matches("items",!0)?"":this.__renderItems(),this.__isFrequencyVisible?this.__renderFrequency():"",this.__isStartDateVisible?this.__renderStartDate():"",this.__isNextTransactionDateVisible?this.__renderNextTransactionDate():"",v(null!=h?h:void 0),v(null===(r=this.data)||void 0===r?void 0:r._links["fx:attributes"].href),v(l),this.getTransactionPageHref,this.hiddenSelector.matches("end-date",!0)?"":this.__renderEndDate())}get __transactionTemplateHref(){var t;return null===(t=this.data)||void 0===t?void 0:t._links["fx:transaction_template"].href}get __defaultTemplateSetHref(){var t,e,i;if(""===(null===(t=this.__transactionTemplate)||void 0===t?void 0:t.template_set_uri))try{const t=new URL(null!==(i=null===(e=this.__store)||void 0===e?void 0:e._links["fx:template_sets"].href)&&void 0!==i?i:"");return t.searchParams.set("code","DEFAULT"),t.toString()}catch(t){}}get __localeCodesHelperHref(){var t;if(this.__defaultTemplateSetHref||this.__templateSetHref)return null!==(t=this.localeCodes)&&void 0!==t?t:void 0}get __templateSetHref(){const t=this.__transactionTemplate;if(!(null==t?void 0:t.currency_code))return(null==t?void 0:t.template_set_uri)||void 0}get __storeHref(){var t,e;return null===(e=null===(t=this.data)||void 0===t?void 0:t._links["fx:store"])||void 0===e?void 0:e.href}get __transactionTemplate(){var t,e;const i=`#${this.__transactionTemplateLoaderId}`;return null!==(e=null===(t=this.renderRoot.querySelector(i))||void 0===t?void 0:t.data)&&void 0!==e?e:null}get __defaultTemplateSet(){var t,e;const i=`#${this.__defaultTemplateSetLoaderId}`,s=this.renderRoot.querySelector(i);return null!==(e=null===(t=null==s?void 0:s.data)||void 0===t?void 0:t._embedded["fx:template_sets"][0])&&void 0!==e?e:null}get __localeCodesHelper(){var t,e;const i=`#${this.__localeCodesHelperLoaderId}`;return null!==(e=null===(t=this.renderRoot.querySelector(i))||void 0===t?void 0:t.data)&&void 0!==e?e:null}get __templateSet(){var t,e;const i=`#${this.__templateSetLoaderId}`;return null!==(e=null===(t=this.renderRoot.querySelector(i))||void 0===t?void 0:t.data)&&void 0!==e?e:null}get __store(){var t,e;const i=`#${this.__storeLoaderId}`;return null!==(e=null===(t=this.renderRoot.querySelector(i))||void 0===t?void 0:t.data)&&void 0!==e?e: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 t=this.settings.subscriptions.allow_next_date_modification;return!!function(t,e){let i;return i="boolean"==typeof e?e:e.map((t=>({allowedDays:t.allowed_days,disallowedDates:t.disallowed_dates,jsonataQuery:t.jsonata_query,max:t.max,min:t.min}))),T(t,i)}(this.data,t)}get __isStartDateVisible(){return!this.hiddenSelector.matches("start-date",!0)&&this.__isNextTransactionDateVisible}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 __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!$({subscription:this.data,settings:this.settings}).next().done}get __frequencies(){if(!this.settings||!this.data)return[".5m","1m","1y"];const t=$({subscription:this.data,settings:this.settings});return Array.from(t)}}let Q;a("vcf-tooltip",l(Q||(Q=(t=>t)`
95
+ `}static get is(){return"vcf-tooltip"}static get version(){return"1.3.15"}static get properties(){return{for:{type:String},position:{type:String,value:"top"},align:{type:String,value:"center"},hidden:{type:Boolean,value:!0,notify:!0,reflectToAttribute:!0,observer:"_hiddenChanged"},manual:{type:Boolean,value:!1,reflectToAttribute:!0},targetElement:{type:Object,observer:"_attachToTarget"},closeButton:{type:Boolean,value:!1,reflectToAttribute:!0},theme:{type:String,reflectToAttribute:!0}}}static get observers(){return["_setPosition(targetElement, hidden, position, align)","_updateTarget(for)","_manualObserver(manual)"]}constructor(){super(),this._boundShow=this.show.bind(this),this._boundHide=this.hide.bind(this),this._boundOnKeyup=this._onKeyup.bind(this)}connectedCallback(){super.connectedCallback(),this._attachToTarget(),this._setDefaultId()}ready(){super.ready(),window.addEventListener("resize",(()=>{clearTimeout(this._resizeTimeout),this._resizeTimeout=setTimeout((()=>{const{targetElement:t,hidden:e,position:i}=this;this.hidden||this._setPosition(t,e,i)}),100)})),this.getAttribute("theme")||this.setAttribute("theme","dark")}disconnectedCallback(){super.disconnectedCallback(),this._detachFromTarget()}_manualObserver(){this.manual?this._removeEvents():this._addEvents()}_attachToTarget(t,e){e&&(this._removeTargetEvents(e),e.describedby&&(e.removeAttribute("aria-describedby"),delete e.describedby)),t&&(this._addEvents(),t.getAttribute("aria-describedby")||(t.setAttribute("aria-describedby",this.id),t.describedby=!0))}_addEvents(){this.targetElement&&!this.manual&&(this.targetElement.addEventListener("mouseenter",this._boundShow),this.targetElement.addEventListener("focus",this._boundShow),this.targetElement.addEventListener("mouseleave",this._boundHide),this.targetElement.addEventListener("blur",this._boundHide),this.targetElement.addEventListener("tap",this._boundHide)),this.manual||(this.addEventListener("mouseenter",this._boundShow),this.addEventListener("mouseleave",this._boundHide))}_detachFromTarget(){this.manual||this._removeEvents(),this.targetElement&&this.targetElement.describedby&&(this.targetElement.removeAttribute("aria-describedby"),delete this.targetElement.describedby)}_removeEvents(){this.targetElement&&this._removeTargetEvents(this.targetElement),this.removeEventListener("mouseenter",this._boundShow),this.removeEventListener("mouseleave",this._boundHide)}_removeTargetEvents(t){t.removeEventListener("mouseenter",this._boundShow),t.removeEventListener("focus",this._boundShow),t.removeEventListener("mouseleave",this._boundHide),t.removeEventListener("blur",this._boundHide),t.removeEventListener("tap",this._boundHide)}_updateTarget(){this.targetElement=this.parentNode.querySelector(`#${this.for}`)}_setPosition(t,e,i){if(t&&!e){let t=window.innerHeight,e=window.innerWidth;this.offsetParent&&(t=this.offsetParent.scrollHeight,e=this.offsetParent.scrollWidth);const s=this.targetElement.getBoundingClientRect(),a=this.getBoundingClientRect(),n=(s.width-a.width)/2,o=(s.height-a.height)/2;let r,l,d=s.left,c=s.top,u=window.pageYOffset;switch(this._parentPostioned&&(c=this.targetElement.offsetTop,d=this.targetElement.offsetLeft,u=0),i){case"top":l=c-a.height+u,r=this._calculateLeft(d,s,a,n);break;case"bottom":l=c+s.height+u,r=this._calculateLeft(d,s,a,n);break;case"left":r=d-a.width,l=this._calculateTop(c,s,a,o,u);break;case"right":r=d+s.width,l=this._calculateTop(c,s,a,o,u)}this._setPositionInVisibleBounds(t,e,r,l,a)}}get _parentPostioned(){return"static"!==window.getComputedStyle(this.offsetParent).position}_setPositionInVisibleBounds(t,e,i,s,a){i+a.width>e?(this.style.right="0px",this.style.left="auto"):(this.style.left=Math.max(0,i)+"px",this.style.right="auto"),s+a.height>t?(this.style.bottom=t+"px",this.style.top="auto"):(this.style.top=Math.max(0,s)+"px",this.style.bottom="auto")}_calculateLeft(t,e,i,s){switch(this.align){case"left":return t;case"right":return e.left+e.width-i.width;default:return t+s}}_calculateTop(t,e,i,s,a){switch(this.align){case"top":return t+a;case"bottom":return t+e.height-i.height+a;default:return t+s+a}}show(){this.hidden=!1}hide(){this.hidden=!0}_hiddenChanged(t){t?(this.setAttribute("aria-hidden",!0),window.removeEventListener("keyup",this._boundOnKeyup)):(this.setAttribute("aria-hidden",!1),window.addEventListener("keyup",this._boundOnKeyup))}_onKeyup(t){27===t.keyCode&&this.hide()}_setDefaultId(){this.id||(Vaadin.tooltipIndex||(Vaadin.tooltipIndex=0),this.id="vcf-tooltip"+ ++Vaadin.tooltipIndex)}}function $(t){return function*(t){const e=[];for(const i of t.settings.subscriptions.allowFrequencyModification)if(g(i.jsonataQuery).evaluate(t.subscription))for(const t of i.values)!e.includes(t)&&(e.push(t),yield t)}({settings:{subscriptions:{allowFrequencyModification:t.settings.subscriptions.allow_frequency_modification.map((t=>({jsonataQuery:t.jsonata_query,values:t.values})))}},subscription:t.subscription})}customElements.define(x.is,x),window.Vaadin.VcfTooltip=x;class w extends Error{constructor(t){super(`Invalid frequency "${t}".`)}}function S(t){const e=864e5,i=31*e;if(".5m"===t)return i/2;const s=parseInt(t.substring(0,t.length-1));if(isNaN(s))throw new w(t);if(t.endsWith("y"))return 31536e6*s;if(t.endsWith("m"))return s*i;if(t.endsWith("w"))return 6048e5*s;if(t.endsWith("d"))return s*e;throw new w(t)}function T(t,e){if("boolean"==typeof e)return e;const i=e.filter((e=>Boolean(g(e.jsonataQuery).evaluate(t)))).reduce(((t,e)=>{var i,s,a,n,o;if(e.min){const i=t.min?S(t.min):1/0;S(e.min)<i&&(t.min=e.min)}if(e.max){const i=t.max?S(t.max):-1/0;S(e.max)>i&&(t.max=e.max)}if("day"===(null===(i=e.allowedDays)||void 0===i?void 0:i.type)){const i=[...null!==(s=t.allowedDaysOfWeek)&&void 0!==s?s:[],...e.allowedDays.days];t.allowedDaysOfWeek=Array.from(new Set(i))}if("month"===(null===(a=e.allowedDays)||void 0===a?void 0:a.type)){const i=[...null!==(n=t.allowedDaysOfMonth)&&void 0!==n?n:[],...e.allowedDays.days];t.allowedDaysOfMonth=Array.from(new Set(i))}if(e.disallowedDates){const i=[...null!==(o=t.disallowedDates)&&void 0!==o?o:[],...e.disallowedDates];t.disallowedDates=Array.from(new Set(i))}return t}),{});return 0!==Object.keys(i).length&&i}function j(t){const[e,i,s]=t.split("-").map((t=>parseInt(t)));return new Date(e,i-1,s)}function E(t){const e=t.settings.subscriptions.allow_next_date_modification;let i;return i="boolean"==typeof e?e:e.map((t=>({allowedDays:t.allowed_days,disallowedDates:t.disallowed_dates,jsonataQuery:t.jsonata_query,max:t.max,min:t.min}))),function(t){var e,i;const s=j(t.value),a=s.getTime(),n=T(t.subscription,t.settings.subscriptions.allowNextDateModification);if("boolean"==typeof n)return n;if(!1===(null===(e=n.allowedDaysOfMonth)||void 0===e?void 0:e.includes(s.getDate())))return!1;if(!1===(null===(i=n.allowedDaysOfWeek)||void 0===i?void 0:i.includes(s.getDay())))return!1;if(n.disallowedDates&&n.disallowedDates.find((t=>{const[e,i]=t.split("..").map((t=>j(t).getTime()));return a===e||void 0!==i&&a>=e&&a<=i})))return!1;if(n.min){const t=b(n.min);if(null!==t&&Date.now()+t>=a)return!1}if(n.max){const t=b(n.max);if(null!==t&&Date.now()+t<=a)return!1}return!0}({settings:{subscriptions:{allowNextDateModification:i}},subscription:t.subscription,value:t.value})}let D,q,k,L,H,I,A,O,C,z,P,N,F,R,V,B,M,U=t=>t;const W=n(o(r(c,"subscription-form")));class K extends W{constructor(){super(...arguments),this.getTransactionPageHref=(t,e)=>null==e?void 0:e._links["fx:receipt"].href,this.customerAddresses=null,this.itemCategories=null,this.localeCodes=null,this.templates={},this.settings=null,this.coupons=null,this.__transactionTemplateLoaderId="transactionTemplateLoader",this.__defaultTemplateSetLoaderId="defaultTemplateSetLoader",this.__localeCodesHelperLoaderId="localeCodesLoader",this.__templateSetLoaderId="templateSetLoader",this.__storeLoaderId="storeLoader",this.__renderHeaderSubtitle=()=>{var t;const{data:e,lang:i,ns:s}=this;if(e){let a,n,o="text-secondary";if(e.first_failed_transaction_date)o="text-error",a=e.first_failed_transaction_date,n="subscription_failed";else if(e.end_date){a=e.end_date;n=new Date(a).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}else a=null!==(t=e.next_transaction_date)&&void 0!==t?t:(new Date).toISOString(),n="subscription_"+(e.is_active?"active":"inactive");const r=d(D||(D=U` <foxy-i18n data-testid="header-subtitle" options="${0}" class="${0}" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify({date:a}),o,i,n,s);return e.first_failed_transaction_date?d(q||(q=U` <span id="status" class="flex items-center space-x-xs ${0}"> ${0}<iron-icon icon="icons:info-outline" class="icon-inline"></iron-icon> </span> <vcf-tooltip for="status" position="bottom"> <span class="text-s">${0}</span> </vcf-tooltip> `),o,r,e.error_message):r}return d(k||(k=U`<x-skeleton class="w-full" variant="static">&nbsp;</x-skeleton>`))},this.__renderHeaderTitle=(t,e)=>{const{data:i,lang:s,ns:a}=this;if(i){const n=_(i.frequency),o=this.__transactionTemplate,r=null==o?void 0:o.total_order;return"string"!=typeof t?d(L||(L=U`--`)):d(H||(H=U` <foxy-i18n data-testid="header-title" options="${0}" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify(u(u({},n),{},{amount:`${r} ${t}`,currencyDisplay:e})),s,".5m"===i.frequency?"twice_a_month":"recurring",a)}return d(I||(I=U`<x-skeleton class="w-full" variant="static">&nbsp;</x-skeleton>`))},this.__renderHeader=(t,e)=>d(A||(A=U` <div data-testid="header" class="sm-col-span-2"> ${0} <div class="leading-xs text-xxl font-bold truncate"> ${0} </div> <div class="leading-xs text-l">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("header:before"),this.__renderHeaderTitle(t,e),this.__renderHeaderSubtitle(),this.renderTemplateOrSlot("header:after")),this.__renderItemsActions=()=>d(O||(O=U` <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 t;let e;try{const i=this.__transactionTemplate,s=new URL(null!==(t=null==i?void 0:i._links["fx:items"].href)&&void 0!==t?t:"");s.searchParams.set("zoom","item_options"),e=s.toString()}catch(t){e=void 0}return d(C||(C=U` <div data-testid="items" class="space-y-xs sm-col-span-2"> ${0} <foxy-internal-async-list-control first="${0}" limit="5" infer="items" item="foxy-item-card"> </foxy-internal-async-list-control> </div> `),this.hiddenSelector.matches("items:actions",!0)?"":this.__renderItemsActions(),v(e))},this.__renderEndDate=()=>{const{disabledSelector:t,lang:e,ns:i}=this,s=this.hiddenSelector.zoom("end-date:form").toString();return d(z||(z=U` <div class="sm-col-span-2"> ${0} <foxy-form-dialog readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="save-button ${0}" data-testid="cancellation-form" parent="${0}" header="end_subscription" alert form="foxy-cancellation-form" href="${0}" lang="${0}" id="end-date-form" ns="${0}" .templates="${0}"> </foxy-form-dialog> <vaadin-button data-testid="end-date" theme="error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n key="end_subscription" ns="${0}" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("end-date:before"),this.readonlySelector.zoom("end-date:form").toString(),t.zoom("end-date:form").toString(),s,this.parent,this.href,e,i,this.getNestedTemplates("end-date:form"),!this.data||t.matches("end-date",!0),(t=>{this.renderRoot.querySelector("#end-date-form").show(t.currentTarget)}),i,e,this.renderTemplateOrSlot("end-date:after"))},this.__checkNextTransactionDateAvailability=t=>{const{settings:e,data:i}=this;if(e&&i){return E({value:y(t),settings:e,subscription:i})}return t.getTime()>=Date.now()},this.__checkStartDateAvailability=t=>t.getTime()>=Date.now(),this.__renderStartDate=()=>{const{data:t,lang:e,ns:i}=this;return d(P||(P=U` <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"),i,e,v(null==t?void 0:t.start_date.substr(0,10)),v(null==t?void 0:t.start_date),e,!this.__isStartDateEditable,this.disabledSelector.matches("start-date",!0),this.__checkStartDateAvailability,(t=>{const e=t.target;this.edit({start_date:e.value})}),this.renderTemplateOrSlot("start-date:after"))},this.__renderNextTransactionDate=()=>{const{data:t,lang:e,ns:i}=this,s=!!(null==t?void 0:t.is_active);return d(N||(N=U` <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"),i,e,v(null==t?void 0:t.next_transaction_date.substr(0,10)),v(null==t?void 0:t.next_transaction_date),e,!s||this.readonlySelector.matches("next-transaction-date",!0),!t||this.disabledSelector.matches("next-transaction-date",!0),this.__checkNextTransactionDateAvailability,(t=>{const e=t.target;this.edit({next_transaction_date:e.value})}),this.renderTemplateOrSlot("next-transaction-date:after"))},this.__renderFrequencyAsDropdown=()=>{const{data:t}=this,e=!!(null==t?void 0:t.is_active),i=this.__frequencies.map((t=>({label:this.t(".5m"===t?"twice_a_month":"frequency",_(t)),value:t})));return d(F||(F=U` <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> `),!t||this.disabledSelector.matches("frequency",!0),t&&(!e||this.readonlySelector.matches("frequency",!0)),this.t("frequency_label").toString(),v(this.form.frequency),i,(t=>{this.edit({frequency:t.target.value})}))},this.__renderFrequencyAsRadioList=()=>{var t;const{data:e,lang:i,ns:s}=this;return d(R||(R=U` <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> `),s,i,s,null===this.settings,this.__frequencies,null!==(t=this.form.frequency)&&void 0!==t?t:null,!e||this.disabledSelector.matches("frequency",!0),e&&(!e.is_active||this.readonlySelector.matches("frequency",!0)),(t=>{this.edit({frequency:t.target.value})}),this.__frequencies.map((t=>d(V||(V=U` <foxy-i18n options="${0}" slot="${0}-label" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify(_(t)),t,i,".5m"===t?"twice_a_month":"frequency",s))))},this.__renderFrequency=()=>d(B||(B=U` <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"))}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-calendar":customElements.get("foxy-internal-calendar"),"foxy-collection-pages":customElements.get("foxy-collection-pages"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"foxy-form-dialog":customElements.get("foxy-form-dialog"),"vaadin-button":customElements.get("vaadin-button"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-nucleon":customElements.get("foxy-nucleon"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-table":customElements.get("foxy-table"),"foxy-i18n":customElements.get("foxy-i18n"),"iron-icon":customElements.get("iron-icon"),"x-skeleton":m,"x-choice":h,"x-group":f}}static get properties(){return u(u({},super.properties),{},{getTransactionPageHref:{attribute:!1},customerAddresses:{attribute:"customer-addresses"},itemCategories:{attribute:"item-categories"},localeCodes:{attribute:"locale-codes"},settings:{type:Object},coupons:{}})}get hiddenSelector(){return new p(`items:pagination:card:autorenew-icon ${super.hiddenSelector}`)}renderBody(){var t,e,i,s,a,n,o,r,l;let c;try{const i=new URL(null!==(e=null===(t=this.data)||void 0===t?void 0:t._links["fx:transactions"].href)&&void 0!==e?e:"");i.searchParams.set("order","transaction_date desc"),i.searchParams.set("zoom","items"),c=i.toString()}catch(t){c=void 0}const u=(null===(i=this.__store)||void 0===i?void 0:i.use_international_currency_symbol)?"code":"symbol",h=this.__transactionTemplate;let m=null;if(null==h?void 0:h.currency_code)m=h.currency_code;else{const t=this.__localeCodesHelper,e=null===(a=null!==(s=this.__templateSet)&&void 0!==s?s:this.__defaultTemplateSet)||void 0===a?void 0:a.locale_code,i=e?null==t?void 0:t.values[e]:void 0;i&&(m=null!==(o=null===(n=/Currency: ([A-Z]{3})/g.exec(i))||void 0===n?void 0:n[1])&&void 0!==o?o:null)}return d(M||(M=U` <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="relative grid grid-cols-1 sm-grid-cols-2 gap-l"> ${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> ${0} </div> `),v(this.__transactionTemplateHref),this.__transactionTemplateLoaderId,(()=>this.requestUpdate()),v(this.__defaultTemplateSetHref),this.__defaultTemplateSetLoaderId,(()=>this.requestUpdate()),v(this.__localeCodesHelperHref),this.__localeCodesHelperLoaderId,(()=>this.requestUpdate()),v(this.__templateSetHref),this.__templateSetLoaderId,(()=>this.requestUpdate()),v(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.hiddenSelector.matches("header",!0)?"":this.__renderHeader(null!=m?m:void 0,u),this.hiddenSelector.matches("items",!0)?"":this.__renderItems(),this.__isFrequencyVisible?this.__renderFrequency():"",this.__isStartDateVisible?this.__renderStartDate():"",this.__isNextTransactionDateVisible?this.__renderNextTransactionDate():"",v(null!=m?m:void 0),v(null===(l=null===(r=this.data)||void 0===r?void 0:r._links["fx:attributes"])||void 0===l?void 0:l.href),v(c),this.getTransactionPageHref,this.hiddenSelector.matches("end-date",!0)?"":this.__renderEndDate())}get __transactionTemplateHref(){const t=this.data;return(null==t?void 0:t._embedded["fx:transaction_template"])||null==t?void 0:t._links["fx:transaction_template"].href}get __defaultTemplateSetHref(){var t,e,i;if(""===(null===(t=this.__transactionTemplate)||void 0===t?void 0:t.template_set_uri))try{const t=new URL(null!==(i=null===(e=this.__store)||void 0===e?void 0:e._links["fx:template_sets"].href)&&void 0!==i?i:"");return t.searchParams.set("code","DEFAULT"),t.toString()}catch(t){}}get __localeCodesHelperHref(){var t;if(this.__defaultTemplateSetHref||this.__templateSetHref)return null!==(t=this.localeCodes)&&void 0!==t?t:void 0}get __templateSetHref(){const t=this.__transactionTemplate;if(!(null==t?void 0:t.currency_code))return(null==t?void 0:t.template_set_uri)||void 0}get __storeHref(){var t,e;return null===(e=null===(t=this.data)||void 0===t?void 0:t._links["fx:store"])||void 0===e?void 0:e.href}get __transactionTemplate(){var t,e;const i=this.data,s=null==i?void 0:i._embedded["fx:transaction_template"],a=`#${this.__transactionTemplateLoaderId}`;return null!==(e=null!=s?s:null===(t=this.renderRoot.querySelector(a))||void 0===t?void 0:t.data)&&void 0!==e?e:null}get __defaultTemplateSet(){var t,e;const i=`#${this.__defaultTemplateSetLoaderId}`,s=this.renderRoot.querySelector(i);return null!==(e=null===(t=null==s?void 0:s.data)||void 0===t?void 0:t._embedded["fx:template_sets"][0])&&void 0!==e?e:null}get __localeCodesHelper(){var t,e;const i=`#${this.__localeCodesHelperLoaderId}`;return null!==(e=null===(t=this.renderRoot.querySelector(i))||void 0===t?void 0:t.data)&&void 0!==e?e:null}get __templateSet(){var t,e;const i=`#${this.__templateSetLoaderId}`;return null!==(e=null===(t=this.renderRoot.querySelector(i))||void 0===t?void 0:t.data)&&void 0!==e?e:null}get __store(){var t,e;const i=`#${this.__storeLoaderId}`;return null!==(e=null===(t=this.renderRoot.querySelector(i))||void 0===t?void 0:t.data)&&void 0!==e?e: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 t=this.settings.subscriptions.allow_next_date_modification;return!!function(t,e){let i;return i="boolean"==typeof e?e:e.map((t=>({allowedDays:t.allowed_days,disallowedDates:t.disallowed_dates,jsonataQuery:t.jsonata_query,max:t.max,min:t.min}))),T(t,i)}(this.data,t)}get __isStartDateVisible(){return!this.hiddenSelector.matches("start-date",!0)&&this.__isNextTransactionDateVisible}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 __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!$({subscription:this.data,settings:this.settings}).next().done}get __frequencies(){if(!this.settings||!this.data)return[".5m","1m","1y"];const t=$({subscription:this.data,settings:this.settings});return Array.from(t)}}let Q;a("vcf-tooltip",l(Q||(Q=(t=>t)`
96
96
  :host([hidden]) [part='container']{
97
97
  display:none !important;
98
98
  }
@@ -1 +1 @@
1
- import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-7097364f.js";import{h as t}from"./shared-7f33a83a.js";import{C as e}from"./shared-67546e10.js";import{N as s}from"./shared-dc91f7ae.js";import{T as i,a as r}from"./shared-2cc638ad.js";import{c as a}from"./shared-4e709717.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-2092d86f.js";import"./shared-a8ced8bf.js";import"./shared-4f037e43.js";import"./shared-dcdb6ea1.js";import"./shared-d3bf9ac0.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";let n,o,d,c,l,m,h,p,u,f,v,y,_=t=>t;const $=i(e(r(s,"transaction-card")));class x extends ${constructor(){super(...arguments),this.templates={},this.__currencyDisplay=""}render(){var e,s;const i=this.hiddenSelector,r=!i.matches("total",!0),d=!i.matches("status",!0);return t(n||(n=_` <div aria-busy="${0}" aria-live="polite" class="relative leading-s font-lumo text-m"> <div class="${0}"> ${0} ${0} ${0} </div> <div class="${0}"> <foxy-spinner data-testid="spinner" state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.in("busy"),a({"transition-opacity":!0,"opacity-0":!this.data}),r||d?t(o||(o=_` <div class="flex items-center justify-between"> ${0} ${0} </div> `),r?this.__renderTotal():"",d?this.__renderStatus():""):"",i.matches("description",!0)?"":this.__renderDescription(),i.matches("customer",!0)?"":this.__renderCustomer(),a({"pointer-events-none absolute inset-0 flex transition-opacity":!0,"opacity-0":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(s=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==s?s:"")}async _sendGet(){const t=await super._sendGet(),e=await super._fetch(t._links["fx:store"].href);return this.__currencyDisplay=e.use_international_currency_symbol?"code":"symbol",t}__renderTotal(){const e=this.data;let s;if(e){const i=`${e.total_order} ${e.currency_code}`,r=this.__currencyDisplay;s=t(d||(d=_` <foxy-i18n options="${0}" lang="${0}" key="price" ns="${0}"> </foxy-i18n> `),JSON.stringify({amount:i,currencyDisplay:r}),this.lang,this.ns)}else s=t(c||(c=_`&ZeroWidthSpace;`));return t(l||(l=_` <div data-testid="total"> ${0} <div class="font-semibold truncate">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("total:before"),s,this.renderTemplateOrSlot("total:after"))}__renderStatus(){var e,s,i,r;const a=(null===(e=this.data)||void 0===e?void 0:e.status)||"completed";return t(m||(m=_` <div data-testid="status"> ${0} <div class="text-tertiary text-s flex items-center space-x-s"> <foxy-i18n options="${0}" lang="${0}" key="time" ns="${0}"> </foxy-i18n> <iron-icon data-testid="status-icon" class="icon-inline text-l ${0}" title="${0}" icon="${0}"> </iron-icon> </div> ${0} </div> `),this.renderTemplateOrSlot("status:before"),JSON.stringify({value:null===(s=this.data)||void 0===s?void 0:s.transaction_date}),this.lang,this.ns,null!==(i={completed:"text-success",rejected:"text-error",declined:"text-error"}[a])&&void 0!==i?i:"text-tertiary",this.t(`transaction_${a}`),null!==(r={completed:"icons:done-all",refunded:"icons:restore",rejected:"icons:highlight-off",declined:"icons:highlight-off",voided:"icons:remove-circle-outline"}[a])&&void 0!==r?r:"icons:schedule",this.renderTemplateOrSlot("status:after"))}__renderDescription(){var e,s;const i=null===(s=null===(e=this.data)||void 0===e?void 0:e._embedded)||void 0===s?void 0:s["fx:items"];let r;if(i){const e={most_expensive_item:[...i].sort(((t,e)=>t.price-e.price))[0],count_minus_one:i.length-1,count:i.length};r=t(h||(h=_` <foxy-i18n options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> `),JSON.stringify(e),this.lang,this.ns)}else r=t(p||(p=_`&ZeroWidthSpace;`));return t(u||(u=_` <div data-testid="description"> ${0} <div class="text-s text-secondary truncate">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("description:before"),r,this.renderTemplateOrSlot("description:after"))}__renderCustomer(){const e=this.data,s=e?t(f||(f=_`${0} ${0} (${0})`),e.customer_first_name,e.customer_last_name,e.customer_email):t(v||(v=_`&ZeroWidthSpace;`));return t(y||(y=_` <div data-testid="customer"> ${0} <div class="text-tertiary truncate text-s">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("customer:before"),s,this.renderTemplateOrSlot("customer:after"))}}customElements.define("foxy-transaction-card",x);export{x as TransactionCard};
1
+ import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-7097364f.js";import{h as t}from"./shared-7f33a83a.js";import{C as e}from"./shared-67546e10.js";import{N as s}from"./shared-dc91f7ae.js";import{T as i,a as r}from"./shared-2cc638ad.js";import{c as a}from"./shared-4e709717.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-2092d86f.js";import"./shared-a8ced8bf.js";import"./shared-4f037e43.js";import"./shared-dcdb6ea1.js";import"./shared-d3bf9ac0.js";import"./shared-955db6b4.js";import"./shared-d6276c83.js";import"./shared-e3ab56d1.js";let o,n,d,c,l,m,h,p,u,f,v,y,_=t=>t;const $=i(e(r(s,"transaction-card")));class x extends ${constructor(){super(...arguments),this.templates={},this.__currencyDisplay=""}render(){var e,s;const i=this.hiddenSelector,r=!i.matches("total",!0),d=!i.matches("status",!0);return t(o||(o=_` <div aria-busy="${0}" aria-live="polite" class="relative leading-s font-lumo text-m"> <div class="${0}"> ${0} ${0} ${0} </div> <div class="${0}"> <foxy-spinner data-testid="spinner" state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.in("busy"),a({"transition-opacity":!0,"opacity-0":!this.data}),r||d?t(n||(n=_` <div class="flex items-center justify-between"> ${0} ${0} </div> `),r?this.__renderTotal():"",d?this.__renderStatus():""):"",i.matches("description",!0)?"":this.__renderDescription(),i.matches("customer",!0)?"":this.__renderCustomer(),a({"pointer-events-none absolute inset-0 flex transition-opacity":!0,"opacity-0":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(s=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==s?s:"")}async _sendGet(){var t;const e=await super._sendGet(),s=null===(t=e._links["fx:store"])||void 0===t?void 0:t.href;if("string"==typeof s){const t=await super._fetch(s);this.__currencyDisplay=t.use_international_currency_symbol?"code":"symbol"}else this.__currencyDisplay="symbol";return e}__renderTotal(){const e=this.data;let s;if(e){const i=`${e.total_order} ${e.currency_code}`,r=this.__currencyDisplay;s=t(d||(d=_` <foxy-i18n options="${0}" lang="${0}" key="price" ns="${0}"> </foxy-i18n> `),JSON.stringify({amount:i,currencyDisplay:r}),this.lang,this.ns)}else s=t(c||(c=_`&ZeroWidthSpace;`));return t(l||(l=_` <div data-testid="total"> ${0} <div class="font-semibold truncate">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("total:before"),s,this.renderTemplateOrSlot("total:after"))}__renderStatus(){var e,s,i,r;const a=(null===(e=this.data)||void 0===e?void 0:e.status)||"completed";return t(m||(m=_` <div data-testid="status"> ${0} <div class="text-tertiary text-s flex items-center space-x-s"> <foxy-i18n options="${0}" lang="${0}" key="time" ns="${0}"> </foxy-i18n> <iron-icon data-testid="status-icon" class="icon-inline text-l ${0}" title="${0}" icon="${0}"> </iron-icon> </div> ${0} </div> `),this.renderTemplateOrSlot("status:before"),JSON.stringify({value:null===(s=this.data)||void 0===s?void 0:s.transaction_date}),this.lang,this.ns,null!==(i={completed:"text-success",rejected:"text-error",declined:"text-error"}[a])&&void 0!==i?i:"text-tertiary",this.t(`transaction_${a}`),null!==(r={completed:"icons:done-all",refunded:"icons:restore",rejected:"icons:highlight-off",declined:"icons:highlight-off",voided:"icons:remove-circle-outline"}[a])&&void 0!==r?r:"icons:schedule",this.renderTemplateOrSlot("status:after"))}__renderDescription(){var e,s;const i=null===(s=null===(e=this.data)||void 0===e?void 0:e._embedded)||void 0===s?void 0:s["fx:items"];let r;if(i){const e={most_expensive_item:[...i].sort(((t,e)=>t.price-e.price))[0],count_minus_one:i.length-1,count:i.length};r=t(h||(h=_` <foxy-i18n options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> `),JSON.stringify(e),this.lang,this.ns)}else r=t(p||(p=_`&ZeroWidthSpace;`));return t(u||(u=_` <div data-testid="description"> ${0} <div class="text-s text-secondary truncate">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("description:before"),r,this.renderTemplateOrSlot("description:after"))}__renderCustomer(){const e=this.data,s=e?t(f||(f=_`${0} ${0} (${0})`),e.customer_first_name,e.customer_last_name,e.customer_email):t(v||(v=_`&ZeroWidthSpace;`));return t(y||(y=_` <div data-testid="customer"> ${0} <div class="text-tertiary truncate text-s">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("customer:before"),s,this.renderTemplateOrSlot("customer:after"))}}customElements.define("foxy-transaction-card",x);export{x as TransactionCard};
@@ -142,6 +142,18 @@
142
142
  }
143
143
  },
144
144
  "subscription-form": {
145
+ "day": "Day",
146
+ "day_plural": "Days",
147
+ "week": "Week",
148
+ "week_plural": "Weeks",
149
+ "month": "Month",
150
+ "month_plural": "Months",
151
+ "year": "Year",
152
+ "year_plural": "Years",
153
+ "cancel": "Cancel",
154
+ "close": "Close",
155
+ "confirm": "Confirm",
156
+ "currency": "Currency",
145
157
  "daily": "Daily",
146
158
  "daily_plural": "Every {{count}} days",
147
159
  "end_subscription": "End subscription",
@@ -162,23 +174,70 @@
162
174
  "twice_a_month": "Twice a month",
163
175
  "update_billing": "Update billing",
164
176
  "update_items": "Edit",
177
+ "undo_cancel": "Review",
178
+ "undo_confirm": "Discard",
179
+ "undo_header": "Unsaved changes",
180
+ "undo_message": "Looks like you didn't save your changes! What would you like to do with them?",
165
181
  "weekly": "Weekly",
166
182
  "weekly_plural": "Every {{count}} weeks",
167
183
  "yearly": "Yearly",
168
184
  "yearly_plural": "Every {{count}} years",
185
+ "items": {
186
+ "pagination": {
187
+ "first": "First",
188
+ "last": "Last",
189
+ "next": "Next",
190
+ "pagination": "{{from}}-{{to}} out of {{total}}",
191
+ "previous": "Previous",
192
+ "card": {
193
+ "price": "{{amount, price}}",
194
+ "wgt": "WGT",
195
+ "spinner": {
196
+ "loading_busy": "Loading",
197
+ "loading_empty": "No items",
198
+ "loading_error": "Failed to load"
199
+ }
200
+ }
201
+ }
202
+ },
203
+ "transactions": {
204
+ "label": "Transactions",
205
+ "pagination": {
206
+ "first": "First",
207
+ "last": "Last",
208
+ "next": "Next",
209
+ "pagination": "{{from}}-{{to}} out of {{total}}",
210
+ "previous": "Previous",
211
+ "card": {
212
+ "code": "Code",
213
+ "customer": "Customer",
214
+ "description": "Description",
215
+ "price": "{{amount, price}}",
216
+ "time": "{{value, date}}",
217
+ "transaction_approved": "Approved",
218
+ "transaction_authorized": "Authorized",
219
+ "transaction_captured": "Captured",
220
+ "transaction_completed": "Completed",
221
+ "transaction_declined": "Declined",
222
+ "transaction_pending": "Pending",
223
+ "transaction_plural": "Transactions",
224
+ "transaction_refunded": "Refunded",
225
+ "transaction_rejected": "Rejected",
226
+ "transaction_summary": "{{most_expensive_item.name}}",
227
+ "transaction_summary_plural": "{{most_expensive_item.name}} and {{count_minus_one}} more",
228
+ "transaction_verified": "Verified",
229
+ "transaction_voided": "Voided",
230
+ "spinner": {
231
+ "loading_busy": "Loading",
232
+ "loading_empty": "No transactions",
233
+ "loading_error": "Failed to load"
234
+ }
235
+ }
236
+ }
237
+ },
169
238
  "spinner": {
170
239
  "loading_busy": "Loading",
171
240
  "loading_error": "Failed to load"
172
- },
173
- "transactions-table": {
174
- "date": "{{value, date}}",
175
- "price": "{{amount, price}}",
176
- "receipt": "Receipt",
177
- "spinner": {
178
- "loading_busy": "Loading",
179
- "loading_empty": "No transactions",
180
- "loading_error": "Failed to load"
181
- }
182
241
  }
183
242
  },
184
243
  "transactions-table": {
@@ -409,7 +409,7 @@ export class SubscriptionForm extends Base {
409
409
  return new BooleanSelector(`items:pagination:card:autorenew-icon ${super.hiddenSelector}`);
410
410
  }
411
411
  renderBody() {
412
- var _a, _b, _c, _d, _e, _f, _g, _h;
412
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
413
413
  let transactionsHref;
414
414
  try {
415
415
  const url = new URL((_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a._links['fx:transactions'].href) !== null && _b !== void 0 ? _b : '');
@@ -417,7 +417,7 @@ export class SubscriptionForm extends Base {
417
417
  url.searchParams.set('zoom', 'items');
418
418
  transactionsHref = url.toString();
419
419
  }
420
- catch (_j) {
420
+ catch (_k) {
421
421
  transactionsHref = undefined;
422
422
  }
423
423
  const currencyDisplay = ((_c = this.__store) === null || _c === void 0 ? void 0 : _c.use_international_currency_symbol) ? 'code' : 'symbol';
@@ -497,7 +497,7 @@ export class SubscriptionForm extends Base {
497
497
  </foxy-internal-number-control>
498
498
 
499
499
  <foxy-internal-async-list-control
500
- first=${ifDefined((_h = this.data) === null || _h === void 0 ? void 0 : _h._links['fx:attributes'].href)}
500
+ first=${ifDefined((_j = (_h = this.data) === null || _h === void 0 ? void 0 : _h._links['fx:attributes']) === null || _j === void 0 ? void 0 : _j.href)}
501
501
  class="sm-col-span-2"
502
502
  infer="attributes"
503
503
  limit="5"
@@ -525,8 +525,9 @@ export class SubscriptionForm extends Base {
525
525
  `;
526
526
  }
527
527
  get __transactionTemplateHref() {
528
- var _a;
529
- return (_a = this.data) === null || _a === void 0 ? void 0 : _a._links['fx:transaction_template'].href;
528
+ const data = this.data;
529
+ const embed = data === null || data === void 0 ? void 0 : data._embedded['fx:transaction_template'];
530
+ return embed ? void 0 : data === null || data === void 0 ? void 0 : data._links['fx:transaction_template'].href;
530
531
  }
531
532
  get __defaultTemplateSetHref() {
532
533
  var _a, _b, _c;
@@ -559,8 +560,10 @@ export class SubscriptionForm extends Base {
559
560
  }
560
561
  get __transactionTemplate() {
561
562
  var _a, _b;
563
+ const data = this.data;
564
+ const embed = data === null || data === void 0 ? void 0 : data._embedded['fx:transaction_template'];
562
565
  const selector = `#${this.__transactionTemplateLoaderId}`;
563
- return (_b = (_a = this.renderRoot.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.data) !== null && _b !== void 0 ? _b : null;
566
+ return (_b = embed !== null && embed !== void 0 ? embed : (_a = this.renderRoot.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.data) !== null && _b !== void 0 ? _b : null;
564
567
  }
565
568
  get __defaultTemplateSet() {
566
569
  var _a, _b;
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionForm.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionForm/SubscriptionForm.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,+BAA4B;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAY,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAChE,OAAO,EAAE,aAAa,EAAE,yCAAsC;AAC9D,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EACL,iCAAiC,EACjC,qBAAqB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,GAAG,qBAAqB,CAAC;YAC/C,YAAY,EAAE,IAAI,CAAC,IAAI;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;SACxB,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import type { Data, Settings, Templates, TransactionPageGetter } from './types';\nimport type { PropertyDeclarations } from 'lit-element';\nimport type { ScopedElementsMap } from '@open-wc/scoped-elements';\nimport type { InternalCalendar } from '../../internal/InternalCalendar';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { ButtonElement } from '@vaadin/vaadin-button';\nimport type { FormDialog } from '../FormDialog';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { Choice, Group, Skeleton } from '../../private/index';\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector, Resource } from '@foxy.io/sdk/core';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { parseFrequency } from '../../../utils/parse-frequency';\nimport { serializeDate } from '../../../utils/serialize-date';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nimport {\n getNextTransactionDateConstraints,\n getAllowedFrequencies,\n isNextTransactionDate,\n} from '@foxy.io/sdk/customer';\n\nconst NS = 'subscription-form';\nconst Base = ScopedElementsMixin(ResponsiveMixin(TranslatableMixin(InternalForm, NS)));\n\n/**\n * Form element for creating or editing subscriptions.\n *\n * @slot header:before - **new in v1.4.0**\n * @slot header:after - **new in v1.4.0**\n *\n * @slot items:before - **new in v1.4.0**\n * @slot items:after - **new in v1.4.0**\n * @slot items:actions:before - **new in v1.4.0**\n * @slot items:actions:after - **new in v1.4.0**\n *\n * @slot end-date:before - **new in v1.4.0**\n * @slot end-date:after - **new in v1.4.0**\n *\n * @slot next-transaction-date:before - **new in v1.4.0**\n * @slot next-transaction-date:after - **new in v1.4.0**\n *\n * @slot frequency:before - **new in v1.4.0**\n * @slot frequency:after - **new in v1.4.0**\n *\n * @slot transactions:before - **new in v1.4.0**\n * @slot transactions:after - **new in v1.4.0**\n *\n * @slot attributes:before - **new in v1.20.0**\n * @slot attributes:after - **new in v1.20.0**\n *\n * @slot timestamps:before - **new in v1.20.0**\n * @slot timestamps:after - **new in v1.20.0**\n *\n * @slot past-due-amount:before - **new in v1.20.0**\n * @slot past-due-amount:after - **new in v1.20.0**\n *\n * @slot start-date:before - **new in v1.20.0**\n * @slot start-date:after - **new in v1.20.0**\n *\n * @element foxy-subscription-form\n * @since 1.2.0\n */\nexport class SubscriptionForm extends Base<Data> {\n static get scopedElements(): ScopedElementsMap {\n return {\n 'foxy-internal-timestamps-control': customElements.get('foxy-internal-timestamps-control'),\n 'foxy-internal-async-list-control': customElements.get('foxy-internal-async-list-control'),\n 'foxy-internal-number-control': customElements.get('foxy-internal-number-control'),\n 'foxy-internal-calendar': customElements.get('foxy-internal-calendar'),\n 'foxy-collection-pages': customElements.get('foxy-collection-pages'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'vaadin-combo-box': customElements.get('vaadin-combo-box'),\n 'foxy-form-dialog': customElements.get('foxy-form-dialog'),\n 'vaadin-button': customElements.get('vaadin-button'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-nucleon': customElements.get('foxy-nucleon'),\n 'vcf-tooltip': customElements.get('vcf-tooltip'),\n 'foxy-table': customElements.get('foxy-table'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'iron-icon': customElements.get('iron-icon'),\n 'x-skeleton': Skeleton,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getTransactionPageHref: { attribute: false },\n customerAddresses: { attribute: 'customer-addresses' },\n itemCategories: { attribute: 'item-categories' },\n localeCodes: { attribute: 'locale-codes' },\n settings: { type: Object },\n coupons: {},\n };\n }\n\n getTransactionPageHref: TransactionPageGetter = (_, data: any) => {\n return data?._links['fx:receipt'].href;\n };\n\n customerAddresses: string | null = null;\n\n itemCategories: string | null = null;\n\n localeCodes: string | null = null;\n\n templates: Templates = {};\n\n settings: Settings | null = null;\n\n coupons: string | null = null;\n\n private readonly __transactionTemplateLoaderId = 'transactionTemplateLoader';\n\n private readonly __defaultTemplateSetLoaderId = 'defaultTemplateSetLoader';\n\n private readonly __localeCodesHelperLoaderId = 'localeCodesLoader';\n\n private readonly __templateSetLoaderId = 'templateSetLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\n\n private readonly __renderHeaderSubtitle = () => {\n const { data, lang, ns } = this;\n\n if (data) {\n let color = 'text-secondary';\n let date: string;\n let key: string;\n\n if (data.first_failed_transaction_date) {\n color = 'text-error';\n date = data.first_failed_transaction_date;\n key = 'subscription_failed';\n } else if (data.end_date) {\n date = data.end_date;\n const hasEnded = new Date(date).getTime() > Date.now();\n key = hasEnded ? 'subscription_will_be_cancelled' : 'subscription_cancelled';\n } else {\n date = data.next_transaction_date ?? new Date().toISOString();\n key = `subscription_${data.is_active ? 'active' : 'inactive'}`;\n }\n\n const text = html`\n <foxy-i18n\n data-testid=\"header-subtitle\"\n options=${JSON.stringify({ date })}\n class=${color}\n lang=${lang}\n key=${key}\n ns=${ns}\n >\n </foxy-i18n>\n `;\n\n if (data.first_failed_transaction_date) {\n return html`\n <span id=\"status\" class=\"flex items-center space-x-xs ${color}\">\n ${text}<iron-icon icon=\"icons:info-outline\" class=\"icon-inline\"></iron-icon>\n </span>\n <vcf-tooltip for=\"status\" position=\"bottom\">\n <span class=\"text-s\">${data.error_message}</span>\n </vcf-tooltip>\n `;\n }\n\n return text;\n }\n\n return html`<x-skeleton class=\"w-full\" variant=\"static\">&nbsp;</x-skeleton>`;\n };\n\n private readonly __renderHeaderTitle = (\n currency: string | undefined,\n currencyDisplay: string | undefined\n ) => {\n const { data, lang, ns } = this;\n\n if (data) {\n const frequency = parseFrequency(data.frequency);\n const transactionTemplate = this.__transactionTemplate;\n const total = transactionTemplate?.total_order;\n\n if (typeof currency !== 'string') return html`--`;\n\n return html`\n <foxy-i18n\n data-testid=\"header-title\"\n options=${JSON.stringify({\n ...frequency,\n amount: `${total} ${currency}`,\n currencyDisplay,\n })}\n lang=${lang}\n key=\"price_${data.frequency === '.5m' ? 'twice_a_month' : 'recurring'}\"\n ns=${ns}\n >\n </foxy-i18n>\n `;\n }\n\n return html`<x-skeleton class=\"w-full\" variant=\"static\">&nbsp;</x-skeleton>`;\n };\n\n private readonly __renderHeader = (\n currencyCode: string | undefined,\n currencyDisplay: string | undefined\n ) => {\n return html`\n <div data-testid=\"header\" class=\"sm-col-span-2\">\n ${this.renderTemplateOrSlot('header:before')}\n <div class=\"leading-xs text-xxl font-bold truncate\">\n ${this.__renderHeaderTitle(currencyCode, currencyDisplay)}\n </div>\n <div class=\"leading-xs text-l\">${this.__renderHeaderSubtitle()}</div>\n ${this.renderTemplateOrSlot('header:after')}\n </div>\n `;\n };\n\n private readonly __renderItemsActions = () => {\n return html`\n <div class=\"flex\" data-testid=\"items:actions\">\n ${this.renderTemplateOrSlot('items:actions:before')}\n\n <foxy-i18n\n data-testid=\"items:actions-label\"\n class=\"flex-1 text-s font-medium text-secondary\"\n lang=${this.lang}\n key=\"item_plural\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('items:actions:after')}\n </div>\n `;\n };\n\n private readonly __renderItems = () => {\n let itemsHref: string | undefined;\n\n try {\n const cart = this.__transactionTemplate;\n const url = new URL(cart?._links['fx:items'].href ?? '');\n url.searchParams.set('zoom', 'item_options');\n itemsHref = url.toString();\n } catch {\n itemsHref = undefined;\n }\n\n return html`\n <div data-testid=\"items\" class=\"space-y-xs sm-col-span-2\">\n ${this.hiddenSelector.matches('items:actions', true) ? '' : this.__renderItemsActions()}\n\n <foxy-internal-async-list-control\n first=${ifDefined(itemsHref)}\n limit=\"5\"\n infer=\"items\"\n item=\"foxy-item-card\"\n >\n </foxy-internal-async-list-control>\n </div>\n `;\n };\n\n private readonly __renderEndDate = () => {\n const { disabledSelector, lang, ns } = this;\n const formHiddenSelector = this.hiddenSelector.zoom('end-date:form').toString();\n\n return html`\n <div class=\"sm-col-span-2\">\n ${this.renderTemplateOrSlot('end-date:before')}\n\n <foxy-form-dialog\n readonlycontrols=${this.readonlySelector.zoom('end-date:form').toString()}\n disabledcontrols=${disabledSelector.zoom('end-date:form').toString()}\n hiddencontrols=\"save-button ${formHiddenSelector}\"\n data-testid=\"cancellation-form\"\n parent=${this.parent}\n header=\"end_subscription\"\n alert\n form=\"foxy-cancellation-form\"\n href=${this.href}\n lang=${lang}\n id=\"end-date-form\"\n ns=${ns}\n .templates=${this.getNestedTemplates('end-date:form')}\n >\n </foxy-form-dialog>\n\n <vaadin-button\n data-testid=\"end-date\"\n theme=\"error\"\n class=\"w-full\"\n ?disabled=${!this.data || disabledSelector.matches('end-date', true)}\n @click=${(evt: Event) => {\n const form = this.renderRoot.querySelector('#end-date-form') as FormDialog;\n form.show(evt.currentTarget as ButtonElement);\n }}\n >\n <foxy-i18n key=\"end_subscription\" ns=${ns} lang=${lang}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('end-date:after')}\n </div>\n `;\n };\n\n private readonly __checkNextTransactionDateAvailability = (date: Date) => {\n const { settings, data: subscription } = this;\n\n if (settings && subscription) {\n const value = serializeDate(date);\n return isNextTransactionDate({ value, settings, subscription });\n }\n\n return date.getTime() >= Date.now();\n };\n\n private readonly __checkStartDateAvailability = (date: Date) => {\n return date.getTime() >= Date.now();\n };\n\n private readonly __renderStartDate = () => {\n const { data, lang, ns } = this;\n\n return html`\n <div data-testid=\"start-date\">\n ${this.renderTemplateOrSlot('start-date:before')}\n\n <x-group frame>\n <foxy-i18n key=\"start_date\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n <foxy-internal-calendar\n start=${ifDefined(data?.start_date.substr(0, 10))}\n value=${ifDefined(data?.start_date)}\n lang=${lang}\n ?readonly=${!this.__isStartDateEditable}\n ?disabled=${this.disabledSelector.matches('start-date', true)}\n .checkAvailability=${this.__checkStartDateAvailability}\n @change=${(evt: Event) => {\n const target = evt.target as InternalCalendar;\n this.edit({ start_date: target.value });\n }}\n >\n </foxy-internal-calendar>\n </x-group>\n\n ${this.renderTemplateOrSlot('start-date:after')}\n </div>\n `;\n };\n\n private readonly __renderNextTransactionDate = () => {\n const { data, lang, ns } = this;\n const isActive = !!data?.is_active;\n\n return html`\n <div data-testid=\"next-transaction-date\">\n ${this.renderTemplateOrSlot('next-transaction-date:before')}\n\n <x-group frame>\n <foxy-i18n key=\"next_transaction_date\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n <foxy-internal-calendar\n start=${ifDefined(data?.next_transaction_date.substr(0, 10))}\n value=${ifDefined(data?.next_transaction_date)}\n lang=${lang}\n ?readonly=${!isActive || this.readonlySelector.matches('next-transaction-date', true)}\n ?disabled=${!data || this.disabledSelector.matches('next-transaction-date', true)}\n .checkAvailability=${this.__checkNextTransactionDateAvailability}\n @change=${(evt: Event) => {\n const target = evt.target as InternalCalendar;\n this.edit({ next_transaction_date: target.value });\n }}\n >\n </foxy-internal-calendar>\n </x-group>\n\n ${this.renderTemplateOrSlot('next-transaction-date:after')}\n </div>\n `;\n };\n\n private readonly __renderFrequencyAsDropdown = () => {\n const { data } = this;\n const active = !!data?.is_active;\n const items = this.__frequencies.map(v => ({\n label: this.t(v === '.5m' ? 'twice_a_month' : 'frequency', parseFrequency(v)),\n value: v,\n }));\n\n return html`\n <vaadin-combo-box\n item-value-path=\"value\"\n item-label-path=\"label\"\n data-testid=\"frequency\"\n ?disabled=${!data || this.disabledSelector.matches('frequency', true)}\n ?readonly=${data && (!active || this.readonlySelector.matches('frequency', true))}\n class=\"w-full\"\n label=${this.t('frequency_label').toString()}\n value=${ifDefined(this.form.frequency)}\n .items=${items}\n @change=${(evt: Event) => {\n this.edit({ frequency: (evt.target as HTMLInputElement).value });\n }}\n >\n </vaadin-combo-box>\n `;\n };\n\n private readonly __renderFrequencyAsRadioList = () => {\n const { data, lang, ns } = this;\n\n return html`\n <x-group frame>\n <foxy-i18n key=\"frequency_label\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n\n <x-choice\n default-custom-value=\"1d\"\n data-testid=\"frequency\"\n type=\"frequency\"\n ns=${ns}\n ?custom=${this.settings === null}\n .items=${this.__frequencies}\n .value=${this.form.frequency ?? null}\n ?disabled=${!data || this.disabledSelector.matches('frequency', true)}\n ?readonly=${data && (!data.is_active || this.readonlySelector.matches('frequency', true))}\n @change=${(evt: Event) => {\n this.edit({ frequency: (evt.target as HTMLInputElement).value });\n }}\n >\n ${this.__frequencies.map(\n frequency => html`\n <foxy-i18n\n options=${JSON.stringify(parseFrequency(frequency))}\n slot=\"${frequency}-label\"\n lang=${lang}\n key=${frequency === '.5m' ? 'twice_a_month' : 'frequency'}\n ns=${ns}\n >\n </foxy-i18n>\n `\n )}\n </x-choice>\n </x-group>\n `;\n };\n\n private readonly __renderFrequency = () => {\n return html`\n <div class=\"sm-col-span-2\">\n ${this.renderTemplateOrSlot('frequency:before')}\n ${this.settings && this.__frequencies.length > 4\n ? this.__renderFrequencyAsDropdown()\n : this.__renderFrequencyAsRadioList()}\n ${this.renderTemplateOrSlot('frequency:after')}\n </div>\n `;\n };\n\n get hiddenSelector(): BooleanSelector {\n return new BooleanSelector(`items:pagination:card:autorenew-icon ${super.hiddenSelector}`);\n }\n\n renderBody(): TemplateResult {\n let transactionsHref: string | undefined;\n\n try {\n const url = new URL(this.data?._links['fx:transactions'].href ?? '');\n url.searchParams.set('order', 'transaction_date desc');\n url.searchParams.set('zoom', 'items');\n transactionsHref = url.toString();\n } catch {\n transactionsHref = undefined;\n }\n\n const currencyDisplay = this.__store?.use_international_currency_symbol ? 'code' : 'symbol';\n const cart = this.__transactionTemplate;\n\n let currencyCode: string | null = null;\n\n if (cart?.currency_code) {\n currencyCode = cart.currency_code;\n } else {\n const allLocaleCodes = this.__localeCodesHelper;\n const localeCode = (this.__templateSet ?? this.__defaultTemplateSet)?.locale_code;\n const localeInfo = localeCode ? allLocaleCodes?.values[localeCode] : void 0;\n\n if (localeInfo) currencyCode = /Currency: ([A-Z]{3})/g.exec(localeInfo)?.[1] ?? null;\n }\n\n return html`\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__transactionTemplateHref)}\n id=${this.__transactionTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__defaultTemplateSetHref)}\n id=${this.__defaultTemplateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__localeCodesHelperHref)}\n id=${this.__localeCodesHelperLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__templateSetHref)}\n id=${this.__templateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__storeHref)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <div class=\"relative grid grid-cols-1 sm-grid-cols-2 gap-l\">\n ${this.hiddenSelector.matches('header', true)\n ? ''\n : this.__renderHeader(currencyCode ?? void 0, currencyDisplay)}\n ${this.hiddenSelector.matches('items', true) ? '' : this.__renderItems()}\n ${this.__isFrequencyVisible ? this.__renderFrequency() : ''}\n ${this.__isStartDateVisible ? this.__renderStartDate() : ''}\n ${this.__isNextTransactionDateVisible ? this.__renderNextTransactionDate() : ''}\n\n <foxy-internal-number-control\n suffix=${ifDefined(currencyCode ?? void 0)}\n infer=\"past-due-amount\"\n class=\"sm-col-span-2\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(this.data?._links['fx:attributes'].href)}\n class=\"sm-col-span-2\"\n infer=\"attributes\"\n limit=\"5\"\n form=\"foxy-attribute-form\"\n item=\"foxy-attribute-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(transactionsHref)}\n class=\"sm-col-span-2\"\n infer=\"transactions\"\n limit=\"5\"\n item=\"foxy-transaction-card\"\n hide-delete-button\n .getPageHref=${this.getTransactionPageHref}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-timestamps-control infer=\"timestamps\" class=\"sm-col-span-2\">\n </foxy-internal-timestamps-control>\n\n ${this.hiddenSelector.matches('end-date', true) ? '' : this.__renderEndDate()}\n </div>\n `;\n }\n\n private get __transactionTemplateHref() {\n return this.data?._links['fx:transaction_template'].href;\n }\n\n private get __defaultTemplateSetHref() {\n const templateSetUri = this.__transactionTemplate?.template_set_uri;\n\n if (templateSetUri === '') {\n try {\n const url = new URL(this.__store?._links['fx:template_sets'].href ?? '');\n url.searchParams.set('code', 'DEFAULT');\n return url.toString();\n } catch {\n //\n }\n }\n }\n\n private get __localeCodesHelperHref() {\n if (this.__defaultTemplateSetHref || this.__templateSetHref) {\n return this.localeCodes ?? void 0;\n }\n }\n\n private get __templateSetHref() {\n const cart = this.__transactionTemplate;\n if (!cart?.currency_code) return cart?.template_set_uri || void 0;\n }\n\n private get __storeHref() {\n return this.data?._links['fx:store']?.href;\n }\n\n private get __transactionTemplate() {\n type Loader = NucleonElement<Resource<Rels.TransactionTemplate>>;\n const selector = `#${this.__transactionTemplateLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __defaultTemplateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSets>>;\n const selector = `#${this.__defaultTemplateSetLoaderId}`;\n const loader = this.renderRoot.querySelector<Loader>(selector);\n return loader?.data?._embedded['fx:template_sets'][0] ?? null;\n }\n\n private get __localeCodesHelper() {\n type Loader = NucleonElement<Resource<Rels.LocaleCodes>>;\n const selector = `#${this.__localeCodesHelperLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __templateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSet>>;\n const selector = `#${this.__templateSetLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __store() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n const selector = `#${this.__storeLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __isNextTransactionDateVisible() {\n if (this.hiddenSelector.matches('next-transaction-date', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date).getTime() <= Date.now()) return false;\n if (this.data.is_active === false) return false;\n if (this.settings === null) return true;\n\n const rules = this.settings.subscriptions.allow_next_date_modification;\n return !!getNextTransactionDateConstraints(this.data, rules);\n }\n\n private get __isStartDateVisible() {\n if (this.hiddenSelector.matches('start-date', true)) return false;\n return this.__isNextTransactionDateVisible;\n }\n\n private get __isStartDateEditable() {\n if (this.readonlySelector.matches('start-date', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date) <= new Date()) return false;\n if (this.data.is_active === false) return false;\n if (this.data.start_date && new Date(this.data.start_date) <= new Date()) return false;\n\n return this.settings === null;\n }\n\n private get __isFrequencyVisible() {\n if (this.hiddenSelector.matches('frequency', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date).getTime() <= Date.now()) return false;\n if (this.data.is_active === false) return false;\n if (this.settings === null) return true;\n\n const allowedFrequencies = getAllowedFrequencies({\n subscription: this.data,\n settings: this.settings,\n });\n\n return !allowedFrequencies.next().done;\n }\n\n private get __frequencies() {\n if (!this.settings || !this.data) return ['.5m', '1m', '1y'];\n\n const allowedFrequencies = getAllowedFrequencies({\n subscription: this.data,\n settings: this.settings,\n });\n\n return Array.from(allowedFrequencies);\n }\n}\n"]}
1
+ {"version":3,"file":"SubscriptionForm.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionForm/SubscriptionForm.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,+BAA4B;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAY,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAChE,OAAO,EAAE,aAAa,EAAE,yCAAsC;AAC9D,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EACL,iCAAiC,EACjC,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,EAAE,GAAG,mBAAmB,CAAC;AAC/B,MAAM,IAAI,GAAG,mBAAmB,CAAC,eAAe,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEvF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,OAAO,gBAAiB,SAAQ,IAAU;IAAhD;;QAoCE,2BAAsB,GAA0B,CAAC,CAAC,EAAE,IAAS,EAAE,EAAE;YAC/D,OAAO,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC;QACzC,CAAC,CAAC;QAEF,sBAAiB,GAAkB,IAAI,CAAC;QAExC,mBAAc,GAAkB,IAAI,CAAC;QAErC,gBAAW,GAAkB,IAAI,CAAC;QAElC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CAAC;IACxC,CAAC;CACF","sourcesContent":["import type { Data, Settings, Templates, TransactionPageGetter } from './types';\nimport type { PropertyDeclarations } from 'lit-element';\nimport type { ScopedElementsMap } from '@open-wc/scoped-elements';\nimport type { InternalCalendar } from '../../internal/InternalCalendar';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { ButtonElement } from '@vaadin/vaadin-button';\nimport type { FormDialog } from '../FormDialog';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { Choice, Group, Skeleton } from '../../private/index';\nimport { ScopedElementsMixin } from '@open-wc/scoped-elements';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector, Resource } from '@foxy.io/sdk/core';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { parseFrequency } from '../../../utils/parse-frequency';\nimport { serializeDate } from '../../../utils/serialize-date';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nimport {\n getNextTransactionDateConstraints,\n getAllowedFrequencies,\n isNextTransactionDate,\n} from '@foxy.io/sdk/customer';\n\nconst NS = 'subscription-form';\nconst Base = ScopedElementsMixin(ResponsiveMixin(TranslatableMixin(InternalForm, NS)));\n\n/**\n * Form element for creating or editing subscriptions.\n *\n * @slot header:before - **new in v1.4.0**\n * @slot header:after - **new in v1.4.0**\n *\n * @slot items:before - **new in v1.4.0**\n * @slot items:after - **new in v1.4.0**\n * @slot items:actions:before - **new in v1.4.0**\n * @slot items:actions:after - **new in v1.4.0**\n *\n * @slot end-date:before - **new in v1.4.0**\n * @slot end-date:after - **new in v1.4.0**\n *\n * @slot next-transaction-date:before - **new in v1.4.0**\n * @slot next-transaction-date:after - **new in v1.4.0**\n *\n * @slot frequency:before - **new in v1.4.0**\n * @slot frequency:after - **new in v1.4.0**\n *\n * @slot transactions:before - **new in v1.4.0**\n * @slot transactions:after - **new in v1.4.0**\n *\n * @slot attributes:before - **new in v1.20.0**\n * @slot attributes:after - **new in v1.20.0**\n *\n * @slot timestamps:before - **new in v1.20.0**\n * @slot timestamps:after - **new in v1.20.0**\n *\n * @slot past-due-amount:before - **new in v1.20.0**\n * @slot past-due-amount:after - **new in v1.20.0**\n *\n * @slot start-date:before - **new in v1.20.0**\n * @slot start-date:after - **new in v1.20.0**\n *\n * @element foxy-subscription-form\n * @since 1.2.0\n */\nexport class SubscriptionForm extends Base<Data> {\n static get scopedElements(): ScopedElementsMap {\n return {\n 'foxy-internal-timestamps-control': customElements.get('foxy-internal-timestamps-control'),\n 'foxy-internal-async-list-control': customElements.get('foxy-internal-async-list-control'),\n 'foxy-internal-number-control': customElements.get('foxy-internal-number-control'),\n 'foxy-internal-calendar': customElements.get('foxy-internal-calendar'),\n 'foxy-collection-pages': customElements.get('foxy-collection-pages'),\n 'foxy-internal-sandbox': customElements.get('foxy-internal-sandbox'),\n 'vaadin-combo-box': customElements.get('vaadin-combo-box'),\n 'foxy-form-dialog': customElements.get('foxy-form-dialog'),\n 'vaadin-button': customElements.get('vaadin-button'),\n 'foxy-spinner': customElements.get('foxy-spinner'),\n 'foxy-nucleon': customElements.get('foxy-nucleon'),\n 'vcf-tooltip': customElements.get('vcf-tooltip'),\n 'foxy-table': customElements.get('foxy-table'),\n 'foxy-i18n': customElements.get('foxy-i18n'),\n 'iron-icon': customElements.get('iron-icon'),\n 'x-skeleton': Skeleton,\n 'x-choice': Choice,\n 'x-group': Group,\n };\n }\n\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n getTransactionPageHref: { attribute: false },\n customerAddresses: { attribute: 'customer-addresses' },\n itemCategories: { attribute: 'item-categories' },\n localeCodes: { attribute: 'locale-codes' },\n settings: { type: Object },\n coupons: {},\n };\n }\n\n getTransactionPageHref: TransactionPageGetter = (_, data: any) => {\n return data?._links['fx:receipt'].href;\n };\n\n customerAddresses: string | null = null;\n\n itemCategories: string | null = null;\n\n localeCodes: string | null = null;\n\n templates: Templates = {};\n\n settings: Settings | null = null;\n\n coupons: string | null = null;\n\n private readonly __transactionTemplateLoaderId = 'transactionTemplateLoader';\n\n private readonly __defaultTemplateSetLoaderId = 'defaultTemplateSetLoader';\n\n private readonly __localeCodesHelperLoaderId = 'localeCodesLoader';\n\n private readonly __templateSetLoaderId = 'templateSetLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\n\n private readonly __renderHeaderSubtitle = () => {\n const { data, lang, ns } = this;\n\n if (data) {\n let color = 'text-secondary';\n let date: string;\n let key: string;\n\n if (data.first_failed_transaction_date) {\n color = 'text-error';\n date = data.first_failed_transaction_date;\n key = 'subscription_failed';\n } else if (data.end_date) {\n date = data.end_date;\n const hasEnded = new Date(date).getTime() > Date.now();\n key = hasEnded ? 'subscription_will_be_cancelled' : 'subscription_cancelled';\n } else {\n date = data.next_transaction_date ?? new Date().toISOString();\n key = `subscription_${data.is_active ? 'active' : 'inactive'}`;\n }\n\n const text = html`\n <foxy-i18n\n data-testid=\"header-subtitle\"\n options=${JSON.stringify({ date })}\n class=${color}\n lang=${lang}\n key=${key}\n ns=${ns}\n >\n </foxy-i18n>\n `;\n\n if (data.first_failed_transaction_date) {\n return html`\n <span id=\"status\" class=\"flex items-center space-x-xs ${color}\">\n ${text}<iron-icon icon=\"icons:info-outline\" class=\"icon-inline\"></iron-icon>\n </span>\n <vcf-tooltip for=\"status\" position=\"bottom\">\n <span class=\"text-s\">${data.error_message}</span>\n </vcf-tooltip>\n `;\n }\n\n return text;\n }\n\n return html`<x-skeleton class=\"w-full\" variant=\"static\">&nbsp;</x-skeleton>`;\n };\n\n private readonly __renderHeaderTitle = (\n currency: string | undefined,\n currencyDisplay: string | undefined\n ) => {\n const { data, lang, ns } = this;\n\n if (data) {\n const frequency = parseFrequency(data.frequency);\n const transactionTemplate = this.__transactionTemplate;\n const total = transactionTemplate?.total_order;\n\n if (typeof currency !== 'string') return html`--`;\n\n return html`\n <foxy-i18n\n data-testid=\"header-title\"\n options=${JSON.stringify({\n ...frequency,\n amount: `${total} ${currency}`,\n currencyDisplay,\n })}\n lang=${lang}\n key=\"price_${data.frequency === '.5m' ? 'twice_a_month' : 'recurring'}\"\n ns=${ns}\n >\n </foxy-i18n>\n `;\n }\n\n return html`<x-skeleton class=\"w-full\" variant=\"static\">&nbsp;</x-skeleton>`;\n };\n\n private readonly __renderHeader = (\n currencyCode: string | undefined,\n currencyDisplay: string | undefined\n ) => {\n return html`\n <div data-testid=\"header\" class=\"sm-col-span-2\">\n ${this.renderTemplateOrSlot('header:before')}\n <div class=\"leading-xs text-xxl font-bold truncate\">\n ${this.__renderHeaderTitle(currencyCode, currencyDisplay)}\n </div>\n <div class=\"leading-xs text-l\">${this.__renderHeaderSubtitle()}</div>\n ${this.renderTemplateOrSlot('header:after')}\n </div>\n `;\n };\n\n private readonly __renderItemsActions = () => {\n return html`\n <div class=\"flex\" data-testid=\"items:actions\">\n ${this.renderTemplateOrSlot('items:actions:before')}\n\n <foxy-i18n\n data-testid=\"items:actions-label\"\n class=\"flex-1 text-s font-medium text-secondary\"\n lang=${this.lang}\n key=\"item_plural\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('items:actions:after')}\n </div>\n `;\n };\n\n private readonly __renderItems = () => {\n let itemsHref: string | undefined;\n\n try {\n const cart = this.__transactionTemplate;\n const url = new URL(cart?._links['fx:items'].href ?? '');\n url.searchParams.set('zoom', 'item_options');\n itemsHref = url.toString();\n } catch {\n itemsHref = undefined;\n }\n\n return html`\n <div data-testid=\"items\" class=\"space-y-xs sm-col-span-2\">\n ${this.hiddenSelector.matches('items:actions', true) ? '' : this.__renderItemsActions()}\n\n <foxy-internal-async-list-control\n first=${ifDefined(itemsHref)}\n limit=\"5\"\n infer=\"items\"\n item=\"foxy-item-card\"\n >\n </foxy-internal-async-list-control>\n </div>\n `;\n };\n\n private readonly __renderEndDate = () => {\n const { disabledSelector, lang, ns } = this;\n const formHiddenSelector = this.hiddenSelector.zoom('end-date:form').toString();\n\n return html`\n <div class=\"sm-col-span-2\">\n ${this.renderTemplateOrSlot('end-date:before')}\n\n <foxy-form-dialog\n readonlycontrols=${this.readonlySelector.zoom('end-date:form').toString()}\n disabledcontrols=${disabledSelector.zoom('end-date:form').toString()}\n hiddencontrols=\"save-button ${formHiddenSelector}\"\n data-testid=\"cancellation-form\"\n parent=${this.parent}\n header=\"end_subscription\"\n alert\n form=\"foxy-cancellation-form\"\n href=${this.href}\n lang=${lang}\n id=\"end-date-form\"\n ns=${ns}\n .templates=${this.getNestedTemplates('end-date:form')}\n >\n </foxy-form-dialog>\n\n <vaadin-button\n data-testid=\"end-date\"\n theme=\"error\"\n class=\"w-full\"\n ?disabled=${!this.data || disabledSelector.matches('end-date', true)}\n @click=${(evt: Event) => {\n const form = this.renderRoot.querySelector('#end-date-form') as FormDialog;\n form.show(evt.currentTarget as ButtonElement);\n }}\n >\n <foxy-i18n key=\"end_subscription\" ns=${ns} lang=${lang}></foxy-i18n>\n </vaadin-button>\n\n ${this.renderTemplateOrSlot('end-date:after')}\n </div>\n `;\n };\n\n private readonly __checkNextTransactionDateAvailability = (date: Date) => {\n const { settings, data: subscription } = this;\n\n if (settings && subscription) {\n const value = serializeDate(date);\n return isNextTransactionDate({ value, settings, subscription });\n }\n\n return date.getTime() >= Date.now();\n };\n\n private readonly __checkStartDateAvailability = (date: Date) => {\n return date.getTime() >= Date.now();\n };\n\n private readonly __renderStartDate = () => {\n const { data, lang, ns } = this;\n\n return html`\n <div data-testid=\"start-date\">\n ${this.renderTemplateOrSlot('start-date:before')}\n\n <x-group frame>\n <foxy-i18n key=\"start_date\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n <foxy-internal-calendar\n start=${ifDefined(data?.start_date.substr(0, 10))}\n value=${ifDefined(data?.start_date)}\n lang=${lang}\n ?readonly=${!this.__isStartDateEditable}\n ?disabled=${this.disabledSelector.matches('start-date', true)}\n .checkAvailability=${this.__checkStartDateAvailability}\n @change=${(evt: Event) => {\n const target = evt.target as InternalCalendar;\n this.edit({ start_date: target.value });\n }}\n >\n </foxy-internal-calendar>\n </x-group>\n\n ${this.renderTemplateOrSlot('start-date:after')}\n </div>\n `;\n };\n\n private readonly __renderNextTransactionDate = () => {\n const { data, lang, ns } = this;\n const isActive = !!data?.is_active;\n\n return html`\n <div data-testid=\"next-transaction-date\">\n ${this.renderTemplateOrSlot('next-transaction-date:before')}\n\n <x-group frame>\n <foxy-i18n key=\"next_transaction_date\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n <foxy-internal-calendar\n start=${ifDefined(data?.next_transaction_date.substr(0, 10))}\n value=${ifDefined(data?.next_transaction_date)}\n lang=${lang}\n ?readonly=${!isActive || this.readonlySelector.matches('next-transaction-date', true)}\n ?disabled=${!data || this.disabledSelector.matches('next-transaction-date', true)}\n .checkAvailability=${this.__checkNextTransactionDateAvailability}\n @change=${(evt: Event) => {\n const target = evt.target as InternalCalendar;\n this.edit({ next_transaction_date: target.value });\n }}\n >\n </foxy-internal-calendar>\n </x-group>\n\n ${this.renderTemplateOrSlot('next-transaction-date:after')}\n </div>\n `;\n };\n\n private readonly __renderFrequencyAsDropdown = () => {\n const { data } = this;\n const active = !!data?.is_active;\n const items = this.__frequencies.map(v => ({\n label: this.t(v === '.5m' ? 'twice_a_month' : 'frequency', parseFrequency(v)),\n value: v,\n }));\n\n return html`\n <vaadin-combo-box\n item-value-path=\"value\"\n item-label-path=\"label\"\n data-testid=\"frequency\"\n ?disabled=${!data || this.disabledSelector.matches('frequency', true)}\n ?readonly=${data && (!active || this.readonlySelector.matches('frequency', true))}\n class=\"w-full\"\n label=${this.t('frequency_label').toString()}\n value=${ifDefined(this.form.frequency)}\n .items=${items}\n @change=${(evt: Event) => {\n this.edit({ frequency: (evt.target as HTMLInputElement).value });\n }}\n >\n </vaadin-combo-box>\n `;\n };\n\n private readonly __renderFrequencyAsRadioList = () => {\n const { data, lang, ns } = this;\n\n return html`\n <x-group frame>\n <foxy-i18n key=\"frequency_label\" ns=${ns} lang=${lang} slot=\"header\"></foxy-i18n>\n\n <x-choice\n default-custom-value=\"1d\"\n data-testid=\"frequency\"\n type=\"frequency\"\n ns=${ns}\n ?custom=${this.settings === null}\n .items=${this.__frequencies}\n .value=${this.form.frequency ?? null}\n ?disabled=${!data || this.disabledSelector.matches('frequency', true)}\n ?readonly=${data && (!data.is_active || this.readonlySelector.matches('frequency', true))}\n @change=${(evt: Event) => {\n this.edit({ frequency: (evt.target as HTMLInputElement).value });\n }}\n >\n ${this.__frequencies.map(\n frequency => html`\n <foxy-i18n\n options=${JSON.stringify(parseFrequency(frequency))}\n slot=\"${frequency}-label\"\n lang=${lang}\n key=${frequency === '.5m' ? 'twice_a_month' : 'frequency'}\n ns=${ns}\n >\n </foxy-i18n>\n `\n )}\n </x-choice>\n </x-group>\n `;\n };\n\n private readonly __renderFrequency = () => {\n return html`\n <div class=\"sm-col-span-2\">\n ${this.renderTemplateOrSlot('frequency:before')}\n ${this.settings && this.__frequencies.length > 4\n ? this.__renderFrequencyAsDropdown()\n : this.__renderFrequencyAsRadioList()}\n ${this.renderTemplateOrSlot('frequency:after')}\n </div>\n `;\n };\n\n get hiddenSelector(): BooleanSelector {\n return new BooleanSelector(`items:pagination:card:autorenew-icon ${super.hiddenSelector}`);\n }\n\n renderBody(): TemplateResult {\n let transactionsHref: string | undefined;\n\n try {\n const url = new URL(this.data?._links['fx:transactions'].href ?? '');\n url.searchParams.set('order', 'transaction_date desc');\n url.searchParams.set('zoom', 'items');\n transactionsHref = url.toString();\n } catch {\n transactionsHref = undefined;\n }\n\n const currencyDisplay = this.__store?.use_international_currency_symbol ? 'code' : 'symbol';\n const cart = this.__transactionTemplate;\n\n let currencyCode: string | null = null;\n\n if (cart?.currency_code) {\n currencyCode = cart.currency_code;\n } else {\n const allLocaleCodes = this.__localeCodesHelper;\n const localeCode = (this.__templateSet ?? this.__defaultTemplateSet)?.locale_code;\n const localeInfo = localeCode ? allLocaleCodes?.values[localeCode] : void 0;\n\n if (localeInfo) currencyCode = /Currency: ([A-Z]{3})/g.exec(localeInfo)?.[1] ?? null;\n }\n\n return html`\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__transactionTemplateHref)}\n id=${this.__transactionTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__defaultTemplateSetHref)}\n id=${this.__defaultTemplateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__localeCodesHelperHref)}\n id=${this.__localeCodesHelperLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__templateSetHref)}\n id=${this.__templateSetLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n class=\"hidden\"\n infer=\"\"\n href=${ifDefined(this.__storeHref)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <div class=\"relative grid grid-cols-1 sm-grid-cols-2 gap-l\">\n ${this.hiddenSelector.matches('header', true)\n ? ''\n : this.__renderHeader(currencyCode ?? void 0, currencyDisplay)}\n ${this.hiddenSelector.matches('items', true) ? '' : this.__renderItems()}\n ${this.__isFrequencyVisible ? this.__renderFrequency() : ''}\n ${this.__isStartDateVisible ? this.__renderStartDate() : ''}\n ${this.__isNextTransactionDateVisible ? this.__renderNextTransactionDate() : ''}\n\n <foxy-internal-number-control\n suffix=${ifDefined(currencyCode ?? void 0)}\n infer=\"past-due-amount\"\n class=\"sm-col-span-2\"\n min=\"0\"\n >\n </foxy-internal-number-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(this.data?._links['fx:attributes']?.href)}\n class=\"sm-col-span-2\"\n infer=\"attributes\"\n limit=\"5\"\n form=\"foxy-attribute-form\"\n item=\"foxy-attribute-card\"\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n first=${ifDefined(transactionsHref)}\n class=\"sm-col-span-2\"\n infer=\"transactions\"\n limit=\"5\"\n item=\"foxy-transaction-card\"\n hide-delete-button\n .getPageHref=${this.getTransactionPageHref}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-timestamps-control infer=\"timestamps\" class=\"sm-col-span-2\">\n </foxy-internal-timestamps-control>\n\n ${this.hiddenSelector.matches('end-date', true) ? '' : this.__renderEndDate()}\n </div>\n `;\n }\n\n private get __transactionTemplateHref() {\n type DataWithEmbeds = Resource<Rels.Subscription, { zoom: 'transaction_template' }>;\n type Embed = Resource<Rels.TransactionTemplate>;\n\n const data = this.data as DataWithEmbeds | null;\n const embed = data?._embedded['fx:transaction_template'] as Embed | undefined;\n\n return embed ? void 0 : data?._links['fx:transaction_template'].href;\n }\n\n private get __defaultTemplateSetHref() {\n const templateSetUri = this.__transactionTemplate?.template_set_uri;\n\n if (templateSetUri === '') {\n try {\n const url = new URL(this.__store?._links['fx:template_sets'].href ?? '');\n url.searchParams.set('code', 'DEFAULT');\n return url.toString();\n } catch {\n //\n }\n }\n }\n\n private get __localeCodesHelperHref() {\n if (this.__defaultTemplateSetHref || this.__templateSetHref) {\n return this.localeCodes ?? void 0;\n }\n }\n\n private get __templateSetHref() {\n const cart = this.__transactionTemplate;\n if (!cart?.currency_code) return cart?.template_set_uri || void 0;\n }\n\n private get __storeHref() {\n return this.data?._links['fx:store']?.href;\n }\n\n private get __transactionTemplate() {\n type DataWithEmbeds = Resource<Rels.Subscription, { zoom: 'transaction_template' }>;\n type Loader = NucleonElement<Resource<Rels.TransactionTemplate>>;\n type Embed = Resource<Rels.TransactionTemplate>;\n\n const data = this.data as DataWithEmbeds | null;\n const embed = data?._embedded['fx:transaction_template'] as Embed | undefined;\n const selector = `#${this.__transactionTemplateLoaderId}`;\n\n return embed ?? this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __defaultTemplateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSets>>;\n const selector = `#${this.__defaultTemplateSetLoaderId}`;\n const loader = this.renderRoot.querySelector<Loader>(selector);\n return loader?.data?._embedded['fx:template_sets'][0] ?? null;\n }\n\n private get __localeCodesHelper() {\n type Loader = NucleonElement<Resource<Rels.LocaleCodes>>;\n const selector = `#${this.__localeCodesHelperLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __templateSet() {\n type Loader = NucleonElement<Resource<Rels.TemplateSet>>;\n const selector = `#${this.__templateSetLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __store() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n const selector = `#${this.__storeLoaderId}`;\n return this.renderRoot.querySelector<Loader>(selector)?.data ?? null;\n }\n\n private get __isNextTransactionDateVisible() {\n if (this.hiddenSelector.matches('next-transaction-date', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date).getTime() <= Date.now()) return false;\n if (this.data.is_active === false) return false;\n if (this.settings === null) return true;\n\n const rules = this.settings.subscriptions.allow_next_date_modification;\n return !!getNextTransactionDateConstraints(this.data, rules);\n }\n\n private get __isStartDateVisible() {\n if (this.hiddenSelector.matches('start-date', true)) return false;\n return this.__isNextTransactionDateVisible;\n }\n\n private get __isStartDateEditable() {\n if (this.readonlySelector.matches('start-date', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date) <= new Date()) return false;\n if (this.data.is_active === false) return false;\n if (this.data.start_date && new Date(this.data.start_date) <= new Date()) return false;\n\n return this.settings === null;\n }\n\n private get __isFrequencyVisible() {\n if (this.hiddenSelector.matches('frequency', true)) return false;\n if (this.data === null) return false;\n if (this.data.end_date && new Date(this.data.end_date).getTime() <= Date.now()) return false;\n if (this.data.is_active === false) return false;\n if (this.settings === null) return true;\n\n const allowedFrequencies = getAllowedFrequencies({\n subscription: this.data,\n settings: this.settings,\n });\n\n return !allowedFrequencies.next().done;\n }\n\n private get __frequencies() {\n if (!this.settings || !this.data) return ['.5m', '1m', '1y'];\n\n const allowedFrequencies = getAllowedFrequencies({\n subscription: this.data,\n settings: this.settings,\n });\n\n return Array.from(allowedFrequencies);\n }\n}\n"]}
@@ -69,9 +69,16 @@ class TransactionCard extends Base {
69
69
  `;
70
70
  }
71
71
  async _sendGet() {
72
+ var _a;
72
73
  const transaction = await super._sendGet();
73
- const store = await super._fetch(transaction._links['fx:store'].href);
74
- this.__currencyDisplay = store.use_international_currency_symbol ? 'code' : 'symbol';
74
+ const storeLink = (_a = transaction._links['fx:store']) === null || _a === void 0 ? void 0 : _a.href;
75
+ if (typeof storeLink === 'string') {
76
+ const store = await super._fetch(storeLink);
77
+ this.__currencyDisplay = store.use_international_currency_symbol ? 'code' : 'symbol';
78
+ }
79
+ else {
80
+ this.__currencyDisplay = 'symbol';
81
+ }
75
82
  return transaction;
76
83
  }
77
84
  __renderTotal() {
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionCard.js","sourceRoot":"","sources":["../../../../src/elements/public/TransactionCard/TransactionCard.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,MAAM,EAAE,GAAG,kBAAkB,CAAC;AAC9B,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;GAcG;AACH,MAAM,eAAgB,SAAQ,IAAU;IAAxC;;QACE,cAAS,GAAc,EAAE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AAG,IAAI,CAAA;;oBAEA,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;iBAC1B,IAAI,CAAC,IAAI;;eAEX,IAAI,CAAC,EAAE;;;OAGf,CAAC;SACH;aAAM;YACL,OAAO,GAAG,IAAI,CAAA,kBAAkB,CAAC;SAClC;QAED,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,oBAAoB,CAAC;sDACH,OAAO;UACnD,IAAI,CAAC,oBAAoB,CAAC,mBAAmB,CAAC;;KAEnD,CAAC;IACJ,CAAC;IAEO,gBAAgB;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,MAAM,OAAO,GAAG,IAAI;YAClB,CAAC,CAAC,IAAI,CAAA,GAAG,IAAI,CAAC,mBAAmB,IAAI,IAAI,CAAC,kBAAkB,KAAK,IAAI,CAAC,cAAc,GAAG;YACvF,CAAC,CAAC,IAAI,CAAA,kBAAkB,CAAC;QAE3B,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;qDACD,OAAO;UAClD,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC;;KAEhD,CAAC;IACJ,CAAC;CACF;AAED,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import { Data, Templates } from './types';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\n\nconst NS = 'transaction-card';\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Basic card displaying a transaction.\n *\n * @slot total:before\n * @slot total:after\n * @slot status:before\n * @slot status:after\n * @slot description:before\n * @slot description:after\n * @slot customer:before\n * @slot customer:after\n *\n * @element foxy-transaction-card\n * @since 1.12.0\n */\nclass TransactionCard extends Base<Data> {\n templates: Templates = {};\n\n private __currencyDisplay = '';\n\n render(): TemplateResult {\n const hiddenSelector = this.hiddenSelector;\n const hasTotal = !hiddenSelector.matches('total', true);\n const hasStatus = !hiddenSelector.matches('status', true);\n\n return html`\n <div\n aria-busy=${this.in('busy')}\n aria-live=\"polite\"\n class=\"relative leading-s font-lumo text-m\"\n >\n <div class=${classMap({ 'transition-opacity': true, 'opacity-0': !this.data })}>\n ${hasTotal || hasStatus\n ? html`\n <div class=\"flex items-center justify-between\">\n ${hasTotal ? this.__renderTotal() : ''} ${hasStatus ? this.__renderStatus() : ''}\n </div>\n `\n : ''}\n ${hiddenSelector.matches('description', true) ? '' : this.__renderDescription()}\n ${hiddenSelector.matches('customer', true) ? '' : this.__renderCustomer()}\n </div>\n\n <div\n class=${classMap({\n 'pointer-events-none absolute inset-0 flex transition-opacity': true,\n 'opacity-0': !!this.data,\n })}\n >\n <foxy-spinner\n data-testid=\"spinner\"\n state=${this.in('fail') ? 'error' : this.in({ idle: 'template' }) ? 'empty' : 'busy'}\n class=\"m-auto\"\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n protected async _sendGet(): Promise<Data> {\n type Store = Resource<Rels.Store>;\n\n const transaction = await super._sendGet();\n const store = await super._fetch<Store>(transaction._links['fx:store'].href);\n\n this.__currencyDisplay = store.use_international_currency_symbol ? 'code' : 'symbol';\n\n return transaction;\n }\n\n private __renderTotal() {\n const data = this.data;\n let content: TemplateResult;\n\n if (data) {\n const amount = `${data.total_order} ${data.currency_code}`;\n const currencyDisplay = this.__currencyDisplay;\n\n content = html`\n <foxy-i18n\n options=${JSON.stringify({ amount, currencyDisplay })}\n lang=${this.lang}\n key=\"price\"\n ns=${this.ns}\n >\n </foxy-i18n>\n `;\n } else {\n content = html`&ZeroWidthSpace;`;\n }\n\n return html`\n <div data-testid=\"total\">\n ${this.renderTemplateOrSlot('total:before')}\n <div class=\"font-semibold truncate\">${content}</div>\n ${this.renderTemplateOrSlot('total:after')}\n </div>\n `;\n }\n\n private __renderStatus() {\n const specialIcons: Record<string, string> = {\n completed: 'icons:done-all',\n refunded: 'icons:restore',\n rejected: 'icons:highlight-off',\n declined: 'icons:highlight-off',\n voided: 'icons:remove-circle-outline',\n };\n\n const specialColors: Record<string, string> = {\n completed: 'text-success',\n rejected: 'text-error',\n declined: 'text-error',\n };\n\n const status = this.data?.status || 'completed';\n\n return html`\n <div data-testid=\"status\">\n ${this.renderTemplateOrSlot('status:before')}\n\n <div class=\"text-tertiary text-s flex items-center space-x-s\">\n <foxy-i18n\n options=${JSON.stringify({ value: this.data?.transaction_date })}\n lang=${this.lang}\n key=\"time\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <iron-icon\n data-testid=\"status-icon\"\n class=\"icon-inline text-l ${specialColors[status] ?? 'text-tertiary'}\"\n title=${this.t(`transaction_${status}`)}\n icon=${specialIcons[status] ?? 'icons:schedule'}\n >\n </iron-icon>\n </div>\n\n ${this.renderTemplateOrSlot('status:after')}\n </div>\n `;\n }\n\n private __renderDescription() {\n const items = this.data?._embedded?.['fx:items'];\n let content: TemplateResult;\n\n if (items) {\n const options = {\n most_expensive_item: [...items].sort((a, b) => a.price - b.price)[0],\n count_minus_one: items.length - 1,\n count: items.length,\n };\n\n content = html`\n <foxy-i18n\n options=${JSON.stringify(options)}\n lang=${this.lang}\n key=\"transaction_summary\"\n ns=${this.ns}\n >\n </foxy-i18n>\n `;\n } else {\n content = html`&ZeroWidthSpace;`;\n }\n\n return html`\n <div data-testid=\"description\">\n ${this.renderTemplateOrSlot('description:before')}\n <div class=\"text-s text-secondary truncate\">${content}</div>\n ${this.renderTemplateOrSlot('description:after')}\n </div>\n `;\n }\n\n private __renderCustomer() {\n const data = this.data;\n const content = data\n ? html`${data.customer_first_name} ${data.customer_last_name} (${data.customer_email})`\n : html`&ZeroWidthSpace;`;\n\n return html`\n <div data-testid=\"customer\">\n ${this.renderTemplateOrSlot('customer:before')}\n <div class=\"text-tertiary truncate text-s\">${content}</div>\n ${this.renderTemplateOrSlot('customer:after')}\n </div>\n `;\n }\n}\n\nexport { TransactionCard };\n"]}
1
+ {"version":3,"file":"TransactionCard.js","sourceRoot":"","sources":["../../../../src/elements/public/TransactionCard/TransactionCard.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,MAAM,EAAE,GAAG,kBAAkB,CAAC;AAC9B,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;GAcG;AACH,MAAM,eAAgB,SAAQ,IAAU;IAAxC;;QACE,cAAS,GAAc,EAAE,CAAC;QAElB,sBAAiB,GAAG,EAAE,CAAC;IAmLjC,CAAC;IAjLC,MAAM;;QACJ,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC3C,MAAM,QAAQ,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QACxD,MAAM,SAAS,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAE1D,OAAO,IAAI,CAAA;;oBAEK,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC;;;;qBAId,QAAQ,CAAC,EAAE,oBAAoB,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,IAAI,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,CAAC,mBAAmB,CAAC;;KAEnD,CAAC;IACJ,CAAC;IAEO,gBAAgB;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,MAAM,OAAO,GAAG,IAAI;YAClB,CAAC,CAAC,IAAI,CAAA,GAAG,IAAI,CAAC,mBAAmB,IAAI,IAAI,CAAC,kBAAkB,KAAK,IAAI,CAAC,cAAc,GAAG;YACvF,CAAC,CAAC,IAAI,CAAA,kBAAkB,CAAC;QAE3B,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;qDACD,OAAO;UAClD,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC;;KAEhD,CAAC;IACJ,CAAC;CACF;AAED,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import { Data, Templates } from './types';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\n\nconst NS = 'transaction-card';\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Basic card displaying a transaction.\n *\n * @slot total:before\n * @slot total:after\n * @slot status:before\n * @slot status:after\n * @slot description:before\n * @slot description:after\n * @slot customer:before\n * @slot customer:after\n *\n * @element foxy-transaction-card\n * @since 1.12.0\n */\nclass TransactionCard extends Base<Data> {\n templates: Templates = {};\n\n private __currencyDisplay = '';\n\n render(): TemplateResult {\n const hiddenSelector = this.hiddenSelector;\n const hasTotal = !hiddenSelector.matches('total', true);\n const hasStatus = !hiddenSelector.matches('status', true);\n\n return html`\n <div\n aria-busy=${this.in('busy')}\n aria-live=\"polite\"\n class=\"relative leading-s font-lumo text-m\"\n >\n <div class=${classMap({ 'transition-opacity': true, 'opacity-0': !this.data })}>\n ${hasTotal || hasStatus\n ? html`\n <div class=\"flex items-center justify-between\">\n ${hasTotal ? this.__renderTotal() : ''} ${hasStatus ? this.__renderStatus() : ''}\n </div>\n `\n : ''}\n ${hiddenSelector.matches('description', true) ? '' : this.__renderDescription()}\n ${hiddenSelector.matches('customer', true) ? '' : this.__renderCustomer()}\n </div>\n\n <div\n class=${classMap({\n 'pointer-events-none absolute inset-0 flex transition-opacity': true,\n 'opacity-0': !!this.data,\n })}\n >\n <foxy-spinner\n data-testid=\"spinner\"\n state=${this.in('fail') ? 'error' : this.in({ idle: 'template' }) ? 'empty' : 'busy'}\n class=\"m-auto\"\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n protected async _sendGet(): Promise<Data> {\n const transaction = await super._sendGet();\n const storeLink = transaction._links['fx:store']?.href;\n\n if (typeof storeLink === 'string') {\n const store = await super._fetch<Resource<Rels.Store>>(storeLink);\n this.__currencyDisplay = store.use_international_currency_symbol ? 'code' : 'symbol';\n } else {\n this.__currencyDisplay = 'symbol';\n }\n\n return transaction;\n }\n\n private __renderTotal() {\n const data = this.data;\n let content: TemplateResult;\n\n if (data) {\n const amount = `${data.total_order} ${data.currency_code}`;\n const currencyDisplay = this.__currencyDisplay;\n\n content = html`\n <foxy-i18n\n options=${JSON.stringify({ amount, currencyDisplay })}\n lang=${this.lang}\n key=\"price\"\n ns=${this.ns}\n >\n </foxy-i18n>\n `;\n } else {\n content = html`&ZeroWidthSpace;`;\n }\n\n return html`\n <div data-testid=\"total\">\n ${this.renderTemplateOrSlot('total:before')}\n <div class=\"font-semibold truncate\">${content}</div>\n ${this.renderTemplateOrSlot('total:after')}\n </div>\n `;\n }\n\n private __renderStatus() {\n const specialIcons: Record<string, string> = {\n completed: 'icons:done-all',\n refunded: 'icons:restore',\n rejected: 'icons:highlight-off',\n declined: 'icons:highlight-off',\n voided: 'icons:remove-circle-outline',\n };\n\n const specialColors: Record<string, string> = {\n completed: 'text-success',\n rejected: 'text-error',\n declined: 'text-error',\n };\n\n const status = this.data?.status || 'completed';\n\n return html`\n <div data-testid=\"status\">\n ${this.renderTemplateOrSlot('status:before')}\n\n <div class=\"text-tertiary text-s flex items-center space-x-s\">\n <foxy-i18n\n options=${JSON.stringify({ value: this.data?.transaction_date })}\n lang=${this.lang}\n key=\"time\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <iron-icon\n data-testid=\"status-icon\"\n class=\"icon-inline text-l ${specialColors[status] ?? 'text-tertiary'}\"\n title=${this.t(`transaction_${status}`)}\n icon=${specialIcons[status] ?? 'icons:schedule'}\n >\n </iron-icon>\n </div>\n\n ${this.renderTemplateOrSlot('status:after')}\n </div>\n `;\n }\n\n private __renderDescription() {\n const items = this.data?._embedded?.['fx:items'];\n let content: TemplateResult;\n\n if (items) {\n const options = {\n most_expensive_item: [...items].sort((a, b) => a.price - b.price)[0],\n count_minus_one: items.length - 1,\n count: items.length,\n };\n\n content = html`\n <foxy-i18n\n options=${JSON.stringify(options)}\n lang=${this.lang}\n key=\"transaction_summary\"\n ns=${this.ns}\n >\n </foxy-i18n>\n `;\n } else {\n content = html`&ZeroWidthSpace;`;\n }\n\n return html`\n <div data-testid=\"description\">\n ${this.renderTemplateOrSlot('description:before')}\n <div class=\"text-s text-secondary truncate\">${content}</div>\n ${this.renderTemplateOrSlot('description:after')}\n </div>\n `;\n }\n\n private __renderCustomer() {\n const data = this.data;\n const content = data\n ? html`${data.customer_first_name} ${data.customer_last_name} (${data.customer_email})`\n : html`&ZeroWidthSpace;`;\n\n return html`\n <div data-testid=\"customer\">\n ${this.renderTemplateOrSlot('customer:before')}\n <div class=\"text-tertiary truncate text-s\">${content}</div>\n ${this.renderTemplateOrSlot('customer:after')}\n </div>\n `;\n }\n}\n\nexport { TransactionCard };\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foxy.io/elements",
3
3
  "type": "module",
4
- "version": "1.21.1",
4
+ "version": "1.21.3",
5
5
  "description": "E-commerce web components by Foxy.",
6
6
  "repository": {
7
7
  "type": "git",