@foxy.io/elements 1.12.1-beta.1 → 1.13.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/cdn/foxy-applied-tax-card.js +1 -1
  2. package/dist/cdn/foxy-custom-field-card.js +1 -1
  3. package/dist/cdn/foxy-discount-card.js +1 -1
  4. package/dist/cdn/foxy-tax-card.js +1 -0
  5. package/dist/cdn/foxy-tax-form.js +1 -0
  6. package/dist/cdn/shared-67157a25.js +1 -0
  7. package/dist/cdn/translations/shared/de.json +16 -0
  8. package/dist/cdn/translations/shared/en.json +16 -0
  9. package/dist/cdn/translations/shared/es.json +16 -0
  10. package/dist/elements/public/CustomFieldCard/TwoLineCard.js +10 -2
  11. package/dist/elements/public/CustomFieldCard/TwoLineCard.js.map +1 -1
  12. package/dist/elements/public/TaxCard/TaxCard.d.ts +24 -0
  13. package/dist/elements/public/TaxCard/TaxCard.js +52 -0
  14. package/dist/elements/public/TaxCard/TaxCard.js.map +1 -0
  15. package/dist/elements/public/TaxCard/index.d.ts +5 -0
  16. package/dist/elements/public/TaxCard/index.js +7 -0
  17. package/dist/elements/public/TaxCard/index.js.map +1 -0
  18. package/dist/elements/public/TaxCard/types.d.ts +3 -0
  19. package/dist/elements/public/TaxCard/types.js +2 -0
  20. package/dist/elements/public/TaxCard/types.js.map +1 -0
  21. package/dist/elements/public/TaxForm/TaxForm.d.ts +102 -0
  22. package/dist/elements/public/TaxForm/TaxForm.js +687 -0
  23. package/dist/elements/public/TaxForm/TaxForm.js.map +1 -0
  24. package/dist/elements/public/TaxForm/index.d.ts +9 -0
  25. package/dist/elements/public/TaxForm/index.js +11 -0
  26. package/dist/elements/public/TaxForm/index.js.map +1 -0
  27. package/dist/elements/public/TaxForm/types.d.ts +33 -0
  28. package/dist/elements/public/TaxForm/types.js +2 -0
  29. package/dist/elements/public/TaxForm/types.js.map +1 -0
  30. package/dist/elements/public/index.d.ts +2 -0
  31. package/dist/elements/public/index.defined.d.ts +2 -0
  32. package/dist/elements/public/index.defined.js +2 -0
  33. package/dist/elements/public/index.defined.js.map +1 -1
  34. package/dist/elements/public/index.js +2 -0
  35. package/dist/elements/public/index.js.map +1 -1
  36. package/package.json +1 -1
  37. package/dist/cdn/shared-dea02a36.js +0 -1
@@ -1 +1 @@
1
- import"./shared-84fa75d9.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{h as r}from"./shared-17968c53.js";import{a as s}from"./shared-c1e0e11f.js";import{T as e}from"./shared-dea02a36.js";import"./shared-45d647e4.js";import"./shared-747b0842.js";import"./shared-cd700eac.js";import"./shared-50744508.js";import"./shared-f0199313.js";import"./shared-98ee7fad.js";import"./shared-cf248335.js";import"./shared-d4dad105.js";import"./shared-7684cb05.js";import"./shared-c0161e6a.js";import"./shared-4e709717.js";let t,a,i=r=>r;class n extends(s(e,"applied-tax-card")){constructor(){super(...arguments),this.__currencyDisplay="",this.__currency=""}render(){return super.render({title:s=>r(t||(t=i`${0}`),s.name),subtitle:s=>r(a||(a=i` <foxy-i18n options="${0}" lang="${0}" key="price" ns="${0}"> </foxy-i18n> <span>&bull;</span> <foxy-i18n options="${0}" lang="${0}" key="percent" ns="${0}"> </foxy-i18n> `),JSON.stringify({amount:`${s.amount} ${this.__currency}`,currencyDisplay:this.__currencyDisplay}),this.lang,this.ns,JSON.stringify({fraction:s.rate/100}),this.lang,this.ns)})}async _sendGet(){const r=await super._sendGet(),[s,e]=await Promise.all([super._fetch(r._links["fx:transaction"].href),super._fetch(r._links["fx:store"].href)]);return this.__currency=s.currency_code,this.__currencyDisplay=e.use_international_currency_symbol?"code":"symbol",r}}customElements.define("foxy-applied-tax-card",n);export{n as AppliedTaxCard};
1
+ import"./shared-84fa75d9.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{h as r}from"./shared-17968c53.js";import{a as s}from"./shared-c1e0e11f.js";import{T as e}from"./shared-67157a25.js";import"./shared-45d647e4.js";import"./shared-747b0842.js";import"./shared-cd700eac.js";import"./shared-50744508.js";import"./shared-f0199313.js";import"./shared-98ee7fad.js";import"./shared-cf248335.js";import"./shared-d4dad105.js";import"./shared-7684cb05.js";import"./shared-c0161e6a.js";import"./shared-4e709717.js";let t,i,a=r=>r;class n extends(s(e,"applied-tax-card")){constructor(){super(...arguments),this.__currencyDisplay="",this.__currency=""}render(){return super.render({title:s=>r(t||(t=a`${0}`),s.name),subtitle:s=>r(i||(i=a` <foxy-i18n options="${0}" lang="${0}" key="price" ns="${0}"> </foxy-i18n> <span>&bull;</span> <foxy-i18n options="${0}" lang="${0}" key="percent" ns="${0}"> </foxy-i18n> `),JSON.stringify({amount:`${s.amount} ${this.__currency}`,currencyDisplay:this.__currencyDisplay}),this.lang,this.ns,JSON.stringify({fraction:s.rate/100}),this.lang,this.ns)})}async _sendGet(){const r=await super._sendGet(),[s,e]=await Promise.all([super._fetch(r._links["fx:transaction"].href),super._fetch(r._links["fx:store"].href)]);return this.__currency=s.currency_code,this.__currencyDisplay=e.use_international_currency_symbol?"code":"symbol",r}}customElements.define("foxy-applied-tax-card",n);export{n as AppliedTaxCard};
@@ -1 +1 @@
1
- import"./shared-84fa75d9.js";import"./foxy-spinner.js";import{h as r}from"./shared-17968c53.js";import{a as e}from"./shared-c1e0e11f.js";import{T as s}from"./shared-dea02a36.js";import"./shared-45d647e4.js";import"./shared-747b0842.js";import"./shared-cd700eac.js";import"./foxy-i18n.js";import"./shared-50744508.js";import"./shared-f0199313.js";import"./shared-98ee7fad.js";import"./shared-cf248335.js";import"./shared-d4dad105.js";import"./shared-7684cb05.js";import"./shared-c0161e6a.js";import"./shared-4e709717.js";let a,d,t=r=>r;class o extends(e(s,"custom-field-card")){render(){return super.render({title:e=>r(a||(a=t`${0}`),e.name),subtitle:e=>r(d||(d=t`${0}`),e.value)})}}customElements.define("foxy-custom-field-card",o);export{o as CustomFieldCard};
1
+ import"./shared-84fa75d9.js";import"./foxy-spinner.js";import{h as r}from"./shared-17968c53.js";import{a as s}from"./shared-c1e0e11f.js";import{T as e}from"./shared-67157a25.js";import"./shared-45d647e4.js";import"./shared-747b0842.js";import"./shared-cd700eac.js";import"./foxy-i18n.js";import"./shared-50744508.js";import"./shared-f0199313.js";import"./shared-98ee7fad.js";import"./shared-cf248335.js";import"./shared-d4dad105.js";import"./shared-7684cb05.js";import"./shared-c0161e6a.js";import"./shared-4e709717.js";let a,d,t=r=>r;class o extends(s(e,"custom-field-card")){render(){return super.render({title:s=>r(a||(a=t`${0}`),s.name),subtitle:s=>r(d||(d=t`${0}`),s.value)})}}customElements.define("foxy-custom-field-card",o);export{o as CustomFieldCard};
@@ -1 +1 @@
1
- import"./shared-84fa75d9.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{h as r}from"./shared-17968c53.js";import{a as s}from"./shared-c1e0e11f.js";import{T as e}from"./shared-dea02a36.js";import"./shared-45d647e4.js";import"./shared-747b0842.js";import"./shared-cd700eac.js";import"./shared-50744508.js";import"./shared-f0199313.js";import"./shared-98ee7fad.js";import"./shared-cf248335.js";import"./shared-d4dad105.js";import"./shared-7684cb05.js";import"./shared-c0161e6a.js";import"./shared-4e709717.js";let t,a,i=r=>r;class o extends(s(e,"discount-card")){constructor(){super(...arguments),this.__currencyDisplay="",this.__currency=""}render(){return super.render({title:s=>r(t||(t=i`${0} &bull; ${0}`),s.name,s.code),subtitle:s=>r(a||(a=i` <foxy-i18n options="${0}" lang="${0}" key="price" ns="${0}"> </foxy-i18n> `),JSON.stringify({currencyDisplay:this.__currencyDisplay,amount:`${Math.abs(s.amount)} ${this.__currency}`}),this.lang,this.ns)})}async _sendGet(){const r=await super._sendGet(),[s,e]=await Promise.all([super._fetch(r._links["fx:transaction"].href),super._fetch(r._links["fx:store"].href)]);return this.__currency=s.currency_code,this.__currencyDisplay=e.use_international_currency_symbol?"code":"symbol",r}}customElements.define("foxy-discount-card",o);export{o as DiscountCard};
1
+ import"./shared-84fa75d9.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{h as r}from"./shared-17968c53.js";import{a as s}from"./shared-c1e0e11f.js";import{T as e}from"./shared-67157a25.js";import"./shared-45d647e4.js";import"./shared-747b0842.js";import"./shared-cd700eac.js";import"./shared-50744508.js";import"./shared-f0199313.js";import"./shared-98ee7fad.js";import"./shared-cf248335.js";import"./shared-d4dad105.js";import"./shared-7684cb05.js";import"./shared-c0161e6a.js";import"./shared-4e709717.js";let t,i,a=r=>r;class o extends(s(e,"discount-card")){constructor(){super(...arguments),this.__currencyDisplay="",this.__currency=""}render(){return super.render({title:s=>r(t||(t=a`${0} &bull; ${0}`),s.name,s.code),subtitle:s=>r(i||(i=a` <foxy-i18n options="${0}" lang="${0}" key="price" ns="${0}"> </foxy-i18n> `),JSON.stringify({currencyDisplay:this.__currencyDisplay,amount:`${Math.abs(s.amount)} ${this.__currency}`}),this.lang,this.ns)})}async _sendGet(){const r=await super._sendGet(),[s,e]=await Promise.all([super._fetch(r._links["fx:transaction"].href),super._fetch(r._links["fx:store"].href)]);return this.__currency=s.currency_code,this.__currencyDisplay=e.use_international_currency_symbol?"code":"symbol",r}}customElements.define("foxy-discount-card",o);export{o as DiscountCard};
@@ -0,0 +1 @@
1
+ import"./shared-84fa75d9.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{h as r}from"./shared-17968c53.js";import{a as t}from"./shared-c1e0e11f.js";import{T as e}from"./shared-67157a25.js";import"./shared-45d647e4.js";import"./shared-747b0842.js";import"./shared-cd700eac.js";import"./shared-50744508.js";import"./shared-f0199313.js";import"./shared-98ee7fad.js";import"./shared-cf248335.js";import"./shared-d4dad105.js";import"./shared-7684cb05.js";import"./shared-c0161e6a.js";import"./shared-4e709717.js";let a,s,i=r=>r;class o extends(t(e,"tax-card")){render(){return super.render({title:({name:t})=>r(a||(a=i`${0}`),t),subtitle:()=>r(s||(s=i`${0} &bull; ${0}`),this.__typeLabel,this.__rateLabel)})}get __typeLabel(){var r;const{type:t,country:e,region:a,city:s}=null!==(r=this.data)&&void 0!==r?r:{};return"global"===t?this.t("tax_global"):"union"===t?this.t("tax_union"):"country"===t?e:"region"===t?`${e}, ${a}`:"local"===t?`${e}, ${a}, ${s}`:void 0}get __rateLabel(){var r,t;if(!1===(null===(r=this.data)||void 0===r?void 0:r.is_live))return this.t("percent",{fraction:this.data.rate/100});const e=null===(t=this.data)||void 0===t?void 0:t.service_provider;return"onesource"===e?"Thomson Reuters ONESOURCE":"avalara"===e?"Avalara AvaTax 15":"taxjar"===e?"TaxJar":this.t("tax_rate_provider_default")}}customElements.define("foxy-tax-card",o);export{o as TaxCard};
@@ -0,0 +1 @@
1
+ import"./shared-452674bd.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import"./shared-bf09e011.js";import"./shared-3ae39e52.js";import"./shared-54c485d2.js";import"./shared-b98f88c9.js";import{_ as e,h as t}from"./shared-17968c53.js";import{C as i}from"./shared-e55b6bb7.js";import"./shared-7888de8c.js";import{T as s,S as r,a}from"./shared-c1e0e11f.js";import"./shared-45d647e4.js";import"./shared-e0248713.js";import{P as n}from"./shared-b77179fd.js";import{c as o}from"./shared-4e709717.js";import{m as l}from"./shared-50744508.js";import{C as d}from"./shared-f0199313.js";import{N as h}from"./shared-cf248335.js";import{i as c}from"./shared-98ee7fad.js";import{i as _}from"./shared-c0161e6a.js";import"./shared-cd700eac.js";import"./shared-747b0842.js";import"./shared-87ca7818.js";import"./shared-54702b33.js";import"./shared-d4dad105.js";import"./shared-7684cb05.js";let u,m,p,y,v,g,f,b,x,$,S,T,k,O,w=e=>e;const C=["US","CA","AT","BE","BG","CY","CZ","DE","DK","EE","ES","FI","FR","GB","GR","HR","HU","IE","IM","IT","LT","LU","LV","MC","MT","NL","PL","PT","RO","SE","SI","SK"],H=[...C,"AU"],j=d(s(r(a(h,"tax-form"))));class E extends j{constructor(){var e;super(...arguments),e=this,this.templates={},this.__countries="",this.__regions="",this.__countriesService=_(l.withConfig({services:{sendGet:async function(){const t=await new E.API(e).fetch(e.countries);if(!t.ok)throw new Error(await t.text());return await t.json()}}})),this.__regionsService=_(l.withConfig({services:{sendGet:async function(){var t;const i=new URL(e.regions);i.searchParams.set("country_code",null!==(t=e.form.country)&&void 0!==t?t:"US");const s=await new E.API(e).fetch(i.toString());if(!s.ok)throw new Error(await s.text());return await s.json()}}}))}static get scopedElements(){return{"vaadin-integer-field":customElements.get("vaadin-integer-field"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"vaadin-button":customElements.get("vaadin-button"),"vaadin-select":customElements.get("vaadin-select"),"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"x-property-table":n,"x-checkbox":i}}static get properties(){return e(e({},super.properties),{},{countries:{type:String,noAccessor:!0},regions:{type:String,noAccessor:!0}})}static get v8n(){return[({name:e})=>!!e||"name_required",({name:e})=>!e||e.length<=30||"name_too_long",({type:e})=>!!e||"type_required",({type:e})=>e&&this.__types.includes(e)||"type_unknown",({country:e,type:t})=>"country"!=t||!!e||"country_required",({country:e,use_origin_rates:t})=>!t||!!e||"country_required",({country:e})=>!e||!!e.match(/[A-Z]{2}/)||"country_unknown",({region:e,type:t})=>"region"!=t||!!e||"region_required",({region:e})=>!e||e.length<=20||"region_unknown",({city:e})=>!e||e.length<=20||"city_too_long",({city:e,type:t})=>"local"!=t||!!e||"city_required",({service_provider:e})=>!e||this.__providers.includes(e)||"service_provider_unknown",({is_live:e,service_provider:t})=>!e||!!t||"service_provider_required",({rate:e})=>!e||e<=100||"rate_unknown",({is_live:e,rate:t})=>!!e||!!t||"rate_required"]}get countries(){return this.__countries}set countries(e){this.__countries=e,e?this.__countriesService.send({type:"FETCH"}):this.__countriesService.send({type:"SET_DATA",data:null})}get regions(){return this.__regions}set regions(e){this.__regions=e,e?this.__regionsService.send({type:"FETCH"}):this.__regionsService.send({type:"SET_DATA",data:null})}connectedCallback(){super.connectedCallback(),this.__countriesService.onTransition((({changed:e})=>e&&this.requestUpdate())),this.__countriesService.onChange((()=>this.requestUpdate())),this.__countriesService.start(),this.__regionsService.onTransition((({changed:e})=>e&&this.requestUpdate())),this.__regionsService.onChange((()=>this.requestUpdate())),this.__regionsService.start()}render(){var e,i;return t(u||(u=w` <div class="relative space-y-m"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <div class="${0}"> <foxy-spinner layout="vertical" class="m-auto p-m bg-base shadow-xs rounded-t-l rounded-b-l" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.__isNameHidden?null:this.__renderName(),this.__isTypeHidden?null:this.__renderType(),this.__isCountryHidden?null:this.__renderCountry(),this.__isRegionHidden?null:this.__renderRegion(),this.__isCityHidden?null:this.__renderCity(),this.__isProviderHidden?null:this.__renderProvider(),this.__isRateHidden?null:this.__renderRate(),this.__isApplyToShippingHidden?null:this.__renderApplyToShipping(),this.__isUseOriginRatesHidden?null:this.__renderUseOriginRates(),this.__isExemptAllCustomerTaxIdsHidden?null:this.__renderExemptAllCustomerTaxIds(),this.__isTimestampsHidden?null:this.__renderTimestamps(),this.__isCreateHidden?null:this.__renderCreate(),this.__isDeleteHidden?null:this.__renderDelete(),o({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!this.in("busy")&&!this.in("fail")}),this.in("fail")?"error":this.in("busy")?"busy":"empty",this.lang,this.ns,null!==(i=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==i?i:"")}disconnectedCallback(){super.disconnectedCallback(),this.__countriesService.stop(),this.__regionsService.stop()}get __isNameHidden(){return this.hiddenSelector.matches("name",!0)}get __isTypeHidden(){return this.hiddenSelector.matches("type",!0)}get __isCountryHidden(){return!!this.hiddenSelector.matches("country",!0)||("union"===this.form.type?!this.form.use_origin_rates:!["country","region","local"].includes(this.form.type))}get __isRegionHidden(){return!!this.hiddenSelector.matches("region",!0)||"local"!==this.form.type&&"region"!==this.form.type}get __isCityHidden(){return!!this.hiddenSelector.matches("city",!0)||"local"!==this.form.type}get __isProviderHidden(){return!!this.hiddenSelector.matches("provider",!0)||(!this.form.type||"global"===this.form.type||"local"===this.form.type)}get __isRateHidden(){return!!this.hiddenSelector.matches("rate",!0)||(!this.form.type||!0===this.form.is_live)}get __isApplyToShippingHidden(){return!!this.hiddenSelector.matches("apply-to-shipping",!0)||(void 0===this.form.type||!!this.form.is_live&&C.includes(this.form.country))}get __isUseOriginRatesHidden(){return!!this.hiddenSelector.matches("use-origin-rates",!0)||("union"!==this.form.type||!this.form.is_live||!!this.form.service_provider)}get __isExemptAllCustomerTaxIdsHidden(){if(this.hiddenSelector.matches("exempt-all-customer-tax-ids",!0))return!0;const e=this.form.service_provider;return void 0===e||"onesource"===e||"avalara"===e}get __isTimestampsHidden(){return!!this.hiddenSelector.matches("timestamps",!0)||!this.data}get __isCreateHidden(){return!!this.hiddenSelector.matches("create",!0)||!!this.data}get __isDeleteHidden(){return!!this.hiddenSelector.matches("delete",!0)||!this.data}__renderName(){return t(m||(m=w` <div> ${0} <vaadin-text-field class="w-full" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("name:before"),this.t("name"),c(this.form.name),this.in("busy")||this.disabledSelector.matches("name",!0),this.readonlySelector.matches("name",!0),(e=>{const t=e.currentTarget.value;this.edit({name:t})}),this.renderTemplateOrSlot("name:after"))}__renderType(){const e=[{label:this.t("tax_global"),value:"global"},{label:this.t("tax_union"),value:"union"},{label:this.t("tax_country"),value:"country"},{label:this.t("tax_region"),value:"region"},{label:this.t("tax_local"),value:"local"}];return t(p||(p=w` <div> ${0} <vaadin-combo-box item-value-path="value" item-label-path="label" item-id-path="value" label="${0}" value="${0}" class="w-full" .items="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot("type:before"),this.t("type"),c(this.form.type),e,this.in("busy")||this.disabledSelector.matches("type",!0),this.readonlySelector.matches("type",!0),(e=>{this.edit({type:e.currentTarget.value,country:"",region:"",city:"",service_provider:"",apply_to_shipping:!1,use_origin_rates:!1,exempt_all_customer_tax_ids:!1,is_live:!1,rate:0})}),this.renderTemplateOrSlot("type:after"))}__renderCountry(){var e;const i=this.__countriesService.state.matches("busy"),s=this.in("busy"),r=i||s,a=this.__countriesService.state.context.data,n=Object.values(null!==(e=null==a?void 0:a.values)&&void 0!==e?e:{});return t(y||(y=w` <div> ${0} <vaadin-combo-box item-value-path="cc2" item-label-path="default" item-id-path="cc2" label="${0}${0}" value="${0}" class="w-full" .items="${0}" ?allow-custom-value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot("country:before"),this.t("country"),i?` • ${this.t("loading_busy")}`:"",c(this.form.country),n,0===n.length,r||this.disabledSelector.matches("country",!0),this.readonlySelector.matches("country",!0),(e=>{this.edit({country:e.currentTarget.value,region:"",city:"",is_live:!1,service_provider:""}),this.__isApplyToShippingHidden&&this.edit({apply_to_shipping:!1}),this.__regionsService.send({type:"FETCH"})}),this.renderTemplateOrSlot("country:after"))}__renderRegion(){var e;const i=this.__regionsService.state.matches("busy"),s=this.in("busy"),r=i||s,a=this.__regionsService.state.context.data,n=Object.values(null!==(e=null==a?void 0:a.values)&&void 0!==e?e:{});return t(v||(v=w` <div> ${0} <vaadin-combo-box item-value-path="code" item-label-path="default" item-id-path="code" label="${0}${0}" value="${0}" class="w-full" .items="${0}" ?allow-custom-value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot("region:before"),this.t("region"),i?` • ${this.t("loading_busy")}`:"",c(this.form.region),n,0===n.length,r||this.disabledSelector.matches("region",!0),this.readonlySelector.matches("region",!0),(e=>{const t=e.currentTarget.value;this.edit({region:t,city:""})}),this.renderTemplateOrSlot("region:after"))}__renderCity(){return t(g||(g=w` <div> ${0} <vaadin-text-field class="w-full" label="${0}" value="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("city:before"),this.t("city"),c(this.form.city),this.in("busy")||this.disabledSelector.matches("city",!0),this.readonlySelector.matches("city",!0),(e=>{const t=e.currentTarget.value;this.edit({city:t})}),this.renderTemplateOrSlot("city:after"))}__renderProvider(){const e=[{label:this.t("tax_rate_provider_none"),value:"none"},{label:"Avalara AvaTax 15",value:"avalara"},{label:"Thomson Reuters ONESOURCE",value:"onesource"}];return C.includes(this.form.country)&&e.push({label:this.t("tax_rate_provider_default"),value:"default"}),H.includes(this.form.country)&&e.push({label:"TaxJar",value:"taxjar"}),t(f||(f=w` <div> ${0} <vaadin-combo-box item-value-path="value" item-label-path="label" item-id-path="value" label="${0}" value="${0}" class="w-full" allow-custom-value .items="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot("provider:before"),this.t("tax_rate_provider"),this.form.service_provider||this.form.is_live?"default":"none",e,this.in("busy")||this.disabledSelector.matches("provider",!0),this.readonlySelector.matches("provider",!0),(e=>{const t=e.currentTarget.value,i="none"===t||"default"===t?"":t;this.edit({service_provider:i,is_live:"none"!==t}),this.__isApplyToShippingHidden&&this.edit({apply_to_shipping:!1}),this.__isExemptAllCustomerTaxIdsHidden&&this.edit({exempt_all_customer_tax_ids:!1}),this.__isUseOriginRatesHidden&&this.edit({use_origin_rates:!1})}),this.renderTemplateOrSlot("provider:after"))}__renderRate(){return t(b||(b=w` <div> ${0} <vaadin-integer-field class="w-full" label="${0}" value="${0}" min="0" prevent-invalid-input has-controls ?disabled="${0}" ?readonly="${0}" @change="${0}"> </vaadin-integer-field> ${0} </div> `),this.renderTemplateOrSlot("rate:before"),this.t("tax_rate"),c(this.form.rate),this.in("busy")||this.disabledSelector.matches("rate",!0),this.readonlySelector.matches("rate",!0),(e=>{const t=parseInt(e.currentTarget.value);this.edit({rate:t})}),this.renderTemplateOrSlot("rate:after"))}__renderApplyToShipping(){return t(x||(x=w` <div> ${0} <x-checkbox class="leading-s" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="block text-m text-body" lang="${0}" key="tax_apply_to_shipping" ns="${0}"> </foxy-i18n> <foxy-i18n class="block text-s text-secondary" lang="${0}" key="tax_apply_to_shipping_explainer" ns="${0}"> </foxy-i18n> </x-checkbox> ${0} </div> `),this.renderTemplateOrSlot("apply-to-shipping:before"),this.disabledSelector.matches("apply-to-shipping",!0),this.readonlySelector.matches("apply-to-shipping",!0),!!this.form.apply_to_shipping,(e=>this.edit({apply_to_shipping:e.detail})),this.lang,this.ns,this.lang,this.ns,this.renderTemplateOrSlot("apply-to-shipping:after"))}__renderUseOriginRates(){return t($||($=w` <div> ${0} <x-checkbox class="leading-s" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="block text-m text-body" lang="${0}" key="tax_use_origin_rates" ns="${0}"> </foxy-i18n> <foxy-i18n class="block text-s text-secondary" lang="${0}" key="tax_use_origin_rates_explainer" ns="${0}"> </foxy-i18n> </x-checkbox> ${0} </div> `),this.renderTemplateOrSlot("use-origin-rates:before"),this.disabledSelector.matches("use-origin-rates",!0),this.readonlySelector.matches("use-origin-rates",!0),!!this.form.use_origin_rates,(e=>this.edit({use_origin_rates:e.detail})),this.lang,this.ns,this.lang,this.ns,this.renderTemplateOrSlot("use-origin-rates:after"))}__renderExemptAllCustomerTaxIds(){return t(S||(S=w` <div> ${0} <x-checkbox class="leading-s" ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n class="block text-m text-body" lang="${0}" key="tax_exempt_all_customer_tax_ids" ns="${0}"> </foxy-i18n> <foxy-i18n class="block text-s text-secondary" lang="${0}" key="tax_exempt_all_customer_tax_ids_explainer" ns="${0}"> </foxy-i18n> </x-checkbox> ${0} </div> `),this.renderTemplateOrSlot("exempt-all-customer-tax-ids:before"),this.disabledSelector.matches("exempt-all-customer-tax-ids",!0),this.readonlySelector.matches("exempt-all-customer-tax-ids",!0),!!this.form.exempt_all_customer_tax_ids,(e=>{this.edit({exempt_all_customer_tax_ids:e.detail})}),this.lang,this.ns,this.lang,this.ns,this.renderTemplateOrSlot("exempt-all-customer-tax-ids:after"))}__renderTimestamps(){return t(T||(T=w` <div> ${0} <x-property-table .items="${0}"> </x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),["date_modified","date_created"].map((e=>({name:this.t(e),value:this.data?this.t("date",{value:new Date(this.data[e])}):""}))),this.renderTemplateOrSlot("timestamps:after"))}__renderCreate(){const e=this.in({idle:{template:{clean:"invalid"}}}),i=this.in({idle:{template:{dirty:"invalid"}}}),s=this.in({idle:{snapshot:{clean:"invalid"}}}),r=this.in({idle:{snapshot:{dirty:"invalid"}}}),a=e||i||(s||r),n=this.in("busy");return t(k||(k=w` <div> ${0} <vaadin-button class="w-full" theme="primary success" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="create" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("create:before"),n||a||this.disabledSelector.matches("create",!0),this.submit,this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}__renderDelete(){return t(O||(O=w` <div> <foxy-internal-confirm-dialog message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> ${0} <vaadin-button theme="primary error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="delete" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.lang,this.ns,(e=>!e.detail.cancelled&&this.delete()),this.renderTemplateOrSlot("delete:before"),this.in("busy")||this.disabledSelector.matches("delete",!0),(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),this.ns,this.lang,this.renderTemplateOrSlot("delete:after"))}}E.__providers=["avalara","","taxjar","onesource"],E.__types=["global","country","region","local","union"],customElements.define("foxy-tax-form",E);export{E as TaxForm};
@@ -0,0 +1 @@
1
+ import{h as t,_ as e}from"./shared-17968c53.js";import{C as i}from"./shared-f0199313.js";import{N as s}from"./shared-cf248335.js";import{T as r}from"./shared-c1e0e11f.js";import{c as a}from"./shared-4e709717.js";let l,n,d,o=t=>t;const h=i(r(s));class p extends h{constructor(){super(...arguments),this.templates={},this.lang="",this.ns="",this.__renderTitle=e=>t(l||(l=o` <div data-testid="title"> ${0} <div class="text-secondary truncate"> ${0}&ZeroWidthSpace; </div> ${0} </div> `),this.renderTemplateOrSlot("title:before"),this.data?null==e?void 0:e(this.data):"",this.renderTemplateOrSlot("title:after")),this.__renderSubtitle=e=>t(n||(n=o` <div data-testid="subtitle"> ${0} <div class="font-semibold truncate"> ${0}&ZeroWidthSpace; </div> ${0} </div> `),this.renderTemplateOrSlot("subtitle:before"),this.data?null==e?void 0:e(this.data):"",this.renderTemplateOrSlot("subtitle:after"))}static get properties(){return e(e({},super.properties),{},{lang:{type:String},ns:{type:String}})}render(e){var i,s;const r=this.hiddenSelector;return t(d||(d=o` <div aria-live="polite" aria-busy="${0}" class="relative text-body text-m font-lumo leading-m"> ${0} ${0} <div class="${0}"> <foxy-spinner data-testid="spinner" class="m-auto" state="${0}" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),!this.data&&this.in("busy"),r.matches("title",!0)?"":this.__renderTitle(null==e?void 0:e.title),r.matches("subtitle",!0)?"":this.__renderSubtitle(null==e?void 0:e.subtitle),a({"transition duration-250 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(s=null===(i=customElements.get("foxy-spinner"))||void 0===i?void 0:i.defaultNS)&&void 0!==s?s:"")}}export{p as T};
@@ -111,7 +111,22 @@
111
111
  "subscription_failed": "Zahlung fehlgeschlagen am {{date, date}}",
112
112
  "subscription_plural": "Abonnements",
113
113
  "subscription_will_be_cancelled": "Wird beendet am {{date, date}}",
114
+ "tax_apply_to_shipping": "Auf Versand anwenden",
115
+ "tax_apply_to_shipping_explainer": "Ankreuzen, um diese Steuer auf die Versandkosten anzuwenden.",
116
+ "tax_country": "Landessteuer",
117
+ "tax_exempt_all_customer_tax_ids": "Alle Kunden mit Steuernummer ausnehmen",
118
+ "tax_exempt_all_customer_tax_ids_explainer": "Aktivieren Sie diese Option, um die Steuererhebung für Kunden mit der gespeicherten Steuernummer zu überspringen.",
119
+ "tax_global": "Globale Steuer",
114
120
  "tax_id": "Steuer-ID",
121
+ "tax_local": "Ortssteuer",
122
+ "tax_rate": "Satz (%)",
123
+ "tax_rate_provider": "Preisanbieter",
124
+ "tax_rate_provider_default": "Standard (Thomson Reuters; andere)",
125
+ "tax_rate_provider_none": "Keine (benutzerdefinierter Tarif)",
126
+ "tax_region": "Regionale Steuer",
127
+ "tax_union": "Steuer der Europäischen Union",
128
+ "tax_use_origin_rates": "Ursprungssteuersätze verwenden",
129
+ "tax_use_origin_rates_explainer": "Ankreuzen, um den Steuersatz Ihres Landes zu verwenden, unabhängig davon, wo sich die Kunden befinden.",
115
130
  "time": "{{value, time}}",
116
131
  "transaction": "Transaktion",
117
132
  "transaction_approved": "Zugelassen",
@@ -128,6 +143,7 @@
128
143
  "transaction_verified": "Überprüft",
129
144
  "transaction_voided": "Storniert",
130
145
  "twice_a_month": "Zweimal im Monat",
146
+ "type": "Typ",
131
147
  "type_any": "Feld unbekannten Typs",
132
148
  "type_attribute": "Schlüsselwertressource",
133
149
  "type_date": "Datumsfeld",
@@ -113,7 +113,22 @@
113
113
  "subscription_inactive": "Inactive",
114
114
  "subscription_plural": "Subscriptions",
115
115
  "subscription_will_be_cancelled": "Ends on {{date, date}}",
116
+ "tax_apply_to_shipping": "Apply to shipping",
117
+ "tax_apply_to_shipping_explainer": "Check to apply this tax to the shipping costs.",
118
+ "tax_country": "Country tax",
119
+ "tax_exempt_all_customer_tax_ids": "Exempt all customers with Tax ID",
120
+ "tax_exempt_all_customer_tax_ids_explainer": "Check to skip tax collection for customers with Tax ID on file.",
121
+ "tax_global": "Global tax",
116
122
  "tax_id": "Tax ID",
123
+ "tax_local": "Local tax",
124
+ "tax_rate": "Rate (%)",
125
+ "tax_rate_provider": "Rate provider",
126
+ "tax_rate_provider_default": "Default (Thomson Reuters; others)",
127
+ "tax_rate_provider_none": "None (custom rate)",
128
+ "tax_region": "Regional tax",
129
+ "tax_union": "European Union tax",
130
+ "tax_use_origin_rates": "Use origin tax rates",
131
+ "tax_use_origin_rates_explainer": "Check to use the tax rate of your country regardless of where customers are located.",
117
132
  "time": "{{value, time}}",
118
133
  "transaction": "Transaction",
119
134
  "transaction_approved": "Approved",
@@ -130,6 +145,7 @@
130
145
  "transaction_verified": "Verified",
131
146
  "transaction_voided": "Voided",
132
147
  "twice_a_month": "Twice a month",
148
+ "type": "Type",
133
149
  "type_any": "Field of unknown type",
134
150
  "type_attribute": "Key-value resource",
135
151
  "type_date": "Date field",
@@ -113,7 +113,22 @@
113
113
  "subscription_inactive": "Inactiva",
114
114
  "subscription_plural": "Suscripciones",
115
115
  "subscription_will_be_cancelled": "Finaliza el {{date, date}}",
116
+ "tax_apply_to_shipping": "Aplicar al envío",
117
+ "tax_apply_to_shipping_explainer": "Marque para aplicar este impuesto a los costos de envío",
118
+ "tax_country": "Impuesto del país",
119
+ "tax_exempt_all_customer_tax_ids": "Eximir a todos los clientes con número de identificación fiscal",
120
+ "tax_exempt_all_customer_tax_ids_explainer": "Marque para omitir la recaudación de impuestos para los clientes con identificación fiscal registrada",
121
+ "tax_global": "Impuesto global",
116
122
  "tax_id": "Número de identificación fiscal",
123
+ "tax_local": "Impuesto local",
124
+ "tax_rate": "Tarifa (%)",
125
+ "tax_rate_provider": "Proveedor de tarifas",
126
+ "tax_rate_provider_default": "Predeterminado (Thomson Reuters; otros)",
127
+ "tax_rate_provider_none": "Ninguno (tarifa personalizada)",
128
+ "tax_region": "Impuesto regional",
129
+ "tax_union": "Impuesto de la Unión Europea",
130
+ "tax_use_origin_rates": "Usar tasas impositivas de origen",
131
+ "tax_use_origin_rates_explainer": "Marque para usar la tasa impositiva de su país independientemente de dónde se encuentren los clientes",
117
132
  "time": "{{value, time}}",
118
133
  "transaction": "Transacción",
119
134
  "transaction_approved": "Aprobado",
@@ -130,6 +145,7 @@
130
145
  "transaction_verified": "Verificado",
131
146
  "transaction_voided": "Anulado",
132
147
  "twice_a_month": "Dos veces al mes",
148
+ "type": "Tipo",
133
149
  "type_any": "Campo de tipo desconocido",
134
150
  "type_attribute": "Recurso de valor-clave",
135
151
  "type_date": "Campo de fecha",
@@ -14,7 +14,11 @@ export class TwoLineCard extends Base {
14
14
  return html `
15
15
  <div data-testid="title">
16
16
  ${this.renderTemplateOrSlot('title:before')}
17
- <div class="text-secondary">${this.data ? content === null || content === void 0 ? void 0 : content(this.data) : ''}&ZeroWidthSpace;</div>
17
+
18
+ <div class="text-secondary truncate">
19
+ ${this.data ? content === null || content === void 0 ? void 0 : content(this.data) : ''}&ZeroWidthSpace;
20
+ </div>
21
+
18
22
  ${this.renderTemplateOrSlot('title:after')}
19
23
  </div>
20
24
  `;
@@ -23,7 +27,11 @@ export class TwoLineCard extends Base {
23
27
  return html `
24
28
  <div data-testid="subtitle">
25
29
  ${this.renderTemplateOrSlot('subtitle:before')}
26
- <div class="font-semibold">${this.data ? content === null || content === void 0 ? void 0 : content(this.data) : ''}&ZeroWidthSpace;</div>
30
+
31
+ <div class="font-semibold truncate">
32
+ ${this.data ? content === null || content === void 0 ? void 0 : content(this.data) : ''}&ZeroWidthSpace;
33
+ </div>
34
+
27
35
  ${this.renderTemplateOrSlot('subtitle:after')}
28
36
  </div>
29
37
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"TwoLineCard.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomFieldCard/TwoLineCard.ts"],"names":[],"mappings":"AAAA,OAAO,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AAC;IACJ,CAAC;IA4BD,MAAM,CAAC,OAA8B;;QACnC,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAE3C,OAAO,IAAI,CAAA;;;oBAGK,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC;;;UAGvC,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,CAAC;UAC/E,cAAc,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,CAAC;;;kBAGhF,QAAQ,CAAC;YACf,2DAA2D,EAAE,IAAI;YACjE,+BAA+B,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI;SAC7C,CAAC;;;;;oBAKQ,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;mBAC7E,IAAI,CAAC,IAAI;kBACV,IAAI,CAAC,EAAE,IAAI,YAAA,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,0CAAE,SAAS,mCAAI,EAAE;;;;;KAK3E,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { ConfigurableMixin, Renderer } from '../../../mixins/configurable';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { HALJSONResource } from '../NucleonElement/types';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { PropertyDeclarations } from 'lit-element';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { classMap } from '../../../utils/class-map';\n\nexport type TemplateFn<TData extends HALJSONResource> = (data: TData) => TemplateResult;\n\nexport type Templates<TData extends HALJSONResource> = {\n 'title:before'?: Renderer<TData>;\n 'title:after'?: Renderer<TData>;\n 'subtitle:before'?: Renderer<TData>;\n 'subtitle:after'?: Renderer<TData>;\n};\n\nexport type RenderOptions<TData extends HALJSONResource> = {\n title: TemplateFn<TData>;\n subtitle: TemplateFn<TData>;\n};\n\nconst Base = ConfigurableMixin(ThemeableMixin(NucleonElement));\n\nexport class TwoLineCard<TData extends HALJSONResource> extends Base<TData> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n lang: { type: String },\n ns: { type: String },\n };\n }\n\n templates: Templates<TData> = {};\n\n lang = '';\n\n ns = '';\n\n private readonly __renderTitle = (content?: TemplateFn<TData>) => {\n return html`\n <div data-testid=\"title\">\n ${this.renderTemplateOrSlot('title:before')}\n <div class=\"text-secondary\">${this.data ? content?.(this.data) : ''}&ZeroWidthSpace;</div>\n ${this.renderTemplateOrSlot('title:after')}\n </div>\n `;\n };\n\n private readonly __renderSubtitle = (content?: TemplateFn<TData>) => {\n return html`\n <div data-testid=\"subtitle\">\n ${this.renderTemplateOrSlot('subtitle:before')}\n <div class=\"font-semibold\">${this.data ? content?.(this.data) : ''}&ZeroWidthSpace;</div>\n ${this.renderTemplateOrSlot('subtitle:after')}\n </div>\n `;\n };\n\n render(options?: RenderOptions<TData>): TemplateResult {\n const hiddenSelector = this.hiddenSelector;\n\n return html`\n <div\n aria-live=\"polite\"\n aria-busy=${!this.data && this.in('busy')}\n class=\"relative text-body text-m font-lumo leading-m\"\n >\n ${hiddenSelector.matches('title', true) ? '' : this.__renderTitle(options?.title)}\n ${hiddenSelector.matches('subtitle', true) ? '' : this.__renderSubtitle(options?.subtitle)}\n\n <div\n class=${classMap({\n 'transition duration-250 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !!this.data,\n })}\n >\n <foxy-spinner\n data-testid=\"spinner\"\n class=\"m-auto\"\n state=${this.in('fail') ? 'error' : this.in({ idle: 'template' }) ? 'empty' : 'busy'}\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"]}
1
+ {"version":3,"file":"TwoLineCard.js","sourceRoot":"","sources":["../../../../src/elements/public/CustomFieldCard/TwoLineCard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAY,wCAAqC;AAC3E,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhD,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAElE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAgBpD,MAAM,IAAI,GAAG,iBAAiB,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,CAAC;AAE/D,MAAM,OAAO,WAA2C,SAAQ,IAAW;IAA3E;;QASE,cAAS,GAAqB,EAAE,CAAC;QAEjC,SAAI,GAAG,EAAE,CAAC;QAEV,OAAE,GAAG,EAAE,CAAC;QAES,kBAAa,GAAG,CAAC,OAA2B,EAAE,EAAE;YAC/D,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC;;;YAGvC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE;;;UAGvC,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC;;KAE7C,CAAC;QACJ,CAAC,CAAC;QAEe,qBAAgB,GAAG,CAAC,OAA2B,EAAE,EAAE;YAClE,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;;;YAG1C,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,IAAI,CAAC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,CAAC,cAAc,CAAC,0CAAE,SAAS,mCAAI,EAAE;;;;;KAK3E,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { ConfigurableMixin, Renderer } from '../../../mixins/configurable';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { HALJSONResource } from '../NucleonElement/types';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { PropertyDeclarations } from 'lit-element';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { classMap } from '../../../utils/class-map';\n\nexport type TemplateFn<TData extends HALJSONResource> = (data: TData) => TemplateResult;\n\nexport type Templates<TData extends HALJSONResource> = {\n 'title:before'?: Renderer<TData>;\n 'title:after'?: Renderer<TData>;\n 'subtitle:before'?: Renderer<TData>;\n 'subtitle:after'?: Renderer<TData>;\n};\n\nexport type RenderOptions<TData extends HALJSONResource> = {\n title: TemplateFn<TData>;\n subtitle: TemplateFn<TData>;\n};\n\nconst Base = ConfigurableMixin(ThemeableMixin(NucleonElement));\n\nexport class TwoLineCard<TData extends HALJSONResource> extends Base<TData> {\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n lang: { type: String },\n ns: { type: String },\n };\n }\n\n templates: Templates<TData> = {};\n\n lang = '';\n\n ns = '';\n\n private readonly __renderTitle = (content?: TemplateFn<TData>) => {\n return html`\n <div data-testid=\"title\">\n ${this.renderTemplateOrSlot('title:before')}\n\n <div class=\"text-secondary truncate\">\n ${this.data ? content?.(this.data) : ''}&ZeroWidthSpace;\n </div>\n\n ${this.renderTemplateOrSlot('title:after')}\n </div>\n `;\n };\n\n private readonly __renderSubtitle = (content?: TemplateFn<TData>) => {\n return html`\n <div data-testid=\"subtitle\">\n ${this.renderTemplateOrSlot('subtitle:before')}\n\n <div class=\"font-semibold truncate\">\n ${this.data ? content?.(this.data) : ''}&ZeroWidthSpace;\n </div>\n\n ${this.renderTemplateOrSlot('subtitle:after')}\n </div>\n `;\n };\n\n render(options?: RenderOptions<TData>): TemplateResult {\n const hiddenSelector = this.hiddenSelector;\n\n return html`\n <div\n aria-live=\"polite\"\n aria-busy=${!this.data && this.in('busy')}\n class=\"relative text-body text-m font-lumo leading-m\"\n >\n ${hiddenSelector.matches('title', true) ? '' : this.__renderTitle(options?.title)}\n ${hiddenSelector.matches('subtitle', true) ? '' : this.__renderSubtitle(options?.subtitle)}\n\n <div\n class=${classMap({\n 'transition duration-250 ease-in-out absolute inset-0 flex': true,\n 'opacity-0 pointer-events-none': !!this.data,\n })}\n >\n <foxy-spinner\n data-testid=\"spinner\"\n class=\"m-auto\"\n state=${this.in('fail') ? 'error' : this.in({ idle: 'template' }) ? 'empty' : 'busy'}\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"]}
@@ -0,0 +1,24 @@
1
+ import { TemplateResult } from 'lit-html';
2
+ import { Data } from './types';
3
+ import { TwoLineCard } from '../CustomFieldCard/TwoLineCard';
4
+ declare const TaxCard_base: typeof TwoLineCard & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
5
+ defaultNS: string;
6
+ };
7
+ /**
8
+ * Basic card displaying an applied tax.
9
+ *
10
+ * @slot title:before
11
+ * @slot title:after
12
+ *
13
+ * @slot subtitle:before
14
+ * @slot subtitle:after
15
+ *
16
+ * @element foxy-tax-card
17
+ * @since 1.13.0
18
+ */
19
+ export declare class TaxCard extends TaxCard_base<Data> {
20
+ render(): TemplateResult;
21
+ private get __typeLabel();
22
+ private get __rateLabel();
23
+ }
24
+ export {};
@@ -0,0 +1,52 @@
1
+ import { html } from 'lit-html';
2
+ import { TranslatableMixin } from "../../../mixins/translatable.js";
3
+ import { TwoLineCard } from "../CustomFieldCard/TwoLineCard.js";
4
+ /**
5
+ * Basic card displaying an applied tax.
6
+ *
7
+ * @slot title:before
8
+ * @slot title:after
9
+ *
10
+ * @slot subtitle:before
11
+ * @slot subtitle:after
12
+ *
13
+ * @element foxy-tax-card
14
+ * @since 1.13.0
15
+ */
16
+ export class TaxCard extends TranslatableMixin(TwoLineCard, 'tax-card') {
17
+ render() {
18
+ return super.render({
19
+ title: ({ name }) => html `${name}`,
20
+ subtitle: () => html `${this.__typeLabel} &bull; ${this.__rateLabel}`,
21
+ });
22
+ }
23
+ get __typeLabel() {
24
+ var _a;
25
+ const { type, country, region, city } = (_a = this.data) !== null && _a !== void 0 ? _a : {};
26
+ if (type === 'global')
27
+ return this.t('tax_global');
28
+ if (type === 'union')
29
+ return this.t('tax_union');
30
+ if (type === 'country')
31
+ return country;
32
+ if (type === 'region')
33
+ return `${country}, ${region}`;
34
+ if (type === 'local')
35
+ return `${country}, ${region}, ${city}`;
36
+ }
37
+ get __rateLabel() {
38
+ var _a, _b;
39
+ if (((_a = this.data) === null || _a === void 0 ? void 0 : _a.is_live) === false) {
40
+ return this.t('percent', { fraction: this.data.rate / 100 });
41
+ }
42
+ const provider = (_b = this.data) === null || _b === void 0 ? void 0 : _b.service_provider;
43
+ if (provider === 'onesource')
44
+ return 'Thomson Reuters ONESOURCE';
45
+ if (provider === 'avalara')
46
+ return 'Avalara AvaTax 15';
47
+ if (provider === 'taxjar')
48
+ return 'TaxJar';
49
+ return this.t('tax_rate_provider_default');
50
+ }
51
+ }
52
+ //# sourceMappingURL=TaxCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaxCard.js","sourceRoot":"","sources":["../../../../src/elements/public/TaxCard/TaxCard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,WAAW,EAAE,0CAAuC;AAE7D;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,OAAQ,SAAQ,iBAAiB,CAAC,WAAW,EAAE,UAAU,CAAO;IAC3E,MAAM;QACJ,OAAO,KAAK,CAAC,MAAM,CAAC;YAClB,KAAK,EAAE,CAAC,EAAE,IAAI,EAA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CAAC;IAC7C,CAAC;CACF","sourcesContent":["import { TemplateResult, html } from 'lit-html';\n\nimport { Data } from './types';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { TwoLineCard } from '../CustomFieldCard/TwoLineCard';\n\n/**\n * Basic card displaying an applied tax.\n *\n * @slot title:before\n * @slot title:after\n *\n * @slot subtitle:before\n * @slot subtitle:after\n *\n * @element foxy-tax-card\n * @since 1.13.0\n */\nexport class TaxCard extends TranslatableMixin(TwoLineCard, 'tax-card')<Data> {\n render(): TemplateResult {\n return super.render({\n title: ({ name }) => html`${name}`,\n subtitle: () => html`${this.__typeLabel} &bull; ${this.__rateLabel}`,\n });\n }\n\n private get __typeLabel() {\n const { type, country, region, city } = this.data ?? {};\n\n if (type === 'global') return this.t('tax_global');\n if (type === 'union') return this.t('tax_union');\n if (type === 'country') return country;\n if (type === 'region') return `${country}, ${region}`;\n if (type === 'local') return `${country}, ${region}, ${city}`;\n }\n\n private get __rateLabel() {\n if (this.data?.is_live === false) {\n return this.t('percent', { fraction: this.data.rate / 100 });\n }\n\n const provider = this.data?.service_provider as string | undefined;\n\n if (provider === 'onesource') return 'Thomson Reuters ONESOURCE';\n if (provider === 'avalara') return 'Avalara AvaTax 15';\n if (provider === 'taxjar') return 'TaxJar';\n\n return this.t('tax_rate_provider_default');\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import '../../internal/InternalSandbox/index';
2
+ import '../Spinner/index';
3
+ import '../I18n/index';
4
+ import { TaxCard } from './TaxCard';
5
+ export { TaxCard };
@@ -0,0 +1,7 @@
1
+ import "../../internal/InternalSandbox/index.js";
2
+ import "../Spinner/index.js";
3
+ import "../I18n/index.js";
4
+ import { TaxCard } from "./TaxCard.js";
5
+ customElements.define('foxy-tax-card', TaxCard);
6
+ export { TaxCard };
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/elements/public/TaxCard/index.ts"],"names":[],"mappings":"AAAA,iDAA8C;AAC9C,6BAA0B;AAC1B,0BAAuB;AAEvB,OAAO,EAAE,OAAO,EAAE,qBAAkB;AAEpC,cAAc,CAAC,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["import '../../internal/InternalSandbox/index';\nimport '../Spinner/index';\nimport '../I18n/index';\n\nimport { TaxCard } from './TaxCard';\n\ncustomElements.define('foxy-tax-card', TaxCard);\n\nexport { TaxCard };\n"]}
@@ -0,0 +1,3 @@
1
+ import { Rels } from '@foxy.io/sdk/backend';
2
+ import { Resource } from '@foxy.io/sdk/core';
3
+ export declare type Data = Resource<Rels.Tax>;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/TaxCard/types.ts"],"names":[],"mappings":"","sourcesContent":["import { Rels } from '@foxy.io/sdk/backend';\nimport { Resource } from '@foxy.io/sdk/core';\n\nexport type Data = Resource<Rels.Tax>;\n"]}
@@ -0,0 +1,102 @@
1
+ import { Data, Templates } from './types';
2
+ import { ScopedElementsMap } from '@open-wc/scoped-elements';
3
+ import { TemplateResult } from 'lit-html';
4
+ import { NucleonElement } from '../NucleonElement/NucleonElement';
5
+ import { NucleonV8N } from '../NucleonElement/types';
6
+ import { PropertyDeclarations } from 'lit-element';
7
+ declare const Base: typeof NucleonElement & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
8
+ defaultNS: string;
9
+ } & import("@open-wc/dedupe-mixin").Constructor<import("@open-wc/scoped-elements/src/types").ScopedElementsHost> & {
10
+ styles: import("lit-element").CSSResultArray;
11
+ } & import("lit-element").Constructor<import("../../../mixins/configurable").ConfigurableMixinHost>;
12
+ /**
13
+ * Form element for creating or editing taxes (`fx:tax`).
14
+ *
15
+ * @slot name:before
16
+ * @slot name:after
17
+ *
18
+ * @slot type:before
19
+ * @slot type:after
20
+ *
21
+ * @slot country:before
22
+ * @slot country:after
23
+ *
24
+ * @slot region:before
25
+ * @slot region:after
26
+ *
27
+ * @slot city:before
28
+ * @slot city:after
29
+ *
30
+ * @slot provider:before
31
+ * @slot provider:after
32
+ *
33
+ * @slot rate:before
34
+ * @slot rate:after
35
+ *
36
+ * @slot apply-to-shipping:before
37
+ * @slot apply-to-shipping:after
38
+ *
39
+ * @slot use-origin-rates:before
40
+ * @slot use-origin-rates:after
41
+ *
42
+ * @slot exempt-all-customer-tax-ids:before
43
+ * @slot exempt-all-customer-tax-ids:after
44
+ *
45
+ * @slot timestamps:before
46
+ * @slot timestamps:after
47
+ *
48
+ * @slot delete:before
49
+ * @slot delete:after
50
+ *
51
+ * @slot create:before
52
+ * @slot create:after
53
+ *
54
+ * @element foxy-tax-form
55
+ * @since 1.13.0
56
+ */
57
+ export declare class TaxForm extends Base<Data> {
58
+ static get scopedElements(): ScopedElementsMap;
59
+ static get properties(): PropertyDeclarations;
60
+ static get v8n(): NucleonV8N<Data>;
61
+ templates: Templates;
62
+ private static __providers;
63
+ private static __types;
64
+ private __countries;
65
+ private __regions;
66
+ private __countriesService;
67
+ private __regionsService;
68
+ get countries(): string;
69
+ set countries(value: string);
70
+ get regions(): string;
71
+ set regions(value: string);
72
+ connectedCallback(): void;
73
+ render(): TemplateResult;
74
+ disconnectedCallback(): void;
75
+ private get __isNameHidden();
76
+ private get __isTypeHidden();
77
+ private get __isCountryHidden();
78
+ private get __isRegionHidden();
79
+ private get __isCityHidden();
80
+ private get __isProviderHidden();
81
+ private get __isRateHidden();
82
+ private get __isApplyToShippingHidden();
83
+ private get __isUseOriginRatesHidden();
84
+ private get __isExemptAllCustomerTaxIdsHidden();
85
+ private get __isTimestampsHidden();
86
+ private get __isCreateHidden();
87
+ private get __isDeleteHidden();
88
+ private __renderName;
89
+ private __renderType;
90
+ private __renderCountry;
91
+ private __renderRegion;
92
+ private __renderCity;
93
+ private __renderProvider;
94
+ private __renderRate;
95
+ private __renderApplyToShipping;
96
+ private __renderUseOriginRates;
97
+ private __renderExemptAllCustomerTaxIds;
98
+ private __renderTimestamps;
99
+ private __renderCreate;
100
+ private __renderDelete;
101
+ }
102
+ export {};