@longvansoftware/service-js-client 2.5.9 → 2.6.1

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 REMOVE_PRODUCT_OPTION_ORDER_LINE_ITEM: DocumentNode;
6
6
  export declare const ADD_ITEM_INTO_ORDER_BY_PRODUCT_JSON_RESOURCE: (fields?: string[]) => DocumentNode;
7
7
  export declare const UPDATE_ORDER_LINE_ITEM_PARENT_ID: DocumentNode;
8
8
  export declare const UPDATE_PRODUCT_OPTION_ORDERLINE_ITEM: DocumentNode;
9
+ export declare const APPLY_REFERRAL_CODE: DocumentNode;
10
+ export declare const REMOVE_REFERRAL_CODE: DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UPDATE_PRODUCT_OPTION_ORDERLINE_ITEM = exports.UPDATE_ORDER_LINE_ITEM_PARENT_ID = exports.ADD_ITEM_INTO_ORDER_BY_PRODUCT_JSON_RESOURCE = exports.REMOVE_PRODUCT_OPTION_ORDER_LINE_ITEM = exports.ADD_TO_CART = exports.UPDATE_QUANTITY_V2 = exports.CREATE_ORDER = void 0;
3
+ exports.REMOVE_REFERRAL_CODE = exports.APPLY_REFERRAL_CODE = exports.UPDATE_PRODUCT_OPTION_ORDERLINE_ITEM = exports.UPDATE_ORDER_LINE_ITEM_PARENT_ID = exports.ADD_ITEM_INTO_ORDER_BY_PRODUCT_JSON_RESOURCE = exports.REMOVE_PRODUCT_OPTION_ORDER_LINE_ITEM = exports.ADD_TO_CART = exports.UPDATE_QUANTITY_V2 = exports.CREATE_ORDER = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.CREATE_ORDER = (0, graphql_tag_1.gql) `
6
6
  mutation CreateOrder($input: CreateOrderInput!) {
@@ -398,3 +398,13 @@ exports.UPDATE_PRODUCT_OPTION_ORDERLINE_ITEM = (0, graphql_tag_1.gql) `
398
398
  )
399
399
  }
400
400
  `;
401
+ exports.APPLY_REFERRAL_CODE = (0, graphql_tag_1.gql) `
402
+ mutation ApplyReferralCode($input: ReferralCodeOrderInput!) {
403
+ applyReferralCode(input: $input)
404
+ }
405
+ `;
406
+ exports.REMOVE_REFERRAL_CODE = (0, graphql_tag_1.gql) `
407
+ mutation RemoveReferralCode($input: ReferralCodeOrderInput!) {
408
+ removeReferralCode(input: $input)
409
+ }
410
+ `;
@@ -472,8 +472,8 @@ const CALCULATE_RESOURCE_CHANGE_PRICE = (fields = []) => {
472
472
  const fieldStr = fields.join("\n ");
473
473
  const hasFields = fields.length > 0;
474
474
  return (0, graphql_tag_1.gql) `
475
- query calculateResourceChangePrice($partnerId: String! $storeId: String! $productIds: [String] $quantity: BigDecimal! $unit: String!) {
476
- calculateResourceChangePrice(partnerId: $partnerId storeId: $storeId productIds: $productIds quantity: $quantity unit: $unit) ${hasFields ? `{ ${fieldStr} }` : ""}
475
+ query calculateResourceChangePrice($partnerId: String! $storeId: String! $productIds: [String] $quantity: BigDecimal! $unit: String! $serviceId: String) {
476
+ calculateResourceChangePrice(partnerId: $partnerId storeId: $storeId productIds: $productIds quantity: $quantity unit: $unit serviceId: $serviceId) ${hasFields ? `{ ${fieldStr} }` : ""}
477
477
  }
478
478
  `;
479
479
  };
@@ -18,5 +18,7 @@ export declare class OrderGraphQLService extends Service {
18
18
  addItemIntoOrderByProductJsonResource(serviceId: string, orderId: string, itemInput: any, durationQuantity: number, durationUnit: string, actorId: string, fields: string[]): Promise<any>;
19
19
  updateOrderLineItemParentId(orderLineItemChildIds: string[], orderLineItemParentId: string, updateBy: string): Promise<any>;
20
20
  updateProductOptionOrderLineItem(orderLineItemId: string, productOptionUpdate: any, updateBy: string): Promise<any>;
21
- calculateResourceChangePrice(productIds: string[], quantity: string, unit: string, storeId: string, fields: string[]): Promise<any>;
21
+ calculateResourceChangePrice(productIds: string[], quantity: string, unit: string, storeId: string, fields: string[], serviceId: string): Promise<any>;
22
+ applyReferralCode(input: any): Promise<any>;
23
+ removeReferralCode(input: any): Promise<any>;
22
24
  }
@@ -285,7 +285,7 @@ class OrderGraphQLService extends serviceSDK_1.Service {
285
285
  }
286
286
  });
287
287
  }
288
- calculateResourceChangePrice(productIds, quantity, unit, storeId, fields) {
288
+ calculateResourceChangePrice(productIds, quantity, unit, storeId, fields, serviceId) {
289
289
  return __awaiter(this, void 0, void 0, function* () {
290
290
  const query = (0, queries_1.CALCULATE_RESOURCE_CHANGE_PRICE)(fields);
291
291
  const variables = {
@@ -293,7 +293,8 @@ class OrderGraphQLService extends serviceSDK_1.Service {
293
293
  storeId: storeId ? storeId : this.storeId,
294
294
  productIds,
295
295
  quantity,
296
- unit
296
+ unit,
297
+ serviceId
297
298
  };
298
299
  try {
299
300
  const response = yield this.graphqlQueryV2(query, variables);
@@ -305,5 +306,37 @@ class OrderGraphQLService extends serviceSDK_1.Service {
305
306
  }
306
307
  });
307
308
  }
309
+ applyReferralCode(input) {
310
+ return __awaiter(this, void 0, void 0, function* () {
311
+ const mutation = mutations_1.APPLY_REFERRAL_CODE;
312
+ const variables = {
313
+ input,
314
+ };
315
+ try {
316
+ const response = yield this.graphqlMutationV2(mutation, variables);
317
+ return response.applyReferralCode;
318
+ }
319
+ catch (error) {
320
+ console.log(`Error in applyReferralCode: ${error}`);
321
+ throw error;
322
+ }
323
+ });
324
+ }
325
+ removeReferralCode(input) {
326
+ return __awaiter(this, void 0, void 0, function* () {
327
+ const mutation = mutations_1.REMOVE_REFERRAL_CODE;
328
+ const variables = {
329
+ input,
330
+ };
331
+ try {
332
+ const response = yield this.graphqlMutationV2(mutation, variables);
333
+ return response.removeReferralCode;
334
+ }
335
+ catch (error) {
336
+ console.log(`Error in removeReferralCode: ${error}`);
337
+ throw error;
338
+ }
339
+ });
340
+ }
308
341
  }
309
342
  exports.OrderGraphQLService = OrderGraphQLService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "2.5.9",
3
+ "version": "2.6.1",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [