@mappedin/mappedin-js 5.0.0-beta.3 → 5.0.0-beta.4

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.
@@ -28,6 +28,7 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue' {
28
28
  export type { TOperationHoursMap } from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/MappedinLocation';
29
29
  export type { TDirectionToOptions } from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/MappedinNavigatable';
30
30
  export { OfflineSearch } from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.OfflineSearch';
31
+ export type { TMappedinOfflineSearchOptions, TMappedinOfflineSearchResult, TMappedinOfflineSearchSuggestions, TMappedinOfflineAllSearchMatch } from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.OfflineSearch';
31
32
  /** API data types */
32
33
  export type { TLocationType, TNode, TImage, TLogo, TGalleryImage, TPhone, TSocial, TColor, TVortex, TPicture, TOpeningHours, TSiblingGroup, TState, TCategory, TEvent, TGeoReference, TMap, TMapGroup, TBuilding, TLocation, TPolygon, TPolygonRanking, TVenue, TMappedinAPI } from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.API.types';
33
34
  export type { TGetVenueOptions } from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.types';
@@ -1224,7 +1225,7 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.Offli
1224
1225
  *
1225
1226
  * @class Mappedin.OfflineSearch
1226
1227
  */
1227
- export type TOfflineSearchOptions = Partial<{
1228
+ type TOfflineSearchAllOptions = {
1228
1229
  /**
1229
1230
  * Array of stopwords to ignore when searching, default: english stopwords
1230
1231
  */
@@ -1257,6 +1258,11 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.Offli
1257
1258
  * Use the location polygons' rank in weighing results
1258
1259
  */
1259
1260
  useLocationRank?: boolean;
1261
+ /**
1262
+ * Emit Analytics events when doing search
1263
+ * @default true when running in production
1264
+ */
1265
+ emitAnalyticsEvents?: boolean;
1260
1266
  /**
1261
1267
  * Fine tune search constants
1262
1268
  */
@@ -1307,8 +1313,8 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.Offli
1307
1313
  */
1308
1314
  PRIMARY_INDEX_TAGS_NAME_WEIGHT: number;
1309
1315
  /**
1310
- * Default rank when one isn't available in the data, default = 0.1
1311
- * @default 0.1
1316
+ * Default rank when one isn't available in the data, default = 1
1317
+ * @default 1
1312
1318
  */
1313
1319
  LOCATION_DEFAULT_RANK: number;
1314
1320
  /**
@@ -1322,31 +1328,72 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.Offli
1322
1328
  */
1323
1329
  RATIO_OF_PREFIX_TO_EXACT: number;
1324
1330
  };
1325
- }>;
1331
+ };
1332
+ export type TMappedinOfflineAllSearchMatch = {
1333
+ /**
1334
+ * The term that was found
1335
+ */
1336
+ term: string;
1337
+ /**
1338
+ * Term's weight
1339
+ */
1340
+ weight: number;
1341
+ /**
1342
+ * What field the search matched on
1343
+ */
1344
+ matchesOn: string;
1345
+ /**
1346
+ * The value of that field
1347
+ */
1348
+ value?: string;
1349
+ };
1350
+ export type TMappedinOfflineSearchOptions = Partial<TOfflineSearchAllOptions>;
1326
1351
  export type TMappedinOfflineSearchResult = {
1327
- type: 'MappedinLocation' | 'MappedinCategory' | string;
1328
- matches: {
1329
- term: string;
1330
- weight: number;
1331
- matchesOn: string;
1332
- value?: string;
1333
- }[];
1352
+ /**
1353
+ * Type describing the object
1354
+ */
1355
+ type: 'MappedinLocation' | 'MappedinCategory' | 'Custom';
1356
+ /**
1357
+ * Details on why the result was returned
1358
+ */
1359
+ matches: TMappedinOfflineAllSearchMatch[];
1360
+ /**
1361
+ * Found object
1362
+ */
1334
1363
  object: MappedinLocation | MappedinCategory | Record<string, unknown>;
1364
+ /**
1365
+ * Total score of the result
1366
+ */
1335
1367
  score: number;
1336
1368
  };
1337
1369
  export type TMappedinOfflineSearchSuggestions = {
1370
+ /**
1371
+ * Total number of suggestions generated
1372
+ */
1338
1373
  total: number;
1374
+ /**
1375
+ * List of suggestions
1376
+ */
1339
1377
  hits: {
1378
+ /**
1379
+ * Suggestion text
1380
+ */
1340
1381
  text: string;
1341
1382
  }[];
1342
1383
  };
1384
+ /**
1385
+ * A {@link OfflineSearch} is an offline search module. It can be initialized at any time by passing the {@link Mappedin} object and a set of {@link TMappedinOfflineAllSearchOptions} options.
1386
+ *
1387
+ *
1388
+ * @class Mappedin.OfflineSearch
1389
+ */
1343
1390
  export class OfflineSearch {
1344
1391
  #private;
1345
1392
  constructor(
1346
1393
  /**
1347
1394
  * Mappedin Venue Object, typically returned by `getVenue`/`showVenue`
1348
1395
  */
1349
- mappedin: Mappedin, options?: TOfflineSearchOptions);
1396
+ mappedin: Mappedin, options?: TMappedinOfflineSearchOptions);
1350
1397
  /**
1351
1398
  * Get Suggestions for term
1352
1399
  */
@@ -1373,10 +1420,9 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.Offli
1373
1420
  */
1374
1421
  addQuery(params: {
1375
1422
  /**
1376
- * Query to match for this object, accepts a string, or
1377
- * a list of strings (for extra tags for example)
1423
+ * Query string to match for this object
1378
1424
  */
1379
- query: string | string[];
1425
+ query: string;
1380
1426
  /**
1381
1427
  * Object that is returned when query matches
1382
1428
  */
@@ -1981,6 +2027,7 @@ declare module '@mappedin/mappedin-js/lib/esm/get-venue/get-venue' {
1981
2027
  export type { TOperationHoursMap } from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/MappedinLocation';
1982
2028
  export type { TDirectionToOptions } from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/MappedinNavigatable';
1983
2029
  export { OfflineSearch } from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.OfflineSearch';
2030
+ export type { TMappedinOfflineSearchOptions, TMappedinOfflineSearchResult, TMappedinOfflineSearchSuggestions, TMappedinOfflineAllSearchMatch } from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.OfflineSearch';
1984
2031
  /** API data types */
1985
2032
  export type { TLocationType, TNode, TImage, TLogo, TGalleryImage, TPhone, TSocial, TColor, TVortex, TPicture, TOpeningHours, TSiblingGroup, TState, TCategory, TEvent, TGeoReference, TMap, TMapGroup, TBuilding, TLocation, TPolygon, TPolygonRanking, TVenue, TMappedinAPI } from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.API.types';
1986
2033
  export type { TGetVenueOptions } from '@mappedin/mappedin-js/lib/esm/get-venue/get-venue/Mappedin.types';