@longvansoftware/storefront-js-client 1.5.6 → 1.5.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.
@@ -10,7 +10,6 @@ export declare const environmentEndpoints: {
10
10
  warehouse: string;
11
11
  computing: string;
12
12
  campaign: string;
13
- cloud: string;
14
13
  };
15
14
  live: {
16
15
  product: string;
@@ -23,6 +22,5 @@ export declare const environmentEndpoints: {
23
22
  warehouse: string;
24
23
  computing: string;
25
24
  campaign: string;
26
- cloud: string;
27
25
  };
28
26
  };
@@ -9,11 +9,11 @@ exports.environmentEndpoints = {
9
9
  order: "https://storefront.dev.longvan.vn/v2",
10
10
  user: "https://user.dev.longvan.vn/user-gateway/graphql",
11
11
  payment: "https://portal.dev.longvan.vn/invoice-gateway/graphql",
12
+ // service: "https://local.huyvd.xyz/service-api/graphql",
12
13
  service: "https://portal.dev.longvan.vn/service-api/graphql",
13
14
  warehouse: "https://portal.dev.longvan.vn/facility-api/public-facility/1.0.0",
14
15
  computing: "https://api-gateway.dev.longvan.vn/computing-service/graphql",
15
16
  campaign: "https://crm.dev.longvan.vn/campaign-gateway/graphql",
16
- cloud: "https://api-gateway.dev.longvan.vn/cloud-service-api/graphql",
17
17
  },
18
18
  live: {
19
19
  product: "https://product-service.longvan.vn/product-service/graphql",
@@ -26,6 +26,5 @@ exports.environmentEndpoints = {
26
26
  warehouse: "https://portal.dev.longvan.vn/facility-api/public-facility/1.0.0",
27
27
  computing: "https://api-gateway.longvan.vn/computing-service/graphql",
28
28
  campaign: "https://crm.dev.longvan.vn/campaign-gateway/graphql",
29
- cloud: "https://api-gateway.longvan.vn/cloud-service-api/graphql"
30
29
  },
31
30
  };
@@ -391,58 +391,52 @@ exports.GET_POLICY = (0, graphql_tag_1.gql) `
391
391
  }
392
392
  `;
393
393
  exports.GET_STORES = (0, graphql_tag_1.gql) `
394
- query GetStores($partnerId: String!) {
395
- getStores(partnerId: $partnerId) {
396
- id
397
- createdStamp
398
- name
399
- type
400
- enable
401
- partyId
402
- warehouses
403
- warehouseIdDefault
404
- enableOrderAbleFuture
405
- enableOrderNegativeQuantity
406
- storeEcommerceName
407
- shippingCompanies
408
- shippingCompanyIdPrimary
409
- customerIdPrimary
410
- paymentMethodIdPrimary
411
- enableCustomProductPrice
412
- enablePaymentPartial
413
- paymentPartialPercent
414
- productStoreLink
394
+ query GetStores($partnerId: String!, $type: String!) {
395
+ getStores(partnerId: $partnerId, type: $type) {
396
+ id
397
+ createdStamp
398
+ name
399
+ type
400
+ enable
401
+ partyId
402
+ warehouses
403
+ warehouseIdDefault
404
+ enableOrderAbleFuture
405
+ enableOrderNegativeQuantity
406
+ storeEcommerceName
407
+ shippingCompanies
408
+ shippingCompanyIdPrimary
409
+ customerIdPrimary
410
+ paymentMethodIdPrimary
411
+ enableCustomProductPrice
412
+ enablePaymentPartial
413
+ paymentPartialPercent
414
+ productStoreLink
415
415
  }
416
416
  }
417
417
  `;
418
418
  exports.GET_DETAIL_STORES = (0, graphql_tag_1.gql) `
419
- query GetDetailStores(
420
- $partnerId: String!
421
- $storeId: String!
422
- ) {
423
- getDetailStores(
424
- partnerId: $partnerId
425
- storeId: $storeId
426
- ){
427
- id
428
- createdStamp
429
- name
430
- type
431
- enable
432
- partyId
433
- warehouses
434
- warehouseIdDefault
435
- enableOrderAbleFuture
436
- enableOrderNegativeQuantity
437
- storeEcommerceName
438
- shippingCompanies
439
- shippingCompanyIdPrimary
440
- customerIdPrimary
441
- paymentMethodIdPrimary
442
- enableCustomProductPrice
443
- enablePaymentPartial
444
- paymentPartialPercent
445
- productStoreLink
419
+ query GetDetailStores($partnerId: String!, $storeId: String!) {
420
+ getDetailStores(partnerId: $partnerId, storeId: $storeId) {
421
+ id
422
+ createdStamp
423
+ name
424
+ type
425
+ enable
426
+ partyId
427
+ warehouses
428
+ warehouseIdDefault
429
+ enableOrderAbleFuture
430
+ enableOrderNegativeQuantity
431
+ storeEcommerceName
432
+ shippingCompanies
433
+ shippingCompanyIdPrimary
434
+ customerIdPrimary
435
+ paymentMethodIdPrimary
436
+ enableCustomProductPrice
437
+ enablePaymentPartial
438
+ paymentPartialPercent
439
+ productStoreLink
446
440
  }
447
441
  }
448
442
  `;
@@ -126,7 +126,39 @@ exports.DELETE_ATTR_VALUE = (0, graphql_tag_1.gql) `
126
126
  serviceId: $serviceId
127
127
  attrName: $attrName
128
128
  updatedBy: $updatedBy
129
- )
129
+ ){
130
+ createdStamp
131
+ updatedStamp
132
+ updatedBy
133
+ createdBy
134
+ partnerId
135
+ serviceName
136
+ serviceId
137
+ type
138
+ typeName
139
+ orderId
140
+ orderLineItemId
141
+ orderItemTermId
142
+ status
143
+ ownerId
144
+ ownerName
145
+ ownerEmail
146
+ ownerPhone
147
+ saleName
148
+ salePartyId
149
+ startDate
150
+ endDate
151
+ version
152
+ location
153
+ description
154
+ username
155
+ password
156
+ urlPrivate
157
+ urlPublic
158
+ serviceType
159
+ actionResult
160
+ attrs
161
+ }
130
162
  }
131
163
  `;
132
164
  exports.UPDATE_SUCCESS_ACTION_PROCESS_STATUS = (0, graphql_tag_1.gql) `
@@ -219,11 +251,13 @@ exports.CREATE_SERVICE_ACTION = (0, graphql_tag_1.gql) `
219
251
  mutation CreateServiceAction(
220
252
  $serviceId: String!
221
253
  $actionType: String!
254
+ $attributes : JSON
222
255
  $createdBy: String!
223
256
  ) {
224
257
  createServiceAction(
225
258
  serviceId: $serviceId
226
259
  actionType: $actionType
260
+ attributes: $attributes
227
261
  createdBy: $createdBy
228
262
  ) {
229
263
  id
@@ -236,49 +270,80 @@ exports.CREATE_SERVICE_ACTION = (0, graphql_tag_1.gql) `
236
270
  createdStamp
237
271
  updatedBy
238
272
  updatedStamp
273
+ attributes
239
274
  }
240
275
  }
241
276
  `;
242
- // const mutation = gql`
243
- // mutation UpdateAttrValue {
244
- // updateAttrValue(
245
- // partnerId: "PKH"
246
- // serviceId: "20.5791"
247
- // attrName: "test"
248
- // attrValue: "123123"
249
- // updatedBy: "20.5791"
250
- // )
251
- // }
252
- // `;
253
277
  exports.UPDATE_ATTR_VALUE = (0, graphql_tag_1.gql) `
254
278
  mutation UpdateAttrValue(
255
279
  $partnerId: String!
256
280
  $serviceId: String!
257
- $attrName: String!
258
- $attrValue: String!
281
+ $attr: JSON!
259
282
  $updatedBy: String!
260
283
  ) {
261
284
  updateAttrValue(
262
285
  partnerId: $partnerId
263
286
  serviceId: $serviceId
264
- attrName: $attrName
265
- attrValue: $attrValue
287
+ attr: $attr
266
288
  updatedBy: $updatedBy
267
- )
289
+ ){
290
+ createdStamp
291
+ updatedStamp
292
+ updatedBy
293
+ createdBy
294
+ partnerId
295
+ serviceName
296
+ serviceId
297
+ type
298
+ typeName
299
+ orderId
300
+ orderLineItemId
301
+ orderItemTermId
302
+ status
303
+ ownerId
304
+ ownerName
305
+ ownerEmail
306
+ ownerPhone
307
+ saleName
308
+ salePartyId
309
+ startDate
310
+ endDate
311
+ version
312
+ location
313
+ description
314
+ username
315
+ password
316
+ urlPrivate
317
+ urlPublic
318
+ serviceType
319
+ actionResult
320
+ attrs
321
+ }
322
+
268
323
  }
269
324
  `;
270
325
  exports.ADD_ACTION_ATTRIBUTE = (0, graphql_tag_1.gql) `
271
326
  mutation AddActionAttribute(
272
327
  $actionId: String!
273
- $attributeName: String!
274
- $attributeValue: String!
328
+ $attribute : JSON!
275
329
  $createdBy: String!
276
330
  ) {
277
331
  addActionAttribute(
278
332
  actionId: $actionId
279
- attributeName: $attributeName
280
- attributeValue: $attributeValue
333
+ attribute: $attribute
281
334
  createdBy: $createdBy
282
- )
335
+ ){
336
+ id
337
+ serviceId
338
+ actionType
339
+ description
340
+ status
341
+ processStatus
342
+ createdBy
343
+ createdStamp
344
+ updatedBy
345
+ updatedStamp
346
+ attributes
347
+ }
283
348
  }
284
349
  `;
@@ -29,6 +29,7 @@ exports.GET_SERVICE_BY_ID = (0, graphql_tag_1.gql) `
29
29
  description
30
30
  serviceType
31
31
  actionResult
32
+ attrs
32
33
  }
33
34
  }
34
35
  `;
@@ -125,6 +126,7 @@ exports.GET_SERVICE_BY_OWNER_ID = (0, graphql_tag_1.gql) `
125
126
  description
126
127
  serviceType
127
128
  actionResult
129
+ attrs
128
130
  }
129
131
  }
130
132
  `;
@@ -149,6 +151,7 @@ exports.GET_SERVICE_ACTION = (0, graphql_tag_1.gql) `
149
151
  createdStamp
150
152
  updatedBy
151
153
  updatedStamp
154
+ attributes
152
155
  }
153
156
  }
154
157
  `;
@@ -8,7 +8,6 @@ import { CrmService } from "../lib/crm/index";
8
8
  import { WarehouseService } from "../lib/warehouse/index";
9
9
  import { ComputingService } from "../lib/computing/index";
10
10
  import { CampaignService } from "./campaign";
11
- import { CloudService } from "./cloud";
12
11
  export interface Endpoints {
13
12
  product: string;
14
13
  crm: string;
@@ -20,13 +19,11 @@ export interface Endpoints {
20
19
  warehouse: string;
21
20
  computing: string;
22
21
  campaign: string;
23
- cloud: string;
24
22
  }
25
23
  export declare class SDK {
26
24
  orgId: string;
27
25
  storeId: string;
28
26
  storefrontAccessToken: string;
29
- environment: string;
30
27
  product: ProductService;
31
28
  auth: AuthService;
32
29
  order: OrderService;
@@ -37,9 +34,8 @@ export declare class SDK {
37
34
  warehouse: WarehouseService;
38
35
  computing: ComputingService;
39
36
  campaign: CampaignService;
40
- cloud: CloudService;
41
37
  token: string | null;
42
- constructor(orgId: string, storeId: string, storefrontAccessToken: string, environment: string);
38
+ constructor(orgId: string, storeId: string, storefrontAccessToken: string);
43
39
  setToken(token: string): void;
44
40
  setStoreId(storeId: string): void;
45
41
  }
@@ -14,19 +14,15 @@ const index_7 = require("../lib/crm/index");
14
14
  const index_8 = require("../lib/warehouse/index");
15
15
  const index_9 = require("../lib/computing/index");
16
16
  const campaign_1 = require("./campaign");
17
- const cloud_1 = require("./cloud");
18
17
  class SDK {
19
- constructor(orgId, storeId, storefrontAccessToken, environment) {
18
+ constructor(orgId, storeId, storefrontAccessToken) {
20
19
  this.orgId = orgId;
21
20
  this.storeId = storeId;
22
21
  this.storefrontAccessToken = storefrontAccessToken;
23
- this.environment = environment;
24
22
  this.token = null;
25
23
  (0, helpers_1.validateStorefrontAccessToken)(storefrontAccessToken);
26
- const endpoints = environment == "live"
27
- ? config_1.environmentEndpoints.live
28
- : config_1.environmentEndpoints.dev;
29
- //console.log("🚀 ~ SDK ~ endpoints:", endpoints.computing);
24
+ const endpoints = config_1.environmentEndpoints.dev;
25
+ console.log("🚀 ~ SDK ~ endpoints:", endpoints.computing);
30
26
  this.product = new index_1.ProductService(endpoints.product, orgId, storeId);
31
27
  this.auth = new index_2.AuthService(endpoints.auth, orgId, storeId);
32
28
  this.order = new index_3.OrderService(endpoints.order, orgId, storeId);
@@ -37,7 +33,6 @@ class SDK {
37
33
  this.warehouse = new index_8.WarehouseService(endpoints.warehouse, orgId, storeId);
38
34
  this.computing = new index_9.ComputingService(endpoints.computing, orgId, storeId);
39
35
  this.campaign = new campaign_1.CampaignService(endpoints.campaign, orgId, storeId);
40
- this.cloud = new cloud_1.CloudService(endpoints.cloud, orgId, storeId);
41
36
  // Initialize other services here
42
37
  }
43
38
  setToken(token) {
@@ -52,7 +47,6 @@ class SDK {
52
47
  this.service.setToken(token);
53
48
  this.warehouse.setToken(token);
54
49
  this.computing.setToken(token);
55
- this.cloud.setToken(token);
56
50
  // Set token for other services here
57
51
  }
58
52
  // các module export từ serviceSDK.ts set storeId vào serviceSDK.ts
@@ -169,7 +169,7 @@ class OrderService extends serviceSDK_1.Service {
169
169
  const method = "PUT";
170
170
  const requestData = {
171
171
  customerId: customerId,
172
- shippingAddressId: shippingAddress,
172
+ shipping_address: shippingAddress,
173
173
  };
174
174
  try {
175
175
  const response = yield this.restApiCallWithToken(endpoint, method, requestData);
@@ -34,6 +34,6 @@ export declare class ProductService extends Service {
34
34
  getSimpleProducts(variables: any): Promise<Product[] | null>;
35
35
  getProductOption(productId: string): Promise<any>;
36
36
  getPolicy(groupId: string): Promise<any>;
37
- getStores(): Promise<any>;
37
+ getStores(type: string): Promise<any>;
38
38
  getDetailStores(): Promise<any>;
39
39
  }
@@ -129,11 +129,12 @@ class ProductService extends serviceSDK_1.Service {
129
129
  });
130
130
  }
131
131
  // ...
132
- getStores() {
132
+ getStores(type) {
133
133
  return __awaiter(this, void 0, void 0, function* () {
134
134
  const query = queries_1.GET_STORES;
135
135
  const variablesHandle = {
136
136
  partnerId: this.orgId,
137
+ type,
137
138
  };
138
139
  try {
139
140
  const response = yield this.graphqlQuery(query, variablesHandle);
@@ -54,7 +54,7 @@ export declare class ServiceManagementService extends Service {
54
54
  * @param attrValue
55
55
  * @param updatedBy
56
56
  */
57
- updateAttrValue(serviceId: string, attrName: string, attrValue: string, updatedBy: string): Promise<any>;
57
+ updateAttrValue(serviceId: string, attr: JSON, updatedBy: string): Promise<any>;
58
58
  /**
59
59
  * delete attr value
60
60
  * @param serviceId
@@ -88,7 +88,7 @@ export declare class ServiceManagementService extends Service {
88
88
  */
89
89
  createServiceTicket(serviceId: string, name: string, createdBy: string, description: string): Promise<any>;
90
90
  getServiceTicket(serviceId: string): Promise<any>;
91
- createServiceAction(serviceId: string, actionType: string, createdBy: string): Promise<any>;
92
- addActionAttribute(actionId: string, attributeName: string, attributeValue: string, createdBy: string): Promise<any>;
91
+ createServiceAction(serviceId: string, actionType: string, attributes: JSON, createdBy: string): Promise<any>;
92
+ addActionAttribute(actionId: string, attribute: JSON, createdBy: string): Promise<any>;
93
93
  getActionAttribute(actionId: string, attributeName: string): Promise<any>;
94
94
  }
@@ -162,14 +162,13 @@ class ServiceManagementService extends serviceSDK_1.Service {
162
162
  * @param attrValue
163
163
  * @param updatedBy
164
164
  */
165
- updateAttrValue(serviceId, attrName, attrValue, updatedBy) {
165
+ updateAttrValue(serviceId, attr, updatedBy) {
166
166
  return __awaiter(this, void 0, void 0, function* () {
167
167
  const mutation = mutations_1.UPDATE_ATTR_VALUE;
168
168
  const variables = {
169
169
  partnerId: this.orgId,
170
170
  serviceId: serviceId,
171
- attrName: attrName,
172
- attrValue: attrValue,
171
+ attr: attr,
173
172
  updatedBy: updatedBy,
174
173
  };
175
174
  try {
@@ -293,12 +292,13 @@ class ServiceManagementService extends serviceSDK_1.Service {
293
292
  }
294
293
  });
295
294
  }
296
- createServiceAction(serviceId, actionType, createdBy) {
295
+ createServiceAction(serviceId, actionType, attributes, createdBy) {
297
296
  return __awaiter(this, void 0, void 0, function* () {
298
297
  const mutation = mutations_1.CREATE_SERVICE_ACTION;
299
298
  const variables = {
300
299
  serviceId,
301
300
  actionType,
301
+ attributes,
302
302
  createdBy,
303
303
  };
304
304
  try {
@@ -310,13 +310,12 @@ class ServiceManagementService extends serviceSDK_1.Service {
310
310
  }
311
311
  });
312
312
  }
313
- addActionAttribute(actionId, attributeName, attributeValue, createdBy) {
313
+ addActionAttribute(actionId, attribute, createdBy) {
314
314
  return __awaiter(this, void 0, void 0, function* () {
315
315
  const mutation = mutations_1.ADD_ACTION_ATTRIBUTE;
316
316
  const variables = {
317
317
  actionId,
318
- attributeName,
319
- attributeValue,
318
+ attribute,
320
319
  createdBy,
321
320
  };
322
321
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/storefront-js-client",
3
- "version": "1.5.6",
3
+ "version": "1.5.8",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [