cloudcommerce 0.37.1 → 0.38.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 (142) hide show
  1. package/.github/workflows/test-apps.yml +2 -2
  2. package/.vscode/settings.json +1 -1
  3. package/CHANGELOG.md +36 -0
  4. package/action.yml +2 -2
  5. package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
  6. package/ecomplus-stores/barra-doce/functions/ssr/package.json +6 -6
  7. package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
  8. package/ecomplus-stores/barra-doce/package.json +2 -2
  9. package/package.json +7 -7
  10. package/packages/api/lib/api.d.ts +2 -2
  11. package/packages/api/package.json +1 -1
  12. package/packages/api/types.d.ts +4 -1
  13. package/packages/apps/affilate-program/package.json +1 -1
  14. package/packages/apps/correios/package.json +1 -1
  15. package/packages/apps/custom-payment/package.json +1 -1
  16. package/packages/apps/custom-shipping/package.json +1 -1
  17. package/packages/apps/datafrete/package.json +1 -1
  18. package/packages/apps/discounts/package.json +1 -1
  19. package/packages/apps/emails/package.json +1 -1
  20. package/packages/apps/fb-conversions/package.json +1 -1
  21. package/packages/apps/flash-courier/package.json +1 -1
  22. package/packages/apps/frenet/package.json +1 -1
  23. package/packages/apps/galaxpay/package.json +1 -1
  24. package/packages/apps/google-analytics/package.json +1 -1
  25. package/packages/apps/jadlog/package.json +1 -1
  26. package/packages/apps/loyalty-points/package.json +1 -1
  27. package/packages/apps/mandae/package.json +1 -1
  28. package/packages/apps/melhor-envio/package.json +1 -1
  29. package/packages/apps/mercadopago/package.json +1 -1
  30. package/packages/apps/pagarme/package.json +1 -1
  31. package/packages/apps/pagarme-v5/package.json +1 -1
  32. package/packages/apps/paghiper/package.json +1 -1
  33. package/packages/apps/pix/package.json +1 -1
  34. package/packages/apps/tiny-erp/package.json +1 -1
  35. package/packages/apps/webhooks/package.json +1 -1
  36. package/packages/cli/config/firestore.rules +4 -1
  37. package/packages/cli/lib/cli.js +30 -9
  38. package/packages/cli/package.json +2 -1
  39. package/packages/cli/src/cli.ts +37 -9
  40. package/packages/config/package.json +1 -1
  41. package/packages/emails/package.json +1 -1
  42. package/packages/eslint/package.json +3 -3
  43. package/packages/events/package.json +1 -1
  44. package/packages/feeds/package.json +1 -1
  45. package/packages/firebase/package.json +1 -1
  46. package/packages/i18n/package.json +1 -1
  47. package/packages/modules/package.json +1 -1
  48. package/packages/passport/package.json +1 -1
  49. package/packages/ssr/package.json +5 -5
  50. package/packages/storefront/.auto-imports.d.ts +1 -0
  51. package/packages/storefront/client.d.ts +1 -0
  52. package/packages/storefront/config/storefront.tailwind.cjs +21 -20
  53. package/packages/storefront/config/storefront.unocss.cjs +11 -0
  54. package/packages/storefront/dist/client/_astro/{AccountPage.700be123.js → AccountPage.j0C5JBLY.js} +1 -1
  55. package/packages/storefront/dist/client/_astro/{CartSidebar.430b55df.js → CartSidebar.1kUFk9Xn.js} +1 -1
  56. package/packages/storefront/dist/client/_astro/HeroSlider.tR1dVXyu.js +1 -0
  57. package/packages/storefront/dist/client/_astro/{PitchBar.06e0f831.js → PitchBar.FelC04wE.js} +1 -1
  58. package/packages/storefront/dist/client/_astro/{Prices.0e829c31.js → Prices.PuQc6C7F.js} +1 -1
  59. package/packages/storefront/dist/client/_astro/ProductCard.ephJafAE.js +1 -0
  60. package/packages/storefront/dist/client/_astro/ProductDetails.B6Ih5MGf.js +7 -0
  61. package/packages/storefront/dist/client/_astro/ProductShelf.GESxuPZ_.js +1 -0
  62. package/packages/storefront/dist/client/_astro/{QuantitySelector.ebf60845.js → QuantitySelector.YNmWjN8y.js} +1 -1
  63. package/packages/storefront/dist/client/_astro/SearchContainer.BzixfU3R.js +1 -0
  64. package/packages/storefront/dist/client/_astro/SearchModal.F7vbwxIv.js +1 -0
  65. package/packages/storefront/dist/client/_astro/ShopHeader.5vR1LgSW.js +10 -0
  66. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.sk5AFsEV.js +1 -0
  67. package/packages/storefront/dist/client/_astro/_slug_.r8QHNfdw.css +1 -0
  68. package/packages/storefront/dist/client/_astro/client.RF8UxjZd.js +1 -0
  69. package/packages/storefront/dist/client/_astro/customer-session._VkzXnXT.js +7 -0
  70. package/packages/storefront/dist/client/_astro/ecom-utils.gJYgRPRz.js +1 -0
  71. package/packages/storefront/dist/client/_astro/{firebase-app.992a296f.js → firebase-app.cPMfoOsn.js} +1 -1
  72. package/packages/storefront/dist/client/_astro/{format-money.9cf6b04d.js → format-money.FMQXgKHB.js} +1 -1
  73. package/packages/storefront/dist/client/_astro/{hoisted.c90fc6ab.js → hoisted.B6fKrLPR.js} +1 -1
  74. package/packages/storefront/dist/client/_astro/{hoisted.54eaab04.js → hoisted._FbzheVm.js} +1 -1
  75. package/packages/storefront/dist/client/_astro/{i18n.29216eeb.js → i18n.m7SpISxy.js} +1 -1
  76. package/packages/storefront/dist/client/_astro/{img.4f23a3dd.js → img.zh-Drf-O.js} +1 -1
  77. package/packages/storefront/dist/client/_astro/{index-61e5ac61.bdc8d0cd.js → index-dd468b12.D5s8VdAL.js} +92 -107
  78. package/packages/storefront/dist/client/_astro/{index.570b84fe.js → index.5PN-EYMS.js} +1 -1
  79. package/packages/storefront/dist/client/_astro/index.XrHFaN2F.js +1 -0
  80. package/packages/storefront/dist/client/_astro/{modules-info.55780599.js → modules-info.sD0tdb2b.js} +1 -1
  81. package/packages/storefront/dist/client/_astro/name.HU5l7TJo.js +1 -0
  82. package/packages/storefront/dist/client/_astro/{photoswipe-lightbox.esm.c157838f.js → photoswipe-lightbox.esm.dZBqKD9u.js} +1 -1
  83. package/packages/storefront/dist/client/_astro/{photoswipe.01431ec7.js → photoswipe.0V7m2jWu.js} +1 -2
  84. package/packages/storefront/dist/client/_astro/{photoswipe.esm.92c2d901.js → photoswipe.esm.Ylh9TGkz.js} +1 -1
  85. package/packages/storefront/dist/client/_astro/sf-utils.5t7r9A2G.js +1 -0
  86. package/packages/storefront/dist/client/_astro/{shopping-cart.d9f601dd.js → shopping-cart.A-1jhlKi.js} +1 -1
  87. package/packages/storefront/dist/client/_astro/use-analytics.1EVxbrS7.js +1 -0
  88. package/packages/storefront/dist/client/_astro/{use-product-card.437911bb.js → use-product-card.erbOV6Fv.js} +1 -1
  89. package/packages/storefront/dist/client/robots.txt +1 -0
  90. package/packages/storefront/dist/server/chunks/{CartSidebar_eab28771.mjs → CartSidebar_hAgJQJgm.mjs} +1 -1
  91. package/packages/storefront/dist/server/chunks/SearchModal_eWb5SdQM.mjs +351 -0
  92. package/packages/storefront/dist/server/chunks/{_.._5a781fb3.mjs → _.._S7DDBn_b.mjs} +1 -1
  93. package/packages/storefront/dist/server/chunks/{account_519edb70.mjs → account_3ySmGzMc.mjs} +1 -1
  94. package/packages/storefront/dist/server/chunks/astro/{assets-service_a9d9ab5f.mjs → assets-service_QlOZG8ov.mjs} +1 -1
  95. package/packages/storefront/dist/server/chunks/{astro_d98f7186.mjs → astro_zcC1GStV.mjs} +17 -34
  96. package/packages/storefront/dist/server/chunks/{index_5e3ed8a0.mjs → index_nIwq11oA.mjs} +1 -1
  97. package/packages/storefront/dist/server/chunks/{index_10e14f85.mjs → index_uAR5ZV4d.mjs} +1 -1
  98. package/packages/storefront/dist/server/chunks/{node_1119b0d1.mjs → node_2VvC7trl.mjs} +1 -1
  99. package/packages/storefront/dist/server/chunks/pages/{__93ade2dd.mjs → __MSibDuuV.mjs} +652 -255
  100. package/packages/storefront/dist/server/chunks/pages/{account_e5d410a7.mjs → account_iG-YqJ5q.mjs} +3 -2
  101. package/packages/storefront/dist/server/chunks/pages/{index_7e25afc1.mjs → index_BtDyKPh_.mjs} +3 -2
  102. package/packages/storefront/dist/server/chunks/pages/{node_bd378ac0.mjs → node_bKqL47eZ.mjs} +2 -2
  103. package/packages/storefront/dist/server/chunks/pages/{~fallback_73578d2f.mjs → ~fallback_73R5VA6j.mjs} +3 -2
  104. package/packages/storefront/dist/server/chunks/{photoswipe_9528923e.mjs → photoswipe_IcWDJiwc.mjs} +1 -1
  105. package/packages/storefront/dist/server/chunks/{~fallback_41122b9b.mjs → ~fallback_7q1dqY4e.mjs} +1 -1
  106. package/packages/storefront/dist/server/entry.mjs +970 -93
  107. package/packages/storefront/dist/server/manifest_dSwvaOdW.mjs +195 -0
  108. package/packages/storefront/dist/server/renderers.mjs +2 -2
  109. package/packages/storefront/package.json +12 -12
  110. package/packages/storefront/src/helpers/sf-utils.ts +29 -1
  111. package/packages/storefront/src/lib/composables/use-search-container.ts +48 -0
  112. package/packages/storefront/src/lib/composables/use-search-modal.ts +1 -1
  113. package/packages/storefront/src/lib/composables/use-shop-header.ts +14 -5
  114. package/packages/storefront/src/lib/composables/use-sticky-header.ts +2 -0
  115. package/packages/storefront/src/lib/layouts/BaseHead.astro +8 -1
  116. package/packages/storefront/src/lib/layouts/use-page-main.ts +15 -0
  117. package/packages/storefront/src/lib/scripts/firestore.ts +27 -0
  118. package/packages/storefront/src/lib/ssr-context.ts +14 -0
  119. package/packages/storefront/src/lib/state/search-engine.ts +62 -25
  120. package/packages/storefront/src/lib/state/use-analytics.ts +9 -10
  121. package/packages/test-base/package.json +1 -1
  122. package/packages/types/package.json +1 -1
  123. package/packages/storefront/dist/client/_astro/HeroSlider.bd684ed8.js +0 -1
  124. package/packages/storefront/dist/client/_astro/ProductDetails.06da998d.js +0 -1
  125. package/packages/storefront/dist/client/_astro/ProductShelf.3f4f38b5.js +0 -1
  126. package/packages/storefront/dist/client/_astro/ProductShelf.bf82838b.js +0 -1
  127. package/packages/storefront/dist/client/_astro/SearchModal.b6aa5ef7.js +0 -1
  128. package/packages/storefront/dist/client/_astro/ShopHeader.2d6e361a.js +0 -4
  129. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.f75743ee.js +0 -1
  130. package/packages/storefront/dist/client/_astro/_slug_.e7cac999.css +0 -1
  131. package/packages/storefront/dist/client/_astro/client.41b42098.js +0 -1
  132. package/packages/storefront/dist/client/_astro/customer-session.5ab9ab1a.js +0 -1
  133. package/packages/storefront/dist/client/_astro/ecom-utils.5cbfb95e.js +0 -1
  134. package/packages/storefront/dist/client/_astro/index.8ac1db99.js +0 -1
  135. package/packages/storefront/dist/client/_astro/name.01410784.js +0 -1
  136. package/packages/storefront/dist/client/_astro/sf-utils.b04e1813.js +0 -1
  137. package/packages/storefront/dist/client/_astro/use-analytics.cc95e346.js +0 -1
  138. package/packages/storefront/dist/server/chunks/SearchModal_f66549d4.mjs +0 -147
  139. package/packages/storefront/dist/server/manifest_221d806b.mjs +0 -1069
  140. /package/packages/storefront/dist/client/_astro/{afetch.f4507208.js → afetch.5c8VmT0-.js} +0 -0
  141. /package/packages/storefront/dist/client/_astro/{img-sizes.41e0efe4.js → img-sizes.gxAI9JNh.js} +0 -0
  142. /package/packages/storefront/dist/client/_astro/{price.04ceb6c4.js → price.Easct8WC.js} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { fileURLToPath } from 'node:url';
2
- import path from 'node:path';
2
+ import { join as joinPath } from 'node:path';
3
3
  import {
4
4
  $,
5
5
  argv,
@@ -7,6 +7,7 @@ import {
7
7
  echo,
8
8
  chalk,
9
9
  } from 'zx';
10
+ import Deepmerge from '@fastify/deepmerge';
10
11
  import login from './login';
11
12
  import build, { prepareCodebases } from './build';
12
13
  import { siginGcloudAndSetIAM, createServiceAccountKey } from './setup-gcloud';
@@ -26,16 +27,16 @@ const pwd = process.cwd();
26
27
 
27
28
  let projectId = FIREBASE_PROJECT_ID;
28
29
  if (projectId) {
29
- if (!fs.existsSync(path.join(pwd, '.firebaserc'))) {
30
+ if (!fs.existsSync(joinPath(pwd, '.firebaserc'))) {
30
31
  fs.writeFileSync(
31
- path.join(pwd, '.firebaserc'),
32
+ joinPath(pwd, '.firebaserc'),
32
33
  JSON.stringify({ projects: { default: projectId } }, null, 2),
33
34
  );
34
35
  }
35
36
  } else {
36
37
  if (GOOGLE_APPLICATION_CREDENTIALS) {
37
38
  try {
38
- const gac = fs.readJSONSync(path.join(pwd, GOOGLE_APPLICATION_CREDENTIALS));
39
+ const gac = fs.readJSONSync(joinPath(pwd, GOOGLE_APPLICATION_CREDENTIALS));
39
40
  projectId = gac.project_id;
40
41
  } catch (e) {
41
42
  //
@@ -43,7 +44,7 @@ if (projectId) {
43
44
  }
44
45
  if (!projectId) {
45
46
  try {
46
- const firebaserc = fs.readJSONSync(path.join(pwd, '.firebaserc'));
47
+ const firebaserc = fs.readJSONSync(joinPath(pwd, '.firebaserc'));
47
48
  projectId = firebaserc.projects.default;
48
49
  } catch (e) {
49
50
  projectId = 'ecom2-demo';
@@ -52,7 +53,34 @@ if (projectId) {
52
53
  }
53
54
 
54
55
  export default async () => {
55
- await fs.copy(path.join(__dirname, '..', 'config'), pwd);
56
+ const baseConfigDir = joinPath(__dirname, '..', 'config');
57
+ await fs.copy(baseConfigDir, pwd);
58
+ const userConfigDir = joinPath(pwd, 'conf');
59
+ if (fs.existsSync(userConfigDir) && fs.lstatSync(userConfigDir).isDirectory()) {
60
+ await fs.copy(userConfigDir, pwd);
61
+ const userFirebaseJsonPath = joinPath(userConfigDir, 'firebase.json');
62
+ if (fs.existsSync(userFirebaseJsonPath)) {
63
+ let userFirebaseConfig: Record<string, any> | undefined;
64
+ try {
65
+ userFirebaseConfig = JSON.parse(
66
+ fs.readFileSync(userFirebaseJsonPath, 'utf8'),
67
+ );
68
+ } catch {
69
+ //
70
+ }
71
+ if (userFirebaseConfig) {
72
+ const deepmerge = Deepmerge();
73
+ const baseFirebaseConfig = JSON.parse(
74
+ fs.readFileSync(joinPath(baseConfigDir, 'firebase.json'), 'utf8'),
75
+ );
76
+ const mergedConfig = deepmerge(baseFirebaseConfig, userFirebaseConfig);
77
+ fs.writeFileSync(
78
+ joinPath(pwd, 'firebase.json'),
79
+ JSON.stringify(mergedConfig, null, 2),
80
+ );
81
+ }
82
+ }
83
+ }
56
84
 
57
85
  const options: string[] = [];
58
86
  Object.keys(argv).forEach((key) => {
@@ -105,7 +133,7 @@ ${chalk.bold('npx kill-port 4000 9099 5001 8080 5000 8085 9199 4400 4500')}
105
133
  if (argv._.includes('setup')) {
106
134
  const { storeId, authenticationId, apiKey } = await login();
107
135
  await fs.writeFile(
108
- path.join(pwd, 'functions', '.env'),
136
+ joinPath(pwd, 'functions', '.env'),
109
137
  `ECOM_AUTHENTICATION_ID=${authenticationId}
110
138
  ECOM_API_KEY=${apiKey}
111
139
  ECOM_STORE_ID=${storeId}
@@ -117,7 +145,7 @@ ECOM_STORE_ID=${storeId}
117
145
  }
118
146
  if (argv.commit !== false) {
119
147
  await fs.writeFile(
120
- path.join(pwd, 'functions', 'config.json'),
148
+ joinPath(pwd, 'functions', 'config.json'),
121
149
  JSON.stringify({ storeId }, null, 2),
122
150
  );
123
151
 
@@ -184,7 +212,7 @@ Finish by saving the following secrets to your GitHub repository:
184
212
 
185
213
  if (argv._.includes('dev') || !argv._.length) {
186
214
  await prepareCodebases(true);
187
- const prefix = path.join(pwd, 'functions/ssr');
215
+ const prefix = joinPath(pwd, 'functions/ssr');
188
216
  // https://docs.astro.build/en/reference/cli-reference/#astro-dev
189
217
  const host = typeof argv.host === 'string' ? argv.host : '';
190
218
  const port = typeof argv.port === 'string' || typeof argv.port === 'number' ? argv.port : '';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/config",
3
3
  "type": "module",
4
- "version": "0.37.1",
4
+ "version": "0.38.0",
5
5
  "description": "E-Com Plus Cloud Commerce base config",
6
6
  "main": "lib/config.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/emails",
3
3
  "type": "module",
4
- "version": "0.37.1",
4
+ "version": "0.38.0",
5
5
  "description": "E-Com Plus Cloud Commerce email sender",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/eslint",
3
3
  "type": "module",
4
- "version": "0.37.1",
4
+ "version": "0.38.0",
5
5
  "description": "E-Com Plus Cloud Commerce ESLint config",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -19,8 +19,8 @@
19
19
  "build": "echo '@ecomplus/eslint'"
20
20
  },
21
21
  "dependencies": {
22
- "@typescript-eslint/eslint-plugin": "^6.13.1",
23
- "@typescript-eslint/parser": "^6.13.1",
22
+ "@typescript-eslint/eslint-plugin": "^6.13.2",
23
+ "@typescript-eslint/parser": "^6.13.2",
24
24
  "eslint": "^8.55.0",
25
25
  "eslint-config-airbnb-base": "^15.0.0",
26
26
  "eslint-plugin-import": "^2.29.0",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/events",
3
3
  "type": "module",
4
- "version": "0.37.1",
4
+ "version": "0.38.0",
5
5
  "description": "E-Com Plus Cloud Commerce app events",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/feeds",
3
3
  "type": "module",
4
- "version": "0.37.1",
4
+ "version": "0.38.0",
5
5
  "description": "E-Com Plus Cloud Commerce catalog feeds",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/firebase",
3
3
  "type": "module",
4
- "version": "0.37.1",
4
+ "version": "0.38.0",
5
5
  "description": "E-Com Plus Cloud Commerce on Firebase",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/i18n",
3
3
  "type": "module",
4
- "version": "0.37.1",
4
+ "version": "0.38.0",
5
5
  "description": "E-Com Plus Cloud Commerce i18n",
6
6
  "main": "lib/all.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/modules",
3
3
  "type": "module",
4
- "version": "0.37.1",
4
+ "version": "0.38.0",
5
5
  "description": "E-Com Plus Cloud Commerce modules API",
6
6
  "main": "lib/index.cjs",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/passport",
3
3
  "type": "module",
4
- "version": "0.37.1",
4
+ "version": "0.38.0",
5
5
  "description": "E-Com Plus Cloud Commerce customers authentication (passport) API",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/ssr",
3
3
  "type": "module",
4
- "version": "0.37.1",
4
+ "version": "0.38.0",
5
5
  "description": "E-Com Plus Cloud Commerce storefront SSR",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -25,19 +25,19 @@
25
25
  "build:workers": "npx tsc -p src/cloudflare --outDir cloudflare && npx eslint --ext .js cloudflare --fix"
26
26
  },
27
27
  "dependencies": {
28
- "@astrojs/node": "6.1.0",
28
+ "@astrojs/node": "7.0.1",
29
29
  "@cloudcommerce/api": "workspace:*",
30
30
  "@cloudcommerce/firebase": "workspace:*",
31
31
  "@cloudcommerce/i18n": "workspace:*",
32
32
  "@ecomplus/utils": "1.5.0-rc.5",
33
- "@vueuse/core": "10.6.1",
34
- "astro": "3.6.4",
33
+ "@vueuse/core": "10.7.0",
34
+ "astro": "4.0.4",
35
35
  "astro-capo": "^0.0.1",
36
36
  "axios": "^1.6.2",
37
37
  "firebase-admin": "^11.11.1",
38
38
  "firebase-functions": "^4.5.0",
39
39
  "mitt": "^3.0.1",
40
- "vue": "3.3.10"
40
+ "vue": "3.3.11"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@cloudcommerce/types": "workspace:*",
@@ -62,4 +62,5 @@ declare global {
62
62
  declare global {
63
63
  // @ts-ignore
64
64
  export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
65
+ import('vue')
65
66
  }
@@ -19,6 +19,7 @@ interface Window {
19
19
  appId: string,
20
20
  measurementId?: string,
21
21
  };
22
+ $reCaptchaSiteKey?: string;
22
23
  ECOM_STORE_ID: number;
23
24
  ECOM_LANG: string;
24
25
  ECOM_CURRENCY: string;
@@ -80,25 +80,25 @@ Object.keys(brandColors).forEach((colorName) => {
80
80
  DEFAULT: toRGB(color),
81
81
  bold: toRGB(bold),
82
82
  };
83
- const scale = chroma.scale([
84
- chroma(hex).luminance(0.95), // 50
85
- chroma(hex).luminance(0.84), // 100
86
- chroma(hex).luminance(0.73), // 200
87
- chroma(hex).luminance(0.62), // 300
88
- chroma(hex).luminance(0.49), // 400
89
- chroma(hex).luminance(0.35), // 500
90
- chroma(hex).luminance(0.23), // 600
91
- chroma(hex).luminance(0.15), // 700
92
- chroma(hex).luminance(0.10), // 800
93
- chroma(hex).luminance(0.05), // 900
94
- chroma(hex).luminance(0.02), // 950
95
- ]).colors(11);
96
- scale.forEach((sHex, index) => {
97
- let palleteIndex;
98
- if (index === 0) palleteIndex = '50';
99
- else if (index === scale.length - 1) palleteIndex = '950';
100
- else palleteIndex = (100 * index).toString();
101
- pallete[palleteIndex] = toRGB(chroma(sHex));
83
+ let scaleRefColor = '';
84
+ let deltaE = 101;
85
+ Object.keys(colors).forEach((twColor) => {
86
+ if (twColor !== twColor.toLowerCase()) return;
87
+ const twPallete = colors[twColor];
88
+ if (!twPallete?.['50']) return;
89
+ Object.values(twPallete).forEach((compareHex) => {
90
+ const _deltaE = chroma.deltaE(hex, compareHex);
91
+ if (_deltaE < deltaE) {
92
+ scaleRefColor = twColor;
93
+ deltaE = _deltaE;
94
+ }
95
+ });
96
+ });
97
+ const refPallete = colors[scaleRefColor];
98
+ Object.keys(refPallete).forEach((palleteIndex) => {
99
+ const refHex = refPallete[palleteIndex];
100
+ const l = chroma(refHex).luminance();
101
+ pallete[palleteIndex] = toRGB(color.luminance(l));
102
102
  });
103
103
  brandColorsPalletes[colorName] = pallete;
104
104
  const colorVariants = { color, subtle, bold };
@@ -150,7 +150,7 @@ const genTailwindConfig = (themeOptions = {}) => {
150
150
  },
151
151
  },
152
152
  plugins: [
153
- ({ addUtilities }) => {
153
+ ({ addUtilities, addVariant }) => {
154
154
  addUtilities({
155
155
  ...Object.keys(onBrandColors).reduce((utilities, colorLabel) => {
156
156
  const [colorName, tone] = colorLabel.split('-');
@@ -219,6 +219,7 @@ const genTailwindConfig = (themeOptions = {}) => {
219
219
  return utilities;
220
220
  }, {}),
221
221
  });
222
+ addVariant('sticky-header', 'body.StickyHeader &');
222
223
  },
223
224
  ],
224
225
  };
@@ -58,6 +58,7 @@ const genUnoCSSConfig = (_tailwindConfig) => {
58
58
  const tailwindConfig = _tailwindConfig || genTailwindConfig(themeOptions);
59
59
  const rules = [];
60
60
  const shortcuts = [];
61
+ const variants = [];
61
62
  tailwindConfig.plugins?.forEach((plugin) => {
62
63
  plugin({
63
64
  addUtilities: (utilities) => {
@@ -75,6 +76,15 @@ const genUnoCSSConfig = (_tailwindConfig) => {
75
76
  }
76
77
  });
77
78
  },
79
+ addVariant: (variant, selector) => {
80
+ variants.push((matcher) => {
81
+ if (!matcher.startsWith(`${variant}:`)) return matcher;
82
+ return {
83
+ matcher: matcher.slice(variant.length + 1),
84
+ selector: (s) => selector.replace('&', s),
85
+ };
86
+ });
87
+ },
78
88
  });
79
89
  });
80
90
  const theme = tailwindConfig.theme.extend;
@@ -82,6 +92,7 @@ const genUnoCSSConfig = (_tailwindConfig) => {
82
92
  preflights,
83
93
  rules,
84
94
  shortcuts,
95
+ variants,
85
96
  theme: {
86
97
  ...theme,
87
98
  colors: {
@@ -1 +1 @@
1
- import{e as M,f as _,E as T,b as V,i as A}from"./customer-session.5ab9ab1a.js";import{_ as P,a as I,v as R,w as k}from"./_plugin-vue_export-helper.f75743ee.js";import{u as j}from"./index.570b84fe.js";import{g as B,b as O,c as q}from"./index-61e5ac61.bdc8d0cd.js";import{b as D}from"./index.8ac1db99.js";import{a as f,w as h,d as C,c as z,L as F,M as l,N as c,Y as N,O as i,V as S,T as r,U as b,X as L,W as E,P as x,Q as U,a1 as W,a2 as Y,R as G,S as K}from"./ecom-utils.5cbfb95e.js";import"./sf-utils.b04e1813.js";const Q=m=>{M();const s=m?.canUseUrlParams!==!1?j("history"):{},e=s.sign_up!==void 0&&s.sign_up!=="0",a=s.password!==void 0&&s.password!=="0",u=f(e),n=f(!e&&!a);h(u,p=>{p?(n.value=!0,s.sign_up="1"):s.sign_up="0"}),h(n,p=>{s.password=p?"0":"1"});const o=f(""),d=f(!1),g=D(async p=>{d.value=!0;const v=Date.now(),y=B();if(_.value){window.localStorage.setItem(T,_.value);try{if(n.value){const w=new URL(p||window.location.toString());w.searchParams.append("email",_.value),await O(y,_.value,{url:w.toString(),handleCodeInApp:!0})}else await q(y,_.value,o.value)}catch(w){console.warn(w.code),console.error(w)}setTimeout(()=>{d.value=!1},Math.min(2e3-(Date.now()-v),1))}},2e3);return{isLinkSignIn:n,isSignUp:u,email:_,password:o,isSubmitting:d,submitLogin:g}},X=C({__name:"LoginForm",props:{loginLinkActionUrl:{}},setup(m,{expose:t}){t();const{isLinkSignIn:s,isSignUp:e,email:a,password:u,isSubmitting:n,submitLogin:o}=Q(),d=f(!1),g=f(0),p=z(()=>g.value>9);h(n,()=>{!n.value&&s.value&&(d.value=!0,g.value+=1)}),h([a,e],()=>{d.value=!1}),h(p,()=>{s.value=!1});const v={isLinkSignIn:s,isSignUp:e,email:a,password:u,isSubmitting:n,submitLogin:o,isEmailSentMsg:d,countEmailsSent:g,isLinkSignInBlocked:p,get customerName(){return V}};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),$={class:"text-base-600 mb-4 text-2xl font-light"},H={key:0},J={key:1,class:"lowercase"},Z={key:0,for:"login-form-email"},ee={class:"relative"},se=["disabled"],te={key:0,class:"text-success-800 absolute left-0 top-0 mt-4 font-medium"},ne=i("i",{class:"i-check mr-1"},null,-1);function ie(m,t,s,e,a,u){const n=F("Fade");return l(),c("form",{class:"text-base-800 w-full max-w-sm bg-white p-6 text-base md:p-8",onSubmit:t[4]||(t[4]=k(()=>e.submitLogin(s.loginLinkActionUrl),["prevent"]))},[N(m.$slots,"head"),i("p",$,[S(r("Olá")+" "),e.customerName?(l(),c("span",H,r(e.customerName),1)):(l(),c("span",J,r("Visitante")))]),e.isLinkSignIn?(l(),c("label",Z,r("Enviar link de acesso por e-mail"))):b("",!0),L(i("input",{id:"login-form-email",type:"email",placeholder:"email@mail.com","onUpdate:modelValue":t[0]||(t[0]=o=>e.email=o),class:"mb-0.5 mt-2 w-full",required:""},null,512),[[I,e.email]]),e.isLinkSignIn?b("",!0):L((l(),c("input",{key:1,type:"password",placeholder:"Senha","onUpdate:modelValue":t[1]||(t[1]=o=>e.password=o),class:"mb-0.5 mt-2 w-full lowercase",required:""},null,512)),[[I,e.password]]),i("div",ee,[i("div",{class:E(["transition-opacity",e.isEmailSentMsg&&"opacity-0 invisible"])},[L(i("a",{href:"?password",class:"ui-link text-base-500 text-right text-sm lowercase",onClick:t[2]||(t[2]=k(o=>e.isLinkSignIn=!e.isLinkSignIn,["prevent"]))},r(e.isLinkSignIn?"Entrar com senha":"Esqueci minha senha"),513),[[R,!e.isSignUp&&!e.isLinkSignInBlocked]]),i("button",{type:"submit",disabled:e.isSubmitting,class:E(["ui-btn-lg ui-btn-primary mb-2 mt-5 w-full",e.isSubmitting&&"opacity-50"])},r(e.isSignUp?"Cadastrar":"Acessar minha conta"),11,se)],2),x(n,{speed:"slow"},{default:U(()=>[e.isEmailSentMsg?(l(),c("p",te,[ne,S(" "+r("Te enviamos o e-mail, verifique sua caixa de entrada e spam se necessário."),1)])):b("",!0)]),_:1}),i("a",{href:"?sign_up",class:"ui-btn-lg ui-btn-contrast block w-full text-center",onClick:t[3]||(t[3]=k(o=>e.isSignUp=!e.isSignUp,["prevent"]))},r(e.isSignUp?"Acessar minha conta":"Criar uma conta"),1)])],32)}const ae=P(X,[["render",ie]]),oe=C({__name:"AccountPage",setup(m,{expose:t}){t();let s=null;{const{location:a}=window,u=new URLSearchParams(a.search).get("return_url");if(!u){const n=new URL(a.toString());n.pathname="/app/",n.hash=`#${a.pathname.replace("/app/","/")}`,s=n.toString()}h(A,()=>{A.value&&(a.href=u||s)},{immediate:!0})}const e={get loginLinkActionUrl(){return s},set loginLinkActionUrl(a){s=a},LoginForm:ae};return Object.defineProperty(e,"__isScriptSetup",{enumerable:!1,value:!0}),e}}),re={class:"from-secondary-700 to-secondary-950 flex min-h-screen w-full flex-col justify-center bg-gradient-to-br"},le={class:"mx-auto p-4"},ce=i("section",{class:"ui-section text-center"},[i("a",{href:"/",class:"text-base-200 hover:text-white"},[i("i",{class:"i-arrow-right mr-1 rotate-180"}),S(" "+r("Ir para a loja"))])],-1),me={class:"overflow-hidden rounded-md shadow-md ring-4 ring-black/10"},ue={class:"mb-5 text-center"},de={href:"/",class:"inline-block"},pe={key:0,class:"ui-section px-0"},ge={class:"mx-auto flex max-w-sm flex-wrap items-center justify-evenly gap-4 px-3"};function _e(m,t,s,e,a,u){const n=F("ALink");return l(),c("article",re,[i("div",le,[ce,i("section",me,[x(e.LoginForm,W(Y({loginLinkActionUrl:e.loginLinkActionUrl})),{head:U(()=>[i("div",ue,[i("a",de,[N(m.$slots,"logo")])])]),_:3},16)]),m.$settings.serviceLinks?.length?(l(),c("nav",pe,[i("ul",ge,[(l(!0),c(G,null,K(m.$settings.serviceLinks,({title:o,href:d},g)=>(l(),c("li",{key:`s-${g}`},[x(n,{href:d,class:"ui-link text-base-200 hover:text-white"},{default:U(()=>[S(r(o),1)]),_:2},1032,["href"])]))),128))])])):b("",!0)])])}const Le=P(oe,[["render",_e]]);export{Le as default};
1
+ import{e as M,f as _,E as T,a as V,d as A}from"./customer-session._VkzXnXT.js";import{_ as P,a as I,v as R,w as k}from"./_plugin-vue_export-helper.sk5AFsEV.js";import{a as j}from"./index.5PN-EYMS.js";import{g as B,b as O,c as q}from"./index-dd468b12.D5s8VdAL.js";import{b as D}from"./index.XrHFaN2F.js";import{a as f,w as h,d as C,c as z,K as F,L as l,M as c,Z as N,R as i,S as b,T as r,Q as S,W as L,V as E,N as x,O as U,a0 as K,a1 as W,X as Y,Y as G}from"./ecom-utils.gJYgRPRz.js";import"./sf-utils.5t7r9A2G.js";const Q=m=>{M();const s=m?.canUseUrlParams!==!1?j("history"):{},e=s.sign_up!==void 0&&s.sign_up!=="0",a=s.password!==void 0&&s.password!=="0",u=f(e),n=f(!e&&!a);h(u,p=>{p?(n.value=!0,s.sign_up="1"):s.sign_up="0"}),h(n,p=>{s.password=p?"0":"1"});const o=f(""),d=f(!1),g=D(async p=>{d.value=!0;const v=Date.now(),y=B();if(_.value){window.localStorage.setItem(T,_.value);try{if(n.value){const w=new URL(p||window.location.toString());w.searchParams.append("email",_.value),await O(y,_.value,{url:w.toString(),handleCodeInApp:!0})}else await q(y,_.value,o.value)}catch(w){console.warn(w.code),console.error(w)}setTimeout(()=>{d.value=!1},Math.min(2e3-(Date.now()-v),1))}},2e3);return{isLinkSignIn:n,isSignUp:u,email:_,password:o,isSubmitting:d,submitLogin:g}},X=C({__name:"LoginForm",props:{loginLinkActionUrl:{}},setup(m,{expose:t}){t();const{isLinkSignIn:s,isSignUp:e,email:a,password:u,isSubmitting:n,submitLogin:o}=Q(),d=f(!1),g=f(0),p=z(()=>g.value>9);h(n,()=>{!n.value&&s.value&&(d.value=!0,g.value+=1)}),h([a,e],()=>{d.value=!1}),h(p,()=>{s.value=!1});const v={isLinkSignIn:s,isSignUp:e,email:a,password:u,isSubmitting:n,submitLogin:o,isEmailSentMsg:d,countEmailsSent:g,isLinkSignInBlocked:p,get customerName(){return V}};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),Z={class:"text-base-600 mb-4 text-2xl font-light"},$={key:0},H={key:1,class:"lowercase"},J={key:0,for:"login-form-email"},ee={class:"relative"},se=["disabled"],te={key:0,class:"text-success-800 absolute left-0 top-0 mt-4 font-medium"},ne=i("i",{class:"i-check mr-1"},null,-1);function ie(m,t,s,e,a,u){const n=F("Fade");return l(),c("form",{class:"text-base-800 w-full max-w-sm bg-white p-6 text-base md:p-8",onSubmit:t[4]||(t[4]=k(()=>e.submitLogin(s.loginLinkActionUrl),["prevent"]))},[N(m.$slots,"head"),i("p",Z,[b(r("Olá")+" "),e.customerName?(l(),c("span",$,r(e.customerName),1)):(l(),c("span",H,r("Visitante")))]),e.isLinkSignIn?(l(),c("label",J,r("Enviar link de acesso por e-mail"))):S("",!0),L(i("input",{id:"login-form-email",type:"email",placeholder:"email@mail.com","onUpdate:modelValue":t[0]||(t[0]=o=>e.email=o),class:"mb-0.5 mt-2 w-full",required:""},null,512),[[I,e.email]]),e.isLinkSignIn?S("",!0):L((l(),c("input",{key:1,type:"password",placeholder:"Senha","onUpdate:modelValue":t[1]||(t[1]=o=>e.password=o),class:"mb-0.5 mt-2 w-full lowercase",required:""},null,512)),[[I,e.password]]),i("div",ee,[i("div",{class:E(["transition-opacity",e.isEmailSentMsg&&"opacity-0 invisible"])},[L(i("a",{href:"?password",class:"ui-link text-base-500 text-right text-sm lowercase",onClick:t[2]||(t[2]=k(o=>e.isLinkSignIn=!e.isLinkSignIn,["prevent"]))},r(e.isLinkSignIn?"Entrar com senha":"Esqueci minha senha"),513),[[R,!e.isSignUp&&!e.isLinkSignInBlocked]]),i("button",{type:"submit",disabled:e.isSubmitting,class:E(["ui-btn-lg ui-btn-primary mb-2 mt-5 w-full",e.isSubmitting&&"opacity-50"])},r(e.isSignUp?"Cadastrar":"Acessar minha conta"),11,se)],2),x(n,{speed:"slow"},{default:U(()=>[e.isEmailSentMsg?(l(),c("p",te,[ne,b(" "+r("Te enviamos o e-mail, verifique sua caixa de entrada e spam se necessário."),1)])):S("",!0)]),_:1}),i("a",{href:"?sign_up",class:"ui-btn-lg ui-btn-contrast block w-full text-center",onClick:t[3]||(t[3]=k(o=>e.isSignUp=!e.isSignUp,["prevent"]))},r(e.isSignUp?"Acessar minha conta":"Criar uma conta"),1)])],32)}const ae=P(X,[["render",ie]]),oe=C({__name:"AccountPage",setup(m,{expose:t}){t();let s=null;{const{location:a}=window,u=new URLSearchParams(a.search).get("return_url");if(!u){const n=new URL(a.toString());n.pathname="/app/",n.hash=`#${a.pathname.replace("/app/","/")}`,s=n.toString()}h(A,()=>{A.value&&(a.href=u||s)},{immediate:!0})}const e={get loginLinkActionUrl(){return s},set loginLinkActionUrl(a){s=a},LoginForm:ae};return Object.defineProperty(e,"__isScriptSetup",{enumerable:!1,value:!0}),e}}),re={class:"from-secondary-700 to-secondary-950 flex min-h-screen w-full flex-col justify-center bg-gradient-to-br"},le={class:"mx-auto p-4"},ce=i("section",{class:"ui-section text-center"},[i("a",{href:"/",class:"text-base-200 hover:text-white"},[i("i",{class:"i-arrow-right mr-1 rotate-180"}),b(" "+r("Ir para a loja"))])],-1),me={class:"overflow-hidden rounded-md shadow-md ring-4 ring-black/10"},ue={class:"mb-5 text-center"},de={href:"/",class:"inline-block"},pe={key:0,class:"ui-section px-0"},ge={class:"mx-auto flex max-w-sm flex-wrap items-center justify-evenly gap-4 px-3"};function _e(m,t,s,e,a,u){const n=F("ALink");return l(),c("article",re,[i("div",le,[ce,i("section",me,[x(e.LoginForm,K(W({loginLinkActionUrl:e.loginLinkActionUrl})),{head:U(()=>[i("div",ue,[i("a",de,[N(m.$slots,"logo")])])]),_:3},16)]),m.$settings.serviceLinks?.length?(l(),c("nav",pe,[i("ul",ge,[(l(!0),c(Y,null,G(m.$settings.serviceLinks,({title:o,href:d},g)=>(l(),c("li",{key:`s-${g}`},[x(n,{href:d,class:"ui-link text-base-200 hover:text-white"},{default:U(()=>[b(r(o),1)]),_:2},1032,["href"])]))),128))])])):S("",!0)])])}const Le=P(oe,[["render",_e]]);export{Le as default};
@@ -1 +1 @@
1
- import{_ as b,w as x}from"./_plugin-vue_export-helper.f75743ee.js";import{f as C}from"./modules-info.55780599.js";import{p as I,r as S,s as w,t as V}from"./shopping-cart.d9f601dd.js";import{Q as P,C as F}from"./QuantitySelector.ebf60845.js";import{P as v}from"./Prices.0e829c31.js";import{c as p,d as y,L as f,M as i,N as m,P as d,Q as k,Z as j,U as h,O as t,T as o,V as g,R as L,S as N}from"./ecom-utils.5cbfb95e.js";import{g as z}from"./name.01410784.js";import{g as A}from"./img.4f23a3dd.js";import"./afetch.f4507208.js";import"./sf-utils.b04e1813.js";import"./format-money.9cf6b04d.js";import"./price.04ceb6c4.js";import"./customer-session.5ab9ab1a.js";import"./index.8ac1db99.js";import"./i18n.29216eeb.js";const q=a=>{const s=p(()=>!a.item&&a.product?I(a.product):null),r=p(()=>a.item||s.value),e=p(()=>z(r.value)),n=p(()=>{const{slug:l}=r.value;return typeof l=="string"?`/${l}`:null}),u=p(()=>{if(r.value.picture)return A(r.value.picture,void 0,a.pictureSize||"small")}),c=p(()=>r.value.final_price||r.value.price);return{cartItem:r,title:e,link:n,image:u,finalPrice:c}},B=y({__name:"CartItem",props:{item:{},product:{},pictureSize:{}},setup(a,{expose:s}){s();const r=a,{cartItem:e,title:n,link:u,image:c,finalPrice:l}=q(r),_={props:r,cartItem:e,title:n,link:u,image:c,finalPrice:l,get removeCartItem(){return S},QuantitySelector:P,Prices:v};return Object.defineProperty(_,"__isScriptSetup",{enumerable:!1,value:!0}),_}}),Q={class:"relative bg-white shadow-sm"},E={class:"text-base-700 group-hover:text-base-900 flex-auto py-2 text-sm group-hover:underline"},M=t("span",{class:"border-3 text-danger-800 border-danger-700/30 flex h-5 w-5 flex-col justify-center rounded-full text-sm leading-none"},[t("i",{class:"i-close mx-auto my-0"})],-1),O=[M],R={class:"border-base-100 flex items-center justify-between border-t-2"},T={class:"border-base-100 border-r-2"};function U(a,s,r,e,n,u){const c=f("AImg"),l=f("ALink");return i(),m("article",Q,[d(l,{href:e.link,class:"group flex items-center gap-5 p-4"},{default:k(()=>[e.image?(i(),j(c,{key:0,picture:e.image,alt:e.title,class:"h-20 w-20 object-cover"},null,8,["picture","alt"])):h("",!0),t("p",E,o(e.title),1)]),_:1},8,["href"]),e.cartItem._id?(i(),m("button",{key:0,onClick:s[0]||(s[0]=x(_=>e.removeCartItem(e.cartItem._id),["stop"])),class:"absolute right-0 top-0 p-2 opacity-70 hover:opacity-100","aria-label":"Remover"},O)):h("",!0),t("div",R,[t("div",T,[d(e.QuantitySelector,{modelValue:e.cartItem.quantity,"onUpdate:modelValue":s[1]||(s[1]=_=>e.cartItem.quantity=_),min:e.cartItem.min_quantity,max:e.cartItem.max_quantity},null,8,["modelValue","min","max"])]),d(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-right text-[95%]"},null,8,["base-price","price"])])])}const D=b(B,[["render",U]]),Z=y({__name:"CartSidebar",emits:["close"],setup(a,{expose:s,emit:r}){s();const n={emit:r,get freeShippingFromValue(){return C},get shoppingCart(){return w},get totalItems(){return V},CheckoutLink:F,Prices:v,CartItem:D};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),G={class:"flex h-screen flex-col bg-white"},H={class:"z-10 flex items-center justify-end gap-3 px-6 py-4 shadow ring-1 ring-black/5"},J=t("span",{class:"text-base-600 text-right text-base font-medium"},o("Meu carrinho de compras"),-1),K={class:"min-w-[3rem] text-right"},W={class:"ui-badge-pill-lg"},X={class:"bg-base-50 grow overflow-y-auto"},Y={key:0,class:"text-center text-sm"},$={key:0,class:"secondary-subtle p-3"},ee=t("strong",{class:"lowercase"},o("Frete grátis"),-1),te={key:1,class:"bg-success-50 text-success-800 p-3"},re=t("i",{class:"text-success-900 i-check mr-1"},null,-1),se={class:"px-4 pb-2 pt-4"},ae={class:"z-10 px-5 pb-3 pt-4 ring-2 ring-black/5"},oe={class:"grid grid-cols-5 items-center gap-3 text-right"},ie=t("div",{class:"col-span-2"},o("Subtotal"),-1),ne=t("i",{class:"i-check mr-2"},null,-1),ce=t("i",{class:"i-arrow-right mr-1 rotate-180"},null,-1);function le(a,s,r,e,n,u){return i(),m("aside",G,[t("header",H,[J,t("span",K,[t("span",W,o(e.totalItems),1)])]),t("article",X,[e.freeShippingFromValue?(i(),m("div",Y,[e.freeShippingFromValue>e.shoppingCart.subtotal?(i(),m("div",$,[g(o("Adicione $1 para ganhar".replace("$1",a.$money(e.freeShippingFromValue-e.shoppingCart.subtotal)))+" ",1),ee])):(i(),m("div",te,[re,g(" "+o("Frete grátis a partir de")+" "+o(a.$money(e.freeShippingFromValue)),1)]))])):h("",!0),t("ul",se,[(i(!0),m(L,null,N(e.shoppingCart.items,(c,l)=>(i(),m("li",{key:l},[d(e.CartItem,{item:c,class:"mb-3"},null,8,["item"])]))),128))])]),t("footer",ae,[t("div",oe,[ie,d(e.Prices,{price:e.shoppingCart.subtotal,class:"col-span-3 text-lg"},null,8,["price"])]),d(e.CheckoutLink,{to:"checkout",class:"ui-btn-lg ui-btn-primary my-2.5 w-full text-right"},{default:k(()=>[ne,g(" "+o("Finalizar compra"))]),_:1}),t("a",{href:"#",onClick:s[0]||(s[0]=x(c=>e.emit("close"),["prevent"])),class:"ui-link text-base-500 hover:text-base-700 text-sm"},[ce,g(" "+o("Continuar comprando"))])])])}const Se=b(Z,[["render",le]]);export{Se as default};
1
+ import{_ as b,w as x}from"./_plugin-vue_export-helper.sk5AFsEV.js";import{f as C}from"./modules-info.sD0tdb2b.js";import{p as I,r as S,s as w,t as V}from"./shopping-cart.A-1jhlKi.js";import{Q as P,C as F}from"./QuantitySelector.YNmWjN8y.js";import{P as v}from"./Prices.PuQc6C7F.js";import{c as p,d as y,K as f,L as i,M as m,N as d,O as k,P as j,Q as h,T as o,R as t,S as g,X as L,Y as N}from"./ecom-utils.gJYgRPRz.js";import{g as z}from"./name.HU5l7TJo.js";import{g as A}from"./img.zh-Drf-O.js";import"./afetch.5c8VmT0-.js";import"./sf-utils.5t7r9A2G.js";import"./format-money.FMQXgKHB.js";import"./price.Easct8WC.js";import"./customer-session._VkzXnXT.js";import"./index.XrHFaN2F.js";import"./i18n.m7SpISxy.js";const q=a=>{const s=p(()=>!a.item&&a.product?I(a.product):null),r=p(()=>a.item||s.value),e=p(()=>z(r.value)),n=p(()=>{const{slug:l}=r.value;return typeof l=="string"?`/${l}`:null}),u=p(()=>{if(r.value.picture)return A(r.value.picture,void 0,a.pictureSize||"small")}),c=p(()=>r.value.final_price||r.value.price);return{cartItem:r,title:e,link:n,image:u,finalPrice:c}},B=y({__name:"CartItem",props:{item:{},product:{},pictureSize:{}},setup(a,{expose:s}){s();const r=a,{cartItem:e,title:n,link:u,image:c,finalPrice:l}=q(r),_={props:r,cartItem:e,title:n,link:u,image:c,finalPrice:l,get removeCartItem(){return S},QuantitySelector:P,Prices:v};return Object.defineProperty(_,"__isScriptSetup",{enumerable:!1,value:!0}),_}}),Q={class:"relative bg-white shadow-sm"},E={class:"text-base-700 group-hover:text-base-900 flex-auto py-2 text-sm group-hover:underline"},M=t("span",{class:"border-3 text-danger-800 border-danger-700/30 flex h-5 w-5 flex-col justify-center rounded-full text-sm leading-none"},[t("i",{class:"i-close mx-auto my-0"})],-1),O=[M],R={class:"border-base-100 flex items-center justify-between border-t-2"},T={class:"border-base-100 border-r-2"};function D(a,s,r,e,n,u){const c=f("AImg"),l=f("ALink");return i(),m("article",Q,[d(l,{href:e.link,class:"group flex items-center gap-5 p-4"},{default:k(()=>[e.image?(i(),j(c,{key:0,picture:e.image,alt:e.title,class:"h-20 w-20 object-cover"},null,8,["picture","alt"])):h("",!0),t("p",E,o(e.title),1)]),_:1},8,["href"]),e.cartItem._id?(i(),m("button",{key:0,onClick:s[0]||(s[0]=x(_=>e.removeCartItem(e.cartItem._id),["stop"])),class:"absolute right-0 top-0 p-2 opacity-70 hover:opacity-100","aria-label":"Remover"},O)):h("",!0),t("div",R,[t("div",T,[d(e.QuantitySelector,{modelValue:e.cartItem.quantity,"onUpdate:modelValue":s[1]||(s[1]=_=>e.cartItem.quantity=_),min:e.cartItem.min_quantity,max:e.cartItem.max_quantity},null,8,["modelValue","min","max"])]),d(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-right text-[95%]"},null,8,["base-price","price"])])])}const K=b(B,[["render",D]]),U=y({__name:"CartSidebar",emits:["close"],setup(a,{expose:s,emit:r}){s();const n={emit:r,get freeShippingFromValue(){return C},get shoppingCart(){return w},get totalItems(){return V},CheckoutLink:F,Prices:v,CartItem:K};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),X={class:"flex h-screen flex-col bg-white"},Y={class:"z-10 flex items-center justify-end gap-3 px-6 py-4 shadow ring-1 ring-black/5"},G=t("span",{class:"text-base-600 text-right text-base font-medium"},o("Meu carrinho de compras"),-1),H={class:"min-w-[3rem] text-right"},J={class:"ui-badge-pill-lg"},W={class:"bg-base-50 grow overflow-y-auto"},Z={key:0,class:"text-center text-sm"},$={key:0,class:"secondary-subtle p-3"},ee=t("strong",{class:"lowercase"},o("Frete grátis"),-1),te={key:1,class:"bg-success-50 text-success-800 p-3"},re=t("i",{class:"text-success-900 i-check mr-1"},null,-1),se={class:"px-4 pb-2 pt-4"},ae={class:"z-10 px-5 pb-3 pt-4 ring-2 ring-black/5"},oe={class:"grid grid-cols-5 items-center gap-3 text-right"},ie=t("div",{class:"col-span-2"},o("Subtotal"),-1),ne=t("i",{class:"i-check mr-2"},null,-1),ce=t("i",{class:"i-arrow-right mr-1 rotate-180"},null,-1);function le(a,s,r,e,n,u){return i(),m("aside",X,[t("header",Y,[G,t("span",H,[t("span",J,o(e.totalItems),1)])]),t("article",W,[e.freeShippingFromValue?(i(),m("div",Z,[e.freeShippingFromValue>e.shoppingCart.subtotal?(i(),m("div",$,[g(o("Adicione $1 para ganhar".replace("$1",a.$money(e.freeShippingFromValue-e.shoppingCart.subtotal)))+" ",1),ee])):(i(),m("div",te,[re,g(" "+o("Frete grátis a partir de")+" "+o(a.$money(e.freeShippingFromValue)),1)]))])):h("",!0),t("ul",se,[(i(!0),m(L,null,N(e.shoppingCart.items,(c,l)=>(i(),m("li",{key:l},[d(e.CartItem,{item:c,class:"mb-3"},null,8,["item"])]))),128))])]),t("footer",ae,[t("div",oe,[ie,d(e.Prices,{price:e.shoppingCart.subtotal,class:"col-span-3 text-lg"},null,8,["price"])]),d(e.CheckoutLink,{to:"checkout",class:"ui-btn-lg ui-btn-primary my-2.5 w-full text-right"},{default:k(()=>[ne,g(" "+o("Finalizar compra"))]),_:1}),t("a",{href:"#",onClick:s[0]||(s[0]=x(c=>e.emit("close"),["prevent"])),class:"ui-link text-base-500 hover:text-base-700 text-sm"},[ce,g(" "+o("Continuar comprando"))])])])}const Se=b(U,[["render",le]]);export{Se as default};
@@ -0,0 +1 @@
1
+ import{_ as w,v as B}from"./_plugin-vue_export-helper.sk5AFsEV.js";import{p as f}from"./modules-info.sD0tdb2b.js";import{c as d,d as T,K as x,L as r,M as l,N as c,O as o,Z as S,V as b,P as v,T as g,S as y,U as C,Q as m,a as H,o as L,W as N,R as _,X as P,Y as V,$ as j}from"./ecom-utils.gJYgRPRz.js";import"./afetch.5c8VmT0-.js";import"./sf-utils.5t7r9A2G.js";import"./format-money.FMQXgKHB.js";import"./price.Easct8WC.js";const M=s=>{const a=d(()=>s.title?f(s.title).value:""),t=d(()=>s.subtitle?f(s.subtitle).value:""),e=d(()=>s.buttonText?f(s.buttonText).value:""),i=d(()=>!!(a.value||t.value||e.value));return{parsedTitle:a,parsedSubtitle:t,parsedButtonText:e,hasHeader:i}},D=T({__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:i,parsedSubtitle:p,parsedButtonText:n}=M(t),u={props:t,hasHeader:e,parsedTitle:i,parsedSubtitle:p,parsedButtonText:n};return Object.defineProperty(u,"__isScriptSetup",{enumerable:!1,value:!0}),u}}),O={key:0,class:"mb-3 p-12 sm:mb-0 xl:ps-32"},z={key:1,class:"mt-4 text-lg md:mt-6"};function A(s,a,t,e,i,p){const n=x("ALink");return r(),l("div",{class:b(["mx-auto overflow-x-hidden",e.hasHeader?"grid grid-cols-1 sm:grid-cols-2 items-center":null])},[c(n,{href:t.href,class:b(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(()=>[S(s.$slots,"picture")]),_:3},8,["href","class"]),e.hasHeader?(r(),l("div",O,[e.parsedTitle?(r(),v(C(t.headingTag),{key:0,class:"ui-title mt-1"},{default:o(()=>[y(g(e.parsedTitle),1)]),_:1})):m("",!0),e.parsedSubtitle?(r(),l("p",z,g(e.parsedSubtitle),1)):m("",!0),e.parsedButtonText?(r(),v(n,{key:2,href:t.buttonLink,class:"ui-btn-lg ui-btn-contrast mt-7 min-w-[150px] md:mt-10"},{default:o(()=>[y(g(e.parsedButtonText),1)]),_:1},8,["href"])):m("",!0)])):m("",!0)],2)}const E=w(D,[["render",A]]),F=T({__name:"HeroSlider",props:{autoplay:{},slides:{}},setup(s,{expose:a}){a();const t=H(!1);L(()=>{t.value=!0});const e={isMounted:t,Banner:E};return Object.defineProperty(e,"__isScriptSetup",{enumerable:!1,value:!0}),e}}),I={class:"relative mx-auto"},K={class:"absolute bottom-5 right-5 z-10 flex w-screen items-center justify-end xl:left-1/2 xl:right-auto xl:-ms-[640px] xl:max-w-screen-xl"},Q=_("i",{class:"i-arrow-right rotate-180"},null,-1),R=_("i",{class:"i-arrow-right"},null,-1);function U(s,a,t,e,i,p){const n=x("CarouselControl"),u=x("Carousel");return r(),l("section",I,[c(u,{autoplay:t.autoplay,class:"secondary [&>*]:items-center"},{controls:o(()=>[N(_("div",K,[_("div",{class:b(["text-primary relative h-10 w-20 rounded-full bg-white/50 shadow-sm ring-1 ring-black/5 transition-opacity",e.isMounted?"opacity-100":"opacity-20 [&>*]:cursor-wait"])},[c(n,{class:"hover:bg-primary/10 h-10 w-10 rounded-full","is-prev":""},{default:o(()=>[Q]),_:1}),c(n,{class:"hover:bg-primary/10 h-10 w-10 rounded-full"},{default:o(()=>[R]),_:1})],2)],512),[[B,t.slides.length>1]])]),default:o(()=>[(r(!0),l(P,null,V(t.slides,(k,h)=>(r(),l("li",{key:h,class:"shrink-0 basis-full"},[c(e.Banner,j({...k,headingTag:h===0?"h2":"h3"},{class:"w-screen max-w-screen-2xl"}),{picture:o(()=>[S(s.$slots,`picture-${h}`)]),_:2},1040)]))),128))]),_:3},8,["autoplay"])])}const $=w(F,[["render",U]]);export{$ as default};
@@ -1 +1 @@
1
- import{_ as C,v as g}from"./_plugin-vue_export-helper.f75743ee.js";import{p as x}from"./modules-info.55780599.js";import{s as b,c as m,d as w,L as p,N as r,O as h,P as i,Q as u,M as l,X as S,R as y,S as B,W as k,U as L}from"./ecom-utils.5cbfb95e.js";import"./afetch.f4507208.js";import"./sf-utils.b04e1813.js";import"./format-money.9cf6b04d.js";import"./price.04ceb6c4.js";function P(t,e){{const s=btoa(JSON.stringify({filename:t}));window.parent.postMessage(JSON.parse(JSON.stringify({type:"open",filename:t,id:s})),window.location.origin),window.addEventListener("message",n=>{n.data.id===s&&e(n.data.data)})}}const N=t=>{const e=b(null);return window.$isCmsPreview&&P(t,s=>{e.value=s}),{liveContent:e}},V=t=>{const e={slides:[]};return t.header?.pitchBar&&(e.slides=t.header.pitchBar),e},O=t=>{const{liveContent:e}=N("layout"),s=m(()=>(e.value?V(e.value).slides:t.slides).map(({html:o})=>x(o).value.replace(/<\/?p>/g,"").replace(/&lt;(\/?d-md)&gt;/g,"<$1>"))),n=m(()=>s.value.filter(a=>a).length);return{parsedContents:s,countValidSlides:n}},M=w({__name:"PitchBar",props:{slides:{}},setup(t,{expose:e}){e();const s=t,{parsedContents:n,countValidSlides:a}=O(s),o={props:s,parsedContents:n,countValidSlides:a};return Object.defineProperty(o,"__isScriptSetup",{enumerable:!1,value:!0}),o}}),J={class:"bg-base-100 relative z-20"},z={class:"container mx-auto px-3 py-1 md:w-2/3"},A=["innerHTML"],E={class:"text-base-400 text-xl leading-none"};function H(t,e,s,n,a,o){const f=p("ALink"),_=p("CarouselControl"),v=p("Carousel");return l(),r("div",J,[h("div",z,[i(v,{autoplay:n.countValidSlides>1?7e3:void 0},{controls:u(()=>[S(h("div",E,[i(_,{class:"bg-base-100 hover:text-base-700 pr-2","is-prev":""}),i(_,{class:"bg-base-100 hover:text-base-700 pl-2"})],512),[[g,n.countValidSlides>1]])]),default:u(()=>[(l(!0),r(y,null,B(s.slides,(c,d)=>(l(),r("li",{key:d,class:"h-full shrink-0 basis-full text-center"},[i(f,{href:c.href,target:c.target,class:k(["inline-block px-8",c.href?"hover:underline":null])},{default:u(()=>[n.parsedContents[d]?(l(),r("span",{key:0,innerHTML:n.parsedContents[d],class:"prose text-base-800 text-sm"},null,8,A)):L("",!0)]),_:2},1032,["href","target","class"])]))),128))]),_:1},8,["autoplay"])])])}const W=C(M,[["render",H]]);export{W as default};
1
+ import{_ as C,v as g}from"./_plugin-vue_export-helper.sk5AFsEV.js";import{p as x}from"./modules-info.sD0tdb2b.js";import{s as b,c as m,d as w,K as p,M as r,R as h,N as i,O as u,L as l,W as S,X as y,Y as B,V as k,Q as L}from"./ecom-utils.gJYgRPRz.js";import"./afetch.5c8VmT0-.js";import"./sf-utils.5t7r9A2G.js";import"./format-money.FMQXgKHB.js";import"./price.Easct8WC.js";function V(t,e){{const s=btoa(JSON.stringify({filename:t}));window.parent.postMessage(JSON.parse(JSON.stringify({type:"open",filename:t,id:s})),window.location.origin),window.addEventListener("message",n=>{n.data.id===s&&e(n.data.data)})}}const N=t=>{const e=b(null);return window.$isCmsPreview&&V(t,s=>{e.value=s}),{liveContent:e}},P=t=>{const e={slides:[]};return t.header?.pitchBar&&(e.slides=t.header.pitchBar),e},O=t=>{const{liveContent:e}=N("layout"),s=m(()=>(e.value?P(e.value).slides:t.slides).map(({html:o})=>x(o).value.replace(/<\/?p>/g,"").replace(/&lt;(\/?d-md)&gt;/g,"<$1>"))),n=m(()=>s.value.filter(a=>a).length);return{parsedContents:s,countValidSlides:n}},M=w({__name:"PitchBar",props:{slides:{}},setup(t,{expose:e}){e();const s=t,{parsedContents:n,countValidSlides:a}=O(s),o={props:s,parsedContents:n,countValidSlides:a};return Object.defineProperty(o,"__isScriptSetup",{enumerable:!1,value:!0}),o}}),J={class:"bg-base-100 relative z-20"},z={class:"container mx-auto px-3 py-1 md:w-2/3"},A=["innerHTML"],E={class:"text-base-400 text-xl leading-none"};function H(t,e,s,n,a,o){const f=p("ALink"),_=p("CarouselControl"),v=p("Carousel");return l(),r("div",J,[h("div",z,[i(v,{autoplay:n.countValidSlides>1?7e3:void 0},{controls:u(()=>[S(h("div",E,[i(_,{class:"bg-base-100 hover:text-base-700 pr-2","is-prev":""}),i(_,{class:"bg-base-100 hover:text-base-700 pl-2"})],512),[[g,n.countValidSlides>1]])]),default:u(()=>[(l(!0),r(y,null,B(s.slides,(c,d)=>(l(),r("li",{key:d,class:"h-full shrink-0 basis-full text-center"},[i(f,{href:c.href,target:c.target,class:k(["inline-block px-8",c.href?"hover:underline":null])},{default:u(()=>[n.parsedContents[d]?(l(),r("span",{key:0,innerHTML:n.parsedContents[d],class:"prose text-base-800 text-sm"},null,8,A)):L("",!0)]),_:2},1032,["href","target","class"])]))),128))]),_:1},8,["autoplay"])])])}const U=C(M,[["render",H]]);export{U as default};
@@ -1 +1 @@
1
- import{a as I,i as A,d as z,l as M}from"./modules-info.55780599.js";import{c as s,d as S,L as T,M as o,N as i,T as r,U as c,O as h,V as N,W as C,P as L,Q as B}from"./ecom-utils.5cbfb95e.js";import{g,c as E}from"./price.04ceb6c4.js";import{_ as F}from"./_plugin-vue_export-helper.f75743ee.js";const W=(a,l)=>{const{type:n,value:e}=l;let d;return e?(n==="percentage"?d=a*((100-e)/100):d=a-e,d>0?d:0):a},Q=a=>{const l=s(()=>a.product||{price:a.price||0,base_price:a.basePrice}),n=s(()=>{const{variations:t}=l.value;if(t){const u=g(l.value);for(let P=0;P<t.length;P++)if(g({...l.value,...t[P]})>u)return!0}return!1}),e=s(()=>{const t=g(l.value),u=I.value;return u&&(!u.min_amount||t>u.min_amount)?W(t,u):t}),d=s(()=>{if(E(l.value))return l.value.base_price;const t=g(l.value);return t>e.value?t:0}),_=s(()=>a.installmentsOption||A.value||{max_number:1}),m=s(()=>{if(_.value.max_number<=1)return 1;const t=_.value.min_installment||5,u=Math.floor(e.value/t);return Math.min(u,_.value.max_number)}),b=s(()=>_.value.monthly_interest||0),k=s(()=>{if(m.value>=2){if(!b.value)return e.value/m.value;const t=b.value/100;return e.value*t/(1-(1+t)**-m.value)}return 0}),f=s(()=>{const t=a.discountOption||z.value;return t&&(!t.min_amount||t.min_amount<=e.value)&&(!a.isAmountTotal||t.apply_at==="total")?t:{}}),O=s(()=>{const{label:t}=f.value;return t?t.includes(" ")?t:`via ${t}`:""}),V=s(()=>W(e.value,f.value)),v=s(()=>{if(a.loyaltyPointsProgram)return a.loyaltyPointsProgram;const t=M.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=s(()=>v.value.min_subtotal_to_earn||0),j=s(()=>v.value.name||""),D=s(()=>v.value.earn_percentage||0),x=s(()=>D.value*v.value.ratio),w=s(()=>x.value>=1?e.value*(x.value/100):0);return{hasVariedPrices:n,salePrice:e,comparePrice:d,installmentsObject:_,installmentsNumber:m,monthlyInterest:b,installmentValue:k,discountObject:f,discountLabel:O,priceWithDiscount:V,pointsProgramObject:v,pointsMinPrice:y,pointsProgramName:j,earnPointsPercentage:D,cashbackPercentage:x,cashbackValue:w}},R=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(a,{expose:l}){l();const n=a,{hasVariedPrices:e,salePrice:d,comparePrice:_,cashbackPercentage:m,cashbackValue:b,installmentsNumber:k,monthlyInterest:f,installmentValue:O,priceWithDiscount:V,discountLabel:v}=Q(n),y={props:n,hasVariedPrices:e,salePrice:d,comparePrice:_,cashbackPercentage:m,cashbackValue:b,installmentsNumber:k,monthlyInterest:f,installmentValue:O,priceWithDiscount:V,discountLabel:v};return Object.defineProperty(y,"__isScriptSetup",{enumerable:!1,value:!0}),y}}),U={key:0,class:"text-base-500 mr-1 text-[87%]"},q={key:0},G={key:1},H={key:0},J={key:0,class:"relative z-10"},K=["data-tooltip"],X=h("i",{class:"i-arrow-uturn-left mr-1"},null,-1),Y={class:"font-medium"},Z=h("small",null," cashback",-1),$={key:0},ee={key:0},te={key:1},ae={key:2},ne={key:0},se={key:0},re={key:1};function oe(a,l,n,e,d,_){const m=T("Fade");return o(),i("div",{class:C(["text-base-600 [&>div]:[font-size:90%] [&_small]:lowercase [&_small]:[font-size:92%]",n.isBig?"text-lg":null])},[e.comparePrice?(o(),i("span",U,[n.isLiteral?(o(),i("small",q,r("De "))):c("",!0),h("s",null,r(a.$money(e.comparePrice)),1),n.isLiteral?(o(),i("small",G,r(" Por"))):c("",!0)])):c("",!0),h("strong",{class:C(["text-base-800",n.isBig?"text-4xl block":"inline-block"])},[e.hasVariedPrices?(o(),i("small",H,r("A partir de "))):c("",!0),N(" "+r(a.$money(e.salePrice)),1)],2),L(m,{slide:"down"},{default:B(()=>[e.cashbackValue&&n.hasCashback?(o(),i("div",J,[h("span",{"data-tooltip":"Receba $1 de volta".replace("$1",a.$percentage(e.cashbackPercentage))},[X,h("span",Y,r(a.$money(e.cashbackValue)),1),Z],8,K)])):c("",!0)]),_:1}),L(m,{slide:"down"},{default:B(()=>[e.installmentValue&&n.hasPriceOptions?(o(),i("div",$,[n.isLiteral?(o(),i("small",ee,r("Até "))):c("",!0),N(" "+r(e.installmentsNumber)+"x ",1),n.isLiteral?(o(),i("small",te,r(" De "))):c("",!0),h("span",null,r(a.$money(e.installmentValue)),1),!e.monthlyInterest&&n.isLiteral?(o(),i("small",ae,r(" Sem juros"))):c("",!0)])):c("",!0)]),_:1}),L(m,{slide:"down"},{default:B(()=>[e.priceWithDiscount<e.salePrice&&n.hasPriceOptions?(o(),i("div",ne,[e.discountLabel?c("",!0):(o(),i("small",se,r("A partir de "))),h("span",null,r(a.$money(e.priceWithDiscount)),1),e.discountLabel?(o(),i("small",re,r(` ${e.discountLabel}`),1)):c("",!0)])):c("",!0)]),_:1})],2)}const me=F(R,[["render",oe]]);export{me as P};
1
+ import{a as W,i as A,d as S,l as z}from"./modules-info.sD0tdb2b.js";import{c as s,d as M,K as T,L as o,M as i,T as r,Q as c,R as h,S as N,V as C,N as L,O as B}from"./ecom-utils.gJYgRPRz.js";import{g,c as E}from"./price.Easct8WC.js";import{_ as F}from"./_plugin-vue_export-helper.sk5AFsEV.js";const j=(a,l)=>{const{type:n,value:e}=l;let d;return e?(n==="percentage"?d=a*((100-e)/100):d=a-e,d>0?d:0):a},R=a=>{const l=s(()=>a.product||{price:a.price||0,base_price:a.basePrice}),n=s(()=>{const{variations:t}=l.value;if(t){const u=g(l.value);for(let P=0;P<t.length;P++)if(g({...l.value,...t[P]})>u)return!0}return!1}),e=s(()=>{const t=g(l.value),u=W.value;return u&&(!u.min_amount||t>u.min_amount)?j(t,u):t}),d=s(()=>{if(E(l.value))return l.value.base_price;const t=g(l.value);return t>e.value?t:0}),_=s(()=>a.installmentsOption||A.value||{max_number:1}),m=s(()=>{if(_.value.max_number<=1)return 1;const t=_.value.min_installment||5,u=Math.floor(e.value/t);return Math.min(u,_.value.max_number)}),b=s(()=>_.value.monthly_interest||0),k=s(()=>{if(m.value>=2){if(!b.value)return e.value/m.value;const t=b.value/100;return e.value*t/(1-(1+t)**-m.value)}return 0}),f=s(()=>{const t=a.discountOption||S.value;return t&&(!t.min_amount||t.min_amount<=e.value)&&(!a.isAmountTotal||t.apply_at==="total")?t:{}}),O=s(()=>{const{label:t}=f.value;return t?t.includes(" ")?t:`via ${t}`:""}),V=s(()=>j(e.value,f.value)),v=s(()=>{if(a.loyaltyPointsProgram)return a.loyaltyPointsProgram;const t=z.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=s(()=>v.value.min_subtotal_to_earn||0),w=s(()=>v.value.name||""),D=s(()=>v.value.earn_percentage||0),x=s(()=>D.value*v.value.ratio),I=s(()=>x.value>=1?e.value*(x.value/100):0);return{hasVariedPrices:n,salePrice:e,comparePrice:d,installmentsObject:_,installmentsNumber:m,monthlyInterest:b,installmentValue:k,discountObject:f,discountLabel:O,priceWithDiscount:V,pointsProgramObject:v,pointsMinPrice:y,pointsProgramName:w,earnPointsPercentage:D,cashbackPercentage:x,cashbackValue:I}},K=M({__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(a,{expose:l}){l();const n=a,{hasVariedPrices:e,salePrice:d,comparePrice:_,cashbackPercentage:m,cashbackValue:b,installmentsNumber:k,monthlyInterest:f,installmentValue:O,priceWithDiscount:V,discountLabel:v}=R(n),y={props:n,hasVariedPrices:e,salePrice:d,comparePrice:_,cashbackPercentage:m,cashbackValue:b,installmentsNumber:k,monthlyInterest:f,installmentValue:O,priceWithDiscount:V,discountLabel:v};return Object.defineProperty(y,"__isScriptSetup",{enumerable:!1,value:!0}),y}}),Q={key:0,class:"text-base-500 mr-1 text-[87%]"},q={key:0},G={key:1},H={key:0},J={key:0,class:"relative z-10"},U=["data-tooltip"],X=h("i",{class:"i-arrow-uturn-left mr-1"},null,-1),Y={class:"font-medium"},Z=h("small",null," cashback",-1),$={key:0},ee={key:0},te={key:1},ae={key:2},ne={key:0},se={key:0},re={key:1};function oe(a,l,n,e,d,_){const m=T("Fade");return o(),i("div",{class:C(["text-base-600 [&>div]:[font-size:90%] [&_small]:lowercase [&_small]:[font-size:92%]",n.isBig?"text-lg":null])},[e.comparePrice?(o(),i("span",Q,[n.isLiteral?(o(),i("small",q,r("De "))):c("",!0),h("s",null,r(a.$money(e.comparePrice)),1),n.isLiteral?(o(),i("small",G,r(" Por"))):c("",!0)])):c("",!0),h("strong",{class:C(["text-base-800",n.isBig?"text-4xl block":"inline-block"])},[e.hasVariedPrices?(o(),i("small",H,r("A partir de "))):c("",!0),N(" "+r(a.$money(e.salePrice)),1)],2),L(m,{slide:"down"},{default:B(()=>[e.cashbackValue&&n.hasCashback?(o(),i("div",J,[h("span",{"data-tooltip":"Receba $1 de volta".replace("$1",a.$percentage(e.cashbackPercentage))},[X,h("span",Y,r(a.$money(e.cashbackValue)),1),Z],8,U)])):c("",!0)]),_:1}),L(m,{slide:"down"},{default:B(()=>[e.installmentValue&&n.hasPriceOptions?(o(),i("div",$,[n.isLiteral?(o(),i("small",ee,r("Até "))):c("",!0),N(" "+r(e.installmentsNumber)+"x ",1),n.isLiteral?(o(),i("small",te,r(" De "))):c("",!0),h("span",null,r(a.$money(e.installmentValue)),1),!e.monthlyInterest&&n.isLiteral?(o(),i("small",ae,r(" Sem juros"))):c("",!0)])):c("",!0)]),_:1}),L(m,{slide:"down"},{default:B(()=>[e.priceWithDiscount<e.salePrice&&n.hasPriceOptions?(o(),i("div",ne,[e.discountLabel?c("",!0):(o(),i("small",se,r("A partir de "))),h("span",null,r(a.$money(e.priceWithDiscount)),1),e.discountLabel?(o(),i("small",re,r(` ${e.discountLabel}`),1)):c("",!0)])):c("",!0)]),_:1})],2)}const me=F(K,[["render",oe]]);export{me as P};
@@ -0,0 +1 @@
1
+ import{b as C}from"./customer-session._VkzXnXT.js";import{c as T,u as V}from"./use-product-card.erbOV6Fv.js";import{a as m,J as N,d as j,K as A,L as s,M as i,N as y,O as I,P as S,Q as w,R as h,S as p,T as k,U as L,V as O}from"./ecom-utils.gJYgRPRz.js";import{_ as z,w as B}from"./_plugin-vue_export-helper.sk5AFsEV.js";import{u as E}from"./index.5PN-EYMS.js";import{a as H}from"./shopping-cart.A-1jhlKi.js";import{P as M}from"./Prices.PuQc6C7F.js";import{g as Q}from"./index.XrHFaN2F.js";const ie=t=>{const r=m(t.title||""),c=m(t.titleLink||""),e=m(!1);let g=null;const d=m(null),n=N(t.products||[]);return t.products||(e.value=!0,g=(async()=>{let u=t.searchQuery||"",l;if(t.collectionId){try{const{data:a}=await C.get(`collections/${t.collectionId}`);l=a}catch(a){console.error(a),d.value=a}const o=l?.products;Array.isArray(o)&&o.length&&(u+=`&_id=${o.slice(0,60).join(",")}`),!r.value&&r.value!==null&&l?.name&&(r.value=l?.name)}const _=t.limit||24;let f=`offset=${t.page?(t.page-1)*_:0}&limit=${_}`;t.sort&&(f+=`&sort=${t.sort}`),f+=u;try{const{data:o}=await C.get(`search/v1?${f}`);if(t.isShuffle){let a=o.result.filter(P=>P.available&&T(P)).length,v,b;for(;a;)b=Math.floor(Math.random()*a--),v=o.result[a],o.result[a]=o.result[b],o.result[b]=v}o.result.forEach(a=>n.push(a))}catch(o){console.error(o),d.value=o}e.value=!1})()),{title:r,titleLink:c,isFetching:e,fetching:g,fetchError:d,products:n}},q=j({__name:"ProductCard",props:{product:{},productId:{},listName:{},listId:{},headingTag:{default:"h3"}},setup(t,{expose:r}){r();const c=t,{product:e,title:g,link:d,images:n,isInStock:u,isActive:l,discountPercentage:_,hasVariations:x}=V(c),f=m(null),o=E(f),a=m(!1);Q(o,()=>{a.value=!0});const v={props:c,product:e,title:g,link:d,images:n,isInStock:u,isActive:l,discountPercentage:_,hasVariations:x,card:f,isHovered:o,wasHoveredOnce:a,get addProductToCart(){return H},Prices:M};return Object.defineProperty(v,"__isScriptSetup",{enumerable:!1,value:!0}),v}}),D=["data-sku"],R={class:"aspect-square p-2 transition-transform motion-safe:group-hover:scale-110"},F={class:"relative h-full w-full overflow-hidden rounded bg-white group-hover:rounded-none"},J={key:0,class:"text-xs text-opacity-70"},K={key:1,class:"from-base-50/20 to-base-100 h-full w-full bg-gradient-to-br"},U={key:0,class:"uno-bm03rg"},G={class:"relative z-10 flex grow flex-col justify-between p-4"},W={class:"pt-2"},X={key:0},Y={key:1,class:"ui-badge bg-warning-100 text-warning-700"},Z=h("span",{class:"bg-on-primary text-primary mr-1 inline-block h-4 w-4 rounded-full text-center text-base leading-none opacity-80"}," + ",-1);function $(t,r,c,e,g,d){const n=A("AImg"),u=A("ALink");return s(),i("article",{ref:"card","data-sku":e.product.sku,class:"group relative mx-auto h-full max-w-[350px] px-0.5 py-3 hover:z-[1]"},[y(u,{href:e.link,class:"flex h-full flex-col overflow-hidden rounded bg-white ring-black/5 group-hover:shadow group-hover:ring-1"},{default:I(()=>[h("div",R,[h("div",F,[e.images?.length?(s(),i("span",J,[y(n,{picture:e.images[0],alt:e.title,class:"absolute left-0 top-0 block h-full w-full object-cover"},null,8,["picture","alt"]),e.images[1]&&e.wasHoveredOnce?(s(),S(n,{key:0,picture:e.images[1],alt:e.title,class:"absolute left-0 top-0 z-10 block h-full w-full object-cover text-transparent opacity-0 transition-opacity group-hover:opacity-100 motion-safe:duration-300"},null,8,["picture","alt"])):w("",!0)])):(s(),i("div",K))])]),e.discountPercentage?(s(),i("span",U,[p(" -"),h("strong",null,k(e.discountPercentage),1),p("% ")])):w("",!0),h("div",G,[(s(),S(L(c.headingTag),{class:O(["ui-link line-clamp-2 no-underline",[e.isActive?"text-base-700":"text-base-500",e.link?"group-hover:text-primary group-hover:underline":null]])},{default:I(()=>[p(k(e.title),1)]),_:1},8,["class"])),h("div",W,[e.isActive?(s(),i("div",X,[y(e.Prices,{product:e.product},null,8,["product"])])):(s(),i("span",Y,k(e.isInStock?"Inativo":"Sem estoque"),1))]),e.isActive&&!e.hasVariations?(s(),i("button",{key:0,class:"uno-3suct9 ui-btn-sm ui-btn-primary",onClick:r[0]||(r[0]=B(l=>e.addProductToCart(e.product),["prevent"]))},[Z,p(" "+k("Adicionar ao carrinho"))])):w("",!0)])]),_:1},8,["href"])],8,D)}const ce=z(q,[["render",$]]);export{ce as P,ie as u};
@@ -0,0 +1,7 @@
1
+ import{_ as D,w as J}from"./_plugin-vue_export-helper.sk5AFsEV.js";import{a as Z}from"./index.5PN-EYMS.js";import{a as H}from"./shopping-cart.A-1jhlKi.js";import{u as W}from"./use-product-card.erbOV6Fv.js";import{C as $,Q as tt}from"./QuantitySelector.YNmWjN8y.js";import{P as et}from"./Prices.PuQc6C7F.js";import{_ as G,b as ot}from"./customer-session._VkzXnXT.js";import{u as it}from"./sf-utils.5t7r9A2G.js";import{g as rt}from"./img-sizes.gxAI9JNh.js";import{_ as at,d as N,a as C,K as P,L as u,M as f,P as I,O as A,Q as b,R as v,X as k,V,N as w,Y as z,a5 as M,J as Q,r as L,w as T,a4 as U,c as K,S as B,T as S,a6 as st,o as nt,Z as lt}from"./ecom-utils.gJYgRPRz.js";import{g as ct}from"./name.HU5l7TJo.js";import"./index.XrHFaN2F.js";import"./price.Easct8WC.js";import"./use-analytics.1EVxbrS7.js";import"./afetch.5c8VmT0-.js";import"./img.zh-Drf-O.js";import"./modules-info.sD0tdb2b.js";import"./format-money.FMQXgKHB.js";import"./i18n.m7SpISxy.js";const q=(r,o,l)=>{if(typeof r!="object"||r===null)return[];let t=[];if(typeof r=="object"&&r!==null)if(Array.isArray(r))r.length&&(r[0].specifications?r.forEach(e=>{t=t.concat(q(e,o,l))}):r[0].text&&(t=r));else{const{specifications:e}=r;if(e)for(const n in e)e[n]&&n===o&&(t=e[o]);if(t&&!t.length&&Array.isArray(l)&&l.length){let n,d;return l&&(d=l.find(a=>a.grid_id===o))&&d.options&&(n=d.options.map(a=>{let s;return a.colors&&a.colors.length?s=a.colors[0]:s=a.option_id,{text:a.text,value:s}})),q(n,o)}}return t},X=q,dt=(r,o,l,t=", ")=>{let e=X(r,o,l);if(e.length){let n=e[0].text;for(let d=1;d<e.length;d++)n+=t+e[d].text;return n}return null},Y=dt,ut=(r,o,l,t)=>{const e=X(r,l,t);for(let n=0;n<e.length;n++)if(e[n].text===o)return e[n].value},mt=ut,ft=(r,o,l,t)=>{let e={};return r&&Array.isArray(r.variations)&&r.variations.forEach(n=>{if(l&&n.quantity<=0)return;let d=n.specifications,a=s=>Y(n,s,t);if(d){if(o){for(let s in o)if(o.hasOwnProperty(s)&&(!d[s]||a(s)!==o[s]))return}for(let s in d)if(d.hasOwnProperty(s)){let m=a(s);if(!e.hasOwnProperty(s))e[s]=[];else if(e[s].indexOf(m)!==-1)continue;e[s].push(m)}}}),e},j=ft,gt=(r,o,l=at.get("lang"))=>{let t;return Array.isArray(o)?t=o.find(e=>e.grid_id===r):console.error("`grids` must be array to get grid title"),t?ct(t,l):r},pt=gt,_t=N({__name:"ImagesGallery",props:{pictures:{}},setup(r,{expose:o}){o();const l=C(0),t=C("");let e;const n=C(!1),a={activeIndex:l,psId:t,get lightbox(){return e},set lightbox(s){e=s},isLoadingLightbox:n,zoom:s=>{if(t.value=`ps-${it()}`,!e&&!n.value){n.value=!0;const m="photoswipe-style";Promise.all([G(()=>import("./photoswipe-lightbox.esm.dZBqKD9u.js"),__vite__mapDeps([])),G(()=>import("./photoswipe.esm.Ylh9TGkz.js"),__vite__mapDeps([])),!document.getElementById(m)&&G(()=>import("./photoswipe.0V7m2jWu.js"),__vite__mapDeps([]))]).then(([{default:i},{default:c},_])=>{if(_){const{default:y}=_,p=document.createElement("style");p.id=m,p.textContent=y,document.head.appendChild(p)}e=new i({gallery:`#${t.value} > div`,children:"a",pswpModule:c,showAnimationDuration:300,hideAnimationDuration:300}),e.init(),e.loadAndOpen(s),n.value=!1})}},get getImgSizes(){return rt}};return Object.defineProperty(a,"__isScriptSetup",{enumerable:!1,value:!0}),a}}),ht={class:"-mx-4 flex w-screen gap-3 sm:mx-0 sm:w-full md:h-[525px] 2xl:gap-5"},vt=["onClick"],yt=v("span",{class:"absolute bottom-0 block h-2 w-full bg-gradient-to-b from-transparent to-white"},null,-1),bt={class:"relative aspect-square h-full grow md:aspect-auto"},xt={key:0,class:"i-arrow-path bg-base-200 absolute left-1/2 top-1/2 -ml-7 -mt-7 h-14 w-14 animate-spin","aria-label":"Carregando"},kt={key:1,class:"mt-2 flex justify-center gap-1.5 md:hidden"},wt=["aria-label","onClick"];function St(r,o,l,t,e,n){const d=P("AImg"),a=P("CarouselControl"),s=P("Carousel"),m=P("ALink");return u(),f("div",ht,[l.pictures.length>1?(u(),I(s,{key:0,axis:"y",class:"group hidden w-[300px] shrink-0 md:block"},{controls:A(()=>[v("span",null,[l.pictures.length>6?(u(),I(a,{key:0,class:"hover:bg-primary-300/60 text-primary !bottom-3 !left-1/2 -ml-5 h-10 w-10 rounded-full bg-white/60 text-xl opacity-0 shadow-sm ring-1 ring-black/5 group-hover:opacity-90"})):b("",!0),yt])]),default:A(()=>[(u(!0),f(k,null,z(Math.ceil(l.pictures.length/2),i=>(u(),f("li",{key:i,class:V(["grid h-1/3 w-full grid-cols-2 gap-3 px-1 pb-3",i===1&&"pt-1"])},[(u(!0),f(k,null,z([1,2].map(c=>(i-1)*2+(c-1)),c=>(u(),f(k,{key:`${i}-${c}`},[c<l.pictures.length?(u(),f("button",{key:0,class:"bg-secondary-100 h-full rounded",onClick:_=>t.activeIndex=c},[w(d,{picture:l.pictures[c],class:V(["ring-secondary/10 h-full w-full rounded border-2 object-cover opacity-90 transition-colors",c===t.activeIndex?"border-secondary/50 ring-4 cursor-auto":"border-transparent hover:border-primary hover:ring-4 hover:ring-primary/20"])},null,8,["picture","class"])],8,vt)):b("",!0)],64))),128))],2))),128))]),_:1})):b("",!0),v("div",bt,[w(s,{as:"div",index:t.activeIndex,"onUpdate:index":o[1]||(o[1]=i=>t.activeIndex=i),class:V(["text-base-600 [&_i]:i-arrow-right mx-auto h-full w-full max-w-[525px] [&>*]:h-full [&_i]:mx-2 [&_i]:text-2xl",t.isLoadingLightbox&&"opacity-80"]),id:t.psId},{default:A(()=>[o[0]||(M(-1),o[0]=(u(!0),f(k,null,z(l.pictures,(i,c)=>(u(),I(m,{key:`big-${c}`,href:i.zoom?.size&&i.zoom.url,"data-pswp-width":t.getImgSizes(i.zoom||"").width,"data-pswp-height":t.getImgSizes(i.zoom||"").height,target:"_blank",rel:"noreferrer",class:V(["shrink-0 basis-full",i.zoom?.size&&"cursor-zoom-in"]),onClick:J(()=>i.zoom?.size&&t.zoom(c),["prevent"])},{default:A(()=>[w(d,{picture:i,"preferred-size":"big",class:"h-full w-full rounded object-cover",fetchpriority:c===0?"high":"low",loading:c===0?"eager":"lazy"},null,8,["picture","fetchpriority","loading"])]),_:2},1032,["href","data-pswp-width","data-pswp-height","class","onClick"]))),128)),M(1),o[0])]),_:1},8,["index","class","id"]),t.isLoadingLightbox?(u(),f("i",xt)):b("",!0),l.pictures.length>1?(u(),f("ul",kt,[(u(!0),f(k,null,z(l.pictures.length,i=>(u(),f("li",{key:`d-${i}`},[v("button",{class:V(["bg-base-700 block h-1.5 w-3 rounded-full",t.activeIndex!==i-1&&"opacity-40"]),"aria-label":`Imagem ${i}`,onClick:c=>t.activeIndex=i-1},null,10,wt)]))),128))])):b("",!0)])])}const Ct=D(_t,[["render",St]]),Ot=r=>{let o=Q(globalThis.$storefront.data.grids);o||(o=Q([]),ot.get("grids").then(({data:{result:i}})=>{i.forEach(c=>o.push(c))}));const l=L({}),t=L({});T(U(r,"variations"),()=>{Object.assign(t,j(r,void 0,!0));const i=j(r);Object.keys(i).forEach(c=>{t[c]?l[c]=t[c]:delete l[c]})},{immediate:!0});const e=K(()=>Object.keys(l)),n=L({}),d=C(),a=({optionText:i,gridId:c,gridIndex:_})=>{n[c]=i;const y={};for(let g=0;g<=_;g++){const h=e[g];n[h]&&(y[h]=n[h])}const p=j(r,y,!0);for(let g=_+1;g<e.value.length;g++){const h=e[g],O=p[h];t[h]=O,n[h]&&!O.includes(n[h])&&delete n[h]}const x=r.variations.slice(0);for(let g=0;g<x.length;g++){const h=x[g],{specifications:O}=h,R=Object.keys(O);for(let E=0;E<R.length;E++){const F=R[E];if(n[F]!==Y(h,F)){x.splice(g,1),g-=1;break}}}d.value=x[0]?._id||null};return T(U(r,"variationId"),i=>{if(!i||i===d.value)return;const c=r.variations.find(x=>x._id===i);if(!c){d.value=null;return}const{specifications:_}=c,y=Object.keys(_),p=(x=0)=>{const g=y[x];if(y[x]&&_[g]&&_[g].length===1){const h=_[g][0].text;l[g].find(O=>O===h)&&(a({optionText:h,gridId:g,gridIndex:e.value.indexOf(g)}),p(x+1))}};p()},{immediate:!0}),{grids:o,variationsGrids:l,activeVariationsGrids:t,selectOption:a,selectedOptions:n,variationId:d,getGridTitle:i=>pt(i,o),getColorOptionBg:i=>{const c=i.split(",").map(_=>mt(r.variations,_.trim(),"colors"));return c.length>1?`background:linear-gradient(to right bottom, ${c[0]} 50%, ${c[1]} 50%)`:`background:${c[0]}`}}},Vt=N({__name:"SkuSelector",props:{variations:{},variationId:{}},emits:["update:variationId"],setup(r,{expose:o,emit:l}){o();const t=r,e=l,{variationsGrids:n,activeVariationsGrids:d,selectOption:a,selectedOptions:s,variationId:m,getGridTitle:i,getColorOptionBg:c}=Ot(t);T(m,y=>{e("update:variationId",y)});const _={props:t,emit:e,variationsGrids:n,activeVariationsGrids:d,selectOption:a,selectedOptions:s,variationId:m,getGridTitle:i,getColorOptionBg:c};return Object.defineProperty(_,"__isScriptSetup",{enumerable:!1,value:!0}),_}}),At={class:"text-base-700 text-sm font-medium"},zt={key:0,class:"text-base-800"},Pt={key:0,class:"mt-2 flex gap-2"},It=["onClick"];function Tt(r,o,l,t,e,n){return u(),f("div",null,[(u(!0),f(k,null,z(t.variationsGrids,(d,a)=>(u(),f("div",{key:a},[v("span",At,[B(S(t.getGridTitle(a))+": ",1),t.selectedOptions[a]?(u(),f("strong",zt,S(t.selectedOptions[a]),1)):b("",!0)]),d.length<7?(u(),f("ul",Pt,[(u(!0),f(k,null,z(d,(s,m)=>(u(),f("li",{key:`${a}-${m}`},[v("button",{class:V(["ring-secondary/60 rounded border",[t.selectedOptions[a]===s?"border-secondary ring-2":null,a==="colors"?"h-9 w-9 text-[0]":"px-2 py-1",t.activeVariationsGrids[a].includes(s)?"text-base-800 bg-base-100 border-base-400":"text-base-500 bg-base-200 border-base-300"]]),style:st(a==="colors"?t.getColorOptionBg(s):void 0),onClick:i=>t.selectOption({optionText:s,gridId:a,gridIndex:m})},S(s),15,It)]))),128))])):b("",!0)]))),128))])}const Et=D(Vt,[["render",Tt]]),Gt=N({__name:"ProductDetails",props:{product:{default:()=>globalThis.$storefront.apiContext?.doc}},setup(r,{expose:o}){o();const l=r,{product:t,title:e,isActive:n}=W(l),d=C(t.min_quantity||1),a=Z("history"),s=C(!1),m=C(null);T(m,p=>{p&&(a.var=p,s.value=!1)}),nt(()=>{T(a,({var:p})=>{typeof p=="string"&&p&&(m.value=p)},{immediate:!0})});const i=K(()=>!!(!t.variations?.length||m.value)),c=p=>(i.value?s.value=!1:(p&&p.preventDefault(),s.value=!0),!s.value),y={props:l,product:t,title:e,isActive:n,quantity:d,params:a,hasSkuSelectionAlert:s,variationId:m,isSkuSelected:i,checkVariation:c,addToCart:()=>{c()&&H(t,m.value?m.value:void 0)},CheckoutLink:$,QuantitySelector:tt,Prices:et,ImagesGallery:Ct,SkuSelector:Et};return Object.defineProperty(y,"__isScriptSetup",{enumerable:!1,value:!0}),y}}),Lt={class:"ui-section relative grid grid-cols-1 items-start gap-5 md:gap-4 lg:grid-cols-4 2xl:gap-6"},jt={class:"w-full lg:col-span-3"},Bt={class:"lg:sticky-header:translate-y-14 top-0 py-4 transition-transform lg:sticky"},qt={class:"ui-text-brand text-secondary-900 text-lg"},Dt={key:0,class:"mt-5"},Nt={key:0,class:"ui-alert inline-block"},Rt=v("i",{class:"i-arrow-right ml-1 -rotate-90"},null,-1),Ft={class:"mt-5 flex flex-wrap items-center gap-x-4 gap-y-2 overflow-hidden md:flex-nowrap lg:mt-4 lg:flex-wrap"},Mt=v("i",{class:"i-chevron-double-right mr-1"},null,-1),Qt=["data-tooltip"],Ut={class:"w-full lg:col-span-3"};function Jt(r,o,l,t,e,n){const d=P("Fade");return u(),f("section",Lt,[v("div",jt,[t.product.pictures?.length?(u(),I(t.ImagesGallery,{key:0,pictures:t.product.pictures},null,8,["pictures"])):b("",!0)]),v("div",Bt,[v("h1",qt,S(t.title),1),t.isActive?(u(),f("div",Dt,[w(t.Prices,{product:t.product,"is-big":"","is-literal":""},null,8,["product"]),t.product.variations?(u(),I(t.SkuSelector,{key:0,variations:t.product.variations,"variation-id":t.variationId,"onUpdate:variationId":o[0]||(o[0]=a=>t.variationId=a),class:"my-4"},null,8,["variations","variation-id"])):b("",!0),w(d,{slide:"down"},{default:A(()=>[t.hasSkuSelectionAlert?(u(),f("div",Nt,[B(S("Por favor selecione uma opção em cada campo acima")+" "),Rt])):b("",!0)]),_:1}),v("div",Ft,[w(t.QuantitySelector,{modelValue:t.quantity,"onUpdate:modelValue":o[1]||(o[1]=a=>t.quantity=a),min:t.product.min_quantity,max:t.product.quantity,class:"border-base-100 rounded md:mr-5 lg:mb-2 lg:mr-auto lg:border-2"},null,8,["modelValue","min","max"]),w(t.CheckoutLink,{class:"ui-btn-lg ui-btn-primary grow text-center",to:"checkout","cart-item":{product_id:t.product._id,quantity:t.quantity,variation_id:t.variationId||void 0},"data-tooltip":t.isSkuSelected?null:"Escolha os detalhes do produto para comprar",onClick:t.checkVariation},{default:A(()=>[Mt,B(" "+S("Comprar"))]),_:1},8,["cart-item","data-tooltip"]),v("button",{class:"ui-btn-lg ui-btn-contrast grow",onClick:J(t.addToCart,["prevent"]),"data-tooltip":t.isSkuSelected?null:"Escolha os detalhes do produto para comprar"},S("Adicionar ao carrinho"),8,Qt)])])):b("",!0)]),v("div",Ut,[lt(r.$slots,"description")])])}const me=D(Gt,[["render",Jt]]);export{me as default};
2
+ function __vite__mapDeps(indexes) {
3
+ if (!__vite__mapDeps.viteFileDeps) {
4
+ __vite__mapDeps.viteFileDeps = []
5
+ }
6
+ return indexes.map((i) => __vite__mapDeps.viteFileDeps[i])
7
+ }
@@ -0,0 +1 @@
1
+ import{_ as h,v as x}from"./_plugin-vue_export-helper.sk5AFsEV.js";import{c as k}from"./index.5PN-EYMS.js";import{u as S,P as b}from"./ProductCard.ephJafAE.js";import{u as v}from"./sf-utils.5t7r9A2G.js";import{d as g,K as u,M as s,R as L,N as o,O as r,V as C,Q as y,L as a,S as N,T as P,W as R,X as V,Y as w}from"./ecom-utils.gJYgRPRz.js";import"./index.XrHFaN2F.js";import"./customer-session._VkzXnXT.js";import"./use-product-card.erbOV6Fv.js";import"./use-analytics.1EVxbrS7.js";import"./shopping-cart.A-1jhlKi.js";import"./price.Easct8WC.js";import"./afetch.5c8VmT0-.js";import"./name.HU5l7TJo.js";import"./i18n.m7SpISxy.js";import"./img.zh-Drf-O.js";import"./Prices.PuQc6C7F.js";import"./modules-info.sD0tdb2b.js";import"./format-money.FMQXgKHB.js";const B=g({__name:"ProductShelf",props:{collectionId:{},searchQuery:{},sort:{},title:{},titleLink:{},isShuffle:{type:Boolean},limit:{},page:{},products:{}},async setup(p,{expose:d}){d();const l=p,[e,_]=k(),{title:n,titleLink:i,fetching:c,products:m}=S(l),t=n.value||`Shelf ${v()}`,f={props:l,DefineCarouselControl:e,ReuseCarouselControl:_,title:n,titleLink:i,fetching:c,products:m,listName:t,ProductCard:b};return Object.defineProperty(f,"__isScriptSetup",{enumerable:!1,value:!0}),f}}),D={class:"ui-section"},T={key:0,class:"mx-auto mb-2 max-w-prose text-center"},A={class:"ui-text-brand text-3xl"};function I(p,d,l,e,_,n){const i=u("ALink"),c=u("CarouselControl"),m=u("Carousel");return a(),s("section",D,[e.title?(a(),s("div",T,[L("h2",A,[o(i,{href:e.titleLink,class:C(e.titleLink?"ui-link":"text-base-700")},{default:r(()=>[N(P(e.title),1)]),_:1},8,["href","class"])])])):y("",!0),o(m,{class:"group/shelf"},{controls:r(()=>[o(e.DefineCarouselControl,null,{default:r(({isPrev:t})=>[R(o(c,{class:C(["uno-c36cp5",t?"!-left-4":"!-right-4"]),"is-prev":t},null,8,["class","is-prev"]),[[x,e.products.length>2]])]),_:1}),o(e.ReuseCarouselControl,{"is-prev":!0}),o(e.ReuseCarouselControl)]),default:r(()=>[(a(!0),s(V,null,w(e.products,t=>(a(),s("li",{key:t._id,class:"shrink-0 basis-1/2 md:basis-1/3 lg:basis-1/4"},[o(e.ProductCard,{product:t,"list-name":e.listName},null,8,["product","list-name"])]))),128))]),_:1})])}const ee=h(B,[["render",I]]);export{ee as default};
@@ -1 +1 @@
1
- import{_ as v,w as V,a as U}from"./_plugin-vue_export-helper.f75743ee.js";import{d as M,c as y,M as p,N as f,Y as u,a3 as q,R as k,V as B,a as P,a4 as $,O as x,T as N,a1 as I,a2 as g,X as T,P as w,Q as C}from"./ecom-utils.5cbfb95e.js";import{u as j}from"./sf-utils.b04e1813.js";const z=M({__name:"CheckoutLink",props:{to:{default:"cart"},cartUrl:{default:globalThis.$storefront?.settings.cartUrl||"/app/#/cart"},checkoutUrl:{default:globalThis.$storefront?.settings.checkoutUrl||"/app/#/checkout"},cartId:{},cartItem:{}},setup(a,{expose:i}){i();const t=a,e=y(()=>{let n=t.to==="cart"?t.cartUrl:t.checkoutUrl;if(t.cartId)n+=`/${t.cartId}`;else if(t.cartItem){const o={product_id:t.cartItem.product_id},{variation_id:l,quantity:d,sku:c,customizations:m}=t.cartItem;l&&(o.variation_id=l),d&&(o.quantity=String(d)),c&&(o.sku=c),m&&m.forEach(({label:r,option:_,attachment:S},Q)=>{const b=`customizations.${Q}.`;r&&(o[b+"label"]=r),_&&(_._id&&(o[b+"option._id"]=_._id),o[b+"option.text"]=_.text),S&&(o[b+"attachment"]=S)}),n+="?"+new URLSearchParams(o).toString()}return n}),s={props:t,href:e};return Object.defineProperty(s,"__isScriptSetup",{enumerable:!1,value:!0}),s}}),O=["href"];function L(a,i,t,e,s,n){return p(),f("a",{href:e.href},[u(a.$slots,"default")],8,O)}const Z=v(z,[["render",L]]),R=M({__name:"QuantitySelectorControl",props:{isMinus:{type:Boolean}},setup(a,{expose:i}){i();const{value:t,isBoundMin:e,isBoundMax:s}=q(h),n={value:t,isBoundMin:e,isBoundMax:s};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),D=["data-quantity-selector-control","aria-label","disabled"];function E(a,i,t,e,s,n){return p(),f("button",{type:"button",class:"leading-12 enabled:text-primary enabled:hover:bg-primary-100/70 h-12 w-10 text-xl 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:i[0]||(i[0]=V(o=>e.value+=t.isMinus?-1:1,["prevent"]))},[u(a.$slots,"default",{},()=>[t.isMinus?(p(),f(k,{key:0},[B("−")],64)):(p(),f(k,{key:1},[B("+")],64))])],8,D)}const F=v(R,[["render",E]]),h=Symbol("quantitySelector"),K=M({__name:"QuantitySelector",props:{modelValue:{default:1},min:{default:1},max:{},step:{},disabled:{type:Boolean},readonly:{type:Boolean}},emits:["update:modelValue"],setup(a,{expose:i,emit:t}){i();const e=a,s=t,n=P(null),o=`NInput${j()}`,l=y({get(){return e.modelValue},set(r){r<e.min&&(r=e.min,n.value.value=`${r}`),e.max&&r>e.max&&(r=e.max,n.value.value=`${r}`),s("update:modelValue",r)}}),d=y(()=>e.min>=l.value),c=y(()=>e.max<=l.value);$(h,{value:l,isBoundMin:d,isBoundMax:c});const m={quantitySelectorKey:h,props:e,emit:s,input:n,inputId:o,value:l,isBoundMin:d,isBoundMax:c,QuantitySelectorControl:F};return Object.defineProperty(m,"__isScriptSetup",{enumerable:!1,value:!0}),m}}),X={"data-quantity-selector":""},Y={class:"flex items-center"},A=["min","max","step","disabled","readonly"];function G(a,i,t,e,s,n){return p(),f("div",X,[u(a.$slots,"label",I(g({inputId:e.inputId,value:e.value})),()=>[x("label",{for:e.inputId,class:"sr-only"},N("Quantidade"))]),x("div",Y,[T(x("input",{ref:"input",type:"number",id:e.inputId,"onUpdate:modelValue":i[0]||(i[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 border-transparent px-2 text-center text-lg [-moz-appearance:_textfield] [&::-webkit-inner-spin-button]:m-0 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:m-0 [&::-webkit-outer-spin-button]:appearance-none"},null,8,A),[[U,e.value]]),u(a.$slots,"controls",I(g({value:e.value,isBoundMin:e.isBoundMin,isBoundMax:e.isBoundMax})),()=>[w(e.QuantitySelectorControl,{"is-minus":"",class:"order-first"},{default:C(()=>[u(a.$slots,"minus")]),_:3}),w(e.QuantitySelectorControl,{class:"order-last"},{default:C(()=>[u(a.$slots,"plus")]),_:3})])])])}const ee=v(K,[["render",G]]);export{Z as C,ee as Q};
1
+ import{_ as v,w as U,a as V}from"./_plugin-vue_export-helper.sk5AFsEV.js";import{d as M,c as y,L as p,M as f,Z as u,a2 as q,X as k,S as B,a as $,a3 as P,R as x,T as N,a0 as I,a1 as g,W as T,N as w,O as C}from"./ecom-utils.gJYgRPRz.js";import{u as j}from"./sf-utils.5t7r9A2G.js";const z=M({__name:"CheckoutLink",props:{to:{default:"cart"},cartUrl:{default:globalThis.$storefront?.settings.cartUrl||"/app/#/cart"},checkoutUrl:{default:globalThis.$storefront?.settings.checkoutUrl||"/app/#/checkout"},cartId:{},cartItem:{}},setup(a,{expose:i}){i();const t=a,e=y(()=>{let n=t.to==="cart"?t.cartUrl:t.checkoutUrl;if(t.cartId)n+=`/${t.cartId}`;else if(t.cartItem){const o={product_id:t.cartItem.product_id},{variation_id:l,quantity:d,sku:c,customizations:m}=t.cartItem;l&&(o.variation_id=l),d&&(o.quantity=String(d)),c&&(o.sku=c),m&&m.forEach(({label:r,option:_,attachment:S},Q)=>{const b=`customizations.${Q}.`;r&&(o[b+"label"]=r),_&&(_._id&&(o[b+"option._id"]=_._id),o[b+"option.text"]=_.text),S&&(o[b+"attachment"]=S)}),n+="?"+new URLSearchParams(o).toString()}return n}),s={props:t,href:e};return Object.defineProperty(s,"__isScriptSetup",{enumerable:!1,value:!0}),s}}),L=["href"];function O(a,i,t,e,s,n){return p(),f("a",{href:e.href},[u(a.$slots,"default")],8,L)}const Y=v(z,[["render",O]]),R=M({__name:"QuantitySelectorControl",props:{isMinus:{type:Boolean}},setup(a,{expose:i}){i();const{value:t,isBoundMin:e,isBoundMax:s}=q(h),n={value:t,isBoundMin:e,isBoundMax:s};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),D=["data-quantity-selector-control","aria-label","disabled"];function E(a,i,t,e,s,n){return p(),f("button",{type:"button",class:"leading-12 enabled:text-primary enabled:hover:bg-primary-100/70 h-12 w-10 text-xl 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:i[0]||(i[0]=U(o=>e.value+=t.isMinus?-1:1,["prevent"]))},[u(a.$slots,"default",{},()=>[t.isMinus?(p(),f(k,{key:0},[B("−")],64)):(p(),f(k,{key:1},[B("+")],64))])],8,D)}const F=v(R,[["render",E]]),h=Symbol("quantitySelector"),K=M({__name:"QuantitySelector",props:{modelValue:{default:1},min:{default:1},max:{},step:{},disabled:{type:Boolean},readonly:{type:Boolean}},emits:["update:modelValue"],setup(a,{expose:i,emit:t}){i();const e=a,s=t,n=$(null),o=`NInput${j()}`,l=y({get(){return e.modelValue},set(r){r<e.min&&(r=e.min,n.value.value=`${r}`),e.max&&r>e.max&&(r=e.max,n.value.value=`${r}`),s("update:modelValue",r)}}),d=y(()=>e.min>=l.value),c=y(()=>e.max<=l.value);P(h,{value:l,isBoundMin:d,isBoundMax:c});const m={quantitySelectorKey:h,props:e,emit:s,input:n,inputId:o,value:l,isBoundMin:d,isBoundMax:c,QuantitySelectorControl:F};return Object.defineProperty(m,"__isScriptSetup",{enumerable:!1,value:!0}),m}}),W={"data-quantity-selector":""},X={class:"flex items-center"},Z=["min","max","step","disabled","readonly"];function A(a,i,t,e,s,n){return p(),f("div",W,[u(a.$slots,"label",I(g({inputId:e.inputId,value:e.value})),()=>[x("label",{for:e.inputId,class:"sr-only"},N("Quantidade"))]),x("div",X,[T(x("input",{ref:"input",type:"number",id:e.inputId,"onUpdate:modelValue":i[0]||(i[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 border-transparent px-2 text-center text-lg [-moz-appearance:_textfield] [&::-webkit-inner-spin-button]:m-0 [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:m-0 [&::-webkit-outer-spin-button]:appearance-none"},null,8,Z),[[V,e.value]]),u(a.$slots,"controls",I(g({value:e.value,isBoundMin:e.isBoundMin,isBoundMax:e.isBoundMax})),()=>[w(e.QuantitySelectorControl,{"is-minus":"",class:"order-first"},{default:C(()=>[u(a.$slots,"minus")]),_:3}),w(e.QuantitySelectorControl,{class:"order-last"},{default:C(()=>[u(a.$slots,"plus")]),_:3})])])])}const ee=v(K,[["render",A]]);export{Y as C,ee as Q};
@@ -0,0 +1 @@
1
+ import{S}from"./use-analytics.1EVxbrS7.js";import{J as w,w as x,d as m,K as u,L as i,M as a,R as p,N as d,O as _,T as k,S as v,V as C,Q as h,X as f,Y as b}from"./ecom-utils.gJYgRPRz.js";import{u as y,P}from"./ProductCard.ephJafAE.js";import{_ as g}from"./_plugin-vue_export-helper.sk5AFsEV.js";import"./customer-session._VkzXnXT.js";import"./sf-utils.5t7r9A2G.js";import"./index.XrHFaN2F.js";import"./shopping-cart.A-1jhlKi.js";import"./price.Easct8WC.js";import"./afetch.5c8VmT0-.js";import"./name.HU5l7TJo.js";import"./i18n.m7SpISxy.js";import"./use-product-card.erbOV6Fv.js";import"./img.zh-Drf-O.js";import"./index.5PN-EYMS.js";import"./Prices.PuQc6C7F.js";import"./modules-info.sD0tdb2b.js";import"./format-money.FMQXgKHB.js";const E=r=>{let{term:o,searchEngine:e}=r;r.ssrError&&(console.error(new Error(`SSR search error: ${r.ssrError}`)),window.location.pathname.startsWith("/s/")&&(window.location.href=`/s?q=${encodeURIComponent(o||"")}`));const t=w(r.products||[]);return e||(e=new S({debounce:50}),o===void 0&&(o=new URLSearchParams(window.location.search).get("q")||null),o!==void 0&&(e.term.value=o)),!e.wasFetched.value&&!r.products&&e.fetch().catch(console.error),x(e.products,()=>{t.splice(0),e?.products.forEach(n=>t.push(n))}),{searchEngine:e,fetching:e.fetching.value,isFetching:e.isFetching,products:t}},L=m({__name:"ProductGrid",props:{collectionId:{},searchQuery:{},sort:{},title:{},titleLink:{},isShuffle:{type:Boolean},limit:{},page:{},products:{}},async setup(r,{expose:o}){o();const e=r,{title:t,titleLink:n,fetching:l,products:s}=y(e),c={props:e,title:t,titleLink:n,fetching:l,products:s,ProductCard:P};return Object.defineProperty(c,"__isScriptSetup",{enumerable:!1,value:!0}),c}}),F={class:"ui-section"},N={key:0,class:"mx-auto mb-2 max-w-prose text-center"},R={class:"ui-text-brand text-3xl"},V={class:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4"};function B(r,o,e,t,n,l){const s=u("ALink");return i(),a("section",F,[t.title?(i(),a("div",N,[p("h2",R,[d(s,{href:t.titleLink,class:C(t.titleLink?"ui-link":"text-base-700")},{default:_(()=>[v(k(t.title),1)]),_:1},8,["href","class"])])])):h("",!0),p("ul",V,[(i(!0),a(f,null,b(t.products,c=>(i(),a("li",{key:c._id},[d(t.ProductCard,{product:c},null,8,["product"])]))),128))])])}const $=g(L,[["render",B]]),G=m({__name:"SearchContainer",props:{searchEngine:{},term:{},sort:{},products:{},ssrError:{}},async setup(r,{expose:o}){o();const e=r,{fetching:t,isFetching:n,products:l}=E(e),s={props:e,fetching:t,isFetching:n,products:l,ProductGrid:$};return Object.defineProperty(s,"__isScriptSetup",{enumerable:!1,value:!0}),s}}),O={key:0,class:"ui-section relative min-h-[300px]"};function j(r,o,e,t,n,l){const s=u("Skeleton"),c=u("Fade");return i(),a(f,null,[t.isFetching?(i(),a("div",O,[d(s,{class:"absolute top-0 w-full","is-bold":"","is-large":""})])):h("",!0),d(c,{"is-leave-to":!1},{default:_(()=>[d(t.ProductGrid,{products:t.products},null,8,["products"])]),_:1})],64)}const re=g(G,[["render",j]]);export{re as default};
@@ -0,0 +1 @@
1
+ import{c as K,g as X}from"./sf-utils.5t7r9A2G.js";import{S as Y,s as O}from"./use-analytics.1EVxbrS7.js";import{a as T,w as V,a4 as q,d as J,K as j,L as f,M as y,N as F,O as x,V as P,X as R,T as W,S as U,Y as z,R as S,Q as H,P as G}from"./ecom-utils.gJYgRPRz.js";import Z from"./ProductShelf.GESxuPZ_.js";import{_ as $}from"./_plugin-vue_export-helper.sk5AFsEV.js";import"./customer-session._VkzXnXT.js";import"./index.XrHFaN2F.js";import"./shopping-cart.A-1jhlKi.js";import"./price.Easct8WC.js";import"./afetch.5c8VmT0-.js";import"./name.HU5l7TJo.js";import"./i18n.m7SpISxy.js";import"./index.5PN-EYMS.js";import"./ProductCard.ephJafAE.js";import"./use-product-card.erbOV6Fv.js";import"./img.zh-Drf-O.js";import"./Prices.PuQc6C7F.js";import"./modules-info.sD0tdb2b.js";import"./format-money.FMQXgKHB.js";var ee=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function te(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Q={exports:{}};(function(n){(function(a,i){n.exports?n.exports=i():a.Wade=i()})(ee,function(){var a={stopWords:["about","after","all","also","am","an","and","another","any","are","as","at","be","because","been","before","being","between","both","but","by","came","can","come","could","did","do","each","for","from","get","got","has","had","he","have","her","here","him","himself","his","how","if","in","into","is","it","like","make","many","me","might","more","most","much","must","my","never","now","of","on","only","or","other","our","out","over","said","same","see","should","since","some","still","such","take","than","that","the","their","them","then","there","these","they","this","those","through","to","too","under","up","very","was","way","we","well","were","what","where","which","while","who","with","would","you","your","a","i"],punctuationRE:/[.,!?:;"']/g},i=function(e,o){for(var r=o,c=0;c<e.length&&(r=r[e[c]])!==void 0;c++);return r},t=function(e,o,r,c){for(var h=null,s=0;s<e.length;s++){var u=e[s];(h=r[u])===void 0?(r[u]=o.length,o.push({index:u,score:c})):o[h].score+=c}},k=function(e,o,r,c,h){var s=i(e,o);s!==void 0&&s.id!==void 0&&t(s.id,r,c,h)},g=function(e,o,r,c,h){var s=i(e,o);if(s!==void 0)for(var u=[s],m=null,d=0;u.length!==0;){(m=u[d]).id!==void 0&&t(m.id,r,c,h),u.pop(),d--;for(var _ in m)u.push(m[_]),d++}},v=function(e){var o=e.length-1;return e[0]===" "&&(e=e.substring(1)),e[o]===" "&&(e=e.substring(0,o)),e.split(" ")},w=function(e){return e.toLowerCase()},p=function(e){return e.replace(a.punctuationRE,"")},E=function(e){for(var o=v(e),r=o.length;r--!=0;)l.config.stopWords.indexOf(o[r])!==-1&&o.splice(r,1);return o.join(" ")},l=function(e){var o=function(u){var m=o.index,d=l.process(u);if(d===!1)return[];for(var _=v(d),L=_.length,b=L-1,C=1/L,B=[],N={},D=0;D<b;D++)k(_[D],m,B,N,C);return g(_[b],m,B,N,C),B};if(Array.isArray(e)){for(var r=e.length,c=new Array(r),h=null,s=0;s<r;s++)(h=l.process(e[s]))!==!1&&(c[s]=h);o.index=l.index(c),o.data=c}else o.index=e.index,o.data=e.data;return o};return l.pipeline=[w,p,E],l.process=function(e){for(var o=l.pipeline,r=0;r<o.length;r++)e=o[r](e);return e.length!==0&&e},l.index=function(e){for(var o={},r=0;r<e.length;r++){var c=e[r];if(c!==void 0)for(var h=v(c),s=0;s<h.length;s++){for(var u=h[s],m=u.length-1,d=o,_=0;_<m;_++){var L=u[_],b=d[L];b=b===void 0?{}:b,d[L]=b,d=b}var C=u[m];d[C]===void 0?d[C]={id:[r]}:(d=d[C]).id===void 0?d.id=[r]:d.id.push(r)}}return o},l.save=function(e){return{data:e.data,index:e.index}},l.config=a,l.version="0.3.3",l})})(Q);var oe=Q.exports;const I=te(oe),re=globalThis.$storefront.data,A=[];["categories","brands","collections"].forEach(n=>{const a=re[n];if(a)for(let i=0;i<a.length;i++){const t=a[i];t.name&&t.slug&&A.push({text:K(`${t.name} ${t.short_description}`),type:n,data:t})}});let M;A.length&&(globalThis.$storefront.settings.lang==="pt_br"&&(I.config.stopWords=["e","a","o","de","para","com","tem"]),M=I(A.map(({text:n})=>n)));const ne=n=>{const a=new Y({debounce:n.fetchDebounce||300});a.pageSize.value=n.productsLimit||12,a.isWithCount.value=!0,a.isWithBuckets.value=!1;const i=T(0),t=T([]);V(q(n,"term"),async g=>{if(a.fetch(g),M){const v=M(K(g));t.value=v.map(({index:w})=>{const{name:p,slug:E}=A[w].data;return{title:p,href:`/${E}`}})}},{immediate:!0}),V(a.meta,()=>{i.value=a.meta.count||0});const k=T([]);return V(O,()=>{k.value=O.filter(g=>g!==n.term)},{immediate:!0}),{searchHistory:k,searchEngine:a,isFetching:a.isFetching,products:a.products,productCount:i,linkHits:t}},ae=J({__name:"SearchModal",props:{term:{},fetchDebounce:{},productsLimit:{}},setup(n,{expose:a}){a();const i=n,{searchHistory:t,isFetching:k,products:g,productCount:v,linkHits:w}=ne(i),p={props:i,searchHistory:t,isFetching:k,products:g,productCount:v,linkHits:w,get getSearchUrl(){return X},ProductShelf:Z};return Object.defineProperty(p,"__isScriptSetup",{enumerable:!1,value:!0}),p}}),ie={class:"relative"},se={key:0,class:"bg-base-100/80 grid grid-cols-1 items-center gap-4 p-4 backdrop-blur-md md:grid-cols-2 lg:mt-5 lg:grid-cols-3 lg:rounded"},le={class:"flex items-center justify-end gap-4 md:order-2"},ce={key:0,class:"text-base-900 text-sm lowercase"},de=["href"],ue={class:"lg:col-span-2"},he=["href"],fe=S("i",{class:"i-clock m-0","aria-label":"Buscar novamente"},null,-1);function pe(n,a,i,t,k,g){const v=j("ALink"),w=j("Carousel"),p=j("Fade"),E=j("Skeleton");return f(),y("article",ie,[F(p,{slide:"down"},{default:x(()=>[t.linkHits.length?(f(),y("section",{key:0,class:P(["bg-white p-4",!t.isFetching&&t.products.length?"lg:rounded-t":"lg:rounded"])},[S("nav",null,[F(w,{"wrapper-key":i.term,class:"px-6 [&>ul]:gap-3"},{default:x(()=>[(f(!0),y(R,null,z(t.linkHits,({title:l,href:e},o)=>(f(),y("li",{key:o,class:"shrink-0"},[F(v,{href:e,class:"ui-link"},{default:x(()=>[U(W(l),1)]),_:2},1032,["href"])]))),128))]),_:1},8,["wrapper-key"])])],2)):H("",!0)]),_:1}),t.isFetching?(f(),G(E,{key:0,class:"absolute top-0 w-full px-5 pt-20"})):H("",!0),F(p,{"is-leave-to":!1},{default:x(()=>[!t.isFetching&&t.products.length?(f(),G(t.ProductShelf,{key:0,products:t.products,class:P(["m-0 max-w-none bg-white px-4 lg:[&_[data-carousel-control=next]]:!-right-10 lg:[&_[data-carousel-control=previous]]:!-left-10",t.linkHits.length?"lg:rounded-b":"lg:rounded"])},null,8,["products","class"])):H("",!0)]),_:1}),F(p,{"is-leave-to":!1},{default:x(()=>[!t.isFetching&&(t.searchHistory.length||t.productCount>t.products.length)?(f(),y("section",se,[S("div",le,[t.productCount>1?(f(),y("p",ce,[S("strong",null,W(t.productCount),1),U(" "+W("Itens encontrados"))])):H("",!0),t.productCount>t.products.length?(f(),y("a",{key:1,href:t.getSearchUrl(i.term),class:"ui-btn ui-btn-primary w-auto text-center"},W("Ver todos"),8,de)):H("",!0)]),S("div",ue,[S("nav",null,[F(w,{"wrapper-key":i.term,class:"px-6 [&>ul]:gap-2.5"},{previous:x(()=>[fe]),default:x(()=>[(f(!0),y(R,null,z(t.searchHistory,(l,e)=>(f(),y("li",{key:e,class:"shrink-0"},[S("a",{href:t.getSearchUrl(l),class:"ui-link text-base-700 text-sm font-normal"},W(l),9,he)]))),128))]),_:1},8,["wrapper-key"])])])])):H("",!0)]),_:1})])}const De=$(ae,[["render",pe]]);export{De as default};