@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.
- package/README.md +356 -3
- package/lib/auth/index.d.mts +58 -4
- package/lib/auth/index.d.ts +58 -4
- package/lib/auth/index.js +5 -2
- package/lib/auth/index.mjs +4 -2
- package/lib/constants/endpoints.js +2 -1
- package/lib/constants/endpoints.mjs +1 -1
- package/lib/index.d.mts +1874 -61
- package/lib/index.d.ts +1874 -61
- package/lib/index.js +1548 -30626
- package/lib/index.mjs +1534 -30626
- package/lib/methods/dom/index.js +1 -0
- package/lib/methods/dom/main-dom.d.mts +1 -13
- package/lib/methods/dom/main-dom.d.ts +1 -13
- package/lib/methods/dom/main-dom.js +14545 -29552
- package/lib/methods/dom/main-dom.mjs +14544 -29552
- package/lib/methods/dom/methods.d.mts +88 -6
- package/lib/methods/dom/methods.d.ts +88 -6
- package/lib/methods/dom/methods.js +137 -30637
- package/lib/methods/dom/methods.mjs +135 -30639
- package/lib/methods/index.d.mts +111 -29
- package/lib/methods/index.d.ts +111 -29
- package/lib/methods/index.js +1024 -30617
- package/lib/methods/index.mjs +1023 -30617
- package/lib/methods/requests/index.d.mts +843 -23
- package/lib/methods/requests/index.d.ts +843 -23
- package/lib/methods/requests/index.js +867 -42
- package/lib/methods/requests/index.mjs +866 -42
- package/lib/methods/requests/requests.d.mts +9 -8
- package/lib/methods/requests/requests.d.ts +9 -8
- package/lib/methods/requests/requests.js +5 -3
- package/lib/methods/requests/requests.mjs +4 -3
- package/lib/models-BmZS-mc4.d.ts +193 -0
- package/lib/models-CTRKogoR.d.ts +487 -0
- package/lib/models-le7xaT4H.d.ts +193 -0
- package/lib/testing/index.d.mts +272 -0
- package/lib/testing/index.d.ts +272 -0
- package/lib/testing/index.js +313 -0
- package/lib/testing/index.mjs +284 -0
- package/lib/types/index.d.mts +1 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.js +1 -0
- package/lib/types/params.d.mts +634 -10
- package/lib/types/params.d.ts +634 -10
- package/lib/types/params.js +1 -0
- package/lib/types/payloads.d.mts +200 -1
- package/lib/types/payloads.d.ts +200 -1
- package/lib/types/payloads.js +1 -0
- package/lib/types/translations.d.mts +58 -0
- package/lib/types/translations.d.ts +58 -0
- package/lib/types/translations.js +1 -0
- package/lib/types/utils/payloads.d.mts +1 -3
- package/lib/types/utils/payloads.d.ts +1 -3
- package/lib/types/utils/payloads.js +1 -0
- package/lib/utils/cookies.d.mts +5 -5
- package/lib/utils/cookies.d.ts +5 -5
- package/lib/utils/cookies.js +14 -3
- package/lib/utils/cookies.mjs +13 -3
- package/lib/utils/defaultMessageBox.js +1 -0
- package/package.json +23 -12
- package/lib/index.global.js +0 -46364
package/lib/types/params.js
CHANGED
package/lib/types/payloads.d.mts
CHANGED
|
@@ -1,105 +1,266 @@
|
|
|
1
1
|
import { Payload } from './utils/payloads.mjs';
|
|
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
|
-
|
|
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
|
|