@pretto/places 0.12.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/addressSearch.d.ts +11 -1
- package/dist/addressSearch.d.ts.map +1 -1
- package/dist/index.js +13 -11
- package/dist/module.js +13 -11
- package/dist/municipalitySearch.d.ts +2 -1
- package/dist/municipalitySearch.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/addressSearch.d.ts
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
interface AddressSearchResult {
|
2
|
+
label: string;
|
3
|
+
value: {
|
4
|
+
city: string;
|
5
|
+
country: string;
|
6
|
+
street: string;
|
7
|
+
zipcode: string;
|
8
|
+
};
|
9
|
+
}
|
1
10
|
export interface AddressApiResult {
|
2
11
|
properties: {
|
3
12
|
label: string;
|
@@ -12,6 +21,7 @@ interface Options {
|
|
12
21
|
country: string;
|
13
22
|
limit: number;
|
14
23
|
}
|
15
|
-
|
24
|
+
declare type DebouncedAddressSearch = (search: string, options?: Options, debounceValue?: number) => Promise<AddressSearchResult[] | string>;
|
25
|
+
export declare const get: DebouncedAddressSearch;
|
16
26
|
export {};
|
17
27
|
//# sourceMappingURL=addressSearch.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"addressSearch.d.ts","sourceRoot":"","sources":["../src/addressSearch.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"addressSearch.d.ts","sourceRoot":"","sources":["../src/addressSearch.ts"],"names":[],"mappings":"AAAA,UAAU,mBAAmB;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;QACf,MAAM,EAAE,MAAM,CAAA;QACd,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;CACF;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE;QACV,KAAK,EAAE,MAAM,CAAA;QACb,IAAI,EAAE,MAAM,CAAA;QACZ,QAAQ,EAAE,MAAM,CAAA;QAChB,IAAI,EAAE,MAAM,CAAA;QACZ,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF;AAED,UAAU,OAAO;IACf,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAED,aAAK,sBAAsB,GAAG,CAC5B,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,OAAO,EACjB,aAAa,CAAC,EAAE,MAAM,KACnB,OAAO,CAAC,mBAAmB,EAAE,GAAG,MAAM,CAAC,CAAA;AAuC5C,eAAO,MAAM,GAAG,EAAE,sBAQjB,CAAA"}
|
package/dist/index.js
CHANGED
@@ -134,12 +134,13 @@ const getData$1 = (search, options) => __awaiter(void 0, void 0, void 0, functio
|
|
134
134
|
}
|
135
135
|
});
|
136
136
|
let getDelayedData$1;
|
137
|
-
const get$2 = (search, options, debounceValue) => {
|
137
|
+
const get$2 = (search, options, debounceValue = 300) => {
|
138
138
|
clearTimeout(getDelayedData$1);
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
139
|
+
return new Promise((resolve, reject) => {
|
140
|
+
getDelayedData$1 = setTimeout(() => {
|
141
|
+
resolve(getData$1(search, options));
|
142
|
+
}, debounceValue);
|
143
|
+
});
|
143
144
|
};
|
144
145
|
|
145
146
|
var municipalitySearch = /*#__PURE__*/Object.freeze({
|
@@ -149,7 +150,7 @@ var municipalitySearch = /*#__PURE__*/Object.freeze({
|
|
149
150
|
});
|
150
151
|
|
151
152
|
const getData = (search, options) => __awaiter(void 0, void 0, void 0, function* () {
|
152
|
-
if (!search)
|
153
|
+
if (!search || search.length < 2)
|
153
154
|
return [];
|
154
155
|
try {
|
155
156
|
const { country = 'fr', limit = 5 } = options || {};
|
@@ -182,12 +183,13 @@ const getData = (search, options) => __awaiter(void 0, void 0, void 0, function*
|
|
182
183
|
}
|
183
184
|
});
|
184
185
|
let getDelayedData;
|
185
|
-
const get$1 = (search, options, debounceValue) => {
|
186
|
+
const get$1 = (search, options, debounceValue = 300) => {
|
186
187
|
clearTimeout(getDelayedData);
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
188
|
+
return new Promise((resolve, reject) => {
|
189
|
+
getDelayedData = setTimeout(() => {
|
190
|
+
resolve(getData(search, options));
|
191
|
+
}, debounceValue);
|
192
|
+
});
|
191
193
|
};
|
192
194
|
|
193
195
|
var addressSearch = /*#__PURE__*/Object.freeze({
|
package/dist/module.js
CHANGED
@@ -124,12 +124,13 @@ const getData$1 = (search, options) => __awaiter(void 0, void 0, void 0, functio
|
|
124
124
|
}
|
125
125
|
});
|
126
126
|
let getDelayedData$1;
|
127
|
-
const get$2 = (search, options, debounceValue) => {
|
127
|
+
const get$2 = (search, options, debounceValue = 300) => {
|
128
128
|
clearTimeout(getDelayedData$1);
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
129
|
+
return new Promise((resolve, reject) => {
|
130
|
+
getDelayedData$1 = setTimeout(() => {
|
131
|
+
resolve(getData$1(search, options));
|
132
|
+
}, debounceValue);
|
133
|
+
});
|
133
134
|
};
|
134
135
|
|
135
136
|
var municipalitySearch = /*#__PURE__*/Object.freeze({
|
@@ -139,7 +140,7 @@ var municipalitySearch = /*#__PURE__*/Object.freeze({
|
|
139
140
|
});
|
140
141
|
|
141
142
|
const getData = (search, options) => __awaiter(void 0, void 0, void 0, function* () {
|
142
|
-
if (!search)
|
143
|
+
if (!search || search.length < 2)
|
143
144
|
return [];
|
144
145
|
try {
|
145
146
|
const { country = 'fr', limit = 5 } = options || {};
|
@@ -172,12 +173,13 @@ const getData = (search, options) => __awaiter(void 0, void 0, void 0, function*
|
|
172
173
|
}
|
173
174
|
});
|
174
175
|
let getDelayedData;
|
175
|
-
const get$1 = (search, options, debounceValue) => {
|
176
|
+
const get$1 = (search, options, debounceValue = 300) => {
|
176
177
|
clearTimeout(getDelayedData);
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
178
|
+
return new Promise((resolve, reject) => {
|
179
|
+
getDelayedData = setTimeout(() => {
|
180
|
+
resolve(getData(search, options));
|
181
|
+
}, debounceValue);
|
182
|
+
});
|
181
183
|
};
|
182
184
|
|
183
185
|
var addressSearch = /*#__PURE__*/Object.freeze({
|
@@ -19,8 +19,9 @@ interface Options {
|
|
19
19
|
limit?: number;
|
20
20
|
departmentOnly?: boolean;
|
21
21
|
}
|
22
|
+
declare type DebouncedMunicipalitySearch = (search: string, options?: Options, debounceValue?: number) => Promise<MunicipalitySearchResult[] | string>;
|
22
23
|
declare type MunicipalitySearch = (search: string, options?: Options) => Promise<MunicipalitySearchResult[] | string>;
|
23
24
|
export declare const getData: MunicipalitySearch;
|
24
|
-
export declare const get:
|
25
|
+
export declare const get: DebouncedMunicipalitySearch;
|
25
26
|
export {};
|
26
27
|
//# sourceMappingURL=municipalitySearch.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"municipalitySearch.d.ts","sourceRoot":"","sources":["../src/municipalitySearch.ts"],"names":[],"mappings":"AAKA,UAAU,wBAAwB;IAChC,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,CAAA;QACf,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;CACF;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,CAAC,EAAE;QACZ,IAAI,EAAE,MAAM,CAAA;QACZ,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;IACD,YAAY,EAAE,MAAM,EAAE,CAAA;CACvB;AAED,UAAU,OAAO;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,aAAK,kBAAkB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,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