@memberstack/dom 2.0.2-beta.0 → 2.0.3
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/index.d.mts +76 -61
- package/lib/index.d.ts +76 -61
- package/lib/index.js +840 -61
- package/lib/index.mjs +840 -61
- package/lib/{models-CTRKogoR.d.ts → models-CFT_ABd5.d.ts} +2 -2
- package/lib/testing/index.d.mts +25 -2
- package/lib/testing/index.d.ts +25 -2
- package/lib/testing/index.js +28 -6
- package/lib/testing/index.mjs +26 -5
- package/package.json +1 -1
- package/lib/auth/index.d.mts +0 -63
- package/lib/auth/index.d.ts +0 -63
- package/lib/auth/index.global.js +0 -244
- package/lib/auth/index.js +0 -161
- package/lib/auth/index.mjs +0 -123
- package/lib/constants/endpoints.d.mts +0 -5
- package/lib/constants/endpoints.d.ts +0 -5
- package/lib/constants/endpoints.global.js +0 -29
- package/lib/constants/endpoints.js +0 -32
- package/lib/constants/endpoints.mjs +0 -7
- package/lib/methods/dom/index.d.mts +0 -2
- package/lib/methods/dom/index.d.ts +0 -2
- package/lib/methods/dom/index.global.js +0 -2
- package/lib/methods/dom/index.js +0 -1
- package/lib/methods/dom/index.mjs +0 -0
- package/lib/methods/dom/main-dom.d.mts +0 -2
- package/lib/methods/dom/main-dom.d.ts +0 -2
- package/lib/methods/dom/main-dom.global.js +0 -30620
- package/lib/methods/dom/main-dom.js +0 -15611
- package/lib/methods/dom/main-dom.mjs +0 -15593
- package/lib/methods/dom/methods.d.mts +0 -100
- package/lib/methods/dom/methods.d.ts +0 -100
- package/lib/methods/dom/methods.global.js +0 -30827
- package/lib/methods/dom/methods.js +0 -335
- package/lib/methods/dom/methods.mjs +0 -302
- package/lib/methods/index.d.mts +0 -185
- package/lib/methods/index.d.ts +0 -185
- package/lib/methods/index.global.js +0 -46361
- package/lib/methods/index.js +0 -2530
- package/lib/methods/index.mjs +0 -2500
- package/lib/methods/requests/index.d.mts +0 -912
- package/lib/methods/requests/index.d.ts +0 -912
- package/lib/methods/requests/index.global.js +0 -15553
- package/lib/methods/requests/index.js +0 -2145
- package/lib/methods/requests/index.mjs +0 -2110
- package/lib/methods/requests/requests.d.mts +0 -43
- package/lib/methods/requests/requests.d.ts +0 -43
- package/lib/methods/requests/requests.global.js +0 -14528
- package/lib/methods/requests/requests.js +0 -244
- package/lib/methods/requests/requests.mjs +0 -210
- package/lib/models-BmZS-mc4.d.ts +0 -193
- package/lib/models-le7xaT4H.d.ts +0 -193
- package/lib/types/index.d.mts +0 -5
- package/lib/types/index.d.ts +0 -5
- package/lib/types/index.global.js +0 -19
- package/lib/types/index.js +0 -18
- package/lib/types/index.mjs +0 -0
- package/lib/types/params.d.mts +0 -946
- package/lib/types/params.d.ts +0 -946
- package/lib/types/params.global.js +0 -19
- package/lib/types/params.js +0 -18
- package/lib/types/params.mjs +0 -0
- package/lib/types/payloads.d.mts +0 -342
- package/lib/types/payloads.d.ts +0 -342
- package/lib/types/payloads.global.js +0 -19
- package/lib/types/payloads.js +0 -18
- package/lib/types/payloads.mjs +0 -0
- package/lib/types/translations.d.mts +0 -101
- package/lib/types/translations.d.ts +0 -101
- package/lib/types/translations.global.js +0 -19
- package/lib/types/translations.js +0 -18
- package/lib/types/translations.mjs +0 -0
- package/lib/types/utils/payloads.d.mts +0 -297
- package/lib/types/utils/payloads.d.ts +0 -297
- package/lib/types/utils/payloads.global.js +0 -19
- package/lib/types/utils/payloads.js +0 -18
- package/lib/types/utils/payloads.mjs +0 -0
- package/lib/utils/cookies.d.mts +0 -13
- package/lib/utils/cookies.d.ts +0 -13
- package/lib/utils/cookies.global.js +0 -261
- package/lib/utils/cookies.js +0 -190
- package/lib/utils/cookies.mjs +0 -148
- package/lib/utils/defaultMessageBox.d.mts +0 -5
- package/lib/utils/defaultMessageBox.d.ts +0 -5
- package/lib/utils/defaultMessageBox.global.js +0 -125
- package/lib/utils/defaultMessageBox.js +0 -130
- package/lib/utils/defaultMessageBox.mjs +0 -103
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { MemberstackTranslations } from '../../types/translations.mjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Preloads the prebuilt modal UI components from CDN.
|
|
5
|
-
* Call this if you know you'll need modals and want to avoid
|
|
6
|
-
* the loading delay on first openModal() call.
|
|
7
|
-
*
|
|
8
|
-
* The modal code is ~630KB and loaded from CDN on demand.
|
|
9
|
-
* Most applications that don't use openModal() will never download this code.
|
|
10
|
-
*
|
|
11
|
-
* @returns Promise that resolves when the prebuilt UI is loaded
|
|
12
|
-
*
|
|
13
|
-
* @example Preload modals on app initialization
|
|
14
|
-
* ```typescript
|
|
15
|
-
* // Preload in the background while user interacts with page
|
|
16
|
-
* memberstack.preloadModals();
|
|
17
|
-
*
|
|
18
|
-
* // Later, openModal() will be instant
|
|
19
|
-
* loginButton.addEventListener('click', () => {
|
|
20
|
-
* memberstack.openModal('LOGIN');
|
|
21
|
-
* });
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @example Wait for preload to complete
|
|
25
|
-
* ```typescript
|
|
26
|
-
* await memberstack.preloadModals();
|
|
27
|
-
* console.log('Modals ready!');
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
declare const preloadModals: () => Promise<void>;
|
|
31
|
-
type OpenModalParams = {
|
|
32
|
-
type: "LOGIN" | "SIGNUP" | "FORGOT_PASSWORD" | "RESET_PASSWORD" | "PROFILE";
|
|
33
|
-
translations?: MemberstackTranslations;
|
|
34
|
-
};
|
|
35
|
-
declare const initDefaultMessageBox: () => void;
|
|
36
|
-
declare const showMessage: (msg: string, isError?: boolean) => Promise<void>;
|
|
37
|
-
declare const showLoader: (element?: HTMLElement) => void;
|
|
38
|
-
declare const hideLoader: (element?: HTMLElement) => void;
|
|
39
|
-
declare const handleRedirect: (redirect?: string, redirectOverride?: string) => string | void;
|
|
40
|
-
/**
|
|
41
|
-
* Opens a pre-built authentication or profile modal.
|
|
42
|
-
* The modal provides a complete UI for the specified authentication flow.
|
|
43
|
-
*
|
|
44
|
-
* @param type - The type of modal to open:
|
|
45
|
-
* - `"LOGIN"` - Email/password login form
|
|
46
|
-
* - `"SIGNUP"` - New member registration form
|
|
47
|
-
* - `"PROFILE"` - Member profile editor (requires authenticated user)
|
|
48
|
-
* - `"FORGOT_PASSWORD"` - Password reset request form
|
|
49
|
-
* - `"RESET_PASSWORD"` - Password reset completion form
|
|
50
|
-
* @param params - Optional configuration for the modal
|
|
51
|
-
* @param params.translations - Custom text overrides for modal labels and messages
|
|
52
|
-
* @returns Promise that resolves when the modal closes with the result of the action
|
|
53
|
-
*
|
|
54
|
-
* @example Open login modal
|
|
55
|
-
* ```typescript
|
|
56
|
-
* const result = await memberstack.openModal('LOGIN');
|
|
57
|
-
* if (result?.data?.member) {
|
|
58
|
-
* console.log('User logged in:', result.data.member.auth.email);
|
|
59
|
-
* }
|
|
60
|
-
* ```
|
|
61
|
-
*
|
|
62
|
-
* @example Open signup modal
|
|
63
|
-
* ```typescript
|
|
64
|
-
* await memberstack.openModal('SIGNUP');
|
|
65
|
-
* ```
|
|
66
|
-
*
|
|
67
|
-
* @example Open profile modal for logged-in user
|
|
68
|
-
* ```typescript
|
|
69
|
-
* await memberstack.openModal('PROFILE');
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* @example With custom translations
|
|
73
|
-
* ```typescript
|
|
74
|
-
* await memberstack.openModal('LOGIN', {
|
|
75
|
-
* translations: {
|
|
76
|
-
* login: {
|
|
77
|
-
* title: 'Welcome Back',
|
|
78
|
-
* button: 'Sign In'
|
|
79
|
-
* }
|
|
80
|
-
* }
|
|
81
|
-
* });
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
declare const openModal: (type: OpenModalParams["type"], params?: {
|
|
85
|
-
[key: string]: unknown;
|
|
86
|
-
translations?: MemberstackTranslations;
|
|
87
|
-
}) => Promise<unknown>;
|
|
88
|
-
/**
|
|
89
|
-
* Closes the currently open modal.
|
|
90
|
-
* Safe to call even if no modal is open.
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* ```typescript
|
|
94
|
-
* // Close modal programmatically
|
|
95
|
-
* memberstack.hideModal();
|
|
96
|
-
* ```
|
|
97
|
-
*/
|
|
98
|
-
declare const hideModal: () => void;
|
|
99
|
-
|
|
100
|
-
export { type OpenModalParams, handleRedirect, hideLoader, hideModal, initDefaultMessageBox, openModal, preloadModals, showLoader, showMessage };
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { MemberstackTranslations } from '../../types/translations.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Preloads the prebuilt modal UI components from CDN.
|
|
5
|
-
* Call this if you know you'll need modals and want to avoid
|
|
6
|
-
* the loading delay on first openModal() call.
|
|
7
|
-
*
|
|
8
|
-
* The modal code is ~630KB and loaded from CDN on demand.
|
|
9
|
-
* Most applications that don't use openModal() will never download this code.
|
|
10
|
-
*
|
|
11
|
-
* @returns Promise that resolves when the prebuilt UI is loaded
|
|
12
|
-
*
|
|
13
|
-
* @example Preload modals on app initialization
|
|
14
|
-
* ```typescript
|
|
15
|
-
* // Preload in the background while user interacts with page
|
|
16
|
-
* memberstack.preloadModals();
|
|
17
|
-
*
|
|
18
|
-
* // Later, openModal() will be instant
|
|
19
|
-
* loginButton.addEventListener('click', () => {
|
|
20
|
-
* memberstack.openModal('LOGIN');
|
|
21
|
-
* });
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @example Wait for preload to complete
|
|
25
|
-
* ```typescript
|
|
26
|
-
* await memberstack.preloadModals();
|
|
27
|
-
* console.log('Modals ready!');
|
|
28
|
-
* ```
|
|
29
|
-
*/
|
|
30
|
-
declare const preloadModals: () => Promise<void>;
|
|
31
|
-
type OpenModalParams = {
|
|
32
|
-
type: "LOGIN" | "SIGNUP" | "FORGOT_PASSWORD" | "RESET_PASSWORD" | "PROFILE";
|
|
33
|
-
translations?: MemberstackTranslations;
|
|
34
|
-
};
|
|
35
|
-
declare const initDefaultMessageBox: () => void;
|
|
36
|
-
declare const showMessage: (msg: string, isError?: boolean) => Promise<void>;
|
|
37
|
-
declare const showLoader: (element?: HTMLElement) => void;
|
|
38
|
-
declare const hideLoader: (element?: HTMLElement) => void;
|
|
39
|
-
declare const handleRedirect: (redirect?: string, redirectOverride?: string) => string | void;
|
|
40
|
-
/**
|
|
41
|
-
* Opens a pre-built authentication or profile modal.
|
|
42
|
-
* The modal provides a complete UI for the specified authentication flow.
|
|
43
|
-
*
|
|
44
|
-
* @param type - The type of modal to open:
|
|
45
|
-
* - `"LOGIN"` - Email/password login form
|
|
46
|
-
* - `"SIGNUP"` - New member registration form
|
|
47
|
-
* - `"PROFILE"` - Member profile editor (requires authenticated user)
|
|
48
|
-
* - `"FORGOT_PASSWORD"` - Password reset request form
|
|
49
|
-
* - `"RESET_PASSWORD"` - Password reset completion form
|
|
50
|
-
* @param params - Optional configuration for the modal
|
|
51
|
-
* @param params.translations - Custom text overrides for modal labels and messages
|
|
52
|
-
* @returns Promise that resolves when the modal closes with the result of the action
|
|
53
|
-
*
|
|
54
|
-
* @example Open login modal
|
|
55
|
-
* ```typescript
|
|
56
|
-
* const result = await memberstack.openModal('LOGIN');
|
|
57
|
-
* if (result?.data?.member) {
|
|
58
|
-
* console.log('User logged in:', result.data.member.auth.email);
|
|
59
|
-
* }
|
|
60
|
-
* ```
|
|
61
|
-
*
|
|
62
|
-
* @example Open signup modal
|
|
63
|
-
* ```typescript
|
|
64
|
-
* await memberstack.openModal('SIGNUP');
|
|
65
|
-
* ```
|
|
66
|
-
*
|
|
67
|
-
* @example Open profile modal for logged-in user
|
|
68
|
-
* ```typescript
|
|
69
|
-
* await memberstack.openModal('PROFILE');
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* @example With custom translations
|
|
73
|
-
* ```typescript
|
|
74
|
-
* await memberstack.openModal('LOGIN', {
|
|
75
|
-
* translations: {
|
|
76
|
-
* login: {
|
|
77
|
-
* title: 'Welcome Back',
|
|
78
|
-
* button: 'Sign In'
|
|
79
|
-
* }
|
|
80
|
-
* }
|
|
81
|
-
* });
|
|
82
|
-
* ```
|
|
83
|
-
*/
|
|
84
|
-
declare const openModal: (type: OpenModalParams["type"], params?: {
|
|
85
|
-
[key: string]: unknown;
|
|
86
|
-
translations?: MemberstackTranslations;
|
|
87
|
-
}) => Promise<unknown>;
|
|
88
|
-
/**
|
|
89
|
-
* Closes the currently open modal.
|
|
90
|
-
* Safe to call even if no modal is open.
|
|
91
|
-
*
|
|
92
|
-
* @example
|
|
93
|
-
* ```typescript
|
|
94
|
-
* // Close modal programmatically
|
|
95
|
-
* memberstack.hideModal();
|
|
96
|
-
* ```
|
|
97
|
-
*/
|
|
98
|
-
declare const hideModal: () => void;
|
|
99
|
-
|
|
100
|
-
export { type OpenModalParams, handleRedirect, hideLoader, hideModal, initDefaultMessageBox, openModal, preloadModals, showLoader, showMessage };
|