cloudcommerce 0.0.63 → 0.0.66
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/.eslintrc.cjs +1 -1
- package/CHANGELOG.md +39 -0
- package/package.json +1 -1
- package/packages/api/lib/api.d.ts +8 -8
- package/packages/api/lib/types/applications.d.ts +2 -2
- package/packages/api/package.json +1 -1
- package/packages/api/src/types/applications.d.ts +2 -2
- package/packages/apps/correios/CHANGELOG.md +1 -0
- package/packages/apps/correios/README.md +1 -0
- package/packages/apps/correios/lib/correios.d.ts +2 -0
- package/packages/apps/correios/lib/correios.js +6 -0
- package/packages/apps/correios/lib/correios.js.map +1 -0
- package/packages/apps/correios/lib/index.d.ts +1 -0
- package/packages/apps/correios/lib/index.js +2 -0
- package/packages/apps/correios/lib/index.js.map +1 -0
- package/packages/apps/correios/lib-mjs/calculate-correios.mjs +470 -0
- package/packages/apps/correios/lib-mjs/correios-ws.mjs +154 -0
- package/packages/apps/correios/package.json +29 -0
- package/packages/apps/correios/src/correios.ts +7 -0
- package/packages/apps/correios/src/index.ts +1 -0
- package/packages/apps/correios/tsconfig.json +6 -0
- package/packages/apps/custom-shipping/CHANGELOG.md +1 -0
- package/packages/apps/custom-shipping/README.md +1 -0
- package/packages/apps/custom-shipping/lib/custom-shipping.d.ts +2 -0
- package/packages/apps/custom-shipping/lib/custom-shipping.js +6 -0
- package/packages/apps/custom-shipping/lib/custom-shipping.js.map +1 -0
- package/packages/apps/custom-shipping/lib/index.d.ts +1 -0
- package/packages/apps/custom-shipping/lib/index.js +2 -0
- package/packages/apps/custom-shipping/lib/index.js.map +1 -0
- package/packages/apps/custom-shipping/lib-mjs/calculate-custom-shipping.mjs +251 -0
- package/packages/apps/custom-shipping/package.json +27 -0
- package/packages/apps/custom-shipping/src/custom-shipping.ts +7 -0
- package/packages/apps/custom-shipping/src/index.ts +1 -0
- package/packages/apps/custom-shipping/tsconfig.json +6 -0
- package/packages/apps/discounts/lib/index.js +1 -1
- package/packages/apps/discounts/package.json +3 -7
- package/packages/apps/tiny-erp/README.md +1 -1
- package/packages/apps/tiny-erp/lib/event-to-tiny.js +0 -2
- package/packages/apps/tiny-erp/lib/event-to-tiny.js.map +1 -1
- package/packages/apps/tiny-erp/lib/index.js +1 -1
- package/packages/apps/tiny-erp/lib/integration/export-order-to-tiny.js +9 -6
- package/packages/apps/tiny-erp/lib/integration/export-order-to-tiny.js.map +1 -1
- package/packages/apps/tiny-erp/package.json +1 -1
- package/packages/apps/tiny-erp/src/event-to-tiny.ts +0 -2
- package/packages/apps/tiny-erp/src/integration/export-order-to-tiny.ts +9 -6
- package/packages/cli/package.json +1 -1
- package/packages/config/CHANGELOG.md +1 -0
- package/packages/config/README.md +1 -0
- package/packages/config/lib/config.d.ts +13 -0
- package/packages/config/lib/config.js +30 -0
- package/packages/config/lib/config.js.map +1 -0
- package/packages/{firebase → config}/lib/defaults.d.ts +0 -0
- package/packages/{firebase → config}/lib/defaults.js +0 -0
- package/packages/{firebase → config}/lib/defaults.js.map +0 -0
- package/packages/config/lib/env.d.ts +11 -0
- package/packages/config/lib/env.js +30 -0
- package/packages/config/lib/env.js.map +1 -0
- package/packages/config/package.json +33 -0
- package/packages/config/src/config.ts +43 -0
- package/packages/{firebase → config}/src/defaults.ts +0 -0
- package/packages/config/src/env.ts +43 -0
- package/packages/config/tsconfig.json +6 -0
- package/packages/events/lib/firebase.js.map +1 -1
- package/packages/events/package.json +1 -1
- package/packages/events/src/firebase.ts +0 -1
- package/packages/firebase/lib/config.d.ts +21 -18
- package/packages/firebase/lib/config.js +20 -38
- package/packages/firebase/lib/config.js.map +1 -1
- package/packages/firebase/lib/env.d.ts +2 -10
- package/packages/firebase/lib/env.js +3 -27
- package/packages/firebase/lib/env.js.map +1 -1
- package/packages/firebase/lib/index.js.map +1 -1
- package/packages/firebase/lib/init.js.map +1 -1
- package/packages/firebase/package.json +2 -2
- package/packages/firebase/src/config.ts +23 -42
- package/packages/firebase/src/env.ts +2 -38
- package/packages/firebase/src/index.ts +0 -1
- package/packages/firebase/src/init.ts +0 -1
- package/packages/modules/lib/firebase/call-app-module.js +33 -13
- package/packages/modules/lib/firebase/call-app-module.js.map +1 -1
- package/packages/modules/lib/firebase.js.map +1 -1
- package/packages/modules/package.json +3 -1
- package/packages/modules/src/firebase/call-app-module.ts +34 -14
- package/packages/modules/src/firebase.ts +0 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/lib/firebase.js.map +1 -1
- package/packages/ssr/package.json +1 -1
- package/packages/ssr/src/firebase.ts +0 -1
- package/packages/storefront/.eslintrc.cjs +6 -0
- package/packages/storefront/astro.config.mjs +20 -0
- package/packages/storefront/content/blog.json +18 -0
- package/packages/storefront/content/brands.json +24 -0
- package/packages/storefront/content/categories.json +24 -0
- package/packages/storefront/content/code.json +5 -0
- package/packages/storefront/content/collections.json +24 -0
- package/packages/storefront/content/contacts.json +13 -0
- package/packages/storefront/content/footer.json +46 -0
- package/packages/storefront/content/header.json +27 -0
- package/packages/storefront/content/home.json +45 -0
- package/packages/storefront/content/info.json +18 -0
- package/packages/storefront/content/maintenance.json +6 -0
- package/packages/storefront/content/menu.json +6 -0
- package/packages/storefront/content/pages/contato.json +6 -0
- package/packages/storefront/content/pages/entrega.json +6 -0
- package/packages/storefront/content/pages/faq.json +6 -0
- package/packages/storefront/content/pages/pagamentos.json +6 -0
- package/packages/storefront/content/pages/privacidade.json +6 -0
- package/packages/storefront/content/pages/sobre-nos.json +6 -0
- package/packages/storefront/content/pages/termos.json +6 -0
- package/packages/storefront/content/pages/trocas.json +6 -0
- package/packages/storefront/content/posts/esta-loja-e-um-pwa.json +9 -0
- package/packages/storefront/content/products.json +32 -0
- package/packages/storefront/content/search.json +8 -0
- package/packages/storefront/content/settings.json +25 -0
- package/packages/storefront/content/social.json +5 -0
- package/packages/storefront/content/widgets/analytics.json +11 -0
- package/packages/storefront/content/widgets/compre-confie.json +11 -0
- package/packages/storefront/content/widgets/ebit.json +11 -0
- package/packages/storefront/content/widgets/fb-pixel.json +12 -0
- package/packages/storefront/content/widgets/gmc-ratings.json +12 -0
- package/packages/storefront/content/widgets/minicart.json +6 -0
- package/packages/storefront/content/widgets/offers-notification.json +11 -0
- package/packages/storefront/content/widgets/opinioes-verificadas.json +18 -0
- package/packages/storefront/content/widgets/product-card.json +10 -0
- package/packages/storefront/content/widgets/product.json +13 -0
- package/packages/storefront/content/widgets/search-engine.json +8 -0
- package/packages/storefront/content/widgets/search.json +6 -0
- package/packages/storefront/content/widgets/tag-manager.json +12 -0
- package/packages/storefront/content/widgets/tawkto.json +12 -0
- package/packages/storefront/content/widgets/trustvox.json +15 -0
- package/packages/storefront/content/widgets/user.json +5 -0
- package/packages/storefront/dist/client/assets/_...0b5ebd52.css +1 -0
- package/packages/storefront/dist/client/assets/_...d4aa8aff.css +1 -0
- package/packages/storefront/dist/client/assets/index.5608ba47.css +1 -0
- package/packages/storefront/dist/client/client.dbac84dd.js +1 -0
- package/packages/storefront/dist/client/favicon.ico +0 -0
- package/packages/storefront/dist/client/page.3aa82516.js +1 -0
- package/packages/storefront/dist/client/~partytown/partytown-atomics.js +2 -0
- package/packages/storefront/dist/client/~partytown/partytown-media.js +2 -0
- package/packages/storefront/dist/client/~partytown/partytown-sw.js +2 -0
- package/packages/storefront/dist/client/~partytown/partytown.js +2 -0
- package/packages/storefront/dist/server/entry.mjs +1674 -0
- package/packages/storefront/package.json +7 -3
- package/packages/storefront/public/favicon.ico +0 -0
- package/packages/storefront/src/components/Card.astro +74 -0
- package/packages/storefront/src/layouts/Layout.astro +56 -0
- package/packages/storefront/src/pages/[...slug].astro +76 -0
- package/packages/storefront/src/pages/index.astro +82 -0
- package/packages/storefront/src/storefront-config.ts +28 -0
- package/packages/storefront/tsconfig.json +3 -0
- package/packages/types/package.json +1 -1
- package/packages/apps/_app.config.js +0 -80
- package/packages/apps/discounts/lib/discounts.config.d.ts +0 -14
- package/packages/apps/discounts/lib/discounts.config.js +0 -19
- package/packages/apps/discounts/lib/discounts.config.js.map +0 -1
- package/packages/apps/discounts/src/discounts.config.ts +0 -25
|
@@ -12,7 +12,15 @@ export default async (appId, modName, url, data, isBigTimeout) => {
|
|
|
12
12
|
return Promise.reject(err);
|
|
13
13
|
}
|
|
14
14
|
const { storeId, apps } = config.get();
|
|
15
|
-
const
|
|
15
|
+
const checkErrorResponse = (logHead, resData) => {
|
|
16
|
+
if (typeof resData === 'object' && resData !== null) {
|
|
17
|
+
const { error, message } = resData;
|
|
18
|
+
if (typeof error === 'string' && error.length && typeof message === 'string') {
|
|
19
|
+
logger.warn(logHead, JSON.stringify({ error, message }));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const debugAndBlacklist = (response) => {
|
|
16
24
|
const status = response ? response.status : 0;
|
|
17
25
|
if (!blacklist[url]) {
|
|
18
26
|
blacklist[url] = 1;
|
|
@@ -26,15 +34,11 @@ export default async (appId, modName, url, data, isBigTimeout) => {
|
|
|
26
34
|
delete blacklist[url];
|
|
27
35
|
}
|
|
28
36
|
}, !status ? 180000 : 6000);
|
|
29
|
-
|
|
37
|
+
const logHead = `${url} : ${status}`;
|
|
30
38
|
if (status >= 400 && status < 500) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (typeof error === 'string' && error.length && typeof message === 'string') {
|
|
35
|
-
logger.warn(JSON.stringify({ error, message }));
|
|
36
|
-
}
|
|
37
|
-
}
|
|
39
|
+
checkErrorResponse(logHead, response.data);
|
|
40
|
+
} else {
|
|
41
|
+
logger.info(logHead);
|
|
38
42
|
}
|
|
39
43
|
};
|
|
40
44
|
// eslint-disable-next-line no-unused-vars
|
|
@@ -46,6 +50,18 @@ export default async (appId, modName, url, data, isBigTimeout) => {
|
|
|
46
50
|
.then(({ applyDiscount }) => applyDiscount(_data));
|
|
47
51
|
};
|
|
48
52
|
}
|
|
53
|
+
} else if (modName === 'calculate_shipping') {
|
|
54
|
+
if (appId === apps.correios.appId) {
|
|
55
|
+
internalModuleFn = async (_data = data) => {
|
|
56
|
+
return import('@cloudcommerce/app-correios')
|
|
57
|
+
.then(({ calculateShipping }) => calculateShipping(_data));
|
|
58
|
+
};
|
|
59
|
+
} else if (appId === apps.customShipping.appId) {
|
|
60
|
+
internalModuleFn = async (_data = data) => {
|
|
61
|
+
return import('@cloudcommerce/app-custom-shipping')
|
|
62
|
+
.then(({ calculateShipping }) => calculateShipping(_data));
|
|
63
|
+
};
|
|
64
|
+
}
|
|
49
65
|
}
|
|
50
66
|
if (internalModuleFn) {
|
|
51
67
|
/*
|
|
@@ -61,10 +77,14 @@ export default async (appId, modName, url, data, isBigTimeout) => {
|
|
|
61
77
|
*/
|
|
62
78
|
const middleware = global[`app${appId}_${modName}_middleware`];
|
|
63
79
|
try {
|
|
80
|
+
let appResponse;
|
|
64
81
|
if (typeof middleware === 'function') {
|
|
65
|
-
|
|
82
|
+
appResponse = await middleware(data, internalModuleFn);
|
|
83
|
+
} else {
|
|
84
|
+
appResponse = await internalModuleFn(data);
|
|
66
85
|
}
|
|
67
|
-
|
|
86
|
+
checkErrorResponse(`${appId}_${modName}`, appResponse);
|
|
87
|
+
return appResponse;
|
|
68
88
|
} catch (err) {
|
|
69
89
|
logger.error(err);
|
|
70
90
|
let message = 'Failed to execute module function';
|
|
@@ -91,12 +111,12 @@ export default async (appId, modName, url, data, isBigTimeout) => {
|
|
|
91
111
|
timeout: isBigTimeout ? 30000 : 10000,
|
|
92
112
|
})
|
|
93
113
|
.then((response) => {
|
|
94
|
-
|
|
114
|
+
debugAndBlacklist(response);
|
|
95
115
|
return response.data;
|
|
96
116
|
})
|
|
97
117
|
.catch((err) => {
|
|
98
118
|
const { response } = err;
|
|
99
|
-
|
|
119
|
+
debugAndBlacklist(response);
|
|
100
120
|
if (err.message || err.code) {
|
|
101
121
|
let msg = `Axios error ${err.code}: ${err.message}`;
|
|
102
122
|
if (data) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call-app-module.js","sourceRoot":"","sources":["../../src/firebase/call-app-module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,MAAM,MAAM,oCAAoC,CAAC;AAExD,gDAAgD;AAChD,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,eAAe,KAAK,EAClB,KAAa,EACb,OAAsB,EACtB,GAAW,EACX,IAAS,EACT,YAAqB,EACrB,EAAE;IACF,IAAI,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;QACtB,MAAM,CAAC,GAAG,CAAC,0BAA0B,GAAG,EAAE,CAAC,CAAC;QAC5C,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACjD,OAAO,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;KAC5B;IACD,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;IAEvC,MAAM,KAAK,GAAG,CAAC,QAAuB,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"call-app-module.js","sourceRoot":"","sources":["../../src/firebase/call-app-module.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,MAAM,MAAM,oCAAoC,CAAC;AAExD,gDAAgD;AAChD,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,eAAe,KAAK,EAClB,KAAa,EACb,OAAsB,EACtB,GAAW,EACX,IAAS,EACT,YAAqB,EACrB,EAAE;IACF,IAAI,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;QACtB,MAAM,CAAC,GAAG,CAAC,0BAA0B,GAAG,EAAE,CAAC,CAAC;QAC5C,MAAM,GAAG,GAAG,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QACjD,OAAO,OAAO,CAA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AAI,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,IAAI,EAAE;YAC3B,IAAI,GAAG,GAAG,eAAe,GAAG,CAAC,IAAI,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;YACpD,IAAI,IAAI,EAAE;gBACR,GAAG,IAAI,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;aACtC;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SAClB;QACD,MAAM,GAAG,CAAC;IACZ,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,iDAAiD;
|
|
1
|
+
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,kCAAkC,CAAC;AAC1C,gDAAgD;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,oCAAoC,CAAC;AACxD,OAAO,eAAe,MAAM,8BAA8B,CAAC;AAE3D,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC;AAE9C,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC,oBAAoB,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IAClE,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC5B,CAAC,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/modules",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.66",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce modules API",
|
|
6
6
|
"main": "lib/index.cjs",
|
|
7
7
|
"exports": {
|
|
@@ -25,6 +25,8 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@cloudcommerce/api": "workspace:*",
|
|
28
|
+
"@cloudcommerce/app-correios": "workspace:*",
|
|
29
|
+
"@cloudcommerce/app-custom-shipping": "workspace:*",
|
|
28
30
|
"@cloudcommerce/app-discounts": "workspace:*",
|
|
29
31
|
"@cloudcommerce/firebase": "workspace:*",
|
|
30
32
|
"ajv": "^8.11.0",
|
|
@@ -20,7 +20,16 @@ export default async (
|
|
|
20
20
|
}
|
|
21
21
|
const { storeId, apps } = config.get();
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const checkErrorResponse = (logHead: string, resData: any) => {
|
|
24
|
+
if (typeof resData === 'object' && resData !== null) {
|
|
25
|
+
const { error, message } = resData;
|
|
26
|
+
if (typeof error === 'string' && error.length && typeof message === 'string') {
|
|
27
|
+
logger.warn(logHead, JSON.stringify({ error, message }));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const debugAndBlacklist = (response: AxiosResponse) => {
|
|
24
33
|
const status = response ? response.status : 0;
|
|
25
34
|
if (!blacklist[url]) {
|
|
26
35
|
blacklist[url] = 1;
|
|
@@ -34,16 +43,11 @@ export default async (
|
|
|
34
43
|
delete blacklist[url];
|
|
35
44
|
}
|
|
36
45
|
}, !status ? 180000 : 6000);
|
|
37
|
-
|
|
38
|
-
logger.info(`${url} : ${status}`);
|
|
46
|
+
const logHead = `${url} : ${status}`;
|
|
39
47
|
if (status >= 400 && status < 500) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (typeof error === 'string' && error.length && typeof message === 'string') {
|
|
44
|
-
logger.warn(JSON.stringify({ error, message }));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
48
|
+
checkErrorResponse(logHead, response.data);
|
|
49
|
+
} else {
|
|
50
|
+
logger.info(logHead);
|
|
47
51
|
}
|
|
48
52
|
};
|
|
49
53
|
|
|
@@ -56,6 +60,18 @@ export default async (
|
|
|
56
60
|
.then(({ applyDiscount }) => applyDiscount(_data));
|
|
57
61
|
};
|
|
58
62
|
}
|
|
63
|
+
} else if (modName === 'calculate_shipping') {
|
|
64
|
+
if (appId === apps.correios.appId) {
|
|
65
|
+
internalModuleFn = async (_data: AppModuleBody = data) => {
|
|
66
|
+
return import('@cloudcommerce/app-correios')
|
|
67
|
+
.then(({ calculateShipping }) => calculateShipping(_data));
|
|
68
|
+
};
|
|
69
|
+
} else if (appId === apps.customShipping.appId) {
|
|
70
|
+
internalModuleFn = async (_data: AppModuleBody = data) => {
|
|
71
|
+
return import('@cloudcommerce/app-custom-shipping')
|
|
72
|
+
.then(({ calculateShipping }) => calculateShipping(_data));
|
|
73
|
+
};
|
|
74
|
+
}
|
|
59
75
|
}
|
|
60
76
|
if (internalModuleFn) {
|
|
61
77
|
/*
|
|
@@ -71,10 +87,14 @@ export default async (
|
|
|
71
87
|
*/
|
|
72
88
|
const middleware = global[`app${appId}_${modName}_middleware`];
|
|
73
89
|
try {
|
|
90
|
+
let appResponse: any;
|
|
74
91
|
if (typeof middleware === 'function') {
|
|
75
|
-
|
|
92
|
+
appResponse = await middleware(data, internalModuleFn);
|
|
93
|
+
} else {
|
|
94
|
+
appResponse = await internalModuleFn(data);
|
|
76
95
|
}
|
|
77
|
-
|
|
96
|
+
checkErrorResponse(`${appId}_${modName}`, appResponse);
|
|
97
|
+
return appResponse;
|
|
78
98
|
} catch (err) {
|
|
79
99
|
logger.error(err);
|
|
80
100
|
let message = 'Failed to execute module function';
|
|
@@ -102,12 +122,12 @@ export default async (
|
|
|
102
122
|
timeout: isBigTimeout ? 30000 : 10000,
|
|
103
123
|
})
|
|
104
124
|
.then((response) => {
|
|
105
|
-
|
|
125
|
+
debugAndBlacklist(response);
|
|
106
126
|
return response.data;
|
|
107
127
|
})
|
|
108
128
|
.catch((err) => {
|
|
109
129
|
const { response } = err;
|
|
110
|
-
|
|
130
|
+
debugAndBlacklist(response);
|
|
111
131
|
if (err.message || err.code) {
|
|
112
132
|
let msg = `Axios error ${err.code}: ${err.message}`;
|
|
113
133
|
if (data) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,iDAAiD;
|
|
1
|
+
{"version":3,"file":"firebase.js","sourceRoot":"","sources":["../src/firebase.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,kCAAkC,CAAC;AAC1C,gDAAgD;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,oCAAoC,CAAC;AAExD,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC;AAElD,MAAM,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;IAC1D,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;AACvC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// https://github.com/import-js/eslint-plugin-import/issues/1810
|
|
2
|
+
/* eslint-disable import/no-unresolved */
|
|
3
|
+
import { defineConfig } from 'astro/config';
|
|
4
|
+
import node from '@astrojs/node';
|
|
5
|
+
import vue from '@astrojs/vue';
|
|
6
|
+
import partytown from '@astrojs/partytown';
|
|
7
|
+
import prefetch from '@astrojs/prefetch';
|
|
8
|
+
import sitemap from '@astrojs/sitemap';
|
|
9
|
+
|
|
10
|
+
// https://astro.build/config
|
|
11
|
+
export default defineConfig({
|
|
12
|
+
output: 'server',
|
|
13
|
+
adapter: node(),
|
|
14
|
+
integrations: [
|
|
15
|
+
vue(),
|
|
16
|
+
partytown(),
|
|
17
|
+
prefetch(),
|
|
18
|
+
sitemap(),
|
|
19
|
+
],
|
|
20
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"sections": [
|
|
3
|
+
{
|
|
4
|
+
"type": "breadcrumbs",
|
|
5
|
+
"enabled": true
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"type": "page-title"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"type": "document-banner",
|
|
12
|
+
"enabled": true
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"type": "brand-retail",
|
|
16
|
+
"enabled": true,
|
|
17
|
+
"sort": "sales"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"type": "document-description",
|
|
21
|
+
"enabled": true
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"sections": [
|
|
3
|
+
{
|
|
4
|
+
"type": "breadcrumbs",
|
|
5
|
+
"enabled": true
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"type": "page-title"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"type": "document-banner",
|
|
12
|
+
"enabled": true
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"type": "category-retail",
|
|
16
|
+
"enabled": true,
|
|
17
|
+
"sort": "sales"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"type": "document-description",
|
|
21
|
+
"enabled": true
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"sections": [
|
|
3
|
+
{
|
|
4
|
+
"type": "breadcrumbs",
|
|
5
|
+
"enabled": true
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"type": "page-title"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"type": "document-banner",
|
|
12
|
+
"enabled": true
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"type": "collection-retail",
|
|
16
|
+
"enabled": true,
|
|
17
|
+
"sort": "sales"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"type": "document-description",
|
|
21
|
+
"enabled": true
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"email": "vitor@e-com.club",
|
|
3
|
+
"phone": "(31) 9 8272-1558",
|
|
4
|
+
"whatsapp": "(31) 9 8272-1558",
|
|
5
|
+
"address": "Endereço",
|
|
6
|
+
"doc_number": "123",
|
|
7
|
+
"facebook": "https://www.facebook.com/ecom.clubpage/",
|
|
8
|
+
"twitter": "",
|
|
9
|
+
"youtube": "https://www.youtube.com/channel/UCBlIxK5JAub0E1EX_qHdzmA",
|
|
10
|
+
"tiktok": "",
|
|
11
|
+
"instagram": "https://www.instagram.com/ecomclub/",
|
|
12
|
+
"pinterest": ""
|
|
13
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": {
|
|
3
|
+
"title": "",
|
|
4
|
+
"text": ""
|
|
5
|
+
},
|
|
6
|
+
"links_1": {
|
|
7
|
+
"list_pages": true,
|
|
8
|
+
"title": "Pages",
|
|
9
|
+
"list": []
|
|
10
|
+
},
|
|
11
|
+
"links_2": {
|
|
12
|
+
"list_categories": true,
|
|
13
|
+
"title": "Categories",
|
|
14
|
+
"list": []
|
|
15
|
+
},
|
|
16
|
+
"contacts": {
|
|
17
|
+
"title": "Contacts",
|
|
18
|
+
"phone_wpp": true,
|
|
19
|
+
"socials": true,
|
|
20
|
+
"email": true,
|
|
21
|
+
"address": true
|
|
22
|
+
},
|
|
23
|
+
"stamps": [
|
|
24
|
+
{
|
|
25
|
+
"src": "/img/uploads/ssl-safe.png",
|
|
26
|
+
"alt": "Secure connection"
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"payment_methods": {
|
|
30
|
+
"bb": true,
|
|
31
|
+
"visa": true,
|
|
32
|
+
"boleto": true,
|
|
33
|
+
"aura": false,
|
|
34
|
+
"banrisul": false,
|
|
35
|
+
"elo": true,
|
|
36
|
+
"hipercard": false,
|
|
37
|
+
"hsbc": false,
|
|
38
|
+
"bradesco": true,
|
|
39
|
+
"santander": false,
|
|
40
|
+
"mastercard": true,
|
|
41
|
+
"citibank": false,
|
|
42
|
+
"mais": false,
|
|
43
|
+
"itau": true
|
|
44
|
+
},
|
|
45
|
+
"credits": ""
|
|
46
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"marketing_stripe": {
|
|
3
|
+
"text": "Aproveite nossos descontos de até 50%!",
|
|
4
|
+
"link": "/promotion"
|
|
5
|
+
},
|
|
6
|
+
"contacts_stripe": {
|
|
7
|
+
"pages": [
|
|
8
|
+
{
|
|
9
|
+
"title": "Sobre nós",
|
|
10
|
+
"link": "/pages/sobre-nos"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"title": "Esta loja é um PWA",
|
|
14
|
+
"link": "/posts/esta-loja-e-um-pwa"
|
|
15
|
+
}
|
|
16
|
+
],
|
|
17
|
+
"phone_wpp": true,
|
|
18
|
+
"socials": true
|
|
19
|
+
},
|
|
20
|
+
"categories_list": {
|
|
21
|
+
"featured": [],
|
|
22
|
+
"random": 6,
|
|
23
|
+
"full_width": false
|
|
24
|
+
},
|
|
25
|
+
"desktop_megamenu": false,
|
|
26
|
+
"search_input": true
|
|
27
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta_title": "",
|
|
3
|
+
"meta_description": "",
|
|
4
|
+
"sections": [
|
|
5
|
+
{
|
|
6
|
+
"type": "banner-slider",
|
|
7
|
+
"autoplay": 9000,
|
|
8
|
+
"full_width": false,
|
|
9
|
+
"slides": [
|
|
10
|
+
{
|
|
11
|
+
"img": "/img/uploads/rect89.webp",
|
|
12
|
+
"link": "/headset",
|
|
13
|
+
"alt": "Headset banner",
|
|
14
|
+
"start": "",
|
|
15
|
+
"end": "",
|
|
16
|
+
"mobile_img": "/img/uploads/headphone.webp"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"start": "",
|
|
20
|
+
"end": "",
|
|
21
|
+
"img": "/img/uploads/banner2.webp"
|
|
22
|
+
}
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"type": "info-bar",
|
|
27
|
+
"enabled": true
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"type": "collection-shelf",
|
|
31
|
+
"shuffle": false,
|
|
32
|
+
"collection_id": null,
|
|
33
|
+
"sort": "offers",
|
|
34
|
+
"title": "",
|
|
35
|
+
"headless": false,
|
|
36
|
+
"limit": 12,
|
|
37
|
+
"page": 1
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"type": "page-title",
|
|
41
|
+
"title": "Loja demo da E-Com Plus",
|
|
42
|
+
"description": "Loja de demonstração e testes da plataforma E-Com Plus e Storefront. Todos os produtos, preços e informações são meramente ilustrativos."
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"shipping": {
|
|
3
|
+
"show": true,
|
|
4
|
+
"text": "Entregamos para todo o Brasil"
|
|
5
|
+
},
|
|
6
|
+
"installments": {
|
|
7
|
+
"show": true,
|
|
8
|
+
"text": "Parcele sem juros"
|
|
9
|
+
},
|
|
10
|
+
"exchange": {
|
|
11
|
+
"show": true,
|
|
12
|
+
"text": "Não gostou? A primeira troca é gratuita"
|
|
13
|
+
},
|
|
14
|
+
"promo": {
|
|
15
|
+
"show": true,
|
|
16
|
+
"text": "Diferentes promoções ao longo do ano!"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Política de privacidade",
|
|
3
|
+
"meta_title": "Política de privacidade",
|
|
4
|
+
"meta_description": "Política de privacidade",
|
|
5
|
+
"body": "Nos comprometemos a preservar os dados de todos os clientes, informações importantes como senha e CPF são criptografadas no momento do cadastro, antes de serem salvas. A finalização da sua compra será realizada em ambiente seguro e nenhuma informação relacionada a cartões de crédito ou contas bancárias será armazenada em nossos bancos de dados. Os dados cadastrais dos clientes não são vendidos, trocados ou divulgados para terceiros, exceto quando essas informações são necessárias para o processo de entrega, para cobrança, ou para participação em promoções solicitadas pelos clientes. Seus dados pessoais são peça fundamental para que seu pedido chegue em segurança, na sua casa, de acordo com nosso prazo de entrega. Nosso site utiliza cookies e informações de sua navegação (sessão do browser) com o objetivo de traçar um perfil do público que visita o site e aperfeiçoar sempre nossos serviços, produtos, conteúdos e garantir as melhores ofertas e promoções para você. Estas informações são registradas automaticamente e serão mantidas em sigilo absoluto. Qualquer alteração sobre nossa política de privacidade será devidamente informada nesta página."
|
|
6
|
+
}
|