hart-estate-widget 4.0.0 → 4.0.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 CHANGED
@@ -166,79 +166,88 @@ html, body
166
166
  ## Parameters:
167
167
  Here you can see a list of accessible options and examples of usage. There are accessible values for each option below in the block "Types of Elements".
168
168
 
169
- ```ts
170
- type TWidgetTab =
171
- 'rotation' | // circular view images (order is mandatory)
172
- 'plan' | // original plan image
173
- 'panorama' ; // 360° images
174
-
175
- type TPanoramaControlType =
176
- 'ruler' | // Ruler button
177
- 'scale' | // Scale 1x, 2x, 0.5x button
178
- 'autoRotate' ; // Auto rotation button
179
-
180
- type TAppColor =
181
- 'main' | // Widget fill color
182
- 'mainText' ; // Widget text color
183
-
184
- type TWidgetLocale =
185
- 'en' | // English language
186
- 'ru' | // Russian language
187
- 'de' | // German language
188
- 'es' | // Spanish language
189
- 'ja' ; // Japanese language
190
-
191
- export type TConfig = {
192
- /** Widget API base URL */
193
- baseUrl: string;
194
-
195
- /** Widget locale */
196
- locale: TWidgetLocale;
197
- /** Overrides locale keys with custom text or translation */
198
- localeOverrides: Record<string, string>;
199
-
200
- /** Path/link to the logo */
201
- logoUrl: string;
202
- /** Link opened when logo is clicked */
203
- logoLinkUrl: string;
204
- /**
205
- * Widget color settings
206
- * - `main`: main color of buttons, elements
207
- * - `mainText`: text color for buttons, elements contrasting with the main color
208
- * */
209
- colors: Record<TAppColor, string>;
210
-
211
- /** First opened tab */
212
- primaryTab: TWidgetTab;
213
- /** Available widget tabs, defaults ['plan', 'rotation', 'panorama'] */
214
- tabs: TWidgetTab[];
215
- /** Path/link to the logo */
216
- /** Controls can be: ruler, autoRotate or scale */
217
- controls: TPanoramaControlType[];
218
-
219
- /** Enable/disable modal of instruction in 3D tour */
220
- isInstructionsVisible: boolean;
221
- /** Enable/disable auto rotation in 3D tour */
222
- isAutoRotate: boolean;
223
- /** Enable/disable device gyroscope for AR */
224
- isGyroscopeEnabled: boolean;
225
- /** Show/hide fullscreen button */
226
- isFullscreenButtonVisible: boolean;
227
- /** Show/hide current room type top label */
228
- isRoomLabelVisible?: boolean;
229
-
230
- /** Camera persective FOV */
231
- cameraFov: number;
232
-
233
- /** Time for fade in (seconds) */
234
- panoramaFadeTime: number;
235
-
236
- /** Widget external integrations */
237
- integrations: {
238
- /** Configuration options for the Sentry Browser SDK. */
239
- sentry?: BrowserOptions; // See https://docs.sentry.io/platforms/javascript/configuration/options/
240
- };
241
- };
169
+ ```json
170
+ {
171
+ // Widget API base URL
172
+ "baseUrl": "https://backend.estate.hart-digital.com",
173
+
174
+ // Widget locale can be one of
175
+ // "en" - English language
176
+ // "ru" - Russian language
177
+ // "de" - German language
178
+ // "es" - Spanish language
179
+ // "ja" - Japanese language
180
+ "locale": "en",
181
+ // Overrides locale keys with custom text or translation
182
+ "localeOverrides": {
183
+ "create-points": "Create a point",
184
+ "delete-points": "Remove point",
185
+ "research-plan": "Research plan",
186
+ "rotate-plan": "Rotate plan",
187
+ "ok": "Ok",
188
+ "ruler-ok": "Ok",
189
+ "made-by-link": "https://getfloorplan.com/",
190
+ "made-by-text": "getfloorplan.com",
191
+ "floor": "$0 floor",
192
+ "floorNumberEndings": {
193
+ "1": "$0st",
194
+ "2": "$0nd",
195
+ "3": "$0d",
196
+ "rest": "$0th"
197
+ }
198
+ },
199
+
200
+ // Path/link to the logo
201
+ "logoUrl": "https://getfloorplan.com/img/logo.58f6cd11.svg",
202
+ // Link opened when logo is clicked
203
+ "logoLinkUrl": "https://getfloorplan.com",
204
+ // Widget color settings in CSS color formal like: "rgba(255, 255, 255, 0)", "#ABCDEF", etc...
205
+ // "main" - main color of buttons, elements
206
+ // "mainText" - text color for buttons, elements contrasting with the main color
207
+ "colors": {
208
+ "main": "#FFA900",
209
+ "mainText": "#413E3E"
210
+ },
211
+
212
+ // First opened tab
213
+ "primaryTab": "panorama",
214
+ // Available widget tabs array with order:
215
+ // "panorama" - Panorama 360 tab
216
+ // "rotation" - Isometric plan rotation tab
217
+ // "plan" - Original plan tab
218
+ "tabs": ["plan", "rotation", "panorama"],
219
+
220
+ // Controls in bottom bar, can be:
221
+ // "ruler" - Ruler enable/disable button
222
+ // "scale" - Scale x1, x2, x0.5 button
223
+ // "autoRotate" - Auto rotate enable/disable button
224
+ "controls": ["ruler", "scale", "autoRotate"],
225
+
226
+ // Enable/disable modal of instruction in 3D tour
227
+ "isInstructionsVisible": true,
228
+ // Enable/disable auto rotation in 3D tour
229
+ "isAutoRotate": false,
230
+ // Enable/disable device gyroscope for AR
231
+ "isGyroscopeEnabled": true,
232
+ // Show/hide fullscreen button
233
+ "isFullscreenButtonVisible": true,
234
+ // Show/hide current room type top label
235
+ "isRoomLabelVisible": false,
236
+
237
+ // Camera persective FOV
238
+ "cameraFov": 75,
239
+
240
+ // Panorama fade time in seconds
241
+ "panoramaFadeTime": 0.5,
242
+
243
+ // Widget external integrations
244
+ "integrations": {
245
+ // https://docs.sentry.io/platforms/javascript/configuration/options/
246
+ "sentry": {
247
+ "dsn": "https://1234567890abcdef@sentry.com/12345"
248
+ }
249
+ }
250
+ }
242
251
  ```
243
252
 
244
253
  ## Widget object from the REST API
package/build/api.js CHANGED
@@ -1 +1 @@
1
- var r={d:(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},o:(r,e)=>Object.prototype.hasOwnProperty.call(r,e)},e={};r.d(e,{j:()=>t});class t{baseUrl;constructor(r){this.baseUrl=r}get headers(){return{Accept:"application/json;widget-version=4.0.0"}}loadCrmWidgetData=async r=>{if(!r)return this.makeError(404,"No crmPlanId!");try{const e=await this.fetch(`/api/crm/plans/${r}/v4/widget`);return e.ok?e.json():this.makeErrorFromResponse(e,"Failed to get CRM Plan widget data!")}catch(r){return this.makeError(520,r.message)}};loadWidgetData=async r=>{if(!r)return this.makeError(404,"No planId!");try{const e=await this.fetch(`/api/plans/${r}/v4/widget`);return e.ok?e.json():this.makeErrorFromResponse(e,"Failed to get Plan widget data!")}catch(r){return this.makeError(520,r.message)}};loadJson=async r=>{try{return(await fetch(r)).json()}catch(r){return this.makeError(500,r.message)}};makeError(r,e="Unknown error"){return{error:{status:r,message:e}}}async makeErrorFromResponse(r,e){if("application/json"===r.headers.get("Content-Type")){const e=await r.json();if("message"in e&&"string"==typeof e.message)return this.makeError(r.status,e.message)}return this.makeError(r.status,e)}fetch(r,e={headers:this.headers}){return fetch(`${this.baseUrl}${r}`,e)}}var a=e.j;export{a as Api};
1
+ var r={d:(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},o:(r,e)=>Object.prototype.hasOwnProperty.call(r,e)},e={};r.d(e,{j:()=>t});class t{baseUrl;constructor(r){this.baseUrl=r}get headers(){return{Accept:"application/json;widget-version=4.0.1"}}loadCrmWidgetData=async r=>{if(!r)return this.makeError(404,"No crmPlanId!");try{const e=await this.fetch(`/api/crm/plans/${r}/v4/widget`);return e.ok?e.json():this.makeErrorFromResponse(e,"Failed to get CRM Plan widget data!")}catch(r){return this.makeError(520,r.message)}};loadWidgetData=async r=>{if(!r)return this.makeError(404,"No planId!");try{const e=await this.fetch(`/api/plans/${r}/v4/widget`);return e.ok?e.json():this.makeErrorFromResponse(e,"Failed to get Plan widget data!")}catch(r){return this.makeError(520,r.message)}};loadJson=async r=>{try{return(await fetch(r)).json()}catch(r){return this.makeError(500,r.message)}};makeError(r,e="Unknown error"){return{error:{status:r,message:e}}}async makeErrorFromResponse(r,e){if("application/json"===r.headers.get("Content-Type")){const e=await r.json();if("message"in e&&"string"==typeof e.message)return this.makeError(r.status,e.message)}return this.makeError(r.status,e)}fetch(r,e={headers:this.headers}){return fetch(`${this.baseUrl}${r}`,e)}}var a=e.j;export{a as Api};