@jetshop/core 5.17.0-alpha.63e16fd6 → 5.17.0-alpha.72f771f3

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.
@@ -13,12 +13,12 @@ import http from 'http';
13
13
  const server = http.createServer(app);
14
14
  let currentApp = app;
15
15
  server.listen(process.env.PORT || 3000, () => {
16
- console.log('🚀 started');
16
+ console.log('🚀 Started');
17
17
  });
18
18
  if (module.hot) {
19
- console.log('Server-side HMR Enabled!');
19
+ console.log('🟢 HMR Server-side enabled!');
20
20
  const reload = () => __awaiter(void 0, void 0, void 0, function* () {
21
- console.log('📦 Server-side HMR Reloaded');
21
+ console.log('📦 HMR Server-side reloaded');
22
22
  try {
23
23
  app = yield require('src/server').default;
24
24
  server.removeListener('request', currentApp);
@@ -26,12 +26,13 @@ import http from 'http';
26
26
  currentApp = app;
27
27
  }
28
28
  catch (error) {
29
+ console.log('🔥 HMR Error: ', (error === null || error === void 0 ? void 0 : error.stack) || error);
29
30
  console.error(error);
30
31
  }
31
32
  });
32
33
  // Reload on HMR
33
34
  module.hot.accept('src/server', reload, (err) => {
34
- console.log('HMR err ', err);
35
+ console.log('🔥 HMR Error: ', err);
35
36
  });
36
37
  }
37
38
  }))();
@@ -1 +1 @@
1
- {"version":3,"file":"entrypoint.js","sourceRoot":"","sources":["entrypoint.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,CAAC,GAAS,EAAE;IACV,IAAI,GAAG,GAAG,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC;IAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IACtC,IAAI,UAAU,GAAG,GAAG,CAAC;IAErB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,EAAE,GAAG,EAAE;QAC3C,OAAO,CAAC,GAAG,CAAC,YAAY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C,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,IAAK,MAAc,CAAC,GAAG,EAAE;QACvB,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;QAE3C,MAAM,MAAM,GAAG,GAAS,EAAE;YACxB,OAAO,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC;YAE3C,IAAI;gBACF,GAAG,GAAG,MAAM,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC;gBAC1C,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;gBAC7C,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;gBAC1B,UAAU,GAAG,GAAG,CAAC;aAClB;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,KAAK,KAAI,KAAK,CAAC,CAAC;gBACrD,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;aACtB;QACH,CAAC,CAAA,CAAC;QAEF,gBAAgB;QACf,MAAc,CAAC,GAAG,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;YACvD,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;KACJ;AACH,CAAC,CAAA,CAAC,EAAE,CAAC"}
@@ -70,7 +70,7 @@ export declare function useAddToCart({ product, variant, submit, commentValidato
70
70
  dirty: boolean;
71
71
  unregisterField: (name: string) => void;
72
72
  registerField: (name: string, { validate }: any) => void;
73
- getFieldProps: (nameOrOptions: any) => import("formik").FieldInputProps<any>;
73
+ getFieldProps: (nameOrOptions: string | import("formik").FieldConfig<any>) => import("formik").FieldInputProps<any>;
74
74
  getFieldMeta: (name: string) => import("formik").FieldMetaProps<any>;
75
75
  getFieldHelpers: (name: string) => import("formik").FieldHelperProps<any>;
76
76
  validateOnBlur: boolean;
@@ -26,7 +26,7 @@ export declare function useForgotPasswordData(): {
26
26
  setSubmitting: (isSubmitting: boolean) => void;
27
27
  setTouched: (touched: import("formik").FormikTouched<MutationRequestPasswordResetArgs>, shouldValidate?: boolean) => void;
28
28
  setValues: (values: React.SetStateAction<MutationRequestPasswordResetArgs>, shouldValidate?: boolean) => void;
29
- setFieldValue: (field: string, value: any, shouldValidate?: boolean) => void;
29
+ setFieldValue: (field: string, value: any, shouldValidate?: boolean) => Promise<void | import("formik").FormikErrors<MutationRequestPasswordResetArgs>>;
30
30
  setFieldError: (field: string, message: string) => void;
31
31
  setFieldTouched: (field: string, isTouched?: boolean, shouldValidate?: boolean) => void;
32
32
  validateForm: (values?: any) => Promise<import("formik").FormikErrors<MutationRequestPasswordResetArgs>>;
@@ -44,7 +44,7 @@ export declare function useForgotPasswordData(): {
44
44
  (e: React.ChangeEvent<any>): void;
45
45
  <T_1 = string | React.ChangeEvent<any>>(field: T_1): T_1 extends React.ChangeEvent<any> ? void : (e: string | React.ChangeEvent<any>) => void;
46
46
  };
47
- getFieldProps: <Value = any>(props: any) => import("formik").FieldInputProps<Value>;
47
+ getFieldProps: <Value = any>(props: string | import("formik").FieldConfig<Value>) => import("formik").FieldInputProps<Value>;
48
48
  getFieldMeta: <Value_1>(name: string) => import("formik").FieldMetaProps<Value_1>;
49
49
  getFieldHelpers: <Value_2 = any>(name: string) => import("formik").FieldHelperProps<Value_2>;
50
50
  dirty: boolean;
@@ -38,7 +38,9 @@ export declare function useResetPasswordForm(): {
38
38
  setValues: (values: React.SetStateAction<{
39
39
  newPassword: string;
40
40
  }>, shouldValidate?: boolean) => void;
41
- setFieldValue: (field: string, value: any, shouldValidate?: boolean) => void;
41
+ setFieldValue: (field: string, value: any, shouldValidate?: boolean) => Promise<void | import("formik").FormikErrors<{
42
+ newPassword: string;
43
+ }>>;
42
44
  setFieldError: (field: string, message: string) => void;
43
45
  setFieldTouched: (field: string, isTouched?: boolean, shouldValidate?: boolean) => void;
44
46
  validateForm: (values?: any) => Promise<import("formik").FormikErrors<{
@@ -66,7 +68,7 @@ export declare function useResetPasswordForm(): {
66
68
  (e: React.ChangeEvent<any>): void;
67
69
  <T_1 = string | React.ChangeEvent<any>>(field: T_1): T_1 extends React.ChangeEvent<any> ? void : (e: string | React.ChangeEvent<any>) => void;
68
70
  };
69
- getFieldProps: <Value = any>(props: any) => import("formik").FieldInputProps<Value>;
71
+ getFieldProps: <Value = any>(props: string | import("formik").FieldConfig<Value>) => import("formik").FieldInputProps<Value>;
70
72
  getFieldMeta: <Value_1>(name: string) => import("formik").FieldMetaProps<Value_1>;
71
73
  getFieldHelpers: <Value_2 = any>(name: string) => import("formik").FieldHelperProps<Value_2>;
72
74
  dirty: boolean;
@@ -13,6 +13,6 @@ declare class ErrorBoundary extends React.Component<BoundaryErrorProps, Boundary
13
13
  state: BoundaryErrorState;
14
14
  static defaultProps: Partial<BoundaryErrorProps>;
15
15
  componentDidCatch(error: Error, info: React.ErrorInfo): void;
16
- render(): string | number | boolean | React.JSX.Element | React.ReactFragment;
16
+ render(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode>;
17
17
  }
18
18
  export default ErrorBoundary;
package/data/cache.js CHANGED
@@ -21,31 +21,14 @@ const createCache = () => new InMemoryCache({
21
21
  }
22
22
  },
23
23
  Product: {
24
- fields: {
25
- stockStatus: {
26
- merge(existing, incoming, { mergeObjects }) {
27
- // custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects
28
- // we do this to fix hydration mismatch on signup page
29
- // where we query for more settings in the already queried settings (tracking)
30
- return mergeObjects(existing, incoming);
31
- }
32
- }
33
- }
24
+ // https://www.apollographql.com/docs/react/caching/cache-configuration#disabling-normalization
25
+ keyFields: false
34
26
  }
27
+ // Category: {
28
+ // // https://www.apollographql.com/docs/react/caching/cache-configuration#disabling-normalization
29
+ // keyFields: false
30
+ // }
35
31
  }
36
- // fragmentMatcher: new IntrospectionFragmentMatcher({
37
- // introspectionQueryResultData: {
38
- // __schema: {
39
- // types: fragmentTypes
40
- // }
41
- // }
42
- // }),
43
- // cacheRedirects: {
44
- // Query: {
45
- // product: (_, args) => toIdValue(`Product:${args.id}`),
46
- // category: (_, args) => toIdValue(`Category:${args.id}`)
47
- // }
48
- // }
49
32
  });
50
33
  export default createCache;
51
34
  //# sourceMappingURL=cache.js.map
package/data/cache.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cache.js","sourceRoot":"","sources":["cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAE5C,MAAM,WAAW,GAAG,GAAG,EAAE,CACvB,IAAI,aAAa,CAAC;IAChB,aAAa,oBACR,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;QACpC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;YACnB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SACxD;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAE,CAAC,CACP;IACD,YAAY,EAAE;QACZ,OAAO,EAAE;YACP,MAAM,EAAE;gBACN,QAAQ,EAAE;oBACR,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,YAAY,EAAE;wBACxC,iFAAiF;wBACjF,sDAAsD;wBACtD,8EAA8E;wBAC9E,OAAO,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;oBAC1C,CAAC;iBACF;aACF;SACF;QACD,OAAO,EAAE;YACP,MAAM,EAAE;gBACN,WAAW,EAAE;oBACX,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,YAAY,EAAE;wBACxC,iFAAiF;wBACjF,sDAAsD;wBACtD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pG,qBAAqB;QACrB,IAAI;KACL;CACF,CAAC,CAAC;AAEL,eAAe,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetshop/core",
3
- "version": "5.17.0-alpha.63e16fd6",
3
+ "version": "5.17.0-alpha.72f771f3",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -42,7 +42,7 @@
42
42
  "@sentry/browser": "^6.15.0",
43
43
  "@sentry/core": "^6.15.0",
44
44
  "@sentry/node": "^6.15.0",
45
- "@tanem/react-nprogress": "^1.1.0",
45
+ "@tanem/react-nprogress": "^5.0.44",
46
46
  "@types/accept-language-parser": "^1.5.1",
47
47
  "@types/gtag.js": "^0.0.10",
48
48
  "@types/loadable__component": "^5.10.0",
@@ -61,7 +61,7 @@
61
61
  "express-graphql": "^0.12.0",
62
62
  "fontfaceobserver": "^2.1.0",
63
63
  "format-message": "^6.2.4",
64
- "graphql": "^14.5.8",
64
+ "graphql": "^15.3.0",
65
65
  "immer": "^10.0.2",
66
66
  "intl": "^1.2.5",
67
67
  "isbot": "^2.2.1",
@@ -78,10 +78,8 @@
78
78
  "react-router-dom": "^5.2.1",
79
79
  "request-ip": "^2.1.3",
80
80
  "schema-dts": "^0.8.2",
81
- "store-css": "^0.3.0",
82
81
  "ts-node": "^7.0.1",
83
82
  "typed-emitter": "^0.1.0",
84
- "typescript": "^4.8.3",
85
83
  "universal-cookie-express": "^4.0.3",
86
84
  "uuid": "^8.3.2",
87
85
  "web-vitals": "^0.2.3",
@@ -113,7 +111,8 @@
113
111
  "jest-dom": "^3.4.0",
114
112
  "lint-staged": "^8.1.5",
115
113
  "nock": "^10.0.6",
116
- "prettier": "^2.3.2"
114
+ "prettier": "^2.3.2",
115
+ "typescript": "^4.8.3"
117
116
  },
118
117
  "peerDependencies": {
119
118
  "react": "^18",
@@ -1,10 +0,0 @@
1
- import * as React from 'react';
2
- import { primaryFont, secondaryFonts } from './injectFont';
3
- export type GoogleFontProps = {
4
- primaryFont?: primaryFont;
5
- secondaryFonts?: secondaryFonts;
6
- };
7
- export default class GoogleFont extends React.PureComponent<GoogleFontProps, {}> {
8
- componentDidMount: () => void;
9
- render(): null;
10
- }
@@ -1,35 +0,0 @@
1
- import * as React from 'react';
2
- import { injectFont } from './injectFont';
3
- export default class GoogleFont extends React.PureComponent {
4
- constructor() {
5
- super(...arguments);
6
- // Uses Google's CDN to request the desired font
7
- this.componentDidMount = () => {
8
- const { primaryFont = '', secondaryFonts = [] } = this.props;
9
- handleGoogleFonts([primaryFont, ...secondaryFonts]);
10
- injectFont(cleanFontName(primaryFont), secondaryFonts.map(font => cleanFontName(font)));
11
- };
12
- }
13
- render() {
14
- return null;
15
- }
16
- }
17
- function cleanFontName(family) {
18
- // Takes a font formatted as `Source+Sans+Pro:400,600&amp;subset=greek-ext`
19
- // and returns 'Source Sans Pro'
20
- return family
21
- .split('&')[0]
22
- .split(':')[0]
23
- .replace(/\+/gi, ' ');
24
- }
25
- function handleGoogleFonts(families) {
26
- // import external font stylesheet and store it in session storage to optimise
27
- // future loads
28
- // Check for document first as this should not run on the server
29
- document &&
30
- import('store-css').then(module => families.map(family => module.default.css(`https://fonts.googleapis.com/css?family=${family}`, {
31
- crossOrigin: 'anonymous',
32
- storage: 'session'
33
- })));
34
- }
35
- //# sourceMappingURL=GoogleFont.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"GoogleFont.js","sourceRoot":"","sources":["GoogleFont.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAA+B,MAAM,cAAc,CAAC;AAOvE,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,KAAK,CAAC,aAG7C;IAHD;;QAIE,gDAAgD;QAChD,sBAAiB,GAAG,GAAG,EAAE;YACvB,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,cAAc,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;YAE7D,iBAAiB,CAAC,CAAC,WAAW,EAAE,GAAG,cAAc,CAAC,CAAC,CAAC;YAEpD,UAAU,CACR,aAAa,CAAC,WAAW,CAAC,EAC1B,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAChD,CAAC;QACJ,CAAC,CAAC;IAKJ,CAAC;IAHQ,MAAM;QACX,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,SAAS,aAAa,CAAC,MAAc;IACnC,2EAA2E;IAC3E,gCAAgC;IAChC,OAAO,MAAM;SACV,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACb,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACb,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAkB;IAC3C,8EAA8E;IAC9E,eAAe;IACf,gEAAgE;IAChE,QAAQ;QACN,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAChC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CACpB,MAAM,CAAC,OAAO,CAAC,GAAG,CAChB,2CAA2C,MAAM,EAAE,EACnD;YACE,WAAW,EAAE,WAAW;YACxB,OAAO,EAAE,SAAS;SACnB,CACF,CACF,CACF,CAAC;AACN,CAAC"}
@@ -1,16 +0,0 @@
1
- import * as React from 'react';
2
- import { primaryFont, secondaryFonts } from './injectFont';
3
- type TypekitFontProps = {
4
- primaryFont?: primaryFont;
5
- secondaryFonts?: secondaryFonts;
6
- /**
7
- * The embed code ID given by Adobe.
8
- * @see https://helpx.adobe.com/fonts/using/embed-codes.html
9
- */
10
- id: string;
11
- };
12
- export default class TypekitFont extends React.PureComponent<TypekitFontProps, {}> {
13
- componentDidMount: () => void;
14
- render(): null;
15
- }
16
- export {};
@@ -1,25 +0,0 @@
1
- import * as React from 'react';
2
- import { injectFont } from './injectFont';
3
- function handleTypekitFonts(id) {
4
- // Check for document first as this should not run on the server
5
- document &&
6
- import('store-css').then(module => module.default.css(`https://use.typekit.net/${id}.css`, {
7
- crossOrigin: 'anonymous',
8
- storage: 'session'
9
- }));
10
- }
11
- export default class TypekitFont extends React.PureComponent {
12
- constructor() {
13
- super(...arguments);
14
- // Uses Google's CDN to request the desired font
15
- this.componentDidMount = () => {
16
- const { primaryFont = '', secondaryFonts = [], id } = this.props;
17
- injectFont(primaryFont, secondaryFonts);
18
- handleTypekitFonts(id);
19
- };
20
- }
21
- render() {
22
- return null;
23
- }
24
- }
25
- //# sourceMappingURL=TypekitFont.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TypekitFont.js","sourceRoot":"","sources":["TypekitFont.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAA+B,MAAM,cAAc,CAAC;AAYvE,SAAS,kBAAkB,CAAC,EAAU;IACpC,gEAAgE;IAChE,QAAQ;QACN,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAChC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,2BAA2B,EAAE,MAAM,EAAE;YACtD,WAAW,EAAE,WAAW;YACxB,OAAO,EAAE,SAAS;SACnB,CAAC,CACH,CAAC;AACN,CAAC;AAED,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,KAAK,CAAC,aAG9C;IAHD;;QAIE,gDAAgD;QAChD,sBAAiB,GAAG,GAAG,EAAE;YACvB,MAAM,EAAE,WAAW,GAAG,EAAE,EAAE,cAAc,GAAG,EAAE,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;YACjE,UAAU,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;YACxC,kBAAkB,CAAC,EAAE,CAAC,CAAC;QACzB,CAAC,CAAC;IAKJ,CAAC;IAHQ,MAAM;QACX,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}