@hobenakicoffee/libraries 3.4.2 → 4.1.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.
Files changed (38) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +119 -246
  3. package/package.json +25 -22
  4. package/src/App.tsx +194 -19
  5. package/src/index.css +0 -1
  6. package/src/types/supabase.ts +940 -3
  7. package/src/components/turnstile-captcha.tsx +0 -47
  8. package/src/components/ui/button.tsx +0 -77
  9. package/src/components/ui/calendar.tsx +0 -235
  10. package/src/components/ui/spinner.tsx +0 -18
  11. package/src/constants/common.test.ts +0 -33
  12. package/src/constants/legal.test.ts +0 -72
  13. package/src/constants/payment.test.ts +0 -259
  14. package/src/constants/platforms.test.ts +0 -66
  15. package/src/constants/services.test.ts +0 -58
  16. package/src/lib/utils.ts +0 -6
  17. package/src/moderation/profanity-service.test.ts +0 -106
  18. package/src/providers/theme-provider.tsx +0 -73
  19. package/src/utils/check-moderation.test.ts +0 -321
  20. package/src/utils/format-amount.test.ts +0 -30
  21. package/src/utils/format-count.test.ts +0 -56
  22. package/src/utils/format-date.test.ts +0 -19
  23. package/src/utils/format-number.test.ts +0 -29
  24. package/src/utils/format-plain-text.test.ts +0 -36
  25. package/src/utils/get-newsletter-post-link.test.ts +0 -27
  26. package/src/utils/get-product-link.test.ts +0 -34
  27. package/src/utils/get-social-handle.test.ts +0 -32
  28. package/src/utils/get-social-link.test.ts +0 -63
  29. package/src/utils/get-user-name-initials.test.ts +0 -34
  30. package/src/utils/get-user-page-link.test.ts +0 -9
  31. package/src/utils/open-to-new-window.test.ts +0 -34
  32. package/src/utils/post-to-facebook.test.ts +0 -43
  33. package/src/utils/post-to-instagram.test.ts +0 -56
  34. package/src/utils/post-to-linkedin.test.ts +0 -43
  35. package/src/utils/post-to-x.test.ts +0 -45
  36. package/src/utils/qr-svg-utils.test.ts +0 -104
  37. package/src/utils/to-human-readable.test.ts +0 -25
  38. package/src/utils/validate-phone-number.test.ts +0 -28
@@ -464,7 +464,7 @@ export type Database = {
464
464
  },
465
465
  ];
466
466
  };
467
- messages_2026_02: {
467
+ messages_2026_03: {
468
468
  Row: {
469
469
  content: string;
470
470
  conversation_id: string;
@@ -488,7 +488,7 @@ export type Database = {
488
488
  };
489
489
  Relationships: [];
490
490
  };
491
- messages_2026_03: {
491
+ messages_2026_04: {
492
492
  Row: {
493
493
  content: string;
494
494
  conversation_id: string;
@@ -512,7 +512,31 @@ export type Database = {
512
512
  };
513
513
  Relationships: [];
514
514
  };
515
- messages_2026_04: {
515
+ messages_2026_05: {
516
+ Row: {
517
+ content: string;
518
+ conversation_id: string;
519
+ created_at: string;
520
+ id: number;
521
+ sender_id: string;
522
+ };
523
+ Insert: {
524
+ content: string;
525
+ conversation_id: string;
526
+ created_at?: string;
527
+ id?: number;
528
+ sender_id: string;
529
+ };
530
+ Update: {
531
+ content?: string;
532
+ conversation_id?: string;
533
+ created_at?: string;
534
+ id?: number;
535
+ sender_id?: string;
536
+ };
537
+ Relationships: [];
538
+ };
539
+ messages_2026_06: {
516
540
  Row: {
517
541
  content: string;
518
542
  conversation_id: string;
@@ -881,6 +905,27 @@ export type Database = {
881
905
  },
882
906
  ];
883
907
  };
908
+ platform_settings: {
909
+ Row: {
910
+ description: string | null;
911
+ key: string;
912
+ updated_at: string;
913
+ value: Json;
914
+ };
915
+ Insert: {
916
+ description?: string | null;
917
+ key: string;
918
+ updated_at?: string;
919
+ value: Json;
920
+ };
921
+ Update: {
922
+ description?: string | null;
923
+ key?: string;
924
+ updated_at?: string;
925
+ value?: Json;
926
+ };
927
+ Relationships: [];
928
+ };
884
929
  post_access_grants: {
885
930
  Row: {
886
931
  created_at: string;
@@ -1169,6 +1214,589 @@ export type Database = {
1169
1214
  },
1170
1215
  ];
1171
1216
  };
1217
+ shop_categories: {
1218
+ Row: {
1219
+ created_at: string;
1220
+ id: string;
1221
+ is_visible: boolean;
1222
+ name: string;
1223
+ profile_id: string;
1224
+ slug: string;
1225
+ sort_order: number;
1226
+ updated_at: string;
1227
+ };
1228
+ Insert: {
1229
+ created_at?: string;
1230
+ id?: string;
1231
+ is_visible?: boolean;
1232
+ name: string;
1233
+ profile_id: string;
1234
+ slug: string;
1235
+ sort_order?: number;
1236
+ updated_at?: string;
1237
+ };
1238
+ Update: {
1239
+ created_at?: string;
1240
+ id?: string;
1241
+ is_visible?: boolean;
1242
+ name?: string;
1243
+ profile_id?: string;
1244
+ slug?: string;
1245
+ sort_order?: number;
1246
+ updated_at?: string;
1247
+ };
1248
+ Relationships: [
1249
+ {
1250
+ foreignKeyName: "shop_categories_profile_id_fkey";
1251
+ columns: ["profile_id"];
1252
+ isOneToOne: false;
1253
+ referencedRelation: "profiles";
1254
+ referencedColumns: ["id"];
1255
+ },
1256
+ ];
1257
+ };
1258
+ shop_download_tokens: {
1259
+ Row: {
1260
+ buyer_profile_id: string;
1261
+ created_at: string;
1262
+ download_count: number;
1263
+ expires_at: string;
1264
+ file_id: string;
1265
+ id: string;
1266
+ max_downloads: number;
1267
+ order_item_id: string;
1268
+ token: string;
1269
+ };
1270
+ Insert: {
1271
+ buyer_profile_id: string;
1272
+ created_at?: string;
1273
+ download_count?: number;
1274
+ expires_at: string;
1275
+ file_id: string;
1276
+ id?: string;
1277
+ max_downloads: number;
1278
+ order_item_id: string;
1279
+ token: string;
1280
+ };
1281
+ Update: {
1282
+ buyer_profile_id?: string;
1283
+ created_at?: string;
1284
+ download_count?: number;
1285
+ expires_at?: string;
1286
+ file_id?: string;
1287
+ id?: string;
1288
+ max_downloads?: number;
1289
+ order_item_id?: string;
1290
+ token?: string;
1291
+ };
1292
+ Relationships: [
1293
+ {
1294
+ foreignKeyName: "shop_download_tokens_buyer_profile_id_fkey";
1295
+ columns: ["buyer_profile_id"];
1296
+ isOneToOne: false;
1297
+ referencedRelation: "profiles";
1298
+ referencedColumns: ["id"];
1299
+ },
1300
+ {
1301
+ foreignKeyName: "shop_download_tokens_file_id_fkey";
1302
+ columns: ["file_id"];
1303
+ isOneToOne: false;
1304
+ referencedRelation: "shop_product_files";
1305
+ referencedColumns: ["id"];
1306
+ },
1307
+ {
1308
+ foreignKeyName: "shop_download_tokens_order_item_id_fkey";
1309
+ columns: ["order_item_id"];
1310
+ isOneToOne: false;
1311
+ referencedRelation: "shop_order_items";
1312
+ referencedColumns: ["id"];
1313
+ },
1314
+ ];
1315
+ };
1316
+ shop_order_items: {
1317
+ Row: {
1318
+ cancellation_reason: string | null;
1319
+ carrier: string | null;
1320
+ cod_settled_at: string | null;
1321
+ created_at: string;
1322
+ delivered_at: string | null;
1323
+ id: string;
1324
+ order_id: string;
1325
+ product_id: string;
1326
+ product_title: string;
1327
+ product_type: Database["public"]["Enums"]["shop_product_type_enum"];
1328
+ quantity: number;
1329
+ shipped_at: string | null;
1330
+ shipping_cost: number;
1331
+ status: Database["public"]["Enums"]["shop_order_item_status_enum"];
1332
+ tracking_number: string | null;
1333
+ tracking_url: string | null;
1334
+ unit_price: number;
1335
+ updated_at: string;
1336
+ variant_id: string | null;
1337
+ variant_label: string | null;
1338
+ variant_options: Json | null;
1339
+ };
1340
+ Insert: {
1341
+ cancellation_reason?: string | null;
1342
+ carrier?: string | null;
1343
+ cod_settled_at?: string | null;
1344
+ created_at?: string;
1345
+ delivered_at?: string | null;
1346
+ id?: string;
1347
+ order_id: string;
1348
+ product_id: string;
1349
+ product_title: string;
1350
+ product_type: Database["public"]["Enums"]["shop_product_type_enum"];
1351
+ quantity?: number;
1352
+ shipped_at?: string | null;
1353
+ shipping_cost?: number;
1354
+ status?: Database["public"]["Enums"]["shop_order_item_status_enum"];
1355
+ tracking_number?: string | null;
1356
+ tracking_url?: string | null;
1357
+ unit_price: number;
1358
+ updated_at?: string;
1359
+ variant_id?: string | null;
1360
+ variant_label?: string | null;
1361
+ variant_options?: Json | null;
1362
+ };
1363
+ Update: {
1364
+ cancellation_reason?: string | null;
1365
+ carrier?: string | null;
1366
+ cod_settled_at?: string | null;
1367
+ created_at?: string;
1368
+ delivered_at?: string | null;
1369
+ id?: string;
1370
+ order_id?: string;
1371
+ product_id?: string;
1372
+ product_title?: string;
1373
+ product_type?: Database["public"]["Enums"]["shop_product_type_enum"];
1374
+ quantity?: number;
1375
+ shipped_at?: string | null;
1376
+ shipping_cost?: number;
1377
+ status?: Database["public"]["Enums"]["shop_order_item_status_enum"];
1378
+ tracking_number?: string | null;
1379
+ tracking_url?: string | null;
1380
+ unit_price?: number;
1381
+ updated_at?: string;
1382
+ variant_id?: string | null;
1383
+ variant_label?: string | null;
1384
+ variant_options?: Json | null;
1385
+ };
1386
+ Relationships: [
1387
+ {
1388
+ foreignKeyName: "shop_order_items_order_id_fkey";
1389
+ columns: ["order_id"];
1390
+ isOneToOne: false;
1391
+ referencedRelation: "shop_orders";
1392
+ referencedColumns: ["id"];
1393
+ },
1394
+ {
1395
+ foreignKeyName: "shop_order_items_product_id_fkey";
1396
+ columns: ["product_id"];
1397
+ isOneToOne: false;
1398
+ referencedRelation: "shop_products";
1399
+ referencedColumns: ["id"];
1400
+ },
1401
+ {
1402
+ foreignKeyName: "shop_order_items_variant_id_fkey";
1403
+ columns: ["variant_id"];
1404
+ isOneToOne: false;
1405
+ referencedRelation: "shop_product_variants";
1406
+ referencedColumns: ["id"];
1407
+ },
1408
+ ];
1409
+ };
1410
+ shop_orders: {
1411
+ Row: {
1412
+ buyer_notes: string | null;
1413
+ buyer_profile_id: string;
1414
+ cod_settled_at: string | null;
1415
+ created_at: string;
1416
+ has_digital: boolean;
1417
+ has_physical: boolean;
1418
+ id: string;
1419
+ order_number: string;
1420
+ payment_method: Database["public"]["Enums"]["shop_payment_method_enum"];
1421
+ platform_fee: number;
1422
+ platform_fee_rate: number;
1423
+ seller_net: number;
1424
+ seller_notes: string | null;
1425
+ seller_profile_id: string;
1426
+ shipping_address: Json | null;
1427
+ shipping_total: number;
1428
+ subtotal: number;
1429
+ transaction_reference_id: string | null;
1430
+ updated_at: string;
1431
+ };
1432
+ Insert: {
1433
+ buyer_notes?: string | null;
1434
+ buyer_profile_id: string;
1435
+ cod_settled_at?: string | null;
1436
+ created_at?: string;
1437
+ has_digital?: boolean;
1438
+ has_physical?: boolean;
1439
+ id?: string;
1440
+ order_number: string;
1441
+ payment_method?: Database["public"]["Enums"]["shop_payment_method_enum"];
1442
+ platform_fee: number;
1443
+ platform_fee_rate: number;
1444
+ seller_net: number;
1445
+ seller_notes?: string | null;
1446
+ seller_profile_id: string;
1447
+ shipping_address?: Json | null;
1448
+ shipping_total?: number;
1449
+ subtotal: number;
1450
+ transaction_reference_id?: string | null;
1451
+ updated_at?: string;
1452
+ };
1453
+ Update: {
1454
+ buyer_notes?: string | null;
1455
+ buyer_profile_id?: string;
1456
+ cod_settled_at?: string | null;
1457
+ created_at?: string;
1458
+ has_digital?: boolean;
1459
+ has_physical?: boolean;
1460
+ id?: string;
1461
+ order_number?: string;
1462
+ payment_method?: Database["public"]["Enums"]["shop_payment_method_enum"];
1463
+ platform_fee?: number;
1464
+ platform_fee_rate?: number;
1465
+ seller_net?: number;
1466
+ seller_notes?: string | null;
1467
+ seller_profile_id?: string;
1468
+ shipping_address?: Json | null;
1469
+ shipping_total?: number;
1470
+ subtotal?: number;
1471
+ transaction_reference_id?: string | null;
1472
+ updated_at?: string;
1473
+ };
1474
+ Relationships: [
1475
+ {
1476
+ foreignKeyName: "shop_orders_buyer_profile_id_fkey";
1477
+ columns: ["buyer_profile_id"];
1478
+ isOneToOne: false;
1479
+ referencedRelation: "profiles";
1480
+ referencedColumns: ["id"];
1481
+ },
1482
+ {
1483
+ foreignKeyName: "shop_orders_seller_profile_id_fkey";
1484
+ columns: ["seller_profile_id"];
1485
+ isOneToOne: false;
1486
+ referencedRelation: "profiles";
1487
+ referencedColumns: ["id"];
1488
+ },
1489
+ {
1490
+ foreignKeyName: "shop_orders_transaction_reference_id_fkey";
1491
+ columns: ["transaction_reference_id"];
1492
+ isOneToOne: false;
1493
+ referencedRelation: "transactions";
1494
+ referencedColumns: ["reference_id"];
1495
+ },
1496
+ ];
1497
+ };
1498
+ shop_policies: {
1499
+ Row: {
1500
+ content: string;
1501
+ created_at: string;
1502
+ id: string;
1503
+ is_enabled: boolean;
1504
+ policy_type: Database["public"]["Enums"]["shop_policy_type_enum"];
1505
+ profile_id: string;
1506
+ updated_at: string;
1507
+ };
1508
+ Insert: {
1509
+ content: string;
1510
+ created_at?: string;
1511
+ id?: string;
1512
+ is_enabled?: boolean;
1513
+ policy_type: Database["public"]["Enums"]["shop_policy_type_enum"];
1514
+ profile_id: string;
1515
+ updated_at?: string;
1516
+ };
1517
+ Update: {
1518
+ content?: string;
1519
+ created_at?: string;
1520
+ id?: string;
1521
+ is_enabled?: boolean;
1522
+ policy_type?: Database["public"]["Enums"]["shop_policy_type_enum"];
1523
+ profile_id?: string;
1524
+ updated_at?: string;
1525
+ };
1526
+ Relationships: [
1527
+ {
1528
+ foreignKeyName: "shop_policies_profile_id_fkey";
1529
+ columns: ["profile_id"];
1530
+ isOneToOne: false;
1531
+ referencedRelation: "profiles";
1532
+ referencedColumns: ["id"];
1533
+ },
1534
+ ];
1535
+ };
1536
+ shop_product_files: {
1537
+ Row: {
1538
+ created_at: string;
1539
+ file_name: string;
1540
+ file_size_bytes: number | null;
1541
+ id: string;
1542
+ is_deleted: boolean;
1543
+ mime_type: string | null;
1544
+ product_id: string;
1545
+ sort_order: number;
1546
+ storage_path: string;
1547
+ };
1548
+ Insert: {
1549
+ created_at?: string;
1550
+ file_name: string;
1551
+ file_size_bytes?: number | null;
1552
+ id?: string;
1553
+ is_deleted?: boolean;
1554
+ mime_type?: string | null;
1555
+ product_id: string;
1556
+ sort_order?: number;
1557
+ storage_path: string;
1558
+ };
1559
+ Update: {
1560
+ created_at?: string;
1561
+ file_name?: string;
1562
+ file_size_bytes?: number | null;
1563
+ id?: string;
1564
+ is_deleted?: boolean;
1565
+ mime_type?: string | null;
1566
+ product_id?: string;
1567
+ sort_order?: number;
1568
+ storage_path?: string;
1569
+ };
1570
+ Relationships: [
1571
+ {
1572
+ foreignKeyName: "shop_product_files_product_id_fkey";
1573
+ columns: ["product_id"];
1574
+ isOneToOne: false;
1575
+ referencedRelation: "shop_products";
1576
+ referencedColumns: ["id"];
1577
+ },
1578
+ ];
1579
+ };
1580
+ shop_product_variants: {
1581
+ Row: {
1582
+ id: string;
1583
+ image_url: string | null;
1584
+ is_active: boolean;
1585
+ options: Json;
1586
+ price_adjustment: number;
1587
+ product_id: string;
1588
+ sku: string | null;
1589
+ sort_order: number;
1590
+ stock_count: number | null;
1591
+ };
1592
+ Insert: {
1593
+ id?: string;
1594
+ image_url?: string | null;
1595
+ is_active?: boolean;
1596
+ options: Json;
1597
+ price_adjustment?: number;
1598
+ product_id: string;
1599
+ sku?: string | null;
1600
+ sort_order?: number;
1601
+ stock_count?: number | null;
1602
+ };
1603
+ Update: {
1604
+ id?: string;
1605
+ image_url?: string | null;
1606
+ is_active?: boolean;
1607
+ options?: Json;
1608
+ price_adjustment?: number;
1609
+ product_id?: string;
1610
+ sku?: string | null;
1611
+ sort_order?: number;
1612
+ stock_count?: number | null;
1613
+ };
1614
+ Relationships: [
1615
+ {
1616
+ foreignKeyName: "shop_product_variants_product_id_fkey";
1617
+ columns: ["product_id"];
1618
+ isOneToOne: false;
1619
+ referencedRelation: "shop_products";
1620
+ referencedColumns: ["id"];
1621
+ },
1622
+ ];
1623
+ };
1624
+ shop_products: {
1625
+ Row: {
1626
+ category_id: string | null;
1627
+ cod_enabled: boolean;
1628
+ compare_at_price: number | null;
1629
+ cover_image_url: string | null;
1630
+ created_at: string;
1631
+ description: string | null;
1632
+ download_expires_hours: number;
1633
+ id: string;
1634
+ images: string[];
1635
+ is_active: boolean;
1636
+ is_deleted: boolean;
1637
+ is_featured: boolean;
1638
+ low_stock_threshold: number;
1639
+ max_downloads: number;
1640
+ option_definitions: Json;
1641
+ price: number;
1642
+ processing_max_days: number | null;
1643
+ processing_min_days: number | null;
1644
+ product_type: Database["public"]["Enums"]["shop_product_type_enum"];
1645
+ profile_id: string;
1646
+ requires_shipping: boolean;
1647
+ sales_count: number;
1648
+ shipping_fee_inside_dhaka: number;
1649
+ shipping_fee_outside_dhaka: number;
1650
+ sku: string | null;
1651
+ slug: string;
1652
+ sort_order: number;
1653
+ stock_count: number | null;
1654
+ tags: string[];
1655
+ title: string;
1656
+ updated_at: string;
1657
+ weight_grams: number | null;
1658
+ };
1659
+ Insert: {
1660
+ category_id?: string | null;
1661
+ cod_enabled?: boolean;
1662
+ compare_at_price?: number | null;
1663
+ cover_image_url?: string | null;
1664
+ created_at?: string;
1665
+ description?: string | null;
1666
+ download_expires_hours?: number;
1667
+ id?: string;
1668
+ images?: string[];
1669
+ is_active?: boolean;
1670
+ is_deleted?: boolean;
1671
+ is_featured?: boolean;
1672
+ low_stock_threshold?: number;
1673
+ max_downloads?: number;
1674
+ option_definitions?: Json;
1675
+ price: number;
1676
+ processing_max_days?: number | null;
1677
+ processing_min_days?: number | null;
1678
+ product_type: Database["public"]["Enums"]["shop_product_type_enum"];
1679
+ profile_id: string;
1680
+ requires_shipping?: boolean;
1681
+ sales_count?: number;
1682
+ shipping_fee_inside_dhaka?: number;
1683
+ shipping_fee_outside_dhaka?: number;
1684
+ sku?: string | null;
1685
+ slug: string;
1686
+ sort_order?: number;
1687
+ stock_count?: number | null;
1688
+ tags?: string[];
1689
+ title: string;
1690
+ updated_at?: string;
1691
+ weight_grams?: number | null;
1692
+ };
1693
+ Update: {
1694
+ category_id?: string | null;
1695
+ cod_enabled?: boolean;
1696
+ compare_at_price?: number | null;
1697
+ cover_image_url?: string | null;
1698
+ created_at?: string;
1699
+ description?: string | null;
1700
+ download_expires_hours?: number;
1701
+ id?: string;
1702
+ images?: string[];
1703
+ is_active?: boolean;
1704
+ is_deleted?: boolean;
1705
+ is_featured?: boolean;
1706
+ low_stock_threshold?: number;
1707
+ max_downloads?: number;
1708
+ option_definitions?: Json;
1709
+ price?: number;
1710
+ processing_max_days?: number | null;
1711
+ processing_min_days?: number | null;
1712
+ product_type?: Database["public"]["Enums"]["shop_product_type_enum"];
1713
+ profile_id?: string;
1714
+ requires_shipping?: boolean;
1715
+ sales_count?: number;
1716
+ shipping_fee_inside_dhaka?: number;
1717
+ shipping_fee_outside_dhaka?: number;
1718
+ sku?: string | null;
1719
+ slug?: string;
1720
+ sort_order?: number;
1721
+ stock_count?: number | null;
1722
+ tags?: string[];
1723
+ title?: string;
1724
+ updated_at?: string;
1725
+ weight_grams?: number | null;
1726
+ };
1727
+ Relationships: [
1728
+ {
1729
+ foreignKeyName: "shop_products_category_id_fkey";
1730
+ columns: ["category_id"];
1731
+ isOneToOne: false;
1732
+ referencedRelation: "shop_categories";
1733
+ referencedColumns: ["id"];
1734
+ },
1735
+ {
1736
+ foreignKeyName: "shop_products_profile_id_fkey";
1737
+ columns: ["profile_id"];
1738
+ isOneToOne: false;
1739
+ referencedRelation: "profiles";
1740
+ referencedColumns: ["id"];
1741
+ },
1742
+ ];
1743
+ };
1744
+ shop_settings: {
1745
+ Row: {
1746
+ banner_url: string | null;
1747
+ created_at: string;
1748
+ deactivation_reason: string | null;
1749
+ id: string;
1750
+ is_active: boolean;
1751
+ logo_url: string | null;
1752
+ profile_id: string;
1753
+ seo_description: string | null;
1754
+ seo_title: string | null;
1755
+ shop_description: string | null;
1756
+ shop_name: string;
1757
+ theme_config: Json;
1758
+ updated_at: string;
1759
+ };
1760
+ Insert: {
1761
+ banner_url?: string | null;
1762
+ created_at?: string;
1763
+ deactivation_reason?: string | null;
1764
+ id?: string;
1765
+ is_active?: boolean;
1766
+ logo_url?: string | null;
1767
+ profile_id: string;
1768
+ seo_description?: string | null;
1769
+ seo_title?: string | null;
1770
+ shop_description?: string | null;
1771
+ shop_name: string;
1772
+ theme_config?: Json;
1773
+ updated_at?: string;
1774
+ };
1775
+ Update: {
1776
+ banner_url?: string | null;
1777
+ created_at?: string;
1778
+ deactivation_reason?: string | null;
1779
+ id?: string;
1780
+ is_active?: boolean;
1781
+ logo_url?: string | null;
1782
+ profile_id?: string;
1783
+ seo_description?: string | null;
1784
+ seo_title?: string | null;
1785
+ shop_description?: string | null;
1786
+ shop_name?: string;
1787
+ theme_config?: Json;
1788
+ updated_at?: string;
1789
+ };
1790
+ Relationships: [
1791
+ {
1792
+ foreignKeyName: "shop_settings_profile_id_fkey";
1793
+ columns: ["profile_id"];
1794
+ isOneToOne: true;
1795
+ referencedRelation: "profiles";
1796
+ referencedColumns: ["id"];
1797
+ },
1798
+ ];
1799
+ };
1172
1800
  supporters: {
1173
1801
  Row: {
1174
1802
  conversation_id: string | null;
@@ -1359,6 +1987,62 @@ export type Database = {
1359
1987
  },
1360
1988
  ];
1361
1989
  };
1990
+ user_addresses: {
1991
+ Row: {
1992
+ address_line1: string;
1993
+ address_line2: string | null;
1994
+ city: string;
1995
+ created_at: string;
1996
+ district: string;
1997
+ id: string;
1998
+ is_default: boolean;
1999
+ label: string | null;
2000
+ phone: string;
2001
+ postal_code: string | null;
2002
+ profile_id: string;
2003
+ recipient_name: string;
2004
+ updated_at: string;
2005
+ };
2006
+ Insert: {
2007
+ address_line1: string;
2008
+ address_line2?: string | null;
2009
+ city: string;
2010
+ created_at?: string;
2011
+ district: string;
2012
+ id?: string;
2013
+ is_default?: boolean;
2014
+ label?: string | null;
2015
+ phone: string;
2016
+ postal_code?: string | null;
2017
+ profile_id: string;
2018
+ recipient_name: string;
2019
+ updated_at?: string;
2020
+ };
2021
+ Update: {
2022
+ address_line1?: string;
2023
+ address_line2?: string | null;
2024
+ city?: string;
2025
+ created_at?: string;
2026
+ district?: string;
2027
+ id?: string;
2028
+ is_default?: boolean;
2029
+ label?: string | null;
2030
+ phone?: string;
2031
+ postal_code?: string | null;
2032
+ profile_id?: string;
2033
+ recipient_name?: string;
2034
+ updated_at?: string;
2035
+ };
2036
+ Relationships: [
2037
+ {
2038
+ foreignKeyName: "user_addresses_profile_id_fkey";
2039
+ columns: ["profile_id"];
2040
+ isOneToOne: false;
2041
+ referencedRelation: "profiles";
2042
+ referencedColumns: ["id"];
2043
+ },
2044
+ ];
2045
+ };
1362
2046
  user_services: {
1363
2047
  Row: {
1364
2048
  config: Json | null;
@@ -1400,6 +2084,7 @@ export type Database = {
1400
2084
  wallets: {
1401
2085
  Row: {
1402
2086
  balance: number;
2087
+ cod_debt: number;
1403
2088
  created_at: string;
1404
2089
  currency: string;
1405
2090
  id: string;
@@ -1409,6 +2094,7 @@ export type Database = {
1409
2094
  };
1410
2095
  Insert: {
1411
2096
  balance?: number;
2097
+ cod_debt?: number;
1412
2098
  created_at?: string;
1413
2099
  currency?: string;
1414
2100
  id?: string;
@@ -1418,6 +2104,7 @@ export type Database = {
1418
2104
  };
1419
2105
  Update: {
1420
2106
  balance?: number;
2107
+ cod_debt?: number;
1421
2108
  created_at?: string;
1422
2109
  currency?: string;
1423
2110
  id?: string;
@@ -1513,12 +2200,28 @@ export type Database = {
1513
2200
  [_ in never]: never;
1514
2201
  };
1515
2202
  Functions: {
2203
+ add_shop_product_file: {
2204
+ Args: {
2205
+ p_file_name: string;
2206
+ p_file_size_bytes?: number;
2207
+ p_mime_type?: string;
2208
+ p_product_id: string;
2209
+ p_sort_order?: number;
2210
+ p_storage_path: string;
2211
+ };
2212
+ Returns: Json;
2213
+ };
1516
2214
  authorize_manager: {
1517
2215
  Args: {
1518
2216
  requested_permission: Database["public"]["Enums"]["manager_permission"];
1519
2217
  };
1520
2218
  Returns: boolean;
1521
2219
  };
2220
+ auto_deactivate_ineligible_shops: { Args: never; Returns: Json };
2221
+ cancel_cod_order_item: {
2222
+ Args: { p_order_item_id: string; p_reason: string };
2223
+ Returns: Json;
2224
+ };
1522
2225
  check_newsletter_post_access: {
1523
2226
  Args: { p_post_id: string };
1524
2227
  Returns: {
@@ -1526,7 +2229,15 @@ export type Database = {
1526
2229
  has_access: boolean;
1527
2230
  }[];
1528
2231
  };
2232
+ check_shop_active_eligibility: {
2233
+ Args: { p_profile_id: string };
2234
+ Returns: Json;
2235
+ };
1529
2236
  cleanup_orphaned_post_images: { Args: never; Returns: undefined };
2237
+ confirm_cod_cash_received: {
2238
+ Args: { p_order_item_id: string };
2239
+ Returns: Json;
2240
+ };
1530
2241
  create_manager: {
1531
2242
  Args: {
1532
2243
  manager_department?: string;
@@ -1546,8 +2257,26 @@ export type Database = {
1546
2257
  };
1547
2258
  create_next_month_partition: { Args: never; Returns: undefined };
1548
2259
  custom_access_token_hook: { Args: { event: Json }; Returns: Json };
2260
+ delete_shop_category: { Args: { p_category_id: string }; Returns: Json };
2261
+ delete_shop_policy: {
2262
+ Args: {
2263
+ p_policy_type: Database["public"]["Enums"]["shop_policy_type_enum"];
2264
+ };
2265
+ Returns: Json;
2266
+ };
2267
+ delete_shop_product: { Args: { p_product_id: string }; Returns: Json };
2268
+ delete_shop_product_file: { Args: { p_file_id: string }; Returns: Json };
2269
+ delete_shop_product_variant: {
2270
+ Args: { p_variant_id: string };
2271
+ Returns: Json;
2272
+ };
2273
+ delete_user_address: { Args: { p_address_id: string }; Returns: Json };
1549
2274
  drop_old_partitions: { Args: never; Returns: undefined };
1550
2275
  follow_user: { Args: { target_user_id: string }; Returns: undefined };
2276
+ get_buyer_orders: {
2277
+ Args: { p_cursor?: string; p_limit?: number };
2278
+ Returns: Json;
2279
+ };
1551
2280
  get_conversations: {
1552
2281
  Args: { p_limit?: number; p_offset?: number };
1553
2282
  Returns: {
@@ -1607,6 +2336,8 @@ export type Database = {
1607
2336
  Args: { p_recipient_id: string };
1608
2337
  Returns: string;
1609
2338
  };
2339
+ get_order_by_number: { Args: { p_order_number: string }; Returns: Json };
2340
+ get_platform_setting: { Args: { p_key: string }; Returns: number };
1610
2341
  get_popular_content: {
1611
2342
  Args: { p_creator_id: string; p_from_date: string; p_to_date: string };
1612
2343
  Returns: {
@@ -1661,6 +2392,10 @@ export type Database = {
1661
2392
  view_count: number;
1662
2393
  }[];
1663
2394
  };
2395
+ get_product_by_slug: {
2396
+ Args: { p_product_slug: string; p_username: string };
2397
+ Returns: Json;
2398
+ };
1664
2399
  get_reader_feed: {
1665
2400
  Args: {
1666
2401
  p_cursor?: string;
@@ -1694,6 +2429,26 @@ export type Database = {
1694
2429
  view_count: number;
1695
2430
  }[];
1696
2431
  };
2432
+ get_seller_orders: {
2433
+ Args: { p_cursor?: string; p_item_status?: string; p_limit?: number };
2434
+ Returns: Json;
2435
+ };
2436
+ get_shop_by_username: {
2437
+ Args: { p_featured_limit?: number; p_username: string };
2438
+ Returns: Json;
2439
+ };
2440
+ get_shop_overview: { Args: never; Returns: Json };
2441
+ get_shop_policies: { Args: { p_username: string }; Returns: Json };
2442
+ get_shop_products: {
2443
+ Args: {
2444
+ p_category_id?: string;
2445
+ p_cursor_id?: string;
2446
+ p_cursor_sort?: number;
2447
+ p_limit?: number;
2448
+ p_username: string;
2449
+ };
2450
+ Returns: Json;
2451
+ };
1697
2452
  get_supporter_coffee_gifts_stats: {
1698
2453
  Args: {
1699
2454
  p_from_date: string;
@@ -1768,6 +2523,22 @@ export type Database = {
1768
2523
  supporter_id: string;
1769
2524
  }[];
1770
2525
  };
2526
+ get_user_addresses: {
2527
+ Args: never;
2528
+ Returns: {
2529
+ address_line1: string;
2530
+ address_line2: string;
2531
+ city: string;
2532
+ created_at: string;
2533
+ district: string;
2534
+ id: string;
2535
+ is_default: boolean;
2536
+ label: string;
2537
+ phone: string;
2538
+ postal_code: string;
2539
+ recipient_name: string;
2540
+ }[];
2541
+ };
1771
2542
  gift_newsletter_post: {
1772
2543
  Args: {
1773
2544
  p_expires_at?: string;
@@ -1778,6 +2549,10 @@ export type Database = {
1778
2549
  };
1779
2550
  Returns: string;
1780
2551
  };
2552
+ handle_shop_payment_success: {
2553
+ Args: { p_order_id: string; p_transaction_reference_id: string };
2554
+ Returns: Json;
2555
+ };
1781
2556
  handle_successful_payment: {
1782
2557
  Args: {
1783
2558
  p_amount: number;
@@ -1801,6 +2576,15 @@ export type Database = {
1801
2576
  };
1802
2577
  Returns: boolean;
1803
2578
  };
2579
+ initiate_shop_checkout: {
2580
+ Args: {
2581
+ p_address_id?: string;
2582
+ p_buyer_notes?: string;
2583
+ p_items: Json;
2584
+ p_payment_method?: Database["public"]["Enums"]["shop_payment_method_enum"];
2585
+ };
2586
+ Returns: Json;
2587
+ };
1804
2588
  is_admin: { Args: never; Returns: boolean };
1805
2589
  is_following: { Args: { target_user_id: string }; Returns: boolean };
1806
2590
  is_manager: { Args: { user_email: string }; Returns: boolean };
@@ -1808,6 +2592,10 @@ export type Database = {
1808
2592
  Args: { p_conversation_id: string };
1809
2593
  Returns: undefined;
1810
2594
  };
2595
+ mark_order_item_delivered: {
2596
+ Args: { p_order_item_id: string };
2597
+ Returns: Json;
2598
+ };
1811
2599
  perform_coffee_gift: {
1812
2600
  Args: {
1813
2601
  p_amount: number;
@@ -1886,6 +2674,14 @@ export type Database = {
1886
2674
  Args: { p_post_id: string };
1887
2675
  Returns: undefined;
1888
2676
  };
2677
+ reorder_shop_categories: {
2678
+ Args: { p_category_ids: string[] };
2679
+ Returns: Json;
2680
+ };
2681
+ reorder_shop_products: {
2682
+ Args: { p_product_ids: string[] };
2683
+ Returns: Json;
2684
+ };
1889
2685
  request_withdrawal: {
1890
2686
  Args: { p_amount: number; p_payout_method_id: string };
1891
2687
  Returns: string;
@@ -1905,8 +2701,98 @@ export type Database = {
1905
2701
  Args: { p_post_id: string };
1906
2702
  Returns: Json;
1907
2703
  };
2704
+ topup_seller_cod_debt: {
2705
+ Args: { p_amount: number; p_profile_id: string };
2706
+ Returns: Json;
2707
+ };
1908
2708
  unfollow_user: { Args: { target_user_id: string }; Returns: undefined };
1909
2709
  unpublish_newsletter_post: { Args: { p_post_id: string }; Returns: Json };
2710
+ update_order_tracking: {
2711
+ Args: {
2712
+ p_carrier?: string;
2713
+ p_order_item_id: string;
2714
+ p_tracking_number: string;
2715
+ p_tracking_url?: string;
2716
+ };
2717
+ Returns: Json;
2718
+ };
2719
+ upsert_shop_category: {
2720
+ Args: {
2721
+ p_category_id?: string;
2722
+ p_is_visible?: boolean;
2723
+ p_name?: string;
2724
+ p_slug?: string;
2725
+ p_sort_order?: number;
2726
+ };
2727
+ Returns: Json;
2728
+ };
2729
+ upsert_shop_policy: {
2730
+ Args: {
2731
+ p_content?: string;
2732
+ p_is_enabled?: boolean;
2733
+ p_policy_type: Database["public"]["Enums"]["shop_policy_type_enum"];
2734
+ };
2735
+ Returns: Json;
2736
+ };
2737
+ upsert_shop_product: {
2738
+ Args: {
2739
+ p_category_id?: string;
2740
+ p_cod_enabled?: boolean;
2741
+ p_compare_at_price?: number;
2742
+ p_cover_image_url?: string;
2743
+ p_description?: string;
2744
+ p_download_expires_hours?: number;
2745
+ p_images?: string[];
2746
+ p_is_active?: boolean;
2747
+ p_is_featured?: boolean;
2748
+ p_low_stock_threshold?: number;
2749
+ p_max_downloads?: number;
2750
+ p_option_definitions?: Json;
2751
+ p_price?: number;
2752
+ p_processing_max_days?: number;
2753
+ p_processing_min_days?: number;
2754
+ p_product_id?: string;
2755
+ p_product_type?: Database["public"]["Enums"]["shop_product_type_enum"];
2756
+ p_requires_shipping?: boolean;
2757
+ p_shipping_fee_inside_dhaka?: number;
2758
+ p_shipping_fee_outside_dhaka?: number;
2759
+ p_sku?: string;
2760
+ p_slug?: string;
2761
+ p_sort_order?: number;
2762
+ p_stock_count?: number;
2763
+ p_tags?: string[];
2764
+ p_title?: string;
2765
+ p_weight_grams?: number;
2766
+ };
2767
+ Returns: Json;
2768
+ };
2769
+ upsert_shop_product_variant: {
2770
+ Args: {
2771
+ p_image_url?: string;
2772
+ p_is_active?: boolean;
2773
+ p_options?: Json;
2774
+ p_price_adjustment?: number;
2775
+ p_product_id?: string;
2776
+ p_sku?: string;
2777
+ p_sort_order?: number;
2778
+ p_stock_count?: number;
2779
+ p_variant_id?: string;
2780
+ };
2781
+ Returns: Json;
2782
+ };
2783
+ upsert_shop_settings: {
2784
+ Args: {
2785
+ p_banner_url?: string;
2786
+ p_is_active?: boolean;
2787
+ p_logo_url?: string;
2788
+ p_seo_description?: string;
2789
+ p_seo_title?: string;
2790
+ p_shop_description?: string;
2791
+ p_shop_name?: string;
2792
+ p_theme_config?: Json;
2793
+ };
2794
+ Returns: Json;
2795
+ };
1910
2796
  upsert_supporter: {
1911
2797
  Args: {
1912
2798
  p_amount?: number;
@@ -1920,6 +2806,21 @@ export type Database = {
1920
2806
  };
1921
2807
  Returns: string;
1922
2808
  };
2809
+ upsert_user_address: {
2810
+ Args: {
2811
+ p_address_id?: string;
2812
+ p_address_line1?: string;
2813
+ p_address_line2?: string;
2814
+ p_city?: string;
2815
+ p_district?: string;
2816
+ p_is_default?: boolean;
2817
+ p_label?: string;
2818
+ p_phone?: string;
2819
+ p_postal_code?: string;
2820
+ p_recipient_name?: string;
2821
+ };
2822
+ Returns: Json;
2823
+ };
1923
2824
  };
1924
2825
  Enums: {
1925
2826
  access_grant_type_enum: "purchase" | "gift";
@@ -2016,6 +2917,23 @@ export type Database = {
2016
2917
  | "implemented"
2017
2918
  | "rejected"
2018
2919
  | "duplicate";
2920
+ shop_order_item_status_enum:
2921
+ | "pending"
2922
+ | "paid"
2923
+ | "fulfilled"
2924
+ | "processing"
2925
+ | "shipped"
2926
+ | "delivered"
2927
+ | "cancelled"
2928
+ | "refunded";
2929
+ shop_payment_method_enum: "online" | "cod";
2930
+ shop_policy_type_enum:
2931
+ | "return_refund"
2932
+ | "digital_products"
2933
+ | "shipping"
2934
+ | "privacy"
2935
+ | "terms_of_service";
2936
+ shop_product_type_enum: "digital" | "physical";
2019
2937
  supporter_platform_enum:
2020
2938
  | "facebook"
2021
2939
  | "x"
@@ -2278,6 +3196,25 @@ export const Constants = {
2278
3196
  "rejected",
2279
3197
  "duplicate",
2280
3198
  ],
3199
+ shop_order_item_status_enum: [
3200
+ "pending",
3201
+ "paid",
3202
+ "fulfilled",
3203
+ "processing",
3204
+ "shipped",
3205
+ "delivered",
3206
+ "cancelled",
3207
+ "refunded",
3208
+ ],
3209
+ shop_payment_method_enum: ["online", "cod"],
3210
+ shop_policy_type_enum: [
3211
+ "return_refund",
3212
+ "digital_products",
3213
+ "shipping",
3214
+ "privacy",
3215
+ "terms_of_service",
3216
+ ],
3217
+ shop_product_type_enum: ["digital", "physical"],
2281
3218
  supporter_platform_enum: [
2282
3219
  "facebook",
2283
3220
  "x",