@memberstack/dom 1.9.32 → 1.9.34
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/lib/auth/index.js +10 -1
- package/lib/auth/index.mjs +10 -1
- package/lib/constants/endpoints.js +1 -1
- package/lib/constants/endpoints.mjs +1 -1
- package/lib/index.d.mts +5 -1
- package/lib/index.d.ts +5 -1
- package/lib/index.js +11041 -445
- package/lib/index.mjs +11041 -445
- package/lib/methods/dom/index.d.mts +1 -1
- package/lib/methods/dom/index.d.ts +1 -1
- package/lib/methods/dom/main-dom.js +10998 -426
- package/lib/methods/dom/main-dom.mjs +10998 -426
- package/lib/methods/dom/methods.d.mts +2 -2
- package/lib/methods/dom/methods.d.ts +2 -2
- package/lib/methods/dom/methods.js +11012 -440
- package/lib/methods/dom/methods.mjs +11012 -440
- package/lib/methods/index.d.mts +6 -2
- package/lib/methods/index.d.ts +6 -2
- package/lib/methods/index.js +11041 -445
- package/lib/methods/index.mjs +11041 -445
- package/lib/methods/requests/index.d.mts +5 -1
- package/lib/methods/requests/index.d.ts +5 -1
- package/lib/methods/requests/index.js +28 -4
- package/lib/methods/requests/index.mjs +28 -4
- package/lib/methods/requests/requests.js +1 -1
- package/lib/methods/requests/requests.mjs +1 -1
- package/lib/types/params.d.mts +4 -1
- package/lib/types/params.d.ts +4 -1
- package/lib/types/payloads.d.mts +1 -1
- package/lib/types/payloads.d.ts +1 -1
- package/lib/utils/cookies.d.mts +2 -1
- package/lib/utils/cookies.d.ts +2 -1
- package/lib/utils/cookies.js +13 -2
- package/lib/utils/cookies.mjs +12 -2
- package/package.json +4 -3
package/lib/auth/index.js
CHANGED
|
@@ -65,11 +65,20 @@ function isLocalStorageAvailable() {
|
|
|
65
65
|
}
|
|
66
66
|
var localStorageAvailable = isLocalStorageAvailable();
|
|
67
67
|
var setCookieOnRootDomain = false;
|
|
68
|
+
var extractDomainFromHostname = (hostname) => {
|
|
69
|
+
const hostnameParts = hostname.split(".");
|
|
70
|
+
const isCountryCodeTLD = hostnameParts.length >= 3 && hostnameParts[hostnameParts.length - 2].length <= 3;
|
|
71
|
+
if (isCountryCodeTLD) {
|
|
72
|
+
return hostnameParts.slice(-3).join(".");
|
|
73
|
+
} else {
|
|
74
|
+
return hostnameParts.slice(-2).join(".");
|
|
75
|
+
}
|
|
76
|
+
};
|
|
68
77
|
var removeMemberToken = () => {
|
|
69
78
|
if (localStorageAvailable) {
|
|
70
79
|
localStorage.removeItem(memberAuthTokenName);
|
|
71
80
|
}
|
|
72
|
-
const domain = window.location.hostname
|
|
81
|
+
const domain = extractDomainFromHostname(window.location.hostname);
|
|
73
82
|
import_js_cookie.default.set(memberAuthTokenName, "", __spreadValues({
|
|
74
83
|
expires: -1,
|
|
75
84
|
sameSite: "strict"
|
package/lib/auth/index.mjs
CHANGED
|
@@ -29,11 +29,20 @@ function isLocalStorageAvailable() {
|
|
|
29
29
|
}
|
|
30
30
|
var localStorageAvailable = isLocalStorageAvailable();
|
|
31
31
|
var setCookieOnRootDomain = false;
|
|
32
|
+
var extractDomainFromHostname = (hostname) => {
|
|
33
|
+
const hostnameParts = hostname.split(".");
|
|
34
|
+
const isCountryCodeTLD = hostnameParts.length >= 3 && hostnameParts[hostnameParts.length - 2].length <= 3;
|
|
35
|
+
if (isCountryCodeTLD) {
|
|
36
|
+
return hostnameParts.slice(-3).join(".");
|
|
37
|
+
} else {
|
|
38
|
+
return hostnameParts.slice(-2).join(".");
|
|
39
|
+
}
|
|
40
|
+
};
|
|
32
41
|
var removeMemberToken = () => {
|
|
33
42
|
if (localStorageAvailable) {
|
|
34
43
|
localStorage.removeItem(memberAuthTokenName);
|
|
35
44
|
}
|
|
36
|
-
const domain = window.location.hostname
|
|
45
|
+
const domain = extractDomainFromHostname(window.location.hostname);
|
|
37
46
|
Cookie.set(memberAuthTokenName, "", __spreadValues({
|
|
38
47
|
expires: -1,
|
|
39
48
|
sameSite: "strict"
|
|
@@ -23,7 +23,7 @@ __export(endpoints_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(endpoints_exports);
|
|
25
25
|
var endpoints = {
|
|
26
|
-
API: "
|
|
26
|
+
API: "https://client.memberstack.com"
|
|
27
27
|
};
|
|
28
28
|
// Annotate the CommonJS export names for ESM import in node:
|
|
29
29
|
0 && (module.exports = {
|
package/lib/index.d.mts
CHANGED
|
@@ -12,7 +12,7 @@ declare const _default: {
|
|
|
12
12
|
hideModal: () => void;
|
|
13
13
|
_hideLoader: (element?: any) => void;
|
|
14
14
|
_showLoader: (element?: any) => void;
|
|
15
|
-
_showMessage: (msg: any, isError: any) => void
|
|
15
|
+
_showMessage: (msg: any, isError: any) => Promise<void>;
|
|
16
16
|
getMemberCookie: () => any;
|
|
17
17
|
onAuthChange: (cb: any) => {
|
|
18
18
|
unsubscribe: () => boolean;
|
|
@@ -25,6 +25,10 @@ declare const _default: {
|
|
|
25
25
|
getChannelInfo(params?: {
|
|
26
26
|
channelKey: string;
|
|
27
27
|
}): Promise<any>;
|
|
28
|
+
subscribeToChannel(params?: {
|
|
29
|
+
channelKey: string;
|
|
30
|
+
action: "NONE" | "THREADS_ONLY";
|
|
31
|
+
}): Promise<void>;
|
|
28
32
|
getPosts(params?: GetPostsParams): Promise<GetPostsPayload>;
|
|
29
33
|
getThreads(params?: GetThreadsParams): Promise<GetThreadsPayload>;
|
|
30
34
|
createPost(params?: CreatePostParams): Promise<CreatePostPayload>;
|
package/lib/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ declare const _default: {
|
|
|
12
12
|
hideModal: () => void;
|
|
13
13
|
_hideLoader: (element?: any) => void;
|
|
14
14
|
_showLoader: (element?: any) => void;
|
|
15
|
-
_showMessage: (msg: any, isError: any) => void
|
|
15
|
+
_showMessage: (msg: any, isError: any) => Promise<void>;
|
|
16
16
|
getMemberCookie: () => any;
|
|
17
17
|
onAuthChange: (cb: any) => {
|
|
18
18
|
unsubscribe: () => boolean;
|
|
@@ -25,6 +25,10 @@ declare const _default: {
|
|
|
25
25
|
getChannelInfo(params?: {
|
|
26
26
|
channelKey: string;
|
|
27
27
|
}): Promise<any>;
|
|
28
|
+
subscribeToChannel(params?: {
|
|
29
|
+
channelKey: string;
|
|
30
|
+
action: "NONE" | "THREADS_ONLY";
|
|
31
|
+
}): Promise<void>;
|
|
28
32
|
getPosts(params?: GetPostsParams): Promise<GetPostsPayload>;
|
|
29
33
|
getThreads(params?: GetThreadsParams): Promise<GetThreadsPayload>;
|
|
30
34
|
createPost(params?: CreatePostParams): Promise<CreatePostPayload>;
|