feed-common 1.43.1 → 1.45.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/profile.constants.d.ts +2 -1
- package/dist/constants/profile.constants.d.ts.map +1 -1
- package/dist/constants/profile.constants.js +7 -5
- package/dist/constants/profile.constants.js.map +1 -1
- package/dist/types/company.types.d.ts +11 -0
- package/dist/types/company.types.d.ts.map +1 -1
- package/dist/utils/company.d.ts +12 -5
- package/dist/utils/company.d.ts.map +1 -1
- package/dist/utils/company.js.map +1 -1
- package/dist/utils/feed-templates/index.d.ts.map +1 -1
- package/dist/utils/feed-templates/index.js +3 -0
- package/dist/utils/feed-templates/index.js.map +1 -1
- package/dist/utils/feed-templates/microsoft.template.d.ts +3 -0
- package/dist/utils/feed-templates/microsoft.template.d.ts.map +1 -0
- package/dist/utils/feed-templates/microsoft.template.js +561 -0
- package/dist/utils/feed-templates/microsoft.template.js.map +1 -0
- package/package.json +1 -1
- package/src/constants/profile.constants.ts +7 -5
- package/src/types/company.types.ts +12 -0
- package/src/utils/company.ts +10 -21
- package/src/utils/feed-templates/index.ts +3 -0
- package/src/utils/feed-templates/microsoft.template.ts +630 -0
package/src/utils/company.ts
CHANGED
@@ -1,40 +1,29 @@
|
|
1
|
-
import {
|
2
|
-
ServerSideEvent,
|
3
|
-
ServerSideProgressEvent,
|
4
|
-
ServerSideScheduleEvent,
|
5
|
-
SubscriptionPlan,
|
6
|
-
} from '../types/company.types.js';
|
7
|
-
import { ShopifyRecurringCharge } from '../types/shopify.types.js';
|
1
|
+
import { ServerSideEvent, ServerSideProgressEvent, ServerSideScheduleEvent } from '../types/company.types.js';
|
8
2
|
|
9
|
-
export function isServerSideProgressEvent
|
10
|
-
|
11
|
-
): event is ServerSideProgressEvent {
|
12
|
-
return event.type === 'progress';
|
3
|
+
export function isServerSideProgressEvent(event: ServerSideEvent): event is ServerSideProgressEvent {
|
4
|
+
return event.type === 'progress';
|
13
5
|
}
|
14
6
|
|
15
|
-
export function isServerSideScheduleEvent
|
16
|
-
|
17
|
-
): event is ServerSideScheduleEvent {
|
18
|
-
return event.type === 'schedule';
|
7
|
+
export function isServerSideScheduleEvent(event: ServerSideEvent): event is ServerSideScheduleEvent {
|
8
|
+
return event.type === 'schedule';
|
19
9
|
}
|
20
10
|
|
21
|
-
export function makeSubscriptionCode
|
22
|
-
|
11
|
+
export function makeSubscriptionCode(plan: { code: string; level: number }) {
|
12
|
+
return `${plan.code}${plan.level}`;
|
23
13
|
}
|
24
14
|
|
25
|
-
export function makeSubscriptionName
|
15
|
+
export function makeSubscriptionName(plan: { code: string; level: number }) {
|
26
16
|
return makeSubscriptionCode(plan);
|
27
17
|
}
|
28
18
|
|
29
|
-
export function extractSubscriptionCode
|
19
|
+
export function extractSubscriptionCode(subscription: { name: string | null }): string | null {
|
30
20
|
return subscription.name?.match(/^G\d+/i)?.[0] ?? null;
|
31
21
|
}
|
32
22
|
|
33
|
-
export function parseSubscriptionName
|
23
|
+
export function parseSubscriptionName(name: string | null): {
|
34
24
|
code: string | null;
|
35
25
|
level: string | null;
|
36
26
|
} {
|
37
27
|
const match = name?.match(/^G(\d+)/);
|
38
28
|
return { code: 'G', level: match ? match[1] : null };
|
39
29
|
}
|
40
|
-
|
@@ -6,6 +6,7 @@ import { facebookFeedTemplate } from './facebook.template.js';
|
|
6
6
|
import { XmlFeedTemplateType } from '../../types/profile.types.js';
|
7
7
|
import { googleFeedTemplate } from './google.template.js';
|
8
8
|
import { tiktokFeedTemplate } from './tiktok.template.js';
|
9
|
+
import { microsoftTemplate } from './microsoft.template.js';
|
9
10
|
|
10
11
|
export const hasMacro = (v: string) => /{{[^}]+}}/.test(v);
|
11
12
|
export const removeMacro = (v: string) => v.replaceAll(/{{[^}]+}}/g, '');
|
@@ -88,6 +89,8 @@ export function getTemplate(type: XMLFeedType): XmlFeedTemplateType {
|
|
88
89
|
return googleFeedTemplate;
|
89
90
|
case XMLFeedType.TikTok:
|
90
91
|
return tiktokFeedTemplate;
|
92
|
+
case XMLFeedType.Microsoft:
|
93
|
+
return microsoftTemplate;
|
91
94
|
default:
|
92
95
|
throw new Error(`Invalid feed type: ${type}`);
|
93
96
|
}
|