@maxzima/wa-communicator 1.0.49 → 1.0.51
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 +1 -1
- package/src/engine/Communicator/Public/Communicator.ts +1 -0
- package/src/types/TCommunicator.ts +1 -0
- package/test/__snapshots__/communicator.spec.ts.snap +15 -2
- package/test/communicator.spec.ts +6 -0
- package/test/testunits/communicator/general.ts +2 -0
- package/test/testunits/communicator/requests.ts +8 -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.profileId && { last_profile_id: data.profileId })));
|
|
233
231
|
return yield this.send({
|
|
234
232
|
method: 'POST',
|
|
235
233
|
url: `${this.props.clientFAPIBaseUrl}${CommunicatorFAPIEndpointEnum.STORAGE}`,
|
package/package.json
CHANGED
|
@@ -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
|
{
|
|
@@ -108,7 +108,7 @@ exports[`Communicator requests profileAssign 1`] = `
|
|
|
108
108
|
|
|
109
109
|
exports[`Communicator requests registration 1`] = `
|
|
110
110
|
{
|
|
111
|
-
"body": "{"name":"_companyName_","country_code":"CAN","source":{"hash":"_hash_","device_type":"mobile","ga_id":"_gaId_","origin":"_origin_","gc_id":"_gcId_","utm_source":"_utmSource_","utm_medium":"_utmMedium_","utm_campaign":"_utmCampaign_","utm_term":"_utmTerm_"}}",
|
|
111
|
+
"body": "{"name":"_companyName_","country_code":"CAN","source":{"hash":"_hash_","device_type":"mobile","ga_id":"_gaId_","origin":"_origin_","gc_id":"_gcId_","utm_source":"_utmSource_","utm_medium":"_utmMedium_","utm_campaign":"_utmCampaign_","utm_term":"_utmTerm_","fbclid":"_fbclid_"}}",
|
|
112
112
|
"headers": {
|
|
113
113
|
"Accept": "application/json, text/plain, */*",
|
|
114
114
|
"Authorization": "Bearer _accessToken_",
|
|
@@ -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":"_profileId_"}",
|
|
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": {
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
getRestrictedCountriesData,
|
|
19
19
|
getAssignedProductsData,
|
|
20
20
|
profileAssignData,
|
|
21
|
+
setStorageValuesDataWithProfileId,
|
|
21
22
|
} from "./testunits/communicator/requests";
|
|
22
23
|
import {communicatorTestData} from "./testunits/communicator/general";
|
|
23
24
|
|
|
@@ -112,6 +113,11 @@ describe('Communicator requests', () => {
|
|
|
112
113
|
expect(setStorageValuesRequestData).toMatchSnapshot();
|
|
113
114
|
});
|
|
114
115
|
|
|
116
|
+
test('setStorageValuesWithProductId', async () => {
|
|
117
|
+
const setStorageValuesRequestData = await communicator.setStorageValues(setStorageValuesDataWithProfileId);
|
|
118
|
+
expect(setStorageValuesRequestData).toMatchSnapshot();
|
|
119
|
+
});
|
|
120
|
+
|
|
115
121
|
test('getRestrictedCountries', async () => {
|
|
116
122
|
const getRestrictedCountriesRequestData = await communicator.getRestrictedCountries(getRestrictedCountriesData);
|
|
117
123
|
expect(getRestrictedCountriesRequestData).toMatchSnapshot();
|
|
@@ -72,6 +72,7 @@ const registrationData: TRegistrationRequestData = {
|
|
|
72
72
|
utmMedium: communicatorTestData.utmMedium,
|
|
73
73
|
utmCampaign: communicatorTestData.utmCampaign,
|
|
74
74
|
utmTerm: communicatorTestData.utmTerm,
|
|
75
|
+
fbclid: communicatorTestData.fbclid,
|
|
75
76
|
};
|
|
76
77
|
|
|
77
78
|
const setStorageValuesData: TStorageRequestData = {
|
|
@@ -79,6 +80,12 @@ const setStorageValuesData: TStorageRequestData = {
|
|
|
79
80
|
origin: communicatorTestData.origin,
|
|
80
81
|
};
|
|
81
82
|
|
|
83
|
+
const setStorageValuesDataWithProfileId: TStorageRequestData = {
|
|
84
|
+
accessToken: communicatorTestData.accessToken,
|
|
85
|
+
origin: communicatorTestData.origin,
|
|
86
|
+
profileId: communicatorTestData.profileId
|
|
87
|
+
};
|
|
88
|
+
|
|
82
89
|
const getRestrictedCountriesData: TGetRestrictedCountriesData = {
|
|
83
90
|
entityType: CountryTypeEnum.GLOBAL
|
|
84
91
|
};
|
|
@@ -103,6 +110,7 @@ export {
|
|
|
103
110
|
getCurrentUserProfileData,
|
|
104
111
|
registrationData,
|
|
105
112
|
setStorageValuesData,
|
|
113
|
+
setStorageValuesDataWithProfileId,
|
|
106
114
|
getRestrictedCountriesData,
|
|
107
115
|
profileAssignData,
|
|
108
116
|
getAssignedProductsData
|