@nanas-home/hub-common 0.49.1064 → 0.51.1149

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,7 +1,5 @@
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';
5
3
 
6
4
  // src/constants/appType.ts
7
5
  var AppType = /* @__PURE__ */ ((AppType2) => {
@@ -59,6 +57,14 @@ var socialLinks = {
59
57
  facebook: "https://www.facebook.com/NanasHomePetConcierge/",
60
58
  linkedin: "https://www.linkedin.com/company/nanas-home-petconcierge/"
61
59
  };
60
+ var commonEmailLinks = {
61
+ instagramLink: "https://www.instagram.com/nanas.home.petconcierge/",
62
+ facebookLink: "https://www.facebook.com/NanasHomePetConcierge/",
63
+ linkedInLink: "https://www.linkedin.com/company/nanas-home-petconcierge/",
64
+ websiteLink: "https://nanashome.club",
65
+ termsAndConditionsLink: "https://nanashome.club/terms-and-conditions.html",
66
+ privacyPolicyLink: "https://nanashome.club/privacy-policy.html"
67
+ };
62
68
 
63
69
  // src/constants/mouseEvent.ts
64
70
  var MouseButton = {
@@ -92,6 +98,13 @@ var validUuidChars = [
92
98
  // src/contracts/dependencyInjection.ts
93
99
  var createToken = (description) => ({ id: Symbol(description) });
94
100
 
101
+ // src/contracts/generated/activity.ts
102
+ var activityShortCode = {
103
+ startIdentifier: "{[|",
104
+ separator: "+",
105
+ endIdentifier: "|]}"
106
+ };
107
+
95
108
  // src/contracts/generated/apiRoute.ts
96
109
  var apiRouteParam = {
97
110
  userUuid: ":userUuid",
@@ -101,7 +114,6 @@ var apiRouteParam = {
101
114
  bookingAddonUuid: ":bookingAddonUuid",
102
115
  userMembershipUuid: ":userMembershipUuid",
103
116
  bugReportUuid: ":bugReportUuid",
104
- linkTypeUuid: ":linkTypeUuid",
105
117
  linkUuid: ":linkUuid",
106
118
  linkType: ":linkType",
107
119
  // Stripe
@@ -116,19 +128,16 @@ var apiRoute = {
116
128
  devJwt: "/jwt",
117
129
  login: "/login",
118
130
  signup: "/signup",
119
- confirmEmail: `/confirm-email/${apiRouteParam.linkTypeUuid}`,
131
+ signupQuestions: "/signup-questions",
132
+ confirmEmail: `/confirm-email/${apiRouteParam.linkUuid}`,
133
+ requestPasswordResetLink: `/password-reset`,
134
+ passwordResetFromTempLink: `/password-reset/${apiRouteParam.linkUuid}`,
120
135
  swagger: { name: "Auth", description: "Endpoints for login, sign up etc" },
121
136
  token: {
122
137
  prefix: "/token",
123
138
  swagger: { name: "AuthToken", description: "Endpoints for creating an API token" }
124
139
  }
125
140
  },
126
- bugReport: {
127
- prefix: "/bug-report",
128
- getAllForUser: "/user",
129
- submit: "/user",
130
- swagger: { name: "BugReports", description: "Endpoints for Users to submit BugReports" }
131
- },
132
141
  version: "/version"
133
142
  },
134
143
  admin: {
@@ -252,6 +261,12 @@ var apiRoute = {
252
261
  removeToBooking: `/${apiRouteParam.bookingAddonUuid}`,
253
262
  swagger: { name: "BookingAddons", description: "Endpoints for User to manage their Booking Addons" }
254
263
  },
264
+ bugReport: {
265
+ prefix: "/bug-report",
266
+ getAllForUser: "/user",
267
+ submit: "/user",
268
+ swagger: { name: "BugReports", description: "Endpoints for Users to submit BugReports" }
269
+ },
255
270
  membership: {
256
271
  prefix: "/membership",
257
272
  getAll: "",
@@ -697,8 +712,15 @@ var AnswerRestriction = {
697
712
  notes: { minLength: 0, maxLength: 1e3 }
698
713
  };
699
714
 
715
+ // src/contracts/generated/restrictions/authRestriction.ts
716
+ var AuthRegisterRestriction = {
717
+ pets: { minItems: 1, maxItems: 5 },
718
+ answers: { minItems: 3, maxItems: 50 }
719
+ };
720
+
700
721
  // src/contracts/generated/restrictions/bookingRestriction.ts
701
722
  var BookingRestriction = {
723
+ code: { min: 0, max: 99999 },
702
724
  notes: { maxLength: 250 }
703
725
  };
704
726
  var BookingAddonRestriction = {
@@ -812,7 +834,7 @@ var searchColumns = {
812
834
  userMembership: [{ "property": "status", "type": 0, "subType": "MembershipStatus" }, { "property": "billingCycle", "type": 0, "subType": "MembershipBillingCycleType" }, { "property": "stripeSubscriptionId", "type": 2 }, { "property": "startDate", "type": 5 }, { "property": "endDate", "type": 5 }],
813
835
  user: [{ "property": "types", "type": 1 }, { "property": "firstName", "type": 2 }, { "property": "lastName", "type": 2 }, { "property": "email", "type": 2 }, { "property": "hubspotId", "type": 2 }, { "property": "flags", "type": 1 }, { "property": "dateCreated", "type": 5 }],
814
836
  upload: [{ "property": "linkUuid", "type": 2 }, { "property": "linkType", "type": 2 }, { "property": "type", "type": 2 }, { "property": "fileName", "type": 2 }, { "property": "blobType", "type": 2 }, { "property": "sizeInKb", "type": 2 }, { "property": "dateCreated", "type": 5 }],
815
- booking: [{ "property": "startDate", "type": 5 }, { "property": "endDate", "type": 5 }, { "property": "status", "type": 2 }, { "property": "notes", "type": 2 }, { "property": "dateCreated", "type": 5 }],
837
+ booking: [{ "property": "code", "type": 2 }, { "property": "status", "type": 1 }, { "property": "startDate", "type": 5 }, { "property": "endDate", "type": 5 }, { "property": "notes", "type": 2 }, { "property": "dateCreated", "type": 5 }],
816
838
  bugReport: [{ "property": "status", "type": 0 }, { "property": "comment", "type": 2 }, { "property": "metadata", "type": 2 }, { "property": "logs", "type": 2 }],
817
839
  question: [{ "property": "forTypes", "type": 1 }, { "property": "transKey", "type": 2 }, { "property": "fallback", "type": 2 }, { "property": "category", "type": 2 }, { "property": "type", "type": 0 }, { "property": "sortOrder", "type": 3 }, { "property": "visible", "type": 4 }, { "property": "notes", "type": 2 }]
818
840
  };
@@ -1457,6 +1479,19 @@ function nameof(key1, key2) {
1457
1479
  return key2 ?? key1;
1458
1480
  }
1459
1481
 
1482
+ // src/helpers/questionHelper.ts
1483
+ var getQuestionGroups = (questionsAndAnswers) => {
1484
+ const questionGroups = {};
1485
+ for (const qna of questionsAndAnswers ?? []) {
1486
+ const existingValue = questionGroups[qna.question.category];
1487
+ questionGroups[qna.question.category] = [...existingValue == null ? [] : existingValue, qna];
1488
+ }
1489
+ return Object.keys(questionGroups).map((category) => ({
1490
+ category,
1491
+ list: (questionGroups[category] ?? []).filter((c) => c != null)
1492
+ }));
1493
+ };
1494
+
1460
1495
  // src/helpers/randomHelper.ts
1461
1496
  var randomIntFromRange = (min, max) => {
1462
1497
  return Math.floor(Math.random() * (max - min) + min);
@@ -1552,40 +1587,6 @@ var defaultSiteColour = {
1552
1587
  primary: "#97A571",
1553
1588
  secondary: "#97A571"
1554
1589
  };
1555
- var TranslationService = class {
1556
- constructor(log, _config) {
1557
- this._config = _config;
1558
- this._logger = log.getLogger("TranslationService");
1559
- }
1560
- _logger;
1561
- _tolgee;
1562
- initialize = async () => {
1563
- if (this._tolgee != null) return;
1564
- this._tolgee = Tolgee().use(DevTools()).use(FormatIcu()).use(
1565
- BackendFetch({
1566
- prefix: "/assets/i18n",
1567
- fallbackOnFail: true
1568
- })
1569
- ).init({
1570
- defaultLanguage: "en",
1571
- observerType: "text",
1572
- observerOptions: { inputPrefix: "{{", inputSuffix: "}}" },
1573
- // Dev mode only 👇
1574
- apiKey: this._config.getTolgeeApiKey(),
1575
- apiUrl: this._config.getTolgeeApiUrl(),
1576
- projectId: this._config.getTolgeeProjectId()
1577
- });
1578
- await this._tolgee.run();
1579
- this._logger.d("Tolgee initialised!");
1580
- };
1581
- instance = () => this._tolgee;
1582
- getLanguage = () => this._tolgee?.getLanguage?.();
1583
- changeLanguage = (locale) => this._tolgee?.changeLanguage?.(locale);
1584
- t = (key, defaultValue, options) => (
1585
- // this._tolgee.t(key, defaultValue, options);
1586
- this._tolgee?.t?.(key, defaultValue, options) ?? defaultValue ?? key
1587
- );
1588
- };
1589
1590
 
1590
1591
  // src/validation/arrayValidation.ts
1591
1592
  var minItems = (minLength2) => (values) => {
@@ -1779,9 +1780,10 @@ var specialChars = "<>@!#$%^&*()_+[]{}?:;|'\"\\,./~`-=";
1779
1780
  var capitalizeAlphabet2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
1780
1781
  var errorMessage = `Password should be minimum of 8 characters, with an uppercase letter, at least 1 number and 1 special character`;
1781
1782
  var passwordValid = (value) => {
1782
- const passwordCharArr = value.split("");
1783
+ const safeValue = value ?? "";
1784
+ const passwordCharArr = safeValue.split("");
1783
1785
  const defaultValidation = { isValid: false, errorMessage };
1784
- if (value.length < UserRestriction.password.minLength)
1786
+ if (safeValue.length < UserRestriction.password.minLength)
1785
1787
  return { ...defaultValidation, errorMessageTransKey: "password_too_short_validator" };
1786
1788
  const hasNumber = passwordCharArr.filter((c) => isNaN(Number(c)) == false).length > 0;
1787
1789
  if (hasNumber == false) return { ...defaultValidation, errorMessageTransKey: "password_missing_number_validator" };
@@ -1851,4 +1853,4 @@ var shouldBeYoutubeUrl = (value) => {
1851
1853
  };
1852
1854
  };
1853
1855
 
1854
- export { APP_TYPE_TOKEN, ActivityRestriction, ActivityType, AddressLinkType, AddressRestriction, AnswerLinkType, AnswerRestriction, AppType, BOT_PATH_TOKEN, BookingAddonRestriction, BookingAddonType, BookingRestriction, BookingStatusType, BugReportRestriction, BugReportStatusType, CommentLinkType, CommentRestriction, CommonConfigService, DependencyInjectionContainer, DrivingRouteRestriction, InvoiceRestriction, InvoiceStatusType, LogService, MembershipBillingCycleType, MembershipRestriction, MembershipStatus, MembershipType, MouseButton, NetworkState, OrderDirectionType, PermissionRestriction, PermissionType, PetRestriction, PetSexType, PetStatusType, PetType, QuestionForType, QuestionRestriction, QuestionType, SITE_CONFIG_TOKEN, SearchableColumnType, StripeRestriction, TempLinkType, 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, emailValid, fakePromise, formatDate, formatFileSize, formatForBookingDate, formatForDateDropdown, formatForDateLocal, formatForDateLocalDetailed, formatForDateOfBirth, formatForDateWithTime, getActiveUserMembership, getAgeInYears, getAllPetQuestionForType, getAppType, getArrFromEnum, getBotPath, getCalendarDropdownDisplayValue, getCalendarDropdownForDateOfBirthDisplayValue, getCommonConfig, getDayClassObject, getDayElements, getDayHeadingElements, getImageParams, getLog, getMimeTypeFromExtension, getPayloadFromJwt, getPerformanceTimer, getPetAvatarUrl, getSiteColour, getSiteConfig, getUserAvatarUrl, getUsersName, getWeekNumber, hasRequiredPermissions, hubspotQuestionsExport, isBefore, isDateAfterStart, isDateBeforeEnd, isDateDisabledByDisabledDays, isDateEnabledByEnabledDays, isNumber, isSameDay, isWebApp, lowercaseFirstLetter, makeArrayOrDefault, maxDate, maxItems, maxLength, maxValue, mimeTypeLookup, minDate, minItems, minLength, minUrlLength, minValue, monthTranslationKeyOrder, multiValidation, nameof, nanasFonts, noValidation, notNull, onlyUnique, passwordValid, portalGlyphLength, promiseFromValue, randomIntFromRange, randomItemFromArray, rootContainer, rootDependencyInjectionSetup, searchColumns, selectedItemsExist, selectedOptionIsInEnum, separateValidation, setContainerToken, setContainerTokenLazy, setSiteConfig, shouldBeUrl, shouldBeYoutubeUrl, showSecondCalendar, socialLinks, timeout, tryParseNumber, uploadsThatNeedEncryption, urlRef, uuidv4, validUuidChars, validateForEach, webAppTypes, weekdayTranslationKeyOrder };
1856
+ export { APP_TYPE_TOKEN, ActivityRestriction, ActivityType, AddressLinkType, AddressRestriction, AnswerLinkType, AnswerRestriction, AppType, AuthRegisterRestriction, BOT_PATH_TOKEN, BookingAddonRestriction, BookingAddonType, BookingRestriction, BookingStatusType, BugReportRestriction, BugReportStatusType, CommentLinkType, CommentRestriction, CommonConfigService, DependencyInjectionContainer, DrivingRouteRestriction, InvoiceRestriction, InvoiceStatusType, LogService, MembershipBillingCycleType, MembershipRestriction, MembershipStatus, MembershipType, MouseButton, NetworkState, OrderDirectionType, PermissionRestriction, PermissionType, PetRestriction, PetSexType, PetStatusType, PetType, QuestionForType, QuestionRestriction, QuestionType, SITE_CONFIG_TOKEN, SearchableColumnType, StripeRestriction, TempLinkType, UnavailabilityRestriction, UploadLinkType, UploadRestriction, UploadType, UserAccountFlagType, UserRestriction, UserType, activityShortCode, addDays, addMinutes, addMonths, addSeconds, addSpacesForEnum, addToParallelTasks, anyObject, apiRoute, apiRouteParam, arrayContains, arrayOfNLength, capitalizeFirstLetter, changeMonth, colourPalette, commonEmailLinks, convertToDate, convertToFullDateSelection, createToken, cyrb53, dateDiffInDays, debounceLeading, defaultSiteColour, emailValid, fakePromise, formatDate, formatFileSize, formatForBookingDate, formatForDateDropdown, formatForDateLocal, formatForDateLocalDetailed, formatForDateOfBirth, formatForDateWithTime, getActiveUserMembership, getAgeInYears, getAllPetQuestionForType, getAppType, getArrFromEnum, getBotPath, getCalendarDropdownDisplayValue, getCalendarDropdownForDateOfBirthDisplayValue, getCommonConfig, getDayClassObject, getDayElements, getDayHeadingElements, getImageParams, getLog, getMimeTypeFromExtension, getPayloadFromJwt, getPerformanceTimer, getPetAvatarUrl, getQuestionGroups, getSiteColour, getSiteConfig, getUserAvatarUrl, getUsersName, getWeekNumber, hasRequiredPermissions, hubspotQuestionsExport, isBefore, isDateAfterStart, isDateBeforeEnd, isDateDisabledByDisabledDays, isDateEnabledByEnabledDays, isNumber, isSameDay, isWebApp, lowercaseFirstLetter, makeArrayOrDefault, maxDate, maxItems, maxLength, maxValue, mimeTypeLookup, minDate, minItems, minLength, minUrlLength, minValue, monthTranslationKeyOrder, multiValidation, nameof, nanasFonts, noValidation, notNull, onlyUnique, passwordValid, portalGlyphLength, promiseFromValue, randomIntFromRange, randomItemFromArray, rootContainer, rootDependencyInjectionSetup, searchColumns, selectedItemsExist, selectedOptionIsInEnum, separateValidation, setContainerToken, setContainerTokenLazy, setSiteConfig, shouldBeUrl, shouldBeYoutubeUrl, showSecondCalendar, socialLinks, timeout, tryParseNumber, uploadsThatNeedEncryption, urlRef, uuidv4, validUuidChars, validateForEach, webAppTypes, weekdayTranslationKeyOrder };