cloudcommerce 0.3.0 → 0.4.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.
- package/CHANGELOG.md +40 -0
- package/package.json +8 -8
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/package.json +2 -2
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/datafrete/package.json +3 -3
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +1 -1
- package/packages/apps/fb-conversions/package.json +2 -2
- package/packages/apps/frenet/package.json +3 -3
- package/packages/apps/galaxpay/package.json +3 -3
- package/packages/apps/google-analytics/package.json +3 -3
- package/packages/apps/infinitepay/lib/ip-create-transaction.js +1 -1
- package/packages/apps/infinitepay/lib/ip-create-transaction.js.map +1 -1
- package/packages/apps/infinitepay/package.json +3 -3
- package/packages/apps/infinitepay/src/ip-create-transaction.ts +1 -1
- package/packages/apps/jadlog/package.json +2 -2
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/melhor-envio/package.json +3 -3
- package/packages/apps/mercadopago/package.json +3 -3
- package/packages/apps/pagarme/package.json +3 -3
- package/packages/apps/paghiper/package.json +3 -3
- package/packages/apps/pix/package.json +3 -3
- package/packages/apps/tiny-erp/package.json +3 -3
- package/packages/apps/webhooks/CHANGELOG.md +1 -0
- package/packages/apps/webhooks/README.md +1 -0
- package/packages/apps/webhooks/lib/app-webhooks.js +9 -0
- package/packages/apps/webhooks/lib/app-webhooks.js.map +1 -0
- package/packages/apps/webhooks/lib/events-to-webhooks-app.js +127 -0
- package/packages/apps/webhooks/lib/events-to-webhooks-app.js.map +1 -0
- package/packages/apps/webhooks/lib/index.js +2 -0
- package/packages/apps/webhooks/lib/index.js.map +1 -0
- package/packages/apps/webhooks/package.json +32 -0
- package/packages/apps/webhooks/src/app-webhooks.ts +14 -0
- package/packages/apps/webhooks/src/events-to-webhooks-app.ts +178 -0
- package/packages/apps/webhooks/src/index.ts +1 -0
- package/packages/apps/webhooks/tsconfig.json +3 -0
- package/packages/cli/lib/setup-gcloud.js +120 -20
- package/packages/cli/package.json +1 -1
- package/packages/cli/src/cli.ts +1 -1
- package/packages/cli/src/setup-gcloud.ts +146 -21
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +2 -2
- package/packages/emails/tests/assets/order.json +1 -1
- package/packages/events/lib/firebase.js +2 -0
- package/packages/events/lib/firebase.js.map +1 -1
- package/packages/events/package.json +3 -2
- package/packages/events/src/firebase.ts +2 -0
- package/packages/firebase/lib/config.d.ts +4 -0
- package/packages/firebase/lib/config.js +10 -1
- package/packages/firebase/lib/config.js.map +1 -1
- package/packages/firebase/lib/handlers/check-store-events.js +13 -4
- package/packages/firebase/lib/handlers/check-store-events.js.map +1 -1
- package/packages/firebase/package.json +2 -2
- package/packages/firebase/src/config.ts +10 -7
- package/packages/firebase/src/handlers/check-store-events.ts +14 -4
- package/packages/i18n/package.json +1 -1
- package/packages/modules/lib/firebase/checkout.js +4 -4
- package/packages/modules/lib/firebase/checkout.js.map +1 -1
- package/packages/modules/package.json +3 -3
- package/packages/modules/schemas/@checkout.cjs +0 -5
- package/packages/modules/schemas/create_transaction.cjs +6 -1
- package/packages/modules/src/firebase/checkout.ts +4 -4
- package/packages/passport/package.json +2 -2
- package/packages/ssr/package.json +7 -7
- package/packages/storefront/dist/client/_astro/PitchBar.004b6ea4.js +1 -0
- package/packages/storefront/dist/client/_astro/Prices.f311909a.js +1 -0
- package/packages/storefront/dist/client/_astro/Prices.vue_vue_type_script_setup_true_lang.ef47de70.js +1 -0
- package/packages/storefront/dist/client/_astro/ProductCard.34de5097.js +1 -0
- package/packages/storefront/dist/client/_astro/ShopHeader.cbfee289.js +1 -0
- package/packages/storefront/dist/client/_astro/{_...slug_.32968ccf.css → _...slug_.bcc33d9d.css} +1 -1
- package/packages/storefront/dist/client/_astro/{client.5a46cc02.js → client.56d86c9b.js} +1 -1
- package/packages/storefront/dist/client/_astro/index.0c833781.css +1 -0
- package/packages/storefront/dist/client/_astro/index.2d12be6c.js +1 -0
- package/packages/storefront/dist/client/_astro/{modules-info.d9373e21.js → modules-info.0debb0b0.js} +1 -1
- package/packages/storefront/dist/client/_astro/runtime-core.esm-bundler.a0432a8e.js +1 -0
- package/packages/storefront/dist/client/_astro/{runtime-dom.esm-bundler.00313542.js → runtime-dom.esm-bundler.0e5774ce.js} +1 -1
- package/packages/storefront/dist/client/fallback/index.html +10 -10
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/chunks/{astro.89bd9221.mjs → astro.0f5b754a.mjs} +871 -826
- package/packages/storefront/dist/server/chunks/pages/{all.23de4e5c.mjs → all.671e6bc1.mjs} +367 -466
- package/packages/storefront/dist/server/chunks/{prerender.f40361a3.mjs → prerender.fd8cdc24.mjs} +0 -0
- package/packages/storefront/dist/server/entry.mjs +20 -12
- package/packages/storefront/package.json +11 -11
- package/packages/storefront/src/lib/components/Drawer.vue +48 -45
- package/packages/storefront/src/lib/components/ProductCard.vue +1 -1
- package/packages/storefront/src/lib/components/ShopHeader.vue +42 -13
- package/packages/storefront/src/lib/components/ShopSidenav.vue +26 -0
- package/packages/storefront/src/lib/composables/use-pitch-bar.ts +27 -0
- package/packages/storefront/src/lib/composables/use-sticky-header.ts +111 -0
- package/packages/storefront/src/lib/layouts/BaseBody.astro +3 -1
- package/packages/storefront/src/lib/layouts/PagesHeader.astro +16 -25
- package/packages/types/index.ts +1 -0
- package/packages/types/modules/@checkout:params.d.ts +1 -5
- package/packages/types/modules/apply_discount:params.d.ts +1 -1
- package/packages/types/modules/apply_discount:response.d.ts +1 -1
- package/packages/types/modules/calculate_shipping:params.d.ts +1 -1
- package/packages/types/modules/calculate_shipping:response.d.ts +1 -1
- package/packages/types/modules/create_transaction:params.d.ts +6 -2
- package/packages/types/modules/create_transaction:response.d.ts +1 -1
- package/packages/types/modules/list_payments:params.d.ts +1 -1
- package/packages/types/modules/list_payments:response.d.ts +1 -1
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/_astro/PitchBar.209c6645.js +0 -1
- package/packages/storefront/dist/client/_astro/Prices.6fbcb5ac.js +0 -1
- package/packages/storefront/dist/client/_astro/Prices.vue_vue_type_script_setup_true_lang.44f23680.js +0 -1
- package/packages/storefront/dist/client/_astro/ProductCard.ee5eee91.js +0 -1
- package/packages/storefront/dist/client/_astro/ShopHeader.b801c785.js +0 -1
- package/packages/storefront/dist/client/_astro/index.844a4059.js +0 -1
- package/packages/storefront/dist/client/_astro/index.90df622b.css +0 -1
- package/packages/storefront/dist/client/_astro/runtime-core.esm-bundler.f04cee62.js +0 -1
- package/packages/storefront/dist/client/_astro/use-component-variant.58788b6e.js +0 -1
- package/packages/storefront/src/lib/components/PitchBar.vue +0 -66
- package/packages/storefront/src/lib/components/Prices.vue +0 -176
- package/packages/storefront/src/lib/components/StickyHeader.vue +0 -84
- package/packages/storefront/src/lib/composables/use-component-variant.ts +0 -17
package/packages/storefront/dist/server/chunks/{prerender.f40361a3.mjs → prerender.fd8cdc24.mjs}
RENAMED
|
File without changes
|
|
@@ -2,7 +2,7 @@ import { performance } from 'node:perf_hooks';
|
|
|
2
2
|
import { ReadableStream, ByteLengthQueuingStrategy, CountQueuingStrategy, ReadableByteStreamController, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, TransformStream, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter } from 'node:stream/web';
|
|
3
3
|
import * as undici 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.
|
|
5
|
+
import { N as NodeApp, g as server_default, h as deserializeManifest } from './chunks/astro.0f5b754a.mjs';
|
|
6
6
|
import { Readable } from 'stream';
|
|
7
7
|
import https from 'https';
|
|
8
8
|
import path from 'path';
|
|
@@ -10,11 +10,12 @@ import { fileURLToPath } from 'url';
|
|
|
10
10
|
import fs from 'fs';
|
|
11
11
|
import http from 'http';
|
|
12
12
|
import send from 'send';
|
|
13
|
+
import enableDestroy from 'server-destroy';
|
|
13
14
|
import { defineComponent, computed, unref, useSSRContext, mergeProps, h as h$2, createSSRApp } from 'vue';
|
|
14
15
|
import { ssrRenderSlotInner, ssrRenderAttrs, ssrRenderSlot, renderToString } from 'vue/server-renderer';
|
|
15
16
|
import { i18n, formatMoney } from '@ecomplus/utils';
|
|
16
|
-
/* empty css */import { _ as _page0, a as _page1, b as _page3, c as _page4, d as _page5 } from './chunks/pages/all.
|
|
17
|
-
import { _ as _page2 } from './chunks/prerender.
|
|
17
|
+
/* empty css */import { _ as _page0, a as _page1, b as _page3, c as _page4, d as _page5 } from './chunks/pages/all.671e6bc1.mjs';
|
|
18
|
+
import { _ as _page2 } from './chunks/prerender.fd8cdc24.mjs';
|
|
18
19
|
import 'path-to-regexp';
|
|
19
20
|
import 'tls';
|
|
20
21
|
import 'mime';
|
|
@@ -2998,7 +2999,8 @@ function createServer({ client, port, host, removeBase }, handler) {
|
|
|
2998
2999
|
if (req.url) {
|
|
2999
3000
|
let pathname = removeBase(req.url);
|
|
3000
3001
|
pathname = pathname[0] === "/" ? pathname : "/" + pathname;
|
|
3001
|
-
|
|
3002
|
+
pathname = new URL(pathname, `http://${host}:${port}`).pathname;
|
|
3003
|
+
const stream = send(req, encodeURI(decodeURI(pathname)), {
|
|
3002
3004
|
root: fileURLToPath(client),
|
|
3003
3005
|
dotfiles: pathname.startsWith("/.well-known/") ? "allow" : "deny"
|
|
3004
3006
|
});
|
|
@@ -3033,6 +3035,7 @@ function createServer({ client, port, host, removeBase }, handler) {
|
|
|
3033
3035
|
httpServer = http.createServer(listener);
|
|
3034
3036
|
}
|
|
3035
3037
|
httpServer.listen(port, host);
|
|
3038
|
+
enableDestroy(httpServer);
|
|
3036
3039
|
const closed = new Promise((resolve, reject) => {
|
|
3037
3040
|
httpServer.addListener("close", resolve);
|
|
3038
3041
|
httpServer.addListener("error", reject);
|
|
@@ -3046,7 +3049,7 @@ function createServer({ client, port, host, removeBase }, handler) {
|
|
|
3046
3049
|
server: httpServer,
|
|
3047
3050
|
stop: async () => {
|
|
3048
3051
|
await new Promise((resolve, reject) => {
|
|
3049
|
-
httpServer.
|
|
3052
|
+
httpServer.destroy((err) => err ? reject(err) : resolve(void 0));
|
|
3050
3053
|
});
|
|
3051
3054
|
}
|
|
3052
3055
|
};
|
|
@@ -3074,7 +3077,7 @@ function getResolvedHostForHttpServer(host) {
|
|
|
3074
3077
|
return host;
|
|
3075
3078
|
}
|
|
3076
3079
|
}
|
|
3077
|
-
function startServer(app, options) {
|
|
3080
|
+
function startServer$1(app, options) {
|
|
3078
3081
|
const port = process.env.PORT ? Number(process.env.PORT) : options.port ?? 8080;
|
|
3079
3082
|
const { client } = resolvePaths(options);
|
|
3080
3083
|
const handler = middleware_default(app, options.mode);
|
|
@@ -3092,7 +3095,10 @@ function startServer(app, options) {
|
|
|
3092
3095
|
);
|
|
3093
3096
|
const protocol = server.server instanceof https.Server ? "https" : "http";
|
|
3094
3097
|
console.log(`Server listening on ${protocol}://${host}:${port}`);
|
|
3095
|
-
return
|
|
3098
|
+
return {
|
|
3099
|
+
server,
|
|
3100
|
+
done: server.closed()
|
|
3101
|
+
};
|
|
3096
3102
|
}
|
|
3097
3103
|
|
|
3098
3104
|
polyfill(globalThis, {
|
|
@@ -3101,7 +3107,8 @@ polyfill(globalThis, {
|
|
|
3101
3107
|
function createExports(manifest, options) {
|
|
3102
3108
|
const app = new NodeApp(manifest);
|
|
3103
3109
|
return {
|
|
3104
|
-
handler: middleware_default(app, options.mode)
|
|
3110
|
+
handler: middleware_default(app, options.mode),
|
|
3111
|
+
startServer: () => startServer$1(app, options)
|
|
3105
3112
|
};
|
|
3106
3113
|
}
|
|
3107
3114
|
function start(manifest, options) {
|
|
@@ -3109,7 +3116,7 @@ function start(manifest, options) {
|
|
|
3109
3116
|
return;
|
|
3110
3117
|
}
|
|
3111
3118
|
const app = new NodeApp(manifest);
|
|
3112
|
-
startServer(app, options);
|
|
3119
|
+
startServer$1(app, options);
|
|
3113
3120
|
}
|
|
3114
3121
|
|
|
3115
3122
|
const adapter = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
@@ -3318,20 +3325,21 @@ const _renderer1 = {
|
|
|
3318
3325
|
renderToStaticMarkup,
|
|
3319
3326
|
};
|
|
3320
3327
|
|
|
3321
|
-
const pageMap = new Map([["../../node_modules/.pnpm/@astrojs+image@0.
|
|
3328
|
+
const pageMap = new Map([["../../node_modules/.pnpm/@astrojs+image@0.14.0_astro@2.0.6+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],]);
|
|
3322
3329
|
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 }),];
|
|
3323
3330
|
|
|
3324
|
-
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"fallback/index.html","links":[],"scripts":[],"routeData":{"route":"/fallback","type":"page","pattern":"^\\/fallback\\/?$","segments":[[{"content":"fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/fallback.astro","pathname":"/fallback","_meta":{"trailingSlash":"ignore"}}},{"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.
|
|
3331
|
+
const _manifest = Object.assign(deserializeManifest({"adapterName":"@astrojs/node","routes":[{"file":"fallback/index.html","links":[],"scripts":[],"routeData":{"route":"/fallback","type":"page","pattern":"^\\/fallback\\/?$","segments":[[{"content":"fallback","dynamic":false,"spread":false}]],"params":[],"component":"src/pages/fallback.astro","pathname":"/fallback","_meta":{"trailingSlash":"ignore"}}},{"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.14.0_astro@2.0.6+sharp@0.31.3/node_modules/@astrojs/image/dist/endpoint.js","pathname":"/_image","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.bcc33d9d.css","_astro/index.0c833781.css"],"scripts":[{"type":"external","value":"_astro/hoisted.6edd7364.js"}],"routeData":{"route":"/","type":"page","pattern":"^\\/$","segments":[],"params":[],"component":"src/pages/index.astro","pathname":"/","_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","_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","_meta":{"trailingSlash":"ignore"}}},{"file":"","links":["_astro/_...slug_.bcc33d9d.css"],"scripts":[{"type":"external","value":"_astro/hoisted.6edd7364.js"}],"routeData":{"route":"/[...slug]","type":"page","pattern":"^(?:\\/(.*?))?\\/?$","segments":[[{"content":"...slug","dynamic":true,"spread":true}]],"params":["...slug"],"component":"src/pages/[...slug].astro","_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,"contentDir":"file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/src/content/"},"pageMap":null,"renderers":[],"entryModules":{"\u0000@astrojs-ssr-virtual-entry":"_@astrojs-ssr-virtual-entry.mjs","~/components/PitchBar.vue":"_astro/PitchBar.004b6ea4.js","~/components/Prices.vue":"_astro/Prices.f311909a.js","@@sf/components/ProductCard.vue":"_astro/ProductCard.34de5097.js","@astrojs/vue/client.js":"_astro/client.56d86c9b.js","/astro/hoisted.js?q=0":"_astro/hoisted.6edd7364.js","@@sf/components/ShopHeader.vue":"_astro/ShopHeader.cbfee289.js","/home/leo/code/ecomplus/cloud-commerce/node_modules/workbox-window/build/workbox-window.prod.es5.mjs":"_astro/workbox-window.prod.es5.295a6886.js","astro:scripts/before-hydration.js":""},"assets":["/_astro/index.0c833781.css","/_astro/server.60de185d.css","/_astro/_...slug_.bcc33d9d.css","/manifest.webmanifest","/registerSW.js","/robots.txt","/sw.js","/workbox-e2ee76b5.js","/_astro/PitchBar.004b6ea4.js","/_astro/Prices.f311909a.js","/_astro/Prices.vue_vue_type_script_setup_true_lang.ef47de70.js","/_astro/ProductCard.34de5097.js","/_astro/ShopHeader.cbfee289.js","/_astro/client.56d86c9b.js","/_astro/ecom-utils.92f137f6.js","/_astro/hoisted.6edd7364.js","/_astro/index.2d12be6c.js","/_astro/modules-info.0debb0b0.js","/_astro/runtime-core.esm-bundler.a0432a8e.js","/_astro/runtime-dom.esm-bundler.0e5774ce.js","/_astro/session-utm.72684b84.js","/_astro/workbox-window.prod.es5.295a6886.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","/assets/icons/bootstrap-icons/font/storefront-icons.woff2","/assets/icons/feather-icons/font/storefront-icons.woff2","/assets/icons/font-awesome/font/storefront-icons.woff2","/assets/icons/line-awesome/font/storefront-icons.woff2","/assets/icons/tabler-icons/font/storefront-icons.woff2","/fallback/index.html"]}), {
|
|
3325
3332
|
pageMap: pageMap,
|
|
3326
3333
|
renderers: renderers
|
|
3327
3334
|
});
|
|
3328
3335
|
const _args = {"mode":"middleware","client":"file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/dist/client/","server":"file:///home/leo/code/ecomplus/cloud-commerce/packages/storefront/dist/server/","host":false,"port":3000};
|
|
3329
3336
|
const _exports = createExports(_manifest, _args);
|
|
3330
3337
|
const handler = _exports['handler'];
|
|
3338
|
+
const startServer = _exports['startServer'];
|
|
3331
3339
|
|
|
3332
3340
|
const _start = 'start';
|
|
3333
3341
|
if(_start in adapter) {
|
|
3334
3342
|
adapter[_start](_manifest, _args);
|
|
3335
3343
|
}
|
|
3336
3344
|
|
|
3337
|
-
export { handler, pageMap, renderers };
|
|
3345
|
+
export { handler, pageMap, renderers, startServer };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/storefront",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.1",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront with Astro",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"repository": {
|
|
@@ -25,34 +25,34 @@
|
|
|
25
25
|
"prepare-monorepo": "sh scripts/prepare-monorepo.sh"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@astrojs/image": "^0.
|
|
29
|
-
"@astrojs/node": "^5.0.
|
|
28
|
+
"@astrojs/image": "^0.14.0",
|
|
29
|
+
"@astrojs/node": "^5.0.3",
|
|
30
30
|
"@astrojs/partytown": "^1.0.3",
|
|
31
|
-
"@astrojs/prefetch": "^0.1.
|
|
32
|
-
"@astrojs/vue": "^2.0.
|
|
31
|
+
"@astrojs/prefetch": "^0.1.2",
|
|
32
|
+
"@astrojs/vue": "^2.0.1",
|
|
33
33
|
"@cloudcommerce/api": "workspace:*",
|
|
34
34
|
"@cloudcommerce/config": "workspace:*",
|
|
35
35
|
"@cloudcommerce/i18n": "workspace:*",
|
|
36
36
|
"@ecomplus/utils": "1.5.0-rc.3",
|
|
37
37
|
"@fastify/deepmerge": "^1.3.0",
|
|
38
|
-
"@headlessui/vue": "^1.7.
|
|
38
|
+
"@headlessui/vue": "^1.7.9",
|
|
39
39
|
"@iconify-json/fa6-brands": "^1.1.8",
|
|
40
40
|
"@iconify-json/heroicons": "^1.1.8",
|
|
41
41
|
"@iconify-json/logos": "^1.1.22",
|
|
42
42
|
"@vite-pwa/astro": "^0.0.1",
|
|
43
43
|
"@vueuse/core": "^9.12.0",
|
|
44
|
-
"astro": "^2.0.
|
|
44
|
+
"astro": "^2.0.6",
|
|
45
45
|
"chroma-js": "^2.4.2",
|
|
46
46
|
"dotenv": "^16.0.3",
|
|
47
|
-
"firebase": "^9.
|
|
47
|
+
"firebase": "^9.17.1",
|
|
48
48
|
"image-size": "^1.0.2",
|
|
49
49
|
"semver": "^7.3.8",
|
|
50
50
|
"sharp": "^0.31.3",
|
|
51
51
|
"tailwindcss": "^3.2.4",
|
|
52
|
-
"unocss": "^0.49.
|
|
53
|
-
"vite": "^4.
|
|
52
|
+
"unocss": "^0.49.4",
|
|
53
|
+
"vite": "^4.1.1",
|
|
54
54
|
"vite-plugin-pwa": "^0.14.1",
|
|
55
|
-
"vue": "^3.2.
|
|
55
|
+
"vue": "^3.2.47"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@babel/core": "^7.20.12",
|
|
@@ -5,29 +5,27 @@ import {
|
|
|
5
5
|
computed,
|
|
6
6
|
watch,
|
|
7
7
|
} from 'vue';
|
|
8
|
-
import useComponentVariant from '@@sf/composables/use-component-variant';
|
|
9
8
|
|
|
10
9
|
export interface Props {
|
|
11
10
|
modelValue?: boolean;
|
|
12
11
|
placement?: 'start' | 'end' | 'top' | 'bottom';
|
|
13
|
-
|
|
12
|
+
position?: 'fixed' | 'absolute';
|
|
14
13
|
hasCloseButton?: boolean;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
const props = withDefaults(defineProps<Props>(), {
|
|
18
17
|
modelValue: false,
|
|
19
18
|
placement: 'start',
|
|
20
|
-
|
|
19
|
+
position: 'fixed',
|
|
21
20
|
hasCloseButton: true,
|
|
22
21
|
});
|
|
23
22
|
const emit = defineEmits([
|
|
24
23
|
'update:modelValue',
|
|
25
24
|
]);
|
|
26
25
|
const close = () => emit('update:modelValue', false);
|
|
27
|
-
const
|
|
28
|
-
const canvas = ref(null);
|
|
26
|
+
const drawer = ref(null);
|
|
29
27
|
const outsideClickListener = (ev: MouseEvent) => {
|
|
30
|
-
if (!
|
|
28
|
+
if (!drawer.value?.contains(ev.target)) {
|
|
31
29
|
close();
|
|
32
30
|
}
|
|
33
31
|
};
|
|
@@ -37,23 +35,14 @@ const escClickListener = (ev: KeyboardEvent) => {
|
|
|
37
35
|
}
|
|
38
36
|
};
|
|
39
37
|
watch(toRef(props, 'modelValue'), async (isOpen) => {
|
|
40
|
-
const header = anchor.value.closest('[class*="backdrop-"]');
|
|
41
38
|
if (isOpen) {
|
|
42
39
|
document.body.style.overflow = 'hidden';
|
|
43
|
-
if (header) {
|
|
44
|
-
header.style.backdropFilter = 'none';
|
|
45
|
-
}
|
|
46
40
|
setTimeout(() => {
|
|
47
41
|
document.addEventListener('click', outsideClickListener, { passive: true });
|
|
48
42
|
document.addEventListener('keydown', escClickListener, { passive: true });
|
|
49
43
|
}, 500);
|
|
50
44
|
} else {
|
|
51
45
|
document.body.style.overflow = null;
|
|
52
|
-
if (header) {
|
|
53
|
-
setTimeout(() => {
|
|
54
|
-
header.style.backdropFilter = null;
|
|
55
|
-
}, 500);
|
|
56
|
-
}
|
|
57
46
|
document.removeEventListener('click', outsideClickListener);
|
|
58
47
|
document.removeEventListener('keydown', escClickListener);
|
|
59
48
|
}
|
|
@@ -66,38 +55,52 @@ const slideTo = computed(() => {
|
|
|
66
55
|
default: return 'down';
|
|
67
56
|
}
|
|
68
57
|
});
|
|
69
|
-
const
|
|
58
|
+
const isFixed = computed(() => {
|
|
59
|
+
return props.position === 'fixed';
|
|
60
|
+
});
|
|
61
|
+
const isPlacementX = computed(() => {
|
|
62
|
+
return props.placement === 'start' || props.placement === 'end';
|
|
63
|
+
});
|
|
70
64
|
</script>
|
|
71
65
|
|
|
72
66
|
<template>
|
|
73
|
-
<
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
67
|
+
<Fade :slide="slideTo" speed="slow" is-floating>
|
|
68
|
+
<dialog
|
|
69
|
+
v-if="modelValue"
|
|
70
|
+
ref="drawer"
|
|
71
|
+
class="w-screen max-w-sm shadow p-0 m-0 z-50"
|
|
72
|
+
:class="[
|
|
73
|
+
position,
|
|
74
|
+
isFixed ? `top-0 left-0 ${(isPlacementX ? 'h-screen' : '')}` : null,
|
|
75
|
+
]"
|
|
76
|
+
:open="modelValue"
|
|
77
|
+
:data-drawer="placement"
|
|
78
|
+
>
|
|
79
|
+
<div class="relative">
|
|
80
|
+
<button
|
|
81
|
+
v-if="hasCloseButton"
|
|
82
|
+
type="button"
|
|
83
|
+
:aria-label="$t.i19close"
|
|
84
|
+
@click.prevent="close"
|
|
85
|
+
class="absolute top-2"
|
|
86
|
+
:class="placement === 'end' ? 'left-2' : 'right-2'"
|
|
87
|
+
data-drawer-close
|
|
82
88
|
>
|
|
83
|
-
<
|
|
84
|
-
<
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
</Fade>
|
|
101
|
-
</Teleport>
|
|
102
|
-
</div>
|
|
89
|
+
<slot name="close">
|
|
90
|
+
<i class="i-close text-base-400 text-3xl"></i>
|
|
91
|
+
</slot>
|
|
92
|
+
</button>
|
|
93
|
+
<slot />
|
|
94
|
+
</div>
|
|
95
|
+
<Teleport to="#teleported-top">
|
|
96
|
+
<Fade>
|
|
97
|
+
<div
|
|
98
|
+
v-if="modelValue"
|
|
99
|
+
class="fixed top-0 left-0 w-screen h-screen bg-black/50 z-40"
|
|
100
|
+
data-drawer-backdrop
|
|
101
|
+
></div>
|
|
102
|
+
</Fade>
|
|
103
|
+
</Teleport>
|
|
104
|
+
</dialog>
|
|
105
|
+
</Fade>
|
|
103
106
|
</template>
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import {
|
|
2
|
+
import type { CategoriesList } from '@cloudcommerce/api/types';
|
|
3
|
+
import { ref, computed } from 'vue';
|
|
3
4
|
import { i19myAccount, i19openCart, i19searchProducts } from '@@i18n';
|
|
5
|
+
import useStickyHeader from '@@sf/composables/use-sticky-header';
|
|
4
6
|
import Drawer from '@@sf/components/Drawer.vue';
|
|
5
|
-
import
|
|
7
|
+
import ShopSidenav from '@@sf/components/ShopSidenav.vue';
|
|
6
8
|
|
|
9
|
+
export interface Props {
|
|
10
|
+
categories: CategoriesList;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
defineProps<Props>();
|
|
7
14
|
const buttons = ref({
|
|
8
15
|
search: {
|
|
9
16
|
icon: 'i-search',
|
|
@@ -22,16 +29,29 @@ const buttons = ref({
|
|
|
22
29
|
},
|
|
23
30
|
});
|
|
24
31
|
const isSidenavOpen = ref(false);
|
|
32
|
+
const header = ref<HTMLElement | null>(null);
|
|
33
|
+
const {
|
|
34
|
+
isSticky,
|
|
35
|
+
staticHeight,
|
|
36
|
+
staticY,
|
|
37
|
+
} = useStickyHeader({ header });
|
|
38
|
+
const sidenavHeight = computed(() => {
|
|
39
|
+
return isSticky.value ? staticHeight.value : staticY.value;
|
|
40
|
+
});
|
|
25
41
|
</script>
|
|
26
42
|
|
|
27
43
|
<template>
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
44
|
+
<header
|
|
45
|
+
ref="header"
|
|
46
|
+
class="top-0 z-50 transition-colors"
|
|
47
|
+
:class="[
|
|
48
|
+
isSticky && !isSidenavOpen ? 'bg-white/80' : 'bg-white',
|
|
49
|
+
isSticky ? 'backdrop-blur-md shadow py-2 md:py-3' : 'py-3 sm:py-4 md:py-5',
|
|
50
|
+
]"
|
|
51
|
+
>
|
|
52
|
+
<div class="container lg:max-w-7xl mx-auto px-1 lg:pl-3
|
|
31
53
|
grid grid-flow-col grid-cols-3 justify-between items-center
|
|
32
|
-
md:grid-cols-none md:auto-cols-max"
|
|
33
|
-
data-header
|
|
34
|
-
>
|
|
54
|
+
md:grid-cols-none md:auto-cols-max">
|
|
35
55
|
<slot name="sidenav-toggle">
|
|
36
56
|
<div class="md:hidden" data-sidenav-toggle>
|
|
37
57
|
<button
|
|
@@ -40,12 +60,12 @@ const isSidenavOpen = ref(false);
|
|
|
40
60
|
@click="isSidenavOpen = !isSidenavOpen"
|
|
41
61
|
>
|
|
42
62
|
<slot name="sidenav-toggle-content">
|
|
43
|
-
<i
|
|
63
|
+
<i
|
|
64
|
+
class="text-base-500 text-3xl"
|
|
65
|
+
:class="isSidenavOpen ? 'i-close' : 'i-menu'"
|
|
66
|
+
></i>
|
|
44
67
|
</slot>
|
|
45
68
|
</button>
|
|
46
|
-
<Drawer v-model="isSidenavOpen" class="-ml-1 lg:-ml-3">
|
|
47
|
-
MENU
|
|
48
|
-
</Drawer>
|
|
49
69
|
</div>
|
|
50
70
|
</slot>
|
|
51
71
|
<slot name="logo" />
|
|
@@ -78,5 +98,14 @@ const isSidenavOpen = ref(false);
|
|
|
78
98
|
</div>
|
|
79
99
|
</slot>
|
|
80
100
|
</div>
|
|
81
|
-
|
|
101
|
+
<Drawer
|
|
102
|
+
v-model="isSidenavOpen"
|
|
103
|
+
:has-close-button="false"
|
|
104
|
+
position="absolute"
|
|
105
|
+
class="mt-2 -z-1"
|
|
106
|
+
:style="{ height: `calc(100vh - ${sidenavHeight}px + .5rem)` }"
|
|
107
|
+
>
|
|
108
|
+
<ShopSidenav class="bg-white pt-6" :categories="categories" />
|
|
109
|
+
</Drawer>
|
|
110
|
+
</header>
|
|
82
111
|
</template>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { CategoriesList } from '@cloudcommerce/api/types';
|
|
3
|
+
|
|
4
|
+
export interface Props {
|
|
5
|
+
categories: CategoriesList;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const props = defineProps<Props>();
|
|
9
|
+
const mainCategories = props.categories.filter(({ slug, parent }) => {
|
|
10
|
+
return slug && !parent;
|
|
11
|
+
});
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<aside data-sidenav>
|
|
16
|
+
<nav class="py-5" data-sidenav-nav>
|
|
17
|
+
<ul>
|
|
18
|
+
<li v-for="mainCategory in mainCategories" :key="mainCategory._id">
|
|
19
|
+
<a :href="`/${mainCategory.slug}`">
|
|
20
|
+
{{ mainCategory.name }}
|
|
21
|
+
</a>
|
|
22
|
+
</li>
|
|
23
|
+
</ul>
|
|
24
|
+
</nav>
|
|
25
|
+
</aside>
|
|
26
|
+
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { computed } from 'vue';
|
|
2
|
+
import { parseShippingPhrase } from '@@sf/state/modules-info';
|
|
3
|
+
|
|
4
|
+
export interface Props {
|
|
5
|
+
slides: Array<{
|
|
6
|
+
href?: string;
|
|
7
|
+
target?: string;
|
|
8
|
+
html: string;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const usePitchBar = (props: Props) => {
|
|
13
|
+
const parsedContents = computed(() => {
|
|
14
|
+
return props.slides.map(({ html }) => {
|
|
15
|
+
return parseShippingPhrase(html).value;
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
const countValidSlides = computed(() => {
|
|
19
|
+
return parsedContents.value.filter((html) => html).length;
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
parsedContents,
|
|
23
|
+
countValidSlides,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default usePitchBar;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import {
|
|
3
|
+
ref,
|
|
4
|
+
computed,
|
|
5
|
+
watch,
|
|
6
|
+
onMounted,
|
|
7
|
+
} from 'vue';
|
|
8
|
+
import {
|
|
9
|
+
promiseTimeout,
|
|
10
|
+
useTimeout,
|
|
11
|
+
useDebounceFn,
|
|
12
|
+
useScroll,
|
|
13
|
+
} from '@vueuse/core';
|
|
14
|
+
|
|
15
|
+
export interface Props {
|
|
16
|
+
header: Ref<HTMLElement>;
|
|
17
|
+
canSetStyles?: boolean;
|
|
18
|
+
canCreateHeightDiv?: boolean;
|
|
19
|
+
isShownOnScrollDown?: boolean;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const useStickyHeader = (props: Props) => {
|
|
23
|
+
const {
|
|
24
|
+
header,
|
|
25
|
+
canSetStyles,
|
|
26
|
+
canCreateHeightDiv,
|
|
27
|
+
isShownOnScrollDown,
|
|
28
|
+
} = {
|
|
29
|
+
canSetStyles: true,
|
|
30
|
+
canCreateHeightDiv: true,
|
|
31
|
+
...props,
|
|
32
|
+
};
|
|
33
|
+
const { ready, start } = useTimeout(100, { controls: true, immediate: false });
|
|
34
|
+
const staticHeight = ref(0);
|
|
35
|
+
const staticY = ref(0);
|
|
36
|
+
let heightDiv: HTMLElement | undefined;
|
|
37
|
+
const { y } = !import.meta.env.SSR ? useScroll(document) : { y: ref(0) };
|
|
38
|
+
const isSticky = computed(() => ready.value && y.value > staticY.value * 1.2);
|
|
39
|
+
const transition = ref('none');
|
|
40
|
+
watch(isSticky, async (_isSticky) => {
|
|
41
|
+
if (canSetStyles) {
|
|
42
|
+
header.value.style.position = _isSticky ? 'sticky' : null;
|
|
43
|
+
}
|
|
44
|
+
if (heightDiv) {
|
|
45
|
+
heightDiv.style.height = _isSticky ? `${staticHeight.value}px` : null;
|
|
46
|
+
}
|
|
47
|
+
if (!_isSticky) {
|
|
48
|
+
start();
|
|
49
|
+
transition.value = 'none';
|
|
50
|
+
} else {
|
|
51
|
+
await promiseTimeout(300);
|
|
52
|
+
transition.value = 'opacity var(--transition-slow), transform var(--transition)';
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
const isScrollUp = ref(false);
|
|
56
|
+
watch(y, (newY, oldY) => {
|
|
57
|
+
isScrollUp.value = newY > 0 && newY < oldY;
|
|
58
|
+
});
|
|
59
|
+
if (!import.meta.env.SSR) {
|
|
60
|
+
onMounted(() => {
|
|
61
|
+
const fixHeight = () => {
|
|
62
|
+
staticHeight.value = header.value.offsetHeight;
|
|
63
|
+
staticY.value = staticHeight.value
|
|
64
|
+
+ window.pageYOffset + header.value.getBoundingClientRect().top;
|
|
65
|
+
start();
|
|
66
|
+
};
|
|
67
|
+
const imgs = header.value.getElementsByTagName('IMG');
|
|
68
|
+
let isAllLoaded = true;
|
|
69
|
+
for (let i = 0; i < imgs.length; i++) {
|
|
70
|
+
const img = imgs[i] as HTMLImageElement;
|
|
71
|
+
if (!img.complete || img.naturalHeight === 0) {
|
|
72
|
+
isAllLoaded = false;
|
|
73
|
+
img.onload = fixHeight;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (isAllLoaded) {
|
|
77
|
+
fixHeight();
|
|
78
|
+
}
|
|
79
|
+
window.addEventListener('resize', useDebounceFn(fixHeight, 300));
|
|
80
|
+
if (canSetStyles) {
|
|
81
|
+
header.value.style.willChange = 'transform';
|
|
82
|
+
watch([isSticky, isScrollUp], ([_isSticky, _isScrollUp]) => {
|
|
83
|
+
let opacity: string | null = null;
|
|
84
|
+
let transform: string | null = null;
|
|
85
|
+
if (_isSticky && (!_isScrollUp || isShownOnScrollDown)) {
|
|
86
|
+
opacity = '0';
|
|
87
|
+
transform = 'translateY(-100%)';
|
|
88
|
+
}
|
|
89
|
+
header.value.style.opacity = opacity;
|
|
90
|
+
header.value.style.transform = transform;
|
|
91
|
+
});
|
|
92
|
+
watch(transition, (_transition) => {
|
|
93
|
+
header.value.style.transition = _transition;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
if (canCreateHeightDiv) {
|
|
97
|
+
heightDiv = document.createElement('div');
|
|
98
|
+
header.value.parentElement.insertBefore(heightDiv, header.value);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
staticHeight,
|
|
104
|
+
staticY,
|
|
105
|
+
isSticky,
|
|
106
|
+
isScrollUp,
|
|
107
|
+
transition,
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
export default useStickyHeader;
|
|
@@ -12,7 +12,9 @@ export interface Props {
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
<body>
|
|
15
|
+
<div id="teleported-overlap" class="relative z-50"></div>
|
|
16
|
+
<div id="teleported-top" class="relative z-0"></div>
|
|
15
17
|
<slot />
|
|
16
18
|
<slot name="before-body-end" />
|
|
17
|
-
<div id="teleported"></div>
|
|
19
|
+
<div id="teleported-bottom" class="relative z-0"></div>
|
|
18
20
|
</body>
|