@wayke-se/components-react 3.5.1 → 3.5.3-beta.1
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/README.md +57 -49
- package/dist-node/index.js +93 -6
- package/dist-node/index.js.map +1 -1
- package/dist-src/components/FinancialOptions/index.js +1 -1
- package/dist-src/components/FinancialOptions/leasing.js +7 -6
- package/dist-src/components/Gallery/wrapper.js +70 -1
- package/dist-types/@types/codegen/types.d.ts +42 -42
- package/dist-types/@types/filter.d.ts +2 -2
- package/dist-types/State/Path/reducer.d.ts +2 -2
- package/dist-types/components/Content/index.d.ts +1 -1
- package/dist-types/components/Icon/index.d.ts +2 -2
- package/dist-types/components/InputCheckbox/index.d.ts +1 -1
- package/dist-types/components/InputSearch/index.d.ts +3 -3
- package/dist-types/components/InputText/index.d.ts +1 -1
- package/dist-types/components/Sphere/Sphere.d.ts +1 -1
- package/dist-types/components/Sphere/SphereLightbox.d.ts +1 -1
- package/dist-types/components/Sphere/SphereViewer.d.ts +1 -1
- package/dist-types/components/ThreeSixty/Rotation.d.ts +1 -1
- package/dist-types/components/ThreeSixty/ThreeSixtLightbox.d.ts +1 -1
- package/dist-types/components/ThreeSixty/ThreeSixty.d.ts +1 -1
- package/dist-types/components/Video/CustomPlayer.d.ts +1 -1
- package/dist-types/components/Video/EmbeddedVideoLightbox.d.ts +1 -1
- package/dist-types/components/Video/VimeoPlayer.d.ts +1 -1
- package/dist-types/components/Video/YoutubePlayer.d.ts +1 -1
- package/dist-types/layout/theme.d.ts +1 -1
- package/dist-types/layouts/WaykeComposite.d.ts +1 -1
- package/dist-types/providers/WaykeItemProvidet.d.ts +1 -1
- package/dist-types/providers/WaykeProvider.d.ts +1 -1
- package/dist-types/utils/pubsub/Actions.d.ts +5 -5
- package/dist-types/utils/pubsub/Events.d.ts +7 -7
- package/dist-types/utils/pubsub/pubsub.d.ts +2 -2
- package/dist-types/utils/sortOptions.d.ts +1 -1
- package/dist-types/utils/specification.d.ts +1 -1
- package/dist-web/index.js +78 -8
- package/dist-web/index.js.map +1 -1
- package/package.json +5 -4
- package/assets/ajax-loader.gif +0 -0
- package/assets/default.css +0 -1
- package/assets/fonts/slick.eot +0 -0
- package/assets/fonts/slick.svg +0 -14
- package/assets/fonts/slick.ttf +0 -0
- package/assets/fonts/slick.woff +0 -0
package/README.md
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
# Components React
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This repository contains components for search and items to use on external websites.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Usage
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Get started using `@wayke-se/components-react`.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### Before you start
|
|
10
10
|
|
|
11
|
-
Install
|
|
11
|
+
**Install**
|
|
12
12
|
```bash
|
|
13
13
|
npm install @wayke-se/components-react
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
Install peer dependencies
|
|
16
|
+
**Install peer dependencies**
|
|
17
17
|
```bash
|
|
18
18
|
npm install react react-dom styled-components
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
+
### Basic usage
|
|
22
|
+
|
|
21
23
|
```javascript
|
|
22
24
|
import React from 'react';
|
|
23
25
|
import WaykeComposite from '@wayke-se/components-react'
|
|
24
|
-
import '@wayke-se/
|
|
25
|
-
// Optional
|
|
26
|
-
import '@wayke-se/ecom-web/dist/index.css';
|
|
26
|
+
import '@wayke-se/ecom-web/dist/index.css'; // Only required if Ecom is activated
|
|
27
27
|
|
|
28
28
|
const ProviderSettings: WaykeProviderSettings = {
|
|
29
29
|
graphQlUrl: "https://gql.wayketech.se/query",
|
|
30
|
-
url: "https://
|
|
31
|
-
urlMlt: "https://
|
|
30
|
+
url: "https://api.wayketech.se/vehicles",
|
|
31
|
+
urlMlt: "https://api.wayketech.se/vehicles-mlt-ext",
|
|
32
32
|
ecomSettings: {
|
|
33
33
|
url: "OPTIONAL_ECOM_URL",
|
|
34
34
|
},
|
|
@@ -46,8 +46,8 @@ const App = () => (
|
|
|
46
46
|
```javascript
|
|
47
47
|
const ProviderSettings: WaykeProviderSettings = {
|
|
48
48
|
graphQlUrl: "https://gql.wayketech.se/query",
|
|
49
|
-
url: "https://
|
|
50
|
-
urlMlt: "https://
|
|
49
|
+
url: "https://api.wayketech.se/vehicles",
|
|
50
|
+
urlMlt: "https://api.wayketech.se/vehicles-mlt-ext",
|
|
51
51
|
ecomSettings: {
|
|
52
52
|
url: "https://ecom.wayketech.se",
|
|
53
53
|
},
|
|
@@ -66,10 +66,9 @@ const ProviderSettings: WaykeProviderSettings = {
|
|
|
66
66
|
}
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
|
|
70
69
|
### WaykeComposite uses hash-route, i want to use path-route
|
|
71
70
|
|
|
72
|
-
In this case you need to make sure that you are in control of the routing, if the user reloads the page, where same html file is
|
|
71
|
+
In this case you need to make sure that you are in control of the routing, if the user reloads the page, where same html file is
|
|
73
72
|
served for `/your/path/to/this/component` and `/your/path/to/this/component/00000000-0000-0000-0000-000000000000`.
|
|
74
73
|
|
|
75
74
|
Examples given the application is located in `/search/vehicles`:
|
|
@@ -84,9 +83,7 @@ Examples given the application is located in `/search/vehicles`:
|
|
|
84
83
|
```javascript
|
|
85
84
|
import React from 'react';
|
|
86
85
|
import { WaykeCompositePath } from '@wayke-se/components-react'
|
|
87
|
-
import '@wayke
|
|
88
|
-
// Optional
|
|
89
|
-
import '@wayke-se/ecom-web/dist/index.css';
|
|
86
|
+
import '@wayke-se/ecom-web/dist/index.css'; // Only required if Ecom is activated
|
|
90
87
|
|
|
91
88
|
const App = () => (
|
|
92
89
|
<WaykeCompositePath
|
|
@@ -119,7 +116,6 @@ const App = () => {
|
|
|
119
116
|
);
|
|
120
117
|
};
|
|
121
118
|
```
|
|
122
|
-
|
|
123
119
|
### I only want to use the Search Item component
|
|
124
120
|
|
|
125
121
|
It's recomended to place WaykeItemProvider close to app-root in order to keep the cache
|
|
@@ -127,9 +123,7 @@ It's recomended to place WaykeItemProvider close to app-root in order to keep th
|
|
|
127
123
|
```javascript
|
|
128
124
|
import React, { useCallback } from 'react';
|
|
129
125
|
import { WaykeItemProvider, WaykeSearchItem } from '@wayke-se/components-react'
|
|
130
|
-
import '@wayke
|
|
131
|
-
// Optional
|
|
132
|
-
import '@wayke-se/ecom-web/dist/index.css';
|
|
126
|
+
import '@wayke-se/ecom-web/dist/index.css'; // Only required if Ecom is activated
|
|
133
127
|
|
|
134
128
|
const App = ({}) => {
|
|
135
129
|
const id = 'd01f79a3-7552-49c4-9d4d-deb3aa581c31';
|
|
@@ -442,7 +436,7 @@ To style the components, copy the following snippet into your *CSS* file and mod
|
|
|
442
436
|
}
|
|
443
437
|
```
|
|
444
438
|
|
|
445
|
-
...or if you want to use it as
|
|
439
|
+
...or if you want to use it as _Sass_ (.scss):
|
|
446
440
|
|
|
447
441
|
```scss
|
|
448
442
|
.wayke__theme {
|
|
@@ -474,31 +468,42 @@ To style the components, copy the following snippet into your *CSS* file and mod
|
|
|
474
468
|
}
|
|
475
469
|
```
|
|
476
470
|
|
|
471
|
+
> **It is highly recommended to *NOT* add or remove any properties defined above in the color selectors**. However, since fonts usually requires more configuration we encourage you to add the necessary font styling required to match your current profile. If you add new properties to the font selectors, please be careful and ensure everything looks as intended before going into production.
|
|
472
|
+
|
|
477
473
|
### Ecom theme
|
|
478
|
-
The default ecom css can be found and imported `node_module/@wayke-se/ecom-web/dist/index.css`.
|
|
479
474
|
|
|
480
|
-
|
|
475
|
+
The default Ecom *CSS* can be found and imported from `@wayke-se/ecom-web/dist/index.css`. This is only necessary if Ecom is activated. If activated and the *CSS* is not imported, the Ecom module will not be displayed correctly.
|
|
476
|
+
|
|
477
|
+
If you want to customize the look of the Ecom module we refer you to the documentation of [@wayke-se/ecom-web](https://www.npmjs.com/package/@wayke-se/ecom-web).
|
|
478
|
+
|
|
479
|
+
## Run example from this repository
|
|
481
480
|
|
|
482
|
-
|
|
483
|
-
This repository contains a example app that uses [@wayke-se/components-react](https://www.npmjs.com/package/@wayke-se/components-react).
|
|
481
|
+
This repository contains an example app that uses [@wayke-se/components-react](https://www.npmjs.com/package/@wayke-se/components-react).
|
|
484
482
|
|
|
485
483
|
|
|
484
|
+
### Setup environment variables
|
|
485
|
+
|
|
486
|
+
To start the example create an `.env` file in root with the following content.
|
|
486
487
|
|
|
487
|
-
To start the example create an `.env` file in root.
|
|
488
488
|
```
|
|
489
489
|
WAYKE_HOST=YOUR_HOST_1,YOUR_HOST_2
|
|
490
|
-
WAYKE_SEARCH_URL=https://
|
|
491
|
-
WAYKE_SEARCH_MLT_URL=https://
|
|
490
|
+
WAYKE_SEARCH_URL=https://api.wayketech.se/vehicles
|
|
491
|
+
WAYKE_SEARCH_MLT_URL=https://api.wayketech.se/vehicles-mlt-ext
|
|
492
492
|
WAYKE_SEARCH_X_API_KEY=YOUR_API_KEY
|
|
493
493
|
WAYKE_GRAPH_QL_URL=https://gql.wayketech.se/query
|
|
494
494
|
WAYKE_ECOM_URL=https://ecom.wayketech.se
|
|
495
495
|
GOOGLE_MAPS_API_KEY=YOUR_GOOGLE_MAPS_STATIC_API_KEY
|
|
496
496
|
```
|
|
497
497
|
|
|
498
|
-
|
|
498
|
+
#### Notes
|
|
499
|
+
|
|
500
|
+
* `WAYKE_SEARCH_MLT_URL` - An *optional* flag. Will fetch related vehicles to current vehicle. If not provided
|
|
499
501
|
`WAYKE_SEARCH_URL` will be used instead, but will fetch latest vehicles.
|
|
500
502
|
|
|
501
|
-
|
|
503
|
+
### Start the example app
|
|
504
|
+
|
|
505
|
+
Run the following commands to start the example app.
|
|
506
|
+
|
|
502
507
|
```bash
|
|
503
508
|
npm install
|
|
504
509
|
cd example
|
|
@@ -506,35 +511,38 @@ npm install
|
|
|
506
511
|
npm start
|
|
507
512
|
```
|
|
508
513
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
This will change the origin, while still pointing to localhost.
|
|
513
|
-
Start the example and open `test.com.localhost:5000`.
|
|
514
|
+
### Custom host
|
|
515
|
+
|
|
516
|
+
`WAYKE_HOST` can be used instead of using and exposing the `WAYKE_SEARCH_X_API_KEY`. If, for example, your development host is `test.com.localhost`.
|
|
514
517
|
|
|
515
|
-
To
|
|
518
|
+
To do so update your local host file and add:
|
|
519
|
+
```txt
|
|
520
|
+
127.0.0.1 test.com.localhost
|
|
516
521
|
```
|
|
522
|
+
|
|
523
|
+
This will change the origin, while still pointing to `localhost`. Start the example app and open `test.com.localhost:5000` in your browser.
|
|
524
|
+
|
|
525
|
+
### Multiple hosts
|
|
526
|
+
|
|
527
|
+
To add multiple hosts, add all hohsts to your local host file and then update `WAYKE_HOST` in `.env` as a comma separated list.
|
|
528
|
+
|
|
529
|
+
```txt
|
|
517
530
|
WAYKE_HOST=a.com.localhost,b.com.localhost
|
|
518
531
|
```
|
|
519
|
-
`a.com.localhost:5000` and `b.com.localhost:5000` can now be accessed.
|
|
520
532
|
|
|
533
|
+
`a.com.localhost:5000` and `b.com.localhost:5000` can now be accessed.
|
|
521
534
|
|
|
522
|
-
### Available
|
|
535
|
+
### Available routes (independent)
|
|
523
536
|
|
|
524
|
-
|
|
537
|
+
**WaykeComposite**
|
|
525
538
|
[http://localhost:5000](http://localhost:5000)
|
|
526
539
|
|
|
527
|
-
|
|
540
|
+
**WaykeSearch With WaykeProvider**
|
|
528
541
|
[http://localhost:5000/search](http://localhost:5000/search)
|
|
529
542
|
|
|
530
|
-
|
|
543
|
+
**WaykeSearchItem With WaykeProvider**
|
|
531
544
|
[http://localhost:5000/search-item/d01f79a3-7552-49c4-9d4d-deb3aa581c31](http://localhost:5000/search-item/d01f79a3-7552-49c4-9d4d-deb3aa581c31)
|
|
532
545
|
|
|
533
|
-
|
|
534
546
|
## Example repositories
|
|
535
547
|
|
|
536
|
-
|
|
537
|
-
[https://github.com/wayke-se/components-react-boilerplate](https://github.com/wayke-se/components-react-boilerplate)
|
|
538
|
-
|
|
539
|
-
### Non-React with/without Typescript example
|
|
540
|
-
[https://github.com/wayke-se/components-react-example](https://github.com/wayke-se/components-react-example)
|
|
548
|
+
We have setup an example repository where you can see how we've implemented `@wayke-se/components-react`. You'll find the repository here: [https://github.com/wayke-se/components-react-example](https://github.com/wayke-se/components-react-example).
|
package/dist-node/index.js
CHANGED
|
@@ -895,6 +895,7 @@ function _objectSpread2(target) {
|
|
|
895
895
|
return target;
|
|
896
896
|
}
|
|
897
897
|
function _defineProperty(obj, key, value) {
|
|
898
|
+
key = _toPropertyKey(key);
|
|
898
899
|
if (key in obj) {
|
|
899
900
|
Object.defineProperty(obj, key, {
|
|
900
901
|
value: value,
|
|
@@ -907,6 +908,20 @@ function _defineProperty(obj, key, value) {
|
|
|
907
908
|
}
|
|
908
909
|
return obj;
|
|
909
910
|
}
|
|
911
|
+
function _toPrimitive(input, hint) {
|
|
912
|
+
if (typeof input !== "object" || input === null) return input;
|
|
913
|
+
var prim = input[Symbol.toPrimitive];
|
|
914
|
+
if (prim !== undefined) {
|
|
915
|
+
var res = prim.call(input, hint || "default");
|
|
916
|
+
if (typeof res !== "object") return res;
|
|
917
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
918
|
+
}
|
|
919
|
+
return (hint === "string" ? String : Number)(input);
|
|
920
|
+
}
|
|
921
|
+
function _toPropertyKey(arg) {
|
|
922
|
+
var key = _toPrimitive(arg, "string");
|
|
923
|
+
return typeof key === "symbol" ? key : String(key);
|
|
924
|
+
}
|
|
910
925
|
|
|
911
926
|
const List = styled__default.ul`
|
|
912
927
|
display: flex;
|
|
@@ -3351,6 +3366,76 @@ const SliderWrapper = styled__default.div`
|
|
|
3351
3366
|
bottom: 0;
|
|
3352
3367
|
left: 0;
|
|
3353
3368
|
right: 0;
|
|
3369
|
+
user-select: none;
|
|
3370
|
+
touch-action: pan-y;
|
|
3371
|
+
-webkit-tap-highlight-color: transparent;
|
|
3372
|
+
|
|
3373
|
+
.slick-list,
|
|
3374
|
+
.slick-track {
|
|
3375
|
+
transform: translate3d(0, 0, 0);
|
|
3376
|
+
}
|
|
3377
|
+
}
|
|
3378
|
+
|
|
3379
|
+
.slick-list {
|
|
3380
|
+
position: relative;
|
|
3381
|
+
display: block;
|
|
3382
|
+
margin: 0;
|
|
3383
|
+
padding: 0;
|
|
3384
|
+
overflow: hidden;
|
|
3385
|
+
|
|
3386
|
+
&:focus {
|
|
3387
|
+
outline: none;
|
|
3388
|
+
}
|
|
3389
|
+
|
|
3390
|
+
&.dragging {
|
|
3391
|
+
cursor: pointer;
|
|
3392
|
+
cursor: hand;
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3396
|
+
.slick-track {
|
|
3397
|
+
position: relative;
|
|
3398
|
+
top: 0;
|
|
3399
|
+
left: 0;
|
|
3400
|
+
display: block;
|
|
3401
|
+
margin-left: auto;
|
|
3402
|
+
margin-right: auto;
|
|
3403
|
+
|
|
3404
|
+
&::before,
|
|
3405
|
+
&::after {
|
|
3406
|
+
content: '';
|
|
3407
|
+
display: table;
|
|
3408
|
+
}
|
|
3409
|
+
|
|
3410
|
+
&::after {
|
|
3411
|
+
clear: both;
|
|
3412
|
+
}
|
|
3413
|
+
}
|
|
3414
|
+
|
|
3415
|
+
.slick-slide {
|
|
3416
|
+
display: none;
|
|
3417
|
+
float: left;
|
|
3418
|
+
min-height: 1px;
|
|
3419
|
+
}
|
|
3420
|
+
|
|
3421
|
+
.slick-loading {
|
|
3422
|
+
.slick-track {
|
|
3423
|
+
visibility: hidden;
|
|
3424
|
+
}
|
|
3425
|
+
|
|
3426
|
+
img {
|
|
3427
|
+
display: none;
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3430
|
+
|
|
3431
|
+
.slick-initialized {
|
|
3432
|
+
.slick-slide {
|
|
3433
|
+
display: block;
|
|
3434
|
+
}
|
|
3435
|
+
}
|
|
3436
|
+
|
|
3437
|
+
.slick-slide.dragging img {
|
|
3438
|
+
pointer-events: none;
|
|
3354
3439
|
}
|
|
3355
3440
|
|
|
3356
3441
|
${props => props.theme.breakpoint.LtMd} {
|
|
@@ -3363,7 +3448,6 @@ const SliderWrapper = styled__default.div`
|
|
|
3363
3448
|
|
|
3364
3449
|
.slick-slide {
|
|
3365
3450
|
border-right: ${size(1)} solid ${props => props.theme.color.bg};
|
|
3366
|
-
//transform: scale(0.95);
|
|
3367
3451
|
transform-origin: 0 50%;
|
|
3368
3452
|
transition: transform 150ms ease;
|
|
3369
3453
|
}
|
|
@@ -5229,14 +5313,17 @@ const Leasing = ({
|
|
|
5229
5313
|
description,
|
|
5230
5314
|
monthlyCost,
|
|
5231
5315
|
duration,
|
|
5232
|
-
mileage
|
|
5316
|
+
mileage,
|
|
5317
|
+
type,
|
|
5318
|
+
name
|
|
5233
5319
|
} = financialOption;
|
|
5320
|
+
const title = type === 'leasing' ? 'Privatleasa' : type === 'business-leasing' ? 'Företagsleasa' : type;
|
|
5234
5321
|
return React__default.createElement(React__default.Fragment, null, modal && React__default.createElement(Modal, {
|
|
5235
|
-
title:
|
|
5322
|
+
title: title,
|
|
5236
5323
|
onClose: toggleModal
|
|
5237
5324
|
}, image && React__default.createElement(Image$2, {
|
|
5238
5325
|
src: image,
|
|
5239
|
-
alt:
|
|
5326
|
+
alt: title
|
|
5240
5327
|
}), description && React__default.createElement(Content$2, {
|
|
5241
5328
|
dangerouslySetInnerHTML: {
|
|
5242
5329
|
__html: description
|
|
@@ -5252,7 +5339,7 @@ const Leasing = ({
|
|
|
5252
5339
|
label: 'Årlig körsträcka',
|
|
5253
5340
|
value: `${numberSeparator((mileage === null || mileage === void 0 ? void 0 : mileage.current) || 0)} mil/år`
|
|
5254
5341
|
}]
|
|
5255
|
-
})))), React__default.createElement(OptionBox, null, React__default.createElement(React__default.Fragment, null, monthlyCost !== null && monthlyCost !== undefined && React__default.createElement(OptionBoxHeading, null, `ca ${numberSeparator(monthlyCost)} kr/mån`)), React__default.createElement(OptionBoxContent, null, React__default.createElement("p", null,
|
|
5342
|
+
})))), React__default.createElement(OptionBox, null, React__default.createElement(React__default.Fragment, null, monthlyCost !== null && monthlyCost !== undefined && React__default.createElement(OptionBoxHeading, null, `ca ${numberSeparator(monthlyCost)} kr/mån`)), React__default.createElement(OptionBoxContent, null, React__default.createElement("p", null, title, ' ', (mileage === null || mileage === void 0 ? void 0 : mileage.current) && (duration === null || duration === void 0 ? void 0 : duration.current) && React__default.createElement(React__default.Fragment, null, React__default.createElement(UtilityTextPrimary, null, numberSeparator(mileage === null || mileage === void 0 ? void 0 : mileage.current), " mil/\u00E5r"), ' ', "i ", React__default.createElement(UtilityTextPrimary, null, duration === null || duration === void 0 ? void 0 : duration.current, " m\u00E5n"), ".", ' ')), name && React__default.createElement("p", null, React__default.createElement(ButtonInline, {
|
|
5256
5343
|
onClick: toggleModal
|
|
5257
5344
|
}, "L\u00E4s mer")))));
|
|
5258
5345
|
};
|
|
@@ -5627,7 +5714,7 @@ const FinancialOptions = ({
|
|
|
5627
5714
|
financialOptions
|
|
5628
5715
|
}) => React__default.createElement(Repeat, null, React__default.createElement(RepeatTiny, null, React__default.createElement(VisualHeading, null, "Andra finansieringsalternativ")), React__default.createElement(RepeatTiny, null, financialOptions.map((financialOption, index) => React__default.createElement(React.Fragment, {
|
|
5629
5716
|
key: index
|
|
5630
|
-
}, financialOption.type === 'leasing' && React__default.createElement(Leasing, {
|
|
5717
|
+
}, (financialOption.type === 'leasing' || financialOption.type === 'business-leasing') && React__default.createElement(Leasing, {
|
|
5631
5718
|
financialOption: financialOption
|
|
5632
5719
|
}), financialOption.type === 'loan' && React__default.createElement(Loan, {
|
|
5633
5720
|
id: id,
|