@frankieone/one-sdk 1.8.0 → 1.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/darwin-amd64/onesdk-cli +0 -0
- package/dist/cli/darwin-arm64/onesdk-cli +0 -0
- package/dist/cli/linux-amd64/onesdk-cli +0 -0
- package/dist/cli/linux-arm64/onesdk-cli +0 -0
- package/dist/cli/windows-amd64/onesdk-cli.exe +0 -0
- package/dist/commit.txt +1 -1
- package/dist/esm/modules/common/shared/models/F2/Individual.d.ts.map +1 -1
- package/dist/esm/modules/common/shared/models/F2/Individual.js +2 -2
- package/dist/esm/modules/common/shared/models/F2/Individual.js.map +1 -1
- package/dist/esm/modules/common/shared/models/F2/PhoneNumber.d.ts +4 -1
- package/dist/esm/modules/common/shared/models/F2/PhoneNumber.d.ts.map +1 -1
- package/dist/esm/modules/common/shared/models/F2/PhoneNumber.js +60 -4
- package/dist/esm/modules/common/shared/models/F2/PhoneNumber.js.map +1 -1
- package/dist/esm/modules/common/shared/utils/getCountryDetails.d.ts +1 -0
- package/dist/esm/modules/common/shared/utils/getCountryDetails.d.ts.map +1 -1
- package/dist/esm/modules/common/shared/utils/getCountryDetails.js +4 -0
- package/dist/esm/modules/common/shared/utils/getCountryDetails.js.map +1 -1
- package/dist/esm/modules/common/vendors/incode/startCamera.d.ts.map +1 -1
- package/dist/esm/modules/common/vendors/incode/startCamera.js +23 -16
- package/dist/esm/modules/common/vendors/incode/startCamera.js.map +1 -1
- package/dist/esm/modules/form/definition.d.ts +1 -0
- package/dist/esm/modules/form/definition.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/App.d.ts +2 -1
- package/dist/esm/modules/form/vendors/react/App.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/App.js +2 -1
- package/dist/esm/modules/form/vendors/react/App.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/components/base/StandardDate/StandardDate.js +1 -1
- package/dist/esm/modules/form/vendors/react/components/base/StandardDate/StandardDate.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/components/view/FrankieAddress/FrankieAddress.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/components/view/FrankieAddress/FrankieAddress.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/components/view/SearchableAddress/SearchableAddress.d.ts +1 -1
- package/dist/esm/modules/form/vendors/react/components/view/SearchableAddress/SearchableAddress.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/components/view/SearchableAddress/SearchableAddress.js +12 -2
- package/dist/esm/modules/form/vendors/react/components/view/SearchableAddress/SearchableAddress.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/IdSelection/manualIdSelection.config.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/IdSelection/manualIdSelection.config.js +3 -1
- package/dist/esm/modules/form/vendors/react/features/IdSelection/manualIdSelection.config.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/fields/passport.config.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/features/Review/fields/passport.config.js +3 -1
- package/dist/esm/modules/form/vendors/react/features/Review/fields/passport.config.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/hooks/useAddressSearch.d.ts +9 -4
- package/dist/esm/modules/form/vendors/react/hooks/useAddressSearch.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/hooks/useAddressSearch.js +29 -78
- package/dist/esm/modules/form/vendors/react/hooks/useAddressSearch.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/hooks/useEventContext.d.ts +1 -0
- package/dist/esm/modules/form/vendors/react/hooks/useEventContext.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/hooks/useEventContext.js.map +1 -1
- package/dist/esm/modules/form/vendors/react/index.d.ts.map +1 -1
- package/dist/esm/modules/form/vendors/react/index.js +8 -5
- package/dist/esm/modules/form/vendors/react/index.js.map +1 -1
- package/dist/esm/modules/frankie-client/FrankieApiClient.d.ts +1 -1
- package/dist/esm/modules/frankie-client/FrankieApiClient.d.ts.map +1 -1
- package/dist/esm/modules/frankie-client/FrankieApiClient.js +12 -0
- package/dist/esm/modules/frankie-client/FrankieApiClient.js.map +1 -1
- package/dist/esm/modules/individual/F2/actions/submit.d.ts +2 -2
- package/dist/esm/modules/individual/F2/actions/submit.d.ts.map +1 -1
- package/dist/esm/modules/individual/F2/actions/submit.js +2 -2
- package/dist/esm/modules/individual/F2/actions/submit.js.map +1 -1
- package/dist/esm/modules/individual/actions/submit.d.ts +2 -1
- package/dist/esm/modules/individual/actions/submit.d.ts.map +1 -1
- package/dist/esm/modules/individual/actions/submit.js +8 -11
- package/dist/esm/modules/individual/actions/submit.js.map +1 -1
- package/dist/esm/modules/individual/definition.d.ts +1 -1
- package/dist/esm/modules/individual/definition.d.ts.map +1 -1
- package/dist/esm/modules/meta.json +1 -1
- package/dist/esm/modules/services/google/address.const.d.ts +20 -0
- package/dist/esm/modules/services/google/address.const.d.ts.map +1 -0
- package/dist/esm/modules/services/google/address.const.js +21 -0
- package/dist/esm/modules/services/google/address.const.js.map +1 -0
- package/dist/esm/modules/services/google/autocomplete.service.d.ts +14 -0
- package/dist/esm/modules/services/google/autocomplete.service.d.ts.map +1 -0
- package/dist/esm/modules/services/google/autocomplete.service.js +43 -0
- package/dist/esm/modules/services/google/autocomplete.service.js.map +1 -0
- package/dist/esm/modules/services/google/autocompleteSuggestion.service.d.ts +13 -0
- package/dist/esm/modules/services/google/autocompleteSuggestion.service.d.ts.map +1 -0
- package/dist/esm/modules/services/google/autocompleteSuggestion.service.js +40 -0
- package/dist/esm/modules/services/google/autocompleteSuggestion.service.js.map +1 -0
- package/dist/esm/modules/services/google/geocode.service.d.ts +16 -0
- package/dist/esm/modules/services/google/geocode.service.d.ts.map +1 -0
- package/dist/esm/modules/services/google/geocode.service.js +73 -0
- package/dist/esm/modules/services/google/geocode.service.js.map +1 -0
- package/dist/esm/modules/{form/vendors/react/model → services/google}/googleAddress.model.d.ts +4 -2
- package/dist/esm/modules/services/google/googleAddress.model.d.ts.map +1 -0
- package/dist/esm/modules/services/google/googleAddress.model.js +110 -0
- package/dist/esm/modules/services/google/googleAddress.model.js.map +1 -0
- package/dist/esm/modules/services/google/googleService.types.d.ts +81 -0
- package/dist/esm/modules/services/google/googleService.types.d.ts.map +1 -0
- package/dist/esm/modules/services/google/googleService.types.js +2 -0
- package/dist/esm/modules/services/google/googleService.types.js.map +1 -0
- package/dist/esm/modules/services/google/utils.d.ts +2 -0
- package/dist/esm/modules/services/google/utils.d.ts.map +1 -0
- package/dist/esm/modules/services/google/utils.js +29 -0
- package/dist/esm/modules/services/google/utils.js.map +1 -0
- package/package.json +1 -1
- package/dist/esm/modules/form/vendors/react/constants/address.const.d.ts +0 -14
- package/dist/esm/modules/form/vendors/react/constants/address.const.d.ts.map +0 -1
- package/dist/esm/modules/form/vendors/react/constants/address.const.js +0 -15
- package/dist/esm/modules/form/vendors/react/constants/address.const.js.map +0 -1
- package/dist/esm/modules/form/vendors/react/model/googleAddress.model.d.ts.map +0 -1
- package/dist/esm/modules/form/vendors/react/model/googleAddress.model.js +0 -63
- package/dist/esm/modules/form/vendors/react/model/googleAddress.model.js.map +0 -1
|
@@ -7,14 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axios from 'axios';
|
|
11
10
|
import { ReactiveStore } from '../../common/index.js';
|
|
12
11
|
import { OneSDKError } from '../../common/index.js';
|
|
13
12
|
const THROW_ERROR_WHEN_MISSING_CONSENTS = false;
|
|
14
13
|
export const mkSubmit = (deps) => {
|
|
15
14
|
const submitMethod = (o) => __awaiter(void 0, void 0, void 0, function* () {
|
|
16
|
-
var _a, _b, _c, _d;
|
|
17
|
-
var
|
|
15
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
16
|
+
var _h, _j;
|
|
18
17
|
const { eventHub, client, globalEventHub, state$ } = deps;
|
|
19
18
|
const documents$ = state$.getRootAccessors('documents');
|
|
20
19
|
const applicant$ = state$.getRootAccessors('applicant');
|
|
@@ -36,8 +35,8 @@ export const mkSubmit = (deps) => {
|
|
|
36
35
|
const documents = documents$.getValue();
|
|
37
36
|
const device = device$.getValue();
|
|
38
37
|
// A value for givenName and familyname is required when submitting an applicant
|
|
39
|
-
(_a = (
|
|
40
|
-
(_b = (
|
|
38
|
+
(_a = (_h = applicant.name).givenName) !== null && _a !== void 0 ? _a : (_h.givenName = '');
|
|
39
|
+
(_b = (_j = applicant.name).familyName) !== null && _b !== void 0 ? _b : (_j.familyName = '');
|
|
41
40
|
// Bind extracted method above to the client object and then call it
|
|
42
41
|
// Either action will result in an entityId
|
|
43
42
|
// If creating new applicant, store recently found entity Id
|
|
@@ -67,12 +66,10 @@ export const mkSubmit = (deps) => {
|
|
|
67
66
|
eventName,
|
|
68
67
|
data: hasEntityId ? {} : { createdEntityId: entityId },
|
|
69
68
|
});
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
70
|
}
|
|
71
71
|
catch (error) {
|
|
72
|
-
eventHub.emit('error',
|
|
73
|
-
? new OneSDKError((_c = error.response.data
|
|
74
|
-
.message) !== null && _c !== void 0 ? _c : error.message, (_d = error.response) === null || _d === void 0 ? void 0 : _d.data)
|
|
75
|
-
: new OneSDKError(error.message, error));
|
|
72
|
+
eventHub.emit('error', new OneSDKError((_e = (_d = (_c = error.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.message) !== null && _e !== void 0 ? _e : error.message, (_g = (_f = error.response) === null || _f === void 0 ? void 0 : _f.data) !== null && _g !== void 0 ? _g : error));
|
|
76
73
|
throw error;
|
|
77
74
|
}
|
|
78
75
|
finally {
|
|
@@ -87,13 +84,13 @@ export const mkRunChecks = (deps) => __awaiter(void 0, void 0, void 0, function*
|
|
|
87
84
|
const device = device$.getValue();
|
|
88
85
|
const isLoading$ = state$.getRootAccessors('isLoading');
|
|
89
86
|
try {
|
|
90
|
-
const
|
|
87
|
+
const checkSummary = yield client.triggerChecks({
|
|
91
88
|
deviceCheckDetails: device,
|
|
92
89
|
});
|
|
93
90
|
globalEventHub.emit('telemetry', {
|
|
94
91
|
eventName: 'RUN_CHECKS',
|
|
95
92
|
});
|
|
96
|
-
return
|
|
93
|
+
return checkSummary;
|
|
97
94
|
}
|
|
98
95
|
catch (error) {
|
|
99
96
|
const err = new OneSDKError(error.message, error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit.js","sourceRoot":"","sources":["../../../../../modules/individual/actions/submit.ts"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"submit.js","sourceRoot":"","sources":["../../../../../modules/individual/actions/submit.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAQ7C,MAAM,iCAAiC,GAAG,KAAK,CAAC;AAQhD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAkB,EAAE,EAAE;IAC7C,MAAM,YAAY,GAAG,CAAO,CAE3B,EAAgC,EAAE;;;QACjC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QAC1D,MAAM,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QACxD,MAAM,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QACxD,MAAM,OAAO,GAAG,MAAM,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAClD,MAAM,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC;QACxD,MAAM,YAAY,GAAG,MAAM,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;QAE5D,MAAM,SAAS,GAAG,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;IAC9I,yHAAyH;IACzH,IAAI,iBAAiB,IAAI,iCAAiC,EAAE,CAAC;QAC3D,MAAM,IAAI,WAAW,CAAC,YAAY,EAAE;YAClC,IAAI,EAAE,WAAW;SAClB,CAAC,CAAC;IACL,CAAC;SAAM,IAAI,iBAAiB,EAAE,CAAC;QAC7B,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE;YACvB,OAAO,EAAE,YAAY,GAAG,0BAA0B;YAClD,OAAO,EAAE;gBACP,IAAI,EAAE,WAAW;aAClB;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -57,7 +57,7 @@ export type IndividualModuleContext = {
|
|
|
57
57
|
access: AccessFunction<PublicAccessors>;
|
|
58
58
|
/** Trigger another search for any existing data for this entity within the service. ! ATTENTION: This will cause a rewrite of any unpersisted information. */
|
|
59
59
|
search: () => Promise<void>;
|
|
60
|
-
runChecks: () => Promise<
|
|
60
|
+
runChecks: () => Promise<CheckSummary>;
|
|
61
61
|
setExtraData: (data: object) => void;
|
|
62
62
|
/** @deprecated This field is temporary and should not be used. only for form-io */
|
|
63
63
|
formIOUpdateDocument: (id: string, details: Document) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../../../modules/individual/definition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAA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,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,SAAS,EAAE,OAAO,EAAE,CAAC;IACrB,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC9B,WAAW,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IACtC,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC1B,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IAClC,MAAM,EAAE,kBAAkB,CAAC;IAE3B,iEAAiE;IACjE,sBAAsB,EAAE,SAAS,CAAC;IAClC,iEAAiE;IACjE,sBAAsB,EAAE,QAAQ,EAAE,CAAC;IAEnC,+HAA+H;IAC/H,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;CAC/B,CAAC,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;CACtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{ "version": "1.8.
|
|
1
|
+
{ "version": "1.8.2" }
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* docs: https://developers.google.com/maps/documentation/javascript/geocoding#GeocodingAddressTypes
|
|
3
|
+
*/
|
|
4
|
+
export declare enum GOOGLE_ADDRESS_INFO_ENUM {
|
|
5
|
+
PREMISE = "premise",
|
|
6
|
+
FLOOR = "floor",
|
|
7
|
+
SUBLOCALITY_LEVEL_1 = "sublocality_level_1",
|
|
8
|
+
ROUTE = "route",
|
|
9
|
+
STREET_ADDRESS = "street_address",
|
|
10
|
+
LOCALITY = "locality",
|
|
11
|
+
ADMINISTRATIVE_AREA_LEVEL_1 = "administrative_area_level_1",
|
|
12
|
+
ADMINISTRATIVE_AREA_LEVEL_2 = "administrative_area_level_2",
|
|
13
|
+
ADMINISTRATIVE_AREA_LEVEL_3 = "administrative_area_level_3",
|
|
14
|
+
ADMINISTRATIVE_AREA_LEVEL_4 = "administrative_area_level_4",
|
|
15
|
+
COUNTRY = "country",
|
|
16
|
+
POSTAL_CODE = "postal_code",
|
|
17
|
+
STREET_NUMBER = "street_number",
|
|
18
|
+
SUB_PREMISE = "subpremise"
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=address.const.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.const.d.ts","sourceRoot":"","sources":["../../../../../modules/services/google/address.const.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,wBAAwB;IAClC,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,mBAAmB,wBAAwB;IAC3C,KAAK,UAAU;IACf,cAAc,mBAAmB;IACjC,QAAQ,aAAa;IACrB,2BAA2B,gCAAgC;IAC3D,2BAA2B,gCAAgC;IAC3D,2BAA2B,gCAAgC;IAC3D,2BAA2B,gCAAgC;IAC3D,OAAO,YAAY;IACnB,WAAW,gBAAgB;IAC3B,aAAa,kBAAkB;IAC/B,WAAW,eAAe;CAC3B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* docs: https://developers.google.com/maps/documentation/javascript/geocoding#GeocodingAddressTypes
|
|
3
|
+
*/
|
|
4
|
+
export var GOOGLE_ADDRESS_INFO_ENUM;
|
|
5
|
+
(function (GOOGLE_ADDRESS_INFO_ENUM) {
|
|
6
|
+
GOOGLE_ADDRESS_INFO_ENUM["PREMISE"] = "premise";
|
|
7
|
+
GOOGLE_ADDRESS_INFO_ENUM["FLOOR"] = "floor";
|
|
8
|
+
GOOGLE_ADDRESS_INFO_ENUM["SUBLOCALITY_LEVEL_1"] = "sublocality_level_1";
|
|
9
|
+
GOOGLE_ADDRESS_INFO_ENUM["ROUTE"] = "route";
|
|
10
|
+
GOOGLE_ADDRESS_INFO_ENUM["STREET_ADDRESS"] = "street_address";
|
|
11
|
+
GOOGLE_ADDRESS_INFO_ENUM["LOCALITY"] = "locality";
|
|
12
|
+
GOOGLE_ADDRESS_INFO_ENUM["ADMINISTRATIVE_AREA_LEVEL_1"] = "administrative_area_level_1";
|
|
13
|
+
GOOGLE_ADDRESS_INFO_ENUM["ADMINISTRATIVE_AREA_LEVEL_2"] = "administrative_area_level_2";
|
|
14
|
+
GOOGLE_ADDRESS_INFO_ENUM["ADMINISTRATIVE_AREA_LEVEL_3"] = "administrative_area_level_3";
|
|
15
|
+
GOOGLE_ADDRESS_INFO_ENUM["ADMINISTRATIVE_AREA_LEVEL_4"] = "administrative_area_level_4";
|
|
16
|
+
GOOGLE_ADDRESS_INFO_ENUM["COUNTRY"] = "country";
|
|
17
|
+
GOOGLE_ADDRESS_INFO_ENUM["POSTAL_CODE"] = "postal_code";
|
|
18
|
+
GOOGLE_ADDRESS_INFO_ENUM["STREET_NUMBER"] = "street_number";
|
|
19
|
+
GOOGLE_ADDRESS_INFO_ENUM["SUB_PREMISE"] = "subpremise";
|
|
20
|
+
})(GOOGLE_ADDRESS_INFO_ENUM || (GOOGLE_ADDRESS_INFO_ENUM = {}));
|
|
21
|
+
//# sourceMappingURL=address.const.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address.const.js","sourceRoot":"","sources":["../../../../../modules/services/google/address.const.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,wBAeX;AAfD,WAAY,wBAAwB;IAClC,+CAAmB,CAAA;IACnB,2CAAe,CAAA;IACf,uEAA2C,CAAA;IAC3C,2CAAe,CAAA;IACf,6DAAiC,CAAA;IACjC,iDAAqB,CAAA;IACrB,uFAA2D,CAAA;IAC3D,uFAA2D,CAAA;IAC3D,uFAA2D,CAAA;IAC3D,uFAA2D,CAAA;IAC3D,+CAAmB,CAAA;IACnB,uDAA2B,CAAA;IAC3B,2DAA+B,CAAA;IAC/B,sDAA0B,CAAA;AAC5B,CAAC,EAfW,wBAAwB,KAAxB,wBAAwB,QAenC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Address } from '../../common/shared/models/Address';
|
|
2
|
+
import type { GoogleSearchAddress } from './googleAddress.model';
|
|
3
|
+
interface Props {
|
|
4
|
+
text: string;
|
|
5
|
+
countries: string[] | undefined;
|
|
6
|
+
requiredComponents: (keyof Address)[];
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated use `googlePlaceAutocompleteSuggestionService` instead
|
|
10
|
+
* Google Place Autocomplete Service.
|
|
11
|
+
*/
|
|
12
|
+
export declare const googlePlaceAutocompleteService: ({ text, countries, requiredComponents, }: Props) => Promise<GoogleSearchAddress[]>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=autocomplete.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocomplete.service.d.ts","sourceRoot":"","sources":["../../../../../modules/services/google/autocomplete.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAIpE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAKjE,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAChC,kBAAkB,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,CAAC;CACvC;AAED;;;GAGG;AACH,eAAO,MAAM,8BAA8B,6CAIxC,KAAK,KAAG,OAAO,CAAC,mBAAmB,EAAE,CAkCvC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { getFullAddressDeprecated } from './geocode.service.js';
|
|
11
|
+
/**
|
|
12
|
+
* @deprecated use `googlePlaceAutocompleteSuggestionService` instead
|
|
13
|
+
* Google Place Autocomplete Service.
|
|
14
|
+
*/
|
|
15
|
+
export const googlePlaceAutocompleteService = (_a) => __awaiter(void 0, [_a], void 0, function* ({ text, countries = [], requiredComponents = [], }) {
|
|
16
|
+
return new Promise((resolve) => {
|
|
17
|
+
let addressList = [];
|
|
18
|
+
if (text) {
|
|
19
|
+
const placeServiceRequest = {
|
|
20
|
+
input: text,
|
|
21
|
+
// REMARKS: restriction based on country
|
|
22
|
+
componentRestrictions: { country: countries },
|
|
23
|
+
};
|
|
24
|
+
const service = new google.maps.places.AutocompleteService();
|
|
25
|
+
service.getPlacePredictions(placeServiceRequest, (predictions, status) => {
|
|
26
|
+
if (status == google.maps.places.PlacesServiceStatus.OK) {
|
|
27
|
+
addressList = predictions.map((item) => ({
|
|
28
|
+
label: item.description,
|
|
29
|
+
value: item.place_id,
|
|
30
|
+
}));
|
|
31
|
+
}
|
|
32
|
+
getFullAddressDeprecated(addressList).then((dataList) => {
|
|
33
|
+
const filteredDataList = dataList.filter((item) => !requiredComponents.some((component) => !item[component]));
|
|
34
|
+
resolve(filteredDataList);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
resolve(addressList);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=autocomplete.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocomplete.service.js","sourceRoot":"","sources":["../../../../../modules/services/google/autocomplete.service.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAa7D;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,KAIJ,EAAE,4CAJS,EACnD,IAAI,EACJ,SAAS,GAAG,EAAE,EACd,kBAAkB,GAAG,EAAE,GACjB;IACN,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,IAAI,WAAW,GAA0B,EAAE,CAAC;QAC5C,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,mBAAmB,GAAG;gBAC1B,KAAK,EAAE,IAAI;gBACX,wCAAwC;gBACxC,qBAAqB,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;aAC9C,CAAC;YACF,MAAM,OAAO,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC;YAE7D,OAAO,CAAC,mBAAmB,CACzB,mBAAmB,EACnB,CAAC,WAAW,EAAE,MAAc,EAAE,EAAE;gBAC9B,IAAI,MAAM,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,EAAE,CAAC;oBACxD,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;wBACvC,KAAK,EAAE,IAAI,CAAC,WAAW;wBACvB,KAAK,EAAE,IAAI,CAAC,QAAQ;qBACrB,CAAC,CAA0B,CAAC;gBAC/B,CAAC;gBACD,wBAAwB,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;oBACtD,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CACtC,CAAC,IAAI,EAAE,EAAE,CACP,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAC5D,CAAC;oBAEF,OAAO,CAAC,gBAAgB,CAAC,CAAC;gBAC5B,CAAC,CAAC,CAAC;YACL,CAAC,CACF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,WAAW,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAA,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Address } from '../../common/shared/models/Address';
|
|
2
|
+
interface Props {
|
|
3
|
+
text: string;
|
|
4
|
+
countries: string[] | undefined;
|
|
5
|
+
requiredComponents: (keyof Address)[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Google Place Autocomplete Suggestion Service.
|
|
9
|
+
* Use this as the replacement for `googlePlaceAutocompleteService`
|
|
10
|
+
*/
|
|
11
|
+
export declare const googlePlaceAutocompleteSuggestionService: ({ text, countries, requiredComponents, }: Props) => Promise<import("./googleAddress.model").GoogleSearchAddress[]>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=autocompleteSuggestion.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocompleteSuggestion.service.d.ts","sourceRoot":"","sources":["../../../../../modules/services/google/autocompleteSuggestion.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AASpE,UAAU,KAAK;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAChC,kBAAkB,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,CAAC;CACvC;AAED;;;GAGG;AACH,eAAO,MAAM,wCAAwC,6CAIlD,KAAK,mEAkCP,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { getCountryAlpha2Code } from '../../common/shared/utils/index.js';
|
|
11
|
+
import { getFullAddress } from './geocode.service.js';
|
|
12
|
+
/**
|
|
13
|
+
* Google Place Autocomplete Suggestion Service.
|
|
14
|
+
* Use this as the replacement for `googlePlaceAutocompleteService`
|
|
15
|
+
*/
|
|
16
|
+
export const googlePlaceAutocompleteSuggestionService = (_a) => __awaiter(void 0, [_a], void 0, function* ({ text, countries = [], requiredComponents = [], }) {
|
|
17
|
+
if (!text || text.trim().length === 0) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const includedRegionCodes = countries
|
|
22
|
+
.map((code) => getCountryAlpha2Code(code))
|
|
23
|
+
.filter((code) => code !== undefined);
|
|
24
|
+
const { suggestions } = yield google.maps.places.AutocompleteSuggestion.fetchAutocompleteSuggestions({
|
|
25
|
+
input: text,
|
|
26
|
+
includedRegionCodes,
|
|
27
|
+
});
|
|
28
|
+
const placeIds = suggestions.map((suggestion) => { var _a, _b; return (_b = (_a = suggestion.placePrediction) === null || _a === void 0 ? void 0 : _a.placeId) !== null && _b !== void 0 ? _b : ''; });
|
|
29
|
+
const fullAddresses = yield getFullAddress(placeIds);
|
|
30
|
+
const filteredDataList = fullAddresses.filter((item) => {
|
|
31
|
+
const isRequiredComponentExists = !requiredComponents.some((component) => !item[component]);
|
|
32
|
+
return item.isVisible() && isRequiredComponentExists;
|
|
33
|
+
});
|
|
34
|
+
return filteredDataList;
|
|
35
|
+
}
|
|
36
|
+
catch (_b) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=autocompleteSuggestion.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autocompleteSuggestion.service.js","sourceRoot":"","sources":["../../../../../modules/services/google/autocompleteSuggestion.service.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAYnD;;;GAGG;AACH,MAAM,CAAC,MAAM,wCAAwC,GAAG,KAI9C,EAAE,4CAJmD,EAC7D,IAAI,EACJ,SAAS,GAAG,EAAE,EACd,kBAAkB,GAAG,EAAE,GACjB;IACN,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,CAAC;QACH,MAAM,mBAAmB,GAAG,SAAS;aAClC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;aACzC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC;QAExC,MAAM,EAAE,WAAW,EAAE,GACnB,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC,4BAA4B,CAC1E;YACE,KAAK,EAAE,IAAI;YACX,mBAAmB;SACpB,CACF,CAAC;QAEJ,MAAM,QAAQ,GAAa,WAAW,CAAC,GAAG,CACxC,CAAC,UAAU,EAAE,EAAE,eAAC,OAAA,MAAA,MAAA,UAAU,CAAC,eAAe,0CAAE,OAAO,mCAAI,EAAE,CAAA,EAAA,CAC1D,CAAC;QAEF,MAAM,aAAa,GAAG,MAAM,cAAc,CAAC,QAAQ,CAAC,CAAC;QACrD,MAAM,gBAAgB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;YACrD,MAAM,yBAAyB,GAAG,CAAC,kBAAkB,CAAC,IAAI,CACxD,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAChC,CAAC;YACF,OAAO,IAAI,CAAC,SAAS,EAAE,IAAI,yBAAyB,CAAC;QACvD,CAAC,CAAC,CAAC;QAEH,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IAAC,WAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC,CAAA,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { FrankieSelectOptions } from '../../form/vendors/react/types/form';
|
|
2
|
+
import { GoogleSearchAddress } from './googleAddress.model';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @deprecated use `getFullAddress` instead
|
|
6
|
+
* @param placesInfo have the all information about the place, placeId, name
|
|
7
|
+
* @returns formated Address with, OptionsTypes & it have AddressInfomation, country, fullAddrss, state etc of list
|
|
8
|
+
*/
|
|
9
|
+
export declare const getFullAddressDeprecated: (placesInfo: FrankieSelectOptions[]) => Promise<GoogleSearchAddress[]>;
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param placeIds list of placeIds
|
|
13
|
+
* @returns formated Address with, OptionsTypes & it have AddressInfomation, country, fullAddrss, state etc of list
|
|
14
|
+
*/
|
|
15
|
+
export declare const getFullAddress: (placeIds: string[]) => Promise<GoogleSearchAddress[]>;
|
|
16
|
+
//# sourceMappingURL=geocode.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geocode.service.d.ts","sourceRoot":"","sources":["../../../../../modules/services/google/geocode.service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAElF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,eACvB,oBAAoB,EAAE,mCAgCnC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,aAAc,MAAM,EAAE,mCAoChD,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { GoogleSearchAddress } from './googleAddress.model.js';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @deprecated use `getFullAddress` instead
|
|
5
|
+
* @param placesInfo have the all information about the place, placeId, name
|
|
6
|
+
* @returns formated Address with, OptionsTypes & it have AddressInfomation, country, fullAddrss, state etc of list
|
|
7
|
+
*/
|
|
8
|
+
export const getFullAddressDeprecated = (placesInfo) => {
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
const geocoder = new google.maps.Geocoder();
|
|
11
|
+
const addressPromises = [];
|
|
12
|
+
placesInfo.forEach((place) => {
|
|
13
|
+
const geocodeRequest = {
|
|
14
|
+
placeId: place.value,
|
|
15
|
+
};
|
|
16
|
+
const promise = new Promise((resolve, reject) => {
|
|
17
|
+
geocoder.geocode(geocodeRequest, (results, status) => {
|
|
18
|
+
if (status === google.maps.GeocoderStatus.OK) {
|
|
19
|
+
const googleSearchData = new GoogleSearchAddress(results[0]);
|
|
20
|
+
googleSearchData['label'] = googleSearchData.fullAddress;
|
|
21
|
+
googleSearchData['value'] = place.value;
|
|
22
|
+
resolve(googleSearchData);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
reject(new Error('Geocode request failed'));
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
addressPromises.push(promise);
|
|
30
|
+
});
|
|
31
|
+
Promise.all(addressPromises)
|
|
32
|
+
.then((addresses) => resolve(addresses))
|
|
33
|
+
.catch((error) => reject(error));
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
*
|
|
38
|
+
* @param placeIds list of placeIds
|
|
39
|
+
* @returns formated Address with, OptionsTypes & it have AddressInfomation, country, fullAddrss, state etc of list
|
|
40
|
+
*/
|
|
41
|
+
export const getFullAddress = (placeIds) => {
|
|
42
|
+
return new Promise((resolve, reject) => {
|
|
43
|
+
const geocoder = new google.maps.Geocoder();
|
|
44
|
+
const addressPromises = [];
|
|
45
|
+
placeIds.forEach((placeId) => {
|
|
46
|
+
const geocodeRequest = {
|
|
47
|
+
placeId,
|
|
48
|
+
};
|
|
49
|
+
const promise = new Promise((resolve, reject) => {
|
|
50
|
+
geocoder.geocode(geocodeRequest, (results, status) => {
|
|
51
|
+
if (status === google.maps.GeocoderStatus.OK) {
|
|
52
|
+
const googleSearchData = new GoogleSearchAddress(results[0]);
|
|
53
|
+
if (!googleSearchData.isVisible()) {
|
|
54
|
+
resolve(new GoogleSearchAddress(null));
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
googleSearchData['label'] = googleSearchData.formattedAddress();
|
|
58
|
+
googleSearchData['value'] = placeId;
|
|
59
|
+
resolve(googleSearchData);
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
reject(new Error('Geocode request failed'));
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
addressPromises.push(promise);
|
|
67
|
+
});
|
|
68
|
+
Promise.all(addressPromises)
|
|
69
|
+
.then((addresses) => resolve(addresses))
|
|
70
|
+
.catch((error) => reject(error));
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=geocode.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geocode.service.js","sourceRoot":"","sources":["../../../../../modules/services/google/geocode.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,UAAkC,EAClC,EAAE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O,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;aACzB,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;aACvC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/dist/esm/modules/{form/vendors/react/model → services/google}/googleAddress.model.d.ts
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address } from '
|
|
1
|
+
import { Address } from '../../common/shared/models/Address';
|
|
2
2
|
export interface GoogleSearchAddressDetails {
|
|
3
3
|
address_components: {
|
|
4
4
|
long_name: string;
|
|
@@ -36,6 +36,8 @@ export declare class GoogleSearchAddress extends Address {
|
|
|
36
36
|
streetAddress: string;
|
|
37
37
|
label: string;
|
|
38
38
|
value: string;
|
|
39
|
-
constructor(result: google.maps.GeocoderResult);
|
|
39
|
+
constructor(result: google.maps.GeocoderResult | null, newPlaceService?: boolean);
|
|
40
|
+
isVisible(): boolean;
|
|
41
|
+
formattedAddress(): string;
|
|
40
42
|
}
|
|
41
43
|
//# sourceMappingURL=googleAddress.model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"googleAddress.model.d.ts","sourceRoot":"","sources":["../../../../../modules/services/google/googleAddress.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAK/D,MAAM,WAAW,0BAA0B;IACzC,kBAAkB,EAAE;QAClB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM,EAAE,CAAC;KACjB,EAAE,CAAC;IACJ,iBAAiB,EAAE,MAAM,CAAC;IAC1B,QAAQ,EAAE;QACR,QAAQ,EAAE;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;QACvC,aAAa,EAAE,MAAM,CAAC;QACtB,QAAQ,EAAE;YACR,SAAS,EAAE;gBAAE,GAAG,EAAE,MAAM,CAAC;gBAAC,GAAG,EAAE,MAAM,CAAA;aAAE,CAAC;YACxC,SAAS,EAAE;gBAAE,GAAG,EAAE,MAAM,CAAC;gBAAC,GAAG,EAAE,MAAM,CAAA;aAAE,CAAC;SACzC,CAAC;KACH,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE;QACT,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,qBAAa,mBAAoB,SAAQ,OAAO;IAC9C,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;gBAEZ,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,cAAc,GAAG,IAAI,EACzC,eAAe,GAAE,OAAe;IAiFlC,SAAS,IAAI,OAAO;IASpB,gBAAgB,IAAI,MAAM;CAa3B"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { Address } from '../../common/shared/models/Address.js';
|
|
2
|
+
import { alpha2ToAlpha3 } from '../../form/vendors/formio/transformers/countryData.js';
|
|
3
|
+
import { GOOGLE_ADDRESS_INFO_ENUM } from './address.const.js';
|
|
4
|
+
export class GoogleSearchAddress extends Address {
|
|
5
|
+
constructor(result, newPlaceService = false) {
|
|
6
|
+
var _a, _b, _c;
|
|
7
|
+
super();
|
|
8
|
+
Object.defineProperty(this, "fullAddress", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
configurable: true,
|
|
11
|
+
writable: true,
|
|
12
|
+
value: void 0
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(this, "streetAddress", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true,
|
|
18
|
+
value: void 0
|
|
19
|
+
});
|
|
20
|
+
Object.defineProperty(this, "label", {
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true,
|
|
24
|
+
value: void 0
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(this, "value", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true,
|
|
30
|
+
value: void 0
|
|
31
|
+
});
|
|
32
|
+
if (!result) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const addressComponents = result.address_components;
|
|
36
|
+
const getAddressComponent = (type) => {
|
|
37
|
+
const shortNamesList = [
|
|
38
|
+
GOOGLE_ADDRESS_INFO_ENUM.COUNTRY,
|
|
39
|
+
GOOGLE_ADDRESS_INFO_ENUM.ADMINISTRATIVE_AREA_LEVEL_1,
|
|
40
|
+
];
|
|
41
|
+
const component = addressComponents.find((c) => c.types.includes(type));
|
|
42
|
+
return component
|
|
43
|
+
? component[shortNamesList.includes(type) ? 'short_name' : 'long_name']
|
|
44
|
+
: null;
|
|
45
|
+
};
|
|
46
|
+
const getAddressComponentWithMultipleCriteria = (criteriaList) => {
|
|
47
|
+
let result = null;
|
|
48
|
+
for (const criteria of criteriaList) {
|
|
49
|
+
if (!result || result.trim().length === 0) {
|
|
50
|
+
result = getAddressComponent(criteria);
|
|
51
|
+
}
|
|
52
|
+
if (result && result.trim().length > 0) {
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return null;
|
|
57
|
+
};
|
|
58
|
+
this.fullAddress = result.formatted_address;
|
|
59
|
+
this.buildingName = getAddressComponent(GOOGLE_ADDRESS_INFO_ENUM.PREMISE);
|
|
60
|
+
this.state = getAddressComponent(GOOGLE_ADDRESS_INFO_ENUM.ADMINISTRATIVE_AREA_LEVEL_1);
|
|
61
|
+
this.streetNumber = getAddressComponent(GOOGLE_ADDRESS_INFO_ENUM.STREET_NUMBER);
|
|
62
|
+
// TODO: if it required for mapping streetType then get it from the address_components
|
|
63
|
+
// this.streetType = getAddressComponent(ADDRESS_INFO_ENUM.ROUTE);
|
|
64
|
+
if (newPlaceService) {
|
|
65
|
+
this.suburb = getAddressComponentWithMultipleCriteria([
|
|
66
|
+
GOOGLE_ADDRESS_INFO_ENUM.SUBLOCALITY_LEVEL_1,
|
|
67
|
+
GOOGLE_ADDRESS_INFO_ENUM.ADMINISTRATIVE_AREA_LEVEL_3,
|
|
68
|
+
GOOGLE_ADDRESS_INFO_ENUM.ADMINISTRATIVE_AREA_LEVEL_4,
|
|
69
|
+
]);
|
|
70
|
+
this.town = getAddressComponentWithMultipleCriteria([
|
|
71
|
+
GOOGLE_ADDRESS_INFO_ENUM.LOCALITY,
|
|
72
|
+
GOOGLE_ADDRESS_INFO_ENUM.ADMINISTRATIVE_AREA_LEVEL_2,
|
|
73
|
+
]);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
this.suburb = getAddressComponent(GOOGLE_ADDRESS_INFO_ENUM.SUBLOCALITY_LEVEL_1);
|
|
77
|
+
this.town = getAddressComponent(GOOGLE_ADDRESS_INFO_ENUM.LOCALITY);
|
|
78
|
+
}
|
|
79
|
+
(this.country = getAddressComponent(GOOGLE_ADDRESS_INFO_ENUM.COUNTRY)),
|
|
80
|
+
(this.postalCode = getAddressComponent(GOOGLE_ADDRESS_INFO_ENUM.POSTAL_CODE));
|
|
81
|
+
this._streetName =
|
|
82
|
+
getAddressComponent(GOOGLE_ADDRESS_INFO_ENUM.ROUTE) ||
|
|
83
|
+
getAddressComponent(GOOGLE_ADDRESS_INFO_ENUM.STREET_ADDRESS);
|
|
84
|
+
this.streetAddress =
|
|
85
|
+
`${(_a = this.streetNumber) !== null && _a !== void 0 ? _a : ''} ${(_b = this._streetName) !== null && _b !== void 0 ? _b : ''}`.trim();
|
|
86
|
+
this.country =
|
|
87
|
+
((_c = this.country) === null || _c === void 0 ? void 0 : _c.length) === 2 ? alpha2ToAlpha3(this.country) : this.country;
|
|
88
|
+
this.unitNumber = getAddressComponent(GOOGLE_ADDRESS_INFO_ENUM.SUB_PREMISE);
|
|
89
|
+
}
|
|
90
|
+
isVisible() {
|
|
91
|
+
// Minimum value to show the address in the dropdown
|
|
92
|
+
return (!!(this.town || this.suburb) &&
|
|
93
|
+
!!(this.state || this.postalCode) &&
|
|
94
|
+
!!this.country);
|
|
95
|
+
}
|
|
96
|
+
formattedAddress() {
|
|
97
|
+
var _a, _b, _c;
|
|
98
|
+
const outputs = [
|
|
99
|
+
this.streetAddress,
|
|
100
|
+
(_a = this.town) !== null && _a !== void 0 ? _a : this.suburb,
|
|
101
|
+
`${(_b = this.state) !== null && _b !== void 0 ? _b : ''} ${(_c = this.postalCode) !== null && _c !== void 0 ? _c : ''}`.trim(),
|
|
102
|
+
this.country,
|
|
103
|
+
];
|
|
104
|
+
return outputs
|
|
105
|
+
.filter((output) => output && output.trim().length > 0)
|
|
106
|
+
.map((output) => output === null || output === void 0 ? void 0 : output.trim())
|
|
107
|
+
.join(', ');
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
//# sourceMappingURL=googleAddress.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"googleAddress.model.js","sourceRoot":"","sources":["../../../../../modules/services/google/googleAddress.model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;AAEtF,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AA0B3D,MAAM,OAAO,mBAAoB,SAAQ,OAAO;IAK9C,YACE,MAAyC,EACzC,kBAA2B,KAAK;;QAEhC,KAAK,EAAE,CAAC;QARV;;;;;WAAoB;QACpB;;;;;WAAsB;QACtB;;;;;WAAc;Q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,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;QAC3E,IAAI,CAAC,UAAU,GAAG,mBAAmB,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC;IAC9E,CAAC;IAED,SAAS;QACP,oDAAoD;QACpD,OAAO,CACL,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC;YAC5B,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,UAAU,CAAC;YACjC,CAAC,CAAC,IAAI,CAAC,OAAO,CACf,CAAC;IACJ,CAAC;IAED,gBAAgB;;QACd,MAAM,OAAO,GAAG;YACd,IAAI,CAAC,aAAa;YAClB,MAAA,IAAI,CAAC,IAAI,mCAAI,IAAI,CAAC,MAAM;YACxB,GAAG,MAAA,IAAI,CAAC,KAAK,mCAAI,EAAE,IAAI,MAAA,IAAI,CAAC,UAAU,mCAAI,EAAE,EAAE,CAAC,IAAI,EAAE;YACrD,IAAI,CAAC,OAAO;SACb,CAAC;QAEF,OAAO,OAAO;aACX,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;aACtD,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,EAAE,CAAC;aAC/B,IAAI,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export type GoogleSuggestion = {
|
|
2
|
+
/**
|
|
3
|
+
* Contains the human-readable name for the returned result. For establishment results, this is usually the business name and address.
|
|
4
|
+
*/
|
|
5
|
+
placePrediction?: {
|
|
6
|
+
placeId: string;
|
|
7
|
+
};
|
|
8
|
+
place_id: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
export type GoogleMapServiceStatus = {
|
|
12
|
+
OK: string;
|
|
13
|
+
ERROR: string;
|
|
14
|
+
INVALID_REQUEST: string;
|
|
15
|
+
OVER_QUERY_LIMIT: string;
|
|
16
|
+
REQUEST_DENIED: string;
|
|
17
|
+
UNKNOWN_ERROR: string;
|
|
18
|
+
ZERO_RESULTS: string;
|
|
19
|
+
};
|
|
20
|
+
export type GoogleMapService = {
|
|
21
|
+
maps: {
|
|
22
|
+
places: {
|
|
23
|
+
/** @deprecated this service is deprecated by google
|
|
24
|
+
* source: https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service
|
|
25
|
+
*
|
|
26
|
+
* As of March 1st, 2025, google.maps.places.AutocompleteService is not available to new customers. Please use AutocompleteSuggestion instead.
|
|
27
|
+
* At this time, google.maps.places.AutocompleteService is not scheduled to be discontinued,
|
|
28
|
+
* but AutocompleteSuggestion is recommended over google.maps.places.AutocompleteService.
|
|
29
|
+
* While google.maps.places.AutocompleteService will continue to receive bug fixes for any major regressions,
|
|
30
|
+
* existing bugs in google.maps.places.AutocompleteService will not be addressed.
|
|
31
|
+
* At least 12 months notice will be given before support is discontinued.
|
|
32
|
+
*/
|
|
33
|
+
AutocompleteService: {
|
|
34
|
+
new (): {
|
|
35
|
+
/** @deprecated this service is deprecated by google */
|
|
36
|
+
getPlacePredictions: (params: {
|
|
37
|
+
input: string;
|
|
38
|
+
componentRestrictions: {
|
|
39
|
+
country: string[];
|
|
40
|
+
};
|
|
41
|
+
}, callback: (results: GoogleSuggestion[], status: string) => void) => void;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* docs: https://developers.google.com/maps/documentation/javascript/reference/autocomplete-data#AutocompleteSuggestion
|
|
46
|
+
*
|
|
47
|
+
* This is the replacement for google.maps.places.AutocompleteService
|
|
48
|
+
*/
|
|
49
|
+
AutocompleteSuggestion: {
|
|
50
|
+
/**
|
|
51
|
+
* Fetches a list of AutocompleteSuggestions.
|
|
52
|
+
*/
|
|
53
|
+
fetchAutocompleteSuggestions: (autocompleteRequest: {
|
|
54
|
+
input: string;
|
|
55
|
+
includedRegionCodes: string[];
|
|
56
|
+
}) => Promise<{
|
|
57
|
+
suggestions: GoogleSuggestion[];
|
|
58
|
+
}>;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* docs: https://developers.google.com/maps/documentation/javascript/reference/places-service#PlacesServiceStatus
|
|
62
|
+
*/
|
|
63
|
+
PlacesServiceStatus: GoogleMapServiceStatus;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* docs: https://developers.google.com/maps/documentation/javascript/reference/geocoder#Geocoder
|
|
67
|
+
*/
|
|
68
|
+
Geocoder: {
|
|
69
|
+
new (): {
|
|
70
|
+
geocode: (request: {
|
|
71
|
+
placeId: string;
|
|
72
|
+
}, callback: (results: google.maps.GeocoderResult[], status: string) => void) => void;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* docs: https://developers.google.com/maps/documentation/javascript/reference/geocoder#GeocoderStatus
|
|
77
|
+
*/
|
|
78
|
+
GeocoderStatus: GoogleMapServiceStatus;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
//# sourceMappingURL=googleService.types.d.ts.map
|