@wayke-se/components-react 3.0.0-beta.1 → 3.0.0-beta.11

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.
Files changed (95) hide show
  1. package/.eslintrc.js +14 -6
  2. package/.github/workflows/release-to-production.yaml +2 -3
  3. package/.github/workflows/release-to-test.yaml +2 -4
  4. package/.prettierrc +2 -0
  5. package/README.md +35 -2
  6. package/assets/ajax-loader.gif +0 -0
  7. package/assets/default.css +1 -0
  8. package/assets/fonts/slick.eot +0 -0
  9. package/assets/fonts/slick.svg +14 -0
  10. package/assets/fonts/slick.ttf +0 -0
  11. package/assets/fonts/slick.woff +0 -0
  12. package/codegen.yml +1 -1
  13. package/dist/ajax-loader-BOAPMZMT.gif +0 -0
  14. package/dist/index.css +240 -1
  15. package/dist/index.css.map +3 -3
  16. package/dist/index.d.ts +393 -320
  17. package/dist/index.js +6565 -838
  18. package/dist/index.js.map +4 -4
  19. package/dist/index.mjs +6548 -838
  20. package/dist/index.mjs.map +4 -4
  21. package/dist/slick-7CK47X3J.svg +14 -0
  22. package/dist/slick-EVLS6IWX.eot +0 -0
  23. package/dist/slick-MU5EZO5G.woff +0 -0
  24. package/dist/slick-NKQ64RRA.ttf +0 -0
  25. package/esbuild/{lib.js → build.js} +5 -14
  26. package/esbuild/common.js +5 -5
  27. package/esbuild/start.js +12 -11
  28. package/{www → esbuild/www}/index.html +3 -3
  29. package/example/src/@types/global.d.ts +7 -0
  30. package/example/src/@types/react-panellum.d.ts +1 -0
  31. package/example/src/App.tsx +77 -0
  32. package/{www → example/src/assets/style}/ecom.css +3 -0
  33. package/{www → example/src/assets/style}/theme.css +0 -0
  34. package/example/src/index.html +26 -0
  35. package/example/src/index.tsx +11 -0
  36. package/example/src/routes/HashRoute/index.tsx +30 -0
  37. package/example/src/routes/Home/index.tsx +33 -0
  38. package/example/src/routes/NotFound/index.tsx +5 -0
  39. package/example/src/routes/PathRoute/index.tsx +35 -0
  40. package/example/src/routes/Search/index.tsx +28 -0
  41. package/example/src/routes/SearchItem/index.tsx +28 -0
  42. package/example/src/routes/index.tsx +25 -0
  43. package/package.json +68 -17
  44. package/src/@types/{codegen.ts → codegen/types.ts} +0 -0
  45. package/src/@types/react-panellum.d.ts +1 -1
  46. package/src/State/CentralStorage/useCentralStorage.ts +1 -1
  47. package/src/components/ActionList/index.tsx +1 -1
  48. package/src/components/FinancialOptions/LoanModal.tsx +1 -1
  49. package/src/components/FinancialOptions/index.tsx +1 -1
  50. package/src/components/FinancialOptions/leasing.tsx +1 -1
  51. package/src/components/FinancialOptions/loan.tsx +1 -1
  52. package/src/components/Gallery/index.tsx +1 -1
  53. package/src/components/Gallery/wrapper.tsx +0 -70
  54. package/src/components/InsuranceOptions/Insurance.tsx +1 -1
  55. package/src/components/InsuranceOptions/InsuranceFree.tsx +1 -1
  56. package/src/components/InsuranceOptions/InsuranceFreeModal.tsx +1 -1
  57. package/src/components/InsuranceOptions/InsuranceModal.tsx +1 -1
  58. package/src/components/InsuranceOptions/index.tsx +1 -1
  59. package/src/components/Lightbox/index.tsx +1 -1
  60. package/src/components/Map/index.tsx +1 -1
  61. package/src/components/OpeningHours/index.tsx +1 -1
  62. package/src/components/Pdf/index.tsx +1 -1
  63. package/src/components/SortSelect/index.tsx +1 -1
  64. package/src/components/Sphere/SphereLightbox.tsx +1 -3
  65. package/src/components/Sphere/SphereViewer.tsx +44 -8
  66. package/src/components/Sphere/wrapper.tsx +0 -3
  67. package/src/hooks/useInsurance.ts +1 -1
  68. package/src/hooks/useLoan.ts +1 -1
  69. package/src/hooks/useSearchItem.ts +1 -1
  70. package/src/hooks/useSearchItemBranch.ts +1 -1
  71. package/src/index-dev.tsx +32 -134
  72. package/src/index-esbuild.ts +74 -0
  73. package/src/index.ts +8 -6
  74. package/src/layouts/searchItem/Branch.tsx +1 -1
  75. package/src/layouts/searchItem/BranchModal.tsx +1 -1
  76. package/src/layouts/searchItem/CheckList.tsx +1 -1
  77. package/src/layouts/searchItem/ManufacturerPackagesOption.tsx +1 -1
  78. package/src/layouts/searchItem/PackageOptions.tsx +1 -1
  79. package/src/layouts/searchItem/Property.tsx +1 -1
  80. package/src/layouts/searchItem/index.tsx +1 -3
  81. package/src/providers/WaykeItemProvidet.tsx +19 -24
  82. package/src/providers/WaykeProvider.tsx +26 -31
  83. package/src/utils/pubsub/Events.ts +10 -0
  84. package/src/utils/pubsub/pubsub.ts +8 -0
  85. package/src/utils/specification.ts +1 -1
  86. package/src/utils/vehicle-properties/custom-property-adder.ts +1 -1
  87. package/tsconfig.build.json +1 -1
  88. package/tsconfig.eslint.json +11 -0
  89. package/tsconfig.json +9 -6
  90. package/webpack.analyze.js +10 -0
  91. package/webpack.config.js +95 -0
  92. package/.husky/pre-commit +0 -4
  93. package/esbuild/cdn.js +0 -26
  94. package/src/hooks/useEcom.ts +0 -21
  95. package/src/styles.scss +0 -1
@@ -0,0 +1,14 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>Generated by Fontastic.me</metadata>
5
+ <defs>
6
+ <font id="slick" horiz-adv-x="512">
7
+ <font-face font-family="slick" units-per-em="512" ascent="480" descent="-32"/>
8
+ <missing-glyph horiz-adv-x="512" />
9
+
10
+ <glyph unicode="&#8594;" d="M241 113l130 130c4 4 6 8 6 13 0 5-2 9-6 13l-130 130c-3 3-7 5-12 5-5 0-10-2-13-5l-29-30c-4-3-6-7-6-12 0-5 2-10 6-13l87-88-87-88c-4-3-6-8-6-13 0-5 2-9 6-12l29-30c3-3 8-5 13-5 5 0 9 2 12 5z m234 143c0-40-9-77-29-110-20-34-46-60-80-80-33-20-70-29-110-29-40 0-77 9-110 29-34 20-60 46-80 80-20 33-29 70-29 110 0 40 9 77 29 110 20 34 46 60 80 80 33 20 70 29 110 29 40 0 77-9 110-29 34-20 60-46 80-80 20-33 29-70 29-110z"/>
11
+ <glyph unicode="&#8592;" d="M296 113l29 30c4 3 6 7 6 12 0 5-2 10-6 13l-87 88 87 88c4 3 6 8 6 13 0 5-2 9-6 12l-29 30c-3 3-8 5-13 5-5 0-9-2-12-5l-130-130c-4-4-6-8-6-13 0-5 2-9 6-13l130-130c3-3 7-5 12-5 5 0 10 2 13 5z m179 143c0-40-9-77-29-110-20-34-46-60-80-80-33-20-70-29-110-29-40 0-77 9-110 29-34 20-60 46-80 80-20 33-29 70-29 110 0 40 9 77 29 110 20 34 46 60 80 80 33 20 70 29 110 29 40 0 77-9 110-29 34-20 60-46 80-80 20-33 29-70 29-110z"/>
12
+ <glyph unicode="&#8226;" d="M475 256c0-40-9-77-29-110-20-34-46-60-80-80-33-20-70-29-110-29-40 0-77 9-110 29-34 20-60 46-80 80-20 33-29 70-29 110 0 40 9 77 29 110 20 34 46 60 80 80 33 20 70 29 110 29 40 0 77-9 110-29 34-20 60-46 80-80 20-33 29-70 29-110z"/>
13
+ <glyph unicode="&#97;" d="M475 439l0-128c0-5-1-9-5-13-4-4-8-5-13-5l-128 0c-8 0-13 3-17 11-3 7-2 14 4 20l40 39c-28 26-62 39-100 39-20 0-39-4-57-11-18-8-33-18-46-32-14-13-24-28-32-46-7-18-11-37-11-57 0-20 4-39 11-57 8-18 18-33 32-46 13-14 28-24 46-32 18-7 37-11 57-11 23 0 44 5 64 15 20 9 38 23 51 42 2 1 4 3 7 3 3 0 5-1 7-3l39-39c2-2 3-3 3-6 0-2-1-4-2-6-21-25-46-45-76-59-29-14-60-20-93-20-30 0-58 5-85 17-27 12-51 27-70 47-20 19-35 43-47 70-12 27-17 55-17 85 0 30 5 58 17 85 12 27 27 51 47 70 19 20 43 35 70 47 27 12 55 17 85 17 28 0 55-5 81-15 26-11 50-26 70-45l37 37c6 6 12 7 20 4 8-4 11-9 11-17z"/>
14
+ </font></defs></svg>
Binary file
Binary file
Binary file
@@ -1,27 +1,18 @@
1
1
  /* eslint-disable no-console */
2
- const { sassPlugin } = require('esbuild-sass-plugin');
2
+
3
+ const config = require('./common');
3
4
  const { Generator } = require('npm-dts');
4
5
  const { build } = require('esbuild');
5
6
  const { dependencies, peerDependencies } = require('../package.json');
6
7
 
7
8
  const shared = {
8
- entryPoints: ['src/index.ts'],
9
+ ...config,
10
+ entryPoints: ['src/index-esbuild.ts'],
9
11
  bundle: true,
10
- minify: true,
12
+ minify: false,
11
13
  sourcemap: true,
12
14
  logLevel: 'info',
13
15
  external: Object.keys(dependencies).concat(Object.keys(peerDependencies || {})),
14
- loader: {
15
- '.js': 'jsx',
16
- '.woff': 'file',
17
- '.woff2': 'file',
18
- '.eot': 'file',
19
- '.ttf': 'file',
20
- '.gif': 'file',
21
- '.svg': 'dataurl',
22
- '.png': 'dataurl',
23
- },
24
- plugins: [sassPlugin()],
25
16
  };
26
17
 
27
18
  build({
package/esbuild/common.js CHANGED
@@ -1,15 +1,15 @@
1
1
  module.exports = {
2
- entryPoints: ['src/index.ts', 'src/style.js'],
3
2
  bundle: true,
4
- outdir: 'build',
3
+ sourcemap: true,
5
4
  loader: {
6
5
  '.js': 'jsx',
7
6
  '.woff': 'file',
8
7
  '.woff2': 'file',
8
+ '.gif': 'file',
9
+ '.png': 'file',
10
+ '.jpg': 'file',
11
+ '.svg': 'file',
9
12
  '.eot': 'file',
10
13
  '.ttf': 'file',
11
- '.gif': 'file',
12
- '.svg': 'dataurl',
13
- '.png': 'dataurl',
14
14
  },
15
15
  };
package/esbuild/start.js CHANGED
@@ -1,20 +1,21 @@
1
+ require('dotenv').config();
1
2
  const config = require('./common');
2
3
 
3
4
  require('esbuild').serve(
4
5
  {
5
- servedir: 'www',
6
+ servedir: 'esbuild/www',
6
7
  port: 5000,
7
8
  },
8
- {
9
- ...config,
9
+ Object.assign(config, {
10
+ entryPoints: ['src/index-dev.tsx'],
11
+ outdir: 'esbuild/www',
10
12
  define: {
11
- 'process.env.WAYKE_SEARCH_URL': '"https://test-ext-api.wayketech.se/vehicles"',
12
- 'process.env.WAYKE_SEARCH_MLT_URL': '"https://test-ext-api.wayketech.se/vehicles-mlt-ext"',
13
- 'process.env.WAYKE_GRAPH_QL_URL': '"https://gql.wayketech.se/query"',
14
- 'process.env.WAYKE_ECOM_URL': '"https://ecom.wayketech.se"',
15
- 'process.env.WAYKE_ECOM_API_ADDRESS': '"https://ecom.wayketech.se"',
13
+ 'process.env.WAYKE_SEARCH_URL': `"${process.env.WAYKE_SEARCH_URL}"`,
14
+ 'process.env.WAYKE_SEARCH_MLT_URL': `"${process.env.WAYKE_SEARCH_MLT_URL}"`,
15
+ 'process.env.WAYKE_SEARCH_X_API_KEY': `"${process.env.WAYKE_SEARCH_X_API_KEY}"`,
16
+ 'process.env.WAYKE_GRAPH_QL_URL': `"${process.env.WAYKE_GRAPH_QL_URL}"`,
17
+ 'process.env.WAYKE_ECOM_URL': `"${process.env.WAYKE_ECOM_URL}"`,
18
+ 'process.env.GOOGLE_MAPS_API_KEY': `"${process.env.GOOGLE_MAPS_API_KEY}"`,
16
19
  },
17
- entryPoints: ['src/index-dev.tsx'],
18
- outdir: 'www',
19
- }
20
+ })
20
21
  );
@@ -4,14 +4,12 @@
4
4
  <title>Wayke Components React</title>
5
5
 
6
6
  <meta charset="UTF-8">
7
- <meta name="description" content="Wayke Components React">
7
+ <meta name="description" content="Wayke Ecom Web">
8
8
  <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
9
9
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
10
10
  <meta name="apple-mobile-web-app-capable" content="yes">
11
11
  <meta name="theme-color" content="#fff">
12
12
 
13
- <link rel="stylesheet" href="ecom.css">
14
- <link rel="stylesheet" href="theme.css">
15
13
  <link rel="stylesheet" href="index-dev.css">
16
14
 
17
15
  <style>
@@ -24,8 +22,10 @@
24
22
  margin: 0;
25
23
  }
26
24
  </style>
25
+
27
26
  </head>
28
27
  <body>
28
+ <h1>Wayke Components React</h1>
29
29
  <div id="root"></div>
30
30
  <script src="index-dev.js"></script>
31
31
  </body>
@@ -0,0 +1,7 @@
1
+ import { WaykePubSub } from '../../../src';
2
+
3
+ declare global {
4
+ interface Window {
5
+ WaykePubSub: WaykePubSub;
6
+ }
7
+ }
@@ -0,0 +1 @@
1
+ declare module 'react-pannellum';
@@ -0,0 +1,77 @@
1
+ import React from 'react';
2
+
3
+ import Routes from './routes/index';
4
+ import { BrowserRouter } from 'react-router-dom';
5
+
6
+ import { WaykePubSub } from '../../src/index';
7
+
8
+ WaykePubSub.subscribe({
9
+ eventName: 'ItemClicked',
10
+ // eslint-disable-next-line
11
+ callback: (id) => console.log('subscribed ItemClicked:', id),
12
+ });
13
+
14
+ WaykePubSub.subscribe({
15
+ eventName: 'HashRouteChange',
16
+ // eslint-disable-next-line
17
+ callback: (id) => console.log('subscribed HashRouteChange:', id),
18
+ });
19
+
20
+ WaykePubSub.subscribe({
21
+ eventName: 'EcomOnUserEvent',
22
+ callback: (userEvent, currentStep) =>
23
+ // eslint-disable-next-line
24
+ console.log('subscribed EcomOnUserEvent:', userEvent, currentStep),
25
+ });
26
+
27
+ WaykePubSub.subscribe({
28
+ eventName: 'EcomOnExit',
29
+ // eslint-disable-next-line
30
+ callback: () => console.log('subscribed EcomOnExit:'),
31
+ });
32
+
33
+ WaykePubSub.subscribe({
34
+ eventName: 'ImagesClick',
35
+ // eslint-disable-next-line
36
+ callback: () => console.log('subscribed ImagesClick:'),
37
+ });
38
+
39
+ WaykePubSub.subscribe({
40
+ eventName: 'OptionsClick',
41
+ // eslint-disable-next-line
42
+ callback: () => console.log('subscribed OptionsClick:'),
43
+ });
44
+
45
+ WaykePubSub.subscribe({
46
+ eventName: 'PhonenumberVisible',
47
+ // eslint-disable-next-line
48
+ callback: () => console.log('subscribed PhonenumberVisible:'),
49
+ });
50
+
51
+ WaykePubSub.subscribe({
52
+ eventName: 'PhonenumberCall',
53
+ // eslint-disable-next-line
54
+ callback: () => console.log('subscribed PhonenumberCall:'),
55
+ });
56
+
57
+ WaykePubSub.subscribe({
58
+ eventName: 'MailVisible',
59
+ // eslint-disable-next-line
60
+ callback: () => console.log('subscribed MailVisible:'),
61
+ });
62
+
63
+ WaykePubSub.subscribe({
64
+ eventName: 'All',
65
+ // eslint-disable-next-line
66
+ callback: (eventName, data) => console.log('subscribed All:', eventName, data),
67
+ });
68
+
69
+ window.WaykePubSub = WaykePubSub;
70
+
71
+ const App = () => (
72
+ <BrowserRouter>
73
+ <Routes />
74
+ </BrowserRouter>
75
+ );
76
+
77
+ export default App;
@@ -1,3 +1,6 @@
1
+ /* @import "@wayke-se/ecom-react/assets/styles/default.css";*/
2
+ @import "@wayke-se/ecom-web/dist/index.css";
3
+
1
4
  /* Custom Ecom CSS (Optional) */
2
5
  /* This file contains custom styling to overwrite wayke-ecom default styling */
3
6
 
File without changes
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html lang="sv">
3
+ <head>
4
+ <title>Wayke</title>
5
+
6
+ <meta charset="UTF-8">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <meta name="description" content="Example of wayke-se/components-react">
9
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
10
+ <meta name="apple-mobile-web-app-capable" content="yes">
11
+
12
+ <style>
13
+ html {
14
+ font-size: 100%;
15
+ -webkit-text-size-adjust: 100%;
16
+ }
17
+
18
+ body {
19
+ margin: 0;
20
+ }
21
+ </style>
22
+ </head>
23
+ <body>
24
+ <div id="root"></div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { createRoot } from 'react-dom/client';
3
+ import './assets/style/theme.css';
4
+ import './assets/style/ecom.css';
5
+ import '../../assets/default.css';
6
+
7
+ import App from './App';
8
+
9
+ const container = document.getElementById('root');
10
+ const root = createRoot(container!); // createRoot(container!) if you use TypeScript
11
+ root.render(<App />);
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+
3
+ import WaykeComposite from '../../../../src/index';
4
+
5
+ const initialQueryParams = new URLSearchParams();
6
+ initialQueryParams.set('modelYear.min', '2018');
7
+
8
+ const Home = () => (
9
+ <WaykeComposite
10
+ composite={{
11
+ // initialQueryParams,
12
+ removeSearchBar: false,
13
+ }}
14
+ provider={{
15
+ graphQlUrl: process.env.WAYKE_GRAPH_QL_URL as string,
16
+ url: process.env.WAYKE_SEARCH_URL as string,
17
+ urlMlt: process.env.WAYKE_SEARCH_MLT_URL as string,
18
+ ecomSettings: {
19
+ url: process.env.WAYKE_ECOM_URL as string,
20
+ useBankId: true,
21
+ serviceLogotypeUrl: 'https://cdn.wayke.se/wui/images/ecom/wayke-logo.svg',
22
+ },
23
+ googleMapsApiKey: process.env.GOOGLE_MAPS_API_KEY as string,
24
+ googleMapsMarker: 'https://www.wayke.se/images/map/marker.png',
25
+ useQueryParamsFromUrl: true,
26
+ }}
27
+ />
28
+ );
29
+
30
+ export default Home;
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+
3
+ import WaykeComposite from '../../../../src/index';
4
+
5
+ const initialQueryParams = new URLSearchParams();
6
+ initialQueryParams.set('modelYear.min', '2018');
7
+
8
+ const Home = () => (
9
+ <WaykeComposite
10
+ composite={{
11
+ // initialQueryParams,
12
+ removeSearchBar: false,
13
+ removeFilterOptions: false,
14
+ modifyDocumentTitleItem: true,
15
+ modifyDocumentTitleSearch: 'Wayke',
16
+ }}
17
+ provider={{
18
+ graphQlUrl: process.env.WAYKE_GRAPH_QL_URL as string,
19
+ url: process.env.WAYKE_SEARCH_URL as string,
20
+ urlMlt: process.env.WAYKE_SEARCH_MLT_URL as string,
21
+ ecomSettings: {
22
+ url: process.env.WAYKE_ECOM_URL as string,
23
+ useBankId: true,
24
+ serviceLogotypeUrl: 'https://cdn.wayke.se/wui/images/ecom/wayke-logo.svg',
25
+ },
26
+ googleMapsApiKey: process.env.GOOGLE_MAPS_API_KEY as string,
27
+ googleMapsMarker: 'https://www.wayke.se/images/map/marker.png',
28
+ useQueryParamsFromUrl: true,
29
+ }}
30
+ />
31
+ );
32
+
33
+ export default Home;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+
3
+ const NotFound = () => <>404 Not Found</>;
4
+
5
+ export default NotFound;
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+
3
+ import WaykeComposite from '../../../../src/index';
4
+
5
+ const initialQueryParams = new URLSearchParams();
6
+ initialQueryParams.set('modelYear.min', '2018');
7
+
8
+ const PathRoute = () => (
9
+ <WaykeComposite
10
+ composite={{
11
+ // initialQueryParams,
12
+ removeSearchBar: false,
13
+ pathRoute: '/id/',
14
+ modifyDocumentTitleItem: true,
15
+ modifyDocumentTitleSearch: 'Wayke',
16
+ initialQueryParams: 'modelSeries=A5&modelSeries=A3',
17
+ }}
18
+ provider={{
19
+ graphQlUrl: process.env.WAYKE_GRAPH_QL_URL as string,
20
+ url: process.env.WAYKE_SEARCH_URL as string,
21
+ urlMlt: process.env.WAYKE_SEARCH_MLT_URL as string,
22
+ ecomSettings: {
23
+ url: process.env.WAYKE_ECOM_URL as string,
24
+ useBankId: true,
25
+ serviceLogotypeUrl: 'https://cdn.wayke.se/wui/images/ecom/wayke-logo.svg',
26
+ },
27
+ googleMapsApiKey: process.env.GOOGLE_MAPS_API_KEY as string,
28
+ googleMapsMarker: 'https://www.wayke.se/images/map/marker.png',
29
+ useQueryParamsFromUrl: true,
30
+ pathRoute: '/id/',
31
+ }}
32
+ />
33
+ );
34
+
35
+ export default PathRoute;
@@ -0,0 +1,28 @@
1
+ import React, { useCallback } from 'react';
2
+
3
+ import { WaykeProvider, WaykeSearch } from '../../../../src/index';
4
+
5
+ const Search = () => {
6
+ const onClickSearchItem = useCallback((id: string) => {
7
+ // eslint-disable-next-line
8
+ console.log(id);
9
+ }, []);
10
+
11
+ return (
12
+ <WaykeProvider
13
+ graphQlUrl={process.env.WAYKE_GRAPH_QL_URL as string}
14
+ url={process.env.WAYKE_SEARCH_URL as string}
15
+ urlMlt={process.env.WAYKE_SEARCH_MLT_URL as string}
16
+ ecomSettings={{
17
+ url: process.env.WAYKE_ECOM_URL as string,
18
+ useBankId: true,
19
+ serviceLogotypeUrl: 'https://cdn.wayke.se/wui/images/ecom/wayke-logo.svg',
20
+ }}
21
+ googleMapsApiKey={process.env.GOOGLE_MAPS_API_KEY as string}
22
+ >
23
+ <WaykeSearch onClickSearchItem={onClickSearchItem} />
24
+ </WaykeProvider>
25
+ );
26
+ };
27
+
28
+ export default Search;
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { useParams } from 'react-router-dom';
3
+
4
+ import { WaykeItemProvider, WaykeSearchItem } from '../../../../src/index';
5
+
6
+ const SearchItem = () => {
7
+ const { id } = useParams();
8
+ if (!id) {
9
+ return <p>No id</p>;
10
+ }
11
+ return (
12
+ <WaykeItemProvider
13
+ graphQlUrl={process.env.WAYKE_GRAPH_QL_URL as string}
14
+ url={process.env.WAYKE_SEARCH_URL as string}
15
+ urlMlt={process.env.WAYKE_SEARCH_MLT_URL as string}
16
+ ecomSettings={{
17
+ url: process.env.WAYKE_ECOM_URL as string,
18
+ useBankId: true,
19
+ serviceLogotypeUrl: 'https://cdn.wayke.se/wui/images/ecom/wayke-logo.svg',
20
+ }}
21
+ googleMapsApiKey={process.env.GOOGLE_MAPS_API_KEY as string}
22
+ >
23
+ <WaykeSearchItem id={id} />
24
+ </WaykeItemProvider>
25
+ );
26
+ };
27
+
28
+ export default SearchItem;
@@ -0,0 +1,25 @@
1
+ import React, { Suspense, lazy } from 'react';
2
+ import { Route, Routes as ReactRouterDomRoutes } from 'react-router-dom';
3
+ import Loader from '../../../src/components/Loader';
4
+
5
+ const Search = lazy(() => import('./Search'));
6
+ const PathRoute = lazy(() => import('./PathRoute'));
7
+ const HashRoute = lazy(() => import('./HashRoute'));
8
+ const Home = lazy(() => import('./Home'));
9
+ const SearchItem = lazy(() => import('./SearchItem'));
10
+ const NotFound = lazy(() => import('./NotFound/index'));
11
+
12
+ const Routes = () => (
13
+ <Suspense fallback={<Loader />}>
14
+ <ReactRouterDomRoutes>
15
+ <Route path="/" element={<Home />} />
16
+ <Route path="/a/b/:id?" element={<PathRoute />} />
17
+ <Route path="/hash" element={<HashRoute />} />
18
+ <Route path="/search" element={<Search />} />
19
+ <Route path="/search-item/:id" element={<SearchItem />} />
20
+ <Route element={<NotFound />} />
21
+ </ReactRouterDomRoutes>
22
+ </Suspense>
23
+ );
24
+
25
+ export default Routes;
package/package.json CHANGED
@@ -1,20 +1,23 @@
1
1
  {
2
2
  "name": "@wayke-se/components-react",
3
- "version": "3.0.0-beta.1",
4
- "description": "Wayke Components React",
3
+ "version": "3.0.0-beta.11",
4
+ "description": "",
5
5
  "module": "dist/index.mjs",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "scripts": {
9
- "build": "npm run clean && node ./esbuild/lib.js",
10
- "start": "node ./esbuild/start.js",
11
- "clean": "rimraf ./dist",
12
- "test": "npm run lint && npm run typecheck",
13
- "typecheck": "tsc -noEmit",
14
- "typecheck:watch": "tsc -noEmit -watch",
15
- "lint": "eslint --ext .ts,.js 'src'",
16
- "lint:fix": "eslint --ext .ts,.js 'src' --fix",
17
- "prepare": "husky install",
9
+ "start:esbuild": "node ./esbuild/start.js",
10
+ "build:esbuild": "rimraf ./dist && node ./esbuild/build.js",
11
+ "analyze": "webpack --config webpack.analyze.js --mode production",
12
+ "build": "pika build",
13
+ "prebuild": "npm run clean",
14
+ "lint": "eslint --ext .tsx,.ts 'src' 'example'",
15
+ "lint:fix": "eslint --ext .tsx,.ts 'src' 'example' --fix",
16
+ "start": "webpack serve --mode development --progress",
17
+ "clean": "rimraf ./pkg",
18
+ "type-check": "tsc --noEmit --skipLibCheck",
19
+ "prettify": "prettier --write 'src/**/*.{ts,tsx}'",
20
+ "prepare": "npm run prettify && npm run type-check && npm run lint",
18
21
  "gen": "graphql-codegen --config ./codegen.yml",
19
22
  "libphonenumber-metadata": "libphonenumber-generate-metadata src/utils/metadata.min.json --countries SE --extended"
20
23
  },
@@ -32,42 +35,90 @@
32
35
  "devDependencies": {
33
36
  "@graphql-codegen/cli": "^2.3.0",
34
37
  "@graphql-codegen/typescript": "^2.4.0",
38
+ "@pika/pack": "^0.5.0",
39
+ "@pika/plugin-build-node": "^0.9.2",
40
+ "@pika/plugin-build-types": "^0.9.2",
41
+ "@pika/plugin-build-web": "^0.9.2",
42
+ "@pika/plugin-copy-assets": "^0.9.2",
43
+ "@pika/plugin-ts-standard-pkg": "^0.9.2",
35
44
  "@types/googlemaps": "^3.43.3",
36
45
  "@types/marked": "^4.0.0",
37
46
  "@types/react": "^18.0.20",
38
47
  "@types/react-dom": "^18.0.6",
39
48
  "@types/react-lazyload": "^3.1.1",
49
+ "@types/react-router-dom": "^5.3.2",
40
50
  "@types/react-slick": "^0.23.7",
41
51
  "@types/styled-components": "^5.1.15",
42
52
  "@typescript-eslint/eslint-plugin": "^5.37.0",
43
53
  "@typescript-eslint/parser": "^5.37.0",
44
- "esbuild-sass-plugin": "^2.3.2",
54
+ "babel-loader": "^8.2.3",
55
+ "css-loader": "^6.5.1",
56
+ "dotenv": "^16.0.2",
57
+ "esbuild": "^0.15.7",
45
58
  "eslint": "^8.23.1",
46
59
  "eslint-config-prettier": "^8.3.0",
47
60
  "eslint-plugin-import": "^2.25.3",
48
61
  "eslint-plugin-prettier": "^4.2.1",
49
62
  "eslint-plugin-react": "^7.27.0",
50
- "husky": "^8.0.1",
63
+ "file-loader": "^6.2.0",
64
+ "fork-ts-checker-webpack-plugin": "^7.2.13",
65
+ "html-webpack-plugin": "^5.5.0",
51
66
  "npm-dts": "^1.3.12",
52
67
  "prettier": "^2.4.1",
53
68
  "react": "^18.2.0",
54
69
  "react-dom": "^18.2.0",
55
- "rimraf": "^3.0.2",
70
+ "react-router-dom": "^6.0.2",
71
+ "source-map-loader": "^4.0.0",
72
+ "style-loader": "^3.3.1",
56
73
  "styled-components": "^5.3.3",
57
- "typescript": "^4.4.4"
74
+ "ts-loader": "^9.2.6",
75
+ "typescript": "^4.4.4",
76
+ "webpack": "^5.64.1",
77
+ "webpack-bundle-analyzer": "^4.5.0",
78
+ "webpack-cli": "^4.9.1",
79
+ "webpack-dev-server": "^4.5.0",
80
+ "webpack-merge": "^5.8.0"
58
81
  },
59
82
  "dependencies": {
60
83
  "@apollo/client": "^3.4.17",
61
84
  "@wayke-se/ecom-web": "^1.4.1",
62
85
  "date-fns": "^2.25.0",
63
- "esbuild": "^0.15.7",
64
86
  "graphql": "^16.0.1",
65
87
  "libphonenumber-js": "^1.9.42",
66
88
  "marked": "^4.0.3",
67
- "pannellum-react": "^1.2.4",
68
89
  "react-compound-slider": "^3.3.1",
69
90
  "react-lazyload": "^3.2.0",
91
+ "react-pannellum": "^0.1.15",
70
92
  "react-slick": "^0.29.0",
71
93
  "scroll-into-view-if-needed": "^2.2.28"
94
+ },
95
+ "@pika/pack": {
96
+ "pipeline": [
97
+ [
98
+ "@pika/plugin-ts-standard-pkg",
99
+ {
100
+ "tsconfig": "tsconfig.build.json",
101
+ "args": [
102
+ "--target",
103
+ "es2020"
104
+ ]
105
+ }
106
+ ],
107
+ [
108
+ "@pika/plugin-build-node"
109
+ ],
110
+ [
111
+ "@pika/plugin-build-web"
112
+ ],
113
+ [
114
+ "@pika/plugin-copy-assets"
115
+ ],
116
+ [
117
+ "@pika/plugin-build-types",
118
+ {
119
+ "tsconfig": "tsconfig.build.json"
120
+ }
121
+ ]
122
+ ]
72
123
  }
73
124
  }
File without changes
@@ -1 +1 @@
1
- declare module 'pannellum-react/es/elements/Pannellum';
1
+ declare module 'react-pannellum';
@@ -1,6 +1,6 @@
1
1
  import { useContext, useEffect } from 'react';
2
2
  import { CentralStorageContext } from './CentralStorageContext';
3
- import { Vehicle } from '../../@types/codegen';
3
+ import { Vehicle } from '../../@types/codegen/types';
4
4
  import useSearchItemBranch from '../../hooks/useSearchItemBranch';
5
5
 
6
6
  const useCentralStorage = (vehicle?: Vehicle | null) => {
@@ -1,7 +1,7 @@
1
1
  import React, { useCallback } from 'react';
2
2
 
3
3
  import ToggleItem from './toggle-item';
4
- import { Maybe, ContactOptions, Branch } from '../../@types/codegen';
4
+ import { Maybe, ContactOptions, Branch } from '../../@types/codegen/types';
5
5
  import { formatPhonenumber } from '../../utils/phonenumbers';
6
6
  import PubSub from '../../utils/pubsub/pubsub';
7
7
 
@@ -10,7 +10,7 @@ import { numberSeparator } from '../../utils/formats';
10
10
  import { ButtonClear, ButtonContent } from '../Button/index';
11
11
  import { ContentLogo, ContentLogoText, ContentLogoMedia } from '../ContentLogo/index';
12
12
  import DataList from '../DataList/index';
13
- import { FinancialOption, Query } from '../../@types/codegen';
13
+ import { FinancialOption, Query } from '../../@types/codegen/types';
14
14
  import PubSub from '../../utils/pubsub/pubsub';
15
15
  import SliderWithLabel from '../RangeSlider/SliderWithLabel';
16
16
 
@@ -3,7 +3,7 @@ import { Repeat, RepeatTiny } from '../Repeat/index';
3
3
  import { VisualHeading } from '../Heading/index';
4
4
  import Leasing from './leasing';
5
5
  import Loan from './loan';
6
- import { FinancialOption } from '../../@types/codegen';
6
+ import { FinancialOption } from '../../@types/codegen/types';
7
7
 
8
8
  interface FinancialOptionsProps {
9
9
  id: string;