cloudcommerce 0.26.4 → 0.26.6
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/.github/workflows/create-release.yml +1 -1
- package/.github/workflows/{test-e2e.yml → test-apps.yml} +19 -5
- package/CHANGELOG.md +25 -0
- package/ecomplus-stores/barra-doce/functions/many/package.json +3 -3
- package/ecomplus-stores/barra-doce/functions/ssr/package.json +6 -6
- package/ecomplus-stores/barra-doce/functions/with-apps/package.json +3 -3
- package/ecomplus-stores/barra-doce/package.json +2 -2
- package/package.json +7 -7
- package/packages/api/package.json +1 -1
- package/packages/apps/affilate-program/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 +2 -2
- 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 +1 -1
- package/packages/apps/flash-courier/package.json +1 -1
- package/packages/apps/frenet/package.json +4 -2
- package/packages/apps/frenet/scripts/tests.sh +7 -0
- package/packages/apps/frenet/tests/calculate-shipping.test.mjs +37 -0
- 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 +2 -2
- package/packages/apps/melhor-envio/package.json +1 -1
- package/packages/apps/mercadopago/package.json +2 -2
- package/packages/apps/mercadopago/scripts/tests.sh +7 -0
- 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 +3 -0
- package/packages/cli/package.json +1 -1
- package/packages/cli/src/cli.ts +4 -0
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +3 -3
- 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 +2 -2
- package/packages/passport/package.json +1 -1
- package/packages/ssr/package.json +2 -2
- package/packages/storefront/package.json +4 -4
- package/packages/storefront/src/lib/components/ContentClearfix.astro +12 -0
- package/packages/storefront/src/lib/composables/use-breadcrumbs.ts +84 -0
- package/packages/storefront/src/lib/composables/use-shared-data.ts +14 -5
- package/packages/storefront/src/lib/content.d.ts +3 -3
- package/packages/storefront/src/lib/layouts/use-page-main.ts +23 -2
- package/packages/storefront/src/lib/ssr-context.ts +17 -5
- package/packages/test-base/package.json +1 -1
- package/packages/test-base/payloads/calculate-shipping.json +4 -4
- package/packages/test-base/payloads/create-transaction.json +1 -1
- package/packages/types/package.json +1 -1
- package/turbo.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
name: Run
|
|
1
|
+
name: Run module and app tests
|
|
2
2
|
|
|
3
3
|
on:
|
|
4
4
|
pull_request:
|
|
@@ -15,7 +15,7 @@ on:
|
|
|
15
15
|
branches:
|
|
16
16
|
- main
|
|
17
17
|
paths:
|
|
18
|
-
- ".github/workflows/test-
|
|
18
|
+
- ".github/workflows/test-apps.yml"
|
|
19
19
|
- "packages/**"
|
|
20
20
|
- "pnpm-lock.yaml"
|
|
21
21
|
- "!**/package.json"
|
|
@@ -34,9 +34,9 @@ jobs:
|
|
|
34
34
|
!contains(github.event.head_commit.author.name, '[bot]')
|
|
35
35
|
|
|
36
36
|
steps:
|
|
37
|
-
- uses: actions/checkout@
|
|
37
|
+
- uses: actions/checkout@v4
|
|
38
38
|
|
|
39
|
-
- uses: actions/checkout@
|
|
39
|
+
- uses: actions/checkout@v4
|
|
40
40
|
with:
|
|
41
41
|
repository: ecomplus/store
|
|
42
42
|
path: store
|
|
@@ -119,11 +119,25 @@ jobs:
|
|
|
119
119
|
ECOM_STORE_ID: ${{ secrets.ECOM_STORE_ID }}
|
|
120
120
|
ECOM_AUTHENTICATION_ID: ${{ secrets.ECOM_AUTHENTICATION_ID }}
|
|
121
121
|
ECOM_API_KEY: ${{ secrets.ECOM_API_KEY }}
|
|
122
|
+
MERCADOPAGO_TOKEN: ${{ secrets.MERCADOPAGO_TOKEN }}
|
|
122
123
|
run: |
|
|
124
|
+
printf "ECOM_AUTHENTICATION_ID=$ECOM_AUTHENTICATION_ID
|
|
125
|
+
ECOM_API_KEY=$ECOM_API_KEY
|
|
126
|
+
ECOM_STORE_ID=$ECOM_STORE_ID
|
|
127
|
+
" > functions/.env
|
|
128
|
+
npx cloudcommerce prepare
|
|
123
129
|
firebase --project=ecom2-demo emulators:start --only functions &
|
|
124
130
|
|
|
125
131
|
- name: Run tests
|
|
126
132
|
shell: bash
|
|
133
|
+
env:
|
|
134
|
+
ECOM_STORE_ID: ${{ secrets.ECOM_STORE_ID }}
|
|
135
|
+
ECOM_AUTHENTICATION_ID: ${{ secrets.ECOM_AUTHENTICATION_ID }}
|
|
136
|
+
ECOM_API_KEY: ${{ secrets.ECOM_API_KEY }}
|
|
137
|
+
MERCADOPAGO_TOKEN: ${{ secrets.MERCADOPAGO_TOKEN }}
|
|
138
|
+
FRENET_TOKEN: ${{ secrets.FRENET_TOKEN }}
|
|
139
|
+
GALAXPAY_ID: ${{ secrets.GALAXPAY_ID }}
|
|
140
|
+
GALAXPAY_HASH: ${{ secrets.GALAXPAY_HASH }}
|
|
127
141
|
run: |
|
|
128
142
|
sleep 10
|
|
129
|
-
pnpm test:
|
|
143
|
+
pnpm test:apps
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,31 @@
|
|
|
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.26.6](https://github.com/ecomplus/cloud-commerce/compare/v0.26.5...v0.26.6) (2023-09-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **apps:** Ensure `@cloudcommerce/test-base` as dev dependency only ([020a23d](https://github.com/ecomplus/cloud-commerce/commit/020a23d474e20a6712e51a04f16bd293035d8929))
|
|
11
|
+
|
|
12
|
+
### [0.26.5](https://github.com/ecomplus/cloud-commerce/compare/v0.26.4...v0.26.5) (2023-09-13)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **storefront:** Async loading CMS content for API doc page (wildcard by slug) ([5fc2010](https://github.com/ecomplus/cloud-commerce/commit/5fc2010ab897a81c142014a1cd207e428e910974))
|
|
18
|
+
* **storefront:** Handling new section type breadcrumbs ([c3af083](https://github.com/ecomplus/cloud-commerce/commit/c3af0838691db06ecd5aaa31d9619b49cfdbdd01))
|
|
19
|
+
* **storefront:** New `useBreadcrumbs` server-side-first composable ([688c037](https://github.com/ecomplus/cloud-commerce/commit/688c03727210834413dc78cdfdca663b0ef80496))
|
|
20
|
+
* **storefront:** New bypassed section types expected for product page ([3e38002](https://github.com/ecomplus/cloud-commerce/commit/3e38002b398881a3ef44d4a916d009c7eeab6443))
|
|
21
|
+
* **storefront:** New ContentClearfix.astro component for user's html content ([5873973](https://github.com/ecomplus/cloud-commerce/commit/58739737f47a494715492ba50116e651a95501b4))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* **deps:** Update non-major dependencies ([#234](https://github.com/ecomplus/cloud-commerce/issues/234)) ([62345c6](https://github.com/ecomplus/cloud-commerce/commit/62345c648901b88ee49c3fee77daa4eaafb4fbb9))
|
|
27
|
+
* **storefront:** Update `apiContext.doc` type with common required document fields ([7f814d9](https://github.com/ecomplus/cloud-commerce/commit/7f814d9fce20a5e8ba01a65ed515f557d3a7d194))
|
|
28
|
+
* **storefront:** Update `useSharedData` to timeout listeners (1s by default) ([9aa5d30](https://github.com/ecomplus/cloud-commerce/commit/9aa5d3018b9eb90397b64d66861a1e05096b9770))
|
|
29
|
+
|
|
5
30
|
### [0.26.4](https://github.com/ecomplus/cloud-commerce/compare/v0.26.3...v0.26.4) (2023-09-08)
|
|
6
31
|
|
|
7
32
|
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cloudcommerce/feeds": "^0.26.
|
|
19
|
-
"@cloudcommerce/firebase": "^0.26.
|
|
20
|
-
"@cloudcommerce/passport": "^0.26.
|
|
18
|
+
"@cloudcommerce/feeds": "^0.26.4",
|
|
19
|
+
"@cloudcommerce/firebase": "^0.26.4",
|
|
20
|
+
"@cloudcommerce/passport": "^0.26.4"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
@@ -17,14 +17,14 @@
|
|
|
17
17
|
},
|
|
18
18
|
"main": "index.js",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@cloudcommerce/api": "^0.26.
|
|
21
|
-
"@cloudcommerce/firebase": "^0.26.
|
|
22
|
-
"@cloudcommerce/ssr": "^0.26.
|
|
20
|
+
"@cloudcommerce/api": "^0.26.4",
|
|
21
|
+
"@cloudcommerce/firebase": "^0.26.4",
|
|
22
|
+
"@cloudcommerce/ssr": "^0.26.4"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@cloudcommerce/i18n": "^0.26.
|
|
26
|
-
"@cloudcommerce/storefront": "^0.26.
|
|
27
|
-
"@cloudcommerce/types": "^0.26.
|
|
25
|
+
"@cloudcommerce/i18n": "^0.26.4",
|
|
26
|
+
"@cloudcommerce/storefront": "^0.26.4",
|
|
27
|
+
"@cloudcommerce/types": "^0.26.4",
|
|
28
28
|
"@fontsource/croissant-one": "^5.0.9",
|
|
29
29
|
"@iconify-json/mingcute": "^1.1.9"
|
|
30
30
|
}
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"main": "index.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@cloudcommerce/events": "^0.26.
|
|
19
|
-
"@cloudcommerce/firebase": "^0.26.
|
|
20
|
-
"@cloudcommerce/modules": "^0.26.
|
|
18
|
+
"@cloudcommerce/events": "^0.26.4",
|
|
19
|
+
"@cloudcommerce/firebase": "^0.26.4",
|
|
20
|
+
"@cloudcommerce/modules": "^0.26.4"
|
|
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.26.
|
|
26
|
+
"@cloudcommerce/cli": "^0.26.4"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@cloudcommerce/eslint": "^0.26.
|
|
29
|
+
"@cloudcommerce/eslint": "^0.26.4"
|
|
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.26.
|
|
4
|
+
"version": "0.26.6",
|
|
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,8 +19,8 @@
|
|
|
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.
|
|
23
|
-
"eslint": "^8.
|
|
22
|
+
"@types/node": "^18.17.15",
|
|
23
|
+
"eslint": "^8.49.0",
|
|
24
24
|
"husky": "^8.0.3",
|
|
25
25
|
"standard-version": "^9.5.0",
|
|
26
26
|
"ts-node": "^10.9.1",
|
|
@@ -28,18 +28,18 @@
|
|
|
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.4",
|
|
32
32
|
"zx": "^7.2.3",
|
|
33
|
-
"@cloudcommerce/eslint": "0.26.
|
|
33
|
+
"@cloudcommerce/eslint": "0.26.6"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"fix-install": "bash scripts/pre-install.sh && pnpm i",
|
|
37
37
|
"postinstall": "husky install && pnpm run -r prepare-monorepo",
|
|
38
38
|
"new-pkg": "bash scripts/new-package.sh",
|
|
39
39
|
"build": "turbo run build --filter='!./ecomplus-stores/**'",
|
|
40
|
-
"
|
|
40
|
+
"build:apps": "turbo run build --filter='./packages/{apps/**,modules}'",
|
|
41
|
+
"test": "turbo run test --filter='!./ecomplus-stores/**' --filter='!./packages/{apps/**,modules}'",
|
|
41
42
|
"test:apps": "turbo run test --filter='./packages/{apps/**,modules}'",
|
|
42
|
-
"test:e2e": "turbo run test:e2e --filter='./packages/**'",
|
|
43
43
|
"release": "bash scripts/version-and-release.sh",
|
|
44
44
|
"store:run": "pnpm build && npm --prefix \"store\" run",
|
|
45
45
|
"start": "pnpm store:run start",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/app-correios",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.26.
|
|
4
|
+
"version": "0.26.6",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce app for Correios shipping calculation",
|
|
6
6
|
"main": "lib/correios.js",
|
|
7
7
|
"repository": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/apps/correios#readme",
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "bash ../../../scripts/build-lib.sh",
|
|
20
|
-
"test
|
|
20
|
+
"test": "node --test tests/"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@cloudcommerce/api": "workspace:*",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/app-custom-shipping",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.26.
|
|
4
|
+
"version": "0.26.6",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce app for custom shipping methods",
|
|
6
6
|
"main": "lib/custom-shipping.js",
|
|
7
7
|
"repository": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/apps/custom-shipping#readme",
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "bash ../../../scripts/build-lib.sh",
|
|
20
|
-
"test
|
|
20
|
+
"test": "node --test tests/"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@cloudcommerce/api": "workspace:*"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/app-frenet",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.26.
|
|
4
|
+
"version": "0.26.6",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce app for Frenet shipping calculation",
|
|
6
6
|
"main": "lib/frenet.js",
|
|
7
7
|
"exports": {
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
},
|
|
21
21
|
"homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/packages/apps/frenet#readme",
|
|
22
22
|
"scripts": {
|
|
23
|
-
"build": "bash ../../../scripts/build-lib.sh"
|
|
23
|
+
"build": "bash ../../../scripts/build-lib.sh",
|
|
24
|
+
"test": "bash scripts/tests.sh"
|
|
24
25
|
},
|
|
25
26
|
"dependencies": {
|
|
26
27
|
"@cloudcommerce/api": "workspace:*",
|
|
@@ -30,6 +31,7 @@
|
|
|
30
31
|
"firebase-functions": "^4.4.1"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
34
|
+
"@cloudcommerce/test-base": "workspace:*",
|
|
33
35
|
"@cloudcommerce/types": "workspace:*",
|
|
34
36
|
"@firebase/app-types": "^0.9.0"
|
|
35
37
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
2
|
+
import assert from 'node:assert';
|
|
3
|
+
import test, { before, describe } from 'node:test';
|
|
4
|
+
import {
|
|
5
|
+
modulesUrl,
|
|
6
|
+
bodyCalculateShipping,
|
|
7
|
+
} from '@cloudcommerce/test-base';
|
|
8
|
+
|
|
9
|
+
describe('Test Shipping Calculation in the Frenet App', async () => {
|
|
10
|
+
let req;
|
|
11
|
+
let data;
|
|
12
|
+
const appId = 1244;
|
|
13
|
+
|
|
14
|
+
before(async () => {
|
|
15
|
+
req = await fetch(`${modulesUrl}/calculate_shipping?app_id=${appId}`, {
|
|
16
|
+
method: 'POST',
|
|
17
|
+
body: JSON.stringify(bodyCalculateShipping),
|
|
18
|
+
headers: {
|
|
19
|
+
'Content-Type': 'application/json',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
data = (await req.json()).result;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
test('Check Status 200', async () => {
|
|
27
|
+
assert.strictEqual(req?.status, 200);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
test('Check validated is true', async () => {
|
|
31
|
+
assert.equal(data[0].validated, true);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('Have shipping services', async () => {
|
|
35
|
+
assert.equal(data[0].response.shipping_services.length > 0, true);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/app-loyalty-points",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.26.
|
|
4
|
+
"version": "0.26.6",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce app to handle simple loyalty points programs",
|
|
6
6
|
"main": "lib/loyalty-points.js",
|
|
7
7
|
"exports": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/apps/loyalty-points#readme",
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "bash ../../../scripts/build-lib.sh",
|
|
24
|
-
"test
|
|
24
|
+
"test": "node --test tests/"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@cloudcommerce/api": "workspace:*",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/app-mercadopago",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.26.
|
|
4
|
+
"version": "0.26.6",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce app to integrate Mercado Pago",
|
|
6
6
|
"main": "lib/mercadopago.js",
|
|
7
7
|
"exports": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/packages/apps/mercadopago#readme",
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "bash scripts/build.sh",
|
|
24
|
-
"test
|
|
24
|
+
"test": "bash scripts/tests.sh"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@cloudcommerce/api": "workspace:*",
|
package/packages/cli/lib/cli.js
CHANGED
|
@@ -145,6 +145,9 @@ Finish by saving the following secrets to your GitHub repository:
|
|
|
145
145
|
-- More info at https://github.com/ecomplus/store#getting-started
|
|
146
146
|
`;
|
|
147
147
|
}
|
|
148
|
+
if (argv._.includes('prepare')) {
|
|
149
|
+
return prepareCodebases();
|
|
150
|
+
}
|
|
148
151
|
if (argv._.includes('dev') || !argv._.length) {
|
|
149
152
|
await prepareCodebases(true);
|
|
150
153
|
const prefix = path.join(pwd, 'functions/ssr');
|
package/packages/cli/src/cli.ts
CHANGED
|
@@ -178,6 +178,10 @@ Finish by saving the following secrets to your GitHub repository:
|
|
|
178
178
|
`;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
+
if (argv._.includes('prepare')) {
|
|
182
|
+
return prepareCodebases();
|
|
183
|
+
}
|
|
184
|
+
|
|
181
185
|
if (argv._.includes('dev') || !argv._.length) {
|
|
182
186
|
await prepareCodebases(true);
|
|
183
187
|
const prefix = path.join(pwd, 'functions/ssr');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/emails",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.26.
|
|
4
|
+
"version": "0.26.6",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce email sender",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"@cloudcommerce/firebase": "workspace:*",
|
|
26
26
|
"axios": "^1.5.0",
|
|
27
27
|
"ejs": "^3.1.9",
|
|
28
|
-
"nodemailer": "^6.9.
|
|
28
|
+
"nodemailer": "^6.9.5"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@cloudcommerce/types": "workspace:*",
|
|
32
32
|
"@types/ejs": "^3.1.2",
|
|
33
|
-
"@types/nodemailer": "^6.4.
|
|
33
|
+
"@types/nodemailer": "^6.4.10"
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/eslint",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.26.
|
|
4
|
+
"version": "0.26.6",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce ESLint config",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"repository": {
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"build": "echo '@ecomplus/eslint'"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
23
|
-
"@typescript-eslint/parser": "^6.
|
|
24
|
-
"eslint": "^8.
|
|
22
|
+
"@typescript-eslint/eslint-plugin": "^6.6.0",
|
|
23
|
+
"@typescript-eslint/parser": "^6.6.0",
|
|
24
|
+
"eslint": "^8.49.0",
|
|
25
25
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
26
26
|
"eslint-plugin-import": "^2.28.1",
|
|
27
27
|
"eslint-plugin-vue": "^9.17.0"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/firebase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.26.
|
|
4
|
+
"version": "0.26.6",
|
|
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": "^4.0.
|
|
34
|
+
"@google-cloud/pubsub": "^4.0.5",
|
|
35
35
|
"firebase-admin": "^11.10.1",
|
|
36
36
|
"firebase-functions": "^4.4.1",
|
|
37
37
|
"source-map-support": "^0.5.21"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/modules",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.26.
|
|
4
|
+
"version": "0.26.6",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce modules API",
|
|
6
6
|
"main": "lib/index.cjs",
|
|
7
7
|
"exports": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"scripts": {
|
|
23
23
|
"build": "bash ../../scripts/build-lib.sh",
|
|
24
24
|
"build:types": "bash scripts/build-types.sh",
|
|
25
|
-
"test
|
|
25
|
+
"test": "node --test tests/modules.test.mjs"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@cloudcommerce/api": "workspace:*",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/ssr",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.26.
|
|
4
|
+
"version": "0.26.6",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront SSR",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@cloudcommerce/types": "workspace:*",
|
|
42
|
-
"@cloudflare/workers-types": "^4.
|
|
42
|
+
"@cloudflare/workers-types": "^4.20230904.0",
|
|
43
43
|
"@firebase/app-types": "^0.9.0"
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/storefront",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.26.
|
|
4
|
+
"version": "0.26.6",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront with Astro",
|
|
6
6
|
"bin": {
|
|
7
7
|
"storefront": "./scripts/build-prod.sh"
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"@headlessui/vue": "^1.7.16",
|
|
41
41
|
"@iconify-json/fa6-brands": "^1.1.13",
|
|
42
42
|
"@iconify-json/heroicons": "^1.1.12",
|
|
43
|
-
"@iconify-json/logos": "^1.1.
|
|
44
|
-
"@vite-pwa/astro": "^0.1.
|
|
43
|
+
"@iconify-json/logos": "^1.1.36",
|
|
44
|
+
"@vite-pwa/astro": "^0.1.3",
|
|
45
45
|
"@vueuse/core": "10.4.1",
|
|
46
46
|
"astro": "2.10.15",
|
|
47
47
|
"astro-capo": "^0.0.1",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"tailwindcss": "^3.3.3",
|
|
56
56
|
"unocss": "^0.55.7",
|
|
57
57
|
"vite": "^4.4.9",
|
|
58
|
-
"vite-plugin-pwa": "^0.16.
|
|
58
|
+
"vite-plugin-pwa": "^0.16.5",
|
|
59
59
|
"vue": "^3.3.4"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
export interface Props {
|
|
3
|
+
html: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const { html } = Astro.props;
|
|
7
|
+
const parsedHTML = html.replace(/<(img|iframe) /g, '<$1 loading="lazy" ');
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
<article class="overflow-x-auto lg:overflow-x-hidden prose !max-w-full">
|
|
11
|
+
<div class="[&_table]:max-w-full [&_img]:max-w-full" set:html={parsedHTML}></div>
|
|
12
|
+
</article>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Products,
|
|
3
|
+
Categories,
|
|
4
|
+
Brands,
|
|
5
|
+
Collections,
|
|
6
|
+
} from '@cloudcommerce/api/types';
|
|
7
|
+
import {
|
|
8
|
+
name as getName,
|
|
9
|
+
categoriesList as getCategoriesList,
|
|
10
|
+
} from '@ecomplus/utils';
|
|
11
|
+
import useSharedData from '@@sf/composables/use-shared-data';
|
|
12
|
+
|
|
13
|
+
export interface Props {
|
|
14
|
+
apiDoc?: Partial<Products | Categories | Brands | Collections>;
|
|
15
|
+
categories?: Partial<Categories>[];
|
|
16
|
+
domain?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const useBreadcrumbs = async (props: Props = {}) => {
|
|
20
|
+
const { settings, apiContext, data } = globalThis.$storefront;
|
|
21
|
+
const {
|
|
22
|
+
apiDoc = apiContext?.doc,
|
|
23
|
+
domain = settings.domain,
|
|
24
|
+
} = props;
|
|
25
|
+
let categories: Props['categories'] = props.categories || data.categories;
|
|
26
|
+
if (!categories) {
|
|
27
|
+
categories = (await useSharedData({ field: 'categories' })).value;
|
|
28
|
+
}
|
|
29
|
+
const breadcrumbs: Array<{ name: string, link: string }> = [];
|
|
30
|
+
if (apiDoc) {
|
|
31
|
+
const productCategories = (apiDoc as Products).categories;
|
|
32
|
+
if (productCategories) {
|
|
33
|
+
getCategoriesList(apiDoc).forEach((categoryName) => {
|
|
34
|
+
const findCategory = (category: Partial<Categories>) => {
|
|
35
|
+
return category.name === categoryName;
|
|
36
|
+
};
|
|
37
|
+
const category = (productCategories && productCategories.find(findCategory))
|
|
38
|
+
|| categories?.find(findCategory);
|
|
39
|
+
if (category) {
|
|
40
|
+
breadcrumbs.push({
|
|
41
|
+
name: getName(category),
|
|
42
|
+
link: `/${category.slug}`,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
breadcrumbs.push({
|
|
48
|
+
name: getName(apiDoc),
|
|
49
|
+
link: `/${apiDoc.slug}`,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
return {
|
|
53
|
+
breadcrumbs,
|
|
54
|
+
inlineJSONLd: domain
|
|
55
|
+
? JSON.stringify({
|
|
56
|
+
'@context': 'https://schema.org',
|
|
57
|
+
'@type': 'BreadcrumbList',
|
|
58
|
+
itemListElement: [
|
|
59
|
+
{
|
|
60
|
+
'@type': 'ListItem',
|
|
61
|
+
position: 1,
|
|
62
|
+
item: {
|
|
63
|
+
'@id': `https://${domain}/`,
|
|
64
|
+
name: 'Homepage',
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
].concat(breadcrumbs.map(({ name, link }, index) => {
|
|
68
|
+
return {
|
|
69
|
+
'@type': 'ListItem',
|
|
70
|
+
position: index + 2,
|
|
71
|
+
item: {
|
|
72
|
+
'@id': `https://${domain}${link}`,
|
|
73
|
+
name,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
})),
|
|
77
|
+
})
|
|
78
|
+
: null,
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export default useBreadcrumbs;
|
|
83
|
+
|
|
84
|
+
export { useBreadcrumbs };
|
|
@@ -3,11 +3,12 @@ import { EventEmitter } from 'node:events';
|
|
|
3
3
|
export interface Props {
|
|
4
4
|
field: string;
|
|
5
5
|
value?: any;
|
|
6
|
+
timeout?: number;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
const emitter = new EventEmitter();
|
|
9
10
|
|
|
10
|
-
const useSharedData = async ({ field, value }: Props) => {
|
|
11
|
+
const useSharedData = async ({ field, value, timeout = 1000 }: Props) => {
|
|
11
12
|
const $data = global.$storefront.data;
|
|
12
13
|
if (value) {
|
|
13
14
|
$data[field] = value;
|
|
@@ -16,7 +17,17 @@ const useSharedData = async ({ field, value }: Props) => {
|
|
|
16
17
|
value = $data[field];
|
|
17
18
|
} else {
|
|
18
19
|
value = await new Promise((resolve) => {
|
|
19
|
-
|
|
20
|
+
const callback = (_value: any) => {
|
|
21
|
+
resolve(_value);
|
|
22
|
+
// eslint-disable-next-line no-use-before-define
|
|
23
|
+
clearTimeout(timer);
|
|
24
|
+
};
|
|
25
|
+
const abort = () => {
|
|
26
|
+
resolve(null);
|
|
27
|
+
emitter.removeListener(field, callback);
|
|
28
|
+
};
|
|
29
|
+
const timer = setTimeout(abort, timeout);
|
|
30
|
+
emitter.once(field, callback);
|
|
20
31
|
});
|
|
21
32
|
}
|
|
22
33
|
return {
|
|
@@ -28,6 +39,4 @@ window.$storefront.data['${field}'] = ${JSON.stringify(value)};`,
|
|
|
28
39
|
|
|
29
40
|
export default useSharedData;
|
|
30
41
|
|
|
31
|
-
export {
|
|
32
|
-
useSharedData,
|
|
33
|
-
};
|
|
42
|
+
export { useSharedData };
|
|
@@ -11,9 +11,9 @@ export type LayoutContent = Omit<_LayoutContent, 'header' | 'footer'> & {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
export interface PageContent {
|
|
14
|
-
meta_title
|
|
15
|
-
meta_description
|
|
16
|
-
hero
|
|
14
|
+
meta_title?: string;
|
|
15
|
+
meta_description?: string;
|
|
16
|
+
hero?: {
|
|
17
17
|
[k: string]: unknown,
|
|
18
18
|
autoplay?: number,
|
|
19
19
|
slides: Array<{
|
|
@@ -3,6 +3,7 @@ import type { PageContent } from '@@sf/content';
|
|
|
3
3
|
import type { RouteContext } from '@@sf/ssr-context';
|
|
4
4
|
import type { Props as UseBannerProps } from '@@sf/composables/use-banner';
|
|
5
5
|
import type { Props as UseProductShelfProps } from '@@sf/composables/use-product-shelf';
|
|
6
|
+
import type { Props as UseBreadcrumbsProps } from '@@sf/composables/use-breadcrumbs';
|
|
6
7
|
import { useProductShelf } from '@@sf/composables/use-product-shelf';
|
|
7
8
|
|
|
8
9
|
export interface Props {
|
|
@@ -11,8 +12,9 @@ export interface Props {
|
|
|
11
12
|
Promise<{ props: Record<string, any> }>;
|
|
12
13
|
}
|
|
13
14
|
|
|
15
|
+
type PageContentHero = Exclude<PageContent['hero'], undefined>;
|
|
14
16
|
const now = Date.now();
|
|
15
|
-
const parseBanners = (banners:
|
|
17
|
+
const parseBanners = (banners: PageContentHero['slides']) => {
|
|
16
18
|
const validBanners: UseBannerProps[] = [];
|
|
17
19
|
banners.forEach(({
|
|
18
20
|
img,
|
|
@@ -38,7 +40,7 @@ const parseBanners = (banners: PageContent['hero']['slides']) => {
|
|
|
38
40
|
|
|
39
41
|
export const usePageHero = async ({ routeContext }: Props) => {
|
|
40
42
|
const { cmsContent } = routeContext;
|
|
41
|
-
const heroSlider: Omit<
|
|
43
|
+
const heroSlider: Omit<PageContentHero, 'slides'>
|
|
42
44
|
& { slides: UseBannerProps[] } = { slides: [] };
|
|
43
45
|
const heroContent = cmsContent?.hero;
|
|
44
46
|
if (heroContent) {
|
|
@@ -59,6 +61,11 @@ export const usePageSections = async <T extends CustomSection = CustomSection>
|
|
|
59
61
|
T
|
|
60
62
|
| { type: 'product-shelf', props: UseProductShelfProps }
|
|
61
63
|
| { type: 'banners-grid', props: { banners: UseBannerProps[] } }
|
|
64
|
+
| { type: 'breadcrumbs', props: UseBreadcrumbsProps }
|
|
65
|
+
| { type: 'product-details', props: {} }
|
|
66
|
+
| { type: 'related-products', props: {} }
|
|
67
|
+
| { type: 'doc-description', props: {} }
|
|
68
|
+
| { type: 'product-specifications', props: {} }
|
|
62
69
|
> = [];
|
|
63
70
|
if (sectionsContent) {
|
|
64
71
|
await Promise.all(sectionsContent.map(async ({ type, ...sectionContent }, index) => {
|
|
@@ -143,6 +150,20 @@ export const usePageSections = async <T extends CustomSection = CustomSection>
|
|
|
143
150
|
};
|
|
144
151
|
return;
|
|
145
152
|
}
|
|
153
|
+
switch (type) {
|
|
154
|
+
case 'breadcrumbs':
|
|
155
|
+
case 'product-details':
|
|
156
|
+
case 'related-products':
|
|
157
|
+
case 'doc-description':
|
|
158
|
+
case 'product-specifications':
|
|
159
|
+
// Bypassed sections
|
|
160
|
+
sections[index] = {
|
|
161
|
+
type,
|
|
162
|
+
props: {},
|
|
163
|
+
};
|
|
164
|
+
return;
|
|
165
|
+
default:
|
|
166
|
+
}
|
|
146
167
|
if (typeof handleCustomSection === 'function') {
|
|
147
168
|
const { props } = await handleCustomSection(
|
|
148
169
|
type as `${string}:${string}`,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AstroGlobal } from 'astro';
|
|
2
2
|
import type { BaseConfig } from '@cloudcommerce/config';
|
|
3
3
|
import type { ApiError, ApiEndpoint } from '@cloudcommerce/api';
|
|
4
|
-
import type { CategoriesList, BrandsList } from '@cloudcommerce/api/types';
|
|
4
|
+
import type { ResourceId, CategoriesList, BrandsList } from '@cloudcommerce/api/types';
|
|
5
5
|
import type { ContentGetter, SettingsContent, PageContent } from '@@sf/content';
|
|
6
6
|
import { EventEmitter } from 'node:events';
|
|
7
7
|
import api from '@cloudcommerce/api';
|
|
@@ -69,7 +69,7 @@ const loadRouteContext = async (Astro: Readonly<AstroGlobal>, {
|
|
|
69
69
|
const isHomepage = urlPath === '/';
|
|
70
70
|
const config = getConfig();
|
|
71
71
|
globalThis.$storefront.settings = config.settings;
|
|
72
|
-
let cmsContent: PageContent | null
|
|
72
|
+
let cmsContent: PageContent | null = { sections: [] };
|
|
73
73
|
const apiState: {
|
|
74
74
|
categories?: CategoriesList,
|
|
75
75
|
brands?: BrandsList,
|
|
@@ -83,9 +83,14 @@ const loadRouteContext = async (Astro: Readonly<AstroGlobal>, {
|
|
|
83
83
|
];
|
|
84
84
|
let fetchingApiContext: typeof apiPrefetchings[number] = null;
|
|
85
85
|
const apiContext: {
|
|
86
|
-
resource?: 'products' | 'categories' | 'brands' | 'collections'
|
|
87
|
-
doc?: Record<string, any
|
|
88
|
-
|
|
86
|
+
resource?: 'products' | 'categories' | 'brands' | 'collections';
|
|
87
|
+
doc?: Record<string, any> & {
|
|
88
|
+
_id: ResourceId;
|
|
89
|
+
store_id: number;
|
|
90
|
+
created_at: string;
|
|
91
|
+
updated_at: string;
|
|
92
|
+
};
|
|
93
|
+
error: ApiError | null;
|
|
89
94
|
} = {
|
|
90
95
|
error: null,
|
|
91
96
|
};
|
|
@@ -108,6 +113,13 @@ const loadRouteContext = async (Astro: Readonly<AstroGlobal>, {
|
|
|
108
113
|
Object.assign(apiContext, response.data);
|
|
109
114
|
const apiResource = apiContext.resource as
|
|
110
115
|
Exclude<typeof apiContext.resource, undefined>;
|
|
116
|
+
config.getContent(`pages/${apiResource}`)
|
|
117
|
+
.then((_cmsContent) => {
|
|
118
|
+
if (cmsContent && _cmsContent) {
|
|
119
|
+
Object.assign(cmsContent, _cmsContent);
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
.catch(console.warn);
|
|
111
123
|
const apiDoc = apiContext.doc as Record<string, any>;
|
|
112
124
|
apiState[`${apiResource}/${apiDoc._id}`] = apiDoc;
|
|
113
125
|
globalThis.$storefront.apiContext = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"to": {
|
|
3
|
-
"zip": "
|
|
3
|
+
"zip": "30140070"
|
|
4
4
|
},
|
|
5
5
|
"items": [
|
|
6
6
|
{
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"quantity": 1,
|
|
12
12
|
"currency_id": "BRL",
|
|
13
13
|
"currency_symbol": "R$",
|
|
14
|
-
"price":
|
|
15
|
-
"final_price":
|
|
14
|
+
"price": 500,
|
|
15
|
+
"final_price": 500,
|
|
16
16
|
"dimensions": {
|
|
17
17
|
"width": {
|
|
18
18
|
"unit": "cm",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
],
|
|
36
|
-
"subtotal":
|
|
36
|
+
"subtotal": 500
|
|
37
37
|
}
|