@deallony/shared 1.2.69 → 1.2.71

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.
@@ -6,6 +6,30 @@ export declare const APP_ROUTES: {
6
6
  pathname: string;
7
7
  };
8
8
  };
9
+ readonly notifications: {
10
+ /** The notification centre (favorites updates) */
11
+ readonly list: () => {
12
+ pathname: string;
13
+ };
14
+ readonly settings: () => {
15
+ pathname: string;
16
+ };
17
+ };
18
+ readonly favorites: {
19
+ readonly compare: (ad_ids: (number | string)[]) => {
20
+ pathname: string;
21
+ params: {
22
+ ids: string;
23
+ };
24
+ };
25
+ /** A favorites list someone shared */
26
+ readonly sharedList: (token: string) => {
27
+ pathname: string;
28
+ params: {
29
+ token: string;
30
+ };
31
+ };
32
+ };
9
33
  readonly categories: {
10
34
  readonly all: (params: {
11
35
  type: SubjectTypeValue;
@@ -5,6 +5,19 @@ exports.APP_ROUTES = {
5
5
  main: {
6
6
  home: () => ({ pathname: "/(tabs)" }),
7
7
  },
8
+ notifications: {
9
+ /** The notification centre (favorites updates) */
10
+ list: () => ({ pathname: "/notifications" }),
11
+ settings: () => ({ pathname: "/notifications/settings" }),
12
+ },
13
+ favorites: {
14
+ compare: (ad_ids) => ({
15
+ pathname: "/favorites/compare",
16
+ params: { ids: ad_ids.join(",") },
17
+ }),
18
+ /** A favorites list someone shared */
19
+ sharedList: (token) => ({ pathname: "/favorites/list/[token]", params: { token } }),
20
+ },
8
21
  categories: {
9
22
  all: (params) => ({
10
23
  pathname: "/category/all-category",
@@ -68,8 +68,11 @@ export type IAd = {
68
68
  created_at?: string | Date;
69
69
  updated_at?: string | Date;
70
70
  expires_at?: string | Date | null;
71
+ deleted_at?: string | Date | null;
72
+ /** My ads: how many users saved this ad */
73
+ favorites_count?: number;
71
74
  };
72
- export type SaveAdDto = Partial<Omit<IAd, "created_at" | "updated_at" | "views" | "user" | "promotions" | "company">> & {
75
+ export type SaveAdDto = Partial<Omit<IAd, "created_at" | "updated_at" | "views" | "user" | "promotions" | "company" | "deleted_at" | "favorites_count">> & {
73
76
  id?: number;
74
77
  latitude?: number;
75
78
  longitude?: number;
@@ -0,0 +1,57 @@
1
+ import { IAd } from "../ad/Ad";
2
+ /** Notifications kept in the user's notification centre. Only favorites updates for now. */
3
+ export declare enum NotificationTypeEnum {
4
+ FAVORITE_PRICE_DROP = "favorite_price_drop",
5
+ FAVORITE_SOLD = "favorite_sold",
6
+ FAVORITE_BACK = "favorite_back",
7
+ FAVORITE_SIMILAR = "favorite_similar"
8
+ }
9
+ export type NotificationText = {
10
+ ar: string;
11
+ en: string;
12
+ };
13
+ export type INotificationData = {
14
+ ad_id?: number;
15
+ old_price?: number;
16
+ new_price?: number;
17
+ currency_id?: number | null;
18
+ /** FAVORITE_SIMILAR: the new ads and what they match */
19
+ ad_ids?: number[];
20
+ count?: number;
21
+ subject_type?: string;
22
+ category_id?: number | null;
23
+ };
24
+ export type INotification = {
25
+ id: number;
26
+ user_id: number;
27
+ type: NotificationTypeEnum;
28
+ title: NotificationText;
29
+ body: NotificationText;
30
+ ad_id: number | null;
31
+ ad?: IAd | null;
32
+ data: INotificationData | null;
33
+ /** Same key within 24 hours updates the existing row instead of adding one */
34
+ group_key: string | null;
35
+ read_at: Date | string | null;
36
+ push_status: "pending" | "sent" | "skipped" | "failed";
37
+ pushed_at: Date | string | null;
38
+ created_at: Date | string;
39
+ updated_at?: Date | string;
40
+ };
41
+ export type INotificationSetting = {
42
+ type: NotificationTypeEnum;
43
+ push_enabled: boolean;
44
+ inbox_enabled: boolean;
45
+ };
46
+ export type GetNotificationsDto = {
47
+ page?: number;
48
+ limit?: number;
49
+ type?: NotificationTypeEnum;
50
+ };
51
+ export type MarkNotificationsReadDto = {
52
+ ids?: number[];
53
+ all?: boolean;
54
+ };
55
+ export type UpdateNotificationSettingsDto = {
56
+ settings: INotificationSetting[];
57
+ };
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.NotificationTypeEnum = void 0;
4
+ /** Notifications kept in the user's notification centre. Only favorites updates for now. */
5
+ var NotificationTypeEnum;
6
+ (function (NotificationTypeEnum) {
7
+ NotificationTypeEnum["FAVORITE_PRICE_DROP"] = "favorite_price_drop";
8
+ NotificationTypeEnum["FAVORITE_SOLD"] = "favorite_sold";
9
+ NotificationTypeEnum["FAVORITE_BACK"] = "favorite_back";
10
+ NotificationTypeEnum["FAVORITE_SIMILAR"] = "favorite_similar";
11
+ })(NotificationTypeEnum || (exports.NotificationTypeEnum = NotificationTypeEnum = {}));
@@ -57,6 +57,7 @@ export * as Chat from "./communication/Chat";
57
57
  export * as Device from "./communication/Device";
58
58
  export * as MessageTemplate from "./communication/MessageTemplate";
59
59
  export * as NotificationToken from "./communication/NotificationToken";
60
+ export * as Notification from "./communication/Notification";
60
61
  export * as File from "./media/File";
61
62
  export * as Media from "./media/Media";
62
63
  export * as Image from "./media/Image";
@@ -37,7 +37,7 @@ var __importStar = (this && this.__importStar) || (function () {
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.Favorite = exports.Wallet = exports.Permission = exports.Role = exports.User = exports.EventVenue = exports.EventWedding = exports.EventTimeline = exports.EventRsvp = exports.Event = exports.District = exports.City = exports.AdminBoundary = exports.WorkType = exports.UsedProductCondition = exports.UsedProductAge = exports.Unit = exports.Transmission = exports.RegionalSpec = exports.PublisherType = exports.PropertyStatus = exports.PriceType = exports.OfferType = exports.LicenseType = exports.FuelType = exports.Feature = exports.Facility = exports.Currency = exports.Color = exports.CategoryWorkType = exports.Category = exports.CarBody = exports.UsedProduct = exports.Service = exports.PropertySubType = exports.Property = exports.MotorTrim = exports.Motor = exports.AdPromotion = exports.Addresses = exports.AdDailyViews = exports.AdLocation = exports.Ad = exports.FilterParams = exports.ModuleFetchEndpoints = exports.Config = exports.AccessType = exports.Status = exports.Response = exports.LocalizedName = void 0;
40
- exports.Payment = exports.Analysis = exports.GeminiApiKey = exports.Google = exports.Kyc = exports.SocialMediaProfile = exports.SocialMediaPlatform = exports.Image = exports.Media = exports.File = exports.NotificationToken = exports.MessageTemplate = exports.Device = exports.Chat = exports.AppStartScreen = exports.MetaData = exports.Company = exports.PotentialUser = exports.Loyalty = void 0;
40
+ exports.Payment = exports.Analysis = exports.GeminiApiKey = exports.Google = exports.Kyc = exports.SocialMediaProfile = exports.SocialMediaPlatform = exports.Image = exports.Media = exports.File = exports.Notification = exports.NotificationToken = exports.MessageTemplate = exports.Device = exports.Chat = exports.AppStartScreen = exports.MetaData = exports.Company = exports.PotentialUser = exports.Loyalty = void 0;
41
41
  // common
42
42
  exports.LocalizedName = __importStar(require("./common/LocalizedName"));
43
43
  exports.Response = __importStar(require("./common/Response"));
@@ -104,6 +104,7 @@ exports.Chat = __importStar(require("./communication/Chat"));
104
104
  exports.Device = __importStar(require("./communication/Device"));
105
105
  exports.MessageTemplate = __importStar(require("./communication/MessageTemplate"));
106
106
  exports.NotificationToken = __importStar(require("./communication/NotificationToken"));
107
+ exports.Notification = __importStar(require("./communication/Notification"));
107
108
  // media
108
109
  exports.File = __importStar(require("./media/File"));
109
110
  exports.Media = __importStar(require("./media/Media"));
@@ -4,11 +4,49 @@ export declare enum FavoritableType {
4
4
  USED_PRODUCTS = "used_products",
5
5
  SERVICES = "services"
6
6
  }
7
+ /** A named group of the user's favorites, e.g. "Family car". Shared through share_token. */
8
+ export type IFavoriteList = {
9
+ id: number;
10
+ user_id: number;
11
+ name: string;
12
+ share_token: string;
13
+ created_at?: Date | string;
14
+ /** Number of favorites in the list, sent with the user's lists */
15
+ count?: number;
16
+ /** Up to four ads for the list's cover */
17
+ preview_ads?: IAd[];
18
+ };
7
19
  export type IFavorite = {
8
20
  id: number;
9
21
  user_id: number;
10
22
  user: IUser;
11
23
  created_at: Date | string;
12
24
  ad: IAd;
25
+ /** The ad's price and currency when it was saved, to show how much it dropped */
26
+ saved_price?: number | null;
27
+ saved_currency_id?: number | null;
28
+ /** The last price the user was notified about, so a drop is not announced twice */
29
+ last_notified_price?: number | null;
30
+ /** Price-drop, sold and back-on-sale alerts for this ad */
31
+ notify?: boolean;
32
+ /** Private note, only the user sees it */
33
+ note?: string | null;
34
+ list_id?: number | null;
13
35
  };
14
36
  export type FavoriteType = IFavorite;
37
+ /** Availability of a favorite's ad, derived from its status and deletion */
38
+ export declare enum FavoriteAvailability {
39
+ AVAILABLE = "available",
40
+ SOLD = "sold",
41
+ UNAVAILABLE = "unavailable"
42
+ }
43
+ export type UpdateFavoriteDto = {
44
+ ad_id: number;
45
+ note?: string | null;
46
+ notify?: boolean;
47
+ list_id?: number | null;
48
+ };
49
+ export type SaveFavoriteListDto = {
50
+ id?: number;
51
+ name: string;
52
+ };
@@ -1,8 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FavoritableType = void 0;
3
+ exports.FavoriteAvailability = exports.FavoritableType = void 0;
4
4
  var FavoritableType;
5
5
  (function (FavoritableType) {
6
6
  FavoritableType["USED_PRODUCTS"] = "used_products";
7
7
  FavoritableType["SERVICES"] = "services";
8
8
  })(FavoritableType || (exports.FavoritableType = FavoritableType = {}));
9
+ /** Availability of a favorite's ad, derived from its status and deletion */
10
+ var FavoriteAvailability;
11
+ (function (FavoriteAvailability) {
12
+ FavoriteAvailability["AVAILABLE"] = "available";
13
+ FavoriteAvailability["SOLD"] = "sold";
14
+ FavoriteAvailability["UNAVAILABLE"] = "unavailable";
15
+ })(FavoriteAvailability || (exports.FavoriteAvailability = FavoriteAvailability = {}));
@@ -2,6 +2,19 @@ export const APP_ROUTES = {
2
2
  main: {
3
3
  home: () => ({ pathname: "/(tabs)" }),
4
4
  },
5
+ notifications: {
6
+ /** The notification centre (favorites updates) */
7
+ list: () => ({ pathname: "/notifications" }),
8
+ settings: () => ({ pathname: "/notifications/settings" }),
9
+ },
10
+ favorites: {
11
+ compare: (ad_ids) => ({
12
+ pathname: "/favorites/compare",
13
+ params: { ids: ad_ids.join(",") },
14
+ }),
15
+ /** A favorites list someone shared */
16
+ sharedList: (token) => ({ pathname: "/favorites/list/[token]", params: { token } }),
17
+ },
5
18
  categories: {
6
19
  all: (params) => ({
7
20
  pathname: "/category/all-category",
@@ -0,0 +1,8 @@
1
+ /** Notifications kept in the user's notification centre. Only favorites updates for now. */
2
+ export var NotificationTypeEnum;
3
+ (function (NotificationTypeEnum) {
4
+ NotificationTypeEnum["FAVORITE_PRICE_DROP"] = "favorite_price_drop";
5
+ NotificationTypeEnum["FAVORITE_SOLD"] = "favorite_sold";
6
+ NotificationTypeEnum["FAVORITE_BACK"] = "favorite_back";
7
+ NotificationTypeEnum["FAVORITE_SIMILAR"] = "favorite_similar";
8
+ })(NotificationTypeEnum || (NotificationTypeEnum = {}));
@@ -67,6 +67,7 @@ export * as Chat from "./communication/Chat.js";
67
67
  export * as Device from "./communication/Device.js";
68
68
  export * as MessageTemplate from "./communication/MessageTemplate.js";
69
69
  export * as NotificationToken from "./communication/NotificationToken.js";
70
+ export * as Notification from "./communication/Notification.js";
70
71
  // media
71
72
  export * as File from "./media/File.js";
72
73
  export * as Media from "./media/Media.js";
@@ -3,3 +3,10 @@ export var FavoritableType;
3
3
  FavoritableType["USED_PRODUCTS"] = "used_products";
4
4
  FavoritableType["SERVICES"] = "services";
5
5
  })(FavoritableType || (FavoritableType = {}));
6
+ /** Availability of a favorite's ad, derived from its status and deletion */
7
+ export var FavoriteAvailability;
8
+ (function (FavoriteAvailability) {
9
+ FavoriteAvailability["AVAILABLE"] = "available";
10
+ FavoriteAvailability["SOLD"] = "sold";
11
+ FavoriteAvailability["UNAVAILABLE"] = "unavailable";
12
+ })(FavoriteAvailability || (FavoriteAvailability = {}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deallony/shared",
3
- "version": "1.2.69",
3
+ "version": "1.2.71",
4
4
  "private": false,
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",