@longvansoftware/service-js-client 1.17.6 → 1.17.7

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.
@@ -6,3 +6,5 @@ export declare const GET_AVERAGE_RATING: import("graphql").DocumentNode;
6
6
  export declare const GET_URL_EVALUATION: import("graphql").DocumentNode;
7
7
  export declare const GET_NUMBER_OF_TICKET_EVALUATION: import("graphql").DocumentNode;
8
8
  export declare const SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE: import("graphql").DocumentNode;
9
+ export declare const GET_VOUCHERS_V2: import("graphql").DocumentNode;
10
+ export declare const SEARCH_CAMPAIGN: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE = exports.GET_NUMBER_OF_TICKET_EVALUATION = exports.GET_URL_EVALUATION = exports.GET_AVERAGE_RATING = exports.GET_VOUCHERS = exports.SUGGEST_VOUCHER = exports.GET_CAMPAIGN_ACTION_BY_ID = exports.SEARCH_PRODUCT_QUANTITY_PROMOTION_ACTION = void 0;
3
+ exports.SEARCH_CAMPAIGN = exports.GET_VOUCHERS_V2 = exports.SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE = exports.GET_NUMBER_OF_TICKET_EVALUATION = exports.GET_URL_EVALUATION = exports.GET_AVERAGE_RATING = exports.GET_VOUCHERS = exports.SUGGEST_VOUCHER = exports.GET_CAMPAIGN_ACTION_BY_ID = exports.SEARCH_PRODUCT_QUANTITY_PROMOTION_ACTION = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.SEARCH_PRODUCT_QUANTITY_PROMOTION_ACTION = (0, graphql_tag_1.gql) `
6
6
  query SearchProductQuantityPromotionAction(
@@ -83,22 +83,10 @@ exports.GET_CAMPAIGN_ACTION_BY_ID = (0, graphql_tag_1.gql) `
83
83
  // `;
84
84
  exports.SUGGEST_VOUCHER = (0, graphql_tag_1.gql) `
85
85
  query SuggestVoucher(
86
- $partyId: String
87
- $excludeExpired: Boolean
88
- $customerId: String
89
- $scope: String
90
- $isNewCustomer: Boolean
91
- $scopeIgnore: String
86
+ $searchVoucherRequest: SearchVoucherRequest
92
87
  ) {
93
88
  suggestVoucher(
94
- searchVoucherRequest: {
95
- partyId: $partyId
96
- excludeExpired: $excludeExpired
97
- customerId: $customerId
98
- scope: $scope
99
- isNewCustomer: $isNewCustomer
100
- scopeIgnore: $scopeIgnore
101
- }
89
+ searchVoucherRequest: $searchVoucherRequest
102
90
  ) {
103
91
  total
104
92
  totalPages
@@ -246,9 +234,6 @@ exports.SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE = (0, graphql_tag_1.gql) `
246
234
  searchProductGiftPromotionResponse(
247
235
  parameterSearchProductGift: $parameterSearchProductGift
248
236
  ) {
249
- total
250
- totalPages
251
- totalElements
252
237
  content {
253
238
  id
254
239
  partyId
@@ -260,19 +245,110 @@ exports.SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE = (0, graphql_tag_1.gql) `
260
245
  giftPromotions {
261
246
  fromQuantity
262
247
  toProductId
248
+ toProductParentId
263
249
  toQuantity
250
+ priceType
264
251
  productName
265
252
  sku
266
253
  featureImage
254
+ unit
267
255
  }
256
+ unit
268
257
  campaignActionName
269
258
  startDate
270
259
  endDate
271
260
  newCustomer
261
+ minimumSpend
262
+ createdStamp
263
+ updatedStamp
264
+ updatedBy
265
+ createdBy
266
+ }
267
+ total
268
+ totalPages
269
+ totalElements
270
+ last
271
+ first
272
+ number
273
+ numberOfElements
274
+ size
275
+ empty
276
+ sort {
277
+ sorted
278
+ unsorted
279
+ empty
280
+ }
281
+ }
282
+ }
283
+ `;
284
+ exports.GET_VOUCHERS_V2 = (0, graphql_tag_1.gql) `
285
+ query SearchVoucher($searchVoucherRequest: SearchVoucherRequest) {
286
+ searchVoucher(searchVoucherRequest: $searchVoucherRequest) {
287
+ total
288
+ totalPages
289
+ totalElements
290
+ last
291
+ first
292
+ number
293
+ numberOfElements
294
+ size
295
+ empty
296
+ content {
297
+ campaignActionId
298
+ campaignId
299
+ partyId
300
+ voucherCode
301
+ voucherType
302
+ status
303
+ discountAmount
304
+ discountPercent
305
+ usageLimitPerVoucher
306
+ maximumDiscount
307
+ numberOfTimeUsed
308
+ id
309
+ createdStamp
310
+ updatedStamp
311
+ updatedBy
312
+ createdBy
313
+ isBirthday
314
+ customerId
315
+ scope
316
+ }
317
+ }
318
+ }
319
+ `;
320
+ exports.SEARCH_CAMPAIGN = (0, graphql_tag_1.gql) `
321
+ query SearchCampaign($searchCampaignRequest: SearchCampaignRequest) {
322
+ searchCampaign(searchCampaignRequest: $searchCampaignRequest) {
323
+ content {
324
+ id
272
325
  createdStamp
273
326
  updatedStamp
274
327
  updatedBy
275
328
  createdBy
329
+ useForAll
330
+ description
331
+ partyId
332
+ name
333
+ type
334
+ domain
335
+ fromDate
336
+ toDate
337
+ status
338
+ }
339
+ total
340
+ totalPages
341
+ totalElements
342
+ last
343
+ first
344
+ number
345
+ numberOfElements
346
+ size
347
+ empty
348
+ sort {
349
+ sorted
350
+ unsorted
351
+ empty
276
352
  }
277
353
  }
278
354
  }
@@ -330,6 +330,9 @@ exports.ADD_TO_CART = (0, graphql_tag_1.gql) `
330
330
  quantity
331
331
  unit
332
332
  productId
333
+ unitGift
334
+ giftDuration
335
+ giftDurationUnit
333
336
  }
334
337
  resourceConfigs {
335
338
  name
@@ -113,6 +113,8 @@ exports.GET_ORDER_DETAIL = (0, graphql_tag_1.gql) `
113
113
  currencyCode
114
114
  }
115
115
  orderLineItemParentId
116
+ giftConditionProductId
117
+ giftQuantity
116
118
  variant {
117
119
  id
118
120
  price {
@@ -135,18 +137,46 @@ exports.GET_ORDER_DETAIL = (0, graphql_tag_1.gql) `
135
137
  value
136
138
  title
137
139
  }
138
- resourceItems {
139
- name
140
- quantity
141
- unit
142
- productId
143
- }
144
140
  resourceConfigs {
145
- name
146
- quantity
147
- unit
148
- productId
149
- }
141
+ name
142
+ quantity
143
+ unit
144
+ productId
145
+ giftProductId
146
+ gift
147
+ giftQuantity
148
+ campaignId
149
+ campaignActionId
150
+ qualify
151
+ idParent
152
+ addQuantity
153
+ defaultQuantity
154
+ title
155
+ price
156
+ unitPrice
157
+ totalResource
158
+ }
159
+ resourceItems {
160
+ name
161
+ quantity
162
+ unit
163
+ productId
164
+ giftProductId
165
+ gift
166
+ giftQuantity
167
+ campaignId
168
+ campaignActionId
169
+ qualify
170
+ idParent
171
+ addQuantity
172
+ defaultQuantity
173
+ title
174
+ price
175
+ unitPrice
176
+ totalResource
177
+ unitGift
178
+ giftDuration
179
+ }
150
180
  itemType
151
181
  }
152
182
  serviceId
@@ -181,6 +211,7 @@ exports.GET_QUANTITY_ORDER_LINEITEMS = (0, graphql_tag_1.gql) `
181
211
  }
182
212
  itemType
183
213
  orderLineItemParentId
214
+ giftConditionProductId
184
215
  }
185
216
  }
186
217
  }
@@ -240,6 +271,8 @@ exports.GET_ORDER_LINE_ITEM_BY_SERVICE_ID = (0, graphql_tag_1.gql) `
240
271
  updatedStamp
241
272
  completedAt
242
273
  orderLineItemParentId
274
+ giftConditionProductId
275
+ giftQuantity
243
276
  orderStatus
244
277
  totalVAT {
245
278
  amount
@@ -13,4 +13,6 @@ export declare class CrmCampingService extends Service {
13
13
  getNumberOfTicketEvaluation(customerId: string): Promise<any>;
14
14
  searchProductGiftPromotionResponse(parameterSearchProductGift: any): Promise<any>;
15
15
  addProductGiftPromotion(orderId: string, updatedBy: string, addData: any): Promise<any>;
16
+ searchVouchersV2(searchVoucherRequest: any): Promise<any>;
17
+ searchCampaign(searchCampaignRequest: any): Promise<any>;
16
18
  }
@@ -93,12 +93,15 @@ class CrmCampingService extends serviceSDK_1.Service {
93
93
  return __awaiter(this, void 0, void 0, function* () {
94
94
  const query = queries_1.SUGGEST_VOUCHER;
95
95
  const variables = {
96
- partyId: this.orgId,
97
- excludeExpired: true,
98
- customerId,
99
- scope,
100
- isNewCustomer,
101
- scopeIgnore,
96
+ searchVoucherRequest: {
97
+ partyId: this.orgId,
98
+ excludeExpired: true,
99
+ customerId,
100
+ scope,
101
+ isNewCustomer,
102
+ scopeIgnore,
103
+ isPageAble: false,
104
+ },
102
105
  };
103
106
  try {
104
107
  const response = yield this.graphqlQueryV2(query, variables);
@@ -223,5 +226,37 @@ class CrmCampingService extends serviceSDK_1.Service {
223
226
  }
224
227
  });
225
228
  }
229
+ searchVouchersV2(searchVoucherRequest) {
230
+ return __awaiter(this, void 0, void 0, function* () {
231
+ const query = queries_1.GET_VOUCHERS_V2;
232
+ const variables = {
233
+ searchVoucherRequest: Object.assign({ partyId: this.orgId }, searchVoucherRequest),
234
+ };
235
+ try {
236
+ const response = yield this.graphqlQuery(query, variables);
237
+ return response.searchVoucher;
238
+ }
239
+ catch (error) {
240
+ console.log(`Error fetching searchVoucher: ${error}`);
241
+ throw error;
242
+ }
243
+ });
244
+ }
245
+ searchCampaign(searchCampaignRequest) {
246
+ return __awaiter(this, void 0, void 0, function* () {
247
+ const query = queries_1.SEARCH_CAMPAIGN;
248
+ const variables = {
249
+ searchCampaignRequest: Object.assign({ partyId: this.orgId }, searchCampaignRequest),
250
+ };
251
+ try {
252
+ const response = yield this.graphqlQuery(query, variables);
253
+ return response.searchCampaign;
254
+ }
255
+ catch (error) {
256
+ console.log(`Error fetching searchCampaign: ${error}`);
257
+ throw error;
258
+ }
259
+ });
260
+ }
226
261
  }
227
262
  exports.CrmCampingService = CrmCampingService;
@@ -471,4 +471,6 @@ export declare class OrderService extends Service {
471
471
  addProductInOrderWithoutLogin(orderId: string, updated_by: string, data: any, store: string): Promise<any>;
472
472
  findCampaignActionGiftVoucher(): Promise<any>;
473
473
  addProductGiftPromotion(orderId: string, updatedBy: string, data: any): Promise<any>;
474
+ removeProductGiftPromotion(orderId: string, orderLineItemId: string): Promise<any>;
475
+ checkNewCustomer(orderId: string, customer_id: string): Promise<any>;
474
476
  }
@@ -1295,5 +1295,40 @@ class OrderService extends serviceSDK_1.Service {
1295
1295
  }
1296
1296
  });
1297
1297
  }
1298
+ // https://storefront.dev.longvan.vn/swagger-ui/index.html#/Order%20API/removeGiftQuantity
1299
+ removeProductGiftPromotion(orderId, orderLineItemId) {
1300
+ return __awaiter(this, void 0, void 0, function* () {
1301
+ console.log("🚀 ~ OrderService ~ removeProductGiftPromotion ~ orderLineItemId:", orderLineItemId);
1302
+ console.log("🚀 ~ OrderService ~ removeProductGiftPromotion ~ orderId:", orderId);
1303
+ const endpoint = `/orders/${this.orgId}/${orderId}/${orderLineItemId}/giftQuantity`;
1304
+ const method = "PUT";
1305
+ try {
1306
+ const response = yield this.restApiCallWithToken(endpoint, method);
1307
+ console.log(response);
1308
+ return response;
1309
+ }
1310
+ catch (error) {
1311
+ console.log(`Error in removeProductGiftPromotion: ${error}`);
1312
+ throw error;
1313
+ }
1314
+ });
1315
+ }
1316
+ checkNewCustomer(orderId, customer_id) {
1317
+ return __awaiter(this, void 0, void 0, function* () {
1318
+ console.log("🚀 ~ OrderService ~ removeProductGiftPromotion ~ orderLineItemId:", customer_id);
1319
+ console.log("🚀 ~ OrderService ~ removeProductGiftPromotion ~ orderId:", orderId);
1320
+ const endpoint = `/front/orders/${this.orgId}/${customer_id}/${orderId}/newCustomer`;
1321
+ const method = "GET";
1322
+ try {
1323
+ const response = yield this.restApiCallWithToken(endpoint, method);
1324
+ console.log(response);
1325
+ return response;
1326
+ }
1327
+ catch (error) {
1328
+ console.log(`Error in removeProductGiftPromotion: ${error}`);
1329
+ throw error;
1330
+ }
1331
+ });
1332
+ }
1298
1333
  }
1299
1334
  exports.OrderService = OrderService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "1.17.6",
3
+ "version": "1.17.7",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [