@wix/members 1.0.540 → 1.0.542

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 (60) hide show
  1. package/account-details-context-provider/package.json +3 -0
  2. package/account-home-context-provider/package.json +3 -0
  3. package/address-context-provider/package.json +3 -0
  4. package/addresses-context-provider/package.json +3 -0
  5. package/build/cjs/context-account-details.d.ts +246 -0
  6. package/build/cjs/context-account-details.js +9508 -0
  7. package/build/cjs/context-account-details.js.map +1 -0
  8. package/build/cjs/context-account-home.d.ts +54 -0
  9. package/build/cjs/context-account-home.js +719 -0
  10. package/build/cjs/context-account-home.js.map +1 -0
  11. package/build/cjs/context-address.d.ts +52 -0
  12. package/build/cjs/context-address.js +587 -0
  13. package/build/cjs/context-address.js.map +1 -0
  14. package/build/cjs/context-addresses.d.ts +104 -0
  15. package/build/cjs/context-addresses.js +9054 -0
  16. package/build/cjs/context-addresses.js.map +1 -0
  17. package/build/cjs/context-authentication.d.ts +633 -0
  18. package/build/cjs/context-authentication.js +4253 -0
  19. package/build/cjs/context-authentication.js.map +1 -0
  20. package/build/es/context-account-details.d.mts +246 -0
  21. package/build/es/context-account-details.mjs +9462 -0
  22. package/build/es/context-account-details.mjs.map +1 -0
  23. package/build/es/context-account-home.d.mts +54 -0
  24. package/build/es/context-account-home.mjs +690 -0
  25. package/build/es/context-account-home.mjs.map +1 -0
  26. package/build/es/context-address.d.mts +52 -0
  27. package/build/es/context-address.mjs +557 -0
  28. package/build/es/context-address.mjs.map +1 -0
  29. package/build/es/context-addresses.d.mts +104 -0
  30. package/build/es/context-addresses.mjs +9012 -0
  31. package/build/es/context-addresses.mjs.map +1 -0
  32. package/build/es/context-authentication.d.mts +633 -0
  33. package/build/es/context-authentication.mjs +4221 -0
  34. package/build/es/context-authentication.mjs.map +1 -0
  35. package/build/internal/cjs/context-account-details.d.ts +246 -0
  36. package/build/internal/cjs/context-account-home.d.ts +54 -0
  37. package/build/internal/cjs/context-address.d.ts +52 -0
  38. package/build/internal/cjs/context-addresses.d.ts +104 -0
  39. package/build/internal/cjs/context-authentication.d.ts +633 -0
  40. package/build/internal/es/context-account-details.d.mts +246 -0
  41. package/build/internal/es/context-account-home.d.mts +54 -0
  42. package/build/internal/es/context-address.d.mts +52 -0
  43. package/build/internal/es/context-addresses.d.mts +104 -0
  44. package/build/internal/es/context-authentication.d.mts +633 -0
  45. package/context/account-details/package.json +3 -0
  46. package/context/account-home/package.json +3 -0
  47. package/context/address/package.json +3 -0
  48. package/context/addresses/package.json +3 -0
  49. package/context/authentication/package.json +3 -0
  50. package/context-runtime/context-account-details/runtime.d.ts +246 -0
  51. package/context-runtime/context-account-details/runtime.js +14 -0
  52. package/context-runtime/context-account-home/runtime.d.ts +54 -0
  53. package/context-runtime/context-account-home/runtime.js +2 -0
  54. package/context-runtime/context-address/runtime.d.ts +52 -0
  55. package/context-runtime/context-address/runtime.js +2 -0
  56. package/context-runtime/context-addresses/runtime.d.ts +104 -0
  57. package/context-runtime/context-addresses/runtime.js +14 -0
  58. package/context-runtime/context-authentication/runtime.d.ts +633 -0
  59. package/context-runtime/context-authentication/runtime.js +6 -0
  60. package/package.json +86 -13
@@ -0,0 +1,246 @@
1
+ import * as _$react from "react";
2
+ import { FC, PropsWithChildren } from "react";
3
+
4
+ //#region ../../node_modules/type-fest/source/observable-like.d.ts
5
+ declare global {
6
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
7
+ interface SymbolConstructor {
8
+ readonly observable: symbol;
9
+ }
10
+ }
11
+ /**
12
+ @remarks
13
+ The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021.
14
+ As well, some guidance on making an `Observable` to not include `closed` property.
15
+ @see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L129-L130
16
+ @see https://github.com/staltz/xstream/blob/6c22580c1d84d69773ee4b0905df44ad464955b3/src/index.ts#L79-L85
17
+ @see https://github.com/benlesh/symbol-observable#making-an-object-observable
18
+
19
+ @category Observable
20
+ */
21
+ //#endregion
22
+ //#region ../../node_modules/@wix/sdk-types/internal/build/index.d.ts
23
+ declare global {
24
+ interface ContextualClient {}
25
+ }
26
+ /**
27
+ * Creates concrete types from SDK descriptors when a contextual client is
28
+ * available.
29
+ *
30
+ * For a REST descriptor the built (bound) API is intersected with the original
31
+ * descriptor, matching what `contextualizeRESTModuleV2` returns at runtime — a
32
+ * value callable as the bound API and still usable as a descriptor. Keeping the
33
+ * descriptor half lets contextual modules be passed to descriptor-constrained
34
+ * helpers such as `elevate` from `@wix/sdk/context` (FEDINF-14092).
35
+ *
36
+ * The `& T` is scoped to REST descriptors — the only shape codegen wraps in
37
+ * `MaybeContext` — so `BuildDescriptors` (used by `createClient().use`) is left
38
+ * unchanged and stays bound-only. The fix lives here rather than in `elevate`,
39
+ * which is kept strict on purpose (see #941) so it still rejects bound-only
40
+ * functions that are unsafe through `createRESTModule`.
41
+ */
42
+ declare global {
43
+ /**
44
+ * A global interface to set the exposure toggle for the SDK.
45
+ * @example
46
+ * ```ts
47
+ * declare global {
48
+ * interface SDKExposureToggle {
49
+ * alpha: true;
50
+ * }
51
+ * }
52
+ */
53
+ interface SDKExposureToggle {}
54
+ }
55
+ declare global {
56
+ /**
57
+ * A global interface to set the type mode for the SDK.
58
+ * @example
59
+ * ```ts
60
+ * declare global {
61
+ * interface SDKTypeMode {
62
+ * strict: true;
63
+ * }
64
+ * }
65
+ */
66
+ interface SDKTypeMode {}
67
+ }
68
+ //#endregion
69
+ //#region ../../node_modules/@wix/app-builder-common/dist/utils/types.d.ts
70
+ type ObjectValues<T> = T[keyof T];
71
+ //#endregion
72
+ //#region src/extensions/account-settings/member-field-contract.d.ts
73
+ /**
74
+ * The semantic kinds a member field can take. Shared so the context provider and the field element
75
+ * describe one vocabulary rather than two that drift apart.
76
+ */
77
+ declare const MEMBER_FIELD_TYPE: {
78
+ readonly TEXT: "TEXT";
79
+ readonly NUMBER: "NUMBER";
80
+ readonly DATE: "DATE";
81
+ readonly URL: "URL";
82
+ readonly SOCIAL: "SOCIAL";
83
+ readonly CHOICE: "CHOICE";
84
+ readonly PHONE: "PHONE";
85
+ };
86
+ type MemberFieldType = ObjectValues<typeof MEMBER_FIELD_TYPE>;
87
+ /** Why a member field's value cannot be saved; a field words its own message from it. */
88
+ declare const MEMBER_FIELD_VALIDATION_ERROR: {
89
+ readonly REQUIRED: "REQUIRED";
90
+ readonly NUMBER: "NUMBER";
91
+ readonly DATE: "DATE";
92
+ readonly URL: "URL";
93
+ readonly CHOICE: "CHOICE";
94
+ readonly PHONE: "PHONE";
95
+ };
96
+ type MemberFieldValidationError = ObjectValues<typeof MEMBER_FIELD_VALIDATION_ERROR>;
97
+ interface MemberFieldOption {
98
+ label: string;
99
+ value: string;
100
+ }
101
+ interface MemberFieldInputEvent {
102
+ target: {
103
+ value?: string | number | null;
104
+ };
105
+ }
106
+ //#endregion
107
+ //#region src/extensions/account-settings/context-providers/account-field-input.d.ts
108
+ interface NamedFieldBinding {
109
+ /** The site's configured field title; `undefined` before the member is read, `null` when the site does not collect the field. */
110
+ name: string | null | undefined;
111
+ value: string;
112
+ }
113
+ //#endregion
114
+ //#region src/extensions/account-settings/context-providers/account-named-fields.d.ts
115
+ /**
116
+ * The platform's own field vocabulary, named as the Members SDK names each value. A `SYSTEM` or
117
+ * `CONTACT` field exists on every site, so each one is addressable by name. Site-specific fields are
118
+ * excluded from Phase 0. The contact email is absent on purpose: the API refuses a write to it.
119
+ */
120
+ declare const NAMED_FIELD_KEYS: {
121
+ readonly firstName: "customfields.system.firstname";
122
+ readonly lastName: "customfields.system.lastname";
123
+ readonly phone: "customfields.system.phone";
124
+ readonly title: "customfields.system.title";
125
+ readonly birthdate: "customfields.contact.birthdate";
126
+ readonly company: "customfields.contact.company";
127
+ readonly jobTitle: "customfields.contact.position";
128
+ };
129
+ type NamedFieldName = keyof typeof NAMED_FIELD_KEYS;
130
+ type NamedValidationErrors = Record<NamedFieldName, MemberFieldValidationError | null>;
131
+ type NamedAccountFields = Record<NamedFieldName, NamedFieldBinding> & {
132
+ /** Every named field's fault, grouped so the binding picker lists them under one heading. */validationErrors: NamedValidationErrors;
133
+ };
134
+ //#endregion
135
+ //#region src/extensions/account-settings/login-info/credential-restriction.d.ts
136
+ /** Whether a signed-in member can change their own credentials on this page, and why not. */
137
+ declare const CREDENTIAL_RESTRICTION: {
138
+ readonly NONE: "NONE";
139
+ readonly SITE_OWNER: "SITE_OWNER";
140
+ readonly SITE_COLLABORATOR: "SITE_COLLABORATOR";
141
+ };
142
+ type CredentialRestriction = ObjectValues<typeof CREDENTIAL_RESTRICTION>;
143
+ //#endregion
144
+ //#region src/extensions/account-settings/login-info/credential-dialog.d.ts
145
+ /** The credential dialog that is open; at most one is. */
146
+ declare const CREDENTIAL_DIALOG: {
147
+ readonly LOGIN_EMAIL: "LOGIN_EMAIL";
148
+ readonly PASSWORD: "PASSWORD";
149
+ };
150
+ type CredentialDialog = ObjectValues<typeof CREDENTIAL_DIALOG>;
151
+ //#endregion
152
+ //#region src/extensions/account-settings/login-info/credential-error.d.ts
153
+ /** Why the last credential write failed. */
154
+ declare const CREDENTIAL_ERROR: {
155
+ readonly INCORRECT_PASSWORD: "INCORRECT_PASSWORD";
156
+ readonly EMAIL_IN_USE: "EMAIL_IN_USE";
157
+ readonly INVALID_EMAIL: "INVALID_EMAIL";
158
+ readonly PASSWORD_TOO_SHORT: "PASSWORD_TOO_SHORT";
159
+ readonly PASSWORD_TOO_LONG: "PASSWORD_TOO_LONG";
160
+ readonly PASSWORD_NOT_ALLOWED: "PASSWORD_NOT_ALLOWED";
161
+ readonly UNKNOWN: "UNKNOWN";
162
+ };
163
+ type CredentialError = ObjectValues<typeof CREDENTIAL_ERROR>;
164
+ //#endregion
165
+ //#region src/extensions/account-settings/context-providers/account-settings-context.d.ts
166
+ declare const SECTION_KIND: {
167
+ readonly GENERAL: "GENERAL";
168
+ readonly DISPLAY_INFO: "DISPLAY_INFO";
169
+ readonly SOCIAL: "SOCIAL";
170
+ };
171
+ type SectionKind = ObjectValues<typeof SECTION_KIND>;
172
+ declare const FIELD_KIND: {
173
+ readonly TEXT: "TEXT";
174
+ readonly NUMBER: "NUMBER";
175
+ readonly DATE: "DATE";
176
+ readonly URL: "URL";
177
+ readonly SOCIAL: "SOCIAL";
178
+ readonly CHOICE: "CHOICE";
179
+ readonly PHONE: "PHONE";
180
+ };
181
+ type FieldKind = MemberFieldType;
182
+ type ChoiceOption = MemberFieldOption;
183
+ type AccountFieldInputEvent = MemberFieldInputEvent;
184
+ interface AccountField {
185
+ id: string;
186
+ key: string;
187
+ kind: FieldKind;
188
+ isRequired: boolean;
189
+ isReadOnly: boolean;
190
+ label: string;
191
+ socialType: string | null;
192
+ loadedValue: string;
193
+ value: string;
194
+ isChanged: boolean;
195
+ options: ChoiceOption[] | null;
196
+ }
197
+ interface AccountFieldSection {
198
+ kind: SectionKind;
199
+ index: number;
200
+ fields: AccountField[];
201
+ }
202
+ interface AccountWriteState {
203
+ isSaving: boolean;
204
+ error: CredentialError | null;
205
+ }
206
+ /** The logged-in member's account details, their editing state and the writes that change them. */
207
+ interface AccountSettingsContextValue extends NamedAccountFields {
208
+ isLoading: boolean;
209
+ /** Bumped on every Save refused for an invalid field, so the topmost invalid input takes focus. */
210
+ focusRequest: number;
211
+ updateNamedField: (fieldName: string, event: MemberFieldInputEvent) => void;
212
+ /** `undefined` until a read commits, `null` with no member. */
213
+ loginEmail: string | null | undefined;
214
+ /** `undefined` until a read commits, `null` with no member. */
215
+ credentialRestriction: CredentialRestriction | null | undefined;
216
+ credentialSaving: boolean;
217
+ credentialError: CredentialError | null;
218
+ credentialDialog: CredentialDialog | null;
219
+ openChangeLoginEmailDialog: () => void;
220
+ openChangePasswordDialog: () => void;
221
+ /** @internal Read by the credential units; a page Button cannot close their modal dialog. */
222
+ closeCredentialDialog: () => void;
223
+ /** Resolves `true` once the member's changes are saved and re-read, `false` when nothing was saved. */
224
+ savePersonalInfo: () => Promise<boolean>;
225
+ /**
226
+ * @internal Read by the credential units, since a page Button cannot supply the passwords.
227
+ * Resolves `true` once the write lands, `false` on failure, refusal or a member change.
228
+ */
229
+ changeLoginEmail: (newEmail: string, currentPassword: string) => Promise<boolean>;
230
+ /** @internal As `changeLoginEmail`. */
231
+ changePassword: (currentPassword: string, newPassword: string) => Promise<boolean>;
232
+ /** Resolves `true` once the email is sent, `false` on failure, refusal or a member change. */
233
+ sendSetPasswordEmail: () => Promise<boolean>;
234
+ }
235
+ declare const AccountSettingsContext: _$react.Context<AccountSettingsContextValue | null>;
236
+ /**
237
+ * Reads the Account Details context. Returns `null` when no provider is attached, so a consumer can
238
+ * collapse instead of crashing the page it was dropped onto.
239
+ */
240
+ declare const useAccountSettings: () => AccountSettingsContextValue | null;
241
+ //#endregion
242
+ //#region src/extensions/account-settings/context-providers/account-settings-context-provider.d.ts
243
+ /** Provides the logged-in member's account details and the writes that change them to its children. */
244
+ declare const AccountSettingsContextProvider: FC<PropsWithChildren>;
245
+ //#endregion
246
+ export { type AccountField, type AccountFieldInputEvent, type AccountFieldSection, AccountSettingsContext, type AccountSettingsContextValue, type AccountWriteState, CREDENTIAL_DIALOG, CREDENTIAL_ERROR, type ChoiceOption, type CredentialDialog, type CredentialError, FIELD_KIND, type FieldKind, NAMED_FIELD_KEYS, type NamedAccountFields, type NamedFieldBinding, SECTION_KIND, type SectionKind, AccountSettingsContextProvider as default, useAccountSettings };