feed-common 1.64.0 → 1.65.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/constants/profile.constants.d.ts +5 -0
  3. package/dist/constants/profile.constants.d.ts.map +1 -1
  4. package/dist/constants/profile.constants.js +35 -0
  5. package/dist/constants/profile.constants.js.map +1 -1
  6. package/dist/index.d.ts +3 -0
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +3 -0
  9. package/dist/index.js.map +1 -1
  10. package/dist/sources/fb-age-group.source.d.ts +5 -0
  11. package/dist/sources/fb-age-group.source.d.ts.map +1 -0
  12. package/dist/sources/fb-age-group.source.js +10 -0
  13. package/dist/sources/fb-age-group.source.js.map +1 -0
  14. package/dist/sources/fb-category.source.d.ts +5 -0
  15. package/dist/sources/fb-category.source.d.ts.map +1 -0
  16. package/dist/sources/fb-category.source.js +2980 -0
  17. package/dist/sources/fb-category.source.js.map +1 -0
  18. package/dist/sources/ms-availability.source.d.ts +5 -0
  19. package/dist/sources/ms-availability.source.d.ts.map +1 -0
  20. package/dist/sources/ms-availability.source.js +8 -0
  21. package/dist/sources/ms-availability.source.js.map +1 -0
  22. package/dist/utils/feed-templates/facebook.template.d.ts.map +1 -1
  23. package/dist/utils/feed-templates/facebook.template.js +29 -21
  24. package/dist/utils/feed-templates/facebook.template.js.map +1 -1
  25. package/dist/utils/feed-templates/microsoft.template.d.ts.map +1 -1
  26. package/dist/utils/feed-templates/microsoft.template.js +6 -3
  27. package/dist/utils/feed-templates/microsoft.template.js.map +1 -1
  28. package/package.json +1 -1
  29. package/src/constants/profile.constants.ts +35 -0
  30. package/src/index.ts +3 -0
  31. package/src/sources/fb-age-group.source.ts +9 -0
  32. package/src/sources/fb-category.source.ts +2979 -0
  33. package/src/sources/ms-availability.source.ts +7 -0
  34. package/src/utils/feed-templates/facebook.template.ts +29 -22
  35. package/src/utils/feed-templates/microsoft.template.ts +7 -4
@@ -0,0 +1,7 @@
1
+ export const MsAvailabilitySource = [
2
+ { label: 'In Stock', value: 'in stock' },
3
+ { label: 'Available for order', value: 'available for order' },
4
+ { label: 'Pre-order', value: 'pre order' },
5
+ { label: 'Out of Stock', value: 'out of stock' },
6
+ { label: 'Discontinued', value: 'discontinued' }
7
+ ];
@@ -17,17 +17,8 @@ const availabilityMapping = {
17
17
  validator: (v: string | number) => validateIfNoMacro(v, z.enum(['in stock', 'out of stock'])),
18
18
  baseMode: true,
19
19
  defaultValue: '',
20
- };
21
-
22
- const conditionMapping = {
23
- attribute: 'condition',
24
- label: 'Condition',
25
- description: 'The condition of the item. Supported values: new, refurbished, used. Example: new',
26
- required: true,
27
- type: 'macro-input' as any,
28
- validator: (v: string | number) => validateIfNoMacro(v, z.enum(['new', 'refurbished', 'used'])),
29
- baseMode: true,
30
- defaultValue: '',
20
+ singleChoice: true,
21
+ fixedValue: true,
31
22
  };
32
23
 
33
24
  const videoMapping = {
@@ -146,11 +137,17 @@ export const facebookFeedTemplate: XmlFeedTemplateType = {
146
137
  },
147
138
  },
148
139
  {
149
- ...conditionMapping,
150
- defaultValue: 'new',
151
- rules: {
152
- sections: [],
153
- },
140
+ attribute: 'condition',
141
+ label: 'Condition',
142
+ description: 'The condition of the item. Supported values: new, refurbished, used. Example: new',
143
+ required: true,
144
+ type: 'macro-input' as any,
145
+ validator: (v: string | number) => validateIfNoMacro(v, z.enum(['new', 'refurbished', 'used'])),
146
+ baseMode: true,
147
+ defaultValue: '{{source.google_condition:}}',
148
+ rules: { sections: [] },
149
+ singleChoice: true,
150
+ fixedValue: true,
154
151
  },
155
152
  {
156
153
  attribute: 'price',
@@ -238,9 +235,10 @@ export const facebookFeedTemplate: XmlFeedTemplateType = {
238
235
  "The date, time and time zone when your sale starts and ends. If you don't add this field, any items with a sale_price remain on sale until you remove their sale price. Use this format: YYYY-MM-DDT23:59+00:00/YYYY-MM-DDT23:59+00:00. Example (using PST time zone -08:00): 2020-04-30T09:30-08:00/2020-05-30T23:59-08:00",
239
236
  required: false,
240
237
  type: 'macro-input',
241
- defaultValue: '',
238
+ defaultValue: '{{source.date_range:}}',
242
239
  validator: (v: string | number) => validateIfNoMacro(v, dateRangeSchema),
243
240
  rules: { sections: [] },
241
+ fixedValue: true,
244
242
  },
245
243
  {
246
244
  attribute: 'item_group_id',
@@ -301,8 +299,10 @@ export const facebookFeedTemplate: XmlFeedTemplateType = {
301
299
  'The category of the item according to the Google product taxonomy. Example: Apparel & Accessories > Clothing > Shirts & Tops or 212',
302
300
  required: false,
303
301
  type: 'macro-input',
304
- defaultValue: '',
302
+ defaultValue: '{{source.google_category:}}',
305
303
  rules: { sections: [] },
304
+ fixedValue: true,
305
+ singleChoice: true,
306
306
  },
307
307
  {
308
308
  attribute: 'fb_product_category',
@@ -311,7 +311,9 @@ export const facebookFeedTemplate: XmlFeedTemplateType = {
311
311
  "The category of the item according to Facebook's product taxonomy. Example: Clothing & Accessories > Clothing > Women's Clothing > Tops & T-Shirts or 430",
312
312
  required: false,
313
313
  type: 'macro-input',
314
- defaultValue: '',
314
+ defaultValue: '{{source.fb_category:}}',
315
+ fixedValue: true,
316
+ singleChoice: true,
315
317
  rules: { sections: [] },
316
318
  },
317
319
  {
@@ -332,7 +334,9 @@ export const facebookFeedTemplate: XmlFeedTemplateType = {
332
334
  'The gender your item is targeted towards. Supported values: female, male, unisex. Example: female',
333
335
  required: false,
334
336
  type: 'macro-input',
335
- defaultValue: '',
337
+ defaultValue: '{{source.google_gender:}}',
338
+ singleChoice: true,
339
+ fixedValue: true,
336
340
  rules: { sections: [] },
337
341
  validator: v => validate(v, z.enum(['female', 'male', 'unisex', '']).optional()),
338
342
  },
@@ -343,7 +347,9 @@ export const facebookFeedTemplate: XmlFeedTemplateType = {
343
347
  'The age group that the item is targeted towards. Supported values: adult, all ages, teen, kids, toddler, infant, newborn. Example: adult',
344
348
  required: false,
345
349
  type: 'macro-input',
346
- defaultValue: '',
350
+ defaultValue: '{{source.fb_age_group:}}',
351
+ singleChoice: true,
352
+ fixedValue: true,
347
353
  rules: { sections: [] },
348
354
  validator: v =>
349
355
  validate(
@@ -405,8 +411,9 @@ export const facebookFeedTemplate: XmlFeedTemplateType = {
405
411
  'This field enables you to add the "free shipping" overlay in Advantage+ catalog ads. Enter shipping details for the item formatted as Country:Region:Service:Price Example: US:NY:Ground:9.99 USD, PH::Air:300 PHP',
406
412
  required: false,
407
413
  type: 'macro-input',
408
- defaultValue: '',
414
+ defaultValue: '{{source.fb_shipping:}}',
409
415
  rules: { sections: [] },
416
+ fixedValue: true,
410
417
  },
411
418
  {
412
419
  attribute: 'shipping_weight',
@@ -5,7 +5,7 @@ import { z } from 'zod';
5
5
  import { ulid } from 'ulid';
6
6
  import { ProductUploadMapSource, XmlFeedTemplateType } from '../../types/profile.types.js';
7
7
 
8
- const availabilityMapping = {
8
+ const availabilityMapping: ProductUploadMapSource = {
9
9
  attribute: 'availability',
10
10
  label: 'Availability',
11
11
  description:
@@ -15,7 +15,10 @@ const availabilityMapping = {
15
15
  validator: (v: string | number) =>
16
16
  validateIfNoMacro(v, z.enum(['in stock', 'available for order', 'preorder', 'out of stock', 'discontinued'])),
17
17
  baseMode: true,
18
- defaultValue: '',
18
+ defaultValue: '{{source.ms_availability:}}',
19
+ fixedValue: true,
20
+ singleChoice: true,
21
+ rules: { sections: [] },
19
22
  };
20
23
 
21
24
  const customLabelMapping: ProductUploadMapSource = {
@@ -333,12 +336,12 @@ export const microsoftTemplate: XmlFeedTemplateType = {
333
336
  },
334
337
  {
335
338
  ...availabilityMapping,
336
- defaultValue: 'in stock',
339
+ defaultValue: '{{source.ms_availability:[{"value": "in stock", "label": "In Stock"}]}}',
337
340
  rules: { sections: [] },
338
341
  },
339
342
  {
340
343
  ...availabilityMapping,
341
- defaultValue: 'out of stock',
344
+ defaultValue: '{{source.ms_availability:[{"value": "out of stock", "label": "Out of Stock"}]}}',
342
345
  rules: {
343
346
  sections: [
344
347
  {