@longvansoftware/service-js-client 2.8.3 → 2.8.5

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 (64) hide show
  1. package/dist/config/config.d.ts +4 -0
  2. package/dist/config/config.js +6 -2
  3. package/dist/src/graphql/campaign/queries.d.ts +13 -11
  4. package/dist/src/graphql/campaign/queries.js +39 -111
  5. package/dist/src/graphql/cloudCloud/mutations.d.ts +2 -0
  6. package/dist/src/graphql/cloudCloud/mutations.js +101 -27
  7. package/dist/src/graphql/cloudCloud/queries.js +4 -0
  8. package/dist/src/graphql/crm/queries.d.ts +1 -0
  9. package/dist/src/graphql/crm/queries.js +18 -1
  10. package/dist/src/graphql/marketplace/mutations.d.ts +0 -0
  11. package/dist/src/graphql/marketplace/mutations.js +1 -0
  12. package/dist/src/graphql/marketplace/queries.d.ts +2 -0
  13. package/dist/src/graphql/marketplace/queries.js +24 -0
  14. package/dist/src/graphql/orderCloud/mutations.d.ts +3 -1
  15. package/dist/src/graphql/orderCloud/mutations.js +21 -5
  16. package/dist/src/graphql/orderGraphQL/mutations.d.ts +1 -0
  17. package/dist/src/graphql/orderGraphQL/mutations.js +18 -1
  18. package/dist/src/graphql/paymentV2/mutations.d.ts +1 -0
  19. package/dist/src/graphql/paymentV2/mutations.js +23 -37
  20. package/dist/src/graphql/paymentV2/queries.d.ts +2 -0
  21. package/dist/src/graphql/paymentV2/queries.js +58 -1
  22. package/dist/src/graphql/storefont/mutation.d.ts +2 -0
  23. package/dist/src/graphql/storefont/mutation.js +28 -0
  24. package/dist/src/graphql/storefont/queries.d.ts +5 -0
  25. package/dist/src/graphql/storefont/queries.js +99 -0
  26. package/dist/src/graphql/storefront/mutation.d.ts +2 -0
  27. package/dist/src/graphql/storefront/mutation.js +28 -0
  28. package/dist/src/graphql/tag/mutations.d.ts +2 -0
  29. package/dist/src/graphql/tag/mutations.js +44 -0
  30. package/dist/src/graphql/tag/queries.d.ts +1 -0
  31. package/dist/src/graphql/tag/queries.js +20 -0
  32. package/dist/src/lib/SDK.d.ts +6 -0
  33. package/dist/src/lib/SDK.js +9 -4
  34. package/dist/src/lib/campaign/index.d.ts +1 -0
  35. package/dist/src/lib/campaign/index.js +69 -12
  36. package/dist/src/lib/cloudCloud/index.d.ts +1 -0
  37. package/dist/src/lib/cloudCloud/index.js +16 -0
  38. package/dist/src/lib/crm/index.d.ts +1 -0
  39. package/dist/src/lib/crm/index.js +16 -0
  40. package/dist/src/lib/imageGateway/index.d.ts +6 -0
  41. package/dist/src/lib/imageGateway/index.js +18 -0
  42. package/dist/src/lib/marketplace/index.d.ts +13 -0
  43. package/dist/src/lib/marketplace/index.js +50 -0
  44. package/dist/src/lib/orderCloud/index.d.ts +2 -0
  45. package/dist/src/lib/orderCloud/index.js +47 -1
  46. package/dist/src/lib/orderGraphQL/index.d.ts +1 -0
  47. package/dist/src/lib/orderGraphQL/index.js +16 -0
  48. package/dist/src/lib/paymentV2/index.d.ts +11 -1
  49. package/dist/src/lib/paymentV2/index.js +55 -14
  50. package/dist/src/lib/portal/index.d.ts +10 -2
  51. package/dist/src/lib/portal/index.js +171 -11
  52. package/dist/src/lib/storefont/index.d.ts +6 -0
  53. package/dist/src/lib/storefont/index.js +41 -0
  54. package/dist/src/lib/storefront/index.d.ts +7 -0
  55. package/dist/src/lib/storefront/index.js +44 -0
  56. package/dist/src/lib/tag/index.d.ts +7 -0
  57. package/dist/src/lib/tag/index.js +61 -0
  58. package/dist/src/utils/helpers.d.ts +2 -0
  59. package/dist/src/utils/helpers.js +11 -5
  60. package/package.json +1 -1
  61. package/dist/src/lib/service.d.ts +0 -14
  62. package/dist/src/lib/service.js +0 -101
  63. package/dist/src/utils/build-field-string.d.ts +0 -1
  64. package/dist/src/utils/build-field-string.js +0 -16
@@ -1,27 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.HANDLE_CREATE_GATEWAY_CONFIG = exports.HANDLE_UPDATE_GATEWAY_CONFIG = exports.CONFIRM_PAYMENT_SUCCESS_MANUAL = exports.CONFIRM_TO_GATEWAY = exports.CANCEL_PAYMENT = void 0;
3
+ exports.HANDLE_CREATE_GATEWAY_CONFIG = exports.CREATE_PAYMENT = exports.HANDLE_UPDATE_GATEWAY_CONFIG = exports.CONFIRM_PAYMENT_SUCCESS_MANUAL = exports.CONFIRM_TO_GATEWAY = exports.CANCEL_PAYMENT = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.CANCEL_PAYMENT = (0, graphql_tag_1.gql) `
6
- mutation CancelPayment($paymentId: String!, $reason: String!) {
7
- cancelPayment(paymentId: $paymentId, reason: $reason)
6
+ mutation CancelPayment($paymentId: String!, $reason: String!, $safeMode: Boolean, $createBy: String) {
7
+ cancelPayment(paymentId: $paymentId, reason: $reason, safeMode: $safeMode, createBy: $createBy)
8
8
  }
9
9
  `;
10
10
  exports.CONFIRM_TO_GATEWAY = (0, graphql_tag_1.gql) `
11
- mutation ConfirmToGateWay(
12
- $paymentId: String!
13
- $storeId: String
14
- $methodTypeCode: String
15
- $methodCode: String
16
- $returnUrl: String
17
- ) {
18
- confirmToGateway(
19
- paymentId: $paymentId
20
- storeId: $storeId
21
- methodTypeCode: $methodTypeCode
22
- methodCode: $methodCode
23
- returnUrl: $returnUrl
24
- ) {
11
+ mutation ConfirmToGateWay($paymentId: String!, $storeId: String, $methodTypeCode: String, $methodCode: String, $returnUrl: String) {
12
+ confirmToGateway(paymentId: $paymentId, storeId: $storeId, methodTypeCode: $methodTypeCode, methodCode: $methodCode, returnUrl: $returnUrl) {
25
13
  code
26
14
  message
27
15
  data
@@ -34,18 +22,8 @@ exports.CONFIRM_TO_GATEWAY = (0, graphql_tag_1.gql) `
34
22
  }
35
23
  `;
36
24
  exports.CONFIRM_PAYMENT_SUCCESS_MANUAL = (0, graphql_tag_1.gql) `
37
- mutation ConfirmPaymentSuccessManual(
38
- $paymentId: String!
39
- $transactionNo: String!
40
- $note: String
41
- $confirmBy: String!
42
- ) {
43
- confirmPaymentSuccessManual(
44
- paymentId: $paymentId
45
- transactionNo: $transactionNo
46
- note: $note
47
- confirmBy: $confirmBy
48
- ) {
25
+ mutation ConfirmPaymentSuccessManual($paymentId: String!, $transactionNo: String!, $note: String, $confirmBy: String!) {
26
+ confirmPaymentSuccessManual(paymentId: $paymentId, transactionNo: $transactionNo, note: $note, confirmBy: $confirmBy) {
49
27
  code
50
28
  message
51
29
  data
@@ -57,10 +35,7 @@ exports.CONFIRM_PAYMENT_SUCCESS_MANUAL = (0, graphql_tag_1.gql) `
57
35
  }
58
36
  `;
59
37
  exports.HANDLE_UPDATE_GATEWAY_CONFIG = (0, graphql_tag_1.gql) `
60
- mutation HandleUpdateGatewayConfig(
61
- $input: PaymentGatewayConfigInput!
62
- $cassoApiKey: String
63
- ) {
38
+ mutation HandleUpdateGatewayConfig($input: PaymentGatewayConfigInput!, $cassoApiKey: String) {
64
39
  handleUpdateGatewayConfig(input: $input, cassoApiKey: $cassoApiKey) {
65
40
  id
66
41
  methodCode
@@ -89,11 +64,22 @@ exports.HANDLE_UPDATE_GATEWAY_CONFIG = (0, graphql_tag_1.gql) `
89
64
  }
90
65
  }
91
66
  `;
67
+ exports.CREATE_PAYMENT = (0, graphql_tag_1.gql) `
68
+ mutation CreatePayment($paymentData: Payment) {
69
+ createPayment(paymentData: $paymentData) {
70
+ code
71
+ message
72
+ data
73
+ qrCodeUrl
74
+ deeplink
75
+ deeplinkMiniApp
76
+ paymentId
77
+ gwConfigId
78
+ }
79
+ }
80
+ `;
92
81
  exports.HANDLE_CREATE_GATEWAY_CONFIG = (0, graphql_tag_1.gql) `
93
- mutation HandleCreateGatewayConfig(
94
- $input: PaymentGatewayConfigInput!
95
- $cassoApiKey: String
96
- ) {
82
+ mutation HandleCreateGatewayConfig($input: PaymentGatewayConfigInput!, $cassoApiKey: String) {
97
83
  handleCreateGatewayConfig(input: $input, cassoApiKey: $cassoApiKey) {
98
84
  id
99
85
  methodCode
@@ -7,4 +7,6 @@ export declare const GW_CONFIG_DETAIL: import("graphql").DocumentNode;
7
7
  export declare const GET_PAYMENT_METHOD_TITLES: import("graphql").DocumentNode;
8
8
  export declare const GET_PAYEMNT_GATEWAYS_BY_METHOD_CODE: import("graphql").DocumentNode;
9
9
  export declare const GET_PAYMENT_METHOD_TYPES_V2: import("graphql").DocumentNode;
10
+ export declare const GET_PAYMENT_METHOD_TYPES_WITH_GATEWAY_CONFIG: import("graphql").DocumentNode;
10
11
  export declare const GET_TRANSFER_INFO: import("graphql").DocumentNode;
12
+ export declare const PAYMENT_METHODS_BY_PARTNER: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_TRANSFER_INFO = exports.GET_PAYMENT_METHOD_TYPES_V2 = exports.GET_PAYEMNT_GATEWAYS_BY_METHOD_CODE = exports.GET_PAYMENT_METHOD_TITLES = exports.GW_CONFIG_DETAIL = exports.PAYMENT_STATUS = exports.PAYMENT_INFO = exports.GET_PAYMENT_METHOD_TYPES = exports.PAYMENT_METHODS = exports.PAYMENTS_BY_ORDERS = void 0;
3
+ exports.PAYMENT_METHODS_BY_PARTNER = exports.GET_TRANSFER_INFO = exports.GET_PAYMENT_METHOD_TYPES_WITH_GATEWAY_CONFIG = exports.GET_PAYMENT_METHOD_TYPES_V2 = exports.GET_PAYEMNT_GATEWAYS_BY_METHOD_CODE = exports.GET_PAYMENT_METHOD_TITLES = exports.GW_CONFIG_DETAIL = exports.PAYMENT_STATUS = exports.PAYMENT_INFO = exports.GET_PAYMENT_METHOD_TYPES = exports.PAYMENT_METHODS = exports.PAYMENTS_BY_ORDERS = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.PAYMENTS_BY_ORDERS = (0, graphql_tag_1.gql) `
6
6
  query PaymentsByOrders($orderIds: [String!]!) {
@@ -255,6 +255,44 @@ exports.GET_PAYMENT_METHOD_TYPES_V2 = (0, graphql_tag_1.gql) `
255
255
  }
256
256
  }
257
257
  `;
258
+ exports.GET_PAYMENT_METHOD_TYPES_WITH_GATEWAY_CONFIG = (0, graphql_tag_1.gql) `
259
+ query GetPaymentMethodTypesWithGatewayConfig(
260
+ $partnerId: String!
261
+ $storeId: String!
262
+ ) {
263
+ getPaymentMethodTypes(partnerId: $partnerId, storeId: $storeId) {
264
+ code
265
+ name
266
+ description
267
+ image
268
+ storeActive
269
+ paymentGatewayConfig {
270
+ id
271
+ methodCode
272
+ partnerCode
273
+ subMethodCode
274
+ gwPartnerCode
275
+ gwPartnerName
276
+ gwPaymentMethod
277
+ gwSubChannel
278
+ gwMethodVersion
279
+ hashAlgorithm
280
+ accessKey
281
+ secretKey
282
+ responseUrl
283
+ requestUrl
284
+ methodType
285
+ publicKey
286
+ redirectUrl
287
+ activated
288
+ paymentRecordingMethod
289
+ userId
290
+ name
291
+ description
292
+ }
293
+ }
294
+ }
295
+ `;
258
296
  exports.GET_TRANSFER_INFO = (0, graphql_tag_1.gql) `
259
297
  query GetTransferInfo(
260
298
  $partnerId: String!
@@ -275,3 +313,22 @@ exports.GET_TRANSFER_INFO = (0, graphql_tag_1.gql) `
275
313
  }
276
314
  }
277
315
  `;
316
+ exports.PAYMENT_METHODS_BY_PARTNER = (0, graphql_tag_1.gql) `
317
+ query PaymentMethodsByPartner($partnerCode: String) {
318
+ paymentMethods(partnerCode: $partnerCode ) {
319
+ id
320
+ code
321
+ description
322
+ image
323
+ name
324
+ titles {
325
+ id
326
+ code
327
+ name
328
+ lang
329
+ showField
330
+ required
331
+ }
332
+ }
333
+ }
334
+ `;
@@ -0,0 +1,2 @@
1
+ import { DocumentNode } from "graphql";
2
+ export declare const MERGE_ORDER_CART: (fields?: string[]) => DocumentNode;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MERGE_ORDER_CART = void 0;
7
+ const helpers_1 = require("../../utils/helpers");
8
+ const graphql_tag_1 = __importDefault(require("graphql-tag"));
9
+ const MERGE_ORDER_CART = (fields = []) => {
10
+ return (0, graphql_tag_1.default) `
11
+ mutation MergeOrderCart(
12
+ $oldCartId: String!
13
+ $newCartId: String!
14
+ $actorId: String!
15
+ $isAllowedToMergeItem: Boolean!
16
+ ) {
17
+ mergeOrderCart(
18
+ input: {
19
+ oldCartId: $oldCartId
20
+ newCartId: $newCartId
21
+ actorId: $actorId
22
+ isAllowedToMergeItem: $isAllowedToMergeItem
23
+ }
24
+ ) ${(0, helpers_1.hasFields)(fields) ? `{ ${(0, helpers_1.joinField)(fields)} }` : ""}
25
+ }
26
+ `;
27
+ };
28
+ exports.MERGE_ORDER_CART = MERGE_ORDER_CART;
@@ -0,0 +1,5 @@
1
+ export declare const GET_REVENUE_STATISTIC_BY_PRODUCT: import("graphql").DocumentNode;
2
+ export declare const GET_REVENUE_STATISTIC_BY_GROUP_OR_CATEGORY: import("graphql").DocumentNode;
3
+ export declare const GET_FIRST_TRIAL_TREATMENT_MONTHLY_REPORT: import("graphql").DocumentNode;
4
+ export declare const GET_FIRST_TRIAL_TREATMENT_MONTHLY_DETAIL: import("graphql").DocumentNode;
5
+ export declare const GET_FIRST_TRIAL_TREATMENT_REMAINING_USES_REPORT: import("graphql").DocumentNode;
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GET_FIRST_TRIAL_TREATMENT_REMAINING_USES_REPORT = exports.GET_FIRST_TRIAL_TREATMENT_MONTHLY_DETAIL = exports.GET_FIRST_TRIAL_TREATMENT_MONTHLY_REPORT = exports.GET_REVENUE_STATISTIC_BY_GROUP_OR_CATEGORY = exports.GET_REVENUE_STATISTIC_BY_PRODUCT = void 0;
4
+ const graphql_tag_1 = require("graphql-tag");
5
+ exports.GET_REVENUE_STATISTIC_BY_PRODUCT = (0, graphql_tag_1.gql) `
6
+ query GetRevenueStatisticByProduct($input: ProductStatisticPagedInput!) {
7
+ getRevenueStatisticByProduct(input: $input) {
8
+ totalElements
9
+ totalPages
10
+ page
11
+ size
12
+ content {
13
+ id
14
+ name
15
+ sku
16
+ image
17
+ productParentId
18
+ totalQuantity
19
+ inventory
20
+ }
21
+ }
22
+ }
23
+ `;
24
+ exports.GET_REVENUE_STATISTIC_BY_GROUP_OR_CATEGORY = (0, graphql_tag_1.gql) `
25
+ query GetRevenueStatisticByGroupOrCategory(
26
+ $input: ProductStatisticInput!
27
+ $groupBy: StatisticGroupBy!
28
+ ) {
29
+ getRevenueStatisticByGroupOrCategory(input: $input, groupBy: $groupBy) {
30
+ totalElements
31
+ totalPages
32
+ page
33
+ size
34
+ content {
35
+ id
36
+ name
37
+ totalOrders
38
+ totalPriceOfSales
39
+ totalPriceOfService
40
+ totalPriceOfRenewals
41
+ totalPrice
42
+ totalNotPayYet
43
+ }
44
+ }
45
+ }
46
+ `;
47
+ exports.GET_FIRST_TRIAL_TREATMENT_MONTHLY_REPORT = (0, graphql_tag_1.gql) `
48
+ query GetFirstTrialTreatmentMonthlyReport(
49
+ $storeIds: [String!]
50
+ $monthCount: Int
51
+ ) {
52
+ getFirstTrialTreatmentMonthlyReport(
53
+ storeIds: $storeIds
54
+ monthCount: $monthCount
55
+ ) {
56
+ totalFirstTrialCount
57
+ totalNewTreatmentCount
58
+ items {
59
+ month
60
+ firstTrialCount
61
+ newTreatmentCount
62
+ }
63
+ }
64
+ }
65
+ `;
66
+ exports.GET_FIRST_TRIAL_TREATMENT_MONTHLY_DETAIL = (0, graphql_tag_1.gql) `
67
+ query GetFirstTrialTreatmentMonthlyDetail(
68
+ $month: String!
69
+ $storeIds: [String!]
70
+ ) {
71
+ getFirstTrialTreatmentMonthlyDetail(month: $month, storeIds: $storeIds) {
72
+ month
73
+ totalFirstTrialCount
74
+ totalNewTreatmentCount
75
+ items {
76
+ salePartyId
77
+ saleName
78
+ firstTrialCount
79
+ newTreatmentCount
80
+ }
81
+ }
82
+ }
83
+ `;
84
+ exports.GET_FIRST_TRIAL_TREATMENT_REMAINING_USES_REPORT = (0, graphql_tag_1.gql) `
85
+ query GetFirstTrialTreatmentRemainingUsesReport($storeIds: [String!]) {
86
+ getFirstTrialTreatmentRemainingUsesReport(storeIds: $storeIds) {
87
+ totalOutOfUsesCount
88
+ totalUnderThreeUsesCount
89
+ totalUnderFiveUsesCount
90
+ items {
91
+ productId
92
+ productName
93
+ outOfUsesCount
94
+ underThreeUsesCount
95
+ underFiveUsesCount
96
+ }
97
+ }
98
+ }
99
+ `;
@@ -0,0 +1,2 @@
1
+ import { DocumentNode } from "graphql";
2
+ export declare const MERGE_ORDER_CART: (fields?: string[]) => DocumentNode;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MERGE_ORDER_CART = void 0;
7
+ const helpers_1 = require("../../utils/helpers");
8
+ const graphql_tag_1 = __importDefault(require("graphql-tag"));
9
+ const MERGE_ORDER_CART = (fields = []) => {
10
+ return (0, graphql_tag_1.default) `
11
+ mutation MergeOrderCart(
12
+ $oldCartId: String!
13
+ $newCartId: String!
14
+ $actorId: String!
15
+ $isAllowedToMergeItem: Boolean!
16
+ ) {
17
+ mergeOrderCart(
18
+ input: {
19
+ oldCartId: $oldCartId
20
+ newCartId: $newCartId
21
+ actorId: $actorId
22
+ isAllowedToMergeItem: $isAllowedToMergeItem
23
+ }
24
+ ) ${(0, helpers_1.hasFields)(fields) ? `{ ${(0, helpers_1.joinField)(fields)} }` : ""}
25
+ }
26
+ `;
27
+ };
28
+ exports.MERGE_ORDER_CART = MERGE_ORDER_CART;
@@ -0,0 +1,2 @@
1
+ export declare const ADD_TAG_TO_TAG_GROUP: import("graphql").DocumentNode;
2
+ export declare const REMOVE_TAG_TO_TAG_GROUP: import("graphql").DocumentNode;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.REMOVE_TAG_TO_TAG_GROUP = exports.ADD_TAG_TO_TAG_GROUP = void 0;
4
+ const graphql_tag_1 = require("graphql-tag");
5
+ exports.ADD_TAG_TO_TAG_GROUP = (0, graphql_tag_1.gql) `
6
+ mutation AddTagToTagGroup(
7
+ $resourceId: String!
8
+ $resourceType: String!
9
+ $tagId: String!
10
+ $tagGroupId: String
11
+ $addedBy: String!
12
+ ) {
13
+ addTagToTagGroup(
14
+ resourceId: $resourceId
15
+ resourceType: $resourceType
16
+ tagId: $tagId
17
+ tagGroupId: $tagGroupId
18
+ addedBy: $addedBy
19
+ ) {
20
+ code
21
+ message
22
+ }
23
+ }
24
+ `;
25
+ exports.REMOVE_TAG_TO_TAG_GROUP = (0, graphql_tag_1.gql) `
26
+ mutation RemoveTagToTagGroup(
27
+ $resourceId: String!
28
+ $resourceType: String!
29
+ $tagId: String!
30
+ $tagGroupId: String
31
+ $updateBy: String!
32
+ ) {
33
+ removeTagToTagGroup(
34
+ resourceId: $resourceId
35
+ resourceType: $resourceType
36
+ tagId: $tagId
37
+ tagGroupId: $tagGroupId
38
+ updateBy: $updateBy
39
+ ) {
40
+ code
41
+ message
42
+ }
43
+ }
44
+ `;
@@ -0,0 +1 @@
1
+ export declare const GET_RESULT_TAG: import("graphql").DocumentNode;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GET_RESULT_TAG = void 0;
4
+ const graphql_tag_1 = require("graphql-tag");
5
+ exports.GET_RESULT_TAG = (0, graphql_tag_1.gql) `
6
+ query GetResultTag($resourceId: String!, $resourceType: String!) {
7
+ getResultTag(resourceId: $resourceId, resourceType: $resourceType) {
8
+ id
9
+ title
10
+ items {
11
+ id
12
+ title
13
+ items {
14
+ id
15
+ title
16
+ }
17
+ }
18
+ }
19
+ }
20
+ `;
@@ -20,6 +20,8 @@ import { QuicklabService } from "./quicklab_service";
20
20
  import { RemoteAccessService } from "./remote_access_service";
21
21
  import { StorageS3Service } from "./storage_s3";
22
22
  import { ContentApiService } from "./content_api";
23
+ import { MarketPlaceService } from "./marketplace";
24
+ import { StorefrontService } from "./storefront";
23
25
  export interface Endpoints {
24
26
  product: string;
25
27
  crm: string;
@@ -43,6 +45,8 @@ export interface Endpoints {
43
45
  remote_access_service: string;
44
46
  storage_s3: string;
45
47
  content_api: string;
48
+ marketplace: string;
49
+ storefront: string;
46
50
  }
47
51
  export declare class SDK {
48
52
  orgId: string;
@@ -70,6 +74,8 @@ export declare class SDK {
70
74
  quicklab_service: QuicklabService;
71
75
  remote_access_service: RemoteAccessService;
72
76
  storage_s3: StorageS3Service;
77
+ marketplace: MarketPlaceService;
78
+ storefront: StorefrontService;
73
79
  content_api: ContentApiService;
74
80
  token: string | null;
75
81
  private endpoints;
@@ -26,6 +26,8 @@ const quicklab_service_1 = require("./quicklab_service");
26
26
  const remote_access_service_1 = require("./remote_access_service");
27
27
  const storage_s3_1 = require("./storage_s3");
28
28
  const content_api_1 = require("./content_api");
29
+ const marketplace_1 = require("./marketplace");
30
+ const storefront_1 = require("./storefront");
29
31
  class SDK {
30
32
  constructor(orgId, storeId, storefrontAccessToken, environment) {
31
33
  this.orgId = orgId;
@@ -35,10 +37,7 @@ class SDK {
35
37
  this.token = null;
36
38
  console.log("🚀 ~ SDK ~ storeId:", storeId);
37
39
  (0, helpers_1.validateStorefrontAccessToken)(storefrontAccessToken);
38
- this.endpoints =
39
- environment == "live"
40
- ? config_1.environmentEndpoints.live
41
- : config_1.environmentEndpoints.dev;
40
+ this.endpoints = environment == "live" ? config_1.environmentEndpoints.live : config_1.environmentEndpoints.dev;
42
41
  //console.log("🚀 ~ SDK ~ endpoints:", endpoints.computing);
43
42
  this.product = new index_1.ProductService(this.endpoints.product, orgId, storeId);
44
43
  this.auth = new index_2.AuthService(this.endpoints.auth, orgId, storeId);
@@ -62,7 +61,9 @@ class SDK {
62
61
  this.remote_access_service = new remote_access_service_1.RemoteAccessService(this.endpoints.remote_access_service, orgId, storeId);
63
62
  this.storage_s3 = new storage_s3_1.StorageS3Service(this.endpoints.storage_s3, orgId, storeId);
64
63
  this.content_api = new content_api_1.ContentApiService(this.endpoints.content_api, orgId, storeId);
64
+ this.marketplace = new marketplace_1.MarketPlaceService(this.endpoints.marketplace, orgId, storeId);
65
65
  // Initialize other services here
66
+ this.storefront = new storefront_1.StorefrontService(this.endpoints.storefront, orgId, storeId);
66
67
  }
67
68
  setToken(token) {
68
69
  this.token = token;
@@ -89,6 +90,8 @@ class SDK {
89
90
  this.remote_access_service.setToken(token);
90
91
  this.storage_s3.setToken(token);
91
92
  this.content_api.setToken(token);
93
+ this.marketplace.setToken(token);
94
+ this.storefront.setToken(token);
92
95
  // Set token for other services here
93
96
  }
94
97
  // các module export từ serviceSDK.ts set storeId vào serviceSDK.ts
@@ -118,6 +121,8 @@ class SDK {
118
121
  this.remote_access_service = new remote_access_service_1.RemoteAccessService(this.endpoints.remote_access_service, this.orgId, storeId);
119
122
  this.storage_s3 = new storage_s3_1.StorageS3Service(this.endpoints.storage_s3, this.orgId, storeId);
120
123
  this.content_api = new content_api_1.ContentApiService(this.endpoints.content_api, this.orgId, storeId);
124
+ this.marketplace = new marketplace_1.MarketPlaceService(this.endpoints.marketplace, this.orgId, storeId);
125
+ this.storefront = new storefront_1.StorefrontService(this.endpoints.storefront, this.orgId, storeId);
121
126
  }
122
127
  }
123
128
  exports.SDK = SDK;
@@ -19,4 +19,5 @@ export declare class CampaignService extends Service {
19
19
  searchProductGiftPromotionResponse(productIds: string[], campaignActionId: string): Promise<any>;
20
20
  getCampaign(id: string): Promise<any>;
21
21
  searchProductPricePromotionResponse(campaignId: string, campaignActionId: string, statusActive: string): Promise<any>;
22
+ voucherForUserRequest(orderId: string, customerId?: string, paymentMethodId?: string, shippingCompanyId?: string, pageNumber?: number, pageSize?: number, fields?: string[]): Promise<any>;
22
23
  }
@@ -30,7 +30,7 @@ class CampaignService extends serviceSDK_1.Service {
30
30
  partyId: this.orgId,
31
31
  productStoreId: this.storeId,
32
32
  customerId,
33
- campaignActionType,
33
+ campaignActionType
34
34
  };
35
35
  try {
36
36
  const response = yield this.graphqlQuery(query, variables);
@@ -54,7 +54,7 @@ class CampaignService extends serviceSDK_1.Service {
54
54
  customerId,
55
55
  excludeExpired,
56
56
  pageNumber,
57
- pageSize,
57
+ pageSize
58
58
  };
59
59
  try {
60
60
  const response = yield this.graphqlQuery(query, variables);
@@ -73,7 +73,7 @@ class CampaignService extends serviceSDK_1.Service {
73
73
  partyId: this.orgId,
74
74
  productStoreId: this.storeId,
75
75
  customerId,
76
- voucherCode,
76
+ voucherCode
77
77
  };
78
78
  try {
79
79
  const response = yield this.graphqlQuery(query, variables);
@@ -92,7 +92,7 @@ class CampaignService extends serviceSDK_1.Service {
92
92
  partyId: this.orgId,
93
93
  productStoreId: this.storeId,
94
94
  campaignActionType,
95
- customerId,
95
+ customerId
96
96
  };
97
97
  try {
98
98
  const response = yield this.graphqlQuery(query, variables);
@@ -110,7 +110,7 @@ class CampaignService extends serviceSDK_1.Service {
110
110
  partyId: this.orgId,
111
111
  productStoreId: this.storeId,
112
112
  productId,
113
- productPrice,
113
+ productPrice
114
114
  };
115
115
  try {
116
116
  const response = yield this.graphqlQuery(query, variables);
@@ -131,7 +131,7 @@ class CampaignService extends serviceSDK_1.Service {
131
131
  campaignActionId,
132
132
  customerId,
133
133
  excludeExpired,
134
- isPageAble,
134
+ isPageAble
135
135
  };
136
136
  try {
137
137
  const response = yield this.graphqlQuery(query, variables);
@@ -149,7 +149,7 @@ class CampaignService extends serviceSDK_1.Service {
149
149
  partyId: this.orgId,
150
150
  voucherCode,
151
151
  userId,
152
- affiliateId,
152
+ affiliateId
153
153
  };
154
154
  try {
155
155
  const response = yield this.graphqlMutation(query, variables);
@@ -169,7 +169,7 @@ class CampaignService extends serviceSDK_1.Service {
169
169
  campaignId: campaignId,
170
170
  campaignActionId: campaignActionId,
171
171
  excludeExpired: true,
172
- isBirthday: isBirthday,
172
+ isBirthday: isBirthday
173
173
  };
174
174
  try {
175
175
  const response = yield this.graphqlQuery(query, variables);
@@ -184,7 +184,7 @@ class CampaignService extends serviceSDK_1.Service {
184
184
  return __awaiter(this, void 0, void 0, function* () {
185
185
  const query = queries_1.GET_CAMPAIGN_ACTION_BY_ID;
186
186
  const variables = {
187
- id,
187
+ id
188
188
  };
189
189
  try {
190
190
  const response = yield this.graphqlQuery(query, variables);
@@ -203,7 +203,7 @@ class CampaignService extends serviceSDK_1.Service {
203
203
  storeId: this.storeId,
204
204
  productIds: productIds,
205
205
  campaignActionId: campaignActionId,
206
- sort: { asc: true, key: "createdStamp" },
206
+ sort: { asc: true, key: "createdStamp" }
207
207
  };
208
208
  try {
209
209
  const response = yield this.graphqlQuery(query, variables);
@@ -218,7 +218,7 @@ class CampaignService extends serviceSDK_1.Service {
218
218
  return __awaiter(this, void 0, void 0, function* () {
219
219
  const query = queries_1.GET_CAMPAIGN;
220
220
  const variables = {
221
- id,
221
+ id
222
222
  };
223
223
  try {
224
224
  const response = yield this.graphqlQuery(query, variables);
@@ -237,7 +237,7 @@ class CampaignService extends serviceSDK_1.Service {
237
237
  campaignId,
238
238
  campaignActionId,
239
239
  statusActive,
240
- sort: { asc: true, key: "productId" },
240
+ sort: { asc: true, key: "productId" }
241
241
  };
242
242
  try {
243
243
  const response = yield this.graphqlQuery(query, variables);
@@ -248,5 +248,62 @@ class CampaignService extends serviceSDK_1.Service {
248
248
  }
249
249
  });
250
250
  }
251
+ voucherForUserRequest(orderId_1) {
252
+ return __awaiter(this, arguments, void 0, function* (orderId, customerId = "", paymentMethodId, shippingCompanyId, pageNumber = 0, pageSize = 20, fields = [
253
+ `content {
254
+ id
255
+ voucherCode
256
+ isBirthday
257
+ discountAmount
258
+ discountPercent
259
+ usageLimitPerVoucher
260
+ numberOfTimeUsed
261
+ maximumDiscount
262
+ maximumDiscountType
263
+ memberLevel
264
+ affiliateId
265
+ description
266
+ usageLimitType
267
+ minimumSpend
268
+ maximumSpend
269
+ expiryDate
270
+ isUsable
271
+ unusableReasons
272
+ remainingAmount
273
+ discountType
274
+ discountValue
275
+ ownerPartyId
276
+ rewardType
277
+ voucherType
278
+ }`,
279
+ "total",
280
+ "pageNumber",
281
+ "pageSize",
282
+ "totalPages",
283
+ "numberOfElements",
284
+ "first",
285
+ "last"
286
+ ]) {
287
+ const query = (0, queries_1.GET_VOUCHER_FOR_USER)(fields);
288
+ const variables = {
289
+ voucherForUserRequest: {
290
+ orderId,
291
+ customerId,
292
+ storeId: this.storeId,
293
+ paymentMethodId,
294
+ shippingCompanyId,
295
+ pageNumber,
296
+ pageSize
297
+ }
298
+ };
299
+ try {
300
+ const res = yield this.graphqlQuery(query, variables);
301
+ return res.getVouchersForUser;
302
+ }
303
+ catch (error) {
304
+ throw error;
305
+ }
306
+ });
307
+ }
251
308
  }
252
309
  exports.CampaignService = CampaignService;
@@ -9,4 +9,5 @@ export declare class CloudCloudService extends Service {
9
9
  updateServiceResource(data: Record<string, any>): Promise<any>;
10
10
  countAvailableBookings(serviceId: string): Promise<any>;
11
11
  recountUsedBookings(serviceId: string, actorId: string): Promise<any>;
12
+ linkUserAccount(ownerId: string, serviceId: string): Promise<any>;
12
13
  }