@hobenakicoffee/libraries 6.8.2 → 6.10.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hobenakicoffee/libraries",
3
- "version": "6.8.2",
3
+ "version": "6.10.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "types": "src/index.ts",
@@ -1,6 +1,7 @@
1
1
  export * from "./common";
2
2
  export * from "./divisions";
3
3
  export * from "./legal";
4
+ export * from "./notifications";
4
5
  export * from "./payment";
5
6
  export * from "./platforms";
6
7
  export * from "./services";
@@ -0,0 +1,15 @@
1
+ export const NotificationTypes = {
2
+ GIFT_RECEIVED: "gift.received",
3
+ NEW_FOLLOWER: "follow.new_follower",
4
+ NEW_SUPPORTER: "supporter.new_supporter",
5
+ NEW_MEMBER: "membership.new_member",
6
+ MEMBERSHIP_EXPIRING: "membership.expiring",
7
+ WITHDRAWAL_STATUS_CHANGED: "withdrawal.status_changed",
8
+ PLATFORM_SUBSCRIPTION_EXPIRING: "platform_subscription.expiring",
9
+ KYC_STATUS_CHANGED: "kyc.status_changed",
10
+ } as const;
11
+
12
+ export type NotificationType =
13
+ (typeof NotificationTypes)[keyof typeof NotificationTypes];
14
+
15
+ export type NotificationCategory = "earnings" | "engagement" | "account";
@@ -478,6 +478,64 @@ export type Database = {
478
478
  };
479
479
  Relationships: [];
480
480
  };
481
+ email_notification_queue: {
482
+ Row: {
483
+ activity_id: string;
484
+ attempts: number;
485
+ created_at: string;
486
+ id: number;
487
+ last_error: string | null;
488
+ notification_type_key: string;
489
+ sent_at: string | null;
490
+ status: string;
491
+ user_profile_id: string;
492
+ };
493
+ Insert: {
494
+ activity_id: string;
495
+ attempts?: number;
496
+ created_at?: string;
497
+ id?: never;
498
+ last_error?: string | null;
499
+ notification_type_key: string;
500
+ sent_at?: string | null;
501
+ status?: string;
502
+ user_profile_id: string;
503
+ };
504
+ Update: {
505
+ activity_id?: string;
506
+ attempts?: number;
507
+ created_at?: string;
508
+ id?: never;
509
+ last_error?: string | null;
510
+ notification_type_key?: string;
511
+ sent_at?: string | null;
512
+ status?: string;
513
+ user_profile_id?: string;
514
+ };
515
+ Relationships: [
516
+ {
517
+ foreignKeyName: "email_notification_queue_activity_id_fkey";
518
+ columns: ["activity_id"];
519
+ isOneToOne: false;
520
+ referencedRelation: "activities";
521
+ referencedColumns: ["id"];
522
+ },
523
+ {
524
+ foreignKeyName: "email_notification_queue_notification_type_key_fkey";
525
+ columns: ["notification_type_key"];
526
+ isOneToOne: false;
527
+ referencedRelation: "notification_types";
528
+ referencedColumns: ["key"];
529
+ },
530
+ {
531
+ foreignKeyName: "email_notification_queue_user_profile_id_fkey";
532
+ columns: ["user_profile_id"];
533
+ isOneToOne: false;
534
+ referencedRelation: "profiles";
535
+ referencedColumns: ["id"];
536
+ },
537
+ ];
538
+ };
481
539
  feed_item_bookmarks: {
482
540
  Row: {
483
541
  created_at: string;
@@ -1065,7 +1123,7 @@ export type Database = {
1065
1123
  },
1066
1124
  ];
1067
1125
  };
1068
- messages_2026_05: {
1126
+ messages_2026_04: {
1069
1127
  Row: {
1070
1128
  content: string;
1071
1129
  conversation_id: string;
@@ -1089,7 +1147,7 @@ export type Database = {
1089
1147
  };
1090
1148
  Relationships: [];
1091
1149
  };
1092
- messages_2026_06: {
1150
+ messages_2026_05: {
1093
1151
  Row: {
1094
1152
  content: string;
1095
1153
  conversation_id: string;
@@ -1113,7 +1171,7 @@ export type Database = {
1113
1171
  };
1114
1172
  Relationships: [];
1115
1173
  };
1116
- messages_2026_07: {
1174
+ messages_2026_06: {
1117
1175
  Row: {
1118
1176
  content: string;
1119
1177
  conversation_id: string;
@@ -1444,6 +1502,98 @@ export type Database = {
1444
1502
  },
1445
1503
  ];
1446
1504
  };
1505
+ notification_preference_overrides: {
1506
+ Row: {
1507
+ enabled: boolean;
1508
+ notification_type_key: string;
1509
+ updated_at: string;
1510
+ user_id: string;
1511
+ };
1512
+ Insert: {
1513
+ enabled: boolean;
1514
+ notification_type_key: string;
1515
+ updated_at?: string;
1516
+ user_id: string;
1517
+ };
1518
+ Update: {
1519
+ enabled?: boolean;
1520
+ notification_type_key?: string;
1521
+ updated_at?: string;
1522
+ user_id?: string;
1523
+ };
1524
+ Relationships: [
1525
+ {
1526
+ foreignKeyName: "notification_preference_overrides_notification_type_key_fkey";
1527
+ columns: ["notification_type_key"];
1528
+ isOneToOne: false;
1529
+ referencedRelation: "notification_types";
1530
+ referencedColumns: ["key"];
1531
+ },
1532
+ {
1533
+ foreignKeyName: "notification_preference_overrides_user_id_fkey";
1534
+ columns: ["user_id"];
1535
+ isOneToOne: false;
1536
+ referencedRelation: "profiles";
1537
+ referencedColumns: ["id"];
1538
+ },
1539
+ ];
1540
+ };
1541
+ notification_types: {
1542
+ Row: {
1543
+ category: string;
1544
+ created_at: string;
1545
+ default_enabled: boolean;
1546
+ description: string | null;
1547
+ email_html_body: string | null;
1548
+ email_placeholders: string | null;
1549
+ email_subject: string | null;
1550
+ email_updated_at: string | null;
1551
+ email_updated_by: string | null;
1552
+ is_active: boolean;
1553
+ key: string;
1554
+ label: string;
1555
+ service: string;
1556
+ };
1557
+ Insert: {
1558
+ category: string;
1559
+ created_at?: string;
1560
+ default_enabled?: boolean;
1561
+ description?: string | null;
1562
+ email_html_body?: string | null;
1563
+ email_placeholders?: string | null;
1564
+ email_subject?: string | null;
1565
+ email_updated_at?: string | null;
1566
+ email_updated_by?: string | null;
1567
+ is_active?: boolean;
1568
+ key: string;
1569
+ label: string;
1570
+ service: string;
1571
+ };
1572
+ Update: {
1573
+ category?: string;
1574
+ created_at?: string;
1575
+ default_enabled?: boolean;
1576
+ description?: string | null;
1577
+ email_html_body?: string | null;
1578
+ email_placeholders?: string | null;
1579
+ email_subject?: string | null;
1580
+ email_updated_at?: string | null;
1581
+ email_updated_by?: string | null;
1582
+ is_active?: boolean;
1583
+ key?: string;
1584
+ label?: string;
1585
+ service?: string;
1586
+ };
1587
+ Relationships: [
1588
+ {
1589
+ foreignKeyName: "notification_types_email_updated_by_fkey";
1590
+ columns: ["email_updated_by"];
1591
+ isOneToOne: false;
1592
+ referencedRelation: "profiles";
1593
+ referencedColumns: ["id"];
1594
+ },
1595
+ ];
1596
+ };
1447
1597
  payout_methods: {
1448
1598
  Row: {
1449
1599
  created_at: string;
@@ -1715,6 +1865,7 @@ export type Database = {
1715
1865
  categories: string[] | null;
1716
1866
  created_at: string | null;
1717
1867
  display_name: string | null;
1868
+ email_notifications_enabled: boolean;
1718
1869
  first_service_name: string | null;
1719
1870
  follower_count: number | null;
1720
1871
  following_count: number | null;
@@ -1748,6 +1899,7 @@ export type Database = {
1748
1899
  categories?: string[] | null;
1749
1900
  created_at?: string | null;
1750
1901
  display_name?: string | null;
1902
+ email_notifications_enabled?: boolean;
1751
1903
  first_service_name?: string | null;
1752
1904
  follower_count?: number | null;
1753
1905
  following_count?: number | null;
@@ -1781,6 +1933,7 @@ export type Database = {
1781
1933
  categories?: string[] | null;
1782
1934
  created_at?: string | null;
1783
1935
  display_name?: string | null;
1936
+ email_notifications_enabled?: boolean;
1784
1937
  first_service_name?: string | null;
1785
1938
  follower_count?: number | null;
1786
1939
  following_count?: number | null;
@@ -3298,6 +3451,7 @@ export type Database = {
3298
3451
  Args: { p_profile_id: string };
3299
3452
  Returns: Json;
3300
3453
  };
3454
+ cleanup_old_email_notification_queue: { Args: never; Returns: undefined };
3301
3455
  cleanup_orphaned_kyc_documents: { Args: never; Returns: undefined };
3302
3456
  cleanup_orphaned_post_images: { Args: never; Returns: undefined };
3303
3457
  cleanup_orphaned_shop_images: { Args: never; Returns: undefined };
@@ -3355,6 +3509,7 @@ export type Database = {
3355
3509
  Returns: Json;
3356
3510
  };
3357
3511
  delete_user_address: { Args: { p_address_id: string }; Returns: Json };
3512
+ dispatch_pending_email_notifications: { Args: never; Returns: undefined };
3358
3513
  drop_old_partitions: { Args: never; Returns: undefined };
3359
3514
  follow_user: { Args: { target_user_id: string }; Returns: undefined };
3360
3515
  get_buyer_orders: {
@@ -3555,6 +3710,10 @@ export type Database = {
3555
3710
  total_post_views: number;
3556
3711
  }[];
3557
3712
  };
3713
+ get_notification_preferences: {
3714
+ Args: { p_target_user_id?: string };
3715
+ Returns: Json;
3716
+ };
3558
3717
  get_or_create_direct_conversation: {
3559
3718
  Args: { p_recipient_id: string };
3560
3719
  Returns: string;
@@ -3881,6 +4040,10 @@ export type Database = {
3881
4040
  Returns: Json;
3882
4041
  };
3883
4042
  is_admin: { Args: never; Returns: boolean };
4043
+ is_email_notification_enabled: {
4044
+ Args: { p_type_key: string; p_user_id: string };
4045
+ Returns: boolean;
4046
+ };
3884
4047
  is_following: { Args: { target_user_id: string }; Returns: boolean };
3885
4048
  is_manager: { Args: { user_email: string }; Returns: boolean };
3886
4049
  mark_conversation_as_read: {
@@ -4016,6 +4179,10 @@ export type Database = {
4016
4179
  Args: { p_amount: number; p_payout_method_id: string };
4017
4180
  Returns: string;
4018
4181
  };
4182
+ resolve_activity_notification_key: {
4183
+ Args: { p_metadata: Json; p_role: string; p_service_type: string };
4184
+ Returns: string;
4185
+ };
4019
4186
  retry_withdrawal: {
4020
4187
  Args: {
4021
4188
  p_amount?: number;
@@ -4055,6 +4222,14 @@ export type Database = {
4055
4222
  sender_id: string;
4056
4223
  }[];
4057
4224
  };
4225
+ set_notification_preference: {
4226
+ Args: {
4227
+ p_enabled: boolean;
4228
+ p_target_user_id?: string;
4229
+ p_type_key: string;
4230
+ };
4231
+ Returns: Json;
4232
+ };
4058
4233
  set_shop_active_by_manager: {
4059
4234
  Args: { p_is_active: boolean; p_profile_id: string };
4060
4235
  Returns: Json;
@@ -4092,6 +4267,14 @@ export type Database = {
4092
4267
  };
4093
4268
  Returns: Json;
4094
4269
  };
4270
+ update_email_notifications_enabled: {
4271
+ Args: { p_enabled: boolean; p_target_user_id?: string };
4272
+ Returns: Json;
4273
+ };
4274
+ update_notification_email_template: {
4275
+ Args: { p_html_body: string; p_key: string; p_subject: string };
4276
+ Returns: Json;
4277
+ };
4095
4278
  update_order_tracking: {
4096
4279
  Args: {
4097
4280
  p_carrier?: string;