@covet-pics/covet-pics-widget 0.174.1 → 0.174.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/cjs/covet-pics-checkbox_9.cjs.entry.js +140 -49
  2. package/dist/cjs/covet-pics-gallery-grid_7.cjs.entry.js +10 -10
  3. package/dist/cjs/covet-pics-gallery-header_3.cjs.entry.js +1 -1
  4. package/dist/cjs/covet-pics-highlighted-hotspots_2.cjs.entry.js +1 -1
  5. package/dist/cjs/covet-pics-widget.cjs.entry.js +2 -2
  6. package/dist/cjs/covet-pics-widget.cjs.js +1 -1
  7. package/dist/cjs/{getters-geTaYis0.js → getters-CyBn8UrZ.js} +14 -15
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/shopcart-DyUcCct4.js +372 -0
  10. package/dist/collection/components/covet-pics-direct-buy/covet-pics-direct-buy.js +22 -18
  11. package/dist/collection/components/covet-pics-direct-buy/test/test-data.js +318 -0
  12. package/dist/collection/components/covet-pics-popup/covet-pics-popup.js +8 -8
  13. package/dist/collection/components/covet-pics-shop-cart/covet-pics-shop-cart.js +36 -34
  14. package/dist/collection/components/covet-pics-shop-cart/test/test-data.js +78 -298
  15. package/dist/collection/services/shopifyAjaxCart.js +33 -0
  16. package/dist/collection/store/getters.js +11 -12
  17. package/dist/collection/store/shopcart.js +109 -138
  18. package/dist/collection/utils/normalize.js +3 -2
  19. package/dist/collection/utils/normalizeAjaxCart.js +35 -0
  20. package/dist/covet-pics-widget/covet-pics-widget.esm.js +1 -1
  21. package/dist/covet-pics-widget/{p-a11d8071.entry.js → p-0db43ad2.entry.js} +1 -1
  22. package/dist/covet-pics-widget/{p-5e262356.entry.js → p-12c8756e.entry.js} +1 -1
  23. package/dist/covet-pics-widget/{p-0c12d4b1.entry.js → p-408dfc96.entry.js} +1 -1
  24. package/dist/covet-pics-widget/p-51c785fd.entry.js +4 -0
  25. package/dist/covet-pics-widget/p-BYVCq0H2.js +4 -0
  26. package/dist/covet-pics-widget/p-C5d8fbcq.js +4 -0
  27. package/dist/covet-pics-widget/{p-40ac4429.entry.js → p-e1f76732.entry.js} +2 -2
  28. package/dist/esm/covet-pics-checkbox_9.entry.js +140 -49
  29. package/dist/esm/covet-pics-gallery-grid_7.entry.js +10 -10
  30. package/dist/esm/covet-pics-gallery-header_3.entry.js +1 -1
  31. package/dist/esm/covet-pics-highlighted-hotspots_2.entry.js +1 -1
  32. package/dist/esm/covet-pics-widget.entry.js +2 -2
  33. package/dist/esm/covet-pics-widget.js +1 -1
  34. package/dist/esm/{getters-rjAUHjUz.js → getters-DdnjbzQ7.js} +12 -13
  35. package/dist/esm/loader.js +1 -1
  36. package/dist/esm/shopcart-CrfvBTez.js +356 -0
  37. package/dist/types/components/covet-pics-direct-buy/test/test-data.d.ts +137 -0
  38. package/dist/types/components/covet-pics-shop-cart/covet-pics-shop-cart.d.ts +4 -3
  39. package/dist/types/components/covet-pics-shop-cart/test/test-data.d.ts +76 -264
  40. package/dist/types/services/shopifyAjaxCart.d.ts +2 -0
  41. package/dist/types/store/getters.d.ts +3 -87
  42. package/dist/types/store/shopcart.d.ts +29 -111
  43. package/dist/types/utils/normalize.d.ts +3 -0
  44. package/dist/types/utils/normalizeAjaxCart.d.ts +10 -0
  45. package/dist/types/utils/types.d.ts +43 -23
  46. package/package.json +1 -1
  47. package/dist/cjs/shopcart-C3zF26Oh.js +0 -624
  48. package/dist/covet-pics-widget/p-90981c0c.entry.js +0 -4
  49. package/dist/covet-pics-widget/p-CcyIWWuL.js +0 -4
  50. package/dist/covet-pics-widget/p-DrqdZ001.js +0 -4
  51. package/dist/esm/shopcart-3E2wHq9_.js +0 -606
@@ -6,8 +6,8 @@
6
6
  var index = require('./index-C5a8iHmi.js');
7
7
  var utils = require('./utils-DVZVIghB.js');
8
8
  var popup = require('./popup-BgupOeY7.js');
9
- var shopcart = require('./shopcart-C3zF26Oh.js');
10
- var getters = require('./getters-geTaYis0.js');
9
+ var shopcart = require('./shopcart-DyUcCct4.js');
10
+ var getters = require('./getters-CyBn8UrZ.js');
11
11
  var storeUtils = require('./storeUtils-sFXfLcFp.js');
12
12
  var funcComponents = require('./funcComponents-CKK6ULzk.js');
13
13
  var index$1 = require('./index-BMdsVEom.js');
@@ -57,6 +57,91 @@ const CovetPicsCheckbox = class {
57
57
  };
58
58
  CovetPicsCheckbox.style = covetPicsCheckboxCss;
59
59
 
60
+ // fileds can be add
61
+ // - collections (A list of collections that include the product.)
62
+ // - compareAtPriceRange
63
+ // - media (The media that are associated with the product. Valid media are images, 3D models, videos.)
64
+ // - priceRange
65
+ // - productType
66
+ const shopifyGraphqlFetch = async (endpoint, query, variables) => {
67
+ try {
68
+ const response = await fetch(endpoint, {
69
+ method: "POST",
70
+ headers: {
71
+ Accept: "application/json",
72
+ "Content-Type": "application/json",
73
+ "Shopify-Storefront-Private-Token": "", // An empty Shopify-Storefront-Private-Token enables tokenless access (limit: 1000). https://shopify.dev/docs/api/storefront/latest#authentication
74
+ },
75
+ body: JSON.stringify({ query, variables }),
76
+ });
77
+ if (!response.ok)
78
+ throw new Error(`HTTP ${response.status} ${response.statusText} (${response.url})`);
79
+ const result = await response.json();
80
+ if (result.errors && result.errors.length > 0) {
81
+ return [result.errors[0], null];
82
+ }
83
+ return [null, result];
84
+ }
85
+ catch (error) {
86
+ const err = error instanceof Error ? error : new Error(String(error));
87
+ return [err, null];
88
+ }
89
+ };
90
+ const queryProductForVariantSelector = `
91
+ query ProductForVariantSelector(
92
+ $handle: String!,
93
+ $selectedOptions: [SelectedOptionInput!],
94
+ $country: CountryCode!,
95
+ $language: LanguageCode!
96
+ )
97
+ @inContext(country: $country, language: $language) {
98
+ product(handle: $handle) {
99
+ id
100
+ title
101
+ handle
102
+ onlineStoreUrl
103
+ images(first: 100) {
104
+ nodes {
105
+ id
106
+ url
107
+ altText
108
+ }
109
+ }
110
+ selectedOrFirstAvailableVariant(
111
+ selectedOptions: $selectedOptions,
112
+ ignoreUnknownOptions: true,
113
+ caseInsensitiveMatch: true
114
+ ) {
115
+ id
116
+ availableForSale
117
+ image { url altText }
118
+ price { amount currencyCode }
119
+ selectedOptions { name value }
120
+ }
121
+ options {
122
+ name
123
+ optionValues {
124
+ name
125
+ swatch {
126
+ color
127
+ image { previewImage { url } }
128
+ }
129
+ }
130
+ }
131
+
132
+ variants(first: 250) {
133
+ nodes {
134
+ availableForSale
135
+ selectedOptions {
136
+ name
137
+ value
138
+ }
139
+ }
140
+ }
141
+ }
142
+ }
143
+ `;
144
+
60
145
  const covetPicsDirectBuyCss = "@font-face{font-family:\"swiper-icons\";src:url(\"data:application/font-woff;charset=utf-8;base64, d09GRgABAAAAAAZgABAAAAAADAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAGRAAAABoAAAAci6qHkUdERUYAAAWgAAAAIwAAACQAYABXR1BPUwAABhQAAAAuAAAANuAY7+xHU1VCAAAFxAAAAFAAAABm2fPczU9TLzIAAAHcAAAASgAAAGBP9V5RY21hcAAAAkQAAACIAAABYt6F0cBjdnQgAAACzAAAAAQAAAAEABEBRGdhc3AAAAWYAAAACAAAAAj//wADZ2x5ZgAAAywAAADMAAAD2MHtryVoZWFkAAABbAAAADAAAAA2E2+eoWhoZWEAAAGcAAAAHwAAACQC9gDzaG10eAAAAigAAAAZAAAArgJkABFsb2NhAAAC0AAAAFoAAABaFQAUGG1heHAAAAG8AAAAHwAAACAAcABAbmFtZQAAA/gAAAE5AAACXvFdBwlwb3N0AAAFNAAAAGIAAACE5s74hXjaY2BkYGAAYpf5Hu/j+W2+MnAzMYDAzaX6QjD6/4//Bxj5GA8AuRwMYGkAPywL13jaY2BkYGA88P8Agx4j+/8fQDYfA1AEBWgDAIB2BOoAeNpjYGRgYNBh4GdgYgABEMnIABJzYNADCQAACWgAsQB42mNgYfzCOIGBlYGB0YcxjYGBwR1Kf2WQZGhhYGBiYGVmgAFGBiQQkOaawtDAoMBQxXjg/wEGPcYDDA4wNUA2CCgwsAAAO4EL6gAAeNpj2M0gyAACqxgGNWBkZ2D4/wMA+xkDdgAAAHjaY2BgYGaAYBkGRgYQiAHyGMF8FgYHIM3DwMHABGQrMOgyWDLEM1T9/w8UBfEMgLzE////P/5//f/V/xv+r4eaAAeMbAxwIUYmIMHEgKYAYjUcsDAwsLKxc3BycfPw8jEQA/gZBASFhEVExcQlJKWkZWTl5BUUlZRVVNXUNTQZBgMAAMR+E+gAEQFEAAAAKgAqACoANAA+AEgAUgBcAGYAcAB6AIQAjgCYAKIArAC2AMAAygDUAN4A6ADyAPwBBgEQARoBJAEuATgBQgFMAVYBYAFqAXQBfgGIAZIBnAGmAbIBzgHsAAB42u2NMQ6CUAyGW568x9AneYYgm4MJbhKFaExIOAVX8ApewSt4Bic4AfeAid3VOBixDxfPYEza5O+Xfi04YADggiUIULCuEJK8VhO4bSvpdnktHI5QCYtdi2sl8ZnXaHlqUrNKzdKcT8cjlq+rwZSvIVczNiezsfnP/uznmfPFBNODM2K7MTQ45YEAZqGP81AmGGcF3iPqOop0r1SPTaTbVkfUe4HXj97wYE+yNwWYxwWu4v1ugWHgo3S1XdZEVqWM7ET0cfnLGxWfkgR42o2PvWrDMBSFj/IHLaF0zKjRgdiVMwScNRAoWUoH78Y2icB/yIY09An6AH2Bdu/UB+yxopYshQiEvnvu0dURgDt8QeC8PDw7Fpji3fEA4z/PEJ6YOB5hKh4dj3EvXhxPqH/SKUY3rJ7srZ4FZnh1PMAtPhwP6fl2PMJMPDgeQ4rY8YT6Gzao0eAEA409DuggmTnFnOcSCiEiLMgxCiTI6Cq5DZUd3Qmp10vO0LaLTd2cjN4fOumlc7lUYbSQcZFkutRG7g6JKZKy0RmdLY680CDnEJ+UMkpFFe1RN7nxdVpXrC4aTtnaurOnYercZg2YVmLN/d/gczfEimrE/fs/bOuq29Zmn8tloORaXgZgGa78yO9/cnXm2BpaGvq25Dv9S4E9+5SIc9PqupJKhYFSSl47+Qcr1mYNAAAAeNptw0cKwkAAAMDZJA8Q7OUJvkLsPfZ6zFVERPy8qHh2YER+3i/BP83vIBLLySsoKimrqKqpa2hp6+jq6RsYGhmbmJqZSy0sraxtbO3sHRydnEMU4uR6yx7JJXveP7WrDycAAAAAAAH//wACeNpjYGRgYOABYhkgZgJCZgZNBkYGLQZtIJsFLMYAAAw3ALgAeNolizEKgDAQBCchRbC2sFER0YD6qVQiBCv/H9ezGI6Z5XBAw8CBK/m5iQQVauVbXLnOrMZv2oLdKFa8Pjuru2hJzGabmOSLzNMzvutpB3N42mNgZGBg4GKQYzBhYMxJLMlj4GBgAYow/P/PAJJhLM6sSoWKfWCAAwDAjgbRAAB42mNgYGBkAIIbCZo5IPrmUn0hGA0AO8EFTQAA\") format(\"woff\");font-weight:400;font-style:normal}:root{--swiper-theme-color:#007aff;}:host{position:relative;display:block;margin-left:auto;margin-right:auto;z-index:1}.swiper{margin-left:auto;margin-right:auto;position:relative;overflow:hidden;list-style:none;padding:0;z-index:1;display:block}.swiper-vertical>.swiper-wrapper{flex-direction:column}.swiper-wrapper{position:relative;width:100%;height:100%;z-index:1;display:flex;transition-property:transform;transition-timing-function:var(--swiper-wrapper-transition-timing-function, initial);box-sizing:content-box}.swiper-android .swiper-slide,.swiper-ios .swiper-slide,.swiper-wrapper{transform:translate3d(0px, 0, 0)}.swiper-horizontal{touch-action:pan-y}.swiper-vertical{touch-action:pan-x}.swiper-slide{flex-shrink:0;width:100%;height:100%;position:relative;transition-property:transform;display:block}.swiper-slide-invisible-blank{visibility:hidden}.swiper-autoheight,.swiper-autoheight .swiper-slide{height:auto}.swiper-autoheight .swiper-wrapper{align-items:flex-start;transition-property:transform, height}.swiper-backface-hidden .swiper-slide{transform:translateZ(0);backface-visibility:hidden}.swiper-3d.swiper-css-mode .swiper-wrapper{perspective:1200px}.swiper-3d .swiper-wrapper{transform-style:preserve-3d}.swiper-3d{perspective:1200px}.swiper-3d .swiper-slide,.swiper-3d .swiper-cube-shadow{transform-style:preserve-3d}.swiper-css-mode>.swiper-wrapper{overflow:auto;scrollbar-width:none;-ms-overflow-style:none;}.swiper-css-mode>.swiper-wrapper::-webkit-scrollbar{display:none}.swiper-css-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:start start}.swiper-css-mode.swiper-horizontal>.swiper-wrapper{scroll-snap-type:x mandatory}.swiper-css-mode.swiper-vertical>.swiper-wrapper{scroll-snap-type:y mandatory}.swiper-css-mode.swiper-free-mode>.swiper-wrapper{scroll-snap-type:none}.swiper-css-mode.swiper-free-mode>.swiper-wrapper>.swiper-slide{scroll-snap-align:none}.swiper-css-mode.swiper-centered>.swiper-wrapper::before{content:\"\";flex-shrink:0;order:9999}.swiper-css-mode.swiper-centered>.swiper-wrapper>.swiper-slide{scroll-snap-align:center center;scroll-snap-stop:always}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper>.swiper-slide:first-child{margin-inline-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-horizontal>.swiper-wrapper::before{height:100%;min-height:1px;width:var(--swiper-centered-offset-after)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper>.swiper-slide:first-child{margin-block-start:var(--swiper-centered-offset-before)}.swiper-css-mode.swiper-centered.swiper-vertical>.swiper-wrapper::before{width:100%;min-width:1px;height:var(--swiper-centered-offset-after)}.swiper-3d .swiper-slide-shadow,.swiper-3d .swiper-slide-shadow-left,.swiper-3d .swiper-slide-shadow-right,.swiper-3d .swiper-slide-shadow-top,.swiper-3d .swiper-slide-shadow-bottom{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none;z-index:10}.swiper-3d .swiper-slide-shadow{background:rgba(0, 0, 0, 0.15)}.swiper-3d .swiper-slide-shadow-left{background-image:linear-gradient(to left, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-right{background-image:linear-gradient(to right, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-top{background-image:linear-gradient(to top, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-3d .swiper-slide-shadow-bottom{background-image:linear-gradient(to bottom, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0))}.swiper-lazy-preloader{width:42px;height:42px;position:absolute;left:50%;top:50%;margin-left:-21px;margin-top:-21px;z-index:10;transform-origin:50%;box-sizing:border-box;border:4px solid var(--swiper-preloader-color, var(--swiper-theme-color));border-radius:50%;border-top-color:transparent}.swiper:not(.swiper-watch-progress) .swiper-lazy-preloader,.swiper-watch-progress .swiper-slide-visible .swiper-lazy-preloader{animation:swiper-preloader-spin 1s infinite linear}.swiper-lazy-preloader-white{--swiper-preloader-color:#fff}.swiper-lazy-preloader-black{--swiper-preloader-color:#000}@keyframes swiper-preloader-spin{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}covet-pics-direct-buy{z-index:1;--covet-direct-buy-btn-size:40px;--covet-direct-buy-padding-size:40px;--covet-direct-buy-dropdown-height:48px;--covet-direct-buy-font-color:#101010;--covet-direct-buy-bg-color:#fcfbfc;--covet-direct-buy-btn-color:var(--covet-internal-direct-buy-btn-color);--covet-direct-buy-btn-bg-color:var(--covet-internal-direct-buy-btn-bg-color);--covet-direct-buy-btn-active-color:var(--covet-internal-direct-buy-btn-active-color);--covet-direct-buy-btn-active-bg-color:var(--covet-internal-direct-buy-btn-active-bg-color);--covet-direct-buy-close-color:#A0A0A0;bottom:0;top:0;width:100%;box-shadow:0 -8px 16px 0 rgba(0, 0, 0, 0.05);transition:max-height 0.35s ease-in-out;min-width:auto;background-color:#ffffff;position:absolute;flex:1 1 auto;min-height:0;display:flex;box-sizing:border-box;overflow:hidden;z-index:1}@media only screen and (max-width: 799.98px){covet-pics-direct-buy{z-index:0;position:fixed;left:0;right:0}}covet-pics-direct-buy .wrap{position:absolute;left:0;top:0;right:0;bottom:0;padding-bottom:80px;overflow:hidden;box-sizing:border-box}covet-pics-direct-buy .main{overflow-y:auto;min-height:0;height:100%;padding-left:var(--covet-direct-buy-padding-size);padding-right:var(--covet-direct-buy-padding-size)}covet-pics-direct-buy .close{background:none;border:none;position:absolute;top:0;left:0;right:auto;transform:auto;padding:0;margin:0;cursor:pointer;outline:none !important;z-index:1}@media only screen and (max-width: 799.98px){covet-pics-direct-buy .close{transform:rotate(270deg);right:0;left:auto;top:50px}}covet-pics-direct-buy .close:hover svg .icon-arrow-path,covet-pics-direct-buy .close:active svg .icon-arrow-path,covet-pics-direct-buy .close:focus svg .icon-arrow-path{stroke:#000000}covet-pics-direct-buy .close .icon-close{width:var(--covet-direct-buy-btn-size);height:var(--covet-direct-buy-btn-size)}covet-pics-direct-buy .close .icon-close .icon-arrow-path{transition:all 0.25s ease}covet-pics-direct-buy .title{font-size:14px;font-weight:400;line-height:var(--covet-direct-buy-btn-size);width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:center;box-sizing:border-box;margin:10px 0 0 0;padding-left:10px}@media only screen and (max-width: 799.98px){covet-pics-direct-buy .title{width:calc(100% - var(--covet-direct-buy-btn-size));padding-left:0;z-index:0}}covet-pics-direct-buy .link-title{text-decoration:none;color:var(--covet-direct-buy-font-color)}covet-pics-direct-buy .product-slider{display:block;overflow:hidden;padding:var(--covet-internal-direct-buy-slide-margin);margin-bottom:var(--covet-internal-direct-buy-slide-margin);border-bottom:1px solid var(--covet-direct-buy-font-color)}covet-pics-direct-buy .product-slider-wrap{display:flex;position:relative;left:0;transition:transform var(--covet-internal-direct-buy-slider-speed) ease;gap:var(--covet-internal-direct-buy-slide-margin)}covet-pics-direct-buy .gallery-slide{box-sizing:border-box;width:var(--covet-internal-direct-buy-slide-width);height:var(--covet-internal-direct-buy-slide-width);flex:none;overflow:hidden;cursor:pointer}covet-pics-direct-buy .image{-o-object-fit:cover;object-fit:cover;width:100%}covet-pics-direct-buy .product-preview{display:block;width:200px;height:200px;position:relative;margin-left:auto;margin-right:auto;overflow:hidden;margin-bottom:20px}@media only screen and (max-width: 799.98px){covet-pics-direct-buy .product-preview{width:150px;height:150px}}covet-pics-direct-buy .preview-slide{width:100%;height:100%;position:absolute;opacity:0;transform-origin:center center;transform:scale(0.95);transition:all 0.25s ease}covet-pics-direct-buy .preview-slide.active{opacity:1;transform:scale(1)}covet-pics-direct-buy .checkbox-group{display:flex;flex-wrap:wrap;padding:0;border:none;margin-bottom:10px;overflow:hidden;max-width:100%;max-width:100%;min-width:0;min-inline-size:0;box-sizing:border-box;gap:8px}covet-pics-direct-buy .footer{background-color:var(--covet-direct-buy-bg-color);position:absolute;width:100%;bottom:0;left:0;right:0;z-index:1}covet-pics-direct-buy .price-wrap{display:flex;height:32px;background:var(--covet-direct-buy-bg-color);justify-content:space-between;align-items:center;text-transform:uppercase;padding:0 var(--covet-direct-buy-padding-size);width:calc(100% - var(--covet-direct-buy-padding-size) * 2)}covet-pics-direct-buy .price-label{color:var(--covet-direct-buy-font-color);font-weight:300;max-width:80px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}covet-pics-direct-buy .price-text{font-weight:600}covet-pics-direct-buy .btn-buy{border:none;background-color:var(--covet-direct-buy-btn-bg-color);color:var(--covet-direct-buy-btn-color);font-family:inherit;display:flex;align-items:center;justify-content:center;width:100%;text-transform:uppercase;text-align:center;cursor:pointer;font-size:14px;line-height:1;padding:17px 17px max(17px, env(safe-area-inset-bottom, 25px)) 17px;margin-bottom:0}covet-pics-direct-buy .btn-buy:hover,covet-pics-direct-buy .btn-buy:active,covet-pics-direct-buy .btn-buy:focus{background-color:var(--covet-direct-buy-btn-active-bg-color)}covet-pics-direct-buy .btn-buy.style-1:hover,covet-pics-direct-buy .btn-buy.style-1:active,covet-pics-direct-buy .btn-buy.style-1:focus{background-color:var(--covet-direct-buy-btn-active-color)}covet-pics-direct-buy .btn-buy.style-2:hover,covet-pics-direct-buy .btn-buy.style-2:active,covet-pics-direct-buy .btn-buy.style-2:focus{background-color:var(--covet-direct-buy-btn-bg-color);color:var(--covet-direct-buy-btn-active-color)}covet-pics-direct-buy .btn-buy:disabled{background:#eeeeee;color:#808080;pointer-events:none}covet-pics-direct-buy .btn-buy.btn-now{margin-top:10px}.popup-product-animation{top:0;left:0;width:var(--covet-pics-popup-product-clone-begin-width);height:var(--covet-pics-popup-product-clone-begin-height);transform:translate(var(--covet-pics-popup-product-clone-begin-x), var(--covet-pics-popup-product-clone-begin-y));display:flex;justify-content:center;align-items:center;z-index:10;position:fixed;background-color:#ffffff;overflow:hidden;will-change:transform;transform:translate(var(--covet-pics-popup-product-clone-begin-x), var(--covet-pics-popup-product-clone-begin-y))}.popup-product-animation img{max-width:100%;max-height:100%}.popup-product-animation.animate{animation:parabolic-move 1s ease forwards}@keyframes parabolic-move{0%{transform:translate(var(--covet-pics-popup-product-clone-begin-x), var(--covet-pics-popup-product-clone-begin-y))}10%{border-radius:50%}50%{opacity:0.9;width:var(--covet-pics-popup-product-clone-end-width);height:var(--covet-pics-popup-product-clone-end-height)}80%{opacity:0.9}90%{opacity:0.5}100%{opacity:0;transform:translate(var(--covet-pics-popup-product-clone-end-x), var(--covet-pics-popup-product-clone-end-y));width:var(--covet-pics-popup-product-clone-end-width);height:var(--covet-pics-popup-product-clone-end-height);border-radius:50%}}";
61
146
 
62
147
  const CovetPicsDirectBuy = class {
@@ -141,7 +226,6 @@ const CovetPicsDirectBuy = class {
141
226
  }
142
227
  disconnectedCallback() {
143
228
  this.unsubscribe();
144
- this.shopCart.remove();
145
229
  }
146
230
  async getData() {
147
231
  var _a;
@@ -151,7 +235,7 @@ const CovetPicsDirectBuy = class {
151
235
  language: this.shopCartState.locale.language.toUpperCase(),
152
236
  selectedOptions: this.selectedOptions
153
237
  };
154
- const [err, result] = await shopcart.shopifyGraphqlFetch(this.shopCartState.config.apiUrl, shopcart.queryProductForVariantSelector, variables);
238
+ const [err, result] = await shopifyGraphqlFetch(this.shopCartState.apiUrl, queryProductForVariantSelector, variables);
155
239
  if (err) {
156
240
  return this.appStore.dispatch(shopcart.showNotification({ message: err.message, type: "error" }));
157
241
  }
@@ -170,12 +254,14 @@ const CovetPicsDirectBuy = class {
170
254
  document.body.appendChild(this.shopCart);
171
255
  }
172
256
  setupShopifySettings() {
257
+ var _a;
173
258
  const shopify = window.Shopify;
174
259
  if (typeof shopify !== "undefined") {
175
260
  this.appStore.dispatch(shopcart.setLocale({
176
261
  country: shopify.country,
177
262
  language: shopify.locale
178
263
  }));
264
+ this.appStore.dispatch(shopcart.setCartRouteRoot(((_a = shopify.routes) === null || _a === void 0 ? void 0 : _a.root) || "/"));
179
265
  this.appStore.dispatch(shopcart.setStoreDomain(utils.getShopUrlFromProductLink(shopify.shop)));
180
266
  }
181
267
  else {
@@ -184,13 +270,7 @@ const CovetPicsDirectBuy = class {
184
270
  }
185
271
  }
186
272
  async checkShopCart() {
187
- if (!this.appState.shopcart.id) {
188
- await this.appStore.dispatch(shopcart.getCartId());
189
- if (!this.appState.shopcart.id)
190
- return;
191
- }
192
273
  await this.appStore.dispatch(shopcart.loadCart());
193
- return this.appStore.dispatch(shopcart.updateBuyerIdentity());
194
274
  }
195
275
  checkIsAvailableForSale() {
196
276
  if (this.shopCartState.error !== null)
@@ -258,11 +338,20 @@ const CovetPicsDirectBuy = class {
258
338
  sliderWrap.style.transform = `translateX(-${deltaX}px)`;
259
339
  }
260
340
  async addToCart() {
261
- const shopcartTotalQuantity = this.appState.shopcart.totalQuantity;
262
- const result = await this.appStore.dispatch(shopcart.addToCart(this.selectedVariant.id));
341
+ var _a;
342
+ const shopcartTotalQuantity = this.appState.shopcart.item_count;
343
+ const variantId = Number(this.selectedVariant.id.split("/").pop());
344
+ if (!shopcart.isValidVariantId(variantId)) {
345
+ this.appStore.dispatch(shopcart.showNotification({ message: "Invalid product variant", type: "error" }));
346
+ return;
347
+ }
348
+ const result = await this.appStore.dispatch(shopcart.addToCart(variantId));
349
+ if (result.type === "shopcart/addToCart/rejected" && ((_a = result.payload) === null || _a === void 0 ? void 0 : _a.isNotAvailable)) {
350
+ this.isAvailableForSale = false;
351
+ return;
352
+ }
263
353
  if (result.type === "shopcart/addToCart/fulfilled") {
264
- // Use the API result to prevent race conditions caused by multiple clicks.
265
- if (result.payload.totalQuantity === shopcartTotalQuantity) {
354
+ if (result.payload.item_count === shopcartTotalQuantity) {
266
355
  this.appStore.dispatch(shopcart.showNotification({ message: "this product is out of stock", type: "info" }));
267
356
  this.isAvailableForSale = false;
268
357
  }
@@ -306,16 +395,16 @@ const CovetPicsDirectBuy = class {
306
395
  }
307
396
  render() {
308
397
  var _a, _b, _c;
309
- return (index.h(index.Host, { key: 'a719e442f1881b485589ec7bceee199dac824813', style: this.itemCSSVariables }, index.h("button", { key: '471c94dc501ec2dca86c99812de121ded3e689e4', class: "close", onClick: this.closeClickHandler, tabindex: "0", "aria-label": "Direct buy close", type: "button" }, index.h(funcComponents.IconDirectBuyClose, { key: '3bdd6c55a5f5e064bbb15471a98e624fdce029d9', iconClass: "icon-close" })), index.h("div", { key: '99e9e7c94b49b10c21cac349c51aaa32bfed8b9a', class: "wrap" }, this.product && (index.h("div", { key: 'd2f46fa9b8335e770caabdd433c40e9577a76839', class: "main" }, index.h("h2", { key: '4a8c90698a4bce4803c18873f053238dd3c6ed4c', class: "title" }, index.h("a", { key: 'c08b932d3ec51d844fafcd2a7ca1b36bc4856c62', class: "link-title", href: this.product.onlineStoreUrl, target: "_blank", "aria-label": `Link to '${this.product.title}'` }, this.product.title)), index.h("div", { key: 'e2129a48f3f910e775e07bc7302f48184f7f72d4', class: "product-preview" }, index.h("div", { key: '7f29a02fc54a440c07f4bdef10493fc969e1e05d', class: "preview-slide active" }, ((_a = this.selectedVariant) === null || _a === void 0 ? void 0 : _a.image)
398
+ return (index.h(index.Host, { key: '8ec220bedde77ded1d5a5a43d2ed692b1d033005', style: this.itemCSSVariables }, index.h("button", { key: '2ed72d85ef8cf498e847d6a44f40a0e4aecfecfe', class: "close", onClick: this.closeClickHandler, tabindex: "0", "aria-label": "Direct buy close", type: "button" }, index.h(funcComponents.IconDirectBuyClose, { key: 'e803845c722ce8a86cfb697c147f3a2163394f3b', iconClass: "icon-close" })), index.h("div", { key: '3a906991e072b8af8b2c97945bd348639aa563e5', class: "wrap" }, this.product && (index.h("div", { key: '108caeceee1b52696be21e93fd0958b1f5ab9e55', class: "main" }, index.h("h2", { key: '923c78cf6c31bbf3ff3195973704807a76de526b', class: "title" }, index.h("a", { key: '6c867a44bdc7d774ca19563c4f77164552db051c', class: "link-title", href: this.product.onlineStoreUrl, target: "_blank", "aria-label": `Link to '${this.product.title}'` }, this.product.title)), index.h("div", { key: '28e5fcc0251f97da79d239ee6e7d30c29f157363', class: "product-preview" }, index.h("div", { key: '6fe73de21ba59bb24792494b3bf4c88042f41bc1', class: "preview-slide active" }, ((_a = this.selectedVariant) === null || _a === void 0 ? void 0 : _a.image)
310
399
  ? index.h("img", { src: this.selectedVariant.image.url, alt: this.selectedVariant.image.altText, class: "image" })
311
400
  : index.h("img", { src: (_b = this.product.images.nodes[0]) === null || _b === void 0 ? void 0 : _b.url, alt: (_c = this.product.images.nodes[0]) === null || _c === void 0 ? void 0 : _c.altText, class: "image" }))), this.renderProductSlider(), this.selectedVariant &&
312
- index.h("div", { key: '276e8c041f0894b81cbd1779cc36c3f0ac63e1f8', class: "options" }, this.options.map((option) => {
401
+ index.h("div", { key: '79c0280b9ebb5ae19e8dfdb2f2eaff51c366e0a9', class: "options" }, this.options.map((option) => {
313
402
  if (option.optionValues.length < 2)
314
403
  return null;
315
404
  return option.optionValues.length < 4 ? this.renderCheckbox(option) : this.renderSelect(option);
316
405
  })))), this.product &&
317
- index.h("div", { key: 'a696bf62b2285320daac5c6448eaf62d291bf0fc', class: "footer" }, this.selectedVariant &&
318
- index.h("div", { key: '19bd18039d76a9466c490a4834f3451b620e3df7', class: "price-wrap" }, index.h("label", { key: 'b06d8ce7ffc7f9be1e0a2673e4d7b05956b45017', class: "price-label" }, this.settings.price_label_caption), index.h("p", { key: '7f209b9b875f863340da646da4a831d53bfb6f7c', class: "price-text" }, utils.formatMoneyNew(this.selectedVariant.price, `${this.shopCartState.locale.language}-${this.shopCartState.locale.country}`))), index.h("button", { key: 'f0e803d96d8ff4672226cd7ce543019701f66eb2', onClick: this.addToCartClickHandler, class: `btn-buy btn-add-to-cart ${this.settings._buyButtonStyle}`, "aria-label": "Add to cart", innerHTML: this.selectedVariant ? this.settings.add_to_cart_button_caption : "out of stock", disabled: !this.isAvailableForSale || !this.selectedVariant, type: "button" })))));
406
+ index.h("div", { key: 'b3c11a4be250f891af791ddb864067846073a35f', class: "footer" }, this.selectedVariant &&
407
+ index.h("div", { key: '7f82adde65d21c331e3e8acfd23b8112ecb76258', class: "price-wrap" }, index.h("label", { key: 'fd8e444e26bf088b88e9ae11b5c885ae4a1f1c0d', class: "price-label" }, this.settings.price_label_caption), index.h("p", { key: 'fbbad09e9703fbd2a3c429a0dd6688c1f19d9862', class: "price-text" }, utils.formatMoneyNew(this.selectedVariant.price, `${this.shopCartState.locale.language}-${this.shopCartState.locale.country}`))), index.h("button", { key: '27fd456324f394ee7ee1f81965c9103870221fdb', onClick: this.addToCartClickHandler, class: `btn-buy btn-add-to-cart ${this.settings._buyButtonStyle}`, "aria-label": "Add to cart", innerHTML: this.selectedVariant ? this.settings.add_to_cart_button_caption : "out of stock", disabled: !this.isAvailableForSale || !this.selectedVariant, type: "button" })))));
319
408
  }
320
409
  get el() { return index.getElement(this); }
321
410
  };
@@ -4080,6 +4169,8 @@ const CovetPicsShopCart = class {
4080
4169
  index.registerInstance(this, hostRef);
4081
4170
  this.isCartVisible = false;
4082
4171
  this.totalQuantity = 0;
4172
+ this.notAvaliableForSaleKeys = [];
4173
+ this.lineUpdatePending = null;
4083
4174
  this.closeShopCart = (event) => {
4084
4175
  event.preventDefault();
4085
4176
  event.stopPropagation();
@@ -4090,28 +4181,27 @@ const CovetPicsShopCart = class {
4090
4181
  event.stopPropagation();
4091
4182
  const btn = event.currentTarget;
4092
4183
  const lineId = btn.dataset.lineId;
4093
- this.appStore.dispatch(shopcart.removeLine({
4094
- lineId: lineId
4095
- }));
4184
+ this.appStore.dispatch(shopcart.removeLine(lineId));
4096
4185
  };
4097
- this.onUpdateLine = async (event) => {
4186
+ this.onUpdateLine = (event) => {
4187
+ var _a;
4098
4188
  event.preventDefault();
4099
4189
  event.stopPropagation();
4100
4190
  const btn = event.currentTarget;
4101
- const totalQuantityBeforeUpdate = this.appState.shopcart.totalQuantity;
4102
- const lineQuantity = parseInt(btn.dataset.lineQuantity);
4103
4191
  const lineId = btn.dataset.lineId;
4104
- await this.appStore.dispatch(shopcart.updateLine({
4105
- lineId: lineId,
4106
- lineQuantity: lineQuantity
4107
- }));
4108
- if (btn.dataset.action === "add" && totalQuantityBeforeUpdate === this.appState.shopcart.totalQuantity) {
4109
- btn.setAttribute("disabled", "true");
4110
- }
4111
- else {
4112
- const btnAdd = btn.closest('.change-count').querySelector('.btn-update[data-action="add"]');
4113
- btnAdd.removeAttribute("disabled");
4114
- }
4192
+ const delta = btn.dataset.action === "add" ? 1 : -1;
4193
+ if (this.lineUpdatePending)
4194
+ clearTimeout(this.lineUpdatePending.timer);
4195
+ const quantity = Math.max(0, ((_a = this.lineUpdatePending) === null || _a === void 0 ? void 0 : _a.lineId) === lineId
4196
+ ? this.lineUpdatePending.quantity + delta
4197
+ : Number(btn.dataset.lineQuantity));
4198
+ this.lineUpdatePending = {
4199
+ lineId, quantity,
4200
+ timer: setTimeout(() => {
4201
+ this.appStore.dispatch(shopcart.updateLine({ lineKey: lineId, quantity }));
4202
+ this.lineUpdatePending = null;
4203
+ }, 300),
4204
+ };
4115
4205
  };
4116
4206
  this.imageLoadedHandler = (event) => {
4117
4207
  event.preventDefault();
@@ -4127,24 +4217,26 @@ const CovetPicsShopCart = class {
4127
4217
  this.initStore();
4128
4218
  }
4129
4219
  disconnectedCallback() {
4220
+ if (this.lineUpdatePending)
4221
+ clearTimeout(this.lineUpdatePending.timer);
4130
4222
  this.unsubscribe();
4131
4223
  }
4132
4224
  initStore() {
4133
4225
  this.appState = this.appStore.getState();
4134
- this.products = [...this.appState.shopcart.lines];
4135
- this.totalAmount = getters.getFormatedTotalPrice(this.appState);
4136
- this.discount = getters.getFormatedDiscount(this.appState);
4137
- this.totalQuantity = this.appState.shopcart.totalQuantity;
4226
+ this.products = [...this.appState.shopcart.items];
4227
+ this.totalAmount = getters.getFormatedTotalPriceAjax(this.appState);
4228
+ this.discount = getters.getFormatedDiscountAjax(this.appState);
4229
+ this.totalQuantity = this.appState.shopcart.item_count;
4138
4230
  this.isCartVisible = this.appState.shopcart.isShopCartVisible;
4139
- this.checkoutUrl = this.appState.shopcart.checkoutUrl;
4231
+ this.notAvaliableForSaleKeys = this.appState.shopcart.notAvaliableForSaleKeys;
4140
4232
  this.unsubscribe = this.appStore.subscribe(() => {
4141
4233
  this.appState = this.appStore.getState();
4142
- this.products = [...this.appState.shopcart.lines];
4143
- this.totalAmount = getters.getFormatedTotalPrice(this.appState);
4144
- this.discount = getters.getFormatedDiscount(this.appState);
4145
- this.totalQuantity = this.appState.shopcart.totalQuantity;
4234
+ this.products = [...this.appState.shopcart.items];
4235
+ this.totalAmount = getters.getFormatedTotalPriceAjax(this.appState);
4236
+ this.discount = getters.getFormatedDiscountAjax(this.appState);
4237
+ this.totalQuantity = this.appState.shopcart.item_count;
4146
4238
  this.isCartVisible = this.appState.shopcart.isShopCartVisible;
4147
- this.checkoutUrl = this.appState.shopcart.checkoutUrl;
4239
+ this.notAvaliableForSaleKeys = this.appState.shopcart.notAvaliableForSaleKeys;
4148
4240
  });
4149
4241
  }
4150
4242
  setWidgetCSSVariables() {
@@ -4155,12 +4247,11 @@ const CovetPicsShopCart = class {
4155
4247
  }
4156
4248
  renderProduct(product) {
4157
4249
  var _a, _b;
4158
- const { merchandise, cost } = product;
4159
- return (index.h("article", { class: "product", key: product.id }, index.h("div", { class: "img-wrap is-loading" }, index.h("img", { class: "img", src: (_a = merchandise.image) === null || _a === void 0 ? void 0 : _a.url, alt: ((_b = merchandise.image) === null || _b === void 0 ? void 0 : _b.altText) || "product image", onLoad: this.imageLoadedHandler, onError: this.imageLoadedHandler })), index.h("div", { class: "description" }, index.h("div", { class: "top" }, index.h("h3", { class: "title" }, merchandise.product.title), index.h("p", { class: "price" }, utils.formatCurrency(cost.totalAmount.amount, cost.totalAmount.currencyCode, `${this.appState.shopcart.locale.language}-${this.appState.shopcart.locale.country}`))), index.h("h4", { class: "text" }, merchandise.title), index.h("div", { class: "bottom" }, index.h("div", { class: "change-count" }, index.h("button", { class: "btn-update", onClick: this.onUpdateLine, "data-line-id": product.id, "data-line-quantity": product.quantity - 1 }, "-"), index.h("span", { class: "count" }, product.quantity), index.h("button", { class: "btn-update", onClick: this.onUpdateLine, "data-line-id": product.id, "data-line-quantity": product.quantity + 1, "data-action": "add" }, "+")), index.h("button", { class: "btn-delete", onClick: this.onRemoveLine, "data-line-id": product.id }, index.h("svg", { class: "icon-basket" }, index.h("path", { d: "M6.31 7.18c0-.51-.4-.92-.9-.92s-.9.41-.9.92v4.63c0 .51.4.93.9.93s.9-.42.9-.93V7.18z", style: { transform: "translateX(3px)" } }), index.h("path", { d: "M6.31 7.18c0-.51-.4-.92-.9-.92s-.9.41-.9.92v4.63c0 .51.4.93.9.93s.9-.42.9-.93V7.18z" }), index.h("path", { d: "m7 0c-1.634 0-2.965 1.33-3.021 2.993H.902C.404 2.993 0 3.407 0 3.918c0 .511.404.926.902.926h.689v5.828c0 .91 0 1.599.044 2.148.043.551.132.971.314 1.338.315.635.818 1.151 1.437 1.474.358.187.766.278 1.303.323.535.045 1.207.045 2.094.045h.434c.887 0 1.558 0 2.093-.045.537-.045.946-.136 1.304-.323a3.3 3.3 0 0 0 1.437-1.474c.182-.367.27-.787.314-1.338.044-.55.044-1.239.044-2.148V4.844h.69c.497 0 .901-.415.901-.926 0-.511-.404-.925-.901-.925h-3.078C9.965 1.33 8.634 0 7 0zm-1.326 3.102h2.652a1.54 1.54 0 0 0-.387-.961c.215.222.357.521.383.852.002.036.004.073.004.109H5.674zM7 1.85c.638 0 1.161.503 1.215 1.143H5.785C5.839 2.353 6.362 1.85 7 1.85zM3.394 4.844h7.212v5.823c0 .943-.001 1.545-.038 2.003-.035.436-.093.585-.124.648a2.42 2.42 0 0 1-.649.666c-.061.032-.206.091-.632.127-.445.037-1.032.039-1.951.039h-.424c-.919 0-1.506-.002-1.952-.039-.426-.036-.57-.095-.631-.127a2.42 2.42 0 0 1-.649-.666c-.031-.063-.09-.212-.124-.648-.037-.458-.038-1.06-.038-2.003V4.844z" })))))));
4250
+ return (index.h("article", { class: "product", key: product.key }, index.h("div", { class: "img-wrap is-loading" }, index.h("img", { class: "img", src: (_a = product.featured_image) === null || _a === void 0 ? void 0 : _a.url, alt: ((_b = product.featured_image) === null || _b === void 0 ? void 0 : _b.alt) || "product image", onLoad: this.imageLoadedHandler, onError: this.imageLoadedHandler })), index.h("div", { class: "description" }, index.h("div", { class: "top" }, index.h("h3", { class: "title" }, product.product_title), index.h("p", { class: "price" }, utils.formatCurrency(product.final_line_price / 100, this.appState.shopcart.currency, `${this.appState.shopcart.locale.language}-${this.appState.shopcart.locale.country}`))), index.h("h4", { class: "text" }, product.variant_title), index.h("div", { class: "bottom" }, index.h("div", { class: "change-count" }, index.h("button", { class: "btn-update", onClick: this.onUpdateLine, "data-line-id": product.key, "data-line-quantity": product.quantity - 1 }, "-"), index.h("span", { class: "count" }, product.quantity), index.h("button", { class: "btn-update", onClick: this.onUpdateLine, "data-line-id": product.key, "data-line-quantity": product.quantity + 1, "data-action": "add", disabled: this.notAvaliableForSaleKeys.includes(product.key) }, "+")), index.h("button", { class: "btn-delete", onClick: this.onRemoveLine, "data-line-id": product.key }, index.h("svg", { class: "icon-basket" }, index.h("path", { d: "M6.31 7.18c0-.51-.4-.92-.9-.92s-.9.41-.9.92v4.63c0 .51.4.93.9.93s.9-.42.9-.93V7.18z", style: { transform: "translateX(3px)" } }), index.h("path", { d: "M6.31 7.18c0-.51-.4-.92-.9-.92s-.9.41-.9.92v4.63c0 .51.4.93.9.93s.9-.42.9-.93V7.18z" }), index.h("path", { d: "m7 0c-1.634 0-2.965 1.33-3.021 2.993H.902C.404 2.993 0 3.407 0 3.918c0 .511.404.926.902.926h.689v5.828c0 .91 0 1.599.044 2.148.043.551.132.971.314 1.338.315.635.818 1.151 1.437 1.474.358.187.766.278 1.303.323.535.045 1.207.045 2.094.045h.434c.887 0 1.558 0 2.093-.045.537-.045.946-.136 1.304-.323a3.3 3.3 0 0 0 1.437-1.474c.182-.367.27-.787.314-1.338.044-.55.044-1.239.044-2.148V4.844h.69c.497 0 .901-.415.901-.926 0-.511-.404-.925-.901-.925h-3.078C9.965 1.33 8.634 0 7 0zm-1.326 3.102h2.652a1.54 1.54 0 0 0-.387-.961c.215.222.357.521.383.852.002.036.004.073.004.109H5.674zM7 1.85c.638 0 1.161.503 1.215 1.143H5.785C5.839 2.353 6.362 1.85 7 1.85zM3.394 4.844h7.212v5.823c0 .943-.001 1.545-.038 2.003-.035.436-.093.585-.124.648a2.42 2.42 0 0 1-.649.666c-.061.032-.206.091-.632.127-.445.037-1.032.039-1.951.039h-.424c-.919 0-1.506-.002-1.952-.039-.426-.036-.57-.095-.631-.127a2.42 2.42 0 0 1-.649-.666c-.031-.063-.09-.212-.124-.648-.037-.458-.038-1.06-.038-2.003V4.844z" })))))));
4160
4251
  }
4161
4252
  render() {
4162
- return (index.h(index.Host, { key: '1859171f70f032e271f50e406dcd76783edabc3a', style: this.setWidgetCSSVariables(), class: { "show": this.isCartVisible }, role: "dialog" }, index.h("div", { key: 'b881885f70ff80d2b558ddd41a6537e370565b26', class: { "cart-body": true, "show": this.isCartVisible } }, index.h("div", { key: 'c844dc933ca9ef0fa55eab86a7bd7c3c9fe9969f', class: "cart-top" }, index.h("h2", { key: '4f1f1ce72e3be1697c8300b15e0d46475c2d16fe', class: "cart-title" }, "Basket"), index.h("button", { key: 'd119b13ceab6f7022f067f3e57cb4a4a991b2bd9', onClick: this.closeShopCart, class: "btn-close" })), index.h("div", { key: '5c69846ab7350c1bd3f0d1364c8ee7b7a0e3d65c', class: "product-list" }, this.products.map((product) => this.renderProduct(product))), index.h("div", { key: '9e707a2fea91eec71024d50d07b281a1a419bb87', class: "cost" }, this.discount !== '0' &&
4163
- index.h("p", { key: '184491722c32f5176de6229068817cb779973fdf', class: "cost-price discount" }, index.h("span", { key: '11c3b1ecb77fadb451c33ff13263d9c225ebfdd5' }, "Discount"), index.h("span", { key: 'a78dc3d242e5e3b77debdef5f16c4d7417fd1ef2' }, "- ", this.discount)), index.h("p", { key: '66f33aa4f1b62a6acab17594ac32cf7a6b77b1b2', class: "cost-price total" }, index.h("span", { key: '152a952a740eceebc0c09d264798385ce11e28e4' }, "Total"), index.h("span", { key: '5ab04c9dc8c78169c48431665ac145ca4d1eab0c' }, this.totalAmount))), index.h("a", { key: 'e4b4aa4f67464db177bbd112e1053fa51b217269', class: { "btn-checkout": true, "disabled": this.products.length === 0 }, href: this.checkoutUrl, target: "_top" }, "Proceed to checkout"))));
4253
+ return (index.h(index.Host, { key: 'ca84f19d56cae95a030d5ee8f6c2ba490570cad2', style: this.setWidgetCSSVariables(), class: { "show": this.isCartVisible }, role: "dialog" }, index.h("div", { key: '11634475cf8ea45417539ffb248d3060113dfe6d', class: { "cart-body": true, "show": this.isCartVisible } }, index.h("div", { key: 'ae1ad1ca55d24c2e38c3ed30c26adadd7f1616e8', class: "cart-top" }, index.h("h2", { key: 'e277c150a45af76591dffaa753d19f0a3b46cba3', class: "cart-title" }, "Basket"), index.h("button", { key: 'b0e323d5c3c7ecd104ca1fa8d823e4e2b9642dd2', onClick: this.closeShopCart, class: "btn-close" })), index.h("div", { key: 'df4b312bbb1f5461d7c9a2de4c9ed086dd323fa2', class: "product-list" }, this.products.map((product) => this.renderProduct(product))), index.h("div", { key: '7bd2ab1992477e0cc42052c03df4b0765f8aae4c', class: "cost" }, this.discount !== '0' &&
4254
+ index.h("p", { key: '768da547541769953d083814e51f97c1aa2f8b98', class: "cost-price discount" }, index.h("span", { key: '0062687751fad0d2d67494a0bba3a931b1ebdb39' }, "Discount"), index.h("span", { key: 'fdcc33c27bc902ccb23bcd3d8b18de0c43471ad8' }, "- ", this.discount)), index.h("p", { key: '8c04bc3db993febfcf5c449e9b582d7bfbb4fc3a', class: "cost-price total" }, index.h("span", { key: '1ac43d436b31617e42e661df3453e05777af635e' }, "Total"), index.h("span", { key: '70f849d336c10715f8f9359aa3eafb44d762b848' }, this.totalAmount))), index.h("a", { key: '8d9bfb32c1390fd43d658afea6796a403671e964', class: { "btn-checkout": true, "disabled": this.products.length === 0 }, href: "/checkout", target: "_top" }, "Proceed to checkout"))));
4164
4255
  }
4165
4256
  get el() { return index.getElement(this); }
4166
4257
  };
@@ -5,12 +5,12 @@
5
5
 
6
6
  var index = require('./index-C5a8iHmi.js');
7
7
  var utils$1 = require('./utils-DVZVIghB.js');
8
- var getters = require('./getters-geTaYis0.js');
8
+ var getters = require('./getters-CyBn8UrZ.js');
9
9
  var popupFuncComponents = require('./popupFuncComponents-Bt--NSom.js');
10
10
  var a11y = require('./a11y-DFTngZna.js');
11
11
  var navigation = require('./navigation-XeIeQQXp.js');
12
12
  var slider = require('./slider-DuFctxkr.js');
13
- var shopcart = require('./shopcart-C3zF26Oh.js');
13
+ var shopcart = require('./shopcart-DyUcCct4.js');
14
14
  var storeUtils = require('./storeUtils-sFXfLcFp.js');
15
15
  var popup = require('./popup-BgupOeY7.js');
16
16
  var funcComponents = require('./funcComponents-CKK6ULzk.js');
@@ -5608,7 +5608,7 @@ const CovetPicsPopup = class {
5608
5608
  this.isPreviousEnable = popup.isPreviousEnable(this.appState);
5609
5609
  this.isNextEnable = popup.isNextEnable(this.appState);
5610
5610
  this.isModalOpenEventSent = this.appState.popup.isModalOpenEventSent;
5611
- this.totalQuantity = this.appState.shopcart.totalQuantity;
5611
+ this.totalQuantity = this.appState.shopcart.item_count;
5612
5612
  this.unsubscribe = this.appStore.subscribe(() => {
5613
5613
  this.appState = this.appStore.getState();
5614
5614
  this.galleryEmbedId = this.appState.widgetId.embedId;
@@ -5620,7 +5620,7 @@ const CovetPicsPopup = class {
5620
5620
  this.isPreviousEnable = popup.isPreviousEnable(this.appState);
5621
5621
  this.isNextEnable = popup.isNextEnable(this.appState);
5622
5622
  this.isModalOpenEventSent = this.appState.popup.isModalOpenEventSent;
5623
- this.totalQuantity = this.appState.shopcart.totalQuantity;
5623
+ this.totalQuantity = this.appState.shopcart.item_count;
5624
5624
  });
5625
5625
  }
5626
5626
  async loadSharedData() {
@@ -5898,13 +5898,13 @@ const CovetPicsPopup = class {
5898
5898
  render() {
5899
5899
  return (
5900
5900
  // needsclick FIXME: https://github.com/ftlabs/fastclick/issues/604
5901
- index.h(index.Host, { key: '7c3888c5758273761bb1502de37d7a636e6e9990', style: this.setPopupCSSVariables(), class: { "needsclick": true, "covet-pics-popup-show": this.popupIsOpen || this.popupIsClosing, "covet-pics-popup-open": this.popupIsOpen } }, index.h("div", { key: 'c61ee5334b7f5d96bc971b17c28e38bdf6b78acf', class: { "popup": true, "responsive": this.settings.popup_image_size === "responsive", "animated": this.settings.popup_animation, "direct-buy-open": this.directBuyIsOpen, "open": this.popupIsOpen || this.popupIsClosing }, tabindex: this.popupIsOpen ? 1 : -1, role: "dialog", "aria-modal": "true", "aria-labelledby": "Popup" }, this.settings.close_button_position === "corner" &&
5901
+ index.h(index.Host, { key: '7f2cecf5501823053d5796fe143c1dbe17474beb', style: this.setPopupCSSVariables(), class: { "needsclick": true, "covet-pics-popup-show": this.popupIsOpen || this.popupIsClosing, "covet-pics-popup-open": this.popupIsOpen } }, index.h("div", { key: 'cfbcc882c595adde2f91dec54b753673f8690286', class: { "popup": true, "responsive": this.settings.popup_image_size === "responsive", "animated": this.settings.popup_animation, "direct-buy-open": this.directBuyIsOpen, "open": this.popupIsOpen || this.popupIsClosing }, tabindex: this.popupIsOpen ? 1 : -1, role: "dialog", "aria-modal": "true", "aria-labelledby": "Popup" }, this.settings.close_button_position === "corner" &&
5902
5902
  this.renderCloseButton(), this.settings._arrowsMobilePosition === "top" &&
5903
- this.renderMobileArrows(), index.h("div", { key: 'fc3d0cda1e410c27c882ec46ffc0645a4ebd8aa3', class: "popup-dialog" }, this.item && this.item.id !== -1 &&
5904
- index.h("div", { key: '33cd214c8e2d1a80777915e7d7cad0aac4e328fa', id: this.contentCarouselId, class: "popup-content" }, this.renderImage(), this.renderSidebar()), ["arrows-type-1", "arrows-type-2", "arrows-type-3"].includes(this.settings._arrowsDesktopType) &&
5905
- index.h("div", { key: '4c7400a68f3f6deebf8473aa8ebab66e6fd02301', class: `desktop-arrows arrows-size-${this.settings._arrowsDesktopSizeType} arrows-color-theme-${this.settings.arrow_color_theme}` }, this.renderArrows(this.settings._arrowsDesktopType)), this.settings.close_button_position === "side" &&
5906
- this.renderCloseButton(), index.h("button", { key: '13d57d2805c0ce1d537c0c77c9e7a8af2dcf80d9', onClick: this.onShowShopCart, class: `btn-checkout desktop ${this.settings.close_button_position}
5907
- ${this.settings.close_button_size} ${this.settings._closeButtonColorTheme} ${this.totalQuantity > 0 ? "show" : ""}`, "aria-hidden": "true", "aria-label": "View cart" }, index.h("span", { key: '389e747eb74d7adbd3ae9138242ff24a14091f65', class: { "counter": true, "bounce": this.totalQuantity > 0 } }, this.totalQuantity), index.h(popupFuncComponents.Icon, { key: 'f770ab3ebbb0623abd432083b9603566c155db57', iconName: "checkout" }))), index.h("div", { key: '846461a6e2f49c54cfbc93482ecb9ed3c86a4ad1', class: "backdrop", "data-dismiss": "popup", onClick: this.hidePopupClickHandler }))));
5903
+ this.renderMobileArrows(), index.h("div", { key: '2e10786634d00a66cd0134f7bfd767168442675c', class: "popup-dialog" }, this.item && this.item.id !== -1 &&
5904
+ index.h("div", { key: '3ecb0f87555d1338cee80f2ca0deca905de33ddc', id: this.contentCarouselId, class: "popup-content" }, this.renderImage(), this.renderSidebar()), ["arrows-type-1", "arrows-type-2", "arrows-type-3"].includes(this.settings._arrowsDesktopType) &&
5905
+ index.h("div", { key: '8f94430011eca7368cdb44803136887292c2e8db', class: `desktop-arrows arrows-size-${this.settings._arrowsDesktopSizeType} arrows-color-theme-${this.settings.arrow_color_theme}` }, this.renderArrows(this.settings._arrowsDesktopType)), this.settings.close_button_position === "side" &&
5906
+ this.renderCloseButton(), index.h("button", { key: '7fd6b0123627ced9f5cd1726978fb29aff7cee11', onClick: this.onShowShopCart, class: `btn-checkout desktop ${this.settings.close_button_position}
5907
+ ${this.settings.close_button_size} ${this.settings._closeButtonColorTheme} ${this.totalQuantity > 0 ? "show" : ""}`, "aria-hidden": "true", "aria-label": "View cart" }, index.h("span", { key: '4e0eadb85f795216f03e7252ff9a98cea1459c9a', class: { "counter": true, "bounce": this.totalQuantity > 0 } }, this.totalQuantity), index.h(popupFuncComponents.Icon, { key: '79f7c88c93e173714fe70ec798f814432ec598ec', iconName: "checkout" }))), index.h("div", { key: 'cf246a05f923f5cd3efe496b5780d06d229eb787', class: "backdrop", "data-dismiss": "popup", onClick: this.hidePopupClickHandler }))));
5908
5908
  }
5909
5909
  get el() { return index.getElement(this); }
5910
5910
  static get watchers() { return {
@@ -8,7 +8,7 @@ var utils = require('./utils-DVZVIghB.js');
8
8
  var sort = require('./sort-DzLm-x1V.js');
9
9
  var funcComponents = require('./funcComponents-CKK6ULzk.js');
10
10
  var index$1 = require('./index-BMdsVEom.js');
11
- var getters = require('./getters-geTaYis0.js');
11
+ var getters = require('./getters-CyBn8UrZ.js');
12
12
  var slider = require('./slider-DuFctxkr.js');
13
13
  var popup = require('./popup-BgupOeY7.js');
14
14
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  var index = require('./index-C5a8iHmi.js');
7
7
  var utils = require('./utils-DVZVIghB.js');
8
- var getters = require('./getters-geTaYis0.js');
8
+ var getters = require('./getters-CyBn8UrZ.js');
9
9
  var storeUtils = require('./storeUtils-sFXfLcFp.js');
10
10
  var a11y = require('./a11y-DFTngZna.js');
11
11
  var navigation = require('./navigation-XeIeQQXp.js');
@@ -9,9 +9,9 @@ var popup = require('./popup-BgupOeY7.js');
9
9
  var sort = require('./sort-DzLm-x1V.js');
10
10
  var items = require('./items-3V7r4_YT.js');
11
11
  var slider = require('./slider-DuFctxkr.js');
12
- var shopcart = require('./shopcart-C3zF26Oh.js');
12
+ var shopcart = require('./shopcart-DyUcCct4.js');
13
13
  var storeUtils = require('./storeUtils-sFXfLcFp.js');
14
- var getters = require('./getters-geTaYis0.js');
14
+ var getters = require('./getters-CyBn8UrZ.js');
15
15
 
16
16
  const STANDARD_GALLERY_URL = "/api/v1/embed/:id";
17
17
  const PRODUCT_GALLERY_URL = "/api/v1/shop/:shop/product/:handle";
@@ -22,7 +22,7 @@ var patchBrowser = () => {
22
22
 
23
23
  patchBrowser().then(async (options) => {
24
24
  await appGlobals.globalScripts();
25
- return index.bootstrapLazy([["covet-pics-post.cjs",[[1,"covet-pics-post",{"postId":[2,"post-id"],"environment":[1],"item":[32],"fetchingError":[32]}]]],["covet-pics-crop-text.cjs",[[0,"covet-pics-crop-text",{"text":[1],"textClass":[1,"text-class"],"textColor":[1,"text-color"],"ratio":[16],"cropCSS":[32]}]]],["covet-pics-star-rating.cjs",[[1,"covet-pics-star-rating",{"rating":[2],"ratingCount":[2,"rating-count"],"starColor":[1,"star-color"],"emptyStarColor":[1,"empty-star-color"],"starBorderColor":[1,"star-border-color"],"starBorderWidth":[2,"star-border-width"],"starSize":[2,"star-size"],"spaceStars":[2,"space-stars"],"spaceStarsText":[2,"space-stars-text"],"showLabel":[4,"show-label"],"label":[1]}]]],["covet-pics-highlighted-hotspots_2.cjs",[[0,"covet-pics-highlighted-page",{"thumbnailUrl":[1,"thumbnail-url"],"thumbnailAlt":[1,"thumbnail-alt"],"ariaLabel":[1,"aria-label"],"thumbnailLayout":[1,"thumbnail-layout"],"videoUrl":[1,"video-url"],"videoPoster":[1,"video-poster"],"thumbnailCarouselImages":[16,"thumbnail-carousel-images"],"productLinks":[16,"product-links"],"productBaseImgAlt":[1,"product-base-img-alt"],"reverseClass":[1,"reverse-class"],"isMobile":[4,"is-mobile"],"pageIndex":[2,"page-index"],"caption":[1],"rating":[2],"createdTime":[1,"created-time"],"userName":[1,"user-name"],"mainSliderIndex":[2,"main-slider-index"],"pageId":[2,"page-id"],"appStore":[16,"app-store"],"hideHotspots":[32],"activeProductIndex":[32],"hoverHotspot":[32]},[[0,"changeActiveHotspot","onChangeActiveHotspot"]]],[0,"covet-pics-highlighted-hotspots",{"links":[16],"activeHotspot":[2,"active-hotspot"],"thumbnailUrl":[1,"thumbnail-url"],"hoverHotspot":[2,"hover-hotspot"],"isMobile":[4,"is-mobile"],"productBaseImgAlt":[1,"product-base-img-alt"],"pageId":[2,"page-id"],"appStore":[16,"app-store"]},null,{"thumbnailUrl":["refreshHotspot"],"activeHotspot":["activeHotspotHandler"]}]]],["covet-pics-gallery-header_3.cjs",[[0,"covet-pics-gallery-header",{"rating":[2],"productTitle":[1,"product-title"],"breakdown":[16],"appStore":[16,"app-store"],"showBreakdownDropdown":[32],"showSortDropdown":[32],"isDesktopScreen":[32]}],[0,"covet-pics-gallery-item",{"altTag":[1,"alt-tag"],"highlighted":[4],"imageUrl":[1,"image-url"],"rating":[2],"itemWidth":[2,"item-width"],"userName":[1,"user-name"],"createdTime":[1,"created-time"],"caption":[1],"itemType":[1,"item-type"],"imageHighResolutionUrl":[1,"image-high-resolution-url"],"imageResponsiveSizes":[1,"image-responsive-sizes"],"itemId":[1,"item-id"],"itemSource":[1,"item-source"],"links":[16],"url":[1],"videoUrl":[1,"video-url"],"itemIndex":[2,"item-index"],"itemSize":[1,"item-size"],"appStore":[16,"app-store"],"tabIndex":[32],"sliderIndex":[32],"showImageAsVideoPoster":[32]},[[10,"updateUploadWidgetCover","updateUploadWidgetCoverHandler"]],{"sliderIndex":["autoPlayVideos"]}],[0,"covet-pics-gallery-item-detail",{"altTag":[1,"alt-tag"],"highlighted":[4],"verified":[4],"imageUrl":[1,"image-url"],"imageHighResolutionUrl":[1,"image-high-resolution-url"],"imageResponsiveSizes":[1,"image-responsive-sizes"],"videoUrl":[1,"video-url"],"itemId":[1,"item-id"],"itemSource":[1,"item-source"],"itemType":[1,"item-type"],"links":[16],"url":[1],"rating":[2],"userName":[1,"user-name"],"caption":[1],"createdTime":[1,"created-time"],"itemIndex":[2,"item-index"],"itemSize":[1,"item-size"],"appStore":[16,"app-store"],"tabIndex":[32],"captionCSS":[32],"reviewClass":[32],"starOnlyClass":[32],"highlightedClass":[32],"sliderIndex":[32],"showImageAsVideoPoster":[32]},[[10,"updateUploadWidgetCover","updateUploadWidgetCoverHandler"],[8,"elementResize","elementResizeHandler"]],{"sliderIndex":["autoPlayVideos"]}]]],["covet-pics-popup-freeflow-carousel_3.cjs",[[0,"covet-pics-popup-slide",{"item":[16],"showCaption":[4,"show-caption"],"showStarRating":[4,"show-star-rating"],"sharedLinkEnable":[4,"shared-link-enable"],"dataLoaded":[32],"isPlaying":[32],"isMuted":[32],"carouselIndex":[32],"videoProgress":[32],"showCarouselVideoControls":[32],"loadMedia":[64],"videoPlay":[64],"videoPause":[64],"videoSoundOff":[64],"videoSoundOn":[64]}],[0,"covet-pics-popup-freeflow-carousel",{"item":[16],"isEnabled":[4,"is-enabled"],"dataLoaded":[1,"data-loaded"],"sliderIndex":[32],"videoPlay":[64],"videoPause":[64],"videoSoundOn":[64],"videoSoundOff":[64],"pauseAllVideos":[64]},null,{"isEnabled":["enableSlider"],"dataLoaded":["lazyLoadMedia"],"sliderIndex":["updateSliderIndex"]}],[1,"covet-pics-popup-freeflow-links",{"links":[16],"itemCreatedTime":[1,"item-created-time"],"isSliderEnabled":[4,"is-slider-enabled"]},null,{"isSliderEnabled":["enableSlider"]}]]],["covet-pics-checkbox_9.cjs",[[0,"covet-pics-direct-buy",{"covetProduct":[16,"covet-product"],"itemId":[1,"item-id"],"appStore":[16,"app-store"],"settings":[32],"selectedVariant":[32],"product":[32],"options":[32],"selectedOptions":[32],"shopCartState":[32],"isAvailableForSale":[32]}],[0,"covet-pics-hotspots",{"links":[16],"backgroundColor":[1,"background-color"],"textColor":[1,"text-color"],"showNumbers":[4,"show-numbers"]},[[0,"linkInactivate","linkInactivateHandler"],[0,"linkActivate","linkActivateHandler"]]],[0,"covet-pics-popup-links",{"links":[16],"greyBorderClass":[1,"grey-border-class"],"itemCreatedTime":[1,"item-created-time"],"appStore":[16,"app-store"],"settings":[32]}],[0,"covet-pics-popup-review",{"rating":[2],"caption":[1],"username":[1],"itemType":[1,"item-type"],"verified":[4],"createdTime":[1,"created-time"],"reviewCSS":[32]},null,{"caption":["watchPropHandler"]}],[0,"covet-pics-popup-shared-links",{"item":[16],"galleryEmbedId":[2,"gallery-embed-id"],"showShareLink":[32],"copyLinkCopied":[32]}],[1,"covet-pics-checkbox",{"checked":[1540],"label":[1],"value":[1],"disabled":[516],"inputId":[1,"input-id"]}],[0,"covet-pics-popup-slider",{"item":[16],"getSwiperState":[64]}],[1,"covet-pics-select",{"selectId":[1,"select-id"],"optionData":[16,"option-data"],"label":[1],"selectedValue":[1,"selected-value"]},[[9,"mousedown","handleClickOutside"]]],[1,"covet-pics-shop-cart",{"appStore":[16,"app-store"],"isCartVisible":[32],"products":[32],"checkoutUrl":[32],"totalAmount":[32],"discount":[32],"totalQuantity":[32]}]]],["covet-pics-gallery-grid_7.cjs",[[1,"covet-pics-popup",{"appStore":[16,"app-store"],"item":[32],"product":[32],"directBuyIsOpen":[32],"settings":[32],"isPreviousEnable":[32],"isNextEnable":[32],"popupIsOpen":[32],"popupIsClosing":[32],"totalQuantity":[32],"openPopup":[64],"closePopup":[64]},[[16,"productLinkClicked","productLinkClickedHandler"]],{"item":["itemChangedHandler"],"popupIsOpen":["popupOpenHandler"]}],[0,"covet-pics-gallery-grid",{"breakdown":[16],"productTitle":[1,"product-title"],"rating":[2],"filtersEnabled":[4,"filters-enabled"],"filters":[16],"showLoadMore":[4,"show-load-more"],"appStore":[16,"app-store"],"showSort":[32],"isGridDisabled":[32],"isDesktopScreen":[32],"itemSize":[32],"isFilterModalShow":[32],"items":[32]},[[0,"imageLoaded","imagesLoadedHandler"],[8,"elementResize","elementResizeHandler"],[9,"mousedown","handleClickOutside"],[0,"itemLoaded","handleItemLoaded"]]],[0,"covet-pics-gallery-slider",{"sliderStyle":[1,"slider-style"],"appStore":[16,"app-store"],"itemSize":[32],"items":[32],"galleryIndex":[32]},[[0,"imageLoaded","imagesLoadedHandler"],[8,"elementResize","elementResizeHandler"],[0,"itemLoaded","handleItemLoaded"]],{"galleryIndex":["changeSlide"]}],[1,"covet-pics-popup-freeflow",{"appStore":[16,"app-store"],"settings":[32],"items":[32],"sliderIndex":[32],"popupIsOpen":[32],"openPopupFreeflow":[64],"closePopupFreeflow":[64]},null,{"popupIsOpen":["popupOpenHandler"],"sliderIndex":["updateSliderIndex"],"items":["updateItems"]}],[0,"covet-pics-highlighted",{"numberOfPages":[2,"number-of-pages"],"items":[16],"appStore":[16,"app-store"],"productLinks":[32],"mainSliderIndex":[32],"mainSliderAnimatingSlides":[32],"windowHeight":[32],"isDesktopScreen":[32]},[[0,"pageLoaded","handleItemLoaded"]]],[1,"covet-pics-notifications",{"appStore":[16,"app-store"],"notifications":[32],"showAll":[32]}],[1,"covet-pics-upload",{"standalone":[4],"appStore":[16,"app-store"],"starRating":[32],"isFormValid":[32],"showFormWarning":[32],"thumbnailLinks":[32],"toShowLinks":[32],"dropedImagesNumber":[32],"isAnimating":[32],"notificationMessage":[32],"isNotificationActive":[32],"widgetWidth":[32],"uploadIsOpen":[32],"uploadIsClosing":[32],"openUpload":[64],"closeUpload":[64]},null,{"uploadIsOpen":["uploadOpenHandler"]}]]],["covet-pics-widget.cjs",[[1,"covet-pics-widget",{"shop":[1],"galleryEmbedId":[2,"gallery-embed-id"],"shopifyProductId":[2,"shopify-product-id"],"environment":[1],"baseUrl":[1,"base-url"],"customSettings":[1,"custom-settings"],"hideElements":[1,"hide-elements"],"previewMode":[4,"preview-mode"],"photoRequestId":[2,"photo-request-id"],"lazyLoad":[4,"lazy-load"],"isLoading":[32],"minNumberOfPhotos":[32],"appStore":[32],"fetchingError":[32],"preloadNextPage":[32],"updateUploadWidgetCoverPreview":[64],"updatePreviewSettings":[64]},[[0,"sortUpdated","sortUpdatedHandler"],[0,"filtersUpdated","filtersUpdatedHandler"],[0,"nextPage","nextPageHandler"],[4,"popupFreeflowNextPage","nextPageHandlerFreeflow"]],{"preloadNextPage":["preloadNextPageHandler"]}]]]], options);
25
+ return index.bootstrapLazy([["covet-pics-post.cjs",[[1,"covet-pics-post",{"postId":[2,"post-id"],"environment":[1],"item":[32],"fetchingError":[32]}]]],["covet-pics-crop-text.cjs",[[0,"covet-pics-crop-text",{"text":[1],"textClass":[1,"text-class"],"textColor":[1,"text-color"],"ratio":[16],"cropCSS":[32]}]]],["covet-pics-star-rating.cjs",[[1,"covet-pics-star-rating",{"rating":[2],"ratingCount":[2,"rating-count"],"starColor":[1,"star-color"],"emptyStarColor":[1,"empty-star-color"],"starBorderColor":[1,"star-border-color"],"starBorderWidth":[2,"star-border-width"],"starSize":[2,"star-size"],"spaceStars":[2,"space-stars"],"spaceStarsText":[2,"space-stars-text"],"showLabel":[4,"show-label"],"label":[1]}]]],["covet-pics-highlighted-hotspots_2.cjs",[[0,"covet-pics-highlighted-page",{"thumbnailUrl":[1,"thumbnail-url"],"thumbnailAlt":[1,"thumbnail-alt"],"ariaLabel":[1,"aria-label"],"thumbnailLayout":[1,"thumbnail-layout"],"videoUrl":[1,"video-url"],"videoPoster":[1,"video-poster"],"thumbnailCarouselImages":[16,"thumbnail-carousel-images"],"productLinks":[16,"product-links"],"productBaseImgAlt":[1,"product-base-img-alt"],"reverseClass":[1,"reverse-class"],"isMobile":[4,"is-mobile"],"pageIndex":[2,"page-index"],"caption":[1],"rating":[2],"createdTime":[1,"created-time"],"userName":[1,"user-name"],"mainSliderIndex":[2,"main-slider-index"],"pageId":[2,"page-id"],"appStore":[16,"app-store"],"hideHotspots":[32],"activeProductIndex":[32],"hoverHotspot":[32]},[[0,"changeActiveHotspot","onChangeActiveHotspot"]]],[0,"covet-pics-highlighted-hotspots",{"links":[16],"activeHotspot":[2,"active-hotspot"],"thumbnailUrl":[1,"thumbnail-url"],"hoverHotspot":[2,"hover-hotspot"],"isMobile":[4,"is-mobile"],"productBaseImgAlt":[1,"product-base-img-alt"],"pageId":[2,"page-id"],"appStore":[16,"app-store"]},null,{"thumbnailUrl":["refreshHotspot"],"activeHotspot":["activeHotspotHandler"]}]]],["covet-pics-gallery-header_3.cjs",[[0,"covet-pics-gallery-header",{"rating":[2],"productTitle":[1,"product-title"],"breakdown":[16],"appStore":[16,"app-store"],"showBreakdownDropdown":[32],"showSortDropdown":[32],"isDesktopScreen":[32]}],[0,"covet-pics-gallery-item",{"altTag":[1,"alt-tag"],"highlighted":[4],"imageUrl":[1,"image-url"],"rating":[2],"itemWidth":[2,"item-width"],"userName":[1,"user-name"],"createdTime":[1,"created-time"],"caption":[1],"itemType":[1,"item-type"],"imageHighResolutionUrl":[1,"image-high-resolution-url"],"imageResponsiveSizes":[1,"image-responsive-sizes"],"itemId":[1,"item-id"],"itemSource":[1,"item-source"],"links":[16],"url":[1],"videoUrl":[1,"video-url"],"itemIndex":[2,"item-index"],"itemSize":[1,"item-size"],"appStore":[16,"app-store"],"tabIndex":[32],"sliderIndex":[32],"showImageAsVideoPoster":[32]},[[10,"updateUploadWidgetCover","updateUploadWidgetCoverHandler"]],{"sliderIndex":["autoPlayVideos"]}],[0,"covet-pics-gallery-item-detail",{"altTag":[1,"alt-tag"],"highlighted":[4],"verified":[4],"imageUrl":[1,"image-url"],"imageHighResolutionUrl":[1,"image-high-resolution-url"],"imageResponsiveSizes":[1,"image-responsive-sizes"],"videoUrl":[1,"video-url"],"itemId":[1,"item-id"],"itemSource":[1,"item-source"],"itemType":[1,"item-type"],"links":[16],"url":[1],"rating":[2],"userName":[1,"user-name"],"caption":[1],"createdTime":[1,"created-time"],"itemIndex":[2,"item-index"],"itemSize":[1,"item-size"],"appStore":[16,"app-store"],"tabIndex":[32],"captionCSS":[32],"reviewClass":[32],"starOnlyClass":[32],"highlightedClass":[32],"sliderIndex":[32],"showImageAsVideoPoster":[32]},[[10,"updateUploadWidgetCover","updateUploadWidgetCoverHandler"],[8,"elementResize","elementResizeHandler"]],{"sliderIndex":["autoPlayVideos"]}]]],["covet-pics-popup-freeflow-carousel_3.cjs",[[0,"covet-pics-popup-slide",{"item":[16],"showCaption":[4,"show-caption"],"showStarRating":[4,"show-star-rating"],"sharedLinkEnable":[4,"shared-link-enable"],"dataLoaded":[32],"isPlaying":[32],"isMuted":[32],"carouselIndex":[32],"videoProgress":[32],"showCarouselVideoControls":[32],"loadMedia":[64],"videoPlay":[64],"videoPause":[64],"videoSoundOff":[64],"videoSoundOn":[64]}],[0,"covet-pics-popup-freeflow-carousel",{"item":[16],"isEnabled":[4,"is-enabled"],"dataLoaded":[1,"data-loaded"],"sliderIndex":[32],"videoPlay":[64],"videoPause":[64],"videoSoundOn":[64],"videoSoundOff":[64],"pauseAllVideos":[64]},null,{"isEnabled":["enableSlider"],"dataLoaded":["lazyLoadMedia"],"sliderIndex":["updateSliderIndex"]}],[1,"covet-pics-popup-freeflow-links",{"links":[16],"itemCreatedTime":[1,"item-created-time"],"isSliderEnabled":[4,"is-slider-enabled"]},null,{"isSliderEnabled":["enableSlider"]}]]],["covet-pics-checkbox_9.cjs",[[0,"covet-pics-direct-buy",{"covetProduct":[16,"covet-product"],"itemId":[1,"item-id"],"appStore":[16,"app-store"],"settings":[32],"selectedVariant":[32],"product":[32],"options":[32],"selectedOptions":[32],"shopCartState":[32],"isAvailableForSale":[32]}],[0,"covet-pics-hotspots",{"links":[16],"backgroundColor":[1,"background-color"],"textColor":[1,"text-color"],"showNumbers":[4,"show-numbers"]},[[0,"linkInactivate","linkInactivateHandler"],[0,"linkActivate","linkActivateHandler"]]],[0,"covet-pics-popup-links",{"links":[16],"greyBorderClass":[1,"grey-border-class"],"itemCreatedTime":[1,"item-created-time"],"appStore":[16,"app-store"],"settings":[32]}],[0,"covet-pics-popup-review",{"rating":[2],"caption":[1],"username":[1],"itemType":[1,"item-type"],"verified":[4],"createdTime":[1,"created-time"],"reviewCSS":[32]},null,{"caption":["watchPropHandler"]}],[0,"covet-pics-popup-shared-links",{"item":[16],"galleryEmbedId":[2,"gallery-embed-id"],"showShareLink":[32],"copyLinkCopied":[32]}],[1,"covet-pics-checkbox",{"checked":[1540],"label":[1],"value":[1],"disabled":[516],"inputId":[1,"input-id"]}],[0,"covet-pics-popup-slider",{"item":[16],"getSwiperState":[64]}],[1,"covet-pics-select",{"selectId":[1,"select-id"],"optionData":[16,"option-data"],"label":[1],"selectedValue":[1,"selected-value"]},[[9,"mousedown","handleClickOutside"]]],[1,"covet-pics-shop-cart",{"appStore":[16,"app-store"],"isCartVisible":[32],"products":[32],"totalAmount":[32],"discount":[32],"totalQuantity":[32],"notAvaliableForSaleKeys":[32]}]]],["covet-pics-gallery-grid_7.cjs",[[1,"covet-pics-popup",{"appStore":[16,"app-store"],"item":[32],"product":[32],"directBuyIsOpen":[32],"settings":[32],"isPreviousEnable":[32],"isNextEnable":[32],"popupIsOpen":[32],"popupIsClosing":[32],"totalQuantity":[32],"openPopup":[64],"closePopup":[64]},[[16,"productLinkClicked","productLinkClickedHandler"]],{"item":["itemChangedHandler"],"popupIsOpen":["popupOpenHandler"]}],[0,"covet-pics-gallery-grid",{"breakdown":[16],"productTitle":[1,"product-title"],"rating":[2],"filtersEnabled":[4,"filters-enabled"],"filters":[16],"showLoadMore":[4,"show-load-more"],"appStore":[16,"app-store"],"showSort":[32],"isGridDisabled":[32],"isDesktopScreen":[32],"itemSize":[32],"isFilterModalShow":[32],"items":[32]},[[0,"imageLoaded","imagesLoadedHandler"],[8,"elementResize","elementResizeHandler"],[9,"mousedown","handleClickOutside"],[0,"itemLoaded","handleItemLoaded"]]],[0,"covet-pics-gallery-slider",{"sliderStyle":[1,"slider-style"],"appStore":[16,"app-store"],"itemSize":[32],"items":[32],"galleryIndex":[32]},[[0,"imageLoaded","imagesLoadedHandler"],[8,"elementResize","elementResizeHandler"],[0,"itemLoaded","handleItemLoaded"]],{"galleryIndex":["changeSlide"]}],[1,"covet-pics-popup-freeflow",{"appStore":[16,"app-store"],"settings":[32],"items":[32],"sliderIndex":[32],"popupIsOpen":[32],"openPopupFreeflow":[64],"closePopupFreeflow":[64]},null,{"popupIsOpen":["popupOpenHandler"],"sliderIndex":["updateSliderIndex"],"items":["updateItems"]}],[0,"covet-pics-highlighted",{"numberOfPages":[2,"number-of-pages"],"items":[16],"appStore":[16,"app-store"],"productLinks":[32],"mainSliderIndex":[32],"mainSliderAnimatingSlides":[32],"windowHeight":[32],"isDesktopScreen":[32]},[[0,"pageLoaded","handleItemLoaded"]]],[1,"covet-pics-notifications",{"appStore":[16,"app-store"],"notifications":[32],"showAll":[32]}],[1,"covet-pics-upload",{"standalone":[4],"appStore":[16,"app-store"],"starRating":[32],"isFormValid":[32],"showFormWarning":[32],"thumbnailLinks":[32],"toShowLinks":[32],"dropedImagesNumber":[32],"isAnimating":[32],"notificationMessage":[32],"isNotificationActive":[32],"widgetWidth":[32],"uploadIsOpen":[32],"uploadIsClosing":[32],"openUpload":[64],"closeUpload":[64]},null,{"uploadIsOpen":["uploadOpenHandler"]}]]],["covet-pics-widget.cjs",[[1,"covet-pics-widget",{"shop":[1],"galleryEmbedId":[2,"gallery-embed-id"],"shopifyProductId":[2,"shopify-product-id"],"environment":[1],"baseUrl":[1,"base-url"],"customSettings":[1,"custom-settings"],"hideElements":[1,"hide-elements"],"previewMode":[4,"preview-mode"],"photoRequestId":[2,"photo-request-id"],"lazyLoad":[4,"lazy-load"],"isLoading":[32],"minNumberOfPhotos":[32],"appStore":[32],"fetchingError":[32],"preloadNextPage":[32],"updateUploadWidgetCoverPreview":[64],"updatePreviewSettings":[64]},[[0,"sortUpdated","sortUpdatedHandler"],[0,"filtersUpdated","filtersUpdatedHandler"],[0,"nextPage","nextPageHandler"],[4,"popupFreeflowNextPage","nextPageHandlerFreeflow"]],{"preloadNextPage":["preloadNextPageHandler"]}]]]], options);
26
26
  });
27
27
 
28
28
  exports.setNonce = index.setNonce;
@@ -61,28 +61,27 @@ const getGalleryIndex = (state) => {
61
61
  const galleryIndex = state.items.findIndex(el => el.id === state.popup.itemId);
62
62
  return galleryIndex;
63
63
  };
64
- const getShopCart = (state) => state.shopcart;
65
- const getFormatedTotalPrice = (state) => {
66
- const { cost } = state.shopcart;
67
- const locale = `${state.shopcart.locale.language}-${state.shopcart.locale.country}`;
68
- return utils.formatCurrency(cost.totalAmount.amount, cost.totalAmount.currencyCode, locale);
64
+ const getLineKeyByVariantId = (state, variantId) => {
65
+ const item = state.shopcart.items.find(i => i.key.startsWith(String(variantId)));
66
+ return item ? item.key : null;
69
67
  };
70
- const getFormatedDiscount = (state) => {
71
- const { discountAllocations } = state.shopcart;
72
- if (discountAllocations === null || discountAllocations.length === 0)
68
+ const getFormatedTotalPriceAjax = (state) => {
69
+ const { total_price, currency, locale } = state.shopcart;
70
+ return utils.formatCurrency(total_price / 100, currency, `${locale.language}-${locale.country}`);
71
+ };
72
+ const getFormatedDiscountAjax = (state) => {
73
+ const { total_discount, currency, locale } = state.shopcart;
74
+ if (total_discount === 0)
73
75
  return "0";
74
- const { language, country } = state.shopcart.locale;
75
- const totalDiscount = discountAllocations.reduce((sum, el) => sum + parseFloat(el.discountedAmount.amount), 0);
76
- const locale = `${language}-${country}`;
77
- return utils.formatCurrency(totalDiscount, discountAllocations[0].discountedAmount.currencyCode, locale);
76
+ return utils.formatCurrency(total_discount / 100, currency, `${locale.language}-${locale.country}`);
78
77
  };
79
78
 
80
- exports.getFormatedDiscount = getFormatedDiscount;
81
- exports.getFormatedTotalPrice = getFormatedTotalPrice;
79
+ exports.getFormatedDiscountAjax = getFormatedDiscountAjax;
80
+ exports.getFormatedTotalPriceAjax = getFormatedTotalPriceAjax;
82
81
  exports.getGalleryIndex = getGalleryIndex;
83
82
  exports.getItemSize = getItemSize;
84
83
  exports.getItemTabIndex = getItemTabIndex;
85
- exports.getShopCart = getShopCart;
84
+ exports.getLineKeyByVariantId = getLineKeyByVariantId;
86
85
  exports.getUseAnalytics = getUseAnalytics;
87
86
  exports.isNeedToPreloadNextPage = isNeedToPreloadNextPage;
88
87
  exports.isWidgetDisabled = isWidgetDisabled;