@graphcommerce/next-config 8.1.0-canary.40 → 8.1.0-canary.42

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,15 @@
1
1
  # Change Log
2
2
 
3
+ ## 8.1.0-canary.42
4
+
5
+ ## 8.1.0-canary.41
6
+
7
+ ### Patch Changes
8
+
9
+ - [#2242](https://github.com/graphcommerce-org/graphcommerce/pull/2242) [`a4cce76`](https://github.com/graphcommerce-org/graphcommerce/commit/a4cce76ca37af2bec604e953ada4bb11bd91f55d) - Add option to show an extended version of the pagination component. Configurable via the "productListPaginationVariant" key in your graphcommerce.config.js
10
+ COMPACT means: "< Page X of Y >"
11
+ EXTENDED means: "< 1 2 ... [5] ... 10 11 >" ([@FrankHarland](https://github.com/FrankHarland))
12
+
3
13
  ## 8.1.0-canary.40
4
14
 
5
15
  ### Minor Changes
@@ -62,6 +62,7 @@ exports[`traverses a schema and returns a list of env variables that match 1`] =
62
62
  "GC_PREVIEW_SECRET",
63
63
  "GC_PRODUCT_FILTERS_LAYOUT",
64
64
  "GC_PRODUCT_FILTERS_PRO",
65
+ "GC_PRODUCT_LIST_PAGINATION_VARIANT",
65
66
  "GC_PRODUCT_ROUTE",
66
67
  "GC_RECENTLY_VIEWED_PRODUCTS",
67
68
  "GC_RECENTLY_VIEWED_PRODUCTS_ENABLED",
@@ -163,6 +163,14 @@ it('finds plugins', () => {
163
163
  "targetModule": "@graphcommerce/magento-product",
164
164
  "type": "component",
165
165
  },
166
+ {
167
+ "enabled": true,
168
+ "sourceExport": "previewModeDefaults",
169
+ "sourceModule": "@graphcommerce/graphcms-ui/plugins/hygraphPreviewModeDefaults",
170
+ "targetExport": "previewModeDefaults",
171
+ "targetModule": "@graphcommerce/ecommerce-ui",
172
+ "type": "function",
173
+ },
166
174
  {
167
175
  "enabled": true,
168
176
  "sourceExport": "plugin",
@@ -171,6 +179,14 @@ it('finds plugins', () => {
171
179
  "targetModule": "@graphcommerce/graphql",
172
180
  "type": "function",
173
181
  },
182
+ {
183
+ "enabled": true,
184
+ "sourceExport": "PreviewModeToolbar",
185
+ "sourceModule": "@graphcommerce/graphcms-ui/plugins/HygraphPreviewModeToolbar",
186
+ "targetExport": "PreviewModeToolbar",
187
+ "targetModule": "@graphcommerce/ecommerce-ui",
188
+ "type": "component",
189
+ },
174
190
  {
175
191
  "enabled": true,
176
192
  "sourceExport": "plugin",
@@ -397,6 +413,15 @@ it('finds plugins', () => {
397
413
  "targetModule": "@graphcommerce/magento-product",
398
414
  "type": "component",
399
415
  },
416
+ {
417
+ "enabled": false,
418
+ "ifConfig": "previewSecret",
419
+ "sourceExport": "FramerNextPages",
420
+ "sourceModule": "@graphcommerce/ecommerce-ui/plugins/PreviewModeFramerNextPages",
421
+ "targetExport": "FramerNextPages",
422
+ "targetModule": "@graphcommerce/framer-next-pages",
423
+ "type": "component",
424
+ },
400
425
  {
401
426
  "enabled": false,
402
427
  "ifConfig": "googleTagmanagerId",
@@ -405,21 +405,31 @@ it('adds debug logging to interceptors for components', async () => {
405
405
  expectOriginal(interceptors['packages/graphql/config']?.template).toMatchInlineSnapshot(`
406
406
  "import { ApolloLink, TypePolicies } from '@apollo/client'
407
407
  import type { GraphCommerceStorefrontConfig } from '@graphcommerce/next-config'
408
+ import type { SetRequired } from 'type-fest'
408
409
  import { MigrateCache } from './components/GraphQLProvider/migrateCache'
410
+ export interface PreviewData {}
411
+ export type PreviewConfig = {
412
+ preview?: boolean
413
+ previewData?: PreviewData & Record<string, unknown>
414
+ }
409
415
  export type ApolloClientConfigInput = {
410
416
  storefront: GraphCommerceStorefrontConfig
411
417
  links?: ApolloLink[]
412
418
  policies?: TypePolicies[]
413
419
  migrations?: MigrateCache[]
414
- }
415
- export type ApolloClientConfig = Required<ApolloClientConfigInput>
420
+ } & PreviewConfig
421
+ export type ApolloClientConfig = SetRequired<
422
+ ApolloClientConfigInput,
423
+ 'links' | 'policies' | 'migrations'
424
+ >
416
425
  export function graphqlConfigOriginal(config: ApolloClientConfigInput): ApolloClientConfig {
417
- const { storefront, links = [], policies = [], migrations = [] } = config
426
+ const { storefront, links = [], policies = [], migrations = [], ...rest } = config
418
427
  return {
419
428
  storefront,
420
429
  links,
421
430
  policies,
422
431
  migrations,
432
+ ...rest,
423
433
  }
424
434
  }"
425
435
  `)
@@ -36,6 +36,7 @@ exports.demoConfig = {
36
36
  ],
37
37
  productFiltersPro: true,
38
38
  productFiltersLayout: 'DEFAULT',
39
+ productListPaginationVariant: 'COMPACT',
39
40
  compareVariant: 'ICON',
40
41
  robotsAllow: false,
41
42
  demoMode: true,
@@ -47,4 +48,5 @@ exports.demoConfig = {
47
48
  recentlyViewedProducts: { enabled: true, maxCount: 20 },
48
49
  breadcrumbs: false,
49
50
  customerDeleteEnabled: true,
51
+ previewSecret: 'SECRET',
50
52
  };
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SidebarGalleryConfigSchema = exports.RecentlyViewedProductsConfigSchema = exports.MagentoConfigurableVariantValuesSchema = exports.GraphCommerceStorefrontConfigSchema = exports.GraphCommerceDebugConfigSchema = exports.GraphCommerceConfigSchema = exports.DatalayerConfigSchema = exports.SidebarGalleryPaginationVariantSchema = exports.ProductFiltersLayoutSchema = exports.CompareVariantSchema = exports.definedNonNullAnySchema = exports.isDefinedNonNullAny = void 0;
3
+ exports.SidebarGalleryConfigSchema = exports.RecentlyViewedProductsConfigSchema = exports.MagentoConfigurableVariantValuesSchema = exports.GraphCommerceStorefrontConfigSchema = exports.GraphCommerceDebugConfigSchema = exports.GraphCommerceConfigSchema = exports.DatalayerConfigSchema = exports.SidebarGalleryPaginationVariantSchema = exports.ProductFiltersLayoutSchema = exports.PaginationVariantSchema = 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;
7
7
  exports.isDefinedNonNullAny = isDefinedNonNullAny;
8
8
  exports.definedNonNullAnySchema = zod_1.z.any().refine((v) => (0, exports.isDefinedNonNullAny)(v));
9
9
  exports.CompareVariantSchema = zod_1.z.enum(['CHECKBOX', 'ICON']);
10
+ exports.PaginationVariantSchema = zod_1.z.enum(['COMPACT', 'EXTENDED']);
10
11
  exports.ProductFiltersLayoutSchema = zod_1.z.enum(['DEFAULT', 'SIDEBAR']);
11
12
  exports.SidebarGalleryPaginationVariantSchema = zod_1.z.enum(['DOTS', 'THUMBNAILS_BOTTOM']);
12
13
  function DatalayerConfigSchema() {
@@ -46,6 +47,7 @@ function GraphCommerceConfigSchema() {
46
47
  previewSecret: zod_1.z.string().nullish(),
47
48
  productFiltersLayout: exports.ProductFiltersLayoutSchema.default("DEFAULT").nullish(),
48
49
  productFiltersPro: zod_1.z.boolean().nullish(),
50
+ productListPaginationVariant: exports.PaginationVariantSchema.default("COMPACT").nullish(),
49
51
  productRoute: zod_1.z.string().nullish(),
50
52
  recentlyViewedProducts: RecentlyViewedProductsConfigSchema().nullish(),
51
53
  robotsAllow: zod_1.z.boolean().nullish(),
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": "8.1.0-canary.40",
5
+ "version": "8.1.0-canary.42",
6
6
  "type": "commonjs",
7
7
  "main": "dist/index.js",
8
8
  "types": "src/index.ts",
@@ -38,6 +38,7 @@ export const demoConfig: PartialDeep<GraphCommerceConfig, { recurseIntoArrays: t
38
38
  ],
39
39
  productFiltersPro: true,
40
40
  productFiltersLayout: 'DEFAULT',
41
+ productListPaginationVariant: 'COMPACT',
41
42
  compareVariant: 'ICON',
42
43
  robotsAllow: false,
43
44
 
@@ -50,4 +51,5 @@ export const demoConfig: PartialDeep<GraphCommerceConfig, { recurseIntoArrays: t
50
51
  recentlyViewedProducts: { enabled: true, maxCount: 20 },
51
52
  breadcrumbs: false,
52
53
  customerDeleteEnabled: true,
54
+ previewSecret: 'SECRET',
53
55
  }
@@ -167,6 +167,7 @@ export type GraphCommerceConfig = {
167
167
  customerCompanyFieldsEnable?: InputMaybe<Scalars['Boolean']['input']>;
168
168
  /** Enable customer account deletion through the account section */
169
169
  customerDeleteEnabled?: InputMaybe<Scalars['Boolean']['input']>;
170
+ /** Datalayer config */
170
171
  dataLayer?: InputMaybe<DatalayerConfig>;
171
172
  /** Debug configuration for GraphCommerce */
172
173
  debug?: InputMaybe<GraphCommerceDebugConfig>;
@@ -293,6 +294,13 @@ export type GraphCommerceConfig = {
293
294
  productFiltersLayout?: InputMaybe<ProductFiltersLayout>;
294
295
  /** Product filters with better UI for mobile and desktop. */
295
296
  productFiltersPro?: InputMaybe<Scalars['Boolean']['input']>;
297
+ /**
298
+ * Pagination variant for the product listings.
299
+ *
300
+ * COMPACT means: "< Page X of Y >"
301
+ * EXTENDED means: "< 1 2 ... 4 [5] 6 ... 10 11 >"
302
+ */
303
+ productListPaginationVariant?: InputMaybe<PaginationVariant>;
296
304
  /**
297
305
  * By default we route products to /p/[url] but you can change this to /product/[url] if you wish.
298
306
  *
@@ -422,6 +430,10 @@ export type MagentoConfigurableVariantValues = {
422
430
  url?: InputMaybe<Scalars['Boolean']['input']>;
423
431
  };
424
432
 
433
+ export type PaginationVariant =
434
+ | 'COMPACT'
435
+ | 'EXTENDED';
436
+
425
437
  export type ProductFiltersLayout =
426
438
  | 'DEFAULT'
427
439
  | 'SIDEBAR';
@@ -458,6 +470,8 @@ export const definedNonNullAnySchema = z.any().refine((v) => isDefinedNonNullAny
458
470
 
459
471
  export const CompareVariantSchema = z.enum(['CHECKBOX', 'ICON']);
460
472
 
473
+ export const PaginationVariantSchema = z.enum(['COMPACT', 'EXTENDED']);
474
+
461
475
  export const ProductFiltersLayoutSchema = z.enum(['DEFAULT', 'SIDEBAR']);
462
476
 
463
477
  export const SidebarGalleryPaginationVariantSchema = z.enum(['DOTS', 'THUMBNAILS_BOTTOM']);
@@ -499,6 +513,7 @@ export function GraphCommerceConfigSchema(): z.ZodObject<Properties<GraphCommerc
499
513
  previewSecret: z.string().nullish(),
500
514
  productFiltersLayout: ProductFiltersLayoutSchema.default("DEFAULT").nullish(),
501
515
  productFiltersPro: z.boolean().nullish(),
516
+ productListPaginationVariant: PaginationVariantSchema.default("COMPACT").nullish(),
502
517
  productRoute: z.string().nullish(),
503
518
  recentlyViewedProducts: RecentlyViewedProductsConfigSchema().nullish(),
504
519
  robotsAllow: z.boolean().nullish(),