@nanas-home/hub-common 0.55.1259 → 0.57.1293

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.
@@ -128,7 +128,9 @@ var apiRouteParam = {
128
128
  petUuid: ":petUuid",
129
129
  addressUuid: ":addressUuid",
130
130
  bookingUuid: ":bookingUuid",
131
+ bookingHostUuid: ":bookingHostUuid",
131
132
  bookingAddonUuid: ":bookingAddonUuid",
133
+ uploadUuid: ":uploadUuid",
132
134
  userMembershipUuid: ":userMembershipUuid",
133
135
  bugReportUuid: ":bugReportUuid",
134
136
  linkUuid: ":linkUuid",
@@ -145,7 +147,9 @@ var apiRoute = {
145
147
  devJwt: "/jwt",
146
148
  login: "/login",
147
149
  signup: "/signup",
150
+ signupProgress: "/signup-progress",
148
151
  signupQuestions: "/signup-questions",
152
+ signupTempPetImageUpload: "/signup-temp-pet-upload",
149
153
  confirmEmail: `/confirm-email/${apiRouteParam.linkUuid}`,
150
154
  requestPasswordResetLink: `/password-reset`,
151
155
  passwordResetFromTempLink: `/password-reset/${apiRouteParam.linkUuid}`,
@@ -186,7 +190,7 @@ var apiRoute = {
186
190
  byPet: `/pet/${apiRouteParam.petUuid}`,
187
191
  withRelationships: `/with-relationships/${apiRouteParam.bookingUuid}`,
188
192
  assignHost: `/assign-host/${apiRouteParam.bookingUuid}/${apiRouteParam.userUuid}`,
189
- removeHost: `/remove-host/${apiRouteParam.bookingUuid}`,
193
+ removeHost: `/remove-host/${apiRouteParam.bookingUuid}/${apiRouteParam.bookingHostUuid}`,
190
194
  calendarOverview: "/calendar-overview",
191
195
  swagger: { name: "Bookings", description: "Endpoints for managing bookings" }
192
196
  },
@@ -225,13 +229,14 @@ var apiRoute = {
225
229
  },
226
230
  upload: {
227
231
  prefix: "/admin/upload",
228
- viewRaw: "/view-raw",
232
+ viewRaw: `/view-raw/${apiRouteParam.uploadUuid}`,
229
233
  image: "/image",
230
234
  swagger: { name: "Uploads", description: "Endpoints for managing Uploads" }
231
235
  },
232
236
  user: {
233
237
  prefix: "/admin/user",
234
238
  searchHosts: "/search-hosts",
239
+ migrationReport: "/migration-report",
235
240
  swagger: { name: "Users", description: "Endpoints for Admins to manage Users" }
236
241
  },
237
242
  userMembership: {
@@ -609,6 +614,7 @@ var UploadLinkType = /* @__PURE__ */ ((UploadLinkType2) => {
609
614
  UploadLinkType2[UploadLinkType2["Unknown"] = 0] = "Unknown";
610
615
  UploadLinkType2[UploadLinkType2["User"] = 1] = "User";
611
616
  UploadLinkType2[UploadLinkType2["Pet"] = 2] = "Pet";
617
+ UploadLinkType2[UploadLinkType2["UserRegistration"] = 3] = "UserRegistration";
612
618
  return UploadLinkType2;
613
619
  })(UploadLinkType || {});
614
620
  var UploadType = /* @__PURE__ */ ((UploadType2) => {
@@ -746,7 +752,15 @@ var AnswerRestriction = {
746
752
 
747
753
  // src/contracts/generated/restrictions/authRestriction.ts
748
754
  var AuthRegisterRestriction = {
749
- pets: { minItems: 1, maxItems: 5 },
755
+ pets: {
756
+ minItems: 1,
757
+ maxItems: 5,
758
+ upload: {
759
+ url: { minLength: 0, maxLength: 1e3 },
760
+ mimeType: { minLength: 3, maxLength: 50 },
761
+ extension: { minLength: 3, maxLength: 5 }
762
+ }
763
+ },
750
764
  answers: { minItems: 3, maxItems: 50 }
751
765
  };
752
766
 
@@ -868,12 +882,12 @@ var UserRestriction = {
868
882
  var searchColumns = {
869
883
  membership: [{ "property": "monthlyFee", "type": 2 }, { "property": "perNightStay", "type": 2 }, { "property": "additionalPetPerNightStay", "type": 2 }, { "property": "transportFee", "type": 2 }, { "property": "perKm", "type": 2 }, { "property": "matchFee", "type": 2 }, { "property": "freeCancellationWithinDays", "type": 2 }, { "property": "bookingAdvanceDays", "type": 2 }, { "property": "bookingCalenderMonthsOpenInAdvance", "type": 2 }, { "property": "seasonalDiscounts", "type": 2 }],
870
884
  address: [{ "property": "name", "type": 2 }, { "property": "street", "type": 2 }, { "property": "city", "type": 2 }, { "property": "postalCode", "type": 2 }],
871
- pet: [{ "property": "type", "type": 0 }, { "property": "sex", "type": 2 }, { "property": "breed", "type": 2 }, { "property": "name", "type": 2 }, { "property": "notes", "type": 2 }, { "property": "dateOfBirth", "type": 5 }],
885
+ pet: [{ "property": "type", "type": 0 }, { "property": "sex", "type": 2 }, { "property": "name", "type": 2 }, { "property": "breed", "type": 2 }, { "property": "status", "type": 0 }, { "property": "neutered", "type": 4 }, { "property": "notes", "type": 2 }],
872
886
  invoice: [{ "property": "userUuid", "type": 2 }, { "property": "bookingUuid", "type": 2 }, { "property": "bookingAddonUuid", "type": 2 }, { "property": "status", "type": 2 }, { "property": "stripeInvoiceId", "type": 2 }, { "property": "dueDate", "type": 5 }, { "property": "notes", "type": 2 }],
873
- 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 }],
887
+ userMembership: [{ "property": "status", "type": 1 }, { "property": "billingCycle", "type": 0 }, { "property": "stripeSubscriptionId", "type": 2 }, { "property": "membershipUuid", "type": 1 }],
874
888
  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 }],
875
889
  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 }],
876
- 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 }],
890
+ booking: [{ "property": "code", "type": 3 }, { "property": "startDate", "type": 5 }, { "property": "endDate", "type": 5 }, { "property": "status", "type": 1 }, { "property": "dateCreated", "type": 5 }, { "property": "notes", "type": 2 }],
877
891
  bugReport: [{ "property": "status", "type": 0 }, { "property": "comment", "type": 2 }, { "property": "metadata", "type": 2 }, { "property": "logs", "type": 2 }],
878
892
  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 }]
879
893
  };
@@ -1166,8 +1180,6 @@ var addToParallelTasks = async (tasks, newTask, numTasksInParallel = 5) => {
1166
1180
  tasks.push(newTask);
1167
1181
  return tasks;
1168
1182
  };
1169
-
1170
- // src/helpers/bookingCalendarHelper.ts
1171
1183
  var getBookingStatusLabelForAdmin = (status) => {
1172
1184
  switch (status) {
1173
1185
  case 0 /* Cancelled */:
@@ -1203,12 +1215,40 @@ var getMembershipTypeLabel = (type) => {
1203
1215
  return "None";
1204
1216
  }
1205
1217
  };
1218
+ var getPetTypeLabel = (type) => {
1219
+ switch (type) {
1220
+ case 1 /* Dog */:
1221
+ return "Dog";
1222
+ case 2 /* Cat */:
1223
+ return "Cat";
1224
+ case 3 /* Bird */:
1225
+ return "Bird";
1226
+ case 4 /* Rodent */:
1227
+ return "Rodent";
1228
+ case 5 /* Reptile */:
1229
+ return "Reptile";
1230
+ case 6 /* Other */:
1231
+ return "Other";
1232
+ case 0 /* Unknown */:
1233
+ default:
1234
+ return "Unknown";
1235
+ }
1236
+ };
1237
+ var formatPetTypesLabel = (types) => {
1238
+ const uniqueTypes = [];
1239
+ for (const type of types) {
1240
+ if (uniqueTypes.includes(type) == false) uniqueTypes.push(type);
1241
+ }
1242
+ const labels = uniqueTypes.map((type) => getPetTypeLabel(type)).filter((label) => label !== "Unknown");
1243
+ return labels.length > 0 ? labels.join(", ") : "Unknown";
1244
+ };
1206
1245
  var formatBookingCalendarLabel = (item) => {
1207
1246
  const status = getBookingStatusLabelForAdmin(item.status);
1208
- const pets = item.petNames.join(", ") || "No pets";
1247
+ const petNames = item.petNames.join(", ") || "No pets";
1209
1248
  const membership = getMembershipTypeLabel(item.ownerMembershipType);
1210
- const hostPart = item.hostNames.length > 0 ? ` with ${item.hostNames.join(", ")}` : "";
1211
- return `${status}: ${pets}, ${membership} (${item.ownerName})${hostPart}`;
1249
+ const petTypes = formatPetTypesLabel(item.petTypes);
1250
+ const hostPart = item.hostNames.length > 0 ? ` [with ${item.hostNames.join(", ")}]` : "";
1251
+ return `${status}: ${petNames}, ${membership} (${item.ownerName}) ${petTypes}${hostPart}`;
1212
1252
  };
1213
1253
  var BOOKING_OVERVIEW_STATUSES = [
1214
1254
  1 /* IntakeCall */,
@@ -1231,9 +1271,29 @@ var computeBookingStatusCounts = (bookings) => {
1231
1271
  }
1232
1272
  return counts;
1233
1273
  };
1234
- var filterBookingsByOverviewStatus = (bookings, status) => {
1235
- if (status == null) return bookings;
1236
- return bookings.filter((booking) => booking.status === status);
1274
+ var filterBookingsByOverviewStatus = (bookings, statuses) => {
1275
+ if (statuses == null || statuses.length === 0) return bookings;
1276
+ const allowed = new Set(statuses);
1277
+ return bookings.filter((booking) => allowed.has(booking.status));
1278
+ };
1279
+ var computeBookingNightCount = (startDate, endDate) => {
1280
+ const nights = Math.abs(
1281
+ dayjs(endDate).startOf("day").diff(dayjs(startDate).startOf("day"), "day")
1282
+ );
1283
+ return Math.max(1, nights);
1284
+ };
1285
+ var formatBookingNightsTooltip = (startDate, endDate) => {
1286
+ const nights = computeBookingNightCount(startDate, endDate);
1287
+ return nights === 1 ? "1 night" : `${nights} nights`;
1288
+ };
1289
+ var serializeBookingOverviewStatuses = (statuses) => {
1290
+ if (statuses.length === 0) return void 0;
1291
+ return statuses.join(",");
1292
+ };
1293
+ var parseBookingOverviewStatuses = (statuses) => {
1294
+ if (statuses == null || statuses.trim().length === 0) return void 0;
1295
+ const parsed = statuses.split(",").map((value) => value.trim()).filter((value) => value.length > 0).map((value) => Number(value)).filter((value) => Number.isFinite(value));
1296
+ return parsed.length > 0 ? parsed : void 0;
1237
1297
  };
1238
1298
 
1239
1299
  // src/components/form/calendar/calendarPicker.functions.ts
@@ -1658,6 +1718,13 @@ var urlRef = (url) => {
1658
1718
  }
1659
1719
  return url + `?ref=${ref}`;
1660
1720
  };
1721
+ var urlAddQueryParam = (url, queryParamName, queryParamValue) => {
1722
+ if (url.includes(`${queryParamName}=`)) return url;
1723
+ if (url.includes("?")) {
1724
+ return url + `&${queryParamName}=${queryParamValue}`;
1725
+ }
1726
+ return url + `?${queryParamName}=${queryParamValue}`;
1727
+ };
1661
1728
 
1662
1729
  // src/helpers/userAccountFlagHelper.ts
1663
1730
  var userMustChangePassword = (flags) => flags?.includes(1 /* ChangePassword */) === true;
@@ -2020,4 +2087,4 @@ var shouldBeYoutubeUrl = (value) => {
2020
2087
  };
2021
2088
  };
2022
2089
 
2023
- export { APP_TYPE_TOKEN, ActivityRestriction, ActivityType, AddressLinkType, AddressRestriction, AnswerLinkType, AnswerRestriction, AppType, AuthRegisterRestriction, BOOKING_OVERVIEW_STATUSES, BOT_PATH_TOKEN, BookingAddonRestriction, BookingAddonType, BookingRestriction, BookingStatusType, BugReportRestriction, BugReportStatusType, CommentLinkType, CommentRestriction, CommonConfigService, DependencyInjectionContainer, DrivingRouteRestriction, InvoiceRestriction, InvoiceStatusType, LogService, MembershipBillingCycleType, MembershipRestriction, MembershipStatus, MembershipType, MouseButton, NANAS_PALLETTE, NetworkState, OrderDirectionType, PermissionRestriction, PermissionType, PetRestriction, PetSexType, PetStatusType, PetType, QuestionForType, QuestionRestriction, QuestionType, SITE_CONFIG_TOKEN, SearchableColumnType, StripeRestriction, SupportedLanguageArray, TempLinkType, TempRegistrationStatus, UnavailabilityRestriction, UploadLinkType, UploadRestriction, UploadType, UserAccountFlagType, UserRestriction, UserType, UuidRestriction, activityShortCode, addDays, addMinutes, addMonths, addSeconds, addSpacesForEnum, addToParallelTasks, allowedNonNumericalValuesInContactNumber, anyObject, apiRoute, apiRouteParam, arrayContains, arrayOfNLength, capitalizeFirstLetter, changeMonth, colourPalette, commonEmailLinks, computeBookingStatusCounts, contactNumberCharValid, contactNumberValid, convertToDate, convertToFullDateSelection, createToken, cyrb53, dateDiffInDays, debounceLeading, defaultSiteColour, emailValid, fakePromise, filterBookingsByOverviewStatus, formatBookingCalendarLabel, formatDate, formatFileSize, formatForBookingDate, formatForDateDropdown, formatForDateLocal, formatForDateLocalDetailed, formatForDateOfBirth, formatForDateWithTime, getActiveUserMembership, getAgeInYears, getAllPetQuestionForType, getAppType, getArrFromEnum, getBookingStatusLabelForAdmin, getBotPath, getCalendarDropdownDisplayValue, getCalendarDropdownForDateOfBirthDisplayValue, getCommonConfig, getDayClassObject, getDayElements, getDayHeadingElements, getImageParams, getLog, getMembershipTypeLabel, 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, postCodeValid, promiseFromValue, randomIntFromRange, randomItemFromArray, rootContainer, rootDependencyInjectionSetup, searchColumns, selectedItemsExist, selectedOptionIsInEnum, separateValidation, setContainerToken, setContainerTokenLazy, setSiteConfig, shouldBeUrl, shouldBeYoutubeUrl, showSecondCalendar, socialLinks, timeout, tryParseNumber, uploadsThatNeedEncryption, urlRef, userMustChangePassword, uuidv4, validUuidChars, validateForEach, webAppTypes, weekdayTranslationKeyOrder };
2090
+ export { APP_TYPE_TOKEN, ActivityRestriction, ActivityType, AddressLinkType, AddressRestriction, AnswerLinkType, AnswerRestriction, AppType, AuthRegisterRestriction, BOOKING_OVERVIEW_STATUSES, BOT_PATH_TOKEN, BookingAddonRestriction, BookingAddonType, BookingRestriction, BookingStatusType, BugReportRestriction, BugReportStatusType, CommentLinkType, CommentRestriction, CommonConfigService, DependencyInjectionContainer, DrivingRouteRestriction, InvoiceRestriction, InvoiceStatusType, LogService, MembershipBillingCycleType, MembershipRestriction, MembershipStatus, MembershipType, MouseButton, NANAS_PALLETTE, NetworkState, OrderDirectionType, PermissionRestriction, PermissionType, PetRestriction, PetSexType, PetStatusType, PetType, QuestionForType, QuestionRestriction, QuestionType, SITE_CONFIG_TOKEN, SearchableColumnType, StripeRestriction, SupportedLanguageArray, TempLinkType, TempRegistrationStatus, UnavailabilityRestriction, UploadLinkType, UploadRestriction, UploadType, UserAccountFlagType, UserRestriction, UserType, UuidRestriction, activityShortCode, addDays, addMinutes, addMonths, addSeconds, addSpacesForEnum, addToParallelTasks, allowedNonNumericalValuesInContactNumber, anyObject, apiRoute, apiRouteParam, arrayContains, arrayOfNLength, capitalizeFirstLetter, changeMonth, colourPalette, commonEmailLinks, computeBookingNightCount, computeBookingStatusCounts, contactNumberCharValid, contactNumberValid, convertToDate, convertToFullDateSelection, createToken, cyrb53, dateDiffInDays, debounceLeading, defaultSiteColour, emailValid, fakePromise, filterBookingsByOverviewStatus, formatBookingCalendarLabel, formatBookingNightsTooltip, formatDate, formatFileSize, formatForBookingDate, formatForDateDropdown, formatForDateLocal, formatForDateLocalDetailed, formatForDateOfBirth, formatForDateWithTime, formatPetTypesLabel, getActiveUserMembership, getAgeInYears, getAllPetQuestionForType, getAppType, getArrFromEnum, getBookingStatusLabelForAdmin, getBotPath, getCalendarDropdownDisplayValue, getCalendarDropdownForDateOfBirthDisplayValue, getCommonConfig, getDayClassObject, getDayElements, getDayHeadingElements, getImageParams, getLog, getMembershipTypeLabel, getMimeTypeFromExtension, getPayloadFromJwt, getPerformanceTimer, getPetAvatarUrl, getPetTypeLabel, 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, parseBookingOverviewStatuses, passwordValid, portalGlyphLength, postCodeValid, promiseFromValue, randomIntFromRange, randomItemFromArray, rootContainer, rootDependencyInjectionSetup, searchColumns, selectedItemsExist, selectedOptionIsInEnum, separateValidation, serializeBookingOverviewStatuses, setContainerToken, setContainerTokenLazy, setSiteConfig, shouldBeUrl, shouldBeYoutubeUrl, showSecondCalendar, socialLinks, timeout, tryParseNumber, uploadsThatNeedEncryption, urlAddQueryParam, urlRef, userMustChangePassword, uuidv4, validUuidChars, validateForEach, webAppTypes, weekdayTranslationKeyOrder };