@longvansoftware/storefront-js-client 1.3.6 → 1.3.8

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 (43) hide show
  1. package/README.md +93 -93
  2. package/dist/config/config.d.ts +4 -0
  3. package/dist/config/config.js +4 -0
  4. package/dist/src/graphql/auth/mutations.js +88 -88
  5. package/dist/src/graphql/auth/queries.js +20 -20
  6. package/dist/src/graphql/crm/mutations.js +253 -248
  7. package/dist/src/graphql/crm/queries.js +148 -148
  8. package/dist/src/graphql/payment/mutations.js +30 -30
  9. package/dist/src/graphql/payment/queries.js +17 -17
  10. package/dist/src/graphql/product/queries.js +322 -322
  11. package/dist/src/graphql/service/mutations.d.ts +8 -0
  12. package/dist/src/graphql/service/mutations.js +203 -0
  13. package/dist/src/graphql/service/queries.d.ts +4 -0
  14. package/dist/src/graphql/service/queries.js +154 -0
  15. package/dist/src/graphql/user/mutations.js +110 -110
  16. package/dist/src/graphql/user/queries.js +60 -60
  17. package/dist/src/lib/SDK.d.ts +6 -0
  18. package/dist/src/lib/SDK.js +6 -0
  19. package/dist/src/lib/auth/index.d.ts +1 -1
  20. package/dist/src/lib/auth/index.js +2 -2
  21. package/dist/src/lib/crm/index.d.ts +1 -1
  22. package/dist/src/lib/crm/index.js +2 -2
  23. package/dist/src/lib/order/index.d.ts +1 -1
  24. package/dist/src/lib/order/index.js +19 -2
  25. package/dist/src/lib/payment/index.d.ts +1 -1
  26. package/dist/src/lib/payment/index.js +2 -2
  27. package/dist/src/lib/product/index.d.ts +1 -1
  28. package/dist/src/lib/product/index.js +2 -2
  29. package/dist/src/lib/service/index.d.ts +91 -0
  30. package/dist/src/lib/service/index.js +298 -0
  31. package/dist/src/lib/service.js +4 -4
  32. package/dist/src/lib/serviceSDK.d.ts +15 -0
  33. package/dist/src/lib/serviceSDK.js +117 -0
  34. package/dist/src/lib/user/index.d.ts +1 -1
  35. package/dist/src/lib/user/index.js +2 -2
  36. package/dist/src/lib/warehouse/index.d.ts +20 -0
  37. package/dist/src/lib/warehouse/index.js +48 -0
  38. package/dist/src/types/order.d.ts +2 -2
  39. package/dist/src/types/service.d.ts +28 -0
  40. package/dist/src/types/service.js +2 -0
  41. package/dist/src/types/warehouse.d.ts +5 -0
  42. package/dist/src/types/warehouse.js +2 -0
  43. package/package.json +42 -42
@@ -2,66 +2,66 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SEARCH_COMPANY = exports.GET_CUSTOMER_BY_ID = exports.GET_PERSON_BY_IDS_QUERY = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
- exports.GET_PERSON_BY_IDS_QUERY = (0, graphql_tag_1.gql) `
6
- query GetPersonByIds($partyIds: [String!]!) {
7
- getPersonByPartyIds(partyIds: $partyIds) {
8
- status
9
- partyId
10
- fullName
11
- phone
12
- address
13
- gender
14
- birthDate
15
- email
16
- personalTitle
17
- imageUrl
18
- identityNumber
19
- id
20
- addressModel {
21
- id
22
- addressInfo
23
- provinceGeoId
24
- districtGeoId
25
- wardGeoId
26
- provinceName
27
- districtName
28
- wardName
29
- isDefault
30
- }
31
- }
32
- }
5
+ exports.GET_PERSON_BY_IDS_QUERY = (0, graphql_tag_1.gql) `
6
+ query GetPersonByIds($partyIds: [String!]!) {
7
+ getPersonByPartyIds(partyIds: $partyIds) {
8
+ status
9
+ partyId
10
+ fullName
11
+ phone
12
+ address
13
+ gender
14
+ birthDate
15
+ email
16
+ personalTitle
17
+ imageUrl
18
+ identityNumber
19
+ id
20
+ addressModel {
21
+ id
22
+ addressInfo
23
+ provinceGeoId
24
+ districtGeoId
25
+ wardGeoId
26
+ provinceName
27
+ districtName
28
+ wardName
29
+ isDefault
30
+ }
31
+ }
32
+ }
33
33
  `;
34
- exports.GET_CUSTOMER_BY_ID = (0, graphql_tag_1.gql) `
35
- query GetCustomerById($id: String!){
36
- getCustomerById(id: $id) {
37
- id
38
- name
39
- address
40
- gender
41
- identityNumber
42
- birthDate
43
- email
44
- phone
45
- createdStamp
46
- createdBy
47
- memberLevel
48
- }
49
- }
34
+ exports.GET_CUSTOMER_BY_ID = (0, graphql_tag_1.gql) `
35
+ query GetCustomerById($id: String!){
36
+ getCustomerById(id: $id) {
37
+ id
38
+ name
39
+ address
40
+ gender
41
+ identityNumber
42
+ birthDate
43
+ email
44
+ phone
45
+ createdStamp
46
+ createdBy
47
+ memberLevel
48
+ }
49
+ }
50
50
  `;
51
- exports.SEARCH_COMPANY = (0, graphql_tag_1.gql) `
52
- query SearchCompany($keyword: String, $orgId: String!, $limit: Int){
53
- searchCompany(keyword: $keyword, orgId: $orgId, limit: $limit) {
54
- id
55
- name
56
- address
57
- gender
58
- identityNumber
59
- birthDate
60
- email
61
- phone
62
- createdStamp
63
- createdBy
64
- memberLevel
65
- }
66
- }
51
+ exports.SEARCH_COMPANY = (0, graphql_tag_1.gql) `
52
+ query SearchCompany($keyword: String, $orgId: String!, $limit: Int){
53
+ searchCompany(keyword: $keyword, orgId: $orgId, limit: $limit) {
54
+ id
55
+ name
56
+ address
57
+ gender
58
+ identityNumber
59
+ birthDate
60
+ email
61
+ phone
62
+ createdStamp
63
+ createdBy
64
+ memberLevel
65
+ }
66
+ }
67
67
  `;
@@ -1,9 +1,11 @@
1
1
  import { ProductService } from "../lib/product/index";
2
2
  import { AuthService } from "../lib/auth/index";
3
3
  import { OrderService } from "../lib/order/index";
4
+ import { ServiceManagementService } from "./service";
4
5
  import { UserService } from "../lib/user/index";
5
6
  import { PaymentService } from "../lib/payment/index";
6
7
  import { CrmService } from "../lib/crm/index";
8
+ import { WarehouseService } from "../lib/warehouse/index";
7
9
  export interface Endpoints {
8
10
  product: string;
9
11
  crm: string;
@@ -11,6 +13,8 @@ export interface Endpoints {
11
13
  order: string;
12
14
  user: string;
13
15
  payment: string;
16
+ service: string;
17
+ warehouse: string;
14
18
  }
15
19
  export declare class SDK {
16
20
  orgId: string;
@@ -22,6 +26,8 @@ export declare class SDK {
22
26
  user: UserService;
23
27
  payment: PaymentService;
24
28
  crm: CrmService;
29
+ service: ServiceManagementService;
30
+ warehouse: WarehouseService;
25
31
  token: string | null;
26
32
  constructor(orgId: string, storeId: string, storefrontAccessToken: string);
27
33
  setToken(token: string): void;
@@ -5,11 +5,13 @@ exports.SDK = void 0;
5
5
  const index_1 = require("../lib/product/index");
6
6
  const index_2 = require("../lib/auth/index");
7
7
  const index_3 = require("../lib/order/index");
8
+ const service_1 = require("./service");
8
9
  const index_4 = require("../lib/user/index");
9
10
  const config_1 = require("../../config/config");
10
11
  const helpers_1 = require("../utils/helpers");
11
12
  const index_5 = require("../lib/payment/index");
12
13
  const index_6 = require("../lib/crm/index");
14
+ const index_7 = require("../lib/warehouse/index");
13
15
  class SDK {
14
16
  constructor(orgId, storeId, storefrontAccessToken) {
15
17
  this.orgId = orgId;
@@ -26,6 +28,8 @@ class SDK {
26
28
  this.user = new index_4.UserService(endpoints.user, orgId, storeId);
27
29
  this.payment = new index_5.PaymentService(endpoints.payment, orgId, storeId);
28
30
  this.crm = new index_6.CrmService(endpoints.crm, orgId, storeId);
31
+ this.service = new service_1.ServiceManagementService(endpoints.service, orgId, storeId);
32
+ this.warehouse = new index_7.WarehouseService(endpoints.warehouse, orgId, storeId);
29
33
  // Initialize other services here
30
34
  }
31
35
  setToken(token) {
@@ -37,6 +41,8 @@ class SDK {
37
41
  this.user.setToken(token);
38
42
  this.payment.setToken(token);
39
43
  this.crm.setToken(token);
44
+ this.service.setToken(token);
45
+ this.warehouse.setToken(token);
40
46
  // Set token for other services here
41
47
  }
42
48
  }
@@ -1,4 +1,4 @@
1
- import { Service } from "../service";
1
+ import { Service } from "../serviceSDK";
2
2
  import { LoginRequest, LoginResponse, RegisterRequest } from "../../types/auth";
3
3
  /**
4
4
  * Represents the authentication service.
@@ -10,13 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.AuthService = void 0;
13
- const service_1 = require("../service");
13
+ const serviceSDK_1 = require("../serviceSDK");
14
14
  const mutations_1 = require("../../graphql/auth/mutations");
15
15
  const queries_1 = require("../../graphql/auth/queries");
16
16
  /**
17
17
  * Represents the authentication service.
18
18
  */
19
- class AuthService extends service_1.Service {
19
+ class AuthService extends serviceSDK_1.Service {
20
20
  /**
21
21
  * Constructs a new ProductService instance.
22
22
  * @param endpoint - The endpoint URL for the service.
@@ -1,5 +1,5 @@
1
1
  import { AddOpportunityRequest, GetOpportunityRequest } from '../../types/crm';
2
- import { Service } from '../service';
2
+ import { Service } from '../serviceSDK';
3
3
  export declare class CrmService extends Service {
4
4
  constructor(endpoint: string, orgId: string, storeId: string);
5
5
  addOpportunity(addOpportunityRequest: AddOpportunityRequest, performerId: string): Promise<any>;
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CrmService = void 0;
13
13
  const mutations_1 = require("../../graphql/crm/mutations");
14
14
  const queries_1 = require("../../graphql/crm/queries");
15
- const service_1 = require("../service");
16
- class CrmService extends service_1.Service {
15
+ const serviceSDK_1 = require("../serviceSDK");
16
+ class CrmService extends serviceSDK_1.Service {
17
17
  constructor(endpoint, orgId, storeId) {
18
18
  super(endpoint, orgId, storeId);
19
19
  }
@@ -1,5 +1,5 @@
1
1
  import { LineItem, DiscountCampaign, CancelOrder, MemberDiscount, CampaignPromotion, OrderQuery } from "../../types/order";
2
- import { Service } from "../service";
2
+ import { Service } from "../serviceSDK";
3
3
  /**
4
4
  * Represents a service for managing orders.
5
5
  */
@@ -10,11 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.OrderService = void 0;
13
- const service_1 = require("../service");
13
+ const serviceSDK_1 = require("../serviceSDK");
14
14
  /**
15
15
  * Represents a service for managing orders.
16
16
  */
17
- class OrderService extends service_1.Service {
17
+ class OrderService extends serviceSDK_1.Service {
18
18
  /**
19
19
  * Constructs a new OrderService instance.
20
20
  * @param endpoint - The endpoint URL for the service.
@@ -1163,3 +1163,20 @@ class OrderService extends service_1.Service {
1163
1163
  }
1164
1164
  }
1165
1165
  exports.OrderService = OrderService;
1166
+ const data = {
1167
+ orderType: "POS_SALE",
1168
+ customer_id: "20.51269",
1169
+ line_items: [
1170
+ {
1171
+ id: "121122",
1172
+ productName: "",
1173
+ quantity: 1,
1174
+ typeDiscount: "MONEY",
1175
+ parent_id: "121121",
1176
+ product_id: "121122",
1177
+ supplier_id: "",
1178
+ input_price: 220000,
1179
+ discount_amount: 0,
1180
+ },
1181
+ ],
1182
+ };
@@ -1,4 +1,4 @@
1
- import { Service } from "../service";
1
+ import { Service } from "../serviceSDK";
2
2
  export declare class PaymentService extends Service {
3
3
  constructor(endpoint: string, orgId: string, storeId: string);
4
4
  getPaymentMethod(): Promise<any>;
@@ -12,8 +12,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PaymentService = void 0;
13
13
  const mutations_1 = require("../../graphql/payment/mutations");
14
14
  const queries_1 = require("../../graphql/payment/queries");
15
- const service_1 = require("../service");
16
- class PaymentService extends service_1.Service {
15
+ const serviceSDK_1 = require("../serviceSDK");
16
+ class PaymentService extends serviceSDK_1.Service {
17
17
  constructor(endpoint, orgId, storeId) {
18
18
  super(endpoint, orgId, storeId);
19
19
  }
@@ -1,4 +1,4 @@
1
- import { Service } from "../service";
1
+ import { Service } from "../serviceSDK";
2
2
  import { Product } from "../../types/product";
3
3
  /**
4
4
  * Service class for managing product-related operations.
@@ -10,12 +10,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.ProductService = void 0;
13
- const service_1 = require("../service");
13
+ const serviceSDK_1 = require("../serviceSDK");
14
14
  const queries_1 = require("../../graphql/product/queries");
15
15
  /**
16
16
  * Service class for managing product-related operations.
17
17
  */
18
- class ProductService extends service_1.Service {
18
+ class ProductService extends serviceSDK_1.Service {
19
19
  /**
20
20
  * Constructs a new ProductService instance.
21
21
  * @param endpoint - The endpoint URL for the service.
@@ -0,0 +1,91 @@
1
+ import { Service } from "../serviceSDK";
2
+ import { ServiceRequest } from "../../types/service";
3
+ export declare class ServiceManagementService extends Service {
4
+ /**
5
+ * Constructs a new ProductService instance.
6
+ * @param endpoint - The endpoint URL for the service.
7
+ * @param orgId - The organization ID.
8
+ * @param storeId - The store ID.
9
+ */
10
+ constructor(endpoint: string, orgId: string, storeId: string);
11
+ /**
12
+ * get service by id .
13
+ * @param serviceId - The id of the service
14
+ */
15
+ getServiceById(serviceId: string): Promise<any>;
16
+ /**
17
+ * get service by type
18
+ * @param type - The endpoint URL for the service.
19
+ */
20
+ getServiceByType(type: string): Promise<any>;
21
+ /**
22
+ * get service by owner id
23
+ * @param ownerId - The endpoint URL for the service.
24
+ */
25
+ getServiceByOwnerId(ownerId: string): Promise<any>;
26
+ /**
27
+ * get service actions
28
+ * @param serviceId -
29
+ * @param actionType
30
+ * @param updatedBy
31
+ */
32
+ getServiceActions(serviceId: string): Promise<any>;
33
+ /**
34
+ * create service
35
+ * @param data
36
+ */
37
+ createService(data: ServiceRequest): Promise<any>;
38
+ /**
39
+ * create service
40
+ * @param data
41
+ * @param serviceId
42
+ * @param updatedBy
43
+ */
44
+ updateService(data: ServiceRequest, serviceId: String, updatedBy: string): Promise<any>;
45
+ /**
46
+ * delete service
47
+ * @param serviceId
48
+ * @param deletedBy
49
+ */
50
+ deleteService(serviceId: string, deletedBy: string): Promise<any>;
51
+ /**
52
+ * update attr value
53
+ * @param serviceId
54
+ * @param attrName
55
+ * @param attrValue
56
+ * @param updatedBy
57
+ */
58
+ updateAttrValue(serviceId: string, attrName: string, attrValue: string, updatedBy: string): Promise<any>;
59
+ /**
60
+ * delete attr value
61
+ * @param serviceId
62
+ * @param attrName
63
+ * @param updatedBy
64
+ */
65
+ deleteAttrValue(serviceId: string, attrName: string, updatedBy: string): Promise<any>;
66
+ /**
67
+ * update success action process status
68
+ * @param serviceId
69
+ * @param actionResult
70
+ * @param updatedBy
71
+ */
72
+ updateSuccessActionProcessStatus(serviceActionId: string, updatedBy: string): Promise<any>;
73
+ /**
74
+ * update fail action process status
75
+ * @param serviceId
76
+ * @param actionResult
77
+ * @param updatedBy
78
+ */
79
+ updateFailActionProcessStatus(serviceActionId: string, description: string, updatedBy: string): Promise<any>;
80
+ /**
81
+ * Creates a service ticket.
82
+ *
83
+ * @param {string} serviceId - The ID of the service.
84
+ * @param {string} name - The name of the service ticket.
85
+ * @param {string} createdBy - The user who created the service ticket.
86
+ * @param {string} description - The description of the service ticket.
87
+ * @returns {Promise<any>} - A promise that resolves to the created service ticket.
88
+ * @throws {Error} - If an error occurs during the creation of the service ticket.
89
+ */
90
+ createServiceTicket(serviceId: string, name: string, createdBy: string, description: string): Promise<any>;
91
+ }