@longvansoftware/storefront-js-client 4.6.2 → 4.6.4
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/marketplace/mutations.d.ts +3 -0
- package/dist/src/graphql/marketplace/mutations.js +54 -0
- package/dist/src/graphql/marketplace/queries.d.ts +2 -0
- package/dist/src/graphql/marketplace/queries.js +45 -0
- package/dist/src/graphql/product/queries.d.ts +31 -29
- package/dist/src/graphql/product/queries.js +20 -10
- package/dist/src/lib/SDK.d.ts +3 -0
- package/dist/src/lib/SDK.js +5 -0
- package/dist/src/lib/marketplace/index.d.ts +9 -0
- package/dist/src/lib/marketplace/index.js +106 -0
- package/dist/src/lib/product/index.d.ts +1 -0
- package/dist/src/lib/product/index.js +18 -0
- package/package.json +3 -2
package/dist/config/config.d.ts
CHANGED
|
@@ -32,6 +32,7 @@ export declare const environmentEndpoints: {
|
|
|
32
32
|
orderCloud: string;
|
|
33
33
|
cloudCloud: string;
|
|
34
34
|
truedoc: string;
|
|
35
|
+
marketplace: string;
|
|
35
36
|
};
|
|
36
37
|
live: {
|
|
37
38
|
product: string;
|
|
@@ -62,5 +63,6 @@ export declare const environmentEndpoints: {
|
|
|
62
63
|
orderCloud: string;
|
|
63
64
|
cloudCloud: string;
|
|
64
65
|
truedoc: string;
|
|
66
|
+
marketplace: string;
|
|
65
67
|
};
|
|
66
68
|
};
|
package/dist/config/config.js
CHANGED
|
@@ -35,6 +35,7 @@ exports.environmentEndpoints = {
|
|
|
35
35
|
orderCloud: "https://api-gateway.dev.longvan.vn/order-cloud-service/graphql",
|
|
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
|
+
marketplace: "https://api-gateway.dev.longvan.vn/marketplace/graphql",
|
|
38
39
|
},
|
|
39
40
|
live: {
|
|
40
41
|
product: "https://product-service.longvan.vn/product-service/graphql",
|
|
@@ -65,5 +66,6 @@ exports.environmentEndpoints = {
|
|
|
65
66
|
orderCloud: "https://api-gateway.longvan.vn/order-cloud-service/graphql",
|
|
66
67
|
cloudCloud: "https://api-gateway.longvan.vn/cloud-service-api/graphql",
|
|
67
68
|
truedoc: "https://api-gateway.truedoc.vn/bmlconnector/graphql",
|
|
69
|
+
marketplace: "https://api-gateway.longvan.vn/marketplace/graphql",
|
|
68
70
|
},
|
|
69
71
|
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.REMOVE_PRODUCT_TAG = exports.ADD_PRODUCT_TAG = exports.CREATE_TAG = void 0;
|
|
4
|
+
const graphql_tag_1 = require("graphql-tag");
|
|
5
|
+
exports.CREATE_TAG = (0, graphql_tag_1.gql) `
|
|
6
|
+
mutation CreateTag($name: String!, $slug: String!, $createdBy: String!) {
|
|
7
|
+
createTag(name: $name, slug: $slug, createdBy: $createdBy) {
|
|
8
|
+
id
|
|
9
|
+
name
|
|
10
|
+
slug
|
|
11
|
+
type
|
|
12
|
+
scope
|
|
13
|
+
storeIds
|
|
14
|
+
selected
|
|
15
|
+
title
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
`;
|
|
19
|
+
exports.ADD_PRODUCT_TAG = (0, graphql_tag_1.gql) `
|
|
20
|
+
mutation AddProductTag(
|
|
21
|
+
$productId: String!
|
|
22
|
+
$tagId: String!
|
|
23
|
+
$tagGroupId: String
|
|
24
|
+
$createBy: String!
|
|
25
|
+
) {
|
|
26
|
+
addProductTag(
|
|
27
|
+
productId: $productId
|
|
28
|
+
tagId: $tagId
|
|
29
|
+
tagGroupId: $tagGroupId
|
|
30
|
+
createBy: $createBy
|
|
31
|
+
) {
|
|
32
|
+
status
|
|
33
|
+
message
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
37
|
+
exports.REMOVE_PRODUCT_TAG = (0, graphql_tag_1.gql) `
|
|
38
|
+
mutation RemoveProductTag(
|
|
39
|
+
$productId: String!
|
|
40
|
+
$tagId: String!
|
|
41
|
+
$tagGroupId: String
|
|
42
|
+
$updatedBy: String!
|
|
43
|
+
) {
|
|
44
|
+
removeProductTag(
|
|
45
|
+
productId: $productId
|
|
46
|
+
tagId: $tagId
|
|
47
|
+
tagGroupId: $tagGroupId
|
|
48
|
+
updatedBy: $updatedBy
|
|
49
|
+
) {
|
|
50
|
+
status
|
|
51
|
+
message
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SEARCH_TAG = exports.GET_TAGS_BY_PRODUCT_ID = void 0;
|
|
4
|
+
const graphql_tag_1 = require("graphql-tag");
|
|
5
|
+
exports.GET_TAGS_BY_PRODUCT_ID = (0, graphql_tag_1.gql) `
|
|
6
|
+
query GetTagsByProductId($productId: String!) {
|
|
7
|
+
getTagsByProductId(productId: $productId) {
|
|
8
|
+
id
|
|
9
|
+
title
|
|
10
|
+
items {
|
|
11
|
+
id
|
|
12
|
+
name
|
|
13
|
+
slug
|
|
14
|
+
type
|
|
15
|
+
scope
|
|
16
|
+
storeIds
|
|
17
|
+
selected
|
|
18
|
+
title
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
exports.SEARCH_TAG = (0, graphql_tag_1.gql) `
|
|
24
|
+
query SearchTag($keyword: String, $currentPage: Int, $maxResult: Int) {
|
|
25
|
+
searchTag(
|
|
26
|
+
keyword: $keyword
|
|
27
|
+
currentPage: $currentPage
|
|
28
|
+
maxResult: $maxResult
|
|
29
|
+
) {
|
|
30
|
+
total
|
|
31
|
+
maxResult
|
|
32
|
+
index
|
|
33
|
+
resultList {
|
|
34
|
+
id
|
|
35
|
+
name
|
|
36
|
+
slug
|
|
37
|
+
type
|
|
38
|
+
scope
|
|
39
|
+
storeIds
|
|
40
|
+
selected
|
|
41
|
+
title
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
`;
|
|
@@ -1,32 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
1
|
+
import { DocumentNode } from "graphql";
|
|
2
|
+
export declare const GET_PRODUCT_BY_ID_QUERY: DocumentNode;
|
|
3
|
+
export declare const GET_SIMPLE_PRODUCT_BY_ID_QUERY: DocumentNode;
|
|
4
|
+
export declare const GET_PRODUCT_BY_SLUG_QUERY: DocumentNode;
|
|
5
|
+
export declare const GET_SIMPLE_PRODUCTS_QUERY: DocumentNode;
|
|
6
|
+
export declare const GET_CATEGORIES_QUERY: DocumentNode;
|
|
7
|
+
export declare const GET_CATEGORY_BY_HANDLE_QUERY: DocumentNode;
|
|
8
|
+
export declare const GET_CATEGORY_BY_ID_QUERY: DocumentNode;
|
|
8
9
|
export declare const GET_BRANDS_QUERY = "\nquery GetBrands($partnerId: String!, $storeChannel: String!, $enable: Boolean) {\n\tgetBrands(partnerId: $partnerId, storeChannel: $storeChannel, enable: $enable) {\n\t\tid\n\t\tname\n\t\timage\n\t\timageIcon\n\t}\n}\n";
|
|
9
10
|
export declare const GET_BRANDS_BY_CATEGORY_QUERY = "\nquery GetBrandsByCategory($partnerId: String!, $storeChannel: String!, $categoryId: String!) {\n\tgetBrandsByCategory(partnerId: $partnerId, storeChannel: $storeChannel, categoryId: $categoryId) {\n\t\tid\n\t\tname\n\t\timage\n\t\timageIcon\n\t}\n}\n";
|
|
10
11
|
export declare const GET_BRAND_DETAIL_QUERY = "\n query GetBrandDetail($partnerId: String!, $brandId: String!, $storeChannel: String!) {\n getDetail(partnerId: $partnerId, brandId: $brandId, storeChannel: $storeChannel) {\n id\n name\n image\n imageIcon\n }\n }\n";
|
|
11
|
-
export declare const GET_PRODUCT_OPTION:
|
|
12
|
-
export declare const GET_POLICY:
|
|
13
|
-
export declare const GET_STORES:
|
|
14
|
-
export declare const GET_DETAIL_STORES:
|
|
15
|
-
export declare const GET_PRODUCT_IMAGE:
|
|
16
|
-
export declare const GET_PRODUCT:
|
|
17
|
-
export declare const GET_UNITS:
|
|
18
|
-
export declare const GET_PRODUCT_VARIANT_BY_ID:
|
|
19
|
-
export declare const GET_PRODUCT_TEMPLATES:
|
|
20
|
-
export declare const GET_GROUPS:
|
|
21
|
-
export declare const GET_BRAND:
|
|
22
|
-
export declare const GET_TAGS:
|
|
23
|
-
export declare const GET_PRODUCT_BY_GROUPID:
|
|
24
|
-
export declare const GET_CATEGORY_BY_ID:
|
|
25
|
-
export declare const GET_CATEGORY_BY_HANDLE:
|
|
26
|
-
export declare const GET_TAGS_BY_PRODUCT:
|
|
27
|
-
export declare const GET_PRODUCT_STORE_BY_SCOPE:
|
|
28
|
-
export declare const GET_PRODUCT_STORE_PUBLIC:
|
|
29
|
-
export declare const GET_PRODUCT_MARKET_PLACE:
|
|
30
|
-
export declare const GET_PRODUCT_MARKET_PLACE_DETAIL_BY_SLUG:
|
|
31
|
-
export declare const GET_PRODUCT_MARKET_PLACE_BY_ID:
|
|
32
|
-
export declare const GET_PRODUCT_MARKET_PLACE_BY_SUPPLIER:
|
|
12
|
+
export declare const GET_PRODUCT_OPTION: DocumentNode;
|
|
13
|
+
export declare const GET_POLICY: DocumentNode;
|
|
14
|
+
export declare const GET_STORES: DocumentNode;
|
|
15
|
+
export declare const GET_DETAIL_STORES: DocumentNode;
|
|
16
|
+
export declare const GET_PRODUCT_IMAGE: DocumentNode;
|
|
17
|
+
export declare const GET_PRODUCT: DocumentNode;
|
|
18
|
+
export declare const GET_UNITS: DocumentNode;
|
|
19
|
+
export declare const GET_PRODUCT_VARIANT_BY_ID: DocumentNode;
|
|
20
|
+
export declare const GET_PRODUCT_TEMPLATES: DocumentNode;
|
|
21
|
+
export declare const GET_GROUPS: DocumentNode;
|
|
22
|
+
export declare const GET_BRAND: DocumentNode;
|
|
23
|
+
export declare const GET_TAGS: DocumentNode;
|
|
24
|
+
export declare const GET_PRODUCT_BY_GROUPID: DocumentNode;
|
|
25
|
+
export declare const GET_CATEGORY_BY_ID: DocumentNode;
|
|
26
|
+
export declare const GET_CATEGORY_BY_HANDLE: DocumentNode;
|
|
27
|
+
export declare const GET_TAGS_BY_PRODUCT: DocumentNode;
|
|
28
|
+
export declare const GET_PRODUCT_STORE_BY_SCOPE: DocumentNode;
|
|
29
|
+
export declare const GET_PRODUCT_STORE_PUBLIC: DocumentNode;
|
|
30
|
+
export declare const GET_PRODUCT_MARKET_PLACE: DocumentNode;
|
|
31
|
+
export declare const GET_PRODUCT_MARKET_PLACE_DETAIL_BY_SLUG: DocumentNode;
|
|
32
|
+
export declare const GET_PRODUCT_MARKET_PLACE_BY_ID: DocumentNode;
|
|
33
|
+
export declare const GET_PRODUCT_MARKET_PLACE_BY_SUPPLIER: DocumentNode;
|
|
34
|
+
export declare const GET_PRODUCT_SIMPLE_BY_HANDLE_DYNAMIC: (fields?: string[]) => DocumentNode;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_PRODUCT_MARKET_PLACE_BY_SUPPLIER = exports.GET_PRODUCT_MARKET_PLACE_BY_ID = exports.GET_PRODUCT_MARKET_PLACE_DETAIL_BY_SLUG = exports.GET_PRODUCT_MARKET_PLACE = exports.GET_PRODUCT_STORE_PUBLIC = exports.GET_PRODUCT_STORE_BY_SCOPE = exports.GET_TAGS_BY_PRODUCT = exports.GET_CATEGORY_BY_HANDLE = exports.GET_CATEGORY_BY_ID = exports.GET_PRODUCT_BY_GROUPID = exports.GET_TAGS = exports.GET_BRAND = exports.GET_GROUPS = exports.GET_PRODUCT_TEMPLATES = exports.GET_PRODUCT_VARIANT_BY_ID = exports.GET_UNITS = exports.GET_PRODUCT = 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_SIMPLE_PRODUCT_BY_ID_QUERY = exports.GET_PRODUCT_BY_ID_QUERY = void 0;
|
|
3
|
+
exports.GET_PRODUCT_SIMPLE_BY_HANDLE_DYNAMIC = exports.GET_PRODUCT_MARKET_PLACE_BY_SUPPLIER = exports.GET_PRODUCT_MARKET_PLACE_BY_ID = exports.GET_PRODUCT_MARKET_PLACE_DETAIL_BY_SLUG = exports.GET_PRODUCT_MARKET_PLACE = exports.GET_PRODUCT_STORE_PUBLIC = exports.GET_PRODUCT_STORE_BY_SCOPE = exports.GET_TAGS_BY_PRODUCT = exports.GET_CATEGORY_BY_HANDLE = exports.GET_CATEGORY_BY_ID = exports.GET_PRODUCT_BY_GROUPID = exports.GET_TAGS = exports.GET_BRAND = exports.GET_GROUPS = exports.GET_PRODUCT_TEMPLATES = exports.GET_PRODUCT_VARIANT_BY_ID = exports.GET_UNITS = exports.GET_PRODUCT = 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_SIMPLE_PRODUCT_BY_ID_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(
|
|
@@ -527,15 +527,7 @@ exports.GET_SIMPLE_PRODUCTS_QUERY = (0, graphql_tag_1.gql) `
|
|
|
527
527
|
vat
|
|
528
528
|
qualify
|
|
529
529
|
parentId
|
|
530
|
-
|
|
531
|
-
id
|
|
532
|
-
name
|
|
533
|
-
slug
|
|
534
|
-
type
|
|
535
|
-
scope
|
|
536
|
-
storeIds
|
|
537
|
-
selected
|
|
538
|
-
}
|
|
530
|
+
|
|
539
531
|
handle
|
|
540
532
|
price
|
|
541
533
|
compareAtPrice
|
|
@@ -1761,3 +1753,21 @@ exports.GET_PRODUCT_MARKET_PLACE_BY_SUPPLIER = (0, graphql_tag_1.gql) `
|
|
|
1761
1753
|
}
|
|
1762
1754
|
}
|
|
1763
1755
|
`;
|
|
1756
|
+
const GET_PRODUCT_SIMPLE_BY_HANDLE_DYNAMIC = (fields = []) => {
|
|
1757
|
+
const fieldStr = fields.join("\n ");
|
|
1758
|
+
const hasFields = fields.length > 0;
|
|
1759
|
+
return (0, graphql_tag_1.gql) `
|
|
1760
|
+
query getProductSimpleByHandle(
|
|
1761
|
+
$partnerId: String!
|
|
1762
|
+
$storeChannel: String!
|
|
1763
|
+
$handle: String
|
|
1764
|
+
) {
|
|
1765
|
+
getProductSimpleByHandle(
|
|
1766
|
+
partnerId: $partnerId
|
|
1767
|
+
storeChannel: $storeChannel
|
|
1768
|
+
handle: $handle
|
|
1769
|
+
) ${hasFields ? `{ ${fieldStr} }` : ""}
|
|
1770
|
+
}
|
|
1771
|
+
`;
|
|
1772
|
+
};
|
|
1773
|
+
exports.GET_PRODUCT_SIMPLE_BY_HANDLE_DYNAMIC = GET_PRODUCT_SIMPLE_BY_HANDLE_DYNAMIC;
|
package/dist/src/lib/SDK.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { FileServiceSerVice } from "./fileService";
|
|
|
26
26
|
import { OrderCloudService } from "./orderCloud";
|
|
27
27
|
import { CloudCloudService } from "./cloudCloud";
|
|
28
28
|
import { TruedocService } from "./truedoc";
|
|
29
|
+
import { MarketPlaceService } from "./marketplace";
|
|
29
30
|
export interface Endpoints {
|
|
30
31
|
product: string;
|
|
31
32
|
crm: string;
|
|
@@ -55,6 +56,7 @@ export interface Endpoints {
|
|
|
55
56
|
orderCloud: string;
|
|
56
57
|
cloudCloud: string;
|
|
57
58
|
truedoc: string;
|
|
59
|
+
marketplace: string;
|
|
58
60
|
}
|
|
59
61
|
export declare class SDK {
|
|
60
62
|
orgId: string;
|
|
@@ -88,6 +90,7 @@ export declare class SDK {
|
|
|
88
90
|
orderCloud: OrderCloudService;
|
|
89
91
|
cloudCloud: CloudCloudService;
|
|
90
92
|
truedoc: TruedocService;
|
|
93
|
+
marketplace: MarketPlaceService;
|
|
91
94
|
token: string | null;
|
|
92
95
|
constructor(orgId: string, storeId: string, environment: "dev" | "live");
|
|
93
96
|
setToken(token: string): void;
|
package/dist/src/lib/SDK.js
CHANGED
|
@@ -31,6 +31,7 @@ const fileService_1 = require("./fileService");
|
|
|
31
31
|
const orderCloud_1 = require("./orderCloud");
|
|
32
32
|
const cloudCloud_1 = require("./cloudCloud");
|
|
33
33
|
const truedoc_1 = require("./truedoc");
|
|
34
|
+
const marketplace_1 = require("./marketplace");
|
|
34
35
|
class SDK {
|
|
35
36
|
constructor(orgId, storeId, environment) {
|
|
36
37
|
this.orgId = orgId;
|
|
@@ -66,6 +67,7 @@ class SDK {
|
|
|
66
67
|
this.orderCloud = new orderCloud_1.OrderCloudService(endpoints.orderCloud, orgId, storeId);
|
|
67
68
|
this.cloudCloud = new cloudCloud_1.CloudCloudService(endpoints.cloudCloud, orgId, storeId);
|
|
68
69
|
this.truedoc = new truedoc_1.TruedocService(endpoints.truedoc, orgId, storeId);
|
|
70
|
+
this.marketplace = new marketplace_1.MarketPlaceService(endpoints.marketplace, orgId, storeId);
|
|
69
71
|
// Initialize other services here
|
|
70
72
|
}
|
|
71
73
|
setToken(token) {
|
|
@@ -100,6 +102,7 @@ class SDK {
|
|
|
100
102
|
this.orderCloud.setToken(token);
|
|
101
103
|
this.cloudCloud.setToken(token);
|
|
102
104
|
this.truedoc.setToken(token);
|
|
105
|
+
this.marketplace.setToken(token);
|
|
103
106
|
}
|
|
104
107
|
// các module export từ serviceSDK.ts set storeId vào serviceSDK.ts
|
|
105
108
|
// src/service.ts
|
|
@@ -131,6 +134,7 @@ class SDK {
|
|
|
131
134
|
this.orderCloud.setStoreId(storeId);
|
|
132
135
|
this.cloudCloud.setStoreId(storeId);
|
|
133
136
|
this.truedoc.setStoreId(storeId);
|
|
137
|
+
this.marketplace.setStoreId(storeId);
|
|
134
138
|
// Set storeId for other services here
|
|
135
139
|
}
|
|
136
140
|
setOrgId(orgId) {
|
|
@@ -161,6 +165,7 @@ class SDK {
|
|
|
161
165
|
this.orderCloud.setOrgId(orgId);
|
|
162
166
|
this.cloudCloud.setOrgId(orgId);
|
|
163
167
|
this.truedoc.setOrgId(orgId);
|
|
168
|
+
this.marketplace.setOrgId(orgId);
|
|
164
169
|
}
|
|
165
170
|
}
|
|
166
171
|
exports.SDK = SDK;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Service } from "../serviceSDK";
|
|
2
|
+
export declare class MarketPlaceService extends Service {
|
|
3
|
+
constructor(endpoint: string, orgId: string, storeId: string);
|
|
4
|
+
createTag(name: string, slug: string, createdBy: string): Promise<any>;
|
|
5
|
+
searchTag(keyword: string, currentPage: number, maxResult: number): Promise<any>;
|
|
6
|
+
getTagsByProductId(productId: string): Promise<any>;
|
|
7
|
+
removeProductTag(productId: string, tagId: string, updatedBy: string, tagGroupId?: string): Promise<any>;
|
|
8
|
+
addProductTag(productId: string, tagId: string, createBy: string, tagGroupId?: string): Promise<any>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
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.MarketPlaceService = void 0;
|
|
13
|
+
const serviceSDK_1 = require("../serviceSDK");
|
|
14
|
+
const queries_1 = require("../../graphql/marketplace/queries");
|
|
15
|
+
const mutations_1 = require("../../graphql/marketplace/mutations");
|
|
16
|
+
class MarketPlaceService extends serviceSDK_1.Service {
|
|
17
|
+
constructor(endpoint, orgId, storeId) {
|
|
18
|
+
super(endpoint, orgId, storeId);
|
|
19
|
+
}
|
|
20
|
+
createTag(name, slug, createdBy) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const mutation = mutations_1.CREATE_TAG;
|
|
23
|
+
const variables = {
|
|
24
|
+
name,
|
|
25
|
+
slug,
|
|
26
|
+
createdBy,
|
|
27
|
+
};
|
|
28
|
+
try {
|
|
29
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
30
|
+
return response.createTag;
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
searchTag(keyword, currentPage, maxResult) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const queries = queries_1.SEARCH_TAG;
|
|
40
|
+
const variables = {
|
|
41
|
+
keyword,
|
|
42
|
+
currentPage,
|
|
43
|
+
maxResult,
|
|
44
|
+
};
|
|
45
|
+
try {
|
|
46
|
+
const response = yield this.graphqlQuery(queries, variables);
|
|
47
|
+
return response.searchTag;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
throw error;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
getTagsByProductId(productId) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const queries = queries_1.GET_TAGS_BY_PRODUCT_ID;
|
|
57
|
+
const variables = {
|
|
58
|
+
productId,
|
|
59
|
+
};
|
|
60
|
+
try {
|
|
61
|
+
const response = yield this.graphqlQuery(queries, variables);
|
|
62
|
+
return response.getTagsByProductId;
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
throw error;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
removeProductTag(productId, tagId, updatedBy, tagGroupId) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const mutation = mutations_1.REMOVE_PRODUCT_TAG;
|
|
72
|
+
const variables = {
|
|
73
|
+
productId,
|
|
74
|
+
tagId,
|
|
75
|
+
updatedBy,
|
|
76
|
+
tagGroupId,
|
|
77
|
+
};
|
|
78
|
+
try {
|
|
79
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
80
|
+
return response.removeProductTag;
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
throw error;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
addProductTag(productId, tagId, createBy, tagGroupId) {
|
|
88
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
89
|
+
const mutation = mutations_1.ADD_PRODUCT_TAG;
|
|
90
|
+
const variables = {
|
|
91
|
+
productId,
|
|
92
|
+
tagId,
|
|
93
|
+
createBy,
|
|
94
|
+
tagGroupId,
|
|
95
|
+
};
|
|
96
|
+
try {
|
|
97
|
+
const response = yield this.graphqlMutation(mutation, variables);
|
|
98
|
+
return response.addProductTag;
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.MarketPlaceService = MarketPlaceService;
|
|
@@ -92,4 +92,5 @@ export declare class ProductService extends Service {
|
|
|
92
92
|
getProductMarketplaceDetailBySlug(storeChannel: string, slug: string): Promise<any>;
|
|
93
93
|
getProductMarketplaceDetailById(storeChannel: string, id: string): Promise<any>;
|
|
94
94
|
getProductMarketplaceBySupplier(dataQuery: any): Promise<any>;
|
|
95
|
+
getProductSimpleByHandle(handle: string, store: string, fields: string[]): Promise<any>;
|
|
95
96
|
}
|
|
@@ -1074,5 +1074,23 @@ class ProductService extends serviceSDK_1.Service {
|
|
|
1074
1074
|
}
|
|
1075
1075
|
});
|
|
1076
1076
|
}
|
|
1077
|
+
getProductSimpleByHandle(handle, store, fields) {
|
|
1078
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1079
|
+
const query = (0, queries_1.GET_PRODUCT_SIMPLE_BY_HANDLE_DYNAMIC)(fields);
|
|
1080
|
+
const variablesHandle = {
|
|
1081
|
+
partnerId: this.orgId,
|
|
1082
|
+
storeChannel: store ? store : this.storeId,
|
|
1083
|
+
handle,
|
|
1084
|
+
};
|
|
1085
|
+
try {
|
|
1086
|
+
const response = yield this.graphqlQuery(query, variablesHandle);
|
|
1087
|
+
return response.getProductSimpleByHandle;
|
|
1088
|
+
}
|
|
1089
|
+
catch (error) {
|
|
1090
|
+
console.log(`Error fetching getProductSimpleByHandle : ${error}`);
|
|
1091
|
+
throw error;
|
|
1092
|
+
}
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1077
1095
|
}
|
|
1078
1096
|
exports.ProductService = ProductService;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longvansoftware/storefront-js-client",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.4",
|
|
4
4
|
"main": "dist/src/index.js",
|
|
5
5
|
"types": "dist/src/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -39,5 +39,6 @@
|
|
|
39
39
|
"ts-jest": "^29.1.2",
|
|
40
40
|
"typescript": "^5.4.5"
|
|
41
41
|
},
|
|
42
|
-
"description": ""
|
|
42
|
+
"description": "",
|
|
43
|
+
"packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
|
|
43
44
|
}
|