@trackunit/translations-device 0.1.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/README.md +18 -0
- package/index.cjs.js +146 -0
- package/index.d.ts +1 -0
- package/index.esm.js +144 -0
- package/package.json +21 -0
- package/src/generated/graphql-api/fragment-masking.d.ts +19 -0
- package/src/generated/graphql-api/gql.d.ts +35 -0
- package/src/generated/graphql-api/graphql.d.ts +168 -0
- package/src/generated/graphql-api/index.d.ts +2 -0
- package/src/index.d.ts +1 -0
- package/src/translation.d.ts +30 -0
- package/src/useDeviceTypeTranslations/useDeviceTypeTranslations.d.ts +10 -0
- package/translation.cjs.js +42 -0
- package/translation.cjs10.js +42 -0
- package/translation.cjs11.js +42 -0
- package/translation.cjs12.js +42 -0
- package/translation.cjs13.js +42 -0
- package/translation.cjs14.js +42 -0
- package/translation.cjs15.js +42 -0
- package/translation.cjs16.js +42 -0
- package/translation.cjs17.js +42 -0
- package/translation.cjs2.js +42 -0
- package/translation.cjs3.js +42 -0
- package/translation.cjs4.js +42 -0
- package/translation.cjs5.js +42 -0
- package/translation.cjs6.js +42 -0
- package/translation.cjs7.js +42 -0
- package/translation.cjs8.js +42 -0
- package/translation.cjs9.js +42 -0
- package/translation.esm.js +40 -0
- package/translation.esm10.js +40 -0
- package/translation.esm11.js +40 -0
- package/translation.esm12.js +40 -0
- package/translation.esm13.js +40 -0
- package/translation.esm14.js +40 -0
- package/translation.esm15.js +40 -0
- package/translation.esm16.js +40 -0
- package/translation.esm17.js +40 -0
- package/translation.esm2.js +40 -0
- package/translation.esm3.js +40 -0
- package/translation.esm4.js +40 -0
- package/translation.esm5.js +40 -0
- package/translation.esm6.js +40 -0
- package/translation.esm7.js +40 -0
- package/translation.esm8.js +40 -0
- package/translation.esm9.js +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Trackunit - Device translation
|
|
2
|
+
The `@trackunit/translations-device` package provides hooks for getting translations for device types.
|
|
3
|
+
|
|
4
|
+
This library is exposed publicly for use in the Trackunit [Iris App SDK](https://www.npmjs.com/package/@trackunit/iris-app).
|
|
5
|
+
|
|
6
|
+
To browse all available components visit the [Design System](https://design.iris.trackunit.com/).
|
|
7
|
+
|
|
8
|
+
For more info and a full guide on Iris App SDK Development, please visit our [Developer Hub](https://developers.trackunit.com/).
|
|
9
|
+
|
|
10
|
+
## Development
|
|
11
|
+
At this point this library is only developed by Trackunit Employees.
|
|
12
|
+
For development related information see the [development readme](https://github.com/Trackunit/manager/blob/master/libs/react/components/DEVELOPMENT.md).
|
|
13
|
+
|
|
14
|
+
## Trackunit
|
|
15
|
+
This package was developed by Trackunit ApS.
|
|
16
|
+
Trackunit is the leading SaaS-based IoT solution for the construction industry, offering an ecosystem of hardware, fleet management software & telematics.
|
|
17
|
+
|
|
18
|
+

|
package/index.cjs.js
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('react/jsx-runtime');
|
|
4
|
+
var i18nLibraryTranslation = require('@trackunit/i18n-library-translation');
|
|
5
|
+
var react = require('react');
|
|
6
|
+
|
|
7
|
+
var defaultTranslations = {
|
|
8
|
+
"deviceType.AEMP": "AEMP",
|
|
9
|
+
"deviceType.BLUETOOTH_TAG": "Bluetooth Tag",
|
|
10
|
+
"deviceType.GRIFFIN": "Griffin",
|
|
11
|
+
"deviceType.GW100": "GW100",
|
|
12
|
+
"deviceType.GW200": "GW200",
|
|
13
|
+
"deviceType.KIN": "Kin",
|
|
14
|
+
"deviceType.KIN2": "Kin 200",
|
|
15
|
+
"deviceType.M10": "M10",
|
|
16
|
+
"deviceType.M20": "M20",
|
|
17
|
+
"deviceType.M3": "M3",
|
|
18
|
+
"deviceType.M4": "M4",
|
|
19
|
+
"deviceType.M5": "M5",
|
|
20
|
+
"deviceType.M50": "M50",
|
|
21
|
+
"deviceType.M6": "M6",
|
|
22
|
+
"deviceType.M7": "M7",
|
|
23
|
+
"deviceType.M70": "M70",
|
|
24
|
+
"deviceType.M8": "M8",
|
|
25
|
+
"deviceType.OTHER": "Other",
|
|
26
|
+
"deviceType.S300": "S300",
|
|
27
|
+
"deviceType.SATRAK_ASTRA": "Satrak Astra",
|
|
28
|
+
"deviceType.SATRAK_TELTONIKA": "Satrak Teltonika",
|
|
29
|
+
"deviceType.SCOMBOX1": "Scombox 1",
|
|
30
|
+
"deviceType.SCOMBOX2": "Scombox 2",
|
|
31
|
+
"deviceType.SCOMBOX2AC": "Scombox 2 AC",
|
|
32
|
+
"deviceType.SPOT": "Spot",
|
|
33
|
+
"deviceType.SPOT2": "Spot 2",
|
|
34
|
+
"deviceType.T15": "T15",
|
|
35
|
+
"deviceType.T25": "T25",
|
|
36
|
+
"deviceType.TU201": "TU201",
|
|
37
|
+
"deviceType.TU301": "TU301",
|
|
38
|
+
"deviceType.TU401": "TU401",
|
|
39
|
+
"deviceType.TU500": "TU500",
|
|
40
|
+
"deviceType.TU501": "TU501",
|
|
41
|
+
"deviceType.TU600": "TU600",
|
|
42
|
+
"deviceType.TU700": "TU700",
|
|
43
|
+
"deviceType.VIRTUAL": "Virtual"
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/** The translation namespace for this library */
|
|
47
|
+
const namespace = "translations.device";
|
|
48
|
+
/**
|
|
49
|
+
* The TranslationResource for this Library.
|
|
50
|
+
* Holds lazy loaded imports for all languages supported by the library.
|
|
51
|
+
*
|
|
52
|
+
* This is used to register the translations for this library before initializing i18next.
|
|
53
|
+
*/
|
|
54
|
+
const translations = {
|
|
55
|
+
ns: namespace,
|
|
56
|
+
default: defaultTranslations,
|
|
57
|
+
languages: {
|
|
58
|
+
de: () => Promise.resolve().then(function () { return require('./translation.cjs.js'); }),
|
|
59
|
+
da: () => Promise.resolve().then(function () { return require('./translation.cjs2.js'); }),
|
|
60
|
+
cs: () => Promise.resolve().then(function () { return require('./translation.cjs3.js'); }),
|
|
61
|
+
nl: () => Promise.resolve().then(function () { return require('./translation.cjs4.js'); }),
|
|
62
|
+
fr: () => Promise.resolve().then(function () { return require('./translation.cjs5.js'); }),
|
|
63
|
+
fi: () => Promise.resolve().then(function () { return require('./translation.cjs6.js'); }),
|
|
64
|
+
hu: () => Promise.resolve().then(function () { return require('./translation.cjs7.js'); }),
|
|
65
|
+
it: () => Promise.resolve().then(function () { return require('./translation.cjs8.js'); }),
|
|
66
|
+
nb: () => Promise.resolve().then(function () { return require('./translation.cjs9.js'); }),
|
|
67
|
+
pl: () => Promise.resolve().then(function () { return require('./translation.cjs10.js'); }),
|
|
68
|
+
pt: () => Promise.resolve().then(function () { return require('./translation.cjs11.js'); }),
|
|
69
|
+
ru: () => Promise.resolve().then(function () { return require('./translation.cjs12.js'); }),
|
|
70
|
+
ro: () => Promise.resolve().then(function () { return require('./translation.cjs13.js'); }),
|
|
71
|
+
es: () => Promise.resolve().then(function () { return require('./translation.cjs14.js'); }),
|
|
72
|
+
sv: () => Promise.resolve().then(function () { return require('./translation.cjs15.js'); }),
|
|
73
|
+
ja: () => Promise.resolve().then(function () { return require('./translation.cjs16.js'); }),
|
|
74
|
+
th: () => Promise.resolve().then(function () { return require('./translation.cjs17.js'); }),
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Local useTranslation for this specific library
|
|
79
|
+
*/
|
|
80
|
+
const useTranslation = () => i18nLibraryTranslation.useNamespaceTranslation(namespace);
|
|
81
|
+
/**
|
|
82
|
+
* Registers the translations for this library
|
|
83
|
+
*/
|
|
84
|
+
const setupLibraryTranslations = () => {
|
|
85
|
+
i18nLibraryTranslation.registerTranslations(translations);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Hook for translating device types.
|
|
90
|
+
*
|
|
91
|
+
* @returns {object} `{ deviceTypeDisplayNames, getDeviceTypeTranslation }` — an object containing the pre-built record of all device type display names (e.g. for filter lists) and a single-lookup function for one device type at a time.
|
|
92
|
+
*/
|
|
93
|
+
const useDeviceTypeTranslations = () => {
|
|
94
|
+
const [t] = useTranslation();
|
|
95
|
+
const deviceTypeDisplayNames = react.useMemo(() => ({
|
|
96
|
+
AEMP: t("deviceType.AEMP"),
|
|
97
|
+
BLUETOOTH_TAG: t("deviceType.BLUETOOTH_TAG"),
|
|
98
|
+
GRIFFIN: t("deviceType.GRIFFIN"),
|
|
99
|
+
GW100: t("deviceType.GW100"),
|
|
100
|
+
GW200: t("deviceType.GW200"),
|
|
101
|
+
KIN: t("deviceType.KIN"),
|
|
102
|
+
KIN2: t("deviceType.KIN2"),
|
|
103
|
+
M3: t("deviceType.M3"),
|
|
104
|
+
M4: t("deviceType.M4"),
|
|
105
|
+
M5: t("deviceType.M5"),
|
|
106
|
+
M6: t("deviceType.M6"),
|
|
107
|
+
M7: t("deviceType.M7"),
|
|
108
|
+
M8: t("deviceType.M8"),
|
|
109
|
+
M10: t("deviceType.M10"),
|
|
110
|
+
M20: t("deviceType.M20"),
|
|
111
|
+
M50: t("deviceType.M50"),
|
|
112
|
+
M70: t("deviceType.M70"),
|
|
113
|
+
OTHER: t("deviceType.OTHER"),
|
|
114
|
+
S300: t("deviceType.S300"),
|
|
115
|
+
SATRAK_ASTRA: t("deviceType.SATRAK_ASTRA"),
|
|
116
|
+
SATRAK_TELTONIKA: t("deviceType.SATRAK_TELTONIKA"),
|
|
117
|
+
SCOMBOX1: t("deviceType.SCOMBOX1"),
|
|
118
|
+
SCOMBOX2: t("deviceType.SCOMBOX2"),
|
|
119
|
+
SCOMBOX2AC: t("deviceType.SCOMBOX2AC"),
|
|
120
|
+
SPOT: t("deviceType.SPOT"),
|
|
121
|
+
SPOT2: t("deviceType.SPOT2"),
|
|
122
|
+
T15: t("deviceType.T15"),
|
|
123
|
+
T25: t("deviceType.T25"),
|
|
124
|
+
TU201: t("deviceType.TU201"),
|
|
125
|
+
TU301: t("deviceType.TU301"),
|
|
126
|
+
TU401: t("deviceType.TU401"),
|
|
127
|
+
TU500: t("deviceType.TU500"),
|
|
128
|
+
TU501: t("deviceType.TU501"),
|
|
129
|
+
TU600: t("deviceType.TU600"),
|
|
130
|
+
TU700: t("deviceType.TU700"),
|
|
131
|
+
VIRTUAL: t("deviceType.VIRTUAL"),
|
|
132
|
+
}), [t]);
|
|
133
|
+
const getDeviceTypeTranslation = react.useCallback((deviceType) => deviceTypeDisplayNames[deviceType], [deviceTypeDisplayNames]);
|
|
134
|
+
return react.useMemo(() => ({ getDeviceTypeTranslation, deviceTypeDisplayNames }), [getDeviceTypeTranslation, deviceTypeDisplayNames]);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/*
|
|
138
|
+
* ----------------------------
|
|
139
|
+
* | SETUP TRANSLATIONS START |
|
|
140
|
+
* ----------------------------
|
|
141
|
+
* This import and function call is needed to register translations for this library.
|
|
142
|
+
* Do not remove this if this library has translations.
|
|
143
|
+
*/
|
|
144
|
+
setupLibraryTranslations();
|
|
145
|
+
|
|
146
|
+
exports.useDeviceTypeTranslations = useDeviceTypeTranslations;
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index";
|
package/index.esm.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import 'react/jsx-runtime';
|
|
2
|
+
import { registerTranslations, useNamespaceTranslation } from '@trackunit/i18n-library-translation';
|
|
3
|
+
import { useMemo, useCallback } from 'react';
|
|
4
|
+
|
|
5
|
+
var defaultTranslations = {
|
|
6
|
+
"deviceType.AEMP": "AEMP",
|
|
7
|
+
"deviceType.BLUETOOTH_TAG": "Bluetooth Tag",
|
|
8
|
+
"deviceType.GRIFFIN": "Griffin",
|
|
9
|
+
"deviceType.GW100": "GW100",
|
|
10
|
+
"deviceType.GW200": "GW200",
|
|
11
|
+
"deviceType.KIN": "Kin",
|
|
12
|
+
"deviceType.KIN2": "Kin 200",
|
|
13
|
+
"deviceType.M10": "M10",
|
|
14
|
+
"deviceType.M20": "M20",
|
|
15
|
+
"deviceType.M3": "M3",
|
|
16
|
+
"deviceType.M4": "M4",
|
|
17
|
+
"deviceType.M5": "M5",
|
|
18
|
+
"deviceType.M50": "M50",
|
|
19
|
+
"deviceType.M6": "M6",
|
|
20
|
+
"deviceType.M7": "M7",
|
|
21
|
+
"deviceType.M70": "M70",
|
|
22
|
+
"deviceType.M8": "M8",
|
|
23
|
+
"deviceType.OTHER": "Other",
|
|
24
|
+
"deviceType.S300": "S300",
|
|
25
|
+
"deviceType.SATRAK_ASTRA": "Satrak Astra",
|
|
26
|
+
"deviceType.SATRAK_TELTONIKA": "Satrak Teltonika",
|
|
27
|
+
"deviceType.SCOMBOX1": "Scombox 1",
|
|
28
|
+
"deviceType.SCOMBOX2": "Scombox 2",
|
|
29
|
+
"deviceType.SCOMBOX2AC": "Scombox 2 AC",
|
|
30
|
+
"deviceType.SPOT": "Spot",
|
|
31
|
+
"deviceType.SPOT2": "Spot 2",
|
|
32
|
+
"deviceType.T15": "T15",
|
|
33
|
+
"deviceType.T25": "T25",
|
|
34
|
+
"deviceType.TU201": "TU201",
|
|
35
|
+
"deviceType.TU301": "TU301",
|
|
36
|
+
"deviceType.TU401": "TU401",
|
|
37
|
+
"deviceType.TU500": "TU500",
|
|
38
|
+
"deviceType.TU501": "TU501",
|
|
39
|
+
"deviceType.TU600": "TU600",
|
|
40
|
+
"deviceType.TU700": "TU700",
|
|
41
|
+
"deviceType.VIRTUAL": "Virtual"
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** The translation namespace for this library */
|
|
45
|
+
const namespace = "translations.device";
|
|
46
|
+
/**
|
|
47
|
+
* The TranslationResource for this Library.
|
|
48
|
+
* Holds lazy loaded imports for all languages supported by the library.
|
|
49
|
+
*
|
|
50
|
+
* This is used to register the translations for this library before initializing i18next.
|
|
51
|
+
*/
|
|
52
|
+
const translations = {
|
|
53
|
+
ns: namespace,
|
|
54
|
+
default: defaultTranslations,
|
|
55
|
+
languages: {
|
|
56
|
+
de: () => import('./translation.esm.js'),
|
|
57
|
+
da: () => import('./translation.esm2.js'),
|
|
58
|
+
cs: () => import('./translation.esm3.js'),
|
|
59
|
+
nl: () => import('./translation.esm4.js'),
|
|
60
|
+
fr: () => import('./translation.esm5.js'),
|
|
61
|
+
fi: () => import('./translation.esm6.js'),
|
|
62
|
+
hu: () => import('./translation.esm7.js'),
|
|
63
|
+
it: () => import('./translation.esm8.js'),
|
|
64
|
+
nb: () => import('./translation.esm9.js'),
|
|
65
|
+
pl: () => import('./translation.esm10.js'),
|
|
66
|
+
pt: () => import('./translation.esm11.js'),
|
|
67
|
+
ru: () => import('./translation.esm12.js'),
|
|
68
|
+
ro: () => import('./translation.esm13.js'),
|
|
69
|
+
es: () => import('./translation.esm14.js'),
|
|
70
|
+
sv: () => import('./translation.esm15.js'),
|
|
71
|
+
ja: () => import('./translation.esm16.js'),
|
|
72
|
+
th: () => import('./translation.esm17.js'),
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Local useTranslation for this specific library
|
|
77
|
+
*/
|
|
78
|
+
const useTranslation = () => useNamespaceTranslation(namespace);
|
|
79
|
+
/**
|
|
80
|
+
* Registers the translations for this library
|
|
81
|
+
*/
|
|
82
|
+
const setupLibraryTranslations = () => {
|
|
83
|
+
registerTranslations(translations);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Hook for translating device types.
|
|
88
|
+
*
|
|
89
|
+
* @returns {object} `{ deviceTypeDisplayNames, getDeviceTypeTranslation }` — an object containing the pre-built record of all device type display names (e.g. for filter lists) and a single-lookup function for one device type at a time.
|
|
90
|
+
*/
|
|
91
|
+
const useDeviceTypeTranslations = () => {
|
|
92
|
+
const [t] = useTranslation();
|
|
93
|
+
const deviceTypeDisplayNames = useMemo(() => ({
|
|
94
|
+
AEMP: t("deviceType.AEMP"),
|
|
95
|
+
BLUETOOTH_TAG: t("deviceType.BLUETOOTH_TAG"),
|
|
96
|
+
GRIFFIN: t("deviceType.GRIFFIN"),
|
|
97
|
+
GW100: t("deviceType.GW100"),
|
|
98
|
+
GW200: t("deviceType.GW200"),
|
|
99
|
+
KIN: t("deviceType.KIN"),
|
|
100
|
+
KIN2: t("deviceType.KIN2"),
|
|
101
|
+
M3: t("deviceType.M3"),
|
|
102
|
+
M4: t("deviceType.M4"),
|
|
103
|
+
M5: t("deviceType.M5"),
|
|
104
|
+
M6: t("deviceType.M6"),
|
|
105
|
+
M7: t("deviceType.M7"),
|
|
106
|
+
M8: t("deviceType.M8"),
|
|
107
|
+
M10: t("deviceType.M10"),
|
|
108
|
+
M20: t("deviceType.M20"),
|
|
109
|
+
M50: t("deviceType.M50"),
|
|
110
|
+
M70: t("deviceType.M70"),
|
|
111
|
+
OTHER: t("deviceType.OTHER"),
|
|
112
|
+
S300: t("deviceType.S300"),
|
|
113
|
+
SATRAK_ASTRA: t("deviceType.SATRAK_ASTRA"),
|
|
114
|
+
SATRAK_TELTONIKA: t("deviceType.SATRAK_TELTONIKA"),
|
|
115
|
+
SCOMBOX1: t("deviceType.SCOMBOX1"),
|
|
116
|
+
SCOMBOX2: t("deviceType.SCOMBOX2"),
|
|
117
|
+
SCOMBOX2AC: t("deviceType.SCOMBOX2AC"),
|
|
118
|
+
SPOT: t("deviceType.SPOT"),
|
|
119
|
+
SPOT2: t("deviceType.SPOT2"),
|
|
120
|
+
T15: t("deviceType.T15"),
|
|
121
|
+
T25: t("deviceType.T25"),
|
|
122
|
+
TU201: t("deviceType.TU201"),
|
|
123
|
+
TU301: t("deviceType.TU301"),
|
|
124
|
+
TU401: t("deviceType.TU401"),
|
|
125
|
+
TU500: t("deviceType.TU500"),
|
|
126
|
+
TU501: t("deviceType.TU501"),
|
|
127
|
+
TU600: t("deviceType.TU600"),
|
|
128
|
+
TU700: t("deviceType.TU700"),
|
|
129
|
+
VIRTUAL: t("deviceType.VIRTUAL"),
|
|
130
|
+
}), [t]);
|
|
131
|
+
const getDeviceTypeTranslation = useCallback((deviceType) => deviceTypeDisplayNames[deviceType], [deviceTypeDisplayNames]);
|
|
132
|
+
return useMemo(() => ({ getDeviceTypeTranslation, deviceTypeDisplayNames }), [getDeviceTypeTranslation, deviceTypeDisplayNames]);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/*
|
|
136
|
+
* ----------------------------
|
|
137
|
+
* | SETUP TRANSLATIONS START |
|
|
138
|
+
* ----------------------------
|
|
139
|
+
* This import and function call is needed to register translations for this library.
|
|
140
|
+
* Do not remove this if this library has translations.
|
|
141
|
+
*/
|
|
142
|
+
setupLibraryTranslations();
|
|
143
|
+
|
|
144
|
+
export { useDeviceTypeTranslations };
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@trackunit/translations-device",
|
|
3
|
+
"version": "0.1.5",
|
|
4
|
+
"repository": "https://github.com/Trackunit/manager",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=24.x"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@trackunit/i18n-library-translation": "1.20.3",
|
|
11
|
+
"@graphql-codegen/cli": "^5.0.3",
|
|
12
|
+
"@graphql-typed-document-node/core": "^3.2.0",
|
|
13
|
+
"@trackunit/iris-app-api": "1.19.2"
|
|
14
|
+
},
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"react": "^19.0.0"
|
|
17
|
+
},
|
|
18
|
+
"module": "./index.esm.js",
|
|
19
|
+
"main": "./index.cjs.js",
|
|
20
|
+
"types": "./index.d.ts"
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ResultOf, DocumentTypeDecoration, TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
2
|
+
import { Incremental } from './graphql';
|
|
3
|
+
export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>> = TDocumentType extends DocumentTypeDecoration<infer TType, any> ? [TType] extends [{
|
|
4
|
+
' $fragmentName'?: infer TKey;
|
|
5
|
+
}] ? TKey extends string ? {
|
|
6
|
+
' $fragmentRefs'?: {
|
|
7
|
+
[key in TKey]: TType;
|
|
8
|
+
};
|
|
9
|
+
} : never : never : never;
|
|
10
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>): TType;
|
|
11
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | undefined): TType | undefined;
|
|
12
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null): TType | null;
|
|
13
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined): TType | null | undefined;
|
|
14
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>>): Array<TType>;
|
|
15
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined): Array<TType> | null | undefined;
|
|
16
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>): ReadonlyArray<TType>;
|
|
17
|
+
export declare function getFragmentData<TType>(_documentNode: DocumentTypeDecoration<TType, any>, fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined): ReadonlyArray<TType> | null | undefined;
|
|
18
|
+
export declare function makeFragmentData<F extends DocumentTypeDecoration<any, any>, FT extends ResultOf<F>>(data: FT, _fragment: F): FragmentType<F>;
|
|
19
|
+
export declare function isFragmentReady<TQuery, TFrag>(queryNode: DocumentTypeDecoration<TQuery, any>, fragmentNode: TypedDocumentNode<TFrag>, data: FragmentType<TypedDocumentNode<Incremental<TFrag>, any>> | null | undefined): data is FragmentType<typeof fragmentNode>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as types from './graphql';
|
|
2
|
+
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
|
|
3
|
+
/**
|
|
4
|
+
* Map of all GraphQL operations in the project.
|
|
5
|
+
*
|
|
6
|
+
* This map has several performance disadvantages:
|
|
7
|
+
* 1. It is not tree-shakeable, so it will include all operations in the project.
|
|
8
|
+
* 2. It is not minifiable, so the string of a GraphQL query will be multiple times inside the bundle.
|
|
9
|
+
* 3. It does not support dead code elimination, so it will add unused operations.
|
|
10
|
+
*
|
|
11
|
+
* Therefore it is highly recommended to use the babel or swc plugin for production.
|
|
12
|
+
* Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size
|
|
13
|
+
*/
|
|
14
|
+
declare const documents: {
|
|
15
|
+
"fragment DeviceTypeFragment on TelematicsDevice {\n deviceType\n}": DocumentNode<types.DeviceTypeFragmentFragment, unknown>;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
19
|
+
*
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const query = graphql(`query GetUser($id: ID!) { user(id: $id) { name } }`);
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* The query argument is unknown!
|
|
27
|
+
* Please regenerate the types.
|
|
28
|
+
*/
|
|
29
|
+
export declare function graphql(source: string): unknown;
|
|
30
|
+
/**
|
|
31
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
32
|
+
*/
|
|
33
|
+
export declare function graphql(source: "fragment DeviceTypeFragment on TelematicsDevice {\n deviceType\n}"): (typeof documents)["fragment DeviceTypeFragment on TelematicsDevice {\n deviceType\n}"];
|
|
34
|
+
export type DocumentType<TDocumentNode extends DocumentNode<any, any>> = TDocumentNode extends DocumentNode<infer TType, any> ? TType : never;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { TypedDocumentNode as DocumentNode } from "@graphql-typed-document-node/core";
|
|
2
|
+
import type { PublicIrisAppManifest } from "@trackunit/iris-app-api";
|
|
3
|
+
export type Maybe<T> = T | null;
|
|
4
|
+
export type InputMaybe<T> = Maybe<T> | undefined;
|
|
5
|
+
export type Exact<T extends {
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}> = {
|
|
8
|
+
[K in keyof T]: T[K];
|
|
9
|
+
};
|
|
10
|
+
export type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
11
|
+
[SubKey in K]?: Maybe<T[SubKey]>;
|
|
12
|
+
};
|
|
13
|
+
export type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
|
|
14
|
+
[SubKey in K]: Maybe<T[SubKey]>;
|
|
15
|
+
};
|
|
16
|
+
export type MakeEmpty<T extends {
|
|
17
|
+
[key: string]: unknown;
|
|
18
|
+
}, K extends keyof T> = {
|
|
19
|
+
[_ in K]?: never;
|
|
20
|
+
};
|
|
21
|
+
export type Incremental<T> = T | {
|
|
22
|
+
[P in keyof T]?: P extends " $fragmentName" | "__typename" ? T[P] : never;
|
|
23
|
+
};
|
|
24
|
+
export type DateTimeISOString = string;
|
|
25
|
+
/** All built-in and custom scalars, mapped to their actual values */
|
|
26
|
+
export type Scalars = {
|
|
27
|
+
ID: {
|
|
28
|
+
input: string;
|
|
29
|
+
output: string;
|
|
30
|
+
};
|
|
31
|
+
String: {
|
|
32
|
+
input: string;
|
|
33
|
+
output: string;
|
|
34
|
+
};
|
|
35
|
+
Boolean: {
|
|
36
|
+
input: boolean;
|
|
37
|
+
output: boolean;
|
|
38
|
+
};
|
|
39
|
+
Int: {
|
|
40
|
+
input: number;
|
|
41
|
+
output: number;
|
|
42
|
+
};
|
|
43
|
+
Float: {
|
|
44
|
+
input: number;
|
|
45
|
+
output: number;
|
|
46
|
+
};
|
|
47
|
+
/** The ISO 4217 currency code of the monetary field definition. */
|
|
48
|
+
Currency: {
|
|
49
|
+
input: string;
|
|
50
|
+
output: string;
|
|
51
|
+
};
|
|
52
|
+
/** Cursor scalar. */
|
|
53
|
+
Cursor: {
|
|
54
|
+
input: string;
|
|
55
|
+
output: string;
|
|
56
|
+
};
|
|
57
|
+
/** Date without time, Eg. 2019-01-01 */
|
|
58
|
+
Date: {
|
|
59
|
+
input: DateTimeISOString;
|
|
60
|
+
output: DateTimeISOString;
|
|
61
|
+
};
|
|
62
|
+
/** DateTime represents a “date-time” as specified in section 5.6 of RFC 3339 */
|
|
63
|
+
DateTime: {
|
|
64
|
+
input: DateTimeISOString;
|
|
65
|
+
output: DateTimeISOString;
|
|
66
|
+
};
|
|
67
|
+
/** Duration represents an ISO 8601 duration */
|
|
68
|
+
Duration: {
|
|
69
|
+
input: any;
|
|
70
|
+
output: any;
|
|
71
|
+
};
|
|
72
|
+
/** Valid email address according to https://owasp.org/www-community/OWASP_Validation_Regex_Repository */
|
|
73
|
+
EmailAddress: {
|
|
74
|
+
input: string;
|
|
75
|
+
output: string;
|
|
76
|
+
};
|
|
77
|
+
/** A (possiblely multidimensional) set of coordinates following x, y, z order. */
|
|
78
|
+
GeoJSONCoordinates: {
|
|
79
|
+
input: [number, number] | [number, number][] | [number, number][][];
|
|
80
|
+
output: [number, number] | [number, number][] | [number, number][][];
|
|
81
|
+
};
|
|
82
|
+
/** Raw JSON object structure, not serialized to string */
|
|
83
|
+
JSON: {
|
|
84
|
+
input: any;
|
|
85
|
+
output: any;
|
|
86
|
+
};
|
|
87
|
+
/** The `JSONObject` scalar type represents JSON values as a string */
|
|
88
|
+
JSONObject: {
|
|
89
|
+
input: any;
|
|
90
|
+
output: any;
|
|
91
|
+
};
|
|
92
|
+
/** 24-hour clock time string in the format hh:mm:ss.sss or hh:mm:ss if partial seconds is zero */
|
|
93
|
+
LocalTime: {
|
|
94
|
+
input: any;
|
|
95
|
+
output: any;
|
|
96
|
+
};
|
|
97
|
+
/** Javascript `Long`. Type represents a 64 bit integer. */
|
|
98
|
+
Long: {
|
|
99
|
+
input: any;
|
|
100
|
+
output: any;
|
|
101
|
+
};
|
|
102
|
+
/** Phone number in E.164 format */
|
|
103
|
+
PhoneNumber: {
|
|
104
|
+
input: string;
|
|
105
|
+
output: string;
|
|
106
|
+
};
|
|
107
|
+
/** The `PublicIrisAppManifest` scalar type represents an Iris App Manifest as JSON */
|
|
108
|
+
PublicIrisAppManifest: {
|
|
109
|
+
input: PublicIrisAppManifest;
|
|
110
|
+
output: PublicIrisAppManifest;
|
|
111
|
+
};
|
|
112
|
+
/** Uniform resource locator */
|
|
113
|
+
Url: {
|
|
114
|
+
input: string;
|
|
115
|
+
output: string;
|
|
116
|
+
};
|
|
117
|
+
/** YearMonth scalar */
|
|
118
|
+
YearMonth: {
|
|
119
|
+
input: any;
|
|
120
|
+
output: any;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
export declare const deviceType: {
|
|
124
|
+
readonly AEMP: "AEMP";
|
|
125
|
+
readonly BLUETOOTH_TAG: "BLUETOOTH_TAG";
|
|
126
|
+
readonly GRIFFIN: "GRIFFIN";
|
|
127
|
+
readonly GW100: "GW100";
|
|
128
|
+
readonly GW200: "GW200";
|
|
129
|
+
readonly KIN: "KIN";
|
|
130
|
+
readonly KIN2: "KIN2";
|
|
131
|
+
readonly M3: "M3";
|
|
132
|
+
readonly M4: "M4";
|
|
133
|
+
readonly M5: "M5";
|
|
134
|
+
readonly M6: "M6";
|
|
135
|
+
readonly M7: "M7";
|
|
136
|
+
readonly M8: "M8";
|
|
137
|
+
readonly M10: "M10";
|
|
138
|
+
readonly M20: "M20";
|
|
139
|
+
readonly M50: "M50";
|
|
140
|
+
readonly M70: "M70";
|
|
141
|
+
readonly OTHER: "OTHER";
|
|
142
|
+
readonly S300: "S300";
|
|
143
|
+
readonly SATRAK_ASTRA: "SATRAK_ASTRA";
|
|
144
|
+
readonly SATRAK_TELTONIKA: "SATRAK_TELTONIKA";
|
|
145
|
+
readonly SCOMBOX1: "SCOMBOX1";
|
|
146
|
+
readonly SCOMBOX2: "SCOMBOX2";
|
|
147
|
+
readonly SCOMBOX2AC: "SCOMBOX2AC";
|
|
148
|
+
readonly SPOT: "SPOT";
|
|
149
|
+
readonly SPOT2: "SPOT2";
|
|
150
|
+
readonly T15: "T15";
|
|
151
|
+
readonly T25: "T25";
|
|
152
|
+
readonly TU201: "TU201";
|
|
153
|
+
readonly TU301: "TU301";
|
|
154
|
+
readonly TU401: "TU401";
|
|
155
|
+
readonly TU500: "TU500";
|
|
156
|
+
readonly TU501: "TU501";
|
|
157
|
+
readonly TU600: "TU600";
|
|
158
|
+
readonly TU700: "TU700";
|
|
159
|
+
readonly VIRTUAL: "VIRTUAL";
|
|
160
|
+
};
|
|
161
|
+
export type DeviceType = (typeof deviceType)[keyof typeof deviceType];
|
|
162
|
+
export type DeviceTypeFragmentFragment = {
|
|
163
|
+
__typename?: "TelematicsDevice";
|
|
164
|
+
deviceType: DeviceType | null;
|
|
165
|
+
} & {
|
|
166
|
+
" $fragmentName"?: "DeviceTypeFragmentFragment";
|
|
167
|
+
};
|
|
168
|
+
export declare const DeviceTypeFragmentFragmentDoc: DocumentNode<DeviceTypeFragmentFragment, unknown>;
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./useDeviceTypeTranslations/useDeviceTypeTranslations";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { NamespaceTransProps, TransForLibs, TranslationResource, useNamespaceTranslation } from "@trackunit/i18n-library-translation";
|
|
2
|
+
import { ReactElement } from "react";
|
|
3
|
+
import defaultTranslations from "./locales/en/translation.json";
|
|
4
|
+
/** A type for all available translation keys in this library */
|
|
5
|
+
export type TranslationKeys = keyof typeof defaultTranslations;
|
|
6
|
+
/** The translation namespace for this library */
|
|
7
|
+
export declare const namespace = "translations.device";
|
|
8
|
+
/**
|
|
9
|
+
* The TranslationResource for this Library.
|
|
10
|
+
* Holds lazy loaded imports for all languages supported by the library.
|
|
11
|
+
*
|
|
12
|
+
* This is used to register the translations for this library before initializing i18next.
|
|
13
|
+
*/
|
|
14
|
+
export declare const translations: TranslationResource<TranslationKeys>;
|
|
15
|
+
/**
|
|
16
|
+
* Local useTranslation for this specific library
|
|
17
|
+
*/
|
|
18
|
+
export declare const useTranslation: () => ReturnType<typeof useNamespaceTranslation<TranslationKeys>>;
|
|
19
|
+
/**
|
|
20
|
+
* Type of the t function for the local useTranslation for this specific library
|
|
21
|
+
*/
|
|
22
|
+
export type TranslationFunction = TransForLibs<TranslationKeys>;
|
|
23
|
+
/**
|
|
24
|
+
* Trans for this specific library.
|
|
25
|
+
*/
|
|
26
|
+
export declare const Trans: (props: NamespaceTransProps<TranslationKeys>) => ReactElement;
|
|
27
|
+
/**
|
|
28
|
+
* Registers the translations for this library
|
|
29
|
+
*/
|
|
30
|
+
export declare const setupLibraryTranslations: () => void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DeviceType } from "../generated/graphql-api/graphql";
|
|
2
|
+
/**
|
|
3
|
+
* Hook for translating device types.
|
|
4
|
+
*
|
|
5
|
+
* @returns {object} `{ deviceTypeDisplayNames, getDeviceTypeTranslation }` — an object containing the pre-built record of all device type display names (e.g. for filter lists) and a single-lookup function for one device type at a time.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useDeviceTypeTranslations: () => {
|
|
8
|
+
deviceTypeDisplayNames: Record<DeviceType, string>;
|
|
9
|
+
getDeviceTypeTranslation: (deviceType: DeviceType) => string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var translation = {
|
|
4
|
+
"deviceType.AEMP": "AEMP",
|
|
5
|
+
"deviceType.BLUETOOTH_TAG": "Bluetooth Tag",
|
|
6
|
+
"deviceType.GRIFFIN": "Griffin",
|
|
7
|
+
"deviceType.GW100": "GW100",
|
|
8
|
+
"deviceType.GW200": "GW200",
|
|
9
|
+
"deviceType.KIN": "Kin",
|
|
10
|
+
"deviceType.KIN2": "Kin 200",
|
|
11
|
+
"deviceType.M10": "M10",
|
|
12
|
+
"deviceType.M20": "M20",
|
|
13
|
+
"deviceType.M3": "M3",
|
|
14
|
+
"deviceType.M4": "M4",
|
|
15
|
+
"deviceType.M5": "M5",
|
|
16
|
+
"deviceType.M50": "M50",
|
|
17
|
+
"deviceType.M6": "M6",
|
|
18
|
+
"deviceType.M7": "M7",
|
|
19
|
+
"deviceType.M70": "M70",
|
|
20
|
+
"deviceType.M8": "M8",
|
|
21
|
+
"deviceType.OTHER": "Other",
|
|
22
|
+
"deviceType.S300": "S300",
|
|
23
|
+
"deviceType.SATRAK_ASTRA": "Satrak Astra",
|
|
24
|
+
"deviceType.SATRAK_TELTONIKA": "Satrak Teltonika",
|
|
25
|
+
"deviceType.SCOMBOX1": "Scombox 1",
|
|
26
|
+
"deviceType.SCOMBOX2": "Scombox 2",
|
|
27
|
+
"deviceType.SCOMBOX2AC": "Scombox 2 AC",
|
|
28
|
+
"deviceType.SPOT": "Spot",
|
|
29
|
+
"deviceType.SPOT2": "Spot 2",
|
|
30
|
+
"deviceType.T15": "T15",
|
|
31
|
+
"deviceType.T25": "T25",
|
|
32
|
+
"deviceType.TU201": "TU201",
|
|
33
|
+
"deviceType.TU301": "TU301",
|
|
34
|
+
"deviceType.TU401": "TU401",
|
|
35
|
+
"deviceType.TU500": "TU500",
|
|
36
|
+
"deviceType.TU501": "TU501",
|
|
37
|
+
"deviceType.TU600": "TU600",
|
|
38
|
+
"deviceType.TU700": "TU700",
|
|
39
|
+
"deviceType.VIRTUAL": "Virtual"
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
exports.default = translation;
|