cloudcommerce 0.0.23 → 0.0.26
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 -0
- package/CHANGELOG.md +22 -0
- package/CONTRIBUTING.md +4 -2
- package/package.json +11 -7
- package/packages/api/lib/types/applications.d.ts +100 -91
- package/packages/api/lib/types/authentications.d.ts +10 -0
- package/packages/api/lib/types/brands.d.ts +9 -0
- package/packages/api/lib/types/carts.d.ts +16 -0
- package/packages/api/lib/types/categories.d.ts +9 -0
- package/packages/api/lib/types/collections.d.ts +8 -0
- package/packages/api/lib/types/customers.d.ts +28 -0
- package/packages/api/lib/types/grids.d.ts +8 -0
- package/packages/api/lib/types/orders.d.ts +287 -222
- package/packages/api/lib/types/products.d.ts +69 -0
- package/packages/api/lib/types/stores.d.ts +3 -0
- package/packages/api/package.json +1 -1
- package/packages/api/src/types/applications.d.ts +100 -91
- package/packages/api/src/types/authentications.d.ts +10 -0
- package/packages/api/src/types/brands.d.ts +9 -0
- package/packages/api/src/types/carts.d.ts +16 -0
- package/packages/api/src/types/categories.d.ts +9 -0
- package/packages/api/src/types/collections.d.ts +8 -0
- package/packages/api/src/types/customers.d.ts +28 -0
- package/packages/api/src/types/grids.d.ts +8 -0
- package/packages/api/src/types/orders.d.ts +287 -222
- package/packages/api/src/types/products.d.ts +69 -0
- package/packages/api/src/types/stores.d.ts +3 -0
- package/packages/apps/discounts/package.json +1 -1
- package/packages/cli/lib/index.js +27 -1
- package/packages/cli/package.json +1 -1
- package/packages/cli/src/index.ts +35 -1
- package/packages/firebase/config.js +5 -0
- package/packages/firebase/lib/config.js +26 -0
- package/packages/firebase/lib/config.js.map +1 -0
- package/packages/firebase/lib/defaults.js +8 -0
- package/packages/firebase/lib/defaults.js.map +1 -0
- package/packages/firebase/lib/index.js +27 -0
- package/packages/firebase/lib/index.js.map +1 -0
- package/packages/firebase/package.json +10 -4
- package/packages/firebase/src/config.ts +29 -0
- package/packages/firebase/src/defaults.ts +7 -0
- package/packages/firebase/src/index.ts +26 -0
- package/packages/firebase/tsconfig.json +3 -0
- package/packages/storefront/package.json +2 -2
- package/pnpm-lock.yaml +294 -63
- package/packages/firebase/src/index.js +0 -0
|
@@ -10,6 +10,9 @@ export interface Products {
|
|
|
10
10
|
created_at: string;
|
|
11
11
|
updated_at: string;
|
|
12
12
|
store_id: number;
|
|
13
|
+
/**
|
|
14
|
+
* @maxItems 10
|
|
15
|
+
*/
|
|
13
16
|
channel_ids?: string[];
|
|
14
17
|
/**
|
|
15
18
|
* Product unique reference code
|
|
@@ -102,6 +105,8 @@ export interface Products {
|
|
|
102
105
|
};
|
|
103
106
|
/**
|
|
104
107
|
* Tags related with product for internal search
|
|
108
|
+
*
|
|
109
|
+
* @maxItems 200
|
|
105
110
|
*/
|
|
106
111
|
keywords?: string[];
|
|
107
112
|
/**
|
|
@@ -268,6 +273,8 @@ export interface Products {
|
|
|
268
273
|
warranty?: string;
|
|
269
274
|
/**
|
|
270
275
|
* List of product brands
|
|
276
|
+
*
|
|
277
|
+
* @maxItems 100
|
|
271
278
|
*/
|
|
272
279
|
brands?: {
|
|
273
280
|
/**
|
|
@@ -319,6 +326,8 @@ export interface Products {
|
|
|
319
326
|
}[];
|
|
320
327
|
/**
|
|
321
328
|
* List of product categories
|
|
329
|
+
*
|
|
330
|
+
* @maxItems 100
|
|
322
331
|
*/
|
|
323
332
|
categories?: {
|
|
324
333
|
/**
|
|
@@ -407,6 +416,8 @@ export interface Products {
|
|
|
407
416
|
google_product_category_id?: number;
|
|
408
417
|
/**
|
|
409
418
|
* Grids for specifications and variations
|
|
419
|
+
*
|
|
420
|
+
* @maxItems 200
|
|
410
421
|
*/
|
|
411
422
|
grids?: {
|
|
412
423
|
/**
|
|
@@ -445,6 +456,8 @@ export interface Products {
|
|
|
445
456
|
specifications?: {
|
|
446
457
|
/**
|
|
447
458
|
* Attribute to tell users the energy efficiency class of your product
|
|
459
|
+
*
|
|
460
|
+
* @maxItems 1
|
|
448
461
|
*/
|
|
449
462
|
energy_efficiency_class?: {
|
|
450
463
|
/**
|
|
@@ -476,6 +489,8 @@ export interface Products {
|
|
|
476
489
|
}[];
|
|
477
490
|
/**
|
|
478
491
|
* Attribute to set the demographic that your product is designed for
|
|
492
|
+
*
|
|
493
|
+
* @maxItems 1
|
|
479
494
|
*/
|
|
480
495
|
age_group?: {
|
|
481
496
|
/**
|
|
@@ -507,6 +522,8 @@ export interface Products {
|
|
|
507
522
|
}[];
|
|
508
523
|
/**
|
|
509
524
|
* Specify for what gender your product is designed
|
|
525
|
+
*
|
|
526
|
+
* @maxItems 1
|
|
510
527
|
*/
|
|
511
528
|
gender?: {
|
|
512
529
|
/**
|
|
@@ -538,6 +555,8 @@ export interface Products {
|
|
|
538
555
|
}[];
|
|
539
556
|
/**
|
|
540
557
|
* Attribute to describe the main fabric or material that your product is made of
|
|
558
|
+
*
|
|
559
|
+
* @maxItems 1
|
|
541
560
|
*/
|
|
542
561
|
material?: {
|
|
543
562
|
/**
|
|
@@ -569,6 +588,8 @@ export interface Products {
|
|
|
569
588
|
}[];
|
|
570
589
|
/**
|
|
571
590
|
* Attribute to describe the pattern or graphic printed on your product
|
|
591
|
+
*
|
|
592
|
+
* @maxItems 1
|
|
572
593
|
*/
|
|
573
594
|
pattern?: {
|
|
574
595
|
/**
|
|
@@ -600,6 +621,8 @@ export interface Products {
|
|
|
600
621
|
}[];
|
|
601
622
|
/**
|
|
602
623
|
* Attribute to describe the standardized size of your product
|
|
624
|
+
*
|
|
625
|
+
* @maxItems 1
|
|
603
626
|
*/
|
|
604
627
|
size?: {
|
|
605
628
|
/**
|
|
@@ -631,6 +654,8 @@ export interface Products {
|
|
|
631
654
|
}[];
|
|
632
655
|
/**
|
|
633
656
|
* Attribute to describe the cut of your product
|
|
657
|
+
*
|
|
658
|
+
* @maxItems 1
|
|
634
659
|
*/
|
|
635
660
|
size_type?: {
|
|
636
661
|
/**
|
|
@@ -662,6 +687,8 @@ export interface Products {
|
|
|
662
687
|
}[];
|
|
663
688
|
/**
|
|
664
689
|
* Which country's sizing system your product uses
|
|
690
|
+
*
|
|
691
|
+
* @maxItems 1
|
|
665
692
|
*/
|
|
666
693
|
size_system?: {
|
|
667
694
|
/**
|
|
@@ -724,6 +751,9 @@ export interface Products {
|
|
|
724
751
|
/**
|
|
725
752
|
* Custom product attributes, grid as property name (such as 'Model' and 'Voltage')
|
|
726
753
|
*
|
|
754
|
+
* @minItems 1
|
|
755
|
+
* @maxItems 30
|
|
756
|
+
*
|
|
727
757
|
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
728
758
|
* via the `patternProperty` "^.{2,70}$".
|
|
729
759
|
*/
|
|
@@ -769,6 +799,8 @@ export interface Products {
|
|
|
769
799
|
};
|
|
770
800
|
/**
|
|
771
801
|
* List of product images
|
|
802
|
+
*
|
|
803
|
+
* @maxItems 50
|
|
772
804
|
*/
|
|
773
805
|
pictures?: (
|
|
774
806
|
| {
|
|
@@ -783,6 +815,8 @@ export interface Products {
|
|
|
783
815
|
)[];
|
|
784
816
|
/**
|
|
785
817
|
* List of videos related to your product
|
|
818
|
+
*
|
|
819
|
+
* @maxItems 30
|
|
786
820
|
*/
|
|
787
821
|
videos?: {
|
|
788
822
|
/**
|
|
@@ -796,6 +830,8 @@ export interface Products {
|
|
|
796
830
|
}[];
|
|
797
831
|
/**
|
|
798
832
|
* List of product customization fields
|
|
833
|
+
*
|
|
834
|
+
* @maxItems 100
|
|
799
835
|
*/
|
|
800
836
|
customizations?: (
|
|
801
837
|
| {
|
|
@@ -807,6 +843,8 @@ export interface Products {
|
|
|
807
843
|
)[];
|
|
808
844
|
/**
|
|
809
845
|
* Product variations list
|
|
846
|
+
*
|
|
847
|
+
* @maxItems 3000
|
|
810
848
|
*/
|
|
811
849
|
variations?: {
|
|
812
850
|
/**
|
|
@@ -848,6 +886,8 @@ export interface Products {
|
|
|
848
886
|
mpn?: string;
|
|
849
887
|
/**
|
|
850
888
|
* List of product NCM codes
|
|
889
|
+
*
|
|
890
|
+
* @maxItems 10
|
|
851
891
|
*/
|
|
852
892
|
ncm?: string[];
|
|
853
893
|
/**
|
|
@@ -943,6 +983,8 @@ export interface Products {
|
|
|
943
983
|
specifications: {
|
|
944
984
|
/**
|
|
945
985
|
* Attribute to describe the main fabric or material that your product is made of
|
|
986
|
+
*
|
|
987
|
+
* @maxItems 1
|
|
946
988
|
*/
|
|
947
989
|
material?: {
|
|
948
990
|
/**
|
|
@@ -974,6 +1016,8 @@ export interface Products {
|
|
|
974
1016
|
}[];
|
|
975
1017
|
/**
|
|
976
1018
|
* Attribute to describe the pattern or graphic printed on your product
|
|
1019
|
+
*
|
|
1020
|
+
* @maxItems 1
|
|
977
1021
|
*/
|
|
978
1022
|
pattern?: {
|
|
979
1023
|
/**
|
|
@@ -1005,6 +1049,8 @@ export interface Products {
|
|
|
1005
1049
|
}[];
|
|
1006
1050
|
/**
|
|
1007
1051
|
* Attribute to describe the standardized size of your product
|
|
1052
|
+
*
|
|
1053
|
+
* @maxItems 1
|
|
1008
1054
|
*/
|
|
1009
1055
|
size?: {
|
|
1010
1056
|
/**
|
|
@@ -1067,6 +1113,9 @@ export interface Products {
|
|
|
1067
1113
|
/**
|
|
1068
1114
|
* Custom variation attributes, grid as property name (such as 'Model' and 'Voltage')
|
|
1069
1115
|
*
|
|
1116
|
+
* @minItems 1
|
|
1117
|
+
* @maxItems 6
|
|
1118
|
+
*
|
|
1070
1119
|
* This interface was referenced by `undefined`'s JSON-Schema definition
|
|
1071
1120
|
* via the `patternProperty` "^.{2,70}$".
|
|
1072
1121
|
*/
|
|
@@ -1116,11 +1165,15 @@ export interface Products {
|
|
|
1116
1165
|
picture_id?: string;
|
|
1117
1166
|
/**
|
|
1118
1167
|
* Flags to associate additional info
|
|
1168
|
+
*
|
|
1169
|
+
* @maxItems 10
|
|
1119
1170
|
*/
|
|
1120
1171
|
flags?: string[];
|
|
1121
1172
|
}[];
|
|
1122
1173
|
/**
|
|
1123
1174
|
* If this product is a kit, set its composition
|
|
1175
|
+
*
|
|
1176
|
+
* @maxItems 100
|
|
1124
1177
|
*/
|
|
1125
1178
|
kit_composition?: {
|
|
1126
1179
|
/**
|
|
@@ -1167,6 +1220,8 @@ export interface Products {
|
|
|
1167
1220
|
parent_item_id?: string;
|
|
1168
1221
|
/**
|
|
1169
1222
|
* Lists of related products
|
|
1223
|
+
*
|
|
1224
|
+
* @maxItems 30
|
|
1170
1225
|
*/
|
|
1171
1226
|
related_products?: {
|
|
1172
1227
|
/**
|
|
@@ -1179,6 +1234,8 @@ export interface Products {
|
|
|
1179
1234
|
relation_type?: 'common_characteristics' | 'common_orders' | 'manual' | 'other';
|
|
1180
1235
|
/**
|
|
1181
1236
|
* List of products
|
|
1237
|
+
*
|
|
1238
|
+
* @maxItems 100
|
|
1182
1239
|
*/
|
|
1183
1240
|
product_ids: string[];
|
|
1184
1241
|
/**
|
|
@@ -1204,14 +1261,20 @@ export interface Products {
|
|
|
1204
1261
|
total_sold?: number;
|
|
1205
1262
|
/**
|
|
1206
1263
|
* List of product GTIN codes
|
|
1264
|
+
*
|
|
1265
|
+
* @maxItems 10
|
|
1207
1266
|
*/
|
|
1208
1267
|
gtin?: string[];
|
|
1209
1268
|
/**
|
|
1210
1269
|
* List of product MPN codes
|
|
1270
|
+
*
|
|
1271
|
+
* @maxItems 10
|
|
1211
1272
|
*/
|
|
1212
1273
|
mpn?: string[];
|
|
1213
1274
|
/**
|
|
1214
1275
|
* List of product NCM codes
|
|
1276
|
+
*
|
|
1277
|
+
* @maxItems 10
|
|
1215
1278
|
*/
|
|
1216
1279
|
ncm?: string[];
|
|
1217
1280
|
/**
|
|
@@ -1237,6 +1300,8 @@ export interface Products {
|
|
|
1237
1300
|
};
|
|
1238
1301
|
/**
|
|
1239
1302
|
* List of custom attributes
|
|
1303
|
+
*
|
|
1304
|
+
* @maxItems 100
|
|
1240
1305
|
*/
|
|
1241
1306
|
metafields?: {
|
|
1242
1307
|
/**
|
|
@@ -1256,6 +1321,8 @@ export interface Products {
|
|
|
1256
1321
|
}[];
|
|
1257
1322
|
/**
|
|
1258
1323
|
* List of custom attributes
|
|
1324
|
+
*
|
|
1325
|
+
* @maxItems 100
|
|
1259
1326
|
*/
|
|
1260
1327
|
hidden_metafields?: {
|
|
1261
1328
|
/**
|
|
@@ -1275,6 +1342,8 @@ export interface Products {
|
|
|
1275
1342
|
}[];
|
|
1276
1343
|
/**
|
|
1277
1344
|
* Flags to associate additional info
|
|
1345
|
+
*
|
|
1346
|
+
* @maxItems 10
|
|
1278
1347
|
*/
|
|
1279
1348
|
flags?: string[];
|
|
1280
1349
|
/**
|
|
@@ -112,6 +112,9 @@ export interface Stores {
|
|
|
112
112
|
* Secondary public contact phone, commonly a cell phone number
|
|
113
113
|
*/
|
|
114
114
|
contact_cellphone?: string;
|
|
115
|
+
/**
|
|
116
|
+
* @maxItems 30
|
|
117
|
+
*/
|
|
115
118
|
sales_channels?: {
|
|
116
119
|
channel_id: string;
|
|
117
120
|
type?: 'ecommerce' | 'mobile' | 'pos' | 'button' | 'social' | 'chatbot' | 'live';
|
|
@@ -2,8 +2,32 @@ import url from 'url';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { $, argv, fs } from 'zx';
|
|
4
4
|
|
|
5
|
+
const { FIREBASE_PROJECT_ID, GOOGLE_APPLICATION_CREDENTIALS } = process.env;
|
|
5
6
|
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
|
6
7
|
const pwd = process.cwd();
|
|
8
|
+
let projectId = FIREBASE_PROJECT_ID;
|
|
9
|
+
if (projectId) {
|
|
10
|
+
if (!fs.existsSync(path.join(pwd, '.firebaserc'))) {
|
|
11
|
+
fs.writeFileSync(path.join(pwd, '.firebaserc'), JSON.stringify({ projects: { default: projectId } }, null, 2));
|
|
12
|
+
}
|
|
13
|
+
} else {
|
|
14
|
+
if (GOOGLE_APPLICATION_CREDENTIALS) {
|
|
15
|
+
try {
|
|
16
|
+
const gac = fs.readJSONSync(path.join(pwd, GOOGLE_APPLICATION_CREDENTIALS));
|
|
17
|
+
projectId = gac.project_id;
|
|
18
|
+
} catch (e) {
|
|
19
|
+
//
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
if (!projectId) {
|
|
23
|
+
try {
|
|
24
|
+
const firebaserc = fs.readJSONSync(path.join(pwd, '.firebaserc'));
|
|
25
|
+
projectId = firebaserc.projects.default;
|
|
26
|
+
} catch (e) {
|
|
27
|
+
projectId = 'ecom2-hello';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
7
31
|
|
|
8
32
|
export default async () => {
|
|
9
33
|
fs.copySync(path.join(__dirname, '..', 'config'), pwd);
|
|
@@ -14,7 +38,9 @@ export default async () => {
|
|
|
14
38
|
}
|
|
15
39
|
return opts;
|
|
16
40
|
}, '');
|
|
17
|
-
const $firebase = async (cmd) =>
|
|
41
|
+
const $firebase = async (cmd) => {
|
|
42
|
+
return $`firebase --project=${projectId} ${cmd}${options}`;
|
|
43
|
+
};
|
|
18
44
|
if (argv._.includes('serve')) {
|
|
19
45
|
return $firebase('emulators:start');
|
|
20
46
|
}
|
|
@@ -2,9 +2,41 @@ import url from 'url';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { $, argv, fs } from 'zx';
|
|
4
4
|
|
|
5
|
+
const {
|
|
6
|
+
FIREBASE_PROJECT_ID,
|
|
7
|
+
GOOGLE_APPLICATION_CREDENTIALS,
|
|
8
|
+
} = process.env;
|
|
9
|
+
|
|
5
10
|
const __dirname = url.fileURLToPath(new URL('.', import.meta.url));
|
|
6
11
|
const pwd = process.cwd();
|
|
7
12
|
|
|
13
|
+
let projectId = FIREBASE_PROJECT_ID;
|
|
14
|
+
if (projectId) {
|
|
15
|
+
if (!fs.existsSync(path.join(pwd, '.firebaserc'))) {
|
|
16
|
+
fs.writeFileSync(
|
|
17
|
+
path.join(pwd, '.firebaserc'),
|
|
18
|
+
JSON.stringify({ projects: { default: projectId } }, null, 2),
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
if (GOOGLE_APPLICATION_CREDENTIALS) {
|
|
23
|
+
try {
|
|
24
|
+
const gac = fs.readJSONSync(path.join(pwd, GOOGLE_APPLICATION_CREDENTIALS));
|
|
25
|
+
projectId = gac.project_id;
|
|
26
|
+
} catch (e) {
|
|
27
|
+
//
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (!projectId) {
|
|
31
|
+
try {
|
|
32
|
+
const firebaserc = fs.readJSONSync(path.join(pwd, '.firebaserc'));
|
|
33
|
+
projectId = firebaserc.projects.default;
|
|
34
|
+
} catch (e) {
|
|
35
|
+
projectId = 'ecom2-hello';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
8
40
|
export default async () => {
|
|
9
41
|
fs.copySync(path.join(__dirname, '..', 'config'), pwd);
|
|
10
42
|
|
|
@@ -15,7 +47,9 @@ export default async () => {
|
|
|
15
47
|
}
|
|
16
48
|
return opts;
|
|
17
49
|
}, '');
|
|
18
|
-
const $firebase = async (cmd: string) =>
|
|
50
|
+
const $firebase = async (cmd: string) => {
|
|
51
|
+
return $`firebase --project=${projectId} ${cmd}${options}`;
|
|
52
|
+
};
|
|
19
53
|
|
|
20
54
|
if (argv._.includes('serve')) {
|
|
21
55
|
return $firebase('emulators:start');
|
|
@@ -0,0 +1,26 @@
|
|
|
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 deepmerge = Deepmerge();
|
|
7
|
+
const self = {
|
|
8
|
+
__config: {
|
|
9
|
+
hello: 'from @cloudcommerce/firebase',
|
|
10
|
+
lang: process.env.ECOM_LANG || DEFAULT_LANG,
|
|
11
|
+
currency: process.env.ECOM_CURRENCY || DEFAULT_CURRENCY,
|
|
12
|
+
currencySymbol: process.env.ECOM_CURRENCY_SYMBOL || DEFAULT_CURRENCY_SYMBOL,
|
|
13
|
+
countryCode: process.env.ECOM_COUNTRY_CODE || DEFAULT_COUNTRY_CODE,
|
|
14
|
+
storeId: Number(process.env.ECOM_STORE_ID),
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export default {
|
|
19
|
+
get() {
|
|
20
|
+
return self.__config;
|
|
21
|
+
},
|
|
22
|
+
set(config) {
|
|
23
|
+
self.__config = deepmerge(self.__config, config);
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
// # 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,SAAS,GAAG,SAAS,EAAE,CAAC;AAE9B,MAAM,IAAI,GAAG;IACX,QAAQ,EAAE;QACR,KAAK,EAAE,8BAA8B;QACrC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,YAAY;QAC3C,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,gBAAgB;QACvD,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,uBAAuB;QAC3E,WAAW,EAAE,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,oBAAoB;QAClE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;KAC3C;CACF,CAAC;AAEF,eAAe;IACb,GAAG;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IACD,GAAG,CAAC,MAAM;QACR,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,OAAO,CAAC;AAEpC,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAEtC,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAE5C,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import 'source-map-support/register.js';
|
|
2
|
+
import { logger } from 'firebase-functions';
|
|
3
|
+
// eslint-disable-next-line import/no-unresolved
|
|
4
|
+
import { onRequest } from 'firebase-functions/v2/https';
|
|
5
|
+
import config from './config.js';
|
|
6
|
+
|
|
7
|
+
const options = {
|
|
8
|
+
region: process.env.DEPLOY_REGION || 'us-east1',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const z = onRequest(options, (request, response) => {
|
|
12
|
+
if (request.url === '/hello') {
|
|
13
|
+
logger.info('Hello logs!', {
|
|
14
|
+
structuredData: true,
|
|
15
|
+
});
|
|
16
|
+
response.send(config.get().hello);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
response.send({
|
|
20
|
+
config: config.get(),
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const ssr = onRequest(options, (request, response) => {
|
|
25
|
+
response.send('<h1>Hello SSR!</h1>');
|
|
26
|
+
});
|
|
27
|
+
// # sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,gCAAgC,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,gDAAgD;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,MAAM,OAAO,GAAG;IACd,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,UAAU;CAChD,CAAC;AAEF,MAAM,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;IACxD,IAAI,OAAO,CAAC,GAAG,KAAK,QAAQ,EAAE;QAC5B,MAAM,CAAC,IAAI,CAAC,aAAa,EAAE;YACzB,cAAc,EAAE,IAAI;SACrB,CAAC,CAAC;QACH,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;QAClC,OAAO;KACR;IACD,QAAQ,CAAC,IAAI,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE;KACrB,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,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"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/firebase",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.26",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce on Firebase",
|
|
6
|
-
"main": "
|
|
6
|
+
"main": "lib/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./lib/index.js",
|
|
9
|
+
"./config": "./config.js"
|
|
10
|
+
},
|
|
7
11
|
"repository": {
|
|
8
12
|
"type": "git",
|
|
9
13
|
"url": "git+https://github.com/ecomplus/cloud-commerce.git",
|
|
@@ -16,12 +20,14 @@
|
|
|
16
20
|
},
|
|
17
21
|
"homepage": "https://github.com/ecomplus/cloud-commerce/tree/main/packages/firebase#readme",
|
|
18
22
|
"scripts": {
|
|
19
|
-
"build": "
|
|
23
|
+
"build": "sh ../../scripts/build-lib.sh"
|
|
20
24
|
},
|
|
21
25
|
"dependencies": {
|
|
22
26
|
"@cloudcommerce/api": "workspace:*",
|
|
27
|
+
"@fastify/deepmerge": "^1.1.0",
|
|
23
28
|
"firebase-admin": "^11.0.0",
|
|
24
|
-
"firebase-functions": "^3.22.0"
|
|
29
|
+
"firebase-functions": "^3.22.0",
|
|
30
|
+
"source-map-support": "^0.5.21"
|
|
25
31
|
},
|
|
26
32
|
"devDependencies": {
|
|
27
33
|
"@firebase/app-types": "^0.7.0"
|
|
@@ -0,0 +1,29 @@
|
|
|
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 deepmerge = Deepmerge();
|
|
10
|
+
|
|
11
|
+
const self = {
|
|
12
|
+
__config: {
|
|
13
|
+
hello: 'from @cloudcommerce/firebase',
|
|
14
|
+
lang: process.env.ECOM_LANG || DEFAULT_LANG,
|
|
15
|
+
currency: process.env.ECOM_CURRENCY || DEFAULT_CURRENCY,
|
|
16
|
+
currencySymbol: process.env.ECOM_CURRENCY_SYMBOL || DEFAULT_CURRENCY_SYMBOL,
|
|
17
|
+
countryCode: process.env.ECOM_COUNTRY_CODE || DEFAULT_COUNTRY_CODE,
|
|
18
|
+
storeId: Number(process.env.ECOM_STORE_ID),
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default {
|
|
23
|
+
get() {
|
|
24
|
+
return self.__config;
|
|
25
|
+
},
|
|
26
|
+
set(config) {
|
|
27
|
+
self.__config = deepmerge(self.__config, config);
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import 'source-map-support/register.js';
|
|
2
|
+
import { logger } from 'firebase-functions';
|
|
3
|
+
// eslint-disable-next-line import/no-unresolved
|
|
4
|
+
import { onRequest } from 'firebase-functions/v2/https';
|
|
5
|
+
import config from './config';
|
|
6
|
+
|
|
7
|
+
const options = {
|
|
8
|
+
region: process.env.DEPLOY_REGION || 'us-east1',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const z = onRequest(options, (request, response) => {
|
|
12
|
+
if (request.url === '/hello') {
|
|
13
|
+
logger.info('Hello logs!', {
|
|
14
|
+
structuredData: true,
|
|
15
|
+
});
|
|
16
|
+
response.send(config.get().hello);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
response.send({
|
|
20
|
+
config: config.get(),
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export const ssr = onRequest(options, (request, response) => {
|
|
25
|
+
response.send('<h1>Hello SSR!</h1>');
|
|
26
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcommerce/storefront",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.26",
|
|
5
5
|
"description": "E-Com Plus Cloud Commerce storefront with Astro",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"repository": {
|
|
@@ -20,6 +20,6 @@
|
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@cloudcommerce/api": "workspace:*",
|
|
23
|
-
"astro": "1.0.0-beta.
|
|
23
|
+
"astro": "1.0.0-beta.64"
|
|
24
24
|
}
|
|
25
25
|
}
|