heartraite 1.0.85 → 1.0.87

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.
@@ -0,0 +1,4 @@
1
+ export declare enum Theme {
2
+ LIGHT = "light",
3
+ DARK = "dark"
4
+ }
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Theme = void 0;
4
+ var Theme;
5
+ (function (Theme) {
6
+ Theme["LIGHT"] = "light";
7
+ Theme["DARK"] = "dark";
8
+ })(Theme || (exports.Theme = Theme = {}));
@@ -4,6 +4,7 @@ export * from "./cloudfunction.enum";
4
4
  export * from "./evaluation.enum";
5
5
  export * from "./environment.enum";
6
6
  export * from "./firestore.enum";
7
+ export * from "./general.enum";
7
8
  export * from "./iap.enum";
8
9
  export * from "./like.enum";
9
10
  export * from "./report.enum";
@@ -20,6 +20,7 @@ __exportStar(require("./cloudfunction.enum"), exports);
20
20
  __exportStar(require("./evaluation.enum"), exports);
21
21
  __exportStar(require("./environment.enum"), exports);
22
22
  __exportStar(require("./firestore.enum"), exports);
23
+ __exportStar(require("./general.enum"), exports);
23
24
  __exportStar(require("./iap.enum"), exports);
24
25
  __exportStar(require("./like.enum"), exports);
25
26
  __exportStar(require("./report.enum"), exports);
@@ -1,7 +1,7 @@
1
1
  import { FeedbackAgreement, Gender, LikeType, ProviderType, ReportReason, UserDeletionReason } from "../enum";
2
2
  import { DeepPartial } from "./helper.types";
3
3
  import { Answer, Demographics } from "./submission.types";
4
- import { DatingPreferences, UserNotifications, UserProfile } from "./user.types";
4
+ import { DatingPreferences, UserNotifications, UserProfile, UserSettings } from "./user.types";
5
5
  export type RegisterUserRequest = {
6
6
  userId: string;
7
7
  email: string;
@@ -134,6 +134,7 @@ export type UpdateUserRequest = {
134
134
  lng: number;
135
135
  };
136
136
  appVersion?: string;
137
+ settings?: DeepPartial<UserSettings>;
137
138
  };
138
139
  export type DeleteUserRequest = {
139
140
  validationPhrase: string;
@@ -1,4 +1,4 @@
1
- import { Gender, MatchmakingMode, NotificationSetting, UserLanguage } from "../enum";
1
+ import { Gender, MatchmakingMode, NotificationSetting, Theme, UserLanguage } from "../enum";
2
2
  export type User = {
3
3
  id: string;
4
4
  email: string;
@@ -11,6 +11,7 @@ export type User = {
11
11
  };
12
12
  export type UserSettings = {
13
13
  language: UserLanguage;
14
+ theme: Theme;
14
15
  };
15
16
  export type UserPermissions = {
16
17
  registrationReferralAllowed: boolean;
@@ -0,0 +1,3 @@
1
+ type SupportedLocale = "sv-SE" | "en-US" | "sv_SE" | "en_US";
2
+ export declare const formatDate: (isoDate?: string | null, locale?: SupportedLocale) => string;
3
+ export {};
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatDate = void 0;
4
+ const normalizeLocale = (locale) => {
5
+ return locale.replace("_", "-"); // Convert sv_SE → sv-SE
6
+ };
7
+ const formatDate = (isoDate, locale = "en-US") => {
8
+ if (!isoDate)
9
+ return "";
10
+ try {
11
+ const normalizedLocale = normalizeLocale(locale);
12
+ return new Intl.DateTimeFormat(normalizedLocale, {
13
+ year: "numeric",
14
+ month: "long",
15
+ day: "numeric",
16
+ }).format(new Date(isoDate));
17
+ }
18
+ catch (e) {
19
+ console.warn("Invalid locale or date:", e);
20
+ return isoDate;
21
+ }
22
+ };
23
+ exports.formatDate = formatDate;
@@ -1,2 +1,3 @@
1
1
  export * from "./time-label.util";
2
2
  export * from "./age.util";
3
+ export * from "./date-label.util";
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./time-label.util"), exports);
18
18
  __exportStar(require("./age.util"), exports);
19
+ __exportStar(require("./date-label.util"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heartraite",
3
- "version": "1.0.85",
3
+ "version": "1.0.87",
4
4
  "description": "Heartraite npm package for common functionality",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -0,0 +1,4 @@
1
+ export enum Theme {
2
+ LIGHT = "light",
3
+ DARK = "dark",
4
+ }
package/src/enum/index.ts CHANGED
@@ -4,6 +4,7 @@ export * from "./cloudfunction.enum";
4
4
  export * from "./evaluation.enum";
5
5
  export * from "./environment.enum";
6
6
  export * from "./firestore.enum";
7
+ export * from "./general.enum";
7
8
  export * from "./iap.enum";
8
9
  export * from "./like.enum";
9
10
  export * from "./report.enum";
@@ -12,6 +12,7 @@ import {
12
12
  DatingPreferences,
13
13
  UserNotifications,
14
14
  UserProfile,
15
+ UserSettings,
15
16
  } from "./user.types";
16
17
 
17
18
  // auth
@@ -138,6 +139,7 @@ export type UpdateUserRequest = {
138
139
  >;
139
140
  geoLocation?: { lat: number; lng: number };
140
141
  appVersion?: string;
142
+ settings?: DeepPartial<UserSettings>;
141
143
  };
142
144
  export type DeleteUserRequest = {
143
145
  validationPhrase: string;
@@ -2,6 +2,7 @@ import {
2
2
  Gender,
3
3
  MatchmakingMode,
4
4
  NotificationSetting,
5
+ Theme,
5
6
  UserLanguage,
6
7
  } from "../enum";
7
8
 
@@ -18,6 +19,7 @@ export type User = {
18
19
 
19
20
  export type UserSettings = {
20
21
  language: UserLanguage;
22
+ theme: Theme;
21
23
  };
22
24
 
23
25
  export type UserPermissions = {
@@ -0,0 +1,24 @@
1
+ type SupportedLocale = "sv-SE" | "en-US" | "sv_SE" | "en_US";
2
+
3
+ const normalizeLocale = (locale: SupportedLocale): string => {
4
+ return locale.replace("_", "-"); // Convert sv_SE → sv-SE
5
+ };
6
+
7
+ export const formatDate = (
8
+ isoDate?: string | null,
9
+ locale: SupportedLocale = "en-US"
10
+ ) => {
11
+ if (!isoDate) return "";
12
+
13
+ try {
14
+ const normalizedLocale = normalizeLocale(locale);
15
+ return new Intl.DateTimeFormat(normalizedLocale, {
16
+ year: "numeric",
17
+ month: "long",
18
+ day: "numeric",
19
+ }).format(new Date(isoDate));
20
+ } catch (e) {
21
+ console.warn("Invalid locale or date:", e);
22
+ return isoDate;
23
+ }
24
+ };
@@ -1,2 +1,3 @@
1
1
  export * from "./time-label.util";
2
2
  export * from "./age.util";
3
+ export * from "./date-label.util";