@searchstax-inc/searchstudio-ux-js 1.1.34 → 1.1.40
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 +76 -0
- package/README.mustache +58 -0
- package/dist/@searchstax-inc/searchstudio-ux-js.cjs +57 -57
- package/dist/@searchstax-inc/searchstudio-ux-js.d.mts +17 -0
- package/dist/@searchstax-inc/searchstudio-ux-js.d.ts +17 -0
- package/dist/@searchstax-inc/searchstudio-ux-js.iife.js +56 -56
- package/dist/@searchstax-inc/searchstudio-ux-js.mjs +1054 -1006
- package/dist/feedbackWidget.mjs +32 -26
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -102,6 +102,8 @@ Following widgets are available:
|
|
|
102
102
|
|
|
103
103
|
[Input Widget](#input-widget)
|
|
104
104
|
|
|
105
|
+
[Location Widget](#location-widget)
|
|
106
|
+
|
|
105
107
|
[Result Widget](#result-widget)
|
|
106
108
|
|
|
107
109
|
[Facets Widget](#facets-widget)
|
|
@@ -313,6 +315,80 @@ example of input widget initialization with various options
|
|
|
313
315
|
},
|
|
314
316
|
});
|
|
315
317
|
```
|
|
318
|
+
### Location Widget ###
|
|
319
|
+
|
|
320
|
+
Initialization properties
|
|
321
|
+
|
|
322
|
+
a. id of container where widget will be rendered
|
|
323
|
+
|
|
324
|
+
b. Input widget config object of type: [ISearchstaxLocationConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#h-search-results-interfaces)
|
|
325
|
+
|
|
326
|
+
example of results widget initialization with minimum options
|
|
327
|
+
```
|
|
328
|
+
function locationDecodeFunction(term: string): Promise<ISearchstaxLocation>{
|
|
329
|
+
return new Promise((resolve) => {
|
|
330
|
+
// make a request to geocoding API to retrieve lat, lon and address and then resolve promise
|
|
331
|
+
resolve({
|
|
332
|
+
address:'Address',
|
|
333
|
+
lat: lat,
|
|
334
|
+
lon: lon,
|
|
335
|
+
error: false
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
function locationDecodeCoordinatesToAddress(lat, lon): Promise<ISearchstaxLocation>{
|
|
341
|
+
return new Promise((resolve) => {
|
|
342
|
+
// make a request to geocoding API to convert lat, lon to address and then resolve promise
|
|
343
|
+
resolve({
|
|
344
|
+
address:'Address',
|
|
345
|
+
lat: lat,
|
|
346
|
+
lon: lon,
|
|
347
|
+
error: false
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
searchstax.addSearchLocationWidget("searchstax-location-container", {
|
|
352
|
+
hooks: {
|
|
353
|
+
locationDecode: locationDecodeFunction,
|
|
354
|
+
locationDecodeCoordinatesToAddress: locationDecodeCoordinatesToAddress
|
|
355
|
+
},
|
|
356
|
+
});
|
|
357
|
+
```
|
|
358
|
+
example of result widget initialization with various options
|
|
359
|
+
```
|
|
360
|
+
searchstax.addSearchLocationWidget("searchstax-location-container", {
|
|
361
|
+
templates:{
|
|
362
|
+
mainTemplate: {
|
|
363
|
+
template: `
|
|
364
|
+
<div class="searchstax-location-input-container" data-test-id="searchstax-location-input-container">
|
|
365
|
+
<div class="searchstax-location-input-wrapper">
|
|
366
|
+
<span class="searchstax-location-input-label">NEAR</span>
|
|
367
|
+
<div class="searchstax-location-input-wrapper-inner">
|
|
368
|
+
<input type="text" id="searchstax-location-input" class="searchstax-location-input" placeholder="Zip, Postal Code or City..." aria-label="Search Location Input" data-test-id="searchstax-location-input" />
|
|
369
|
+
<button id="searchstax-location-get-current-location" class="searchstax-get-current-location-button">Use my current location</button>
|
|
370
|
+
</div>
|
|
371
|
+
{{#shouldShowLocationDistanceDropdown}}
|
|
372
|
+
<span class="searchstax-location-input-label">WITHIN</span>
|
|
373
|
+
<select id="searchstax-location-radius-select" class="searchstax-location-radius-select" aria-label="Search Location Radius Select" data-test-id="searchstax-location-radius-select">
|
|
374
|
+
{{#locationSearchDistanceValues}}
|
|
375
|
+
<option value="{{value}}" {{#isSelected}}selected{{/isSelected}}>{{label}}</option>
|
|
376
|
+
{{/locationSearchDistanceValues}}
|
|
377
|
+
</select>
|
|
378
|
+
{{/shouldShowLocationDistanceDropdown}}
|
|
379
|
+
</div>
|
|
380
|
+
</div>
|
|
381
|
+
`,
|
|
382
|
+
locationInputId: "searchstax-location-input",
|
|
383
|
+
radiusInputId: "searchstax-location-radius-select"
|
|
384
|
+
},
|
|
385
|
+
},
|
|
386
|
+
hooks: {
|
|
387
|
+
locationDecode: locationDecodeFunction,
|
|
388
|
+
locationDecodeCoordinatesToAddress: locationDecodeCoordinatesToAddress
|
|
389
|
+
},
|
|
390
|
+
});
|
|
391
|
+
```
|
|
316
392
|
### Result Widget ###
|
|
317
393
|
Initialization properties
|
|
318
394
|
|
package/README.mustache
CHANGED
|
@@ -102,6 +102,8 @@ Following widgets are available:
|
|
|
102
102
|
|
|
103
103
|
[Input Widget](#input-widget)
|
|
104
104
|
|
|
105
|
+
[Location Widget](#location-widget)
|
|
106
|
+
|
|
105
107
|
[Result Widget](#result-widget)
|
|
106
108
|
|
|
107
109
|
[Facets Widget](#facets-widget)
|
|
@@ -214,6 +216,62 @@ example of input widget initialization with various options
|
|
|
214
216
|
},
|
|
215
217
|
});
|
|
216
218
|
```
|
|
219
|
+
### Location Widget ###
|
|
220
|
+
|
|
221
|
+
Initialization properties
|
|
222
|
+
|
|
223
|
+
a. id of container where widget will be rendered
|
|
224
|
+
|
|
225
|
+
b. Input widget config object of type: [ISearchstaxLocationConfig](https://www.searchstax.com/docs/searchstudio/interfaces/#h-search-results-interfaces)
|
|
226
|
+
|
|
227
|
+
example of results widget initialization with minimum options
|
|
228
|
+
```
|
|
229
|
+
function locationDecodeFunction(term: string): Promise<ISearchstaxLocation>{
|
|
230
|
+
return new Promise((resolve) => {
|
|
231
|
+
// make a request to geocoding API to retrieve lat, lon and address and then resolve promise
|
|
232
|
+
resolve({
|
|
233
|
+
address:'Address',
|
|
234
|
+
lat: lat,
|
|
235
|
+
lon: lon,
|
|
236
|
+
error: false
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function locationDecodeCoordinatesToAddress(lat, lon): Promise<ISearchstaxLocation>{
|
|
242
|
+
return new Promise((resolve) => {
|
|
243
|
+
// make a request to geocoding API to convert lat, lon to address and then resolve promise
|
|
244
|
+
resolve({
|
|
245
|
+
address:'Address',
|
|
246
|
+
lat: lat,
|
|
247
|
+
lon: lon,
|
|
248
|
+
error: false
|
|
249
|
+
});
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
searchstax.addSearchLocationWidget("searchstax-location-container", {
|
|
253
|
+
hooks: {
|
|
254
|
+
locationDecode: locationDecodeFunction,
|
|
255
|
+
locationDecodeCoordinatesToAddress: locationDecodeCoordinatesToAddress
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
```
|
|
259
|
+
example of result widget initialization with various options
|
|
260
|
+
```
|
|
261
|
+
searchstax.addSearchLocationWidget("searchstax-location-container", {
|
|
262
|
+
templates:{
|
|
263
|
+
mainTemplate: {
|
|
264
|
+
template: `{{&location.mainTemplate.template}}`,
|
|
265
|
+
locationInputId: "searchstax-location-input",
|
|
266
|
+
radiusInputId: "searchstax-location-radius-select"
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
hooks: {
|
|
270
|
+
locationDecode: locationDecodeFunction,
|
|
271
|
+
locationDecodeCoordinatesToAddress: locationDecodeCoordinatesToAddress
|
|
272
|
+
},
|
|
273
|
+
});
|
|
274
|
+
```
|
|
217
275
|
### Result Widget ###
|
|
218
276
|
Initialization properties
|
|
219
277
|
|