@smartsoft001/auth-shell-app-services 2.107.0 → 2.109.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 (2) hide show
  1. package/index.js +28 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -95,6 +95,31 @@ var PasswordService = class _PasswordService {
95
95
  }
96
96
  };
97
97
 
98
+ // packages/shared/utils/src/lib/services/remove-html/remove-html.service.ts
99
+ var RemoveHtmlService = class {
100
+ /**
101
+ * Remove HTML tags and decode HTML entities from text
102
+ * - Removes HTML tags
103
+ * - Decodes common named entities ( , ", etc.)
104
+ * - Decodes numeric entities ({ or «)
105
+ * - Removes any remaining unrecognized entities
106
+ */
107
+ static create(val) {
108
+ if (!val) {
109
+ return "";
110
+ }
111
+ let result = val;
112
+ result = result.replace(/<[^>]*(>|$)/g, "");
113
+ result = result.replace(/&nbsp;/g, " ").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&amp;/g, "&").replace(/&bdquo;/g, "\u201E").replace(/&rdquo;/g, '"').replace(/&ldquo;/g, '"').replace(/&laquo;/g, "\xAB").replace(/&raquo;/g, "\xBB").replace(/&zwnj;/g, "");
114
+ result = result.replace(/&#(\d+);/g, (match, dec) => String.fromCharCode(dec)).replace(
115
+ /&#x([0-9a-f]+);/gi,
116
+ (match, hex) => String.fromCharCode(parseInt(hex, 16))
117
+ );
118
+ result = result.replace(/&[a-z]+;/gi, "");
119
+ return result;
120
+ }
121
+ };
122
+
98
123
  // packages/shared/utils/src/lib/services/slug/slug.service.ts
99
124
  var SlugService = class _SlugService {
100
125
  static {
@@ -121,6 +146,7 @@ var SlugService = class _SlugService {
121
146
  }
122
147
  /**
123
148
  * Convert text to URL-friendly slug
149
+ * - Removes HTML tags and entities
124
150
  * - Replaces Polish characters with English equivalents
125
151
  * - Converts to lowercase
126
152
  * - Replaces spaces and special characters with hyphens
@@ -131,7 +157,8 @@ var SlugService = class _SlugService {
131
157
  if (!text) {
132
158
  return "";
133
159
  }
134
- let slug = text.split("").map((char) => _SlugService.polishToEnglishMap[char] || char).join("");
160
+ let slug = RemoveHtmlService.create(text);
161
+ slug = slug.split("").map((char) => _SlugService.polishToEnglishMap[char] || char).join("");
135
162
  slug = slug.toLowerCase();
136
163
  slug = slug.replace(/[^a-z0-9]+/g, "-");
137
164
  slug = slug.replace(/-+/g, "-");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartsoft001/auth-shell-app-services",
3
- "version": "2.107.0",
3
+ "version": "2.109.0",
4
4
  "description": "Utils to authorization",
5
5
  "repository": {
6
6
  "type": "git",