feed-common 1.0.3 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/constants/google.constants.d.ts +1 -0
  3. package/dist/constants/google.constants.d.ts.map +1 -0
  4. package/dist/constants/product.constants.d.ts +1 -0
  5. package/dist/constants/product.constants.d.ts.map +1 -0
  6. package/dist/constants/profile.constants.d.ts +1 -0
  7. package/dist/constants/profile.constants.d.ts.map +1 -0
  8. package/dist/index.d.ts +2 -1
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +1 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/types/company.types.d.ts +18 -0
  13. package/dist/types/company.types.d.ts.map +1 -0
  14. package/dist/types/product.types.d.ts +3 -2
  15. package/dist/types/product.types.d.ts.map +1 -0
  16. package/dist/types/profile.types.d.ts +1 -0
  17. package/dist/types/profile.types.d.ts.map +1 -0
  18. package/dist/types/shopify.types.d.ts +36 -0
  19. package/dist/types/shopify.types.d.ts.map +1 -0
  20. package/dist/types/shopify.types.js +2 -0
  21. package/dist/types/shopify.types.js.map +1 -0
  22. package/dist/utils/company.d.ts +10 -1
  23. package/dist/utils/company.d.ts.map +1 -0
  24. package/dist/utils/company.js +13 -0
  25. package/dist/utils/company.js.map +1 -1
  26. package/dist/utils/profile.d.ts +1 -0
  27. package/dist/utils/profile.d.ts.map +1 -0
  28. package/dist/utils/utils.d.ts +1 -0
  29. package/dist/utils/utils.d.ts.map +1 -0
  30. package/package.json +4 -1
  31. package/src/index.ts +1 -1
  32. package/src/types/company.types.ts +19 -0
  33. package/src/types/product.types.ts +2 -2
  34. package/src/types/shopify.types.ts +45 -0
  35. package/src/utils/company.ts +37 -6
  36. package/dist/utils/gmc.d.ts +0 -1
  37. package/dist/utils/gmc.js +0 -55
  38. package/dist/utils/gmc.js.map +0 -1
  39. package/src/utils/gmc.ts +0 -61
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [1.1.1](https://github.com/advertikon/package-maxify-feed-common/compare/v1.1.0...v1.1.1) (2024-02-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * fix shopify types ([0482e82](https://github.com/advertikon/package-maxify-feed-common/commit/0482e82a5b02eb7cfa4f7b16abce1fb95e4210c5))
7
+
8
+ # [1.1.0](https://github.com/advertikon/package-maxify-feed-common/compare/v1.0.3...v1.1.0) (2024-02-11)
9
+
10
+
11
+ ### Features
12
+
13
+ * add Shopify types ([f73c84a](https://github.com/advertikon/package-maxify-feed-common/commit/f73c84aa9377de29be0a107e8813246a2ef03ab7))
14
+
1
15
  ## [1.0.3](https://github.com/advertikon/package-maxify-feed-common/compare/v1.0.2...v1.0.3) (2024-02-06)
2
16
 
3
17
 
@@ -9,3 +9,4 @@ export declare enum GoogleAccountStatus {
9
9
  REMOVED = "REMOVED",
10
10
  REJECTED = "REJECTED"
11
11
  }
12
+ //# sourceMappingURL=google.constants.d.ts.map
@@ -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"}
@@ -2,3 +2,4 @@ export declare enum ProductSyncStatus {
2
2
  SYNCING = "syncing",
3
3
  SYNCED = "synced"
4
4
  }
5
+ //# sourceMappingURL=product.constants.d.ts.map
@@ -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"}
@@ -67,3 +67,4 @@ export declare const ProductUploadMappings: ProductUploadMapSource[];
67
67
  export declare const CHANNEL = "online";
68
68
  export declare const GMC_PRODUCT_ID_TEMPLATE = "{PRODUCT_ID}_{VARIANT_ID}";
69
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"}
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 './utils/gmc.js';
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 './utils/gmc.js';
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;AAEzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,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"}
@@ -10,3 +10,21 @@ export type ServerSideProgressEvent = ServerSideEvent & {
10
10
  totalCount: number;
11
11
  };
12
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 ShopifyCollection = {
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: ShopifyCollection[];
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,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EA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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"}
@@ -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,wBA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S,CAAC;IACjB,KAAK,EAAE;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 { RestResources } from '@shopify/shopify-api/rest/admin/2023-07';
2
+ type GetInstanceType<T extends keyof RestResources> = InstanceType<RestResources[T]>;
3
+ type ShopifyRecurringCharge = GetInstanceType<'RecurringApplicationCharge'>;
4
+ type ShopifyShop = GetInstanceType<'Shop'>;
5
+ type ShopifyWebhook = GetInstanceType<'Webhook'>;
6
+ type ShopifyCustomCollection = GetInstanceType<'CustomCollection'>;
7
+ type ShopifySmartCollection = GetInstanceType<'SmartCollection'>;
8
+ type ShopifyCollection = ShopifyCustomCollection | ShopifySmartCollection;
9
+ type ShopifyProductVariant = GetInstanceType<'Variant'> & {
10
+ images: {
11
+ variant_ids?: number[];
12
+ }[];
13
+ };
14
+ type ShopifyProduct = GetInstanceType<'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 { ShopifyShop, ShopifyProduct, ShopifyWebhook, ShopifyCustomCollection, ShopifySmartCollection, ShopifyCollection, 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,aAAa,EAAE,MAAM,yCAAyC,CAAC;AAExE,KAAK,eAAe,CAAC,CAAC,SAAS,MAAM,aAAa,IAAI,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AAErF,KAAK,sBAAsB,GAAG,eAAe,CAAC,4BAA4B,CAAC,CAAC;AAC5E,KAAK,WAAW,GAAG,eAAe,CAAC,M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@ -0,0 +1 @@
1
+ {"version":3,"file":"shopify.types.js","sourceRoot":"","sources":["../../src/types/shopify.types.ts"],"names":[],"mappings":""}
@@ -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"}
@@ -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":"AAEA,MAAM,UAAU,yBAAyB,CAAE,KAAsB;IAC7D,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAE,KAAsB;IAC7D,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AACrC,CAAC"}
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,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAC3D,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAE,IAAmB;IAItD,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACrC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACzD,CAAC"}
@@ -26,3 +26,4 @@ export declare function detectProfileChange(a: ProductUploadProfile, b: ProductU
26
26
  id: boolean;
27
27
  };
28
28
  export declare function sanitizeUploadProfile(profile: ProductUploadProfile): ProductUploadProfile;
29
+ //# sourceMappingURL=profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/utils/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,cAAc,EACd,eAAe,EACf,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACL,2BAA2B,EAE5B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,qBAAqB,EACrB,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,2BAA2B,CAAC;AAGnC,wBAAgB,oBAAoB,CAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,MAAM,EAAE,CAgB9E;AAED,wBAAgB,mBAAmB,CAAE,KAAK,EAAE,qBAAqB,EAAE,GAAG,MAAM,EAAE,CAW7E;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,wBAAwB,EAAE,GACnC,MAAM,EAAE,CA4BV;AA4CD,wBAAgB,gBAAgB,CAC9B,SAAS,GAAE,2BAA2B,CAAC,OAAO,CAAM,GACnD,qBAAqB,CAEvB;AAED,wBAAgB,YAAY,CAC1B,CAAC,EAAE,oBAAoB,EACvB,CAAC,EAAE,oBAAoB,GACtB,MAAM,CAiCR;AAED,wBAAgB,QAAQ,CAAE,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAK5D;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,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"}
@@ -1 +1,2 @@
1
1
  export declare function code(): string;
2
+ //# sourceMappingURL=utils.d.ts.map
@@ -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",
3
+ "version": "1.1.1",
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"
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';
@@ -12,3 +12,22 @@ export type ServerSideProgressEvent = ServerSideEvent & {
12
12
  };
13
13
 
14
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 ShopifyCollection = {
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: ShopifyCollection[];
58
+ collections: AppCollection[];
59
59
  tags: string[];
60
60
  vendor: string;
61
61
  product_type: string;
@@ -0,0 +1,45 @@
1
+ import { RestResources } from '@shopify/shopify-api/rest/admin/2023-07';
2
+
3
+ type GetInstanceType<T extends keyof RestResources> = InstanceType<RestResources[T]>;
4
+
5
+ type ShopifyRecurringCharge = GetInstanceType<'RecurringApplicationCharge'>;
6
+ type ShopifyShop = GetInstanceType<'Shop'>;
7
+ type ShopifyWebhook = GetInstanceType<'Webhook'>;
8
+ type ShopifyCustomCollection = GetInstanceType<'CustomCollection'>;
9
+ type ShopifySmartCollection = GetInstanceType<'SmartCollection'>;
10
+ type ShopifyCollection = ShopifyCustomCollection | ShopifySmartCollection;
11
+ type ShopifyProductVariant = GetInstanceType<'Variant'> & {
12
+ images: { variant_ids?: number[] }[];
13
+ };
14
+ type ShopifyProduct = GetInstanceType<'Product'> & {
15
+ variants: ShopifyProductVariant[];
16
+ };
17
+
18
+ export type WebhookHeader = {
19
+ host: string;
20
+ 'user-agent': string;
21
+ 'content-length': string;
22
+ accept: string;
23
+ 'accept-encoding': string;
24
+ 'content-type': string;
25
+ 'x-forwarded-for': string;
26
+ 'x-forwarded-host': string;
27
+ 'x-forwarded-proto': string;
28
+ 'x-shopify-api-version': string;
29
+ 'x-shopify-hmac-sha256': string;
30
+ 'x-shopify-product-id': string;
31
+ 'x-shopify-shop-domain': string;
32
+ 'x-shopify-topic': string;
33
+ 'x-shopify-triggered-at': string;
34
+ 'x-shopify-webhook-id': string;
35
+ };
36
+
37
+ export {
38
+ ShopifyShop,
39
+ ShopifyProduct,
40
+ ShopifyWebhook,
41
+ ShopifyCustomCollection,
42
+ ShopifySmartCollection,
43
+ ShopifyCollection,
44
+ ShopifyRecurringCharge,
45
+ };
@@ -1,9 +1,40 @@
1
- import { ServerSideEvent, ServerSideProgressEvent, ServerSideScheduleEvent } from '../types/company.types.js';
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 (event: ServerSideEvent): event is ServerSideProgressEvent {
4
- return event.type === 'progress';
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
- }
@@ -1 +0,0 @@
1
- export {};
package/dist/utils/gmc.js DELETED
@@ -1,55 +0,0 @@
1
- // export function isGmcProductId (
2
- // productId: string,
3
- // profileIdTemplate: string
4
- // ): boolean {
5
- // return new RegExp(
6
- // profileIdTemplate
7
- // .replace('{PRODUCT_ID}', '\\d+')
8
- // .replace('{VARIANT_ID}', '\\d+')
9
- // .replace('{COUNTRY}', '\\w+')
10
- // .replace('{LANGUAGE}', '\\w+')
11
- // ).test(productId);
12
- // }
13
- export {};
14
- // export function GMCProductIdToShopify (productId: string, profileIdTemplate: string): number {
15
- // const [, , , id] = productId.split(':');
16
- // return Number(getProductIdFromGmcId(id, profileIdTemplate));
17
- // }
18
- // export function GmcIdParts (gmcProductId: string, profileIdTemplate: string): {
19
- // channel: string;
20
- // locale: string;
21
- // country: string;
22
- // idPart: string;
23
- // shopifyId: number;
24
- // shopifyVariantId: number;
25
- // } {
26
- // const [channel, locale, country, idPart] = gmcProductId.split(':');
27
- // if (!channel || !locale || !country || !idPart) {
28
- // throw new Error(`${gmcProductId} is not a valid GMC product id`);
29
- // }
30
- // return {
31
- // channel,
32
- // locale,
33
- // country,
34
- // idPart,
35
- // ...getShopifyIdsFromGmcIdPart(idPart, profileIdTemplate),
36
- // };
37
- // }
38
- // export function getShopifyIdsFromGmcIdPart (gmcId: string, profileIdTemplate: string): {
39
- // shopifyId: number;
40
- // shopifyVariantId: number;
41
- // } {
42
- // if (!isGmcProductId(gmcId, profileIdTemplate)) {
43
- // throw new Error(`${gmcId} is not a valid GMC product id part`);
44
- // }
45
- // const [productId, variantId] = gmcId.split('_');
46
- // return { shopifyId: Number(productId), shopifyVariantId: Number(variantId) };
47
- // }
48
- // export function getProductIdFromGmcId (gmcId: string, profileIdTemplate: string): number {
49
- // if (!isGmcProductId(gmcId, profileIdTemplate)) {
50
- // throw new Error(`${gmcId} is not a valid GMC product id part`);
51
- // }
52
- // const [productId] = gmcId.split('_');
53
- // return Number(productId);
54
- // }
55
- //# sourceMappingURL=gmc.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gmc.js","sourceRoot":"","sources":["../../src/utils/gmc.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,uBAAuB;AACvB,8BAA8B;AAC9B,eAAe;AACf,uBAAuB;AACvB,wBAAwB;AACxB,yCAAyC;AACzC,yCAAyC;AACzC,sCAAsC;AACtC,uCAAuC;AACvC,uBAAuB;AACvB,IAAI;;AAEJ,iGAAiG;AACjG,6CAA6C;AAC7C,iEAAiE;AACjE,IAAI;AAEJ,kFAAkF;AAClF,qBAAqB;AACrB,oBAAoB;AACpB,qBAAqB;AACrB,oBAAoB;AACpB,uBAAuB;AACvB,8BAA8B;AAC9B,MAAM;AACN,wEAAwE;AAExE,sDAAsD;AACtD,wEAAwE;AACxE,MAAM;AAEN,aAAa;AACb,eAAe;AACf,cAAc;AACd,eAAe;AACf,cAAc;AACd,gEAAgE;AAChE,OAAO;AACP,IAAI;AAEJ,2FAA2F;AAC3F,uBAAuB;AACvB,8BAA8B;AAC9B,MAAM;AACN,qDAAqD;AACrD,sEAAsE;AACtE,MAAM;AAEN,qDAAqD;AACrD,kFAAkF;AAClF,IAAI;AAEJ,6FAA6F;AAC7F,qDAAqD;AACrD,sEAAsE;AACtE,MAAM;AAEN,0CAA0C;AAC1C,8BAA8B;AAC9B,IAAI"}
package/src/utils/gmc.ts DELETED
@@ -1,61 +0,0 @@
1
- // export function isGmcProductId (
2
- // productId: string,
3
- // profileIdTemplate: string
4
- // ): boolean {
5
- // return new RegExp(
6
- // profileIdTemplate
7
- // .replace('{PRODUCT_ID}', '\\d+')
8
- // .replace('{VARIANT_ID}', '\\d+')
9
- // .replace('{COUNTRY}', '\\w+')
10
- // .replace('{LANGUAGE}', '\\w+')
11
- // ).test(productId);
12
- // }
13
-
14
- // export function GMCProductIdToShopify (productId: string, profileIdTemplate: string): number {
15
- // const [, , , id] = productId.split(':');
16
- // return Number(getProductIdFromGmcId(id, profileIdTemplate));
17
- // }
18
-
19
- // export function GmcIdParts (gmcProductId: string, profileIdTemplate: string): {
20
- // channel: string;
21
- // locale: string;
22
- // country: string;
23
- // idPart: string;
24
- // shopifyId: number;
25
- // shopifyVariantId: number;
26
- // } {
27
- // const [channel, locale, country, idPart] = gmcProductId.split(':');
28
-
29
- // if (!channel || !locale || !country || !idPart) {
30
- // throw new Error(`${gmcProductId} is not a valid GMC product id`);
31
- // }
32
-
33
- // return {
34
- // channel,
35
- // locale,
36
- // country,
37
- // idPart,
38
- // ...getShopifyIdsFromGmcIdPart(idPart, profileIdTemplate),
39
- // };
40
- // }
41
-
42
- // export function getShopifyIdsFromGmcIdPart (gmcId: string, profileIdTemplate: string): {
43
- // shopifyId: number;
44
- // shopifyVariantId: number;
45
- // } {
46
- // if (!isGmcProductId(gmcId, profileIdTemplate)) {
47
- // throw new Error(`${gmcId} is not a valid GMC product id part`);
48
- // }
49
-
50
- // const [productId, variantId] = gmcId.split('_');
51
- // return { shopifyId: Number(productId), shopifyVariantId: Number(variantId) };
52
- // }
53
-
54
- // export function getProductIdFromGmcId (gmcId: string, profileIdTemplate: string): number {
55
- // if (!isGmcProductId(gmcId, profileIdTemplate)) {
56
- // throw new Error(`${gmcId} is not a valid GMC product id part`);
57
- // }
58
-
59
- // const [productId] = gmcId.split('_');
60
- // return Number(productId);
61
- // }