@foxy.io/elements 1.18.0-beta.22 → 1.18.0-beta.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-address-card.js +85 -3
- package/dist/cdn/foxy-customer-portal.js +1 -1
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-shipment-card.js +1 -1
- package/dist/cdn/foxy-store-form.js +1 -1
- package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
- package/dist/cdn/foxy-transaction.js +1 -1
- package/dist/cdn/shared-4979dca4.js +1 -0
- package/dist/cdn/translations/store-shipping-method-form/en.json +10 -10
- package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.d.ts +84 -1
- package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.js +88 -15
- package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.js.map +1 -1
- package/dist/elements/public/ItemCategoryForm/internal/InternalItemCategoryFormTaxesControl/InternalItemCategoryFormTaxesControl.js +1 -1
- package/dist/elements/public/ItemCategoryForm/internal/InternalItemCategoryFormTaxesControl/InternalItemCategoryFormTaxesControl.js.map +1 -1
- package/dist/elements/public/ItemCategoryForm/internal/InternalItemCategoryFormTaxesControlItem/InternalItemCategoryFormTaxesControlItem.js +2 -2
- package/dist/elements/public/ItemCategoryForm/internal/InternalItemCategoryFormTaxesControlItem/InternalItemCategoryFormTaxesControlItem.js.map +1 -1
- package/dist/elements/public/ItemCategoryForm/types.d.ts +53 -1
- package/dist/elements/public/ItemCategoryForm/types.js.map +1 -1
- package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.d.ts +46 -1
- package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.js +85 -29
- package/dist/elements/public/StoreShippingMethodForm/StoreShippingMethodForm.js.map +1 -1
- package/dist/elements/public/StoreShippingMethodForm/index.d.ts +1 -3
- package/dist/elements/public/StoreShippingMethodForm/index.js +1 -3
- package/dist/elements/public/StoreShippingMethodForm/index.js.map +1 -1
- package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesControl/InternalStoreShippingMethodFormServicesControl.d.ts +1 -1
- package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesControl/InternalStoreShippingMethodFormServicesControl.js +3 -3
- package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesControl/InternalStoreShippingMethodFormServicesControl.js.map +1 -1
- package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPage/InternalStoreShippingMethodFormServicesPage.d.ts +4 -4
- package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPage/InternalStoreShippingMethodFormServicesPage.js +6 -6
- package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPage/InternalStoreShippingMethodFormServicesPage.js.map +1 -1
- package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItem/InternalStoreShippingMethodFormServicesPageItem.d.ts +4 -4
- package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItem/InternalStoreShippingMethodFormServicesPageItem.js +3 -3
- package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItem/InternalStoreShippingMethodFormServicesPageItem.js.map +1 -1
- package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItemContent/InternalStoreShippingMethodFormServicesPageItemContent.d.ts +4 -4
- package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItemContent/InternalStoreShippingMethodFormServicesPageItemContent.js +3 -3
- package/dist/elements/public/StoreShippingMethodForm/internal/InternalStoreShippingMethodFormServicesPageItemContent/InternalStoreShippingMethodFormServicesPageItemContent.js.map +1 -1
- package/dist/elements/public/StoreShippingMethodForm/types.d.ts +33 -1
- package/dist/elements/public/StoreShippingMethodForm/types.js.map +1 -1
- package/package.json +1 -1
- package/dist/cdn/shared-5b177708.js +0 -82
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-custom-field-form.js";import"./foxy-custom-field-card.js";import"./foxy-applied-tax-card.js";import"./foxy-discount-card.js";import"./foxy-shipment-card.js";import"./foxy-payment-card.js";import"./foxy-item-form.js";import"./shared-0821cfdc.js";import"./shared-a0c8faf2.js";import{I as t}from"./shared-6581241a.js";import{I as r}from"./shared-9bdacf65.js";import"./foxy-customer-card.js";import"./foxy-form-dialog.js";import"./foxy-customer.js";import{h as o,c as e}from"./shared-7f33a83a.js";import{i}from"./shared-d3bf9ac0.js";import"./shared-bc814810.js";import"./shared-8dd0af4d.js";import{_ as s}from"./shared-a8ced8bf.js";import{N as n}from"./shared-181f51bd.js";import{a}from"./shared-2cc638ad.js";import{B as d}from"./shared-76b3d76a.js";import"./shared-2092d86f.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-4f037e43.js";import"./shared-43bcce74.js";import"./shared-4e709717.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";import"./shared-ed0dee03.js";import"./shared-be66c2e7.js";import"./shared-08156595.js";import"./shared-5ea18e60.js";import"./shared-5a4829e3.js";import"./shared-1c94a156.js";import"./shared-bd252323.js";import"./shared-7d4fb1a2.js";import"./shared-4849ef5b.js";import"./shared-6cb1015f.js";import"./shared-08e27fe9.js";import"./shared-11c2efc8.js";import"./shared-62a54a6c.js";import"./shared-101d1234.js";import"./shared-404aa9cc.js";import"./shared-d8dc97f0.js";import"./shared-5378bd8c.js";import"./shared-88c4cfec.js";import"./shared-868065de.js";import"./shared-486d7bb5.js";import"./foxy-address-card.js";import"./shared-5b177708.js";import"./foxy-item-card.js";import"./shared-21679ebd.js";import"./foxy-nucleon-element.js";import"./shared-988ec916.js";import"./shared-39c10b22.js";import"./shared-d518bd55.js";import"./shared-80fc2b6a.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-coupon-card.js";import"./shared-c95c17e6.js";import"./foxy-discount-builder.js";import"./shared-d519a301.js";import"./shared-e6f3e9f0.js";import"./shared-af226a9a.js";import"./shared-a41234b4.js";import"./shared-bc7f58ef.js";import"./shared-f7e4cd67.js";import"./foxy-subscription-card.js";import"./shared-d61b3e4f.js";import"./foxy-subscription-form.js";import"./shared-1000b848.js";import"./foxy-collection-page.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./foxy-cancellation-form.js";import"./foxy-transaction-card.js";import"./shared-ea67b3f3.js";import"./shared-75e78c70.js";import"./shared-99065f2a.js";import"./foxy-payment-method-card.js";import"./foxy-transactions-table.js";import"./shared-f80f402a.js";import"./foxy-collection-pages.js";import"./foxy-customer-form.js";import"./shared-b738ee96.js";import"./foxy-address-form.js";import"./foxy-table.js";import"./shared-4f9d2417.js";let l,c=t=>t;customElements.define("foxy-internal-transaction-customer-control",class extends r{renderControl(){var t,r,e,s;return o(l||(l=c` <foxy-internal-details summary="customer" infer="" open> <foxy-form-dialog header="header" infer="dialog" form="foxy-customer" href="${0}" id="dialog"> </foxy-form-dialog> <button class="w-full text-left block rounded-b-l transition-colors hover-bg-contrast-5 focus-outline-none focus-ring-2 focus-ring-primary-50" @click="${0}"> <foxy-customer-card infer="card" class="p-m" href="${0}"> </foxy-customer-card> </button> </foxy-internal-details> `),i(null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===r?void 0:r._links["fx:customer"].href),(t=>{this.renderRoot.querySelector("#dialog").show(t.currentTarget)}),i(null===(s=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===s?void 0:s._links["fx:customer"].href))}});let f,m=t=>t;customElements.define("foxy-internal-transaction-post-action-control",class extends r{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return s(s({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const t=this.__state,r="fail"===t?"error":"idle"===t?this.theme:"";return o(f||(f=m` <foxy-internal-confirm-dialog header="header" infer="confirm" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button class="w-full" theme="${0} tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),(t=>!t.detail.cancelled&&this.__submit()),r,"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 r=new n.API(this),o=await r.fetch(null!==(t=this.href)&&void 0!==t?t:"",{method:"POST"});this.__state=o.ok?"idle":"fail",o.ok&&this.dispatchEvent(new CustomEvent("done"))}catch(t){this.__state="fail"}}});let u,p,h,y,x,v=t=>t;customElements.define("foxy-internal-transaction-actions-control",class extends r{renderControl(){var t,r,e,i,s,n,a,d;return o(u||(u=v` <div class="divide-y divide-contrast-10"> ${0} ${0} ${0} ${0} </div> `),(null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===r?void 0:r._links["fx:capture"])?this.__renderCaptureAction():"",(null===(i=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===i?void 0:i._links["fx:void"])?this.__renderVoidAction():"",(null===(n=null===(s=this.nucleon)||void 0===s?void 0:s.data)||void 0===n?void 0:n._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():"")}__renderSendEmailsAction(){var t,r;return o(p||(p=v` <foxy-internal-transaction-post-action-control infer="send-emails" theme="contrast" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),i(null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===r?void 0:r._links["fx:send_emails"].href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderCaptureAction(){var t,r;return o(h||(h=v` <foxy-internal-transaction-post-action-control theme="success" infer="capture" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),i(null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===r?void 0:r._links["fx:capture"].href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderVoidAction(){var t,r,e;return o(y||(y=v` <foxy-internal-transaction-post-action-control theme="error" infer="void" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),i(null===(e=null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===r?void 0:r._links["fx:void"])||void 0===e?void 0:e.href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderRefundAction(){var t,r,e;return o(x||(x=v` <foxy-internal-transaction-post-action-control theme="contrast" infer="refund" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),i(null===(e=null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===r?void 0:r._links["fx:refund"])||void 0===e?void 0:e.href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}});let j,_,b,$,g,k,w,S=t=>t;customElements.define("foxy-internal-transaction-summary-control",class extends r{renderControl(){var t;return o(j||(j=S` <div class="border-t border-transparent"> <div class="h-m flex items-center justify-between"> <div class="text-xl font-bold">${0}</div> <div>${0}</div> </div> <div class="border-t border-contrast-10 mb-s"></div> ${0} </div> `),this.__renderPrice(),(null===(t=this.nucleon)||void 0===t?void 0:t.data)?this.__renderStatus():"",this.__renderTotals())}__renderStatus(){var t,r;const e={authorized:"bg-success text-success-contrast",completed:"bg-success text-success-contrast",declined:"bg-error text-error-contrast",rejected:"bg-error text-error-contrast"},i=(null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===r?void 0:r.status)||"completed";return o(_||(_=S` <foxy-i18n class="flex items-center h-xs px-s text-s font-semibold rounded ${0}" infer="" key="transaction_${0}"> </foxy-i18n> `),i in e?e[i]:"bg-contrast-5 text-contrast",i)}__renderPrice(){var t;const r=null===(t=this.nucleon)||void 0===t?void 0:t.data,e=null==r?void 0:r.currency_code;if(!r)return o(b||(b=S`--`));const i={amount:`${r.total_order} ${e}`};return o($||($=S`<foxy-i18n infer="" key="price" .options="${0}"></foxy-i18n>`),i)}__renderTotals(){var t;const r=null===(t=this.nucleon)||void 0===t?void 0:t.data,e=null==r?void 0:r.currency_code;return["total_item_price","total_shipping","total_tax"].map((t=>{const i={amount:`${null==r?void 0:r[t]} ${e}`};return o(g||(g=S` <div class="flex justify-between text-m text-secondary"> <foxy-i18n key="${0}" infer=""></foxy-i18n> ${0} </div> `),t,r?o(k||(k=S`<foxy-i18n infer="" key="price" .options="${0}"></foxy-i18n>`),i):o(w||(w=S`<span>--</span>`)))}))}});let A,E,C=t=>t;class T extends(a(t,"transaction")){static get styles(){return[...super.styles,e(A||(A=C`#body{display:grid;grid-template-columns:repeat(auto-fill,minmax(calc(18.75 * var(--lumo-space-m)),1fr))}#body>:first-child{grid-column-start:1;grid-column-end:-2}`))]}get readonlySelector(){var t,r,o;return Boolean(null!==(r=null===(t=this.data)||void 0===t?void 0:t._links["fx:void"])&&void 0!==r?r:null===(o=this.data)||void 0===o?void 0:o._links["fx:refund"])?super.readonlySelector:new d(`${super.readonlySelector} attributes custom-fields`)}renderBody(){var t,r,e,s,n,a;return o(E||(E=C` <div id="body" class="gap-m"> <foxy-internal-async-details-control infer="shipments" first="${0}" item="foxy-shipment-card" open> </foxy-internal-async-details-control> <div class="grid gap-m self-start"> <foxy-internal-transaction-summary-control infer="summary"> </foxy-internal-transaction-summary-control> <foxy-internal-transaction-customer-control infer="customer"> </foxy-internal-transaction-customer-control> <foxy-internal-async-details-control infer="payments" class="max-w-full overflow-hidden" first="${0}" limit="1" item="foxy-payment-card" open> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="discounts" first="${0}" limit="5" item="foxy-discount-card"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="applied-taxes" first="${0}" limit="5" item="foxy-applied-tax-card"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="custom-fields" first="${0}" limit="5" form="foxy-custom-field-form" item="foxy-custom-field-card" .related="${0}"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="attributes" first="${0}" limit="5" form="foxy-attribute-form" item="foxy-attribute-card" .related="${0}"> </foxy-internal-async-details-control> <foxy-internal-transaction-actions-control infer="actions"> </foxy-internal-transaction-actions-control> </div> </div> `),i(null===(t=this.data)||void 0===t?void 0:t._links["fx:shipments"].href),i(null===(r=this.data)||void 0===r?void 0:r._links["fx:payments"].href),i(null===(e=this.data)||void 0===e?void 0:e._links["fx:discounts"].href),i(null===(s=this.data)||void 0===s?void 0:s._links["fx:applied_taxes"].href),i(null===(n=this.data)||void 0===n?void 0:n._links["fx:custom_fields"].href),[this.href],i(null===(a=this.data)||void 0===a?void 0:a._links["fx:attributes"].href),[this.href])}}customElements.define("foxy-transaction",T);export{T as Transaction};
|
|
1
|
+
import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-custom-field-form.js";import"./foxy-custom-field-card.js";import"./foxy-applied-tax-card.js";import"./foxy-discount-card.js";import"./foxy-shipment-card.js";import"./foxy-payment-card.js";import"./foxy-item-form.js";import"./shared-0821cfdc.js";import"./shared-a0c8faf2.js";import{I as t}from"./shared-6581241a.js";import{I as r}from"./shared-9bdacf65.js";import"./foxy-customer-card.js";import"./foxy-form-dialog.js";import"./foxy-customer.js";import{h as o,c as e}from"./shared-7f33a83a.js";import{i}from"./shared-d3bf9ac0.js";import"./shared-bc814810.js";import"./shared-8dd0af4d.js";import{_ as s}from"./shared-a8ced8bf.js";import{N as n}from"./shared-181f51bd.js";import{a}from"./shared-2cc638ad.js";import{B as d}from"./shared-76b3d76a.js";import"./shared-2092d86f.js";import"./shared-62c088b7.js";import"./shared-0ce006b9.js";import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-4f037e43.js";import"./shared-43bcce74.js";import"./shared-4e709717.js";import"./shared-a85afa33.js";import"./shared-d6276c83.js";import"./shared-2f7dcefa.js";import"./shared-ed0dee03.js";import"./shared-be66c2e7.js";import"./shared-08156595.js";import"./shared-5ea18e60.js";import"./shared-5a4829e3.js";import"./shared-1c94a156.js";import"./shared-bd252323.js";import"./shared-7d4fb1a2.js";import"./shared-4849ef5b.js";import"./shared-6cb1015f.js";import"./shared-08e27fe9.js";import"./shared-11c2efc8.js";import"./shared-62a54a6c.js";import"./shared-101d1234.js";import"./shared-404aa9cc.js";import"./shared-d8dc97f0.js";import"./shared-5378bd8c.js";import"./shared-88c4cfec.js";import"./shared-868065de.js";import"./shared-486d7bb5.js";import"./foxy-address-card.js";import"./foxy-item-card.js";import"./shared-21679ebd.js";import"./foxy-nucleon-element.js";import"./shared-988ec916.js";import"./shared-39c10b22.js";import"./shared-d518bd55.js";import"./shared-80fc2b6a.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-coupon-card.js";import"./shared-c95c17e6.js";import"./foxy-discount-builder.js";import"./shared-d519a301.js";import"./shared-e6f3e9f0.js";import"./shared-af226a9a.js";import"./shared-a41234b4.js";import"./shared-bc7f58ef.js";import"./shared-f7e4cd67.js";import"./foxy-subscription-card.js";import"./shared-d61b3e4f.js";import"./foxy-subscription-form.js";import"./shared-1000b848.js";import"./foxy-collection-page.js";import"./foxy-swipe-actions.js";import"./foxy-pagination.js";import"./foxy-cancellation-form.js";import"./foxy-transaction-card.js";import"./shared-ea67b3f3.js";import"./shared-75e78c70.js";import"./shared-99065f2a.js";import"./foxy-payment-method-card.js";import"./foxy-transactions-table.js";import"./shared-f80f402a.js";import"./foxy-collection-pages.js";import"./foxy-customer-form.js";import"./shared-b738ee96.js";import"./foxy-address-form.js";import"./foxy-table.js";import"./shared-4f9d2417.js";let l,c=t=>t;customElements.define("foxy-internal-transaction-customer-control",class extends r{renderControl(){var t,r,e,s;return o(l||(l=c` <foxy-internal-details summary="customer" infer="" open> <foxy-form-dialog header="header" infer="dialog" form="foxy-customer" href="${0}" id="dialog"> </foxy-form-dialog> <button class="w-full text-left block rounded-b-l transition-colors hover-bg-contrast-5 focus-outline-none focus-ring-2 focus-ring-primary-50" @click="${0}"> <foxy-customer-card infer="card" class="p-m" href="${0}"> </foxy-customer-card> </button> </foxy-internal-details> `),i(null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===r?void 0:r._links["fx:customer"].href),(t=>{this.renderRoot.querySelector("#dialog").show(t.currentTarget)}),i(null===(s=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===s?void 0:s._links["fx:customer"].href))}});let f,m=t=>t;customElements.define("foxy-internal-transaction-post-action-control",class extends r{constructor(){super(...arguments),this.theme=null,this.href=null,this.__state="idle"}static get properties(){return s(s({},super.properties),{},{__state:{type:String},theme:{type:String},href:{type:String}})}renderControl(){const t=this.__state,r="fail"===t?"error":"idle"===t?this.theme:"";return o(f||(f=m` <foxy-internal-confirm-dialog header="header" infer="confirm" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button class="w-full" theme="${0} tertiary" ?disabled="${0}" @click="${0}"> <foxy-i18n key="${0}" infer=""></foxy-i18n> </vaadin-button> `),(t=>!t.detail.cancelled&&this.__submit()),r,"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 r=new n.API(this),o=await r.fetch(null!==(t=this.href)&&void 0!==t?t:"",{method:"POST"});this.__state=o.ok?"idle":"fail",o.ok&&this.dispatchEvent(new CustomEvent("done"))}catch(t){this.__state="fail"}}});let u,p,h,y,x,v=t=>t;customElements.define("foxy-internal-transaction-actions-control",class extends r{renderControl(){var t,r,e,i,s,n,a,d;return o(u||(u=v` <div class="divide-y divide-contrast-10"> ${0} ${0} ${0} ${0} </div> `),(null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===r?void 0:r._links["fx:capture"])?this.__renderCaptureAction():"",(null===(i=null===(e=this.nucleon)||void 0===e?void 0:e.data)||void 0===i?void 0:i._links["fx:void"])?this.__renderVoidAction():"",(null===(n=null===(s=this.nucleon)||void 0===s?void 0:s.data)||void 0===n?void 0:n._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():"")}__renderSendEmailsAction(){var t,r;return o(p||(p=v` <foxy-internal-transaction-post-action-control infer="send-emails" theme="contrast" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),i(null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===r?void 0:r._links["fx:send_emails"].href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderCaptureAction(){var t,r;return o(h||(h=v` <foxy-internal-transaction-post-action-control theme="success" infer="capture" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),i(null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===r?void 0:r._links["fx:capture"].href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderVoidAction(){var t,r,e;return o(y||(y=v` <foxy-internal-transaction-post-action-control theme="error" infer="void" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),i(null===(e=null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===r?void 0:r._links["fx:void"])||void 0===e?void 0:e.href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}__renderRefundAction(){var t,r,e;return o(x||(x=v` <foxy-internal-transaction-post-action-control theme="contrast" infer="refund" href="${0}" @done="${0}"> </foxy-internal-transaction-post-action-control> `),i(null===(e=null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===r?void 0:r._links["fx:refund"])||void 0===e?void 0:e.href),(()=>{var t;return null===(t=this.nucleon)||void 0===t?void 0:t.refresh()}))}});let j,_,b,$,g,k,w,S=t=>t;customElements.define("foxy-internal-transaction-summary-control",class extends r{renderControl(){var t;return o(j||(j=S` <div class="border-t border-transparent"> <div class="h-m flex items-center justify-between"> <div class="text-xl font-bold">${0}</div> <div>${0}</div> </div> <div class="border-t border-contrast-10 mb-s"></div> ${0} </div> `),this.__renderPrice(),(null===(t=this.nucleon)||void 0===t?void 0:t.data)?this.__renderStatus():"",this.__renderTotals())}__renderStatus(){var t,r;const e={authorized:"bg-success text-success-contrast",completed:"bg-success text-success-contrast",declined:"bg-error text-error-contrast",rejected:"bg-error text-error-contrast"},i=(null===(r=null===(t=this.nucleon)||void 0===t?void 0:t.data)||void 0===r?void 0:r.status)||"completed";return o(_||(_=S` <foxy-i18n class="flex items-center h-xs px-s text-s font-semibold rounded ${0}" infer="" key="transaction_${0}"> </foxy-i18n> `),i in e?e[i]:"bg-contrast-5 text-contrast",i)}__renderPrice(){var t;const r=null===(t=this.nucleon)||void 0===t?void 0:t.data,e=null==r?void 0:r.currency_code;if(!r)return o(b||(b=S`--`));const i={amount:`${r.total_order} ${e}`};return o($||($=S`<foxy-i18n infer="" key="price" .options="${0}"></foxy-i18n>`),i)}__renderTotals(){var t;const r=null===(t=this.nucleon)||void 0===t?void 0:t.data,e=null==r?void 0:r.currency_code;return["total_item_price","total_shipping","total_tax"].map((t=>{const i={amount:`${null==r?void 0:r[t]} ${e}`};return o(g||(g=S` <div class="flex justify-between text-m text-secondary"> <foxy-i18n key="${0}" infer=""></foxy-i18n> ${0} </div> `),t,r?o(k||(k=S`<foxy-i18n infer="" key="price" .options="${0}"></foxy-i18n>`),i):o(w||(w=S`<span>--</span>`)))}))}});let A,E,C=t=>t;class T extends(a(t,"transaction")){static get styles(){return[...super.styles,e(A||(A=C`#body{display:grid;grid-template-columns:repeat(auto-fill,minmax(calc(18.75 * var(--lumo-space-m)),1fr))}#body>:first-child{grid-column-start:1;grid-column-end:-2}`))]}get readonlySelector(){var t,r,o;return Boolean(null!==(r=null===(t=this.data)||void 0===t?void 0:t._links["fx:void"])&&void 0!==r?r:null===(o=this.data)||void 0===o?void 0:o._links["fx:refund"])?super.readonlySelector:new d(`${super.readonlySelector} attributes custom-fields`)}renderBody(){var t,r,e,s,n,a;return o(E||(E=C` <div id="body" class="gap-m"> <foxy-internal-async-details-control infer="shipments" first="${0}" item="foxy-shipment-card" open> </foxy-internal-async-details-control> <div class="grid gap-m self-start"> <foxy-internal-transaction-summary-control infer="summary"> </foxy-internal-transaction-summary-control> <foxy-internal-transaction-customer-control infer="customer"> </foxy-internal-transaction-customer-control> <foxy-internal-async-details-control infer="payments" class="max-w-full overflow-hidden" first="${0}" limit="1" item="foxy-payment-card" open> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="discounts" first="${0}" limit="5" item="foxy-discount-card"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="applied-taxes" first="${0}" limit="5" item="foxy-applied-tax-card"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="custom-fields" first="${0}" limit="5" form="foxy-custom-field-form" item="foxy-custom-field-card" .related="${0}"> </foxy-internal-async-details-control> <foxy-internal-async-details-control infer="attributes" first="${0}" limit="5" form="foxy-attribute-form" item="foxy-attribute-card" .related="${0}"> </foxy-internal-async-details-control> <foxy-internal-transaction-actions-control infer="actions"> </foxy-internal-transaction-actions-control> </div> </div> `),i(null===(t=this.data)||void 0===t?void 0:t._links["fx:shipments"].href),i(null===(r=this.data)||void 0===r?void 0:r._links["fx:payments"].href),i(null===(e=this.data)||void 0===e?void 0:e._links["fx:discounts"].href),i(null===(s=this.data)||void 0===s?void 0:s._links["fx:applied_taxes"].href),i(null===(n=this.data)||void 0===n?void 0:n._links["fx:custom_fields"].href),[this.href],i(null===(a=this.data)||void 0===a?void 0:a._links["fx:attributes"].href),[this.href])}}customElements.define("foxy-transaction",T);export{T as Transaction};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./shared-83596b46.js";import"./shared-08156595.js";import{I as e}from"./shared-39c10b22.js";import{i as r}from"./shared-d3bf9ac0.js";import{h as s}from"./shared-7f33a83a.js";let a,l=e=>e;customElements.define("foxy-internal-password-control",class extends e{renderControl(){return s(a||(a=l` <vaadin-password-field error-message="${0}" helper-text="${0}" placeholder="${0}" label="${0}" class="w-full" ?disabled="${0}" ?readonly="${0}" .checkValidity="${0}" .value="${0}" @keydown="${0}" @input="${0}"> </vaadin-password-field> `),r(this._errorMessage),this.helperText,this.placeholder,this.label,this.disabled,this.readonly,this._checkValidity,this._value,(e=>{var r;return"Enter"===e.key&&(null===(r=this.nucleon)||void 0===r?void 0:r.submit())}),(e=>{const r=e.currentTarget;this._value=r.value}))}get _value(){var e;return null!==(e=super._value)&&void 0!==e?e:""}set _value(e){super._value=e}});
|
|
@@ -3,19 +3,19 @@
|
|
|
3
3
|
"label": "Shipping Method",
|
|
4
4
|
"placeholder": "Select service",
|
|
5
5
|
"helper_text": "",
|
|
6
|
-
"
|
|
6
|
+
"v8n_required": "Please select a shipping method."
|
|
7
7
|
},
|
|
8
8
|
"shipping-container-uri": {
|
|
9
9
|
"label": "Container",
|
|
10
10
|
"placeholder": "Select container",
|
|
11
11
|
"helper_text": "",
|
|
12
|
-
"
|
|
12
|
+
"v8n_required": "Please select a shipping method."
|
|
13
13
|
},
|
|
14
14
|
"shipping-drop-type-uri": {
|
|
15
15
|
"label": "Drop Type",
|
|
16
16
|
"placeholder": "Select pickup",
|
|
17
17
|
"helper_text": "",
|
|
18
|
-
"
|
|
18
|
+
"v8n_required": "Please select a drop type."
|
|
19
19
|
},
|
|
20
20
|
"destinations": {
|
|
21
21
|
"label": "Destinations",
|
|
@@ -27,40 +27,40 @@
|
|
|
27
27
|
"label": "Authentication Key",
|
|
28
28
|
"placeholder": "N/A",
|
|
29
29
|
"helper_text": "If using account specific rates, enter your shipping account authentication key here, if applicable.",
|
|
30
|
-
"
|
|
30
|
+
"v8n_too_long": "Authentication key must be 50 characters or less."
|
|
31
31
|
},
|
|
32
32
|
"meter-number": {
|
|
33
33
|
"label": "Meter Number",
|
|
34
34
|
"placeholder": "N/A",
|
|
35
35
|
"helper_text": "If using account specific rates, enter your shipping account meter number here, if applicable.",
|
|
36
|
-
"
|
|
36
|
+
"v8n_too_long": "Meter number must be 50 characters or less."
|
|
37
37
|
},
|
|
38
38
|
"accountid": {
|
|
39
39
|
"label": "Account ID",
|
|
40
40
|
"placeholder": "N/A",
|
|
41
41
|
"helper_text": "If using account specific rates, enter your shipping account id here.",
|
|
42
|
-
"
|
|
42
|
+
"v8n_too_long": "Account ID must be 50 characters or less."
|
|
43
43
|
},
|
|
44
44
|
"endpoint": {
|
|
45
45
|
"label": "Endpoint URL",
|
|
46
46
|
"placeholder": "https://example.com/rates",
|
|
47
47
|
"helper_text": "Enter a URL that we'll poll for shipping rates.",
|
|
48
|
-
"
|
|
48
|
+
"v8n_required": "Please enter a valid endpoint URL."
|
|
49
49
|
},
|
|
50
50
|
"password": {
|
|
51
51
|
"label": "Password",
|
|
52
52
|
"placeholder": "N/A",
|
|
53
53
|
"helper_text": "If using account specific rates, enter your shipping account password here.",
|
|
54
|
-
"
|
|
54
|
+
"v8n_too_long": "Password must be 50 characters or less."
|
|
55
55
|
},
|
|
56
56
|
"custom-code": {
|
|
57
57
|
"label": "Custom Code",
|
|
58
58
|
"placeholder": "Paste your code here",
|
|
59
59
|
"helper_text": "JavaScript used to create and modify shipping rates.",
|
|
60
|
-
"
|
|
60
|
+
"v8n_too_long": "Please reduce the size of your custom code to 64KB or less."
|
|
61
61
|
},
|
|
62
62
|
"services": {
|
|
63
|
-
"
|
|
63
|
+
"label": "Additional services",
|
|
64
64
|
"first": "First",
|
|
65
65
|
"last": "Last",
|
|
66
66
|
"next": "Next",
|
|
@@ -1,15 +1,98 @@
|
|
|
1
1
|
import type { PropertyDeclarations } from 'lit-element';
|
|
2
|
+
import type { Templates, Data } from './types';
|
|
2
3
|
import type { TemplateResult } from 'lit-html';
|
|
3
4
|
import type { NucleonV8N } from '../NucleonElement/types';
|
|
4
|
-
import type { Data } from './types';
|
|
5
5
|
import { InternalForm } from '../../internal/InternalForm/InternalForm';
|
|
6
6
|
declare const ItemCategoryForm_base: typeof InternalForm & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
|
|
7
7
|
defaultNS: string;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* Form element for item categories (`fx:item_category`).
|
|
11
|
+
*
|
|
12
|
+
* @slot name:before
|
|
13
|
+
* @slot name:after
|
|
14
|
+
*
|
|
15
|
+
* @slot code:before
|
|
16
|
+
* @slot code:after
|
|
17
|
+
*
|
|
18
|
+
* @slot handling-fee-type:before
|
|
19
|
+
* @slot handling-fee-type:after
|
|
20
|
+
*
|
|
21
|
+
* @slot handling-fee:before
|
|
22
|
+
* @slot handling-fee:after
|
|
23
|
+
*
|
|
24
|
+
* @slot handling-fee-percentage:before
|
|
25
|
+
* @slot handling-fee-percentage:after
|
|
26
|
+
*
|
|
27
|
+
* @slot handling-fee-minimum:before
|
|
28
|
+
* @slot handling-fee-minimum:after
|
|
29
|
+
*
|
|
30
|
+
* @slot item-delivery-type:before
|
|
31
|
+
* @slot item-delivery-type:after
|
|
32
|
+
*
|
|
33
|
+
* @slot max-downloads-per-customer:before
|
|
34
|
+
* @slot max-downloads-per-customer:after
|
|
35
|
+
*
|
|
36
|
+
* @slot max-downloads-time-period:before
|
|
37
|
+
* @slot max-downloads-time-period:after
|
|
38
|
+
*
|
|
39
|
+
* @slot shipping-flat-rate:before
|
|
40
|
+
* @slot shipping-flat-rate:after
|
|
41
|
+
*
|
|
42
|
+
* @slot shipping-flat-rate-type:before
|
|
43
|
+
* @slot shipping-flat-rate-type:after
|
|
44
|
+
*
|
|
45
|
+
* @slot default-weight:before
|
|
46
|
+
* @slot default-weight:after
|
|
47
|
+
*
|
|
48
|
+
* @slot default-weight-unit:before
|
|
49
|
+
* @slot default-weight-unit:after
|
|
50
|
+
*
|
|
51
|
+
* @slot default-length-unit:before
|
|
52
|
+
* @slot default-length-unit:after
|
|
53
|
+
*
|
|
54
|
+
* @slot customs-value:before
|
|
55
|
+
* @slot customs-value:after
|
|
56
|
+
*
|
|
57
|
+
* @slot discount-name:before
|
|
58
|
+
* @slot discount-name:after
|
|
59
|
+
*
|
|
60
|
+
* @slot discount-builder:before
|
|
61
|
+
* @slot discount-builder:after
|
|
62
|
+
*
|
|
63
|
+
* @slot admin-email-template-uri:before
|
|
64
|
+
* @slot admin-email-template-uri:after
|
|
65
|
+
*
|
|
66
|
+
* @slot customer-email-template-uri:before
|
|
67
|
+
* @slot customer-email-template-uri:after
|
|
68
|
+
*
|
|
69
|
+
* @slot gift-recipient-email-template-uri:before
|
|
70
|
+
* @slot gift-recipient-email-template-uri:after
|
|
71
|
+
*
|
|
72
|
+
* @slot taxes:before
|
|
73
|
+
* @slot taxes:after
|
|
74
|
+
*
|
|
75
|
+
* @slot timestamps:before
|
|
76
|
+
* @slot timestamps:after
|
|
77
|
+
*
|
|
78
|
+
* @slot create:before
|
|
79
|
+
* @slot create:after
|
|
80
|
+
*
|
|
81
|
+
* @slot delete:before
|
|
82
|
+
* @slot delete:after
|
|
83
|
+
*
|
|
84
|
+
*
|
|
85
|
+
* @since 1.21.0
|
|
86
|
+
* @element foxy-item-category-form
|
|
87
|
+
*/
|
|
9
88
|
export declare class ItemCategoryForm extends ItemCategoryForm_base<Data> {
|
|
10
89
|
static get properties(): PropertyDeclarations;
|
|
11
90
|
static get v8n(): NucleonV8N<Data>;
|
|
91
|
+
/** URL of the `fx:email_templates` collection for a store. */
|
|
12
92
|
emailTemplates: string | null;
|
|
93
|
+
/** Template render functions mapped to their name. */
|
|
94
|
+
templates: Templates;
|
|
95
|
+
/** URL of the `fx:taxes` collection for a store. */
|
|
13
96
|
taxes: string | null;
|
|
14
97
|
private static __shippingFlatRateTypeOptions;
|
|
15
98
|
private static __defaultWeightUnitOptions;
|
|
@@ -2,17 +2,100 @@ import { TranslatableMixin } from "../../../mixins/translatable.js";
|
|
|
2
2
|
import { InternalForm } from "../../internal/InternalForm/InternalForm.js";
|
|
3
3
|
import { ifDefined } from 'lit-html/directives/if-defined';
|
|
4
4
|
import { html } from 'lit-html';
|
|
5
|
+
/**
|
|
6
|
+
* Form element for item categories (`fx:item_category`).
|
|
7
|
+
*
|
|
8
|
+
* @slot name:before
|
|
9
|
+
* @slot name:after
|
|
10
|
+
*
|
|
11
|
+
* @slot code:before
|
|
12
|
+
* @slot code:after
|
|
13
|
+
*
|
|
14
|
+
* @slot handling-fee-type:before
|
|
15
|
+
* @slot handling-fee-type:after
|
|
16
|
+
*
|
|
17
|
+
* @slot handling-fee:before
|
|
18
|
+
* @slot handling-fee:after
|
|
19
|
+
*
|
|
20
|
+
* @slot handling-fee-percentage:before
|
|
21
|
+
* @slot handling-fee-percentage:after
|
|
22
|
+
*
|
|
23
|
+
* @slot handling-fee-minimum:before
|
|
24
|
+
* @slot handling-fee-minimum:after
|
|
25
|
+
*
|
|
26
|
+
* @slot item-delivery-type:before
|
|
27
|
+
* @slot item-delivery-type:after
|
|
28
|
+
*
|
|
29
|
+
* @slot max-downloads-per-customer:before
|
|
30
|
+
* @slot max-downloads-per-customer:after
|
|
31
|
+
*
|
|
32
|
+
* @slot max-downloads-time-period:before
|
|
33
|
+
* @slot max-downloads-time-period:after
|
|
34
|
+
*
|
|
35
|
+
* @slot shipping-flat-rate:before
|
|
36
|
+
* @slot shipping-flat-rate:after
|
|
37
|
+
*
|
|
38
|
+
* @slot shipping-flat-rate-type:before
|
|
39
|
+
* @slot shipping-flat-rate-type:after
|
|
40
|
+
*
|
|
41
|
+
* @slot default-weight:before
|
|
42
|
+
* @slot default-weight:after
|
|
43
|
+
*
|
|
44
|
+
* @slot default-weight-unit:before
|
|
45
|
+
* @slot default-weight-unit:after
|
|
46
|
+
*
|
|
47
|
+
* @slot default-length-unit:before
|
|
48
|
+
* @slot default-length-unit:after
|
|
49
|
+
*
|
|
50
|
+
* @slot customs-value:before
|
|
51
|
+
* @slot customs-value:after
|
|
52
|
+
*
|
|
53
|
+
* @slot discount-name:before
|
|
54
|
+
* @slot discount-name:after
|
|
55
|
+
*
|
|
56
|
+
* @slot discount-builder:before
|
|
57
|
+
* @slot discount-builder:after
|
|
58
|
+
*
|
|
59
|
+
* @slot admin-email-template-uri:before
|
|
60
|
+
* @slot admin-email-template-uri:after
|
|
61
|
+
*
|
|
62
|
+
* @slot customer-email-template-uri:before
|
|
63
|
+
* @slot customer-email-template-uri:after
|
|
64
|
+
*
|
|
65
|
+
* @slot gift-recipient-email-template-uri:before
|
|
66
|
+
* @slot gift-recipient-email-template-uri:after
|
|
67
|
+
*
|
|
68
|
+
* @slot taxes:before
|
|
69
|
+
* @slot taxes:after
|
|
70
|
+
*
|
|
71
|
+
* @slot timestamps:before
|
|
72
|
+
* @slot timestamps:after
|
|
73
|
+
*
|
|
74
|
+
* @slot create:before
|
|
75
|
+
* @slot create:after
|
|
76
|
+
*
|
|
77
|
+
* @slot delete:before
|
|
78
|
+
* @slot delete:after
|
|
79
|
+
*
|
|
80
|
+
*
|
|
81
|
+
* @since 1.21.0
|
|
82
|
+
* @element foxy-item-category-form
|
|
83
|
+
*/
|
|
5
84
|
export class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-category-form') {
|
|
6
85
|
constructor() {
|
|
7
86
|
super(...arguments);
|
|
87
|
+
/** URL of the `fx:email_templates` collection for a store. */
|
|
8
88
|
this.emailTemplates = null;
|
|
89
|
+
/** Template render functions mapped to their name. */
|
|
90
|
+
this.templates = {};
|
|
91
|
+
/** URL of the `fx:taxes` collection for a store. */
|
|
9
92
|
this.taxes = null;
|
|
10
93
|
}
|
|
11
94
|
static get properties() {
|
|
12
95
|
return {
|
|
13
96
|
...super.properties,
|
|
14
|
-
emailTemplates: {
|
|
15
|
-
taxes: {
|
|
97
|
+
emailTemplates: { attribute: 'email-templates' },
|
|
98
|
+
taxes: {},
|
|
16
99
|
};
|
|
17
100
|
}
|
|
18
101
|
static get v8n() {
|
|
@@ -84,15 +167,11 @@ export class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-cate
|
|
|
84
167
|
var _a, _b, _c, _d;
|
|
85
168
|
const itemDeliveryType = this.form.item_delivery_type;
|
|
86
169
|
const handlingFeeType = (_a = this.form.handling_fee_type) !== null && _a !== void 0 ? _a : 'none';
|
|
87
|
-
const hasDividers = !this.hiddenSelector.matches('dividers', true);
|
|
88
|
-
const divider = html `<div class="border-t border-contrast-10 col-span-2"></div>`;
|
|
89
170
|
return html `
|
|
90
171
|
<div class="grid grid-cols-2 gap-m">
|
|
91
172
|
<foxy-internal-text-control infer="name" class="col-span-2"></foxy-internal-text-control>
|
|
92
173
|
<foxy-internal-text-control infer="code" class="col-span-2"></foxy-internal-text-control>
|
|
93
174
|
|
|
94
|
-
${hasDividers ? divider : ''}
|
|
95
|
-
|
|
96
175
|
<foxy-internal-select-control
|
|
97
176
|
infer="handling-fee-type"
|
|
98
177
|
class="col-span-2"
|
|
@@ -109,7 +188,6 @@ export class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-cate
|
|
|
109
188
|
? this.__renderHandlingFeeMinimum()
|
|
110
189
|
: ''}
|
|
111
190
|
`}
|
|
112
|
-
${hasDividers ? divider : ''}
|
|
113
191
|
|
|
114
192
|
<foxy-internal-select-control
|
|
115
193
|
infer="item-delivery-type"
|
|
@@ -121,20 +199,15 @@ export class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-cate
|
|
|
121
199
|
${itemDeliveryType === 'downloaded'
|
|
122
200
|
? this.__renderDownloadDeliveryControls()
|
|
123
201
|
: itemDeliveryType === 'flat_rate'
|
|
124
|
-
? this.__renderFlatRateControls()
|
|
202
|
+
? [this.__renderFlatRateControls(), this.__renderCustomsValue()]
|
|
125
203
|
: itemDeliveryType === 'shipped'
|
|
126
|
-
? this.__renderShippingControls()
|
|
204
|
+
? [this.__renderShippingControls(), this.__renderCustomsValue()]
|
|
127
205
|
: ''}
|
|
128
|
-
${itemDeliveryType === 'shipped' || itemDeliveryType === 'flat_rate'
|
|
129
|
-
? this.__renderCustomsValue()
|
|
130
|
-
: ''}
|
|
131
|
-
${hasDividers ? divider : ''}
|
|
132
206
|
|
|
133
207
|
<foxy-internal-text-control infer="discount-name" class="col-span-2">
|
|
134
208
|
</foxy-internal-text-control>
|
|
135
209
|
|
|
136
210
|
${this.form.discount_name ? this.__renderDiscountBuilder() : ''}
|
|
137
|
-
${hasDividers ? divider : ''}
|
|
138
211
|
|
|
139
212
|
<foxy-internal-async-combo-box-control
|
|
140
213
|
item-label-path="description"
|
|
@@ -172,7 +245,7 @@ export class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-cate
|
|
|
172
245
|
>
|
|
173
246
|
</foxy-internal-async-combo-box-control>
|
|
174
247
|
|
|
175
|
-
${
|
|
248
|
+
${this.data ? this.__renderTaxes() : ''}
|
|
176
249
|
</div>
|
|
177
250
|
|
|
178
251
|
${super.renderBody()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ItemCategoryForm.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemCategoryForm/ItemCategoryForm.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,YAAY,EAAE,oDAAiD;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB,CAAC,YAAY,EAAE,oBAAoB,CAAO;IAAjG;;QA+GE,mBAAc,GAAkB,IAAI,CAAC;QAErC,UAAK,GAAkB,IAAI,CAAC;IAkP9B,CAAC;IAlWC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE;YAC9D,KAA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AK,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE;IACrC,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE;CACtC,CAAC;AAEa,2CAA0B,GAAG;IAC1C,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE;IACnC,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE;CACpC,CAAC;AAEa,0CAAyB,GAAG;IACzC,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,YAAY,EAAE;IACnD,EAAE,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,YAAY,EAAE;IACnD,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,WAAW,EAAE;IACjD,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,SAAS,EAAE;IAC7C,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,QAAQ,EAAE;CAC5C,CAAC;AAEa,yCAAwB,GAAG;IACxC,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE;IACvC,EAAE,KAAK,EAAE,uBAAuB,EAAE,KAAK,EAAE,gBAAgB,EAAE;IAC3D,EAAE,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,eAAe,EAAE;IACzD,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,cAAc,EAAE;IACvD,EAAE,KAAK,EAAE,kCAAkC,EAAE,KAAK,EAAE,2BAA2B,EAAE;CAClF,CAAC","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { DiscountBuilder } from '../DiscountBuilder/DiscountBuilder';\nimport type { TemplateResult } from 'lit-html';\nimport type { ParsedValue } from '../DiscountBuilder/types';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Data } from './types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\nexport class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-category-form')<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n emailTemplates: { type: String, attribute: 'email-templates' },\n taxes: { type: String },\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ code: v }) => !!v || 'code:v8n_required',\n ({ code: v }) => (v && v.length <= 50) || 'code:v8n_too_long',\n\n ({ name: v }) => !!v || 'name:v8n_required',\n ({ name: v }) => (v && v.length <= 50) || 'name:v8n_too_long',\n\n ({ item_delivery_type: v }) => !!v || 'item-delivery-type:v8n_required',\n\n ({ item_delivery_type: t, max_downloads_per_customer: v }) => {\n return (\n (t === 'downloaded' ? typeof v === 'number' : true) ||\n 'max-downloads-per-customer:v8n_required'\n );\n },\n\n ({ max_downloads_per_customer: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'max-downloads-per-customer:v8n_negative';\n },\n\n ({ item_delivery_type: t, max_downloads_time_period: v }) => {\n return (\n (t === 'downloaded' ? typeof v === 'number' : true) ||\n 'max-downloads-time-period:v8n_required'\n );\n },\n\n ({ max_downloads_time_period: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'max-downloads-time-period:v8n_negative';\n },\n\n ({ customs_value: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'customs-value:v8n_negative';\n },\n\n ({ item_delivery_type: t, default_weight: v }) => {\n return (t === 'shipped' ? typeof v === 'number' : true) || 'default-weight:v8n_required';\n },\n\n ({ default_weight: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'default-weight:v8n_negative';\n },\n\n ({ item_delivery_type: t, default_weight_unit: v }) => {\n return (\n (t === 'shipped' ? typeof v === 'string' : true) || 'default-weight-unit:v8n_required'\n );\n },\n\n ({ item_delivery_type: t, default_length_unit: v }) => {\n return (\n (t === 'shipped' ? typeof v === 'string' : true) || 'default-length-unit:v8n_required'\n );\n },\n\n ({ item_delivery_type: t, shipping_flat_rate: v }) => {\n return (\n (t === 'flat_rate' ? typeof v === 'number' : true) || 'shipping-flat-rate:v8n_required'\n );\n },\n\n ({ shipping_flat_rate: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'shipping-flat-rate:v8n_negative';\n },\n\n ({ item_delivery_type: t, shipping_flat_rate_type: v }) => {\n return (\n (t === 'flat_rate' ? typeof v === 'string' : true) ||\n 'shipping-flat-rate-type:v8n_required'\n );\n },\n\n ({ handling_fee_type: v }) => !!v || 'handling-fee-type:v8n_required',\n\n ({ handling_fee_type: t, handling_fee_minimum: v }) => {\n return (\n (t === 'flat_percent_with_minimum' ? typeof v === 'number' : true) ||\n 'handling-fee-minimum:v8n_required'\n );\n },\n\n ({ handling_fee_minimum: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'handling-fee-minimum:v8n_negative';\n },\n\n ({ handling_fee_type: t, handling_fee_percentage: v }) => {\n return (\n (t === 'flat_percent_with_minimum' || t === 'flat_percent'\n ? typeof v === 'number'\n : true) || 'handling-fee-percentage:v8n_required'\n );\n },\n\n ({ handling_fee_percentage: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'handling-fee-percentage:v8n_negative';\n },\n\n ({ send_admin_email: s, admin_email: v }) => (s ? !!v : true) || 'admin-email:v8n_required',\n ];\n }\n\n emailTemplates: string | null = null;\n\n taxes: string | null = null;\n\n private static __shippingFlatRateTypeOptions = [\n { label: 'option_per_order', value: 'per_order' },\n { label: 'option_per_shipment', value: 'per_shipment' },\n ];\n\n private static __defaultWeightUnitOptions = [\n { label: 'option_lbs', value: 'LBS' },\n { label: 'option_kgs', value: 'KGS' },\n ];\n\n private static __defaultLengthUnitOptions = [\n { label: 'option_in', value: 'IN' },\n { label: 'option_cm', value: 'CM' },\n ];\n\n private static __itemDeliveryTypeOptions = [\n { label: 'option_notshipped', value: 'notshipped' },\n { label: 'option_downloaded', value: 'downloaded' },\n { label: 'option_flat_rate', value: 'flat_rate' },\n { label: 'option_shipped', value: 'shipped' },\n { label: 'option_pickup', value: 'pickup' },\n ];\n\n private static __handlingFeeTypeOptions = [\n { label: 'option_none', value: 'none' },\n { label: 'option_flat_per_order', value: 'flat_per_order' },\n { label: 'option_flat_per_item', value: 'flat_per_item' },\n { label: 'option_flat_percent', value: 'flat_percent' },\n { label: 'option_flat_percent_with_minimum', value: 'flat_percent_with_minimum' },\n ];\n\n renderBody(): TemplateResult {\n const itemDeliveryType = this.form.item_delivery_type;\n const handlingFeeType = this.form.handling_fee_type ?? 'none';\n const hasDividers = !this.hiddenSelector.matches('dividers', true);\n const divider = html`<div class=\"border-t border-contrast-10 col-span-2\"></div>`;\n\n return html`\n <div class=\"grid grid-cols-2 gap-m\">\n <foxy-internal-text-control infer=\"name\" class=\"col-span-2\"></foxy-internal-text-control>\n <foxy-internal-text-control infer=\"code\" class=\"col-span-2\"></foxy-internal-text-control>\n\n ${hasDividers ? divider : ''}\n\n <foxy-internal-select-control\n infer=\"handling-fee-type\"\n class=\"col-span-2\"\n .options=${ItemCategoryForm.__handlingFeeTypeOptions}\n >\n </foxy-internal-select-control>\n\n ${handlingFeeType === 'none'\n ? ''\n : html`\n ${this.__renderHandlingFee()}\n ${handlingFeeType.includes('percent') ? this.__renderHandlingFeePercentage() : ''}\n ${handlingFeeType === 'flat_percent_with_minimum'\n ? this.__renderHandlingFeeMinimum()\n : ''}\n `}\n ${hasDividers ? divider : ''}\n\n <foxy-internal-select-control\n infer=\"item-delivery-type\"\n class=\"col-span-2\"\n .options=${ItemCategoryForm.__itemDeliveryTypeOptions}\n >\n </foxy-internal-select-control>\n\n ${itemDeliveryType === 'downloaded'\n ? this.__renderDownloadDeliveryControls()\n : itemDeliveryType === 'flat_rate'\n ? this.__renderFlatRateControls()\n : itemDeliveryType === 'shipped'\n ? this.__renderShippingControls()\n : ''}\n ${itemDeliveryType === 'shipped' || itemDeliveryType === 'flat_rate'\n ? this.__renderCustomsValue()\n : ''}\n ${hasDividers ? divider : ''}\n\n <foxy-internal-text-control infer=\"discount-name\" class=\"col-span-2\">\n </foxy-internal-text-control>\n\n ${this.form.discount_name ? this.__renderDiscountBuilder() : ''}\n ${hasDividers ? divider : ''}\n\n <foxy-internal-async-combo-box-control\n item-label-path=\"description\"\n item-value-path=\"_links.self.href\"\n first=${ifDefined(this.emailTemplates ?? undefined)}\n infer=\"admin-email-template-uri\"\n class=${this.form.send_admin_email ? '' : 'col-span-2'}\n @change=${(evt: CustomEvent) => {\n this.edit({\n send_admin_email: !!evt.detail,\n admin_email: evt.detail ? this.form.admin_email : '',\n });\n }}\n >\n </foxy-internal-async-combo-box-control>\n\n ${this.form.send_admin_email ? this.__renderAdminEmail() : ''}\n\n <foxy-internal-async-combo-box-control\n item-label-path=\"description\"\n item-value-path=\"_links.self.href\"\n first=${ifDefined(this.emailTemplates ?? undefined)}\n infer=\"customer-email-template-uri\"\n class=\"col-span-2\"\n @change=${(evt: CustomEvent) => this.edit({ send_customer_email: !!evt.detail })}\n >\n </foxy-internal-async-combo-box-control>\n\n <foxy-internal-async-combo-box-control\n item-label-path=\"description\"\n item-value-path=\"_links.self.href\"\n first=${ifDefined(this.emailTemplates ?? undefined)}\n infer=\"gift-recipient-email-template-uri\"\n class=\"col-span-2\"\n >\n </foxy-internal-async-combo-box-control>\n\n ${hasDividers ? divider : ''} ${this.data ? this.__renderTaxes() : ''}\n </div>\n\n ${super.renderBody()}\n `;\n }\n\n private __renderHandlingFee() {\n return html`\n <foxy-internal-number-control\n infer=\"handling-fee\"\n class=${this.form.handling_fee_type === 'flat_percent' ? '' : 'col-span-2'}\n >\n </foxy-internal-number-control>\n `;\n }\n\n private __renderHandlingFeePercentage() {\n return html`\n <foxy-internal-number-control infer=\"handling-fee-percentage\"> </foxy-internal-number-control>\n `;\n }\n\n private __renderHandlingFeeMinimum() {\n return html`\n <foxy-internal-number-control infer=\"handling-fee-minimum\"> </foxy-internal-number-control>\n `;\n }\n\n private __renderDownloadDeliveryControls() {\n return html`\n <foxy-internal-integer-control infer=\"max-downloads-per-customer\">\n </foxy-internal-integer-control>\n\n <foxy-internal-integer-control infer=\"max-downloads-time-period\">\n </foxy-internal-integer-control>\n `;\n }\n\n private __renderFlatRateControls() {\n return html`\n <foxy-internal-number-control infer=\"shipping-flat-rate\"> </foxy-internal-number-control>\n\n <foxy-internal-select-control\n infer=\"shipping-flat-rate-type\"\n .options=${ItemCategoryForm.__shippingFlatRateTypeOptions}\n >\n </foxy-internal-select-control>\n `;\n }\n\n private __renderShippingControls() {\n return html`\n <foxy-internal-integer-control infer=\"default-weight\" class=\"col-span-2\">\n </foxy-internal-integer-control>\n\n <foxy-internal-select-control\n infer=\"default-weight-unit\"\n .options=${ItemCategoryForm.__defaultWeightUnitOptions}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-select-control\n infer=\"default-length-unit\"\n .options=${ItemCategoryForm.__defaultLengthUnitOptions}\n >\n </foxy-internal-select-control>\n `;\n }\n\n private __renderCustomsValue() {\n return html`\n <foxy-internal-number-control infer=\"customs-value\" class=\"col-span-2\">\n </foxy-internal-number-control>\n `;\n }\n\n private __renderDiscountBuilder() {\n const parsedValue: ParsedValue = {\n name: this.form.discount_name ?? '',\n type: this.form.discount_type || 'quantity_amount',\n details: this.form.discount_details ?? '',\n };\n\n return html`\n <foxy-discount-builder\n infer=\"discount-builder\"\n class=\"col-span-2\"\n .parsedValue=${parsedValue}\n @change=${(evt: CustomEvent) => {\n const builder = evt.currentTarget as DiscountBuilder;\n\n this.edit({\n discount_name: builder.parsedValue.name,\n discount_type: builder.parsedValue.type,\n discount_details: builder.parsedValue.details,\n });\n }}\n >\n </foxy-discount-builder>\n `;\n }\n\n private __renderAdminEmail() {\n return html`<foxy-internal-text-control infer=\"admin-email\"> </foxy-internal-text-control>`;\n }\n\n private __renderTaxes() {\n return html`\n <foxy-internal-item-category-form-taxes-control\n taxes=${ifDefined(this.taxes ?? undefined)}\n class=\"col-span-2\"\n infer=\"taxes\"\n >\n </foxy-internal-item-category-form-taxes-control>\n `;\n }\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ent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { DiscountBuilder } from '../DiscountBuilder/DiscountBuilder';\nimport type { Templates, Data } from './types';\nimport type { TemplateResult } from 'lit-html';\nimport type { ParsedValue } from '../DiscountBuilder/types';\nimport type { NucleonV8N } from '../NucleonElement/types';\n\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { InternalForm } from '../../internal/InternalForm/InternalForm';\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { html } from 'lit-html';\n\n/**\n * Form element for item categories (`fx:item_category`).\n *\n * @slot name:before\n * @slot name:after\n *\n * @slot code:before\n * @slot code:after\n *\n * @slot handling-fee-type:before\n * @slot handling-fee-type:after\n *\n * @slot handling-fee:before\n * @slot handling-fee:after\n *\n * @slot handling-fee-percentage:before\n * @slot handling-fee-percentage:after\n *\n * @slot handling-fee-minimum:before\n * @slot handling-fee-minimum:after\n *\n * @slot item-delivery-type:before\n * @slot item-delivery-type:after\n *\n * @slot max-downloads-per-customer:before\n * @slot max-downloads-per-customer:after\n *\n * @slot max-downloads-time-period:before\n * @slot max-downloads-time-period:after\n *\n * @slot shipping-flat-rate:before\n * @slot shipping-flat-rate:after\n *\n * @slot shipping-flat-rate-type:before\n * @slot shipping-flat-rate-type:after\n *\n * @slot default-weight:before\n * @slot default-weight:after\n *\n * @slot default-weight-unit:before\n * @slot default-weight-unit:after\n *\n * @slot default-length-unit:before\n * @slot default-length-unit:after\n *\n * @slot customs-value:before\n * @slot customs-value:after\n *\n * @slot discount-name:before\n * @slot discount-name:after\n *\n * @slot discount-builder:before\n * @slot discount-builder:after\n *\n * @slot admin-email-template-uri:before\n * @slot admin-email-template-uri:after\n *\n * @slot customer-email-template-uri:before\n * @slot customer-email-template-uri:after\n *\n * @slot gift-recipient-email-template-uri:before\n * @slot gift-recipient-email-template-uri:after\n *\n * @slot taxes:before\n * @slot taxes:after\n *\n * @slot timestamps:before\n * @slot timestamps:after\n *\n * @slot create:before\n * @slot create:after\n *\n * @slot delete:before\n * @slot delete:after\n *\n *\n * @since 1.21.0\n * @element foxy-item-category-form\n */\nexport class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-category-form')<Data> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n emailTemplates: { attribute: 'email-templates' },\n taxes: {},\n };\n }\n\n static get v8n(): NucleonV8N<Data> {\n return [\n ({ code: v }) => !!v || 'code:v8n_required',\n ({ code: v }) => (v && v.length <= 50) || 'code:v8n_too_long',\n\n ({ name: v }) => !!v || 'name:v8n_required',\n ({ name: v }) => (v && v.length <= 50) || 'name:v8n_too_long',\n\n ({ item_delivery_type: v }) => !!v || 'item-delivery-type:v8n_required',\n\n ({ item_delivery_type: t, max_downloads_per_customer: v }) => {\n return (\n (t === 'downloaded' ? typeof v === 'number' : true) ||\n 'max-downloads-per-customer:v8n_required'\n );\n },\n\n ({ max_downloads_per_customer: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'max-downloads-per-customer:v8n_negative';\n },\n\n ({ item_delivery_type: t, max_downloads_time_period: v }) => {\n return (\n (t === 'downloaded' ? typeof v === 'number' : true) ||\n 'max-downloads-time-period:v8n_required'\n );\n },\n\n ({ max_downloads_time_period: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'max-downloads-time-period:v8n_negative';\n },\n\n ({ customs_value: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'customs-value:v8n_negative';\n },\n\n ({ item_delivery_type: t, default_weight: v }) => {\n return (t === 'shipped' ? typeof v === 'number' : true) || 'default-weight:v8n_required';\n },\n\n ({ default_weight: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'default-weight:v8n_negative';\n },\n\n ({ item_delivery_type: t, default_weight_unit: v }) => {\n return (\n (t === 'shipped' ? typeof v === 'string' : true) || 'default-weight-unit:v8n_required'\n );\n },\n\n ({ item_delivery_type: t, default_length_unit: v }) => {\n return (\n (t === 'shipped' ? typeof v === 'string' : true) || 'default-length-unit:v8n_required'\n );\n },\n\n ({ item_delivery_type: t, shipping_flat_rate: v }) => {\n return (\n (t === 'flat_rate' ? typeof v === 'number' : true) || 'shipping-flat-rate:v8n_required'\n );\n },\n\n ({ shipping_flat_rate: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'shipping-flat-rate:v8n_negative';\n },\n\n ({ item_delivery_type: t, shipping_flat_rate_type: v }) => {\n return (\n (t === 'flat_rate' ? typeof v === 'string' : true) ||\n 'shipping-flat-rate-type:v8n_required'\n );\n },\n\n ({ handling_fee_type: v }) => !!v || 'handling-fee-type:v8n_required',\n\n ({ handling_fee_type: t, handling_fee_minimum: v }) => {\n return (\n (t === 'flat_percent_with_minimum' ? typeof v === 'number' : true) ||\n 'handling-fee-minimum:v8n_required'\n );\n },\n\n ({ handling_fee_minimum: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'handling-fee-minimum:v8n_negative';\n },\n\n ({ handling_fee_type: t, handling_fee_percentage: v }) => {\n return (\n (t === 'flat_percent_with_minimum' || t === 'flat_percent'\n ? typeof v === 'number'\n : true) || 'handling-fee-percentage:v8n_required'\n );\n },\n\n ({ handling_fee_percentage: v }) => {\n return (typeof v === 'number' ? v >= 0 : true) || 'handling-fee-percentage:v8n_negative';\n },\n\n ({ send_admin_email: s, admin_email: v }) => (s ? !!v : true) || 'admin-email:v8n_required',\n ];\n }\n\n /** URL of the `fx:email_templates` collection for a store. */\n emailTemplates: string | null = null;\n\n /** Template render functions mapped to their name. */\n templates: Templates = {};\n\n /** URL of the `fx:taxes` collection for a store. */\n taxes: string | null = null;\n\n private static __shippingFlatRateTypeOptions = [\n { label: 'option_per_order', value: 'per_order' },\n { label: 'option_per_shipment', value: 'per_shipment' },\n ];\n\n private static __defaultWeightUnitOptions = [\n { label: 'option_lbs', value: 'LBS' },\n { label: 'option_kgs', value: 'KGS' },\n ];\n\n private static __defaultLengthUnitOptions = [\n { label: 'option_in', value: 'IN' },\n { label: 'option_cm', value: 'CM' },\n ];\n\n private static __itemDeliveryTypeOptions = [\n { label: 'option_notshipped', value: 'notshipped' },\n { label: 'option_downloaded', value: 'downloaded' },\n { label: 'option_flat_rate', value: 'flat_rate' },\n { label: 'option_shipped', value: 'shipped' },\n { label: 'option_pickup', value: 'pickup' },\n ];\n\n private static __handlingFeeTypeOptions = [\n { label: 'option_none', value: 'none' },\n { label: 'option_flat_per_order', value: 'flat_per_order' },\n { label: 'option_flat_per_item', value: 'flat_per_item' },\n { label: 'option_flat_percent', value: 'flat_percent' },\n { label: 'option_flat_percent_with_minimum', value: 'flat_percent_with_minimum' },\n ];\n\n renderBody(): TemplateResult {\n const itemDeliveryType = this.form.item_delivery_type;\n const handlingFeeType = this.form.handling_fee_type ?? 'none';\n\n return html`\n <div class=\"grid grid-cols-2 gap-m\">\n <foxy-internal-text-control infer=\"name\" class=\"col-span-2\"></foxy-internal-text-control>\n <foxy-internal-text-control infer=\"code\" class=\"col-span-2\"></foxy-internal-text-control>\n\n <foxy-internal-select-control\n infer=\"handling-fee-type\"\n class=\"col-span-2\"\n .options=${ItemCategoryForm.__handlingFeeTypeOptions}\n >\n </foxy-internal-select-control>\n\n ${handlingFeeType === 'none'\n ? ''\n : html`\n ${this.__renderHandlingFee()}\n ${handlingFeeType.includes('percent') ? this.__renderHandlingFeePercentage() : ''}\n ${handlingFeeType === 'flat_percent_with_minimum'\n ? this.__renderHandlingFeeMinimum()\n : ''}\n `}\n\n <foxy-internal-select-control\n infer=\"item-delivery-type\"\n class=\"col-span-2\"\n .options=${ItemCategoryForm.__itemDeliveryTypeOptions}\n >\n </foxy-internal-select-control>\n\n ${itemDeliveryType === 'downloaded'\n ? this.__renderDownloadDeliveryControls()\n : itemDeliveryType === 'flat_rate'\n ? [this.__renderFlatRateControls(), this.__renderCustomsValue()]\n : itemDeliveryType === 'shipped'\n ? [this.__renderShippingControls(), this.__renderCustomsValue()]\n : ''}\n\n <foxy-internal-text-control infer=\"discount-name\" class=\"col-span-2\">\n </foxy-internal-text-control>\n\n ${this.form.discount_name ? this.__renderDiscountBuilder() : ''}\n\n <foxy-internal-async-combo-box-control\n item-label-path=\"description\"\n item-value-path=\"_links.self.href\"\n first=${ifDefined(this.emailTemplates ?? undefined)}\n infer=\"admin-email-template-uri\"\n class=${this.form.send_admin_email ? '' : 'col-span-2'}\n @change=${(evt: CustomEvent) => {\n this.edit({\n send_admin_email: !!evt.detail,\n admin_email: evt.detail ? this.form.admin_email : '',\n });\n }}\n >\n </foxy-internal-async-combo-box-control>\n\n ${this.form.send_admin_email ? this.__renderAdminEmail() : ''}\n\n <foxy-internal-async-combo-box-control\n item-label-path=\"description\"\n item-value-path=\"_links.self.href\"\n first=${ifDefined(this.emailTemplates ?? undefined)}\n infer=\"customer-email-template-uri\"\n class=\"col-span-2\"\n @change=${(evt: CustomEvent) => this.edit({ send_customer_email: !!evt.detail })}\n >\n </foxy-internal-async-combo-box-control>\n\n <foxy-internal-async-combo-box-control\n item-label-path=\"description\"\n item-value-path=\"_links.self.href\"\n first=${ifDefined(this.emailTemplates ?? undefined)}\n infer=\"gift-recipient-email-template-uri\"\n class=\"col-span-2\"\n >\n </foxy-internal-async-combo-box-control>\n\n ${this.data ? this.__renderTaxes() : ''}\n </div>\n\n ${super.renderBody()}\n `;\n }\n\n private __renderHandlingFee() {\n return html`\n <foxy-internal-number-control\n infer=\"handling-fee\"\n class=${this.form.handling_fee_type === 'flat_percent' ? '' : 'col-span-2'}\n >\n </foxy-internal-number-control>\n `;\n }\n\n private __renderHandlingFeePercentage() {\n return html`\n <foxy-internal-number-control infer=\"handling-fee-percentage\"> </foxy-internal-number-control>\n `;\n }\n\n private __renderHandlingFeeMinimum() {\n return html`\n <foxy-internal-number-control infer=\"handling-fee-minimum\"> </foxy-internal-number-control>\n `;\n }\n\n private __renderDownloadDeliveryControls() {\n return html`\n <foxy-internal-integer-control infer=\"max-downloads-per-customer\">\n </foxy-internal-integer-control>\n\n <foxy-internal-integer-control infer=\"max-downloads-time-period\">\n </foxy-internal-integer-control>\n `;\n }\n\n private __renderFlatRateControls() {\n return html`\n <foxy-internal-number-control infer=\"shipping-flat-rate\"> </foxy-internal-number-control>\n\n <foxy-internal-select-control\n infer=\"shipping-flat-rate-type\"\n .options=${ItemCategoryForm.__shippingFlatRateTypeOptions}\n >\n </foxy-internal-select-control>\n `;\n }\n\n private __renderShippingControls() {\n return html`\n <foxy-internal-integer-control infer=\"default-weight\" class=\"col-span-2\">\n </foxy-internal-integer-control>\n\n <foxy-internal-select-control\n infer=\"default-weight-unit\"\n .options=${ItemCategoryForm.__defaultWeightUnitOptions}\n >\n </foxy-internal-select-control>\n\n <foxy-internal-select-control\n infer=\"default-length-unit\"\n .options=${ItemCategoryForm.__defaultLengthUnitOptions}\n >\n </foxy-internal-select-control>\n `;\n }\n\n private __renderCustomsValue() {\n return html`\n <foxy-internal-number-control infer=\"customs-value\" class=\"col-span-2\">\n </foxy-internal-number-control>\n `;\n }\n\n private __renderDiscountBuilder() {\n const parsedValue: ParsedValue = {\n name: this.form.discount_name ?? '',\n type: this.form.discount_type || 'quantity_amount',\n details: this.form.discount_details ?? '',\n };\n\n return html`\n <foxy-discount-builder\n infer=\"discount-builder\"\n class=\"col-span-2\"\n .parsedValue=${parsedValue}\n @change=${(evt: CustomEvent) => {\n const builder = evt.currentTarget as DiscountBuilder;\n\n this.edit({\n discount_name: builder.parsedValue.name,\n discount_type: builder.parsedValue.type,\n discount_details: builder.parsedValue.details,\n });\n }}\n >\n </foxy-discount-builder>\n `;\n }\n\n private __renderAdminEmail() {\n return html`<foxy-internal-text-control infer=\"admin-email\"> </foxy-internal-text-control>`;\n }\n\n private __renderTaxes() {\n return html`\n <foxy-internal-item-category-form-taxes-control\n taxes=${ifDefined(this.taxes ?? undefined)}\n class=\"col-span-2\"\n infer=\"taxes\"\n >\n </foxy-internal-item-category-form-taxes-control>\n `;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalItemCategoryFormTaxesControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/ItemCategoryForm/internal/InternalItemCategoryFormTaxesControl/InternalItemCategoryFormTaxesControl.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,gEAA6D;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,OAAO,oCAAqC,SAAQ,eAAe;IAAzE;;QAQE,UAAK,GAAkB,IAAI,CAAC;IAuC9B,CAAC;IA9CC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,KAAK,EAAE,EAAE
|
|
1
|
+
{"version":3,"file":"InternalItemCategoryFormTaxesControl.js","sourceRoot":"","sources":["../../../../../../src/elements/public/ItemCategoryForm/internal/InternalItemCategoryFormTaxesControl/InternalItemCategoryFormTaxesControl.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,gEAA6D;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,OAAO,oCAAqC,SAAQ,eAAe;IAAzE;;QAQE,UAAK,GAAkB,IAAI,CAAC;IAuC9B,CAAC;IA9CC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,KAAK,EAAE,EAAE;SACV,CAAC;IACJ,CAAC;IAID,aAAa;;QACX,MAAM,OAAO,GAAG,IAAI,CAAC,OAAsC,CAAC;QAC5D,IAAI,KAAa,CAAC;QAElB,IAAI;YACF,MAAM,GAAG,GAAG,IAAI,GAAG,OAAC,IAAI,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC;YACtC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;YACnC,KAAK,GAAG,GAAG,CAAC,QAAQ,EAAE,CAAC;SACxB;QAAC,WAAM;YACN,KAAK,SAAG,IAAI,CAAC,KAAK,mCAAI,EAAE,CAAC;SAC1B;QAED,OAAO,IAAI,CAAA;;;;;;;;+BAQgB,KAAK;;;;;mBAKjB;YACP,qBAAqB,cAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,CAAC,MAAM,0CAAG,wBAAwB,EAAE,IAAI,mCAAI,EAAE;YAClF,eAAe,EAAE,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI;SAC/B;;;;;;;KAON,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { TemplateResult } from 'lit-html';\nimport type { NucleonElement } from '../../../NucleonElement/NucleonElement';\nimport type { Data } from '../../types';\n\nimport { InternalControl } from '../../../../internal/InternalControl/InternalControl';\nimport { html } from 'lit-html';\n\nexport class InternalItemCategoryFormTaxesControl extends InternalControl {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n taxes: {},\n };\n }\n\n taxes: string | null = null;\n\n renderControl(): TemplateResult {\n const nucleon = this.nucleon as NucleonElement<Data> | null;\n let taxes: string;\n\n try {\n const url = new URL(this.taxes ?? '');\n url.searchParams.set('limit', '5');\n taxes = url.toString();\n } catch {\n taxes = this.taxes ?? '';\n }\n\n return html`\n <foxy-i18n\n class=\"block text-s font-medium text-secondary leading-none mb-s\"\n infer=\"\"\n key=\"title\"\n >\n </foxy-i18n>\n\n <foxy-pagination first=${taxes} infer=\"pagination\">\n <foxy-collection-page\n class=\"block mb-s divide-y divide-contrast-10 border border-contrast-10 rounded-t-l rounded-b-l\"\n infer=\"\"\n item=\"foxy-internal-item-category-form-taxes-control-item\"\n .props=${{\n 'tax-item-categories': nucleon?.form._links?.['fx:tax_item_categories'].href ?? '',\n 'item-category': nucleon?.href,\n }}\n >\n </foxy-collection-page>\n </foxy-pagination>\n\n <foxy-i18n class=\"block text-xs text-secondary leading-xs mt-xs\" infer=\"\" key=\"helper_text\">\n </foxy-i18n>\n `;\n }\n}\n"]}
|
|
@@ -12,8 +12,8 @@ export class InternalItemCategoryFormTaxesControlItem extends TaxCard {
|
|
|
12
12
|
static get properties() {
|
|
13
13
|
return {
|
|
14
14
|
...super.properties,
|
|
15
|
-
taxItemCategories: {
|
|
16
|
-
itemCategory: {
|
|
15
|
+
taxItemCategories: { attribute: 'tax-item-categories' },
|
|
16
|
+
itemCategory: { attribute: 'item-category' },
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
render() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InternalItemCategoryFormTaxesControlItem.js","sourceRoot":"","sources":["../../../../../../src/elements/public/ItemCategoryForm/internal/InternalItemCategoryFormTaxesControlItem/InternalItemCategoryFormTaxesControlItem.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,oCAAiC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAKhC,MAAM,OAAO,wCAAyC,SAAQ,OAAO;IAArE;;QASE,sBAAiB,GAAkB,IAAI,CAAC;QAExC,iBAAY,GAAkB,IAAI,CAAC;QAE3B,4BAAuB,GAAG,KAAK,CAAC;QAEhC,uBAAkB,GAA6B,IAAI,CAAC;IAqE9D,CAAC;IAnFC,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,iBAAiB,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"InternalItemCategoryFormTaxesControlItem.js","sourceRoot":"","sources":["../../../../../../src/elements/public/ItemCategoryForm/internal/InternalItemCategoryFormTaxesControlItem/InternalItemCategoryFormTaxesControlItem.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,oCAAiC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAKhC,MAAM,OAAO,wCAAyC,SAAQ,OAAO;IAArE;;QASE,sBAAiB,GAAkB,IAAI,CAAC;QAExC,iBAAY,GAAkB,IAAI,CAAC;QAE3B,4BAAuB,GAAG,KAAK,CA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AS,OAAC,IAAI,CAAC,iBAAiB,mCAAI,SAAS,CAAC;iBAChD,SAAS,CAAC,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;;oBAEzC,CAAC,GAAgB,EAAE,EAAE;YAC7B,MAAM,OAAO,GAAG,GAAG,CAAC,aAAkD,CAAC;YACvE,IAAI,CAAC,uBAAuB,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;YACnD,IAAI,CAAC,aAAa,EAAE,CAAC;QACvB,CAAC;;;;;;;oBAOS,CAAC,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,uBAAuB,IAAI,IAAI,CAAC,QAAQ;mBAC1E,CAAC,CAAC,eAAe;kBAClB,CAAC,GAAgB,EAAE,EAAE;YAG7B,MAAM,QAAQ,GAAG,GAAG,CAAC,aAAgC,CAAC;YACtD,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAoB,CAAC;YAE/E,IAAI,QAAQ,CAAC,OAAO,EAAE;gBACpB,QAAQ,CAAC,IAAI,CAAC;oBACZ,OAAO,EAAE,IAAI,CAAC,IAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI;oBACpC,iBAAiB,EAAE,IAAI,CAAC,YAAa;iBACtC,CAAC,CAAC;gBAEH,QAAQ,CAAC,MAAM,EAAE,CAAC;aACnB;iBAAM;gBACL,QAAQ,CAAC,MAAM,EAAE,CAAC;aACnB;QACH,CAAC;;UAEC,KAAK,CAAC,MAAM,EAAE;;KAEnB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import type { PropertyDeclarations } from 'lit-element';\nimport type { CheckboxElement } from '@vaadin/vaadin-checkbox';\nimport type { NucleonElement } from '../../../NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\n\nimport { ifDefined } from 'lit-html/directives/if-defined';\nimport { TaxCard } from '../../../TaxCard/TaxCard';\nimport { html } from 'lit-html';\n\ntype TaxItemCategories = Resource<Rels.TaxItemCategories>;\ntype TaxItemCategory = Resource<Rels.TaxItemCategory>;\n\nexport class InternalItemCategoryFormTaxesControlItem extends TaxCard {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n taxItemCategories: { attribute: 'tax-item-categories' },\n itemCategory: { attribute: 'item-category' },\n };\n }\n\n taxItemCategories: string | null = null;\n\n itemCategory: string | null = null;\n\n private __resourceElementIsBusy = false;\n\n private __queryElementData: TaxItemCategories | null = null;\n\n render(): TemplateResult {\n const taxItemCategory = this.__queryElementData?._embedded?.['fx:tax_item_categories']?.[0];\n let taxItemCategories: string | undefined;\n\n try {\n const url = new URL(this.taxItemCategories ?? '');\n const hrefAsUrl = new URL(this.href);\n const id = hrefAsUrl.pathname.split('/').pop();\n\n if (!id) throw new Error();\n\n url.searchParams.set('tax_id', id);\n url.searchParams.set('limit', '1');\n taxItemCategories = url.toString();\n } catch {\n taxItemCategories = undefined;\n }\n\n return html`\n <foxy-nucleon\n href=${ifDefined(taxItemCategories)}\n id=\"query\"\n @update=${(evt: CustomEvent) => {\n const nucleon = evt.currentTarget as NucleonElement<TaxItemCategories>;\n this.__queryElementData = nucleon.data;\n this.requestUpdate();\n }}\n >\n <foxy-nucleon\n parent=${ifDefined(this.taxItemCategories ?? undefined)}\n href=${ifDefined(taxItemCategory?._links.self.href)}\n id=\"resource\"\n @update=${(evt: CustomEvent) => {\n const nucleon = evt.currentTarget as NucleonElement<TaxItemCategories>;\n this.__resourceElementIsBusy = !nucleon.in('idle');\n this.requestUpdate();\n }}\n >\n </foxy-nucleon>\n </foxy-nucleon>\n\n <vaadin-checkbox\n class=\"px-m py-s block overflow-hidden\"\n ?disabled=${!this.__queryElementData || this.__resourceElementIsBusy || this.disabled}\n ?checked=${!!taxItemCategory}\n @change=${(evt: CustomEvent) => {\n type ResourceElement = NucleonElement<TaxItemCategory>;\n\n const checkbox = evt.currentTarget as CheckboxElement;\n const resource = this.renderRoot.querySelector('#resource') as ResourceElement;\n\n if (checkbox.checked) {\n resource.edit({\n tax_uri: this.data!._links.self.href,\n item_category_uri: this.itemCategory!,\n });\n\n resource.submit();\n } else {\n resource.delete();\n }\n }}\n >\n ${super.render()}\n </vaadin-checkbox>\n `;\n }\n}\n"]}
|