@longvansoftware/storefront-js-client 2.5.8 → 2.6.1
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/config/config.js +1 -1
- 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.d.ts +2 -0
- package/dist/src/graphql/campaign/queries.js +94 -1
- package/dist/src/lib/campaign/index.d.ts +4 -1
- package/dist/src/lib/campaign/index.js +51 -1
- package/dist/src/lib/portal/index.d.ts +1 -0
- package/dist/src/lib/portal/index.js +13 -0
- package/package.json +1 -1
package/dist/config/config.js
CHANGED
|
@@ -18,7 +18,7 @@ exports.environmentEndpoints = {
|
|
|
18
18
|
warehouseV2: "https://portal.dev.longvan.vn/facility-api",
|
|
19
19
|
deepLinkVietQr: "https://api.vietqr.io/v2",
|
|
20
20
|
comhub: "https://com-hub.dev.longvan.vn/com-hub/v1",
|
|
21
|
-
portal: "
|
|
21
|
+
portal: "https://portal.dev.longvan.vn",
|
|
22
22
|
upload: "https://fileservice.dev.longvan.vn/omnichannel/files/upload",
|
|
23
23
|
getImage: "https://s3-img-gw.longvan.net/img/omnichannel",
|
|
24
24
|
accounting: "https://api-gateway.dev.longvan.vn/accounting-service",
|
|
@@ -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
|
+
`;
|
|
@@ -4,3 +4,5 @@ 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;
|
|
8
|
+
export declare const GET_CAMPAIGN_ACTION_BY_ID: 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.GET_CAMPAIGN_ACTION_BY_ID = 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(
|
|
@@ -216,6 +216,7 @@ exports.GET_VOUCHER_AVAILABLE_FOR_CUSTOMER = (0, graphql_tag_1.gql) `
|
|
|
216
216
|
$campaignId: String
|
|
217
217
|
$customerId: String
|
|
218
218
|
$excludeExpired: Boolean
|
|
219
|
+
$isPageAble: Boolean
|
|
219
220
|
) {
|
|
220
221
|
getVoucherAvailableForCustomer(
|
|
221
222
|
searchVoucherRequest: {
|
|
@@ -224,6 +225,7 @@ exports.GET_VOUCHER_AVAILABLE_FOR_CUSTOMER = (0, graphql_tag_1.gql) `
|
|
|
224
225
|
campaignId: $campaignId
|
|
225
226
|
customerId: $customerId
|
|
226
227
|
excludeExpired: $excludeExpired
|
|
228
|
+
isPageAble: $isPageAble
|
|
227
229
|
}
|
|
228
230
|
) {
|
|
229
231
|
total
|
|
@@ -258,3 +260,94 @@ exports.GET_VOUCHER_AVAILABLE_FOR_CUSTOMER = (0, graphql_tag_1.gql) `
|
|
|
258
260
|
}
|
|
259
261
|
}
|
|
260
262
|
`;
|
|
263
|
+
exports.SUGGEST_VOUCHER = (0, graphql_tag_1.gql) `
|
|
264
|
+
query SuggestVoucher($partyId: String, $excludeExpired: Boolean) {
|
|
265
|
+
suggestVoucher(
|
|
266
|
+
searchVoucherRequest: {
|
|
267
|
+
partyId: $partyId
|
|
268
|
+
excludeExpired: $excludeExpired
|
|
269
|
+
}
|
|
270
|
+
) {
|
|
271
|
+
total
|
|
272
|
+
totalPages
|
|
273
|
+
totalElements
|
|
274
|
+
last
|
|
275
|
+
first
|
|
276
|
+
number
|
|
277
|
+
numberOfElements
|
|
278
|
+
size
|
|
279
|
+
empty
|
|
280
|
+
content {
|
|
281
|
+
campaignActionId
|
|
282
|
+
campaignId
|
|
283
|
+
partyId
|
|
284
|
+
voucherCode
|
|
285
|
+
voucherType
|
|
286
|
+
status
|
|
287
|
+
discountAmount
|
|
288
|
+
discountPercent
|
|
289
|
+
usageLimitPerVoucher
|
|
290
|
+
maximumDiscount
|
|
291
|
+
numberOfTimeUsed
|
|
292
|
+
id
|
|
293
|
+
createdStamp
|
|
294
|
+
updatedStamp
|
|
295
|
+
updatedBy
|
|
296
|
+
createdBy
|
|
297
|
+
isBirthday
|
|
298
|
+
customerId
|
|
299
|
+
scope
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
`;
|
|
304
|
+
// query GetCampaignActionById {
|
|
305
|
+
// getCampaignActionById(id: "20.1273.888") {
|
|
306
|
+
// name
|
|
307
|
+
// description
|
|
308
|
+
// partyId
|
|
309
|
+
// type
|
|
310
|
+
// viewTemplateId
|
|
311
|
+
// urlTemplate
|
|
312
|
+
// shortCode
|
|
313
|
+
// uriPattern
|
|
314
|
+
// parameterPattern
|
|
315
|
+
// status
|
|
316
|
+
// extendDaysForHeadReview
|
|
317
|
+
// priorityLevel
|
|
318
|
+
// positionConnectionType
|
|
319
|
+
// baseCommissionPercent
|
|
320
|
+
// targetType
|
|
321
|
+
// id
|
|
322
|
+
// createdStamp
|
|
323
|
+
// updatedStamp
|
|
324
|
+
// updatedBy
|
|
325
|
+
// createdBy
|
|
326
|
+
// }
|
|
327
|
+
// }
|
|
328
|
+
exports.GET_CAMPAIGN_ACTION_BY_ID = (0, graphql_tag_1.gql) `
|
|
329
|
+
query GetCampaignActionById($id: String!) {
|
|
330
|
+
getCampaignActionById(id: $id) {
|
|
331
|
+
name
|
|
332
|
+
description
|
|
333
|
+
partyId
|
|
334
|
+
type
|
|
335
|
+
viewTemplateId
|
|
336
|
+
urlTemplate
|
|
337
|
+
shortCode
|
|
338
|
+
uriPattern
|
|
339
|
+
parameterPattern
|
|
340
|
+
status
|
|
341
|
+
extendDaysForHeadReview
|
|
342
|
+
priorityLevel
|
|
343
|
+
positionConnectionType
|
|
344
|
+
baseCommissionPercent
|
|
345
|
+
targetType
|
|
346
|
+
id
|
|
347
|
+
createdStamp
|
|
348
|
+
updatedStamp
|
|
349
|
+
updatedBy
|
|
350
|
+
createdBy
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
`;
|
|
@@ -12,5 +12,8 @@ export declare class CampaignService extends Service {
|
|
|
12
12
|
checkValidVoucher(customerId: string, voucherCode: string): Promise<any>;
|
|
13
13
|
getCampaignActiveNow(campaignActionType: string, customerId: string): Promise<any>;
|
|
14
14
|
getPromotionProductPrice(productId: String, productPrice: number): Promise<any>;
|
|
15
|
-
getVoucherAvailableForCustomer(campaignId: string, customerId: string, excludeExpired: Boolean): Promise<any>;
|
|
15
|
+
getVoucherAvailableForCustomer(campaignId: string, customerId: string, excludeExpired: Boolean, isPageAble: Boolean): Promise<any>;
|
|
16
|
+
addCustomerToVoucher(voucherCode: string, userId: string): Promise<any>;
|
|
17
|
+
suggestVoucher(): Promise<any>;
|
|
18
|
+
getCampaignActionById(id: string): Promise<any>;
|
|
16
19
|
}
|
|
@@ -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.
|
|
@@ -120,7 +121,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
120
121
|
}
|
|
121
122
|
});
|
|
122
123
|
}
|
|
123
|
-
getVoucherAvailableForCustomer(campaignId, customerId, excludeExpired) {
|
|
124
|
+
getVoucherAvailableForCustomer(campaignId, customerId, excludeExpired, isPageAble) {
|
|
124
125
|
return __awaiter(this, void 0, void 0, function* () {
|
|
125
126
|
const query = queries_1.GET_VOUCHER_AVAILABLE_FOR_CUSTOMER;
|
|
126
127
|
const variables = {
|
|
@@ -129,6 +130,7 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
129
130
|
campaignId,
|
|
130
131
|
customerId,
|
|
131
132
|
excludeExpired,
|
|
133
|
+
isPageAble,
|
|
132
134
|
};
|
|
133
135
|
try {
|
|
134
136
|
const response = yield this.graphqlQuery(query, variables);
|
|
@@ -139,5 +141,53 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
139
141
|
}
|
|
140
142
|
});
|
|
141
143
|
}
|
|
144
|
+
addCustomerToVoucher(voucherCode, userId) {
|
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
const query = mutations_1.ADD_CUSTOMER_ID_INTO_VOUCHER;
|
|
147
|
+
const variables = {
|
|
148
|
+
partyId: this.orgId,
|
|
149
|
+
voucherCode,
|
|
150
|
+
userId,
|
|
151
|
+
};
|
|
152
|
+
try {
|
|
153
|
+
const response = yield this.graphqlMutation(query, variables);
|
|
154
|
+
return response.addCustomerIdIntoVoucher;
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
suggestVoucher() {
|
|
162
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
163
|
+
const query = queries_1.SUGGEST_VOUCHER;
|
|
164
|
+
const variables = {
|
|
165
|
+
partyId: this.orgId,
|
|
166
|
+
excludeExpired: true,
|
|
167
|
+
};
|
|
168
|
+
try {
|
|
169
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
170
|
+
return response.suggestVoucher;
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
throw error;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
getCampaignActionById(id) {
|
|
178
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
179
|
+
const query = queries_1.GET_CAMPAIGN_ACTION_BY_ID;
|
|
180
|
+
const variables = {
|
|
181
|
+
id,
|
|
182
|
+
};
|
|
183
|
+
try {
|
|
184
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
185
|
+
return response.getCampaignActionById;
|
|
186
|
+
}
|
|
187
|
+
catch (error) {
|
|
188
|
+
throw error;
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
}
|
|
142
192
|
}
|
|
143
193
|
exports.CampaignService = CampaignService;
|
|
@@ -8,4 +8,5 @@ export declare class PortalService extends Service {
|
|
|
8
8
|
redirectLink(sku?: string, id?: string): string;
|
|
9
9
|
imageProduct(parentId: string, parentType: string, width?: number, height?: number): string;
|
|
10
10
|
imagesProduct(parentId: string, parentType: string, width?: number, height?: number): string;
|
|
11
|
+
completeOrder(orderId: string, byUser: string): Promise<any>;
|
|
11
12
|
}
|
|
@@ -85,5 +85,18 @@ class PortalService extends serviceSDK_1.Service {
|
|
|
85
85
|
const url = `${this.endpoint}/image-gateway/public/images/${parentType}/${parentId}?w=${width}&h=${height}`;
|
|
86
86
|
return url;
|
|
87
87
|
}
|
|
88
|
+
completeOrder(orderId, byUser) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
const endpoint = `/fulfillment-api/public/fulfillment/${this.orgId}/${orderId}/complete-fulfillment/${byUser}`;
|
|
91
|
+
const method = "PUT";
|
|
92
|
+
try {
|
|
93
|
+
const response = yield this.restApiCallWithToken(endpoint, method);
|
|
94
|
+
return response;
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
88
101
|
}
|
|
89
102
|
exports.PortalService = PortalService;
|