@longvansoftware/service-js-client 1.16.4 → 1.16.6

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 (100) hide show
  1. package/dist/src/graphql/cloud/mutations.d.ts +0 -4
  2. package/dist/src/graphql/cloud/mutations.js +1 -47
  3. package/dist/src/graphql/cloud/queries.d.ts +0 -1
  4. package/dist/src/graphql/cloud/queries.js +1 -26
  5. package/dist/src/graphql/computing/mutations.d.ts +0 -1
  6. package/dist/src/graphql/computing/mutations.js +1 -15
  7. package/dist/src/graphql/crm/mutations.d.ts +0 -3
  8. package/dist/src/graphql/crm/mutations.js +1 -54
  9. package/dist/src/graphql/crm/queries.d.ts +0 -3
  10. package/dist/src/graphql/crm/queries.js +1 -71
  11. package/dist/src/graphql/crm_camping/queries.js +19 -49
  12. package/dist/src/graphql/orderGraphQL/queries.d.ts +5 -7
  13. package/dist/src/graphql/orderGraphQL/queries.js +1 -11
  14. package/dist/src/graphql/product/queries.d.ts +0 -2
  15. package/dist/src/graphql/product/queries.js +1 -32
  16. package/dist/src/lib/auth/index.d.ts +1 -1
  17. package/dist/src/lib/auth/index.js +4 -3
  18. package/dist/src/lib/cloud/index.d.ts +0 -5
  19. package/dist/src/lib/cloud/index.js +0 -85
  20. package/dist/src/lib/computing/index.d.ts +0 -1
  21. package/dist/src/lib/computing/index.js +0 -17
  22. package/dist/src/lib/crm/index.d.ts +0 -6
  23. package/dist/src/lib/crm/index.js +0 -107
  24. package/dist/src/lib/crm_camping/index.d.ts +2 -2
  25. package/dist/src/lib/crm_camping/index.js +8 -13
  26. package/dist/src/lib/orderGraphQL/index.d.ts +0 -1
  27. package/dist/src/lib/orderGraphQL/index.js +0 -16
  28. package/dist/src/lib/product/index.d.ts +0 -2
  29. package/dist/src/lib/product/index.js +0 -34
  30. package/dist/src/lib/resource_permission/index.d.ts +2 -2
  31. package/dist/src/lib/resource_permission/index.js +4 -4
  32. package/dist/src/lib/service.d.ts +14 -0
  33. package/dist/src/lib/service.js +101 -0
  34. package/dist/src/utils/build-field-string.d.ts +1 -0
  35. package/dist/src/utils/build-field-string.js +16 -0
  36. package/package.json +1 -1
  37. package/dist/src/graphql/campaign/mutations.d.ts +0 -1
  38. package/dist/src/graphql/campaign/mutations.js +0 -34
  39. package/dist/src/graphql/campaign/queries.d.ts +0 -9
  40. package/dist/src/graphql/campaign/queries.js +0 -427
  41. package/dist/src/graphql/cashbook/queries.d.ts +0 -2
  42. package/dist/src/graphql/cashbook/queries.js +0 -99
  43. package/dist/src/graphql/fragments/product.d.ts +0 -38
  44. package/dist/src/graphql/fragments/product.js +0 -196
  45. package/dist/src/graphql/paymentV2/mutations.d.ts +0 -5
  46. package/dist/src/graphql/paymentV2/mutations.js +0 -120
  47. package/dist/src/graphql/paymentV2/queries.d.ts +0 -9
  48. package/dist/src/graphql/paymentV2/queries.js +0 -257
  49. package/dist/src/graphql/store/mutations.d.ts +0 -1
  50. package/dist/src/graphql/store/mutations.js +0 -29
  51. package/dist/src/graphql/store/queries.d.ts +0 -1
  52. package/dist/src/graphql/store/queries.js +0 -29
  53. package/dist/src/lib/accounting/index.d.ts +0 -5
  54. package/dist/src/lib/accounting/index.js +0 -32
  55. package/dist/src/lib/campaign/index.d.ts +0 -20
  56. package/dist/src/lib/campaign/index.js +0 -218
  57. package/dist/src/lib/cashbook/index.d.ts +0 -6
  58. package/dist/src/lib/cashbook/index.js +0 -56
  59. package/dist/src/lib/comhub/index.d.ts +0 -6
  60. package/dist/src/lib/comhub/index.js +0 -50
  61. package/dist/src/lib/deepLinkVietQr/index.d.ts +0 -7
  62. package/dist/src/lib/deepLinkVietQr/index.js +0 -58
  63. package/dist/src/lib/fileService/index.d.ts +0 -34
  64. package/dist/src/lib/fileService/index.js +0 -80
  65. package/dist/src/lib/getImage/index.d.ts +0 -4
  66. package/dist/src/lib/getImage/index.js +0 -10
  67. package/dist/src/lib/image/index.d.ts +0 -7
  68. package/dist/src/lib/image/index.js +0 -49
  69. package/dist/src/lib/omnigateway/index.d.ts +0 -7
  70. package/dist/src/lib/omnigateway/index.js +0 -58
  71. package/dist/src/lib/paymentV2/index.d.ts +0 -18
  72. package/dist/src/lib/paymentV2/index.js +0 -245
  73. package/dist/src/lib/portal/index.d.ts +0 -23
  74. package/dist/src/lib/portal/index.js +0 -255
  75. package/dist/src/lib/shareZalo/index.d.ts +0 -5
  76. package/dist/src/lib/shareZalo/index.js +0 -32
  77. package/dist/src/lib/store/index.d.ts +0 -30
  78. package/dist/src/lib/store/index.js +0 -74
  79. package/dist/src/lib/token/index.d.ts +0 -5
  80. package/dist/src/lib/token/index.js +0 -32
  81. package/dist/src/lib/upload/index.d.ts +0 -5
  82. package/dist/src/lib/upload/index.js +0 -35
  83. package/dist/src/lib/warehouseV2/index.d.ts +0 -13
  84. package/dist/src/lib/warehouseV2/index.js +0 -54
  85. package/dist/src/lib/zca/index.d.ts +0 -12
  86. package/dist/src/lib/zca/index.js +0 -41
  87. package/dist/src/types/campaign.d.ts +0 -14
  88. package/dist/src/types/campaign.js +0 -2
  89. package/dist/src/types/common.d.ts +0 -264
  90. package/dist/src/types/common.js +0 -35
  91. package/dist/src/types/invoice.d.ts +0 -13
  92. package/dist/src/types/invoice.js +0 -2
  93. package/dist/src/types/portal.d.ts +0 -7
  94. package/dist/src/types/portal.js +0 -2
  95. package/dist/src/types/store.d.ts +0 -158
  96. package/dist/src/types/store.js +0 -3
  97. package/dist/src/utils/errorHandler.d.ts +0 -64
  98. package/dist/src/utils/errorHandler.js +0 -197
  99. package/dist/src/utils/validatePhoneNumber.d.ts +0 -1
  100. package/dist/src/utils/validatePhoneNumber.js +0 -20
@@ -1,218 +0,0 @@
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.CampaignService = void 0;
13
- const serviceSDK_1 = require("../serviceSDK");
14
- const queries_1 = require("../../graphql/campaign/queries");
15
- const mutations_1 = require("../../graphql/campaign/mutations");
16
- class CampaignService extends serviceSDK_1.Service {
17
- /**
18
- * Constructs a new CampaignService instance.
19
- * @param endpoint - The endpoint URL for the service.
20
- * @param orgId - The organization ID.
21
- * @param storeId - The store ID.
22
- */
23
- constructor(endpoint, orgId, storeId) {
24
- super(endpoint, orgId, storeId);
25
- }
26
- getCampaignActionActiveNow(customerId, campaignActionType) {
27
- return __awaiter(this, void 0, void 0, function* () {
28
- const query = queries_1.GET_CAMPAIGN_ACTION_ACTIVE_NOW;
29
- const variables = {
30
- partyId: this.orgId,
31
- productStoreId: this.storeId,
32
- customerId,
33
- campaignActionType,
34
- };
35
- try {
36
- const response = yield this.graphqlQuery(query, variables);
37
- return response.getCampaignActionActiveNow;
38
- }
39
- catch (error) {
40
- console.log(`Error fetching getCampaignActionActiveNow: ${error}`);
41
- throw error;
42
- }
43
- });
44
- }
45
- searchVouchers(campaignId, campaignActionId, campaignActionType, customerId, excludeExpired, pageNumber, pageSize) {
46
- return __awaiter(this, void 0, void 0, function* () {
47
- const query = queries_1.GET_VOUCHERS;
48
- const variables = {
49
- partyId: this.orgId,
50
- storeId: this.storeId,
51
- campaignId,
52
- campaignActionId,
53
- campaignActionType,
54
- customerId,
55
- excludeExpired,
56
- pageNumber,
57
- pageSize,
58
- };
59
- try {
60
- const response = yield this.graphqlQuery(query, variables);
61
- return response.searchVoucher;
62
- }
63
- catch (error) {
64
- console.log(`Error fetching searchVoucher: ${error}`);
65
- throw error;
66
- }
67
- });
68
- }
69
- checkValidVoucher(customerId, voucherCode) {
70
- return __awaiter(this, void 0, void 0, function* () {
71
- const query = queries_1.CHECK_VALID_VOUCHER;
72
- const variables = {
73
- partyId: this.orgId,
74
- productStoreId: this.storeId,
75
- customerId,
76
- voucherCode,
77
- };
78
- try {
79
- const response = yield this.graphqlQuery(query, variables);
80
- return response.checkValidVoucher;
81
- }
82
- catch (error) {
83
- console.log(`Error fetching searchVoucher: ${error}`);
84
- throw error;
85
- }
86
- });
87
- }
88
- getCampaignActiveNow(campaignActionType, customerId) {
89
- return __awaiter(this, void 0, void 0, function* () {
90
- const query = queries_1.GET_CAMPAIGN_ACTIVE_NOW;
91
- const variables = {
92
- partyId: this.orgId,
93
- productStoreId: this.storeId,
94
- campaignActionType,
95
- customerId,
96
- };
97
- try {
98
- const response = yield this.graphqlQuery(query, variables);
99
- return response.getCampaignActiveNow;
100
- }
101
- catch (error) {
102
- throw error;
103
- }
104
- });
105
- }
106
- getPromotionProductPrice(productId, productPrice) {
107
- return __awaiter(this, void 0, void 0, function* () {
108
- const query = queries_1.GET_PROMOTION_PRODUCT_PRICE;
109
- const variables = {
110
- partyId: this.orgId,
111
- productStoreId: this.storeId,
112
- productId,
113
- productPrice,
114
- };
115
- try {
116
- const response = yield this.graphqlQuery(query, variables);
117
- return response.getPromotionProductPrice;
118
- }
119
- catch (error) {
120
- throw error;
121
- }
122
- });
123
- }
124
- getVoucherAvailableForCustomer(campaignId, campaignActionId, customerId, excludeExpired, isPageAble) {
125
- return __awaiter(this, void 0, void 0, function* () {
126
- const query = queries_1.GET_VOUCHER_AVAILABLE_FOR_CUSTOMER;
127
- const variables = {
128
- partyId: this.orgId,
129
- storeId: this.storeId,
130
- campaignId,
131
- campaignActionId,
132
- customerId,
133
- excludeExpired,
134
- isPageAble,
135
- };
136
- try {
137
- const response = yield this.graphqlQuery(query, variables);
138
- return response.getVoucherAvailableForCustomer;
139
- }
140
- catch (error) {
141
- throw error;
142
- }
143
- });
144
- }
145
- addCustomerToVoucher(voucherCode, userId, affiliateId) {
146
- return __awaiter(this, void 0, void 0, function* () {
147
- const query = mutations_1.ADD_CUSTOMER_ID_INTO_VOUCHER;
148
- const variables = {
149
- partyId: this.orgId,
150
- voucherCode,
151
- userId,
152
- affiliateId,
153
- };
154
- try {
155
- const response = yield this.graphqlMutation(query, variables);
156
- return response.addCustomerIdIntoVoucher;
157
- }
158
- catch (error) {
159
- throw error;
160
- }
161
- });
162
- }
163
- suggestVoucher(customerId, campaignId, campaignActionId, isBirthday) {
164
- return __awaiter(this, void 0, void 0, function* () {
165
- const query = queries_1.SUGGEST_VOUCHER;
166
- const variables = {
167
- partyId: this.orgId,
168
- customerId: customerId,
169
- campaignId: campaignId,
170
- campaignActionId: campaignActionId,
171
- excludeExpired: true,
172
- isBirthday: isBirthday,
173
- };
174
- try {
175
- const response = yield this.graphqlQuery(query, variables);
176
- return response.suggestVoucher;
177
- }
178
- catch (error) {
179
- throw error;
180
- }
181
- });
182
- }
183
- getCampaignActionById(id) {
184
- return __awaiter(this, void 0, void 0, function* () {
185
- const query = queries_1.GET_CAMPAIGN_ACTION_BY_ID;
186
- const variables = {
187
- id,
188
- };
189
- try {
190
- const response = yield this.graphqlQuery(query, variables);
191
- return response.getCampaignActionById;
192
- }
193
- catch (error) {
194
- throw error;
195
- }
196
- });
197
- }
198
- searchProductGiftPromotionResponse(productIds, campaignActionId) {
199
- return __awaiter(this, void 0, void 0, function* () {
200
- const query = queries_1.SEARCH_PRODUCT_GIFT_PROMOTION_RESPONSE;
201
- const variables = {
202
- partyId: this.orgId,
203
- storeId: this.storeId,
204
- productIds: productIds,
205
- campaignActionId: campaignActionId,
206
- sort: { asc: true, key: "createdStamp" },
207
- };
208
- try {
209
- const response = yield this.graphqlQuery(query, variables);
210
- return response.searchProductGiftPromotionResponse;
211
- }
212
- catch (error) {
213
- throw error;
214
- }
215
- });
216
- }
217
- }
218
- exports.CampaignService = CampaignService;
@@ -1,6 +0,0 @@
1
- import { Service } from "../serviceSDK";
2
- export declare class CashbookService extends Service {
3
- constructor(endpoint: string, orgId: string, storeId: string);
4
- searchTransactions(keyword: string, dateFrom: number, dateTo: number, currentPage: number, pageSize: number): Promise<any>;
5
- getCashbookTransactionDetail(cashTransactionId: string): Promise<any>;
6
- }
@@ -1,56 +0,0 @@
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.CashbookService = void 0;
13
- const serviceSDK_1 = require("../serviceSDK");
14
- const queries_1 = require("../../graphql/cashbook/queries");
15
- class CashbookService extends serviceSDK_1.Service {
16
- constructor(endpoint, orgId, storeId) {
17
- super(endpoint, orgId, storeId);
18
- }
19
- searchTransactions(keyword, dateFrom, dateTo, currentPage, pageSize) {
20
- return __awaiter(this, void 0, void 0, function* () {
21
- const query = queries_1.SEARCH_TRANSACTIONS;
22
- const variables = {
23
- partnerId: this.orgId,
24
- keyword,
25
- dateFrom,
26
- dateTo,
27
- currentPage,
28
- pageSize,
29
- };
30
- try {
31
- const response = yield this.graphqlQueryV3(query, variables);
32
- return response.searchTransactions;
33
- }
34
- catch (error) {
35
- throw error;
36
- }
37
- });
38
- }
39
- getCashbookTransactionDetail(cashTransactionId) {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- const query = queries_1.GET_CASHBOOK_TRANSACTION_DETAIL;
42
- const variables = {
43
- partnerId: this.orgId,
44
- cashTransactionId,
45
- };
46
- try {
47
- const response = yield this.graphqlQueryV3(query, variables);
48
- return response.getCashbookTransactionDetail;
49
- }
50
- catch (error) {
51
- throw error;
52
- }
53
- });
54
- }
55
- }
56
- exports.CashbookService = CashbookService;
@@ -1,6 +0,0 @@
1
- import { Service } from "../serviceSDK";
2
- export declare class ComhubService extends Service {
3
- constructor(endpoint: string, orgId: string, storeId: string);
4
- sendZns(dataTemplate: any, appId: string, messageType: string): Promise<any>;
5
- sendMessage(OAId: string, content: string, contentType: string, senderPartyId: string, receivePartyIds: [string]): Promise<any>;
6
- }
@@ -1,50 +0,0 @@
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.ComhubService = void 0;
13
- const serviceSDK_1 = require("../serviceSDK");
14
- class ComhubService extends serviceSDK_1.Service {
15
- constructor(endpoint, orgId, storeId) {
16
- super(endpoint, orgId, storeId);
17
- }
18
- sendZns(dataTemplate, appId, messageType) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- const endpoint = `/web-hook/message/v2/send/social/ZNS/app/${appId}/message-type/${messageType}`;
21
- const method = "POST";
22
- try {
23
- const response = yield this.restApiCallWithNoHeader(endpoint, method, dataTemplate);
24
- return response;
25
- }
26
- catch (error) {
27
- throw error;
28
- }
29
- });
30
- }
31
- sendMessage(OAId, content, contentType, senderPartyId, receivePartyIds) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- const endpoint = `/web-hook/message/send/social/app/${OAId}`;
34
- const method = "POST";
35
- const dataRequet = {
36
- content,
37
- senderPartyId,
38
- receivePartyIds,
39
- };
40
- try {
41
- const response = yield this.restApiCallWithNoHeader(endpoint, method, dataRequet);
42
- return response;
43
- }
44
- catch (error) {
45
- throw error;
46
- }
47
- });
48
- }
49
- }
50
- exports.ComhubService = ComhubService;
@@ -1,7 +0,0 @@
1
- import { Service } from "../serviceSDK";
2
- export declare class DeepLinkVietQrService extends Service {
3
- constructor(endpoint: string, orgId: string, storeId: string);
4
- getAndroidBank(): Promise<any>;
5
- getIosBank(): Promise<any>;
6
- getBank(): Promise<any>;
7
- }
@@ -1,58 +0,0 @@
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.DeepLinkVietQrService = void 0;
13
- const serviceSDK_1 = require("../serviceSDK");
14
- class DeepLinkVietQrService extends serviceSDK_1.Service {
15
- constructor(endpoint, orgId, storeId) {
16
- super(endpoint, orgId, storeId);
17
- }
18
- getAndroidBank() {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- const endpoint = `/android-app-deeplinks`;
21
- const method = "GET";
22
- try {
23
- const response = yield this.restApiCallWithToken(endpoint, method);
24
- return response;
25
- }
26
- catch (error) {
27
- throw error;
28
- }
29
- });
30
- }
31
- getIosBank() {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- const endpoint = `/ios-app-deeplinks`;
34
- const method = "GET";
35
- try {
36
- const response = yield this.restApiCallWithToken(endpoint, method);
37
- return response;
38
- }
39
- catch (error) {
40
- throw error;
41
- }
42
- });
43
- }
44
- getBank() {
45
- return __awaiter(this, void 0, void 0, function* () {
46
- const endpoint = `/banks`;
47
- const method = "GET";
48
- try {
49
- const response = yield this.restApiCallWithToken(endpoint, method);
50
- return response;
51
- }
52
- catch (error) {
53
- throw error;
54
- }
55
- });
56
- }
57
- }
58
- exports.DeepLinkVietQrService = DeepLinkVietQrService;
@@ -1,34 +0,0 @@
1
- import { Service } from "../serviceSDK";
2
- export interface UploadFileRequest {
3
- uploadFile: File;
4
- path: string;
5
- parentId?: string;
6
- parentType?: string;
7
- }
8
- export interface UploadFileResponse {
9
- fileName: string;
10
- filePath: string;
11
- fileSize: number;
12
- }
13
- export declare class FileServiceSerVice extends Service {
14
- constructor(endpoint: string, orgId: string, storeId: string);
15
- /**
16
- * Upload file to the file service
17
- * @param uploadFile - File object to upload
18
- * @param path - Directory path to save the file
19
- * @param parentId - Reference ID of parent object (optional)
20
- * @param parentType - Type of parent object reference (optional)
21
- * @returns Promise<UploadFileResponse>
22
- */
23
- uploadFile(uploadFile: File, path: string, parentId?: string, parentType?: string): Promise<UploadFileResponse>;
24
- /**
25
- * Upload image file (convenience method)
26
- * @param imageFile - Image file to upload
27
- * @param path - Directory path to save the image (default: "public")
28
- * @param parentId - Reference ID of parent object (optional)
29
- * @param parentType - Type of parent object reference (optional)
30
- * @returns Promise<UploadFileResponse>
31
- */
32
- uploadImage(imageFile: File, path?: string, parentId?: string, parentType?: string): Promise<UploadFileResponse>;
33
- getImage(parentId: string, parenttype: string): Promise<any>;
34
- }
@@ -1,80 +0,0 @@
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.FileServiceSerVice = void 0;
13
- const serviceSDK_1 = require("../serviceSDK");
14
- class FileServiceSerVice extends serviceSDK_1.Service {
15
- constructor(endpoint, orgId, storeId) {
16
- super(endpoint, orgId, storeId);
17
- }
18
- /**
19
- * Upload file to the file service
20
- * @param uploadFile - File object to upload
21
- * @param path - Directory path to save the file
22
- * @param parentId - Reference ID of parent object (optional)
23
- * @param parentType - Type of parent object reference (optional)
24
- * @returns Promise<UploadFileResponse>
25
- */
26
- uploadFile(uploadFile, path, parentId, parentType) {
27
- return __awaiter(this, void 0, void 0, function* () {
28
- const endpoint = `/omnichannel/files/upload`;
29
- const method = "POST";
30
- try {
31
- const formData = new FormData();
32
- formData.append("uploadFile", uploadFile);
33
- formData.append("path", path);
34
- if (parentId) {
35
- formData.append("parentId", parentId);
36
- }
37
- if (parentType) {
38
- formData.append("parentType", parentType);
39
- }
40
- const response = yield this.restApiCallWithNoHeader(endpoint, method, formData);
41
- return response;
42
- }
43
- catch (error) {
44
- console.error("Error uploading file:", error);
45
- throw error;
46
- }
47
- });
48
- }
49
- /**
50
- * Upload image file (convenience method)
51
- * @param imageFile - Image file to upload
52
- * @param path - Directory path to save the image (default: "public")
53
- * @param parentId - Reference ID of parent object (optional)
54
- * @param parentType - Type of parent object reference (optional)
55
- * @returns Promise<UploadFileResponse>
56
- */
57
- uploadImage(imageFile_1) {
58
- return __awaiter(this, arguments, void 0, function* (imageFile, path = "public", parentId, parentType) {
59
- // Validate that the file is an image
60
- if (!imageFile.type.startsWith("image/")) {
61
- throw new Error("File must be an image");
62
- }
63
- return this.uploadFile(imageFile, path, parentId, parentType);
64
- });
65
- }
66
- getImage(parentId, parenttype) {
67
- return __awaiter(this, void 0, void 0, function* () {
68
- const endpoint = `/omnichannel/files/gets/${parentId}/${parenttype}`;
69
- const method = "GET";
70
- try {
71
- const response = yield this.restApiCallWithNoHeader(endpoint, method);
72
- return response;
73
- }
74
- catch (error) {
75
- throw error;
76
- }
77
- });
78
- }
79
- }
80
- exports.FileServiceSerVice = FileServiceSerVice;
@@ -1,4 +0,0 @@
1
- import { Service } from "../serviceSDK";
2
- export declare class GetImageService extends Service {
3
- constructor(endpoint: string, orgId: string, storeId: string);
4
- }
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetImageService = void 0;
4
- const serviceSDK_1 = require("../serviceSDK");
5
- class GetImageService extends serviceSDK_1.Service {
6
- constructor(endpoint, orgId, storeId) {
7
- super(endpoint, orgId, storeId);
8
- }
9
- }
10
- exports.GetImageService = GetImageService;
@@ -1,7 +0,0 @@
1
- import { Service } from "../serviceSDK";
2
- export declare class ImageService extends Service {
3
- constructor(endpoint: string, orgId: string, storeId: string);
4
- setToken(token: string): void;
5
- getImageProduct(imageId: string): Promise<any>;
6
- getImageProducts(productCode: string): Promise<any>;
7
- }
@@ -1,49 +0,0 @@
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.ImageService = void 0;
13
- const serviceSDK_1 = require("../serviceSDK");
14
- class ImageService extends serviceSDK_1.Service {
15
- constructor(endpoint, orgId, storeId) {
16
- super(endpoint, orgId, storeId);
17
- }
18
- setToken(token) {
19
- this.token = token;
20
- }
21
- getImageProduct(imageId) {
22
- return __awaiter(this, void 0, void 0, function* () {
23
- const endpoint = `/${this.orgId}/${imageId}/images-url`;
24
- const method = "GET";
25
- try {
26
- const response = yield this.restApiCallWithNoToken(endpoint, method);
27
- return response;
28
- }
29
- catch (error) {
30
- throw error;
31
- }
32
- });
33
- }
34
- getImageProducts(productCode) {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- try {
37
- const response = yield fetch(`https://product-service.dev.longvan.vn/product-service/v1/products/${this.orgId}/${productCode}/images-url`);
38
- if (!response.ok) {
39
- throw new Error("Failed to get image products");
40
- }
41
- return response.json();
42
- }
43
- catch (error) {
44
- console.error("Error getting image products:", error);
45
- }
46
- });
47
- }
48
- }
49
- exports.ImageService = ImageService;
@@ -1,7 +0,0 @@
1
- import { Service } from "../serviceSDK";
2
- export declare class OmnigatewayService extends Service {
3
- constructor(endpoint: string, orgId: string, storeId: string);
4
- requestJoinRoom(roomId: string, listUser: [string]): Promise<any>;
5
- getTemplate(type: string): Promise<any>;
6
- getInfoChatApp(): Promise<any>;
7
- }
@@ -1,58 +0,0 @@
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.OmnigatewayService = void 0;
13
- const serviceSDK_1 = require("../serviceSDK");
14
- class OmnigatewayService extends serviceSDK_1.Service {
15
- constructor(endpoint, orgId, storeId) {
16
- super(endpoint, orgId, storeId);
17
- }
18
- requestJoinRoom(roomId, listUser) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- const endpoint = `/topics/room/${roomId}/join`;
21
- const method = "POST";
22
- try {
23
- const response = yield this.restApiCallWithNoHeader(endpoint, method, listUser);
24
- return response;
25
- }
26
- catch (error) {
27
- throw error;
28
- }
29
- });
30
- }
31
- getTemplate(type) {
32
- return __awaiter(this, void 0, void 0, function* () {
33
- const endpoint = `/message-templates/partner/${this.orgId}/type/${type}`;
34
- const method = "GET";
35
- try {
36
- const response = yield this.restApiCallWithNoHeader(endpoint, method);
37
- return response;
38
- }
39
- catch (error) {
40
- throw error;
41
- }
42
- });
43
- }
44
- getInfoChatApp() {
45
- return __awaiter(this, void 0, void 0, function* () {
46
- const endpoint = `/channels/partner/${this.orgId}/social`;
47
- const method = "GET";
48
- try {
49
- const response = yield this.restApiCallWithNoHeader(endpoint, method);
50
- return response;
51
- }
52
- catch (error) {
53
- throw error;
54
- }
55
- });
56
- }
57
- }
58
- exports.OmnigatewayService = OmnigatewayService;