@gofynd/fdk-client-javascript 3.17.2 → 3.18.0
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 +1 -1
- package/package.json +6 -2
- package/sdk/common/AxiosHelper.js +10 -3
- package/sdk/common/utils.d.ts +11 -1
- package/sdk/common/utils.js +17 -0
- package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +0 -7
- package/sdk/platform/Communication/CommunicationPlatformModel.js +0 -3
- package/sdk/platform/Order/OrderPlatformClient.d.ts +1 -1
- package/sdk/platform/Order/OrderPlatformClient.js +1 -1
- package/sdk/platform/Order/OrderPlatformModel.d.ts +5 -5
- package/sdk/platform/Order/OrderPlatformModel.js +3 -3
package/README.md
CHANGED
|
@@ -234,7 +234,7 @@ console.log("Active Theme: ", response.information.name);
|
|
|
234
234
|
The above code will log the curl command in the console
|
|
235
235
|
|
|
236
236
|
```bash
|
|
237
|
-
curl --request GET "https://api.fynd.com/service/application/theme/v1.0/applied-theme" --header 'authorization: Bearer <authorization-token>' --header 'x-fp-sdk-version: 3.
|
|
237
|
+
curl --request GET "https://api.fynd.com/service/application/theme/v1.0/applied-theme" --header 'authorization: Bearer <authorization-token>' --header 'x-fp-sdk-version: 3.18.0' --header 'x-fp-date: 20230222T115108Z' --header 'x-fp-signature: v1.1:1e3ab3b02b5bc626e3c32a37ee844266ade02bbcbaafc28fc7a0e46a76a7a1a8'
|
|
238
238
|
Active Theme: Emerge
|
|
239
239
|
```
|
|
240
240
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gofynd/fdk-client-javascript",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.18.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
},
|
|
13
13
|
"author": "Jigar Dafda",
|
|
14
14
|
"license": "ISC",
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "https://github.com/gofynd/fdk-client-javascript.git"
|
|
18
|
+
},
|
|
15
19
|
"dependencies": {
|
|
16
20
|
"axios": "^1.6.4",
|
|
17
21
|
"camelcase": "^6.3.0",
|
|
@@ -42,4 +46,4 @@
|
|
|
42
46
|
"!dist",
|
|
43
47
|
"!cypress"
|
|
44
48
|
]
|
|
45
|
-
}
|
|
49
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { isAbsoluteURL, combineURLs } = require("./utils");
|
|
1
|
+
const { isAbsoluteURL, combineURLs, isWebWorker } = require("./utils");
|
|
2
2
|
const axios = require("axios").default;
|
|
3
3
|
const querystring = require("query-string");
|
|
4
4
|
const { sign } = require("@gofynd/fp-signature");
|
|
@@ -79,12 +79,19 @@ function requestInterceptorFn() {
|
|
|
79
79
|
return config;
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
|
|
83
|
+
const axiosConfig = {
|
|
83
84
|
withCredentials: true,
|
|
84
85
|
paramsSerializer: (params) => {
|
|
85
86
|
return querystring.stringify(params);
|
|
86
87
|
},
|
|
87
|
-
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
if (isWebWorker()) {
|
|
91
|
+
axiosConfig.adapter = "fetch";
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const fdkAxios = axios.create(axiosConfig);
|
|
88
95
|
|
|
89
96
|
// Generate Curl in debug mode
|
|
90
97
|
fdkAxios.interceptors.request.use(
|
package/sdk/common/utils.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export function findBestMatchingLink(allLinks?: any[], pathname?: string): {
|
|
|
7
7
|
value: string;
|
|
8
8
|
params: {};
|
|
9
9
|
};
|
|
10
|
-
export function convertStringToBase64(string: any):
|
|
10
|
+
export function convertStringToBase64(string: any): any;
|
|
11
11
|
export function isBrowser(): boolean;
|
|
12
12
|
export function isNode(): boolean;
|
|
13
13
|
export namespace NAV_TYPE {
|
|
@@ -29,3 +29,13 @@ export function combineURLs(baseURL: string, relativeURL: string): string;
|
|
|
29
29
|
* @returns {boolean} True if the specified URL is absolute, otherwise false
|
|
30
30
|
*/
|
|
31
31
|
export function isAbsoluteURL(url: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Checks if the current execution context is a Web Worker (DedicatedWorker).
|
|
34
|
+
*
|
|
35
|
+
* This function determines whether the code is running inside a Dedicated Web
|
|
36
|
+
* Worker by verifying that the global `self` object exists, has a constructor,
|
|
37
|
+
* and that the constructor's name is "DedicatedWorkerGlobalScope".
|
|
38
|
+
*
|
|
39
|
+
* @returns {boolean} True if running in a Dedicated Web Worker, otherwise false.
|
|
40
|
+
*/
|
|
41
|
+
export function isWebWorker(): boolean;
|
package/sdk/common/utils.js
CHANGED
|
@@ -166,11 +166,27 @@ const isNode = () => {
|
|
|
166
166
|
);
|
|
167
167
|
};
|
|
168
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Checks if the current execution context is a Web Worker (DedicatedWorker).
|
|
171
|
+
*
|
|
172
|
+
* This function determines whether the code is running inside a Dedicated Web
|
|
173
|
+
* Worker by verifying that the global `self` object exists, has a constructor,
|
|
174
|
+
* and that the constructor's name is "DedicatedWorkerGlobalScope".
|
|
175
|
+
*
|
|
176
|
+
* @returns {boolean} True if running in a Dedicated Web Worker, otherwise false.
|
|
177
|
+
*/
|
|
178
|
+
const isWebWorker = () =>
|
|
179
|
+
typeof self === "object" &&
|
|
180
|
+
self.constructor &&
|
|
181
|
+
self.constructor.name === "DedicatedWorkerGlobalScope";
|
|
182
|
+
|
|
169
183
|
const convertStringToBase64 = (string) => {
|
|
170
184
|
if (isNode()) {
|
|
171
185
|
return Buffer.from(string, "utf-8").toString("base64");
|
|
172
186
|
} else if (isBrowser()) {
|
|
173
187
|
return window.btoa(string);
|
|
188
|
+
} else if (isWebWorker()) {
|
|
189
|
+
return BufferPolyFill.from(string, "utf-8").toString("base64");
|
|
174
190
|
} else {
|
|
175
191
|
throw new FDKException("Base64 conversion error: Unsupported environment");
|
|
176
192
|
}
|
|
@@ -217,4 +233,5 @@ module.exports = {
|
|
|
217
233
|
NAV_TYPE,
|
|
218
234
|
combineURLs,
|
|
219
235
|
isAbsoluteURL,
|
|
236
|
+
isWebWorker,
|
|
220
237
|
};
|
|
@@ -662,8 +662,6 @@ export = CommunicationPlatformModel;
|
|
|
662
662
|
* @property {SendOtpCommsReqData} [data]
|
|
663
663
|
* @property {SendOtpCommsReqSms} [sms]
|
|
664
664
|
* @property {SendOtpCommsReqEmail} [email]
|
|
665
|
-
* @property {Object} [additional_variables] - Additional data in key-value
|
|
666
|
-
* format where values can be of any type
|
|
667
665
|
*/
|
|
668
666
|
/**
|
|
669
667
|
* @typedef SendOtpCommsRes
|
|
@@ -1710,11 +1708,6 @@ type SendOtpCommsReq = {
|
|
|
1710
1708
|
data?: SendOtpCommsReqData;
|
|
1711
1709
|
sms?: SendOtpCommsReqSms;
|
|
1712
1710
|
email?: SendOtpCommsReqEmail;
|
|
1713
|
-
/**
|
|
1714
|
-
* - Additional data in key-value
|
|
1715
|
-
* format where values can be of any type
|
|
1716
|
-
*/
|
|
1717
|
-
additional_variables?: any;
|
|
1718
1711
|
};
|
|
1719
1712
|
/** @returns {SendOtpCommsRes} */
|
|
1720
1713
|
declare function SendOtpCommsRes(): SendOtpCommsRes;
|
|
@@ -757,8 +757,6 @@ const Joi = require("joi");
|
|
|
757
757
|
* @property {SendOtpCommsReqData} [data]
|
|
758
758
|
* @property {SendOtpCommsReqSms} [sms]
|
|
759
759
|
* @property {SendOtpCommsReqEmail} [email]
|
|
760
|
-
* @property {Object} [additional_variables] - Additional data in key-value
|
|
761
|
-
* format where values can be of any type
|
|
762
760
|
*/
|
|
763
761
|
|
|
764
762
|
/**
|
|
@@ -1994,7 +1992,6 @@ class CommunicationPlatformModel {
|
|
|
1994
1992
|
data: CommunicationPlatformModel.SendOtpCommsReqData(),
|
|
1995
1993
|
sms: CommunicationPlatformModel.SendOtpCommsReqSms(),
|
|
1996
1994
|
email: CommunicationPlatformModel.SendOtpCommsReqEmail(),
|
|
1997
|
-
additional_variables: Joi.object().pattern(/\S/, Joi.any()),
|
|
1998
1995
|
});
|
|
1999
1996
|
}
|
|
2000
1997
|
|
|
@@ -85,7 +85,7 @@ declare class Order {
|
|
|
85
85
|
* @returns {Promise<Object>} - Success response
|
|
86
86
|
* @name createOrder
|
|
87
87
|
* @summary: Create Order
|
|
88
|
-
* @description: Creates an order in the OMS. Use the (<a href='
|
|
88
|
+
* @description: Creates an order in the OMS. Note: Use the Serviceability API (<a href='/commerce/sdk/latest/platform/company/serviceability#createShipments'>createShipments</a>) to determine shipments before creating an order. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/order/createOrder/).
|
|
89
89
|
*/
|
|
90
90
|
createOrder({ xOrderingSource, body, xApplicationId, xExtensionId, requestHeaders }?: OrderPlatformValidator.CreateOrderParam, { responseHeaders }?: object): Promise<any>;
|
|
91
91
|
/**
|
|
@@ -604,7 +604,7 @@ class Order {
|
|
|
604
604
|
* @returns {Promise<Object>} - Success response
|
|
605
605
|
* @name createOrder
|
|
606
606
|
* @summary: Create Order
|
|
607
|
-
* @description: Creates an order in the OMS. Use the (<a href='
|
|
607
|
+
* @description: Creates an order in the OMS. Note: Use the Serviceability API (<a href='/commerce/sdk/latest/platform/company/serviceability#createShipments'>createShipments</a>) to determine shipments before creating an order. - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/order/createOrder/).
|
|
608
608
|
*/
|
|
609
609
|
async createOrder(
|
|
610
610
|
{ xOrderingSource, body, xApplicationId, xExtensionId, requestHeaders } = {
|
|
@@ -2858,8 +2858,8 @@ export = OrderPlatformModel;
|
|
|
2858
2858
|
* offline mode. Used to enable offline-specific processing and sync behavior.
|
|
2859
2859
|
* @property {LineItemSchema[]} [line_items] - A list of items included in the shipment.
|
|
2860
2860
|
* @property {OrderFulfillmentTimelineSchema} [order_fulfillment_timeline]
|
|
2861
|
-
* @property {number}
|
|
2862
|
-
*
|
|
2861
|
+
* @property {number} location_id - The location ID from which this shipment is
|
|
2862
|
+
* being fulfilled.
|
|
2863
2863
|
* @property {string} [external_location_id] - The external location ID from
|
|
2864
2864
|
* which this shipment is being fulfilled.
|
|
2865
2865
|
* @property {number} [return_location_id] - Overrides the article's default
|
|
@@ -11344,10 +11344,10 @@ type CreateOrderShipmentSchema = {
|
|
|
11344
11344
|
line_items?: LineItemSchema[];
|
|
11345
11345
|
order_fulfillment_timeline?: OrderFulfillmentTimelineSchema;
|
|
11346
11346
|
/**
|
|
11347
|
-
* - The location ID from which this shipment
|
|
11348
|
-
*
|
|
11347
|
+
* - The location ID from which this shipment is
|
|
11348
|
+
* being fulfilled.
|
|
11349
11349
|
*/
|
|
11350
|
-
location_id
|
|
11350
|
+
location_id: number;
|
|
11351
11351
|
/**
|
|
11352
11352
|
* - The external location ID from
|
|
11353
11353
|
* which this shipment is being fulfilled.
|
|
@@ -3117,8 +3117,8 @@ const Joi = require("joi");
|
|
|
3117
3117
|
* offline mode. Used to enable offline-specific processing and sync behavior.
|
|
3118
3118
|
* @property {LineItemSchema[]} [line_items] - A list of items included in the shipment.
|
|
3119
3119
|
* @property {OrderFulfillmentTimelineSchema} [order_fulfillment_timeline]
|
|
3120
|
-
* @property {number}
|
|
3121
|
-
*
|
|
3120
|
+
* @property {number} location_id - The location ID from which this shipment is
|
|
3121
|
+
* being fulfilled.
|
|
3122
3122
|
* @property {string} [external_location_id] - The external location ID from
|
|
3123
3123
|
* which this shipment is being fulfilled.
|
|
3124
3124
|
* @property {number} [return_location_id] - Overrides the article's default
|
|
@@ -8898,7 +8898,7 @@ class OrderPlatformModel {
|
|
|
8898
8898
|
invoice_id: Joi.string().allow(""),
|
|
8899
8899
|
line_items: Joi.array().items(OrderPlatformModel.LineItemSchema()),
|
|
8900
8900
|
order_fulfillment_timeline: OrderPlatformModel.OrderFulfillmentTimelineSchema(),
|
|
8901
|
-
location_id: Joi.number(),
|
|
8901
|
+
location_id: Joi.number().required(),
|
|
8902
8902
|
external_location_id: Joi.string().allow(""),
|
|
8903
8903
|
return_location_id: Joi.number(),
|
|
8904
8904
|
courier_partner_details: OrderPlatformModel.CourierPartnerDetailsSchema(),
|