@kard-financial/sdk 3.2.0 → 3.2.2
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/dist/cjs/helpers/hem.d.ts +0 -10
- package/dist/cjs/helpers/hem.js +0 -1
- package/dist/esm/helpers/hem.d.mts +0 -10
- package/dist/esm/helpers/hem.mjs +1 -1
- package/package.json +9 -2
- package/reference.md +18 -33
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Normalize an email address for Hashed Email (HEM) generation.
|
|
3
|
-
*
|
|
4
|
-
* Follows UID2/LiveRamp industry standards:
|
|
5
|
-
* - Remove all whitespace
|
|
6
|
-
* - Lowercase
|
|
7
|
-
* - Gmail/Googlemail only: remove dots from local-part, strip '+' suffix
|
|
8
|
-
* - Canonicalize googlemail.com → gmail.com
|
|
9
|
-
*/
|
|
10
|
-
export declare function normalizeEmail(raw: string): string;
|
|
11
1
|
/**
|
|
12
2
|
* Generate a Hashed Email (HEM) from a raw email address.
|
|
13
3
|
* Returns the lowercase hex SHA-256 digest of the normalized, UTF-8-encoded email.
|
package/dist/cjs/helpers/hem.js
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Normalize an email address for Hashed Email (HEM) generation.
|
|
3
|
-
*
|
|
4
|
-
* Follows UID2/LiveRamp industry standards:
|
|
5
|
-
* - Remove all whitespace
|
|
6
|
-
* - Lowercase
|
|
7
|
-
* - Gmail/Googlemail only: remove dots from local-part, strip '+' suffix
|
|
8
|
-
* - Canonicalize googlemail.com → gmail.com
|
|
9
|
-
*/
|
|
10
|
-
export declare function normalizeEmail(raw: string): string;
|
|
11
1
|
/**
|
|
12
2
|
* Generate a Hashed Email (HEM) from a raw email address.
|
|
13
3
|
* Returns the lowercase hex SHA-256 digest of the normalized, UTF-8-encoded email.
|
package/dist/esm/helpers/hem.mjs
CHANGED
|
@@ -9,7 +9,7 @@ const GMAIL_DOMAINS = new Set(["gmail.com", "googlemail.com"]);
|
|
|
9
9
|
* - Gmail/Googlemail only: remove dots from local-part, strip '+' suffix
|
|
10
10
|
* - Canonicalize googlemail.com → gmail.com
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
function normalizeEmail(raw) {
|
|
13
13
|
const email = raw.replace(/\s/g, "").toLowerCase();
|
|
14
14
|
const atIndex = email.indexOf("@");
|
|
15
15
|
if (atIndex < 1 || atIndex !== email.lastIndexOf("@") || atIndex === email.length - 1) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kard-financial/sdk",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": "github:KardFinancial/kard-node-sdk",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -72,5 +72,12 @@
|
|
|
72
72
|
"engines": {
|
|
73
73
|
"node": ">=18.0.0"
|
|
74
74
|
},
|
|
75
|
-
"sideEffects": false
|
|
75
|
+
"sideEffects": false,
|
|
76
|
+
"typesVersions": {
|
|
77
|
+
"*": {
|
|
78
|
+
"helpers/hem": [
|
|
79
|
+
"dist/cjs/helpers/hem.d.ts"
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
}
|
|
76
83
|
}
|
package/reference.md
CHANGED
|
@@ -1888,9 +1888,9 @@ await client.users.uploads.update("organization-123", "user-123", "upload-123",
|
|
|
1888
1888
|
## Custom Helper Functions
|
|
1889
1889
|
### hem
|
|
1890
1890
|
|
|
1891
|
-
**Import:** `import {
|
|
1891
|
+
**Import:** `import { generateHEM } from "@kard-financial/sdk/helpers/hem";`
|
|
1892
1892
|
|
|
1893
|
-
<details><summary><code><a href="/src/helpers/hem.ts">
|
|
1893
|
+
<details><summary><code><a href="/src/helpers/hem.ts">generateHEM(raw: string): string</a></code></summary>
|
|
1894
1894
|
<dl>
|
|
1895
1895
|
<dd>
|
|
1896
1896
|
|
|
@@ -1905,37 +1905,22 @@ Follows UID2/LiveRamp industry standards:
|
|
|
1905
1905
|
- Lowercase
|
|
1906
1906
|
- Gmail/Googlemail only: remove dots from local-part, strip '+' suffix
|
|
1907
1907
|
- Canonicalize googlemail.com → gmail.com
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
</dl>
|
|
1925
|
-
|
|
1926
|
-
</dd>
|
|
1927
|
-
</dl>
|
|
1928
|
-
</details>
|
|
1929
|
-
|
|
1930
|
-
<details><summary><code><a href="/src/helpers/hem.ts">generateHEM(raw: string): string</a></code></summary>
|
|
1931
|
-
<dl>
|
|
1932
|
-
<dd>
|
|
1933
|
-
|
|
1934
|
-
#### 📝 Description
|
|
1935
|
-
|
|
1936
|
-
<dl>
|
|
1937
|
-
<dd>
|
|
1938
|
-
|
|
1908
|
+
/
|
|
1909
|
+
function normalizeEmail(raw: string): string {
|
|
1910
|
+
const email = raw.replace(/\s/g, "").toLowerCase();
|
|
1911
|
+
const atIndex = email.indexOf("@");
|
|
1912
|
+
if (atIndex < 1 || atIndex !== email.lastIndexOf("@") || atIndex === email.length - 1) {
|
|
1913
|
+
throw new TypeError(`Invalid email address: ${JSON.stringify(raw)}`);
|
|
1914
|
+
}
|
|
1915
|
+
const localPart = email.slice(0, atIndex);
|
|
1916
|
+
const domain = email.slice(atIndex + 1);
|
|
1917
|
+
if (GMAIL_DOMAINS.has(domain)) {
|
|
1918
|
+
const base = localPart.split("+")[0].replace(/\./g, "");
|
|
1919
|
+
return `${base}@gmail.com`;
|
|
1920
|
+
}
|
|
1921
|
+
return `${localPart}@${domain}`;
|
|
1922
|
+
}
|
|
1923
|
+
/**
|
|
1939
1924
|
Generate a Hashed Email (HEM) from a raw email address.
|
|
1940
1925
|
Returns the lowercase hex SHA-256 digest of the normalized, UTF-8-encoded email.
|
|
1941
1926
|
|