cloudcommerce 2.3.4 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/ecomplus-stores/barradoce/functions/many/package.json +3 -3
  3. package/ecomplus-stores/barradoce/functions/ssr/package.json +6 -6
  4. package/ecomplus-stores/barradoce/functions/with-apps/package.json +3 -3
  5. package/ecomplus-stores/barradoce/package.json +2 -2
  6. package/package.json +5 -5
  7. package/packages/api/package.json +1 -1
  8. package/packages/apps/affiliate-program/package.json +2 -2
  9. package/packages/apps/correios/package.json +3 -3
  10. package/packages/apps/custom-payment/package.json +1 -1
  11. package/packages/apps/custom-shipping/package.json +1 -1
  12. package/packages/apps/datafrete/package.json +2 -2
  13. package/packages/apps/discounts/package.json +1 -1
  14. package/packages/apps/emails/package.json +2 -2
  15. package/packages/apps/fb-conversions/package.json +2 -2
  16. package/packages/apps/flash-courier/package.json +2 -2
  17. package/packages/apps/frenet/package.json +2 -2
  18. package/packages/apps/galaxpay/package.json +2 -2
  19. package/packages/apps/google-analytics/package.json +2 -2
  20. package/packages/apps/jadlog/package.json +1 -1
  21. package/packages/apps/loyalty-points/package.json +1 -1
  22. package/packages/apps/mandae/package.json +2 -2
  23. package/packages/apps/melhor-envio/package.json +2 -2
  24. package/packages/apps/mercadopago/package.json +2 -2
  25. package/packages/apps/pagarme/package.json +3 -3
  26. package/packages/apps/pagarme-v5/package.json +2 -2
  27. package/packages/apps/paghiper/package.json +2 -2
  28. package/packages/apps/pix/package.json +2 -2
  29. package/packages/apps/tiny-erp/package.json +2 -2
  30. package/packages/apps/webhooks/package.json +2 -2
  31. package/packages/cli/package.json +2 -2
  32. package/packages/config/package.json +1 -1
  33. package/packages/emails/package.json +1 -1
  34. package/packages/eslint/package.json +4 -4
  35. package/packages/eslint/storefront.eslintrc.cjs +1 -0
  36. package/packages/events/package.json +2 -2
  37. package/packages/feeds/package.json +1 -1
  38. package/packages/firebase/package.json +4 -4
  39. package/packages/i18n/package.json +1 -1
  40. package/packages/modules/package.json +2 -2
  41. package/packages/passport/package.json +2 -2
  42. package/packages/ssr/package.json +4 -4
  43. package/packages/storefront/client.d.ts +1 -0
  44. package/packages/storefront/package.json +8 -7
  45. package/packages/storefront/src/decap-cms/gen-preview-container.ts +35 -16
  46. package/packages/storefront/src/decap-cms/get-cms-config.ts +2 -2
  47. package/packages/storefront/src/decap-cms/preview/webcontainer.ts +104 -0
  48. package/packages/storefront/src/env.d.ts +1 -0
  49. package/packages/storefront/src/lib/scripts/decap-cms.ts +41 -39
  50. package/packages/storefront/src/lib/ssr-context.ts +5 -0
  51. package/packages/test-base/package.json +1 -1
  52. 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
+ ### [2.4.2](https://github.com/ecomplus/cloud-commerce/compare/v2.4.1...v2.4.2) (2024-02-12)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * **deps:** Update non-major dependencies ([#325](https://github.com/ecomplus/cloud-commerce/issues/325)) ([9facbaf](https://github.com/ecomplus/cloud-commerce/commit/9facbafbd60eef8da9c4f033e1b2fb76567c07e5))
11
+ * **storefront:** Bump Vue to latest v3.4.18 ([ae61990](https://github.com/ecomplus/cloud-commerce/commit/ae619902e2fde3a3e5e5d7ab18e5198fcaf2f50e))
12
+ * **storefront:** Keep restarting CMS preview dev server on WebContainer [[#320](https://github.com/ecomplus/cloud-commerce/issues/320)] ([f463729](https://github.com/ecomplus/cloud-commerce/commit/f463729891819723f3cb769a0a406594450fce59))
13
+
14
+ ### [2.4.1](https://github.com/ecomplus/cloud-commerce/compare/v2.4.0...v2.4.1) (2024-02-10)
15
+
16
+ ## [2.4.0](https://github.com/ecomplus/cloud-commerce/compare/v2.3.4...v2.4.0) (2024-02-10)
17
+
18
+
19
+ ### Features
20
+
21
+ * **storefront:** Getting startep with new `scripts/decap-cms` ([bac0d21](https://github.com/ecomplus/cloud-commerce/commit/bac0d21fd1bd03abe53b283bda92c1c36b08098f)), closes [#320](https://github.com/ecomplus/cloud-commerce/issues/320)
22
+
5
23
  ### [2.3.4](https://github.com/ecomplus/cloud-commerce/compare/v2.3.3...v2.3.4) (2024-02-09)
6
24
 
7
25
  ### [2.3.3](https://github.com/ecomplus/cloud-commerce/compare/v2.3.2...v2.3.3) (2024-02-09)
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "main": "index.js",
17
17
  "dependencies": {
18
- "@cloudcommerce/feeds": "^2.3.2",
19
- "@cloudcommerce/firebase": "^2.3.2",
20
- "@cloudcommerce/passport": "^2.3.2"
18
+ "@cloudcommerce/feeds": "^2.4.1",
19
+ "@cloudcommerce/firebase": "^2.4.1",
20
+ "@cloudcommerce/passport": "^2.4.1"
21
21
  }
22
22
  }
@@ -18,15 +18,15 @@
18
18
  },
19
19
  "main": "index.js",
20
20
  "dependencies": {
21
- "@cloudcommerce/api": "^2.3.2",
22
- "@cloudcommerce/firebase": "^2.3.2",
23
- "@cloudcommerce/ssr": "^2.3.2",
21
+ "@cloudcommerce/api": "^2.4.1",
22
+ "@cloudcommerce/firebase": "^2.4.1",
23
+ "@cloudcommerce/ssr": "^2.4.1",
24
24
  "@headlessui/vue": "^1.7.18"
25
25
  },
26
26
  "devDependencies": {
27
- "@cloudcommerce/i18n": "^2.3.2",
28
- "@cloudcommerce/storefront": "^2.3.2",
29
- "@cloudcommerce/types": "^2.3.2",
27
+ "@cloudcommerce/i18n": "^2.4.1",
28
+ "@cloudcommerce/storefront": "^2.4.1",
29
+ "@cloudcommerce/types": "^2.4.1",
30
30
  "@iconify-json/mingcute": "^1.1.16",
31
31
  "photoswipe": "^5.4.3"
32
32
  }
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "main": "index.js",
17
17
  "dependencies": {
18
- "@cloudcommerce/events": "^2.3.2",
19
- "@cloudcommerce/firebase": "^2.3.2",
20
- "@cloudcommerce/modules": "^2.3.2"
18
+ "@cloudcommerce/events": "^2.4.1",
19
+ "@cloudcommerce/firebase": "^2.4.1",
20
+ "@cloudcommerce/modules": "^2.4.1"
21
21
  }
22
22
  }
@@ -26,10 +26,10 @@
26
26
  "url": "https://github.com/ecomplus/cloud-commerce/issues"
27
27
  },
28
28
  "dependencies": {
29
- "@cloudcommerce/cli": "^2.3.2"
29
+ "@cloudcommerce/cli": "^2.4.1"
30
30
  },
31
31
  "devDependencies": {
32
- "@cloudcommerce/eslint": "^2.3.2",
32
+ "@cloudcommerce/eslint": "^2.4.1",
33
33
  "husky": "^9.0.10",
34
34
  "lint-staged": "^15.2.2"
35
35
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cloudcommerce",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
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>",
@@ -23,20 +23,20 @@
23
23
  "@commitlint/cli": "^18.6.0",
24
24
  "@commitlint/config-conventional": "^18.6.0",
25
25
  "@commitlint/rules": "^18.6.0",
26
- "@types/node": "^18.19.14",
27
- "dotenv": "^16.4.1",
26
+ "@types/node": "^18.19.15",
27
+ "dotenv": "^16.4.2",
28
28
  "eslint": "^8.56.0",
29
29
  "husky": "^9.0.10",
30
30
  "lint-staged": "^15.2.2",
31
31
  "standard-version": "^9.5.0",
32
32
  "ts-node": "^10.9.2",
33
- "turbo": "^1.12.2",
33
+ "turbo": "^1.12.3",
34
34
  "typescript": "~5.2.2",
35
35
  "uglify-js": "^3.17.4",
36
36
  "vite": "^5.0.11",
37
37
  "vitest": "^1.2.2",
38
38
  "zx": "^7.2.3",
39
- "@cloudcommerce/eslint": "2.3.4"
39
+ "@cloudcommerce/eslint": "2.4.2"
40
40
  },
41
41
  "scripts": {
42
42
  "fix-install": "bash scripts/pre-install.sh && pnpm i",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/api",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce APIs client/adapter",
6
6
  "main": "lib/api.js",
7
7
  "types": "lib/api.d.ts",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-affiliate-program",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app for simple affiliate program",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -22,7 +22,7 @@
22
22
  "@cloudcommerce/api": "workspace:*",
23
23
  "@cloudcommerce/firebase": "workspace:*",
24
24
  "firebase-admin": "^12.0.0",
25
- "firebase-functions": "^4.6.0"
25
+ "firebase-functions": "^4.7.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@cloudcommerce/types": "workspace:*"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-correios",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app for Correios shipping calculation",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -26,10 +26,10 @@
26
26
  "dependencies": {
27
27
  "@cloudcommerce/api": "workspace:*",
28
28
  "@cloudcommerce/firebase": "workspace:*",
29
- "@google-cloud/pubsub": "^4.2.0",
29
+ "@google-cloud/pubsub": "^4.3.1",
30
30
  "axios": "^1.6.7",
31
31
  "firebase-admin": "^12.0.0",
32
- "firebase-functions": "^4.6.0"
32
+ "firebase-functions": "^4.7.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@cloudcommerce/test-base": "workspace:*",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-custom-payment",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app for simple custom payment methods",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-custom-shipping",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app for custom shipping methods",
6
6
  "main": "lib/custom-shipping.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-datafrete",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Datafrete shipping gateway ",
6
6
  "main": "lib/datafrete.js",
7
7
  "exports": {
@@ -28,7 +28,7 @@
28
28
  "@ecomplus/utils": "1.5.0-rc.6",
29
29
  "axios": "^1.6.7",
30
30
  "firebase-admin": "^12.0.0",
31
- "firebase-functions": "^4.6.0"
31
+ "firebase-functions": "^4.7.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@cloudcommerce/types": "workspace:*",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-discounts",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app for complex discount rules",
6
6
  "main": "lib/discounts.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-emails",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce default transactional email app",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -24,7 +24,7 @@
24
24
  "@cloudcommerce/firebase": "workspace:*",
25
25
  "@ecomplus/transactional-mails": "^2.0.2",
26
26
  "firebase-admin": "^12.0.0",
27
- "firebase-functions": "^4.6.0"
27
+ "firebase-functions": "^4.7.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@cloudcommerce/types": "workspace:*",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-fb-conversions",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
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": {
@@ -23,7 +23,7 @@
23
23
  "@cloudcommerce/firebase": "workspace:*",
24
24
  "facebook-nodejs-business-sdk": "^19.0.0",
25
25
  "firebase-admin": "^12.0.0",
26
- "firebase-functions": "^4.6.0"
26
+ "firebase-functions": "^4.7.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@cloudcommerce/types": "workspace:*",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-flash-courier",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Flash Courier",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -26,7 +26,7 @@
26
26
  "@cloudcommerce/api": "workspace:*",
27
27
  "@cloudcommerce/firebase": "workspace:*",
28
28
  "axios": "^1.6.7",
29
- "firebase-functions": "^4.6.0"
29
+ "firebase-functions": "^4.7.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@cloudcommerce/types": "workspace:*"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-frenet",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app for Frenet shipping calculation",
6
6
  "main": "lib/frenet.js",
7
7
  "exports": {
@@ -28,7 +28,7 @@
28
28
  "@cloudcommerce/firebase": "workspace:*",
29
29
  "axios": "^1.6.7",
30
30
  "firebase-admin": "^12.0.0",
31
- "firebase-functions": "^4.6.0"
31
+ "firebase-functions": "^4.7.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@cloudcommerce/test-base": "workspace:*",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-galaxpay",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Galax Pay for recurring payments",
6
6
  "main": "lib/galaxpay.js",
7
7
  "exports": {
@@ -27,7 +27,7 @@
27
27
  "@cloudcommerce/firebase": "workspace:*",
28
28
  "axios": "^1.6.7",
29
29
  "firebase-admin": "^12.0.0",
30
- "firebase-functions": "^4.6.0"
30
+ "firebase-functions": "^4.7.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@cloudcommerce/types": "workspace:*",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-google-analytics",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app to send carts/orders events to GA Measurement Protocol",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -23,7 +23,7 @@
23
23
  "@cloudcommerce/firebase": "workspace:*",
24
24
  "axios": "^1.6.7",
25
25
  "firebase-admin": "^12.0.0",
26
- "firebase-functions": "^4.6.0"
26
+ "firebase-functions": "^4.7.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@cloudcommerce/types": "workspace:*",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-jadlog",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app for Jadlog shipping calculation",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-loyalty-points",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
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": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-mandae",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Mandaê shipping intermediator",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -22,7 +22,7 @@
22
22
  "@cloudcommerce/api": "workspace:*",
23
23
  "@ecomplus/utils": "1.5.0-rc.6",
24
24
  "axios": "^1.6.7",
25
- "firebase-functions": "^4.6.0"
25
+ "firebase-functions": "^4.7.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@cloudcommerce/test-base": "workspace:*",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-melhor-envio",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Melhor Envio",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -27,7 +27,7 @@
27
27
  "@cloudcommerce/firebase": "workspace:*",
28
28
  "axios": "^1.6.7",
29
29
  "firebase-admin": "^12.0.0",
30
- "firebase-functions": "^4.6.0"
30
+ "firebase-functions": "^4.7.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@cloudcommerce/types": "workspace:*",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-mercadopago",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Mercado Pago",
6
6
  "main": "lib/mercadopago.js",
7
7
  "exports": {
@@ -28,7 +28,7 @@
28
28
  "@cloudcommerce/firebase": "workspace:*",
29
29
  "axios": "^1.6.7",
30
30
  "firebase-admin": "^12.0.0",
31
- "firebase-functions": "^4.6.0"
31
+ "firebase-functions": "^4.7.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@cloudcommerce/test-base": "workspace:*",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-pagarme",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Pagar.me",
6
6
  "main": "lib/pagarme.js",
7
7
  "exports": {
@@ -27,8 +27,8 @@
27
27
  "@cloudcommerce/firebase": "workspace:*",
28
28
  "axios": "^1.6.7",
29
29
  "firebase-admin": "^12.0.0",
30
- "firebase-functions": "^4.6.0",
31
- "pagarme": "^4.33.1",
30
+ "firebase-functions": "^4.7.0",
31
+ "pagarme": "^4.34.0",
32
32
  "qs": "^6.11.2"
33
33
  },
34
34
  "devDependencies": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-pagarme-v5",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Pagar.me API v5 with recurring payments",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -29,7 +29,7 @@
29
29
  "@ecomplus/utils": "1.5.0-rc.6",
30
30
  "axios": "^1.6.7",
31
31
  "firebase-admin": "^12.0.0",
32
- "firebase-functions": "^4.6.0"
32
+ "firebase-functions": "^4.7.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@cloudcommerce/test-base": "workspace:*",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-paghiper",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate PagHiper",
6
6
  "main": "lib/paghiper.js",
7
7
  "exports": {
@@ -27,7 +27,7 @@
27
27
  "@cloudcommerce/firebase": "workspace:*",
28
28
  "axios": "^1.6.7",
29
29
  "firebase-admin": "^12.0.0",
30
- "firebase-functions": "^4.6.0"
30
+ "firebase-functions": "^4.7.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@cloudcommerce/types": "workspace:*",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-pix",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app to integrate Pix API (Bacen)",
6
6
  "main": "lib/pix.js",
7
7
  "exports": {
@@ -27,7 +27,7 @@
27
27
  "@cloudcommerce/firebase": "workspace:*",
28
28
  "axios": "^1.6.7",
29
29
  "firebase-admin": "^12.0.0",
30
- "firebase-functions": "^4.6.0"
30
+ "firebase-functions": "^4.7.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@cloudcommerce/types": "workspace:*",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-tiny-erp",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app for Tiny ERP",
6
6
  "main": "lib/tiny-erp.js",
7
7
  "repository": {
@@ -24,7 +24,7 @@
24
24
  "@ecomplus/utils": "1.5.0-rc.6",
25
25
  "axios": "^1.6.7",
26
26
  "firebase-admin": "^12.0.0",
27
- "firebase-functions": "^4.6.0",
27
+ "firebase-functions": "^4.7.0",
28
28
  "form-data": "4.0.0"
29
29
  },
30
30
  "devDependencies": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/app-webhooks",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app for general order webhooks",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -23,7 +23,7 @@
23
23
  "@cloudcommerce/firebase": "workspace:*",
24
24
  "axios": "^1.6.7",
25
25
  "firebase-admin": "^12.0.0",
26
- "firebase-functions": "^4.6.0"
26
+ "firebase-functions": "^4.7.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@cloudcommerce/types": "workspace:*",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/cli",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce CLI tools",
6
6
  "bin": {
7
7
  "cloudcommerce": "./bin/run.mjs"
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@cloudcommerce/api": "workspace:*",
30
30
  "@fastify/deepmerge": "^1.3.0",
31
- "dotenv": "^16.4.1",
31
+ "dotenv": "^16.4.2",
32
32
  "libsodium-wrappers": "^0.7.13",
33
33
  "md5": "^2.3.0",
34
34
  "typescript": "~5.2.2",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/config",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce base config",
6
6
  "main": "lib/config.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/emails",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce email sender",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/eslint",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce ESLint config",
6
6
  "main": "lib/index.js",
7
7
  "repository": {
@@ -19,13 +19,13 @@
19
19
  "build": "echo '@ecomplus/eslint'"
20
20
  },
21
21
  "dependencies": {
22
- "@typescript-eslint/eslint-plugin": "^6.20.0",
23
- "@typescript-eslint/parser": "^6.20.0",
22
+ "@typescript-eslint/eslint-plugin": "^6.21.0",
23
+ "@typescript-eslint/parser": "^6.21.0",
24
24
  "eslint": "^8.56.0",
25
25
  "eslint-config-airbnb-base": "^15.0.0",
26
26
  "eslint-plugin-astro": "^0.31.4",
27
27
  "eslint-plugin-import": "^2.29.1",
28
- "eslint-plugin-tailwindcss": "3.14.1",
28
+ "eslint-plugin-tailwindcss": "3.14.2",
29
29
  "eslint-plugin-vue": "^9.21.1"
30
30
  }
31
31
  }
@@ -5,6 +5,7 @@ module.exports = {
5
5
  ],
6
6
  rules: {
7
7
  'no-console': 'off',
8
+ 'class-methods-use-this': 'off',
8
9
  'max-len': 'warn',
9
10
  'semi': 'warn',
10
11
  'arrow-parens': 'warn',
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/events",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce app events",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -44,7 +44,7 @@
44
44
  "@cloudcommerce/firebase": "workspace:*",
45
45
  "@cloudcommerce/ssr": "workspace:*",
46
46
  "firebase-admin": "^12.0.0",
47
- "firebase-functions": "^4.6.0",
47
+ "firebase-functions": "^4.7.0",
48
48
  "source-map-support": "^0.5.21"
49
49
  },
50
50
  "devDependencies": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/feeds",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce catalog feeds",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/firebase",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce on Firebase",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -32,10 +32,10 @@
32
32
  "dependencies": {
33
33
  "@cloudcommerce/api": "workspace:*",
34
34
  "@cloudcommerce/config": "workspace:*",
35
- "@google-cloud/pubsub": "^4.2.0",
36
- "dotenv": "^16.4.1",
35
+ "@google-cloud/pubsub": "^4.3.1",
36
+ "dotenv": "^16.4.2",
37
37
  "firebase-admin": "^12.0.0",
38
- "firebase-functions": "^4.6.0",
38
+ "firebase-functions": "^4.7.0",
39
39
  "source-map-support": "^0.5.21"
40
40
  },
41
41
  "devDependencies": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/i18n",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce i18n",
6
6
  "main": "lib/all.js",
7
7
  "exports": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/modules",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce modules API",
6
6
  "main": "lib/index.cjs",
7
7
  "exports": {
@@ -49,7 +49,7 @@
49
49
  "ajv-formats": "^2.1.1",
50
50
  "axios": "^1.6.7",
51
51
  "firebase-admin": "^12.0.0",
52
- "firebase-functions": "^4.6.0",
52
+ "firebase-functions": "^4.7.0",
53
53
  "source-map-support": "^0.5.21"
54
54
  },
55
55
  "devDependencies": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/passport",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce customers authentication (passport) API",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -26,7 +26,7 @@
26
26
  "@cloudcommerce/api": "workspace:*",
27
27
  "@cloudcommerce/firebase": "workspace:*",
28
28
  "firebase-admin": "^12.0.0",
29
- "firebase-functions": "^4.6.0",
29
+ "firebase-functions": "^4.7.0",
30
30
  "source-map-support": "^0.5.21"
31
31
  },
32
32
  "devDependencies": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/ssr",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce storefront SSR",
6
6
  "main": "lib/index.js",
7
7
  "exports": {
@@ -36,14 +36,14 @@
36
36
  "astro-capo": "^0.0.1",
37
37
  "axios": "^1.6.7",
38
38
  "firebase-admin": "^12.0.0",
39
- "firebase-functions": "^4.6.0",
39
+ "firebase-functions": "^4.7.0",
40
40
  "mitt": "^3.0.1",
41
- "vue": "^3.4.15",
41
+ "vue": "^3.4.18",
42
42
  "yaml": "^2.3.4"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@cloudcommerce/types": "workspace:*",
46
- "@cloudflare/workers-types": "^4.20240129.0",
46
+ "@cloudflare/workers-types": "^4.20240208.0",
47
47
  "@firebase/app-types": "^0.9.0",
48
48
  "typescript": "~5.2.2"
49
49
  }
@@ -26,6 +26,7 @@ interface Window {
26
26
  ECOM_CURRENCY_SYMBOL: string;
27
27
  ECOM_COUNTRY_CODE: string;
28
28
  GIT_BRANCH: string;
29
+ GIT_REPO?: string;
29
30
  AB_EXPERIMENT_ID?: string;
30
31
  CMS_CUSTOM_CONFIG?: Record<string, any>;
31
32
  CMS_SSO_URL?: string | null;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/storefront",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce storefront with Astro",
6
6
  "bin": {
7
7
  "storefront": "./scripts/build-prod.sh"
@@ -40,31 +40,32 @@
40
40
  "@iconify-json/fa6-brands": "^1.1.18",
41
41
  "@iconify-json/heroicons": "^1.1.19",
42
42
  "@iconify-json/logos": "^1.1.42",
43
- "@types/gtag.js": "^0.0.18",
43
+ "@types/gtag.js": "^0.0.19",
44
44
  "@vite-pwa/astro": "^0.2.0",
45
45
  "@vueuse/core": "10.7.2",
46
+ "@webcontainer/api": "^1.1.9",
46
47
  "astro": "4.3.5",
47
48
  "astro-capo": "^0.0.1",
48
49
  "chroma-js": "^2.4.2",
49
- "dotenv": "^16.4.1",
50
+ "dotenv": "^16.4.2",
50
51
  "firebase": "^10.8.0",
51
52
  "image-size": "^1.1.1",
52
53
  "mime": "^3.0.0",
53
54
  "mitt": "^3.0.1",
54
- "semver": "^7.5.4",
55
+ "semver": "^7.6.0",
55
56
  "sharp": "^0.32.6",
56
57
  "tailwindcss": "^3.4.1",
57
58
  "unocss": "^0.58.5",
58
59
  "unplugin-auto-import": "^0.17.5",
59
60
  "vite": "^5.0.11",
60
- "vite-plugin-pwa": "^0.17.5",
61
- "vue": "^3.4.15",
61
+ "vite-plugin-pwa": "^0.18.1",
62
+ "vue": "^3.4.18",
62
63
  "wade": "0.3.3",
63
64
  "yaml": "^2.3.4"
64
65
  },
65
66
  "devDependencies": {
66
67
  "@cloudcommerce/eslint": "workspace:*",
67
68
  "@cloudcommerce/types": "workspace:*",
68
- "@webcontainer/api": "^1.1.9"
69
+ "@types/react": "^18.2.55"
69
70
  }
70
71
  }
@@ -1,32 +1,51 @@
1
- import type { WebContainer as IWebContainer } from '@webcontainer/api';
1
+ import type NReact from 'react';
2
+ import { initWebcontainer } from './preview/webcontainer';
2
3
 
3
- export const genPreviewContainer = async ({ createClass, h, WebContainer }: {
4
- createClass: (o: { render: () => HTMLElement }) => (...args: any) => any,
5
- h: (n: string, ...args: any) => HTMLElement, // React.createElement
6
- WebContainer: any,
4
+ export const genPreviewContainer = ({ React, cmsConfig, ghToken }: {
5
+ React: typeof NReact,
6
+ cmsConfig: Record<string, any>,
7
+ ghToken?: string,
7
8
  }) => {
8
- const webcontainerInstance: IWebContainer = await WebContainer.boot();
9
- console.log({ webcontainerInstance });
9
+ const { repo } = cmsConfig.backend;
10
+ const cliTextareaId = 'webcontainerCli';
11
+ const serverIframeId = 'serverPreview';
10
12
  // https://github.com/decaporg/decap-cms/issues/2183#issuecomment-997373169
11
- return createClass({
13
+ return class Prevew extends React.Component {
12
14
  render() {
13
15
  const { entry } = (this as any).props;
14
16
  console.log({ entry });
15
- const { host } = window.location;
16
17
  const slug = '';
17
- const isLocal = host.startsWith('localhost') || host.startsWith('127.0.0.');
18
- const src = `${isLocal ? 'http' : 'https'}://${host}/~preview/${slug}`;
18
+ const urlPath = `/~preview/${slug}`;
19
19
  const html = `
20
+ <textarea id="${cliTextareaId}"></textarea>
20
21
  <iframe
22
+ if="${serverIframeId}"
23
+ data-url="${urlPath}"
21
24
  border="0"
22
- src="${src}"
23
25
  width="100%"
24
26
  height="100%"
25
- style="border: 1px solid #EEE; height: calc(100dvh - 12px)"
27
+ style="border: 1px solid #EEE; height: calc(100vh - 30px)"
26
28
  ></iframe>`;
27
- return h('div', { dangerouslySetInnerHTML: { __html: html } });
28
- },
29
- });
29
+ return React.createElement('div', {
30
+ dangerouslySetInnerHTML: { __html: html },
31
+ });
32
+ }
33
+ componentDidMount() {
34
+ const iframe = document.getElementById('preview-pane') as HTMLIFrameElement;
35
+ const cliTextarea = iframe.contentWindow!.document
36
+ .getElementById(cliTextareaId) as HTMLTextAreaElement;
37
+ const previewIframe = iframe.contentWindow!.document
38
+ .getElementById(serverIframeId) as HTMLIFrameElement;
39
+ initWebcontainer({ repo, ghToken, cliTextarea })
40
+ .then(({ webcontainerInstance, startDevServer }) => {
41
+ webcontainerInstance.on('server-ready', (port, url) => {
42
+ console.log({ port, url });
43
+ previewIframe.src = `${url}${previewIframe.dataset.url}`;
44
+ });
45
+ startDevServer();
46
+ });
47
+ }
48
+ };
30
49
  };
31
50
 
32
51
  export default genPreviewContainer;
@@ -28,8 +28,8 @@ export const getCmsConfig = () => {
28
28
  },
29
29
  fields: [
30
30
  {
31
- label: 'E-Com Plus Store ID',
32
- name: 'store_id',
31
+ label: 'e-com.plus Store ID',
32
+ name: 'storeId',
33
33
  widget: 'hidden',
34
34
  },
35
35
  {
@@ -0,0 +1,104 @@
1
+ import { WebContainer } from '@webcontainer/api';
2
+
3
+ export const genContainerFiles = ({ repo, ghToken, repoDir }: {
4
+ repo: string,
5
+ ghToken?: string,
6
+ repoDir: string,
7
+ }) => ({
8
+ 'git.js': {
9
+ file: {
10
+ contents: `
11
+ import fs from 'node:fs';
12
+ import { join as joinPath } from 'node:path';
13
+ import { clone, pull } from 'isomorphic-git';
14
+ import * as http from 'isomorphic-git/http/node/index.cjs';
15
+ const dir = joinPath(process.cwd(), '${repoDir}');
16
+ const isClone = process.argv.find((val) => val === '--clone');
17
+ const options = {
18
+ fs,
19
+ http,
20
+ dir,
21
+ singleBranch: true,
22
+ };
23
+ ${(ghToken
24
+ ? `
25
+ options.oauth2format = 'github';
26
+ options.token = '${ghToken}';`
27
+ : '')}
28
+ if (isClone) {
29
+ options.url = 'https://github.com/${repo}.git';
30
+ options.depth = 1;
31
+ clone(options);
32
+ } else {
33
+ pull(options);
34
+ }
35
+ `,
36
+ },
37
+ },
38
+ 'package.json': {
39
+ file: {
40
+ contents: `
41
+ {
42
+ "name": "git-app",
43
+ "version": "1.0.0",
44
+ "type": "module",
45
+ "private": true,
46
+ "description": "",
47
+ "author": "",
48
+ "license": "ISC",
49
+ "scripts": {
50
+ "git:clone": "node git.js --clone",
51
+ "git:pull": "node git.js --pull"
52
+ },
53
+ "dependencies": {
54
+ "isomorphic-git": "^1.25.3"
55
+ }
56
+ }`,
57
+ },
58
+ },
59
+ });
60
+
61
+ export const initWebcontainer = async ({ repo, ghToken, cliTextarea }: {
62
+ repo: string,
63
+ ghToken?: string,
64
+ cliTextarea: HTMLTextAreaElement,
65
+ }) => {
66
+ const webcontainerInstance = await WebContainer.boot();
67
+ const repoDir = 'store';
68
+ const files = genContainerFiles({ repo, ghToken, repoDir });
69
+ await webcontainerInstance.mount(files);
70
+ const exec = async (command: string, args: string[]) => {
71
+ const cliArgs = args.reduce((acc, opt) => `${acc} ${opt}`, '');
72
+ const cli = `$ ${command}${cliArgs}\n`;
73
+ cliTextarea.value += cli;
74
+ const proc = await webcontainerInstance.spawn(command, args);
75
+ if (import.meta.env.DEV || (window as any).DEBUG) {
76
+ proc.output.pipeTo(new WritableStream({
77
+ write(stdout) {
78
+ console.debug?.('webcontainer', { stdout });
79
+ },
80
+ }));
81
+ }
82
+ if (await proc.exit !== 0) {
83
+ throw new Error(`${command} failed`);
84
+ }
85
+ };
86
+ await exec('npm', ['install']);
87
+ await exec('npm', ['run', 'git:clone']);
88
+ const ssrDir = `${repoDir}/functions/ssr`;
89
+ await exec('npm', ['--prefix', ssrDir, 'i']);
90
+ await webcontainerInstance.fs.writeFile(
91
+ `${ssrDir}/.env`,
92
+ `ECOM_STORE_ID=${window.ECOM_STORE_ID}\n`,
93
+ );
94
+ const startDevServer = async () => {
95
+ await exec('npm', ['--prefix', ssrDir, 'run', 'dev']);
96
+ // Keep restarting dev server (can crash)
97
+ startDevServer();
98
+ };
99
+ return {
100
+ webcontainerInstance,
101
+ webcontainerExec: exec,
102
+ startDevServer,
103
+ };
104
+ };
@@ -3,6 +3,7 @@
3
3
  /// <reference types="vue/ref-macros" />
4
4
  /// <reference types="../client" />
5
5
  /// <reference types="../server" />
6
+ /// <reference types="react" />
6
7
 
7
8
  declare module '*.vue' {
8
9
  import { type DefineComponent } from 'vue';
@@ -4,47 +4,33 @@ import getCmsConfig from '../../decap-cms/get-cms-config';
4
4
  import genPreviewContainer from '../../decap-cms/gen-preview-container';
5
5
 
6
6
  let cmsConfig: Record<string, any> = getCmsConfig();
7
+ let ghToken: string | undefined;
7
8
  const initCmsWithPreview = () => {
8
- const {
9
- CMS,
10
- initCMS,
11
- createClass,
12
- h,
13
- } = window as any as {
14
- CMS: Record<string, any>,
15
- initCMS: (c: { config: Record<string, any> }) => void,
16
- createClass: any,
17
- h: any,
18
- };
19
- initCMS({ config: cmsConfig });
20
- /* eslint-disable import/no-unresolved */
21
- // @ts-ignore
22
- import(/* @vite-ignore */ 'https://esm.sh/@webcontainer/api@^1')
23
- .then(({ WebContainer }) => {
24
- const Preview = genPreviewContainer({ createClass, h, WebContainer });
25
- CMS.registerPreviewTemplate('general', Preview);
26
- })
27
- .catch((err) => {
28
- console.error(err);
29
- // eslint-disable-next-line
30
- window.alert('Failed importing WebContainer for live preview');
31
- });
9
+ const { React, CMS } = window as any;
10
+ CMS.init({ config: cmsConfig });
11
+ const Preview = genPreviewContainer({ React, cmsConfig, ghToken });
12
+ CMS.registerPreviewTemplate('general', Preview);
32
13
  };
33
14
 
34
15
  const authAndInitCms = async () => {
35
- if (import.meta.env.DEV) {
36
- cmsConfig.local_backend = true;
37
- cmsConfig.backend = { name: 'git-gateway' };
38
- initCmsWithPreview();
39
- return;
40
- }
41
16
  const {
42
17
  location,
43
18
  sessionStorage,
44
19
  ECOM_STORE_ID,
20
+ GIT_REPO,
45
21
  CMS_SSO_URL = 'https://app.e-com.plus/pages/login?api_version=2',
46
22
  } = window;
47
- let token = sessionStorage.getItem('cms_token');
23
+ if (import.meta.env.DEV) {
24
+ cmsConfig.local_backend = true;
25
+ cmsConfig.backend = {
26
+ repo: GIT_REPO || 'ecomplus/store',
27
+ name: 'git-gateway',
28
+ };
29
+ initCmsWithPreview();
30
+ return;
31
+ }
32
+ const storageKey = '__cms_token';
33
+ let token = sessionStorage.getItem(storageKey);
48
34
  const searchParams = new URLSearchParams(location.search);
49
35
  const ssoToken = searchParams.get('sso_token') || searchParams.get('access_token');
50
36
  if (!cmsConfig.backend?.base_url) {
@@ -56,8 +42,8 @@ const authAndInitCms = async () => {
56
42
  return;
57
43
  }
58
44
  cmsConfig.backend = {
59
- repo: '_owner/_name',
60
- api_root: 'https://ecomplus.app/api/git/github/',
45
+ repo: GIT_REPO || '_owner/_name',
46
+ api_root: `https://ecomplus.app/api/${ECOM_STORE_ID}/git/github/`,
61
47
  name: 'github',
62
48
  base_url: `https://${location.hostname}`,
63
49
  auth_endpoint: location.pathname, // self
@@ -89,8 +75,10 @@ const authAndInitCms = async () => {
89
75
  : installations[0];
90
76
  if (installation?.gh_token && installation.gh_token.charAt(0) !== '*') {
91
77
  // Consume GitHub REST API directly
92
- token = installation.gh_token;
78
+ token = installation.gh_token as string;
79
+ ghToken = token;
93
80
  delete cmsConfig.backend.api_root;
81
+ cmsConfig.backend.repo = installation.repository;
94
82
  cmsConfig.backend.name = 'github';
95
83
  }
96
84
  }
@@ -98,6 +86,7 @@ const authAndInitCms = async () => {
98
86
  }
99
87
  }
100
88
  if (token) {
89
+ sessionStorage.removeItem(storageKey);
101
90
  if (!window.opener) initCmsWithPreview();
102
91
  // Ref.: https://github.com/decaporg/decap-cms/blob/e93c94f1ce707719dfb7750af82b17c38b461831/packages/decap-cms-lib-auth/src/netlify-auth.js#L46
103
92
  // E.g.: https://github.com/Herohtar/netlify-cms-oauth-firebase/blob/master/functions/index.js#L9-L25
@@ -122,7 +111,7 @@ const authAndInitCms = async () => {
122
111
  );
123
112
  const provider = cmsConfig.backend.name;
124
113
  if (provider && provider !== 'git-gateway') {
125
- sessionStorage.setItem('cms_token', ssoToken);
114
+ sessionStorage.setItem(storageKey, ssoToken);
126
115
  }
127
116
  }
128
117
  initCmsWithPreview();
@@ -134,8 +123,21 @@ if (!import.meta.env.SSR) {
134
123
  cmsConfig = deepmerge(cmsConfig, window.CMS_CUSTOM_CONFIG);
135
124
  }
136
125
  (window as any).CMS_MANUAL_INIT = true;
137
- const cmsScript = document.createElement('script');
138
- cmsScript.src = 'https://unpkg.com/decap-cms@^3.0.0/dist/decap-cms.js';
139
- cmsScript.onload = authAndInitCms;
140
- document.body.appendChild(cmsScript);
126
+ /* eslint-disable import/no-unresolved */
127
+ Promise.all([
128
+ // @ts-ignore
129
+ import(/* @vite-ignore */ 'https://esm.sh/react@^18'),
130
+ // @ts-ignore
131
+ import(/* @vite-ignore */ 'https://esm.sh/decap-cms-app@^3'),
132
+ ])
133
+ .then(([React, { default: CMS }]) => {
134
+ (window as any).React = React;
135
+ (window as any).CMS = CMS;
136
+ authAndInitCms();
137
+ })
138
+ .catch((err) => {
139
+ console.error(err);
140
+ // eslint-disable-next-line
141
+ window.alert('Failed importing Decap CMS app or preview dependencies');
142
+ });
141
143
  }
@@ -267,6 +267,11 @@ const loadRouteContext = async (
267
267
  } else {
268
268
  setResponseCache(Astro, 120, 180);
269
269
  }
270
+ if (isPreview || urlPath.startsWith('/admin/')) {
271
+ // https://webcontainers.io/guides/configuring-headers#configuring-headers
272
+ Astro.response.headers.set('Cross-Origin-Embedder-Policy', 'require-corp');
273
+ Astro.response.headers.set('Cross-Origin-Opener-Policy', 'same-origin');
274
+ }
270
275
  const routeContext = {
271
276
  ...config,
272
277
  isHomepage,
@@ -2,7 +2,7 @@
2
2
  "name": "@cloudcommerce/test-base",
3
3
  "private": true,
4
4
  "type": "module",
5
- "version": "2.3.4",
5
+ "version": "2.4.2",
6
6
  "description": "E-Com Plus Cloud Commerce basic setup for testing",
7
7
  "main": "lib/index.js",
8
8
  "repository": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/types",
3
3
  "type": "module",
4
- "version": "2.3.4",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce reusable type definitions",
6
6
  "main": "index.ts",
7
7
  "repository": {