@hobenakicoffee/libraries 4.8.0 → 5.0.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": "4.8.0",
3
+ "version": "5.0.0",
4
4
  "type": "module",
5
5
  "types": "src/index.ts",
6
6
  "repository": {
@@ -206,6 +206,99 @@ export type Database = {
206
206
  };
207
207
  Relationships: [];
208
208
  };
209
+ creator_platform_subscriptions: {
210
+ Row: {
211
+ created_at: string;
212
+ id: number;
213
+ period_end: string;
214
+ period_start: string;
215
+ plan_id: number;
216
+ price_at_purchase: number;
217
+ profile_id: string;
218
+ service_type: string;
219
+ status: string;
220
+ transaction_reference_id: string | null;
221
+ updated_at: string;
222
+ };
223
+ Insert: {
224
+ created_at?: string;
225
+ id?: never;
226
+ period_end: string;
227
+ period_start: string;
228
+ plan_id: number;
229
+ price_at_purchase: number;
230
+ profile_id: string;
231
+ service_type: string;
232
+ status?: string;
233
+ transaction_reference_id?: string | null;
234
+ updated_at?: string;
235
+ };
236
+ Update: {
237
+ created_at?: string;
238
+ id?: never;
239
+ period_end?: string;
240
+ period_start?: string;
241
+ plan_id?: number;
242
+ price_at_purchase?: number;
243
+ profile_id?: string;
244
+ service_type?: string;
245
+ status?: string;
246
+ transaction_reference_id?: string | null;
247
+ updated_at?: string;
248
+ };
249
+ Relationships: [
250
+ {
251
+ foreignKeyName: "creator_platform_subscriptions_plan_id_fkey";
252
+ columns: ["plan_id"];
253
+ isOneToOne: false;
254
+ referencedRelation: "platform_subscription_plans";
255
+ referencedColumns: ["id"];
256
+ },
257
+ {
258
+ foreignKeyName: "creator_platform_subscriptions_profile_id_fkey";
259
+ columns: ["profile_id"];
260
+ isOneToOne: false;
261
+ referencedRelation: "profiles";
262
+ referencedColumns: ["id"];
263
+ },
264
+ {
265
+ foreignKeyName: "creator_platform_subscriptions_transaction_reference_id_fkey";
266
+ columns: ["transaction_reference_id"];
267
+ isOneToOne: false;
268
+ referencedRelation: "transactions";
269
+ referencedColumns: ["reference_id"];
270
+ },
271
+ ];
272
+ };
273
+ creator_subscription_notifications: {
274
+ Row: {
275
+ id: number;
276
+ notification_type: string;
277
+ sent_at: string;
278
+ subscription_id: number;
279
+ };
280
+ Insert: {
281
+ id?: never;
282
+ notification_type: string;
283
+ sent_at?: string;
284
+ subscription_id: number;
285
+ };
286
+ Update: {
287
+ id?: never;
288
+ notification_type?: string;
289
+ sent_at?: string;
290
+ subscription_id?: number;
291
+ };
292
+ Relationships: [
293
+ {
294
+ foreignKeyName: "creator_subscription_notifications_subscription_id_fkey";
295
+ columns: ["subscription_id"];
296
+ isOneToOne: false;
297
+ referencedRelation: "creator_platform_subscriptions";
298
+ referencedColumns: ["id"];
299
+ },
300
+ ];
301
+ };
209
302
  follows: {
210
303
  Row: {
211
304
  created_at: string | null;
@@ -905,6 +998,42 @@ export type Database = {
905
998
  };
906
999
  Relationships: [];
907
1000
  };
1001
+ platform_subscription_plans: {
1002
+ Row: {
1003
+ created_at: string;
1004
+ description: string | null;
1005
+ id: number;
1006
+ is_active: boolean;
1007
+ name: string;
1008
+ price_per_month: number;
1009
+ service_type: string;
1010
+ sort_order: number;
1011
+ updated_at: string;
1012
+ };
1013
+ Insert: {
1014
+ created_at?: string;
1015
+ description?: string | null;
1016
+ id?: never;
1017
+ is_active?: boolean;
1018
+ name: string;
1019
+ price_per_month: number;
1020
+ service_type: string;
1021
+ sort_order?: number;
1022
+ updated_at?: string;
1023
+ };
1024
+ Update: {
1025
+ created_at?: string;
1026
+ description?: string | null;
1027
+ id?: never;
1028
+ is_active?: boolean;
1029
+ name?: string;
1030
+ price_per_month?: number;
1031
+ service_type?: string;
1032
+ sort_order?: number;
1033
+ updated_at?: string;
1034
+ };
1035
+ Relationships: [];
1036
+ };
908
1037
  post_access_grants: {
909
1038
  Row: {
910
1039
  created_at: string;
@@ -1364,6 +1493,7 @@ export type Database = {
1364
1493
  delivered_at: string | null;
1365
1494
  id: string;
1366
1495
  order_id: string;
1496
+ platform_fee_rate: number;
1367
1497
  product_id: string;
1368
1498
  product_title: string;
1369
1499
  product_type: Database["public"]["Enums"]["shop_product_type_enum"];
@@ -1387,6 +1517,7 @@ export type Database = {
1387
1517
  delivered_at?: string | null;
1388
1518
  id?: string;
1389
1519
  order_id: string;
1520
+ platform_fee_rate?: number;
1390
1521
  product_id: string;
1391
1522
  product_title: string;
1392
1523
  product_type: Database["public"]["Enums"]["shop_product_type_enum"];
@@ -1410,6 +1541,7 @@ export type Database = {
1410
1541
  delivered_at?: string | null;
1411
1542
  id?: string;
1412
1543
  order_id?: string;
1544
+ platform_fee_rate?: number;
1413
1545
  product_id?: string;
1414
1546
  product_title?: string;
1415
1547
  product_type?: Database["public"]["Enums"]["shop_product_type_enum"];
@@ -1461,7 +1593,7 @@ export type Database = {
1461
1593
  order_number: string;
1462
1594
  payment_method: Database["public"]["Enums"]["shop_payment_method_enum"];
1463
1595
  platform_fee: number;
1464
- platform_fee_rate: number;
1596
+ platform_fee_rate: number | null;
1465
1597
  seller_net: number;
1466
1598
  seller_notes: string | null;
1467
1599
  seller_profile_id: string;
@@ -1482,7 +1614,7 @@ export type Database = {
1482
1614
  order_number: string;
1483
1615
  payment_method?: Database["public"]["Enums"]["shop_payment_method_enum"];
1484
1616
  platform_fee: number;
1485
- platform_fee_rate: number;
1617
+ platform_fee_rate?: number | null;
1486
1618
  seller_net: number;
1487
1619
  seller_notes?: string | null;
1488
1620
  seller_profile_id: string;
@@ -1503,7 +1635,7 @@ export type Database = {
1503
1635
  order_number?: string;
1504
1636
  payment_method?: Database["public"]["Enums"]["shop_payment_method_enum"];
1505
1637
  platform_fee?: number;
1506
- platform_fee_rate?: number;
1638
+ platform_fee_rate?: number | null;
1507
1639
  seller_net?: number;
1508
1640
  seller_notes?: string | null;
1509
1641
  seller_profile_id?: string;
@@ -1910,47 +2042,80 @@ export type Database = {
1910
2042
  shop_settings: {
1911
2043
  Row: {
1912
2044
  banner_url: string | null;
2045
+ cod_enabled: boolean;
1913
2046
  created_at: string;
1914
2047
  deactivation_reason: string | null;
1915
2048
  id: string;
1916
2049
  is_active: boolean;
1917
2050
  logo_url: string | null;
2051
+ processing_max_days: number | null;
2052
+ processing_min_days: number | null;
1918
2053
  profile_id: string;
2054
+ requires_shipping: boolean;
1919
2055
  seo_description: string | null;
1920
2056
  seo_title: string | null;
2057
+ shipping_fee_inside_dhaka: number | null;
2058
+ shipping_fee_outside_dhaka: number | null;
2059
+ shipping_from_address: Json | null;
1921
2060
  shop_description: string | null;
1922
2061
  shop_name: string;
1923
2062
  theme_config: Json;
2063
+ total_earnings: number;
2064
+ total_products: number;
2065
+ total_sales: number;
2066
+ total_views: number;
1924
2067
  updated_at: string;
1925
2068
  };
1926
2069
  Insert: {
1927
2070
  banner_url?: string | null;
2071
+ cod_enabled?: boolean;
1928
2072
  created_at?: string;
1929
2073
  deactivation_reason?: string | null;
1930
2074
  id?: string;
1931
2075
  is_active?: boolean;
1932
2076
  logo_url?: string | null;
2077
+ processing_max_days?: number | null;
2078
+ processing_min_days?: number | null;
1933
2079
  profile_id: string;
2080
+ requires_shipping?: boolean;
1934
2081
  seo_description?: string | null;
1935
2082
  seo_title?: string | null;
2083
+ shipping_fee_inside_dhaka?: number | null;
2084
+ shipping_fee_outside_dhaka?: number | null;
2085
+ shipping_from_address?: Json | null;
1936
2086
  shop_description?: string | null;
1937
2087
  shop_name: string;
1938
2088
  theme_config?: Json;
2089
+ total_earnings?: number;
2090
+ total_products?: number;
2091
+ total_sales?: number;
2092
+ total_views?: number;
1939
2093
  updated_at?: string;
1940
2094
  };
1941
2095
  Update: {
1942
2096
  banner_url?: string | null;
2097
+ cod_enabled?: boolean;
1943
2098
  created_at?: string;
1944
2099
  deactivation_reason?: string | null;
1945
2100
  id?: string;
1946
2101
  is_active?: boolean;
1947
2102
  logo_url?: string | null;
2103
+ processing_max_days?: number | null;
2104
+ processing_min_days?: number | null;
1948
2105
  profile_id?: string;
2106
+ requires_shipping?: boolean;
1949
2107
  seo_description?: string | null;
1950
2108
  seo_title?: string | null;
2109
+ shipping_fee_inside_dhaka?: number | null;
2110
+ shipping_fee_outside_dhaka?: number | null;
2111
+ shipping_from_address?: Json | null;
1951
2112
  shop_description?: string | null;
1952
2113
  shop_name?: string;
1953
2114
  theme_config?: Json;
2115
+ total_earnings?: number;
2116
+ total_products?: number;
2117
+ total_sales?: number;
2118
+ total_views?: number;
1954
2119
  updated_at?: string;
1955
2120
  };
1956
2121
  Relationships: [
@@ -2366,6 +2531,15 @@ export type Database = {
2366
2531
  [_ in never]: never;
2367
2532
  };
2368
2533
  Functions: {
2534
+ activate_creator_platform_subscription: {
2535
+ Args: {
2536
+ p_creator_profile_id: string;
2537
+ p_plan_id: number;
2538
+ p_provider: Database["public"]["Enums"]["provider_enum"];
2539
+ p_provider_transaction_id: string;
2540
+ };
2541
+ Returns: Json;
2542
+ };
2369
2543
  add_shop_product_file: {
2370
2544
  Args: {
2371
2545
  p_file_name: string;
@@ -2377,6 +2551,10 @@ export type Database = {
2377
2551
  };
2378
2552
  Returns: Json;
2379
2553
  };
2554
+ admin_grant_creator_subscription: {
2555
+ Args: { p_months?: number; p_plan_id: number; p_profile_id: string };
2556
+ Returns: Json;
2557
+ };
2380
2558
  approve_newsletter_post: { Args: { p_post_id: string }; Returns: Json };
2381
2559
  approve_shop_category: { Args: { p_category_id: string }; Returns: Json };
2382
2560
  approve_shop_product: { Args: { p_product_id: string }; Returns: Json };
@@ -2391,6 +2569,10 @@ export type Database = {
2391
2569
  Args: { p_order_item_id: string; p_reason: string };
2392
2570
  Returns: Json;
2393
2571
  };
2572
+ cancel_creator_platform_subscription: {
2573
+ Args: { p_service_type: string };
2574
+ Returns: Json;
2575
+ };
2394
2576
  check_newsletter_post_access: {
2395
2577
  Args: { p_post_id: string };
2396
2578
  Returns: {
@@ -2473,6 +2655,10 @@ export type Database = {
2473
2655
  unique_supporters_change: number;
2474
2656
  }[];
2475
2657
  };
2658
+ get_creator_effective_fee_rate: {
2659
+ Args: { p_profile_id: string; p_service_type: string };
2660
+ Returns: number;
2661
+ };
2476
2662
  get_followers: { Args: { target_user_id: string }; Returns: string[] };
2477
2663
  get_following: { Args: { target_user_id: string }; Returns: string[] };
2478
2664
  get_messages: {
@@ -2619,6 +2805,7 @@ export type Database = {
2619
2805
  };
2620
2806
  Returns: Json;
2621
2807
  };
2808
+ get_shop_stats: { Args: never; Returns: Json };
2622
2809
  get_supporter_coffee_gifts_stats: {
2623
2810
  Args: {
2624
2811
  p_from_date: string;
@@ -2783,7 +2970,6 @@ export type Database = {
2783
2970
  p_identity_hash: string;
2784
2971
  p_is_monthly?: boolean;
2785
2972
  p_message?: string;
2786
- p_platform_fee: number;
2787
2973
  p_provider: Database["public"]["Enums"]["provider_enum"];
2788
2974
  p_provider_transaction_id: string;
2789
2975
  p_reference_type: Database["public"]["Enums"]["reference_type_enum"];
@@ -2793,6 +2979,7 @@ export type Database = {
2793
2979
  };
2794
2980
  Returns: Json;
2795
2981
  };
2982
+ process_creator_subscription_expiry: { Args: never; Returns: undefined };
2796
2983
  process_membership_expiry_notifications: {
2797
2984
  Args: never;
2798
2985
  Returns: undefined;
@@ -2830,7 +3017,6 @@ export type Database = {
2830
3017
  p_identity_hash: string;
2831
3018
  p_message?: string;
2832
3019
  p_plan_id: string;
2833
- p_platform_fee: number;
2834
3020
  p_provider: Database["public"]["Enums"]["provider_enum"];
2835
3021
  p_provider_transaction_id: string;
2836
3022
  p_source?: string;
@@ -2845,7 +3031,6 @@ export type Database = {
2845
3031
  p_buyer_profile_id: string;
2846
3032
  p_identity_hash: string;
2847
3033
  p_message?: string;
2848
- p_platform_fee: number;
2849
3034
  p_post_id: string;
2850
3035
  p_provider: Database["public"]["Enums"]["provider_enum"];
2851
3036
  p_provider_transaction_id: string;
@@ -2861,6 +3046,7 @@ export type Database = {
2861
3046
  Args: { p_post_id: string };
2862
3047
  Returns: undefined;
2863
3048
  };
3049
+ record_shop_view: { Args: { p_username: string }; Returns: undefined };
2864
3050
  reject_newsletter_post: {
2865
3051
  Args: { p_post_id: string; p_rejection_reason: string };
2866
3052
  Returns: Json;
@@ -2895,6 +3081,10 @@ export type Database = {
2895
3081
  sender_id: string;
2896
3082
  }[];
2897
3083
  };
3084
+ set_shop_active_by_manager: {
3085
+ Args: { p_is_active: boolean; p_profile_id: string };
3086
+ Returns: Json;
3087
+ };
2898
3088
  toggle_follow: { Args: { target_user_id: string }; Returns: boolean };
2899
3089
  toggle_newsletter_post_like: {
2900
3090
  Args: { p_post_id: string };
@@ -2981,10 +3171,17 @@ export type Database = {
2981
3171
  upsert_shop_settings: {
2982
3172
  Args: {
2983
3173
  p_banner_url?: string;
3174
+ p_cod_enabled?: boolean;
2984
3175
  p_is_active?: boolean;
2985
3176
  p_logo_url?: string;
3177
+ p_processing_max_days?: number;
3178
+ p_processing_min_days?: number;
3179
+ p_requires_shipping?: boolean;
2986
3180
  p_seo_description?: string;
2987
3181
  p_seo_title?: string;
3182
+ p_shipping_fee_inside_dhaka?: number;
3183
+ p_shipping_fee_outside_dhaka?: number;
3184
+ p_shipping_from_address?: Json;
2988
3185
  p_shop_description?: string;
2989
3186
  p_shop_name?: string;
2990
3187
  p_theme_config?: Json;
@@ -3082,7 +3279,7 @@ export type Database = {
3082
3279
  | "refunded"
3083
3280
  | "reviewing";
3084
3281
  payout_provider: "bkash" | "nagad" | "rocket" | "bank";
3085
- post_status_enum: "draft" | "published" | "archived" | "review";
3282
+ post_status_enum: "draft" | "published" | "review" | "archived";
3086
3283
  post_version_source_enum:
3087
3284
  | "autosave"
3088
3285
  | "ai_polish"
@@ -3358,7 +3555,7 @@ export const Constants = {
3358
3555
  "reviewing",
3359
3556
  ],
3360
3557
  payout_provider: ["bkash", "nagad", "rocket", "bank"],
3361
- post_status_enum: ["draft", "published", "archived", "review"],
3558
+ post_status_enum: ["draft", "published", "review", "archived"],
3362
3559
  post_version_source_enum: [
3363
3560
  "autosave",
3364
3561
  "ai_polish",