@longvansoftware/storefront-js-client 4.7.0 → 4.7.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.
- package/dist/config/config.d.ts +2 -0
- package/dist/config/config.js +2 -0
- package/dist/src/graphql/tag/mutations.d.ts +2 -0
- package/dist/src/graphql/tag/mutations.js +44 -0
- package/dist/src/graphql/tag/queries.d.ts +1 -0
- package/dist/src/graphql/tag/queries.js +20 -0
- package/dist/src/lib/SDK.d.ts +3 -0
- package/dist/src/lib/SDK.js +5 -0
- package/dist/src/lib/portal/index.d.ts +3 -0
- package/dist/src/lib/portal/index.js +50 -0
- package/dist/src/lib/tag/index.d.ts +7 -0
- package/dist/src/lib/tag/index.js +61 -0
- package/package.json +1 -1
package/dist/config/config.d.ts
CHANGED
|
@@ -33,6 +33,7 @@ export declare const environmentEndpoints: {
|
|
|
33
33
|
cloudCloud: string;
|
|
34
34
|
truedoc: string;
|
|
35
35
|
marketplace: string;
|
|
36
|
+
tag: string;
|
|
36
37
|
};
|
|
37
38
|
live: {
|
|
38
39
|
product: string;
|
|
@@ -64,5 +65,6 @@ export declare const environmentEndpoints: {
|
|
|
64
65
|
cloudCloud: string;
|
|
65
66
|
truedoc: string;
|
|
66
67
|
marketplace: string;
|
|
68
|
+
tag: string;
|
|
67
69
|
};
|
|
68
70
|
};
|
package/dist/config/config.js
CHANGED
|
@@ -36,6 +36,7 @@ exports.environmentEndpoints = {
|
|
|
36
36
|
cloudCloud: "https://api-gateway.dev.longvan.vn/cloud-service-api/graphql",
|
|
37
37
|
truedoc: "https://api-gateway.dev.truedoc.vn/bmlconnector/graphql",
|
|
38
38
|
marketplace: "https://api-gateway.dev.longvan.vn/marketplace/graphql",
|
|
39
|
+
tag: "https://portal.dev.longvan.vn/tag-api/graphql",
|
|
39
40
|
},
|
|
40
41
|
live: {
|
|
41
42
|
product: "https://product-service.longvan.vn/product-service/graphql",
|
|
@@ -67,5 +68,6 @@ exports.environmentEndpoints = {
|
|
|
67
68
|
cloudCloud: "https://api-gateway.longvan.vn/cloud-service-api/graphql",
|
|
68
69
|
truedoc: "https://api-gateway.truedoc.vn/bmlconnector/graphql",
|
|
69
70
|
marketplace: "https://api-gateway.longvan.vn/marketplace/graphql",
|
|
71
|
+
tag: "https://portal.longvan.vn/tag-api/graphql",
|
|
70
72
|
},
|
|
71
73
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REMOVE_TAG_TO_TAG_GROUP = exports.ADD_TAG_TO_TAG_GROUP = void 0;
|
|
4
|
+
const graphql_tag_1 = require("graphql-tag");
|
|
5
|
+
exports.ADD_TAG_TO_TAG_GROUP = (0, graphql_tag_1.gql) `
|
|
6
|
+
mutation AddTagToTagGroup(
|
|
7
|
+
$resourceId: String!
|
|
8
|
+
$resourceType: String!
|
|
9
|
+
$tagId: String!
|
|
10
|
+
$tagGroupId: String
|
|
11
|
+
$addedBy: String!
|
|
12
|
+
) {
|
|
13
|
+
addTagToTagGroup(
|
|
14
|
+
resourceId: $resourceId
|
|
15
|
+
resourceType: $resourceType
|
|
16
|
+
tagId: $tagId
|
|
17
|
+
tagGroupId: $tagGroupId
|
|
18
|
+
addedBy: $addedBy
|
|
19
|
+
) {
|
|
20
|
+
code
|
|
21
|
+
message
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`;
|
|
25
|
+
exports.REMOVE_TAG_TO_TAG_GROUP = (0, graphql_tag_1.gql) `
|
|
26
|
+
mutation RemoveTagToTagGroup(
|
|
27
|
+
$resourceId: String!
|
|
28
|
+
$resourceType: String!
|
|
29
|
+
$tagId: String!
|
|
30
|
+
$tagGroupId: String
|
|
31
|
+
$updateBy: String!
|
|
32
|
+
) {
|
|
33
|
+
removeTagToTagGroup(
|
|
34
|
+
resourceId: $resourceId
|
|
35
|
+
resourceType: $resourceType
|
|
36
|
+
tagId: $tagId
|
|
37
|
+
tagGroupId: $tagGroupId
|
|
38
|
+
updateBy: $updateBy
|
|
39
|
+
) {
|
|
40
|
+
code
|
|
41
|
+
message
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const GET_RESULT_TAG: import("graphql").DocumentNode;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GET_RESULT_TAG = void 0;
|
|
4
|
+
const graphql_tag_1 = require("graphql-tag");
|
|
5
|
+
exports.GET_RESULT_TAG = (0, graphql_tag_1.gql) `
|
|
6
|
+
query GetResultTag($resourceId: String!, $resourceType: String!) {
|
|
7
|
+
getResultTag(resourceId: $resourceId, resourceType: $resourceType) {
|
|
8
|
+
id
|
|
9
|
+
title
|
|
10
|
+
items {
|
|
11
|
+
id
|
|
12
|
+
title
|
|
13
|
+
items {
|
|
14
|
+
id
|
|
15
|
+
title
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
`;
|
package/dist/src/lib/SDK.d.ts
CHANGED
|
@@ -27,6 +27,7 @@ import { OrderCloudService } from "./orderCloud";
|
|
|
27
27
|
import { CloudCloudService } from "./cloudCloud";
|
|
28
28
|
import { TruedocService } from "./truedoc";
|
|
29
29
|
import { MarketPlaceService } from "./marketplace";
|
|
30
|
+
import { TagService } from "./tag";
|
|
30
31
|
export interface Endpoints {
|
|
31
32
|
product: string;
|
|
32
33
|
crm: string;
|
|
@@ -57,6 +58,7 @@ export interface Endpoints {
|
|
|
57
58
|
cloudCloud: string;
|
|
58
59
|
truedoc: string;
|
|
59
60
|
marketplace: string;
|
|
61
|
+
tag: string;
|
|
60
62
|
}
|
|
61
63
|
export declare class SDK {
|
|
62
64
|
orgId: string;
|
|
@@ -91,6 +93,7 @@ export declare class SDK {
|
|
|
91
93
|
cloudCloud: CloudCloudService;
|
|
92
94
|
truedoc: TruedocService;
|
|
93
95
|
marketplace: MarketPlaceService;
|
|
96
|
+
tag: TagService;
|
|
94
97
|
token: string | null;
|
|
95
98
|
constructor(orgId: string, storeId: string, environment: "dev" | "live");
|
|
96
99
|
setToken(token: string): void;
|
package/dist/src/lib/SDK.js
CHANGED
|
@@ -32,6 +32,7 @@ const orderCloud_1 = require("./orderCloud");
|
|
|
32
32
|
const cloudCloud_1 = require("./cloudCloud");
|
|
33
33
|
const truedoc_1 = require("./truedoc");
|
|
34
34
|
const marketplace_1 = require("./marketplace");
|
|
35
|
+
const tag_1 = require("./tag");
|
|
35
36
|
class SDK {
|
|
36
37
|
constructor(orgId, storeId, environment) {
|
|
37
38
|
this.orgId = orgId;
|
|
@@ -68,6 +69,7 @@ class SDK {
|
|
|
68
69
|
this.cloudCloud = new cloudCloud_1.CloudCloudService(endpoints.cloudCloud, orgId, storeId);
|
|
69
70
|
this.truedoc = new truedoc_1.TruedocService(endpoints.truedoc, orgId, storeId);
|
|
70
71
|
this.marketplace = new marketplace_1.MarketPlaceService(endpoints.marketplace, orgId, storeId);
|
|
72
|
+
this.tag = new tag_1.TagService(endpoints.tag, orgId, storeId);
|
|
71
73
|
// Initialize other services here
|
|
72
74
|
}
|
|
73
75
|
setToken(token) {
|
|
@@ -103,6 +105,7 @@ class SDK {
|
|
|
103
105
|
this.cloudCloud.setToken(token);
|
|
104
106
|
this.truedoc.setToken(token);
|
|
105
107
|
this.marketplace.setToken(token);
|
|
108
|
+
this.tag.setToken(token);
|
|
106
109
|
}
|
|
107
110
|
// các module export từ serviceSDK.ts set storeId vào serviceSDK.ts
|
|
108
111
|
// src/service.ts
|
|
@@ -135,6 +138,7 @@ class SDK {
|
|
|
135
138
|
this.cloudCloud.setStoreId(storeId);
|
|
136
139
|
this.truedoc.setStoreId(storeId);
|
|
137
140
|
this.marketplace.setStoreId(storeId);
|
|
141
|
+
this.tag.setStoreId(storeId);
|
|
138
142
|
// Set storeId for other services here
|
|
139
143
|
}
|
|
140
144
|
setOrgId(orgId) {
|
|
@@ -166,6 +170,7 @@ class SDK {
|
|
|
166
170
|
this.cloudCloud.setOrgId(orgId);
|
|
167
171
|
this.truedoc.setOrgId(orgId);
|
|
168
172
|
this.marketplace.setOrgId(orgId);
|
|
173
|
+
this.tag.setOrgId(orgId);
|
|
169
174
|
}
|
|
170
175
|
}
|
|
171
176
|
exports.SDK = SDK;
|
|
@@ -30,4 +30,7 @@ export declare class PortalService extends Service {
|
|
|
30
30
|
getPosition(query?: Record<string, any>): Promise<any>;
|
|
31
31
|
getPositionForTime(query?: Record<string, any>): Promise<any>;
|
|
32
32
|
getBookingCount(query?: Record<string, any>): Promise<any>;
|
|
33
|
+
getSlugPathFromDynamicFrom(query?: Record<string, any>): Promise<any>;
|
|
34
|
+
putSlugPathFromDynamicFrom(data: any): Promise<any>;
|
|
35
|
+
postSlugPathFromDynamicFrom(data: any): Promise<any>;
|
|
33
36
|
}
|
|
@@ -452,5 +452,55 @@ class PortalService extends serviceSDK_1.Service {
|
|
|
452
452
|
}
|
|
453
453
|
});
|
|
454
454
|
}
|
|
455
|
+
getSlugPathFromDynamicFrom(query) {
|
|
456
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
457
|
+
const method = "GET";
|
|
458
|
+
const baseUrl = `/dynamic-collection/public/v2/records/slug_path/slug_path_view`;
|
|
459
|
+
const params = new URLSearchParams();
|
|
460
|
+
if (query) {
|
|
461
|
+
Object.entries(query).forEach(([key, value]) => {
|
|
462
|
+
if (value !== undefined && value !== null) {
|
|
463
|
+
params.append(key, String(value));
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
const endpoint = params.toString()
|
|
468
|
+
? `${baseUrl}?${params.toString()}`
|
|
469
|
+
: baseUrl;
|
|
470
|
+
try {
|
|
471
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method);
|
|
472
|
+
return response;
|
|
473
|
+
}
|
|
474
|
+
catch (error) {
|
|
475
|
+
throw error;
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
putSlugPathFromDynamicFrom(data) {
|
|
480
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
481
|
+
const method = "PUT";
|
|
482
|
+
const endpoint = `/dynamic-collection/public/v2/records/slug_path/slug_path_form`;
|
|
483
|
+
try {
|
|
484
|
+
const response = yield this.restApiCallWithNoToken(endpoint, method, data);
|
|
485
|
+
return response;
|
|
486
|
+
}
|
|
487
|
+
catch (error) {
|
|
488
|
+
throw error;
|
|
489
|
+
}
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
postSlugPathFromDynamicFrom(data) {
|
|
493
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
494
|
+
const method = "POST";
|
|
495
|
+
const endpoint = `/dynamic-collection/public/v2/records/slug_path/slug_path_form`;
|
|
496
|
+
try {
|
|
497
|
+
const response = yield this.restApiCallWithNoHeader(endpoint, method, data);
|
|
498
|
+
return response;
|
|
499
|
+
}
|
|
500
|
+
catch (error) {
|
|
501
|
+
throw error;
|
|
502
|
+
}
|
|
503
|
+
});
|
|
504
|
+
}
|
|
455
505
|
}
|
|
456
506
|
exports.PortalService = PortalService;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Service } from "../serviceSDK";
|
|
2
|
+
export declare class TagService extends Service {
|
|
3
|
+
constructor(endpoint: string, orgId: string, storeId: string);
|
|
4
|
+
addTagToTagGroup(data: any): Promise<any>;
|
|
5
|
+
removeTagToTagGroup(data: any): Promise<any>;
|
|
6
|
+
getResultTag(resourceId: string, resourceType: string): Promise<any>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
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.TagService = void 0;
|
|
13
|
+
const serviceSDK_1 = require("../serviceSDK");
|
|
14
|
+
const mutations_1 = require("../../graphql/tag/mutations");
|
|
15
|
+
const queries_1 = require("../../graphql/tag/queries");
|
|
16
|
+
class TagService extends serviceSDK_1.Service {
|
|
17
|
+
constructor(endpoint, orgId, storeId) {
|
|
18
|
+
super(endpoint, orgId, storeId);
|
|
19
|
+
}
|
|
20
|
+
addTagToTagGroup(data) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const mutation = mutations_1.ADD_TAG_TO_TAG_GROUP;
|
|
23
|
+
try {
|
|
24
|
+
const response = yield this.graphqlMutation(mutation, data);
|
|
25
|
+
return response.addTagToTagGroup;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
removeTagToTagGroup(data) {
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
const mutation = mutations_1.REMOVE_TAG_TO_TAG_GROUP;
|
|
35
|
+
try {
|
|
36
|
+
const response = yield this.graphqlMutation(mutation, data);
|
|
37
|
+
return response.removeTagToTagGroup;
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
getResultTag(resourceId, resourceType) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const queries = queries_1.GET_RESULT_TAG;
|
|
47
|
+
const variables = {
|
|
48
|
+
resourceId,
|
|
49
|
+
resourceType,
|
|
50
|
+
};
|
|
51
|
+
try {
|
|
52
|
+
const response = yield this.graphqlMutationV3(queries, variables);
|
|
53
|
+
return response.getResultTag;
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.TagService = TagService;
|