cloudcommerce 0.26.3 → 0.26.5

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 (128) hide show
  1. package/.github/workflows/create-release.yml +1 -1
  2. package/.github/workflows/{test-e2e.yml → test-apps.yml} +19 -5
  3. package/CHANGELOG.md +31 -0
  4. package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
  5. package/ecomplus-stores/barra-doce/functions/ssr/package.json +6 -6
  6. package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
  7. package/ecomplus-stores/barra-doce/package.json +2 -2
  8. package/ecomplus-stores/iluminim/functions/many/package.json +3 -3
  9. package/ecomplus-stores/iluminim/functions/ssr/package.json +6 -6
  10. package/ecomplus-stores/iluminim/functions/with-apps/package.json +3 -3
  11. package/ecomplus-stores/iluminim/package.json +2 -2
  12. package/package.json +7 -7
  13. package/packages/api/package.json +1 -1
  14. package/packages/apps/affilate-program/package.json +1 -1
  15. package/packages/apps/correios/package.json +2 -2
  16. package/packages/apps/custom-payment/package.json +1 -1
  17. package/packages/apps/custom-shipping/package.json +2 -2
  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 +4 -2
  24. package/packages/apps/frenet/scripts/tests.sh +7 -0
  25. package/packages/apps/frenet/tests/calculate-shipping.test.mjs +37 -0
  26. package/packages/apps/galaxpay/package.json +1 -1
  27. package/packages/apps/google-analytics/package.json +1 -1
  28. package/packages/apps/jadlog/package.json +1 -1
  29. package/packages/apps/loyalty-points/package.json +2 -2
  30. package/packages/apps/melhor-envio/package.json +1 -1
  31. package/packages/apps/mercadopago/package.json +2 -2
  32. package/packages/apps/mercadopago/scripts/tests.sh +7 -0
  33. package/packages/apps/pagarme/package.json +1 -1
  34. package/packages/apps/paghiper/package.json +1 -1
  35. package/packages/apps/pix/package.json +1 -1
  36. package/packages/apps/tiny-erp/package.json +1 -1
  37. package/packages/apps/webhooks/package.json +1 -1
  38. package/packages/cli/lib/cli.js +3 -0
  39. package/packages/cli/package.json +1 -1
  40. package/packages/cli/src/cli.ts +4 -0
  41. package/packages/config/package.json +1 -1
  42. package/packages/emails/package.json +3 -3
  43. package/packages/eslint/package.json +4 -4
  44. package/packages/events/package.json +1 -1
  45. package/packages/feeds/package.json +1 -1
  46. package/packages/firebase/package.json +2 -2
  47. package/packages/i18n/package.json +1 -1
  48. package/packages/modules/package.json +2 -2
  49. package/packages/passport/package.json +1 -1
  50. package/packages/ssr/package.json +2 -2
  51. package/packages/storefront/astro.config.mjs +33 -23
  52. package/packages/storefront/dist/client/_astro/{Carousel.0b24e2cb.js → Carousel.9ad2e1dc.js} +1 -1
  53. package/packages/storefront/dist/client/_astro/{CartSidebar.2731d333.js → CartSidebar.a6c6a885.js} +1 -1
  54. package/packages/storefront/dist/client/_astro/{HeroSlider.a70b2582.js → HeroSlider.ee1e6200.js} +1 -1
  55. package/packages/storefront/dist/client/_astro/{PitchBar.13991988.js → PitchBar.6111676e.js} +1 -1
  56. package/packages/storefront/dist/client/_astro/{Prices.cdfa346a.js → Prices.04ff8fce.js} +1 -1
  57. package/packages/storefront/dist/client/_astro/{ProductShelf.619c56a5.js → ProductShelf.085721d6.js} +1 -1
  58. package/packages/storefront/dist/client/_astro/SearchModal.cffd4c2d.js +1 -0
  59. package/packages/storefront/dist/client/_astro/{ShopHeader.2c2fded7.js → ShopHeader.7e485e35.js} +2 -2
  60. package/packages/storefront/dist/client/_astro/{_plugin-vue_export-helper.fc5e2f5b.js → _plugin-vue_export-helper.ee681fa8.js} +1 -1
  61. package/packages/storefront/dist/client/_astro/{api.39f40cd8.js → api.a2eda23e.js} +1 -1
  62. package/packages/storefront/dist/client/_astro/client.e6d9439a.js +1 -0
  63. package/packages/storefront/dist/client/_astro/{format-money.86f14860.js → format-money.923559cc.js} +1 -1
  64. package/packages/storefront/dist/client/_astro/hoisted.85fdcf03.js +1 -0
  65. package/packages/storefront/dist/client/_astro/{img.d4891d80.js → img.ec6ba316.js} +1 -1
  66. package/packages/storefront/dist/client/_astro/{index.33801818.js → index.ea57babe.js} +1 -1
  67. package/packages/storefront/dist/client/_astro/{modules-info.ec412b24.js → modules-info.e5d77bf3.js} +1 -1
  68. package/packages/storefront/dist/client/sw.js +1 -1
  69. package/packages/storefront/dist/server/chunks/{CartSidebar.cca9fdd3.mjs → CartSidebar.41b20543.mjs} +20 -9
  70. package/packages/storefront/dist/server/chunks/{SearchModal.a680efae.mjs → SearchModal.5f5e6a15.mjs} +19 -8
  71. package/packages/storefront/dist/server/chunks/_...4a2548d2.mjs +35 -0
  72. package/packages/storefront/dist/server/chunks/account@_@astro.204fba92.mjs +35 -0
  73. package/packages/storefront/dist/server/chunks/{astro.440a2e08.mjs → astro.708269c6.mjs} +1859 -149
  74. package/packages/storefront/dist/server/chunks/endpoint@_@js.11be892a.mjs +35 -0
  75. package/packages/storefront/dist/server/chunks/index@_@astro.19e0f502.mjs +35 -0
  76. package/packages/storefront/dist/server/chunks/index@_@astro.b37a6ac9.mjs +35 -0
  77. package/packages/storefront/dist/{client/chunks/pages/_...slug_.astro.ec6517ba.mjs → server/chunks/pages/_...slug_.astro.36e8882b.mjs} +273 -331
  78. package/packages/storefront/dist/{client/chunks/pages/account.astro.3d2605e6.mjs → server/chunks/pages/account.astro.32e7e6ef.mjs} +10 -2
  79. package/packages/storefront/dist/server/chunks/pages/endpoint.js.f7a896a1.mjs +119 -0
  80. package/packages/storefront/dist/server/chunks/pages/{index.astro.079f316a.mjs → index.astro.3145bd93.mjs} +2 -3
  81. package/packages/storefront/dist/server/chunks/pages/{~fallback.astro.01594623.mjs → ~fallback.astro.ba4c2475.mjs} +20 -9
  82. package/packages/storefront/dist/server/chunks/~fallback@_@astro.6bb4c4b4.mjs +35 -0
  83. package/packages/storefront/dist/server/entry.mjs +2359 -1166
  84. package/packages/storefront/dist/server/renderers.mjs +21 -10
  85. package/packages/storefront/package.json +4 -4
  86. package/packages/storefront/src/lib/components/ContentClearfix.astro +12 -0
  87. package/packages/storefront/src/lib/composables/use-breadcrumbs.ts +84 -0
  88. package/packages/storefront/src/lib/composables/use-shared-data.ts +14 -5
  89. package/packages/storefront/src/lib/content.d.ts +3 -3
  90. package/packages/storefront/src/lib/layouts/BaseHead.astro +3 -0
  91. package/packages/storefront/src/lib/layouts/use-page-main.ts +23 -2
  92. package/packages/storefront/src/lib/ssr-context.ts +17 -5
  93. package/packages/test-base/package.json +1 -1
  94. package/packages/test-base/payloads/calculate-shipping.json +4 -4
  95. package/packages/test-base/payloads/create-transaction.json +1 -1
  96. package/packages/types/package.json +1 -1
  97. package/pnpm-workspace.yaml +0 -2
  98. package/turbo.json +1 -1
  99. package/packages/storefront/dist/client/_astro/SearchModal.117a477d.js +0 -1
  100. package/packages/storefront/dist/client/_astro/client.a5d2898b.js +0 -1
  101. package/packages/storefront/dist/client/_astro/hoisted.d90361ee.js +0 -1
  102. package/packages/storefront/dist/client/_empty-middleware.mjs +0 -3
  103. package/packages/storefront/dist/client/chunks/CartSidebar.0ce1e999.mjs +0 -382
  104. package/packages/storefront/dist/client/chunks/SearchModal.f603145b.mjs +0 -32
  105. package/packages/storefront/dist/client/chunks/astro.11be33ee.mjs +0 -1424
  106. package/packages/storefront/dist/client/chunks/pages/index.astro.8ad03206.mjs +0 -1650
  107. package/packages/storefront/dist/client/chunks/pages/~fallback.astro.d31d20b4.mjs +0 -54
  108. package/packages/storefront/dist/client/chunks/sharp.3f154e38.mjs +0 -74
  109. package/packages/storefront/dist/client/manifest.e39eb543.mjs +0 -79
  110. package/packages/storefront/dist/client/pages/_---slug_.astro.mjs +0 -23
  111. package/packages/storefront/dist/client/pages/app/account.astro.mjs +0 -23
  112. package/packages/storefront/dist/client/pages/app.astro.mjs +0 -23
  113. package/packages/storefront/dist/client/pages/index.astro.mjs +0 -23
  114. package/packages/storefront/dist/client/pages/~fallback.astro.mjs +0 -23
  115. package/packages/storefront/dist/client/registerSW.js +0 -1
  116. package/packages/storefront/dist/client/renderers.mjs +0 -369
  117. package/packages/storefront/dist/server/chunks/_...f7cdc954.mjs +0 -24
  118. package/packages/storefront/dist/server/chunks/account@_@astro.fa8b921b.mjs +0 -24
  119. package/packages/storefront/dist/server/chunks/image-endpoint@_@js.802bf648.mjs +0 -24
  120. package/packages/storefront/dist/server/chunks/index@_@astro.a122f091.mjs +0 -24
  121. package/packages/storefront/dist/server/chunks/index@_@astro.da98dcbe.mjs +0 -24
  122. package/packages/storefront/dist/server/chunks/pages/_...slug_.astro.08ba5973.mjs +0 -3930
  123. package/packages/storefront/dist/server/chunks/pages/account.astro.f11f26f3.mjs +0 -15
  124. package/packages/storefront/dist/server/chunks/pages/image-endpoint.js.a9374d3e.mjs +0 -238
  125. package/packages/storefront/dist/server/chunks/sharp.52841bb4.mjs +0 -75
  126. package/packages/storefront/dist/server/chunks/~fallback@_@astro.876a97c5.mjs +0 -24
  127. package/packages/storefront/dist/server/manifest.12e7a10c.mjs +0 -561
  128. /package/packages/storefront/dist/client/{workbox-5e0bf4e4.js → workbox-1b331600.js} +0 -0
@@ -1,20 +1,31 @@
1
+ import { i as server_default } from './chunks/astro.708269c6.mjs';
1
2
  import { useSSRContext, defineComponent, computed, createVNode, resolveDynamicComponent, mergeProps, withCtx, renderSlot, h, createSSRApp } from 'vue';
2
3
  import { ssrRenderSlotInner, ssrRenderVNode, ssrRenderSlot, ssrRenderAttrs, ssrRenderClass, renderToString } from 'vue/server-renderer';
3
4
  import { img, imgSizes, i18n, formatMoney } from '@ecomplus/utils';
4
- import { _ as _export_sfc } from './chunks/pages/_...slug_.astro.08ba5973.mjs';
5
+ import { _ as _export_sfc } from './chunks/pages/_...slug_.astro.36e8882b.mjs';
6
+ import 'path-to-regexp';
7
+ import 'cookie';
5
8
  import '@astrojs/internal-helpers/path';
6
- import './chunks/astro.440a2e08.mjs';
7
- import 'clsx';
9
+ import 'kleur/colors';
10
+ import 'node:fs';
11
+ import 'node:http';
12
+ import 'node:tls';
13
+ import 'mime';
14
+ import 'string-width';
8
15
  import 'html-escaper';
16
+ import 'node:fs/promises';
17
+ import 'node:path';
18
+ import 'node:url';
19
+ import 'http-cache-semantics';
20
+ import 'node:os';
21
+ import 'image-size';
22
+ import 'magic-string';
23
+ import 'node:stream';
9
24
  import '@cloudcommerce/api';
10
25
  import 'node:events';
11
- import 'node:fs';
12
- import 'node:path';
13
26
  import '@cloudcommerce/config';
14
27
  import 'ultrahtml';
15
- /* empty css */import 'image-size';
16
- import 'mime';
17
- import '@vueuse/core';
28
+ /* empty css */import '@vueuse/core';
18
29
  import '@headlessui/vue';
19
30
 
20
31
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
@@ -359,12 +370,12 @@ async function renderToStaticMarkup(Component, props, slotted, metadata) {
359
370
  return { html };
360
371
  }
361
372
 
362
- const _renderer0 = {
373
+ const _renderer1 = {
363
374
  check,
364
375
  renderToStaticMarkup,
365
376
  supportsAstroStaticSlot: true,
366
377
  };
367
378
 
368
- const renderers = [Object.assign({"name":"@astrojs/vue","clientEntrypoint":"@astrojs/vue/client.js","serverEntrypoint":"@astrojs/vue/server.js"}, { ssr: _renderer0 }),];
379
+ const renderers = [Object.assign({"name":"astro:jsx","serverEntrypoint":"astro/jsx/server.js","jsxImportSource":"astro"}, { ssr: server_default }),Object.assign({"name":"@astrojs/vue","clientEntrypoint":"@astrojs/vue/client.js","serverEntrypoint":"@astrojs/vue/server.js"}, { ssr: _renderer1 }),];
369
380
 
370
381
  export { renderers };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/storefront",
3
3
  "type": "module",
4
- "version": "0.26.3",
4
+ "version": "0.26.5",
5
5
  "description": "E-Com Plus Cloud Commerce storefront with Astro",
6
6
  "bin": {
7
7
  "storefront": "./scripts/build-prod.sh"
@@ -40,8 +40,8 @@
40
40
  "@headlessui/vue": "^1.7.16",
41
41
  "@iconify-json/fa6-brands": "^1.1.13",
42
42
  "@iconify-json/heroicons": "^1.1.12",
43
- "@iconify-json/logos": "^1.1.35",
44
- "@vite-pwa/astro": "^0.1.2",
43
+ "@iconify-json/logos": "^1.1.36",
44
+ "@vite-pwa/astro": "^0.1.3",
45
45
  "@vueuse/core": "10.4.1",
46
46
  "astro": "2.10.15",
47
47
  "astro-capo": "^0.0.1",
@@ -55,7 +55,7 @@
55
55
  "tailwindcss": "^3.3.3",
56
56
  "unocss": "^0.55.7",
57
57
  "vite": "^4.4.9",
58
- "vite-plugin-pwa": "^0.16.4",
58
+ "vite-plugin-pwa": "^0.16.5",
59
59
  "vue": "^3.3.4"
60
60
  },
61
61
  "devDependencies": {
@@ -0,0 +1,12 @@
1
+ ---
2
+ export interface Props {
3
+ html: string;
4
+ }
5
+
6
+ const { html } = Astro.props;
7
+ const parsedHTML = html.replace(/<(img|iframe) /g, '<$1 loading="lazy" ');
8
+ ---
9
+
10
+ <article class="overflow-x-auto lg:overflow-x-hidden prose !max-w-full">
11
+ <div class="[&_table]:max-w-full [&_img]:max-w-full" set:html={parsedHTML}></div>
12
+ </article>
@@ -0,0 +1,84 @@
1
+ import type {
2
+ Products,
3
+ Categories,
4
+ Brands,
5
+ Collections,
6
+ } from '@cloudcommerce/api/types';
7
+ import {
8
+ name as getName,
9
+ categoriesList as getCategoriesList,
10
+ } from '@ecomplus/utils';
11
+ import useSharedData from '@@sf/composables/use-shared-data';
12
+
13
+ export interface Props {
14
+ apiDoc?: Partial<Products | Categories | Brands | Collections>;
15
+ categories?: Partial<Categories>[];
16
+ domain?: string;
17
+ }
18
+
19
+ const useBreadcrumbs = async (props: Props = {}) => {
20
+ const { settings, apiContext, data } = globalThis.$storefront;
21
+ const {
22
+ apiDoc = apiContext?.doc,
23
+ domain = settings.domain,
24
+ } = props;
25
+ let categories: Props['categories'] = props.categories || data.categories;
26
+ if (!categories) {
27
+ categories = (await useSharedData({ field: 'categories' })).value;
28
+ }
29
+ const breadcrumbs: Array<{ name: string, link: string }> = [];
30
+ if (apiDoc) {
31
+ const productCategories = (apiDoc as Products).categories;
32
+ if (productCategories) {
33
+ getCategoriesList(apiDoc).forEach((categoryName) => {
34
+ const findCategory = (category: Partial<Categories>) => {
35
+ return category.name === categoryName;
36
+ };
37
+ const category = (productCategories && productCategories.find(findCategory))
38
+ || categories?.find(findCategory);
39
+ if (category) {
40
+ breadcrumbs.push({
41
+ name: getName(category),
42
+ link: `/${category.slug}`,
43
+ });
44
+ }
45
+ });
46
+ }
47
+ breadcrumbs.push({
48
+ name: getName(apiDoc),
49
+ link: `/${apiDoc.slug}`,
50
+ });
51
+ }
52
+ return {
53
+ breadcrumbs,
54
+ inlineJSONLd: domain
55
+ ? JSON.stringify({
56
+ '@context': 'https://schema.org',
57
+ '@type': 'BreadcrumbList',
58
+ itemListElement: [
59
+ {
60
+ '@type': 'ListItem',
61
+ position: 1,
62
+ item: {
63
+ '@id': `https://${domain}/`,
64
+ name: 'Homepage',
65
+ },
66
+ },
67
+ ].concat(breadcrumbs.map(({ name, link }, index) => {
68
+ return {
69
+ '@type': 'ListItem',
70
+ position: index + 2,
71
+ item: {
72
+ '@id': `https://${domain}${link}`,
73
+ name,
74
+ },
75
+ };
76
+ })),
77
+ })
78
+ : null,
79
+ };
80
+ };
81
+
82
+ export default useBreadcrumbs;
83
+
84
+ export { useBreadcrumbs };
@@ -3,11 +3,12 @@ import { EventEmitter } from 'node:events';
3
3
  export interface Props {
4
4
  field: string;
5
5
  value?: any;
6
+ timeout?: number;
6
7
  }
7
8
 
8
9
  const emitter = new EventEmitter();
9
10
 
10
- const useSharedData = async ({ field, value }: Props) => {
11
+ const useSharedData = async ({ field, value, timeout = 1000 }: Props) => {
11
12
  const $data = global.$storefront.data;
12
13
  if (value) {
13
14
  $data[field] = value;
@@ -16,7 +17,17 @@ const useSharedData = async ({ field, value }: Props) => {
16
17
  value = $data[field];
17
18
  } else {
18
19
  value = await new Promise((resolve) => {
19
- emitter.once(field, resolve);
20
+ const callback = (_value: any) => {
21
+ resolve(_value);
22
+ // eslint-disable-next-line no-use-before-define
23
+ clearTimeout(timer);
24
+ };
25
+ const abort = () => {
26
+ resolve(null);
27
+ emitter.removeListener(field, callback);
28
+ };
29
+ const timer = setTimeout(abort, timeout);
30
+ emitter.once(field, callback);
20
31
  });
21
32
  }
22
33
  return {
@@ -28,6 +39,4 @@ window.$storefront.data['${field}'] = ${JSON.stringify(value)};`,
28
39
 
29
40
  export default useSharedData;
30
41
 
31
- export {
32
- useSharedData,
33
- };
42
+ export { useSharedData };
@@ -11,9 +11,9 @@ export type LayoutContent = Omit<_LayoutContent, 'header' | 'footer'> & {
11
11
  };
12
12
 
13
13
  export interface PageContent {
14
- meta_title: string;
15
- meta_description: string;
16
- hero: {
14
+ meta_title?: string;
15
+ meta_description?: string;
16
+ hero?: {
17
17
  [k: string]: unknown,
18
18
  autoplay?: number,
19
19
  slides: Array<{
@@ -1,5 +1,6 @@
1
1
  ---
2
2
  import { pwaInfo } from 'virtual:pwa-info';
3
+ import { ViewTransitions } from 'astro:transitions';
3
4
  import { img as getImg, price as getPrice } from '@ecomplus/utils';
4
5
 
5
6
  const deployRand = import.meta.env.DEPLOY_RAND || '_';
@@ -148,3 +149,5 @@ const inlineJSONLd = JSON.stringify({
148
149
 
149
150
  <script is:inline set:html={inlineClientJS} />
150
151
  <script type="application/ld+json" set:html={inlineJSONLd} />
152
+
153
+ <ViewTransitions />
@@ -3,6 +3,7 @@ import type { PageContent } from '@@sf/content';
3
3
  import type { RouteContext } from '@@sf/ssr-context';
4
4
  import type { Props as UseBannerProps } from '@@sf/composables/use-banner';
5
5
  import type { Props as UseProductShelfProps } from '@@sf/composables/use-product-shelf';
6
+ import type { Props as UseBreadcrumbsProps } from '@@sf/composables/use-breadcrumbs';
6
7
  import { useProductShelf } from '@@sf/composables/use-product-shelf';
7
8
 
8
9
  export interface Props {
@@ -11,8 +12,9 @@ export interface Props {
11
12
  Promise<{ props: Record<string, any> }>;
12
13
  }
13
14
 
15
+ type PageContentHero = Exclude<PageContent['hero'], undefined>;
14
16
  const now = Date.now();
15
- const parseBanners = (banners: PageContent['hero']['slides']) => {
17
+ const parseBanners = (banners: PageContentHero['slides']) => {
16
18
  const validBanners: UseBannerProps[] = [];
17
19
  banners.forEach(({
18
20
  img,
@@ -38,7 +40,7 @@ const parseBanners = (banners: PageContent['hero']['slides']) => {
38
40
 
39
41
  export const usePageHero = async ({ routeContext }: Props) => {
40
42
  const { cmsContent } = routeContext;
41
- const heroSlider: Omit<PageContent['hero'], 'slides'>
43
+ const heroSlider: Omit<PageContentHero, 'slides'>
42
44
  & { slides: UseBannerProps[] } = { slides: [] };
43
45
  const heroContent = cmsContent?.hero;
44
46
  if (heroContent) {
@@ -59,6 +61,11 @@ export const usePageSections = async <T extends CustomSection = CustomSection>
59
61
  T
60
62
  | { type: 'product-shelf', props: UseProductShelfProps }
61
63
  | { type: 'banners-grid', props: { banners: UseBannerProps[] } }
64
+ | { type: 'breadcrumbs', props: UseBreadcrumbsProps }
65
+ | { type: 'product-details', props: {} }
66
+ | { type: 'related-products', props: {} }
67
+ | { type: 'doc-description', props: {} }
68
+ | { type: 'product-specifications', props: {} }
62
69
  > = [];
63
70
  if (sectionsContent) {
64
71
  await Promise.all(sectionsContent.map(async ({ type, ...sectionContent }, index) => {
@@ -143,6 +150,20 @@ export const usePageSections = async <T extends CustomSection = CustomSection>
143
150
  };
144
151
  return;
145
152
  }
153
+ switch (type) {
154
+ case 'breadcrumbs':
155
+ case 'product-details':
156
+ case 'related-products':
157
+ case 'doc-description':
158
+ case 'product-specifications':
159
+ // Bypassed sections
160
+ sections[index] = {
161
+ type,
162
+ props: {},
163
+ };
164
+ return;
165
+ default:
166
+ }
146
167
  if (typeof handleCustomSection === 'function') {
147
168
  const { props } = await handleCustomSection(
148
169
  type as `${string}:${string}`,
@@ -1,7 +1,7 @@
1
1
  import type { AstroGlobal } from 'astro';
2
2
  import type { BaseConfig } from '@cloudcommerce/config';
3
3
  import type { ApiError, ApiEndpoint } from '@cloudcommerce/api';
4
- import type { CategoriesList, BrandsList } from '@cloudcommerce/api/types';
4
+ import type { ResourceId, CategoriesList, BrandsList } from '@cloudcommerce/api/types';
5
5
  import type { ContentGetter, SettingsContent, PageContent } from '@@sf/content';
6
6
  import { EventEmitter } from 'node:events';
7
7
  import api from '@cloudcommerce/api';
@@ -69,7 +69,7 @@ const loadRouteContext = async (Astro: Readonly<AstroGlobal>, {
69
69
  const isHomepage = urlPath === '/';
70
70
  const config = getConfig();
71
71
  globalThis.$storefront.settings = config.settings;
72
- let cmsContent: PageContent | null | undefined;
72
+ let cmsContent: PageContent | null = { sections: [] };
73
73
  const apiState: {
74
74
  categories?: CategoriesList,
75
75
  brands?: BrandsList,
@@ -83,9 +83,14 @@ const loadRouteContext = async (Astro: Readonly<AstroGlobal>, {
83
83
  ];
84
84
  let fetchingApiContext: typeof apiPrefetchings[number] = null;
85
85
  const apiContext: {
86
- resource?: 'products' | 'categories' | 'brands' | 'collections',
87
- doc?: Record<string, any>,
88
- error: ApiError | null,
86
+ resource?: 'products' | 'categories' | 'brands' | 'collections';
87
+ doc?: Record<string, any> & {
88
+ _id: ResourceId;
89
+ store_id: number;
90
+ created_at: string;
91
+ updated_at: string;
92
+ };
93
+ error: ApiError | null;
89
94
  } = {
90
95
  error: null,
91
96
  };
@@ -108,6 +113,13 @@ const loadRouteContext = async (Astro: Readonly<AstroGlobal>, {
108
113
  Object.assign(apiContext, response.data);
109
114
  const apiResource = apiContext.resource as
110
115
  Exclude<typeof apiContext.resource, undefined>;
116
+ config.getContent(`pages/${apiResource}`)
117
+ .then((_cmsContent) => {
118
+ if (cmsContent && _cmsContent) {
119
+ Object.assign(cmsContent, _cmsContent);
120
+ }
121
+ })
122
+ .catch(console.warn);
111
123
  const apiDoc = apiContext.doc as Record<string, any>;
112
124
  apiState[`${apiResource}/${apiDoc._id}`] = apiDoc;
113
125
  globalThis.$storefront.apiContext = {
@@ -2,7 +2,7 @@
2
2
  "name": "@cloudcommerce/test-base",
3
3
  "private": true,
4
4
  "type": "module",
5
- "version": "0.26.3",
5
+ "version": "0.26.5",
6
6
  "description": "E-Com Plus Cloud Commerce basic setup for testing",
7
7
  "main": "lib/index.js",
8
8
  "repository": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "to": {
3
- "zip": "35701134"
3
+ "zip": "30140070"
4
4
  },
5
5
  "items": [
6
6
  {
@@ -11,8 +11,8 @@
11
11
  "quantity": 1,
12
12
  "currency_id": "BRL",
13
13
  "currency_symbol": "R$",
14
- "price": 99.75,
15
- "final_price": 99.75,
14
+ "price": 500,
15
+ "final_price": 500,
16
16
  "dimensions": {
17
17
  "width": {
18
18
  "unit": "cm",
@@ -33,5 +33,5 @@
33
33
  }
34
34
  }
35
35
  ],
36
- "subtotal": 99.75
36
+ "subtotal": 500
37
37
  }
@@ -88,7 +88,7 @@
88
88
  }
89
89
  ],
90
90
  "buyer": {
91
- "customer_id": "621781e57963422eee198e7f",
91
+ "customer_id": "5bf556de7f2ea911aecb8f50",
92
92
  "email": "fulanociclano@email.com",
93
93
  "birth_date": {
94
94
  "day": 25,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/types",
3
3
  "type": "module",
4
- "version": "0.26.3",
4
+ "version": "0.26.5",
5
5
  "description": "E-Com Plus Cloud Commerce reusable type definitions",
6
6
  "main": "index.ts",
7
7
  "repository": {
@@ -4,7 +4,5 @@ packages:
4
4
  - 'docs'
5
5
  - 'store'
6
6
  - 'store/functions/*'
7
- - 'ecomplus-stores/iluminim'
8
- - 'ecomplus-stores/iluminim/functions/*'
9
7
  - 'ecomplus-stores/barra-doce'
10
8
  - 'ecomplus-stores/barra-doce/functions/*'
package/turbo.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "test": {
13
13
  "outputs": []
14
14
  },
15
- "test:e2e": {
15
+ "test:apps": {
16
16
  "outputs": []
17
17
  }
18
18
  },
@@ -1 +0,0 @@
1
- import{_ as e,o as c,a as o}from"./_plugin-vue_export-helper.fc5e2f5b.js";const s={},a={class:"w-full h-40 bg-base-300"};function t(r,n){return c(),o("div",a)}const l=e(s,[["render",t]]);export{l as default};
@@ -1 +0,0 @@
1
- import{_,d as p,c as a,o as w,l as A,w as P,q as C,X as k,u as T,a as $,H as N,I,b as f,n as d,A as v,S as R,Y as z,Z as O}from"./_plugin-vue_export-helper.fc5e2f5b.js";import{g as j,i as H}from"./img.d4891d80.js";import{f as q}from"./format-money.86f14860.js";const W=r=>{let s={width:0,height:0},e;return typeof r=="object"&&r!==null?e=r.size:e=r,typeof e=="string"&&e.split("x").forEach((t,o)=>{t=parseFloat(t),isNaN(t)||(s[o===0?"width":"height"]=t)}),s},M=W,Y=p({__name:"Fade",props:{speed:{default:"default"},slide:{},isFloating:{type:Boolean,default:!1},isLeaveTo:{type:Boolean,default:!0},isEnterFrom:{type:Boolean,default:!0}},setup(r,{expose:s}){s();const e=r,t=a(()=>e.speed==="default"?"var(--transition, .2s linear)":`var(--transition-${e.speed}, .4s linear)`),o=a(()=>{switch(e.slide){case"down":return"translate3d(0, -100%, 0)";case"left":return"translate3d(-100%, 0, 0)";case"right":return"translate3d(100%, 0, 0)";case"up":return"translate3d(0, 100%, 0)";default:return"none"}}),i=a(()=>o.value!=="none"?.1:0),u=a(()=>e.isEnterFrom?i.value:1),g=a(()=>e.isLeaveTo?i.value:1),m=a(()=>e.isEnterFrom?o.value:"none"),S=a(()=>e.isLeaveTo?o.value:"none"),l=a(()=>e.slide==="down"||e.slide==="up"),c=a(()=>e.isFloating?null:l.value?0:"auto"),h=a(()=>e.isFloating?null:e.slide&&!l.value?0:"auto"),b=a(()=>e.isEnterFrom?c.value:"auto"),F=a(()=>e.isEnterFrom?h.value:"auto"),L=a(()=>{let n="opacity";return o.value!=="none"&&(n+=", transform"),c.value===0&&(n+=", height"),h.value===0&&(n+=", width"),n}),E={props:e,duration:t,transform:o,opacity:i,enterFromOpacity:u,leaveToOpacity:g,enterFromTransform:m,leaveToTransform:S,isSlideY:l,height:c,width:h,enterFromHeight:b,enterFromWidth:F,willChange:L,setInitialStyles:n=>{n.style.setProperty("--fade-will-change",L.value),n.style.setProperty("--fade-duration",t.value),n.style.setProperty("--fade-enter-opacity",String(u.value)),n.style.setProperty("--fade-enter-transform",String(m.value)),n.style.setProperty("--fade-enter-height",String(b.value)),n.style.setProperty("--fade-enter-width",String(F.value)),n.style.setProperty("--fade-leave-opacity",String(g.value)),n.style.setProperty("--fade-leave-transform",String(S.value))},onEnter:n=>{if(e.slide&&!e.isFloating&&e.isEnterFrom){l.value?(n.style.width=getComputedStyle(n).width,n.style.height="auto"):(n.style.width="auto",n.style.height=getComputedStyle(n).height),n.style.position="absolute",n.style.visibility="hidden";const{width:y,height:B}=getComputedStyle(n);n.style.width=l.value?"":"0",n.style.height=l.value?"0":"",n.style.position="",n.style.visibility="",getComputedStyle(n)[l.value?"height":"width"],requestAnimationFrame(()=>{l.value?n.style.height=B:n.style.width=y})}},onAfterEnter:n=>{e.slide&&!e.isFloating&&e.isEnterFrom&&(n.style[l.value?"height":"width"]="")},onLeave:n=>{if(e.slide&&!e.isFloating&&e.isLeaveTo){l.value?n.style.height=getComputedStyle(n).height:n.style.width=getComputedStyle(n).width;const y=l.value?"height":"width";getComputedStyle(n)[y],requestAnimationFrame(()=>{n.style[y]="0"})}}};return Object.defineProperty(E,"__isScriptSetup",{enumerable:!1,value:!0}),E}});function D(r,s,e,t,o,i){return w(),A(k,{name:"sf-fade",onBeforeEnter:t.setInitialStyles,onEnter:t.onEnter,onBeforeLeave:t.setInitialStyles,onAfterEnter:t.onAfterEnter,onLeave:t.onLeave},{default:P(()=>[C(r.$slots,"default")]),_:3},8,["onBeforeEnter","onEnter","onBeforeLeave","onAfterEnter","onLeave"])}const V=_(Y,[["render",D]]),X=p({__name:"ALink",props:{href:{},target:{}},setup(r,{expose:s}){s();const e=r,t=a(()=>{if(e.href){if(e.target)return e.target;if(e.href.startsWith("http")){const i=globalThis.$storefront.settings.domain||window.location.host;if(e.href.startsWith(`https://${i}`))return}return e.href.charAt(0)==="/"?void 0:"_blank"}}),o={props:e,linkTarget:t};return Object.defineProperty(o,"__isScriptSetup",{enumerable:!1,value:!0}),o}});function Z(r,s,e,t,o,i){return w(),A(T(e.href?"a":"span"),{href:e.href,target:t.linkTarget,rel:t.linkTarget==="_blank"?"noopener":void 0},{default:P(()=>[C(r.$slots,"default")]),_:3},8,["href","target","rel"])}const G=_(X,[["render",Z]]),J=p({__name:"AImg",props:{picture:{},loading:{default:"lazy"},decoding:{},alt:{}},setup(r,{expose:s}){s();const e=r,t=a(()=>e.picture.url?e.picture:j(e.picture)||{}),o=a(()=>M(t.value)),i=a(()=>({src:t.value.url,alt:t.value.alt||e.alt,width:o.value.width||void 0,height:o.value.height||void 0,loading:e.loading,decoding:e.decoding||(o.value.height?"async":void 0)})),u={props:e,image:t,dimensions:o,attrs:i};return Object.defineProperty(u,"__isScriptSetup",{enumerable:!1,value:!0}),u}});function K(r,s,e,t,o,i){return w(),$("img",N(I(t.attrs)),null,16)}const Q=_(J,[["render",K]]),x="bg-gray-200 rounded-md dark:bg-gray-700",U=p({__name:"Skeleton",props:{isBold:{type:Boolean},isLarge:{type:Boolean}},setup(r,{expose:s}){s();const e=r,t=a(()=>`${x} ${e.isBold?"h-8 mb-6":"h-2.5 mb-4"}`),o=a(()=>`${x} ${e.isBold?"h-5 mb-4":"h-2 mb-2.5"}`),i={props:e,rowClassName:x,firstRowClassName:t,nextRowsClassName:o};return Object.defineProperty(i,"__isScriptSetup",{enumerable:!1,value:!0}),i}}),ee=f("span",{class:"sr-only"},"Loading...",-1);function te(r,s,e,t,o,i){return w(),$("div",{role:"status",class:d(["animate-pulse",e.isLarge?"max-w-4xl":"max-w-sm"])},[f("div",{class:d([t.firstRowClassName,e.isLarge?"w-96":"w-48"])},null,2),f("div",{class:d([t.nextRowsClassName,e.isLarge?"max-w-[680px]":"max-w-[340px]"])},null,2),f("div",{class:d(t.nextRowsClassName)},null,2),f("div",{class:d([t.nextRowsClassName,e.isLarge?"max-w-[660px]":"max-w-[330px]"])},null,2),f("div",{class:d([t.nextRowsClassName,e.isLarge?"max-w-[600px]":"max-w-[300px]"])},null,2),f("div",{class:d([t.nextRowsClassName,e.isLarge?"max-w-[720px]":"max-w-[360px]"])},null,2),ee],2)}const ne=_(U,[["render",te]]),re=(r,s=1)=>Number.isInteger(r)?`${r}%`:`${r.toFixed(s)}%`,se=r=>{r.use({install:(s,e)=>{s.config.globalProperties.$t=(t,o)=>H(t,o||e?.lang),s.config.globalProperties.$money=q,s.config.globalProperties.$percentage=re,s.config.globalProperties.$settings=globalThis.$storefront.settings,s.config.globalProperties.$apiContext=globalThis.$storefront.apiContext}}),r.component("Fade",V),r.component("ALink",G),r.component("AImg",Q),r.component("Skeleton",ne)},oe=p({props:{value:String,name:String,hydrate:{type:Boolean,default:!0}},setup({name:r,value:s,hydrate:e}){if(!s)return()=>null;let t=e?"astro-slot":"astro-static-slot";return()=>v(t,{name:r,innerHTML:s})}}),me=r=>async(s,e,t,{client:o})=>{if(delete e.class,!r.hasAttribute("ssr"))return;const i=s.name?`${s.name} Host`:void 0,u={};for(const[c,h]of Object.entries(t))u[c]=()=>v(oe,{value:h,name:c==="default"?void 0:c});let g=v(s,e,u);ae(s.setup)&&(g=v(R,null,g));const m=o!=="only",l=(m?z:O)({name:i,render:()=>g});await se(l),l.mount(r,m),r.addEventListener("astro:unmount",()=>l.unmount(),{once:!0})};function ae(r){const s=r?.constructor;return s&&s.name==="AsyncFunction"}export{me as default};
@@ -1 +0,0 @@
1
- import{_ as v}from"./preload-helper.cf010ec4.js";import"./session-utm.744b0db3.js";function g(d={}){const{immediate:l=!1,onNeedRefresh:m,onOfflineReady:t,onRegistered:r,onRegisteredSW:o,onRegisterError:s}=d;let i,a;const c=async(n=!0)=>{await a};async function f(){if("serviceWorker"in navigator){const{Workbox:n}=await v(()=>import("./workbox-window.prod.es5.a7b12eab.js"),[]);i=new n("/sw.js",{scope:"/",type:"classic"}),i.addEventListener("activated",e=>{(e.isUpdate||e.isExternal)&&window.location.reload()}),i.addEventListener("installed",e=>{e.isUpdate||t?.()}),i.register({immediate:l}).then(e=>{o?o("/sw.js",e):r?.(e)}).catch(e=>{s?.(e)})}}return a=f(),c}g({immediate:!1});
@@ -1,3 +0,0 @@
1
- const onRequest = undefined;
2
-
3
- export { onRequest };