@smartsoft001/auth-domain 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.
- package/index.js +28 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -92,6 +92,31 @@ var PasswordService = class _PasswordService {
|
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
+
// packages/shared/utils/src/lib/services/remove-html/remove-html.service.ts
|
|
96
|
+
var RemoveHtmlService = class {
|
|
97
|
+
/**
|
|
98
|
+
* Remove HTML tags and decode HTML entities from text
|
|
99
|
+
* - Removes HTML tags
|
|
100
|
+
* - Decodes common named entities ( , ", etc.)
|
|
101
|
+
* - Decodes numeric entities ({ or «)
|
|
102
|
+
* - Removes any remaining unrecognized entities
|
|
103
|
+
*/
|
|
104
|
+
static create(val) {
|
|
105
|
+
if (!val) {
|
|
106
|
+
return "";
|
|
107
|
+
}
|
|
108
|
+
let result = val;
|
|
109
|
+
result = result.replace(/<[^>]*(>|$)/g, "");
|
|
110
|
+
result = result.replace(/ /g, " ").replace(/"/g, '"').replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/„/g, "\u201E").replace(/”/g, '"').replace(/“/g, '"').replace(/«/g, "\xAB").replace(/»/g, "\xBB").replace(/‌/g, "");
|
|
111
|
+
result = result.replace(/&#(\d+);/g, (match, dec) => String.fromCharCode(dec)).replace(
|
|
112
|
+
/&#x([0-9a-f]+);/gi,
|
|
113
|
+
(match, hex) => String.fromCharCode(parseInt(hex, 16))
|
|
114
|
+
);
|
|
115
|
+
result = result.replace(/&[a-z]+;/gi, "");
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
95
120
|
// packages/shared/utils/src/lib/services/slug/slug.service.ts
|
|
96
121
|
var SlugService = class _SlugService {
|
|
97
122
|
static {
|
|
@@ -118,6 +143,7 @@ var SlugService = class _SlugService {
|
|
|
118
143
|
}
|
|
119
144
|
/**
|
|
120
145
|
* Convert text to URL-friendly slug
|
|
146
|
+
* - Removes HTML tags and entities
|
|
121
147
|
* - Replaces Polish characters with English equivalents
|
|
122
148
|
* - Converts to lowercase
|
|
123
149
|
* - Replaces spaces and special characters with hyphens
|
|
@@ -128,7 +154,8 @@ var SlugService = class _SlugService {
|
|
|
128
154
|
if (!text) {
|
|
129
155
|
return "";
|
|
130
156
|
}
|
|
131
|
-
let slug =
|
|
157
|
+
let slug = RemoveHtmlService.create(text);
|
|
158
|
+
slug = slug.split("").map((char) => _SlugService.polishToEnglishMap[char] || char).join("");
|
|
132
159
|
slug = slug.toLowerCase();
|
|
133
160
|
slug = slug.replace(/[^a-z0-9]+/g, "-");
|
|
134
161
|
slug = slug.replace(/-+/g, "-");
|