@gofynd/fdk-client-javascript 2.0.0 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -237,7 +237,7 @@ console.log("Active Theme: ", response.information.name);
237
237
  The above code will log the curl command in the console
238
238
 
239
239
  ```bash
240
- curl --request GET "https://api.fynd.com/service/application/theme/v1.0/applied-theme" --header 'authorization: Bearer <authorization-token>' --header 'x-fp-sdk-version: 2.0.0' --header 'x-fp-date: 20230222T115108Z' --header 'x-fp-signature: v1.1:1e3ab3b02b5bc626e3c32a37ee844266ade02bbcbaafc28fc7a0e46a76a7a1a8'
240
+ curl --request GET "https://api.fynd.com/service/application/theme/v1.0/applied-theme" --header 'authorization: Bearer <authorization-token>' --header 'x-fp-sdk-version: v2.0.2' --header 'x-fp-date: 20230222T115108Z' --header 'x-fp-signature: v1.1:1e3ab3b02b5bc626e3c32a37ee844266ade02bbcbaafc28fc7a0e46a76a7a1a8'
241
241
  Active Theme: Emerge
242
242
  ```
243
243
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gofynd/fdk-client-javascript",
3
- "version": "2.0.0",
3
+ "version": "v2.0.2",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -5,9 +5,12 @@ function convertUrlToAction(url) {
5
5
  if (url) {
6
6
  const path = utils.trimChar(url);
7
7
  const query = utils.getQuery(path);
8
- const pathname = utils.validURL(path)
9
- ? new URL(path).pathname
10
- : path.split("?")[0];
8
+ let pathname;
9
+ try {
10
+ pathname = new URL(path).pathname;
11
+ } catch (e) {
12
+ pathname = path.split("?")[0];
13
+ }
11
14
  const allNavigations = Object.assign({}, Constant.NAVIGATORS);
12
15
  const typeLink = {};
13
16
  for (nav in allNavigations) {
@@ -7,7 +7,6 @@ export function findBestMatchingLink(allLinks?: any[], pathname?: string): {
7
7
  value: string;
8
8
  params: {};
9
9
  };
10
- export function validURL(str: any): boolean;
11
10
  export function convertStringToBase64(string: any): string;
12
11
  export function isBrowser(): boolean;
13
12
  export function isNode(): boolean;
@@ -94,19 +94,6 @@ const trimChar = (string = "", charToRemove = "/") => {
94
94
  return string;
95
95
  };
96
96
 
97
- function validURL(str) {
98
- var pattern = new RegExp(
99
- "^(https?:\\/\\/)?" + // protocol
100
- "((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|" + // domain name
101
- "((\\d{1,3}\\.){3}\\d{1,3}))" + // OR ip (v4) address
102
- "(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*" + // port and path
103
- "(\\?[;&a-z\\d%_.~+=-]*)?" + // query string
104
- "(\\#[-a-z\\d_]*)?$",
105
- "i"
106
- ); // fragment locator
107
- return !!pattern.test(str);
108
- }
109
-
110
97
  const findBestMatchingLink = (allLinks = [], pathname = "/") => {
111
98
  let bestMatch = { value: "", params: {} };
112
99
  pathname = trimChar(pathname); // -> product/test-product-tag/reviews
@@ -221,7 +208,6 @@ module.exports = {
221
208
  trimChar,
222
209
  generateUrlWithParams,
223
210
  findBestMatchingLink,
224
- validURL,
225
211
  convertStringToBase64,
226
212
  isBrowser,
227
213
  isNode,
@@ -309,6 +309,8 @@ export = LogisticsPartnerModel;
309
309
  * @property {string} status - Current status of the result item.
310
310
  * @property {number} [total] - Total number of records processed.
311
311
  * @property {string} [error_file_path] - Path to the file containing error details.
312
+ * @property {string} [modified_on] - The timestamp when the record last modified.
313
+ * @property {string} [created_on] - The timestamp when the record was created.
312
314
  */
313
315
  /**
314
316
  * @typedef BulkRegionResult
@@ -1360,6 +1362,14 @@ type BulkRegionResultItemData = {
1360
1362
  * - Path to the file containing error details.
1361
1363
  */
1362
1364
  error_file_path?: string;
1365
+ /**
1366
+ * - The timestamp when the record last modified.
1367
+ */
1368
+ modified_on?: string;
1369
+ /**
1370
+ * - The timestamp when the record was created.
1371
+ */
1372
+ created_on?: string;
1363
1373
  };
1364
1374
  /** @returns {BulkRegionResult} */
1365
1375
  declare function BulkRegionResult(): BulkRegionResult;
@@ -326,6 +326,8 @@ const Joi = require("joi");
326
326
  * @property {string} status - Current status of the result item.
327
327
  * @property {number} [total] - Total number of records processed.
328
328
  * @property {string} [error_file_path] - Path to the file containing error details.
329
+ * @property {string} [modified_on] - The timestamp when the record last modified.
330
+ * @property {string} [created_on] - The timestamp when the record was created.
329
331
  */
330
332
 
331
333
  /**
@@ -910,6 +912,8 @@ class LogisticsPartnerModel {
910
912
  status: Joi.string().allow("").required(),
911
913
  total: Joi.number(),
912
914
  error_file_path: Joi.string().allow(""),
915
+ modified_on: Joi.string().allow(""),
916
+ created_on: Joi.string().allow(""),
913
917
  });
914
918
  }
915
919
 
@@ -26,13 +26,13 @@ class LogisticsValidator {
26
26
 
27
27
  static getBulkTat() {
28
28
  return Joi.object({
29
- extensionId: Joi.string().allow("").required(),
29
+ extensionId: Joi.string().allow("").allow(null).required(),
30
30
  schemeId: Joi.string().allow("").required(),
31
31
  pageNo: Joi.number(),
32
32
  pageSize: Joi.number(),
33
33
  batchId: Joi.string().allow(""),
34
34
  action: Joi.string().allow(""),
35
- status: Joi.string().allow(""),
35
+ status: Joi.string().allow("").allow(null),
36
36
  country: Joi.string().allow(""),
37
37
  region: Joi.string().allow(""),
38
38
  startDate: Joi.string().allow(""),
@@ -170,7 +170,7 @@ class LogisticsValidator {
170
170
  pageSize: Joi.number(),
171
171
  batchId: Joi.string().allow(""),
172
172
  action: Joi.string().allow(""),
173
- status: Joi.string().allow(""),
173
+ status: Joi.string().allow("").allow(null),
174
174
  country: Joi.string().allow(""),
175
175
  region: Joi.string().allow(""),
176
176
  startDate: Joi.string().allow(""),
@@ -1002,6 +1002,8 @@ export = CartPlatformModel;
1002
1002
  * @property {string} [promotion_name] - Promotion name of current promotion
1003
1003
  * @property {BuyRules[]} [buy_rules] - Buy rules for promotions
1004
1004
  * @property {string} [offer_text] - Offer text of current promotion
1005
+ * @property {string} [offer_label] - Offer label of the applied promotion, to
1006
+ * be used as display text.
1005
1007
  * @property {number} [amount] - Per unit discount amount applied with current promotion
1006
1008
  * @property {string} [float_amount] - Per unit discount amount with decimal
1007
1009
  * values applied with current promotion.
@@ -4768,6 +4770,11 @@ type AppliedPromotion = {
4768
4770
  * - Offer text of current promotion
4769
4771
  */
4770
4772
  offer_text?: string;
4773
+ /**
4774
+ * - Offer label of the applied promotion, to
4775
+ * be used as display text.
4776
+ */
4777
+ offer_label?: string;
4771
4778
  /**
4772
4779
  * - Per unit discount amount applied with current promotion
4773
4780
  */
@@ -1098,6 +1098,8 @@ const Joi = require("joi");
1098
1098
  * @property {string} [promotion_name] - Promotion name of current promotion
1099
1099
  * @property {BuyRules[]} [buy_rules] - Buy rules for promotions
1100
1100
  * @property {string} [offer_text] - Offer text of current promotion
1101
+ * @property {string} [offer_label] - Offer label of the applied promotion, to
1102
+ * be used as display text.
1101
1103
  * @property {number} [amount] - Per unit discount amount applied with current promotion
1102
1104
  * @property {string} [float_amount] - Per unit discount amount with decimal
1103
1105
  * values applied with current promotion.
@@ -3671,6 +3673,7 @@ class CartPlatformModel {
3671
3673
  promotion_name: Joi.string().allow(""),
3672
3674
  buy_rules: Joi.array().items(CartPlatformModel.BuyRules()),
3673
3675
  offer_text: Joi.string().allow(""),
3676
+ offer_label: Joi.string().allow(""),
3674
3677
  amount: Joi.number(),
3675
3678
  float_amount: Joi.string().allow(""),
3676
3679
  promotion_type: Joi.string().allow(""),
@@ -463,6 +463,8 @@ export = ServiceabilityPlatformModel;
463
463
  * @property {string} status - Current status of the result item.
464
464
  * @property {number} [total] - Total number of records processed.
465
465
  * @property {string} [error_file_path] - Path to the file containing error details.
466
+ * @property {string} [modified_on] - The timestamp when the record last modified.
467
+ * @property {string} [created_on] - The timestamp when the record was created.
466
468
  */
467
469
  /**
468
470
  * @typedef BulkRegionResult
@@ -1591,7 +1593,7 @@ export = ServiceabilityPlatformModel;
1591
1593
  */
1592
1594
  /**
1593
1595
  * @typedef CustomerRadiusSchema
1594
- * @property {string} unit - The unit of measurement for the radius (e.g.,
1596
+ * @property {string} [unit] - The unit of measurement for the radius (e.g.,
1595
1597
  * kilometers, miles).
1596
1598
  * @property {number} [lt] - The less-than comparison value for the radius.
1597
1599
  * @property {number} [lte] - The less-than-or-equal comparison value for the radius.
@@ -3182,6 +3184,14 @@ type BulkRegionResultItemData = {
3182
3184
  * - Path to the file containing error details.
3183
3185
  */
3184
3186
  error_file_path?: string;
3187
+ /**
3188
+ * - The timestamp when the record last modified.
3189
+ */
3190
+ modified_on?: string;
3191
+ /**
3192
+ * - The timestamp when the record was created.
3193
+ */
3194
+ created_on?: string;
3185
3195
  };
3186
3196
  /** @returns {BulkRegionResult} */
3187
3197
  declare function BulkRegionResult(): BulkRegionResult;
@@ -5907,7 +5917,7 @@ type CustomerRadiusSchema = {
5907
5917
  * - The unit of measurement for the radius (e.g.,
5908
5918
  * kilometers, miles).
5909
5919
  */
5910
- unit: string;
5920
+ unit?: string;
5911
5921
  /**
5912
5922
  * - The less-than comparison value for the radius.
5913
5923
  */
@@ -515,6 +515,8 @@ const Joi = require("joi");
515
515
  * @property {string} status - Current status of the result item.
516
516
  * @property {number} [total] - Total number of records processed.
517
517
  * @property {string} [error_file_path] - Path to the file containing error details.
518
+ * @property {string} [modified_on] - The timestamp when the record last modified.
519
+ * @property {string} [created_on] - The timestamp when the record was created.
518
520
  */
519
521
 
520
522
  /**
@@ -1751,7 +1753,7 @@ const Joi = require("joi");
1751
1753
 
1752
1754
  /**
1753
1755
  * @typedef CustomerRadiusSchema
1754
- * @property {string} unit - The unit of measurement for the radius (e.g.,
1756
+ * @property {string} [unit] - The unit of measurement for the radius (e.g.,
1755
1757
  * kilometers, miles).
1756
1758
  * @property {number} [lt] - The less-than comparison value for the radius.
1757
1759
  * @property {number} [lte] - The less-than-or-equal comparison value for the radius.
@@ -2809,6 +2811,8 @@ class ServiceabilityPlatformModel {
2809
2811
  status: Joi.string().allow("").required(),
2810
2812
  total: Joi.number(),
2811
2813
  error_file_path: Joi.string().allow(""),
2814
+ modified_on: Joi.string().allow(""),
2815
+ created_on: Joi.string().allow(""),
2812
2816
  });
2813
2817
  }
2814
2818
 
@@ -4107,7 +4111,7 @@ class ServiceabilityPlatformModel {
4107
4111
  /** @returns {CustomerRadiusSchema} */
4108
4112
  static CustomerRadiusSchema() {
4109
4113
  return Joi.object({
4110
- unit: Joi.string().allow("").required(),
4114
+ unit: Joi.string().allow(""),
4111
4115
  lt: Joi.number(),
4112
4116
  lte: Joi.number(),
4113
4117
  gt: Joi.number(),
@@ -264,7 +264,7 @@ class ServiceabilityPlatformValidator {
264
264
  pageSize: Joi.number(),
265
265
  batchId: Joi.string().allow(""),
266
266
  action: Joi.string().allow(""),
267
- status: Joi.string().allow(""),
267
+ status: Joi.string().allow("").allow(null),
268
268
  country: Joi.string().allow(""),
269
269
  region: Joi.string().allow(""),
270
270
  startDate: Joi.string().allow(""),
@@ -281,7 +281,7 @@ class ServiceabilityPlatformValidator {
281
281
  pageSize: Joi.number(),
282
282
  batchId: Joi.string().allow(""),
283
283
  action: Joi.string().allow(""),
284
- status: Joi.string().allow(""),
284
+ status: Joi.string().allow("").allow(null),
285
285
  country: Joi.string().allow(""),
286
286
  region: Joi.string().allow(""),
287
287
  startDate: Joi.string().allow(""),