cloudcommerce 0.23.2 → 0.24.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 (166) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
  3. package/ecomplus-stores/barra-doce/functions/ssr/content/layout.json +0 -6
  4. package/ecomplus-stores/barra-doce/functions/ssr/content/settings.json +17 -0
  5. package/ecomplus-stores/barra-doce/functions/ssr/package.json +6 -6
  6. package/ecomplus-stores/barra-doce/functions/ssr/public/robots.txt +2 -4
  7. package/ecomplus-stores/barra-doce/functions/ssr/src/components/AccountMenu.vue +1 -10
  8. package/ecomplus-stores/barra-doce/functions/ssr/src/components/Banner.vue +4 -6
  9. package/ecomplus-stores/barra-doce/functions/ssr/src/components/PitchBar.vue +2 -3
  10. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ProductCard.vue +4 -5
  11. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ProductShelf.vue +1 -4
  12. package/ecomplus-stores/barra-doce/functions/ssr/src/components/ShopHeader.vue +2 -7
  13. package/ecomplus-stores/barra-doce/functions/ssr/tailwind.config.cjs +1 -1
  14. package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
  15. package/ecomplus-stores/barra-doce/package.json +2 -2
  16. package/ecomplus-stores/iluminim/functions/many/package.json +3 -3
  17. package/ecomplus-stores/iluminim/functions/ssr/content/layout.json +0 -6
  18. package/ecomplus-stores/iluminim/functions/ssr/content/settings.json +16 -0
  19. package/ecomplus-stores/iluminim/functions/ssr/package.json +6 -6
  20. package/ecomplus-stores/iluminim/functions/ssr/public/robots.txt +2 -4
  21. package/ecomplus-stores/iluminim/functions/ssr/src/components/AccountMenu.vue +1 -10
  22. package/ecomplus-stores/iluminim/functions/ssr/src/components/Banner.vue +4 -6
  23. package/ecomplus-stores/iluminim/functions/ssr/src/components/PitchBar.vue +2 -3
  24. package/ecomplus-stores/iluminim/functions/ssr/src/components/ProductCard.vue +4 -5
  25. package/ecomplus-stores/iluminim/functions/ssr/src/components/ProductShelf.vue +1 -4
  26. package/ecomplus-stores/iluminim/functions/ssr/src/components/ShopHeader.vue +2 -7
  27. package/ecomplus-stores/iluminim/functions/ssr/tailwind.config.cjs +1 -1
  28. package/ecomplus-stores/iluminim/functions/with-apps/package.json +3 -3
  29. package/ecomplus-stores/iluminim/package.json +2 -2
  30. package/package.json +8 -8
  31. package/packages/api/package.json +1 -1
  32. package/packages/api/tests/index.test.ts +0 -2
  33. package/packages/apps/affilate-program/package.json +1 -1
  34. package/packages/apps/correios/package.json +1 -1
  35. package/packages/apps/custom-payment/lib/custom-payment-create-transaction.js +1 -1
  36. package/packages/apps/custom-payment/lib/custom-payment-list-payments.js +1 -1
  37. package/packages/apps/custom-payment/package.json +1 -1
  38. package/packages/apps/custom-shipping/package.json +1 -1
  39. package/packages/apps/datafrete/package.json +1 -1
  40. package/packages/apps/discounts/package.json +1 -1
  41. package/packages/apps/emails/package.json +1 -1
  42. package/packages/apps/fb-conversions/package.json +2 -2
  43. package/packages/apps/flash-courier/package.json +1 -1
  44. package/packages/apps/frenet/package.json +1 -1
  45. package/packages/apps/galaxpay/lib/galaxpay-create-transaction.js +1 -1
  46. package/packages/apps/galaxpay/lib/galaxpay-list-payments.js +1 -1
  47. package/packages/apps/galaxpay/package.json +1 -1
  48. package/packages/apps/google-analytics/package.json +1 -1
  49. package/packages/apps/jadlog/package.json +1 -1
  50. package/packages/apps/loyalty-points/lib/loyalty-create-transaction.js +1 -1
  51. package/packages/apps/loyalty-points/lib/loyalty-list-payments.js +1 -1
  52. package/packages/apps/loyalty-points/package.json +1 -1
  53. package/packages/apps/melhor-envio/package.json +1 -1
  54. package/packages/apps/mercadopago/lib/mp-create-transaction.js +1 -1
  55. package/packages/apps/mercadopago/lib/mp-list-payments.js +1 -1
  56. package/packages/apps/mercadopago/package.json +1 -1
  57. package/packages/apps/pagarme/lib/pagarme-create-transaction.js +1 -1
  58. package/packages/apps/pagarme/lib/pagarme-list-payments.js +1 -1
  59. package/packages/apps/pagarme/package.json +1 -1
  60. package/packages/apps/paghiper/lib/paghiper-create-transaction.js +1 -1
  61. package/packages/apps/paghiper/lib/paghiper-list-payments.js +1 -1
  62. package/packages/apps/paghiper/package.json +1 -1
  63. package/packages/apps/pix/lib/pix-create-transaction.js +1 -1
  64. package/packages/apps/pix/lib/pix-list-payments.js +1 -1
  65. package/packages/apps/pix/package.json +1 -1
  66. package/packages/apps/tiny-erp/package.json +1 -1
  67. package/packages/apps/webhooks/package.json +1 -1
  68. package/packages/cli/package.json +1 -1
  69. package/packages/config/package.json +1 -1
  70. package/packages/emails/package.json +1 -1
  71. package/packages/emails/tests/sendgrid.test.ts +0 -1
  72. package/packages/emails/tests/smtp.test.ts +0 -1
  73. package/packages/eslint/base.eslintrc.cjs +23 -0
  74. package/packages/eslint/package.json +5 -5
  75. package/packages/events/package.json +1 -1
  76. package/packages/feeds/package.json +1 -1
  77. package/packages/firebase/package.json +1 -1
  78. package/packages/i18n/package.json +1 -1
  79. package/packages/modules/package.json +1 -1
  80. package/packages/passport/package.json +1 -1
  81. package/packages/ssr/cloudflare/swr-worker.js +94 -26
  82. package/packages/ssr/lib/firebase/serve-storefront.js +22 -28
  83. package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
  84. package/packages/ssr/package.json +4 -4
  85. package/packages/ssr/src/cloudflare/swr-worker.ts +99 -26
  86. package/packages/ssr/src/firebase/serve-storefront.ts +24 -28
  87. package/packages/storefront/config/storefront.tailwind.cjs +41 -27
  88. package/packages/storefront/config/storefront.unocss.cjs +9 -23
  89. package/packages/storefront/dist/client/_astro/{_...slug_.07c1fa58.css → _...slug_.a786e016.css} +1 -1
  90. package/packages/storefront/dist/client/_astro/ecom-icon_CDmhA.png +0 -0
  91. package/packages/storefront/dist/client/_astro/ecom-icon_Z27EX9f.png +0 -0
  92. package/packages/storefront/dist/client/_astro/ecom-icon_Zo1CLq.png +0 -0
  93. package/packages/storefront/dist/client/_astro/headphone_22qtrt.avif +0 -0
  94. package/packages/storefront/dist/client/_astro/headphone_247ud8.avif +0 -0
  95. package/packages/storefront/dist/client/_astro/headphone_Z1hoMcQ.webp +0 -0
  96. package/packages/storefront/dist/client/_astro/headphone_Z1j5MXv.webp +0 -0
  97. package/packages/storefront/dist/client/_astro/logo_144owC.webp +0 -0
  98. package/packages/storefront/dist/client/_astro/logo_1ug3XF.png +0 -0
  99. package/packages/storefront/dist/client/_astro/logo_Z1EIN1I.avif +0 -0
  100. package/packages/storefront/dist/client/_astro/passion_29BEzB.webp +0 -0
  101. package/packages/storefront/dist/client/_astro/passion_2sykkb.avif +0 -0
  102. package/packages/storefront/dist/client/_astro/passion_HYj6i.webp +0 -0
  103. package/packages/storefront/dist/client/_astro/passion_Z18ANwS.avif +0 -0
  104. package/packages/storefront/dist/client/_astro/passion_ZK2FPz.webp +0 -0
  105. package/packages/storefront/dist/client/_astro/passion_pVNbE.avif +0 -0
  106. package/packages/storefront/dist/client/_astro/rect8589_1EUYOa.webp +0 -0
  107. package/packages/storefront/dist/client/_astro/rect8589_1Sqf3x.png +0 -0
  108. package/packages/storefront/dist/client/_astro/rect8589_1VeSii.avif +0 -0
  109. package/packages/storefront/dist/client/_astro/rect8589_2wFECM.png +0 -0
  110. package/packages/storefront/dist/client/_astro/rect8589_7mg8W.png +0 -0
  111. package/packages/storefront/dist/client/_astro/rect8589_Kv492.webp +0 -0
  112. package/packages/storefront/dist/client/_astro/rect8589_Z1DNkkN.webp +0 -0
  113. package/packages/storefront/dist/client/_astro/rect8589_Z1IS4wy.avif +0 -0
  114. package/packages/storefront/dist/client/_astro/rect8589_Zt4vbx.avif +0 -0
  115. package/packages/storefront/dist/client/_astro/rect859_1Bqr36.webp +0 -0
  116. package/packages/storefront/dist/client/_astro/rect859_1pj5UP.png +0 -0
  117. package/packages/storefront/dist/client/_astro/rect859_2dVuzq.avif +0 -0
  118. package/packages/storefront/dist/client/_astro/rect859_HaXay.png +0 -0
  119. package/packages/storefront/dist/client/_astro/rect859_Z100iy0.png +0 -0
  120. package/packages/storefront/dist/client/_astro/rect859_Z2i1RBz.avif +0 -0
  121. package/packages/storefront/dist/client/_astro/rect859_ZMRWqJ.webp +0 -0
  122. package/packages/storefront/dist/client/_astro/rect859_mPQHw.avif +0 -0
  123. package/packages/storefront/dist/client/_astro/rect859_xyq7d.webp +0 -0
  124. package/packages/storefront/dist/client/_astro/rect89_1DkX0O.webp +0 -0
  125. package/packages/storefront/dist/client/_astro/rect89_2uIqYp.avif +0 -0
  126. package/packages/storefront/dist/client/_astro/rect89_Z1rGPGT.webp +0 -0
  127. package/packages/storefront/dist/client/_astro/rect89_ZAjmIj.avif +0 -0
  128. package/packages/storefront/dist/client/robots.txt +2 -4
  129. package/packages/storefront/dist/client/sw.js +1 -1
  130. package/packages/storefront/dist/client/~fallback.html +98 -0
  131. package/packages/storefront/dist/client/~index.html +134 -0
  132. package/packages/storefront/dist/server/chunks/{_...c5a36021.mjs → _...5323ec5a.mjs} +4 -11
  133. package/packages/storefront/dist/server/chunks/{account@_@astro.3e90f29a.mjs → account@_@astro.a02ffb0b.mjs} +4 -11
  134. package/packages/storefront/dist/server/chunks/{astro.6adaff02.mjs → astro.a7611b51.mjs} +11 -18
  135. package/packages/storefront/dist/server/chunks/{index@_@astro.66b84ac2.mjs → index@_@astro.42c693b9.mjs} +4 -11
  136. package/packages/storefront/dist/server/chunks/{index@_@astro.0221a7bd.mjs → index@_@astro.d898498a.mjs} +4 -11
  137. package/packages/storefront/dist/server/chunks/pages/{_...slug_.astro.501582b9.mjs → _...slug_.astro.0f33557e.mjs} +103 -309
  138. package/packages/storefront/dist/server/chunks/pages/{account.astro.53400a42.mjs → account.astro.9325adb2.mjs} +1 -1
  139. package/packages/storefront/dist/server/chunks/pages/{index.astro.f1104ab2.mjs → index.astro.0f31fa39.mjs} +8 -27
  140. package/packages/storefront/dist/server/chunks/pages/{fallback.astro.8d1c6076.mjs → ~fallback.astro.bd93f01e.mjs} +15 -32
  141. package/packages/storefront/dist/server/chunks/{fallback@_@astro.9f73db0f.mjs → ~fallback@_@astro.d17419ae.mjs} +4 -11
  142. package/packages/storefront/dist/server/entry.mjs +47 -16
  143. package/packages/storefront/dist/server/images.dist.csv +38 -0
  144. package/packages/storefront/dist/server/images.src.csv +11 -0
  145. package/packages/storefront/dist/server/renderers.mjs +3 -10
  146. package/packages/storefront/dist/server/stylesheets.csv +1 -0
  147. package/packages/storefront/package.json +7 -6
  148. package/packages/storefront/scripts/build-prod.sh +2 -0
  149. package/packages/storefront/src/env.d.ts +0 -2
  150. package/packages/storefront/src/helpers/server-data.ts +9 -2
  151. package/packages/storefront/src/lib/components/BannerPictures.astro +2 -2
  152. package/packages/storefront/src/lib/components/Drawer.vue +1 -1
  153. package/packages/storefront/src/lib/components/PaymentMethodFlag.vue +36 -0
  154. package/packages/storefront/src/lib/components/SocialNetworkIcon.vue +1 -0
  155. package/packages/storefront/src/lib/components/globals/ALink.vue +5 -3
  156. package/packages/storefront/src/lib/composables/use-sticky-header.ts +1 -1
  157. package/packages/storefront/src/lib/layouts/BaseHead.astro +1 -1
  158. package/packages/storefront/src/lib/layouts/use-page-header.ts +2 -9
  159. package/packages/storefront/src/lib/ssr-context.ts +31 -25
  160. package/packages/storefront/src/vue-globals.d.ts +0 -1
  161. package/packages/types/index.ts +16 -0
  162. package/packages/types/package.json +1 -1
  163. package/packages/storefront/dist/server/chunks/endpoint@_@js.b79eed3b.mjs +0 -34
  164. package/packages/storefront/dist/server/chunks/pages/endpoint.js.4c130895.mjs +0 -119
  165. /package/ecomplus-stores/barra-doce/functions/ssr/src/pages/{fallback.astro → ~fallback.astro} +0 -0
  166. /package/ecomplus-stores/iluminim/functions/ssr/src/pages/{fallback.astro → ~fallback.astro} +0 -0
@@ -2,12 +2,13 @@
2
2
  import { computed } from 'vue';
3
3
 
4
4
  export interface Props {
5
- href: string;
5
+ href?: string | null;
6
6
  target?: string;
7
7
  }
8
8
 
9
9
  const props = defineProps<Props>();
10
10
  const linkTarget = computed(() => {
11
+ if (!props.href) return undefined;
11
12
  if (props.target) return props.target;
12
13
  if (props.href.startsWith('http')) {
13
14
  const domain = globalThis.$storefront.settings.domain || window.location.host;
@@ -18,9 +19,10 @@ const linkTarget = computed(() => {
18
19
  </script>
19
20
 
20
21
  <template>
21
- <a
22
+ <component
23
+ :is="href ? 'a' : 'span'"
22
24
  :href="href"
23
25
  :target="linkTarget"
24
26
  :rel="linkTarget === '_blank' ? 'noopener' : undefined"
25
- ><slot /></a>
27
+ ><slot /></component>
26
28
  </template>
@@ -46,7 +46,7 @@ const useStickyHeader = (props: Props) => {
46
46
  y.value = nextY;
47
47
  }, {
48
48
  debounce: isMobile ? 100 : 50,
49
- maxWait: isMobile ? 300 : 150,
49
+ maxWait: isMobile ? 800 : 400,
50
50
  });
51
51
  const isSticky = computed(() => ready.value && y.value > staticY.value * 1.2);
52
52
  const transition = ref('none');
@@ -63,7 +63,7 @@ if (apiContext.error) {
63
63
  inlineClientJS += `
64
64
  console.error(${JSON.stringify(message)});
65
65
  setTimeout(() => {
66
- window.location.replace("/fallback?status=${statusCode}&url=${encodeURIComponent(url)}");
66
+ window.location.replace("/~fallback?status=${statusCode}&url=${encodeURIComponent(url)}");
67
67
  }, 1);`;
68
68
  }
69
69
  if (apiDoc) {
@@ -1,12 +1,9 @@
1
1
  import type { RouteContext } from '@@sf/ssr-context';
2
- import type { LayoutContent } from '@@sf/content';
3
2
  import type { Props as UseShopHeaderProps } from '@@sf/composables/use-shop-header';
4
3
  import api from '@cloudcommerce/api';
5
4
  import { parseLayoutContent } from '@@sf/composables/use-pitch-bar';
6
5
 
7
- type ShopHeaderProps = Omit<UseShopHeaderProps, 'header'> & {
8
- serviceLinks?: LayoutContent['service_links'],
9
- };
6
+ type ShopHeaderProps = Omit<UseShopHeaderProps, 'header'>;
10
7
 
11
8
  export interface Props {
12
9
  routeContext: RouteContext;
@@ -16,10 +13,7 @@ export interface Props {
16
13
  const usePageHeader = async ({ routeContext, listedCategoryFields }: Props) => {
17
14
  const { apiState, getContent } = routeContext;
18
15
  const layoutContent = await getContent('layout');
19
- const {
20
- header: headerContent,
21
- service_links: serviceLinks,
22
- } = layoutContent;
16
+ const { header: headerContent } = layoutContent;
23
17
  const pitchBar = parseLayoutContent(layoutContent);
24
18
  let { categories } = apiState;
25
19
  if (!categories) {
@@ -45,7 +39,6 @@ const usePageHeader = async ({ routeContext, listedCategoryFields }: Props) => {
45
39
  menuCategorySlugs: headerContent.inline_menu_categories?.featured,
46
40
  menuRandomCategories: headerContent.inline_menu_categories?.random,
47
41
  isAlphabeticalSortSubmenu: headerContent.alphabetical_sort_submenu,
48
- serviceLinks,
49
42
  };
50
43
  /*
51
44
  if (import.meta.env.DEV) {
@@ -75,13 +75,13 @@ const loadRouteContext = async (Astro: Readonly<AstroGlobal>, {
75
75
  brands?: BrandsList,
76
76
  [k: string]: Record<string, any> | undefined,
77
77
  } = {};
78
- const apiPrefetchings = [
78
+ const apiPrefetchings: Array<ReturnType<typeof api.get> | Promise<null> | null> = [
79
79
  ...apiPrefetchEndpoints.map((endpoint) => {
80
80
  if (endpoint === ':slug') return null; // fetch by slug
81
81
  return api.get(endpoint);
82
82
  }),
83
83
  ];
84
- let fetchingApiContext: ReturnType<typeof api.get> | null = null;
84
+ let fetchingApiContext: typeof apiPrefetchings[number] = null;
85
85
  const apiContext: {
86
86
  resource?: 'products' | 'categories' | 'brands' | 'collections',
87
87
  doc?: Record<string, any>,
@@ -89,20 +89,21 @@ const loadRouteContext = async (Astro: Readonly<AstroGlobal>, {
89
89
  } = {
90
90
  error: null,
91
91
  };
92
+ const { slug } = Astro.params;
92
93
  if (isHomepage) {
93
94
  cmsContent = await config.getContent('pages/home');
94
- } else {
95
- const { slug } = Astro.params;
96
- if (slug) {
97
- if (contentCollection) {
98
- cmsContent = await config.getContent(`${contentCollection}/${slug}`);
99
- } else if (slug.startsWith('api/')) {
100
- const err: any = new Error('/api/* routes not implemented on SSR directly');
101
- Astro.response.status = 501;
102
- err.responseHTML = `<head></head><body>${err.message}</body>`;
103
- throw err;
104
- } else {
105
- fetchingApiContext = api.get(`slugs/${slug}`)
95
+ } else if (slug) {
96
+ if (contentCollection) {
97
+ cmsContent = await config.getContent(`${contentCollection}/${slug}`);
98
+ } else if (slug.startsWith('api/')) {
99
+ const err: any = new Error('/api/* routes not implemented on SSR directly');
100
+ Astro.response.status = 501;
101
+ err.responseHTML = `<head></head><body>${err.message}</body>`;
102
+ throw err;
103
+ } else {
104
+ const prefetchingsIndex = apiPrefetchings.findIndex((pr) => pr === null);
105
+ fetchingApiContext = new Promise((resolve, reject) => {
106
+ api.get(`slugs/${slug}`)
106
107
  .then((response) => {
107
108
  Object.assign(apiContext, response.data);
108
109
  const apiResource = apiContext.resource as
@@ -114,16 +115,19 @@ const loadRouteContext = async (Astro: Readonly<AstroGlobal>, {
114
115
  doc: apiDoc as any,
115
116
  timestamp: Date.now(),
116
117
  };
117
- return response;
118
+ resolve(null);
119
+ })
120
+ .catch((err: ApiError) => {
121
+ if (prefetchingsIndex > -1) {
122
+ reject(err);
123
+ } else {
124
+ apiContext.error = err;
125
+ resolve(null);
126
+ }
118
127
  });
119
- const index = apiPrefetchings.findIndex((pr) => pr === null);
120
- if (index > -1) {
121
- apiPrefetchings[index] = fetchingApiContext;
122
- } else {
123
- fetchingApiContext.catch((err: ApiError) => {
124
- apiContext.error = err;
125
- });
126
- }
128
+ }) as Promise<null>;
129
+ if (prefetchingsIndex > -1) {
130
+ apiPrefetchings[prefetchingsIndex] = fetchingApiContext;
127
131
  }
128
132
  }
129
133
  }
@@ -135,6 +139,8 @@ const loadRouteContext = async (Astro: Readonly<AstroGlobal>, {
135
139
  if (!apiState[apiStateKey]) {
136
140
  apiState[apiStateKey] = data.result || data;
137
141
  }
142
+ } else if (slug && apiContext.doc) {
143
+ apiState[`slugs/${slug}`] = apiContext;
138
144
  }
139
145
  });
140
146
  } catch (err: any) {
@@ -155,13 +161,13 @@ const loadRouteContext = async (Astro: Readonly<AstroGlobal>, {
155
161
  Astro.response.status = status;
156
162
  err.responseHTML = `<head>
157
163
  <meta http-equiv="refresh" content="0;
158
- url=/fallback?status=${status}&url=${encodeURIComponent(urlPath)}"/>
164
+ url=/~fallback?status=${status}&url=${encodeURIComponent(urlPath)}"/>
159
165
  </head>
160
166
  <body></body>`;
161
167
  throw err;
162
168
  }
163
169
  Astro.response.headers.set('X-Load-Took', String(Date.now() - startedAt));
164
- if (urlPath === '/fallback') {
170
+ if (urlPath === '/~fallback') {
165
171
  setResponseCache(Astro, 3600, 86400);
166
172
  } else if (isHomepage) {
167
173
  setResponseCache(Astro, 180, 300);
@@ -1,5 +1,4 @@
1
1
  // Read more: https://github.com/vuejs/core/pull/3399
2
- // eslint-disable-next-line import/no-extraneous-dependencies
3
2
  import '@vue/runtime-core';
4
3
  import type { FormatPercentage } from '@@sf/pages/_vue';
5
4
  import type { $Storefront } from '@@sf/$storefront';
@@ -81,6 +81,16 @@ type AppModuleBody = {
81
81
  application: Applications,
82
82
  };
83
83
 
84
+ type PaymentMethodFlag = 'pix'
85
+ | 'visa'
86
+ | 'mastercard'
87
+ | 'elo'
88
+ | 'amex'
89
+ | 'hipercard'
90
+ | 'boleto'
91
+ | 'diners'
92
+ | 'discover';
93
+
84
94
  type SettingsContent = {
85
95
  domain: string,
86
96
  name: string,
@@ -106,6 +116,12 @@ type SettingsContent = {
106
116
  youtube?: string,
107
117
  tiktok?: string,
108
118
  pinterest?: string,
119
+ threads?: string,
120
+ service_links?: Array<{
121
+ title: string,
122
+ href: string,
123
+ }>,
124
+ payment_methods?: PaymentMethodFlag[],
109
125
  modules?: {
110
126
  list_payments?: {
111
127
  installments_option?: Partial<ListPaymentsResponse['installments_option']>,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/types",
3
3
  "type": "module",
4
- "version": "0.23.2",
4
+ "version": "0.24.0",
5
5
  "description": "E-Com Plus Cloud Commerce reusable type definitions",
6
6
  "main": "index.ts",
7
7
  "repository": {
@@ -1,34 +0,0 @@
1
- export { renderers } from '../renderers.mjs';
2
- export { onRequest } from '../_empty-middleware.mjs';
3
- import './astro.6adaff02.mjs';
4
- import 'path-to-regexp';
5
- import 'cookie';
6
- import '@astrojs/internal-helpers/path';
7
- import 'kleur/colors';
8
- import 'node:fs';
9
- import 'node:http';
10
- import 'node:tls';
11
- import 'mime';
12
- import 'string-width';
13
- import 'html-escaper';
14
- import 'vue';
15
- import 'vue/server-renderer';
16
- import '@ecomplus/utils';
17
- import './pages/_...slug_.astro.501582b9.mjs';
18
- import 'node:fs/promises';
19
- import 'node:path';
20
- import 'node:url';
21
- import 'http-cache-semantics';
22
- import 'node:os';
23
- import 'image-size';
24
- import 'magic-string';
25
- import 'node:stream';
26
- import '@cloudcommerce/api';
27
- import 'node:events';
28
- import '@cloudcommerce/config';
29
- /* empty css */import '@vueuse/core';
30
- import '@headlessui/vue';
31
-
32
- const page = () => import('./pages/endpoint.js.4c130895.mjs').then(n => n.e);
33
-
34
- export { page };
@@ -1,119 +0,0 @@
1
- import mime from 'mime';
2
- import sharp$1 from 'sharp';
3
- import { B as BaseSSRService, i as isOutputFormatSupportsAlpha } from './_...slug_.astro.501582b9.mjs';
4
-
5
- class SharpService extends BaseSSRService {
6
- async transform(inputBuffer, transform) {
7
- if (transform.format === "svg") {
8
- return {
9
- data: inputBuffer,
10
- format: transform.format
11
- };
12
- }
13
- const sharpImage = sharp$1(inputBuffer, { failOnError: false, pages: -1 });
14
- sharpImage.rotate();
15
- if (transform.width || transform.height) {
16
- const width = transform.width && Math.round(transform.width);
17
- const height = transform.height && Math.round(transform.height);
18
- sharpImage.resize({
19
- width,
20
- height,
21
- fit: transform.fit,
22
- position: transform.position,
23
- background: transform.background
24
- });
25
- }
26
- if (transform.format) {
27
- sharpImage.toFormat(transform.format, { quality: transform.quality });
28
- if (transform.background && !isOutputFormatSupportsAlpha(transform.format)) {
29
- sharpImage.flatten({ background: transform.background });
30
- }
31
- }
32
- const { data, info } = await sharpImage.toBuffer({ resolveWithObject: true });
33
- return {
34
- data,
35
- format: info.format
36
- };
37
- }
38
- }
39
- const service = new SharpService();
40
- var sharp_default = service;
41
-
42
- const sharp = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
43
- __proto__: null,
44
- default: sharp_default
45
- }, Symbol.toStringTag, { value: 'Module' }));
46
-
47
- const fnv1a52 = (str) => {
48
- const len = str.length;
49
- let i = 0, t0 = 0, v0 = 8997, t1 = 0, v1 = 33826, t2 = 0, v2 = 40164, t3 = 0, v3 = 52210;
50
- while (i < len) {
51
- v0 ^= str.charCodeAt(i++);
52
- t0 = v0 * 435;
53
- t1 = v1 * 435;
54
- t2 = v2 * 435;
55
- t3 = v3 * 435;
56
- t2 += v0 << 8;
57
- t3 += v1 << 8;
58
- t1 += t0 >>> 16;
59
- v0 = t0 & 65535;
60
- t2 += t1 >>> 16;
61
- v1 = t1 & 65535;
62
- v3 = t3 + (t2 >>> 16) & 65535;
63
- v2 = t2 & 65535;
64
- }
65
- return (v3 & 15) * 281474976710656 + v2 * 4294967296 + v1 * 65536 + (v0 ^ v3 >> 4);
66
- };
67
- const etag = (payload, weak = false) => {
68
- const prefix = weak ? 'W/"' : '"';
69
- return prefix + fnv1a52(payload).toString(36) + payload.length.toString(36) + '"';
70
- };
71
-
72
- function isRemoteImage(src) {
73
- return /^(https?:)?\/\//.test(src);
74
- }
75
-
76
- async function loadRemoteImage(src) {
77
- try {
78
- const res = await fetch(src);
79
- if (!res.ok) {
80
- return void 0;
81
- }
82
- return Buffer.from(await res.arrayBuffer());
83
- } catch (err) {
84
- console.error(err);
85
- return void 0;
86
- }
87
- }
88
- const get = async ({ request }) => {
89
- try {
90
- const url = new URL(request.url);
91
- const transform = sharp_default.parseTransform(url.searchParams);
92
- let inputBuffer = void 0;
93
- const sourceUrl = isRemoteImage(transform.src) ? new URL(transform.src) : new URL(transform.src, url.origin);
94
- inputBuffer = await loadRemoteImage(sourceUrl);
95
- if (!inputBuffer) {
96
- return new Response("Not Found", { status: 404 });
97
- }
98
- const { data, format } = await sharp_default.transform(inputBuffer, transform);
99
- return new Response(data, {
100
- status: 200,
101
- headers: {
102
- "Content-Type": mime.getType(format) || "",
103
- "Cache-Control": "public, max-age=31536000",
104
- ETag: etag(data.toString()),
105
- Date: (/* @__PURE__ */ new Date()).toUTCString()
106
- }
107
- });
108
- } catch (err) {
109
- console.error(err);
110
- return new Response(`Server Error: ${err}`, { status: 500 });
111
- }
112
- };
113
-
114
- const endpoint = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
115
- __proto__: null,
116
- get
117
- }, Symbol.toStringTag, { value: 'Module' }));
118
-
119
- export { endpoint as e, sharp as s };