cloudcommerce 0.37.1 → 0.39.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 (147) hide show
  1. package/.github/workflows/test-apps.yml +2 -2
  2. package/.vscode/settings.json +1 -1
  3. package/CHANGELOG.md +64 -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/ssr/src/layouts/PageHeader.astro +3 -6
  8. package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
  9. package/ecomplus-stores/barra-doce/package.json +2 -2
  10. package/package.json +7 -7
  11. package/packages/api/lib/api.d.ts +2 -2
  12. package/packages/api/package.json +1 -1
  13. package/packages/api/types.d.ts +4 -1
  14. package/packages/apps/affilate-program/package.json +1 -1
  15. package/packages/apps/correios/package.json +1 -1
  16. package/packages/apps/custom-payment/package.json +1 -1
  17. package/packages/apps/custom-shipping/package.json +1 -1
  18. package/packages/apps/datafrete/package.json +1 -1
  19. package/packages/apps/discounts/package.json +1 -1
  20. package/packages/apps/emails/package.json +1 -1
  21. package/packages/apps/fb-conversions/package.json +1 -1
  22. package/packages/apps/flash-courier/package.json +1 -1
  23. package/packages/apps/frenet/package.json +1 -1
  24. package/packages/apps/galaxpay/package.json +1 -1
  25. package/packages/apps/google-analytics/package.json +1 -1
  26. package/packages/apps/jadlog/package.json +1 -1
  27. package/packages/apps/loyalty-points/package.json +1 -1
  28. package/packages/apps/mandae/package.json +1 -1
  29. package/packages/apps/melhor-envio/package.json +1 -1
  30. package/packages/apps/mercadopago/package.json +1 -1
  31. package/packages/apps/pagarme/package.json +1 -1
  32. package/packages/apps/pagarme-v5/package.json +1 -1
  33. package/packages/apps/paghiper/package.json +1 -1
  34. package/packages/apps/pix/package.json +1 -1
  35. package/packages/apps/tiny-erp/package.json +1 -1
  36. package/packages/apps/webhooks/package.json +1 -1
  37. package/packages/cli/config/firestore.rules +4 -1
  38. package/packages/cli/lib/cli.js +30 -9
  39. package/packages/cli/package.json +2 -1
  40. package/packages/cli/src/cli.ts +37 -9
  41. package/packages/config/package.json +1 -1
  42. package/packages/emails/package.json +1 -1
  43. package/packages/eslint/package.json +3 -3
  44. package/packages/events/package.json +1 -1
  45. package/packages/feeds/package.json +1 -1
  46. package/packages/firebase/package.json +1 -1
  47. package/packages/i18n/package.json +1 -1
  48. package/packages/modules/package.json +1 -1
  49. package/packages/passport/package.json +1 -1
  50. package/packages/ssr/package.json +5 -5
  51. package/packages/storefront/.auto-imports.d.ts +1 -0
  52. package/packages/storefront/client.d.ts +1 -0
  53. package/packages/storefront/config/storefront.tailwind.cjs +21 -20
  54. package/packages/storefront/config/storefront.unocss.cjs +11 -0
  55. package/packages/storefront/dist/client/_astro/{AccountPage.700be123.js → AccountPage.j0C5JBLY.js} +1 -1
  56. package/packages/storefront/dist/client/_astro/{CartSidebar.430b55df.js → CartSidebar.1kUFk9Xn.js} +1 -1
  57. package/packages/storefront/dist/client/_astro/HeroSlider.tR1dVXyu.js +1 -0
  58. package/packages/storefront/dist/client/_astro/{PitchBar.06e0f831.js → PitchBar.FelC04wE.js} +1 -1
  59. package/packages/storefront/dist/client/_astro/{Prices.0e829c31.js → Prices.PuQc6C7F.js} +1 -1
  60. package/packages/storefront/dist/client/_astro/ProductCard.ephJafAE.js +1 -0
  61. package/packages/storefront/dist/client/_astro/ProductDetails.B6Ih5MGf.js +7 -0
  62. package/packages/storefront/dist/client/_astro/ProductShelf.GESxuPZ_.js +1 -0
  63. package/packages/storefront/dist/client/_astro/{QuantitySelector.ebf60845.js → QuantitySelector.YNmWjN8y.js} +1 -1
  64. package/packages/storefront/dist/client/_astro/SearchContainer.BzixfU3R.js +1 -0
  65. package/packages/storefront/dist/client/_astro/SearchModal.F7vbwxIv.js +1 -0
  66. package/packages/storefront/dist/client/_astro/ShopHeader.5vR1LgSW.js +10 -0
  67. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.sk5AFsEV.js +1 -0
  68. package/packages/storefront/dist/client/_astro/_slug_.r8QHNfdw.css +1 -0
  69. package/packages/storefront/dist/client/_astro/client.RF8UxjZd.js +1 -0
  70. package/packages/storefront/dist/client/_astro/customer-session._VkzXnXT.js +7 -0
  71. package/packages/storefront/dist/client/_astro/ecom-utils.gJYgRPRz.js +1 -0
  72. package/packages/storefront/dist/client/_astro/{firebase-app.992a296f.js → firebase-app.cPMfoOsn.js} +1 -1
  73. package/packages/storefront/dist/client/_astro/{format-money.9cf6b04d.js → format-money.FMQXgKHB.js} +1 -1
  74. package/packages/storefront/dist/client/_astro/{hoisted.c90fc6ab.js → hoisted.B6fKrLPR.js} +1 -1
  75. package/packages/storefront/dist/client/_astro/{hoisted.54eaab04.js → hoisted._FbzheVm.js} +1 -1
  76. package/packages/storefront/dist/client/_astro/{i18n.29216eeb.js → i18n.m7SpISxy.js} +1 -1
  77. package/packages/storefront/dist/client/_astro/{img.4f23a3dd.js → img.zh-Drf-O.js} +1 -1
  78. package/packages/storefront/dist/client/_astro/{index-61e5ac61.bdc8d0cd.js → index-dd468b12.D5s8VdAL.js} +92 -107
  79. package/packages/storefront/dist/client/_astro/{index.570b84fe.js → index.5PN-EYMS.js} +1 -1
  80. package/packages/storefront/dist/client/_astro/index.XrHFaN2F.js +1 -0
  81. package/packages/storefront/dist/client/_astro/{modules-info.55780599.js → modules-info.sD0tdb2b.js} +1 -1
  82. package/packages/storefront/dist/client/_astro/name.HU5l7TJo.js +1 -0
  83. package/packages/storefront/dist/client/_astro/{photoswipe-lightbox.esm.c157838f.js → photoswipe-lightbox.esm.dZBqKD9u.js} +1 -1
  84. package/packages/storefront/dist/client/_astro/{photoswipe.01431ec7.js → photoswipe.0V7m2jWu.js} +1 -2
  85. package/packages/storefront/dist/client/_astro/{photoswipe.esm.92c2d901.js → photoswipe.esm.Ylh9TGkz.js} +1 -1
  86. package/packages/storefront/dist/client/_astro/sf-utils.5t7r9A2G.js +1 -0
  87. package/packages/storefront/dist/client/_astro/{shopping-cart.d9f601dd.js → shopping-cart.A-1jhlKi.js} +1 -1
  88. package/packages/storefront/dist/client/_astro/use-analytics.1EVxbrS7.js +1 -0
  89. package/packages/storefront/dist/client/_astro/{use-product-card.437911bb.js → use-product-card.erbOV6Fv.js} +1 -1
  90. package/packages/storefront/dist/client/robots.txt +1 -0
  91. package/packages/storefront/dist/server/chunks/{CartSidebar_eab28771.mjs → CartSidebar_hAgJQJgm.mjs} +1 -1
  92. package/packages/storefront/dist/server/chunks/SearchModal_eWb5SdQM.mjs +351 -0
  93. package/packages/storefront/dist/server/chunks/{_.._5a781fb3.mjs → _.._S7DDBn_b.mjs} +1 -1
  94. package/packages/storefront/dist/server/chunks/{account_519edb70.mjs → account_3ySmGzMc.mjs} +1 -1
  95. package/packages/storefront/dist/server/chunks/astro/{assets-service_a9d9ab5f.mjs → assets-service_QlOZG8ov.mjs} +1 -1
  96. package/packages/storefront/dist/server/chunks/{astro_d98f7186.mjs → astro_zcC1GStV.mjs} +17 -34
  97. package/packages/storefront/dist/server/chunks/{index_5e3ed8a0.mjs → index_nIwq11oA.mjs} +1 -1
  98. package/packages/storefront/dist/server/chunks/{index_10e14f85.mjs → index_uAR5ZV4d.mjs} +1 -1
  99. package/packages/storefront/dist/server/chunks/{node_1119b0d1.mjs → node_2VvC7trl.mjs} +1 -1
  100. package/packages/storefront/dist/server/chunks/pages/{__93ade2dd.mjs → __MSibDuuV.mjs} +652 -255
  101. package/packages/storefront/dist/server/chunks/pages/{account_e5d410a7.mjs → account_iG-YqJ5q.mjs} +3 -2
  102. package/packages/storefront/dist/server/chunks/pages/{index_7e25afc1.mjs → index_BtDyKPh_.mjs} +3 -2
  103. package/packages/storefront/dist/server/chunks/pages/{node_bd378ac0.mjs → node_bKqL47eZ.mjs} +2 -2
  104. package/packages/storefront/dist/server/chunks/pages/{~fallback_73578d2f.mjs → ~fallback_73R5VA6j.mjs} +3 -2
  105. package/packages/storefront/dist/server/chunks/{photoswipe_9528923e.mjs → photoswipe_IcWDJiwc.mjs} +1 -1
  106. package/packages/storefront/dist/server/chunks/{~fallback_41122b9b.mjs → ~fallback_7q1dqY4e.mjs} +1 -1
  107. package/packages/storefront/dist/server/entry.mjs +970 -93
  108. package/packages/storefront/dist/server/manifest_dSwvaOdW.mjs +195 -0
  109. package/packages/storefront/dist/server/renderers.mjs +2 -2
  110. package/packages/storefront/package.json +12 -12
  111. package/packages/storefront/src/helpers/sf-utils.ts +29 -1
  112. package/packages/storefront/src/lib/components/SharedData.astro +2 -2
  113. package/packages/storefront/src/lib/composables/use-breadcrumbs.ts +1 -1
  114. package/packages/storefront/src/lib/composables/use-search-modal.ts +1 -1
  115. package/packages/storefront/src/lib/composables/use-search-showcase.ts +55 -0
  116. package/packages/storefront/src/lib/composables/use-shared-data.ts +10 -5
  117. package/packages/storefront/src/lib/composables/use-shop-header.ts +14 -5
  118. package/packages/storefront/src/lib/composables/use-sticky-header.ts +2 -0
  119. package/packages/storefront/src/lib/layouts/BaseHead.astro +8 -1
  120. package/packages/storefront/src/lib/layouts/use-page-header.ts +6 -3
  121. package/packages/storefront/src/lib/layouts/use-page-main.ts +45 -1
  122. package/packages/storefront/src/lib/scripts/firestore.ts +27 -0
  123. package/packages/storefront/src/lib/ssr-context.ts +14 -0
  124. package/packages/storefront/src/lib/state/search-engine.ts +65 -27
  125. package/packages/storefront/src/lib/state/use-analytics.ts +9 -10
  126. package/packages/test-base/package.json +1 -1
  127. package/packages/types/package.json +1 -1
  128. package/packages/storefront/dist/client/_astro/HeroSlider.bd684ed8.js +0 -1
  129. package/packages/storefront/dist/client/_astro/ProductDetails.06da998d.js +0 -1
  130. package/packages/storefront/dist/client/_astro/ProductShelf.3f4f38b5.js +0 -1
  131. package/packages/storefront/dist/client/_astro/ProductShelf.bf82838b.js +0 -1
  132. package/packages/storefront/dist/client/_astro/SearchModal.b6aa5ef7.js +0 -1
  133. package/packages/storefront/dist/client/_astro/ShopHeader.2d6e361a.js +0 -4
  134. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.f75743ee.js +0 -1
  135. package/packages/storefront/dist/client/_astro/_slug_.e7cac999.css +0 -1
  136. package/packages/storefront/dist/client/_astro/client.41b42098.js +0 -1
  137. package/packages/storefront/dist/client/_astro/customer-session.5ab9ab1a.js +0 -1
  138. package/packages/storefront/dist/client/_astro/ecom-utils.5cbfb95e.js +0 -1
  139. package/packages/storefront/dist/client/_astro/index.8ac1db99.js +0 -1
  140. package/packages/storefront/dist/client/_astro/name.01410784.js +0 -1
  141. package/packages/storefront/dist/client/_astro/sf-utils.b04e1813.js +0 -1
  142. package/packages/storefront/dist/client/_astro/use-analytics.cc95e346.js +0 -1
  143. package/packages/storefront/dist/server/chunks/SearchModal_f66549d4.mjs +0 -147
  144. package/packages/storefront/dist/server/manifest_221d806b.mjs +0 -1069
  145. /package/packages/storefront/dist/client/_astro/{afetch.f4507208.js → afetch.5c8VmT0-.js} +0 -0
  146. /package/packages/storefront/dist/client/_astro/{img-sizes.41e0efe4.js → img-sizes.gxAI9JNh.js} +0 -0
  147. /package/packages/storefront/dist/client/_astro/{price.04ceb6c4.js → price.Easct8WC.js} +0 -0
@@ -1,8 +1,9 @@
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
  $, argv, fs, echo, chalk,
5
5
  } from 'zx';
6
+ import Deepmerge from '@fastify/deepmerge';
6
7
  import login from './login.js';
7
8
  import build, { prepareCodebases } from './build.js';
8
9
  import { siginGcloudAndSetIAM, createServiceAccountKey } from './setup-gcloud.js';
@@ -15,13 +16,13 @@ const __dirname = fileURLToPath(new URL('.', import.meta.url));
15
16
  const pwd = process.cwd();
16
17
  let projectId = FIREBASE_PROJECT_ID;
17
18
  if (projectId) {
18
- if (!fs.existsSync(path.join(pwd, '.firebaserc'))) {
19
- fs.writeFileSync(path.join(pwd, '.firebaserc'), JSON.stringify({ projects: { default: projectId } }, null, 2));
19
+ if (!fs.existsSync(joinPath(pwd, '.firebaserc'))) {
20
+ fs.writeFileSync(joinPath(pwd, '.firebaserc'), JSON.stringify({ projects: { default: projectId } }, null, 2));
20
21
  }
21
22
  } else {
22
23
  if (GOOGLE_APPLICATION_CREDENTIALS) {
23
24
  try {
24
- const gac = fs.readJSONSync(path.join(pwd, GOOGLE_APPLICATION_CREDENTIALS));
25
+ const gac = fs.readJSONSync(joinPath(pwd, GOOGLE_APPLICATION_CREDENTIALS));
25
26
  projectId = gac.project_id;
26
27
  } catch (e) {
27
28
  //
@@ -29,7 +30,7 @@ if (projectId) {
29
30
  }
30
31
  if (!projectId) {
31
32
  try {
32
- const firebaserc = fs.readJSONSync(path.join(pwd, '.firebaserc'));
33
+ const firebaserc = fs.readJSONSync(joinPath(pwd, '.firebaserc'));
33
34
  projectId = firebaserc.projects.default;
34
35
  } catch (e) {
35
36
  projectId = 'ecom2-demo';
@@ -38,7 +39,27 @@ if (projectId) {
38
39
  }
39
40
 
40
41
  export default async () => {
41
- await fs.copy(path.join(__dirname, '..', 'config'), pwd);
42
+ const baseConfigDir = joinPath(__dirname, '..', 'config');
43
+ await fs.copy(baseConfigDir, pwd);
44
+ const userConfigDir = joinPath(pwd, 'conf');
45
+ if (fs.existsSync(userConfigDir) && fs.lstatSync(userConfigDir).isDirectory()) {
46
+ await fs.copy(userConfigDir, pwd);
47
+ const userFirebaseJsonPath = joinPath(userConfigDir, 'firebase.json');
48
+ if (fs.existsSync(userFirebaseJsonPath)) {
49
+ let userFirebaseConfig;
50
+ try {
51
+ userFirebaseConfig = JSON.parse(fs.readFileSync(userFirebaseJsonPath, 'utf8'));
52
+ } catch {
53
+ //
54
+ }
55
+ if (userFirebaseConfig) {
56
+ const deepmerge = Deepmerge();
57
+ const baseFirebaseConfig = JSON.parse(fs.readFileSync(joinPath(baseConfigDir, 'firebase.json'), 'utf8'));
58
+ const mergedConfig = deepmerge(baseFirebaseConfig, userFirebaseConfig);
59
+ fs.writeFileSync(joinPath(pwd, 'firebase.json'), JSON.stringify(mergedConfig, null, 2));
60
+ }
61
+ }
62
+ }
42
63
  const options = [];
43
64
  Object.keys(argv).forEach((key) => {
44
65
  if (key !== '_' && argv[key] !== false) {
@@ -86,7 +107,7 @@ ${chalk.bold('npx kill-port 4000 9099 5001 8080 5000 8085 9199 4400 4500')}
86
107
  }
87
108
  if (argv._.includes('setup')) {
88
109
  const { storeId, authenticationId, apiKey } = await login();
89
- await fs.writeFile(path.join(pwd, 'functions', '.env'), `ECOM_AUTHENTICATION_ID=${authenticationId}
110
+ await fs.writeFile(joinPath(pwd, 'functions', '.env'), `ECOM_AUTHENTICATION_ID=${authenticationId}
90
111
  ECOM_API_KEY=${apiKey}
91
112
  ECOM_STORE_ID=${storeId}
92
113
  `);
@@ -94,7 +115,7 @@ ECOM_STORE_ID=${storeId}
94
115
  await $firebase('deploy');
95
116
  }
96
117
  if (argv.commit !== false) {
97
- await fs.writeFile(path.join(pwd, 'functions', 'config.json'), JSON.stringify({ storeId }, null, 2));
118
+ await fs.writeFile(joinPath(pwd, 'functions', 'config.json'), JSON.stringify({ storeId }, null, 2));
98
119
  await build(argv.codebase);
99
120
  try {
100
121
  await $`git add .firebaserc functions/config.json`;
@@ -150,7 +171,7 @@ Finish by saving the following secrets to your GitHub repository:
150
171
  }
151
172
  if (argv._.includes('dev') || !argv._.length) {
152
173
  await prepareCodebases(true);
153
- const prefix = path.join(pwd, 'functions/ssr');
174
+ const prefix = joinPath(pwd, 'functions/ssr');
154
175
  // https://docs.astro.build/en/reference/cli-reference/#astro-dev
155
176
  const host = typeof argv.host === 'string' ? argv.host : '';
156
177
  const port = typeof argv.port === 'string' || typeof argv.port === 'number' ? argv.port : '';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/cli",
3
3
  "type": "module",
4
- "version": "0.37.1",
4
+ "version": "0.39.0",
5
5
  "description": "E-Com Plus Cloud Commerce CLI tools",
6
6
  "bin": {
7
7
  "cloudcommerce": "./bin/run.mjs"
@@ -27,6 +27,7 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@cloudcommerce/api": "workspace:*",
30
+ "@fastify/deepmerge": "^1.3.0",
30
31
  "libsodium-wrappers": "^0.7.13",
31
32
  "md5": "^2.3.0",
32
33
  "typescript": "~5.2.2",
@@ -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.39.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.39.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.39.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.39.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.39.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.39.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.39.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.39.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.39.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.39.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};