feed-common 1.1.0 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +14 -0
- package/dist/types/company.types.d.ts +7 -1
- package/dist/types/company.types.d.ts.map +1 -1
- package/dist/types/shopify.types.d.ts +11 -11
- package/dist/types/shopify.types.d.ts.map +1 -1
- package/dist/types/shopify.types.js +1 -6
- package/dist/types/shopify.types.js.map +1 -1
- package/dist/utils/company.js +1 -1
- package/dist/utils/company.js.map +1 -1
- package/package.json +1 -1
- package/src/types/company.types.ts +5 -1
- package/src/types/shopify.types.ts +38 -33
- package/src/utils/company.ts +1 -1
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
## [1.1.2](https://github.com/advertikon/package-maxify-feed-common/compare/v1.1.1...v1.1.2) (2024-02-16)
|
2
|
+
|
3
|
+
|
4
|
+
### Bug Fixes
|
5
|
+
|
6
|
+
* add company stuff ([4bc7e37](https://github.com/advertikon/package-maxify-feed-common/commit/4bc7e37368afce41b988b90db52b0e9d8576cf3c))
|
7
|
+
|
8
|
+
## [1.1.1](https://github.com/advertikon/package-maxify-feed-common/compare/v1.1.0...v1.1.1) (2024-02-12)
|
9
|
+
|
10
|
+
|
11
|
+
### Bug Fixes
|
12
|
+
|
13
|
+
* fix shopify types ([0482e82](https://github.com/advertikon/package-maxify-feed-common/commit/0482e82a5b02eb7cfa4f7b16abce1fb95e4210c5))
|
14
|
+
|
1
15
|
# [1.1.0](https://github.com/advertikon/package-maxify-feed-common/compare/v1.0.3...v1.1.0) (2024-02-11)
|
2
16
|
|
3
17
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
export type ServerSideEvent = {
|
2
2
|
shop: string;
|
3
3
|
eventID: string;
|
4
|
-
type:
|
4
|
+
type: 'progress' | 'schedule';
|
5
5
|
name: string;
|
6
6
|
status?: boolean;
|
7
7
|
};
|
@@ -12,6 +12,8 @@ export type ServerSideProgressEvent = ServerSideEvent & {
|
|
12
12
|
export type ServerSideScheduleEvent = ServerSideEvent;
|
13
13
|
export type CompanyStats = {
|
14
14
|
totalProductsCount: number;
|
15
|
+
syncedProductsCount: number;
|
16
|
+
limits: AppLimits;
|
15
17
|
profilesStats: {
|
16
18
|
count: number;
|
17
19
|
errors: number;
|
@@ -27,4 +29,8 @@ export type SubscriptionPlan = {
|
|
27
29
|
profiles: number;
|
28
30
|
price: number;
|
29
31
|
};
|
32
|
+
export type AppLimits = {
|
33
|
+
products: number;
|
34
|
+
profiles: number;
|
35
|
+
};
|
30
36
|
//# sourceMappingURL=company.types.d.ts.map
|
@@ -1 +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"}
|
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,mBAAmB,EAAE,MAAM,CAAC;IAC5B,MAAM,EAAE,SAAS,CAAC;IAClB,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;AAEF,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAA"}
|
@@ -1,17 +1,17 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
type ShopifyCollection =
|
9
|
-
type ShopifyProductVariant = Variant & {
|
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
10
|
images: {
|
11
11
|
variant_ids?: number[];
|
12
12
|
}[];
|
13
13
|
};
|
14
|
-
type ShopifyProduct = Product & {
|
14
|
+
type ShopifyProduct = GetInstanceType<'Product'> & {
|
15
15
|
variants: ShopifyProductVariant[];
|
16
16
|
};
|
17
17
|
export type WebhookHeader = {
|
@@ -32,5 +32,5 @@ export type WebhookHeader = {
|
|
32
32
|
'x-shopify-triggered-at': string;
|
33
33
|
'x-shopify-webhook-id': string;
|
34
34
|
};
|
35
|
-
export {
|
35
|
+
export { ShopifyShop, ShopifyProduct, ShopifyWebhook, ShopifyCustomCollection, ShopifySmartCollection, ShopifyCollection, ShopifyRecurringCharge, };
|
36
36
|
//# sourceMappingURL=shopify.types.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"shopify.types.d.ts","sourceRoot":"","sources":["../../src/types/shopify.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
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,C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,cAAc,EACd,uBAAuB,EACvB,sBAAsB,EACtB,iBAAiB,EACjB,sBAAsB,GACvB,CAAC"}
|
@@ -1,7 +1,2 @@
|
|
1
|
-
|
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, };
|
1
|
+
export {};
|
7
2
|
//# sourceMappingURL=shopify.types.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"shopify.types.js","sourceRoot":"","sources":["../../src/types/shopify.types.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"shopify.types.js","sourceRoot":"","sources":["../../src/types/shopify.types.ts"],"names":[],"mappings":""}
|
package/dist/utils/company.js
CHANGED
@@ -8,7 +8,7 @@ export function makeSubscriptionCode(plan) {
|
|
8
8
|
return `${plan.code}${plan.level}`;
|
9
9
|
}
|
10
10
|
export function makeSubscriptionName(plan) {
|
11
|
-
return
|
11
|
+
return makeSubscriptionCode(plan);
|
12
12
|
}
|
13
13
|
export function extractSubscriptionCode(subscription) {
|
14
14
|
return subscription.name?.match(/^G\d+/i)?.[0] ?? null;
|
@@ -1 +1 @@
|
|
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,
|
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,oBAAoB,CAAC,IAAI,CAAC,CAAC;AACtC,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"}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
export type ServerSideEvent = {
|
2
2
|
shop: string;
|
3
3
|
eventID: string;
|
4
|
-
type:
|
4
|
+
type: 'progress' | 'schedule';
|
5
5
|
name: string;
|
6
6
|
status?: boolean;
|
7
7
|
};
|
@@ -15,6 +15,8 @@ export type ServerSideScheduleEvent = ServerSideEvent;
|
|
15
15
|
|
16
16
|
export type CompanyStats = {
|
17
17
|
totalProductsCount: number;
|
18
|
+
syncedProductsCount: number;
|
19
|
+
limits: AppLimits;
|
18
20
|
profilesStats: {
|
19
21
|
count: number;
|
20
22
|
errors: number;
|
@@ -31,3 +33,5 @@ export type SubscriptionPlan = {
|
|
31
33
|
profiles: number;
|
32
34
|
price: number;
|
33
35
|
};
|
36
|
+
|
37
|
+
export type AppLimits = { products: number; profiles: number }
|
@@ -1,40 +1,45 @@
|
|
1
|
-
import {
|
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';
|
1
|
+
import { RestResources } from '@shopify/shopify-api/rest/admin/2023-07';
|
8
2
|
|
9
|
-
type
|
10
|
-
|
11
|
-
type
|
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
|
+
};
|
12
17
|
|
13
18
|
export type WebhookHeader = {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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;
|
30
35
|
};
|
31
36
|
|
32
37
|
export {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
ShopifyShop,
|
39
|
+
ShopifyProduct,
|
40
|
+
ShopifyWebhook,
|
41
|
+
ShopifyCustomCollection,
|
42
|
+
ShopifySmartCollection,
|
43
|
+
ShopifyCollection,
|
44
|
+
ShopifyRecurringCharge,
|
40
45
|
};
|
package/src/utils/company.ts
CHANGED
@@ -23,7 +23,7 @@ export function makeSubscriptionCode (plan: SubscriptionPlan) {
|
|
23
23
|
}
|
24
24
|
|
25
25
|
export function makeSubscriptionName (plan: SubscriptionPlan) {
|
26
|
-
return
|
26
|
+
return makeSubscriptionCode(plan);
|
27
27
|
}
|
28
28
|
|
29
29
|
export function extractSubscriptionCode (subscription: ShopifyRecurringCharge) {
|