@vue-storefront/next 1.1.1-rc.2 → 2.0.0

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/CHANGELOG.md CHANGED
@@ -1,8 +1,13 @@
1
1
  # Change log
2
2
 
3
+ ## 2.0.0
4
+
5
+ - **[CHANGED]** Updated the `@vue-storefront/sdk` dependency to version `2.0.0`.
6
+ - **[ADDED]** `defaults` property to the injected context
7
+
3
8
  ## 1.1.1
4
9
 
5
- - **[FIXED]** "The inferred type of 'SckProvider' cannot be named without a reference to (...)" error when calling `createSdkContext`.
10
+ - **[FIXED]** "The inferred type of 'SdkProvider' cannot be named without a reference to (...)" error when calling `createSdkContext`.
6
11
 
7
12
  ## 1.1.0
8
13
 
package/dist/client.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { SDKApi } from '@vue-storefront/sdk';
2
- import { b as CreateSdkContextReturn } from './types-C_UwxYcn.mjs';
2
+ import { b as CreateSdkContextReturn } from './types-6cqVOIZW.mjs';
3
3
  import 'react';
4
4
 
5
5
  /**
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { SDKApi } from '@vue-storefront/sdk';
2
- import { b as CreateSdkContextReturn } from './types-C_UwxYcn.js';
2
+ import { b as CreateSdkContextReturn } from './types-6cqVOIZW.js';
3
3
  import 'react';
4
4
 
5
5
  /**
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as Config, a as CreateSdkReturn } from './types-C_UwxYcn.mjs';
1
+ import { C as Config, a as CreateSdkReturn } from './types-6cqVOIZW.mjs';
2
2
  import '@vue-storefront/sdk';
3
3
  import 'react';
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { C as Config, a as CreateSdkReturn } from './types-C_UwxYcn.js';
1
+ import { C as Config, a as CreateSdkReturn } from './types-6cqVOIZW.js';
2
2
  import '@vue-storefront/sdk';
3
3
  import 'react';
4
4
 
package/dist/index.js CHANGED
@@ -78,6 +78,28 @@ function composeMiddlewareUrl({
78
78
  return removeTrailingSlash(url);
79
79
  }
80
80
 
81
+ // ../../shared/src/helpers/defaultConfigs.ts
82
+ var contextConfig = {
83
+ unifiedCommerce: {
84
+ middlewareModule: {
85
+ defaultMethodsRequestConfig: {
86
+ getCategories: { method: "GET" },
87
+ getProductDetails: { method: "GET" },
88
+ getProductReviews: { method: "GET" },
89
+ getProducts: { method: "GET" },
90
+ searchProducts: { method: "GET" }
91
+ }
92
+ }
93
+ },
94
+ unifiedCms: {
95
+ middlewareModule: {
96
+ defaultMethodsRequestConfig: {
97
+ getEntries: { method: "GET" }
98
+ }
99
+ }
100
+ }
101
+ };
102
+
81
103
  // src/sdk/index.tsx
82
104
  var import_sdk = require("@vue-storefront/sdk");
83
105
 
@@ -110,6 +132,7 @@ function createSdk(options, configDefinition) {
110
132
  headers: getRequestHeaders()
111
133
  });
112
134
  const resolvedConfig = configDefinition({
135
+ defaults: contextConfig,
113
136
  buildModule: import_sdk.buildModule,
114
137
  middlewareModule: import_sdk.middlewareModule,
115
138
  getRequestHeaders,
package/dist/index.mjs CHANGED
@@ -41,6 +41,28 @@ function composeMiddlewareUrl({
41
41
  return removeTrailingSlash(url);
42
42
  }
43
43
 
44
+ // ../../shared/src/helpers/defaultConfigs.ts
45
+ var contextConfig = {
46
+ unifiedCommerce: {
47
+ middlewareModule: {
48
+ defaultMethodsRequestConfig: {
49
+ getCategories: { method: "GET" },
50
+ getProductDetails: { method: "GET" },
51
+ getProductReviews: { method: "GET" },
52
+ getProducts: { method: "GET" },
53
+ searchProducts: { method: "GET" }
54
+ }
55
+ }
56
+ },
57
+ unifiedCms: {
58
+ middlewareModule: {
59
+ defaultMethodsRequestConfig: {
60
+ getEntries: { method: "GET" }
61
+ }
62
+ }
63
+ }
64
+ };
65
+
44
66
  // src/sdk/index.tsx
45
67
  import { buildModule, initSDK, middlewareModule } from "@vue-storefront/sdk";
46
68
 
@@ -73,6 +95,7 @@ function createSdk(options, configDefinition) {
73
95
  headers: getRequestHeaders()
74
96
  });
75
97
  const resolvedConfig = configDefinition({
98
+ defaults: contextConfig,
76
99
  buildModule,
77
100
  middlewareModule,
78
101
  getRequestHeaders,
@@ -1,6 +1,39 @@
1
1
  import { SDKApi, buildModule, middlewareModule } from '@vue-storefront/sdk';
2
2
  import { ReactNode } from 'react';
3
3
 
4
+ declare const contextConfig: {
5
+ readonly unifiedCommerce: {
6
+ readonly middlewareModule: {
7
+ readonly defaultMethodsRequestConfig: {
8
+ readonly getCategories: {
9
+ readonly method: "GET";
10
+ };
11
+ readonly getProductDetails: {
12
+ readonly method: "GET";
13
+ };
14
+ readonly getProductReviews: {
15
+ readonly method: "GET";
16
+ };
17
+ readonly getProducts: {
18
+ readonly method: "GET";
19
+ };
20
+ readonly searchProducts: {
21
+ readonly method: "GET";
22
+ };
23
+ };
24
+ };
25
+ };
26
+ readonly unifiedCms: {
27
+ readonly middlewareModule: {
28
+ readonly defaultMethodsRequestConfig: {
29
+ readonly getEntries: {
30
+ readonly method: "GET";
31
+ };
32
+ };
33
+ };
34
+ };
35
+ };
36
+
4
37
  type GetSdkContext = {
5
38
  /**
6
39
  * A function that returns the request headers.
@@ -14,6 +47,7 @@ type StaticContext = {
14
47
  buildModule: typeof buildModule;
15
48
  middlewareModule: typeof middlewareModule;
16
49
  middlewareUrl: string;
50
+ defaults: typeof contextConfig;
17
51
  };
18
52
  type InjectedContext = DynamicContext & StaticContext;
19
53
  type Config<TConfig> = (context: InjectedContext) => TConfig;
@@ -1,6 +1,39 @@
1
1
  import { SDKApi, buildModule, middlewareModule } from '@vue-storefront/sdk';
2
2
  import { ReactNode } from 'react';
3
3
 
4
+ declare const contextConfig: {
5
+ readonly unifiedCommerce: {
6
+ readonly middlewareModule: {
7
+ readonly defaultMethodsRequestConfig: {
8
+ readonly getCategories: {
9
+ readonly method: "GET";
10
+ };
11
+ readonly getProductDetails: {
12
+ readonly method: "GET";
13
+ };
14
+ readonly getProductReviews: {
15
+ readonly method: "GET";
16
+ };
17
+ readonly getProducts: {
18
+ readonly method: "GET";
19
+ };
20
+ readonly searchProducts: {
21
+ readonly method: "GET";
22
+ };
23
+ };
24
+ };
25
+ };
26
+ readonly unifiedCms: {
27
+ readonly middlewareModule: {
28
+ readonly defaultMethodsRequestConfig: {
29
+ readonly getEntries: {
30
+ readonly method: "GET";
31
+ };
32
+ };
33
+ };
34
+ };
35
+ };
36
+
4
37
  type GetSdkContext = {
5
38
  /**
6
39
  * A function that returns the request headers.
@@ -14,6 +47,7 @@ type StaticContext = {
14
47
  buildModule: typeof buildModule;
15
48
  middlewareModule: typeof middlewareModule;
16
49
  middlewareUrl: string;
50
+ defaults: typeof contextConfig;
17
51
  };
18
52
  type InjectedContext = DynamicContext & StaticContext;
19
53
  type Config<TConfig> = (context: InjectedContext) => TConfig;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@vue-storefront/next",
3
3
  "description": "Vue Storefront dedicated features for Next.js",
4
4
  "license": "MIT",
5
- "version": "1.1.1-rc.2",
5
+ "version": "2.0.0",
6
6
  "exports": {
7
7
  ".": {
8
8
  "import": "./dist/index.mjs",
@@ -43,7 +43,7 @@
43
43
  "test:unit": "vitest run"
44
44
  },
45
45
  "dependencies": {
46
- "@vue-storefront/sdk": "^1.4.0"
46
+ "@vue-storefront/sdk": "^2.0.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/react": "^18.2.31",
@@ -54,8 +54,8 @@
54
54
  "vitest": "^0.34.6"
55
55
  },
56
56
  "peerDependencies": {
57
- "react": "^18.2.0",
58
- "next": "^13.4.7 || ^14.0.0"
57
+ "next": "^13.4.7 || ^14.0.0",
58
+ "react": "^18.2.0"
59
59
  },
60
60
  "engines": {
61
61
  "npm": ">=8.0.0",