@gofynd/fdk-client-javascript 1.4.15-beta.1 → 1.4.15-beta.10

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.
Files changed (154) hide show
  1. package/README.md +2 -2
  2. package/application.d.ts +1 -2
  3. package/application.js +2 -3
  4. package/index.d.ts +1 -2
  5. package/index.js +7 -1
  6. package/package.json +2 -3
  7. package/sdk/application/ApplicationClient.js +0 -18
  8. package/sdk/application/Cart/CartApplicationClient.d.ts +55 -90
  9. package/sdk/application/Cart/CartApplicationClient.js +60 -1185
  10. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +80 -142
  11. package/sdk/application/Catalog/CatalogApplicationClient.js +148 -1293
  12. package/sdk/application/Common/CommonApplicationClient.d.ts +4 -8
  13. package/sdk/application/Common/CommonApplicationClient.js +5 -89
  14. package/sdk/application/Communication/CommunicationApplicationClient.d.ts +6 -19
  15. package/sdk/application/Communication/CommunicationApplicationClient.js +6 -145
  16. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +32 -73
  17. package/sdk/application/Configuration/ConfigurationApplicationClient.js +31 -718
  18. package/sdk/application/Content/ContentApplicationClient.d.ts +46 -78
  19. package/sdk/application/Content/ContentApplicationClient.js +77 -914
  20. package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +9 -12
  21. package/sdk/application/FileStorage/FileStorageApplicationClient.js +22 -125
  22. package/sdk/application/Lead/LeadApplicationClient.d.ts +10 -18
  23. package/sdk/application/Lead/LeadApplicationClient.js +32 -202
  24. package/sdk/application/Logistic/LogisticApplicationClient.d.ts +22 -39
  25. package/sdk/application/Logistic/LogisticApplicationClient.js +50 -478
  26. package/sdk/application/Order/OrderApplicationClient.d.ts +22 -42
  27. package/sdk/application/Order/OrderApplicationClient.js +86 -472
  28. package/sdk/application/Payment/PaymentApplicationClient.d.ts +92 -212
  29. package/sdk/application/Payment/PaymentApplicationClient.js +57 -2102
  30. package/sdk/application/Rewards/RewardsApplicationClient.d.ts +14 -28
  31. package/sdk/application/Rewards/RewardsApplicationClient.js +16 -305
  32. package/sdk/application/Share/ShareApplicationClient.d.ts +14 -24
  33. package/sdk/application/Share/ShareApplicationClient.js +34 -294
  34. package/sdk/application/Theme/ThemeApplicationClient.d.ts +8 -14
  35. package/sdk/application/Theme/ThemeApplicationClient.js +28 -162
  36. package/sdk/application/User/UserApplicationClient.d.ts +85 -136
  37. package/sdk/application/User/UserApplicationClient.js +45 -1815
  38. package/sdk/application/Webhook/WebhookApplicationClient.d.ts +2 -5
  39. package/sdk/application/Webhook/WebhookApplicationClient.js +4 -47
  40. package/sdk/application/index.d.ts +0 -18
  41. package/sdk/application/index.js +0 -33
  42. package/sdk/common/Utility.d.ts +1 -1
  43. package/sdk/common/Utility.js +10 -7
  44. package/sdk/common/Validator.d.ts +1 -0
  45. package/sdk/common/Validator.js +20 -0
  46. package/sdk/common/utils.d.ts +0 -1
  47. package/sdk/common/utils.js +0 -14
  48. package/sdk/partner/FileStorage/FileStoragePartnerModel.d.ts +2 -0
  49. package/sdk/partner/FileStorage/FileStoragePartnerModel.js +2 -0
  50. package/sdk/partner/OAuthClient.js +1 -0
  51. package/sdk/partner/Theme/ThemePartnerModel.d.ts +3 -40
  52. package/sdk/partner/Theme/ThemePartnerModel.js +2 -24
  53. package/sdk/platform/Cart/CartPlatformModel.d.ts +28 -0
  54. package/sdk/platform/Cart/CartPlatformModel.js +12 -0
  55. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +0 -7
  56. package/sdk/platform/Catalog/CatalogPlatformModel.js +1 -4
  57. package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +14 -0
  58. package/sdk/platform/Configuration/ConfigurationPlatformModel.js +6 -0
  59. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +3 -1
  60. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +3 -0
  61. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +3 -1
  62. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +3 -0
  63. package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +16 -1
  64. package/sdk/platform/FileStorage/FileStoragePlatformModel.js +20 -0
  65. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +0 -10
  66. package/sdk/platform/Order/OrderPlatformApplicationClient.js +0 -92
  67. package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -28
  68. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +0 -18
  69. package/sdk/platform/Order/OrderPlatformClient.d.ts +10 -0
  70. package/sdk/platform/Order/OrderPlatformClient.js +99 -0
  71. package/sdk/platform/Order/OrderPlatformModel.d.ts +7 -0
  72. package/sdk/platform/Order/OrderPlatformModel.js +3 -0
  73. package/sdk/platform/Order/OrderPlatformValidator.d.ts +33 -1
  74. package/sdk/platform/Order/OrderPlatformValidator.js +20 -0
  75. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +1 -1
  76. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +4 -4
  77. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +56 -19
  78. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +42 -18
  79. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +3 -3
  80. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +2 -2
  81. package/sdk/platform/Theme/ThemePlatformModel.d.ts +3 -40
  82. package/sdk/platform/Theme/ThemePlatformModel.js +2 -24
  83. package/sdk/public/Configuration/ConfigurationPublicClient.js +5 -2
  84. package/sdk/public/Content/ContentPublicClient.d.ts +1 -1
  85. package/sdk/public/Content/ContentPublicClient.js +14 -2
  86. package/sdk/public/Partner/PartnerPublicClient.d.ts +1 -1
  87. package/sdk/public/Partner/PartnerPublicClient.js +14 -2
  88. package/sdk/public/Webhook/WebhookPublicClient.js +5 -2
  89. package/sdk/application/Cart/CartApplicationModel.d.ts +0 -3994
  90. package/sdk/application/Cart/CartApplicationModel.js +0 -2497
  91. package/sdk/application/Cart/CartApplicationValidator.d.ts +0 -769
  92. package/sdk/application/Cart/CartApplicationValidator.js +0 -530
  93. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +0 -3857
  94. package/sdk/application/Catalog/CatalogApplicationModel.js +0 -2629
  95. package/sdk/application/Catalog/CatalogApplicationValidator.d.ts +0 -791
  96. package/sdk/application/Catalog/CatalogApplicationValidator.js +0 -551
  97. package/sdk/application/Common/CommonApplicationModel.d.ts +0 -449
  98. package/sdk/application/Common/CommonApplicationModel.js +0 -308
  99. package/sdk/application/Common/CommonApplicationValidator.d.ts +0 -46
  100. package/sdk/application/Common/CommonApplicationValidator.js +0 -38
  101. package/sdk/application/Communication/CommunicationApplicationModel.d.ts +0 -293
  102. package/sdk/application/Communication/CommunicationApplicationModel.js +0 -201
  103. package/sdk/application/Communication/CommunicationApplicationValidator.d.ts +0 -29
  104. package/sdk/application/Communication/CommunicationApplicationValidator.js +0 -38
  105. package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +0 -2556
  106. package/sdk/application/Configuration/ConfigurationApplicationModel.js +0 -1887
  107. package/sdk/application/Configuration/ConfigurationApplicationValidator.d.ts +0 -179
  108. package/sdk/application/Configuration/ConfigurationApplicationValidator.js +0 -176
  109. package/sdk/application/Content/ContentApplicationModel.d.ts +0 -2133
  110. package/sdk/application/Content/ContentApplicationModel.js +0 -1589
  111. package/sdk/application/Content/ContentApplicationValidator.d.ts +0 -284
  112. package/sdk/application/Content/ContentApplicationValidator.js +0 -264
  113. package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +0 -272
  114. package/sdk/application/FileStorage/FileStorageApplicationModel.js +0 -190
  115. package/sdk/application/FileStorage/FileStorageApplicationValidator.d.ts +0 -56
  116. package/sdk/application/FileStorage/FileStorageApplicationValidator.js +0 -53
  117. package/sdk/application/Lead/LeadApplicationModel.d.ts +0 -590
  118. package/sdk/application/Lead/LeadApplicationModel.js +0 -480
  119. package/sdk/application/Lead/LeadApplicationValidator.d.ts +0 -68
  120. package/sdk/application/Lead/LeadApplicationValidator.js +0 -71
  121. package/sdk/application/Logistic/LogisticApplicationModel.d.ts +0 -1675
  122. package/sdk/application/Logistic/LogisticApplicationModel.js +0 -1121
  123. package/sdk/application/Logistic/LogisticApplicationValidator.d.ts +0 -254
  124. package/sdk/application/Logistic/LogisticApplicationValidator.js +0 -190
  125. package/sdk/application/Order/OrderApplicationModel.d.ts +0 -2296
  126. package/sdk/application/Order/OrderApplicationModel.js +0 -1471
  127. package/sdk/application/Order/OrderApplicationValidator.d.ts +0 -265
  128. package/sdk/application/Order/OrderApplicationValidator.js +0 -197
  129. package/sdk/application/Payment/PaymentApplicationModel.d.ts +0 -4058
  130. package/sdk/application/Payment/PaymentApplicationModel.js +0 -2630
  131. package/sdk/application/Payment/PaymentApplicationValidator.d.ts +0 -576
  132. package/sdk/application/Payment/PaymentApplicationValidator.js +0 -594
  133. package/sdk/application/Rewards/RewardsApplicationModel.d.ts +0 -365
  134. package/sdk/application/Rewards/RewardsApplicationModel.js +0 -396
  135. package/sdk/application/Rewards/RewardsApplicationValidator.d.ts +0 -73
  136. package/sdk/application/Rewards/RewardsApplicationValidator.js +0 -84
  137. package/sdk/application/Share/ShareApplicationModel.d.ts +0 -339
  138. package/sdk/application/Share/ShareApplicationModel.js +0 -234
  139. package/sdk/application/Share/ShareApplicationValidator.d.ts +0 -90
  140. package/sdk/application/Share/ShareApplicationValidator.js +0 -91
  141. package/sdk/application/Theme/ThemeApplicationModel.d.ts +0 -1713
  142. package/sdk/application/Theme/ThemeApplicationModel.js +0 -1426
  143. package/sdk/application/Theme/ThemeApplicationValidator.d.ts +0 -66
  144. package/sdk/application/Theme/ThemeApplicationValidator.js +0 -58
  145. package/sdk/application/User/UserApplicationModel.d.ts +0 -1943
  146. package/sdk/application/User/UserApplicationModel.js +0 -1382
  147. package/sdk/application/User/UserApplicationValidator.d.ts +0 -560
  148. package/sdk/application/User/UserApplicationValidator.js +0 -573
  149. package/sdk/application/Webhook/WebhookApplicationModel.d.ts +0 -52
  150. package/sdk/application/Webhook/WebhookApplicationModel.js +0 -46
  151. package/sdk/application/Webhook/WebhookApplicationValidator.d.ts +0 -16
  152. package/sdk/application/Webhook/WebhookApplicationValidator.js +0 -19
  153. package/sdk/common/Clickstream.d.ts +0 -1
  154. package/sdk/common/Clickstream.js +0 -464
@@ -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 ThemeApplicationValidator = require("./ThemeApplicationValidator");
9
- const ThemeApplicationModel = require("./ThemeApplicationModel");
10
- const { Logger } = require("./../../common/Logger");
11
- const Joi = require("joi");
9
+ const { validateRequiredParams } = require("../../common/Validator");
12
10
 
13
11
  class Theme {
14
12
  constructor(_conf) {
@@ -36,10 +34,9 @@ class Theme {
36
34
  }
37
35
 
38
36
  /**
39
- * @param {ThemeApplicationValidator.GetAllPagesParam} arg - Arg object.
40
37
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
41
38
  * @param {import("../ApplicationAPIClient").Options} - Options
42
- * @returns {Promise<ThemeApplicationModel.AllAvailablePageSchema>} - Success response
39
+ * @returns {Promise<AllAvailablePageSchema>} - Success response
43
40
  * @name getAllPages
44
41
  * @summary: List pages
45
42
  * @description: Get all page level configs, sections and seo data of a theme. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/theme/getAllPages/).
@@ -48,26 +45,13 @@ class Theme {
48
45
  { themeId, requestHeaders } = { requestHeaders: {} },
49
46
  { responseHeaders } = { responseHeaders: false }
50
47
  ) {
51
- const { error } = ThemeApplicationValidator.getAllPages().validate(
52
- { themeId },
53
- { abortEarly: false, allowUnknown: true }
54
- );
55
- if (error) {
56
- return Promise.reject(new FDKClientValidationError(error));
57
- }
58
-
59
- // Showing warrnings if extra unknown parameters are found
60
- const {
61
- error: warrning,
62
- } = ThemeApplicationValidator.getAllPages().validate(
63
- { themeId },
64
- { abortEarly: false, allowUnknown: false }
65
- );
66
- if (warrning) {
67
- Logger({
68
- level: "WARN",
69
- message: `Parameter Validation warrnings for application > Theme > getAllPages \n ${warrning}`,
48
+ const errors = validateRequiredParams(arguments[0], ["themeId"]);
49
+ if (errors.length > 0) {
50
+ const error = new FDKClientValidationError({
51
+ message: "Missing required field",
52
+ details: errors,
70
53
  });
54
+ return Promise.reject(new FDKClientValidationError(error));
71
55
  }
72
56
 
73
57
  const query_params = {};
@@ -92,32 +76,13 @@ class Theme {
92
76
  responseData = response[0];
93
77
  }
94
78
 
95
- const {
96
- error: res_error,
97
- } = ThemeApplicationModel.AllAvailablePageSchema().validate(responseData, {
98
- abortEarly: false,
99
- allowUnknown: true,
100
- });
101
-
102
- if (res_error) {
103
- if (this._conf.options.strictResponseCheck === true) {
104
- return Promise.reject(new FDKResponseValidationError(res_error));
105
- } else {
106
- Logger({
107
- level: "WARN",
108
- message: `Response Validation Warnings for application > Theme > getAllPages \n ${res_error}`,
109
- });
110
- }
111
- }
112
-
113
79
  return response;
114
80
  }
115
81
 
116
82
  /**
117
- * @param {ThemeApplicationValidator.GetAppliedThemeParam} arg - Arg object.
118
83
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
119
84
  * @param {import("../ApplicationAPIClient").Options} - Options
120
- * @returns {Promise<ThemeApplicationModel.ThemesSchema>} - Success response
85
+ * @returns {Promise<ThemesSchema>} - Success response
121
86
  * @name getAppliedTheme
122
87
  * @summary: Get applied theme
123
88
  * @description: Gets the theme configuration and template details of a theme applied to the application. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/theme/getAppliedTheme/).
@@ -126,28 +91,6 @@ class Theme {
126
91
  { requestHeaders } = { requestHeaders: {} },
127
92
  { responseHeaders } = { responseHeaders: false }
128
93
  ) {
129
- const { error } = ThemeApplicationValidator.getAppliedTheme().validate(
130
- {},
131
- { abortEarly: false, allowUnknown: true }
132
- );
133
- if (error) {
134
- return Promise.reject(new FDKClientValidationError(error));
135
- }
136
-
137
- // Showing warrnings if extra unknown parameters are found
138
- const {
139
- error: warrning,
140
- } = ThemeApplicationValidator.getAppliedTheme().validate(
141
- {},
142
- { abortEarly: false, allowUnknown: false }
143
- );
144
- if (warrning) {
145
- Logger({
146
- level: "WARN",
147
- message: `Parameter Validation warrnings for application > Theme > getAppliedTheme \n ${warrning}`,
148
- });
149
- }
150
-
151
94
  const query_params = {};
152
95
 
153
96
  const xHeaders = {};
@@ -170,32 +113,13 @@ class Theme {
170
113
  responseData = response[0];
171
114
  }
172
115
 
173
- const {
174
- error: res_error,
175
- } = ThemeApplicationModel.ThemesSchema().validate(responseData, {
176
- abortEarly: false,
177
- allowUnknown: true,
178
- });
179
-
180
- if (res_error) {
181
- if (this._conf.options.strictResponseCheck === true) {
182
- return Promise.reject(new FDKResponseValidationError(res_error));
183
- } else {
184
- Logger({
185
- level: "WARN",
186
- message: `Response Validation Warnings for application > Theme > getAppliedTheme \n ${res_error}`,
187
- });
188
- }
189
- }
190
-
191
116
  return response;
192
117
  }
193
118
 
194
119
  /**
195
- * @param {ThemeApplicationValidator.GetPageParam} arg - Arg object.
196
120
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
197
121
  * @param {import("../ApplicationAPIClient").Options} - Options
198
- * @returns {Promise<ThemeApplicationModel.AvailablePageSchema>} - Success response
122
+ * @returns {Promise<AvailablePageSchema>} - Success response
199
123
  * @name getPage
200
124
  * @summary: Get theme page
201
125
  * @description: Get page level configurations, applied sections and seo data of a page by `page_value` received from list pages api. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/theme/getPage/).
@@ -211,24 +135,16 @@ class Theme {
211
135
  } = { requestHeaders: {} },
212
136
  { responseHeaders } = { responseHeaders: false }
213
137
  ) {
214
- const { error } = ThemeApplicationValidator.getPage().validate(
215
- { themeId, pageValue, filters, sectionPreviewHash, company },
216
- { abortEarly: false, allowUnknown: true }
217
- );
218
- if (error) {
219
- return Promise.reject(new FDKClientValidationError(error));
220
- }
221
-
222
- // Showing warrnings if extra unknown parameters are found
223
- const { error: warrning } = ThemeApplicationValidator.getPage().validate(
224
- { themeId, pageValue, filters, sectionPreviewHash, company },
225
- { abortEarly: false, allowUnknown: false }
226
- );
227
- if (warrning) {
228
- Logger({
229
- level: "WARN",
230
- message: `Parameter Validation warrnings for application > Theme > getPage \n ${warrning}`,
138
+ const errors = validateRequiredParams(arguments[0], [
139
+ "themeId",
140
+ "pageValue",
141
+ ]);
142
+ if (errors.length > 0) {
143
+ const error = new FDKClientValidationError({
144
+ message: "Missing required field",
145
+ details: errors,
231
146
  });
147
+ return Promise.reject(new FDKClientValidationError(error));
232
148
  }
233
149
 
234
150
  const query_params = {};
@@ -256,32 +172,13 @@ class Theme {
256
172
  responseData = response[0];
257
173
  }
258
174
 
259
- const {
260
- error: res_error,
261
- } = ThemeApplicationModel.AvailablePageSchema().validate(responseData, {
262
- abortEarly: false,
263
- allowUnknown: true,
264
- });
265
-
266
- if (res_error) {
267
- if (this._conf.options.strictResponseCheck === true) {
268
- return Promise.reject(new FDKResponseValidationError(res_error));
269
- } else {
270
- Logger({
271
- level: "WARN",
272
- message: `Response Validation Warnings for application > Theme > getPage \n ${res_error}`,
273
- });
274
- }
275
- }
276
-
277
175
  return response;
278
176
  }
279
177
 
280
178
  /**
281
- * @param {ThemeApplicationValidator.GetThemeForPreviewParam} arg - Arg object.
282
179
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
283
180
  * @param {import("../ApplicationAPIClient").Options} - Options
284
- * @returns {Promise<ThemeApplicationModel.ThemesSchema>} - Success response
181
+ * @returns {Promise<ThemesSchema>} - Success response
285
182
  * @name getThemeForPreview
286
183
  * @summary: Get theme for preview
287
184
  * @description: Gets the theme configuration and template details of a theme by theme id. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/theme/getThemeForPreview/).
@@ -290,26 +187,13 @@ class Theme {
290
187
  { themeId, requestHeaders } = { requestHeaders: {} },
291
188
  { responseHeaders } = { responseHeaders: false }
292
189
  ) {
293
- const { error } = ThemeApplicationValidator.getThemeForPreview().validate(
294
- { themeId },
295
- { abortEarly: false, allowUnknown: true }
296
- );
297
- if (error) {
298
- return Promise.reject(new FDKClientValidationError(error));
299
- }
300
-
301
- // Showing warrnings if extra unknown parameters are found
302
- const {
303
- error: warrning,
304
- } = ThemeApplicationValidator.getThemeForPreview().validate(
305
- { themeId },
306
- { abortEarly: false, allowUnknown: false }
307
- );
308
- if (warrning) {
309
- Logger({
310
- level: "WARN",
311
- message: `Parameter Validation warrnings for application > Theme > getThemeForPreview \n ${warrning}`,
190
+ const errors = validateRequiredParams(arguments[0], ["themeId"]);
191
+ if (errors.length > 0) {
192
+ const error = new FDKClientValidationError({
193
+ message: "Missing required field",
194
+ details: errors,
312
195
  });
196
+ return Promise.reject(new FDKClientValidationError(error));
313
197
  }
314
198
 
315
199
  const query_params = {};
@@ -334,24 +218,6 @@ class Theme {
334
218
  responseData = response[0];
335
219
  }
336
220
 
337
- const {
338
- error: res_error,
339
- } = ThemeApplicationModel.ThemesSchema().validate(responseData, {
340
- abortEarly: false,
341
- allowUnknown: true,
342
- });
343
-
344
- if (res_error) {
345
- if (this._conf.options.strictResponseCheck === true) {
346
- return Promise.reject(new FDKResponseValidationError(res_error));
347
- } else {
348
- Logger({
349
- level: "WARN",
350
- message: `Response Validation Warnings for application > Theme > getThemeForPreview \n ${res_error}`,
351
- });
352
- }
353
- }
354
-
355
221
  return response;
356
222
  }
357
223
  }