@blackfisk/blackfisk-vue-storefront-api 1.0.2 → 1.0.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/License.md +21 -0
- package/lib/api/getProductCollection/index.d.ts +7 -5
- package/lib/api/getProductCollection/index.d.ts.map +1 -1
- package/lib/api/index.d.ts +0 -2
- package/lib/api/index.d.ts.map +1 -1
- package/lib/index.server.d.ts.map +1 -1
- package/lib/types/api/endpoints.d.ts +1 -4
- package/lib/types/api/endpoints.d.ts.map +1 -1
- package/lib/types/api/index.d.ts +60 -0
- package/lib/types/api/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/server/api/getProductCollection/index.d.ts +7 -5
- package/server/api/getProductCollection/index.d.ts.map +1 -1
- package/server/api/index.d.ts +0 -2
- package/server/api/index.d.ts.map +1 -1
- package/server/index.js +19 -41
- package/server/index.js.map +1 -1
- package/server/index.server.d.ts.map +1 -1
- package/server/types/api/endpoints.d.ts +1 -4
- package/server/types/api/endpoints.d.ts.map +1 -1
- package/server/types/api/index.d.ts +60 -0
- package/server/types/api/index.d.ts.map +1 -1
- package/lib/api/exampleEndpoint/index.d.ts +0 -3
- package/lib/api/exampleEndpoint/index.d.ts.map +0 -1
- package/lib/api/getPageContent/index.d.ts +0 -15
- package/lib/api/getPageContent/index.d.ts.map +0 -1
- package/server/api/exampleEndpoint/index.d.ts +0 -3
- package/server/api/exampleEndpoint/index.d.ts.map +0 -1
- package/server/api/getPageContent/index.d.ts +0 -15
- package/server/api/getPageContent/index.d.ts.map +0 -1
package/License.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Vue Storefront
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { Endpoints } from '../../types';
|
|
1
|
+
import { Endpoints, SearchProduct } from '../../types';
|
|
2
|
+
export interface getProductCollectionTemplateParams {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
2
5
|
export interface getProductCollectionParams {
|
|
3
6
|
collectionId: number | string;
|
|
7
|
+
templateParams?: getProductCollectionTemplateParams;
|
|
8
|
+
debug?: boolean;
|
|
4
9
|
}
|
|
5
10
|
export interface getProductCollectionResponse {
|
|
6
|
-
data:
|
|
7
|
-
content: {};
|
|
8
|
-
meta: {};
|
|
9
|
-
};
|
|
11
|
+
data: SearchProduct[];
|
|
10
12
|
}
|
|
11
13
|
export declare const getProductCollection: Endpoints['getProductCollection'];
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/getProductCollection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/getProductCollection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACvD,MAAM,WAAW,kCAAkC;IACjD,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AACD,MAAM,WAAW,0BAA0B;IACzC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,kCAAkC,CAAC;IACpD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AACD,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,aAAa,EAAE,CAAC;CACvB;AACD,eAAO,MAAM,oBAAoB,EAAE,SAAS,CAAC,sBAAsB,CA0BlE,CAAC"}
|
package/lib/api/index.d.ts
CHANGED
package/lib/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":"AAqCA,QAAA,MAAQ,eAAe,kEAGrB,CAAC;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BfskIntegrationContext
|
|
2
|
-
import { getPageContentParams, getPageContentResponse } from '../../api/getPageContent/index';
|
|
1
|
+
import { BfskIntegrationContext } from '..';
|
|
3
2
|
import { getProductCollectionParams, getProductCollectionResponse } from '../../api/getProductCollection/index';
|
|
4
3
|
/**
|
|
5
4
|
* Definition of all API-client methods available in {@link https://docs.vuestorefront.io/v2/advanced/context.html#context-api | context}.
|
|
@@ -9,8 +8,6 @@ export interface Endpoints {
|
|
|
9
8
|
* Here you can find an example endpoint definition. Based on this example, you should define how your endpoint will look like.
|
|
10
9
|
* This description will appear in the API extractor, so try to document all endpoints added here.
|
|
11
10
|
*/
|
|
12
|
-
exampleEndpoint(context: BfskIntegrationContext, params: TODO): Promise<TODO>;
|
|
13
|
-
getPageContent(context: BfskIntegrationContext, params: getPageContentParams): Promise<getPageContentResponse>;
|
|
14
11
|
getProductCollection(context: BfskIntegrationContext, params: getProductCollectionParams): Promise<getProductCollectionResponse>;
|
|
15
12
|
}
|
|
16
13
|
//# sourceMappingURL=endpoints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../src/types/api/endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../src/types/api/endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAQ,MAAM,IAAI,CAAA;AACjD,OAAO,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAA;AAE/G;;GAEG;AACH,MAAM,WAAW,SAAS;IAExB;;;OAGG;IACH,oBAAoB,CAAC,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;CAClI"}
|
package/lib/types/api/index.d.ts
CHANGED
|
@@ -1,2 +1,62 @@
|
|
|
1
|
+
export interface SearchProductAttribute {
|
|
2
|
+
id: number;
|
|
3
|
+
name: string;
|
|
4
|
+
valueJSON: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SearchProductAttributeTypes {
|
|
7
|
+
facets: SearchProductAttribute[];
|
|
8
|
+
misc: SearchProductAttribute[];
|
|
9
|
+
specifications: SearchProductAttribute[];
|
|
10
|
+
variants: SearchProductAttribute[];
|
|
11
|
+
}
|
|
12
|
+
export interface SearchProductCondition {
|
|
13
|
+
id: number;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SearchProductImage {
|
|
18
|
+
url: string;
|
|
19
|
+
public_id: string;
|
|
20
|
+
isPrimary: number;
|
|
21
|
+
alt: string;
|
|
22
|
+
}
|
|
23
|
+
export interface SearchProductMeta {
|
|
24
|
+
}
|
|
25
|
+
export interface SearchProduct {
|
|
26
|
+
id: number;
|
|
27
|
+
accountId: number;
|
|
28
|
+
attributeListValues: string[];
|
|
29
|
+
attributeValues: string[];
|
|
30
|
+
attributes: SearchProductAttributeTypes;
|
|
31
|
+
brandId: number;
|
|
32
|
+
brandName: string;
|
|
33
|
+
categories: string[];
|
|
34
|
+
categoryIds: number[];
|
|
35
|
+
categoryName: string;
|
|
36
|
+
channelId: number;
|
|
37
|
+
colors: [];
|
|
38
|
+
condition: SearchProductCondition;
|
|
39
|
+
description: string;
|
|
40
|
+
familyId: number;
|
|
41
|
+
features: string[];
|
|
42
|
+
heading: string;
|
|
43
|
+
images: SearchProductImage[];
|
|
44
|
+
imagesCount: number;
|
|
45
|
+
isAvailable: boolean;
|
|
46
|
+
keywords: string[];
|
|
47
|
+
meta: SearchProductMeta;
|
|
48
|
+
metaDescription: string;
|
|
49
|
+
mpn: string;
|
|
50
|
+
parentName: string;
|
|
51
|
+
priceMAP: number;
|
|
52
|
+
priceSale: number;
|
|
53
|
+
pricingStrategy: string;
|
|
54
|
+
productName: string;
|
|
55
|
+
quantity: number;
|
|
56
|
+
sku: string;
|
|
57
|
+
slug: string;
|
|
58
|
+
title: string;
|
|
59
|
+
upc: string;
|
|
60
|
+
}
|
|
1
61
|
export * from './endpoints';
|
|
2
62
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/api/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,sBAAsB,EAAE,CAAC;IACjC,IAAI,EAAE,sBAAsB,EAAE,CAAC;IAC/B,cAAc,EAAE,sBAAsB,EAAE,CAAC;IACzC,QAAQ,EAAE,sBAAsB,EAAE,CAAC;CACpC;AACD,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;CACb;AACD,MAAM,WAAW,iBAAiB;CAAG;AACrC,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,UAAU,EAAE,2BAA2B,CAAC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,EAAE,CAAC;IACX,SAAS,EAAE,sBAAsB,CAAC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,kBAAkB,EAAE,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,IAAI,EAAE,iBAAiB,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AACD,cAAc,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blackfisk/blackfisk-vue-storefront-api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"server": "server/index.js",
|
|
6
6
|
"main": "lib/index.cjs.js",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"lib/**/*",
|
|
29
29
|
"server/**/*"
|
|
30
30
|
],
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "be6d7a7b779ae7025136bd8e093ca3d2284f1a9d"
|
|
32
32
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { Endpoints } from '../../types';
|
|
1
|
+
import { Endpoints, SearchProduct } from '../../types';
|
|
2
|
+
export interface getProductCollectionTemplateParams {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
}
|
|
2
5
|
export interface getProductCollectionParams {
|
|
3
6
|
collectionId: number | string;
|
|
7
|
+
templateParams?: getProductCollectionTemplateParams;
|
|
8
|
+
debug?: boolean;
|
|
4
9
|
}
|
|
5
10
|
export interface getProductCollectionResponse {
|
|
6
|
-
data:
|
|
7
|
-
content: {};
|
|
8
|
-
meta: {};
|
|
9
|
-
};
|
|
11
|
+
data: SearchProduct[];
|
|
10
12
|
}
|
|
11
13
|
export declare const getProductCollection: Endpoints['getProductCollection'];
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/getProductCollection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/getProductCollection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACvD,MAAM,WAAW,kCAAkC;IACjD,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AACD,MAAM,WAAW,0BAA0B;IACzC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,cAAc,CAAC,EAAE,kCAAkC,CAAC;IACpD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AACD,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,aAAa,EAAE,CAAC;CACvB;AACD,eAAO,MAAM,oBAAoB,EAAE,SAAS,CAAC,sBAAsB,CA0BlE,CAAC"}
|
package/server/api/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/server/index.js
CHANGED
|
@@ -9,54 +9,33 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
9
9
|
|
|
10
10
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
11
11
|
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
method: 'GET',
|
|
28
|
-
url: RequestURL.href,
|
|
29
|
-
});
|
|
30
|
-
console.log({ status, PageContentResponse: data });
|
|
31
|
-
const PageContent = data?.data?.[0] ?? {};
|
|
32
|
-
console.log({ PageContent });
|
|
33
|
-
return { data: PageContent };
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const getProductCollection = async (context, params) => {
|
|
37
|
-
console.log('getProductCollection has been called. It\'s now updated.');
|
|
12
|
+
const getProductCollection = async (context, params = {
|
|
13
|
+
collectionId: 0,
|
|
14
|
+
templateParams: {
|
|
15
|
+
id: 0,
|
|
16
|
+
ids: [],
|
|
17
|
+
term: '',
|
|
18
|
+
familyId: 0,
|
|
19
|
+
categoryId: 0,
|
|
20
|
+
brandId: 0,
|
|
21
|
+
pricingStrategy: '',
|
|
22
|
+
conditionId: 0,
|
|
23
|
+
limit: 0,
|
|
24
|
+
},
|
|
25
|
+
debug: false,
|
|
26
|
+
}) => {
|
|
38
27
|
const RequestURL = new URL('v2/vsf/productCollection', context.config.api.url);
|
|
39
|
-
if (!('collectionId' in params)) {
|
|
40
|
-
params['collectionId'] = 145;
|
|
41
|
-
}
|
|
42
|
-
for (const param in params) {
|
|
43
|
-
RequestURL.searchParams.set(param, params[param]);
|
|
44
|
-
}
|
|
45
|
-
console.log({ RequestURL });
|
|
46
28
|
const { data, status } = await context.client.request({
|
|
47
|
-
method: '
|
|
29
|
+
method: 'POST',
|
|
48
30
|
url: RequestURL.href,
|
|
31
|
+
data: params,
|
|
49
32
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
console.log({ PageContent });
|
|
53
|
-
return { data: PageContent };
|
|
33
|
+
const productCollection = (data?.data ?? []);
|
|
34
|
+
return { data: productCollection };
|
|
54
35
|
};
|
|
55
36
|
|
|
56
37
|
var apiEndpoints = /*#__PURE__*/Object.freeze({
|
|
57
38
|
__proto__: null,
|
|
58
|
-
exampleEndpoint: exampleEndpoint,
|
|
59
|
-
getPageContent: getPageContent,
|
|
60
39
|
getProductCollection: getProductCollection
|
|
61
40
|
});
|
|
62
41
|
|
|
@@ -84,7 +63,6 @@ const buildClient = (settings) => {
|
|
|
84
63
|
return axiosInstance;
|
|
85
64
|
};
|
|
86
65
|
const onCreate = (settings) => {
|
|
87
|
-
console.log({ settings });
|
|
88
66
|
const client = buildClient(settings);
|
|
89
67
|
return {
|
|
90
68
|
config: settings,
|
package/server/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/api/
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/api/getProductCollection/index.ts","../src/index.server.ts"],"sourcesContent":["import { Endpoints, SearchProduct } from '../../types';\nexport interface getProductCollectionTemplateParams {\n [key: string]: any,\n}\nexport interface getProductCollectionParams {\n collectionId: number | string,\n templateParams?: getProductCollectionTemplateParams,\n debug?: boolean,\n}\nexport interface getProductCollectionResponse {\n data: SearchProduct[],\n}\nexport const getProductCollection: Endpoints['getProductCollection'] = async (\n context,\n params: getProductCollectionParams = {\n collectionId: 0,\n templateParams: {\n id: 0,\n ids: [],\n term: '',\n familyId: 0,\n categoryId: 0,\n brandId: 0,\n pricingStrategy: '',\n conditionId: 0,\n limit: 0,\n },\n debug: false,\n }\n) => {\n const RequestURL = new URL('v2/vsf/productCollection', context.config.api.url);\n const { data, status } = await context.client.request({\n method: 'POST',\n url: RequestURL.href,\n data: params,\n })\n const productCollection = (data?.data ?? [])\n return { data: productCollection };\n};\n","import axios from 'axios';\nimport { apiClientFactory } from '@vue-storefront/middleware';\nimport { MiddlewareConfig } from './index';\nimport * as apiEndpoints from './api';\n\n/**\n * In here you should create the client you'll use to communicate with the backend.\n * Axios is just an example.\n */\nconst buildClient = (settings: MiddlewareConfig) => {\n const defaultSettings = {\n accountId: 0,\n channelId: 0,\n accountSiteId: 0,\n baseURL: '',\n }\n const axiosInstance = axios.create({\n baseURL: settings.api.url || defaultSettings.baseURL,\n // baseURL: settings.api.url,\n headers: {\n 'X-Account-Id': settings.accountId || defaultSettings.accountId,\n 'X-Channel-Id': settings.channelId || defaultSettings.channelId,\n 'X-Site-Id': settings.accountSiteId || defaultSettings.accountSiteId,\n authorization: `${settings.api.auth_jwt || process.env.SECURITY_TOKEN || ''}`\n },\n });\n return axiosInstance\n}\n\nconst onCreate = (settings: MiddlewareConfig) => {\n const client = buildClient(settings);\n return {\n config: settings,\n client\n };\n};\n\nconst { createApiClient } = apiClientFactory<any, any>({\n onCreate,\n api: apiEndpoints,\n});\n\nexport { createApiClient };\n"],"names":["axios","apiClientFactory"],"mappings":";;;;;;;;;;;AAYO,MAAM,oBAAoB,GAAsC,OACrE,OAAO,EACP,MAAqC,GAAA;AACnC,IAAA,YAAY,EAAE,CAAC;AACf,IAAA,cAAc,EAAE;AACd,QAAA,EAAE,EAAE,CAAC;AACL,QAAA,GAAG,EAAE,EAAE;AACP,QAAA,IAAI,EAAE,EAAE;AACR,QAAA,QAAQ,EAAE,CAAC;AACX,QAAA,UAAU,EAAE,CAAC;AACb,QAAA,OAAO,EAAE,CAAC;AACV,QAAA,eAAe,EAAE,EAAE;AACnB,QAAA,WAAW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CAAC,GAAG,CAAC,cAAc,IAAI,EAAE,CAAE,CAAA;AAC9E,SAAA;AACF,KAAA,CAAC,CAAC;AACH,IAAA,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,QAA0B,KAAI;AAC9C,IAAA,MAAM,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAC;IACrC,OAAO;AACL,QAAA,MAAM,EAAE,QAAQ;QAChB,MAAM;KACP,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,EAAE,eAAe,EAAE,GAAGC,2BAAgB,CAAW;IACrD,QAAQ;AACR,IAAA,GAAG,EAAE,YAAY;AAClB,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../src/index.server.ts"],"names":[],"mappings":"AAqCA,QAAA,MAAQ,eAAe,kEAGrB,CAAC;AAEH,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BfskIntegrationContext
|
|
2
|
-
import { getPageContentParams, getPageContentResponse } from '../../api/getPageContent/index';
|
|
1
|
+
import { BfskIntegrationContext } from '..';
|
|
3
2
|
import { getProductCollectionParams, getProductCollectionResponse } from '../../api/getProductCollection/index';
|
|
4
3
|
/**
|
|
5
4
|
* Definition of all API-client methods available in {@link https://docs.vuestorefront.io/v2/advanced/context.html#context-api | context}.
|
|
@@ -9,8 +8,6 @@ export interface Endpoints {
|
|
|
9
8
|
* Here you can find an example endpoint definition. Based on this example, you should define how your endpoint will look like.
|
|
10
9
|
* This description will appear in the API extractor, so try to document all endpoints added here.
|
|
11
10
|
*/
|
|
12
|
-
exampleEndpoint(context: BfskIntegrationContext, params: TODO): Promise<TODO>;
|
|
13
|
-
getPageContent(context: BfskIntegrationContext, params: getPageContentParams): Promise<getPageContentResponse>;
|
|
14
11
|
getProductCollection(context: BfskIntegrationContext, params: getProductCollectionParams): Promise<getProductCollectionResponse>;
|
|
15
12
|
}
|
|
16
13
|
//# sourceMappingURL=endpoints.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../src/types/api/endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../src/types/api/endpoints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAQ,MAAM,IAAI,CAAA;AACjD,OAAO,EAAE,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,sCAAsC,CAAA;AAE/G;;GAEG;AACH,MAAM,WAAW,SAAS;IAExB;;;OAGG;IACH,oBAAoB,CAAC,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;CAClI"}
|
|
@@ -1,2 +1,62 @@
|
|
|
1
|
+
export interface SearchProductAttribute {
|
|
2
|
+
id: number;
|
|
3
|
+
name: string;
|
|
4
|
+
valueJSON: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SearchProductAttributeTypes {
|
|
7
|
+
facets: SearchProductAttribute[];
|
|
8
|
+
misc: SearchProductAttribute[];
|
|
9
|
+
specifications: SearchProductAttribute[];
|
|
10
|
+
variants: SearchProductAttribute[];
|
|
11
|
+
}
|
|
12
|
+
export interface SearchProductCondition {
|
|
13
|
+
id: number;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SearchProductImage {
|
|
18
|
+
url: string;
|
|
19
|
+
public_id: string;
|
|
20
|
+
isPrimary: number;
|
|
21
|
+
alt: string;
|
|
22
|
+
}
|
|
23
|
+
export interface SearchProductMeta {
|
|
24
|
+
}
|
|
25
|
+
export interface SearchProduct {
|
|
26
|
+
id: number;
|
|
27
|
+
accountId: number;
|
|
28
|
+
attributeListValues: string[];
|
|
29
|
+
attributeValues: string[];
|
|
30
|
+
attributes: SearchProductAttributeTypes;
|
|
31
|
+
brandId: number;
|
|
32
|
+
brandName: string;
|
|
33
|
+
categories: string[];
|
|
34
|
+
categoryIds: number[];
|
|
35
|
+
categoryName: string;
|
|
36
|
+
channelId: number;
|
|
37
|
+
colors: [];
|
|
38
|
+
condition: SearchProductCondition;
|
|
39
|
+
description: string;
|
|
40
|
+
familyId: number;
|
|
41
|
+
features: string[];
|
|
42
|
+
heading: string;
|
|
43
|
+
images: SearchProductImage[];
|
|
44
|
+
imagesCount: number;
|
|
45
|
+
isAvailable: boolean;
|
|
46
|
+
keywords: string[];
|
|
47
|
+
meta: SearchProductMeta;
|
|
48
|
+
metaDescription: string;
|
|
49
|
+
mpn: string;
|
|
50
|
+
parentName: string;
|
|
51
|
+
priceMAP: number;
|
|
52
|
+
priceSale: number;
|
|
53
|
+
pricingStrategy: string;
|
|
54
|
+
productName: string;
|
|
55
|
+
quantity: number;
|
|
56
|
+
sku: string;
|
|
57
|
+
slug: string;
|
|
58
|
+
title: string;
|
|
59
|
+
upc: string;
|
|
60
|
+
}
|
|
1
61
|
export * from './endpoints';
|
|
2
62
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/types/api/index.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,sBAAsB,EAAE,CAAC;IACjC,IAAI,EAAE,s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AM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AACD,cAAc,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/exampleEndpoint/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,iBAAiB,CASxD,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Endpoints } from '../../types';
|
|
2
|
-
export interface getPageContentParams {
|
|
3
|
-
typeId: number;
|
|
4
|
-
referenceId: string;
|
|
5
|
-
collectionId: number;
|
|
6
|
-
slug: string;
|
|
7
|
-
}
|
|
8
|
-
export interface getPageContentResponse {
|
|
9
|
-
data: {
|
|
10
|
-
content: {};
|
|
11
|
-
meta: {};
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export declare const getPageContent: Endpoints['getPageContent'];
|
|
15
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/getPageContent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AACD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE;QACJ,OAAO,EAAE,EAAE,CAAC;QACZ,IAAI,EAAE,EAAE,CAAC;KACV,CAAC;CACH;AACD,eAAO,MAAM,cAAc,EAAE,SAAS,CAAC,gBAAgB,CAkBtD,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/exampleEndpoint/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,iBAAiB,CASxD,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Endpoints } from '../../types';
|
|
2
|
-
export interface getPageContentParams {
|
|
3
|
-
typeId: number;
|
|
4
|
-
referenceId: string;
|
|
5
|
-
collectionId: number;
|
|
6
|
-
slug: string;
|
|
7
|
-
}
|
|
8
|
-
export interface getPageContentResponse {
|
|
9
|
-
data: {
|
|
10
|
-
content: {};
|
|
11
|
-
meta: {};
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export declare const getPageContent: Endpoints['getPageContent'];
|
|
15
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/api/getPageContent/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;CACd;AACD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE;QACJ,OAAO,EAAE,EAAE,CAAC;QACZ,IAAI,EAAE,EAAE,CAAC;KACV,CAAC;CACH;AACD,eAAO,MAAM,cAAc,EAAE,SAAS,CAAC,gBAAgB,CAkBtD,CAAC"}
|