@maxzima/wa-communicator 1.0.4 → 1.0.6
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 +4 -2
- package/dist/engine/Communicator/Public/Communicator.d.ts +2 -2
- package/dist/engine/Communicator/Public/Communicator.js +3 -3
- package/dist/types/TCommunicator.d.ts +5 -2
- package/package.json +1 -1
- package/src/engine/Communicator/Public/Communicator.ts +7 -3
- package/src/types/TCommunicator.ts +6 -1
package/README.md
CHANGED
|
@@ -87,7 +87,7 @@ communicator.signUp({
|
|
|
87
87
|
.then((response) => callback(response));
|
|
88
88
|
|
|
89
89
|
communicator.registration({
|
|
90
|
-
|
|
90
|
+
accessToken: 'some_access_token...',
|
|
91
91
|
name: 'companyName',
|
|
92
92
|
hash: 'some_tracking_hash...',
|
|
93
93
|
deviceType: 'mobile',
|
|
@@ -96,7 +96,9 @@ communicator.registration({
|
|
|
96
96
|
})
|
|
97
97
|
.then((response) => callback(response));
|
|
98
98
|
|
|
99
|
-
communicator.getCurrentUserProfile(
|
|
99
|
+
communicator.getCurrentUserProfile({
|
|
100
|
+
accessToken: 'some_access_token...',
|
|
101
|
+
})
|
|
100
102
|
.then((response) => callback(response))
|
|
101
103
|
```
|
|
102
104
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TCreateSessionRequestData, TEmailUpdateRequestData, TRegistrationRequestData, TResponse, TSetupChallengeRequestData, TSignInByMobileRequestData, TSignUpByMobileRequestData, TVerifyChallengeRequestData } from "@root/types";
|
|
1
|
+
import { TCreateSessionRequestData, TEmailUpdateRequestData, TGetCurrentUserProfileRequestData, TRegistrationRequestData, TResponse, TSetupChallengeRequestData, TSignInByMobileRequestData, TSignUpByMobileRequestData, TVerifyChallengeRequestData } from "@root/types";
|
|
2
2
|
export declare class Communicator {
|
|
3
3
|
private props;
|
|
4
4
|
constructor(props: TCommunicatorProps);
|
|
@@ -8,7 +8,7 @@ export declare class Communicator {
|
|
|
8
8
|
verifyChallenge(data: TVerifyChallengeRequestData): Promise<TResponse>;
|
|
9
9
|
emailUpdate(data: TEmailUpdateRequestData): Promise<TResponse>;
|
|
10
10
|
createSession(data: TCreateSessionRequestData): Promise<TResponse>;
|
|
11
|
-
getCurrentUserProfile(): Promise<TResponse>;
|
|
11
|
+
getCurrentUserProfile(data: TGetCurrentUserProfileRequestData): Promise<TResponse>;
|
|
12
12
|
registration(data: TRegistrationRequestData): Promise<TResponse>;
|
|
13
13
|
private send;
|
|
14
14
|
private getMeta;
|
|
@@ -106,12 +106,12 @@ export class Communicator {
|
|
|
106
106
|
});
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
|
-
getCurrentUserProfile() {
|
|
109
|
+
getCurrentUserProfile(data) {
|
|
110
110
|
return __awaiter(this, void 0, void 0, function* () {
|
|
111
111
|
return yield this.send({
|
|
112
112
|
method: 'GET',
|
|
113
113
|
url: `${this.props.clientFAPIBaseUrl}${"user"}`,
|
|
114
|
-
headers: CommunicatorDefaultRequestData.FETCH_HEADERS_INIT,
|
|
114
|
+
headers: Object.assign({ 'Authorization': `Bearer ${data.accessToken}` }, CommunicatorDefaultRequestData.FETCH_HEADERS_INIT),
|
|
115
115
|
});
|
|
116
116
|
});
|
|
117
117
|
}
|
|
@@ -129,7 +129,7 @@ export class Communicator {
|
|
|
129
129
|
return yield this.send({
|
|
130
130
|
method: 'POST',
|
|
131
131
|
url: `${this.props.clientFAPIBaseUrl}${"clients/registration"}`,
|
|
132
|
-
headers: Object.assign({ 'Authorization': `Bearer ${data.
|
|
132
|
+
headers: Object.assign({ 'Authorization': `Bearer ${data.accessToken}` }, CommunicatorDefaultRequestData.FETCH_HEADERS_INIT),
|
|
133
133
|
body,
|
|
134
134
|
});
|
|
135
135
|
});
|
|
@@ -99,12 +99,15 @@ declare type TRegistrationRequestBody = {
|
|
|
99
99
|
name: string;
|
|
100
100
|
source: TRegistrationRequestBodySource;
|
|
101
101
|
};
|
|
102
|
+
declare type TGetCurrentUserProfileRequestData = {
|
|
103
|
+
accessToken: string;
|
|
104
|
+
};
|
|
102
105
|
declare type TRegistrationRequestData = {
|
|
103
|
-
|
|
106
|
+
accessToken: string;
|
|
104
107
|
name: TRegistrationRequestBody['name'];
|
|
105
108
|
deviceType: TRegistrationRequestBodySource['device_type'];
|
|
106
109
|
hash: TRegistrationRequestBodySource['hash'];
|
|
107
110
|
gaId: TRegistrationRequestBodySource['ga_id'];
|
|
108
111
|
origin: TRegistrationRequestBodySource['origin'];
|
|
109
112
|
};
|
|
110
|
-
export { TChallenge, TAuditSource, TRequestProps, TRequestQueryParams, TResponse, TSignInStartRequestBody, TAccountMeta, TSignInByMobileRequestData, TSignInByMobileResponse, TSignUpStartRequestBody, TSignUpByMobileRequestData, TSetupChallengeRequestData, TSetupChallengeResponse, TVerifyChallengeRequestBody, TVerifyChallengeRequestData, TVerifyChallengeResponse, TEmailUpdateRequestData, TCreateSessionRequestData, TCreateSessionResponse, TGetCurrentUserProfileResponseUser, TRegistrationRequestData };
|
|
113
|
+
export { TChallenge, TAuditSource, TRequestProps, TRequestQueryParams, TResponse, TSignInStartRequestBody, TAccountMeta, TSignInByMobileRequestData, TSignInByMobileResponse, TSignUpStartRequestBody, TSignUpByMobileRequestData, TSetupChallengeRequestData, TSetupChallengeResponse, TVerifyChallengeRequestBody, TVerifyChallengeRequestData, TVerifyChallengeResponse, TEmailUpdateRequestData, TCreateSessionRequestData, TCreateSessionResponse, TGetCurrentUserProfileResponseUser, TGetCurrentUserProfileRequestData, TRegistrationRequestData };
|
package/package.json
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
TAccountMeta,
|
|
3
3
|
TCreateSessionRequestData,
|
|
4
4
|
TEmailUpdateRequestData,
|
|
5
|
+
TGetCurrentUserProfileRequestData,
|
|
5
6
|
TRegistrationRequestData,
|
|
6
7
|
TRequestProps,
|
|
7
8
|
TRequestQueryParams,
|
|
@@ -112,11 +113,14 @@ export class Communicator {
|
|
|
112
113
|
});
|
|
113
114
|
}
|
|
114
115
|
|
|
115
|
-
public async getCurrentUserProfile() {
|
|
116
|
+
public async getCurrentUserProfile(data: TGetCurrentUserProfileRequestData) {
|
|
116
117
|
return await this.send({
|
|
117
118
|
method: 'GET',
|
|
118
119
|
url: `${this.props.clientFAPIBaseUrl}${CommunicatorFAPIEndpointEnum.USER}`,
|
|
119
|
-
headers:
|
|
120
|
+
headers: {
|
|
121
|
+
'Authorization': `Bearer ${data.accessToken}`,
|
|
122
|
+
...CommunicatorDefaultRequestData.FETCH_HEADERS_INIT,
|
|
123
|
+
},
|
|
120
124
|
});
|
|
121
125
|
}
|
|
122
126
|
|
|
@@ -135,7 +139,7 @@ export class Communicator {
|
|
|
135
139
|
method: 'POST',
|
|
136
140
|
url: `${this.props.clientFAPIBaseUrl}${CommunicatorFAPIEndpointEnum.REGISTRATION}`,
|
|
137
141
|
headers: {
|
|
138
|
-
'Authorization': `Bearer ${data.
|
|
142
|
+
'Authorization': `Bearer ${data.accessToken}`,
|
|
139
143
|
...CommunicatorDefaultRequestData.FETCH_HEADERS_INIT,
|
|
140
144
|
},
|
|
141
145
|
body,
|
|
@@ -144,8 +144,12 @@ type TRegistrationRequestBody = {
|
|
|
144
144
|
source: TRegistrationRequestBodySource,
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
type TGetCurrentUserProfileRequestData = {
|
|
148
|
+
accessToken: string,
|
|
149
|
+
}
|
|
150
|
+
|
|
147
151
|
type TRegistrationRequestData = {
|
|
148
|
-
|
|
152
|
+
accessToken: string,
|
|
149
153
|
name: TRegistrationRequestBody['name'],
|
|
150
154
|
deviceType: TRegistrationRequestBodySource['device_type']
|
|
151
155
|
hash: TRegistrationRequestBodySource['hash'],
|
|
@@ -175,5 +179,6 @@ export {
|
|
|
175
179
|
TCreateSessionRequestData,
|
|
176
180
|
TCreateSessionResponse,
|
|
177
181
|
TGetCurrentUserProfileResponseUser,
|
|
182
|
+
TGetCurrentUserProfileRequestData,
|
|
178
183
|
TRegistrationRequestData
|
|
179
184
|
};
|