@foxy.io/elements 1.24.0-beta.2 → 1.24.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/foxy-item-category-form.js +1 -1
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/translations/item-category-form/en.json +3 -3
- package/dist/cdn/translations/transaction-card/en.json +6 -6
- package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.d.ts +6 -0
- package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.js +45 -3
- package/dist/elements/public/ItemCategoryForm/ItemCategoryForm.js.map +1 -1
- package/dist/elements/public/ItemCategoryForm/index.d.ts +1 -0
- package/dist/elements/public/ItemCategoryForm/index.js +1 -0
- package/dist/elements/public/ItemCategoryForm/index.js.map +1 -1
- package/dist/elements/public/TransactionCard/TransactionCard.js +13 -19
- package/dist/elements/public/TransactionCard/TransactionCard.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-65318cc1.js";import"./shared-51d28e6d.js";import"./shared-8474bc4a.js";import"./shared-c4240bc6.js";import"./shared-a3c73e91.js";import{I as e}from"./shared-25f64060.js";import"./foxy-discount-builder.js";import{I as t}from"./shared-0a248c0d.js";import"./foxy-collection-page.js";import"./foxy-pagination.js";import"./shared-b3ac59eb.js";import"./foxy-nucleon-element.js";import{TaxCard as n}from"./foxy-tax-card.js";import{_ as r}from"./shared-307262a1.js";import{i}from"./shared-d3bf9ac0.js";import{h as o}from"./shared-7f33a83a.js";import{a}from"./shared-09d4fbb8.js";import"./shared-88e36564.js";import"./shared-17d0db7f.js";import"./shared-59042137.js";import"./shared-31651a9c.js";import"./shared-d14c2060.js";import"./shared-4674063d.js";import"./shared-e6828dbf.js";import"./shared-dfe2602a.js";import"./shared-1d08a5ad.js";import"./shared-64657919.js";import"./shared-fef9ecc1.js";import"./shared-432c5183.js";import"./shared-77a4d8e8.js";import"./shared-4b67d699.js";import"./shared-e6997950.js";import"./shared-6dc64a17.js";import"./shared-36725fe3.js";import"./shared-c7f2f1ab.js";import"./shared-4e709717.js";import"./foxy-spinner.js";import"./shared-c6c6ba69.js";import"./shared-c2d3b32b.js";import"./shared-d6276c83.js";import"./shared-332f2997.js";import"./shared-d519a301.js";import"./shared-e6f3e9f0.js";import"./shared-0479553e.js";import"./shared-11c2efc8.js";import"./shared-bf62a65b.js";import"./shared-a92ae606.js";let l,s=e=>e;customElements.define("foxy-internal-item-category-form-taxes-control-item",class extends n{constructor(){super(...arguments),this.taxItemCategories=null,this.itemCategory=null,this.__resourceElementIsBusy=!1,this.__queryElementData=null}static get properties(){return r(r({},super.properties),{},{taxItemCategories:{attribute:"tax-item-categories"},itemCategory:{attribute:"item-category"}})}render(){var e,t,n,r,a;const d=null===(n=null===(t=null===(e=this.__queryElementData)||void 0===e?void 0:e._embedded)||void 0===t?void 0:t["fx:tax_item_categories"])||void 0===n?void 0:n[0];let m;try{const e=new URL(null!==(r=this.taxItemCategories)&&void 0!==r?r:""),t=new URL(this.href).pathname.split("/").pop();if(!t)throw new Error;e.searchParams.set("tax_id",t),e.searchParams.set("limit","1"),m=e.toString()}catch(e){m=void 0}return o(l||(l=s` <foxy-nucleon href="${0}" id="query" @update="${0}"> <foxy-nucleon parent="${0}" href="${0}" id="resource" @update="${0}"> </foxy-nucleon> </foxy-nucleon> <vaadin-checkbox class="px-m py-s block overflow-hidden" ?disabled="${0}" ?checked="${0}" @change="${0}"> ${0} </vaadin-checkbox> `),i(m),(e=>{const t=e.currentTarget;this.__queryElementData=t.data,this.requestUpdate()}),i(null!==(a=this.taxItemCategories)&&void 0!==a?a:void 0),i(null==d?void 0:d._links.self.href),(e=>{const t=e.currentTarget;this.__resourceElementIsBusy=!t.in("idle"),this.requestUpdate()}),!this.__queryElementData||this.__resourceElementIsBusy||this.disabled,!!d,(e=>{const t=e.currentTarget,n=this.renderRoot.querySelector("#resource");t.checked?(n.edit({tax_uri:this.data._links.self.href,item_category_uri:this.itemCategory}),n.submit()):n.delete()}),super.render())}});let d,m=e=>e;customElements.define("foxy-internal-item-category-form-taxes-control",class extends t{constructor(){super(...arguments),this.taxes=null}static get properties(){return r(r({},super.properties),{},{taxes:{}})}renderControl(){var e,t,n,r;const i=this.nucleon;let a;try{const t=new URL(null!==(e=this.taxes)&&void 0!==e?e:"");t.searchParams.set("limit","5"),a=t.toString()}catch(e){a=null!==(t=this.taxes)&&void 0!==t?t:""}return o(d||(d=m` <foxy-i18n class="block text-s font-medium text-secondary leading-none mb-s" infer="" key="title"> </foxy-i18n> <foxy-pagination first="${0}" infer="pagination"> <foxy-collection-page class="block mb-s divide-y divide-contrast-10 border border-contrast-10 rounded-t-l rounded-b-l" infer="" item="foxy-internal-item-category-form-taxes-control-item" .props="${0}"> </foxy-collection-page> </foxy-pagination> <foxy-i18n class="block text-xs text-secondary leading-xs mt-xs" infer="" key="helper_text"> </foxy-i18n> `),a,{"tax-item-categories":null!==(r=null===(n=null==i?void 0:i.form._links)||void 0===n?void 0:n["fx:tax_item_categories"].href)&&void 0!==r?r:"","item-category":null==i?void 0:i.href})}});let p,c,_,f,u,h,y,x,g,v,b,j,w=e=>e;class $ extends(a(e,"item-category-form")){constructor(){super(...arguments),this.emailTemplates=null,this.templates={},this.taxes=null}static get properties(){return r(r({},super.properties),{},{emailTemplates:{attribute:"email-templates"},taxes:{}})}static get v8n(){return[({code:e})=>!!e||"code:v8n_required",({code:e})=>e&&e.length<=50||"code:v8n_too_long",({name:e})=>!!e||"name:v8n_required",({name:e})=>e&&e.length<=50||"name:v8n_too_long",({item_delivery_type:e})=>!!e||"item-delivery-type:v8n_required",({item_delivery_type:e,max_downloads_per_customer:t})=>"downloaded"!==e||"number"==typeof t||"max-downloads-per-customer:v8n_required",({max_downloads_per_customer:e})=>"number"!=typeof e||e>=0||"max-downloads-per-customer:v8n_negative",({item_delivery_type:e,max_downloads_time_period:t})=>"downloaded"!==e||"number"==typeof t||"max-downloads-time-period:v8n_required",({max_downloads_time_period:e})=>"number"!=typeof e||e>=0||"max-downloads-time-period:v8n_negative",({customs_value:e})=>"number"!=typeof e||e>=0||"customs-value:v8n_negative",({item_delivery_type:e,default_weight:t})=>"shipped"!==e||"number"==typeof t||"default-weight:v8n_required",({default_weight:e})=>"number"!=typeof e||e>=0||"default-weight:v8n_negative",({item_delivery_type:e,default_weight_unit:t})=>"shipped"!==e||"string"==typeof t||"default-weight-unit:v8n_required",({item_delivery_type:e,default_length_unit:t})=>"shipped"!==e||"string"==typeof t||"default-length-unit:v8n_required",({item_delivery_type:e,shipping_flat_rate:t})=>"flat_rate"!==e||"number"==typeof t||"shipping-flat-rate:v8n_required",({shipping_flat_rate:e})=>"number"!=typeof e||e>=0||"shipping-flat-rate:v8n_negative",({item_delivery_type:e,shipping_flat_rate_type:t})=>"flat_rate"!==e||"string"==typeof t||"shipping-flat-rate-type:v8n_required",({handling_fee_type:e})=>!!e||"handling-fee-type:v8n_required",({handling_fee_type:e,handling_fee_minimum:t})=>"flat_percent_with_minimum"!==e||"number"==typeof t||"handling-fee-minimum:v8n_required",({handling_fee_minimum:e})=>"number"!=typeof e||e>=0||"handling-fee-minimum:v8n_negative",({handling_fee_type:e,handling_fee_percentage:t})=>"flat_percent_with_minimum"!==e&&"flat_percent"!==e||"number"==typeof t||"handling-fee-percentage:v8n_required",({handling_fee_percentage:e})=>"number"!=typeof e||e>=0||"handling-fee-percentage:v8n_negative",({send_admin_email:e,admin_email:t})=>!e||!!t||"admin-email:v8n_required"]}renderBody(){var e,t,n,r;const a=this.form.item_delivery_type,l=null!==(e=this.form.handling_fee_type)&&void 0!==e?e:"none";return o(p||(p=w` <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control infer="name" class="col-span-2"></foxy-internal-text-control> <foxy-internal-text-control infer="code" class="col-span-2"></foxy-internal-text-control> <foxy-internal-select-control infer="handling-fee-type" class="col-span-2" .options="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-select-control infer="item-delivery-type" class="col-span-2" .options="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-text-control infer="discount-name" class="col-span-2"> </foxy-internal-text-control> ${0} <foxy-internal-async-combo-box-control item-label-path="description" item-value-path="_links.self.href" first="${0}" infer="admin-email-template-uri" class="${0}" @change="${0}"> </foxy-internal-async-combo-box-control> ${0} <foxy-internal-async-combo-box-control item-label-path="description" item-value-path="_links.self.href" first="${0}" infer="customer-email-template-uri" class="col-span-2" @change="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-async-combo-box-control item-label-path="description" item-value-path="_links.self.href" first="${0}" infer="gift-recipient-email-template-uri" class="col-span-2"> </foxy-internal-async-combo-box-control> ${0} </div> ${0} `),$.__handlingFeeTypeOptions,"none"===l?"":o(c||(c=w` ${0} ${0} ${0} `),this.__renderHandlingFee(),l.includes("percent")?this.__renderHandlingFeePercentage():"","flat_percent_with_minimum"===l?this.__renderHandlingFeeMinimum():""),$.__itemDeliveryTypeOptions,"downloaded"===a?this.__renderDownloadDeliveryControls():"flat_rate"===a?[this.__renderFlatRateControls(),this.__renderCustomsValue()]:"shipped"===a?[this.__renderShippingControls(),this.__renderCustomsValue()]:"",this.form.discount_name?this.__renderDiscountBuilder():"",i(null!==(t=this.emailTemplates)&&void 0!==t?t:void 0),this.form.send_admin_email?"":"col-span-2",(e=>{this.edit({send_admin_email:!!e.detail,admin_email:e.detail?this.form.admin_email:""})}),this.form.send_admin_email?this.__renderAdminEmail():"",i(null!==(n=this.emailTemplates)&&void 0!==n?n:void 0),(e=>this.edit({send_customer_email:!!e.detail})),i(null!==(r=this.emailTemplates)&&void 0!==r?r:void 0),this.data?this.__renderTaxes():"",super.renderBody())}__renderHandlingFee(){return o(_||(_=w` <foxy-internal-number-control infer="handling-fee" class="${0}"> </foxy-internal-number-control> `),"flat_percent"===this.form.handling_fee_type?"":"col-span-2")}__renderHandlingFeePercentage(){return o(f||(f=w` <foxy-internal-number-control infer="handling-fee-percentage"> </foxy-internal-number-control> `))}__renderHandlingFeeMinimum(){return o(u||(u=w` <foxy-internal-number-control infer="handling-fee-minimum"> </foxy-internal-number-control> `))}__renderDownloadDeliveryControls(){return o(h||(h=w` <foxy-internal-integer-control infer="max-downloads-per-customer"> </foxy-internal-integer-control> <foxy-internal-integer-control infer="max-downloads-time-period"> </foxy-internal-integer-control> `))}__renderFlatRateControls(){return o(y||(y=w` <foxy-internal-number-control infer="shipping-flat-rate"> </foxy-internal-number-control> <foxy-internal-select-control infer="shipping-flat-rate-type" .options="${0}"> </foxy-internal-select-control> `),$.__shippingFlatRateTypeOptions)}__renderShippingControls(){return o(x||(x=w` <foxy-internal-integer-control infer="default-weight" class="col-span-2"> </foxy-internal-integer-control> <foxy-internal-select-control infer="default-weight-unit" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="default-length-unit" .options="${0}"> </foxy-internal-select-control> `),$.__defaultWeightUnitOptions,$.__defaultLengthUnitOptions)}__renderCustomsValue(){return o(g||(g=w` <foxy-internal-number-control infer="customs-value" class="col-span-2"> </foxy-internal-number-control> `))}__renderDiscountBuilder(){var e,t;const n={name:null!==(e=this.form.discount_name)&&void 0!==e?e:"",type:this.form.discount_type||"quantity_amount",details:null!==(t=this.form.discount_details)&&void 0!==t?t:""};return o(v||(v=w` <foxy-discount-builder infer="discount-builder" class="col-span-2" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> `),n,(e=>{const t=e.currentTarget;this.edit({discount_name:t.parsedValue.name,discount_type:t.parsedValue.type,discount_details:t.parsedValue.details})}))}__renderAdminEmail(){return o(b||(b=w`<foxy-internal-text-control infer="admin-email"> </foxy-internal-text-control>`))}__renderTaxes(){var e;return o(j||(j=w` <foxy-internal-item-category-form-taxes-control taxes="${0}" class="col-span-2" infer="taxes"> </foxy-internal-item-category-form-taxes-control> `),i(null!==(e=this.taxes)&&void 0!==e?e:void 0))}}$.__shippingFlatRateTypeOptions=[{label:"option_per_order",value:"per_order"},{label:"option_per_shipment",value:"per_shipment"}],$.__defaultWeightUnitOptions=[{label:"option_lbs",value:"LBS"},{label:"option_kgs",value:"KGS"}],$.__defaultLengthUnitOptions=[{label:"option_in",value:"IN"},{label:"option_cm",value:"CM"}],$.__itemDeliveryTypeOptions=[{label:"option_notshipped",value:"notshipped"},{label:"option_downloaded",value:"downloaded"},{label:"option_flat_rate",value:"flat_rate"},{label:"option_shipped",value:"shipped"},{label:"option_pickup",value:"pickup"}],$.__handlingFeeTypeOptions=[{label:"option_none",value:"none"},{label:"option_flat_per_order",value:"flat_per_order"},{label:"option_flat_per_item",value:"flat_per_item"},{label:"option_flat_percent",value:"flat_percent"},{label:"option_flat_percent_with_minimum",value:"flat_percent_with_minimum"}],customElements.define("foxy-item-category-form",$);export{$ as ItemCategoryForm};
|
|
1
|
+
import"./shared-65318cc1.js";import"./shared-51d28e6d.js";import"./shared-8474bc4a.js";import"./shared-c4240bc6.js";import"./shared-a3c73e91.js";import{I as e}from"./shared-25f64060.js";import"./foxy-discount-builder.js";import"./foxy-nucleon-element.js";import{I as t}from"./shared-0a248c0d.js";import"./foxy-collection-page.js";import"./foxy-pagination.js";import"./shared-b3ac59eb.js";import{TaxCard as i}from"./foxy-tax-card.js";import{_ as n}from"./shared-307262a1.js";import{i as r}from"./shared-d3bf9ac0.js";import{h as o}from"./shared-7f33a83a.js";import{a}from"./shared-09d4fbb8.js";import"./shared-88e36564.js";import"./shared-17d0db7f.js";import"./shared-59042137.js";import"./shared-31651a9c.js";import"./shared-d14c2060.js";import"./shared-4674063d.js";import"./shared-e6828dbf.js";import"./shared-dfe2602a.js";import"./shared-1d08a5ad.js";import"./shared-64657919.js";import"./shared-fef9ecc1.js";import"./shared-432c5183.js";import"./shared-77a4d8e8.js";import"./shared-4b67d699.js";import"./shared-e6997950.js";import"./shared-6dc64a17.js";import"./shared-36725fe3.js";import"./shared-c7f2f1ab.js";import"./shared-4e709717.js";import"./foxy-spinner.js";import"./shared-c6c6ba69.js";import"./shared-c2d3b32b.js";import"./shared-d6276c83.js";import"./shared-332f2997.js";import"./shared-d519a301.js";import"./shared-e6f3e9f0.js";import"./shared-0479553e.js";import"./shared-11c2efc8.js";import"./shared-bf62a65b.js";import"./shared-a92ae606.js";let l,s=e=>e;customElements.define("foxy-internal-item-category-form-taxes-control-item",class extends i{constructor(){super(...arguments),this.taxItemCategories=null,this.itemCategory=null,this.__resourceElementIsBusy=!1,this.__queryElementData=null}static get properties(){return n(n({},super.properties),{},{taxItemCategories:{attribute:"tax-item-categories"},itemCategory:{attribute:"item-category"}})}render(){var e,t,i,n,a;const d=null===(i=null===(t=null===(e=this.__queryElementData)||void 0===e?void 0:e._embedded)||void 0===t?void 0:t["fx:tax_item_categories"])||void 0===i?void 0:i[0];let m;try{const e=new URL(null!==(n=this.taxItemCategories)&&void 0!==n?n:""),t=new URL(this.href).pathname.split("/").pop();if(!t)throw new Error;e.searchParams.set("tax_id",t),e.searchParams.set("limit","1"),m=e.toString()}catch(e){m=void 0}return o(l||(l=s` <foxy-nucleon href="${0}" id="query" @update="${0}"> <foxy-nucleon parent="${0}" href="${0}" id="resource" @update="${0}"> </foxy-nucleon> </foxy-nucleon> <vaadin-checkbox class="px-m py-s block overflow-hidden" ?disabled="${0}" ?checked="${0}" @change="${0}"> ${0} </vaadin-checkbox> `),r(m),(e=>{const t=e.currentTarget;this.__queryElementData=t.data,this.requestUpdate()}),r(null!==(a=this.taxItemCategories)&&void 0!==a?a:void 0),r(null==d?void 0:d._links.self.href),(e=>{const t=e.currentTarget;this.__resourceElementIsBusy=!t.in("idle"),this.requestUpdate()}),!this.__queryElementData||this.__resourceElementIsBusy||this.disabled,!!d,(e=>{const t=e.currentTarget,i=this.renderRoot.querySelector("#resource");t.checked?(i.edit({tax_uri:this.data._links.self.href,item_category_uri:this.itemCategory}),i.submit()):i.delete()}),super.render())}});let d,m=e=>e;customElements.define("foxy-internal-item-category-form-taxes-control",class extends t{constructor(){super(...arguments),this.taxes=null}static get properties(){return n(n({},super.properties),{},{taxes:{}})}renderControl(){var e,t,i,n;const r=this.nucleon;let a;try{const t=new URL(null!==(e=this.taxes)&&void 0!==e?e:"");t.searchParams.set("limit","5"),a=t.toString()}catch(e){a=null!==(t=this.taxes)&&void 0!==t?t:""}return o(d||(d=m` <foxy-i18n class="block text-s font-medium text-secondary leading-none mb-s" infer="" key="title"> </foxy-i18n> <foxy-pagination first="${0}" infer="pagination"> <foxy-collection-page class="block mb-s divide-y divide-contrast-10 border border-contrast-10 rounded-t-l rounded-b-l" infer="" item="foxy-internal-item-category-form-taxes-control-item" .props="${0}"> </foxy-collection-page> </foxy-pagination> <foxy-i18n class="block text-xs text-secondary leading-xs mt-xs" infer="" key="helper_text"> </foxy-i18n> `),a,{"tax-item-categories":null!==(n=null===(i=null==r?void 0:r.form._links)||void 0===i?void 0:i["fx:tax_item_categories"].href)&&void 0!==n?n:"","item-category":null==r?void 0:r.href})}});let p,c,_,u,f,h,y,x,g,v,b,$,j=e=>e;class w extends(a(e,"item-category-form")){constructor(){super(...arguments),this.emailTemplates=null,this.templates={},this.taxes=null,this.__giftRecipientEmailTemplateLoaderId="gift-recipient-email-template-loader",this.__customerEmailTemplateLoaderId="customer-email-template-loader",this.__adminEmailTemplateLoaderId="admin-email-template-loader"}static get properties(){return n(n({},super.properties),{},{emailTemplates:{attribute:"email-templates"},taxes:{}})}static get v8n(){return[({code:e})=>!!e||"code:v8n_required",({code:e})=>e&&e.length<=50||"code:v8n_too_long",({name:e})=>!!e||"name:v8n_required",({name:e})=>e&&e.length<=50||"name:v8n_too_long",({item_delivery_type:e})=>!!e||"item-delivery-type:v8n_required",({item_delivery_type:e,max_downloads_per_customer:t})=>"downloaded"!==e||"number"==typeof t||"max-downloads-per-customer:v8n_required",({max_downloads_per_customer:e})=>"number"!=typeof e||e>=0||"max-downloads-per-customer:v8n_negative",({item_delivery_type:e,max_downloads_time_period:t})=>"downloaded"!==e||"number"==typeof t||"max-downloads-time-period:v8n_required",({max_downloads_time_period:e})=>"number"!=typeof e||e>=0||"max-downloads-time-period:v8n_negative",({customs_value:e})=>"number"!=typeof e||e>=0||"customs-value:v8n_negative",({item_delivery_type:e,default_weight:t})=>"shipped"!==e||"number"==typeof t||"default-weight:v8n_required",({default_weight:e})=>"number"!=typeof e||e>=0||"default-weight:v8n_negative",({item_delivery_type:e,default_weight_unit:t})=>"shipped"!==e||"string"==typeof t||"default-weight-unit:v8n_required",({item_delivery_type:e,default_length_unit:t})=>"shipped"!==e||"string"==typeof t||"default-length-unit:v8n_required",({item_delivery_type:e,shipping_flat_rate:t})=>"flat_rate"!==e||"number"==typeof t||"shipping-flat-rate:v8n_required",({shipping_flat_rate:e})=>"number"!=typeof e||e>=0||"shipping-flat-rate:v8n_negative",({item_delivery_type:e,shipping_flat_rate_type:t})=>"flat_rate"!==e||"string"==typeof t||"shipping-flat-rate-type:v8n_required",({handling_fee_type:e})=>!!e||"handling-fee-type:v8n_required",({handling_fee_type:e,handling_fee_minimum:t})=>"flat_percent_with_minimum"!==e||"number"==typeof t||"handling-fee-minimum:v8n_required",({handling_fee_minimum:e})=>"number"!=typeof e||e>=0||"handling-fee-minimum:v8n_negative",({handling_fee_type:e,handling_fee_percentage:t})=>"flat_percent_with_minimum"!==e&&"flat_percent"!==e||"number"==typeof t||"handling-fee-percentage:v8n_required",({handling_fee_percentage:e})=>"number"!=typeof e||e>=0||"handling-fee-percentage:v8n_negative",({send_admin_email:e,admin_email:t})=>!e||!!t||"admin-email:v8n_required"]}renderBody(){var e,t,i,n,a,l,s;const d=this.form.item_delivery_type,m=null!==(e=this.form.handling_fee_type)&&void 0!==e?e:"none";return o(p||(p=j` <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control infer="name" class="col-span-2"></foxy-internal-text-control> <foxy-internal-text-control infer="code" class="col-span-2"></foxy-internal-text-control> <foxy-internal-select-control infer="handling-fee-type" class="col-span-2" .options="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-select-control infer="item-delivery-type" class="col-span-2" .options="${0}"> </foxy-internal-select-control> ${0} <foxy-internal-text-control infer="discount-name" class="col-span-2"> </foxy-internal-text-control> ${0} <foxy-internal-async-combo-box-control item-label-path="description" item-value-path="_links.self.href" first="${0}" infer="admin-email-template-uri" class="${0}" .selectedItem="${0}" @change="${0}"> </foxy-internal-async-combo-box-control> ${0} <foxy-internal-async-combo-box-control item-label-path="description" item-value-path="_links.self.href" first="${0}" infer="customer-email-template-uri" class="col-span-2" .selectedItem="${0}" @change="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-async-combo-box-control item-label-path="description" item-value-path="_links.self.href" first="${0}" infer="gift-recipient-email-template-uri" class="col-span-2" .selectedItem="${0}"> </foxy-internal-async-combo-box-control> ${0} </div> ${0} `),r(this.form.customer_email_template_uri||void 0),this.__customerEmailTemplateLoaderId,(()=>this.requestUpdate()),r(this.form.gift_recipient_email_template_uri||void 0),this.__giftRecipientEmailTemplateLoaderId,(()=>this.requestUpdate()),r(this.form.admin_email_template_uri||void 0),this.__adminEmailTemplateLoaderId,(()=>this.requestUpdate()),w.__handlingFeeTypeOptions,"none"===m?"":o(c||(c=j` ${0} ${0} ${0} `),this.__renderHandlingFee(),m.includes("percent")?this.__renderHandlingFeePercentage():"","flat_percent_with_minimum"===m?this.__renderHandlingFeeMinimum():""),w.__itemDeliveryTypeOptions,"downloaded"===d?this.__renderDownloadDeliveryControls():"flat_rate"===d?[this.__renderFlatRateControls(),this.__renderCustomsValue()]:"shipped"===d?[this.__renderShippingControls(),this.__renderCustomsValue()]:"",this.form.discount_name?this.__renderDiscountBuilder():"",r(null!==(t=this.emailTemplates)&&void 0!==t?t:void 0),this.form.send_admin_email?"":"col-span-2",null===(i=this.__adminEmailTemplateLoader)||void 0===i?void 0:i.data,(e=>{this.edit({send_admin_email:!!e.detail,admin_email:e.detail?this.form.admin_email:""})}),this.form.send_admin_email?this.__renderAdminEmail():"",r(null!==(n=this.emailTemplates)&&void 0!==n?n:void 0),null===(a=this.__customerEmailTemplateLoader)||void 0===a?void 0:a.data,(e=>this.edit({send_customer_email:!!e.detail})),r(null!==(l=this.emailTemplates)&&void 0!==l?l:void 0),null===(s=this.__giftRecipientEmailTemplateLoader)||void 0===s?void 0:s.data,this.data?this.__renderTaxes():"",super.renderBody())}get __giftRecipientEmailTemplateLoader(){const e=this.__giftRecipientEmailTemplateLoaderId;return this.renderRoot.querySelector(`#${e}`)}get __customerEmailTemplateLoader(){const e=this.__customerEmailTemplateLoaderId;return this.renderRoot.querySelector(`#${e}`)}get __adminEmailTemplateLoader(){const e=this.__adminEmailTemplateLoaderId;return this.renderRoot.querySelector(`#${e}`)}__renderHandlingFee(){return o(_||(_=j` <foxy-internal-number-control infer="handling-fee" class="${0}"> </foxy-internal-number-control> `),"flat_percent"===this.form.handling_fee_type?"":"col-span-2")}__renderHandlingFeePercentage(){return o(u||(u=j` <foxy-internal-number-control infer="handling-fee-percentage"> </foxy-internal-number-control> `))}__renderHandlingFeeMinimum(){return o(f||(f=j` <foxy-internal-number-control infer="handling-fee-minimum"> </foxy-internal-number-control> `))}__renderDownloadDeliveryControls(){return o(h||(h=j` <foxy-internal-integer-control infer="max-downloads-per-customer"> </foxy-internal-integer-control> <foxy-internal-integer-control infer="max-downloads-time-period"> </foxy-internal-integer-control> `))}__renderFlatRateControls(){return o(y||(y=j` <foxy-internal-number-control infer="shipping-flat-rate"> </foxy-internal-number-control> <foxy-internal-select-control infer="shipping-flat-rate-type" .options="${0}"> </foxy-internal-select-control> `),w.__shippingFlatRateTypeOptions)}__renderShippingControls(){return o(x||(x=j` <foxy-internal-integer-control infer="default-weight" class="col-span-2"> </foxy-internal-integer-control> <foxy-internal-select-control infer="default-weight-unit" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="default-length-unit" .options="${0}"> </foxy-internal-select-control> `),w.__defaultWeightUnitOptions,w.__defaultLengthUnitOptions)}__renderCustomsValue(){return o(g||(g=j` <foxy-internal-number-control infer="customs-value" class="col-span-2"> </foxy-internal-number-control> `))}__renderDiscountBuilder(){var e,t;const i={name:null!==(e=this.form.discount_name)&&void 0!==e?e:"",type:this.form.discount_type||"quantity_amount",details:null!==(t=this.form.discount_details)&&void 0!==t?t:""};return o(v||(v=j` <foxy-discount-builder infer="discount-builder" class="col-span-2" .parsedValue="${0}" @change="${0}"> </foxy-discount-builder> `),i,(e=>{const t=e.currentTarget;this.edit({discount_name:t.parsedValue.name,discount_type:t.parsedValue.type,discount_details:t.parsedValue.details})}))}__renderAdminEmail(){return o(b||(b=j`<foxy-internal-text-control infer="admin-email"> </foxy-internal-text-control>`))}__renderTaxes(){var e;return o($||($=j` <foxy-internal-item-category-form-taxes-control taxes="${0}" class="col-span-2" infer="taxes"> </foxy-internal-item-category-form-taxes-control> `),r(null!==(e=this.taxes)&&void 0!==e?e:void 0))}}w.__shippingFlatRateTypeOptions=[{label:"option_per_order",value:"per_order"},{label:"option_per_shipment",value:"per_shipment"}],w.__defaultWeightUnitOptions=[{label:"option_lbs",value:"LBS"},{label:"option_kgs",value:"KGS"}],w.__defaultLengthUnitOptions=[{label:"option_in",value:"IN"},{label:"option_cm",value:"CM"}],w.__itemDeliveryTypeOptions=[{label:"option_notshipped",value:"notshipped"},{label:"option_downloaded",value:"downloaded"},{label:"option_flat_rate",value:"flat_rate"},{label:"option_shipped",value:"shipped"},{label:"option_pickup",value:"pickup"}],w.__handlingFeeTypeOptions=[{label:"option_none",value:"none"},{label:"option_flat_per_order",value:"flat_per_order"},{label:"option_flat_per_item",value:"flat_per_item"},{label:"option_flat_percent",value:"flat_percent"},{label:"option_flat_percent_with_minimum",value:"flat_percent_with_minimum"}],customElements.define("foxy-item-category-form",w);export{w as ItemCategoryForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-77a4d8e8.js";import{h as t}from"./shared-7f33a83a.js";import{C as e}from"./shared-c7f2f1ab.js";import{N as s}from"./shared-c2d3b32b.js";import{T as i,a as r}from"./shared-09d4fbb8.js";import{c as n}from"./shared-4e709717.js";import"./shared-4674063d.js";import"./shared-59042137.js";import"./shared-c6c6ba69.js";import"./shared-307262a1.js";import"./shared-4b67d699.js";import"./shared-64657919.js";import"./shared-d3bf9ac0.js";import"./shared-1d08a5ad.js";import"./shared-d6276c83.js";import"./shared-332f2997.js";let a,o,d,c,l,p,u,h,
|
|
1
|
+
import"./shared-0479553e.js";import"./foxy-spinner.js";import"./shared-77a4d8e8.js";import{h as t}from"./shared-7f33a83a.js";import{C as e}from"./shared-c7f2f1ab.js";import{N as s}from"./shared-c2d3b32b.js";import{T as i,a as r}from"./shared-09d4fbb8.js";import{c as n}from"./shared-4e709717.js";import"./shared-4674063d.js";import"./shared-59042137.js";import"./shared-c6c6ba69.js";import"./shared-307262a1.js";import"./shared-4b67d699.js";import"./shared-64657919.js";import"./shared-d3bf9ac0.js";import"./shared-1d08a5ad.js";import"./shared-d6276c83.js";import"./shared-332f2997.js";let a,o,d,c,l,p,u,m,h,f,v,y,_,$=t=>t;const x=i(e(r(s,"transaction-card")));class b extends x{constructor(){super(...arguments),this.templates={},this.__currencyDisplay=""}render(){var e,s;const i=this.hiddenSelector,r=!i.matches("total",!0),d=!i.matches("status",!0);return t(a||(a=$` <div aria-busy="${0}" aria-live="polite" class="relative leading-s font-lumo text-m"> <div class="${0}"> ${0} ${0} ${0} </div> <div class="${0}"> <foxy-spinner data-testid="spinner" state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.in("busy"),n({"transition-opacity":!0,"opacity-0":!this.data}),r||d?t(o||(o=$` <div class="flex items-center justify-between gap-s"> ${0} ${0} </div> `),r?this.__renderTotal():"",d?this.__renderStatus():""):"",i.matches("description",!0)?"":this.__renderDescription(),i.matches("customer",!0)?"":this.__renderCustomer(),n({"pointer-events-none absolute inset-0 flex transition-opacity":!0,"opacity-0":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(s=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==s?s:"")}async _sendGet(){var t;const e=await super._sendGet(),s=null===(t=e._links["fx:store"])||void 0===t?void 0:t.href;if("string"==typeof s){const t=await super._fetch(s);this.__currencyDisplay=t.use_international_currency_symbol?"code":"symbol"}else this.__currencyDisplay="symbol";return e}__renderTotal(){var e,s;const i=this.data;let r;if(i){const n=`${i.total_order} ${i.currency_code}`,a=this.__currencyDisplay,o=["subscription_cancellation","subscription_modification","subscription_renewal","updateinfo"].includes(i.type)?i.type:"fx:subscription"in i._links?"new_subscription":"new_order",l=null===(s=null===(e=this.data)||void 0===e?void 0:e.source)||void 0===s?void 0:s.substring(0,3).toUpperCase();r=t(d||(d=$` ${0} <foxy-i18n class="truncate" lang="${0}" key="type_${0}" ns="${0}"></foxy-i18n> <span>•</span> <foxy-i18n options="${0}" lang="${0}" key="price" ns="${0}"> </foxy-i18n> `),l?t(c||(c=$`<span title="${0}">${0}</span>`),this.t(`source_${l}`),l):"",this.lang,o,this.ns,JSON.stringify({amount:n,currencyDisplay:a}),this.lang,this.ns)}else r=t(l||(l=$`​`));return t(p||(p=$` <div class="min-w-0" data-testid="total"> ${0} <div class="font-medium flex items-center gap-xs">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("total:before"),r,this.renderTemplateOrSlot("total:after"))}__renderStatus(){var e,s,i,r;const n=(null===(e=this.data)||void 0===e?void 0:e.status)||"completed";return t(u||(u=$` <div class="flex-shrink-0" data-testid="status"> ${0} <div class="text-tertiary text-s flex items-center space-x-s"> <foxy-i18n options="${0}" lang="${0}" key="time" ns="${0}"> </foxy-i18n> <iron-icon data-testid="status-icon" class="icon-inline text-l ${0}" title="${0}" icon="${0}"> </iron-icon> </div> ${0} </div> `),this.renderTemplateOrSlot("status:before"),JSON.stringify({value:null===(s=this.data)||void 0===s?void 0:s.transaction_date}),this.lang,this.ns,null!==(i={completed:"text-success",rejected:"text-error",declined:"text-error"}[n])&&void 0!==i?i:"text-tertiary",this.t(`transaction_${n}`),null!==(r={completed:"icons:done-all",refunded:"icons:restore",rejected:"icons:highlight-off",declined:"icons:highlight-off",voided:"icons:remove-circle-outline"}[n])&&void 0!==r?r:"icons:schedule",this.renderTemplateOrSlot("status:after"))}__renderDescription(){var e,s;const i=null===(s=null===(e=this.data)||void 0===e?void 0:e._embedded)||void 0===s?void 0:s["fx:items"];let r;if(i){const e={most_expensive_item:[...i].sort(((t,e)=>t.price-e.price))[0],count_minus_one:i.length-1,count:i.length};r=t(m||(m=$` <foxy-i18n options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> `),JSON.stringify(e),this.lang,this.ns)}else r=t(h||(h=$`​`));return t(f||(f=$` <div data-testid="description"> ${0} <div class="text-s text-secondary truncate">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("description:before"),r,this.renderTemplateOrSlot("description:after"))}__renderCustomer(){const e=this.data,s=e?t(v||(v=$`${0} ${0} (${0})`),e.customer_first_name,e.customer_last_name,e.customer_email):t(y||(y=$`​`));return t(_||(_=$` <div data-testid="customer"> ${0} <div class="text-tertiary truncate text-s">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("customer:before"),s,this.renderTemplateOrSlot("customer:after"))}}customElements.define("foxy-transaction-card",b);export{b as TransactionCard};
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
"increase": "increase"
|
|
157
157
|
},
|
|
158
158
|
"admin-email-template-uri": {
|
|
159
|
-
"label": "
|
|
159
|
+
"label": "Message to admin",
|
|
160
160
|
"placeholder": "None (don't send)",
|
|
161
161
|
"helper_text": ""
|
|
162
162
|
},
|
|
@@ -167,12 +167,12 @@
|
|
|
167
167
|
"v8n_required": "Please enter an email"
|
|
168
168
|
},
|
|
169
169
|
"customer-email-template-uri": {
|
|
170
|
-
"label": "
|
|
170
|
+
"label": "Message to customer",
|
|
171
171
|
"placeholder": "None (don't send)",
|
|
172
172
|
"helper_text": ""
|
|
173
173
|
},
|
|
174
174
|
"gift-recipient-email-template-uri": {
|
|
175
|
-
"label": "
|
|
175
|
+
"label": "Message to gift recipient",
|
|
176
176
|
"placeholder": "None (don't send)",
|
|
177
177
|
"helper_text": ""
|
|
178
178
|
},
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"transaction_summary_plural": "{{most_expensive_item.name}} and {{count_minus_one}} more",
|
|
18
18
|
"transaction_verified": "Verified",
|
|
19
19
|
"transaction_voided": "Voided",
|
|
20
|
-
"type_subscription_cancellation": "
|
|
21
|
-
"type_subscription_modification": "
|
|
22
|
-
"type_subscription_renewal": "
|
|
23
|
-
"type_updateinfo": "
|
|
24
|
-
"type_new_order": "
|
|
25
|
-
"type_new_subscription": "
|
|
20
|
+
"type_subscription_cancellation": "Cancellation",
|
|
21
|
+
"type_subscription_modification": "Modification",
|
|
22
|
+
"type_subscription_renewal": "Renewal",
|
|
23
|
+
"type_updateinfo": "Update",
|
|
24
|
+
"type_new_order": "Order",
|
|
25
|
+
"type_new_subscription": "Subscription",
|
|
26
26
|
"source_MIT": "This transaction was initiated by merchant",
|
|
27
27
|
"source_CIT": "This transaction was initiated by customer",
|
|
28
28
|
"spinner": {
|
|
@@ -99,7 +99,13 @@ export declare class ItemCategoryForm extends ItemCategoryForm_base<Data> {
|
|
|
99
99
|
private static __defaultLengthUnitOptions;
|
|
100
100
|
private static __itemDeliveryTypeOptions;
|
|
101
101
|
private static __handlingFeeTypeOptions;
|
|
102
|
+
private readonly __giftRecipientEmailTemplateLoaderId;
|
|
103
|
+
private readonly __customerEmailTemplateLoaderId;
|
|
104
|
+
private readonly __adminEmailTemplateLoaderId;
|
|
102
105
|
renderBody(): TemplateResult;
|
|
106
|
+
private get __giftRecipientEmailTemplateLoader();
|
|
107
|
+
private get __customerEmailTemplateLoader();
|
|
108
|
+
private get __adminEmailTemplateLoader();
|
|
103
109
|
private __renderHandlingFee;
|
|
104
110
|
private __renderHandlingFeePercentage;
|
|
105
111
|
private __renderHandlingFeeMinimum;
|
|
@@ -90,6 +90,9 @@ export class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-cate
|
|
|
90
90
|
this.templates = {};
|
|
91
91
|
/** URL of the `fx:taxes` collection for a store. */
|
|
92
92
|
this.taxes = null;
|
|
93
|
+
this.__giftRecipientEmailTemplateLoaderId = 'gift-recipient-email-template-loader';
|
|
94
|
+
this.__customerEmailTemplateLoaderId = 'customer-email-template-loader';
|
|
95
|
+
this.__adminEmailTemplateLoaderId = 'admin-email-template-loader';
|
|
93
96
|
}
|
|
94
97
|
static get properties() {
|
|
95
98
|
return {
|
|
@@ -164,10 +167,34 @@ export class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-cate
|
|
|
164
167
|
];
|
|
165
168
|
}
|
|
166
169
|
renderBody() {
|
|
167
|
-
var _a, _b, _c, _d;
|
|
170
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
168
171
|
const itemDeliveryType = this.form.item_delivery_type;
|
|
169
172
|
const handlingFeeType = (_a = this.form.handling_fee_type) !== null && _a !== void 0 ? _a : 'none';
|
|
170
173
|
return html `
|
|
174
|
+
<foxy-nucleon
|
|
175
|
+
infer=""
|
|
176
|
+
href=${ifDefined(this.form.customer_email_template_uri || undefined)}
|
|
177
|
+
id=${this.__customerEmailTemplateLoaderId}
|
|
178
|
+
@update=${() => this.requestUpdate()}
|
|
179
|
+
>
|
|
180
|
+
</foxy-nucleon>
|
|
181
|
+
|
|
182
|
+
<foxy-nucleon
|
|
183
|
+
infer=""
|
|
184
|
+
href=${ifDefined(this.form.gift_recipient_email_template_uri || undefined)}
|
|
185
|
+
id=${this.__giftRecipientEmailTemplateLoaderId}
|
|
186
|
+
@update=${() => this.requestUpdate()}
|
|
187
|
+
>
|
|
188
|
+
</foxy-nucleon>
|
|
189
|
+
|
|
190
|
+
<foxy-nucleon
|
|
191
|
+
infer=""
|
|
192
|
+
href=${ifDefined(this.form.admin_email_template_uri || undefined)}
|
|
193
|
+
id=${this.__adminEmailTemplateLoaderId}
|
|
194
|
+
@update=${() => this.requestUpdate()}
|
|
195
|
+
>
|
|
196
|
+
</foxy-nucleon>
|
|
197
|
+
|
|
171
198
|
<div class="grid grid-cols-2 gap-m">
|
|
172
199
|
<foxy-internal-text-control infer="name" class="col-span-2"></foxy-internal-text-control>
|
|
173
200
|
<foxy-internal-text-control infer="code" class="col-span-2"></foxy-internal-text-control>
|
|
@@ -215,6 +242,7 @@ export class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-cate
|
|
|
215
242
|
first=${ifDefined((_b = this.emailTemplates) !== null && _b !== void 0 ? _b : undefined)}
|
|
216
243
|
infer="admin-email-template-uri"
|
|
217
244
|
class=${this.form.send_admin_email ? '' : 'col-span-2'}
|
|
245
|
+
.selectedItem=${(_c = this.__adminEmailTemplateLoader) === null || _c === void 0 ? void 0 : _c.data}
|
|
218
246
|
@change=${(evt) => {
|
|
219
247
|
this.edit({
|
|
220
248
|
send_admin_email: !!evt.detail,
|
|
@@ -229,9 +257,10 @@ export class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-cate
|
|
|
229
257
|
<foxy-internal-async-combo-box-control
|
|
230
258
|
item-label-path="description"
|
|
231
259
|
item-value-path="_links.self.href"
|
|
232
|
-
first=${ifDefined((
|
|
260
|
+
first=${ifDefined((_d = this.emailTemplates) !== null && _d !== void 0 ? _d : undefined)}
|
|
233
261
|
infer="customer-email-template-uri"
|
|
234
262
|
class="col-span-2"
|
|
263
|
+
.selectedItem=${(_e = this.__customerEmailTemplateLoader) === null || _e === void 0 ? void 0 : _e.data}
|
|
235
264
|
@change=${(evt) => this.edit({ send_customer_email: !!evt.detail })}
|
|
236
265
|
>
|
|
237
266
|
</foxy-internal-async-combo-box-control>
|
|
@@ -239,9 +268,10 @@ export class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-cate
|
|
|
239
268
|
<foxy-internal-async-combo-box-control
|
|
240
269
|
item-label-path="description"
|
|
241
270
|
item-value-path="_links.self.href"
|
|
242
|
-
first=${ifDefined((
|
|
271
|
+
first=${ifDefined((_f = this.emailTemplates) !== null && _f !== void 0 ? _f : undefined)}
|
|
243
272
|
infer="gift-recipient-email-template-uri"
|
|
244
273
|
class="col-span-2"
|
|
274
|
+
.selectedItem=${(_g = this.__giftRecipientEmailTemplateLoader) === null || _g === void 0 ? void 0 : _g.data}
|
|
245
275
|
>
|
|
246
276
|
</foxy-internal-async-combo-box-control>
|
|
247
277
|
|
|
@@ -251,6 +281,18 @@ export class ItemCategoryForm extends TranslatableMixin(InternalForm, 'item-cate
|
|
|
251
281
|
${super.renderBody()}
|
|
252
282
|
`;
|
|
253
283
|
}
|
|
284
|
+
get __giftRecipientEmailTemplateLoader() {
|
|
285
|
+
const id = this.__giftRecipientEmailTemplateLoaderId;
|
|
286
|
+
return this.renderRoot.querySelector(`#${id}`);
|
|
287
|
+
}
|
|
288
|
+
get __customerEmailTemplateLoader() {
|
|
289
|
+
const id = this.__customerEmailTemplateLoaderId;
|
|
290
|
+
return this.renderRoot.querySelector(`#${id}`);
|
|
291
|
+
}
|
|
292
|
+
get __adminEmailTemplateLoader() {
|
|
293
|
+
const id = this.__adminEmailTemplateLoaderId;
|
|
294
|
+
return this.renderRoot.querySelector(`#${id}`);
|
|
295
|
+
}
|
|
254
296
|
__renderHandlingFee() {
|
|
255
297
|
return html `
|
|
256
298
|
<foxy-internal-number-control
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAK,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 { 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
|
+
{"version":3,"file":"ItemCategoryForm.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemCategoryForm/ItemCategoryForm.ts"],"names":[],"mappings":"AAUA,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8EG;AACH,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB,CAAC,YAAY,EAAE,o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AAE,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 { Templates, Data } from './types';\nimport type { NucleonElement } from '../NucleonElement/NucleonElement';\nimport type { TemplateResult } from 'lit-html';\nimport type { ParsedValue } from '../DiscountBuilder/types';\nimport type { NucleonV8N } from '../NucleonElement/types';\nimport type { Resource } from '@foxy.io/sdk/core';\nimport type { Rels } from '@foxy.io/sdk/backend';\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 private readonly __giftRecipientEmailTemplateLoaderId = 'gift-recipient-email-template-loader';\n\n private readonly __customerEmailTemplateLoaderId = 'customer-email-template-loader';\n\n private readonly __adminEmailTemplateLoaderId = 'admin-email-template-loader';\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 <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.form.customer_email_template_uri || undefined)}\n id=${this.__customerEmailTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.form.gift_recipient_email_template_uri || undefined)}\n id=${this.__giftRecipientEmailTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\n <foxy-nucleon\n infer=\"\"\n href=${ifDefined(this.form.admin_email_template_uri || undefined)}\n id=${this.__adminEmailTemplateLoaderId}\n @update=${() => this.requestUpdate()}\n >\n </foxy-nucleon>\n\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 .selectedItem=${this.__adminEmailTemplateLoader?.data}\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 .selectedItem=${this.__customerEmailTemplateLoader?.data}\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 .selectedItem=${this.__giftRecipientEmailTemplateLoader?.data}\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 get __giftRecipientEmailTemplateLoader() {\n const id = this.__giftRecipientEmailTemplateLoaderId;\n type Loader = NucleonElement<Resource<Rels.EmailTemplate>>;\n return this.renderRoot.querySelector<Loader>(`#${id}`);\n }\n\n private get __customerEmailTemplateLoader() {\n const id = this.__customerEmailTemplateLoaderId;\n type Loader = NucleonElement<Resource<Rels.EmailTemplate>>;\n return this.renderRoot.querySelector<Loader>(`#${id}`);\n }\n\n private get __adminEmailTemplateLoader() {\n const id = this.__adminEmailTemplateLoaderId;\n type Loader = NucleonElement<Resource<Rels.EmailTemplate>>;\n return this.renderRoot.querySelector<Loader>(`#${id}`);\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"]}
|
|
@@ -5,6 +5,7 @@ import '../../internal/InternalSelectControl/index';
|
|
|
5
5
|
import '../../internal/InternalTextControl/index';
|
|
6
6
|
import '../../internal/InternalForm/index';
|
|
7
7
|
import '../DiscountBuilder/index';
|
|
8
|
+
import '../NucleonElement/index';
|
|
8
9
|
import './internal/InternalItemCategoryFormTaxesControl/index';
|
|
9
10
|
import { ItemCategoryForm } from './ItemCategoryForm';
|
|
10
11
|
export { ItemCategoryForm };
|
|
@@ -5,6 +5,7 @@ import "../../internal/InternalSelectControl/index.js";
|
|
|
5
5
|
import "../../internal/InternalTextControl/index.js";
|
|
6
6
|
import "../../internal/InternalForm/index.js";
|
|
7
7
|
import "../DiscountBuilder/index.js";
|
|
8
|
+
import "../NucleonElement/index.js";
|
|
8
9
|
import "./internal/InternalItemCategoryFormTaxesControl/index.js";
|
|
9
10
|
import { ItemCategoryForm } from "./ItemCategoryForm.js";
|
|
10
11
|
customElements.define('foxy-item-category-form', ItemCategoryForm);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemCategoryForm/index.ts"],"names":[],"mappings":"AAAA,8DAA2D;AAC3D,wDAAqD;AACrD,uDAAoD;AACpD,uDAAoD;AACpD,qDAAkD;AAClD,8CAA2C;AAE3C,qCAAkC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/ItemCategoryForm/index.ts"],"names":[],"mappings":"AAAA,8DAA2D;AAC3D,wDAAqD;AACrD,uDAAoD;AACpD,uDAAoD;AACpD,qDAAkD;AAClD,8CAA2C;AAE3C,qCAAkC;AAClC,oCAAiC;AAEjC,kEAA+D;AAE/D,OAAO,EAAE,gBAAgB,EAAE,8BAA2B;AAEtD,cAAc,CAAC,MAAM,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,CAAC;AAEnE,OAAO,EAAE,gBAAgB,EAAE,CAAC","sourcesContent":["import '../../internal/InternalAsyncComboBoxControl/index';\nimport '../../internal/InternalIntegerControl/index';\nimport '../../internal/InternalNumberControl/index';\nimport '../../internal/InternalSelectControl/index';\nimport '../../internal/InternalTextControl/index';\nimport '../../internal/InternalForm/index';\n\nimport '../DiscountBuilder/index';\nimport '../NucleonElement/index';\n\nimport './internal/InternalItemCategoryFormTaxesControl/index';\n\nimport { ItemCategoryForm } from './ItemCategoryForm';\n\ncustomElements.define('foxy-item-category-form', ItemCategoryForm);\n\nexport { ItemCategoryForm };\n"]}
|
|
@@ -41,7 +41,7 @@ class TransactionCard extends Base {
|
|
|
41
41
|
<div class=${classMap({ 'transition-opacity': true, 'opacity-0': !this.data })}>
|
|
42
42
|
${hasTotal || hasStatus
|
|
43
43
|
? html `
|
|
44
|
-
<div class="flex items-center justify-between">
|
|
44
|
+
<div class="flex items-center justify-between gap-s">
|
|
45
45
|
${hasTotal ? this.__renderTotal() : ''} ${hasStatus ? this.__renderStatus() : ''}
|
|
46
46
|
</div>
|
|
47
47
|
`
|
|
@@ -82,6 +82,7 @@ class TransactionCard extends Base {
|
|
|
82
82
|
return transaction;
|
|
83
83
|
}
|
|
84
84
|
__renderTotal() {
|
|
85
|
+
var _a, _b;
|
|
85
86
|
const data = this.data;
|
|
86
87
|
let content;
|
|
87
88
|
if (data) {
|
|
@@ -98,9 +99,11 @@ class TransactionCard extends Base {
|
|
|
98
99
|
: 'fx:subscription' in data._links
|
|
99
100
|
? 'new_subscription'
|
|
100
101
|
: 'new_order';
|
|
102
|
+
const source = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.source) === null || _b === void 0 ? void 0 : _b.substring(0, 3).toUpperCase();
|
|
101
103
|
content = html `
|
|
102
|
-
|
|
103
|
-
<
|
|
104
|
+
${source ? html `<span title=${this.t(`source_${source}`)}>${source}</span>` : ''}
|
|
105
|
+
<foxy-i18n class="truncate" lang=${this.lang} key="type_${type}" ns=${this.ns}></foxy-i18n>
|
|
106
|
+
<span>•</span>
|
|
104
107
|
<foxy-i18n
|
|
105
108
|
options=${JSON.stringify({ amount, currencyDisplay })}
|
|
106
109
|
lang=${this.lang}
|
|
@@ -114,15 +117,15 @@ class TransactionCard extends Base {
|
|
|
114
117
|
content = html `​`;
|
|
115
118
|
}
|
|
116
119
|
return html `
|
|
117
|
-
<div data-testid="total">
|
|
120
|
+
<div class="min-w-0" data-testid="total">
|
|
118
121
|
${this.renderTemplateOrSlot('total:before')}
|
|
119
|
-
<div class="font-medium
|
|
122
|
+
<div class="font-medium flex items-center gap-xs">${content}</div>
|
|
120
123
|
${this.renderTemplateOrSlot('total:after')}
|
|
121
124
|
</div>
|
|
122
125
|
`;
|
|
123
126
|
}
|
|
124
127
|
__renderStatus() {
|
|
125
|
-
var _a, _b, _c, _d
|
|
128
|
+
var _a, _b, _c, _d;
|
|
126
129
|
const specialIcons = {
|
|
127
130
|
completed: 'icons:done-all',
|
|
128
131
|
refunded: 'icons:restore',
|
|
@@ -136,22 +139,13 @@ class TransactionCard extends Base {
|
|
|
136
139
|
declined: 'text-error',
|
|
137
140
|
};
|
|
138
141
|
const status = ((_a = this.data) === null || _a === void 0 ? void 0 : _a.status) || 'completed';
|
|
139
|
-
const source = (_b = this.data) === null || _b === void 0 ? void 0 : _b.source.substring(0, 3).toUpperCase();
|
|
140
142
|
return html `
|
|
141
|
-
<div data-testid="status">
|
|
143
|
+
<div class="flex-shrink-0" data-testid="status">
|
|
142
144
|
${this.renderTemplateOrSlot('status:before')}
|
|
143
145
|
|
|
144
146
|
<div class="text-tertiary text-s flex items-center space-x-s">
|
|
145
|
-
${source
|
|
146
|
-
? html `
|
|
147
|
-
<div class="bg-contrast-5 rounded-s px-xs" title=${this.t(`source_${source}`)}>
|
|
148
|
-
${source}
|
|
149
|
-
</div>
|
|
150
|
-
`
|
|
151
|
-
: ''}
|
|
152
|
-
|
|
153
147
|
<foxy-i18n
|
|
154
|
-
options=${JSON.stringify({ value: (
|
|
148
|
+
options=${JSON.stringify({ value: (_b = this.data) === null || _b === void 0 ? void 0 : _b.transaction_date })}
|
|
155
149
|
lang=${this.lang}
|
|
156
150
|
key="time"
|
|
157
151
|
ns=${this.ns}
|
|
@@ -160,9 +154,9 @@ class TransactionCard extends Base {
|
|
|
160
154
|
|
|
161
155
|
<iron-icon
|
|
162
156
|
data-testid="status-icon"
|
|
163
|
-
class="icon-inline text-l ${(
|
|
157
|
+
class="icon-inline text-l ${(_c = specialColors[status]) !== null && _c !== void 0 ? _c : 'text-tertiary'}"
|
|
164
158
|
title=${this.t(`transaction_${status}`)}
|
|
165
|
-
icon=${(
|
|
159
|
+
icon=${(_d = specialIcons[status]) !== null && _d !== void 0 ? _d : 'icons:schedule'}
|
|
166
160
|
>
|
|
167
161
|
</iron-icon>
|
|
168
162
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionCard.js","sourceRoot":"","sources":["../../../../src/elements/public/TransactionCard/TransactionCard.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,OAAO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AC,EAAE;;;OAGf,CAAC;SACH;aAAM;YACL,OAAO,GAAG,IAAI,CAAA,kBAAkB,CAAC;SAClC;QAED,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,oBAAoB,CAAC;sDACH,OAAO;UACnD,IAAI,CAAC,oBAAoB,CAAC,mBAAmB,CAAC;;KAEnD,CAAC;IACJ,CAAC;IAEO,gBAAgB;QACtB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QACvB,MAAM,OAAO,GAAG,IAAI;YAClB,CAAC,CAAC,IAAI,CAAA,GAAG,IAAI,CAAC,mBAAmB,IAAI,IAAI,CAAC,kBAAkB,KAAK,IAAI,CAAC,cAAc,GAAG;YACvF,CAAC,CAAC,IAAI,CAAA,kBAAkB,CAAC;QAE3B,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;qDACD,OAAO;UAClD,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC;;KAEhD,CAAC;IACJ,CAAC;CACF;AAED,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import { Data, Templates } from './types';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\n\nconst NS = 'transaction-card';\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Basic card displaying a transaction.\n *\n * @slot total:before\n * @slot total:after\n * @slot status:before\n * @slot status:after\n * @slot description:before\n * @slot description:after\n * @slot customer:before\n * @slot customer:after\n *\n * @element foxy-transaction-card\n * @since 1.12.0\n */\nclass TransactionCard extends Base<Data> {\n templates: Templates = {};\n\n private __currencyDisplay = '';\n\n render(): TemplateResult {\n const hiddenSelector = this.hiddenSelector;\n const hasTotal = !hiddenSelector.matches('total', true);\n const hasStatus = !hiddenSelector.matches('status', true);\n\n return html`\n <div\n aria-busy=${this.in('busy')}\n aria-live=\"polite\"\n class=\"relative leading-s font-lumo text-m\"\n >\n <div class=${classMap({ 'transition-opacity': true, 'opacity-0': !this.data })}>\n ${hasTotal || hasStatus\n ? html`\n <div class=\"flex items-center justify-between\">\n ${hasTotal ? this.__renderTotal() : ''} ${hasStatus ? this.__renderStatus() : ''}\n </div>\n `\n : ''}\n ${hiddenSelector.matches('description', true) ? '' : this.__renderDescription()}\n ${hiddenSelector.matches('customer', true) ? '' : this.__renderCustomer()}\n </div>\n\n <div\n class=${classMap({\n 'pointer-events-none absolute inset-0 flex transition-opacity': true,\n 'opacity-0': !!this.data,\n })}\n >\n <foxy-spinner\n data-testid=\"spinner\"\n state=${this.in('fail') ? 'error' : this.in({ idle: 'template' }) ? 'empty' : 'busy'}\n class=\"m-auto\"\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n protected async _sendGet(): Promise<Data> {\n const transaction = await super._sendGet();\n const storeLink = transaction._links['fx:store']?.href;\n\n if (typeof storeLink === 'string') {\n const store = await super._fetch<Resource<Rels.Store>>(storeLink);\n this.__currencyDisplay = store.use_international_currency_symbol ? 'code' : 'symbol';\n } else {\n this.__currencyDisplay = 'symbol';\n }\n\n return transaction;\n }\n\n private __renderTotal() {\n const data = this.data;\n let content: TemplateResult;\n\n if (data) {\n const amount = `${data.total_order} ${data.currency_code}`;\n const currencyDisplay = this.__currencyDisplay;\n const apiTypes = [\n 'subscription_cancellation',\n 'subscription_modification',\n 'subscription_renewal',\n 'updateinfo',\n ];\n\n const type = apiTypes.includes(data.type)\n ? data.type\n : 'fx:subscription' in data._links\n ? 'new_subscription'\n : 'new_order';\n\n content = html`\n <foxy-i18n lang=${this.lang} key=\"type_${type}\" ns=${this.ns}></foxy-i18n>\n <span> • </span>\n <foxy-i18n\n options=${JSON.stringify({ amount, currencyDisplay })}\n lang=${this.lang}\n key=\"price\"\n ns=${this.ns}\n >\n </foxy-i18n>\n `;\n } else {\n content = html`​`;\n }\n\n return html`\n <div data-testid=\"total\">\n ${this.renderTemplateOrSlot('total:before')}\n <div class=\"font-medium truncate\">${content}</div>\n ${this.renderTemplateOrSlot('total:after')}\n </div>\n `;\n }\n\n private __renderStatus() {\n const specialIcons: Record<string, string> = {\n completed: 'icons:done-all',\n refunded: 'icons:restore',\n rejected: 'icons:highlight-off',\n declined: 'icons:highlight-off',\n voided: 'icons:remove-circle-outline',\n };\n\n const specialColors: Record<string, string> = {\n completed: 'text-success',\n rejected: 'text-error',\n declined: 'text-error',\n };\n\n const status = this.data?.status || 'completed';\n const source = this.data?.source.substring(0, 3).toUpperCase();\n\n return html`\n <div data-testid=\"status\">\n ${this.renderTemplateOrSlot('status:before')}\n\n <div class=\"text-tertiary text-s flex items-center space-x-s\">\n ${source\n ? html`\n <div class=\"bg-contrast-5 rounded-s px-xs\" title=${this.t(`source_${source}`)}>\n ${source}\n </div>\n `\n : ''}\n\n <foxy-i18n\n options=${JSON.stringify({ value: this.data?.transaction_date })}\n lang=${this.lang}\n key=\"time\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <iron-icon\n data-testid=\"status-icon\"\n class=\"icon-inline text-l ${specialColors[status] ?? 'text-tertiary'}\"\n title=${this.t(`transaction_${status}`)}\n icon=${specialIcons[status] ?? 'icons:schedule'}\n >\n </iron-icon>\n </div>\n\n ${this.renderTemplateOrSlot('status:after')}\n </div>\n `;\n }\n\n private __renderDescription() {\n const items = this.data?._embedded?.['fx:items'];\n let content: TemplateResult;\n\n if (items) {\n const options = {\n most_expensive_item: [...items].sort((a, b) => a.price - b.price)[0],\n count_minus_one: items.length - 1,\n count: items.length,\n };\n\n content = html`\n <foxy-i18n\n options=${JSON.stringify(options)}\n lang=${this.lang}\n key=\"transaction_summary\"\n ns=${this.ns}\n >\n </foxy-i18n>\n `;\n } else {\n content = html`​`;\n }\n\n return html`\n <div data-testid=\"description\">\n ${this.renderTemplateOrSlot('description:before')}\n <div class=\"text-s text-secondary truncate\">${content}</div>\n ${this.renderTemplateOrSlot('description:after')}\n </div>\n `;\n }\n\n private __renderCustomer() {\n const data = this.data;\n const content = data\n ? html`${data.customer_first_name} ${data.customer_last_name} (${data.customer_email})`\n : html`​`;\n\n return html`\n <div data-testid=\"customer\">\n ${this.renderTemplateOrSlot('customer:before')}\n <div class=\"text-tertiary truncate text-s\">${content}</div>\n ${this.renderTemplateOrSlot('customer:after')}\n </div>\n `;\n }\n}\n\nexport { TransactionCard };\n"]}
|
|
1
|
+
{"version":3,"file":"TransactionCard.js","sourceRoot":"","sources":["../../../../src/elements/public/TransactionCard/TransactionCard.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAGlE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,MAAM,EAAE,GAAG,kBAAkB,CAAC;AAC9B,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;GAcG;AACH,MAAM,eAAgB,SAAQ,IAAU;IAAxC;;QACE,cAAS,GAAc,EAAE,CAAC;QAElB,sBAAiB,GAAG,EAAE,CAAC;IAoMjC,CAAC;IAlMC,MAAM;;QACJ,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC3C,MAAM,QAAQ,GAAG,CAAC,cAAc,CAAC,OAAO,CAAC,O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EL,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;qDACD,OAAO;UAClD,IAAI,CAAC,oBAAoB,CAAC,gBAAgB,CAAC;;KAEhD,CAAC;IACJ,CAAC;CACF;AAED,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import { Data, Templates } from './types';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\n\nconst NS = 'transaction-card';\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Basic card displaying a transaction.\n *\n * @slot total:before\n * @slot total:after\n * @slot status:before\n * @slot status:after\n * @slot description:before\n * @slot description:after\n * @slot customer:before\n * @slot customer:after\n *\n * @element foxy-transaction-card\n * @since 1.12.0\n */\nclass TransactionCard extends Base<Data> {\n templates: Templates = {};\n\n private __currencyDisplay = '';\n\n render(): TemplateResult {\n const hiddenSelector = this.hiddenSelector;\n const hasTotal = !hiddenSelector.matches('total', true);\n const hasStatus = !hiddenSelector.matches('status', true);\n\n return html`\n <div\n aria-busy=${this.in('busy')}\n aria-live=\"polite\"\n class=\"relative leading-s font-lumo text-m\"\n >\n <div class=${classMap({ 'transition-opacity': true, 'opacity-0': !this.data })}>\n ${hasTotal || hasStatus\n ? html`\n <div class=\"flex items-center justify-between gap-s\">\n ${hasTotal ? this.__renderTotal() : ''} ${hasStatus ? this.__renderStatus() : ''}\n </div>\n `\n : ''}\n ${hiddenSelector.matches('description', true) ? '' : this.__renderDescription()}\n ${hiddenSelector.matches('customer', true) ? '' : this.__renderCustomer()}\n </div>\n\n <div\n class=${classMap({\n 'pointer-events-none absolute inset-0 flex transition-opacity': true,\n 'opacity-0': !!this.data,\n })}\n >\n <foxy-spinner\n data-testid=\"spinner\"\n state=${this.in('fail') ? 'error' : this.in({ idle: 'template' }) ? 'empty' : 'busy'}\n class=\"m-auto\"\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n protected async _sendGet(): Promise<Data> {\n const transaction = await super._sendGet();\n const storeLink = transaction._links['fx:store']?.href;\n\n if (typeof storeLink === 'string') {\n const store = await super._fetch<Resource<Rels.Store>>(storeLink);\n this.__currencyDisplay = store.use_international_currency_symbol ? 'code' : 'symbol';\n } else {\n this.__currencyDisplay = 'symbol';\n }\n\n return transaction;\n }\n\n private __renderTotal() {\n const data = this.data;\n let content: TemplateResult;\n\n if (data) {\n const amount = `${data.total_order} ${data.currency_code}`;\n const currencyDisplay = this.__currencyDisplay;\n const apiTypes = [\n 'subscription_cancellation',\n 'subscription_modification',\n 'subscription_renewal',\n 'updateinfo',\n ];\n\n const type = apiTypes.includes(data.type)\n ? data.type\n : 'fx:subscription' in data._links\n ? 'new_subscription'\n : 'new_order';\n\n const source = this.data?.source?.substring(0, 3).toUpperCase();\n\n content = html`\n ${source ? html`<span title=${this.t(`source_${source}`)}>${source}</span>` : ''}\n <foxy-i18n class=\"truncate\" lang=${this.lang} key=\"type_${type}\" ns=${this.ns}></foxy-i18n>\n <span>•</span>\n <foxy-i18n\n options=${JSON.stringify({ amount, currencyDisplay })}\n lang=${this.lang}\n key=\"price\"\n ns=${this.ns}\n >\n </foxy-i18n>\n `;\n } else {\n content = html`​`;\n }\n\n return html`\n <div class=\"min-w-0\" data-testid=\"total\">\n ${this.renderTemplateOrSlot('total:before')}\n <div class=\"font-medium flex items-center gap-xs\">${content}</div>\n ${this.renderTemplateOrSlot('total:after')}\n </div>\n `;\n }\n\n private __renderStatus() {\n const specialIcons: Record<string, string> = {\n completed: 'icons:done-all',\n refunded: 'icons:restore',\n rejected: 'icons:highlight-off',\n declined: 'icons:highlight-off',\n voided: 'icons:remove-circle-outline',\n };\n\n const specialColors: Record<string, string> = {\n completed: 'text-success',\n rejected: 'text-error',\n declined: 'text-error',\n };\n\n const status = this.data?.status || 'completed';\n\n return html`\n <div class=\"flex-shrink-0\" data-testid=\"status\">\n ${this.renderTemplateOrSlot('status:before')}\n\n <div class=\"text-tertiary text-s flex items-center space-x-s\">\n <foxy-i18n\n options=${JSON.stringify({ value: this.data?.transaction_date })}\n lang=${this.lang}\n key=\"time\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n <iron-icon\n data-testid=\"status-icon\"\n class=\"icon-inline text-l ${specialColors[status] ?? 'text-tertiary'}\"\n title=${this.t(`transaction_${status}`)}\n icon=${specialIcons[status] ?? 'icons:schedule'}\n >\n </iron-icon>\n </div>\n\n ${this.renderTemplateOrSlot('status:after')}\n </div>\n `;\n }\n\n private __renderDescription() {\n const items = this.data?._embedded?.['fx:items'];\n let content: TemplateResult;\n\n if (items) {\n const options = {\n most_expensive_item: [...items].sort((a, b) => a.price - b.price)[0],\n count_minus_one: items.length - 1,\n count: items.length,\n };\n\n content = html`\n <foxy-i18n\n options=${JSON.stringify(options)}\n lang=${this.lang}\n key=\"transaction_summary\"\n ns=${this.ns}\n >\n </foxy-i18n>\n `;\n } else {\n content = html`​`;\n }\n\n return html`\n <div data-testid=\"description\">\n ${this.renderTemplateOrSlot('description:before')}\n <div class=\"text-s text-secondary truncate\">${content}</div>\n ${this.renderTemplateOrSlot('description:after')}\n </div>\n `;\n }\n\n private __renderCustomer() {\n const data = this.data;\n const content = data\n ? html`${data.customer_first_name} ${data.customer_last_name} (${data.customer_email})`\n : html`​`;\n\n return html`\n <div data-testid=\"customer\">\n ${this.renderTemplateOrSlot('customer:before')}\n <div class=\"text-tertiary truncate text-s\">${content}</div>\n ${this.renderTemplateOrSlot('customer:after')}\n </div>\n `;\n }\n}\n\nexport { TransactionCard };\n"]}
|