cloudcommerce 0.8.7 → 0.9.1

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 (177) hide show
  1. package/.github/renovate.json +1 -2
  2. package/.vscode/extensions.json +3 -1
  3. package/.vscode/settings.json +5 -1
  4. package/CHANGELOG.md +54 -0
  5. package/ecomplus-stores/monocard/.devcontainer/devcontainer.json +1 -1
  6. package/ecomplus-stores/monocard/.gitpod.yml +3 -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/content/layout.json +37 -0
  12. package/ecomplus-stores/monocard/functions/ssr/package.json +8 -8
  13. package/ecomplus-stores/monocard/functions/ssr/src/components/FeatureTabs.astro +1 -1
  14. package/ecomplus-stores/monocard/functions/ssr/src/components/FeatureTabs.vue +23 -10
  15. package/ecomplus-stores/monocard/functions/ssr/src/components/PitchBar.vue +2 -2
  16. package/ecomplus-stores/monocard/functions/ssr/src/components/ShopHeader.vue +11 -10
  17. package/ecomplus-stores/monocard/functions/ssr/src/components/ShopSidenavCategory.vue +2 -2
  18. package/ecomplus-stores/monocard/functions/ssr/src/layouts/Pages.astro +28 -14
  19. package/ecomplus-stores/monocard/functions/ssr/src/main/Home.astro +3 -3
  20. package/ecomplus-stores/monocard/functions/ssr/src/main/Wildcard.astro +9 -7
  21. package/ecomplus-stores/monocard/functions/ssr/src/pages/[...slug].astro +2 -2
  22. package/ecomplus-stores/monocard/functions/ssr/src/pages/fallback.astro +1 -1
  23. package/ecomplus-stores/monocard/functions/ssr/src/pages/index.astro +2 -2
  24. package/ecomplus-stores/monocard/package.json +1 -1
  25. package/ecomplus-stores/monocard/scripts/install.sh +6 -1
  26. package/ecomplus-stores/tia-sonia/.devcontainer/devcontainer.json +3 -0
  27. package/ecomplus-stores/tia-sonia/.gitpod.yml +3 -0
  28. package/ecomplus-stores/tia-sonia/scripts/install.sh +6 -1
  29. package/package.json +13 -13
  30. package/packages/api/lib/api.d.ts +27 -11
  31. package/packages/api/package.json +1 -1
  32. package/packages/apps/correios/package.json +3 -3
  33. package/packages/apps/custom-payment/package.json +1 -1
  34. package/packages/apps/custom-shipping/package.json +1 -1
  35. package/packages/apps/datafrete/package.json +4 -4
  36. package/packages/apps/discounts/package.json +1 -1
  37. package/packages/apps/emails/lib/functios-lib/abandoned-carts.js +2 -1
  38. package/packages/apps/emails/lib/functios-lib/abandoned-carts.js.map +1 -1
  39. package/packages/apps/emails/package.json +2 -2
  40. package/packages/apps/emails/src/functios-lib/abandoned-carts.ts +2 -1
  41. package/packages/apps/fb-conversions/package.json +3 -3
  42. package/packages/apps/frenet/lib/functions-lib/tracking-codes.js +2 -1
  43. package/packages/apps/frenet/lib/functions-lib/tracking-codes.js.map +1 -1
  44. package/packages/apps/frenet/package.json +4 -4
  45. package/packages/apps/frenet/src/functions-lib/tracking-codes.ts +2 -1
  46. package/packages/apps/galaxpay/lib/functions-lib/ecom/events-to-galaxpay.js +1 -1
  47. package/packages/apps/galaxpay/lib/functions-lib/ecom/events-to-galaxpay.js.map +1 -1
  48. package/packages/apps/galaxpay/lib/functions-lib/galaxpay/webhook.js +101 -37
  49. package/packages/apps/galaxpay/lib/functions-lib/galaxpay/webhook.js.map +1 -1
  50. package/packages/apps/galaxpay/package.json +4 -4
  51. package/packages/apps/galaxpay/src/functions-lib/ecom/events-to-galaxpay.ts +1 -1
  52. package/packages/apps/galaxpay/src/functions-lib/galaxpay/webhook.ts +123 -39
  53. package/packages/apps/google-analytics/package.json +4 -4
  54. package/packages/apps/infinitepay/package.json +4 -4
  55. package/packages/apps/jadlog/package.json +2 -2
  56. package/packages/apps/loyalty-points/package.json +1 -1
  57. package/packages/apps/melhor-envio/lib/functions-lib/tracking-codes.js +1 -1
  58. package/packages/apps/melhor-envio/lib/functions-lib/tracking-codes.js.map +1 -1
  59. package/packages/apps/melhor-envio/package.json +4 -4
  60. package/packages/apps/melhor-envio/src/functions-lib/tracking-codes.ts +1 -1
  61. package/packages/apps/mercadopago/package.json +4 -4
  62. package/packages/apps/pagarme/package.json +4 -4
  63. package/packages/apps/paghiper/package.json +4 -4
  64. package/packages/apps/pix/package.json +4 -4
  65. package/packages/apps/tiny-erp/package.json +4 -4
  66. package/packages/apps/webhooks/package.json +4 -4
  67. package/packages/cli/lib/build.js +2 -0
  68. package/packages/cli/lib/cli.js +2 -2
  69. package/packages/cli/package.json +1 -1
  70. package/packages/cli/src/build.ts +2 -0
  71. package/packages/cli/src/cli.ts +2 -2
  72. package/packages/config/lib/config.js +13 -2
  73. package/packages/config/lib/config.js.map +1 -1
  74. package/packages/config/lib/defaults.d.ts +1 -0
  75. package/packages/config/lib/defaults.js +2 -0
  76. package/packages/config/lib/defaults.js.map +1 -1
  77. package/packages/config/package.json +1 -1
  78. package/packages/config/src/config.ts +13 -1
  79. package/packages/config/src/defaults.ts +2 -0
  80. package/packages/emails/package.json +2 -2
  81. package/packages/events/package.json +3 -3
  82. package/packages/firebase/package.json +4 -4
  83. package/packages/i18n/package.json +1 -1
  84. package/packages/modules/package.json +4 -4
  85. package/packages/passport/package.json +3 -3
  86. package/packages/ssr/package.json +8 -8
  87. package/packages/storefront/client.d.ts +1 -1
  88. package/packages/storefront/config/storefront.cms.cjs +17 -12
  89. package/packages/storefront/config/storefront.cms.mjs +17 -12
  90. package/packages/storefront/dist/client/_astro/Carousel.ef27cf12.js +1 -0
  91. package/packages/storefront/dist/client/_astro/HeroSlider.276b893c.js +1 -0
  92. package/packages/storefront/dist/client/_astro/PitchBar.ff1445b5.js +1 -0
  93. package/packages/storefront/dist/client/_astro/Prices.70885f17.js +1 -0
  94. package/packages/storefront/dist/client/_astro/ShopHeader.89b60037.js +4 -0
  95. package/packages/storefront/dist/client/_astro/_...slug_.9a31c59e.css +1 -0
  96. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.0c2b7f88.js +1 -0
  97. package/packages/storefront/dist/client/_astro/client.4e825332.js +1 -0
  98. package/packages/storefront/dist/client/_astro/{firebase-app.d090c84e.js → firebase-app.2840bd36.js} +111 -111
  99. package/packages/storefront/dist/client/_astro/{format-money.ab6b71eb.js → format-money.f09b89ed.js} +1 -1
  100. package/packages/storefront/dist/client/_astro/{hoisted.541b5c05.js → hoisted.56fa2eff.js} +1 -1
  101. package/packages/storefront/dist/client/_astro/index.1eaf97c3.css +1 -0
  102. package/packages/storefront/dist/client/_astro/index.9018a8da.js +1 -0
  103. package/packages/storefront/dist/client/_astro/{modules-info.06ac0727.js → modules-info.2a72e536.js} +1 -1
  104. package/packages/storefront/dist/client/_astro/runtime-dom.esm-bundler.1fd80976.js +1 -0
  105. package/packages/storefront/dist/client/_astro/session-utm.ac492493.js +1 -0
  106. package/packages/storefront/dist/client/img/uploads/ecom-icon.png +0 -0
  107. package/packages/storefront/dist/client/img/uploads/logo.png +0 -0
  108. package/packages/storefront/dist/client/manifest.webmanifest +1 -1
  109. package/packages/storefront/dist/client/sw.js +1 -1
  110. package/packages/storefront/dist/client/workbox-e0d788d4.js +1 -1
  111. package/packages/storefront/dist/server/chunks/{astro.9781c0a7.mjs → astro.39f7f387.mjs} +910 -295
  112. package/packages/storefront/dist/server/chunks/pages/{all.b355675e.mjs → all.2ca6d33d.mjs} +414 -258
  113. package/packages/storefront/dist/server/entry.mjs +32 -19
  114. package/packages/storefront/dist/server/manifest.webmanifest +1 -1
  115. package/packages/storefront/package.json +16 -16
  116. package/packages/storefront/server.d.ts +1 -1
  117. package/packages/storefront/src/images/use-ssr-picture.ts +30 -10
  118. package/packages/storefront/src/lib/assets/base.css +4 -2
  119. package/packages/storefront/src/lib/cms.d.ts +14 -18
  120. package/packages/storefront/src/lib/components/Carousel.vue +24 -23
  121. package/packages/storefront/src/lib/components/CarouselControl.vue +2 -2
  122. package/packages/storefront/src/lib/components/Drawer.vue +5 -5
  123. package/packages/storefront/src/lib/components/HeroPicture.astro +54 -0
  124. package/packages/storefront/src/lib/components/LoginForm.vue +3 -2
  125. package/packages/storefront/src/lib/components/SocialNetworkLink.vue +2 -2
  126. package/packages/storefront/src/lib/components/_injection-keys.ts +5 -3
  127. package/packages/storefront/src/lib/components/globals/AImg.vue +4 -5
  128. package/packages/storefront/src/lib/components/globals/ALink.vue +2 -2
  129. package/packages/storefront/src/lib/components/globals/Fade.vue +5 -5
  130. package/packages/storefront/src/lib/composables/use-hero-slider.ts +38 -0
  131. package/packages/storefront/src/lib/composables/use-prices.ts +6 -3
  132. package/packages/storefront/src/lib/composables/use-shop-header.ts +30 -14
  133. package/packages/storefront/src/lib/composables/use-sticky-header.ts +15 -12
  134. package/packages/storefront/src/lib/layouts/Base.astro +1 -1
  135. package/packages/storefront/src/lib/layouts/BaseBody.astro +2 -2
  136. package/packages/storefront/src/lib/layouts/BaseHead.astro +2 -2
  137. package/packages/storefront/src/lib/layouts/sections/use-hero-section.ts +48 -0
  138. package/packages/storefront/src/lib/layouts/use-home-main.ts +16 -0
  139. package/packages/storefront/src/lib/layouts/use-page-layout.ts +41 -0
  140. package/packages/storefront/src/lib/pages/_vue.ts +1 -1
  141. package/packages/storefront/src/lib/scripts/modules-info-preset.ts +5 -2
  142. package/packages/storefront/src/lib/scripts/session-utm.ts +6 -1
  143. package/packages/storefront/src/lib/ssr-context.ts +24 -15
  144. package/packages/storefront/src/lib/state/customer-session.ts +14 -2
  145. package/packages/storefront/src/lib/state/shopping-cart/add-cart-item.ts +8 -10
  146. package/packages/storefront/src/lib/state/shopping-cart.ts +4 -3
  147. package/packages/storefront/src/vue-globals.d.ts +3 -2
  148. package/packages/storefront/tailwind.config.cjs +10 -3
  149. package/packages/storefront/tsconfig.json +3 -1
  150. package/packages/storefront/uno.config.cjs +8 -4
  151. package/packages/types/package.json +1 -1
  152. package/ecomplus-stores/monocard/functions/ssr/content/code.json +0 -5
  153. package/ecomplus-stores/monocard/functions/ssr/content/footer.json +0 -46
  154. package/ecomplus-stores/monocard/functions/ssr/content/header.json +0 -23
  155. package/ecomplus-stores/monocard/functions/ssr/content/menu.json +0 -6
  156. package/ecomplus-stores/monocard/functions/ssr/content/metatags.json +0 -5
  157. package/ecomplus-stores/monocard/functions/ssr/src/components/header/HeaderButtonLink.vue +0 -5
  158. package/ecomplus-stores/monocard/functions/ssr/src/components/header/HeaderButtons.vue +0 -39
  159. package/ecomplus-stores/monocard/functions/ssr/src/components/header/HeaderNav.vue +0 -61
  160. package/ecomplus-stores/monocard/functions/ssr/src/components/header/HeaderNavLink.vue +0 -5
  161. package/packages/storefront/dist/client/_astro/PitchBar.5d55c359.js +0 -1
  162. package/packages/storefront/dist/client/_astro/Prices.55399c72.js +0 -1
  163. package/packages/storefront/dist/client/_astro/ProductCard.7e891c08.js +0 -1
  164. package/packages/storefront/dist/client/_astro/ShopHeader.6bbe1a17.js +0 -4
  165. package/packages/storefront/dist/client/_astro/_...slug_.45f0edaf.css +0 -1
  166. package/packages/storefront/dist/client/_astro/_plugin-vue_export-helper.77ed7c18.js +0 -1
  167. package/packages/storefront/dist/client/_astro/client.0de2f274.js +0 -1
  168. package/packages/storefront/dist/client/_astro/index.ff4f0b30.js +0 -1
  169. package/packages/storefront/dist/client/_astro/runtime-dom.esm-bundler.d2f39f33.js +0 -1
  170. package/packages/storefront/dist/client/_astro/session-utm.72684b84.js +0 -1
  171. package/packages/storefront/dist/client/img/uploads/icon.png +0 -0
  172. package/packages/storefront/dist/client/img/uploads/large-icon.png +0 -0
  173. package/packages/storefront/dist/client/img/uploads/logo.webp +0 -0
  174. package/packages/storefront/src/lib/components/ProductCard.vue +0 -36
  175. package/packages/storefront/src/lib/layouts/PagesHeader.astro +0 -51
  176. /package/packages/storefront/dist/client/_astro/{index.0c833781.css → index.e56fc6b3.css} +0 -0
  177. /package/packages/storefront/dist/client/_astro/{server.1bc2fa51.css → server.1dabec03.css} +0 -0
@@ -2,7 +2,7 @@ import { performance } from 'node:perf_hooks';
2
2
  import { ByteLengthQueuingStrategy, CountQueuingStrategy, ReadableByteStreamController, ReadableStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, TransformStream, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter } from 'node:stream/web';
3
3
  import { File, FormData, Headers, Request, Response, fetch } from 'undici';
4
4
  import { setTimeout as setTimeout$1, clearTimeout as clearTimeout$1 } from 'node:timers';
5
- import { N as NodeApp, g as server_default, h as deserializeManifest } from './chunks/astro.9781c0a7.mjs';
5
+ import { N as NodeApp, g as server_default, h as deserializeManifest } from './chunks/astro.39f7f387.mjs';
6
6
  import { Readable } from 'stream';
7
7
  import https from 'https';
8
8
  import path from 'path';
@@ -14,7 +14,7 @@ import enableDestroy from 'server-destroy';
14
14
  import { defineComponent, computed, useSSRContext, mergeProps, h as h$1, createSSRApp } from 'vue';
15
15
  import { ssrRenderSlotInner, ssrRenderAttrs, ssrRenderSlot, renderToString } from 'vue/server-renderer';
16
16
  import { img, imgSizes, i18n, formatMoney } from '@ecomplus/utils';
17
- /* empty css */import { _ as _export_sfc, a as _page0, b as _page1, c as _page2, d as _page3, e as _page4, f as _page5 } from './chunks/pages/all.b355675e.mjs';
17
+ /* empty css */import { _ as _export_sfc, a as _page0, b as _page1, c as _page2, d as _page3, e as _page4, f as _page5 } from './chunks/pages/all.2ca6d33d.mjs';
18
18
  import 'mime';
19
19
  import 'cookie';
20
20
  import 'kleur/colors';
@@ -37,7 +37,7 @@ import '@cloudcommerce/api';
37
37
  import 'node:fs';
38
38
  import '@cloudcommerce/config';
39
39
  /* empty css */import '@vueuse/core';
40
- import '@headlessui/vue';
40
+ /* empty css */import '@headlessui/vue';
41
41
 
42
42
  /** Returns the function bound to the given object. */
43
43
  const __function_bind = Function.bind.bind(Function.call);
@@ -2458,6 +2458,7 @@ function isNodeReadableStream(value) {
2458
2458
  }
2459
2459
  function readerIterator(reader) {
2460
2460
  const iterator = {
2461
+ //@ts-expect-error
2461
2462
  next() {
2462
2463
  return reader.read();
2463
2464
  }
@@ -2639,13 +2640,26 @@ async function writeWebResponse(app, res, webResponse) {
2639
2640
  res.end();
2640
2641
  }
2641
2642
 
2643
+ function parsePathname(pathname, host, port) {
2644
+ try {
2645
+ const urlPathname = new URL(pathname, `http://${host}:${port}`).pathname;
2646
+ return decodeURI(encodeURI(urlPathname));
2647
+ } catch (err) {
2648
+ return void 0;
2649
+ }
2650
+ }
2642
2651
  function createServer({ client, port, host, removeBase }, handler) {
2643
2652
  const listener = (req, res) => {
2644
2653
  if (req.url) {
2645
2654
  let pathname = removeBase(req.url);
2646
2655
  pathname = pathname[0] === "/" ? pathname : "/" + pathname;
2647
- pathname = new URL(pathname, `http://${host}:${port}`).pathname;
2648
- const stream = send(req, encodeURI(decodeURI(pathname)), {
2656
+ const encodedURI = parsePathname(pathname, host, port);
2657
+ if (!encodedURI) {
2658
+ res.writeHead(400);
2659
+ res.end("Bad request.");
2660
+ return res;
2661
+ }
2662
+ const stream = send(req, encodedURI, {
2649
2663
  root: fileURLToPath(client),
2650
2664
  dotfiles: pathname.startsWith("/.well-known/") ? "allow" : "deny"
2651
2665
  });
@@ -2867,10 +2881,10 @@ const _sfc_main$2 = defineComponent({
2867
2881
  el.style.position = "absolute";
2868
2882
  el.style.visibility = "hidden";
2869
2883
  const { width: width2, height: height2 } = getComputedStyle(el);
2870
- el.style.width = isSlideY.value ? null : "0";
2871
- el.style.height = isSlideY.value ? "0" : null;
2872
- el.style.position = null;
2873
- el.style.visibility = null;
2884
+ el.style.width = isSlideY.value ? "" : "0";
2885
+ el.style.height = isSlideY.value ? "0" : "";
2886
+ el.style.position = "";
2887
+ el.style.visibility = "";
2874
2888
  getComputedStyle(el)[isSlideY.value ? "height" : "width"];
2875
2889
  requestAnimationFrame(() => {
2876
2890
  if (isSlideY.value) {
@@ -2883,7 +2897,7 @@ const _sfc_main$2 = defineComponent({
2883
2897
  };
2884
2898
  const onAfterEnter = (el) => {
2885
2899
  if (props.slide && !props.isFloating && props.isEnterFrom) {
2886
- el.style[isSlideY.value ? "height" : "width"] = null;
2900
+ el.style[isSlideY.value ? "height" : "width"] = "";
2887
2901
  }
2888
2902
  };
2889
2903
  const onLeave = (el) => {
@@ -2931,7 +2945,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
2931
2945
  if (props.href.startsWith("http")) {
2932
2946
  const domain = globalThis.storefront.settings.domain || window.location.host;
2933
2947
  if (props.href.startsWith(`https://${domain}`))
2934
- return null;
2948
+ return void 0;
2935
2949
  }
2936
2950
  return "_blank";
2937
2951
  });
@@ -2944,7 +2958,7 @@ function _sfc_ssrRender$1(_ctx, _push, _parent, _attrs, $props, $setup, $data, $
2944
2958
  _push(`<a${ssrRenderAttrs(mergeProps({
2945
2959
  href: $props.href,
2946
2960
  target: $setup.linkTarget,
2947
- rel: $setup.linkTarget === "_blank" ? "noopener" : null
2961
+ rel: $setup.linkTarget === "_blank" ? "noopener" : void 0
2948
2962
  }, _attrs))}>`);
2949
2963
  ssrRenderSlot(_ctx.$slots, "default", {}, null, _push, _parent);
2950
2964
  _push(`</a>`);
@@ -2977,13 +2991,12 @@ const _sfc_main = defineComponent({
2977
2991
  return imgSizes(image.value);
2978
2992
  });
2979
2993
  const attrs = computed(() => ({
2980
- ...props,
2981
2994
  src: image.value.url,
2982
2995
  alt: image.value.alt,
2983
- width: dimensions.value.width || null,
2984
- height: dimensions.value.height || null,
2985
- decoding: props.decoding || (dimensions.value.height ? "async" : null),
2986
- picture: null
2996
+ width: dimensions.value.width || void 0,
2997
+ height: dimensions.value.height || void 0,
2998
+ loading: props.loading,
2999
+ decoding: props.decoding || (dimensions.value.height ? "async" : void 0)
2987
3000
  }));
2988
3001
  const __returned__ = { props, image, dimensions, attrs };
2989
3002
  Object.defineProperty(__returned__, "__isScriptSetup", { enumerable: false, value: true });
@@ -3059,10 +3072,10 @@ const _renderer1 = {
3059
3072
  renderToStaticMarkup,
3060
3073
  };
3061
3074
 
3062
- const pageMap = new Map([["../../node_modules/.pnpm/@astrojs+image@0.16.0_astro@2.1.2+sharp@0.31.3/node_modules/@astrojs/image/dist/endpoint.js", _page0],["src/pages/index.astro", _page1],["src/pages/fallback.astro", _page2],["src/pages/app/index.astro", _page3],["src/pages/app/account.astro", _page4],["src/pages/[...slug].astro", _page5],]);
3075
+ const pageMap = new Map([["../../node_modules/.pnpm/@astrojs+image@0.16.6_astro@2.3.0_sharp@0.31.3/node_modules/@astrojs/image/dist/endpoint.js", _page0],["src/pages/index.astro", _page1],["src/pages/fallback.astro", _page2],["src/pages/app/index.astro", _page3],["src/pages/app/account.astro", _page4],["src/pages/[...slug].astro", _page5],]);
3063
3076
  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 }),];
3064
3077
 
3065
- const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.16.0_astro@2.1.2+sharp@0.31.3/node_modules/@astrojs/image/dist/endpoint.js","pathname":"/_image","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.45f0edaf.css","_astro/index.0c833781.css"],"scripts":[{"type":"external","value":"_astro/hoisted.541b5c05.js"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.45f0edaf.css"],"scripts":[{"type":"external","value":"_astro/hoisted.541b5c05.js"}],"routeData":{"route":"/fallback","type":"page","pattern":"^\\/fallback\\/?$","segments":[[{"content":"fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/fallback.astro","pathname":"/fallback","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"routeData":{"route":"/app","type":"page","pattern":"^\\/app\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/index.astro","pathname":"/app","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"routeData":{"route":"/app/account","type":"page","pattern":"^\\/app\\/account\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}],[{"content":"account","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/account.astro","pathname":"/app/account","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.45f0edaf.css"],"scripts":[{"type":"external","value":"_astro/hoisted.541b5c05.js"}],"routeData":{"route":"/[...slug]","type":"page","pattern":"^(?:\\/(.*?))?\\/?$","segments":[[{"content":"...slug","dynamic":true,"spread":true}]],"params":["...slug"],"component":"src/pages/[...slug].astro","prerender":false,"_meta":{"trailingSlash":"ignore"}}}],"site":"https://ecom2-002.web.app","base":"/","markdown":{"drafts":false,"syntaxHighlight":"shiki","shikiConfig":{"langs":[],"theme":"github-dark","wrap":false},"remarkPlugins":[],"rehypePlugins":[],"remarkRehype":{},"gfm":true,"smartypants":true},"pageMap":null,"propagation":[],"renderers":[],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"_@astrojs-ssr-virtual-entry.mjs","@@sf/components/ProductCard.vue":"_astro/ProductCard.7e891c08.js","~/components/Prices.vue":"_astro/Prices.55399c72.js","~/components/PitchBar.vue":"_astro/PitchBar.5d55c359.js","@astrojs/vue/client.js":"_astro/client.0de2f274.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/workbox-window/build/workbox-window.prod.es5.mjs":"_astro/workbox-window.prod.es5.dc90f814.js","/astro/hoisted.js?q=0":"_astro/hoisted.541b5c05.js","~/components/ShopHeader.vue":"_astro/ShopHeader.6bbe1a17.js","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/scripts/firebase-app.ts":"_astro/firebase-app.d090c84e.js","astro:scripts/before-hydration.js":""},"assets":["/_astro/index.0c833781.css","/_astro/server.1bc2fa51.css","/_astro/_...slug_.45f0edaf.css","/manifest.webmanifest","/robots.txt","/sw.js","/workbox-e0d788d4.js","/_astro/PitchBar.5d55c359.js","/_astro/Prices.55399c72.js","/_astro/ProductCard.7e891c08.js","/_astro/ShopHeader.6bbe1a17.js","/_astro/_plugin-vue_export-helper.77ed7c18.js","/_astro/client.0de2f274.js","/_astro/firebase-app.d090c84e.js","/_astro/format-money.ab6b71eb.js","/_astro/hoisted.541b5c05.js","/_astro/idle-callback.889bf0ea.js","/_astro/index.ff4f0b30.js","/_astro/modules-info.06ac0727.js","/_astro/preload-helper.101896b7.js","/_astro/runtime-dom.esm-bundler.d2f39f33.js","/_astro/session-utm.72684b84.js","/_astro/workbox-window.prod.es5.dc90f814.js","/admin/config.json","/assets/cms-preview.css","/assets/cms.css","/assets/cvv.png","/assets/img-placeholder.png","/assets/payments.png","/assets/ssl-safe.png","/img/icon.png","/img/large-icon.png","/img/uploads/banner1.png","/img/uploads/banner2.png","/img/uploads/banner2.webp","/img/uploads/favicon.png","/img/uploads/headless.png","/img/uploads/headphone.png","/img/uploads/headphone.webp","/img/uploads/icon.png","/img/uploads/large-icon.png","/img/uploads/logo.png","/img/uploads/logo.webp","/img/uploads/og-image.png","/img/uploads/passion.png","/img/uploads/passion.webp","/img/uploads/pwa-reliable.png","/img/uploads/rect8589.png","/img/uploads/rect859.png","/img/uploads/rect89.png","/img/uploads/rect89.webp","/img/uploads/ssl-safe.png"]}), {
3078
+ const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"","links":[],"scripts":[],"routeData":{"type":"endpoint","route":"/_image","pattern":"^\\/_image$","segments":[[{"content":"_image","dynamic":false,"spread":false}]],"params":[],"component":"../../node_modules/.pnpm/@astrojs+image@0.16.6_astro@2.3.0_sharp@0.31.3/node_modules/@astrojs/image/dist/endpoint.js","pathname":"/_image","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["/_astro/_...slug_.9a31c59e.css","/_astro/index.e56fc6b3.css","/_astro/index.1eaf97c3.css"],"scripts":[{"type":"external","value":"/_astro/hoisted.56fa2eff.js"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["/_astro/_...slug_.9a31c59e.css","/_astro/index.1eaf97c3.css"],"scripts":[{"type":"external","value":"/_astro/hoisted.56fa2eff.js"}],"routeData":{"route":"/fallback","type":"page","pattern":"^\\/fallback\\/?$","segments":[[{"content":"fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/fallback.astro","pathname":"/fallback","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"routeData":{"route":"/app","type":"page","pattern":"^\\/app\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/index.astro","pathname":"/app","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":[],"scripts":[],"routeData":{"route":"/app/account","type":"page","pattern":"^\\/app\\/account\\/?$","segments":[[{"content":"app","dynamic":false,"spread":false}],[{"content":"account","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/app/account.astro","pathname":"/app/account","prerender":false,"_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["/_astro/_...slug_.9a31c59e.css","/_astro/index.1eaf97c3.css"],"scripts":[{"type":"external","value":"/_astro/hoisted.56fa2eff.js"}],"routeData":{"route":"/[...slug]","type":"page","pattern":"^(?:\\/(.*?))?\\/?$","segments":[[{"content":"...slug","dynamic":true,"spread":true}]],"params":["...slug"],"component":"src/pages/[...slug].astro","prerender":false,"_meta":{"trailingSlash":"ignore"}}}],"site":"https://ecom2-002.web.app","base":"/","markdown":{"drafts":false,"syntaxHighlight":"shiki","shikiConfig":{"langs":[],"theme":"github-dark","wrap":false},"remarkPlugins":[],"rehypePlugins":[],"remarkRehype":{},"gfm":true,"smartypants":true},"pageMap":null,"componentMetadata":[["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/[...slug].astro",{"propagation":"none","containsHead":true}],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/fallback.astro",{"propagation":"none","containsHead":true}],["/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/pages/index.astro",{"propagation":"none","containsHead":true}]],"renderers":[],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"_@astrojs-ssr-virtual-entry.mjs","~/components/PitchBar.vue":"_astro/PitchBar.ff1445b5.js","~/components/HeroSlider.vue":"_astro/HeroSlider.276b893c.js","@astrojs/vue/client.js":"_astro/client.4e825332.js","~/components/Prices.vue":"_astro/Prices.70885f17.js","/astro/hoisted.js?q=0":"_astro/hoisted.56fa2eff.js","~/components/ShopHeader.vue":"_astro/ShopHeader.89b60037.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/workbox-window/build/workbox-window.prod.es5.mjs":"_astro/workbox-window.prod.es5.dc90f814.js","/home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/lib/scripts/firebase-app.ts":"_astro/firebase-app.2840bd36.js","astro:scripts/before-hydration.js":""},"assets":["/_astro/index.e56fc6b3.css","/_astro/server.1dabec03.css","/_astro/index.1eaf97c3.css","/_astro/_...slug_.9a31c59e.css","/manifest.webmanifest","/robots.txt","/sw.js","/workbox-e0d788d4.js","/_astro/Carousel.ef27cf12.js","/_astro/HeroSlider.276b893c.js","/_astro/PitchBar.ff1445b5.js","/_astro/Prices.70885f17.js","/_astro/ShopHeader.89b60037.js","/_astro/_plugin-vue_export-helper.0c2b7f88.js","/_astro/client.4e825332.js","/_astro/firebase-app.2840bd36.js","/_astro/format-money.f09b89ed.js","/_astro/hoisted.56fa2eff.js","/_astro/idle-callback.889bf0ea.js","/_astro/index.9018a8da.js","/_astro/modules-info.2a72e536.js","/_astro/preload-helper.101896b7.js","/_astro/runtime-dom.esm-bundler.1fd80976.js","/_astro/session-utm.ac492493.js","/_astro/workbox-window.prod.es5.dc90f814.js","/admin/config.json","/assets/cms-preview.css","/assets/cms.css","/assets/cvv.png","/assets/img-placeholder.png","/assets/payments.png","/assets/ssl-safe.png","/img/icon.png","/img/large-icon.png","/img/uploads/banner1.png","/img/uploads/banner2.png","/img/uploads/banner2.webp","/img/uploads/ecom-icon.png","/img/uploads/favicon.png","/img/uploads/headless.png","/img/uploads/headphone.png","/img/uploads/headphone.webp","/img/uploads/logo.png","/img/uploads/og-image.png","/img/uploads/passion.png","/img/uploads/passion.webp","/img/uploads/pwa-reliable.png","/img/uploads/rect8589.png","/img/uploads/rect859.png","/img/uploads/rect89.png","/img/uploads/rect89.webp","/img/uploads/ssl-safe.png"]}), {
3066
3079
  pageMap: pageMap,
3067
3080
  renderers: renderers
3068
3081
  });
@@ -1 +1 @@
1
- {"name":"My Shop","short_name":"My Shop","start_url":"/","display":"standalone","background_color":"#f5f6fa","lang":"en","scope":"/","description":"My PWA Shop","theme_color":"#137c5c","crossorigin":"use-credentials","icons":[{"src":"/_image?f=png&w=192&h=192&href=%2Fimg%2Fuploads%2Flarge-icon.png&V=_","sizes":"192x192","type":"image/png"},{"src":"/_image?f=png&w=512&h=512&href=%2Fimg%2Fuploads%2Flarge-icon.png&V=_","sizes":"512x512","type":"image/png"},{"src":"/img/uploads/large-icon.png","sizes":"512x512","type":"image/png","purpose":"any maskable"}]}
1
+ {"name":"My Shop","short_name":"My Shop","start_url":"/","display":"standalone","background_color":"#f5f6fa","lang":"en","scope":"/","description":"My PWA Shop","theme_color":"#37003c","crossorigin":"use-credentials","icons":[{"src":"/_image?f=png&w=192&h=192&href=%2Fimg%2Fuploads%2Fecom-icon.png&V=_","sizes":"192x192","type":"image/png"},{"src":"/_image?f=png&w=512&h=512&href=%2Fimg%2Fuploads%2Fecom-icon.png&V=_","sizes":"512x512","type":"image/png"},{"src":"/img/uploads/ecom-icon.png","sizes":"512x512","type":"image/png","purpose":"any maskable"}]}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/storefront",
3
3
  "type": "module",
4
- "version": "0.8.7",
4
+ "version": "0.9.1",
5
5
  "description": "E-Com Plus Cloud Commerce storefront with Astro",
6
6
  "bin": {
7
7
  "storefront": "./scripts/build-prod.sh"
@@ -29,36 +29,36 @@
29
29
  "prepare-monorepo": "bash scripts/prepare-monorepo.sh"
30
30
  },
31
31
  "dependencies": {
32
- "@astrojs/image": "0.16.0",
33
- "@astrojs/node": "5.1.0",
34
- "@astrojs/vue": "2.1.0",
32
+ "@astrojs/image": "0.16.6",
33
+ "@astrojs/node": "5.1.1",
34
+ "@astrojs/vue": "2.1.1",
35
35
  "@cloudcommerce/api": "workspace:*",
36
36
  "@cloudcommerce/config": "workspace:*",
37
37
  "@cloudcommerce/i18n": "workspace:*",
38
38
  "@ecomplus/utils": "1.5.0-rc.3",
39
39
  "@fastify/deepmerge": "^1.3.0",
40
- "@headlessui/vue": "^1.7.12",
41
- "@iconify-json/fa6-brands": "^1.1.10",
40
+ "@headlessui/vue": "^1.7.13",
41
+ "@iconify-json/fa6-brands": "^1.1.11",
42
42
  "@iconify-json/heroicons": "^1.1.10",
43
- "@iconify-json/logos": "^1.1.23",
43
+ "@iconify-json/logos": "^1.1.25",
44
44
  "@vite-pwa/astro": "^0.0.5",
45
- "@vueuse/core": "9.12.0",
46
- "astro": "2.1.2",
45
+ "@vueuse/core": "10.0.2",
46
+ "astro": "2.3.0",
47
47
  "chroma-js": "^2.4.2",
48
48
  "dotenv": "^16.0.3",
49
- "firebase": "^9.18.0",
49
+ "firebase": "^9.20.0",
50
50
  "image-size": "^1.0.2",
51
51
  "mime": "^3.0.0",
52
- "semver": "^7.3.8",
52
+ "semver": "^7.5.0",
53
53
  "sharp": "^0.31.3",
54
- "tailwindcss": "^3.2.7",
55
- "unocss": "^0.50.6",
56
- "vite": "^4.2.1",
57
- "vite-plugin-pwa": "^0.14.5",
54
+ "tailwindcss": "^3.3.1",
55
+ "unocss": "^0.51.5",
56
+ "vite": "^4.2.2",
57
+ "vite-plugin-pwa": "^0.14.7",
58
58
  "vue": "^3.2.47"
59
59
  },
60
60
  "devDependencies": {
61
- "@babel/core": "^7.21.3",
61
+ "@babel/core": "^7.21.4",
62
62
  "@cloudcommerce/types": "workspace:*"
63
63
  }
64
64
  }
@@ -31,7 +31,7 @@ declare global {
31
31
  onLoad: (callback: (...args: any[]) => void) => void,
32
32
  };
33
33
  // eslint-disable-next-line
34
- var api_prefetch_endpoints: undefined | ApiEndpoint[];
34
+ var api_prefetch_endpoints: ApiEndpoint[];
35
35
  // eslint-disable-next-line
36
36
  var storefront_slim_doc_regex: undefined | RegExp;
37
37
  }
@@ -67,26 +67,46 @@ const useSSRPicture = async (params: UsePictureParams) => {
67
67
  let sizes: string = propSizes || '';
68
68
  if (!sizes && attrs.class) {
69
69
  const classNames = attrs.class.split(' ');
70
- const classRegex = /^(\w+:)?max-w-\[(\w+)\]$/;
71
70
  let nextSize: string;
71
+ const breakpoints = {
72
+ sm: 640,
73
+ md: 768,
74
+ lg: 1024,
75
+ xl: 1280,
76
+ '2xl': 1536,
77
+ };
72
78
  [
73
79
  [''],
74
- ['sm', 640],
75
- ['md', 768],
76
- ['lg', 1024],
77
- ['xl', 1280],
78
- ['2xl', 1536],
80
+ ...Object.entries(breakpoints),
79
81
  ].forEach(([breakpoint, minWidth]: [string, number | undefined]) => {
80
- const className = classNames.find((_class) => {
81
- return _class.startsWith(breakpoint ? `${breakpoint}:max-w-[` : 'max-w-[');
82
+ const classRegex = breakpoint
83
+ ? new RegExp(`^${breakpoint}:max-w-(\\[\\w+\\]|screen-\\w+)$`)
84
+ : /^max-w-(\[\w+\]|screen-\w+)$/;
85
+ let classMaxW: string | undefined;
86
+ classNames.find((_class) => {
87
+ const maxW = _class.replace(classRegex, '$1');
88
+ if (maxW !== _class) {
89
+ classMaxW = maxW;
90
+ return true;
91
+ }
92
+ return false;
82
93
  });
83
- if (className) {
94
+ if (classMaxW) {
84
95
  if (nextSize) {
85
96
  // max-w-50px sm:max-w-[... => (max-width: 639px) 50px...
86
97
  if (sizes) sizes += ', ';
87
98
  sizes += `(max-width: ${(minWidth - 1)}px) ${nextSize}`;
88
99
  }
89
- nextSize = className.replace(classRegex, '$2');
100
+ if (classMaxW.charAt(0) === '[') {
101
+ // [100px] => 100px
102
+ nextSize = classMaxW.slice(1, classMaxW.length - 1);
103
+ } else {
104
+ // screen-2xl => 1536px
105
+ const screenSize = breakpoints[classMaxW.slice(7)];
106
+ if (screenSize) {
107
+ nextSize = `${screenSize}px`;
108
+ }
109
+ }
90
110
  }
91
111
  });
92
112
  if (nextSize) {
@@ -11,8 +11,10 @@
11
11
  --transition: .15s ease-in-out;
12
12
  --transition-slow: .25s ease-in-out;
13
13
  --transition-slower: .45s ease-in-out;
14
- --c-on-dark: rgb(255, 255, 255);
15
- --c-on-light: rgb(0, 0, 0);
14
+ --rgb-on-dark: 255, 255, 255;
15
+ --c-on-dark: rgb(var(--rgb-on-dark));
16
+ --rgb-on-light: 0, 0, 0;
17
+ --c-on-light: rgb(var(--rgb-on-light));
16
18
  --c-background: #fff;
17
19
  --c-on-background: theme('colors.base.800');
18
20
  --un-prose-body: theme('colors.base.700');
@@ -1,25 +1,21 @@
1
1
  import type { CmsSettings as _CmsSettings } from '@cloudcommerce/types';
2
2
 
3
- type CmsSettings = _CmsSettings &
3
+ export type CmsSettings = _CmsSettings &
4
4
  Omit<typeof import('content/settings.json'), keyof _CmsSettings>;
5
- type CmsCode = typeof import('content/code.json');
6
- type CmsMetatags = typeof import('content/metatags.json');
7
- type CmsHeader = typeof import('content/header.json');
8
5
 
9
- type CMS = <T extends string>(filename: T) =>
6
+ export type CmsLayout = typeof import('content/layout.json');
7
+
8
+ export type CmsHome = typeof import('content/home.json');
9
+
10
+ export type ContentFilenames = 'settings'
11
+ | 'layout'
12
+ | 'home'
13
+ | `${string}/`
14
+ | `${string}/${string}`;
15
+
16
+ export type CMS = <T extends ContentFilenames>(filename: T) =>
10
17
  T extends `${string}/` ? Promise<Array<string>> :
11
18
  T extends 'settings' ? CmsSettings :
12
- T extends 'code' ? Promise<CmsCode | null> :
13
- T extends 'metatags' ? Promise<CmsMetatags | null> :
14
- T extends 'header' ? Promise<CmsHeader | null> :
19
+ T extends 'layout' ? Promise<CmsLayout> :
20
+ T extends 'home' ? Promise<CmsHome> :
15
21
  Promise<Record<string, any> | null>;
16
-
17
- export default CMS;
18
-
19
- export type {
20
- CMS,
21
- CmsSettings,
22
- CmsCode,
23
- CmsMetatags,
24
- CmsHeader,
25
- };
@@ -36,28 +36,39 @@ watch(currentIndex, (current, previous) => {
36
36
  emit('update:modelValue', current + 1);
37
37
  }
38
38
  });
39
- const wrapper = ref<HTMLElement>(null);
39
+ const wrapper = ref<HTMLElement | null>(null);
40
40
  const { x: currentPos, isScrolling, arrivedState } = useScroll(wrapper);
41
41
  const isBoundLeft = computed(() => arrivedState.left);
42
42
  const isBoundRight = computed(() => arrivedState.right);
43
- const slidesWidth = ref([]);
43
+ const slidesWidth = ref<{ offsetLeft: number; width: number; }[]>([]);
44
44
  const wrapperScrollWidth = ref(0);
45
45
  const wrapperVisibleWidth = ref(0);
46
46
  const indexCount = ref(0);
47
47
  const calcWrapperWidth = () => {
48
+ if (!wrapper.value) return;
48
49
  wrapperScrollWidth.value = wrapper.value.scrollWidth;
49
50
  wrapperVisibleWidth.value = wrapper.value.offsetWidth;
50
51
  };
51
52
  const calcSlidesWidth = () => {
52
- const childNodes = [...wrapper.value.children];
53
- slidesWidth.value = childNodes.map((node: HTMLElement) => ({
53
+ if (!wrapper.value) return;
54
+ let childNodes = [...wrapper.value.children] as HTMLElement[];
55
+ if (childNodes.length === 1 && childNodes[0].tagName.endsWith('SLOT')) {
56
+ childNodes = [...childNodes[0].children] as HTMLElement[];
57
+ }
58
+ slidesWidth.value = childNodes.map((node) => ({
54
59
  offsetLeft: node.offsetLeft,
55
60
  width: node.offsetWidth,
56
61
  }));
57
62
  };
58
- const calcNextWidth = (direction) => {
59
- const nextSlideIndex = direction > 0
60
- ? currentIndex.value : currentIndex.value + direction;
63
+ const calcNextWidth = (direction: number) => {
64
+ let nextSlideIndex = currentIndex.value + direction;
65
+ if (nextSlideIndex >= slidesWidth.value.length) {
66
+ nextSlideIndex = 0;
67
+ direction = -direction;
68
+ } else if (nextSlideIndex < 0) {
69
+ nextSlideIndex = slidesWidth.value.length - 1;
70
+ direction = -direction;
71
+ }
61
72
  const width = slidesWidth.value[nextSlideIndex]?.width || 0;
62
73
  if (!width) {
63
74
  return 0;
@@ -65,7 +76,7 @@ const calcNextWidth = (direction) => {
65
76
  return width * direction;
66
77
  };
67
78
  const calcCurrentIndex = () => {
68
- const getCurrentIndex = slidesWidth.value.findIndex((slide: HTMLElement) => {
79
+ const getCurrentIndex = slidesWidth.value.findIndex((slide) => {
69
80
  // Find the closest point, with 5px approximate.
70
81
  return Math.abs(slide.offsetLeft - currentPos.value) <= 5;
71
82
  });
@@ -78,7 +89,7 @@ const calcIndexCount = () => {
78
89
  indexCount.value = slidesWidth.value
79
90
  .findIndex(({ offsetLeft }) => (offsetLeft >= maxPos - 5));
80
91
  };
81
- let autoplayTimer = null;
92
+ let autoplayTimer: ReturnType<typeof setTimeout> | undefined;
82
93
  const restartAutoplay = () => {
83
94
  if (props.autoplay) {
84
95
  clearTimeout(autoplayTimer);
@@ -89,21 +100,9 @@ const restartAutoplay = () => {
89
100
  }
90
101
  };
91
102
  const changeSlide = (direction: number) => {
92
- if (direction < 0) {
93
- if (isBoundLeft.value) {
94
- calcIndexCount();
95
- currentIndex.value = indexCount.value - 1;
96
- changeSlide(1);
97
- return;
98
- }
99
- } else if (isBoundRight.value) {
100
- currentIndex.value = 1;
101
- changeSlide(-1);
102
- return;
103
- }
104
103
  const nextSlideWidth = calcNextWidth(direction);
105
104
  if (nextSlideWidth) {
106
- wrapper.value.scrollBy({ left: nextSlideWidth, behavior: 'smooth' });
105
+ wrapper.value?.scrollBy({ left: nextSlideWidth, behavior: 'smooth' });
107
106
  restartAutoplay();
108
107
  }
109
108
  };
@@ -134,6 +133,7 @@ const calcOnInit = () => {
134
133
  calcIndexCount();
135
134
  };
136
135
  const onResize = useDebounceFn(() => {
136
+ if (!wrapper.value) return;
137
137
  wrapper.value.scrollLeft = 0;
138
138
  calcOnInit();
139
139
  }, 400);
@@ -141,7 +141,8 @@ onMounted(() => {
141
141
  calcOnInit();
142
142
  if (!import.meta.env.SSR) {
143
143
  nextTick(() => {
144
- [...wrapper.value.children].forEach((slide: HTMLElement) => {
144
+ if (!wrapper.value) return;
145
+ [...wrapper.value.children].forEach((slide) => {
145
146
  slide.setAttribute('tabindex', '0');
146
147
  });
147
148
  });
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { inject } from 'vue';
3
- import { carouselKey } from './_injection-keys';
3
+ import { type CarouselInject, carouselKey } from './_injection-keys';
4
4
 
5
5
  export interface Props {
6
6
  direction?: number;
@@ -9,7 +9,7 @@ export interface Props {
9
9
  withDefaults(defineProps<Props>(), {
10
10
  direction: 1,
11
11
  });
12
- const { changeSlide } = inject(carouselKey);
12
+ const { changeSlide } = inject(carouselKey) as CarouselInject;
13
13
  </script>
14
14
 
15
15
  <template>
@@ -23,9 +23,9 @@ const emit = defineEmits([
23
23
  'update:modelValue',
24
24
  ]);
25
25
  const close = () => emit('update:modelValue', false);
26
- const drawer = ref(null);
26
+ const drawer = ref<HTMLElement | null>(null);
27
27
  const outsideClickListener = (ev: MouseEvent) => {
28
- if (!drawer.value?.contains(ev.target)) {
28
+ if (!drawer.value?.contains(ev.target as Node)) {
29
29
  close();
30
30
  }
31
31
  };
@@ -45,8 +45,8 @@ watch(toRef(props, 'modelValue'), async (isOpen) => {
45
45
  document.addEventListener('keydown', escClickListener, { passive: true });
46
46
  }, 500);
47
47
  } else {
48
- document.body.style.overflow = null;
49
- document.body.style.paddingRight = null;
48
+ document.body.style.overflow = '';
49
+ document.body.style.paddingRight = '';
50
50
  document.removeEventListener('click', outsideClickListener);
51
51
  document.removeEventListener('keydown', escClickListener);
52
52
  }
@@ -79,7 +79,7 @@ const isPlacementX = computed(() => {
79
79
  isPlacementX ? 'max-w-sm' : null,
80
80
  ]"
81
81
  :style="{
82
- maxWidth: !isPlacementX ? `calc(100vw - ${scrollbarWidth}px)` : null,
82
+ maxWidth: !isPlacementX ? `calc(100vw - ${scrollbarWidth}px)` : undefined,
83
83
  }"
84
84
  :open="modelValue"
85
85
  :data-drawer="placement"
@@ -0,0 +1,54 @@
1
+ ---
2
+ import type { HeroSliderProps } from '@@sf/layouts/sections/use-hero-section';
3
+ import Picture from '@@sf/components/Picture.astro';
4
+
5
+ export type Props = HeroSliderProps['slides'][0] & {
6
+ index: number;
7
+ widths?: number[];
8
+ mobileWidths?: number[];
9
+ };
10
+
11
+ const {
12
+ img,
13
+ alt,
14
+ mobileImg,
15
+ title,
16
+ subtitle,
17
+ buttonText,
18
+ index,
19
+ } = Astro.props as Props;
20
+ const hasHeader = title || subtitle || buttonText;
21
+ let { widths, mobileWidths }= Astro.props;
22
+ if (!widths?.length) {
23
+ if (mobileImg) {
24
+ widths = [1536, 2048];
25
+ } else {
26
+ widths = [856, 1536, 2048];
27
+ if (hasHeader) {
28
+ widths = widths.map((w) => (w / 2));
29
+ }
30
+ }
31
+ }
32
+ if (!mobileWidths?.length) {
33
+ mobileWidths = [720, 856];
34
+ }
35
+ ---
36
+
37
+ <Picture
38
+ src={img}
39
+ alt={alt || ''}
40
+ widths={widths}
41
+ fetchpriority={index === 0 ? 'high' : 'low'}
42
+ loading={index === 0 ? 'eager' : 'lazy'}
43
+ class={`${(mobileImg ? 'hidden md:block' : '')} max-w-screen-2xl mx-auto`}
44
+ />
45
+ {mobileImg &&
46
+ <Picture
47
+ src={mobileImg}
48
+ alt={alt || ''}
49
+ widths={mobileWidths}
50
+ fetchpriority={index === 0 ? 'high' : 'low'}
51
+ loading={index === 0 ? 'eager' : 'lazy'}
52
+ class="md:hidden max-w-screen-sm mx-auto"
53
+ />
54
+ }
@@ -33,7 +33,7 @@ watch(isLogged, (_isLogged) => {
33
33
  immediate: true,
34
34
  });
35
35
  watch(email, (_email) => {
36
- emit('set:email', _email);
36
+ emit('set:email', _email as string);
37
37
  }, {
38
38
  immediate: true,
39
39
  });
@@ -47,6 +47,7 @@ watch(isSignUp, (_isSignUp) => {
47
47
  const password = ref('');
48
48
  const submitLogin = async () => {
49
49
  const firebaseAuth = getAuth();
50
+ if (!email.value) return;
50
51
  window.localStorage.setItem('emailForSignIn', email.value);
51
52
  try {
52
53
  if (isLinkSignIn.value) {
@@ -59,7 +60,7 @@ const submitLogin = async () => {
59
60
  } else {
60
61
  await signInWithEmailAndPassword(firebaseAuth, email.value, password.value);
61
62
  }
62
- } catch (error) {
63
+ } catch (error: any) {
63
64
  console.warn(error.code);
64
65
  console.error(error);
65
66
  }
@@ -12,8 +12,8 @@ export interface Props {
12
12
  }
13
13
 
14
14
  const props = defineProps<Props>();
15
- const fixedHref = computed(() => {
16
- let href = props.href || socialNetworks[props.network];
15
+ const fixedHref = computed<string>(() => {
16
+ let href = props.href || socialNetworks[props.network] || '';
17
17
  if (props.network === 'whatsapp') {
18
18
  const tel = href.replace(/[^+\d]/g, '');
19
19
  // eslint-disable-next-line prefer-template
@@ -1,9 +1,11 @@
1
1
  /* eslint-disable import/prefer-default-export */
2
2
  import type { Ref, InjectionKey } from 'vue';
3
3
 
4
- export const carouselKey = Symbol('carousel') as InjectionKey<{
5
- autoplay: Ref<number>,
4
+ export type CarouselInject = {
5
+ autoplay: Ref<number | undefined>,
6
6
  changeSlide: (direction: number) => void,
7
7
  isBoundLeft: Ref<boolean>,
8
8
  isBoundRight: Ref<boolean>,
9
- }>;
9
+ };
10
+
11
+ export const carouselKey = Symbol('carousel') as InjectionKey<CarouselInject>;
@@ -40,13 +40,12 @@ const dimensions = computed(() => {
40
40
  return getImgSizes(image.value) as { width: number, height: number };
41
41
  });
42
42
  const attrs = computed<ImgHTMLAttributes>(() => ({
43
- ...props,
44
43
  src: image.value.url,
45
44
  alt: image.value.alt,
46
- width: dimensions.value.width || null,
47
- height: dimensions.value.height || null,
48
- decoding: props.decoding || (dimensions.value.height ? 'async' : null),
49
- picture: null,
45
+ width: dimensions.value.width || undefined,
46
+ height: dimensions.value.height || undefined,
47
+ loading: props.loading,
48
+ decoding: props.decoding || (dimensions.value.height ? 'async' : undefined),
50
49
  }));
51
50
  </script>
52
51