@longvansoftware/service-js-client 1.4.3 → 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.
@@ -499,12 +499,14 @@ exports.GET_PRODUCT_OPTION = (0, graphql_tag_1.gql) `
499
499
  price
500
500
  productId
501
501
  productName
502
+ qualify
502
503
  }
503
504
  productOptionConfigs {
504
505
  id
505
506
  price
506
507
  productId
507
508
  productName
509
+ qualify
508
510
  }
509
511
  }
510
512
  createStamp
@@ -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;
@@ -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
- const endpoints = environment == "live"
32
- ? config_1.environmentEndpoints.live
33
- : config_1.environmentEndpoints.dev;
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.setStoreId(storeId);
78
- this.auth.setStoreId(storeId);
79
- this.order.setStoreId(storeId);
80
- this.user.setStoreId(storeId);
81
- this.payment.setStoreId(storeId);
82
- this.crm.setStoreId(storeId);
83
- this.service.setStoreId(storeId);
84
- this.warehouse.setStoreId(storeId);
85
- // Set storeId for other services here
86
- this.computing.setStoreId(storeId);
87
- this.cloud.setStoreId(storeId);
88
- this.dns.setStoreId(storeId);
89
- this.crm_camping.setStoreId(storeId);
90
- this.order_graphQL.setStoreId(storeId);
91
- this.paymentLV.setStoreId(storeId);
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;
@@ -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 storeId: string;
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.storeId = storeId;
22
- console.log("🚀 ~ Updating constructor storeId to:", storeId);
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.this.storeId:", variables.storeChannel);
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 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [