cloudcommerce 0.0.96 → 0.0.98
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 +21 -0
- package/package.json +3 -3
- package/packages/api/package.json +1 -1
- package/packages/apps/correios/lib-mjs/correios-ws.mjs +2 -1
- package/packages/apps/correios/package.json +1 -1
- package/packages/apps/custom-shipping/package.json +1 -1
- package/packages/apps/discounts/package.json +1 -1
- package/packages/apps/frenet/package.json +1 -1
- package/packages/apps/tiny-erp/lib/event-to-tiny.js +94 -94
- package/packages/apps/tiny-erp/lib/index.js +1 -1
- package/packages/apps/tiny-erp/lib/integration/after-tiny-queue.js +74 -71
- package/packages/apps/tiny-erp/lib/integration/export-order-to-tiny.js +73 -70
- package/packages/apps/tiny-erp/lib/integration/export-product-to-tiny.js +53 -49
- package/packages/apps/tiny-erp/lib/integration/helpers/format-tiny-date.js +3 -3
- package/packages/apps/tiny-erp/lib/integration/import-order-from-tiny.js +75 -76
- package/packages/apps/tiny-erp/lib/integration/import-product-from-tiny.js +140 -137
- package/packages/apps/tiny-erp/lib/integration/parsers/order-from-tiny.js +39 -40
- package/packages/apps/tiny-erp/lib/integration/parsers/order-to-tiny.js +178 -173
- package/packages/apps/tiny-erp/lib/integration/parsers/product-from-tiny.js +171 -173
- package/packages/apps/tiny-erp/lib/integration/parsers/product-to-tiny.js +127 -123
- package/packages/apps/tiny-erp/lib/integration/parsers/status-from-tiny.js +32 -32
- package/packages/apps/tiny-erp/lib/integration/parsers/status-to-tiny.js +37 -37
- package/packages/apps/tiny-erp/lib/integration/post-tiny-erp.js +43 -42
- package/packages/apps/tiny-erp/lib/tiny-erp.js +6 -8
- package/packages/apps/tiny-erp/lib/tiny-webhook.js +73 -76
- package/packages/apps/tiny-erp/package.json +2 -2
- package/packages/cli/package.json +1 -1
- package/packages/config/package.json +1 -1
- package/packages/events/package.json +2 -2
- package/packages/firebase/package.json +3 -3
- package/packages/modules/lib/firebase/ajv.js +19 -24
- package/packages/modules/lib/firebase/call-app-module.js +116 -110
- package/packages/modules/lib/firebase/checkout.js +151 -152
- package/packages/modules/lib/firebase/functions-checkout/fix-items.js +194 -187
- package/packages/modules/lib/firebase/functions-checkout/get-custumerId.js +25 -26
- package/packages/modules/lib/firebase/functions-checkout/handle-order-transaction.js +110 -109
- package/packages/modules/lib/firebase/functions-checkout/new-order.js +177 -177
- package/packages/modules/lib/firebase/functions-checkout/request-to-module.js +59 -59
- package/packages/modules/lib/firebase/functions-checkout/utils.js +195 -197
- package/packages/modules/lib/firebase/handle-module.js +144 -146
- package/packages/modules/lib/firebase/proxy-apps.js +2 -1
- package/packages/modules/lib/firebase/serve-modules-api.js +52 -53
- package/packages/modules/lib/firebase.js +4 -6
- package/packages/modules/lib/index.js +12 -15
- package/packages/modules/package.json +2 -2
- package/packages/passport/package.json +2 -2
- package/packages/ssr/package.json +2 -2
- package/packages/storefront/.eslintrc.cjs +1 -0
- package/packages/storefront/astro.config.mjs +11 -1
- package/packages/storefront/dist/client/LoginOffcanvas.daf3f717.js +1 -0
- package/packages/storefront/dist/client/assets/_...522e6bf2.css +4 -0
- package/packages/storefront/dist/client/assets/{_...ee104f19.css → _...a48b75c7.css} +1 -1
- package/packages/storefront/dist/client/chunks/LoginForm.d9251274.js +1066 -0
- package/packages/storefront/dist/client/chunks/LoginOffcanvas.07fe6492.js +1 -0
- package/packages/storefront/dist/client/{hoisted.46e058d2.js → chunks/index.esm.84a649c7.js} +77 -17
- package/packages/storefront/dist/client/chunks/preload-helper.f15ab524.js +1 -0
- package/packages/storefront/dist/client/chunks/runtime-dom.esm-bundler.738639ee.js +1 -0
- package/packages/storefront/dist/client/client.b552d86a.js +1 -0
- package/packages/storefront/dist/client/hoisted.054c36ac.js +1 -0
- package/packages/storefront/dist/client/manifest.webmanifest +1 -1
- package/packages/storefront/dist/client/sw.js +1 -1
- package/packages/storefront/dist/server/entry.mjs +370 -180
- package/packages/storefront/dist/server/manifest.webmanifest +1 -1
- package/packages/storefront/package.json +6 -5
- package/packages/storefront/src/assets/pico.css +0 -1
- package/packages/storefront/src/env.d.ts +1 -1
- package/packages/storefront/src/lib/components/AOffcanvas.vue +98 -0
- package/packages/storefront/src/lib/components/LoginForm.vue +54 -0
- package/packages/storefront/src/lib/components/LoginOffcanvas.vue +41 -0
- package/packages/storefront/src/lib/components/TheHeader.vue +37 -3
- package/packages/storefront/src/lib/components/TopBar.vue +13 -21
- package/packages/storefront/src/lib/layouts/BaseBody.astro +41 -38
- package/packages/storefront/src/lib/layouts/BaseHead.astro +0 -5
- package/packages/storefront/src/lib/layouts/BaseStateJson.astro +12 -11
- package/packages/storefront/src/lib/layouts/PagesHeader.astro +29 -20
- package/packages/storefront/src/lib/scripts/firebase-app.ts +16 -0
- package/packages/storefront/src/lib/{helpers → ssr}/image.ts +1 -1
- package/packages/storefront/src/pages/app/account.astro +0 -0
- package/packages/storefront/storefront.config.mjs +1 -1
- package/packages/storefront/tsconfig.json +4 -1
- package/packages/types/package.json +1 -1
- package/packages/storefront/dist/client/assets/_...73e01db2.css +0 -4
- package/packages/storefront/dist/client/client.80baece3.js +0 -1
- package/packages/storefront/src/lib/components/LoginModal.vue +0 -82
|
@@ -3,167 +3,165 @@ import Ajv from 'ajv';
|
|
|
3
3
|
import addFormats from 'ajv-formats';
|
|
4
4
|
import api from '@cloudcommerce/api';
|
|
5
5
|
import config from '@cloudcommerce/firebase/lib/config';
|
|
6
|
-
import {
|
|
7
|
-
ajv, ajvOptions, parseAjvErrors, sendRequestError,
|
|
8
|
-
} from './ajv.js';
|
|
6
|
+
import { ajv, ajvOptions, parseAjvErrors, sendRequestError, } from './ajv.js';
|
|
9
7
|
import callAppModule from './call-app-module.js';
|
|
10
|
-
|
|
11
8
|
const ajvAppsResponse = addFormats(new Ajv({ ...ajvOptions, allErrors: true }));
|
|
12
9
|
// Cache apps list and no params modules results
|
|
13
10
|
const appsCache = {};
|
|
14
11
|
const resultsCache = {};
|
|
15
12
|
async function runModule(params, res, modName, validate, responseValidate, appId) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
let canCache = true;
|
|
26
|
-
const cacheKey = `${storeId}:${modName}`;
|
|
27
|
-
const listAppsParams = {
|
|
28
|
-
state: 'active',
|
|
29
|
-
[`modules.${modName}.enabled`]: true,
|
|
30
|
-
fields: `_id,app_id,version,data,hidden_data,modules.${modName}`,
|
|
31
|
-
};
|
|
32
|
-
if (appId
|
|
33
|
-
&& (typeof appId === 'number' || (typeof appId === 'string' && /^\d+$/.test(appId)))) {
|
|
34
|
-
if (typeof appId === 'string') {
|
|
35
|
-
appId = parseInt(appId, 10);
|
|
13
|
+
const respond = (result) => res.send({
|
|
14
|
+
result,
|
|
15
|
+
meta: params,
|
|
16
|
+
});
|
|
17
|
+
const { storeId } = config.get();
|
|
18
|
+
const isEmptyParams = (!params || !Object.keys(params).length);
|
|
19
|
+
if (!validate(params)) {
|
|
20
|
+
return sendRequestError(res, modName, validate.errors);
|
|
36
21
|
}
|
|
37
|
-
canCache =
|
|
38
|
-
|
|
39
|
-
listAppsParams
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
22
|
+
let canCache = true;
|
|
23
|
+
const cacheKey = `${storeId}:${modName}`;
|
|
24
|
+
const listAppsParams = {
|
|
25
|
+
state: 'active',
|
|
26
|
+
[`modules.${modName}.enabled`]: true,
|
|
27
|
+
fields: `_id,app_id,version,data,hidden_data,modules.${modName}`,
|
|
28
|
+
};
|
|
29
|
+
if (appId
|
|
30
|
+
&& (typeof appId === 'number' || (typeof appId === 'string' && /^\d+$/.test(appId)))) {
|
|
31
|
+
if (typeof appId === 'string') {
|
|
32
|
+
appId = parseInt(appId, 10);
|
|
33
|
+
}
|
|
34
|
+
canCache = false;
|
|
35
|
+
listAppsParams.app_id = appId;
|
|
36
|
+
listAppsParams.limit = 1;
|
|
45
37
|
}
|
|
46
|
-
canCacheResults =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
try {
|
|
53
|
-
const { data } = await api.get('applications', {
|
|
54
|
-
params: listAppsParams,
|
|
55
|
-
});
|
|
56
|
-
appsList = data.result;
|
|
57
|
-
} catch (err) {
|
|
58
|
-
logger.error(err);
|
|
59
|
-
const error = err;
|
|
60
|
-
return res.status(500).send({
|
|
61
|
-
status: 500,
|
|
62
|
-
error_code: 'MOD801',
|
|
63
|
-
message: `Store API returned status ${error.statusCode} trying to list apps`,
|
|
64
|
-
more_info: error.data?.user_message?.en_us,
|
|
65
|
-
});
|
|
38
|
+
let canCacheResults = false;
|
|
39
|
+
if (canCache && isEmptyParams) {
|
|
40
|
+
if (resultsCache[cacheKey]) {
|
|
41
|
+
return respond(resultsCache[cacheKey]);
|
|
42
|
+
}
|
|
43
|
+
canCacheResults = true;
|
|
66
44
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return respond([]);
|
|
45
|
+
let appsList;
|
|
46
|
+
if (canCache && appsCache[cacheKey]) {
|
|
47
|
+
appsList = appsCache[cacheKey];
|
|
71
48
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
49
|
+
else {
|
|
50
|
+
try {
|
|
51
|
+
const { data } = await api.get('applications', {
|
|
52
|
+
params: listAppsParams,
|
|
53
|
+
});
|
|
54
|
+
appsList = data.result;
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
logger.error(err);
|
|
58
|
+
const error = err;
|
|
59
|
+
return res.status(500).send({
|
|
60
|
+
status: 500,
|
|
61
|
+
error_code: 'MOD801',
|
|
62
|
+
message: `Store API returned status ${error.statusCode} trying to list apps`,
|
|
63
|
+
more_info: error.data?.user_message?.en_us,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
78
66
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
application,
|
|
96
|
-
};
|
|
97
|
-
const reqStartTime = Date.now();
|
|
98
|
-
moduleReqs.push(new Promise((resolve) => {
|
|
99
|
-
let response;
|
|
100
|
-
let isError = false;
|
|
101
|
-
let errorMessage = null;
|
|
102
|
-
callAppModule(appId, modName, appModuleUrl, appModuleBody, isBigTimeout)
|
|
103
|
-
.then((appResponse) => {
|
|
104
|
-
response = appResponse;
|
|
105
|
-
if (appResponse?.error) {
|
|
106
|
-
isError = true;
|
|
107
|
-
errorMessage = appResponse.message || String(appResponse.error);
|
|
67
|
+
if (Array.isArray(appsList)) {
|
|
68
|
+
if (!appsList.length) {
|
|
69
|
+
return respond([]);
|
|
70
|
+
}
|
|
71
|
+
if (canCache && !appsCache[cacheKey]) {
|
|
72
|
+
appsCache[cacheKey] = appsList;
|
|
73
|
+
setTimeout(() => {
|
|
74
|
+
appsCache[cacheKey] = null;
|
|
75
|
+
delete appsCache[cacheKey];
|
|
76
|
+
}, appsList.length ? 60000 : 3000);
|
|
77
|
+
}
|
|
78
|
+
const moduleReqs = [];
|
|
79
|
+
for (let i = 0; i < appsList.length; i++) {
|
|
80
|
+
const application = appsList[i];
|
|
81
|
+
if (!application.hidden_data) {
|
|
82
|
+
application.hidden_data = {};
|
|
108
83
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
version: application.version,
|
|
121
|
-
validated: false,
|
|
122
|
-
response_errors: null,
|
|
123
|
-
error: isError,
|
|
124
|
-
error_message: errorMessage,
|
|
125
|
-
response,
|
|
84
|
+
if (!application.data) {
|
|
85
|
+
application.data = {};
|
|
86
|
+
}
|
|
87
|
+
const appModuleUrl = application.modules[modName].endpoint;
|
|
88
|
+
// Handle request with big timeout if proxying one app (by ID) only
|
|
89
|
+
const isBigTimeout = !!(appId);
|
|
90
|
+
const appModuleBody = {
|
|
91
|
+
storeId,
|
|
92
|
+
module: modName,
|
|
93
|
+
params,
|
|
94
|
+
application,
|
|
126
95
|
};
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
96
|
+
const reqStartTime = Date.now();
|
|
97
|
+
moduleReqs.push(new Promise((resolve) => {
|
|
98
|
+
let response;
|
|
99
|
+
let isError = false;
|
|
100
|
+
let errorMessage = null;
|
|
101
|
+
callAppModule(appId, modName, appModuleUrl, appModuleBody, isBigTimeout)
|
|
102
|
+
.then((appResponse) => {
|
|
103
|
+
response = appResponse;
|
|
104
|
+
if (appResponse?.error) {
|
|
105
|
+
isError = true;
|
|
106
|
+
errorMessage = appResponse.message || String(appResponse.error);
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
.catch((err) => {
|
|
110
|
+
response = null;
|
|
111
|
+
isError = true;
|
|
112
|
+
errorMessage = err.message;
|
|
113
|
+
})
|
|
114
|
+
.finally(() => {
|
|
115
|
+
const result = {
|
|
116
|
+
_id: application._id,
|
|
117
|
+
app_id: application.app_id,
|
|
118
|
+
took: Date.now() - reqStartTime,
|
|
119
|
+
version: application.version,
|
|
120
|
+
validated: false,
|
|
121
|
+
response_errors: null,
|
|
122
|
+
error: isError,
|
|
123
|
+
error_message: errorMessage,
|
|
124
|
+
response,
|
|
125
|
+
};
|
|
126
|
+
if (!isError && typeof response === 'object' && response !== null) {
|
|
127
|
+
result.validated = responseValidate(response);
|
|
128
|
+
if (!result.validated) {
|
|
129
|
+
// @ts-ignore
|
|
130
|
+
result.response_errors = parseAjvErrors(responseValidate.errors, ajvAppsResponse);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
resolve(result);
|
|
134
|
+
});
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
return Promise.all(moduleReqs).then((results) => {
|
|
138
|
+
if (!results.find(({ response }) => response)) {
|
|
139
|
+
res.status(409);
|
|
140
|
+
canCacheResults = false;
|
|
141
|
+
}
|
|
142
|
+
if (canCacheResults && !resultsCache[cacheKey]) {
|
|
143
|
+
resultsCache[cacheKey] = results;
|
|
144
|
+
setTimeout(() => {
|
|
145
|
+
resultsCache[cacheKey] = null;
|
|
146
|
+
delete resultsCache[cacheKey];
|
|
147
|
+
}, 60000);
|
|
133
148
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}));
|
|
149
|
+
return respond(results);
|
|
150
|
+
});
|
|
137
151
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
res.status(409);
|
|
141
|
-
canCacheResults = false;
|
|
142
|
-
}
|
|
143
|
-
if (canCacheResults && !resultsCache[cacheKey]) {
|
|
144
|
-
resultsCache[cacheKey] = results;
|
|
145
|
-
setTimeout(() => {
|
|
146
|
-
resultsCache[cacheKey] = null;
|
|
147
|
-
delete resultsCache[cacheKey];
|
|
148
|
-
}, 60000);
|
|
149
|
-
}
|
|
150
|
-
return respond(results);
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
// Shoud never happen
|
|
154
|
-
return res.sendStatus(501);
|
|
152
|
+
// Shoud never happen
|
|
153
|
+
return res.sendStatus(501);
|
|
155
154
|
}
|
|
156
|
-
|
|
157
155
|
export default (modName, schema, responseSchema, req, res) => {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
156
|
+
const validate = ajv.compile(schema);
|
|
157
|
+
const responseValidate = ajvAppsResponse.compile(responseSchema);
|
|
158
|
+
return {
|
|
159
|
+
GET() {
|
|
160
|
+
runModule(req.query, res, modName, validate, responseValidate);
|
|
161
|
+
},
|
|
162
|
+
POST() {
|
|
163
|
+
runModule(req.body, res, modName, validate, responseValidate, req.query.app_id);
|
|
164
|
+
},
|
|
165
|
+
};
|
|
168
166
|
};
|
|
169
|
-
|
|
167
|
+
//# sourceMappingURL=handle-module.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
//# sourceMappingURL=proxy-apps.js.map
|
|
@@ -1,63 +1,62 @@
|
|
|
1
1
|
import { schemas } from '../index.js';
|
|
2
2
|
import handleModule from './handle-module.js';
|
|
3
3
|
import checkout from './checkout.js';
|
|
4
|
-
|
|
5
4
|
export default (req, res) => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
if (method === 'POST'
|
|
11
|
-
&& (!req.body || typeof req.body !== 'object' || Array.isArray(req.body))) {
|
|
12
|
-
return res.sendStatus(400);
|
|
13
|
-
}
|
|
14
|
-
let { url } = req;
|
|
15
|
-
if (url.endsWith('.json')) {
|
|
16
|
-
url = url.slice(0, -5);
|
|
17
|
-
}
|
|
18
|
-
[url] = url.split('?');
|
|
19
|
-
const modName = url.split('/')[1];
|
|
20
|
-
const sendSchema = (isResponseSchema = false) => {
|
|
21
|
-
return res.status(200)
|
|
22
|
-
.setHeader('Cache-Control', 'public, max-age=3600')
|
|
23
|
-
.send(schemas[modName][isResponseSchema ? 'response' : 'params']);
|
|
24
|
-
};
|
|
25
|
-
if (modName === '@checkout') {
|
|
26
|
-
if (url === '/@checkout') {
|
|
27
|
-
if (method === 'GET') {
|
|
28
|
-
return res.status(405)
|
|
29
|
-
.send({
|
|
30
|
-
error_code: 'CKT101',
|
|
31
|
-
message: 'GET is acceptable only to JSON schema, at /@checkout/schema',
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
return checkout(schemas[modName].params, req, res, req.hostname);
|
|
35
|
-
}
|
|
36
|
-
if (url === '/@checkout/schema') {
|
|
37
|
-
return sendSchema();
|
|
38
|
-
}
|
|
39
|
-
return res.sendStatus(404);
|
|
40
|
-
}
|
|
41
|
-
if (schemas[modName]) {
|
|
42
|
-
const { params: schema, response: responseSchema } = schemas[modName];
|
|
43
|
-
if (!schema.$schema) {
|
|
44
|
-
schema.$schema = 'http://json-schema.org/draft-07/schema#';
|
|
45
|
-
schema.title = `Module \`${modName}\`: Params model`;
|
|
5
|
+
const { method } = req;
|
|
6
|
+
if (method !== 'POST' && method !== 'GET') {
|
|
7
|
+
return res.sendStatus(405);
|
|
46
8
|
}
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
9
|
+
if (method === 'POST'
|
|
10
|
+
&& (!req.body || typeof req.body !== 'object' || Array.isArray(req.body))) {
|
|
11
|
+
return res.sendStatus(400);
|
|
50
12
|
}
|
|
51
|
-
|
|
52
|
-
|
|
13
|
+
let { url } = req;
|
|
14
|
+
if (url.endsWith('.json')) {
|
|
15
|
+
url = url.slice(0, -5);
|
|
53
16
|
}
|
|
54
|
-
|
|
55
|
-
|
|
17
|
+
[url] = url.split('?');
|
|
18
|
+
const modName = url.split('/')[1];
|
|
19
|
+
const sendSchema = (isResponseSchema = false) => {
|
|
20
|
+
return res.status(200)
|
|
21
|
+
.setHeader('Cache-Control', 'public, max-age=3600')
|
|
22
|
+
.send(schemas[modName][isResponseSchema ? 'response' : 'params']);
|
|
23
|
+
};
|
|
24
|
+
if (modName === '@checkout') {
|
|
25
|
+
if (url === '/@checkout') {
|
|
26
|
+
if (method === 'GET') {
|
|
27
|
+
return res.status(405)
|
|
28
|
+
.send({
|
|
29
|
+
error_code: 'CKT101',
|
|
30
|
+
message: 'GET is acceptable only to JSON schema, at /@checkout/schema',
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
return checkout(schemas[modName].params, req, res, req.hostname);
|
|
34
|
+
}
|
|
35
|
+
if (url === '/@checkout/schema') {
|
|
36
|
+
return sendSchema();
|
|
37
|
+
}
|
|
38
|
+
return res.sendStatus(404);
|
|
56
39
|
}
|
|
57
|
-
if (
|
|
58
|
-
|
|
40
|
+
if (schemas[modName]) {
|
|
41
|
+
const { params: schema, response: responseSchema } = schemas[modName];
|
|
42
|
+
if (!schema.$schema) {
|
|
43
|
+
schema.$schema = 'http://json-schema.org/draft-07/schema#';
|
|
44
|
+
schema.title = `Module \`${modName}\`: Params model`;
|
|
45
|
+
}
|
|
46
|
+
if (!responseSchema.$schema) {
|
|
47
|
+
responseSchema.$schema = 'http://json-schema.org/draft-07/schema#';
|
|
48
|
+
responseSchema.title = `Module \`${modName}\`: App response model`;
|
|
49
|
+
}
|
|
50
|
+
if (url === `/${modName}/schema`) {
|
|
51
|
+
return sendSchema();
|
|
52
|
+
}
|
|
53
|
+
if (url === `/${modName}/response_schema`) {
|
|
54
|
+
return sendSchema(true);
|
|
55
|
+
}
|
|
56
|
+
if (url === `/${modName}`) {
|
|
57
|
+
return handleModule(modName, schema, responseSchema, req, res)[method]();
|
|
58
|
+
}
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
return res.sendStatus(404);
|
|
60
|
+
return res.sendStatus(404);
|
|
62
61
|
};
|
|
63
|
-
|
|
62
|
+
//# sourceMappingURL=serve-modules-api.js.map
|
|
@@ -4,13 +4,11 @@ import '@cloudcommerce/firebase/lib/init';
|
|
|
4
4
|
import { onRequest } from 'firebase-functions/v2/https';
|
|
5
5
|
import config from '@cloudcommerce/firebase/lib/config';
|
|
6
6
|
import serveModulesApi from './firebase/serve-modules-api.js';
|
|
7
|
-
|
|
8
7
|
const { httpsFunctionOptions } = config.get();
|
|
9
|
-
|
|
10
8
|
export const modules = onRequest({
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
concurrency: 6,
|
|
10
|
+
...httpsFunctionOptions,
|
|
13
11
|
}, (req, res) => {
|
|
14
|
-
|
|
12
|
+
serveModulesApi(req, res);
|
|
15
13
|
});
|
|
16
|
-
|
|
14
|
+
//# sourceMappingURL=firebase.js.map
|
|
@@ -3,23 +3,20 @@ import * as applyDiscount from '../schemas/apply_discount.cjs';
|
|
|
3
3
|
import * as listPayments from '../schemas/list_payments.cjs';
|
|
4
4
|
import * as createTransaction from '../schemas/create_transaction.cjs';
|
|
5
5
|
import * as checkout from '../schemas/@checkout.cjs';
|
|
6
|
-
|
|
7
6
|
const schemas = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
calculate_shipping: calculateShipping,
|
|
8
|
+
apply_discount: applyDiscount,
|
|
9
|
+
list_payments: listPayments,
|
|
10
|
+
create_transaction: createTransaction,
|
|
11
|
+
'@checkout': checkout,
|
|
13
12
|
};
|
|
14
|
-
|
|
15
13
|
export default {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
calculateShipping,
|
|
15
|
+
applyDiscount,
|
|
16
|
+
listPayments,
|
|
17
|
+
createTransaction,
|
|
18
|
+
checkout,
|
|
19
|
+
schemas,
|
|
22
20
|
};
|
|
23
|
-
|
|
24
21
|
export { schemas };
|
|
25
|
-
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/modules",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.98",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce modules API",
|
|
6
6
|
"main": "lib/index.cjs",
|
|
7
7
|
"exports": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"ajv-formats": "^2.1.1",
|
|
35
35
|
"axios": "^0.27.2",
|
|
36
36
|
"firebase-admin": "^11.0.1",
|
|
37
|
-
"firebase-functions": "^3.
|
|
37
|
+
"firebase-functions": "^3.24.0",
|
|
38
38
|
"source-map-support": "^0.5.21"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/passport",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.98",
|
|
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": "^11.0.1",
|
|
29
|
-
"firebase-functions": "^3.
|
|
29
|
+
"firebase-functions": "^3.24.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": "0.0.
|
|
4
|
+
"version": "0.0.98",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront SSR",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"color": "^4.2.3",
|
|
31
31
|
"compression": "^1.7.4",
|
|
32
32
|
"firebase-admin": "^11.0.1",
|
|
33
|
-
"firebase-functions": "^3.
|
|
33
|
+
"firebase-functions": "^3.24.0",
|
|
34
34
|
"html-escaper": "^3.0.3",
|
|
35
35
|
"image-size": "^1.0.2",
|
|
36
36
|
"kleur": "^4.1.5",
|
|
@@ -13,7 +13,12 @@ import getConfig from './storefront.config.mjs';
|
|
|
13
13
|
|
|
14
14
|
dotenv.config();
|
|
15
15
|
|
|
16
|
-
const {
|
|
16
|
+
const {
|
|
17
|
+
lang,
|
|
18
|
+
domain,
|
|
19
|
+
primaryColor,
|
|
20
|
+
settings,
|
|
21
|
+
} = getConfig();
|
|
17
22
|
|
|
18
23
|
const _vitePWAOptions = {
|
|
19
24
|
manifest: {
|
|
@@ -136,6 +141,11 @@ const genAstroConfig = ({
|
|
|
136
141
|
plugins: [
|
|
137
142
|
VitePWA(vitePWAOptions),
|
|
138
143
|
],
|
|
144
|
+
resolve: {
|
|
145
|
+
alias: {
|
|
146
|
+
'@i18n': `@ecomplus/i18n/src/${lang}/index.js`,
|
|
147
|
+
},
|
|
148
|
+
},
|
|
139
149
|
},
|
|
140
150
|
});
|
|
141
151
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as i}from"./chunks/LoginOffcanvas.07fe6492.js";import"./chunks/preload-helper.f15ab524.js";import"./chunks/runtime-dom.esm-bundler.738639ee.js";/* empty css */export{i as default};
|