@jetshop/core 5.17.0-alpha.240f9d97 → 5.17.0-alpha.2d418770

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- import { getCLS, getFID, getLCP } from 'web-vitals';
1
+ import { onCLS, onLCP, onFID } from 'web-vitals';
2
2
  import { createApiReporter, getDeviceInfo } from 'web-vitals-reporter';
3
3
  import { routeList } from '../boot/addMissingConfig';
4
4
  let globalPageType = undefined;
@@ -11,7 +11,7 @@ export function webVitals({ shopId, apiUrl }) {
11
11
  var _a;
12
12
  // Init report callback with information about the browser.
13
13
  const deviceInfo = getDeviceInfo();
14
- Object.keys(routeList).forEach(route => {
14
+ Object.keys(routeList).forEach((route) => {
15
15
  var _a;
16
16
  if ((_a = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.url) === null || _a === void 0 ? void 0 : _a.includes(routeList[route])) {
17
17
  globalPageType = route;
@@ -32,8 +32,8 @@ export function webVitals({ shopId, apiUrl }) {
32
32
  }
33
33
  });
34
34
  // Setup web-vitals
35
- getLCP(sendToAnalytics);
36
- getFID(sendToAnalytics);
37
- getCLS(sendToAnalytics);
35
+ onLCP(sendToAnalytics);
36
+ onFID(sendToAnalytics);
37
+ onCLS(sendToAnalytics);
38
38
  }
39
39
  //# sourceMappingURL=webVitals.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webVitals.js","sourceRoot":"","sources":["webVitals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAErD,IAAI,cAAc,GAAuB,SAAS,CAAC;AAEnD,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,IAAI,CAAC,cAAc,EAAE;QACnB,cAAc,GAAG,IAAI,CAAC;KACvB;AACH,CAAC;AAED,MAAM,UAAU,S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ACzB,CAAC"}
@@ -33,6 +33,7 @@ const Loading = (LoadingPage) => LoadingPage ? React.createElement(LoadingPage,
33
33
  const RouteResolver = ({ productPage, categoryPage, contentPage, notFoundPage: NotFoundPage, ErrorPage, LoadingPage, result, pathname, state, search }) => {
34
34
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
35
35
  setPageType((_c = (_b = (_a = result === null || result === void 0 ? void 0 : result.data) === null || _a === void 0 ? void 0 : _a.route) === null || _b === void 0 ? void 0 : _b.object) === null || _c === void 0 ? void 0 : _c.__typename);
36
+ result.error && console.error(result.error);
36
37
  if (((_f = (_e = (_d = result === null || result === void 0 ? void 0 : result.data) === null || _d === void 0 ? void 0 : _d.route) === null || _e === void 0 ? void 0 : _e.path) !== null && _f !== void 0 ? _f : pathname) !== pathname) {
37
38
  return (React.createElement(Status, { code: 301 },
38
39
  React.createElement(Redirect, { to: {
@@ -1 +1 @@
1
- {"version":3,"file":"RouteResolver.js","sourceRoot":"","sources":["RouteResolver.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,YAA8B,MAAM,gBAAgB,CAAC;AAC5D,OAAO,aAAgC,MAAM,iBAAiB,CAAC;AAC/D,OAAO,YAA8B,MAAM,gBAAgB,CAAC;AAE5D,OAAO,MAAM,MAAM,UAAU,CAAC;AAE9B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAC;AAElF,MAAM,WAAW,GAAG,CAAC,KAAU,EAAE,MAAmB,EAAE,IAAY,EAAE,EAAE;;IACpE,IAAI,MAAM,CAAC,KAAK,EAAE;QAChB,OAAO,KAAK,CAAC;KACd;IACD,MAAM,SAAS,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAC;IAC9B,MAAM,SAAS,GAAG,MAAA,MAAA,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ACV,CAAC;SACH;QAED,OAAO,CACL,oBAAC,MAAM,IAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,IACnC,SAAS,CAAC,CAAC,CAAC,CACX,oBAAC,SAAS,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,GAAI,CACnC,CAAC,CAAC,CAAC,CACF,oBAAC,YAAY,IAAC,KAAK,EAAE,MAAM,CAAC,KAAK,GAAI,CACtC,CACM,CACV,CAAC;KACH;AACH,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetshop/core",
3
- "version": "5.17.0-alpha.240f9d97",
3
+ "version": "5.17.0-alpha.2d418770",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "**/*.js",
@@ -38,16 +38,11 @@
38
38
  "@graphql-tools/stitch": "^7.5.1",
39
39
  "@graphql-tools/wrap": "^7.0.5",
40
40
  "@loadable/component": "^5.11.0",
41
- "@loadable/server": "^5.11.0",
41
+ "@loadable/server": "^5.16.0",
42
42
  "@sentry/browser": "^6.15.0",
43
43
  "@sentry/core": "^6.15.0",
44
44
  "@sentry/node": "^6.15.0",
45
45
  "@tanem/react-nprogress": "^5.0.44",
46
- "@types/accept-language-parser": "^1.5.1",
47
- "@types/gtag.js": "^0.0.10",
48
- "@types/loadable__component": "^5.10.0",
49
- "@types/loadable__server": "^5.9.1",
50
- "@types/react-router-dom": "^5.1.8",
51
46
  "@xstate/react": "^0.8.1",
52
47
  "accept-language-parser": "^1.5.0",
53
48
  "apollo-server": "~2.6.9",
@@ -55,7 +50,6 @@
55
50
  "apollo-server-express": "~2.6.9",
56
51
  "compression": "^1.7.2",
57
52
  "dnscache": "^1.0.2",
58
- "esm": "^3.0.84",
59
53
  "eventemitter3": "^3.1.2",
60
54
  "express": "^4.16.3",
61
55
  "express-graphql": "^0.12.0",
@@ -64,7 +58,7 @@
64
58
  "graphql": "^15.3.0",
65
59
  "immer": "^10.0.2",
66
60
  "intl": "^1.2.5",
67
- "isbot": "^2.2.1",
61
+ "isbot": "^3.6.12",
68
62
  "lodash.merge": "^4.6.1",
69
63
  "lodash.pick": "^4.4.0",
70
64
  "mobile-detect": "^1.4.4",
@@ -77,23 +71,26 @@
77
71
  "react-media": "^1.10.0",
78
72
  "react-router-dom": "^5.2.1",
79
73
  "request-ip": "^2.1.3",
80
- "schema-dts": "^0.8.2",
81
- "ts-node": "^7.0.1",
74
+ "schema-dts": "^1.1.2",
82
75
  "typed-emitter": "^0.1.0",
83
76
  "universal-cookie-express": "^4.0.3",
84
77
  "uuid": "^8.3.2",
85
- "web-vitals": "^0.2.3",
86
- "web-vitals-reporter": "^0.2.0",
78
+ "web-vitals": "^3.4.0",
79
+ "web-vitals-reporter": "^1.0.0",
87
80
  "xstate": "^4.13.0"
88
81
  },
89
82
  "devDependencies": {
90
83
  "@graphql-codegen/typescript": "^1.21.0",
91
84
  "@react-mock/localstorage": "^0.1.2",
85
+ "@types/accept-language-parser": "^1.5.1",
92
86
  "@types/compression": "^0.0.36",
93
87
  "@types/express": "^4.11.1",
94
88
  "@types/fontfaceobserver": "^0.0.6",
95
89
  "@types/graphql": "^14.2.2",
90
+ "@types/gtag.js": "^0.0.10",
96
91
  "@types/jest": "^24.0.12",
92
+ "@types/loadable__component": "^5.10.0",
93
+ "@types/loadable__server": "^5.9.1",
97
94
  "@types/lodash.isequal": "^4.5.3",
98
95
  "@types/lodash.merge": "^4.6.4",
99
96
  "@types/lodash.pick": "^4.4.4",
@@ -112,6 +109,7 @@
112
109
  "lint-staged": "^8.1.5",
113
110
  "nock": "^10.0.6",
114
111
  "prettier": "^2.3.2",
112
+ "ts-node": "^7.0.1",
115
113
  "typescript": "^4.8.3"
116
114
  },
117
115
  "peerDependencies": {
@@ -1,35 +0,0 @@
1
- import { SchemaExtension } from './../boot/server/createApolloServer';
2
- export interface AddwishGetRecommendationsResponseBoxItem {
3
- /**
4
- * Article number
5
- * @see https://www.addwish.com/api/v1/product-recommendation/getProductBoxes?ids=5aaf90dc65f8014ff3957e9e%2C5aaf90da65f8014ff3957e91&url=https%3A%2F%2Fwww.scstyling.com&format=json
6
- */
7
- productNumber: string;
8
- url: string;
9
- [key: string]: any;
10
- }
11
- export interface AddwishGetRecommendationsResponseBox {
12
- result?: AddwishGetRecommendationsResponseBoxItem[];
13
- errorCode?: string;
14
- countAfterSource?: string;
15
- }
16
- export interface AddwishGetRecommendationsResponse {
17
- result: {
18
- [key: string]: AddwishGetRecommendationsResponseBox;
19
- };
20
- }
21
- export declare function validateResponseBox({ response, id }: {
22
- response: AddwishGetRecommendationsResponse;
23
- id: string;
24
- }): void;
25
- export declare function fetchAddwishRecommendations({ ids, url }: {
26
- /**
27
- * List of recommendation box IDs. Separate multiple IDs with a comma.
28
- */
29
- ids: string[];
30
- /**
31
- * This url specifies the product you want to find relations for. Note that you can also specify specific urls for each recommendation box.
32
- */
33
- url?: string;
34
- }): Promise<AddwishGetRecommendationsResponse>;
35
- export declare const addwishSchemaExtension: SchemaExtension;
@@ -1,141 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { gql } from '@apollo/client';
11
- import { print } from 'graphql';
12
- import fetch from 'node-fetch';
13
- import qs from 'qs';
14
- const typeDefs = gql `
15
- type GetAddwishProductsResponse {
16
- # Addwish Box ID
17
- id: String!
18
- products: [Product!]
19
- errorCode: String
20
- countAfterSource: String
21
- }
22
- extend type Query {
23
- getAddwishProducts(
24
- # Recommendation box ID
25
- id: String!
26
- # This url specifies the product you want to find relations for. Note that you can also specify specific urls for each recommendation box.
27
- url: String
28
- ): GetAddwishProductsResponse!
29
- }
30
- `;
31
- class UnexpectedResponseError extends Error {
32
- constructor(message, { id, response, box }) {
33
- super(message);
34
- console.warn(message, { id, response, box });
35
- }
36
- }
37
- export function validateResponseBox({ response, id }) {
38
- const box = response.result[id];
39
- if (!box) {
40
- throw new UnexpectedResponseError('Box not found in the rsponse.', {
41
- id,
42
- response,
43
- box
44
- });
45
- }
46
- if (box.errorCode) {
47
- throw new UnexpectedResponseError(`Box error: "${box.errorCode}"`, {
48
- id,
49
- response,
50
- box
51
- });
52
- }
53
- if (!Array.isArray(box.result)) {
54
- throw new UnexpectedResponseError("Result property wasn't an array", {
55
- id,
56
- response,
57
- box
58
- });
59
- }
60
- if (box.result.length > 0 &&
61
- typeof box.result[0].productNumber !== 'string') {
62
- throw new UnexpectedResponseError('"productNumber" needs to be a string', {
63
- id,
64
- response,
65
- box
66
- });
67
- }
68
- }
69
- const ADDWISH_GET_PRODUCTBOXES_URL = `https://www.addwish.com/api/v1/product-recommendation/getProductBoxes`;
70
- export function fetchAddwishRecommendations({ ids, url }) {
71
- return __awaiter(this, void 0, void 0, function* () {
72
- const addwishUrl = `${ADDWISH_GET_PRODUCTBOXES_URL}?${qs.stringify({
73
- format: 'json',
74
- url,
75
- ids: ids.join(',')
76
- })}`;
77
- return fetch(addwishUrl).then((res) => res.json());
78
- });
79
- }
80
- export const addwishSchemaExtension = ({ remoteSchema }) => {
81
- const resolvers = {
82
- Query: {
83
- getAddwishProducts: {
84
- resolve(_source, { id, url }) {
85
- return __awaiter(this, void 0, void 0, function* () {
86
- // Don't fail the whole API response because Addwish is down etc
87
- try {
88
- // Could be refactored to use DataLoader
89
- const response = yield fetchAddwishRecommendations({
90
- ids: [id],
91
- url
92
- });
93
- validateResponseBox({ response, id });
94
- const box = response.result[id];
95
- return {
96
- id,
97
- box,
98
- errorCode: null,
99
- countAfterSource: box.countAfterSource
100
- };
101
- }
102
- catch (err) {
103
- return {
104
- id,
105
- errorCode: err.message || 'Something went wrong',
106
- box: null
107
- };
108
- }
109
- });
110
- }
111
- }
112
- },
113
- GetAddwishProductsResponse: {
114
- products: {
115
- resolve({ box }, _args, context, info) {
116
- return __awaiter(this, void 0, void 0, function* () {
117
- if (!box) {
118
- return null;
119
- }
120
- if (box.result.length <= 0) {
121
- return [];
122
- }
123
- const articleNumbers = box.result.map((item) => item.productNumber);
124
- return info.mergeInfo.delegateToSchema({
125
- schema: remoteSchema,
126
- operation: 'query',
127
- fieldName: 'products',
128
- args: {
129
- articleNumbers
130
- },
131
- context,
132
- info
133
- });
134
- });
135
- }
136
- }
137
- }
138
- };
139
- return { schema: print(typeDefs), resolvers };
140
- };
141
- //# sourceMappingURL=addwishSchemaExtension.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"addwishSchemaExtension.js","sourceRoot":"","sources":["addwishSchemaExtension.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAIrC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;AA6BpB,MAAM,QAAQ,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;CAgBnB,CAAC;AAEF,MAAM,uBAAwB,SAAQ,KAAK;IACzC,YACE,OAAe,EACf,EACE,EAAE,EACF,QAAQ,EACR,GAAG,EAKJ;QAED,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;CACF;AAED,MAAM,UAAU,mBAAmB,CAAC,EAClC,QAAQ,EACR,EAAE,EAIH;IACC,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;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EAAE;gCACJ,cAAc;6BACf;4BACD,OAAO;4BACP,IAAI;yBACL,CAAC,CAAC;oBACL,CAAC;iBAAA;aACF;SACF;KACF,CAAC;IAEF,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,SAAS,EAAE,CAAC;AAChD,CAAC,CAAC"}
@@ -1,5 +0,0 @@
1
- import { SchemaExtension } from '../boot/server/createApolloServer';
2
- export declare const createNostoSchemaExtension: ({ nostoApiToken }: {
3
- nostoApiToken: string;
4
- }) => SchemaExtension;
5
- export declare const getNostoSchemaLinkTypeDefs: SchemaExtension;
@@ -1,77 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { HttpLink } from '@apollo/client';
11
- import { setContext } from '@apollo/client/link/context';
12
- import fetch from 'node-fetch';
13
- import { introspectSchema, makeRemoteExecutableSchema, transformSchema, RenameTypes, RenameRootFields } from 'graphql-tools';
14
- function getNostoSchema({ nostoApiToken }) {
15
- return __awaiter(this, void 0, void 0, function* () {
16
- const http = new HttpLink({
17
- uri: `https://api.nosto.com/v1/graphql`,
18
- fetch: fetch
19
- });
20
- // on introspect, get headers from conf/env
21
- const introspectLink = setContext(() => ({
22
- headers: {
23
- Authorization: `Basic ${Buffer.from(`:${nostoApiToken}`).toString('base64')}`
24
- }
25
- })).concat(http);
26
- // We could do this build-time to speed up start
27
- const schema = yield introspectSchema(introspectLink);
28
- const executableSchema = makeRemoteExecutableSchema({
29
- schema,
30
- link: introspectLink
31
- });
32
- const transformedNostoSchema = transformSchema(executableSchema, [
33
- new RenameTypes((name) => `Nosto${name}`),
34
- new RenameRootFields((_operation, name) => `nosto${name.substring(0, 1).toUpperCase()}${name.substring(1)}`)
35
- ]);
36
- return transformedNostoSchema;
37
- });
38
- }
39
- export const createNostoSchemaExtension = ({ nostoApiToken }) => {
40
- const nostoSchemaExtension = ({ remoteSchema }) => __awaiter(void 0, void 0, void 0, function* () {
41
- const schema = yield getNostoSchema({ nostoApiToken });
42
- const resolvers = {
43
- NostoRecommendedProduct: {
44
- product: {
45
- fragment: `... on RecommendedProduct { productId }`,
46
- resolve(recommendedProduct, _args, context, info) {
47
- return info.mergeInfo.delegateToSchema({
48
- schema: remoteSchema,
49
- operation: 'query',
50
- fieldName: 'product',
51
- args: {
52
- id: parseInt(recommendedProduct.productId)
53
- },
54
- context,
55
- info
56
- });
57
- }
58
- }
59
- }
60
- };
61
- return {
62
- schema,
63
- resolvers
64
- };
65
- });
66
- return nostoSchemaExtension;
67
- };
68
- export const getNostoSchemaLinkTypeDefs = () => {
69
- return {
70
- schema: `
71
- extend type NostoRecommendedProduct {
72
- product: Product
73
- }
74
- `
75
- };
76
- };
77
- //# sourceMappingURL=nostoSchemaExtension.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nostoSchemaExtension.js","sourceRoot":"","sources":["nostoSchemaExtension.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EACL,gBAAgB,EAChB,0BAA0B,EAC1B,eAAe,EACf,WAAW,EACX,gBAAgB,EAEjB,MAAM,eAAe,CAAC;AAIvB,SAAe,cAAc,CAAC,EAC5B,aAAa,EAGd;;QACC,MAAM,IAAI,GAAG,IAAI,QAAQ,CAAC;YACxB,GAAG,EAAE,kCAAkC;YACvC,KAAK,EAA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