@wix/auto_sdk_atlas_autocomplete 1.0.0 → 1.0.2
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/build/{es/src/atlas-v2-prediction-autocomplete.types.d.ts → cjs/atlas-v2-prediction-autocomplete.universal-Bydmqyu-.d.ts} +29 -29
- package/build/cjs/index.d.ts +16 -1
- package/build/cjs/index.js +221 -15
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/meta.d.ts +69 -1
- package/build/cjs/meta.js +177 -15
- package/build/cjs/meta.js.map +1 -1
- package/build/{cjs/src/atlas-v2-prediction-autocomplete.types.d.ts → es/atlas-v2-prediction-autocomplete.universal-Bydmqyu-.d.mts} +29 -29
- package/build/es/index.d.mts +16 -0
- package/build/es/index.mjs +199 -0
- package/build/es/index.mjs.map +1 -0
- package/build/es/meta.d.mts +69 -0
- package/build/es/meta.mjs +153 -0
- package/build/es/meta.mjs.map +1 -0
- package/build/internal/cjs/{src/atlas-v2-prediction-autocomplete.types.d.ts → atlas-v2-prediction-autocomplete.universal-Bydmqyu-.d.ts} +29 -29
- package/build/internal/cjs/index.d.ts +16 -1
- package/build/internal/cjs/index.js +221 -15
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/meta.d.ts +69 -1
- package/build/internal/cjs/meta.js +177 -15
- package/build/internal/cjs/meta.js.map +1 -1
- package/build/internal/es/{src/atlas-v2-prediction-autocomplete.types.d.ts → atlas-v2-prediction-autocomplete.universal-Bydmqyu-.d.mts} +29 -29
- package/build/internal/es/index.d.mts +16 -0
- package/build/internal/es/index.mjs +199 -0
- package/build/internal/es/index.mjs.map +1 -0
- package/build/internal/es/meta.d.mts +69 -0
- package/build/internal/es/meta.mjs +153 -0
- package/build/internal/es/meta.mjs.map +1 -0
- package/package.json +11 -10
- package/build/cjs/index.typings.d.ts +0 -1
- package/build/cjs/index.typings.js +0 -18
- package/build/cjs/index.typings.js.map +0 -1
- package/build/cjs/src/atlas-v2-prediction-autocomplete.context.d.ts +0 -5
- package/build/cjs/src/atlas-v2-prediction-autocomplete.context.js +0 -9
- package/build/cjs/src/atlas-v2-prediction-autocomplete.context.js.map +0 -1
- package/build/cjs/src/atlas-v2-prediction-autocomplete.http.d.ts +0 -3
- package/build/cjs/src/atlas-v2-prediction-autocomplete.http.js +0 -134
- package/build/cjs/src/atlas-v2-prediction-autocomplete.http.js.map +0 -1
- package/build/cjs/src/atlas-v2-prediction-autocomplete.meta.d.ts +0 -13
- package/build/cjs/src/atlas-v2-prediction-autocomplete.meta.js +0 -47
- package/build/cjs/src/atlas-v2-prediction-autocomplete.meta.js.map +0 -1
- package/build/cjs/src/atlas-v2-prediction-autocomplete.public.d.ts +0 -14
- package/build/cjs/src/atlas-v2-prediction-autocomplete.public.js +0 -14
- package/build/cjs/src/atlas-v2-prediction-autocomplete.public.js.map +0 -1
- package/build/cjs/src/atlas-v2-prediction-autocomplete.types.js +0 -11
- package/build/cjs/src/atlas-v2-prediction-autocomplete.types.js.map +0 -1
- package/build/cjs/src/atlas-v2-prediction-autocomplete.universal.d.ts +0 -140
- package/build/cjs/src/atlas-v2-prediction-autocomplete.universal.js +0 -98
- package/build/cjs/src/atlas-v2-prediction-autocomplete.universal.js.map +0 -1
- package/build/es/index.d.ts +0 -1
- package/build/es/index.js +0 -2
- package/build/es/index.js.map +0 -1
- package/build/es/index.typings.d.ts +0 -1
- package/build/es/index.typings.js +0 -2
- package/build/es/index.typings.js.map +0 -1
- package/build/es/meta.d.ts +0 -1
- package/build/es/meta.js +0 -2
- package/build/es/meta.js.map +0 -1
- package/build/es/src/atlas-v2-prediction-autocomplete.context.d.ts +0 -5
- package/build/es/src/atlas-v2-prediction-autocomplete.context.js +0 -5
- package/build/es/src/atlas-v2-prediction-autocomplete.context.js.map +0 -1
- package/build/es/src/atlas-v2-prediction-autocomplete.http.d.ts +0 -3
- package/build/es/src/atlas-v2-prediction-autocomplete.http.js +0 -130
- package/build/es/src/atlas-v2-prediction-autocomplete.http.js.map +0 -1
- package/build/es/src/atlas-v2-prediction-autocomplete.meta.d.ts +0 -13
- package/build/es/src/atlas-v2-prediction-autocomplete.meta.js +0 -20
- package/build/es/src/atlas-v2-prediction-autocomplete.meta.js.map +0 -1
- package/build/es/src/atlas-v2-prediction-autocomplete.public.d.ts +0 -14
- package/build/es/src/atlas-v2-prediction-autocomplete.public.js +0 -9
- package/build/es/src/atlas-v2-prediction-autocomplete.public.js.map +0 -1
- package/build/es/src/atlas-v2-prediction-autocomplete.types.js +0 -8
- package/build/es/src/atlas-v2-prediction-autocomplete.types.js.map +0 -1
- package/build/es/src/atlas-v2-prediction-autocomplete.universal.d.ts +0 -140
- package/build/es/src/atlas-v2-prediction-autocomplete.universal.js +0 -71
- package/build/es/src/atlas-v2-prediction-autocomplete.universal.js.map +0 -1
- package/build/internal/cjs/index.typings.d.ts +0 -1
- package/build/internal/cjs/index.typings.js +0 -18
- package/build/internal/cjs/index.typings.js.map +0 -1
- package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.context.d.ts +0 -5
- package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.context.js +0 -9
- package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.context.js.map +0 -1
- package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.http.d.ts +0 -3
- package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.http.js +0 -134
- package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.http.js.map +0 -1
- package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.meta.d.ts +0 -13
- package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.meta.js +0 -47
- package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.meta.js.map +0 -1
- package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.public.d.ts +0 -14
- package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.public.js +0 -14
- package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.public.js.map +0 -1
- package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.types.js +0 -11
- package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.types.js.map +0 -1
- package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.universal.d.ts +0 -140
- package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.universal.js +0 -98
- package/build/internal/cjs/src/atlas-v2-prediction-autocomplete.universal.js.map +0 -1
- package/build/internal/es/index.d.ts +0 -1
- package/build/internal/es/index.js +0 -2
- package/build/internal/es/index.js.map +0 -1
- package/build/internal/es/index.typings.d.ts +0 -1
- package/build/internal/es/index.typings.js +0 -2
- package/build/internal/es/index.typings.js.map +0 -1
- package/build/internal/es/meta.d.ts +0 -1
- package/build/internal/es/meta.js +0 -2
- package/build/internal/es/meta.js.map +0 -1
- package/build/internal/es/src/atlas-v2-prediction-autocomplete.context.d.ts +0 -5
- package/build/internal/es/src/atlas-v2-prediction-autocomplete.context.js +0 -5
- package/build/internal/es/src/atlas-v2-prediction-autocomplete.context.js.map +0 -1
- package/build/internal/es/src/atlas-v2-prediction-autocomplete.http.d.ts +0 -3
- package/build/internal/es/src/atlas-v2-prediction-autocomplete.http.js +0 -130
- package/build/internal/es/src/atlas-v2-prediction-autocomplete.http.js.map +0 -1
- package/build/internal/es/src/atlas-v2-prediction-autocomplete.meta.d.ts +0 -13
- package/build/internal/es/src/atlas-v2-prediction-autocomplete.meta.js +0 -20
- package/build/internal/es/src/atlas-v2-prediction-autocomplete.meta.js.map +0 -1
- package/build/internal/es/src/atlas-v2-prediction-autocomplete.public.d.ts +0 -14
- package/build/internal/es/src/atlas-v2-prediction-autocomplete.public.js +0 -9
- package/build/internal/es/src/atlas-v2-prediction-autocomplete.public.js.map +0 -1
- package/build/internal/es/src/atlas-v2-prediction-autocomplete.types.js +0 -8
- package/build/internal/es/src/atlas-v2-prediction-autocomplete.types.js.map +0 -1
- package/build/internal/es/src/atlas-v2-prediction-autocomplete.universal.d.ts +0 -140
- package/build/internal/es/src/atlas-v2-prediction-autocomplete.universal.js +0 -71
- package/build/internal/es/src/atlas-v2-prediction-autocomplete.universal.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
interface Prediction {
|
|
2
2
|
/** The human-readable name of the prediction */
|
|
3
3
|
description?: string;
|
|
4
4
|
/** The id of the prediction that can be use in place api. Available for short time. */
|
|
@@ -10,11 +10,11 @@ export interface Prediction {
|
|
|
10
10
|
/** Contains an integer indicating the straight-line distance between the predicted place, and the specified origin point, in meters. */
|
|
11
11
|
distanceInMeters?: number | null;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
interface MatchedSubstrings {
|
|
14
14
|
length?: number;
|
|
15
15
|
offset?: number;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
interface TextStructure {
|
|
18
18
|
/** Contains the main text of a prediction, usually the name of the place */
|
|
19
19
|
mainText?: string;
|
|
20
20
|
/** Contains the secondary text of a prediction, usually the location of the place */
|
|
@@ -22,7 +22,7 @@ export interface TextStructure {
|
|
|
22
22
|
/** Contains an array with offset value and length. These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired */
|
|
23
23
|
mainTextMatchedSubstrings?: MatchedSubstrings[];
|
|
24
24
|
}
|
|
25
|
-
|
|
25
|
+
interface ListPredictionsRequest {
|
|
26
26
|
/** The text the predictions will be based on. */
|
|
27
27
|
input?: string;
|
|
28
28
|
/** The origin point from which to calculate straight-line distance to the destination */
|
|
@@ -34,28 +34,30 @@ export interface ListPredictionsRequest {
|
|
|
34
34
|
/** Filters the user can add in order to get more accurate results */
|
|
35
35
|
filterBy?: FilterBy[];
|
|
36
36
|
}
|
|
37
|
-
|
|
37
|
+
interface AddressLocation {
|
|
38
38
|
/** Address latitude. */
|
|
39
39
|
latitude?: number | null;
|
|
40
40
|
/** Address longitude. */
|
|
41
41
|
longitude?: number | null;
|
|
42
42
|
}
|
|
43
|
-
|
|
43
|
+
interface FilterBy {
|
|
44
44
|
/** One of the filter types enum */
|
|
45
|
-
filterType?:
|
|
45
|
+
filterType?: FilterTypeWithLiterals;
|
|
46
46
|
/** Free text like "us" */
|
|
47
47
|
filterValue?: string;
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
declare enum FilterType {
|
|
50
50
|
/** Filter by zip code */
|
|
51
51
|
zip_code = "zip_code",
|
|
52
52
|
/** Filter by 2-letters or 3-letters country code */
|
|
53
53
|
country_code = "country_code"
|
|
54
54
|
}
|
|
55
|
-
|
|
55
|
+
/** @enumType */
|
|
56
|
+
type FilterTypeWithLiterals = FilterType | 'zip_code' | 'country_code';
|
|
57
|
+
interface ListPredictionsResponse {
|
|
56
58
|
predictions?: Prediction[];
|
|
57
59
|
}
|
|
58
|
-
|
|
60
|
+
interface PredictRequest {
|
|
59
61
|
/**
|
|
60
62
|
* The text the predictions will be based on.
|
|
61
63
|
* @minLength 1
|
|
@@ -75,25 +77,23 @@ export interface PredictRequest {
|
|
|
75
77
|
*/
|
|
76
78
|
sessionToken?: string | null;
|
|
77
79
|
}
|
|
78
|
-
|
|
80
|
+
interface PredictResponse {
|
|
79
81
|
predictions?: Prediction[];
|
|
80
82
|
}
|
|
81
|
-
interface
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
export interface PredictResponseNonNullableFields {
|
|
97
|
-
predictions: PredictionNonNullableFields[];
|
|
83
|
+
interface PredictOptions {
|
|
84
|
+
/** The origin point from which to calculate straight-line distance to the destination */
|
|
85
|
+
origin?: AddressLocation;
|
|
86
|
+
/** The point around which you wish to retrieve place information */
|
|
87
|
+
location?: AddressLocation;
|
|
88
|
+
/** The acceptable distance from that location (in meters) */
|
|
89
|
+
radius?: string | null;
|
|
90
|
+
/** alpha-2 or alpha-3 ISO-3166 country codes to filter by */
|
|
91
|
+
countryCodes?: string[];
|
|
92
|
+
/**
|
|
93
|
+
* A random string which identifies an autocomplete session for billing purposes. The session begins when the user starts typing a query, and concludes when they select a place and a call to Get Place is made. Once a session has concluded, the token is no longer valid. your app must generate a fresh token for each session.
|
|
94
|
+
* @format GUID
|
|
95
|
+
*/
|
|
96
|
+
sessionToken?: string | null;
|
|
98
97
|
}
|
|
99
|
-
|
|
98
|
+
|
|
99
|
+
export { type AddressLocation as A, FilterType as F, type ListPredictionsRequest as L, type MatchedSubstrings as M, type PredictOptions as P, type TextStructure as T, type PredictResponse as a, type Prediction as b, type FilterBy as c, type ListPredictionsResponse as d, type PredictRequest as e };
|
package/build/cjs/index.d.ts
CHANGED
|
@@ -1 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { HttpClient, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
|
|
2
|
+
import { P as PredictOptions, a as PredictResponse } from './atlas-v2-prediction-autocomplete.universal-Bydmqyu-.js';
|
|
3
|
+
export { A as AddressLocation, c as FilterBy, F as FilterType, L as ListPredictionsRequest, d as ListPredictionsResponse, M as MatchedSubstrings, e as PredictRequest, b as Prediction, T as TextStructure } from './atlas-v2-prediction-autocomplete.universal-Bydmqyu-.js';
|
|
4
|
+
|
|
5
|
+
declare function predict$1(httpClient: HttpClient): PredictSignature;
|
|
6
|
+
interface PredictSignature {
|
|
7
|
+
/**
|
|
8
|
+
* A Predict end-point take an input and returns an list of Prediction object.
|
|
9
|
+
* @param - The text the predictions will be based on.
|
|
10
|
+
*/
|
|
11
|
+
(input: string, options?: PredictOptions | undefined): Promise<PredictResponse>;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
declare const predict: MaybeContext<BuildRESTFunction<typeof predict$1> & typeof predict$1>;
|
|
15
|
+
|
|
16
|
+
export { PredictOptions, PredictResponse, predict };
|
package/build/cjs/index.js
CHANGED
|
@@ -1,18 +1,224 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
9
|
};
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
FilterType: () => FilterType,
|
|
24
|
+
predict: () => predict4
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(index_exports);
|
|
27
|
+
|
|
28
|
+
// src/atlas-v2-prediction-autocomplete.universal.ts
|
|
29
|
+
var import_transform_error = require("@wix/sdk-runtime/transform-error");
|
|
30
|
+
var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
|
|
31
|
+
|
|
32
|
+
// src/atlas-v2-prediction-autocomplete.http.ts
|
|
33
|
+
var import_float = require("@wix/sdk-runtime/transformations/float");
|
|
34
|
+
var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
35
|
+
var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
|
|
36
|
+
function resolveComWixpressViAtlasServiceV2AutocompleteServiceV2Url(opts) {
|
|
37
|
+
const domainToMappings = {
|
|
38
|
+
"api._api_base_domain_": [
|
|
39
|
+
{
|
|
40
|
+
srcPath: "/wix-atlas-service-web",
|
|
41
|
+
destPath: ""
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
"bo._base_domain_": [
|
|
45
|
+
{
|
|
46
|
+
srcPath: "/wix-atlas-service-web",
|
|
47
|
+
destPath: ""
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"wixbo.ai": [
|
|
51
|
+
{
|
|
52
|
+
srcPath: "/wix-atlas-service-web",
|
|
53
|
+
destPath: ""
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"wix-bo.com": [
|
|
57
|
+
{
|
|
58
|
+
srcPath: "/wix-atlas-service-web",
|
|
59
|
+
destPath: ""
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
_: [
|
|
63
|
+
{
|
|
64
|
+
srcPath: "/api/wix-atlas-service-web",
|
|
65
|
+
destPath: ""
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
srcPath: "/_api/wix-atlas-service-web",
|
|
69
|
+
destPath: ""
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"www._base_domain_": [
|
|
73
|
+
{
|
|
74
|
+
srcPath: "/wix-atlas-service-web",
|
|
75
|
+
destPath: ""
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
srcPath: "/_api/wix-atlas-service-web",
|
|
79
|
+
destPath: ""
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
srcPath: "/api/wix-atlas-service-web",
|
|
83
|
+
destPath: ""
|
|
84
|
+
}
|
|
85
|
+
],
|
|
86
|
+
"manage._base_domain_": [
|
|
87
|
+
{
|
|
88
|
+
srcPath: "/wix-atlas-service-web",
|
|
89
|
+
destPath: ""
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"editor._base_domain_": [
|
|
93
|
+
{
|
|
94
|
+
srcPath: "/wix-atlas-service-web",
|
|
95
|
+
destPath: ""
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
srcPath: "/api/wix-atlas-service-web",
|
|
99
|
+
destPath: ""
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"blocks._base_domain_": [
|
|
103
|
+
{
|
|
104
|
+
srcPath: "/wix-atlas-service-web",
|
|
105
|
+
destPath: ""
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
srcPath: "/api/wix-atlas-service-web",
|
|
109
|
+
destPath: ""
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"create.editorx": [
|
|
113
|
+
{
|
|
114
|
+
srcPath: "/wix-atlas-service-web",
|
|
115
|
+
destPath: ""
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
srcPath: "/api/wix-atlas-service-web",
|
|
119
|
+
destPath: ""
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"editor.wixapps.net": [
|
|
123
|
+
{
|
|
124
|
+
srcPath: "/api/wix-atlas-service-web",
|
|
125
|
+
destPath: ""
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
};
|
|
129
|
+
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
130
|
+
}
|
|
131
|
+
var PACKAGE_NAME = "@wix/auto_sdk_atlas_autocomplete";
|
|
132
|
+
function predict(payload) {
|
|
133
|
+
function __predict({ host }) {
|
|
134
|
+
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
135
|
+
{
|
|
136
|
+
transformFn: import_float.transformSDKFloatToRESTFloat,
|
|
137
|
+
paths: [
|
|
138
|
+
{ path: "origin.latitude" },
|
|
139
|
+
{ path: "origin.longitude" },
|
|
140
|
+
{ path: "location.latitude" },
|
|
141
|
+
{ path: "location.longitude" }
|
|
142
|
+
]
|
|
143
|
+
}
|
|
144
|
+
]);
|
|
145
|
+
const metadata = {
|
|
146
|
+
entityFqdn: "wix.atlas.v2.prediction",
|
|
147
|
+
method: "POST",
|
|
148
|
+
methodFqn: "com.wixpress.vi.atlas.service.v2.AutocompleteServiceV2.Predict",
|
|
149
|
+
packageName: PACKAGE_NAME,
|
|
150
|
+
url: resolveComWixpressViAtlasServiceV2AutocompleteServiceV2Url({
|
|
151
|
+
protoPath: "/v2/predict",
|
|
152
|
+
data: serializedData,
|
|
153
|
+
host
|
|
154
|
+
}),
|
|
155
|
+
data: serializedData
|
|
156
|
+
};
|
|
157
|
+
return metadata;
|
|
158
|
+
}
|
|
159
|
+
return __predict;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// src/atlas-v2-prediction-autocomplete.universal.ts
|
|
163
|
+
var FilterType = /* @__PURE__ */ ((FilterType2) => {
|
|
164
|
+
FilterType2["zip_code"] = "zip_code";
|
|
165
|
+
FilterType2["country_code"] = "country_code";
|
|
166
|
+
return FilterType2;
|
|
167
|
+
})(FilterType || {});
|
|
168
|
+
async function predict2(input, options) {
|
|
169
|
+
const { httpClient, sideEffects } = arguments[2];
|
|
170
|
+
const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
|
|
171
|
+
input,
|
|
172
|
+
origin: options?.origin,
|
|
173
|
+
location: options?.location,
|
|
174
|
+
radius: options?.radius,
|
|
175
|
+
countryCodes: options?.countryCodes,
|
|
176
|
+
sessionToken: options?.sessionToken
|
|
177
|
+
});
|
|
178
|
+
const reqOpts = predict(payload);
|
|
179
|
+
sideEffects?.onSiteCall?.();
|
|
180
|
+
try {
|
|
181
|
+
const result = await httpClient.request(reqOpts);
|
|
182
|
+
sideEffects?.onSuccess?.(result);
|
|
183
|
+
return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
|
|
184
|
+
} catch (err) {
|
|
185
|
+
const transformedError = (0, import_transform_error.transformError)(
|
|
186
|
+
err,
|
|
187
|
+
{
|
|
188
|
+
spreadPathsToArguments: {},
|
|
189
|
+
explicitPathsToArguments: {
|
|
190
|
+
input: "$[0]",
|
|
191
|
+
origin: "$[1].origin",
|
|
192
|
+
location: "$[1].location",
|
|
193
|
+
radius: "$[1].radius",
|
|
194
|
+
countryCodes: "$[1].countryCodes",
|
|
195
|
+
sessionToken: "$[1].sessionToken"
|
|
196
|
+
},
|
|
197
|
+
singleArgumentUnchanged: false
|
|
198
|
+
},
|
|
199
|
+
["input", "options"]
|
|
200
|
+
);
|
|
201
|
+
sideEffects?.onError?.(err);
|
|
202
|
+
throw transformedError;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// src/atlas-v2-prediction-autocomplete.public.ts
|
|
207
|
+
function predict3(httpClient) {
|
|
208
|
+
return (input, options) => predict2(
|
|
209
|
+
input,
|
|
210
|
+
options,
|
|
211
|
+
// @ts-ignore
|
|
212
|
+
{ httpClient }
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// src/atlas-v2-prediction-autocomplete.context.ts
|
|
217
|
+
var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
|
|
218
|
+
var predict4 = /* @__PURE__ */ (0, import_rest_modules2.createRESTModule)(predict3);
|
|
219
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
220
|
+
0 && (module.exports = {
|
|
221
|
+
FilterType,
|
|
222
|
+
predict
|
|
223
|
+
});
|
|
18
224
|
//# sourceMappingURL=index.js.map
|
package/build/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oFAAkE"}
|
|
1
|
+
{"version":3,"sources":["../../index.ts","../../src/atlas-v2-prediction-autocomplete.universal.ts","../../src/atlas-v2-prediction-autocomplete.http.ts","../../src/atlas-v2-prediction-autocomplete.public.ts","../../src/atlas-v2-prediction-autocomplete.context.ts"],"sourcesContent":["export * from './src/atlas-v2-prediction-autocomplete.context.js';\n","import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixAtlasV2Prediction from './atlas-v2-prediction-autocomplete.http.js';\n\nexport interface Prediction {\n /** The human-readable name of the prediction */\n description?: string;\n /** The id of the prediction that can be use in place api. Available for short time. */\n searchId?: string;\n /** Contains an array with offset value and length. These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired */\n matchedSubstrings?: MatchedSubstrings[];\n /** Provides pre-formatted text that can be shown in your autocomplete results */\n textStructure?: TextStructure;\n /** Contains an integer indicating the straight-line distance between the predicted place, and the specified origin point, in meters. */\n distanceInMeters?: number | null;\n}\n\nexport interface MatchedSubstrings {\n length?: number;\n offset?: number;\n}\n\nexport interface TextStructure {\n /** Contains the main text of a prediction, usually the name of the place */\n mainText?: string;\n /** Contains the secondary text of a prediction, usually the location of the place */\n secondaryText?: string;\n /** Contains an array with offset value and length. These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired */\n mainTextMatchedSubstrings?: MatchedSubstrings[];\n}\n\nexport interface ListPredictionsRequest {\n /** The text the predictions will be based on. */\n input?: string;\n /** The origin point from which to calculate straight-line distance to the destination */\n origin?: AddressLocation;\n /** The point around which you wish to retrieve place information */\n location?: AddressLocation;\n /** The acceptable distance from that location (in meters) */\n radius?: string | null;\n /** Filters the user can add in order to get more accurate results */\n filterBy?: FilterBy[];\n}\n\nexport interface AddressLocation {\n /** Address latitude. */\n latitude?: number | null;\n /** Address longitude. */\n longitude?: number | null;\n}\n\nexport interface FilterBy {\n /** One of the filter types enum */\n filterType?: FilterTypeWithLiterals;\n /** Free text like \"us\" */\n filterValue?: string;\n}\n\nexport enum FilterType {\n /** Filter by zip code */\n zip_code = 'zip_code',\n /** Filter by 2-letters or 3-letters country code */\n country_code = 'country_code',\n}\n\n/** @enumType */\nexport type FilterTypeWithLiterals = FilterType | 'zip_code' | 'country_code';\n\nexport interface ListPredictionsResponse {\n predictions?: Prediction[];\n}\n\nexport interface PredictRequest {\n /**\n * The text the predictions will be based on.\n * @minLength 1\n */\n input: string;\n /** The origin point from which to calculate straight-line distance to the destination */\n origin?: AddressLocation;\n /** The point around which you wish to retrieve place information */\n location?: AddressLocation;\n /** The acceptable distance from that location (in meters) */\n radius?: string | null;\n /** alpha-2 or alpha-3 ISO-3166 country codes to filter by */\n countryCodes?: string[];\n /**\n * A random string which identifies an autocomplete session for billing purposes. The session begins when the user starts typing a query, and concludes when they select a place and a call to Get Place is made. Once a session has concluded, the token is no longer valid. your app must generate a fresh token for each session.\n * @format GUID\n */\n sessionToken?: string | null;\n}\n\nexport interface PredictResponse {\n predictions?: Prediction[];\n}\n\ntype PredictionNonNullablePaths =\n | `description`\n | `searchId`\n | `matchedSubstrings`\n | `matchedSubstrings.${number}.length`\n | `matchedSubstrings.${number}.offset`\n | `textStructure.mainText`\n | `textStructure.secondaryText`\n | `textStructure.mainTextMatchedSubstrings`\n | `textStructure.mainTextMatchedSubstrings.${number}.length`\n | `textStructure.mainTextMatchedSubstrings.${number}.offset`;\n\n/**\n * A Predict end-point take an input and returns an list of Prediction object.\n * @param input - The text the predictions will be based on.\n * @public\n * @documentationMaturity preview\n * @requiredField input\n * @permissionId WIX_ATLAS.LIST_PREDICTIONS\n * @applicableIdentity APP\n * @applicableIdentity VISITOR\n * @fqn com.wixpress.vi.atlas.service.v2.AutocompleteServiceV2.Predict\n */\nexport async function predict(\n input: string,\n options?: PredictOptions\n): Promise<\n NonNullablePaths<\n PredictResponse,\n {\n [P in PredictionNonNullablePaths]: `predictions.${number}.${P}`;\n }[PredictionNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[2] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n input: input,\n origin: options?.origin,\n location: options?.location,\n radius: options?.radius,\n countryCodes: options?.countryCodes,\n sessionToken: options?.sessionToken,\n });\n\n const reqOpts = ambassadorWixAtlasV2Prediction.predict(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n input: '$[0]',\n origin: '$[1].origin',\n location: '$[1].location',\n radius: '$[1].radius',\n countryCodes: '$[1].countryCodes',\n sessionToken: '$[1].sessionToken',\n },\n singleArgumentUnchanged: false,\n },\n ['input', 'options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface PredictOptions {\n /** The origin point from which to calculate straight-line distance to the destination */\n origin?: AddressLocation;\n /** The point around which you wish to retrieve place information */\n location?: AddressLocation;\n /** The acceptable distance from that location (in meters) */\n radius?: string | null;\n /** alpha-2 or alpha-3 ISO-3166 country codes to filter by */\n countryCodes?: string[];\n /**\n * A random string which identifies an autocomplete session for billing purposes. The session begins when the user starts typing a query, and concludes when they select a place and a call to Get Place is made. Once a session has concluded, the token is no longer valid. your app must generate a fresh token for each session.\n * @format GUID\n */\n sessionToken?: string | null;\n}\n","import { transformSDKFloatToRESTFloat } from '@wix/sdk-runtime/transformations/float';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveComWixpressViAtlasServiceV2AutocompleteServiceV2Url(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'api._api_base_domain_': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'bo._base_domain_': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'wixbo.ai': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'wix-bo.com': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n ],\n _: [\n {\n srcPath: '/api/wix-atlas-service-web',\n destPath: '',\n },\n {\n srcPath: '/_api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n {\n srcPath: '/_api/wix-atlas-service-web',\n destPath: '',\n },\n {\n srcPath: '/api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'manage._base_domain_': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n {\n srcPath: '/api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n {\n srcPath: '/api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/wix-atlas-service-web',\n destPath: '',\n },\n {\n srcPath: '/api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'editor.wixapps.net': [\n {\n srcPath: '/api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_atlas_autocomplete';\n\n/** A Predict end-point take an input and returns an list of Prediction object. */\nexport function predict(payload: object): RequestOptionsFactory<any> {\n function __predict({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKFloatToRESTFloat,\n paths: [\n { path: 'origin.latitude' },\n { path: 'origin.longitude' },\n { path: 'location.latitude' },\n { path: 'location.longitude' },\n ],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.atlas.v2.prediction',\n method: 'POST' as any,\n methodFqn:\n 'com.wixpress.vi.atlas.service.v2.AutocompleteServiceV2.Predict',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressViAtlasServiceV2AutocompleteServiceV2Url({\n protoPath: '/v2/predict',\n data: serializedData,\n host,\n }),\n data: serializedData,\n };\n\n return metadata;\n }\n\n return __predict;\n}\n","import { HttpClient } from '@wix/sdk-types';\nimport {\n PredictOptions,\n PredictResponse,\n predict as universalPredict,\n} from './atlas-v2-prediction-autocomplete.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/atlas' };\n\nexport function predict(httpClient: HttpClient): PredictSignature {\n return (input: string, options?: PredictOptions) =>\n universalPredict(\n input,\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface PredictSignature {\n /**\n * A Predict end-point take an input and returns an list of Prediction object.\n * @param - The text the predictions will be based on.\n */\n (\n input: string,\n options?: PredictOptions | undefined\n ): Promise<PredictResponse>;\n}\n\nexport {\n AddressLocation,\n FilterBy,\n FilterType,\n ListPredictionsRequest,\n ListPredictionsResponse,\n MatchedSubstrings,\n PredictOptions,\n PredictRequest,\n PredictResponse,\n Prediction,\n TextStructure,\n} from './atlas-v2-prediction-autocomplete.universal.js';\n","import { predict as publicPredict } from './atlas-v2-prediction-autocomplete.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const predict: MaybeContext<\n BuildRESTFunction<typeof publicPredict> & typeof publicPredict\n> = /*#__PURE__*/ createRESTModule(publicPredict);\n\nexport { FilterType } from './atlas-v2-prediction-autocomplete.universal.js';\nexport {\n Prediction,\n MatchedSubstrings,\n TextStructure,\n ListPredictionsRequest,\n AddressLocation,\n FilterBy,\n ListPredictionsResponse,\n PredictRequest,\n PredictResponse,\n PredictOptions,\n} from './atlas-v2-prediction-autocomplete.universal.js';\n"],"mappings":"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","names":["predict","FilterType","predict","sdkTransformError","predict","import_rest_modules","predict"]}
|
package/build/cjs/meta.d.ts
CHANGED
|
@@ -1 +1,69 @@
|
|
|
1
|
-
|
|
1
|
+
import { e as PredictRequest$1, a as PredictResponse$1 } from './atlas-v2-prediction-autocomplete.universal-Bydmqyu-.js';
|
|
2
|
+
|
|
3
|
+
interface Prediction {
|
|
4
|
+
/** The human-readable name of the prediction */
|
|
5
|
+
description?: string;
|
|
6
|
+
/** The id of the prediction that can be use in place api. Available for short time. */
|
|
7
|
+
searchId?: string;
|
|
8
|
+
/** Contains an array with offset value and length. These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired */
|
|
9
|
+
matchedSubstrings?: MatchedSubstrings[];
|
|
10
|
+
/** Provides pre-formatted text that can be shown in your autocomplete results */
|
|
11
|
+
textStructure?: TextStructure;
|
|
12
|
+
/** Contains an integer indicating the straight-line distance between the predicted place, and the specified origin point, in meters. */
|
|
13
|
+
distanceInMeters?: number | null;
|
|
14
|
+
}
|
|
15
|
+
interface MatchedSubstrings {
|
|
16
|
+
length?: number;
|
|
17
|
+
offset?: number;
|
|
18
|
+
}
|
|
19
|
+
interface TextStructure {
|
|
20
|
+
/** Contains the main text of a prediction, usually the name of the place */
|
|
21
|
+
mainText?: string;
|
|
22
|
+
/** Contains the secondary text of a prediction, usually the location of the place */
|
|
23
|
+
secondaryText?: string;
|
|
24
|
+
/** Contains an array with offset value and length. These describe the location of the entered term in the prediction result text, so that the term can be highlighted if desired */
|
|
25
|
+
mainTextMatchedSubstrings?: MatchedSubstrings[];
|
|
26
|
+
}
|
|
27
|
+
interface AddressLocation {
|
|
28
|
+
/** Address latitude. */
|
|
29
|
+
latitude?: number | null;
|
|
30
|
+
/** Address longitude. */
|
|
31
|
+
longitude?: number | null;
|
|
32
|
+
}
|
|
33
|
+
interface PredictRequest {
|
|
34
|
+
/**
|
|
35
|
+
* The text the predictions will be based on.
|
|
36
|
+
* @minLength 1
|
|
37
|
+
*/
|
|
38
|
+
input: string;
|
|
39
|
+
/** The origin point from which to calculate straight-line distance to the destination */
|
|
40
|
+
origin?: AddressLocation;
|
|
41
|
+
/** The point around which you wish to retrieve place information */
|
|
42
|
+
location?: AddressLocation;
|
|
43
|
+
/** The acceptable distance from that location (in meters) */
|
|
44
|
+
radius?: string | null;
|
|
45
|
+
/** alpha-2 or alpha-3 ISO-3166 country codes to filter by */
|
|
46
|
+
countryCodes?: string[];
|
|
47
|
+
/**
|
|
48
|
+
* A random string which identifies an autocomplete session for billing purposes. The session begins when the user starts typing a query, and concludes when they select a place and a call to Get Place is made. Once a session has concluded, the token is no longer valid. your app must generate a fresh token for each session.
|
|
49
|
+
* @format GUID
|
|
50
|
+
*/
|
|
51
|
+
sessionToken?: string | null;
|
|
52
|
+
}
|
|
53
|
+
interface PredictResponse {
|
|
54
|
+
predictions?: Prediction[];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
type __PublicMethodMetaInfo<K = string, M = unknown, T = unknown, S = unknown, Q = unknown, R = unknown> = {
|
|
58
|
+
getUrl: (context: any) => string;
|
|
59
|
+
httpMethod: K;
|
|
60
|
+
path: string;
|
|
61
|
+
pathParams: M;
|
|
62
|
+
__requestType: T;
|
|
63
|
+
__originalRequestType: S;
|
|
64
|
+
__responseType: Q;
|
|
65
|
+
__originalResponseType: R;
|
|
66
|
+
};
|
|
67
|
+
declare function predict(): __PublicMethodMetaInfo<'POST', {}, PredictRequest$1, PredictRequest, PredictResponse$1, PredictResponse>;
|
|
68
|
+
|
|
69
|
+
export { type __PublicMethodMetaInfo, predict };
|
package/build/cjs/meta.js
CHANGED
|
@@ -1,18 +1,180 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
9
|
};
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// meta.ts
|
|
21
|
+
var meta_exports = {};
|
|
22
|
+
__export(meta_exports, {
|
|
23
|
+
predict: () => predict2
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(meta_exports);
|
|
26
|
+
|
|
27
|
+
// src/atlas-v2-prediction-autocomplete.http.ts
|
|
28
|
+
var import_float = require("@wix/sdk-runtime/transformations/float");
|
|
29
|
+
var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
|
|
30
|
+
var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
|
|
31
|
+
function resolveComWixpressViAtlasServiceV2AutocompleteServiceV2Url(opts) {
|
|
32
|
+
const domainToMappings = {
|
|
33
|
+
"api._api_base_domain_": [
|
|
34
|
+
{
|
|
35
|
+
srcPath: "/wix-atlas-service-web",
|
|
36
|
+
destPath: ""
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"bo._base_domain_": [
|
|
40
|
+
{
|
|
41
|
+
srcPath: "/wix-atlas-service-web",
|
|
42
|
+
destPath: ""
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"wixbo.ai": [
|
|
46
|
+
{
|
|
47
|
+
srcPath: "/wix-atlas-service-web",
|
|
48
|
+
destPath: ""
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"wix-bo.com": [
|
|
52
|
+
{
|
|
53
|
+
srcPath: "/wix-atlas-service-web",
|
|
54
|
+
destPath: ""
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
_: [
|
|
58
|
+
{
|
|
59
|
+
srcPath: "/api/wix-atlas-service-web",
|
|
60
|
+
destPath: ""
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
srcPath: "/_api/wix-atlas-service-web",
|
|
64
|
+
destPath: ""
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"www._base_domain_": [
|
|
68
|
+
{
|
|
69
|
+
srcPath: "/wix-atlas-service-web",
|
|
70
|
+
destPath: ""
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
srcPath: "/_api/wix-atlas-service-web",
|
|
74
|
+
destPath: ""
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
srcPath: "/api/wix-atlas-service-web",
|
|
78
|
+
destPath: ""
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"manage._base_domain_": [
|
|
82
|
+
{
|
|
83
|
+
srcPath: "/wix-atlas-service-web",
|
|
84
|
+
destPath: ""
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
"editor._base_domain_": [
|
|
88
|
+
{
|
|
89
|
+
srcPath: "/wix-atlas-service-web",
|
|
90
|
+
destPath: ""
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
srcPath: "/api/wix-atlas-service-web",
|
|
94
|
+
destPath: ""
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"blocks._base_domain_": [
|
|
98
|
+
{
|
|
99
|
+
srcPath: "/wix-atlas-service-web",
|
|
100
|
+
destPath: ""
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
srcPath: "/api/wix-atlas-service-web",
|
|
104
|
+
destPath: ""
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
"create.editorx": [
|
|
108
|
+
{
|
|
109
|
+
srcPath: "/wix-atlas-service-web",
|
|
110
|
+
destPath: ""
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
srcPath: "/api/wix-atlas-service-web",
|
|
114
|
+
destPath: ""
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"editor.wixapps.net": [
|
|
118
|
+
{
|
|
119
|
+
srcPath: "/api/wix-atlas-service-web",
|
|
120
|
+
destPath: ""
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
};
|
|
124
|
+
return (0, import_rest_modules.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
125
|
+
}
|
|
126
|
+
var PACKAGE_NAME = "@wix/auto_sdk_atlas_autocomplete";
|
|
127
|
+
function predict(payload) {
|
|
128
|
+
function __predict({ host }) {
|
|
129
|
+
const serializedData = (0, import_transform_paths.transformPaths)(payload, [
|
|
130
|
+
{
|
|
131
|
+
transformFn: import_float.transformSDKFloatToRESTFloat,
|
|
132
|
+
paths: [
|
|
133
|
+
{ path: "origin.latitude" },
|
|
134
|
+
{ path: "origin.longitude" },
|
|
135
|
+
{ path: "location.latitude" },
|
|
136
|
+
{ path: "location.longitude" }
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
]);
|
|
140
|
+
const metadata = {
|
|
141
|
+
entityFqdn: "wix.atlas.v2.prediction",
|
|
142
|
+
method: "POST",
|
|
143
|
+
methodFqn: "com.wixpress.vi.atlas.service.v2.AutocompleteServiceV2.Predict",
|
|
144
|
+
packageName: PACKAGE_NAME,
|
|
145
|
+
url: resolveComWixpressViAtlasServiceV2AutocompleteServiceV2Url({
|
|
146
|
+
protoPath: "/v2/predict",
|
|
147
|
+
data: serializedData,
|
|
148
|
+
host
|
|
149
|
+
}),
|
|
150
|
+
data: serializedData
|
|
151
|
+
};
|
|
152
|
+
return metadata;
|
|
153
|
+
}
|
|
154
|
+
return __predict;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// src/atlas-v2-prediction-autocomplete.meta.ts
|
|
158
|
+
function predict2() {
|
|
159
|
+
const payload = {};
|
|
160
|
+
const getRequestOptions = predict(payload);
|
|
161
|
+
const getUrl = (context) => {
|
|
162
|
+
const { url } = getRequestOptions(context);
|
|
163
|
+
return url;
|
|
164
|
+
};
|
|
165
|
+
return {
|
|
166
|
+
getUrl,
|
|
167
|
+
httpMethod: "POST",
|
|
168
|
+
path: "/v2/predict",
|
|
169
|
+
pathParams: {},
|
|
170
|
+
__requestType: null,
|
|
171
|
+
__originalRequestType: null,
|
|
172
|
+
__responseType: null,
|
|
173
|
+
__originalResponseType: null
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
177
|
+
0 && (module.exports = {
|
|
178
|
+
predict
|
|
179
|
+
});
|
|
18
180
|
//# sourceMappingURL=meta.js.map
|