@foxy.io/elements 1.25.0-beta.4 → 1.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/cdn/foxy-customer-portal.js +2 -2
  2. package/dist/cdn/foxy-subscription-card.js +1 -1
  3. package/dist/cdn/foxy-transaction.js +1 -1
  4. package/dist/elements/public/BillingAddressCard/BillingAddressCard.d.ts +2 -1
  5. package/dist/elements/public/BillingAddressCard/BillingAddressCard.js.map +1 -1
  6. package/dist/elements/public/CouponForm/types.d.ts +3 -7
  7. package/dist/elements/public/CouponForm/types.js.map +1 -1
  8. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js +2 -2
  9. package/dist/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.js.map +1 -1
  10. package/dist/elements/public/NativeIntegrationForm/NativeIntegrationForm.js.map +1 -1
  11. package/dist/elements/public/PaymentCard/PaymentCard.js.map +1 -1
  12. package/dist/elements/public/PaymentsApi/api/types.d.ts +2 -0
  13. package/dist/elements/public/PaymentsApi/api/types.js.map +1 -1
  14. package/dist/elements/public/ShipmentCard/ShipmentCard.js.map +1 -1
  15. package/dist/elements/public/SubscriptionCard/SubscriptionCard.js +2 -2
  16. package/dist/elements/public/SubscriptionCard/SubscriptionCard.js.map +1 -1
  17. package/dist/elements/public/SubscriptionCard/types.d.ts +2 -2
  18. package/dist/elements/public/SubscriptionCard/types.js.map +1 -1
  19. package/dist/elements/public/Transaction/Transaction.js +2 -2
  20. package/dist/elements/public/Transaction/Transaction.js.map +1 -1
  21. package/dist/elements/public/Transaction/internal/InternalTransactionSummaryControl/InternalTransactionSummaryControl.js +6 -4
  22. package/dist/elements/public/Transaction/internal/InternalTransactionSummaryControl/InternalTransactionSummaryControl.js.map +1 -1
  23. package/dist/elements/public/Transaction/types.d.ts +5 -19
  24. package/dist/elements/public/Transaction/types.js.map +1 -1
  25. package/package.json +2 -2
@@ -134,7 +134,7 @@ import"./foxy-customer.js";import"./shared-c7b3d22b.js";import"./shared-30d00b64
134
134
  >
135
135
  </foxy-subscription-card>
136
136
  </button>
137
- `),h({"block w-full border border-contrast-10 p-m rounded-t-l rounded-b-l":!0,"focus-outline-none focus-border-primary":!0,"hover-border-contrast-30":null!==s.data}),null===s.data,(e=>{const t=new URL(s.href);t.searchParams.set("zoom","last_transaction,transaction_template:items"),this.__subscriptionDialog.href=t.toString(),this.__subscriptionDialog.show(e.currentTarget)}),s.parent,s.group,s.lang,s.href,s.ns,null!==(i=null===(r=customElements.get("foxy-subscription-card"))||void 0===r?void 0:r.defaultNS)&&void 0!==i?i:"",s.templates)},this.__renderPage=e=>{let{html:t}=e,s=o(e,te);return t(ce||(ce=pe`
137
+ `),h({"block w-full border border-contrast-10 p-m rounded-t-l rounded-b-l":!0,"focus-outline-none focus-border-primary":!0,"hover-border-contrast-30":null!==s.data}),null===s.data,(e=>{const t=new URL(s.href);t.searchParams.set("zoom","transaction_template:items"),this.__subscriptionDialog.href=t.toString(),this.__subscriptionDialog.show(e.currentTarget)}),s.parent,s.group,s.lang,s.href,s.ns,null!==(i=null===(r=customElements.get("foxy-subscription-card"))||void 0===r?void 0:r.defaultNS)&&void 0!==i?i:"",s.templates)},this.__renderPage=e=>{let{html:t}=e,s=o(e,te);return t(ce||(ce=pe`
138
138
  <foxy-collection-page
139
139
  ns=${0}
140
140
  href=${0}
@@ -145,4 +145,4 @@ import"./foxy-customer.js";import"./shared-c7b3d22b.js";import"./shared-30d00b64
145
145
  .templates=${0}
146
146
  >
147
147
  </foxy-collection-page>
148
- `),s.ns,s.href,s.lang,s.group,this.__renderPageItem,s.templates)},this.__renderHeader=()=>i(me||(me=pe` ${0} <foxy-i18n class="block text-l font-medium" lang="${0}" key="subscription_plural" ns="${0}"> </foxy-i18n> ${0} `),this.renderTemplateOrSlot("header:before"),this.lang,this.ns,this.renderTemplateOrSlot("header:after")),this.__renderList=()=>{var e;const t=this.disabledSelector.zoom("list"),s=this.readonlySelector.zoom("list"),r=[this.hiddenSelector.zoom("list").zoom("form").toString(),"end-date"];return i(ue||(ue=pe` ${0} <foxy-form-dialog readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" header="update" parent="${0}" group="${0}" lang="${0}" ns="${0}" id="subscription-dialog" .form="${0}" .templates="${0}"> </foxy-form-dialog> <foxy-collection-pages class="block space-y-m" first="${0}" group="${0}" lang="${0}" ns="${0}" manual .page="${0}" .templates="${0}"> </foxy-collection-pages> ${0} `),this.renderTemplateOrSlot("list:before"),s.zoom("form").toString(),t.zoom("form").toString(),r.join(" ").trim(),u(null===(e=this.customer)||void 0===e?void 0:e._links["fx:subscriptions"].href),this.group,this.lang,this.ns,this.__renderForm,this.getNestedTemplates("list:form"),this.__activeSubscriptionsLink,this.group,this.lang,this.ns,this.__renderPage,this.getNestedTemplates("list:card"),this.renderTemplateOrSlot("list:after"))}}static get properties(){return s(s({},super.properties),{},{settings:{attribute:!1},customer:{attribute:!1},group:{type:String}})}render(){return i(he||(he=pe` <div class="space-y-s" data-testid="subscriptions"> ${0} ${0} </div> `),this.hiddenSelector.matches("header",!0)?"":this.__renderHeader(),this.hiddenSelector.matches("list",!0)?"":this.__renderList())}get __subscriptionDialog(){return this.renderRoot.querySelector("#subscription-dialog")}get __activeSubscriptionsLink(){try{const e=new URL(this.customer._links["fx:subscriptions"].href);return e.searchParams.set("zoom","last_transaction,transaction_template:items"),e.toString()}catch(e){return""}}}),customElements.define("foxy-internal-customer-portal-transactions",class extends be{constructor(){super(...arguments),this.customer=null,this.columns=[],this.group="",this.__renderHeader=()=>i(ge||(ge=ve` <div> ${0} <foxy-i18n class="text-l font-medium" lang="${0}" key="transaction_plural" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("header:before"),this.lang,this.ns,this.renderTemplateOrSlot("header:after")),this.__renderList=()=>{let e="";if(this.customer){const t=new URL(this.customer._links["fx:transactions"].href);t.searchParams.set("zoom","items"),e=t.toString()}return i($e||($e=ve` <div> ${0} <foxy-collection-pages spinner="foxy-spinner" group="${0}" first="${0}" class="block divide-y divide-contrast-10 px-m border border-contrast-10 rounded-t-l rounded-b-l" page="foxy-transactions-table" lang="${0}" ns="${0}" manual .templates="${0}" .props="${0}"> </foxy-collection-pages> ${0} </div> `),this.renderTemplateOrSlot("list:before"),this.group,e,this.lang,this.ns,this.getNestedTemplates("table"),{".columns":this.columns},this.renderTemplateOrSlot("list:after"))}}static get properties(){return s(s({},super.properties),{},{customer:{attribute:!1},columns:{attribute:!1},group:{type:String}})}render(){return i(ye||(ye=ve` <div class="space-y-s" data-testid="transactions"> ${0} ${0} </div> `),this.hiddenSelector.matches("header")?"":this.__renderHeader(),this.hiddenSelector.matches("list")?"":this.__renderList())}}),customElements.define("foxy-internal-customer-portal-link",k),customElements.define("foxy-customer-portal",b);export{b as CustomerPortal};
148
+ `),s.ns,s.href,s.lang,s.group,this.__renderPageItem,s.templates)},this.__renderHeader=()=>i(me||(me=pe` ${0} <foxy-i18n class="block text-l font-medium" lang="${0}" key="subscription_plural" ns="${0}"> </foxy-i18n> ${0} `),this.renderTemplateOrSlot("header:before"),this.lang,this.ns,this.renderTemplateOrSlot("header:after")),this.__renderList=()=>{var e;const t=this.disabledSelector.zoom("list"),s=this.readonlySelector.zoom("list"),r=[this.hiddenSelector.zoom("list").zoom("form").toString(),"end-date"];return i(ue||(ue=pe` ${0} <foxy-form-dialog readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="${0}" header="update" parent="${0}" group="${0}" lang="${0}" ns="${0}" id="subscription-dialog" .form="${0}" .templates="${0}"> </foxy-form-dialog> <foxy-collection-pages class="block space-y-m" first="${0}" group="${0}" lang="${0}" ns="${0}" manual .page="${0}" .templates="${0}"> </foxy-collection-pages> ${0} `),this.renderTemplateOrSlot("list:before"),s.zoom("form").toString(),t.zoom("form").toString(),r.join(" ").trim(),u(null===(e=this.customer)||void 0===e?void 0:e._links["fx:subscriptions"].href),this.group,this.lang,this.ns,this.__renderForm,this.getNestedTemplates("list:form"),this.__activeSubscriptionsLink,this.group,this.lang,this.ns,this.__renderPage,this.getNestedTemplates("list:card"),this.renderTemplateOrSlot("list:after"))}}static get properties(){return s(s({},super.properties),{},{settings:{attribute:!1},customer:{attribute:!1},group:{type:String}})}render(){return i(he||(he=pe` <div class="space-y-s" data-testid="subscriptions"> ${0} ${0} </div> `),this.hiddenSelector.matches("header",!0)?"":this.__renderHeader(),this.hiddenSelector.matches("list",!0)?"":this.__renderList())}get __subscriptionDialog(){return this.renderRoot.querySelector("#subscription-dialog")}get __activeSubscriptionsLink(){try{const e=new URL(this.customer._links["fx:subscriptions"].href);return e.searchParams.set("zoom","transaction_template:items"),e.toString()}catch(e){return""}}}),customElements.define("foxy-internal-customer-portal-transactions",class extends be{constructor(){super(...arguments),this.customer=null,this.columns=[],this.group="",this.__renderHeader=()=>i(ge||(ge=ve` <div> ${0} <foxy-i18n class="text-l font-medium" lang="${0}" key="transaction_plural" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("header:before"),this.lang,this.ns,this.renderTemplateOrSlot("header:after")),this.__renderList=()=>{let e="";if(this.customer){const t=new URL(this.customer._links["fx:transactions"].href);t.searchParams.set("zoom","items"),e=t.toString()}return i($e||($e=ve` <div> ${0} <foxy-collection-pages spinner="foxy-spinner" group="${0}" first="${0}" class="block divide-y divide-contrast-10 px-m border border-contrast-10 rounded-t-l rounded-b-l" page="foxy-transactions-table" lang="${0}" ns="${0}" manual .templates="${0}" .props="${0}"> </foxy-collection-pages> ${0} </div> `),this.renderTemplateOrSlot("list:before"),this.group,e,this.lang,this.ns,this.getNestedTemplates("table"),{".columns":this.columns},this.renderTemplateOrSlot("list:after"))}}static get properties(){return s(s({},super.properties),{},{customer:{attribute:!1},columns:{attribute:!1},group:{type:String}})}render(){return i(ye||(ye=ve` <div class="space-y-s" data-testid="transactions"> ${0} ${0} </div> `),this.hiddenSelector.matches("header")?"":this.__renderHeader(),this.hiddenSelector.matches("list")?"":this.__renderList())}}),customElements.define("foxy-internal-customer-portal-link",k),customElements.define("foxy-customer-portal",b);export{b as CustomerPortal};
@@ -1 +1 @@
1
- import"./shared-30d00b64.js";import"./shared-ff9791cf.js";import"./shared-f9180815.js";import"./foxy-spinner.js";import"./shared-029816d7.js";import{_ as t}from"./shared-1522d76f.js";import{h as e}from"./shared-7f33a83a.js";import{C as s}from"./shared-b23c903e.js";import{N as i}from"./shared-6a7f96c4.js";import{R as a,T as n,a as r}from"./shared-5fa697c4.js";import{c as o}from"./shared-4e709717.js";import{p as d}from"./shared-4c650e5c.js";import"./shared-43f449bb.js";import"./shared-30cbf0a6.js";import"./shared-343d1fd7.js";import"./shared-d3bf9ac0.js";import"./shared-07e9d1fb.js";import"./shared-3ab0306f.js";import"./shared-eb116b3e.js";let c,l=t=>t;const m=s(a(n(r(i,"subscription-card"))));class f extends m{render(){var t,s,i,a,n;const r=!!(null===(t=this.data)||void 0===t?void 0:t.is_active),d=!!(null===(s=this.data)||void 0===s?void 0:s.first_failed_transaction_date);return e(c||(c=l` <div class="relative text-left"> <div class="${0}"> <div class="${0}"> <iron-icon class="m-auto" icon="${0}"> </iron-icon> </div> <div class="flex-1 min-w-0 leading-xs flex flex-col sm-flex-row sm-items-center"> <div class="order-1 sm-order-0"> <div class="text-body font-medium origin-top-left text-m"> <foxy-i18n data-testid="summary" options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> &#8203; </div> <div class="${0}"> <foxy-i18n data-testid="status" options="${0}" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> &#8203; </div> </div> <div class="flex-1 font-medium leading-xs mb-xs sm-mb-0 sm-text-right text-xxs sm-text-l tracking-wide sm-tracking-normal uppercase sm-normal-case order-0 sm-order-1 font-tnum text-secondary sm-text-body"> <foxy-i18n data-testid="price" options="${0}" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> &#8203; </div> </div> </div> <div data-testid="spinner" class="${0}"> <foxy-spinner state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> ${0} `),o({"flex items-start sm-items-center space-x-m transition duration-150 ease-in-out":!0,"opacity-0":!this.in({idle:"snapshot"})}),o({"min-w-0 flex-shrink-0 rounded-full relative flex p-s":!0,"text-success bg-success-10":r&&!d,"text-body bg-contrast-5":!r&&!d,"text-error bg-error-10":d}),d?"error-outline":r?"done":"done-all",JSON.stringify(this.__getSummaryOptions()),this.lang,this.ns,o({"text-m":!0,"text-tertiary":!r&&!d,"text-success":r&&!d,"text-error":d}),JSON.stringify(this.__getStatusOptions()),this.lang,this.__getStatusKey(),this.ns,JSON.stringify(this.__getPriceOptions()),this.lang,".5m"===(null===(i=this.data)||void 0===i?void 0:i.frequency)?"twice_a_month":"recurring",this.ns,o({"pointer-events-none absolute inset-0 flex transition ease-in-out duration-150":!0,"opacity-0":this.in({idle:"snapshot"})}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(n=null===(a=customElements.get("foxy-spinner"))||void 0===a?void 0:a.defaultNS)&&void 0!==n?n:"",this.renderTemplateOrSlot())}__getSummaryOptions(){if(null===this.data)return{};const t=this.data._embedded["fx:transaction_template"]._embedded["fx:items"];return{most_expensive_item:[...t].sort(((t,e)=>t.price-e.price))[0],count_minus_one:t.length-1,count:t.length}}__getStatusOptions(){const t=this.data;return null===t?{}:t.first_failed_transaction_date?{date:t.first_failed_transaction_date}:t.end_date?{date:t.end_date}:!1===t.is_active?{}:new Date(t.start_date)>new Date?{date:t.start_date}:{date:t.next_transaction_date}}__getPriceOptions(){if(null===this.data)return{};const e=this.data._embedded["fx:last_transaction"],s=`${e.total_order} ${e.currency_code}`;return t(t({},d(this.data.frequency)),{},{amount:s})}__getStatusKey(){const t=this.data;if(null!==t){if(t.first_failed_transaction_date)return"subscription_failed";if(t.end_date){return new Date(t.end_date).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}return!1===t.is_active?"subscription_inactive":new Date(t.start_date)>new Date?"subscription_will_be_active":"subscription_active"}}}customElements.define("foxy-subscription-card",f);export{f as SubscriptionCard};
1
+ import"./shared-30d00b64.js";import"./shared-ff9791cf.js";import"./shared-f9180815.js";import"./foxy-spinner.js";import"./shared-029816d7.js";import{_ as t}from"./shared-1522d76f.js";import{h as e}from"./shared-7f33a83a.js";import{C as s}from"./shared-b23c903e.js";import{N as i}from"./shared-6a7f96c4.js";import{R as a,T as n,a as r}from"./shared-5fa697c4.js";import{c as o}from"./shared-4e709717.js";import{p as d}from"./shared-4c650e5c.js";import"./shared-43f449bb.js";import"./shared-30cbf0a6.js";import"./shared-343d1fd7.js";import"./shared-d3bf9ac0.js";import"./shared-07e9d1fb.js";import"./shared-3ab0306f.js";import"./shared-eb116b3e.js";let c,l=t=>t;const m=s(a(n(r(i,"subscription-card"))));class f extends m{render(){var t,s,i,a,n;const r=!!(null===(t=this.data)||void 0===t?void 0:t.is_active),d=!!(null===(s=this.data)||void 0===s?void 0:s.first_failed_transaction_date);return e(c||(c=l` <div class="relative text-left"> <div class="${0}"> <div class="${0}"> <iron-icon class="m-auto" icon="${0}"> </iron-icon> </div> <div class="flex-1 min-w-0 leading-xs flex flex-col sm-flex-row sm-items-center"> <div class="order-1 sm-order-0"> <div class="text-body font-medium origin-top-left text-m"> <foxy-i18n data-testid="summary" options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> &#8203; </div> <div class="${0}"> <foxy-i18n data-testid="status" options="${0}" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> &#8203; </div> </div> <div class="flex-1 font-medium leading-xs mb-xs sm-mb-0 sm-text-right text-xxs sm-text-l tracking-wide sm-tracking-normal uppercase sm-normal-case order-0 sm-order-1 font-tnum text-secondary sm-text-body"> <foxy-i18n data-testid="price" options="${0}" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> &#8203; </div> </div> </div> <div data-testid="spinner" class="${0}"> <foxy-spinner state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> ${0} `),o({"flex items-start sm-items-center space-x-m transition duration-150 ease-in-out":!0,"opacity-0":!this.in({idle:"snapshot"})}),o({"min-w-0 flex-shrink-0 rounded-full relative flex p-s":!0,"text-success bg-success-10":r&&!d,"text-body bg-contrast-5":!r&&!d,"text-error bg-error-10":d}),d?"error-outline":r?"done":"done-all",JSON.stringify(this.__getSummaryOptions()),this.lang,this.ns,o({"text-m":!0,"text-tertiary":!r&&!d,"text-success":r&&!d,"text-error":d}),JSON.stringify(this.__getStatusOptions()),this.lang,this.__getStatusKey(),this.ns,JSON.stringify(this.__getPriceOptions()),this.lang,".5m"===(null===(i=this.data)||void 0===i?void 0:i.frequency)?"twice_a_month":"recurring",this.ns,o({"pointer-events-none absolute inset-0 flex transition ease-in-out duration-150":!0,"opacity-0":this.in({idle:"snapshot"})}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(n=null===(a=customElements.get("foxy-spinner"))||void 0===a?void 0:a.defaultNS)&&void 0!==n?n:"",this.renderTemplateOrSlot())}__getSummaryOptions(){if(null===this.data)return{};const t=this.data._embedded["fx:transaction_template"]._embedded["fx:items"];return{most_expensive_item:[...t].sort(((t,e)=>t.price-e.price))[0],count_minus_one:t.length-1,count:t.length}}__getStatusOptions(){const t=this.data;return null===t?{}:t.first_failed_transaction_date?{date:t.first_failed_transaction_date}:t.end_date?{date:t.end_date}:!1===t.is_active?{}:new Date(t.start_date)>new Date?{date:t.start_date}:{date:t.next_transaction_date}}__getPriceOptions(){if(null===this.data)return{};const e=this.data._embedded["fx:transaction_template"],s=`${e.total_order} ${e.currency_code}`;return t(t({},d(this.data.frequency)),{},{amount:s})}__getStatusKey(){const t=this.data;if(null!==t){if(t.first_failed_transaction_date)return"subscription_failed";if(t.end_date){return new Date(t.end_date).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}return!1===t.is_active?"subscription_inactive":new Date(t.start_date)>new Date?"subscription_will_be_active":"subscription_active"}}}customElements.define("foxy-subscription-card",f);export{f as SubscriptionCard};
@@ -1 +1 @@
1
- import"./foxy-billing-address-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-custom-field-form.js";import"./foxy-custom-field-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-shipment-card.js";import"./foxy-payment-card.js";import"./foxy-item-card.js";import"./foxy-item-form.js";import"./shared-029816d7.js";import"./shared-8201d0b5.js";import{I as t}from"./shared-ff8ca16b.js";import{I as e}from"./shared-fc15a882.js";import"./foxy-customer-card.js";import"./foxy-swipe-actions.js";import"./foxy-spinner.js";import{_ as i,B as o}from"./shared-1522d76f.js";import{g as s}from"./shared-bab2ea2c.js";import{i as r}from"./shared-d3bf9ac0.js";import{h as n,s as a}from"./shared-7f33a83a.js";import{c as d}from"./shared-4e709717.js";import"./shared-c7b3d22b.js";import"./shared-d21fa1a6.js";import{N as l}from"./shared-6a7f96c4.js";import"./foxy-nucleon-element.js";import{R as c,a as u}from"./shared-5fa697c4.js";import"./shared-2cf08dd4.js";import"./shared-e91453df.js";import"./shared-ff9791cf.js";import"./shared-43f449bb.js";import"./shared-30d00b64.js";import"./shared-30cbf0a6.js";import"./shared-343d1fd7.js";import"./shared-07e9d1fb.js";import"./shared-3ab0306f.js";import"./shared-eb116b3e.js";import"./shared-f9180815.js";import"./shared-b23c903e.js";import"./shared-9df8f842.js";import"./shared-f9a3d1ff.js";import"./shared-c9ba1b64.js";import"./shared-b509bc2c.js";import"./shared-61ade33e.js";import"./shared-9c08cfab.js";import"./shared-e39807f8.js";import"./shared-ea527e98.js";import"./shared-99c0ae04.js";import"./shared-ad34b6db.js";import"./shared-4e59fd48.js";import"./shared-2c8c4b43.js";import"./shared-11c2efc8.js";import"./shared-268571df.js";import"./shared-4c124efc.js";import"./shared-2b27e2e7.js";import"./shared-a8dc23f1.js";import"./shared-2bdc99f4.js";import"./shared-4462dc70.js";import"./shared-e83f2983.js";import"./shared-293771ba.js";import"./shared-d7be11de.js";import"./shared-4c650e5c.js";import"./shared-7dd17943.js";import"./shared-bed7aae1.js";import"./shared-8952aeac.js";import"./shared-54b0e48f.js";import"./shared-7e1953f5.js";import"./shared-6a9ae42e.js";import"./shared-20ba4cdc.js";import"./shared-ac7c5a5e.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-discount-builder.js";import"./shared-d519a301.js";import"./shared-bb05cfed.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-collection-page.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";let p,m,f,h,_=t=>t;customElements.define("foxy-internal-transaction-customer-control",class extends e{constructor(){super(...arguments),this.__copyEmailState="idle",this.__copyIdState="idle"}static get properties(){return i(i({},super.properties),{},{__copyEmailState:{attribute:!1},__copyIdState:{attribute:!1}})}renderControl(){var t,e,i,o;const l=this.nucleon,c=null===(t=null==l?void 0:l.data)||void 0===t?void 0:t._links["fx:customer"].href,u=c?null===(e=null==l?void 0:l.getCustomerPageHref)||void 0===e?void 0:e.call(l,c):void 0;return n(p||(p=_` <foxy-i18n infer="" class="block text-s font-medium leading-xs mb-xs" key="label"> </foxy-i18n> <foxy-swipe-actions> <a class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" href="${0}"> <foxy-customer-card infer="" href="${0}"></foxy-customer-card> </a> <div class="h-full grid grid-cols-2 gap-s ml-s" slot="action"> ${0} ${0} </div> </foxy-swipe-actions> `),d({"block ring-inset rounded transition-colors":!0,"ring-1 ring-contrast-10":!u,"cursor-pointer bg-contrast-5 hover-bg-contrast-10":!!u,"focus-outline-none focus-ring-2 focus-ring-primary-50":!!u}),r(u),r(c),this.__renderCopyAction(a(m||(m=_`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M9.493 2.852a.75.75 0 0 0-1.486-.204L7.545 6H4.198a.75.75 0 0 0 0 1.5h3.14l-.69 5H3.302a.75.75 0 0 0 0 1.5h3.14l-.435 3.148a.75.75 0 0 0 1.486.204L7.955 14h2.986l-.434 3.148a.75.75 0 0 0 1.486.204L12.456 14h3.346a.75.75 0 0 0 0-1.5h-3.14l.69-5h3.346a.75.75 0 0 0 0-1.5h-3.14l.435-3.148a.75.75 0 0 0-1.486-.204L12.045 6H9.059l.434-3.148ZM8.852 7.5l-.69 5h2.986l.69-5H8.852Z" clip-rule="evenodd" /></svg>`)),"copy_id_caption","__copyIdState",c?String(s(c)):""),this.__renderCopyAction(a(f||(f=_`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M5.404 14.596A6.5 6.5 0 1 1 16.5 10a1.25 1.25 0 0 1-2.5 0 4 4 0 1 0-.571 2.06A2.75 2.75 0 0 0 18 10a8 8 0 1 0-2.343 5.657.75.75 0 0 0-1.06-1.06 6.5 6.5 0 0 1-9.193 0ZM10 7.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z" clip-rule="evenodd" /></svg>`)),"copy_email_caption","__copyEmailState",null!==(o=null===(i=null==l?void 0:l.data)||void 0===i?void 0:i.customer_email)&&void 0!==o?o:""))}__renderCopyAction(t,e,i,o){const s=this[i],r="fail"===s?"error":"done"===s?"end":"busy";return n(h||(h=_` <button class="relative transition-colors bg-contrast-5 text-body hover-bg-contrast-10 rounded h-full py-0 px-m focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50" ?disabled="${0}" @click="${0}" @focusout="${0}" @mouseout="${0}"> <div class="${0}"> ${0} <foxy-i18n class="mt-xs text-s font-medium leading-none" infer="" key="${0}"> </foxy-i18n> </div> <div class="${0}"> <foxy-spinner layout="no-label" state="${0}" infer="spinner"> </foxy-spinner> </div> </button> `),"idle"!==s,(()=>"idle"===s&&this.__copy(o,i)),(t=>"idle"!==s&&t.stopPropagation()),(t=>"idle"!==s&&t.stopPropagation()),d({"relative flex flex-col items-center justify-center transition-opacity":!0,"opacity-0":"idle"!==s}),t,e,d({"absolute inset-0 flex items-center justify-center transition-opacity":!0,"opacity-0":"idle"===s}),r)}async __copy(t,e){this[e]="busy";try{await navigator.clipboard.writeText(t),this[e]="done"}catch(t){this[e]="fail"}setTimeout((()=>this[e]="idle"),3e3)}});let y,v=t=>t;customElements.define("foxy-internal-transaction-post-action-control",class extends e{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return i(i({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const t=this.__state,e="fail"===t?"error":"idle"===t?this.theme:"";return n(y||(y=v` <foxy-internal-confirm-dialog header="header" infer="confirm" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button class="w-full" theme="${0} tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),(t=>!t.detail.cancelled&&this.__submit()),e,"busy"===t||this.disabled,(t=>{this.renderRoot.querySelector("#confirm").show(t.currentTarget)}),t)}async __submit(){var t;if("busy"!==this.__state)try{this.__state="busy";const e=new l.API(this),i=await e.fetch(null!==(t=this.href)&&void 0!==t?t:"",{method:"POST"});this.__state=i.ok?"idle":"fail",i.ok&&this.dispatchEvent(new CustomEvent("done"))}catch(t){this.__state="fail"}}});let x,b,g,j,$,w,k=t=>t;customElements.define("foxy-internal-transaction-actions-control",class extends e{renderControl(){var t,e,i,o,s,r,a,d,l,c;return n(x||(x=k` <div class="flex flex-wrap gap-x-m gap-y-xs"> ${0} ${0} ${0} ${0} ${0} </div> `),(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:capture"])?this.__renderCaptureAction():"",(null===(o=null===(i=this.nucleon)||void 0===i?void 0:i.data)||void 0===o?void 0:o._links["fx:void"])?this.__renderVoidAction():"",(null===(r=null===(s=this.nucleon)||void 0===s?void 0:s.data)||void 0===r?void 0:r._links["fx:refund"])?this.__renderRefundAction():"",(null===(d=null===(a=this.nucleon)||void 0===a?void 0:a.data)||void 0===d?void 0:d._links["fx:send_emails"])?this.__renderSendEmailsAction():"",(null===(c=null===(l=this.nucleon)||void 0===l?void 0:l.data)||void 0===c?void 0:c._links["fx:subscription"])?this.__renderSubscriptionAction():"")}__renderSendEmailsAction(){var t,e;return n(b||(b=k` <foxy-internal-transaction-post-action-control infer="send-emails" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),r(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:send_emails"].href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderCaptureAction(){var t,e;return n(g||(g=k` <foxy-internal-transaction-post-action-control theme="success" infer="capture" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),r(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:capture"].href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderVoidAction(){var t,e,i;return n(j||(j=k` <foxy-internal-transaction-post-action-control theme="error" infer="void" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),r(null===(i=null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:void"])||void 0===i?void 0:i.href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderRefundAction(){var t,e,i;return n($||($=k` <foxy-internal-transaction-post-action-control infer="refund" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),r(null===(i=null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:refund"])||void 0===i?void 0:i.href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderSubscriptionAction(){var t,e,i;const o=this.nucleon,s=null===(e=null===(t=null==o?void 0:o.data)||void 0===t?void 0:t._links["fx:subscription"])||void 0===e?void 0:e.href,a=s?null===(i=null==o?void 0:o.getSubscriptionPageHref)||void 0===i?void 0:i.call(o,s):void 0;return n(w||(w=k` <a class="rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="subscription" key="caption"></foxy-i18n> </a> `),r(a))}});let S,P,H,A,C,E,L,I,R,G,B=t=>t;customElements.define("foxy-internal-transaction-summary-control",class extends e{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var t,e,i,o,s,a,d,l,c;const u=null===(t=this.nucleon)||void 0===t?void 0:t.data;if(!u)return n(S||(S=B``));const p=null!==(i=null===(e=null==u?void 0:u._embedded)||void 0===e?void 0:e["fx:applied_taxes"])&&void 0!==i?i:[],m=null!==(s=null===(o=u._embedded)||void 0===o?void 0:o["fx:shipments"])&&void 0!==s?s:[];return n(P||(P=B` <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <p class="grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 2px);grid-template-columns:1fr min-content"> <span><foxy-i18n key="subtotal" infer=""></foxy-i18n>&colon;</span> <span>${0}</span> ${0} ${0} ${0} ${0} <span class="col-span-2 border-t border-dashed border-contrast-20 my-s"></span> <span class="col-span-2 flex gap-s justify-between items-center"> ${0} <span class="text-xl font-medium leading-xs"> <foxy-i18n infer="" key="total"></foxy-i18n>&colon; ${0} </span> </span> </p> `),r(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__renderPrice(u.total_item_price),0===m.length||0===u.total_shipping?n(H||(H=B` <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>&colon;</span> <span>${0} </span> `),this.__renderPrice(u.total_shipping,!0)):m.map((t=>n(A||(A=B` <span>${0}&colon;</span> <span>${0}</span> `),t.shipping_service_description,this.__renderPrice(t.total_shipping,!0)))),0===p.length||0===u.total_tax?n(C||(C=B` <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>&colon;</span> <span>${0}</span> `),this.__renderPrice(u.total_tax,!0)):p.map((t=>n(E||(E=B` <span>${0}&colon;</span> <span>${0}</span> `),t.name,this.__renderPrice(t.amount,!0)))),null===(d=null===(a=null==u?void 0:u._embedded)||void 0===a?void 0:a["fx:applied_gift_card_codes"])||void 0===d?void 0:d.map((t=>{var e;return n(L||(L=B` <span>${0}&colon;</span> <span>${0}</span> `),t._embedded["fx:gift_card"].name,this.__renderPrice(null!==(e=t.balance_adjustment)&&void 0!==e?e:0,!0))})),null===(c=null===(l=null==u?void 0:u._embedded)||void 0===l?void 0:l["fx:discounts"])||void 0===c?void 0:c.map((t=>n(I||(I=B` <span data-testclass="discount">${0}&colon;</span> <span>${0}</span> `),t.name,this.__renderPrice(t.amount,!0)))),this.__renderStatus(),this.__renderPrice(u.total_order))}get __storeHref(){var t,e,i;return null===(i=null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:store"])||void 0===i?void 0:i.href}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}__renderPrice(t,e=!1){var i,o,s;const r=(null===(i=this.__store)||void 0===i?void 0:i.use_international_currency_symbol)?"code":"symbol",a=null===(s=null===(o=this.nucleon)||void 0===o?void 0:o.data)||void 0===s?void 0:s.currency_code;return n(R||(R=B` <foxy-i18n class="${0}" infer="" key="price" .options="${0}"> </foxy-i18n> `),e&&0!==t?t>0?"text-success":"text-error":"",{currencyDisplay:r,signDisplay:e?"exceptZero":"auto",amount:`${t} ${a}`})}__renderStatus(){var t,e;const i=(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e.status)||"completed";let o="";return o=["capturing","captured","approved","authorized","pending"].includes(i)?"text-success bg-success-10":i&&"completed"!==i?["problem","pending_fraud_review","rejected","declined"].includes(i)?"text-error-contrast bg-error":"bg-contrast-5 text-body":"text-success-contrast bg-success",n(G||(G=B` <foxy-i18n infer="" class="${0} rounded-s py-xs px-s font-medium text-s leading-xs" key="status_${0}"></foxy-i18n> `),o,i)}});let Z,M,T=t=>t;const W=c(u(t,"transaction"));class q extends W{constructor(){super(...arguments),this.hostedPaymentGatewaysHelper=null,this.paymentGatewaysHelper=null,this.getSubscriptionPageHref=null,this.getCustomerPageHref=null}static get properties(){return i(i({},super.properties),{},{hostedPaymentGatewaysHelper:{attribute:"hosted-payment-gateways-helper"},paymentGatewaysHelper:{attribute:"payment-gateways-helper"},getSubscriptionPageHref:{attribute:!1},getCustomerPageHref:{attribute:!1}})}get readonlySelector(){var t,e,i;const s=Boolean(null!==(e=null===(t=this.data)||void 0===t?void 0:t._links["fx:void"])&&void 0!==e?e:null===(i=this.data)||void 0===i?void 0:i._links["fx:refund"]);return new o(s?`${super.readonlySelector} billing-addresses`:`${super.readonlySelector} billing-addresses items attributes custom-fields`)}get hiddenSelector(){var t,e;const i=["billing-addresses:dialog:delete billing-addresses:dialog:timestamps"],s=null===(t=this.data)||void 0===t?void 0:t.type;return(null===(e=this.data)||void 0===e?void 0:e._links["fx:subscription"])||i.push("subscription"),"subscription_modification"===s&&i.push("actions"),"updateinfo"===s&&i.push("not=customer,subscription,payments,custom-fields,attributes"),"subscription_cancellation"===s&&i.push("not=customer,subscription,custom-fields,attributes"),new o(`${super.hiddenSelector} ${i.join(" ")}`.trim())}renderBody(){var t,e,i,o,s,a,d,l,c,u,p,m,f;let h,_,y="subtitle";const v=this.hiddenSelector,x=null===(t=this.data)||void 0===t?void 0:t.source,b=null===(e=this.data)||void 0===e?void 0:e.type;if("updateinfo"===b?y=""===x||(null==x?void 0:x.startsWith("cit_"))?"subtitle_customer_changed_payment_method":"mit_uoe"===x?"subtitle_admin_changed_payment_method_with_uoe":"mit_api"===x?"subtitle_integration_changed_payment_method":"subtitle_admin_changed_payment_method":"subscription_modification"===b?y=""===x||(null==x?void 0:x.startsWith("cit_"))?"subtitle_customer_changed_subscription":"mit_uoe"===x?"subtitle_admin_changed_subscription_with_uoe":"mit_api"===x?"subtitle_integration_changed_subscription":"subtitle_admin_changed_subscription":"subscription_renewal"===b?"mit_recurring"===x?y="subtitle_subscription_renewal_attempt":"mit_recurring_reattempt_automated"===x?y="subtitle_subscription_renewal_automated_reattempt":"mit_recurring_reattempt_manual"===x&&(y="subtitle_subscription_renewal_manual_reattempt"):"subscription_cancellation"===b?"cit_recurring_cancellation"===x?y="subtitle_customer_canceled_subscription":"mit_recurring_cancellation"===x&&(y="subtitle_admin_canceled_subscription"):(null===(i=this.data)||void 0===i?void 0:i._links["fx:subscription"])?(null==x?void 0:x.startsWith("cit_"))?y="subtitle_customer_subscribed":"mit_uoe"===x?y="subtitle_admin_subscribed_with_uoe":"mit_api"===x&&(y="subtitle_integration_subscribed"):(null==x?void 0:x.startsWith("cit_"))?y="subtitle_customer_placed_order":"mit_uoe"===x?y="subtitle_admin_placed_order_with_uoe":"mit_api"===x&&(y="subtitle_integration_placed_order"),this.data)try{const t=new URL(this.data._links["fx:shipments"].href),e=new URL(this.data._links["fx:items"].href);t.searchParams.set("zoom","items:item_category"),e.searchParams.set("zoom","item_options"),h=t.toString(),_=e.toString()}catch(t){}return n(Z||(Z=T` <h2> <div class="flex items-center gap-s leading-xs text-xxl font-medium break-all"> <foxy-i18n infer="header" key="title" .options="${0}"></foxy-i18n> <foxy-copy-to-clipboard infer="header" class="inline-block text-m" text="${0}"> </foxy-copy-to-clipboard> </div> <foxy-i18n class="block leading-xs text-l text-secondary" infer="header" key="${0}" .options="${0}"> </foxy-i18n> <foxy-internal-transaction-actions-control class="mt-xs" infer="actions"> </foxy-internal-transaction-actions-control> </h2> ${0} <foxy-internal-transaction-customer-control infer="customer"> </foxy-internal-transaction-customer-control> <div class="grid gap-s" ?hidden="${0}"> <foxy-internal-async-list-control infer="items" class="min-w-0" first="${0}" limit="10" item="foxy-item-card" form="foxy-item-form" alert .related="${0}"> </foxy-internal-async-list-control> <foxy-internal-transaction-summary-control infer="summary" class="min-w-0"> </foxy-internal-transaction-summary-control> </div> <foxy-internal-async-list-control infer="billing-addresses" first="${0}" item="foxy-billing-address-card" form="foxy-address-form" hide-create-button hide-delete-button alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="payments" first="${0}" item="foxy-payment-card" .itemProps="${0}"> </foxy-internal-async-list-control> <div class="grid gap-m sm-grid-cols-2" ?hidden="${0}"> <foxy-internal-async-list-control infer="custom-fields" class="min-w-0" first="${0}" limit="5" form="foxy-custom-field-form" item="foxy-custom-field-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" limit="5" form="foxy-attribute-form" item="foxy-attribute-card" alert> </foxy-internal-async-list-control> </div> <foxy-internal-async-list-control infer="shipments" first="${0}" item="foxy-shipment-card"> </foxy-internal-async-list-control> `),this.data,null===(o=this.data)||void 0===o?void 0:o.display_id,y,{transaction_date:null===(s=this.data)||void 0===s?void 0:s.transaction_date,ip_country:null===(a=this.data)||void 0===a?void 0:a.ip_country},["problem","pending_fraud_review","rejected","declined"].includes(null!==(l=null===(d=this.data)||void 0===d?void 0:d.status)&&void 0!==l?l:"")?n(M||(M=T` <p class="leading-xs text-body rounded bg-error-10 block" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <foxy-i18n infer="header" key="alert_status_${0}"></foxy-i18n> </p> `),null===(c=this.data)||void 0===c?void 0:c.status):"",v.matches("items",!0)&&v.matches("summary",!0),r(_),[this.href],r(null===(u=this.data)||void 0===u?void 0:u._links["fx:billing_addresses"].href),r(null===(p=this.data)||void 0===p?void 0:p._links["fx:payments"].href),{"hosted-payment-gateways-helper":this.hostedPaymentGatewaysHelper,"payment-gateways-helper":this.paymentGatewaysHelper},v.matches("custom-fields",!0)&&v.matches("attributes",!0),r(null===(m=this.data)||void 0===m?void 0:m._links["fx:custom_fields"].href),r(null===(f=this.data)||void 0===f?void 0:f._links["fx:attributes"].href),r(h))}}customElements.define("foxy-transaction",q);export{q as Transaction};
1
+ import"./foxy-billing-address-card.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-custom-field-form.js";import"./foxy-custom-field-card.js";import"./foxy-copy-to-clipboard.js";import"./foxy-shipment-card.js";import"./foxy-payment-card.js";import"./foxy-item-card.js";import"./foxy-item-form.js";import"./shared-029816d7.js";import"./shared-8201d0b5.js";import{I as t}from"./shared-ff8ca16b.js";import{I as e}from"./shared-fc15a882.js";import"./foxy-customer-card.js";import"./foxy-swipe-actions.js";import"./foxy-spinner.js";import{_ as i,B as o}from"./shared-1522d76f.js";import{g as s}from"./shared-bab2ea2c.js";import{i as r}from"./shared-d3bf9ac0.js";import{h as n,s as a}from"./shared-7f33a83a.js";import{c as d}from"./shared-4e709717.js";import"./shared-c7b3d22b.js";import"./shared-d21fa1a6.js";import{N as l}from"./shared-6a7f96c4.js";import"./foxy-nucleon-element.js";import{R as c,a as u}from"./shared-5fa697c4.js";import"./shared-2cf08dd4.js";import"./shared-e91453df.js";import"./shared-ff9791cf.js";import"./shared-43f449bb.js";import"./shared-30d00b64.js";import"./shared-30cbf0a6.js";import"./shared-343d1fd7.js";import"./shared-07e9d1fb.js";import"./shared-3ab0306f.js";import"./shared-eb116b3e.js";import"./shared-f9180815.js";import"./shared-b23c903e.js";import"./shared-9df8f842.js";import"./shared-f9a3d1ff.js";import"./shared-c9ba1b64.js";import"./shared-b509bc2c.js";import"./shared-61ade33e.js";import"./shared-9c08cfab.js";import"./shared-e39807f8.js";import"./shared-ea527e98.js";import"./shared-99c0ae04.js";import"./shared-ad34b6db.js";import"./shared-4e59fd48.js";import"./shared-2c8c4b43.js";import"./shared-11c2efc8.js";import"./shared-268571df.js";import"./shared-4c124efc.js";import"./shared-2b27e2e7.js";import"./shared-a8dc23f1.js";import"./shared-2bdc99f4.js";import"./shared-4462dc70.js";import"./shared-e83f2983.js";import"./shared-293771ba.js";import"./shared-d7be11de.js";import"./shared-4c650e5c.js";import"./shared-7dd17943.js";import"./shared-bed7aae1.js";import"./shared-8952aeac.js";import"./shared-54b0e48f.js";import"./shared-7e1953f5.js";import"./shared-6a9ae42e.js";import"./shared-20ba4cdc.js";import"./shared-ac7c5a5e.js";import"./shared-79d0699c.js";import"./shared-43e2c3f6.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-discount-builder.js";import"./shared-d519a301.js";import"./shared-bb05cfed.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-collection-page.js";import"./foxy-form-dialog.js";import"./foxy-pagination.js";let p,m,f,h,_=t=>t;customElements.define("foxy-internal-transaction-customer-control",class extends e{constructor(){super(...arguments),this.__copyEmailState="idle",this.__copyIdState="idle"}static get properties(){return i(i({},super.properties),{},{__copyEmailState:{attribute:!1},__copyIdState:{attribute:!1}})}renderControl(){var t,e,i,o;const l=this.nucleon,c=null===(t=null==l?void 0:l.data)||void 0===t?void 0:t._links["fx:customer"].href,u=c?null===(e=null==l?void 0:l.getCustomerPageHref)||void 0===e?void 0:e.call(l,c):void 0;return n(p||(p=_` <foxy-i18n infer="" class="block text-s font-medium leading-xs mb-xs" key="label"> </foxy-i18n> <foxy-swipe-actions> <a class="${0}" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)" href="${0}"> <foxy-customer-card infer="" href="${0}"></foxy-customer-card> </a> <div class="h-full grid grid-cols-2 gap-s ml-s" slot="action"> ${0} ${0} </div> </foxy-swipe-actions> `),d({"block ring-inset rounded transition-colors":!0,"ring-1 ring-contrast-10":!u,"cursor-pointer bg-contrast-5 hover-bg-contrast-10":!!u,"focus-outline-none focus-ring-2 focus-ring-primary-50":!!u}),r(u),r(c),this.__renderCopyAction(a(m||(m=_`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M9.493 2.852a.75.75 0 0 0-1.486-.204L7.545 6H4.198a.75.75 0 0 0 0 1.5h3.14l-.69 5H3.302a.75.75 0 0 0 0 1.5h3.14l-.435 3.148a.75.75 0 0 0 1.486.204L7.955 14h2.986l-.434 3.148a.75.75 0 0 0 1.486.204L12.456 14h3.346a.75.75 0 0 0 0-1.5h-3.14l.69-5h3.346a.75.75 0 0 0 0-1.5h-3.14l.435-3.148a.75.75 0 0 0-1.486-.204L12.045 6H9.059l.434-3.148ZM8.852 7.5l-.69 5h2.986l.69-5H8.852Z" clip-rule="evenodd" /></svg>`)),"copy_id_caption","__copyIdState",c?String(s(c)):""),this.__renderCopyAction(a(f||(f=_`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" style="width: 1.2rem; height: 1.2rem"><path fill-rule="evenodd" d="M5.404 14.596A6.5 6.5 0 1 1 16.5 10a1.25 1.25 0 0 1-2.5 0 4 4 0 1 0-.571 2.06A2.75 2.75 0 0 0 18 10a8 8 0 1 0-2.343 5.657.75.75 0 0 0-1.06-1.06 6.5 6.5 0 0 1-9.193 0ZM10 7.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5Z" clip-rule="evenodd" /></svg>`)),"copy_email_caption","__copyEmailState",null!==(o=null===(i=null==l?void 0:l.data)||void 0===i?void 0:i.customer_email)&&void 0!==o?o:""))}__renderCopyAction(t,e,i,o){const s=this[i],r="fail"===s?"error":"done"===s?"end":"busy";return n(h||(h=_` <button class="relative transition-colors bg-contrast-5 text-body hover-bg-contrast-10 rounded h-full py-0 px-m focus-outline-none focus-ring-2 focus-ring-inset focus-ring-primary-50" ?disabled="${0}" @click="${0}" @focusout="${0}" @mouseout="${0}"> <div class="${0}"> ${0} <foxy-i18n class="mt-xs text-s font-medium leading-none" infer="" key="${0}"> </foxy-i18n> </div> <div class="${0}"> <foxy-spinner layout="no-label" state="${0}" infer="spinner"> </foxy-spinner> </div> </button> `),"idle"!==s,(()=>"idle"===s&&this.__copy(o,i)),(t=>"idle"!==s&&t.stopPropagation()),(t=>"idle"!==s&&t.stopPropagation()),d({"relative flex flex-col items-center justify-center transition-opacity":!0,"opacity-0":"idle"!==s}),t,e,d({"absolute inset-0 flex items-center justify-center transition-opacity":!0,"opacity-0":"idle"===s}),r)}async __copy(t,e){this[e]="busy";try{await navigator.clipboard.writeText(t),this[e]="done"}catch(t){this[e]="fail"}setTimeout((()=>this[e]="idle"),3e3)}});let y,v=t=>t;customElements.define("foxy-internal-transaction-post-action-control",class extends e{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return i(i({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const t=this.__state,e="fail"===t?"error":"idle"===t?this.theme:"";return n(y||(y=v` <foxy-internal-confirm-dialog header="header" infer="confirm" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button class="w-full" theme="${0} tertiary-inline" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),(t=>!t.detail.cancelled&&this.__submit()),e,"busy"===t||this.disabled,(t=>{this.renderRoot.querySelector("#confirm").show(t.currentTarget)}),t)}async __submit(){var t;if("busy"!==this.__state)try{this.__state="busy";const e=new l.API(this),i=await e.fetch(null!==(t=this.href)&&void 0!==t?t:"",{method:"POST"});this.__state=i.ok?"idle":"fail",i.ok&&this.dispatchEvent(new CustomEvent("done"))}catch(t){this.__state="fail"}}});let x,b,g,j,$,w,k=t=>t;customElements.define("foxy-internal-transaction-actions-control",class extends e{renderControl(){var t,e,i,o,s,r,a,d,l,c;return n(x||(x=k` <div class="flex flex-wrap gap-x-m gap-y-xs"> ${0} ${0} ${0} ${0} ${0} </div> `),(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:capture"])?this.__renderCaptureAction():"",(null===(o=null===(i=this.nucleon)||void 0===i?void 0:i.data)||void 0===o?void 0:o._links["fx:void"])?this.__renderVoidAction():"",(null===(r=null===(s=this.nucleon)||void 0===s?void 0:s.data)||void 0===r?void 0:r._links["fx:refund"])?this.__renderRefundAction():"",(null===(d=null===(a=this.nucleon)||void 0===a?void 0:a.data)||void 0===d?void 0:d._links["fx:send_emails"])?this.__renderSendEmailsAction():"",(null===(c=null===(l=this.nucleon)||void 0===l?void 0:l.data)||void 0===c?void 0:c._links["fx:subscription"])?this.__renderSubscriptionAction():"")}__renderSendEmailsAction(){var t,e;return n(b||(b=k` <foxy-internal-transaction-post-action-control infer="send-emails" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),r(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:send_emails"].href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderCaptureAction(){var t,e;return n(g||(g=k` <foxy-internal-transaction-post-action-control theme="success" infer="capture" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),r(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:capture"].href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderVoidAction(){var t,e,i;return n(j||(j=k` <foxy-internal-transaction-post-action-control theme="error" infer="void" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),r(null===(i=null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:void"])||void 0===i?void 0:i.href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderRefundAction(){var t,e,i;return n($||($=k` <foxy-internal-transaction-post-action-control infer="refund" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),r(null===(i=null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:refund"])||void 0===i?void 0:i.href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderSubscriptionAction(){var t,e,i;const o=this.nucleon,s=null===(e=null===(t=null==o?void 0:o.data)||void 0===t?void 0:t._links["fx:subscription"])||void 0===e?void 0:e.href,a=s?null===(i=null==o?void 0:o.getSubscriptionPageHref)||void 0===i?void 0:i.call(o,s):void 0;return n(w||(w=k` <a class="rounded text-m font-medium text-primary cursor-pointer transition-opacity hover-opacity-80 focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="subscription" key="caption"></foxy-i18n> </a> `),r(a))}});let S,P,H,A,C,E,L,I,R,G,B=t=>t;customElements.define("foxy-internal-transaction-summary-control",class extends e{constructor(){super(...arguments),this.__storeLoaderId="storeLoader"}renderControl(){var t,e,i,o,s,a,d,l,c;const u=null===(t=this.nucleon)||void 0===t?void 0:t.data;if(!u)return n(S||(S=B``));const p=null!==(i=null===(e=null==u?void 0:u._embedded)||void 0===e?void 0:e["fx:applied_taxes"])&&void 0!==i?i:[],m=null!==(s=null===(o=u._embedded)||void 0===o?void 0:o["fx:shipments"])&&void 0!==s?s:[];return n(P||(P=B` <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <p class="grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 2px);grid-template-columns:1fr min-content"> <span><foxy-i18n key="subtotal" infer=""></foxy-i18n>&colon;</span> <span>${0}</span> ${0} ${0} ${0} ${0} <span class="col-span-2 border-t border-dashed border-contrast-20 my-s"></span> <span class="col-span-2 flex gap-s justify-between items-center"> ${0} <span class="text-xl font-medium leading-xs"> <foxy-i18n infer="" key="total"></foxy-i18n>&colon; ${0} </span> </span> </p> `),r(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__renderPrice(u.total_item_price),0===m.length||0===u.total_shipping?n(H||(H=B` <span><foxy-i18n infer="" key="total_shipping"></foxy-i18n>&colon;</span> <span>${0} </span> `),this.__renderPrice(u.total_shipping,!0)):m.map((t=>n(A||(A=B` <span>${0}&colon;</span> <span>${0}</span> `),t.shipping_service_description,this.__renderPrice(t.total_shipping,!0)))),0===p.length||0===u.total_tax?n(C||(C=B` <span><foxy-i18n infer="" key="total_tax"></foxy-i18n>&colon;</span> <span>${0}</span> `),this.__renderPrice(u.total_tax,!0)):p.map((t=>n(E||(E=B` <span>${0}&colon;</span> <span>${0}</span> `),t.name,this.__renderPrice(t.amount,!0)))),null===(d=null===(a=null==u?void 0:u._embedded)||void 0===a?void 0:a["fx:applied_gift_card_codes"])||void 0===d?void 0:d.map((t=>{var e;return n(L||(L=B` <span>${0}&colon;</span> <span>${0}</span> `),t._embedded["fx:gift_card"].name,this.__renderPrice(null!==(e=t.balance_adjustment)&&void 0!==e?e:0,!0))})),null===(c=null===(l=null==u?void 0:u._embedded)||void 0===l?void 0:l["fx:discounts"])||void 0===c?void 0:c.map((t=>n(I||(I=B` <span data-testclass="discount">${0}&colon;</span> <span>${0}</span> `),t.name,this.__renderPrice(t.amount,!0)))),this.__renderStatus(),this.__renderPrice(u.total_order))}get __storeHref(){var t,e,i;return null===(i=null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e._links["fx:store"])||void 0===i?void 0:i.href}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}__renderPrice(t,e=!1){var i,o,s;const r=(null===(i=this.__store)||void 0===i?void 0:i.use_international_currency_symbol)?"code":"symbol",a=null===(s=null===(o=this.nucleon)||void 0===o?void 0:o.data)||void 0===s?void 0:s.currency_code;return n(R||(R=B` <foxy-i18n class="${0}" infer="" key="price" .options="${0}"> </foxy-i18n> `),e&&0!==t?t>0?"text-success":"text-error":"",{currencyDisplay:r,signDisplay:e?"exceptZero":"auto",amount:`${t} ${a}`})}__renderStatus(){var t,e;const i=(null===(e=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===e?void 0:e.status)||"completed";let o="";return o=["capturing","captured","approved","authorized","pending"].includes(i)?"text-success bg-success-10":i&&"completed"!==i?["problem","pending_fraud_review","rejected","declined"].includes(i)?"text-error-contrast bg-error":"bg-contrast-5 text-body":"text-success-contrast bg-success",n(G||(G=B` <foxy-i18n infer="" class="${0} rounded-s py-xs px-s font-medium text-s leading-xs" key="status_${0}"></foxy-i18n> `),o,i)}});let Z,M,T=t=>t;const W=c(u(t,"transaction"));class q extends W{constructor(){super(...arguments),this.hostedPaymentGatewaysHelper=null,this.paymentGatewaysHelper=null,this.getSubscriptionPageHref=null,this.getCustomerPageHref=null}static get properties(){return i(i({},super.properties),{},{hostedPaymentGatewaysHelper:{attribute:"hosted-payment-gateways-helper"},paymentGatewaysHelper:{attribute:"payment-gateways-helper"},getSubscriptionPageHref:{attribute:!1},getCustomerPageHref:{attribute:!1}})}get readonlySelector(){var t,e,i;const s=Boolean(null!==(e=null===(t=this.data)||void 0===t?void 0:t._links["fx:void"])&&void 0!==e?e:null===(i=this.data)||void 0===i?void 0:i._links["fx:refund"]);return new o(s?`${super.readonlySelector} billing-addresses`:`${super.readonlySelector} billing-addresses items attributes custom-fields`)}get hiddenSelector(){var t,e;const i=["billing-addresses:dialog:delete billing-addresses:dialog:timestamps"],s=null===(t=this.data)||void 0===t?void 0:t.type;return(null===(e=this.data)||void 0===e?void 0:e._links["fx:subscription"])||i.push("subscription"),"subscription_modification"===s&&i.push("actions"),"updateinfo"===s&&i.push("not=customer,subscription,payments,custom-fields,attributes"),"subscription_cancellation"===s&&i.push("not=customer,subscription,custom-fields,attributes"),new o(`${super.hiddenSelector} ${i.join(" ")}`.trim())}renderBody(){var t,e,i,o,s,a,d,l,c,u,p,m,f;let h,_,y="subtitle";const v=this.hiddenSelector,x=null===(t=this.data)||void 0===t?void 0:t.source,b=null===(e=this.data)||void 0===e?void 0:e.type;if("updateinfo"===b?y=!x||(null==x?void 0:x.startsWith("cit_"))?"subtitle_customer_changed_payment_method":"mit_uoe"===x?"subtitle_admin_changed_payment_method_with_uoe":"mit_api"===x?"subtitle_integration_changed_payment_method":"subtitle_admin_changed_payment_method":"subscription_modification"===b?y=!x||(null==x?void 0:x.startsWith("cit_"))?"subtitle_customer_changed_subscription":"mit_uoe"===x?"subtitle_admin_changed_subscription_with_uoe":"mit_api"===x?"subtitle_integration_changed_subscription":"subtitle_admin_changed_subscription":"subscription_renewal"===b?"mit_recurring"===x?y="subtitle_subscription_renewal_attempt":"mit_recurring_reattempt_automated"===x?y="subtitle_subscription_renewal_automated_reattempt":"mit_recurring_reattempt_manual"===x&&(y="subtitle_subscription_renewal_manual_reattempt"):"subscription_cancellation"===b?"cit_recurring_cancellation"===x?y="subtitle_customer_canceled_subscription":"mit_recurring_cancellation"===x&&(y="subtitle_admin_canceled_subscription"):(null===(i=this.data)||void 0===i?void 0:i._links["fx:subscription"])?(null==x?void 0:x.startsWith("cit_"))?y="subtitle_customer_subscribed":"mit_uoe"===x?y="subtitle_admin_subscribed_with_uoe":"mit_api"===x&&(y="subtitle_integration_subscribed"):(null==x?void 0:x.startsWith("cit_"))?y="subtitle_customer_placed_order":"mit_uoe"===x?y="subtitle_admin_placed_order_with_uoe":"mit_api"===x&&(y="subtitle_integration_placed_order"),this.data)try{const t=new URL(this.data._links["fx:shipments"].href),e=new URL(this.data._links["fx:items"].href);t.searchParams.set("zoom","items:item_category"),e.searchParams.set("zoom","item_options"),h=t.toString(),_=e.toString()}catch(t){}return n(Z||(Z=T` <h2> <div class="flex items-center gap-s leading-xs text-xxl font-medium break-all"> <foxy-i18n infer="header" key="title" .options="${0}"></foxy-i18n> <foxy-copy-to-clipboard infer="header" class="inline-block text-m" text="${0}"> </foxy-copy-to-clipboard> </div> <foxy-i18n class="block leading-xs text-l text-secondary" infer="header" key="${0}" .options="${0}"> </foxy-i18n> <foxy-internal-transaction-actions-control class="mt-xs" infer="actions"> </foxy-internal-transaction-actions-control> </h2> ${0} <foxy-internal-transaction-customer-control infer="customer"> </foxy-internal-transaction-customer-control> <div class="grid gap-s" ?hidden="${0}"> <foxy-internal-async-list-control infer="items" class="min-w-0" first="${0}" limit="10" item="foxy-item-card" form="foxy-item-form" alert .related="${0}"> </foxy-internal-async-list-control> <foxy-internal-transaction-summary-control infer="summary" class="min-w-0"> </foxy-internal-transaction-summary-control> </div> <foxy-internal-async-list-control infer="billing-addresses" first="${0}" item="foxy-billing-address-card" form="foxy-address-form" hide-create-button hide-delete-button alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="payments" first="${0}" item="foxy-payment-card" .itemProps="${0}"> </foxy-internal-async-list-control> <div class="grid gap-m sm-grid-cols-2" ?hidden="${0}"> <foxy-internal-async-list-control infer="custom-fields" class="min-w-0" first="${0}" limit="5" form="foxy-custom-field-form" item="foxy-custom-field-card" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" limit="5" form="foxy-attribute-form" item="foxy-attribute-card" alert> </foxy-internal-async-list-control> </div> <foxy-internal-async-list-control infer="shipments" first="${0}" item="foxy-shipment-card"> </foxy-internal-async-list-control> `),this.data,null===(o=this.data)||void 0===o?void 0:o.display_id,y,{transaction_date:null===(s=this.data)||void 0===s?void 0:s.transaction_date,ip_country:null===(a=this.data)||void 0===a?void 0:a.ip_country},["problem","pending_fraud_review","rejected","declined"].includes(null!==(l=null===(d=this.data)||void 0===d?void 0:d.status)&&void 0!==l?l:"")?n(M||(M=T` <p class="leading-xs text-body rounded bg-error-10 block" style="padding:calc(.625em + (var(--lumo-border-radius)/ 4) - 1px)"> <foxy-i18n infer="header" key="alert_status_${0}"></foxy-i18n> </p> `),null===(c=this.data)||void 0===c?void 0:c.status):"",v.matches("items",!0)&&v.matches("summary",!0),r(_),[this.href],r(null===(u=this.data)||void 0===u?void 0:u._links["fx:billing_addresses"].href),r(null===(p=this.data)||void 0===p?void 0:p._links["fx:payments"].href),{"hosted-payment-gateways-helper":this.hostedPaymentGatewaysHelper,"payment-gateways-helper":this.paymentGatewaysHelper},v.matches("custom-fields",!0)&&v.matches("attributes",!0),r(null===(m=this.data)||void 0===m?void 0:m._links["fx:custom_fields"].href),r(null===(f=this.data)||void 0===f?void 0:f._links["fx:attributes"].href),r(h))}}customElements.define("foxy-transaction",q);export{q as Transaction};
@@ -1,3 +1,4 @@
1
+ import type { TemplateResult } from 'lit-html';
1
2
  import type { Data } from './types';
2
3
  import { InternalCard } from '../../internal/InternalCard/InternalCard';
3
4
  declare const Base: typeof InternalCard & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
@@ -10,6 +11,6 @@ declare const Base: typeof InternalCard & import("lit-element").Constructor<impo
10
11
  * @since 1.25.0
11
12
  */
12
13
  export declare class BillingAddressCard extends Base<Data> {
13
- renderBody(): import("lit-html").TemplateResult;
14
+ renderBody(): TemplateResult;
14
15
  }
15
16
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"BillingAddressCard.js","sourceRoot":"","sources":["../../../../src/elements/public/BillingAddressCard/BillingAddressCard.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,sBAAsB,CAAC;AAClC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,OAAO,kBAAmB,SAAQ,IAAU;IAChD,UAAU;QACR,OAAO,IAAI,CAAA;;;yDAG0C,IAAI,CAAC,IAAI;;;;4DAIN,IAAI,CAAC,IAAI;;;;KAIhE,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { html } from 'lit-html';\n\nconst NS = 'billing-address-card';\nconst Base = TranslatableMixin(InternalCard, NS);\n\n/**\n * Card element representing a `fx:billing_address` resource.\n *\n * @element foxy-billing-address-card\n * @since 1.25.0\n */\nexport class BillingAddressCard extends Base<Data> {\n renderBody() {\n return html`\n <section class=\"leading-none space-y-xs font-lumo\">\n <p class=\"text-m text-body font-medium truncate\">\n <foxy-i18n infer=\"\" key=\"full_name\" .options=${this.data}></foxy-i18n>\n &ZeroWidthSpace;\n </p>\n <p class=\"text-s text-secondary truncate\">\n <foxy-i18n infer=\"\" key=\"full_address\" .options=${this.data}></foxy-i18n>\n &ZeroWidthSpace;\n </p>\n </section>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"BillingAddressCard.js","sourceRoot":"","sources":["../../../../src/elements/public/BillingAddressCard/BillingAddressCard.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,sBAAsB,CAAC;AAClC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,OAAO,kBAAmB,SAAQ,IAAU;IAChD,UAAU;QACR,OAAO,IAAI,CAAA;;;yDAG0C,IAAI,CAAC,IAAI;;;;4DAIN,IAAI,CAAC,IAAI;;;;KAIhE,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { TemplateResult } from 'lit-html';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { html } from 'lit-html';\n\nconst NS = 'billing-address-card';\nconst Base = TranslatableMixin(InternalCard, NS);\n\n/**\n * Card element representing a `fx:billing_address` resource.\n *\n * @element foxy-billing-address-card\n * @since 1.25.0\n */\nexport class BillingAddressCard extends Base<Data> {\n renderBody(): TemplateResult {\n return html`\n <section class=\"leading-none space-y-xs font-lumo\">\n <p class=\"text-m text-body font-medium truncate\">\n <foxy-i18n infer=\"\" key=\"full_name\" .options=${this.data}></foxy-i18n>\n &ZeroWidthSpace;\n </p>\n <p class=\"text-s text-secondary truncate\">\n <foxy-i18n infer=\"\" key=\"full_address\" .options=${this.data}></foxy-i18n>\n &ZeroWidthSpace;\n </p>\n </section>\n `;\n }\n}\n"]}
@@ -1,7 +1,3 @@
1
- import { Rels } from '@foxy.io/sdk/backend';
2
- import { Resource } from '@foxy.io/sdk/core';
3
- export declare type Data = Resource<Rels.Coupon> & {
4
- customer_auto_apply: boolean;
5
- customer_attribute_restrictions: string;
6
- customer_subscription_restrictions: string;
7
- };
1
+ import type { Resource } from '@foxy.io/sdk/core';
2
+ import type { Rels } from '@foxy.io/sdk/backend';
3
+ export declare type Data = Resource<Rels.Coupon>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/CouponForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\n\n// TODO: simplify the type below once the SDK is updated\n\nexport type Data = Resource<Rels.Coupon> & {\n customer_auto_apply: boolean;\n customer_attribute_restrictions: string;\n customer_subscription_restrictions: string;\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/CouponForm/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nexport type Data = Resource<Rels.Coupon>;\n"]}
@@ -160,7 +160,7 @@ export class InternalCustomerPortalSubscriptions extends Base {
160
160
  ?disabled=${ctx.data === null}
161
161
  @click=${(evt) => {
162
162
  const url = new URL(ctx.href);
163
- url.searchParams.set('zoom', 'last_transaction,transaction_template:items');
163
+ url.searchParams.set('zoom', 'transaction_template:items');
164
164
  this.__subscriptionDialog.href = url.toString();
165
165
  this.__subscriptionDialog.show(evt.currentTarget);
166
166
  }}
@@ -269,7 +269,7 @@ export class InternalCustomerPortalSubscriptions extends Base {
269
269
  get __activeSubscriptionsLink() {
270
270
  try {
271
271
  const url = new URL(this.customer._links['fx:subscriptions'].href);
272
- url.searchParams.set('zoom', 'last_transaction,transaction_template:items');
272
+ url.searchParams.set('zoom', 'transaction_template:items');
273
273
  return url.toString();
274
274
  }
275
275
  catch (_a) {
@@ -1 +1 @@
1
- {"version":3,"file":"InternalCustomerPortalSubscriptions.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAY,wCAAqC;AAE3E,OAAO,EAAE,UAAU,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAMrF,OAAO,EAAE,eAAe,EAAY,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAE7D,MAAM,IAAI,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/F,MAAM,OAAO,mCAAoC,SAAQ,IAAI;IAA7D;;QAUE,aAAQ,GAAiD,IAAI,CAAC;QAE9D,aAAQ,GAA2B,IAAI,CAAC;QAExC,UAAK,GAAG,EAAE,CAAC;QAEM,oCAA+B,GAA+B,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;;YAC5F,MAAM,QAAQ,GAAG,CAAC,QAAC,IAAI,CAAC,IAAI,0CAAE,QAAQ,CAAA,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YAC/F,IAAI,WAAW,GAAG,EAAE,CAAC;YAErB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B,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACxB,CAAC;IACJ,CAAC;IAkQD,MAAM;QACJ,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE;UACxE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE;;KAEzE,CAAC;IACJ,CAAC;IAED,IAAY,oBAAoB;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,sBAAsB,CAAe,CAAC;IAC7E,CAAC;IAED,IAAY,yBAAyB;QACnC,IAAI;YACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC;YACpE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,6CAA6C,CAAC,CAAC;YAC5E,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;SACvB;QAAC,WAAM;YACN,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CACF","sourcesContent":["import { ConfigurableMixin, Renderer } from '../../../mixins/configurable';\nimport { Graph, Rels } from '@foxy.io/sdk/customer';\nimport { LitElement, PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { FormDialog } from '../FormDialog/FormDialog';\nimport { FormRendererContext } from '../FormDialog/types';\nimport { ItemRenderer } from '../CollectionPage/types';\nimport { PageRenderer } from '../CollectionPages/types';\nimport { BooleanSelector, Resource } from '@foxy.io/sdk/core';\nimport { SubscriptionForm } from '../SubscriptionForm/SubscriptionForm';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { InferrableMixin } from '../../../mixins/inferrable';\n\nconst Base = TranslatableMixin(ConfigurableMixin(ThemeableMixin(InferrableMixin(LitElement))));\n\nexport class InternalCustomerPortalSubscriptions extends Base {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n settings: { attribute: false },\n customer: { attribute: false },\n group: { type: String },\n };\n }\n\n settings: Resource<Rels.CustomerPortalSettings> | null = null;\n\n customer: Resource<Graph> | null = null;\n\n group = '';\n\n private readonly __renderFormHeaderActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n let billingLink = '';\n\n if (!hasEnded && host.in({ idle: 'snapshot' })) {\n const link = host.data._links['fx:sub_token_url'].href;\n const updateBillingURL = new URL(link);\n\n updateBillingURL.searchParams.set('cart', 'checkout');\n updateBillingURL.searchParams.set('sub_restart', 'auto');\n billingLink = updateBillingURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:update\"\n href=${billingLink}\n icon=\"icons:credit-card\"\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_billing\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:update:after')}\n `;\n };\n\n private readonly __renderFormHeaderActionsEnd: Renderer<SubscriptionForm> = (html, host) => {\n const hasEndDate = !!host.data?.end_date;\n let cancelLink = '';\n\n if (!hasEndDate && host.in({ idle: 'snapshot' })) {\n const cancelURL = new URL(host.data._links['fx:sub_token_url'].href);\n\n cancelURL.searchParams.set('sub_cancel', 'true');\n cancelLink = cancelURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:end:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:end\"\n href=${cancelLink}\n icon=\"icons:block\"\n ?disabled=${hasEndDate || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"end_subscription\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:end:after')}\n `;\n };\n\n private readonly __renderFormHeaderActions: Renderer<SubscriptionForm> = (html, host) => {\n const isUpdateActionHidden = host.hiddenSelector.matches('header:actions:update');\n const isEndActionHidden = host.hiddenSelector.matches('header:actions:end');\n\n return html`\n <style>\n main {\n display: flex;\n justify-content: space-between;\n padding-top: var(--lumo-space-xs);\n margin-top: var(--lumo-space-s);\n border-top: 1px solid var(--lumo-contrast-10pct);\n color: var(--lumo-secondary-color);\n }\n </style>\n\n ${host.renderTemplateOrSlot('header:actions:before')}\n\n <main data-testid=\"header:actions\">\n ${isUpdateActionHidden ? '' : this.__renderFormHeaderActionsUpdate(html, host)}\n ${isEndActionHidden ? '' : this.__renderFormHeaderActionsEnd(html, host)}\n </main>\n\n ${host.renderTemplateOrSlot('header:actions:after')}\n `;\n };\n\n private readonly __renderFormItemsActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const itemsLink = host.data?._links['fx:sub_modification_url']?.href ?? '';\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n\n return html`\n ${host.renderTemplateOrSlot('items:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"items:actions:update\"\n class=\"text-primary\"\n href=${itemsLink}\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_items\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('items:actions:update:after')}\n `;\n };\n\n private readonly __renderForm = (ctx: FormRendererContext) => {\n const templates = { ...ctx.dialog.templates };\n const originalHeaderAfterRenderer = templates['header:after'];\n const originalItemsActionsAfterRenderer = templates['items:actions:after'];\n\n templates['header:after'] = (html, host) => {\n const actionsHidden = host.hiddenSelector.matches('header:actions', true);\n return html`\n ${actionsHidden ? '' : this.__renderFormHeaderActions(html, host)}\n ${originalHeaderAfterRenderer?.(html, host)}\n `;\n };\n\n templates['items:actions:after'] = (html, host) => {\n const hasUpdateLink = !!host.data?._links['fx:sub_modification_url'];\n const isUpdateHidden = host.hiddenSelector.matches('items:actions:update', true);\n const isUpdateRendered = hasUpdateLink && !isUpdateHidden;\n\n return html`\n ${isUpdateRendered ? this.__renderFormItemsActionsUpdate(html, host) : ''}\n ${originalItemsActionsAfterRenderer?.(html, host)}\n `;\n };\n\n return html`\n <foxy-subscription-form\n disabledcontrols=${ctx.dialog.disabledControls.toString()}\n readonlycontrols=${ctx.dialog.readonlyControls.toString()}\n hiddencontrols=${new BooleanSelector(\n `attributes timestamps start-date past-due-amount customer ${ctx.dialog.hiddenSelector}`\n )}\n settings=${JSON.stringify(this.settings)}\n parent=${ctx.dialog.parent}\n group=${ctx.dialog.group}\n lang=${ctx.dialog.lang}\n href=${ctx.dialog.href}\n ns=\"${ctx.dialog.ns} ${customElements.get('foxy-subscription-form')?.defaultNS ?? ''}\"\n id=\"form\"\n .templates=${templates}\n @update=${ctx.handleUpdate}\n @fetch=${ctx.handleFetch}\n >\n </foxy-subscription-form>\n `;\n };\n\n private readonly __renderPageItem: ItemRenderer = ({ html, ...ctx }) => {\n return html`\n <button\n class=${classMap({\n 'block w-full border border-contrast-10 p-m rounded-t-l rounded-b-l': true,\n 'focus-outline-none focus-border-primary': true,\n 'hover-border-contrast-30': ctx.data !== null,\n })}\n ?disabled=${ctx.data === null}\n @click=${(evt: Event) => {\n const url = new URL(ctx.href);\n url.searchParams.set('zoom', 'last_transaction,transaction_template:items');\n this.__subscriptionDialog.href = url.toString();\n this.__subscriptionDialog.show(evt.currentTarget as HTMLButtonElement);\n }}\n >\n <foxy-subscription-card\n hiddencontrols=\"email\"\n parent=${ctx.parent}\n group=${ctx.group}\n lang=${ctx.lang}\n href=${ctx.href}\n ns=\"${ctx.ns} ${customElements.get('foxy-subscription-card')?.defaultNS ?? ''}\"\n .templates=${ctx.templates}\n >\n </foxy-subscription-card>\n </button>\n `;\n };\n\n private readonly __renderPage: PageRenderer<any> = ({ html, ...ctx }) => {\n return html`\n <foxy-collection-page\n ns=${ctx.ns}\n href=${ctx.href}\n lang=${ctx.lang}\n group=${ctx.group}\n class=\"space-y-m\"\n .item=${this.__renderPageItem}\n .templates=${ctx.templates}\n >\n </foxy-collection-page>\n `;\n };\n\n private readonly __renderHeader = () => {\n return html`\n ${this.renderTemplateOrSlot('header:before')}\n\n <foxy-i18n\n class=\"block text-l font-medium\"\n lang=${this.lang}\n key=\"subscription_plural\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('header:after')}\n `;\n };\n\n private readonly __renderList = () => {\n const disabledSelector = this.disabledSelector.zoom('list');\n const readonlySelector = this.readonlySelector.zoom('list');\n const hiddenSelector = this.hiddenSelector.zoom('list');\n const extendedHiddenControlsArray = [hiddenSelector.zoom('form').toString(), 'end-date'];\n\n return html`\n ${this.renderTemplateOrSlot('list:before')}\n\n <foxy-form-dialog\n readonlycontrols=${readonlySelector.zoom('form').toString()}\n disabledcontrols=${disabledSelector.zoom('form').toString()}\n hiddencontrols=${extendedHiddenControlsArray.join(' ').trim()}\n header=\"update\"\n parent=${ifDefined(this.customer?._links['fx:subscriptions'].href)}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n id=\"subscription-dialog\"\n .form=${this.__renderForm}\n .templates=${this.getNestedTemplates('list:form')}\n >\n </foxy-form-dialog>\n\n <foxy-collection-pages\n class=\"block space-y-m\"\n first=${this.__activeSubscriptionsLink}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n manual\n .page=${this.__renderPage}\n .templates=${this.getNestedTemplates('list:card')}\n >\n </foxy-collection-pages>\n\n ${this.renderTemplateOrSlot('list:after')}\n `;\n };\n\n render(): TemplateResult {\n return html`\n <div class=\"space-y-s\" data-testid=\"subscriptions\">\n ${this.hiddenSelector.matches('header', true) ? '' : this.__renderHeader()}\n ${this.hiddenSelector.matches('list', true) ? '' : this.__renderList()}\n </div>\n `;\n }\n\n private get __subscriptionDialog() {\n return this.renderRoot.querySelector('#subscription-dialog') as FormDialog;\n }\n\n private get __activeSubscriptionsLink() {\n try {\n const url = new URL(this.customer!._links['fx:subscriptions'].href);\n url.searchParams.set('zoom', 'last_transaction,transaction_template:items');\n return url.toString();\n } catch {\n return '';\n }\n }\n}\n"]}
1
+ {"version":3,"file":"InternalCustomerPortalSubscriptions.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomerPortal/InternalCustomerPortalSubscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAY,wCAAqC;AAE3E,OAAO,EAAE,UAAU,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAMrF,OAAO,EAAE,eAAe,EAAY,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAE7D,MAAM,IAAI,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAE/F,MAAM,OAAO,mCAAoC,SAAQ,IAAI;IAA7D;;QAUE,aAAQ,GAAiD,IAAI,CAAC;QAE9D,aAAQ,GAA2B,IAAI,CAAC;QAExC,UAAK,GAAG,EAAE,CAAC;QAEM,oCAA+B,GAA+B,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;;YAC5F,MAAM,QAAQ,GAAG,CAAC,QAAC,IAAI,CAAC,IAAI,0CAAE,QAAQ,CAAA,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CA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,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC9B,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE;YAC9B,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACxB,CAAC;IACJ,CAAC;IAkQD,MAAM;QACJ,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,EAAE;UACxE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE;;KAEzE,CAAC;IACJ,CAAC;IAED,IAAY,oBAAoB;QAC9B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,sBAAsB,CAAe,CAAC;IAC7E,CAAC;IAED,IAAY,yBAAyB;QACnC,IAAI;YACF,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,CAAC;YACpE,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;YAC3D,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;SACvB;QAAC,WAAM;YACN,OAAO,EAAE,CAAC;SACX;IACH,CAAC;CACF","sourcesContent":["import { ConfigurableMixin, Renderer } from '../../../mixins/configurable';\nimport { Graph, Rels } from '@foxy.io/sdk/customer';\nimport { LitElement, PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { FormDialog } from '../FormDialog/FormDialog';\nimport { FormRendererContext } from '../FormDialog/types';\nimport { ItemRenderer } from '../CollectionPage/types';\nimport { PageRenderer } from '../CollectionPages/types';\nimport { BooleanSelector, Resource } from '@foxy.io/sdk/core';\nimport { SubscriptionForm } from '../SubscriptionForm/SubscriptionForm';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { InferrableMixin } from '../../../mixins/inferrable';\n\nconst Base = TranslatableMixin(ConfigurableMixin(ThemeableMixin(InferrableMixin(LitElement))));\n\nexport class InternalCustomerPortalSubscriptions extends Base {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n settings: { attribute: false },\n customer: { attribute: false },\n group: { type: String },\n };\n }\n\n settings: Resource<Rels.CustomerPortalSettings> | null = null;\n\n customer: Resource<Graph> | null = null;\n\n group = '';\n\n private readonly __renderFormHeaderActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n let billingLink = '';\n\n if (!hasEnded && host.in({ idle: 'snapshot' })) {\n const link = host.data._links['fx:sub_token_url'].href;\n const updateBillingURL = new URL(link);\n\n updateBillingURL.searchParams.set('cart', 'checkout');\n updateBillingURL.searchParams.set('sub_restart', 'auto');\n billingLink = updateBillingURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:update\"\n href=${billingLink}\n icon=\"icons:credit-card\"\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_billing\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:update:after')}\n `;\n };\n\n private readonly __renderFormHeaderActionsEnd: Renderer<SubscriptionForm> = (html, host) => {\n const hasEndDate = !!host.data?.end_date;\n let cancelLink = '';\n\n if (!hasEndDate && host.in({ idle: 'snapshot' })) {\n const cancelURL = new URL(host.data._links['fx:sub_token_url'].href);\n\n cancelURL.searchParams.set('sub_cancel', 'true');\n cancelLink = cancelURL.toString();\n }\n\n return html`\n ${host.renderTemplateOrSlot('header:actions:end:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"header:actions:end\"\n href=${cancelLink}\n icon=\"icons:block\"\n ?disabled=${hasEndDate || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"end_subscription\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('header:actions:end:after')}\n `;\n };\n\n private readonly __renderFormHeaderActions: Renderer<SubscriptionForm> = (html, host) => {\n const isUpdateActionHidden = host.hiddenSelector.matches('header:actions:update');\n const isEndActionHidden = host.hiddenSelector.matches('header:actions:end');\n\n return html`\n <style>\n main {\n display: flex;\n justify-content: space-between;\n padding-top: var(--lumo-space-xs);\n margin-top: var(--lumo-space-s);\n border-top: 1px solid var(--lumo-contrast-10pct);\n color: var(--lumo-secondary-color);\n }\n </style>\n\n ${host.renderTemplateOrSlot('header:actions:before')}\n\n <main data-testid=\"header:actions\">\n ${isUpdateActionHidden ? '' : this.__renderFormHeaderActionsUpdate(html, host)}\n ${isEndActionHidden ? '' : this.__renderFormHeaderActionsEnd(html, host)}\n </main>\n\n ${host.renderTemplateOrSlot('header:actions:after')}\n `;\n };\n\n private readonly __renderFormItemsActionsUpdate: Renderer<SubscriptionForm> = (html, host) => {\n const itemsLink = host.data?._links['fx:sub_modification_url']?.href ?? '';\n const hasEnded = !!host.data?.end_date && new Date(host.data.end_date).getTime() <= Date.now();\n\n return html`\n ${host.renderTemplateOrSlot('items:actions:update:before')}\n\n <foxy-internal-customer-portal-link\n data-testid=\"items:actions:update\"\n class=\"text-primary\"\n href=${itemsLink}\n ?disabled=${hasEnded || !host.in('idle')}\n >\n <foxy-i18n lang=${host.lang} key=\"update_items\" ns=${host.ns}></foxy-i18n>\n </foxy-internal-customer-portal-link>\n\n ${host.renderTemplateOrSlot('items:actions:update:after')}\n `;\n };\n\n private readonly __renderForm = (ctx: FormRendererContext) => {\n const templates = { ...ctx.dialog.templates };\n const originalHeaderAfterRenderer = templates['header:after'];\n const originalItemsActionsAfterRenderer = templates['items:actions:after'];\n\n templates['header:after'] = (html, host) => {\n const actionsHidden = host.hiddenSelector.matches('header:actions', true);\n return html`\n ${actionsHidden ? '' : this.__renderFormHeaderActions(html, host)}\n ${originalHeaderAfterRenderer?.(html, host)}\n `;\n };\n\n templates['items:actions:after'] = (html, host) => {\n const hasUpdateLink = !!host.data?._links['fx:sub_modification_url'];\n const isUpdateHidden = host.hiddenSelector.matches('items:actions:update', true);\n const isUpdateRendered = hasUpdateLink && !isUpdateHidden;\n\n return html`\n ${isUpdateRendered ? this.__renderFormItemsActionsUpdate(html, host) : ''}\n ${originalItemsActionsAfterRenderer?.(html, host)}\n `;\n };\n\n return html`\n <foxy-subscription-form\n disabledcontrols=${ctx.dialog.disabledControls.toString()}\n readonlycontrols=${ctx.dialog.readonlyControls.toString()}\n hiddencontrols=${new BooleanSelector(\n `attributes timestamps start-date past-due-amount customer ${ctx.dialog.hiddenSelector}`\n )}\n settings=${JSON.stringify(this.settings)}\n parent=${ctx.dialog.parent}\n group=${ctx.dialog.group}\n lang=${ctx.dialog.lang}\n href=${ctx.dialog.href}\n ns=\"${ctx.dialog.ns} ${customElements.get('foxy-subscription-form')?.defaultNS ?? ''}\"\n id=\"form\"\n .templates=${templates}\n @update=${ctx.handleUpdate}\n @fetch=${ctx.handleFetch}\n >\n </foxy-subscription-form>\n `;\n };\n\n private readonly __renderPageItem: ItemRenderer = ({ html, ...ctx }) => {\n return html`\n <button\n class=${classMap({\n 'block w-full border border-contrast-10 p-m rounded-t-l rounded-b-l': true,\n 'focus-outline-none focus-border-primary': true,\n 'hover-border-contrast-30': ctx.data !== null,\n })}\n ?disabled=${ctx.data === null}\n @click=${(evt: Event) => {\n const url = new URL(ctx.href);\n url.searchParams.set('zoom', 'transaction_template:items');\n this.__subscriptionDialog.href = url.toString();\n this.__subscriptionDialog.show(evt.currentTarget as HTMLButtonElement);\n }}\n >\n <foxy-subscription-card\n hiddencontrols=\"email\"\n parent=${ctx.parent}\n group=${ctx.group}\n lang=${ctx.lang}\n href=${ctx.href}\n ns=\"${ctx.ns} ${customElements.get('foxy-subscription-card')?.defaultNS ?? ''}\"\n .templates=${ctx.templates}\n >\n </foxy-subscription-card>\n </button>\n `;\n };\n\n private readonly __renderPage: PageRenderer<any> = ({ html, ...ctx }) => {\n return html`\n <foxy-collection-page\n ns=${ctx.ns}\n href=${ctx.href}\n lang=${ctx.lang}\n group=${ctx.group}\n class=\"space-y-m\"\n .item=${this.__renderPageItem}\n .templates=${ctx.templates}\n >\n </foxy-collection-page>\n `;\n };\n\n private readonly __renderHeader = () => {\n return html`\n ${this.renderTemplateOrSlot('header:before')}\n\n <foxy-i18n\n class=\"block text-l font-medium\"\n lang=${this.lang}\n key=\"subscription_plural\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('header:after')}\n `;\n };\n\n private readonly __renderList = () => {\n const disabledSelector = this.disabledSelector.zoom('list');\n const readonlySelector = this.readonlySelector.zoom('list');\n const hiddenSelector = this.hiddenSelector.zoom('list');\n const extendedHiddenControlsArray = [hiddenSelector.zoom('form').toString(), 'end-date'];\n\n return html`\n ${this.renderTemplateOrSlot('list:before')}\n\n <foxy-form-dialog\n readonlycontrols=${readonlySelector.zoom('form').toString()}\n disabledcontrols=${disabledSelector.zoom('form').toString()}\n hiddencontrols=${extendedHiddenControlsArray.join(' ').trim()}\n header=\"update\"\n parent=${ifDefined(this.customer?._links['fx:subscriptions'].href)}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n id=\"subscription-dialog\"\n .form=${this.__renderForm}\n .templates=${this.getNestedTemplates('list:form')}\n >\n </foxy-form-dialog>\n\n <foxy-collection-pages\n class=\"block space-y-m\"\n first=${this.__activeSubscriptionsLink}\n group=${this.group}\n lang=${this.lang}\n ns=${this.ns}\n manual\n .page=${this.__renderPage}\n .templates=${this.getNestedTemplates('list:card')}\n >\n </foxy-collection-pages>\n\n ${this.renderTemplateOrSlot('list:after')}\n `;\n };\n\n render(): TemplateResult {\n return html`\n <div class=\"space-y-s\" data-testid=\"subscriptions\">\n ${this.hiddenSelector.matches('header', true) ? '' : this.__renderHeader()}\n ${this.hiddenSelector.matches('list', true) ? '' : this.__renderList()}\n </div>\n `;\n }\n\n private get __subscriptionDialog() {\n return this.renderRoot.querySelector('#subscription-dialog') as FormDialog;\n }\n\n private get __activeSubscriptionsLink() {\n try {\n const url = new URL(this.customer!._links['fx:subscriptions'].href);\n url.searchParams.set('zoom', 'transaction_template:items');\n return url.toString();\n } catch {\n return '';\n }\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"NativeIntegrationForm.js","sourceRoot":"","sources":["../../../../src/elements/public/NativeIntegrationForm/NativeIntegrationForm.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,KAAK,QAAQ,sBAAmB;AACvC,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAExC,MAAM,EAAE,GAAG,yBAAyB,CAAC;AACrC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFG;AACH,MAAM,OAAO,qBAAsB,SAAQ,IAAU;IAArD;;QAkHE,cAAS,GAAc,EAAE,CAAC;QAET,4BAAuB,GAAG,OAAO,CAAC,CAAC,GAAW,EAAE,EAAE;YACjE,OAAO,GAAG,EAAE,wBAAC,IAAI,CAAC,QAAQ,0CAAG,GAAG,IAAC,CAAC;QACpC,CAAC,CAAC,CAAC;QAEc,4BAAuB,GAAG,OA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C,sBAAsB,CAAC;;;;;;;oBAOtD,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC;oBACpC,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC;;;KAGnD,CAAC;IACJ,CAAC;IAEO,oBAAoB;QAC1B,OAAO,IAAI,CAAA;;;oBAGK,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC;oBACtC,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC;;;;;;oBAMtC,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC;oBACnC,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC;;;;;;;KAOlD,CAAC;IACJ,CAAC;IAEO,sBAAsB;QAC5B,OAAO,IAAI,CAAA;;;oBAGK,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC;oBAC1C,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC;;;;;;;KAOzD,CAAC;IACJ,CAAC;IAEO,uBAAuB;QAC7B,OAAO,IAAI,CAAA;;;oBAGK,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC;oBACnC,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC;;;;;;;KAOlD,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { Data, Templates } from './types';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Option } from '../../internal/InternalRadioGroupControl/types';\nimport type { Item } from '../../internal/InternalEditableListControl/types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { html } from 'lit-html';\n\nimport * as defaults from './defaults';\nimport memoize from 'lodash-es/memoize';\n\nconst NS = 'native-integration-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\n/**\n * Form element for configuring native integrations (`fx:native_integration`).\n *\n * @slot timestamps:before\n * @slot timestamps:after\n * @slot delete:before\n * @slot delete:after\n * @slot create:before\n * @slot create:after\n * @slot provider:before\n * @slot provider:after\n * @slot avalara-service-url:before\n * @slot avalara-service-url:after\n * @slot avalara-id:before\n * @slot avalara-id:after\n * @slot avalara-key:before\n * @slot avalara-key:after\n * @slot avalara-company-code:before\n * @slot avalara-company-code:after\n * @slot avalara-options:before\n * @slot avalara-options:after\n * @slot avalara-address-validation-countries:before\n * @slot avalara-address-validation-countries:after\n * @slot avalara-category-to-product-tax-code-mappings:before\n * @slot avalara-category-to-product-tax-code-mappings:after\n * @slot taxjar-api-token:before\n * @slot taxjar-api-token:after\n * @slot taxjar-category-to-product-tax-code-mappings:before\n * @slot taxjar-category-to-product-tax-code-mappings:after\n * @slot taxjar-options:before\n * @slot taxjar-options:after\n * @slot onesource-service-url:before\n * @slot onesource-service-url:after\n * @slot onesource-external-company-id:before\n * @slot onesource-external-company-id:after\n * @slot onesource-calling-system-number:before\n * @slot onesource-calling-system-number:after\n * @slot onesource-from-city:before\n * @slot onesource-from-city:after\n * @slot onesource-host-system:before\n * @slot onesource-host-system:after\n * @slot onesource-company-role:before\n * @slot onesource-company-role:after\n * @slot onesource-part-number-product-option:before\n * @slot onesource-part-number-product-option:after\n * @slot onesource-product-order-priority:before\n * @slot onesource-product-order-priority:after\n * @slot onesource-audit-settings:before\n * @slot onesource-audit-settings:after\n * @slot webhook-service:before\n * @slot webhook-service:after\n * @slot webhook-json-title:before\n * @slot webhook-json-title:after\n * @slot webhook-json-encryption-key:before\n * @slot webhook-json-encryption-key:after\n * @slot webhook-json-url:before\n * @slot webhook-json-url:after\n * @slot webhook-json-events:before\n * @slot webhook-json-events:after\n * @slot webhook-legacy-xml-title:before\n * @slot webhook-legacy-xml-title:after\n * @slot webhook-legacy-xml-url:before\n * @slot webhook-legacy-xml-url:after\n * @slot webflow-site-id:before\n * @slot webflow-site-id:after\n * @slot webflow-site-name:before\n * @slot webflow-site-name:after\n * @slot webflow-collection-id:before\n * @slot webflow-collection-id:after\n * @slot webflow-collection-name:before\n * @slot webflow-collection-name:after\n * @slot webflow-sku-field-id:before\n * @slot webflow-sku-field-id:after\n * @slot webflow-sku-field-name:before\n * @slot webflow-sku-field-name:after\n * @slot webflow-inventory-field-id:before\n * @slot webflow-inventory-field-id:after\n * @slot webflow-inventory-field-name:before\n * @slot webflow-inventory-field-name:after\n * @slot webflow-auth:before\n * @slot webflow-auth:after\n * @slot zapier-event:before\n * @slot zapier-event:after\n * @slot zapier-url:before\n * @slot zapier-url:after\n *\n * @element foxy-native-integration-form\n * @since 1.25.0\n */\nexport class NativeIntegrationForm extends Base<Data> {\n static get v8n(): NucleonV8N<Data> {\n const parse = memoize(JSON.parse);\n const isURL = memoize((value: string) => {\n try {\n return Boolean(new URL(value));\n } catch {\n return false;\n }\n });\n\n return [\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const url = parse(c).service_url;\n const err = url ? (isURL(url) ? null : 'v8n_invalid') : 'v8n_required';\n return p === 'avalara' && err ? `avalara-service-url:${err}` : true;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'avalara' || !!parse(c).id || 'avalara-id:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'avalara' || !!parse(c).key || 'avalara-key:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'avalara' || !!parse(c).company_code || 'avalara-company-code:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n if (p !== 'avalara') return true;\n const mappings = parse(c).category_to_product_tax_code_mappings;\n const err = 'avalara-category-to-product-tax-code-mappings:v8n_required';\n return (mappings && Object.entries(mappings).length > 0) || err;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'taxjar' || !!parse(c).api_token || 'taxjar-api-token:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const url = parse(c).service_url;\n const err = url ? (isURL(url) ? null : 'v8n_invalid') : 'v8n_required';\n return p === 'onesource' && err ? `onesource-service-url:${err}` : true;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const prefix = 'onesource-external-company-id';\n return p !== 'onesource' || !!parse(c).external_company_id || `${prefix}:v8n_required`;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const prefix = 'onesource-calling-system-number';\n return p !== 'onesource' || !!parse(c).calling_system_number || `${prefix}:v8n_required`;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const prefix = 'onesource-from-city';\n return p !== 'onesource' || !!parse(c).from_city || `${prefix}:v8n_required`;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const prefix = 'onesource-host-system';\n return p !== 'onesource' || !!parse(c).host_system || `${prefix}:v8n_required`;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const { service: s, title: t } = parse(c);\n return p !== 'webhook' || s !== 'json' || !!t || 'webhook-json-title:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const { service: s, encryption_key: e } = parse(c);\n return p !== 'webhook' || s !== 'json' || !!e || 'webhook-json-encryption-key:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const { service: s, url: u } = parse(c);\n const err = u ? (isURL(u) ? null : 'v8n_invalid') : 'v8n_required';\n return p === 'webhook' && s === 'json' && err ? `webhook-json-url:${err}` : true;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const { service: s, title: t } = parse(c);\n const err = 'webhook-legacy-xml-title:v8n_required';\n return p !== 'webhook' || s !== 'legacy_xml' || !!t || err;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const { service: s, url: u } = parse(c);\n const err = u ? (isURL(u) ? null : 'v8n_invalid') : 'v8n_required';\n const prefix = 'webhook-legacy-xml-url';\n return p === 'webhook' && s === 'legacy_xml' && err ? `${prefix}:${err}` : true;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'webflow' || !!parse(c).site_id || 'webflow-site-id:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'webflow' || !!parse(c).site_name || 'webflow-site-name:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'webflow' || !!parse(c).collection_id || 'webflow-collection-id:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const err = 'webflow-collection-name:v8n_required';\n return p !== 'webflow' || !!parse(c).collection_name || err;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'webflow' || !!parse(c).sku_field_id || 'webflow-sku-field-id:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const err = 'webflow-sku-field-name:v8n_required';\n return p !== 'webflow' || !!parse(c).sku_field_name || err;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const err = 'webflow-inventory-field-id:v8n_required';\n return p !== 'webflow' || !!parse(c).inventory_field_id || err;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const err = 'webflow-inventory-field-name:v8n_required';\n return p !== 'webflow' || !!parse(c).inventory_field_name || err;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'webflow' || !!parse(c).auth || 'webflow-auth:v8n_required';\n },\n ];\n }\n\n templates: Templates = {};\n\n private readonly __createConfigGetterFor = memoize((key: string) => {\n return () => this.__config?.[key];\n });\n\n private readonly __createConfigSetterFor = memoize((key: string) => {\n return (value: unknown) => (this.__config = { [key]: value });\n });\n\n private readonly __providerGetValue = () => {\n return this.form.provider ?? 'avalara';\n };\n\n private readonly __providerSetValue = (value: string) => {\n this.edit({ provider: value, config: '{}' });\n this.__config = {};\n };\n\n private readonly __templateProviderOptions: Option[] = [\n { value: 'avalara', label: 'option_avalara' },\n { value: 'onesource', label: 'option_onesource' },\n { value: 'taxjar', label: 'option_taxjar' },\n { value: 'webflow', label: 'option_webflow' },\n ];\n\n private readonly __avalaraConfigOptions: Option[] = [\n {\n value: 'use_ava_tax',\n label: 'option_use_ava_tax',\n },\n {\n value: 'enable_colorado_delivery_fee',\n label: 'option_enable_colorado_delivery_fee',\n },\n {\n value: 'create_invoice',\n label: 'option_create_invoice',\n },\n {\n value: 'use_address_validation',\n label: 'option_use_address_validation',\n },\n ];\n\n private readonly __taxjarConfigOptions: Option[] = [\n {\n value: 'create_invoice',\n label: 'option_create_invoice',\n },\n ];\n\n private readonly __configOptionsGetValue = () => {\n const config = this.__config;\n const value: string[] = [];\n\n if (config?.enable_colorado_delivery_fee) value.push('enable_colorado_delivery_fee');\n if (config?.use_address_validation) value.push('use_address_validation');\n if (config?.create_invoice) value.push('create_invoice');\n if (config?.use_ava_tax) value.push('use_ava_tax');\n\n return value;\n };\n\n private readonly __configOptionsSetValue = (value: string[]) => {\n this.__config = {\n enable_colorado_delivery_fee: value.includes('enable_colorado_delivery_fee'),\n use_address_validation: value.includes('use_address_validation'),\n create_invoice: value.includes('create_invoice'),\n use_ava_tax: value.includes('use_ava_tax'),\n };\n };\n\n private readonly __avalaraAddressValidationCountriesOptions = [\n { value: 'US', label: 'option_US' },\n { value: 'CA', label: 'option_CA' },\n ];\n\n private readonly __codeMappingsGetValue = () => {\n const mappings = this.__config?.category_to_product_tax_code_mappings ?? {};\n return Object.entries(mappings).map(([foxyCategory, vndTaxCode]) => {\n return { value: `${foxyCategory}:${vndTaxCode}` };\n });\n };\n\n private readonly __codeMappingsSetValue = (value: Item[]) => {\n const mappings: Record<string, string> = {};\n\n for (const { value: mapping } of value) {\n const [foxyCategory, vndTaxCode] = mapping.split(':');\n if (foxyCategory && vndTaxCode) mappings[foxyCategory] = vndTaxCode;\n }\n\n this.__config = { category_to_product_tax_code_mappings: mappings };\n };\n\n private readonly __onesourceCompanyRoleOptions = [\n { value: 'B', label: 'option_buyer' },\n { value: 'M', label: 'option_middleman' },\n { value: 'S', label: 'option_seller' },\n ];\n\n private readonly __onesourceProductOrderPriorityGetValue = () => {\n const value = this.__config?.product_order_priority.split(',') ?? [];\n return value.filter((v: string) => !!v).map((v: string) => ({ value: v }));\n };\n\n private readonly __onesourceProductOrderPrioritySetValue = (value: Item[]) => {\n this.__config = { product_order_priority: value.map(i => i.value).join(',') };\n };\n\n private readonly __onesourceAuditSettingsOptions = [\n { value: 'capture_only', label: 'option_capture_only' },\n { value: 'auth_and_capture', label: 'option_auth_and_capture' },\n { value: 'never', label: 'option_never' },\n ];\n\n private readonly __webhookServiceOptions = [\n { value: 'json', label: 'option_json' },\n { value: 'legacy_xml', label: 'option_legacy_xml' },\n ];\n\n private readonly __webhookJsonEventsOptions = [\n { value: 'transaction/created', label: 'option_transaction_created' },\n { value: 'subscription/cancelled', label: 'option_subscription_cancelled' },\n ];\n\n get readonlySelector() {\n const match = [super.readonlySelector.toString()];\n\n if (this.href) {\n match.push(\n 'apple-pay-merchant-id',\n 'custom-tax-url',\n 'zapier-events',\n 'zapier-url',\n 'provider'\n );\n }\n\n return new BooleanSelector(match.join(' ').trim());\n }\n\n renderBody(): TemplateResult {\n const provider = this.form.provider ?? 'avalara';\n\n return html`\n ${this.href\n ? provider === 'webhook'\n ? ''\n : html`<foxy-internal-text-control infer=\"provider\"></foxy-internal-text-control>`\n : html`\n <foxy-internal-radio-group-control\n infer=\"provider\"\n theme=\"vertical\"\n .getValue=${this.__providerGetValue}\n .setValue=${this.__providerSetValue}\n .options=${this.__templateProviderOptions}\n >\n </foxy-internal-radio-group-control>\n `}\n ${provider === 'avalara'\n ? this.__renderAvalaraConfig()\n : provider === 'taxjar'\n ? this.__renderTaxJarConfig()\n : provider === 'onesource'\n ? this.__renderOneSourceConfig()\n : provider === 'webflow'\n ? this.__renderWebflowConfig()\n : provider === 'zapier'\n ? this.__renderZapierConfig()\n : provider === 'webhook'\n ? this.__renderWebhookConfig()\n : provider === 'apple_pay'\n ? this.__renderApplePayConfig()\n : provider === 'custom_tax'\n ? this.__renderCustomTaxConfig()\n : ''}\n ${super.renderBody()}\n `;\n }\n\n protected async _fetch<TResult = Data>(...args: Parameters<Window['fetch']>): Promise<TResult> {\n try {\n return await super._fetch(...args);\n } catch (err) {\n let message;\n\n try {\n message = (await (err as Response).json())._embedded['fx:errors'][0].message;\n } catch {\n throw err;\n }\n\n if (message.includes('has already been configured')) {\n throw ['error:already_configured'];\n } else {\n throw err;\n }\n }\n }\n\n private get __config() {\n try {\n return JSON.parse(this.form.config as string);\n } catch {\n return null;\n }\n }\n\n private set __config(value: any) {\n const config = this.__config;\n const provider = this.form.provider ?? 'avalara';\n const defaultConfig = (() => {\n if (provider === 'avalara') return defaults.avalara;\n if (provider === 'taxjar') return defaults.taxjar;\n if (provider === 'onesource') return defaults.onesource;\n if (provider === 'webflow') return defaults.webflow;\n if (provider === 'zapier') return defaults.zapier;\n if (provider === 'webhook') {\n if (config?.service === 'legacy_xml') return defaults.webhookLegacyXml;\n return defaults.webhookJson;\n }\n })();\n\n const newConfig = JSON.stringify({ ...defaultConfig, ...config, ...value });\n this.edit({ provider, config: newConfig });\n }\n\n private __renderAvalaraConfig() {\n return html`\n <foxy-internal-text-control\n infer=\"avalara-service-url\"\n .getValue=${this.__createConfigGetterFor('service_url')}\n .setValue=${this.__createConfigSetterFor('service_url')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"avalara-id\"\n .getValue=${this.__createConfigGetterFor('id')}\n .setValue=${this.__createConfigSetterFor('id')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-password-control\n infer=\"avalara-key\"\n .getValue=${this.__createConfigGetterFor('key')}\n .setValue=${this.__createConfigSetterFor('key')}\n >\n </foxy-internal-password-control>\n\n <foxy-internal-text-control\n infer=\"avalara-company-code\"\n .getValue=${this.__createConfigGetterFor('company_code')}\n .setValue=${this.__createConfigSetterFor('company_code')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-editable-list-control\n infer=\"avalara-category-to-product-tax-code-mappings\"\n .getValue=${this.__codeMappingsGetValue}\n .setValue=${this.__codeMappingsSetValue}\n >\n </foxy-internal-editable-list-control>\n\n <foxy-internal-checkbox-group-control\n infer=\"avalara-options\"\n .getValue=${this.__configOptionsGetValue}\n .setValue=${this.__configOptionsSetValue}\n .options=${this.__avalaraConfigOptions}\n >\n </foxy-internal-checkbox-group-control>\n\n ${this.__config?.use_address_validation\n ? html`\n <foxy-internal-checkbox-group-control\n infer=\"avalara-address-validation-countries\"\n .getValue=${this.__createConfigGetterFor('address_validation_countries')}\n .setValue=${this.__createConfigSetterFor('address_validation_countries')}\n .options=${this.__avalaraAddressValidationCountriesOptions}\n >\n </foxy-internal-checkbox-group-control>\n `\n : ''}\n `;\n }\n\n private __renderTaxJarConfig() {\n return html`\n <foxy-internal-password-control\n infer=\"taxjar-api-token\"\n .getValue=${this.__createConfigGetterFor('api_token')}\n .setValue=${this.__createConfigSetterFor('api_token')}\n >\n </foxy-internal-password-control>\n\n <foxy-internal-editable-list-control\n infer=\"taxjar-category-to-product-tax-code-mappings\"\n .getValue=${this.__codeMappingsGetValue}\n .setValue=${this.__codeMappingsSetValue}\n >\n </foxy-internal-editable-list-control>\n\n <foxy-internal-checkbox-group-control\n infer=\"taxjar-options\"\n .getValue=${this.__configOptionsGetValue}\n .setValue=${this.__configOptionsSetValue}\n .options=${this.__taxjarConfigOptions}\n >\n </foxy-internal-checkbox-group-control>\n `;\n }\n\n private __renderOneSourceConfig() {\n return html`\n <foxy-internal-text-control\n infer=\"onesource-service-url\"\n .getValue=${this.__createConfigGetterFor('service_url')}\n .setValue=${this.__createConfigSetterFor('service_url')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"onesource-external-company-id\"\n .getValue=${this.__createConfigGetterFor('external_company_id')}\n .setValue=${this.__createConfigSetterFor('external_company_id')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"onesource-calling-system-number\"\n .getValue=${this.__createConfigGetterFor('calling_system_number')}\n .setValue=${this.__createConfigSetterFor('calling_system_number')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"onesource-from-city\"\n .getValue=${this.__createConfigGetterFor('from_city')}\n .setValue=${this.__createConfigSetterFor('from_city')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"onesource-host-system\"\n .getValue=${this.__createConfigGetterFor('host_system')}\n .setValue=${this.__createConfigSetterFor('host_system')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-radio-group-control\n infer=\"onesource-company-role\"\n .getValue=${this.__createConfigGetterFor('company_role')}\n .setValue=${this.__createConfigSetterFor('company_role')}\n .options=${this.__onesourceCompanyRoleOptions}\n >\n </foxy-internal-radio-group-control>\n\n <foxy-internal-text-control\n infer=\"onesource-part-number-product-option\"\n .getValue=${this.__createConfigGetterFor('part_number_product_option')}\n .setValue=${this.__createConfigSetterFor('part_number_product_option')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-editable-list-control\n infer=\"onesource-product-order-priority\"\n .getValue=${this.__onesourceProductOrderPriorityGetValue}\n .setValue=${this.__onesourceProductOrderPrioritySetValue}\n >\n </foxy-internal-editable-list-control>\n\n <foxy-internal-radio-group-control\n infer=\"onesource-audit-settings\"\n .getValue=${this.__createConfigGetterFor('audit_settings')}\n .setValue=${this.__createConfigSetterFor('audit_settings')}\n .options=${this.__onesourceAuditSettingsOptions}\n >\n </foxy-internal-radio-group-control>\n `;\n }\n\n private __renderWebhookConfig() {\n return html`\n <p\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n class=\"rounded bg-error-10 text-error font-medium\"\n >\n <foxy-i18n infer=\"webhook-warning\" key=\"warning_text\"></foxy-i18n>\n <br />\n <br />\n <a\n target=\"_blank\"\n class=\"text-body rounded hover-underline hover-cursor-pointer focus-outline-none focus-ring-2 focus-ring-error-50\"\n lang=\"en\"\n rel=\"noopener\"\n href=\"https://www.foxy.io/blog/new-feature-json-webhook/\"\n >\n <foxy-i18n infer=\"webhook-warning\" key=\"link_text\"></foxy-i18n>\n </a>\n </p>\n\n ${this.__config?.service === 'json'\n ? this.__renderWebhookJsonConfig()\n : this.__config?.service === 'legacy_xml'\n ? this.__renderWebhookLegacyXmlConfig()\n : ''}\n `;\n }\n\n private __renderWebhookJsonConfig() {\n return html`\n <foxy-internal-text-control\n infer=\"webhook-json-title\"\n .getValue=${this.__createConfigGetterFor('title')}\n .setValue=${this.__createConfigSetterFor('title')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-area-control\n infer=\"webhook-json-url\"\n .getValue=${this.__createConfigGetterFor('url')}\n .setValue=${this.__createConfigSetterFor('url')}\n >\n </foxy-internal-text-area-control>\n\n <foxy-internal-radio-group-control\n infer=\"webhook-service\"\n .getValue=${this.__createConfigGetterFor('service')}\n .setValue=${this.__createConfigSetterFor('service')}\n .options=${this.__webhookServiceOptions}\n >\n </foxy-internal-radio-group-control>\n\n <foxy-internal-checkbox-group-control\n infer=\"webhook-json-events\"\n .getValue=${this.__createConfigGetterFor('events')}\n .setValue=${this.__createConfigSetterFor('events')}\n .options=${this.__webhookJsonEventsOptions}\n >\n </foxy-internal-checkbox-group-control>\n\n <foxy-internal-password-control\n infer=\"webhook-json-encryption-key\"\n .getValue=${this.__createConfigGetterFor('encryption_key')}\n .setValue=${this.__createConfigSetterFor('encryption_key')}\n >\n </foxy-internal-password-control>\n `;\n }\n\n private __renderWebhookLegacyXmlConfig() {\n return html`\n <foxy-internal-text-control\n infer=\"webhook-legacy-xml-title\"\n .getValue=${this.__createConfigGetterFor('title')}\n .setValue=${this.__createConfigSetterFor('title')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-area-control\n infer=\"webhook-legacy-xml-url\"\n .getValue=${this.__createConfigGetterFor('url')}\n .setValue=${this.__createConfigSetterFor('url')}\n >\n </foxy-internal-text-area-control>\n\n <foxy-internal-radio-group-control\n infer=\"webhook-service\"\n .getValue=${this.__createConfigGetterFor('service')}\n .setValue=${this.__createConfigSetterFor('service')}\n .options=${this.__webhookServiceOptions}\n >\n </foxy-internal-radio-group-control>\n `;\n }\n\n private __renderWebflowConfig() {\n return html`\n <div class=\"grid grid-cols-2 gap-m\">\n <foxy-internal-text-control\n infer=\"webflow-site-id\"\n .getValue=${this.__createConfigGetterFor('site_id')}\n .setValue=${this.__createConfigSetterFor('site_id')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"webflow-site-name\"\n .getValue=${this.__createConfigGetterFor('site_name')}\n .setValue=${this.__createConfigSetterFor('site_name')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"webflow-collection-id\"\n .getValue=${this.__createConfigGetterFor('collection_id')}\n .setValue=${this.__createConfigSetterFor('collection_id')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"webflow-collection-name\"\n .getValue=${this.__createConfigGetterFor('collection_name')}\n .setValue=${this.__createConfigSetterFor('collection_name')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"webflow-sku-field-id\"\n .getValue=${this.__createConfigGetterFor('sku_field_id')}\n .setValue=${this.__createConfigSetterFor('sku_field_id')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"webflow-sku-field-name\"\n .getValue=${this.__createConfigGetterFor('sku_field_name')}\n .setValue=${this.__createConfigSetterFor('sku_field_name')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"webflow-inventory-field-id\"\n .getValue=${this.__createConfigGetterFor('inventory_field_id')}\n .setValue=${this.__createConfigSetterFor('inventory_field_id')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"webflow-inventory-field-name\"\n .getValue=${this.__createConfigGetterFor('inventory_field_name')}\n .setValue=${this.__createConfigSetterFor('inventory_field_name')}\n >\n </foxy-internal-text-control>\n </div>\n\n <foxy-internal-password-control\n infer=\"webflow-auth\"\n .getValue=${this.__createConfigGetterFor('auth')}\n .setValue=${this.__createConfigSetterFor('auth')}\n >\n </foxy-internal-password-control>\n `;\n }\n\n private __renderZapierConfig() {\n return html`\n <foxy-internal-editable-list-control\n infer=\"zapier-events\"\n .getValue=${this.__createConfigGetterFor('events')}\n .setValue=${this.__createConfigSetterFor('events')}\n >\n </foxy-internal-editable-list-control>\n\n <foxy-internal-text-area-control\n infer=\"zapier-url\"\n .getValue=${this.__createConfigGetterFor('url')}\n .setValue=${this.__createConfigSetterFor('url')}\n >\n </foxy-internal-text-area-control>\n\n <p class=\"text-xs text-secondary leading-xs\">\n <foxy-i18n infer=\"zapier-warning\" key=\"warning_text\"></foxy-i18n>\n </p>\n `;\n }\n\n private __renderApplePayConfig() {\n return html`\n <foxy-internal-text-control\n infer=\"apple-pay-merchant-id\"\n .getValue=${this.__createConfigGetterFor('merchantID')}\n .setValue=${this.__createConfigSetterFor('merchantID')}\n >\n </foxy-internal-text-control>\n\n <p class=\"text-xs text-secondary leading-xs\">\n <foxy-i18n infer=\"apple-pay-warning\" key=\"warning_text\"></foxy-i18n>\n </p>\n `;\n }\n\n private __renderCustomTaxConfig() {\n return html`\n <foxy-internal-text-control\n infer=\"custom-tax-url\"\n .getValue=${this.__createConfigGetterFor('url')}\n .setValue=${this.__createConfigSetterFor('url')}\n >\n </foxy-internal-text-control>\n\n <p class=\"text-xs text-secondary leading-xs\">\n <foxy-i18n infer=\"custom-tax-warning\" key=\"warning_text\"></foxy-i18n>\n </p>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"NativeIntegrationForm.js","sourceRoot":"","sources":["../../../../src/elements/public/NativeIntegrationForm/NativeIntegrationForm.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,KAAK,QAAQ,sBAAmB;AACvC,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAExC,MAAM,EAAE,GAAG,yBAAyB,CAAC;AACrC,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AI,CAAC,uBAAuB,CAAC,cAAc,CAAC;;;;;;sBAM5C,IAAI,CAAC,uBAAuB,CAAC,gBAAgB,CAAC;sBAC9C,IAAI,CAAC,uBAAuB,CAAC,gBAAgB,CAAC;;;;;;sBAM9C,IAAI,CAAC,uBAAuB,CAAC,oBAAoB,CAAC;sBAClD,IAAI,CAAC,uBAAuB,CAAC,oBAAoB,CAAC;;;;;;sBAMlD,IAAI,CAAC,uBAAuB,CAAC,sBAAsB,CAAC;sBACpD,IAAI,CAAC,uBAAuB,CAAC,sBAAsB,CAAC;;;;;;;oBAOtD,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC;oBACpC,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC;;;KAGnD,CAAC;IACJ,CAAC;IAEO,oBAAoB;QAC1B,OAAO,IAAI,CAAA;;;oBAGK,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC;oBACtC,IAAI,CAAC,uBAAuB,CAAC,QAAQ,CAAC;;;;;;oBAMtC,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC;oBACnC,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC;;;;;;;KAOlD,CAAC;IACJ,CAAC;IAEO,sBAAsB;QAC5B,OAAO,IAAI,CAAA;;;oBAGK,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC;oBAC1C,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC;;;;;;;KAOzD,CAAC;IACJ,CAAC;IAEO,uBAAuB;QAC7B,OAAO,IAAI,CAAA;;;oBAGK,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC;oBACnC,IAAI,CAAC,uBAAuB,CAAC,KAAK,CAAC;;;;;;;KAOlD,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { Data, Templates } from './types';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Option } from '../../internal/InternalRadioGroupControl/types';\nimport type { Item } from '../../internal/InternalEditableListControl/types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { html } from 'lit-html';\n\nimport * as defaults from './defaults';\nimport memoize from 'lodash-es/memoize';\n\nconst NS = 'native-integration-form';\nconst Base = TranslatableMixin(InternalForm, NS);\n\n/**\n * Form element for configuring native integrations (`fx:native_integration`).\n *\n * @slot timestamps:before\n * @slot timestamps:after\n * @slot delete:before\n * @slot delete:after\n * @slot create:before\n * @slot create:after\n * @slot provider:before\n * @slot provider:after\n * @slot avalara-service-url:before\n * @slot avalara-service-url:after\n * @slot avalara-id:before\n * @slot avalara-id:after\n * @slot avalara-key:before\n * @slot avalara-key:after\n * @slot avalara-company-code:before\n * @slot avalara-company-code:after\n * @slot avalara-options:before\n * @slot avalara-options:after\n * @slot avalara-address-validation-countries:before\n * @slot avalara-address-validation-countries:after\n * @slot avalara-category-to-product-tax-code-mappings:before\n * @slot avalara-category-to-product-tax-code-mappings:after\n * @slot taxjar-api-token:before\n * @slot taxjar-api-token:after\n * @slot taxjar-category-to-product-tax-code-mappings:before\n * @slot taxjar-category-to-product-tax-code-mappings:after\n * @slot taxjar-options:before\n * @slot taxjar-options:after\n * @slot onesource-service-url:before\n * @slot onesource-service-url:after\n * @slot onesource-external-company-id:before\n * @slot onesource-external-company-id:after\n * @slot onesource-calling-system-number:before\n * @slot onesource-calling-system-number:after\n * @slot onesource-from-city:before\n * @slot onesource-from-city:after\n * @slot onesource-host-system:before\n * @slot onesource-host-system:after\n * @slot onesource-company-role:before\n * @slot onesource-company-role:after\n * @slot onesource-part-number-product-option:before\n * @slot onesource-part-number-product-option:after\n * @slot onesource-product-order-priority:before\n * @slot onesource-product-order-priority:after\n * @slot onesource-audit-settings:before\n * @slot onesource-audit-settings:after\n * @slot webhook-service:before\n * @slot webhook-service:after\n * @slot webhook-json-title:before\n * @slot webhook-json-title:after\n * @slot webhook-json-encryption-key:before\n * @slot webhook-json-encryption-key:after\n * @slot webhook-json-url:before\n * @slot webhook-json-url:after\n * @slot webhook-json-events:before\n * @slot webhook-json-events:after\n * @slot webhook-legacy-xml-title:before\n * @slot webhook-legacy-xml-title:after\n * @slot webhook-legacy-xml-url:before\n * @slot webhook-legacy-xml-url:after\n * @slot webflow-site-id:before\n * @slot webflow-site-id:after\n * @slot webflow-site-name:before\n * @slot webflow-site-name:after\n * @slot webflow-collection-id:before\n * @slot webflow-collection-id:after\n * @slot webflow-collection-name:before\n * @slot webflow-collection-name:after\n * @slot webflow-sku-field-id:before\n * @slot webflow-sku-field-id:after\n * @slot webflow-sku-field-name:before\n * @slot webflow-sku-field-name:after\n * @slot webflow-inventory-field-id:before\n * @slot webflow-inventory-field-id:after\n * @slot webflow-inventory-field-name:before\n * @slot webflow-inventory-field-name:after\n * @slot webflow-auth:before\n * @slot webflow-auth:after\n * @slot zapier-event:before\n * @slot zapier-event:after\n * @slot zapier-url:before\n * @slot zapier-url:after\n *\n * @element foxy-native-integration-form\n * @since 1.25.0\n */\nexport class NativeIntegrationForm extends Base<Data> {\n static get v8n(): NucleonV8N<Data> {\n const parse = memoize(JSON.parse);\n const isURL = memoize((value: string) => {\n try {\n return Boolean(new URL(value));\n } catch {\n return false;\n }\n });\n\n return [\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const url = parse(c).service_url;\n const err = url ? (isURL(url) ? null : 'v8n_invalid') : 'v8n_required';\n return p === 'avalara' && err ? `avalara-service-url:${err}` : true;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'avalara' || !!parse(c).id || 'avalara-id:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'avalara' || !!parse(c).key || 'avalara-key:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'avalara' || !!parse(c).company_code || 'avalara-company-code:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n if (p !== 'avalara') return true;\n const mappings = parse(c).category_to_product_tax_code_mappings;\n const err = 'avalara-category-to-product-tax-code-mappings:v8n_required';\n return (mappings && Object.entries(mappings).length > 0) || err;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'taxjar' || !!parse(c).api_token || 'taxjar-api-token:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const url = parse(c).service_url;\n const err = url ? (isURL(url) ? null : 'v8n_invalid') : 'v8n_required';\n return p === 'onesource' && err ? `onesource-service-url:${err}` : true;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const prefix = 'onesource-external-company-id';\n return p !== 'onesource' || !!parse(c).external_company_id || `${prefix}:v8n_required`;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const prefix = 'onesource-calling-system-number';\n return p !== 'onesource' || !!parse(c).calling_system_number || `${prefix}:v8n_required`;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const prefix = 'onesource-from-city';\n return p !== 'onesource' || !!parse(c).from_city || `${prefix}:v8n_required`;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const prefix = 'onesource-host-system';\n return p !== 'onesource' || !!parse(c).host_system || `${prefix}:v8n_required`;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const { service: s, title: t } = parse(c);\n return p !== 'webhook' || s !== 'json' || !!t || 'webhook-json-title:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const { service: s, encryption_key: e } = parse(c);\n return p !== 'webhook' || s !== 'json' || !!e || 'webhook-json-encryption-key:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const { service: s, url: u } = parse(c);\n const err = u ? (isURL(u) ? null : 'v8n_invalid') : 'v8n_required';\n return p === 'webhook' && s === 'json' && err ? `webhook-json-url:${err}` : true;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const { service: s, title: t } = parse(c);\n const err = 'webhook-legacy-xml-title:v8n_required';\n return p !== 'webhook' || s !== 'legacy_xml' || !!t || err;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const { service: s, url: u } = parse(c);\n const err = u ? (isURL(u) ? null : 'v8n_invalid') : 'v8n_required';\n const prefix = 'webhook-legacy-xml-url';\n return p === 'webhook' && s === 'legacy_xml' && err ? `${prefix}:${err}` : true;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'webflow' || !!parse(c).site_id || 'webflow-site-id:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'webflow' || !!parse(c).site_name || 'webflow-site-name:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'webflow' || !!parse(c).collection_id || 'webflow-collection-id:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const err = 'webflow-collection-name:v8n_required';\n return p !== 'webflow' || !!parse(c).collection_name || err;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'webflow' || !!parse(c).sku_field_id || 'webflow-sku-field-id:v8n_required';\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const err = 'webflow-sku-field-name:v8n_required';\n return p !== 'webflow' || !!parse(c).sku_field_name || err;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const err = 'webflow-inventory-field-id:v8n_required';\n return p !== 'webflow' || !!parse(c).inventory_field_id || err;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n const err = 'webflow-inventory-field-name:v8n_required';\n return p !== 'webflow' || !!parse(c).inventory_field_name || err;\n },\n ({ provider: p = 'avalara', config: c = '{}' }) => {\n return p !== 'webflow' || !!parse(c).auth || 'webflow-auth:v8n_required';\n },\n ];\n }\n\n templates: Templates = {};\n\n private readonly __createConfigGetterFor = memoize((key: string) => {\n return () => this.__config?.[key];\n });\n\n private readonly __createConfigSetterFor = memoize((key: string) => {\n return (value: unknown) => (this.__config = { [key]: value });\n });\n\n private readonly __providerGetValue = () => {\n return this.form.provider ?? 'avalara';\n };\n\n private readonly __providerSetValue = (value: string) => {\n this.edit({ provider: value, config: '{}' });\n this.__config = {};\n };\n\n private readonly __templateProviderOptions: Option[] = [\n { value: 'avalara', label: 'option_avalara' },\n { value: 'onesource', label: 'option_onesource' },\n { value: 'taxjar', label: 'option_taxjar' },\n { value: 'webflow', label: 'option_webflow' },\n ];\n\n private readonly __avalaraConfigOptions: Option[] = [\n {\n value: 'use_ava_tax',\n label: 'option_use_ava_tax',\n },\n {\n value: 'enable_colorado_delivery_fee',\n label: 'option_enable_colorado_delivery_fee',\n },\n {\n value: 'create_invoice',\n label: 'option_create_invoice',\n },\n {\n value: 'use_address_validation',\n label: 'option_use_address_validation',\n },\n ];\n\n private readonly __taxjarConfigOptions: Option[] = [\n {\n value: 'create_invoice',\n label: 'option_create_invoice',\n },\n ];\n\n private readonly __configOptionsGetValue = () => {\n const config = this.__config;\n const value: string[] = [];\n\n if (config?.enable_colorado_delivery_fee) value.push('enable_colorado_delivery_fee');\n if (config?.use_address_validation) value.push('use_address_validation');\n if (config?.create_invoice) value.push('create_invoice');\n if (config?.use_ava_tax) value.push('use_ava_tax');\n\n return value;\n };\n\n private readonly __configOptionsSetValue = (value: string[]) => {\n this.__config = {\n enable_colorado_delivery_fee: value.includes('enable_colorado_delivery_fee'),\n use_address_validation: value.includes('use_address_validation'),\n create_invoice: value.includes('create_invoice'),\n use_ava_tax: value.includes('use_ava_tax'),\n };\n };\n\n private readonly __avalaraAddressValidationCountriesOptions = [\n { value: 'US', label: 'option_US' },\n { value: 'CA', label: 'option_CA' },\n ];\n\n private readonly __codeMappingsGetValue = () => {\n const mappings = this.__config?.category_to_product_tax_code_mappings ?? {};\n return Object.entries(mappings).map(([foxyCategory, vndTaxCode]) => {\n return { value: `${foxyCategory}:${vndTaxCode}` };\n });\n };\n\n private readonly __codeMappingsSetValue = (value: Item[]) => {\n const mappings: Record<string, string> = {};\n\n for (const { value: mapping } of value) {\n const [foxyCategory, vndTaxCode] = mapping.split(':');\n if (foxyCategory && vndTaxCode) mappings[foxyCategory] = vndTaxCode;\n }\n\n this.__config = { category_to_product_tax_code_mappings: mappings };\n };\n\n private readonly __onesourceCompanyRoleOptions = [\n { value: 'B', label: 'option_buyer' },\n { value: 'M', label: 'option_middleman' },\n { value: 'S', label: 'option_seller' },\n ];\n\n private readonly __onesourceProductOrderPriorityGetValue = () => {\n const value = this.__config?.product_order_priority.split(',') ?? [];\n return value.filter((v: string) => !!v).map((v: string) => ({ value: v }));\n };\n\n private readonly __onesourceProductOrderPrioritySetValue = (value: Item[]) => {\n this.__config = { product_order_priority: value.map(i => i.value).join(',') };\n };\n\n private readonly __onesourceAuditSettingsOptions = [\n { value: 'capture_only', label: 'option_capture_only' },\n { value: 'auth_and_capture', label: 'option_auth_and_capture' },\n { value: 'never', label: 'option_never' },\n ];\n\n private readonly __webhookServiceOptions = [\n { value: 'json', label: 'option_json' },\n { value: 'legacy_xml', label: 'option_legacy_xml' },\n ];\n\n private readonly __webhookJsonEventsOptions = [\n { value: 'transaction/created', label: 'option_transaction_created' },\n { value: 'subscription/cancelled', label: 'option_subscription_cancelled' },\n ];\n\n get readonlySelector(): BooleanSelector {\n const match = [super.readonlySelector.toString()];\n\n if (this.href) {\n match.push(\n 'apple-pay-merchant-id',\n 'custom-tax-url',\n 'zapier-events',\n 'zapier-url',\n 'provider'\n );\n }\n\n return new BooleanSelector(match.join(' ').trim());\n }\n\n renderBody(): TemplateResult {\n const provider = this.form.provider ?? 'avalara';\n\n return html`\n ${this.href\n ? provider === 'webhook'\n ? ''\n : html`<foxy-internal-text-control infer=\"provider\"></foxy-internal-text-control>`\n : html`\n <foxy-internal-radio-group-control\n infer=\"provider\"\n theme=\"vertical\"\n .getValue=${this.__providerGetValue}\n .setValue=${this.__providerSetValue}\n .options=${this.__templateProviderOptions}\n >\n </foxy-internal-radio-group-control>\n `}\n ${provider === 'avalara'\n ? this.__renderAvalaraConfig()\n : provider === 'taxjar'\n ? this.__renderTaxJarConfig()\n : provider === 'onesource'\n ? this.__renderOneSourceConfig()\n : provider === 'webflow'\n ? this.__renderWebflowConfig()\n : provider === 'zapier'\n ? this.__renderZapierConfig()\n : provider === 'webhook'\n ? this.__renderWebhookConfig()\n : provider === 'apple_pay'\n ? this.__renderApplePayConfig()\n : provider === 'custom_tax'\n ? this.__renderCustomTaxConfig()\n : ''}\n ${super.renderBody()}\n `;\n }\n\n protected async _fetch<TResult = Data>(...args: Parameters<Window['fetch']>): Promise<TResult> {\n try {\n return await super._fetch(...args);\n } catch (err) {\n let message;\n\n try {\n message = (await (err as Response).json())._embedded['fx:errors'][0].message;\n } catch {\n throw err;\n }\n\n if (message.includes('has already been configured')) {\n throw ['error:already_configured'];\n } else {\n throw err;\n }\n }\n }\n\n private get __config() {\n try {\n return JSON.parse(this.form.config as string);\n } catch {\n return null;\n }\n }\n\n private set __config(value: any) {\n const config = this.__config;\n const provider = this.form.provider ?? 'avalara';\n const defaultConfig = (() => {\n if (provider === 'avalara') return defaults.avalara;\n if (provider === 'taxjar') return defaults.taxjar;\n if (provider === 'onesource') return defaults.onesource;\n if (provider === 'webflow') return defaults.webflow;\n if (provider === 'zapier') return defaults.zapier;\n if (provider === 'webhook') {\n if (config?.service === 'legacy_xml') return defaults.webhookLegacyXml;\n return defaults.webhookJson;\n }\n })();\n\n const newConfig = JSON.stringify({ ...defaultConfig, ...config, ...value });\n this.edit({ provider, config: newConfig });\n }\n\n private __renderAvalaraConfig() {\n return html`\n <foxy-internal-text-control\n infer=\"avalara-service-url\"\n .getValue=${this.__createConfigGetterFor('service_url')}\n .setValue=${this.__createConfigSetterFor('service_url')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"avalara-id\"\n .getValue=${this.__createConfigGetterFor('id')}\n .setValue=${this.__createConfigSetterFor('id')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-password-control\n infer=\"avalara-key\"\n .getValue=${this.__createConfigGetterFor('key')}\n .setValue=${this.__createConfigSetterFor('key')}\n >\n </foxy-internal-password-control>\n\n <foxy-internal-text-control\n infer=\"avalara-company-code\"\n .getValue=${this.__createConfigGetterFor('company_code')}\n .setValue=${this.__createConfigSetterFor('company_code')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-editable-list-control\n infer=\"avalara-category-to-product-tax-code-mappings\"\n .getValue=${this.__codeMappingsGetValue}\n .setValue=${this.__codeMappingsSetValue}\n >\n </foxy-internal-editable-list-control>\n\n <foxy-internal-checkbox-group-control\n infer=\"avalara-options\"\n .getValue=${this.__configOptionsGetValue}\n .setValue=${this.__configOptionsSetValue}\n .options=${this.__avalaraConfigOptions}\n >\n </foxy-internal-checkbox-group-control>\n\n ${this.__config?.use_address_validation\n ? html`\n <foxy-internal-checkbox-group-control\n infer=\"avalara-address-validation-countries\"\n .getValue=${this.__createConfigGetterFor('address_validation_countries')}\n .setValue=${this.__createConfigSetterFor('address_validation_countries')}\n .options=${this.__avalaraAddressValidationCountriesOptions}\n >\n </foxy-internal-checkbox-group-control>\n `\n : ''}\n `;\n }\n\n private __renderTaxJarConfig() {\n return html`\n <foxy-internal-password-control\n infer=\"taxjar-api-token\"\n .getValue=${this.__createConfigGetterFor('api_token')}\n .setValue=${this.__createConfigSetterFor('api_token')}\n >\n </foxy-internal-password-control>\n\n <foxy-internal-editable-list-control\n infer=\"taxjar-category-to-product-tax-code-mappings\"\n .getValue=${this.__codeMappingsGetValue}\n .setValue=${this.__codeMappingsSetValue}\n >\n </foxy-internal-editable-list-control>\n\n <foxy-internal-checkbox-group-control\n infer=\"taxjar-options\"\n .getValue=${this.__configOptionsGetValue}\n .setValue=${this.__configOptionsSetValue}\n .options=${this.__taxjarConfigOptions}\n >\n </foxy-internal-checkbox-group-control>\n `;\n }\n\n private __renderOneSourceConfig() {\n return html`\n <foxy-internal-text-control\n infer=\"onesource-service-url\"\n .getValue=${this.__createConfigGetterFor('service_url')}\n .setValue=${this.__createConfigSetterFor('service_url')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"onesource-external-company-id\"\n .getValue=${this.__createConfigGetterFor('external_company_id')}\n .setValue=${this.__createConfigSetterFor('external_company_id')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"onesource-calling-system-number\"\n .getValue=${this.__createConfigGetterFor('calling_system_number')}\n .setValue=${this.__createConfigSetterFor('calling_system_number')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"onesource-from-city\"\n .getValue=${this.__createConfigGetterFor('from_city')}\n .setValue=${this.__createConfigSetterFor('from_city')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"onesource-host-system\"\n .getValue=${this.__createConfigGetterFor('host_system')}\n .setValue=${this.__createConfigSetterFor('host_system')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-radio-group-control\n infer=\"onesource-company-role\"\n .getValue=${this.__createConfigGetterFor('company_role')}\n .setValue=${this.__createConfigSetterFor('company_role')}\n .options=${this.__onesourceCompanyRoleOptions}\n >\n </foxy-internal-radio-group-control>\n\n <foxy-internal-text-control\n infer=\"onesource-part-number-product-option\"\n .getValue=${this.__createConfigGetterFor('part_number_product_option')}\n .setValue=${this.__createConfigSetterFor('part_number_product_option')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-editable-list-control\n infer=\"onesource-product-order-priority\"\n .getValue=${this.__onesourceProductOrderPriorityGetValue}\n .setValue=${this.__onesourceProductOrderPrioritySetValue}\n >\n </foxy-internal-editable-list-control>\n\n <foxy-internal-radio-group-control\n infer=\"onesource-audit-settings\"\n .getValue=${this.__createConfigGetterFor('audit_settings')}\n .setValue=${this.__createConfigSetterFor('audit_settings')}\n .options=${this.__onesourceAuditSettingsOptions}\n >\n </foxy-internal-radio-group-control>\n `;\n }\n\n private __renderWebhookConfig() {\n return html`\n <p\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n class=\"rounded bg-error-10 text-error font-medium\"\n >\n <foxy-i18n infer=\"webhook-warning\" key=\"warning_text\"></foxy-i18n>\n <br />\n <br />\n <a\n target=\"_blank\"\n class=\"text-body rounded hover-underline hover-cursor-pointer focus-outline-none focus-ring-2 focus-ring-error-50\"\n lang=\"en\"\n rel=\"noopener\"\n href=\"https://www.foxy.io/blog/new-feature-json-webhook/\"\n >\n <foxy-i18n infer=\"webhook-warning\" key=\"link_text\"></foxy-i18n>\n </a>\n </p>\n\n ${this.__config?.service === 'json'\n ? this.__renderWebhookJsonConfig()\n : this.__config?.service === 'legacy_xml'\n ? this.__renderWebhookLegacyXmlConfig()\n : ''}\n `;\n }\n\n private __renderWebhookJsonConfig() {\n return html`\n <foxy-internal-text-control\n infer=\"webhook-json-title\"\n .getValue=${this.__createConfigGetterFor('title')}\n .setValue=${this.__createConfigSetterFor('title')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-area-control\n infer=\"webhook-json-url\"\n .getValue=${this.__createConfigGetterFor('url')}\n .setValue=${this.__createConfigSetterFor('url')}\n >\n </foxy-internal-text-area-control>\n\n <foxy-internal-radio-group-control\n infer=\"webhook-service\"\n .getValue=${this.__createConfigGetterFor('service')}\n .setValue=${this.__createConfigSetterFor('service')}\n .options=${this.__webhookServiceOptions}\n >\n </foxy-internal-radio-group-control>\n\n <foxy-internal-checkbox-group-control\n infer=\"webhook-json-events\"\n .getValue=${this.__createConfigGetterFor('events')}\n .setValue=${this.__createConfigSetterFor('events')}\n .options=${this.__webhookJsonEventsOptions}\n >\n </foxy-internal-checkbox-group-control>\n\n <foxy-internal-password-control\n infer=\"webhook-json-encryption-key\"\n .getValue=${this.__createConfigGetterFor('encryption_key')}\n .setValue=${this.__createConfigSetterFor('encryption_key')}\n >\n </foxy-internal-password-control>\n `;\n }\n\n private __renderWebhookLegacyXmlConfig() {\n return html`\n <foxy-internal-text-control\n infer=\"webhook-legacy-xml-title\"\n .getValue=${this.__createConfigGetterFor('title')}\n .setValue=${this.__createConfigSetterFor('title')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-area-control\n infer=\"webhook-legacy-xml-url\"\n .getValue=${this.__createConfigGetterFor('url')}\n .setValue=${this.__createConfigSetterFor('url')}\n >\n </foxy-internal-text-area-control>\n\n <foxy-internal-radio-group-control\n infer=\"webhook-service\"\n .getValue=${this.__createConfigGetterFor('service')}\n .setValue=${this.__createConfigSetterFor('service')}\n .options=${this.__webhookServiceOptions}\n >\n </foxy-internal-radio-group-control>\n `;\n }\n\n private __renderWebflowConfig() {\n return html`\n <div class=\"grid grid-cols-2 gap-m\">\n <foxy-internal-text-control\n infer=\"webflow-site-id\"\n .getValue=${this.__createConfigGetterFor('site_id')}\n .setValue=${this.__createConfigSetterFor('site_id')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"webflow-site-name\"\n .getValue=${this.__createConfigGetterFor('site_name')}\n .setValue=${this.__createConfigSetterFor('site_name')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"webflow-collection-id\"\n .getValue=${this.__createConfigGetterFor('collection_id')}\n .setValue=${this.__createConfigSetterFor('collection_id')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"webflow-collection-name\"\n .getValue=${this.__createConfigGetterFor('collection_name')}\n .setValue=${this.__createConfigSetterFor('collection_name')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"webflow-sku-field-id\"\n .getValue=${this.__createConfigGetterFor('sku_field_id')}\n .setValue=${this.__createConfigSetterFor('sku_field_id')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"webflow-sku-field-name\"\n .getValue=${this.__createConfigGetterFor('sku_field_name')}\n .setValue=${this.__createConfigSetterFor('sku_field_name')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"webflow-inventory-field-id\"\n .getValue=${this.__createConfigGetterFor('inventory_field_id')}\n .setValue=${this.__createConfigSetterFor('inventory_field_id')}\n >\n </foxy-internal-text-control>\n\n <foxy-internal-text-control\n infer=\"webflow-inventory-field-name\"\n .getValue=${this.__createConfigGetterFor('inventory_field_name')}\n .setValue=${this.__createConfigSetterFor('inventory_field_name')}\n >\n </foxy-internal-text-control>\n </div>\n\n <foxy-internal-password-control\n infer=\"webflow-auth\"\n .getValue=${this.__createConfigGetterFor('auth')}\n .setValue=${this.__createConfigSetterFor('auth')}\n >\n </foxy-internal-password-control>\n `;\n }\n\n private __renderZapierConfig() {\n return html`\n <foxy-internal-editable-list-control\n infer=\"zapier-events\"\n .getValue=${this.__createConfigGetterFor('events')}\n .setValue=${this.__createConfigSetterFor('events')}\n >\n </foxy-internal-editable-list-control>\n\n <foxy-internal-text-area-control\n infer=\"zapier-url\"\n .getValue=${this.__createConfigGetterFor('url')}\n .setValue=${this.__createConfigSetterFor('url')}\n >\n </foxy-internal-text-area-control>\n\n <p class=\"text-xs text-secondary leading-xs\">\n <foxy-i18n infer=\"zapier-warning\" key=\"warning_text\"></foxy-i18n>\n </p>\n `;\n }\n\n private __renderApplePayConfig() {\n return html`\n <foxy-internal-text-control\n infer=\"apple-pay-merchant-id\"\n .getValue=${this.__createConfigGetterFor('merchantID')}\n .setValue=${this.__createConfigSetterFor('merchantID')}\n >\n </foxy-internal-text-control>\n\n <p class=\"text-xs text-secondary leading-xs\">\n <foxy-i18n infer=\"apple-pay-warning\" key=\"warning_text\"></foxy-i18n>\n </p>\n `;\n }\n\n private __renderCustomTaxConfig() {\n return html`\n <foxy-internal-text-control\n infer=\"custom-tax-url\"\n .getValue=${this.__createConfigGetterFor('url')}\n .setValue=${this.__createConfigSetterFor('url')}\n >\n </foxy-internal-text-control>\n\n <p class=\"text-xs text-secondary leading-xs\">\n <foxy-i18n infer=\"custom-tax-warning\" key=\"warning_text\"></foxy-i18n>\n </p>\n `;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"PaymentCard.js","sourceRoot":"","sources":["../../../../src/elements/public/PaymentCard/PaymentCard.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,sCAAmC;AAEpD,OAAO,EAAE,iBAAiB,EA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O,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAC;IACrF,CAAC;IAED,IAAY,mBAAmB;QAE7B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;IACjF,CAAC;IAED,IAAY,aAAa;QAEvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,IAAY,iBAAiB;;QAC3B,MAAM,KAAK,SAAG,IAAI,CAAC,aAAa,0CAAE,IAAI,CAAC;QACvC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACxF,CAAC;IAED,IAAY,cAAc;;QACxB,mBAAO,IAAI,CAAC,mBAAmB,0CAAE,IAAI,0CAAE,aAAa,CAAC;IACvD,CAAC;IAED,IAAY,aAAa;;QACvB,MAAM,IAAI,SAAG,IAAI,CAAC,IAAI,0CAAE,YAAY,CAAC;QACrC,IAAI,IAAI,EAAE;YACR,MAAM,OAAO,eAAG,IAAI,CAAC,uBAAuB,0CAAE,IAAI,0CAAE,MAAM,CAAC,IAAI,CAAC,CAAC;YACjE,MAAM,aAAa,eAAG,IAAI,CAAC,6BAA6B,0CAAE,IAAI,0CAAE,MAAM,CAAC,IAAI,CAAC,CAAC;YAC7E,aAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,CAAC;SAC7C;IACH,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\nimport type { Data } from './types';\n\nimport * as logos from '../PaymentMethodCard/logos';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nconst NS = 'payment-card';\nconst Base = TranslatableMixin(InternalCard, NS);\n\n/**\n * Basic card displaying a payment resource (`fx:payment`).\n *\n * @element foxy-payment-card\n * @since 1.11.0\n */\nexport class PaymentCard extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n hostedPaymentGatewaysHelper: { attribute: 'hosted-payment-gateways-helper' },\n paymentGatewaysHelper: { attribute: 'payment-gateways-helper' },\n };\n }\n\n /** URL of the `fx:hosted_payment_gateways` property helper resource. */\n hostedPaymentGatewaysHelper: string | null = null;\n\n /** URL of the `fx:payment_gateways` property helper resource. */\n paymentGatewaysHelper: string | null = null;\n\n private readonly __hostedPaymentGatewaysLoaderId = 'hostedPaymentGatewaysLoader';\n\n private readonly __paymentGatewaysLoaderId = 'paymentGatewaysLoader';\n\n private readonly __transactionLoaderId = 'transactionLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\n\n renderBody(): TemplateResult {\n const data = this.data;\n const amount = `${data?.amount ?? ''} ${this.__currencyCode}`;\n const amountOptions = { currencyDisplay: this.__currencyDisplay, amount };\n\n const infoKeys = [\n 'processor_response',\n 'paypal_payer_id',\n 'third_party_id',\n 'purchase_order',\n ] as const;\n\n const score = this.data?.fraud_protection_score ?? 0;\n const scoreColor = score > 0 ? 'text-error' : 'text-success';\n const scoreBackground = score > 0 ? 'bg-error-10' : 'bg-success-10';\n\n const type = (data?.cc_type ?? 'unknown').toLowerCase() as keyof typeof logos;\n const year = data?.cc_exp_year?.substring(2);\n const month = data?.cc_exp_month;\n const last4Digits = data?.cc_number_masked?.replace(/x/gi, '');\n\n return html`\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.hostedPaymentGatewaysHelper ?? undefined)}\n id=${this.__hostedPaymentGatewaysLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.paymentGatewaysHelper ?? undefined)}\n id=${this.__paymentGatewaysLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(data?._links['fx:transaction'].href)}\n id=${this.__transactionLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(data?._links['fx:store'].href)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <p class=\"leading-s\">\n <span class=\"block font-medium text-m\" data-testid=\"line-1\">\n <foxy-i18n .options=${amountOptions} infer=\"\" key=\"price\"></foxy-i18n>\n <span>&nbsp;&bull;&nbsp;</span>\n <foxy-i18n .options=${{ value: data?.date_created }} infer=\"\" key=\"date\"></foxy-i18n>\n </span>\n\n <span class=\"block text-s text-secondary\">\n ${this.__gatewayName || html`<foxy-i18n infer=\"\" key=\"unknown\"></foxy-i18n>`}\n </span>\n\n ${infoKeys.map(key => {\n if (!data?.[key]) return;\n const css = 'block text-s text-tertiary';\n return html`<foxy-i18n class=${css} infer=\"\" key=${key} .options=${data}></foxy-i18n>`;\n })}\n\n <span class=\"mt-s flex space-x-s overflow-auto\">\n ${month && year && last4Digits\n ? html`\n <span\n class=\"truncate flex items-center h-xs rounded-s overflow-hidden bg-contrast-5\"\n data-testid=\"card-info\"\n >\n <span class=\"h-xs\">${logos[type] ?? logos.unknown}</span>\n <span class=\"font-medium px-s\">•••• ${last4Digits} ${month}/${year}</span>\n </span>\n `\n : ''}\n\n <foxy-i18n\n class=\"truncate flex font-medium h-xs items-center px-s rounded-s text-s ${scoreColor} ${scoreBackground}\"\n infer=\"\"\n key=\"fraud_risk\"\n .options=${{ score }}\n >\n </foxy-i18n>\n </span>\n </p>\n `;\n }\n\n get isBodyReady() {\n if (!super.isBodyReady) return false;\n if (!this.__currencyCode) return false;\n if (!this.__currencyDisplay) return false;\n return !this.hostedPaymentGatewaysHelper || !this.paymentGatewaysHelper || !!this.__gatewayName;\n }\n\n private get __hostedPaymentGatewaysLoader() {\n type Loader = NucleonElement<Resource<Rels.HostedPaymentGatewaysHelper>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__hostedPaymentGatewaysLoaderId}`);\n }\n\n private get __paymentGatewaysLoader() {\n type Loader = NucleonElement<Resource<Rels.PaymentGatewaysHelper>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__paymentGatewaysLoaderId}`);\n }\n\n private get __transactionLoader() {\n type Loader = NucleonElement<Resource<Rels.Transaction>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__transactionLoaderId}`);\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__storeLoaderId}`);\n }\n\n private get __currencyDisplay() {\n const store = this.__storeLoader?.data;\n return store ? (store.use_international_currency_symbol ? 'code' : 'symbol') : void 0;\n }\n\n private get __currencyCode() {\n return this.__transactionLoader?.data?.currency_code;\n }\n\n private get __gatewayName() {\n const type = this.data?.gateway_type;\n if (type) {\n const gateway = this.__paymentGatewaysLoader?.data?.values[type];\n const hostedGateway = this.__hostedPaymentGatewaysLoader?.data?.values[type];\n return gateway?.name ?? hostedGateway?.name;\n }\n }\n}\n"]}
1
+ {"version":3,"file":"PaymentCard.js","sourceRoot":"","sources":["../../../../src/elements/public/PaymentCard/PaymentCard.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,sCAAmC;AAEpD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAA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O,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;IACjF,CAAC;IAED,IAAY,aAAa;QAEvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,IAAY,iBAAiB;;QAC3B,MAAM,KAAK,SAAG,IAAI,CAAC,aAAa,0CAAE,IAAI,CAAC;QACvC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACxF,CAAC;IAED,IAAY,cAAc;;QACxB,mBAAO,IAAI,CAAC,mBAAmB,0CAAE,IAAI,0CAAE,aAAa,CAAC;IACvD,CAAC;IAED,IAAY,aAAa;;QACvB,MAAM,IAAI,SAAG,IAAI,CAAC,IAAI,0CAAE,YAAY,CAAC;QACrC,IAAI,IAAI,EAAE;YACR,MAAM,OAAO,eAAG,IAAI,CAAC,uBAAuB,0CAAE,IAAI,0CAAE,MAAM,CAAC,IAAI,CAAC,CAAC;YACjE,MAAM,aAAa,eAAG,IAAI,CAAC,6BAA6B,0CAAE,IAAI,0CAAE,MAAM,CAAC,IAAI,CAAC,CAAC;YAC7E,aAAO,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,mCAAI,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,IAAI,CAAC;SAC7C;IACH,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\nimport type { Data } from './types';\n\nimport * as logos from '../PaymentMethodCard/logos';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nconst NS = 'payment-card';\nconst Base = TranslatableMixin(InternalCard, NS);\n\n/**\n * Basic card displaying a payment resource (`fx:payment`).\n *\n * @element foxy-payment-card\n * @since 1.11.0\n */\nexport class PaymentCard extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n hostedPaymentGatewaysHelper: { attribute: 'hosted-payment-gateways-helper' },\n paymentGatewaysHelper: { attribute: 'payment-gateways-helper' },\n };\n }\n\n /** URL of the `fx:hosted_payment_gateways` property helper resource. */\n hostedPaymentGatewaysHelper: string | null = null;\n\n /** URL of the `fx:payment_gateways` property helper resource. */\n paymentGatewaysHelper: string | null = null;\n\n private readonly __hostedPaymentGatewaysLoaderId = 'hostedPaymentGatewaysLoader';\n\n private readonly __paymentGatewaysLoaderId = 'paymentGatewaysLoader';\n\n private readonly __transactionLoaderId = 'transactionLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\n\n renderBody(): TemplateResult {\n const data = this.data;\n const amount = `${data?.amount ?? ''} ${this.__currencyCode}`;\n const amountOptions = { currencyDisplay: this.__currencyDisplay, amount };\n\n const infoKeys = [\n 'processor_response',\n 'paypal_payer_id',\n 'third_party_id',\n 'purchase_order',\n ] as const;\n\n const score = this.data?.fraud_protection_score ?? 0;\n const scoreColor = score > 0 ? 'text-error' : 'text-success';\n const scoreBackground = score > 0 ? 'bg-error-10' : 'bg-success-10';\n\n const type = (data?.cc_type ?? 'unknown').toLowerCase() as keyof typeof logos;\n const year = data?.cc_exp_year?.substring(2);\n const month = data?.cc_exp_month;\n const last4Digits = data?.cc_number_masked?.replace(/x/gi, '');\n\n return html`\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.hostedPaymentGatewaysHelper ?? undefined)}\n id=${this.__hostedPaymentGatewaysLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.paymentGatewaysHelper ?? undefined)}\n id=${this.__paymentGatewaysLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(data?._links['fx:transaction'].href)}\n id=${this.__transactionLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(data?._links['fx:store'].href)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <p class=\"leading-s\">\n <span class=\"block font-medium text-m\" data-testid=\"line-1\">\n <foxy-i18n .options=${amountOptions} infer=\"\" key=\"price\"></foxy-i18n>\n <span>&nbsp;&bull;&nbsp;</span>\n <foxy-i18n .options=${{ value: data?.date_created }} infer=\"\" key=\"date\"></foxy-i18n>\n </span>\n\n <span class=\"block text-s text-secondary\">\n ${this.__gatewayName || html`<foxy-i18n infer=\"\" key=\"unknown\"></foxy-i18n>`}\n </span>\n\n ${infoKeys.map(key => {\n if (!data?.[key]) return;\n const css = 'block text-s text-tertiary';\n return html`<foxy-i18n class=${css} infer=\"\" key=${key} .options=${data}></foxy-i18n>`;\n })}\n\n <span class=\"mt-s flex space-x-s overflow-auto\">\n ${month && year && last4Digits\n ? html`\n <span\n class=\"truncate flex items-center h-xs rounded-s overflow-hidden bg-contrast-5\"\n data-testid=\"card-info\"\n >\n <span class=\"h-xs\">${logos[type] ?? logos.unknown}</span>\n <span class=\"font-medium px-s\">•••• ${last4Digits} ${month}/${year}</span>\n </span>\n `\n : ''}\n\n <foxy-i18n\n class=\"truncate flex font-medium h-xs items-center px-s rounded-s text-s ${scoreColor} ${scoreBackground}\"\n infer=\"\"\n key=\"fraud_risk\"\n .options=${{ score }}\n >\n </foxy-i18n>\n </span>\n </p>\n `;\n }\n\n get isBodyReady(): boolean {\n if (!super.isBodyReady) return false;\n if (!this.__currencyCode) return false;\n if (!this.__currencyDisplay) return false;\n return !this.hostedPaymentGatewaysHelper || !this.paymentGatewaysHelper || !!this.__gatewayName;\n }\n\n private get __hostedPaymentGatewaysLoader() {\n type Loader = NucleonElement<Resource<Rels.HostedPaymentGatewaysHelper>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__hostedPaymentGatewaysLoaderId}`);\n }\n\n private get __paymentGatewaysLoader() {\n type Loader = NucleonElement<Resource<Rels.PaymentGatewaysHelper>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__paymentGatewaysLoaderId}`);\n }\n\n private get __transactionLoader() {\n type Loader = NucleonElement<Resource<Rels.Transaction>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__transactionLoaderId}`);\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__storeLoaderId}`);\n }\n\n private get __currencyDisplay() {\n const store = this.__storeLoader?.data;\n return store ? (store.use_international_currency_symbol ? 'code' : 'symbol') : void 0;\n }\n\n private get __currencyCode() {\n return this.__transactionLoader?.data?.currency_code;\n }\n\n private get __gatewayName() {\n const type = this.data?.gateway_type;\n if (type) {\n const gateway = this.__paymentGatewaysLoader?.data?.values[type];\n const hostedGateway = this.__hostedPaymentGatewaysLoader?.data?.values[type];\n return gateway?.name ?? hostedGateway?.name;\n }\n }\n}\n"]}
@@ -76,6 +76,8 @@ interface AvailablePaymentMethodsRel extends Graph {
76
76
  test_third_party_key: string;
77
77
  /** The description of the third party key field for this gateway. */
78
78
  third_party_key_description: string;
79
+ /** Whether or not this payment method is deprecated. */
80
+ is_deprecated: boolean;
79
81
  /** If this gateway requires additional information, this will contain details about the data which needs to be collected to configure this gateway. */
80
82
  additional_fields: null | {
81
83
  blocks: {
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/elements/public/PaymentsApi/api/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Rels } from '@foxy.io/sdk/backend';\nimport type { Graph, Resource } from '@foxy.io/sdk/core';\n\nimport type {\n CollectionGraphLinks,\n CollectionGraphProps,\n} from '@foxy.io/sdk/dist/types/core/defaults';\n\ninterface PaymentPresetsRel extends Graph {\n curie: 'fx:payment_presets';\n props: CollectionGraphProps;\n links: CollectionGraphLinks<PaymentPresetsRel>;\n child: PaymentPresetRel;\n}\n\ninterface PaymentPresetRel extends Graph {\n curie: 'fx:payment_preset';\n props: Omit<Rels.PaymentMethodSet['props'], 'gateway_uri'>;\n links: {\n 'self': PaymentPresetRel;\n 'fx:store': Rels.Store;\n 'fx:payment_methods': PaymentMethodsRel;\n 'fx:fraud_protections': FraudProtectionsRel;\n 'fx:available_payment_methods': AvailablePaymentMethodsRel;\n 'fx:available_fraud_protections': AvailableFraudProtectionsRel;\n };\n}\n\ninterface PaymentMethodsRel extends Graph {\n curie: 'fx:payment_methods';\n props: CollectionGraphProps;\n links: CollectionGraphLinks<PaymentMethodsRel>;\n child: PaymentMethodRel;\n}\n\ninterface PaymentMethodRel extends Graph {\n curie: 'fx:payment_method';\n props: (Rels.HostedPaymentGateway['props'] | Rels.PaymentGateway['props']) & {\n helper: (\n | Rels.PaymentGatewaysHelper\n | Rels.HostedPaymentGatewaysHelper\n )['props']['values'][string];\n };\n links: {\n 'self': PaymentMethodRel;\n 'fx:store': Rels.Store;\n 'fx:payment_preset': any;\n };\n}\n\ninterface FraudProtectionsRel extends Graph {\n curie: 'fx:fraud_protections';\n props: CollectionGraphProps;\n links: CollectionGraphLinks<FraudProtectionsRel>;\n child: FraudProtectionRel;\n}\n\ninterface FraudProtectionRel extends Graph {\n curie: 'fx:fraud_protection';\n links: {\n 'self': FraudProtectionRel;\n 'fx:store': Rels.Store;\n 'fx:payment_preset': PaymentPresetRel;\n };\n props: Rels.FraudProtection['props'] & {\n helper: AvailableFraudProtectionsRel['props']['values'][string];\n };\n}\n\ninterface AvailablePaymentMethodsRel extends Graph {\n curie: 'fx:available_payment_methods';\n props: {\n values: {\n [key: string]: {\n /** The name of this payment gateway. */\n name: string;\n /** The default id you can use for testing this gateway. */\n test_id: string;\n /** The default key you can use for testing this gateway. */\n test_key: string;\n /** The description of the id field for this gateway. */\n id_description: string;\n /** The description of the key field for this gateway. */\n key_description: string;\n /** Whether or not this gateway supports 3D Secure functionality. */\n supports_3d_secure: 0 | 1;\n /** Whether or not this gateway supports authorize only instead of auth+capture. */\n supports_auth_only: 0 | 1;\n /** The default third party key you can use for testing this gateway. */\n test_third_party_key: string;\n /** The description of the third party key field for this gateway. */\n third_party_key_description: string;\n /** If this gateway requires additional information, this will contain details about the data which needs to be collected to configure this gateway. */\n additional_fields: null | {\n blocks: {\n id: string;\n is_live: boolean;\n parent_id: string;\n fields: {\n id: string;\n type: string;\n name: string;\n options?: { name: string; value: string }[];\n optional?: boolean;\n file_type?: string;\n description?: string;\n default_value: string;\n }[];\n }[];\n };\n /** If this payment method can't be used due to a conflict with another payment method, the details about it will be here. */\n conflict?: { type: string; name: string };\n };\n };\n };\n links: {\n self: PaymentMethodRel;\n };\n}\n\ninterface AvailableFraudProtectionsRel extends Graph {\n curie: 'fx:available_fraud_protections';\n links: { self: AvailableFraudProtectionsRel };\n props: {\n values: {\n [key: string]: {\n name: string;\n uses_rejection_threshold: boolean;\n json: null | {\n blocks: {\n id: string;\n is_live?: boolean;\n parent_id: string;\n fields: {\n id: string;\n type: string;\n name: string;\n options?: { name: string; value: string }[];\n optional?: boolean;\n file_type?: string;\n description?: string;\n default_value: unknown;\n }[];\n }[];\n };\n };\n };\n };\n}\n\nexport type PaymentMethods = Resource<PaymentMethodsRel>;\nexport type PaymentMethod = Resource<PaymentMethodRel>;\n\nexport type PaymentPresets = Resource<PaymentPresetsRel>;\nexport type PaymentPreset = Resource<PaymentPresetRel>;\n\nexport type FraudProtections = Resource<FraudProtectionsRel>;\nexport type FraudProtection = Resource<FraudProtectionRel>;\n\nexport type AvailablePaymentMethods = Resource<AvailablePaymentMethodsRel>;\nexport type AvailableFraudProtections = Resource<AvailableFraudProtectionsRel>;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/elements/public/PaymentsApi/api/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Rels } from '@foxy.io/sdk/backend';\nimport type { Graph, Resource } from '@foxy.io/sdk/core';\n\nimport type {\n CollectionGraphLinks,\n CollectionGraphProps,\n} from '@foxy.io/sdk/dist/types/core/defaults';\n\ninterface PaymentPresetsRel extends Graph {\n curie: 'fx:payment_presets';\n props: CollectionGraphProps;\n links: CollectionGraphLinks<PaymentPresetsRel>;\n child: PaymentPresetRel;\n}\n\ninterface PaymentPresetRel extends Graph {\n curie: 'fx:payment_preset';\n props: Omit<Rels.PaymentMethodSet['props'], 'gateway_uri'>;\n links: {\n 'self': PaymentPresetRel;\n 'fx:store': Rels.Store;\n 'fx:payment_methods': PaymentMethodsRel;\n 'fx:fraud_protections': FraudProtectionsRel;\n 'fx:available_payment_methods': AvailablePaymentMethodsRel;\n 'fx:available_fraud_protections': AvailableFraudProtectionsRel;\n };\n}\n\ninterface PaymentMethodsRel extends Graph {\n curie: 'fx:payment_methods';\n props: CollectionGraphProps;\n links: CollectionGraphLinks<PaymentMethodsRel>;\n child: PaymentMethodRel;\n}\n\ninterface PaymentMethodRel extends Graph {\n curie: 'fx:payment_method';\n props: (Rels.HostedPaymentGateway['props'] | Rels.PaymentGateway['props']) & {\n helper: (\n | Rels.PaymentGatewaysHelper\n | Rels.HostedPaymentGatewaysHelper\n )['props']['values'][string];\n };\n links: {\n 'self': PaymentMethodRel;\n 'fx:store': Rels.Store;\n 'fx:payment_preset': any;\n };\n}\n\ninterface FraudProtectionsRel extends Graph {\n curie: 'fx:fraud_protections';\n props: CollectionGraphProps;\n links: CollectionGraphLinks<FraudProtectionsRel>;\n child: FraudProtectionRel;\n}\n\ninterface FraudProtectionRel extends Graph {\n curie: 'fx:fraud_protection';\n links: {\n 'self': FraudProtectionRel;\n 'fx:store': Rels.Store;\n 'fx:payment_preset': PaymentPresetRel;\n };\n props: Rels.FraudProtection['props'] & {\n helper: AvailableFraudProtectionsRel['props']['values'][string];\n };\n}\n\ninterface AvailablePaymentMethodsRel extends Graph {\n curie: 'fx:available_payment_methods';\n props: {\n values: {\n [key: string]: {\n /** The name of this payment gateway. */\n name: string;\n /** The default id you can use for testing this gateway. */\n test_id: string;\n /** The default key you can use for testing this gateway. */\n test_key: string;\n /** The description of the id field for this gateway. */\n id_description: string;\n /** The description of the key field for this gateway. */\n key_description: string;\n /** Whether or not this gateway supports 3D Secure functionality. */\n supports_3d_secure: 0 | 1;\n /** Whether or not this gateway supports authorize only instead of auth+capture. */\n supports_auth_only: 0 | 1;\n /** The default third party key you can use for testing this gateway. */\n test_third_party_key: string;\n /** The description of the third party key field for this gateway. */\n third_party_key_description: string;\n /** Whether or not this payment method is deprecated. */\n is_deprecated: boolean;\n /** If this gateway requires additional information, this will contain details about the data which needs to be collected to configure this gateway. */\n additional_fields: null | {\n blocks: {\n id: string;\n is_live: boolean;\n parent_id: string;\n fields: {\n id: string;\n type: string;\n name: string;\n options?: { name: string; value: string }[];\n optional?: boolean;\n file_type?: string;\n description?: string;\n default_value: string;\n }[];\n }[];\n };\n /** If this payment method can't be used due to a conflict with another payment method, the details about it will be here. */\n conflict?: { type: string; name: string };\n };\n };\n };\n links: {\n self: PaymentMethodRel;\n };\n}\n\ninterface AvailableFraudProtectionsRel extends Graph {\n curie: 'fx:available_fraud_protections';\n links: { self: AvailableFraudProtectionsRel };\n props: {\n values: {\n [key: string]: {\n name: string;\n uses_rejection_threshold: boolean;\n json: null | {\n blocks: {\n id: string;\n is_live?: boolean;\n parent_id: string;\n fields: {\n id: string;\n type: string;\n name: string;\n options?: { name: string; value: string }[];\n optional?: boolean;\n file_type?: string;\n description?: string;\n default_value: unknown;\n }[];\n }[];\n };\n };\n };\n };\n}\n\nexport type PaymentMethods = Resource<PaymentMethodsRel>;\nexport type PaymentMethod = Resource<PaymentMethodRel>;\n\nexport type PaymentPresets = Resource<PaymentPresetsRel>;\nexport type PaymentPreset = Resource<PaymentPresetRel>;\n\nexport type FraudProtections = Resource<FraudProtectionsRel>;\nexport type FraudProtection = Resource<FraudProtectionRel>;\n\nexport type AvailablePaymentMethods = Resource<AvailablePaymentMethodsRel>;\nexport type AvailableFraudProtections = Resource<AvailableFraudProtectionsRel>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"ShipmentCard.js","sourceRoot":"","sources":["../../../../src/elements/public/ShipmentCard/ShipmentCard.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,eAAe,CAAC;AAC3B,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,OAAO,YAAa,SAAQ,IAAU;IAA5C;;QACmB,0BAAqB,GAAG,mBAAmB,CAAC;QAE5C,oBAAe,GAAG,aAAa,CAAC;IA2GnD,CAAC;IAzGC,UAAU;;QACR,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,SAAG,IAAI,CAAC,IAAI,mCAAI,EAAE,CAAC;QACxF,MAAM,cAAc,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;QAEvF,MAAM,MAAM,GAAG,GAAG,MAAA,IAAI,CAAC,IAAI,0CAAE,cAAc,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;QACrE,MAAM,eAAe,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAC/C,MAAM,YAAY,GAAG,EAAE,MAAM,EAAE,eAA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AU,IAAI,CAAC,MAAM,IAAI,UAAU;;2DAErC,IAAI,CAAC,MAAM,IAAI,UAAU;;0EAEV,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE;;;;uBAI3E,CAAC;YACJ,CAAC,CAAC;;;;aAIT;YACH,CAAC,CAAC,EAAE;;KAET,CAAC;IACJ,CAAC;IAED,IAAI,WAAW;QACb,OAAO,KAAK,CAAC,WAAW,IAAI,CAAC,CAAC,IAAI,CAAC,iBAAiB,IAAI,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC;IAChF,CAAC;IAED,IAAY,mBAAmB;QAE7B,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;IACjF,CAAC;IAED,IAAY,aAAa;QAEvB,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAS,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,IAAY,iBAAiB;;QAC3B,MAAM,KAAK,SAAG,IAAI,CAAC,aAAa,0CAAE,IAAI,CAAC;QACvC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACxF,CAAC;IAED,IAAY,cAAc;;QACxB,mBAAO,IAAI,CAAC,mBAAmB,0CAAE,IAAI,0CAAE,aAAa,CAAC;IACvD,CAAC;CACF","sourcesContent":["import type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { decode } from 'html-entities';\nimport { html } from 'lit-html';\n\nconst NS = 'shipment-card';\nconst Base = TranslatableMixin(InternalCard, NS);\n\n/**\n * Basic card displaying a shipment (`fx:shipment`).\n *\n * @element foxy-shipment-card\n * @since 1.17.0\n */\nexport class ShipmentCard extends Base<Data> {\n private readonly __transactionLoaderId = 'transactionLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\n\n renderBody(): TemplateResult {\n const { address_name, address1, address2, city, region, postal_code } = this.data ?? {};\n const addressOptions = { address_name, address1, address2, city, region, postal_code };\n\n const amount = `${this.data?.total_shipping} ${this.__currencyCode}`;\n const currencyDisplay = this.__currencyDisplay;\n const priceOptions = { amount, currencyDisplay };\n const description = this.data?.shipping_service_description;\n const items = this.data?._embedded?.['fx:items'] ?? [];\n\n return html`\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.data?._links['fx:transaction'].href)}\n id=${this.__transactionLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.data?._links['fx:store'].href)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <div class=\"space-y-s\">\n <div class=\"grid leading-s text-body\">\n <foxy-i18n\n class=\"truncate text-m font-medium\"\n infer=\"\"\n key=\"full_address\"\n .options=${addressOptions}\n >\n </foxy-i18n>\n\n <span class=\"truncate text-s text-secondary\">\n ${description ? html`${decode(description)} &bull; ` : ''}\n <foxy-i18n key=\"price\" infer=\"\" .options=${priceOptions}></foxy-i18n>\n &bull;\n <foxy-i18n infer=\"\" key=\"item\" .options=${{ count: items.length }}></foxy-i18n>\n </span>\n </div>\n\n ${items.length > 0\n ? html`\n <div class=\"border-t border-dashed border-contrast-20\"></div>\n <div class=\"overflow-auto\">\n <table class=\"text-s leading-s whitespace-nowrap\">\n <thead></thead>\n <tbody>\n ${items.map(item => {\n const category = item._embedded?.['fx:item_category'];\n const lengthUnit = category?.default_length_unit;\n const weightUnit = category?.default_weight_unit;\n\n return html`\n <tr>\n <td class=\"pr-s font-medium\">\n ${item.code || html`<foxy-i18n infer=\"\" key=\"no_code\"></foxy-i18n>`}\n </td>\n <td class=\"px-s text-secondary\">${item.name}</td>\n <td class=\"px-s text-tertiary\">\n ${item.width}&times;${item.height}&times;${item.length} ${lengthUnit}\n </td>\n <td class=\"px-s text-tertiary\">${item.weight} ${weightUnit}</td>\n <td class=\"pl-s font-medium\">\n <foxy-i18n infer=\"\" key=\"quantity\" .options=${{ count: item.quantity }}>\n </foxy-i18n>\n </td>\n </tr>\n `;\n })}\n </tbody>\n </table>\n </div>\n `\n : ''}\n </div>\n `;\n }\n\n get isBodyReady() {\n return super.isBodyReady && !!this.__currencyDisplay && !!this.__currencyCode;\n }\n\n private get __transactionLoader() {\n type Loader = NucleonElement<Resource<Rels.Transaction>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__transactionLoaderId}`);\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__storeLoaderId}`);\n }\n\n private get __currencyDisplay() {\n const store = this.__storeLoader?.data;\n return store ? (store.use_international_currency_symbol ? 'code' : 'symbol') : void 0;\n }\n\n private get __currencyCode() {\n return this.__transactionLoader?.data?.currency_code;\n }\n}\n"]}
1
+ {"version":3,"file":"ShipmentCard.js","sourceRoot":"","sources":["../../../../src/elements/public/ShipmentCard/ShipmentCard.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,EAAE,GAAG,eAAe,CAAC;AAC3B,MAAM,IAAI,GAAG,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AA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,MAAM,KAAK,SAAG,IAAI,CAAC,aAAa,0CAAE,IAAI,CAAC;QACvC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACxF,CAAC;IAED,IAAY,cAAc;;QACxB,mBAAO,IAAI,CAAC,mBAAmB,0CAAE,IAAI,0CAAE,aAAa,CAAC;IACvD,CAAC;CACF","sourcesContent":["import type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalCard } from '../../internal/InternalCard/InternalCard';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { decode } from 'html-entities';\nimport { html } from 'lit-html';\n\nconst NS = 'shipment-card';\nconst Base = TranslatableMixin(InternalCard, NS);\n\n/**\n * Basic card displaying a shipment (`fx:shipment`).\n *\n * @element foxy-shipment-card\n * @since 1.17.0\n */\nexport class ShipmentCard extends Base<Data> {\n private readonly __transactionLoaderId = 'transactionLoader';\n\n private readonly __storeLoaderId = 'storeLoader';\n\n renderBody(): TemplateResult {\n const { address_name, address1, address2, city, region, postal_code } = this.data ?? {};\n const addressOptions = { address_name, address1, address2, city, region, postal_code };\n\n const amount = `${this.data?.total_shipping} ${this.__currencyCode}`;\n const currencyDisplay = this.__currencyDisplay;\n const priceOptions = { amount, currencyDisplay };\n const description = this.data?.shipping_service_description;\n const items = this.data?._embedded?.['fx:items'] ?? [];\n\n return html`\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.data?._links['fx:transaction'].href)}\n id=${this.__transactionLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.data?._links['fx:store'].href)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <div class=\"space-y-s\">\n <div class=\"grid leading-s text-body\">\n <foxy-i18n\n class=\"truncate text-m font-medium\"\n infer=\"\"\n key=\"full_address\"\n .options=${addressOptions}\n >\n </foxy-i18n>\n\n <span class=\"truncate text-s text-secondary\">\n ${description ? html`${decode(description)} &bull; ` : ''}\n <foxy-i18n key=\"price\" infer=\"\" .options=${priceOptions}></foxy-i18n>\n &bull;\n <foxy-i18n infer=\"\" key=\"item\" .options=${{ count: items.length }}></foxy-i18n>\n </span>\n </div>\n\n ${items.length > 0\n ? html`\n <div class=\"border-t border-dashed border-contrast-20\"></div>\n <div class=\"overflow-auto\">\n <table class=\"text-s leading-s whitespace-nowrap\">\n <thead></thead>\n <tbody>\n ${items.map(item => {\n const category = item._embedded?.['fx:item_category'];\n const lengthUnit = category?.default_length_unit;\n const weightUnit = category?.default_weight_unit;\n\n return html`\n <tr>\n <td class=\"pr-s font-medium\">\n ${item.code || html`<foxy-i18n infer=\"\" key=\"no_code\"></foxy-i18n>`}\n </td>\n <td class=\"px-s text-secondary\">${item.name}</td>\n <td class=\"px-s text-tertiary\">\n ${item.width}&times;${item.height}&times;${item.length} ${lengthUnit}\n </td>\n <td class=\"px-s text-tertiary\">${item.weight} ${weightUnit}</td>\n <td class=\"pl-s font-medium\">\n <foxy-i18n infer=\"\" key=\"quantity\" .options=${{ count: item.quantity }}>\n </foxy-i18n>\n </td>\n </tr>\n `;\n })}\n </tbody>\n </table>\n </div>\n `\n : ''}\n </div>\n `;\n }\n\n get isBodyReady(): boolean {\n return super.isBodyReady && !!this.__currencyDisplay && !!this.__currencyCode;\n }\n\n private get __transactionLoader() {\n type Loader = NucleonElement<Resource<Rels.Transaction>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__transactionLoaderId}`);\n }\n\n private get __storeLoader() {\n type Loader = NucleonElement<Resource<Rels.Store>>;\n return this.renderRoot.querySelector<Loader>(`#${this.__storeLoaderId}`);\n }\n\n private get __currencyDisplay() {\n const store = this.__storeLoader?.data;\n return store ? (store.use_international_currency_symbol ? 'code' : 'symbol') : void 0;\n }\n\n private get __currencyCode() {\n return this.__transactionLoader?.data?.currency_code;\n }\n}\n"]}
@@ -139,8 +139,8 @@ export class SubscriptionCard extends Base {
139
139
  __getPriceOptions() {
140
140
  if (this.data === null)
141
141
  return {};
142
- const transaction = this.data._embedded['fx:last_transaction'];
143
- const amount = `${transaction.total_order} ${transaction.currency_code}`;
142
+ const cart = this.data._embedded['fx:transaction_template'];
143
+ const amount = `${cart.total_order} ${cart.currency_code}`;
144
144
  return { ...parseFrequency(this.data.frequency), amount };
145
145
  }
146
146
  __getStatusKey() {
@@ -1 +1 @@
1
- {"version":3,"file":"SubscriptionCard.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionCard/SubscriptionCard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAClE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAEhE,MAAM,EAAE,GAAG,mBAAmB,CAAC;AAC/B,MAAM,IAAI,GAAG,iBAAiB,CAC5B,eAAe,CAAC,cAAc,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CACvE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,OAAO,gBAAiB,SAAQ,IAAU;IAC9C,MAAM;;QACJ,MAAM,QAAQ,GAAG,CAAC,QAAC,IAAI,CAAC,IAAI,0CAAE,SAAS,CAAA,CAAC;QACxC,MAAM,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AAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,IAAI,EAAE;YAAE,OAAO,6BAA6B,CAAC;QAEjF,OAAO,qBAAqB,CAAC;IAC/B,CAAC;CACF","sourcesContent":["import { TemplateResult, html } from 'lit-html';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { Data } from './types';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { parseFrequency } from '../../../utils/parse-frequency';\n\nconst NS = 'subscription-card';\nconst Base = ConfigurableMixin(\n ResponsiveMixin(ThemeableMixin(TranslatableMixin(NucleonElement, NS)))\n);\n\n/**\n * Card element displaying subscription summary.\n *\n * @element foxy-subscription-card\n * @since 1.4.0\n */\nexport class SubscriptionCard extends Base<Data> {\n render(): TemplateResult {\n const isActive = !!this.data?.is_active;\n const isFailed = !!this.data?.first_failed_transaction_date;\n\n return html`\n <div class=\"relative text-left\">\n <div\n class=${classMap({\n 'flex items-start sm-items-center space-x-m transition duration-150 ease-in-out': true,\n 'opacity-0': !this.in({ idle: 'snapshot' }),\n })}\n >\n <div\n class=${classMap({\n 'min-w-0 flex-shrink-0 rounded-full relative flex p-s': true,\n 'text-success bg-success-10': isActive && !isFailed,\n 'text-body bg-contrast-5': !isActive && !isFailed,\n 'text-error bg-error-10': isFailed,\n })}\n >\n <iron-icon\n class=\"m-auto\"\n icon=${isFailed ? 'error-outline' : isActive ? 'done' : 'done-all'}\n >\n </iron-icon>\n </div>\n\n <div class=\"flex-1 min-w-0 leading-xs flex flex-col sm-flex-row sm-items-center\">\n <div class=\"order-1 sm-order-0\">\n <div class=\"text-body font-medium origin-top-left text-m\">\n <foxy-i18n\n data-testid=\"summary\"\n options=${JSON.stringify(this.__getSummaryOptions())}\n lang=${this.lang}\n key=\"transaction_summary\"\n ns=${this.ns}\n >\n </foxy-i18n>\n &#8203;\n </div>\n\n <div\n class=${classMap({\n 'text-m': true,\n 'text-tertiary': !isActive && !isFailed,\n 'text-success': isActive && !isFailed,\n 'text-error': isFailed,\n })}\n >\n <foxy-i18n\n data-testid=\"status\"\n options=${JSON.stringify(this.__getStatusOptions())}\n lang=${this.lang}\n key=${this.__getStatusKey()}\n ns=${this.ns}\n >\n </foxy-i18n>\n &#8203;\n </div>\n </div>\n\n <div\n class=\"flex-1 font-medium leading-xs mb-xs sm-mb-0 sm-text-right text-xxs sm-text-l tracking-wide sm-tracking-normal uppercase sm-normal-case order-0 sm-order-1 font-tnum text-secondary sm-text-body\"\n >\n <foxy-i18n\n data-testid=\"price\"\n options=${JSON.stringify(this.__getPriceOptions())}\n lang=${this.lang}\n key=\"price_${this.data?.frequency === '.5m' ? 'twice_a_month' : 'recurring'}\"\n ns=${this.ns}\n >\n </foxy-i18n>\n &#8203;\n </div>\n </div>\n </div>\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'pointer-events-none absolute inset-0 flex transition ease-in-out duration-150': true,\n 'opacity-0': this.in({ idle: 'snapshot' }),\n })}\n >\n <foxy-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 ${this.renderTemplateOrSlot()}\n `;\n }\n\n private __getSummaryOptions() {\n if (this.data === null) return {};\n const items = this.data._embedded['fx:transaction_template']._embedded['fx:items'];\n\n return {\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\n private __getStatusOptions() {\n const data = this.data;\n\n if (data === null) return {};\n if (data.first_failed_transaction_date) return { date: data.first_failed_transaction_date };\n if (data.end_date) return { date: data.end_date };\n if (data.is_active === false) return {};\n if (new Date(data.start_date) > new Date()) return { date: data.start_date };\n\n return { date: data.next_transaction_date };\n }\n\n private __getPriceOptions() {\n if (this.data === null) return {};\n\n const transaction = this.data._embedded['fx:last_transaction'];\n const amount = `${transaction.total_order} ${transaction.currency_code}`;\n return { ...parseFrequency(this.data.frequency), amount };\n }\n\n private __getStatusKey() {\n const data = this.data;\n\n if (data === null) return;\n if (data.first_failed_transaction_date) return 'subscription_failed';\n if (data.end_date) {\n const hasEnded = new Date(data.end_date).getTime() > Date.now();\n return hasEnded ? 'subscription_will_be_cancelled' : 'subscription_cancelled';\n }\n\n if (data.is_active === false) return 'subscription_inactive';\n if (new Date(data.start_date) > new Date()) return 'subscription_will_be_active';\n\n return 'subscription_active';\n }\n}\n"]}
1
+ {"version":3,"file":"SubscriptionCard.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionCard/SubscriptionCard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AAEjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAClE,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AACpD,OAAO,EAAE,cAAc,EAAE,0CAAuC;AAEhE,MAAM,EAAE,GAAG,mBAAmB,CAAC;AAC/B,MAAM,IAAI,GAAG,iBAAiB,CAC5B,eAAe,CAAC,cAAc,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CACvE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,OAAO,gBAAiB,SAAQ,IAAU;IAC9C,MAAM;;QACJ,MAAM,QAAQ,GAAG,CAAC,QAAC,IAAI,CAAC,IAAI,0CAAE,SAAS,CAAA,CAAC;QACxC,MAAM,QAAQ,GAAG,CAAC,QAAC,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AAC,UAAU,CAAC,GAAG,IAAI,IAAI,EAAE;YAAE,OAAO,6BAA6B,CAAC;QAEjF,OAAO,qBAAqB,CAAC;IAC/B,CAAC;CACF","sourcesContent":["import { TemplateResult, html } from 'lit-html';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { Data } from './types';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\nimport { parseFrequency } from '../../../utils/parse-frequency';\n\nconst NS = 'subscription-card';\nconst Base = ConfigurableMixin(\n ResponsiveMixin(ThemeableMixin(TranslatableMixin(NucleonElement, NS)))\n);\n\n/**\n * Card element displaying subscription summary.\n *\n * @element foxy-subscription-card\n * @since 1.4.0\n */\nexport class SubscriptionCard extends Base<Data> {\n render(): TemplateResult {\n const isActive = !!this.data?.is_active;\n const isFailed = !!this.data?.first_failed_transaction_date;\n\n return html`\n <div class=\"relative text-left\">\n <div\n class=${classMap({\n 'flex items-start sm-items-center space-x-m transition duration-150 ease-in-out': true,\n 'opacity-0': !this.in({ idle: 'snapshot' }),\n })}\n >\n <div\n class=${classMap({\n 'min-w-0 flex-shrink-0 rounded-full relative flex p-s': true,\n 'text-success bg-success-10': isActive && !isFailed,\n 'text-body bg-contrast-5': !isActive && !isFailed,\n 'text-error bg-error-10': isFailed,\n })}\n >\n <iron-icon\n class=\"m-auto\"\n icon=${isFailed ? 'error-outline' : isActive ? 'done' : 'done-all'}\n >\n </iron-icon>\n </div>\n\n <div class=\"flex-1 min-w-0 leading-xs flex flex-col sm-flex-row sm-items-center\">\n <div class=\"order-1 sm-order-0\">\n <div class=\"text-body font-medium origin-top-left text-m\">\n <foxy-i18n\n data-testid=\"summary\"\n options=${JSON.stringify(this.__getSummaryOptions())}\n lang=${this.lang}\n key=\"transaction_summary\"\n ns=${this.ns}\n >\n </foxy-i18n>\n &#8203;\n </div>\n\n <div\n class=${classMap({\n 'text-m': true,\n 'text-tertiary': !isActive && !isFailed,\n 'text-success': isActive && !isFailed,\n 'text-error': isFailed,\n })}\n >\n <foxy-i18n\n data-testid=\"status\"\n options=${JSON.stringify(this.__getStatusOptions())}\n lang=${this.lang}\n key=${this.__getStatusKey()}\n ns=${this.ns}\n >\n </foxy-i18n>\n &#8203;\n </div>\n </div>\n\n <div\n class=\"flex-1 font-medium leading-xs mb-xs sm-mb-0 sm-text-right text-xxs sm-text-l tracking-wide sm-tracking-normal uppercase sm-normal-case order-0 sm-order-1 font-tnum text-secondary sm-text-body\"\n >\n <foxy-i18n\n data-testid=\"price\"\n options=${JSON.stringify(this.__getPriceOptions())}\n lang=${this.lang}\n key=\"price_${this.data?.frequency === '.5m' ? 'twice_a_month' : 'recurring'}\"\n ns=${this.ns}\n >\n </foxy-i18n>\n &#8203;\n </div>\n </div>\n </div>\n\n <div\n data-testid=\"spinner\"\n class=${classMap({\n 'pointer-events-none absolute inset-0 flex transition ease-in-out duration-150': true,\n 'opacity-0': this.in({ idle: 'snapshot' }),\n })}\n >\n <foxy-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 ${this.renderTemplateOrSlot()}\n `;\n }\n\n private __getSummaryOptions() {\n if (this.data === null) return {};\n const items = this.data._embedded['fx:transaction_template']._embedded['fx:items'];\n\n return {\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\n private __getStatusOptions() {\n const data = this.data;\n\n if (data === null) return {};\n if (data.first_failed_transaction_date) return { date: data.first_failed_transaction_date };\n if (data.end_date) return { date: data.end_date };\n if (data.is_active === false) return {};\n if (new Date(data.start_date) > new Date()) return { date: data.start_date };\n\n return { date: data.next_transaction_date };\n }\n\n private __getPriceOptions() {\n if (this.data === null) return {};\n\n const cart = this.data._embedded['fx:transaction_template'];\n const amount = `${cart.total_order} ${cart.currency_code}`;\n return { ...parseFrequency(this.data.frequency), amount };\n }\n\n private __getStatusKey() {\n const data = this.data;\n\n if (data === null) return;\n if (data.first_failed_transaction_date) return 'subscription_failed';\n if (data.end_date) {\n const hasEnded = new Date(data.end_date).getTime() > Date.now();\n return hasEnded ? 'subscription_will_be_cancelled' : 'subscription_cancelled';\n }\n\n if (data.is_active === false) return 'subscription_inactive';\n if (new Date(data.start_date) > new Date()) return 'subscription_will_be_active';\n\n return 'subscription_active';\n }\n}\n"]}
@@ -4,9 +4,9 @@ import { Resource } from '@foxy.io/sdk/core';
4
4
  import { SubscriptionCard } from './SubscriptionCard';
5
5
  export declare type Rel = Rels.Subscription;
6
6
  export declare type Data = Resource<Rel, {
7
- zoom: ['last_transaction', {
7
+ zoom: {
8
8
  transaction_template: 'items';
9
- }];
9
+ };
10
10
  }>;
11
11
  export declare type Templates = {
12
12
  default?: Renderer<SubscriptionCard>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionCard/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Rels } from '@foxy.io/sdk/backend';\nimport { Renderer } from '../../../mixins/configurable';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { SubscriptionCard } from './SubscriptionCard';\n\nexport type Rel = Rels.Subscription;\nexport type Data = Resource<Rel, { zoom: ['last_transaction', { transaction_template: 'items' }] }>;\nexport type Templates = { default?: Renderer<SubscriptionCard> };\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/SubscriptionCard/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Rels } from '@foxy.io/sdk/backend';\nimport { Renderer } from '../../../mixins/configurable';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { SubscriptionCard } from './SubscriptionCard';\n\nexport type Rel = Rels.Subscription;\nexport type Data = Resource<Rel, { zoom: { transaction_template: 'items' } }>;\nexport type Templates = { default?: Renderer<SubscriptionCard> };\n"]}
@@ -64,7 +64,7 @@ export class Transaction extends Base {
64
64
  const source = (_a = this.data) === null || _a === void 0 ? void 0 : _a.source;
65
65
  const type = (_b = this.data) === null || _b === void 0 ? void 0 : _b.type;
66
66
  if (type === 'updateinfo') {
67
- if (source === '' || (source === null || source === void 0 ? void 0 : source.startsWith('cit_'))) {
67
+ if (!source || (source === null || source === void 0 ? void 0 : source.startsWith('cit_'))) {
68
68
  subtitleKey = 'subtitle_customer_changed_payment_method';
69
69
  }
70
70
  else if (source === 'mit_uoe') {
@@ -78,7 +78,7 @@ export class Transaction extends Base {
78
78
  }
79
79
  }
80
80
  else if (type === 'subscription_modification') {
81
- if (source === '' || (source === null || source === void 0 ? void 0 : source.startsWith('cit_'))) {
81
+ if (!source || (source === null || source === void 0 ? void 0 : source.startsWith('cit_'))) {
82
82
  subtitleKey = 'subtitle_customer_changed_subscription';
83
83
  }
84
84
  else if (source === 'mit_uoe') {
@@ -1 +1 @@
1
- {"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/elements/public/Transaction/Transaction.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,EAAE,GAAG,aAAa,CAAC;AACzB,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,IAAU;IAA3C;;QAWE,wEA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AAC,SAAS,CAAC;;;;;qBAKjB,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;gBAUhB,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,sBAAsB,EAAE,IAAI,CAAC;;;;;;;;;;;gBAWzD,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC;;qBAE3C;YACX,gCAAgC,EAAE,IAAI,CAAC,2BAA2B;YAClE,yBAAyB,EAAE,IAAI,CAAC,qBAAqB;SACtD;;;;;;kBAMS,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC;;;;;kBAK3E,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,kBAAkB,EAAE,IAAI,CAAC;;;;;;;;;;;kBAWrD,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC;;;;;;;;;;;gBAWpD,SAAS,CAAC,aAAa,CAAC;;;;KAInC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-element';\n\nconst NS = 'transaction';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Transaction summary page (`fx:transaction`).\n *\n * @element foxy-transaction\n * @since 1.17.0\n */\nexport class Transaction extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n hostedPaymentGatewaysHelper: { attribute: 'hosted-payment-gateways-helper' },\n paymentGatewaysHelper: { attribute: 'payment-gateways-helper' },\n getSubscriptionPageHref: { attribute: false },\n getCustomerPageHref: { attribute: false },\n };\n }\n\n /** URL of the `fx:hosted_payment_gateways` property helper resource. */\n hostedPaymentGatewaysHelper: string | null = null;\n\n /** URL of the `fx:payment_gateways` property helper resource. */\n paymentGatewaysHelper: string | null = null;\n\n getSubscriptionPageHref: ((href: string) => string) | null = null;\n\n getCustomerPageHref: ((href: string) => string) | null = null;\n\n get readonlySelector(): BooleanSelector {\n const isEditable = Boolean(this.data?._links['fx:void'] ?? this.data?._links['fx:refund']);\n return isEditable\n ? new BooleanSelector(`${super.readonlySelector} billing-addresses`)\n : new BooleanSelector(\n `${super.readonlySelector} billing-addresses items attributes custom-fields`\n );\n }\n\n get hiddenSelector(): BooleanSelector {\n const hidden = ['billing-addresses:dialog:delete billing-addresses:dialog:timestamps'];\n const type = this.data?.type;\n\n if (!this.data?._links['fx:subscription']) hidden.push('subscription');\n if (type === 'subscription_modification') hidden.push('actions');\n\n if (type === 'updateinfo') {\n hidden.push('not=customer,subscription,payments,custom-fields,attributes');\n }\n\n if (type === 'subscription_cancellation') {\n hidden.push('not=customer,subscription,custom-fields,attributes');\n }\n\n return new BooleanSelector(`${super.hiddenSelector} ${hidden.join(' ')}`.trim());\n }\n\n renderBody(): TemplateResult {\n let shipmentsLink: string | undefined = undefined;\n let subtitleKey = 'subtitle';\n let itemsLink: string | undefined = undefined;\n\n const alertStatuses = ['problem', 'pending_fraud_review', 'rejected', 'declined'];\n const hidden = this.hiddenSelector;\n const source = this.data?.source;\n const type = this.data?.type;\n\n if (type === 'updateinfo') {\n if (source === '' || source?.startsWith('cit_')) {\n subtitleKey = 'subtitle_customer_changed_payment_method';\n } else if (source === 'mit_uoe') {\n subtitleKey = 'subtitle_admin_changed_payment_method_with_uoe';\n } else if (source === 'mit_api') {\n subtitleKey = 'subtitle_integration_changed_payment_method';\n } else {\n subtitleKey = 'subtitle_admin_changed_payment_method';\n }\n } else if (type === 'subscription_modification') {\n if (source === '' || source?.startsWith('cit_')) {\n subtitleKey = 'subtitle_customer_changed_subscription';\n } else if (source === 'mit_uoe') {\n subtitleKey = 'subtitle_admin_changed_subscription_with_uoe';\n } else if (source === 'mit_api') {\n subtitleKey = 'subtitle_integration_changed_subscription';\n } else {\n subtitleKey = 'subtitle_admin_changed_subscription';\n }\n } else if (type === 'subscription_renewal') {\n if (source === 'mit_recurring') {\n subtitleKey = 'subtitle_subscription_renewal_attempt';\n } else if (source === 'mit_recurring_reattempt_automated') {\n subtitleKey = 'subtitle_subscription_renewal_automated_reattempt';\n } else if (source === 'mit_recurring_reattempt_manual') {\n subtitleKey = 'subtitle_subscription_renewal_manual_reattempt';\n }\n } else if (type === 'subscription_cancellation') {\n if (source === 'cit_recurring_cancellation') {\n subtitleKey = 'subtitle_customer_canceled_subscription';\n } else if (source === 'mit_recurring_cancellation') {\n subtitleKey = 'subtitle_admin_canceled_subscription';\n }\n } else {\n if (this.data?._links['fx:subscription']) {\n if (source?.startsWith('cit_')) {\n subtitleKey = 'subtitle_customer_subscribed';\n } else if (source === 'mit_uoe') {\n subtitleKey = 'subtitle_admin_subscribed_with_uoe';\n } else if (source === 'mit_api') {\n subtitleKey = 'subtitle_integration_subscribed';\n }\n } else {\n if (source?.startsWith('cit_')) {\n subtitleKey = 'subtitle_customer_placed_order';\n } else if (source === 'mit_uoe') {\n subtitleKey = 'subtitle_admin_placed_order_with_uoe';\n } else if (source === 'mit_api') {\n subtitleKey = 'subtitle_integration_placed_order';\n }\n }\n }\n\n if (this.data) {\n try {\n const shipmentsUrl = new URL(this.data._links['fx:shipments'].href);\n const itemsUrl = new URL(this.data._links['fx:items'].href);\n shipmentsUrl.searchParams.set('zoom', 'items:item_category');\n itemsUrl.searchParams.set('zoom', 'item_options');\n shipmentsLink = shipmentsUrl.toString();\n itemsLink = itemsUrl.toString();\n } catch {\n //\n }\n }\n\n return html`\n <h2>\n <div class=\"flex items-center gap-s leading-xs text-xxl font-medium break-all\">\n <foxy-i18n infer=\"header\" key=\"title\" .options=${this.data}></foxy-i18n>\n <foxy-copy-to-clipboard\n infer=\"header\"\n class=\"inline-block text-m\"\n text=${this.data?.display_id}\n >\n </foxy-copy-to-clipboard>\n </div>\n\n <foxy-i18n\n class=\"block leading-xs text-l text-secondary\"\n infer=\"header\"\n key=${subtitleKey}\n .options=${{\n transaction_date: this.data?.transaction_date,\n ip_country: this.data?.ip_country,\n }}\n >\n </foxy-i18n>\n\n <foxy-internal-transaction-actions-control class=\"mt-xs\" infer=\"actions\">\n </foxy-internal-transaction-actions-control>\n </h2>\n\n ${alertStatuses.includes(this.data?.status ?? '')\n ? html`\n <p\n class=\"leading-xs text-body rounded bg-error-10 block\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <foxy-i18n infer=\"header\" key=\"alert_status_${this.data?.status}\"></foxy-i18n>\n </p>\n `\n : ''}\n\n <foxy-internal-transaction-customer-control infer=\"customer\">\n </foxy-internal-transaction-customer-control>\n\n <div\n class=\"grid gap-s\"\n ?hidden=${hidden.matches('items', true) && hidden.matches('summary', true)}\n >\n <foxy-internal-async-list-control\n infer=\"items\"\n class=\"min-w-0\"\n first=${ifDefined(itemsLink)}\n limit=\"10\"\n item=\"foxy-item-card\"\n form=\"foxy-item-form\"\n alert\n .related=${[this.href]}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-transaction-summary-control infer=\"summary\" class=\"min-w-0\">\n </foxy-internal-transaction-summary-control>\n </div>\n\n <foxy-internal-async-list-control\n infer=\"billing-addresses\"\n first=${ifDefined(this.data?._links['fx:billing_addresses'].href)}\n item=\"foxy-billing-address-card\"\n form=\"foxy-address-form\"\n hide-create-button\n hide-delete-button\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"payments\"\n first=${ifDefined(this.data?._links['fx:payments'].href)}\n item=\"foxy-payment-card\"\n .itemProps=${{\n 'hosted-payment-gateways-helper': this.hostedPaymentGatewaysHelper,\n 'payment-gateways-helper': this.paymentGatewaysHelper,\n }}\n >\n </foxy-internal-async-list-control>\n\n <div\n class=\"grid gap-m sm-grid-cols-2\"\n ?hidden=${hidden.matches('custom-fields', true) && hidden.matches('attributes', true)}\n >\n <foxy-internal-async-list-control\n infer=\"custom-fields\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:custom_fields'].href)}\n limit=\"5\"\n form=\"foxy-custom-field-form\"\n item=\"foxy-custom-field-card\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"attributes\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:attributes'].href)}\n limit=\"5\"\n form=\"foxy-attribute-form\"\n item=\"foxy-attribute-card\"\n alert\n >\n </foxy-internal-async-list-control>\n </div>\n\n <foxy-internal-async-list-control\n infer=\"shipments\"\n first=${ifDefined(shipmentsLink)}\n item=\"foxy-shipment-card\"\n >\n </foxy-internal-async-list-control>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"Transaction.js","sourceRoot":"","sources":["../../../../src/elements/public/Transaction/Transaction.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,sCAAmC;AAC7D,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,EAAE,GAAG,aAAa,CAAC;AACzB,MAAM,IAAI,GAAG,eAAe,CAAC,iBAAiB,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,CAAC;AAElE;;;;;GAKG;AACH,MAAM,OAAO,WAAY,SAAQ,IAAU;IAA3C;;QAWE,wEAAwE;QACxE,gCAA2B,GAAkB,IAAI,CAAC;QAElD,iEAAiE;QACjE,0BAAqB,GAAkB,IAAI,CAAC;QAE5C,4B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CAAE,MAAM,CAAC,sBAAsB,EAAE,IAAI,CAAC;;;;;;;;;;;gBAWzD,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,aAAa,EAAE,IAAI,CAAC;;qBAE3C;YACX,gCAAgC,EAAE,IAAI,CAAC,2BAA2B;YAClE,yBAAyB,EAAE,IAAI,CAAC,qBAAqB;SACtD;;;;;;kBAMS,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC;;;;;kBAK3E,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,kBAAkB,EAAE,IAAI,CAAC;;;;;;;;;;;kBAWrD,SAAS,OAAC,IAAI,CAAC,IAAI,0CAAE,MAAM,CAAC,eAAe,EAAE,IAAI,CAAC;;;;;;;;;;;gBAWpD,SAAS,CAAC,aAAa,CAAC;;;;KAInC,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations, TemplateResult } from 'lit-element';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { ResponsiveMixin } from '../../../mixins/responsive';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-element';\n\nconst NS = 'transaction';\nconst Base = ResponsiveMixin(TranslatableMixin(InternalForm, NS));\n\n/**\n * Transaction summary page (`fx:transaction`).\n *\n * @element foxy-transaction\n * @since 1.17.0\n */\nexport class Transaction extends Base<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n hostedPaymentGatewaysHelper: { attribute: 'hosted-payment-gateways-helper' },\n paymentGatewaysHelper: { attribute: 'payment-gateways-helper' },\n getSubscriptionPageHref: { attribute: false },\n getCustomerPageHref: { attribute: false },\n };\n }\n\n /** URL of the `fx:hosted_payment_gateways` property helper resource. */\n hostedPaymentGatewaysHelper: string | null = null;\n\n /** URL of the `fx:payment_gateways` property helper resource. */\n paymentGatewaysHelper: string | null = null;\n\n getSubscriptionPageHref: ((href: string) => string) | null = null;\n\n getCustomerPageHref: ((href: string) => string) | null = null;\n\n get readonlySelector(): BooleanSelector {\n const isEditable = Boolean(this.data?._links['fx:void'] ?? this.data?._links['fx:refund']);\n return isEditable\n ? new BooleanSelector(`${super.readonlySelector} billing-addresses`)\n : new BooleanSelector(\n `${super.readonlySelector} billing-addresses items attributes custom-fields`\n );\n }\n\n get hiddenSelector(): BooleanSelector {\n const hidden = ['billing-addresses:dialog:delete billing-addresses:dialog:timestamps'];\n const type = this.data?.type;\n\n if (!this.data?._links['fx:subscription']) hidden.push('subscription');\n if (type === 'subscription_modification') hidden.push('actions');\n\n if (type === 'updateinfo') {\n hidden.push('not=customer,subscription,payments,custom-fields,attributes');\n }\n\n if (type === 'subscription_cancellation') {\n hidden.push('not=customer,subscription,custom-fields,attributes');\n }\n\n return new BooleanSelector(`${super.hiddenSelector} ${hidden.join(' ')}`.trim());\n }\n\n renderBody(): TemplateResult {\n let shipmentsLink: string | undefined = undefined;\n let subtitleKey = 'subtitle';\n let itemsLink: string | undefined = undefined;\n\n const alertStatuses = ['problem', 'pending_fraud_review', 'rejected', 'declined'];\n const hidden = this.hiddenSelector;\n const source = this.data?.source;\n const type = this.data?.type;\n\n if (type === 'updateinfo') {\n if (!source || source?.startsWith('cit_')) {\n subtitleKey = 'subtitle_customer_changed_payment_method';\n } else if (source === 'mit_uoe') {\n subtitleKey = 'subtitle_admin_changed_payment_method_with_uoe';\n } else if (source === 'mit_api') {\n subtitleKey = 'subtitle_integration_changed_payment_method';\n } else {\n subtitleKey = 'subtitle_admin_changed_payment_method';\n }\n } else if (type === 'subscription_modification') {\n if (!source || source?.startsWith('cit_')) {\n subtitleKey = 'subtitle_customer_changed_subscription';\n } else if (source === 'mit_uoe') {\n subtitleKey = 'subtitle_admin_changed_subscription_with_uoe';\n } else if (source === 'mit_api') {\n subtitleKey = 'subtitle_integration_changed_subscription';\n } else {\n subtitleKey = 'subtitle_admin_changed_subscription';\n }\n } else if (type === 'subscription_renewal') {\n if (source === 'mit_recurring') {\n subtitleKey = 'subtitle_subscription_renewal_attempt';\n } else if (source === 'mit_recurring_reattempt_automated') {\n subtitleKey = 'subtitle_subscription_renewal_automated_reattempt';\n } else if (source === 'mit_recurring_reattempt_manual') {\n subtitleKey = 'subtitle_subscription_renewal_manual_reattempt';\n }\n } else if (type === 'subscription_cancellation') {\n if (source === 'cit_recurring_cancellation') {\n subtitleKey = 'subtitle_customer_canceled_subscription';\n } else if (source === 'mit_recurring_cancellation') {\n subtitleKey = 'subtitle_admin_canceled_subscription';\n }\n } else {\n if (this.data?._links['fx:subscription']) {\n if (source?.startsWith('cit_')) {\n subtitleKey = 'subtitle_customer_subscribed';\n } else if (source === 'mit_uoe') {\n subtitleKey = 'subtitle_admin_subscribed_with_uoe';\n } else if (source === 'mit_api') {\n subtitleKey = 'subtitle_integration_subscribed';\n }\n } else {\n if (source?.startsWith('cit_')) {\n subtitleKey = 'subtitle_customer_placed_order';\n } else if (source === 'mit_uoe') {\n subtitleKey = 'subtitle_admin_placed_order_with_uoe';\n } else if (source === 'mit_api') {\n subtitleKey = 'subtitle_integration_placed_order';\n }\n }\n }\n\n if (this.data) {\n try {\n const shipmentsUrl = new URL(this.data._links['fx:shipments'].href);\n const itemsUrl = new URL(this.data._links['fx:items'].href);\n shipmentsUrl.searchParams.set('zoom', 'items:item_category');\n itemsUrl.searchParams.set('zoom', 'item_options');\n shipmentsLink = shipmentsUrl.toString();\n itemsLink = itemsUrl.toString();\n } catch {\n //\n }\n }\n\n return html`\n <h2>\n <div class=\"flex items-center gap-s leading-xs text-xxl font-medium break-all\">\n <foxy-i18n infer=\"header\" key=\"title\" .options=${this.data}></foxy-i18n>\n <foxy-copy-to-clipboard\n infer=\"header\"\n class=\"inline-block text-m\"\n text=${this.data?.display_id}\n >\n </foxy-copy-to-clipboard>\n </div>\n\n <foxy-i18n\n class=\"block leading-xs text-l text-secondary\"\n infer=\"header\"\n key=${subtitleKey}\n .options=${{\n transaction_date: this.data?.transaction_date,\n ip_country: this.data?.ip_country,\n }}\n >\n </foxy-i18n>\n\n <foxy-internal-transaction-actions-control class=\"mt-xs\" infer=\"actions\">\n </foxy-internal-transaction-actions-control>\n </h2>\n\n ${alertStatuses.includes(this.data?.status ?? '')\n ? html`\n <p\n class=\"leading-xs text-body rounded bg-error-10 block\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 1px)\"\n >\n <foxy-i18n infer=\"header\" key=\"alert_status_${this.data?.status}\"></foxy-i18n>\n </p>\n `\n : ''}\n\n <foxy-internal-transaction-customer-control infer=\"customer\">\n </foxy-internal-transaction-customer-control>\n\n <div\n class=\"grid gap-s\"\n ?hidden=${hidden.matches('items', true) && hidden.matches('summary', true)}\n >\n <foxy-internal-async-list-control\n infer=\"items\"\n class=\"min-w-0\"\n first=${ifDefined(itemsLink)}\n limit=\"10\"\n item=\"foxy-item-card\"\n form=\"foxy-item-form\"\n alert\n .related=${[this.href]}\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-transaction-summary-control infer=\"summary\" class=\"min-w-0\">\n </foxy-internal-transaction-summary-control>\n </div>\n\n <foxy-internal-async-list-control\n infer=\"billing-addresses\"\n first=${ifDefined(this.data?._links['fx:billing_addresses'].href)}\n item=\"foxy-billing-address-card\"\n form=\"foxy-address-form\"\n hide-create-button\n hide-delete-button\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"payments\"\n first=${ifDefined(this.data?._links['fx:payments'].href)}\n item=\"foxy-payment-card\"\n .itemProps=${{\n 'hosted-payment-gateways-helper': this.hostedPaymentGatewaysHelper,\n 'payment-gateways-helper': this.paymentGatewaysHelper,\n }}\n >\n </foxy-internal-async-list-control>\n\n <div\n class=\"grid gap-m sm-grid-cols-2\"\n ?hidden=${hidden.matches('custom-fields', true) && hidden.matches('attributes', true)}\n >\n <foxy-internal-async-list-control\n infer=\"custom-fields\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:custom_fields'].href)}\n limit=\"5\"\n form=\"foxy-custom-field-form\"\n item=\"foxy-custom-field-card\"\n alert\n >\n </foxy-internal-async-list-control>\n\n <foxy-internal-async-list-control\n infer=\"attributes\"\n class=\"min-w-0\"\n first=${ifDefined(this.data?._links['fx:attributes'].href)}\n limit=\"5\"\n form=\"foxy-attribute-form\"\n item=\"foxy-attribute-card\"\n alert\n >\n </foxy-internal-async-list-control>\n </div>\n\n <foxy-internal-async-list-control\n infer=\"shipments\"\n first=${ifDefined(shipmentsLink)}\n item=\"foxy-shipment-card\"\n >\n </foxy-internal-async-list-control>\n `;\n }\n}\n"]}
@@ -51,12 +51,14 @@ export class InternalTransactionSummaryControl extends InternalControl {
51
51
  <span>${this.__renderPrice(tax.amount, true)}</span>
52
52
  `;
53
53
  })}
54
- ${(_g = (_f = data === null || data === void 0 ? void 0 : data._embedded) === null || _f === void 0 ? void 0 : _f['fx:applied_gift_card_codes']) === null || _g === void 0 ? void 0 : _g.map(code => {
54
+ ${
55
+ // @ts-expect-error SDK doesn't support name mismatch between `fx:applied_gift_card_codes` and `fx:gift_card_logs`
56
+ (_g = (_f = data === null || data === void 0 ? void 0 : data._embedded) === null || _f === void 0 ? void 0 : _f['fx:applied_gift_card_codes']) === null || _g === void 0 ? void 0 : _g.map(code => {
55
57
  var _a;
56
58
  return html `
57
- <span>${code._embedded['fx:gift_card'].name}&colon;</span>
58
- <span>${this.__renderPrice((_a = code.balance_adjustment) !== null && _a !== void 0 ? _a : 0, true)}</span>
59
- `;
59
+ <span>${code._embedded['fx:gift_card'].name}&colon;</span>
60
+ <span>${this.__renderPrice((_a = code.balance_adjustment) !== null && _a !== void 0 ? _a : 0, true)}</span>
61
+ `;
60
62
  })}
61
63
  ${(_j = (_h = data === null || data === void 0 ? void 0 : data._embedded) === null || _h === void 0 ? void 0 : _h['fx:discounts']) === null || _j === void 0 ? void 0 : _j.map(discount => {
62
64
  return html `
@@ -1 +1 @@
1
- {"version":3,"file":"InternalTransactionSummaryControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/Transaction/internal/InternalTransactionSummaryControl/InternalTransactionSummaryControl.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,gEAA6D;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,OAAO,iCAAkC,SAAQ,eAAe;IAAtE;;QACmB,oBAAe,GAAG,aAAa,CAAC;IA4HnD,CAAC;IA1HC,aAAa;;QACX,MAAM,IAAI,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAwB,CAAC;QACpD,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAA,EAAE,CAAC;QAEzB,MAAM,KAAK,eAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,0CAAG,kBAAkB,oCAAK,EAAE,CAAC;QAC1D,MAAM,SAAS,eAAG,IAAI,CAAC,SAAS,0CAAG,cAAc,oCAAK,EAAE,CAAC;QAEzD,OAAO,IAAI,CAAA;;;eAGA,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC;aAC7B,IAAI,CAAC,eAAe;kBACf,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,EAAE;;;;;;;;;gBAS5B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,gBAAqC,CAAC;;UAEpE,SAAS,CAAC,MAAM,KAAK,CAAC,IAAK,IAAI,CAAC,cAAoC,KAAK,CAAC;YAC1E,CAAC,CAAC,IAAI,CAAA;;sBAEM,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,cAAmC,EAAE,IAAI,CAAC;aAC3E;YACH,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;gBACvB,OAAO,IAAI,CAAA;wBACD,QAAQ,C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C,KAAK,GAAG,kCAAkC,CAAC;SAC5C;aAAM,IAAI,CAAC,SAAS,EAAE,sBAAsB,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACvF,KAAK,GAAG,8BAA8B,CAAC;SACxC;aAAM;YACL,KAAK,GAAG,yBAAyB,CAAC;SACnC;QAED,OAAO,IAAI,CAAA;;;iBAGE,KAAK;sBACA,MAAM;;KAEvB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { NucleonElement } from '../../../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Data } from '../../types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { InternalControl } from '../../../../internal/InternalControl/InternalControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nexport class InternalTransactionSummaryControl extends InternalControl {\n private readonly __storeLoaderId = 'storeLoader';\n\n renderControl(): TemplateResult {\n const data = this.nucleon?.data as Data | undefined;\n if (!data) return html``;\n\n const taxes = data?._embedded?.['fx:applied_taxes'] ?? [];\n const shipments = data._embedded?.['fx:shipments'] ?? [];\n\n return html`\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.__storeHref)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <p\n class=\"grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 2px); grid-template-columns: 1fr min-content\"\n >\n <span><foxy-i18n key=\"subtotal\" infer=\"\"></foxy-i18n>&colon;</span>\n <span>${this.__renderPrice(data.total_item_price as unknown as number)}</span>\n\n ${shipments.length === 0 || (data.total_shipping as unknown as number) === 0\n ? html`\n <span><foxy-i18n infer=\"\" key=\"total_shipping\"></foxy-i18n>&colon;</span>\n <span>${this.__renderPrice(data.total_shipping as unknown as number, true)} </span>\n `\n : shipments.map(shipment => {\n return html`\n <span>${shipment.shipping_service_description}&colon;</span>\n <span>${this.__renderPrice(shipment.total_shipping, true)}</span>\n `;\n })}\n ${taxes.length === 0 || (data.total_tax as unknown as number) === 0\n ? html`\n <span><foxy-i18n infer=\"\" key=\"total_tax\"></foxy-i18n>&colon;</span>\n <span>${this.__renderPrice(data.total_tax as unknown as number, true)}</span>\n `\n : taxes.map(tax => {\n return html`\n <span>${tax.name}&colon;</span>\n <span>${this.__renderPrice(tax.amount, true)}</span>\n `;\n })}\n ${data?._embedded?.['fx:applied_gift_card_codes']?.map(code => {\n return html`\n <span>${code._embedded['fx:gift_card'].name}&colon;</span>\n <span>${this.__renderPrice(code.balance_adjustment ?? 0, true)}</span>\n `;\n })}\n ${data?._embedded?.['fx:discounts']?.map(discount => {\n return html`\n <span data-testclass=\"discount\">${discount.name}&colon;</span>\n <span>${this.__renderPrice(discount.amount, true)}</span>\n `;\n })}\n\n <span class=\"col-span-2 border-t border-dashed border-contrast-20 my-s\"></span>\n\n <span class=\"col-span-2 flex gap-s justify-between items-center\">\n ${this.__renderStatus()}\n <span class=\"text-xl font-medium leading-xs\">\n <foxy-i18n infer=\"\" key=\"total\"></foxy-i18n>&colon;\n ${this.__renderPrice(data.total_order)}\n </span>\n </span>\n </p>\n `;\n }\n\n private get __storeHref() {\n return this.nucleon?.data?._links['fx:store']?.href as string | undefined;\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 __renderPrice(amount: number, isAdditive = false) {\n const currencyDisplay = this.__store?.use_international_currency_symbol ? 'code' : 'symbol';\n const currencyCode = this.nucleon?.data?.currency_code as string | undefined;\n\n return html`\n <foxy-i18n\n class=${isAdditive && amount !== 0 ? (amount > 0 ? 'text-success' : 'text-error') : ''}\n infer=\"\"\n key=\"price\"\n .options=${{\n currencyDisplay,\n signDisplay: isAdditive ? 'exceptZero' : 'auto',\n amount: `${amount} ${currencyCode}`,\n }}\n >\n </foxy-i18n>\n `;\n }\n\n private __renderStatus() {\n const status = this.nucleon?.data?.status || 'completed';\n let color = '';\n\n if (['capturing', 'captured', 'approved', 'authorized', 'pending'].includes(status)) {\n color = 'text-success bg-success-10';\n } else if (!status || status === 'completed') {\n color = 'text-success-contrast bg-success';\n } else if (['problem', 'pending_fraud_review', 'rejected', 'declined'].includes(status)) {\n color = 'text-error-contrast bg-error';\n } else {\n color = 'bg-contrast-5 text-body';\n }\n\n return html`\n <foxy-i18n\n infer=\"\"\n class=\"${color} rounded-s py-xs px-s font-medium text-s leading-xs\"\n key=\"status_${status}\"\n ></foxy-i18n>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"InternalTransactionSummaryControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/Transaction/internal/InternalTransactionSummaryControl/InternalTransactionSummaryControl.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,eAAe,EAAE,gEAA6D;AACvF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,OAAO,iCAAkC,SAAQ,eAAe;IAAtE;;QACmB,oBAAe,GAAG,aAAa,CAAC;IA+HnD,CAAC;IA7HC,aAAa;;QACX,MAAM,IAAI,GAAG,MAAA,IAAI,CAAC,OAAO,0CAAE,IAAwB,CAAC;QACpD,IAAI,CAAC,IAAI;YAAE,OAAO,IAAI,CAAA,EAAE,CAAC;QAEzB,MAAM,KAAK,eAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,0CAAG,kBAAkB,oCAAK,EAAE,CAAC;QAC1D,MAAM,SAAS,eAAG,IAAI,CAAC,SAAS,0CAAG,cAAc,oCAAK,EAAE,CAAC;QAEzD,OAAO,IAAI,CAAA;;;eAGA,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC;aAC7B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YAC/C,MAAM,EAAE,GAAG,MAAM,IAAI,YAAY,EAAE;SACpC;;;KAGJ,CAAC;IACJ,CAAC;IAEO,cAAc;;QACpB,MAAM,MAAM,GAAG,aAAA,IAAI,CAAC,OAAO,0CAAE,IAAI,0CAAE,MAAM,KAAI,WAAW,CAAC;QACzD,IAAI,KAAK,GAAG,EAAE,CAAC;QAEf,IAAI,CAAC,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACnF,KAAK,GAAG,4BAA4B,CAAC;SACtC;aAAM,IAAI,CAAC,MAAM,IAAI,MAAM,KAAK,WAAW,EAAE;YAC5C,KAAK,GAAG,kCAAkC,CAAC;SAC5C;aAAM,IAAI,CAAC,SAAS,EAAE,sBAAsB,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;YACvF,KAAK,GAAG,8BAA8B,CAAC;SACxC;aAAM;YACL,KAAK,GAAG,yBAAyB,CAAC;SACnC;QAED,OAAO,IAAI,CAAA;;;iBAGE,KAAK;sBACA,MAAM;;KAEvB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { NucleonElement } from '../../../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Data } from '../../types';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { InternalControl } from '../../../../internal/InternalControl/InternalControl';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nexport class InternalTransactionSummaryControl extends InternalControl {\n private readonly __storeLoaderId = 'storeLoader';\n\n renderControl(): TemplateResult {\n const data = this.nucleon?.data as Data | undefined;\n if (!data) return html``;\n\n const taxes = data?._embedded?.['fx:applied_taxes'] ?? [];\n const shipments = data._embedded?.['fx:shipments'] ?? [];\n\n return html`\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.__storeHref)}\n id=${this.__storeLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <p\n class=\"grid gap-x-s text-right text-s leading-m border-dashed border rounded border-contrast-20 whitespace-nowrap overflow-auto\"\n style=\"padding: calc(0.625em + (var(--lumo-border-radius) / 4) - 2px); grid-template-columns: 1fr min-content\"\n >\n <span><foxy-i18n key=\"subtotal\" infer=\"\"></foxy-i18n>&colon;</span>\n <span>${this.__renderPrice(data.total_item_price as unknown as number)}</span>\n\n ${shipments.length === 0 || (data.total_shipping as unknown as number) === 0\n ? html`\n <span><foxy-i18n infer=\"\" key=\"total_shipping\"></foxy-i18n>&colon;</span>\n <span>${this.__renderPrice(data.total_shipping as unknown as number, true)} </span>\n `\n : shipments.map(shipment => {\n return html`\n <span>${shipment.shipping_service_description}&colon;</span>\n <span>${this.__renderPrice(shipment.total_shipping, true)}</span>\n `;\n })}\n ${taxes.length === 0 || (data.total_tax as unknown as number) === 0\n ? html`\n <span><foxy-i18n infer=\"\" key=\"total_tax\"></foxy-i18n>&colon;</span>\n <span>${this.__renderPrice(data.total_tax as unknown as number, true)}</span>\n `\n : taxes.map(tax => {\n return html`\n <span>${tax.name}&colon;</span>\n <span>${this.__renderPrice(tax.amount, true)}</span>\n `;\n })}\n ${\n // @ts-expect-error SDK doesn't support name mismatch between `fx:applied_gift_card_codes` and `fx:gift_card_logs`\n data?._embedded?.['fx:applied_gift_card_codes']?.map(code => {\n return html`\n <span>${code._embedded['fx:gift_card'].name}&colon;</span>\n <span>${this.__renderPrice(code.balance_adjustment ?? 0, true)}</span>\n `;\n })\n }\n ${data?._embedded?.['fx:discounts']?.map(discount => {\n return html`\n <span data-testclass=\"discount\">${discount.name}&colon;</span>\n <span>${this.__renderPrice(discount.amount, true)}</span>\n `;\n })}\n\n <span class=\"col-span-2 border-t border-dashed border-contrast-20 my-s\"></span>\n\n <span class=\"col-span-2 flex gap-s justify-between items-center\">\n ${this.__renderStatus()}\n <span class=\"text-xl font-medium leading-xs\">\n <foxy-i18n infer=\"\" key=\"total\"></foxy-i18n>&colon;\n ${this.__renderPrice(data.total_order)}\n </span>\n </span>\n </p>\n `;\n }\n\n private get __storeHref() {\n return this.nucleon?.data?._links['fx:store']?.href as string | undefined;\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 __renderPrice(amount: number, isAdditive = false) {\n const currencyDisplay = this.__store?.use_international_currency_symbol ? 'code' : 'symbol';\n const currencyCode = this.nucleon?.data?.currency_code as string | undefined;\n\n return html`\n <foxy-i18n\n class=${isAdditive && amount !== 0 ? (amount > 0 ? 'text-success' : 'text-error') : ''}\n infer=\"\"\n key=\"price\"\n .options=${{\n currencyDisplay,\n signDisplay: isAdditive ? 'exceptZero' : 'auto',\n amount: `${amount} ${currencyCode}`,\n }}\n >\n </foxy-i18n>\n `;\n }\n\n private __renderStatus() {\n const status = this.nucleon?.data?.status || 'completed';\n let color = '';\n\n if (['capturing', 'captured', 'approved', 'authorized', 'pending'].includes(status)) {\n color = 'text-success bg-success-10';\n } else if (!status || status === 'completed') {\n color = 'text-success-contrast bg-success';\n } else if (['problem', 'pending_fraud_review', 'rejected', 'declined'].includes(status)) {\n color = 'text-error-contrast bg-error';\n } else {\n color = 'bg-contrast-5 text-body';\n }\n\n return html`\n <foxy-i18n\n infer=\"\"\n class=\"${color} rounded-s py-xs px-s font-medium text-s leading-xs\"\n key=\"status_${status}\"\n ></foxy-i18n>\n `;\n }\n}\n"]}
@@ -1,21 +1,7 @@
1
1
  import type { Resource } from '@foxy.io/sdk/core';
2
2
  import type { Rels } from '@foxy.io/sdk/backend';
3
- export declare type Data = Omit<Resource<Rels.Transaction, {
4
- zoom: ['applied_taxes', 'shipments'];
5
- }>, 'type'> & {
6
- _embedded?: {
7
- 'fx:applied_gift_card_codes': Resource<Rels.GiftCardCodeLogs['child'], {
8
- zoom: 'gift_card';
9
- }>[];
10
- 'fx:discounts'?: Resource<Rels.Discount>[];
11
- };
12
- _links?: {
13
- 'fx:subscription'?: {
14
- href: string;
15
- };
16
- };
17
- user_agent: string;
18
- display_id: string | number;
19
- source: string;
20
- type: Rels.Transaction['props']['type'] | '';
21
- };
3
+ export declare type Data = Resource<Rels.Transaction, {
4
+ zoom: [{
5
+ applied_gift_card_codes: ['gift_card'];
6
+ }, 'applied_taxes', 'shipments', 'discounts'];
7
+ }>;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/Transaction/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\n// TODO: simplify once SDK types are fixed\n\nexport type Data = Omit<\n Resource<Rels.Transaction, { zoom: ['applied_taxes', 'shipments'] }>,\n 'type'\n> & {\n _embedded?: {\n 'fx:applied_gift_card_codes': Resource<Rels.GiftCardCodeLogs['child'], { zoom: 'gift_card' }>[];\n 'fx:discounts'?: Resource<Rels.Discount>[];\n };\n _links?: {\n 'fx:subscription'?: { href: string };\n };\n user_agent: string;\n display_id: string | number;\n source: string;\n type: Rels.Transaction['props']['type'] | '';\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/Transaction/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nexport type Data = Resource<\n Rels.Transaction,\n { zoom: [{ applied_gift_card_codes: ['gift_card'] }, 'applied_taxes', 'shipments', 'discounts'] }\n>;\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@foxy.io/elements",
3
3
  "type": "module",
4
- "version": "1.25.0-beta.4",
4
+ "version": "1.25.0",
5
5
  "description": "E-commerce web components by Foxy.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -28,7 +28,7 @@
28
28
  "prepack": "npm run lint && rimraf dist && node ./.build/compile-for-npm.js && rollup -c"
29
29
  },
30
30
  "dependencies": {
31
- "@foxy.io/sdk": "^1.11.0",
31
+ "@foxy.io/sdk": "^1.11.2",
32
32
  "@open-wc/lit-helpers": "^0.3.12",
33
33
  "@open-wc/scoped-elements": "^1.2.1",
34
34
  "@polymer/iron-icons": "^3.0.1",