@longvansoftware/storefront-js-client 2.5.8 → 2.6.0
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 +92 -1
- package/dist/src/lib/campaign/index.d.ts +3 -0
- package/dist/src/lib/campaign/index.js +49 -0
- 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(
|
|
@@ -258,3 +258,94 @@ exports.GET_VOUCHER_AVAILABLE_FOR_CUSTOMER = (0, graphql_tag_1.gql) `
|
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
`;
|
|
261
|
+
exports.SUGGEST_VOUCHER = (0, graphql_tag_1.gql) `
|
|
262
|
+
query SuggestVoucher($partyId: String, $excludeExpired: Boolean) {
|
|
263
|
+
suggestVoucher(
|
|
264
|
+
searchVoucherRequest: {
|
|
265
|
+
partyId: $partyId
|
|
266
|
+
excludeExpired: $excludeExpired
|
|
267
|
+
}
|
|
268
|
+
) {
|
|
269
|
+
total
|
|
270
|
+
totalPages
|
|
271
|
+
totalElements
|
|
272
|
+
last
|
|
273
|
+
first
|
|
274
|
+
number
|
|
275
|
+
numberOfElements
|
|
276
|
+
size
|
|
277
|
+
empty
|
|
278
|
+
content {
|
|
279
|
+
campaignActionId
|
|
280
|
+
campaignId
|
|
281
|
+
partyId
|
|
282
|
+
voucherCode
|
|
283
|
+
voucherType
|
|
284
|
+
status
|
|
285
|
+
discountAmount
|
|
286
|
+
discountPercent
|
|
287
|
+
usageLimitPerVoucher
|
|
288
|
+
maximumDiscount
|
|
289
|
+
numberOfTimeUsed
|
|
290
|
+
id
|
|
291
|
+
createdStamp
|
|
292
|
+
updatedStamp
|
|
293
|
+
updatedBy
|
|
294
|
+
createdBy
|
|
295
|
+
isBirthday
|
|
296
|
+
customerId
|
|
297
|
+
scope
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
`;
|
|
302
|
+
// query GetCampaignActionById {
|
|
303
|
+
// getCampaignActionById(id: "20.1273.888") {
|
|
304
|
+
// name
|
|
305
|
+
// description
|
|
306
|
+
// partyId
|
|
307
|
+
// type
|
|
308
|
+
// viewTemplateId
|
|
309
|
+
// urlTemplate
|
|
310
|
+
// shortCode
|
|
311
|
+
// uriPattern
|
|
312
|
+
// parameterPattern
|
|
313
|
+
// status
|
|
314
|
+
// extendDaysForHeadReview
|
|
315
|
+
// priorityLevel
|
|
316
|
+
// positionConnectionType
|
|
317
|
+
// baseCommissionPercent
|
|
318
|
+
// targetType
|
|
319
|
+
// id
|
|
320
|
+
// createdStamp
|
|
321
|
+
// updatedStamp
|
|
322
|
+
// updatedBy
|
|
323
|
+
// createdBy
|
|
324
|
+
// }
|
|
325
|
+
// }
|
|
326
|
+
exports.GET_CAMPAIGN_ACTION_BY_ID = (0, graphql_tag_1.gql) `
|
|
327
|
+
query GetCampaignActionById($id: String!) {
|
|
328
|
+
getCampaignActionById(id: $id) {
|
|
329
|
+
name
|
|
330
|
+
description
|
|
331
|
+
partyId
|
|
332
|
+
type
|
|
333
|
+
viewTemplateId
|
|
334
|
+
urlTemplate
|
|
335
|
+
shortCode
|
|
336
|
+
uriPattern
|
|
337
|
+
parameterPattern
|
|
338
|
+
status
|
|
339
|
+
extendDaysForHeadReview
|
|
340
|
+
priorityLevel
|
|
341
|
+
positionConnectionType
|
|
342
|
+
baseCommissionPercent
|
|
343
|
+
targetType
|
|
344
|
+
id
|
|
345
|
+
createdStamp
|
|
346
|
+
updatedStamp
|
|
347
|
+
updatedBy
|
|
348
|
+
createdBy
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
`;
|
|
@@ -13,4 +13,7 @@ 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(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.
|
|
@@ -139,5 +140,53 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
139
140
|
}
|
|
140
141
|
});
|
|
141
142
|
}
|
|
143
|
+
addCustomerToVoucher(voucherCode, userId) {
|
|
144
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
+
const query = mutations_1.ADD_CUSTOMER_ID_INTO_VOUCHER;
|
|
146
|
+
const variables = {
|
|
147
|
+
partyId: this.orgId,
|
|
148
|
+
voucherCode,
|
|
149
|
+
userId,
|
|
150
|
+
};
|
|
151
|
+
try {
|
|
152
|
+
const response = yield this.graphqlMutation(query, variables);
|
|
153
|
+
return response.addCustomerIdIntoVoucher;
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
throw error;
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
suggestVoucher() {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
162
|
+
const query = queries_1.SUGGEST_VOUCHER;
|
|
163
|
+
const variables = {
|
|
164
|
+
partyId: this.orgId,
|
|
165
|
+
excludeExpired: true,
|
|
166
|
+
};
|
|
167
|
+
try {
|
|
168
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
169
|
+
return response.suggestVoucher;
|
|
170
|
+
}
|
|
171
|
+
catch (error) {
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
getCampaignActionById(id) {
|
|
177
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
+
const query = queries_1.GET_CAMPAIGN_ACTION_BY_ID;
|
|
179
|
+
const variables = {
|
|
180
|
+
id,
|
|
181
|
+
};
|
|
182
|
+
try {
|
|
183
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
184
|
+
return response.getCampaignActionById;
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
throw error;
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
142
191
|
}
|
|
143
192
|
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;
|