@longvansoftware/service-js-client 2.2.0 → 2.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.
@@ -21,6 +21,7 @@ export declare const environmentEndpoints: {
21
21
  quicklab_service: string;
22
22
  remote_access_service: string;
23
23
  storage_s3: string;
24
+ content_api: string;
24
25
  };
25
26
  live: {
26
27
  product: string;
@@ -44,5 +45,6 @@ export declare const environmentEndpoints: {
44
45
  quicklab_service: string;
45
46
  remote_access_service: string;
46
47
  storage_s3: string;
48
+ content_api: string;
47
49
  };
48
50
  };
@@ -25,6 +25,7 @@ exports.environmentEndpoints = {
25
25
  remote_access_service: "https://api-gateway.dev.longvan.vn/remote-access-service/graphql",
26
26
  // storage_s3: "https://portal.dev.longvan.vn/storage-s3-api/graphql",
27
27
  storage_s3: "https://storage-s3-api.dev.longvan.vn/storage-s3-api/graphql",
28
+ content_api: "https://portal.dev.longvan.vn/content-api/graphql"
28
29
  },
29
30
  live: {
30
31
  product: "https://product-service.longvan.vn/product-service/graphql",
@@ -49,5 +50,6 @@ exports.environmentEndpoints = {
49
50
  remote_access_service: "https://api-gateway.longvan.vn/remote-access-service/graphql",
50
51
  // storage_s3: "https://portal.longvan.vn/storage-s3-api/graphql",
51
52
  storage_s3: "https://storage-s3-api.longvan.vn/storage-s3-api/graphql",
53
+ content_api: "https://portal.longvan.vn/content-api/graphql"
52
54
  },
53
55
  };
@@ -9,3 +9,4 @@ export declare const GET_EMAIL_BY_PARTYID: DocumentNode;
9
9
  export declare const GET_ACCESS_TOKEN_BY_OTP: DocumentNode;
10
10
  export declare const GET_PARTY_DETAIL_BY_PHONE: (fields?: string[]) => DocumentNode;
11
11
  export declare const GET_ORGANIZATIONS_BY_PARTYID: (fields?: string[]) => DocumentNode;
12
+ export declare const CHECK_ENABLED_2FA: (fields?: string[]) => DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_ORGANIZATIONS_BY_PARTYID = exports.GET_PARTY_DETAIL_BY_PHONE = exports.GET_ACCESS_TOKEN_BY_OTP = exports.GET_EMAIL_BY_PARTYID = exports.GET_PHONE_BY_PARTYID = exports.GET_USER_LOGIN_BY_PARTY_ID = exports.CHECK_USERNAME_EXISTED = exports.GET_USER_LOGIN_BY_USER_LOGIN_ID = exports.GET_USER_LOGIN_BY_TOKEN = exports.GET_USER_DETAIL = void 0;
3
+ exports.CHECK_ENABLED_2FA = exports.GET_ORGANIZATIONS_BY_PARTYID = exports.GET_PARTY_DETAIL_BY_PHONE = exports.GET_ACCESS_TOKEN_BY_OTP = exports.GET_EMAIL_BY_PARTYID = exports.GET_PHONE_BY_PARTYID = exports.GET_USER_LOGIN_BY_PARTY_ID = exports.CHECK_USERNAME_EXISTED = exports.GET_USER_LOGIN_BY_USER_LOGIN_ID = exports.GET_USER_LOGIN_BY_TOKEN = exports.GET_USER_DETAIL = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.GET_USER_DETAIL = (0, graphql_tag_1.gql) `
6
6
  query GetUserDetail($orgId: String!, $accessToken: String!) {
@@ -110,3 +110,15 @@ const GET_ORGANIZATIONS_BY_PARTYID = (fields = []) => {
110
110
  `;
111
111
  };
112
112
  exports.GET_ORGANIZATIONS_BY_PARTYID = GET_ORGANIZATIONS_BY_PARTYID;
113
+ const CHECK_ENABLED_2FA = (fields = []) => {
114
+ const fieldStr = fields.join("\n ");
115
+ const hasFields = fields.length > 0;
116
+ return (0, graphql_tag_1.gql) `
117
+ query CheckEnabled2FA($partyId: String!) {
118
+ checkEnabled2FA(partyId: $partyId) {
119
+ ${hasFields ? `${fieldStr}` : ""}
120
+ }
121
+ }
122
+ `;
123
+ };
124
+ exports.CHECK_ENABLED_2FA = CHECK_ENABLED_2FA;
@@ -0,0 +1,2 @@
1
+ import { DocumentNode } from "graphql";
2
+ export declare const GET_ARTICLE_RELATED_TO_PRODUCT: (fields?: string[]) => DocumentNode;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GET_ARTICLE_RELATED_TO_PRODUCT = void 0;
4
+ const graphql_tag_1 = require("graphql-tag");
5
+ const GET_ARTICLE_RELATED_TO_PRODUCT = (fields = []) => {
6
+ const fieldStr = fields.join("\n ");
7
+ const hasFields = fields.length > 0;
8
+ return (0, graphql_tag_1.gql) `
9
+ query getArticleRelatedToProduct(
10
+ $partnerId: String!
11
+ $productId: String!
12
+ ) {
13
+ getArticleRelatedToProduct(
14
+ partnerId: $partnerId
15
+ productId: $productId
16
+ )
17
+ {
18
+ ${hasFields ? `${fieldStr}` : ""}
19
+ }
20
+ }
21
+ `;
22
+ };
23
+ exports.GET_ARTICLE_RELATED_TO_PRODUCT = GET_ARTICLE_RELATED_TO_PRODUCT;
@@ -26,3 +26,4 @@ export declare const GET_LIST_PRODUCTS_CONFIG_DYNAMIC: (fields?: string[]) => Do
26
26
  export declare const GET_CATEGORIES: DocumentNode;
27
27
  export declare const GET_PRICE_MENUS: DocumentNode;
28
28
  export declare const GET_SIMPLE_PRODUCTS_DYNAMIC: (fields?: string[]) => DocumentNode;
29
+ export declare const GET_PRODUCT_RELATED_TO_ARTICLE: (fields?: string[]) => DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_SIMPLE_PRODUCTS_DYNAMIC = exports.GET_PRICE_MENUS = exports.GET_CATEGORIES = exports.GET_LIST_PRODUCTS_CONFIG_DYNAMIC = exports.GET_TAGS_BY_CATEGORY = exports.GET_TAGS = exports.GET_LIST_PRICE = exports.GET_DETAIL_STORES = exports.GET_RELATED_INFOR = exports.GET_PRODUCT_VARIANT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_VARIANT_BY_ID = exports.GET_RESOURCE_BY_PRODUCT = exports.GET_HANDLE_BY_SERVICETYPE = exports.GET_PRODUCTS_DYNAMIC = exports.GET_PRODUCTS = 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_DYNAMIC = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
3
+ exports.GET_PRODUCT_RELATED_TO_ARTICLE = exports.GET_SIMPLE_PRODUCTS_DYNAMIC = exports.GET_PRICE_MENUS = exports.GET_CATEGORIES = exports.GET_LIST_PRODUCTS_CONFIG_DYNAMIC = exports.GET_TAGS_BY_CATEGORY = exports.GET_TAGS = exports.GET_LIST_PRICE = exports.GET_DETAIL_STORES = exports.GET_RELATED_INFOR = exports.GET_PRODUCT_VARIANT_BY_ID_QUERY_DYNAMIC = exports.GET_PRODUCT_VARIANT_BY_ID = exports.GET_RESOURCE_BY_PRODUCT = exports.GET_HANDLE_BY_SERVICETYPE = exports.GET_PRODUCTS_DYNAMIC = exports.GET_PRODUCTS = 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_DYNAMIC = 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(
@@ -1177,3 +1177,23 @@ const GET_SIMPLE_PRODUCTS_DYNAMIC = (fields = []) => {
1177
1177
  `;
1178
1178
  };
1179
1179
  exports.GET_SIMPLE_PRODUCTS_DYNAMIC = GET_SIMPLE_PRODUCTS_DYNAMIC;
1180
+ const GET_PRODUCT_RELATED_TO_ARTICLE = (fields = []) => {
1181
+ const fieldStr = fields.join("\n ");
1182
+ const hasFields = fields.length > 0;
1183
+ return (0, graphql_tag_1.gql) `
1184
+ query getProductRelatedToArticle(
1185
+ $partnerId: String!
1186
+ $storeId: String!
1187
+ $articleId: String!
1188
+ ) {
1189
+ getProductRelatedToArticle(
1190
+ partnerId: $partnerId
1191
+ storeId: $storeId
1192
+ articleId: $articleId
1193
+ ) {
1194
+ ${hasFields ? `${fieldStr}` : ""}
1195
+ }
1196
+ }
1197
+ `;
1198
+ };
1199
+ exports.GET_PRODUCT_RELATED_TO_ARTICLE = GET_PRODUCT_RELATED_TO_ARTICLE;
@@ -19,6 +19,7 @@ import { AccountingService } from "./accounting_service";
19
19
  import { QuicklabService } from "./quicklab_service";
20
20
  import { RemoteAccessService } from "./remote_access_service";
21
21
  import { StorageS3Service } from "./storage_s3";
22
+ import { ContentApiService } from "./content_api";
22
23
  export interface Endpoints {
23
24
  product: string;
24
25
  crm: string;
@@ -41,6 +42,7 @@ export interface Endpoints {
41
42
  quicklab_service: string;
42
43
  remote_access_service: string;
43
44
  storage_s3: string;
45
+ content_api: string;
44
46
  }
45
47
  export declare class SDK {
46
48
  orgId: string;
@@ -68,6 +70,7 @@ export declare class SDK {
68
70
  quicklab_service: QuicklabService;
69
71
  remote_access_service: RemoteAccessService;
70
72
  storage_s3: StorageS3Service;
73
+ content_api: ContentApiService;
71
74
  token: string | null;
72
75
  private endpoints;
73
76
  constructor(orgId: string, storeId: string, storefrontAccessToken: string, environment: string);
@@ -25,6 +25,7 @@ const accounting_service_1 = require("./accounting_service");
25
25
  const quicklab_service_1 = require("./quicklab_service");
26
26
  const remote_access_service_1 = require("./remote_access_service");
27
27
  const storage_s3_1 = require("./storage_s3");
28
+ const content_api_1 = require("./content_api");
28
29
  class SDK {
29
30
  constructor(orgId, storeId, storefrontAccessToken, environment) {
30
31
  this.orgId = orgId;
@@ -60,6 +61,7 @@ class SDK {
60
61
  this.quicklab_service = new quicklab_service_1.QuicklabService(this.endpoints.quicklab_service, orgId, storeId);
61
62
  this.remote_access_service = new remote_access_service_1.RemoteAccessService(this.endpoints.remote_access_service, orgId, storeId);
62
63
  this.storage_s3 = new storage_s3_1.StorageS3Service(this.endpoints.storage_s3, orgId, storeId);
64
+ this.content_api = new content_api_1.ContentApiService(this.endpoints.content_api, orgId, storeId);
63
65
  // Initialize other services here
64
66
  }
65
67
  setToken(token) {
@@ -86,6 +88,7 @@ class SDK {
86
88
  this.quicklab_service.setToken(token);
87
89
  this.remote_access_service.setToken(token);
88
90
  this.storage_s3.setToken(token);
91
+ this.content_api.setToken(token);
89
92
  // Set token for other services here
90
93
  }
91
94
  // các module export từ serviceSDK.ts set storeId vào serviceSDK.ts
@@ -114,6 +117,7 @@ class SDK {
114
117
  this.quicklab_service = new quicklab_service_1.QuicklabService(this.endpoints.quicklab_service, this.orgId, storeId);
115
118
  this.remote_access_service = new remote_access_service_1.RemoteAccessService(this.endpoints.remote_access_service, this.orgId, storeId);
116
119
  this.storage_s3 = new storage_s3_1.StorageS3Service(this.endpoints.storage_s3, this.orgId, storeId);
120
+ this.content_api = new content_api_1.ContentApiService(this.endpoints.content_api, this.orgId, storeId);
117
121
  }
118
122
  }
119
123
  exports.SDK = SDK;
@@ -47,4 +47,5 @@ export declare class AuthService extends Service {
47
47
  getPartyDetailByPhone(phone: string, fields: string[]): Promise<any>;
48
48
  createPartyDetail(name: string, phone: string, createdBy: string, source: string, fields: string[]): Promise<any>;
49
49
  getOrganizationsByPartyIdDynamic(partyId: string, fields: string[]): Promise<any>;
50
+ checkEnabled2FA(partyId: string, fields: string[]): Promise<any>;
50
51
  }
@@ -444,5 +444,21 @@ class AuthService extends serviceSDK_1.Service {
444
444
  }
445
445
  });
446
446
  }
447
+ checkEnabled2FA(partyId, fields) {
448
+ return __awaiter(this, void 0, void 0, function* () {
449
+ const query = (0, queries_1.CHECK_ENABLED_2FA)(fields);
450
+ const variables = {
451
+ partyId
452
+ };
453
+ try {
454
+ const response = yield this.graphqlQuery(query, variables);
455
+ return response.checkEnabled2FA;
456
+ }
457
+ catch (error) {
458
+ console.log(`Error in checkEnabled2FA: ${error}`);
459
+ throw error;
460
+ }
461
+ });
462
+ }
447
463
  }
448
464
  exports.AuthService = AuthService;
@@ -0,0 +1,7 @@
1
+ import { Service } from "../serviceSDK";
2
+ export declare class ContentApiService extends Service {
3
+ constructor(endpoint: string, orgId: string, storeId: string);
4
+ setToken(token: string): void;
5
+ setStoreId(storeId: string): void;
6
+ getArticleRelatedToProduct(productId: string, fields: string[]): Promise<any>;
7
+ }
@@ -0,0 +1,43 @@
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.ContentApiService = void 0;
13
+ const queries_1 = require("../../graphql/content_api/queries");
14
+ const serviceSDK_1 = require("../serviceSDK");
15
+ class ContentApiService extends serviceSDK_1.Service {
16
+ constructor(endpoint, orgId, storeId) {
17
+ super(endpoint, orgId, storeId);
18
+ }
19
+ setToken(token) {
20
+ this.token = token;
21
+ }
22
+ setStoreId(storeId) {
23
+ this.storeId = storeId;
24
+ }
25
+ getArticleRelatedToProduct(productId, fields) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const query = (0, queries_1.GET_ARTICLE_RELATED_TO_PRODUCT)(fields);
28
+ const variables = {
29
+ partnerId: this.orgId,
30
+ productId,
31
+ };
32
+ try {
33
+ const response = yield this.graphqlQuery(query, variables);
34
+ return response.getArticleRelatedToProduct;
35
+ }
36
+ catch (error) {
37
+ console.log(`Error fetching get getArticleRelatedToProduct method: ${error}`);
38
+ throw error;
39
+ }
40
+ });
41
+ }
42
+ }
43
+ exports.ContentApiService = ContentApiService;
@@ -53,4 +53,5 @@ export declare class ProductService extends Service {
53
53
  getCategories(): Promise<any>;
54
54
  getPriceMenus(categoryId: string, store: string): Promise<any>;
55
55
  getSimpleProductsDynamic(variables: any, storeId: string, fields: string[]): Promise<any>;
56
+ getProductRelatedToArticle(articleId: string, storeId: string, fields: string[]): Promise<any>;
56
57
  }
@@ -401,5 +401,23 @@ class ProductService extends serviceSDK_1.Service {
401
401
  }
402
402
  });
403
403
  }
404
+ getProductRelatedToArticle(articleId, storeId, fields) {
405
+ return __awaiter(this, void 0, void 0, function* () {
406
+ const query = (0, queries_1.GET_PRODUCT_RELATED_TO_ARTICLE)(fields);
407
+ const variablesHandle = {
408
+ partnerId: this.orgId,
409
+ storeId: storeId ? storeId : this.storeId,
410
+ articleId,
411
+ };
412
+ try {
413
+ const response = yield this.graphqlQuery(query, variablesHandle);
414
+ return response.getProductRelatedToArticle;
415
+ }
416
+ catch (error) {
417
+ console.log(`Error fetching getProductRelatedToArticle: ${error}`);
418
+ throw error;
419
+ }
420
+ });
421
+ }
404
422
  }
405
423
  exports.ProductService = ProductService;
@@ -22,6 +22,7 @@ export interface Filter {
22
22
  serviceId: string;
23
23
  type: string;
24
24
  status: ServiceStatus;
25
+ statuses: ServiceStatus[];
25
26
  salePartyId: string;
26
27
  offset: number;
27
28
  maxResult: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [