@longvansoftware/storefront-js-client 2.2.7-beta.1 → 2.2.7-beta.11
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/src/graphql/auth/mutations.js +0 -20
- package/dist/src/graphql/campaign/mutations.d.ts +1 -0
- package/dist/src/graphql/campaign/mutations.js +31 -0
- package/dist/src/graphql/campaign/queries.js +2 -2
- package/dist/src/lib/auth/index.d.ts +3 -0
- package/dist/src/lib/auth/index.js +67 -1
- package/dist/src/lib/campaign/index.d.ts +2 -1
- package/dist/src/lib/campaign/index.js +20 -2
- package/dist/src/lib/order/index.d.ts +2 -0
- package/dist/src/lib/order/index.js +26 -0
- package/package.json +1 -1
|
@@ -120,26 +120,6 @@ exports.LINKING_USER_LOGIN_AND_USER_DETAIL_MUTATION = (0, graphql_tag_1.gql) `
|
|
|
120
120
|
linkingUserLoginAndUserDetail(userLoginId: $userLoginId, partyId: $partyId)
|
|
121
121
|
}
|
|
122
122
|
`;
|
|
123
|
-
// mutation CreateUserDetail {
|
|
124
|
-
// createUserDetail(userLoginId: "2312312312", partnerId: "FOX") {
|
|
125
|
-
// partyId
|
|
126
|
-
// orgId
|
|
127
|
-
// fullName
|
|
128
|
-
// email
|
|
129
|
-
// phone
|
|
130
|
-
// address
|
|
131
|
-
// identityNumber
|
|
132
|
-
// gender
|
|
133
|
-
// birthDate
|
|
134
|
-
// avatarUrl
|
|
135
|
-
// accessToken
|
|
136
|
-
// username
|
|
137
|
-
// readyV2
|
|
138
|
-
// orgPermissionsMap
|
|
139
|
-
// orgPositionsMap
|
|
140
|
-
// orgRolesMap
|
|
141
|
-
// }
|
|
142
|
-
// }
|
|
143
123
|
exports.CREATE_USER_DETAIL_MUTATION = (0, graphql_tag_1.gql) `
|
|
144
124
|
mutation CreateUserDetail($userLoginId: String!, $partnerId: String!) {
|
|
145
125
|
createUserDetail(userLoginId: $userLoginId, partnerId: $partnerId) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ADD_CUSTOMER_ID_INTO_VOUCHER: import("graphql").DocumentNode;
|
|
@@ -1 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ADD_CUSTOMER_ID_INTO_VOUCHER = void 0;
|
|
7
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
|
+
exports.ADD_CUSTOMER_ID_INTO_VOUCHER = (0, graphql_tag_1.default) `
|
|
9
|
+
mutation AddCustomerToVoucher(
|
|
10
|
+
$partyId: String!
|
|
11
|
+
$voucherCode: String!
|
|
12
|
+
$userId: String!
|
|
13
|
+
) {
|
|
14
|
+
addCustomerToVoucher(
|
|
15
|
+
partyId: $partyId
|
|
16
|
+
voucherCode: $voucherCode
|
|
17
|
+
userId: $userId
|
|
18
|
+
) {
|
|
19
|
+
id
|
|
20
|
+
customerId
|
|
21
|
+
campaignActionId
|
|
22
|
+
campaignId
|
|
23
|
+
partyId
|
|
24
|
+
voucherCode
|
|
25
|
+
voucherType
|
|
26
|
+
status
|
|
27
|
+
discountAmount
|
|
28
|
+
discountPercent
|
|
29
|
+
usageLimitPerVoucher
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
`;
|
|
@@ -92,12 +92,12 @@ exports.CHECK_VALID_VOUCHER = (0, graphql_tag_1.gql) `
|
|
|
92
92
|
query CheckValidVoucher(
|
|
93
93
|
$partyId: String
|
|
94
94
|
$customerId: String
|
|
95
|
-
$
|
|
95
|
+
$campaignActionId: String!
|
|
96
96
|
) {
|
|
97
97
|
checkValidVoucher(
|
|
98
98
|
checkValidVoucherRequest: {
|
|
99
99
|
customerId: $customerId
|
|
100
|
-
|
|
100
|
+
campaignActionId: $campaignActionId
|
|
101
101
|
}
|
|
102
102
|
partyId: $partyId
|
|
103
103
|
) {
|
|
@@ -37,4 +37,7 @@ export declare class AuthService extends Service {
|
|
|
37
37
|
checkUsernameExisted(username: string): Promise<any>;
|
|
38
38
|
linkingUserLoginAndUserDetail(userLoginId: string, partyId: string): Promise<any>;
|
|
39
39
|
createUserDetail(userLoginId: string): Promise<any>;
|
|
40
|
+
sendSmsVerifyCode(username: string): Promise<any>;
|
|
41
|
+
verifyCode(username: string, code: string): Promise<any>;
|
|
42
|
+
resetPassword(username: string, newPassword: string, accessToken: string): Promise<any>;
|
|
40
43
|
}
|
|
@@ -38,7 +38,6 @@ class AuthService extends serviceSDK_1.Service {
|
|
|
38
38
|
loginRequest: Object.assign({ orgId: this.orgId }, loginRequest),
|
|
39
39
|
};
|
|
40
40
|
const data = yield this.graphqlMutation(mutations_1.LOGIN_MUTATION, variables);
|
|
41
|
-
console.log("🚀 ~ AuthService ~ login ~ data:", data);
|
|
42
41
|
return data.login;
|
|
43
42
|
});
|
|
44
43
|
}
|
|
@@ -175,5 +174,72 @@ class AuthService extends serviceSDK_1.Service {
|
|
|
175
174
|
}
|
|
176
175
|
});
|
|
177
176
|
}
|
|
177
|
+
// mutation VerifyCode {
|
|
178
|
+
// sendSmsVerifyCode(orgId: "FYP", username: "0971879660") {
|
|
179
|
+
// id
|
|
180
|
+
// code
|
|
181
|
+
// username
|
|
182
|
+
// timeExpired
|
|
183
|
+
// }
|
|
184
|
+
// }
|
|
185
|
+
sendSmsVerifyCode(username) {
|
|
186
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
const query = mutations_1.SEND_SMS_VERIFY_CODE_MUTATION;
|
|
188
|
+
const variables = {
|
|
189
|
+
orgId: this.orgId,
|
|
190
|
+
username,
|
|
191
|
+
};
|
|
192
|
+
try {
|
|
193
|
+
const response = yield this.graphqlMutation(query, variables);
|
|
194
|
+
return response.sendSmsVerifyCode;
|
|
195
|
+
}
|
|
196
|
+
catch (error) {
|
|
197
|
+
console.log(`Error in sendSmsVerifyCode: ${error}`);
|
|
198
|
+
throw error;
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
// mutation VerifyCode {
|
|
203
|
+
// verifyCode(
|
|
204
|
+
// orgId: "FYP"
|
|
205
|
+
// verifyCodeRequest: { username: "0971879660", code: "999999" }
|
|
206
|
+
// )
|
|
207
|
+
// }
|
|
208
|
+
verifyCode(username, code) {
|
|
209
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
210
|
+
const query = mutations_1.VERIFY_CODE_MUTATION;
|
|
211
|
+
const variables = {
|
|
212
|
+
orgId: this.orgId,
|
|
213
|
+
verifyCodeRequest: { username, code },
|
|
214
|
+
};
|
|
215
|
+
try {
|
|
216
|
+
const response = yield this.graphqlMutation(query, variables);
|
|
217
|
+
return response.verifyCode;
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
console.log(`Error in verifyCode: ${error}`);
|
|
221
|
+
throw error;
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
resetPassword(username, newPassword, accessToken) {
|
|
226
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
227
|
+
const query = mutations_1.RESET_PASSWORD_MUTATION;
|
|
228
|
+
const variables = {
|
|
229
|
+
orgId: this.orgId,
|
|
230
|
+
username,
|
|
231
|
+
newPassword,
|
|
232
|
+
accessToken,
|
|
233
|
+
};
|
|
234
|
+
try {
|
|
235
|
+
const response = yield this.graphqlMutation(query, variables);
|
|
236
|
+
return response.resetPassword;
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
console.log(`Error in resetPassword: ${error}`);
|
|
240
|
+
throw error;
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
}
|
|
178
244
|
}
|
|
179
245
|
exports.AuthService = AuthService;
|
|
@@ -9,8 +9,9 @@ export declare class CampaignService extends Service {
|
|
|
9
9
|
constructor(endpoint: string, orgId: string, storeId: string);
|
|
10
10
|
getCampaignActionActiveNow(customerId: string, campaignActionType: string): Promise<any>;
|
|
11
11
|
searchVouchers(campaignId: String, campaignActionId: String, campaignActionType: String, customerId: String, excludeExpired: Boolean, pageNumber: number, pageSize: number): Promise<any>;
|
|
12
|
-
checkValidVoucher(customerId: string,
|
|
12
|
+
checkValidVoucher(customerId: string, campaignActionId: string): Promise<any>;
|
|
13
13
|
getCampaignActiveNow(campaignActionType: string, customerId: string): Promise<any>;
|
|
14
14
|
getPromotionProductPrice(productId: String, productPrice: number): Promise<any>;
|
|
15
15
|
getVoucherAvailableForCustomer(campaignId: string, customerId: string, excludeExpired: Boolean): Promise<any>;
|
|
16
|
+
addCustomerToVoucher(voucherCode: string, userId: string): Promise<any>;
|
|
16
17
|
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.CampaignService = void 0;
|
|
13
13
|
const serviceSDK_1 = require("../serviceSDK");
|
|
14
14
|
const queries_1 = require("../../graphql/campaign/queries");
|
|
15
|
+
const mutations_1 = require("../../graphql/campaign/mutations");
|
|
15
16
|
class CampaignService extends serviceSDK_1.Service {
|
|
16
17
|
/**
|
|
17
18
|
* Constructs a new CampaignService instance.
|
|
@@ -65,13 +66,13 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
68
|
}
|
|
68
|
-
checkValidVoucher(customerId,
|
|
69
|
+
checkValidVoucher(customerId, campaignActionId) {
|
|
69
70
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
71
|
const query = queries_1.CHECK_VALID_VOUCHER;
|
|
71
72
|
const variables = {
|
|
72
73
|
partyId: this.orgId,
|
|
73
74
|
customerId,
|
|
74
|
-
|
|
75
|
+
campaignActionId,
|
|
75
76
|
};
|
|
76
77
|
try {
|
|
77
78
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -138,5 +139,22 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
138
139
|
}
|
|
139
140
|
});
|
|
140
141
|
}
|
|
142
|
+
addCustomerToVoucher(voucherCode, userId) {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
const query = mutations_1.ADD_CUSTOMER_ID_INTO_VOUCHER;
|
|
145
|
+
const variables = {
|
|
146
|
+
partyId: this.orgId,
|
|
147
|
+
voucherCode,
|
|
148
|
+
userId,
|
|
149
|
+
};
|
|
150
|
+
try {
|
|
151
|
+
const response = yield this.graphqlMutation(query, variables);
|
|
152
|
+
return response.addCustomerIdIntoVoucher;
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
throw error;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
141
159
|
}
|
|
142
160
|
exports.CampaignService = CampaignService;
|
|
@@ -459,4 +459,6 @@ export declare class OrderService extends Service {
|
|
|
459
459
|
enableProductDiary(orderId: string, orderItemId: string): Promise<any>;
|
|
460
460
|
removeMemberDiscount(orderId: string): Promise<any>;
|
|
461
461
|
getInfoChatApp(attributesName: string): Promise<any>;
|
|
462
|
+
updateCustomerInOrder(orderId: string, dataRequest: any): Promise<any>;
|
|
463
|
+
findCampaignActionGiftVoucher(): Promise<any>;
|
|
462
464
|
}
|
|
@@ -1343,5 +1343,31 @@ class OrderService extends serviceSDK_1.Service {
|
|
|
1343
1343
|
}
|
|
1344
1344
|
});
|
|
1345
1345
|
}
|
|
1346
|
+
updateCustomerInOrder(orderId, dataRequest) {
|
|
1347
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1348
|
+
const endpoint = `/front/orders/${this.orgId}/${orderId}/customerInfo`;
|
|
1349
|
+
const method = "PUT";
|
|
1350
|
+
try {
|
|
1351
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method, dataRequest);
|
|
1352
|
+
return response;
|
|
1353
|
+
}
|
|
1354
|
+
catch (error) {
|
|
1355
|
+
throw error;
|
|
1356
|
+
}
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
findCampaignActionGiftVoucher() {
|
|
1360
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1361
|
+
const endpoint = `/front/orders/${this.orgId}/findCampaignActionGiftVoucher`;
|
|
1362
|
+
const method = "GET";
|
|
1363
|
+
try {
|
|
1364
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
1365
|
+
return response;
|
|
1366
|
+
}
|
|
1367
|
+
catch (error) {
|
|
1368
|
+
throw error;
|
|
1369
|
+
}
|
|
1370
|
+
});
|
|
1371
|
+
}
|
|
1346
1372
|
}
|
|
1347
1373
|
exports.OrderService = OrderService;
|