@longvansoftware/storefront-js-client 2.0.2 → 2.0.4
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/campaign/queries.d.ts +1 -0
- package/dist/src/graphql/campaign/queries.js +34 -3
- package/dist/src/graphql/product/queries.d.ts +1 -0
- package/dist/src/graphql/product/queries.js +105 -15
- package/dist/src/lib/campaign/index.d.ts +1 -0
- package/dist/src/lib/campaign/index.js +18 -0
- package/dist/src/lib/product/index.d.ts +2 -0
- package/dist/src/lib/product/index.js +35 -0
- package/package.json +1 -1
|
@@ -2,3 +2,4 @@ export declare const GET_CAMPAIGN_ACTION_ACTIVE_NOW: import("graphql").DocumentN
|
|
|
2
2
|
export declare const GET_VOUCHERS: import("graphql").DocumentNode;
|
|
3
3
|
export declare const CHECK_VALID_VOUCHER: import("graphql").DocumentNode;
|
|
4
4
|
export declare const GET_CAMPAIGN_ACTIVE_NOW: import("graphql").DocumentNode;
|
|
5
|
+
export declare const GET_PROMOTION_PRODUCT_PRICE: import("graphql").DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_CAMPAIGN_ACTIVE_NOW = exports.CHECK_VALID_VOUCHER = exports.GET_VOUCHERS = exports.GET_CAMPAIGN_ACTION_ACTIVE_NOW = void 0;
|
|
3
|
+
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(
|
|
@@ -52,8 +52,8 @@ exports.GET_VOUCHERS = (0, graphql_tag_1.gql) `
|
|
|
52
52
|
campaignActionType: $campaignActionType
|
|
53
53
|
customerId: $customerId
|
|
54
54
|
excludeExpired: $excludeExpired
|
|
55
|
-
pageNumber
|
|
56
|
-
pageSize
|
|
55
|
+
pageNumber: $pageNumber
|
|
56
|
+
pageSize: $pageSize
|
|
57
57
|
}
|
|
58
58
|
) {
|
|
59
59
|
total
|
|
@@ -176,3 +176,34 @@ exports.GET_CAMPAIGN_ACTIVE_NOW = (0, graphql_tag_1.gql) `
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
`;
|
|
179
|
+
exports.GET_PROMOTION_PRODUCT_PRICE = (0, graphql_tag_1.gql) `
|
|
180
|
+
query GetPromotionProductPrice(
|
|
181
|
+
$partyId: String!
|
|
182
|
+
$productStoreId: String!
|
|
183
|
+
$productId: String!
|
|
184
|
+
$productPrice: BigDecimal!
|
|
185
|
+
) {
|
|
186
|
+
getPromotionProductPrice(
|
|
187
|
+
partyId: $partyId
|
|
188
|
+
productStoreId: $productStoreId
|
|
189
|
+
productId: $productId
|
|
190
|
+
productPrice: $productPrice
|
|
191
|
+
) {
|
|
192
|
+
campaignId
|
|
193
|
+
campaignName
|
|
194
|
+
statusCampaign
|
|
195
|
+
campaignDescription
|
|
196
|
+
fromDate
|
|
197
|
+
toDate
|
|
198
|
+
campaignPrivateUse
|
|
199
|
+
useWithOtherCampaignIds
|
|
200
|
+
campaignActionId
|
|
201
|
+
campaignActionName
|
|
202
|
+
type
|
|
203
|
+
campaignActionDescription
|
|
204
|
+
priorityLevel
|
|
205
|
+
campaignActionPrivateUse
|
|
206
|
+
useWithOtherCampaignActionIds
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
`;
|
|
@@ -12,3 +12,4 @@ export declare const GET_POLICY: import("graphql").DocumentNode;
|
|
|
12
12
|
export declare const GET_STORES: import("graphql").DocumentNode;
|
|
13
13
|
export declare const GET_DETAIL_STORES: import("graphql").DocumentNode;
|
|
14
14
|
export declare const GET_PRODUCT_IMAGE: import("graphql").DocumentNode;
|
|
15
|
+
export declare const GET_PRODUCT: import("graphql").DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_PRODUCT_IMAGE = exports.GET_DETAIL_STORES = exports.GET_STORES = exports.GET_POLICY = exports.GET_PRODUCT_OPTION = exports.GET_BRAND_DETAIL_QUERY = exports.GET_BRANDS_BY_CATEGORY_QUERY = exports.GET_BRANDS_QUERY = exports.GET_CATEGORY_BY_ID_QUERY = exports.GET_CATEGORY_BY_HANDLE_QUERY = exports.GET_CATEGORIES_QUERY = exports.GET_SIMPLE_PRODUCTS_QUERY = exports.GET_PRODUCT_BY_SLUG_QUERY = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
|
|
3
|
+
exports.GET_PRODUCT = exports.GET_PRODUCT_IMAGE = exports.GET_DETAIL_STORES = exports.GET_STORES = exports.GET_POLICY = exports.GET_PRODUCT_OPTION = exports.GET_BRAND_DETAIL_QUERY = exports.GET_BRANDS_BY_CATEGORY_QUERY = exports.GET_BRANDS_QUERY = exports.GET_CATEGORY_BY_ID_QUERY = exports.GET_CATEGORY_BY_HANDLE_QUERY = exports.GET_CATEGORIES_QUERY = exports.GET_SIMPLE_PRODUCTS_QUERY = exports.GET_PRODUCT_BY_SLUG_QUERY = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
|
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
|
5
5
|
// export const GET_PRODUCT_BY_ID_QUERY = gql`
|
|
6
6
|
// query GetProductById(
|
|
@@ -90,8 +90,16 @@ const graphql_tag_1 = require("graphql-tag");
|
|
|
90
90
|
// }
|
|
91
91
|
// `;
|
|
92
92
|
exports.GET_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
|
|
93
|
-
query GetProductById(
|
|
94
|
-
|
|
93
|
+
query GetProductById(
|
|
94
|
+
$partnerId: String!
|
|
95
|
+
$storeChannel: String!
|
|
96
|
+
$productId: String!
|
|
97
|
+
) {
|
|
98
|
+
getProductById(
|
|
99
|
+
partnerId: $partnerId
|
|
100
|
+
storeChannel: $storeChannel
|
|
101
|
+
productId: $productId
|
|
102
|
+
) {
|
|
95
103
|
id
|
|
96
104
|
title
|
|
97
105
|
description
|
|
@@ -144,8 +152,16 @@ exports.GET_PRODUCT_BY_ID_QUERY = (0, graphql_tag_1.gql) `
|
|
|
144
152
|
}
|
|
145
153
|
`;
|
|
146
154
|
exports.GET_PRODUCT_BY_SLUG_QUERY = (0, graphql_tag_1.gql) `
|
|
147
|
-
query GetProductByHandle(
|
|
148
|
-
|
|
155
|
+
query GetProductByHandle(
|
|
156
|
+
$partnerId: String!
|
|
157
|
+
$storeChannel: String!
|
|
158
|
+
$handle: String!
|
|
159
|
+
) {
|
|
160
|
+
getProductByHandle(
|
|
161
|
+
partnerId: $partnerId
|
|
162
|
+
storeChannel: $storeChannel
|
|
163
|
+
handle: $handle
|
|
164
|
+
) {
|
|
149
165
|
id
|
|
150
166
|
title
|
|
151
167
|
description
|
|
@@ -244,15 +260,19 @@ exports.GET_SIMPLE_PRODUCTS_QUERY = (0, graphql_tag_1.gql) `
|
|
|
244
260
|
id
|
|
245
261
|
title
|
|
246
262
|
sku
|
|
247
|
-
subType
|
|
248
263
|
shortDescription
|
|
249
|
-
|
|
264
|
+
description
|
|
250
265
|
subType
|
|
266
|
+
vat
|
|
251
267
|
qualify
|
|
268
|
+
parentId
|
|
252
269
|
handle
|
|
253
270
|
price
|
|
254
271
|
compareAtPrice
|
|
272
|
+
priceType
|
|
273
|
+
priceTypeName
|
|
255
274
|
featuredImage
|
|
275
|
+
optionsRelationship
|
|
256
276
|
images
|
|
257
277
|
}
|
|
258
278
|
}
|
|
@@ -277,8 +297,8 @@ exports.GET_CATEGORIES_QUERY = (0, graphql_tag_1.gql) `
|
|
|
277
297
|
icon
|
|
278
298
|
parentId
|
|
279
299
|
level
|
|
280
|
-
sequence
|
|
281
300
|
handle
|
|
301
|
+
description
|
|
282
302
|
child {
|
|
283
303
|
id
|
|
284
304
|
title
|
|
@@ -286,15 +306,23 @@ exports.GET_CATEGORIES_QUERY = (0, graphql_tag_1.gql) `
|
|
|
286
306
|
icon
|
|
287
307
|
parentId
|
|
288
308
|
level
|
|
289
|
-
sequence
|
|
290
309
|
handle
|
|
310
|
+
description
|
|
291
311
|
}
|
|
292
312
|
}
|
|
293
313
|
}
|
|
294
314
|
`;
|
|
295
315
|
exports.GET_CATEGORY_BY_HANDLE_QUERY = (0, graphql_tag_1.gql) `
|
|
296
|
-
query GetCategoryByHandle(
|
|
297
|
-
|
|
316
|
+
query GetCategoryByHandle(
|
|
317
|
+
$partnerId: String!
|
|
318
|
+
$storeChannel: String!
|
|
319
|
+
$handle: String!
|
|
320
|
+
) {
|
|
321
|
+
getCategoryByHandle(
|
|
322
|
+
partnerId: $partnerId
|
|
323
|
+
storeChannel: $storeChannel
|
|
324
|
+
handle: $handle
|
|
325
|
+
) {
|
|
298
326
|
id
|
|
299
327
|
title
|
|
300
328
|
image
|
|
@@ -315,8 +343,16 @@ exports.GET_CATEGORY_BY_HANDLE_QUERY = (0, graphql_tag_1.gql) `
|
|
|
315
343
|
}
|
|
316
344
|
`;
|
|
317
345
|
exports.GET_CATEGORY_BY_ID_QUERY = (0, graphql_tag_1.gql) `
|
|
318
|
-
query GetCategoryById(
|
|
319
|
-
|
|
346
|
+
query GetCategoryById(
|
|
347
|
+
$partnerId: String!
|
|
348
|
+
$storeChannel: String!
|
|
349
|
+
$categoryId: String!
|
|
350
|
+
) {
|
|
351
|
+
getCategoryById(
|
|
352
|
+
partnerId: $partnerId
|
|
353
|
+
storeChannel: $storeChannel
|
|
354
|
+
categoryId: $categoryId
|
|
355
|
+
) {
|
|
320
356
|
id
|
|
321
357
|
title
|
|
322
358
|
image
|
|
@@ -367,8 +403,16 @@ exports.GET_BRAND_DETAIL_QUERY = `
|
|
|
367
403
|
}
|
|
368
404
|
`;
|
|
369
405
|
exports.GET_PRODUCT_OPTION = (0, graphql_tag_1.gql) `
|
|
370
|
-
query GetProductOption(
|
|
371
|
-
|
|
406
|
+
query GetProductOption(
|
|
407
|
+
$partnerId: String!
|
|
408
|
+
$storeChannel: String!
|
|
409
|
+
$productId: String!
|
|
410
|
+
) {
|
|
411
|
+
getProductOption(
|
|
412
|
+
partnerId: $partnerId
|
|
413
|
+
storeChannel: $storeChannel
|
|
414
|
+
productId: $productId
|
|
415
|
+
) {
|
|
372
416
|
id
|
|
373
417
|
name
|
|
374
418
|
subType
|
|
@@ -445,3 +489,49 @@ exports.GET_PRODUCT_IMAGE = (0, graphql_tag_1.gql) `
|
|
|
445
489
|
getProductImage(partnerId: $partnerId, productId: $productId)
|
|
446
490
|
}
|
|
447
491
|
`;
|
|
492
|
+
exports.GET_PRODUCT = (0, graphql_tag_1.gql) `
|
|
493
|
+
query GetProducts(
|
|
494
|
+
$partnerId: String!
|
|
495
|
+
$storeChannel: String!
|
|
496
|
+
$category: String
|
|
497
|
+
) {
|
|
498
|
+
getProducts(
|
|
499
|
+
partnerId: $partnerId
|
|
500
|
+
storeChannel: $storeChannel
|
|
501
|
+
category: $category
|
|
502
|
+
) {
|
|
503
|
+
total
|
|
504
|
+
currentPage
|
|
505
|
+
maxResult
|
|
506
|
+
totalPage
|
|
507
|
+
data {
|
|
508
|
+
id
|
|
509
|
+
title
|
|
510
|
+
subType
|
|
511
|
+
description
|
|
512
|
+
sku
|
|
513
|
+
shortDescription
|
|
514
|
+
weight
|
|
515
|
+
width
|
|
516
|
+
depth
|
|
517
|
+
height
|
|
518
|
+
vat
|
|
519
|
+
qualify
|
|
520
|
+
parentId
|
|
521
|
+
handle
|
|
522
|
+
price
|
|
523
|
+
priceType
|
|
524
|
+
salePolicy
|
|
525
|
+
priceTypeName
|
|
526
|
+
priceVaries
|
|
527
|
+
available
|
|
528
|
+
tags
|
|
529
|
+
options
|
|
530
|
+
optionsRelationship
|
|
531
|
+
compareAtPrice
|
|
532
|
+
featuredImage
|
|
533
|
+
images
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
`;
|
|
@@ -11,4 +11,5 @@ export declare class CampaignService extends Service {
|
|
|
11
11
|
searchVouchers(campaignId: String, campaignActionId: String, campaignActionType: String, customerId: String, excludeExpired: Boolean, pageNumber: number, pageSize: number): Promise<any>;
|
|
12
12
|
checkValidVoucher(customerId: string, voucherCode: string): Promise<any>;
|
|
13
13
|
getCampaignActiveNow(campaignActionType: string, customerId: string): Promise<any>;
|
|
14
|
+
getPromotionProductPrice(productId: String, productPrice: number): Promise<any>;
|
|
14
15
|
}
|
|
@@ -101,5 +101,23 @@ class CampaignService extends serviceSDK_1.Service {
|
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
+
getPromotionProductPrice(productId, productPrice) {
|
|
105
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
const query = queries_1.GET_PROMOTION_PRODUCT_PRICE;
|
|
107
|
+
const variables = {
|
|
108
|
+
partyId: this.orgId,
|
|
109
|
+
productStoreId: this.storeId,
|
|
110
|
+
productId,
|
|
111
|
+
productPrice,
|
|
112
|
+
};
|
|
113
|
+
try {
|
|
114
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
115
|
+
return response.getPromotionProductPrice;
|
|
116
|
+
}
|
|
117
|
+
catch (error) {
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
104
122
|
}
|
|
105
123
|
exports.CampaignService = CampaignService;
|
|
@@ -37,4 +37,6 @@ export declare class ProductService extends Service {
|
|
|
37
37
|
getStores(type: string): Promise<any>;
|
|
38
38
|
getDetailStores(): Promise<any>;
|
|
39
39
|
getProductImage: (productId: string) => Promise<any>;
|
|
40
|
+
getCategory(typeBuild: string, level: number): Promise<any>;
|
|
41
|
+
getProduct(category: string): Promise<any>;
|
|
40
42
|
}
|
|
@@ -176,5 +176,40 @@ class ProductService extends serviceSDK_1.Service {
|
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
+
getCategory(typeBuild, level) {
|
|
180
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
181
|
+
const query = queries_1.GET_CATEGORIES_QUERY;
|
|
182
|
+
const variables = {
|
|
183
|
+
partnerId: this.orgId,
|
|
184
|
+
storeChannel: this.storeId,
|
|
185
|
+
typeBuild,
|
|
186
|
+
level,
|
|
187
|
+
};
|
|
188
|
+
try {
|
|
189
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
190
|
+
return response.getCategories;
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
throw error;
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
getProduct(category) {
|
|
198
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
199
|
+
const query = queries_1.GET_PRODUCT;
|
|
200
|
+
const variables = {
|
|
201
|
+
partnerId: this.orgId,
|
|
202
|
+
storeChannel: this.storeId,
|
|
203
|
+
category
|
|
204
|
+
};
|
|
205
|
+
try {
|
|
206
|
+
const response = yield this.graphqlQuery(query, variables);
|
|
207
|
+
return response.getProducts;
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
throw error;
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
}
|
|
179
214
|
}
|
|
180
215
|
exports.ProductService = ProductService;
|