cloudcommerce 0.24.1 → 0.25.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.
- package/CHANGELOG.md +18 -0
- package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
- package/ecomplus-stores/barra-doce/functions/ssr/package.json +7 -7
- package/ecomplus-stores/barra-doce/functions/ssr/src/main/Home.astro +6 -6
- package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
- package/ecomplus-stores/barra-doce/package.json +2 -2
- package/ecomplus-stores/iluminim/functions/many/package.json +3 -3
- package/ecomplus-stores/iluminim/functions/ssr/package.json +7 -7
- package/ecomplus-stores/iluminim/functions/with-apps/package.json +3 -3
- package/ecomplus-stores/iluminim/package.json +2 -2
- package/ecomplus-stores/monocard/functions/ssr/package.json +1 -1
- package/package.json +4 -4
- package/packages/api/package.json +1 -1
- package/packages/apps/affilate-program/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/datafrete/package.json +1 -1
- 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/flash-courier/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/galaxpay/package.json +1 -1
- package/packages/apps/google-analytics/package.json +1 -1
- package/packages/apps/jadlog/package.json +1 -1
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/melhor-envio/package.json +1 -1
- package/packages/apps/mercadopago/package.json +1 -1
- package/packages/apps/pagarme/package.json +1 -1
- package/packages/apps/paghiper/package.json +1 -1
- package/packages/apps/pix/package.json +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/apps/webhooks/package.json +1 -1
- package/packages/cli/lib/cli.js +5 -1
- package/packages/cli/package.json +1 -1
- package/packages/cli/src/cli.ts +5 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +1 -1
- package/packages/eslint/package.json +4 -4
- package/packages/events/package.json +1 -1
- package/packages/feeds/package.json +1 -1
- package/packages/firebase/package.json +2 -2
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/lib/firebase/serve-storefront.js +25 -21
- package/packages/ssr/lib/firebase/serve-storefront.js.map +1 -1
- package/packages/ssr/package.json +5 -5
- package/packages/ssr/src/firebase/serve-storefront.ts +27 -22
- package/packages/storefront/config/storefront.config.mjs +8 -2
- package/packages/storefront/package.json +7 -7
- package/packages/storefront/src/helpers/server-data.ts +14 -17
- package/packages/storefront/src/images/use-ssr-picture.ts +18 -3
- package/packages/storefront/src/lib/components/BannerPictures.astro +4 -4
- package/packages/storefront/src/lib/components/PaymentMethodFlag.vue +2 -2
- package/packages/storefront/src/lib/ssr-context.ts +1 -1
- package/packages/types/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [0.25.0](https://github.com/ecomplus/cloud-commerce/compare/v0.24.1...v0.25.0) (2023-08-23)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ⚠ BREAKING CHANGES
|
|
9
|
+
|
|
10
|
+
* **cli:** Host is now exposed by default on dev (default) CLI command, SSR function dev script should not contain --host and --port options
|
|
11
|
+
* **storefront:** Stop exporing non-reactive globals `settings` and `apiContext` from `@@sf/sf-lib`
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **cli:** Update `cloudcommerce [dev]` command to bypass --host and --port args ([e55e438](https://github.com/ecomplus/cloud-commerce/commit/e55e4383a8de2a9ff1d65b0af766c3e8980b1121))
|
|
16
|
+
* **deps:** Update non-major dependencies ([#216](https://github.com/ecomplus/cloud-commerce/issues/216)) ([377e4b0](https://github.com/ecomplus/cloud-commerce/commit/377e4b0533cb41d839afff1cfc4f8c44caeffa0f))
|
|
17
|
+
* **firebase:** Update dependency @google-cloud/pubsub to v4 ([#217](https://github.com/ecomplus/cloud-commerce/issues/217)) ([d5e98b8](https://github.com/ecomplus/cloud-commerce/commit/d5e98b84937a5be3062972e49480fc98bc9ffe70))
|
|
18
|
+
* **ssr:** Redirect not found .css files to unique CSS filepath ([d2dcaf9](https://github.com/ecomplus/cloud-commerce/commit/d2dcaf99551e2581027f07c62a1beddec46ec896))
|
|
19
|
+
* **storefront:** Prevent undefined `import.meta.env` error on config ([83c26f6](https://github.com/ecomplus/cloud-commerce/commit/83c26f660c307e366c139c489e75f8bc2450dc1b))
|
|
20
|
+
* **storefront:** Set `socialNetworks` after route load on SSR ([9d2be60](https://github.com/ecomplus/cloud-commerce/commit/9d2be602937f4d61ca0c96cdc6170a717ff5b3f0))
|
|
21
|
+
* **storefront:** Update Astro to v2.10.12 ([#215](https://github.com/ecomplus/cloud-commerce/issues/215)) ([4ae833f](https://github.com/ecomplus/cloud-commerce/commit/4ae833f25438626e268019e7ea9032a14aa1abf8))
|
|
22
|
+
|
|
5
23
|
### [0.24.1](https://github.com/ecomplus/cloud-commerce/compare/v0.24.0...v0.24.1) (2023-08-19)
|
|
6
24
|
|
|
7
25
|
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cloudcommerce/feeds": "^0.24.
|
|
19
|
-
"@cloudcommerce/firebase": "^0.24.
|
|
20
|
-
"@cloudcommerce/passport": "^0.24.
|
|
18
|
+
"@cloudcommerce/feeds": "^0.24.1",
|
|
19
|
+
"@cloudcommerce/firebase": "^0.24.1",
|
|
20
|
+
"@cloudcommerce/passport": "^0.24.1"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"private": true,
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"dev": "astro dev
|
|
6
|
+
"dev": "astro dev",
|
|
7
7
|
"build": "bash scripts/build.sh",
|
|
8
8
|
"build:static": "BUILD_OUTPUT=static astro build",
|
|
9
9
|
"serve": "firebase emulators:start --only functions",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
},
|
|
18
18
|
"main": "index.js",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@cloudcommerce/api": "^0.24.
|
|
21
|
-
"@cloudcommerce/firebase": "^0.24.
|
|
22
|
-
"@cloudcommerce/ssr": "^0.24.
|
|
20
|
+
"@cloudcommerce/api": "^0.24.1",
|
|
21
|
+
"@cloudcommerce/firebase": "^0.24.1",
|
|
22
|
+
"@cloudcommerce/ssr": "^0.24.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@cloudcommerce/i18n": "^0.24.
|
|
26
|
-
"@cloudcommerce/storefront": "^0.24.
|
|
27
|
-
"@cloudcommerce/types": "^0.24.
|
|
25
|
+
"@cloudcommerce/i18n": "^0.24.1",
|
|
26
|
+
"@cloudcommerce/storefront": "^0.24.1",
|
|
27
|
+
"@cloudcommerce/types": "^0.24.1",
|
|
28
28
|
"@fontsource/croissant-one": "^5.0.5",
|
|
29
29
|
"@iconify-json/mingcute": "^1.1.7"
|
|
30
30
|
}
|
|
@@ -14,22 +14,22 @@ const heroSlides = heroSlider.slides;
|
|
|
14
14
|
<HeroSlider {...heroSlider} client:load>
|
|
15
15
|
{heroSlides[0] && <BannerPictures
|
|
16
16
|
slot="picture-0" {...heroSlides[0]} index={0}
|
|
17
|
-
widths={[856, 1024, 1536]} class="max-w-
|
|
17
|
+
widths={[640, 856, 1024, 1536]} class="max-w-screen-sm sm:max-w-screen-lg" />}
|
|
18
18
|
{heroSlides[1] && <BannerPictures
|
|
19
19
|
slot="picture-1" {...heroSlides[1]} index={1}
|
|
20
|
-
widths={[856, 1024, 1536]} class="max-w-
|
|
20
|
+
widths={[856, 1024, 1536]} class="max-w-screen-sm sm:max-w-screen-lg" />}
|
|
21
21
|
{heroSlides[2] && <BannerPictures
|
|
22
22
|
slot="picture-2" {...heroSlides[2]} index={2}
|
|
23
|
-
widths={[856, 1024, 1536]} class="max-w-
|
|
23
|
+
widths={[856, 1024, 1536]} class="max-w-screen-sm sm:max-w-screen-lg" />}
|
|
24
24
|
{heroSlides[3] && <BannerPictures
|
|
25
25
|
slot="picture-3" {...heroSlides[3]} index={3}
|
|
26
|
-
widths={[856, 1024, 1536]} class="max-w-
|
|
26
|
+
widths={[856, 1024, 1536]} class="max-w-screen-sm sm:max-w-screen-lg" />}
|
|
27
27
|
{heroSlides[4] && <BannerPictures
|
|
28
28
|
slot="picture-4" {...heroSlides[4]} index={4}
|
|
29
|
-
widths={[856, 1024, 1536]} class="max-w-
|
|
29
|
+
widths={[856, 1024, 1536]} class="max-w-screen-sm sm:max-w-screen-lg" />}
|
|
30
30
|
{heroSlides[5] && <BannerPictures
|
|
31
31
|
slot="picture-5" {...heroSlides[5]} index={5}
|
|
32
|
-
widths={[856, 1024, 1536]} class="max-w-
|
|
32
|
+
widths={[856, 1024, 1536]} class="max-w-screen-sm sm:max-w-screen-lg" />}
|
|
33
33
|
<!-- https://github.com/withastro/astro/issues/5066#issuecomment-1277998365 -->
|
|
34
34
|
</HeroSlider>
|
|
35
35
|
}
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cloudcommerce/events": "^0.24.
|
|
19
|
-
"@cloudcommerce/firebase": "^0.24.
|
|
20
|
-
"@cloudcommerce/modules": "^0.24.
|
|
18
|
+
"@cloudcommerce/events": "^0.24.1",
|
|
19
|
+
"@cloudcommerce/firebase": "^0.24.1",
|
|
20
|
+
"@cloudcommerce/modules": "^0.24.1"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"url": "https://github.com/ecomplus/cloud-commerce/issues"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@cloudcommerce/cli": "^0.24.
|
|
26
|
+
"@cloudcommerce/cli": "^0.24.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@cloudcommerce/eslint": "^0.24.
|
|
29
|
+
"@cloudcommerce/eslint": "^0.24.1"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cloudcommerce/feeds": "^0.24.
|
|
19
|
-
"@cloudcommerce/firebase": "^0.24.
|
|
20
|
-
"@cloudcommerce/passport": "^0.24.
|
|
18
|
+
"@cloudcommerce/feeds": "^0.24.1",
|
|
19
|
+
"@cloudcommerce/firebase": "^0.24.1",
|
|
20
|
+
"@cloudcommerce/passport": "^0.24.1"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"private": true,
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"dev": "astro dev
|
|
6
|
+
"dev": "astro dev",
|
|
7
7
|
"build": "bash scripts/build.sh",
|
|
8
8
|
"build:static": "BUILD_OUTPUT=static astro build",
|
|
9
9
|
"serve": "firebase emulators:start --only functions",
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
},
|
|
18
18
|
"main": "index.js",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@cloudcommerce/api": "^0.24.
|
|
21
|
-
"@cloudcommerce/firebase": "^0.24.
|
|
22
|
-
"@cloudcommerce/ssr": "^0.24.
|
|
20
|
+
"@cloudcommerce/api": "^0.24.1",
|
|
21
|
+
"@cloudcommerce/firebase": "^0.24.1",
|
|
22
|
+
"@cloudcommerce/ssr": "^0.24.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@cloudcommerce/i18n": "^0.24.
|
|
26
|
-
"@cloudcommerce/storefront": "^0.24.
|
|
27
|
-
"@cloudcommerce/types": "^0.24.
|
|
25
|
+
"@cloudcommerce/i18n": "^0.24.1",
|
|
26
|
+
"@cloudcommerce/storefront": "^0.24.1",
|
|
27
|
+
"@cloudcommerce/types": "^0.24.1",
|
|
28
28
|
"@fontsource-variable/heebo": "^5.0.5",
|
|
29
29
|
"@iconify-json/carbon": "^1.1.18"
|
|
30
30
|
}
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cloudcommerce/events": "^0.24.
|
|
19
|
-
"@cloudcommerce/firebase": "^0.24.
|
|
20
|
-
"@cloudcommerce/modules": "^0.24.
|
|
18
|
+
"@cloudcommerce/events": "^0.24.1",
|
|
19
|
+
"@cloudcommerce/firebase": "^0.24.1",
|
|
20
|
+
"@cloudcommerce/modules": "^0.24.1"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"url": "https://github.com/ecomplus/cloud-commerce/issues"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@cloudcommerce/cli": "^0.24.
|
|
26
|
+
"@cloudcommerce/cli": "^0.24.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@cloudcommerce/eslint": "^0.24.
|
|
29
|
+
"@cloudcommerce/eslint": "^0.24.1"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcommerce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.25.0",
|
|
5
5
|
"description": "Open fair-code headless commerce platform: API-first, microservices based, event driven and cloud native",
|
|
6
6
|
"main": "packages/api/lib/index.js",
|
|
7
7
|
"author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@commitlint/cli": "^17.7.1",
|
|
20
20
|
"@commitlint/config-conventional": "^17.7.0",
|
|
21
21
|
"@commitlint/rules": "^17.7.0",
|
|
22
|
-
"@types/node": "^18.17.
|
|
22
|
+
"@types/node": "^18.17.6",
|
|
23
23
|
"eslint": "^8.47.0",
|
|
24
24
|
"husky": "^8.0.3",
|
|
25
25
|
"standard-version": "^9.5.0",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"typescript": "~5.0.4",
|
|
29
29
|
"uglify-js": "^3.17.4",
|
|
30
30
|
"vite": "^4.4.9",
|
|
31
|
-
"vitest": "^0.34.
|
|
31
|
+
"vitest": "^0.34.2",
|
|
32
32
|
"zx": "^7.2.3",
|
|
33
|
-
"@cloudcommerce/eslint": "0.
|
|
33
|
+
"@cloudcommerce/eslint": "0.25.0"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"fix-install": "bash scripts/pre-install.sh && pnpm i",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/app-fb-conversions",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.25.0",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce app to send carts/orders to Facebook Conversions API",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"repository": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@cloudcommerce/api": "workspace:*",
|
|
23
23
|
"@cloudcommerce/firebase": "workspace:*",
|
|
24
|
-
"facebook-nodejs-business-sdk": "^17.0.
|
|
24
|
+
"facebook-nodejs-business-sdk": "^17.0.3",
|
|
25
25
|
"firebase-admin": "^11.10.1",
|
|
26
26
|
"firebase-functions": "^4.4.1"
|
|
27
27
|
},
|
package/packages/cli/lib/cli.js
CHANGED
|
@@ -147,7 +147,11 @@ Finish by saving the following secrets to your GitHub repository:
|
|
|
147
147
|
}
|
|
148
148
|
if (argv._.includes('dev') || !argv._.length) {
|
|
149
149
|
await prepareCodebases(true);
|
|
150
|
-
|
|
150
|
+
const prefix = path.join(pwd, 'functions/ssr');
|
|
151
|
+
// https://docs.astro.build/en/reference/cli-reference/#astro-dev
|
|
152
|
+
const host = typeof argv.host === 'string' ? argv.host : '';
|
|
153
|
+
const port = typeof argv.port === 'string' || typeof argv.port === 'number' ? argv.port : '';
|
|
154
|
+
return $`npm --prefix "${prefix}" run dev -- --host ${host} --port ${port}`;
|
|
151
155
|
}
|
|
152
156
|
return $`echo 'Hello from @cloudcommerce/cli'`;
|
|
153
157
|
};
|
package/packages/cli/src/cli.ts
CHANGED
|
@@ -180,7 +180,11 @@ Finish by saving the following secrets to your GitHub repository:
|
|
|
180
180
|
|
|
181
181
|
if (argv._.includes('dev') || !argv._.length) {
|
|
182
182
|
await prepareCodebases(true);
|
|
183
|
-
|
|
183
|
+
const prefix = path.join(pwd, 'functions/ssr');
|
|
184
|
+
// https://docs.astro.build/en/reference/cli-reference/#astro-dev
|
|
185
|
+
const host = typeof argv.host === 'string' ? argv.host : '';
|
|
186
|
+
const port = typeof argv.port === 'string' || typeof argv.port === 'number' ? argv.port : '';
|
|
187
|
+
return $`npm --prefix "${prefix}" run dev -- --host ${host} --port ${port}`;
|
|
184
188
|
}
|
|
185
189
|
return $`echo 'Hello from @cloudcommerce/cli'`;
|
|
186
190
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/eslint",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.25.0",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce ESLint config",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"repository": {
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
"build": "echo '@ecomplus/eslint'"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
23
|
-
"@typescript-eslint/parser": "^6.
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "^6.4.0",
|
|
23
|
+
"@typescript-eslint/parser": "^6.4.0",
|
|
24
24
|
"eslint": "^8.47.0",
|
|
25
25
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
26
|
-
"eslint-plugin-import": "^2.28.
|
|
26
|
+
"eslint-plugin-import": "^2.28.1",
|
|
27
27
|
"eslint-plugin-vue": "^9.17.0"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/firebase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.25.0",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce on Firebase",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@cloudcommerce/api": "workspace:*",
|
|
33
33
|
"@cloudcommerce/config": "workspace:*",
|
|
34
|
-
"@google-cloud/pubsub": "^
|
|
34
|
+
"@google-cloud/pubsub": "^4.0.1",
|
|
35
35
|
"firebase-admin": "^11.10.1",
|
|
36
36
|
"firebase-functions": "^4.4.1",
|
|
37
37
|
"source-map-support": "^0.5.21"
|
|
@@ -109,26 +109,10 @@ export default async (req, res) => {
|
|
|
109
109
|
proxy(req, res);
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return res.status(status)
|
|
117
|
-
.set('X-SSR-ID', `v1/${Date.now()}`)
|
|
118
|
-
.set('Cache-Control', cacheControl);
|
|
119
|
-
};
|
|
120
|
-
const fallback = (err, status = 500) => {
|
|
121
|
-
if (url !== '/~fallback' && (/\/[^/.]+$/.test(url) || /\.x?html$/.test(url))) {
|
|
122
|
-
setStatusAndCache(status, 'public, max-age=120')
|
|
123
|
-
.send('<html><head>'
|
|
124
|
-
+ '<meta http-equiv="refresh" content="0; '
|
|
125
|
-
+ `url=/~fallback?status=${status}&url=${encodeURIComponent(url)}"/>`
|
|
126
|
-
+ `</head><body>${err.toString()}</body></html>`);
|
|
127
|
-
} else {
|
|
128
|
-
setStatusAndCache(status, 'public, max-age=120, s-maxage=600')
|
|
129
|
-
.send(err.toString());
|
|
130
|
-
}
|
|
131
|
-
};
|
|
112
|
+
if (req.path.endsWith('.css') && cssFilepath) {
|
|
113
|
+
res.set('Cache-Control', 'max-age=3600').redirect(302, cssFilepath);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
132
116
|
if (req.path === '/_image') {
|
|
133
117
|
const { href } = req.query;
|
|
134
118
|
if (typeof href === 'string' && href.length > 3) {
|
|
@@ -169,7 +153,27 @@ export default async (req, res) => {
|
|
|
169
153
|
res.sendStatus(400);
|
|
170
154
|
return;
|
|
171
155
|
}
|
|
172
|
-
|
|
156
|
+
res.set('X-XSS-Protection', '1; mode=block');
|
|
157
|
+
const url = req.path.replace(/\.html$/, '');
|
|
158
|
+
const setStatusAndCache = (status, cacheControl) => {
|
|
159
|
+
if (res.headersSent) return res;
|
|
160
|
+
return res.status(status)
|
|
161
|
+
.set('X-SSR-ID', `v1/${Date.now()}`)
|
|
162
|
+
.set('Cache-Control', cacheControl);
|
|
163
|
+
};
|
|
164
|
+
const fallback = (err, status = 500) => {
|
|
165
|
+
if (url !== '/~fallback' && (/\/[^/.]+$/.test(url) || /\.x?html$/.test(url))) {
|
|
166
|
+
setStatusAndCache(status, 'public, max-age=120')
|
|
167
|
+
.send('<html><head>'
|
|
168
|
+
+ '<meta http-equiv="refresh" content="0; '
|
|
169
|
+
+ `url=/~fallback?status=${status}&url=${encodeURIComponent(url)}"/>`
|
|
170
|
+
+ `</head><body>${err.toString()}</body></html>`);
|
|
171
|
+
} else {
|
|
172
|
+
setStatusAndCache(status, 'public, max-age=120, s-maxage=600')
|
|
173
|
+
.send(err.toString());
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
/*
|
|
173
177
|
Check Response methods used by Astro Node.js integration:
|
|
174
178
|
https://github.com/withastro/astro/blob/main/packages/integrations/node/src/nodeMiddleware.ts
|
|
175
179
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serve-storefront.js","sourceRoot":"","sources":["../../src/firebase/serve-storefront.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,MAAM,MAAM,2BAA2B,CAAC;AAW/C,MAAM,EACJ,mBAAmB,EACnB,eAAe,EACf,iBAAiB,GAClB,GAAG,OAAO,CAAC,GAAG,CAAC;AAEhB,MAAM,OAAO,GAAG,mBAAmB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;AACrD,IAAI,cAAsB,CAAC;AAE3B,MAAM,WAAW,GAAiB,EAAE,CAAC;AAErC,IAAI,WAA+B,CAAC;AACpC,QAAQ,CAAC,QAAQ,CAAC,OAAO,EAAE,6BAA6B,CAAC,EAAE,OAAO,CAAC;KAChE,IAAI,CAAC,CAAC,cAAc,EAAE,EAAE;IACvB,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAC1C,MAAM,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACnC,IAAI,QAAQ;YAAE,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IACH,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,WAAW,GAAG,QAAQ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E,GAAG,CAAC,KAAK,CAAC,CAAC;YACxC,QAAQ,CAAC,GAAG,CAAC,CAAC;YACd,OAAO;SACR;QACD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC/E,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,IAAI,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;QAC7C,IAAI;YACF,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,CAAC;YACnC,iBAAiB,CAAC,GAAG,EAAE,kCAAkC,CAAC;iBACvD,IAAI,CAAC,IAAI,CAAC,CAAC;SACf;QAAC,OAAO,CAAC,EAAE;YACV,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;SAClB;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/ssr",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.25.0",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront SSR",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -24,21 +24,21 @@
|
|
|
24
24
|
"build:workers": "npx tsc -p src/cloudflare --outDir cloudflare && npx eslint --ext .js cloudflare --fix"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@astrojs/node": "5.3.
|
|
27
|
+
"@astrojs/node": "5.3.5",
|
|
28
28
|
"@cloudcommerce/api": "workspace:*",
|
|
29
29
|
"@cloudcommerce/firebase": "workspace:*",
|
|
30
30
|
"@cloudcommerce/i18n": "workspace:*",
|
|
31
31
|
"@ecomplus/utils": "1.5.0-rc.5",
|
|
32
|
-
"@headlessui/vue": "^1.7.
|
|
32
|
+
"@headlessui/vue": "^1.7.16",
|
|
33
33
|
"@vueuse/core": "10.3.0",
|
|
34
|
-
"astro": "2.10.
|
|
34
|
+
"astro": "2.10.12",
|
|
35
35
|
"firebase-admin": "^11.10.1",
|
|
36
36
|
"firebase-functions": "^4.4.1",
|
|
37
37
|
"vue": "^3.3.4"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@cloudcommerce/types": "workspace:*",
|
|
41
|
-
"@cloudflare/workers-types": "^4.
|
|
41
|
+
"@cloudflare/workers-types": "^4.20230814.0",
|
|
42
42
|
"@firebase/app-types": "^0.9.0"
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -132,28 +132,10 @@ export default async (req: Request, res: Response) => {
|
|
|
132
132
|
proxy(req, res);
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
if (res.headersSent) return res;
|
|
140
|
-
return res.status(status)
|
|
141
|
-
.set('X-SSR-ID', `v1/${Date.now()}`)
|
|
142
|
-
.set('Cache-Control', cacheControl);
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
const fallback = (err: any, status = 500) => {
|
|
146
|
-
if (url !== '/~fallback' && (/\/[^/.]+$/.test(url) || /\.x?html$/.test(url))) {
|
|
147
|
-
setStatusAndCache(status, 'public, max-age=120')
|
|
148
|
-
.send('<html><head>'
|
|
149
|
-
+ '<meta http-equiv="refresh" content="0; '
|
|
150
|
-
+ `url=/~fallback?status=${status}&url=${encodeURIComponent(url)}"/>`
|
|
151
|
-
+ `</head><body>${err.toString()}</body></html>`);
|
|
152
|
-
} else {
|
|
153
|
-
setStatusAndCache(status, 'public, max-age=120, s-maxage=600')
|
|
154
|
-
.send(err.toString());
|
|
155
|
-
}
|
|
156
|
-
};
|
|
135
|
+
if (req.path.endsWith('.css') && cssFilepath) {
|
|
136
|
+
res.set('Cache-Control', 'max-age=3600').redirect(302, cssFilepath);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
157
139
|
|
|
158
140
|
if (req.path === '/_image') {
|
|
159
141
|
const { href } = req.query;
|
|
@@ -196,6 +178,29 @@ export default async (req: Request, res: Response) => {
|
|
|
196
178
|
return;
|
|
197
179
|
}
|
|
198
180
|
|
|
181
|
+
res.set('X-XSS-Protection', '1; mode=block');
|
|
182
|
+
const url = req.path.replace(/\.html$/, '');
|
|
183
|
+
|
|
184
|
+
const setStatusAndCache = (status: number, cacheControl: string) => {
|
|
185
|
+
if (res.headersSent) return res;
|
|
186
|
+
return res.status(status)
|
|
187
|
+
.set('X-SSR-ID', `v1/${Date.now()}`)
|
|
188
|
+
.set('Cache-Control', cacheControl);
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
const fallback = (err: any, status = 500) => {
|
|
192
|
+
if (url !== '/~fallback' && (/\/[^/.]+$/.test(url) || /\.x?html$/.test(url))) {
|
|
193
|
+
setStatusAndCache(status, 'public, max-age=120')
|
|
194
|
+
.send('<html><head>'
|
|
195
|
+
+ '<meta http-equiv="refresh" content="0; '
|
|
196
|
+
+ `url=/~fallback?status=${status}&url=${encodeURIComponent(url)}"/>`
|
|
197
|
+
+ `</head><body>${err.toString()}</body></html>`);
|
|
198
|
+
} else {
|
|
199
|
+
setStatusAndCache(status, 'public, max-age=120, s-maxage=600')
|
|
200
|
+
.send(err.toString());
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
|
|
199
204
|
/*
|
|
200
205
|
Check Response methods used by Astro Node.js integration:
|
|
201
206
|
https://github.com/withastro/astro/blob/main/packages/integrations/node/src/nodeMiddleware.ts
|
|
@@ -4,9 +4,15 @@ import config from '@cloudcommerce/config';
|
|
|
4
4
|
import './storefront.cms.js';
|
|
5
5
|
|
|
6
6
|
export default () => {
|
|
7
|
-
const {
|
|
7
|
+
const {
|
|
8
|
+
ECOM_STORE_ID,
|
|
9
|
+
VITE_ECOM_STORE_ID,
|
|
10
|
+
PROD,
|
|
11
|
+
} = import.meta.env || process.env;
|
|
8
12
|
if (VITE_ECOM_STORE_ID) {
|
|
9
13
|
config.set({ storeId: Number(VITE_ECOM_STORE_ID) });
|
|
14
|
+
} else if (ECOM_STORE_ID) {
|
|
15
|
+
config.set({ storeId: Number(ECOM_STORE_ID) });
|
|
10
16
|
}
|
|
11
17
|
|
|
12
18
|
const {
|
|
@@ -29,7 +35,7 @@ export default () => {
|
|
|
29
35
|
} catch {
|
|
30
36
|
//
|
|
31
37
|
}
|
|
32
|
-
if (!storeId &&
|
|
38
|
+
if (!storeId && !PROD) {
|
|
33
39
|
storeId = 1011;
|
|
34
40
|
console.warn('> `storeId` is not set, using fallback 1011 for dev only\n');
|
|
35
41
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/storefront",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.25.0",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront with Astro",
|
|
6
6
|
"bin": {
|
|
7
7
|
"storefront": "./scripts/build-prod.sh"
|
|
@@ -30,29 +30,29 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@astrojs/image": "0.17.3",
|
|
33
|
-
"@astrojs/node": "5.3.
|
|
33
|
+
"@astrojs/node": "5.3.5",
|
|
34
34
|
"@astrojs/vue": "2.2.1",
|
|
35
35
|
"@cloudcommerce/api": "workspace:*",
|
|
36
36
|
"@cloudcommerce/config": "workspace:*",
|
|
37
37
|
"@cloudcommerce/i18n": "workspace:*",
|
|
38
38
|
"@ecomplus/utils": "1.5.0-rc.5",
|
|
39
39
|
"@fastify/deepmerge": "^1.3.0",
|
|
40
|
-
"@headlessui/vue": "^1.7.
|
|
40
|
+
"@headlessui/vue": "^1.7.16",
|
|
41
41
|
"@iconify-json/fa6-brands": "^1.1.13",
|
|
42
42
|
"@iconify-json/heroicons": "^1.1.12",
|
|
43
43
|
"@iconify-json/logos": "^1.1.34",
|
|
44
44
|
"@vite-pwa/astro": "^0.1.1",
|
|
45
45
|
"@vueuse/core": "10.3.0",
|
|
46
|
-
"astro": "2.10.
|
|
46
|
+
"astro": "2.10.12",
|
|
47
47
|
"chroma-js": "^2.4.2",
|
|
48
48
|
"dotenv": "^16.3.1",
|
|
49
|
-
"firebase": "^10.
|
|
49
|
+
"firebase": "^10.2.0",
|
|
50
50
|
"image-size": "^1.0.2",
|
|
51
51
|
"mime": "^3.0.0",
|
|
52
52
|
"semver": "^7.5.4",
|
|
53
|
-
"sharp": "^0.32.
|
|
53
|
+
"sharp": "^0.32.5",
|
|
54
54
|
"tailwindcss": "^3.3.3",
|
|
55
|
-
"unocss": "^0.55.
|
|
55
|
+
"unocss": "^0.55.2",
|
|
56
56
|
"vite": "^4.4.9",
|
|
57
57
|
"vite-plugin-pwa": "^0.16.4",
|
|
58
58
|
"vue": "^3.3.4"
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
const {
|
|
2
|
-
settings,
|
|
3
|
-
apiContext,
|
|
4
|
-
} = globalThis.$storefront;
|
|
5
|
-
|
|
6
1
|
const networkNames = [
|
|
7
2
|
'whatsapp',
|
|
8
3
|
'instagram',
|
|
@@ -17,16 +12,18 @@ const networkNames = [
|
|
|
17
12
|
export type NetworkName = typeof networkNames[number];
|
|
18
13
|
|
|
19
14
|
const socialNetworks: Partial<Record<NetworkName, string>> = {};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
const setSocialNetworks = () => {
|
|
16
|
+
const { settings } = globalThis.$storefront;
|
|
17
|
+
networkNames.forEach((network: NetworkName) => {
|
|
18
|
+
if (settings[network]) {
|
|
19
|
+
socialNetworks[network] = settings[network];
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
if (import.meta.env.SSR) {
|
|
24
|
+
global.$storefront.onLoad(() => setSocialNetworks());
|
|
25
|
+
} else {
|
|
26
|
+
setSocialNetworks();
|
|
27
|
+
}
|
|
31
28
|
|
|
32
|
-
export
|
|
29
|
+
export { socialNetworks };
|
|
@@ -63,10 +63,25 @@ const useSSRPicture = async (params: UsePictureParams) => {
|
|
|
63
63
|
}
|
|
64
64
|
} else if ((!attrs.width || !attrs.height) && typeof src === 'string') {
|
|
65
65
|
const { width, height } = tryImageSize(src);
|
|
66
|
-
if (height) {
|
|
66
|
+
if (width && height) {
|
|
67
67
|
aspectRatio = getAspectRatio({ width, height }, tryImageSize);
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
let hasSplicedWidths = false;
|
|
69
|
+
for (let i = widths.length - 1; i >= 0; i--) {
|
|
70
|
+
if (widths[i] > width) {
|
|
71
|
+
widths.splice(i, 1);
|
|
72
|
+
hasSplicedWidths = true;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (hasSplicedWidths) {
|
|
76
|
+
attrs.width = width;
|
|
77
|
+
attrs.height = height;
|
|
78
|
+
if (!widths.find((w) => w === width)) {
|
|
79
|
+
widths.push(width);
|
|
80
|
+
}
|
|
81
|
+
} else {
|
|
82
|
+
attrs.width = Math.max(...widths);
|
|
83
|
+
attrs.height = Math.round(attrs.width / aspectRatio);
|
|
84
|
+
}
|
|
70
85
|
}
|
|
71
86
|
}
|
|
72
87
|
let sizes: string = propSizes || '';
|
|
@@ -18,8 +18,8 @@ const {
|
|
|
18
18
|
subtitle,
|
|
19
19
|
buttonText,
|
|
20
20
|
index,
|
|
21
|
-
class: className = 'max-w-screen-2xl',
|
|
22
|
-
mobileClass = 'max-w-screen-sm',
|
|
21
|
+
class: className = 'max-w-screen-sm sm:max-w-[828px] md:max-w-screen-2xl',
|
|
22
|
+
mobileClass = 'max-w-screen-sm sm:max-w-screen-lg',
|
|
23
23
|
} = Astro.props as Props;
|
|
24
24
|
const hasHeader = title || subtitle || buttonText;
|
|
25
25
|
let { widths, mobileWidths } = Astro.props;
|
|
@@ -27,14 +27,14 @@ if (!widths?.length) {
|
|
|
27
27
|
if (mobileImg) {
|
|
28
28
|
widths = [1536, 2048];
|
|
29
29
|
} else {
|
|
30
|
-
widths = [
|
|
30
|
+
widths = [640, 828, 1536, 2048];
|
|
31
31
|
if (hasHeader) {
|
|
32
32
|
widths = widths.map((w) => (w / 2));
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
if (!mobileWidths?.length) {
|
|
37
|
-
mobileWidths = [
|
|
37
|
+
mobileWidths = [640, 1024];
|
|
38
38
|
}
|
|
39
39
|
---
|
|
40
40
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { SettingsContent } from '@@sf/content';
|
|
3
3
|
import { computed } from 'vue';
|
|
4
4
|
|
|
5
5
|
export interface Props {
|
|
6
6
|
as?: string;
|
|
7
|
-
flag:
|
|
7
|
+
flag: Exclude<SettingsContent['payment_methods'], undefined>[number];
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
const props = withDefaults(defineProps<Props>(), {
|