cloudcommerce 2.3.2 → 2.3.4
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/.gitmodules +3 -3
- package/CHANGELOG.md +12 -0
- package/ecomplus-stores/{barra-doce → barradoce}/functions/many/package.json +4 -4
- package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/package.json +9 -9
- package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/DocDescription.vue +1 -1
- package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/main/content/Hero.astro +2 -2
- package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/main/content/Sections.astro +13 -13
- package/ecomplus-stores/{barra-doce → barradoce}/functions/with-apps/package.json +4 -4
- package/ecomplus-stores/{barra-doce → barradoce}/package.json +5 -5
- package/ecomplus-stores/tia-sonia/package.json +1 -1
- package/package.json +2 -2
- package/packages/api/package.json +1 -1
- package/packages/api/types/brands.d.ts +0 -8
- package/packages/api/types/categories.d.ts +0 -8
- package/packages/api/types/collections.d.ts +0 -8
- package/packages/api/types/products.d.ts +0 -8
- package/packages/api/types/stores.d.ts +11 -0
- 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/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 +2 -2
- package/packages/storefront/client.d.ts +3 -0
- package/packages/storefront/package.json +4 -3
- package/packages/storefront/src/decap-cms/gen-preview-container.ts +32 -0
- package/packages/storefront/src/decap-cms/get-cms-config.ts +59 -0
- package/packages/storefront/src/lib/components/ViewTransitions.astro +4 -1
- package/packages/storefront/src/lib/layouts/BaseHead.astro +5 -5
- package/packages/storefront/src/lib/scripts/decap-cms.ts +141 -0
- package/packages/test-base/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/pnpm-workspace.yaml +2 -2
- package/packages/storefront/src/lib/scripts/git-cms-auth.ts +0 -3
- package/packages/storefront/src/lib/scripts/sso-ecom.ts +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/.devcontainer/devcontainer.json +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/.editorconfig +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/.eslintrc.cjs +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/.firebaserc +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/.github/build-and-deploy +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/.github/renovate.json +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/.github/workflows/build-and-deploy.yml +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/.github/workflows/calibreapp-image-actions.yml +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/.gitpod.yml +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/.husky/pre-commit +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/.idx/dev.nix +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/.nvmrc +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/.vscode/extensions.json +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/.vscode/launch.json +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/.vscode/settings.json +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/README.md +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/SETUP.md +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/SETUP.pt-BR.md +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/conf/firebase.json +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/config.json +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/example.env +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/many/index.js +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/.eslintrc.cjs +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/.staged.eslintrc.cjs +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/astro.config.mjs +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/blog/3.md +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/blog/4.md +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/blog/5.md +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/blog/dos.md +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/blog/uno.md +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/extra-pages/contato.md +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/extra-pages/terms.md +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/extra-pages/trocas.md +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/layout.json +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/pages/brands.json +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/pages/categories.json +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/pages/collections.json +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/pages/home.json +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/pages/products.json +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/pages/search.json +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/settings.json +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/index.js +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/public/admin/.gitkeep +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/public/assets/.gitkeep +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/public/img/icon.png +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/public/img/large-icon.png +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/public/img/uploads/banner-forma-decora.jpg +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/public/img/uploads/ecom-icon.png +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/public/img/uploads/logo-barradoce.webp +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/public/img/uploads/og-image.png +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/public/robots.txt +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/scripts/build.sh +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/assets/style.css +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/AccountMenu.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/AccountPage.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/Banner.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/BannersGrid.astro +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/BlogPosts.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/Breadcrumbs.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/CartItem.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/CartSidebar.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/CheckoutPage.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/Collapse.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/ContentEntry.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/DocBanners.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/FooterStamps.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/HeroSlider.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/ImagesGallery.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/LoginForm.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/PageTitle.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/Pagination.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/PitchBar.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/Prices.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/ProductCard.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/ProductDetails.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/ProductShelf.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/ProductSpecifications.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/SearchFilters.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/SearchModal.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/SearchShowcase.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/ShopFooter.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/ShopHeader.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/ShopHeaderMenu.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/ShopHeaderSubmenu.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/ShopSidenav.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/ShopSidenavCategory.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/SkuSelector.vue +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/env.d.ts +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/layouts/Base.astro +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/layouts/PageFooter.astro +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/layouts/PageHeader.astro +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/main/Fallback.astro +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/main/Main.astro +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/pages/[...slug].astro +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/pages/_vue.ts +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/pages/app/account.astro +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/pages/app/index.astro +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/pages/blog/[page].astro +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/pages/blog/_blog-pages.ts +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/pages/~fallback.astro +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/scripts/InlineScripts.astro +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/tailwind.config.cjs +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/tsconfig.json +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/uno.config.cjs +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/functions/with-apps/index.js +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/scripts/install.sh +0 -0
- /package/ecomplus-stores/{barra-doce → barradoce}/tailwind.config.cjs +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/ssr",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.4",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront SSR",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@cloudcommerce/i18n": "workspace:*",
|
|
33
33
|
"@ecomplus/utils": "1.5.0-rc.6",
|
|
34
34
|
"@vueuse/core": "10.7.2",
|
|
35
|
-
"astro": "4.3.
|
|
35
|
+
"astro": "4.3.5",
|
|
36
36
|
"astro-capo": "^0.0.1",
|
|
37
37
|
"axios": "^1.6.7",
|
|
38
38
|
"firebase-admin": "^12.0.0",
|
|
@@ -27,6 +27,9 @@ interface Window {
|
|
|
27
27
|
ECOM_COUNTRY_CODE: string;
|
|
28
28
|
GIT_BRANCH: string;
|
|
29
29
|
AB_EXPERIMENT_ID?: string;
|
|
30
|
+
CMS_CUSTOM_CONFIG?: Record<string, any>;
|
|
31
|
+
CMS_SSO_URL?: string | null;
|
|
32
|
+
CMS_REPO_BASE_DIR?: string;
|
|
30
33
|
$storefront?: import('@@sf/$storefront').$Storefront & {
|
|
31
34
|
modulesInfoPreset?: Partial<typeof import('./src/lib/state/modules-info').default>,
|
|
32
35
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/storefront",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.3.
|
|
4
|
+
"version": "2.3.4",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront with Astro",
|
|
6
6
|
"bin": {
|
|
7
7
|
"storefront": "./scripts/build-prod.sh"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@types/gtag.js": "^0.0.18",
|
|
44
44
|
"@vite-pwa/astro": "^0.2.0",
|
|
45
45
|
"@vueuse/core": "10.7.2",
|
|
46
|
-
"astro": "4.3.
|
|
46
|
+
"astro": "4.3.5",
|
|
47
47
|
"astro-capo": "^0.0.1",
|
|
48
48
|
"chroma-js": "^2.4.2",
|
|
49
49
|
"dotenv": "^16.4.1",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@cloudcommerce/eslint": "workspace:*",
|
|
67
|
-
"@cloudcommerce/types": "workspace:*"
|
|
67
|
+
"@cloudcommerce/types": "workspace:*",
|
|
68
|
+
"@webcontainer/api": "^1.1.9"
|
|
68
69
|
}
|
|
69
70
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { WebContainer as IWebContainer } from '@webcontainer/api';
|
|
2
|
+
|
|
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,
|
|
7
|
+
}) => {
|
|
8
|
+
const webcontainerInstance: IWebContainer = await WebContainer.boot();
|
|
9
|
+
console.log({ webcontainerInstance });
|
|
10
|
+
// https://github.com/decaporg/decap-cms/issues/2183#issuecomment-997373169
|
|
11
|
+
return createClass({
|
|
12
|
+
render() {
|
|
13
|
+
const { entry } = (this as any).props;
|
|
14
|
+
console.log({ entry });
|
|
15
|
+
const { host } = window.location;
|
|
16
|
+
const slug = '';
|
|
17
|
+
const isLocal = host.startsWith('localhost') || host.startsWith('127.0.0.');
|
|
18
|
+
const src = `${isLocal ? 'http' : 'https'}://${host}/~preview/${slug}`;
|
|
19
|
+
const html = `
|
|
20
|
+
<iframe
|
|
21
|
+
border="0"
|
|
22
|
+
src="${src}"
|
|
23
|
+
width="100%"
|
|
24
|
+
height="100%"
|
|
25
|
+
style="border: 1px solid #EEE; height: calc(100dvh - 12px)"
|
|
26
|
+
></iframe>`;
|
|
27
|
+
return h('div', { dangerouslySetInnerHTML: { __html: html } });
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default genPreviewContainer;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export const getCmsConfig = () => {
|
|
2
|
+
const baseDir = window.CMS_REPO_BASE_DIR || 'functions/ssr/';
|
|
3
|
+
const config: Record<string, any> = {
|
|
4
|
+
load_config_file: false,
|
|
5
|
+
media_folder: `${baseDir}template/public/img/uploads`,
|
|
6
|
+
public_folder: '/img/uploads',
|
|
7
|
+
slug: {
|
|
8
|
+
encoding: 'ascii',
|
|
9
|
+
clean_accents: true,
|
|
10
|
+
sanitize_replacement: '-',
|
|
11
|
+
},
|
|
12
|
+
collections: [
|
|
13
|
+
{
|
|
14
|
+
name: 'settings',
|
|
15
|
+
label: 'Configurações',
|
|
16
|
+
description: 'Configurações gerais para identidade e metadados do site',
|
|
17
|
+
delete: false,
|
|
18
|
+
editor: {
|
|
19
|
+
preview: false,
|
|
20
|
+
},
|
|
21
|
+
files: [
|
|
22
|
+
{
|
|
23
|
+
name: 'general',
|
|
24
|
+
label: 'Configurações gerais',
|
|
25
|
+
file: `${baseDir}content/settings.json`,
|
|
26
|
+
editor: {
|
|
27
|
+
preview: true,
|
|
28
|
+
},
|
|
29
|
+
fields: [
|
|
30
|
+
{
|
|
31
|
+
label: 'E-Com Plus Store ID',
|
|
32
|
+
name: 'store_id',
|
|
33
|
+
widget: 'hidden',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: 'Repositório',
|
|
37
|
+
name: 'repository',
|
|
38
|
+
widget: 'hidden',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
label: 'Domínio',
|
|
42
|
+
name: 'domain',
|
|
43
|
+
widget: 'string',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
label: 'Nome da loja',
|
|
47
|
+
name: 'name',
|
|
48
|
+
widget: 'string',
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
};
|
|
56
|
+
return config;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default getCmsConfig;
|
|
@@ -291,7 +291,8 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
291
291
|
|
|
292
292
|
if (
|
|
293
293
|
(supportsViewTransitions || getFallback() !== 'none') &&
|
|
294
|
-
!location.pathname.startsWith('/app/')
|
|
294
|
+
!location.pathname.startsWith('/app/') &&
|
|
295
|
+
!location.pathname.startsWith('/admin/')
|
|
295
296
|
) {
|
|
296
297
|
markScriptsExec();
|
|
297
298
|
|
|
@@ -310,6 +311,7 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
310
311
|
link.hasAttribute('download') ||
|
|
311
312
|
!link.href ||
|
|
312
313
|
link.pathname.startsWith('/app/') || // "real" SPA routes
|
|
314
|
+
link.pathname.startsWith('/admin/') || // CMS route
|
|
313
315
|
(link.target && link.target !== '_self') ||
|
|
314
316
|
link.origin !== location.origin ||
|
|
315
317
|
ev.button !== 0 || // left clicks only
|
|
@@ -390,6 +392,7 @@ const { fallback = 'animate' } = Astro.props as Props;
|
|
|
390
392
|
el.origin === location.origin &&
|
|
391
393
|
el.pathname !== location.pathname &&
|
|
392
394
|
!el.pathname.startsWith('/app/') && // "real" SPA routes
|
|
395
|
+
!el.pathname.startsWith('/admin/') && // CMS route
|
|
393
396
|
el.dataset.astroReload === undefined &&
|
|
394
397
|
!el.hasAttribute('download') &&
|
|
395
398
|
/* <a role=button> commonly used as no-JS interaction fallback,
|
|
@@ -88,6 +88,11 @@ if (!ogImage) {
|
|
|
88
88
|
|
|
89
89
|
let inlineClientJS = `
|
|
90
90
|
window._emitApiContext = (id = null) => {
|
|
91
|
+
$storefront.url = new URL(window.location.toString());
|
|
92
|
+
$storefront.getSession = (/* sid */) => ({
|
|
93
|
+
url: $storefront.url,
|
|
94
|
+
apiContext: $storefront.apiContext,
|
|
95
|
+
});
|
|
91
96
|
console.log('[ctx] emit ' + id);
|
|
92
97
|
window.dispatchEvent(new Event('storefront:apiContext'));
|
|
93
98
|
window._emitedContextId = id;
|
|
@@ -135,16 +140,11 @@ if (apiDoc) {
|
|
|
135
140
|
inlineClientJS += `
|
|
136
141
|
window._firstLoadContextId = '${apiDoc._id}';`;
|
|
137
142
|
contextInlineClientJS = `
|
|
138
|
-
$storefront.url = new URL(window.location.toString());
|
|
139
143
|
$storefront.apiContext = ${JSON.stringify({
|
|
140
144
|
resource: apiContext.resource,
|
|
141
145
|
doc: minifyApiDoc({ ...apiDoc }),
|
|
142
146
|
timestamp: Date.now(),
|
|
143
147
|
})};
|
|
144
|
-
$storefront.getSession = (/* sid */) => {
|
|
145
|
-
url: $storefront.url,
|
|
146
|
-
apiContext: $storefront.apiContext,
|
|
147
|
-
};
|
|
148
148
|
$storefront.context /* DEPRECATED */ = $storefront.apiContext;
|
|
149
149
|
_emitApiContext('${apiDoc._id}');`;
|
|
150
150
|
} else {
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import Deepmerge from '@fastify/deepmerge';
|
|
2
|
+
import afetch from '../../helpers/afetch';
|
|
3
|
+
import getCmsConfig from '../../decap-cms/get-cms-config';
|
|
4
|
+
import genPreviewContainer from '../../decap-cms/gen-preview-container';
|
|
5
|
+
|
|
6
|
+
let cmsConfig: Record<string, any> = getCmsConfig();
|
|
7
|
+
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
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
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
|
+
const {
|
|
42
|
+
location,
|
|
43
|
+
sessionStorage,
|
|
44
|
+
ECOM_STORE_ID,
|
|
45
|
+
CMS_SSO_URL = 'https://app.e-com.plus/pages/login?api_version=2',
|
|
46
|
+
} = window;
|
|
47
|
+
let token = sessionStorage.getItem('cms_token');
|
|
48
|
+
const searchParams = new URLSearchParams(location.search);
|
|
49
|
+
const ssoToken = searchParams.get('sso_token') || searchParams.get('access_token');
|
|
50
|
+
if (!cmsConfig.backend?.base_url) {
|
|
51
|
+
if (!token && !ssoToken && CMS_SSO_URL) {
|
|
52
|
+
const url = new URL(CMS_SSO_URL);
|
|
53
|
+
url.searchParams.set('sso_store_id', `${ECOM_STORE_ID}`);
|
|
54
|
+
url.searchParams.set('sso_redirect', location.href);
|
|
55
|
+
location.href = url.toString();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
cmsConfig.backend = {
|
|
59
|
+
repo: '_owner/_name',
|
|
60
|
+
api_root: 'https://ecomplus.app/api/git/github/',
|
|
61
|
+
name: 'github',
|
|
62
|
+
base_url: `https://${location.hostname}`,
|
|
63
|
+
auth_endpoint: location.pathname, // self
|
|
64
|
+
branch: 'main',
|
|
65
|
+
commit_messages: {
|
|
66
|
+
create: 'Create {{collection}} “{{slug}}”',
|
|
67
|
+
update: 'Update {{collection}} “{{slug}}”',
|
|
68
|
+
delete: 'Delete {{collection}} “{{slug}}”',
|
|
69
|
+
uploadMedia: 'Upload “{{path}}”',
|
|
70
|
+
deleteMedia: '[skip ci] Delete “{{path}}”',
|
|
71
|
+
openAuthoring: '{{message}}',
|
|
72
|
+
...cmsConfig.backend?.commit_messages,
|
|
73
|
+
},
|
|
74
|
+
...cmsConfig.backend,
|
|
75
|
+
};
|
|
76
|
+
if (cmsConfig.backend.api_root?.startsWith('https://ecomplus.app/')) {
|
|
77
|
+
const res = await afetch('https://ecomplus.app/api/github-installation', {
|
|
78
|
+
headers: {
|
|
79
|
+
'X-Store-ID': `${ECOM_STORE_ID}`,
|
|
80
|
+
Authorization: `Bearer ${ssoToken}`,
|
|
81
|
+
},
|
|
82
|
+
});
|
|
83
|
+
if (res.ok) {
|
|
84
|
+
const { installations } = await res.json();
|
|
85
|
+
if (Array.isArray(installations)) {
|
|
86
|
+
const { repo } = cmsConfig.backend;
|
|
87
|
+
const installation = repo !== '_owner/_name'
|
|
88
|
+
? installations.find(({ repository }) => repository === repo)
|
|
89
|
+
: installations[0];
|
|
90
|
+
if (installation?.gh_token && installation.gh_token.charAt(0) !== '*') {
|
|
91
|
+
// Consume GitHub REST API directly
|
|
92
|
+
token = installation.gh_token;
|
|
93
|
+
delete cmsConfig.backend.api_root;
|
|
94
|
+
cmsConfig.backend.name = 'github';
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (token) {
|
|
101
|
+
if (!window.opener) initCmsWithPreview();
|
|
102
|
+
// Ref.: https://github.com/decaporg/decap-cms/blob/e93c94f1ce707719dfb7750af82b17c38b461831/packages/decap-cms-lib-auth/src/netlify-auth.js#L46
|
|
103
|
+
// E.g.: https://github.com/Herohtar/netlify-cms-oauth-firebase/blob/master/functions/index.js#L9-L25
|
|
104
|
+
const self = window.opener || window;
|
|
105
|
+
setTimeout(() => {
|
|
106
|
+
self.postMessage('authorizing:github', '*');
|
|
107
|
+
self.postMessage(
|
|
108
|
+
`authorization:github:success:${JSON.stringify({
|
|
109
|
+
token,
|
|
110
|
+
provider: cmsConfig.backend.name,
|
|
111
|
+
})}`,
|
|
112
|
+
cmsConfig.backend.base_url,
|
|
113
|
+
);
|
|
114
|
+
}, 100);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (ssoToken) {
|
|
118
|
+
window.history?.pushState(
|
|
119
|
+
'hide-token',
|
|
120
|
+
document.title,
|
|
121
|
+
`${location.pathname}${location.search}${location.hash}`,
|
|
122
|
+
);
|
|
123
|
+
const provider = cmsConfig.backend.name;
|
|
124
|
+
if (provider && provider !== 'git-gateway') {
|
|
125
|
+
sessionStorage.setItem('cms_token', ssoToken);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
initCmsWithPreview();
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
if (!import.meta.env.SSR) {
|
|
132
|
+
if (window.CMS_CUSTOM_CONFIG) {
|
|
133
|
+
const deepmerge = Deepmerge();
|
|
134
|
+
cmsConfig = deepmerge(cmsConfig, window.CMS_CUSTOM_CONFIG);
|
|
135
|
+
}
|
|
136
|
+
(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);
|
|
141
|
+
}
|
package/pnpm-workspace.yaml
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/.github/workflows/calibreapp-image-actions.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/extra-pages/contato.md
RENAMED
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/extra-pages/terms.md
RENAMED
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/extra-pages/trocas.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/pages/categories.json
RENAMED
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/content/pages/collections.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/public/img/uploads/ecom-icon.png
RENAMED
|
File without changes
|
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/public/img/uploads/og-image.png
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/AccountMenu.vue
RENAMED
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/AccountPage.vue
RENAMED
|
File without changes
|
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/BannersGrid.astro
RENAMED
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/BlogPosts.vue
RENAMED
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/Breadcrumbs.vue
RENAMED
|
File without changes
|
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/CartSidebar.vue
RENAMED
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/CheckoutPage.vue
RENAMED
|
File without changes
|
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/ContentEntry.vue
RENAMED
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/DocBanners.vue
RENAMED
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/FooterStamps.vue
RENAMED
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/HeroSlider.vue
RENAMED
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/ImagesGallery.vue
RENAMED
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/LoginForm.vue
RENAMED
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/PageTitle.vue
RENAMED
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/Pagination.vue
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/ecomplus-stores/{barra-doce → barradoce}/functions/ssr/src/components/ProductCard.vue
RENAMED
|
File without changes
|