cloudcommerce 0.9.0 → 0.10.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 (145) hide show
  1. package/.vscode/extensions.json +3 -1
  2. package/.vscode/settings.json +5 -1
  3. package/CHANGELOG.md +30 -0
  4. package/action.yml +3 -0
  5. package/ecomplus-stores/monocard/.devcontainer/devcontainer.json +28 -1
  6. package/ecomplus-stores/monocard/.gitpod.yml +12 -0
  7. package/ecomplus-stores/monocard/functions/core/package.json +1 -1
  8. package/ecomplus-stores/monocard/functions/events/package.json +2 -2
  9. package/ecomplus-stores/monocard/functions/modules/package.json +2 -2
  10. package/ecomplus-stores/monocard/functions/passport/package.json +2 -2
  11. package/ecomplus-stores/monocard/functions/ssr/package.json +8 -8
  12. package/ecomplus-stores/monocard/package.json +1 -1
  13. package/ecomplus-stores/monocard/scripts/install.sh +6 -1
  14. package/ecomplus-stores/tia-sonia/.devcontainer/devcontainer.json +30 -0
  15. package/ecomplus-stores/tia-sonia/.gitpod.yml +12 -0
  16. package/ecomplus-stores/tia-sonia/scripts/install.sh +6 -1
  17. package/package.json +12 -12
  18. package/packages/api/package.json +1 -1
  19. package/packages/apps/correios/package.json +2 -2
  20. package/packages/apps/custom-payment/package.json +1 -1
  21. package/packages/apps/custom-shipping/package.json +1 -1
  22. package/packages/apps/datafrete/package.json +4 -4
  23. package/packages/apps/discounts/package.json +1 -1
  24. package/packages/apps/emails/package.json +2 -2
  25. package/packages/apps/fb-conversions/package.json +4 -4
  26. package/packages/apps/frenet/package.json +4 -4
  27. package/packages/apps/galaxpay/package.json +4 -4
  28. package/packages/apps/google-analytics/package.json +4 -4
  29. package/packages/apps/infinitepay/package.json +4 -4
  30. package/packages/apps/jadlog/package.json +2 -2
  31. package/packages/apps/loyalty-points/package.json +1 -1
  32. package/packages/apps/melhor-envio/package.json +4 -4
  33. package/packages/apps/mercadopago/package.json +4 -4
  34. package/packages/apps/pagarme/package.json +4 -4
  35. package/packages/apps/paghiper/package.json +4 -4
  36. package/packages/apps/pix/package.json +4 -4
  37. package/packages/apps/tiny-erp/lib/tiny-erp.js +6 -4
  38. package/packages/apps/tiny-erp/lib/tiny-erp.js.map +1 -1
  39. package/packages/apps/tiny-erp/lib/tiny-webhook.js +7 -4
  40. package/packages/apps/tiny-erp/lib/tiny-webhook.js.map +1 -1
  41. package/packages/apps/tiny-erp/package.json +4 -4
  42. package/packages/apps/tiny-erp/src/tiny-erp.ts +6 -4
  43. package/packages/apps/tiny-erp/src/tiny-webhook.ts +7 -4
  44. package/packages/apps/webhooks/package.json +4 -4
  45. package/packages/cli/lib/build.js +2 -0
  46. package/packages/cli/lib/cli.js +4 -2
  47. package/packages/cli/package.json +1 -1
  48. package/packages/cli/src/build.ts +2 -0
  49. package/packages/cli/src/cli.ts +5 -2
  50. package/packages/config/package.json +1 -1
  51. package/packages/emails/package.json +2 -2
  52. package/packages/events/package.json +3 -3
  53. package/packages/firebase/lib/config.d.ts +5 -1
  54. package/packages/firebase/lib/config.js +6 -2
  55. package/packages/firebase/lib/config.js.map +1 -1
  56. package/packages/firebase/package.json +4 -4
  57. package/packages/firebase/src/config.ts +7 -1
  58. package/packages/i18n/package.json +1 -1
  59. package/packages/modules/lib/firebase.js +4 -3
  60. package/packages/modules/lib/firebase.js.map +1 -1
  61. package/packages/modules/package.json +4 -4
  62. package/packages/modules/src/firebase.ts +7 -3
  63. package/packages/passport/lib/firebase/serve-passport-api.js +8 -5
  64. package/packages/passport/lib/firebase/serve-passport-api.js.map +1 -1
  65. package/packages/passport/lib/firebase.js +11 -8
  66. package/packages/passport/lib/firebase.js.map +1 -1
  67. package/packages/passport/package.json +3 -3
  68. package/packages/passport/src/firebase/serve-passport-api.ts +8 -5
  69. package/packages/passport/src/firebase.ts +11 -8
  70. package/packages/ssr/lib/firebase.js +14 -11
  71. package/packages/ssr/lib/firebase.js.map +1 -1
  72. package/packages/ssr/package.json +6 -6
  73. package/packages/ssr/src/firebase.ts +14 -11
  74. package/packages/storefront/.astro/types.d.ts +117 -0
  75. package/packages/storefront/client.d.ts +1 -0
  76. package/packages/storefront/dist/client/_astro/Carousel.06e8cee5.js +1 -0
  77. package/packages/storefront/dist/client/_astro/HeroSlider.2c4563ee.js +1 -0
  78. package/packages/storefront/dist/client/_astro/PitchBar.8945ceb4.js +1 -0
  79. package/packages/storefront/dist/client/_astro/{Prices.70885f17.js → Prices.bc136725.js} +1 -1
  80. package/packages/storefront/dist/client/_astro/{ShopHeader.e901fad5.js → ShopHeader.5d83d6d5.js} +2 -2
  81. package/packages/storefront/dist/client/_astro/{_...slug_.9a31c59e.css → _...slug_.48ea2ee1.css} +1 -1
  82. package/packages/storefront/dist/client/_astro/_commonjsHelpers.725317a4.js +1 -0
  83. package/packages/storefront/dist/client/_astro/{_plugin-vue_export-helper.0c2b7f88.js → _plugin-vue_export-helper.d71c044e.js} +1 -1
  84. package/packages/storefront/dist/client/_astro/{client.4e825332.js → client.97e9e785.js} +1 -1
  85. package/packages/storefront/dist/client/_astro/client.f447e2e8.js +128 -0
  86. package/packages/storefront/dist/client/_astro/{firebase-app.247497b8.js → firebase-app.2840bd36.js} +111 -111
  87. package/packages/storefront/dist/client/_astro/{format-money.f09b89ed.js → format-money.d54c1237.js} +1 -1
  88. package/packages/storefront/dist/client/_astro/index.2899cbe4.js +9 -0
  89. package/packages/storefront/dist/client/_astro/{index.9018a8da.js → index.b12dff85.js} +1 -1
  90. package/packages/storefront/dist/client/_astro/index.es.28e34903.js +1 -0
  91. package/packages/storefront/dist/client/_astro/{modules-info.2a72e536.js → modules-info.ea748f9d.js} +1 -1
  92. package/packages/storefront/dist/client/_astro/runtime-dom.esm-bundler.e9908a78.js +1 -0
  93. package/packages/storefront/dist/client/_astro/server.browser.e1b1e312.js +27 -0
  94. package/packages/storefront/dist/client/admin/assets/Range.es-3e45690c.js +1 -0
  95. package/packages/storefront/dist/client/admin/assets/SchemaReference.es-68e2a833.js +1 -0
  96. package/packages/storefront/dist/client/admin/assets/brace-fold.es-f96db61f.js +1 -0
  97. package/packages/storefront/dist/client/admin/assets/closebrackets.es-0488b839.js +2 -0
  98. package/packages/storefront/dist/client/admin/assets/codemirror.es-15b9374a.js +24 -0
  99. package/packages/storefront/dist/client/admin/assets/comment.es-d4bed417.js +2 -0
  100. package/packages/storefront/dist/client/admin/assets/dialog.es-56aaee5b.js +1 -0
  101. package/packages/storefront/dist/client/admin/assets/foldgutter.es-55067bee.js +1 -0
  102. package/packages/storefront/dist/client/admin/assets/forEachState.es-1e367fb2.js +1 -0
  103. package/packages/storefront/dist/client/admin/assets/hint.es-07ec11aa.js +1 -0
  104. package/packages/storefront/dist/client/admin/assets/hint.es2-35fd7219.js +1 -0
  105. package/packages/storefront/dist/client/admin/assets/index-64cd926d.css +1 -0
  106. package/packages/storefront/dist/client/admin/assets/index-d5c6a1a9.js +6332 -0
  107. package/packages/storefront/dist/client/admin/assets/index-f1d880da.js +216 -0
  108. package/packages/storefront/dist/client/admin/assets/info-addon.es-eded2c26.js +1 -0
  109. package/packages/storefront/dist/client/admin/assets/info.es-93649208.js +1 -0
  110. package/packages/storefront/dist/client/admin/assets/javascript.es-634a06b1.js +1 -0
  111. package/packages/storefront/dist/client/admin/assets/jump-to-line.es-23d2d4a8.js +1 -0
  112. package/packages/storefront/dist/client/admin/assets/jump.es-732b233e.js +1 -0
  113. package/packages/storefront/dist/client/admin/assets/lint.es-240359bd.js +6 -0
  114. package/packages/storefront/dist/client/admin/assets/lint.es2-df11292b.js +1 -0
  115. package/packages/storefront/dist/client/admin/assets/lint.es3-aa543b52.js +1 -0
  116. package/packages/storefront/dist/client/admin/assets/matchbrackets.es-f5e3ac04.js +1 -0
  117. package/packages/storefront/dist/client/admin/assets/mode-indent.es-341daf63.js +1 -0
  118. package/packages/storefront/dist/client/admin/assets/mode.es-c74239d3.js +1 -0
  119. package/packages/storefront/dist/client/admin/assets/mode.es2-9319d2a9.js +1 -0
  120. package/packages/storefront/dist/client/admin/assets/mode.es3-deb92d78.js +1 -0
  121. package/packages/storefront/dist/client/admin/assets/search.es-143ba137.js +2 -0
  122. package/packages/storefront/dist/client/admin/assets/searchcursor.es-6069a13e.js +7 -0
  123. package/packages/storefront/dist/client/admin/assets/show-hint.es-ff4fde1d.js +1 -0
  124. package/packages/storefront/dist/client/admin/assets/sublime.es-23f726a0.js +6 -0
  125. package/packages/storefront/dist/client/admin/index.html +15 -0
  126. package/packages/storefront/dist/client/sw.js +1 -1
  127. package/packages/storefront/dist/server/chunks/pages/{all.b15cad2d.mjs → all.e51db7f0.mjs} +79 -55
  128. package/packages/storefront/dist/server/entry.mjs +3 -3
  129. package/packages/storefront/package.json +18 -10
  130. package/packages/storefront/scripts/prepare-monorepo.sh +2 -0
  131. package/packages/storefront/src/env.d.ts +1 -0
  132. package/packages/storefront/src/lib/components/Carousel.vue +9 -14
  133. package/packages/storefront/src/lib/components/Post.vue +107 -0
  134. package/packages/storefront/src/lib/composables/use-pitch-bar.ts +26 -2
  135. package/packages/storefront/src/lib/layouts/BaseStateJson.astro +5 -0
  136. package/packages/storefront/src/lib/layouts/use-page-layout.ts +5 -7
  137. package/packages/storefront/src/lib/ssr-context.ts +6 -1
  138. package/packages/storefront/src/lib/state/use-cms-preview.ts +101 -0
  139. package/packages/storefront/storefront.config.mjs +10 -2
  140. package/packages/types/package.json +1 -1
  141. package/packages/storefront/dist/client/_astro/Carousel.dfb3f26a.js +0 -1
  142. package/packages/storefront/dist/client/_astro/HeroSlider.34436243.js +0 -1
  143. package/packages/storefront/dist/client/_astro/PitchBar.1c993792.js +0 -1
  144. package/packages/storefront/dist/client/_astro/runtime-dom.esm-bundler.1fd80976.js +0 -1
  145. package/packages/storefront/dist/client/admin/config.json +0 -1
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/passport",
3
3
  "type": "module",
4
- "version": "0.9.0",
4
+ "version": "0.10.0",
5
5
  "description": "E-Com Plus Cloud Commerce customers authentication (passport) API",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -25,8 +25,8 @@
25
25
  "dependencies": {
26
26
  "@cloudcommerce/api": "workspace:*",
27
27
  "@cloudcommerce/firebase": "workspace:*",
28
- "firebase-admin": "^11.6.0",
29
- "firebase-functions": "^4.2.1",
28
+ "firebase-admin": "^11.7.0",
29
+ "firebase-functions": "^4.3.1",
30
30
  "source-map-support": "^0.5.21"
31
31
  },
32
32
  "devDependencies": {
@@ -12,23 +12,26 @@ export default async (req: Request, res: Response) => {
12
12
  const endpoint = url.split('/')[1];
13
13
 
14
14
  if (endpoint !== 'token') {
15
- return res.sendStatus(404);
15
+ res.sendStatus(404);
16
+ return;
16
17
  }
17
18
  const firebaseAuthToken = req.headers.authorization?.split(' ')[1];
18
19
  if (!firebaseAuthToken) {
19
- return res.sendStatus(401);
20
+ res.sendStatus(401);
21
+ return;
20
22
  }
21
23
  try {
22
24
  const authCustomerApi = await authenticateCustomer(firebaseAuthToken);
23
25
  if (authCustomerApi !== null) {
24
- return res.send(authCustomerApi);
26
+ res.send(authCustomerApi);
27
+ return;
25
28
  }
26
- return res.status(401).json({
29
+ res.status(401).json({
27
30
  status: 401,
28
31
  error: 'Invalid Firebase Auth token, unauthorized',
29
32
  });
30
33
  } catch (err) {
31
34
  logger.error(err);
32
- return res.sendStatus((err as ApiError).statusCode || 500);
35
+ res.sendStatus((err as ApiError).statusCode || 500);
33
36
  }
34
37
  };
@@ -1,14 +1,17 @@
1
1
  import '@cloudcommerce/firebase/lib/init';
2
- import { HttpsOptions, onRequest } from 'firebase-functions/v2/https';
2
+ import functions from 'firebase-functions/v1';
3
3
  import config from '@cloudcommerce/firebase/lib/config';
4
4
  import servePassportApi from './firebase/serve-passport-api';
5
5
 
6
- const options = {
7
- memory: '128MiB',
8
- ...config.get().httpsFunctionOptions,
9
- } as HttpsOptions;
6
+ const { httpsFunctionOptions } = config.get();
7
+ const { region } = httpsFunctionOptions;
10
8
 
11
9
  // eslint-disable-next-line import/prefer-default-export
12
- export const passport = onRequest(options, (req, res) => {
13
- servePassportApi(req, res);
14
- });
10
+ export const passport = functions
11
+ .region(region)
12
+ .runWith({
13
+ ...httpsFunctionOptions,
14
+ memory: '128MB',
15
+ timeoutSeconds: 30,
16
+ })
17
+ .https.onRequest(servePassportApi);
@@ -2,21 +2,24 @@
2
2
  import { initializeApp } from 'firebase-admin/app';
3
3
 
4
4
  initializeApp();
5
- import { onRequest } from 'firebase-functions/v2/https';
5
+ import functions from 'firebase-functions/v1';
6
6
  import config from '@cloudcommerce/firebase/lib/config';
7
7
  import serveStorefront from './firebase/serve-storefront.js';
8
8
 
9
9
  const { httpsFunctionOptions, ssrFunctionOptions } = config.get();
10
+ const { region } = httpsFunctionOptions;
10
11
 
11
- export const ssr = onRequest(ssrFunctionOptions, (req, res) => {
12
- serveStorefront(req, res);
13
- });
12
+ export const ssr = functions
13
+ .region(ssrFunctionOptions.region || region)
14
+ .runWith(ssrFunctionOptions)
15
+ .https.onRequest(serveStorefront);
14
16
 
15
- export const feeds = onRequest({
16
- memory: '512MiB',
17
- ...httpsFunctionOptions,
18
- timeoutSeconds: 120,
19
- }, (req, res) => {
20
- serveStorefront(req, res);
21
- });
17
+ export const feeds = functions
18
+ .region(region)
19
+ .runWith({
20
+ ...httpsFunctionOptions,
21
+ memory: '512MB',
22
+ timeoutSeconds: 120,
23
+ })
24
+ .https.onRequest(serveStorefront);
22
25
  // # sourceMappingURL=firebase.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,aAAa,EAAE,CAAC;AAEhB,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAE1D,MAAM,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;AAElE,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC,kBAAkB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IAC5D,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC5B,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS,CAAC;IAC7B,MAAM,EAAE,QAAQ;IAChB,GAAG,oBAAoB;IACvB,cAAc,EAAE,GAAG;CACpB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACd,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC5B,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,aAAa,EAAE,CAAC;AAEhB,OAAO,SAAS,MAAM,uBAAuB,CAAC;AAC9C,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,eAAe,MAAM,6BAA6B,CAAC;AAE1D,MAAM,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;AAClE,MAAM,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAAC;AAExC,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS;KACzB,MAAM,CAAC,kBAAkB,CAAC,MAAM,IAAI,MAAM,CAAC;KAC3C,OAAO,CAAC,kBAAkB,CAAC;KAC3B,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;AAEpC,MAAM,CAAC,MAAM,KAAK,GAAG,SAAS;KAC3B,MAAM,CAAC,MAAM,CAAC;KACd,OAAO,CAAC;IACP,GAAG,oBAAoB;IACvB,MAAM,EAAE,OAAO;IACf,cAAc,EAAE,GAAG;CACpB,CAAC;KACD,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/ssr",
3
3
  "type": "module",
4
- "version": "0.9.0",
4
+ "version": "0.10.0",
5
5
  "description": "E-Com Plus Cloud Commerce storefront SSR",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -28,12 +28,12 @@
28
28
  "@cloudcommerce/firebase": "workspace:*",
29
29
  "@cloudcommerce/i18n": "workspace:*",
30
30
  "@ecomplus/utils": "1.5.0-rc.3",
31
- "@headlessui/vue": "^1.7.12",
32
- "@vueuse/core": "10.0.2",
31
+ "@headlessui/vue": "^1.7.13",
32
+ "@vueuse/core": "10.1.0",
33
33
  "astro": "2.3.0",
34
- "firebase-admin": "^11.6.0",
35
- "firebase-functions": "^4.2.1",
36
- "semver": "^7.3.8",
34
+ "firebase-admin": "^11.7.0",
35
+ "firebase-functions": "^4.3.1",
36
+ "semver": "^7.5.0",
37
37
  "vue": "^3.2.47"
38
38
  },
39
39
  "devDependencies": {
@@ -3,20 +3,23 @@ import { initializeApp } from 'firebase-admin/app';
3
3
 
4
4
  initializeApp();
5
5
 
6
- import { onRequest } from 'firebase-functions/v2/https';
6
+ import functions from 'firebase-functions/v1';
7
7
  import config from '@cloudcommerce/firebase/lib/config';
8
8
  import serveStorefront from './firebase/serve-storefront';
9
9
 
10
10
  const { httpsFunctionOptions, ssrFunctionOptions } = config.get();
11
+ const { region } = httpsFunctionOptions;
11
12
 
12
- export const ssr = onRequest(ssrFunctionOptions, (req, res) => {
13
- serveStorefront(req, res);
14
- });
13
+ export const ssr = functions
14
+ .region(ssrFunctionOptions.region || region)
15
+ .runWith(ssrFunctionOptions)
16
+ .https.onRequest(serveStorefront);
15
17
 
16
- export const feeds = onRequest({
17
- memory: '512MiB',
18
- ...httpsFunctionOptions,
19
- timeoutSeconds: 120,
20
- }, (req, res) => {
21
- serveStorefront(req, res);
22
- });
18
+ export const feeds = functions
19
+ .region(region)
20
+ .runWith({
21
+ ...httpsFunctionOptions,
22
+ memory: '512MB',
23
+ timeoutSeconds: 120,
24
+ })
25
+ .https.onRequest(serveStorefront);
@@ -0,0 +1,117 @@
1
+ declare module 'astro:content' {
2
+ interface Render {
3
+ '.md': Promise<{
4
+ Content: import('astro').MarkdownInstance<{}>['Content'];
5
+ headings: import('astro').MarkdownHeading[];
6
+ remarkPluginFrontmatter: Record<string, any>;
7
+ }>;
8
+ }
9
+ }
10
+
11
+ declare module 'astro:content' {
12
+ export { z } from 'astro/zod';
13
+ export type CollectionEntry<C extends keyof typeof entryMap> =
14
+ (typeof entryMap)[C][keyof (typeof entryMap)[C]];
15
+
16
+ // TODO: Remove this when having this fallback is no longer relevant. 2.3? 3.0? - erika, 2023-04-04
17
+ /**
18
+ * @deprecated
19
+ * `astro:content` no longer provide `image()`.
20
+ *
21
+ * Please use it through `schema`, like such:
22
+ * ```ts
23
+ * import { defineCollection, z } from "astro:content";
24
+ *
25
+ * defineCollection({
26
+ * schema: ({ image }) =>
27
+ * z.object({
28
+ * image: image(),
29
+ * }),
30
+ * });
31
+ * ```
32
+ */
33
+ export const image: never;
34
+
35
+ // This needs to be in sync with ImageMetadata
36
+ export type ImageFunction = () => import('astro/zod').ZodObject<{
37
+ src: import('astro/zod').ZodString;
38
+ width: import('astro/zod').ZodNumber;
39
+ height: import('astro/zod').ZodNumber;
40
+ format: import('astro/zod').ZodUnion<
41
+ [
42
+ import('astro/zod').ZodLiteral<'png'>,
43
+ import('astro/zod').ZodLiteral<'jpg'>,
44
+ import('astro/zod').ZodLiteral<'jpeg'>,
45
+ import('astro/zod').ZodLiteral<'tiff'>,
46
+ import('astro/zod').ZodLiteral<'webp'>,
47
+ import('astro/zod').ZodLiteral<'gif'>,
48
+ import('astro/zod').ZodLiteral<'svg'>
49
+ ]
50
+ >;
51
+ }>;
52
+
53
+ type BaseSchemaWithoutEffects =
54
+ | import('astro/zod').AnyZodObject
55
+ | import('astro/zod').ZodUnion<import('astro/zod').AnyZodObject[]>
56
+ | import('astro/zod').ZodDiscriminatedUnion<string, import('astro/zod').AnyZodObject[]>
57
+ | import('astro/zod').ZodIntersection<
58
+ import('astro/zod').AnyZodObject,
59
+ import('astro/zod').AnyZodObject
60
+ >;
61
+
62
+ type BaseSchema =
63
+ | BaseSchemaWithoutEffects
64
+ | import('astro/zod').ZodEffects<BaseSchemaWithoutEffects>;
65
+
66
+ export type SchemaContext = { image: ImageFunction };
67
+
68
+ type BaseCollectionConfig<S extends BaseSchema> = {
69
+ schema?: S | ((context: SchemaContext) => S);
70
+ };
71
+ export function defineCollection<S extends BaseSchema>(
72
+ input: BaseCollectionConfig<S>
73
+ ): BaseCollectionConfig<S>;
74
+
75
+ type EntryMapKeys = keyof typeof entryMap;
76
+ type AllValuesOf<T> = T extends any ? T[keyof T] : never;
77
+ type ValidEntrySlug<C extends EntryMapKeys> = AllValuesOf<(typeof entryMap)[C]>['slug'];
78
+
79
+ export function getEntryBySlug<
80
+ C extends keyof typeof entryMap,
81
+ E extends ValidEntrySlug<C> | (string & {})
82
+ >(
83
+ collection: C,
84
+ // Note that this has to accept a regular string too, for SSR
85
+ entrySlug: E
86
+ ): E extends ValidEntrySlug<C>
87
+ ? Promise<CollectionEntry<C>>
88
+ : Promise<CollectionEntry<C> | undefined>;
89
+ export function getCollection<C extends keyof typeof entryMap, E extends CollectionEntry<C>>(
90
+ collection: C,
91
+ filter?: (entry: CollectionEntry<C>) => entry is E
92
+ ): Promise<E[]>;
93
+ export function getCollection<C extends keyof typeof entryMap>(
94
+ collection: C,
95
+ filter?: (entry: CollectionEntry<C>) => unknown
96
+ ): Promise<CollectionEntry<C>[]>;
97
+
98
+ type ReturnTypeOrOriginal<T> = T extends (...args: any[]) => infer R ? R : T;
99
+ type InferEntrySchema<C extends keyof typeof entryMap> = import('astro/zod').infer<
100
+ ReturnTypeOrOriginal<Required<ContentConfig['collections'][C]>['schema']>
101
+ >;
102
+
103
+ const entryMap: {
104
+ "posts": {
105
+ "hello-tinacms.md": {
106
+ id: "hello-tinacms.md",
107
+ slug: "hello-tinacms",
108
+ body: string,
109
+ collection: "posts",
110
+ data: any
111
+ } & { render(): Render[".md"] },
112
+ },
113
+
114
+ };
115
+
116
+ type ContentConfig = never;
117
+ }
@@ -44,4 +44,5 @@ interface Window {
44
44
  },
45
45
  modulesInfoPreset?: Partial<typeof import('./src/lib/state/modules-info').default>,
46
46
  };
47
+ isCMSPreview?: boolean;
47
48
  }
@@ -0,0 +1 @@
1
+ import{a as M,c as q,b as K}from"./index.b12dff85.js";import{d as D,_ as H,A as U,o as b,a as $,q as f,b as G,n as N,j as c,k as v,t as j,c as A,l as J,D as Q,L as X,B as Y,g as Z,w as S,h as ee,e as O,H as te,I as ae}from"./_plugin-vue_export-helper.d71c044e.js";const F=Symbol("carousel"),oe=D({__name:"CarouselControl",props:{direction:{default:1}},setup(n,{expose:r}){r();const{changeSlide:l}=U(F),t={changeSlide:l};return Object.defineProperty(t,"__isScriptSetup",{enumerable:!1,value:!0}),t}}),le=["aria-label","data-carousel-control"];function ne(n,r,l,t,s,o){return b(),$("button",{type:"button","aria-label":l.direction>0?"Próximo":"Anterior",onClick:r[0]||(r[0]=p=>t.changeSlide(l.direction)),class:N(["group absolute top-0",l.direction>0?"right-0":"left-0"]),"data-carousel-control":l.direction>0?"next":"previous"},[f(n.$slots,"default",{},()=>[G("i",{class:N(["m-0",l.direction>0?"i-chevron-right group-active:translate-x-1":"i-chevron-left group-active:-translate-x-1"])},null,2)])],10,le)}const re=H(oe,[["render",ne]]);const se=D({__name:"Carousel",props:{as:{default:"ul"},modelValue:{default:1},autoplay:null},emits:["update:modelValue"],setup(n,{expose:r,emit:l}){r();const t=n,s=c(t.modelValue-1);v(j(t,"modelValue"),e=>{s.value=e-1}),v(s,(e,a)=>{e!==a&&l("update:modelValue",e+1)});const o=c(null),{x:p,isScrolling:w,arrivedState:h}=M(o),B=A(()=>h.left),W=A(()=>h.right),u=c([]),m=c(0),_=c(0),L=c(0),I=()=>{o.value&&(m.value=o.value.scrollWidth,_.value=o.value.offsetWidth)},T=()=>{if(!o.value)return;let e=[...o.value.children];e.length===1&&e[0].tagName.endsWith("SLOT")&&(e=[...e[0].children]),u.value=e.map(a=>({offsetLeft:a.offsetLeft,width:a.offsetWidth}))},P=e=>{let a=s.value+e;a>=u.value.length?(a=0,e=-e):a<0&&(a=u.value.length-1,e=-e);const E=u.value[a]?.width||0;return E?E*e:0},g=()=>{const e=u.value.findIndex(a=>Math.abs(a.offsetLeft-p.value)<=5);e>-1&&(s.value=e||0)},V=()=>{const e=m.value-_.value;L.value=u.value.findIndex(({offsetLeft:a})=>a>=e-5)};let i;const d=()=>{t.autoplay&&(clearTimeout(i),i=setTimeout(()=>{x(1)},t.autoplay))},x=e=>{const a=P(e);a&&(o.value?.scrollBy({left:a,behavior:"smooth"}),d())};v(w,e=>{e?clearTimeout(i):(g(),d())});const k=c(null),R=q(k);v(R,e=>{e?clearTimeout(i):d()});const C=()=>{o.value&&(I(),T(),g(),V())},y=K(()=>{o.value&&(o.value.scrollLeft=0,C())},400);J(()=>{C(),Q(()=>{o.value&&[...o.value.children].forEach(e=>{e.setAttribute("tabindex","0")})}),d(),window.addEventListener("resize",y)}),X(()=>{window.removeEventListener("resize",y),clearTimeout(i)}),Y(F,{autoplay:j(t,"autoplay"),changeSlide:x,isBoundLeft:B,isBoundRight:W});const z={props:t,emit:l,currentIndex:s,wrapper:o,currentPos:p,isScrolling:w,arrivedState:h,isBoundLeft:B,isBoundRight:W,slidesWidth:u,wrapperScrollWidth:m,wrapperVisibleWidth:_,indexCount:L,calcWrapperWidth:I,calcSlidesWidth:T,calcNextWidth:P,calcCurrentIndex:g,calcIndexCount:V,get autoplayTimer(){return i},set autoplayTimer(e){i=e},restartAutoplay:d,changeSlide:x,carousel:k,isHovered:R,calcOnInit:C,onResize:y,CarouselControl:re};return Object.defineProperty(z,"__isScriptSetup",{enumerable:!1,value:!0}),z}}),ue={ref:"carousel",class:"relative","data-carousel":""};function ie(n,r,l,t,s,o){return b(),$("div",ue,[(b(),Z(ee(l.as),{ref:"wrapper",class:"flex overflow-x-scroll overflow-y-hidden list-none m-0 p-0","data-carousel-wrapper":""},{default:S(()=>[f(n.$slots,"default")]),_:3},512)),f(n.$slots,"controls",te(ae({changeSlide:t.changeSlide,isBoundLeft:t.isBoundLeft,isBoundRight:t.isBoundRight,currentPage:t.currentIndex+1,pageCount:t.indexCount+1})),()=>[O(t.CarouselControl,{direction:-1},{default:S(()=>[f(n.$slots,"previous")]),_:3}),O(t.CarouselControl,null,{default:S(()=>[f(n.$slots,"next")]),_:3})])],512)}const fe=H(se,[["render",ie]]);export{fe as C,re as a};
@@ -0,0 +1 @@
1
+ import{v as f}from"./runtime-dom.esm-bundler.e9908a78.js";import{p as u}from"./modules-info.ea748f9d.js";import{c as b,_ as g,d as v,a as o,e as d,w as m,o as s,f as w,b as n,F as y,r as C,n as _,q as S,g as k,h as H,x as T,v as p,i as h}from"./_plugin-vue_export-helper.d71c044e.js";import{C as B,a as N}from"./Carousel.06e8cee5.js";import"./session-utm.ac492493.js";import"./idle-callback.889bf0ea.js";import"./format-money.d54c1237.js";import"./index.b12dff85.js";const V=a=>({parsedSlides:b(()=>a.slides.map(e=>{const r=e.title?u(e.title).value:"",l=e.subtitle?u(e.subtitle).value:"",x=e.buttonText?u(e.buttonText).value:"";return{...e,hasHeader:!!(r||l||x)}}))}),D=v({__name:"HeroSlider",props:{autoplay:null,slides:null},setup(a,{expose:i}){i();const e=a,{parsedSlides:r}=V(e),l={props:e,parsedSlides:r,Carousel:B,CarouselControl:N};return Object.defineProperty(l,"__isScriptSetup",{enumerable:!1,value:!0}),l}}),j={class:"relative mx-auto"},z=["href"],F={key:0,class:"basis-1/2 grow-0 p-12 xl:ps-32 mb-3 md:mb-0"},L={key:0,class:"text-lg mt-4 md:mt-6"},P=["href"],q={class:"absolute z-10 bottom-5 flex justify-end items-center w-screen xl:max-w-screen-xl xl:left-1/2 -ms-[640px]"},E={class:"relative w-20 h-10 rounded-full bg-white/50 text-primary shadow-sm ring-1 ring-black/5"};function O(a,i,e,r,l,x){return s(),o("section",j,[d(r.Carousel,{autoplay:e.autoplay},{controls:m(()=>[w(n("div",q,[n("div",E,[d(r.CarouselControl,{direction:-1,class:"w-10 h-10 rounded-full hover:bg-primary/10"}),d(r.CarouselControl,{class:"w-10 h-10 rounded-full hover:bg-primary/10"})])],512),[[f,r.parsedSlides.length>1]])]),default:m(()=>[(s(!0),o(y,null,C(r.parsedSlides,(t,c)=>(s(),o("li",{key:c,class:"shrink-0 basis-full h-full secondary"},[n("div",{class:_(["w-screen max-w-screen-2xl mx-auto overflow-x-hidden",t.hasHeader?"grid grid-cols-1 md:grid-cols-2 items-center":null])},[n("a",{href:t.href,class:_(t.hasHeader?"basis-1/2 grow-0 md:order-last":null)},[S(a.$slots,`picture-${c}`)],10,z),t.hasHeader?(s(),o("div",F,[(s(),k(H(c===0?"h2":"h3"),{class:"mt-1 text-3xl xl:text-5xl font-black"},{default:m(()=>[T(p(t.title),1)]),_:2},1024)),t.subtitle?(s(),o("p",L,p(t.subtitle),1)):h("",!0),t.buttonText?(s(),o("a",{key:1,href:t.buttonLink,class:"not-prose inline-block min-w-[150px] mt-7 md:mt-10 bg-white text-primary text-lg font-bold px-6 py-2.5 rounded hover:bg-primary-100 active:ring-3 ring-white/30"},p(t.buttonText),9,P)):h("",!0)])):h("",!0)],2)]))),128))]),_:3},8,["autoplay"])])}const U=g(D,[["render",O]]);export{U as default};
@@ -0,0 +1 @@
1
+ import{v}from"./runtime-dom.esm-bundler.e9908a78.js";import{p as y}from"./modules-info.ea748f9d.js";import{_ as p}from"./preload-helper.101896b7.js";import{s as b,c as h,_ as w,d as g,a as d,b as m,e as u,w as _,o as l,f as C,F as x,r as S,g as P,h as E,n as k,i as L}from"./_plugin-vue_export-helper.d71c044e.js";import{C as O,a as V}from"./Carousel.06e8cee5.js";import"./session-utm.ac492493.js";import"./idle-callback.889bf0ea.js";import"./format-money.d54c1237.js";import"./index.b12dff85.js";function T({data:o,query:t,variables:a,cb:s}){{const r=btoa(JSON.stringify({query:t}));window.parent.postMessage(JSON.parse(JSON.stringify({type:"open",data:o,query:t,variables:a,id:r})),window.location.origin),window.addEventListener("message",n=>{n.data.id===r&&s(n.data.data)})}}const A=({query:o,id:t})=>{window.parent.postMessage({type:"close",id:t||btoa(JSON.stringify({query:o}))},window.location.origin)},B=o=>{const t=b({});return window.isCMSPreview&&p(()=>import("./server.browser.e1b1e312.js").then(a=>a.s),["_astro/server.browser.e1b1e312.js","_astro/index.2899cbe4.js","_astro/_commonjsHelpers.725317a4.js"]).then(async({default:a})=>{const{TinaMarkdown:s}=await p(()=>import("./index.es.28e34903.js"),["_astro/index.es.28e34903.js","_astro/index.2899cbe4.js","_astro/_commonjsHelpers.725317a4.js"]),r=e=>(Object.keys(e).forEach(c=>{typeof e[c]=="object"&&e[c]&&(Array.isArray(e[c])&&e[c].forEach(f=>r(f)),e[c].type==="root"&&Array.isArray(e[c].children)?e[c]=a.renderToString(s({content:e[c]})):r(e[c]))}),e),{client:n}=await p(()=>import("./client.f447e2e8.js"),["_astro/client.f447e2e8.js","_astro/_commonjsHelpers.725317a4.js"]),i=await o(n);T({cb:e=>{Object.assign(t,r(e))},data:i.data,query:i.query,variables:i.variables}),window.addEventListener("beforeunload",()=>{A({query:i.query})},{capture:!0})}),{liveContent:t}},M=o=>{const t={slides:[]};return o.header?.pitch_bar&&(t.slides=o.header.pitch_bar),t},N=o=>{const{liveContent:t}=B(async r=>r.queries.layout({relativePath:"layout.json"})),a=h(()=>(t.layout?M(t.layout).slides:o.slides).map(({html:n})=>y(n).value.replace(/<\/?p>/g,"").replace(/&lt;(\/?d-md)&gt;/g,"<$1>"))),s=h(()=>a.value.filter(r=>r).length);return{parsedContents:a,countValidSlides:s}},D=g({__name:"PitchBar",props:{slides:null},setup(o,{expose:t}){t();const a=o,{parsedContents:s,countValidSlides:r}=N(a),n={props:a,parsedContents:s,countValidSlides:r,Carousel:O,CarouselControl:V};return Object.defineProperty(n,"__isScriptSetup",{enumerable:!1,value:!0}),n}}),j={class:"bg-base-100 relative z-20"},q={class:"container md:w-2/3 mx-auto px-3 py-1"},J=["innerHTML"],R={class:"text-xl leading-none text-base-400"};function I(o,t,a,s,r,n){return l(),d("div",j,[m("div",q,[u(s.Carousel,{autoplay:s.countValidSlides>1?7e3:void 0},{controls:_(()=>[C(m("div",R,[u(s.CarouselControl,{direction:-1,class:"pr-2 bg-base-100 hover:text-base-700"}),u(s.CarouselControl,{class:"pl-2 bg-base-100 hover:text-base-700"})],512),[[v,s.countValidSlides>1]])]),default:_(()=>[(l(!0),d(x,null,S(a.slides,(i,e)=>(l(),d("li",{key:e,class:"shrink-0 basis-full h-full text-center"},[(l(),P(E(i.href?"ALink":"span"),{href:i.href,target:i.target,class:k(["inline-block px-8",i.href?"hover:underline":null])},{default:_(()=>[s.parsedContents[e]?(l(),d("span",{key:0,innerHTML:s.parsedContents[e],class:"prose text-sm text-base-800"},null,8,J)):L("",!0)]),_:2},1032,["href","target","class"]))]))),128))]),_:1},8,["autoplay"])])])}const Y=w(D,[["render",I]]);export{Y as default};
@@ -1 +1 @@
1
- import{m as g}from"./modules-info.2a72e536.js";import{g as k,c as S}from"./format-money.f09b89ed.js";import{c as a,d as M,_ as T,a as o,u as i,i as u,b as h,v as C,n as I,e as L,w as D,m as z,o as l}from"./_plugin-vue_export-helper.0c2b7f88.js";import"./session-utm.ac492493.js";import"./idle-callback.889bf0ea.js";const j=(n,c)=>{const{type:s,value:t}=c;let r;return t?(s==="percentage"?r=n*((100-t)/100):r=n-t,r>0?r:0):n},E=n=>{const c=a(()=>n.product||{price:n.price||0,base_price:n.basePrice}),s=a(()=>{const{variations:e}=c.value;if(e){const _=k(c.value);for(let v=0;v<e.length;v++)if(k({...c.value,...e[v]})>_)return!0}return!1}),t=a(()=>g.apply_discount.available_extra_discount),r=a(()=>{const e=k(c.value),_=t.value;return _&&(!_.min_amount||e>_.min_amount)?j(e,_):e}),P=a(()=>{if(S(c.value))return c.value.base_price;const e=k(c.value);return e>r.value?e:0}),m=a(()=>n.installmentsOption||g.list_payments.installments_option||{max_number:1}),b=a(()=>{if(m.value.max_number<=1)return 1;const e=m.value.min_installment||5,_=Math.round(r.value/e);return Math.min(_,m.value.max_number)}),y=a(()=>m.value.monthly_interest||0),V=a(()=>{if(b.value>=2){if(!y.value)return r.value/b.value;const e=y.value/100;return r.value*e/(1-(1+e)**-b.value)}return 0}),p=a(()=>{const e=n.discountOption||g.list_payments.discount_option;return e&&(!e.min_amount||e.min_amount<=r.value)&&(!n.isAmountTotal||e.apply_at==="total")?e:{}}),x=a(()=>{const{label:e}=p.value;return e?e.includes(" ")?e:`via ${e}`:""}),O=a(()=>j(r.value,p.value)),d=a(()=>{if(n.loyaltyPointsProgram)return n.loyaltyPointsProgram;const e=g.list_payments.loyalty_points_programs;if(e){const _=Object.keys(e);for(let v=0;v<_.length;v++){const f=e[_[v]];if(f?.earn_percentage&&f.earn_percentage>0)return f}}return{ratio:0}}),W=a(()=>d.value.min_subtotal_to_earn||0),w=a(()=>d.value.name||""),N=a(()=>d.value.earn_percentage||0),B=a(()=>N.value*d.value.ratio),A=a(()=>B.value>=1?r.value*(B.value/100):0);return{hasVariedPrices:s,salePrice:r,comparePrice:P,installmentsObject:m,installmentsNumber:b,monthlyInterest:y,installmentValue:V,discountObject:p,discountLabel:x,priceWithDiscount:O,pointsProgramObject:d,pointsMinPrice:W,pointsProgramName:w,earnPointsPercentage:N,cashbackPercentage:B,cashbackValue:A}};const F=M({__name:"Prices",props:{product:null,price:null,basePrice:null,isAmountTotal:{type:Boolean},installmentsOption:null,discountOption:null,isBig:{type:Boolean},isLiteral:{type:Boolean},hasCashback:{type:Boolean,default:!0},hasPriceOptions:{type:Boolean,default:!0}},setup(n,{expose:c}){c();const s=n,{hasVariedPrices:t,salePrice:r,comparePrice:P,cashbackPercentage:m,cashbackValue:b,installmentsNumber:y,monthlyInterest:V,installmentValue:p,priceWithDiscount:x,discountLabel:O}=E(s),d={props:s,hasVariedPrices:t,salePrice:r,comparePrice:P,cashbackPercentage:m,cashbackValue:b,installmentsNumber:y,monthlyInterest:V,installmentValue:p,priceWithDiscount:x,discountLabel:O};return Object.defineProperty(d,"__isScriptSetup",{enumerable:!1,value:!0}),d}}),R={key:0,class:"text-base-500 mr-1"},q={key:0},G={key:1},H={key:0},J={key:0,class:"relative z-10"},K=["data-tooltip"],Q=h("i",{class:"i-cashback mr-1"},null,-1),U={class:"font-medium"},X=h("small",null," cashback",-1),Y={key:0},Z={key:0},$={key:1},ee={key:2},te={key:0},ne={key:0},ae={key:1};function se(n,c,s,t,r,P){const m=z("Fade");return l(),o("div",{class:I(["text-base-600",s.isBig?"text-lg":null]),"data-prices":""},[t.comparePrice?(l(),o("span",R,[s.isLiteral?(l(),o("small",q,i("De "))):u("",!0),h("s",null,i(n.$money(t.comparePrice)),1),s.isLiteral?(l(),o("small",G,i(" Por"))):u("",!0)])):u("",!0),h("strong",{class:I(["inline-block text-base-800",s.isBig?"text-5xl block":null])},[t.hasVariedPrices?(l(),o("small",H,i("A partir de "))):u("",!0),C(" "+i(n.$money(t.salePrice)),1)],2),L(m,{slide:"down"},{default:D(()=>[t.cashbackValue&&s.hasCashback?(l(),o("div",J,[h("span",{"data-tooltip":"Receba $1 de volta".replace("$1",n.$percentage(t.cashbackPercentage))},[Q,h("span",U,i(n.$money(t.cashbackValue)),1),X],8,K)])):u("",!0)]),_:1}),L(m,{slide:"down"},{default:D(()=>[t.installmentValue&&s.hasPriceOptions?(l(),o("div",Y,[s.isLiteral?(l(),o("small",Z,i("Até "))):u("",!0),C(" "+i(t.installmentsNumber)+"x ",1),s.isLiteral?(l(),o("small",$,i(" De "))):u("",!0),h("span",null,i(n.$money(t.installmentValue)),1),!t.monthlyInterest&&s.isLiteral?(l(),o("small",ee,i("Sem juros"))):u("",!0)])):u("",!0)]),_:1}),L(m,{slide:"down"},{default:D(()=>[t.priceWithDiscount<t.salePrice&&s.hasPriceOptions?(l(),o("div",te,[t.discountLabel?u("",!0):(l(),o("small",ne,i("A partir de "))),h("span",null,i(n.$money(t.priceWithDiscount)),1),t.discountLabel?(l(),o("small",ae,i(` ${t.discountLabel}`),1)):u("",!0)])):u("",!0)]),_:1})],2)}const ue=T(F,[["render",se]]);export{ue as default};
1
+ import{m as g}from"./modules-info.ea748f9d.js";import{g as k,c as S}from"./format-money.d54c1237.js";import{c as a,d as M,_ as T,a as o,v as i,i as u,b as h,x as C,n as I,e as L,w as D,m as z,o as l}from"./_plugin-vue_export-helper.d71c044e.js";import"./session-utm.ac492493.js";import"./idle-callback.889bf0ea.js";const j=(n,c)=>{const{type:s,value:t}=c;let r;return t?(s==="percentage"?r=n*((100-t)/100):r=n-t,r>0?r:0):n},E=n=>{const c=a(()=>n.product||{price:n.price||0,base_price:n.basePrice}),s=a(()=>{const{variations:e}=c.value;if(e){const _=k(c.value);for(let v=0;v<e.length;v++)if(k({...c.value,...e[v]})>_)return!0}return!1}),t=a(()=>g.apply_discount.available_extra_discount),r=a(()=>{const e=k(c.value),_=t.value;return _&&(!_.min_amount||e>_.min_amount)?j(e,_):e}),P=a(()=>{if(S(c.value))return c.value.base_price;const e=k(c.value);return e>r.value?e:0}),m=a(()=>n.installmentsOption||g.list_payments.installments_option||{max_number:1}),b=a(()=>{if(m.value.max_number<=1)return 1;const e=m.value.min_installment||5,_=Math.round(r.value/e);return Math.min(_,m.value.max_number)}),y=a(()=>m.value.monthly_interest||0),x=a(()=>{if(b.value>=2){if(!y.value)return r.value/b.value;const e=y.value/100;return r.value*e/(1-(1+e)**-b.value)}return 0}),p=a(()=>{const e=n.discountOption||g.list_payments.discount_option;return e&&(!e.min_amount||e.min_amount<=r.value)&&(!n.isAmountTotal||e.apply_at==="total")?e:{}}),V=a(()=>{const{label:e}=p.value;return e?e.includes(" ")?e:`via ${e}`:""}),O=a(()=>j(r.value,p.value)),d=a(()=>{if(n.loyaltyPointsProgram)return n.loyaltyPointsProgram;const e=g.list_payments.loyalty_points_programs;if(e){const _=Object.keys(e);for(let v=0;v<_.length;v++){const f=e[_[v]];if(f?.earn_percentage&&f.earn_percentage>0)return f}}return{ratio:0}}),W=a(()=>d.value.min_subtotal_to_earn||0),w=a(()=>d.value.name||""),N=a(()=>d.value.earn_percentage||0),B=a(()=>N.value*d.value.ratio),A=a(()=>B.value>=1?r.value*(B.value/100):0);return{hasVariedPrices:s,salePrice:r,comparePrice:P,installmentsObject:m,installmentsNumber:b,monthlyInterest:y,installmentValue:x,discountObject:p,discountLabel:V,priceWithDiscount:O,pointsProgramObject:d,pointsMinPrice:W,pointsProgramName:w,earnPointsPercentage:N,cashbackPercentage:B,cashbackValue:A}};const F=M({__name:"Prices",props:{product:null,price:null,basePrice:null,isAmountTotal:{type:Boolean},installmentsOption:null,discountOption:null,isBig:{type:Boolean},isLiteral:{type:Boolean},hasCashback:{type:Boolean,default:!0},hasPriceOptions:{type:Boolean,default:!0}},setup(n,{expose:c}){c();const s=n,{hasVariedPrices:t,salePrice:r,comparePrice:P,cashbackPercentage:m,cashbackValue:b,installmentsNumber:y,monthlyInterest:x,installmentValue:p,priceWithDiscount:V,discountLabel:O}=E(s),d={props:s,hasVariedPrices:t,salePrice:r,comparePrice:P,cashbackPercentage:m,cashbackValue:b,installmentsNumber:y,monthlyInterest:x,installmentValue:p,priceWithDiscount:V,discountLabel:O};return Object.defineProperty(d,"__isScriptSetup",{enumerable:!1,value:!0}),d}}),R={key:0,class:"text-base-500 mr-1"},q={key:0},G={key:1},H={key:0},J={key:0,class:"relative z-10"},K=["data-tooltip"],Q=h("i",{class:"i-cashback mr-1"},null,-1),U={class:"font-medium"},X=h("small",null," cashback",-1),Y={key:0},Z={key:0},$={key:1},ee={key:2},te={key:0},ne={key:0},ae={key:1};function se(n,c,s,t,r,P){const m=z("Fade");return l(),o("div",{class:I(["text-base-600",s.isBig?"text-lg":null]),"data-prices":""},[t.comparePrice?(l(),o("span",R,[s.isLiteral?(l(),o("small",q,i("De "))):u("",!0),h("s",null,i(n.$money(t.comparePrice)),1),s.isLiteral?(l(),o("small",G,i(" Por"))):u("",!0)])):u("",!0),h("strong",{class:I(["inline-block text-base-800",s.isBig?"text-5xl block":null])},[t.hasVariedPrices?(l(),o("small",H,i("A partir de "))):u("",!0),C(" "+i(n.$money(t.salePrice)),1)],2),L(m,{slide:"down"},{default:D(()=>[t.cashbackValue&&s.hasCashback?(l(),o("div",J,[h("span",{"data-tooltip":"Receba $1 de volta".replace("$1",n.$percentage(t.cashbackPercentage))},[Q,h("span",U,i(n.$money(t.cashbackValue)),1),X],8,K)])):u("",!0)]),_:1}),L(m,{slide:"down"},{default:D(()=>[t.installmentValue&&s.hasPriceOptions?(l(),o("div",Y,[s.isLiteral?(l(),o("small",Z,i("Até "))):u("",!0),C(" "+i(t.installmentsNumber)+"x ",1),s.isLiteral?(l(),o("small",$,i(" De "))):u("",!0),h("span",null,i(n.$money(t.installmentValue)),1),!t.monthlyInterest&&s.isLiteral?(l(),o("small",ee,i("Sem juros"))):u("",!0)])):u("",!0)]),_:1}),L(m,{slide:"down"},{default:D(()=>[t.priceWithDiscount<t.salePrice&&s.hasPriceOptions?(l(),o("div",te,[t.discountLabel?u("",!0):(l(),o("small",ne,i("A partir de "))),h("span",null,i(n.$money(t.priceWithDiscount)),1),t.discountLabel?(l(),o("small",ae,i(` ${t.discountLabel}`),1)):u("",!0)])):u("",!0)]),_:1})],2)}const ue=T(F,[["render",se]]);export{ue as default};