@longvansoftware/storefront-js-client 2.4.4 → 2.4.6

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.
@@ -14,3 +14,4 @@ export declare const UPDATE_CONNECTOR_DESCRIPTION: import("graphql").DocumentNod
14
14
  export declare const REMOVE_TAG: import("graphql").DocumentNode;
15
15
  export declare const CLOSE_TOPIC: import("graphql").DocumentNode;
16
16
  export declare const CREATE_TOPIC: import("graphql").DocumentNode;
17
+ export declare const ADD_TOPIC_RELATED_RESOURCE: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CREATE_TOPIC = exports.CLOSE_TOPIC = exports.REMOVE_TAG = exports.UPDATE_CONNECTOR_DESCRIPTION = exports.ADD_TAG = exports.CREATE_CONNECTOR = exports.UPDATE_WORK_EFFORT_PROCESS_STATUS = 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;
3
+ exports.ADD_TOPIC_RELATED_RESOURCE = exports.CREATE_TOPIC = exports.CLOSE_TOPIC = exports.REMOVE_TAG = exports.UPDATE_CONNECTOR_DESCRIPTION = exports.ADD_TAG = exports.CREATE_CONNECTOR = exports.UPDATE_WORK_EFFORT_PROCESS_STATUS = 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(
@@ -817,3 +817,18 @@ exports.CREATE_TOPIC = (0, graphql_tag_1.gql) `
817
817
  }
818
818
  }
819
819
  `;
820
+ exports.ADD_TOPIC_RELATED_RESOURCE = (0, graphql_tag_1.gql) `
821
+ mutation AddTopicRelatedResource(
822
+ $topicId: String!
823
+ $resourceId: String!
824
+ $resourceType: String!
825
+ $createdBy: String!
826
+ ) {
827
+ addTopicRelatedResource(
828
+ topicId: $topicId
829
+ resourceId: $resourceId
830
+ resourceType: $resourceType
831
+ createdBy: $createdBy
832
+ )
833
+ }
834
+ `;
@@ -12,3 +12,4 @@ export declare const GET_TAG: import("graphql").DocumentNode;
12
12
  export declare const SEARCH_TOPIC: import("graphql").DocumentNode;
13
13
  export declare const GET_MY_WORK_EFFORT_TODAY: import("graphql").DocumentNode;
14
14
  export declare const GET_MESSAGES: import("graphql").DocumentNode;
15
+ export declare const GET_RESOURCE_RELATED_TOPIC: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_MESSAGES = exports.GET_MY_WORK_EFFORT_TODAY = exports.SEARCH_TOPIC = exports.GET_TAG = exports.GET_CONNECTOR_BY_RESOURCE = exports.GET_WORK_EFFORT_BY_ID = 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;
3
+ exports.GET_RESOURCE_RELATED_TOPIC = exports.GET_MESSAGES = exports.GET_MY_WORK_EFFORT_TODAY = exports.SEARCH_TOPIC = exports.GET_TAG = exports.GET_CONNECTOR_BY_RESOURCE = exports.GET_WORK_EFFORT_BY_ID = 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(
@@ -670,3 +670,11 @@ exports.GET_MESSAGES = (0, graphql_tag_1.gql) `
670
670
  }
671
671
  }
672
672
  `;
673
+ exports.GET_RESOURCE_RELATED_TOPIC = (0, graphql_tag_1.gql) `
674
+ query GetResourceRelatedTopic(
675
+ $topicId: String!
676
+ $resourceType: String!
677
+ ){
678
+ getResourceRelatedTopic(topicId: $topicId, resourceType: $resourceType)
679
+ }
680
+ `;
@@ -34,4 +34,6 @@ export declare class CrmService extends Service {
34
34
  getTopicByCustomerId(filterTopicRequest: any, pageSize: number, currentPage: number): Promise<any>;
35
35
  getMyWorkEffortToday(performerId: string, source: string): Promise<any>;
36
36
  getMessages(topicId: String, pageSize: Number, pageNumber: Number): Promise<any>;
37
+ getResourceRelatedTopic(topicId: string, resourceType: string): Promise<any>;
38
+ addTopicRelatedResource(topicId: string, resourceId: string, resourceType: string, createdBy: string): Promise<any>;
37
39
  }
@@ -576,5 +576,39 @@ class CrmService extends serviceSDK_1.Service {
576
576
  }
577
577
  });
578
578
  }
579
+ getResourceRelatedTopic(topicId, resourceType) {
580
+ return __awaiter(this, void 0, void 0, function* () {
581
+ const query = queries_1.GET_RESOURCE_RELATED_TOPIC;
582
+ const variables = {
583
+ topicId,
584
+ resourceType,
585
+ };
586
+ try {
587
+ const response = yield this.graphqlQuery(query, variables);
588
+ return response.getResourceRelatedTopic;
589
+ }
590
+ catch (error) {
591
+ throw error;
592
+ }
593
+ });
594
+ }
595
+ addTopicRelatedResource(topicId, resourceId, resourceType, createdBy) {
596
+ return __awaiter(this, void 0, void 0, function* () {
597
+ const mutation = mutations_1.ADD_TOPIC_RELATED_RESOURCE;
598
+ const variables = {
599
+ topicId,
600
+ resourceId,
601
+ resourceType,
602
+ createdBy,
603
+ };
604
+ try {
605
+ const response = yield this.graphqlMutation(mutation, variables);
606
+ return response.addTopicRelatedResource;
607
+ }
608
+ catch (error) {
609
+ throw error;
610
+ }
611
+ });
612
+ }
579
613
  }
580
614
  exports.CrmService = CrmService;
@@ -459,4 +459,5 @@ export declare class OrderService extends Service {
459
459
  enableProductDiary(orderId: string, orderItemId: string): Promise<any>;
460
460
  removeMemberDiscount(orderId: string): Promise<any>;
461
461
  getInfoChatApp(attributesName: string): Promise<any>;
462
+ validatePhoneNumber(phoneNumer: string): boolean;
462
463
  }
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.OrderService = void 0;
13
13
  const serviceSDK_1 = require("../serviceSDK");
14
+ const validatePhoneNumber_1 = require("../../utils/validatePhoneNumber");
14
15
  /**
15
16
  * Represents a service for managing orders.
16
17
  */
@@ -1343,5 +1344,9 @@ class OrderService extends serviceSDK_1.Service {
1343
1344
  }
1344
1345
  });
1345
1346
  }
1347
+ validatePhoneNumber(phoneNumer) {
1348
+ const res = (0, validatePhoneNumber_1.validatePhoneNumber)(phoneNumer);
1349
+ return res;
1350
+ }
1346
1351
  }
1347
1352
  exports.OrderService = OrderService;
@@ -0,0 +1 @@
1
+ export declare function validatePhoneNumber(phoneNumber: string): boolean;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validatePhoneNumber = void 0;
4
+ function validatePhoneNumber(phoneNumber) {
5
+ var _a;
6
+ const urlParams = new URLSearchParams(window.location.search);
7
+ const country = ((_a = urlParams.get("country")) === null || _a === void 0 ? void 0 : _a.trim()) || "default";
8
+ const pattern = (() => {
9
+ switch (country) {
10
+ case "vietnam":
11
+ return /^(0?)(3[2-9]|5[6|8|9]|7[0|6-9]|8[0-6|8|9]|9[0-4|6-9])[0-9]{7}$/;
12
+ case "quocte":
13
+ return /^(\+|00)[1-9][0-9]{1,3}[0-9]{4,14}$/;
14
+ default:
15
+ return /^(0?)(3[2-9]|5[6|8|9]|7[0|6-9]|8[0-6|8|9]|9[0-4|6-9])[0-9]{7}$|^(\+|00)[1-9][0-9]{1,3}[0-9]{4,14}$/;
16
+ }
17
+ })();
18
+ return pattern.test(phoneNumber);
19
+ }
20
+ exports.validatePhoneNumber = validatePhoneNumber;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/storefront-js-client",
3
- "version": "2.4.4",
3
+ "version": "2.4.6",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [