cloudcommerce 0.0.65 → 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/CHANGELOG.md +12 -0
- package/package.json +1 -1
- package/packages/api/package.json +1 -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/tiny-erp/package.json +1 -1
- 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/package.json +1 -1
- package/packages/firebase/lib/config.d.ts +21 -24
- package/packages/firebase/lib/config.js +20 -44
- 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/package.json +2 -2
- package/packages/firebase/src/config.ts +23 -48
- package/packages/firebase/src/env.ts +2 -38
- package/packages/modules/package.json +1 -1
- package/packages/passport/package.json +1 -1
- package/packages/ssr/package.json +1 -1
- package/packages/storefront/.eslintrc.cjs +6 -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/package.json +1 -1
- package/packages/storefront/src/storefront-config.ts +28 -0
- package/packages/types/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [0.0.66](https://github.com/ecomplus/cloud-commerce/compare/v0.0.65...v0.0.66) (2022-09-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **config:** New reusable/isolated `@cloudcoommerce/config` package ([64b482f](https://github.com/ecomplus/cloud-commerce/commit/64b482fff9f8087a38890b52ff0c6bb7c40f85f9))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **config:** Fix type defs for `@cloudcommerce/firebase` config ([f567851](https://github.com/ecomplus/cloud-commerce/commit/f567851e24d48162062e50cab77676c70b13e546))
|
|
16
|
+
|
|
5
17
|
### [0.0.65](https://github.com/ecomplus/cloud-commerce/compare/v0.0.64...v0.0.65) (2022-09-03)
|
|
6
18
|
|
|
7
19
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcommerce",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.66",
|
|
5
5
|
"description": "Open fair-code headless commerce platform: API-first, microservices based, event driven and cloud native",
|
|
6
6
|
"main": "packages/api/lib/index.js",
|
|
7
7
|
"author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Please refer to GitHub [repository releases](https://github.com/ecomplus/cloud-commerce/releases) or monorepo unified [CHANGELOG.md](https://github.com/ecomplus/cloud-commerce/blob/main/CHANGELOG.md).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# `@cloudcommerce/config`
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare type BaseConfig = {
|
|
2
|
+
lang: string;
|
|
3
|
+
currency: string;
|
|
4
|
+
currencySymbol: string;
|
|
5
|
+
countryCode: string;
|
|
6
|
+
storeId: number;
|
|
7
|
+
};
|
|
8
|
+
declare const _default: {
|
|
9
|
+
get(): BaseConfig;
|
|
10
|
+
set(config: any): void;
|
|
11
|
+
};
|
|
12
|
+
export default _default;
|
|
13
|
+
export type { BaseConfig };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Deepmerge from '@fastify/deepmerge';
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_LANG, DEFAULT_CURRENCY, DEFAULT_CURRENCY_SYMBOL, DEFAULT_COUNTRY_CODE,
|
|
4
|
+
} from './defaults.js';
|
|
5
|
+
|
|
6
|
+
const _env = (typeof process === 'object' && process?.env) || globalThis;
|
|
7
|
+
const deepmerge = Deepmerge();
|
|
8
|
+
const self = globalThis.__cloudCommerce || {
|
|
9
|
+
config: {
|
|
10
|
+
lang: _env.ECOM_LANG || DEFAULT_LANG,
|
|
11
|
+
currency: _env.ECOM_CURRENCY || DEFAULT_CURRENCY,
|
|
12
|
+
currencySymbol: _env.ECOM_CURRENCY_SYMBOL || DEFAULT_CURRENCY_SYMBOL,
|
|
13
|
+
countryCode: _env.ECOM_COUNTRY_CODE || DEFAULT_COUNTRY_CODE,
|
|
14
|
+
storeId: Number(_env.ECOM_STORE_ID),
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
globalThis.__cloudCommerce = self;
|
|
18
|
+
|
|
19
|
+
export default {
|
|
20
|
+
get() {
|
|
21
|
+
return self.config;
|
|
22
|
+
},
|
|
23
|
+
set(config) {
|
|
24
|
+
self.config = deepmerge(self.config, config);
|
|
25
|
+
if (config.storeId) {
|
|
26
|
+
_env.ECOM_STORE_ID = config.storeId;
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
// # sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AAEpB,MAAM,IAAI,GAAwB,CAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,EAAE,GAAG,CAAC,IAAI,UAAU,CAAC;AAC9F,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC;AAU9B,MAAM,IAAI,GAA2B,UAAU,CAAC,eAAe,IAAI;IACjE,MAAM,EAAE;QACN,IAAI,EAAE,IAAI,CAAC,SAAS,IAAI,YAAY;QACpC,QAAQ,EAAE,IAAI,CAAC,aAAa,IAAI,gBAAgB;QAChD,cAAc,EAAE,IAAI,CAAC,oBAAoB,IAAI,uBAAuB;QACpE,WAAW,EAAE,IAAI,CAAC,iBAAiB,IAAI,oBAAoB;QAC3D,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC;KACpC;CACF,CAAC;AACF,UAAU,CAAC,eAAe,GAAG,IAAI,CAAC;AAElC,eAAe;IACb,GAAG;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IACD,GAAG,CAAC,MAAM;QACR,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAC7C,IAAI,MAAM,CAAC,OAAO,EAAE;YAClB,IAAI,CAAC,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC;SACrC;IACH,CAAC;CACF,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const _env = (typeof process === 'object' && process?.env) || globalThis;
|
|
2
|
+
|
|
3
|
+
export default () => {
|
|
4
|
+
const {
|
|
5
|
+
ECOM_STORE_ID, ECOM_AUTHENTICATION_ID, ECOM_API_KEY, GITHUB_TOKEN,
|
|
6
|
+
} = _env;
|
|
7
|
+
const storeId = ECOM_STORE_ID && parseInt(ECOM_STORE_ID, 10);
|
|
8
|
+
if (!storeId) {
|
|
9
|
+
throw new Error('ECOM_STORE_ID is not set or not a number');
|
|
10
|
+
}
|
|
11
|
+
if (!ECOM_AUTHENTICATION_ID) {
|
|
12
|
+
throw new Error('ECOM_AUTHENTICATION_ID is not set');
|
|
13
|
+
}
|
|
14
|
+
if (!ECOM_API_KEY) {
|
|
15
|
+
throw new Error('ECOM_API_KEY is not set');
|
|
16
|
+
}
|
|
17
|
+
const authenticationId = ECOM_AUTHENTICATION_ID;
|
|
18
|
+
const apiKey = ECOM_API_KEY;
|
|
19
|
+
const githubToken = GITHUB_TOKEN;
|
|
20
|
+
const env = {
|
|
21
|
+
storeId,
|
|
22
|
+
apiAuth: {
|
|
23
|
+
authenticationId,
|
|
24
|
+
apiKey,
|
|
25
|
+
},
|
|
26
|
+
githubToken,
|
|
27
|
+
};
|
|
28
|
+
return env;
|
|
29
|
+
};
|
|
30
|
+
// # sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AASA,MAAM,IAAI,GAAwB,CAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,EAAE,GAAG,CAAC,IAAI,UAAU,CAAC;AAE9F,eAAe,GAAG,EAAE;IAClB,MAAM,EACJ,aAAa,EACb,sBAAsB,EACtB,YAAY,EACZ,YAAY,GACb,GAAG,IAAI,CAAC;IACT,MAAM,OAAO,GAAG,aAAa,IAAI,QAAQ,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;IAC7D,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;KAC7D;IACD,IAAI,CAAC,sBAAsB,EAAE;QAC3B,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;KACtD;IACD,IAAI,CAAC,YAAY,EAAE;QACjB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;KAC5C;IACD,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;IAChD,MAAM,MAAM,GAAG,YAAY,CAAC;IAC5B,MAAM,WAAW,GAAG,YAAY,CAAC;IACjC,MAAM,GAAG,GAAQ;QACf,OAAO;QACP,OAAO,EAAE;YACP,gBAAgB;YAChB,MAAM;SACP;QACD,WAAW;KACZ,CAAC;IACF,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cloudcommerce/config",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.66",
|
|
5
|
+
"description": "E-Com Plus Cloud Commerce base config",
|
|
6
|
+
"main": "lib/config.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./lib/config.js",
|
|
9
|
+
"./lib/config": "./lib/config.js",
|
|
10
|
+
"./lib/env": "./lib/env.js"
|
|
11
|
+
},
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/ecomplus/cloud-commerce.git",
|
|
15
|
+
"directory": "packages/config"
|
|
16
|
+
},
|
|
17
|
+
"author": "E-Com Club Softwares para E-commerce <ti@e-com.club>",
|
|
18
|
+
"license": "Apache 2.0 with Commons Clause",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/ecomplus/cloud-commerce/issues"
|
|
21
|
+
},
|
|
22
|
+
"homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/config#readme",
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "sh ../../scripts/build-lib.sh"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@cloudcommerce/api": "workspace:*",
|
|
28
|
+
"@fastify/deepmerge": "^1.1.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"@cloudcommerce/types": "workspace:*"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import Deepmerge from '@fastify/deepmerge';
|
|
2
|
+
import {
|
|
3
|
+
DEFAULT_LANG,
|
|
4
|
+
DEFAULT_CURRENCY,
|
|
5
|
+
DEFAULT_CURRENCY_SYMBOL,
|
|
6
|
+
DEFAULT_COUNTRY_CODE,
|
|
7
|
+
} from './defaults';
|
|
8
|
+
|
|
9
|
+
const _env: Record<string, any> = (typeof process === 'object' && process?.env) || globalThis;
|
|
10
|
+
const deepmerge = Deepmerge();
|
|
11
|
+
|
|
12
|
+
type BaseConfig = {
|
|
13
|
+
lang: string,
|
|
14
|
+
currency: string,
|
|
15
|
+
currencySymbol: string,
|
|
16
|
+
countryCode: string,
|
|
17
|
+
storeId: number,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const self: { config: BaseConfig } = globalThis.__cloudCommerce || {
|
|
21
|
+
config: {
|
|
22
|
+
lang: _env.ECOM_LANG || DEFAULT_LANG,
|
|
23
|
+
currency: _env.ECOM_CURRENCY || DEFAULT_CURRENCY,
|
|
24
|
+
currencySymbol: _env.ECOM_CURRENCY_SYMBOL || DEFAULT_CURRENCY_SYMBOL,
|
|
25
|
+
countryCode: _env.ECOM_COUNTRY_CODE || DEFAULT_COUNTRY_CODE,
|
|
26
|
+
storeId: Number(_env.ECOM_STORE_ID),
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
globalThis.__cloudCommerce = self;
|
|
30
|
+
|
|
31
|
+
export default {
|
|
32
|
+
get() {
|
|
33
|
+
return self.config;
|
|
34
|
+
},
|
|
35
|
+
set(config) {
|
|
36
|
+
self.config = deepmerge(self.config, config);
|
|
37
|
+
if (config.storeId) {
|
|
38
|
+
_env.ECOM_STORE_ID = config.storeId;
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type { BaseConfig };
|
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
type Env = {
|
|
2
|
+
storeId: number;
|
|
3
|
+
apiAuth: {
|
|
4
|
+
authenticationId: string;
|
|
5
|
+
apiKey: string;
|
|
6
|
+
},
|
|
7
|
+
githubToken?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const _env: Record<string, any> = (typeof process === 'object' && process?.env) || globalThis;
|
|
11
|
+
|
|
12
|
+
export default () => {
|
|
13
|
+
const {
|
|
14
|
+
ECOM_STORE_ID,
|
|
15
|
+
ECOM_AUTHENTICATION_ID,
|
|
16
|
+
ECOM_API_KEY,
|
|
17
|
+
GITHUB_TOKEN,
|
|
18
|
+
} = _env;
|
|
19
|
+
const storeId = ECOM_STORE_ID && parseInt(ECOM_STORE_ID, 10);
|
|
20
|
+
if (!storeId) {
|
|
21
|
+
throw new Error('ECOM_STORE_ID is not set or not a number');
|
|
22
|
+
}
|
|
23
|
+
if (!ECOM_AUTHENTICATION_ID) {
|
|
24
|
+
throw new Error('ECOM_AUTHENTICATION_ID is not set');
|
|
25
|
+
}
|
|
26
|
+
if (!ECOM_API_KEY) {
|
|
27
|
+
throw new Error('ECOM_API_KEY is not set');
|
|
28
|
+
}
|
|
29
|
+
const authenticationId = ECOM_AUTHENTICATION_ID;
|
|
30
|
+
const apiKey = ECOM_API_KEY;
|
|
31
|
+
const githubToken = GITHUB_TOKEN;
|
|
32
|
+
const env: Env = {
|
|
33
|
+
storeId,
|
|
34
|
+
apiAuth: {
|
|
35
|
+
authenticationId,
|
|
36
|
+
apiKey,
|
|
37
|
+
},
|
|
38
|
+
githubToken,
|
|
39
|
+
};
|
|
40
|
+
return env;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type { Env };
|
|
@@ -1,31 +1,28 @@
|
|
|
1
1
|
import type { ApiEventName } from '@cloudcommerce/types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
import { BaseConfig } from '@cloudcommerce/config';
|
|
3
|
+
declare const mergeConfig: {
|
|
4
|
+
hello: string;
|
|
5
|
+
httpsFunctionOptions: {
|
|
6
|
+
region: string;
|
|
7
|
+
};
|
|
8
|
+
apps: {
|
|
9
|
+
discounts: {
|
|
10
|
+
appId: number;
|
|
11
|
+
};
|
|
12
|
+
correios: {
|
|
13
|
+
appId: number;
|
|
12
14
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
customShipping: {
|
|
21
|
-
appId: number;
|
|
22
|
-
};
|
|
23
|
-
tinyErp: {
|
|
24
|
-
appId: number;
|
|
25
|
-
events: ApiEventName[];
|
|
26
|
-
};
|
|
15
|
+
customShipping: {
|
|
16
|
+
appId: number;
|
|
17
|
+
};
|
|
18
|
+
tinyErp: {
|
|
19
|
+
appId: number;
|
|
20
|
+
events: ApiEventName[];
|
|
27
21
|
};
|
|
28
22
|
};
|
|
23
|
+
};
|
|
24
|
+
declare const _default: {
|
|
25
|
+
get(): BaseConfig & typeof mergeConfig;
|
|
29
26
|
set(config: any): void;
|
|
30
27
|
};
|
|
31
28
|
export default _default;
|
|
@@ -1,57 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
DEFAULT_LANG, DEFAULT_CURRENCY, DEFAULT_CURRENCY_SYMBOL, DEFAULT_COUNTRY_CODE,
|
|
4
|
-
} from './defaults.js';
|
|
1
|
+
import config from '@cloudcommerce/config';
|
|
5
2
|
|
|
6
|
-
// @ts-ignore
|
|
7
|
-
const env = (typeof process === 'object' && process?.env)
|
|
8
|
-
|| (typeof window === 'object' && window)
|
|
9
|
-
|| {};
|
|
10
|
-
const deepmerge = Deepmerge();
|
|
11
3
|
const tinyErpEvents = [
|
|
12
4
|
'orders-anyStatusSet',
|
|
13
5
|
'products-new',
|
|
14
6
|
'products-priceSet',
|
|
15
7
|
'applications-dataSet',
|
|
16
8
|
];
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
9
|
+
const mergeConfig = {
|
|
10
|
+
hello: 'from @cloudcommerce/firebase',
|
|
11
|
+
httpsFunctionOptions: {
|
|
12
|
+
region: process.env.DEPLOY_REGION || 'southamerica-east1',
|
|
13
|
+
},
|
|
14
|
+
apps: {
|
|
15
|
+
discounts: {
|
|
16
|
+
appId: 1252,
|
|
17
|
+
},
|
|
18
|
+
correios: {
|
|
19
|
+
appId: 1248,
|
|
20
|
+
},
|
|
21
|
+
customShipping: {
|
|
22
|
+
appId: 1253,
|
|
27
23
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
correios: {
|
|
33
|
-
appId: 1248,
|
|
34
|
-
},
|
|
35
|
-
customShipping: {
|
|
36
|
-
appId: 1253,
|
|
37
|
-
},
|
|
38
|
-
tinyErp: {
|
|
39
|
-
appId: 105922,
|
|
40
|
-
events: tinyErpEvents,
|
|
41
|
-
},
|
|
24
|
+
tinyErp: {
|
|
25
|
+
appId: 105922,
|
|
26
|
+
events: tinyErpEvents,
|
|
42
27
|
},
|
|
43
28
|
},
|
|
44
29
|
};
|
|
30
|
+
config.set(mergeConfig);
|
|
45
31
|
|
|
46
|
-
export default
|
|
47
|
-
get() {
|
|
48
|
-
return self.__config;
|
|
49
|
-
},
|
|
50
|
-
set(config) {
|
|
51
|
-
self.__config = deepmerge(self.__config, config);
|
|
52
|
-
if (config.storeId) {
|
|
53
|
-
env.ECOM_STORE_ID = config.storeId;
|
|
54
|
-
}
|
|
55
|
-
},
|
|
56
|
-
};
|
|
32
|
+
export default config;
|
|
57
33
|
// # sourceMappingURL=config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,MAAsB,MAAM,uBAAuB,CAAC;AAE3D,MAAM,aAAa,GAAmB;IACpC,qBAAqB;IACrB,cAAc;IACd,mBAAmB;IACnB,sBAAsB;CACvB,CAAC;AAEF,MAAM,WAAW,GAAG;IAClB,KAAK,EAAE,8BAA8B;IACrC,oBAAoB,EAAE;QACpB,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,oBAAoB;KAC1D;IACD,IAAI,EAAE;QACJ,SAAS,EAAE;YACT,KAAK,EAAE,IAAI;SACZ;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,IAAI;SACZ;QACD,cAAc,EAAE;YACd,KAAK,EAAE,IAAI;SACZ;QACD,OAAO,EAAE;YACP,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,aAAa;SACtB;KACF;CACF,CAAC;AACF,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;AAExB,eAAe,MAId,CAAC"}
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
apiAuth: {
|
|
4
|
-
authenticationId: string;
|
|
5
|
-
apiKey: string;
|
|
6
|
-
};
|
|
7
|
-
githubToken?: string;
|
|
8
|
-
};
|
|
9
|
-
declare const _default: () => Env;
|
|
10
|
-
export default _default;
|
|
1
|
+
import getEnv, { Env } from '@cloudcommerce/config/lib/env';
|
|
2
|
+
export default getEnv;
|
|
11
3
|
export type { Env };
|
|
@@ -1,28 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} = process.env;
|
|
5
|
-
const storeId = ECOM_STORE_ID && parseInt(ECOM_STORE_ID, 10);
|
|
6
|
-
if (!storeId) {
|
|
7
|
-
throw new Error('ECOM_STORE_ID is not set or not a number');
|
|
8
|
-
}
|
|
9
|
-
if (!ECOM_AUTHENTICATION_ID) {
|
|
10
|
-
throw new Error('ECOM_AUTHENTICATION_ID is not set');
|
|
11
|
-
}
|
|
12
|
-
if (!ECOM_API_KEY) {
|
|
13
|
-
throw new Error('ECOM_API_KEY is not set');
|
|
14
|
-
}
|
|
15
|
-
const authenticationId = ECOM_AUTHENTICATION_ID;
|
|
16
|
-
const apiKey = ECOM_API_KEY;
|
|
17
|
-
const githubToken = GITHUB_TOKEN;
|
|
18
|
-
const env = {
|
|
19
|
-
storeId,
|
|
20
|
-
apiAuth: {
|
|
21
|
-
authenticationId,
|
|
22
|
-
apiKey,
|
|
23
|
-
},
|
|
24
|
-
githubToken,
|
|
25
|
-
};
|
|
26
|
-
return env;
|
|
27
|
-
};
|
|
1
|
+
import getEnv from '@cloudcommerce/config/lib/env';
|
|
2
|
+
|
|
3
|
+
export default getEnv;
|
|
28
4
|
// # sourceMappingURL=env.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,OAAO,MAAe,MAAM,+BAA+B,CAAC;AAE5D,eAAe,MAAM,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/firebase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.66",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce on Firebase",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@cloudcommerce/api": "workspace:*",
|
|
33
|
-
"@
|
|
33
|
+
"@cloudcommerce/config": "workspace:*",
|
|
34
34
|
"@google-cloud/pubsub": "^3.1.0",
|
|
35
35
|
"firebase-admin": "^11.0.1",
|
|
36
36
|
"firebase-functions": "^3.22.0",
|
|
@@ -1,18 +1,5 @@
|
|
|
1
1
|
import type { ApiEventName } from '@cloudcommerce/types';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
DEFAULT_LANG,
|
|
5
|
-
DEFAULT_CURRENCY,
|
|
6
|
-
DEFAULT_CURRENCY_SYMBOL,
|
|
7
|
-
DEFAULT_COUNTRY_CODE,
|
|
8
|
-
} from './defaults';
|
|
9
|
-
|
|
10
|
-
// @ts-ignore
|
|
11
|
-
const env: { [key: string]: string } = (typeof process === 'object' && process?.env)
|
|
12
|
-
|| (typeof window === 'object' && window)
|
|
13
|
-
|| {};
|
|
14
|
-
|
|
15
|
-
const deepmerge = Deepmerge();
|
|
2
|
+
import config, { BaseConfig } from '@cloudcommerce/config';
|
|
16
3
|
|
|
17
4
|
const tinyErpEvents: ApiEventName[] = [
|
|
18
5
|
'orders-anyStatusSet',
|
|
@@ -21,43 +8,31 @@ const tinyErpEvents: ApiEventName[] = [
|
|
|
21
8
|
'applications-dataSet',
|
|
22
9
|
];
|
|
23
10
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
11
|
+
const mergeConfig = {
|
|
12
|
+
hello: 'from @cloudcommerce/firebase',
|
|
13
|
+
httpsFunctionOptions: {
|
|
14
|
+
region: process.env.DEPLOY_REGION || 'southamerica-east1',
|
|
15
|
+
},
|
|
16
|
+
apps: {
|
|
17
|
+
discounts: {
|
|
18
|
+
appId: 1252,
|
|
19
|
+
},
|
|
20
|
+
correios: {
|
|
21
|
+
appId: 1248,
|
|
34
22
|
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
customShipping: {
|
|
43
|
-
appId: 1253,
|
|
44
|
-
},
|
|
45
|
-
tinyErp: {
|
|
46
|
-
appId: 105922,
|
|
47
|
-
events: tinyErpEvents,
|
|
48
|
-
},
|
|
23
|
+
customShipping: {
|
|
24
|
+
appId: 1253,
|
|
25
|
+
},
|
|
26
|
+
tinyErp: {
|
|
27
|
+
appId: 105922,
|
|
28
|
+
events: tinyErpEvents,
|
|
49
29
|
},
|
|
50
30
|
},
|
|
51
31
|
};
|
|
32
|
+
config.set(mergeConfig);
|
|
52
33
|
|
|
53
|
-
export default {
|
|
54
|
-
get()
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
set(config) {
|
|
58
|
-
self.__config = deepmerge(self.__config, config);
|
|
59
|
-
if (config.storeId) {
|
|
60
|
-
env.ECOM_STORE_ID = config.storeId;
|
|
61
|
-
}
|
|
62
|
-
},
|
|
34
|
+
export default config as {
|
|
35
|
+
get(): BaseConfig & typeof mergeConfig;
|
|
36
|
+
// eslint-disable-next-line
|
|
37
|
+
set(config: any): void;
|
|
63
38
|
};
|