@longvansoftware/service-js-client 1.4.3 → 1.4.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.
- package/dist/src/graphql/cloud/queries.d.ts +1 -0
- package/dist/src/graphql/cloud/queries.js +9 -1
- package/dist/src/graphql/computing/queries.js +15 -2
- package/dist/src/graphql/product/queries.js +2 -0
- package/dist/src/lib/SDK.d.ts +1 -0
- package/dist/src/lib/SDK.js +34 -34
- package/dist/src/lib/cloud/index.d.ts +1 -0
- package/dist/src/lib/cloud/index.js +16 -0
- package/dist/src/lib/computing/index.d.ts +2 -2
- package/dist/src/lib/computing/index.js +4 -2
- package/dist/src/lib/order/index.d.ts +2 -2
- package/dist/src/lib/order/index.js +4 -4
- package/dist/src/lib/paymentLV/index.d.ts +2 -2
- package/dist/src/lib/paymentLV/index.js +4 -4
- package/dist/src/lib/product/index.d.ts +4 -4
- package/dist/src/lib/product/index.js +9 -10
- package/package.json +1 -1
@@ -6,3 +6,4 @@ export declare const SEARCH_SERVICE: import("graphql").DocumentNode;
|
|
6
6
|
export declare const GET_PRODUCTS_OF_SERVICE: import("graphql").DocumentNode;
|
7
7
|
export declare const GET_IPS_OF_SERVICE: import("graphql").DocumentNode;
|
8
8
|
export declare const GET_SERVICES_BY_ORDER_ID: import("graphql").DocumentNode;
|
9
|
+
export declare const CHECK_DOMAIN_NAME_AVAILABLE: import("graphql").DocumentNode;
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.GET_SERVICES_BY_ORDER_ID = exports.GET_IPS_OF_SERVICE = exports.GET_PRODUCTS_OF_SERVICE = exports.SEARCH_SERVICE = exports.SERVICE_TYPE = exports.GET_USER_MAIL_HOSTING = exports.GET_MAIL_RESOURCE = exports.SERVICE_DETAIL = void 0;
|
3
|
+
exports.CHECK_DOMAIN_NAME_AVAILABLE = exports.GET_SERVICES_BY_ORDER_ID = exports.GET_IPS_OF_SERVICE = exports.GET_PRODUCTS_OF_SERVICE = exports.SEARCH_SERVICE = exports.SERVICE_TYPE = exports.GET_USER_MAIL_HOSTING = exports.GET_MAIL_RESOURCE = exports.SERVICE_DETAIL = void 0;
|
4
4
|
const graphql_tag_1 = require("graphql-tag");
|
5
5
|
exports.SERVICE_DETAIL = (0, graphql_tag_1.gql) `
|
6
6
|
query ServiceDetail($serviceId: String) {
|
@@ -160,3 +160,11 @@ exports.GET_SERVICES_BY_ORDER_ID = (0, graphql_tag_1.gql) `
|
|
160
160
|
}
|
161
161
|
}
|
162
162
|
`;
|
163
|
+
exports.CHECK_DOMAIN_NAME_AVAILABLE = (0, graphql_tag_1.gql) `
|
164
|
+
query CheckDomainNameAvailable($domainName: String!) {
|
165
|
+
checkDomainNameAvailable(domainName: $domainName) {
|
166
|
+
domainName
|
167
|
+
isAvailable
|
168
|
+
}
|
169
|
+
}
|
170
|
+
`;
|
@@ -22,6 +22,7 @@ exports.COMPUTING_DETAIL = (0, graphql_tag_1.gql) `
|
|
22
22
|
protocolConnect
|
23
23
|
lastBackup
|
24
24
|
backupSequence
|
25
|
+
platform
|
25
26
|
}
|
26
27
|
}
|
27
28
|
`;
|
@@ -63,8 +64,16 @@ exports.RAM_USAGE_START_TIME = (0, graphql_tag_1.gql) `
|
|
63
64
|
}
|
64
65
|
`;
|
65
66
|
exports.CPU_USAGE_START_TIME = (0, graphql_tag_1.gql) `
|
66
|
-
query CpuUsageStartTime(
|
67
|
-
|
67
|
+
query CpuUsageStartTime(
|
68
|
+
$computingId: String!
|
69
|
+
$startTime: String!
|
70
|
+
$type: String
|
71
|
+
) {
|
72
|
+
cpuUsageStartTime(
|
73
|
+
computingId: $computingId
|
74
|
+
startTime: $startTime
|
75
|
+
type: $type
|
76
|
+
) {
|
68
77
|
time
|
69
78
|
value
|
70
79
|
}
|
@@ -123,9 +132,11 @@ exports.CPU_USAGE_DATE_RANGE = (0, graphql_tag_1.gql) `
|
|
123
132
|
$computingId: String!
|
124
133
|
$fromDate: DateCustom!
|
125
134
|
$toDate: DateCustom!
|
135
|
+
$type: String
|
126
136
|
) {
|
127
137
|
cpuUsageDateRange(
|
128
138
|
computingId: $computingId
|
139
|
+
type: $type
|
129
140
|
fromDate: $fromDate
|
130
141
|
toDate: $toDate
|
131
142
|
) {
|
@@ -207,6 +218,7 @@ exports.GET_COMPUTINGS = (0, graphql_tag_1.gql) `
|
|
207
218
|
serviceId
|
208
219
|
status
|
209
220
|
statusDetail
|
221
|
+
platform
|
210
222
|
}
|
211
223
|
}
|
212
224
|
`;
|
@@ -303,6 +315,7 @@ exports.GET_COMPUTING_BY_SERVICE = (0, graphql_tag_1.gql) `
|
|
303
315
|
serviceId
|
304
316
|
status
|
305
317
|
statusDetail
|
318
|
+
platform
|
306
319
|
}
|
307
320
|
}
|
308
321
|
`;
|
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) {
|
@@ -74,22 +75,21 @@ class SDK {
|
|
74
75
|
setStoreId(storeId) {
|
75
76
|
console.log("🚀 ~ SDK: Updating storeId to:", storeId);
|
76
77
|
this.storeId = storeId;
|
77
|
-
this.product.
|
78
|
-
this.auth.
|
79
|
-
this.order.
|
80
|
-
this.user.
|
81
|
-
this.payment.
|
82
|
-
this.crm.
|
83
|
-
this.service.
|
84
|
-
this.warehouse.
|
85
|
-
|
86
|
-
this.
|
87
|
-
this.
|
88
|
-
this.
|
89
|
-
this.
|
90
|
-
this.
|
91
|
-
this.
|
92
|
-
this.resource_permission.setStoreId(storeId);
|
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);
|
93
93
|
}
|
94
94
|
}
|
95
95
|
exports.SDK = SDK;
|
@@ -26,4 +26,5 @@ export declare class CloudService extends Service {
|
|
26
26
|
getProductsOfService(serviceId: string): Promise<any>;
|
27
27
|
getIpsOfService(serviceId: string): Promise<any>;
|
28
28
|
getServicesByOrderId(orderId: string): Promise<any>;
|
29
|
+
checkDomainNameAvailable(domainName: string): Promise<any>;
|
29
30
|
}
|
@@ -295,5 +295,21 @@ class CloudService extends serviceSDK_1.Service {
|
|
295
295
|
}
|
296
296
|
});
|
297
297
|
}
|
298
|
+
checkDomainNameAvailable(domainName) {
|
299
|
+
return __awaiter(this, void 0, void 0, function* () {
|
300
|
+
const query = queries_1.CHECK_DOMAIN_NAME_AVAILABLE;
|
301
|
+
const variables = {
|
302
|
+
domainName,
|
303
|
+
};
|
304
|
+
try {
|
305
|
+
const response = yield this.graphqlQueryV2(query, variables);
|
306
|
+
return response.checkDomainNameAvailable;
|
307
|
+
}
|
308
|
+
catch (error) {
|
309
|
+
console.log(`Error in checkDomainNameAvailable: ${error}`);
|
310
|
+
throw error;
|
311
|
+
}
|
312
|
+
});
|
313
|
+
}
|
298
314
|
}
|
299
315
|
exports.CloudService = CloudService;
|
@@ -24,9 +24,9 @@ export declare class ComputingService extends Service {
|
|
24
24
|
rollbackSnapshot(payload: RollBackSnapShot, createBy: string): Promise<any>;
|
25
25
|
deleteSnapshot(payload: RollBackSnapShot, updateBy: string): Promise<any>;
|
26
26
|
ramUsageStartTime(computingId: string, startTime: string): Promise<any>;
|
27
|
-
cpuUsageStartTime(computingId: string, startTime: string): Promise<any>;
|
27
|
+
cpuUsageStartTime(computingId: string, startTime: string, type: string): Promise<any>;
|
28
28
|
ramUsageDateRange(computingId: string, fromDate: any, toDate: any): Promise<any>;
|
29
|
-
cpuUsageDateRange(computingId: string, fromDate: any, toDate: any): Promise<any>;
|
29
|
+
cpuUsageDateRange(computingId: string, fromDate: any, toDate: any, type: string): Promise<any>;
|
30
30
|
backupPoint(computingId: string): Promise<any>;
|
31
31
|
networkUsageDateRange(computingId: string, type: string, fromDate: any, toDate: any): Promise<any>;
|
32
32
|
diskUsageDateRange(computingId: string, type: string, fromDate: any, toDate: any): Promise<any>;
|
@@ -270,12 +270,13 @@ class ComputingService extends serviceSDK_1.Service {
|
|
270
270
|
}
|
271
271
|
});
|
272
272
|
}
|
273
|
-
cpuUsageStartTime(computingId, startTime) {
|
273
|
+
cpuUsageStartTime(computingId, startTime, type) {
|
274
274
|
return __awaiter(this, void 0, void 0, function* () {
|
275
275
|
const query = queries_1.CPU_USAGE_START_TIME;
|
276
276
|
const variables = {
|
277
277
|
computingId,
|
278
278
|
startTime,
|
279
|
+
type,
|
279
280
|
};
|
280
281
|
try {
|
281
282
|
const response = yield this.graphqlQueryV2(query, variables);
|
@@ -305,13 +306,14 @@ class ComputingService extends serviceSDK_1.Service {
|
|
305
306
|
}
|
306
307
|
});
|
307
308
|
}
|
308
|
-
cpuUsageDateRange(computingId, fromDate, toDate) {
|
309
|
+
cpuUsageDateRange(computingId, fromDate, toDate, type) {
|
309
310
|
return __awaiter(this, void 0, void 0, function* () {
|
310
311
|
const query = queries_1.CPU_USAGE_DATE_RANGE;
|
311
312
|
const variables = {
|
312
313
|
computingId,
|
313
314
|
fromDate,
|
314
315
|
toDate,
|
316
|
+
type,
|
315
317
|
};
|
316
318
|
try {
|
317
319
|
const response = yield this.graphqlQueryV2(query, variables);
|
@@ -459,7 +459,7 @@ export declare class OrderService extends Service {
|
|
459
459
|
* @returns A prom that resolves when the customer and shipping address are updated.
|
460
460
|
* @throws If an error occurs while updating the customer and shipping address.
|
461
461
|
*/
|
462
|
-
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>;
|
463
463
|
/**
|
464
464
|
* get list order realation
|
465
465
|
* @param orderId - The id of order
|
@@ -467,5 +467,5 @@ export declare class OrderService extends Service {
|
|
467
467
|
* @returns A prom that resolves when the customer and shipping address are updated.
|
468
468
|
* @throws If an error occurs while updating the customer and shipping address.
|
469
469
|
*/
|
470
|
-
addProductInOrderWithoutLogin(orderId: string, updated_by: string, data: any): Promise<any>;
|
470
|
+
addProductInOrderWithoutLogin(orderId: string, updated_by: string, data: any, store: string): Promise<any>;
|
471
471
|
}
|
@@ -1212,9 +1212,9 @@ class OrderService extends serviceSDK_1.Service {
|
|
1212
1212
|
* @returns A prom that resolves when the customer and shipping address are updated.
|
1213
1213
|
* @throws If an error occurs while updating the customer and shipping address.
|
1214
1214
|
*/
|
1215
|
-
deleteProductInOrderWithoutLogin(orderId, orderItemId, reason, updated_by) {
|
1215
|
+
deleteProductInOrderWithoutLogin(orderId, orderItemId, reason, updated_by, store) {
|
1216
1216
|
return __awaiter(this, void 0, void 0, function* () {
|
1217
|
-
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}`;
|
1218
1218
|
const method = "DELETE";
|
1219
1219
|
try {
|
1220
1220
|
const response = yield this.restApiCallWithToken(endpoint, method);
|
@@ -1233,9 +1233,9 @@ class OrderService extends serviceSDK_1.Service {
|
|
1233
1233
|
* @returns A prom that resolves when the customer and shipping address are updated.
|
1234
1234
|
* @throws If an error occurs while updating the customer and shipping address.
|
1235
1235
|
*/
|
1236
|
-
addProductInOrderWithoutLogin(orderId, updated_by, data) {
|
1236
|
+
addProductInOrderWithoutLogin(orderId, updated_by, data, store) {
|
1237
1237
|
return __awaiter(this, void 0, void 0, function* () {
|
1238
|
-
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}`;
|
1239
1239
|
const method = "POST";
|
1240
1240
|
try {
|
1241
1241
|
const response = yield this.restApiCallWithToken(endpoint, method, data);
|
@@ -4,8 +4,8 @@ export declare class PaymentLVService extends Service {
|
|
4
4
|
setToken(token: string): void;
|
5
5
|
setStoreId(storeId: string): void;
|
6
6
|
paymentsByOrders(orderIds: [string]): Promise<any>;
|
7
|
-
getTransferInfo(paymentId: string): Promise<any>;
|
7
|
+
getTransferInfo(paymentId: string, store: string): Promise<any>;
|
8
8
|
cancelPayment(paymentId: string, reason: string, createBy: string): Promise<any>;
|
9
9
|
confirmPaidManual(paymentId: string, confirmBy: string): Promise<any>;
|
10
|
-
getPaymentMethodTypes(): Promise<any>;
|
10
|
+
getPaymentMethodTypes(store: string): Promise<any>;
|
11
11
|
}
|
@@ -42,12 +42,12 @@ class PaymentLVService extends serviceSDK_1.Service {
|
|
42
42
|
}
|
43
43
|
});
|
44
44
|
}
|
45
|
-
getTransferInfo(paymentId) {
|
45
|
+
getTransferInfo(paymentId, store) {
|
46
46
|
return __awaiter(this, void 0, void 0, function* () {
|
47
47
|
const query = queries_1.GET_TRANSFER_INFO;
|
48
48
|
const variables = {
|
49
49
|
partnerId: this.orgId,
|
50
|
-
storeId: this.storeId,
|
50
|
+
storeId: store ? store : this.storeId,
|
51
51
|
paymentId,
|
52
52
|
};
|
53
53
|
try {
|
@@ -95,12 +95,12 @@ class PaymentLVService extends serviceSDK_1.Service {
|
|
95
95
|
}
|
96
96
|
});
|
97
97
|
}
|
98
|
-
getPaymentMethodTypes() {
|
98
|
+
getPaymentMethodTypes(store) {
|
99
99
|
return __awaiter(this, void 0, void 0, function* () {
|
100
100
|
const query = queries_1.GET_PAYMENT_METHOD_TYPES;
|
101
101
|
const variables = {
|
102
102
|
partnerId: this.orgId,
|
103
|
-
storeId: this.storeId,
|
103
|
+
storeId: store ? store : this.storeId,
|
104
104
|
};
|
105
105
|
try {
|
106
106
|
const response = yield this.graphqlQueryCustomHeader(query, variables);
|
@@ -10,7 +10,7 @@ export declare class ProductService extends Service {
|
|
10
10
|
* @param orgId - The organization ID.
|
11
11
|
* @param storeId - The store ID.
|
12
12
|
*/
|
13
|
-
protected
|
13
|
+
protected dataStoreId: string;
|
14
14
|
constructor(endpoint: string, orgId: string, storeId: string);
|
15
15
|
setToken(token: string): void;
|
16
16
|
setStoreId(storeId: string): void;
|
@@ -20,14 +20,14 @@ export declare class ProductService extends Service {
|
|
20
20
|
* @returns A promise that resolves to the product.
|
21
21
|
* @throws If an error occurs while fetching the product.
|
22
22
|
*/
|
23
|
-
getProductById(productId: string): Promise<any>;
|
23
|
+
getProductById(productId: string, store: string): Promise<any>;
|
24
24
|
/**
|
25
25
|
* Retrieves a product by its slug.
|
26
26
|
* @param slug - The slug of the product.
|
27
27
|
* @returns A promise that resolves to the product.
|
28
28
|
* @throws If an error occurs while fetching the product.
|
29
29
|
*/
|
30
|
-
getProductBySlug(slug: string): Promise<Product>;
|
30
|
+
getProductBySlug(slug: string, store: string): Promise<Product>;
|
31
31
|
/**
|
32
32
|
* Retrieves simple products based on the provided variables.
|
33
33
|
* @param variables - The variables for the query.
|
@@ -35,7 +35,7 @@ export declare class ProductService extends Service {
|
|
35
35
|
* @throws If an error occurs while fetching the simple products.
|
36
36
|
*/
|
37
37
|
getSimpleProducts(variables: any): Promise<Product[] | null>;
|
38
|
-
getProductOption(productId: string): Promise<any>;
|
38
|
+
getProductOption(productId: string, store: string): Promise<any>;
|
39
39
|
getPolicy(groupId: string): Promise<any>;
|
40
40
|
getProducts(param: getProduct, store: string): Promise<any>;
|
41
41
|
getHandleByServiceTypes(serviceTypes: [string]): Promise<any>;
|
@@ -18,15 +18,14 @@ const queries_1 = require("../../graphql/product/queries");
|
|
18
18
|
class ProductService extends serviceSDK_1.Service {
|
19
19
|
constructor(endpoint, orgId, storeId) {
|
20
20
|
super(endpoint, orgId, storeId);
|
21
|
-
this.
|
22
|
-
console.log("🚀 ~
|
21
|
+
this.dataStoreId = storeId;
|
22
|
+
console.log("🚀 ~ ProductService ~ constructor ~ storeId:", this.dataStoreId);
|
23
23
|
}
|
24
24
|
setToken(token) {
|
25
25
|
this.token = token;
|
26
26
|
}
|
27
27
|
setStoreId(storeId) {
|
28
28
|
this.storeId = storeId;
|
29
|
-
console.log("🚀 ~ Updating storeId to:", storeId);
|
30
29
|
}
|
31
30
|
// ...
|
32
31
|
/**
|
@@ -35,12 +34,12 @@ class ProductService extends serviceSDK_1.Service {
|
|
35
34
|
* @returns A promise that resolves to the product.
|
36
35
|
* @throws If an error occurs while fetching the product.
|
37
36
|
*/
|
38
|
-
getProductById(productId) {
|
37
|
+
getProductById(productId, store) {
|
39
38
|
return __awaiter(this, void 0, void 0, function* () {
|
40
39
|
const query = queries_1.GET_PRODUCT_BY_ID_QUERY;
|
41
40
|
const variables = {
|
42
41
|
partnerId: this.orgId,
|
43
|
-
storeChannel: this.storeId,
|
42
|
+
storeChannel: store ? store : this.storeId,
|
44
43
|
productId,
|
45
44
|
};
|
46
45
|
try {
|
@@ -59,15 +58,15 @@ class ProductService extends serviceSDK_1.Service {
|
|
59
58
|
* @returns A promise that resolves to the product.
|
60
59
|
* @throws If an error occurs while fetching the product.
|
61
60
|
*/
|
62
|
-
getProductBySlug(slug) {
|
61
|
+
getProductBySlug(slug, store) {
|
63
62
|
return __awaiter(this, void 0, void 0, function* () {
|
64
63
|
const query = queries_1.GET_PRODUCT_BY_SLUG_QUERY;
|
65
64
|
const variables = {
|
66
65
|
partnerId: this.orgId,
|
67
|
-
storeChannel: this.storeId,
|
66
|
+
storeChannel: store ? store : this.storeId,
|
68
67
|
handle: slug,
|
69
68
|
};
|
70
|
-
console.log("🚀 ~ ProductService ~ getProductBySlug ~ variables
|
69
|
+
//console.log("🚀 ~ ProductService ~ getProductBySlug ~ variables:", variables.storeChannel)
|
71
70
|
try {
|
72
71
|
const response = yield this.graphqlQuery(query, variables);
|
73
72
|
return response.getProductByHandle;
|
@@ -98,12 +97,12 @@ class ProductService extends serviceSDK_1.Service {
|
|
98
97
|
}
|
99
98
|
});
|
100
99
|
}
|
101
|
-
getProductOption(productId) {
|
100
|
+
getProductOption(productId, store) {
|
102
101
|
return __awaiter(this, void 0, void 0, function* () {
|
103
102
|
const query = queries_1.GET_PRODUCT_OPTION;
|
104
103
|
const variablesHandle = {
|
105
104
|
partnerId: this.orgId,
|
106
|
-
storeChannel: this.storeId,
|
105
|
+
storeChannel: store ? store : this.storeId,
|
107
106
|
productId,
|
108
107
|
};
|
109
108
|
try {
|