@hobenakicoffee/libraries 4.3.1 → 4.5.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/README.md +35 -0
- package/package.json +1 -1
- package/src/constants/shop-service.ts +9 -0
- package/src/types/supabase.ts +197 -3
package/README.md
CHANGED
|
@@ -3,6 +3,41 @@
|
|
|
3
3
|
Framework-agnostic shared constants, utilities, types, and moderation tools for "হবে নাকি Coffee?" projects.
|
|
4
4
|
**Version: 4.1.1**
|
|
5
5
|
|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+

|
|
13
|
+

|
|
14
|
+

|
|
15
|
+

|
|
16
|
+

|
|
17
|
+

|
|
18
|
+

|
|
19
|
+

|
|
20
|
+

|
|
21
|
+

|
|
22
|
+

|
|
23
|
+

|
|
24
|
+

|
|
25
|
+

|
|
26
|
+

|
|
27
|
+

|
|
28
|
+

|
|
29
|
+

|
|
30
|
+

|
|
31
|
+

|
|
32
|
+

|
|
33
|
+

|
|
34
|
+

|
|
35
|
+

|
|
36
|
+

|
|
37
|
+

|
|
38
|
+

|
|
39
|
+

|
|
40
|
+
|
|
6
41
|
## Installation
|
|
7
42
|
|
|
8
43
|
```bash
|
package/package.json
CHANGED
|
@@ -7,3 +7,12 @@ export const ShopProductTypes = {
|
|
|
7
7
|
|
|
8
8
|
export type ShopProductType =
|
|
9
9
|
(typeof ShopProductTypes)[keyof typeof ShopProductTypes];
|
|
10
|
+
|
|
11
|
+
export const ShopApprovalStatuses = {
|
|
12
|
+
pending: "pending",
|
|
13
|
+
approved: "approved",
|
|
14
|
+
rejected: "rejected",
|
|
15
|
+
} as const;
|
|
16
|
+
|
|
17
|
+
export type ShopApprovalStatus =
|
|
18
|
+
(typeof ShopApprovalStatuses)[keyof typeof ShopApprovalStatuses];
|
package/src/types/supabase.ts
CHANGED
|
@@ -286,7 +286,7 @@ export type Database = {
|
|
|
286
286
|
{
|
|
287
287
|
foreignKeyName: "manager_user_roles_user_id_fkey";
|
|
288
288
|
columns: ["user_id"];
|
|
289
|
-
isOneToOne:
|
|
289
|
+
isOneToOne: true;
|
|
290
290
|
referencedRelation: "managers";
|
|
291
291
|
referencedColumns: ["id"];
|
|
292
292
|
},
|
|
@@ -694,6 +694,7 @@ export type Database = {
|
|
|
694
694
|
published_at: string | null;
|
|
695
695
|
purchase_count: number;
|
|
696
696
|
reading_time_minutes: number | null;
|
|
697
|
+
reject_reason: string | null;
|
|
697
698
|
revenue_total: number;
|
|
698
699
|
slug: string | null;
|
|
699
700
|
status: Database["public"]["Enums"]["post_status_enum"];
|
|
@@ -719,6 +720,7 @@ export type Database = {
|
|
|
719
720
|
published_at?: string | null;
|
|
720
721
|
purchase_count?: number;
|
|
721
722
|
reading_time_minutes?: number | null;
|
|
723
|
+
reject_reason?: string | null;
|
|
722
724
|
revenue_total?: number;
|
|
723
725
|
slug?: string | null;
|
|
724
726
|
status?: Database["public"]["Enums"]["post_status_enum"];
|
|
@@ -744,6 +746,7 @@ export type Database = {
|
|
|
744
746
|
published_at?: string | null;
|
|
745
747
|
purchase_count?: number;
|
|
746
748
|
reading_time_minutes?: number | null;
|
|
749
|
+
reject_reason?: string | null;
|
|
747
750
|
revenue_total?: number;
|
|
748
751
|
slug?: string | null;
|
|
749
752
|
status?: Database["public"]["Enums"]["post_status_enum"];
|
|
@@ -1237,6 +1240,63 @@ export type Database = {
|
|
|
1237
1240
|
},
|
|
1238
1241
|
];
|
|
1239
1242
|
};
|
|
1243
|
+
shop_category_drafts: {
|
|
1244
|
+
Row: {
|
|
1245
|
+
approval_status: Database["public"]["Enums"]["shop_approval_status_enum"];
|
|
1246
|
+
category_id: string;
|
|
1247
|
+
created_at: string;
|
|
1248
|
+
description: string | null;
|
|
1249
|
+
id: string;
|
|
1250
|
+
name: string;
|
|
1251
|
+
profile_id: string;
|
|
1252
|
+
rejection_reason: string | null;
|
|
1253
|
+
slug: string;
|
|
1254
|
+
sort_order: number;
|
|
1255
|
+
updated_at: string;
|
|
1256
|
+
};
|
|
1257
|
+
Insert: {
|
|
1258
|
+
approval_status?: Database["public"]["Enums"]["shop_approval_status_enum"];
|
|
1259
|
+
category_id: string;
|
|
1260
|
+
created_at?: string;
|
|
1261
|
+
description?: string | null;
|
|
1262
|
+
id?: string;
|
|
1263
|
+
name: string;
|
|
1264
|
+
profile_id: string;
|
|
1265
|
+
rejection_reason?: string | null;
|
|
1266
|
+
slug: string;
|
|
1267
|
+
sort_order?: number;
|
|
1268
|
+
updated_at?: string;
|
|
1269
|
+
};
|
|
1270
|
+
Update: {
|
|
1271
|
+
approval_status?: Database["public"]["Enums"]["shop_approval_status_enum"];
|
|
1272
|
+
category_id?: string;
|
|
1273
|
+
created_at?: string;
|
|
1274
|
+
description?: string | null;
|
|
1275
|
+
id?: string;
|
|
1276
|
+
name?: string;
|
|
1277
|
+
profile_id?: string;
|
|
1278
|
+
rejection_reason?: string | null;
|
|
1279
|
+
slug?: string;
|
|
1280
|
+
sort_order?: number;
|
|
1281
|
+
updated_at?: string;
|
|
1282
|
+
};
|
|
1283
|
+
Relationships: [
|
|
1284
|
+
{
|
|
1285
|
+
foreignKeyName: "shop_category_drafts_category_id_fkey";
|
|
1286
|
+
columns: ["category_id"];
|
|
1287
|
+
isOneToOne: true;
|
|
1288
|
+
referencedRelation: "shop_categories";
|
|
1289
|
+
referencedColumns: ["id"];
|
|
1290
|
+
},
|
|
1291
|
+
{
|
|
1292
|
+
foreignKeyName: "shop_category_drafts_profile_id_fkey";
|
|
1293
|
+
columns: ["profile_id"];
|
|
1294
|
+
isOneToOne: false;
|
|
1295
|
+
referencedRelation: "profiles";
|
|
1296
|
+
referencedColumns: ["id"];
|
|
1297
|
+
},
|
|
1298
|
+
];
|
|
1299
|
+
};
|
|
1240
1300
|
shop_download_tokens: {
|
|
1241
1301
|
Row: {
|
|
1242
1302
|
buyer_profile_id: string;
|
|
@@ -1515,6 +1575,130 @@ export type Database = {
|
|
|
1515
1575
|
},
|
|
1516
1576
|
];
|
|
1517
1577
|
};
|
|
1578
|
+
shop_product_drafts: {
|
|
1579
|
+
Row: {
|
|
1580
|
+
approval_status: Database["public"]["Enums"]["shop_approval_status_enum"];
|
|
1581
|
+
category_id: string | null;
|
|
1582
|
+
cod_enabled: boolean;
|
|
1583
|
+
compare_at_price: number | null;
|
|
1584
|
+
cover_image_url: string | null;
|
|
1585
|
+
created_at: string;
|
|
1586
|
+
description: string | null;
|
|
1587
|
+
download_expires_hours: number;
|
|
1588
|
+
id: string;
|
|
1589
|
+
images: string[];
|
|
1590
|
+
is_featured: boolean;
|
|
1591
|
+
low_stock_threshold: number;
|
|
1592
|
+
max_downloads: number;
|
|
1593
|
+
option_definitions: Json;
|
|
1594
|
+
price: number;
|
|
1595
|
+
processing_max_days: number | null;
|
|
1596
|
+
processing_min_days: number | null;
|
|
1597
|
+
product_id: string;
|
|
1598
|
+
profile_id: string;
|
|
1599
|
+
rejection_reason: string | null;
|
|
1600
|
+
requires_shipping: boolean;
|
|
1601
|
+
shipping_fee_inside_dhaka: number;
|
|
1602
|
+
shipping_fee_outside_dhaka: number;
|
|
1603
|
+
sku: string | null;
|
|
1604
|
+
slug: string;
|
|
1605
|
+
sort_order: number;
|
|
1606
|
+
stock_count: number | null;
|
|
1607
|
+
tags: string[];
|
|
1608
|
+
title: string;
|
|
1609
|
+
updated_at: string;
|
|
1610
|
+
weight_grams: number | null;
|
|
1611
|
+
};
|
|
1612
|
+
Insert: {
|
|
1613
|
+
approval_status?: Database["public"]["Enums"]["shop_approval_status_enum"];
|
|
1614
|
+
category_id?: string | null;
|
|
1615
|
+
cod_enabled?: boolean;
|
|
1616
|
+
compare_at_price?: number | null;
|
|
1617
|
+
cover_image_url?: string | null;
|
|
1618
|
+
created_at?: string;
|
|
1619
|
+
description?: string | null;
|
|
1620
|
+
download_expires_hours?: number;
|
|
1621
|
+
id?: string;
|
|
1622
|
+
images?: string[];
|
|
1623
|
+
is_featured?: boolean;
|
|
1624
|
+
low_stock_threshold?: number;
|
|
1625
|
+
max_downloads?: number;
|
|
1626
|
+
option_definitions?: Json;
|
|
1627
|
+
price: number;
|
|
1628
|
+
processing_max_days?: number | null;
|
|
1629
|
+
processing_min_days?: number | null;
|
|
1630
|
+
product_id: string;
|
|
1631
|
+
profile_id: string;
|
|
1632
|
+
rejection_reason?: string | null;
|
|
1633
|
+
requires_shipping?: boolean;
|
|
1634
|
+
shipping_fee_inside_dhaka?: number;
|
|
1635
|
+
shipping_fee_outside_dhaka?: number;
|
|
1636
|
+
sku?: string | null;
|
|
1637
|
+
slug: string;
|
|
1638
|
+
sort_order?: number;
|
|
1639
|
+
stock_count?: number | null;
|
|
1640
|
+
tags?: string[];
|
|
1641
|
+
title: string;
|
|
1642
|
+
updated_at?: string;
|
|
1643
|
+
weight_grams?: number | null;
|
|
1644
|
+
};
|
|
1645
|
+
Update: {
|
|
1646
|
+
approval_status?: Database["public"]["Enums"]["shop_approval_status_enum"];
|
|
1647
|
+
category_id?: string | null;
|
|
1648
|
+
cod_enabled?: boolean;
|
|
1649
|
+
compare_at_price?: number | null;
|
|
1650
|
+
cover_image_url?: string | null;
|
|
1651
|
+
created_at?: string;
|
|
1652
|
+
description?: string | null;
|
|
1653
|
+
download_expires_hours?: number;
|
|
1654
|
+
id?: string;
|
|
1655
|
+
images?: string[];
|
|
1656
|
+
is_featured?: boolean;
|
|
1657
|
+
low_stock_threshold?: number;
|
|
1658
|
+
max_downloads?: number;
|
|
1659
|
+
option_definitions?: Json;
|
|
1660
|
+
price?: number;
|
|
1661
|
+
processing_max_days?: number | null;
|
|
1662
|
+
processing_min_days?: number | null;
|
|
1663
|
+
product_id?: string;
|
|
1664
|
+
profile_id?: string;
|
|
1665
|
+
rejection_reason?: string | null;
|
|
1666
|
+
requires_shipping?: boolean;
|
|
1667
|
+
shipping_fee_inside_dhaka?: number;
|
|
1668
|
+
shipping_fee_outside_dhaka?: number;
|
|
1669
|
+
sku?: string | null;
|
|
1670
|
+
slug?: string;
|
|
1671
|
+
sort_order?: number;
|
|
1672
|
+
stock_count?: number | null;
|
|
1673
|
+
tags?: string[];
|
|
1674
|
+
title?: string;
|
|
1675
|
+
updated_at?: string;
|
|
1676
|
+
weight_grams?: number | null;
|
|
1677
|
+
};
|
|
1678
|
+
Relationships: [
|
|
1679
|
+
{
|
|
1680
|
+
foreignKeyName: "shop_product_drafts_category_id_fkey";
|
|
1681
|
+
columns: ["category_id"];
|
|
1682
|
+
isOneToOne: false;
|
|
1683
|
+
referencedRelation: "shop_categories";
|
|
1684
|
+
referencedColumns: ["id"];
|
|
1685
|
+
},
|
|
1686
|
+
{
|
|
1687
|
+
foreignKeyName: "shop_product_drafts_product_id_fkey";
|
|
1688
|
+
columns: ["product_id"];
|
|
1689
|
+
isOneToOne: true;
|
|
1690
|
+
referencedRelation: "shop_products";
|
|
1691
|
+
referencedColumns: ["id"];
|
|
1692
|
+
},
|
|
1693
|
+
{
|
|
1694
|
+
foreignKeyName: "shop_product_drafts_profile_id_fkey";
|
|
1695
|
+
columns: ["profile_id"];
|
|
1696
|
+
isOneToOne: false;
|
|
1697
|
+
referencedRelation: "profiles";
|
|
1698
|
+
referencedColumns: ["id"];
|
|
1699
|
+
},
|
|
1700
|
+
];
|
|
1701
|
+
};
|
|
1518
1702
|
shop_product_files: {
|
|
1519
1703
|
Row: {
|
|
1520
1704
|
created_at: string;
|
|
@@ -2193,6 +2377,8 @@ export type Database = {
|
|
|
2193
2377
|
};
|
|
2194
2378
|
Returns: Json;
|
|
2195
2379
|
};
|
|
2380
|
+
approve_shop_category: { Args: { p_category_id: string }; Returns: Json };
|
|
2381
|
+
approve_shop_product: { Args: { p_product_id: string }; Returns: Json };
|
|
2196
2382
|
authorize_manager: {
|
|
2197
2383
|
Args: {
|
|
2198
2384
|
requested_permission: Database["public"]["Enums"]["manager_permission"];
|
|
@@ -2656,6 +2842,14 @@ export type Database = {
|
|
|
2656
2842
|
Args: { p_post_id: string };
|
|
2657
2843
|
Returns: undefined;
|
|
2658
2844
|
};
|
|
2845
|
+
reject_shop_category: {
|
|
2846
|
+
Args: { p_category_id: string; p_rejection_reason: string };
|
|
2847
|
+
Returns: Json;
|
|
2848
|
+
};
|
|
2849
|
+
reject_shop_product: {
|
|
2850
|
+
Args: { p_product_id: string; p_rejection_reason: string };
|
|
2851
|
+
Returns: Json;
|
|
2852
|
+
};
|
|
2659
2853
|
reorder_shop_categories: {
|
|
2660
2854
|
Args: { p_category_ids: string[] };
|
|
2661
2855
|
Returns: Json;
|
|
@@ -2702,7 +2896,6 @@ export type Database = {
|
|
|
2702
2896
|
Args: {
|
|
2703
2897
|
p_category_id?: string;
|
|
2704
2898
|
p_description?: string;
|
|
2705
|
-
p_is_visible?: boolean;
|
|
2706
2899
|
p_name?: string;
|
|
2707
2900
|
p_slug?: string;
|
|
2708
2901
|
p_sort_order?: number;
|
|
@@ -2726,7 +2919,6 @@ export type Database = {
|
|
|
2726
2919
|
p_description?: string;
|
|
2727
2920
|
p_download_expires_hours?: number;
|
|
2728
2921
|
p_images?: string[];
|
|
2729
|
-
p_is_active?: boolean;
|
|
2730
2922
|
p_is_featured?: boolean;
|
|
2731
2923
|
p_low_stock_threshold?: number;
|
|
2732
2924
|
p_max_downloads?: number;
|
|
@@ -2900,6 +3092,7 @@ export type Database = {
|
|
|
2900
3092
|
| "implemented"
|
|
2901
3093
|
| "rejected"
|
|
2902
3094
|
| "duplicate";
|
|
3095
|
+
shop_approval_status_enum: "pending" | "approved" | "rejected";
|
|
2903
3096
|
shop_order_item_status_enum:
|
|
2904
3097
|
| "pending"
|
|
2905
3098
|
| "paid"
|
|
@@ -3179,6 +3372,7 @@ export const Constants = {
|
|
|
3179
3372
|
"rejected",
|
|
3180
3373
|
"duplicate",
|
|
3181
3374
|
],
|
|
3375
|
+
shop_approval_status_enum: ["pending", "approved", "rejected"],
|
|
3182
3376
|
shop_order_item_status_enum: [
|
|
3183
3377
|
"pending",
|
|
3184
3378
|
"paid",
|