@memberstack/dom 2.0.0 → 2.0.2-beta.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.
Files changed (61) hide show
  1. package/README.md +356 -3
  2. package/lib/auth/index.d.mts +58 -4
  3. package/lib/auth/index.d.ts +58 -4
  4. package/lib/auth/index.js +5 -2
  5. package/lib/auth/index.mjs +4 -2
  6. package/lib/constants/endpoints.js +2 -1
  7. package/lib/constants/endpoints.mjs +1 -1
  8. package/lib/index.d.mts +1874 -61
  9. package/lib/index.d.ts +1874 -61
  10. package/lib/index.js +1548 -30626
  11. package/lib/index.mjs +1534 -30626
  12. package/lib/methods/dom/index.js +1 -0
  13. package/lib/methods/dom/main-dom.d.mts +1 -13
  14. package/lib/methods/dom/main-dom.d.ts +1 -13
  15. package/lib/methods/dom/main-dom.js +14545 -29552
  16. package/lib/methods/dom/main-dom.mjs +14544 -29552
  17. package/lib/methods/dom/methods.d.mts +88 -6
  18. package/lib/methods/dom/methods.d.ts +88 -6
  19. package/lib/methods/dom/methods.js +137 -30637
  20. package/lib/methods/dom/methods.mjs +135 -30639
  21. package/lib/methods/index.d.mts +111 -29
  22. package/lib/methods/index.d.ts +111 -29
  23. package/lib/methods/index.js +1024 -30617
  24. package/lib/methods/index.mjs +1023 -30617
  25. package/lib/methods/requests/index.d.mts +843 -23
  26. package/lib/methods/requests/index.d.ts +843 -23
  27. package/lib/methods/requests/index.js +867 -42
  28. package/lib/methods/requests/index.mjs +866 -42
  29. package/lib/methods/requests/requests.d.mts +9 -8
  30. package/lib/methods/requests/requests.d.ts +9 -8
  31. package/lib/methods/requests/requests.js +5 -3
  32. package/lib/methods/requests/requests.mjs +4 -3
  33. package/lib/models-BmZS-mc4.d.ts +193 -0
  34. package/lib/models-CTRKogoR.d.ts +487 -0
  35. package/lib/models-le7xaT4H.d.ts +193 -0
  36. package/lib/testing/index.d.mts +272 -0
  37. package/lib/testing/index.d.ts +272 -0
  38. package/lib/testing/index.js +313 -0
  39. package/lib/testing/index.mjs +284 -0
  40. package/lib/types/index.d.mts +1 -0
  41. package/lib/types/index.d.ts +1 -0
  42. package/lib/types/index.js +1 -0
  43. package/lib/types/params.d.mts +634 -10
  44. package/lib/types/params.d.ts +634 -10
  45. package/lib/types/params.js +1 -0
  46. package/lib/types/payloads.d.mts +200 -1
  47. package/lib/types/payloads.d.ts +200 -1
  48. package/lib/types/payloads.js +1 -0
  49. package/lib/types/translations.d.mts +58 -0
  50. package/lib/types/translations.d.ts +58 -0
  51. package/lib/types/translations.js +1 -0
  52. package/lib/types/utils/payloads.d.mts +1 -3
  53. package/lib/types/utils/payloads.d.ts +1 -3
  54. package/lib/types/utils/payloads.js +1 -0
  55. package/lib/utils/cookies.d.mts +5 -5
  56. package/lib/utils/cookies.d.ts +5 -5
  57. package/lib/utils/cookies.js +14 -3
  58. package/lib/utils/cookies.mjs +13 -3
  59. package/lib/utils/defaultMessageBox.js +1 -0
  60. package/package.json +23 -12
  61. package/lib/index.global.js +0 -46364
@@ -1,105 +1,266 @@
1
1
  import { Payload } from './utils/payloads.js';
2
2
 
3
+ /**
4
+ * @fileoverview Response payload types for Memberstack SDK methods.
5
+ * All SDK methods return Promise<PayloadType> where PayloadType wraps the data.
6
+ */
7
+
8
+ /** Response from getApp() - contains app configuration */
3
9
  type AppPayload = Response<Payload.Transforms["App"]>;
10
+ /** Response from deleteMember() - contains deletion confirmation */
4
11
  type DeleteMemberPayload = Response<Payload.Transforms["DeletedMember"]>;
12
+ /** Response from getAppAndMember() - contains both app and member data */
5
13
  type GetAppAndMemberPayload = Response<Payload.Transforms["GetAppAndMember"]>;
14
+ /** Response from addMemberCard() - contains updated member data */
6
15
  type AddMemberCardPayload = Response<Payload.Transforms["Member"]>;
16
+ /** Response from cancelPlan() - contains updated member data */
7
17
  type CancelPlanPayload = Response<Payload.Transforms["Member"]>;
18
+ /** Response from removePlan() - contains removal confirmation */
8
19
  type RemovePlanPayload = Response<Payload.Transforms["RemovePlan"]>;
9
- type GetCurrentMemberPayload = Response<Payload.Transforms["Member"]>;
20
+ /**
21
+ * Response from getCurrentMember() - contains member data or null if not logged in.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * const { data: member } = await memberstack.getCurrentMember();
26
+ * if (member) {
27
+ * console.log('Logged in:', member.auth.email);
28
+ * }
29
+ * ```
30
+ */
31
+ type GetCurrentMemberPayload = Response<Payload.Transforms["Member"] | null>;
32
+ /** Response from getMemberJSON() - contains member's JSON store */
10
33
  type GetMemberJSONPayload = Response<Payload.Transforms["MemberJSON"]>;
34
+ /** Response from getMemberCards() - contains array of saved payment cards */
11
35
  type GetMemberCardsPayload = Response<Payload.Transforms["MemberCard"][]>;
36
+ /** Response from connectProvider()/disconnectProvider() - contains updated auth providers */
12
37
  type ConnectProviderPayload = Response<Payload.Transforms["AuthProviders"]>;
38
+ /** Response from getMemberInvoices() - paginated list of invoices */
13
39
  type GetMemberInvoicesPayload = PaginatedResponse<Payload.Transforms["MemberInvoice"]>;
40
+ /** Response from getMemberReceipts() - paginated list of receipts */
14
41
  type GetMemberReceiptsPayload = PaginatedResponse<Payload.Transforms["MemberReceipt"]>;
42
+ /** Response from updateMemberProfileImage() - contains new profile image URL */
15
43
  type UpdateMemberProfileImagePayload = Response<{
16
44
  profileImage: string;
17
45
  }>;
46
+ /** Response from getSecureContent() - contains the gated content HTML */
18
47
  type GetSecureContentPayload = Response<Payload.Transforms["SecureContent"]>;
48
+ /** Response from setPassword() - contains updated member data */
19
49
  type SetPasswordPayload = Response<Payload.Transforms["Member"]>;
50
+ /** Response from getRestrictedUrlGroups() - array of content access groups */
20
51
  type GetRestrictedUrlGroupsPayload = Response<Payload.Transforms["RestrictedUrlGroup"][]>;
52
+ /** Response from getPlans() - array of available plans */
21
53
  type GetPlansPayload = Response<Payload.Transforms["Plan"][]>;
54
+ /** Response from getPlan() - single plan details */
22
55
  type GetPlanPayload = Response<Payload.Transforms["Plan"]>;
56
+ /**
57
+ * Response from loginMemberEmailPassword() - contains member and tokens.
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * const { data } = await memberstack.loginMemberEmailPassword({
62
+ * email: 'user@example.com',
63
+ * password: 'password123'
64
+ * });
65
+ * console.log('Logged in:', data.member.auth.email);
66
+ * ```
67
+ */
23
68
  type LoginMemberEmailPasswordPayload = Response<Payload.Transforms["MemberAuth"]>;
69
+ /** Response from sendMemberLoginPasswordlessEmail() - success indicator */
24
70
  type SendMemberLoginPasswordlessEmailPayload = Response<{
25
71
  success: boolean;
26
72
  }>;
73
+ /** Response from logout() - optional redirect URL */
27
74
  type LogoutMemberPayload = Response<{
28
75
  redirect?: string;
29
76
  }>;
77
+ /** Response from purchasePlans() - contains purchase details */
30
78
  type PurchasePlansPayload = Response<Payload.Transforms["Purchase"]>;
79
+ /** Response from addPlan() - contains updated plan connections */
31
80
  type AddPlanPayload = Response<Payload.Transforms["AddPlan"]>;
81
+ /** Response from purchasePlansWithCheckout() - contains Stripe checkout URL */
32
82
  type PurchasePlansWithCheckoutPayload = Response<Payload.Transforms["PurchaseWithCheckout"]>;
83
+ /** Response from launchStripeCustomerPortal() - contains portal URL */
33
84
  type LaunchStripeCustomerPortalPayload = Response<Payload.Transforms["LaunchStripeCustomerPortal"]>;
85
+ /** Response from openStripeCustomerPortal() - contains portal URL */
34
86
  type OpenStripeCustomerPortalPayload = Response<Payload.Transforms["OpenStripeCustomerPortal"]>;
87
+ /**
88
+ * Response from signupMemberEmailPassword() - contains new member and tokens.
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * const { data } = await memberstack.signupMemberEmailPassword({
93
+ * email: 'newuser@example.com',
94
+ * password: 'password123'
95
+ * });
96
+ * console.log('Signed up:', data.member.id);
97
+ * ```
98
+ */
35
99
  type SignupMemberEmailPasswordPayload = Response<Payload.Transforms["MemberAuth"]>;
100
+ /** Response from signupMemberAuthProvider() - contains member and tokens */
36
101
  type SignupMemberAuthProviderPayload = Response<Payload.Transforms["MemberAuth"]>;
102
+ /** Response from updateDefaultCard() - contains updated member data */
37
103
  type UpdateDefaultCardPayload = Response<Payload.Transforms["Member"]>;
104
+ /** Response from updateMemberAuth() - contains updated member data */
38
105
  type UpdateMemberAuthPayload = Response<Payload.Transforms["Member"]>;
106
+ /** Response from updateMember() - contains updated member data */
39
107
  type UpdateMemberPayload = Response<Payload.Transforms["Member"]>;
108
+ /** Response from updatePlanPayment() - contains updated member data */
40
109
  type UpdatePlanPaymentPayload = Response<Payload.Transforms["Member"]>;
110
+ /** Response from refreshMemberTokens() - contains new access tokens */
41
111
  type RefreshMemberTokensPayload = Response<Payload.Transforms["MemberAuth"]["tokens"]>;
112
+ /** Response from sendMemberResetPasswordEmail() - success message */
42
113
  type SendMemberResetPasswordEmailPayload = Response<string>;
114
+ /** Response from replacePlan() - contains purchase/upgrade details */
43
115
  type ReplacePlanPayload = Response<Payload.Transforms["Purchase"]>;
116
+ /** Response from getAuthProviders() - array of configured OAuth providers */
44
117
  type GetAuthProvidersPayload = Response<Payload.Transforms["AuthProvider"][]>;
118
+ /** Response from getTotalCheckoutAmount() - calculated checkout total */
45
119
  type GetTotalCheckoutAmountPayload = Response<Payload.Transforms["TotalCheckoutAmount"]>;
120
+ /** Response from getAuthenticationClientSecret() - Stripe client secret for SCA */
46
121
  type GetAuthenticationClientSecretPayload = Response<Payload.Transforms["AuthenticationClientSecret"]>;
122
+ /** Response from sendMemberVerificationEmail() - success indicator */
47
123
  type SendMemberVerificationEmailPayload = Response<Payload.Transforms["SendMemberVerificationEmail"]>;
124
+ /** Response from resetMemberPassword() - success indicator */
48
125
  type ResetMemberPassworPayload = Response<Payload.Transforms["ResetMemberPassword"]>;
126
+ /** Response from getPosts() - contains posts array */
49
127
  type GetPostsPayload = Response<Payload.Transforms["Posts"]>;
128
+ /** Response from getThreads() - contains threads array */
50
129
  type GetThreadsPayload = Response<Payload.Transforms["Threads"]>;
130
+ /** Response from createPost() - contains created post */
51
131
  type CreatePostPayload = Response<Payload.Transforms["Post"]>;
132
+ /** Response from createThread() - contains created thread */
52
133
  type CreateThreadPayload = Response<Payload.Transforms["Thread"]>;
134
+ /** Response from updatePost() - contains updated post */
53
135
  type UpdatePostPayload = Response<Payload.Transforms["Post"]>;
136
+ /** Response from updateThread() - contains updated thread */
54
137
  type UpdateThreadPayload = Response<Payload.Transforms["Thread"]>;
138
+ /**
139
+ * Response from getDataTables() - list of all data tables.
140
+ *
141
+ * @example
142
+ * ```typescript
143
+ * const { data } = await memberstack.getDataTables();
144
+ * data.tables.forEach(table => console.log(table.name, table.key));
145
+ * ```
146
+ */
55
147
  type GetDataTablesPayload = Response<{
56
148
  tables: DataTableResponse[];
57
149
  }>;
150
+ /**
151
+ * Response from getDataTable() - single table schema.
152
+ *
153
+ * @example
154
+ * ```typescript
155
+ * const { data: table } = await memberstack.getDataTable({ table: 'posts' });
156
+ * console.log('Fields:', table.fields.map(f => f.name));
157
+ * ```
158
+ */
58
159
  type GetDataTablePayload = Response<DataTableResponse>;
160
+ /**
161
+ * Response from getDataRecords() - paginated records list.
162
+ *
163
+ * @example
164
+ * ```typescript
165
+ * const { data } = await memberstack.getDataRecords({ table: 'posts', limit: 10 });
166
+ * console.log('Records:', data.records.length);
167
+ * console.log('Has more:', data.pagination.hasMore);
168
+ * ```
169
+ */
59
170
  type GetDataRecordsPayload = Response<{
171
+ /** Array of data records */
60
172
  records: DataRecordResponse[];
173
+ /** Pagination information */
61
174
  pagination: {
175
+ /** Number of records returned */
62
176
  limit: number;
177
+ /** Cursor for next page (null if no more) */
63
178
  endCursor: number | null;
179
+ /** Whether more records exist */
64
180
  hasMore: boolean;
65
181
  };
66
182
  }>;
183
+ /** Response from createDataRecord() - the created record */
67
184
  type CreateDataRecordPayload = Response<DataRecordResponse>;
185
+ /** Response from getDataRecord() - single record data */
68
186
  type GetDataRecordPayload = Response<DataRecordResponse>;
187
+ /** Response from updateDataRecord() - the updated record */
69
188
  type UpdateDataRecordPayload = Response<DataRecordResponse>;
189
+ /** Response from deleteDataRecord() - deleted record ID */
70
190
  type DeleteDataRecordPayload = Response<{
71
191
  id: string;
72
192
  }>;
193
+ /**
194
+ * Response from queryDataRecords() - advanced query results.
195
+ * Can return either records with pagination or a count result.
196
+ *
197
+ * @example Records response
198
+ * ```typescript
199
+ * const { data } = await memberstack.queryDataRecords({
200
+ * table: 'posts',
201
+ * query: { where: { published: { equals: true } }, take: 10 }
202
+ * });
203
+ * if ('records' in data) {
204
+ * console.log('Found:', data.records.length);
205
+ * }
206
+ * ```
207
+ */
73
208
  type QueryDataRecordsPayload = Response<{
209
+ /** Array of matching records */
74
210
  records: QueryDataRecordResponse[];
211
+ /** Pagination info (if applicable) */
75
212
  pagination?: {
76
213
  limit: number;
77
214
  hasMore: boolean;
78
215
  endCursor: number;
79
216
  };
80
217
  }> | Response<{
218
+ /** Count result when using _count query */
81
219
  _count: number;
82
220
  }>;
221
+ /**
222
+ * Data table schema and configuration.
223
+ */
83
224
  type DataTableResponse = {
225
+ /** Unique table ID */
84
226
  id: string;
227
+ /** Table key/slug for API calls */
85
228
  key: string;
229
+ /** Display name */
86
230
  name: string;
231
+ /** Create permission rule */
87
232
  createRule: string;
233
+ /** Read permission rule */
88
234
  readRule: string;
235
+ /** Update permission rule */
89
236
  updateRule: string;
237
+ /** Delete permission rule */
90
238
  deleteRule: string;
239
+ /** ISO timestamp of creation */
91
240
  createdAt: string;
241
+ /** ISO timestamp of last update */
92
242
  updatedAt?: string;
243
+ /** Total number of records in table */
93
244
  recordCount: number;
245
+ /** Array of field definitions */
94
246
  fields: {
247
+ /** Unique field ID */
95
248
  id: string;
249
+ /** Field key for data access */
96
250
  key: string;
251
+ /** Display name */
97
252
  name: string;
253
+ /** Field type (text, number, boolean, date, reference, etc.) */
98
254
  type: string;
255
+ /** Whether field is required */
99
256
  required: boolean;
257
+ /** Default value if not provided */
100
258
  defaultValue?: any;
259
+ /** Display order in table */
101
260
  tableOrder?: number;
261
+ /** For reference fields: ID of referenced table */
102
262
  referencedTableId?: string;
263
+ /** For reference fields: referenced table info */
103
264
  referencedTable?: {
104
265
  id: string;
105
266
  key: string;
@@ -107,36 +268,74 @@ type DataTableResponse = {
107
268
  };
108
269
  }[];
109
270
  };
271
+ /**
272
+ * Single data record from a table.
273
+ */
110
274
  type DataRecordResponse = {
275
+ /** Unique record ID */
111
276
  id: string;
277
+ /** Key of the table this record belongs to */
112
278
  tableKey: string;
279
+ /** ID of member who created this record (if applicable) */
113
280
  createdByMemberId?: string;
281
+ /** Record data as key-value pairs */
114
282
  data: Record<string, any>;
283
+ /** ISO timestamp of creation */
115
284
  createdAt: string;
285
+ /** ISO timestamp of last update */
116
286
  updatedAt: string;
287
+ /** Internal ordering value for pagination */
117
288
  internalOrder: number;
289
+ /** Whether current authenticated member owns this record */
118
290
  activeMemberOwnsIt: boolean;
119
291
  };
292
+ /**
293
+ * Result of a reference field connect/disconnect operation.
294
+ */
120
295
  type ReferenceFieldResult = {
296
+ /** Number of records affected */
121
297
  count: number;
298
+ /** Action that was performed */
122
299
  action: 'connected' | 'disconnected' | 'unchanged';
123
300
  };
301
+ /**
302
+ * Result of a member reference field operation.
303
+ */
124
304
  type MemberReferenceFieldResult = {
305
+ /** Number of records affected */
125
306
  count: number;
307
+ /** Whether the current member is referenced */
126
308
  hasself: boolean;
309
+ /** Action that was performed */
127
310
  action: 'connected' | 'disconnected' | 'unchanged';
128
311
  };
312
+ /**
313
+ * Enhanced record response for query API including relationships.
314
+ */
129
315
  type QueryDataRecordResponse = DataRecordResponse & {
316
+ /** Included relationships appear as top-level properties */
130
317
  [relationName: string]: any;
318
+ /** Count of related records when using _count */
131
319
  _count?: Record<string, number>;
132
320
  };
321
+ /**
322
+ * Paginated response wrapper for list endpoints.
323
+ */
133
324
  type PaginatedResponse<T> = {
325
+ /** Whether more pages exist */
134
326
  hasNext: boolean;
327
+ /** Cursor for fetching next page */
135
328
  endCursor: string | null;
329
+ /** Total count of all matching items */
136
330
  totalCount: number;
331
+ /** Array of items for current page */
137
332
  data: T[];
138
333
  };
334
+ /**
335
+ * Standard response wrapper - all SDK methods return this shape.
336
+ */
139
337
  type Response<T> = {
338
+ /** The response data */
140
339
  data: T;
141
340
  };
142
341
 
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -21,6 +21,11 @@ interface MemberstackTranslations {
21
21
  or?: string;
22
22
  continue_with_email?: string;
23
23
  signup_with_password?: string;
24
+ create_an_account?: string;
25
+ already_have_an_account?: string;
26
+ signup_button?: string;
27
+ signup_email_placeholder?: string;
28
+ signup_password_placeholder?: string;
24
29
  reset_your_password?: string;
25
30
  reset_instructions?: string;
26
31
  reset_email_placeholder?: string;
@@ -33,6 +38,59 @@ interface MemberstackTranslations {
33
38
  login_passwordless_instructions?: string;
34
39
  login_verification_code?: string;
35
40
  login_verify_email?: string;
41
+ test_card_title?: string;
42
+ test_card_subtitle?: string;
43
+ test_card_copy_button?: string;
44
+ test_card_copied_button?: string;
45
+ test_successful_payments?: string;
46
+ test_declined_payments?: string;
47
+ test_card_visa?: string;
48
+ test_card_mastercard?: string;
49
+ test_card_amex?: string;
50
+ test_card_generic_decline?: string;
51
+ test_card_insufficient_funds?: string;
52
+ test_card_instructions?: string;
53
+ test_card_continue?: string;
54
+ test_card_alternatives?: string;
55
+ success_title?: string;
56
+ password_reset_success?: string;
57
+ save_button?: string;
58
+ cancel_button?: string;
59
+ copy_button?: string;
60
+ copied_button?: string;
61
+ remove_button?: string;
62
+ upgrade_button?: string;
63
+ delete_account?: string;
64
+ set_password?: string;
65
+ change_password?: string;
66
+ connect_additional_accounts?: string;
67
+ disconnect_provider?: string;
68
+ connect_with_provider?: string;
69
+ delete_confirmation_title?: string;
70
+ delete_confirmation_message?: string;
71
+ yes_delete_account?: string;
72
+ team_title?: string;
73
+ loading_text?: string;
74
+ regenerate_invite_link?: string;
75
+ seats_full_warning?: string;
76
+ are_you_sure?: string;
77
+ member_avatar_alt?: string;
78
+ plans_title?: string;
79
+ paid_plans?: string;
80
+ team_plans?: string;
81
+ free_plans?: string;
82
+ no_plans_message?: string;
83
+ manage_subscriptions?: string;
84
+ leave_team?: string;
85
+ profile_button?: string;
86
+ security_button?: string;
87
+ plans_button?: string;
88
+ team_button?: string;
89
+ logout_button?: string;
90
+ profile_information_title?: string;
91
+ security_title?: string;
92
+ upload_profile_image?: string;
93
+ replace_image?: string;
36
94
  }
37
95
  declare global {
38
96
  interface Window {
@@ -21,6 +21,11 @@ interface MemberstackTranslations {
21
21
  or?: string;
22
22
  continue_with_email?: string;
23
23
  signup_with_password?: string;
24
+ create_an_account?: string;
25
+ already_have_an_account?: string;
26
+ signup_button?: string;
27
+ signup_email_placeholder?: string;
28
+ signup_password_placeholder?: string;
24
29
  reset_your_password?: string;
25
30
  reset_instructions?: string;
26
31
  reset_email_placeholder?: string;
@@ -33,6 +38,59 @@ interface MemberstackTranslations {
33
38
  login_passwordless_instructions?: string;
34
39
  login_verification_code?: string;
35
40
  login_verify_email?: string;
41
+ test_card_title?: string;
42
+ test_card_subtitle?: string;
43
+ test_card_copy_button?: string;
44
+ test_card_copied_button?: string;
45
+ test_successful_payments?: string;
46
+ test_declined_payments?: string;
47
+ test_card_visa?: string;
48
+ test_card_mastercard?: string;
49
+ test_card_amex?: string;
50
+ test_card_generic_decline?: string;
51
+ test_card_insufficient_funds?: string;
52
+ test_card_instructions?: string;
53
+ test_card_continue?: string;
54
+ test_card_alternatives?: string;
55
+ success_title?: string;
56
+ password_reset_success?: string;
57
+ save_button?: string;
58
+ cancel_button?: string;
59
+ copy_button?: string;
60
+ copied_button?: string;
61
+ remove_button?: string;
62
+ upgrade_button?: string;
63
+ delete_account?: string;
64
+ set_password?: string;
65
+ change_password?: string;
66
+ connect_additional_accounts?: string;
67
+ disconnect_provider?: string;
68
+ connect_with_provider?: string;
69
+ delete_confirmation_title?: string;
70
+ delete_confirmation_message?: string;
71
+ yes_delete_account?: string;
72
+ team_title?: string;
73
+ loading_text?: string;
74
+ regenerate_invite_link?: string;
75
+ seats_full_warning?: string;
76
+ are_you_sure?: string;
77
+ member_avatar_alt?: string;
78
+ plans_title?: string;
79
+ paid_plans?: string;
80
+ team_plans?: string;
81
+ free_plans?: string;
82
+ no_plans_message?: string;
83
+ manage_subscriptions?: string;
84
+ leave_team?: string;
85
+ profile_button?: string;
86
+ security_button?: string;
87
+ plans_button?: string;
88
+ team_button?: string;
89
+ logout_button?: string;
90
+ profile_information_title?: string;
91
+ security_title?: string;
92
+ upload_profile_image?: string;
93
+ replace_image?: string;
36
94
  }
37
95
  declare global {
38
96
  interface Window {
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -114,9 +114,7 @@ declare namespace Payload {
114
114
  redirect: string;
115
115
  contentGroups?: Transforms["RestrictedUrlGroup"][];
116
116
  };
117
- MemberJSON: {
118
- json: object;
119
- };
117
+ MemberJSON: object;
120
118
  AuthProviders: {
121
119
  providers: {
122
120
  provider: string;
@@ -114,9 +114,7 @@ declare namespace Payload {
114
114
  redirect: string;
115
115
  contentGroups?: Transforms["RestrictedUrlGroup"][];
116
116
  };
117
- MemberJSON: {
118
- json: object;
119
- };
117
+ MemberJSON: object;
120
118
  AuthProviders: {
121
119
  providers: {
122
120
  provider: string;
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -1,13 +1,13 @@
1
- declare const setUseCookies: (setCookieOnRoot?: any) => void;
2
- declare const setApiDomain: (domain: any) => void;
3
- declare const extractDomainFromHostname: (hostname: any) => any;
1
+ declare const setUseCookies: (setCookieOnRoot?: boolean) => void;
2
+ declare const setApiDomain: (domain: string) => void;
3
+ declare const extractDomainFromHostname: (hostname: string) => string;
4
4
  declare const useCookiesValid: () => boolean;
5
- declare const setMemberToken: (token: any, expires?: number) => void;
5
+ declare const setMemberToken: (token: string, expires?: number) => void;
6
6
  declare const removeMemberToken: () => void;
7
7
  declare const getMemberToken: () => any;
8
8
  declare const setMemberTokenIfAvailable: () => void;
9
9
  declare const getSessionId: () => string;
10
- declare const setSessionId: (sessionId: any) => void;
10
+ declare const setSessionId: (sessionId: string) => void;
11
11
  declare const removeSessionId: () => void;
12
12
 
13
13
  export { extractDomainFromHostname, getMemberToken, getSessionId, removeMemberToken, removeSessionId, setApiDomain, setMemberToken, setMemberTokenIfAvailable, setSessionId, setUseCookies, useCookiesValid };
@@ -1,13 +1,13 @@
1
- declare const setUseCookies: (setCookieOnRoot?: any) => void;
2
- declare const setApiDomain: (domain: any) => void;
3
- declare const extractDomainFromHostname: (hostname: any) => any;
1
+ declare const setUseCookies: (setCookieOnRoot?: boolean) => void;
2
+ declare const setApiDomain: (domain: string) => void;
3
+ declare const extractDomainFromHostname: (hostname: string) => string;
4
4
  declare const useCookiesValid: () => boolean;
5
- declare const setMemberToken: (token: any, expires?: number) => void;
5
+ declare const setMemberToken: (token: string, expires?: number) => void;
6
6
  declare const removeMemberToken: () => void;
7
7
  declare const getMemberToken: () => any;
8
8
  declare const setMemberTokenIfAvailable: () => void;
9
9
  declare const getSessionId: () => string;
10
- declare const setSessionId: (sessionId: any) => void;
10
+ declare const setSessionId: (sessionId: string) => void;
11
11
  declare const removeSessionId: () => void;
12
12
 
13
13
  export { extractDomainFromHostname, getMemberToken, getSessionId, removeMemberToken, removeSessionId, setApiDomain, setMemberToken, setMemberTokenIfAvailable, setSessionId, setUseCookies, useCookiesValid };
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -70,18 +71,28 @@ function isLocalStorageAvailable() {
70
71
  var localStorageAvailable = isLocalStorageAvailable();
71
72
  var useCookies = false;
72
73
  var setCookieOnRootDomain = false;
73
- var apiDomain;
74
+ var apiDomain = "";
74
75
  var setUseCookies = (setCookieOnRoot) => {
75
76
  useCookies = true;
76
77
  if (setCookieOnRoot)
77
78
  setCookieOnRootDomain = true;
78
79
  };
79
80
  var setApiDomain = (domain) => {
80
- apiDomain = domain;
81
+ try {
82
+ if (domain.startsWith("http://") || domain.startsWith("https://")) {
83
+ const url = new URL(domain);
84
+ apiDomain = url.hostname;
85
+ } else {
86
+ apiDomain = domain;
87
+ }
88
+ } catch (e) {
89
+ apiDomain = domain;
90
+ }
81
91
  };
82
92
  var extractDomainFromHostname = (hostname) => {
93
+ var _a, _b;
83
94
  const hostnameParts = hostname.split(".");
84
- const isCountryCodeTLD = hostnameParts.length >= 3 && hostnameParts[hostnameParts.length - 2].length <= 3;
95
+ const isCountryCodeTLD = hostnameParts.length >= 4 && ((_b = (_a = hostnameParts[hostnameParts.length - 2]) == null ? void 0 : _a.length) != null ? _b : 0) <= 3;
85
96
  if (isCountryCodeTLD) {
86
97
  return hostnameParts.slice(-3).join(".");
87
98
  } else {
@@ -30,18 +30,28 @@ function isLocalStorageAvailable() {
30
30
  var localStorageAvailable = isLocalStorageAvailable();
31
31
  var useCookies = false;
32
32
  var setCookieOnRootDomain = false;
33
- var apiDomain;
33
+ var apiDomain = "";
34
34
  var setUseCookies = (setCookieOnRoot) => {
35
35
  useCookies = true;
36
36
  if (setCookieOnRoot)
37
37
  setCookieOnRootDomain = true;
38
38
  };
39
39
  var setApiDomain = (domain) => {
40
- apiDomain = domain;
40
+ try {
41
+ if (domain.startsWith("http://") || domain.startsWith("https://")) {
42
+ const url = new URL(domain);
43
+ apiDomain = url.hostname;
44
+ } else {
45
+ apiDomain = domain;
46
+ }
47
+ } catch (e) {
48
+ apiDomain = domain;
49
+ }
41
50
  };
42
51
  var extractDomainFromHostname = (hostname) => {
52
+ var _a, _b;
43
53
  const hostnameParts = hostname.split(".");
44
- const isCountryCodeTLD = hostnameParts.length >= 3 && hostnameParts[hostnameParts.length - 2].length <= 3;
54
+ const isCountryCodeTLD = hostnameParts.length >= 4 && ((_b = (_a = hostnameParts[hostnameParts.length - 2]) == null ? void 0 : _a.length) != null ? _b : 0) <= 3;
45
55
  if (isCountryCodeTLD) {
46
56
  return hostnameParts.slice(-3).join(".");
47
57
  } else {
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;