@graphcommerce/next-config 8.1.0-canary.44 → 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 +14 -0
- package/__tests__/config/utils/__snapshots__/mergeEnvIntoConfig.ts.snap +1 -0
- package/__tests__/interceptors/findPlugins.ts +16 -18
- package/dist/generated/config.js +1 -0
- package/dist/interceptors/writeInterceptors.js +7 -7
- package/package.json +1 -1
- package/src/generated/config.ts +3 -0
- package/src/interceptors/writeInterceptors.ts +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
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
|
+
|
|
15
|
+
## 8.1.0-canary.45
|
|
16
|
+
|
|
3
17
|
## 8.1.0-canary.44
|
|
4
18
|
|
|
5
19
|
## 8.1.0-canary.43
|
|
@@ -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",
|
|
@@ -211,6 +211,22 @@ it('finds plugins', () => {
|
|
|
211
211
|
"targetModule": "@graphcommerce/graphql",
|
|
212
212
|
"type": "component",
|
|
213
213
|
},
|
|
214
|
+
{
|
|
215
|
+
"enabled": true,
|
|
216
|
+
"sourceExport": "getInContextInput",
|
|
217
|
+
"sourceModule": "@graphcommerce/magento-customer/plugins/magentoCustomerGetInContext",
|
|
218
|
+
"targetExport": "getInContextInput",
|
|
219
|
+
"targetModule": "@graphcommerce/graphql",
|
|
220
|
+
"type": "function",
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"enabled": true,
|
|
224
|
+
"sourceExport": "useInContextInput",
|
|
225
|
+
"sourceModule": "@graphcommerce/magento-customer/plugins/magentoCustomerGetInContext",
|
|
226
|
+
"targetExport": "useInContextInput",
|
|
227
|
+
"targetModule": "@graphcommerce/graphql",
|
|
228
|
+
"type": "function",
|
|
229
|
+
},
|
|
214
230
|
{
|
|
215
231
|
"enabled": true,
|
|
216
232
|
"sourceExport": "GraphQLProvider",
|
|
@@ -386,15 +402,6 @@ it('finds plugins', () => {
|
|
|
386
402
|
"targetModule": "@graphcommerce/magento-recently-viewed-products",
|
|
387
403
|
"type": "component",
|
|
388
404
|
},
|
|
389
|
-
{
|
|
390
|
-
"enabled": false,
|
|
391
|
-
"ifConfig": "demoMode",
|
|
392
|
-
"sourceExport": "Plugin",
|
|
393
|
-
"sourceModule": "@graphcommerce/demo-magento-graphcommerce/plugins/demo/DemoProductListItemsBase",
|
|
394
|
-
"targetExport": "ProductListItemsBase",
|
|
395
|
-
"targetModule": "@graphcommerce/magento-product",
|
|
396
|
-
"type": "component",
|
|
397
|
-
},
|
|
398
405
|
{
|
|
399
406
|
"enabled": false,
|
|
400
407
|
"ifConfig": "demoMode",
|
|
@@ -404,15 +411,6 @@ it('finds plugins', () => {
|
|
|
404
411
|
"targetModule": "@graphcommerce/magento-product-configurable",
|
|
405
412
|
"type": "component",
|
|
406
413
|
},
|
|
407
|
-
{
|
|
408
|
-
"enabled": false,
|
|
409
|
-
"ifConfig": "demoMode",
|
|
410
|
-
"sourceExport": "Plugin",
|
|
411
|
-
"sourceModule": "@graphcommerce/demo-magento-graphcommerce/plugins/demo/DemoProductListItem",
|
|
412
|
-
"targetExport": "ProductListItem",
|
|
413
|
-
"targetModule": "@graphcommerce/magento-product",
|
|
414
|
-
"type": "component",
|
|
415
|
-
},
|
|
416
414
|
{
|
|
417
415
|
"enabled": false,
|
|
418
416
|
"ifConfig": "previewSecret",
|
package/dist/generated/config.js
CHANGED
|
@@ -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.
|
|
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.
|
|
29
|
-
|
|
28
|
+
if (existing.has(relativeFile)) {
|
|
29
|
+
existing.delete(relativeFile);
|
|
30
30
|
}
|
|
31
|
-
if (existing.
|
|
32
|
-
|
|
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.
|
|
5
|
+
"version": "8.1.0-canary.46",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"types": "src/index.ts",
|
package/src/generated/config.ts
CHANGED
|
@@ -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
|
|
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.
|
|
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.
|
|
34
|
-
|
|
33
|
+
if (existing.has(relativeFile)) {
|
|
34
|
+
existing.delete(relativeFile)
|
|
35
35
|
}
|
|
36
|
-
if (existing.
|
|
37
|
-
|
|
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
|
|