@feelflow/ffid-sdk 5.17.1 → 5.19.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/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkA2KK6L63_cjs = require('./chunk-A2KK6L63.cjs');
3
+ var chunkTW2FXASO_cjs = require('./chunk-TW2FXASO.cjs');
4
4
  var chunkH5O2CCAY_cjs = require('./chunk-H5O2CCAY.cjs');
5
5
  var react = require('react');
6
6
  var jsxRuntime = require('react/jsx-runtime');
@@ -54,8 +54,8 @@ function defaultRedirect(url) {
54
54
  }
55
55
  function useRequireActiveSubscription(options) {
56
56
  const { redirectTo, allowGrace = true, onRedirect } = options;
57
- const { isLoading, error } = chunkA2KK6L63_cjs.useFFIDContext();
58
- const { effectiveStatus, isBlocked, isGrace } = chunkA2KK6L63_cjs.useSubscription();
57
+ const { isLoading, error } = chunkTW2FXASO_cjs.useFFIDContext();
58
+ const { effectiveStatus, isBlocked, isGrace } = chunkTW2FXASO_cjs.useSubscription();
59
59
  const hasFetchError = error !== null && effectiveStatus === null;
60
60
  const shouldRedirect = !isLoading && !hasFetchError && (isBlocked || !allowGrace && isGrace || effectiveStatus === null);
61
61
  react.useEffect(() => {
@@ -76,7 +76,7 @@ function useRequireActiveSubscription(options) {
76
76
  }
77
77
  function withFFIDAuth(Component, options = {}) {
78
78
  const WrappedComponent = (props) => {
79
- const { isLoading, isAuthenticated, login } = chunkA2KK6L63_cjs.useFFIDContext();
79
+ const { isLoading, isAuthenticated, login } = chunkTW2FXASO_cjs.useFFIDContext();
80
80
  const hasRedirected = react.useRef(false);
81
81
  react.useEffect(() => {
82
82
  if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
@@ -105,151 +105,155 @@ var FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS = 1e3;
105
105
 
106
106
  Object.defineProperty(exports, "ACCESS_GRANTING_EFFECTIVE_STATUSES", {
107
107
  enumerable: true,
108
- get: function () { return chunkA2KK6L63_cjs.ACCESS_GRANTING_EFFECTIVE_STATUSES; }
108
+ get: function () { return chunkTW2FXASO_cjs.ACCESS_GRANTING_EFFECTIVE_STATUSES; }
109
109
  });
110
110
  Object.defineProperty(exports, "BLOCKING_EFFECTIVE_STATUSES", {
111
111
  enumerable: true,
112
- get: function () { return chunkA2KK6L63_cjs.BLOCKING_EFFECTIVE_STATUSES; }
112
+ get: function () { return chunkTW2FXASO_cjs.BLOCKING_EFFECTIVE_STATUSES; }
113
113
  });
114
114
  Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
115
115
  enumerable: true,
116
- get: function () { return chunkA2KK6L63_cjs.DEFAULT_API_BASE_URL; }
116
+ get: function () { return chunkTW2FXASO_cjs.DEFAULT_API_BASE_URL; }
117
117
  });
118
118
  Object.defineProperty(exports, "DEFAULT_OAUTH_SCOPES", {
119
119
  enumerable: true,
120
- get: function () { return chunkA2KK6L63_cjs.DEFAULT_OAUTH_SCOPES; }
120
+ get: function () { return chunkTW2FXASO_cjs.DEFAULT_OAUTH_SCOPES; }
121
121
  });
122
122
  Object.defineProperty(exports, "EFFECTIVE_SUBSCRIPTION_STATUSES", {
123
123
  enumerable: true,
124
- get: function () { return chunkA2KK6L63_cjs.EFFECTIVE_SUBSCRIPTION_STATUSES; }
124
+ get: function () { return chunkTW2FXASO_cjs.EFFECTIVE_SUBSCRIPTION_STATUSES; }
125
125
  });
126
126
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
127
127
  enumerable: true,
128
- get: function () { return chunkA2KK6L63_cjs.FFIDAnnouncementBadge; }
128
+ get: function () { return chunkTW2FXASO_cjs.FFIDAnnouncementBadge; }
129
129
  });
130
130
  Object.defineProperty(exports, "FFIDAnnouncementList", {
131
131
  enumerable: true,
132
- get: function () { return chunkA2KK6L63_cjs.FFIDAnnouncementList; }
132
+ get: function () { return chunkTW2FXASO_cjs.FFIDAnnouncementList; }
133
133
  });
134
134
  Object.defineProperty(exports, "FFIDInquiryForm", {
135
135
  enumerable: true,
136
- get: function () { return chunkA2KK6L63_cjs.FFIDInquiryForm; }
136
+ get: function () { return chunkTW2FXASO_cjs.FFIDInquiryForm; }
137
137
  });
138
138
  Object.defineProperty(exports, "FFIDLoginButton", {
139
139
  enumerable: true,
140
- get: function () { return chunkA2KK6L63_cjs.FFIDLoginButton; }
140
+ get: function () { return chunkTW2FXASO_cjs.FFIDLoginButton; }
141
141
  });
142
142
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
143
143
  enumerable: true,
144
- get: function () { return chunkA2KK6L63_cjs.FFIDOrganizationSwitcher; }
144
+ get: function () { return chunkTW2FXASO_cjs.FFIDOrganizationSwitcher; }
145
145
  });
146
146
  Object.defineProperty(exports, "FFIDProvider", {
147
147
  enumerable: true,
148
- get: function () { return chunkA2KK6L63_cjs.FFIDProvider; }
148
+ get: function () { return chunkTW2FXASO_cjs.FFIDProvider; }
149
149
  });
150
150
  Object.defineProperty(exports, "FFIDSDKError", {
151
151
  enumerable: true,
152
- get: function () { return chunkA2KK6L63_cjs.FFIDSDKError; }
152
+ get: function () { return chunkTW2FXASO_cjs.FFIDSDKError; }
153
153
  });
154
154
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
155
155
  enumerable: true,
156
- get: function () { return chunkA2KK6L63_cjs.FFIDSubscriptionBadge; }
156
+ get: function () { return chunkTW2FXASO_cjs.FFIDSubscriptionBadge; }
157
157
  });
158
158
  Object.defineProperty(exports, "FFIDUserMenu", {
159
159
  enumerable: true,
160
- get: function () { return chunkA2KK6L63_cjs.FFIDUserMenu; }
160
+ get: function () { return chunkTW2FXASO_cjs.FFIDUserMenu; }
161
161
  });
162
162
  Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
163
163
  enumerable: true,
164
- get: function () { return chunkA2KK6L63_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
164
+ get: function () { return chunkTW2FXASO_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
165
+ });
166
+ Object.defineProperty(exports, "FFID_ERROR_CODES", {
167
+ enumerable: true,
168
+ get: function () { return chunkTW2FXASO_cjs.FFID_ERROR_CODES; }
165
169
  });
166
170
  Object.defineProperty(exports, "FFID_INQUIRY_CATEGORIES", {
167
171
  enumerable: true,
168
- get: function () { return chunkA2KK6L63_cjs.FFID_INQUIRY_CATEGORIES; }
172
+ get: function () { return chunkTW2FXASO_cjs.FFID_INQUIRY_CATEGORIES; }
169
173
  });
170
174
  Object.defineProperty(exports, "FFID_INQUIRY_CATEGORIES_SITE_2026", {
171
175
  enumerable: true,
172
- get: function () { return chunkA2KK6L63_cjs.FFID_INQUIRY_CATEGORIES_SITE_2026; }
176
+ get: function () { return chunkTW2FXASO_cjs.FFID_INQUIRY_CATEGORIES_SITE_2026; }
173
177
  });
174
178
  Object.defineProperty(exports, "clearState", {
175
179
  enumerable: true,
176
- get: function () { return chunkA2KK6L63_cjs.cleanupStateStorage; }
180
+ get: function () { return chunkTW2FXASO_cjs.cleanupStateStorage; }
177
181
  });
178
182
  Object.defineProperty(exports, "computeEffectiveStatusFromSession", {
179
183
  enumerable: true,
180
- get: function () { return chunkA2KK6L63_cjs.computeEffectiveStatusFromSession; }
184
+ get: function () { return chunkTW2FXASO_cjs.computeEffectiveStatusFromSession; }
181
185
  });
182
186
  Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
183
187
  enumerable: true,
184
- get: function () { return chunkA2KK6L63_cjs.createFFIDAnnouncementsClient; }
188
+ get: function () { return chunkTW2FXASO_cjs.createFFIDAnnouncementsClient; }
185
189
  });
186
190
  Object.defineProperty(exports, "createFFIDClient", {
187
191
  enumerable: true,
188
- get: function () { return chunkA2KK6L63_cjs.createFFIDClient; }
192
+ get: function () { return chunkTW2FXASO_cjs.createFFIDClient; }
189
193
  });
190
194
  Object.defineProperty(exports, "createTokenStore", {
191
195
  enumerable: true,
192
- get: function () { return chunkA2KK6L63_cjs.createTokenStore; }
196
+ get: function () { return chunkTW2FXASO_cjs.createTokenStore; }
193
197
  });
194
198
  Object.defineProperty(exports, "generateCodeChallenge", {
195
199
  enumerable: true,
196
- get: function () { return chunkA2KK6L63_cjs.generateCodeChallenge; }
200
+ get: function () { return chunkTW2FXASO_cjs.generateCodeChallenge; }
197
201
  });
198
202
  Object.defineProperty(exports, "generateCodeVerifier", {
199
203
  enumerable: true,
200
- get: function () { return chunkA2KK6L63_cjs.generateCodeVerifier; }
204
+ get: function () { return chunkTW2FXASO_cjs.generateCodeVerifier; }
201
205
  });
202
206
  Object.defineProperty(exports, "handleRedirectCallback", {
203
207
  enumerable: true,
204
- get: function () { return chunkA2KK6L63_cjs.handleRedirectCallback; }
208
+ get: function () { return chunkTW2FXASO_cjs.handleRedirectCallback; }
205
209
  });
206
210
  Object.defineProperty(exports, "hasAccessFromUserinfo", {
207
211
  enumerable: true,
208
- get: function () { return chunkA2KK6L63_cjs.hasAccessFromUserinfo; }
212
+ get: function () { return chunkTW2FXASO_cjs.hasAccessFromUserinfo; }
209
213
  });
210
214
  Object.defineProperty(exports, "isBlockedFromUserinfo", {
211
215
  enumerable: true,
212
- get: function () { return chunkA2KK6L63_cjs.isBlockedFromUserinfo; }
216
+ get: function () { return chunkTW2FXASO_cjs.isBlockedFromUserinfo; }
213
217
  });
214
218
  Object.defineProperty(exports, "isFFIDInquiryCategorySite2026", {
215
219
  enumerable: true,
216
- get: function () { return chunkA2KK6L63_cjs.isFFIDInquiryCategorySite2026; }
220
+ get: function () { return chunkTW2FXASO_cjs.isFFIDInquiryCategorySite2026; }
217
221
  });
218
222
  Object.defineProperty(exports, "normalizeRedirectUri", {
219
223
  enumerable: true,
220
- get: function () { return chunkA2KK6L63_cjs.normalizeRedirectUri; }
224
+ get: function () { return chunkTW2FXASO_cjs.normalizeRedirectUri; }
221
225
  });
222
226
  Object.defineProperty(exports, "retrieveCodeVerifier", {
223
227
  enumerable: true,
224
- get: function () { return chunkA2KK6L63_cjs.retrieveCodeVerifier; }
228
+ get: function () { return chunkTW2FXASO_cjs.retrieveCodeVerifier; }
225
229
  });
226
230
  Object.defineProperty(exports, "retrieveState", {
227
231
  enumerable: true,
228
- get: function () { return chunkA2KK6L63_cjs.retrieveState; }
232
+ get: function () { return chunkTW2FXASO_cjs.retrieveState; }
229
233
  });
230
234
  Object.defineProperty(exports, "storeCodeVerifier", {
231
235
  enumerable: true,
232
- get: function () { return chunkA2KK6L63_cjs.storeCodeVerifier; }
236
+ get: function () { return chunkTW2FXASO_cjs.storeCodeVerifier; }
233
237
  });
234
238
  Object.defineProperty(exports, "storeState", {
235
239
  enumerable: true,
236
- get: function () { return chunkA2KK6L63_cjs.storeState; }
240
+ get: function () { return chunkTW2FXASO_cjs.storeState; }
237
241
  });
238
242
  Object.defineProperty(exports, "useFFID", {
239
243
  enumerable: true,
240
- get: function () { return chunkA2KK6L63_cjs.useFFID; }
244
+ get: function () { return chunkTW2FXASO_cjs.useFFID; }
241
245
  });
242
246
  Object.defineProperty(exports, "useFFIDAnnouncements", {
243
247
  enumerable: true,
244
- get: function () { return chunkA2KK6L63_cjs.useFFIDAnnouncements; }
248
+ get: function () { return chunkTW2FXASO_cjs.useFFIDAnnouncements; }
245
249
  });
246
250
  Object.defineProperty(exports, "useSubscription", {
247
251
  enumerable: true,
248
- get: function () { return chunkA2KK6L63_cjs.useSubscription; }
252
+ get: function () { return chunkTW2FXASO_cjs.useSubscription; }
249
253
  });
250
254
  Object.defineProperty(exports, "withSubscription", {
251
255
  enumerable: true,
252
- get: function () { return chunkA2KK6L63_cjs.withSubscription; }
256
+ get: function () { return chunkTW2FXASO_cjs.withSubscription; }
253
257
  });
254
258
  Object.defineProperty(exports, "ALL_DENIED_EXCEPT_NECESSARY", {
255
259
  enumerable: true,
package/dist/index.d.cts CHANGED
@@ -564,6 +564,217 @@ interface FFIDRemoveMemberResponse {
564
564
  message: string;
565
565
  }
566
566
 
567
+ /**
568
+ * Provisioning types (ext API) — service-key-authenticated, idempotent user /
569
+ * organization provisioning for external batch migration (#3790 / #4127).
570
+ *
571
+ * Mirrors the server contract of `POST /api/v1/ext/users/provision` and
572
+ * `POST /api/v1/ext/organizations/provision`. Responses are modelled as
573
+ * discriminated unions on `dryRun` so consumers narrow with `if (res.dryRun)`
574
+ * and the compiler enforces which fields are present on each branch
575
+ * (`wouldCreate` on dry-run, `created` on a real call).
576
+ */
577
+
578
+ /** Optional business-profile fields applied to a freshly provisioned user. */
579
+ interface FFIDProvisionUserProfileInput {
580
+ /** Display name (1–255 chars). */
581
+ displayName?: string;
582
+ /** Company name (≤255 chars). */
583
+ companyName?: string;
584
+ /** Department (≤255 chars). */
585
+ department?: string;
586
+ /** Job title (≤255 chars). */
587
+ jobTitle?: string;
588
+ /** Phone number (≤30 chars). */
589
+ phone?: string;
590
+ }
591
+ /** Parameters for `provisionUser`. */
592
+ interface FFIDProvisionUserParams {
593
+ /**
594
+ * Email of the user to provision. Normalized (trim + lowercase) server-side
595
+ * before the idempotency lookup, so re-runs with different casing resolve to
596
+ * the same user.
597
+ */
598
+ email: string;
599
+ /** Optional business profile applied only when a new user is created. */
600
+ profile?: FFIDProvisionUserProfileInput;
601
+ /**
602
+ * When `true`, the server performs no writes and returns a
603
+ * {@link FFIDProvisionUserDryRun} describing what a real call would do.
604
+ * @default false
605
+ */
606
+ dryRun?: boolean;
607
+ }
608
+ /** Minimal identity returned for a provisioned / resolved user. */
609
+ interface FFIDProvisionedUser {
610
+ /** User ID (UUID). */
611
+ id: string;
612
+ /** Email address (normalized). */
613
+ email: string;
614
+ }
615
+ /**
616
+ * Real (non-dry-run) user provisioning outcome.
617
+ *
618
+ * Idempotent: an existing email resolves to `created: false` (HTTP 200) instead
619
+ * of creating a duplicate; a new email yields `created: true` (HTTP 201) for a
620
+ * passwordless, email-confirmed user.
621
+ */
622
+ interface FFIDProvisionUserOutcome {
623
+ /** Discriminant — absent/`false` for a real call. */
624
+ dryRun?: false;
625
+ /**
626
+ * `true` → a new passwordless, email-confirmed user was created (HTTP 201).
627
+ * `false` → a user with this email already existed; idempotent no-op (HTTP 200).
628
+ */
629
+ created: boolean;
630
+ user: FFIDProvisionedUser;
631
+ /**
632
+ * Present only when a new user was created **and** a `profile` was supplied.
633
+ * `false` means the user row was created but the authoritative profile write
634
+ * did not complete — some profile fields may not be fully applied, so
635
+ * re-issue the profile to be sure. Absent on the idempotent-existing branch
636
+ * and when no profile was requested.
637
+ */
638
+ profileWritten?: boolean;
639
+ }
640
+ /** Dry-run user provisioning outcome — no writes performed. */
641
+ interface FFIDProvisionUserDryRun {
642
+ /** Discriminant — always `true` for a dry-run. */
643
+ dryRun: true;
644
+ /** Whether a real call would create a new user. */
645
+ wouldCreate: boolean;
646
+ /** `id` is present only when the user already exists. */
647
+ user: {
648
+ id?: string;
649
+ email: string;
650
+ };
651
+ }
652
+ /**
653
+ * Response from `provisionUser`. Narrow with the truthiness of `dryRun`:
654
+ *
655
+ * ```ts
656
+ * if (res.dryRun) {
657
+ * // FFIDProvisionUserDryRun — inspect res.wouldCreate
658
+ * } else {
659
+ * // FFIDProvisionUserOutcome — inspect res.created
660
+ * }
661
+ * ```
662
+ *
663
+ * A real (non-dry-run) response omits `dryRun` on the wire (it is `undefined`,
664
+ * not `false`), so narrow with `if (res.dryRun)` — do **not** use
665
+ * `res.dryRun === false` or `switch (res.dryRun)`, which would miss every real
666
+ * response. This mirrors how `FFIDApiResponse` is narrowed on `data` / `error`.
667
+ */
668
+ type FFIDProvisionUserResponse = FFIDProvisionUserOutcome | FFIDProvisionUserDryRun;
669
+ /** A member to add to the provisioned organization. */
670
+ interface FFIDProvisionOrganizationMemberInput {
671
+ email: string;
672
+ /** `owner` is intentionally excluded — the owner is set via `ownerEmail`. */
673
+ role: FFIDAssignableMemberRole;
674
+ }
675
+ /** Parameters for `provisionOrganization`. */
676
+ interface FFIDProvisionOrganizationParams {
677
+ /** Organization display name (1–255 chars). */
678
+ name: string;
679
+ /**
680
+ * Email of the organization owner. The owner **must** already be an FFID user
681
+ * — provision them via `provisionUser` first, otherwise the call returns an
682
+ * `OWNER_NOT_FOUND` error (HTTP 422).
683
+ */
684
+ ownerEmail: string;
685
+ /** Optional billing contact email. */
686
+ billingEmail?: string;
687
+ /** Members to add idempotently (≤100 per request; validated client-side). */
688
+ members?: FFIDProvisionOrganizationMemberInput[];
689
+ /**
690
+ * When `true`, the server performs no writes and returns a
691
+ * {@link FFIDProvisionOrganizationDryRun} describing what a real call would do.
692
+ * @default false
693
+ */
694
+ dryRun?: boolean;
695
+ }
696
+ /** Minimal organization shape returned by the org provisioning helper. */
697
+ interface FFIDProvisionedOrganization {
698
+ /** Organization ID (UUID). */
699
+ id: string;
700
+ /** Organization display name. */
701
+ name: string;
702
+ /** URL-safe slug. */
703
+ slug: string;
704
+ }
705
+ /** Per-member outcome status of a real (non-dry-run) organization provision. */
706
+ type FFIDProvisionMemberStatus = 'added' | 'already_member' | 'user_not_found';
707
+ /** Per-member outcome status of a dry-run organization provision. */
708
+ type FFIDProvisionMemberPlanStatus = 'would_add' | 'already_member' | 'user_not_found';
709
+ /** Per-member outcome of a real (non-dry-run) organization provision. */
710
+ interface FFIDProvisionMemberResult {
711
+ email: string;
712
+ role: FFIDAssignableMemberRole;
713
+ /**
714
+ * - `added` — membership was inserted.
715
+ * - `already_member` — user was already a member (idempotent no-op).
716
+ * - `user_not_found` — no FFID user exists for this email (skipped).
717
+ */
718
+ status: FFIDProvisionMemberStatus;
719
+ }
720
+ /** Per-member plan of a dry-run organization provision. */
721
+ interface FFIDProvisionMemberPlan {
722
+ email: string;
723
+ role: FFIDAssignableMemberRole;
724
+ /**
725
+ * - `would_add` — user exists and is not yet a member.
726
+ * - `already_member` — user is already a member of the existing org.
727
+ * - `user_not_found` — no FFID user exists for this email.
728
+ */
729
+ status: FFIDProvisionMemberPlanStatus;
730
+ }
731
+ /** Real (non-dry-run) organization provisioning outcome. */
732
+ interface FFIDProvisionOrganizationOutcome {
733
+ /** Discriminant — absent/`false` for a real call. */
734
+ dryRun?: false;
735
+ /**
736
+ * `true` → a brand-new organization was created (HTTP 201).
737
+ * `false` → the owner already owned an org with this name; idempotent (HTTP 200).
738
+ */
739
+ created: boolean;
740
+ organization: FFIDProvisionedOrganization;
741
+ /** Per-member results (added / already_member / user_not_found). */
742
+ members: FFIDProvisionMemberResult[];
743
+ }
744
+ /** Dry-run organization provisioning outcome — no writes performed. */
745
+ interface FFIDProvisionOrganizationDryRun {
746
+ /** Discriminant — always `true` for a dry-run. */
747
+ dryRun: true;
748
+ /**
749
+ * Whether a real call would create a new organization. Coupled to
750
+ * `organization`: `wouldCreate === (organization === null)` — the server
751
+ * returns `organization: null` exactly when it would create a new org.
752
+ */
753
+ wouldCreate: boolean;
754
+ /** `null` when the org does not exist yet (would be created) — see `wouldCreate`. */
755
+ organization: FFIDProvisionedOrganization | null;
756
+ /** Per-member plans (would_add / already_member / user_not_found). */
757
+ members: FFIDProvisionMemberPlan[];
758
+ }
759
+ /**
760
+ * Response from `provisionOrganization`. Narrow on `dryRun`:
761
+ *
762
+ * ```ts
763
+ * if (res.dryRun) {
764
+ * // FFIDProvisionOrganizationDryRun — inspect res.wouldCreate / res.organization (nullable)
765
+ * } else {
766
+ * // FFIDProvisionOrganizationOutcome — inspect res.created / res.members
767
+ * }
768
+ * ```
769
+ *
770
+ * As with `FFIDProvisionUserResponse`, a real response omits `dryRun` on the
771
+ * wire, so narrow with `if (res.dryRun)` — not `res.dryRun === false`.
772
+ *
773
+ * When `ownerEmail` has no FFID user, the call resolves to
774
+ * `{ error: { code: 'OWNER_NOT_FOUND' } }` (HTTP 422) rather than a data branch.
775
+ */
776
+ type FFIDProvisionOrganizationResponse = FFIDProvisionOrganizationOutcome | FFIDProvisionOrganizationDryRun;
777
+
567
778
  /**
568
779
  * Contract resource types (#3787 Phase A)
569
780
  *
@@ -1127,6 +1338,33 @@ interface RedirectToAuthorizeOptions {
1127
1338
  prompt?: FFIDPrompt;
1128
1339
  }
1129
1340
 
1341
+ /**
1342
+ * FFID SDK error codes
1343
+ *
1344
+ * Codes the SDK itself attaches to `FFIDError.code`. Exported from the
1345
+ * package entry points so consumers can branch on codes (e.g.
1346
+ * `TOKEN_EXPIRED` vs `TOKEN_VERIFICATION_ERROR`) without hardcoding strings.
1347
+ */
1348
+ /** Error codes used by the SDK */
1349
+ declare const FFID_ERROR_CODES: {
1350
+ readonly NETWORK_ERROR: "NETWORK_ERROR";
1351
+ readonly PARSE_ERROR: "PARSE_ERROR";
1352
+ readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
1353
+ readonly TOKEN_EXCHANGE_ERROR: "TOKEN_EXCHANGE_ERROR";
1354
+ readonly TOKEN_REFRESH_ERROR: "TOKEN_REFRESH_ERROR";
1355
+ readonly NO_TOKENS: "NO_TOKENS";
1356
+ readonly TOKEN_VERIFICATION_ERROR: "TOKEN_VERIFICATION_ERROR";
1357
+ readonly TOKEN_EXPIRED: "TOKEN_EXPIRED";
1358
+ readonly STATE_MISMATCH_ERROR: "STATE_MISMATCH_ERROR";
1359
+ };
1360
+ /**
1361
+ * Union of the error code literals the SDK itself produces.
1362
+ *
1363
+ * Note: `FFIDError.code` intentionally stays `string` — server-provided
1364
+ * error codes pass through verbatim and must not be narrowed away.
1365
+ */
1366
+ type FFIDErrorCode = (typeof FFID_ERROR_CODES)[keyof typeof FFID_ERROR_CODES];
1367
+
1130
1368
  /** Creates an FFID API client instance */
1131
1369
  declare function createFFIDClient(config: FFIDConfig): {
1132
1370
  getSession: () => Promise<FFIDApiResponse<FFIDSessionResponse>>;
@@ -1167,6 +1405,8 @@ declare function createFFIDClient(config: FFIDConfig): {
1167
1405
  organizationId: string;
1168
1406
  userId: string;
1169
1407
  }) => Promise<FFIDApiResponse<FFIDRemoveMemberResponse>>;
1408
+ provisionUser: (params: FFIDProvisionUserParams) => Promise<FFIDApiResponse<FFIDProvisionUserResponse>>;
1409
+ provisionOrganization: (params: FFIDProvisionOrganizationParams) => Promise<FFIDApiResponse<FFIDProvisionOrganizationResponse>>;
1170
1410
  getProfile: (options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
1171
1411
  updateProfile: (data: FFIDUpdateUserProfileRequest, options?: FFIDProfileCallOptions) => Promise<FFIDApiResponse<FFIDUserProfile>>;
1172
1412
  getLoginHistory: (params?: FFIDGetLoginHistoryParams) => Promise<FFIDApiResponse<FFIDLoginHistoryResponse>>;
@@ -2040,4 +2280,4 @@ declare function createInquiryMethods(deps: InquiryMethodsDeps): {
2040
2280
  };
2041
2281
  type FFIDInquiryClient = ReturnType<typeof createInquiryMethods>;
2042
2282
 
2043
- export { ACCESS_GRANTING_EFFECTIVE_STATUSES, AnnouncementListResponse, BLOCKING_EFFECTIVE_STATUSES, type ComputeEffectiveStatusInput, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, DEFAULT_OAUTH_SCOPES, EffectiveSubscriptionStatus, type ExchangeCodeForTokensOptions, type FFIDAddMemberParams, type FFIDAddMemberRequest, type FFIDAddMemberResponse, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDAssignableMemberRole, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelPendingDowngradeResponse, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, FFIDCheckServiceAccessParams, type FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, type FFIDCreateCheckoutParams, type FFIDCreatePortalParams, FFIDError, type FFIDInquiryClient, FFIDInquiryCreateParams, FFIDInquiryCreateResponse, type FFIDInvitationStatus, type FFIDInviteMemberRequest, type FFIDInviteMemberResponse, type FFIDLeaveOrganizationParams, type FFIDLeaveOrganizationResponse, type FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, type FFIDLoginHistoryEntry, type FFIDLoginHistoryResponse, type FFIDMemberRole, type FFIDMemberStatus, type FFIDNewsletterBodySource, type FFIDNewsletterCampaignStatus, type FFIDNewsletterClient, type FFIDNewsletterConfirmParams, type FFIDNewsletterConfirmResponse, type FFIDNewsletterDispatchParams, type FFIDNewsletterDispatchResponse, type FFIDNewsletterSegment, type FFIDNewsletterSubscribeParams, type FFIDNewsletterSubscribeResponse, type FFIDNewsletterType, type FFIDNewsletterUnsubscribeParams, type FFIDNewsletterUnsubscribeResponse, FFIDOAuthUserInfo, FFIDOAuthUserInfoSubscription, FFIDOrganization, type FFIDOrganizationDomain, type FFIDOrganizationDomainsResponse, type FFIDOrganizationMember, type FFIDOrganizationNotificationPreferences, type FFIDOrganizationNotificationPreferencesResponse, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreview, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, type FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, type FFIDPreviewSeatChangeParams, type FFIDProfileCallOptions, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, type FFIDRemoveMemberResponse, type FFIDResetSessionResponse, FFIDSDKError, type FFIDSeatChangeLineItem, type FFIDSeatChangePreview, type FFIDSeatChangePreviewResponse, FFIDServiceAccessDecision, type FFIDServiceInfo, FFIDSessionResponse, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, type FFIDSupportedCurrency, type FFIDUpdateMemberRoleResponse, type FFIDUpdateNotificationPreferencesRequest, type FFIDUpdateUserProfileRequest, FFIDUser, type FFIDUserProfile, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS, FFID_NEWSLETTER_TYPES, type HandleRedirectCallbackClient, type HandleRedirectCallbackOptions, type KVNamespaceLike, ListAnnouncementsOptions, type NormalizeRedirectUriResult, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type UseRequireActiveSubscriptionOptions, type UseRequireActiveSubscriptionReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, cleanupStateStorage as clearState, computeEffectiveStatusFromSession, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, handleRedirectCallback, hasAccessFromUserinfo, isBlockedFromUserinfo, normalizeRedirectUri, retrieveCodeVerifier, retrieveState, storeCodeVerifier, storeState, useFFID, useRequireActiveSubscription, useSubscription, withFFIDAuth, withSubscription };
2283
+ export { ACCESS_GRANTING_EFFECTIVE_STATUSES, AnnouncementListResponse, BLOCKING_EFFECTIVE_STATUSES, type ComputeEffectiveStatusInput, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, DEFAULT_OAUTH_SCOPES, EffectiveSubscriptionStatus, type ExchangeCodeForTokensOptions, type FFIDAddMemberParams, type FFIDAddMemberRequest, type FFIDAddMemberResponse, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDAssignableMemberRole, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelPendingDowngradeResponse, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, FFIDCheckServiceAccessParams, type FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, type FFIDCreateCheckoutParams, type FFIDCreatePortalParams, FFIDError, type FFIDErrorCode, type FFIDInquiryClient, FFIDInquiryCreateParams, FFIDInquiryCreateResponse, type FFIDInvitationStatus, type FFIDInviteMemberRequest, type FFIDInviteMemberResponse, type FFIDLeaveOrganizationParams, type FFIDLeaveOrganizationResponse, type FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, type FFIDLoginHistoryEntry, type FFIDLoginHistoryResponse, type FFIDMemberRole, type FFIDMemberStatus, type FFIDNewsletterBodySource, type FFIDNewsletterCampaignStatus, type FFIDNewsletterClient, type FFIDNewsletterConfirmParams, type FFIDNewsletterConfirmResponse, type FFIDNewsletterDispatchParams, type FFIDNewsletterDispatchResponse, type FFIDNewsletterSegment, type FFIDNewsletterSubscribeParams, type FFIDNewsletterSubscribeResponse, type FFIDNewsletterType, type FFIDNewsletterUnsubscribeParams, type FFIDNewsletterUnsubscribeResponse, FFIDOAuthUserInfo, FFIDOAuthUserInfoSubscription, FFIDOrganization, type FFIDOrganizationDomain, type FFIDOrganizationDomainsResponse, type FFIDOrganizationMember, type FFIDOrganizationNotificationPreferences, type FFIDOrganizationNotificationPreferencesResponse, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreview, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, type FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, type FFIDPreviewSeatChangeParams, type FFIDProfileCallOptions, FFIDProvider, type FFIDProviderProps, type FFIDProvisionMemberPlan, type FFIDProvisionMemberPlanStatus, type FFIDProvisionMemberResult, type FFIDProvisionMemberStatus, type FFIDProvisionOrganizationDryRun, type FFIDProvisionOrganizationMemberInput, type FFIDProvisionOrganizationOutcome, type FFIDProvisionOrganizationParams, type FFIDProvisionOrganizationResponse, type FFIDProvisionUserDryRun, type FFIDProvisionUserOutcome, type FFIDProvisionUserParams, type FFIDProvisionUserProfileInput, type FFIDProvisionUserResponse, type FFIDProvisionedOrganization, type FFIDProvisionedUser, FFIDRedirectResult, type FFIDRemoveMemberResponse, type FFIDResetSessionResponse, FFIDSDKError, type FFIDSeatChangeLineItem, type FFIDSeatChangePreview, type FFIDSeatChangePreviewResponse, FFIDServiceAccessDecision, type FFIDServiceInfo, FFIDSessionResponse, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, type FFIDSupportedCurrency, type FFIDUpdateMemberRoleResponse, type FFIDUpdateNotificationPreferencesRequest, type FFIDUpdateUserProfileRequest, FFIDUser, type FFIDUserProfile, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_ERROR_CODES, FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS, FFID_NEWSLETTER_TYPES, type HandleRedirectCallbackClient, type HandleRedirectCallbackOptions, type KVNamespaceLike, ListAnnouncementsOptions, type NormalizeRedirectUriResult, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type UseRequireActiveSubscriptionOptions, type UseRequireActiveSubscriptionReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, cleanupStateStorage as clearState, computeEffectiveStatusFromSession, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, handleRedirectCallback, hasAccessFromUserinfo, isBlockedFromUserinfo, normalizeRedirectUri, retrieveCodeVerifier, retrieveState, storeCodeVerifier, storeState, useFFID, useRequireActiveSubscription, useSubscription, withFFIDAuth, withSubscription };