@gofynd/fdk-client-javascript 1.4.15-beta.1 → 1.4.15-beta.11
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 +2 -2
- package/application.d.ts +1 -2
- package/application.js +2 -3
- package/index.d.ts +1 -2
- package/index.js +7 -1
- package/package.json +3 -4
- package/sdk/application/ApplicationClient.js +0 -18
- package/sdk/application/Cart/CartApplicationClient.d.ts +55 -90
- package/sdk/application/Cart/CartApplicationClient.js +60 -1185
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +90 -142
- package/sdk/application/Catalog/CatalogApplicationClient.js +187 -1293
- package/sdk/application/Common/CommonApplicationClient.d.ts +4 -8
- package/sdk/application/Common/CommonApplicationClient.js +5 -89
- package/sdk/application/Communication/CommunicationApplicationClient.d.ts +6 -19
- package/sdk/application/Communication/CommunicationApplicationClient.js +6 -145
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +32 -73
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +31 -718
- package/sdk/application/Content/ContentApplicationClient.d.ts +46 -78
- package/sdk/application/Content/ContentApplicationClient.js +77 -914
- package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +6 -11
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +19 -125
- package/sdk/application/Lead/LeadApplicationClient.d.ts +10 -18
- package/sdk/application/Lead/LeadApplicationClient.js +32 -202
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +22 -39
- package/sdk/application/Logistic/LogisticApplicationClient.js +50 -478
- package/sdk/application/Order/OrderApplicationClient.d.ts +22 -42
- package/sdk/application/Order/OrderApplicationClient.js +86 -472
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +92 -212
- package/sdk/application/Payment/PaymentApplicationClient.js +57 -2102
- package/sdk/application/Rewards/RewardsApplicationClient.d.ts +14 -28
- package/sdk/application/Rewards/RewardsApplicationClient.js +16 -305
- package/sdk/application/Share/ShareApplicationClient.d.ts +14 -24
- package/sdk/application/Share/ShareApplicationClient.js +34 -294
- package/sdk/application/Theme/ThemeApplicationClient.d.ts +8 -14
- package/sdk/application/Theme/ThemeApplicationClient.js +28 -162
- package/sdk/application/User/UserApplicationClient.d.ts +85 -136
- package/sdk/application/User/UserApplicationClient.js +45 -1815
- package/sdk/application/Webhook/WebhookApplicationClient.d.ts +2 -5
- package/sdk/application/Webhook/WebhookApplicationClient.js +4 -47
- package/sdk/application/index.d.ts +0 -18
- package/sdk/application/index.js +0 -33
- package/sdk/common/Utility.d.ts +1 -1
- package/sdk/common/Utility.js +10 -7
- package/sdk/common/Validator.d.ts +1 -0
- package/sdk/common/Validator.js +20 -0
- package/sdk/common/utils.d.ts +0 -1
- package/sdk/common/utils.js +0 -14
- package/sdk/partner/OAuthClient.js +1 -0
- package/sdk/partner/Theme/ThemePartnerModel.d.ts +3 -40
- package/sdk/partner/Theme/ThemePartnerModel.js +2 -24
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +39 -1
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +247 -1
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +33 -1
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +37 -0
- package/sdk/platform/Cart/CartPlatformModel.d.ts +193 -1
- package/sdk/platform/Cart/CartPlatformModel.js +132 -0
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +0 -7
- package/sdk/platform/Catalog/CatalogPlatformModel.js +1 -4
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +14 -0
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +6 -0
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +0 -10
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +0 -92
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -28
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +0 -18
- package/sdk/platform/Order/OrderPlatformClient.d.ts +10 -0
- package/sdk/platform/Order/OrderPlatformClient.js +99 -0
- package/sdk/platform/Order/OrderPlatformModel.d.ts +7 -0
- package/sdk/platform/Order/OrderPlatformModel.js +3 -0
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +33 -1
- package/sdk/platform/Order/OrderPlatformValidator.js +20 -0
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +1 -1
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +4 -4
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +56 -19
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +42 -18
- package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +3 -3
- package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +2 -2
- package/sdk/platform/Theme/ThemePlatformModel.d.ts +3 -40
- package/sdk/platform/Theme/ThemePlatformModel.js +2 -24
- package/sdk/public/Configuration/ConfigurationPublicClient.js +5 -2
- package/sdk/public/Content/ContentPublicClient.d.ts +1 -1
- package/sdk/public/Content/ContentPublicClient.js +14 -2
- package/sdk/public/Partner/PartnerPublicClient.d.ts +1 -1
- package/sdk/public/Partner/PartnerPublicClient.js +14 -2
- package/sdk/public/Webhook/WebhookPublicClient.js +5 -2
- package/sdk/application/Cart/CartApplicationModel.d.ts +0 -3994
- package/sdk/application/Cart/CartApplicationModel.js +0 -2497
- package/sdk/application/Cart/CartApplicationValidator.d.ts +0 -769
- package/sdk/application/Cart/CartApplicationValidator.js +0 -530
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +0 -3857
- package/sdk/application/Catalog/CatalogApplicationModel.js +0 -2629
- package/sdk/application/Catalog/CatalogApplicationValidator.d.ts +0 -791
- package/sdk/application/Catalog/CatalogApplicationValidator.js +0 -551
- package/sdk/application/Common/CommonApplicationModel.d.ts +0 -449
- package/sdk/application/Common/CommonApplicationModel.js +0 -308
- package/sdk/application/Common/CommonApplicationValidator.d.ts +0 -46
- package/sdk/application/Common/CommonApplicationValidator.js +0 -38
- package/sdk/application/Communication/CommunicationApplicationModel.d.ts +0 -293
- package/sdk/application/Communication/CommunicationApplicationModel.js +0 -201
- package/sdk/application/Communication/CommunicationApplicationValidator.d.ts +0 -29
- package/sdk/application/Communication/CommunicationApplicationValidator.js +0 -38
- package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +0 -2556
- package/sdk/application/Configuration/ConfigurationApplicationModel.js +0 -1887
- package/sdk/application/Configuration/ConfigurationApplicationValidator.d.ts +0 -179
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +0 -176
- package/sdk/application/Content/ContentApplicationModel.d.ts +0 -2133
- package/sdk/application/Content/ContentApplicationModel.js +0 -1589
- package/sdk/application/Content/ContentApplicationValidator.d.ts +0 -284
- package/sdk/application/Content/ContentApplicationValidator.js +0 -264
- package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +0 -272
- package/sdk/application/FileStorage/FileStorageApplicationModel.js +0 -190
- package/sdk/application/FileStorage/FileStorageApplicationValidator.d.ts +0 -56
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +0 -53
- package/sdk/application/Lead/LeadApplicationModel.d.ts +0 -590
- package/sdk/application/Lead/LeadApplicationModel.js +0 -480
- package/sdk/application/Lead/LeadApplicationValidator.d.ts +0 -68
- package/sdk/application/Lead/LeadApplicationValidator.js +0 -71
- package/sdk/application/Logistic/LogisticApplicationModel.d.ts +0 -1675
- package/sdk/application/Logistic/LogisticApplicationModel.js +0 -1121
- package/sdk/application/Logistic/LogisticApplicationValidator.d.ts +0 -254
- package/sdk/application/Logistic/LogisticApplicationValidator.js +0 -190
- package/sdk/application/Order/OrderApplicationModel.d.ts +0 -2296
- package/sdk/application/Order/OrderApplicationModel.js +0 -1471
- package/sdk/application/Order/OrderApplicationValidator.d.ts +0 -265
- package/sdk/application/Order/OrderApplicationValidator.js +0 -197
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +0 -4058
- package/sdk/application/Payment/PaymentApplicationModel.js +0 -2630
- package/sdk/application/Payment/PaymentApplicationValidator.d.ts +0 -576
- package/sdk/application/Payment/PaymentApplicationValidator.js +0 -594
- package/sdk/application/Rewards/RewardsApplicationModel.d.ts +0 -365
- package/sdk/application/Rewards/RewardsApplicationModel.js +0 -396
- package/sdk/application/Rewards/RewardsApplicationValidator.d.ts +0 -73
- package/sdk/application/Rewards/RewardsApplicationValidator.js +0 -84
- package/sdk/application/Share/ShareApplicationModel.d.ts +0 -339
- package/sdk/application/Share/ShareApplicationModel.js +0 -234
- package/sdk/application/Share/ShareApplicationValidator.d.ts +0 -90
- package/sdk/application/Share/ShareApplicationValidator.js +0 -91
- package/sdk/application/Theme/ThemeApplicationModel.d.ts +0 -1713
- package/sdk/application/Theme/ThemeApplicationModel.js +0 -1426
- package/sdk/application/Theme/ThemeApplicationValidator.d.ts +0 -66
- package/sdk/application/Theme/ThemeApplicationValidator.js +0 -58
- package/sdk/application/User/UserApplicationModel.d.ts +0 -1943
- package/sdk/application/User/UserApplicationModel.js +0 -1382
- package/sdk/application/User/UserApplicationValidator.d.ts +0 -560
- package/sdk/application/User/UserApplicationValidator.js +0 -573
- package/sdk/application/Webhook/WebhookApplicationModel.d.ts +0 -52
- package/sdk/application/Webhook/WebhookApplicationModel.js +0 -46
- package/sdk/application/Webhook/WebhookApplicationValidator.d.ts +0 -16
- package/sdk/application/Webhook/WebhookApplicationValidator.js +0 -19
- package/sdk/common/Clickstream.d.ts +0 -1
- package/sdk/common/Clickstream.js +0 -464
|
@@ -8,15 +8,12 @@ declare class Webhook {
|
|
|
8
8
|
_urls: {};
|
|
9
9
|
updateUrls(urls: any): void;
|
|
10
10
|
/**
|
|
11
|
-
* @param {WebhookApplicationValidator.SaveClickEventParam} arg - Arg object.
|
|
12
11
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
13
12
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
14
|
-
* @returns {Promise<
|
|
13
|
+
* @returns {Promise<ClickEventResponse>} - Success response
|
|
15
14
|
* @name saveClickEvent
|
|
16
15
|
* @summary: Endpoint to capture click events from sales channels and persist them in database.
|
|
17
16
|
* @description: Send click events from sales channels. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/webhook/saveClickEvent/).
|
|
18
17
|
*/
|
|
19
|
-
saveClickEvent({ body, requestHeaders }?:
|
|
18
|
+
saveClickEvent({ body, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<ClickEventResponse>;
|
|
20
19
|
}
|
|
21
|
-
import WebhookApplicationValidator = require("./WebhookApplicationValidator");
|
|
22
|
-
import WebhookApplicationModel = require("./WebhookApplicationModel");
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
const ApplicationAPIClient = require("../ApplicationAPIClient");
|
|
2
1
|
const {
|
|
3
2
|
FDKClientValidationError,
|
|
4
3
|
FDKResponseValidationError,
|
|
5
4
|
} = require("../../common/FDKError");
|
|
5
|
+
|
|
6
|
+
const ApplicationAPIClient = require("../ApplicationAPIClient");
|
|
6
7
|
const constructUrl = require("../constructUrl");
|
|
7
8
|
const Paginator = require("../../common/Paginator");
|
|
8
|
-
const
|
|
9
|
-
const WebhookApplicationModel = require("./WebhookApplicationModel");
|
|
10
|
-
const { Logger } = require("./../../common/Logger");
|
|
11
|
-
const Joi = require("joi");
|
|
9
|
+
const { validateRequiredParams } = require("../../common/Validator");
|
|
12
10
|
|
|
13
11
|
class Webhook {
|
|
14
12
|
constructor(_conf) {
|
|
@@ -34,10 +32,9 @@ class Webhook {
|
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
/**
|
|
37
|
-
* @param {WebhookApplicationValidator.SaveClickEventParam} arg - Arg object.
|
|
38
35
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
39
36
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
40
|
-
* @returns {Promise<
|
|
37
|
+
* @returns {Promise<ClickEventResponse>} - Success response
|
|
41
38
|
* @name saveClickEvent
|
|
42
39
|
* @summary: Endpoint to capture click events from sales channels and persist them in database.
|
|
43
40
|
* @description: Send click events from sales channels. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/webhook/saveClickEvent/).
|
|
@@ -46,28 +43,6 @@ class Webhook {
|
|
|
46
43
|
{ body, requestHeaders } = { requestHeaders: {} },
|
|
47
44
|
{ responseHeaders } = { responseHeaders: false }
|
|
48
45
|
) {
|
|
49
|
-
const { error } = WebhookApplicationValidator.saveClickEvent().validate(
|
|
50
|
-
{ body },
|
|
51
|
-
{ abortEarly: false, allowUnknown: true }
|
|
52
|
-
);
|
|
53
|
-
if (error) {
|
|
54
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// Showing warrnings if extra unknown parameters are found
|
|
58
|
-
const {
|
|
59
|
-
error: warrning,
|
|
60
|
-
} = WebhookApplicationValidator.saveClickEvent().validate(
|
|
61
|
-
{ body },
|
|
62
|
-
{ abortEarly: false, allowUnknown: false }
|
|
63
|
-
);
|
|
64
|
-
if (warrning) {
|
|
65
|
-
Logger({
|
|
66
|
-
level: "WARN",
|
|
67
|
-
message: `Parameter Validation warrnings for application > Webhook > saveClickEvent \n ${warrning}`,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
|
|
71
46
|
const query_params = {};
|
|
72
47
|
|
|
73
48
|
const xHeaders = {};
|
|
@@ -90,24 +65,6 @@ class Webhook {
|
|
|
90
65
|
responseData = response[0];
|
|
91
66
|
}
|
|
92
67
|
|
|
93
|
-
const {
|
|
94
|
-
error: res_error,
|
|
95
|
-
} = WebhookApplicationModel.ClickEventResponse().validate(responseData, {
|
|
96
|
-
abortEarly: false,
|
|
97
|
-
allowUnknown: true,
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
if (res_error) {
|
|
101
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
102
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
103
|
-
} else {
|
|
104
|
-
Logger({
|
|
105
|
-
level: "WARN",
|
|
106
|
-
message: `Response Validation Warnings for application > Webhook > saveClickEvent \n ${res_error}`,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
68
|
return response;
|
|
112
69
|
}
|
|
113
70
|
}
|
|
@@ -1,20 +1,2 @@
|
|
|
1
1
|
export const ApplicationConfig: typeof import("./ApplicationConfig");
|
|
2
2
|
export const ApplicationClient: typeof import("./ApplicationClient");
|
|
3
|
-
export namespace ApplicationModel {
|
|
4
|
-
const CartApplicationModel: typeof import("./Cart/CartApplicationModel");
|
|
5
|
-
const CatalogApplicationModel: typeof import("./Catalog/CatalogApplicationModel");
|
|
6
|
-
const CommonApplicationModel: typeof import("./Common/CommonApplicationModel");
|
|
7
|
-
const CommunicationApplicationModel: typeof import("./Communication/CommunicationApplicationModel");
|
|
8
|
-
const ConfigurationApplicationModel: typeof import("./Configuration/ConfigurationApplicationModel");
|
|
9
|
-
const ContentApplicationModel: typeof import("./Content/ContentApplicationModel");
|
|
10
|
-
const FileStorageApplicationModel: typeof import("./FileStorage/FileStorageApplicationModel");
|
|
11
|
-
const LeadApplicationModel: typeof import("./Lead/LeadApplicationModel");
|
|
12
|
-
const LogisticApplicationModel: typeof import("./Logistic/LogisticApplicationModel");
|
|
13
|
-
const OrderApplicationModel: typeof import("./Order/OrderApplicationModel");
|
|
14
|
-
const PaymentApplicationModel: typeof import("./Payment/PaymentApplicationModel");
|
|
15
|
-
const RewardsApplicationModel: typeof import("./Rewards/RewardsApplicationModel");
|
|
16
|
-
const ShareApplicationModel: typeof import("./Share/ShareApplicationModel");
|
|
17
|
-
const ThemeApplicationModel: typeof import("./Theme/ThemeApplicationModel");
|
|
18
|
-
const UserApplicationModel: typeof import("./User/UserApplicationModel");
|
|
19
|
-
const WebhookApplicationModel: typeof import("./Webhook/WebhookApplicationModel");
|
|
20
|
-
}
|
package/sdk/application/index.js
CHANGED
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
ApplicationConfig: require("./ApplicationConfig"),
|
|
3
3
|
ApplicationClient: require("./ApplicationClient"),
|
|
4
|
-
ApplicationModel: {
|
|
5
|
-
CartApplicationModel: require("./Cart/CartApplicationModel"),
|
|
6
|
-
|
|
7
|
-
CatalogApplicationModel: require("./Catalog/CatalogApplicationModel"),
|
|
8
|
-
|
|
9
|
-
CommonApplicationModel: require("./Common/CommonApplicationModel"),
|
|
10
|
-
|
|
11
|
-
CommunicationApplicationModel: require("./Communication/CommunicationApplicationModel"),
|
|
12
|
-
|
|
13
|
-
ConfigurationApplicationModel: require("./Configuration/ConfigurationApplicationModel"),
|
|
14
|
-
|
|
15
|
-
ContentApplicationModel: require("./Content/ContentApplicationModel"),
|
|
16
|
-
|
|
17
|
-
FileStorageApplicationModel: require("./FileStorage/FileStorageApplicationModel"),
|
|
18
|
-
|
|
19
|
-
LeadApplicationModel: require("./Lead/LeadApplicationModel"),
|
|
20
|
-
|
|
21
|
-
LogisticApplicationModel: require("./Logistic/LogisticApplicationModel"),
|
|
22
|
-
|
|
23
|
-
OrderApplicationModel: require("./Order/OrderApplicationModel"),
|
|
24
|
-
|
|
25
|
-
PaymentApplicationModel: require("./Payment/PaymentApplicationModel"),
|
|
26
|
-
|
|
27
|
-
RewardsApplicationModel: require("./Rewards/RewardsApplicationModel"),
|
|
28
|
-
|
|
29
|
-
ShareApplicationModel: require("./Share/ShareApplicationModel"),
|
|
30
|
-
|
|
31
|
-
ThemeApplicationModel: require("./Theme/ThemeApplicationModel"),
|
|
32
|
-
|
|
33
|
-
UserApplicationModel: require("./User/UserApplicationModel"),
|
|
34
|
-
|
|
35
|
-
WebhookApplicationModel: require("./Webhook/WebhookApplicationModel"),
|
|
36
|
-
},
|
|
37
4
|
};
|
package/sdk/common/Utility.d.ts
CHANGED
package/sdk/common/Utility.js
CHANGED
|
@@ -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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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) {
|
|
@@ -65,7 +68,7 @@ function convertUrlToAction(url) {
|
|
|
65
68
|
}
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
function convertActionToUrl(action) {
|
|
71
|
+
function convertActionToUrl(action, locale) {
|
|
69
72
|
if (action && action.page && action.page.type) {
|
|
70
73
|
switch (action.type) {
|
|
71
74
|
case utils.NAV_TYPE.PAGE: {
|
|
@@ -83,16 +86,16 @@ function convertActionToUrl(action) {
|
|
|
83
86
|
item.link +=
|
|
84
87
|
"/?" + utils.transformRequestOptions(action.page.query);
|
|
85
88
|
}
|
|
86
|
-
return item.link;
|
|
89
|
+
return locale ? `/${locale}${item.link}` : item.link;
|
|
87
90
|
}
|
|
88
|
-
return "";
|
|
91
|
+
return locale ? `/${locale}` : "";
|
|
89
92
|
}
|
|
90
93
|
case utils.NAV_TYPE.POPUP: {
|
|
91
94
|
break;
|
|
92
95
|
}
|
|
93
96
|
}
|
|
94
97
|
} else {
|
|
95
|
-
return "";
|
|
98
|
+
return locale ? `/${locale}` : "";
|
|
96
99
|
}
|
|
97
100
|
}
|
|
98
101
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function validateRequiredParams(params: any, requiredParams: any): any[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function validateRequiredParams(params, requiredParams) {
|
|
2
|
+
const errors = [];
|
|
3
|
+
requiredParams.forEach((key) => {
|
|
4
|
+
const value = params[key];
|
|
5
|
+
|
|
6
|
+
// Reject missing or empty values (except for boolean false)
|
|
7
|
+
if (
|
|
8
|
+
value === undefined ||
|
|
9
|
+
value === null ||
|
|
10
|
+
(typeof value !== "boolean" && value === "")
|
|
11
|
+
) {
|
|
12
|
+
errors.push(`Missing or empty required parameter: ${key}`);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
return errors;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
module.exports = {
|
|
19
|
+
validateRequiredParams,
|
|
20
|
+
};
|
package/sdk/common/utils.d.ts
CHANGED
|
@@ -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;
|
package/sdk/common/utils.js
CHANGED
|
@@ -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,
|
|
@@ -6,6 +6,7 @@ const querystring = require("query-string");
|
|
|
6
6
|
const { sign } = require("@gofynd/fp-signature");
|
|
7
7
|
const { convertStringToBase64 } = require("../common/utils");
|
|
8
8
|
|
|
9
|
+
const refreshTokenRequestCache = {};
|
|
9
10
|
class OAuthClient extends BaseOAuthClient {
|
|
10
11
|
constructor(config) {
|
|
11
12
|
super(config);
|
|
@@ -482,16 +482,7 @@ export = ThemePartnerModel;
|
|
|
482
482
|
*/
|
|
483
483
|
/**
|
|
484
484
|
* @typedef GlobalSchema
|
|
485
|
-
* @property {
|
|
486
|
-
*/
|
|
487
|
-
/**
|
|
488
|
-
* @typedef Prop
|
|
489
|
-
* @property {string} [type] - The type of the property
|
|
490
|
-
* @property {string} [category] - The category of the property
|
|
491
|
-
* @property {string} [value] - The value of the property
|
|
492
|
-
* @property {string} [id] - The ID of the property
|
|
493
|
-
* @property {string} [label] - The label of the property
|
|
494
|
-
* @property {string} [info] - Additional information about the property
|
|
485
|
+
* @property {Object[]} [props]
|
|
495
486
|
*/
|
|
496
487
|
/**
|
|
497
488
|
* @typedef Preset
|
|
@@ -656,7 +647,7 @@ export = ThemePartnerModel;
|
|
|
656
647
|
declare class ThemePartnerModel {
|
|
657
648
|
}
|
|
658
649
|
declare namespace ThemePartnerModel {
|
|
659
|
-
export { AvailablePageSchema, DraftExtensionSectionRequest, DraftExtensionSectionResponse, SectionsResponse, ExtensionSection, PropExtension, AssetsExtension, PublishExtensionSectionRequest, ExtensionPreviewRequest, ExtensionPreviewResponse, PublishExtensionSectionResponse, AvailablePageSectionMetaAttributes, AvailablePageSeo, SEOMetaItem, SEOMetaItems, SEOSitemap, SEObreadcrumb, Action, AvailablePageSchemaSections, AvailablePageScreenPredicate, AvailablePageUserPredicate, AvailablePageRoutePredicate, AvailablePagePlatformPredicate, AvailablePageSchedulePredicate, AvailablePagePredicate, MarketplaceThemeSchema, MarketplaceTheme, PaymentInfo, ContactInfo, CatalogSize, MarketplaceThemeImages, CarouselItem, ExploreInfo, Feature, FeatureItem, Highlight, Variation, Documentation, Comments, ThemeRejectionReasons, AllAvailablePageSchema, PaginationSchema, BlitzkriegApiErrorSchema, BlitzkriegInternalServerErrorSchema, ThemesSchema, Font, FontVariants, FontVariant, Config, ThemeConfiguration, OverlayPopup, DividerStrokeHighlight, UserAlerts, OrderTracking, ThemeConfigListPage, ThemeConfigListPageSettingsProps, CustomConfig, CustomProps, ThemeMeta, ThemePayment, Release, Images, Assets, UMDJs, CommonJS, CSS, SectionItem, GlobalSchema,
|
|
650
|
+
export { AvailablePageSchema, DraftExtensionSectionRequest, DraftExtensionSectionResponse, SectionsResponse, ExtensionSection, PropExtension, AssetsExtension, PublishExtensionSectionRequest, ExtensionPreviewRequest, ExtensionPreviewResponse, PublishExtensionSectionResponse, AvailablePageSectionMetaAttributes, AvailablePageSeo, SEOMetaItem, SEOMetaItems, SEOSitemap, SEObreadcrumb, Action, AvailablePageSchemaSections, AvailablePageScreenPredicate, AvailablePageUserPredicate, AvailablePageRoutePredicate, AvailablePagePlatformPredicate, AvailablePageSchedulePredicate, AvailablePagePredicate, MarketplaceThemeSchema, MarketplaceTheme, PaymentInfo, ContactInfo, CatalogSize, MarketplaceThemeImages, CarouselItem, ExploreInfo, Feature, FeatureItem, Highlight, Variation, Documentation, Comments, ThemeRejectionReasons, AllAvailablePageSchema, PaginationSchema, BlitzkriegApiErrorSchema, BlitzkriegInternalServerErrorSchema, ThemesSchema, Font, FontVariants, FontVariant, Config, ThemeConfiguration, OverlayPopup, DividerStrokeHighlight, UserAlerts, OrderTracking, ThemeConfigListPage, ThemeConfigListPageSettingsProps, CustomConfig, CustomProps, ThemeMeta, ThemePayment, Release, Images, Assets, UMDJs, CommonJS, CSS, SectionItem, GlobalSchema, Preset, Page, SectionProps, SectionPreset, ImagePickerProp, UrlProp, BlockProps, TextProp, CheckboxProp, RangeProp, Section, Block, Predicate, Screen, ThemeUserSchema, Route, UpdateThemeRequestBody, CreateNewTheme, ActionPage, PageType };
|
|
660
651
|
}
|
|
661
652
|
/** @returns {AvailablePageSchema} */
|
|
662
653
|
declare function AvailablePageSchema(): AvailablePageSchema;
|
|
@@ -1581,35 +1572,7 @@ type SectionItem = {
|
|
|
1581
1572
|
/** @returns {GlobalSchema} */
|
|
1582
1573
|
declare function GlobalSchema(): GlobalSchema;
|
|
1583
1574
|
type GlobalSchema = {
|
|
1584
|
-
props?:
|
|
1585
|
-
};
|
|
1586
|
-
/** @returns {Prop} */
|
|
1587
|
-
declare function Prop(): Prop;
|
|
1588
|
-
type Prop = {
|
|
1589
|
-
/**
|
|
1590
|
-
* - The type of the property
|
|
1591
|
-
*/
|
|
1592
|
-
type?: string;
|
|
1593
|
-
/**
|
|
1594
|
-
* - The category of the property
|
|
1595
|
-
*/
|
|
1596
|
-
category?: string;
|
|
1597
|
-
/**
|
|
1598
|
-
* - The value of the property
|
|
1599
|
-
*/
|
|
1600
|
-
value?: string;
|
|
1601
|
-
/**
|
|
1602
|
-
* - The ID of the property
|
|
1603
|
-
*/
|
|
1604
|
-
id?: string;
|
|
1605
|
-
/**
|
|
1606
|
-
* - The label of the property
|
|
1607
|
-
*/
|
|
1608
|
-
label?: string;
|
|
1609
|
-
/**
|
|
1610
|
-
* - Additional information about the property
|
|
1611
|
-
*/
|
|
1612
|
-
info?: string;
|
|
1575
|
+
props?: any[];
|
|
1613
1576
|
};
|
|
1614
1577
|
/** @returns {Preset} */
|
|
1615
1578
|
declare function Preset(): Preset;
|
|
@@ -550,17 +550,7 @@ const Joi = require("joi");
|
|
|
550
550
|
|
|
551
551
|
/**
|
|
552
552
|
* @typedef GlobalSchema
|
|
553
|
-
* @property {
|
|
554
|
-
*/
|
|
555
|
-
|
|
556
|
-
/**
|
|
557
|
-
* @typedef Prop
|
|
558
|
-
* @property {string} [type] - The type of the property
|
|
559
|
-
* @property {string} [category] - The category of the property
|
|
560
|
-
* @property {string} [value] - The value of the property
|
|
561
|
-
* @property {string} [id] - The ID of the property
|
|
562
|
-
* @property {string} [label] - The label of the property
|
|
563
|
-
* @property {string} [info] - Additional information about the property
|
|
553
|
+
* @property {Object[]} [props]
|
|
564
554
|
*/
|
|
565
555
|
|
|
566
556
|
/**
|
|
@@ -1428,19 +1418,7 @@ class ThemePartnerModel {
|
|
|
1428
1418
|
/** @returns {GlobalSchema} */
|
|
1429
1419
|
static GlobalSchema() {
|
|
1430
1420
|
return Joi.object({
|
|
1431
|
-
props: Joi.array().items(
|
|
1432
|
-
});
|
|
1433
|
-
}
|
|
1434
|
-
|
|
1435
|
-
/** @returns {Prop} */
|
|
1436
|
-
static Prop() {
|
|
1437
|
-
return Joi.object({
|
|
1438
|
-
type: Joi.string().allow(""),
|
|
1439
|
-
category: Joi.string().allow(""),
|
|
1440
|
-
value: Joi.string().allow(""),
|
|
1441
|
-
id: Joi.string().allow(""),
|
|
1442
|
-
label: Joi.string().allow(""),
|
|
1443
|
-
info: Joi.string().allow(""),
|
|
1421
|
+
props: Joi.array().items(Joi.any()),
|
|
1444
1422
|
});
|
|
1445
1423
|
}
|
|
1446
1424
|
|
|
@@ -13,6 +13,19 @@ declare class Cart {
|
|
|
13
13
|
* @description: Customers can add a new address to their cart to save details such as name, email, contact information, and address. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/cart/addAddress/).
|
|
14
14
|
*/
|
|
15
15
|
addAddress({ body, requestHeaders }?: CartPlatformApplicationValidator.AddAddressParam, { responseHeaders }?: object): Promise<CartPlatformModel.SaveAddressResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* @param {CartPlatformApplicationValidator.AddBulkPriceAdjustmentParam} arg
|
|
18
|
+
* - Arg object
|
|
19
|
+
*
|
|
20
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
21
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
22
|
+
* @returns {Promise<CartPlatformModel.BulkPriceAdjustmentResponse>} -
|
|
23
|
+
* Success response
|
|
24
|
+
* @name addBulkPriceAdjustment
|
|
25
|
+
* @summary: Create price adjustments in Bulk
|
|
26
|
+
* @description: Create custom price adjustments for items in the cart, facilitating the application of discounts or promotions. Price adjustments can be tailored based on specific sales channel contexts, enhancing flexibility in pricing strategies. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/cart/addBulkPriceAdjustment/).
|
|
27
|
+
*/
|
|
28
|
+
addBulkPriceAdjustment({ body, requestHeaders }?: CartPlatformApplicationValidator.AddBulkPriceAdjustmentParam, { responseHeaders }?: object): Promise<CartPlatformModel.BulkPriceAdjustmentResponse>;
|
|
16
29
|
/**
|
|
17
30
|
* @param {CartPlatformApplicationValidator.AddItemsParam} arg - Arg object
|
|
18
31
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
@@ -417,7 +430,7 @@ declare class Cart {
|
|
|
417
430
|
* @returns {Promise<CartPlatformModel.CartCheckoutResponse>} - Success response
|
|
418
431
|
* @name platformCheckoutCartV2
|
|
419
432
|
* @summary: Checkout cart
|
|
420
|
-
* @description: The checkout cart initiates the order creation process based on the items in the user
|
|
433
|
+
* @description: The checkout cart initiates the order creation process based on the items in the user's cart, their selected address, and chosen payment methods. It also supports multiple payment method options and revalidates the cart details to ensure a secure and seamless order placement. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/cart/platformCheckoutCartV2/).
|
|
421
434
|
*/
|
|
422
435
|
platformCheckoutCartV2({ body, id, requestHeaders }?: CartPlatformApplicationValidator.PlatformCheckoutCartV2Param, { responseHeaders }?: object): Promise<CartPlatformModel.CartCheckoutResponse>;
|
|
423
436
|
/**
|
|
@@ -440,6 +453,18 @@ declare class Cart {
|
|
|
440
453
|
* @description: Remove an existing customer address from the system. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/cart/removeAddress/).
|
|
441
454
|
*/
|
|
442
455
|
removeAddress({ id, userId, requestHeaders }?: CartPlatformApplicationValidator.RemoveAddressParam, { responseHeaders }?: object): Promise<CartPlatformModel.DeleteAddressResponse>;
|
|
456
|
+
/**
|
|
457
|
+
* @param {CartPlatformApplicationValidator.RemoveBulkPriceAdjustmentParam} arg
|
|
458
|
+
* - Arg object
|
|
459
|
+
*
|
|
460
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
461
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
462
|
+
* @returns {Promise<CartPlatformModel.SuccessMessage>} - Success response
|
|
463
|
+
* @name removeBulkPriceAdjustment
|
|
464
|
+
* @summary: Remove price adjustments in bulk.
|
|
465
|
+
* @description: Remove the applied price adjustments for specific items within the cart based on unique price adjustment IDs. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/cart/removeBulkPriceAdjustment/).
|
|
466
|
+
*/
|
|
467
|
+
removeBulkPriceAdjustment({ priceAdjustmentIds, requestHeaders }?: CartPlatformApplicationValidator.RemoveBulkPriceAdjustmentParam, { responseHeaders }?: object): Promise<CartPlatformModel.SuccessMessage>;
|
|
443
468
|
/**
|
|
444
469
|
* @param {CartPlatformApplicationValidator.RemoveCouponParam} arg - Arg object
|
|
445
470
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
@@ -502,6 +527,19 @@ declare class Cart {
|
|
|
502
527
|
* @description: Update the user address - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/cart/updateAddress/).
|
|
503
528
|
*/
|
|
504
529
|
updateAddress({ id, body, requestHeaders }?: CartPlatformApplicationValidator.UpdateAddressParam, { responseHeaders }?: object): Promise<CartPlatformModel.UpdateAddressResponse>;
|
|
530
|
+
/**
|
|
531
|
+
* @param {CartPlatformApplicationValidator.UpdateBulkPriceAdjustmentParam} arg
|
|
532
|
+
* - Arg object
|
|
533
|
+
*
|
|
534
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
535
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
536
|
+
* @returns {Promise<CartPlatformModel.BulkPriceAdjustmentResponse>} -
|
|
537
|
+
* Success response
|
|
538
|
+
* @name updateBulkPriceAdjustment
|
|
539
|
+
* @summary: Update price adjustments
|
|
540
|
+
* @description: Modify price adjustments for specific items in the cart. By providing the seller ID, sales channel ID, and price adjustment ID, seller can apply discounts or other adjustments to the prices of cart items, facilitating dynamic pricing strategies. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/cart/updateBulkPriceAdjustment/).
|
|
541
|
+
*/
|
|
542
|
+
updateBulkPriceAdjustment({ body, requestHeaders }?: CartPlatformApplicationValidator.UpdateBulkPriceAdjustmentParam, { responseHeaders }?: object): Promise<CartPlatformModel.BulkPriceAdjustmentResponse>;
|
|
505
543
|
/**
|
|
506
544
|
* @param {CartPlatformApplicationValidator.UpdateCartParam} arg - Arg object
|
|
507
545
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|