cloudcommerce 0.33.4 → 0.34.0

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 (212) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
  3. package/ecomplus-stores/barra-doce/functions/ssr/package.json +6 -6
  4. package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
  5. package/ecomplus-stores/barra-doce/package.json +2 -2
  6. package/ecomplus-stores/monocard/functions/many/package.json +3 -3
  7. package/ecomplus-stores/monocard/functions/ssr/package.json +6 -6
  8. package/ecomplus-stores/monocard/functions/with-apps/package.json +3 -3
  9. package/ecomplus-stores/monocard/package.json +2 -2
  10. package/package.json +2 -2
  11. package/packages/api/lib/api.js +5 -2
  12. package/packages/api/lib/api.js.map +1 -1
  13. package/packages/api/package.json +1 -1
  14. package/packages/api/src/api.ts +5 -2
  15. package/packages/apps/affilate-program/package.json +1 -1
  16. package/packages/apps/correios/package.json +1 -1
  17. package/packages/apps/custom-payment/package.json +1 -1
  18. package/packages/apps/custom-shipping/package.json +1 -1
  19. package/packages/apps/datafrete/package.json +1 -1
  20. package/packages/apps/discounts/package.json +1 -1
  21. package/packages/apps/emails/package.json +1 -1
  22. package/packages/apps/fb-conversions/package.json +1 -1
  23. package/packages/apps/flash-courier/package.json +1 -1
  24. package/packages/apps/frenet/package.json +1 -1
  25. package/packages/apps/galaxpay/package.json +1 -1
  26. package/packages/apps/google-analytics/package.json +1 -1
  27. package/packages/apps/jadlog/lib-mjs/deadlines/range-6.mjs +633 -633
  28. package/packages/apps/jadlog/package.json +1 -1
  29. package/packages/apps/loyalty-points/package.json +1 -1
  30. package/packages/apps/mandae/package.json +1 -1
  31. package/packages/apps/melhor-envio/package.json +1 -1
  32. package/packages/apps/mercadopago/package.json +1 -1
  33. package/packages/apps/pagarme/package.json +1 -1
  34. package/packages/apps/pagarme-v5/package.json +1 -1
  35. package/packages/apps/paghiper/package.json +1 -1
  36. package/packages/apps/pix/package.json +1 -1
  37. package/packages/apps/tiny-erp/package.json +1 -1
  38. package/packages/apps/webhooks/package.json +1 -1
  39. package/packages/cli/config/firebase.json +5 -0
  40. package/packages/cli/package.json +1 -1
  41. package/packages/config/package.json +1 -1
  42. package/packages/emails/package.json +1 -1
  43. package/packages/eslint/package.json +1 -1
  44. package/packages/events/package.json +1 -1
  45. package/packages/feeds/package.json +1 -1
  46. package/packages/firebase/package.json +1 -1
  47. package/packages/i18n/package.json +1 -1
  48. package/packages/modules/lib/firebase/checkout.js +4 -6
  49. package/packages/modules/lib/firebase/checkout.js.map +1 -1
  50. package/packages/modules/lib/firebase/functions-checkout/handle-order-transaction.js +3 -0
  51. package/packages/modules/lib/firebase/functions-checkout/handle-order-transaction.js.map +1 -1
  52. package/packages/modules/package.json +1 -1
  53. package/packages/modules/src/firebase/checkout.ts +4 -6
  54. package/packages/modules/src/firebase/functions-checkout/handle-order-transaction.ts +3 -0
  55. package/packages/passport/package.json +1 -1
  56. package/packages/ssr/package.json +3 -3
  57. package/packages/storefront/.auto-imports.d.ts +1 -1
  58. package/packages/storefront/astro.config.mjs +5 -10
  59. package/packages/storefront/config/astro/mock-pwa-info.mjs +2 -0
  60. package/packages/storefront/dist/client/_astro/AccountPage.6ead88b1.js +1 -0
  61. package/packages/storefront/dist/client/_astro/CartSidebar.8151e4ee.js +1 -0
  62. package/packages/storefront/dist/client/_astro/HeroSlider.46474cda.js +1 -0
  63. package/packages/storefront/dist/client/_astro/PitchBar.fbca6881.js +1 -0
  64. package/packages/storefront/dist/client/_astro/Prices.311303d8.js +1 -0
  65. package/packages/storefront/dist/client/_astro/ProductDetails.d66f9f7e.js +1 -0
  66. package/packages/storefront/dist/client/_astro/ProductShelf.9536b4c1.js +1 -0
  67. package/packages/storefront/dist/client/_astro/QuantitySelector.e74e368a.js +1 -0
  68. package/packages/storefront/dist/client/_astro/SearchModal.83b73e0b.js +1 -0
  69. package/packages/storefront/dist/client/_astro/ShopHeader.06f4d486.js +4 -0
  70. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.dd1a60ce.js +1 -0
  71. package/packages/storefront/dist/client/_astro/_slug_.52cde7a0.css +1 -0
  72. package/packages/storefront/dist/client/_astro/afetch.f4507208.js +1 -0
  73. package/packages/storefront/dist/client/_astro/client.7c1b0374.js +1 -0
  74. package/packages/storefront/dist/client/_astro/customer-session.2d173cc1.js +1 -0
  75. package/packages/storefront/dist/client/_astro/ecom-icon_12falx.png +0 -0
  76. package/packages/storefront/dist/client/_astro/ecom-icon_15pqnO.png +0 -0
  77. package/packages/storefront/dist/client/_astro/ecom-icon_t3guw.png +0 -0
  78. package/packages/storefront/dist/client/_astro/ecom-utils.c385a436.js +1 -0
  79. package/packages/storefront/dist/client/_astro/firebase-app.992a296f.js +16 -0
  80. package/packages/storefront/dist/client/_astro/format-money.8962a5ab.js +1 -0
  81. package/packages/storefront/dist/client/_astro/hoisted.57d8d9d0.js +1 -0
  82. package/packages/storefront/dist/client/_astro/hoisted.f16496bc.js +1 -0
  83. package/packages/storefront/dist/client/_astro/i18n.78f362d9.js +1 -0
  84. package/packages/storefront/dist/client/_astro/img-sizes.41e0efe4.js +1 -0
  85. package/packages/storefront/dist/client/_astro/img.bfbd75a8.js +1 -0
  86. package/packages/storefront/dist/client/_astro/{firebase-app.3f59f3c7.js → index-61e5ac61.bdc8d0cd.js} +129 -99
  87. package/packages/storefront/dist/client/_astro/index.e02b88b7.js +1 -0
  88. package/packages/storefront/dist/client/_astro/index.e20e07e3.js +1 -0
  89. package/packages/storefront/dist/client/_astro/logo_1UBsBq.webp +0 -0
  90. package/packages/storefront/dist/client/_astro/logo_Z1K5PE9.png +0 -0
  91. package/packages/storefront/dist/client/_astro/logo_Z1KIIl1.avif +0 -0
  92. package/packages/storefront/dist/client/_astro/modules-info.3c447a07.js +1 -0
  93. package/packages/storefront/dist/client/_astro/name.3cd31c8b.js +1 -0
  94. package/packages/storefront/dist/client/_astro/photoswipe-lightbox.esm.c157838f.js +4 -0
  95. package/packages/storefront/dist/client/_astro/photoswipe.01431ec7.js +2 -0
  96. package/packages/storefront/dist/client/_astro/photoswipe.esm.92c2d901.js +4 -0
  97. package/packages/storefront/dist/client/_astro/price.04ceb6c4.js +1 -0
  98. package/packages/storefront/dist/client/_astro/rect8589_1TtOHY.png +0 -0
  99. package/packages/storefront/dist/client/_astro/rect8589_Uxfdf.png +0 -0
  100. package/packages/storefront/dist/client/_astro/rect8589_Z15uApA.png +0 -0
  101. package/packages/storefront/dist/client/_astro/rect8589_Z1JT1HB.webp +0 -0
  102. package/packages/storefront/dist/client/_astro/rect8589_tMFW0.avif +0 -0
  103. package/packages/storefront/dist/client/_astro/rect859_DIqwR.png +0 -0
  104. package/packages/storefront/dist/client/_astro/rect859_Z1IKDb2.png +0 -0
  105. package/packages/storefront/dist/client/_astro/rect859_Z2kFHGk.avif +0 -0
  106. package/packages/storefront/dist/client/_astro/rect859_jXzBi.png +0 -0
  107. package/packages/storefront/dist/client/_astro/rect859_x1l16.webp +0 -0
  108. package/packages/storefront/dist/client/_astro/sf-utils.b04e1813.js +1 -0
  109. package/packages/storefront/dist/client/_astro/shopping-cart.6b03b120.js +1 -0
  110. package/packages/storefront/dist/client/_astro/use-analytics.d0c184ef.js +1 -0
  111. package/packages/storefront/dist/client/_astro/use-product-card.e0990572.js +1 -0
  112. package/packages/storefront/dist/client/robots.txt +1 -1
  113. package/packages/storefront/dist/client/~fallback.html +21 -14
  114. package/packages/storefront/dist/client/~index.html +43 -36
  115. package/packages/storefront/dist/server/chunks/CartSidebar_03b51b57.mjs +203 -0
  116. package/packages/storefront/dist/server/chunks/SearchModal_2afca4fe.mjs +18 -0
  117. package/packages/storefront/dist/server/chunks/_.._4def02ff.mjs +6 -0
  118. package/packages/storefront/dist/server/chunks/account_2ee873cf.mjs +6 -0
  119. package/packages/storefront/dist/server/chunks/astro/assets-service_66a9c838.mjs +496 -0
  120. package/packages/storefront/dist/server/chunks/{astro.708269c6.mjs → astro_8447f017.mjs} +208 -1878
  121. package/packages/storefront/dist/server/chunks/index_37bacd45.mjs +6 -0
  122. package/packages/storefront/dist/server/chunks/index_5dcbbe32.mjs +6 -0
  123. package/packages/storefront/dist/server/chunks/node_b3ae36f1.mjs +6 -0
  124. package/packages/storefront/dist/server/chunks/pages/{_...slug_.astro.0808946e.mjs → __80fd1c60.mjs} +1781 -950
  125. package/packages/storefront/dist/server/chunks/pages/account_bfd9a66a.mjs +21 -0
  126. package/packages/storefront/dist/server/chunks/pages/index_8e1d063c.mjs +295 -0
  127. package/packages/storefront/dist/server/chunks/pages/node_530334cf.mjs +160 -0
  128. package/packages/storefront/dist/server/chunks/pages/~fallback_6ff698cd.mjs +30 -0
  129. package/packages/storefront/dist/server/chunks/photoswipe_9528923e.mjs +3 -0
  130. package/packages/storefront/dist/server/chunks/~fallback_7c4b84d5.mjs +6 -0
  131. package/packages/storefront/dist/server/entry.mjs +1012 -2526
  132. package/packages/storefront/dist/server/images.dist.csv +30 -30
  133. package/packages/storefront/dist/server/manifest_2019b8a9.mjs +1069 -0
  134. package/packages/storefront/dist/server/renderers.mjs +335 -51
  135. package/packages/storefront/dist/server/static-builds.csv +66 -51
  136. package/packages/storefront/package.json +4 -5
  137. package/packages/storefront/src/env.d.ts +1 -1
  138. package/packages/storefront/src/images/get-built-image.ts +36 -8
  139. package/packages/storefront/src/images/get-built-picture.ts +3 -130
  140. package/packages/storefront/src/images/picture-base.ts +135 -0
  141. package/packages/storefront/src/images/use-ssr-picture.ts +18 -10
  142. package/packages/storefront/src/lib/components/Picture.astro +47 -4
  143. package/packages/storefront/src/lib/scripts/vbeta-app.ts +4 -1
  144. package/packages/storefront/src/lib/state/modules-info.ts +5 -1
  145. package/packages/test-base/package.json +1 -1
  146. package/packages/types/package.json +1 -1
  147. package/pnpm-workspace.yaml +0 -2
  148. package/packages/storefront/dist/client/_astro/Carousel.4bf71bce.js +0 -1
  149. package/packages/storefront/dist/client/_astro/CartSidebar.05b12b39.js +0 -1
  150. package/packages/storefront/dist/client/_astro/HeroSlider.fe108a14.js +0 -1
  151. package/packages/storefront/dist/client/_astro/PitchBar.2c821b77.js +0 -1
  152. package/packages/storefront/dist/client/_astro/Prices.78eb0a61.js +0 -1
  153. package/packages/storefront/dist/client/_astro/ProductShelf.46d8a51c.js +0 -1
  154. package/packages/storefront/dist/client/_astro/SearchModal.cffd4c2d.js +0 -1
  155. package/packages/storefront/dist/client/_astro/ShopHeader.3694a82b.js +0 -4
  156. package/packages/storefront/dist/client/_astro/_...slug_.a4a7a874.css +0 -1
  157. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.ee681fa8.js +0 -1
  158. package/packages/storefront/dist/client/_astro/api.a2eda23e.js +0 -1
  159. package/packages/storefront/dist/client/_astro/client.e6d9439a.js +0 -1
  160. package/packages/storefront/dist/client/_astro/ecom-icon_CDmhA.png +0 -0
  161. package/packages/storefront/dist/client/_astro/ecom-icon_Z27EX9f.png +0 -0
  162. package/packages/storefront/dist/client/_astro/ecom-icon_Zo1CLq.png +0 -0
  163. package/packages/storefront/dist/client/_astro/format-money.923559cc.js +0 -1
  164. package/packages/storefront/dist/client/_astro/hoisted.648beb9d.js +0 -1
  165. package/packages/storefront/dist/client/_astro/img.ec6ba316.js +0 -1
  166. package/packages/storefront/dist/client/_astro/index.fadf28bd.js +0 -1
  167. package/packages/storefront/dist/client/_astro/logo_144owC.webp +0 -0
  168. package/packages/storefront/dist/client/_astro/logo_1ug3XF.png +0 -0
  169. package/packages/storefront/dist/client/_astro/logo_Z1EIN1I.avif +0 -0
  170. package/packages/storefront/dist/client/_astro/modules-info.df822732.js +0 -1
  171. package/packages/storefront/dist/client/_astro/preload-helper.cf010ec4.js +0 -1
  172. package/packages/storefront/dist/client/_astro/rect8589_1ND0he.png +0 -0
  173. package/packages/storefront/dist/client/_astro/rect8589_1mIaKd.png +0 -0
  174. package/packages/storefront/dist/client/_astro/rect8589_Z2a06Gx.png +0 -0
  175. package/packages/storefront/dist/client/_astro/rect8589_Z2nulUU.webp +0 -0
  176. package/packages/storefront/dist/client/_astro/rect8589_ZH7hsH.avif +0 -0
  177. package/packages/storefront/dist/client/_astro/rect859_1IVKep.png +0 -0
  178. package/packages/storefront/dist/client/_astro/rect859_1zkdb4.webp +0 -0
  179. package/packages/storefront/dist/client/_astro/rect859_CnIof.png +0 -0
  180. package/packages/storefront/dist/client/_astro/rect859_Z1OtQaE.avif +0 -0
  181. package/packages/storefront/dist/client/_astro/rect859_flB3g.png +0 -0
  182. package/packages/storefront/dist/client/_astro/session-utm.744b0db3.js +0 -1
  183. package/packages/storefront/dist/client/_astro/workbox-window.prod.es5.a7b12eab.js +0 -2
  184. package/packages/storefront/dist/client/manifest.webmanifest +0 -1
  185. package/packages/storefront/dist/client/sw.js +0 -1
  186. package/packages/storefront/dist/client/workbox-1b331600.js +0 -1
  187. package/packages/storefront/dist/server/chunks/CartSidebar.4179ad81.mjs +0 -386
  188. package/packages/storefront/dist/server/chunks/SearchModal.146ce2f7.mjs +0 -37
  189. package/packages/storefront/dist/server/chunks/_...05c626ea.mjs +0 -28
  190. package/packages/storefront/dist/server/chunks/account@_@astro.5eaddaf8.mjs +0 -28
  191. package/packages/storefront/dist/server/chunks/index@_@astro.25a343cc.mjs +0 -28
  192. package/packages/storefront/dist/server/chunks/index@_@astro.2d2f2e33.mjs +0 -28
  193. package/packages/storefront/dist/server/chunks/pages/account.astro.32e7e6ef.mjs +0 -23
  194. package/packages/storefront/dist/server/chunks/pages/index.astro.d4145872.mjs +0 -186
  195. package/packages/storefront/dist/server/chunks/pages/~fallback.astro.84d4765b.mjs +0 -49
  196. package/packages/storefront/dist/server/chunks/~fallback@_@astro.86d710c3.mjs +0 -28
  197. package/packages/storefront/dist/server/manifest.webmanifest +0 -1
  198. package/packages/storefront/dist/server/registerSW.js +0 -1
  199. /package/packages/storefront/dist/client/_astro/{headphone_1Ekzdh.avif → headphone_T2Jjc.avif} +0 -0
  200. /package/packages/storefront/dist/client/_astro/{headphone_Z1GbHcH.webp → headphone_Z1CG18r.webp} +0 -0
  201. /package/packages/storefront/dist/client/_astro/{passion_1LvKlp.webp → passion_LHbe9.webp} +0 -0
  202. /package/packages/storefront/dist/client/_astro/{passion_2PSWs.avif → passion_Z23MeUb.avif} +0 -0
  203. /package/packages/storefront/dist/client/_astro/{rect8589_1A8K2Q.webp → rect8589_1f5opX.webp} +0 -0
  204. /package/packages/storefront/dist/client/_astro/{rect8589_ZorpIx.webp → rect8589_IUskt.webp} +0 -0
  205. /package/packages/storefront/dist/client/_astro/{rect8589_Z1NFjiR.avif → rect8589_Z1Ap1Im.avif} +0 -0
  206. /package/packages/storefront/dist/client/_astro/{rect8589_LhopI.avif → rect8589_ZY9mtN.avif} +0 -0
  207. /package/packages/storefront/dist/client/_astro/{rect859_1CcLjM.avif → rect859_1TgQXS.avif} +0 -0
  208. /package/packages/storefront/dist/client/_astro/{rect859_299fN7.avif → rect859_2Nm1z.avif} +0 -0
  209. /package/packages/storefront/dist/client/_astro/{rect859_sLbkT.webp → rect859_Z29FI4V.webp} +0 -0
  210. /package/packages/storefront/dist/client/_astro/{rect859_rsWaw.webp → rect859_ZkpPFI.webp} +0 -0
  211. /package/packages/storefront/dist/client/_astro/{rect89_1yf5jS.avif → rect89_1TSfW7.avif} +0 -0
  212. /package/packages/storefront/dist/client/_astro/{rect89_GQBli.webp → rect89_Z1re32x.webp} +0 -0
@@ -1,20 +1,46 @@
1
- import type { OutputFormat } from '@astrojs/image/dist/loaders/';
2
1
  import { join as joinPath } from 'node:path';
3
2
  import { readFileSync } from 'node:fs';
4
3
 
4
+ export type OutputFormatSupportsAlpha = 'avif' | 'png' | 'webp';
5
+
6
+ export type OutputFormat = OutputFormatSupportsAlpha | 'jpeg' | 'jpg' | 'svg';
7
+
8
+ export interface TransformOptions {
9
+ src: string;
10
+ alt?: string;
11
+ format?: OutputFormat;
12
+ quality?: number;
13
+ width?: number;
14
+ height?: number;
15
+ aspectRatio?: number | `${number}:${number}`;
16
+ background?: string;
17
+ fit?: 'cover' | 'contain' | 'fill' | 'inside' | 'outside';
18
+ position?: 'top' | 'right top' | 'right' | 'right bottom'
19
+ | 'bottom' | 'left bottom' | 'left' | 'left top'
20
+ | 'north' | 'northeast' | 'east' | 'southeast'
21
+ | 'south' | 'southwest' | 'west' | 'northwest'
22
+ | 'center' | 'centre' | 'cover' | 'entropy' | 'attention';
23
+ }
24
+
5
25
  const { STOREFRONT_BASE_DIR } = process.env;
6
26
  const baseDir = STOREFRONT_BASE_DIR || process.cwd();
7
27
  type BuiltImage = { filename: string, width: number, height: number };
8
28
  const builtImages: BuiltImage[] = [];
9
29
  const manifestFilepath = joinPath(baseDir, 'dist/server/images.dist.csv');
10
- readFileSync(manifestFilepath, 'utf-8').split(/\n/).forEach((line) => {
11
- const [filename, width, height] = line.split(',');
12
- builtImages.push({
13
- filename,
14
- width: Number(width),
15
- height: Number(height),
30
+ try {
31
+ readFileSync(manifestFilepath, 'utf-8').split(/\n/).forEach((line) => {
32
+ const [filename, width, height] = line.split(',');
33
+ builtImages.push({
34
+ filename,
35
+ width: Number(width),
36
+ height: Number(height),
37
+ });
16
38
  });
17
- });
39
+ } catch (err) {
40
+ if (global.$renderStorefront) {
41
+ console.error(err);
42
+ }
43
+ }
18
44
  builtImages.sort((a, b) => {
19
45
  if (a.width < b.width) return -1;
20
46
  return 1;
@@ -51,3 +77,5 @@ const getBuiltImage = async ({ src, width, format }: ImageOptions) => {
51
77
  export default getBuiltImage;
52
78
 
53
79
  export { getBuiltImage };
80
+
81
+ export type GetBuiltImage = typeof getBuiltImage;
@@ -1,133 +1,6 @@
1
- import type { HTMLAttributes } from 'astro/types';
2
- // import type { ImageMetadata } from '@astrojs/image/dist/vite-plugin-astro-image';
3
- import type { OutputFormat, TransformOptions } from '@astrojs/image/dist/loaders/';
4
- import mime from 'mime';
1
+ import { createPictureGetter } from './picture-base';
5
2
  import getBuiltImage from './get-built-image';
6
3
 
7
- function removeQueryString(src: string) {
8
- const index = src.lastIndexOf('?');
9
- return index > 0 ? src.substring(0, index) : src;
10
- }
4
+ export const getBuiltPicture = createPictureGetter(getBuiltImage);
11
5
 
12
- function basename(src: string) {
13
- // eslint-disable-next-line
14
- return removeQueryString(src.replace(/^.*[\\\/]/, ''));
15
- }
16
-
17
- const extname = (src: string) => {
18
- const base = basename(src);
19
- const index = base.lastIndexOf('.');
20
- if (index <= 0) {
21
- return '';
22
- }
23
- return base.substring(index);
24
- };
25
-
26
- function parseAspectRatio(aspectRatio: TransformOptions['aspectRatio']) {
27
- if (!aspectRatio) {
28
- return undefined;
29
- }
30
- // Parse aspect ratio strings, if required (ex: "16:9")
31
- if (typeof aspectRatio === 'number') {
32
- return aspectRatio;
33
- }
34
- const [width, height] = aspectRatio.split(':');
35
- return parseInt(width, 10) / parseInt(height, 10);
36
- }
37
-
38
- export interface GetPictureParams {
39
- src: string /* | ImageMetadata | Promise<{ default: ImageMetadata }> */;
40
- alt: string;
41
- widths: number[];
42
- formats: OutputFormat[];
43
- aspectRatio?: TransformOptions['aspectRatio'];
44
- fit?: TransformOptions['fit'];
45
- background?: TransformOptions['background'];
46
- position?: TransformOptions['position'];
47
- }
48
-
49
- export interface GetPictureResult {
50
- image: HTMLAttributes<'img'>;
51
- sources: { type: string; srcset: string }[];
52
- }
53
-
54
- async function resolveAspectRatio({ src, aspectRatio }: GetPictureParams) {
55
- if (typeof src === 'string') {
56
- return parseAspectRatio(aspectRatio);
57
- }
58
- throw new Error('Custom (faster) `Picture.ssr.astro` works only with string ("remote") src');
59
- /*
60
- const metadata = 'then' in src ? (await src).default : src;
61
- return parseAspectRatio(aspectRatio) || metadata.width / metadata.height;
62
- */
63
- }
64
-
65
- async function resolveFormats({ src, formats }: GetPictureParams) {
66
- const unique = new Set(formats);
67
- if (typeof src === 'string') {
68
- unique.add(extname(src).replace('.', '') as OutputFormat);
69
- } else {
70
- throw new Error('Custom `Picture.ssr.astro` works only with string src');
71
- /*
72
- const metadata = 'then' in src ? (await src).default : src;
73
- unique.add(extname(metadata.src).replace('.', '') as OutputFormat);
74
- */
75
- }
76
- return Array.from(unique).filter(Boolean);
77
- }
78
-
79
- export async function getBuiltPicture(params: GetPictureParams): Promise<GetPictureResult> {
80
- const {
81
- src,
82
- alt,
83
- widths,
84
- fit,
85
- position,
86
- background,
87
- } = params;
88
- if (!src) {
89
- throw new Error('[@astrojs/image] `src` is required');
90
- }
91
- if (!widths || !Array.isArray(widths)) {
92
- throw new Error('[@astrojs/image] at least one `width` is required. ex: `widths={[100]}`');
93
- }
94
- const aspectRatio = await resolveAspectRatio(params);
95
- if (!aspectRatio) {
96
- throw new Error('`aspectRatio` must be provided for remote images');
97
- }
98
- // Always include the original image format
99
- const allFormats = await resolveFormats(params);
100
- const lastFormat = allFormats[allFormats.length - 1];
101
- const maxWidth = Math.max(...widths);
102
- let image: HTMLAttributes<'img'>;
103
- async function getSource(format: OutputFormat) {
104
- const imgs = await Promise.all(
105
- widths.map(async (width) => {
106
- const img = await getBuiltImage({
107
- src,
108
- alt,
109
- format,
110
- width,
111
- fit,
112
- position,
113
- background,
114
- aspectRatio,
115
- });
116
- if (format === lastFormat && width === maxWidth) {
117
- image = img;
118
- }
119
- return `${img.src} ${width}w`;
120
- }),
121
- );
122
- return {
123
- type: mime.getType(format) || format,
124
- srcset: imgs.join(','),
125
- };
126
- }
127
- const sources = await Promise.all(allFormats.map((format) => getSource(format)));
128
- return {
129
- sources,
130
- // @ts-ignore
131
- image,
132
- };
133
- }
6
+ export default getBuiltPicture;
@@ -0,0 +1,135 @@
1
+ import type { HTMLAttributes } from 'astro/types';
2
+ import type { OutputFormat, TransformOptions, GetBuiltImage } from './get-built-image';
3
+ import mime from 'mime/lite.js';
4
+
5
+ export interface GetPictureParams {
6
+ src: string /* | ImageMetadata | Promise<{ default: ImageMetadata }> */;
7
+ alt: string;
8
+ widths: number[];
9
+ formats: OutputFormat[];
10
+ aspectRatio?: TransformOptions['aspectRatio'];
11
+ fit?: TransformOptions['fit'];
12
+ background?: TransformOptions['background'];
13
+ position?: TransformOptions['position'];
14
+ }
15
+
16
+ export interface GetPictureResult {
17
+ image: HTMLAttributes<'img'>;
18
+ sources: { type: string; srcset: string }[];
19
+ }
20
+
21
+ function removeQueryString(src: string) {
22
+ const index = src.lastIndexOf('?');
23
+ return index > 0 ? src.substring(0, index) : src;
24
+ }
25
+
26
+ function basename(src: string) {
27
+ // eslint-disable-next-line
28
+ return removeQueryString(src.replace(/^.*[\\\/]/, ''));
29
+ }
30
+
31
+ const extname = (src: string) => {
32
+ const base = basename(src);
33
+ const index = base.lastIndexOf('.');
34
+ if (index <= 0) {
35
+ return '';
36
+ }
37
+ return base.substring(index);
38
+ };
39
+
40
+ function parseAspectRatio(aspectRatio: TransformOptions['aspectRatio']) {
41
+ if (!aspectRatio) {
42
+ return undefined;
43
+ }
44
+ // Parse aspect ratio strings, if required (ex: "16:9")
45
+ if (typeof aspectRatio === 'number') {
46
+ return aspectRatio;
47
+ }
48
+ const [width, height] = aspectRatio.split(':');
49
+ return parseInt(width, 10) / parseInt(height, 10);
50
+ }
51
+
52
+ async function resolveAspectRatio({ src, aspectRatio }: GetPictureParams) {
53
+ if (typeof src === 'string') {
54
+ return parseAspectRatio(aspectRatio);
55
+ }
56
+ throw new Error('Custom (faster) `Picture.runtime.astro` works only with string ("remote") src');
57
+ /*
58
+ const metadata = 'then' in src ? (await src).default : src;
59
+ return parseAspectRatio(aspectRatio) || metadata.width / metadata.height;
60
+ */
61
+ }
62
+
63
+ async function resolveFormats({ src, formats }: GetPictureParams) {
64
+ const unique = new Set(formats);
65
+ if (typeof src === 'string') {
66
+ unique.add(extname(src).replace('.', '') as OutputFormat);
67
+ } else {
68
+ throw new Error('Custom `Picture.ssr.astro` works only with string src');
69
+ /*
70
+ const metadata = 'then' in src ? (await src).default : src;
71
+ unique.add(extname(metadata.src).replace('.', '') as OutputFormat);
72
+ */
73
+ }
74
+ return Array.from(unique).filter(Boolean);
75
+ }
76
+
77
+ export const createPictureGetter = (getImage: GetBuiltImage):
78
+ ((params: GetPictureParams) => Promise<GetPictureResult>) => {
79
+ return async (params) => {
80
+ const {
81
+ src,
82
+ alt,
83
+ widths,
84
+ fit,
85
+ position,
86
+ background,
87
+ } = params;
88
+ if (!src) {
89
+ throw new Error('[@astrojs/image] `src` is required');
90
+ }
91
+ if (!widths || !Array.isArray(widths)) {
92
+ throw new Error('[@astrojs/image] at least one `width` is required. ex: `widths={[100]}`');
93
+ }
94
+ const aspectRatio = await resolveAspectRatio(params);
95
+ if (!aspectRatio) {
96
+ throw new Error('`aspectRatio` must be provided for remote images');
97
+ }
98
+ // Always include the original image format
99
+ const allFormats = await resolveFormats(params);
100
+ const lastFormat = allFormats[allFormats.length - 1];
101
+ const maxWidth = Math.max(...widths);
102
+ let image: HTMLAttributes<'img'>;
103
+ async function getSource(format: OutputFormat) {
104
+ const imgs = await Promise.all(
105
+ widths.map(async (width) => {
106
+ const img = await getImage({
107
+ src,
108
+ alt,
109
+ format,
110
+ width,
111
+ height: width / (aspectRatio as number),
112
+ fit,
113
+ position,
114
+ background,
115
+ aspectRatio,
116
+ });
117
+ if (format === lastFormat && width === maxWidth) {
118
+ image = img;
119
+ }
120
+ return `${img.src} ${width}w`;
121
+ }),
122
+ );
123
+ return {
124
+ type: mime.getType(format) || format,
125
+ srcset: imgs.join(','),
126
+ };
127
+ }
128
+ const sources = await Promise.all(allFormats.map((format) => getSource(format)));
129
+ return {
130
+ sources,
131
+ // @ts-ignore
132
+ image,
133
+ };
134
+ };
135
+ };
@@ -1,12 +1,20 @@
1
- import type { PictureComponentRemoteImageProps } from '@astrojs/image/components/';
2
- import type {
3
- GetPictureParams,
4
- GetPictureResult,
5
- } from '@astrojs/image/dist/lib/get-picture';
6
- import type {
7
- GetPictureParams as GetBuiltPictureParams,
8
- GetPictureResult as GetBuiltPictureResult,
9
- } from './get-built-picture';
1
+ /// <reference types="astro/astro-jsx" />
2
+ import type { HTMLAttributes } from 'astro/types';
3
+ import type { GetPictureParams, GetPictureResult } from './picture-base';
4
+ import type { OutputFormat, TransformOptions } from './get-built-image';
5
+
6
+ export interface PictureComponentRemoteImageProps
7
+ extends astroHTML.JSX.HTMLAttributes,
8
+ TransformOptions,
9
+ Pick<HTMLAttributes<'img'>, 'loading' | 'decoding' | 'fetchpriority'> {
10
+ src: string;
11
+ alt: string;
12
+ widths: number[];
13
+ aspectRatio: TransformOptions['aspectRatio'];
14
+ sizes?: HTMLImageElement['sizes'];
15
+ formats?: OutputFormat[];
16
+ background?: TransformOptions['background'];
17
+ }
10
18
 
11
19
  export type PictureProps = Omit<PictureComponentRemoteImageProps, 'aspectRatio' | 'sizes'> & {
12
20
  sizes?: string;
@@ -31,7 +39,7 @@ const getAspectRatio = (src: string | ImageSize, tryImageSize: TryImageSize) =>
31
39
  export type UsePictureParams = PictureProps & {
32
40
  tryImageSize: TryImageSize;
33
41
  getPicture: ((params: GetPictureParams) => Promise<GetPictureResult>)
34
- | ((params: GetBuiltPictureParams) => Promise<GetBuiltPictureResult>);
42
+ | ((params: GetPictureParams) => Promise<GetPictureResult>);
35
43
  assetsPrefix?: string;
36
44
  };
37
45
 
@@ -1,7 +1,11 @@
1
1
  ---
2
- import { resolve as resolvePath } from 'node:path';
2
+ import type { ImageMetadata } from 'astro';
3
+ import { resolve as resolvePath, basename } from 'node:path';
4
+ import { copyFileSync } from 'node:fs';
5
+ import mime from 'mime/lite.js';
6
+ import { getImage } from 'astro:assets';
3
7
  import imageSize from 'image-size';
4
- import { getPicture } from '@astrojs/image';
8
+ import { createPictureGetter } from '../../images/picture-base';
5
9
  import { type PictureProps, useSSRPicture } from '../../images/use-ssr-picture';
6
10
 
7
11
  export type Props = PictureProps;
@@ -12,7 +16,20 @@ const versionSuffix = import.meta.env.BUILD_OUTPUT !== 'static' && deployRand
12
16
  : '';
13
17
 
14
18
  const getImageFilepath = (src: string) => {
15
- return resolvePath(import.meta.env.STOREFRONT_BASE_DIR, `public${src}`);
19
+ const filepath = resolvePath(import.meta.env.STOREFRONT_BASE_DIR, `public${src}`);
20
+ if (import.meta.env.BUILD_OUTPUT === 'static') {
21
+ try {
22
+ copyFileSync(filepath, resolvePath(
23
+ import.meta.env.STOREFRONT_BASE_DIR,
24
+ import.meta.env.BUILD_OUT_DIR || 'dist/client',
25
+ '_astro',
26
+ basename(filepath),
27
+ ));
28
+ } catch (err) {
29
+ console.error(err);
30
+ }
31
+ }
32
+ return filepath;
16
33
  };
17
34
  const tryImageSize = (src: string) => {
18
35
  let dimensions: { width?: number, height?: number } = {};
@@ -34,7 +51,33 @@ const {
34
51
  } = await useSSRPicture({
35
52
  ...Astro.props,
36
53
  tryImageSize,
37
- getPicture,
54
+ getPicture: createPictureGetter(async (imageOptions) => {
55
+ let imageMetadata: ImageMetadata | undefined;
56
+ if (imageOptions.src.startsWith('/')) {
57
+ const imageFilepath = getImageFilepath(imageOptions.src);
58
+ const { width, height } = tryImageSize(imageOptions.src);
59
+ if (width && height) {
60
+ const mimeType = mime.getType(imageFilepath);
61
+ if (mimeType?.startsWith('image/')) {
62
+ imageMetadata = {
63
+ src: imageFilepath,
64
+ width,
65
+ height,
66
+ // @ts-ignore
67
+ format: mimeType.replace('image/', ''),
68
+ };
69
+ }
70
+ }
71
+ }
72
+ const {
73
+ src,
74
+ attributes: { width, height },
75
+ } = await getImage({
76
+ ...imageOptions,
77
+ src: imageMetadata || imageOptions.src,
78
+ });
79
+ return { src, width, height };
80
+ }),
38
81
  assetsPrefix: Astro.locals.assetsPrefix,
39
82
  });
40
83
  if (imgAttrs) {
@@ -182,6 +182,7 @@ if (!import.meta.env.SSR) {
182
182
  if (Object.keys(utm).length) {
183
183
  sessionStorage.setItem('ecomUtm', JSON.stringify(utm));
184
184
  }
185
+ const { hostname } = window.location;
185
186
  const { domain } = globalThis.$storefront.settings;
186
187
  const apiBaseUri = `https://ecomplus.io/v2/:${window.ECOM_STORE_ID}/`;
187
188
  // @ts-ignore
@@ -193,7 +194,9 @@ if (!import.meta.env.SSR) {
193
194
  // @ts-ignore
194
195
  window.ECOMCLIENT_API_SEARCH = `${apiBaseUri}/search/_els/`;
195
196
  // @ts-ignore
196
- window.ECOMCLIENT_API_MODULES = `https://${domain}/_api/modules/`;
197
+ window.ECOMCLIENT_API_MODULES = hostname !== 'localhost' && hostname !== '127.0.0.1'
198
+ ? `https://${domain}/_api/modules/`
199
+ : '/_api/modules/';
197
200
 
198
201
  const onLoad = () => {
199
202
  const { ecomPassport } = window as Record<string, any>;
@@ -67,8 +67,12 @@ if (!import.meta.env.SSR) {
67
67
  }
68
68
 
69
69
  modulesToFetch.forEach(({ modName, reqOptions }) => {
70
+ const { hostname } = window.location;
70
71
  const { domain } = globalThis.$storefront.settings;
71
- afetch(`https://${domain}/_api/modules/${modName}`, reqOptions)
72
+ const modulesBaseUri = hostname !== 'localhost' && hostname !== '127.0.0.1'
73
+ ? `https://${domain}/_api/modules/`
74
+ : '/_api/modules/';
75
+ afetch(`${modulesBaseUri}${modName}`, reqOptions)
72
76
  .then(async (response) => {
73
77
  if (response.ok) {
74
78
  const modInfo = {};
@@ -2,7 +2,7 @@
2
2
  "name": "@cloudcommerce/test-base",
3
3
  "private": true,
4
4
  "type": "module",
5
- "version": "0.33.4",
5
+ "version": "0.34.0",
6
6
  "description": "E-Com Plus Cloud Commerce basic setup for testing",
7
7
  "main": "lib/index.js",
8
8
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/types",
3
3
  "type": "module",
4
- "version": "0.33.4",
4
+ "version": "0.34.0",
5
5
  "description": "E-Com Plus Cloud Commerce reusable type definitions",
6
6
  "main": "index.ts",
7
7
  "repository": {
@@ -6,5 +6,3 @@ packages:
6
6
  - 'store/functions/*'
7
7
  - 'ecomplus-stores/barra-doce'
8
8
  - 'ecomplus-stores/barra-doce/functions/*'
9
- - 'ecomplus-stores/monocard'
10
- - 'ecomplus-stores/monocard/functions/*'
@@ -1 +0,0 @@
1
- import{a as U,d as G,b as J}from"./index.fadf28bd.js";import{_ as q,d as K,B as X,o as B,a as Q,q as v,b as Y,n as $,i as c,j as h,t as D,c as F,k as Z,E as ee,Q as te,C as ae,l as oe,w as P,u as le,e as M,H as se,I as re}from"./_plugin-vue_export-helper.ee681fa8.js";const ne=K({__name:"CarouselControl",props:{isPrev:{type:Boolean,default:!1}},setup(r,{expose:u}){u();const{changeSlide:l}=X(L),t={changeSlide:l};return Object.defineProperty(t,"__isScriptSetup",{enumerable:!1,value:!0}),t}}),ue=["aria-label","data-carousel-control"];function ie(r,u,l,t,n,o){return B(),Q("button",{type:"button","aria-label":l.isPrev?"Anterior":"Próximo",onClick:u[0]||(u[0]=m=>t.changeSlide(l.isPrev?-1:1)),class:$(["group absolute top-0 z-1",l.isPrev?"left-0":"right-0"]),"data-carousel-control":l.isPrev?"previous":"next"},[v(r.$slots,"default",{},()=>[Y("i",{class:$(["m-0",l.isPrev?"i-chevron-left group-active:-translate-x-1":"i-chevron-right group-active:translate-x-1"])},null,2)])],10,ue)}const ce=q(ne,[["render",ie]]),L=Symbol("carousel"),de=K({__name:"Carousel",props:{as:{default:"ul"},modelValue:{default:1},autoplay:{}},emits:["update:modelValue"],setup(r,{expose:u,emit:l}){u();const t=r,n=c(0);h(D(t,"modelValue"),e=>{n.value=e-1},{immediate:!0}),h(n,(e,a)=>{e!==a&&l("update:modelValue",e+1)});const o=c(null),{x:m,isScrolling:T,arrivedState:_}=U(o),W=F(()=>_.left),I=F(()=>_.right),s=c([]),g=c(0),p=c(0),k=c(0),V=()=>{o.value&&(g.value=o.value.scrollWidth,p.value=o.value.offsetWidth)},z=()=>{if(!o.value)return;let e=[...o.value.children];e.length===1&&e[0].tagName.endsWith("SLOT")&&(e=[...e[0].children]),s.value=e.map(a=>({offsetLeft:a.offsetLeft,width:a.offsetWidth}))},E=e=>{let a=n.value+e;if(a>=s.value.length)return 0;a<0&&(a=s.value.length+a);const{offsetLeft:y,width:d}=s.value[a]||{};return d?y:0},x=()=>{const e=s.value.findIndex(a=>Math.abs(a.offsetLeft-m.value)<=5);e>-1&&(n.value=e||0)},O=()=>{const e=g.value-p.value;k.value=s.value.findIndex(({offsetLeft:a})=>a>=e-5)};let i;const f=()=>{t.autoplay&&(clearTimeout(i),i=setTimeout(()=>{C(1)},t.autoplay))},C=(e,a=!0)=>{if(s.value.length<2)return;if(a&&(e===1||e===-1)){let d=0,A=0;for(let S=n.value;S<s.value.length;S++){const{width:H}=s.value[S]||{};if(H&&(d+=1,A+=H,A>=p.value))break}d&&(e=e>0?d:-d)}const y=E(e);o.value?.scrollTo({left:y,behavior:"smooth"}),f()};h(T,e=>{e?clearTimeout(i):(x(),f())});const R=c(null),N=G(R);h(N,e=>{e?clearTimeout(i):f()});const b=()=>{o.value&&(V(),z(),x(),O())},w=J(()=>{o.value&&(o.value.scrollLeft=0,b())},400);Z(()=>{b(),ee(()=>{o.value&&[...o.value.children].forEach(e=>{e.setAttribute("tabindex","0")})}),f(),window.addEventListener("resize",w)}),te(()=>{window.removeEventListener("resize",w),clearTimeout(i)}),ae(L,{autoplay:D(t,"autoplay"),changeSlide:C,isBoundLeft:W,isBoundRight:I});const j={carouselKey:L,props:t,emit:l,currentIndex:n,wrapper:o,currentPos:m,isScrolling:T,arrivedState:_,isBoundLeft:W,isBoundRight:I,slidesWidth:s,wrapperScrollWidth:g,wrapperVisibleWidth:p,indexCount:k,calcWrapperWidth:V,calcSlidesWidth:z,calcNextOffsetLeft:E,calcCurrentIndex:x,calcIndexCount:O,get autoplayTimer(){return i},set autoplayTimer(e){i=e},restartAutoplay:f,changeSlide:C,carousel:R,isHovered:N,calcOnInit:b,onResize:w,CarouselControl:ce};return Object.defineProperty(j,"__isScriptSetup",{enumerable:!1,value:!0}),j}}),fe={ref:"carousel",class:"relative","data-carousel":""};function ve(r,u,l,t,n,o){return B(),Q("div",fe,[(B(),oe(le(l.as),{ref:"wrapper",class:"flex overflow-x-scroll overflow-y-hidden list-none m-0 p-0 snap-x snap-mandatory scroll-smooth [&>*]:snap-start [&>*]:outline-none",style:{"scrollbar-width":"none","-webkit-overflow-scrolling":"touch","-ms-overflow-style":"none"},"data-carousel-wrapper":""},{default:P(()=>[v(r.$slots,"default")]),_:3},512)),v(r.$slots,"controls",se(re({changeSlide:t.changeSlide,isBoundLeft:t.isBoundLeft,isBoundRight:t.isBoundRight,currentPage:t.currentIndex+1,pageCount:t.indexCount+1})),()=>[M(t.CarouselControl,{"is-prev":""},{default:P(()=>[v(r.$slots,"previous")]),_:3}),M(t.CarouselControl,null,{default:P(()=>[v(r.$slots,"next")]),_:3})])],512)}const me=q(de,[["render",ve]]);export{me as C,ce as a};
@@ -1 +0,0 @@
1
- import{d as g,c as m,_ as x,o as i,a as c,q as b,B as P,F as v,y as h,p as C,i as F,C as j,b as a,x as d,H as w,I as M,f as q,$ as Q,e as _,w as y,r as B,l as z,h as k,g as L}from"./_plugin-vue_export-helper.ee681fa8.js";import{f as N}from"./modules-info.df822732.js";import{p as U,r as A,s as O,t as $}from"./api.a2eda23e.js";import{g as T,P as V}from"./Prices.78eb0a61.js";import{g as E}from"./img.ec6ba316.js";import{e as D}from"./index.fadf28bd.js";import"./session-utm.744b0db3.js";import"./format-money.923559cc.js";const R=g({__name:"CheckoutLink",props:{to:{default:"cart"},cartUrl:{default:globalThis.$storefront.settings.cart_url||"/app/#/cart"},checkoutUrl:{default:globalThis.$storefront.settings.checkout_url||"/app/#/checkout"}},setup(r,{expose:s}){s();const t=r,e=m(()=>t.to==="cart"?t.cartUrl:t.checkoutUrl),n={props:t,href:e};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),H=["href"];function K(r,s,t,e,n,l){return i(),c("a",{href:e.href},[b(r.$slots,"default")],8,H)}const G=x(R,[["render",K]]),J=r=>{const s=m(()=>!r.item&&r.product?U(r.product):null),t=m(()=>r.item||s.value),e=m(()=>T(t.value)),n=m(()=>{const{slug:u}=t.value;return typeof u=="string"?`/${u}`:null}),l=m(()=>{if(t.value.picture)return E(t.value.picture,void 0,r.pictureSize||"small")}),o=m(()=>t.value.final_price||t.value.price);return{cartItem:t,title:e,link:n,image:l,finalPrice:o}},W=g({__name:"QuantitySelectorControl",props:{isMinus:{type:Boolean}},setup(r,{expose:s}){s();const{value:t,isBoundMin:e,isBoundMax:n}=P(S),l={value:t,isBoundMin:e,isBoundMax:n};return Object.defineProperty(l,"__isScriptSetup",{enumerable:!1,value:!0}),l}}),X=["data-quantity-selector-control","aria-label","disabled"];function Y(r,s,t,e,n,l){return i(),c("button",{type:"button",class:"w-10 h-12 text-xl leading-12 enabled:text-primary enabled:hover:bg-primary-100/70 disabled:opacity-40","data-quantity-selector-control":t.isMinus?"minus":"plus","aria-label":t.isMinus?"Menos":"Mais",disabled:t.isMinus?e.isBoundMin:e.isBoundMax,onClick:s[0]||(s[0]=C(o=>e.value+=t.isMinus?-1:1,["prevent"]))},[b(r.$slots,"default",{},()=>[t.isMinus?(i(),c(v,{key:0},[h("−")],64)):(i(),c(v,{key:1},[h("+")],64))])],8,X)}const Z=x(W,[["render",Y]]),S=Symbol("quantitySelector"),ee=g({__name:"QuantitySelector",props:{modelValue:{default:1},min:{default:1},max:{},step:{},disabled:{type:Boolean},readonly:{type:Boolean}},emits:["update:modelValue"],setup(r,{expose:s,emit:t}){s();const e=r,n=F(null),l=`NInput${D()}`,o=m({get(){return e.modelValue},set(f){f<e.min&&(f=e.min,n.value.value=`${f}`),e.max&&f>e.max&&(f=e.max,n.value.value=`${f}`),t("update:modelValue",f)}}),u=m(()=>e.min>=o.value),p=m(()=>e.max<=o.value);j(S,{value:o,isBoundMin:u,isBoundMax:p});const I={quantitySelectorKey:S,props:e,emit:t,input:n,inputId:l,value:o,isBoundMin:u,isBoundMax:p,QuantitySelectorControl:Z};return Object.defineProperty(I,"__isScriptSetup",{enumerable:!1,value:!0}),I}}),te={"data-quantity-selector":""},re={class:"flex items-center"},se=["min","max","step","disabled","readonly"];function ae(r,s,t,e,n,l){return i(),c("div",te,[b(r.$slots,"label",w(M({inputId:e.inputId,value:e.value})),()=>[a("label",{for:e.inputId,class:"sr-only"},d("Quantidade"))]),a("div",re,[q(a("input",{ref:"input",type:"number",id:e.inputId,"onUpdate:modelValue":s[0]||(s[0]=o=>e.value=o),min:t.min,max:t.max,step:t.step,disabled:t.disabled,readonly:t.readonly,class:"h-12 w-14 px-2 text-lg border-transparent text-center [-moz-appearance:_textfield] [&::-webkit-outer-spin-button]:m-0 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:m-0 [&::-webkit-inner-spin-button]:appearance-none"},null,8,se),[[Q,e.value]]),b(r.$slots,"controls",w(M({value:e.value,isBoundMin:e.isBoundMin,isBoundMax:e.isBoundMax})),()=>[_(e.QuantitySelectorControl,{"is-minus":"",class:"order-first"},{default:y(()=>[b(r.$slots,"minus")]),_:3}),_(e.QuantitySelectorControl,{class:"order-last"},{default:y(()=>[b(r.$slots,"plus")]),_:3})])])])}const ne=x(ee,[["render",ae]]),oe=g({__name:"CartItem",props:{item:{},product:{},pictureSize:{}},setup(r,{expose:s}){s();const t=r,{cartItem:e,title:n,link:l,image:o,finalPrice:u}=J(t),p={props:t,cartItem:e,title:n,link:l,image:o,finalPrice:u,get removeCartItem(){return A},QuantitySelector:ne,Prices:V};return Object.defineProperty(p,"__isScriptSetup",{enumerable:!1,value:!0}),p}}),ie={class:"relative bg-white shadow-sm"},le={class:"py-2 flex-auto text-sm text-base-700 group-hover:text-base-900 group-hover:underline"},ce=a("span",{class:"w-5 h-5 text-sm leading-none flex flex-col justify-center rounded-full border-3 text-danger-800 border-danger-700/30"},[a("i",{class:"i-close my-0 mx-auto"})],-1),ue=[ce],de={class:"flex justify-between items-center border-t-2 border-base-100"},me={class:"border-r-2 border-base-100"};function pe(r,s,t,e,n,l){const o=B("AImg"),u=B("ALink");return i(),c("article",ie,[_(u,{href:e.link,class:"flex items-center gap-5 p-4 group"},{default:y(()=>[e.image?(i(),z(o,{key:0,picture:e.image,alt:e.title,class:"w-20 h-20 object-cover"},null,8,["picture","alt"])):k("",!0),a("p",le,d(e.title),1)]),_:1},8,["href"]),e.cartItem._id?(i(),c("button",{key:0,onClick:s[0]||(s[0]=C(p=>e.removeCartItem(e.cartItem._id),["stop"])),class:"absolute top-0 right-0 p-2 opacity-70 hover:opacity-100","aria-label":"Remover"},ue)):k("",!0),a("div",de,[a("div",me,[_(e.QuantitySelector,{modelValue:e.cartItem.quantity,"onUpdate:modelValue":s[1]||(s[1]=p=>e.cartItem.quantity=p),min:e.cartItem.min_quantity,max:e.cartItem.max_quantity},null,8,["modelValue","min","max"])]),_(e.Prices,{"base-price":e.cartItem.base_price,price:e.finalPrice,"has-cashback":!1,"has-price-options":!1,class:"px-4 py-2.5 text-[95%] text-right"},null,8,["base-price","price"])])])}const _e=x(oe,[["render",pe]]),fe=g({__name:"CartSidebar",emits:["close"],setup(r,{expose:s,emit:t}){s();const e={emit:t,get freeShippingFromValue(){return N},get shoppingCart(){return O},get totalItems(){return $},CheckoutLink:G,Prices:V,CartItem:_e};return Object.defineProperty(e,"__isScriptSetup",{enumerable:!1,value:!0}),e}}),be={class:"flex flex-col h-screen bg-white"},he={class:"px-6 py-4 flex justify-end items-center gap-3 shadow ring-1 ring-black/5 z-10"},ge=a("span",{class:"text-right text-base text-base-600 font-medium"},d("Meu carrinho de compras"),-1),xe={class:"min-w-[3rem] text-right"},ye={class:"ui-badge-pill-lg"},ve={class:"grow overflow-y-auto bg-base-50"},ke={key:0,class:"text-sm text-center"},Se={key:0,class:"p-3 secondary-subtle"},Ce=a("strong",{class:"lowercase"},d("Frete grátis"),-1),Ie={key:1,class:"p-3 bg-success-50 text-success-800"},we=a("i",{class:"text-success-900 i-check mr-1"},null,-1),Me={class:"px-4 pt-4 pb-2"},Be={class:"px-5 pt-4 pb-3 ring-2 ring-black/5 z-10"},Ve={class:"grid grid-cols-5 gap-3 items-center text-right"},Pe=a("div",{class:"col-span-2"},d("Subtotal"),-1),Fe=a("i",{class:"i-check mr-2"},null,-1),je=a("i",{class:"i-arrow-left mr-1"},null,-1);function qe(r,s,t,e,n,l){return i(),c("aside",be,[a("header",he,[ge,a("span",xe,[a("span",ye,d(e.totalItems),1)])]),a("article",ve,[e.freeShippingFromValue?(i(),c("div",ke,[e.freeShippingFromValue>e.shoppingCart.subtotal?(i(),c("div",Se,[h(d("Adicione $1 para ganhar".replace("$1",r.$money(e.freeShippingFromValue-e.shoppingCart.subtotal)))+" ",1),Ce])):(i(),c("div",Ie,[we,h(" "+d("Frete grátis a partir de")+" "+d(r.$money(e.freeShippingFromValue)),1)]))])):k("",!0),a("ul",Me,[(i(!0),c(v,null,L(e.shoppingCart.items,(o,u)=>(i(),c("li",{key:u},[_(e.CartItem,{item:o,class:"mb-3"},null,8,["item"])]))),128))])]),a("footer",Be,[a("div",Ve,[Pe,_(e.Prices,{price:e.shoppingCart.subtotal,class:"col-span-3 text-lg"},null,8,["price"])]),_(e.CheckoutLink,{class:"ui-btn-lg ui-btn-primary w-full text-right my-2.5"},{default:y(()=>[Fe,h(" "+d("Finalizar compra"))]),_:1}),a("a",{href:"#",onClick:s[0]||(s[0]=C(o=>e.emit("close"),["prevent"])),class:"ui-link text-base-500 hover:text-base-700 text-sm"},[je,h(" "+d("Continuar comprando"))])])])}const Te=x(fe,[["render",qe]]);export{Te as default};
@@ -1 +0,0 @@
1
- import{c as d,_ as v,d as w,r as C,o as r,a as i,e as u,w as o,q as y,n as x,l as g,y as b,x as f,u as T,h as m,f as k,v as S,b as _,F as B,g as H,K as L}from"./_plugin-vue_export-helper.ee681fa8.js";import{C as j,a as N}from"./Carousel.4bf71bce.js";import{p}from"./modules-info.df822732.js";import"./index.fadf28bd.js";import"./session-utm.744b0db3.js";import"./format-money.923559cc.js";const P=s=>{const a=d(()=>s.title?p(s.title).value:""),t=d(()=>s.subtitle?p(s.subtitle).value:""),e=d(()=>s.buttonText?p(s.buttonText).value:""),c=d(()=>!!(a.value||t.value||e.value));return{parsedTitle:a,parsedSubtitle:t,parsedButtonText:e,hasHeader:c}},V=w({__name:"Banner",props:{img:{},alt:{},mobileImg:{},href:{},title:{},subtitle:{},buttonLink:{},buttonText:{},headingTag:{default:"h3"}},setup(s,{expose:a}){a();const t=s,{hasHeader:e,parsedTitle:c,parsedSubtitle:h,parsedButtonText:l}=P(t),n={props:t,hasHeader:e,parsedTitle:c,parsedSubtitle:h,parsedButtonText:l};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),D={key:0,class:"p-12 xl:ps-32 mb-3 sm:mb-0"},z={key:1,class:"text-lg mt-4 md:mt-6"};function A(s,a,t,e,c,h){const l=C("ALink");return r(),i("div",{class:x(["mx-auto overflow-x-hidden",e.hasHeader?"grid grid-cols-1 sm:grid-cols-2 items-center":null])},[u(l,{href:t.href,class:x(e.hasHeader?"sm:order-last [&_img]:max-w-full sm:[&_img]:max-w-none [&_img]:aspect-video sm:[&_img]:aspect-[2.5] [&_img]:object-cover":"[&_img]:max-w-full")},{default:o(()=>[y(s.$slots,"picture")]),_:3},8,["href","class"]),e.hasHeader?(r(),i("div",D,[e.parsedTitle?(r(),g(T(t.headingTag),{key:0,class:"ui-title mt-1"},{default:o(()=>[b(f(e.parsedTitle),1)]),_:1})):m("",!0),e.parsedSubtitle?(r(),i("p",z,f(e.parsedSubtitle),1)):m("",!0),e.parsedButtonText?(r(),g(l,{key:2,href:t.buttonLink,class:"ui-btn-lg ui-btn-contrast min-w-[150px] mt-7 md:mt-10"},{default:o(()=>[b(f(e.parsedButtonText),1)]),_:1},8,["href"])):m("",!0)])):m("",!0)],2)}const F=v(V,[["render",A]]),O=w({__name:"HeroSlider",props:{autoplay:{},slides:{}},setup(s,{expose:a}){a();const t={Carousel:j,CarouselControl:N,Banner:F};return Object.defineProperty(t,"__isScriptSetup",{enumerable:!1,value:!0}),t}}),q={class:"relative mx-auto"},E={class:"absolute z-10 bottom-5 flex justify-end items-center w-screen right-5 xl:right-auto xl:max-w-screen-xl xl:left-1/2 xl:-ms-[640px]"},I={class:"relative w-20 h-10 rounded-full bg-white/50 text-primary shadow-sm ring-1 ring-black/5"},K=_("i",{class:"i-arrow-left"},null,-1),G=_("i",{class:"i-arrow-right"},null,-1);function J(s,a,t,e,c,h){return r(),i("section",q,[u(e.Carousel,{autoplay:t.autoplay,class:"secondary [&>*]:items-center"},{controls:o(()=>[k(_("div",E,[_("div",I,[u(e.CarouselControl,{class:"w-10 h-10 rounded-full hover:bg-primary/10","is-prev":""},{default:o(()=>[K]),_:1}),u(e.CarouselControl,{class:"w-10 h-10 rounded-full hover:bg-primary/10"},{default:o(()=>[G]),_:1})])],512),[[S,t.slides.length>1]])]),default:o(()=>[(r(!0),i(B,null,H(t.slides,(l,n)=>(r(),i("li",{key:n,class:"shrink-0 basis-full"},[u(e.Banner,L({...l,headingTag:n===0?"h2":"h3"},{class:"w-screen max-w-screen-2xl"}),{picture:o(()=>[y(s.$slots,`picture-${n}`)]),_:2},1040)]))),128))]),_:3},8,["autoplay"])])}const Y=v(O,[["render",J]]);export{Y as default};
@@ -1 +0,0 @@
1
- import{s as m,c as u,_ as f,d as v,r as C,a as o,b as _,e as i,w as p,o as l,f as g,v as b,F as w,g as x,n as S,h as y}from"./_plugin-vue_export-helper.ee681fa8.js";import{p as k}from"./modules-info.df822732.js";import{C as B,a as L}from"./Carousel.4bf71bce.js";import"./session-utm.744b0db3.js";import"./index.fadf28bd.js";import"./format-money.923559cc.js";function P(t,s){{const a=btoa(JSON.stringify({filename:t}));window.parent.postMessage(JSON.parse(JSON.stringify({type:"open",filename:t,id:a})),window.location.origin),window.addEventListener("message",e=>{e.data.id===a&&s(e.data.data)})}}const V=t=>{const s=m(null);return window.$isCmsPreview&&P(t,a=>{s.value=a}),{liveContent:s}},N=t=>{const s={slides:[]};return t.header?.pitch_bar&&(s.slides=t.header.pitch_bar),s},O=t=>{const{liveContent:s}=V("layout"),a=u(()=>(s.value?N(s.value).slides:t.slides).map(({html:n})=>k(n).value.replace(/<\/?p>/g,"").replace(/&lt;(\/?d-md)&gt;/g,"<$1>"))),e=u(()=>a.value.filter(r=>r).length);return{parsedContents:a,countValidSlides:e}},J=v({__name:"PitchBar",props:{slides:{}},setup(t,{expose:s}){s();const a=t,{parsedContents:e,countValidSlides:r}=O(a),n={props:a,parsedContents:e,countValidSlides:r,Carousel:B,CarouselControl:L};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),M={class:"bg-base-100 relative z-20"},z={class:"container md:w-2/3 mx-auto px-3 py-1"},A=["innerHTML"],E={class:"text-xl leading-none text-base-400"};function F(t,s,a,e,r,n){const h=C("ALink");return l(),o("div",M,[_("div",z,[i(e.Carousel,{autoplay:e.countValidSlides>1?7e3:void 0},{controls:p(()=>[g(_("div",E,[i(e.CarouselControl,{class:"pr-2 bg-base-100 hover:text-base-700","is-prev":""}),i(e.CarouselControl,{class:"pl-2 bg-base-100 hover:text-base-700"})],512),[[b,e.countValidSlides>1]])]),default:p(()=>[(l(!0),o(w,null,x(a.slides,(c,d)=>(l(),o("li",{key:d,class:"shrink-0 basis-full h-full text-center"},[i(h,{href:c.href,target:c.target,class:S(["inline-block px-8",c.href?"hover:underline":null])},{default:p(()=>[e.parsedContents[d]?(l(),o("span",{key:0,innerHTML:e.parsedContents[d],class:"prose text-sm text-base-800"},null,8,A)):y("",!0)]),_:2},1032,["href","target","class"])]))),128))]),_:1},8,["autoplay"])])])}const q=f(J,[["render",F]]);export{q as default};
@@ -1 +0,0 @@
1
- import{a0 as W,c as r,N as g,O as A,_ as z,d as S,r as E,o,a as l,x as i,h as c,b as h,y as D,n as w,e as B,w as L}from"./_plugin-vue_export-helper.ee681fa8.js";import{i as M}from"./img.ec6ba316.js";import{a as T,i as F,d as R,l as q}from"./modules-info.df822732.js";const G=(n,a=W.get("lang"))=>a&&n.i18n&&n.i18n[a]?n.i18n[a]:n.name||n.title||M(n.i18n,a)||"",de=G,C=(n,a)=>{const{type:s,value:e}=a;let _;return e?(s==="percentage"?_=n*((100-e)/100):_=n-e,_>0?_:0):n},H=n=>{const a=r(()=>n.product||{price:n.price||0,base_price:n.basePrice}),s=r(()=>{const{variations:t}=a.value;if(t){const u=g(a.value);for(let P=0;P<t.length;P++)if(g({...a.value,...t[P]})>u)return!0}return!1}),e=r(()=>{const t=g(a.value),u=T.value;return u&&(!u.min_amount||t>u.min_amount)?C(t,u):t}),_=r(()=>{if(A(a.value))return a.value.base_price;const t=g(a.value);return t>e.value?t:0}),d=r(()=>n.installmentsOption||F.value||{max_number:1}),m=r(()=>{if(d.value.max_number<=1)return 1;const t=d.value.min_installment||5,u=Math.floor(e.value/t);return Math.min(u,d.value.max_number)}),f=r(()=>d.value.monthly_interest||0),k=r(()=>{if(m.value>=2){if(!f.value)return e.value/m.value;const t=f.value/100;return e.value*t/(1-(1+t)**-m.value)}return 0}),b=r(()=>{const t=n.discountOption||R.value;return t&&(!t.min_amount||t.min_amount<=e.value)&&(!n.isAmountTotal||t.apply_at==="total")?t:{}}),O=r(()=>{const{label:t}=b.value;return t?t.includes(" ")?t:`via ${t}`:""}),x=r(()=>C(e.value,b.value)),v=r(()=>{if(n.loyaltyPointsProgram)return n.loyaltyPointsProgram;const t=q.value;if(t){const u=Object.keys(t);for(let P=0;P<u.length;P++){const p=t[u[P]];if(p?.earn_percentage&&p.earn_percentage>0)return p}}return{ratio:0}}),y=r(()=>v.value.min_subtotal_to_earn||0),j=r(()=>v.value.name||""),N=r(()=>v.value.earn_percentage||0),V=r(()=>N.value*v.value.ratio),I=r(()=>V.value>=1?e.value*(V.value/100):0);return{hasVariedPrices:s,salePrice:e,comparePrice:_,installmentsObject:d,installmentsNumber:m,monthlyInterest:f,installmentValue:k,discountObject:b,discountLabel:O,priceWithDiscount:x,pointsProgramObject:v,pointsMinPrice:y,pointsProgramName:j,earnPointsPercentage:N,cashbackPercentage:V,cashbackValue:I}},J=S({__name:"Prices",props:{isBig:{type:Boolean},isLiteral:{type:Boolean},hasCashback:{type:Boolean,default:!0},hasPriceOptions:{type:Boolean,default:!0},product:{},price:{},basePrice:{},isAmountTotal:{type:Boolean},installmentsOption:{},discountOption:{},loyaltyPointsProgram:{}},setup(n,{expose:a}){a();const s=n,{hasVariedPrices:e,salePrice:_,comparePrice:d,cashbackPercentage:m,cashbackValue:f,installmentsNumber:k,monthlyInterest:b,installmentValue:O,priceWithDiscount:x,discountLabel:v}=H(s),y={props:s,hasVariedPrices:e,salePrice:_,comparePrice:d,cashbackPercentage:m,cashbackValue:f,installmentsNumber:k,monthlyInterest:b,installmentValue:O,priceWithDiscount:x,discountLabel:v};return Object.defineProperty(y,"__isScriptSetup",{enumerable:!1,value:!0}),y}}),K={key:0,class:"text-base-500 mr-1 text-[87%]"},Q={key:0},U={key:1},X={key:0},Y={key:0,class:"relative z-10"},Z=["data-tooltip"],$=h("i",{class:"i-arrow-uturn-left mr-1"},null,-1),ee={class:"font-medium"},te=h("small",null," cashback",-1),ne={key:0},ae={key:0},se={key:1},re={key:2},ie={key:0},oe={key:0},le={key:1};function ce(n,a,s,e,_,d){const m=E("Fade");return o(),l("div",{class:w(["text-base-600 [&>div]:[font-size:90%] [&_small]:[font-size:92%] [&_small]:lowercase",s.isBig?"text-lg":null])},[e.comparePrice?(o(),l("span",K,[s.isLiteral?(o(),l("small",Q,i("De "))):c("",!0),h("s",null,i(n.$money(e.comparePrice)),1),s.isLiteral?(o(),l("small",U,i(" Por"))):c("",!0)])):c("",!0),h("strong",{class:w(["inline-block text-base-800",s.isBig?"text-5xl block":null])},[e.hasVariedPrices?(o(),l("small",X,i("A partir de "))):c("",!0),D(" "+i(n.$money(e.salePrice)),1)],2),B(m,{slide:"down"},{default:L(()=>[e.cashbackValue&&s.hasCashback?(o(),l("div",Y,[h("span",{"data-tooltip":"Receba $1 de volta".replace("$1",n.$percentage(e.cashbackPercentage))},[$,h("span",ee,i(n.$money(e.cashbackValue)),1),te],8,Z)])):c("",!0)]),_:1}),B(m,{slide:"down"},{default:L(()=>[e.installmentValue&&s.hasPriceOptions?(o(),l("div",ne,[s.isLiteral?(o(),l("small",ae,i("Até "))):c("",!0),D(" "+i(e.installmentsNumber)+"x ",1),s.isLiteral?(o(),l("small",se,i(" De "))):c("",!0),h("span",null,i(n.$money(e.installmentValue)),1),!e.monthlyInterest&&s.isLiteral?(o(),l("small",re,i(" Sem juros"))):c("",!0)])):c("",!0)]),_:1}),B(m,{slide:"down"},{default:L(()=>[e.priceWithDiscount<e.salePrice&&s.hasPriceOptions?(o(),l("div",ie,[e.discountLabel?c("",!0):(o(),l("small",oe,i("A partir de "))),h("span",null,i(n.$money(e.priceWithDiscount)),1),e.discountLabel?(o(),l("small",le,i(` ${e.discountLabel}`),1)):c("",!0)])):c("",!0)]),_:1})],2)}const he=z(J,[["render",ce]]);export{he as P,de as g};
@@ -1 +0,0 @@
1
- import{i as p,M as j,N as L,c as b,O as Q,_ as V,d as B,r as A,o as l,a as d,e as m,w as C,b as _,l as O,h as S,y as x,x as w,u as T,n as E,p as q,f as M,v as F,F as H,g as z}from"./_plugin-vue_export-helper.ee681fa8.js";import{a as I,b as D}from"./api.a2eda23e.js";import{C as R,a as G}from"./Carousel.4bf71bce.js";import{d as J,c as K}from"./index.fadf28bd.js";import{g as U,P as W}from"./Prices.78eb0a61.js";import{g as X}from"./img.ec6ba316.js";import"./modules-info.df822732.js";import"./session-utm.744b0db3.js";import"./format-money.923559cc.js";const Y=e=>e&&e.min_quantity||1,Z=Y,$=e=>!e.hasOwnProperty("quantity")||e.quantity>=Z(e),N=$,tt=e=>{const a=p(e.title||""),i=p(e.titleLink||""),t=p(!1);let u=null;const r=p(null),c=j(e.products||[]);return e.products||(t.value=!0,u=(async()=>{let s=e.searchQuery||"",h;if(e.collectionId){try{const{data:o}=await I.get(`collections/${e.collectionId}`);h=o}catch(o){console.error(o),r.value=o}const n=h?.products;Array.isArray(n)&&n.length&&(s+=`&_id=${n.slice(0,60).join(",")}`),!a.value&&a.value!==null&&h?.name&&(a.value=h?.name)}const v=e.limit||24;let f=`offset=${e.page?(e.page-1)*v:0}&limit=${v}`;e.sort&&(f+=`&sort=${e.sort}`),f+=s;try{const{data:n}=await I.get(`search/v1?${f}`);if(e.isShuffle){let o=n.result.filter(k=>k.available&&N(k)).length,g,y;for(;o;)y=Math.floor(Math.random()*o--),g=n.result[o],n.result[o]=n.result[y],n.result[y]=g}n.result.forEach(o=>c.push(o))}catch(n){console.error(n),r.value=n}t.value=!1})()),{title:a,titleLink:i,isFetching:t,fetching:u,fetchError:r,products:c}},et=e=>{const a=p(!1);let i=null;const t=p(null),{productId:u}=e,r=j({...e.product,_id:e.product?._id||u,price:L(e.product||{})});!e.product&&u&&(a.value=!0,i=(async()=>{try{const{data:o}=await I.get(`products/${u}`);Object.assign(r,o)}catch(o){console.error(o),t.value=o}a.value=!1})());const c=b(()=>U(r)),s=b(()=>{const{slug:o}=r;return typeof o=="string"?`/${o}`:null}),h=b(()=>{const{pictures:o}=r,g=[];return o&&o.forEach(y=>{const k=X(y);k&&g.push(k)}),g}),v=b(()=>N(r)),P=b(()=>v.value&&r.available&&r.visible),f=b(()=>{if(Q(r)){const o=r.base_price;return Math.round((o-L(r))*100/o)}return 0}),n=b(()=>r.has_variations?!0:!!r.variations?.length);return{isFetching:a,fetching:i,fetchError:t,product:r,title:c,link:s,images:h,isInStock:v,isActive:P,discountPercentage:f,hasVariations:n}},ot=B({__name:"ProductCard",props:{product:{},productId:{},headingTag:{default:"h3"}},setup(e,{expose:a}){a();const i=e,{product:t,title:u,link:r,images:c,isInStock:s,isActive:h,discountPercentage:v,hasVariations:P}=et(i),f=p(null),n=J(f),o=p(!1);K(n,()=>{o.value=!0});const g={props:i,product:t,title:u,link:r,images:c,isInStock:s,isActive:h,discountPercentage:v,hasVariations:P,card:f,isHovered:n,wasHoveredOnce:o,get addProductToCart(){return D},Prices:W};return Object.defineProperty(g,"__isScriptSetup",{enumerable:!1,value:!0}),g}}),rt=["data-sku"],nt={class:"aspect-square p-2 motion-safe:group-hover:scale-110 transition-transform"},at={class:"relative w-full h-full bg-white rounded overflow-hidden group-hover:rounded-none"},st={key:0,class:"text-xs text-opacity-70"},it={key:1,class:"w-full h-full bg-gradient-to-br from-base-50/20 to-base-100"},ct={key:0,class:"uno-bm03rg"},lt={class:"relative flex flex-col grow justify-between p-4 group-hover:backdrop-blur-md bg-white/40 z-10"},ut={class:"pt-2"},dt={key:0},ht={key:1,class:"ui-badge bg-warning-100 text-warning-700"},ft=_("span",{class:"inline-block h-4 w-4 leading-none text-base text-center bg-on-primary text-primary opacity-80 rounded-full mr-1"}," + ",-1);function gt(e,a,i,t,u,r){const c=A("AImg"),s=A("ALink");return l(),d("article",{ref:"card","data-sku":t.product.sku,class:"relative h-full max-w-[350px] mx-auto py-3 group"},[m(s,{href:t.link,class:"flex flex-col h-full rounded overflow-hidden group-hover:shadow group-hover:ring-1 ring-black/5"},{default:C(()=>[_("div",nt,[_("div",at,[t.images?.length?(l(),d("span",st,[m(c,{picture:t.images[0],alt:t.title,class:"absolute top-0 left-0 block w-full h-full object-cover"},null,8,["picture","alt"]),t.images[1]&&t.wasHoveredOnce?(l(),O(c,{key:0,picture:t.images[1],alt:t.title,class:"absolute top-0 left-0 block w-full h-full object-cover opacity-0 group-hover:opacity-100 transition-opacity motion-safe:duration-300 text-transparent z-10"},null,8,["picture","alt"])):S("",!0)])):(l(),d("div",it))])]),t.discountPercentage?(l(),d("span",ct,[x(" -"),_("strong",null,w(t.discountPercentage),1),x("% ")])):S("",!0),_("div",lt,[(l(),O(T(i.headingTag),{class:E(["ui-link no-underline line-clamp-2",[t.isActive?"text-base-700":"text-base-500",t.link?"group-hover:underline group-hover:text-primary":null]])},{default:C(()=>[x(w(t.title),1)]),_:1},8,["class"])),_("div",ut,[t.isActive?(l(),d("div",dt,[m(t.Prices,{product:t.product},null,8,["product"])])):(l(),d("span",ht,w(t.isInStock?"Inativo":"Sem estoque"),1))]),t.isActive&&!t.hasVariations?(l(),d("button",{key:0,class:"uno-3suct9 ui-btn-sm ui-btn-primary",onClick:a[0]||(a[0]=q(h=>t.addProductToCart(t.product),["prevent"]))},[ft,x(" "+w("Adicionar ao carrinho"))])):S("",!0)])]),_:1},8,["href"])],8,rt)}const mt=V(ot,[["render",gt]]),_t=B({__name:"ProductShelf",props:{collectionId:{},searchQuery:{},sort:{},title:{},titleLink:{},isShuffle:{type:Boolean},limit:{},page:{},products:{}},async setup(e,{expose:a}){a();const i=e,{title:t,titleLink:u,fetching:r,products:c}=tt(i),s={props:i,title:t,titleLink:u,fetching:r,products:c,Carousel:R,CarouselControl:G,ProductCard:mt};return Object.defineProperty(s,"__isScriptSetup",{enumerable:!1,value:!0}),s}}),pt={class:"ui-section"},vt={key:0,class:"max-w-prose mx-auto text-center mb-2"},bt={class:"ui-text-brand text-3xl"},yt={class:"text-3xl lg:text-2xl leading-none text-primary lg:opacity-0 group-hover/shelf:opacity-90 transition-opacity"};function kt(e,a,i,t,u,r){const c=A("ALink");return l(),d("section",pt,[t.title?(l(),d("div",vt,[_("h2",bt,[m(c,{href:t.titleLink,class:E(t.titleLink?"ui-link":"text-base-700")},{default:C(()=>[x(w(t.title),1)]),_:1},8,["href","class"])])])):S("",!0),m(t.Carousel,{class:"group/shelf"},{controls:C(()=>[M(_("div",yt,[m(t.CarouselControl,{class:"!top-1/2 !-left-4 w-12 h-12 bg-transparent lg:bg-white/80 lg:hover:bg-primary-300/60 rounded-full lg:shadow-sm lg:ring-1 ring-black/5","is-prev":""}),m(t.CarouselControl,{class:"!top-1/2 !-right-4 w-12 h-12 bg-transparent lg:bg-white/80 lg:hover:bg-primary-300/60 rounded-full lg:shadow-sm lg:ring-1 ring-black/5"})],512),[[F,t.products.length>2]])]),default:C(()=>[(l(!0),d(H,null,z(t.products,s=>(l(),d("li",{key:s._id,class:"basis-1/2 md:basis-1/3 lg:basis-1/4 shrink-0"},[m(t.ProductCard,{product:s},null,8,["product"])]))),128))]),_:1})])}const jt=V(_t,[["render",kt]]);export{jt as default};
@@ -1 +0,0 @@
1
- import{_ as e,o as c,a as o}from"./_plugin-vue_export-helper.ee681fa8.js";const s={},a={class:"w-full h-40 bg-base-300"};function t(r,n){return c(),o("div",a)}const l=e(s,[["render",t]]);export{l as default};