@hobenakicoffee/libraries 4.1.0 → 4.2.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 CHANGED
@@ -1,6 +1,7 @@
1
1
  # @hobenakicoffee/libraries
2
2
 
3
3
  Framework-agnostic shared constants, utilities, types, and moderation tools for "হবে নাকি Coffee?" projects.
4
+ **Version: 4.1.1**
4
5
 
5
6
  ## Installation
6
7
 
@@ -29,16 +30,19 @@ import { SupporterPlatforms } from "@hobenakicoffee/libraries/constants";
29
30
  import { formatAmount, formatDate, getUserPageLink } from "@hobenakicoffee/libraries/utils";
30
31
 
31
32
  // Types only
32
- import { Database, Tables } from "@hobenakicoffee/libraries/types";
33
+ import type { Database, Tables } from "@hobenakicoffee/libraries/types";
33
34
 
34
35
  // Moderation tools
35
- import { moderateText } from "@hobenakicoffee/libraries/moderation";
36
+ import { containsProfanity, containsBanglaSwear } from "@hobenakicoffee/libraries/moderation";
36
37
 
37
38
  // URL state management
38
39
  import { parseAsSortOrder } from "@hobenakicoffee/libraries/nuqs";
39
40
 
40
41
  // Scripts
41
42
  import { checkEnvEncryption } from "@hobenakicoffee/libraries/scripts";
43
+
44
+ // Hooks
45
+ import { useIsMobile } from "@hobenakicoffee/libraries/hooks";
42
46
  ```
43
47
 
44
48
  ## Entry Points Overview
@@ -52,6 +56,7 @@ import { checkEnvEncryption } from "@hobenakicoffee/libraries/scripts";
52
56
  | `@hobenakicoffee/libraries/moderation` | Content moderation tools |
53
57
  | `@hobenakicoffee/libraries/nuqs` | URL state management parsers |
54
58
  | `@hobenakicoffee/libraries/scripts` | Build/utility scripts |
59
+ | `@hobenakicoffee/libraries/hooks` | React hooks |
55
60
 
56
61
  ---
57
62
 
@@ -466,48 +471,15 @@ result.error // Error if any
466
471
 
467
472
  ## Moderation (`@hobenakicoffee/libraries/moderation`)
468
473
 
469
- ### moderateText
474
+ ### containsProfanity / containsBanglaSwear
470
475
 
471
476
  Local profanity detection for English and Bangla.
472
477
 
473
478
  ```ts
474
- import { moderateText } from "@hobenakicoffee/libraries/moderation";
475
-
476
- const result = moderateText("some bad word here");
477
-
478
- result.isAllowed // boolean
479
- result.matched // Array of matched words
480
- ```
481
-
482
- ### normalizeLeetspeak
483
-
484
- Converts leetspeak to normal text (e.g., "h4x0r" -> "haxor").
485
-
486
- ```ts
487
- import { normalizeLeetspeak } from "@hobenakicoffee/libraries/moderation";
488
-
489
- normalizeLeetspeak("h4x0r"); // "haxor"
490
- normalizeLeetspeak("p@ssw0rd"); // "password"
491
- ```
492
-
493
- ### normalizeUnicode
494
-
495
- Normalizes Unicode characters (removes diacritics).
496
-
497
- ```ts
498
- import { normalizeUnicode } from "@hobenakicoffee/libraries/moderation";
479
+ import { containsProfanity, containsBanglaSwear, badwordsMatcher } from "@hobenakicoffee/libraries/moderation";
499
480
 
500
- normalizeUnicode("café"); // "cafe"
501
- ```
502
-
503
- ### banglaBadWords
504
-
505
- Array of Bangla profanity words for content moderation.
506
-
507
- ```ts
508
- import { banglaBadWords } from "@hobenakicoffee/libraries/moderation";
509
-
510
- console.log(banglaBadWords.length); // word count
481
+ const hasProfanity = containsProfanity("some bad word here");
482
+ const hasBanglaProfanity = containsBanglaSwear("কিছু খারাপ শব্দ");
511
483
  ```
512
484
 
513
485
  ---
@@ -635,11 +607,11 @@ function MyComponent() {
635
607
  | `getInitials` | Get name initials |
636
608
  | `getSocialLink` | Generate social profile URL |
637
609
  | `getSocialHandle` | Extract handle from social URL |
638
- | `openInNewWindow` | Open URL in new tab |
639
- | `shareToFacebook` | Share to Facebook |
640
- | `shareToInstagram` | Share to Instagram |
641
- | `shareToLinkedIn` | Share to LinkedIn |
642
- | `shareToX` | Share to X (Twitter) |
610
+ | `openToNewWindow` | Open URL in new tab |
611
+ | `postToFacebook` | Share to Facebook |
612
+ | `postToInstagram` | Share to Instagram |
613
+ | `postToLinkedIn` | Share to LinkedIn |
614
+ | `postToX` | Share to X (Twitter) |
643
615
  | `downloadQrSvgAsPng` | Download QR as PNG |
644
616
  | `printQrSvg` | Print QR code |
645
617
  | `toHumanReadable` | Convert camelCase/snake_case to readable |
@@ -650,9 +622,9 @@ function MyComponent() {
650
622
 
651
623
  | Function | Description |
652
624
  |----------|-------------|
653
- | `moderateText` | Check text for profanity |
654
- | `normalizeLeetspeak` | Convert leetspeak to normal |
655
- | `normalizeUnicode` | Remove Unicode diacritics |
625
+ | `containsProfanity` | Check text for profanity (English + Bangla) |
626
+ | `containsBanglaSwear` | Check text for Bangla profanity |
627
+ | `badwordsMatcher` | English profanity matcher (obscenity) |
656
628
  | `banglaBadWords` | Bangla profanity word list |
657
629
 
658
630
  ---
@@ -740,7 +712,6 @@ src/
740
712
  │ │ ├── bn.ts # Bangla bad words
741
713
  │ │ └── index.ts
742
714
  │ ├── profanity-service.ts
743
- │ ├── normalizer.ts
744
715
  │ └── index.ts # Exports
745
716
  ├── types/
746
717
  │ ├── supabase.ts # Full Supabase types
@@ -792,4 +763,4 @@ For local publish (if needed):
792
763
 
793
764
  ```bash
794
765
  npm publish --access public
795
- ```
766
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hobenakicoffee/libraries",
3
- "version": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "type": "module",
5
5
  "types": "src/index.ts",
6
6
  "repository": {
@@ -15,7 +15,8 @@
15
15
  "./types": "./src/types/index.ts",
16
16
  "./utils": "./src/utils/index.ts",
17
17
  "./nuqs": "./src/nuqs/index.ts",
18
- "./scripts": "./src/scripts/index.ts"
18
+ "./scripts": "./src/scripts/index.ts",
19
+ "./hooks": "./src/hooks/index.ts"
19
20
  },
20
21
  "files": [
21
22
  "src",
@@ -3,3 +3,4 @@ export * from "./legal";
3
3
  export * from "./payment";
4
4
  export * from "./platforms";
5
5
  export * from "./services";
6
+ export * from "./shop-service";
@@ -0,0 +1,9 @@
1
+ export const MAX_PRODUCT_PRICE = 9_999_999_999;
2
+
3
+ export const ShopProductType = {
4
+ digital: "digital",
5
+ physical: "physical",
6
+ } as const;
7
+
8
+ export type ShopProductType =
9
+ (typeof ShopProductType)[keyof typeof ShopProductType];
@@ -0,0 +1 @@
1
+ export * from "./use-mobile";
@@ -464,30 +464,6 @@ export type Database = {
464
464
  },
465
465
  ];
466
466
  };
467
- messages_2026_03: {
468
- Row: {
469
- content: string;
470
- conversation_id: string;
471
- created_at: string;
472
- id: number;
473
- sender_id: string;
474
- };
475
- Insert: {
476
- content: string;
477
- conversation_id: string;
478
- created_at?: string;
479
- id?: number;
480
- sender_id: string;
481
- };
482
- Update: {
483
- content?: string;
484
- conversation_id?: string;
485
- created_at?: string;
486
- id?: number;
487
- sender_id?: string;
488
- };
489
- Relationships: [];
490
- };
491
467
  messages_2026_04: {
492
468
  Row: {
493
469
  content: string;