@gofynd/fdk-client-javascript 1.0.3 → 1.1.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 +51 -2
- package/index.d.ts +7 -4
- package/index.js +22 -7
- package/package.json +23 -14
- package/partner.d.ts +4 -0
- package/partner.js +7 -0
- package/sdk/application/ApplicationAPIClient.js +2 -4
- package/sdk/application/Cart/CartApplicationClient.js +29 -28
- package/sdk/application/Cart/CartApplicationModel.js +3 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +43 -42
- package/sdk/application/Catalog/CatalogApplicationModel.js +5 -3
- package/sdk/application/Common/CommonApplicationClient.js +5 -4
- package/sdk/application/Communication/CommunicationApplicationClient.js +6 -5
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +21 -20
- package/sdk/application/Content/ContentApplicationClient.js +26 -25
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +6 -5
- package/sdk/application/Lead/LeadApplicationClient.js +10 -9
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +1 -3
- package/sdk/application/Logistic/LogisticApplicationClient.js +11 -12
- package/sdk/application/Logistic/LogisticApplicationValidator.js +0 -1
- package/sdk/application/Order/OrderApplicationClient.js +15 -14
- package/sdk/application/Order/OrderApplicationModel.js +9 -0
- package/sdk/application/Payment/PaymentApplicationClient.js +42 -41
- package/sdk/application/PosCart/PosCartApplicationClient.js +30 -29
- package/sdk/application/PosCart/PosCartApplicationModel.js +3 -1
- package/sdk/application/Rewards/RewardsApplicationClient.js +11 -10
- package/sdk/application/Share/ShareApplicationClient.js +10 -9
- package/sdk/application/Theme/ThemeApplicationClient.js +7 -6
- package/sdk/application/User/UserApplicationClient.js +38 -37
- package/sdk/common/AxiosHelper.js +17 -6
- package/sdk/common/BaseOAuthClient.d.ts +17 -0
- package/sdk/common/BaseOAuthClient.js +67 -0
- package/sdk/common/RequestSigner.js +0 -5
- package/sdk/partner/OAuthClient.d.ts +14 -0
- package/sdk/partner/OAuthClient.js +112 -0
- package/sdk/partner/PartnerAPIClient.d.ts +12 -0
- package/sdk/partner/PartnerAPIClient.js +42 -0
- package/sdk/partner/PartnerClient.d.ts +6 -0
- package/sdk/partner/PartnerClient.js +17 -0
- package/sdk/partner/PartnerConfig.d.ts +30 -0
- package/sdk/partner/PartnerConfig.js +39 -0
- package/sdk/partner/index.d.ts +3 -0
- package/sdk/partner/index.js +5 -0
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +3 -1
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +5 -4
- package/sdk/platform/Analytics/AnalyticsPlatformValidator.js +1 -0
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +3 -2
- package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.js +1 -0
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -0
- package/sdk/platform/Billing/BillingPlatformClient.js +137 -2
- package/sdk/platform/Billing/BillingPlatformModel.d.ts +4 -0
- package/sdk/platform/Billing/BillingPlatformModel.js +44 -0
- package/sdk/platform/Billing/BillingPlatformValidator.d.ts +2 -0
- package/sdk/platform/Billing/BillingPlatformValidator.js +15 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +27 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +177 -1
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +3 -0
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +17 -1
- package/sdk/platform/Cart/CartPlatformModel.js +7 -3
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +3 -1
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +2 -2
- package/sdk/platform/Catalog/CatalogPlatformClient.js +6 -9
- package/sdk/platform/Catalog/CatalogPlatformModel.js +9 -9
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +2 -1
- package/sdk/platform/Common/CommonPlatformClient.js +7 -18
- package/sdk/platform/Common/CommonPlatformValidator.js +1 -0
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +3 -1
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +4 -3
- package/sdk/platform/Communication/CommunicationPlatformValidator.js +1 -0
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +5 -4
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +1 -0
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +3 -1
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +9 -8
- package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +1 -0
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +3 -1
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Discount/DiscountPlatformClient.js +3 -2
- package/sdk/platform/Discount/DiscountPlatformValidator.js +1 -0
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +3 -3
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +27 -5
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +1 -1
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +3 -3
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +28 -6
- package/sdk/platform/FileStorage/FileStoragePlatformValidator.js +1 -0
- package/sdk/platform/Inventory/InventoryPlatformClient.js +3 -2
- package/sdk/platform/Inventory/InventoryPlatformValidator.js +1 -0
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +3 -1
- package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Lead/LeadPlatformClient.js +4 -3
- package/sdk/platform/Lead/LeadPlatformValidator.js +1 -0
- package/sdk/platform/OAuthClient.js +3 -9
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +3 -1
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Order/OrderPlatformClient.d.ts +1 -1
- package/sdk/platform/Order/OrderPlatformClient.js +16 -3
- package/sdk/platform/Order/OrderPlatformModel.js +1 -0
- package/sdk/platform/Order/OrderPlatformValidator.js +1 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +3 -1
- package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +1 -1
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +14 -14
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Payment/PaymentPlatformClient.js +3 -2
- package/sdk/platform/Payment/PaymentPlatformValidator.js +1 -0
- package/sdk/platform/PlatformApplicationClient.d.ts +5 -1
- package/sdk/platform/PlatformApplicationClient.js +4 -0
- package/sdk/platform/PlatformClient.d.ts +51 -12
- package/sdk/platform/PlatformClient.js +54 -11
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +17 -19
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +88 -83
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +8 -9
- package/sdk/platform/Share/SharePlatformApplicationClient.js +3 -1
- package/sdk/platform/Share/SharePlatformApplicationValidator.js +1 -1
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +3 -1
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +1 -1
- package/sdk/platform/User/UserPlatformApplicationClient.js +3 -1
- package/sdk/platform/User/UserPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Webhook/WebhookPlatformClient.js +3 -2
- package/sdk/platform/Webhook/WebhookPlatformValidator.js +1 -0
- package/sdk/public/Configuration/ConfigurationPublicClient.js +2 -0
- package/sdk/public/Inventory/InventoryPublicClient.js +2 -0
- package/sdk/public/Webhook/WebhookPublicClient.js +2 -0
- package/.github/workflows/on_create_release.yml +0 -23
- package/.github/workflows/on_merge_main.yml +0 -38
- package/.github/workflows/on_pull_request.yml +0 -35
- package/.prettierrc +0 -5
- package/documentation/application/CART.md +0 -8771
- package/documentation/application/CATALOG.md +0 -8690
- package/documentation/application/COMMON.md +0 -325
- package/documentation/application/COMMUNICATION.md +0 -387
- package/documentation/application/CONFIGURATION.md +0 -2212
- package/documentation/application/CONTENT.md +0 -2629
- package/documentation/application/FILESTORAGE.md +0 -442
- package/documentation/application/LEAD.md +0 -1549
- package/documentation/application/LOGISTIC.md +0 -689
- package/documentation/application/ORDER.md +0 -2937
- package/documentation/application/PAYMENT.md +0 -4475
- package/documentation/application/POSCART.md +0 -9375
- package/documentation/application/README.md +0 -21
- package/documentation/application/REWARDS.md +0 -554
- package/documentation/application/SHARE.md +0 -635
- package/documentation/application/THEME.md +0 -5517
- package/documentation/application/USER.md +0 -3798
- package/documentation/platform/ANALYTICS.md +0 -1012
- package/documentation/platform/AUDITTRAIL.md +0 -493
- package/documentation/platform/BILLING.md +0 -1889
- package/documentation/platform/CART.md +0 -4711
- package/documentation/platform/CATALOG.md +0 -20522
- package/documentation/platform/COMMON.md +0 -325
- package/documentation/platform/COMMUNICATION.md +0 -4970
- package/documentation/platform/COMPANYPROFILE.md +0 -1646
- package/documentation/platform/CONFIGURATION.md +0 -6316
- package/documentation/platform/CONTENT.md +0 -8364
- package/documentation/platform/DISCOUNT.md +0 -767
- package/documentation/platform/FILESTORAGE.md +0 -945
- package/documentation/platform/INVENTORY.md +0 -1136
- package/documentation/platform/LEAD.md +0 -4394
- package/documentation/platform/ORDER.md +0 -6525
- package/documentation/platform/PARTNER.md +0 -193
- package/documentation/platform/PAYMENT.md +0 -3138
- package/documentation/platform/README.md +0 -27
- package/documentation/platform/REWARDS.md +0 -919
- package/documentation/platform/SHARE.md +0 -513
- package/documentation/platform/THEME.md +0 -35446
- package/documentation/platform/USER.md +0 -2174
- package/documentation/platform/WEBHOOK.md +0 -485
- package/documentation/public/CONFIGURATION.md +0 -325
- package/documentation/public/INVENTORY.md +0 -508
- package/documentation/public/WEBHOOK.md +0 -246
- package/jest.config.d.ts +0 -4
- package/jest.config.js +0 -6
- package/tests/application/catalog.spec.js +0 -54
- package/tests/common/action-url.spec.js +0 -35
- package/tests/common/schema/action-url.json +0 -178
- package/tests/common/schema/url-action.json +0 -683
- package/tests/common/url-action.spec.js +0 -48
- package/tests/helpers/cookie.helper.js +0 -31
- package/tests/helpers/oauth.helper.js +0 -43
- package/tests/platform/catalog.spec.js +0 -49
- package/tests/public/location.spec.js +0 -39
package/README.md
CHANGED
|
@@ -13,6 +13,8 @@ Get started with the Javascript Development SDK for Fynd Platform
|
|
|
13
13
|
|
|
14
14
|
### Usage
|
|
15
15
|
|
|
16
|
+
#### Node
|
|
17
|
+
|
|
16
18
|
```
|
|
17
19
|
npm install @gofynd/fdk-client-javascript
|
|
18
20
|
```
|
|
@@ -26,6 +28,22 @@ const {
|
|
|
26
28
|
} = require("fdk-client-javascript");
|
|
27
29
|
```
|
|
28
30
|
|
|
31
|
+
#### Browser
|
|
32
|
+
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
|
+
```html
|
|
35
|
+
<script src="https://cdn.jsdelivr.net/gh/gofynd/fdk-client-javascript@<version>/dist/application.js"></script>
|
|
36
|
+
```
|
|
37
|
+
Install Specific version
|
|
38
|
+
```html
|
|
39
|
+
<script src="https://cdn.jsdelivr.net/gh/gofynd/fdk-client-javascript@1.0.1/dist/application.js"></script>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
const { ApplicationConfig, ApplicationClient } = window;
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
|
|
29
47
|
### Logging
|
|
30
48
|
|
|
31
49
|
For logging support user can pass `logLevel` in `ApplicationConfig` or `PlatformConfig` while declaration.
|
|
@@ -103,6 +121,33 @@ async function getData() {
|
|
|
103
121
|
|
|
104
122
|
getData();
|
|
105
123
|
```
|
|
124
|
+
---
|
|
125
|
+
### Cookie
|
|
126
|
+
|
|
127
|
+
Following code snippet will read and write cookies on behalf of you <br />
|
|
128
|
+
Cookies will get appended in subsequent requests.
|
|
129
|
+
|
|
130
|
+
```javascript
|
|
131
|
+
const { FdkAxios } = require('@gofynd/fdk-client-javascript');
|
|
132
|
+
const { wrapper } = require("axios-cookiejar-support");
|
|
133
|
+
const { CookieJar } = require("tough-cookie");
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
wrapper(FdkAxios);
|
|
137
|
+
const cookieJar = new CookieJar();
|
|
138
|
+
FdkAxios.defaults.jar = cookieJar;
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
module.exports = cookieJar
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
get the stored cookie from the CookieJar instance
|
|
145
|
+
```javascript
|
|
146
|
+
const cookieJar = require('path/to/cookieJar') // replace with actual path
|
|
147
|
+
|
|
148
|
+
let cookies = await cookieJar.getCookies("https://api.fynd.com");
|
|
149
|
+
```
|
|
150
|
+
---
|
|
106
151
|
|
|
107
152
|
### Log Curl
|
|
108
153
|
To print the curl command in the console for all network calls made using `applicationClient` or `platformClient`, set the logger level to debug.
|
|
@@ -127,7 +172,7 @@ The above code will log the curl command in the console
|
|
|
127
172
|
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'
|
|
128
173
|
Active Theme: Emerge
|
|
129
174
|
```
|
|
130
|
-
|
|
175
|
+
---
|
|
131
176
|
### TypeScript
|
|
132
177
|
|
|
133
178
|
fdk-client-javascript includes Typescript definitions.
|
|
@@ -135,8 +180,12 @@ fdk-client-javascript includes Typescript definitions.
|
|
|
135
180
|
```typescript
|
|
136
181
|
import { ApplicationConfig, ApplicationClient } from "fdk-client-javascript";
|
|
137
182
|
```
|
|
138
|
-
|
|
183
|
+
---
|
|
139
184
|
### Documentation
|
|
140
185
|
|
|
186
|
+
- [Public Front](documentation/public/README.md)
|
|
141
187
|
- [Application Front](documentation/application/README.md)
|
|
142
188
|
- [Platform Front](documentation/platform/README.md)
|
|
189
|
+
- [Admin Front](documentation/admin/README.md)
|
|
190
|
+
- [Partner Front](documentation/partner/README.md)
|
|
191
|
+
|
package/index.d.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
+
import { PublicConfig } from "./sdk/public";
|
|
2
|
+
import { PublicClient } from "./sdk/public";
|
|
3
|
+
import { PublicModel } from "./sdk/public";
|
|
1
4
|
import { ApplicationConfig } from "./sdk/application";
|
|
2
5
|
import { ApplicationClient } from "./sdk/application";
|
|
3
6
|
import { ApplicationModel } from "./sdk/application";
|
|
4
7
|
import { PlatformConfig } from "./sdk/platform";
|
|
5
8
|
import { PlatformClient } from "./sdk/platform";
|
|
6
9
|
import { PlatformModel } from "./sdk/platform";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
+
import { PartnerConfig } from "./sdk/partner";
|
|
11
|
+
import { PartnerClient } from "./sdk/partner";
|
|
12
|
+
import { PartnerModel } from "./sdk/partner";
|
|
10
13
|
import { fdkAxios } from "./sdk/common/AxiosHelper";
|
|
11
14
|
import Utility = require("./sdk/common/Utility");
|
|
12
15
|
import Constant = require("./sdk/common/Constant");
|
|
13
|
-
export { ApplicationConfig, ApplicationClient, ApplicationModel, PlatformConfig, PlatformClient, PlatformModel,
|
|
16
|
+
export { PublicConfig, PublicClient, PublicModel, ApplicationConfig, ApplicationClient, ApplicationModel, PlatformConfig, PlatformClient, PlatformModel, PartnerConfig, PartnerClient, PartnerModel, fdkAxios as FdkAxios, Utility, Constant };
|
package/index.js
CHANGED
|
@@ -1,26 +1,41 @@
|
|
|
1
|
-
const {ApplicationConfig, ApplicationClient, ApplicationModel } = require('./sdk/application');
|
|
2
|
-
const {PlatformConfig, PlatformClient, PlatformModel } = require('./sdk/platform');
|
|
3
|
-
const {PublicConfig, PublicClient, PublicModel } = require('./sdk/public');
|
|
4
|
-
|
|
5
1
|
|
|
2
|
+
const { PublicConfig, PublicClient, PublicModel } = require('./sdk/public');
|
|
3
|
+
const { ApplicationConfig, ApplicationClient, ApplicationModel } = require('./sdk/application');
|
|
4
|
+
const { PlatformConfig, PlatformClient, PlatformModel } = require('./sdk/platform');
|
|
6
5
|
|
|
6
|
+
const { PartnerConfig, PartnerClient, PartnerModel } = require('./sdk/partner');
|
|
7
7
|
const {fdkAxios} = require('./sdk/common/AxiosHelper');
|
|
8
8
|
const Utility = require('./sdk/common/Utility');
|
|
9
9
|
const Constant = require('./sdk/common/Constant');
|
|
10
10
|
|
|
11
11
|
module.exports = {
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
PublicConfig,
|
|
15
|
+
PublicClient,
|
|
16
|
+
PublicModel,
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
12
20
|
ApplicationConfig,
|
|
13
21
|
ApplicationClient,
|
|
14
22
|
ApplicationModel,
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
15
26
|
PlatformConfig,
|
|
16
27
|
PlatformClient,
|
|
17
28
|
PlatformModel,
|
|
18
|
-
PublicConfig,
|
|
19
|
-
PublicClient,
|
|
20
|
-
PublicModel,
|
|
21
29
|
|
|
22
30
|
|
|
23
31
|
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
PartnerConfig,
|
|
35
|
+
PartnerClient,
|
|
36
|
+
PartnerModel,
|
|
37
|
+
|
|
38
|
+
|
|
24
39
|
FdkAxios: fdkAxios,
|
|
25
40
|
Utility,
|
|
26
41
|
Constant,
|
package/package.json
CHANGED
|
@@ -1,35 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gofynd/fdk-client-javascript",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "jest --coverage",
|
|
8
|
+
"test:standalone": "npm run build && npx cypress run",
|
|
9
|
+
"build": "webpack",
|
|
8
10
|
"prettier": "npx prettier -w ./sdk ./tests && npx tsc"
|
|
9
11
|
},
|
|
10
|
-
"jest": {
|
|
11
|
-
"coverageThreshold": {
|
|
12
|
-
"global": {
|
|
13
|
-
"branches": 0,
|
|
14
|
-
"functions": 0,
|
|
15
|
-
"lines": 0
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
12
|
"author": "Jigar Dafda<jigar.dafda@gmail.com>",
|
|
20
13
|
"license": "ISC",
|
|
21
14
|
"dependencies": {
|
|
22
15
|
"axios": "^0.27.2",
|
|
16
|
+
"camelcase": "^6.3.0",
|
|
23
17
|
"crypto-js": "^4.1.1",
|
|
18
|
+
"isomorphic-base64": "^1.0.2",
|
|
24
19
|
"joi": "^17.7.0",
|
|
25
|
-
"query-string": "^6.14.1",
|
|
26
20
|
"loglevel": "^1.8.1",
|
|
27
|
-
"
|
|
21
|
+
"query-string": "^7.1.3"
|
|
28
22
|
},
|
|
29
23
|
"devDependencies": {
|
|
24
|
+
"axios-cookiejar-support": "^4.0.6",
|
|
30
25
|
"axios-mock-adapter": "^1.21.2",
|
|
26
|
+
"clean-webpack-plugin": "^4.0.0",
|
|
31
27
|
"coveralls": "^3.1.1",
|
|
28
|
+
"cypress": "^9.2.0",
|
|
32
29
|
"dotenv": "^16.0.3",
|
|
33
|
-
"jest": "^
|
|
34
|
-
|
|
30
|
+
"jest": "^29.5.0",
|
|
31
|
+
"tough-cookie": "^4.1.2",
|
|
32
|
+
"webpack": "^5.81.0",
|
|
33
|
+
"webpack-cli": "^5.0.2"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"sdk/**/*.js",
|
|
37
|
+
"sdk/**/*.d.ts",
|
|
38
|
+
"./*.js",
|
|
39
|
+
"./*.d.ts",
|
|
40
|
+
"!**.config.*",
|
|
41
|
+
"!dist",
|
|
42
|
+
"!cypress"
|
|
43
|
+
]
|
|
35
44
|
}
|
package/partner.d.ts
ADDED
package/partner.js
ADDED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const { fdkAxios } = require("../common/AxiosHelper");
|
|
2
|
+
const { btoa } = require("isomorphic-base64");
|
|
2
3
|
|
|
3
4
|
class APIClient {
|
|
4
5
|
/**
|
|
@@ -10,10 +11,7 @@ class APIClient {
|
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
static execute(conf, method, url, query, body, xHeaders) {
|
|
13
|
-
const token =
|
|
14
|
-
`${conf.applicationID}:${conf.applicationToken}`,
|
|
15
|
-
"utf8"
|
|
16
|
-
).toString("base64");
|
|
14
|
+
const token = btoa(`${conf.applicationID}:${conf.applicationToken}`);
|
|
17
15
|
|
|
18
16
|
let headers = { Authorization: "Bearer " + token };
|
|
19
17
|
if (conf.cookie) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
const
|
|
1
|
+
const ApplicationAPIClient = require("../ApplicationAPIClient");
|
|
2
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
2
3
|
const constructUrl = require("../constructUrl");
|
|
3
4
|
const Paginator = require("../../common/Paginator");
|
|
4
|
-
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
5
5
|
const CartValidator = require("./CartApplicationValidator");
|
|
6
6
|
const CartModel = require("./CartApplicationModel");
|
|
7
7
|
const { Logger } = require("./../../common/Logger");
|
|
8
|
+
const Joi = require("joi");
|
|
8
9
|
|
|
9
10
|
class Cart {
|
|
10
11
|
constructor(_conf) {
|
|
@@ -88,7 +89,7 @@ class Cart {
|
|
|
88
89
|
|
|
89
90
|
const xHeaders = {};
|
|
90
91
|
|
|
91
|
-
const response = await
|
|
92
|
+
const response = await ApplicationAPIClient.execute(
|
|
92
93
|
this._conf,
|
|
93
94
|
"post",
|
|
94
95
|
constructUrl({
|
|
@@ -159,7 +160,7 @@ class Cart {
|
|
|
159
160
|
|
|
160
161
|
const xHeaders = {};
|
|
161
162
|
|
|
162
|
-
const response = await
|
|
163
|
+
const response = await ApplicationAPIClient.execute(
|
|
163
164
|
this._conf,
|
|
164
165
|
"post",
|
|
165
166
|
constructUrl({
|
|
@@ -232,7 +233,7 @@ class Cart {
|
|
|
232
233
|
|
|
233
234
|
const xHeaders = {};
|
|
234
235
|
|
|
235
|
-
const response = await
|
|
236
|
+
const response = await ApplicationAPIClient.execute(
|
|
236
237
|
this._conf,
|
|
237
238
|
"post",
|
|
238
239
|
constructUrl({
|
|
@@ -303,7 +304,7 @@ class Cart {
|
|
|
303
304
|
|
|
304
305
|
const xHeaders = {};
|
|
305
306
|
|
|
306
|
-
const response = await
|
|
307
|
+
const response = await ApplicationAPIClient.execute(
|
|
307
308
|
this._conf,
|
|
308
309
|
"post",
|
|
309
310
|
constructUrl({
|
|
@@ -368,7 +369,7 @@ class Cart {
|
|
|
368
369
|
|
|
369
370
|
const xHeaders = {};
|
|
370
371
|
|
|
371
|
-
const response = await
|
|
372
|
+
const response = await ApplicationAPIClient.execute(
|
|
372
373
|
this._conf,
|
|
373
374
|
"post",
|
|
374
375
|
constructUrl({
|
|
@@ -451,7 +452,7 @@ class Cart {
|
|
|
451
452
|
|
|
452
453
|
const xHeaders = {};
|
|
453
454
|
|
|
454
|
-
const response = await
|
|
455
|
+
const response = await ApplicationAPIClient.execute(
|
|
455
456
|
this._conf,
|
|
456
457
|
"get",
|
|
457
458
|
constructUrl({
|
|
@@ -530,7 +531,7 @@ class Cart {
|
|
|
530
531
|
|
|
531
532
|
const xHeaders = {};
|
|
532
533
|
|
|
533
|
-
const response = await
|
|
534
|
+
const response = await ApplicationAPIClient.execute(
|
|
534
535
|
this._conf,
|
|
535
536
|
"get",
|
|
536
537
|
constructUrl({
|
|
@@ -602,7 +603,7 @@ class Cart {
|
|
|
602
603
|
|
|
603
604
|
const xHeaders = {};
|
|
604
605
|
|
|
605
|
-
const response = await
|
|
606
|
+
const response = await ApplicationAPIClient.execute(
|
|
606
607
|
this._conf,
|
|
607
608
|
"get",
|
|
608
609
|
constructUrl({
|
|
@@ -676,7 +677,7 @@ class Cart {
|
|
|
676
677
|
|
|
677
678
|
const xHeaders = {};
|
|
678
679
|
|
|
679
|
-
const response = await
|
|
680
|
+
const response = await ApplicationAPIClient.execute(
|
|
680
681
|
this._conf,
|
|
681
682
|
"get",
|
|
682
683
|
constructUrl({
|
|
@@ -740,7 +741,7 @@ class Cart {
|
|
|
740
741
|
|
|
741
742
|
const xHeaders = {};
|
|
742
743
|
|
|
743
|
-
const response = await
|
|
744
|
+
const response = await ApplicationAPIClient.execute(
|
|
744
745
|
this._conf,
|
|
745
746
|
"head",
|
|
746
747
|
constructUrl({
|
|
@@ -800,7 +801,7 @@ class Cart {
|
|
|
800
801
|
|
|
801
802
|
const xHeaders = {};
|
|
802
803
|
|
|
803
|
-
const response = await
|
|
804
|
+
const response = await ApplicationAPIClient.execute(
|
|
804
805
|
this._conf,
|
|
805
806
|
"post",
|
|
806
807
|
constructUrl({
|
|
@@ -863,7 +864,7 @@ class Cart {
|
|
|
863
864
|
|
|
864
865
|
const xHeaders = {};
|
|
865
866
|
|
|
866
|
-
const response = await
|
|
867
|
+
const response = await ApplicationAPIClient.execute(
|
|
867
868
|
this._conf,
|
|
868
869
|
"get",
|
|
869
870
|
constructUrl({
|
|
@@ -929,7 +930,7 @@ class Cart {
|
|
|
929
930
|
|
|
930
931
|
const xHeaders = {};
|
|
931
932
|
|
|
932
|
-
const response = await
|
|
933
|
+
const response = await ApplicationAPIClient.execute(
|
|
933
934
|
this._conf,
|
|
934
935
|
"get",
|
|
935
936
|
constructUrl({
|
|
@@ -995,7 +996,7 @@ class Cart {
|
|
|
995
996
|
|
|
996
997
|
const xHeaders = {};
|
|
997
998
|
|
|
998
|
-
const response = await
|
|
999
|
+
const response = await ApplicationAPIClient.execute(
|
|
999
1000
|
this._conf,
|
|
1000
1001
|
"get",
|
|
1001
1002
|
constructUrl({
|
|
@@ -1069,7 +1070,7 @@ class Cart {
|
|
|
1069
1070
|
|
|
1070
1071
|
const xHeaders = {};
|
|
1071
1072
|
|
|
1072
|
-
const response = await
|
|
1073
|
+
const response = await ApplicationAPIClient.execute(
|
|
1073
1074
|
this._conf,
|
|
1074
1075
|
"get",
|
|
1075
1076
|
constructUrl({
|
|
@@ -1139,7 +1140,7 @@ class Cart {
|
|
|
1139
1140
|
|
|
1140
1141
|
const xHeaders = {};
|
|
1141
1142
|
|
|
1142
|
-
const response = await
|
|
1143
|
+
const response = await ApplicationAPIClient.execute(
|
|
1143
1144
|
this._conf,
|
|
1144
1145
|
"get",
|
|
1145
1146
|
constructUrl({
|
|
@@ -1213,7 +1214,7 @@ class Cart {
|
|
|
1213
1214
|
|
|
1214
1215
|
const xHeaders = {};
|
|
1215
1216
|
|
|
1216
|
-
const response = await
|
|
1217
|
+
const response = await ApplicationAPIClient.execute(
|
|
1217
1218
|
this._conf,
|
|
1218
1219
|
"get",
|
|
1219
1220
|
constructUrl({
|
|
@@ -1276,7 +1277,7 @@ class Cart {
|
|
|
1276
1277
|
|
|
1277
1278
|
const xHeaders = {};
|
|
1278
1279
|
|
|
1279
|
-
const response = await
|
|
1280
|
+
const response = await ApplicationAPIClient.execute(
|
|
1280
1281
|
this._conf,
|
|
1281
1282
|
"delete",
|
|
1282
1283
|
constructUrl({
|
|
@@ -1342,7 +1343,7 @@ class Cart {
|
|
|
1342
1343
|
|
|
1343
1344
|
const xHeaders = {};
|
|
1344
1345
|
|
|
1345
|
-
const response = await
|
|
1346
|
+
const response = await ApplicationAPIClient.execute(
|
|
1346
1347
|
this._conf,
|
|
1347
1348
|
"delete",
|
|
1348
1349
|
constructUrl({
|
|
@@ -1413,7 +1414,7 @@ class Cart {
|
|
|
1413
1414
|
|
|
1414
1415
|
const xHeaders = {};
|
|
1415
1416
|
|
|
1416
|
-
const response = await
|
|
1417
|
+
const response = await ApplicationAPIClient.execute(
|
|
1417
1418
|
this._conf,
|
|
1418
1419
|
"post",
|
|
1419
1420
|
constructUrl({
|
|
@@ -1480,7 +1481,7 @@ class Cart {
|
|
|
1480
1481
|
|
|
1481
1482
|
const xHeaders = {};
|
|
1482
1483
|
|
|
1483
|
-
const response = await
|
|
1484
|
+
const response = await ApplicationAPIClient.execute(
|
|
1484
1485
|
this._conf,
|
|
1485
1486
|
"put",
|
|
1486
1487
|
constructUrl({
|
|
@@ -1544,7 +1545,7 @@ class Cart {
|
|
|
1544
1545
|
|
|
1545
1546
|
const xHeaders = {};
|
|
1546
1547
|
|
|
1547
|
-
const response = await
|
|
1548
|
+
const response = await ApplicationAPIClient.execute(
|
|
1548
1549
|
this._conf,
|
|
1549
1550
|
"put",
|
|
1550
1551
|
constructUrl({
|
|
@@ -1617,7 +1618,7 @@ class Cart {
|
|
|
1617
1618
|
|
|
1618
1619
|
const xHeaders = {};
|
|
1619
1620
|
|
|
1620
|
-
const response = await
|
|
1621
|
+
const response = await ApplicationAPIClient.execute(
|
|
1621
1622
|
this._conf,
|
|
1622
1623
|
"put",
|
|
1623
1624
|
constructUrl({
|
|
@@ -1684,7 +1685,7 @@ class Cart {
|
|
|
1684
1685
|
|
|
1685
1686
|
const xHeaders = {};
|
|
1686
1687
|
|
|
1687
|
-
const response = await
|
|
1688
|
+
const response = await ApplicationAPIClient.execute(
|
|
1688
1689
|
this._conf,
|
|
1689
1690
|
"put",
|
|
1690
1691
|
constructUrl({
|
|
@@ -1749,7 +1750,7 @@ class Cart {
|
|
|
1749
1750
|
|
|
1750
1751
|
const xHeaders = {};
|
|
1751
1752
|
|
|
1752
|
-
const response = await
|
|
1753
|
+
const response = await ApplicationAPIClient.execute(
|
|
1753
1754
|
this._conf,
|
|
1754
1755
|
"post",
|
|
1755
1756
|
constructUrl({
|
|
@@ -1851,7 +1852,7 @@ class Cart {
|
|
|
1851
1852
|
|
|
1852
1853
|
const xHeaders = {};
|
|
1853
1854
|
|
|
1854
|
-
const response = await
|
|
1855
|
+
const response = await ApplicationAPIClient.execute(
|
|
1855
1856
|
this._conf,
|
|
1856
1857
|
"get",
|
|
1857
1858
|
constructUrl({
|
|
@@ -28,7 +28,9 @@ class CartModel {
|
|
|
28
28
|
extra_meta: Joi.any(),
|
|
29
29
|
item_id: Joi.number(),
|
|
30
30
|
item_size: Joi.string().allow(""),
|
|
31
|
-
parent_item_identifiers: Joi.
|
|
31
|
+
parent_item_identifiers: Joi.array().items(
|
|
32
|
+
Joi.object().pattern(/\S/, Joi.string().allow(""))
|
|
33
|
+
),
|
|
32
34
|
pos: Joi.boolean(),
|
|
33
35
|
product_group_tags: Joi.array().items(Joi.string().allow("").allow(null)),
|
|
34
36
|
quantity: Joi.number(),
|