@graphcommerce/next-config 6.2.0-canary.72 → 6.2.0-canary.74

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,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 6.2.0-canary.74
4
+
5
+ ## 6.2.0-canary.73
6
+
3
7
  ## 6.2.0-canary.72
4
8
 
5
9
  ## 6.2.0-canary.71
@@ -26,4 +26,5 @@ exports.demoConfig = {
26
26
  limitSsg: true,
27
27
  compare: true,
28
28
  configurableVariantForSimple: true,
29
+ configurableVariantValues: { url: true, content: true },
29
30
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GraphCommerceStorefrontConfigSchema = exports.GraphCommerceDebugConfigSchema = exports.GraphCommerceConfigSchema = exports.ProductFiltersLayoutSchema = exports.CompareVariantSchema = exports.definedNonNullAnySchema = exports.isDefinedNonNullAny = void 0;
3
+ exports.MagentoConfigurableVariantValuesSchema = exports.GraphCommerceStorefrontConfigSchema = exports.GraphCommerceDebugConfigSchema = exports.GraphCommerceConfigSchema = exports.ProductFiltersLayoutSchema = exports.CompareVariantSchema = exports.definedNonNullAnySchema = exports.isDefinedNonNullAny = void 0;
4
4
  /* eslint-disable */
5
5
  const zod_1 = require("zod");
6
6
  const isDefinedNonNullAny = (v) => v !== undefined && v !== null;
@@ -15,6 +15,7 @@ function GraphCommerceConfigSchema() {
15
15
  compare: zod_1.z.boolean().nullish(),
16
16
  compareVariant: exports.CompareVariantSchema.nullish(),
17
17
  configurableVariantForSimple: zod_1.z.boolean().nullish(),
18
+ configurableVariantValues: MagentoConfigurableVariantValuesSchema().nullish(),
18
19
  customerRequireEmailConfirmation: zod_1.z.boolean().nullish(),
19
20
  debug: GraphCommerceDebugConfigSchema().nullish(),
20
21
  demoMode: zod_1.z.boolean().nullish(),
@@ -63,3 +64,10 @@ function GraphCommerceStorefrontConfigSchema() {
63
64
  });
64
65
  }
65
66
  exports.GraphCommerceStorefrontConfigSchema = GraphCommerceStorefrontConfigSchema;
67
+ function MagentoConfigurableVariantValuesSchema() {
68
+ return zod_1.z.object({
69
+ content: zod_1.z.boolean().nullish(),
70
+ url: zod_1.z.boolean().nullish()
71
+ });
72
+ }
73
+ exports.MagentoConfigurableVariantValuesSchema = MagentoConfigurableVariantValuesSchema;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/next-config",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "6.2.0-canary.72",
5
+ "version": "6.2.0-canary.74",
6
6
  "type": "commonjs",
7
7
  "main": "dist/index.js",
8
8
  "types": "src/index.ts",
@@ -27,5 +27,7 @@ export const demoConfig: PartialDeep<GraphCommerceConfig, { recurseIntoArrays: t
27
27
  demoMode: true,
28
28
  limitSsg: true,
29
29
  compare: true,
30
+
30
31
  configurableVariantForSimple: true,
32
+ configurableVariantValues: { url: true, content: true },
31
33
  }
@@ -133,6 +133,12 @@ export type GraphCommerceConfig = {
133
133
  * the options to select the simple product are pre-selected.
134
134
  */
135
135
  configurableVariantForSimple?: InputMaybe<Scalars['Boolean']['input']>;
136
+ /**
137
+ * When a user selects a variant, it will switch the values on the configurable page with the values of the configured variant.
138
+ *
139
+ * Enabling options here will allow switching of those variants.
140
+ */
141
+ configurableVariantValues?: InputMaybe<MagentoConfigurableVariantValues>;
136
142
  /**
137
143
  * Due to a limitation in the GraphQL API of Magento 2, we need to know if the
138
144
  * customer requires email confirmation.
@@ -341,6 +347,18 @@ export type GraphCommerceStorefrontConfig = {
341
347
  magentoStoreCode: Scalars['String']['input'];
342
348
  };
343
349
 
350
+ /** Options to configure which values will be replaced when a variant is selected on the product page. */
351
+ export type MagentoConfigurableVariantValues = {
352
+ /** Use the name, description, short description and meta data from the configured variant */
353
+ content?: InputMaybe<Scalars['Boolean']['input']>;
354
+ /**
355
+ * When a variant is selected the URL of the product will be changed in the address bar.
356
+ *
357
+ * This only happens when the actual variant is can be accessed by the URL.
358
+ */
359
+ url?: InputMaybe<Scalars['Boolean']['input']>;
360
+ };
361
+
344
362
  export type ProductFiltersLayout =
345
363
  | 'DEFAULT'
346
364
  | 'SIDEBAR';
@@ -367,6 +385,7 @@ export function GraphCommerceConfigSchema(): z.ZodObject<Properties<GraphCommerc
367
385
  compare: z.boolean().nullish(),
368
386
  compareVariant: CompareVariantSchema.nullish(),
369
387
  configurableVariantForSimple: z.boolean().nullish(),
388
+ configurableVariantValues: MagentoConfigurableVariantValuesSchema().nullish(),
370
389
  customerRequireEmailConfirmation: z.boolean().nullish(),
371
390
  debug: GraphCommerceDebugConfigSchema().nullish(),
372
391
  demoMode: z.boolean().nullish(),
@@ -414,3 +433,10 @@ export function GraphCommerceStorefrontConfigSchema(): z.ZodObject<Properties<Gr
414
433
  magentoStoreCode: z.string().min(1)
415
434
  })
416
435
  }
436
+
437
+ export function MagentoConfigurableVariantValuesSchema(): z.ZodObject<Properties<MagentoConfigurableVariantValues>> {
438
+ return z.object({
439
+ content: z.boolean().nullish(),
440
+ url: z.boolean().nullish()
441
+ })
442
+ }
package/src/index.ts CHANGED
@@ -11,8 +11,11 @@ export type PluginProps<P extends Record<string, unknown> = Record<string, unkno
11
11
  Prev: React.FC<P>
12
12
  }
13
13
 
14
- export type ReactPlugin<T extends React.FC<any>> = (
15
- props: Parameters<T>[0] & { Prev: React.FC<Parameters<T>[0]> },
14
+ export type ReactPlugin<
15
+ T extends React.FC<any>,
16
+ AdditionalOptionalProps extends Record<string, unknown> = Record<string, unknown>,
17
+ > = (
18
+ props: Parameters<T>[0] & AdditionalOptionalProps & { Prev: React.FC<Parameters<T>[0]> },
16
19
  ) => ReturnType<T>
17
20
 
18
21
  export type MethodPlugin<T extends (...args: any[]) => any> = (