@nanas-home/hub-common 0.22.412 → 0.25.447

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.
@@ -1,5 +1,7 @@
1
1
  import dayjs from 'dayjs';
2
2
  import { jwtDecode } from 'jwt-decode';
3
+ import { FormatIcu } from '@tolgee/format-icu';
4
+ import { Tolgee, DevTools, BackendFetch } from '@tolgee/web';
3
5
 
4
6
  // src/constants/calendar.constants.ts
5
7
  var weekdayTranslationKeyOrder = [
@@ -249,8 +251,9 @@ var AppType = /* @__PURE__ */ ((AppType2) => {
249
251
  AppType2[AppType2["HubApi"] = 3] = "HubApi";
250
252
  AppType2[AppType2["BookingManager"] = 4] = "BookingManager";
251
253
  AppType2[AppType2["HostCalendar"] = 5] = "HostCalendar";
252
- AppType2[AppType2["Test"] = 6] = "Test";
253
- AppType2[AppType2["Interactive"] = 7] = "Interactive";
254
+ AppType2[AppType2["Landing"] = 6] = "Landing";
255
+ AppType2[AppType2["Test"] = 7] = "Test";
256
+ AppType2[AppType2["Interactive"] = 8] = "Interactive";
254
257
  return AppType2;
255
258
  })(AppType || {});
256
259
  var webAppTypes = [
@@ -1105,152 +1108,226 @@ var getPayloadFromJwt = (token) => {
1105
1108
 
1106
1109
  // src/assets/meta.json
1107
1110
  var meta_default = {
1108
- packageVersion: "0.22.0",
1109
- date: "2026-01-19",
1110
- gitCommitHash: "93e0b9f56559f4439dedcead12ee57dcb309c069"
1111
+ packageVersion: "0.25.0",
1112
+ date: "2026-01-26",
1113
+ gitCommitHash: "fb1940793706b71221c87d3673ae00d590387af8"
1111
1114
  };
1112
1115
 
1113
1116
  // src/assets/packagesUsed.json
1114
1117
  var packagesUsed_default = {
1115
- generatedDate: "2026-01-19T14:29:03.979Z",
1116
- generatedDateFormat: "2026-01-19",
1117
- list: [
1118
- {
1119
- name: "@chromatic-com/storybook",
1120
- version: "5.0.0",
1121
- licenseType: "MIT",
1122
- repoUrl: "https://github.com/chromaui/addon-visual-tests.git",
1123
- licenceUrl: "https://github.com/chromaui/addon-visual-tests/blob/master/LICENSE"
1124
- },
1125
- {
1126
- name: "@storybook/addon-a11y",
1127
- version: "10.1.11",
1128
- licenseType: "MIT",
1129
- repoUrl: "https://github.com/storybookjs/storybook.git"
1130
- },
1131
- {
1132
- name: "@storybook/addon-docs",
1133
- version: "10.1.11",
1134
- licenseType: "MIT",
1135
- repoUrl: "https://github.com/storybookjs/storybook.git"
1136
- },
1137
- {
1138
- name: "@storybook/addon-links",
1139
- version: "10.1.11",
1140
- licenseType: "MIT",
1141
- repoUrl: "https://github.com/storybookjs/storybook.git"
1142
- },
1143
- {
1144
- name: "@storybook/addon-onboarding",
1145
- version: "10.1.11",
1146
- licenseType: "MIT",
1147
- repoUrl: "https://github.com/storybookjs/storybook.git"
1148
- },
1149
- {
1150
- name: "@storybook/addon-vitest",
1151
- version: "10.1.11",
1152
- licenseType: "MIT",
1153
- repoUrl: "https://github.com/storybookjs/storybook.git"
1154
- },
1155
- {
1156
- name: "@types/node",
1157
- version: "25.0.9",
1158
- licenseType: "MIT",
1159
- repoUrl: "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
1160
- licenceUrl: "https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/LICENSE"
1161
- },
1162
- {
1163
- name: "@vitest/browser",
1164
- version: "4.0.17",
1165
- licenseType: "MIT",
1166
- repoUrl: "https://github.com/vitest-dev/vitest.git",
1167
- licenceUrl: "https://github.com/vitest-dev/vitest/blob/master/LICENSE"
1168
- },
1169
- {
1170
- name: "@vitest/coverage-v8",
1171
- version: "4.0.17",
1172
- licenseType: "MIT",
1173
- repoUrl: "https://github.com/vitest-dev/vitest.git",
1174
- licenceUrl: "https://github.com/vitest-dev/vitest/blob/master/LICENSE"
1175
- },
1176
- {
1177
- name: "@vitest/ui",
1178
- version: "4.0.17",
1179
- licenseType: "MIT",
1180
- repoUrl: "https://github.com/vitest-dev/vitest.git",
1181
- licenceUrl: "https://github.com/vitest-dev/vitest/blob/master/LICENSE"
1182
- },
1183
- {
1184
- name: "dotenv-cli",
1185
- version: "11.0.0",
1186
- licenseType: "MIT",
1187
- repoUrl: "https://www.npmjs.com/package/dotenv-cli"
1188
- },
1189
- {
1190
- name: "jsdom",
1191
- version: "27.4.0",
1192
- licenseType: "MIT",
1193
- repoUrl: "https://github.com/jsdom/jsdom.git"
1194
- },
1195
- {
1196
- name: "sass",
1197
- version: "1.97.2",
1198
- licenseType: "MIT",
1199
- repoUrl: "https://github.com/sass/dart-sass",
1200
- licenceUrl: "https://github.com/sass/dart-sass/blob/master/LICENSE"
1201
- },
1202
- {
1203
- name: "storybook",
1204
- version: "10.1.11",
1205
- licenseType: "MIT",
1206
- repoUrl: "https://github.com/storybookjs/storybook.git"
1207
- },
1208
- {
1209
- name: "storybook-solidjs-vite",
1210
- version: "10.0.9",
1211
- licenseType: "MIT",
1212
- repoUrl: "https://github.com/solidjs-community/storybook.git",
1213
- licenceUrl: "https://github.com/solidjs-community/storybook/blob/master/LICENSE"
1214
- },
1215
- {
1216
- name: "tsup",
1217
- version: "8.5.1",
1218
- licenseType: "MIT",
1219
- repoUrl: "https://github.com/egoist/tsup.git",
1220
- licenceUrl: "https://github.com/egoist/tsup/blob/master/LICENSE"
1221
- },
1222
- {
1223
- name: "tsup-preset-solid",
1224
- version: "2.2.0",
1225
- licenseType: "MIT",
1226
- repoUrl: "https://github.com/solidjs-community/tsup-preset-solid.git",
1227
- licenceUrl: "https://github.com/solidjs-community/tsup-preset-solid/blob/master/LICENSE"
1228
- },
1229
- {
1230
- name: "typescript",
1231
- version: "5.9.3",
1232
- licenseType: "Apache-2.0",
1233
- repoUrl: "https://github.com/microsoft/TypeScript.git"
1234
- },
1235
- {
1236
- name: "vite",
1237
- version: "7.3.1",
1238
- licenseType: "MIT",
1239
- repoUrl: "https://github.com/vitejs/vite.git"
1240
- },
1241
- {
1242
- name: "vite-plugin-solid",
1243
- version: "2.11.10",
1244
- licenseType: "MIT",
1245
- repoUrl: "https://github.com/solidjs/vite-plugin-solid.git"
1246
- },
1247
- {
1248
- name: "vitest",
1249
- version: "4.0.17",
1250
- licenseType: "MIT",
1251
- repoUrl: "https://github.com/vitest-dev/vitest.git"
1252
- }
1253
- ]
1118
+ generatedDate: "2026-01-26T15:46:26.560Z",
1119
+ generatedDateFormat: "2026-01-26",
1120
+ list: {
1121
+ dependencies: [],
1122
+ peerDependencies: [
1123
+ {
1124
+ name: "@hcaptcha/types",
1125
+ version: "1.0.4",
1126
+ licenseType: "MIT",
1127
+ repoUrl: "https://www.npmjs.com/package/@hcaptcha/types"
1128
+ },
1129
+ {
1130
+ name: "@tolgee/format-icu",
1131
+ version: "6.2.6",
1132
+ licenseType: "MIT",
1133
+ repoUrl: "https://github.com/tolgee/tolgee-js",
1134
+ licenceUrl: "https://github.com/tolgee/tolgee-js/blob/master/LICENSE"
1135
+ },
1136
+ {
1137
+ name: "@tolgee/web",
1138
+ version: "6.2.6",
1139
+ licenseType: "BSD-3-Clause",
1140
+ repoUrl: "https://github.com/tolgee/tolgee-js.git",
1141
+ licenceUrl: "https://github.com/tolgee/tolgee-js/blob/master/LICENSE"
1142
+ },
1143
+ {
1144
+ name: "classnames",
1145
+ version: "2.5.1",
1146
+ licenseType: "MIT",
1147
+ repoUrl: "https://github.com/JedWatson/classnames.git",
1148
+ licenceUrl: "https://github.com/JedWatson/classnames/blob/master/LICENSE"
1149
+ },
1150
+ {
1151
+ name: "dayjs",
1152
+ version: "1.11.13",
1153
+ licenseType: "MIT",
1154
+ repoUrl: "https://github.com/iamkun/dayjs.git",
1155
+ licenceUrl: "https://github.com/iamkun/dayjs/blob/master/LICENSE"
1156
+ },
1157
+ {
1158
+ name: "favicons",
1159
+ version: "7.2.0",
1160
+ licenseType: "MIT",
1161
+ repoUrl: "https://github.com/itgalaxy/favicons.git",
1162
+ licenceUrl: "https://github.com/itgalaxy/favicons/blob/master/LICENSE"
1163
+ },
1164
+ {
1165
+ name: "jwt-decode",
1166
+ version: "4.0.0",
1167
+ licenseType: "MIT",
1168
+ repoUrl: "git://github.com/auth0/jwt-decode",
1169
+ licenceUrl: "https://github.com/auth0/jwt-decode/blob/master/LICENSE"
1170
+ },
1171
+ {
1172
+ name: "solid-js",
1173
+ version: "1.9.7",
1174
+ licenseType: "MIT",
1175
+ repoUrl: "https://github.com/solidjs/solid",
1176
+ licenceUrl: "https://github.com/solidjs/solid/blob/master/LICENSE"
1177
+ },
1178
+ {
1179
+ name: "solid-toast",
1180
+ version: "0.5.0",
1181
+ licenseType: "MIT",
1182
+ repoUrl: "https://github.com/ardeora/solid-toast.git",
1183
+ licenceUrl: "https://github.com/ardeora/solid-toast/blob/master/LICENSE"
1184
+ }
1185
+ ],
1186
+ devDependencies: [
1187
+ {
1188
+ name: "@chromatic-com/storybook",
1189
+ version: "5.0.0",
1190
+ licenseType: "MIT",
1191
+ repoUrl: "https://github.com/chromaui/addon-visual-tests.git",
1192
+ licenceUrl: "https://github.com/chromaui/addon-visual-tests/blob/master/LICENSE"
1193
+ },
1194
+ {
1195
+ name: "@storybook/addon-a11y",
1196
+ version: "10.2.0",
1197
+ licenseType: "MIT",
1198
+ repoUrl: "https://github.com/storybookjs/storybook.git"
1199
+ },
1200
+ {
1201
+ name: "@storybook/addon-docs",
1202
+ version: "10.2.0",
1203
+ licenseType: "MIT",
1204
+ repoUrl: "https://github.com/storybookjs/storybook.git"
1205
+ },
1206
+ {
1207
+ name: "@storybook/addon-links",
1208
+ version: "10.2.0",
1209
+ licenseType: "MIT",
1210
+ repoUrl: "https://github.com/storybookjs/storybook.git"
1211
+ },
1212
+ {
1213
+ name: "@storybook/addon-onboarding",
1214
+ version: "10.2.0",
1215
+ licenseType: "MIT",
1216
+ repoUrl: "https://github.com/storybookjs/storybook.git"
1217
+ },
1218
+ {
1219
+ name: "@storybook/addon-vitest",
1220
+ version: "10.2.0",
1221
+ licenseType: "MIT",
1222
+ repoUrl: "https://github.com/storybookjs/storybook.git"
1223
+ },
1224
+ {
1225
+ name: "@types/node",
1226
+ version: "25.0.9",
1227
+ licenseType: "MIT",
1228
+ repoUrl: "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
1229
+ licenceUrl: "https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/LICENSE"
1230
+ },
1231
+ {
1232
+ name: "@vitest/browser",
1233
+ version: "4.0.17",
1234
+ licenseType: "MIT",
1235
+ repoUrl: "https://github.com/vitest-dev/vitest.git",
1236
+ licenceUrl: "https://github.com/vitest-dev/vitest/blob/master/LICENSE"
1237
+ },
1238
+ {
1239
+ name: "@vitest/coverage-v8",
1240
+ version: "4.0.17",
1241
+ licenseType: "MIT",
1242
+ repoUrl: "https://github.com/vitest-dev/vitest.git",
1243
+ licenceUrl: "https://github.com/vitest-dev/vitest/blob/master/LICENSE"
1244
+ },
1245
+ {
1246
+ name: "@vitest/ui",
1247
+ version: "4.0.17",
1248
+ licenseType: "MIT",
1249
+ repoUrl: "https://github.com/vitest-dev/vitest.git",
1250
+ licenceUrl: "https://github.com/vitest-dev/vitest/blob/master/LICENSE"
1251
+ },
1252
+ {
1253
+ name: "dotenv-cli",
1254
+ version: "11.0.0",
1255
+ licenseType: "MIT",
1256
+ repoUrl: "https://www.npmjs.com/package/dotenv-cli"
1257
+ },
1258
+ {
1259
+ name: "jsdom",
1260
+ version: "27.4.0",
1261
+ licenseType: "MIT",
1262
+ repoUrl: "https://github.com/jsdom/jsdom.git"
1263
+ },
1264
+ {
1265
+ name: "node-html-parser",
1266
+ version: "7.0.2",
1267
+ licenseType: "MIT",
1268
+ repoUrl: "https://github.com/taoqf/node-fast-html-parser.git",
1269
+ licenceUrl: "https://github.com/taoqf/node-fast-html-parser/blob/master/LICENSE"
1270
+ },
1271
+ {
1272
+ name: "sass",
1273
+ version: "1.97.2",
1274
+ licenseType: "MIT",
1275
+ repoUrl: "https://github.com/sass/dart-sass",
1276
+ licenceUrl: "https://github.com/sass/dart-sass/blob/master/LICENSE"
1277
+ },
1278
+ {
1279
+ name: "storybook",
1280
+ version: "10.2.0",
1281
+ licenseType: "MIT",
1282
+ repoUrl: "https://github.com/storybookjs/storybook.git"
1283
+ },
1284
+ {
1285
+ name: "storybook-solidjs-vite",
1286
+ version: "10.0.9",
1287
+ licenseType: "MIT",
1288
+ repoUrl: "https://github.com/solidjs-community/storybook.git",
1289
+ licenceUrl: "https://github.com/solidjs-community/storybook/blob/master/LICENSE"
1290
+ },
1291
+ {
1292
+ name: "tsup",
1293
+ version: "8.5.1",
1294
+ licenseType: "MIT",
1295
+ repoUrl: "https://github.com/egoist/tsup.git",
1296
+ licenceUrl: "https://github.com/egoist/tsup/blob/master/LICENSE"
1297
+ },
1298
+ {
1299
+ name: "tsup-preset-solid",
1300
+ version: "2.2.0",
1301
+ licenseType: "MIT",
1302
+ repoUrl: "https://github.com/solidjs-community/tsup-preset-solid.git",
1303
+ licenceUrl: "https://github.com/solidjs-community/tsup-preset-solid/blob/master/LICENSE"
1304
+ },
1305
+ {
1306
+ name: "typescript",
1307
+ version: "5.9.3",
1308
+ licenseType: "Apache-2.0",
1309
+ repoUrl: "https://github.com/microsoft/TypeScript.git"
1310
+ },
1311
+ {
1312
+ name: "vite",
1313
+ version: "7.3.1",
1314
+ licenseType: "MIT",
1315
+ repoUrl: "https://github.com/vitejs/vite.git"
1316
+ },
1317
+ {
1318
+ name: "vite-plugin-solid",
1319
+ version: "2.11.10",
1320
+ licenseType: "MIT",
1321
+ repoUrl: "https://github.com/solidjs/vite-plugin-solid.git"
1322
+ },
1323
+ {
1324
+ name: "vitest",
1325
+ version: "4.0.17",
1326
+ licenseType: "MIT",
1327
+ repoUrl: "https://github.com/vitest-dev/vitest.git"
1328
+ }
1329
+ ]
1330
+ }
1254
1331
  };
1255
1332
 
1256
1333
  // src/helpers/metaHelper.ts
@@ -1401,6 +1478,38 @@ var defaultSiteColour = {
1401
1478
  primary: "#97A571",
1402
1479
  secondary: "#97A571"
1403
1480
  };
1481
+ var TranslationService = class {
1482
+ constructor(log, _config) {
1483
+ this._config = _config;
1484
+ this._logger = log.getLogger("TranslationService");
1485
+ }
1486
+ _logger;
1487
+ _tolgee;
1488
+ initialize = async () => {
1489
+ if (this._tolgee != null) return;
1490
+ this._tolgee = Tolgee().use(DevTools()).use(FormatIcu()).use(
1491
+ BackendFetch({
1492
+ prefix: "/assets/i18n",
1493
+ fallbackOnFail: true
1494
+ })
1495
+ ).init({
1496
+ defaultLanguage: "en",
1497
+ observerType: "text",
1498
+ observerOptions: { inputPrefix: "{{", inputSuffix: "}}" },
1499
+ // Dev mode only 👇
1500
+ apiKey: this._config.getTolgeeApiKey(),
1501
+ apiUrl: this._config.getTolgeeApiUrl(),
1502
+ projectId: this._config.getTolgeeProjectId()
1503
+ });
1504
+ await this._tolgee.run();
1505
+ this._logger.d("Tolgee initialised!");
1506
+ };
1507
+ instance = () => this._tolgee;
1508
+ t = (key, defaultValue, options) => (
1509
+ // this._tolgee.t(key, defaultValue, options);
1510
+ this._tolgee?.t?.(key, defaultValue, options) ?? defaultValue ?? key
1511
+ );
1512
+ };
1404
1513
 
1405
1514
  // src/validation/arrayValidation.ts
1406
1515
  var minItems = (minLength2) => (values) => {
@@ -1597,4 +1706,4 @@ var shouldBeYoutubeUrl = (value) => {
1597
1706
  };
1598
1707
  };
1599
1708
 
1600
- export { APP_TYPE_TOKEN, ActivityRestriction, ActivityType, AddressLinkType, AddressRestriction, AnswerLinkType, AnswerRestriction, AppType, BOT_PATH_TOKEN, BookingAddonRestriction, BookingAddonType, BookingRestriction, BookingStatusType, CommentLinkType, CommentRestriction, CommonConfigService, DependencyInjectionContainer, DrivingRouteRestriction, LogService, MembershipStatus, MembershipType, MouseButton, NetworkState, OrderDirectionType, PermissionRestriction, PermissionType, PetRestriction, PetSexType, PetStatusType, PetType, QuestionForType, QuestionRestriction, QuestionType, SITE_CONFIG_TOKEN, SearchableColumnType, UnavailabilityRestriction, UploadLinkType, UploadRestriction, UploadType, UserAccountFlagType, UserRestriction, UserType, addDays, addMinutes, addMonths, addSeconds, addSpacesForEnum, addToParallelTasks, anyObject, apiRoute, apiRouteParam, arrayContains, arrayOfNLength, capitalizeFirstLetter, changeMonth, colourPalette, convertToDate, convertToFullDateSelection, createToken, cyrb53, dateDiffInDays, debounceLeading, defaultSiteColour, fakePromise, formatDate, formatFileSize, formatForBookingDate, formatForDateDropdown, formatForDateLocal, formatForDateLocalDetailed, formatForDateOfBirth, formatForDateWithTime, getAgeInYears, getAllPetQuestionForType, getAppType, getArrFromEnum, getBotPath, getCalendarDropdownDisplayValue, getCalendarDropdownForDateOfBirthDisplayValue, getCommonConfig, getDayClassObject, getDayElements, getDayHeadingElements, getImageParams, getLog, getMeta, getMimeTypeFromExtension, getPackagesUsed, getPayloadFromJwt, getPerformanceTimer, getPetAvatarUrl, getSiteColour, getSiteConfig, getUserAvatarUrl, getUsersName, getWeekNumber, hasRequiredPermissions, isBefore, isDateAfterStart, isDateBeforeEnd, isDateDisabledByDisabledDays, isDateEnabledByEnabledDays, isNumber, isSameDay, isWebApp, lowercaseFirstLetter, makeArrayOrDefault, maxDate, maxItems, maxLength, mimeTypeLookup, minDate, minItems, minLength, minUrlLength, monthTranslationKeyOrder, multiValidation, nameof, noValidation, notNull, onlyUnique, portalGlyphLength, promiseFromValue, randomIntFromRange, randomItemFromArray, rootContainer, rootDependencyInjectionSetup, searchColumns, selectedItemsExist, selectedOptionIsInEnum, separateValidation, setContainerToken, setContainerTokenLazy, setSiteConfig, shouldBeUrl, shouldBeYoutubeUrl, showSecondCalendar, timeout, tryParseNumber, uploadsThatNeedEncryption, urlRef, uuidv4, validUuidChars, validateForEach, webAppTypes, weekdayTranslationKeyOrder };
1709
+ export { APP_TYPE_TOKEN, ActivityRestriction, ActivityType, AddressLinkType, AddressRestriction, AnswerLinkType, AnswerRestriction, AppType, BOT_PATH_TOKEN, BookingAddonRestriction, BookingAddonType, BookingRestriction, BookingStatusType, CommentLinkType, CommentRestriction, CommonConfigService, DependencyInjectionContainer, DrivingRouteRestriction, LogService, MembershipStatus, MembershipType, MouseButton, NetworkState, OrderDirectionType, PermissionRestriction, PermissionType, PetRestriction, PetSexType, PetStatusType, PetType, QuestionForType, QuestionRestriction, QuestionType, SITE_CONFIG_TOKEN, SearchableColumnType, TranslationService, UnavailabilityRestriction, UploadLinkType, UploadRestriction, UploadType, UserAccountFlagType, UserRestriction, UserType, addDays, addMinutes, addMonths, addSeconds, addSpacesForEnum, addToParallelTasks, anyObject, apiRoute, apiRouteParam, arrayContains, arrayOfNLength, capitalizeFirstLetter, changeMonth, colourPalette, convertToDate, convertToFullDateSelection, createToken, cyrb53, dateDiffInDays, debounceLeading, defaultSiteColour, fakePromise, formatDate, formatFileSize, formatForBookingDate, formatForDateDropdown, formatForDateLocal, formatForDateLocalDetailed, formatForDateOfBirth, formatForDateWithTime, getAgeInYears, getAllPetQuestionForType, getAppType, getArrFromEnum, getBotPath, getCalendarDropdownDisplayValue, getCalendarDropdownForDateOfBirthDisplayValue, getCommonConfig, getDayClassObject, getDayElements, getDayHeadingElements, getImageParams, getLog, getMeta, getMimeTypeFromExtension, getPackagesUsed, getPayloadFromJwt, getPerformanceTimer, getPetAvatarUrl, getSiteColour, getSiteConfig, getUserAvatarUrl, getUsersName, getWeekNumber, hasRequiredPermissions, isBefore, isDateAfterStart, isDateBeforeEnd, isDateDisabledByDisabledDays, isDateEnabledByEnabledDays, isNumber, isSameDay, isWebApp, lowercaseFirstLetter, makeArrayOrDefault, maxDate, maxItems, maxLength, mimeTypeLookup, minDate, minItems, minLength, minUrlLength, monthTranslationKeyOrder, multiValidation, nameof, noValidation, notNull, onlyUnique, portalGlyphLength, promiseFromValue, randomIntFromRange, randomItemFromArray, rootContainer, rootDependencyInjectionSetup, searchColumns, selectedItemsExist, selectedOptionIsInEnum, separateValidation, setContainerToken, setContainerTokenLazy, setSiteConfig, shouldBeUrl, shouldBeYoutubeUrl, showSecondCalendar, timeout, tryParseNumber, uploadsThatNeedEncryption, urlRef, uuidv4, validUuidChars, validateForEach, webAppTypes, weekdayTranslationKeyOrder };