@longvansoftware/service-js-client 1.6.9 → 1.7.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.
@@ -15,6 +15,7 @@ export declare const environmentEndpoints: {
15
15
  order_graphQL: string;
16
16
  paymentLV: string;
17
17
  resource_permission: string;
18
+ cloud_rest: string;
18
19
  };
19
20
  live: {
20
21
  product: string;
@@ -32,5 +33,6 @@ export declare const environmentEndpoints: {
32
33
  order_graphQL: string;
33
34
  paymentLV: string;
34
35
  resource_permission: string;
36
+ cloud_rest: string;
35
37
  };
36
38
  };
@@ -17,7 +17,8 @@ exports.environmentEndpoints = {
17
17
  crm_camping: "https://crm.dev.longvan.vn/campaign-gateway/graphql",
18
18
  order_graphQL: "https://api-gateway.dev.longvan.vn/order-cloud-service/graphql",
19
19
  paymentLV: "https://payment.dev.longvan.vn/graphql",
20
- resource_permission: "https://api-gateway.dev.longvan.vn/resource-permission-api/graphql"
20
+ resource_permission: "https://api-gateway.dev.longvan.vn/resource-permission-api/graphql",
21
+ cloud_rest: "https://api-gateway.dev.longvan.vn/cloud-service-api/v1"
21
22
  },
22
23
  live: {
23
24
  product: "https://product-service.longvan.vn/product-service/graphql",
@@ -34,6 +35,7 @@ exports.environmentEndpoints = {
34
35
  crm_camping: "https://crm.longvan.vn/campaign-gateway/graphql",
35
36
  order_graphQL: "https://api-gateway.longvan.vn/order-cloud-service/graphql",
36
37
  paymentLV: "https://payment.longvan.vn/graphql",
37
- resource_permission: "https://api-gateway.longvan.vn/resource-permission-api/graphql"
38
+ resource_permission: "https://api-gateway.longvan.vn/resource-permission-api/graphql",
39
+ cloud_rest: "https://api-gateway.longvan.vn/cloud-service-api/v1"
38
40
  },
39
41
  };
@@ -6,3 +6,4 @@ export declare const UPDATE_USER_NAME: import("graphql").DocumentNode;
6
6
  export declare const UPDATE_PASSWORD: import("graphql").DocumentNode;
7
7
  export declare const UPDATE_USER_PASSWORD: import("graphql").DocumentNode;
8
8
  export declare const UPDATE_DNS: import("graphql").DocumentNode;
9
+ export declare const CREATE_DOMAIN_CONTACT: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UPDATE_DNS = exports.UPDATE_USER_PASSWORD = exports.UPDATE_PASSWORD = exports.UPDATE_USER_NAME = exports.UPDATE_DOMAIN_NAME = exports.DELETE_USER_MAIL_HOSTING = exports.CREATE_USER_MAIL_HOSTING = exports.CHANGE_SERVICE_NAME = void 0;
3
+ exports.CREATE_DOMAIN_CONTACT = exports.UPDATE_DNS = exports.UPDATE_USER_PASSWORD = exports.UPDATE_PASSWORD = exports.UPDATE_USER_NAME = exports.UPDATE_DOMAIN_NAME = exports.DELETE_USER_MAIL_HOSTING = exports.CREATE_USER_MAIL_HOSTING = exports.CHANGE_SERVICE_NAME = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.CHANGE_SERVICE_NAME = (0, graphql_tag_1.gql) `
6
6
  mutation ChangeServiceName(
@@ -106,3 +106,23 @@ exports.UPDATE_DNS = (0, graphql_tag_1.gql) `
106
106
  )
107
107
  }
108
108
  `;
109
+ exports.CREATE_DOMAIN_CONTACT = (0, graphql_tag_1.gql) `
110
+ mutation CreateDomainContact(
111
+ $serviceId: String!
112
+ $domainContacts: [DomainContact]!
113
+ ) {
114
+ createDomainContact(
115
+ serviceId: $serviceId
116
+ domainContacts: $domainContacts
117
+ ) {
118
+ domainName
119
+ domainId
120
+ supplierId
121
+ partyOwnerId
122
+ adminOwnerId
123
+ domainTechnicalId
124
+ domainPayerId
125
+ attrs
126
+ }
127
+ }
128
+ `;
@@ -8,3 +8,4 @@ export declare const GET_IPS_OF_SERVICE: import("graphql").DocumentNode;
8
8
  export declare const GET_SERVICES_BY_ORDER_ID: import("graphql").DocumentNode;
9
9
  export declare const CHECK_DOMAIN_NAME_AVAILABLE: import("graphql").DocumentNode;
10
10
  export declare const GET_SERVICE_TYPE_LIST: import("graphql").DocumentNode;
11
+ export declare const GET_DOMAIN_CONTACTS: import("graphql").DocumentNode;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GET_SERVICE_TYPE_LIST = exports.CHECK_DOMAIN_NAME_AVAILABLE = exports.GET_SERVICES_BY_ORDER_ID = exports.GET_IPS_OF_SERVICE = exports.GET_PRODUCTS_OF_SERVICE = exports.SEARCH_SERVICE = exports.SERVICE_TYPE = exports.GET_USER_MAIL_HOSTING = exports.GET_MAIL_RESOURCE = exports.SERVICE_DETAIL = void 0;
3
+ exports.GET_DOMAIN_CONTACTS = exports.GET_SERVICE_TYPE_LIST = exports.CHECK_DOMAIN_NAME_AVAILABLE = exports.GET_SERVICES_BY_ORDER_ID = exports.GET_IPS_OF_SERVICE = exports.GET_PRODUCTS_OF_SERVICE = exports.SEARCH_SERVICE = exports.SERVICE_TYPE = exports.GET_USER_MAIL_HOSTING = exports.GET_MAIL_RESOURCE = exports.SERVICE_DETAIL = void 0;
4
4
  const graphql_tag_1 = require("graphql-tag");
5
5
  exports.SERVICE_DETAIL = (0, graphql_tag_1.gql) `
6
6
  query ServiceDetail($serviceId: String) {
@@ -178,3 +178,30 @@ exports.GET_SERVICE_TYPE_LIST = (0, graphql_tag_1.gql) `
178
178
  }
179
179
  }
180
180
  `;
181
+ exports.GET_DOMAIN_CONTACTS = (0, graphql_tag_1.gql) `
182
+ query GetDomainContacts($serviceId: String!) {
183
+ getDomainContacts(serviceId: $serviceId) {
184
+ partyId
185
+ fullName
186
+ otherName
187
+ customerType
188
+ email
189
+ country
190
+ provinceId
191
+ province
192
+ districtId
193
+ district
194
+ wardId
195
+ ward
196
+ address
197
+ phone
198
+ contactType
199
+ taxCode
200
+ businessCode
201
+ idNumber
202
+ gender
203
+ birthday
204
+ level
205
+ }
206
+ }
207
+ `;
@@ -13,6 +13,7 @@ import { CrmCampingService } from "./crm_camping";
13
13
  import { OrderGraphQLService } from "./orderGraphQL";
14
14
  import { PaymentLVService } from "./paymentLV";
15
15
  import { ResourcePermissionService } from "./resource_permission";
16
+ import { CloudRestService } from "./cloud_rest";
16
17
  export interface Endpoints {
17
18
  product: string;
18
19
  crm: string;
@@ -29,6 +30,7 @@ export interface Endpoints {
29
30
  order_graphQL: string;
30
31
  paymentLV: string;
31
32
  resource_permission: string;
33
+ cloud_rest: string;
32
34
  }
33
35
  export declare class SDK {
34
36
  orgId: string;
@@ -50,6 +52,7 @@ export declare class SDK {
50
52
  order_graphQL: OrderGraphQLService;
51
53
  paymentLV: PaymentLVService;
52
54
  resource_permission: ResourcePermissionService;
55
+ cloud_rest: CloudRestService;
53
56
  token: string | null;
54
57
  private endpoints;
55
58
  constructor(orgId: string, storeId: string, storefrontAccessToken: string, environment: string);
@@ -19,6 +19,7 @@ const crm_camping_1 = require("./crm_camping");
19
19
  const orderGraphQL_1 = require("./orderGraphQL");
20
20
  const paymentLV_1 = require("./paymentLV");
21
21
  const resource_permission_1 = require("./resource_permission");
22
+ const cloud_rest_1 = require("./cloud_rest");
22
23
  class SDK {
23
24
  constructor(orgId, storeId, storefrontAccessToken, environment) {
24
25
  this.orgId = orgId;
@@ -48,6 +49,7 @@ class SDK {
48
49
  this.order_graphQL = new orderGraphQL_1.OrderGraphQLService(this.endpoints.order_graphQL, orgId, storeId);
49
50
  this.paymentLV = new paymentLV_1.PaymentLVService(this.endpoints.paymentLV, orgId, storeId);
50
51
  this.resource_permission = new resource_permission_1.ResourcePermissionService(this.endpoints.resource_permission, orgId, storeId);
52
+ this.cloud_rest = new cloud_rest_1.CloudRestService(this.endpoints.cloud_rest, orgId, storeId);
51
53
  // Initialize other services here
52
54
  }
53
55
  setToken(token) {
@@ -68,6 +70,7 @@ class SDK {
68
70
  this.order_graphQL.setToken(token);
69
71
  this.paymentLV.setToken(token);
70
72
  this.resource_permission.setToken(token);
73
+ this.cloud_rest.setToken(token);
71
74
  // Set token for other services here
72
75
  }
73
76
  // các module export từ serviceSDK.ts set storeId vào serviceSDK.ts
@@ -90,6 +93,7 @@ class SDK {
90
93
  this.order_graphQL = new orderGraphQL_1.OrderGraphQLService(this.endpoints.order_graphQL, this.orgId, storeId);
91
94
  this.paymentLV = new paymentLV_1.PaymentLVService(this.endpoints.paymentLV, this.orgId, storeId);
92
95
  this.resource_permission = new resource_permission_1.ResourcePermissionService(this.endpoints.resource_permission, this.orgId, storeId);
96
+ this.cloud_rest = new cloud_rest_1.CloudRestService(this.endpoints.cloud_rest, this.orgId, storeId);
93
97
  }
94
98
  }
95
99
  exports.SDK = SDK;
@@ -28,4 +28,6 @@ export declare class CloudService extends Service {
28
28
  getServicesByOrderId(orderId: string): Promise<any>;
29
29
  checkDomainNameAvailable(domainName: string): Promise<any>;
30
30
  getServiceTypeList(): Promise<any>;
31
+ createDomainContact(serviceId: string, domainContacts: any): Promise<any>;
32
+ getDomainContacts(serviceId: string): Promise<any>;
31
33
  }
@@ -325,5 +325,33 @@ class CloudService extends serviceSDK_1.Service {
325
325
  }
326
326
  });
327
327
  }
328
+ createDomainContact(serviceId, domainContacts) {
329
+ return __awaiter(this, void 0, void 0, function* () {
330
+ const mutation = mutations_1.CREATE_DOMAIN_CONTACT;
331
+ const variables = { serviceId, domainContacts };
332
+ try {
333
+ const response = yield this.graphqlMutationV2(mutation, variables);
334
+ return response.createDomainContact;
335
+ }
336
+ catch (error) {
337
+ console.log(`Error in createDomainContact: ${error}`);
338
+ throw error;
339
+ }
340
+ });
341
+ }
342
+ getDomainContacts(serviceId) {
343
+ return __awaiter(this, void 0, void 0, function* () {
344
+ const query = queries_1.GET_DOMAIN_CONTACTS;
345
+ const variables = { serviceId };
346
+ try {
347
+ const response = yield this.graphqlQueryV2(query, variables);
348
+ return response.getDomainContacts;
349
+ }
350
+ catch (error) {
351
+ console.log(`Error in getDomainContacts: ${error}`);
352
+ throw error;
353
+ }
354
+ });
355
+ }
328
356
  }
329
357
  exports.CloudService = CloudService;
@@ -0,0 +1,15 @@
1
+ import { Service } from "../serviceSDK";
2
+ export declare class CloudRestService extends Service {
3
+ /**
4
+ * Constructs a new OrderService instance.
5
+ * @param endpoint - The endpoint URL for the service.
6
+ * @param orgId - The organization ID.
7
+ * @param storeId - The store ID.
8
+ */
9
+ constructor(endpoint: string, orgId: string, storeId: string);
10
+ setToken(token: string): void;
11
+ setStoreId(storeId: string): void;
12
+ getProvinces(): Promise<any>;
13
+ getDistrictsByProvinceId(provinceId: string): Promise<any>;
14
+ getWardByDistrictId(districtId: string): Promise<any>;
15
+ }
@@ -0,0 +1,73 @@
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.CloudRestService = void 0;
13
+ const serviceSDK_1 = require("../serviceSDK");
14
+ class CloudRestService extends serviceSDK_1.Service {
15
+ /**
16
+ * Constructs a new OrderService instance.
17
+ * @param endpoint - The endpoint URL for the service.
18
+ * @param orgId - The organization ID.
19
+ * @param storeId - The store ID.
20
+ */
21
+ constructor(endpoint, orgId, storeId) {
22
+ super(endpoint, orgId, storeId);
23
+ }
24
+ setToken(token) {
25
+ this.token = token;
26
+ }
27
+ setStoreId(storeId) {
28
+ this.storeId = storeId;
29
+ }
30
+ getProvinces() {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ const endpoint = `/places/provinces`;
33
+ const method = "GET";
34
+ try {
35
+ const response = yield this.restApiCallWithToken(endpoint, method);
36
+ return response;
37
+ }
38
+ catch (error) {
39
+ console.log(`Error in getProvinces: ${error}`);
40
+ throw error;
41
+ }
42
+ });
43
+ }
44
+ getDistrictsByProvinceId(provinceId) {
45
+ return __awaiter(this, void 0, void 0, function* () {
46
+ const endpoint = `/places/districts/${provinceId}`;
47
+ const method = "GET";
48
+ try {
49
+ const response = yield this.restApiCallWithToken(endpoint, method);
50
+ return response;
51
+ }
52
+ catch (error) {
53
+ console.log(`Error in getDistrictsByProvinceId: ${error}`);
54
+ throw error;
55
+ }
56
+ });
57
+ }
58
+ getWardByDistrictId(districtId) {
59
+ return __awaiter(this, void 0, void 0, function* () {
60
+ const endpoint = `/places/wards/${districtId}`;
61
+ const method = "GET";
62
+ try {
63
+ const response = yield this.restApiCallWithToken(endpoint, method);
64
+ return response;
65
+ }
66
+ catch (error) {
67
+ console.log(`Error in getWardByDistrictId: ${error}`);
68
+ throw error;
69
+ }
70
+ });
71
+ }
72
+ }
73
+ exports.CloudRestService = CloudRestService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@longvansoftware/service-js-client",
3
- "version": "1.6.9",
3
+ "version": "1.7.1",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "files": [