@memberstack/dom 2.0.2-beta.0 → 2.0.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.
Files changed (87) hide show
  1. package/lib/index.d.mts +61 -26
  2. package/lib/index.d.ts +61 -26
  3. package/lib/index.js +793 -53
  4. package/lib/index.mjs +793 -53
  5. package/lib/{models-CTRKogoR.d.ts → models-CFT_ABd5.d.ts} +2 -2
  6. package/lib/testing/index.d.mts +25 -2
  7. package/lib/testing/index.d.ts +25 -2
  8. package/lib/testing/index.js +28 -6
  9. package/lib/testing/index.mjs +26 -5
  10. package/package.json +1 -1
  11. package/lib/auth/index.d.mts +0 -63
  12. package/lib/auth/index.d.ts +0 -63
  13. package/lib/auth/index.global.js +0 -244
  14. package/lib/auth/index.js +0 -161
  15. package/lib/auth/index.mjs +0 -123
  16. package/lib/constants/endpoints.d.mts +0 -5
  17. package/lib/constants/endpoints.d.ts +0 -5
  18. package/lib/constants/endpoints.global.js +0 -29
  19. package/lib/constants/endpoints.js +0 -32
  20. package/lib/constants/endpoints.mjs +0 -7
  21. package/lib/methods/dom/index.d.mts +0 -2
  22. package/lib/methods/dom/index.d.ts +0 -2
  23. package/lib/methods/dom/index.global.js +0 -2
  24. package/lib/methods/dom/index.js +0 -1
  25. package/lib/methods/dom/index.mjs +0 -0
  26. package/lib/methods/dom/main-dom.d.mts +0 -2
  27. package/lib/methods/dom/main-dom.d.ts +0 -2
  28. package/lib/methods/dom/main-dom.global.js +0 -30620
  29. package/lib/methods/dom/main-dom.js +0 -15611
  30. package/lib/methods/dom/main-dom.mjs +0 -15593
  31. package/lib/methods/dom/methods.d.mts +0 -100
  32. package/lib/methods/dom/methods.d.ts +0 -100
  33. package/lib/methods/dom/methods.global.js +0 -30827
  34. package/lib/methods/dom/methods.js +0 -335
  35. package/lib/methods/dom/methods.mjs +0 -302
  36. package/lib/methods/index.d.mts +0 -185
  37. package/lib/methods/index.d.ts +0 -185
  38. package/lib/methods/index.global.js +0 -46361
  39. package/lib/methods/index.js +0 -2530
  40. package/lib/methods/index.mjs +0 -2500
  41. package/lib/methods/requests/index.d.mts +0 -912
  42. package/lib/methods/requests/index.d.ts +0 -912
  43. package/lib/methods/requests/index.global.js +0 -15553
  44. package/lib/methods/requests/index.js +0 -2145
  45. package/lib/methods/requests/index.mjs +0 -2110
  46. package/lib/methods/requests/requests.d.mts +0 -43
  47. package/lib/methods/requests/requests.d.ts +0 -43
  48. package/lib/methods/requests/requests.global.js +0 -14528
  49. package/lib/methods/requests/requests.js +0 -244
  50. package/lib/methods/requests/requests.mjs +0 -210
  51. package/lib/models-BmZS-mc4.d.ts +0 -193
  52. package/lib/models-le7xaT4H.d.ts +0 -193
  53. package/lib/types/index.d.mts +0 -5
  54. package/lib/types/index.d.ts +0 -5
  55. package/lib/types/index.global.js +0 -19
  56. package/lib/types/index.js +0 -18
  57. package/lib/types/index.mjs +0 -0
  58. package/lib/types/params.d.mts +0 -946
  59. package/lib/types/params.d.ts +0 -946
  60. package/lib/types/params.global.js +0 -19
  61. package/lib/types/params.js +0 -18
  62. package/lib/types/params.mjs +0 -0
  63. package/lib/types/payloads.d.mts +0 -342
  64. package/lib/types/payloads.d.ts +0 -342
  65. package/lib/types/payloads.global.js +0 -19
  66. package/lib/types/payloads.js +0 -18
  67. package/lib/types/payloads.mjs +0 -0
  68. package/lib/types/translations.d.mts +0 -101
  69. package/lib/types/translations.d.ts +0 -101
  70. package/lib/types/translations.global.js +0 -19
  71. package/lib/types/translations.js +0 -18
  72. package/lib/types/translations.mjs +0 -0
  73. package/lib/types/utils/payloads.d.mts +0 -297
  74. package/lib/types/utils/payloads.d.ts +0 -297
  75. package/lib/types/utils/payloads.global.js +0 -19
  76. package/lib/types/utils/payloads.js +0 -18
  77. package/lib/types/utils/payloads.mjs +0 -0
  78. package/lib/utils/cookies.d.mts +0 -13
  79. package/lib/utils/cookies.d.ts +0 -13
  80. package/lib/utils/cookies.global.js +0 -261
  81. package/lib/utils/cookies.js +0 -190
  82. package/lib/utils/cookies.mjs +0 -148
  83. package/lib/utils/defaultMessageBox.d.mts +0 -5
  84. package/lib/utils/defaultMessageBox.d.ts +0 -5
  85. package/lib/utils/defaultMessageBox.global.js +0 -125
  86. package/lib/utils/defaultMessageBox.js +0 -130
  87. 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 };