@wix/auto_sdk_atlas_location 1.0.3 → 1.0.5
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/cjs/index.d.ts +2 -5
- package/build/cjs/index.js +10 -0
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +1 -4
- package/build/cjs/index.typings.js +10 -0
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.js +10 -0
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.d.mts +2 -5
- package/build/es/index.mjs +10 -0
- package/build/es/index.mjs.map +1 -1
- package/build/es/index.typings.d.mts +1 -4
- package/build/es/index.typings.mjs +10 -0
- package/build/es/index.typings.mjs.map +1 -1
- package/build/es/meta.mjs +10 -0
- package/build/es/meta.mjs.map +1 -1
- package/build/internal/cjs/index.d.ts +2 -5
- package/build/internal/cjs/index.js +10 -0
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/index.typings.d.ts +1 -4
- package/build/internal/cjs/index.typings.js +10 -0
- package/build/internal/cjs/index.typings.js.map +1 -1
- package/build/internal/cjs/meta.js +10 -0
- package/build/internal/cjs/meta.js.map +1 -1
- package/build/internal/es/index.d.mts +2 -5
- package/build/internal/es/index.mjs +10 -0
- package/build/internal/es/index.mjs.map +1 -1
- package/build/internal/es/index.typings.d.mts +1 -4
- package/build/internal/es/index.typings.mjs +10 -0
- package/build/internal/es/index.typings.mjs.map +1 -1
- package/build/internal/es/meta.mjs +10 -0
- package/build/internal/es/meta.mjs.map +1 -1
- package/package.json +4 -3
package/build/cjs/index.d.ts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { HttpClient, NonNullablePaths, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
|
|
2
2
|
import { SearchOptions, SearchResponse } from './index.typings.js';
|
|
3
|
-
export { Address, AddressLocation, AddressStreetOneOf, FilterBy, FilterType, Proximity, ReverseGeocodingRequest, ReverseGeocodingResponse, SearchRequest, SearchResult, StreetAddress, Subdivision, SubdivisionType } from './index.typings.js';
|
|
3
|
+
export { Address, AddressLocation, AddressStreetOneOf, FilterBy, FilterType, FilterTypeWithLiterals, Proximity, ProximityWithLiterals, ReverseGeocodingRequest, ReverseGeocodingResponse, SearchRequest, SearchResult, StreetAddress, Subdivision, SubdivisionType, SubdivisionTypeWithLiterals } from './index.typings.js';
|
|
4
4
|
|
|
5
|
-
type SearchResultNonNullablePaths = `address.streetAddress.number` | `address.streetAddress.name` | `proximity`;
|
|
6
5
|
declare function search$1(httpClient: HttpClient): SearchSignature;
|
|
7
6
|
interface SearchSignature {
|
|
8
7
|
/**
|
|
9
8
|
* A Search request takes a free text as an input and returns a list of 'Address' objects.
|
|
10
9
|
*/
|
|
11
|
-
(options?: SearchOptions): Promise<NonNullablePaths<SearchResponse, {
|
|
12
|
-
[P in SearchResultNonNullablePaths]: `searchResults.${number}.${P}`;
|
|
13
|
-
}[SearchResultNonNullablePaths]>>;
|
|
10
|
+
(options?: SearchOptions): Promise<NonNullablePaths<SearchResponse, `searchResults` | `searchResults.${number}.address.streetAddress.number` | `searchResults.${number}.address.streetAddress.name` | `searchResults.${number}.proximity`, 6>>;
|
|
14
11
|
}
|
|
15
12
|
|
|
16
13
|
declare const search: MaybeContext<BuildRESTFunction<typeof search$1> & typeof search$1>;
|
package/build/cjs/index.js
CHANGED
|
@@ -133,6 +133,16 @@ function resolveComWixpressViAtlasServiceV2LocationServiceV2Url(opts) {
|
|
|
133
133
|
srcPath: "/_api/wix-atlas-service-web",
|
|
134
134
|
destPath: ""
|
|
135
135
|
}
|
|
136
|
+
],
|
|
137
|
+
"platform.rise.ai": [
|
|
138
|
+
{
|
|
139
|
+
srcPath: "/_api/wix-atlas-service-web",
|
|
140
|
+
destPath: ""
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
srcPath: "/wix-atlas-service-web",
|
|
144
|
+
destPath: ""
|
|
145
|
+
}
|
|
136
146
|
]
|
|
137
147
|
};
|
|
138
148
|
return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
package/build/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts","../../src/atlas-v2-search-result-location.universal.ts","../../src/atlas-v2-search-result-location.http.ts","../../src/atlas-v2-search-result-location.public.ts","../../src/atlas-v2-search-result-location.context.ts"],"sourcesContent":["export * from './src/atlas-v2-search-result-location.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 ambassadorWixAtlasV2SearchResult from './atlas-v2-search-result-location.http.js';\nimport { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\n\nexport interface SearchResult {\n /** The Address object */\n address?: Address;\n /** stores additional data about the proximity to the specified location */\n proximity?: ProximityWithLiterals;\n}\n\n/** Physical address */\nexport interface Address extends AddressStreetOneOf {\n /** Street name and number. */\n streetAddress?: StreetAddress;\n /** Main address line, usually street and number as free text. */\n addressLine1?: string | null;\n /**\n * Country code.\n * @format COUNTRY\n */\n country?: string | null;\n /** Subdivision. Usually a state, region, prefecture, or province code, according to [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2). */\n subdivision?: string | null;\n /** City name. */\n city?: string | null;\n /** Zip/postal code. */\n postalCode?: string | null;\n /** Free text providing more detailed address info. Usually contains Apt, Suite, and Floor. */\n addressLine2?: string | null;\n}\n\n/** @oneof */\nexport interface AddressStreetOneOf {\n /** Street name and number. */\n streetAddress?: StreetAddress;\n /** Main address line, usually street and number as free text. */\n addressLine?: string | null;\n}\n\nexport interface StreetAddress {\n /** Street number. */\n number?: string;\n /** Street name. */\n name?: string;\n}\n\nexport interface AddressLocation {\n /** Address latitude. */\n latitude?: number | null;\n /** Address longitude. */\n longitude?: number | null;\n}\n\nexport interface Subdivision {\n /** Short subdivision code. */\n code?: string;\n /** Subdivision full name. */\n name?: string;\n}\n\nexport enum SubdivisionType {\n UNKNOWN_SUBDIVISION_TYPE = 'UNKNOWN_SUBDIVISION_TYPE',\n /** State */\n ADMINISTRATIVE_AREA_LEVEL_1 = 'ADMINISTRATIVE_AREA_LEVEL_1',\n /** County */\n ADMINISTRATIVE_AREA_LEVEL_2 = 'ADMINISTRATIVE_AREA_LEVEL_2',\n /** City/town */\n ADMINISTRATIVE_AREA_LEVEL_3 = 'ADMINISTRATIVE_AREA_LEVEL_3',\n /** Neighborhood/quarter */\n ADMINISTRATIVE_AREA_LEVEL_4 = 'ADMINISTRATIVE_AREA_LEVEL_4',\n /** Street/block */\n ADMINISTRATIVE_AREA_LEVEL_5 = 'ADMINISTRATIVE_AREA_LEVEL_5',\n /** ADMINISTRATIVE_AREA_LEVEL_0. Indicates the national political entity, and is typically the highest order type returned by the Geocoder. */\n COUNTRY = 'COUNTRY',\n}\n\n/** @enumType */\nexport type SubdivisionTypeWithLiterals =\n | SubdivisionType\n | 'UNKNOWN_SUBDIVISION_TYPE'\n | 'ADMINISTRATIVE_AREA_LEVEL_1'\n | 'ADMINISTRATIVE_AREA_LEVEL_2'\n | 'ADMINISTRATIVE_AREA_LEVEL_3'\n | 'ADMINISTRATIVE_AREA_LEVEL_4'\n | 'ADMINISTRATIVE_AREA_LEVEL_5'\n | 'COUNTRY';\n\nexport enum Proximity {\n UNKNOWN_PROXIMITY = 'UNKNOWN_PROXIMITY',\n /** indicates that the returned result is a precise geocode for which we have location information accurate down to street address precision */\n PINPOINT = 'PINPOINT',\n /** indicates that the returned result is the geometric center of a result */\n APPROXIMATE = 'APPROXIMATE',\n /** indicates that the returned result is around an area */\n GENERAL_AREA = 'GENERAL_AREA',\n}\n\n/** @enumType */\nexport type ProximityWithLiterals =\n | Proximity\n | 'UNKNOWN_PROXIMITY'\n | 'PINPOINT'\n | 'APPROXIMATE'\n | 'GENERAL_AREA';\n\n/** User must provide query or filter by parameters */\nexport interface SearchRequest {\n /** Free text */\n query?: string | null;\n /**\n * Deprecate! - Please use 'zipCode' and 'countryCodes' fields\n * @deprecated\n */\n filterBy?: FilterBy[];\n /** Zip code filter the user can add in order to get more accurate results */\n zipCode?: string | null;\n /** Country codes filter the user can add in order to get more accurate results */\n countryCodes?: string[];\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 SearchResponse {\n /** List of 'Address' objects */\n searchResults?: SearchResult[];\n}\n\nexport interface ReverseGeocodingRequest {\n /** The latitude and longitude values specifying the location for which you wish to obtain the closest, human-readable address. */\n addressLocation?: AddressLocation;\n}\n\nexport interface ReverseGeocodingResponse {\n searchResults?: SearchResult[];\n}\n\ntype SearchResultNonNullablePaths =\n | `address.streetAddress.number`\n | `address.streetAddress.name`\n | `proximity`;\n\n/**\n * A Search request takes a free text as an input and returns a list of 'Address' objects.\n * @public\n * @documentationMaturity preview\n * @permissionId WIX_ATLAS.SEARCH\n * @applicableIdentity APP\n * @applicableIdentity VISITOR\n * @fqn com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search\n */\nexport async function search(\n options?: SearchOptions\n): Promise<\n NonNullablePaths<\n SearchResponse,\n {\n [P in SearchResultNonNullablePaths]: `searchResults.${number}.${P}`;\n }[SearchResultNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n query: options?.query,\n filterBy: options?.filterBy,\n zipCode: options?.zipCode,\n countryCodes: options?.countryCodes,\n });\n\n const reqOpts = ambassadorWixAtlasV2SearchResult.search(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(\n transformPaths(result.data, [\n {\n transformFn: transformRESTAddressToSDKAddress,\n paths: [{ path: 'searchResults.address' }],\n },\n ])\n )!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n query: '$[0].query',\n filterBy: '$[0].filterBy',\n zipCode: '$[0].zipCode',\n countryCodes: '$[0].countryCodes',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface SearchOptions {\n /** Free text */\n query?: string | null;\n /**\n * Deprecate! - Please use 'zipCode' and 'countryCodes' fields\n * @deprecated\n */\n filterBy?: FilterBy[];\n /** Zip code filter the user can add in order to get more accurate results */\n zipCode?: string | null;\n /** Country codes filter the user can add in order to get more accurate results */\n countryCodes?: string[];\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformRESTFloatToSDKFloat } 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 resolveComWixpressViAtlasServiceV2LocationServiceV2Url(\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 '*.wixforms.com': [\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_location';\n\n/** A Search request takes a free text as an input and returns a list of 'Address' objects. */\nexport function search(payload: object): RequestOptionsFactory<any> {\n function __search({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.atlas.v2.search_result',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'searchResults.address.geocode.latitude' },\n { path: 'searchResults.address.geocode.longitude' },\n ],\n },\n ]),\n fallback: [\n {\n method: 'GET' as any,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n },\n ],\n };\n\n return metadata;\n }\n\n return __search;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n SearchOptions,\n SearchResponse,\n search as universalSearch,\n} from './atlas-v2-search-result-location.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/atlas' };\n\ntype SearchResultNonNullablePaths =\n | `address.streetAddress.number`\n | `address.streetAddress.name`\n | `proximity`;\n\nexport function search(httpClient: HttpClient): SearchSignature {\n return (options?: SearchOptions) =>\n universalSearch(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface SearchSignature {\n /**\n * A Search request takes a free text as an input and returns a list of 'Address' objects.\n */\n (options?: SearchOptions): Promise<\n NonNullablePaths<\n SearchResponse,\n {\n [P in SearchResultNonNullablePaths]: `searchResults.${number}.${P}`;\n }[SearchResultNonNullablePaths]\n >\n >;\n}\n\nexport {\n Address,\n AddressLocation,\n AddressStreetOneOf,\n FilterBy,\n FilterType,\n Proximity,\n ReverseGeocodingRequest,\n ReverseGeocodingResponse,\n SearchOptions,\n SearchRequest,\n SearchResponse,\n SearchResult,\n StreetAddress,\n Subdivision,\n SubdivisionType,\n} from './atlas-v2-search-result-location.universal.js';\n","import { search as publicSearch } from './atlas-v2-search-result-location.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const search: MaybeContext<\n BuildRESTFunction<typeof publicSearch> & typeof publicSearch\n> = /*#__PURE__*/ createRESTModule(publicSearch);\n\nexport {\n SubdivisionType,\n Proximity,\n FilterType,\n} from './atlas-v2-search-result-location.universal.js';\nexport {\n SearchResult,\n Address,\n AddressStreetOneOf,\n StreetAddress,\n AddressLocation,\n Subdivision,\n SearchRequest,\n FilterBy,\n SearchResponse,\n ReverseGeocodingRequest,\n ReverseGeocodingResponse,\n SearchOptions,\n} from './atlas-v2-search-result-location.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAAkC;AAClC,mBAA6C;AAC7C,6BAA+B;AAC/B,IAAAC,uBAA2B;AAI3B,SAAS,uDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,oBAAoB;AAAA,MAClB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,cAAc;AAAA,MACZ;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;A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AC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,OAAO;AAAA,UACP,UAAU;AAAA,UACV,SAAS;AAAA,UACT,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEvNO,SAASC,QAAO,YAAyC;AAC9D,SAAO,CAAC,YACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACpBA,IAAAC,uBAAiC;AAG1B,IAAMC,UAEK,2DAAiBA,OAAY;","names":["search","import_rest_modules","payload","import_transform_paths","SubdivisionType","Proximity","FilterType","search","sdkTransformError","search","import_rest_modules","search"]}
|
|
1
|
+
{"version":3,"sources":["../../index.ts","../../src/atlas-v2-search-result-location.universal.ts","../../src/atlas-v2-search-result-location.http.ts","../../src/atlas-v2-search-result-location.public.ts","../../src/atlas-v2-search-result-location.context.ts"],"sourcesContent":["export * from './src/atlas-v2-search-result-location.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 ambassadorWixAtlasV2SearchResult from './atlas-v2-search-result-location.http.js';\nimport { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\n\nexport interface SearchResult {\n /** The Address object */\n address?: Address;\n /** stores additional data about the proximity to the specified location */\n proximity?: ProximityWithLiterals;\n}\n\n/** Physical address */\nexport interface Address extends AddressStreetOneOf {\n /** Street name and number. */\n streetAddress?: StreetAddress;\n /** Main address line, usually street and number as free text. */\n addressLine1?: string | null;\n /**\n * Country code.\n * @format COUNTRY\n */\n country?: string | null;\n /** Subdivision. Usually a state, region, prefecture, or province code, according to [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2). */\n subdivision?: string | null;\n /** City name. */\n city?: string | null;\n /** Zip/postal code. */\n postalCode?: string | null;\n /** Free text providing more detailed address info. Usually contains Apt, Suite, and Floor. */\n addressLine2?: string | null;\n}\n\n/** @oneof */\nexport interface AddressStreetOneOf {\n /** Street name and number. */\n streetAddress?: StreetAddress;\n /** Main address line, usually street and number as free text. */\n addressLine?: string | null;\n}\n\nexport interface StreetAddress {\n /** Street number. */\n number?: string;\n /** Street name. */\n name?: string;\n}\n\nexport interface AddressLocation {\n /** Address latitude. */\n latitude?: number | null;\n /** Address longitude. */\n longitude?: number | null;\n}\n\nexport interface Subdivision {\n /** Short subdivision code. */\n code?: string;\n /** Subdivision full name. */\n name?: string;\n}\n\nexport enum SubdivisionType {\n UNKNOWN_SUBDIVISION_TYPE = 'UNKNOWN_SUBDIVISION_TYPE',\n /** State */\n ADMINISTRATIVE_AREA_LEVEL_1 = 'ADMINISTRATIVE_AREA_LEVEL_1',\n /** County */\n ADMINISTRATIVE_AREA_LEVEL_2 = 'ADMINISTRATIVE_AREA_LEVEL_2',\n /** City/town */\n ADMINISTRATIVE_AREA_LEVEL_3 = 'ADMINISTRATIVE_AREA_LEVEL_3',\n /** Neighborhood/quarter */\n ADMINISTRATIVE_AREA_LEVEL_4 = 'ADMINISTRATIVE_AREA_LEVEL_4',\n /** Street/block */\n ADMINISTRATIVE_AREA_LEVEL_5 = 'ADMINISTRATIVE_AREA_LEVEL_5',\n /** ADMINISTRATIVE_AREA_LEVEL_0. Indicates the national political entity, and is typically the highest order type returned by the Geocoder. */\n COUNTRY = 'COUNTRY',\n}\n\n/** @enumType */\nexport type SubdivisionTypeWithLiterals =\n | SubdivisionType\n | 'UNKNOWN_SUBDIVISION_TYPE'\n | 'ADMINISTRATIVE_AREA_LEVEL_1'\n | 'ADMINISTRATIVE_AREA_LEVEL_2'\n | 'ADMINISTRATIVE_AREA_LEVEL_3'\n | 'ADMINISTRATIVE_AREA_LEVEL_4'\n | 'ADMINISTRATIVE_AREA_LEVEL_5'\n | 'COUNTRY';\n\nexport enum Proximity {\n UNKNOWN_PROXIMITY = 'UNKNOWN_PROXIMITY',\n /** indicates that the returned result is a precise geocode for which we have location information accurate down to street address precision */\n PINPOINT = 'PINPOINT',\n /** indicates that the returned result is the geometric center of a result */\n APPROXIMATE = 'APPROXIMATE',\n /** indicates that the returned result is around an area */\n GENERAL_AREA = 'GENERAL_AREA',\n}\n\n/** @enumType */\nexport type ProximityWithLiterals =\n | Proximity\n | 'UNKNOWN_PROXIMITY'\n | 'PINPOINT'\n | 'APPROXIMATE'\n | 'GENERAL_AREA';\n\n/** User must provide query or filter by parameters */\nexport interface SearchRequest {\n /** Free text */\n query?: string | null;\n /**\n * Deprecate! - Please use 'zipCode' and 'countryCodes' fields\n * @deprecated\n */\n filterBy?: FilterBy[];\n /** Zip code filter the user can add in order to get more accurate results */\n zipCode?: string | null;\n /** Country codes filter the user can add in order to get more accurate results */\n countryCodes?: string[];\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 SearchResponse {\n /** List of 'Address' objects */\n searchResults?: SearchResult[];\n}\n\nexport interface ReverseGeocodingRequest {\n /** The latitude and longitude values specifying the location for which you wish to obtain the closest, human-readable address. */\n addressLocation?: AddressLocation;\n}\n\nexport interface ReverseGeocodingResponse {\n searchResults?: SearchResult[];\n}\n\n/**\n * A Search request takes a free text as an input and returns a list of 'Address' objects.\n * @public\n * @documentationMaturity preview\n * @permissionId WIX_ATLAS.SEARCH\n * @applicableIdentity APP\n * @applicableIdentity VISITOR\n * @fqn com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search\n */\nexport async function search(\n options?: SearchOptions\n): Promise<\n NonNullablePaths<\n SearchResponse,\n | `searchResults`\n | `searchResults.${number}.address.streetAddress.number`\n | `searchResults.${number}.address.streetAddress.name`\n | `searchResults.${number}.proximity`,\n 6\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n query: options?.query,\n filterBy: options?.filterBy,\n zipCode: options?.zipCode,\n countryCodes: options?.countryCodes,\n });\n\n const reqOpts = ambassadorWixAtlasV2SearchResult.search(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(\n transformPaths(result.data, [\n {\n transformFn: transformRESTAddressToSDKAddress,\n paths: [{ path: 'searchResults.address' }],\n },\n ])\n )!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n query: '$[0].query',\n filterBy: '$[0].filterBy',\n zipCode: '$[0].zipCode',\n countryCodes: '$[0].countryCodes',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface SearchOptions {\n /** Free text */\n query?: string | null;\n /**\n * Deprecate! - Please use 'zipCode' and 'countryCodes' fields\n * @deprecated\n */\n filterBy?: FilterBy[];\n /** Zip code filter the user can add in order to get more accurate results */\n zipCode?: string | null;\n /** Country codes filter the user can add in order to get more accurate results */\n countryCodes?: string[];\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformRESTFloatToSDKFloat } 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 resolveComWixpressViAtlasServiceV2LocationServiceV2Url(\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 '*.wixforms.com': [\n {\n srcPath: '/_api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'platform.rise.ai': [\n {\n srcPath: '/_api/wix-atlas-service-web',\n destPath: '',\n },\n {\n srcPath: '/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_location';\n\n/** A Search request takes a free text as an input and returns a list of 'Address' objects. */\nexport function search(payload: object): RequestOptionsFactory<any> {\n function __search({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.atlas.v2.search_result',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'searchResults.address.geocode.latitude' },\n { path: 'searchResults.address.geocode.longitude' },\n ],\n },\n ]),\n fallback: [\n {\n method: 'GET' as any,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n },\n ],\n };\n\n return metadata;\n }\n\n return __search;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n SearchOptions,\n SearchResponse,\n search as universalSearch,\n} from './atlas-v2-search-result-location.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/atlas' };\n\nexport function search(httpClient: HttpClient): SearchSignature {\n return (options?: SearchOptions) =>\n universalSearch(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface SearchSignature {\n /**\n * A Search request takes a free text as an input and returns a list of 'Address' objects.\n */\n (options?: SearchOptions): Promise<\n NonNullablePaths<\n SearchResponse,\n | `searchResults`\n | `searchResults.${number}.address.streetAddress.number`\n | `searchResults.${number}.address.streetAddress.name`\n | `searchResults.${number}.proximity`,\n 6\n >\n >;\n}\n\nexport {\n Address,\n AddressLocation,\n AddressStreetOneOf,\n FilterBy,\n FilterType,\n Proximity,\n ReverseGeocodingRequest,\n ReverseGeocodingResponse,\n SearchOptions,\n SearchRequest,\n SearchResponse,\n SearchResult,\n StreetAddress,\n Subdivision,\n SubdivisionType,\n} from './atlas-v2-search-result-location.universal.js';\n","import { search as publicSearch } from './atlas-v2-search-result-location.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const search: MaybeContext<\n BuildRESTFunction<typeof publicSearch> & typeof publicSearch\n> = /*#__PURE__*/ createRESTModule(publicSearch);\n\nexport {\n SubdivisionType,\n Proximity,\n FilterType,\n} from './atlas-v2-search-result-location.universal.js';\nexport {\n SearchResult,\n Address,\n AddressStreetOneOf,\n StreetAddress,\n AddressLocation,\n Subdivision,\n SearchRequest,\n FilterBy,\n SearchResponse,\n ReverseGeocodingRequest,\n ReverseGeocodingResponse,\n SearchOptions,\n} from './atlas-v2-search-result-location.universal.js';\nexport {\n SubdivisionTypeWithLiterals,\n ProximityWithLiterals,\n FilterTypeWithLiterals,\n} from './atlas-v2-search-result-location.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAAkC;AAClC,mBAA6C;AAC7C,6BAA+B;AAC/B,IAAAC,uBAA2B;AAI3B,SAAS,uDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,oBAAoB;AAAA,MAClB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,YA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,uBAAiC;AAG1B,IAAMC,UAEK,2DAAiBA,OAAY;","names":["search","import_rest_modules","payload","import_transform_paths","SubdivisionType","Proximity","FilterType","search","sdkTransformError","search","import_rest_modules","search"]}
|
|
@@ -118,7 +118,6 @@ interface ReverseGeocodingRequest {
|
|
|
118
118
|
interface ReverseGeocodingResponse {
|
|
119
119
|
searchResults?: SearchResult[];
|
|
120
120
|
}
|
|
121
|
-
type SearchResultNonNullablePaths = `address.streetAddress.number` | `address.streetAddress.name` | `proximity`;
|
|
122
121
|
/**
|
|
123
122
|
* A Search request takes a free text as an input and returns a list of 'Address' objects.
|
|
124
123
|
* @public
|
|
@@ -128,9 +127,7 @@ type SearchResultNonNullablePaths = `address.streetAddress.number` | `address.st
|
|
|
128
127
|
* @applicableIdentity VISITOR
|
|
129
128
|
* @fqn com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search
|
|
130
129
|
*/
|
|
131
|
-
declare function search(options?: SearchOptions): Promise<NonNullablePaths<SearchResponse, {
|
|
132
|
-
[P in SearchResultNonNullablePaths]: `searchResults.${number}.${P}`;
|
|
133
|
-
}[SearchResultNonNullablePaths]>>;
|
|
130
|
+
declare function search(options?: SearchOptions): Promise<NonNullablePaths<SearchResponse, `searchResults` | `searchResults.${number}.address.streetAddress.number` | `searchResults.${number}.address.streetAddress.name` | `searchResults.${number}.proximity`, 6>>;
|
|
134
131
|
interface SearchOptions {
|
|
135
132
|
/** Free text */
|
|
136
133
|
query?: string | null;
|
|
@@ -133,6 +133,16 @@ function resolveComWixpressViAtlasServiceV2LocationServiceV2Url(opts) {
|
|
|
133
133
|
srcPath: "/_api/wix-atlas-service-web",
|
|
134
134
|
destPath: ""
|
|
135
135
|
}
|
|
136
|
+
],
|
|
137
|
+
"platform.rise.ai": [
|
|
138
|
+
{
|
|
139
|
+
srcPath: "/_api/wix-atlas-service-web",
|
|
140
|
+
destPath: ""
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
srcPath: "/wix-atlas-service-web",
|
|
144
|
+
destPath: ""
|
|
145
|
+
}
|
|
136
146
|
]
|
|
137
147
|
};
|
|
138
148
|
return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.typings.ts","../../src/atlas-v2-search-result-location.universal.ts","../../src/atlas-v2-search-result-location.http.ts"],"sourcesContent":["export * from './src/atlas-v2-search-result-location.universal.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 ambassadorWixAtlasV2SearchResult from './atlas-v2-search-result-location.http.js';\nimport { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\n\nexport interface SearchResult {\n /** The Address object */\n address?: Address;\n /** stores additional data about the proximity to the specified location */\n proximity?: ProximityWithLiterals;\n}\n\n/** Physical address */\nexport interface Address extends AddressStreetOneOf {\n /** Street name and number. */\n streetAddress?: StreetAddress;\n /** Main address line, usually street and number as free text. */\n addressLine1?: string | null;\n /**\n * Country code.\n * @format COUNTRY\n */\n country?: string | null;\n /** Subdivision. Usually a state, region, prefecture, or province code, according to [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2). */\n subdivision?: string | null;\n /** City name. */\n city?: string | null;\n /** Zip/postal code. */\n postalCode?: string | null;\n /** Free text providing more detailed address info. Usually contains Apt, Suite, and Floor. */\n addressLine2?: string | null;\n}\n\n/** @oneof */\nexport interface AddressStreetOneOf {\n /** Street name and number. */\n streetAddress?: StreetAddress;\n /** Main address line, usually street and number as free text. */\n addressLine?: string | null;\n}\n\nexport interface StreetAddress {\n /** Street number. */\n number?: string;\n /** Street name. */\n name?: string;\n}\n\nexport interface AddressLocation {\n /** Address latitude. */\n latitude?: number | null;\n /** Address longitude. */\n longitude?: number | null;\n}\n\nexport interface Subdivision {\n /** Short subdivision code. */\n code?: string;\n /** Subdivision full name. */\n name?: string;\n}\n\nexport enum SubdivisionType {\n UNKNOWN_SUBDIVISION_TYPE = 'UNKNOWN_SUBDIVISION_TYPE',\n /** State */\n ADMINISTRATIVE_AREA_LEVEL_1 = 'ADMINISTRATIVE_AREA_LEVEL_1',\n /** County */\n ADMINISTRATIVE_AREA_LEVEL_2 = 'ADMINISTRATIVE_AREA_LEVEL_2',\n /** City/town */\n ADMINISTRATIVE_AREA_LEVEL_3 = 'ADMINISTRATIVE_AREA_LEVEL_3',\n /** Neighborhood/quarter */\n ADMINISTRATIVE_AREA_LEVEL_4 = 'ADMINISTRATIVE_AREA_LEVEL_4',\n /** Street/block */\n ADMINISTRATIVE_AREA_LEVEL_5 = 'ADMINISTRATIVE_AREA_LEVEL_5',\n /** ADMINISTRATIVE_AREA_LEVEL_0. Indicates the national political entity, and is typically the highest order type returned by the Geocoder. */\n COUNTRY = 'COUNTRY',\n}\n\n/** @enumType */\nexport type SubdivisionTypeWithLiterals =\n | SubdivisionType\n | 'UNKNOWN_SUBDIVISION_TYPE'\n | 'ADMINISTRATIVE_AREA_LEVEL_1'\n | 'ADMINISTRATIVE_AREA_LEVEL_2'\n | 'ADMINISTRATIVE_AREA_LEVEL_3'\n | 'ADMINISTRATIVE_AREA_LEVEL_4'\n | 'ADMINISTRATIVE_AREA_LEVEL_5'\n | 'COUNTRY';\n\nexport enum Proximity {\n UNKNOWN_PROXIMITY = 'UNKNOWN_PROXIMITY',\n /** indicates that the returned result is a precise geocode for which we have location information accurate down to street address precision */\n PINPOINT = 'PINPOINT',\n /** indicates that the returned result is the geometric center of a result */\n APPROXIMATE = 'APPROXIMATE',\n /** indicates that the returned result is around an area */\n GENERAL_AREA = 'GENERAL_AREA',\n}\n\n/** @enumType */\nexport type ProximityWithLiterals =\n | Proximity\n | 'UNKNOWN_PROXIMITY'\n | 'PINPOINT'\n | 'APPROXIMATE'\n | 'GENERAL_AREA';\n\n/** User must provide query or filter by parameters */\nexport interface SearchRequest {\n /** Free text */\n query?: string | null;\n /**\n * Deprecate! - Please use 'zipCode' and 'countryCodes' fields\n * @deprecated\n */\n filterBy?: FilterBy[];\n /** Zip code filter the user can add in order to get more accurate results */\n zipCode?: string | null;\n /** Country codes filter the user can add in order to get more accurate results */\n countryCodes?: string[];\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 SearchResponse {\n /** List of 'Address' objects */\n searchResults?: SearchResult[];\n}\n\nexport interface ReverseGeocodingRequest {\n /** The latitude and longitude values specifying the location for which you wish to obtain the closest, human-readable address. */\n addressLocation?: AddressLocation;\n}\n\nexport interface ReverseGeocodingResponse {\n searchResults?: SearchResult[];\n}\n\ntype SearchResultNonNullablePaths =\n | `address.streetAddress.number`\n | `address.streetAddress.name`\n | `proximity`;\n\n/**\n * A Search request takes a free text as an input and returns a list of 'Address' objects.\n * @public\n * @documentationMaturity preview\n * @permissionId WIX_ATLAS.SEARCH\n * @applicableIdentity APP\n * @applicableIdentity VISITOR\n * @fqn com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search\n */\nexport async function search(\n options?: SearchOptions\n): Promise<\n NonNullablePaths<\n SearchResponse,\n {\n [P in SearchResultNonNullablePaths]: `searchResults.${number}.${P}`;\n }[SearchResultNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n query: options?.query,\n filterBy: options?.filterBy,\n zipCode: options?.zipCode,\n countryCodes: options?.countryCodes,\n });\n\n const reqOpts = ambassadorWixAtlasV2SearchResult.search(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(\n transformPaths(result.data, [\n {\n transformFn: transformRESTAddressToSDKAddress,\n paths: [{ path: 'searchResults.address' }],\n },\n ])\n )!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n query: '$[0].query',\n filterBy: '$[0].filterBy',\n zipCode: '$[0].zipCode',\n countryCodes: '$[0].countryCodes',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface SearchOptions {\n /** Free text */\n query?: string | null;\n /**\n * Deprecate! - Please use 'zipCode' and 'countryCodes' fields\n * @deprecated\n */\n filterBy?: FilterBy[];\n /** Zip code filter the user can add in order to get more accurate results */\n zipCode?: string | null;\n /** Country codes filter the user can add in order to get more accurate results */\n countryCodes?: string[];\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformRESTFloatToSDKFloat } 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 resolveComWixpressViAtlasServiceV2LocationServiceV2Url(\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 '*.wixforms.com': [\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_location';\n\n/** A Search request takes a free text as an input and returns a list of 'Address' objects. */\nexport function search(payload: object): RequestOptionsFactory<any> {\n function __search({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.atlas.v2.search_result',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'searchResults.address.geocode.latitude' },\n { path: 'searchResults.address.geocode.longitude' },\n ],\n },\n ]),\n fallback: [\n {\n method: 'GET' as any,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n },\n ],\n };\n\n return metadata;\n }\n\n return __search;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAAkC;AAClC,mBAA6C;AAC7C,6BAA+B;AAC/B,IAAAC,uBAA2B;AAI3B,SAAS,uDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,oBAAoB;AAAA,MAClB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,cAAc;AAAA,MACZ;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE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UACE,aAAa;AAAA,UACb,OAAO,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,OAAO;AAAA,UACP,UAAU;AAAA,UACV,SAAS;AAAA,UACT,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["search","import_rest_modules","payload","import_transform_paths","SubdivisionType","Proximity","FilterType","search","sdkTransformError"]}
|
|
1
|
+
{"version":3,"sources":["../../index.typings.ts","../../src/atlas-v2-search-result-location.universal.ts","../../src/atlas-v2-search-result-location.http.ts"],"sourcesContent":["export * from './src/atlas-v2-search-result-location.universal.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 ambassadorWixAtlasV2SearchResult from './atlas-v2-search-result-location.http.js';\nimport { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\n\nexport interface SearchResult {\n /** The Address object */\n address?: Address;\n /** stores additional data about the proximity to the specified location */\n proximity?: ProximityWithLiterals;\n}\n\n/** Physical address */\nexport interface Address extends AddressStreetOneOf {\n /** Street name and number. */\n streetAddress?: StreetAddress;\n /** Main address line, usually street and number as free text. */\n addressLine1?: string | null;\n /**\n * Country code.\n * @format COUNTRY\n */\n country?: string | null;\n /** Subdivision. Usually a state, region, prefecture, or province code, according to [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2). */\n subdivision?: string | null;\n /** City name. */\n city?: string | null;\n /** Zip/postal code. */\n postalCode?: string | null;\n /** Free text providing more detailed address info. Usually contains Apt, Suite, and Floor. */\n addressLine2?: string | null;\n}\n\n/** @oneof */\nexport interface AddressStreetOneOf {\n /** Street name and number. */\n streetAddress?: StreetAddress;\n /** Main address line, usually street and number as free text. */\n addressLine?: string | null;\n}\n\nexport interface StreetAddress {\n /** Street number. */\n number?: string;\n /** Street name. */\n name?: string;\n}\n\nexport interface AddressLocation {\n /** Address latitude. */\n latitude?: number | null;\n /** Address longitude. */\n longitude?: number | null;\n}\n\nexport interface Subdivision {\n /** Short subdivision code. */\n code?: string;\n /** Subdivision full name. */\n name?: string;\n}\n\nexport enum SubdivisionType {\n UNKNOWN_SUBDIVISION_TYPE = 'UNKNOWN_SUBDIVISION_TYPE',\n /** State */\n ADMINISTRATIVE_AREA_LEVEL_1 = 'ADMINISTRATIVE_AREA_LEVEL_1',\n /** County */\n ADMINISTRATIVE_AREA_LEVEL_2 = 'ADMINISTRATIVE_AREA_LEVEL_2',\n /** City/town */\n ADMINISTRATIVE_AREA_LEVEL_3 = 'ADMINISTRATIVE_AREA_LEVEL_3',\n /** Neighborhood/quarter */\n ADMINISTRATIVE_AREA_LEVEL_4 = 'ADMINISTRATIVE_AREA_LEVEL_4',\n /** Street/block */\n ADMINISTRATIVE_AREA_LEVEL_5 = 'ADMINISTRATIVE_AREA_LEVEL_5',\n /** ADMINISTRATIVE_AREA_LEVEL_0. Indicates the national political entity, and is typically the highest order type returned by the Geocoder. */\n COUNTRY = 'COUNTRY',\n}\n\n/** @enumType */\nexport type SubdivisionTypeWithLiterals =\n | SubdivisionType\n | 'UNKNOWN_SUBDIVISION_TYPE'\n | 'ADMINISTRATIVE_AREA_LEVEL_1'\n | 'ADMINISTRATIVE_AREA_LEVEL_2'\n | 'ADMINISTRATIVE_AREA_LEVEL_3'\n | 'ADMINISTRATIVE_AREA_LEVEL_4'\n | 'ADMINISTRATIVE_AREA_LEVEL_5'\n | 'COUNTRY';\n\nexport enum Proximity {\n UNKNOWN_PROXIMITY = 'UNKNOWN_PROXIMITY',\n /** indicates that the returned result is a precise geocode for which we have location information accurate down to street address precision */\n PINPOINT = 'PINPOINT',\n /** indicates that the returned result is the geometric center of a result */\n APPROXIMATE = 'APPROXIMATE',\n /** indicates that the returned result is around an area */\n GENERAL_AREA = 'GENERAL_AREA',\n}\n\n/** @enumType */\nexport type ProximityWithLiterals =\n | Proximity\n | 'UNKNOWN_PROXIMITY'\n | 'PINPOINT'\n | 'APPROXIMATE'\n | 'GENERAL_AREA';\n\n/** User must provide query or filter by parameters */\nexport interface SearchRequest {\n /** Free text */\n query?: string | null;\n /**\n * Deprecate! - Please use 'zipCode' and 'countryCodes' fields\n * @deprecated\n */\n filterBy?: FilterBy[];\n /** Zip code filter the user can add in order to get more accurate results */\n zipCode?: string | null;\n /** Country codes filter the user can add in order to get more accurate results */\n countryCodes?: string[];\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 SearchResponse {\n /** List of 'Address' objects */\n searchResults?: SearchResult[];\n}\n\nexport interface ReverseGeocodingRequest {\n /** The latitude and longitude values specifying the location for which you wish to obtain the closest, human-readable address. */\n addressLocation?: AddressLocation;\n}\n\nexport interface ReverseGeocodingResponse {\n searchResults?: SearchResult[];\n}\n\n/**\n * A Search request takes a free text as an input and returns a list of 'Address' objects.\n * @public\n * @documentationMaturity preview\n * @permissionId WIX_ATLAS.SEARCH\n * @applicableIdentity APP\n * @applicableIdentity VISITOR\n * @fqn com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search\n */\nexport async function search(\n options?: SearchOptions\n): Promise<\n NonNullablePaths<\n SearchResponse,\n | `searchResults`\n | `searchResults.${number}.address.streetAddress.number`\n | `searchResults.${number}.address.streetAddress.name`\n | `searchResults.${number}.proximity`,\n 6\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n query: options?.query,\n filterBy: options?.filterBy,\n zipCode: options?.zipCode,\n countryCodes: options?.countryCodes,\n });\n\n const reqOpts = ambassadorWixAtlasV2SearchResult.search(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(\n transformPaths(result.data, [\n {\n transformFn: transformRESTAddressToSDKAddress,\n paths: [{ path: 'searchResults.address' }],\n },\n ])\n )!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n query: '$[0].query',\n filterBy: '$[0].filterBy',\n zipCode: '$[0].zipCode',\n countryCodes: '$[0].countryCodes',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface SearchOptions {\n /** Free text */\n query?: string | null;\n /**\n * Deprecate! - Please use 'zipCode' and 'countryCodes' fields\n * @deprecated\n */\n filterBy?: FilterBy[];\n /** Zip code filter the user can add in order to get more accurate results */\n zipCode?: string | null;\n /** Country codes filter the user can add in order to get more accurate results */\n countryCodes?: string[];\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformRESTFloatToSDKFloat } 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 resolveComWixpressViAtlasServiceV2LocationServiceV2Url(\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 '*.wixforms.com': [\n {\n srcPath: '/_api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'platform.rise.ai': [\n {\n srcPath: '/_api/wix-atlas-service-web',\n destPath: '',\n },\n {\n srcPath: '/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_location';\n\n/** A Search request takes a free text as an input and returns a list of 'Address' objects. */\nexport function search(payload: object): RequestOptionsFactory<any> {\n function __search({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.atlas.v2.search_result',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'searchResults.address.geocode.latitude' },\n { path: 'searchResults.address.geocode.longitude' },\n ],\n },\n ]),\n fallback: [\n {\n method: 'GET' as any,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n },\n ],\n };\n\n return metadata;\n }\n\n return __search;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAAA;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAAkC;AAClC,mBAA6C;AAC7C,6BAA+B;AAC/B,IAAAC,uBAA2B;AAI3B,SAAS,uDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,oBAAoB;AAAA,MAClB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,cAAc;AAAA,MACZ;AAAA,QACE,SAAS;AAAA,QACT,U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AAe;AAPL,SAAAA;AAAA,GAAA;AAwCL,IAAK,aAAL,kBAAKC,gBAAL;AAEL,EAAAA,YAAA,cAAW;AAEX,EAAAA,YAAA,kBAAe;AAJL,SAAAA;AAAA,GAAA;AAiCZ,eAAsBC,QACpB,SAUA;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,cAAU,qEAAsC;AAAA,IACpD,OAAO,SAAS;AAAA,IAChB,UAAU,SAAS;AAAA,IACnB,SAAS,SAAS;AAAA,IAClB,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAA2C,OAAO,OAAO;AAE/D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,eAAO;AAAA,UACL,wCAAe,OAAO,MAAM;AAAA,QAC1B;AAAA,UACE,aAAa;AAAA,UACb,OAAO,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,SAAS,KAAU;AACjB,UAAM,uBAAmB,uBAAAC;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,OAAO;AAAA,UACP,UAAU;AAAA,UACV,SAAS;AAAA,UACT,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["search","import_rest_modules","payload","import_transform_paths","SubdivisionType","Proximity","FilterType","search","sdkTransformError"]}
|
package/build/cjs/meta.js
CHANGED
|
@@ -126,6 +126,16 @@ function resolveComWixpressViAtlasServiceV2LocationServiceV2Url(opts) {
|
|
|
126
126
|
srcPath: "/_api/wix-atlas-service-web",
|
|
127
127
|
destPath: ""
|
|
128
128
|
}
|
|
129
|
+
],
|
|
130
|
+
"platform.rise.ai": [
|
|
131
|
+
{
|
|
132
|
+
srcPath: "/_api/wix-atlas-service-web",
|
|
133
|
+
destPath: ""
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
srcPath: "/wix-atlas-service-web",
|
|
137
|
+
destPath: ""
|
|
138
|
+
}
|
|
129
139
|
]
|
|
130
140
|
};
|
|
131
141
|
return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
|
package/build/cjs/meta.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../meta.ts","../../src/atlas-v2-search-result-location.http.ts","../../src/atlas-v2-search-result-location.meta.ts"],"sourcesContent":["export * from './src/atlas-v2-search-result-location.meta.js';\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformRESTFloatToSDKFloat } 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 resolveComWixpressViAtlasServiceV2LocationServiceV2Url(\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 '*.wixforms.com': [\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_location';\n\n/** A Search request takes a free text as an input and returns a list of 'Address' objects. */\nexport function search(payload: object): RequestOptionsFactory<any> {\n function __search({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.atlas.v2.search_result',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'searchResults.address.geocode.latitude' },\n { path: 'searchResults.address.geocode.longitude' },\n ],\n },\n ]),\n fallback: [\n {\n method: 'GET' as any,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n },\n ],\n };\n\n return metadata;\n }\n\n return __search;\n}\n","import * as ambassadorWixAtlasV2SearchResult from './atlas-v2-search-result-location.http.js';\nimport * as ambassadorWixAtlasV2SearchResultTypes from './atlas-v2-search-result-location.types.js';\nimport * as ambassadorWixAtlasV2SearchResultUniversalTypes from './atlas-v2-search-result-location.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function search(): __PublicMethodMetaInfo<\n 'GET',\n {},\n ambassadorWixAtlasV2SearchResultUniversalTypes.SearchRequest,\n ambassadorWixAtlasV2SearchResultTypes.SearchRequest,\n ambassadorWixAtlasV2SearchResultUniversalTypes.SearchResponse,\n ambassadorWixAtlasV2SearchResultTypes.SearchResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions = ambassadorWixAtlasV2SearchResult.search(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'GET',\n path: '/v2/search',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,gBAAAA;AAAA;AAAA;;;ACAA,0BAAkC;AAClC,mBAA6C;AAC7C,6BAA+B;AAC/B,IAAAC,uBAA2B;AAI3B,SAAS,uDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,oBAAoB;AAAA,MAClB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV;AAAA,QACE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,CAAC,CAAC;AAC7D;AAEA,IAAM,eAAe;AAGd,SAAS,OAAO,SAA6C;AAClE,WAAS,SAAS,EAAE,KAAK,GAAQ;AAC/B,UAAM,WAAW;AAAA,MACf,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,WAAW;AAAA,MACX,aAAa;AAAA,MACb,KAAK,uDAAuD;AAAA,QAC1D,WAAW;AAAA,QACX,MAAM;AAAA,QACN;AAAA,MACF,CAAC;AAAA,MACD,YAAQ,uCAAkB,OAAO;AAAA,MACjC,mBAAmB,CAACC,iBAClB,uCAAeA,UAAS;AAAA,QACtB;AAAA,UACE,aAAa;AAAA,UACb,OAAO;AAAA,YACL,EAAE,MAAM,yCAAyC;AAAA,YACjD,EAAE,MAAM,0CAA0C;AAAA,UACpD;AAAA,QACF;AAAA,MACF,CAAC;AAAA,MACH,UAAU;AAAA,QACR;AAAA,UACE,QAAQ;AAAA,UACR,KAAK,uDAAuD;AAAA,YAC1D,WAAW;AAAA,YACX,MAAM;AAAA,YACN;AAAA,UACF,CAAC;AAAA,UACD,YAAQ,uCAAkB,OAAO;AAAA,QACnC;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;
|
|
1
|
+
{"version":3,"sources":["../../meta.ts","../../src/atlas-v2-search-result-location.http.ts","../../src/atlas-v2-search-result-location.meta.ts"],"sourcesContent":["export * from './src/atlas-v2-search-result-location.meta.js';\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformRESTFloatToSDKFloat } 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 resolveComWixpressViAtlasServiceV2LocationServiceV2Url(\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 '*.wixforms.com': [\n {\n srcPath: '/_api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'platform.rise.ai': [\n {\n srcPath: '/_api/wix-atlas-service-web',\n destPath: '',\n },\n {\n srcPath: '/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_location';\n\n/** A Search request takes a free text as an input and returns a list of 'Address' objects. */\nexport function search(payload: object): RequestOptionsFactory<any> {\n function __search({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.atlas.v2.search_result',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'searchResults.address.geocode.latitude' },\n { path: 'searchResults.address.geocode.longitude' },\n ],\n },\n ]),\n fallback: [\n {\n method: 'GET' as any,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n },\n ],\n };\n\n return metadata;\n }\n\n return __search;\n}\n","import * as ambassadorWixAtlasV2SearchResult from './atlas-v2-search-result-location.http.js';\nimport * as ambassadorWixAtlasV2SearchResultTypes from './atlas-v2-search-result-location.types.js';\nimport * as ambassadorWixAtlasV2SearchResultUniversalTypes from './atlas-v2-search-result-location.universal.js';\n\nexport type __PublicMethodMetaInfo<\n K = string,\n M = unknown,\n T = unknown,\n S = unknown,\n Q = unknown,\n R = unknown\n> = {\n getUrl: (context: any) => string;\n httpMethod: K;\n path: string;\n pathParams: M;\n __requestType: T;\n __originalRequestType: S;\n __responseType: Q;\n __originalResponseType: R;\n};\n\nexport function search(): __PublicMethodMetaInfo<\n 'GET',\n {},\n ambassadorWixAtlasV2SearchResultUniversalTypes.SearchRequest,\n ambassadorWixAtlasV2SearchResultTypes.SearchRequest,\n ambassadorWixAtlasV2SearchResultUniversalTypes.SearchResponse,\n ambassadorWixAtlasV2SearchResultTypes.SearchResponse\n> {\n const payload = {} as any;\n\n const getRequestOptions = ambassadorWixAtlasV2SearchResult.search(payload);\n\n const getUrl = (context: any): string => {\n const { url } = getRequestOptions(context);\n return url!;\n };\n\n return {\n getUrl,\n httpMethod: 'GET',\n path: '/v2/search',\n pathParams: {},\n __requestType: null as any,\n __originalRequestType: null as any,\n __responseType: null as any,\n __originalResponseType: null as any,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,gBAAAA;AAAA;AAAA;;;ACAA,0BAAkC;AAClC,mBAA6C;AAC7C,6BAA+B;AAC/B,IAAAC,uBAA2B;AAI3B,SAAS,uDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,oBAAoB;AAAA,MAClB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,cAAc;AAAA,MACZ;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AA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;AAAA,UACR,KAAK,uDAAuD;AAAA,YAC1D,WAAW;AAAA,YACX,MAAM;AAAA,YACN;AAAA,UACF,CAAC;AAAA,UACD,YAAQ,uCAAkB,OAAO;AAAA,QACnC;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;;;AC/IO,SAASC,UAOd;AACA,QAAM,UAAU,CAAC;AAEjB,QAAM,oBAAqD,OAAO,OAAO;AAEzE,QAAM,SAAS,CAAC,YAAyB;AACvC,UAAM,EAAE,IAAI,IAAI,kBAAkB,OAAO;AACzC,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA,YAAY;AAAA,IACZ,MAAM;AAAA,IACN,YAAY,CAAC;AAAA,IACb,eAAe;AAAA,IACf,uBAAuB;AAAA,IACvB,gBAAgB;AAAA,IAChB,wBAAwB;AAAA,EAC1B;AACF;","names":["search","import_rest_modules","payload","search"]}
|
package/build/es/index.d.mts
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { HttpClient, NonNullablePaths, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
|
|
2
2
|
import { SearchOptions, SearchResponse } from './index.typings.mjs';
|
|
3
|
-
export { Address, AddressLocation, AddressStreetOneOf, FilterBy, FilterType, Proximity, ReverseGeocodingRequest, ReverseGeocodingResponse, SearchRequest, SearchResult, StreetAddress, Subdivision, SubdivisionType } from './index.typings.mjs';
|
|
3
|
+
export { Address, AddressLocation, AddressStreetOneOf, FilterBy, FilterType, FilterTypeWithLiterals, Proximity, ProximityWithLiterals, ReverseGeocodingRequest, ReverseGeocodingResponse, SearchRequest, SearchResult, StreetAddress, Subdivision, SubdivisionType, SubdivisionTypeWithLiterals } from './index.typings.mjs';
|
|
4
4
|
|
|
5
|
-
type SearchResultNonNullablePaths = `address.streetAddress.number` | `address.streetAddress.name` | `proximity`;
|
|
6
5
|
declare function search$1(httpClient: HttpClient): SearchSignature;
|
|
7
6
|
interface SearchSignature {
|
|
8
7
|
/**
|
|
9
8
|
* A Search request takes a free text as an input and returns a list of 'Address' objects.
|
|
10
9
|
*/
|
|
11
|
-
(options?: SearchOptions): Promise<NonNullablePaths<SearchResponse, {
|
|
12
|
-
[P in SearchResultNonNullablePaths]: `searchResults.${number}.${P}`;
|
|
13
|
-
}[SearchResultNonNullablePaths]>>;
|
|
10
|
+
(options?: SearchOptions): Promise<NonNullablePaths<SearchResponse, `searchResults` | `searchResults.${number}.address.streetAddress.number` | `searchResults.${number}.address.streetAddress.name` | `searchResults.${number}.proximity`, 6>>;
|
|
14
11
|
}
|
|
15
12
|
|
|
16
13
|
declare const search: MaybeContext<BuildRESTFunction<typeof search$1> & typeof search$1>;
|
package/build/es/index.mjs
CHANGED
|
@@ -107,6 +107,16 @@ function resolveComWixpressViAtlasServiceV2LocationServiceV2Url(opts) {
|
|
|
107
107
|
srcPath: "/_api/wix-atlas-service-web",
|
|
108
108
|
destPath: ""
|
|
109
109
|
}
|
|
110
|
+
],
|
|
111
|
+
"platform.rise.ai": [
|
|
112
|
+
{
|
|
113
|
+
srcPath: "/_api/wix-atlas-service-web",
|
|
114
|
+
destPath: ""
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
srcPath: "/wix-atlas-service-web",
|
|
118
|
+
destPath: ""
|
|
119
|
+
}
|
|
110
120
|
]
|
|
111
121
|
};
|
|
112
122
|
return resolveUrl(Object.assign(opts, { domainToMappings }));
|
package/build/es/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/atlas-v2-search-result-location.universal.ts","../../src/atlas-v2-search-result-location.http.ts","../../src/atlas-v2-search-result-location.public.ts","../../src/atlas-v2-search-result-location.context.ts"],"sourcesContent":["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 ambassadorWixAtlasV2SearchResult from './atlas-v2-search-result-location.http.js';\nimport { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\n\nexport interface SearchResult {\n /** The Address object */\n address?: Address;\n /** stores additional data about the proximity to the specified location */\n proximity?: ProximityWithLiterals;\n}\n\n/** Physical address */\nexport interface Address extends AddressStreetOneOf {\n /** Street name and number. */\n streetAddress?: StreetAddress;\n /** Main address line, usually street and number as free text. */\n addressLine1?: string | null;\n /**\n * Country code.\n * @format COUNTRY\n */\n country?: string | null;\n /** Subdivision. Usually a state, region, prefecture, or province code, according to [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2). */\n subdivision?: string | null;\n /** City name. */\n city?: string | null;\n /** Zip/postal code. */\n postalCode?: string | null;\n /** Free text providing more detailed address info. Usually contains Apt, Suite, and Floor. */\n addressLine2?: string | null;\n}\n\n/** @oneof */\nexport interface AddressStreetOneOf {\n /** Street name and number. */\n streetAddress?: StreetAddress;\n /** Main address line, usually street and number as free text. */\n addressLine?: string | null;\n}\n\nexport interface StreetAddress {\n /** Street number. */\n number?: string;\n /** Street name. */\n name?: string;\n}\n\nexport interface AddressLocation {\n /** Address latitude. */\n latitude?: number | null;\n /** Address longitude. */\n longitude?: number | null;\n}\n\nexport interface Subdivision {\n /** Short subdivision code. */\n code?: string;\n /** Subdivision full name. */\n name?: string;\n}\n\nexport enum SubdivisionType {\n UNKNOWN_SUBDIVISION_TYPE = 'UNKNOWN_SUBDIVISION_TYPE',\n /** State */\n ADMINISTRATIVE_AREA_LEVEL_1 = 'ADMINISTRATIVE_AREA_LEVEL_1',\n /** County */\n ADMINISTRATIVE_AREA_LEVEL_2 = 'ADMINISTRATIVE_AREA_LEVEL_2',\n /** City/town */\n ADMINISTRATIVE_AREA_LEVEL_3 = 'ADMINISTRATIVE_AREA_LEVEL_3',\n /** Neighborhood/quarter */\n ADMINISTRATIVE_AREA_LEVEL_4 = 'ADMINISTRATIVE_AREA_LEVEL_4',\n /** Street/block */\n ADMINISTRATIVE_AREA_LEVEL_5 = 'ADMINISTRATIVE_AREA_LEVEL_5',\n /** ADMINISTRATIVE_AREA_LEVEL_0. Indicates the national political entity, and is typically the highest order type returned by the Geocoder. */\n COUNTRY = 'COUNTRY',\n}\n\n/** @enumType */\nexport type SubdivisionTypeWithLiterals =\n | SubdivisionType\n | 'UNKNOWN_SUBDIVISION_TYPE'\n | 'ADMINISTRATIVE_AREA_LEVEL_1'\n | 'ADMINISTRATIVE_AREA_LEVEL_2'\n | 'ADMINISTRATIVE_AREA_LEVEL_3'\n | 'ADMINISTRATIVE_AREA_LEVEL_4'\n | 'ADMINISTRATIVE_AREA_LEVEL_5'\n | 'COUNTRY';\n\nexport enum Proximity {\n UNKNOWN_PROXIMITY = 'UNKNOWN_PROXIMITY',\n /** indicates that the returned result is a precise geocode for which we have location information accurate down to street address precision */\n PINPOINT = 'PINPOINT',\n /** indicates that the returned result is the geometric center of a result */\n APPROXIMATE = 'APPROXIMATE',\n /** indicates that the returned result is around an area */\n GENERAL_AREA = 'GENERAL_AREA',\n}\n\n/** @enumType */\nexport type ProximityWithLiterals =\n | Proximity\n | 'UNKNOWN_PROXIMITY'\n | 'PINPOINT'\n | 'APPROXIMATE'\n | 'GENERAL_AREA';\n\n/** User must provide query or filter by parameters */\nexport interface SearchRequest {\n /** Free text */\n query?: string | null;\n /**\n * Deprecate! - Please use 'zipCode' and 'countryCodes' fields\n * @deprecated\n */\n filterBy?: FilterBy[];\n /** Zip code filter the user can add in order to get more accurate results */\n zipCode?: string | null;\n /** Country codes filter the user can add in order to get more accurate results */\n countryCodes?: string[];\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 SearchResponse {\n /** List of 'Address' objects */\n searchResults?: SearchResult[];\n}\n\nexport interface ReverseGeocodingRequest {\n /** The latitude and longitude values specifying the location for which you wish to obtain the closest, human-readable address. */\n addressLocation?: AddressLocation;\n}\n\nexport interface ReverseGeocodingResponse {\n searchResults?: SearchResult[];\n}\n\ntype SearchResultNonNullablePaths =\n | `address.streetAddress.number`\n | `address.streetAddress.name`\n | `proximity`;\n\n/**\n * A Search request takes a free text as an input and returns a list of 'Address' objects.\n * @public\n * @documentationMaturity preview\n * @permissionId WIX_ATLAS.SEARCH\n * @applicableIdentity APP\n * @applicableIdentity VISITOR\n * @fqn com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search\n */\nexport async function search(\n options?: SearchOptions\n): Promise<\n NonNullablePaths<\n SearchResponse,\n {\n [P in SearchResultNonNullablePaths]: `searchResults.${number}.${P}`;\n }[SearchResultNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n query: options?.query,\n filterBy: options?.filterBy,\n zipCode: options?.zipCode,\n countryCodes: options?.countryCodes,\n });\n\n const reqOpts = ambassadorWixAtlasV2SearchResult.search(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(\n transformPaths(result.data, [\n {\n transformFn: transformRESTAddressToSDKAddress,\n paths: [{ path: 'searchResults.address' }],\n },\n ])\n )!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n query: '$[0].query',\n filterBy: '$[0].filterBy',\n zipCode: '$[0].zipCode',\n countryCodes: '$[0].countryCodes',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface SearchOptions {\n /** Free text */\n query?: string | null;\n /**\n * Deprecate! - Please use 'zipCode' and 'countryCodes' fields\n * @deprecated\n */\n filterBy?: FilterBy[];\n /** Zip code filter the user can add in order to get more accurate results */\n zipCode?: string | null;\n /** Country codes filter the user can add in order to get more accurate results */\n countryCodes?: string[];\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformRESTFloatToSDKFloat } 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 resolveComWixpressViAtlasServiceV2LocationServiceV2Url(\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 '*.wixforms.com': [\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_location';\n\n/** A Search request takes a free text as an input and returns a list of 'Address' objects. */\nexport function search(payload: object): RequestOptionsFactory<any> {\n function __search({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.atlas.v2.search_result',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'searchResults.address.geocode.latitude' },\n { path: 'searchResults.address.geocode.longitude' },\n ],\n },\n ]),\n fallback: [\n {\n method: 'GET' as any,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n },\n ],\n };\n\n return metadata;\n }\n\n return __search;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n SearchOptions,\n SearchResponse,\n search as universalSearch,\n} from './atlas-v2-search-result-location.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/atlas' };\n\ntype SearchResultNonNullablePaths =\n | `address.streetAddress.number`\n | `address.streetAddress.name`\n | `proximity`;\n\nexport function search(httpClient: HttpClient): SearchSignature {\n return (options?: SearchOptions) =>\n universalSearch(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface SearchSignature {\n /**\n * A Search request takes a free text as an input and returns a list of 'Address' objects.\n */\n (options?: SearchOptions): Promise<\n NonNullablePaths<\n SearchResponse,\n {\n [P in SearchResultNonNullablePaths]: `searchResults.${number}.${P}`;\n }[SearchResultNonNullablePaths]\n >\n >;\n}\n\nexport {\n Address,\n AddressLocation,\n AddressStreetOneOf,\n FilterBy,\n FilterType,\n Proximity,\n ReverseGeocodingRequest,\n ReverseGeocodingResponse,\n SearchOptions,\n SearchRequest,\n SearchResponse,\n SearchResult,\n StreetAddress,\n Subdivision,\n SubdivisionType,\n} from './atlas-v2-search-result-location.universal.js';\n","import { search as publicSearch } from './atlas-v2-search-result-location.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const search: MaybeContext<\n BuildRESTFunction<typeof publicSearch> & typeof publicSearch\n> = /*#__PURE__*/ createRESTModule(publicSearch);\n\nexport {\n SubdivisionType,\n Proximity,\n FilterType,\n} from './atlas-v2-search-result-location.universal.js';\nexport {\n SearchResult,\n Address,\n AddressStreetOneOf,\n StreetAddress,\n AddressLocation,\n Subdivision,\n SearchRequest,\n FilterBy,\n SearchResponse,\n ReverseGeocodingRequest,\n ReverseGeocodingResponse,\n SearchOptions,\n} from './atlas-v2-search-result-location.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,yBAAyB;AAClC,SAAS,oCAAoC;AAC7C,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,SAAS,uDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS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S,wBAAwB;AAG1B,IAAMC,UAEK,iCAAiBA,OAAY;","names":["payload","transformPaths","SubdivisionType","Proximity","FilterType","search","search","search"]}
|
|
1
|
+
{"version":3,"sources":["../../src/atlas-v2-search-result-location.universal.ts","../../src/atlas-v2-search-result-location.http.ts","../../src/atlas-v2-search-result-location.public.ts","../../src/atlas-v2-search-result-location.context.ts"],"sourcesContent":["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 ambassadorWixAtlasV2SearchResult from './atlas-v2-search-result-location.http.js';\nimport { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\n\nexport interface SearchResult {\n /** The Address object */\n address?: Address;\n /** stores additional data about the proximity to the specified location */\n proximity?: ProximityWithLiterals;\n}\n\n/** Physical address */\nexport interface Address extends AddressStreetOneOf {\n /** Street name and number. */\n streetAddress?: StreetAddress;\n /** Main address line, usually street and number as free text. */\n addressLine1?: string | null;\n /**\n * Country code.\n * @format COUNTRY\n */\n country?: string | null;\n /** Subdivision. Usually a state, region, prefecture, or province code, according to [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2). */\n subdivision?: string | null;\n /** City name. */\n city?: string | null;\n /** Zip/postal code. */\n postalCode?: string | null;\n /** Free text providing more detailed address info. Usually contains Apt, Suite, and Floor. */\n addressLine2?: string | null;\n}\n\n/** @oneof */\nexport interface AddressStreetOneOf {\n /** Street name and number. */\n streetAddress?: StreetAddress;\n /** Main address line, usually street and number as free text. */\n addressLine?: string | null;\n}\n\nexport interface StreetAddress {\n /** Street number. */\n number?: string;\n /** Street name. */\n name?: string;\n}\n\nexport interface AddressLocation {\n /** Address latitude. */\n latitude?: number | null;\n /** Address longitude. */\n longitude?: number | null;\n}\n\nexport interface Subdivision {\n /** Short subdivision code. */\n code?: string;\n /** Subdivision full name. */\n name?: string;\n}\n\nexport enum SubdivisionType {\n UNKNOWN_SUBDIVISION_TYPE = 'UNKNOWN_SUBDIVISION_TYPE',\n /** State */\n ADMINISTRATIVE_AREA_LEVEL_1 = 'ADMINISTRATIVE_AREA_LEVEL_1',\n /** County */\n ADMINISTRATIVE_AREA_LEVEL_2 = 'ADMINISTRATIVE_AREA_LEVEL_2',\n /** City/town */\n ADMINISTRATIVE_AREA_LEVEL_3 = 'ADMINISTRATIVE_AREA_LEVEL_3',\n /** Neighborhood/quarter */\n ADMINISTRATIVE_AREA_LEVEL_4 = 'ADMINISTRATIVE_AREA_LEVEL_4',\n /** Street/block */\n ADMINISTRATIVE_AREA_LEVEL_5 = 'ADMINISTRATIVE_AREA_LEVEL_5',\n /** ADMINISTRATIVE_AREA_LEVEL_0. Indicates the national political entity, and is typically the highest order type returned by the Geocoder. */\n COUNTRY = 'COUNTRY',\n}\n\n/** @enumType */\nexport type SubdivisionTypeWithLiterals =\n | SubdivisionType\n | 'UNKNOWN_SUBDIVISION_TYPE'\n | 'ADMINISTRATIVE_AREA_LEVEL_1'\n | 'ADMINISTRATIVE_AREA_LEVEL_2'\n | 'ADMINISTRATIVE_AREA_LEVEL_3'\n | 'ADMINISTRATIVE_AREA_LEVEL_4'\n | 'ADMINISTRATIVE_AREA_LEVEL_5'\n | 'COUNTRY';\n\nexport enum Proximity {\n UNKNOWN_PROXIMITY = 'UNKNOWN_PROXIMITY',\n /** indicates that the returned result is a precise geocode for which we have location information accurate down to street address precision */\n PINPOINT = 'PINPOINT',\n /** indicates that the returned result is the geometric center of a result */\n APPROXIMATE = 'APPROXIMATE',\n /** indicates that the returned result is around an area */\n GENERAL_AREA = 'GENERAL_AREA',\n}\n\n/** @enumType */\nexport type ProximityWithLiterals =\n | Proximity\n | 'UNKNOWN_PROXIMITY'\n | 'PINPOINT'\n | 'APPROXIMATE'\n | 'GENERAL_AREA';\n\n/** User must provide query or filter by parameters */\nexport interface SearchRequest {\n /** Free text */\n query?: string | null;\n /**\n * Deprecate! - Please use 'zipCode' and 'countryCodes' fields\n * @deprecated\n */\n filterBy?: FilterBy[];\n /** Zip code filter the user can add in order to get more accurate results */\n zipCode?: string | null;\n /** Country codes filter the user can add in order to get more accurate results */\n countryCodes?: string[];\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 SearchResponse {\n /** List of 'Address' objects */\n searchResults?: SearchResult[];\n}\n\nexport interface ReverseGeocodingRequest {\n /** The latitude and longitude values specifying the location for which you wish to obtain the closest, human-readable address. */\n addressLocation?: AddressLocation;\n}\n\nexport interface ReverseGeocodingResponse {\n searchResults?: SearchResult[];\n}\n\n/**\n * A Search request takes a free text as an input and returns a list of 'Address' objects.\n * @public\n * @documentationMaturity preview\n * @permissionId WIX_ATLAS.SEARCH\n * @applicableIdentity APP\n * @applicableIdentity VISITOR\n * @fqn com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search\n */\nexport async function search(\n options?: SearchOptions\n): Promise<\n NonNullablePaths<\n SearchResponse,\n | `searchResults`\n | `searchResults.${number}.address.streetAddress.number`\n | `searchResults.${number}.address.streetAddress.name`\n | `searchResults.${number}.proximity`,\n 6\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n query: options?.query,\n filterBy: options?.filterBy,\n zipCode: options?.zipCode,\n countryCodes: options?.countryCodes,\n });\n\n const reqOpts = ambassadorWixAtlasV2SearchResult.search(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(\n transformPaths(result.data, [\n {\n transformFn: transformRESTAddressToSDKAddress,\n paths: [{ path: 'searchResults.address' }],\n },\n ])\n )!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n query: '$[0].query',\n filterBy: '$[0].filterBy',\n zipCode: '$[0].zipCode',\n countryCodes: '$[0].countryCodes',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface SearchOptions {\n /** Free text */\n query?: string | null;\n /**\n * Deprecate! - Please use 'zipCode' and 'countryCodes' fields\n * @deprecated\n */\n filterBy?: FilterBy[];\n /** Zip code filter the user can add in order to get more accurate results */\n zipCode?: string | null;\n /** Country codes filter the user can add in order to get more accurate results */\n countryCodes?: string[];\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformRESTFloatToSDKFloat } 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 resolveComWixpressViAtlasServiceV2LocationServiceV2Url(\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 '*.wixforms.com': [\n {\n srcPath: '/_api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'platform.rise.ai': [\n {\n srcPath: '/_api/wix-atlas-service-web',\n destPath: '',\n },\n {\n srcPath: '/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_location';\n\n/** A Search request takes a free text as an input and returns a list of 'Address' objects. */\nexport function search(payload: object): RequestOptionsFactory<any> {\n function __search({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.atlas.v2.search_result',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'searchResults.address.geocode.latitude' },\n { path: 'searchResults.address.geocode.longitude' },\n ],\n },\n ]),\n fallback: [\n {\n method: 'GET' as any,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n },\n ],\n };\n\n return metadata;\n }\n\n return __search;\n}\n","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n SearchOptions,\n SearchResponse,\n search as universalSearch,\n} from './atlas-v2-search-result-location.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/atlas' };\n\nexport function search(httpClient: HttpClient): SearchSignature {\n return (options?: SearchOptions) =>\n universalSearch(\n options,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface SearchSignature {\n /**\n * A Search request takes a free text as an input and returns a list of 'Address' objects.\n */\n (options?: SearchOptions): Promise<\n NonNullablePaths<\n SearchResponse,\n | `searchResults`\n | `searchResults.${number}.address.streetAddress.number`\n | `searchResults.${number}.address.streetAddress.name`\n | `searchResults.${number}.proximity`,\n 6\n >\n >;\n}\n\nexport {\n Address,\n AddressLocation,\n AddressStreetOneOf,\n FilterBy,\n FilterType,\n Proximity,\n ReverseGeocodingRequest,\n ReverseGeocodingResponse,\n SearchOptions,\n SearchRequest,\n SearchResponse,\n SearchResult,\n StreetAddress,\n Subdivision,\n SubdivisionType,\n} from './atlas-v2-search-result-location.universal.js';\n","import { search as publicSearch } from './atlas-v2-search-result-location.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const search: MaybeContext<\n BuildRESTFunction<typeof publicSearch> & typeof publicSearch\n> = /*#__PURE__*/ createRESTModule(publicSearch);\n\nexport {\n SubdivisionType,\n Proximity,\n FilterType,\n} from './atlas-v2-search-result-location.universal.js';\nexport {\n SearchResult,\n Address,\n AddressStreetOneOf,\n StreetAddress,\n AddressLocation,\n Subdivision,\n SearchRequest,\n FilterBy,\n SearchResponse,\n ReverseGeocodingRequest,\n ReverseGeocodingResponse,\n SearchOptions,\n} from './atlas-v2-search-result-location.universal.js';\nexport {\n SubdivisionTypeWithLiterals,\n ProximityWithLiterals,\n FilterTypeWithLiterals,\n} from './atlas-v2-search-result-location.universal.js';\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,yBAAyB;AAClC,SAAS,oCAAoC;AAC7C,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,SAAS,uDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,oBAAoB;AAAA,MAClB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,YAAY;AAAA,MACV;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,cAAc;AAAA,MACZ;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,qBAAqB;AAAA,MACnB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,MACA;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA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AAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO;AAAA,MACLJ,gBAAe,OAAO,MAAM;AAAA,QAC1B;AAAA,UACE,aAAa;AAAA,UACb,OAAO,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,OAAO;AAAA,UACP,UAAU;AAAA,UACV,SAAS;AAAA,UACT,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;;;AEzNO,SAASK,QAAO,YAAyC;AAC9D,SAAO,CAAC,YACNA;AAAA,IACE;AAAA;AAAA,IAEA,EAAE,WAAW;AAAA,EACf;AACJ;;;ACfA,SAAS,wBAAwB;AAG1B,IAAMC,UAEK,iCAAiBA,OAAY;","names":["payload","transformPaths","SubdivisionType","Proximity","FilterType","search","search","search"]}
|
|
@@ -118,7 +118,6 @@ interface ReverseGeocodingRequest {
|
|
|
118
118
|
interface ReverseGeocodingResponse {
|
|
119
119
|
searchResults?: SearchResult[];
|
|
120
120
|
}
|
|
121
|
-
type SearchResultNonNullablePaths = `address.streetAddress.number` | `address.streetAddress.name` | `proximity`;
|
|
122
121
|
/**
|
|
123
122
|
* A Search request takes a free text as an input and returns a list of 'Address' objects.
|
|
124
123
|
* @public
|
|
@@ -128,9 +127,7 @@ type SearchResultNonNullablePaths = `address.streetAddress.number` | `address.st
|
|
|
128
127
|
* @applicableIdentity VISITOR
|
|
129
128
|
* @fqn com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search
|
|
130
129
|
*/
|
|
131
|
-
declare function search(options?: SearchOptions): Promise<NonNullablePaths<SearchResponse, {
|
|
132
|
-
[P in SearchResultNonNullablePaths]: `searchResults.${number}.${P}`;
|
|
133
|
-
}[SearchResultNonNullablePaths]>>;
|
|
130
|
+
declare function search(options?: SearchOptions): Promise<NonNullablePaths<SearchResponse, `searchResults` | `searchResults.${number}.address.streetAddress.number` | `searchResults.${number}.address.streetAddress.name` | `searchResults.${number}.proximity`, 6>>;
|
|
134
131
|
interface SearchOptions {
|
|
135
132
|
/** Free text */
|
|
136
133
|
query?: string | null;
|
|
@@ -107,6 +107,16 @@ function resolveComWixpressViAtlasServiceV2LocationServiceV2Url(opts) {
|
|
|
107
107
|
srcPath: "/_api/wix-atlas-service-web",
|
|
108
108
|
destPath: ""
|
|
109
109
|
}
|
|
110
|
+
],
|
|
111
|
+
"platform.rise.ai": [
|
|
112
|
+
{
|
|
113
|
+
srcPath: "/_api/wix-atlas-service-web",
|
|
114
|
+
destPath: ""
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
srcPath: "/wix-atlas-service-web",
|
|
118
|
+
destPath: ""
|
|
119
|
+
}
|
|
110
120
|
]
|
|
111
121
|
};
|
|
112
122
|
return resolveUrl(Object.assign(opts, { domainToMappings }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/atlas-v2-search-result-location.universal.ts","../../src/atlas-v2-search-result-location.http.ts"],"sourcesContent":["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 ambassadorWixAtlasV2SearchResult from './atlas-v2-search-result-location.http.js';\nimport { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\n\nexport interface SearchResult {\n /** The Address object */\n address?: Address;\n /** stores additional data about the proximity to the specified location */\n proximity?: ProximityWithLiterals;\n}\n\n/** Physical address */\nexport interface Address extends AddressStreetOneOf {\n /** Street name and number. */\n streetAddress?: StreetAddress;\n /** Main address line, usually street and number as free text. */\n addressLine1?: string | null;\n /**\n * Country code.\n * @format COUNTRY\n */\n country?: string | null;\n /** Subdivision. Usually a state, region, prefecture, or province code, according to [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2). */\n subdivision?: string | null;\n /** City name. */\n city?: string | null;\n /** Zip/postal code. */\n postalCode?: string | null;\n /** Free text providing more detailed address info. Usually contains Apt, Suite, and Floor. */\n addressLine2?: string | null;\n}\n\n/** @oneof */\nexport interface AddressStreetOneOf {\n /** Street name and number. */\n streetAddress?: StreetAddress;\n /** Main address line, usually street and number as free text. */\n addressLine?: string | null;\n}\n\nexport interface StreetAddress {\n /** Street number. */\n number?: string;\n /** Street name. */\n name?: string;\n}\n\nexport interface AddressLocation {\n /** Address latitude. */\n latitude?: number | null;\n /** Address longitude. */\n longitude?: number | null;\n}\n\nexport interface Subdivision {\n /** Short subdivision code. */\n code?: string;\n /** Subdivision full name. */\n name?: string;\n}\n\nexport enum SubdivisionType {\n UNKNOWN_SUBDIVISION_TYPE = 'UNKNOWN_SUBDIVISION_TYPE',\n /** State */\n ADMINISTRATIVE_AREA_LEVEL_1 = 'ADMINISTRATIVE_AREA_LEVEL_1',\n /** County */\n ADMINISTRATIVE_AREA_LEVEL_2 = 'ADMINISTRATIVE_AREA_LEVEL_2',\n /** City/town */\n ADMINISTRATIVE_AREA_LEVEL_3 = 'ADMINISTRATIVE_AREA_LEVEL_3',\n /** Neighborhood/quarter */\n ADMINISTRATIVE_AREA_LEVEL_4 = 'ADMINISTRATIVE_AREA_LEVEL_4',\n /** Street/block */\n ADMINISTRATIVE_AREA_LEVEL_5 = 'ADMINISTRATIVE_AREA_LEVEL_5',\n /** ADMINISTRATIVE_AREA_LEVEL_0. Indicates the national political entity, and is typically the highest order type returned by the Geocoder. */\n COUNTRY = 'COUNTRY',\n}\n\n/** @enumType */\nexport type SubdivisionTypeWithLiterals =\n | SubdivisionType\n | 'UNKNOWN_SUBDIVISION_TYPE'\n | 'ADMINISTRATIVE_AREA_LEVEL_1'\n | 'ADMINISTRATIVE_AREA_LEVEL_2'\n | 'ADMINISTRATIVE_AREA_LEVEL_3'\n | 'ADMINISTRATIVE_AREA_LEVEL_4'\n | 'ADMINISTRATIVE_AREA_LEVEL_5'\n | 'COUNTRY';\n\nexport enum Proximity {\n UNKNOWN_PROXIMITY = 'UNKNOWN_PROXIMITY',\n /** indicates that the returned result is a precise geocode for which we have location information accurate down to street address precision */\n PINPOINT = 'PINPOINT',\n /** indicates that the returned result is the geometric center of a result */\n APPROXIMATE = 'APPROXIMATE',\n /** indicates that the returned result is around an area */\n GENERAL_AREA = 'GENERAL_AREA',\n}\n\n/** @enumType */\nexport type ProximityWithLiterals =\n | Proximity\n | 'UNKNOWN_PROXIMITY'\n | 'PINPOINT'\n | 'APPROXIMATE'\n | 'GENERAL_AREA';\n\n/** User must provide query or filter by parameters */\nexport interface SearchRequest {\n /** Free text */\n query?: string | null;\n /**\n * Deprecate! - Please use 'zipCode' and 'countryCodes' fields\n * @deprecated\n */\n filterBy?: FilterBy[];\n /** Zip code filter the user can add in order to get more accurate results */\n zipCode?: string | null;\n /** Country codes filter the user can add in order to get more accurate results */\n countryCodes?: string[];\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 SearchResponse {\n /** List of 'Address' objects */\n searchResults?: SearchResult[];\n}\n\nexport interface ReverseGeocodingRequest {\n /** The latitude and longitude values specifying the location for which you wish to obtain the closest, human-readable address. */\n addressLocation?: AddressLocation;\n}\n\nexport interface ReverseGeocodingResponse {\n searchResults?: SearchResult[];\n}\n\ntype SearchResultNonNullablePaths =\n | `address.streetAddress.number`\n | `address.streetAddress.name`\n | `proximity`;\n\n/**\n * A Search request takes a free text as an input and returns a list of 'Address' objects.\n * @public\n * @documentationMaturity preview\n * @permissionId WIX_ATLAS.SEARCH\n * @applicableIdentity APP\n * @applicableIdentity VISITOR\n * @fqn com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search\n */\nexport async function search(\n options?: SearchOptions\n): Promise<\n NonNullablePaths<\n SearchResponse,\n {\n [P in SearchResultNonNullablePaths]: `searchResults.${number}.${P}`;\n }[SearchResultNonNullablePaths]\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n query: options?.query,\n filterBy: options?.filterBy,\n zipCode: options?.zipCode,\n countryCodes: options?.countryCodes,\n });\n\n const reqOpts = ambassadorWixAtlasV2SearchResult.search(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(\n transformPaths(result.data, [\n {\n transformFn: transformRESTAddressToSDKAddress,\n paths: [{ path: 'searchResults.address' }],\n },\n ])\n )!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n query: '$[0].query',\n filterBy: '$[0].filterBy',\n zipCode: '$[0].zipCode',\n countryCodes: '$[0].countryCodes',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface SearchOptions {\n /** Free text */\n query?: string | null;\n /**\n * Deprecate! - Please use 'zipCode' and 'countryCodes' fields\n * @deprecated\n */\n filterBy?: FilterBy[];\n /** Zip code filter the user can add in order to get more accurate results */\n zipCode?: string | null;\n /** Country codes filter the user can add in order to get more accurate results */\n countryCodes?: string[];\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformRESTFloatToSDKFloat } 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 resolveComWixpressViAtlasServiceV2LocationServiceV2Url(\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 '*.wixforms.com': [\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_location';\n\n/** A Search request takes a free text as an input and returns a list of 'Address' objects. */\nexport function search(payload: object): RequestOptionsFactory<any> {\n function __search({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.atlas.v2.search_result',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'searchResults.address.geocode.latitude' },\n { path: 'searchResults.address.geocode.longitude' },\n ],\n },\n ]),\n fallback: [\n {\n method: 'GET' as any,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n },\n ],\n };\n\n return metadata;\n }\n\n return __search;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;ACJP,SAAS,yBAAyB;AAClC,SAAS,oCAAoC;AAC7C,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAI3B,SAAS,uDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,yBAAyB;AAAA,MACvB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,oBAAoB;AAAA,MAClB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,YAAY;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,SAAAA;AAAA,GAAA;AAwCL,IAAK,aAAL,kBAAKC,gBAAL;AAEL,EAAAA,YAAA,cAAW;AAEX,EAAAA,YAAA,kBAAe;AAJL,SAAAA;AAAA,GAAA;AAsCZ,eAAsBC,QACpB,SAQA;AAEA,QAAM,EAAE,YAAY,YAAY,IAAI,UAAU,CAAC;AAK/C,QAAM,UAAU,sCAAsC;AAAA,IACpD,OAAO,SAAS;AAAA,IAChB,UAAU,SAAS;AAAA,IACnB,SAAS,SAAS;AAAA,IAClB,cAAc,SAAS;AAAA,EACzB,CAAC;AAED,QAAM,UAA2C,OAAO,OAAO;AAE/D,eAAa,aAAa;AAC1B,MAAI;AACF,UAAM,SAAS,MAAM,WAAW,QAAQ,OAAO;AAC/C,iBAAa,YAAY,MAAM;AAE/B,WAAO;AAAA,MACLJ,gBAAe,OAAO,MAAM;AAAA,QAC1B;AAAA,UACE,aAAa;AAAA,UACb,OAAO,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAAA,QAC3C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF,SAAS,KAAU;AACjB,UAAM,mBAAmB;AAAA,MACvB;AAAA,MACA;AAAA,QACE,wBAAwB,CAAC;AAAA,QACzB,0BAA0B;AAAA,UACxB,OAAO;AAAA,UACP,UAAU;AAAA,UACV,SAAS;AAAA,UACT,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["payload","transformPaths","SubdivisionType","Proximity","FilterType","search"]}
|
|
1
|
+
{"version":3,"sources":["../../src/atlas-v2-search-result-location.universal.ts","../../src/atlas-v2-search-result-location.http.ts"],"sourcesContent":["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 ambassadorWixAtlasV2SearchResult from './atlas-v2-search-result-location.http.js';\nimport { transformRESTAddressToSDKAddress } from '@wix/sdk-runtime/transformations/address';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\n\nexport interface SearchResult {\n /** The Address object */\n address?: Address;\n /** stores additional data about the proximity to the specified location */\n proximity?: ProximityWithLiterals;\n}\n\n/** Physical address */\nexport interface Address extends AddressStreetOneOf {\n /** Street name and number. */\n streetAddress?: StreetAddress;\n /** Main address line, usually street and number as free text. */\n addressLine1?: string | null;\n /**\n * Country code.\n * @format COUNTRY\n */\n country?: string | null;\n /** Subdivision. Usually a state, region, prefecture, or province code, according to [ISO 3166-2](https://en.wikipedia.org/wiki/ISO_3166-2). */\n subdivision?: string | null;\n /** City name. */\n city?: string | null;\n /** Zip/postal code. */\n postalCode?: string | null;\n /** Free text providing more detailed address info. Usually contains Apt, Suite, and Floor. */\n addressLine2?: string | null;\n}\n\n/** @oneof */\nexport interface AddressStreetOneOf {\n /** Street name and number. */\n streetAddress?: StreetAddress;\n /** Main address line, usually street and number as free text. */\n addressLine?: string | null;\n}\n\nexport interface StreetAddress {\n /** Street number. */\n number?: string;\n /** Street name. */\n name?: string;\n}\n\nexport interface AddressLocation {\n /** Address latitude. */\n latitude?: number | null;\n /** Address longitude. */\n longitude?: number | null;\n}\n\nexport interface Subdivision {\n /** Short subdivision code. */\n code?: string;\n /** Subdivision full name. */\n name?: string;\n}\n\nexport enum SubdivisionType {\n UNKNOWN_SUBDIVISION_TYPE = 'UNKNOWN_SUBDIVISION_TYPE',\n /** State */\n ADMINISTRATIVE_AREA_LEVEL_1 = 'ADMINISTRATIVE_AREA_LEVEL_1',\n /** County */\n ADMINISTRATIVE_AREA_LEVEL_2 = 'ADMINISTRATIVE_AREA_LEVEL_2',\n /** City/town */\n ADMINISTRATIVE_AREA_LEVEL_3 = 'ADMINISTRATIVE_AREA_LEVEL_3',\n /** Neighborhood/quarter */\n ADMINISTRATIVE_AREA_LEVEL_4 = 'ADMINISTRATIVE_AREA_LEVEL_4',\n /** Street/block */\n ADMINISTRATIVE_AREA_LEVEL_5 = 'ADMINISTRATIVE_AREA_LEVEL_5',\n /** ADMINISTRATIVE_AREA_LEVEL_0. Indicates the national political entity, and is typically the highest order type returned by the Geocoder. */\n COUNTRY = 'COUNTRY',\n}\n\n/** @enumType */\nexport type SubdivisionTypeWithLiterals =\n | SubdivisionType\n | 'UNKNOWN_SUBDIVISION_TYPE'\n | 'ADMINISTRATIVE_AREA_LEVEL_1'\n | 'ADMINISTRATIVE_AREA_LEVEL_2'\n | 'ADMINISTRATIVE_AREA_LEVEL_3'\n | 'ADMINISTRATIVE_AREA_LEVEL_4'\n | 'ADMINISTRATIVE_AREA_LEVEL_5'\n | 'COUNTRY';\n\nexport enum Proximity {\n UNKNOWN_PROXIMITY = 'UNKNOWN_PROXIMITY',\n /** indicates that the returned result is a precise geocode for which we have location information accurate down to street address precision */\n PINPOINT = 'PINPOINT',\n /** indicates that the returned result is the geometric center of a result */\n APPROXIMATE = 'APPROXIMATE',\n /** indicates that the returned result is around an area */\n GENERAL_AREA = 'GENERAL_AREA',\n}\n\n/** @enumType */\nexport type ProximityWithLiterals =\n | Proximity\n | 'UNKNOWN_PROXIMITY'\n | 'PINPOINT'\n | 'APPROXIMATE'\n | 'GENERAL_AREA';\n\n/** User must provide query or filter by parameters */\nexport interface SearchRequest {\n /** Free text */\n query?: string | null;\n /**\n * Deprecate! - Please use 'zipCode' and 'countryCodes' fields\n * @deprecated\n */\n filterBy?: FilterBy[];\n /** Zip code filter the user can add in order to get more accurate results */\n zipCode?: string | null;\n /** Country codes filter the user can add in order to get more accurate results */\n countryCodes?: string[];\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 SearchResponse {\n /** List of 'Address' objects */\n searchResults?: SearchResult[];\n}\n\nexport interface ReverseGeocodingRequest {\n /** The latitude and longitude values specifying the location for which you wish to obtain the closest, human-readable address. */\n addressLocation?: AddressLocation;\n}\n\nexport interface ReverseGeocodingResponse {\n searchResults?: SearchResult[];\n}\n\n/**\n * A Search request takes a free text as an input and returns a list of 'Address' objects.\n * @public\n * @documentationMaturity preview\n * @permissionId WIX_ATLAS.SEARCH\n * @applicableIdentity APP\n * @applicableIdentity VISITOR\n * @fqn com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search\n */\nexport async function search(\n options?: SearchOptions\n): Promise<\n NonNullablePaths<\n SearchResponse,\n | `searchResults`\n | `searchResults.${number}.address.streetAddress.number`\n | `searchResults.${number}.address.streetAddress.name`\n | `searchResults.${number}.proximity`,\n 6\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n query: options?.query,\n filterBy: options?.filterBy,\n zipCode: options?.zipCode,\n countryCodes: options?.countryCodes,\n });\n\n const reqOpts = ambassadorWixAtlasV2SearchResult.search(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(\n transformPaths(result.data, [\n {\n transformFn: transformRESTAddressToSDKAddress,\n paths: [{ path: 'searchResults.address' }],\n },\n ])\n )!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {\n query: '$[0].query',\n filterBy: '$[0].filterBy',\n zipCode: '$[0].zipCode',\n countryCodes: '$[0].countryCodes',\n },\n singleArgumentUnchanged: false,\n },\n ['options']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\nexport interface SearchOptions {\n /** Free text */\n query?: string | null;\n /**\n * Deprecate! - Please use 'zipCode' and 'countryCodes' fields\n * @deprecated\n */\n filterBy?: FilterBy[];\n /** Zip code filter the user can add in order to get more accurate results */\n zipCode?: string | null;\n /** Country codes filter the user can add in order to get more accurate results */\n countryCodes?: string[];\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformRESTFloatToSDKFloat } 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 resolveComWixpressViAtlasServiceV2LocationServiceV2Url(\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 '*.wixforms.com': [\n {\n srcPath: '/_api/wix-atlas-service-web',\n destPath: '',\n },\n ],\n 'platform.rise.ai': [\n {\n srcPath: '/_api/wix-atlas-service-web',\n destPath: '',\n },\n {\n srcPath: '/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_location';\n\n/** A Search request takes a free text as an input and returns a list of 'Address' objects. */\nexport function search(payload: object): RequestOptionsFactory<any> {\n function __search({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.atlas.v2.search_result',\n method: 'GET' as any,\n methodFqn: 'com.wixpress.vi.atlas.service.v2.LocationServiceV2.Search',\n packageName: PACKAGE_NAME,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTFloatToSDKFloat,\n paths: [\n { path: 'searchResults.address.geocode.latitude' },\n { path: 'searchResults.address.geocode.longitude' },\n ],\n },\n ]),\n fallback: [\n {\n method: 'GET' as any,\n url: resolveComWixpressViAtlasServiceV2LocationServiceV2Url({\n protoPath: '/v2/search',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n },\n ],\n };\n\n return metadata;\n }\n\n return __search;\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,yBAAyB;AACpD;AAAA,EACE;AAAA,EACA;AAAA,OACK;;;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ACxB,OAAO;AAAA,UACP,UAAU;AAAA,UACV,SAAS;AAAA,UACT,cAAc;AAAA,QAChB;AAAA,QACA,yBAAyB;AAAA,MAC3B;AAAA,MACA,CAAC,SAAS;AAAA,IACZ;AACA,iBAAa,UAAU,GAAG;AAE1B,UAAM;AAAA,EACR;AACF;","names":["payload","transformPaths","SubdivisionType","Proximity","FilterType","search"]}
|
package/build/es/meta.mjs
CHANGED
|
@@ -100,6 +100,16 @@ function resolveComWixpressViAtlasServiceV2LocationServiceV2Url(opts) {
|
|
|
100
100
|
srcPath: "/_api/wix-atlas-service-web",
|
|
101
101
|
destPath: ""
|
|
102
102
|
}
|
|
103
|
+
],
|
|
104
|
+
"platform.rise.ai": [
|
|
105
|
+
{
|
|
106
|
+
srcPath: "/_api/wix-atlas-service-web",
|
|
107
|
+
destPath: ""
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
srcPath: "/wix-atlas-service-web",
|
|
111
|
+
destPath: ""
|
|
112
|
+
}
|
|
103
113
|
]
|
|
104
114
|
};
|
|
105
115
|
return resolveUrl(Object.assign(opts, { domainToMappings }));
|