@longvansoftware/service-js-client 1.4.1 โ†’ 1.4.3

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.
@@ -26,7 +26,7 @@ class SDK {
26
26
  this.storefrontAccessToken = storefrontAccessToken;
27
27
  this.environment = environment;
28
28
  this.token = null;
29
- //console.log("๐Ÿš€ ~ SDK ~ environment:", environment);
29
+ console.log("๐Ÿš€ ~ SDK ~ storeId:", storeId);
30
30
  (0, helpers_1.validateStorefrontAccessToken)(storefrontAccessToken);
31
31
  const endpoints = environment == "live"
32
32
  ? config_1.environmentEndpoints.live
@@ -72,6 +72,7 @@ class SDK {
72
72
  // cรกc module export tแปซ serviceSDK.ts set storeId vร o serviceSDK.ts
73
73
  // src/service.ts
74
74
  setStoreId(storeId) {
75
+ console.log("๐Ÿš€ ~ SDK: Updating storeId to:", storeId);
75
76
  this.storeId = storeId;
76
77
  this.product.setStoreId(storeId);
77
78
  this.auth.setStoreId(storeId);
@@ -82,6 +83,13 @@ class SDK {
82
83
  this.service.setStoreId(storeId);
83
84
  this.warehouse.setStoreId(storeId);
84
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);
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;
@@ -2,5 +2,6 @@ import { Service } from "../serviceSDK";
2
2
  export declare class DnsService extends Service {
3
3
  constructor(endpoint: string, orgId: string, storeId: string);
4
4
  setToken(token: string): void;
5
+ setStoreId(storeId: string): void;
5
6
  getDomain(params: any): Promise<any>;
6
7
  }
@@ -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.
@@ -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.
@@ -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,6 +2,7 @@ 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
7
  getTransferInfo(paymentId: string): Promise<any>;
7
8
  cancelPayment(paymentId: string, reason: string, createBy: string): Promise<any>;
@@ -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;
@@ -10,7 +10,10 @@ 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
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.
@@ -34,7 +37,7 @@ export declare class ProductService extends Service {
34
37
  getSimpleProducts(variables: any): Promise<Product[] | null>;
35
38
  getProductOption(productId: string): Promise<any>;
36
39
  getPolicy(groupId: string): Promise<any>;
37
- getProducts(param: getProduct): Promise<any>;
40
+ getProducts(param: getProduct, store: string): Promise<any>;
38
41
  getHandleByServiceTypes(serviceTypes: [string]): Promise<any>;
39
42
  getResourceByProduct(productId: string): Promise<any>;
40
43
  getProductVariantById(variantId: string): Promise<any>;
@@ -16,14 +16,17 @@ 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.storeId = storeId;
22
+ console.log("๐Ÿš€ ~ Updating constructor storeId to:", storeId);
23
+ }
24
+ setToken(token) {
25
+ this.token = token;
26
+ }
27
+ setStoreId(storeId) {
28
+ this.storeId = storeId;
29
+ console.log("๐Ÿš€ ~ Updating storeId to:", storeId);
27
30
  }
28
31
  // ...
29
32
  /**
@@ -64,6 +67,7 @@ class ProductService extends serviceSDK_1.Service {
64
67
  storeChannel: this.storeId,
65
68
  handle: slug,
66
69
  };
70
+ console.log("๐Ÿš€ ~ ProductService ~ getProductBySlug ~ variables.this.storeId:", variables.storeChannel);
67
71
  try {
68
72
  const response = yield this.graphqlQuery(query, variables);
69
73
  return response.getProductByHandle;
@@ -128,10 +132,10 @@ class ProductService extends serviceSDK_1.Service {
128
132
  }
129
133
  });
130
134
  }
131
- getProducts(param) {
135
+ getProducts(param, store) {
132
136
  return __awaiter(this, void 0, void 0, function* () {
133
137
  const query = queries_1.GET_PRODUCTS;
134
- const variablesHandle = Object.assign({ partnerId: this.orgId, storeChannel: this.storeId }, param);
138
+ const variablesHandle = Object.assign({ partnerId: this.orgId, storeChannel: store ? store : this.storeId }, param);
135
139
  try {
136
140
  const response = yield this.graphqlQueryV2(query, variablesHandle);
137
141
  return response.getProducts;
@@ -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
@@ -24,6 +24,9 @@ class WarehouseService extends serviceSDK_1.Service {
24
24
  setToken(token) {
25
25
  this.token = token;
26
26
  }
27
+ setStoreId(storeId) {
28
+ this.storeId = storeId;
29
+ }
27
30
  /**
28
31
  * get product inventory
29
32
  * @param warehouseId - the id of the warehouse
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [