@longvansoftware/storefront-js-client 1.2.1 → 1.2.2

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.
@@ -1,2 +1,3 @@
1
1
  export declare const GET_PERSON_BY_IDS_QUERY: import("graphql").DocumentNode;
2
2
  export declare const GET_CUSTOMER_BY_ID: import("graphql").DocumentNode;
3
+ export declare const SEARCH_COMPANY: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_CUSTOMER_BY_ID = exports.GET_PERSON_BY_IDS_QUERY = void 0;
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
5
  exports.GET_PERSON_BY_IDS_QUERY = (0, graphql_tag_1.gql) `
6
6
  query GetPersonByIds($partyIds: [String!]!) {
@@ -48,3 +48,20 @@ query GetCustomerById($id: String!){
48
48
  }
49
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
+ }
67
+ `;
@@ -89,14 +89,14 @@ class CrmService extends service_1.Service {
89
89
  }
90
90
  updateStatusAttachmentById(performerId, attachmentId, status) {
91
91
  return __awaiter(this, void 0, void 0, function* () {
92
- const query = mutations_1.UPDATE_STATUS_ATTACHMENT_BY_ID;
92
+ const mutation = mutations_1.UPDATE_STATUS_ATTACHMENT_BY_ID;
93
93
  const variables = {
94
94
  performerId,
95
95
  attachmentId,
96
96
  status
97
97
  };
98
98
  try {
99
- const response = yield this.graphqlQuery(query, variables);
99
+ const response = yield this.graphqlMutation(mutation, variables);
100
100
  return response.updateStatusAttachmentById;
101
101
  }
102
102
  catch (error) {
@@ -107,14 +107,14 @@ class CrmService extends service_1.Service {
107
107
  }
108
108
  updateWorkEffortDescription(performerId, workEffortId, description) {
109
109
  return __awaiter(this, void 0, void 0, function* () {
110
- const query = mutations_1.UPDATE_WORK_EFFORT_DESCRIPTION;
110
+ const mutation = mutations_1.UPDATE_WORK_EFFORT_DESCRIPTION;
111
111
  const variables = {
112
112
  performerId,
113
113
  workEffortId,
114
114
  description
115
115
  };
116
116
  try {
117
- const response = yield this.graphqlQuery(query, variables);
117
+ const response = yield this.graphqlMutation(mutation, variables);
118
118
  return response.updateWorkEffortDescription;
119
119
  }
120
120
  catch (error) {
@@ -125,7 +125,7 @@ class CrmService extends service_1.Service {
125
125
  }
126
126
  updateWorkEffortName(performerId, workEffortId, name) {
127
127
  return __awaiter(this, void 0, void 0, function* () {
128
- const query = mutations_1.UPDATE_WORK_EFFORT_NAME;
128
+ const mutation = mutations_1.UPDATE_WORK_EFFORT_NAME;
129
129
  const variables = {
130
130
  partyId: this.orgId,
131
131
  performerId,
@@ -133,7 +133,7 @@ class CrmService extends service_1.Service {
133
133
  newName: name
134
134
  };
135
135
  try {
136
- const response = yield this.graphqlQuery(query, variables);
136
+ const response = yield this.graphqlMutation(mutation, variables);
137
137
  return response.updateWorkEffortName;
138
138
  }
139
139
  catch (error) {
@@ -144,7 +144,7 @@ class CrmService extends service_1.Service {
144
144
  }
145
145
  updateWorkEffortStatus(performerId, workEffortId, source, status) {
146
146
  return __awaiter(this, void 0, void 0, function* () {
147
- const query = mutations_1.UPDATE_WORK_EFFORT_STATUS;
147
+ const mutation = mutations_1.UPDATE_WORK_EFFORT_STATUS;
148
148
  const variables = {
149
149
  partyId: this.orgId,
150
150
  performerId,
@@ -153,7 +153,7 @@ class CrmService extends service_1.Service {
153
153
  status
154
154
  };
155
155
  try {
156
- const response = yield this.graphqlQuery(query, variables);
156
+ const response = yield this.graphqlMutation(mutation, variables);
157
157
  return response.updateWorkEffortStatus;
158
158
  }
159
159
  catch (error) {
@@ -164,7 +164,7 @@ class CrmService extends service_1.Service {
164
164
  }
165
165
  addAttachmentForWorkEffort(performerId, workEffortId, attachments) {
166
166
  return __awaiter(this, void 0, void 0, function* () {
167
- const query = mutations_1.ADD_ATTACHMENT_FOR_WORK_EFFORT;
167
+ const mutation = mutations_1.ADD_ATTACHMENT_FOR_WORK_EFFORT;
168
168
  const variables = {
169
169
  partyId: this.orgId,
170
170
  performerId,
@@ -172,7 +172,7 @@ class CrmService extends service_1.Service {
172
172
  attachments,
173
173
  };
174
174
  try {
175
- const response = yield this.graphqlQuery(query, variables);
175
+ const response = yield this.graphqlMutation(mutation, variables);
176
176
  return response.addAttachmentForWorkEffort;
177
177
  }
178
178
  catch (error) {
@@ -11,6 +11,7 @@ export declare class OrderService 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;
14
15
  /**
15
16
  * Creates a new order.
16
17
  * @param orderData - The data for the order.
@@ -24,6 +24,10 @@ class OrderService extends service_1.Service {
24
24
  constructor(endpoint, orgId, storeId) {
25
25
  super(endpoint, orgId, storeId);
26
26
  }
27
+ setToken(token) {
28
+ console.log("🚀 ~ OrderService ~ setToken ~ token:", token);
29
+ this.token = token;
30
+ }
27
31
  /**
28
32
  * Creates a new order.
29
33
  * @param orderData - The data for the order.
@@ -79,6 +79,7 @@ class Service {
79
79
  return __awaiter(this, void 0, void 0, function* () {
80
80
  try {
81
81
  const modifiedHeaders = Object.assign(Object.assign({}, headers), { "Partner-Id": this.orgId, "X-Ecomos-Access-Token": this.token });
82
+ console.log("🚀 ~ Service ~ modifiedHeaders:", modifiedHeaders);
82
83
  const response = yield (0, axios_1.default)({
83
84
  url: this.endpoint + path,
84
85
  method,
@@ -7,4 +7,5 @@ export declare class UserService extends Service {
7
7
  updateCompanyInfo(id: string, fieldName: string, valueUpdate: string, updatedBy: string): Promise<any>;
8
8
  updateCustomerV2(id: string, customerItem: updateCustomerRequest, updatedBy: string): Promise<any>;
9
9
  getCustomerById(id: string): Promise<any>;
10
+ searchCompany(keyword: string, limit: number): Promise<any>;
10
11
  }
@@ -38,7 +38,7 @@ class UserService extends service_1.Service {
38
38
  orgId: this.orgId,
39
39
  createCompanyRequest: {
40
40
  name: payload === null || payload === void 0 ? void 0 : payload.name,
41
- phone: payload === null || payload === void 0 ? void 0 : payload.phone,
41
+ phone: payload === null || payload === void 0 ? void 0 : payload.referPhone,
42
42
  address: payload === null || payload === void 0 ? void 0 : payload.address,
43
43
  },
44
44
  createTaxCodeRequest: null,
@@ -113,5 +113,23 @@ class UserService extends service_1.Service {
113
113
  }
114
114
  });
115
115
  }
116
+ searchCompany(keyword, limit) {
117
+ return __awaiter(this, void 0, void 0, function* () {
118
+ const query = queries_1.SEARCH_COMPANY;
119
+ const variables = {
120
+ keyword,
121
+ orgId: this.orgId,
122
+ limit,
123
+ };
124
+ try {
125
+ const response = yield this.graphqlQuery(query, variables);
126
+ return response.searchCompany;
127
+ }
128
+ catch (error) {
129
+ console.log(`Error in searchCompany: ${error}`);
130
+ throw error;
131
+ }
132
+ });
133
+ }
116
134
  }
117
135
  exports.UserService = UserService;
@@ -8,6 +8,7 @@ export interface AddOpportunityRequest {
8
8
  referEmail: string;
9
9
  targetId: string;
10
10
  extSource: string;
11
+ ownerId: string;
11
12
  }
12
13
  export interface Opportunity {
13
14
  goal: string;
@@ -1,6 +1,6 @@
1
1
  export interface createCompanyRequest {
2
2
  name: string;
3
- phone: string;
3
+ referPhone: string;
4
4
  address: string;
5
5
  }
6
6
  export interface CreateCompany {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/storefront-js-client",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [
@@ -19,7 +19,7 @@
19
19
  "author": "",
20
20
  "license": "ISC",
21
21
  "dependencies": {
22
- "@apollo/client": "3.7.11",
22
+ "@apollo/client": "3.9.11",
23
23
  "apollo-boost": "^0.4.9",
24
24
  "axios": "^1.6.8",
25
25
  "crypto-js": "^4.2.0",