@gofynd/fdk-client-javascript 1.2.0 → 1.3.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 +44 -7
- package/package.json +1 -2
- package/sdk/application/ApplicationAPIClient.d.ts +3 -3
- package/sdk/application/ApplicationAPIClient.js +6 -4
- package/sdk/application/ApplicationClient.d.ts +2 -3
- package/sdk/application/ApplicationClient.js +1 -45
- package/sdk/application/ApplicationConfig.d.ts +46 -6
- package/sdk/application/ApplicationConfig.js +15 -16
- package/sdk/application/Cart/CartApplicationClient.d.ts +61 -33
- package/sdk/application/Cart/CartApplicationClient.js +225 -134
- package/sdk/application/Cart/CartApplicationModel.d.ts +4 -4
- package/sdk/application/Cart/CartApplicationModel.js +4 -4
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +61 -30
- package/sdk/application/Catalog/CatalogApplicationClient.js +234 -146
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +115 -13
- package/sdk/application/Catalog/CatalogApplicationModel.js +77 -12
- package/sdk/application/Common/CommonApplicationClient.d.ts +5 -3
- package/sdk/application/Common/CommonApplicationClient.js +13 -11
- package/sdk/application/Common/CommonApplicationModel.d.ts +3 -83
- package/sdk/application/Common/CommonApplicationModel.js +2 -58
- package/sdk/application/Communication/CommunicationApplicationClient.d.ts +9 -3
- package/sdk/application/Communication/CommunicationApplicationClient.js +25 -13
- package/sdk/application/Communication/CommunicationApplicationModel.d.ts +1 -34
- package/sdk/application/Communication/CommunicationApplicationModel.js +0 -36
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +46 -16
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +144 -68
- package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +1 -219
- package/sdk/application/Configuration/ConfigurationApplicationModel.js +0 -226
- package/sdk/application/Content/ContentApplicationClient.d.ts +49 -21
- package/sdk/application/Content/ContentApplicationClient.js +159 -80
- package/sdk/application/Content/ContentApplicationModel.d.ts +5 -622
- package/sdk/application/Content/ContentApplicationModel.js +11 -763
- package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +6 -3
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +20 -14
- package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +1 -152
- package/sdk/application/FileStorage/FileStorageApplicationModel.js +0 -180
- package/sdk/application/Lead/LeadApplicationClient.d.ts +14 -7
- package/sdk/application/Lead/LeadApplicationClient.js +50 -31
- package/sdk/application/Lead/LeadApplicationModel.d.ts +22 -741
- package/sdk/application/Lead/LeadApplicationModel.js +21 -481
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +11 -5
- package/sdk/application/Logistic/LogisticApplicationClient.js +41 -20
- package/sdk/application/Order/OrderApplicationClient.d.ts +24 -12
- package/sdk/application/Order/OrderApplicationClient.js +88 -56
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +91 -42
- package/sdk/application/Payment/PaymentApplicationClient.js +293 -194
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +36 -36
- package/sdk/application/Payment/PaymentApplicationModel.js +36 -36
- package/sdk/application/PosCart/PosCartApplicationClient.d.ts +59 -32
- package/sdk/application/PosCart/PosCartApplicationClient.js +214 -130
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +2 -2
- package/sdk/application/PosCart/PosCartApplicationModel.js +2 -2
- package/sdk/application/Rewards/RewardsApplicationClient.d.ts +16 -7
- package/sdk/application/Rewards/RewardsApplicationClient.js +56 -29
- package/sdk/application/Share/ShareApplicationClient.d.ts +15 -7
- package/sdk/application/Share/ShareApplicationClient.js +51 -31
- package/sdk/application/Share/ShareApplicationModel.d.ts +1 -33
- package/sdk/application/Share/ShareApplicationModel.js +0 -38
- package/sdk/application/Theme/ThemeApplicationClient.d.ts +9 -4
- package/sdk/application/Theme/ThemeApplicationClient.js +35 -18
- package/sdk/application/Theme/ThemeApplicationModel.d.ts +982 -312
- package/sdk/application/Theme/ThemeApplicationModel.js +621 -284
- package/sdk/application/User/UserApplicationClient.d.ts +74 -35
- package/sdk/application/User/UserApplicationClient.js +252 -161
- package/sdk/application/User/UserApplicationModel.d.ts +3 -401
- package/sdk/application/User/UserApplicationModel.js +2 -490
- package/sdk/common/AxiosHelper.js +1 -2
- package/sdk/common/FDKError.d.ts +3 -0
- package/sdk/common/FDKError.js +8 -0
- package/sdk/common/utils.d.ts +3 -0
- package/sdk/common/utils.js +29 -0
- package/sdk/partner/PartnerAPIClient.d.ts +5 -4
- package/sdk/partner/PartnerAPIClient.js +7 -4
- package/sdk/partner/PartnerClient.d.ts +2 -0
- package/sdk/partner/PartnerClient.js +3 -0
- package/sdk/partner/Theme/ThemePartnerClient.d.ts +299 -0
- package/sdk/partner/Theme/ThemePartnerClient.js +768 -0
- package/sdk/partner/Theme/ThemePartnerModel.d.ts +1706 -0
- package/sdk/partner/Theme/ThemePartnerModel.js +1409 -0
- package/sdk/partner/Theme/ThemePartnerValidator.d.ts +22 -0
- package/sdk/partner/Theme/ThemePartnerValidator.js +157 -0
- package/sdk/partner/index.d.ts +3 -1
- package/sdk/partner/index.js +3 -1
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +38 -16
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.d.ts +1 -13
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.js +0 -12
- package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.d.ts +10 -0
- package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.js +4 -0
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +59 -14
- package/sdk/platform/Billing/BillingPlatformClient.js +315 -64
- package/sdk/platform/Billing/BillingPlatformModel.d.ts +56 -196
- package/sdk/platform/Billing/BillingPlatformModel.js +63 -217
- package/sdk/platform/Billing/BillingPlatformValidator.d.ts +23 -1
- package/sdk/platform/Billing/BillingPlatformValidator.js +31 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +124 -63
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +431 -265
- package/sdk/platform/Cart/CartPlatformModel.d.ts +253 -53
- package/sdk/platform/Cart/CartPlatformModel.js +104 -54
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +120 -53
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +398 -247
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +155 -78
- package/sdk/platform/Catalog/CatalogPlatformClient.js +561 -355
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +10 -12
- package/sdk/platform/Catalog/CatalogPlatformModel.js +10 -12
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +30 -0
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +13 -0
- package/sdk/platform/Common/CommonPlatformClient.d.ts +5 -3
- package/sdk/platform/Common/CommonPlatformClient.js +13 -11
- package/sdk/platform/Common/CommonPlatformModel.d.ts +39 -64
- package/sdk/platform/Common/CommonPlatformModel.js +23 -57
- package/sdk/platform/Common/CommonPlatformValidator.d.ts +5 -10
- package/sdk/platform/Common/CommonPlatformValidator.js +3 -4
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +370 -120
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +2328 -888
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +143 -24
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +179 -15
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +6 -5
- package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +386 -308
- package/sdk/platform/Communication/CommunicationPlatformModel.js +415 -355
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +38 -13
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +171 -57
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +53 -1
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +54 -0
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.d.ts +5 -1
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +7 -0
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +96 -29
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +311 -126
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.d.ts +5 -1
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +7 -0
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +121 -86
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +13 -180
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +5 -113
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +162 -70
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +528 -309
- package/sdk/platform/Content/ContentPlatformModel.d.ts +9 -198
- package/sdk/platform/Content/ContentPlatformModel.js +8 -231
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +48 -11
- package/sdk/platform/Discount/DiscountPlatformClient.js +142 -48
- package/sdk/platform/Discount/DiscountPlatformModel.d.ts +40 -1
- package/sdk/platform/Discount/DiscountPlatformModel.js +27 -0
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +84 -18
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +486 -53
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +71 -7
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +81 -5
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +13 -18
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +58 -65
- package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +198 -71
- package/sdk/platform/FileStorage/FileStoragePlatformModel.js +212 -64
- package/sdk/platform/FileStorage/FileStoragePlatformValidator.d.ts +18 -10
- package/sdk/platform/FileStorage/FileStoragePlatformValidator.js +11 -6
- package/sdk/platform/Finance/FinancePlatformClient.d.ts +177 -40
- package/sdk/platform/Finance/FinancePlatformClient.js +1028 -132
- package/sdk/platform/Finance/FinancePlatformModel.d.ts +670 -22
- package/sdk/platform/Finance/FinancePlatformModel.js +809 -23
- package/sdk/platform/Finance/FinancePlatformValidator.d.ts +111 -1
- package/sdk/platform/Finance/FinancePlatformValidator.js +134 -0
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +24 -12
- package/sdk/platform/Inventory/InventoryPlatformClient.js +94 -52
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +27 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +101 -55
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +50 -39
- package/sdk/platform/Lead/LeadPlatformClient.js +171 -112
- package/sdk/platform/Lead/LeadPlatformModel.d.ts +32 -390
- package/sdk/platform/Lead/LeadPlatformModel.js +31 -214
- package/sdk/platform/Lead/LeadPlatformValidator.d.ts +33 -33
- package/sdk/platform/Lead/LeadPlatformValidator.js +23 -23
- package/sdk/platform/OAuthClient.js +6 -2
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +12 -10
- package/sdk/platform/Order/OrderPlatformClient.d.ts +165 -71
- package/sdk/platform/Order/OrderPlatformClient.js +738 -205
- package/sdk/platform/Order/OrderPlatformModel.d.ts +261 -3
- package/sdk/platform/Order/OrderPlatformModel.js +225 -2
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +104 -3
- package/sdk/platform/Order/OrderPlatformValidator.js +85 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -22
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +12 -159
- package/sdk/platform/Partner/PartnerPlatformApplicationValidator.d.ts +1 -30
- package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +0 -26
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -690
- package/sdk/platform/Partner/PartnerPlatformModel.js +0 -809
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +167 -32
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +793 -145
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +91 -1
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +91 -0
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +20 -10
- package/sdk/platform/Payment/PaymentPlatformClient.js +68 -47
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +549 -7
- package/sdk/platform/Payment/PaymentPlatformModel.js +305 -6
- package/sdk/platform/PlatformAPIClient.d.ts +3 -3
- package/sdk/platform/PlatformAPIClient.js +2 -2
- package/sdk/platform/PlatformClient.d.ts +2 -2
- package/sdk/platform/PlatformClient.js +4 -4
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +28 -12
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +90 -53
- package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +1 -12
- package/sdk/platform/Rewards/RewardsPlatformModel.js +0 -14
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +62 -26
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +210 -93
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.d.ts +20 -11
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.js +23 -11
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +36 -18
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +142 -78
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +12 -3
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +14 -2
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +10 -26
- package/sdk/platform/Share/SharePlatformApplicationClient.js +36 -67
- package/sdk/platform/Share/SharePlatformModel.d.ts +4 -4
- package/sdk/platform/Share/SharePlatformModel.js +4 -4
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +127 -57
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +564 -189
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.d.ts +63 -26
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +62 -22
- package/sdk/platform/Theme/ThemePlatformClient.d.ts +37 -0
- package/sdk/platform/Theme/ThemePlatformClient.js +235 -0
- package/sdk/platform/Theme/ThemePlatformModel.d.ts +1167 -261
- package/sdk/platform/Theme/ThemePlatformModel.js +801 -244
- package/sdk/platform/Theme/ThemePlatformValidator.d.ts +32 -0
- package/sdk/platform/Theme/ThemePlatformValidator.js +38 -0
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +35 -17
- package/sdk/platform/User/UserPlatformApplicationClient.js +132 -73
- package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +7 -0
- package/sdk/platform/User/UserPlatformApplicationValidator.js +3 -0
- package/sdk/platform/User/UserPlatformModel.d.ts +1 -738
- package/sdk/platform/User/UserPlatformModel.js +3 -899
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +120 -7
- package/sdk/platform/Webhook/WebhookPlatformClient.js +799 -41
- package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +476 -86
- package/sdk/platform/Webhook/WebhookPlatformModel.js +388 -89
- package/sdk/platform/Webhook/WebhookPlatformValidator.d.ts +96 -9
- package/sdk/platform/Webhook/WebhookPlatformValidator.js +117 -5
- package/sdk/public/Configuration/ConfigurationPublicClient.d.ts +5 -3
- package/sdk/public/Configuration/ConfigurationPublicClient.js +13 -11
- package/sdk/public/Configuration/ConfigurationPublicModel.d.ts +3 -106
- package/sdk/public/Configuration/ConfigurationPublicModel.js +2 -59
- package/sdk/public/Inventory/InventoryPublicClient.d.ts +12 -6
- package/sdk/public/Inventory/InventoryPublicClient.js +42 -27
- package/sdk/public/Partner/PartnerPublicClient.d.ts +22 -0
- package/sdk/public/Partner/PartnerPublicClient.js +110 -0
- package/sdk/public/Partner/PartnerPublicModel.d.ts +240 -0
- package/sdk/public/Partner/PartnerPublicModel.js +280 -0
- package/sdk/public/Partner/PartnerPublicValidator.d.ts +18 -0
- package/sdk/public/Partner/PartnerPublicValidator.js +19 -0
- package/sdk/public/PublicAPIClient.d.ts +14 -1
- package/sdk/public/PublicAPIClient.js +7 -1
- package/sdk/public/PublicClient.d.ts +2 -0
- package/sdk/public/PublicClient.js +4 -0
- package/sdk/public/Webhook/WebhookPublicClient.d.ts +5 -2
- package/sdk/public/Webhook/WebhookPublicClient.js +15 -9
- package/sdk/public/Webhook/WebhookPublicModel.d.ts +1 -191
- package/sdk/public/Webhook/WebhookPublicModel.js +0 -229
- package/sdk/public/index.d.ts +1 -0
- package/sdk/public/index.js +2 -0
- package/sdk/application/ApplicationModels.d.ts +0 -48
- package/sdk/application/ApplicationModels.js +0 -38
- package/sdk/platform/Partner/PartnerPlatformClient.d.ts +0 -106
- package/sdk/platform/Partner/PartnerPlatformClient.js +0 -878
- package/sdk/platform/Partner/PartnerPlatformValidator.d.ts +0 -208
- package/sdk/platform/Partner/PartnerPlatformValidator.js +0 -169
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Get started with the Javascript Development SDK for Fynd Platform
|
|
|
15
15
|
|
|
16
16
|
#### Node
|
|
17
17
|
|
|
18
|
-
```
|
|
18
|
+
```bash
|
|
19
19
|
npm install @gofynd/fdk-client-javascript
|
|
20
20
|
```
|
|
21
21
|
|
|
@@ -29,21 +29,23 @@ const {
|
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
#### Browser
|
|
32
|
+
|
|
32
33
|
you can load fdk-client-javascript's application browser bundle from CDN; `ApplicationConfig`, `ApplicationClient` and `ApplicationModels` will be attached to browser's `window` object.
|
|
33
34
|
|
|
34
35
|
```html
|
|
35
36
|
<script src="https://cdn.jsdelivr.net/gh/gofynd/fdk-client-javascript@<version>/dist/application.js"></script>
|
|
36
37
|
```
|
|
38
|
+
|
|
37
39
|
Install Specific version
|
|
40
|
+
|
|
38
41
|
```html
|
|
39
|
-
<script src="https://cdn.jsdelivr.net/gh/gofynd/fdk-client-javascript@1.0
|
|
42
|
+
<script src="https://cdn.jsdelivr.net/gh/gofynd/fdk-client-javascript@1.1.0/dist/application.js"></script>
|
|
40
43
|
```
|
|
41
44
|
|
|
42
45
|
```js
|
|
43
46
|
const { ApplicationConfig, ApplicationClient } = window;
|
|
44
47
|
```
|
|
45
48
|
|
|
46
|
-
|
|
47
49
|
### Logging
|
|
48
50
|
|
|
49
51
|
For logging support user can pass `logLevel` in `ApplicationConfig` or `PlatformConfig` while declaration.
|
|
@@ -53,6 +55,7 @@ Available logging levels: TRACE, DEBUG, INFO, WARN, ERROR.
|
|
|
53
55
|
|
|
54
56
|
Default log level: ERROR
|
|
55
57
|
```
|
|
58
|
+
|
|
56
59
|
### Sample Usage - ApplicationClient
|
|
57
60
|
|
|
58
61
|
```javascript
|
|
@@ -121,7 +124,9 @@ async function getData() {
|
|
|
121
124
|
|
|
122
125
|
getData();
|
|
123
126
|
```
|
|
127
|
+
|
|
124
128
|
---
|
|
129
|
+
|
|
125
130
|
### Cookie
|
|
126
131
|
|
|
127
132
|
Following code snippet will read and write cookies on behalf of you <br />
|
|
@@ -142,19 +147,43 @@ module.exports = cookieJar
|
|
|
142
147
|
```
|
|
143
148
|
|
|
144
149
|
get the stored cookie from the CookieJar instance
|
|
150
|
+
|
|
145
151
|
```javascript
|
|
146
152
|
const cookieJar = require('path/to/cookieJar') // replace with actual path
|
|
147
153
|
|
|
148
154
|
let cookies = await cookieJar.getCookies("https://api.fynd.com");
|
|
149
155
|
```
|
|
156
|
+
|
|
150
157
|
---
|
|
151
|
-
|
|
152
|
-
|
|
158
|
+
|
|
159
|
+
### Headers
|
|
160
|
+
|
|
161
|
+
#### Adding Request Headers
|
|
162
|
+
|
|
163
|
+
To include request headers when calling a method, add `requestHeaders` object in the first argument.
|
|
164
|
+
|
|
165
|
+
```javascript
|
|
166
|
+
const requestHeaders = {
|
|
167
|
+
"x-api-version": "1.0"
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
const options = {
|
|
171
|
+
responseHeaders: true
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const [response, headers] = await platformClient.application("<APPLICATION_ID>").theme.getAllPages({theme_id: "<THEME_ID>", requestHeaders: requestHeaders}, options);
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
#### get Response Headers
|
|
178
|
+
|
|
179
|
+
To retrieve the response headers, simply set the `responseHeaders` option to `true` when calling the desired method. Below is an example demonstrating how to achieve this:
|
|
180
|
+
|
|
153
181
|
```javascript
|
|
154
182
|
const options = {
|
|
155
|
-
|
|
183
|
+
responseHeaders: true
|
|
156
184
|
}
|
|
157
|
-
const [response, headers] = await platformClient.application("<APPLICATION_ID>").theme.getAllPages
|
|
185
|
+
const [response, headers] = await platformClient.application("<APPLICATION_ID>").theme.getAllPages({theme_id: "<THEME_ID>"}, options);
|
|
186
|
+
|
|
158
187
|
console.log("[API RESPONSE]: ", response);
|
|
159
188
|
console.log("[RESPONSE HEADERS]: ", headers);
|
|
160
189
|
```
|
|
@@ -162,7 +191,9 @@ console.log("[RESPONSE HEADERS]: ", headers);
|
|
|
162
191
|
---
|
|
163
192
|
|
|
164
193
|
### Log Curl
|
|
194
|
+
|
|
165
195
|
To print the curl command in the console for all network calls made using `applicationClient` or `platformClient`, set the logger level to debug.
|
|
196
|
+
|
|
166
197
|
```javascript
|
|
167
198
|
const {
|
|
168
199
|
ApplicationClient, ApplicationConfig,
|
|
@@ -179,12 +210,16 @@ let applicationClient = new ApplicationClient(applicationConfig);
|
|
|
179
210
|
let response = await applicationClient.theme.getAppliedTheme();
|
|
180
211
|
console.log("Active Theme: ", response.information.name);
|
|
181
212
|
```
|
|
213
|
+
|
|
182
214
|
The above code will log the curl command in the console
|
|
215
|
+
|
|
183
216
|
```bash
|
|
184
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: 0.1.36' --header 'x-fp-date: 20230222T115108Z' --header 'x-fp-signature: v1.1:1e3ab3b02b5bc626e3c32a37ee844266ade02bbcbaafc28fc7a0e46a76a7a1a8'
|
|
185
218
|
Active Theme: Emerge
|
|
186
219
|
```
|
|
220
|
+
|
|
187
221
|
---
|
|
222
|
+
|
|
188
223
|
### TypeScript
|
|
189
224
|
|
|
190
225
|
fdk-client-javascript includes Typescript definitions.
|
|
@@ -192,7 +227,9 @@ fdk-client-javascript includes Typescript definitions.
|
|
|
192
227
|
```typescript
|
|
193
228
|
import { ApplicationConfig, ApplicationClient } from "fdk-client-javascript";
|
|
194
229
|
```
|
|
230
|
+
|
|
195
231
|
---
|
|
232
|
+
|
|
196
233
|
### Documentation
|
|
197
234
|
|
|
198
235
|
- [Application Front](documentation/application/README.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gofynd/fdk-client-javascript",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
"axios": "^0.27.2",
|
|
16
16
|
"camelcase": "^6.3.0",
|
|
17
17
|
"crypto-js": "^4.1.1",
|
|
18
|
-
"isomorphic-base64": "^1.0.2",
|
|
19
18
|
"joi": "^17.7.0",
|
|
20
19
|
"loglevel": "^1.8.1",
|
|
21
20
|
"query-string": "^7.1.3"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export = APIClient;
|
|
2
2
|
/**
|
|
3
3
|
* @typedef {Object} Options
|
|
4
|
-
* @property {boolean}
|
|
4
|
+
* @property {boolean} responseHeaders - Whether response headers are returned or not.
|
|
5
5
|
*/
|
|
6
6
|
declare class APIClient {
|
|
7
7
|
/**
|
|
@@ -19,7 +19,7 @@ declare namespace APIClient {
|
|
|
19
19
|
}
|
|
20
20
|
type Options = {
|
|
21
21
|
/**
|
|
22
|
-
* - Whether headers are returned or not.
|
|
22
|
+
* - Whether response headers are returned or not.
|
|
23
23
|
*/
|
|
24
|
-
|
|
24
|
+
responseHeaders: boolean;
|
|
25
25
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const { fdkAxios } = require("../common/AxiosHelper");
|
|
2
|
-
const {
|
|
2
|
+
const { convertStringToBase64 } = require("../common/utils");
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @typedef {Object} Options
|
|
6
|
-
* @property {boolean}
|
|
6
|
+
* @property {boolean} responseHeaders - Whether response headers are returned or not.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
class APIClient {
|
|
@@ -17,7 +17,9 @@ class APIClient {
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
static execute(conf, method, url, query, body, xHeaders, options) {
|
|
20
|
-
const token =
|
|
20
|
+
const token = convertStringToBase64(
|
|
21
|
+
`${conf.applicationID}:${conf.applicationToken}`
|
|
22
|
+
);
|
|
21
23
|
|
|
22
24
|
let headers = { Authorization: "Bearer " + token };
|
|
23
25
|
if (conf.cookie) {
|
|
@@ -43,7 +45,7 @@ class APIClient {
|
|
|
43
45
|
params: query,
|
|
44
46
|
data: body,
|
|
45
47
|
headers: { ...headers, ...extraHeaders, ...xHeaders },
|
|
46
|
-
|
|
48
|
+
responseHeaders: options.responseHeaders,
|
|
47
49
|
};
|
|
48
50
|
rawRequest = JSON.parse(JSON.stringify(rawRequest));
|
|
49
51
|
|
|
@@ -34,11 +34,10 @@ declare class ApplicationClient {
|
|
|
34
34
|
/**
|
|
35
35
|
* Sets the location details for the application.
|
|
36
36
|
*
|
|
37
|
-
* @param {import("./
|
|
37
|
+
* @param {import("./ApplicationConfig").LocationObject} locationDetails -
|
|
38
38
|
* The location details to set.
|
|
39
|
-
* @throws {FDKClientValidationError} When the location details validation fails.
|
|
40
39
|
*/
|
|
41
|
-
setLocationDetails(locationDetails: import("./
|
|
40
|
+
setLocationDetails(locationDetails: import("./ApplicationConfig").LocationObject): void;
|
|
42
41
|
/**
|
|
43
42
|
* Sets the currency code in ApplicationConfig.
|
|
44
43
|
*
|
|
@@ -1,37 +1,19 @@
|
|
|
1
|
-
const { LocationValidator } = require("./ApplicationModels");
|
|
2
|
-
|
|
3
1
|
const Cart = require("./Cart/CartApplicationClient");
|
|
4
|
-
|
|
5
2
|
const Catalog = require("./Catalog/CatalogApplicationClient");
|
|
6
|
-
|
|
7
3
|
const Common = require("./Common/CommonApplicationClient");
|
|
8
|
-
|
|
9
4
|
const Communication = require("./Communication/CommunicationApplicationClient");
|
|
10
|
-
|
|
11
5
|
const Configuration = require("./Configuration/ConfigurationApplicationClient");
|
|
12
|
-
|
|
13
6
|
const Content = require("./Content/ContentApplicationClient");
|
|
14
|
-
|
|
15
7
|
const FileStorage = require("./FileStorage/FileStorageApplicationClient");
|
|
16
|
-
|
|
17
8
|
const Lead = require("./Lead/LeadApplicationClient");
|
|
18
|
-
|
|
19
9
|
const Logistic = require("./Logistic/LogisticApplicationClient");
|
|
20
|
-
|
|
21
10
|
const Order = require("./Order/OrderApplicationClient");
|
|
22
|
-
|
|
23
11
|
const Payment = require("./Payment/PaymentApplicationClient");
|
|
24
|
-
|
|
25
12
|
const PosCart = require("./PosCart/PosCartApplicationClient");
|
|
26
|
-
|
|
27
13
|
const Rewards = require("./Rewards/RewardsApplicationClient");
|
|
28
|
-
|
|
29
14
|
const Share = require("./Share/ShareApplicationClient");
|
|
30
|
-
|
|
31
15
|
const Theme = require("./Theme/ThemeApplicationClient");
|
|
32
|
-
|
|
33
16
|
const User = require("./User/UserApplicationClient");
|
|
34
|
-
|
|
35
17
|
const { FDKClientValidationError } = require("../common/FDKError");
|
|
36
18
|
|
|
37
19
|
/**
|
|
@@ -43,37 +25,21 @@ class ApplicationClient {
|
|
|
43
25
|
/** @param {import("./ApplicationConfig")} config - The application configuration. */
|
|
44
26
|
constructor(config) {
|
|
45
27
|
this.config = config;
|
|
46
|
-
|
|
47
28
|
this.cart = new Cart(config);
|
|
48
|
-
|
|
49
29
|
this.catalog = new Catalog(config);
|
|
50
|
-
|
|
51
30
|
this.common = new Common(config);
|
|
52
|
-
|
|
53
31
|
this.communication = new Communication(config);
|
|
54
|
-
|
|
55
32
|
this.configuration = new Configuration(config);
|
|
56
|
-
|
|
57
33
|
this.content = new Content(config);
|
|
58
|
-
|
|
59
34
|
this.fileStorage = new FileStorage(config);
|
|
60
|
-
|
|
61
35
|
this.lead = new Lead(config);
|
|
62
|
-
|
|
63
36
|
this.logistic = new Logistic(config);
|
|
64
|
-
|
|
65
37
|
this.order = new Order(config);
|
|
66
|
-
|
|
67
38
|
this.payment = new Payment(config);
|
|
68
|
-
|
|
69
39
|
this.posCart = new PosCart(config);
|
|
70
|
-
|
|
71
40
|
this.rewards = new Rewards(config);
|
|
72
|
-
|
|
73
41
|
this.share = new Share(config);
|
|
74
|
-
|
|
75
42
|
this.theme = new Theme(config);
|
|
76
|
-
|
|
77
43
|
this.user = new User(config);
|
|
78
44
|
}
|
|
79
45
|
|
|
@@ -90,20 +56,10 @@ class ApplicationClient {
|
|
|
90
56
|
/**
|
|
91
57
|
* Sets the location details for the application.
|
|
92
58
|
*
|
|
93
|
-
* @param {import("./
|
|
59
|
+
* @param {import("./ApplicationConfig").LocationObject} locationDetails -
|
|
94
60
|
* The location details to set.
|
|
95
|
-
* @throws {FDKClientValidationError} When the location details validation fails.
|
|
96
61
|
*/
|
|
97
62
|
setLocationDetails(locationDetails) {
|
|
98
|
-
const {
|
|
99
|
-
error,
|
|
100
|
-
} = LocationValidator.validateLocationObj().validate(locationDetails, {
|
|
101
|
-
abortEarly: false,
|
|
102
|
-
allowUnknown: true,
|
|
103
|
-
});
|
|
104
|
-
if (error) {
|
|
105
|
-
throw new FDKClientValidationError(error);
|
|
106
|
-
}
|
|
107
63
|
this.config.locationDetails = {
|
|
108
64
|
...this.config.locationDetails,
|
|
109
65
|
...locationDetails,
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
export = ApplicationConfig;
|
|
2
|
+
/**
|
|
3
|
+
* Represents the location object for validation.
|
|
4
|
+
*
|
|
5
|
+
* @typedef {Object} LocationObject
|
|
6
|
+
* @property {string} pincode - The pincode of the location.
|
|
7
|
+
* @property {string} country - The country of the location.
|
|
8
|
+
* @property {string} country_iso_code - The ISO code of the country.
|
|
9
|
+
* @property {string} city - The city of the location.
|
|
10
|
+
* @property {Object} location - The geographical coordinates of the location.
|
|
11
|
+
* @property {string} location.longitude - The longitude of the location.
|
|
12
|
+
* @property {string} location.latitude - The latitude of the location.
|
|
13
|
+
*/
|
|
2
14
|
/**
|
|
3
15
|
* Represents the configuration for an application.
|
|
4
16
|
*
|
|
@@ -14,9 +26,7 @@ declare class ApplicationConfig {
|
|
|
14
26
|
* API. \n Write full domain. Default is `'https://api.fynd.com'`
|
|
15
27
|
* @param {logLevelEnum} [_conf.logLevel='ERROR'] - The log level. Available
|
|
16
28
|
* options: TRACE, DEBUG, INFO, WARN, ERROR. Default is `'ERROR'`
|
|
17
|
-
* @param {
|
|
18
|
-
* - The location details.
|
|
19
|
-
*
|
|
29
|
+
* @param {LocationObject} [_conf.locationDetails] - The location details.
|
|
20
30
|
* @param {string} [_conf.currencyCode='INR'] - The currency code. Default is `'INR'`
|
|
21
31
|
* @param {object} [_opts] - Additional options.
|
|
22
32
|
*/
|
|
@@ -25,7 +35,7 @@ declare class ApplicationConfig {
|
|
|
25
35
|
applicationToken?: string;
|
|
26
36
|
domain?: string;
|
|
27
37
|
logLevel?: "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR";
|
|
28
|
-
locationDetails?:
|
|
38
|
+
locationDetails?: LocationObject;
|
|
29
39
|
currencyCode?: string;
|
|
30
40
|
}, _opts?: object);
|
|
31
41
|
applicationID: string;
|
|
@@ -34,7 +44,7 @@ declare class ApplicationConfig {
|
|
|
34
44
|
domain: string;
|
|
35
45
|
logLevel: "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR";
|
|
36
46
|
extraHeaders: any[];
|
|
37
|
-
locationDetails:
|
|
47
|
+
locationDetails: LocationObject;
|
|
38
48
|
currencyCode: string;
|
|
39
49
|
/**
|
|
40
50
|
* Sets the log level for the application.
|
|
@@ -53,8 +63,38 @@ declare class ApplicationConfig {
|
|
|
53
63
|
/**
|
|
54
64
|
* Validates the application configuration.
|
|
55
65
|
*
|
|
56
|
-
* @throws {FDKClientValidationError} When the locationDetails validation fails.
|
|
57
66
|
* @throws {FDKInvalidCredentialError} When the credentials are invalid or missing.
|
|
58
67
|
*/
|
|
59
68
|
validate(): void;
|
|
60
69
|
}
|
|
70
|
+
declare namespace ApplicationConfig {
|
|
71
|
+
export { LocationObject };
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Represents the location object for validation.
|
|
75
|
+
*/
|
|
76
|
+
type LocationObject = {
|
|
77
|
+
/**
|
|
78
|
+
* - The pincode of the location.
|
|
79
|
+
*/
|
|
80
|
+
pincode: string;
|
|
81
|
+
/**
|
|
82
|
+
* - The country of the location.
|
|
83
|
+
*/
|
|
84
|
+
country: string;
|
|
85
|
+
/**
|
|
86
|
+
* - The ISO code of the country.
|
|
87
|
+
*/
|
|
88
|
+
country_iso_code: string;
|
|
89
|
+
/**
|
|
90
|
+
* - The city of the location.
|
|
91
|
+
*/
|
|
92
|
+
city: string;
|
|
93
|
+
/**
|
|
94
|
+
* - The geographical coordinates of the location.
|
|
95
|
+
*/
|
|
96
|
+
location: {
|
|
97
|
+
longitude: string;
|
|
98
|
+
latitude: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
const {
|
|
2
|
-
FDKInvalidCredentialError,
|
|
3
|
-
FDKClientValidationError,
|
|
4
|
-
} = require("../common/FDKError");
|
|
1
|
+
const { FDKInvalidCredentialError } = require("../common/FDKError");
|
|
5
2
|
const { Logger, setLoggerLevel } = require("../common/Logger");
|
|
6
|
-
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Represents the location object for validation.
|
|
6
|
+
*
|
|
7
|
+
* @typedef {Object} LocationObject
|
|
8
|
+
* @property {string} pincode - The pincode of the location.
|
|
9
|
+
* @property {string} country - The country of the location.
|
|
10
|
+
* @property {string} country_iso_code - The ISO code of the country.
|
|
11
|
+
* @property {string} city - The city of the location.
|
|
12
|
+
* @property {Object} location - The geographical coordinates of the location.
|
|
13
|
+
* @property {string} location.longitude - The longitude of the location.
|
|
14
|
+
* @property {string} location.latitude - The latitude of the location.
|
|
15
|
+
*/
|
|
7
16
|
|
|
8
17
|
/**
|
|
9
18
|
* Represents the configuration for an application.
|
|
@@ -21,9 +30,7 @@ class ApplicationConfig {
|
|
|
21
30
|
* API. \n Write full domain. Default is `'https://api.fynd.com'`
|
|
22
31
|
* @param {logLevelEnum} [_conf.logLevel='ERROR'] - The log level. Available
|
|
23
32
|
* options: TRACE, DEBUG, INFO, WARN, ERROR. Default is `'ERROR'`
|
|
24
|
-
* @param {
|
|
25
|
-
* - The location details.
|
|
26
|
-
*
|
|
33
|
+
* @param {LocationObject} [_conf.locationDetails] - The location details.
|
|
27
34
|
* @param {string} [_conf.currencyCode='INR'] - The currency code. Default is `'INR'`
|
|
28
35
|
* @param {object} [_opts] - Additional options.
|
|
29
36
|
*/
|
|
@@ -63,17 +70,9 @@ class ApplicationConfig {
|
|
|
63
70
|
/**
|
|
64
71
|
* Validates the application configuration.
|
|
65
72
|
*
|
|
66
|
-
* @throws {FDKClientValidationError} When the locationDetails validation fails.
|
|
67
73
|
* @throws {FDKInvalidCredentialError} When the credentials are invalid or missing.
|
|
68
74
|
*/
|
|
69
75
|
validate() {
|
|
70
|
-
const { error } = LocationValidator.validateLocationObj().validate(
|
|
71
|
-
this.locationDetails,
|
|
72
|
-
{ abortEarly: false, allowUnknown: true }
|
|
73
|
-
);
|
|
74
|
-
if (error) {
|
|
75
|
-
throw new FDKClientValidationError(error);
|
|
76
|
-
}
|
|
77
76
|
if (!this.applicationID) {
|
|
78
77
|
Logger({ level: "ERROR", message: "No Application ID Present" });
|
|
79
78
|
throw new FDKInvalidCredentialError("No Application ID Present");
|