@foxy.io/elements 1.14.0-beta.1 → 1.14.0-beta.5
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/README.md +1 -1
- package/dist/cdn/foxy-access-recovery-form.js +1 -1
- package/dist/cdn/foxy-address-card.js +1 -1
- package/dist/cdn/foxy-address-form.js +1 -1
- package/dist/cdn/foxy-applied-tax-card.js +1 -1
- package/dist/cdn/foxy-attribute-card.js +1 -1
- package/dist/cdn/foxy-attribute-form.js +1 -1
- package/dist/cdn/foxy-cancellation-form.js +1 -1
- package/dist/cdn/foxy-collection-page.js +1 -1
- package/dist/cdn/foxy-collection-pages.js +1 -1
- package/dist/cdn/foxy-custom-field-card.js +1 -1
- package/dist/cdn/foxy-custom-field-form.js +1 -1
- package/dist/cdn/foxy-customer-api.js +1 -1
- package/dist/cdn/foxy-customer-card.js +1 -1
- package/dist/cdn/foxy-customer-form.js +1 -1
- package/dist/cdn/foxy-customer-portal-settings.js +10 -10
- package/dist/cdn/foxy-customer-portal.js +2 -2
- package/dist/cdn/foxy-customer.js +1 -1
- package/dist/cdn/foxy-customers-table.js +1 -1
- package/dist/cdn/foxy-discount-card.js +1 -1
- package/dist/cdn/foxy-donation.js +1 -1
- package/dist/cdn/foxy-email-template-form.js +1 -0
- package/dist/cdn/foxy-error-entry-card.js +1 -1
- package/dist/cdn/foxy-form-dialog.js +1 -1
- package/dist/cdn/foxy-i18n.js +1 -1
- package/dist/cdn/foxy-items-form.js +1 -1
- package/dist/cdn/foxy-nucleon-element.js +1 -1
- package/dist/cdn/foxy-payment-card.js +1 -1
- package/dist/cdn/foxy-payment-method-card.js +1 -1
- package/dist/cdn/foxy-query-builder.js +1 -1
- package/dist/cdn/foxy-sign-in-form.js +1 -1
- package/dist/cdn/foxy-spinner.js +2 -2
- package/dist/cdn/foxy-subscription-card.js +1 -1
- package/dist/cdn/foxy-subscription-form.js +26 -9
- package/dist/cdn/foxy-subscriptions-table.js +1 -1
- package/dist/cdn/foxy-table.js +1 -1
- package/dist/cdn/foxy-tax-card.js +1 -1
- package/dist/cdn/foxy-tax-form.js +1 -1
- package/dist/cdn/foxy-template-config-form.js +14 -0
- package/dist/cdn/foxy-template-form.js +1 -1
- package/dist/cdn/foxy-transaction-card.js +1 -1
- package/dist/cdn/foxy-transactions-table.js +1 -1
- package/dist/cdn/foxy-user-form.js +1 -1
- package/dist/cdn/foxy-users-table.js +1 -1
- package/dist/cdn/{shared-d4dad105.js → shared-00563cb0.js} +1 -1
- package/dist/cdn/shared-0ced76a0.js +358 -0
- package/dist/cdn/{shared-151ca103.js → shared-10bdb6b9.js} +1 -1
- package/dist/cdn/{shared-99f45065.js → shared-1469c1c4.js} +1 -1
- package/dist/cdn/shared-166c44ae.js +264 -0
- package/dist/cdn/{shared-f4119f12.js → shared-16f72e27.js} +1 -1
- package/dist/cdn/shared-1761daef.js +15 -0
- package/dist/cdn/{shared-e057788f.js → shared-1b7e65e4.js} +1 -1
- package/dist/cdn/{shared-5fedf5e4.js → shared-200f613b.js} +2 -2
- package/dist/cdn/{shared-6783c996.js → shared-2174bcd4.js} +1 -1
- package/dist/cdn/{shared-4059f633.js → shared-218ba06e.js} +1 -1
- package/dist/cdn/{shared-e9920617.js → shared-34b2c1e2.js} +1 -1
- package/dist/cdn/shared-396320f9.js +314 -0
- package/dist/cdn/{shared-566252ac.js → shared-3d868b17.js} +1 -1
- package/dist/cdn/{shared-cf248335.js → shared-44cfc617.js} +1 -1
- package/dist/cdn/{shared-45d647e4.js → shared-46ee137f.js} +1 -1
- package/dist/cdn/shared-4a52d9b5.js +1 -0
- package/dist/cdn/{shared-f0199313.js → shared-593f7e2c.js} +1 -1
- package/dist/cdn/shared-59e44f29.js +1 -0
- package/dist/cdn/{shared-cd700eac.js → shared-60126eee.js} +1 -1
- package/dist/cdn/{shared-dbbe03f9.js → shared-614e1a4e.js} +1 -1
- package/dist/cdn/{shared-17968c53.js → shared-63eaded9.js} +3 -3
- package/dist/cdn/shared-6b7602c7.js +1 -0
- package/dist/cdn/{shared-98ee7fad.js → shared-6d45a07b.js} +1 -1
- package/dist/cdn/shared-75ce6e43.js +1 -0
- package/dist/cdn/shared-782bf922.js +1 -0
- package/dist/cdn/{shared-5d286626.js → shared-7a39a41f.js} +1 -1
- package/dist/cdn/{shared-35415106.js → shared-87190eae.js} +1 -1
- package/dist/cdn/{shared-84fa75d9.js → shared-9221e6b2.js} +1 -1
- package/dist/cdn/{shared-2860a3d3.js → shared-94b0ae99.js} +2 -2
- package/dist/cdn/shared-9d779f46.js +1 -0
- package/dist/cdn/shared-a46edf4b.js +1 -0
- package/dist/cdn/{shared-54702b33.js → shared-b0f0e8b5.js} +1 -1
- package/dist/cdn/{shared-ed4ed7a5.js → shared-b710881a.js} +2 -2
- package/dist/cdn/{shared-3ae39e52.js → shared-bb824ab4.js} +3 -3
- package/dist/cdn/shared-d94ffc2b.js +1 -0
- package/dist/cdn/shared-df573cea.js +12 -0
- package/dist/cdn/{shared-e5de8675.js → shared-e7f8ffe9.js} +1 -1
- package/dist/cdn/{shared-54c485d2.js → shared-ec861f31.js} +21 -21
- package/dist/cdn/{shared-e0248713.js → shared-f0a83bd6.js} +1 -1
- package/dist/cdn/{shared-f2a4fd27.js → shared-fb90e05c.js} +1 -1
- package/dist/cdn/{shared-747b0842.js → shared-ff79f3f9.js} +1 -1
- package/dist/cdn/translations/shared/en.json +56 -3
- package/dist/elements/private/Choice/Choice.js +3 -3
- package/dist/elements/private/Choice/Choice.js.map +1 -1
- package/dist/elements/private/Group/Group.js +1 -1
- package/dist/elements/private/Group/Group.js.map +1 -1
- package/dist/elements/private/I18N/I18N.js +1 -1
- package/dist/elements/private/I18N/I18N.js.map +1 -1
- package/dist/elements/public/AddressForm/AddressForm.js +8 -4
- package/dist/elements/public/AddressForm/AddressForm.js.map +1 -1
- package/dist/elements/public/AttributeForm/AttributeForm.js +8 -4
- package/dist/elements/public/AttributeForm/AttributeForm.js.map +1 -1
- package/dist/elements/public/CustomFieldForm/CustomFieldForm.js +8 -4
- package/dist/elements/public/CustomFieldForm/CustomFieldForm.js.map +1 -1
- package/dist/elements/public/CustomerForm/CustomerForm.js +8 -4
- package/dist/elements/public/CustomerForm/CustomerForm.js.map +1 -1
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.d.ts +24 -0
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js +311 -0
- package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js.map +1 -0
- package/dist/elements/public/EmailTemplateForm/index.d.ts +9 -0
- package/dist/elements/public/EmailTemplateForm/index.js +11 -0
- package/dist/elements/public/EmailTemplateForm/index.js.map +1 -0
- package/dist/elements/public/EmailTemplateForm/types.d.ts +3 -0
- package/dist/elements/public/EmailTemplateForm/types.js +2 -0
- package/dist/elements/public/EmailTemplateForm/types.js.map +1 -0
- package/dist/elements/public/ItemsForm/ItemsForm.js +2 -2
- package/dist/elements/public/ItemsForm/ItemsForm.js.map +1 -1
- package/dist/elements/public/NucleonElement/serveFromCache.js +1 -0
- package/dist/elements/public/NucleonElement/serveFromCache.js.map +1 -1
- package/dist/elements/public/TaxForm/TaxForm.js +8 -4
- package/dist/elements/public/TaxForm/TaxForm.js.map +1 -1
- package/dist/elements/public/TemplateConfigForm/CountriesList.d.ts +23 -0
- package/dist/elements/public/TemplateConfigForm/CountriesList.js +129 -0
- package/dist/elements/public/TemplateConfigForm/CountriesList.js.map +1 -0
- package/dist/elements/public/TemplateConfigForm/CountryCard.d.ts +20 -0
- package/dist/elements/public/TemplateConfigForm/CountryCard.js +125 -0
- package/dist/elements/public/TemplateConfigForm/CountryCard.js.map +1 -0
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.d.ts +29 -0
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js +700 -0
- package/dist/elements/public/TemplateConfigForm/TemplateConfigForm.js.map +1 -0
- package/dist/elements/public/TemplateConfigForm/defaults.d.ts +2 -0
- package/dist/elements/public/TemplateConfigForm/defaults.js +95 -0
- package/dist/elements/public/TemplateConfigForm/defaults.js.map +1 -0
- package/dist/elements/public/TemplateConfigForm/index.d.ts +9 -0
- package/dist/elements/public/TemplateConfigForm/index.js +11 -0
- package/dist/elements/public/TemplateConfigForm/index.js.map +1 -0
- package/dist/elements/public/TemplateConfigForm/types.d.ts +116 -0
- package/dist/elements/public/TemplateConfigForm/types.js +2 -0
- package/dist/elements/public/TemplateConfigForm/types.js.map +1 -0
- package/dist/elements/public/TemplateForm/TemplateForm.js +10 -6
- package/dist/elements/public/TemplateForm/TemplateForm.js.map +1 -1
- package/dist/elements/public/index.d.ts +2 -0
- package/dist/elements/public/index.defined.d.ts +2 -0
- package/dist/elements/public/index.defined.js +2 -0
- package/dist/elements/public/index.defined.js.map +1 -1
- package/dist/elements/public/index.js +2 -0
- package/dist/elements/public/index.js.map +1 -1
- package/dist/mixins/themeable.js +86 -12
- package/dist/mixins/themeable.js.map +1 -1
- package/package.json +2 -7
- package/dist/cdn/shared-35502e88.js +0 -1
- package/dist/cdn/shared-50744508.js +0 -15
- package/dist/cdn/shared-5388f705.js +0 -1
- package/dist/cdn/shared-7f588649.js +0 -1
- package/dist/cdn/shared-9467cb31.js +0 -572
- package/dist/cdn/shared-b98f88c9.js +0 -369
- package/dist/cdn/shared-c0161e6a.js +0 -1
- package/dist/cdn/shared-dbcffd8e.js +0 -1
- package/dist/cdn/shared-e21a2aac.js +0 -1
- package/dist/cdn/shared-ebbef842.js +0 -1
- package/dist/cdn/shared-fd5b81be.js +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{P as e,h as t}from"./shared-
|
|
1
|
+
import{P as e,h as t}from"./shared-ff79f3f9.js";import{E as s,T as i}from"./shared-df573cea.js";import"./shared-46ee137f.js";import"./shared-f0a83bd6.js";import{r as n,S as a}from"./shared-396320f9.js";import{j as o,h as r,_ as l,w as d}from"./shared-63eaded9.js";import"./shared-ec861f31.js";import"./shared-0ced76a0.js";import"./shared-60126eee.js";import"./foxy-cancellation-form.js";import"./shared-9221e6b2.js";import"./foxy-collection-pages.js";import"./foxy-form-dialog.js";import{P as c}from"./shared-75ce6e43.js";import"./foxy-spinner.js";import"./foxy-table.js";import"./foxy-i18n.js";import{C as u}from"./shared-593f7e2c.js";import{S as h,T as m,a as f}from"./shared-d94ffc2b.js";import{C as p}from"./shared-166c44ae.js";import"./shared-4a52d9b5.js";import"./shared-bb824ab4.js";import{G as y}from"./shared-7a39a41f.js";import{c as b}from"./shared-4e709717.js";import{p as g}from"./shared-e7f8ffe9.js";import{j as _}from"./shared-59e44f29.js";import"./foxy-nucleon-element.js";import{T as v}from"./shared-1469c1c4.js";import{i as x}from"./shared-6d45a07b.js";import{p as $}from"./shared-6b7602c7.js";import{s as w}from"./shared-2061be9a.js";import{N as S}from"./shared-44cfc617.js";import"./shared-9d779f46.js";import"./shared-1761daef.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";import"./foxy-collection-page.js";import"./shared-b710881a.js";import"./shared-3d868b17.js";import"./shared-87190eae.js";import"./shared-2174bcd4.js";n("vcf-tooltip",o`
|
|
2
2
|
:host {
|
|
3
3
|
/* Sizing */
|
|
4
4
|
--lumo-tooltip-size: var(--lumo-size-m);
|
|
5
5
|
/* Style */
|
|
6
6
|
font-family: var(--lumo-font-family);
|
|
7
|
-
font-size: var(--lumo-font-size-
|
|
8
|
-
|
|
7
|
+
font-size: var(--lumo-font-size-s, 0.875rem);
|
|
8
|
+
line-height: var(--lumo-line-height-s, 1.375);
|
|
9
9
|
cursor: default;
|
|
10
10
|
-webkit-tap-highlight-color: transparent;
|
|
11
11
|
-webkit-font-smoothing: antialiased;
|
|
@@ -24,8 +24,16 @@ import{P as e,h as t}from"./shared-747b0842.js";import{E as s,T as i}from"./shar
|
|
|
24
24
|
-ms-user-select: none;
|
|
25
25
|
-webkit-user-select: none;
|
|
26
26
|
user-select: none;
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
|
|
28
|
+
--tooltip-animation-duration: 250ms;
|
|
29
|
+
--tooltip-delay: 500ms;
|
|
30
|
+
animation: tooltipFadeIn var(--tooltip-animation-duration);
|
|
31
|
+
animation-delay: var(--tooltip-delay);
|
|
32
|
+
animation-fill-mode: both;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host([manual]) {
|
|
36
|
+
--tooltip-delay: 0;
|
|
29
37
|
}
|
|
30
38
|
|
|
31
39
|
:host([close-button]) [part='close-button'] {
|
|
@@ -55,7 +63,7 @@ import{P as e,h as t}from"./shared-747b0842.js";import{E as s,T as i}from"./shar
|
|
|
55
63
|
color: var(--lumo-body-text-color);
|
|
56
64
|
background-color: var(--lumo-base-color);
|
|
57
65
|
border-radius: var(--lumo-border-radius);
|
|
58
|
-
|
|
66
|
+
box-shadow: var(--lumo-box-shadow-xs);
|
|
59
67
|
}
|
|
60
68
|
|
|
61
69
|
:host([hidden]) [part='content'] {
|
|
@@ -65,6 +73,15 @@ import{P as e,h as t}from"./shared-747b0842.js";import{E as s,T as i}from"./shar
|
|
|
65
73
|
:host ::slotted(*) {
|
|
66
74
|
box-sizing: border-box;
|
|
67
75
|
}
|
|
76
|
+
|
|
77
|
+
@keyframes tooltipFadeIn {
|
|
78
|
+
0% {
|
|
79
|
+
opacity: 0;
|
|
80
|
+
}
|
|
81
|
+
100% {
|
|
82
|
+
opacity: 1;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
68
85
|
</style>
|
|
69
86
|
|
|
70
87
|
<div part="container" theme$="[[theme]]">
|
|
@@ -75,10 +92,10 @@ import{P as e,h as t}from"./shared-747b0842.js";import{E as s,T as i}from"./shar
|
|
|
75
92
|
<iron-icon icon="lumo:cross"></iron-icon>
|
|
76
93
|
</vaadin-button>
|
|
77
94
|
</div>
|
|
78
|
-
`}static get is(){return"vcf-tooltip"}static get version(){return"1.3.14"}static get properties(){return{for:{type:String},position:{type:String,value:"top"},align:{type:String,value:"center"},hidden:{type:Boolean,value:!0,notify:!0,reflectToAttribute:!0,observer:"_hiddenChanged"},manual:{type:Boolean,value:!1,reflectToAttribute:!0},targetElement:{type:Object,observer:"_attachToTarget"},closeButton:{type:Boolean,value:!1,reflectToAttribute:!0},theme:{type:String,reflectToAttribute:!0}}}static get observers(){return["_setPosition(targetElement, hidden, position, align)","_updateTarget(for)","_manualObserver(manual)"]}constructor(){super(),this._boundShow=this.show.bind(this),this._boundHide=this.hide.bind(this),this._boundOnKeyup=this._onKeyup.bind(this)}connectedCallback(){super.connectedCallback(),this._attachToTarget(),this._setDefaultId()}ready(){super.ready(),window.addEventListener("resize",(()=>{clearTimeout(this._resizeTimeout),this._resizeTimeout=setTimeout((()=>{const{targetElement:e,hidden:t,position:s}=this;this.hidden||this._setPosition(e,t,s)}),100)})),this.getAttribute("theme")||this.setAttribute("theme","dark")}disconnectedCallback(){super.disconnectedCallback(),this._detachFromTarget()}_manualObserver(){this.manual?this._removeEvents():this._addEvents()}_attachToTarget(e,t){t&&(this._removeTargetEvents(t),t.describedby&&(t.removeAttribute("aria-describedby"),delete t.describedby)),e&&(this._addEvents(),e.getAttribute("aria-describedby")||(e.setAttribute("aria-describedby",this.id),e.describedby=!0))}_addEvents(){this.targetElement&&!this.manual&&(this.targetElement.addEventListener("mouseenter",this._boundShow),this.targetElement.addEventListener("focus",this._boundShow),this.targetElement.addEventListener("mouseleave",this._boundHide),this.targetElement.addEventListener("blur",this._boundHide),this.targetElement.addEventListener("tap",this._boundHide)),this.manual||(this.addEventListener("mouseenter",this._boundShow),this.addEventListener("mouseleave",this._boundHide))}_detachFromTarget(){this.manual||this._removeEvents(),this.targetElement&&this.targetElement.describedby&&(this.targetElement.removeAttribute("aria-describedby"),delete this.targetElement.describedby)}_removeEvents(){this.targetElement&&this._removeTargetEvents(this.targetElement),this.removeEventListener("mouseenter",this._boundShow),this.removeEventListener("mouseleave",this._boundHide)}_removeTargetEvents(e){e.removeEventListener("mouseenter",this._boundShow),e.removeEventListener("focus",this._boundShow),e.removeEventListener("mouseleave",this._boundHide),e.removeEventListener("blur",this._boundHide),e.removeEventListener("tap",this._boundHide)}_updateTarget(){this.targetElement=this.parentNode.querySelector(`#${this.for}`)}_setPosition(e,t,s){if(e&&!t){let e=window.innerHeight,t=window.innerWidth;this.offsetParent&&(e=this.offsetParent.scrollHeight,t=this.offsetParent.scrollWidth);const i=this.targetElement.getBoundingClientRect(),n=this.getBoundingClientRect(),a=(i.width-n.width)/2,o=(i.height-n.height)/2;let r,l,d=i.left,c=i.top,u=window.pageYOffset;switch(this._parentPostioned&&(c=this.targetElement.offsetTop,d=this.targetElement.offsetLeft,u=0),s){case"top":l=c-n.height+u,r=this._calculateLeft(d,i,n,a);break;case"bottom":l=c+i.height+u,r=this._calculateLeft(d,i,n,a);break;case"left":r=d-n.width,l=this._calculateTop(c,i,n,o,u);break;case"right":r=d+i.width,l=this._calculateTop(c,i,n,o,u)}this._setPositionInVisibleBounds(e,t,r,l,n)}}get _parentPostioned(){return"static"!==window.getComputedStyle(this.offsetParent).position}_setPositionInVisibleBounds(e,t,s,i,n){s+n.width>t?(this.style.right="0px",this.style.left="auto"):(this.style.left=Math.max(0,s)+"px",this.style.right="auto"),i+n.height>e?(this.style.bottom=e+"px",this.style.top="auto"):(this.style.top=Math.max(0,i)+"px",this.style.bottom="auto")}_calculateLeft(e,t,s,i){switch(this.align){case"left":return e;case"right":return t.left+t.width-s.width;default:return e+i}}_calculateTop(e,t,s,i,n){switch(this.align){case"top":return e+n;case"bottom":return e+t.height-s.height+n;default:return e+i+n}}show(){this.hidden=!1}hide(){this.hidden=!0}_hiddenChanged(e){e?(this.setAttribute("aria-hidden",!0),window.removeEventListener("keyup",this._boundOnKeyup)):(this.setAttribute("aria-hidden",!1),window.addEventListener("keyup",this._boundOnKeyup))}_onKeyup(e){27===e.keyCode&&this.hide()}_setDefaultId(){this.id||(Vaadin.tooltipIndex||(Vaadin.tooltipIndex=0),this.id="vcf-tooltip"+ ++Vaadin.tooltipIndex)}}function T(e){return function*(e){const t=[];for(const s of e.settings.subscriptions.allowFrequencyModification)if(_(s.jsonataQuery).evaluate(e.subscription))for(const e of s.values)!t.includes(e)&&(t.push(e),yield e)}({settings:{subscriptions:{allowFrequencyModification:e.settings.subscriptions.allow_frequency_modification.map((e=>({jsonataQuery:e.jsonata_query,values:e.values})))}},subscription:e.subscription})}customElements.define(E.is,E),window.Vaadin.VcfTooltip=E;class j extends Error{constructor(e){super(`Invalid frequency "${e}".`)}}function q(e){const t=864e5,s=31*t;if(".5m"===e)return s/2;const i=parseInt(e.substring(0,e.length-1));if(isNaN(i))throw new j(e);if(e.endsWith("y"))return 31536e6*i;if(e.endsWith("m"))return i*s;if(e.endsWith("w"))return 6048e5*i;if(e.endsWith("d"))return i*t;throw new j(e)}function D(e,t){if("boolean"==typeof t)return t;const s=t.filter((t=>Boolean(_(t.jsonataQuery).evaluate(e)))).reduce(((e,t)=>{var s,i,n,a,o;if(t.min){const s=e.min?q(e.min):1/0;q(t.min)<s&&(e.min=t.min)}if(t.max){const s=e.max?q(e.max):-1/0;q(t.max)>s&&(e.max=t.max)}if("day"===(null===(s=t.allowedDays)||void 0===s?void 0:s.type)){const s=[...null!==(i=e.allowedDaysOfWeek)&&void 0!==i?i:[],...t.allowedDays.days];e.allowedDaysOfWeek=Array.from(new Set(s))}if("month"===(null===(n=t.allowedDays)||void 0===n?void 0:n.type)){const s=[...null!==(a=e.allowedDaysOfMonth)&&void 0!==a?a:[],...t.allowedDays.days];e.allowedDaysOfMonth=Array.from(new Set(s))}if(t.disallowedDates){const s=[...null!==(o=e.disallowedDates)&&void 0!==o?o:[],...t.disallowedDates];e.disallowedDates=Array.from(new Set(s))}return e}),{});return 0!==Object.keys(s).length&&s}function k(e){const[t,s,i]=e.split("-").map((e=>parseInt(e)));return new Date(t,s-1,i)}function O(e){const t=e.settings.subscriptions.allow_next_date_modification;let s;return s="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),function(e){var t,s;const i=k(e.value),n=i.getTime(),a=D(e.subscription,e.settings.subscriptions.allowNextDateModification);if("boolean"==typeof a)return a;if(!1===(null===(t=a.allowedDaysOfMonth)||void 0===t?void 0:t.includes(i.getDate())))return!1;if(!1===(null===(s=a.allowedDaysOfWeek)||void 0===s?void 0:s.includes(i.getDay())))return!1;if(a.disallowedDates&&a.disallowedDates.find((e=>{const[t,s]=e.split("..").map((e=>k(e).getTime()));return n===t||void 0!==s&&n>=t&&n<=s})))return!1;if(a.min){const e=g(a.min);if(null!==e&&Date.now()+e>=n)return!1}if(a.max){const e=g(a.max);if(null!==e&&Date.now()+e<=n)return!1}return!0}({settings:{subscriptions:{allowNextDateModification:s}},subscription:e.subscription,value:e.value})}const A=["html"];let L,z,C,I,N,H,P,F,V,B,M,W,K,Q,R,J,G,Y,U,X,Z,ee=e=>e;const te=m(f(h(p(S,"subscription-form"))));class se extends te{constructor(){super(...arguments),this.settings=null,this.templates={},this.__renderHeaderSubtitle=()=>{var e;const{data:t,lang:s,ns:i}=this;if(t){let n,a,o="text-secondary";if(t.first_failed_transaction_date)o="text-error",n=t.first_failed_transaction_date,a="subscription_failed";else if(t.end_date){n=t.end_date;a=new Date(n).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}else n=null!==(e=t.next_transaction_date)&&void 0!==e?e:(new Date).toISOString(),a="subscription_"+(t.is_active?"active":"inactive");const r=l(L||(L=ee` <foxy-i18n data-testid="header-subtitle" options="${0}" class="${0}" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify({date:n}),o,s,a,i);return t.first_failed_transaction_date?l(z||(z=ee` <span id="status" class="flex items-center space-x-xs ${0}"> ${0}<iron-icon icon="icons:info-outline" class="icon-inline"></iron-icon> </span> <vcf-tooltip for="status" position="bottom"> <span class="text-s">${0}</span> </vcf-tooltip> `),o,r,t.error_message):r}return l(C||(C=ee`<x-skeleton class="w-full" variant="static"> </x-skeleton>`))},this.__renderHeaderTitle=()=>{const{data:e,lang:t,ns:s}=this;if(e){const i=$(e.frequency),n=e._embedded["fx:last_transaction"].currency_code,a=e._embedded["fx:last_transaction"].total_order;return l(I||(I=ee` <foxy-i18n data-testid="header-title" options="${0}" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify(d(d({},i),{},{amount:`${a} ${n}`})),t,".5m"===e.frequency?"twice_a_month":"recurring",s)}return l(N||(N=ee`<x-skeleton class="w-full" variant="static"> </x-skeleton>`))},this.__renderHeader=()=>l(H||(H=ee` <div data-testid="header"> ${0} <div class="leading-xs text-xxl font-bold">${0}</div> <div class="leading-xs text-l">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("header:before"),this.__renderHeaderTitle(),this.__renderHeaderSubtitle(),this.renderTemplateOrSlot("header:after")),this.__renderItemsActions=()=>l(P||(P=ee` <div class="flex" data-testid="items:actions"> ${0} <foxy-i18n data-testid="items:actions-label" class="flex-1" lang="${0}" key="item_plural" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("items:actions:before"),this.lang,this.ns,this.renderTemplateOrSlot("items:actions:after")),this.__renderItemsItem=e=>{const t=e.price.toLocaleString(this.lang||"en",{style:"currency",currency:this.data._embedded["fx:last_transaction"].currency_code});let s;return s=e.quantity>1?l(F||(F=ee` <div data-testclass="item-quantity" class="px-s h-xs rounded bg-contrast-5 flex items-center font-tnum text-contrast text-s font-bold"> ${0} </div> `),e.quantity):l(V||(V=ee``)),l(B||(B=ee` <figure class="flex items-center space-x-m py-s pr-m" data-testclass="item"> <x-preview data-testclass="item-preview" class="w-l h-l" .quantity="${0}" .image="${0}"> </x-preview> <figcaption class="leading-s flex-1 flex justify-between items-center"> <div class="flex flex-col"> <span class="font-medium" data-testclass="item-name">${0}</span> <span class="text-secondary text-s" data-testclass="item-price">${0}</span> </div> ${0} </figcaption> </figure> `),e.quantity,e.image,e.name,t,s)},this.__renderItems=()=>{var e,t;const s=this.hiddenSelector,i=null!==(t=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:transaction_template"]._embedded["fx:items"])&&void 0!==t?t:[],n=s.matches("items:actions",!0)?"":this.__renderItemsActions();return l(M||(M=ee` <div data-testid="items"> ${0} <x-group frame> <div slot="header">${0}</div> <div class="divide-y divide-contrast-10 pl-s">${0}</div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("items:before"),n,i.map(this.__renderItemsItem),this.renderTemplateOrSlot("items:after"))},this.__renderEndDate=()=>{const{disabledSelector:e,lang:t,ns:s}=this,i=this.hiddenSelector.zoom("end-date:form").toString();return l(W||(W=ee` <div> ${0} <foxy-form-dialog readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="save-button ${0}" data-testid="cancellation-form" parent="${0}" header="end_subscription" alert form="foxy-cancellation-form" href="${0}" lang="${0}" id="end-date-form" ns="${0}" .templates="${0}"> </foxy-form-dialog> <vaadin-button data-testid="end-date" theme="error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n key="end_subscription" ns="${0}" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("end-date:before"),this.readonlySelector.zoom("end-date:form").toString(),e.zoom("end-date:form").toString(),i,this.parent,this.href,t,s,this.getNestedTemplates("end-date:form"),!this.data||e.matches("end-date",!0),(e=>{this.renderRoot.querySelector("#end-date-form").show(e.currentTarget)}),s,t,this.renderTemplateOrSlot("end-date:after"))},this.__checkNextTransactionDateAvailability=e=>{const{settings:t,data:s}=this;if(t&&s){return O({value:w(e),settings:t,subscription:s})}return e.getTime()>=Date.now()},this.__renderNextTransactionDate=()=>{const{data:e,lang:t,ns:s}=this,i=!!(null==e?void 0:e.is_active);return l(K||(K=ee` <div data-testid="next-transaction-date"> ${0} <x-group frame> <foxy-i18n key="next_transaction_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("next-transaction-date:before"),s,t,x(null==e?void 0:e.next_transaction_date.substr(0,10)),x(null==e?void 0:e.next_transaction_date),t,!i||this.readonlySelector.matches("next-transaction-date",!0),!e||this.disabledSelector.matches("next-transaction-date",!0),this.__checkNextTransactionDateAvailability,(e=>{const t=e.target;this.edit({next_transaction_date:t.value})}),this.renderTemplateOrSlot("next-transaction-date:after"))},this.__renderFrequencyAsDropdown=()=>{const{data:e}=this,t=!!(null==e?void 0:e.is_active),s=this.__frequencies.map((e=>({label:this.t(".5m"===e?"twice_a_month":"frequency",$(e)),value:e})));return l(Q||(Q=ee` <vaadin-combo-box item-value-path="value" item-label-path="label" data-testid="frequency" ?disabled="${0}" ?readonly="${0}" class="w-full" label="${0}" value="${0}" .items="${0}" @change="${0}"> </vaadin-combo-box> `),!e||this.disabledSelector.matches("frequency",!0),e&&(!t||this.readonlySelector.matches("frequency",!0)),this.t("frequency_label").toString(),x(this.form.frequency),s,(e=>{this.edit({frequency:e.target.value})}))},this.__renderFrequencyAsRadioList=()=>{var e;const{data:t,lang:s,ns:i}=this;return l(R||(R=ee` <x-group frame> <foxy-i18n key="frequency_label" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <x-choice default-custom-value="1d" data-testid="frequency" type="frequency" ns="${0}" ?custom="${0}" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} </x-choice> </x-group> `),i,s,se.defaultNS,null===this.settings,this.__frequencies,null!==(e=this.form.frequency)&&void 0!==e?e:null,!t||this.disabledSelector.matches("frequency",!0),t&&(!t.is_active||this.readonlySelector.matches("frequency",!0)),(e=>{this.edit({frequency:e.target.value})}),this.__frequencies.map((e=>l(J||(J=ee` <foxy-i18n options="${0}" slot="${0}-label" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify($(e)),e,s,".5m"===e?"twice_a_month":"frequency",i))))},this.__renderFrequency=()=>l(G||(G=ee` <div> ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("frequency:before"),this.settings&&this.__frequencies.length>4?this.__renderFrequencyAsDropdown():this.__renderFrequencyAsRadioList(),this.renderTemplateOrSlot("frequency:after")),this.__transactionsTableColumns=[{cell(e){var t;const s=v.statusColumn.cell(e),i=v.priceColumn.cell(e),n=null!==(t={declined:"text-error",rejected:"text-error"}[e.data.status])&&void 0!==t?t:"text-body";return e.html(Y||(Y=ee`
|
|
95
|
+
`}static get is(){return"vcf-tooltip"}static get version(){return"1.3.15"}static get properties(){return{for:{type:String},position:{type:String,value:"top"},align:{type:String,value:"center"},hidden:{type:Boolean,value:!0,notify:!0,reflectToAttribute:!0,observer:"_hiddenChanged"},manual:{type:Boolean,value:!1,reflectToAttribute:!0},targetElement:{type:Object,observer:"_attachToTarget"},closeButton:{type:Boolean,value:!1,reflectToAttribute:!0},theme:{type:String,reflectToAttribute:!0}}}static get observers(){return["_setPosition(targetElement, hidden, position, align)","_updateTarget(for)","_manualObserver(manual)"]}constructor(){super(),this._boundShow=this.show.bind(this),this._boundHide=this.hide.bind(this),this._boundOnKeyup=this._onKeyup.bind(this)}connectedCallback(){super.connectedCallback(),this._attachToTarget(),this._setDefaultId()}ready(){super.ready(),window.addEventListener("resize",(()=>{clearTimeout(this._resizeTimeout),this._resizeTimeout=setTimeout((()=>{const{targetElement:e,hidden:t,position:s}=this;this.hidden||this._setPosition(e,t,s)}),100)})),this.getAttribute("theme")||this.setAttribute("theme","dark")}disconnectedCallback(){super.disconnectedCallback(),this._detachFromTarget()}_manualObserver(){this.manual?this._removeEvents():this._addEvents()}_attachToTarget(e,t){t&&(this._removeTargetEvents(t),t.describedby&&(t.removeAttribute("aria-describedby"),delete t.describedby)),e&&(this._addEvents(),e.getAttribute("aria-describedby")||(e.setAttribute("aria-describedby",this.id),e.describedby=!0))}_addEvents(){this.targetElement&&!this.manual&&(this.targetElement.addEventListener("mouseenter",this._boundShow),this.targetElement.addEventListener("focus",this._boundShow),this.targetElement.addEventListener("mouseleave",this._boundHide),this.targetElement.addEventListener("blur",this._boundHide),this.targetElement.addEventListener("tap",this._boundHide)),this.manual||(this.addEventListener("mouseenter",this._boundShow),this.addEventListener("mouseleave",this._boundHide))}_detachFromTarget(){this.manual||this._removeEvents(),this.targetElement&&this.targetElement.describedby&&(this.targetElement.removeAttribute("aria-describedby"),delete this.targetElement.describedby)}_removeEvents(){this.targetElement&&this._removeTargetEvents(this.targetElement),this.removeEventListener("mouseenter",this._boundShow),this.removeEventListener("mouseleave",this._boundHide)}_removeTargetEvents(e){e.removeEventListener("mouseenter",this._boundShow),e.removeEventListener("focus",this._boundShow),e.removeEventListener("mouseleave",this._boundHide),e.removeEventListener("blur",this._boundHide),e.removeEventListener("tap",this._boundHide)}_updateTarget(){this.targetElement=this.parentNode.querySelector(`#${this.for}`)}_setPosition(e,t,s){if(e&&!t){let e=window.innerHeight,t=window.innerWidth;this.offsetParent&&(e=this.offsetParent.scrollHeight,t=this.offsetParent.scrollWidth);const i=this.targetElement.getBoundingClientRect(),n=this.getBoundingClientRect(),a=(i.width-n.width)/2,o=(i.height-n.height)/2;let r,l,d=i.left,c=i.top,u=window.pageYOffset;switch(this._parentPostioned&&(c=this.targetElement.offsetTop,d=this.targetElement.offsetLeft,u=0),s){case"top":l=c-n.height+u,r=this._calculateLeft(d,i,n,a);break;case"bottom":l=c+i.height+u,r=this._calculateLeft(d,i,n,a);break;case"left":r=d-n.width,l=this._calculateTop(c,i,n,o,u);break;case"right":r=d+i.width,l=this._calculateTop(c,i,n,o,u)}this._setPositionInVisibleBounds(e,t,r,l,n)}}get _parentPostioned(){return"static"!==window.getComputedStyle(this.offsetParent).position}_setPositionInVisibleBounds(e,t,s,i,n){s+n.width>t?(this.style.right="0px",this.style.left="auto"):(this.style.left=Math.max(0,s)+"px",this.style.right="auto"),i+n.height>e?(this.style.bottom=e+"px",this.style.top="auto"):(this.style.top=Math.max(0,i)+"px",this.style.bottom="auto")}_calculateLeft(e,t,s,i){switch(this.align){case"left":return e;case"right":return t.left+t.width-s.width;default:return e+i}}_calculateTop(e,t,s,i,n){switch(this.align){case"top":return e+n;case"bottom":return e+t.height-s.height+n;default:return e+i+n}}show(){this.hidden=!1}hide(){this.hidden=!0}_hiddenChanged(e){e?(this.setAttribute("aria-hidden",!0),window.removeEventListener("keyup",this._boundOnKeyup)):(this.setAttribute("aria-hidden",!1),window.addEventListener("keyup",this._boundOnKeyup))}_onKeyup(e){27===e.keyCode&&this.hide()}_setDefaultId(){this.id||(Vaadin.tooltipIndex||(Vaadin.tooltipIndex=0),this.id="vcf-tooltip"+ ++Vaadin.tooltipIndex)}}function T(e){return function*(e){const t=[];for(const s of e.settings.subscriptions.allowFrequencyModification)if(_(s.jsonataQuery).evaluate(e.subscription))for(const e of s.values)!t.includes(e)&&(t.push(e),yield e)}({settings:{subscriptions:{allowFrequencyModification:e.settings.subscriptions.allow_frequency_modification.map((e=>({jsonataQuery:e.jsonata_query,values:e.values})))}},subscription:e.subscription})}customElements.define(E.is,E),window.Vaadin.VcfTooltip=E;class j extends Error{constructor(e){super(`Invalid frequency "${e}".`)}}function q(e){const t=864e5,s=31*t;if(".5m"===e)return s/2;const i=parseInt(e.substring(0,e.length-1));if(isNaN(i))throw new j(e);if(e.endsWith("y"))return 31536e6*i;if(e.endsWith("m"))return i*s;if(e.endsWith("w"))return 6048e5*i;if(e.endsWith("d"))return i*t;throw new j(e)}function D(e,t){if("boolean"==typeof t)return t;const s=t.filter((t=>Boolean(_(t.jsonataQuery).evaluate(e)))).reduce(((e,t)=>{var s,i,n,a,o;if(t.min){const s=e.min?q(e.min):1/0;q(t.min)<s&&(e.min=t.min)}if(t.max){const s=e.max?q(e.max):-1/0;q(t.max)>s&&(e.max=t.max)}if("day"===(null===(s=t.allowedDays)||void 0===s?void 0:s.type)){const s=[...null!==(i=e.allowedDaysOfWeek)&&void 0!==i?i:[],...t.allowedDays.days];e.allowedDaysOfWeek=Array.from(new Set(s))}if("month"===(null===(n=t.allowedDays)||void 0===n?void 0:n.type)){const s=[...null!==(a=e.allowedDaysOfMonth)&&void 0!==a?a:[],...t.allowedDays.days];e.allowedDaysOfMonth=Array.from(new Set(s))}if(t.disallowedDates){const s=[...null!==(o=e.disallowedDates)&&void 0!==o?o:[],...t.disallowedDates];e.disallowedDates=Array.from(new Set(s))}return e}),{});return 0!==Object.keys(s).length&&s}function k(e){const[t,s,i]=e.split("-").map((e=>parseInt(e)));return new Date(t,s-1,i)}function O(e){const t=e.settings.subscriptions.allow_next_date_modification;let s;return s="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),function(e){var t,s;const i=k(e.value),n=i.getTime(),a=D(e.subscription,e.settings.subscriptions.allowNextDateModification);if("boolean"==typeof a)return a;if(!1===(null===(t=a.allowedDaysOfMonth)||void 0===t?void 0:t.includes(i.getDate())))return!1;if(!1===(null===(s=a.allowedDaysOfWeek)||void 0===s?void 0:s.includes(i.getDay())))return!1;if(a.disallowedDates&&a.disallowedDates.find((e=>{const[t,s]=e.split("..").map((e=>k(e).getTime()));return n===t||void 0!==s&&n>=t&&n<=s})))return!1;if(a.min){const e=g(a.min);if(null!==e&&Date.now()+e>=n)return!1}if(a.max){const e=g(a.max);if(null!==e&&Date.now()+e<=n)return!1}return!0}({settings:{subscriptions:{allowNextDateModification:s}},subscription:e.subscription,value:e.value})}const A=["html"];let L,I,z,C,N,H,P,F,V,B,M,W,K,Q,R,J,G,Y,U,X,Z,ee=e=>e;const te=h(m(u(f(S,"subscription-form"))));class se extends te{constructor(){super(...arguments),this.settings=null,this.templates={},this.__renderHeaderSubtitle=()=>{var e;const{data:t,lang:s,ns:i}=this;if(t){let n,a,o="text-secondary";if(t.first_failed_transaction_date)o="text-error",n=t.first_failed_transaction_date,a="subscription_failed";else if(t.end_date){n=t.end_date;a=new Date(n).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}else n=null!==(e=t.next_transaction_date)&&void 0!==e?e:(new Date).toISOString(),a="subscription_"+(t.is_active?"active":"inactive");const l=r(L||(L=ee` <foxy-i18n data-testid="header-subtitle" options="${0}" class="${0}" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify({date:n}),o,s,a,i);return t.first_failed_transaction_date?r(I||(I=ee` <span id="status" class="flex items-center space-x-xs ${0}"> ${0}<iron-icon icon="icons:info-outline" class="icon-inline"></iron-icon> </span> <vcf-tooltip for="status" position="bottom"> <span class="text-s">${0}</span> </vcf-tooltip> `),o,l,t.error_message):l}return r(z||(z=ee`<x-skeleton class="w-full" variant="static"> </x-skeleton>`))},this.__renderHeaderTitle=()=>{const{data:e,lang:t,ns:s}=this;if(e){const i=$(e.frequency),n=e._embedded["fx:last_transaction"].currency_code,a=e._embedded["fx:last_transaction"].total_order;return r(C||(C=ee` <foxy-i18n data-testid="header-title" options="${0}" lang="${0}" key="price_${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify(l(l({},i),{},{amount:`${a} ${n}`})),t,".5m"===e.frequency?"twice_a_month":"recurring",s)}return r(N||(N=ee`<x-skeleton class="w-full" variant="static"> </x-skeleton>`))},this.__renderHeader=()=>r(H||(H=ee` <div data-testid="header"> ${0} <div class="leading-xs text-xxl font-bold">${0}</div> <div class="leading-xs text-l">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("header:before"),this.__renderHeaderTitle(),this.__renderHeaderSubtitle(),this.renderTemplateOrSlot("header:after")),this.__renderItemsActions=()=>r(P||(P=ee` <div class="flex" data-testid="items:actions"> ${0} <foxy-i18n data-testid="items:actions-label" class="flex-1" lang="${0}" key="item_plural" ns="${0}"> </foxy-i18n> ${0} </div> `),this.renderTemplateOrSlot("items:actions:before"),this.lang,this.ns,this.renderTemplateOrSlot("items:actions:after")),this.__renderItemsItem=e=>{const t=e.price.toLocaleString(this.lang||"en",{style:"currency",currency:this.data._embedded["fx:last_transaction"].currency_code});let s;return s=e.quantity>1?r(F||(F=ee` <div data-testclass="item-quantity" class="px-s h-xs rounded bg-contrast-5 flex items-center font-tnum text-contrast text-s font-bold"> ${0} </div> `),e.quantity):r(V||(V=ee``)),r(B||(B=ee` <figure class="flex items-center space-x-m py-s pr-m" data-testclass="item"> <x-preview data-testclass="item-preview" class="w-l h-l" .quantity="${0}" .image="${0}"> </x-preview> <figcaption class="leading-s flex-1 flex justify-between items-center"> <div class="flex flex-col"> <span class="font-medium" data-testclass="item-name">${0}</span> <span class="text-secondary text-s" data-testclass="item-price">${0}</span> </div> ${0} </figcaption> </figure> `),e.quantity,e.image,e.name,t,s)},this.__renderItems=()=>{var e,t;const s=this.hiddenSelector,i=null!==(t=null===(e=this.data)||void 0===e?void 0:e._embedded["fx:transaction_template"]._embedded["fx:items"])&&void 0!==t?t:[],n=s.matches("items:actions",!0)?"":this.__renderItemsActions();return r(M||(M=ee` <div data-testid="items"> ${0} <x-group frame> <div slot="header">${0}</div> <div class="divide-y divide-contrast-10 pl-s">${0}</div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("items:before"),n,i.map(this.__renderItemsItem),this.renderTemplateOrSlot("items:after"))},this.__renderEndDate=()=>{const{disabledSelector:e,lang:t,ns:s}=this,i=this.hiddenSelector.zoom("end-date:form").toString();return r(W||(W=ee` <div> ${0} <foxy-form-dialog readonlycontrols="${0}" disabledcontrols="${0}" hiddencontrols="save-button ${0}" data-testid="cancellation-form" parent="${0}" header="end_subscription" alert form="foxy-cancellation-form" href="${0}" lang="${0}" id="end-date-form" ns="${0}" .templates="${0}"> </foxy-form-dialog> <vaadin-button data-testid="end-date" theme="error" class="w-full" ?disabled="${0}" @click="${0}"> <foxy-i18n key="end_subscription" ns="${0}" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("end-date:before"),this.readonlySelector.zoom("end-date:form").toString(),e.zoom("end-date:form").toString(),i,this.parent,this.href,t,s,this.getNestedTemplates("end-date:form"),!this.data||e.matches("end-date",!0),(e=>{this.renderRoot.querySelector("#end-date-form").show(e.currentTarget)}),s,t,this.renderTemplateOrSlot("end-date:after"))},this.__checkNextTransactionDateAvailability=e=>{const{settings:t,data:s}=this;if(t&&s){return O({value:w(e),settings:t,subscription:s})}return e.getTime()>=Date.now()},this.__renderNextTransactionDate=()=>{const{data:e,lang:t,ns:s}=this,i=!!(null==e?void 0:e.is_active);return r(K||(K=ee` <div data-testid="next-transaction-date"> ${0} <x-group frame> <foxy-i18n key="next_transaction_date" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <foxy-internal-calendar start="${0}" value="${0}" lang="${0}" ?readonly="${0}" ?disabled="${0}" .checkAvailability="${0}" @change="${0}"> </foxy-internal-calendar> </x-group> ${0} </div> `),this.renderTemplateOrSlot("next-transaction-date:before"),s,t,x(null==e?void 0:e.next_transaction_date.substr(0,10)),x(null==e?void 0:e.next_transaction_date),t,!i||this.readonlySelector.matches("next-transaction-date",!0),!e||this.disabledSelector.matches("next-transaction-date",!0),this.__checkNextTransactionDateAvailability,(e=>{const t=e.target;this.edit({next_transaction_date:t.value})}),this.renderTemplateOrSlot("next-transaction-date:after"))},this.__renderFrequencyAsDropdown=()=>{const{data:e}=this,t=!!(null==e?void 0:e.is_active),s=this.__frequencies.map((e=>({label:this.t(".5m"===e?"twice_a_month":"frequency",$(e)),value:e})));return r(Q||(Q=ee` <vaadin-combo-box item-value-path="value" item-label-path="label" data-testid="frequency" ?disabled="${0}" ?readonly="${0}" class="w-full" label="${0}" value="${0}" .items="${0}" @change="${0}"> </vaadin-combo-box> `),!e||this.disabledSelector.matches("frequency",!0),e&&(!t||this.readonlySelector.matches("frequency",!0)),this.t("frequency_label").toString(),x(this.form.frequency),s,(e=>{this.edit({frequency:e.target.value})}))},this.__renderFrequencyAsRadioList=()=>{var e;const{data:t,lang:s,ns:i}=this;return r(R||(R=ee` <x-group frame> <foxy-i18n key="frequency_label" ns="${0}" lang="${0}" slot="header"></foxy-i18n> <x-choice default-custom-value="1d" data-testid="frequency" type="frequency" ns="${0}" ?custom="${0}" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} </x-choice> </x-group> `),i,s,se.defaultNS,null===this.settings,this.__frequencies,null!==(e=this.form.frequency)&&void 0!==e?e:null,!t||this.disabledSelector.matches("frequency",!0),t&&(!t.is_active||this.readonlySelector.matches("frequency",!0)),(e=>{this.edit({frequency:e.target.value})}),this.__frequencies.map((e=>r(J||(J=ee` <foxy-i18n options="${0}" slot="${0}-label" lang="${0}" key="${0}" ns="${0}"> </foxy-i18n> `),JSON.stringify($(e)),e,s,".5m"===e?"twice_a_month":"frequency",i))))},this.__renderFrequency=()=>r(G||(G=ee` <div> ${0} ${0} ${0} </div> `),this.renderTemplateOrSlot("frequency:before"),this.settings&&this.__frequencies.length>4?this.__renderFrequencyAsDropdown():this.__renderFrequencyAsRadioList(),this.renderTemplateOrSlot("frequency:after")),this.__transactionsTableColumns=[{cell(e){var t;const s=v.statusColumn.cell(e),i=v.priceColumn.cell(e),n=null!==(t={declined:"text-error",rejected:"text-error"}[e.data.status])&&void 0!==t?t:"text-body";return e.html(Y||(Y=ee`
|
|
79
96
|
<span class="sr-only">${0}</span>
|
|
80
97
|
<span class="${0} text-s">${0}</span>
|
|
81
|
-
`),s,n,i)}},{cell:v.idColumn.cell,hideBelow:"sm"},{cell:v.dateColumn.cell},{cell:v.receiptColumn.cell}],this.__renderTransactionsPage=e=>{let{html:t}=e,s=
|
|
98
|
+
`),s,n,i)}},{cell:v.idColumn.cell,hideBelow:"sm"},{cell:v.dateColumn.cell},{cell:v.receiptColumn.cell}],this.__renderTransactionsPage=e=>{let{html:t}=e,s=d(e,A);var i,n;return t(U||(U=ee`
|
|
82
99
|
<foxy-table
|
|
83
100
|
group=${0}
|
|
84
101
|
lang=${0}
|
|
@@ -87,7 +104,7 @@ import{P as e,h as t}from"./shared-747b0842.js";import{E as s,T as i}from"./shar
|
|
|
87
104
|
.columns=${0}
|
|
88
105
|
>
|
|
89
106
|
</foxy-table>
|
|
90
|
-
`),s.group,s.lang,s.href,s.ns,null!==(n=null===(i=customElements.get("foxy-transactions-table"))||void 0===i?void 0:i.defaultNS)&&void 0!==n?n:"",this.__transactionsTableColumns)},this.__renderTransactions=()=>{var e,t;const{lang:s,ns:i}=this;return
|
|
107
|
+
`),s.group,s.lang,s.href,s.ns,null!==(n=null===(i=customElements.get("foxy-transactions-table"))||void 0===i?void 0:i.defaultNS)&&void 0!==n?n:"",this.__transactionsTableColumns)},this.__renderTransactions=()=>{var e,t;const{lang:s,ns:i}=this;return r(X||(X=ee` <div data-testid="transactions"> ${0} <x-group frame> <foxy-i18n lang="${0}" slot="header" key="transaction_plural" ns="${0}"></foxy-i18n> <foxy-collection-pages group="${0}" class="block divide-y divide-contrast-10 px-m" first="${0}" lang="${0}" ns="${0}" .page="${0}"> </foxy-collection-pages> </x-group> ${0} </div> `),this.renderTemplateOrSlot("transactions:before"),s,i,this.group,null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:transactions"].href)&&void 0!==t?t:"",s,i,this.__renderTransactionsPage,this.renderTemplateOrSlot("transactions:after"))}}static get scopedElements(){return{"foxy-internal-calendar":customElements.get("foxy-internal-calendar"),"foxy-collection-pages":customElements.get("foxy-collection-pages"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"foxy-form-dialog":customElements.get("foxy-form-dialog"),"vaadin-button":customElements.get("vaadin-button"),"foxy-spinner":customElements.get("foxy-spinner"),"vcf-tooltip":customElements.get("vcf-tooltip"),"foxy-table":customElements.get("foxy-table"),"foxy-i18n":customElements.get("foxy-i18n"),"iron-icon":customElements.get("iron-icon"),"x-skeleton":a,"x-preview":c,"x-choice":p,"x-group":y}}static get properties(){return l(l({},super.properties),{},{settings:{type:Object}})}render(){var e,t;const s=this.in("busy"),i=this.in("fail");return r(Z||(Z=ee` <div data-testid="wrapper" aria-busy="${0}" aria-live="polite" class="relative space-y-l text-body font-lumo text-m leading-m"> ${0} ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" 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> `),s,this.hiddenSelector.matches("header",!0)?"":this.__renderHeader(),this.hiddenSelector.matches("items",!0)?"":this.__renderItems(),this.hiddenSelector.matches("end-date",!0)?"":this.__renderEndDate(),this.__isNextTransactionDateVisible?this.__renderNextTransactionDate():"",this.__isFrequencyVisible?this.__renderFrequency():"",this.hiddenSelector.matches("transactions",!0)?"":this.__renderTransactions(),b({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!s&&!i}),i?"error":s?"busy":"empty",this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}get __isNextTransactionDateVisible(){if(this.hiddenSelector.matches("next-transaction-date",!0))return!1;if(null===this.settings)return!0;if(null===this.data)return!1;const e=this.settings.subscriptions.allow_next_date_modification;return!!function(e,t){let s;return s="boolean"==typeof t?t:t.map((e=>({allowedDays:e.allowed_days,disallowedDates:e.disallowed_dates,jsonataQuery:e.jsonata_query,max:e.max,min:e.min}))),D(e,s)}(this.data,e)}get __isFrequencyVisible(){if(this.hiddenSelector.matches("frequency",!0))return!1;if(null===this.settings)return!0;if(null===this.data)return!1;return!T({subscription:this.data,settings:this.settings}).next().done}get __frequencies(){if(!this.settings||!this.data)return[".5m","1m","1y"];const e=T({subscription:this.data,settings:this.settings});return Array.from(e)}}let ie;n("vcf-tooltip",o(ie||(ie=(e=>e)`
|
|
91
108
|
:host([hidden]) [part='container']{
|
|
92
109
|
display:none !important;
|
|
93
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./foxy-spinner.js";import"./foxy-i18n.js";import{S as s}from"./shared-
|
|
1
|
+
import"./foxy-spinner.js";import"./foxy-i18n.js";import{S as s}from"./shared-10bdb6b9.js";export{S as SubscriptionsTable}from"./shared-10bdb6b9.js";import"./shared-46ee137f.js";import"./shared-ff79f3f9.js";import"./shared-60126eee.js";import"./shared-63eaded9.js";import"./shared-d94ffc2b.js";import"./shared-1761daef.js";import"./shared-2174bcd4.js";import"./shared-593f7e2c.js";import"./shared-6d45a07b.js";import"./foxy-nucleon-element.js";import"./shared-44cfc617.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";import"./shared-a46edf4b.js";import"./shared-4e709717.js";import"./shared-6b7602c7.js";import"./shared-87ca7818.js";customElements.define("foxy-subscriptions-table",s);
|
package/dist/cdn/foxy-table.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-9221e6b2.js";import"./foxy-spinner.js";import{T as e}from"./shared-2174bcd4.js";export{T as Table}from"./shared-2174bcd4.js";import"./shared-63eaded9.js";import"./shared-46ee137f.js";import"./shared-ff79f3f9.js";import"./shared-60126eee.js";import"./foxy-i18n.js";import"./shared-d94ffc2b.js";import"./shared-1761daef.js";import"./shared-593f7e2c.js";import"./shared-6d45a07b.js";import"./foxy-nucleon-element.js";import"./shared-44cfc617.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";import"./shared-a46edf4b.js";import"./shared-4e709717.js";customElements.define("foxy-table",e);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{h as e}from"./shared-63eaded9.js";import{a as r}from"./shared-d94ffc2b.js";import{T as t}from"./shared-614e1a4e.js";import"./shared-46ee137f.js";import"./shared-ff79f3f9.js";import"./shared-60126eee.js";import"./shared-1761daef.js";import"./shared-593f7e2c.js";import"./shared-6d45a07b.js";import"./shared-44cfc617.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";import"./shared-a46edf4b.js";import"./shared-4e709717.js";let a,s,i=e=>e;class o extends(r(t,"tax-card")){render(){return super.render({title:({name:r})=>e(a||(a=i`${0}`),r),subtitle:()=>e(s||(s=i`${0} • ${0}`),this.__typeLabel,this.__rateLabel)})}get __typeLabel(){var e;const{type:r,country:t,region:a,city:s}=null!==(e=this.data)&&void 0!==e?e:{};return"global"===r?this.t("tax_global"):"union"===r?this.t("tax_union"):"country"===r?t:"region"===r?`${t}, ${a}`:"local"===r?`${t}, ${a}, ${s}`:void 0}get __rateLabel(){var e,r;if(!1===(null===(e=this.data)||void 0===e?void 0:e.is_live))return this.t("percent",{fraction:this.data.rate/100});const t=null===(r=this.data)||void 0===r?void 0:r.service_provider;return"onesource"===t?"Thomson Reuters ONESOURCE":"avalara"===t?"Avalara AvaTax 15":"taxjar"===t?"TaxJar":this.t("tax_rate_provider_default")}}customElements.define("foxy-tax-card",o);export{o as TaxCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-566252ac.js";import"./shared-84fa75d9.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{D as e}from"./shared-9467cb31.js";import"./shared-3ae39e52.js";import"./shared-54c485d2.js";import"./shared-b98f88c9.js";import{_ as t,h as i}from"./shared-17968c53.js";import{C as r}from"./shared-e057788f.js";import"./shared-7f588649.js";import{T as s,S as a,a as n}from"./shared-5388f705.js";import"./shared-45d647e4.js";import"./shared-e0248713.js";import{P as o}from"./shared-f2a4fd27.js";import{c as d}from"./shared-4e709717.js";import{m as l}from"./shared-50744508.js";import{C as h}from"./shared-f0199313.js";import{N as c}from"./shared-cf248335.js";import{i as _}from"./shared-98ee7fad.js";import{i as u}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 m,p,y,g,v,f,$,b,x,S,T,E,k,O,C=e=>e;const w=["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=[...w,"AU"],j=h(s(a(n(c,"tax-form"))));class A extends j{constructor(){var e;super(...arguments),e=this,this.templates={},this.__previousCountry=void 0,this.__countries="",this.__regions="",this.__countriesService=u(l.withConfig({services:{sendGet:async function(){const t=await new A.API(e).fetch(e.countries);if(!t.ok)throw new Error(await t.text());return await t.json()}}})),this.__regionsService=u(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 r=await new A.API(e).fetch(i.toString());if(!r.ok)throw new Error(await r.text());return await r.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"),"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"x-property-table":o,"x-checkbox":r,"x-dropdown":e}}static get properties(){return t(t({},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",({country:e,type:t})=>"country"!==t||!!e||"country_required",({country:e,type:t})=>"region"!==t||!!e||"country_required",({country:e,use_origin_rates:t})=>!t||!!e||"country_required",({country:e})=>!e||!!e.match(/[A-Z]{2}/)||"country_invalid",({region:e,type:t})=>"region"!=t||!!e||"region_required",({region:e})=>!e||e.length<=20||"region_too_long",({city:e})=>!e||e.length<=50||"city_too_long",({city:e,type:t})=>"local"!=t||!!e||"city_required",({rate:e})=>!e||e<=100||"rate_invalid"]}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,t;return i(m||(m=C` <div class="relative space-y-m"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" 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(),d({"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!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}updated(e){super.updated(e),this.form.country!==this.__previousCountry&&(this.__previousCountry=this.form.country,this.__regionsService.send({type:"FETCH"})),this.renderRoot.querySelectorAll("vaadin-combo-box").forEach((e=>e.validate()))}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&&w.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}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__getValidator(e){return()=>!this.errors.some((t=>t.startsWith(e)))}__renderName(){return i(p||(p=C` <div> ${0} <vaadin-text-field data-testid="name" class="w-full" label="${0}" value="${0}" .checkValidity="${0}" .errorMessage="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("name:before"),this.t("name"),_(this.form.name),this.__getValidator("name"),this.__getErrorMessage("name"),this.in("busy")||this.disabledSelector.matches("name",!0),this.readonlySelector.matches("name",!0),this.__submitOnEnter,(e=>{const t=e.currentTarget.value;this.edit({name:t})}),this.renderTemplateOrSlot("name:after"))}__renderType(){return this.form.type||this.edit({type:"global"}),i(y||(y=C` <div> ${0} <x-dropdown data-testid="type" label="${0}" value="${0}" class="w-full" .items="${0}" .getText="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </x-dropdown> ${0} </div> `),this.renderTemplateOrSlot("type:before"),this.t("type"),_(this.form.type),["global","union","country","region","local"],(e=>this.t(`tax_${e}`)),this.in("busy")||this.disabledSelector.matches("type",!0),this.readonlySelector.matches("type",!0),(e=>{this.edit({type:e.detail,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 t=this.__countriesService.state.matches("busy"),r=this.in("busy"),s=t||r,a=this.__countriesService.state.context.data,n=Object.values(null!==(e=null==a?void 0:a.values)&&void 0!==e?e:{});return i(g||(g=C` <div> ${0} <vaadin-combo-box item-value-path="cc2" item-label-path="default" item-id-path="cc2" data-testid="country" label="${0}${0}" value="${0}" class="w-full" .checkValidity="${0}" .errorMessage="${0}" .items="${0}" ?allow-custom-value="${0}" ?disabled="${0}" ?readonly="${0}" required @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot("country:before"),this.t("country"),t?` • ${this.t("loading_busy")}`:"",_(t?void 0:this.form.country),this.__getValidator("country"),this.__getErrorMessage("country"),n,0===n.length,s||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 t=this.__regionsService.state.matches("busy"),r=this.in("busy"),s=t||r,a=this.__regionsService.state.context.data,n=Object.values(null!==(e=null==a?void 0:a.values)&&void 0!==e?e:{});return i(v||(v=C` <div> ${0} <vaadin-combo-box item-value-path="code" item-label-path="default" item-id-path="code" data-testid="region" label="${0}${0}" value="${0}" class="w-full" .checkValidity="${0}" .errorMessage="${0}" .items="${0}" ?allow-custom-value="${0}" ?disabled="${0}" ?readonly="${0}" required @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot("region:before"),this.t("region"),t?` • ${this.t("loading_busy")}`:"",_(t?void 0:this.form.region),this.__getValidator("region"),this.__getErrorMessage("region"),n,0===n.length,s||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 i(f||(f=C` <div> ${0} <vaadin-text-field data-testid="city" class="w-full" label="${0}" value="${0}" .checkValidity="${0}" .errorMessage="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("city:before"),this.t("city"),_(this.form.city),this.__getValidator("city"),this.__getErrorMessage("city"),this.in("busy")||this.disabledSelector.matches("city",!0),this.readonlySelector.matches("city",!0),this.__submitOnEnter,(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("union"===this.form.type||w.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"}),i($||($=C` <div> ${0} <x-dropdown data-testid="provider" label="${0}" value="${0}" class="w-full" .items="${0}" .getText="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </x-dropdown> ${0} </div> `),this.renderTemplateOrSlot("provider:before"),this.t("tax_rate_provider"),this.form.service_provider||(this.form.is_live?"default":"none"),e.map((e=>e.value)),(t=>{var i;return null===(i=e.find((e=>e.value===t)))||void 0===i?void 0:i.label}),this.in("busy")||this.disabledSelector.matches("provider",!0),this.readonlySelector.matches("provider",!0),(e=>{const t=e.detail,i=["none","default"].includes(t)?"":t;this.edit({service_provider:i,is_live:"none"!==t}),this.__isExemptAllCustomerTaxIdsHidden&&this.edit({exempt_all_customer_tax_ids:!1}),this.__isApplyToShippingHidden&&this.edit({apply_to_shipping:!1}),this.__isUseOriginRatesHidden&&this.edit({use_origin_rates:!1})}),this.renderTemplateOrSlot("provider:after"))}__renderRate(){return i(b||(b=C` <div> ${0} <vaadin-integer-field data-testid="rate" class="w-full" label="${0}" value="${0}" min="0" prevent-invalid-input has-controls .checkValidity="${0}" .errorMessage="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @change="${0}"> </vaadin-integer-field> ${0} </div> `),this.renderTemplateOrSlot("rate:before"),this.t("tax_rate"),_(this.form.rate),this.__getValidator("rate"),this.__getErrorMessage("rate"),this.in("busy")||this.disabledSelector.matches("rate",!0),this.readonlySelector.matches("rate",!0),this.__submitOnEnter,(e=>{const t=parseInt(e.currentTarget.value);this.edit({rate:t})}),this.renderTemplateOrSlot("rate:after"))}__renderApplyToShipping(){return i(x||(x=C` <div> ${0} <x-checkbox data-testid="apply-to-shipping" 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.in("busy")||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 i(S||(S=C` <div> ${0} <x-checkbox data-testid="use-origin-rates" 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.in("busy")||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(){const e="exempt-all-customer-tax-ids";return i(T||(T=C` <div> ${0} <x-checkbox data-testid="${0}" 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(`${e}:before`),e,this.in("busy")||this.disabledSelector.matches(e,!0),this.readonlySelector.matches(e,!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(`${e}:after`))}__renderTimestamps(){return i(E||(E=C` <div> ${0} <x-property-table data-testid="timestamps" .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"}}}),t=this.in({idle:{template:{dirty:"invalid"}}}),r=this.in({idle:{snapshot:{clean:"invalid"}}}),s=this.in({idle:{snapshot:{dirty:"invalid"}}}),a=e||t||(r||s),n=this.in("busy");return i(k||(k=C` <div> ${0} <vaadin-button data-testid="create" 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 i(O||(O=C` <div> <foxy-internal-confirm-dialog data-testid="confirm" 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 data-testid="delete" 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"))}__submitOnEnter(e){"Enter"===e.key&&this.submit()}}customElements.define("foxy-tax-form",A);export{A as TaxForm};
|
|
1
|
+
import"./shared-3d868b17.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import"./shared-166c44ae.js";import"./shared-bb824ab4.js";import"./shared-ec861f31.js";import"./shared-0ced76a0.js";import{D as e}from"./shared-396320f9.js";import{_ as t,h as i}from"./shared-63eaded9.js";import{C as r}from"./shared-1b7e65e4.js";import"./shared-4a52d9b5.js";import{T as s,S as a,a as n}from"./shared-d94ffc2b.js";import"./shared-df573cea.js";import"./shared-46ee137f.js";import"./shared-f0a83bd6.js";import{P as o}from"./shared-fb90e05c.js";import{c as d}from"./shared-4e709717.js";import{a as l}from"./shared-1761daef.js";import{C as h}from"./shared-593f7e2c.js";import{N as c}from"./shared-44cfc617.js";import{i as _}from"./shared-6d45a07b.js";import{i as u}from"./shared-a46edf4b.js";import"./shared-60126eee.js";import"./shared-ff79f3f9.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";let m,p,y,g,v,f,b,$,x,S,T,E,k,O,C=e=>e;const w=["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=[...w,"AU"],j=h(s(a(n(c,"tax-form"))));class A extends j{constructor(){var e;super(...arguments),e=this,this.templates={},this.__previousCountry=void 0,this.__countries="",this.__regions="",this.__countriesService=u(l.withConfig({services:{sendGet:async function(){const t=await new A.API(e).fetch(e.countries);if(!t.ok)throw new Error(await t.text());return await t.json()}}})),this.__regionsService=u(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 r=await new A.API(e).fetch(i.toString());if(!r.ok)throw new Error(await r.text());return await r.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"),"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"x-property-table":o,"x-checkbox":r,"x-dropdown":e}}static get properties(){return t(t({},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",({country:e,type:t})=>"country"!==t||!!e||"country_required",({country:e,type:t})=>"region"!==t||!!e||"country_required",({country:e,use_origin_rates:t})=>!t||!!e||"country_required",({country:e})=>!e||!!e.match(/[A-Z]{2}/)||"country_invalid",({region:e,type:t})=>"region"!=t||!!e||"region_required",({region:e})=>!e||e.length<=20||"region_too_long",({city:e})=>!e||e.length<=50||"city_too_long",({city:e,type:t})=>"local"!=t||!!e||"city_required",({rate:e})=>!e||e<=100||"rate_invalid"]}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,t;return i(m||(m=C` <div class="relative space-y-m"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} <div data-testid="spinner" 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(),d({"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!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}updated(e){super.updated(e),this.form.country!==this.__previousCountry&&(this.__previousCountry=this.form.country,this.__regionsService.send({type:"FETCH"})),this.renderRoot.querySelectorAll("vaadin-combo-box").forEach((e=>e.validate()))}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&&w.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}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__getValidator(e){return()=>!this.errors.some((t=>t.startsWith(e)))}__renderName(){return i(p||(p=C` <div> ${0} <vaadin-text-field data-testid="name" class="w-full" label="${0}" value="${0}" .checkValidity="${0}" .errorMessage="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("name:before"),this.t("name"),_(this.form.name),this.__getValidator("name"),this.__getErrorMessage("name"),this.in("busy")||this.disabledSelector.matches("name",!0),this.readonlySelector.matches("name",!0),this.__submitOnEnter,(e=>{const t=e.currentTarget.value;this.edit({name:t})}),this.renderTemplateOrSlot("name:after"))}__renderType(){return this.form.type||this.edit({type:"global"}),i(y||(y=C` <div> ${0} <x-dropdown data-testid="type" label="${0}" value="${0}" class="w-full" .items="${0}" .getText="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </x-dropdown> ${0} </div> `),this.renderTemplateOrSlot("type:before"),this.t("type"),_(this.form.type),["global","union","country","region","local"],(e=>this.t(`tax_${e}`)),this.in("busy")||this.disabledSelector.matches("type",!0),this.readonlySelector.matches("type",!0),(e=>{this.edit({type:e.detail,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 t=this.__countriesService.state.matches("busy"),r=this.in("busy"),s=t||r,a=this.__countriesService.state.context.data,n=Object.values(null!==(e=null==a?void 0:a.values)&&void 0!==e?e:{});return i(g||(g=C` <div> ${0} <vaadin-combo-box item-value-path="cc2" item-label-path="default" item-id-path="cc2" data-testid="country" label="${0}${0}" value="${0}" class="w-full" .checkValidity="${0}" .errorMessage="${0}" .items="${0}" ?allow-custom-value="${0}" ?disabled="${0}" ?readonly="${0}" required @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot("country:before"),this.t("country"),t?` • ${this.t("loading_busy")}`:"",_(t?void 0:this.form.country),this.__getValidator("country"),this.__getErrorMessage("country"),n,0===n.length,s||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 t=this.__regionsService.state.matches("busy"),r=this.in("busy"),s=t||r,a=this.__regionsService.state.context.data,n=Object.values(null!==(e=null==a?void 0:a.values)&&void 0!==e?e:{});return i(v||(v=C` <div> ${0} <vaadin-combo-box item-value-path="code" item-label-path="default" item-id-path="code" data-testid="region" label="${0}${0}" value="${0}" class="w-full" .checkValidity="${0}" .errorMessage="${0}" .items="${0}" ?allow-custom-value="${0}" ?disabled="${0}" ?readonly="${0}" required @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot("region:before"),this.t("region"),t?` • ${this.t("loading_busy")}`:"",_(t?void 0:this.form.region),this.__getValidator("region"),this.__getErrorMessage("region"),n,0===n.length,s||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 i(f||(f=C` <div> ${0} <vaadin-text-field data-testid="city" class="w-full" label="${0}" value="${0}" .checkValidity="${0}" .errorMessage="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("city:before"),this.t("city"),_(this.form.city),this.__getValidator("city"),this.__getErrorMessage("city"),this.in("busy")||this.disabledSelector.matches("city",!0),this.readonlySelector.matches("city",!0),this.__submitOnEnter,(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("union"===this.form.type||w.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"}),i(b||(b=C` <div> ${0} <x-dropdown data-testid="provider" label="${0}" value="${0}" class="w-full" .items="${0}" .getText="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> </x-dropdown> ${0} </div> `),this.renderTemplateOrSlot("provider:before"),this.t("tax_rate_provider"),this.form.service_provider||(this.form.is_live?"default":"none"),e.map((e=>e.value)),(t=>{var i;return null===(i=e.find((e=>e.value===t)))||void 0===i?void 0:i.label}),this.in("busy")||this.disabledSelector.matches("provider",!0),this.readonlySelector.matches("provider",!0),(e=>{const t=e.detail,i=["none","default"].includes(t)?"":t;this.edit({service_provider:i,is_live:"none"!==t}),this.__isExemptAllCustomerTaxIdsHidden&&this.edit({exempt_all_customer_tax_ids:!1}),this.__isApplyToShippingHidden&&this.edit({apply_to_shipping:!1}),this.__isUseOriginRatesHidden&&this.edit({use_origin_rates:!1})}),this.renderTemplateOrSlot("provider:after"))}__renderRate(){return i($||($=C` <div> ${0} <vaadin-integer-field data-testid="rate" class="w-full" label="${0}" value="${0}" min="0" prevent-invalid-input has-controls .checkValidity="${0}" .errorMessage="${0}" ?disabled="${0}" ?readonly="${0}" required @keydown="${0}" @change="${0}"> </vaadin-integer-field> ${0} </div> `),this.renderTemplateOrSlot("rate:before"),this.t("tax_rate"),_(this.form.rate),this.__getValidator("rate"),this.__getErrorMessage("rate"),this.in("busy")||this.disabledSelector.matches("rate",!0),this.readonlySelector.matches("rate",!0),this.__submitOnEnter,(e=>{const t=parseInt(e.currentTarget.value);this.edit({rate:t})}),this.renderTemplateOrSlot("rate:after"))}__renderApplyToShipping(){return i(x||(x=C` <div> ${0} <x-checkbox data-testid="apply-to-shipping" 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.in("busy")||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 i(S||(S=C` <div> ${0} <x-checkbox data-testid="use-origin-rates" 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.in("busy")||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(){const e="exempt-all-customer-tax-ids";return i(T||(T=C` <div> ${0} <x-checkbox data-testid="${0}" 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(`${e}:before`),e,this.in("busy")||this.disabledSelector.matches(e,!0),this.readonlySelector.matches(e,!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(`${e}:after`))}__renderTimestamps(){return i(E||(E=C` <div> ${0} <x-property-table data-testid="timestamps" .items="${0}"> </x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}})),this.renderTemplateOrSlot("timestamps:after"))}__renderCreate(){const e=this.in({idle:{template:{clean:"invalid"}}}),t=this.in({idle:{template:{dirty:"invalid"}}}),r=this.in({idle:{snapshot:{clean:"invalid"}}}),s=this.in({idle:{snapshot:{dirty:"invalid"}}}),a=e||t||(r||s),n=this.in("busy");return i(k||(k=C` <div> ${0} <vaadin-button data-testid="create" 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 i(O||(O=C` <div> <foxy-internal-confirm-dialog data-testid="confirm" 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 data-testid="delete" 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"))}__submitOnEnter(e){"Enter"===e.key&&this.submit()}}customElements.define("foxy-tax-form",A);export{A as TaxForm};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import"./shared-60126eee.js";import"./shared-46ee137f.js";import"./shared-bb824ab4.js";import{C as e,a as t}from"./shared-166c44ae.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{_ as s,h as i,k as o,E as n,N as r,B as a,P as l,A as c}from"./shared-63eaded9.js";import{C as d}from"./shared-1b7e65e4.js";import{C as u}from"./shared-593f7e2c.js";import{N as h}from"./shared-44cfc617.js";import{T as p,a as g,S as f,R as _}from"./shared-d94ffc2b.js";import{c as m}from"./shared-4e709717.js";import{i as y}from"./shared-6d45a07b.js";import{G as x}from"./shared-7a39a41f.js";import"./shared-ff79f3f9.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import"./shared-ec861f31.js";import"./shared-1761daef.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";let b,$,v,k,w,S=e=>e;const j=u(p(g(h)));class O extends j{constructor(){super(...arguments),this.regions=[],this.region="",this.name="",this.code=""}static get properties(){return s(s({},super.properties),{},{regions:{type:Array},region:{type:String},name:{type:String},code:{type:String}})}render(){var e,t;return i(b||(b=S` <div class="border border-contrast-10 rounded text-s"> <div class="h-m flex justify-between items-center border-b border-contrast-10"> <div class="ml-m"> <span>${0}</span> ${0} </div> <button class="mr-xs flex items-center justify-center rounded-full transition-colors hover-bg-error-10 hover-text-error focus-outline-none focus-ring-2 focus-ring-inset focus-ring-error-50" style="width:calc(var(--lumo-size-s) - 2px);height:calc(var(--lumo-size-s) - 2px)" @click="${0}"> <iron-icon icon="icons:close" class="icon-inline text-m"></iron-icon> </button> </div> <div class="flex flex-wrap p-xs"> ${0} <div class="h-s m-xs flex items-center transition-colors border border-contrast-10 hover-border-contrast-40 focus-within-ring-1 focus-within-ring-primary-50 focus-within-border-primary-50" style="border-radius:var(--lumo-size-s)"> <input placeholder="${0}" class="bg-transparent appearance-none h-s text-s px-s focus-outline-none" style="width:8rem" list="list" .value="${0}" @keydown="${0}" @input="${0}"> <button style="width:calc(var(--lumo-size-s) - 2px);height:calc(var(--lumo-size-s) - 2px)" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:add" class="icon-inline text-m"></iron-icon> </button> </div> <datalist id="list"> ${0} </datalist> </div> </div> `),this.name||this.code,this.name?i($||($=S`<span class="text-secondary">${0}</span>`),this.code):"",(()=>this.dispatchEvent(new CustomEvent("delete"))),this.regions.map((e=>{var t,s;const o=null===(s=null===(t=this.data)||void 0===t?void 0:t.values[e])||void 0===s?void 0:s.default;return i(v||(v=S` <div class="flex items-center border border-contrast-10 h-s m-xs" style="border-radius:var(--lumo-size-s)"> <span class="mx-s"> <span>${0}</span> ${0} </span> <button class="flex items-center justify-center rounded-full transition-colors hover-bg-error-10 hover-text-error focus-outline-none focus-ring-2 focus-ring-inset focus-ring-error-50" style="width:calc(var(--lumo-size-s) - 2px);height:calc(var(--lumo-size-s) - 2px)" @click="${0}"> <iron-icon icon="icons:close" class="icon-inline text-m"></iron-icon> </button> </div> `),o||e,o?i(k||(k=S`<span class="text-secondary">${0}</span>`),e):"",(()=>{this.regions=this.regions.filter((t=>t!==e)),this.dispatchEvent(new CustomEvent("update:regions"))}))})),this.t("add_region"),this.region,(e=>{"Enter"===e.key&&this.region&&this.__addRegion()}),(e=>{const t=e.currentTarget;this.region=t.value}),m({"flex-shrink-0":!0,"flex items-center justify-center rounded-full transition-colors":!0,"bg-contrast-5 text-disabled cursor-default":!this.region,"bg-success-10 text-success cursor-pointer":!!this.region,"hover-bg-success hover-text-success-contrast":!!this.region,"focus-outline-none focus-ring-2 ring-inset ring-success-50":!!this.region}),!this.region,this.__addRegion,Object.values(null!==(t=null===(e=this.data)||void 0===e?void 0:e.values)&&void 0!==t?t:{}).map((e=>i(w||(w=S`<option value="${0}">${0}</option>`),e.code,e.default))))}__addRegion(){this.regions=[...new Set([...this.regions,this.region])],this.region="",this.dispatchEvent(new CustomEvent("update:regions"))}}let T,E,F,N=e=>e;const J=f(p(g(h)));class q extends J{constructor(){super(...arguments),this.countries={},this.disabled=!1,this.readonly=!1,this.regions="",this.country=""}static get scopedElements(){return{"x-country-card":O,"iron-icon":customElements.get("iron-icon")}}static get properties(){return s(s({},super.properties),{},{countries:{type:Object},disabled:{type:Boolean},readonly:{type:Boolean},regions:{type:String},country:{type:String}})}render(){var e,t;return i(T||(T=N` <div> <div class="space-y-s"> ${0} <div class="h-m flex items-center rounded transition-colors border border-contrast-10 hover-border-contrast-40 focus-within-ring-1 focus-within-ring-primary-50 focus-within-border-primary-50"> <input placeholder="${0}" class="w-full bg-transparent appearance-none h-m text-s px-m focus-outline-none" list="list" .value="${0}" @keydown="${0}" @input="${0}"> <button class="${0}" style="width:calc(var(--lumo-size-s) - 2px);height:calc(var(--lumo-size-s) - 2px)" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:add" class="icon-inline text-m"></iron-icon> </button> </div> </div> <datalist id="list"> ${0} </datalist> </div> `),Object.entries(this.countries).map((([e,t])=>{var o,n;let r;try{const t=new URL(this.regions);t.searchParams.set("country_code",e),r=t.toString()}catch(e){r=""}return i(E||(E=N` <x-country-card regions="${0}" code="${0}" name="${0}" href="${0}" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}" @update:regions="${0}" @delete="${0}"> </x-country-card> `),JSON.stringify("*"===t?[]:t),e,y(null===(n=null===(o=this.data)||void 0===o?void 0:o.values[e])||void 0===n?void 0:n.default),r,this.lang,this.ns,this.disabled,this.readonly,(t=>{const i=s({},this.countries),o=t.currentTarget.regions;i[e]=o.length?o:"*",this.countries=i,this.dispatchEvent(new CustomEvent("update:countries"))}),(()=>{const t=s({},this.countries);delete t[e],this.countries=t,this.dispatchEvent(new CustomEvent("update:countries"))}))})),this.t("add_country"),this.country,(e=>{"Enter"===e.key&&this.country&&this.__addCountry()}),(e=>{const t=e.currentTarget;this.country=t.value}),m({"mr-xs flex-shrink-0":!0,"flex items-center justify-center rounded-full transition-colors":!0,"bg-contrast-5 text-disabled cursor-default":!this.country,"bg-success-10 text-success cursor-pointer":!!this.country,"hover-bg-success hover-text-success-contrast":!!this.country,"focus-outline-none focus-ring-2 ring-inset ring-success-50":!!this.country}),!this.country,this.__addCountry,Object.values(null!==(t=null===(e=this.data)||void 0===e?void 0:e.values)&&void 0!==t?t:{}).map((e=>i(F||(F=N`<option value="${0}">${0}</option>`),e.cc2,e.default))))}__addCountry(){this.countries=s(s({},this.countries),{},{[this.country]:"*"}),this.country="",this.dispatchEvent(new CustomEvent("update:countries"))}}const C=o((e=>t=>{let s;if(t instanceof n||t instanceof r)throw new Error("The `live` directive is not allowed on text or event bindings");if(t instanceof a)H(t.strings),s=t.element.hasAttribute(t.name),t.value=s;else{const{element:i,name:o,strings:n}=t.committer;if(H(n),t instanceof l){if(s=i[o],s===e)return}else t instanceof c&&(s=i.getAttribute(o));if(s===String(e))return}t.setValue(e)})),H=e=>{if(2!==e.length||""!==e[0]||""!==e[1])throw new Error("`live` bindings can only contain a single expression")};
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright (c) 2020 The Polymer Project Authors. All rights reserved.
|
|
5
|
+
* This code may only be used under the BSD style license found at
|
|
6
|
+
* http://polymer.github.io/LICENSE.txt
|
|
7
|
+
* The complete set of authors may be found at
|
|
8
|
+
* http://polymer.github.io/AUTHORS.txt
|
|
9
|
+
* The complete set of contributors may be found at
|
|
10
|
+
* http://polymer.github.io/CONTRIBUTORS.txt
|
|
11
|
+
* Code distributed by Google as part of the polymer project is also
|
|
12
|
+
* subject to an additional IP rights grant found at
|
|
13
|
+
* http://polymer.github.io/PATENTS.txt
|
|
14
|
+
*/let I,V,z,A,R,G,B,D,L,P,U,W,Y,K,M,Q,X,Z,ee,te=e=>e;const se=f(_(u(p(g(h,"template-config-form")))));class ie extends se{constructor(){super(...arguments),this.countries="",this.regions="",this.__addHiddenFieldInputValue=""}static get scopedElements(){return{"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-text-area":customElements.get("vaadin-text-area"),"iron-icon":customElements.get("iron-icon"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"x-countries-list":q,"x-checkbox":d,"x-choice":e,"x-group":x}}static get properties(){return s(s({},super.properties),{},{__addHiddenFieldInputValue:{attribute:!1},countries:{type:String},regions:{type:String}})}render(){var e,t;const s=this.hiddenControls,o=this.form.json?JSON.parse(this.form.json):{cart_type:"default",checkout_type:"default_account",csc_requirements:"all_cards",tos_checkbox_settings:{usage:"none",initial_state:"unchecked",is_hidden:!1,url:""},eu_secure_data_transfer_consent:{usage:"required"},newsletter_subscribe:{usage:"none"},analytics_config:{usage:"none",google_analytics:{usage:"none",account_id:"",include_on_site:!1},segment_io:{usage:"none",account_id:""}},colors:{usage:"none",primary:"4D4D4D",secondary:"FFFFFF",tertiary:"FFFFFF"},use_checkout_confirmation_window:{usage:"none"},supported_payment_cards:["visa","mastercard","discover","amex"],custom_checkout_field_requirements:{cart_controls:"enabled",coupon_entry:"enabled",billing_first_name:"required",billing_last_name:"required",billing_company:"optional",billing_tax_id:"hidden",billing_phone:"optional",billing_address1:"required",billing_address2:"optional",billing_city:"required",billing_region:"default",billing_postal_code:"required",billing_country:"required"},cart_display_config:{usage:"none",show_product_weight:!0,show_product_category:!0,show_product_code:!0,show_product_options:!0,show_sub_frequency:!0,show_sub_startdate:!0,show_sub_nextdate:!0,show_sub_enddate:!0,hidden_product_options:[]},foxycomplete:{usage:"required",show_combobox:!0,combobox_open:"\\u25bc",combobox_close:"\\u25b2",show_flags:!0},custom_script_values:{header:"",footer:"",checkout_fields:"",multiship_checkout_fields:""},http_receipt:!1,custom_config:"",debug:{usage:"none"},location_filtering:{usage:"none",shipping_filter_type:"blacklist",billing_filter_type:"blacklist",shipping_filter_values:{},billing_filter_values:{}},postal_code_lookup:{usage:"enabled"}};return i(I||(I=te` <div class="relative" aria-busy="${0}" aria-live="polite"> <div class="${0}"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} </div> <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.in("busy"),m({"space-y-l transition-opacity":!0,"opacity-50":!this.in("idle")}),s.matches("cart-type",!0)?"":this.__renderCartType(o),s.matches("foxycomplete",!0)?"":this.__renderFoxycomplete(o),s.matches("locations",!0)?"":this.__renderLocations(o),s.matches("hidden-fields",!0)?"":this.__renderHiddenFields(o),s.matches("google-analytics",!0)?"":this.__renderGoogleAnalytics(o),s.matches("segment-io",!0)?"":this.__renderSegmentIo(o),s.matches("troubleshooting",!0)?"":this.__renderTroubleshooting(o),s.matches("custom-config",!0)?"":this.__renderCustomConfig(o),s.matches("header",!0)?"":this.__renderHeader(o),s.matches("footer",!0)?"":this.__renderFooter(o),m({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":this.in("idle")}),this.in("fail")?"error":"busy",this.lang,this.ns,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}__renderCartType(e){const{lang:t,ns:o}=this,n=["default","fullpage","custom"];return i(V||(V=te` <div> ${0} <x-group frame> <foxy-i18n slot="header" lang="${0}" key="cart_type" ns="${0}"></foxy-i18n> <x-choice .value="${0}" .items="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} </x-choice> </x-group> ${0} </div> `),this.renderTemplateOrSlot("cart-type:before"),t,o,e.cart_type,n,this.disabledSelector.matches("cart-type",!0),this.readonlySelector.matches("cart-type",!0),(t=>{this.edit({json:JSON.stringify(s(s({},e),{},{cart_type:t.detail}))})}),n.map((e=>i(z||(z=te` <div slot="${0}-label" class="grid leading-s py-s"> <foxy-i18n lang="${0}" key="cart_type_${0}" ns="${0}"></foxy-i18n> <foxy-i18n class="text-secondary text-xs" lang="${0}" key="cart_type_${0}_explainer" ns="${0}"> </foxy-i18n> </div> `),e,t,e,o,t,e,o))),this.renderTemplateOrSlot("cart-type:after"))}__renderFoxycomplete(e){const{lang:o,ns:n}=this,r=this.disabledSelector.matches("foxycomplete",!0),a=this.readonlySelector.matches("foxycomplete",!0),l=["combobox","search","disabled"],c="none"===e.foxycomplete.usage?"disabled":e.foxycomplete.show_combobox?"combobox":"search",d=()=>i(A||(A=te` <x-checkbox ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n lang="${0}" key="show_country_flags" ns="${0}"></foxy-i18n> </x-checkbox> `),r,a,e.foxycomplete.show_flags,(t=>{const i=s(s({},e.foxycomplete),{},{show_flags:t.detail});this.edit({json:JSON.stringify(s(s({},e),{},{foxycomplete:i}))})}),o,n);return i(R||(R=te` <div> ${0} <x-group frame> <foxy-i18n slot="header" lang="${0}" key="foxycomplete" ns="${0}"></foxy-i18n> <x-choice .value="${0}" .items="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> ${0} <div slot="combobox" class="space-y-m pb-s" ?hidden="${0}"> <div class="grid grid-cols-2 gap-m" style="max-width:16rem"> ${0} </div> ${0} </div> <div slot="search" class="pb-s" ?hidden="${0}"> ${0} </div> </x-choice> <div class="border-t border-contrast-10 p-m"> <x-checkbox ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <foxy-i18n lang="${0}" key="enable_postcode_lookup" ns="${0}"></foxy-i18n> </x-checkbox> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("foxycomplete:before"),o,n,c,l,r,a,(i=>{if(!(i instanceof t))return;const o=s(s({},e.foxycomplete),{},{usage:"disabled"===i.detail?"none":"required",show_combobox:"combobox"===i.detail});this.edit({json:JSON.stringify(s(s({},e),{},{foxycomplete:o}))})}),l.map((e=>i(G||(G=te` <div slot="${0}-label" class="grid leading-s py-s"> <foxy-i18n lang="${0}" key="foxycomplete_${0}" ns="${0}"></foxy-i18n> <foxy-i18n class="text-secondary text-xs" lang="${0}" key="foxycomplete_${0}_explainer" ns="${0}"> </foxy-i18n> </div> `),e,o,e,n,o,e,n))),"combobox"!==c,["open","close"].map((t=>{const o="open"===t?"combobox_open":"combobox_close";return i(B||(B=te` <vaadin-text-field label="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}"> </vaadin-text-field> `),this.t(`${t}_icon`),e.foxycomplete[o],r,a,(t=>{const i=t.currentTarget,n=s(s({},e.foxycomplete),{},{[o]:i.value});this.edit({json:JSON.stringify(s(s({},e),{},{foxycomplete:n}))})}))})),d(),"search"!==c,d(),r,a,"enabled"===e.postal_code_lookup.usage,(t=>{const i={usage:t.detail?"enabled":"none"};this.edit({json:JSON.stringify(s(s({},e),{},{postal_code_lookup:i}))})}),o,n,this.renderTemplateOrSlot("foxycomplete:after"))}__renderLocations(e){const{lang:t,ns:s}=this,o=e.location_filtering,n="blacklist"===o.shipping_filter_type?"block":"allow",r="both"===o.usage?"copy":"blacklist"===o.billing_filter_type?"block":"allow",a=()=>{if("both"===o.usage)o.billing_filter_type=o.shipping_filter_type,o.billing_filter_values=o.shipping_filter_values;else{const e=Object.keys(o.billing_filter_values).length>0,t=Object.keys(o.shipping_filter_values).length>0;o.usage=e||t?e&&!t?"billing":t&&!e?"shipping":"independent":"none"}};return i(D||(D=te` ${0} <x-group frame> <foxy-i18n slot="header" lang="${0}" key="location_plural" ns="${0}"></foxy-i18n> <div class="grid sm-grid-cols-2 bg-contrast-10" style="gap:1px"> <x-group class="bg-base pt-m"> <foxy-i18n class="text-tertiary" slot="header" lang="${0}" key="shipping" ns="${0}"> </foxy-i18n> <x-choice .items="${0}" .value="${0}" @change="${0}"> <foxy-i18n slot="allow-label" lang="${0}" key="allowlist" ns="${0}"></foxy-i18n> <foxy-i18n slot="block-label" lang="${0}" key="blocklist" ns="${0}"></foxy-i18n> <x-countries-list countries="${0}" regions="${0}" class="mb-m" href="${0}" slot="${0}" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}" @update:countries="${0}"> </x-countries-list> </x-choice> </x-group> <x-group class="bg-base pt-m"> <foxy-i18n class="text-tertiary" slot="header" lang="${0}" key="billing" ns="${0}"> </foxy-i18n> <x-choice .items="${0}" .value="${0}" @change="${0}"> <foxy-i18n slot="allow-label" lang="${0}" key="allowlist" ns="${0}"></foxy-i18n> <foxy-i18n slot="block-label" lang="${0}" key="blocklist" ns="${0}"></foxy-i18n> <foxy-i18n slot="copy-label" lang="${0}" key="same_as_shipping" ns="${0}"></foxy-i18n> <x-countries-list countries="${0}" regions="${0}" class="mb-m" href="${0}" slot="${0}" lang="${0}" ns="${0}" ?disabled="${0}" ?readonly="${0}" ?hidden="${0}" @update:countries="${0}"> </x-countries-list> </x-choice> </x-group> </div> </x-group> ${0} `),this.renderTemplateOrSlot("locations:before"),t,s,t,s,["allow","block"],n,(t=>{"both"!==o.usage&&(o.usage="independent"),o.shipping_filter_type="block"===t.detail?"blacklist":"whitelist",a(),this.edit({json:JSON.stringify(e)})}),t,s,t,s,JSON.stringify(o.shipping_filter_values),this.regions,this.countries,n,t,s,this.disabledSelector.matches("locations",!0),this.readonlySelector.matches("locations",!0),(t=>{o.shipping_filter_values=t.currentTarget.countries,a(),this.edit({json:JSON.stringify(e)})}),t,s,["allow","block","copy"],r,(t=>{"copy"===t.detail?o.usage="both":(o.usage="independent",o.billing_filter_type="block"===t.detail?"blacklist":"whitelist"),a(),this.edit({json:JSON.stringify(e)})}),t,s,t,s,t,s,JSON.stringify(o.billing_filter_values),this.regions,this.countries,r,t,s,this.disabledSelector.matches("locations",!0),this.readonlySelector.matches("locations",!0),"copy"===r,(t=>{o.billing_filter_values=t.currentTarget.countries,a(),this.edit({json:JSON.stringify(e)})}),this.renderTemplateOrSlot("locations:after"))}__renderHiddenFields(e){const{lang:t,ns:s}=this,o=[],n=[],r=e.cart_display_config;for(const e in r){if(!e.startsWith("show_"))continue;const t=e.substring(5);o.push(t),"required"!==r.usage||r[e]||n.push(t)}"required"===r.usage&&n.push(...r.hidden_product_options);const a=()=>{r.usage="required",o.includes(this.__addHiddenFieldInputValue)?r[`show_${this.__addHiddenFieldInputValue}`]=!1:r.hidden_product_options.includes(this.__addHiddenFieldInputValue)||r.hidden_product_options.push(this.__addHiddenFieldInputValue),this.edit({json:JSON.stringify(e)}),this.__addHiddenFieldInputValue=""},l="calc(var(--lumo-border-radius-l) / 1.2)",c=0===n.length?[l]:["0","0",l,l];return i(L||(L=te` <div> ${0} <x-group frame> <foxy-i18n slot="header" lang="${0}" key="hidden_fields" ns="${0}"></foxy-i18n> <div class="divide-y divide-contrast-10"> ${0} </div> <div style="border-radius:${0}" class="${0}"> <input placeholder="${0}" class="w-full bg-transparent appearance-none h-m px-m focus-outline-none" list="hidden-fields-list" .value="${0}" @keydown="${0}" @input="${0}"> <datalist id="hidden-fields-list"> ${0} </datalist> <button aria-label="${0}" class="${0}" ?disabled="${0}" @click="${0}"> <iron-icon icon="icons:add" class="icon-inline text-m"></iron-icon> </button> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("hidden-fields:before"),t,s,n.map((n=>i(P||(P=te` <div class="h-m ml-m pr-xs flex items-center justify-between"> ${0} <button class="flex w-xs h-xs items-center justify-center rounded-full transition-colors hover-bg-error-10 hover-text-error focus-outline-none focus-ring-2 focus-ring-inset focus-ring-error-50" @click="${0}"> <iron-icon icon="icons:close" class="icon-inline text-m"></iron-icon> </button> </div> `),o.includes(n)?i(U||(U=te`<foxy-i18n lang="${0}" key="${0}" ns="${0}"></foxy-i18n>`),t,n,s):i(W||(W=te`<span>${0}</span>`),n),(()=>{"boolean"==typeof r[`show_${n}`]?r[`show_${n}`]=!0:r.hidden_product_options=r.hidden_product_options.filter((e=>e!==n)),this.edit({json:JSON.stringify(e)})})))),c.join(" "),m({"h-m flex items-center ring-inset ring-primary-50 focus-within-ring-2":!0,"border-t border-contrast-10":n.length>0}),this.t("add_field"),C(this.__addHiddenFieldInputValue),(e=>"Enter"===e.key&&a()),(e=>{this.__addHiddenFieldInputValue=e.currentTarget.value}),o.filter((e=>!n.includes(e))).map((e=>i(Y||(Y=te`<option value="${0}">${0}</option>`),e,this.t(e)))),this.t("add_field"),m({"w-xs h-xs mr-xs flex-shrink-0 ring-inset ring-success-50":!0,"flex items-center justify-center rounded-full transition-colors":!0,"bg-contrast-5 text-disabled cursor-default":!this.__addHiddenFieldInputValue,"bg-success-10 text-success cursor-pointer":!!this.__addHiddenFieldInputValue,"hover-bg-success hover-text-success-contrast":!!this.__addHiddenFieldInputValue,"focus-outline-none focus-ring-2":!!this.__addHiddenFieldInputValue}),!this.__addHiddenFieldInputValue,a,this.renderTemplateOrSlot("hidden-fields:after"))}__renderGoogleAnalytics(e){const{lang:t,ns:s}=this,o=e.analytics_config,n=o.segment_io,r=o.google_analytics,a=this.disabledSelector.matches("google-analytics",!0),l=this.readonlySelector.matches("google-analytics",!0);return i(K||(K=te` <div> ${0} <x-group frame> <span slot="header">Google Analytics</span> <div class="p-m space-y-m"> <vaadin-text-field class="w-full" label="${0}" placeholder="UA-1234567-1" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" clear-button-visible @keydown="${0}" @input="${0}"> </vaadin-text-field> <x-checkbox ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <div class="flex flex-col"> <foxy-i18n lang="${0}" key="ga_include_on_site" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs leading-s text-secondary" lang="${0}" key="ga_include_on_site_explainer" ns="${0}"> </foxy-i18n> </div> </x-checkbox> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("google-analytics:before"),this.t("ga_account_id"),this.t("ga_account_id_explainer"),C(r.account_id),a,l,(e=>"Enter"===e.key&&this.submit()),(e=>{r.account_id=e.currentTarget.value,r.usage=r.account_id?"required":"none",o.usage=r.account_id||n.account_id?"required":"none"}),a,l,r.include_on_site,(t=>{r.include_on_site=t.detail,this.edit({json:JSON.stringify(e)})}),t,s,t,s,this.renderTemplateOrSlot("google-analytics:after"))}__renderSegmentIo(e){const t=e.analytics_config,s=t.segment_io,o=t.google_analytics,n=this.disabledSelector.matches("segment-io",!0),r=this.readonlySelector.matches("segment-io",!0);return i(M||(M=te` <div> ${0} <x-group frame> <span slot="header">Segment.io</span> <div class="p-m"> <vaadin-text-field class="w-full" label="${0}" placeholder="MY-WRITE-KEY" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" clear-button-visible @keydown="${0}" @input="${0}"> </vaadin-text-field> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("segment-io:before"),this.t("sio_account_id"),this.t("sio_account_id_explainer"),C(s.account_id),n,r,(e=>"Enter"===e.key&&this.submit()),(e=>{s.account_id=e.currentTarget.value,s.usage=s.account_id?"required":"none",t.usage=o.account_id||s.account_id?"required":"none"}),this.renderTemplateOrSlot("segment-io:after"))}__renderTroubleshooting(e){const{lang:t,ns:s}=this,o=e.debug;return i(Q||(Q=te` <div> ${0} <x-group frame> <foxy-i18n slot="header" lang="${0}" key="troubleshooting" ns="${0}"></foxy-i18n> <div class="p-m space-y-m"> <x-checkbox ?disabled="${0}" ?readonly="${0}" ?checked="${0}" @change="${0}"> <div class="flex flex-col"> <foxy-i18n lang="${0}" key="troubleshooting_debug" ns="${0}"></foxy-i18n> <foxy-i18n class="text-xs leading-s text-secondary" lang="${0}" key="troubleshooting_debug_explainer" ns="${0}"> </foxy-i18n> </div> </x-checkbox> </div> </x-group> ${0} </div> `),this.renderTemplateOrSlot("troubleshooting:before"),t,s,this.disabledSelector.matches("troubleshooting",!0),this.readonlySelector.matches("troubleshooting",!0),"required"===o.usage,(t=>{o.usage=t.detail?"required":"none",this.edit({json:JSON.stringify(e)})}),t,s,t,s,this.renderTemplateOrSlot("troubleshooting:after"))}__renderCustomConfig(e){return i(X||(X=te` <div> ${0} <vaadin-text-area class="w-full" label="${0}" placeholder='{ "key": "value" }' helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}"> </vaadin-text-area> ${0} </div> `),this.renderTemplateOrSlot("custom-config:before"),this.t("custom_config"),this.t("custom_config_helper_text"),e.custom_config?JSON.stringify(e.custom_config,null,2):"",this.disabledSelector.matches("custom-config",!0),this.readonlySelector.matches("custom-config",!0),(t=>{const s=t.currentTarget;try{e.custom_config=s.value?JSON.parse(s.value):"",this.edit({json:JSON.stringify(e)}),s.invalid=!1}catch(e){s.invalid=!0}}),this.renderTemplateOrSlot("custom-config:after"))}__renderHeader(e){return i(Z||(Z=te` <div> ${0} <vaadin-text-area class="w-full" label="${0}" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}"> </vaadin-text-area> ${0} </div> `),this.renderTemplateOrSlot("header:before"),this.t("custom_header"),this.t("custom_header_helper_text"),e.custom_script_values.header,this.disabledSelector.matches("header",!0),this.readonlySelector.matches("header",!0),(t=>{const i=t.currentTarget,o=s(s({},e.custom_script_values),{},{header:i.value});this.edit({json:JSON.stringify(s(s({},e),{},{custom_script_values:o}))})}),this.renderTemplateOrSlot("header:after"))}__renderFooter(e){return i(ee||(ee=te` <div> ${0} <vaadin-text-area class="w-full" label="${0}" helper-text="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}"> </vaadin-text-area> ${0} </div> `),this.renderTemplateOrSlot("footer:before"),this.t("custom_footer"),this.t("custom_footer_helper_text"),e.custom_script_values.footer,this.disabledSelector.matches("footer",!0),this.readonlySelector.matches("footer",!0),(t=>{const i=t.currentTarget,o=s(s({},e.custom_script_values),{},{footer:i.value});this.edit({json:JSON.stringify(s(s({},e),{},{custom_script_values:o}))})}),this.renderTemplateOrSlot("footer:after"))}}customElements.define("foxy-template-config-form",ie);export{ie as TemplateConfigForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-bb824ab4.js";import{C as e,a as t}from"./shared-166c44ae.js";import"./shared-0ced76a0.js";import"./shared-3d868b17.js";import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{_ as i,j as a,h as s}from"./shared-63eaded9.js";import"./shared-46ee137f.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import{C as r}from"./shared-593f7e2c.js";import{S as n,T as o,a as d}from"./shared-d94ffc2b.js";import"./shared-4a52d9b5.js";import"./shared-396320f9.js";import"./shared-ec861f31.js";import{G as l}from"./shared-7a39a41f.js";import{P as c}from"./shared-fb90e05c.js";import{c as h}from"./shared-4e709717.js";import{N as m}from"./shared-44cfc617.js";import{i as p}from"./shared-6d45a07b.js";import"./shared-ff79f3f9.js";import"./shared-1761daef.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-60126eee.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";let f,u,v,y,$,b,_,x,g=e=>e;const j=n(o(r(d(m,"template-form"))));class S extends j{constructor(){super(...arguments),this.__cacheState="idle",this.__contentChoice="default"}static get properties(){return i(i({},super.properties),{},{__cacheState:{attribute:!1},__contentChoice:{attribute:!1}})}static get styles(){return[...super.styles,a(f||(f=g`#cached-content::part(input-field){max-height:15em}`))]}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-text-area":customElements.get("vaadin-text-area"),"vaadin-button":customElements.get("vaadin-button"),"x-property-table":c,"x-choice":e,"x-group":l}}render(){var e,t;const{hiddenSelector:i,href:a,lang:r,ns:n}=this,o=a?"delete":"create",d=this.in("busy"),l=this.in("fail");return s(u||(u=g` <div class="space-y-m"> ${0} ${0} ${0} ${0} <div data-testid="spinner" 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> `),i.matches("description",!0)?"":this.__renderDescription(),i.matches("content",!0)?"":this.__renderContent(),i.matches("timestamps",!0)||!a?"":this.__renderTimestamps(),i.matches(o)?"":this.__renderAction(o),h({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!d&&!l}),l?"error":d?"busy":"empty",r,n,null!==(t=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==t?t:"")}__renderDescription(){var e,t;return s(v||(v=g` <div> ${0} <vaadin-text-field class="w-full mb-s" label="${0}" .value="${0}" @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot("description:before"),this.t("description"),null!==(t=null===(e=this.form)||void 0===e?void 0:e.description)&&void 0!==t?t:"",(e=>"Enter"===e.key&&this.submit()),(e=>{this.edit({description:e.currentTarget.value})}),this.renderTemplateOrSlot("description:after"))}__renderContent(){var e;const i=this.form.content_url?"url":this.form.content?"clipboard":this.__contentChoice;return s(y||(y=g` <div> ${0} <x-group frame> <foxy-i18n lang="${0}" slot="header" key="template" ns="${0}"></foxy-i18n> <x-choice data-testid="template-type" .value="${0}" .items="${0}" ?readonly="${0}" ?disabled="${0}" @change="${0}"> ${0} <div slot="url" ?hidden="${0}"> <div class="flex items-center mt-0 mb-m"> <vaadin-text-field data-testid="content_url" value="${0}" class="mr-s flex-grow" @input="${0}"> </vaadin-text-field> ${0} </div> </div> <div slot="clipboard" ?hidden="${0}"> <vaadin-text-area id="cached-content" data-testid="content" class="w-full mb-m" .value="${0}" @input="${0}"> </vaadin-text-area> </div> </x-choice> </x-group> ${0} </div> `),this.renderTemplateOrSlot("content:before"),this.lang,this.ns,i,["default","url","clipboard"],this.readonlySelector.matches("content",!0),this.in("busy")||this.disabledSelector.matches("content",!0),(e=>{e instanceof t&&(this.edit({content:"",content_url:""}),this.__contentChoice=e.detail)}),["default","url","clipboard"].map((e=>s($||($=g` <div slot="${0}-label" class="py-s leading-s"> <foxy-i18n class="block" lang="${0}" key="template_${0}" ns="${0}"> </foxy-i18n> <foxy-i18n class="block text-s opacity-70" lang="${0}" key="template_${0}_explainer" ns="${0}"> </foxy-i18n> </div> `),e,this.lang,e,this.ns,this.lang,e,this.ns))),"url"!==i,p(this.form.content_url),(e=>{const t=e.currentTarget.value;this.edit({content:"",content_url:t})}),this.form.content_url===(null===(e=this.data)||void 0===e?void 0:e.content_url)?s(b||(b=g` <vaadin-button class="relative" ?disabled="${0}" @click="${0}"> <foxy-i18n class="${0}" lang="${0}" key="cache" ns="${0}"> </foxy-i18n> <div class="${0}"> <foxy-spinner layout="no-label" class="m-auto" state="${0}" lang="${0}" ns="${0}"> </foxy-spinner> </div> </vaadin-button> `),"busy"===this.__cacheState,this.__cache,h({"relative transition-opacity":!0,"opacity-0":"idle"!==this.__cacheState}),this.lang,this.ns,h({"absolute inset-0 flex transition-opacity":!0,"opacity-0":"idle"===this.__cacheState}),"fail"===this.__cacheState?"error":"busy",this.lang,this.ns):"","clipboard"!==i,this.form.content,(e=>{const t=e.currentTarget.value;this.edit({content:t,content_url:""})}),this.renderTemplateOrSlot("content:after"))}__renderTimestamps(){return s(_||(_=g` <div> ${0} <x-property-table data-testid="timestamps" .items="${0}"> </x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),["date_modified","date_created"].map((e=>{var t;return{name:this.t(e),value:(null===(t=this.data)||void 0===t?void 0:t[e])?this.t("date",{value:new Date(this.data[e])}):""}})),this.renderTemplateOrSlot("timestamps:after"))}__renderAction(e){const{disabledSelector:t,href:i,lang:a,ns:r}=this,n=this.in({idle:{template:{dirty:"valid"}}}),o=this.in({idle:{snapshot:{dirty:"valid"}}}),d=!this.in("idle")||t.matches(e,!0),l=n||o;return s(x||(x=g` <div> ${0} <foxy-internal-confirm-dialog message="delete_prompt" confirm="delete" cancel="cancel" header="delete" theme="primary error" lang="${0}" ns="${0}" id="confirm" data-testid="confirm" @hide="${0}"> </foxy-internal-confirm-dialog> <vaadin-button class="w-full" theme="${0}" data-testid="${0}" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" key="${0}" lang="${0}"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot(`${e}:before`),a,r,(e=>{e.detail.cancelled||this.delete()}),this.in("idle")?"primary "+(i?"error":"success"):"",e,this.in({idle:"template"})&&!l||d,(t=>{if("delete"===e){this.renderRoot.querySelector("#confirm").show(t.currentTarget)}else this.submit()}),r,e,a,this.renderTemplateOrSlot(`${e}:after`))}async __cache(){var e,t;this.__cacheState="busy";try{const i=null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:cache"].href)&&void 0!==t?t:"",a=await new S.API(this).fetch(i,{method:"POST"});this.__cacheState=a.ok?"idle":"fail"}catch(e){this.__cacheState="fail"}}}customElements.define("foxy-template-form",S);export{S as TemplateForm};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-9221e6b2.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{h as t}from"./shared-63eaded9.js";import{C as e}from"./shared-593f7e2c.js";import{N as s}from"./shared-44cfc617.js";import{T as i,a as r}from"./shared-d94ffc2b.js";import{c as a}from"./shared-4e709717.js";import"./shared-46ee137f.js";import"./shared-ff79f3f9.js";import"./shared-60126eee.js";import"./shared-1761daef.js";import"./shared-6d45a07b.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";import"./shared-a46edf4b.js";let n,o,d,c,l,m,h,p,u,f,v,y,_=t=>t;const $=i(e(r(s,"transaction-card")));class x extends ${constructor(){super(...arguments),this.templates={},this.__currencyDisplay=""}render(){var e,s;const i=this.hiddenSelector,r=!i.matches("total",!0),d=!i.matches("status",!0);return t(n||(n=_` <div aria-busy="${0}" aria-live="polite" class="relative leading-m font-lumo text-m"> <div class="${0}"> ${0} ${0} ${0} </div> <div class="${0}"> <foxy-spinner data-testid="spinner" state="${0}" class="m-auto" lang="${0}" ns="${0} ${0}"> </foxy-spinner> </div> </div> `),this.in("busy"),a({"transition-opacity":!0,"opacity-0":!this.data}),r||d?t(o||(o=_` <div class="flex items-center justify-between"> ${0} ${0} </div> `),r?this.__renderTotal():"",d?this.__renderStatus():""):"",i.matches("description",!0)?"":this.__renderDescription(),i.matches("customer",!0)?"":this.__renderCustomer(),a({"pointer-events-none absolute inset-0 flex transition-opacity":!0,"opacity-0":!!this.data}),this.in("fail")?"error":this.in({idle:"template"})?"empty":"busy",this.lang,this.ns,null!==(s=null===(e=customElements.get("foxy-spinner"))||void 0===e?void 0:e.defaultNS)&&void 0!==s?s:"")}async _sendGet(){const t=await super._sendGet(),e=await super._fetch(t._links["fx:store"].href);return this.__currencyDisplay=e.use_international_currency_symbol?"code":"symbol",t}__renderTotal(){const e=this.data;let s;if(e){const i=`${e.total_order} ${e.currency_code}`,r=this.__currencyDisplay;s=t(d||(d=_` <foxy-i18n options="${0}" lang="${0}" key="price" ns="${0}"> </foxy-i18n> `),JSON.stringify({amount:i,currencyDisplay:r}),this.lang,this.ns)}else s=t(c||(c=_`​`));return t(l||(l=_` <div data-testid="total"> ${0} <div class="font-semibold truncate">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("total:before"),s,this.renderTemplateOrSlot("total:after"))}__renderStatus(){var e,s,i,r;const a=(null===(e=this.data)||void 0===e?void 0:e.status)||"completed";return t(m||(m=_` <div data-testid="status"> ${0} <div class="text-tertiary text-s flex items-center space-x-s"> <foxy-i18n options="${0}" lang="${0}" key="time" ns="${0}"> </foxy-i18n> <iron-icon data-testid="status-icon" class="icon-inline text-l ${0}" title="${0}" icon="${0}"> </iron-icon> </div> ${0} </div> `),this.renderTemplateOrSlot("status:before"),JSON.stringify({value:null===(s=this.data)||void 0===s?void 0:s.transaction_date}),this.lang,this.ns,null!==(i={completed:"text-success",rejected:"text-error",declined:"text-error"}[a])&&void 0!==i?i:"text-tertiary",this.t(`transaction_${a}`),null!==(r={completed:"icons:done-all",refunded:"icons:restore",rejected:"icons:highlight-off",declined:"icons:highlight-off",voided:"icons:remove-circle-outline"}[a])&&void 0!==r?r:"icons:schedule",this.renderTemplateOrSlot("status:after"))}__renderDescription(){var e,s;const i=null===(s=null===(e=this.data)||void 0===e?void 0:e._embedded)||void 0===s?void 0:s["fx:items"];let r;if(i){const e={most_expensive_item:[...i].sort(((t,e)=>t.price-e.price))[0],count:i.length};r=t(h||(h=_` <foxy-i18n options="${0}" lang="${0}" key="transaction_summary" ns="${0}"> </foxy-i18n> `),JSON.stringify(e),this.lang,this.ns)}else r=t(p||(p=_`​`));return t(u||(u=_` <div data-testid="description"> ${0} <div class="text-s text-secondary truncate">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("description:before"),r,this.renderTemplateOrSlot("description:after"))}__renderCustomer(){const e=this.data,s=e?t(f||(f=_`${0} ${0} (${0})`),e.customer_first_name,e.customer_last_name,e.customer_email):t(v||(v=_`​`));return t(y||(y=_` <div data-testid="customer"> ${0} <div class="text-tertiary truncate text-s">${0}</div> ${0} </div> `),this.renderTemplateOrSlot("customer:before"),s,this.renderTemplateOrSlot("customer:after"))}}customElements.define("foxy-transaction-card",x);export{x as TransactionCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-60126eee.js";import"./shared-46ee137f.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{T as s}from"./shared-1469c1c4.js";export{T as TransactionsTable}from"./shared-1469c1c4.js";import"./shared-ff79f3f9.js";import"./shared-63eaded9.js";import"./shared-d94ffc2b.js";import"./shared-1761daef.js";import"./shared-2174bcd4.js";import"./shared-593f7e2c.js";import"./shared-6d45a07b.js";import"./foxy-nucleon-element.js";import"./shared-44cfc617.js";import"./shared-00563cb0.js";import"./shared-7684cb05.js";import"./shared-a46edf4b.js";import"./shared-4e709717.js";customElements.define("foxy-transactions-table",s);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-bb824ab4.js";import"./shared-0ced76a0.js";import"./shared-3d868b17.js";import"./foxy-spinner.js";import"./foxy-i18n.js";export{U as UserForm}from"./shared-782bf922.js";import"./shared-df573cea.js";import"./shared-ff79f3f9.js";import"./shared-63eaded9.js";import"./shared-4a52d9b5.js";import"./shared-00563cb0.js";import"./shared-1761daef.js";import"./shared-593f7e2c.js";import"./shared-6d45a07b.js";import"./shared-d94ffc2b.js";import"./shared-4e709717.js";import"./shared-46ee137f.js";import"./shared-60126eee.js";import"./shared-1b7e65e4.js";import"./shared-f0a83bd6.js";import"./shared-166c44ae.js";import"./shared-ec861f31.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-396320f9.js";import"./shared-7a39a41f.js";import"./shared-44cfc617.js";import"./shared-7684cb05.js";import"./shared-b738ee96.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./shared-
|
|
1
|
+
import"./shared-0ced76a0.js";import"./foxy-form-dialog.js";import{r as e}from"./shared-782bf922.js";import"./foxy-spinner.js";import"./foxy-i18n.js";import{h as s}from"./shared-63eaded9.js";import{T as a}from"./shared-2174bcd4.js";import"./shared-df573cea.js";import"./shared-ff79f3f9.js";import"./shared-3d868b17.js";import"./shared-4a52d9b5.js";import"./shared-00563cb0.js";import"./shared-1761daef.js";import"./shared-593f7e2c.js";import"./shared-6d45a07b.js";import"./shared-d94ffc2b.js";import"./shared-4e709717.js";import"./shared-7684cb05.js";import"./shared-bb824ab4.js";import"./shared-1b7e65e4.js";import"./shared-46ee137f.js";import"./shared-f0a83bd6.js";import"./shared-166c44ae.js";import"./shared-ec861f31.js";import"./shared-87ca7818.js";import"./shared-b0f0e8b5.js";import"./shared-a46edf4b.js";import"./shared-396320f9.js";import"./shared-7a39a41f.js";import"./shared-44cfc617.js";import"./shared-b738ee96.js";import"./shared-60126eee.js";import"./foxy-nucleon-element.js";let t,r,o,d,i,m,n,l=e=>e;class f extends a{constructor(){super(...arguments),this.columns=[f.nameColumn,f.emailColumn,f.rolesColumn,f.lastUpdatedColumn,f.actionsColumn]}render(){return s(t||(t=l` <foxy-form-dialog parent="${0}" form="foxy-user-form" lang="${0}" ns="${0}" id="form"> </foxy-form-dialog> ${0} `),this.href,this.lang,this.ns,super.render())}}f.nameColumn={cell:e=>s(r||(r=l` <span data-testclass="name" class="text-m font-medium"> ${0} ${0} </span> `),e.data.first_name,e.data.last_name)},f.emailColumn={hideBelow:"md",cell:e=>s(o||(o=l` <span data-testclass="email" class="text-m text-secondary">${0}</span> `),e.data.email)},f.rolesColumn={cell:a=>s(d||(d=l` <div data-testclass="roles" class="flex space-x-s"> ${0} </div> `),["is_merchant","is_programmer","is_front_end_developer","is_designer"].map((t=>s(i||(i=l` <div class="${0}" style="width:1rem;height:1rem"> ${0} </div> `),a.data[t]?"":"text-disabled",e.find((e=>e.property===t)).icon))))},f.lastUpdatedColumn={hideBelow:"lg",cell:e=>s(m||(m=l` <span data-testclass="lastUpdated" class="text-m text-secondary font-tnum"> <foxy-i18n options="${0}" lang="${0}" key="date" ns="${0}"> </foxy-i18n> <foxy-i18n options="${0}" lang="${0}" key="time" ns="${0}"> </foxy-i18n> </span> `),JSON.stringify({value:e.data.date_modified}),e.lang,e.ns,JSON.stringify({value:e.data.date_modified}),e.lang,e.ns)},f.actionsColumn={cell:e=>s(n||(n=l` <vaadin-button data-testclass="actions" theme="tertiary small" @click="${0}"> <foxy-i18n lang="${0}" key="update" ns="${0}"></foxy-i18n> </vaadin-button> `),(s=>{const a=s.target,t=a.getRootNode().querySelector("#form");t.href=e.data._links.self.href,t.show(a)}),e.lang,e.ns)},customElements.define("foxy-users-table",f);export{f as UsersTable};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as e,A as t}from"./shared-
|
|
1
|
+
import{F as e,A as t}from"./shared-1761daef.js";class s extends t{constructor(t){super({base:new URL(document.baseURI),fetch:(...n)=>new Promise(((c,a)=>{const o="string"==typeof n[0]?new s.WHATWGRequest(...n):n[0];o.headers.set("Content-Type","application/json"),o.headers.set("FOXY-API-VERSION","1");const r=new e("fetch",{cancelable:!0,composed:!0,bubbles:!0,request:o,resolve:c,reject:a});t.dispatchEvent(r),r.defaultPrevented||fetch(o).then(c).catch(a)}))})}}s.FetchEvent=e;export{s as A};
|