@fleetbase/ember-ui 0.3.20 → 0.3.21
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.
|
@@ -275,6 +275,20 @@ export default class LayoutHeaderComponent extends Component {
|
|
|
275
275
|
// Push support menu items
|
|
276
276
|
menuItems.pushObjects(supportMenuItems);
|
|
277
277
|
|
|
278
|
+
// Push items from universe registry
|
|
279
|
+
const universeUserMenuItems = this.universe.userMenuItems;
|
|
280
|
+
if (isArray(universeUserMenuItems) && universeUserMenuItems.length) {
|
|
281
|
+
menuItems.pushObjects([
|
|
282
|
+
{
|
|
283
|
+
seperator: true,
|
|
284
|
+
},
|
|
285
|
+
...universeUserMenuItems,
|
|
286
|
+
{
|
|
287
|
+
seperator: true,
|
|
288
|
+
},
|
|
289
|
+
]);
|
|
290
|
+
}
|
|
291
|
+
|
|
278
292
|
// Push provided menu items
|
|
279
293
|
menuItems.pushObjects(userMenuItems);
|
|
280
294
|
|
|
@@ -4,6 +4,7 @@ import { inject as service } from '@ember/service';
|
|
|
4
4
|
import { action } from '@ember/object';
|
|
5
5
|
import { debug } from '@ember/debug';
|
|
6
6
|
import intlTelInput from 'intl-tel-input';
|
|
7
|
+
import lookupUserIp from '@fleetbase/ember-core/utils/lookup-user-ip';
|
|
7
8
|
|
|
8
9
|
export default class PhoneInputComponent extends Component {
|
|
9
10
|
@service fetch;
|
|
@@ -15,13 +16,20 @@ export default class PhoneInputComponent extends Component {
|
|
|
15
16
|
initialCountry: 'auto',
|
|
16
17
|
separateDialCode: true,
|
|
17
18
|
formatAsYouType: true,
|
|
18
|
-
geoIpLookup: async (success
|
|
19
|
+
geoIpLookup: async (success) => {
|
|
19
20
|
try {
|
|
20
|
-
const
|
|
21
|
-
|
|
21
|
+
const ipData = await lookupUserIp();
|
|
22
|
+
if (ipData && ipData.country_code) {
|
|
23
|
+
success(ipData.country_code);
|
|
24
|
+
} else {
|
|
25
|
+
// Fallback to US if no country code in response
|
|
26
|
+
debug('No country code in IP lookup response, defaulting to US');
|
|
27
|
+
success('us');
|
|
28
|
+
}
|
|
22
29
|
} catch (error) {
|
|
23
|
-
|
|
24
|
-
|
|
30
|
+
// Always succeed with US fallback on error
|
|
31
|
+
debug('Failed to lookup country code, defaulting to US: ' + error.message);
|
|
32
|
+
success('us');
|
|
25
33
|
}
|
|
26
34
|
},
|
|
27
35
|
utilsScript: '/assets/libphonenumber/utils.js',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fleetbase/ember-ui",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.21",
|
|
4
4
|
"description": "Fleetbase UI provides all the interface components, helpers, services and utilities for building a Fleetbase extension into the Console.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fleetbase-ui",
|