@graphcommerce/next-config 8.1.0-canary.45 → 8.1.0-canary.46

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,17 @@
1
1
  # Change Log
2
2
 
3
+ ## 8.1.0-canary.46
4
+
5
+ ### Minor Changes
6
+
7
+ - [#2313](https://github.com/graphcommerce-org/graphcommerce/pull/2313) [`511e75c`](https://github.com/graphcommerce-org/graphcommerce/commit/511e75c3f8c077e617ed17e5042796e2411f312f) - Add the customerNote field to the shipping and customer address forms
8
+ ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
9
+
10
+ ### Patch Changes
11
+
12
+ - [#2314](https://github.com/graphcommerce-org/graphcommerce/pull/2314) [`ccd218c`](https://github.com/graphcommerce-org/graphcommerce/commit/ccd218c827d8ba7e632fa40ed75ad63a38620275) - Solve an issue where interceptors were immediately deleted after generating
13
+ ([@paales](https://github.com/paales))
14
+
3
15
  ## 8.1.0-canary.45
4
16
 
5
17
  ## 8.1.0-canary.44
@@ -37,6 +37,7 @@ exports[`traverses a schema and returns a list of env variables that match 1`] =
37
37
  "GC_CONFIGURABLE_VARIANT_VALUES_URL",
38
38
  "GC_CROSS_SELLS_HIDE_CART_ITEMS",
39
39
  "GC_CROSS_SELLS_REDIRECT_ITEMS",
40
+ "GC_CUSTOMER_ADDRESS_NOTE_ENABLE",
40
41
  "GC_CUSTOMER_COMPANY_FIELDS_ENABLE",
41
42
  "GC_CUSTOMER_DELETE_ENABLED",
42
43
  "GC_DATA_LAYER",
@@ -27,6 +27,7 @@ function GraphCommerceConfigSchema() {
27
27
  configurableVariantValues: MagentoConfigurableVariantValuesSchema().nullish(),
28
28
  crossSellsHideCartItems: zod_1.z.boolean().default(false).nullish(),
29
29
  crossSellsRedirectItems: zod_1.z.boolean().default(false).nullish(),
30
+ customerAddressNoteEnable: zod_1.z.boolean().nullish(),
30
31
  customerCompanyFieldsEnable: zod_1.z.boolean().nullish(),
31
32
  customerDeleteEnabled: zod_1.z.boolean().nullish(),
32
33
  dataLayer: DatalayerConfigSchema().nullish(),
@@ -17,19 +17,19 @@ function checkFileExists(file) {
17
17
  }
18
18
  async function writeInterceptors(interceptors, cwd = process.cwd()) {
19
19
  const dependencies = (0, resolveDependenciesSync_1.resolveDependenciesSync)(cwd);
20
- const existing = [];
20
+ const existing = new Set();
21
21
  dependencies.forEach((dependency) => {
22
22
  const files = (0, glob_1.sync)([`${dependency}/**/*.interceptor.tsx`, `${dependency}/**/*.interceptor.ts`], { cwd });
23
- existing.push(...files);
23
+ files.forEach((file) => existing.add(file));
24
24
  });
25
25
  const written = Object.entries(interceptors).map(async ([, plugin]) => {
26
26
  const extension = plugin.sourcePath.endsWith('.tsx') ? '.tsx' : '.ts';
27
27
  const relativeFile = `${plugin.fromRoot}.interceptor${extension}`;
28
- if (existing.includes(relativeFile)) {
29
- delete existing[existing.indexOf(relativeFile)];
28
+ if (existing.has(relativeFile)) {
29
+ existing.delete(relativeFile);
30
30
  }
31
- if (existing.includes(`./${relativeFile}`)) {
32
- delete existing[existing.indexOf(`./${relativeFile}`)];
31
+ if (existing.has(`./${relativeFile}`)) {
32
+ existing.delete(`./${relativeFile}`);
33
33
  }
34
34
  const fileToWrite = path_1.default.join(cwd, relativeFile);
35
35
  const isSame = (await checkFileExists(fileToWrite)) &&
@@ -38,7 +38,7 @@ async function writeInterceptors(interceptors, cwd = process.cwd()) {
38
38
  await promises_1.default.writeFile(fileToWrite, plugin.template);
39
39
  });
40
40
  // Cleanup unused interceptors
41
- const cleaned = existing.map(async (file) => (await checkFileExists(file)) && (await promises_1.default.unlink(file)));
41
+ const cleaned = [...existing].map(async (file) => (await checkFileExists(file)) && (await promises_1.default.unlink(file)));
42
42
  await Promise.all(written);
43
43
  await Promise.all(cleaned);
44
44
  }
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.45",
5
+ "version": "8.1.0-canary.46",
6
6
  "type": "commonjs",
7
7
  "main": "dist/index.js",
8
8
  "types": "src/index.ts",
@@ -159,6 +159,8 @@ export type GraphCommerceConfig = {
159
159
  * Default: 'false'
160
160
  */
161
161
  crossSellsRedirectItems?: InputMaybe<Scalars['Boolean']['input']>;
162
+ /** Enables the shipping notes field in the checkout */
163
+ customerAddressNoteEnable?: InputMaybe<Scalars['Boolean']['input']>;
162
164
  /**
163
165
  * Enables company fields inside the checkout:
164
166
  * - Company name
@@ -493,6 +495,7 @@ export function GraphCommerceConfigSchema(): z.ZodObject<Properties<GraphCommerc
493
495
  configurableVariantValues: MagentoConfigurableVariantValuesSchema().nullish(),
494
496
  crossSellsHideCartItems: z.boolean().default(false).nullish(),
495
497
  crossSellsRedirectItems: z.boolean().default(false).nullish(),
498
+ customerAddressNoteEnable: z.boolean().nullish(),
496
499
  customerCompanyFieldsEnable: z.boolean().nullish(),
497
500
  customerDeleteEnabled: z.boolean().nullish(),
498
501
  dataLayer: DatalayerConfigSchema().nullish(),
@@ -17,24 +17,24 @@ export async function writeInterceptors(
17
17
  cwd: string = process.cwd(),
18
18
  ) {
19
19
  const dependencies = resolveDependenciesSync(cwd)
20
- const existing: string[] = []
20
+ const existing = new Set<string>()
21
21
  dependencies.forEach((dependency) => {
22
22
  const files = globSync(
23
23
  [`${dependency}/**/*.interceptor.tsx`, `${dependency}/**/*.interceptor.ts`],
24
24
  { cwd },
25
25
  )
26
- existing.push(...files)
26
+ files.forEach((file) => existing.add(file))
27
27
  })
28
28
 
29
29
  const written = Object.entries(interceptors).map(async ([, plugin]) => {
30
30
  const extension = plugin.sourcePath.endsWith('.tsx') ? '.tsx' : '.ts'
31
31
  const relativeFile = `${plugin.fromRoot}.interceptor${extension}`
32
32
 
33
- if (existing.includes(relativeFile)) {
34
- delete existing[existing.indexOf(relativeFile)]
33
+ if (existing.has(relativeFile)) {
34
+ existing.delete(relativeFile)
35
35
  }
36
- if (existing.includes(`./${relativeFile}`)) {
37
- delete existing[existing.indexOf(`./${relativeFile}`)]
36
+ if (existing.has(`./${relativeFile}`)) {
37
+ existing.delete(`./${relativeFile}`)
38
38
  }
39
39
 
40
40
  const fileToWrite = path.join(cwd, relativeFile)
@@ -47,7 +47,7 @@ export async function writeInterceptors(
47
47
  })
48
48
 
49
49
  // Cleanup unused interceptors
50
- const cleaned = existing.map(
50
+ const cleaned = [...existing].map(
51
51
  async (file) => (await checkFileExists(file)) && (await fs.unlink(file)),
52
52
  )
53
53