@longvansoftware/storefront-js-client 2.2.7-beta.10 → 2.2.7-beta.12
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/queries.d.ts +3 -0
- package/dist/src/graphql/auth/queries.js +16 -1
- package/dist/src/graphql/campaign/mutations.js +2 -2
- package/dist/src/graphql/campaign/queries.d.ts +1 -0
- package/dist/src/graphql/campaign/queries.js +42 -1
- package/dist/src/lib/auth/index.d.ts +3 -0
- package/dist/src/lib/auth/index.js +54 -0
- package/dist/src/lib/campaign/index.d.ts +2 -1
- package/dist/src/lib/campaign/index.js +18 -2
- package/package.json +1 -1
|
@@ -2,3 +2,6 @@ export declare const GET_USER_DETAIL: import("graphql").DocumentNode;
|
|
|
2
2
|
export declare const GET_USER_LOGIN_BY_TOKEN: import("graphql").DocumentNode;
|
|
3
3
|
export declare const GET_USER_LOGIN_BY_USER_LOGIN_ID: import("graphql").DocumentNode;
|
|
4
4
|
export declare const CHECK_USERNAME_EXISTED: import("graphql").DocumentNode;
|
|
5
|
+
export declare const LOGIN_GOOGLE: import("graphql").DocumentNode;
|
|
6
|
+
export declare const LOGIN_FACEBOOK: import("graphql").DocumentNode;
|
|
7
|
+
export declare const LOGIN_ZALO: import("graphql").DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CHECK_USERNAME_EXISTED = exports.GET_USER_LOGIN_BY_USER_LOGIN_ID = exports.GET_USER_LOGIN_BY_TOKEN = exports.GET_USER_DETAIL = void 0;
|
|
3
|
+
exports.LOGIN_ZALO = exports.LOGIN_FACEBOOK = exports.LOGIN_GOOGLE = exports.CHECK_USERNAME_EXISTED = exports.GET_USER_LOGIN_BY_USER_LOGIN_ID = exports.GET_USER_LOGIN_BY_TOKEN = exports.GET_USER_DETAIL = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.GET_USER_DETAIL = (0, graphql_tag_1.gql) `
|
|
6
6
|
query GetUserDetail($orgId: String!, $accessToken: String!) {
|
|
@@ -58,3 +58,18 @@ exports.CHECK_USERNAME_EXISTED = (0, graphql_tag_1.gql) `
|
|
|
58
58
|
checkUsernameExisted(username: $username, orgId: $orgId)
|
|
59
59
|
}
|
|
60
60
|
`;
|
|
61
|
+
exports.LOGIN_GOOGLE = (0, graphql_tag_1.gql) `
|
|
62
|
+
query LoginGoogle($orgId: String!, $type: String!, $redirectUrl: String!) {
|
|
63
|
+
loginGoogle(orgId: $orgId, type: $type, redirectUrl: $redirectUrl)
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
exports.LOGIN_FACEBOOK = (0, graphql_tag_1.gql) `
|
|
67
|
+
query LoginFacebook($orgId: String!, $type: String!, $redirectUrl: String!) {
|
|
68
|
+
loginFacebook(orgId: $orgId, type: $type, redirectUrl: $redirectUrl)
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
exports.LOGIN_ZALO = (0, graphql_tag_1.gql) `
|
|
72
|
+
query LoginZalo($orgId: String!, $type: String!, $redirectUrl: String!) {
|
|
73
|
+
loginZalo(orgId: $orgId, type: $type, redirectUrl: $redirectUrl)
|
|
74
|
+
}
|
|
75
|
+
`;
|
|
@@ -8,12 +8,12 @@ const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
|
8
8
|
exports.ADD_CUSTOMER_ID_INTO_VOUCHER = (0, graphql_tag_1.default) `
|
|
9
9
|
mutation AddCustomerToVoucher(
|
|
10
10
|
$partyId: String!
|
|
11
|
-
$
|
|
11
|
+
$voucherCode: String!
|
|
12
12
|
$userId: String!
|
|
13
13
|
) {
|
|
14
14
|
addCustomerToVoucher(
|
|
15
15
|
partyId: $partyId
|
|
16
|
-
|
|
16
|
+
voucherCode: $voucherCode
|
|
17
17
|
userId: $userId
|
|
18
18
|
) {
|
|
19
19
|
id
|
|
@@ -4,3 +4,4 @@ export declare const CHECK_VALID_VOUCHER: import("graphql").DocumentNode;
|
|
|
4
4
|
export declare const GET_CAMPAIGN_ACTIVE_NOW: import("graphql").DocumentNode;
|
|
5
5
|
export declare const GET_PROMOTION_PRODUCT_PRICE: import("graphql").DocumentNode;
|
|
6
6
|
export declare const GET_VOUCHER_AVAILABLE_FOR_CUSTOMER: import("graphql").DocumentNode;
|
|
7
|
+
export declare const SUGGEST_VOUCHER: import("graphql").DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_VOUCHER_AVAILABLE_FOR_CUSTOMER = exports.GET_PROMOTION_PRODUCT_PRICE = exports.GET_CAMPAIGN_ACTIVE_NOW = exports.CHECK_VALID_VOUCHER = exports.GET_VOUCHERS = exports.GET_CAMPAIGN_ACTION_ACTIVE_NOW = void 0;
|
|
3
|
+
exports.SUGGEST_VOUCHER = exports.GET_VOUCHER_AVAILABLE_FOR_CUSTOMER = exports.GET_PROMOTION_PRODUCT_PRICE = exports.GET_CAMPAIGN_ACTIVE_NOW = exports.CHECK_VALID_VOUCHER = exports.GET_VOUCHERS = exports.GET_CAMPAIGN_ACTION_ACTIVE_NOW = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
exports.GET_CAMPAIGN_ACTION_ACTIVE_NOW = (0, graphql_tag_1.gql) `
|
|
6
6
|
query GetCampaignActionActiveNow(
|
|
@@ -256,3 +256,44 @@ exports.GET_VOUCHER_AVAILABLE_FOR_CUSTOMER = (0, graphql_tag_1.gql) `
|
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
`;
|
|
259
|
+
exports.SUGGEST_VOUCHER = (0, graphql_tag_1.gql) `
|
|
260
|
+
query SuggestVoucher($partyId: String, $excludeExpired: Boolean) {
|
|
261
|
+
suggestVoucher(
|
|
262
|
+
searchVoucherRequest: {
|
|
263
|
+
partyId: $partyId
|
|
264
|
+
excludeExpired: $excludeExpired
|
|
265
|
+
}
|
|
266
|
+
) {
|
|
267
|
+
total
|
|
268
|
+
totalPages
|
|
269
|
+
totalElements
|
|
270
|
+
last
|
|
271
|
+
first
|
|
272
|
+
number
|
|
273
|
+
numberOfElements
|
|
274
|
+
size
|
|
275
|
+
empty
|
|
276
|
+
content {
|
|
277
|
+
campaignActionId
|
|
278
|
+
campaignId
|
|
279
|
+
partyId
|
|
280
|
+
voucherCode
|
|
281
|
+
voucherType
|
|
282
|
+
status
|
|
283
|
+
discountAmount
|
|
284
|
+
discountPercent
|
|
285
|
+
usageLimitPerVoucher
|
|
286
|
+
maximumDiscount
|
|
287
|
+
numberOfTimeUsed
|
|
288
|
+
id
|
|
289
|
+
createdStamp
|
|
290
|
+
updatedStamp
|
|
291
|
+
updatedBy
|
|
292
|
+
createdBy
|
|
293
|
+
isBirthday
|
|
294
|
+
customerId
|
|
295
|
+
scope
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
`;
|
|
@@ -40,4 +40,7 @@ export declare class AuthService extends Service {
|
|
|
40
40
|
sendSmsVerifyCode(username: string): Promise<any>;
|
|
41
41
|
verifyCode(username: string, code: string): Promise<any>;
|
|
42
42
|
resetPassword(username: string, newPassword: string, accessToken: string): Promise<any>;
|
|
43
|
+
loginGoogle(redirectUrl: string): Promise<any>;
|
|
44
|
+
loginFacebook(redirectUrl: string): Promise<any>;
|
|
45
|
+
loginZalo(redirectUrl: string): Promise<any>;
|
|
43
46
|
}
|
|
@@ -241,5 +241,59 @@ class AuthService extends serviceSDK_1.Service {
|
|
|
241
241
|
}
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
|
+
loginGoogle(redirectUrl) {
|
|
245
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
246
|
+
const query = queries_1.LOGIN_GOOGLE;
|
|
247
|
+
const variables = {
|
|
248
|
+
orgId: this.orgId,
|
|
249
|
+
type: "login",
|
|
250
|
+
redirectUrl,
|
|
251
|
+
};
|
|
252
|
+
try {
|
|
253
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
254
|
+
return response.loginGoogle;
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
console.log(`Error in loginGoogle: ${error}`);
|
|
258
|
+
throw error;
|
|
259
|
+
}
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
loginFacebook(redirectUrl) {
|
|
263
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
264
|
+
const query = queries_1.LOGIN_FACEBOOK;
|
|
265
|
+
const variables = {
|
|
266
|
+
orgId: this.orgId,
|
|
267
|
+
type: "login",
|
|
268
|
+
redirectUrl,
|
|
269
|
+
};
|
|
270
|
+
try {
|
|
271
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
272
|
+
return response.loginFacebook;
|
|
273
|
+
}
|
|
274
|
+
catch (error) {
|
|
275
|
+
console.log(`Error in loginFacebook: ${error}`);
|
|
276
|
+
throw error;
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
loginZalo(redirectUrl) {
|
|
281
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
282
|
+
const query = queries_1.LOGIN_ZALO;
|
|
283
|
+
const variables = {
|
|
284
|
+
orgId: this.orgId,
|
|
285
|
+
type: "login",
|
|
286
|
+
redirectUrl,
|
|
287
|
+
};
|
|
288
|
+
try {
|
|
289
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
290
|
+
return response.loginZalo;
|
|
291
|
+
}
|
|
292
|
+
catch (error) {
|
|
293
|
+
console.log(`Error in loginZalo: ${error}`);
|
|
294
|
+
throw error;
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
}
|
|
244
298
|
}
|
|
245
299
|
exports.AuthService = AuthService;
|
|
@@ -13,5 +13,6 @@ export declare class CampaignService extends Service {
|
|
|
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(
|
|
16
|
+
addCustomerToVoucher(voucherCode: string, userId: string): Promise<any>;
|
|
17
|
+
suggestVoucher(): Promise<any>;
|
|
17
18
|
}
|
|
@@ -139,12 +139,12 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
139
139
|
}
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
|
-
addCustomerToVoucher(
|
|
142
|
+
addCustomerToVoucher(voucherCode, userId) {
|
|
143
143
|
return __awaiter(this, void 0, void 0, function* () {
|
|
144
144
|
const query = mutations_1.ADD_CUSTOMER_ID_INTO_VOUCHER;
|
|
145
145
|
const variables = {
|
|
146
146
|
partyId: this.orgId,
|
|
147
|
-
|
|
147
|
+
voucherCode,
|
|
148
148
|
userId,
|
|
149
149
|
};
|
|
150
150
|
try {
|
|
@@ -156,5 +156,21 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
156
156
|
}
|
|
157
157
|
});
|
|
158
158
|
}
|
|
159
|
+
suggestVoucher() {
|
|
160
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
const query = queries_1.SUGGEST_VOUCHER;
|
|
162
|
+
const variables = {
|
|
163
|
+
partyId: this.orgId,
|
|
164
|
+
excludeExpired: true
|
|
165
|
+
};
|
|
166
|
+
try {
|
|
167
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
168
|
+
return response.suggestVoucher;
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
throw error;
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
}
|
|
159
175
|
}
|
|
160
176
|
exports.CampaignService = CampaignService;
|