@longvansoftware/service-js-client 1.4.2 โ 1.4.4
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.
- package/dist/src/graphql/product/queries.js +2 -0
- package/dist/src/lib/SDK.d.ts +1 -0
- package/dist/src/lib/SDK.js +35 -27
- package/dist/src/lib/auth/index.d.ts +2 -0
- package/dist/src/lib/auth/index.js +6 -0
- package/dist/src/lib/cloud/index.d.ts +1 -0
- package/dist/src/lib/cloud/index.js +3 -0
- package/dist/src/lib/computing/index.d.ts +1 -0
- package/dist/src/lib/computing/index.js +3 -0
- package/dist/src/lib/crm/index.d.ts +1 -0
- package/dist/src/lib/crm/index.js +3 -0
- package/dist/src/lib/crm_camping/index.d.ts +1 -0
- package/dist/src/lib/crm_camping/index.js +3 -0
- package/dist/src/lib/dns/index.d.ts +1 -0
- package/dist/src/lib/dns/index.js +3 -0
- package/dist/src/lib/order/index.d.ts +3 -2
- package/dist/src/lib/order/index.js +7 -4
- package/dist/src/lib/orderGraphQL/index.d.ts +1 -0
- package/dist/src/lib/orderGraphQL/index.js +3 -0
- package/dist/src/lib/payment/index.d.ts +2 -0
- package/dist/src/lib/payment/index.js +6 -0
- package/dist/src/lib/paymentLV/index.d.ts +3 -2
- package/dist/src/lib/paymentLV/index.js +7 -4
- package/dist/src/lib/product/index.d.ts +6 -3
- package/dist/src/lib/product/index.js +15 -12
- package/dist/src/lib/resource_permission/index.d.ts +1 -0
- package/dist/src/lib/resource_permission/index.js +3 -0
- package/dist/src/lib/service/index.d.ts +2 -0
- package/dist/src/lib/service/index.js +6 -0
- package/dist/src/lib/user/index.d.ts +2 -0
- package/dist/src/lib/user/index.js +6 -0
- package/dist/src/lib/warehouse/index.d.ts +1 -0
- package/dist/src/lib/warehouse/index.js +3 -0
- package/package.json +1 -1
package/dist/src/lib/SDK.d.ts
CHANGED
@@ -51,6 +51,7 @@ export declare class SDK {
|
|
51
51
|
paymentLV: PaymentLVService;
|
52
52
|
resource_permission: ResourcePermissionService;
|
53
53
|
token: string | null;
|
54
|
+
private endpoints;
|
54
55
|
constructor(orgId: string, storeId: string, storefrontAccessToken: string, environment: string);
|
55
56
|
setToken(token: string): void;
|
56
57
|
setStoreId(storeId: string): void;
|
package/dist/src/lib/SDK.js
CHANGED
@@ -28,25 +28,26 @@ class SDK {
|
|
28
28
|
this.token = null;
|
29
29
|
console.log("๐ ~ SDK ~ storeId:", storeId);
|
30
30
|
(0, helpers_1.validateStorefrontAccessToken)(storefrontAccessToken);
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
this.endpoints =
|
32
|
+
environment == "live"
|
33
|
+
? config_1.environmentEndpoints.live
|
34
|
+
: config_1.environmentEndpoints.dev;
|
34
35
|
//console.log("๐ ~ SDK ~ endpoints:", endpoints.computing);
|
35
|
-
this.product = new index_1.ProductService(endpoints.product, orgId, storeId);
|
36
|
-
this.auth = new index_2.AuthService(endpoints.auth, orgId, storeId);
|
37
|
-
this.order = new index_3.OrderService(endpoints.order, orgId, storeId);
|
38
|
-
this.user = new index_5.UserService(endpoints.user, orgId, storeId);
|
39
|
-
this.payment = new index_6.PaymentService(endpoints.payment, orgId, storeId);
|
40
|
-
this.crm = new index_7.CrmService(endpoints.crm, orgId, storeId);
|
41
|
-
this.service = new index_4.ServiceManagementService(endpoints.service, orgId, storeId);
|
42
|
-
this.warehouse = new index_8.WarehouseService(endpoints.warehouse, orgId, storeId);
|
43
|
-
this.computing = new index_9.ComputingService(endpoints.computing, orgId, storeId);
|
44
|
-
this.cloud = new cloud_1.CloudService(endpoints.cloud, orgId, storeId);
|
45
|
-
this.dns = new index_10.DnsService(endpoints.dns, orgId, storeId);
|
46
|
-
this.crm_camping = new crm_camping_1.CrmCampingService(endpoints.crm_camping, orgId, storeId);
|
47
|
-
this.order_graphQL = new orderGraphQL_1.OrderGraphQLService(endpoints.order_graphQL, orgId, storeId);
|
48
|
-
this.paymentLV = new paymentLV_1.PaymentLVService(endpoints.paymentLV, orgId, storeId);
|
49
|
-
this.resource_permission = new resource_permission_1.ResourcePermissionService(endpoints.resource_permission, orgId, storeId);
|
36
|
+
this.product = new index_1.ProductService(this.endpoints.product, orgId, storeId);
|
37
|
+
this.auth = new index_2.AuthService(this.endpoints.auth, orgId, storeId);
|
38
|
+
this.order = new index_3.OrderService(this.endpoints.order, orgId, storeId);
|
39
|
+
this.user = new index_5.UserService(this.endpoints.user, orgId, storeId);
|
40
|
+
this.payment = new index_6.PaymentService(this.endpoints.payment, orgId, storeId);
|
41
|
+
this.crm = new index_7.CrmService(this.endpoints.crm, orgId, storeId);
|
42
|
+
this.service = new index_4.ServiceManagementService(this.endpoints.service, orgId, storeId);
|
43
|
+
this.warehouse = new index_8.WarehouseService(this.endpoints.warehouse, orgId, storeId);
|
44
|
+
this.computing = new index_9.ComputingService(this.endpoints.computing, orgId, storeId);
|
45
|
+
this.cloud = new cloud_1.CloudService(this.endpoints.cloud, orgId, storeId);
|
46
|
+
this.dns = new index_10.DnsService(this.endpoints.dns, orgId, storeId);
|
47
|
+
this.crm_camping = new crm_camping_1.CrmCampingService(this.endpoints.crm_camping, orgId, storeId);
|
48
|
+
this.order_graphQL = new orderGraphQL_1.OrderGraphQLService(this.endpoints.order_graphQL, orgId, storeId);
|
49
|
+
this.paymentLV = new paymentLV_1.PaymentLVService(this.endpoints.paymentLV, orgId, storeId);
|
50
|
+
this.resource_permission = new resource_permission_1.ResourcePermissionService(this.endpoints.resource_permission, orgId, storeId);
|
50
51
|
// Initialize other services here
|
51
52
|
}
|
52
53
|
setToken(token) {
|
@@ -72,16 +73,23 @@ class SDK {
|
|
72
73
|
// cรกc module export tแปซ serviceSDK.ts set storeId vร o serviceSDK.ts
|
73
74
|
// src/service.ts
|
74
75
|
setStoreId(storeId) {
|
76
|
+
console.log("๐ ~ SDK: Updating storeId to:", storeId);
|
75
77
|
this.storeId = storeId;
|
76
|
-
this.product.
|
77
|
-
this.auth.
|
78
|
-
this.order.
|
79
|
-
this.user.
|
80
|
-
this.payment.
|
81
|
-
this.crm.
|
82
|
-
this.service.
|
83
|
-
this.warehouse.
|
84
|
-
|
78
|
+
this.product = new index_1.ProductService(this.endpoints.product, this.orgId, storeId);
|
79
|
+
this.auth = new index_2.AuthService(this.endpoints.auth, this.orgId, storeId);
|
80
|
+
this.order = new index_3.OrderService(this.endpoints.order, this.orgId, storeId);
|
81
|
+
this.user = new index_5.UserService(this.endpoints.user, this.orgId, storeId);
|
82
|
+
this.payment = new index_6.PaymentService(this.endpoints.payment, this.orgId, storeId);
|
83
|
+
this.crm = new index_7.CrmService(this.endpoints.crm, this.orgId, storeId);
|
84
|
+
this.service = new index_4.ServiceManagementService(this.endpoints.service, this.orgId, storeId);
|
85
|
+
this.warehouse = new index_8.WarehouseService(this.endpoints.warehouse, this.orgId, storeId);
|
86
|
+
this.computing = new index_9.ComputingService(this.endpoints.computing, this.orgId, storeId);
|
87
|
+
this.cloud = new cloud_1.CloudService(this.endpoints.cloud, this.orgId, storeId);
|
88
|
+
this.dns = new index_10.DnsService(this.endpoints.dns, this.orgId, storeId);
|
89
|
+
this.crm_camping = new crm_camping_1.CrmCampingService(this.endpoints.crm_camping, this.orgId, storeId);
|
90
|
+
this.order_graphQL = new orderGraphQL_1.OrderGraphQLService(this.endpoints.order_graphQL, this.orgId, storeId);
|
91
|
+
this.paymentLV = new paymentLV_1.PaymentLVService(this.endpoints.paymentLV, this.orgId, storeId);
|
92
|
+
this.resource_permission = new resource_permission_1.ResourcePermissionService(this.endpoints.resource_permission, this.orgId, storeId);
|
85
93
|
}
|
86
94
|
}
|
87
95
|
exports.SDK = SDK;
|
@@ -11,6 +11,8 @@ export declare class AuthService extends Service {
|
|
11
11
|
* @param storeId - The store ID.
|
12
12
|
*/
|
13
13
|
constructor(endpoint: string, orgId: string, storeId: string);
|
14
|
+
setToken(token: string): void;
|
15
|
+
setStoreId(storeId: string): void;
|
14
16
|
/**
|
15
17
|
* Logs in a user with the provided login request.
|
16
18
|
* @param loginRequest - The login request object.
|
@@ -26,6 +26,12 @@ class AuthService extends serviceSDK_1.Service {
|
|
26
26
|
constructor(endpoint, orgId, storeId) {
|
27
27
|
super(endpoint, orgId, storeId);
|
28
28
|
}
|
29
|
+
setToken(token) {
|
30
|
+
this.token = token;
|
31
|
+
}
|
32
|
+
setStoreId(storeId) {
|
33
|
+
this.storeId = storeId;
|
34
|
+
}
|
29
35
|
/**
|
30
36
|
* Logs in a user with the provided login request.
|
31
37
|
* @param loginRequest - The login request object.
|
@@ -9,6 +9,7 @@ export declare class CloudService extends Service {
|
|
9
9
|
*/
|
10
10
|
constructor(endpoint: string, orgId: string, storeId: string);
|
11
11
|
setToken(token: string): void;
|
12
|
+
setStoreId(storeId: string): void;
|
12
13
|
serviceDetail(serviceId: string): Promise<any>;
|
13
14
|
getMailResource(serviceId: string): Promise<any>;
|
14
15
|
changeServiceName(serviceId: string, updateBy: string, updateData: string): Promise<any>;
|
@@ -26,6 +26,9 @@ class CloudService extends serviceSDK_1.Service {
|
|
26
26
|
setToken(token) {
|
27
27
|
this.token = token;
|
28
28
|
}
|
29
|
+
setStoreId(storeId) {
|
30
|
+
this.storeId = storeId;
|
31
|
+
}
|
29
32
|
serviceDetail(serviceId) {
|
30
33
|
return __awaiter(this, void 0, void 0, function* () {
|
31
34
|
const query = queries_1.SERVICE_DETAIL;
|
@@ -9,6 +9,7 @@ export declare class ComputingService extends Service {
|
|
9
9
|
*/
|
10
10
|
constructor(endpoint: string, orgId: string, storeId: string);
|
11
11
|
setToken(token: string): void;
|
12
|
+
setStoreId(storeId: string): void;
|
12
13
|
computingDetail(computingId: string): Promise<any>;
|
13
14
|
portNats(computingId: string): Promise<any>;
|
14
15
|
restartVM(computingId: string, actor: string): Promise<any>;
|
@@ -26,6 +26,9 @@ class ComputingService extends serviceSDK_1.Service {
|
|
26
26
|
setToken(token) {
|
27
27
|
this.token = token;
|
28
28
|
}
|
29
|
+
setStoreId(storeId) {
|
30
|
+
this.storeId = storeId;
|
31
|
+
}
|
29
32
|
computingDetail(computingId) {
|
30
33
|
return __awaiter(this, void 0, void 0, function* () {
|
31
34
|
const query = queries_1.COMPUTING_DETAIL;
|
@@ -3,6 +3,7 @@ import { Service } from "../serviceSDK";
|
|
3
3
|
export declare class CrmService extends Service {
|
4
4
|
constructor(endpoint: string, orgId: string, storeId: string);
|
5
5
|
setToken(token: string): void;
|
6
|
+
setStoreId(storeId: string): void;
|
6
7
|
addOpportunity(addOpportunityRequest: AddOpportunityRequest, performerId: string): Promise<any>;
|
7
8
|
getListOpportunity(performerId: string, getOpportunityRequest: GetOpportunityRequest): Promise<any>;
|
8
9
|
getListTodo(workEffortId: string[]): Promise<any>;
|
@@ -20,6 +20,9 @@ class CrmService extends serviceSDK_1.Service {
|
|
20
20
|
setToken(token) {
|
21
21
|
this.token = token;
|
22
22
|
}
|
23
|
+
setStoreId(storeId) {
|
24
|
+
this.storeId = storeId;
|
25
|
+
}
|
23
26
|
addOpportunity(addOpportunityRequest, performerId) {
|
24
27
|
return __awaiter(this, void 0, void 0, function* () {
|
25
28
|
const mutation = mutations_1.ADD_OPPORTUNITY_MUTATION;
|
@@ -2,5 +2,6 @@ import { Service } from "../serviceSDK";
|
|
2
2
|
export declare class CrmCampingService extends Service {
|
3
3
|
constructor(endpoint: string, orgId: string, storeId: string);
|
4
4
|
setToken(token: string): void;
|
5
|
+
setStoreId(storeId: string): void;
|
5
6
|
searchProductQuantityPromotionAction(productId: string): Promise<any>;
|
6
7
|
}
|
@@ -19,6 +19,9 @@ class CrmCampingService extends serviceSDK_1.Service {
|
|
19
19
|
setToken(token) {
|
20
20
|
this.token = token;
|
21
21
|
}
|
22
|
+
setStoreId(storeId) {
|
23
|
+
this.storeId = storeId;
|
24
|
+
}
|
22
25
|
searchProductQuantityPromotionAction(productId) {
|
23
26
|
return __awaiter(this, void 0, void 0, function* () {
|
24
27
|
const query = queries_1.SEARCH_PRODUCT_QUANTITY_PROMOTION_ACTION;
|
@@ -18,6 +18,9 @@ class DnsService extends serviceSDK_1.Service {
|
|
18
18
|
setToken(token) {
|
19
19
|
this.token = token;
|
20
20
|
}
|
21
|
+
setStoreId(storeId) {
|
22
|
+
this.storeId = storeId;
|
23
|
+
}
|
21
24
|
getDomain(params) {
|
22
25
|
return __awaiter(this, void 0, void 0, function* () {
|
23
26
|
console.log("๐ ~ DnsService ~ getDomain ~ params:", params);
|
@@ -12,6 +12,7 @@ export declare class OrderService extends Service {
|
|
12
12
|
*/
|
13
13
|
constructor(endpoint: string, orgId: string, storeId: string);
|
14
14
|
setToken(token: string): void;
|
15
|
+
setStoreId(storeId: string): void;
|
15
16
|
/**
|
16
17
|
* Creates a new order.
|
17
18
|
* @param orderData - The data for the order.
|
@@ -458,7 +459,7 @@ export declare class OrderService extends Service {
|
|
458
459
|
* @returns A prom that resolves when the customer and shipping address are updated.
|
459
460
|
* @throws If an error occurs while updating the customer and shipping address.
|
460
461
|
*/
|
461
|
-
deleteProductInOrderWithoutLogin(orderId: string, orderItemId: string, reason: string, updated_by: string): Promise<any>;
|
462
|
+
deleteProductInOrderWithoutLogin(orderId: string, orderItemId: string, reason: string, updated_by: string, store: string): Promise<any>;
|
462
463
|
/**
|
463
464
|
* get list order realation
|
464
465
|
* @param orderId - The id of order
|
@@ -466,5 +467,5 @@ export declare class OrderService extends Service {
|
|
466
467
|
* @returns A prom that resolves when the customer and shipping address are updated.
|
467
468
|
* @throws If an error occurs while updating the customer and shipping address.
|
468
469
|
*/
|
469
|
-
addProductInOrderWithoutLogin(orderId: string, updated_by: string, data: any): Promise<any>;
|
470
|
+
addProductInOrderWithoutLogin(orderId: string, updated_by: string, data: any, store: string): Promise<any>;
|
470
471
|
}
|
@@ -27,6 +27,9 @@ class OrderService extends serviceSDK_1.Service {
|
|
27
27
|
setToken(token) {
|
28
28
|
this.token = token;
|
29
29
|
}
|
30
|
+
setStoreId(storeId) {
|
31
|
+
this.storeId = storeId;
|
32
|
+
}
|
30
33
|
/**
|
31
34
|
* Creates a new order.
|
32
35
|
* @param orderData - The data for the order.
|
@@ -1209,9 +1212,9 @@ class OrderService extends serviceSDK_1.Service {
|
|
1209
1212
|
* @returns A prom that resolves when the customer and shipping address are updated.
|
1210
1213
|
* @throws If an error occurs while updating the customer and shipping address.
|
1211
1214
|
*/
|
1212
|
-
deleteProductInOrderWithoutLogin(orderId, orderItemId, reason, updated_by) {
|
1215
|
+
deleteProductInOrderWithoutLogin(orderId, orderItemId, reason, updated_by, store) {
|
1213
1216
|
return __awaiter(this, void 0, void 0, function* () {
|
1214
|
-
const endpoint = `/front/orders/${this.orgId}/${this.storeId}/${orderId}/${orderItemId}/remove?updated_by=${updated_by}&reason=${reason}`;
|
1217
|
+
const endpoint = `/front/orders/${this.orgId}/${store ? store : this.storeId}/${orderId}/${orderItemId}/remove?updated_by=${updated_by}&reason=${reason}`;
|
1215
1218
|
const method = "DELETE";
|
1216
1219
|
try {
|
1217
1220
|
const response = yield this.restApiCallWithToken(endpoint, method);
|
@@ -1230,9 +1233,9 @@ class OrderService extends serviceSDK_1.Service {
|
|
1230
1233
|
* @returns A prom that resolves when the customer and shipping address are updated.
|
1231
1234
|
* @throws If an error occurs while updating the customer and shipping address.
|
1232
1235
|
*/
|
1233
|
-
addProductInOrderWithoutLogin(orderId, updated_by, data) {
|
1236
|
+
addProductInOrderWithoutLogin(orderId, updated_by, data, store) {
|
1234
1237
|
return __awaiter(this, void 0, void 0, function* () {
|
1235
|
-
const endpoint = `/front/orders/${this.orgId}/${this.storeId}/${orderId}/orderLineItem?updated_by=${updated_by}`;
|
1238
|
+
const endpoint = `/front/orders/${this.orgId}/${store ? store : this.storeId}/${orderId}/orderLineItem?updated_by=${updated_by}`;
|
1236
1239
|
const method = "POST";
|
1237
1240
|
try {
|
1238
1241
|
const response = yield this.restApiCallWithToken(endpoint, method, data);
|
@@ -2,6 +2,7 @@ import { Service } from "../serviceSDK";
|
|
2
2
|
export declare class OrderGraphQLService extends Service {
|
3
3
|
constructor(endpoint: string, orgId: string, storeId: string);
|
4
4
|
setToken(token: string): void;
|
5
|
+
setStoreId(storeId: string): void;
|
5
6
|
createOrder(input: any): Promise<any>;
|
6
7
|
getOrderDetail(orderId: string): Promise<any>;
|
7
8
|
updateQuantityV2(payload: any): Promise<any>;
|
@@ -20,6 +20,9 @@ class OrderGraphQLService extends serviceSDK_1.Service {
|
|
20
20
|
setToken(token) {
|
21
21
|
this.token = token;
|
22
22
|
}
|
23
|
+
setStoreId(storeId) {
|
24
|
+
this.storeId = storeId;
|
25
|
+
}
|
23
26
|
createOrder(input) {
|
24
27
|
return __awaiter(this, void 0, void 0, function* () {
|
25
28
|
const mutation = mutations_1.CREATE_ORDER;
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import { Service } from "../serviceSDK";
|
2
2
|
export declare class PaymentService extends Service {
|
3
3
|
constructor(endpoint: string, orgId: string, storeId: string);
|
4
|
+
setToken(token: string): void;
|
5
|
+
setStoreId(storeId: string): void;
|
4
6
|
getPaymentMethod(): Promise<any>;
|
5
7
|
createPaymentOrder(paymentOrderData: any): Promise<any>;
|
6
8
|
genQRPayment(orderId: any, totalAmount: any): Promise<any>;
|
@@ -17,6 +17,12 @@ class PaymentService extends serviceSDK_1.Service {
|
|
17
17
|
constructor(endpoint, orgId, storeId) {
|
18
18
|
super(endpoint, orgId, storeId);
|
19
19
|
}
|
20
|
+
setToken(token) {
|
21
|
+
this.token = token;
|
22
|
+
}
|
23
|
+
setStoreId(storeId) {
|
24
|
+
this.storeId = storeId;
|
25
|
+
}
|
20
26
|
getPaymentMethod() {
|
21
27
|
return __awaiter(this, void 0, void 0, function* () {
|
22
28
|
const query = queries_1.GET_PAYMENT_METHOD;
|
@@ -2,9 +2,10 @@ import { Service } from "../serviceSDK";
|
|
2
2
|
export declare class PaymentLVService extends Service {
|
3
3
|
constructor(endpoint: string, orgId: string, storeId: string);
|
4
4
|
setToken(token: string): void;
|
5
|
+
setStoreId(storeId: string): void;
|
5
6
|
paymentsByOrders(orderIds: [string]): Promise<any>;
|
6
|
-
getTransferInfo(paymentId: string): Promise<any>;
|
7
|
+
getTransferInfo(paymentId: string, store: string): Promise<any>;
|
7
8
|
cancelPayment(paymentId: string, reason: string, createBy: string): Promise<any>;
|
8
9
|
confirmPaidManual(paymentId: string, confirmBy: string): Promise<any>;
|
9
|
-
getPaymentMethodTypes(): Promise<any>;
|
10
|
+
getPaymentMethodTypes(store: string): Promise<any>;
|
10
11
|
}
|
@@ -20,6 +20,9 @@ class PaymentLVService extends serviceSDK_1.Service {
|
|
20
20
|
setToken(token) {
|
21
21
|
this.token = token;
|
22
22
|
}
|
23
|
+
setStoreId(storeId) {
|
24
|
+
this.storeId = storeId;
|
25
|
+
}
|
23
26
|
paymentsByOrders(orderIds) {
|
24
27
|
return __awaiter(this, void 0, void 0, function* () {
|
25
28
|
const query = queries_1.PAYMENTS_BY_ORDERS;
|
@@ -39,12 +42,12 @@ class PaymentLVService extends serviceSDK_1.Service {
|
|
39
42
|
}
|
40
43
|
});
|
41
44
|
}
|
42
|
-
getTransferInfo(paymentId) {
|
45
|
+
getTransferInfo(paymentId, store) {
|
43
46
|
return __awaiter(this, void 0, void 0, function* () {
|
44
47
|
const query = queries_1.GET_TRANSFER_INFO;
|
45
48
|
const variables = {
|
46
49
|
partnerId: this.orgId,
|
47
|
-
storeId: this.storeId,
|
50
|
+
storeId: store ? store : this.storeId,
|
48
51
|
paymentId,
|
49
52
|
};
|
50
53
|
try {
|
@@ -92,12 +95,12 @@ class PaymentLVService extends serviceSDK_1.Service {
|
|
92
95
|
}
|
93
96
|
});
|
94
97
|
}
|
95
|
-
getPaymentMethodTypes() {
|
98
|
+
getPaymentMethodTypes(store) {
|
96
99
|
return __awaiter(this, void 0, void 0, function* () {
|
97
100
|
const query = queries_1.GET_PAYMENT_METHOD_TYPES;
|
98
101
|
const variables = {
|
99
102
|
partnerId: this.orgId,
|
100
|
-
storeId: this.storeId,
|
103
|
+
storeId: store ? store : this.storeId,
|
101
104
|
};
|
102
105
|
try {
|
103
106
|
const response = yield this.graphqlQueryCustomHeader(query, variables);
|
@@ -10,21 +10,24 @@ export declare class ProductService extends Service {
|
|
10
10
|
* @param orgId - The organization ID.
|
11
11
|
* @param storeId - The store ID.
|
12
12
|
*/
|
13
|
+
protected dataStoreId: string;
|
13
14
|
constructor(endpoint: string, orgId: string, storeId: string);
|
15
|
+
setToken(token: string): void;
|
16
|
+
setStoreId(storeId: string): void;
|
14
17
|
/**
|
15
18
|
* Retrieves a product by its ID.
|
16
19
|
* @param productId - The ID of the product.
|
17
20
|
* @returns A promise that resolves to the product.
|
18
21
|
* @throws If an error occurs while fetching the product.
|
19
22
|
*/
|
20
|
-
getProductById(productId: string): Promise<any>;
|
23
|
+
getProductById(productId: string, store: string): Promise<any>;
|
21
24
|
/**
|
22
25
|
* Retrieves a product by its slug.
|
23
26
|
* @param slug - The slug of the product.
|
24
27
|
* @returns A promise that resolves to the product.
|
25
28
|
* @throws If an error occurs while fetching the product.
|
26
29
|
*/
|
27
|
-
getProductBySlug(slug: string): Promise<Product>;
|
30
|
+
getProductBySlug(slug: string, store: string): Promise<Product>;
|
28
31
|
/**
|
29
32
|
* Retrieves simple products based on the provided variables.
|
30
33
|
* @param variables - The variables for the query.
|
@@ -32,7 +35,7 @@ export declare class ProductService extends Service {
|
|
32
35
|
* @throws If an error occurs while fetching the simple products.
|
33
36
|
*/
|
34
37
|
getSimpleProducts(variables: any): Promise<Product[] | null>;
|
35
|
-
getProductOption(productId: string): Promise<any>;
|
38
|
+
getProductOption(productId: string, store: string): Promise<any>;
|
36
39
|
getPolicy(groupId: string): Promise<any>;
|
37
40
|
getProducts(param: getProduct, store: string): Promise<any>;
|
38
41
|
getHandleByServiceTypes(serviceTypes: [string]): Promise<any>;
|
@@ -16,14 +16,16 @@ const queries_1 = require("../../graphql/product/queries");
|
|
16
16
|
* Service class for managing product-related operations.
|
17
17
|
*/
|
18
18
|
class ProductService extends serviceSDK_1.Service {
|
19
|
-
/**
|
20
|
-
* Constructs a new ProductService instance.
|
21
|
-
* @param endpoint - The endpoint URL for the service.
|
22
|
-
* @param orgId - The organization ID.
|
23
|
-
* @param storeId - The store ID.
|
24
|
-
*/
|
25
19
|
constructor(endpoint, orgId, storeId) {
|
26
20
|
super(endpoint, orgId, storeId);
|
21
|
+
this.dataStoreId = storeId;
|
22
|
+
console.log("๐ ~ ProductService ~ constructor ~ storeId:", this.dataStoreId);
|
23
|
+
}
|
24
|
+
setToken(token) {
|
25
|
+
this.token = token;
|
26
|
+
}
|
27
|
+
setStoreId(storeId) {
|
28
|
+
this.storeId = storeId;
|
27
29
|
}
|
28
30
|
// ...
|
29
31
|
/**
|
@@ -32,12 +34,12 @@ class ProductService extends serviceSDK_1.Service {
|
|
32
34
|
* @returns A promise that resolves to the product.
|
33
35
|
* @throws If an error occurs while fetching the product.
|
34
36
|
*/
|
35
|
-
getProductById(productId) {
|
37
|
+
getProductById(productId, store) {
|
36
38
|
return __awaiter(this, void 0, void 0, function* () {
|
37
39
|
const query = queries_1.GET_PRODUCT_BY_ID_QUERY;
|
38
40
|
const variables = {
|
39
41
|
partnerId: this.orgId,
|
40
|
-
storeChannel: this.storeId,
|
42
|
+
storeChannel: store ? store : this.storeId,
|
41
43
|
productId,
|
42
44
|
};
|
43
45
|
try {
|
@@ -56,14 +58,15 @@ class ProductService extends serviceSDK_1.Service {
|
|
56
58
|
* @returns A promise that resolves to the product.
|
57
59
|
* @throws If an error occurs while fetching the product.
|
58
60
|
*/
|
59
|
-
getProductBySlug(slug) {
|
61
|
+
getProductBySlug(slug, store) {
|
60
62
|
return __awaiter(this, void 0, void 0, function* () {
|
61
63
|
const query = queries_1.GET_PRODUCT_BY_SLUG_QUERY;
|
62
64
|
const variables = {
|
63
65
|
partnerId: this.orgId,
|
64
|
-
storeChannel: this.storeId,
|
66
|
+
storeChannel: store ? store : this.storeId,
|
65
67
|
handle: slug,
|
66
68
|
};
|
69
|
+
//console.log("๐ ~ ProductService ~ getProductBySlug ~ variables:", variables.storeChannel)
|
67
70
|
try {
|
68
71
|
const response = yield this.graphqlQuery(query, variables);
|
69
72
|
return response.getProductByHandle;
|
@@ -94,12 +97,12 @@ class ProductService extends serviceSDK_1.Service {
|
|
94
97
|
}
|
95
98
|
});
|
96
99
|
}
|
97
|
-
getProductOption(productId) {
|
100
|
+
getProductOption(productId, store) {
|
98
101
|
return __awaiter(this, void 0, void 0, function* () {
|
99
102
|
const query = queries_1.GET_PRODUCT_OPTION;
|
100
103
|
const variablesHandle = {
|
101
104
|
partnerId: this.orgId,
|
102
|
-
storeChannel: this.storeId,
|
105
|
+
storeChannel: store ? store : this.storeId,
|
103
106
|
productId,
|
104
107
|
};
|
105
108
|
try {
|
@@ -2,6 +2,7 @@ import { Service } from "../serviceSDK";
|
|
2
2
|
export declare class ResourcePermissionService extends Service {
|
3
3
|
constructor(endpoint: string, orgId: string, storeId: string);
|
4
4
|
setToken(token: string): void;
|
5
|
+
setStoreId(storeId: string): void;
|
5
6
|
shareResource(createModel: any): Promise<any>;
|
6
7
|
removeShareParty(resourceId: string, sharePartyId: string): Promise<any>;
|
7
8
|
}
|
@@ -19,6 +19,9 @@ class ResourcePermissionService extends serviceSDK_1.Service {
|
|
19
19
|
setToken(token) {
|
20
20
|
this.token = token;
|
21
21
|
}
|
22
|
+
setStoreId(storeId) {
|
23
|
+
this.storeId = storeId;
|
24
|
+
}
|
22
25
|
shareResource(createModel) {
|
23
26
|
return __awaiter(this, void 0, void 0, function* () {
|
24
27
|
const mutation = mutations_1.SHARE_RESOURCE;
|
@@ -8,6 +8,8 @@ export declare class ServiceManagementService extends Service {
|
|
8
8
|
* @param storeId - The store ID.
|
9
9
|
*/
|
10
10
|
constructor(endpoint: string, orgId: string, storeId: string);
|
11
|
+
setToken(token: string): void;
|
12
|
+
setStoreId(storeId: string): void;
|
11
13
|
/**
|
12
14
|
* get service by id .
|
13
15
|
* @param serviceId - The id of the service
|
@@ -23,6 +23,12 @@ class ServiceManagementService extends serviceSDK_1.Service {
|
|
23
23
|
constructor(endpoint, orgId, storeId) {
|
24
24
|
super(endpoint, orgId, storeId);
|
25
25
|
}
|
26
|
+
setToken(token) {
|
27
|
+
this.token = token;
|
28
|
+
}
|
29
|
+
setStoreId(storeId) {
|
30
|
+
this.storeId = storeId;
|
31
|
+
}
|
26
32
|
/**
|
27
33
|
* get service by id .
|
28
34
|
* @param serviceId - The id of the service
|
@@ -2,6 +2,8 @@ import { Service } from "../serviceSDK";
|
|
2
2
|
import { createCompanyRequest, createCustomerRequest, dataCustomerRequest, updateCustomerRequest, customerQuery, searchCustomersResponse, employeesQuery } from "../../types/user";
|
3
3
|
export declare class UserService extends Service {
|
4
4
|
constructor(endpoint: string, orgId: string, storeId: string);
|
5
|
+
setToken(token: string): void;
|
6
|
+
setStoreId(storeId: string): void;
|
5
7
|
getPersonByPartyIds(partyIds: string[]): Promise<any>;
|
6
8
|
createCompany(payload: createCompanyRequest, createdBy: string): Promise<any>;
|
7
9
|
updateCompanyInfo(id: string, fieldName: string, valueUpdate: string, updatedBy: string): Promise<any>;
|
@@ -17,6 +17,12 @@ class UserService extends serviceSDK_1.Service {
|
|
17
17
|
constructor(endpoint, orgId, storeId) {
|
18
18
|
super(endpoint, orgId, storeId);
|
19
19
|
}
|
20
|
+
setToken(token) {
|
21
|
+
this.token = token;
|
22
|
+
}
|
23
|
+
setStoreId(storeId) {
|
24
|
+
this.storeId = storeId;
|
25
|
+
}
|
20
26
|
getPersonByPartyIds(partyIds) {
|
21
27
|
return __awaiter(this, void 0, void 0, function* () {
|
22
28
|
const query = queries_1.GET_PERSON_BY_IDS_QUERY;
|
@@ -9,6 +9,7 @@ export declare class WarehouseService extends Service {
|
|
9
9
|
*/
|
10
10
|
constructor(endpoint: string, orgId: string, storeId: string);
|
11
11
|
setToken(token: string): void;
|
12
|
+
setStoreId(storeId: string): void;
|
12
13
|
/**
|
13
14
|
* get product inventory
|
14
15
|
* @param warehouseId - the id of the warehouse
|