@foxy.io/elements 1.24.0 → 1.24.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/cdn/foxy-address-form.js +1 -1
  2. package/dist/cdn/foxy-admin-subscription-card.js +1 -1
  3. package/dist/cdn/foxy-api-browser.js +1 -1
  4. package/dist/cdn/foxy-applied-coupon-code-form.js +1 -1
  5. package/dist/cdn/foxy-attribute-form.js +1 -1
  6. package/dist/cdn/foxy-cart-form.js +1 -1
  7. package/dist/cdn/foxy-client-form.js +1 -1
  8. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  9. package/dist/cdn/foxy-coupon-form.js +1 -1
  10. package/dist/cdn/foxy-custom-field-form.js +1 -1
  11. package/dist/cdn/foxy-customer-form.js +1 -1
  12. package/dist/cdn/foxy-customer-portal.js +1 -1
  13. package/dist/cdn/foxy-customer.js +1 -1
  14. package/dist/cdn/foxy-downloadable-form.js +1 -1
  15. package/dist/cdn/foxy-email-template-form.js +1 -1
  16. package/dist/cdn/foxy-filter-attribute-form.js +1 -1
  17. package/dist/cdn/foxy-gift-card-code-form.js +1 -1
  18. package/dist/cdn/foxy-gift-card-form.js +1 -1
  19. package/dist/cdn/foxy-integration-form.js +1 -1
  20. package/dist/cdn/foxy-item-category-form.js +1 -1
  21. package/dist/cdn/foxy-item-form.js +1 -1
  22. package/dist/cdn/foxy-item-option-form.js +1 -1
  23. package/dist/cdn/foxy-passkey-form.js +1 -1
  24. package/dist/cdn/foxy-payments-api-fraud-protection-form.js +1 -1
  25. package/dist/cdn/foxy-payments-api-payment-method-form.js +1 -1
  26. package/dist/cdn/foxy-payments-api-payment-preset-form.js +1 -1
  27. package/dist/cdn/foxy-payments-api.js +1 -1
  28. package/dist/cdn/foxy-report-form.js +2 -2
  29. package/dist/cdn/foxy-shipment-card.js +1 -1
  30. package/dist/cdn/foxy-store-form.js +1 -1
  31. package/dist/cdn/foxy-store-shipping-method-form.js +1 -1
  32. package/dist/cdn/foxy-subscription-card.js +1 -1
  33. package/dist/cdn/foxy-subscription-form.js +2 -2
  34. package/dist/cdn/foxy-subscription-settings-form.js +1 -1
  35. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  36. package/dist/cdn/foxy-tax-form.js +1 -1
  37. package/dist/cdn/foxy-template-form.js +1 -1
  38. package/dist/cdn/foxy-template-set-form.js +1 -1
  39. package/dist/cdn/foxy-transaction.js +1 -1
  40. package/dist/cdn/foxy-user-form.js +1 -1
  41. package/dist/cdn/foxy-users-table.js +1 -1
  42. package/dist/cdn/foxy-webhook-form.js +1 -1
  43. package/dist/cdn/shared-4205699e.js +1 -0
  44. package/dist/cdn/shared-5280c80a.js +1 -0
  45. package/dist/cdn/{shared-baeef007.js → shared-94798eb5.js} +1 -1
  46. package/dist/cdn/shared-fa7539af.js +46 -0
  47. package/dist/cdn/translations/address-form/en.json +1 -1
  48. package/dist/cdn/translations/admin-subscription-card/en.json +1 -0
  49. package/dist/cdn/translations/attribute-form/en.json +1 -1
  50. package/dist/cdn/translations/cart-form/en.json +47 -65
  51. package/dist/cdn/translations/client-form/en.json +1 -1
  52. package/dist/cdn/translations/coupon-code-form/en.json +1 -1
  53. package/dist/cdn/translations/coupon-form/en.json +4 -4
  54. package/dist/cdn/translations/custom-field-form/en.json +1 -1
  55. package/dist/cdn/translations/customer/en.json +5 -3
  56. package/dist/cdn/translations/customer-form/en.json +1 -1
  57. package/dist/cdn/translations/customer-portal/en.json +4 -2
  58. package/dist/cdn/translations/downloadable-form/en.json +1 -1
  59. package/dist/cdn/translations/email-template-form/en.json +1 -1
  60. package/dist/cdn/translations/gift-card-code-form/en.json +1 -1
  61. package/dist/cdn/translations/gift-card-form/en.json +3 -3
  62. package/dist/cdn/translations/item-category-form/en.json +1 -1
  63. package/dist/cdn/translations/item-form/en.json +30 -32
  64. package/dist/cdn/translations/item-option-form/en.json +1 -1
  65. package/dist/cdn/translations/passkey-form/en.json +1 -1
  66. package/dist/cdn/translations/payments-api-fraud-protection-form/en.json +1 -1
  67. package/dist/cdn/translations/payments-api-payment-method-form/en.json +1 -1
  68. package/dist/cdn/translations/payments-api-payment-preset-form/en.json +1 -1
  69. package/dist/cdn/translations/report-form/en.json +1 -1
  70. package/dist/cdn/translations/shipment-card/en.json +47 -64
  71. package/dist/cdn/translations/store-form/en.json +2 -2
  72. package/dist/cdn/translations/store-shipping-method-form/en.json +1 -1
  73. package/dist/cdn/translations/subscription-card/en.json +1 -0
  74. package/dist/cdn/translations/subscription-form/en.json +3 -2
  75. package/dist/cdn/translations/subscription-settings-form/en.json +1 -1
  76. package/dist/cdn/translations/subscriptions-table/en.json +1 -0
  77. package/dist/cdn/translations/tax-form/en.json +1 -1
  78. package/dist/cdn/translations/template-form/en.json +1 -1
  79. package/dist/cdn/translations/template-set-form/en.json +1 -1
  80. package/dist/cdn/translations/transaction/en.json +54 -69
  81. package/dist/cdn/translations/webhook-form/en.json +1 -1
  82. package/dist/elements/internal/InternalTimestampsControl/InternalTimestampsControl.d.ts +1 -3
  83. package/dist/elements/internal/InternalTimestampsControl/InternalTimestampsControl.js +18 -41
  84. package/dist/elements/internal/InternalTimestampsControl/InternalTimestampsControl.js.map +1 -1
  85. package/dist/elements/private/Metadata/Metadata.d.ts +13 -0
  86. package/dist/elements/private/Metadata/Metadata.js +27 -0
  87. package/dist/elements/private/Metadata/Metadata.js.map +1 -0
  88. package/dist/elements/private/index.d.ts +1 -1
  89. package/dist/elements/private/index.js +1 -1
  90. package/dist/elements/private/index.js.map +1 -1
  91. package/dist/elements/public/AddressForm/AddressForm.js +3 -3
  92. package/dist/elements/public/AddressForm/AddressForm.js.map +1 -1
  93. package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.js +17 -6
  94. package/dist/elements/public/AdminSubscriptionCard/AdminSubscriptionCard.js.map +1 -1
  95. package/dist/elements/public/AttributeForm/AttributeForm.js +3 -3
  96. package/dist/elements/public/AttributeForm/AttributeForm.js.map +1 -1
  97. package/dist/elements/public/CouponCodeForm/CouponCodeForm.js +4 -4
  98. package/dist/elements/public/CouponCodeForm/CouponCodeForm.js.map +1 -1
  99. package/dist/elements/public/CouponForm/CouponForm.js +4 -4
  100. package/dist/elements/public/CouponForm/CouponForm.js.map +1 -1
  101. package/dist/elements/public/CustomFieldForm/CustomFieldForm.js +3 -3
  102. package/dist/elements/public/CustomFieldForm/CustomFieldForm.js.map +1 -1
  103. package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js +4 -4
  104. package/dist/elements/public/EmailTemplateForm/EmailTemplateForm.js.map +1 -1
  105. package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js +4 -4
  106. package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js.map +1 -1
  107. package/dist/elements/public/GiftCardForm/GiftCardForm.js +4 -4
  108. package/dist/elements/public/GiftCardForm/GiftCardForm.js.map +1 -1
  109. package/dist/elements/public/ItemForm/ItemForm.js +26 -13
  110. package/dist/elements/public/ItemForm/ItemForm.js.map +1 -1
  111. package/dist/elements/public/ItemForm/index.d.ts +1 -1
  112. package/dist/elements/public/ItemForm/index.js +1 -1
  113. package/dist/elements/public/ItemForm/index.js.map +1 -1
  114. package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/InternalItemFormCartControl.d.ts +0 -1
  115. package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/InternalItemFormCartControl.js +8 -14
  116. package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/InternalItemFormCartControl.js.map +1 -1
  117. package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/index.d.ts +0 -1
  118. package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/index.js +0 -1
  119. package/dist/elements/public/ItemForm/internal/InternalItemFormCartControl/index.js.map +1 -1
  120. package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/InternalItemFormInventoryControl.d.ts +0 -1
  121. package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/InternalItemFormInventoryControl.js +13 -19
  122. package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/InternalItemFormInventoryControl.js.map +1 -1
  123. package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/index.d.ts +0 -1
  124. package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/index.js +0 -1
  125. package/dist/elements/public/ItemForm/internal/InternalItemFormInventoryControl/index.js.map +1 -1
  126. package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/InternalItemFormLineItemDiscountControl.d.ts +0 -1
  127. package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/InternalItemFormLineItemDiscountControl.js +17 -23
  128. package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/InternalItemFormLineItemDiscountControl.js.map +1 -1
  129. package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/index.d.ts +0 -1
  130. package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/index.js +0 -1
  131. package/dist/elements/public/ItemForm/internal/InternalItemFormLineItemDiscountControl/index.js.map +1 -1
  132. package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/InternalItemFormShippingControl.d.ts +0 -1
  133. package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/InternalItemFormShippingControl.js +14 -20
  134. package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/InternalItemFormShippingControl.js.map +1 -1
  135. package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/index.d.ts +0 -1
  136. package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/index.js +0 -1
  137. package/dist/elements/public/ItemForm/internal/InternalItemFormShippingControl/index.js.map +1 -1
  138. package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/InternalItemFormSubscriptionControl.d.ts +0 -1
  139. package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/InternalItemFormSubscriptionControl.js +28 -26
  140. package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/InternalItemFormSubscriptionControl.js.map +1 -1
  141. package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/index.d.ts +0 -1
  142. package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/index.js +0 -1
  143. package/dist/elements/public/ItemForm/internal/InternalItemFormSubscriptionControl/index.js.map +1 -1
  144. package/dist/elements/public/PaymentsApi/PaymentsApi.js +7 -1
  145. package/dist/elements/public/PaymentsApi/PaymentsApi.js.map +1 -1
  146. package/dist/elements/public/PaymentsApiPaymentMethodForm/PaymentsApiPaymentMethodForm.js +1 -1
  147. package/dist/elements/public/PaymentsApiPaymentMethodForm/PaymentsApiPaymentMethodForm.js.map +1 -1
  148. package/dist/elements/public/ReportForm/ReportForm.js +4 -4
  149. package/dist/elements/public/ReportForm/ReportForm.js.map +1 -1
  150. package/dist/elements/public/StoreForm/StoreForm.js +1 -1
  151. package/dist/elements/public/StoreForm/StoreForm.js.map +1 -1
  152. package/dist/elements/public/SubscriptionCard/SubscriptionCard.js +24 -12
  153. package/dist/elements/public/SubscriptionCard/SubscriptionCard.js.map +1 -1
  154. package/dist/elements/public/SubscriptionForm/SubscriptionForm.js +11 -4
  155. package/dist/elements/public/SubscriptionForm/SubscriptionForm.js.map +1 -1
  156. package/dist/elements/public/SubscriptionsTable/SubscriptionsTable.js +22 -22
  157. package/dist/elements/public/SubscriptionsTable/SubscriptionsTable.js.map +1 -1
  158. package/dist/elements/public/TaxForm/TaxForm.js +4 -4
  159. package/dist/elements/public/TaxForm/TaxForm.js.map +1 -1
  160. package/dist/elements/public/TemplateForm/TemplateForm.js +4 -4
  161. package/dist/elements/public/TemplateForm/TemplateForm.js.map +1 -1
  162. package/package.json +1 -1
  163. package/dist/cdn/shared-7fab31ac.js +0 -1
  164. package/dist/cdn/shared-e2e2ca6a.js +0 -1
  165. package/dist/cdn/shared-f29d410a.js +0 -46
  166. package/dist/elements/private/PropertyTable/PropertyTable.d.ts +0 -12
  167. package/dist/elements/private/PropertyTable/PropertyTable.js +0 -43
  168. package/dist/elements/private/PropertyTable/PropertyTable.js.map +0 -1
@@ -1 +1 @@
1
- import"./shared-9048eeb2.js";import"./shared-ef7f2d07.js";import"./shared-799dc083.js";import"./shared-f9180815.js";import"./foxy-spinner.js";import"./shared-2edcd981.js";import{h as e}from"./shared-7f33a83a.js";import{C as t}from"./shared-5cf7b194.js";import{N as a}from"./shared-9b12aeac.js";import{P as i}from"./shared-7fab31ac.js";import{S as s,T as r,a as o}from"./shared-3b709ddc.js";import{c as d}from"./shared-4e709717.js";import{i as n}from"./shared-d3bf9ac0.js";import{m as l}from"./shared-4c2e9064.js";import"./shared-eb8a0fdf.js";import"./shared-e5239bec.js";import"./shared-3f04e4cc.js";import"./shared-fff03a45.js";import"./shared-5784c088.js";import"./shared-7abbc95c.js";import"./shared-621b3283.js";import"./shared-35728235.js";import"./shared-343d1fd7.js";import"./shared-fd96bcd1.js";import"./shared-b446c140.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";const h={AF:[],AX:[],AL:[],DZ:[],AS:[],AD:[],AO:[],AI:[],AQ:[],AG:[],AR:[],AM:[],AW:[],AU:["ACT","NSW","NT","QLD","SA","TAS","VIC","WA"],AT:["BL","KN","NO","OO","SB","ST","TI","VB","WI"],AZ:[],BS:[],BH:[],BD:[],BB:[],BY:[],BE:[],BZ:[],BJ:[],BM:[],BT:[],BO:[],BQ:["BO","SA","SE"],BA:[],BW:[],BV:[],BR:[],IO:[],BN:[],BG:[],BF:[],BI:[],KH:[],CM:[],CA:["AB","BC","MB","NB","NL","NT","NS","NU","ON","PE","QC","SK","YT"],CV:[],CW:[],KY:[],CF:[],TD:[],CL:[],CN:[],CX:[],CC:[],CO:[],KM:[],CG:[],CD:[],CK:[],CR:[],CI:[],HR:[],CU:[],CY:[],CZ:[],DK:[],DJ:[],DM:[],DO:[],EC:[],EG:[],SV:[],SX:[],GQ:[],ER:[],EE:[],ET:[],FK:[],FO:[],FJ:[],FI:[],FR:[],GF:[],PF:[],TF:[],GA:[],GM:[],GE:[],DE:["BW","BY","BE","BB","HB","HH","HE","MV","NI","NW","RP","SL","SN","ST","SH","TH"],GH:[],GI:[],GR:[],GL:[],GD:[],GP:[],GU:[],GT:[],GG:[],GN:[],GW:[],GY:[],HT:[],HM:[],VA:[],HN:[],HK:[],HU:[],IS:[],IN:["AN","AP","AR","AS","BR","CH","CT","DN","DD","DL","GA","GJ","HR","HP","JK","JH","KA","KL","LD","MP","MH","MN","ML","MZ","NL","OR","PY","PB","RJ","SK","TN","TG","TR","UT","UP","WB"],ID:[],IR:[],IQ:[],IE:["CW","CN","CE","CO","DL","D","G","KY","KE","KK","LS","LM","LK","LD","LH","MO","MH","MN","OY","RN","SO","TA","WD","WH","WX","WW"],IM:[],IL:[],IT:[],JM:[],JP:["10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","05","02","07","01","08","03","04","09","06"],JE:[],JO:[],KZ:[],KE:[],KI:[],KP:[],KR:[],KW:[],KG:[],LA:[],LV:[],LB:[],LS:[],LR:[],LY:[],LI:[],LT:[],LU:[],MO:[],MK:[],MG:[],MW:[],MY:[],MV:[],ML:[],MT:[],MH:[],MQ:[],MR:[],MU:[],YT:[],MX:[],FM:[],MD:[],MC:[],MN:[],ME:[],MS:[],MA:[],MZ:[],MM:[],NA:[],NR:[],NP:[],NL:[],NC:[],NZ:[],NI:[],NE:[],NG:[],NU:[],NF:[],MP:[],NO:["10","11","12","14","15","16","17","18","19","20","30","34","38","42","46","50","54","01","02","03","04","05","06","07","08","09"],OM:[],PK:[],PW:[],PS:[],PA:[],PG:[],PY:[],PE:[],PH:[],PN:[],PL:[],PT:[],PR:[],QA:[],RE:[],RO:[],RU:[],RW:[],BL:[],SH:[],KN:[],LC:[],MF:[],PM:[],VC:[],WS:[],SM:[],SS:[],ST:[],SA:[],SN:[],RS:[],SC:[],SL:[],SG:[],SK:[],SI:[],SB:[],SO:[],ZA:[],GS:[],ES:["A Coruna","Alava","Albacete","Alicante","Almeria","Asturias","Avila","Badajoz","Baleares","Barcelona","Burgos","Caceres","Cadiz","CN","Cantabria","Castellon","Ceuta","Ciudad Real","Cordoba","Cuenca","Gipuzkoa","Girona","Granada","Guadalajara","Guipuzcoa","Huelva","Huesca","Jaen","La Rioja","Las Palmas","Leon","Lleida","Lugo","Madrid","Malaga","Melilla","Murcia","Navarra","Ourense","Palencia","Pontevedra","Salamanca","Santa Cruz de Tenerife","Segovia","Sevilla","Soria","Tarragona","Teruel","Toledo","Valencia","Valladolid","Vizcaya","Zamora","Zaragoza"],LK:[],SD:[],SR:[],SJ:[],SZ:[],SE:[],CH:["AG","AR","AI","BL","BS","BE","FR","GE","GL","GR","JU","LU","NE","NW","OW","SH","SZ","SO","SG","TI","TG","UR","VS","VD","ZH","ZG"],SY:[],TW:[],TJ:[],TZ:[],TH:[],TL:[],TG:[],TK:[],TO:[],TT:[],TN:[],TR:[],TM:[],TC:[],TV:[],UG:[],UA:[],AE:[],GB:[],US:["AL","AK","AS","AZ","AR","AF","AA","AC","AE","AM","AP","CA","CO","CT","DE","DC","FM","FL","GA","GU","HI","ID","IL","IN","IA","KS","KY","LA","ME","MH","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","MP","OH","OK","OR","PA","PR","RI","SC","SD","TN","TX","UT","VT","VI","VA","WA","WV","WI","WY"],UM:[],UY:[],UZ:[],VU:[],VE:[],VN:[],VG:[],VI:[],WF:[],EH:[],YE:[],ZM:[],ZW:[]};let m,c,_,u,f,p,S=e=>e;const g=s(t(r(o(a,"address-form"))));class b extends g{constructor(){super(...arguments),this.templates={},this.__getValidator=l((e=>()=>!this.errors.some((t=>t.startsWith(e))))),this.__bindField=l((e=>t=>{const a=t.currentTarget;this.edit({[e]:a.value})})),this.__maybeRenderCountry=()=>{var t,a;const i="country";if(this.hiddenSelector.matches(i))return"";const s=Object.keys(h);return e(m||(m=S` <div> ${0} <vaadin-combo-box class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" item-value-path="code" item-label-path="text" .checkValidity="${0}" .items="${0}" ?readonly="${0}" ?disabled="${0}" @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot(`${i}:before`),this.t(i).toString(),n(null===(a=null===(t=this.form)||void 0===t?void 0:t[i])||void 0===a?void 0:a.toString()),this.__getErrorMessage(i),i,this.__getValidator(i),s.map((e=>({text:this.t(`country_${e.toLowerCase()}`),code:e}))),this.readonlySelector.matches(i,!0),!this.in("idle")||this.disabledSelector.matches(i,!0),(e=>{const t=e.currentTarget;this.edit({country:t.value,region:""})}),this.renderTemplateOrSlot(`${i}:after`))},this.__maybeRenderRegion=()=>{var t,a,i,s,r;const o="region";if(this.hiddenSelector.matches(o))return"";const d=null!==(a=h[null!==(t=this.form.country)&&void 0!==t?t:""])&&void 0!==a?a:[],l=null!==(i=this.form.country)&&void 0!==i?i:"";return e(c||(c=S` <div> ${0} <vaadin-combo-box class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" item-value-path="code" item-label-path="text" .checkValidity="${0}" .items="${0}" ?allow-custom-value="${0}" ?readonly="${0}" ?disabled="${0}" @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot(`${o}:before`),this.t(o).toString(),n(null===(r=null===(s=this.form)||void 0===s?void 0:s[o])||void 0===r?void 0:r.toString()),this.__getErrorMessage(o),o,this.__getValidator(o),d.map((e=>({text:this.t(`country_${l.toLowerCase()}_region_${e.toLowerCase()}`),code:e}))),0===d.length,this.readonlySelector.matches(o,!0),!this.in("idle")||this.disabledSelector.matches(o,!0),this.__bindField(o),this.renderTemplateOrSlot(`${o}:after`))},this.__maybeRenderTextField=t=>{var a,i;const{field:s,wide:r=!1,readonly:o=!1,required:l=!1}=t,h=s.replace(/_/,"-").replace("1","-one").replace("2","-two");return this.hiddenSelector.matches(h)?"":e(_||(_=S` <div class="${0}"> ${0} <vaadin-text-field class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" .checkValidity="${0}" ?disabled="${0}" ?required="${0}" ?readonly="${0}" @input="${0}" @keydown="${0}"> </vaadin-text-field> ${0} </div> `),d({"col-span-2":r}),this.renderTemplateOrSlot(`${h}:before`),this.t(s).toString(),n(null===(i=null===(a=this.form)||void 0===a?void 0:a[s])||void 0===i?void 0:i.toString()),this.__getErrorMessage(s),h,this.__getValidator(s),!this.in("idle")||this.disabledSelector.matches(h),l,o||this.readonlySelector.matches(h),this.__bindField(s),this.__handleKeyDown,this.renderTemplateOrSlot(`${h}:after`))},this.__renderTimestamps=()=>{const t=["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])}):""}}));return e(u||(u=S` <div> ${0} <x-property-table .items="${0}" data-testid="timestamps"></x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),t,this.renderTemplateOrSlot("timestamps:after"))},this.__renderAction=t=>{var a,i;const s=this.in({idle:{template:{dirty:"valid"}}}),r=this.in({idle:{snapshot:{dirty:"valid"}}}),o=!this.in("idle")||this.disabledSelector.matches(t,!0),d=!!(null===(a=this.form)||void 0===a?void 0:a.is_default_shipping),n=!!(null===(i=this.form)||void 0===i?void 0:i.is_default_billing),l=d||n,h=s||r;return e(f||(f=S` <div> ${0} <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(`${t}:before`),this.in("idle")?""+(this.href?"error":"primary success"):"",t,this.in({idle:"template"})&&!h||o||l,this.__handleActionClick,this.ns,t,this.lang,this.renderTemplateOrSlot(`${t}:after`))}}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"x-property-table":i,"vaadin-button":customElements.get("vaadin-button"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n")}}static get v8n(){return[({address_name:e})=>e&&e.length>0||"address_name_required",({address_name:e})=>!e||e.length<=100||"address_name_too_long",({first_name:e})=>!e||e.length<=50||"first_name_too_long",({last_name:e})=>!e||e.length<=50||"last_name_too_long",({region:e})=>!e||e.length<=50||"region_too_long",({city:e})=>!e||e.length<=50||"city_too_long",({phone:e})=>!e||e.length<=50||"phone_too_long",({company:e})=>!e||e.length<=50||"company_too_long",({address2:e})=>!e||e.length<=100||"address2_too_long",({address1:e})=>e&&e.length>0||"address1_required",({address1:e})=>e&&e.length<=100||"address1_too_long",({postal_code:e})=>!e||e.length<=50||"postal_code_too_long"]}connectedCallback(){super.connectedCallback(),customElements.get("foxy-i18n").i18next.loadNamespaces(["country","region"])}render(){var t,a,i,s;const{hiddenSelector:r,lang:o,ns:n}=this,l=this.href?"delete":"create",h=!!(null===(t=this.form)||void 0===t?void 0:t.is_default_shipping),m=!!(null===(a=this.form)||void 0===a?void 0:a.is_default_billing),c=h||m,_=this.in("busy"),u=this.in("fail");return e(p||(p=S` <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> <div class="space-y-l font-lumo text-m leading-m text-body relative" aria-busy="${0}" aria-live="polite" data-testid="wrapper"> <div class="grid grid-cols-2 gap-m"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} </div> ${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> `),o,n,this.__handleConfirmHide,this.in("busy"),this.__maybeRenderTextField({field:"address_name",wide:!0,readonly:c,required:!0}),this.__maybeRenderTextField({field:"first_name"}),this.__maybeRenderTextField({field:"last_name"}),this.__maybeRenderTextField({field:"company"}),this.__maybeRenderTextField({field:"phone"}),this.__maybeRenderTextField({field:"address1",wide:!0,required:!0}),this.__maybeRenderTextField({field:"address2",wide:!0}),this.__maybeRenderCountry(),this.__maybeRenderRegion(),this.__maybeRenderTextField({field:"city"}),this.__maybeRenderTextField({field:"postal_code"}),!this.data||r.matches("timestamps",!0)?"":this.__renderTimestamps(),r.matches(l,!0)?"":this.__renderAction(l),d({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!_&&!u}),u?"error":_?"busy":"empty",o,this.ns,null!==(s=null===(i=customElements.get("foxy-spinner"))||void 0===i?void 0:i.defaultNS)&&void 0!==s?s:"")}disconnectedCallback(){var e,t;super.disconnectedCallback(),null===(t=(e=this.__getValidator.cache).clear)||void 0===t||t.call(e)}__handleKeyDown(e){"Enter"===e.key&&this.submit()}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__handleActionClick(e){if(this.in({idle:"snapshot"})){this.renderRoot.querySelector("#confirm").show(e.currentTarget)}else this.submit()}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}customElements.define("foxy-address-form",b);export{b as AddressForm};
1
+ import"./shared-9048eeb2.js";import"./shared-ef7f2d07.js";import"./shared-799dc083.js";import"./shared-f9180815.js";import"./foxy-spinner.js";import"./shared-2edcd981.js";import{h as e}from"./shared-7f33a83a.js";import{C as t}from"./shared-5cf7b194.js";import{N as a}from"./shared-9b12aeac.js";import{M as i}from"./shared-4205699e.js";import{S as s,T as r,a as d}from"./shared-3b709ddc.js";import{c as o}from"./shared-4e709717.js";import{i as n}from"./shared-d3bf9ac0.js";import{m as l}from"./shared-4c2e9064.js";import"./shared-eb8a0fdf.js";import"./shared-e5239bec.js";import"./shared-3f04e4cc.js";import"./shared-fff03a45.js";import"./shared-5784c088.js";import"./shared-7abbc95c.js";import"./shared-621b3283.js";import"./shared-35728235.js";import"./shared-343d1fd7.js";import"./shared-fd96bcd1.js";import"./shared-b446c140.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";const m={AF:[],AX:[],AL:[],DZ:[],AS:[],AD:[],AO:[],AI:[],AQ:[],AG:[],AR:[],AM:[],AW:[],AU:["ACT","NSW","NT","QLD","SA","TAS","VIC","WA"],AT:["BL","KN","NO","OO","SB","ST","TI","VB","WI"],AZ:[],BS:[],BH:[],BD:[],BB:[],BY:[],BE:[],BZ:[],BJ:[],BM:[],BT:[],BO:[],BQ:["BO","SA","SE"],BA:[],BW:[],BV:[],BR:[],IO:[],BN:[],BG:[],BF:[],BI:[],KH:[],CM:[],CA:["AB","BC","MB","NB","NL","NT","NS","NU","ON","PE","QC","SK","YT"],CV:[],CW:[],KY:[],CF:[],TD:[],CL:[],CN:[],CX:[],CC:[],CO:[],KM:[],CG:[],CD:[],CK:[],CR:[],CI:[],HR:[],CU:[],CY:[],CZ:[],DK:[],DJ:[],DM:[],DO:[],EC:[],EG:[],SV:[],SX:[],GQ:[],ER:[],EE:[],ET:[],FK:[],FO:[],FJ:[],FI:[],FR:[],GF:[],PF:[],TF:[],GA:[],GM:[],GE:[],DE:["BW","BY","BE","BB","HB","HH","HE","MV","NI","NW","RP","SL","SN","ST","SH","TH"],GH:[],GI:[],GR:[],GL:[],GD:[],GP:[],GU:[],GT:[],GG:[],GN:[],GW:[],GY:[],HT:[],HM:[],VA:[],HN:[],HK:[],HU:[],IS:[],IN:["AN","AP","AR","AS","BR","CH","CT","DN","DD","DL","GA","GJ","HR","HP","JK","JH","KA","KL","LD","MP","MH","MN","ML","MZ","NL","OR","PY","PB","RJ","SK","TN","TG","TR","UT","UP","WB"],ID:[],IR:[],IQ:[],IE:["CW","CN","CE","CO","DL","D","G","KY","KE","KK","LS","LM","LK","LD","LH","MO","MH","MN","OY","RN","SO","TA","WD","WH","WX","WW"],IM:[],IL:[],IT:[],JM:[],JP:["10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","05","02","07","01","08","03","04","09","06"],JE:[],JO:[],KZ:[],KE:[],KI:[],KP:[],KR:[],KW:[],KG:[],LA:[],LV:[],LB:[],LS:[],LR:[],LY:[],LI:[],LT:[],LU:[],MO:[],MK:[],MG:[],MW:[],MY:[],MV:[],ML:[],MT:[],MH:[],MQ:[],MR:[],MU:[],YT:[],MX:[],FM:[],MD:[],MC:[],MN:[],ME:[],MS:[],MA:[],MZ:[],MM:[],NA:[],NR:[],NP:[],NL:[],NC:[],NZ:[],NI:[],NE:[],NG:[],NU:[],NF:[],MP:[],NO:["10","11","12","14","15","16","17","18","19","20","30","34","38","42","46","50","54","01","02","03","04","05","06","07","08","09"],OM:[],PK:[],PW:[],PS:[],PA:[],PG:[],PY:[],PE:[],PH:[],PN:[],PL:[],PT:[],PR:[],QA:[],RE:[],RO:[],RU:[],RW:[],BL:[],SH:[],KN:[],LC:[],MF:[],PM:[],VC:[],WS:[],SM:[],SS:[],ST:[],SA:[],SN:[],RS:[],SC:[],SL:[],SG:[],SK:[],SI:[],SB:[],SO:[],ZA:[],GS:[],ES:["A Coruna","Alava","Albacete","Alicante","Almeria","Asturias","Avila","Badajoz","Baleares","Barcelona","Burgos","Caceres","Cadiz","CN","Cantabria","Castellon","Ceuta","Ciudad Real","Cordoba","Cuenca","Gipuzkoa","Girona","Granada","Guadalajara","Guipuzcoa","Huelva","Huesca","Jaen","La Rioja","Las Palmas","Leon","Lleida","Lugo","Madrid","Malaga","Melilla","Murcia","Navarra","Ourense","Palencia","Pontevedra","Salamanca","Santa Cruz de Tenerife","Segovia","Sevilla","Soria","Tarragona","Teruel","Toledo","Valencia","Valladolid","Vizcaya","Zamora","Zaragoza"],LK:[],SD:[],SR:[],SJ:[],SZ:[],SE:[],CH:["AG","AR","AI","BL","BS","BE","FR","GE","GL","GR","JU","LU","NE","NW","OW","SH","SZ","SO","SG","TI","TG","UR","VS","VD","ZH","ZG"],SY:[],TW:[],TJ:[],TZ:[],TH:[],TL:[],TG:[],TK:[],TO:[],TT:[],TN:[],TR:[],TM:[],TC:[],TV:[],UG:[],UA:[],AE:[],GB:[],US:["AL","AK","AS","AZ","AR","AF","AA","AC","AE","AM","AP","CA","CO","CT","DE","DC","FM","FL","GA","GU","HI","ID","IL","IN","IA","KS","KY","LA","ME","MH","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","MP","OH","OK","OR","PA","PR","RI","SC","SD","TN","TX","UT","VT","VI","VA","WA","WV","WI","WY"],UM:[],UY:[],UZ:[],VU:[],VE:[],VN:[],VG:[],VI:[],WF:[],EH:[],YE:[],ZM:[],ZW:[]};let h,c,_,u,f,p,S=e=>e;const g=s(t(r(d(a,"address-form"))));class v extends g{constructor(){super(...arguments),this.templates={},this.__getValidator=l((e=>()=>!this.errors.some((t=>t.startsWith(e))))),this.__bindField=l((e=>t=>{const a=t.currentTarget;this.edit({[e]:a.value})})),this.__maybeRenderCountry=()=>{var t,a;const i="country";if(this.hiddenSelector.matches(i))return"";const s=Object.keys(m);return e(h||(h=S` <div> ${0} <vaadin-combo-box class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" item-value-path="code" item-label-path="text" .checkValidity="${0}" .items="${0}" ?readonly="${0}" ?disabled="${0}" @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot(`${i}:before`),this.t(i).toString(),n(null===(a=null===(t=this.form)||void 0===t?void 0:t[i])||void 0===a?void 0:a.toString()),this.__getErrorMessage(i),i,this.__getValidator(i),s.map((e=>({text:this.t(`country_${e.toLowerCase()}`),code:e}))),this.readonlySelector.matches(i,!0),!this.in("idle")||this.disabledSelector.matches(i,!0),(e=>{const t=e.currentTarget;this.edit({country:t.value,region:""})}),this.renderTemplateOrSlot(`${i}:after`))},this.__maybeRenderRegion=()=>{var t,a,i,s,r;const d="region";if(this.hiddenSelector.matches(d))return"";const o=null!==(a=m[null!==(t=this.form.country)&&void 0!==t?t:""])&&void 0!==a?a:[],l=null!==(i=this.form.country)&&void 0!==i?i:"";return e(c||(c=S` <div> ${0} <vaadin-combo-box class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" item-value-path="code" item-label-path="text" .checkValidity="${0}" .items="${0}" ?allow-custom-value="${0}" ?readonly="${0}" ?disabled="${0}" @change="${0}"> </vaadin-combo-box> ${0} </div> `),this.renderTemplateOrSlot(`${d}:before`),this.t(d).toString(),n(null===(r=null===(s=this.form)||void 0===s?void 0:s[d])||void 0===r?void 0:r.toString()),this.__getErrorMessage(d),d,this.__getValidator(d),o.map((e=>({text:this.t(`country_${l.toLowerCase()}_region_${e.toLowerCase()}`),code:e}))),0===o.length,this.readonlySelector.matches(d,!0),!this.in("idle")||this.disabledSelector.matches(d,!0),this.__bindField(d),this.renderTemplateOrSlot(`${d}:after`))},this.__maybeRenderTextField=t=>{var a,i;const{field:s,wide:r=!1,readonly:d=!1,required:l=!1}=t,m=s.replace(/_/,"-").replace("1","-one").replace("2","-two");return this.hiddenSelector.matches(m)?"":e(_||(_=S` <div class="${0}"> ${0} <vaadin-text-field class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" .checkValidity="${0}" ?disabled="${0}" ?required="${0}" ?readonly="${0}" @input="${0}" @keydown="${0}"> </vaadin-text-field> ${0} </div> `),o({"col-span-2":r}),this.renderTemplateOrSlot(`${m}:before`),this.t(s).toString(),n(null===(i=null===(a=this.form)||void 0===a?void 0:a[s])||void 0===i?void 0:i.toString()),this.__getErrorMessage(s),m,this.__getValidator(s),!this.in("idle")||this.disabledSelector.matches(m),l,d||this.readonlySelector.matches(m),this.__bindField(s),this.__handleKeyDown,this.renderTemplateOrSlot(`${m}:after`))},this.__renderTimestamps=()=>{const t=["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])}):""}}));return e(u||(u=S` <div> ${0} <x-metadata .items="${0}" data-testid="timestamps"></x-metadata> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),t,this.renderTemplateOrSlot("timestamps:after"))},this.__renderAction=t=>{var a,i;const s=this.in({idle:{template:{dirty:"valid"}}}),r=this.in({idle:{snapshot:{dirty:"valid"}}}),d=!this.in("idle")||this.disabledSelector.matches(t,!0),o=!!(null===(a=this.form)||void 0===a?void 0:a.is_default_shipping),n=!!(null===(i=this.form)||void 0===i?void 0:i.is_default_billing),l=o||n,m=s||r;return e(f||(f=S` <div> ${0} <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(`${t}:before`),this.in("idle")?""+(this.href?"error":"primary success"):"",t,this.in({idle:"template"})&&!m||d||l,this.__handleActionClick,this.ns,t,this.lang,this.renderTemplateOrSlot(`${t}:after`))}}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-combo-box":customElements.get("vaadin-combo-box"),"x-metadata":i,"vaadin-button":customElements.get("vaadin-button"),"foxy-spinner":customElements.get("foxy-spinner"),"foxy-i18n":customElements.get("foxy-i18n")}}static get v8n(){return[({address_name:e})=>e&&e.length>0||"address_name_required",({address_name:e})=>!e||e.length<=100||"address_name_too_long",({first_name:e})=>!e||e.length<=50||"first_name_too_long",({last_name:e})=>!e||e.length<=50||"last_name_too_long",({region:e})=>!e||e.length<=50||"region_too_long",({city:e})=>!e||e.length<=50||"city_too_long",({phone:e})=>!e||e.length<=50||"phone_too_long",({company:e})=>!e||e.length<=50||"company_too_long",({address2:e})=>!e||e.length<=100||"address2_too_long",({address1:e})=>e&&e.length>0||"address1_required",({address1:e})=>e&&e.length<=100||"address1_too_long",({postal_code:e})=>!e||e.length<=50||"postal_code_too_long"]}connectedCallback(){super.connectedCallback(),customElements.get("foxy-i18n").i18next.loadNamespaces(["country","region"])}render(){var t,a,i,s;const{hiddenSelector:r,lang:d,ns:n}=this,l=this.href?"delete":"create",m=!!(null===(t=this.form)||void 0===t?void 0:t.is_default_shipping),h=!!(null===(a=this.form)||void 0===a?void 0:a.is_default_billing),c=m||h,_=this.in("busy"),u=this.in("fail");return e(p||(p=S` <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> <div class="space-y-l font-lumo text-m leading-m text-body relative" aria-busy="${0}" aria-live="polite" data-testid="wrapper"> <div class="grid grid-cols-2 gap-m"> ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} ${0} </div> ${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> `),d,n,this.__handleConfirmHide,this.in("busy"),this.__maybeRenderTextField({field:"address_name",wide:!0,readonly:c,required:!0}),this.__maybeRenderTextField({field:"first_name"}),this.__maybeRenderTextField({field:"last_name"}),this.__maybeRenderTextField({field:"company"}),this.__maybeRenderTextField({field:"phone"}),this.__maybeRenderTextField({field:"address1",wide:!0,required:!0}),this.__maybeRenderTextField({field:"address2",wide:!0}),this.__maybeRenderCountry(),this.__maybeRenderRegion(),this.__maybeRenderTextField({field:"city"}),this.__maybeRenderTextField({field:"postal_code"}),!this.data||r.matches("timestamps",!0)?"":this.__renderTimestamps(),r.matches(l,!0)?"":this.__renderAction(l),o({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!_&&!u}),u?"error":_?"busy":"empty",d,this.ns,null!==(s=null===(i=customElements.get("foxy-spinner"))||void 0===i?void 0:i.defaultNS)&&void 0!==s?s:"")}disconnectedCallback(){var e,t;super.disconnectedCallback(),null===(t=(e=this.__getValidator.cache).clear)||void 0===t||t.call(e)}__handleKeyDown(e){"Enter"===e.key&&this.submit()}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__handleActionClick(e){if(this.in({idle:"snapshot"})){this.renderRoot.querySelector("#confirm").show(e.currentTarget)}else this.submit()}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}customElements.define("foxy-address-form",v);export{v as AddressForm};
@@ -1 +1 @@
1
- import"./shared-584174ff.js";import"./foxy-nucleon-element.js";import"./shared-2edcd981.js";import{_ as e}from"./shared-4c2e9064.js";import{a as t}from"./shared-3b709ddc.js";import{C as r}from"./shared-5cf7b194.js";import{p as i}from"./shared-630a0ff2.js";import{I as s}from"./shared-31d8e3b8.js";import{i as o}from"./shared-d3bf9ac0.js";import{h as a}from"./shared-7f33a83a.js";import"./foxy-spinner.js";import"./shared-5784c088.js";import"./shared-e5239bec.js";import"./shared-b446c140.js";import"./shared-fd96bcd1.js";import"./shared-343d1fd7.js";import"./shared-9b12aeac.js";import"./shared-35728235.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";import"./shared-4e709717.js";let n,d,l,_,c,u,m,p=e=>e;const f=r(t(s,"admin-subscription-card"));class h extends f{constructor(){super(...arguments),this.localeCodes=null,this.__transactionTemplateLoaderId="transactionTemplateLoader",this.__defaultTemplateSetLoaderId="defaultTemplateSetLoader",this.__localeCodesHelperLoaderId="localeCodesLoader",this.__templateSetLoaderId="templateSetLoader",this.__itemsLoaderId="itemsLoader",this.__storeLoaderId="storeLoader"}static get properties(){return e(e({},super.properties),{},{localeCodes:{attribute:"locale-codes"}})}renderBody(){var e;const t=!!(null===(e=this.data)||void 0===e?void 0:e.first_failed_transaction_date),r=this.__transactionTemplate,i=this.__priceKey,s=this.__priceOptions,f=this.__summaryOptions,h=this.__summaryKey,v=this.__statusKey,y=this.__statusOptions;return a(n||(n=p` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <div class="text-left leading-s text-tertiary"> <div class="flex items-center space-x-s"> <span class="block flex-1 font-medium text-body truncate"> ${0} </span> <span class="text-s"> ${0} </span> </div> <div class="truncate text-s ${0}"> ${0} </div> <div class="text-tertiary truncate text-s">${0}&ZeroWidthSpace;</div> </div> `),o(this.__transactionTemplateHref),this.__transactionTemplateLoaderId,(()=>this.requestUpdate()),o(this.__defaultTemplateSetHref),this.__defaultTemplateSetLoaderId,(()=>this.requestUpdate()),o(this.__localeCodesHelperHref),this.__localeCodesHelperLoaderId,(()=>this.requestUpdate()),o(this.__templateSetHref),this.__templateSetLoaderId,(()=>this.requestUpdate()),o(this.__itemsHref),this.__itemsLoaderId,(()=>this.requestUpdate()),o(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),f&&h?a(d||(d=p`<foxy-i18n infer="" key="${0}" .options="${0}"></foxy-i18n>`),h,f):a(l||(l=p`&ZeroWidthSpace;`)),s&&i?a(_||(_=p`<foxy-i18n infer="" key="${0}" .options="${0}"></foxy-i18n>`),i,s):a(c||(c=p`&ZeroWidthSpace;`)),t?"text-error":"text-secondary",y&&v?a(u||(u=p`<foxy-i18n infer="" key="${0}" .options="${0}"></foxy-i18n>`),v,y):a(m||(m=p`&ZeroWidthSpace;`)),null==r?void 0:r.customer_email)}get isBodyReady(){const e=!!this.__items&&!!this.__currencyCode&&!!this.__currencyDisplay;return super.isBodyReady&&e}get __transactionTemplateHref(){var e,t;const r=this.data;if(!r)return;if("_embedded"in r&&"fx:transaction_template"in r._embedded)return;const i=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:transaction_template"].href)&&void 0!==t?t:"");return i.searchParams.set("zoom","items"),i.toString()}get __defaultTemplateSetHref(){var e,t,r;if(""===(null===(e=this.__transactionTemplate)||void 0===e?void 0:e.template_set_uri))try{const e=new URL(null!==(r=null===(t=this.__store)||void 0===t?void 0:t._links["fx:template_sets"].href)&&void 0!==r?r:"");return e.searchParams.set("code","DEFAULT"),e.toString()}catch(e){}}get __localeCodesHelperHref(){var e;if(this.__defaultTemplateSetHref||this.__templateSetHref)return null!==(e=this.localeCodes)&&void 0!==e?e:void 0}get __templateSetHref(){const e=this.__transactionTemplate;if(!(null==e?void 0:e.currency_code))return(null==e?void 0:e.template_set_uri)||void 0}get __itemsHref(){const e=this.__transactionTemplate;if(!e)return;if("_embedded"in e&&"fx:items"in e._embedded)return;const t=new URL(e._links["fx:items"].href);return t.searchParams.set("limit","1"),t.toString()}get __storeHref(){var e,t;return null===(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:store"])||void 0===t?void 0:t.href}get __transactionTemplate(){var e,t;const r=this.data;if(r&&"_embedded"in r&&"fx:transaction_template"in r._embedded)return r._embedded["fx:transaction_template"];{const r=`#${this.__transactionTemplateLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}}get __defaultTemplateSet(){var e,t;const r=`#${this.__defaultTemplateSetLoaderId}`,i=this.renderRoot.querySelector(r);return null!==(t=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e._embedded["fx:template_sets"][0])&&void 0!==t?t:null}get __localeCodesHelper(){var e,t;const r=`#${this.__localeCodesHelperLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __templateSet(){var e,t;const r=`#${this.__templateSetLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __items(){const e=this.__transactionTemplate;if(e&&"_embedded"in e&&"fx:items"in e._embedded){const t=e._embedded["fx:items"];return{array:t,count:t.length,isApproximateCount:20===t.length}}const t=this.renderRoot.querySelector(`#${this.__itemsLoaderId}`);return(null==t?void 0:t.data)?{array:t.data._embedded["fx:items"],count:t.data.total_items,isApproximateCount:!1}:null}get __store(){var e,t;const r=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __currencyDisplay(){var e;const t=null===(e=this.__store)||void 0===e?void 0:e.use_international_currency_symbol;return!0===t?"code":!1===t?"symbol":void 0}get __summaryOptions(){var e;const{array:t,count:r}=null!==(e=this.__items)&&void 0!==e?e:{};if(t&&r)return{firstItem:t[0],count:r,countMinus1:r-1}}get __summaryKey(){const e=this.__items;if(e)return e.isApproximateCount?"summary_approximate":"summary"}get __statusOptions(){var e,t;const r=this.data,i=null!==(t=null!==(e=null==r?void 0:r.first_failed_transaction_date)&&void 0!==e?e:null==r?void 0:r.end_date)&&void 0!==t?t:null==r?void 0:r.next_transaction_date;if(i)return{date:i}}get __currencyCode(){var e,t,r;const i=this.__transactionTemplate;if(null==i?void 0:i.currency_code)return i.currency_code;{const i=this.__localeCodesHelper,s=null===(t=null!==(e=this.__templateSet)&&void 0!==e?e:this.__defaultTemplateSet)||void 0===t?void 0:t.locale_code,o=s?null==i?void 0:i.values[s]:void 0;if(o)return null===(r=/Currency: ([A-Z]{3})/g.exec(o))||void 0===r?void 0:r[1]}}get __priceOptions(){var t,r;const s=this.__currencyDisplay;if(void 0===s)return;const o=this.__currencyCode;if(void 0===o)return;const a=null===(t=this.__transactionTemplate)||void 0===t?void 0:t.total_order;if(void 0===a)return;const n=null===(r=this.data)||void 0===r?void 0:r.frequency;return void 0!==n?e(e({},i(n)),{},{amount:`${a} ${o}`,currencyDisplay:s}):void 0}get __statusKey(){const e=this.data;if(null!==e){if(e.first_failed_transaction_date)return"subscription_failed";if(e.end_date){return new Date(e.end_date).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}return"subscription_"+(e.is_active?"active":"inactive")}}get __priceKey(){var e;const t=null===(e=this.data)||void 0===e?void 0:e.frequency;if(t)return"price_"+(".5m"===t?"twice_a_month":"recurring")}}customElements.define("foxy-admin-subscription-card",h);export{h as AdminSubscriptionCard};
1
+ import"./shared-584174ff.js";import"./foxy-nucleon-element.js";import"./shared-2edcd981.js";import{_ as e}from"./shared-4c2e9064.js";import{a as t}from"./shared-3b709ddc.js";import{C as r}from"./shared-5cf7b194.js";import{p as i}from"./shared-630a0ff2.js";import{I as s}from"./shared-31d8e3b8.js";import{i as a}from"./shared-d3bf9ac0.js";import{h as o}from"./shared-7f33a83a.js";import"./foxy-spinner.js";import"./shared-5784c088.js";import"./shared-e5239bec.js";import"./shared-b446c140.js";import"./shared-fd96bcd1.js";import"./shared-343d1fd7.js";import"./shared-9b12aeac.js";import"./shared-35728235.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";import"./shared-4e709717.js";let n,d,l,_,c,u,m,p=e=>e;const f=r(t(s,"admin-subscription-card"));class h extends f{constructor(){super(...arguments),this.localeCodes=null,this.__transactionTemplateLoaderId="transactionTemplateLoader",this.__defaultTemplateSetLoaderId="defaultTemplateSetLoader",this.__localeCodesHelperLoaderId="localeCodesLoader",this.__templateSetLoaderId="templateSetLoader",this.__itemsLoaderId="itemsLoader",this.__storeLoaderId="storeLoader"}static get properties(){return e(e({},super.properties),{},{localeCodes:{attribute:"locale-codes"}})}renderBody(){var e;const t=!!(null===(e=this.data)||void 0===e?void 0:e.first_failed_transaction_date),r=this.__transactionTemplate,i=this.__priceKey,s=this.__priceOptions,f=this.__summaryOptions,h=this.__summaryKey,v=this.__statusKey,y=this.__statusOptions;return o(n||(n=p` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <div class="text-left leading-s text-tertiary"> <div class="flex items-center space-x-s"> <span class="block flex-1 font-medium text-body truncate"> ${0} </span> <span class="text-s"> ${0} </span> </div> <div class="truncate text-s ${0}"> ${0} </div> <div class="text-tertiary truncate text-s">${0}&ZeroWidthSpace;</div> </div> `),a(this.__transactionTemplateHref),this.__transactionTemplateLoaderId,(()=>this.requestUpdate()),a(this.__defaultTemplateSetHref),this.__defaultTemplateSetLoaderId,(()=>this.requestUpdate()),a(this.__localeCodesHelperHref),this.__localeCodesHelperLoaderId,(()=>this.requestUpdate()),a(this.__templateSetHref),this.__templateSetLoaderId,(()=>this.requestUpdate()),a(this.__itemsHref),this.__itemsLoaderId,(()=>this.requestUpdate()),a(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),f&&h?o(d||(d=p`<foxy-i18n infer="" key="${0}" .options="${0}"></foxy-i18n>`),h,f):o(l||(l=p`&ZeroWidthSpace;`)),s&&i?o(_||(_=p`<foxy-i18n infer="" key="${0}" .options="${0}"></foxy-i18n>`),i,s):o(c||(c=p`&ZeroWidthSpace;`)),t?"text-error":"text-secondary",y&&v?o(u||(u=p`<foxy-i18n infer="" key="${0}" .options="${0}"></foxy-i18n>`),v,y):o(m||(m=p`&ZeroWidthSpace;`)),null==r?void 0:r.customer_email)}get isBodyReady(){const e=!!this.__items&&!!this.__currencyCode&&!!this.__currencyDisplay;return super.isBodyReady&&e}get __transactionTemplateHref(){var e,t;const r=this.data;if(!r)return;if("_embedded"in r&&"fx:transaction_template"in r._embedded)return;const i=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:transaction_template"].href)&&void 0!==t?t:"");return i.searchParams.set("zoom","items"),i.toString()}get __defaultTemplateSetHref(){var e,t,r;if(""===(null===(e=this.__transactionTemplate)||void 0===e?void 0:e.template_set_uri))try{const e=new URL(null!==(r=null===(t=this.__store)||void 0===t?void 0:t._links["fx:template_sets"].href)&&void 0!==r?r:"");return e.searchParams.set("code","DEFAULT"),e.toString()}catch(e){}}get __localeCodesHelperHref(){var e;if(this.__defaultTemplateSetHref||this.__templateSetHref)return null!==(e=this.localeCodes)&&void 0!==e?e:void 0}get __templateSetHref(){const e=this.__transactionTemplate;if(!(null==e?void 0:e.currency_code))return(null==e?void 0:e.template_set_uri)||void 0}get __itemsHref(){const e=this.__transactionTemplate;if(!e)return;if("_embedded"in e&&"fx:items"in e._embedded)return;const t=new URL(e._links["fx:items"].href);return t.searchParams.set("limit","1"),t.toString()}get __storeHref(){var e,t;return null===(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:store"])||void 0===t?void 0:t.href}get __transactionTemplate(){var e,t;const r=this.data;if(r&&"_embedded"in r&&"fx:transaction_template"in r._embedded)return r._embedded["fx:transaction_template"];{const r=`#${this.__transactionTemplateLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}}get __defaultTemplateSet(){var e,t;const r=`#${this.__defaultTemplateSetLoaderId}`,i=this.renderRoot.querySelector(r);return null!==(t=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e._embedded["fx:template_sets"][0])&&void 0!==t?t:null}get __localeCodesHelper(){var e,t;const r=`#${this.__localeCodesHelperLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __templateSet(){var e,t;const r=`#${this.__templateSetLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __items(){const e=this.__transactionTemplate;if(e&&"_embedded"in e&&"fx:items"in e._embedded){const t=e._embedded["fx:items"];return{array:t,count:t.length,isApproximateCount:20===t.length}}const t=this.renderRoot.querySelector(`#${this.__itemsLoaderId}`);return(null==t?void 0:t.data)?{array:t.data._embedded["fx:items"],count:t.data.total_items,isApproximateCount:!1}:null}get __store(){var e,t;const r=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(r))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __currencyDisplay(){var e;const t=null===(e=this.__store)||void 0===e?void 0:e.use_international_currency_symbol;return!0===t?"code":!1===t?"symbol":void 0}get __summaryOptions(){var e;const{array:t,count:r}=null!==(e=this.__items)&&void 0!==e?e:{};if(t&&r)return{firstItem:t[0],count:r,countMinus1:r-1}}get __summaryKey(){const e=this.__items;if(e)return e.isApproximateCount?"summary_approximate":"summary"}get __statusOptions(){const e=this.data;if(null!==e)return e.first_failed_transaction_date?{date:e.first_failed_transaction_date}:e.end_date?{date:e.end_date}:!1===e.is_active?{}:new Date(e.start_date)>new Date?{date:e.start_date}:{date:e.next_transaction_date}}get __currencyCode(){var e,t,r;const i=this.__transactionTemplate;if(null==i?void 0:i.currency_code)return i.currency_code;{const i=this.__localeCodesHelper,s=null===(t=null!==(e=this.__templateSet)&&void 0!==e?e:this.__defaultTemplateSet)||void 0===t?void 0:t.locale_code,a=s?null==i?void 0:i.values[s]:void 0;if(a)return null===(r=/Currency: ([A-Z]{3})/g.exec(a))||void 0===r?void 0:r[1]}}get __priceOptions(){var t,r;const s=this.__currencyDisplay;if(void 0===s)return;const a=this.__currencyCode;if(void 0===a)return;const o=null===(t=this.__transactionTemplate)||void 0===t?void 0:t.total_order;if(void 0===o)return;const n=null===(r=this.data)||void 0===r?void 0:r.frequency;return void 0!==n?e(e({},i(n)),{},{amount:`${o} ${a}`,currencyDisplay:s}):void 0}get __statusKey(){const e=this.data;if(null!==e){if(e.first_failed_transaction_date)return"subscription_failed";if(e.end_date){return new Date(e.end_date).getTime()>Date.now()?"subscription_will_be_cancelled":"subscription_cancelled"}return!1===e.is_active?"subscription_inactive":new Date(e.start_date)>new Date?"subscription_will_be_active":"subscription_active"}}get __priceKey(){var e;const t=null===(e=this.data)||void 0===e?void 0:e.frequency;if(t)return"price_"+(".5m"===t?"twice_a_month":"recurring")}}customElements.define("foxy-admin-subscription-card",h);export{h as AdminSubscriptionCard};
@@ -1,4 +1,4 @@
1
- import"./shared-7abbc95c.js";import"./shared-9048eeb2.js";import"./shared-b446c140.js";import"./shared-5784c088.js";import"./foxy-collection-page.js";import"./foxy-pagination.js";import"./shared-2edcd981.js";import{I as t}from"./shared-e2e2ca6a.js";import"./shared-f29acc38.js";import"./foxy-copy-to-clipboard.js";import"./foxy-swipe-actions.js";import{_ as e}from"./shared-4c2e9064.js";import{a as s,T as r}from"./shared-3b709ddc.js";import{c as i}from"./shared-4e709717.js";import{c as n,h as o}from"./shared-7f33a83a.js";import{C as a}from"./shared-5cf7b194.js";import{N as h}from"./shared-9b12aeac.js";import"./shared-eb8a0fdf.js";import"./shared-e5239bec.js";import"./shared-3f04e4cc.js";import"./foxy-spinner.js";import"./shared-fd96bcd1.js";import"./shared-343d1fd7.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./shared-ba93be6b.js";import"./shared-f9180815.js";import"./shared-799dc083.js";import"./shared-621b3283.js";import"./shared-35728235.js";import"./shared-ff7fd5fa.js";import"./shared-d3bf9ac0.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";let l,c,d,p,f,u,m,_,b,y,g,v,x,$=t=>t;const w=Symbol(),j=Symbol();class k extends(s(t)){constructor(){super(...arguments),this.open=!1}static get properties(){return e(e({},super.properties),{},{open:{type:Boolean,reflect:!0}})}static get styles(){return[...super.styles,n(l||(l=$`.resource{display:grid;grid-template-columns:repeat(auto-fill,minmax(calc(18.75 * var(--lumo-space-m)),1fr));grid-gap:1px}.resource>:first-child{grid-column-start:1;grid-column-end:-2}foxy-internal-source-control::part(editor){border-radius:0;max-height:none;box-shadow:none;border:none}foxy-internal-source-control::part(helper-text),foxy-internal-source-control::part(label){position:absolute;width:1px;height:1px;padding-top:0;margin-top:-1px;overflow-x:hidden;overflow-y:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-top-width:0}`))]}static get v8n(){return[...super.v8n,t=>"string"!=typeof t[w]||"invalid_json"]}renderBody(){return o(c||(c=$` <details class="select-none rounded-t-l rounded-b-l overflow-hidden border border-contrast-10" ?open="${0}" @toggle="${0}"> <summary class="${0}"> <div class="flex items-center space-x-s p-s pr-m transition-colors cursor-pointer bg-contrast-5 hover-bg-contrast-10"> <foxy-copy-to-clipboard infer="copy-to-clipboard" text="${0}"> </foxy-copy-to-clipboard> <span class="font-medium truncate">${0}</span> <span class="flex-1"></span> ${0} ${0} ${0} </div> </summary> ${0} </details> `),this.open,(t=>{const e=t.currentTarget;this.open=e.open}),i({"ring-inset ring-primary-50 rounded-t-l":!0,"focus-outline-none focus-ring-2":!0,"rounded-b-l":!this.open}),this.href||this.parent,this.__renderTitle(),this.in({idle:{snapshot:"dirty"}})||this.in({idle:"template"})?o(d||(d=$` <foxy-internal-create-control infer="create" theme="tertiary-inline success"> </foxy-internal-create-control> `)):"",this.in({idle:{snapshot:"dirty"}})||this.in({idle:{template:"dirty"}})?o(p||(p=$` <vaadin-button data-testid="undo" theme="tertiary-inline contrast" class="px-xs" @click="${0}"> <foxy-i18n infer="" key="undo"></foxy-i18n> </vaadin-button> `),(()=>this.undo())):"",this.in({idle:"snapshot"})?o(f||(f=$` <foxy-internal-delete-control infer="delete" theme="tertiary-inline error"> </foxy-internal-delete-control> `)):"",this.open?this.__renderForm():"")}async _fetch(...t){var e;try{const s=t[0]instanceof Request?t[0]:new Request(...t);if("POST"!==s.method)return await super._fetch(...t);const r=null!==(e=this.form[j])&&void 0!==e?e:JSON.stringify(this.form);return await super._fetch(s.url,{method:"POST",body:r})}catch(t){throw["invalid_json"]}}__renderTitle(){if(!this.href)return o(u||(u=$` <span class="text-tertiary">POST</span> <span>${0}</span> `),this.parent);let t="",e="",s="";try{const r=new URL(this.href);t=r.pathname,t.startsWith("/")&&(t=t.substring(1));const i=t.split("/");t=i.slice(0,i.length-1).join("/"),i.length>1&&(t=`${t}/`,e=i[i.length-1]),s=r.search}catch(e){t=this.href}return o(m||(m=$` ${0} `),[o(_||(_=$`<span>${0}</span>`),t),o(b||(b=$`<span class="text-primary">${0}</span>`),e),o(y||(y=$`<span class="text-tertiary">${0}</span>`),s)])}__renderForm(){return o(g||(g=$` <div class="bg-base"> <div class="${0} border-t border-contrast-5 bg-contrast-10"> <foxy-internal-source-control infer="editor" class="flex-1 bg-base" .getValue="${0}" .setValue="${0}"> </foxy-internal-source-control> ${0} </div> </div> `),this.data?"resource":"",(()=>this.__formAsString),(t=>this.__formAsString=t),this.data?o(v||(v=$` <div class="bg-base"> <ul class="bg-contrast-5 p-xs h-full"> ${0} </ul> </div> `),this.__links.map((([t,e])=>this.__renderLink(t,e.href,e.title)))):"")}get __links(){var t,e;const s=Object.entries(null!==(e=null===(t=this.data)||void 0===t?void 0:t._links)&&void 0!==e?e:{}).filter((([t,e])=>"self"!==t&&!Array.isArray(e)&&!e.templated));try{s.sort((([t],[e])=>t.localeCompare(e,this.lang)))}catch(t){s.sort((([t],[e])=>t.localeCompare(e)))}return s}get __formAsString(){const t=this.form,e=t[j],s=t[w];return"string"==typeof s?s:"string"==typeof e?e:JSON.stringify(t,((t,e)=>t.startsWith("_")?void 0:e),2)}set __formAsString(t){this.undo();try{const e=JSON.parse(t);"object"==typeof e&&this.edit(e),this.edit({[j]:t})}catch(e){this.edit({[w]:t})}}__renderLink(t,e,s){return o(x||(x=$` <li data-testclass="link" class="m-xs rounded overflow-hidden transition-colors hover-bg-contrast-5"> <foxy-swipe-actions> <button class="${0}" @click="${0}"> <div class="flex items-center"> <div class="flex-1 space-y-xs px-s min-w-0 text-s"> <div class="truncate font-medium">${0}</div> <div class="opacity-75 truncate">${0}</div> </div> <iron-icon class="icon-inline text-xl text-tertiary mr-s flex-shrink-0" icon="icons:chevron-right"> </iron-icon> </div> </button> <div slot="action" class="h-full flex"> <vaadin-button theme="secondary success" class="h-full rounded-none" @click="${0}"> POST </vaadin-button> </div> </foxy-swipe-actions> </li> `),i({"rounded leading-none space-y-xs block text-left w-full py-s":!0,"ring-inset ring-primary-50":!0,"focus-outline-none focus-ring-2 ":!0}),(()=>{const t=new CustomEvent("navigate:get",{bubbles:!0,detail:e});this.dispatchEvent(t)}),s||e,t,(()=>{const t=new CustomEvent("navigate:post",{bubbles:!0,detail:e});this.dispatchEvent(t)}))}}customElements.define("foxy-internal-api-browser-resource-form",k);let C,S,E,T,U,O,B,P,A,G=t=>t;const H=a(r(s(h,"api-browser")));class R extends H{constructor(){super(...arguments),this.home=null,this.__newCurrentUrl=null,this.__history=[],this.__renderItem=({href:t,html:e})=>t?e(S||(S=G`
1
+ import"./shared-7abbc95c.js";import"./shared-9048eeb2.js";import"./shared-b446c140.js";import"./shared-5784c088.js";import"./foxy-collection-page.js";import"./foxy-pagination.js";import"./shared-2edcd981.js";import{I as t}from"./shared-5280c80a.js";import"./shared-f29acc38.js";import"./foxy-copy-to-clipboard.js";import"./foxy-swipe-actions.js";import{_ as e}from"./shared-4c2e9064.js";import{a as s,T as r}from"./shared-3b709ddc.js";import{c as i}from"./shared-4e709717.js";import{c as n,h as o}from"./shared-7f33a83a.js";import{C as a}from"./shared-5cf7b194.js";import{N as h}from"./shared-9b12aeac.js";import"./shared-eb8a0fdf.js";import"./shared-e5239bec.js";import"./shared-3f04e4cc.js";import"./foxy-spinner.js";import"./shared-fd96bcd1.js";import"./shared-343d1fd7.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./shared-ba93be6b.js";import"./shared-f9180815.js";import"./shared-799dc083.js";import"./shared-621b3283.js";import"./shared-35728235.js";import"./shared-ff7fd5fa.js";import"./shared-d3bf9ac0.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";let l,c,d,p,f,u,m,_,b,y,g,v,x,$=t=>t;const w=Symbol(),j=Symbol();class k extends(s(t)){constructor(){super(...arguments),this.open=!1}static get properties(){return e(e({},super.properties),{},{open:{type:Boolean,reflect:!0}})}static get styles(){return[...super.styles,n(l||(l=$`.resource{display:grid;grid-template-columns:repeat(auto-fill,minmax(calc(18.75 * var(--lumo-space-m)),1fr));grid-gap:1px}.resource>:first-child{grid-column-start:1;grid-column-end:-2}foxy-internal-source-control::part(editor){border-radius:0;max-height:none;box-shadow:none;border:none}foxy-internal-source-control::part(helper-text),foxy-internal-source-control::part(label){position:absolute;width:1px;height:1px;padding-top:0;margin-top:-1px;overflow-x:hidden;overflow-y:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-top-width:0}`))]}static get v8n(){return[...super.v8n,t=>"string"!=typeof t[w]||"invalid_json"]}renderBody(){return o(c||(c=$` <details class="select-none rounded-t-l rounded-b-l overflow-hidden border border-contrast-10" ?open="${0}" @toggle="${0}"> <summary class="${0}"> <div class="flex items-center space-x-s p-s pr-m transition-colors cursor-pointer bg-contrast-5 hover-bg-contrast-10"> <foxy-copy-to-clipboard infer="copy-to-clipboard" text="${0}"> </foxy-copy-to-clipboard> <span class="font-medium truncate">${0}</span> <span class="flex-1"></span> ${0} ${0} ${0} </div> </summary> ${0} </details> `),this.open,(t=>{const e=t.currentTarget;this.open=e.open}),i({"ring-inset ring-primary-50 rounded-t-l":!0,"focus-outline-none focus-ring-2":!0,"rounded-b-l":!this.open}),this.href||this.parent,this.__renderTitle(),this.in({idle:{snapshot:"dirty"}})||this.in({idle:"template"})?o(d||(d=$` <foxy-internal-create-control infer="create" theme="tertiary-inline success"> </foxy-internal-create-control> `)):"",this.in({idle:{snapshot:"dirty"}})||this.in({idle:{template:"dirty"}})?o(p||(p=$` <vaadin-button data-testid="undo" theme="tertiary-inline contrast" class="px-xs" @click="${0}"> <foxy-i18n infer="" key="undo"></foxy-i18n> </vaadin-button> `),(()=>this.undo())):"",this.in({idle:"snapshot"})?o(f||(f=$` <foxy-internal-delete-control infer="delete" theme="tertiary-inline error"> </foxy-internal-delete-control> `)):"",this.open?this.__renderForm():"")}async _fetch(...t){var e;try{const s=t[0]instanceof Request?t[0]:new Request(...t);if("POST"!==s.method)return await super._fetch(...t);const r=null!==(e=this.form[j])&&void 0!==e?e:JSON.stringify(this.form);return await super._fetch(s.url,{method:"POST",body:r})}catch(t){throw["invalid_json"]}}__renderTitle(){if(!this.href)return o(u||(u=$` <span class="text-tertiary">POST</span> <span>${0}</span> `),this.parent);let t="",e="",s="";try{const r=new URL(this.href);t=r.pathname,t.startsWith("/")&&(t=t.substring(1));const i=t.split("/");t=i.slice(0,i.length-1).join("/"),i.length>1&&(t=`${t}/`,e=i[i.length-1]),s=r.search}catch(e){t=this.href}return o(m||(m=$` ${0} `),[o(_||(_=$`<span>${0}</span>`),t),o(b||(b=$`<span class="text-primary">${0}</span>`),e),o(y||(y=$`<span class="text-tertiary">${0}</span>`),s)])}__renderForm(){return o(g||(g=$` <div class="bg-base"> <div class="${0} border-t border-contrast-5 bg-contrast-10"> <foxy-internal-source-control infer="editor" class="flex-1 bg-base" .getValue="${0}" .setValue="${0}"> </foxy-internal-source-control> ${0} </div> </div> `),this.data?"resource":"",(()=>this.__formAsString),(t=>this.__formAsString=t),this.data?o(v||(v=$` <div class="bg-base"> <ul class="bg-contrast-5 p-xs h-full"> ${0} </ul> </div> `),this.__links.map((([t,e])=>this.__renderLink(t,e.href,e.title)))):"")}get __links(){var t,e;const s=Object.entries(null!==(e=null===(t=this.data)||void 0===t?void 0:t._links)&&void 0!==e?e:{}).filter((([t,e])=>"self"!==t&&!Array.isArray(e)&&!e.templated));try{s.sort((([t],[e])=>t.localeCompare(e,this.lang)))}catch(t){s.sort((([t],[e])=>t.localeCompare(e)))}return s}get __formAsString(){const t=this.form,e=t[j],s=t[w];return"string"==typeof s?s:"string"==typeof e?e:JSON.stringify(t,((t,e)=>t.startsWith("_")?void 0:e),2)}set __formAsString(t){this.undo();try{const e=JSON.parse(t);"object"==typeof e&&this.edit(e),this.edit({[j]:t})}catch(e){this.edit({[w]:t})}}__renderLink(t,e,s){return o(x||(x=$` <li data-testclass="link" class="m-xs rounded overflow-hidden transition-colors hover-bg-contrast-5"> <foxy-swipe-actions> <button class="${0}" @click="${0}"> <div class="flex items-center"> <div class="flex-1 space-y-xs px-s min-w-0 text-s"> <div class="truncate font-medium">${0}</div> <div class="opacity-75 truncate">${0}</div> </div> <iron-icon class="icon-inline text-xl text-tertiary mr-s flex-shrink-0" icon="icons:chevron-right"> </iron-icon> </div> </button> <div slot="action" class="h-full flex"> <vaadin-button theme="secondary success" class="h-full rounded-none" @click="${0}"> POST </vaadin-button> </div> </foxy-swipe-actions> </li> `),i({"rounded leading-none space-y-xs block text-left w-full py-s":!0,"ring-inset ring-primary-50":!0,"focus-outline-none focus-ring-2 ":!0}),(()=>{const t=new CustomEvent("navigate:get",{bubbles:!0,detail:e});this.dispatchEvent(t)}),s||e,t,(()=>{const t=new CustomEvent("navigate:post",{bubbles:!0,detail:e});this.dispatchEvent(t)}))}}customElements.define("foxy-internal-api-browser-resource-form",k);let C,S,E,T,U,O,B,P,A,G=t=>t;const H=a(r(s(h,"api-browser")));class R extends H{constructor(){super(...arguments),this.home=null,this.__newCurrentUrl=null,this.__history=[],this.__renderItem=({href:t,html:e})=>t?e(S||(S=G`
2
2
  <foxy-internal-api-browser-resource-form infer="" href=${0}>
3
3
  </foxy-internal-api-browser-resource-form>
4
4
  `),t):e(C||(C=G``)),this.__handleExistingResourceFetch=t=>{"DELETE"===t.request.method&&(t.preventDefault(),t.respondWith(new R.API(this).fetch(t.request).then((t=>(t.ok&&(this.__canGoBack?this.__goBack():this.__canGoHome?this.__goHome():(this.parent="",this.href="")),t)))))}}static get properties(){return e(e({},super.properties),{},{__newCurrentUrl:{attribute:!1},__history:{attribute:!1},home:{type:String}})}render(){var t;return o(E||(E=G` <div class="space-y-m"> <div class="flex items-center gap-s flex-wrap-reverse"> <vaadin-button title="${0}" theme="icon contrast" class="p-0" ?disabled="${0}" @click="${0}"> <iron-icon class="icon-inline text-m" icon="icons:arrow-back"></iron-icon> </vaadin-button> <vaadin-button title="${0}" theme="icon contrast" class="p-0" ?disabled="${0}" @click="${0}"> <iron-icon class="icon-inline text-m" icon="icons:home"></iron-icon> </vaadin-button> <vaadin-text-field placeholder="https://api.foxy.io/stores/0" aria-label="${0}" class="flex-1" ?disabled="${0}" ?readonly="${0}" .value="${0}" @keydown="${0}" @input="${0}"> </vaadin-text-field> ${0} <div class="grid grid-cols-2"> <vaadin-button title="${0}" theme="${0}" class="rounded-r-none p-0" ?disabled="${0}" @click="${0}"> GET </vaadin-button> <vaadin-button title="${0}" theme="${0}" class="rounded-l-none p-0" ?disabled="${0}" @click="${0}"> POST </vaadin-button> </div> </div> <div @navigate:get="${0}" @navigate:post="${0}"> ${0} </div> </div> `),this.t("go_back"),this.disabled||!this.__canGoBack,(()=>this.__goBack()),this.t("go_home"),this.disabled||!this.__canGoHome,(()=>this.__goHome()),this.t("current_url"),this.disabled,this.readonly,this.__newCurrentUrl||this.href||this.parent,(t=>"Enter"===t.key&&this.__go()),(t=>{const e=t.currentTarget;this.__newCurrentUrl=e.value}),this.__newCurrentUrl?o(T||(T=G` <vaadin-button title="${0}" theme="icon primary" class="p-0" ?disabled="${0}" @click="${0}"> <iron-icon class="icon-inline text-m" icon="icons:arrow-forward"></iron-icon> </vaadin-button> `),this.t("navigate"),this.disabled||this.in("busy"),this.__go):o(U||(U=G` <vaadin-button title="${0}" theme="icon contrast" class="p-0" ?disabled="${0}" @click="${0}"> <iron-icon class="icon-inline text-m" icon="icons:refresh"></iron-icon> </vaadin-button> `),this.t("refresh"),this.disabled||this.in("busy"),(()=>this.refresh())),this.t("get_mode"),this.href?"contrast primary":"contrast",this.disabled||"get"===this.__mode,(()=>this.__mode="get"),this.t("post_mode"),this.href?"contrast":"contrast primary",this.disabled||"post"===this.__mode,(()=>this.__mode="post"),(t=>{t.stopPropagation(),this.__history.push({href:this.href,parent:this.parent}),this.__newCurrentUrl=null,this.parent="",this.href=t.detail}),(t=>{t.stopPropagation(),this.__history.push({href:this.href,parent:this.parent}),this.__newCurrentUrl=null,this.parent=t.detail,this.href=""}),this.href?o(O||(O=G` ${0} `),(null===(t=this.data)||void 0===t?void 0:t._links.first)?o(B||(B=G` <foxy-pagination first="${0}" infer=""> <foxy-collection-page class="block space-y-m mb-m" infer="" .item="${0}"> </foxy-collection-page> </foxy-pagination> `),this.href,this.__renderItem):o(P||(P=G` <foxy-internal-api-browser-resource-form infer="" href="${0}" open @fetch="${0}"> </foxy-internal-api-browser-resource-form> `),this.href,this.__handleExistingResourceFetch)):o(A||(A=G` <foxy-internal-api-browser-resource-form infer="" parent="${0}" open @update="${0}"> </foxy-internal-api-browser-resource-form> `),this.parent,(t=>{const e=t.currentTarget;e.in({idle:"snapshot"})&&(this.href=e.data._links.self.href,this.parent="")})))}get __canGoBack(){return this.__history.length>0}get __canGoHome(){return this.href!==this.home}get __mode(){return this.href?"get":"post"}set __mode(t){"get"===t?(this.href=this.parent,this.parent=""):(this.parent=this.href,this.href="")}__goBack(){var t,e;const s=this.__history.length-1,r=this.__history[s];this.parent=null!==(t=null==r?void 0:r.parent)&&void 0!==t?t:"",this.href=null!==(e=null==r?void 0:r.href)&&void 0!==e?e:"",this.__history=this.__history.slice(0,s)}__goHome(){var t;this.__history=[],this.parent="",this.href=null!==(t=this.home)&&void 0!==t?t:""}__go(){if("string"==typeof this.__newCurrentUrl){this.__history.push({href:this.href,parent:this.parent});this[this.href?"href":"parent"]=this.__newCurrentUrl,this.__newCurrentUrl=null}}}customElements.define("foxy-api-browser",R);export{R as ApiBrowser};
@@ -1 +1 @@
1
- import"./shared-8f922de8.js";import"./shared-d90dbae7.js";import{I as e}from"./shared-e2e2ca6a.js";import{a as s}from"./shared-3b709ddc.js";import{B as r}from"./shared-4c2e9064.js";import{h as t}from"./shared-7f33a83a.js";import"./shared-ad80244a.js";import"./shared-eb8a0fdf.js";import"./shared-e5239bec.js";import"./shared-7abbc95c.js";import"./shared-3f04e4cc.js";import"./shared-5784c088.js";import"./shared-ff7fd5fa.js";import"./shared-ba93be6b.js";import"./shared-f9180815.js";import"./shared-2edcd981.js";import"./shared-343d1fd7.js";import"./shared-fd96bcd1.js";import"./shared-5cf7b194.js";import"./shared-d3bf9ac0.js";import"./shared-9b12aeac.js";import"./shared-35728235.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";import"./shared-9048eeb2.js";import"./shared-799dc083.js";import"./shared-621b3283.js";import"./shared-4e709717.js";import"./foxy-spinner.js";import"./shared-b446c140.js";let o,i,a=e=>e;const d=s(e,"applied-coupon-code-form");class c extends d{constructor(){super(...arguments),this.templates={},this.__ignoreUsageLimitsOptions=[{value:"checked",label:"option_checked"}],this.__getIgnoreUsageLimitsValue=()=>this.form.ignore_usage_limits?["checked"]:[],this.__setIgnoreUsageLimitsValue=e=>{this.edit({ignore_usage_limits:e.includes("checked")})}}static get v8n(){return[({code:e})=>!!e||"code:v8n_required"]}get readonlySelector(){return this.data?new r("not=delete"):super.readonlySelector}get hiddenSelector(){return new r(`timestamps ${super.hiddenSelector}`)}renderBody(){return t(o||(o=a` <foxy-internal-text-control helper-text="${0}" infer="code"> </foxy-internal-text-control> ${0} ${0} `),this.t(this.data?"code.helper_text_existing":"code.helper_text_new"),this.data?"":t(i||(i=a` <foxy-internal-checkbox-group-control infer="ignore-usage-limits" class="-my-xs" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__getIgnoreUsageLimitsValue,this.__setIgnoreUsageLimitsValue,this.__ignoreUsageLimitsOptions),super.renderBody())}}customElements.define("foxy-applied-coupon-code-form",c);export{c as AppliedCouponCodeForm};
1
+ import"./shared-8f922de8.js";import"./shared-d90dbae7.js";import{I as e}from"./shared-5280c80a.js";import{a as s}from"./shared-3b709ddc.js";import{B as r}from"./shared-4c2e9064.js";import{h as t}from"./shared-7f33a83a.js";import"./shared-ad80244a.js";import"./shared-eb8a0fdf.js";import"./shared-e5239bec.js";import"./shared-7abbc95c.js";import"./shared-3f04e4cc.js";import"./shared-5784c088.js";import"./shared-ff7fd5fa.js";import"./shared-ba93be6b.js";import"./shared-f9180815.js";import"./shared-2edcd981.js";import"./shared-343d1fd7.js";import"./shared-fd96bcd1.js";import"./shared-5cf7b194.js";import"./shared-d3bf9ac0.js";import"./shared-9b12aeac.js";import"./shared-35728235.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";import"./shared-9048eeb2.js";import"./shared-799dc083.js";import"./shared-621b3283.js";import"./shared-4e709717.js";import"./foxy-spinner.js";import"./shared-b446c140.js";let o,i,a=e=>e;const d=s(e,"applied-coupon-code-form");class c extends d{constructor(){super(...arguments),this.templates={},this.__ignoreUsageLimitsOptions=[{value:"checked",label:"option_checked"}],this.__getIgnoreUsageLimitsValue=()=>this.form.ignore_usage_limits?["checked"]:[],this.__setIgnoreUsageLimitsValue=e=>{this.edit({ignore_usage_limits:e.includes("checked")})}}static get v8n(){return[({code:e})=>!!e||"code:v8n_required"]}get readonlySelector(){return this.data?new r("not=delete"):super.readonlySelector}get hiddenSelector(){return new r(`timestamps ${super.hiddenSelector}`)}renderBody(){return t(o||(o=a` <foxy-internal-text-control helper-text="${0}" infer="code"> </foxy-internal-text-control> ${0} ${0} `),this.t(this.data?"code.helper_text_existing":"code.helper_text_new"),this.data?"":t(i||(i=a` <foxy-internal-checkbox-group-control infer="ignore-usage-limits" class="-my-xs" .getValue="${0}" .setValue="${0}" .options="${0}"> </foxy-internal-checkbox-group-control> `),this.__getIgnoreUsageLimitsValue,this.__setIgnoreUsageLimitsValue,this.__ignoreUsageLimitsOptions),super.renderBody())}}customElements.define("foxy-applied-coupon-code-form",c);export{c as AppliedCouponCodeForm};
@@ -1 +1 @@
1
- import"./shared-6daeb197.js";import"./shared-7abbc95c.js";import"./shared-9048eeb2.js";import"./shared-799dc083.js";import"./shared-f9180815.js";import"./foxy-spinner.js";import"./shared-2edcd981.js";import"./shared-5784c088.js";import"./shared-eb8a0fdf.js";import"./shared-099c1f57.js";import{h as e}from"./shared-7f33a83a.js";import{a as t,T as i,S as s}from"./shared-3b709ddc.js";import{c as a}from"./shared-4e709717.js";import{C as r}from"./shared-601f27b1.js";import"./shared-621b3283.js";import"./shared-f21e5761.js";import"./shared-13fbea95.js";import"./shared-3c2414d4.js";import"./shared-bee111d6.js";import"./shared-ef7f2d07.js";import{m as d}from"./shared-4c2e9064.js";import{G as l}from"./shared-d1f5de89.js";import"./shared-3f04e4cc.js";import{P as n}from"./shared-7fab31ac.js";import{C as o}from"./shared-5cf7b194.js";import{N as h}from"./shared-9b12aeac.js";import{i as m}from"./shared-d3bf9ac0.js";import"./shared-e5239bec.js";import"./shared-b446c140.js";import"./shared-fd96bcd1.js";import"./shared-343d1fd7.js";import"./shared-11c2efc8.js";import"./shared-e8a51c60.js";import"./shared-35728235.js";import"./shared-f5bbb1e0.js";import"./shared-fff03a45.js";import"./shared-3ab0306f.js";let c,f,p,b,v,u,y=e=>e;const _=t(o(i(s(h))),"attribute-form");class $ extends _{constructor(){super(...arguments),this.templates={},this.__getValidator=d((e=>()=>!this.errors.some((t=>t.startsWith(e))))),this.__bindField=d((e=>t=>{const i=t.target;this.edit({[e]:i.value})})),this.__maybeRenderTextField=({field:t})=>{var i,s;const a=t.replace(/_/,"-");return this.hiddenSelector.matches(a)?"":e(c||(c=y` <div> ${0} <vaadin-text-field class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" .checkValidity="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}" @keydown="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot(`${a}:before`),this.t(t).toString(),m(null===(s=null===(i=this.form)||void 0===i?void 0:i[t])||void 0===s?void 0:s.toString()),this.__getErrorMessage(t),t,this.__getValidator(t),!this.in("idle")||this.disabledSelector.matches(a),this.readonlySelector.matches(a),this.__bindField(t),this.__handleKeyDown,this.renderTemplateOrSlot(`${a}:after`))},this.__renderVisibility=()=>{var t;const{disabledSelector:i,readonlySelector:s,form:r,lang:d,ns:l}=this,n=!this.in("idle"),o=n||i.matches("visibility",!0);return e(f||(f=y` <div> ${0} <x-group frame> <foxy-i18n data-testid="visibility-label" class="${0}" lang="${0}" slot="header" key="visibility" ns="${0}"> </foxy-i18n> <x-choice data-testid="visibility" lang="${0}" ns="${0}" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> <foxy-i18n slot="private-label" lang="${0}" key="visibility_private" ns="${0}"> </foxy-i18n> <foxy-i18n slot="restricted-label" lang="${0}" key="visibility_restricted" ns="${0}"> </foxy-i18n> <foxy-i18n ns="${0}" lang="${0}" slot="public-label" key="visibility_public"> </foxy-i18n> </x-choice> </x-group> ${0} </div> `),this.renderTemplateOrSlot("visibility:before"),a({"text-disabled":o}),d,l,d,$.defaultNS,$.__visibilityOptions,null!==(t=null==r?void 0:r.visibility)&&void 0!==t?t:"private",n||i.matches("visibility",!0),s.matches("visibility",!0),this.__handleChoiceChange,d,l,d,l,l,d,this.renderTemplateOrSlot("visibility:after"))},this.__renderTimestamps=()=>{const t=["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])}):""}}));return e(p||(p=y` <div> ${0} <x-property-table .items="${0}" data-testid="timestamps"></x-property-table> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),t,this.renderTemplateOrSlot("timestamps:after"))},this.__renderDelete=()=>e(b||(b=y` <div> ${0} <vaadin-button class="w-full" data-testid="delete" theme="error" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="delete"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("delete:before"),!this.in("idle")||this.disabledSelector.matches("delete",!0),this.__handleDeleteClick,this.ns,this.lang,this.renderTemplateOrSlot("delete:after")),this.__renderCreate=()=>{const t=this.in({idle:{template:{dirty:"valid"}}}),i=this.in({idle:{snapshot:{dirty:"valid"}}}),s=t||i;return e(v||(v=y` <div> ${0} <vaadin-button data-testid="create" class="w-full" theme="success primary" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="create"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("create:before"),!this.in("idle")||!s||this.disabledSelector.matches("create",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-text-area":customElements.get("vaadin-text-area"),"x-property-table":n,"vaadin-button":customElements.get("vaadin-button"),"x-choice":r,"x-group":l,"foxy-i18n":customElements.get("foxy-i18n"),"foxy-spinner":customElements.get("foxy-spinner")}}static get v8n(){return[({value:e})=>e&&e.length>0||"value_required",({value:e})=>e&&e.length<=1e3||"value_too_long",({name:e})=>e&&e.length>0||"name_required",({name:e})=>e&&e.length<=500||"name_too_long"]}render(){var t,i;const{hiddenSelector:s,data:r,lang:d,ns:l}=this,n=this.in("busy"),o=this.in("fail");return e(u||(u=y` <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> <div class="relative" aria-busy="${0}" aria-live="polite"> <div class="grid grid-cols-1 gap-l"> ${0} ${0} ${0} ${0} ${0} ${0} </div> <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> `),d,l,this.__handleConfirmHide,this.in("busy"),this.__maybeRenderTextField({field:"name"}),this.__maybeRenderTextField({field:"value"}),s.matches("visibility",!0)?"":this.__renderVisibility(),s.matches("timestamps",!0)||!r?"":this.__renderTimestamps(),s.matches("delete",!0)||!r?"":this.__renderDelete(),s.matches("create",!0)||r?"":this.__renderCreate(),a({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!n&&!o}),o?"error":n?"busy":"empty",d,l,null!==(i=null===(t=customElements.get("foxy-spinner"))||void 0===t?void 0:t.defaultNS)&&void 0!==i?i:"")}disconnectedCallback(){var e,t,i,s;super.disconnectedCallback(),null===(t=(e=this.__bindField.cache).clear)||void 0===t||t.call(e),null===(s=(i=this.__getValidator.cache).clear)||void 0===s||s.call(i)}get __confirmDialog(){return this.renderRoot.querySelector("#confirm")}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__handleKeyDown(e){"Enter"===e.key&&this.submit()}__handleChoiceChange(e){this.edit({visibility:e.detail})}__handleDeleteClick(e){this.__confirmDialog.show(e.currentTarget)}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}$.__visibilityOptions=["private","restricted","public"],customElements.define("foxy-attribute-form",$);export{$ as AttributeForm};
1
+ import"./shared-6daeb197.js";import"./shared-7abbc95c.js";import"./shared-9048eeb2.js";import"./shared-799dc083.js";import"./shared-f9180815.js";import"./foxy-spinner.js";import"./shared-2edcd981.js";import"./shared-5784c088.js";import"./shared-eb8a0fdf.js";import"./shared-099c1f57.js";import{h as e}from"./shared-7f33a83a.js";import{a as t,T as i,S as s}from"./shared-3b709ddc.js";import{c as a}from"./shared-4e709717.js";import{C as r}from"./shared-601f27b1.js";import"./shared-621b3283.js";import"./shared-f21e5761.js";import"./shared-13fbea95.js";import"./shared-3c2414d4.js";import"./shared-bee111d6.js";import"./shared-ef7f2d07.js";import{m as d}from"./shared-4c2e9064.js";import{G as l}from"./shared-d1f5de89.js";import"./shared-3f04e4cc.js";import{M as n}from"./shared-4205699e.js";import{C as o}from"./shared-5cf7b194.js";import{N as h}from"./shared-9b12aeac.js";import{i as m}from"./shared-d3bf9ac0.js";import"./shared-e5239bec.js";import"./shared-b446c140.js";import"./shared-fd96bcd1.js";import"./shared-343d1fd7.js";import"./shared-11c2efc8.js";import"./shared-e8a51c60.js";import"./shared-35728235.js";import"./shared-f5bbb1e0.js";import"./shared-fff03a45.js";import"./shared-3ab0306f.js";let c,f,p,b,v,u,y=e=>e;const _=t(o(i(s(h))),"attribute-form");class $ extends _{constructor(){super(...arguments),this.templates={},this.__getValidator=d((e=>()=>!this.errors.some((t=>t.startsWith(e))))),this.__bindField=d((e=>t=>{const i=t.target;this.edit({[e]:i.value})})),this.__maybeRenderTextField=({field:t})=>{var i,s;const a=t.replace(/_/,"-");return this.hiddenSelector.matches(a)?"":e(c||(c=y` <div> ${0} <vaadin-text-field class="w-full" label="${0}" value="${0}" error-message="${0}" data-testid="${0}" .checkValidity="${0}" ?disabled="${0}" ?readonly="${0}" @input="${0}" @keydown="${0}"> </vaadin-text-field> ${0} </div> `),this.renderTemplateOrSlot(`${a}:before`),this.t(t).toString(),m(null===(s=null===(i=this.form)||void 0===i?void 0:i[t])||void 0===s?void 0:s.toString()),this.__getErrorMessage(t),t,this.__getValidator(t),!this.in("idle")||this.disabledSelector.matches(a),this.readonlySelector.matches(a),this.__bindField(t),this.__handleKeyDown,this.renderTemplateOrSlot(`${a}:after`))},this.__renderVisibility=()=>{var t;const{disabledSelector:i,readonlySelector:s,form:r,lang:d,ns:l}=this,n=!this.in("idle"),o=n||i.matches("visibility",!0);return e(f||(f=y` <div> ${0} <x-group frame> <foxy-i18n data-testid="visibility-label" class="${0}" lang="${0}" slot="header" key="visibility" ns="${0}"> </foxy-i18n> <x-choice data-testid="visibility" lang="${0}" ns="${0}" .items="${0}" .value="${0}" ?disabled="${0}" ?readonly="${0}" @change="${0}"> <foxy-i18n slot="private-label" lang="${0}" key="visibility_private" ns="${0}"> </foxy-i18n> <foxy-i18n slot="restricted-label" lang="${0}" key="visibility_restricted" ns="${0}"> </foxy-i18n> <foxy-i18n ns="${0}" lang="${0}" slot="public-label" key="visibility_public"> </foxy-i18n> </x-choice> </x-group> ${0} </div> `),this.renderTemplateOrSlot("visibility:before"),a({"text-disabled":o}),d,l,d,$.defaultNS,$.__visibilityOptions,null!==(t=null==r?void 0:r.visibility)&&void 0!==t?t:"private",n||i.matches("visibility",!0),s.matches("visibility",!0),this.__handleChoiceChange,d,l,d,l,l,d,this.renderTemplateOrSlot("visibility:after"))},this.__renderTimestamps=()=>{const t=["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])}):""}}));return e(p||(p=y` <div> ${0} <x-metadata .items="${0}" data-testid="timestamps"></x-metadata> ${0} </div> `),this.renderTemplateOrSlot("timestamps:before"),t,this.renderTemplateOrSlot("timestamps:after"))},this.__renderDelete=()=>e(b||(b=y` <div> ${0} <vaadin-button class="w-full" data-testid="delete" theme="error" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="delete"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("delete:before"),!this.in("idle")||this.disabledSelector.matches("delete",!0),this.__handleDeleteClick,this.ns,this.lang,this.renderTemplateOrSlot("delete:after")),this.__renderCreate=()=>{const t=this.in({idle:{template:{dirty:"valid"}}}),i=this.in({idle:{snapshot:{dirty:"valid"}}}),s=t||i;return e(v||(v=y` <div> ${0} <vaadin-button data-testid="create" class="w-full" theme="success primary" ?disabled="${0}" @click="${0}"> <foxy-i18n ns="${0}" lang="${0}" key="create"></foxy-i18n> </vaadin-button> ${0} </div> `),this.renderTemplateOrSlot("create:before"),!this.in("idle")||!s||this.disabledSelector.matches("create",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}}static get scopedElements(){return{"foxy-internal-confirm-dialog":customElements.get("foxy-internal-confirm-dialog"),"foxy-internal-sandbox":customElements.get("foxy-internal-sandbox"),"vaadin-text-field":customElements.get("vaadin-text-field"),"vaadin-text-area":customElements.get("vaadin-text-area"),"x-metadata":n,"vaadin-button":customElements.get("vaadin-button"),"x-choice":r,"x-group":l,"foxy-i18n":customElements.get("foxy-i18n"),"foxy-spinner":customElements.get("foxy-spinner")}}static get v8n(){return[({value:e})=>e&&e.length>0||"value_required",({value:e})=>e&&e.length<=1e3||"value_too_long",({name:e})=>e&&e.length>0||"name_required",({name:e})=>e&&e.length<=500||"name_too_long"]}render(){var t,i;const{hiddenSelector:s,data:r,lang:d,ns:l}=this,n=this.in("busy"),o=this.in("fail");return e(u||(u=y` <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> <div class="relative" aria-busy="${0}" aria-live="polite"> <div class="grid grid-cols-1 gap-l"> ${0} ${0} ${0} ${0} ${0} ${0} </div> <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> `),d,l,this.__handleConfirmHide,this.in("busy"),this.__maybeRenderTextField({field:"name"}),this.__maybeRenderTextField({field:"value"}),s.matches("visibility",!0)?"":this.__renderVisibility(),s.matches("timestamps",!0)||!r?"":this.__renderTimestamps(),s.matches("delete",!0)||!r?"":this.__renderDelete(),s.matches("create",!0)||r?"":this.__renderCreate(),a({"transition duration-500 ease-in-out absolute inset-0 flex":!0,"opacity-0 pointer-events-none":!n&&!o}),o?"error":n?"busy":"empty",d,l,null!==(i=null===(t=customElements.get("foxy-spinner"))||void 0===t?void 0:t.defaultNS)&&void 0!==i?i:"")}disconnectedCallback(){var e,t,i,s;super.disconnectedCallback(),null===(t=(e=this.__bindField.cache).clear)||void 0===t||t.call(e),null===(s=(i=this.__getValidator.cache).clear)||void 0===s||s.call(i)}get __confirmDialog(){return this.renderRoot.querySelector("#confirm")}__getErrorMessage(e){const t=this.errors.find((t=>t.startsWith(e)));return t?this.t(t.replace(e,"v8n")).toString():""}__handleKeyDown(e){"Enter"===e.key&&this.submit()}__handleChoiceChange(e){this.edit({visibility:e.detail})}__handleDeleteClick(e){this.__confirmDialog.show(e.currentTarget)}__handleConfirmHide(e){e.detail.cancelled||this.delete()}}$.__visibilityOptions=["private","restricted","public"],customElements.define("foxy-attribute-form",$);export{$ as AttributeForm};
@@ -1 +1 @@
1
- import"./shared-c839e147.js";import"./shared-5103c1b4.js";import"./shared-0c0ee663.js";import{I as e}from"./shared-e2e2ca6a.js";import"./shared-d90dbae7.js";import"./foxy-applied-coupon-code-card.js";import"./foxy-applied-coupon-code-form.js";import"./foxy-custom-field-card.js";import"./foxy-custom-field-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-discount-card.js";import"./foxy-item-card.js";import"./foxy-item-form.js";import"./shared-2edcd981.js";import{I as t}from"./shared-ba93be6b.js";import{_ as o,Y as i}from"./shared-4c2e9064.js";import{c as r}from"./shared-4e709717.js";import{h as s}from"./shared-7f33a83a.js";import{R as n,a as l}from"./shared-3b709ddc.js";import{i as a}from"./shared-d3bf9ac0.js";import{s as d}from"./shared-8a9c64b2.js";import"./shared-ef7f2d07.js";import"./shared-eb8a0fdf.js";import"./shared-e5239bec.js";import"./shared-3f04e4cc.js";import"./shared-fff03a45.js";import"./shared-5784c088.js";import"./shared-7abbc95c.js";import"./shared-ff7fd5fa.js";import"./shared-35728235.js";import"./shared-343d1fd7.js";import"./shared-9048eeb2.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-b446c140.js";import"./shared-fd96bcd1.js";import"./shared-5cf7b194.js";import"./shared-9b12aeac.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-799dc083.js";import"./shared-621b3283.js";import"./foxy-pagination.js";import"./shared-584174ff.js";import"./shared-31d8e3b8.js";import"./shared-f0a9f3c2.js";import"./shared-8f922de8.js";import"./shared-ad80244a.js";import"./shared-f9180815.js";import"./shared-099c1f57.js";import"./shared-601f27b1.js";import"./shared-13fbea95.js";import"./shared-3c2414d4.js";import"./shared-6daeb197.js";import"./shared-bee111d6.js";import"./shared-f21e5761.js";import"./shared-f5bbb1e0.js";import"./shared-7fab31ac.js";import"./shared-d1f5de89.js";import"./shared-5a889c45.js";import"./shared-406ce9ad.js";import"./shared-27d21f4a.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-coupon-card.js";import"./foxy-discount-builder.js";import"./shared-bb05cfed.js";import"./shared-773e7177.js";import"./shared-c76ef8d8.js";import"./shared-79d0699c.js";import"./shared-efaf8d49.js";import"./foxy-subscription-card.js";import"./shared-630a0ff2.js";import"./foxy-subscription-form.js";import"./foxy-cancellation-form.js";import"./foxy-transaction-card.js";import"./foxy-customer-card.js";import"./shared-e006e82c.js";import"./shared-800ee6c0.js";import"./shared-3bcc07cd.js";let c,f,p=e=>e;customElements.define("foxy-internal-cart-form-view-as-customer-control",class extends t{constructor(){super(...arguments),this.__loader=null}static get properties(){return o(o({},super.properties),{},{__loader:{attribute:!1}})}renderControl(){var e,t;const o=null===(e=this.__loader)||void 0===e?void 0:e.state,i=null===(t=this.__loader)||void 0===t?void 0:t.result;return i?s(c||(c=p` <a target="_blank" class="flex h-m px-m rounded font-medium transition-colors text-body bg-contrast-5 hover-bg-contrast-10 items-center justify-center focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="" key="state_idle"></foxy-i18n> </a> `),i):s(f||(f=p` <div class="${0}"> <foxy-i18n infer="" key="${0}"> </foxy-i18n> </div> `),r({"flex h-m px-m rounded items-center justify-center":!0,"transition-colors bg-contrast-5 font-medium":!0,"text-tertiary":"fail"!==o,"text-error":"fail"===o}),"fail"===o?"state_fail":"state_busy")}updated(e){var t;super.updated(e);const o=this.nucleon,i=null==o?void 0:o.data,r=null!==(t=null==i?void 0:i._links["fx:create_session"].href)&&void 0!==t?t:null;this.__reloadSessionHref(r)}async __reloadSessionHref(e){var t;if((null===(t=this.__loader)||void 0===t?void 0:t.href)===e)return;const o=this.nucleon;if(o)if(e){const t={result:null,state:"busy",href:e},i=new o.constructor.API(this);this.__loader=t;try{const o=await i.fetch(e,{method:"POST"});if(!o.ok)throw new Error;t.result=(await o.json()).cart_link,t.state="idle"}catch(e){t.state="fail"}finally{this.requestUpdate()}}else this.__loader=null}});let u,h,_,m,y,g,x,v,b,j,$,L,S,H=e=>e;const k=n(l(e,"cart-form"));class R extends k{constructor(){super(...arguments),this.itemCategories=null,this.templateSets=null,this.localeCodes=null,this.customers=null,this.countries=null,this.templates={},this.regions=null,this.coupons=null,this.__defaultTemplateSetLoaderId="defaultTemplateSetLoader",this.__localeCodesHelperLoaderId="localeCodesLoader",this.__shippingRegionsLoaderId="shippingRegionsLoader",this.__billingRegionsLoaderId="billingRegionsLoader",this.__templateSetLoaderId="templateSetLoader",this.__countriesHelperLoaderId="countriesHelperLoader",this.__discountsLoaderId="discountsLoader",this.__customerLoaderId="customerLoader",this.__storeLoaderId="storeLoader",this.__customerTypeGetValue=()=>{var e;return this.form.customer_uri?(null===(e=this.__customer)||void 0===e?void 0:e.is_anonymous)?"guest":"regular":"new"},this.__customerTypeSetValue=e=>{this.edit({customer_uri:"",customer_email:""}),this.__isGuestMode="guest"===e},this.__customerTypeOptions=[{label:"option_new",value:"new"},{label:"option_guest",value:"guest"},{label:"option_regular",value:"regular"}],this.__customerGetValue=()=>this.form.customer_uri||this.form.customer_email,this.__customerSetValue=e=>{try{new URL(e);const t={},r=this.data,s=this.form;for(const e in this.form){if("customer_email"===e)continue;const o=i(s,e);i(r,e)!==o&&d(t,e,o)}this.undo(),this.edit(o(o({},t),{},{customer_uri:e}))}catch(t){this.edit({customer_uri:"",customer_email:e})}},this.__isGuestMode=!1}static get properties(){return o(o({},super.properties),{},{itemCategories:{attribute:"item-categories"},templateSets:{attribute:"template-sets"},localeCodes:{attribute:"locale-codes"},customers:{},countries:{},regions:{},coupons:{},__isGuestMode:{attribute:!1}})}static get v8n(){return[({billing_first_name:e})=>!e||e.length<=50||"billing-first-name:v8n_too_long",({billing_last_name:e})=>!e||e.length<=50||"billing-last-name:v8n_too_long",({billing_region:e})=>!e||e.length<=50||"billing-region:v8n_too_long",({billing_city:e})=>!e||e.length<=50||"billing-city:v8n_too_long",({billing_phone:e})=>!e||e.length<=50||"billing-phone:v8n_too_long",({billing_company:e})=>!e||e.length<=50||"billing-company:v8n_too_long",({billing_address2:e})=>!e||e.length<=100||"billing-address-two:v8n_too_long",({billing_address1:e})=>!e||e.length<=100||"billing-address-one:v8n_too_long",({billing_postal_code:e})=>!e||e.length<=50||"billing-postal-code:v8n_too_long",({shipping_first_name:e})=>!e||e.length<=50||"shipping-first-name:v8n_too_long",({shipping_last_name:e})=>!e||e.length<=50||"shipping-last-name:v8n_too_long",({shipping_region:e})=>!e||e.length<=50||"shipping-region:v8n_too_long",({shipping_city:e})=>!e||e.length<=50||"shipping-city:v8n_too_long",({shipping_phone:e})=>!e||e.length<=50||"shipping-phone:v8n_too_long",({shipping_company:e})=>!e||e.length<=50||"shipping-company:v8n_too_long",({shipping_address2:e})=>!e||e.length<=100||"shipping-address-two:v8n_too_long",({shipping_address1:e})=>!e||e.length<=100||"shipping-address-one:v8n_too_long",({shipping_postal_code:e})=>!e||e.length<=50||"shipping-postal-code:v8n_too_long"]}renderBody(){var e,t,o,i,r,n,l,d,c,f,p,g;const x=Object.values(null!==(e=this.__shippingRegions)&&void 0!==e?e:{}),v=Object.values(null!==(t=this.__billingRegions)&&void 0!==t?t:{}),b=Object.values(null!==(o=this.__countriesHelper)&&void 0!==o?o:{}),j=x.map((e=>({label:e.default,value:e.code}))),$=v.map((e=>({label:e.default,value:e.code}))),L=b.map((e=>({label:e.default,value:e.cc2}))),S=null===(i=this.__customer)||void 0===i?void 0:i._links["fx:customer_addresses"].href,k=this.__store,R=k?k.use_international_currency_symbol?"code":"symbol":void 0;let I=null;if(this.form.currency_code)I=this.form.currency_code;else{const e=this.__localeCodesHelper,t=null===(n=null!==(r=this.__templateSet)&&void 0!==r?r:this.__defaultTemplateSet)||void 0===n?void 0:n.locale_code,o=t?null==e?void 0:e.values[t]:void 0;o&&(I=null!==(d=null===(l=/Currency: ([A-Z]{3})/g.exec(o))||void 0===l?void 0:l[1])&&void 0!==d?d:null)}return s(_||(_=H` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <div class="grid sm-grid-cols-2 gap-l"> <div class="sm-col-span-2"> <foxy-i18n class="text-l font-medium leading-s block" infer="" key="order_section_title"> </foxy-i18n> <foxy-i18n class="text-s text-secondary leading-s block" infer="" key="order_section_description"> </foxy-i18n> </div> <foxy-internal-select-control infer="customer-type" .getValue="${0}" .setValue="${0}" .options="${0}" @update="${0}"> </foxy-internal-select-control> <foxy-internal-async-combo-box-control item-label-path="email" item-value-path="_links.self.href" item-id-path="_links.self.href" first="${0}" infer="customer" allow-custom-value .selectedItem="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-async-combo-box-control item-label-path="description" item-value-path="_links.self.href" item-id-path="_links.self.href" first="${0}" class="sm-col-span-2" infer="template-set-uri" .selectedItem="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-async-list-control infer="items" class="min-w-0 sm-col-span-2" first="${0}" limit="5" .item="${0}" .form="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="applied-coupon-codes" class="min-w-0 sm-col-span-2" first="${0}" limit="5" item="foxy-applied-coupon-code-card" form="${0}" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="custom-fields" class="min-w-0" first="${0}" limit="5" item="foxy-custom-field-card" form="${0}" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" limit="5" item="foxy-attribute-card" form="${0}" alert> </foxy-internal-async-list-control> <div class="grid gap-l"> <div> <foxy-i18n class="text-l font-medium leading-s block" infer="" key="billing_section_title"> </foxy-i18n> <foxy-i18n class="text-s text-secondary leading-s block" infer="" key="billing_section_description"> </foxy-i18n> </div> <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control infer="billing-first-name"></foxy-internal-text-control> <foxy-internal-text-control infer="billing-last-name"></foxy-internal-text-control> <foxy-internal-text-control infer="billing-company"></foxy-internal-text-control> <foxy-internal-text-control infer="billing-phone"></foxy-internal-text-control> <foxy-internal-text-control property="billing_address1" infer="billing-address-one" class="col-span-2"> </foxy-internal-text-control> <foxy-internal-text-control property="billing_address2" infer="billing-address-two" class="col-span-2"> </foxy-internal-text-control> <foxy-internal-select-control infer="billing-country" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="billing-region" .options="${0}"> </foxy-internal-select-control> <foxy-internal-text-control infer="billing-city"></foxy-internal-text-control> <foxy-internal-text-control infer="billing-postal-code"></foxy-internal-text-control> </div> </div> <div class="grid gap-l"> <div> <foxy-i18n class="text-l font-medium leading-s block" infer="" key="shipping_section_title"> </foxy-i18n> <foxy-i18n class="text-s text-secondary leading-s block" infer="" key="shipping_section_description"> </foxy-i18n> </div> <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control infer="shipping-first-name"></foxy-internal-text-control> <foxy-internal-text-control infer="shipping-last-name"></foxy-internal-text-control> <foxy-internal-text-control infer="shipping-company"></foxy-internal-text-control> <foxy-internal-text-control infer="shipping-phone"></foxy-internal-text-control> <foxy-internal-text-control property="shipping_address1" infer="shipping-address-one" class="col-span-2"> </foxy-internal-text-control> <foxy-internal-text-control property="shipping_address2" infer="shipping-address-two" class="col-span-2"> </foxy-internal-text-control> <foxy-internal-select-control infer="shipping-country" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="shipping-region" .options="${0}"> </foxy-internal-select-control> <foxy-internal-text-control infer="shipping-city"></foxy-internal-text-control> <foxy-internal-text-control infer="shipping-postal-code"></foxy-internal-text-control> </div> </div> <div class="leading-m sm-col-span-2"> <div class="text-xl font-medium mb-s"> ${0} </div> <div class="border-t border-contrast-10 mb-s"></div> ${0} ${0} </div> ${0} </div> `),a(this.__shippingRegionsHref),this.__shippingRegionsLoaderId,(()=>this.requestUpdate()),a(this.__billingRegionsHref),this.__billingRegionsLoaderId,(()=>this.requestUpdate()),a(this.__countriesHref),this.__countriesHelperLoaderId,(()=>this.requestUpdate()),a(this.__customerHref),this.__customerLoaderId,(()=>this.requestUpdate()),a(this.__discountsHref),this.__discountsLoaderId,(()=>this.requestUpdate()),a(this.__defaultTemplateSetHref),this.__defaultTemplateSetLoaderId,(()=>this.requestUpdate()),a(this.__localeCodesHelperHref),this.__localeCodesHelperLoaderId,(()=>this.requestUpdate()),a(this.__templateSetHref),this.__templateSetLoaderId,(()=>this.requestUpdate()),a(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__customerTypeGetValue,this.__customerTypeSetValue,this.__customerTypeOptions,(()=>this.requestUpdate()),a(this.__customersHref),this.__customer,this.__customerGetValue,this.__customerSetValue,a(this.templateSets),null!==(c=this.__templateSet)&&void 0!==c?c:null,a(this.__itemsHref),(e=>s(h||(h=H` <foxy-item-card locale-codes="${0}" parent="${0}" infer="" href="${0}" .related="${0}"> </foxy-item-card> `),this.localeCodes,e.parent,e.href,e.related)),this.data?e=>{var t,o,i;return s(u||(u=H` <foxy-item-form customer-addresses="${0}" item-categories="${0}" locale-codes="${0}" coupons="${0}" parent="${0}" href="${0}" infer="" id="form" .related="${0}" @fetch="${0}" @update="${0}"> </foxy-item-form> `),a(null!=S?S:void 0),a(null!==(t=this.itemCategories)&&void 0!==t?t:void 0),a(null!==(o=this.localeCodes)&&void 0!==o?o:void 0),a(null!==(i=this.coupons)&&void 0!==i?i:void 0),e.dialog.parent,e.dialog.href,e.dialog.related,e.handleFetch,e.handleUpdate)}:null,a(null===(f=this.data)||void 0===f?void 0:f._links["fx:applied_coupon_codes"].href),a(this.data?"foxy-applied-coupon-code-form":void 0),a(null===(p=this.data)||void 0===p?void 0:p._links["fx:custom_fields"].href),a(this.data?"foxy-custom-field-form":void 0),a(null===(g=this.data)||void 0===g?void 0:g._links["fx:attributes"].href),a(this.data?"foxy-attribute-form":void 0),L,$,L,j,this.__renderTotalOrder(I,R),this.__renderTotals(I,R),this.__renderDiscounts(I,R),this.data?s(m||(m=H` <div class="grid gap-s sm-grid-cols-2 sm-gap-l sm-col-span-2"> <foxy-internal-cart-form-view-as-customer-control infer="view-as-customer"> </foxy-internal-cart-form-view-as-customer-control> <foxy-internal-delete-control infer="delete"></foxy-internal-delete-control> </div> `)):s(y||(y=H`<foxy-internal-create-control infer="create"></foxy-internal-create-control>`)))}get __defaultTemplateSetHref(){var e,t,o;if(""===(null===(e=this.data)||void 0===e?void 0:e.template_set_uri))try{const e=new URL(null!==(o=null===(t=this.__store)||void 0===t?void 0:t._links["fx:template_sets"].href)&&void 0!==o?o:"");return e.searchParams.set("code","DEFAULT"),e.toString()}catch(e){}}get __localeCodesHelperHref(){var e;if(this.__defaultTemplateSetHref||this.__templateSetHref)return null!==(e=this.localeCodes)&&void 0!==e?e:void 0}get __shippingRegionsHref(){var e;try{const t=new URL(null!==(e=this.regions)&&void 0!==e?e:""),o=this.form.shipping_country;return o&&t.searchParams.set("country_code",o),t.toString()}catch(e){}}get __billingRegionsHref(){var e;try{const t=new URL(null!==(e=this.regions)&&void 0!==e?e:""),o=this.form.billing_country;return o&&t.searchParams.set("country_code",o),t.toString()}catch(e){}}get __templateSetHref(){return this.form.template_set_uri||void 0}get __customersHref(){var e;try{const t=new URL(null!==(e=this.customers)&&void 0!==e?e:"");return t.searchParams.set("is_anonymous",this.__isGuestMode?"1":"0"),t.toString()}catch(e){}}get __countriesHref(){var e;return null!==(e=this.countries)&&void 0!==e?e:void 0}get __discountsHref(){var e,t;try{const o=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:discounts"].href)&&void 0!==t?t:"");return o.searchParams.set("limit","300"),o.toString()}catch(e){}}get __customerHref(){return this.form.customer_uri||void 0}get __itemsHref(){var e,t;try{const o=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:items"].href)&&void 0!==t?t:"");return o.searchParams.set("zoom","item_options"),o.toString()}catch(e){}}get __storeHref(){var e,t;return null===(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:store"])||void 0===t?void 0:t.href}get __defaultTemplateSet(){var e,t;const o=`#${this.__defaultTemplateSetLoaderId}`,i=this.renderRoot.querySelector(o);return null!==(t=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e._embedded["fx:template_sets"][0])&&void 0!==t?t:null}get __localeCodesHelper(){var e,t;const o=`#${this.__localeCodesHelperLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(o))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __shippingRegions(){var e;const t=this.renderRoot.querySelector(`#${this.__shippingRegionsLoaderId}`);return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.values}get __billingRegions(){var e;const t=this.renderRoot.querySelector(`#${this.__billingRegionsLoaderId}`);return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.values}get __templateSet(){var e,t;const o=`#${this.__templateSetLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(o))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __discounts(){return this.renderRoot.querySelector(`#${this.__discountsLoaderId}`)}get __countriesHelper(){var e;const t=this.renderRoot.querySelector(`#${this.__countriesHelperLoaderId}`);return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.values}get __customer(){var e;return null===(e=this.renderRoot.querySelector(`#${this.__customerLoaderId}`))||void 0===e?void 0:e.data}get __store(){var e,t;const o=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(o))||void 0===e?void 0:e.data)&&void 0!==t?t:null}__renderTotalOrder(e,t){const o=this.data;if(!o||!e||!t)return s(g||(g=H`--`));const i={amount:`${o.total_order} ${e}`,currencyDisplay:t};return s(x||(x=H`<foxy-i18n infer="totals" key="total_order" .options="${0}"></foxy-i18n>`),i)}__renderTotals(e,t){const o=this.data,i=o&&e&&t;return["total_item_price","total_shipping","total_tax"].map((r=>{const n={amount:`${null==o?void 0:o[r]} ${e}`,currencyDisplay:t};return s(v||(v=H` <div data-testid="${0}" class="flex justify-between text-m text-secondary"> <foxy-i18n key="${0}" infer="totals"></foxy-i18n> ${0} </div> `),r,r,i?s(b||(b=H`<foxy-i18n infer="totals" key="price" .options="${0}"></foxy-i18n>`),n):s(j||(j=H`<span>--</span>`)))}))}__renderDiscounts(e,t){var o,i;const r=null===(i=null===(o=this.__discounts)||void 0===o?void 0:o.data)||void 0===i?void 0:i._embedded["fx:discounts"],n=e&&t;return null==r?void 0:r.map((o=>{const i={amount:`${o.amount} ${e}`,currencyDisplay:t};return s($||($=H` <div data-testclass="discount" class="flex justify-between text-m text-secondary"> <span>${0} &bull; ${0}</span> ${0} </div> `),o.name,o.code,n?s(L||(L=H`<foxy-i18n infer="totals" key="price" .options="${0}"></foxy-i18n>`),i):s(S||(S=H`<span>--</span>`)))}))}}customElements.define("foxy-cart-form",R);export{R as CartForm};
1
+ import"./shared-c839e147.js";import"./shared-5103c1b4.js";import"./shared-0c0ee663.js";import{I as e}from"./shared-5280c80a.js";import"./shared-d90dbae7.js";import"./foxy-applied-coupon-code-card.js";import"./foxy-applied-coupon-code-form.js";import"./foxy-custom-field-card.js";import"./foxy-custom-field-form.js";import"./foxy-nucleon-element.js";import"./foxy-attribute-card.js";import"./foxy-attribute-form.js";import"./foxy-discount-card.js";import"./foxy-item-card.js";import"./foxy-item-form.js";import"./shared-2edcd981.js";import{I as t}from"./shared-ba93be6b.js";import{_ as o,Y as i}from"./shared-4c2e9064.js";import{c as r}from"./shared-4e709717.js";import{h as s}from"./shared-7f33a83a.js";import{R as n,a as l}from"./shared-3b709ddc.js";import{i as a}from"./shared-d3bf9ac0.js";import{s as d}from"./shared-8a9c64b2.js";import"./shared-ef7f2d07.js";import"./shared-eb8a0fdf.js";import"./shared-e5239bec.js";import"./shared-3f04e4cc.js";import"./shared-fff03a45.js";import"./shared-5784c088.js";import"./shared-7abbc95c.js";import"./shared-ff7fd5fa.js";import"./shared-35728235.js";import"./shared-343d1fd7.js";import"./shared-9048eeb2.js";import"./foxy-collection-page.js";import"./foxy-spinner.js";import"./shared-b446c140.js";import"./shared-fd96bcd1.js";import"./shared-5cf7b194.js";import"./shared-9b12aeac.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";import"./shared-d519a301.js";import"./shared-11c2efc8.js";import"./foxy-swipe-actions.js";import"./foxy-form-dialog.js";import"./shared-799dc083.js";import"./shared-621b3283.js";import"./foxy-pagination.js";import"./shared-584174ff.js";import"./shared-31d8e3b8.js";import"./shared-f0a9f3c2.js";import"./shared-8f922de8.js";import"./shared-ad80244a.js";import"./shared-f9180815.js";import"./shared-099c1f57.js";import"./shared-601f27b1.js";import"./shared-13fbea95.js";import"./shared-3c2414d4.js";import"./shared-6daeb197.js";import"./shared-bee111d6.js";import"./shared-f21e5761.js";import"./shared-f5bbb1e0.js";import"./shared-4205699e.js";import"./shared-d1f5de89.js";import"./shared-5a889c45.js";import"./shared-27d21f4a.js";import"./foxy-discount-detail-card.js";import"./foxy-coupon-detail-card.js";import"./foxy-item-option-card.js";import"./foxy-item-option-form.js";import"./foxy-coupon-card.js";import"./foxy-discount-builder.js";import"./shared-bb05cfed.js";import"./shared-773e7177.js";import"./shared-c76ef8d8.js";import"./shared-79d0699c.js";import"./shared-efaf8d49.js";import"./foxy-subscription-card.js";import"./shared-630a0ff2.js";import"./foxy-subscription-form.js";import"./foxy-cancellation-form.js";import"./foxy-transaction-card.js";import"./foxy-customer-card.js";import"./shared-e006e82c.js";import"./shared-800ee6c0.js";import"./shared-3bcc07cd.js";let c,f,u=e=>e;customElements.define("foxy-internal-cart-form-view-as-customer-control",class extends t{constructor(){super(...arguments),this.__loader=null}static get properties(){return o(o({},super.properties),{},{__loader:{attribute:!1}})}renderControl(){var e,t;const o=null===(e=this.__loader)||void 0===e?void 0:e.state,i=null===(t=this.__loader)||void 0===t?void 0:t.result;return i?s(c||(c=u` <a target="_blank" class="flex h-m px-m rounded font-medium transition-colors text-body bg-contrast-5 hover-bg-contrast-10 items-center justify-center focus-outline-none focus-ring-2 focus-ring-primary-50" href="${0}"> <foxy-i18n infer="" key="state_idle"></foxy-i18n> </a> `),i):s(f||(f=u` <div class="${0}"> <foxy-i18n infer="" key="${0}"> </foxy-i18n> </div> `),r({"flex h-m px-m rounded items-center justify-center":!0,"transition-colors bg-contrast-5 font-medium":!0,"text-tertiary":"fail"!==o,"text-error":"fail"===o}),"fail"===o?"state_fail":"state_busy")}updated(e){var t;super.updated(e);const o=this.nucleon,i=null==o?void 0:o.data,r=null!==(t=null==i?void 0:i._links["fx:create_session"].href)&&void 0!==t?t:null;this.__reloadSessionHref(r)}async __reloadSessionHref(e){var t;if((null===(t=this.__loader)||void 0===t?void 0:t.href)===e)return;const o=this.nucleon;if(o)if(e){const t={result:null,state:"busy",href:e},i=new o.constructor.API(this);this.__loader=t;try{const o=await i.fetch(e,{method:"POST"});if(!o.ok)throw new Error;t.result=(await o.json()).cart_link,t.state="idle"}catch(e){t.state="fail"}finally{this.requestUpdate()}}else this.__loader=null}});let p,_,h,m,y,g,x,v,b,j,$,L,S,H=e=>e;const k=n(l(e,"cart-form"));class R extends k{constructor(){super(...arguments),this.itemCategories=null,this.templateSets=null,this.localeCodes=null,this.customers=null,this.countries=null,this.templates={},this.regions=null,this.coupons=null,this.__defaultTemplateSetLoaderId="defaultTemplateSetLoader",this.__localeCodesHelperLoaderId="localeCodesLoader",this.__shippingRegionsLoaderId="shippingRegionsLoader",this.__billingRegionsLoaderId="billingRegionsLoader",this.__templateSetLoaderId="templateSetLoader",this.__countriesHelperLoaderId="countriesHelperLoader",this.__discountsLoaderId="discountsLoader",this.__customerLoaderId="customerLoader",this.__storeLoaderId="storeLoader",this.__customerTypeGetValue=()=>{var e;return this.form.customer_uri?(null===(e=this.__customer)||void 0===e?void 0:e.is_anonymous)?"guest":"regular":"new"},this.__customerTypeSetValue=e=>{this.edit({customer_uri:"",customer_email:""}),this.__isGuestMode="guest"===e},this.__customerTypeOptions=[{label:"option_new",value:"new"},{label:"option_guest",value:"guest"},{label:"option_regular",value:"regular"}],this.__customerGetValue=()=>this.form.customer_uri||this.form.customer_email,this.__customerSetValue=e=>{try{new URL(e);const t={},r=this.data,s=this.form;for(const e in this.form){if("customer_email"===e)continue;const o=i(s,e);i(r,e)!==o&&d(t,e,o)}this.undo(),this.edit(o(o({},t),{},{customer_uri:e}))}catch(t){this.edit({customer_uri:"",customer_email:e})}},this.__isGuestMode=!1}static get properties(){return o(o({},super.properties),{},{itemCategories:{attribute:"item-categories"},templateSets:{attribute:"template-sets"},localeCodes:{attribute:"locale-codes"},customers:{},countries:{},regions:{},coupons:{},__isGuestMode:{attribute:!1}})}static get v8n(){return[({billing_first_name:e})=>!e||e.length<=50||"billing-first-name:v8n_too_long",({billing_last_name:e})=>!e||e.length<=50||"billing-last-name:v8n_too_long",({billing_region:e})=>!e||e.length<=50||"billing-region:v8n_too_long",({billing_city:e})=>!e||e.length<=50||"billing-city:v8n_too_long",({billing_phone:e})=>!e||e.length<=50||"billing-phone:v8n_too_long",({billing_company:e})=>!e||e.length<=50||"billing-company:v8n_too_long",({billing_address2:e})=>!e||e.length<=100||"billing-address-two:v8n_too_long",({billing_address1:e})=>!e||e.length<=100||"billing-address-one:v8n_too_long",({billing_postal_code:e})=>!e||e.length<=50||"billing-postal-code:v8n_too_long",({shipping_first_name:e})=>!e||e.length<=50||"shipping-first-name:v8n_too_long",({shipping_last_name:e})=>!e||e.length<=50||"shipping-last-name:v8n_too_long",({shipping_region:e})=>!e||e.length<=50||"shipping-region:v8n_too_long",({shipping_city:e})=>!e||e.length<=50||"shipping-city:v8n_too_long",({shipping_phone:e})=>!e||e.length<=50||"shipping-phone:v8n_too_long",({shipping_company:e})=>!e||e.length<=50||"shipping-company:v8n_too_long",({shipping_address2:e})=>!e||e.length<=100||"shipping-address-two:v8n_too_long",({shipping_address1:e})=>!e||e.length<=100||"shipping-address-one:v8n_too_long",({shipping_postal_code:e})=>!e||e.length<=50||"shipping-postal-code:v8n_too_long"]}renderBody(){var e,t,o,i,r,n,l,d,c,f,u,g;const x=Object.values(null!==(e=this.__shippingRegions)&&void 0!==e?e:{}),v=Object.values(null!==(t=this.__billingRegions)&&void 0!==t?t:{}),b=Object.values(null!==(o=this.__countriesHelper)&&void 0!==o?o:{}),j=x.map((e=>({label:e.default,value:e.code}))),$=v.map((e=>({label:e.default,value:e.code}))),L=b.map((e=>({label:e.default,value:e.cc2}))),S=null===(i=this.__customer)||void 0===i?void 0:i._links["fx:customer_addresses"].href,k=this.__store,R=k?k.use_international_currency_symbol?"code":"symbol":void 0;let I=null;if(this.form.currency_code)I=this.form.currency_code;else{const e=this.__localeCodesHelper,t=null===(n=null!==(r=this.__templateSet)&&void 0!==r?r:this.__defaultTemplateSet)||void 0===n?void 0:n.locale_code,o=t?null==e?void 0:e.values[t]:void 0;o&&(I=null!==(d=null===(l=/Currency: ([A-Z]{3})/g.exec(o))||void 0===l?void 0:l[1])&&void 0!==d?d:null)}return s(h||(h=H` <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <foxy-nucleon class="hidden" infer="" href="${0}" id="${0}" @update="${0}"> </foxy-nucleon> <div class="grid sm-grid-cols-2 gap-l"> <div class="sm-col-span-2"> <foxy-i18n class="text-l font-medium leading-s block" infer="" key="order_section_title"> </foxy-i18n> <foxy-i18n class="text-s text-secondary leading-s block" infer="" key="order_section_description"> </foxy-i18n> </div> <foxy-internal-select-control infer="customer-type" .getValue="${0}" .setValue="${0}" .options="${0}" @update="${0}"> </foxy-internal-select-control> <foxy-internal-async-combo-box-control item-label-path="email" item-value-path="_links.self.href" item-id-path="_links.self.href" first="${0}" infer="customer" allow-custom-value .selectedItem="${0}" .getValue="${0}" .setValue="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-async-combo-box-control item-label-path="description" item-value-path="_links.self.href" item-id-path="_links.self.href" first="${0}" class="sm-col-span-2" infer="template-set-uri" .selectedItem="${0}"> </foxy-internal-async-combo-box-control> <foxy-internal-async-list-control infer="items" class="min-w-0 sm-col-span-2" first="${0}" limit="5" .item="${0}" .form="${0}"> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="applied-coupon-codes" class="min-w-0 sm-col-span-2" first="${0}" limit="5" item="foxy-applied-coupon-code-card" form="${0}" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="custom-fields" class="min-w-0" first="${0}" limit="5" item="foxy-custom-field-card" form="${0}" alert> </foxy-internal-async-list-control> <foxy-internal-async-list-control infer="attributes" class="min-w-0" first="${0}" limit="5" item="foxy-attribute-card" form="${0}" alert> </foxy-internal-async-list-control> <div class="grid gap-l"> <div> <foxy-i18n class="text-l font-medium leading-s block" infer="" key="billing_section_title"> </foxy-i18n> <foxy-i18n class="text-s text-secondary leading-s block" infer="" key="billing_section_description"> </foxy-i18n> </div> <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control infer="billing-first-name"></foxy-internal-text-control> <foxy-internal-text-control infer="billing-last-name"></foxy-internal-text-control> <foxy-internal-text-control infer="billing-company"></foxy-internal-text-control> <foxy-internal-text-control infer="billing-phone"></foxy-internal-text-control> <foxy-internal-text-control property="billing_address1" infer="billing-address-one" class="col-span-2"> </foxy-internal-text-control> <foxy-internal-text-control property="billing_address2" infer="billing-address-two" class="col-span-2"> </foxy-internal-text-control> <foxy-internal-select-control infer="billing-country" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="billing-region" .options="${0}"> </foxy-internal-select-control> <foxy-internal-text-control infer="billing-city"></foxy-internal-text-control> <foxy-internal-text-control infer="billing-postal-code"></foxy-internal-text-control> </div> </div> <div class="grid gap-l"> <div> <foxy-i18n class="text-l font-medium leading-s block" infer="" key="shipping_section_title"> </foxy-i18n> <foxy-i18n class="text-s text-secondary leading-s block" infer="" key="shipping_section_description"> </foxy-i18n> </div> <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control infer="shipping-first-name"></foxy-internal-text-control> <foxy-internal-text-control infer="shipping-last-name"></foxy-internal-text-control> <foxy-internal-text-control infer="shipping-company"></foxy-internal-text-control> <foxy-internal-text-control infer="shipping-phone"></foxy-internal-text-control> <foxy-internal-text-control property="shipping_address1" infer="shipping-address-one" class="col-span-2"> </foxy-internal-text-control> <foxy-internal-text-control property="shipping_address2" infer="shipping-address-two" class="col-span-2"> </foxy-internal-text-control> <foxy-internal-select-control infer="shipping-country" .options="${0}"> </foxy-internal-select-control> <foxy-internal-select-control infer="shipping-region" .options="${0}"> </foxy-internal-select-control> <foxy-internal-text-control infer="shipping-city"></foxy-internal-text-control> <foxy-internal-text-control infer="shipping-postal-code"></foxy-internal-text-control> </div> </div> <div class="leading-m sm-col-span-2"> <div class="text-xl font-medium mb-s"> ${0} </div> <div class="border-t border-contrast-10 mb-s"></div> ${0} ${0} </div> ${0} </div> `),a(this.__shippingRegionsHref),this.__shippingRegionsLoaderId,(()=>this.requestUpdate()),a(this.__billingRegionsHref),this.__billingRegionsLoaderId,(()=>this.requestUpdate()),a(this.__countriesHref),this.__countriesHelperLoaderId,(()=>this.requestUpdate()),a(this.__customerHref),this.__customerLoaderId,(()=>this.requestUpdate()),a(this.__discountsHref),this.__discountsLoaderId,(()=>this.requestUpdate()),a(this.__defaultTemplateSetHref),this.__defaultTemplateSetLoaderId,(()=>this.requestUpdate()),a(this.__localeCodesHelperHref),this.__localeCodesHelperLoaderId,(()=>this.requestUpdate()),a(this.__templateSetHref),this.__templateSetLoaderId,(()=>this.requestUpdate()),a(this.__storeHref),this.__storeLoaderId,(()=>this.requestUpdate()),this.__customerTypeGetValue,this.__customerTypeSetValue,this.__customerTypeOptions,(()=>this.requestUpdate()),a(this.__customersHref),this.__customer,this.__customerGetValue,this.__customerSetValue,a(this.templateSets),null!==(c=this.__templateSet)&&void 0!==c?c:null,a(this.__itemsHref),(e=>s(_||(_=H` <foxy-item-card locale-codes="${0}" parent="${0}" infer="" href="${0}" .related="${0}"> </foxy-item-card> `),this.localeCodes,e.parent,e.href,e.related)),this.data?e=>{var t,o,i;return s(p||(p=H` <foxy-item-form customer-addresses="${0}" item-categories="${0}" locale-codes="${0}" coupons="${0}" parent="${0}" href="${0}" infer="" id="form" .related="${0}" @fetch="${0}" @update="${0}"> </foxy-item-form> `),a(null!=S?S:void 0),a(null!==(t=this.itemCategories)&&void 0!==t?t:void 0),a(null!==(o=this.localeCodes)&&void 0!==o?o:void 0),a(null!==(i=this.coupons)&&void 0!==i?i:void 0),e.dialog.parent,e.dialog.href,e.dialog.related,e.handleFetch,e.handleUpdate)}:null,a(null===(f=this.data)||void 0===f?void 0:f._links["fx:applied_coupon_codes"].href),a(this.data?"foxy-applied-coupon-code-form":void 0),a(null===(u=this.data)||void 0===u?void 0:u._links["fx:custom_fields"].href),a(this.data?"foxy-custom-field-form":void 0),a(null===(g=this.data)||void 0===g?void 0:g._links["fx:attributes"].href),a(this.data?"foxy-attribute-form":void 0),L,$,L,j,this.__renderTotalOrder(I,R),this.__renderTotals(I,R),this.__renderDiscounts(I,R),this.data?s(m||(m=H` <div class="grid gap-s sm-grid-cols-2 sm-gap-l sm-col-span-2"> <foxy-internal-cart-form-view-as-customer-control infer="view-as-customer"> </foxy-internal-cart-form-view-as-customer-control> <foxy-internal-delete-control infer="delete"></foxy-internal-delete-control> </div> `)):s(y||(y=H`<foxy-internal-create-control infer="create"></foxy-internal-create-control>`)))}get __defaultTemplateSetHref(){var e,t,o;if(""===(null===(e=this.data)||void 0===e?void 0:e.template_set_uri))try{const e=new URL(null!==(o=null===(t=this.__store)||void 0===t?void 0:t._links["fx:template_sets"].href)&&void 0!==o?o:"");return e.searchParams.set("code","DEFAULT"),e.toString()}catch(e){}}get __localeCodesHelperHref(){var e;if(this.__defaultTemplateSetHref||this.__templateSetHref)return null!==(e=this.localeCodes)&&void 0!==e?e:void 0}get __shippingRegionsHref(){var e;try{const t=new URL(null!==(e=this.regions)&&void 0!==e?e:""),o=this.form.shipping_country;return o&&t.searchParams.set("country_code",o),t.toString()}catch(e){}}get __billingRegionsHref(){var e;try{const t=new URL(null!==(e=this.regions)&&void 0!==e?e:""),o=this.form.billing_country;return o&&t.searchParams.set("country_code",o),t.toString()}catch(e){}}get __templateSetHref(){return this.form.template_set_uri||void 0}get __customersHref(){var e;try{const t=new URL(null!==(e=this.customers)&&void 0!==e?e:"");return t.searchParams.set("is_anonymous",this.__isGuestMode?"1":"0"),t.toString()}catch(e){}}get __countriesHref(){var e;return null!==(e=this.countries)&&void 0!==e?e:void 0}get __discountsHref(){var e,t;try{const o=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:discounts"].href)&&void 0!==t?t:"");return o.searchParams.set("limit","300"),o.toString()}catch(e){}}get __customerHref(){return this.form.customer_uri||void 0}get __itemsHref(){var e,t;try{const o=new URL(null!==(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:items"].href)&&void 0!==t?t:"");return o.searchParams.set("zoom","item_options"),o.toString()}catch(e){}}get __storeHref(){var e,t;return null===(t=null===(e=this.data)||void 0===e?void 0:e._links["fx:store"])||void 0===t?void 0:t.href}get __defaultTemplateSet(){var e,t;const o=`#${this.__defaultTemplateSetLoaderId}`,i=this.renderRoot.querySelector(o);return null!==(t=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e._embedded["fx:template_sets"][0])&&void 0!==t?t:null}get __localeCodesHelper(){var e,t;const o=`#${this.__localeCodesHelperLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(o))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __shippingRegions(){var e;const t=this.renderRoot.querySelector(`#${this.__shippingRegionsLoaderId}`);return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.values}get __billingRegions(){var e;const t=this.renderRoot.querySelector(`#${this.__billingRegionsLoaderId}`);return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.values}get __templateSet(){var e,t;const o=`#${this.__templateSetLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(o))||void 0===e?void 0:e.data)&&void 0!==t?t:null}get __discounts(){return this.renderRoot.querySelector(`#${this.__discountsLoaderId}`)}get __countriesHelper(){var e;const t=this.renderRoot.querySelector(`#${this.__countriesHelperLoaderId}`);return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.values}get __customer(){var e;return null===(e=this.renderRoot.querySelector(`#${this.__customerLoaderId}`))||void 0===e?void 0:e.data}get __store(){var e,t;const o=`#${this.__storeLoaderId}`;return null!==(t=null===(e=this.renderRoot.querySelector(o))||void 0===e?void 0:e.data)&&void 0!==t?t:null}__renderTotalOrder(e,t){const o=this.data;if(!o||!e||!t)return s(g||(g=H`--`));const i={amount:`${o.total_order} ${e}`,currencyDisplay:t};return s(x||(x=H`<foxy-i18n infer="totals" key="total_order" .options="${0}"></foxy-i18n>`),i)}__renderTotals(e,t){const o=this.data,i=o&&e&&t;return["total_item_price","total_shipping","total_tax"].map((r=>{const n={amount:`${null==o?void 0:o[r]} ${e}`,currencyDisplay:t};return s(v||(v=H` <div data-testid="${0}" class="flex justify-between text-m text-secondary"> <foxy-i18n key="${0}" infer="totals"></foxy-i18n> ${0} </div> `),r,r,i?s(b||(b=H`<foxy-i18n infer="totals" key="price" .options="${0}"></foxy-i18n>`),n):s(j||(j=H`<span>--</span>`)))}))}__renderDiscounts(e,t){var o,i;const r=null===(i=null===(o=this.__discounts)||void 0===o?void 0:o.data)||void 0===i?void 0:i._embedded["fx:discounts"],n=e&&t;return null==r?void 0:r.map((o=>{const i={amount:`${o.amount} ${e}`,currencyDisplay:t};return s($||($=H` <div data-testclass="discount" class="flex justify-between text-m text-secondary"> <span>${0} &bull; ${0}</span> ${0} </div> `),o.name,o.code,n?s(L||(L=H`<foxy-i18n infer="totals" key="price" .options="${0}"></foxy-i18n>`),i):s(S||(S=H`<span>--</span>`)))}))}}customElements.define("foxy-cart-form",R);export{R as CartForm};
@@ -1 +1 @@
1
- import"./shared-fcfbfbdb.js";import"./shared-d90dbae7.js";import{I as t}from"./shared-e2e2ca6a.js";import{R as e,a as r}from"./shared-3b709ddc.js";import{B as o}from"./shared-4c2e9064.js";import{h as n}from"./shared-7f33a83a.js";import"./shared-6daeb197.js";import"./shared-eb8a0fdf.js";import"./shared-e5239bec.js";import"./shared-7abbc95c.js";import"./shared-3f04e4cc.js";import"./shared-ff7fd5fa.js";import"./shared-ba93be6b.js";import"./shared-f9180815.js";import"./shared-2edcd981.js";import"./shared-343d1fd7.js";import"./shared-fd96bcd1.js";import"./shared-5cf7b194.js";import"./shared-d3bf9ac0.js";import"./shared-9b12aeac.js";import"./shared-35728235.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";import"./shared-9048eeb2.js";import"./shared-799dc083.js";import"./shared-621b3283.js";import"./shared-4e709717.js";import"./foxy-spinner.js";import"./shared-5784c088.js";import"./shared-b446c140.js";let s,a=t=>t;const i=e(r(t,"client-form"));class c extends i{constructor(){super(...arguments),this.templates={}}get readonlySelector(){const t=["client-secret"];return(this.data||this.in({busy:"fetching"}))&&t.push("client-id"),new o(`${t.join(" ")} ${super.readonlySelector.toString()}`)}get hiddenSelector(){const t=[];return this.data||this.in({busy:"fetching"})||t.push("client-secret"),new o(`${t.join(" ")} ${super.hiddenSelector.toString()}`)}renderBody(){return n(s||(s=a` <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control class="col-span-2" infer="client-id"> </foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="client-secret"> </foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="redirect-uri"> </foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="project-name"> </foxy-internal-text-control> <foxy-internal-text-area-control class="col-span-2" infer="project-description"> </foxy-internal-text-area-control> <foxy-internal-text-control infer="company-name"></foxy-internal-text-control> <foxy-internal-text-control infer="company-url"></foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="company-logo"> </foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="contact-name"> </foxy-internal-text-control> <foxy-internal-text-control infer="contact-email"></foxy-internal-text-control> <foxy-internal-text-control infer="contact-phone"></foxy-internal-text-control> </div> ${0} `),super.renderBody())}}customElements.define("foxy-client-form",c);export{c as ClientForm};
1
+ import"./shared-fcfbfbdb.js";import"./shared-d90dbae7.js";import{I as t}from"./shared-5280c80a.js";import{R as e,a as r}from"./shared-3b709ddc.js";import{B as o}from"./shared-4c2e9064.js";import{h as n}from"./shared-7f33a83a.js";import"./shared-6daeb197.js";import"./shared-eb8a0fdf.js";import"./shared-e5239bec.js";import"./shared-7abbc95c.js";import"./shared-3f04e4cc.js";import"./shared-ff7fd5fa.js";import"./shared-ba93be6b.js";import"./shared-f9180815.js";import"./shared-2edcd981.js";import"./shared-343d1fd7.js";import"./shared-fd96bcd1.js";import"./shared-5cf7b194.js";import"./shared-d3bf9ac0.js";import"./shared-9b12aeac.js";import"./shared-35728235.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";import"./shared-9048eeb2.js";import"./shared-799dc083.js";import"./shared-621b3283.js";import"./shared-4e709717.js";import"./foxy-spinner.js";import"./shared-5784c088.js";import"./shared-b446c140.js";let s,a=t=>t;const i=e(r(t,"client-form"));class c extends i{constructor(){super(...arguments),this.templates={}}get readonlySelector(){const t=["client-secret"];return(this.data||this.in({busy:"fetching"}))&&t.push("client-id"),new o(`${t.join(" ")} ${super.readonlySelector.toString()}`)}get hiddenSelector(){const t=[];return this.data||this.in({busy:"fetching"})||t.push("client-secret"),new o(`${t.join(" ")} ${super.hiddenSelector.toString()}`)}renderBody(){return n(s||(s=a` <div class="grid grid-cols-2 gap-m"> <foxy-internal-text-control class="col-span-2" infer="client-id"> </foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="client-secret"> </foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="redirect-uri"> </foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="project-name"> </foxy-internal-text-control> <foxy-internal-text-area-control class="col-span-2" infer="project-description"> </foxy-internal-text-area-control> <foxy-internal-text-control infer="company-name"></foxy-internal-text-control> <foxy-internal-text-control infer="company-url"></foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="company-logo"> </foxy-internal-text-control> <foxy-internal-text-control class="col-span-2" infer="contact-name"> </foxy-internal-text-control> <foxy-internal-text-control infer="contact-email"></foxy-internal-text-control> <foxy-internal-text-control infer="contact-phone"></foxy-internal-text-control> </div> ${0} `),super.renderBody())}}customElements.define("foxy-client-form",c);export{c as ClientForm};
@@ -1 +1 @@
1
- import"./shared-799dc083.js";import"./shared-f9180815.js";import"./foxy-spinner.js";import"./shared-2edcd981.js";import"./shared-7abbc95c.js";import"./shared-9048eeb2.js";import{h as e}from"./shared-7f33a83a.js";import{C as t}from"./shared-5cf7b194.js";import{N as s}from"./shared-9b12aeac.js";import"./shared-5784c088.js";import"./shared-eb8a0fdf.js";import"./shared-099c1f57.js";import{T as r,S as i,a}from"./shared-3b709ddc.js";import{c as d}from"./shared-4e709717.js";import"./shared-601f27b1.js";import"./shared-621b3283.js";import"./shared-f21e5761.js";import"./shared-13fbea95.js";import"./shared-3c2414d4.js";import"./shared-bee111d6.js";import"./shared-ef7f2d07.js";import"./shared-3f04e4cc.js";import{P as o}from"./shared-7fab31ac.js";import{i as n}from"./shared-d3bf9ac0.js";import"./shared-4c2e9064.js";import"./shared-b446c140.js";import"./shared-e5239bec.js";import"./shared-fd96bcd1.js";import"./shared-343d1fd7.js";import"./shared-35728235.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";import"./shared-6daeb197.js";import"./shared-11c2efc8.js";import"./shared-f5bbb1e0.js";import"./shared-fff03a45.js";let l,h,m,c,p,f=e=>e;const u=t(r(i(a(s,"coupon-code-form"))));class b extends u{constructor(){super(...arguments),this.templates={}}static get scopedElements(){return{"vaadin-text-field":customElements.get("vaadin-text-field"),"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}}static get v8n(){return[({code:e})=>!!e||"code_required",({code:e})=>!e||e.length<=50||"code_too_long",({code:e})=>!(null==e?void 0:e.includes(" "))||"code_has_spaces"]}render(){var t,s;return e(l||(l=f` <div class="relative 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> `),this.__isCodeHidden?null:this.__renderCode(),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("idle")}),this.in("fail")?"error":this.in("busy")?"busy":"empty",this.lang,this.ns,null!==(s=null===(t=customElements.get("foxy-spinner"))||void 0===t?void 0:t.defaultNS)&&void 0!==s?s:"")}get __isCodeHidden(){return this.hiddenSelector.matches("code",!0)}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)))}__renderCode(){return e(h||(h=f` <div> ${0} <vaadin-text-field data-testid="code" 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("code:before"),this.t("code"),n(this.form.code),this.__getValidator("code"),this.__getErrorMessage("code"),!this.in("idle")||this.disabledSelector.matches("code",!0),this.readonlySelector.matches("code",!0),(e=>"Enter"===e.key&&this.submit()),(e=>{const t=e.currentTarget.value;this.edit({code:t})}),this.renderTemplateOrSlot("code:after"))}__renderTimestamps(){return e(m||(m=f` <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 t=this.in({idle:{template:{clean:"invalid"}}}),s=this.in({idle:{template:{dirty:"invalid"}}}),r=this.in({idle:{snapshot:{clean:"invalid"}}}),i=this.in({idle:{snapshot:{dirty:"invalid"}}}),a=t||s||(r||i),d=this.in("idle");return e(c||(c=f` <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"),!d||a||this.disabledSelector.matches("create",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}__renderDelete(){return e(p||(p=f` <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="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("idle")||this.disabledSelector.matches("delete",!0),(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),this.ns,this.lang,this.renderTemplateOrSlot("delete:after"))}}customElements.define("foxy-coupon-code-form",b);export{b as CouponCodeForm};
1
+ import"./shared-799dc083.js";import"./shared-f9180815.js";import"./foxy-spinner.js";import"./shared-2edcd981.js";import"./shared-7abbc95c.js";import"./shared-9048eeb2.js";import{h as e}from"./shared-7f33a83a.js";import{C as t}from"./shared-5cf7b194.js";import{N as s}from"./shared-9b12aeac.js";import"./shared-5784c088.js";import"./shared-eb8a0fdf.js";import"./shared-099c1f57.js";import{T as i,S as r,a}from"./shared-3b709ddc.js";import{c as d}from"./shared-4e709717.js";import"./shared-601f27b1.js";import"./shared-621b3283.js";import"./shared-f21e5761.js";import"./shared-13fbea95.js";import"./shared-3c2414d4.js";import"./shared-bee111d6.js";import"./shared-ef7f2d07.js";import"./shared-3f04e4cc.js";import{M as n}from"./shared-4205699e.js";import{i as o}from"./shared-d3bf9ac0.js";import"./shared-4c2e9064.js";import"./shared-b446c140.js";import"./shared-e5239bec.js";import"./shared-fd96bcd1.js";import"./shared-343d1fd7.js";import"./shared-35728235.js";import"./shared-3ab0306f.js";import"./shared-e8a51c60.js";import"./shared-6daeb197.js";import"./shared-11c2efc8.js";import"./shared-f5bbb1e0.js";import"./shared-fff03a45.js";let l,m,h,c,p,f=e=>e;const u=t(i(r(a(s,"coupon-code-form"))));class _ extends u{constructor(){super(...arguments),this.templates={}}static get scopedElements(){return{"vaadin-text-field":customElements.get("vaadin-text-field"),"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-metadata":n}}static get v8n(){return[({code:e})=>!!e||"code_required",({code:e})=>!e||e.length<=50||"code_too_long",({code:e})=>!(null==e?void 0:e.includes(" "))||"code_has_spaces"]}render(){var t,s;return e(l||(l=f` <div class="relative 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> `),this.__isCodeHidden?null:this.__renderCode(),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("idle")}),this.in("fail")?"error":this.in("busy")?"busy":"empty",this.lang,this.ns,null!==(s=null===(t=customElements.get("foxy-spinner"))||void 0===t?void 0:t.defaultNS)&&void 0!==s?s:"")}get __isCodeHidden(){return this.hiddenSelector.matches("code",!0)}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)))}__renderCode(){return e(m||(m=f` <div> ${0} <vaadin-text-field data-testid="code" 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("code:before"),this.t("code"),o(this.form.code),this.__getValidator("code"),this.__getErrorMessage("code"),!this.in("idle")||this.disabledSelector.matches("code",!0),this.readonlySelector.matches("code",!0),(e=>"Enter"===e.key&&this.submit()),(e=>{const t=e.currentTarget.value;this.edit({code:t})}),this.renderTemplateOrSlot("code:after"))}__renderTimestamps(){return e(h||(h=f` <div> ${0} <x-metadata data-testid="timestamps" .items="${0}"> </x-metadata> ${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 t=this.in({idle:{template:{clean:"invalid"}}}),s=this.in({idle:{template:{dirty:"invalid"}}}),i=this.in({idle:{snapshot:{clean:"invalid"}}}),r=this.in({idle:{snapshot:{dirty:"invalid"}}}),a=t||s||(i||r),d=this.in("idle");return e(c||(c=f` <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"),!d||a||this.disabledSelector.matches("create",!0),(()=>this.submit()),this.ns,this.lang,this.renderTemplateOrSlot("create:after"))}__renderDelete(){return e(p||(p=f` <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="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("idle")||this.disabledSelector.matches("delete",!0),(e=>{this.renderRoot.querySelector("#confirm").show(e.currentTarget)}),this.ns,this.lang,this.renderTemplateOrSlot("delete:after"))}}customElements.define("foxy-coupon-code-form",_);export{_ as CouponCodeForm};