@longvansoftware/storefront-js-client 1.1.8 → 1.2.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.
@@ -1,3 +1,2 @@
1
1
  export declare const GET_PERSON_BY_IDS_QUERY: import("graphql").DocumentNode;
2
2
  export declare const GET_CUSTOMER_BY_ID: import("graphql").DocumentNode;
3
- export declare const SEARCH_COMPANY: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SEARCH_COMPANY = exports.GET_CUSTOMER_BY_ID = exports.GET_PERSON_BY_IDS_QUERY = void 0;
3
+ exports.GET_CUSTOMER_BY_ID = exports.GET_PERSON_BY_IDS_QUERY = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.GET_PERSON_BY_IDS_QUERY = (0, graphql_tag_1.gql) `
6
6
  query GetPersonByIds($partyIds: [String!]!) {
@@ -48,20 +48,3 @@ query GetCustomerById($id: String!){
48
48
  }
49
49
  }
50
50
  `;
51
- exports.SEARCH_COMPANY = (0, graphql_tag_1.gql) `
52
- query SearchCompany($keyword: String, $orgId: String!, $limit: Int){
53
- searchCompany(keyword: $keyword, orgId: $orgId, limit: $limit) {
54
- id
55
- name
56
- address
57
- gender
58
- identityNumber
59
- birthDate
60
- email
61
- phone
62
- createdStamp
63
- createdBy
64
- memberLevel
65
- }
66
- }
67
- `;
@@ -89,14 +89,14 @@ class CrmService extends service_1.Service {
89
89
  }
90
90
  updateStatusAttachmentById(performerId, attachmentId, status) {
91
91
  return __awaiter(this, void 0, void 0, function* () {
92
- const mutation = mutations_1.UPDATE_STATUS_ATTACHMENT_BY_ID;
92
+ const query = mutations_1.UPDATE_STATUS_ATTACHMENT_BY_ID;
93
93
  const variables = {
94
94
  performerId,
95
95
  attachmentId,
96
96
  status
97
97
  };
98
98
  try {
99
- const response = yield this.graphqlMutation(mutation, variables);
99
+ const response = yield this.graphqlQuery(query, variables);
100
100
  return response.updateStatusAttachmentById;
101
101
  }
102
102
  catch (error) {
@@ -107,14 +107,14 @@ class CrmService extends service_1.Service {
107
107
  }
108
108
  updateWorkEffortDescription(performerId, workEffortId, description) {
109
109
  return __awaiter(this, void 0, void 0, function* () {
110
- const mutation = mutations_1.UPDATE_WORK_EFFORT_DESCRIPTION;
110
+ const query = mutations_1.UPDATE_WORK_EFFORT_DESCRIPTION;
111
111
  const variables = {
112
112
  performerId,
113
113
  workEffortId,
114
114
  description
115
115
  };
116
116
  try {
117
- const response = yield this.graphqlMutation(mutation, variables);
117
+ const response = yield this.graphqlQuery(query, variables);
118
118
  return response.updateWorkEffortDescription;
119
119
  }
120
120
  catch (error) {
@@ -125,7 +125,7 @@ class CrmService extends service_1.Service {
125
125
  }
126
126
  updateWorkEffortName(performerId, workEffortId, name) {
127
127
  return __awaiter(this, void 0, void 0, function* () {
128
- const mutation = mutations_1.UPDATE_WORK_EFFORT_NAME;
128
+ const query = mutations_1.UPDATE_WORK_EFFORT_NAME;
129
129
  const variables = {
130
130
  partyId: this.orgId,
131
131
  performerId,
@@ -133,7 +133,7 @@ class CrmService extends service_1.Service {
133
133
  newName: name
134
134
  };
135
135
  try {
136
- const response = yield this.graphqlMutation(mutation, variables);
136
+ const response = yield this.graphqlQuery(query, variables);
137
137
  return response.updateWorkEffortName;
138
138
  }
139
139
  catch (error) {
@@ -144,7 +144,7 @@ class CrmService extends service_1.Service {
144
144
  }
145
145
  updateWorkEffortStatus(performerId, workEffortId, source, status) {
146
146
  return __awaiter(this, void 0, void 0, function* () {
147
- const mutation = mutations_1.UPDATE_WORK_EFFORT_STATUS;
147
+ const query = mutations_1.UPDATE_WORK_EFFORT_STATUS;
148
148
  const variables = {
149
149
  partyId: this.orgId,
150
150
  performerId,
@@ -153,7 +153,7 @@ class CrmService extends service_1.Service {
153
153
  status
154
154
  };
155
155
  try {
156
- const response = yield this.graphqlMutation(mutation, variables);
156
+ const response = yield this.graphqlQuery(query, variables);
157
157
  return response.updateWorkEffortStatus;
158
158
  }
159
159
  catch (error) {
@@ -164,7 +164,7 @@ class CrmService extends service_1.Service {
164
164
  }
165
165
  addAttachmentForWorkEffort(performerId, workEffortId, attachments) {
166
166
  return __awaiter(this, void 0, void 0, function* () {
167
- const mutation = mutations_1.ADD_ATTACHMENT_FOR_WORK_EFFORT;
167
+ const query = mutations_1.ADD_ATTACHMENT_FOR_WORK_EFFORT;
168
168
  const variables = {
169
169
  partyId: this.orgId,
170
170
  performerId,
@@ -172,7 +172,7 @@ class CrmService extends service_1.Service {
172
172
  attachments,
173
173
  };
174
174
  try {
175
- const response = yield this.graphqlMutation(mutation, variables);
175
+ const response = yield this.graphqlQuery(query, variables);
176
176
  return response.addAttachmentForWorkEffort;
177
177
  }
178
178
  catch (error) {
@@ -124,26 +124,35 @@ export declare class OrderService extends Service {
124
124
  * Updates the customer and shipping address for an order.
125
125
  * @param orderId - The ID of the order.
126
126
  * @param orderItemId - The id of order.
127
+ * @param type_discount
128
+ * @param discount_amount
129
+ * @param campaign_id
130
+ * @param campaign_action_id
131
+ * @param campaign_action_type
127
132
  * @returns A promise that resolves when the customer and shipping address are updated.
128
133
  * @throws If an error occurs while updating the customer and shipping address.
129
134
  */
130
- updateDiscountPriceInOrder(orderId: string, orderItemId: string): Promise<any>;
135
+ updateDiscountPriceInOrder(orderId: string, orderItemId: string, type_discount: string, discount_amount: 0, campaign_id: string, campaign_action_id: string, campaign_action_type: string): Promise<any>;
131
136
  /**
132
137
  * Updates the customer and shipping address for an order.
133
138
  * @param orderId - The ID of the order.
139
+ * @param reason
140
+ * @param updatedBy
141
+ * @param note
142
+ * @param orderType
134
143
  * @returns A promise that resolves when the customer and shipping address are updated.
135
144
  * @throws If an error occurs while updating the customer and shipping address.
136
145
  */
137
- updateCancelOrder(orderId: string): Promise<any>;
146
+ updateCancelOrder(orderId: string, reason: "CUSTOMER", updatedBy: string, note: string, orderType: "SALES"): Promise<any>;
138
147
  /**
139
148
  * Updates the customer and shipping address for an order.
140
149
  * @param orderId - The ID of the order.
141
150
  * @param statusNew - the new status of order
142
- * @param updateBy - Id of person update
151
+ * @param updatedBy - Id of person update
143
152
  * @returns A promise that resolves when the customer and shipping address are updated.
144
153
  * @throws If an error occurs while updating the customer and shipping address.
145
154
  */
146
- updateStatusOrder(orderId: string, statusNew: string, updateBy: string): Promise<any>;
155
+ updateStatusReturnOrder(orderId: string, statusNew: string, updatedBy: string): Promise<any>;
147
156
  /**
148
157
  * Updates the customer and shipping address for an order.
149
158
  * @param orderId - The ID of the order.
@@ -239,7 +248,7 @@ export declare class OrderService extends Service {
239
248
  * @returns A promise that resolves when the customer and shipping address are updated.
240
249
  * @throws If an error occurs while updating the customer and shipping address.
241
250
  */
242
- updateMemberDiscount(orderId: string, type: string, amount: number, campaignId: string, campaignActionId: string, campaignActionType: string): Promise<any>;
251
+ updateMemberDiscount(orderId: string, type: string, amount: 0, campaignId: string, campaignActionId: string, campaignActionType: string): Promise<any>;
243
252
  /**
244
253
  * Updates the customer and shipping address for an order.
245
254
  * @param orderId - The ID of the order.
@@ -259,7 +268,7 @@ export declare class OrderService extends Service {
259
268
  * @returns A promise that resolves when the customer and shipping address are updated.
260
269
  * @throws If an error occurs while updating the customer and shipping address.
261
270
  */
262
- updateDiscount(orderId: string, type: string, amount: number, campaignId: string, campaignActionId: string, campaignActionType: string): Promise<any>;
271
+ updateDiscount(orderId: string, type: string, amount: 0, campaignId: string, campaignActionId: string, campaignActionType: string): Promise<any>;
263
272
  /**
264
273
  * Updates the customer and shipping address for an order.
265
274
  * @param orderId - The ID of the order.
@@ -296,13 +305,13 @@ export declare class OrderService extends Service {
296
305
  * @returns A promise that resolves when the customer and shipping address are updated.
297
306
  * @throws If an error occurs while updating the customer and shipping address.
298
307
  */
299
- updateListTypeOrder(): Promise<any>;
308
+ getListTypeOrder(): Promise<any>;
300
309
  /**
301
310
  * Updates the customer and shipping address for an order.
302
311
  * @returns A promise that resolves when the customer and shipping address are updated.
303
312
  * @throws If an error occurs while updating the customer and shipping address.
304
313
  */
305
- updateListShippingCarrier(): Promise<any>;
314
+ getListShippingCarrier(): Promise<any>;
306
315
  /**
307
316
  * Get list sell order
308
317
  * @param orderId
@@ -358,7 +367,7 @@ export declare class OrderService extends Service {
358
367
  * @returns A promise that resolves when the customer and shipping address are updated.
359
368
  * @throws If an error occurs while updating the customer and shipping address.
360
369
  */
361
- getListReturnorder(orderId: string, status: [number], statusIgnore: [number], subStatus: string, ffmStatus: string, subType: string, paymentMethod: string, keyword: string, customerMultiValue: string, productMultiValue: string, customerId: string, createdBy: string, dateCreateFrom: number, dateCreateTo: number, dateUpdateFrom: number, dateUpdateTo: number, employeeAssign: string, currentPage: 1, maxResult: 20): Promise<any>;
370
+ getListReturnOrder(orderId: string, status: [number], statusIgnore: [number], subStatus: string, ffmStatus: string, subType: string, paymentMethod: string, keyword: string, customerMultiValue: string, productMultiValue: string, customerId: string, createdBy: string, dateCreateFrom: number, dateCreateTo: number, dateUpdateFrom: number, dateUpdateTo: number, employeeAssign: string, currentPage: 1, maxResult: 20): Promise<any>;
362
371
  /**
363
372
  * Get list sale order status
364
373
  * @returns A promise that resolves when the customer and shipping address are updated.
@@ -378,9 +387,48 @@ export declare class OrderService extends Service {
378
387
  * Get list sale order status
379
388
  * @param orderId - The id of order
380
389
  * @param orderItemId - Thi id of item order
381
- * @param reason - The reason of remove product in order
390
+ * @param reason - The reason of cancel product in order
391
+ * @returns A promise that resolves when the customer and shipping address are updated.
392
+ * @throws If an error occurs while updating the customer and shipping address.
393
+ */
394
+ cancelProductInOrder(orderId: string, orderItemId: string, reason: string): Promise<any>;
395
+ /**
396
+ * Get list sale order status
397
+ * @param orderId - The id of order
398
+ * @param orderItemId - Thi id of item order
399
+ * @param reason - The reason of cancel product in order
400
+ * @returns A promise that resolves when the customer and shipping address are updated.
401
+ * @throws If an error occurs while updating the customer and shipping address.
402
+ */
403
+ removeProductInOrder(orderId: string, orderItemId: string, reason: string): Promise<any>;
404
+ /**
405
+ * Get list sale order status
406
+ * @param orderId - The id of order
407
+ * @param paymentMethod - Thi id of item order
408
+ * @returns A promise that resolves when the customer and shipping address are updated.
409
+ * @throws If an error occurs while updating the customer and shipping address.
410
+ */
411
+ printOrderPdf(orderId: string, paymentMethod: string): Promise<any>;
412
+ /**
413
+ * Get list sale order status
414
+ * @param orderId - The id of order
415
+ * @param paymentMethod - Thi id of item order
416
+ * @returns A promise that resolves when the customer and shipping address are updated.
417
+ * @throws If an error occurs while updating the customer and shipping address.
418
+ */
419
+ printOrderHtml(orderId: string, paymentMethod: string): Promise<any>;
420
+ /**
421
+ * Get list sale order status
422
+ * @param orderData - The id of order
423
+ * @returns A promise that resolves when the customer and shipping address are updated.
424
+ * @throws If an error occurs while updating the customer and shipping address.
425
+ */
426
+ createOrderReturn(orderData: any): Promise<any>;
427
+ /**
428
+ * Get list sale order status
429
+ * @param orderData - The id of order
382
430
  * @returns A promise that resolves when the customer and shipping address are updated.
383
431
  * @throws If an error occurs while updating the customer and shipping address.
384
432
  */
385
- removeProductInOrder(orderId: string, orderItemId: string): Promise<void>;
433
+ calculateOrder(orderData: any): Promise<any>;
386
434
  }
@@ -297,15 +297,27 @@ class OrderService extends service_1.Service {
297
297
  * Updates the customer and shipping address for an order.
298
298
  * @param orderId - The ID of the order.
299
299
  * @param orderItemId - The id of order.
300
+ * @param type_discount
301
+ * @param discount_amount
302
+ * @param campaign_id
303
+ * @param campaign_action_id
304
+ * @param campaign_action_type
300
305
  * @returns A promise that resolves when the customer and shipping address are updated.
301
306
  * @throws If an error occurs while updating the customer and shipping address.
302
307
  */
303
- updateDiscountPriceInOrder(orderId, orderItemId) {
308
+ updateDiscountPriceInOrder(orderId, orderItemId, type_discount, discount_amount, campaign_id, campaign_action_id, campaign_action_type) {
304
309
  return __awaiter(this, void 0, void 0, function* () {
305
310
  const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}/discount}`;
306
311
  const method = "PUT";
312
+ const orderData = {
313
+ type_discount,
314
+ discount_amount,
315
+ campaign_id,
316
+ campaign_action_id,
317
+ campaign_action_type,
318
+ };
307
319
  try {
308
- const response = yield this.restApiCallWithToken(endpoint, method);
320
+ const response = yield this.restApiCallWithToken(endpoint, method, orderData);
309
321
  return response;
310
322
  }
311
323
  catch (error) {
@@ -317,15 +329,25 @@ class OrderService extends service_1.Service {
317
329
  /**
318
330
  * Updates the customer and shipping address for an order.
319
331
  * @param orderId - The ID of the order.
332
+ * @param reason
333
+ * @param updatedBy
334
+ * @param note
335
+ * @param orderType
320
336
  * @returns A promise that resolves when the customer and shipping address are updated.
321
337
  * @throws If an error occurs while updating the customer and shipping address.
322
338
  */
323
- updateCancelOrder(orderId) {
339
+ updateCancelOrder(orderId, reason, updatedBy, note, orderType) {
324
340
  return __awaiter(this, void 0, void 0, function* () {
325
341
  const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/cancel`;
326
342
  const method = "PUT";
343
+ const orderData = {
344
+ reason,
345
+ updatedBy,
346
+ note,
347
+ orderType,
348
+ };
327
349
  try {
328
- const response = yield this.restApiCallWithToken(endpoint, method);
350
+ const response = yield this.restApiCallWithToken(endpoint, method, orderData);
329
351
  return response;
330
352
  }
331
353
  catch (error) {
@@ -338,20 +360,23 @@ class OrderService extends service_1.Service {
338
360
  * Updates the customer and shipping address for an order.
339
361
  * @param orderId - The ID of the order.
340
362
  * @param statusNew - the new status of order
341
- * @param updateBy - Id of person update
363
+ * @param updatedBy - Id of person update
342
364
  * @returns A promise that resolves when the customer and shipping address are updated.
343
365
  * @throws If an error occurs while updating the customer and shipping address.
344
366
  */
345
- updateStatusOrder(orderId, statusNew, updateBy) {
367
+ updateStatusReturnOrder(orderId, statusNew, updatedBy) {
346
368
  return __awaiter(this, void 0, void 0, function* () {
347
- const endpoint = `/orders/${this.orgId}/${orderId}/${statusNew}?updated_by=${updateBy}`;
369
+ if (!orderId || !statusNew || !updatedBy) {
370
+ throw new Error("Tham số đầu vào không hợp lệ.");
371
+ }
372
+ const endpoint = `/orders/${this.orgId}/${orderId}/${statusNew}?updated_by=${updatedBy}`;
348
373
  const method = "PUT";
349
374
  try {
350
375
  const response = yield this.restApiCallWithToken(endpoint, method);
351
376
  return response;
352
377
  }
353
378
  catch (error) {
354
- console.log(`Error in updateStatusOrder: ${error}`);
379
+ console.log(`Error in updateStatusReturnOrder: ${error}`);
355
380
  throw error;
356
381
  }
357
382
  });
@@ -714,8 +739,8 @@ class OrderService extends service_1.Service {
714
739
  const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/sell_order`;
715
740
  const method = "GET";
716
741
  try {
717
- const response = yield this.restApiCallWithToken(endpoint, method);
718
- return response;
742
+ const res = yield this.restApiCallWithToken(endpoint, method);
743
+ return res;
719
744
  }
720
745
  catch (error) {
721
746
  console.log(`Error in getInfoSellOrder: ${error}`);
@@ -748,7 +773,7 @@ class OrderService extends service_1.Service {
748
773
  * @returns A promise that resolves when the customer and shipping address are updated.
749
774
  * @throws If an error occurs while updating the customer and shipping address.
750
775
  */
751
- updateListTypeOrder() {
776
+ getListTypeOrder() {
752
777
  return __awaiter(this, void 0, void 0, function* () {
753
778
  const endpoint = `/orders/${this.orgId}/${this.storeId}/type`;
754
779
  const method = "GET";
@@ -767,7 +792,7 @@ class OrderService extends service_1.Service {
767
792
  * @returns A promise that resolves when the customer and shipping address are updated.
768
793
  * @throws If an error occurs while updating the customer and shipping address.
769
794
  */
770
- updateListShippingCarrier() {
795
+ getListShippingCarrier() {
771
796
  return __awaiter(this, void 0, void 0, function* () {
772
797
  const endpoint = `/orders/${this.orgId}/${this.storeId}/shippingCarrier`;
773
798
  const method = "GET";
@@ -862,7 +887,7 @@ class OrderService extends service_1.Service {
862
887
  * @returns A promise that resolves when the customer and shipping address are updated.
863
888
  * @throws If an error occurs while updating the customer and shipping address.
864
889
  */
865
- getListReturnorder(orderId, status, statusIgnore, subStatus, ffmStatus, subType, paymentMethod, keyword, customerMultiValue, productMultiValue, customerId, createdBy, dateCreateFrom, dateCreateTo, dateUpdateFrom, dateUpdateTo, employeeAssign, currentPage, maxResult) {
890
+ getListReturnOrder(orderId, status, statusIgnore, subStatus, ffmStatus, subType, paymentMethod, keyword, customerMultiValue, productMultiValue, customerId, createdBy, dateCreateFrom, dateCreateTo, dateUpdateFrom, dateUpdateTo, employeeAssign, currentPage, maxResult) {
866
891
  return __awaiter(this, void 0, void 0, function* () {
867
892
  const endpoint = `/orders/${this.orgId}/${this.storeId}/return_order?order_id=${orderId}&status=${status}&status_ignore=${statusIgnore}&sub_status=${subStatus}&ffm_status=${ffmStatus}&sub_type=${subType}&payment_method=${paymentMethod}&keyword=${keyword}&customer_multi_value=${customerMultiValue}&product_multi_value=${productMultiValue}&customer_id=${customerId}&created_by=${createdBy}&date_create_from=${dateCreateFrom}&date_create_to=${dateCreateTo}&date_update_from=${dateUpdateFrom}&date_update_to=${dateUpdateTo}&employee_assign=${employeeAssign}&currentPage=${currentPage}&maxResult=${maxResult}`;
868
893
  const method = "GET";
@@ -871,7 +896,7 @@ class OrderService extends service_1.Service {
871
896
  return response;
872
897
  }
873
898
  catch (error) {
874
- console.log(`Error in getListReturnorder: ${error}`);
899
+ console.log(`Error in getListReturnOrder: ${error}`);
875
900
  throw error;
876
901
  }
877
902
  });
@@ -906,7 +931,7 @@ class OrderService extends service_1.Service {
906
931
  removeDraftOrder(storeId, orderId, updatedBy) {
907
932
  return __awaiter(this, void 0, void 0, function* () {
908
933
  const endpoint = `/orders/${this.orgId}/${storeId}/${orderId}/draft?updated_by=${updatedBy}`;
909
- const method = "GET";
934
+ const method = "DELETE";
910
935
  try {
911
936
  const response = yield this.restApiCallWithToken(endpoint, method);
912
937
  return response;
@@ -921,12 +946,127 @@ class OrderService extends service_1.Service {
921
946
  * Get list sale order status
922
947
  * @param orderId - The id of order
923
948
  * @param orderItemId - Thi id of item order
924
- * @param reason - The reason of remove product in order
949
+ * @param reason - The reason of cancel product in order
925
950
  * @returns A promise that resolves when the customer and shipping address are updated.
926
951
  * @throws If an error occurs while updating the customer and shipping address.
927
952
  */
928
- removeProductInOrder(orderId, orderItemId) {
929
- return __awaiter(this, void 0, void 0, function* () { });
953
+ cancelProductInOrder(orderId, orderItemId, reason) {
954
+ return __awaiter(this, void 0, void 0, function* () {
955
+ const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}?reason=${reason}`;
956
+ const method = "DELETE";
957
+ try {
958
+ const response = yield this.restApiCallWithToken(endpoint, method);
959
+ return response;
960
+ }
961
+ catch (error) {
962
+ console.log(`Error in removeProductInOrder: ${error}`);
963
+ throw error;
964
+ }
965
+ });
966
+ }
967
+ /**
968
+ * Get list sale order status
969
+ * @param orderId - The id of order
970
+ * @param orderItemId - Thi id of item order
971
+ * @param reason - The reason of cancel product in order
972
+ * @returns A promise that resolves when the customer and shipping address are updated.
973
+ * @throws If an error occurs while updating the customer and shipping address.
974
+ */
975
+ removeProductInOrder(orderId, orderItemId, reason) {
976
+ return __awaiter(this, void 0, void 0, function* () {
977
+ const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}/delete?reason=${reason}`;
978
+ const method = "DELETE";
979
+ try {
980
+ const response = yield this.restApiCallWithToken(endpoint, method);
981
+ return response;
982
+ }
983
+ catch (error) {
984
+ console.log(`Error in removeProductInOrder: ${error}`);
985
+ throw error;
986
+ }
987
+ });
988
+ }
989
+ /**
990
+ * Get list sale order status
991
+ * @param orderId - The id of order
992
+ * @param paymentMethod - Thi id of item order
993
+ * @returns A promise that resolves when the customer and shipping address are updated.
994
+ * @throws If an error occurs while updating the customer and shipping address.
995
+ */
996
+ printOrderPdf(orderId, paymentMethod) {
997
+ return __awaiter(this, void 0, void 0, function* () {
998
+ const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/print.pdf?payment_method=${paymentMethod}`;
999
+ const method = "POST";
1000
+ try {
1001
+ const response = yield this.restApiCallWithToken(endpoint, method);
1002
+ return response;
1003
+ }
1004
+ catch (error) {
1005
+ console.log(`Error in printOrderPdf: ${error}`);
1006
+ throw error;
1007
+ }
1008
+ });
1009
+ }
1010
+ /**
1011
+ * Get list sale order status
1012
+ * @param orderId - The id of order
1013
+ * @param paymentMethod - Thi id of item order
1014
+ * @returns A promise that resolves when the customer and shipping address are updated.
1015
+ * @throws If an error occurs while updating the customer and shipping address.
1016
+ */
1017
+ printOrderHtml(orderId, paymentMethod) {
1018
+ return __awaiter(this, void 0, void 0, function* () {
1019
+ const endpoint = `/orders/${this.orgId}/${this.storeId}/${orderId}/print.html?payment_method=${paymentMethod}`;
1020
+ const method = "POST";
1021
+ try {
1022
+ const response = yield this.restApiCallWithToken(endpoint, method);
1023
+ return response;
1024
+ }
1025
+ catch (error) {
1026
+ console.log(`Error in printOrderHtml: ${error}`);
1027
+ throw error;
1028
+ }
1029
+ });
1030
+ }
1031
+ /**
1032
+ * Get list sale order status
1033
+ * @param orderData - The id of order
1034
+ * @returns A promise that resolves when the customer and shipping address are updated.
1035
+ * @throws If an error occurs while updating the customer and shipping address.
1036
+ */
1037
+ createOrderReturn(orderData) {
1038
+ return __awaiter(this, void 0, void 0, function* () {
1039
+ const endpoint = `/orders/${this.orgId}/order_return`;
1040
+ const method = "POST";
1041
+ try {
1042
+ const response = yield this.restApiCallWithToken(endpoint, method, orderData);
1043
+ return response;
1044
+ }
1045
+ catch (error) {
1046
+ console.log(`Error in createOrderReturn: ${error}`);
1047
+ throw error;
1048
+ }
1049
+ });
1050
+ }
1051
+ /**
1052
+ * Get list sale order status
1053
+ * @param orderData - The id of order
1054
+ * @returns A promise that resolves when the customer and shipping address are updated.
1055
+ * @throws If an error occurs while updating the customer and shipping address.
1056
+ */
1057
+ calculateOrder(orderData) {
1058
+ return __awaiter(this, void 0, void 0, function* () {
1059
+ const endpoint = `/orders/${this.orgId}/calculate`;
1060
+ const method = "POST";
1061
+ try {
1062
+ const response = yield this.restApiCallWithToken(endpoint, method, orderData);
1063
+ return response;
1064
+ }
1065
+ catch (error) {
1066
+ console.log(`Error in calculateOrder: ${error}`);
1067
+ throw error;
1068
+ }
1069
+ });
930
1070
  }
931
1071
  }
932
1072
  exports.OrderService = OrderService;
@@ -7,5 +7,4 @@ export declare class UserService extends Service {
7
7
  updateCompanyInfo(id: string, fieldName: string, valueUpdate: string, updatedBy: string): Promise<any>;
8
8
  updateCustomerV2(id: string, customerItem: updateCustomerRequest, updatedBy: string): Promise<any>;
9
9
  getCustomerById(id: string): Promise<any>;
10
- searchCompany(keyword: string, limit: number): Promise<any>;
11
10
  }
@@ -38,7 +38,7 @@ class UserService extends service_1.Service {
38
38
  orgId: this.orgId,
39
39
  createCompanyRequest: {
40
40
  name: payload === null || payload === void 0 ? void 0 : payload.name,
41
- phone: payload === null || payload === void 0 ? void 0 : payload.referPhone,
41
+ phone: payload === null || payload === void 0 ? void 0 : payload.phone,
42
42
  address: payload === null || payload === void 0 ? void 0 : payload.address,
43
43
  },
44
44
  createTaxCodeRequest: null,
@@ -113,23 +113,5 @@ class UserService extends service_1.Service {
113
113
  }
114
114
  });
115
115
  }
116
- searchCompany(keyword, limit) {
117
- return __awaiter(this, void 0, void 0, function* () {
118
- const query = queries_1.SEARCH_COMPANY;
119
- const variables = {
120
- keyword,
121
- orgId: this.orgId,
122
- limit,
123
- };
124
- try {
125
- const response = yield this.graphqlQuery(query, variables);
126
- return response.searchCompany;
127
- }
128
- catch (error) {
129
- console.log(`Error in searchCompany: ${error}`);
130
- throw error;
131
- }
132
- });
133
- }
134
116
  }
135
117
  exports.UserService = UserService;
@@ -8,7 +8,6 @@ export interface AddOpportunityRequest {
8
8
  referEmail: string;
9
9
  targetId: string;
10
10
  extSource: string;
11
- ownerId: string;
12
11
  }
13
12
  export interface Opportunity {
14
13
  goal: string;
@@ -1,6 +1,6 @@
1
1
  export interface createCompanyRequest {
2
2
  name: string;
3
- referPhone: string;
3
+ phone: string;
4
4
  address: string;
5
5
  }
6
6
  export interface CreateCompany {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/storefront-js-client",
3
- "version": "1.1.8",
3
+ "version": "1.2.1",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [
@@ -19,7 +19,7 @@
19
19
  "author": "",
20
20
  "license": "ISC",
21
21
  "dependencies": {
22
- "@apollo/client": "3.9.11",
22
+ "@apollo/client": "3.7.11",
23
23
  "apollo-boost": "^0.4.9",
24
24
  "axios": "^1.6.8",
25
25
  "crypto-js": "^4.2.0",