@longvansoftware/service-js-client 1.15.1 → 1.15.2

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(
@@ -210,3 +210,39 @@ exports.GET_NUMBER_OF_TICKET_EVALUATION = (0, graphql_tag_1.gql) `
210
210
  getNumberOfTicketEvaluation(customerId: $customerId, orgId: $orgId,)
211
211
  }
212
212
  `;
213
+ exports.SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE = (0, graphql_tag_1.gql) `
214
+ query SearchProductGiftPromotionResponse($partyId: String!, $productId: String!) {
215
+ searchProductGiftPromotionResponse(
216
+ parameterSearchProductGift: {
217
+ partyId: $partyId
218
+ productId: $productId
219
+ }
220
+ ) {
221
+ total
222
+ totalPages
223
+ totalElements
224
+ content {
225
+ partyId
226
+ campaignId
227
+ campaignActionId
228
+ campaignActionName
229
+ startDate
230
+ endDate
231
+ productId
232
+
233
+ productParentId
234
+
235
+ quantityLimit
236
+ newCustomer
237
+ giftPromotions {
238
+ fromQuantity
239
+ toQuantity
240
+ toProductId
241
+ productName
242
+ sku
243
+ featureImage
244
+ }
245
+ }
246
+ }
247
+ }
248
+ `;
@@ -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.2",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [