feed-common 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +14 -0
- package/dist/constants/google.constants.d.ts +1 -0
- package/dist/constants/google.constants.d.ts.map +1 -0
- package/dist/constants/product.constants.d.ts +1 -0
- package/dist/constants/product.constants.d.ts.map +1 -0
- package/dist/constants/profile.constants.d.ts +5 -4
- package/dist/constants/profile.constants.d.ts.map +1 -0
- package/dist/constants/profile.constants.js +19 -18
- package/dist/constants/profile.constants.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types/company.types.d.ts +21 -2
- package/dist/types/company.types.d.ts.map +1 -0
- package/dist/types/product.types.d.ts +3 -2
- package/dist/types/product.types.d.ts.map +1 -0
- package/dist/types/profile.types.d.ts +7 -6
- package/dist/types/profile.types.d.ts.map +1 -0
- package/dist/types/shopify.types.d.ts +36 -0
- package/dist/types/shopify.types.d.ts.map +1 -0
- package/dist/types/shopify.types.js +7 -0
- package/dist/types/shopify.types.js.map +1 -0
- package/dist/utils/company.d.ts +10 -1
- package/dist/utils/company.d.ts.map +1 -0
- package/dist/utils/company.js +13 -0
- package/dist/utils/company.js.map +1 -1
- package/dist/utils/profile.d.ts +1 -0
- package/dist/utils/profile.d.ts.map +1 -0
- package/dist/utils/utils.d.ts +1 -0
- package/dist/utils/utils.d.ts.map +1 -0
- package/package.json +4 -1
- package/src/constants/profile.constants.ts +23 -20
- package/src/index.ts +1 -1
- package/src/types/company.types.ts +29 -4
- package/src/types/product.types.ts +2 -2
- package/src/types/profile.types.ts +6 -5
- package/src/types/shopify.types.ts +40 -0
- package/src/utils/company.ts +37 -6
- package/dist/utils/gmc.d.ts +0 -16
- package/dist/utils/gmc.js +0 -39
- package/dist/utils/gmc.js.map +0 -1
- package/src/utils/gmc.ts +0 -69
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
# [1.1.0](https://github.com/advertikon/package-maxify-feed-common/compare/v1.0.3...v1.1.0) (2024-02-11)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* add Shopify types ([f73c84a](https://github.com/advertikon/package-maxify-feed-common/commit/f73c84aa9377de29be0a107e8813246a2ef03ab7))
|
7
|
+
|
8
|
+
## [1.0.3](https://github.com/advertikon/package-maxify-feed-common/compare/v1.0.2...v1.0.3) (2024-02-06)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* release ([3d0b54a](https://github.com/advertikon/package-maxify-feed-common/commit/3d0b54aa1b0ca7caaa6d2e97a7114d0e44fca6dd))
|
14
|
+
|
1
15
|
## [1.0.2](https://github.com/advertikon/package-maxify-feed-common/compare/v1.0.1...v1.0.2) (2024-02-02)
|
2
16
|
|
3
17
|
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"google.constants.d.ts","sourceRoot":"","sources":["../../src/constants/google.constants.ts"],"names":[],"mappings":"AAAA,oBAAY,oBAAoB;IAC9B,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,OAAO,YAAY;IACnB,cAAc,mBAAmB;CAClC;AAED,oBAAY,mBAAmB;IAC7B,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,QAAQ,aAAa;CACtB"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"product.constants.d.ts","sourceRoot":"","sources":["../../src/constants/product.constants.ts"],"names":[],"mappings":"AAAA,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB"}
|
@@ -1,8 +1,7 @@
|
|
1
|
-
import { ProductUploadMapSource } from '../types/profile.types.js';
|
2
|
-
import { ProductUploadRuleFilterType } from '../types/profile.types.js';
|
1
|
+
import { ProductUploadMapSource, ProductUploadRuleFilterType } from '../types/profile.types.js';
|
3
2
|
export declare const SOURCE_VENDORS = "source.vendor";
|
4
3
|
export declare const SOURCE_TAGS = "source.tag";
|
5
|
-
export declare const
|
4
|
+
export declare const SOURCE_PRODUCT_TYPE = "source.product_type";
|
6
5
|
export declare const SOURCE_COLLECTIONS = "source.collection";
|
7
6
|
export declare const SOURCE_LANGUAGE = "source.language";
|
8
7
|
export declare const SOURCE_GOOGLE_CATEGORY = "source.google_category";
|
@@ -53,7 +52,7 @@ export declare const RuleOperators: {
|
|
53
52
|
value: string;
|
54
53
|
};
|
55
54
|
};
|
56
|
-
export declare const
|
55
|
+
export declare const ProductUploadRulesOperators: {
|
57
56
|
string: {
|
58
57
|
label: string;
|
59
58
|
value: string;
|
@@ -67,3 +66,5 @@ export declare const ProductUploadRuleFilters: ProductUploadRuleFilterType[];
|
|
67
66
|
export declare const ProductUploadMappings: ProductUploadMapSource[];
|
68
67
|
export declare const CHANNEL = "online";
|
69
68
|
export declare const GMC_PRODUCT_ID_TEMPLATE = "{PRODUCT_ID}_{VARIANT_ID}";
|
69
|
+
export declare const ProfileIdTemplateCodes: string[];
|
70
|
+
//# sourceMappingURL=profile.constants.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"profile.constants.d.ts","sourceRoot":"","sources":["../../src/constants/profile.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,2BAA2B,EAC5B,MAAM,2BAA2B,CAAC;AAEnC,eAAO,MAAM,cAAc,kBAAkB,CAAC;AAC9C,eAAO,MAAM,WAAW,eAAe,CAAC;AACxC,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AACzD,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AACtD,eAAO,MAAM,eAAe,oBAAoB,CAAC;AACjD,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,eAAO,MAAM,cAAc,mBAAmB,CAAC;AAE/C,eAAO,MAAM,sBAAsB,mBAAmB,CAAC;AACvD,eAAO,MAAM,sBAAsB,oBAAoB,CAAC;AACxD,eAAO,MAAM,kBAAkB,gBAAgB,CAAC;AAEhD,eAAO,MAAM,aAAa,iBAAiB,CAAC;AAE5C,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCzB,CAAC;AAEF,eAAO,MAAM,2BAA2B;;;;;;;;;CAYvC,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,2BAA2B,EA0BjE,CAAC;AASF,eAAO,MAAM,qBAAqB,EAAE,sBAAsB,EAiQzD,CAAC;AACF,eAAO,MAAM,OAAO,WAAW,CAAC;AAChC,eAAO,MAAM,uBAAuB,8BAA8B,CAAC;AACnE,eAAO,MAAM,sBAAsB,UAAsD,CAAC"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export const SOURCE_VENDORS = 'source.vendor';
|
2
2
|
export const SOURCE_TAGS = 'source.tag';
|
3
|
-
export const
|
3
|
+
export const SOURCE_PRODUCT_TYPE = 'source.product_type';
|
4
4
|
export const SOURCE_COLLECTIONS = 'source.collection';
|
5
5
|
export const SOURCE_LANGUAGE = 'source.language';
|
6
6
|
export const SOURCE_GOOGLE_CATEGORY = 'source.google_category';
|
@@ -51,7 +51,7 @@ export const RuleOperators = {
|
|
51
51
|
value: 'notIn',
|
52
52
|
},
|
53
53
|
};
|
54
|
-
export const
|
54
|
+
export const ProductUploadRulesOperators = {
|
55
55
|
string: [
|
56
56
|
RuleOperators.contains,
|
57
57
|
RuleOperators.notContains,
|
@@ -67,27 +67,27 @@ export const PruoductUploadRulesOperators = {
|
|
67
67
|
export const ProductUploadRuleFilters = [
|
68
68
|
{
|
69
69
|
label: 'Title',
|
70
|
-
operators:
|
70
|
+
operators: ProductUploadRulesOperators.string,
|
71
71
|
value: 'title',
|
72
72
|
},
|
73
73
|
{
|
74
74
|
label: 'Collection',
|
75
|
-
operators:
|
75
|
+
operators: ProductUploadRulesOperators.list,
|
76
76
|
value: 'collection',
|
77
77
|
},
|
78
78
|
{
|
79
79
|
label: 'Product Type',
|
80
|
-
operators:
|
80
|
+
operators: ProductUploadRulesOperators.list,
|
81
81
|
value: 'product_type',
|
82
82
|
},
|
83
83
|
{
|
84
84
|
label: 'Vendor',
|
85
|
-
operators:
|
85
|
+
operators: ProductUploadRulesOperators.list,
|
86
86
|
value: 'vendor',
|
87
87
|
},
|
88
88
|
{
|
89
89
|
label: 'Tag',
|
90
|
-
operators:
|
90
|
+
operators: ProductUploadRulesOperators.list,
|
91
91
|
value: 'tag',
|
92
92
|
},
|
93
93
|
];
|
@@ -103,7 +103,7 @@ export const ProductUploadMappings = [
|
|
103
103
|
label: 'Content Language',
|
104
104
|
attribute: 'contentLanguage',
|
105
105
|
type: 'select',
|
106
|
-
|
106
|
+
choices: [SOURCE_LANGUAGE],
|
107
107
|
rules: ['title', 'collection', 'product_type', 'vendor', 'tag'],
|
108
108
|
description: 'Language for the item',
|
109
109
|
},
|
@@ -112,7 +112,7 @@ export const ProductUploadMappings = [
|
|
112
112
|
label: 'Target Country',
|
113
113
|
attribute: 'targetCountry',
|
114
114
|
type: 'select',
|
115
|
-
|
115
|
+
choices: [SOURCE_COUNTRY],
|
116
116
|
rules: ['title', 'collection', 'product_type', 'vendor', 'tag'],
|
117
117
|
description: 'The item\'s country of sale',
|
118
118
|
},
|
@@ -121,7 +121,7 @@ export const ProductUploadMappings = [
|
|
121
121
|
label: 'Adult',
|
122
122
|
attribute: 'adult',
|
123
123
|
type: 'select',
|
124
|
-
|
124
|
+
choices: [
|
125
125
|
{ label: 'Yes', value: true },
|
126
126
|
{ label: 'No', value: false },
|
127
127
|
],
|
@@ -133,7 +133,7 @@ export const ProductUploadMappings = [
|
|
133
133
|
label: 'Age Group',
|
134
134
|
attribute: 'ageGroup',
|
135
135
|
type: 'select',
|
136
|
-
|
136
|
+
choices: [
|
137
137
|
{ label: '0-3 months old', value: 'newborn' },
|
138
138
|
{ label: '3-12 months old', value: 'infant' },
|
139
139
|
{ label: '1-5 years old', value: 'toddler' },
|
@@ -148,7 +148,7 @@ export const ProductUploadMappings = [
|
|
148
148
|
label: 'Availability',
|
149
149
|
attribute: 'availability',
|
150
150
|
type: 'select',
|
151
|
-
|
151
|
+
choices: [
|
152
152
|
{ label: 'In Stock', value: 'in_stock' },
|
153
153
|
{ label: 'Out Of Stock', value: 'out_of_stock' },
|
154
154
|
{ label: 'Preorder', value: 'preorder' },
|
@@ -165,7 +165,7 @@ export const ProductUploadMappings = [
|
|
165
165
|
defaultValue: 'shopify.vendor',
|
166
166
|
rules: ['title', 'collection', 'product_type', 'vendor', 'tag'],
|
167
167
|
description: 'Brand of the item',
|
168
|
-
|
168
|
+
choices: [
|
169
169
|
ShopifyProductSource.vendor,
|
170
170
|
SOURCE_VENDORS,
|
171
171
|
ShopifyProductSource.custom,
|
@@ -176,7 +176,7 @@ export const ProductUploadMappings = [
|
|
176
176
|
label: 'Gender',
|
177
177
|
attribute: 'gender',
|
178
178
|
type: 'select',
|
179
|
-
|
179
|
+
choices: [
|
180
180
|
{ label: 'Male', value: 'male' },
|
181
181
|
{ label: 'Female', value: 'female' },
|
182
182
|
{ label: 'Unisex', value: 'unisex' },
|
@@ -189,7 +189,7 @@ export const ProductUploadMappings = [
|
|
189
189
|
label: 'Google category',
|
190
190
|
attribute: 'googleProductCategory',
|
191
191
|
type: 'select',
|
192
|
-
|
192
|
+
choices: [SOURCE_GOOGLE_CATEGORY],
|
193
193
|
rules: ['title', 'collection', 'product_type', 'vendor', 'tag'],
|
194
194
|
description: 'Google\'s category of the item',
|
195
195
|
},
|
@@ -201,7 +201,7 @@ export const ProductUploadMappings = [
|
|
201
201
|
defaultValue: 'shopify.vendor',
|
202
202
|
rules: ['title', 'collection', 'product_type', 'vendor', 'tag'],
|
203
203
|
description: 'Global Trade Item Number (GTIN) of the item',
|
204
|
-
|
204
|
+
choices: [
|
205
205
|
ShopifyProductSource.barcode,
|
206
206
|
ShopifyProductSource.sku,
|
207
207
|
{ label: 'Custom input', value: SOURCE_CUSTOM },
|
@@ -215,7 +215,7 @@ export const ProductUploadMappings = [
|
|
215
215
|
defaultValue: 'shopify.vendor',
|
216
216
|
rules: ['title', 'collection', 'product_type', 'vendor', 'tag'],
|
217
217
|
description: 'Manufacturer Part Number (MPN) of the item',
|
218
|
-
|
218
|
+
choices: [
|
219
219
|
ShopifyProductSource.barcode,
|
220
220
|
ShopifyProductSource.sku,
|
221
221
|
{ label: 'Custom input', value: SOURCE_CUSTOM },
|
@@ -226,7 +226,7 @@ export const ProductUploadMappings = [
|
|
226
226
|
label: 'Included Destinations',
|
227
227
|
attribute: 'includedDestinations',
|
228
228
|
type: 'multiselect',
|
229
|
-
|
229
|
+
choices: [
|
230
230
|
{ label: 'Shopping ads', value: 'Shopping_ads' },
|
231
231
|
{ label: 'Dynamic remarketing ads', value: 'Display_ads' },
|
232
232
|
{ label: 'Free listings', value: 'Free_listings' },
|
@@ -353,4 +353,5 @@ export const ProductUploadMappings = [
|
|
353
353
|
];
|
354
354
|
export const CHANNEL = 'online';
|
355
355
|
export const GMC_PRODUCT_ID_TEMPLATE = '{PRODUCT_ID}_{VARIANT_ID}';
|
356
|
+
export const ProfileIdTemplateCodes = ['PRODUCT_ID', 'VARIANT_ID', 'COUNTRY', 'LANGUAGE'];
|
356
357
|
//# sourceMappingURL=profile.constants.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"profile.constants.js","sourceRoot":"","sources":["../../src/constants/profile.constants.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"profile.constants.js","sourceRoot":"","sources":["../../src/constants/profile.constants.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,cAAc,GAAG,eAAe,CAAC;AAC9C,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC;AACxC,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AACzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC;AACtD,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAC;AACjD,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAC/D,MAAM,CA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6B;IAC7B,MAAM;IACN,oHAAoH;IACpH,MAAM;IACN,2CAA2C;IAC3C,MAAM;IACN,oHAAoH;IACpH,MAAM;IACN,2CAA2C;IAC3C,MAAM;IACN,mHAAmH;IACnH,MAAM;IACN,0CAA0C;IAC1C,MAAM;IACN,qBAAqB;IACrB,MAAM;IACN,uCAAuC;IACvC,MAAM;IACN,sCAAsC;IACtC,MAAM;IACN,oDAAoD;IACpD,MAAM;IACN,sCAAsC;IACtC,MAAM;IACN,oDAAoD;IACpD,MAAM;IACN,sCAAsC;IACtC,MAAM;IACN,iDAAiD;IACjD,MAAM;IACN,qCAAqC;IACrC,MAAM;IACN,mDAAmD;IACnD,MAAM;IACN,wLAAwL;IACxL,MAAM;IACN,kDAAkD;IAClD,MAAM;IACN,sLAAsL;IACtL,MAAM;IACN,2BAA2B;IAC3B,MAAM;IACN,2EAA2E;IAC3E,MAAM;IACN,8BAA8B;IAC9B,MAAM;IACN,yDAAyD;IACzD,MAAM;IACN,4BAA4B;CAC7B,CAAC;AACF,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAChC,MAAM,CAAC,MAAM,uBAAuB,GAAG,2BAA2B,CAAC;AACnE,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
@@ -4,7 +4,8 @@ export * from './constants/profile.constants.js';
|
|
4
4
|
export * from './types/product.types.js';
|
5
5
|
export * from './types/profile.types.js';
|
6
6
|
export * from './types/company.types.js';
|
7
|
-
export * from './
|
7
|
+
export * from './types/shopify.types.js';
|
8
8
|
export * from './utils/profile.js';
|
9
9
|
export * from './utils/utils.js';
|
10
10
|
export * from './utils/company.js';
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AAEjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
@@ -4,7 +4,7 @@ export * from './constants/profile.constants.js';
|
|
4
4
|
export * from './types/product.types.js';
|
5
5
|
export * from './types/profile.types.js';
|
6
6
|
export * from './types/company.types.js';
|
7
|
-
export * from './
|
7
|
+
export * from './types/shopify.types.js';
|
8
8
|
export * from './utils/profile.js';
|
9
9
|
export * from './utils/utils.js';
|
10
10
|
export * from './utils/company.js';
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AAEjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC;AAChD,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AAEjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AAEzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC"}
|
@@ -1,11 +1,30 @@
|
|
1
1
|
export type ServerSideEvent = {
|
2
2
|
shop: string;
|
3
|
-
|
4
|
-
type:
|
3
|
+
eventID: string;
|
4
|
+
type: "progress" | "schedule";
|
5
5
|
name: string;
|
6
|
+
status?: boolean;
|
6
7
|
};
|
7
8
|
export type ServerSideProgressEvent = ServerSideEvent & {
|
8
9
|
progress: number;
|
9
10
|
totalCount: number;
|
10
11
|
};
|
11
12
|
export type ServerSideScheduleEvent = ServerSideEvent;
|
13
|
+
export type CompanyStats = {
|
14
|
+
totalProductsCount: number;
|
15
|
+
profilesStats: {
|
16
|
+
count: number;
|
17
|
+
errors: number;
|
18
|
+
warnings: number;
|
19
|
+
profileId: string;
|
20
|
+
profile: string;
|
21
|
+
}[];
|
22
|
+
};
|
23
|
+
export type SubscriptionPlan = {
|
24
|
+
code: string;
|
25
|
+
level: number;
|
26
|
+
products: number;
|
27
|
+
profiles: number;
|
28
|
+
price: number;
|
29
|
+
};
|
30
|
+
//# sourceMappingURL=company.types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"company.types.d.ts","sourceRoot":"","sources":["../../src/types/company.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,eAAe,GAAG;IACtD,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,eAAe,CAAC;AAEtD,MAAM,MAAM,YAAY,GAAG;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,aAAa,EAAE;QACb,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
|
@@ -26,7 +26,7 @@ export type gmcIssue = {
|
|
26
26
|
updated_at: string;
|
27
27
|
issue: GoogleProductIssue[];
|
28
28
|
};
|
29
|
-
export type
|
29
|
+
export type AppCollection = {
|
30
30
|
id: number;
|
31
31
|
handle: string;
|
32
32
|
title: string;
|
@@ -48,7 +48,7 @@ export type AppProduct = {
|
|
48
48
|
src: string;
|
49
49
|
id: string;
|
50
50
|
}[];
|
51
|
-
collections:
|
51
|
+
collections: AppCollection[];
|
52
52
|
tags: string[];
|
53
53
|
vendor: string;
|
54
54
|
product_type: string;
|
@@ -84,3 +84,4 @@ export type UploadProductBulkPayload = {
|
|
84
84
|
types: string[];
|
85
85
|
tags: string[];
|
86
86
|
};
|
87
|
+
//# sourceMappingURL=product.types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"product.types.d.ts","sourceRoot":"","sources":["../../src/types/product.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;AAE/D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,E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;IAC7B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,iBAAiB,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,IAAI,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,UAAU,EAAE;QACV,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,OAAO,CAAC;QACjB,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,EAAE,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAAC"}
|
@@ -1,12 +1,11 @@
|
|
1
|
-
import { ProductUploadRuleFilters, ProductUploadMappings } from '../constants/profile.constants.js';
|
2
|
-
|
3
|
-
export type ProductUploadRuleOpratorType = {
|
1
|
+
import { ProductUploadRuleFilters, ProductUploadMappings, RuleOperators } from '../constants/profile.constants.js';
|
2
|
+
export type ProductUploadRuleOperatorType = {
|
4
3
|
label: string;
|
5
4
|
value: string;
|
6
5
|
};
|
7
6
|
export type ProductUploadRuleFilterType = {
|
8
7
|
label: string;
|
9
|
-
operators:
|
8
|
+
operators: ProductUploadRuleOperatorType[];
|
10
9
|
value: string;
|
11
10
|
disabled?: boolean;
|
12
11
|
};
|
@@ -26,7 +25,7 @@ export type ProductUploadMapSource = {
|
|
26
25
|
label: string;
|
27
26
|
attribute: string;
|
28
27
|
type: 'select' | 'multiselect' | 'text' | 'number';
|
29
|
-
|
28
|
+
choices?: OptionType[];
|
30
29
|
rules: ProductUploadRuleFilterType['value'][];
|
31
30
|
description?: string;
|
32
31
|
defaultValue?: ValueType;
|
@@ -38,7 +37,7 @@ export type ProductUploadMapping = {
|
|
38
37
|
sections: {
|
39
38
|
ruleItems: {
|
40
39
|
attribute: (typeof ProductUploadRuleFilters)[number]['value'];
|
41
|
-
operator:
|
40
|
+
operator: ProductUploadRuleOperatorType['value'];
|
42
41
|
value: string | string[] | number[] | number | boolean;
|
43
42
|
id: string;
|
44
43
|
}[];
|
@@ -48,6 +47,7 @@ export type ProductUploadMapping = {
|
|
48
47
|
type MappingFields = (typeof ProductUploadMappings)[number]['attribute'];
|
49
48
|
export type ProductUploadProfile = {
|
50
49
|
id: string;
|
50
|
+
profileIdTemplate: string;
|
51
51
|
name: string;
|
52
52
|
active?: boolean;
|
53
53
|
rules: ProductUploadRules;
|
@@ -66,3 +66,4 @@ export type ProductUploadRuleItem = {
|
|
66
66
|
value: string | number | string[] | number[] | boolean;
|
67
67
|
};
|
68
68
|
export {};
|
69
|
+
//# sourceMappingURL=profile.types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"profile.types.d.ts","sourceRoot":"","sources":["../../src/types/profile.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EAC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AAE;QACL,QAAQ,EAAE;YACR,SAAS,EAAE;gBACT,SAAS,EAAE,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;gBAC9D,QAAQ,EAAE,6BAA6B,CAAC,OAAO,CAAC,CAAC;gBACjD,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC;gBACvD,EAAE,EAAE,MAAM,CAAC;aACZ,EAAE,CAAC;SACL,EAAE,CAAC;KACL,CAAC;CACH,CAAC;AAEF,KAAK,aAAa,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC;AAEzE,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,QAAQ,EAAE,oBAAoB,EAAE,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,wBAAwB,EAAE,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,EAAE,qBAAqB,EAAE,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC;CACxD,CAAC"}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { Product } from '@shopify/shopify-api/rest/admin/2023-07/product';
|
2
|
+
import { Variant } from '@shopify/shopify-api/rest/admin/2023-07/variant';
|
3
|
+
import { Shop } from '@shopify/shopify-api/rest/admin/2023-07/shop';
|
4
|
+
import { Webhook } from '@shopify/shopify-api/rest/admin/2023-07/webhook';
|
5
|
+
import { CustomCollection } from '@shopify/shopify-api/rest/admin/2023-07/custom_collection';
|
6
|
+
import { SmartCollection } from '@shopify/shopify-api/rest/admin/2023-07/smart_collection';
|
7
|
+
import { RecurringApplicationCharge } from '@shopify/shopify-api/rest/admin/2023-07/recurring_application_charge';
|
8
|
+
type ShopifyCollection = CustomCollection | SmartCollection;
|
9
|
+
type ShopifyProductVariant = Variant & {
|
10
|
+
images: {
|
11
|
+
variant_ids?: number[];
|
12
|
+
}[];
|
13
|
+
};
|
14
|
+
type ShopifyProduct = Product & {
|
15
|
+
variants: ShopifyProductVariant[];
|
16
|
+
};
|
17
|
+
export type WebhookHeader = {
|
18
|
+
host: string;
|
19
|
+
'user-agent': string;
|
20
|
+
'content-length': string;
|
21
|
+
accept: string;
|
22
|
+
'accept-encoding': string;
|
23
|
+
'content-type': string;
|
24
|
+
'x-forwarded-for': string;
|
25
|
+
'x-forwarded-host': string;
|
26
|
+
'x-forwarded-proto': string;
|
27
|
+
'x-shopify-api-version': string;
|
28
|
+
'x-shopify-hmac-sha256': string;
|
29
|
+
'x-shopify-product-id': string;
|
30
|
+
'x-shopify-shop-domain': string;
|
31
|
+
'x-shopify-topic': string;
|
32
|
+
'x-shopify-triggered-at': string;
|
33
|
+
'x-shopify-webhook-id': string;
|
34
|
+
};
|
35
|
+
export { Shop as ShopifyShop, ShopifyProduct, Webhook as ShopifyWebhook, CustomCollection as ShopifyCustomCollection, SmartCollection as ShopifySmartCollection, ShopifyCollection, RecurringApplicationCharge as ShopifyRecurringCharge, };
|
36
|
+
//# sourceMappingURL=shopify.types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"shopify.types.d.ts","sourceRoot":"","sources":["../../src/types/shopify.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iDAAiD,CA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AAI,uBAAuB,EAC3C,eAAe,IAAI,sBAAsB,EACzC,iBAAiB,EACjB,0BAA0B,IAAI,sBAAsB,GACvD,CAAC"}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { Shop } from '@shopify/shopify-api/rest/admin/2023-07/shop';
|
2
|
+
import { Webhook } from '@shopify/shopify-api/rest/admin/2023-07/webhook';
|
3
|
+
import { CustomCollection } from '@shopify/shopify-api/rest/admin/2023-07/custom_collection';
|
4
|
+
import { SmartCollection } from '@shopify/shopify-api/rest/admin/2023-07/smart_collection';
|
5
|
+
import { RecurringApplicationCharge } from '@shopify/shopify-api/rest/admin/2023-07/recurring_application_charge';
|
6
|
+
export { Shop as ShopifyShop, Webhook as ShopifyWebhook, CustomCollection as ShopifyCustomCollection, SmartCollection as ShopifySmartCollection, RecurringApplicationCharge as ShopifyRecurringCharge, };
|
7
|
+
//# sourceMappingURL=shopify.types.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"shopify.types.js","sourceRoot":"","sources":["../../src/types/shopify.types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,8CAA8C,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,iDAAiD,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,0DAA0D,CAAC;AAC3F,OAAO,EAAE,0BAA0B,EAAE,MAAM,sEAAsE,CAAC;AAyBlH,OAAO,EACH,IAAI,IAAI,WAAW,EAEnB,OAAO,IAAI,cAAc,EACzB,gBAAgB,IAAI,uBAAuB,EAC3C,eAAe,IAAI,sBAAsB,EAEzC,0BAA0B,IAAI,sBAAsB,GACvD,CAAC"}
|
package/dist/utils/company.d.ts
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
-
import { ServerSideEvent, ServerSideProgressEvent, ServerSideScheduleEvent } from '../types/company.types.js';
|
1
|
+
import { ServerSideEvent, ServerSideProgressEvent, ServerSideScheduleEvent, SubscriptionPlan } from '../types/company.types.js';
|
2
|
+
import { ShopifyRecurringCharge } from '../types/shopify.types.js';
|
2
3
|
export declare function isServerSideProgressEvent(event: ServerSideEvent): event is ServerSideProgressEvent;
|
3
4
|
export declare function isServerSideScheduleEvent(event: ServerSideEvent): event is ServerSideScheduleEvent;
|
5
|
+
export declare function makeSubscriptionCode(plan: SubscriptionPlan): string;
|
6
|
+
export declare function makeSubscriptionName(plan: SubscriptionPlan): string;
|
7
|
+
export declare function extractSubscriptionCode(subscription: ShopifyRecurringCharge): string | null;
|
8
|
+
export declare function parseSubscriptionName(name: string | null): {
|
9
|
+
code: string | null;
|
10
|
+
level: string | null;
|
11
|
+
};
|
12
|
+
//# sourceMappingURL=company.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"company.d.ts","sourceRoot":"","sources":["../../src/utils/company.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,eAAe,GACrB,KAAK,IAAI,uBAAuB,CAElC;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,eAAe,GACrB,KAAK,IAAI,uBAAuB,CAElC;AAED,wBAAgB,oBAAoB,CAAE,IAAI,EAAE,gBAAgB,UAE3D;AAED,wBAAgB,oBAAoB,CAAE,IAAI,EAAE,gBAAgB,UAE3D;AAED,wBAAgB,uBAAuB,CAAE,YAAY,EAAE,sBAAsB,iBAE5E;AAED,wBAAgB,qBAAqB,CAAE,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG;IACzD,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,CAGA"}
|
package/dist/utils/company.js
CHANGED
@@ -4,4 +4,17 @@ export function isServerSideProgressEvent(event) {
|
|
4
4
|
export function isServerSideScheduleEvent(event) {
|
5
5
|
return event.type === 'schedule';
|
6
6
|
}
|
7
|
+
export function makeSubscriptionCode(plan) {
|
8
|
+
return `${plan.code}${plan.level}`;
|
9
|
+
}
|
10
|
+
export function makeSubscriptionName(plan) {
|
11
|
+
return `${makeSubscriptionCode(plan)} (up to ${plan.products})`;
|
12
|
+
}
|
13
|
+
export function extractSubscriptionCode(subscription) {
|
14
|
+
return subscription.name?.match(/^G\d+/i)?.[0] ?? null;
|
15
|
+
}
|
16
|
+
export function parseSubscriptionName(name) {
|
17
|
+
const match = name?.match(/^G(\d+)/);
|
18
|
+
return { code: 'G', level: match ? match[1] : null };
|
19
|
+
}
|
7
20
|
//# sourceMappingURL=company.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"company.js","sourceRoot":"","sources":["../../src/utils/company.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"company.js","sourceRoot":"","sources":["../../src/utils/company.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,yBAAyB,CACvC,KAAsB;IAEtB,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,KAAsB;IAEtB,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAE,IAAsB;IAC1D,OAAO,GAAG,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAE,IAAsB;IACxD,OAAO,GAAG,oBAAoB,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,QAAQ,GAAG,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAE,YAAoC;IACzE,OAAO,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,E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AAY,CAC1B,CAAC,GAAE,kBAAqC,EACxC,CAAC,GAAE,kBAAqC,GACvC,OAAO,CA4CT;AAUD,wBAAgB,eAAe,CAC7B,CAAC,EAAE,oBAAoB,EAAE,EACzB,CAAC,EAAE,oBAAoB,EAAE,GACxB,OAAO,CA6BT;AACD,wBAAgB,cAAc,CAAE,MAAM,EAAE,UAAU,GAAG,MAAM,IAAI,MAAM,CAEpE;AAED,wBAAgB,YAAY,CAAE,MAAM,EAAE,UAAU,GAAG,MAAM,IAAI,cAAc,CAE1E;AAED,wBAAgB,aAAa,CAAE,MAAM,EAAE,UAAU,GAAG,MAAM,IAAI,eAAe,CAE5E;AACD,wBAAgB,mBAAmB,CACjC,CAAC,EAAE,oBAAoB,EACvB,CAAC,EAAE,oBAAoB,GACtB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,OAAO,CAAA;CAAE,CAwCnE;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,oBAAoB,GAC5B,oBAAoB,CAkBtB"}
|
package/dist/utils/utils.d.ts
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,IAAI,WAEnB"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "feed-common",
|
3
|
-
"version": "1.0
|
3
|
+
"version": "1.1.0",
|
4
4
|
"description": "Maxify feed common library",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"type": "module",
|
@@ -23,6 +23,9 @@
|
|
23
23
|
"semantic-release-slack-bot": "^4.0.2",
|
24
24
|
"typescript": "^5.3.3"
|
25
25
|
},
|
26
|
+
"peerDependencies": {
|
27
|
+
"@shopify/shopify-api": "^9.2.0"
|
28
|
+
},
|
26
29
|
"repository": {
|
27
30
|
"type": "git",
|
28
31
|
"url": "git+https://github.com/advertikon/package-maxify-feed-common.git"
|
@@ -1,9 +1,11 @@
|
|
1
|
-
import {
|
2
|
-
|
1
|
+
import {
|
2
|
+
ProductUploadMapSource,
|
3
|
+
ProductUploadRuleFilterType,
|
4
|
+
} from '../types/profile.types.js';
|
3
5
|
|
4
6
|
export const SOURCE_VENDORS = 'source.vendor';
|
5
7
|
export const SOURCE_TAGS = 'source.tag';
|
6
|
-
export const
|
8
|
+
export const SOURCE_PRODUCT_TYPE = 'source.product_type';
|
7
9
|
export const SOURCE_COLLECTIONS = 'source.collection';
|
8
10
|
export const SOURCE_LANGUAGE = 'source.language';
|
9
11
|
export const SOURCE_GOOGLE_CATEGORY = 'source.google_category';
|
@@ -58,7 +60,7 @@ export const RuleOperators = {
|
|
58
60
|
},
|
59
61
|
};
|
60
62
|
|
61
|
-
export const
|
63
|
+
export const ProductUploadRulesOperators = {
|
62
64
|
string: [
|
63
65
|
RuleOperators.contains,
|
64
66
|
RuleOperators.notContains,
|
@@ -75,27 +77,27 @@ export const PruoductUploadRulesOperators = {
|
|
75
77
|
export const ProductUploadRuleFilters: ProductUploadRuleFilterType[] = [
|
76
78
|
{
|
77
79
|
label: 'Title',
|
78
|
-
operators:
|
80
|
+
operators: ProductUploadRulesOperators.string,
|
79
81
|
value: 'title',
|
80
82
|
},
|
81
83
|
{
|
82
84
|
label: 'Collection',
|
83
|
-
operators:
|
85
|
+
operators: ProductUploadRulesOperators.list,
|
84
86
|
value: 'collection',
|
85
87
|
},
|
86
88
|
{
|
87
89
|
label: 'Product Type',
|
88
|
-
operators:
|
90
|
+
operators: ProductUploadRulesOperators.list,
|
89
91
|
value: 'product_type',
|
90
92
|
},
|
91
93
|
{
|
92
94
|
label: 'Vendor',
|
93
|
-
operators:
|
95
|
+
operators: ProductUploadRulesOperators.list,
|
94
96
|
value: 'vendor',
|
95
97
|
},
|
96
98
|
{
|
97
99
|
label: 'Tag',
|
98
|
-
operators:
|
100
|
+
operators: ProductUploadRulesOperators.list,
|
99
101
|
value: 'tag',
|
100
102
|
},
|
101
103
|
];
|
@@ -113,7 +115,7 @@ export const ProductUploadMappings: ProductUploadMapSource[] = [
|
|
113
115
|
label: 'Content Language',
|
114
116
|
attribute: 'contentLanguage',
|
115
117
|
type: 'select',
|
116
|
-
|
118
|
+
choices: [SOURCE_LANGUAGE],
|
117
119
|
rules: ['title', 'collection', 'product_type', 'vendor', 'tag'],
|
118
120
|
description: 'Language for the item',
|
119
121
|
},
|
@@ -122,7 +124,7 @@ export const ProductUploadMappings: ProductUploadMapSource[] = [
|
|
122
124
|
label: 'Target Country',
|
123
125
|
attribute: 'targetCountry',
|
124
126
|
type: 'select',
|
125
|
-
|
127
|
+
choices: [SOURCE_COUNTRY],
|
126
128
|
rules: ['title', 'collection', 'product_type', 'vendor', 'tag'],
|
127
129
|
description: 'The item\'s country of sale',
|
128
130
|
},
|
@@ -131,7 +133,7 @@ export const ProductUploadMappings: ProductUploadMapSource[] = [
|
|
131
133
|
label: 'Adult',
|
132
134
|
attribute: 'adult',
|
133
135
|
type: 'select',
|
134
|
-
|
136
|
+
choices: [
|
135
137
|
{ label: 'Yes', value: true },
|
136
138
|
{ label: 'No', value: false },
|
137
139
|
],
|
@@ -144,7 +146,7 @@ export const ProductUploadMappings: ProductUploadMapSource[] = [
|
|
144
146
|
label: 'Age Group',
|
145
147
|
attribute: 'ageGroup',
|
146
148
|
type: 'select',
|
147
|
-
|
149
|
+
choices: [
|
148
150
|
{ label: '0-3 months old', value: 'newborn' },
|
149
151
|
{ label: '3-12 months old', value: 'infant' },
|
150
152
|
{ label: '1-5 years old', value: 'toddler' },
|
@@ -159,7 +161,7 @@ export const ProductUploadMappings: ProductUploadMapSource[] = [
|
|
159
161
|
label: 'Availability',
|
160
162
|
attribute: 'availability',
|
161
163
|
type: 'select',
|
162
|
-
|
164
|
+
choices: [
|
163
165
|
{ label: 'In Stock', value: 'in_stock' },
|
164
166
|
{ label: 'Out Of Stock', value: 'out_of_stock' },
|
165
167
|
{ label: 'Preorder', value: 'preorder' },
|
@@ -176,7 +178,7 @@ export const ProductUploadMappings: ProductUploadMapSource[] = [
|
|
176
178
|
defaultValue: 'shopify.vendor',
|
177
179
|
rules: ['title', 'collection', 'product_type', 'vendor', 'tag'],
|
178
180
|
description: 'Brand of the item',
|
179
|
-
|
181
|
+
choices: [
|
180
182
|
ShopifyProductSource.vendor,
|
181
183
|
SOURCE_VENDORS,
|
182
184
|
ShopifyProductSource.custom,
|
@@ -187,7 +189,7 @@ export const ProductUploadMappings: ProductUploadMapSource[] = [
|
|
187
189
|
label: 'Gender',
|
188
190
|
attribute: 'gender',
|
189
191
|
type: 'select',
|
190
|
-
|
192
|
+
choices: [
|
191
193
|
{ label: 'Male', value: 'male' },
|
192
194
|
{ label: 'Female', value: 'female' },
|
193
195
|
{ label: 'Unisex', value: 'unisex' },
|
@@ -200,7 +202,7 @@ export const ProductUploadMappings: ProductUploadMapSource[] = [
|
|
200
202
|
label: 'Google category',
|
201
203
|
attribute: 'googleProductCategory',
|
202
204
|
type: 'select',
|
203
|
-
|
205
|
+
choices: [SOURCE_GOOGLE_CATEGORY],
|
204
206
|
rules: ['title', 'collection', 'product_type', 'vendor', 'tag'],
|
205
207
|
description: 'Google\'s category of the item',
|
206
208
|
},
|
@@ -212,7 +214,7 @@ export const ProductUploadMappings: ProductUploadMapSource[] = [
|
|
212
214
|
defaultValue: 'shopify.vendor',
|
213
215
|
rules: ['title', 'collection', 'product_type', 'vendor', 'tag'],
|
214
216
|
description: 'Global Trade Item Number (GTIN) of the item',
|
215
|
-
|
217
|
+
choices: [
|
216
218
|
ShopifyProductSource.barcode,
|
217
219
|
ShopifyProductSource.sku,
|
218
220
|
{ label: 'Custom input', value: SOURCE_CUSTOM },
|
@@ -226,7 +228,7 @@ export const ProductUploadMappings: ProductUploadMapSource[] = [
|
|
226
228
|
defaultValue: 'shopify.vendor',
|
227
229
|
rules: ['title', 'collection', 'product_type', 'vendor', 'tag'],
|
228
230
|
description: 'Manufacturer Part Number (MPN) of the item',
|
229
|
-
|
231
|
+
choices: [
|
230
232
|
ShopifyProductSource.barcode,
|
231
233
|
ShopifyProductSource.sku,
|
232
234
|
{ label: 'Custom input', value: SOURCE_CUSTOM },
|
@@ -237,7 +239,7 @@ export const ProductUploadMappings: ProductUploadMapSource[] = [
|
|
237
239
|
label: 'Included Destinations',
|
238
240
|
attribute: 'includedDestinations',
|
239
241
|
type: 'multiselect',
|
240
|
-
|
242
|
+
choices: [
|
241
243
|
{ label: 'Shopping ads', value: 'Shopping_ads' },
|
242
244
|
{ label: 'Dynamic remarketing ads', value: 'Display_ads' },
|
243
245
|
{ label: 'Free listings', value: 'Free_listings' },
|
@@ -367,3 +369,4 @@ export const ProductUploadMappings: ProductUploadMapSource[] = [
|
|
367
369
|
];
|
368
370
|
export const CHANNEL = 'online';
|
369
371
|
export const GMC_PRODUCT_ID_TEMPLATE = '{PRODUCT_ID}_{VARIANT_ID}';
|
372
|
+
export const ProfileIdTemplateCodes = ['PRODUCT_ID', 'VARIANT_ID', 'COUNTRY', 'LANGUAGE'];
|
package/src/index.ts
CHANGED
@@ -5,8 +5,8 @@ export * from './constants/profile.constants.js';
|
|
5
5
|
export * from './types/product.types.js';
|
6
6
|
export * from './types/profile.types.js';
|
7
7
|
export * from './types/company.types.js';
|
8
|
+
export * from './types/shopify.types.js';
|
8
9
|
|
9
|
-
export * from './utils/gmc.js';
|
10
10
|
export * from './utils/profile.js';
|
11
11
|
export * from './utils/utils.js';
|
12
12
|
export * from './utils/company.js';
|
@@ -1,8 +1,33 @@
|
|
1
|
-
export type ServerSideEvent = {
|
1
|
+
export type ServerSideEvent = {
|
2
|
+
shop: string;
|
3
|
+
eventID: string;
|
4
|
+
type: "progress" | "schedule";
|
5
|
+
name: string;
|
6
|
+
status?: boolean;
|
7
|
+
};
|
2
8
|
|
3
9
|
export type ServerSideProgressEvent = ServerSideEvent & {
|
4
|
-
|
5
|
-
|
10
|
+
progress: number;
|
11
|
+
totalCount: number;
|
6
12
|
};
|
7
13
|
|
8
|
-
export type ServerSideScheduleEvent = ServerSideEvent;
|
14
|
+
export type ServerSideScheduleEvent = ServerSideEvent;
|
15
|
+
|
16
|
+
export type CompanyStats = {
|
17
|
+
totalProductsCount: number;
|
18
|
+
profilesStats: {
|
19
|
+
count: number;
|
20
|
+
errors: number;
|
21
|
+
warnings: number;
|
22
|
+
profileId: string;
|
23
|
+
profile: string;
|
24
|
+
}[];
|
25
|
+
};
|
26
|
+
|
27
|
+
export type SubscriptionPlan = {
|
28
|
+
code: string;
|
29
|
+
level: number;
|
30
|
+
products: number;
|
31
|
+
profiles: number;
|
32
|
+
price: number;
|
33
|
+
};
|
@@ -32,7 +32,7 @@ export type gmcIssue = {
|
|
32
32
|
issue: GoogleProductIssue[];
|
33
33
|
};
|
34
34
|
|
35
|
-
export type
|
35
|
+
export type AppCollection = {
|
36
36
|
id: number;
|
37
37
|
handle: string;
|
38
38
|
title: string;
|
@@ -55,7 +55,7 @@ export type AppProduct = {
|
|
55
55
|
src: string;
|
56
56
|
id: string;
|
57
57
|
}[];
|
58
|
-
collections:
|
58
|
+
collections: AppCollection[];
|
59
59
|
tags: string[];
|
60
60
|
vendor: string;
|
61
61
|
product_type: string;
|
@@ -1,17 +1,17 @@
|
|
1
1
|
import {
|
2
2
|
ProductUploadRuleFilters,
|
3
3
|
ProductUploadMappings,
|
4
|
+
RuleOperators,
|
4
5
|
} from '../constants/profile.constants.js';
|
5
|
-
import { RuleOperators } from '../constants/profile.constants.js';
|
6
6
|
|
7
|
-
export type
|
7
|
+
export type ProductUploadRuleOperatorType = {
|
8
8
|
label: string;
|
9
9
|
value: string;
|
10
10
|
};
|
11
11
|
|
12
12
|
export type ProductUploadRuleFilterType = {
|
13
13
|
label: string;
|
14
|
-
operators:
|
14
|
+
operators: ProductUploadRuleOperatorType[];
|
15
15
|
value: string;
|
16
16
|
disabled?: boolean;
|
17
17
|
};
|
@@ -26,7 +26,7 @@ export type ProductUploadMapSource = {
|
|
26
26
|
label: string;
|
27
27
|
attribute: string;
|
28
28
|
type: 'select' | 'multiselect' | 'text' | 'number';
|
29
|
-
|
29
|
+
choices?: OptionType[];
|
30
30
|
rules: ProductUploadRuleFilterType['value'][];
|
31
31
|
description?: string;
|
32
32
|
defaultValue?: ValueType;
|
@@ -39,7 +39,7 @@ export type ProductUploadMapping = {
|
|
39
39
|
sections: {
|
40
40
|
ruleItems: {
|
41
41
|
attribute: (typeof ProductUploadRuleFilters)[number]['value'];
|
42
|
-
operator:
|
42
|
+
operator: ProductUploadRuleOperatorType['value'];
|
43
43
|
value: string | string[] | number[] | number | boolean;
|
44
44
|
id: string;
|
45
45
|
}[];
|
@@ -51,6 +51,7 @@ type MappingFields = (typeof ProductUploadMappings)[number]['attribute'];
|
|
51
51
|
|
52
52
|
export type ProductUploadProfile = {
|
53
53
|
id: string;
|
54
|
+
profileIdTemplate: string;
|
54
55
|
name: string;
|
55
56
|
active?: boolean;
|
56
57
|
rules: ProductUploadRules;
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { Product } from '@shopify/shopify-api/rest/admin/2023-07/product';
|
2
|
+
import { Variant } from '@shopify/shopify-api/rest/admin/2023-07/variant';
|
3
|
+
import { Shop } from '@shopify/shopify-api/rest/admin/2023-07/shop';
|
4
|
+
import { Webhook } from '@shopify/shopify-api/rest/admin/2023-07/webhook';
|
5
|
+
import { CustomCollection } from '@shopify/shopify-api/rest/admin/2023-07/custom_collection';
|
6
|
+
import { SmartCollection } from '@shopify/shopify-api/rest/admin/2023-07/smart_collection';
|
7
|
+
import { RecurringApplicationCharge } from '@shopify/shopify-api/rest/admin/2023-07/recurring_application_charge';
|
8
|
+
|
9
|
+
type ShopifyCollection = CustomCollection | SmartCollection;
|
10
|
+
type ShopifyProductVariant = Variant & { images: { variant_ids?: number[] }[] };
|
11
|
+
type ShopifyProduct = Product & { variants: ShopifyProductVariant[] };
|
12
|
+
|
13
|
+
export type WebhookHeader = {
|
14
|
+
host: string;
|
15
|
+
'user-agent': string;
|
16
|
+
'content-length': string;
|
17
|
+
accept: string;
|
18
|
+
'accept-encoding': string;
|
19
|
+
'content-type': string;
|
20
|
+
'x-forwarded-for': string;
|
21
|
+
'x-forwarded-host': string;
|
22
|
+
'x-forwarded-proto': string;
|
23
|
+
'x-shopify-api-version': string;
|
24
|
+
'x-shopify-hmac-sha256': string;
|
25
|
+
'x-shopify-product-id': string;
|
26
|
+
'x-shopify-shop-domain': string;
|
27
|
+
'x-shopify-topic': string;
|
28
|
+
'x-shopify-triggered-at': string;
|
29
|
+
'x-shopify-webhook-id': string;
|
30
|
+
};
|
31
|
+
|
32
|
+
export {
|
33
|
+
Shop as ShopifyShop,
|
34
|
+
ShopifyProduct,
|
35
|
+
Webhook as ShopifyWebhook,
|
36
|
+
CustomCollection as ShopifyCustomCollection,
|
37
|
+
SmartCollection as ShopifySmartCollection,
|
38
|
+
ShopifyCollection,
|
39
|
+
RecurringApplicationCharge as ShopifyRecurringCharge,
|
40
|
+
};
|
package/src/utils/company.ts
CHANGED
@@ -1,9 +1,40 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
ServerSideEvent,
|
3
|
+
ServerSideProgressEvent,
|
4
|
+
ServerSideScheduleEvent,
|
5
|
+
SubscriptionPlan,
|
6
|
+
} from '../types/company.types.js';
|
7
|
+
import { ShopifyRecurringCharge } from '../types/shopify.types.js';
|
2
8
|
|
3
|
-
export function isServerSideProgressEvent (
|
4
|
-
|
9
|
+
export function isServerSideProgressEvent (
|
10
|
+
event: ServerSideEvent
|
11
|
+
): event is ServerSideProgressEvent {
|
12
|
+
return event.type === 'progress';
|
13
|
+
}
|
14
|
+
|
15
|
+
export function isServerSideScheduleEvent (
|
16
|
+
event: ServerSideEvent
|
17
|
+
): event is ServerSideScheduleEvent {
|
18
|
+
return event.type === 'schedule';
|
19
|
+
}
|
20
|
+
|
21
|
+
export function makeSubscriptionCode (plan: SubscriptionPlan) {
|
22
|
+
return `${plan.code}${plan.level}`;
|
23
|
+
}
|
24
|
+
|
25
|
+
export function makeSubscriptionName (plan: SubscriptionPlan) {
|
26
|
+
return `${makeSubscriptionCode(plan)} (up to ${plan.products})`;
|
27
|
+
}
|
28
|
+
|
29
|
+
export function extractSubscriptionCode (subscription: ShopifyRecurringCharge) {
|
30
|
+
return subscription.name?.match(/^G\d+/i)?.[0] ?? null;
|
31
|
+
}
|
32
|
+
|
33
|
+
export function parseSubscriptionName (name: string | null): {
|
34
|
+
code: string | null;
|
35
|
+
level: string | null;
|
36
|
+
} {
|
37
|
+
const match = name?.match(/^G(\d+)/);
|
38
|
+
return { code: 'G', level: match ? match[1] : null };
|
5
39
|
}
|
6
40
|
|
7
|
-
export function isServerSideScheduleEvent (event: ServerSideEvent): event is ServerSideScheduleEvent {
|
8
|
-
return event.type === 'schedule';
|
9
|
-
}
|
package/dist/utils/gmc.d.ts
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
export declare function isGmcProductId(productId: string): boolean;
|
2
|
-
export declare function GMCProductIdToShopify(productId: string): number;
|
3
|
-
export declare function GmcIdParts(gmcProductId: string): {
|
4
|
-
channel: string;
|
5
|
-
locale: string;
|
6
|
-
country: string;
|
7
|
-
idPart: string;
|
8
|
-
shopifyId: number;
|
9
|
-
shopifyVariantId: number;
|
10
|
-
};
|
11
|
-
export declare function makeGmcIdPart(productId: number | null, variantId: number | null): string;
|
12
|
-
export declare function getShopifyIdsFromGmcIdPart(gmcId: string): {
|
13
|
-
shopifyId: number;
|
14
|
-
shopifyVariantId: number;
|
15
|
-
};
|
16
|
-
export declare function getProductIdFromGmcId(gmcId: string): number;
|
package/dist/utils/gmc.js
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
import { GMC_PRODUCT_ID_TEMPLATE } from '../constants/profile.constants.js';
|
2
|
-
export function isGmcProductId(productId) {
|
3
|
-
return new RegExp(GMC_PRODUCT_ID_TEMPLATE.replace('{PRODUCT_ID}', '\\d+').replace('{VARIANT_ID}', '\\d+')).test(productId);
|
4
|
-
}
|
5
|
-
export function GMCProductIdToShopify(productId) {
|
6
|
-
const [, , , id] = productId.split(':');
|
7
|
-
return Number(getProductIdFromGmcId(id));
|
8
|
-
}
|
9
|
-
export function GmcIdParts(gmcProductId) {
|
10
|
-
const [channel, locale, country, idPart] = gmcProductId.split(':');
|
11
|
-
if (!channel || !locale || !country || !idPart) {
|
12
|
-
throw new Error(`${gmcProductId} is not a valid GMC product id`);
|
13
|
-
}
|
14
|
-
return {
|
15
|
-
channel,
|
16
|
-
locale,
|
17
|
-
country,
|
18
|
-
idPart,
|
19
|
-
...getShopifyIdsFromGmcIdPart(idPart),
|
20
|
-
};
|
21
|
-
}
|
22
|
-
export function makeGmcIdPart(productId, variantId) {
|
23
|
-
return GMC_PRODUCT_ID_TEMPLATE.replace('{PRODUCT_ID}', String(productId)).replace('{VARIANT_ID}', String(variantId));
|
24
|
-
}
|
25
|
-
export function getShopifyIdsFromGmcIdPart(gmcId) {
|
26
|
-
if (!isGmcProductId(gmcId)) {
|
27
|
-
throw new Error(`${gmcId} is not a valid GMC product id part`);
|
28
|
-
}
|
29
|
-
const [productId, variantId] = gmcId.split('_');
|
30
|
-
return { shopifyId: Number(productId), shopifyVariantId: Number(variantId) };
|
31
|
-
}
|
32
|
-
export function getProductIdFromGmcId(gmcId) {
|
33
|
-
if (!isGmcProductId(gmcId)) {
|
34
|
-
throw new Error(`${gmcId} is not a valid GMC product id part`);
|
35
|
-
}
|
36
|
-
const [productId] = gmcId.split('_');
|
37
|
-
return Number(productId);
|
38
|
-
}
|
39
|
-
//# sourceMappingURL=gmc.js.map
|
package/dist/utils/gmc.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"gmc.js","sourceRoot":"","sources":["../../src/utils/gmc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,MAAM,UAAU,cAAc,CAAE,SAAiB;IAC/C,OAAO,IAAI,MAAM,CACf,uBAAuB,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AAK,CAAC,GAAG,CAAC,CAAC;IAChD,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE,gBAAgB,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;AAC/E,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAE,KAAa;IAClD,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,qCAAqC,CAAC,CAAC;IACjE,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACrC,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC;AAC3B,CAAC"}
|
package/src/utils/gmc.ts
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
import { GMC_PRODUCT_ID_TEMPLATE } from '../constants/profile.constants.js';
|
2
|
-
|
3
|
-
export function isGmcProductId (productId: string): boolean {
|
4
|
-
return new RegExp(
|
5
|
-
GMC_PRODUCT_ID_TEMPLATE.replace('{PRODUCT_ID}', '\\d+').replace(
|
6
|
-
'{VARIANT_ID}',
|
7
|
-
'\\d+'
|
8
|
-
)
|
9
|
-
).test(productId);
|
10
|
-
}
|
11
|
-
|
12
|
-
export function GMCProductIdToShopify (productId: string): number {
|
13
|
-
const [, , , id] = productId.split(':');
|
14
|
-
return Number(getProductIdFromGmcId(id));
|
15
|
-
}
|
16
|
-
|
17
|
-
export function GmcIdParts (gmcProductId: string): {
|
18
|
-
channel: string;
|
19
|
-
locale: string;
|
20
|
-
country: string;
|
21
|
-
idPart: string;
|
22
|
-
shopifyId: number;
|
23
|
-
shopifyVariantId: number;
|
24
|
-
} {
|
25
|
-
const [channel, locale, country, idPart] = gmcProductId.split(':');
|
26
|
-
|
27
|
-
if (!channel || !locale || !country || !idPart) {
|
28
|
-
throw new Error(`${gmcProductId} is not a valid GMC product id`);
|
29
|
-
}
|
30
|
-
|
31
|
-
return {
|
32
|
-
channel,
|
33
|
-
locale,
|
34
|
-
country,
|
35
|
-
idPart,
|
36
|
-
...getShopifyIdsFromGmcIdPart(idPart),
|
37
|
-
};
|
38
|
-
}
|
39
|
-
|
40
|
-
export function makeGmcIdPart (
|
41
|
-
productId: number | null,
|
42
|
-
variantId: number | null
|
43
|
-
): string {
|
44
|
-
return GMC_PRODUCT_ID_TEMPLATE.replace(
|
45
|
-
'{PRODUCT_ID}',
|
46
|
-
String(productId)
|
47
|
-
).replace('{VARIANT_ID}', String(variantId));
|
48
|
-
}
|
49
|
-
|
50
|
-
export function getShopifyIdsFromGmcIdPart (gmcId: string): {
|
51
|
-
shopifyId: number;
|
52
|
-
shopifyVariantId: number;
|
53
|
-
} {
|
54
|
-
if (!isGmcProductId(gmcId)) {
|
55
|
-
throw new Error(`${gmcId} is not a valid GMC product id part`);
|
56
|
-
}
|
57
|
-
|
58
|
-
const [productId, variantId] = gmcId.split('_');
|
59
|
-
return { shopifyId: Number(productId), shopifyVariantId: Number(variantId) };
|
60
|
-
}
|
61
|
-
|
62
|
-
export function getProductIdFromGmcId (gmcId: string): number {
|
63
|
-
if (!isGmcProductId(gmcId)) {
|
64
|
-
throw new Error(`${gmcId} is not a valid GMC product id part`);
|
65
|
-
}
|
66
|
-
|
67
|
-
const [productId] = gmcId.split('_');
|
68
|
-
return Number(productId);
|
69
|
-
}
|