@longvansoftware/storefront-js-client 1.5.9 → 1.6.1

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,6 +10,7 @@ export declare const environmentEndpoints: {
10
10
  warehouse: string;
11
11
  computing: string;
12
12
  campaign: string;
13
+ image: string;
13
14
  };
14
15
  live: {
15
16
  product: string;
@@ -22,5 +23,6 @@ export declare const environmentEndpoints: {
22
23
  warehouse: string;
23
24
  computing: string;
24
25
  campaign: string;
26
+ image: string;
25
27
  };
26
28
  };
@@ -13,6 +13,7 @@ exports.environmentEndpoints = {
13
13
  warehouse: "https://portal.dev.longvan.vn/facility-api/public-facility/1.0.0",
14
14
  computing: "https://api-gateway.dev.longvan.vn/computing-service/graphql",
15
15
  campaign: "https://crm.dev.longvan.vn/campaign-gateway/graphql",
16
+ image: "https://product-service.dev.longvan.vn/product-service/v1/products"
16
17
  },
17
18
  live: {
18
19
  product: "https://product-service.longvan.vn/product-service/graphql",
@@ -25,5 +26,6 @@ exports.environmentEndpoints = {
25
26
  warehouse: "https://portal.longvan.vn/facility-api/public-facility/1.0.0",
26
27
  computing: "https://api-gateway.longvan.vn/computing-service/graphql",
27
28
  campaign: "https://crm.longvan.vn/campaign-gateway/graphql",
29
+ image: "https://product-service.dev.longvan.vn/product-service/v1/products"
28
30
  },
29
31
  };
@@ -6,3 +6,4 @@ export declare const UPDATE_WORK_EFFORT_STATUS: import("graphql").DocumentNode;
6
6
  export declare const ADD_ATTACHMENT_FOR_WORK_EFFORT: import("graphql").DocumentNode;
7
7
  export declare const ADD_TICKED: import("graphql").DocumentNode;
8
8
  export declare const ADD_COMMENT: import("graphql").DocumentNode;
9
+ export declare const CREATE_WORK_EFFORT: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ADD_COMMENT = exports.ADD_TICKED = exports.ADD_ATTACHMENT_FOR_WORK_EFFORT = exports.UPDATE_WORK_EFFORT_STATUS = exports.UPDATE_WORK_EFFORT_NAME = exports.UPDATE_WORK_EFFORT_DESCRIPTION = exports.UPDATE_STATUS_ATTACHMENT_BY_ID = exports.ADD_OPPORTUNITY_MUTATION = void 0;
3
+ exports.CREATE_WORK_EFFORT = exports.ADD_COMMENT = exports.ADD_TICKED = exports.ADD_ATTACHMENT_FOR_WORK_EFFORT = exports.UPDATE_WORK_EFFORT_STATUS = exports.UPDATE_WORK_EFFORT_NAME = exports.UPDATE_WORK_EFFORT_DESCRIPTION = exports.UPDATE_STATUS_ATTACHMENT_BY_ID = exports.ADD_OPPORTUNITY_MUTATION = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.ADD_OPPORTUNITY_MUTATION = (0, graphql_tag_1.gql) `
6
6
  mutation AddOpportunity(
@@ -48,7 +48,7 @@ exports.UPDATE_STATUS_ATTACHMENT_BY_ID = (0, graphql_tag_1.gql) `
48
48
  mutation UpdateStatusAttachmentById(
49
49
  $performerId: String!
50
50
  $attachmentId: String!
51
- $status: String!
51
+ $status: AttachmentStatus!
52
52
  ) {
53
53
  updateStatusAttachmentById(
54
54
  performerId: $performerId
@@ -314,3 +314,25 @@ exports.ADD_COMMENT = (0, graphql_tag_1.gql) `
314
314
  }
315
315
  }
316
316
  `;
317
+ exports.CREATE_WORK_EFFORT = (0, graphql_tag_1.gql) `
318
+ mutation CreateWorkEffort(
319
+ $partnerId: String!
320
+ $createdBy: String!
321
+ $name: String!
322
+ $workEffortTypeId: String!
323
+ $source: String!
324
+ $attributes: JSON
325
+ ) {
326
+ createWorkEffort(
327
+ partnerId: $partnerId
328
+ createdBy: $createdBy
329
+ name: $name
330
+ workEffortTypeId: $workEffortTypeId
331
+ source: $source
332
+ attributes: $attributes
333
+ ) {
334
+ workEffortTypeId
335
+ id
336
+ }
337
+ }
338
+ `;
@@ -5,3 +5,4 @@ export declare const GET_LIST_TICKET: import("graphql").DocumentNode;
5
5
  export declare const GET_TICKET_BY_ID: import("graphql").DocumentNode;
6
6
  export declare const GET_ATTACHMENT_BY_WORK_EFFORT_ID: import("graphql").DocumentNode;
7
7
  export declare const GET_LIST_COMMENT: import("graphql").DocumentNode;
8
+ export declare const GET_WORK_EFFORTS: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_LIST_COMMENT = exports.GET_ATTACHMENT_BY_WORK_EFFORT_ID = exports.GET_TICKET_BY_ID = exports.GET_LIST_TICKET = exports.GET_LIST_WORK_EFFORT_TYPE = exports.GET_LIST_TODO = exports.GET_LIST_OPPORTUNITY_QUERY = void 0;
3
+ exports.GET_WORK_EFFORTS = exports.GET_LIST_COMMENT = exports.GET_ATTACHMENT_BY_WORK_EFFORT_ID = exports.GET_TICKET_BY_ID = exports.GET_LIST_TICKET = exports.GET_LIST_WORK_EFFORT_TYPE = exports.GET_LIST_TODO = exports.GET_LIST_OPPORTUNITY_QUERY = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.GET_LIST_OPPORTUNITY_QUERY = (0, graphql_tag_1.gql) `
6
6
  query GetListOpportunity(
@@ -279,3 +279,47 @@ exports.GET_LIST_COMMENT = (0, graphql_tag_1.gql) `
279
279
  }
280
280
  }
281
281
  `;
282
+ exports.GET_WORK_EFFORTS = (0, graphql_tag_1.gql) `
283
+ query GetWorkEfforts(
284
+ $partnerId: String!
285
+ $performerId: String!
286
+ $source: String!
287
+ $workEffortTypeId: String!
288
+ ){
289
+ getWorkEfforts(
290
+ partnerId:$partnerId
291
+ performerId:$performerId
292
+ source: $source
293
+ workEffortTypeId: $workEffortTypeId
294
+ ){
295
+ total
296
+ data{
297
+ id
298
+ createdStamp
299
+ updatedStamp
300
+ createdBy
301
+ updatedBy
302
+ name
303
+ partyId
304
+ targetId
305
+ targetType
306
+ targetUrl
307
+ description
308
+ status
309
+ parentId
310
+ workEffortTypeId
311
+ stmId
312
+ workflowId
313
+ endDateExpect
314
+ endDateActual
315
+ startDateActual
316
+ startDateExpect
317
+ source
318
+ ownerId
319
+ priorityName
320
+ priorityValue
321
+ extSource
322
+ }
323
+ }
324
+ }
325
+ `;
@@ -11,3 +11,4 @@ export declare const GET_PRODUCT_OPTION: import("graphql").DocumentNode;
11
11
  export declare const GET_POLICY: import("graphql").DocumentNode;
12
12
  export declare const GET_STORES: import("graphql").DocumentNode;
13
13
  export declare const GET_DETAIL_STORES: import("graphql").DocumentNode;
14
+ export declare const GET_PRODUCT_IMAGE: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_DETAIL_STORES = exports.GET_STORES = exports.GET_POLICY = exports.GET_PRODUCT_OPTION = exports.GET_BRAND_DETAIL_QUERY = exports.GET_BRANDS_BY_CATEGORY_QUERY = exports.GET_BRANDS_QUERY = exports.GET_CATEGORY_BY_ID_QUERY = exports.GET_CATEGORY_BY_HANDLE_QUERY = exports.GET_CATEGORIES_QUERY = exports.GET_SIMPLE_PRODUCTS_QUERY = exports.GET_PRODUCT_BY_SLUG_QUERY = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
3
+ exports.GET_PRODUCT_IMAGE = exports.GET_DETAIL_STORES = exports.GET_STORES = exports.GET_POLICY = exports.GET_PRODUCT_OPTION = exports.GET_BRAND_DETAIL_QUERY = exports.GET_BRANDS_BY_CATEGORY_QUERY = exports.GET_BRANDS_QUERY = exports.GET_CATEGORY_BY_ID_QUERY = exports.GET_CATEGORY_BY_HANDLE_QUERY = exports.GET_CATEGORIES_QUERY = exports.GET_SIMPLE_PRODUCTS_QUERY = exports.GET_PRODUCT_BY_SLUG_QUERY = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  // export const GET_PRODUCT_BY_ID_QUERY = gql`
6
6
  // query GetProductById(
@@ -440,3 +440,8 @@ exports.GET_DETAIL_STORES = (0, graphql_tag_1.gql) `
440
440
  }
441
441
  }
442
442
  `;
443
+ exports.GET_PRODUCT_IMAGE = (0, graphql_tag_1.gql) `
444
+ query GetProductImage($partnerId: String!, $productId: String!) {
445
+ getProductImage(partnerId: $partnerId, productId: $productId)
446
+ }
447
+ `;
@@ -8,6 +8,7 @@ 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 { ImageService } from "./image";
11
12
  export interface Endpoints {
12
13
  product: string;
13
14
  crm: string;
@@ -19,6 +20,7 @@ export interface Endpoints {
19
20
  warehouse: string;
20
21
  computing: string;
21
22
  campaign: string;
23
+ image: string;
22
24
  }
23
25
  export declare class SDK {
24
26
  orgId: string;
@@ -34,6 +36,7 @@ export declare class SDK {
34
36
  warehouse: WarehouseService;
35
37
  computing: ComputingService;
36
38
  campaign: CampaignService;
39
+ image: ImageService;
37
40
  token: string | null;
38
41
  constructor(orgId: string, storeId: string, environment: "dev" | "live");
39
42
  setToken(token: string): void;
@@ -13,6 +13,7 @@ const index_7 = require("../lib/crm/index");
13
13
  const index_8 = require("../lib/warehouse/index");
14
14
  const index_9 = require("../lib/computing/index");
15
15
  const campaign_1 = require("./campaign");
16
+ const image_1 = require("./image");
16
17
  class SDK {
17
18
  constructor(orgId, storeId, environment) {
18
19
  this.orgId = orgId;
@@ -30,6 +31,7 @@ class SDK {
30
31
  this.warehouse = new index_8.WarehouseService(endpoints.warehouse, orgId, storeId);
31
32
  this.computing = new index_9.ComputingService(endpoints.computing, orgId, storeId);
32
33
  this.campaign = new campaign_1.CampaignService(endpoints.campaign, orgId, storeId);
34
+ this.image = new image_1.ImageService(endpoints.image, orgId, storeId);
33
35
  // Initialize other services here
34
36
  }
35
37
  setToken(token) {
@@ -44,6 +46,7 @@ class SDK {
44
46
  this.service.setToken(token);
45
47
  this.warehouse.setToken(token);
46
48
  this.computing.setToken(token);
49
+ this.image.setToken(token);
47
50
  // Set token for other services here
48
51
  }
49
52
  // các module export từ serviceSDK.ts set storeId vào serviceSDK.ts
@@ -58,6 +61,7 @@ class SDK {
58
61
  this.crm.setStoreId(storeId);
59
62
  this.service.setStoreId(storeId);
60
63
  this.warehouse.setStoreId(storeId);
64
+ this.image.setStoreId(storeId);
61
65
  // Set storeId for other services here
62
66
  }
63
67
  }
@@ -18,4 +18,6 @@ export declare class CrmService extends Service {
18
18
  getAttachmentByWorkEffortId(workEffortIds: [string]): Promise<any>;
19
19
  getListComment(getCommentRequest: GetCommentRequest): Promise<any>;
20
20
  addComment(params: any): Promise<any>;
21
+ createWorkEffort(createdBy: string, name: string, workEffortTypeId: string, source: string, attributes: object): Promise<any>;
22
+ getWorkEfforts(performerId: string, source: string, workEffortTypeId: string): Promise<any>;
21
23
  }
@@ -292,5 +292,43 @@ class CrmService extends serviceSDK_1.Service {
292
292
  }
293
293
  });
294
294
  }
295
+ createWorkEffort(createdBy, name, workEffortTypeId, source, attributes) {
296
+ return __awaiter(this, void 0, void 0, function* () {
297
+ const query = mutations_1.CREATE_WORK_EFFORT;
298
+ const variables = {
299
+ partnerId: this.orgId,
300
+ createdBy,
301
+ name,
302
+ workEffortTypeId,
303
+ source,
304
+ attributes,
305
+ };
306
+ try {
307
+ const response = yield this.graphqlMutationV2(query, variables);
308
+ return response.createWorkEffort;
309
+ }
310
+ catch (error) {
311
+ throw error;
312
+ }
313
+ });
314
+ }
315
+ getWorkEfforts(performerId, source, workEffortTypeId) {
316
+ return __awaiter(this, void 0, void 0, function* () {
317
+ const query = queries_1.GET_WORK_EFFORTS;
318
+ const variables = {
319
+ partnerId: this.orgId,
320
+ performerId,
321
+ source,
322
+ workEffortTypeId,
323
+ };
324
+ try {
325
+ const response = yield this.graphqlQueryV2(query, variables);
326
+ return response.getWorkEfforts;
327
+ }
328
+ catch (error) {
329
+ throw error;
330
+ }
331
+ });
332
+ }
295
333
  }
296
334
  exports.CrmService = CrmService;
@@ -0,0 +1,7 @@
1
+ import { Service } from "../serviceSDK";
2
+ export declare class ImageService extends Service {
3
+ constructor(endpoint: string, orgId: string, storeId: string);
4
+ setToken(token: string): void;
5
+ getImageProduct(imageId: string): Promise<any>;
6
+ getImageProducts(productCode: string): Promise<any>;
7
+ }
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ImageService = void 0;
13
+ const serviceSDK_1 = require("../serviceSDK");
14
+ class ImageService extends serviceSDK_1.Service {
15
+ constructor(endpoint, orgId, storeId) {
16
+ super(endpoint, orgId, storeId);
17
+ }
18
+ setToken(token) {
19
+ this.token = token;
20
+ }
21
+ getImageProduct(imageId) {
22
+ return __awaiter(this, void 0, void 0, function* () {
23
+ const endpoint = `/${this.orgId}/${imageId}/images-url`;
24
+ const method = "GET";
25
+ try {
26
+ const response = yield this.restApiCallWithNoToken(endpoint, method);
27
+ return response;
28
+ }
29
+ catch (error) {
30
+ throw error;
31
+ }
32
+ });
33
+ }
34
+ getImageProducts(productCode) {
35
+ return __awaiter(this, void 0, void 0, function* () {
36
+ try {
37
+ const response = yield fetch(`https://product-service.dev.longvan.vn/product-service/v1/products/${this.orgId}/${productCode}/images-url`);
38
+ if (!response.ok) {
39
+ throw new Error("Failed to get image products");
40
+ }
41
+ return response.json();
42
+ }
43
+ catch (error) {
44
+ console.error("Error getting image products:", error);
45
+ }
46
+ });
47
+ }
48
+ }
49
+ exports.ImageService = ImageService;
@@ -36,4 +36,5 @@ export declare class ProductService extends Service {
36
36
  getPolicy(groupId: string): Promise<any>;
37
37
  getStores(type: string): Promise<any>;
38
38
  getDetailStores(): Promise<any>;
39
+ getProductImage: (productId: string) => Promise<any>;
39
40
  }
@@ -24,6 +24,20 @@ class ProductService extends serviceSDK_1.Service {
24
24
  */
25
25
  constructor(endpoint, orgId, storeId) {
26
26
  super(endpoint, orgId, storeId);
27
+ this.getProductImage = (productId) => __awaiter(this, void 0, void 0, function* () {
28
+ const query = queries_1.GET_PRODUCT_IMAGE;
29
+ const variables = {
30
+ partnerId: this.orgId,
31
+ productId,
32
+ };
33
+ try {
34
+ const response = yield this.graphqlQuery(query, variables);
35
+ return response.getProductImage;
36
+ }
37
+ catch (error) {
38
+ throw error;
39
+ }
40
+ });
27
41
  }
28
42
  // ...
29
43
  /**
@@ -289,3 +289,5 @@ export interface CommentType {
289
289
  GLOBAL: "GLOBAL";
290
290
  INTERNAL: "INTERNAL";
291
291
  }
292
+ export interface AttachmentStatus {
293
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/storefront-js-client",
3
- "version": "1.5.9",
3
+ "version": "1.6.1",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [