cloudcommerce 2.4.1 → 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 (48) hide show
  1. package/CHANGELOG.md +9 -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/events/package.json +2 -2
  36. package/packages/feeds/package.json +1 -1
  37. package/packages/firebase/package.json +4 -4
  38. package/packages/i18n/package.json +1 -1
  39. package/packages/modules/package.json +2 -2
  40. package/packages/passport/package.json +2 -2
  41. package/packages/ssr/package.json +4 -4
  42. package/packages/storefront/package.json +8 -8
  43. package/packages/storefront/src/decap-cms/gen-preview-container.ts +21 -49
  44. package/packages/storefront/src/decap-cms/preview/webcontainer.ts +51 -93
  45. package/packages/storefront/src/lib/scripts/decap-cms.ts +3 -15
  46. package/packages/test-base/package.json +1 -1
  47. package/packages/types/package.json +1 -1
  48. package/packages/storefront/src/decap-cms/preview/indexeddb.ts +0 -51
package/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
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
+
5
14
  ### [2.4.1](https://github.com/ecomplus/cloud-commerce/compare/v2.4.0...v2.4.1) (2024-02-10)
6
15
 
7
16
  ## [2.4.0](https://github.com/ecomplus/cloud-commerce/compare/v2.3.4...v2.4.0) (2024-02-10)
@@ -15,8 +15,8 @@
15
15
  },
16
16
  "main": "index.js",
17
17
  "dependencies": {
18
- "@cloudcommerce/feeds": "^2.3.4",
19
- "@cloudcommerce/firebase": "^2.3.4",
20
- "@cloudcommerce/passport": "^2.3.4"
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.4",
22
- "@cloudcommerce/firebase": "^2.3.4",
23
- "@cloudcommerce/ssr": "^2.3.4",
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.4",
28
- "@cloudcommerce/storefront": "^2.3.4",
29
- "@cloudcommerce/types": "^2.3.4",
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.4",
19
- "@cloudcommerce/firebase": "^2.3.4",
20
- "@cloudcommerce/modules": "^2.3.4"
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.4"
29
+ "@cloudcommerce/cli": "^2.4.1"
30
30
  },
31
31
  "devDependencies": {
32
- "@cloudcommerce/eslint": "^2.3.4",
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.4.1",
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.4.1"
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/events",
3
3
  "type": "module",
4
- "version": "2.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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.4.1",
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
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/storefront",
3
3
  "type": "module",
4
- "version": "2.4.1",
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,32 +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
- "@types/react": "^18.2.55",
69
- "@webcontainer/api": "^1.1.9"
69
+ "@types/react": "^18.2.55"
70
70
  }
71
71
  }
@@ -1,77 +1,49 @@
1
1
  import type NReact from 'react';
2
- import afetch from '../helpers/afetch';
3
2
  import { initWebcontainer } from './preview/webcontainer';
4
3
 
5
- const getRepoCommits = async (repo: string, ghToken?: string) => {
6
- const headers: Record<string, string> = {
7
- Accept: 'application/vnd.github+json',
8
- 'X-GitHub-Api-Version': '2022-11-28',
9
- };
10
- if (ghToken) {
11
- headers.Authorization = `Bearer ${ghToken}`;
12
- }
13
- const res = await afetch(`https://api.github.com/repos/${repo}/commits`, {
14
- headers,
15
- });
16
- if (res.ok) {
17
- return res.json();
18
- }
19
- const err: any = new Error('Failed reading repository commits on GitHub API');
20
- err.res = res;
21
- err.text = await res.text();
22
- throw new Error(err);
23
- };
24
-
25
- export const genPreviewContainer = ({
26
- React,
27
- WebContainer,
28
- cmsConfig,
29
- ghToken,
30
- }: {
4
+ export const genPreviewContainer = ({ React, cmsConfig, ghToken }: {
31
5
  React: typeof NReact,
32
- WebContainer: any,
33
6
  cmsConfig: Record<string, any>,
34
7
  ghToken?: string,
35
8
  }) => {
36
9
  const { repo } = cmsConfig.backend;
37
10
  const cliTextareaId = 'webcontainerCli';
11
+ const serverIframeId = 'serverPreview';
38
12
  // https://github.com/decaporg/decap-cms/issues/2183#issuecomment-997373169
39
13
  return class Prevew extends React.Component {
40
14
  render() {
41
15
  const { entry } = (this as any).props;
42
16
  console.log({ entry });
43
- const { host } = window.location;
44
17
  const slug = '';
45
- const isLocal = host.startsWith('localhost') || host.startsWith('127.0.0.');
46
- const src = `${isLocal ? 'http' : 'https'}://${host}/~preview/${slug}`;
18
+ const urlPath = `/~preview/${slug}`;
47
19
  const html = `
48
20
  <textarea id="${cliTextareaId}"></textarea>
49
- <code>${src}</code>`;
21
+ <iframe
22
+ if="${serverIframeId}"
23
+ data-url="${urlPath}"
24
+ border="0"
25
+ width="100%"
26
+ height="100%"
27
+ style="border: 1px solid #EEE; height: calc(100vh - 30px)"
28
+ ></iframe>`;
50
29
  return React.createElement('div', {
51
30
  dangerouslySetInnerHTML: { __html: html },
52
31
  });
53
32
  }
54
33
  componentDidMount() {
55
- let commitSha: string | undefined;
56
- (async () => {
57
- try {
58
- const commits = await getRepoCommits(repo, ghToken);
59
- commitSha = commits[0]?.sha;
60
- } catch (err) {
61
- console.error(err);
62
- }
63
- })();
64
34
  const iframe = document.getElementById('preview-pane') as HTMLIFrameElement;
65
35
  const cliTextarea = iframe.contentWindow!.document
66
36
  .getElementById(cliTextareaId) as HTMLTextAreaElement;
67
- initWebcontainer({
68
- repo,
69
- ghToken,
70
- WebContainer,
71
- cliTextarea,
72
- }).then(({ startDevServer }) => {
73
- startDevServer(commitSha);
74
- });
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
+ });
75
47
  }
76
48
  };
77
49
  };
@@ -1,69 +1,37 @@
1
- import type { WebContainer as IWebContainer } from '@webcontainer/api';
2
- import { RepoDatabase } from './indexeddb';
1
+ import { WebContainer } from '@webcontainer/api';
3
2
 
4
- export const genContainerFiles = ({ repo, ghToken }: {
3
+ export const genContainerFiles = ({ repo, ghToken, repoDir }: {
5
4
  repo: string,
6
5
  ghToken?: string,
6
+ repoDir: string,
7
7
  }) => ({
8
8
  'git.js': {
9
9
  file: {
10
10
  contents: `
11
- import { join } from 'path';
12
- import { clone } from 'isomorphic-git';
13
- import * as http from 'isomorphic-git/http/node/index.cjs';
14
11
  import fs from 'node:fs';
15
- const exe = async () => {
16
- const dir = join(process.cwd(), 'store');
17
- const gitOptions = {
18
- fs,
19
- http,
20
- dir,
21
- url: 'https://github.com/${repo}.git',
22
- singleBranch: true,
23
- depth: 1,
24
- };
25
- ${(ghToken
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
26
24
  ? `
27
- gitOptions.oauth2format = 'github';
28
- gitOptions.token = '${ghToken}';`
25
+ options.oauth2format = 'github';
26
+ options.token = '${ghToken}';`
29
27
  : '')}
30
- await clone(gitOptions);
31
- };
32
- exe();
33
- `,
34
- },
35
- },
36
- 'unzipper.js': {
37
- file: {
38
- contents: `
39
- import AdmZip from 'adm-zip';
40
- const unzipDirectory = async (inputFilePath, outputDirectory) => {
41
- const zip = new AdmZip(inputFilePath);
42
- return new Promise((resolve, reject) => {
43
- zip.extractAllToAsync(outputDirectory, true, (error) => {
44
- if (error) {
45
- console.error(error);
46
- reject(error);
47
- } else {
48
- resolve();
49
- }
50
- });
51
- });
52
- };
53
- await unzipDirectory('store.zip', 'store');
54
- `,
55
- },
56
- },
57
- 'zipper.js': {
58
- file: {
59
- contents: `
60
- import AdmZip from 'adm-zip';
61
- const zipDirectory = async (sourceDir, outputFilePath) => {
62
- const zip = new AdmZip();
63
- zip.addLocalFolder(sourceDir);
64
- await zip.writeZipPromise(outputFilePath);
65
- };
66
- await zipDirectory('./store', './store.zip');
28
+ if (isClone) {
29
+ options.url = 'https://github.com/${repo}.git';
30
+ options.depth = 1;
31
+ clone(options);
32
+ } else {
33
+ pull(options);
34
+ }
67
35
  `,
68
36
  },
69
37
  },
@@ -76,67 +44,57 @@ await zipDirectory('./store', './store.zip');
76
44
  "type": "module",
77
45
  "private": true,
78
46
  "description": "",
79
- "main": "index.js",
80
47
  "author": "",
81
48
  "license": "ISC",
82
49
  "scripts": {
83
- "start": "nodemon --watch './' index.js",
84
- "git": "node git.js",
85
- "unzipper": "node unzipper.js",
86
- "zipper": "node zipper.js"
50
+ "git:clone": "node git.js --clone",
51
+ "git:pull": "node git.js --pull"
87
52
  },
88
53
  "dependencies": {
89
- "dotenv": "^16.3.1",
90
- "adm-zip": "^0.5.10",
91
- "axios": "^1.6.2",
92
- "isomorphic-git": "^1.25.2"
54
+ "isomorphic-git": "^1.25.3"
93
55
  }
94
56
  }`,
95
57
  },
96
58
  },
97
59
  });
98
60
 
99
- export const initWebcontainer = async ({
100
- repo,
101
- ghToken,
102
- WebContainer,
103
- cliTextarea,
104
- }: {
61
+ export const initWebcontainer = async ({ repo, ghToken, cliTextarea }: {
105
62
  repo: string,
106
63
  ghToken?: string,
107
- WebContainer: Record<string, any>,
108
64
  cliTextarea: HTMLTextAreaElement,
109
65
  }) => {
110
- const webcontainerInstance: IWebContainer = await WebContainer.boot();
111
- const files = genContainerFiles({ repo, ghToken });
66
+ const webcontainerInstance = await WebContainer.boot();
67
+ const repoDir = 'store';
68
+ const files = genContainerFiles({ repo, ghToken, repoDir });
112
69
  await webcontainerInstance.mount(files);
113
70
  const exec = async (command: string, args: string[]) => {
114
71
  const cliArgs = args.reduce((acc, opt) => `${acc} ${opt}`, '');
115
72
  const cli = `$ ${command}${cliArgs}\n`;
116
73
  cliTextarea.value += cli;
117
- const cmd = await webcontainerInstance.spawn(command, args);
118
- cmd.output.pipeTo(new WritableStream({
119
- write(stdout) {
120
- console.debug?.('webcontainer', { stdout });
121
- },
122
- }));
123
- if (await cmd.exit !== 0) {
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) {
124
83
  throw new Error(`${command} failed`);
125
84
  }
126
85
  };
127
86
  await exec('npm', ['install']);
128
- const startDevServer = async (commitSha?: string) => {
129
- const repoDatabase = new RepoDatabase(repo);
130
- const storedRepoZip = commitSha ? await repoDatabase.get(commitSha) : null;
131
- if (!storedRepoZip) {
132
- await exec('npm', ['run', 'git']);
133
- await exec('npm', ['--prefix', 'store', 'i']);
134
- if (commitSha) {
135
- await exec('npm', ['run', 'zipper']);
136
- const repoZip = await webcontainerInstance.fs.readFile('./store.zip');
137
- repoDatabase.put(commitSha, repoZip);
138
- }
139
- }
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();
140
98
  };
141
99
  return {
142
100
  webcontainerInstance,
@@ -6,18 +6,9 @@ import genPreviewContainer from '../../decap-cms/gen-preview-container';
6
6
  let cmsConfig: Record<string, any> = getCmsConfig();
7
7
  let ghToken: string | undefined;
8
8
  const initCmsWithPreview = () => {
9
- const { React, CMS, WebContainer } = window as any as {
10
- React: any,
11
- CMS: Record<string, any>,
12
- WebContainer: any,
13
- };
9
+ const { React, CMS } = window as any;
14
10
  CMS.init({ config: cmsConfig });
15
- const Preview = genPreviewContainer({
16
- React,
17
- WebContainer,
18
- cmsConfig,
19
- ghToken,
20
- });
11
+ const Preview = genPreviewContainer({ React, cmsConfig, ghToken });
21
12
  CMS.registerPreviewTemplate('general', Preview);
22
13
  };
23
14
 
@@ -138,13 +129,10 @@ if (!import.meta.env.SSR) {
138
129
  import(/* @vite-ignore */ 'https://esm.sh/react@^18'),
139
130
  // @ts-ignore
140
131
  import(/* @vite-ignore */ 'https://esm.sh/decap-cms-app@^3'),
141
- // @ts-ignore
142
- import(/* @vite-ignore */ 'https://esm.sh/@webcontainer/api@^1'),
143
132
  ])
144
- .then(([React, { default: CMS }, { WebContainer }]) => {
133
+ .then(([React, { default: CMS }]) => {
145
134
  (window as any).React = React;
146
135
  (window as any).CMS = CMS;
147
- (window as any).WebContainer = WebContainer;
148
136
  authAndInitCms();
149
137
  })
150
138
  .catch((err) => {
@@ -2,7 +2,7 @@
2
2
  "name": "@cloudcommerce/test-base",
3
3
  "private": true,
4
4
  "type": "module",
5
- "version": "2.4.1",
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.4.1",
4
+ "version": "2.4.2",
5
5
  "description": "E-Com Plus Cloud Commerce reusable type definitions",
6
6
  "main": "index.ts",
7
7
  "repository": {
@@ -1,51 +0,0 @@
1
- let db: IDBDatabase;
2
- const storeName = 'repo';
3
-
4
- export const startingDb = new Promise<IDBDatabase>((resolve, reject) => {
5
- const openRequest = indexedDB.open('ecomplus', 2);
6
- openRequest.onerror = () => {
7
- reject(new Error('Why didn\'t you allow my web app to use IndexedDB?!'));
8
- };
9
- openRequest.onsuccess = (ev) => {
10
- db = (ev.target as any).result;
11
- resolve(db!);
12
- };
13
- openRequest.onupgradeneeded = (ev) => {
14
- db = (ev.target as any).result;
15
- db!.createObjectStore(storeName, { keyPath: 'sha' });
16
- resolve(db!);
17
- };
18
- });
19
-
20
- export class RepoDatabase {
21
- objectKey = '';
22
- data: any;
23
- constructor(repo: string) {
24
- this.objectKey = repo;
25
- }
26
- async put(sha: string, zip: any) {
27
- await startingDb;
28
- const data = this.data || {};
29
- data.sha = sha;
30
- data.zip = zip;
31
- const tx = db.transaction([storeName], 'readwrite');
32
- const objectStore = tx.objectStore(storeName);
33
- console.log({ data });
34
- objectStore.put(data, this.objectKey);
35
- }
36
- async get(sha: string) {
37
- await startingDb;
38
- const tx = db.transaction([storeName]);
39
- const objectStore = tx.objectStore(storeName);
40
- const request = objectStore.get(this.objectKey);
41
- return new Promise((resolve, reject) => {
42
- request.onerror = (error) => {
43
- reject(error);
44
- };
45
- request.onsuccess = (ev) => {
46
- this.data = (ev.target as any).result;
47
- resolve(sha === this.data?.sha ? this.data.zip : null);
48
- };
49
- });
50
- }
51
- }