@longvansoftware/service-js-client 1.15.1 → 1.15.3

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.
@@ -5,3 +5,4 @@ export declare const GET_VOUCHERS: import("graphql").DocumentNode;
5
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
+ export declare const SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- 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_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(
@@ -110,6 +110,7 @@ exports.SUGGEST_VOUCHER = (0, graphql_tag_1.gql) `
110
110
  status
111
111
  discountAmount
112
112
  discountPercent
113
+ description
113
114
  usageLimitPerVoucher
114
115
  maximumDiscount
115
116
  numberOfTimeUsed
@@ -210,3 +211,39 @@ exports.GET_NUMBER_OF_TICKET_EVALUATION = (0, graphql_tag_1.gql) `
210
211
  getNumberOfTicketEvaluation(customerId: $customerId, orgId: $orgId,)
211
212
  }
212
213
  `;
214
+ exports.SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE = (0, graphql_tag_1.gql) `
215
+ query SearchProductGiftPromotionResponse($partyId: String!, $productId: String!) {
216
+ searchProductGiftPromotionResponse(
217
+ parameterSearchProductGift: {
218
+ partyId: $partyId
219
+ productId: $productId
220
+ }
221
+ ) {
222
+ total
223
+ totalPages
224
+ totalElements
225
+ content {
226
+ partyId
227
+ campaignId
228
+ campaignActionId
229
+ campaignActionName
230
+ startDate
231
+ endDate
232
+ productId
233
+
234
+ productParentId
235
+
236
+ quantityLimit
237
+ newCustomer
238
+ giftPromotions {
239
+ fromQuantity
240
+ toQuantity
241
+ toProductId
242
+ productName
243
+ sku
244
+ featureImage
245
+ }
246
+ }
247
+ }
248
+ }
249
+ `;
@@ -73,11 +73,21 @@ exports.GET_ORDER_DETAIL = (0, graphql_tag_1.gql) `
73
73
  version
74
74
  description
75
75
  discountApplications {
76
+ allocationMethod
77
+ targetSelection
78
+ targetType
79
+ title
80
+ type
81
+ percent
82
+ voucherCode
83
+ voucherId
84
+ campaignId
85
+ campaignActionId
86
+ campaignActionType
76
87
  value {
77
88
  amount
78
89
  currencyCode
79
90
  }
80
- type
81
91
  }
82
92
  remainTotal {
83
93
  amount
@@ -11,4 +11,6 @@ export declare class CrmCampingService extends Service {
11
11
  getAverageRating(targetIds: [string], customerId: string, evaluationType: string): Promise<any>;
12
12
  getUrlEvaluation(targetIds: [string], customerId: string, evaluationType: string): Promise<any>;
13
13
  getNumberOfTicketEvaluation(customerId: string): Promise<any>;
14
+ searchProductGiftPromotionResponse(productId: string): Promise<any>;
15
+ addProductGiftPromotion(orderId: string, updatedBy: string, addData: any): Promise<any>;
14
16
  }
@@ -185,5 +185,38 @@ class CrmCampingService extends serviceSDK_1.Service {
185
185
  }
186
186
  });
187
187
  }
188
+ searchProductGiftPromotionResponse(productId) {
189
+ return __awaiter(this, void 0, void 0, function* () {
190
+ const query = queries_1.SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE;
191
+ const variables = {
192
+ partyId: this.orgId,
193
+ productId
194
+ };
195
+ try {
196
+ const response = yield this.graphqlQueryV2(query, variables);
197
+ return response.searchProductGiftPromotionResponse;
198
+ }
199
+ catch (error) {
200
+ throw error;
201
+ }
202
+ });
203
+ }
204
+ addProductGiftPromotion(orderId, updatedBy, addData) {
205
+ return __awaiter(this, void 0, void 0, function* () {
206
+ const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/orderLineItem?updated_by=${updatedBy}`;
207
+ const method = "POST";
208
+ const data = addData;
209
+ console.log("data in add sdk", data);
210
+ try {
211
+ const response = yield this.restApiCallWithToken(endpoint, method, data);
212
+ console.log(response);
213
+ return response;
214
+ }
215
+ catch (error) {
216
+ console.log(`Error in addProductGiftPromotion: ${error}`);
217
+ throw error;
218
+ }
219
+ });
220
+ }
188
221
  }
189
222
  exports.CrmCampingService = CrmCampingService;
@@ -470,4 +470,5 @@ export declare class OrderService extends Service {
470
470
  */
471
471
  addProductInOrderWithoutLogin(orderId: string, updated_by: string, data: any, store: string): Promise<any>;
472
472
  findCampaignActionGiftVoucher(): Promise<any>;
473
+ addProductGiftPromotion(orderId: string, updatedBy: string, data: any): Promise<any>;
473
474
  }
@@ -1280,5 +1280,20 @@ class OrderService extends serviceSDK_1.Service {
1280
1280
  }
1281
1281
  });
1282
1282
  }
1283
+ addProductGiftPromotion(orderId, updatedBy, data) {
1284
+ return __awaiter(this, void 0, void 0, function* () {
1285
+ const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/orderLineItem?updated_by=${updatedBy}`;
1286
+ const method = "POST";
1287
+ try {
1288
+ const response = yield this.restApiCallWithToken(endpoint, method, data);
1289
+ console.log(response);
1290
+ return response;
1291
+ }
1292
+ catch (error) {
1293
+ console.log(`Error in addProductGiftPromotion: ${error}`);
1294
+ throw error;
1295
+ }
1296
+ });
1297
+ }
1283
1298
  }
1284
1299
  exports.OrderService = OrderService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "1.15.1",
3
+ "version": "1.15.3",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [