cloudcommerce 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -0
- package/ecomplus-stores/barradoce/functions/many/package.json +3 -3
- package/ecomplus-stores/barradoce/functions/ssr/package.json +6 -6
- package/ecomplus-stores/barradoce/functions/ssr/src/components/CartSidebar.vue +20 -0
- package/ecomplus-stores/barradoce/functions/ssr/src/components/HeroSlider.vue +1 -3
- package/ecomplus-stores/barradoce/functions/ssr/src/components/ProductDetails.vue +12 -4
- package/ecomplus-stores/barradoce/functions/ssr/src/components/ShippingCalculator.vue +100 -0
- package/ecomplus-stores/barradoce/functions/with-apps/package.json +3 -3
- package/ecomplus-stores/barradoce/package.json +2 -2
- package/package.json +2 -2
- package/packages/api/package.json +1 -1
- package/packages/apps/affiliate-program/package.json +1 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-payment/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/datafrete/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/emails/package.json +1 -1
- package/packages/apps/fb-conversions/package.json +1 -1
- package/packages/apps/flash-courier/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/galaxpay/package.json +1 -1
- package/packages/apps/google-analytics/package.json +1 -1
- package/packages/apps/jadlog/package.json +1 -1
- package/packages/apps/loyalty-points/package.json +1 -1
- package/packages/apps/mandae/package.json +1 -1
- package/packages/apps/melhor-envio/package.json +1 -1
- package/packages/apps/mercadopago/package.json +1 -1
- package/packages/apps/pagarme/package.json +1 -1
- package/packages/apps/pagarme-v5/package.json +1 -1
- package/packages/apps/paghiper/package.json +1 -1
- package/packages/apps/pix/package.json +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/apps/webhooks/package.json +1 -1
- package/packages/cli/ci/bunny-prepare-ab.sh +4 -4
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/emails/package.json +1 -1
- package/packages/eslint/package.json +1 -1
- package/packages/eslint/storefront.eslintrc.cjs +1 -0
- package/packages/events/package.json +1 -1
- package/packages/feeds/package.json +1 -1
- package/packages/firebase/package.json +1 -1
- package/packages/i18n/package.json +1 -1
- package/packages/modules/package.json +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/package.json +3 -3
- package/packages/storefront/package.json +4 -3
- package/packages/storefront/src/__fixtures__/calculate_shipping.json +161 -0
- package/packages/storefront/src/helpers/afetch.ts +1 -0
- package/packages/storefront/src/lib/components/Spinner.vue +16 -0
- package/packages/storefront/src/lib/components/globals/Skeleton.vue +25 -7
- package/packages/storefront/src/lib/composables/use-shipping-calculator.ts +90 -31
- package/packages/storefront/src/lib/layouts/BaseBody.astro +0 -13
- package/packages/storefront/src/lib/scripts/experimental-web-ide.ts +29 -0
- package/packages/storefront/src/lib/ssr-context.ts +9 -0
- package/packages/storefront/src/web-ide/webcontainer.ts +104 -0
- package/packages/test-base/package.json +1 -1
- package/packages/types/package.json +1 -1
|
@@ -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
|
+
ref: 'c59d5884ab86899da1c7fd154bf4009cac0a60e9',
|
|
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 initVM = async ({ repo, ghToken, cliTextarea }: {
|
|
63
|
+
repo: string,
|
|
64
|
+
ghToken?: string,
|
|
65
|
+
cliTextarea: HTMLTextAreaElement,
|
|
66
|
+
}) => {
|
|
67
|
+
const vm = await WebContainer.boot();
|
|
68
|
+
const repoDir = 'store';
|
|
69
|
+
const files = genContainerFiles({ repo, ghToken, repoDir });
|
|
70
|
+
await vm.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 vm.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', '--omit=dev', '--ignore-scripts']);
|
|
90
|
+
const ssrDir = `${repoDir}/functions/ssr`;
|
|
91
|
+
await exec('npm', ['--prefix', ssrDir, 'ci']);
|
|
92
|
+
await vm.fs.writeFile(
|
|
93
|
+
`${ssrDir}/.env`,
|
|
94
|
+
`ECOM_STORE_ID=${window.ECOM_STORE_ID}\n`,
|
|
95
|
+
);
|
|
96
|
+
const startDevServer = async () => {
|
|
97
|
+
await exec('npm', ['--prefix', repoDir, 'run', 'dev']);
|
|
98
|
+
};
|
|
99
|
+
return {
|
|
100
|
+
vm,
|
|
101
|
+
vmExec: exec,
|
|
102
|
+
startDevServer,
|
|
103
|
+
};
|
|
104
|
+
};
|