@longvansoftware/service-js-client 2.8.7 → 2.8.8

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.
Files changed (44) hide show
  1. package/dist/src/graphql/campaign/queries.d.ts +13 -11
  2. package/dist/src/graphql/campaign/queries.js +39 -111
  3. package/dist/src/graphql/cloudCloud/mutations.d.ts +2 -0
  4. package/dist/src/graphql/cloudCloud/mutations.js +101 -27
  5. package/dist/src/graphql/cloudCloud/queries.js +4 -0
  6. package/dist/src/graphql/orderCloud/mutations.d.ts +3 -1
  7. package/dist/src/graphql/orderCloud/mutations.js +21 -5
  8. package/dist/src/graphql/paymentV2/mutations.d.ts +1 -0
  9. package/dist/src/graphql/paymentV2/mutations.js +23 -37
  10. package/dist/src/graphql/paymentV2/queries.d.ts +2 -0
  11. package/dist/src/graphql/paymentV2/queries.js +58 -1
  12. package/dist/src/graphql/storefont/mutation.d.ts +4 -0
  13. package/dist/src/graphql/storefont/mutation.js +56 -0
  14. package/dist/src/graphql/storefont/queries.d.ts +5 -0
  15. package/dist/src/graphql/storefont/queries.js +106 -0
  16. package/dist/src/graphql/storefront/query.d.ts +3 -0
  17. package/dist/src/graphql/storefront/query.js +41 -0
  18. package/dist/src/graphql/tag/mutations.d.ts +2 -0
  19. package/dist/src/graphql/tag/mutations.js +44 -0
  20. package/dist/src/graphql/tag/queries.d.ts +1 -0
  21. package/dist/src/graphql/tag/queries.js +20 -0
  22. package/dist/src/lib/campaign/index.d.ts +1 -0
  23. package/dist/src/lib/campaign/index.js +69 -12
  24. package/dist/src/lib/cloudCloud/index.d.ts +1 -0
  25. package/dist/src/lib/cloudCloud/index.js +16 -0
  26. package/dist/src/lib/imageGateway/index.d.ts +6 -0
  27. package/dist/src/lib/imageGateway/index.js +18 -0
  28. package/dist/src/lib/orderCloud/index.d.ts +2 -0
  29. package/dist/src/lib/orderCloud/index.js +47 -1
  30. package/dist/src/lib/paymentV2/index.d.ts +11 -1
  31. package/dist/src/lib/paymentV2/index.js +55 -14
  32. package/dist/src/lib/portal/index.d.ts +10 -2
  33. package/dist/src/lib/portal/index.js +171 -11
  34. package/dist/src/lib/storefont/index.d.ts +23 -0
  35. package/dist/src/lib/storefont/index.js +160 -0
  36. package/dist/src/lib/storefront/index.d.ts +2 -0
  37. package/dist/src/lib/storefront/index.js +39 -0
  38. package/dist/src/lib/tag/index.d.ts +7 -0
  39. package/dist/src/lib/tag/index.js +61 -0
  40. package/package.json +1 -1
  41. package/dist/src/lib/service.d.ts +0 -14
  42. package/dist/src/lib/service.js +0 -101
  43. package/dist/src/utils/build-field-string.d.ts +0 -1
  44. package/dist/src/utils/build-field-string.js +0 -16
@@ -21,7 +21,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
21
21
  return __awaiter(this, void 0, void 0, function* () {
22
22
  const query = queries_1.PAYMENTS_BY_ORDERS;
23
23
  const variables = {
24
- orderIds: orderIds,
24
+ orderIds: orderIds
25
25
  };
26
26
  try {
27
27
  const response = yield this.graphqlQueryV3(query, variables);
@@ -32,12 +32,14 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
32
32
  }
33
33
  });
34
34
  }
35
- cancelPayment(paymentId, reason) {
35
+ cancelPayment(paymentId, reason, safeMode, createBy) {
36
36
  return __awaiter(this, void 0, void 0, function* () {
37
37
  const mutation = mutations_1.CANCEL_PAYMENT;
38
38
  const variables = {
39
39
  paymentId: paymentId,
40
40
  reason: reason,
41
+ safeMode: safeMode,
42
+ createBy: createBy
41
43
  };
42
44
  try {
43
45
  const respone = yield this.graphqlMutationV3(mutation, variables);
@@ -66,7 +68,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
66
68
  const query = queries_1.GET_PAYMENT_METHOD_TYPES;
67
69
  const variables = {
68
70
  partnerId: this.orgId,
69
- storeId: this.storeId,
71
+ storeId: this.storeId
70
72
  };
71
73
  try {
72
74
  const response = yield this.graphqlQueryV3(query, variables);
@@ -81,7 +83,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
81
83
  return __awaiter(this, void 0, void 0, function* () {
82
84
  const query = queries_1.PAYMENT_INFO;
83
85
  const variables = {
84
- paymentId,
86
+ paymentId
85
87
  };
86
88
  try {
87
89
  const response = yield this.graphqlQueryV3(query, variables);
@@ -100,7 +102,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
100
102
  storeId: this.storeId,
101
103
  methodTypeCode,
102
104
  methodCode,
103
- returnUrl,
105
+ returnUrl
104
106
  };
105
107
  try {
106
108
  const response = yield this.graphqlMutationV3(mutation, variables);
@@ -115,7 +117,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
115
117
  return __awaiter(this, void 0, void 0, function* () {
116
118
  const query = queries_1.PAYMENT_STATUS;
117
119
  const variables = {
118
- paymentId,
120
+ paymentId
119
121
  };
120
122
  try {
121
123
  const response = yield this.graphqlQueryV3(query, variables);
@@ -130,7 +132,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
130
132
  return __awaiter(this, void 0, void 0, function* () {
131
133
  const query = queries_1.GW_CONFIG_DETAIL;
132
134
  const variables = {
133
- configId,
135
+ configId
134
136
  };
135
137
  try {
136
138
  const response = yield this.graphqlQueryV3(query, variables);
@@ -148,7 +150,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
148
150
  paymentId: paymentId,
149
151
  transactionNo: transactionNo,
150
152
  note: note,
151
- confirmBy: confirmBy,
153
+ confirmBy: confirmBy
152
154
  };
153
155
  try {
154
156
  const response = yield this.graphqlMutationV3(mutation, variables);
@@ -163,7 +165,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
163
165
  return __awaiter(this, void 0, void 0, function* () {
164
166
  const query = queries_1.GET_PAYMENT_METHOD_TITLES;
165
167
  const variables = {
166
- methodCode,
168
+ methodCode
167
169
  };
168
170
  try {
169
171
  const response = yield this.graphqlQueryV3(query, variables);
@@ -180,7 +182,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
180
182
  const data = Object.assign(Object.assign({}, input), { partnerCode: this.orgId });
181
183
  const variable = {
182
184
  input: data,
183
- cassoApiKey,
185
+ cassoApiKey
184
186
  };
185
187
  try {
186
188
  const response = yield this.graphqlMutationV3(mutation, variable);
@@ -197,7 +199,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
197
199
  const data = Object.assign(Object.assign({}, input), { partnerCode: this.orgId });
198
200
  const variable = {
199
201
  input: data,
200
- cassoApiKey,
202
+ cassoApiKey
201
203
  };
202
204
  try {
203
205
  const response = yield this.graphqlMutationV3(mutation, variable);
@@ -214,7 +216,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
214
216
  const variables = {
215
217
  partnerId: this.orgId,
216
218
  methodCode,
217
- storeId: this.storeId,
219
+ storeId: this.storeId
218
220
  };
219
221
  try {
220
222
  const response = yield this.graphqlQueryV3(query, variables);
@@ -232,7 +234,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
232
234
  partnerId: this.orgId,
233
235
  storeId: this.storeId,
234
236
  storeActive: storeActive,
235
- allMethodTypes: allMethodTypes,
237
+ allMethodTypes: allMethodTypes
236
238
  };
237
239
  try {
238
240
  const response = yield this.graphqlQueryV3(queries, variables);
@@ -249,7 +251,7 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
249
251
  const variables = {
250
252
  partnerId: this.orgId,
251
253
  storeId,
252
- paymentId,
254
+ paymentId
253
255
  };
254
256
  try {
255
257
  const response = yield this.graphqlMutationV3(queries, variables);
@@ -260,5 +262,44 @@ class PaymentServiceV2 extends serviceSDK_1.Service {
260
262
  }
261
263
  });
262
264
  }
265
+ createPayment(paymentData) {
266
+ return __awaiter(this, void 0, void 0, function* () {
267
+ const mutation = mutations_1.CREATE_PAYMENT;
268
+ const variables = { paymentData };
269
+ try {
270
+ const response = yield this.graphqlMutationV3(mutation, variables);
271
+ return response.createPayment;
272
+ }
273
+ catch (error) {
274
+ throw error;
275
+ }
276
+ });
277
+ }
278
+ paymentMethodsByPartner(partnerCode) {
279
+ return __awaiter(this, void 0, void 0, function* () {
280
+ const query = queries_1.PAYMENT_METHODS_BY_PARTNER;
281
+ const variables = { partnerCode };
282
+ try {
283
+ const response = yield this.graphqlQueryV3(query, variables);
284
+ return response.paymentMethods;
285
+ }
286
+ catch (error) {
287
+ throw error;
288
+ }
289
+ });
290
+ }
291
+ getPaymentMethodTypesWithGatewayConfig(partnerId, storeId) {
292
+ return __awaiter(this, void 0, void 0, function* () {
293
+ const query = queries_1.GET_PAYMENT_METHOD_TYPES_WITH_GATEWAY_CONFIG;
294
+ const variables = { partnerId, storeId };
295
+ try {
296
+ const response = yield this.graphqlQueryV3(query, variables);
297
+ return response.getPaymentMethodTypes;
298
+ }
299
+ catch (error) {
300
+ throw error;
301
+ }
302
+ });
303
+ }
263
304
  }
264
305
  exports.PaymentServiceV2 = PaymentServiceV2;
@@ -6,8 +6,6 @@ export declare class PortalService extends Service {
6
6
  createTag(title: string, createBy: string, partnerId?: string): Promise<any>;
7
7
  searchTag(partnerId?: string, title?: string, id?: string, search?: string): Promise<any>;
8
8
  redirectLink(sku?: string, id?: string): string;
9
- imageProduct(parentId: string, parentType: string, width?: number, height?: number): string;
10
- imagesProduct(parentId: string, parentType: string, width?: number, height?: number): string;
11
9
  completeOrder(orderId: string, byUser: string): Promise<any>;
12
10
  pushMessage(message: any): Promise<any>;
13
11
  confirmExport(orderId: string, updateBy: string): Promise<any>;
@@ -30,4 +28,14 @@ export declare class PortalService extends Service {
30
28
  getPosition(query?: Record<string, any>): Promise<any>;
31
29
  getPositionForTime(query?: Record<string, any>): Promise<any>;
32
30
  getBookingCount(query?: Record<string, any>): Promise<any>;
31
+ getSlugPathFromDynamicFrom(query?: Record<string, any>): Promise<any>;
32
+ putSlugPathFromDynamicFrom(data: any): Promise<any>;
33
+ postSlugPathFromDynamicFrom(data: any): Promise<any>;
34
+ getExamGroupTimeSlots(query?: Record<string, any>): Promise<any>;
35
+ getExamGroupExecutionDates(query?: Record<string, any>): Promise<any>;
36
+ getExamGroupExecutionLocations(query?: Record<string, any>): Promise<any>;
37
+ getEventsActivity(query?: Record<string, any>): Promise<any>;
38
+ imageProduct(parentId: string, parentType: string, width?: number, height?: number): string;
39
+ imagesProduct(parentId: string, parentType: string, width?: number, height?: number): string;
40
+ confirmOrderWithoutPaid(partnerId: string, orderId: string, createBy: string): Promise<any>;
33
41
  }
@@ -77,14 +77,6 @@ class PortalService extends serviceSDK_1.Service {
77
77
  const url = `${this.endpoint}/facility/manager/session/inventory-item-by-product.xhtml?${sku ? `sku=${sku}` : `id=${id}`}&orgId=${this.orgId}`;
78
78
  return url;
79
79
  }
80
- imageProduct(parentId, parentType, width, height) {
81
- const url = `${this.endpoint}/image-gateway/public/image/${parentType}/${parentId}${width ? `?w=${width}` : ``}${`${height ? `&h=${height}` : ``}`} `;
82
- return url;
83
- }
84
- imagesProduct(parentId, parentType, width, height) {
85
- const url = `${this.endpoint}/image-gateway/public/images/${parentType}/${parentId}?w=${width}&h=${height}`;
86
- return url;
87
- }
88
80
  completeOrder(orderId, byUser) {
89
81
  return __awaiter(this, void 0, void 0, function* () {
90
82
  const endpoint = `/fulfillment-api/public/fulfillment/${this.orgId}/${orderId}/complete-fulfillment/${byUser}`;
@@ -157,7 +149,7 @@ class PortalService extends serviceSDK_1.Service {
157
149
  const endpoint = `/fulfillment-api/public/fulfillment/${this.orgId}/packageBoxes`;
158
150
  const method = "GET";
159
151
  try {
160
- const response = yield this.restApiCallWithNoHeader(endpoint, method);
152
+ const response = yield this.restApiCallWithToken(endpoint, method);
161
153
  return response;
162
154
  }
163
155
  catch (error) {
@@ -170,7 +162,7 @@ class PortalService extends serviceSDK_1.Service {
170
162
  const endpoint = `/fulfillment-api/public/fulfillment/${this.orgId}/${orderId}/shipment-parameters`;
171
163
  const method = "GET";
172
164
  try {
173
- const response = yield this.restApiCallWithNoHeader(endpoint, method);
165
+ const response = yield this.restApiCallWithToken(endpoint, method);
174
166
  return response;
175
167
  }
176
168
  catch (error) {
@@ -199,7 +191,7 @@ class PortalService extends serviceSDK_1.Service {
199
191
  const endpoint = `/fulfillment-api/public/fulfillment/${this.orgId}/${orderId}/fulfillment-stage`;
200
192
  const method = "GET";
201
193
  try {
202
- const response = yield this.restApiCallWithNoHeader(endpoint, method);
194
+ const response = yield this.restApiCallWithToken(endpoint, method);
203
195
  return response;
204
196
  }
205
197
  catch (error) {
@@ -452,5 +444,173 @@ class PortalService extends serviceSDK_1.Service {
452
444
  }
453
445
  });
454
446
  }
447
+ getSlugPathFromDynamicFrom(query) {
448
+ return __awaiter(this, void 0, void 0, function* () {
449
+ const method = "GET";
450
+ const baseUrl = `/dynamic-collection/public/v2/records/slug_path/slug_path_view`;
451
+ const params = new URLSearchParams();
452
+ if (query) {
453
+ Object.entries(query).forEach(([key, value]) => {
454
+ if (value !== undefined && value !== null) {
455
+ params.append(key, String(value));
456
+ }
457
+ });
458
+ }
459
+ const endpoint = params.toString()
460
+ ? `${baseUrl}?${params.toString()}`
461
+ : baseUrl;
462
+ try {
463
+ const response = yield this.restApiCallWithNoToken(endpoint, method);
464
+ return response;
465
+ }
466
+ catch (error) {
467
+ throw error;
468
+ }
469
+ });
470
+ }
471
+ putSlugPathFromDynamicFrom(data) {
472
+ return __awaiter(this, void 0, void 0, function* () {
473
+ const method = "PUT";
474
+ const endpoint = `/dynamic-collection/public/v2/records/slug_path/slug_path_form`;
475
+ try {
476
+ const response = yield this.restApiCallWithNoToken(endpoint, method, data);
477
+ return response;
478
+ }
479
+ catch (error) {
480
+ throw error;
481
+ }
482
+ });
483
+ }
484
+ postSlugPathFromDynamicFrom(data) {
485
+ return __awaiter(this, void 0, void 0, function* () {
486
+ const method = "POST";
487
+ const endpoint = `/dynamic-collection/public/v2/records/slug_path/slug_path_form`;
488
+ try {
489
+ const response = yield this.restApiCallWithNoHeader(endpoint, method, data);
490
+ return response;
491
+ }
492
+ catch (error) {
493
+ throw error;
494
+ }
495
+ });
496
+ }
497
+ getExamGroupTimeSlots(query) {
498
+ return __awaiter(this, void 0, void 0, function* () {
499
+ const method = "GET";
500
+ const baseUrl = `/dynamic-collection/public/v2/exam-group/time-slots`;
501
+ const params = new URLSearchParams();
502
+ if (query) {
503
+ Object.entries(query).forEach(([key, value]) => {
504
+ if (value !== undefined && value !== null) {
505
+ params.append(key, String(value));
506
+ }
507
+ });
508
+ }
509
+ const endpoint = params.toString()
510
+ ? `${baseUrl}?${params.toString()}`
511
+ : baseUrl;
512
+ try {
513
+ const response = yield this.restApiCallWithNoToken(endpoint, method);
514
+ return response;
515
+ }
516
+ catch (error) {
517
+ throw error;
518
+ }
519
+ });
520
+ }
521
+ getExamGroupExecutionDates(query) {
522
+ return __awaiter(this, void 0, void 0, function* () {
523
+ const method = "GET";
524
+ const baseUrl = `/dynamic-collection/public/v2/exam-group/execution-dates`;
525
+ const params = new URLSearchParams();
526
+ if (query) {
527
+ Object.entries(query).forEach(([key, value]) => {
528
+ if (value !== undefined && value !== null) {
529
+ params.append(key, String(value));
530
+ }
531
+ });
532
+ }
533
+ const endpoint = params.toString()
534
+ ? `${baseUrl}?${params.toString()}`
535
+ : baseUrl;
536
+ try {
537
+ const response = yield this.restApiCallWithNoToken(endpoint, method);
538
+ return response;
539
+ }
540
+ catch (error) {
541
+ throw error;
542
+ }
543
+ });
544
+ }
545
+ getExamGroupExecutionLocations(query) {
546
+ return __awaiter(this, void 0, void 0, function* () {
547
+ const method = "GET";
548
+ const baseUrl = `/dynamic-collection/public/v2/exam-group/execution-locations`;
549
+ const params = new URLSearchParams();
550
+ if (query) {
551
+ Object.entries(query).forEach(([key, value]) => {
552
+ if (value !== undefined && value !== null) {
553
+ params.append(key, String(value));
554
+ }
555
+ });
556
+ }
557
+ const endpoint = params.toString()
558
+ ? `${baseUrl}?${params.toString()}`
559
+ : baseUrl;
560
+ try {
561
+ const response = yield this.restApiCallWithNoToken(endpoint, method);
562
+ return response;
563
+ }
564
+ catch (error) {
565
+ throw error;
566
+ }
567
+ });
568
+ }
569
+ getEventsActivity(query) {
570
+ return __awaiter(this, void 0, void 0, function* () {
571
+ const method = "GET";
572
+ const baseUrl = `/dynamic-collection/public/v2/event/event-activity`;
573
+ const params = new URLSearchParams();
574
+ if (query) {
575
+ Object.entries(query).forEach(([key, value]) => {
576
+ if (value !== undefined && value !== null) {
577
+ params.append(key, String(value));
578
+ }
579
+ });
580
+ }
581
+ const endpoint = params.toString()
582
+ ? `${baseUrl}?${params.toString()}`
583
+ : baseUrl;
584
+ try {
585
+ const response = yield this.restApiCallWithNoToken(endpoint, method);
586
+ return response;
587
+ }
588
+ catch (error) {
589
+ throw error;
590
+ }
591
+ });
592
+ }
593
+ imageProduct(parentId, parentType, width, height) {
594
+ const url = `${this.endpoint}/image-gateway/public/image/${parentType}/${parentId}${width ? `?w=${width}` : ``}${`${height ? `&h=${height}` : ``}`} `;
595
+ return url;
596
+ }
597
+ imagesProduct(parentId, parentType, width, height) {
598
+ const url = `${this.endpoint}/image-gateway/public/images/${parentType}/${parentId}?w=${width}&h=${height}`;
599
+ return url;
600
+ }
601
+ // API confirmOrder xử lý FFM cho order có mặt hàng có offerType = SUBCRIPTION
602
+ confirmOrderWithoutPaid(partnerId, orderId, createBy) {
603
+ return __awaiter(this, void 0, void 0, function* () {
604
+ const endpoint = `/order-cloud-service/service-webhook/confirm-order-without-paid?partnerId=${partnerId}&orderId=${orderId}&createBy=${createBy}`;
605
+ const method = "GET";
606
+ try {
607
+ const response = yield this.restApiCallWithNoHeader(endpoint, method);
608
+ return response;
609
+ }
610
+ catch (error) {
611
+ throw error;
612
+ }
613
+ });
614
+ }
455
615
  }
456
616
  exports.PortalService = PortalService;
@@ -0,0 +1,23 @@
1
+ import { Service } from "../serviceSDK";
2
+ export interface QuickAddOrderItemInput {
3
+ orderId: string;
4
+ itemName: string;
5
+ unitPrice: string;
6
+ quantity?: string;
7
+ unit?: string | null;
8
+ itemType?: string | null;
9
+ vatRate?: string | null;
10
+ customAttributes?: any;
11
+ }
12
+ export declare class StorefontService extends Service {
13
+ constructor(endpoint: string, orgId: string, storeId: string);
14
+ setToken(token: string): void;
15
+ getRevenueStatisticByGroupOrCategory(dataQuery: any, groupBy: any): Promise<any>;
16
+ getRevenueStatisticByProduct(dataQuery: any): Promise<any>;
17
+ quickAddOrderItem(input: QuickAddOrderItemInput): Promise<any>;
18
+ getFirstTrialTreatmentMonthlyReport(monthCount: number, storeIds: [string]): Promise<any>;
19
+ getFirstTrialTreatmentMonthlyDetail(month: string, storeIds: [string]): Promise<any>;
20
+ mergeOrderCart(oldCartId: string, newCartId: string, actorId: string, isAllowedToMergeItem: boolean, fields?: string[]): Promise<any>;
21
+ getFirstTrialTreatmentRemainingUsesReport(storeIds: [string]): Promise<any>;
22
+ updateOrderLineItemResource(orderId: string, lineItemId: string, input: any): Promise<any>;
23
+ }
@@ -0,0 +1,160 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.StorefontService = void 0;
13
+ const serviceSDK_1 = require("../serviceSDK");
14
+ const queries_1 = require("../../graphql/storefont/queries");
15
+ const mutation_1 = require("../../graphql/storefont/mutation");
16
+ class StorefontService extends serviceSDK_1.Service {
17
+ constructor(endpoint, orgId, storeId) {
18
+ super(endpoint, orgId, storeId);
19
+ }
20
+ setToken(token) {
21
+ this.token = token;
22
+ }
23
+ getRevenueStatisticByGroupOrCategory(dataQuery, groupBy) {
24
+ return __awaiter(this, void 0, void 0, function* () {
25
+ const query = queries_1.GET_REVENUE_STATISTIC_BY_GROUP_OR_CATEGORY;
26
+ const variables = {
27
+ input: dataQuery,
28
+ groupBy,
29
+ };
30
+ try {
31
+ const response = yield this.graphqlQueryV4(query, variables);
32
+ return response.getRevenueStatisticByGroupOrCategory;
33
+ }
34
+ catch (error) {
35
+ throw error;
36
+ }
37
+ });
38
+ }
39
+ getRevenueStatisticByProduct(dataQuery) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ const query = queries_1.GET_REVENUE_STATISTIC_BY_PRODUCT;
42
+ const variables = {
43
+ input: dataQuery,
44
+ };
45
+ try {
46
+ const response = yield this.graphqlQueryV4(query, variables);
47
+ return response.getRevenueStatisticByProduct;
48
+ }
49
+ catch (error) {
50
+ throw error;
51
+ }
52
+ });
53
+ }
54
+ quickAddOrderItem(input) {
55
+ return __awaiter(this, void 0, void 0, function* () {
56
+ const variables = {
57
+ partnerId: this.orgId,
58
+ storeId: this.storeId,
59
+ input,
60
+ };
61
+ try {
62
+ const response = yield this.graphqlMutationV2(mutation_1.QUICK_ADD_ORDER_ITEM, variables);
63
+ return response.quickAddOrderItem;
64
+ }
65
+ catch (error) {
66
+ throw error;
67
+ }
68
+ });
69
+ }
70
+ getFirstTrialTreatmentMonthlyReport(monthCount, storeIds) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ const query = queries_1.GET_FIRST_TRIAL_TREATMENT_MONTHLY_REPORT;
73
+ const variables = {
74
+ monthCount,
75
+ storeIds,
76
+ };
77
+ try {
78
+ const response = yield this.graphqlQueryV4(query, variables);
79
+ return response.getFirstTrialTreatmentMonthlyReport;
80
+ }
81
+ catch (error) {
82
+ throw error;
83
+ }
84
+ });
85
+ }
86
+ getFirstTrialTreatmentMonthlyDetail(month, storeIds) {
87
+ return __awaiter(this, void 0, void 0, function* () {
88
+ const query = queries_1.GET_FIRST_TRIAL_TREATMENT_MONTHLY_DETAIL;
89
+ const variables = {
90
+ month,
91
+ storeIds,
92
+ };
93
+ try {
94
+ const response = yield this.graphqlQueryV4(query, variables);
95
+ return response.getFirstTrialTreatmentMonthlyDetail;
96
+ }
97
+ catch (error) {
98
+ throw error;
99
+ }
100
+ });
101
+ }
102
+ mergeOrderCart(oldCartId_1, newCartId_1, actorId_1, isAllowedToMergeItem_1) {
103
+ return __awaiter(this, arguments, void 0, function* (oldCartId, newCartId, actorId, isAllowedToMergeItem, fields = [
104
+ "success",
105
+ "movedItemCount",
106
+ "skippedItemCount",
107
+ "oldCartCanceled",
108
+ "message",
109
+ ]) {
110
+ const mutation = (0, mutation_1.MERGE_ORDER_CART)(fields);
111
+ const variables = {
112
+ oldCartId,
113
+ newCartId,
114
+ actorId,
115
+ isAllowedToMergeItem,
116
+ };
117
+ try {
118
+ const response = yield this.graphqlMutationV2(mutation, variables);
119
+ return response.mergeOrderCart;
120
+ }
121
+ catch (error) {
122
+ throw error;
123
+ }
124
+ });
125
+ }
126
+ getFirstTrialTreatmentRemainingUsesReport(storeIds) {
127
+ return __awaiter(this, void 0, void 0, function* () {
128
+ const query = queries_1.GET_FIRST_TRIAL_TREATMENT_REMAINING_USES_REPORT;
129
+ const variables = {
130
+ storeIds,
131
+ };
132
+ try {
133
+ const response = yield this.graphqlQueryV4(query, variables);
134
+ return response.getFirstTrialTreatmentRemainingUsesReport;
135
+ }
136
+ catch (error) {
137
+ throw error;
138
+ }
139
+ });
140
+ }
141
+ updateOrderLineItemResource(orderId, lineItemId, input) {
142
+ return __awaiter(this, void 0, void 0, function* () {
143
+ const mutation = mutation_1.UPDATE_ORDER_LINE_ITEM_RESOURCE;
144
+ const variables = {
145
+ partnerId: this.orgId,
146
+ orderId,
147
+ lineItemId,
148
+ input,
149
+ };
150
+ try {
151
+ const response = yield this.graphqlMutationV2(mutation, variables);
152
+ return response.updateOrderLineItemResource;
153
+ }
154
+ catch (error) {
155
+ throw error;
156
+ }
157
+ });
158
+ }
159
+ }
160
+ exports.StorefontService = StorefontService;
@@ -4,4 +4,6 @@ export declare class StorefrontService extends Service {
4
4
  setToken(token: string): void;
5
5
  setStoreId(storeId: string): void;
6
6
  mergeOrderCart(oldCartId: string, newCartId: string, actorId: string, isAllowedToMergeItem: boolean, fields?: string[]): Promise<any>;
7
+ getReferralCodes(partnerId: string, ownerReferralId: string, size?: number, page?: number, onlyWithBalance?: boolean, status?: string, fields?: string[]): Promise<any>;
8
+ getReferralCodeDetail(partnerId: string, voucherCode: string, fields?: string[]): Promise<any>;
7
9
  }
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.StorefrontService = void 0;
13
13
  const mutation_1 = require("../../graphql/storefront/mutation");
14
+ const query_1 = require("../../graphql/storefront/query");
14
15
  const serviceSDK_1 = require("../serviceSDK");
15
16
  class StorefrontService extends serviceSDK_1.Service {
16
17
  constructor(endpoint, orgId, storeId) {
@@ -40,5 +41,43 @@ class StorefrontService extends serviceSDK_1.Service {
40
41
  }
41
42
  });
42
43
  }
44
+ getReferralCodes(partnerId_1, ownerReferralId_1, size_1, page_1, onlyWithBalance_1, status_1) {
45
+ return __awaiter(this, arguments, void 0, function* (partnerId, ownerReferralId, size, page, onlyWithBalance, status, fields = []) {
46
+ const query = (0, query_1.GET_REFERRAL_CODES)(fields);
47
+ const variables = {
48
+ partnerId,
49
+ ownerReferralId,
50
+ size,
51
+ page,
52
+ onlyWithBalance,
53
+ status
54
+ };
55
+ try {
56
+ const response = yield this.graphqlQueryV2(query, variables);
57
+ return response.referralCodes;
58
+ }
59
+ catch (error) {
60
+ console.log(`Error fetching getReferralCodes : ${error}`);
61
+ throw error;
62
+ }
63
+ });
64
+ }
65
+ getReferralCodeDetail(partnerId_1, voucherCode_1) {
66
+ return __awaiter(this, arguments, void 0, function* (partnerId, voucherCode, fields = []) {
67
+ const query = (0, query_1.GET_REFERRAL_CODE_DETAIL)(fields);
68
+ const variables = {
69
+ partnerId,
70
+ voucherCode
71
+ };
72
+ try {
73
+ const response = yield this.graphqlQueryV2(query, variables);
74
+ return response.referralCodeDetail;
75
+ }
76
+ catch (error) {
77
+ console.log(`Error fetching getReferralCodeDetail : ${error}`);
78
+ throw error;
79
+ }
80
+ });
81
+ }
43
82
  }
44
83
  exports.StorefrontService = StorefrontService;
@@ -0,0 +1,7 @@
1
+ import { Service } from "../serviceSDK";
2
+ export declare class TagService extends Service {
3
+ constructor(endpoint: string, orgId: string, storeId: string);
4
+ addTagToTagGroup(data: any): Promise<any>;
5
+ removeTagToTagGroup(data: any): Promise<any>;
6
+ getResultTag(resourceId: string, resourceType: string): Promise<any>;
7
+ }