hart-estate-widget 2.6.8 → 2.7.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 +258 -256
- package/build/widget.bundle.js +1 -1
- package/build/widget.module.js +1 -1
- package/package.json +67 -67
package/README.md
CHANGED
@@ -1,256 +1,258 @@
|
|
1
|
-
# HART Estate Widget Component
|
2
|
-
|
3
|
-
## Prerequisites
|
4
|
-
|
5
|
-
![node:
|
6
|
-
|
7
|
-
## Installation using NPM:
|
8
|
-
|
9
|
-
`npm install hart-estate-widget --save`
|
10
|
-
|
11
|
-
## Usage example:
|
12
|
-
|
13
|
-
### HTML
|
14
|
-
```html
|
15
|
-
<html lang="en">
|
16
|
-
<head>
|
17
|
-
<meta charset="utf-8">
|
18
|
-
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
|
19
|
-
<title>katmosfera</title>
|
20
|
-
<link rel="icon" href="./assets/img/logo.png">
|
21
|
-
<script src="./js/index.js" type="module"></script>
|
22
|
-
</head>
|
23
|
-
|
24
|
-
<body>
|
25
|
-
<section class="widget-section">
|
26
|
-
<div class="widget" id="widget"></div> <!--must match the first attribute in 'new Widget('#widget', options);' -->
|
27
|
-
</section>
|
28
|
-
</body>
|
29
|
-
</html>
|
30
|
-
```
|
31
|
-
|
32
|
-
### JS
|
33
|
-
```js
|
34
|
-
import { ApiStore, Widget, rotationModes } from 'hart-estate-widget';
|
35
|
-
import '../assets/sass/index.sass'; // style
|
36
|
-
import logo from '../assets/img/logo.png'; // logo
|
37
|
-
|
38
|
-
const WIDGET_API_URL = 'https://backend.estate.hart-digital.com';
|
39
|
-
|
40
|
-
const createWidget = async (logoUrl) => {
|
41
|
-
const widgetApiHandler = new ApiStore(WIDGET_API_URL)
|
42
|
-
|
43
|
-
const { searchParams } = new URL(document.location);
|
44
|
-
const planId = searchParams.get("id");
|
45
|
-
|
46
|
-
const planData = await widgetApiHandler.loadWidgetData(planId);
|
47
|
-
const options = { // the parameters you need that are described below in "Parameters"
|
48
|
-
...planData.parsed,
|
49
|
-
API_URL: WIDGET_API_URL,
|
50
|
-
rotationMode: rotationModes.DEFAULT,
|
51
|
-
tabs: ['panorama', 'rotation'],
|
52
|
-
locale: 'en',
|
53
|
-
logoUrl,
|
54
|
-
logo,
|
55
|
-
}
|
56
|
-
|
57
|
-
new Widget('#widget', options); // must match the element id
|
58
|
-
}
|
59
|
-
|
60
|
-
createWidget('https://yoursite/'); // create a widget
|
61
|
-
```
|
62
|
-
|
63
|
-
## Functionality check:
|
64
|
-
|
65
|
-
### Instalization
|
66
|
-
1. `npm install sass@1.62.1`
|
67
|
-
2. `npm install parcel@2.8.3`
|
68
|
-
3. `npm install @parcel/transformer-sass@2.8.3`
|
69
|
-
|
70
|
-
### Add files
|
71
|
-
4. add index.html to the ~/src/index.html using the above described content for HTML
|
72
|
-
5. add index.js to the ~/src/js/index.js using the above described content for JS
|
73
|
-
6. add logo.png to the ~/src/assets/img/logo.png (if the logo is not png then replace all paths to the logo)
|
74
|
-
7. add index.sass to the ~/src/assets/sass/index.sass using:
|
75
|
-
```sass
|
76
|
-
*, *:before, *:after
|
77
|
-
-webkit-font-smoothing: antialiased
|
78
|
-
-moz-osx-font-smoothing: grayscale
|
79
|
-
font-family: 'Proxima Nova'
|
80
|
-
text-decoration: none
|
81
|
-
font-weight: 400
|
82
|
-
color: #fff
|
83
|
-
outline: none
|
84
|
-
padding: 0
|
85
|
-
margin: 0
|
86
|
-
box-sizing: border-box
|
87
|
-
-webkit-box-sizing: border-box
|
88
|
-
|
89
|
-
body
|
90
|
-
width: 100%
|
91
|
-
height: 100%
|
92
|
-
overflow: hidden
|
93
|
-
|
94
|
-
.widget-section
|
95
|
-
width: 100%
|
96
|
-
height: 100%
|
97
|
-
.widget
|
98
|
-
width: 100%
|
99
|
-
height: 100%
|
100
|
-
```
|
101
|
-
|
102
|
-
|
103
|
-
### Run
|
104
|
-
8. `rm -rf dist && npx parcel ./src/index.html`
|
105
|
-
9. open: http://localhost:1234/?id=4c834af9-e08a-4ede-bd53-b231bcae38da
|
106
|
-
|
107
|
-
|
108
|
-
## Parameters:
|
109
|
-
Here you can see list of accessable options and example of using. There are accessable values of each option below in the block "Types of elements"
|
110
|
-
```js
|
111
|
-
{
|
112
|
-
// elements
|
113
|
-
tabs: ['rotation', 'panorama'], // included elements
|
114
|
-
|
115
|
-
// logo
|
116
|
-
logo: '', // path/link to logo
|
117
|
-
logoUrl: '', // link opened when logo is clicked
|
118
|
-
|
119
|
-
// localization
|
120
|
-
// accessable languages are in "Types of elements"
|
121
|
-
locale: 'en', // ISO 639 language code
|
122
|
-
|
123
|
-
// width/height
|
124
|
-
width: 1920,
|
125
|
-
height: 1080,
|
126
|
-
resizable: true, // automatically resize the widget to the size of the container when the window is resized
|
127
|
-
|
128
|
-
// values
|
129
|
-
rotationMode: '', // mode of operation for plan images
|
130
|
-
panoramaFov: 75, // camera field of view angle for panoramic tour
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
"
|
157
|
-
"
|
158
|
-
"
|
159
|
-
"
|
160
|
-
"
|
161
|
-
"
|
162
|
-
"
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
//
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
'
|
208
|
-
'
|
209
|
-
'
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
'
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
}
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
1
|
+
# HART Estate Widget Component
|
2
|
+
|
3
|
+
## Prerequisites
|
4
|
+
|
5
|
+

|
6
|
+
|
7
|
+
## Installation using NPM:
|
8
|
+
|
9
|
+
`npm install hart-estate-widget --save`
|
10
|
+
|
11
|
+
## Usage example:
|
12
|
+
|
13
|
+
### HTML
|
14
|
+
```html
|
15
|
+
<html lang="en">
|
16
|
+
<head>
|
17
|
+
<meta charset="utf-8">
|
18
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0" />
|
19
|
+
<title>katmosfera</title>
|
20
|
+
<link rel="icon" href="./assets/img/logo.png">
|
21
|
+
<script src="./js/index.js" type="module"></script>
|
22
|
+
</head>
|
23
|
+
|
24
|
+
<body>
|
25
|
+
<section class="widget-section">
|
26
|
+
<div class="widget" id="widget"></div> <!--must match the first attribute in 'new Widget('#widget', options);' -->
|
27
|
+
</section>
|
28
|
+
</body>
|
29
|
+
</html>
|
30
|
+
```
|
31
|
+
|
32
|
+
### JS
|
33
|
+
```js
|
34
|
+
import { ApiStore, Widget, rotationModes } from 'hart-estate-widget';
|
35
|
+
import '../assets/sass/index.sass'; // style
|
36
|
+
import logo from '../assets/img/logo.png'; // logo
|
37
|
+
|
38
|
+
const WIDGET_API_URL = 'https://backend.estate.hart-digital.com';
|
39
|
+
|
40
|
+
const createWidget = async (logoUrl) => {
|
41
|
+
const widgetApiHandler = new ApiStore(WIDGET_API_URL)
|
42
|
+
|
43
|
+
const { searchParams } = new URL(document.location);
|
44
|
+
const planId = searchParams.get("id");
|
45
|
+
|
46
|
+
const planData = await widgetApiHandler.loadWidgetData(planId);
|
47
|
+
const options = { // the parameters you need that are described below in "Parameters"
|
48
|
+
...planData.parsed,
|
49
|
+
API_URL: WIDGET_API_URL,
|
50
|
+
rotationMode: rotationModes.DEFAULT,
|
51
|
+
tabs: ['panorama', 'rotation'],
|
52
|
+
locale: 'en',
|
53
|
+
logoUrl,
|
54
|
+
logo,
|
55
|
+
}
|
56
|
+
|
57
|
+
new Widget('#widget', options); // must match the element id
|
58
|
+
}
|
59
|
+
|
60
|
+
createWidget('https://yoursite/'); // create a widget
|
61
|
+
```
|
62
|
+
|
63
|
+
## Functionality check:
|
64
|
+
|
65
|
+
### Instalization
|
66
|
+
1. `npm install sass@1.62.1`
|
67
|
+
2. `npm install parcel@2.8.3`
|
68
|
+
3. `npm install @parcel/transformer-sass@2.8.3`
|
69
|
+
|
70
|
+
### Add files
|
71
|
+
4. add index.html to the ~/src/index.html using the above described content for HTML
|
72
|
+
5. add index.js to the ~/src/js/index.js using the above described content for JS
|
73
|
+
6. add logo.png to the ~/src/assets/img/logo.png (if the logo is not png then replace all paths to the logo)
|
74
|
+
7. add index.sass to the ~/src/assets/sass/index.sass using:
|
75
|
+
```sass
|
76
|
+
*, *:before, *:after
|
77
|
+
-webkit-font-smoothing: antialiased
|
78
|
+
-moz-osx-font-smoothing: grayscale
|
79
|
+
font-family: 'Proxima Nova'
|
80
|
+
text-decoration: none
|
81
|
+
font-weight: 400
|
82
|
+
color: #fff
|
83
|
+
outline: none
|
84
|
+
padding: 0
|
85
|
+
margin: 0
|
86
|
+
box-sizing: border-box
|
87
|
+
-webkit-box-sizing: border-box
|
88
|
+
|
89
|
+
body
|
90
|
+
width: 100%
|
91
|
+
height: 100%
|
92
|
+
overflow: hidden
|
93
|
+
|
94
|
+
.widget-section
|
95
|
+
width: 100%
|
96
|
+
height: 100%
|
97
|
+
.widget
|
98
|
+
width: 100%
|
99
|
+
height: 100%
|
100
|
+
```
|
101
|
+
|
102
|
+
|
103
|
+
### Run
|
104
|
+
8. `rm -rf dist && npx parcel ./src/index.html`
|
105
|
+
9. open: http://localhost:1234/?id=4c834af9-e08a-4ede-bd53-b231bcae38da
|
106
|
+
|
107
|
+
|
108
|
+
## Parameters:
|
109
|
+
Here you can see list of accessable options and example of using. There are accessable values of each option below in the block "Types of elements"
|
110
|
+
```js
|
111
|
+
{
|
112
|
+
// elements
|
113
|
+
tabs: ['rotation', 'panorama'], // included elements
|
114
|
+
|
115
|
+
// logo
|
116
|
+
logo: '', // path/link to logo
|
117
|
+
logoUrl: '', // link opened when logo is clicked
|
118
|
+
|
119
|
+
// localization
|
120
|
+
// accessable languages are in "Types of elements"
|
121
|
+
locale: 'en', // ISO 639 language code
|
122
|
+
|
123
|
+
// width/height
|
124
|
+
width: 1920,
|
125
|
+
height: 1080,
|
126
|
+
resizable: true, // automatically resize the widget to the size of the container when the window is resized
|
127
|
+
|
128
|
+
// values
|
129
|
+
rotationMode: '', // mode of operation for plan images
|
130
|
+
panoramaFov: 75, // camera field of view angle for panoramic tour
|
131
|
+
preloadPerPanoramaCount: 3, // the number of panoramas loaded next to the current one to optimize transitions
|
132
|
+
forcePreloadNonCached: true, // give preloading a higher priority for unloaded panoramas than by distance from the current one
|
133
|
+
enableCameraTransitionBetweenPanoramas: true, // enable / disable camera rotation transition between panoramas (if CameraPoint.Rotation.Yaw is defined in json)
|
134
|
+
enableCamerRotationBetweenPanoramas: true, // enable / disable camera rotation between panoramas (if CameraPoint.Rotation.Yaw is defined in json)
|
135
|
+
instructionVisible: true, // enable / disable modal of instruction in 3D tour
|
136
|
+
autoRotate: false, // enable / disable auto rotation in 3D tour
|
137
|
+
primaryCameraPointId: null, // primary camera point id for panorama tour
|
138
|
+
floors: [ // array of floors, contains 360° images and panoramic tour data
|
139
|
+
{
|
140
|
+
original_plan_img: '', // path to the original plan image (required for panoramic tour)
|
141
|
+
styled_plan_img: '', // path to the styled plan image (required for panoramic tour)
|
142
|
+
top_view_img: '', // path to the top view image
|
143
|
+
panorama: '', // type of panorama and paths to 360° images
|
144
|
+
rotate: '', // type of images and paths to circular view images (order is mandatory)
|
145
|
+
}
|
146
|
+
],
|
147
|
+
|
148
|
+
// colors
|
149
|
+
colors: {
|
150
|
+
main: '#HEX', // main color of buttons, elements
|
151
|
+
mainText: '#HEX', // text color for buttons, elements contrasting with the main color
|
152
|
+
},
|
153
|
+
|
154
|
+
// copyRight: all text in widget
|
155
|
+
dictionaryOverrides: {
|
156
|
+
"create-points": "Create a point", // text for create point
|
157
|
+
"delete-points": "Remove point", // text for delete point
|
158
|
+
"research-plan": "Research plan", // text for research plan
|
159
|
+
"rotate-plan": "Rotate plan", // text for rotate plan
|
160
|
+
"ok": "Ok", // button text
|
161
|
+
"made-by-link": "https://getfloorplan.com/", // watermark link
|
162
|
+
"made-by-text": "getfloorplan.com", // watermark text
|
163
|
+
"instructions-hint-text": "", // additional text on the bottom of instruction modal
|
164
|
+
"floor": "$0 floor" // floor text
|
165
|
+
},
|
166
|
+
|
167
|
+
API_URL: '', // api url
|
168
|
+
|
169
|
+
// branding
|
170
|
+
branding: {
|
171
|
+
company_url: '', // link opened when logo is clicked (more priority than logoUrl)
|
172
|
+
company_name: '', // watermark text (more priority than dictionaryOverrides['made-by-text'])
|
173
|
+
widget_language: 'en', // ISO 639 language code
|
174
|
+
logo_path: '', // path to logo
|
175
|
+
|
176
|
+
// panorama icons
|
177
|
+
panoramaIcons: {
|
178
|
+
spot: 'URL', // icon for camera points in one room
|
179
|
+
door: 'URL' // icon for door
|
180
|
+
},
|
181
|
+
|
182
|
+
// scales
|
183
|
+
scales: ['x05', 'x1'],
|
184
|
+
}
|
185
|
+
|
186
|
+
```
|
187
|
+
|
188
|
+
## Types of elements
|
189
|
+
```js
|
190
|
+
tabs: [
|
191
|
+
'rotation', // circular view images (order is mandatory)
|
192
|
+
'panorama', // 360° images
|
193
|
+
],
|
194
|
+
rotationMode: [
|
195
|
+
rotationModes.DEFAULT, // top view mode (multiple perspectives) and stylized plan view
|
196
|
+
rotationModes.THREESIXTY, // image scrolling mode for circular view
|
197
|
+
],
|
198
|
+
floors[0].rotate.type: [
|
199
|
+
'top_down', // full model
|
200
|
+
'middle_cut', // model with cut in the middle
|
201
|
+
],
|
202
|
+
floors[0].panorama.type: [
|
203
|
+
'sphere', // 360° panorama
|
204
|
+
'cube', // panorama with 6 images (top, down, left, right, front, back)
|
205
|
+
],
|
206
|
+
locale: [
|
207
|
+
'ru', // Russian language
|
208
|
+
'en', // English language
|
209
|
+
'es', // Spanish language
|
210
|
+
'de', // German language
|
211
|
+
'ja', // Japanese language
|
212
|
+
],
|
213
|
+
scales: [
|
214
|
+
'x1',
|
215
|
+
'x2',
|
216
|
+
'x05'
|
217
|
+
],
|
218
|
+
```
|
219
|
+
|
220
|
+
### Widget object from the REST API
|
221
|
+
```js
|
222
|
+
name: "", // CRM plan id (only for CRM API)
|
223
|
+
original_plan_img: "", // deprecated, path to the original plan image
|
224
|
+
original_plans_img: [ // array of paths to the original plan images
|
225
|
+
""
|
226
|
+
],
|
227
|
+
styled_plan_img: "", // path to the styled plan image
|
228
|
+
top_view_img: "", // path to the top view image
|
229
|
+
json: { // json with data for 3D tour
|
230
|
+
type: "furniture", // type of json (furniture, neural)
|
231
|
+
value: "" // path to json
|
232
|
+
},
|
233
|
+
panorama: { // type of panorama and paths to 360° images
|
234
|
+
type: "sphere", // 360° panorama or 'cube' for 6 images
|
235
|
+
items: {
|
236
|
+
[
|
237
|
+
camera_id: "" // camera id for panorama
|
238
|
+
room_id: "" // room id for panorama
|
239
|
+
images: [ // array of paths to 360° sphere and sides of the cube if type is cube
|
240
|
+
sphere: "",
|
241
|
+
front: null,
|
242
|
+
back: null,
|
243
|
+
left: null,
|
244
|
+
right: null,
|
245
|
+
top: null,
|
246
|
+
bottom: null,
|
247
|
+
scene_depth: "", // path to exr file for depth map if available
|
248
|
+
]
|
249
|
+
}
|
250
|
+
]
|
251
|
+
},
|
252
|
+
rotate: { // type of images and paths to circular view images
|
253
|
+
type: "top_down", // full model or model with cut in the middle ('middle_cut')
|
254
|
+
items: [ // array of paths to circular view images
|
255
|
+
""
|
256
|
+
]
|
257
|
+
}
|
258
|
+
```
|