@nanas-home/hub-common 0.4.227 → 0.6.233
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/chunk/{J6QSO2HN.js → IKM3ISF5.js} +321 -54
- package/dist/index.css +2 -2
- package/dist/node-utils/index.d.ts +3 -3
- package/dist/node-utils/index.js +13 -11
- package/dist/{validation-Dpye2Rqo.d.ts → validation-DYJj1R8j.d.ts} +136 -12
- package/dist/web/index.d.ts +95 -10
- package/dist/web/index.js +683 -124
- package/dist/web/index.jsx +1306 -693
- package/package.json +3 -2
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Service, Token, Container } from '@freshgum/typedi';
|
|
2
2
|
import dayjs from 'dayjs';
|
|
3
|
+
import { FormatIcu } from '@tolgee/format-icu';
|
|
4
|
+
import { Tolgee, DevTools, BackendFetch } from '@tolgee/web';
|
|
3
5
|
import { jwtDecode } from 'jwt-decode';
|
|
4
6
|
|
|
5
7
|
var __defProp = Object.defineProperty;
|
|
@@ -187,6 +189,7 @@ var apiRoute = {
|
|
|
187
189
|
},
|
|
188
190
|
upload: {
|
|
189
191
|
prefix: "/upload",
|
|
192
|
+
image: "/image",
|
|
190
193
|
swagger: { name: "Uploads", description: "Endpoints for managing Uploads" }
|
|
191
194
|
},
|
|
192
195
|
question: {
|
|
@@ -253,6 +256,15 @@ var UploadType = /* @__PURE__ */ ((UploadType2) => {
|
|
|
253
256
|
})(UploadType || {});
|
|
254
257
|
var uploadsThatNeedEncryption = [];
|
|
255
258
|
|
|
259
|
+
// src/contracts/generated/enum/CommentLinkType.ts
|
|
260
|
+
var CommentLinkType = /* @__PURE__ */ ((CommentLinkType2) => {
|
|
261
|
+
CommentLinkType2[CommentLinkType2["Unknown"] = 0] = "Unknown";
|
|
262
|
+
CommentLinkType2[CommentLinkType2["User"] = 1] = "User";
|
|
263
|
+
CommentLinkType2[CommentLinkType2["Pet"] = 2] = "Pet";
|
|
264
|
+
CommentLinkType2[CommentLinkType2["Booking"] = 3] = "Booking";
|
|
265
|
+
return CommentLinkType2;
|
|
266
|
+
})(CommentLinkType || {});
|
|
267
|
+
|
|
256
268
|
// src/contracts/generated/enum/userType.ts
|
|
257
269
|
var UserType = /* @__PURE__ */ ((UserType2) => {
|
|
258
270
|
UserType2[UserType2["Unknown"] = 0] = "Unknown";
|
|
@@ -316,6 +328,13 @@ var NetworkState = /* @__PURE__ */ ((NetworkState2) => {
|
|
|
316
328
|
return NetworkState2;
|
|
317
329
|
})(NetworkState || {});
|
|
318
330
|
|
|
331
|
+
// src/contracts/generated/enum/AddressLinkType.ts
|
|
332
|
+
var AddressLinkType = /* @__PURE__ */ ((AddressLinkType2) => {
|
|
333
|
+
AddressLinkType2[AddressLinkType2["Unknown"] = 0] = "Unknown";
|
|
334
|
+
AddressLinkType2[AddressLinkType2["User"] = 1] = "User";
|
|
335
|
+
return AddressLinkType2;
|
|
336
|
+
})(AddressLinkType || {});
|
|
337
|
+
|
|
319
338
|
// src/contracts/generated/enum/activityType.ts
|
|
320
339
|
var ActivityType = /* @__PURE__ */ ((ActivityType2) => {
|
|
321
340
|
ActivityType2[ActivityType2["Unknown"] = 0] = "Unknown";
|
|
@@ -375,6 +394,14 @@ var PetType = /* @__PURE__ */ ((PetType2) => {
|
|
|
375
394
|
return PetType2;
|
|
376
395
|
})(PetType || {});
|
|
377
396
|
|
|
397
|
+
// src/contracts/generated/enum/AnswerLinkType.ts
|
|
398
|
+
var AnswerLinkType = /* @__PURE__ */ ((AnswerLinkType2) => {
|
|
399
|
+
AnswerLinkType2[AnswerLinkType2["Unknown"] = 0] = "Unknown";
|
|
400
|
+
AnswerLinkType2[AnswerLinkType2["User"] = 1] = "User";
|
|
401
|
+
AnswerLinkType2[AnswerLinkType2["Pet"] = 2] = "Pet";
|
|
402
|
+
return AnswerLinkType2;
|
|
403
|
+
})(AnswerLinkType || {});
|
|
404
|
+
|
|
378
405
|
// src/contracts/generated/enum/userAccountFlagType.ts
|
|
379
406
|
var UserAccountFlagType = /* @__PURE__ */ ((UserAccountFlagType2) => {
|
|
380
407
|
UserAccountFlagType2[UserAccountFlagType2["Unknown"] = 0] = "Unknown";
|
|
@@ -449,6 +476,15 @@ var BOT_PATH = new Token("BOT_PATH");
|
|
|
449
476
|
var getBotPath = () => Container.get(BOT_PATH);
|
|
450
477
|
var APP_TYPE = new Token("APP_TYPE");
|
|
451
478
|
var getAppType = () => Container.get(APP_TYPE);
|
|
479
|
+
var SITE_CONFIG = new Token("SITE_CONFIG");
|
|
480
|
+
var setSiteConfig = (value) => Container.set({ id: SITE_CONFIG, value });
|
|
481
|
+
var getSiteConfig = () => {
|
|
482
|
+
try {
|
|
483
|
+
return Container.get(SITE_CONFIG);
|
|
484
|
+
} catch {
|
|
485
|
+
console.error("unable to get site config. Did you set the config on app startup?");
|
|
486
|
+
}
|
|
487
|
+
};
|
|
452
488
|
var setContainerToken = (id, value) => Container.set({ id, value });
|
|
453
489
|
var getCommonConfig = () => Container.get(CommonConfigService);
|
|
454
490
|
var formatDate = (date, format = "DD MMM YYYY HH:mm") => {
|
|
@@ -1120,15 +1156,6 @@ var PetCreateDtoMeta = {
|
|
|
1120
1156
|
)
|
|
1121
1157
|
}
|
|
1122
1158
|
};
|
|
1123
|
-
var SiteConfigService = class {
|
|
1124
|
-
_site;
|
|
1125
|
-
getConfig = () => this._site;
|
|
1126
|
-
setConfig = (site) => this._site = site;
|
|
1127
|
-
};
|
|
1128
|
-
SiteConfigService = __decorateClass([
|
|
1129
|
-
Service([])
|
|
1130
|
-
], SiteConfigService);
|
|
1131
|
-
var getSiteConfig = () => Container.get(SiteConfigService);
|
|
1132
1159
|
|
|
1133
1160
|
// src/helpers/performanceHelper.ts
|
|
1134
1161
|
var getPerformanceTimer = () => ({
|
|
@@ -1199,15 +1226,15 @@ var stopPropagation = (event) => {
|
|
|
1199
1226
|
|
|
1200
1227
|
// src/assets/meta.json
|
|
1201
1228
|
var meta_default = {
|
|
1202
|
-
packageVersion: "0.
|
|
1203
|
-
date: "2025-07-
|
|
1204
|
-
gitCommitHash: "
|
|
1229
|
+
packageVersion: "0.6.0",
|
|
1230
|
+
date: "2025-07-14",
|
|
1231
|
+
gitCommitHash: "8dc25f3b5c1402f330e87797c2b6a014b2beb380"
|
|
1205
1232
|
};
|
|
1206
1233
|
|
|
1207
1234
|
// src/assets/packagesUsed.json
|
|
1208
1235
|
var packagesUsed_default = {
|
|
1209
|
-
generatedDate: "2025-07-
|
|
1210
|
-
generatedDateFormat: "2025-07-
|
|
1236
|
+
generatedDate: "2025-07-14T14:28:31.636Z",
|
|
1237
|
+
generatedDateFormat: "2025-07-14",
|
|
1211
1238
|
list: [
|
|
1212
1239
|
{
|
|
1213
1240
|
name: "@chromatic-com/storybook",
|
|
@@ -1227,40 +1254,35 @@ var packagesUsed_default = {
|
|
|
1227
1254
|
name: "@storybook/addon-a11y",
|
|
1228
1255
|
version: "9.0.16",
|
|
1229
1256
|
licenseType: "MIT",
|
|
1230
|
-
repoUrl: "https://github.com/storybookjs/storybook.git"
|
|
1231
|
-
licenceUrl: "https://github.com/storybookjs/storybook/blob/master/LICENSE.md"
|
|
1257
|
+
repoUrl: "https://github.com/storybookjs/storybook.git"
|
|
1232
1258
|
},
|
|
1233
1259
|
{
|
|
1234
1260
|
name: "@storybook/addon-docs",
|
|
1235
1261
|
version: "9.0.16",
|
|
1236
1262
|
licenseType: "MIT",
|
|
1237
|
-
repoUrl: "https://github.com/storybookjs/storybook.git"
|
|
1238
|
-
licenceUrl: "https://github.com/storybookjs/storybook/blob/master/LICENSE.md"
|
|
1263
|
+
repoUrl: "https://github.com/storybookjs/storybook.git"
|
|
1239
1264
|
},
|
|
1240
1265
|
{
|
|
1241
1266
|
name: "@storybook/addon-links",
|
|
1242
1267
|
version: "9.0.16",
|
|
1243
1268
|
licenseType: "MIT",
|
|
1244
|
-
repoUrl: "https://github.com/storybookjs/storybook.git"
|
|
1245
|
-
licenceUrl: "https://github.com/storybookjs/storybook/blob/master/LICENSE.md"
|
|
1269
|
+
repoUrl: "https://github.com/storybookjs/storybook.git"
|
|
1246
1270
|
},
|
|
1247
1271
|
{
|
|
1248
1272
|
name: "@storybook/addon-onboarding",
|
|
1249
1273
|
version: "9.0.16",
|
|
1250
1274
|
licenseType: "MIT",
|
|
1251
|
-
repoUrl: "https://github.com/storybookjs/storybook.git"
|
|
1252
|
-
licenceUrl: "https://github.com/storybookjs/storybook/blob/master/LICENSE.md"
|
|
1275
|
+
repoUrl: "https://github.com/storybookjs/storybook.git"
|
|
1253
1276
|
},
|
|
1254
1277
|
{
|
|
1255
1278
|
name: "@storybook/addon-vitest",
|
|
1256
1279
|
version: "9.0.16",
|
|
1257
1280
|
licenseType: "MIT",
|
|
1258
|
-
repoUrl: "https://github.com/storybookjs/storybook.git"
|
|
1259
|
-
licenceUrl: "https://github.com/storybookjs/storybook/blob/master/LICENSE.md"
|
|
1281
|
+
repoUrl: "https://github.com/storybookjs/storybook.git"
|
|
1260
1282
|
},
|
|
1261
1283
|
{
|
|
1262
1284
|
name: "@types/node",
|
|
1263
|
-
version: "24.0.
|
|
1285
|
+
version: "24.0.13",
|
|
1264
1286
|
licenseType: "MIT",
|
|
1265
1287
|
repoUrl: "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
1266
1288
|
licenceUrl: "https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/LICENSE"
|
|
@@ -1289,7 +1311,8 @@ var packagesUsed_default = {
|
|
|
1289
1311
|
{
|
|
1290
1312
|
name: "dotenv-cli",
|
|
1291
1313
|
version: "8.0.0",
|
|
1292
|
-
licenseType: "MIT"
|
|
1314
|
+
licenseType: "MIT",
|
|
1315
|
+
repoUrl: "https://www.npmjs.com/package/dotenv-cli"
|
|
1293
1316
|
},
|
|
1294
1317
|
{
|
|
1295
1318
|
name: "sass",
|
|
@@ -1302,8 +1325,7 @@ var packagesUsed_default = {
|
|
|
1302
1325
|
name: "storybook",
|
|
1303
1326
|
version: "9.0.16",
|
|
1304
1327
|
licenseType: "MIT",
|
|
1305
|
-
repoUrl: "https://github.com/storybookjs/storybook.git"
|
|
1306
|
-
licenceUrl: "https://github.com/storybookjs/storybook/blob/master/LICENSE.md"
|
|
1328
|
+
repoUrl: "https://github.com/storybookjs/storybook.git"
|
|
1307
1329
|
},
|
|
1308
1330
|
{
|
|
1309
1331
|
name: "tsup",
|
|
@@ -1323,29 +1345,25 @@ var packagesUsed_default = {
|
|
|
1323
1345
|
name: "typescript",
|
|
1324
1346
|
version: "5.8.3",
|
|
1325
1347
|
licenseType: "Apache-2.0",
|
|
1326
|
-
repoUrl: "https://github.com/microsoft/TypeScript.git"
|
|
1327
|
-
licenceUrl: "https://github.com/microsoft/TypeScript/blob/master/LICENSE.md"
|
|
1348
|
+
repoUrl: "https://github.com/microsoft/TypeScript.git"
|
|
1328
1349
|
},
|
|
1329
1350
|
{
|
|
1330
1351
|
name: "vite",
|
|
1331
1352
|
version: "7.0.4",
|
|
1332
1353
|
licenseType: "MIT",
|
|
1333
|
-
repoUrl: "https://github.com/vitejs/vite.git"
|
|
1334
|
-
licenceUrl: "https://github.com/vitejs/vite/blob/master/LICENSE.md"
|
|
1354
|
+
repoUrl: "https://github.com/vitejs/vite.git"
|
|
1335
1355
|
},
|
|
1336
1356
|
{
|
|
1337
1357
|
name: "vite-plugin-solid",
|
|
1338
1358
|
version: "2.11.7",
|
|
1339
1359
|
licenseType: "MIT",
|
|
1340
|
-
repoUrl: "https://github.com/solidjs/vite-plugin-solid.git"
|
|
1341
|
-
licenceUrl: "https://github.com/solidjs/vite-plugin-solid/blob/master/LICENSE.md"
|
|
1360
|
+
repoUrl: "https://github.com/solidjs/vite-plugin-solid.git"
|
|
1342
1361
|
},
|
|
1343
1362
|
{
|
|
1344
1363
|
name: "vitest",
|
|
1345
1364
|
version: "3.2.4",
|
|
1346
1365
|
licenseType: "MIT",
|
|
1347
|
-
repoUrl: "https://github.com/vitest-dev/vitest.git"
|
|
1348
|
-
licenceUrl: "https://github.com/vitest-dev/vitest/blob/master/LICENSE.md"
|
|
1366
|
+
repoUrl: "https://github.com/vitest-dev/vitest.git"
|
|
1349
1367
|
}
|
|
1350
1368
|
]
|
|
1351
1369
|
};
|
|
@@ -1379,6 +1397,58 @@ var uuidv4 = () => {
|
|
|
1379
1397
|
return (c === "x" ? r : r & 3 | 8).toString(16);
|
|
1380
1398
|
});
|
|
1381
1399
|
};
|
|
1400
|
+
var TranslationService = class {
|
|
1401
|
+
constructor(log, _config) {
|
|
1402
|
+
this._config = _config;
|
|
1403
|
+
this._logger = log.getLogger("TranslationService");
|
|
1404
|
+
}
|
|
1405
|
+
_logger;
|
|
1406
|
+
_tolgee;
|
|
1407
|
+
initialize = async () => {
|
|
1408
|
+
this._tolgee = Tolgee().use(DevTools()).use(FormatIcu()).use(
|
|
1409
|
+
BackendFetch({
|
|
1410
|
+
prefix: "/assets/i18n",
|
|
1411
|
+
fallbackOnFail: true
|
|
1412
|
+
})
|
|
1413
|
+
).init({
|
|
1414
|
+
defaultLanguage: "en",
|
|
1415
|
+
observerType: "text",
|
|
1416
|
+
observerOptions: { inputPrefix: "{{", inputSuffix: "}}" },
|
|
1417
|
+
// Dev mode only 👇
|
|
1418
|
+
apiKey: this._config.getTolgeeApiKey(),
|
|
1419
|
+
apiUrl: this._config.getTolgeeApiUrl(),
|
|
1420
|
+
projectId: this._config.getTolgeeProjectId()
|
|
1421
|
+
});
|
|
1422
|
+
await this._tolgee.run();
|
|
1423
|
+
this._logger.d("Tolgee initialised!");
|
|
1424
|
+
};
|
|
1425
|
+
instance = () => this._tolgee;
|
|
1426
|
+
t = (key, defaultValue, options) => (
|
|
1427
|
+
// this._tolgee.t(key, defaultValue, options);
|
|
1428
|
+
this._tolgee?.t?.(key, defaultValue, options) ?? defaultValue ?? key
|
|
1429
|
+
);
|
|
1430
|
+
};
|
|
1431
|
+
TranslationService = __decorateClass([
|
|
1432
|
+
Service({ scope: "singleton" }, [LogService, CommonConfigService])
|
|
1433
|
+
], TranslationService);
|
|
1434
|
+
var translate = () => Container.get(TranslationService);
|
|
1435
|
+
|
|
1436
|
+
// src/helpers/formHelper.ts
|
|
1437
|
+
var hasOneOrMoreErrors = (validators) => {
|
|
1438
|
+
const invalidResults = validators.filter((v) => v.isValid != true);
|
|
1439
|
+
if (invalidResults.length > 0) {
|
|
1440
|
+
const errorMessages = [];
|
|
1441
|
+
for (const invalidResult of invalidResults) {
|
|
1442
|
+
if (invalidResult.errorMessageTransKey == null) continue;
|
|
1443
|
+
const errorMessage = translate().t(invalidResult.errorMessageTransKey ?? "error", "error", {
|
|
1444
|
+
...invalidResult.errorMessageParams
|
|
1445
|
+
});
|
|
1446
|
+
errorMessages.push(errorMessage);
|
|
1447
|
+
}
|
|
1448
|
+
return errorMessages;
|
|
1449
|
+
}
|
|
1450
|
+
return null;
|
|
1451
|
+
};
|
|
1382
1452
|
|
|
1383
1453
|
// src/helpers/hashHelper.ts
|
|
1384
1454
|
var cyrb53 = (input, seed = 0) => {
|
|
@@ -1504,6 +1574,35 @@ var getPayloadFromJwt = (token) => {
|
|
|
1504
1574
|
}
|
|
1505
1575
|
};
|
|
1506
1576
|
|
|
1577
|
+
// src/helpers/urlHelper.ts
|
|
1578
|
+
var urlRef = (url) => {
|
|
1579
|
+
const { ref } = getSiteConfig()?.ref ?? anyObject();
|
|
1580
|
+
if (ref == null) return url;
|
|
1581
|
+
if (url.includes("?")) {
|
|
1582
|
+
return url + `&ref=${ref}`;
|
|
1583
|
+
}
|
|
1584
|
+
return url + `?ref=${ref}`;
|
|
1585
|
+
};
|
|
1586
|
+
|
|
1587
|
+
// src/helpers/profileHelper.ts
|
|
1588
|
+
var getUserAvatarUrl = (userUuid) => {
|
|
1589
|
+
return `${getCommonConfig().getHubApiUrl()}${apiRoute.routes.user.prefix}${apiRoute.routes.user.profile.prefix}/${userUuid}/profile.png`;
|
|
1590
|
+
};
|
|
1591
|
+
var getPetAvatarUrl = (petUuid) => {
|
|
1592
|
+
return `${getCommonConfig().getHubApiUrl()}${apiRoute.routes.pet.prefix}${apiRoute.routes.user.profile.prefix}/${petUuid}/profile.png`;
|
|
1593
|
+
};
|
|
1594
|
+
var getQuestionsFromUserTypes = (userTypes) => {
|
|
1595
|
+
const questionTypes = [];
|
|
1596
|
+
if (userTypes.includes(2 /* Host */)) {
|
|
1597
|
+
questionTypes.push(1 /* Host */);
|
|
1598
|
+
}
|
|
1599
|
+
if (userTypes.includes(1 /* Owner */)) {
|
|
1600
|
+
questionTypes.push(2 /* Owner */);
|
|
1601
|
+
questionTypes.push(3 /* Pet */);
|
|
1602
|
+
}
|
|
1603
|
+
return questionTypes;
|
|
1604
|
+
};
|
|
1605
|
+
|
|
1507
1606
|
// src/helpers/commonHelper.ts
|
|
1508
1607
|
var getUsersName = (details) => `${details?.firstName} ${details?.lastName}`;
|
|
1509
1608
|
|
|
@@ -1551,14 +1650,14 @@ LocalStorageService = __decorateClass([
|
|
|
1551
1650
|
], LocalStorageService);
|
|
1552
1651
|
var getLocalStorage = () => Container.get(LocalStorageService);
|
|
1553
1652
|
var CommonStateService = class {
|
|
1554
|
-
_localStorageKey
|
|
1653
|
+
_localStorageKey;
|
|
1555
1654
|
_internalState = {
|
|
1556
1655
|
language: "en",
|
|
1557
1656
|
theme: "dark",
|
|
1558
|
-
isSideBarOpen: true,
|
|
1559
1657
|
auth: void 0
|
|
1560
1658
|
};
|
|
1561
1659
|
constructor(local) {
|
|
1660
|
+
this._localStorageKey = getSiteConfig()?.settings.localStorageKey ?? "nanas-home-common";
|
|
1562
1661
|
const localInitialState = local.get(this._localStorageKey);
|
|
1563
1662
|
if (localInitialState != null) {
|
|
1564
1663
|
this._internalState = {
|
|
@@ -1578,7 +1677,6 @@ var CommonStateService = class {
|
|
|
1578
1677
|
this.saveToLocalStorage(this._internalState);
|
|
1579
1678
|
}
|
|
1580
1679
|
getPermissions = () => this._internalState.auth?.permissions ?? [];
|
|
1581
|
-
getIsSidebarOpen = () => this._internalState?.isSideBarOpen ?? true;
|
|
1582
1680
|
getTheme = () => this._internalState.theme;
|
|
1583
1681
|
};
|
|
1584
1682
|
CommonStateService = __decorateClass([
|
|
@@ -1586,10 +1684,11 @@ CommonStateService = __decorateClass([
|
|
|
1586
1684
|
], CommonStateService);
|
|
1587
1685
|
var getCommonStateService = () => Container.get(CommonStateService);
|
|
1588
1686
|
var DocumentService = class {
|
|
1589
|
-
constructor(_config
|
|
1687
|
+
constructor(_config) {
|
|
1590
1688
|
this._config = _config;
|
|
1591
|
-
this._siteConfig =
|
|
1689
|
+
this._siteConfig = getSiteConfig();
|
|
1592
1690
|
}
|
|
1691
|
+
_siteConfig;
|
|
1593
1692
|
initDebug = () => {
|
|
1594
1693
|
const isProd = this._config.isProd();
|
|
1595
1694
|
if (!isProd) {
|
|
@@ -1601,12 +1700,12 @@ var DocumentService = class {
|
|
|
1601
1700
|
};
|
|
1602
1701
|
isDebugEnabled = () => window.enableDebug ?? false;
|
|
1603
1702
|
setDocumentTitle = (pageTitle) => {
|
|
1604
|
-
const siteTitle = this._siteConfig
|
|
1703
|
+
const siteTitle = this._siteConfig?.title;
|
|
1605
1704
|
const titleSuffix = siteTitle ? ` - ${siteTitle}` : "";
|
|
1606
1705
|
document.title = `${pageTitle}${titleSuffix}`;
|
|
1607
1706
|
};
|
|
1608
1707
|
resetDocumentTitle = () => {
|
|
1609
|
-
document.title = this._siteConfig
|
|
1708
|
+
document.title = this._siteConfig?.title ?? "";
|
|
1610
1709
|
};
|
|
1611
1710
|
addClassToBody = (className) => {
|
|
1612
1711
|
document.body.classList.add(className);
|
|
@@ -1653,7 +1752,7 @@ var DocumentService = class {
|
|
|
1653
1752
|
};
|
|
1654
1753
|
};
|
|
1655
1754
|
DocumentService = __decorateClass([
|
|
1656
|
-
Service({ scope: "singleton" }, [CommonConfigService
|
|
1755
|
+
Service({ scope: "singleton" }, [CommonConfigService])
|
|
1657
1756
|
], DocumentService);
|
|
1658
1757
|
var getDocumentServ = () => Container.get(DocumentService);
|
|
1659
1758
|
|
|
@@ -1721,21 +1820,40 @@ var BaseApiService = class {
|
|
|
1721
1820
|
return response;
|
|
1722
1821
|
}
|
|
1723
1822
|
async post(url, data, manipulateHeaders, customMapper) {
|
|
1823
|
+
return this._internalPost({
|
|
1824
|
+
url,
|
|
1825
|
+
data: JSON.stringify(data),
|
|
1826
|
+
manipulateHeaders,
|
|
1827
|
+
customMapper
|
|
1828
|
+
});
|
|
1829
|
+
}
|
|
1830
|
+
async postForm(url, data, manipulateHeaders, customMapper) {
|
|
1831
|
+
return this._internalPost({
|
|
1832
|
+
url,
|
|
1833
|
+
data,
|
|
1834
|
+
manipulateHeaders,
|
|
1835
|
+
customMapper
|
|
1836
|
+
});
|
|
1837
|
+
}
|
|
1838
|
+
async _internalPost(props) {
|
|
1724
1839
|
let options = anyObject();
|
|
1725
|
-
if (manipulateHeaders != null) {
|
|
1726
|
-
options = { headers: manipulateHeaders?.() };
|
|
1840
|
+
if (props.manipulateHeaders != null) {
|
|
1841
|
+
options = { headers: props.manipulateHeaders?.() };
|
|
1727
1842
|
}
|
|
1843
|
+
const defaultHeaders = props.doNotAddDefaultHeaders ? anyObject() : {
|
|
1844
|
+
Accept: "application/json",
|
|
1845
|
+
"Content-Type": "application/json"
|
|
1846
|
+
};
|
|
1728
1847
|
let result;
|
|
1729
1848
|
try {
|
|
1730
|
-
result = await fetch(`${this._baseUrl}${url}`, {
|
|
1849
|
+
result = await fetch(`${this._baseUrl}${props.url}`, {
|
|
1731
1850
|
...options,
|
|
1732
1851
|
method: "POST",
|
|
1733
1852
|
headers: {
|
|
1734
|
-
|
|
1735
|
-
"Content-Type": "application/json",
|
|
1853
|
+
...defaultHeaders,
|
|
1736
1854
|
...options.headers
|
|
1737
1855
|
},
|
|
1738
|
-
body:
|
|
1856
|
+
body: props.data
|
|
1739
1857
|
});
|
|
1740
1858
|
this._interceptor(result);
|
|
1741
1859
|
if (result.ok == false) {
|
|
@@ -1753,8 +1871,8 @@ ${errorJson.message}`
|
|
|
1753
1871
|
errorMessage: result.statusText
|
|
1754
1872
|
};
|
|
1755
1873
|
}
|
|
1756
|
-
if (customMapper != null) {
|
|
1757
|
-
return customMapper(result);
|
|
1874
|
+
if (props.customMapper != null) {
|
|
1875
|
+
return props.customMapper(result);
|
|
1758
1876
|
}
|
|
1759
1877
|
} catch (ex) {
|
|
1760
1878
|
this.logger.i("BaseApiService post", ex?.toString?.());
|
|
@@ -1910,6 +2028,82 @@ UserApiService = __decorateClass([
|
|
|
1910
2028
|
Service([LogService, CommonConfigService])
|
|
1911
2029
|
], UserApiService);
|
|
1912
2030
|
var getUserApiService = () => Container.get(UserApiService);
|
|
2031
|
+
var PetApiService = class extends BaseCrudService {
|
|
2032
|
+
prefix = apiRoute.routes.pet.prefix;
|
|
2033
|
+
constructor(log, config) {
|
|
2034
|
+
super(
|
|
2035
|
+
apiRoute.routes.pet.prefix,
|
|
2036
|
+
//
|
|
2037
|
+
log.getLogger("PetApiService"),
|
|
2038
|
+
config
|
|
2039
|
+
);
|
|
2040
|
+
}
|
|
2041
|
+
getForUserUuid = (userUuid) => this.get(`${this.prefix}${apiRoute.routes.user.prefix}/${userUuid}`, addAccessTokenToHeaders);
|
|
2042
|
+
};
|
|
2043
|
+
PetApiService = __decorateClass([
|
|
2044
|
+
Service([LogService, CommonConfigService])
|
|
2045
|
+
], PetApiService);
|
|
2046
|
+
var getPetApiService = () => Container.get(PetApiService);
|
|
2047
|
+
var UserPermissionApiService = class extends BaseApiService {
|
|
2048
|
+
prefix = apiRoute.routes.userPermission.prefix;
|
|
2049
|
+
constructor(log, config) {
|
|
2050
|
+
const apiUrl = config.getHubApiUrl();
|
|
2051
|
+
super(apiUrl, log.getLogger("UserPermissionApiService"));
|
|
2052
|
+
}
|
|
2053
|
+
getForUserUuid = (userUuid) => this.get(`${this.prefix}/${userUuid}`, addAccessTokenToHeaders);
|
|
2054
|
+
addPermissionToUser = (userUuid, permissionType) => this.put(`${this.prefix}/${userUuid}/${permissionType}`, null, addAccessTokenToHeaders);
|
|
2055
|
+
removePermissionFromUser = (userUuid, permissionType) => this.delete(`${this.prefix}/${userUuid}/${permissionType}`, addAccessTokenToHeaders);
|
|
2056
|
+
};
|
|
2057
|
+
UserPermissionApiService = __decorateClass([
|
|
2058
|
+
Service([LogService, CommonConfigService])
|
|
2059
|
+
], UserPermissionApiService);
|
|
2060
|
+
var getUserPermissionApiService = () => Container.get(UserPermissionApiService);
|
|
2061
|
+
var UploadApiService = class extends BaseApiService {
|
|
2062
|
+
_prefix = apiRoute.routes.upload.prefix;
|
|
2063
|
+
constructor(log, config) {
|
|
2064
|
+
const apiUrl = config.getHubApiUrl();
|
|
2065
|
+
super(apiUrl, log.getLogger("UploadApiService"));
|
|
2066
|
+
}
|
|
2067
|
+
create = async (dto) => this.post(this._prefix, dto, addAccessTokenToHeaders);
|
|
2068
|
+
read = (uuid) => this.get(`${this._prefix}/${uuid}`, addAccessTokenToHeaders);
|
|
2069
|
+
readPage = (pagination) => this.get(`${this._prefix}?${getPaginationQueryParams(pagination)}`, addAccessTokenToHeaders);
|
|
2070
|
+
search = (pagination) => this.get(`${this._prefix}?${getPaginationQueryParams(pagination)}`, addAccessTokenToHeaders);
|
|
2071
|
+
uploadFile = (data) => {
|
|
2072
|
+
const formData = new FormData();
|
|
2073
|
+
formData.append("file", data.file);
|
|
2074
|
+
formData.append("linkUuid", data.linkUuid);
|
|
2075
|
+
formData.append("type", data.type.toString());
|
|
2076
|
+
formData.append("linkType", data.linkType.toString());
|
|
2077
|
+
return this.postForm(`${this._prefix}${apiRoute.routes.upload.image}`, formData, addAccessTokenToHeaders);
|
|
2078
|
+
};
|
|
2079
|
+
update = (item) => {
|
|
2080
|
+
throw "not implemented";
|
|
2081
|
+
};
|
|
2082
|
+
del = (item) => {
|
|
2083
|
+
throw "not implemented";
|
|
2084
|
+
};
|
|
2085
|
+
};
|
|
2086
|
+
UploadApiService = __decorateClass([
|
|
2087
|
+
Service([LogService, CommonConfigService])
|
|
2088
|
+
], UploadApiService);
|
|
2089
|
+
var getUploadApiService = () => Container.get(UploadApiService);
|
|
2090
|
+
var QuestionApiService = class extends BaseCrudService {
|
|
2091
|
+
prefix = apiRoute.routes.question.prefix;
|
|
2092
|
+
constructor(log, config) {
|
|
2093
|
+
super(
|
|
2094
|
+
apiRoute.routes.question.prefix,
|
|
2095
|
+
//
|
|
2096
|
+
log.getLogger("QuestionApiService"),
|
|
2097
|
+
config
|
|
2098
|
+
);
|
|
2099
|
+
}
|
|
2100
|
+
// getForUserUuid = (userUuid: string): Promise<ResultWithValue<Array<PetDto>>> =>
|
|
2101
|
+
// this.get(`${this.prefix}${apiRoute.routes.user.prefix}/${userUuid}`, addAccessTokenToHeaders);
|
|
2102
|
+
};
|
|
2103
|
+
QuestionApiService = __decorateClass([
|
|
2104
|
+
Service([LogService, CommonConfigService])
|
|
2105
|
+
], QuestionApiService);
|
|
2106
|
+
var getQuestionApiService = () => Container.get(QuestionApiService);
|
|
1913
2107
|
var ProfileApiService = class extends BaseApiService {
|
|
1914
2108
|
prefix = apiRoute.routes.user.prefix;
|
|
1915
2109
|
constructor(log, config) {
|
|
@@ -1924,7 +2118,7 @@ var ProfileApiService = class extends BaseApiService {
|
|
|
1924
2118
|
// });
|
|
1925
2119
|
update = (profile) => this.post(`${this.prefix}${apiRoute.routes.user.profile.prefix}`, profile, addAccessTokenToHeaders);
|
|
1926
2120
|
getQuestionsAndAnswers = (payload) => async () => this.post(
|
|
1927
|
-
`${this.prefix}${apiRoute.routes.user.profile.answers}`,
|
|
2121
|
+
`${this.prefix}${apiRoute.routes.user.profile.prefix}${apiRoute.routes.user.profile.answers}`,
|
|
1928
2122
|
payload,
|
|
1929
2123
|
addAccessTokenToHeaders
|
|
1930
2124
|
);
|
|
@@ -1933,6 +2127,40 @@ ProfileApiService = __decorateClass([
|
|
|
1933
2127
|
Service([LogService, CommonConfigService, CommonStateService])
|
|
1934
2128
|
], ProfileApiService);
|
|
1935
2129
|
var getProfileApiService = () => Container.get(ProfileApiService);
|
|
2130
|
+
var ActivityApiService = class extends BaseCrudService {
|
|
2131
|
+
prefix = apiRoute.routes.activity.prefix;
|
|
2132
|
+
constructor(log, config) {
|
|
2133
|
+
super(
|
|
2134
|
+
apiRoute.routes.activity.prefix,
|
|
2135
|
+
//
|
|
2136
|
+
log.getLogger("ActivityApiService"),
|
|
2137
|
+
config
|
|
2138
|
+
);
|
|
2139
|
+
}
|
|
2140
|
+
getPagedForUserUuid = (userUuid, pagination) => this.get(`${this.prefix}/${userUuid}?${getPaginationQueryParams(pagination)}`, addAccessTokenToHeaders);
|
|
2141
|
+
};
|
|
2142
|
+
ActivityApiService = __decorateClass([
|
|
2143
|
+
Service([LogService, CommonConfigService])
|
|
2144
|
+
], ActivityApiService);
|
|
2145
|
+
var getActivityApiService = () => Container.get(ActivityApiService);
|
|
2146
|
+
var CommentApiService = class extends BaseApiService {
|
|
2147
|
+
prefix = apiRoute.routes.comment.prefix;
|
|
2148
|
+
constructor(log, config) {
|
|
2149
|
+
const apiUrl = config.getHubApiUrl();
|
|
2150
|
+
super(apiUrl, log.getLogger("CommentApiService"));
|
|
2151
|
+
}
|
|
2152
|
+
getByLinks = (linkUuid, linkType, pagination) => async () => this.get(
|
|
2153
|
+
`${this.prefix}${apiRoute.routes.comment.byLink}/${linkUuid}/${linkType}?${getPaginationQueryParams(
|
|
2154
|
+
pagination
|
|
2155
|
+
)}`,
|
|
2156
|
+
addAccessTokenToHeaders
|
|
2157
|
+
);
|
|
2158
|
+
create = async (dto) => this.post(this.prefix, dto, addAccessTokenToHeaders);
|
|
2159
|
+
};
|
|
2160
|
+
CommentApiService = __decorateClass([
|
|
2161
|
+
Service([LogService, CommonConfigService])
|
|
2162
|
+
], CommentApiService);
|
|
2163
|
+
var getCommentApiService = () => Container.get(CommentApiService);
|
|
1936
2164
|
var AuthApiService = class extends BaseApiService {
|
|
1937
2165
|
prefix = apiRoute.routes.auth.prefix;
|
|
1938
2166
|
constructor(log, config) {
|
|
@@ -1946,6 +2174,45 @@ AuthApiService = __decorateClass([
|
|
|
1946
2174
|
Service([LogService, CommonConfigService])
|
|
1947
2175
|
], AuthApiService);
|
|
1948
2176
|
var getAuthApiService = () => Container.get(AuthApiService);
|
|
2177
|
+
var BookingApiService = class extends BaseCrudService {
|
|
2178
|
+
prefix = apiRoute.routes.booking.prefix;
|
|
2179
|
+
constructor(log, config) {
|
|
2180
|
+
super(
|
|
2181
|
+
apiRoute.routes.booking.prefix,
|
|
2182
|
+
//
|
|
2183
|
+
log.getLogger("BookingApiService"),
|
|
2184
|
+
config
|
|
2185
|
+
);
|
|
2186
|
+
}
|
|
2187
|
+
getForUserUuid = (userUuid) => this.get(`${this.prefix}${apiRoute.routes.user.prefix}/${userUuid}`, addAccessTokenToHeaders);
|
|
2188
|
+
};
|
|
2189
|
+
BookingApiService = __decorateClass([
|
|
2190
|
+
Service([LogService, CommonConfigService])
|
|
2191
|
+
], BookingApiService);
|
|
2192
|
+
var getBookingApiService = () => Container.get(BookingApiService);
|
|
2193
|
+
var AddressApiService = class extends BaseCrudService {
|
|
2194
|
+
prefix = apiRoute.routes.address.prefix;
|
|
2195
|
+
constructor(log, config) {
|
|
2196
|
+
super(
|
|
2197
|
+
apiRoute.routes.address.prefix,
|
|
2198
|
+
//
|
|
2199
|
+
log.getLogger("AddressApiService"),
|
|
2200
|
+
config
|
|
2201
|
+
);
|
|
2202
|
+
}
|
|
2203
|
+
getByLinks = (linkUuid, linkType) => async () => this.get(
|
|
2204
|
+
`${this.prefix}${apiRoute.routes.address.byLink}/${linkUuid}/${linkType}`,
|
|
2205
|
+
addAccessTokenToHeaders
|
|
2206
|
+
);
|
|
2207
|
+
lookupGps = async (uuid) => this.get(
|
|
2208
|
+
`${this.prefix}${apiRoute.routes.address.lookup}/${uuid}`,
|
|
2209
|
+
addAccessTokenToHeaders
|
|
2210
|
+
);
|
|
2211
|
+
};
|
|
2212
|
+
AddressApiService = __decorateClass([
|
|
2213
|
+
Service([LogService, CommonConfigService])
|
|
2214
|
+
], AddressApiService);
|
|
2215
|
+
var getAddressApiService = () => Container.get(AddressApiService);
|
|
1949
2216
|
var CaptchaService = class {
|
|
1950
2217
|
constructor(log, _config) {
|
|
1951
2218
|
this._config = _config;
|
|
@@ -2048,4 +2315,4 @@ var validUuidChars = [
|
|
|
2048
2315
|
"F"
|
|
2049
2316
|
];
|
|
2050
2317
|
|
|
2051
|
-
export { APP_TYPE, ActivityRestriction, ActivityType, AddressCreateDtoMeta, AddressRestriction, AnswerRestriction, AppType, AuthApiService, AuthLoginDtoMeta, AuthSignupDtoMeta, BOT_PATH, BaseApiService, BaseCrudService, BookingAddonRestriction, BookingAddonType, BookingCreateDtoMeta, BookingRestriction, BookingStatusType, CaptchaService, CommentRestriction, CommonConfigService, CommonStateService, DocumentService, DrivingRouteRestriction, LocalStorageKeys, LocalStorageService, LogService, MembershipRestriction, MembershipStatus, NetworkState, OrderDirectionType, PermissionRestriction, PermissionType, PetCreateDtoMeta, PetRestriction, PetSexType, PetStatusType, PetType, ProfileApiService, ProfileUpdateDtoMeta, QuestionCreateDtoMeta, QuestionForType, QuestionRestriction, QuestionType,
|
|
2318
|
+
export { APP_TYPE, ActivityApiService, ActivityRestriction, ActivityType, AddressApiService, AddressCreateDtoMeta, AddressLinkType, AddressRestriction, AnswerLinkType, AnswerRestriction, AppType, AuthApiService, AuthLoginDtoMeta, AuthSignupDtoMeta, BOT_PATH, BaseApiService, BaseCrudService, BookingAddonRestriction, BookingAddonType, BookingApiService, BookingCreateDtoMeta, BookingRestriction, BookingStatusType, CaptchaService, CommentApiService, CommentLinkType, CommentRestriction, CommonConfigService, CommonStateService, DocumentService, DrivingRouteRestriction, LocalStorageKeys, LocalStorageService, LogService, MembershipRestriction, MembershipStatus, NetworkState, OrderDirectionType, PermissionRestriction, PermissionType, PetApiService, PetCreateDtoMeta, PetRestriction, PetSexType, PetStatusType, PetType, ProfileApiService, ProfileUpdateDtoMeta, QuestionApiService, QuestionCreateDtoMeta, QuestionForType, QuestionRestriction, QuestionType, SITE_CONFIG, TranslationService, UnavailabilityRestriction, UploadApiService, UploadCreateDtoMeta, UploadLinkType, UploadRestriction, UploadType, UserAccountFlagType, UserApiService, UserCreateDtoMeta, UserDtoMeta, UserPermissionApiService, UserRestriction, UserType, __decorateClass, addAccessTokenToHeaders, addDays, addMinutes, addSeconds, addSpacesForEnum, addToParallelTasks, anyObject, apiParams, apiRoute, arrayContains, arrayOfNLength, capitalizeFirstLetter, cyrb53, dateDiffInDays, debounceLeading, fakePromise, formDataWithAccessTokenHeaders, formatDate, formatFileSize, formatForBookingDate, formatForDateDropdown, formatForDateLocal, formatForDateLocalDetailed, formatForDateOfBirth, formatForDateWithTime, getActivityApiService, getAddressApiService, getAgeInYears, getAppType, getArrFromEnum, getAuthApiService, getBookingApiService, getBotPath, getCaptchaService, getCommentApiService, getCommonConfig, getCommonStateService, getDefaultDtoMeta, getDocumentServ, getImageParams, getLocalStorage, getLog, getMeta, getMimeTypeFromExtension, getPackagesUsed, getPaginationQueryParams, getPayloadFromJwt, getPerformanceTimer, getPetApiService, getPetAvatarUrl, getProfileApiService, getQuestionApiService, getQuestionsFromUserTypes, getSiteConfig, getUploadApiService, getUserApiService, getUserAvatarUrl, getUserPermissionApiService, getUsersName, getWeekNumber, hasOneOrMoreErrors, isBefore, isNumber, isSameDay, isWebApp, lowercaseFirstLetter, makeArrayOrDefault, maxDate, maxItems, maxLength, mimeTypeLookup, minDate, minItems, minLength, minUrlLength, multiValidation, nameof, noValidation, notNull, onTargetFiles, onTargetValue, onlyUnique, portalGlyphLength, preventDefault, randomIntFromRange, randomItemFromArray, selectedItemsExist, separateValidation, setContainerToken, setSiteConfig, shouldBeUrl, shouldBeYoutubeUrl, stopPropagation, timeout, translate, uploadsThatNeedEncryption, urlRef, uuidv4, validUuidChars, validateForEach, webAppTypes };
|