cloudcommerce 2.4.3 → 2.5.1

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 (79) hide show
  1. package/.github/workflows/test-apps.yml +2 -2
  2. package/CHANGELOG.md +26 -0
  3. package/action.yml +3 -3
  4. package/ecomplus-stores/barradoce/functions/many/package.json +3 -3
  5. package/ecomplus-stores/barradoce/functions/ssr/package.json +10 -8
  6. package/ecomplus-stores/barradoce/functions/ssr/src/components/Pagination.vue +4 -7
  7. package/ecomplus-stores/barradoce/functions/ssr/src/components/ProductDetails.vue +1 -1
  8. package/ecomplus-stores/barradoce/functions/ssr/src/layouts/PageHeader.astro +5 -4
  9. package/ecomplus-stores/barradoce/functions/ssr/src/main/content/Hero.astro +1 -1
  10. package/ecomplus-stores/barradoce/functions/ssr/src/main/content/Sections.astro +10 -7
  11. package/ecomplus-stores/barradoce/functions/ssr/src/pages/admin/index.astro +2 -0
  12. package/ecomplus-stores/barradoce/functions/with-apps/package.json +3 -3
  13. package/ecomplus-stores/barradoce/package.json +2 -2
  14. package/package.json +10 -10
  15. package/packages/api/package.json +1 -1
  16. package/packages/apps/affiliate-program/package.json +1 -1
  17. package/packages/apps/correios/package.json +2 -2
  18. package/packages/apps/custom-payment/package.json +1 -1
  19. package/packages/apps/custom-shipping/package.json +1 -1
  20. package/packages/apps/datafrete/package.json +1 -1
  21. package/packages/apps/discounts/package.json +1 -1
  22. package/packages/apps/emails/package.json +1 -1
  23. package/packages/apps/fb-conversions/package.json +1 -1
  24. package/packages/apps/flash-courier/package.json +1 -1
  25. package/packages/apps/frenet/package.json +1 -1
  26. package/packages/apps/galaxpay/package.json +1 -1
  27. package/packages/apps/google-analytics/package.json +1 -1
  28. package/packages/apps/jadlog/package.json +1 -1
  29. package/packages/apps/loyalty-points/package.json +1 -1
  30. package/packages/apps/mandae/package.json +1 -1
  31. package/packages/apps/melhor-envio/package.json +1 -1
  32. package/packages/apps/mercadopago/package.json +1 -1
  33. package/packages/apps/pagarme/package.json +1 -1
  34. package/packages/apps/pagarme-v5/package.json +1 -1
  35. package/packages/apps/paghiper/package.json +1 -1
  36. package/packages/apps/pix/package.json +1 -1
  37. package/packages/apps/tiny-erp/package.json +1 -1
  38. package/packages/apps/webhooks/package.json +1 -1
  39. package/packages/cli/ci/bunny-prepare-ab.sh +4 -4
  40. package/packages/cli/package.json +2 -2
  41. package/packages/config/package.json +1 -1
  42. package/packages/emails/package.json +1 -1
  43. package/packages/eslint/package.json +3 -3
  44. package/packages/events/package.json +1 -1
  45. package/packages/feeds/package.json +1 -1
  46. package/packages/firebase/package.json +3 -3
  47. package/packages/i18n/package.json +1 -1
  48. package/packages/modules/package.json +1 -1
  49. package/packages/passport/package.json +1 -1
  50. package/packages/ssr/lib/lib/serve-storefront.js +1 -1
  51. package/packages/ssr/lib/lib/serve-storefront.js.map +1 -1
  52. package/packages/ssr/package.json +3 -3
  53. package/packages/ssr/src/lib/serve-storefront.ts +2 -2
  54. package/packages/storefront/astro.config.mjs +5 -1
  55. package/packages/storefront/client.d.ts +3 -0
  56. package/packages/storefront/config/astro/client-sf-directive.mjs +97 -0
  57. package/packages/storefront/config/astro/index.d.ts +9 -2
  58. package/packages/storefront/config/storefront.cms.js +3 -3
  59. package/packages/storefront/package.json +8 -9
  60. package/packages/storefront/src/decap-cms/create-preview-component.ts +135 -0
  61. package/packages/storefront/src/decap-cms/get-cms-config.ts +320 -12
  62. package/packages/storefront/src/lib/assets/decap-cms.css +81 -0
  63. package/packages/storefront/src/lib/components/Drawer.vue +8 -13
  64. package/packages/storefront/src/lib/components/QuantitySelector.vue +4 -9
  65. package/packages/storefront/src/lib/composables/use-pitch-bar.ts +3 -9
  66. package/packages/storefront/src/lib/composables/use-product-shelf.ts +4 -1
  67. package/packages/storefront/src/lib/content.d.ts +19 -4
  68. package/packages/storefront/src/lib/layouts/BaseBody.astro +0 -13
  69. package/packages/storefront/src/lib/layouts/BaseHead.astro +1 -1
  70. package/packages/storefront/src/lib/scripts/decap-cms.ts +36 -28
  71. package/packages/storefront/src/lib/ssr-context.ts +35 -11
  72. package/packages/storefront/src/lib/state/use-cms-preview.ts +88 -27
  73. package/packages/test-base/package.json +1 -1
  74. package/packages/types/package.json +1 -1
  75. package/packages/storefront/config/astro/context-directive.mjs +0 -46
  76. package/packages/storefront/src/decap-cms/gen-preview-container.ts +0 -51
  77. package/packages/storefront/src/decap-cms/preview/ssr-package.ts +0 -14160
  78. package/packages/storefront/src/decap-cms/preview/webcontainer.ts +0 -108
  79. package/packages/storefront/src/lib/pages/admin.astro +0 -0
@@ -1,108 +0,0 @@
1
- import { WebContainer } from '@webcontainer/api';
2
- import { json as frozenSsrPkgJson, lock as frozenSsrPkgLock } from './ssr-package';
3
-
4
- export const genContainerFiles = ({ repo, ghToken, repoDir }: {
5
- repo: string,
6
- ghToken?: string,
7
- repoDir: string,
8
- }) => ({
9
- 'git.js': {
10
- file: {
11
- contents: `
12
- import fs from 'node:fs';
13
- import { join as joinPath } from 'node:path';
14
- import { clone, pull } from 'isomorphic-git';
15
- import * as http from 'isomorphic-git/http/node/index.cjs';
16
- const dir = joinPath(process.cwd(), '${repoDir}');
17
- const isClone = process.argv.find((val) => val === '--clone');
18
- const options = {
19
- fs,
20
- http,
21
- dir,
22
- singleBranch: true,
23
- };
24
- ${(ghToken
25
- ? `
26
- options.oauth2format = 'github';
27
- options.token = '${ghToken}';`
28
- : '')}
29
- if (isClone) {
30
- options.url = 'https://github.com/${repo}.git';
31
- options.depth = 1;
32
- clone(options);
33
- } else {
34
- pull(options);
35
- }
36
- `,
37
- },
38
- },
39
- 'package.json': {
40
- file: {
41
- contents: `
42
- {
43
- "name": "git-app",
44
- "version": "1.0.0",
45
- "type": "module",
46
- "private": true,
47
- "description": "",
48
- "author": "",
49
- "license": "ISC",
50
- "scripts": {
51
- "git:clone": "node git.js --clone",
52
- "git:pull": "node git.js --pull"
53
- },
54
- "dependencies": {
55
- "isomorphic-git": "^1.25.3"
56
- }
57
- }`,
58
- },
59
- },
60
- });
61
-
62
- export const initWebcontainer = async ({ repo, ghToken, cliTextarea }: {
63
- repo: string,
64
- ghToken?: string,
65
- cliTextarea: HTMLTextAreaElement,
66
- }) => {
67
- const webcontainerInstance = await WebContainer.boot();
68
- const repoDir = 'store';
69
- const files = genContainerFiles({ repo, ghToken, repoDir });
70
- await webcontainerInstance.mount(files);
71
- const exec = async (command: string, args: string[]) => {
72
- const cliArgs = args.reduce((acc, opt) => `${acc} ${opt}`, '');
73
- const cli = `$ ${command}${cliArgs}\n`;
74
- cliTextarea.value += cli;
75
- const proc = await webcontainerInstance.spawn(command, args);
76
- if (import.meta.env.DEV || (window as any).DEBUG) {
77
- proc.output.pipeTo(new WritableStream({
78
- write(stdout) {
79
- console.debug?.('webcontainer', { stdout });
80
- },
81
- }));
82
- }
83
- if (await proc.exit !== 0) {
84
- throw new Error(`${command} failed`);
85
- }
86
- };
87
- await exec('npm', ['install']);
88
- await exec('npm', ['run', 'git:clone']);
89
- await exec('npm', ['--prefix', repoDir, 'ci']);
90
- const ssrDir = `${repoDir}/functions/ssr`;
91
- webcontainerInstance.fs.writeFile(`${ssrDir}/package.json`, frozenSsrPkgJson);
92
- webcontainerInstance.fs.writeFile(`${ssrDir}/package-lock.json`, frozenSsrPkgLock);
93
- await exec('npm', ['--prefix', ssrDir, 'ci']);
94
- await webcontainerInstance.fs.writeFile(
95
- `${ssrDir}/.env`,
96
- `ECOM_STORE_ID=${window.ECOM_STORE_ID}\n`,
97
- );
98
- const startDevServer = async () => {
99
- await exec('npm', ['--prefix', repoDir, 'run', 'dev']);
100
- // Keep restarting dev server (can crash)
101
- // startDevServer();
102
- };
103
- return {
104
- webcontainerInstance,
105
- webcontainerExec: exec,
106
- startDevServer,
107
- };
108
- };
File without changes