@maxzima/wa-communicator 1.0.48 → 1.0.50
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/dist/engine/Communicator/Public/Communicator.js +1 -3
- package/dist/types/TCommunicator.d.ts +1 -0
- package/package.json +2 -2
- package/src/engine/Communicator/Public/Communicator.ts +1 -0
- package/src/types/TCommunicator.ts +1 -0
- package/test/__snapshots__/communicator.spec.ts.snap +14 -1
- package/test/communicator.spec.ts +6 -1
- package/test/testunits/communicator/general.ts +1 -0
- package/test/testunits/communicator/requests.ts +7 -0
|
@@ -227,9 +227,7 @@ export class Communicator {
|
|
|
227
227
|
setStorageValues(data) {
|
|
228
228
|
return __awaiter(this, void 0, void 0, function* () {
|
|
229
229
|
const headers = this.getHeaders(data.accessToken);
|
|
230
|
-
const body = JSON.stringify({
|
|
231
|
-
seo_source: data.origin,
|
|
232
|
-
});
|
|
230
|
+
const body = JSON.stringify(Object.assign({ seo_source: data.origin }, (data.productId && { last_profile_id: data.productId })));
|
|
233
231
|
return yield this.send({
|
|
234
232
|
method: 'POST',
|
|
235
233
|
url: `${this.props.clientFAPIBaseUrl}${CommunicatorFAPIEndpointEnum.STORAGE}`,
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.
|
|
2
|
+
"version": "1.0.50",
|
|
3
3
|
"name": "@maxzima/wa-communicator",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Noname",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "dist/index.d.ts",
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
10
|
+
"node": ">=20.11.1 <23"
|
|
11
11
|
},
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://
|
|
1
|
+
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
|
2
2
|
|
|
3
3
|
exports[`Communicator getHeaders headers with token 1`] = `
|
|
4
4
|
{
|
|
@@ -132,6 +132,19 @@ exports[`Communicator requests setStorageValues 1`] = `
|
|
|
132
132
|
}
|
|
133
133
|
`;
|
|
134
134
|
|
|
135
|
+
exports[`Communicator requests setStorageValuesWithProductId 1`] = `
|
|
136
|
+
{
|
|
137
|
+
"body": "{"seo_source":"_origin_","last_profile_id":"_productId_"}",
|
|
138
|
+
"headers": {
|
|
139
|
+
"Accept": "application/json, text/plain, */*",
|
|
140
|
+
"Authorization": "Bearer _accessToken_",
|
|
141
|
+
"Content-Type": "application/json",
|
|
142
|
+
},
|
|
143
|
+
"method": "POST",
|
|
144
|
+
"url": "https://google.com/storage",
|
|
145
|
+
}
|
|
146
|
+
`;
|
|
147
|
+
|
|
135
148
|
exports[`Communicator requests setupChallenge 1`] = `
|
|
136
149
|
{
|
|
137
150
|
"headers": {
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
setStorageValuesData,
|
|
18
18
|
getRestrictedCountriesData,
|
|
19
19
|
getAssignedProductsData,
|
|
20
|
-
profileAssignData,
|
|
20
|
+
profileAssignData, setStorageValuesDataWithProductId,
|
|
21
21
|
} from "./testunits/communicator/requests";
|
|
22
22
|
import {communicatorTestData} from "./testunits/communicator/general";
|
|
23
23
|
|
|
@@ -112,6 +112,11 @@ describe('Communicator requests', () => {
|
|
|
112
112
|
expect(setStorageValuesRequestData).toMatchSnapshot();
|
|
113
113
|
});
|
|
114
114
|
|
|
115
|
+
test('setStorageValuesWithProductId', async () => {
|
|
116
|
+
const setStorageValuesRequestData = await communicator.setStorageValues(setStorageValuesDataWithProductId);
|
|
117
|
+
expect(setStorageValuesRequestData).toMatchSnapshot();
|
|
118
|
+
});
|
|
119
|
+
|
|
115
120
|
test('getRestrictedCountries', async () => {
|
|
116
121
|
const getRestrictedCountriesRequestData = await communicator.getRestrictedCountries(getRestrictedCountriesData);
|
|
117
122
|
expect(getRestrictedCountriesRequestData).toMatchSnapshot();
|
|
@@ -79,6 +79,12 @@ const setStorageValuesData: TStorageRequestData = {
|
|
|
79
79
|
origin: communicatorTestData.origin,
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
+
const setStorageValuesDataWithProductId: TStorageRequestData = {
|
|
83
|
+
accessToken: communicatorTestData.accessToken,
|
|
84
|
+
origin: communicatorTestData.origin,
|
|
85
|
+
productId: communicatorTestData.productId
|
|
86
|
+
};
|
|
87
|
+
|
|
82
88
|
const getRestrictedCountriesData: TGetRestrictedCountriesData = {
|
|
83
89
|
entityType: CountryTypeEnum.GLOBAL
|
|
84
90
|
};
|
|
@@ -103,6 +109,7 @@ export {
|
|
|
103
109
|
getCurrentUserProfileData,
|
|
104
110
|
registrationData,
|
|
105
111
|
setStorageValuesData,
|
|
112
|
+
setStorageValuesDataWithProductId,
|
|
106
113
|
getRestrictedCountriesData,
|
|
107
114
|
profileAssignData,
|
|
108
115
|
getAssignedProductsData
|