@gofynd/fdk-client-javascript 1.3.6 → 1.3.8

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
@@ -214,7 +214,7 @@ console.log("Active Theme: ", response.information.name);
214
214
  The above code will log the curl command in the console
215
215
 
216
216
  ```bash
217
- curl --request GET "https://api.fynd.com/service/application/theme/v1.0/applied-theme" --header 'authorization: Bearer <authorization-token>' --header 'x-fp-sdk-version: 1.3.6' --header 'x-fp-date: 20230222T115108Z' --header 'x-fp-signature: v1.1:1e3ab3b02b5bc626e3c32a37ee844266ade02bbcbaafc28fc7a0e46a76a7a1a8'
217
+ curl --request GET "https://api.fynd.com/service/application/theme/v1.0/applied-theme" --header 'authorization: Bearer <authorization-token>' --header 'x-fp-sdk-version: 1.3.8' --header 'x-fp-date: 20230222T115108Z' --header 'x-fp-signature: v1.1:1e3ab3b02b5bc626e3c32a37ee844266ade02bbcbaafc28fc7a0e46a76a7a1a8'
218
218
  Active Theme: Emerge
219
219
  ```
220
220
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gofynd/fdk-client-javascript",
3
- "version": "1.3.6",
3
+ "version": "1.3.8",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,7 +14,6 @@
14
14
  "dependencies": {
15
15
  "axios": "^0.27.2",
16
16
  "camelcase": "^6.3.0",
17
- "crypto-js": "^4.1.1",
18
17
  "joi": "^17.7.0",
19
18
  "loglevel": "^1.8.1",
20
19
  "query-string": "^7.1.3",
@@ -144,7 +144,7 @@ declare class Cart {
144
144
  * @summary: Fetch all items added to the cart
145
145
  * @description: Use this API to get details of all the items added to a cart. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getCart/).
146
146
  */
147
- getCart({ id, i, b, assignCardId, areaCode, buyNow, requestHeaders }?: CartApplicationValidator.GetCartParam, { responseHeaders }?: object): Promise<CartApplicationModel.CartDetailResponse>;
147
+ getCart({ id, i, b, c, assignCardId, areaCode, buyNow, requestHeaders }?: CartApplicationValidator.GetCartParam, { responseHeaders }?: object): Promise<CartApplicationModel.CartDetailResponse>;
148
148
  /**
149
149
  * @param {CartApplicationValidator.GetCartLastModifiedParam} arg - Arg object.
150
150
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
@@ -896,13 +896,13 @@ class Cart {
896
896
  * @description: Use this API to get details of all the items added to a cart. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/cart/getCart/).
897
897
  */
898
898
  async getCart(
899
- { id, i, b, assignCardId, areaCode, buyNow, requestHeaders } = {
899
+ { id, i, b, c, assignCardId, areaCode, buyNow, requestHeaders } = {
900
900
  requestHeaders: {},
901
901
  },
902
902
  { responseHeaders } = { responseHeaders: false }
903
903
  ) {
904
904
  const { error } = CartApplicationValidator.getCart().validate(
905
- { id, i, b, assignCardId, areaCode, buyNow },
905
+ { id, i, b, c, assignCardId, areaCode, buyNow },
906
906
  { abortEarly: false, allowUnknown: true }
907
907
  );
908
908
  if (error) {
@@ -911,7 +911,7 @@ class Cart {
911
911
 
912
912
  // Showing warrnings if extra unknown parameters are found
913
913
  const { error: warrning } = CartApplicationValidator.getCart().validate(
914
- { id, i, b, assignCardId, areaCode, buyNow },
914
+ { id, i, b, c, assignCardId, areaCode, buyNow },
915
915
  { abortEarly: false, allowUnknown: false }
916
916
  );
917
917
  if (warrning) {
@@ -925,6 +925,7 @@ class Cart {
925
925
  query_params["id"] = id;
926
926
  query_params["i"] = i;
927
927
  query_params["b"] = b;
928
+ query_params["c"] = c;
928
929
  query_params["assign_card_id"] = assignCardId;
929
930
  query_params["area_code"] = areaCode;
930
931
  query_params["buy_now"] = buyNow;
@@ -76,6 +76,7 @@ export = CartApplicationValidator;
76
76
  * @property {string} [id]
77
77
  * @property {boolean} [i]
78
78
  * @property {boolean} [b]
79
+ * @property {boolean} [c]
79
80
  * @property {number} [assignCardId]
80
81
  * @property {string} [areaCode]
81
82
  * @property {boolean} [buyNow]
@@ -345,6 +346,7 @@ type GetCartParam = {
345
346
  id?: string;
346
347
  i?: boolean;
347
348
  b?: boolean;
349
+ c?: boolean;
348
350
  assignCardId?: number;
349
351
  areaCode?: string;
350
352
  buyNow?: boolean;
@@ -89,6 +89,7 @@ const CartApplicationModel = require("./CartApplicationModel");
89
89
  * @property {string} [id]
90
90
  * @property {boolean} [i]
91
91
  * @property {boolean} [b]
92
+ * @property {boolean} [c]
92
93
  * @property {number} [assignCardId]
93
94
  * @property {string} [areaCode]
94
95
  * @property {boolean} [buyNow]
@@ -335,6 +336,7 @@ class CartApplicationValidator {
335
336
  id: Joi.string().allow(""),
336
337
  i: Joi.boolean(),
337
338
  b: Joi.boolean(),
339
+ c: Joi.boolean(),
338
340
  assignCardId: Joi.number(),
339
341
  areaCode: Joi.string().allow(""),
340
342
  buyNow: Joi.boolean(),
@@ -136,7 +136,7 @@ declare class PosCart {
136
136
  * @summary: Fetch all items added to the cart
137
137
  * @description: Use this API to get details of all the items added to a cart. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/poscart/getCart/).
138
138
  */
139
- getCart({ id, i, b, assignCardId, areaCode, buyNow, requestHeaders }?: PosCartApplicationValidator.GetCartParam, { responseHeaders }?: object): Promise<PosCartApplicationModel.CartDetailResponse>;
139
+ getCart({ id, i, b, c, assignCardId, areaCode, buyNow, requestHeaders }?: PosCartApplicationValidator.GetCartParam, { responseHeaders }?: object): Promise<PosCartApplicationModel.CartDetailResponse>;
140
140
  /**
141
141
  * @param {PosCartApplicationValidator.GetCartLastModifiedParam} arg - Arg object.
142
142
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
@@ -832,13 +832,13 @@ class PosCart {
832
832
  * @description: Use this API to get details of all the items added to a cart. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/poscart/getCart/).
833
833
  */
834
834
  async getCart(
835
- { id, i, b, assignCardId, areaCode, buyNow, requestHeaders } = {
835
+ { id, i, b, c, assignCardId, areaCode, buyNow, requestHeaders } = {
836
836
  requestHeaders: {},
837
837
  },
838
838
  { responseHeaders } = { responseHeaders: false }
839
839
  ) {
840
840
  const { error } = PosCartApplicationValidator.getCart().validate(
841
- { id, i, b, assignCardId, areaCode, buyNow },
841
+ { id, i, b, c, assignCardId, areaCode, buyNow },
842
842
  { abortEarly: false, allowUnknown: true }
843
843
  );
844
844
  if (error) {
@@ -847,7 +847,7 @@ class PosCart {
847
847
 
848
848
  // Showing warrnings if extra unknown parameters are found
849
849
  const { error: warrning } = PosCartApplicationValidator.getCart().validate(
850
- { id, i, b, assignCardId, areaCode, buyNow },
850
+ { id, i, b, c, assignCardId, areaCode, buyNow },
851
851
  { abortEarly: false, allowUnknown: false }
852
852
  );
853
853
  if (warrning) {
@@ -861,6 +861,7 @@ class PosCart {
861
861
  query_params["id"] = id;
862
862
  query_params["i"] = i;
863
863
  query_params["b"] = b;
864
+ query_params["c"] = c;
864
865
  query_params["assign_card_id"] = assignCardId;
865
866
  query_params["area_code"] = areaCode;
866
867
  query_params["buy_now"] = buyNow;
@@ -72,6 +72,7 @@ export = PosCartApplicationValidator;
72
72
  * @property {string} [id]
73
73
  * @property {boolean} [i]
74
74
  * @property {boolean} [b]
75
+ * @property {boolean} [c]
75
76
  * @property {number} [assignCardId]
76
77
  * @property {string} [areaCode]
77
78
  * @property {boolean} [buyNow]
@@ -325,6 +326,7 @@ type GetCartParam = {
325
326
  id?: string;
326
327
  i?: boolean;
327
328
  b?: boolean;
329
+ c?: boolean;
328
330
  assignCardId?: number;
329
331
  areaCode?: string;
330
332
  buyNow?: boolean;
@@ -84,6 +84,7 @@ const PosCartApplicationModel = require("./PosCartApplicationModel");
84
84
  * @property {string} [id]
85
85
  * @property {boolean} [i]
86
86
  * @property {boolean} [b]
87
+ * @property {boolean} [c]
87
88
  * @property {number} [assignCardId]
88
89
  * @property {string} [areaCode]
89
90
  * @property {boolean} [buyNow]
@@ -321,6 +322,7 @@ class PosCartApplicationValidator {
321
322
  id: Joi.string().allow(""),
322
323
  i: Joi.boolean(),
323
324
  b: Joi.boolean(),
325
+ c: Joi.boolean(),
324
326
  assignCardId: Joi.number(),
325
327
  areaCode: Joi.string().allow(""),
326
328
  buyNow: Joi.boolean(),
@@ -31,12 +31,17 @@ class OAuthClient extends BaseOAuthClient {
31
31
  path: reqPath,
32
32
  body: null,
33
33
  headers: {},
34
- signQuery: true,
35
34
  };
36
- signingOptions = sign(signingOptions, "1234567");
35
+ const signature = sign(signingOptions, {
36
+ signQuery: true,
37
+ });
37
38
  Logger({ type: "DEBUG", message: "Authorization successful" });
38
39
 
39
- return `${this.config.domain}${signingOptions.path}`;
40
+ const urlObj = new URL(reqPath, this.config.domain);
41
+ urlObj.searchParams.set("x-fp-date", signature["x-fp-date"]);
42
+ urlObj.searchParams.set("x-fp-signature", signature["x-fp-signature"]);
43
+
44
+ return urlObj.href;
40
45
  }
41
46
 
42
47
  async verifyCallback(query) {
@@ -176,7 +176,7 @@ declare class Cart {
176
176
  * @summary: Fetch all items added to the cart
177
177
  * @description: Use this API to get details of all the items added to a cart. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/cart/getAbandonedCartDetails/).
178
178
  */
179
- getAbandonedCartDetails({ id, i, b, requestHeaders }?: CartPlatformApplicationValidator.GetAbandonedCartDetailsParam, { responseHeaders }?: object): Promise<CartPlatformModel.CartDetailResponse>;
179
+ getAbandonedCartDetails({ id, i, b, c, requestHeaders }?: CartPlatformApplicationValidator.GetAbandonedCartDetailsParam, { responseHeaders }?: object): Promise<CartPlatformModel.CartDetailResponse>;
180
180
  /**
181
181
  * @param {CartPlatformApplicationValidator.GetAddressByIdParam} arg - Arg object
182
182
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
@@ -1144,7 +1144,7 @@ class Cart {
1144
1144
  * @description: Use this API to get details of all the items added to a cart. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/cart/getAbandonedCartDetails/).
1145
1145
  */
1146
1146
  async getAbandonedCartDetails(
1147
- { id, i, b, requestHeaders } = { requestHeaders: {} },
1147
+ { id, i, b, c, requestHeaders } = { requestHeaders: {} },
1148
1148
  { responseHeaders } = { responseHeaders: false }
1149
1149
  ) {
1150
1150
  const {
@@ -1154,6 +1154,7 @@ class Cart {
1154
1154
  id,
1155
1155
  i,
1156
1156
  b,
1157
+ c,
1157
1158
  },
1158
1159
  { abortEarly: false, allowUnknown: true }
1159
1160
  );
@@ -1169,6 +1170,7 @@ class Cart {
1169
1170
  id,
1170
1171
  i,
1171
1172
  b,
1173
+ c,
1172
1174
  },
1173
1175
  { abortEarly: false, allowUnknown: false }
1174
1176
  );
@@ -1183,6 +1185,7 @@ class Cart {
1183
1185
  query_params["id"] = id;
1184
1186
  query_params["i"] = i;
1185
1187
  query_params["b"] = b;
1188
+ query_params["c"] = c;
1186
1189
 
1187
1190
  const response = await PlatformAPIClient.execute(
1188
1191
  this.config,
@@ -67,6 +67,7 @@ export = CartPlatformApplicationValidator;
67
67
  * @property {string} [id]
68
68
  * @property {boolean} [i]
69
69
  * @property {boolean} [b]
70
+ * @property {boolean} [c]
70
71
  */
71
72
  /**
72
73
  * @typedef GetAddressByIdParam
@@ -521,6 +522,7 @@ type GetAbandonedCartDetailsParam = {
521
522
  id?: string;
522
523
  i?: boolean;
523
524
  b?: boolean;
525
+ c?: boolean;
524
526
  };
525
527
  type GetAddressByIdParam = {
526
528
  id: string;
@@ -83,6 +83,7 @@ const CartPlatformModel = require("./CartPlatformModel");
83
83
  * @property {string} [id]
84
84
  * @property {boolean} [i]
85
85
  * @property {boolean} [b]
86
+ * @property {boolean} [c]
86
87
  */
87
88
 
88
89
  /**
@@ -512,6 +513,7 @@ class CartPlatformApplicationValidator {
512
513
  id: Joi.string().allow(""),
513
514
  i: Joi.boolean(),
514
515
  b: Joi.boolean(),
516
+ c: Joi.boolean(),
515
517
  }).required();
516
518
  }
517
519
 
@@ -84,12 +84,16 @@ class OAuthClient {
84
84
  path: reqPath,
85
85
  body: null,
86
86
  headers: {},
87
- signQuery: true,
88
87
  };
89
- signingOptions = sign(signingOptions, "1234567");
88
+ const signature = sign(signingOptions, {
89
+ signQuery: true,
90
+ });
90
91
  Logger({ level: "INFO", message: "Authorization successful.!" });
92
+ const urlObj = new URL(reqPath, this.config.domain);
93
+ urlObj.searchParams.set("x-fp-date", signature["x-fp-date"]);
94
+ urlObj.searchParams.set("x-fp-signature", signature["x-fp-signature"]);
91
95
 
92
- return `${this.config.domain}${signingOptions.path}`;
96
+ return urlObj.href;
93
97
  }
94
98
 
95
99
  async verifyCallback(query) {
@@ -286,7 +286,7 @@ class Order {
286
286
  const response = await PlatformAPIClient.execute(
287
287
  this.config,
288
288
  "get",
289
- `/service/platform/order/v1.0/company/${this.config.companyId}/application/<application_id>/orders/shipments/<shipment_id>/line_number/<line_number>/reasons`,
289
+ `/service/platform/order/v1.0/company/${this.config.companyId}/application/${this.applicationId}/orders/shipments/${shipmentId}/line_number/${lineNumber}/reasons`,
290
290
  query_params,
291
291
  undefined,
292
292
  requestHeaders,