cloudcommerce 2.4.1 → 2.4.3

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 (53) 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/ssr/src/pages/admin/index.astro +23 -0
  5. package/ecomplus-stores/barradoce/functions/with-apps/package.json +3 -3
  6. package/ecomplus-stores/barradoce/package.json +2 -2
  7. package/package.json +5 -5
  8. package/packages/api/package.json +1 -1
  9. package/packages/apps/affiliate-program/package.json +2 -2
  10. package/packages/apps/correios/package.json +3 -3
  11. package/packages/apps/custom-payment/package.json +1 -1
  12. package/packages/apps/custom-shipping/package.json +1 -1
  13. package/packages/apps/datafrete/package.json +2 -2
  14. package/packages/apps/discounts/package.json +1 -1
  15. package/packages/apps/emails/package.json +2 -2
  16. package/packages/apps/fb-conversions/package.json +2 -2
  17. package/packages/apps/flash-courier/package.json +2 -2
  18. package/packages/apps/frenet/package.json +2 -2
  19. package/packages/apps/galaxpay/package.json +2 -2
  20. package/packages/apps/google-analytics/package.json +2 -2
  21. package/packages/apps/jadlog/package.json +1 -1
  22. package/packages/apps/loyalty-points/package.json +1 -1
  23. package/packages/apps/mandae/package.json +2 -2
  24. package/packages/apps/melhor-envio/package.json +2 -2
  25. package/packages/apps/mercadopago/package.json +2 -2
  26. package/packages/apps/pagarme/package.json +3 -3
  27. package/packages/apps/pagarme-v5/package.json +2 -2
  28. package/packages/apps/paghiper/package.json +2 -2
  29. package/packages/apps/pix/package.json +2 -2
  30. package/packages/apps/tiny-erp/package.json +2 -2
  31. package/packages/apps/webhooks/package.json +2 -2
  32. package/packages/cli/ci/bunny-config-base.sh +2 -0
  33. package/packages/cli/package.json +2 -2
  34. package/packages/config/package.json +1 -1
  35. package/packages/emails/package.json +1 -1
  36. package/packages/eslint/package.json +4 -4
  37. package/packages/events/package.json +2 -2
  38. package/packages/feeds/package.json +1 -1
  39. package/packages/firebase/package.json +4 -4
  40. package/packages/i18n/package.json +1 -1
  41. package/packages/modules/package.json +2 -2
  42. package/packages/passport/package.json +2 -2
  43. package/packages/ssr/package.json +4 -4
  44. package/packages/storefront/package.json +8 -8
  45. package/packages/storefront/src/decap-cms/gen-preview-container.ts +21 -49
  46. package/packages/storefront/src/decap-cms/preview/ssr-package.ts +14160 -0
  47. package/packages/storefront/src/decap-cms/preview/webcontainer.ts +55 -93
  48. package/packages/storefront/src/lib/layouts/BaseBody.astro +13 -0
  49. package/packages/storefront/src/lib/pages/admin.astro +0 -0
  50. package/packages/storefront/src/lib/scripts/decap-cms.ts +4 -16
  51. package/packages/test-base/package.json +1 -1
  52. package/packages/types/package.json +1 -1
  53. package/packages/storefront/src/decap-cms/preview/indexeddb.ts +0 -51
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudcommerce/events",
3
3
  "type": "module",
4
- "version": "2.4.1",
4
+ "version": "2.4.3",
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.3",
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.3",
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.3",
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.3",
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.3",
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.3",
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.3",
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
+ id="${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;
44
+ });
45
+ startDevServer();
46
+ });
75
47
  }
76
48
  };
77
49
  };