@foxy.io/elements 1.15.0-beta.3 → 1.15.0-beta.4

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 (149) hide show
  1. package/dist/cdn/foxy-access-recovery-form.js +1 -1
  2. package/dist/cdn/foxy-address-card.js +1 -1
  3. package/dist/cdn/foxy-address-form.js +1 -1
  4. package/dist/cdn/foxy-applied-tax-card.js +1 -1
  5. package/dist/cdn/foxy-attribute-card.js +1 -1
  6. package/dist/cdn/foxy-attribute-form.js +1 -1
  7. package/dist/cdn/foxy-cancellation-form.js +1 -1
  8. package/dist/cdn/foxy-collection-page.js +1 -1
  9. package/dist/cdn/foxy-collection-pages.js +1 -1
  10. package/dist/cdn/foxy-coupon-card.js +1 -1
  11. package/dist/cdn/foxy-coupon-code-form.js +1 -1
  12. package/dist/cdn/foxy-coupon-codes-form.js +1 -1
  13. package/dist/cdn/foxy-coupon-form.js +1 -1
  14. package/dist/cdn/foxy-custom-field-card.js +1 -1
  15. package/dist/cdn/foxy-custom-field-form.js +1 -1
  16. package/dist/cdn/foxy-customer-card.js +1 -1
  17. package/dist/cdn/foxy-customer-form.js +1 -1
  18. package/dist/cdn/foxy-customer-portal-settings.js +1 -169
  19. package/dist/cdn/foxy-customer-portal.js +2 -2
  20. package/dist/cdn/foxy-customer.js +1 -1
  21. package/dist/cdn/foxy-customers-table.js +1 -1
  22. package/dist/cdn/foxy-discount-card.js +1 -1
  23. package/dist/cdn/foxy-donation.js +1 -1
  24. package/dist/cdn/foxy-email-template-form.js +1 -1
  25. package/dist/cdn/foxy-error-entry-card.js +1 -1
  26. package/dist/cdn/foxy-form-dialog.js +1 -1
  27. package/dist/cdn/foxy-generate-codes-form.js +1 -1
  28. package/dist/cdn/foxy-gift-card-card.js +1 -0
  29. package/dist/cdn/foxy-gift-card-code-form.js +1 -0
  30. package/dist/cdn/foxy-gift-card-codes-form.js +1 -0
  31. package/dist/cdn/foxy-gift-card-form.js +1 -0
  32. package/dist/cdn/foxy-i18n.js +1 -1
  33. package/dist/cdn/foxy-items-form.js +1 -1
  34. package/dist/cdn/foxy-pagination.js +1 -1
  35. package/dist/cdn/foxy-payment-card.js +1 -1
  36. package/dist/cdn/foxy-payment-method-card.js +1 -1
  37. package/dist/cdn/foxy-query-builder.js +1 -1
  38. package/dist/cdn/foxy-sign-in-form.js +1 -1
  39. package/dist/cdn/foxy-spinner.js +1 -1
  40. package/dist/cdn/foxy-subscription-card.js +1 -1
  41. package/dist/cdn/foxy-subscription-form.js +3 -3
  42. package/dist/cdn/foxy-subscriptions-table.js +1 -1
  43. package/dist/cdn/foxy-table.js +1 -1
  44. package/dist/cdn/foxy-tax-card.js +1 -1
  45. package/dist/cdn/foxy-tax-form.js +1 -1
  46. package/dist/cdn/foxy-template-config-form.js +1 -1
  47. package/dist/cdn/foxy-template-form.js +1 -1
  48. package/dist/cdn/foxy-transaction-card.js +1 -1
  49. package/dist/cdn/foxy-transactions-table.js +1 -1
  50. package/dist/cdn/foxy-user-form.js +1 -1
  51. package/dist/cdn/foxy-users-table.js +1 -1
  52. package/dist/cdn/{shared-b2330475.js → shared-00db6da0.js} +1 -1
  53. package/dist/cdn/{shared-9af7b5f0.js → shared-02945b27.js} +1 -1
  54. package/dist/cdn/{shared-b03b6d72.js → shared-07049bfe.js} +1 -1
  55. package/dist/cdn/{shared-ccea5a33.js → shared-08c63028.js} +1 -1
  56. package/dist/cdn/shared-0e4d19e2.js +1 -0
  57. package/dist/cdn/{shared-a4e6ecb0.js → shared-1497778c.js} +1 -1
  58. package/dist/cdn/{shared-f875a4f8.js → shared-1f307a03.js} +1 -1
  59. package/dist/cdn/{shared-4038cb18.js → shared-203923ef.js} +1 -1
  60. package/dist/cdn/shared-301a57fe.js +1 -0
  61. package/dist/cdn/{shared-a11160e7.js → shared-347cb5d5.js} +1 -1
  62. package/dist/cdn/{shared-0bda8ecb.js → shared-3b8cfbb1.js} +1 -1
  63. package/dist/cdn/{shared-51b5e223.js → shared-40b5267a.js} +1 -1
  64. package/dist/cdn/{shared-ff149b55.js → shared-47223541.js} +1 -1
  65. package/dist/cdn/{shared-8f7a66c4.js → shared-4dc6d228.js} +1 -1
  66. package/dist/cdn/{shared-a8d96c23.js → shared-680cb883.js} +1 -1
  67. package/dist/cdn/{shared-c6a4b2d6.js → shared-80ce089c.js} +1 -1
  68. package/dist/cdn/shared-8a5ec3cf.js +1 -0
  69. package/dist/cdn/shared-d4d7391d.js +302 -0
  70. package/dist/cdn/{shared-0fcdd1c4.js → shared-e563e7b0.js} +1 -1
  71. package/dist/cdn/{shared-cd3c902e.js → shared-e68b9c83.js} +1 -1
  72. package/dist/cdn/{shared-d9a260f0.js → shared-f7805cfe.js} +1 -1
  73. package/dist/cdn/translations/shared/en.json +178 -0
  74. package/dist/elements/private/FrequencyInput/FrequencyInput.d.ts +2 -1
  75. package/dist/elements/private/FrequencyInput/FrequencyInput.js +3 -1
  76. package/dist/elements/private/FrequencyInput/FrequencyInput.js.map +1 -1
  77. package/dist/elements/public/CollectionPage/CollectionPage.js +3 -1
  78. package/dist/elements/public/CollectionPage/CollectionPage.js.map +1 -1
  79. package/dist/elements/public/CollectionPage/types.d.ts +2 -0
  80. package/dist/elements/public/CollectionPage/types.js.map +1 -1
  81. package/dist/elements/public/CouponCard/CouponCard.js +2 -2
  82. package/dist/elements/public/CouponCard/CouponCard.js.map +1 -1
  83. package/dist/elements/public/GiftCardCard/GiftCardCard.d.ts +26 -0
  84. package/dist/elements/public/GiftCardCard/GiftCardCard.js +118 -0
  85. package/dist/elements/public/GiftCardCard/GiftCardCard.js.map +1 -0
  86. package/dist/elements/public/GiftCardCard/index.d.ts +5 -0
  87. package/dist/elements/public/GiftCardCard/index.js +7 -0
  88. package/dist/elements/public/GiftCardCard/index.js.map +1 -0
  89. package/dist/elements/public/GiftCardCard/types.d.ts +36 -0
  90. package/dist/elements/public/GiftCardCard/types.js +2 -0
  91. package/dist/elements/public/GiftCardCard/types.js.map +1 -0
  92. package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.d.ts +55 -0
  93. package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js +292 -0
  94. package/dist/elements/public/GiftCardCodeForm/GiftCardCodeForm.js.map +1 -0
  95. package/dist/elements/public/GiftCardCodeForm/index.d.ts +10 -0
  96. package/dist/elements/public/GiftCardCodeForm/index.js +12 -0
  97. package/dist/elements/public/GiftCardCodeForm/index.js.map +1 -0
  98. package/dist/elements/public/GiftCardCodeForm/types.d.ts +40 -0
  99. package/dist/elements/public/GiftCardCodeForm/types.js +2 -0
  100. package/dist/elements/public/GiftCardCodeForm/types.js.map +1 -0
  101. package/dist/elements/public/GiftCardCodesForm/GiftCardCodesForm.d.ts +29 -0
  102. package/dist/elements/public/GiftCardCodesForm/GiftCardCodesForm.js +209 -0
  103. package/dist/elements/public/GiftCardCodesForm/GiftCardCodesForm.js.map +1 -0
  104. package/dist/elements/public/GiftCardCodesForm/index.d.ts +8 -0
  105. package/dist/elements/public/GiftCardCodesForm/index.js +12 -0
  106. package/dist/elements/public/GiftCardCodesForm/index.js.map +1 -0
  107. package/dist/elements/public/GiftCardCodesForm/internal/InternalGiftCardCodesFormListItem.d.ts +19 -0
  108. package/dist/elements/public/GiftCardCodesForm/internal/InternalGiftCardCodesFormListItem.js +48 -0
  109. package/dist/elements/public/GiftCardCodesForm/internal/InternalGiftCardCodesFormListItem.js.map +1 -0
  110. package/dist/elements/public/GiftCardCodesForm/types.d.ts +16 -0
  111. package/dist/elements/public/GiftCardCodesForm/types.js +2 -0
  112. package/dist/elements/public/GiftCardCodesForm/types.js.map +1 -0
  113. package/dist/elements/public/GiftCardForm/GiftCardForm.d.ts +66 -0
  114. package/dist/elements/public/GiftCardForm/GiftCardForm.js +650 -0
  115. package/dist/elements/public/GiftCardForm/GiftCardForm.js.map +1 -0
  116. package/dist/elements/public/GiftCardForm/currencies.d.ts +1 -0
  117. package/dist/elements/public/GiftCardForm/currencies.js +173 -0
  118. package/dist/elements/public/GiftCardForm/currencies.js.map +1 -0
  119. package/dist/elements/public/GiftCardForm/index.d.ts +18 -0
  120. package/dist/elements/public/GiftCardForm/index.js +20 -0
  121. package/dist/elements/public/GiftCardForm/index.js.map +1 -0
  122. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.d.ts +19 -0
  123. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.js +98 -0
  124. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPage.js.map +1 -0
  125. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.d.ts +33 -0
  126. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.js +52 -0
  127. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItem.js.map +1 -0
  128. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.d.ts +26 -0
  129. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.js +53 -0
  130. package/dist/elements/public/GiftCardForm/private/CategoryRestrictionsPageItemContent.js.map +1 -0
  131. package/dist/elements/public/GiftCardForm/types.d.ts +52 -0
  132. package/dist/elements/public/GiftCardForm/types.js +2 -0
  133. package/dist/elements/public/GiftCardForm/types.js.map +1 -0
  134. package/dist/elements/public/index.d.ts +4 -0
  135. package/dist/elements/public/index.defined.d.ts +4 -0
  136. package/dist/elements/public/index.defined.js +4 -0
  137. package/dist/elements/public/index.defined.js.map +1 -1
  138. package/dist/elements/public/index.js +4 -0
  139. package/dist/elements/public/index.js.map +1 -1
  140. package/dist/mixins/themeable.js +12 -0
  141. package/dist/mixins/themeable.js.map +1 -1
  142. package/dist/utils/parse-duration.d.ts +1 -1
  143. package/dist/utils/parse-duration.js +7 -3
  144. package/dist/utils/parse-duration.js.map +1 -1
  145. package/package.json +1 -1
  146. package/dist/cdn/shared-6b7602c7.js +0 -1
  147. package/dist/cdn/shared-710ed658.js +0 -134
  148. package/dist/cdn/shared-800a5471.js +0 -1
  149. package/dist/cdn/shared-87ca7818.js +0 -1
@@ -1 +1 @@
1
- import{L as t,_ as e,j as i,h as s}from"./shared-63eaded9.js";import"./shared-0ced76a0.js";import{p as r}from"./shared-87ca7818.js";import"./shared-46ee137f.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import{b as a,S as n,c as o}from"./shared-cd3c902e.js";import"./shared-710ed658.js";import"./shared-0fcdd1c4.js";import{I as l,D as c}from"./shared-a8d96c23.js";import{E as h}from"./shared-0bda8ecb.js";import"./shared-ec861f31.js";import"./shared-36629ded.js";import"./shared-bb824ab4.js";import"./foxy-i18n.js";import"./shared-60126eee.js";import{s as d}from"./shared-b0f0e8b5.js";class u extends CustomEvent{constructor(t){super("change",{detail:t})}}class m extends CustomEvent{constructor(t){super("submit",{detail:t,cancelable:!0})}}let _,p,g=t=>t;var y;!function(t){t[t.Excluded=0]="Excluded",t[t.BeforeEnter=1]="BeforeEnter",t[t.Default=2]="Default",t[t.Previous=3]="Previous",t[t.BeforeExit=4]="BeforeExit"}(y||(y={}));class f extends t{constructor(){super(...arguments),this.quantity=0,this.image=""}static get properties(){return e(e({},super.properties),{},{quantity:{attribute:!1},image:{attribute:!1}})}static get styles(){return[a.styles,i(_||(_=g`.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.blur-1{filter:blur(1px)}.blur-2{filter:blur(2px)}.grayscale{filter:grayscale()}.rotate-12{--tw-rotate:12deg}.-rotate-12{--tw-rotate:-12deg}.-rotate-24{--tw-rotate:-24deg}.translate-y-half{--tw-translate-y:50%}`))]}set empty(t){this.updateComplete.then((()=>{if(t){const[,...t]=this.__stack;t.forEach((t=>t.remove()))}else this.quantity>1&&this.__stack.length<2&&this.__insertImage(y.Previous,this.__stack[0])}))}set data({quantity:t,image:e}){this.quantity=t,this.image=e}render(){return s(p||(p=g`<div id="image" class="w-full h-full relative"></div>`))}firstUpdated(){const t=this.__insertImage(y.Default);this.quantity>1&&this.__insertImage(y.Previous,t)}updated(t){if(t.has("quantity")){const e=t.get("quantity");void 0!==e&&(this.quantity>e?this.__add():this.__remove())}t.has("image")&&this.__stack.forEach((t=>t.src=this.image))}get __container(){return this.shadowRoot.getElementById("image")}get __stack(){var t,e;return[...null!==(e=null===(t=this.__container)||void 0===t?void 0:t.querySelectorAll(":not(.opacity-0)"))&&void 0!==e?e:[]].reverse()}__add(){const[t,e]=this.__stack;this.quantity>1?(t&&this.__setImageState(t,y.Previous),e&&(this.__setImageState(e,y.BeforeExit),e.ontransitionend=()=>e.remove()),this.__setImageState(this.__insertImage(y.BeforeEnter),y.Default)):t&&this.__setImageState(t,y.Default)}__remove(){const[t,e]=this.__stack;let i;if(this.quantity>0?(e&&this.__setImageState(e,y.Default),i=t):(t&&this.__setImageState(t,y.Excluded),i=e),i&&(this.__setImageState(i,y.BeforeEnter),i.ontransitionend=()=>i.remove()),this.quantity>1){const t=this.__insertImage(y.BeforeExit,this.__container.firstElementChild);this.__setImageState(t,y.Previous)}}__insertImage(t,e=null){const i=new Image;return i.src=this.image,i.setAttribute("part","picture"),i.addEventListener("error",(()=>i.src=f.placeholder)),this.__setImageState(i,t),this.__container.insertBefore(i,e),i}__setImageState(t,e){t.offsetHeight,t.className=["absolute inset-0 w-full h-full object-cover rounded transform transition duration-700 ease-out-back",["grayscale","shadow-m translate-y-half scale-110 rotate-12 opacity-0","shadow-m","blur-1 -rotate-12 opacity-25","blur-2 -rotate-24 opacity-0"][e]].join(" ")}}f.placeholder='data:image/svg+xml,%3Csvg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Crect width="40" height="40" fill="%23E8E8E8"/%3E%3Cpath d="M31.5143 0H24.5476L0 24.5476V31.5143L11.7046 19.8097L11.9841 17.0782C12.0983 15.9624 13.0131 15.1154 14.1038 15.1154H15.7373V12.1923C15.7373 10.9815 16.6915 10 17.8687 10H21.5143L31.5143 0Z" fill="white"/%3E%3Cpath d="M11.5434 21.3852L0 32.9285V39.8953L11.5822 28.3131C11.172 27.8663 10.9438 27.2444 11.012 26.5782L11.5434 21.3852Z" fill="white"/%3E%3Cpath d="M12.4305 28.879L1.30951 40H8.27631L19.2763 29H13.1316C12.8853 29 12.6495 28.9573 12.4305 28.879Z" fill="white"/%3E%3Cpath d="M28.3113 19.965L28.0159 17.0782C27.9116 16.0591 27.1395 15.2642 26.1754 15.1341L40 1.3095V8.27627L28.3113 19.965Z" fill="white"/%3E%3Cpath d="M20.6905 29L9.69049 40H16.6572L27.9755 28.6817C27.6541 28.8832 27.2756 29 26.8684 29H20.6905Z" fill="white"/%3E%3Cpath d="M28.6572 28C28.9128 27.5952 29.0415 27.1003 28.988 26.5782L28.4426 21.2479L40 9.69053V16.6572L28.6572 28Z" fill="white"/%3E%3Cpath d="M25.0381 40H18.0715L40 18.0715V25.0381L25.0381 40Z" fill="white"/%3E%3Cpath d="M26.4524 40H33.4191L40 33.4191V26.4524L26.4524 40Z" fill="white"/%3E%3Cpath d="M40 40H34.8333L40 34.8333V40Z" fill="white"/%3E%3Cpath d="M16.1666 0H23.1334L0 23.1334V16.1666L16.1666 0Z" fill="white"/%3E%3Cpath d="M14.7524 0H7.78571L0 7.78573V14.7524L14.7524 0Z" fill="white"/%3E%3Cpath d="M0 0H6.37152L0 6.37151V0Z" fill="white"/%3E%3Cpath d="M21.467 11.4615H17.8687C17.4763 11.4615 17.1582 11.7887 17.1582 12.1923V15.1154H22.8418V12.1923C22.8418 11.7887 22.5237 11.4615 22.1313 11.4615H21.467Z" fill="white"/%3E%3Cpath d="M24.7798 15.1154H24.2627V12.1923C24.2627 11.227 23.6562 10.4075 22.8138 10.1148L32.9286 0H39.89L24.7798 15.1154Z" fill="white"/%3E%3C/svg%3E';let v,b,w,x,q,I,E,$,C=t=>t;class S extends(n(t)){constructor(){super(...arguments),this.empty=!1,this.data=[]}static get properties(){return e(e({},super.properties),{},{empty:{attribute:!1},data:{attribute:!1}})}static get styles(){return[a.styles,i(v||(v=C`.w-preview{width:5.5rem}.h-preview{height:5.5rem}.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.grayscale{filter:grayscale()}.grid-2>:nth-child(1),.grid-3>:nth-child(1),.grid-4-plus>:nth-child(1),.grid-4>:nth-child(1){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(2){opacity:0;--tw-translate-x:100%;--tw-translate-y:var(--tw-translate-x)}.grid-2>:nth-child(2),.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){transform-origin:top right}.grid-1>:nth-child(3),.grid-2>:nth-child(3),.grid-3>:nth-child(3),.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(3),.grid-2>:nth-child(3){opacity:0;--tw-translate-y:100%}.grid-3>:nth-child(3){transform-origin:bottom right}.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){transform-origin:bottom left}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4),.grid-4-plus>:nth-child(4),.grid-4>:nth-child(4){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4){opacity:0;transform-origin:bottom left;--tw-translate-x:100%}.grid-1>:nth-child(4)>:first-child,.grid-2>:nth-child(4)>:first-child,.grid-3>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:first-child{transform:perspective(250px) rotateX(-90deg)}.grid-4-plus>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:last-child{transition-delay:.15s;transition-timing-function:ease-out}.grid-4-plus>:nth-child(4)>:last-child,.grid-4>:nth-child(4)>:first-child{transition-timing-function:ease-in}.grid-4-plus>:nth-child(4)>:last-child{transform:perspective(250px) rotateX(90deg)}.grid-1>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){opacity:0}.grid-1>:nth-child(5){--tw-translate-x:100%}.grid-2>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-translate-y:-100%}.grid-1>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){opacity:0}.grid-1>:nth-child(6){--tw-translate-y:100%}.grid-2>:nth-child(6),.grid-3>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-translate-x:-100%}`))]}render(){const t=this.data.length,e="rounded bg-contrast-10",i="transition-all duration-700 ease-out-back transform absolute inset-0",r=this.empty?"grayscale":"",a=t>4?"grid-4-plus":`grid-${Math.max(1,t)}`,n=d({exportparts:"picture",class:"w-full h-full",".empty":this.empty}),[o,l,c,h]=this.data;return s(b||(b=C` <div class="${0} w-preview h-preview relative font-lumo"> <div class="${0} ${0} origin-top-left"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> ${0} </div> <div class="${0} ${0} origin-top-right"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> <div class="${0} flex text-body transition duration-150 absolute inset-0"> ${0} </div> <div class="transition duration-150 absolute inset-0"> ${0} </div> </div> <div class="${0} ${0} origin-top-right"></div> <div class="${0} ${0} origin-bottom-left"></div> </div> `),a,i,r,o?s(w||(w=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,o):"",i,r,l?s(x||(x=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,l):"",i,r,c?s(q||(q=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,c):"",i,r,e,t>102?s(I||(I=C`<iron-icon icon="icons:more-horiz" class="m-auto w-xl h-xl"></iron-icon>`)):s(E||(E=C`<div class="m-auto text-xxxl">+${0}</div>`),t-3),h?s($||($=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,h):"",i,e,i,e)}}let D,k,L=t=>t;class A extends S{static get scopedElements(){return{"x-pic":f}}}class N extends S{static get scopedElements(){return{"x-pic":A}}}class P extends(n(t)){constructor(){super(...arguments),this.quantity=0,this.items=[]}static get scopedElements(){return{"x-picture":f,"x-bundle-grid":N}}static get properties(){return{quantity:{attribute:!1},image:{attribute:!1},items:{attribute:!1}}}static get styles(){return a.styles}render(){const{quantity:t,image:e=""}=this,i=0===t,r=d({class:"w-full h-full",exportparts:"picture"});if(0===this.items.length)return s(D||(D=L`<x-picture ...="${0}" .data="${0}"></x-picture>`),r,{quantity:t,image:e});{const e=new Array(Math.max(1,t)).fill(this.items);return s(k||(k=L`<x-bundle-grid ...="${0}" .empty="${0}" .data="${0}"></x-bundle-grid>`),r,i,e)}}}class j extends o{static get properties(){return e(e({},super.properties),{},{open:{type:Object},signatures:{type:Object,converter:t=>{const e=JSON.parse(t);for(const t of Object.keys(e))64!=e[t].length&&console.error("There is something wrong with the signature. It should have 64 characters.");return e}}})}signedName(t){return this.signatures&&this.signatures[t]?`${t}||${this.signatures[t]}${this.isOpen(t)?"||open":""}`:t}isOpen(t){return!(!this.open||!this.open[t])}}let F,T,O,V,M,H,B,Z=t=>t;class R extends j{constructor(){super("items-form"),this.rel="product_item",this.readonly=!1,this.quantity=0,this.total=this.__computeTotalPrice(),this.currency="",this.isItem=!0,this.isChildItem=!1,this.pid=R.__newId(),this.__modified=!1,this.__childPrices=[],this.__images=[],this.__childrenCount=0,this.__itemDescription="",this.__handleQuantity={handleEvent:t=>{const e=Number(t.target.value);this.quantity=e,this.__modified=!0,this.__images=[this.getImageDescription()].concat(this.__images.slice(1,this.__images.length))}},this.__childItemsObserver=new MutationObserver(this.__observeItems.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__setCode(),this.__acknowledgeChildItems(),this.__changedChildItem(),this.__isValid()||console.error("Invalid item",this.value)}))}static get styles(){return[super.styles,i(F||(F=Z`:host{--quantity-width:6.5rem;--preview-size:5.5rem;--threshold:20rem}.min-w-description::before{content:'';width:var(--threshold);display:block;overflow:hidden}.ml-description{--min-width:calc(var(--threshold) + var(--preview-size) + var(--lumo-space-l));--free-space:calc(100% - var(--min-width));--max-margin-left:calc(var(--preview-size) + var(--lumo-space-l));--final-margin-left:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-left));margin-left:var(--final-margin-left)}.mr-quantity{--min-width:var(--threshold);--free-space:calc(100% - var(--min-width));--max-margin-right:calc(var(--quantity-width) + var(--lumo-space-l));--final-margin-right:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-right));margin-right:var(--final-margin-right)}:host([data-bundled]:not(:last-of-type)) .separator::after{content:' ';display:block;position:absolute;width:100vw;border-bottom:solid thin var(--lumo-shade-10pct);left:0;bottom:0}.w-quantity{width:var(--quantity-width)}.w-preview{width:var(--preview-size)}.h-preview{height:var(--preview-size)}`))]}static get scopedElements(){return{"vaadin-integer-field":customElements.get("vaadin-integer-field"),"x-error-screen":h,"x-preview":P,"x-i18n":l}}static get properties(){return e(e({},super.properties),{},{__modified:{},readonly:{type:Boolean,reflect:!0},currency:{type:String},category:{type:String},code:{type:String,reflect:!0},expires:{type:String},height:{type:Number},image:{type:String},length:{type:Number},name:{type:String},parent_code:{type:String},price:{type:Number},quantity:{type:Number,reflect:!0},quantity_max:{type:Number},quantity_min:{type:String},shipto:{type:String},total:{type:Number,reflect:!0,attribute:"total"},url:{type:String},value:{type:Object},weight:{type:Number},width:{type:Number},__childPrices:{},__childrenCount:{},__images:{},alt:{type:String},isChildItem:{type:Boolean,reflect:!0,attribute:"data-bundled"},isItem:{type:Boolean,reflect:!0,attribute:"data-item"},open:{type:Object},pid:{type:Number,reflect:!0},items:{type:Array}})}get items(){const t=[];return this.__onEachChildItem([e=>t.push(e.value)]),t}set items(t){this.__createItems(t)}get value(){const t={};for(let e=0;e<this.attributes.length;e++)t[this.attributes[e].name]=this.attributes[e].value;return t.items=this.items,t}set value(t){this.__itemDescription="";for(const e in t){let i="";if("description"!=e){if("object"==typeof t[e])i=JSON.stringify(t[e]);else{const s=e;(t[s]&&"undefined"!==t[s]||0===t[s])&&(i=t[e].toString())}this.setAttribute(e,t[e]?i:"")}else this.__itemDescription=t[e]}}updated(t){t.forEach(((t,e)=>{"__itemDescription"!=e&&"isChildItem"!=e||this.__updateDescriptionEl()})),this.__setTotalPrice(),this.dispatchEvent(new Event("change"))}render(){var t;if(!this.__isValid())return s(T||(T=Z`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`));const e=`font-lumo text-body text-s leading-m transition duration-100 ${this.quantity?"":"removed opacity-50"}`;if(this.isChildItem)return s(O||(O=Z` <article part="item" class="py-s w-full relative separator item-summary flex justify-between ${0}"> <div class="description flex-1"> <h1 class="text-header font-medium">${0}</h1> <section class="description text-secondary"> <slot></slot> </section> </div> ${0} </article> `),e,this.name,this.quantity<2?"":s(V||(V=Z` <section class="quantity font-medium text-tertiary whitespace-nowrap"> ${0} </section> `),this._t("item.items",{quantity:this.quantity})));{const i=(null!==(t=this.price)&&void 0!==t?t:0)+this.__childPrices.reduce(((t,e)=>t+e),0),r=this.__translateAmount(i*this.quantity),a=this.__translateAmount(i);return s(M||(M=Z` <article part="item" class="p-l relative item ${0} ${0}"> <x-preview class="preview float-left w-preview h-preview mr-l mb-l" exportparts="picture" .image="${0}" .quantity="${0}" .items="${0}"> </x-preview> <section class="description min-w-description ml-description"> <h1 class="text-header font-medium text-l leading-none mr-quantity mb-s"> ${0} </h1> <div class="item-description text-secondary mr-quantity mb-s"> <slot></slot> </div> <div class="child-items mb-s"> <slot name="items"></slot> </div> ${0} </section> <section class="quantity w-quantity absolute top-0 right-0 m-l"> <vaadin-integer-field class="w-full p-0" name="quantity" @change="${0}" value="${0}" min="0" has-controls ?readonly="${0}"> </vaadin-integer-field> ${0} </section> </article> `),e,this.__modified?"modified":"",this.image,this.quantity,[...this.querySelectorAll("[data-bundled]")].map((t=>{var e;return{quantity:t.quantity,image:null!==(e=t.image)&&void 0!==e?e:""}})),this.name,a?s(H||(H=Z`<div class="font-medium price text-l">${0}</div>`),a):"",this.__handleQuantity,this.quantity,this.readonly,this.quantity>1?s(B||(B=Z` <x-i18n .ns="${0}" .lang="${0}" .opts="${0}" class="price-total text-secondary text-xs text-center block mt-xs" key="price.total"> </x-i18n> `),this.ns,this.lang,{amount:r}):"")}}getImageDescription(){return{src:this.image,alt:this.alt,quantity:this.quantity}}signedName(t){const e=super.signedName(t);return`${this.pid.toString()}:${e}`}static __newId(){const t=R.__existingIds.reduce(((t,e)=>e>t?e:t),0)+1;return R.__existingIds.push(t),t}__updateDescriptionEl(){if(this.__itemDescription){let t=this.shadowRoot.querySelector("data-item-description");t||(t=document.createElement("p"),t.dataset.itemDescription="true",this.__addSlottedEl(t)),t.innerText=this.__itemDescription}else{const t=this.shadowRoot.querySelector("data-item-description");t&&t.remove()}}__addSlottedEl(t){const e=this.shadowRoot.querySelector("article");e&&e.appendChild(t)}__setCode(){this.code||(this.code=`RAND${Math.random()}`)}__createItems(t){t.forEach((t=>{const e=document.createElement(this.tagName);e.value=t,e.currency=this.currency,e.__computeTotalPrice(),this.__acknowledgeItem(e),this.appendChild(e)}))}__setTotalPrice(){this.total=this.__computeTotalPrice()}__computeTotalPrice(){if(!this.__childPrices)return this.price?this.price*this.quantity:0;let t=0;return this.__childPrices.forEach((e=>{t+=e})),t+=this.price,t*=this.quantity,t}__isValid(){const t=[];return this.name&&this.name.length||t.push("The name attribute of an item is required."),this.price||0===this.price||t.push("The price attribute of an item is required."),this.price&&this.price<0&&t.push("Item added with negative price."),this.quantity_min&&this.quantity&&this.quantity<this.quantity_min&&t.push("Quantity amount is less than minimum quantity."),this.quantity_max&&this.quantity&&this.quantity>this.quantity_max&&t.push("Quantity amount is more than maximum quantity."),console.error(...t),!t.length}__translateAmount(t){return this.currency?t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"}):""}__observeItems(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.nodeType===Node.DOCUMENT_NODE&&this.__acknowledgeItem(t)}))})),this.__setTotalPrice()}__acknowledgeChildItems(){var t;null===(t=this.shadowRoot)||void 0===t||t.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t))),this.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t)))}__acknowledgeItem(t){t.addEventListener("change",this.__changedChildItem.bind(this)),t.currency=this.currency,t.isItem=!1,t.isChildItem=!0,this.code&&(t.parent_code=this.code)}__changedChildItem(){const t=[],e=[];let i=0;this.__onEachChildItem([e=>{void 0!==e.total&&t.push(e.total)},t=>{e.push(t.getImageDescription())},()=>i+=1]),this.image&&0===e.length&&e.push(this.getImageDescription()),this.__childPrices=t,this.__images=e,this.__childrenCount=i,this.__setTotalPrice()}__onEachChildItem(t){const e=this.querySelectorAll("[data-bundled]");for(const i of e)for(const e of t)e(i)}}R.__existingIds=[];let z,Q,W,J,U,X,G=t=>t;class K extends j{constructor(){super("items-form"),this.readonly=!1,this.target="_top",this.cart="checkout",this.sub_modify="replace",this.sub_restart="auto",this.frequencies=[],this.handleSubmit={handleEvent:()=>{null!==this.__data&&this.dispatchEvent(new m(this.__data))&&this.shadowRoot.querySelector("form").submit()}},this.__hasValidItems=!1,this.__total=0,this.__handleFrequency={handleEvent:t=>{const e=t.detail.replace(/([wydm])\w*/,"$1").replace(/ /g,"").replace(/^0/,"");K.__validFrequency(e)?this.sub_frequency=e:this.sub_frequency="",this.__updateData()}},this.__data=new FormData,this.__childItemsObserver=new MutationObserver(this.__observeChildren.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}))}static get scopedElements(){return{"x-error-screen":h,"vaadin-button":customElements.get("vaadin-button"),"x-dropdown":c,"x-item":R}}static get properties(){return e(e({},super.properties),{},{currency:{type:String},readonly:{type:Boolean},cart:{type:String,converter:t=>t&&!["checkout","add"].includes(t)?null:t},target:{type:String},store:{type:String,attribute:"store"},sub_frequency:{type:String},sub_startdate:{type:String,converter:t=>K.__validDate(t)?t:(console.error("Invalid start date",t),"")},sub_enddate:{type:String,converter:t=>K.__validDateFuture(t)?t:(console.error("Invalid end date",t),"")},sub_token:{type:String},sub_modify:{type:String,converter:t=>""===t||"append"===t?"":"replace"},sub_restart:{type:String,converter:t=>"true"===t?t:"auto"},frequencies:{converter:t=>{if(!t)return[];const e=JSON.parse(t);if(!Array.isArray(e))return console.error("Invalid frequency","Frequency options must be an array."),[];for(const t of e)if(!K.__validFrequency(t))return console.error("Invalid frequency","Invalid frequency option.\n Please, check https://wiki.foxycart.com/v/2.0/products#subscription_product_options for possible values.\n Each frequency must be a in the format:\n - 1d (a number followed by d, for day)\n - 1w (a number followed by w, for week)\n - 1m (a number followed by m, for month)\n - 1y (a number followed by y, for year)\n or .5m (no other decimals are allowed, and this is only for months)\n ",t),[];return e.filter(K.__validFrequency)}},items:{type:Array},__hasValidItems:{attribute:!1},__total:{attribute:!1},__data:{attribute:!1}})}get items(){const t=[];return this.__itemElements.forEach((e=>{const i=new Proxy(e,{set:function(t,e,i){const s=Object.keys(t.value);return!("string"!=typeof e||!s.includes(e))&&(t[e]=i,!0)},get:function(t,e){return t.value[e]}});t.push(i)})),t}set items(t){this.__removeItems(),this.__createItemsFromItemArray(t)}get total(){return this.__total}render(){var t;return this.store&&this.currency?s(Q||(Q=G` <div> <form class="overflow-hidden" method="POST" target="${0}" action="https://${0}/cart" data-testid="form" class="hidden" hidden> ${0} </form> <section class="items"> <slot></slot> </section> ${0} </div> `),this.target,this.store,this.__data?s(W||(W=G` ${0}`),[...this.__data.entries()].map((([t,e])=>s(J||(J=G`<input type="hidden" name="${0}" value="${0}">`),t,e)))):"",this.readonly?"":s(U||(U=G` <section class="actions flex flex-wrap justify-end m-m"> ${0} <vaadin-button class="m-s w-full sm-w-auto" theme="primary" data-testid="submit" ?disabled="${0}" @click="${0}"> <span class="total"> ${0} </span> </vaadin-button> </section> `),this.frequencies&&this.frequencies.length?s(X||(X=G` <x-dropdown type="text" name="frequency" class="subscription m-s w-full sm-w-auto" lang="${0}" .value="${0}" .items="${0}" .getText="${0}" @change="${0}"> </x-dropdown> `),this.lang,null!==(t=this.sub_frequency)&&void 0!==t?t:"0",this.frequencies.concat(["0"]),this.__translateFrequency.bind(this),this.__handleFrequency):"",!this.__hasValidItems,this.handleSubmit,this.__submitBtnText(this.__translateAmount(this.total)))):s(z||(z=G`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`))}addItems(t){for(const e of t){const t=this.createItem(e);this.appendChild(t),this.__acknowledgeItemElement(t)}}removeItems(t){this.__removeItems((e=>t.includes(e.pid)))}updated(){this.dispatchEvent(new u(this.__data))}createItem(t){const e=this.constructor.getScopedTagName("x-item"),i=document.createElement(e);return i.value=t,i.currency=this.currency,i.readonly=this.readonly,i}__submitBtnText(t){if(this.sub_frequency&&"0"!=this.sub_frequency){const e=r(this.sub_frequency);return 1===e.count?this._t("checkout.subscribe_single_unit",{value:t,period:this._t(e.units).toLowerCase()}):this._t("checkout.subscribe_muiltiple_units",{value:t,period:this.__translateFrequency(this.sub_frequency).toLowerCase()})}return this._t("checkout.buy",{value:t})}get __itemElements(){return this.querySelectorAll("[data-item]")}__createItemsFromItemArray(t){this.addItems(t)}__removeItems(t=(()=>!0)){this.__itemElements.forEach((e=>{t(e)&&e.remove()}))}__addSignature(t,e,i){return`${t}||${e}${i?"||open":""}`}__formDataFill(t){let e=0;return this.__itemElements.forEach((i=>{e+=this.__formDataAddItem(t,i)})),this.__formDataAddCartWideSubscriptionFields(t),e}__formDataCustomInputs(t){this.querySelectorAll("[name]").forEach((e=>{const i=e;"INPUT"==i.tagName&&["checkbox","radio"].includes(i.type)&&!i.checked||"OPTION"!=i.tagName&&i.value&&["number","string"].includes(typeof i.value)&&t.set(i.name,i.value)}))}__isAttributeReserved(t){return["alt","currency","description","isChildren","isItem","items","open","pid","signatures","slot","total"].includes(t)}__formDataAddItem(t,e,i=null){let s=0;if(this.__validItem(e)){if(!e.value.pid)throw new Error("Attempt to convert a item without a propper ID");i&&i.getAttribute("code")&&e.setAttribute("parent_code",i.getAttribute("code"));for(let s=0;s<e.attributes.length;s++){const r=e.attributes[s];if(!this.__isAttributeReserved(r.name)&&!r.name.startsWith("data-")){let s=e[r.name];e.code&&["string","number"].includes(typeof s)&&(i&&"quantity"==r.name&&(s=Number(r.value)*i.quantity),t.set(e.signedName(r.name),s.toString()))}}s+=1,this.__formDataAddSubscriptionFields(t,e)}const r=e.querySelectorAll("[data-bundled]");if(r&&e.quantity>0)for(const i of r)s+=this.__formDataAddItem(t,i,e);return s}__formDataAddSubscriptionFields(t,e){if(this.sub_frequency)for(const i of["sub_frequency","sub_startdate","sub_enddate"])this[i]&&t.set(e.signedName(i),this[i])}__formDataAddCartWideSubscriptionFields(t){this.sub_frequency&&(this.sub_token&&t.set(this.signedName("sub_token"),this.sub_token),t.set(this.signedName("sub_modify"),this.sub_modify),t.set(this.signedName("sub_restart"),this.sub_restart))}__formDataAddCartFields(t){this.cart?t.set("cart",this.cart):t.delete("cart")}static __validDate(t){return null!=t&&(t.match(/^(\d{1,2}|\d{8})$/)?!(t.match(/^\d{2}$/)&&Number(t)>31):!(t.match(/^\.5m/)||!K.__validFrequency(t)))}static __validDateFuture(t){let e=!1;if(K.__validDate(t))if(t.match(/^\d{8}/)){e=(new Date).toISOString().replace(/(-|T.*)/g,"")<=t}else e=!0;return e}static __validFrequency(t){return!!t&&!!t.match(/^(\.5m|\d+[dwmy])$/)}__observeChildren(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.addEventListener("change",this.__itemChange.bind(this))}))})),this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}__itemChange(){this.__computeTotalPrice(),this.__updateData()}__computeTotalPrice(){let t=0;this.__itemElements.forEach((e=>{const i=e;i.total&&(t+=Number(i.total))})),this.__total=Number(t.toFixed(2))}__acknowledgeItemElements(){this.__itemElements.forEach((t=>{const e=t;this.__acknowledgeItemElement(e)}))}__acknowledgeItemElement(t){t.addEventListener("change",this.__itemChange.bind(this)),t.currency=this.currency}__validItem(t){const e=t.getAttribute("pid"),i=Number(t.getAttribute("quantity")),s=Number(t.getAttribute("price"));return!!(e&&i>0&&s>=0)}__translateFrequency(t){if(t.startsWith("0"))return this._t("frequency_once");if(".5m"===t)return this._t("frequency_0_5m");const{count:e,units:i}=r(t);return this._t("frequency",{units:this._t(i,{count:e}),count:e})}__translateAmount(t){return t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"})}__updateData(){this.__data=null;if(!this.shadowRoot.querySelector("form"))return;const t=new FormData,e=this.__formDataFill(t);this.__hasValidItems=!!e,this.__formDataAddCartFields(t),this.__formDataCustomInputs(t),this.__data=t}}customElements.define("foxy-items-form",K),customElements.define("foxy-item",R);export{K as I,P,R as a};
1
+ import{L as t,_ as e,j as i,h as s}from"./shared-63eaded9.js";import"./shared-0ced76a0.js";import{p as r}from"./shared-0e4d19e2.js";import"./shared-46ee137f.js";import"./shared-df573cea.js";import"./shared-f0a83bd6.js";import{b as a,S as n,c as o}from"./shared-e68b9c83.js";import"./shared-d4d7391d.js";import"./shared-e563e7b0.js";import{I as l,D as c}from"./shared-680cb883.js";import{E as h}from"./shared-3b8cfbb1.js";import"./shared-36629ded.js";import"./shared-bb824ab4.js";import"./shared-ec861f31.js";import"./foxy-i18n.js";import"./shared-60126eee.js";import{s as d}from"./shared-b0f0e8b5.js";class u extends CustomEvent{constructor(t){super("change",{detail:t})}}class m extends CustomEvent{constructor(t){super("submit",{detail:t,cancelable:!0})}}let _,p,g=t=>t;var y;!function(t){t[t.Excluded=0]="Excluded",t[t.BeforeEnter=1]="BeforeEnter",t[t.Default=2]="Default",t[t.Previous=3]="Previous",t[t.BeforeExit=4]="BeforeExit"}(y||(y={}));class f extends t{constructor(){super(...arguments),this.quantity=0,this.image=""}static get properties(){return e(e({},super.properties),{},{quantity:{attribute:!1},image:{attribute:!1}})}static get styles(){return[a.styles,i(_||(_=g`.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.blur-1{filter:blur(1px)}.blur-2{filter:blur(2px)}.grayscale{filter:grayscale()}.rotate-12{--tw-rotate:12deg}.-rotate-12{--tw-rotate:-12deg}.-rotate-24{--tw-rotate:-24deg}.translate-y-half{--tw-translate-y:50%}`))]}set empty(t){this.updateComplete.then((()=>{if(t){const[,...t]=this.__stack;t.forEach((t=>t.remove()))}else this.quantity>1&&this.__stack.length<2&&this.__insertImage(y.Previous,this.__stack[0])}))}set data({quantity:t,image:e}){this.quantity=t,this.image=e}render(){return s(p||(p=g`<div id="image" class="w-full h-full relative"></div>`))}firstUpdated(){const t=this.__insertImage(y.Default);this.quantity>1&&this.__insertImage(y.Previous,t)}updated(t){if(t.has("quantity")){const e=t.get("quantity");void 0!==e&&(this.quantity>e?this.__add():this.__remove())}t.has("image")&&this.__stack.forEach((t=>t.src=this.image))}get __container(){return this.shadowRoot.getElementById("image")}get __stack(){var t,e;return[...null!==(e=null===(t=this.__container)||void 0===t?void 0:t.querySelectorAll(":not(.opacity-0)"))&&void 0!==e?e:[]].reverse()}__add(){const[t,e]=this.__stack;this.quantity>1?(t&&this.__setImageState(t,y.Previous),e&&(this.__setImageState(e,y.BeforeExit),e.ontransitionend=()=>e.remove()),this.__setImageState(this.__insertImage(y.BeforeEnter),y.Default)):t&&this.__setImageState(t,y.Default)}__remove(){const[t,e]=this.__stack;let i;if(this.quantity>0?(e&&this.__setImageState(e,y.Default),i=t):(t&&this.__setImageState(t,y.Excluded),i=e),i&&(this.__setImageState(i,y.BeforeEnter),i.ontransitionend=()=>i.remove()),this.quantity>1){const t=this.__insertImage(y.BeforeExit,this.__container.firstElementChild);this.__setImageState(t,y.Previous)}}__insertImage(t,e=null){const i=new Image;return i.src=this.image,i.setAttribute("part","picture"),i.addEventListener("error",(()=>i.src=f.placeholder)),this.__setImageState(i,t),this.__container.insertBefore(i,e),i}__setImageState(t,e){t.offsetHeight,t.className=["absolute inset-0 w-full h-full object-cover rounded transform transition duration-700 ease-out-back",["grayscale","shadow-m translate-y-half scale-110 rotate-12 opacity-0","shadow-m","blur-1 -rotate-12 opacity-25","blur-2 -rotate-24 opacity-0"][e]].join(" ")}}f.placeholder='data:image/svg+xml,%3Csvg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"%3E%3Crect width="40" height="40" fill="%23E8E8E8"/%3E%3Cpath d="M31.5143 0H24.5476L0 24.5476V31.5143L11.7046 19.8097L11.9841 17.0782C12.0983 15.9624 13.0131 15.1154 14.1038 15.1154H15.7373V12.1923C15.7373 10.9815 16.6915 10 17.8687 10H21.5143L31.5143 0Z" fill="white"/%3E%3Cpath d="M11.5434 21.3852L0 32.9285V39.8953L11.5822 28.3131C11.172 27.8663 10.9438 27.2444 11.012 26.5782L11.5434 21.3852Z" fill="white"/%3E%3Cpath d="M12.4305 28.879L1.30951 40H8.27631L19.2763 29H13.1316C12.8853 29 12.6495 28.9573 12.4305 28.879Z" fill="white"/%3E%3Cpath d="M28.3113 19.965L28.0159 17.0782C27.9116 16.0591 27.1395 15.2642 26.1754 15.1341L40 1.3095V8.27627L28.3113 19.965Z" fill="white"/%3E%3Cpath d="M20.6905 29L9.69049 40H16.6572L27.9755 28.6817C27.6541 28.8832 27.2756 29 26.8684 29H20.6905Z" fill="white"/%3E%3Cpath d="M28.6572 28C28.9128 27.5952 29.0415 27.1003 28.988 26.5782L28.4426 21.2479L40 9.69053V16.6572L28.6572 28Z" fill="white"/%3E%3Cpath d="M25.0381 40H18.0715L40 18.0715V25.0381L25.0381 40Z" fill="white"/%3E%3Cpath d="M26.4524 40H33.4191L40 33.4191V26.4524L26.4524 40Z" fill="white"/%3E%3Cpath d="M40 40H34.8333L40 34.8333V40Z" fill="white"/%3E%3Cpath d="M16.1666 0H23.1334L0 23.1334V16.1666L16.1666 0Z" fill="white"/%3E%3Cpath d="M14.7524 0H7.78571L0 7.78573V14.7524L14.7524 0Z" fill="white"/%3E%3Cpath d="M0 0H6.37152L0 6.37151V0Z" fill="white"/%3E%3Cpath d="M21.467 11.4615H17.8687C17.4763 11.4615 17.1582 11.7887 17.1582 12.1923V15.1154H22.8418V12.1923C22.8418 11.7887 22.5237 11.4615 22.1313 11.4615H21.467Z" fill="white"/%3E%3Cpath d="M24.7798 15.1154H24.2627V12.1923C24.2627 11.227 23.6562 10.4075 22.8138 10.1148L32.9286 0H39.89L24.7798 15.1154Z" fill="white"/%3E%3C/svg%3E';let v,b,w,x,q,I,E,$,C=t=>t;class S extends(n(t)){constructor(){super(...arguments),this.empty=!1,this.data=[]}static get properties(){return e(e({},super.properties),{},{empty:{attribute:!1},data:{attribute:!1}})}static get styles(){return[a.styles,i(v||(v=C`.w-preview{width:5.5rem}.h-preview{height:5.5rem}.ease-out-back{transition-timing-function:cubic-bezier(.34,1.56,.64,1)}.grayscale{filter:grayscale()}.grid-2>:nth-child(1),.grid-3>:nth-child(1),.grid-4-plus>:nth-child(1),.grid-4>:nth-child(1){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(2){opacity:0;--tw-translate-x:100%;--tw-translate-y:var(--tw-translate-x)}.grid-2>:nth-child(2),.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(2),.grid-4-plus>:nth-child(2),.grid-4>:nth-child(2){transform-origin:top right}.grid-1>:nth-child(3),.grid-2>:nth-child(3),.grid-3>:nth-child(3),.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(3),.grid-2>:nth-child(3){opacity:0;--tw-translate-y:100%}.grid-3>:nth-child(3){transform-origin:bottom right}.grid-4-plus>:nth-child(3),.grid-4>:nth-child(3){transform-origin:bottom left}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4),.grid-4-plus>:nth-child(4),.grid-4>:nth-child(4){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-1>:nth-child(4),.grid-2>:nth-child(4),.grid-3>:nth-child(4){opacity:0;transform-origin:bottom left;--tw-translate-x:100%}.grid-1>:nth-child(4)>:first-child,.grid-2>:nth-child(4)>:first-child,.grid-3>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:first-child{transform:perspective(250px) rotateX(-90deg)}.grid-4-plus>:nth-child(4)>:first-child,.grid-4>:nth-child(4)>:last-child{transition-delay:.15s;transition-timing-function:ease-out}.grid-4-plus>:nth-child(4)>:last-child,.grid-4>:nth-child(4)>:first-child{transition-timing-function:ease-in}.grid-4-plus>:nth-child(4)>:last-child{transform:perspective(250px) rotateX(90deg)}.grid-1>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){opacity:0}.grid-1>:nth-child(5){--tw-translate-x:100%}.grid-2>:nth-child(5),.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-3>:nth-child(5),.grid-4-plus>:nth-child(5),.grid-4>:nth-child(5){--tw-translate-y:-100%}.grid-1>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){opacity:0}.grid-1>:nth-child(6){--tw-translate-y:100%}.grid-2>:nth-child(6),.grid-3>:nth-child(6),.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-scale-x:calc(2.5 / 5.5);--tw-scale-y:var(--tw-scale-x)}.grid-4-plus>:nth-child(6),.grid-4>:nth-child(6){--tw-translate-x:-100%}`))]}render(){const t=this.data.length,e="rounded bg-contrast-10",i="transition-all duration-700 ease-out-back transform absolute inset-0",r=this.empty?"grayscale":"",a=t>4?"grid-4-plus":`grid-${Math.max(1,t)}`,n=d({exportparts:"picture",class:"w-full h-full",".empty":this.empty}),[o,l,c,h]=this.data;return s(b||(b=C` <div class="${0} w-preview h-preview relative font-lumo"> <div class="${0} ${0} origin-top-left"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> ${0} </div> <div class="${0} ${0} origin-top-right"> ${0} </div> <div class="${0} ${0} origin-bottom-right"> <div class="${0} flex text-body transition duration-150 absolute inset-0"> ${0} </div> <div class="transition duration-150 absolute inset-0"> ${0} </div> </div> <div class="${0} ${0} origin-top-right"></div> <div class="${0} ${0} origin-bottom-left"></div> </div> `),a,i,r,o?s(w||(w=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,o):"",i,r,l?s(x||(x=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,l):"",i,r,c?s(q||(q=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,c):"",i,r,e,t>102?s(I||(I=C`<iron-icon icon="icons:more-horiz" class="m-auto w-xl h-xl"></iron-icon>`)):s(E||(E=C`<div class="m-auto text-xxxl">+${0}</div>`),t-3),h?s($||($=C`<x-pic ...="${0}" .data="${0}"></x-pic>`),n,h):"",i,e,i,e)}}let D,k,L=t=>t;class A extends S{static get scopedElements(){return{"x-pic":f}}}class N extends S{static get scopedElements(){return{"x-pic":A}}}class P extends(n(t)){constructor(){super(...arguments),this.quantity=0,this.items=[]}static get scopedElements(){return{"x-picture":f,"x-bundle-grid":N}}static get properties(){return{quantity:{attribute:!1},image:{attribute:!1},items:{attribute:!1}}}static get styles(){return a.styles}render(){const{quantity:t,image:e=""}=this,i=0===t,r=d({class:"w-full h-full",exportparts:"picture"});if(0===this.items.length)return s(D||(D=L`<x-picture ...="${0}" .data="${0}"></x-picture>`),r,{quantity:t,image:e});{const e=new Array(Math.max(1,t)).fill(this.items);return s(k||(k=L`<x-bundle-grid ...="${0}" .empty="${0}" .data="${0}"></x-bundle-grid>`),r,i,e)}}}class j extends o{static get properties(){return e(e({},super.properties),{},{open:{type:Object},signatures:{type:Object,converter:t=>{const e=JSON.parse(t);for(const t of Object.keys(e))64!=e[t].length&&console.error("There is something wrong with the signature. It should have 64 characters.");return e}}})}signedName(t){return this.signatures&&this.signatures[t]?`${t}||${this.signatures[t]}${this.isOpen(t)?"||open":""}`:t}isOpen(t){return!(!this.open||!this.open[t])}}let F,T,O,V,M,H,B,Z=t=>t;class R extends j{constructor(){super("items-form"),this.rel="product_item",this.readonly=!1,this.quantity=0,this.total=this.__computeTotalPrice(),this.currency="",this.isItem=!0,this.isChildItem=!1,this.pid=R.__newId(),this.__modified=!1,this.__childPrices=[],this.__images=[],this.__childrenCount=0,this.__itemDescription="",this.__handleQuantity={handleEvent:t=>{const e=Number(t.target.value);this.quantity=e,this.__modified=!0,this.__images=[this.getImageDescription()].concat(this.__images.slice(1,this.__images.length))}},this.__childItemsObserver=new MutationObserver(this.__observeItems.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__setCode(),this.__acknowledgeChildItems(),this.__changedChildItem(),this.__isValid()||console.error("Invalid item",this.value)}))}static get styles(){return[super.styles,i(F||(F=Z`:host{--quantity-width:6.5rem;--preview-size:5.5rem;--threshold:20rem}.min-w-description::before{content:'';width:var(--threshold);display:block;overflow:hidden}.ml-description{--min-width:calc(var(--threshold) + var(--preview-size) + var(--lumo-space-l));--free-space:calc(100% - var(--min-width));--max-margin-left:calc(var(--preview-size) + var(--lumo-space-l));--final-margin-left:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-left));margin-left:var(--final-margin-left)}.mr-quantity{--min-width:var(--threshold);--free-space:calc(100% - var(--min-width));--max-margin-right:calc(var(--quantity-width) + var(--lumo-space-l));--final-margin-right:clamp(0rem, var(--free-space) * 999999999, var(--max-margin-right));margin-right:var(--final-margin-right)}:host([data-bundled]:not(:last-of-type)) .separator::after{content:' ';display:block;position:absolute;width:100vw;border-bottom:solid thin var(--lumo-shade-10pct);left:0;bottom:0}.w-quantity{width:var(--quantity-width)}.w-preview{width:var(--preview-size)}.h-preview{height:var(--preview-size)}`))]}static get scopedElements(){return{"vaadin-integer-field":customElements.get("vaadin-integer-field"),"x-error-screen":h,"x-preview":P,"x-i18n":l}}static get properties(){return e(e({},super.properties),{},{__modified:{},readonly:{type:Boolean,reflect:!0},currency:{type:String},category:{type:String},code:{type:String,reflect:!0},expires:{type:String},height:{type:Number},image:{type:String},length:{type:Number},name:{type:String},parent_code:{type:String},price:{type:Number},quantity:{type:Number,reflect:!0},quantity_max:{type:Number},quantity_min:{type:String},shipto:{type:String},total:{type:Number,reflect:!0,attribute:"total"},url:{type:String},value:{type:Object},weight:{type:Number},width:{type:Number},__childPrices:{},__childrenCount:{},__images:{},alt:{type:String},isChildItem:{type:Boolean,reflect:!0,attribute:"data-bundled"},isItem:{type:Boolean,reflect:!0,attribute:"data-item"},open:{type:Object},pid:{type:Number,reflect:!0},items:{type:Array}})}get items(){const t=[];return this.__onEachChildItem([e=>t.push(e.value)]),t}set items(t){this.__createItems(t)}get value(){const t={};for(let e=0;e<this.attributes.length;e++)t[this.attributes[e].name]=this.attributes[e].value;return t.items=this.items,t}set value(t){this.__itemDescription="";for(const e in t){let i="";if("description"!=e){if("object"==typeof t[e])i=JSON.stringify(t[e]);else{const s=e;(t[s]&&"undefined"!==t[s]||0===t[s])&&(i=t[e].toString())}this.setAttribute(e,t[e]?i:"")}else this.__itemDescription=t[e]}}updated(t){t.forEach(((t,e)=>{"__itemDescription"!=e&&"isChildItem"!=e||this.__updateDescriptionEl()})),this.__setTotalPrice(),this.dispatchEvent(new Event("change"))}render(){var t;if(!this.__isValid())return s(T||(T=Z`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`));const e=`font-lumo text-body text-s leading-m transition duration-100 ${this.quantity?"":"removed opacity-50"}`;if(this.isChildItem)return s(O||(O=Z` <article part="item" class="py-s w-full relative separator item-summary flex justify-between ${0}"> <div class="description flex-1"> <h1 class="text-header font-medium">${0}</h1> <section class="description text-secondary"> <slot></slot> </section> </div> ${0} </article> `),e,this.name,this.quantity<2?"":s(V||(V=Z` <section class="quantity font-medium text-tertiary whitespace-nowrap"> ${0} </section> `),this._t("item.items",{quantity:this.quantity})));{const i=(null!==(t=this.price)&&void 0!==t?t:0)+this.__childPrices.reduce(((t,e)=>t+e),0),r=this.__translateAmount(i*this.quantity),a=this.__translateAmount(i);return s(M||(M=Z` <article part="item" class="p-l relative item ${0} ${0}"> <x-preview class="preview float-left w-preview h-preview mr-l mb-l" exportparts="picture" .image="${0}" .quantity="${0}" .items="${0}"> </x-preview> <section class="description min-w-description ml-description"> <h1 class="text-header font-medium text-l leading-none mr-quantity mb-s"> ${0} </h1> <div class="item-description text-secondary mr-quantity mb-s"> <slot></slot> </div> <div class="child-items mb-s"> <slot name="items"></slot> </div> ${0} </section> <section class="quantity w-quantity absolute top-0 right-0 m-l"> <vaadin-integer-field class="w-full p-0" name="quantity" @change="${0}" value="${0}" min="0" has-controls ?readonly="${0}"> </vaadin-integer-field> ${0} </section> </article> `),e,this.__modified?"modified":"",this.image,this.quantity,[...this.querySelectorAll("[data-bundled]")].map((t=>{var e;return{quantity:t.quantity,image:null!==(e=t.image)&&void 0!==e?e:""}})),this.name,a?s(H||(H=Z`<div class="font-medium price text-l">${0}</div>`),a):"",this.__handleQuantity,this.quantity,this.readonly,this.quantity>1?s(B||(B=Z` <x-i18n .ns="${0}" .lang="${0}" .opts="${0}" class="price-total text-secondary text-xs text-center block mt-xs" key="price.total"> </x-i18n> `),this.ns,this.lang,{amount:r}):"")}}getImageDescription(){return{src:this.image,alt:this.alt,quantity:this.quantity}}signedName(t){const e=super.signedName(t);return`${this.pid.toString()}:${e}`}static __newId(){const t=R.__existingIds.reduce(((t,e)=>e>t?e:t),0)+1;return R.__existingIds.push(t),t}__updateDescriptionEl(){if(this.__itemDescription){let t=this.shadowRoot.querySelector("data-item-description");t||(t=document.createElement("p"),t.dataset.itemDescription="true",this.__addSlottedEl(t)),t.innerText=this.__itemDescription}else{const t=this.shadowRoot.querySelector("data-item-description");t&&t.remove()}}__addSlottedEl(t){const e=this.shadowRoot.querySelector("article");e&&e.appendChild(t)}__setCode(){this.code||(this.code=`RAND${Math.random()}`)}__createItems(t){t.forEach((t=>{const e=document.createElement(this.tagName);e.value=t,e.currency=this.currency,e.__computeTotalPrice(),this.__acknowledgeItem(e),this.appendChild(e)}))}__setTotalPrice(){this.total=this.__computeTotalPrice()}__computeTotalPrice(){if(!this.__childPrices)return this.price?this.price*this.quantity:0;let t=0;return this.__childPrices.forEach((e=>{t+=e})),t+=this.price,t*=this.quantity,t}__isValid(){const t=[];return this.name&&this.name.length||t.push("The name attribute of an item is required."),this.price||0===this.price||t.push("The price attribute of an item is required."),this.price&&this.price<0&&t.push("Item added with negative price."),this.quantity_min&&this.quantity&&this.quantity<this.quantity_min&&t.push("Quantity amount is less than minimum quantity."),this.quantity_max&&this.quantity&&this.quantity>this.quantity_max&&t.push("Quantity amount is more than maximum quantity."),console.error(...t),!t.length}__translateAmount(t){return this.currency?t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"}):""}__observeItems(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.nodeType===Node.DOCUMENT_NODE&&this.__acknowledgeItem(t)}))})),this.__setTotalPrice()}__acknowledgeChildItems(){var t;null===(t=this.shadowRoot)||void 0===t||t.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t))),this.querySelectorAll("[data-item]").forEach((t=>this.__acknowledgeItem(t)))}__acknowledgeItem(t){t.addEventListener("change",this.__changedChildItem.bind(this)),t.currency=this.currency,t.isItem=!1,t.isChildItem=!0,this.code&&(t.parent_code=this.code)}__changedChildItem(){const t=[],e=[];let i=0;this.__onEachChildItem([e=>{void 0!==e.total&&t.push(e.total)},t=>{e.push(t.getImageDescription())},()=>i+=1]),this.image&&0===e.length&&e.push(this.getImageDescription()),this.__childPrices=t,this.__images=e,this.__childrenCount=i,this.__setTotalPrice()}__onEachChildItem(t){const e=this.querySelectorAll("[data-bundled]");for(const i of e)for(const e of t)e(i)}}R.__existingIds=[];let z,Q,W,J,U,X,G=t=>t;class K extends j{constructor(){super("items-form"),this.readonly=!1,this.target="_top",this.cart="checkout",this.sub_modify="replace",this.sub_restart="auto",this.frequencies=[],this.handleSubmit={handleEvent:()=>{null!==this.__data&&this.dispatchEvent(new m(this.__data))&&this.shadowRoot.querySelector("form").submit()}},this.__hasValidItems=!1,this.__total=0,this.__handleFrequency={handleEvent:t=>{const e=t.detail.replace(/([wydm])\w*/,"$1").replace(/ /g,"").replace(/^0/,"");K.__validFrequency(e)?this.sub_frequency=e:this.sub_frequency="",this.__updateData()}},this.__data=new FormData,this.__childItemsObserver=new MutationObserver(this.__observeChildren.bind(this)),this.__childItemsObserver.observe(this,{childList:!0,attributes:!1,subtree:!0}),this.updateComplete.then((()=>{this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}))}static get scopedElements(){return{"x-error-screen":h,"vaadin-button":customElements.get("vaadin-button"),"x-dropdown":c,"x-item":R}}static get properties(){return e(e({},super.properties),{},{currency:{type:String},readonly:{type:Boolean},cart:{type:String,converter:t=>t&&!["checkout","add"].includes(t)?null:t},target:{type:String},store:{type:String,attribute:"store"},sub_frequency:{type:String},sub_startdate:{type:String,converter:t=>K.__validDate(t)?t:(console.error("Invalid start date",t),"")},sub_enddate:{type:String,converter:t=>K.__validDateFuture(t)?t:(console.error("Invalid end date",t),"")},sub_token:{type:String},sub_modify:{type:String,converter:t=>""===t||"append"===t?"":"replace"},sub_restart:{type:String,converter:t=>"true"===t?t:"auto"},frequencies:{converter:t=>{if(!t)return[];const e=JSON.parse(t);if(!Array.isArray(e))return console.error("Invalid frequency","Frequency options must be an array."),[];for(const t of e)if(!K.__validFrequency(t))return console.error("Invalid frequency","Invalid frequency option.\n Please, check https://wiki.foxycart.com/v/2.0/products#subscription_product_options for possible values.\n Each frequency must be a in the format:\n - 1d (a number followed by d, for day)\n - 1w (a number followed by w, for week)\n - 1m (a number followed by m, for month)\n - 1y (a number followed by y, for year)\n or .5m (no other decimals are allowed, and this is only for months)\n ",t),[];return e.filter(K.__validFrequency)}},items:{type:Array},__hasValidItems:{attribute:!1},__total:{attribute:!1},__data:{attribute:!1}})}get items(){const t=[];return this.__itemElements.forEach((e=>{const i=new Proxy(e,{set:function(t,e,i){const s=Object.keys(t.value);return!("string"!=typeof e||!s.includes(e))&&(t[e]=i,!0)},get:function(t,e){return t.value[e]}});t.push(i)})),t}set items(t){this.__removeItems(),this.__createItemsFromItemArray(t)}get total(){return this.__total}render(){var t;return this.store&&this.currency?s(Q||(Q=G` <div> <form class="overflow-hidden" method="POST" target="${0}" action="https://${0}/cart" data-testid="form" class="hidden" hidden> ${0} </form> <section class="items"> <slot></slot> </section> ${0} </div> `),this.target,this.store,this.__data?s(W||(W=G` ${0}`),[...this.__data.entries()].map((([t,e])=>s(J||(J=G`<input type="hidden" name="${0}" value="${0}">`),t,e)))):"",this.readonly?"":s(U||(U=G` <section class="actions flex flex-wrap justify-end m-m"> ${0} <vaadin-button class="m-s w-full sm-w-auto" theme="primary" data-testid="submit" ?disabled="${0}" @click="${0}"> <span class="total"> ${0} </span> </vaadin-button> </section> `),this.frequencies&&this.frequencies.length?s(X||(X=G` <x-dropdown type="text" name="frequency" class="subscription m-s w-full sm-w-auto" lang="${0}" .value="${0}" .items="${0}" .getText="${0}" @change="${0}"> </x-dropdown> `),this.lang,null!==(t=this.sub_frequency)&&void 0!==t?t:"0",this.frequencies.concat(["0"]),this.__translateFrequency.bind(this),this.__handleFrequency):"",!this.__hasValidItems,this.handleSubmit,this.__submitBtnText(this.__translateAmount(this.total)))):s(z||(z=G`<x-error-screen type="setup_needed" class="relative"></x-error-screen>`))}addItems(t){for(const e of t){const t=this.createItem(e);this.appendChild(t),this.__acknowledgeItemElement(t)}}removeItems(t){this.__removeItems((e=>t.includes(e.pid)))}updated(){this.dispatchEvent(new u(this.__data))}createItem(t){const e=this.constructor.getScopedTagName("x-item"),i=document.createElement(e);return i.value=t,i.currency=this.currency,i.readonly=this.readonly,i}__submitBtnText(t){if(this.sub_frequency&&"0"!=this.sub_frequency){const e=r(this.sub_frequency);return 1===e.count?this._t("checkout.subscribe_single_unit",{value:t,period:this._t(e.units).toLowerCase()}):this._t("checkout.subscribe_muiltiple_units",{value:t,period:this.__translateFrequency(this.sub_frequency).toLowerCase()})}return this._t("checkout.buy",{value:t})}get __itemElements(){return this.querySelectorAll("[data-item]")}__createItemsFromItemArray(t){this.addItems(t)}__removeItems(t=(()=>!0)){this.__itemElements.forEach((e=>{t(e)&&e.remove()}))}__addSignature(t,e,i){return`${t}||${e}${i?"||open":""}`}__formDataFill(t){let e=0;return this.__itemElements.forEach((i=>{e+=this.__formDataAddItem(t,i)})),this.__formDataAddCartWideSubscriptionFields(t),e}__formDataCustomInputs(t){this.querySelectorAll("[name]").forEach((e=>{const i=e;"INPUT"==i.tagName&&["checkbox","radio"].includes(i.type)&&!i.checked||"OPTION"!=i.tagName&&i.value&&["number","string"].includes(typeof i.value)&&t.set(i.name,i.value)}))}__isAttributeReserved(t){return["alt","currency","description","isChildren","isItem","items","open","pid","signatures","slot","total"].includes(t)}__formDataAddItem(t,e,i=null){let s=0;if(this.__validItem(e)){if(!e.value.pid)throw new Error("Attempt to convert a item without a propper ID");i&&i.getAttribute("code")&&e.setAttribute("parent_code",i.getAttribute("code"));for(let s=0;s<e.attributes.length;s++){const r=e.attributes[s];if(!this.__isAttributeReserved(r.name)&&!r.name.startsWith("data-")){let s=e[r.name];e.code&&["string","number"].includes(typeof s)&&(i&&"quantity"==r.name&&(s=Number(r.value)*i.quantity),t.set(e.signedName(r.name),s.toString()))}}s+=1,this.__formDataAddSubscriptionFields(t,e)}const r=e.querySelectorAll("[data-bundled]");if(r&&e.quantity>0)for(const i of r)s+=this.__formDataAddItem(t,i,e);return s}__formDataAddSubscriptionFields(t,e){if(this.sub_frequency)for(const i of["sub_frequency","sub_startdate","sub_enddate"])this[i]&&t.set(e.signedName(i),this[i])}__formDataAddCartWideSubscriptionFields(t){this.sub_frequency&&(this.sub_token&&t.set(this.signedName("sub_token"),this.sub_token),t.set(this.signedName("sub_modify"),this.sub_modify),t.set(this.signedName("sub_restart"),this.sub_restart))}__formDataAddCartFields(t){this.cart?t.set("cart",this.cart):t.delete("cart")}static __validDate(t){return null!=t&&(t.match(/^(\d{1,2}|\d{8})$/)?!(t.match(/^\d{2}$/)&&Number(t)>31):!(t.match(/^\.5m/)||!K.__validFrequency(t)))}static __validDateFuture(t){let e=!1;if(K.__validDate(t))if(t.match(/^\d{8}/)){e=(new Date).toISOString().replace(/(-|T.*)/g,"")<=t}else e=!0;return e}static __validFrequency(t){return!!t&&!!t.match(/^(\.5m|\d+[dwmy])$/)}__observeChildren(t){t.forEach((t=>{"childList"==t.type&&t.addedNodes.forEach((t=>{t.addEventListener("change",this.__itemChange.bind(this))}))})),this.__acknowledgeItemElements(),this.__computeTotalPrice(),this.__updateData()}__itemChange(){this.__computeTotalPrice(),this.__updateData()}__computeTotalPrice(){let t=0;this.__itemElements.forEach((e=>{const i=e;i.total&&(t+=Number(i.total))})),this.__total=Number(t.toFixed(2))}__acknowledgeItemElements(){this.__itemElements.forEach((t=>{const e=t;this.__acknowledgeItemElement(e)}))}__acknowledgeItemElement(t){t.addEventListener("change",this.__itemChange.bind(this)),t.currency=this.currency}__validItem(t){const e=t.getAttribute("pid"),i=Number(t.getAttribute("quantity")),s=Number(t.getAttribute("price"));return!!(e&&i>0&&s>=0)}__translateFrequency(t){if(t.startsWith("0"))return this._t("frequency_once");if(".5m"===t)return this._t("frequency_0_5m");const{count:e,units:i}=r(t);return this._t("frequency",{units:this._t(i,{count:e}),count:e})}__translateAmount(t){return t.toLocaleString(this.lang,{minimumFractionDigits:2,currency:this.currency,style:"currency"})}__updateData(){this.__data=null;if(!this.shadowRoot.querySelector("form"))return;const t=new FormData,e=this.__formDataFill(t);this.__hasValidItems=!!e,this.__formDataAddCartFields(t),this.__formDataCustomInputs(t),this.__data=t}}customElements.define("foxy-items-form",K),customElements.define("foxy-item",R);export{K as I,P,R as a};
@@ -64,6 +64,178 @@
64
64
  "coupon_entry": "Coupon code",
65
65
  "coupon_name_helper_text": "Coupon name is visible to the customers.",
66
66
  "create": "Create",
67
+ "currency": "Currency",
68
+ "currency_aed": "United Arab Emirates Dirham",
69
+ "currency_afn": "Afghan Afghani",
70
+ "currency_all": "Albanian Lek",
71
+ "currency_amd": "Armenian Dram",
72
+ "currency_ang": "Netherlands Antillean Guilder",
73
+ "currency_aoa": "Angolan Kwanza",
74
+ "currency_ars": "Argentine Peso",
75
+ "currency_aud": "Australian Dollar",
76
+ "currency_awg": "Aruban Florin",
77
+ "currency_azn": "Azerbaijani Manat",
78
+ "currency_bam": "Bosnia-Herzegovina Convertible Mark",
79
+ "currency_bbd": "Barbadian Dollar",
80
+ "currency_bdt": "Bangladeshi Taka",
81
+ "currency_bgn": "Bulgarian Lev",
82
+ "currency_bhd": "Bahraini Dinar",
83
+ "currency_bif": "Burundian Franc",
84
+ "currency_bmd": "Bermudan Dollar",
85
+ "currency_bnd": "Brunei Dollar",
86
+ "currency_bob": "Bolivian Boliviano",
87
+ "currency_brl": "Brazilian Real",
88
+ "currency_bsd": "Bahamian Dollar",
89
+ "currency_btc": "Bitcoin",
90
+ "currency_btn": "Bhutanese Ngultrum",
91
+ "currency_bwp": "Botswanan Pula",
92
+ "currency_byn": "Belarusian Ruble",
93
+ "currency_bzd": "Belize Dollar",
94
+ "currency_cad": "Canadian Dollar",
95
+ "currency_cdf": "Congolese Franc",
96
+ "currency_chf": "Swiss Franc",
97
+ "currency_clf": "Chilean Unit of Account (UF)",
98
+ "currency_clp": "Chilean Peso",
99
+ "currency_cnh": "Chinese Yuan (Offshore)",
100
+ "currency_cny": "Chinese Yuan",
101
+ "currency_cop": "Colombian Peso",
102
+ "currency_crc": "Costa Rican Colón",
103
+ "currency_cuc": "Cuban Convertible Peso",
104
+ "currency_cup": "Cuban Peso",
105
+ "currency_cve": "Cape Verdean Escudo",
106
+ "currency_czk": "Czech Republic Koruna",
107
+ "currency_djf": "Djiboutian Franc",
108
+ "currency_dkk": "Danish Krone",
109
+ "currency_dop": "Dominican Peso",
110
+ "currency_dzd": "Algerian Dinar",
111
+ "currency_egp": "Egyptian Pound",
112
+ "currency_ern": "Eritrean Nakfa",
113
+ "currency_etb": "Ethiopian Birr",
114
+ "currency_eur": "Euro",
115
+ "currency_fjd": "Fijian Dollar",
116
+ "currency_fkp": "Falkland Islands Pound",
117
+ "currency_gbp": "British Pound Sterling",
118
+ "currency_gel": "Georgian Lari",
119
+ "currency_ggp": "Guernsey Pound",
120
+ "currency_ghs": "Ghanaian Cedi",
121
+ "currency_gip": "Gibraltar Pound",
122
+ "currency_gmd": "Gambian Dalasi",
123
+ "currency_gnf": "Guinean Franc",
124
+ "currency_gtq": "Guatemalan Quetzal",
125
+ "currency_gyd": "Guyanaese Dollar",
126
+ "currency_hkd": "Hong Kong Dollar",
127
+ "currency_hnl": "Honduran Lempira",
128
+ "currency_hrk": "Croatian Kuna",
129
+ "currency_htg": "Haitian Gourde",
130
+ "currency_huf": "Hungarian Forint",
131
+ "currency_idr": "Indonesian Rupiah",
132
+ "currency_ils": "Israeli New Sheqel",
133
+ "currency_imp": "Manx pound",
134
+ "currency_inr": "Indian Rupee",
135
+ "currency_iqd": "Iraqi Dinar",
136
+ "currency_irr": "Iranian Rial",
137
+ "currency_isk": "Icelandic Króna",
138
+ "currency_jep": "Jersey Pound",
139
+ "currency_jmd": "Jamaican Dollar",
140
+ "currency_jod": "Jordanian Dinar",
141
+ "currency_jpy": "Japanese Yen",
142
+ "currency_kes": "Kenyan Shilling",
143
+ "currency_kgs": "Kyrgystani Som",
144
+ "currency_khr": "Cambodian Riel",
145
+ "currency_kmf": "Comorian Franc",
146
+ "currency_kpw": "North Korean Won",
147
+ "currency_krw": "South Korean Won",
148
+ "currency_kwd": "Kuwaiti Dinar",
149
+ "currency_kyd": "Cayman Islands Dollar",
150
+ "currency_kzt": "Kazakhstani Tenge",
151
+ "currency_lak": "Laotian Kip",
152
+ "currency_lbp": "Lebanese Pound",
153
+ "currency_lkr": "Sri Lankan Rupee",
154
+ "currency_lrd": "Liberian Dollar",
155
+ "currency_lsl": "Lesotho Loti",
156
+ "currency_lyd": "Libyan Dinar",
157
+ "currency_mad": "Moroccan Dirham",
158
+ "currency_mdl": "Moldovan Leu",
159
+ "currency_mga": "Malagasy Ariary",
160
+ "currency_mkd": "Macedonian Denar",
161
+ "currency_mmk": "Myanma Kyat",
162
+ "currency_mnt": "Mongolian Tugrik",
163
+ "currency_mop": "Macanese Pataca",
164
+ "currency_mru": "Mauritanian Ouguiya",
165
+ "currency_mur": "Mauritian Rupee",
166
+ "currency_mvr": "Maldivian Rufiyaa",
167
+ "currency_mwk": "Malawian Kwacha",
168
+ "currency_mxn": "Mexican Peso",
169
+ "currency_myr": "Malaysian Ringgit",
170
+ "currency_mzn": "Mozambican Metical",
171
+ "currency_nad": "Namibian Dollar",
172
+ "currency_ngn": "Nigerian Naira",
173
+ "currency_nio": "Nicaraguan Córdoba",
174
+ "currency_nok": "Norwegian Krone",
175
+ "currency_npr": "Nepalese Rupee",
176
+ "currency_nzd": "New Zealand Dollar",
177
+ "currency_omr": "Omani Rial",
178
+ "currency_pab": "Panamanian Balboa",
179
+ "currency_pen": "Peruvian Nuevo Sol",
180
+ "currency_pgk": "Papua New Guinean Kina",
181
+ "currency_php": "Philippine Peso",
182
+ "currency_pkr": "Pakistani Rupee",
183
+ "currency_pln": "Polish Zloty",
184
+ "currency_pyg": "Paraguayan Guarani",
185
+ "currency_qar": "Qatari Rial",
186
+ "currency_ron": "Romanian Leu",
187
+ "currency_rsd": "Serbian Dinar",
188
+ "currency_rub": "Russian Ruble",
189
+ "currency_rwf": "Rwandan Franc",
190
+ "currency_sar": "Saudi Riyal",
191
+ "currency_sbd": "Solomon Islands Dollar",
192
+ "currency_scr": "Seychellois Rupee",
193
+ "currency_sdg": "Sudanese Pound",
194
+ "currency_sek": "Swedish Krona",
195
+ "currency_sgd": "Singapore Dollar",
196
+ "currency_shp": "Saint Helena Pound",
197
+ "currency_sll": "Sierra Leonean Leone",
198
+ "currency_sos": "Somali Shilling",
199
+ "currency_srd": "Surinamese Dollar",
200
+ "currency_ssp": "South Sudanese Pound",
201
+ "currency_std": "São Tomé and Príncipe Dobra (pre-2018)",
202
+ "currency_stn": "São Tomé and Príncipe Dobra",
203
+ "currency_svc": "Salvadoran Colón",
204
+ "currency_syp": "Syrian Pound",
205
+ "currency_szl": "Swazi Lilangeni",
206
+ "currency_thb": "Thai Baht",
207
+ "currency_tjs": "Tajikistani Somoni",
208
+ "currency_tmt": "Turkmenistani Manat",
209
+ "currency_tnd": "Tunisian Dinar",
210
+ "currency_top": "Tongan Pa'anga",
211
+ "currency_try": "Turkish Lira",
212
+ "currency_ttd": "Trinidad and Tobago Dollar",
213
+ "currency_twd": "New Taiwan Dollar",
214
+ "currency_tzs": "Tanzanian Shilling",
215
+ "currency_uah": "Ukrainian Hryvnia",
216
+ "currency_ugx": "Ugandan Shilling",
217
+ "currency_usd": "United States Dollar",
218
+ "currency_uyu": "Uruguayan Peso",
219
+ "currency_uzs": "Uzbekistan Som",
220
+ "currency_vef": "Venezuelan Bolívar Fuerte (Old)",
221
+ "currency_ves": "Venezuelan Bolívar Soberano",
222
+ "currency_vnd": "Vietnamese Dong",
223
+ "currency_vuv": "Vanuatu Vatu",
224
+ "currency_wst": "Samoan Tala",
225
+ "currency_xaf": "CFA Franc BEAC",
226
+ "currency_xag": "Silver Ounce",
227
+ "currency_xau": "Gold Ounce",
228
+ "currency_xcd": "East Caribbean Dollar",
229
+ "currency_xdr": "Special Drawing Rights",
230
+ "currency_xof": "CFA Franc BCEAO",
231
+ "currency_xpd": "Palladium Ounce",
232
+ "currency_xpf": "CFP Franc",
233
+ "currency_xpt": "Platinum Ounce",
234
+ "currency_yer": "Yemeni Rial",
235
+ "currency_zar": "South African Rand",
236
+ "currency_zmw": "Zambian Kwacha",
237
+ "currency_zwl": "Zimbabwean Dollar",
238
+ "current_balance": "Current balance",
67
239
  "custom_config": "Custom config",
68
240
  "custom_config_helper_text": "If you have any custom values you'd like to make available to your twig template, you can add them here as a valid JSON string.",
69
241
  "custom_discount": "Custom discount",
@@ -109,6 +281,8 @@
109
281
  "end_subscription_explainer": "Your subscription will remain active until the selected end date. You might have to resubscribe if you decide to resume this subscription later.",
110
282
  "error": "Error",
111
283
  "expires": "Expires",
284
+ "expires_after": "Expires after",
285
+ "expires_after_value": "Expires {{value}}",
112
286
  "field": "Field",
113
287
  "field_plural": "Fields",
114
288
  "filter": "Filter",
@@ -135,6 +309,9 @@
135
309
  "ga_include_on_site_explainer": "Enable Google Analytics on any page where the loader.js file is included.",
136
310
  "generate": "Generate",
137
311
  "generate_codes_done": "All done! We've added new codes for you.",
312
+ "gift_card_category_restrictions_helper_text": "Select which item categories this gift card can be applied to. If you’d like this gift card to be available to all items regardless of the category, keep your selection empty. All changes are saved automatically.",
313
+ "gift_card_name_helper_text": "Gift card names are displayed to the customer.",
314
+ "gift_card_product_restrictions_explainer": "If you want to limit which products can use this gift card, you can enter full product codes or partial product codes using * as a wild card at the beginning or end of the value. So abc123, fun_*, *-small would match abc123, fun_ and fun_times, and example-small. It wouldn't match abc12, abc1234, fun, or good-smalls.",
138
315
  "hidden": "Hidden",
139
316
  "hidden_codes_explainer": "We’ve hidden some of your codes because there were too many of them. Don’t worry – we’ll import them anyway.",
140
317
  "hidden_codes_header": "{{count}} code is hidden",
@@ -180,6 +357,7 @@
180
357
  "multiple_codes_allowed": "Allow multiple codes per customer",
181
358
  "multiple_codes_allowed_explainer": "Let customers apply this coupon multiple times to the same order.",
182
359
  "name": "Name",
360
+ "never_expires": "Never expires",
183
361
  "new_password": "New password",
184
362
  "new_password_format_error": "The new password you've chosen is too weak. Please enter a secure new password.",
185
363
  "new_password_required_error": "To keep your account secure, please change your password before logging in this time.",
@@ -1,5 +1,6 @@
1
- import '@vaadin/vaadin-combo-box';
2
1
  import '@vaadin/vaadin-text-field/vaadin-integer-field';
2
+ import '@vaadin/vaadin-custom-field';
3
+ import '@vaadin/vaadin-combo-box';
3
4
  import '../../public/I18n/index';
4
5
  import { CSSResult, CSSResultArray, LitElement, PropertyDeclarations, TemplateResult } from 'lit-element';
5
6
  export declare class FrequencyInput extends LitElement {
@@ -1,5 +1,6 @@
1
- import '@vaadin/vaadin-combo-box';
2
1
  import '@vaadin/vaadin-text-field/vaadin-integer-field';
2
+ import '@vaadin/vaadin-custom-field';
3
+ import '@vaadin/vaadin-combo-box';
3
4
  import "../../public/I18n/index.js";
4
5
  import { LitElement, css, html, } from 'lit-element';
5
6
  import { FrequencyInputChangeEvent } from "./FrequencyInputChangeEvent.js";
@@ -51,6 +52,7 @@ vaadin-custom-field{
51
52
  width:100%;
52
53
  font-size:0;
53
54
  line-height:0;
55
+ padding-top:0 !important;
54
56
  }
55
57
 
56
58
  vaadin-custom-field::part(label){
@@ -1 +1 @@
1
- {"version":3,"file":"FrequencyInput.js","sourceRoot":"","sources":["../../../../src/elements/private/FrequencyInput/FrequencyInput.ts"],"names":[],"mappings":"AAAA,OAAO,0BAA0B,CAAC;AAClC,OAAO,gDAAgD,CAAC;AACxD,oCAAiC;AAEjC,OAAO,EAGL,UAAU,EAGV,GAAG,EACH,IAAI,GACL,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,yBAAyB,EAAE,uCAAoC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,yCAAsC;AAE9D,MAAM,OAAO,cAAe,SAAQ,UAAU;IAA9C;;QAiDE,UAAK,GAAG,EAAE,CAA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9B,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,OAAiC;QACvC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACvB,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,iBAAuC,CAAC;QACtE,IAAI,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK;YAAE,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IAC3D,CAAC;IAED,oBAAoB;;QAClB,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7B,MAAA,IAAI,CAAC,qBAAqB,+CAA1B,IAAI,EAA2B;IACjC,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAY,GAAG;QACb,OAAO,cAAc,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtE,CAAC;IAEO,cAAc,CAAC,GAAsB;QAC3C,MAAM,KAAK,GAAG,GAAG,CAAC,MAA4B,CAAC;QAC/C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAe,CAAC;QACnC,IAAI,CAAC,aAAa,CAAC,IAAI,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAChE,CAAC;CACF","sourcesContent":["import '@vaadin/vaadin-combo-box';\nimport '@vaadin/vaadin-text-field/vaadin-integer-field';\nimport '../../public/I18n/index';\n\nimport {\n CSSResult,\n CSSResultArray,\n LitElement,\n PropertyDeclarations,\n TemplateResult,\n css,\n html,\n} from 'lit-element';\nimport { CustomFieldElement, CustomFieldI18n } from '@vaadin/vaadin-custom-field';\n\nimport { FrequencyInputChangeEvent } from './FrequencyInputChangeEvent';\nimport { live } from '@open-wc/lit-helpers';\nimport memoize from 'lodash-es/memoize';\nimport { parseDuration } from '../../../utils/parse-duration';\n\nexport class FrequencyInput extends LitElement {\n static get properties(): PropertyDeclarations {\n return {\n checkValidity: { attribute: false },\n errorMessage: { type: String, attribute: 'error-message' },\n disabled: { type: Boolean, reflect: true },\n readonly: { type: Boolean, reflect: true },\n label: { type: String },\n value: { type: String },\n lang: { type: String },\n };\n }\n\n static get styles(): CSSResult | CSSResultArray {\n return css`\n :host {\n display: block;\n }\n\n vaadin-custom-field {\n width: 100%;\n font-size: 0;\n line-height: 0;\n }\n\n vaadin-custom-field::part(label) {\n padding-bottom: var(--lumo-space-s);\n }\n\n vaadin-custom-field::part(error-message)[aria-hidden='false'] {\n padding-top: var(--lumo-space-xs);\n }\n\n vaadin-integer-field,\n vaadin-combo-box {\n width: calc(50% - (var(--lumo-space-s) / 2));\n }\n\n vaadin-integer-field {\n margin-right: var(--lumo-space-s);\n padding: 0;\n }\n\n vaadin-combo-box::part(text-field) {\n padding: 0;\n }\n `;\n }\n\n label = '';\n\n value = '';\n\n disabled = false;\n\n readonly = false;\n\n errorMessage = '';\n\n private __i18n: CustomFieldI18n = {\n formatValue: inputValues => inputValues.join(''),\n parseValue: value => {\n const { count, units } = parseDuration(value);\n return [count.toString(), units];\n },\n };\n\n private __getItems = memoize((value: string) => {\n const count = parseDuration(value).count;\n\n return [\n { value: 'd', label: this.__t('day', { count }) },\n { value: 'w', label: this.__t('week', { count }) },\n { value: 'm', label: this.__t('month', { count }) },\n { value: 'y', label: this.__t('year', { count }) },\n ];\n });\n\n private __untrackTranslations?: () => void;\n\n connectedCallback(): void {\n super.connectedCallback();\n this.__untrackTranslations = customElements.get('foxy-i18n').onTranslationChange(() => {\n this.__getItems.cache.clear?.();\n this.requestUpdate();\n });\n }\n\n render(): TemplateResult {\n return html`\n <vaadin-custom-field\n data-testid=\"field\"\n .i18n=${this.__i18n}\n .label=${this.label}\n .value=${live(this.value)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .errorMessage=${this.errorMessage}\n .checkValidity=${this.checkValidity}\n @change=${this.__handleChange}\n >\n <vaadin-integer-field\n data-testid=\"value\"\n min=\"1\"\n max=\"999\"\n has-controls\n prevent-invalid-input\n ?invalid=${!this.checkValidity()}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n >\n </vaadin-integer-field>\n\n <vaadin-combo-box\n data-testid=\"units\"\n item-value-path=\"value\"\n item-label-path=\"label\"\n .items=${this.__getItems(this.value)}\n ?invalid=${!this.checkValidity()}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n >\n </vaadin-combo-box>\n </vaadin-custom-field>\n `;\n }\n\n updated(changes: Map<keyof this, unknown>): void {\n super.updated(changes);\n const field = this.renderRoot.firstElementChild as CustomFieldElement;\n if (field.value !== this.value) field.value = this.value;\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.__untrackTranslations?.();\n }\n\n checkValidity(): boolean {\n return true;\n }\n\n private get __t() {\n return customElements.get('foxy-i18n').i18next.getFixedT(this.lang);\n }\n\n private __handleChange(evt: CustomEvent<void>) {\n const field = evt.target as CustomFieldElement;\n this.value = field.value as string;\n this.dispatchEvent(new FrequencyInputChangeEvent(this.value));\n }\n}\n"]}
1
+ {"version":3,"file":"FrequencyInput.js","sourceRoot":"","sources":["../../../../src/elements/private/FrequencyInput/FrequencyInput.ts"],"names":[],"mappings":"AAAA,OAAO,gDAAgD,CAAC;AACxD,OAAO,6BAA6B,CAAC;AACrC,OAAO,0BAA0B,CAAC;AAClC,oCAAiC;AAEjC,OAAO,EAGL,UAAU,EAGV,GAAG,EACH,IAAI,GACL,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,yBAAyB,EAAE,uCAAoC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,yCAAsC;AAE9D,MAAM,OAAO,cAAe,SAAQ,UAAU;IAA9C;;QAkDE,UAAK,GAAG,EAAE,CAAC;QAEX,UAAK,GAAG,EAAE,CAAC;QAEX,aAAQ,GAAG,KAAK,CAAC;QAEjB,aAAQ,GAAG,KAAK,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AAC;QACvB,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAC,iBAAuC,CAAC;QACtE,IAAI,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK;YAAE,KAAK,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IAC3D,CAAC;IAED,oBAAoB;;QAClB,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7B,MAAA,IAAI,CAAC,qBAAqB,+CAA1B,IAAI,EAA2B;IACjC,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAY,GAAG;QACb,OAAO,cAAc,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACtE,CAAC;IAEO,cAAc,CAAC,GAAsB;QAC3C,MAAM,KAAK,GAAG,GAAG,CAAC,MAA4B,CAAC;QAC/C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,KAAe,CAAC;QACnC,IAAI,CAAC,aAAa,CAAC,IAAI,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAChE,CAAC;CACF","sourcesContent":["import '@vaadin/vaadin-text-field/vaadin-integer-field';\nimport '@vaadin/vaadin-custom-field';\nimport '@vaadin/vaadin-combo-box';\nimport '../../public/I18n/index';\n\nimport {\n CSSResult,\n CSSResultArray,\n LitElement,\n PropertyDeclarations,\n TemplateResult,\n css,\n html,\n} from 'lit-element';\nimport type { CustomFieldElement, CustomFieldI18n } from '@vaadin/vaadin-custom-field';\n\nimport { FrequencyInputChangeEvent } from './FrequencyInputChangeEvent';\nimport { live } from '@open-wc/lit-helpers';\nimport memoize from 'lodash-es/memoize';\nimport { parseDuration } from '../../../utils/parse-duration';\n\nexport class FrequencyInput extends LitElement {\n static get properties(): PropertyDeclarations {\n return {\n checkValidity: { attribute: false },\n errorMessage: { type: String, attribute: 'error-message' },\n disabled: { type: Boolean, reflect: true },\n readonly: { type: Boolean, reflect: true },\n label: { type: String },\n value: { type: String },\n lang: { type: String },\n };\n }\n\n static get styles(): CSSResult | CSSResultArray {\n return css`\n :host {\n display: block;\n }\n\n vaadin-custom-field {\n width: 100%;\n font-size: 0;\n line-height: 0;\n padding-top: 0 !important;\n }\n\n vaadin-custom-field::part(label) {\n padding-bottom: var(--lumo-space-s);\n }\n\n vaadin-custom-field::part(error-message)[aria-hidden='false'] {\n padding-top: var(--lumo-space-xs);\n }\n\n vaadin-integer-field,\n vaadin-combo-box {\n width: calc(50% - (var(--lumo-space-s) / 2));\n }\n\n vaadin-integer-field {\n margin-right: var(--lumo-space-s);\n padding: 0;\n }\n\n vaadin-combo-box::part(text-field) {\n padding: 0;\n }\n `;\n }\n\n label = '';\n\n value = '';\n\n disabled = false;\n\n readonly = false;\n\n errorMessage = '';\n\n private __i18n: CustomFieldI18n = {\n formatValue: inputValues => inputValues.join(''),\n parseValue: value => {\n const { count, units } = parseDuration(value);\n return [count.toString(), units];\n },\n };\n\n private __getItems = memoize((value: string) => {\n const count = parseDuration(value).count;\n\n return [\n { value: 'd', label: this.__t('day', { count }) },\n { value: 'w', label: this.__t('week', { count }) },\n { value: 'm', label: this.__t('month', { count }) },\n { value: 'y', label: this.__t('year', { count }) },\n ];\n });\n\n private __untrackTranslations?: () => void;\n\n connectedCallback(): void {\n super.connectedCallback();\n this.__untrackTranslations = customElements.get('foxy-i18n').onTranslationChange(() => {\n this.__getItems.cache.clear?.();\n this.requestUpdate();\n });\n }\n\n render(): TemplateResult {\n return html`\n <vaadin-custom-field\n data-testid=\"field\"\n .i18n=${this.__i18n}\n .label=${this.label}\n .value=${live(this.value)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n .errorMessage=${this.errorMessage}\n .checkValidity=${this.checkValidity}\n @change=${this.__handleChange}\n >\n <vaadin-integer-field\n data-testid=\"value\"\n min=\"1\"\n max=\"999\"\n has-controls\n prevent-invalid-input\n ?invalid=${!this.checkValidity()}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n >\n </vaadin-integer-field>\n\n <vaadin-combo-box\n data-testid=\"units\"\n item-value-path=\"value\"\n item-label-path=\"label\"\n .items=${this.__getItems(this.value)}\n ?invalid=${!this.checkValidity()}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n >\n </vaadin-combo-box>\n </vaadin-custom-field>\n `;\n }\n\n updated(changes: Map<keyof this, unknown>): void {\n super.updated(changes);\n const field = this.renderRoot.firstElementChild as CustomFieldElement;\n if (field.value !== this.value) field.value = this.value;\n }\n\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.__untrackTranslations?.();\n }\n\n checkValidity(): boolean {\n return true;\n }\n\n private get __t() {\n return customElements.get('foxy-i18n').i18next.getFixedT(this.lang);\n }\n\n private __handleChange(evt: CustomEvent<void>) {\n const field = evt.target as CustomFieldElement;\n this.value = field.value as string;\n this.dispatchEvent(new FrequencyInputChangeEvent(this.value));\n }\n}\n"]}
@@ -94,13 +94,14 @@ export class CollectionPage extends ConfigurableMixin(NucleonElement) {
94
94
  else if (this.in({ idle: 'template' }) || this.__items.length === 0) {
95
95
  items.push({ key: 'empty', href: '', data: null });
96
96
  }
97
- return html `${repeat(items, item => item.key, item => { var _a; return (_a = this.__renderItem) === null || _a === void 0 ? void 0 : _a.call(this, {
97
+ return html `${repeat(items, item => item.key, (item, index) => { var _a, _b, _c, _d, _e; return (_a = this.__renderItem) === null || _a === void 0 ? void 0 : _a.call(this, {
98
98
  disabledControls: this.disabledControls,
99
99
  readonlyControls: this.readonlyControls,
100
100
  hiddenControls: this.hiddenControls,
101
101
  templates: this.templates,
102
102
  disabled: this.disabled,
103
103
  readonly: this.readonly,
104
+ previous: (_c = (_b = items[index - 1]) === null || _b === void 0 ? void 0 : _b.data) !== null && _c !== void 0 ? _c : null,
104
105
  hidden: this.hidden,
105
106
  parent: this.href,
106
107
  spread: spread,
@@ -109,6 +110,7 @@ export class CollectionPage extends ConfigurableMixin(NucleonElement) {
109
110
  lang: this.lang,
110
111
  data: item.data,
111
112
  href: item.href,
113
+ next: (_e = (_d = items[index + 1]) === null || _d === void 0 ? void 0 : _d.data) !== null && _e !== void 0 ? _e : null,
112
114
  ns: this.ns,
113
115
  html,
114
116
  }); })}`;
@@ -1 +1 @@
1
- {"version":3,"file":"CollectionPage.js","sourceRoot":"","sources":["../../../../src/elements/public/CollectionPage/CollectionPage.ts"],"names":[],"mappings":"AACA,OAAO,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,UAAU,EAAE,wCAAqC;AAC1D,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,OAAO,cAAmC,SAAQ,iBAAiB,CAAC,cAAc,CAAQ;IAsB9F;QACE,KAAK,EAAE,CAAC;QAZV,iJAAiJ;QACjJ,UAAK,GAA4B,EAAE,CAAC;QAEpC,OAAE,GAAG,EAAE,CAAC;QAEA,4BAAuB,GAAG,CAAC,GAAY,EAAE,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC;QAQnF,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAAC;IAxBD,gBAAgB;IAChB,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACvB,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACtB,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACrB,CAAC;IACJ,CAAC;IAkBD;;;;;;;;;;OAUG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,IAAI,CAAC,KAAgD;QACvD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S,mCAAI,EAAE,CAAU,CAAC,CAAC,MAAM,CAC1E,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,EACtB,EAA0B,CAC3B,CAAC;IACJ,CAAC;IAEO,sBAAsB,CAAC,KAAc;QAC3C,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI;YAAE,OAAO;QACpE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC;QAEtC,IAAI,MAAM,KAAK,KAAK;YAAE,OAAO;QAC7B,IAAI,GAAG,KAAK,8BAA8B;YAAE,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC9E,IAAI,GAAG,KAAK,6BAA6B;YAAE,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC9E,CAAC;IAEO,cAAc,CAAC,KAAiB;QACtC,KAAK,CAAC,wBAAwB,EAAE,CAAC;QACjC,KAAK,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IAEO,aAAa,CAAC,KAAiB;QACrC,KAAK,CAAC,wBAAwB,EAAE,CAAC;QACjC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC;CACF;AAED,2BAAwB","sourcesContent":["import { ExtractItem, ItemRenderer, Page } from './types';\nimport { PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { FetchEvent } from '../NucleonElement/FetchEvent';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { repeat } from 'lit-html/directives/repeat';\nimport { spread } from '@open-wc/lit-helpers';\n\n/**\n * Renders an element for each resource in a collection page.\n *\n * @element foxy-collection-page\n * @since 1.1.0\n */\nexport class CollectionPage<TPage extends Page> extends ConfigurableMixin(NucleonElement)<TPage> {\n /** @readonly */\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n props: { type: Object },\n item: { type: String },\n ns: { type: String },\n };\n }\n\n /** Spread directive argument from `@open-wc/lit-helpers` (properties, event listeners and attributes you'd like to pass to the item element). */\n props: Record<string, unknown> = {};\n\n ns = '';\n\n private __pageFetchEventHandler = (evt: unknown) => this.__handlePageFetchEvent(evt);\n\n private __renderItem!: ItemRenderer<ExtractItem<TPage>>;\n\n private __item!: string | ItemRenderer<ExtractItem<TPage>>;\n\n constructor() {\n super();\n this.item = 'foxy-null';\n }\n\n /**\n * Custom element tag or a render function to use for displaying collection items.\n * Generated custom elements will have the following attributes:\n *\n * - `parent` – same as `foxy-collection-page[href]`;\n * - `group` - same as `foxy-collection-page[group]`;\n * - `href` – collection page item's `_links.self.href` value;\n * - `lang` – same as `foxy-collection-page[lang]`;\n *\n * Render function will receive `ItemRendererContext` in the first argument.\n */\n get item(): string | ItemRenderer<ExtractItem<TPage>> {\n return this.__item;\n }\n\n set item(value: string | ItemRenderer<ExtractItem<TPage>>) {\n if (typeof value === 'string') {\n this.__renderItem = new Function(\n 'ctx',\n `return ctx.html\\`\n <${value}\n disabledcontrols=\\${ctx.disabledControls.toString()}\n readonlycontrols=\\${ctx.readonlyControls.toString()}\n hiddencontrols=\\${ctx.hiddenControls.toString()}\n data-testclass=\"items\"\n parent=\\${ctx.parent}\n group=\\${ctx.group}\n href=\\${ctx.href}\n lang=\\${ctx.lang}\n ns=\"\\${ctx.ns} $\\{customElements.get('${value}')?.defaultNS ?? ''}\"\n ?disabled=\\${ctx.disabled}\n ?readonly=\\${ctx.readonly}\n ?hidden=\\${ctx.hidden}\n .templates=\\${ctx.templates}\n ...=\\${ctx.spread(ctx.props)}\n >\n </${value}>\\``\n ) as ItemRenderer;\n } else {\n this.__renderItem = value;\n }\n\n this.__item = value;\n this.requestUpdate();\n }\n\n /** @readonly */\n createRenderRoot(): HTMLElement {\n return this;\n }\n\n /** @readonly */\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('fetch', this.__pageFetchEventHandler);\n }\n\n /** @readonly */\n render(): TemplateResult {\n type RepeatItem = { key: string; href: string; data: ExtractItem<TPage> | null };\n const items: RepeatItem[] = this.__items.map(item => ({\n key: item._links.self.href,\n href: item._links.self.href,\n data: item,\n }));\n\n if (this.in('busy')) {\n items.push({ key: 'stalled', href: 'foxy://collection-page/stall', data: null });\n } else if (this.in('fail')) {\n items.push({ key: 'failed', href: 'foxy://collection-page/fail', data: null });\n } else if (this.in({ idle: 'template' }) || this.__items.length === 0) {\n items.push({ key: 'empty', href: '', data: null });\n }\n\n return html`${repeat(\n items,\n item => item.key,\n item =>\n this.__renderItem?.({\n disabledControls: this.disabledControls,\n readonlyControls: this.readonlyControls,\n hiddenControls: this.hiddenControls,\n templates: this.templates,\n disabled: this.disabled,\n readonly: this.readonly,\n hidden: this.hidden,\n parent: this.href,\n spread: spread,\n props: this.props,\n group: this.group,\n lang: this.lang,\n data: item.data,\n href: item.href,\n ns: this.ns,\n html,\n })\n )}`;\n }\n\n /** @readonly */\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener('fetch', this.__pageFetchEventHandler);\n }\n\n private get __items(): ExtractItem<TPage>[] {\n return Array.from(Object.values(this.form?._embedded ?? {}) as any[]).reduce(\n (p, c) => [...p, ...c],\n [] as ExtractItem<TPage>[]\n );\n }\n\n private __handlePageFetchEvent(event: unknown) {\n if (!(event instanceof FetchEvent) || event.target === this) return;\n const { method, url } = event.request;\n\n if (method !== 'GET') return;\n if (url === 'foxy://collection-page/stall') return this.__stallRequest(event);\n if (url === 'foxy://collection-page/fail') return this.__failRequest(event);\n }\n\n private __stallRequest(event: FetchEvent) {\n event.stopImmediatePropagation();\n event.respondWith(new Promise(() => void 0));\n }\n\n private __failRequest(event: FetchEvent) {\n event.stopImmediatePropagation();\n event.respondWith(Promise.resolve(new Response(null, { status: 500 })));\n }\n}\n\nexport * from './types';\n"]}
1
+ {"version":3,"file":"CollectionPage.js","sourceRoot":"","sources":["../../../../src/elements/public/CollectionPage/CollectionPage.ts"],"names":[],"mappings":"AACA,OAAO,EAAwC,IAAI,EAAE,MAAM,aAAa,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,UAAU,EAAE,wCAAqC;AAC1D,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,OAAO,cAAmC,SAAQ,iBAAiB,CAAC,cAAc,CAAQ;IAsB9F;QACE,KAAK,EAAE,CAAC;QAZV,iJAAiJ;QACjJ,UAAK,GAA4B,EAAE,CAAC;QAEpC,OAAE,GAAG,EAAE,CAAC;QAEA,4BAAuB,GAAG,CAAC,GAAY,EAAE,EAAE,CAAC,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC;QAQnF,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;IAC1B,CAAC;IAxBD,gBAAgB;IAChB,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,GAAG,KAAK,CAAC,UAAU;YACnB,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACvB,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;YACtB,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACrB,CAAC;IACJ,CAAC;IAkBD;;;;;;;;;;OAUG;IACH,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,IAAI,IAAI,CAAC,KAAgD;QACvD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,IAAI,CA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,CAAC;IAClE,CAAC;IAED,IAAY,OAAO;;QACjB,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,aAAC,IAAI,CAAC,IAAI,0CAAE,SAAS,mCAAI,EAAE,CAAU,CAAC,CAAC,MAAM,CAC1E,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,EACtB,EAA0B,CAC3B,CAAC;IACJ,CAAC;IAEO,sBAAsB,CAAC,KAAc;QAC3C,IAAI,CAAC,CAAC,KAAK,YAAY,UAAU,CAAC,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI;YAAE,OAAO;QACpE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC;QAEtC,IAAI,MAAM,KAAK,KAAK;YAAE,OAAO;QAC7B,IAAI,GAAG,KAAK,8BAA8B;YAAE,OAAO,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QAC9E,IAAI,GAAG,KAAK,6BAA6B;YAAE,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC9E,CAAC;IAEO,cAAc,CAAC,KAAiB;QACtC,KAAK,CAAC,wBAAwB,EAAE,CAAC;QACjC,KAAK,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC;IAEO,aAAa,CAAC,KAAiB;QACrC,KAAK,CAAC,wBAAwB,EAAE,CAAC;QACjC,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC;CACF;AAED,2BAAwB","sourcesContent":["import { ExtractItem, ItemRenderer, Page } from './types';\nimport { PropertyDeclarations, TemplateResult, html } from 'lit-element';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { FetchEvent } from '../NucleonElement/FetchEvent';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { repeat } from 'lit-html/directives/repeat';\nimport { spread } from '@open-wc/lit-helpers';\n\n/**\n * Renders an element for each resource in a collection page.\n *\n * @element foxy-collection-page\n * @since 1.1.0\n */\nexport class CollectionPage<TPage extends Page> extends ConfigurableMixin(NucleonElement)<TPage> {\n /** @readonly */\n static get properties(): PropertyDeclarations {\n return {\n ...super.properties,\n props: { type: Object },\n item: { type: String },\n ns: { type: String },\n };\n }\n\n /** Spread directive argument from `@open-wc/lit-helpers` (properties, event listeners and attributes you'd like to pass to the item element). */\n props: Record<string, unknown> = {};\n\n ns = '';\n\n private __pageFetchEventHandler = (evt: unknown) => this.__handlePageFetchEvent(evt);\n\n private __renderItem!: ItemRenderer<ExtractItem<TPage>>;\n\n private __item!: string | ItemRenderer<ExtractItem<TPage>>;\n\n constructor() {\n super();\n this.item = 'foxy-null';\n }\n\n /**\n * Custom element tag or a render function to use for displaying collection items.\n * Generated custom elements will have the following attributes:\n *\n * - `parent` – same as `foxy-collection-page[href]`;\n * - `group` - same as `foxy-collection-page[group]`;\n * - `href` – collection page item's `_links.self.href` value;\n * - `lang` – same as `foxy-collection-page[lang]`;\n *\n * Render function will receive `ItemRendererContext` in the first argument.\n */\n get item(): string | ItemRenderer<ExtractItem<TPage>> {\n return this.__item;\n }\n\n set item(value: string | ItemRenderer<ExtractItem<TPage>>) {\n if (typeof value === 'string') {\n this.__renderItem = new Function(\n 'ctx',\n `return ctx.html\\`\n <${value}\n disabledcontrols=\\${ctx.disabledControls.toString()}\n readonlycontrols=\\${ctx.readonlyControls.toString()}\n hiddencontrols=\\${ctx.hiddenControls.toString()}\n data-testclass=\"items\"\n parent=\\${ctx.parent}\n group=\\${ctx.group}\n href=\\${ctx.href}\n lang=\\${ctx.lang}\n ns=\"\\${ctx.ns} $\\{customElements.get('${value}')?.defaultNS ?? ''}\"\n ?disabled=\\${ctx.disabled}\n ?readonly=\\${ctx.readonly}\n ?hidden=\\${ctx.hidden}\n .templates=\\${ctx.templates}\n ...=\\${ctx.spread(ctx.props)}\n >\n </${value}>\\``\n ) as ItemRenderer;\n } else {\n this.__renderItem = value;\n }\n\n this.__item = value;\n this.requestUpdate();\n }\n\n /** @readonly */\n createRenderRoot(): HTMLElement {\n return this;\n }\n\n /** @readonly */\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('fetch', this.__pageFetchEventHandler);\n }\n\n /** @readonly */\n render(): TemplateResult {\n type RepeatItem = { key: string; href: string; data: ExtractItem<TPage> | null };\n const items: RepeatItem[] = this.__items.map(item => ({\n key: item._links.self.href,\n href: item._links.self.href,\n data: item,\n }));\n\n if (this.in('busy')) {\n items.push({ key: 'stalled', href: 'foxy://collection-page/stall', data: null });\n } else if (this.in('fail')) {\n items.push({ key: 'failed', href: 'foxy://collection-page/fail', data: null });\n } else if (this.in({ idle: 'template' }) || this.__items.length === 0) {\n items.push({ key: 'empty', href: '', data: null });\n }\n\n return html`${repeat(\n items,\n item => item.key,\n (item, index) =>\n this.__renderItem?.({\n disabledControls: this.disabledControls,\n readonlyControls: this.readonlyControls,\n hiddenControls: this.hiddenControls,\n templates: this.templates,\n disabled: this.disabled,\n readonly: this.readonly,\n previous: items[index - 1]?.data ?? null,\n hidden: this.hidden,\n parent: this.href,\n spread: spread,\n props: this.props,\n group: this.group,\n lang: this.lang,\n data: item.data,\n href: item.href,\n next: items[index + 1]?.data ?? null,\n ns: this.ns,\n html,\n })\n )}`;\n }\n\n /** @readonly */\n disconnectedCallback(): void {\n super.disconnectedCallback();\n this.removeEventListener('fetch', this.__pageFetchEventHandler);\n }\n\n private get __items(): ExtractItem<TPage>[] {\n return Array.from(Object.values(this.form?._embedded ?? {}) as any[]).reduce(\n (p, c) => [...p, ...c],\n [] as ExtractItem<TPage>[]\n );\n }\n\n private __handlePageFetchEvent(event: unknown) {\n if (!(event instanceof FetchEvent) || event.target === this) return;\n const { method, url } = event.request;\n\n if (method !== 'GET') return;\n if (url === 'foxy://collection-page/stall') return this.__stallRequest(event);\n if (url === 'foxy://collection-page/fail') return this.__failRequest(event);\n }\n\n private __stallRequest(event: FetchEvent) {\n event.stopImmediatePropagation();\n event.respondWith(new Promise(() => void 0));\n }\n\n private __failRequest(event: FetchEvent) {\n event.stopImmediatePropagation();\n event.respondWith(Promise.resolve(new Response(null, { status: 500 })));\n }\n}\n\nexport * from './types';\n"]}
@@ -16,6 +16,7 @@ export declare type ItemRendererContext<TItem extends HALJSONResource = HALJSONR
16
16
  templates: Partial<Record<string, Renderer<any>>>;
17
17
  readonly: boolean;
18
18
  disabled: boolean;
19
+ previous: TItem | null;
19
20
  hidden: boolean;
20
21
  parent: string;
21
22
  spread: typeof spread;
@@ -25,6 +26,7 @@ export declare type ItemRendererContext<TItem extends HALJSONResource = HALJSONR
25
26
  lang: string;
26
27
  href: string;
27
28
  data: TItem | null;
29
+ next: TItem | null;
28
30
  ns: string;
29
31
  };
30
32
  export declare type ItemRenderer<TItem extends HALJSONResource = HALJSONResource> = (ctx: ItemRendererContext<TItem>) => TemplateResult;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/CollectionPage/types.ts"],"names":[],"mappings":"","sourcesContent":["import { TemplateResult, html } from 'lit-html';\n\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { HALJSONResource } from '../NucleonElement/types';\nimport { Renderer } from '../../../mixins/configurable';\nimport { spread } from '@open-wc/lit-helpers';\n\nexport type Page = HALJSONResource & { _embedded: Record<string, HALJSONResource[]> };\nexport type ExtractItem<T> = T extends { _embedded: Record<string, (infer U)[]> } ? U : never;\n\nexport type ItemRendererContext<TItem extends HALJSONResource = HALJSONResource> = {\n readonlyControls: BooleanSelector;\n disabledControls: BooleanSelector;\n hiddenControls: BooleanSelector;\n templates: Partial<Record<string, Renderer<any>>>;\n readonly: boolean;\n disabled: boolean;\n hidden: boolean;\n parent: string;\n spread: typeof spread;\n props: Record<string, unknown>;\n group: string;\n html: typeof html;\n lang: string;\n href: string;\n data: TItem | null;\n ns: string;\n};\n\nexport type ItemRenderer<TItem extends HALJSONResource = HALJSONResource> = (\n ctx: ItemRendererContext<TItem>\n) => TemplateResult;\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/elements/public/CollectionPage/types.ts"],"names":[],"mappings":"","sourcesContent":["import { TemplateResult, html } from 'lit-html';\n\nimport { BooleanSelector } from '@foxy.io/sdk/core';\nimport { HALJSONResource } from '../NucleonElement/types';\nimport { Renderer } from '../../../mixins/configurable';\nimport { spread } from '@open-wc/lit-helpers';\n\nexport type Page = HALJSONResource & { _embedded: Record<string, HALJSONResource[]> };\nexport type ExtractItem<T> = T extends { _embedded: Record<string, (infer U)[]> } ? U : never;\n\nexport type ItemRendererContext<TItem extends HALJSONResource = HALJSONResource> = {\n readonlyControls: BooleanSelector;\n disabledControls: BooleanSelector;\n hiddenControls: BooleanSelector;\n templates: Partial<Record<string, Renderer<any>>>;\n readonly: boolean;\n disabled: boolean;\n previous: TItem | null;\n hidden: boolean;\n parent: string;\n spread: typeof spread;\n props: Record<string, unknown>;\n group: string;\n html: typeof html;\n lang: string;\n href: string;\n data: TItem | null;\n next: TItem | null;\n ns: string;\n};\n\nexport type ItemRenderer<TItem extends HALJSONResource = HALJSONResource> = (\n ctx: ItemRendererContext<TItem>\n) => TemplateResult;\n"]}
@@ -58,7 +58,7 @@ export class CouponCard extends Base {
58
58
  `;
59
59
  }
60
60
  __renderTitle() {
61
- var _a, _b, _c, _d, _e;
61
+ var _a, _b, _c, _d, _e, _f;
62
62
  const count = (_b = (_a = this.data) === null || _a === void 0 ? void 0 : _a.number_of_uses_to_date) !== null && _b !== void 0 ? _b : 0;
63
63
  const total = (_d = (_c = this.data) === null || _c === void 0 ? void 0 : _c.number_of_uses_allowed) !== null && _d !== void 0 ? _d : 0;
64
64
  return html `
@@ -66,7 +66,7 @@ export class CouponCard extends Base {
66
66
  ${this.renderTemplateOrSlot('title:before')}
67
67
 
68
68
  <div class="flex items-center justify-between">
69
- <div class="font-semibold truncate">${(_e = this.data) === null || _e === void 0 ? void 0 : _e.name}</div>
69
+ <div class="font-semibold truncate">${(_f = (_e = this.data) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : html `&ZeroWidthSpace;`}</div>
70
70
 
71
71
  <foxy-i18n
72
72
  options=${JSON.stringify({ count, total })}
@@ -1 +1 @@
1
- {"version":3,"file":"CouponCard.js","sourceRoot":"","sources":["../../../../src/elements/public/CouponCard/CouponCard.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAClE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,MAAM,EAAE,GAAG,aAAa,CAAC;AACzB,MAAM,IAAI,GAAG,cAAc,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAEtF;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,UAAW,SAAQ,IAAU;IAA1C;;QACE,cAAS,GAAc,EAAE,CAAC;IA8G5B,CAAC;IA5GC,MAAM;;QACJ,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAE3C,OAAO,IAAI,CAAA;;oBAEK,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC;;;;qBAId,QAAQ,CAAC,EAAE,oBAAoB,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YAC1E,cAAc,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAA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,CAAC;;KAE9C,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { Data, Templates } from './types';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\n\nconst NS = 'coupon-card';\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Basic card displaying a coupon.\n *\n * @slot title:before\n * @slot title:after\n * @slot description:before\n * @slot description:after\n * @slot status:before\n * @slot status:after\n *\n * @element foxy-coupon-card\n * @since 1.15.0\n */\nexport class CouponCard extends Base<Data> {\n templates: Templates = {};\n\n render(): TemplateResult {\n const hiddenSelector = this.hiddenSelector;\n\n return html`\n <div\n aria-busy=${this.in('busy')}\n aria-live=\"polite\"\n class=\"relative leading-m font-lumo text-m\"\n >\n <div class=${classMap({ 'transition-opacity': true, 'opacity-0': !this.data })}>\n ${hiddenSelector.matches('title', true) ? '' : this.__renderTitle()}\n ${hiddenSelector.matches('description', true) ? '' : this.__renderDescription()}\n ${hiddenSelector.matches('status', true) ? '' : this.__renderStatus()}\n </div>\n\n <div\n class=${classMap({\n 'pointer-events-none absolute inset-0 flex transition-opacity': true,\n 'opacity-0': !!this.data,\n })}\n >\n <foxy-spinner\n data-testid=\"spinner\"\n state=${this.in('fail') ? 'error' : this.in({ idle: 'template' }) ? 'empty' : 'busy'}\n class=\"m-auto\"\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n private __renderTitle() {\n const count = this.data?.number_of_uses_to_date ?? 0;\n const total = this.data?.number_of_uses_allowed ?? 0;\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('title:before')}\n\n <div class=\"flex items-center justify-between\">\n <div class=\"font-semibold truncate\">${this.data?.name}</div>\n\n <foxy-i18n\n options=${JSON.stringify({ count, total })}\n class=\"text-tertiary text-s flex-shrink-0\"\n lang=${this.lang}\n key=${total === 0 ? 'uses_count' : 'uses_to_total_count'}\n ns=${this.ns}\n >\n </foxy-i18n>\n </div>\n\n ${this.renderTemplateOrSlot('title:after')}\n </div>\n `;\n }\n\n private __renderDescription() {\n let summary: TemplateResult | null = null;\n\n if (this.data) {\n const details = this.data.coupon_discount_details;\n const type = this.data.coupon_discount_type;\n\n summary = html`\n <foxy-i18n\n options=${JSON.stringify({ params: { details, type } })}\n lang=${this.lang}\n key=\"discount_summary\"\n ns=${this.ns}\n >\n </foxy-i18n>\n `;\n }\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('description:before')}\n <div class=\"truncate text-s text-secondary\">${summary ?? html`&ZeroWidthSpace;`}</div>\n ${this.renderTemplateOrSlot('description:after')}\n </div>\n `;\n }\n\n private __renderStatus() {\n const { start_date: start, end_date: end } = this.data ?? {};\n const type = start && end ? 'complete' : start ? 'from' : end ? 'until' : 'any';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('status:before')}\n\n <foxy-i18n\n options=${JSON.stringify({ start, end })}\n class=\"block truncate text-s text-tertiary\"\n lang=${this.lang}\n key=\"date_range_${type}\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('status:after')}\n </div>\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"CouponCard.js","sourceRoot":"","sources":["../../../../src/elements/public/CouponCard/CouponCard.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,cAAc,EAAE,4CAAyC;AAClE,OAAO,EAAE,cAAc,EAAE,qCAAkC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,wCAAqC;AACjE,OAAO,EAAE,QAAQ,EAAE,oCAAiC;AAEpD,MAA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AAoB,CAAC,mBAAmB,CAAC;;KAEnD,CAAC;IACJ,CAAC;IAEO,cAAc;;QACpB,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAG,IAAI,CAAC,IAAI,mCAAI,EAAE,CAAC;QAC7D,MAAM,IAAI,GAAG,KAAK,IAAI,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;QAEhF,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,oBAAoB,CAAC,eAAe,CAAC;;;oBAGhC,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;;iBAEjC,IAAI,CAAC,IAAI;4BACE,IAAI;eACjB,IAAI,CAAC,EAAE;;;;UAIZ,IAAI,CAAC,oBAAoB,CAAC,cAAc,CAAC;;KAE9C,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { Data, Templates } from './types';\nimport { TemplateResult, html } from 'lit-html';\n\nimport { ConfigurableMixin } from '../../../mixins/configurable';\nimport { NucleonElement } from '../NucleonElement/NucleonElement';\nimport { ThemeableMixin } from '../../../mixins/themeable';\nimport { TranslatableMixin } from '../../../mixins/translatable';\nimport { classMap } from '../../../utils/class-map';\n\nconst NS = 'coupon-card';\nconst Base = ThemeableMixin(ConfigurableMixin(TranslatableMixin(NucleonElement, NS)));\n\n/**\n * Basic card displaying a coupon.\n *\n * @slot title:before\n * @slot title:after\n * @slot description:before\n * @slot description:after\n * @slot status:before\n * @slot status:after\n *\n * @element foxy-coupon-card\n * @since 1.15.0\n */\nexport class CouponCard extends Base<Data> {\n templates: Templates = {};\n\n render(): TemplateResult {\n const hiddenSelector = this.hiddenSelector;\n\n return html`\n <div\n aria-busy=${this.in('busy')}\n aria-live=\"polite\"\n class=\"relative leading-m font-lumo text-m\"\n >\n <div class=${classMap({ 'transition-opacity': true, 'opacity-0': !this.data })}>\n ${hiddenSelector.matches('title', true) ? '' : this.__renderTitle()}\n ${hiddenSelector.matches('description', true) ? '' : this.__renderDescription()}\n ${hiddenSelector.matches('status', true) ? '' : this.__renderStatus()}\n </div>\n\n <div\n class=${classMap({\n 'pointer-events-none absolute inset-0 flex transition-opacity': true,\n 'opacity-0': !!this.data,\n })}\n >\n <foxy-spinner\n data-testid=\"spinner\"\n state=${this.in('fail') ? 'error' : this.in({ idle: 'template' }) ? 'empty' : 'busy'}\n class=\"m-auto\"\n lang=${this.lang}\n ns=\"${this.ns} ${customElements.get('foxy-spinner')?.defaultNS ?? ''}\"\n >\n </foxy-spinner>\n </div>\n </div>\n `;\n }\n\n private __renderTitle() {\n const count = this.data?.number_of_uses_to_date ?? 0;\n const total = this.data?.number_of_uses_allowed ?? 0;\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('title:before')}\n\n <div class=\"flex items-center justify-between\">\n <div class=\"font-semibold truncate\">${this.data?.name ?? html`&ZeroWidthSpace;`}</div>\n\n <foxy-i18n\n options=${JSON.stringify({ count, total })}\n class=\"text-tertiary text-s flex-shrink-0\"\n lang=${this.lang}\n key=${total === 0 ? 'uses_count' : 'uses_to_total_count'}\n ns=${this.ns}\n >\n </foxy-i18n>\n </div>\n\n ${this.renderTemplateOrSlot('title:after')}\n </div>\n `;\n }\n\n private __renderDescription() {\n let summary: TemplateResult | null = null;\n\n if (this.data) {\n const details = this.data.coupon_discount_details;\n const type = this.data.coupon_discount_type;\n\n summary = html`\n <foxy-i18n\n options=${JSON.stringify({ params: { details, type } })}\n lang=${this.lang}\n key=\"discount_summary\"\n ns=${this.ns}\n >\n </foxy-i18n>\n `;\n }\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('description:before')}\n <div class=\"truncate text-s text-secondary\">${summary ?? html`&ZeroWidthSpace;`}</div>\n ${this.renderTemplateOrSlot('description:after')}\n </div>\n `;\n }\n\n private __renderStatus() {\n const { start_date: start, end_date: end } = this.data ?? {};\n const type = start && end ? 'complete' : start ? 'from' : end ? 'until' : 'any';\n\n return html`\n <div>\n ${this.renderTemplateOrSlot('status:before')}\n\n <foxy-i18n\n options=${JSON.stringify({ start, end })}\n class=\"block truncate text-s text-tertiary\"\n lang=${this.lang}\n key=\"date_range_${type}\"\n ns=${this.ns}\n >\n </foxy-i18n>\n\n ${this.renderTemplateOrSlot('status:after')}\n </div>\n `;\n }\n}\n"]}
@@ -0,0 +1,26 @@
1
+ import { Data, Templates } from './types';
2
+ import { TemplateResult } from 'lit-html';
3
+ import { NucleonElement } from '../NucleonElement/NucleonElement';
4
+ declare const Base: typeof NucleonElement & import("lit-element").Constructor<import("../../../mixins/translatable").TranslatableMixinHost> & {
5
+ defaultNS: string;
6
+ } & import("lit-element").Constructor<import("../../../mixins/configurable").ConfigurableMixinHost> & {
7
+ styles: import("lit-element").CSSResultArray;
8
+ };
9
+ /**
10
+ * Basic card displaying a gift card.
11
+ *
12
+ * @slot title:before
13
+ * @slot title:after
14
+ * @slot status:before
15
+ * @slot status:after
16
+ *
17
+ * @element foxy-gift-card-card
18
+ * @since 1.15.0
19
+ */
20
+ export declare class GiftCardCard extends Base<Data> {
21
+ templates: Templates;
22
+ render(): TemplateResult;
23
+ private __renderTitle;
24
+ private __renderStatus;
25
+ }
26
+ export {};