@feelflow/ffid-sdk 4.0.0 → 4.1.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.
@@ -808,7 +808,7 @@ function createProfileMethods(deps) {
808
808
  }
809
809
 
810
810
  // src/client/version-check.ts
811
- var SDK_VERSION = "4.0.0";
811
+ var SDK_VERSION = "4.1.0";
812
812
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
813
813
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
814
814
  function sdkHeaders() {
@@ -806,7 +806,7 @@ function createProfileMethods(deps) {
806
806
  }
807
807
 
808
808
  // src/client/version-check.ts
809
- var SDK_VERSION = "4.0.0";
809
+ var SDK_VERSION = "4.1.0";
810
810
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
811
811
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
812
812
  function sdkHeaders() {
@@ -1,34 +1,34 @@
1
1
  'use strict';
2
2
 
3
- var chunkXQL4YSTL_cjs = require('../chunk-XQL4YSTL.cjs');
3
+ var chunkOYCNHBMG_cjs = require('../chunk-OYCNHBMG.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
8
8
  enumerable: true,
9
- get: function () { return chunkXQL4YSTL_cjs.FFIDAnnouncementBadge; }
9
+ get: function () { return chunkOYCNHBMG_cjs.FFIDAnnouncementBadge; }
10
10
  });
11
11
  Object.defineProperty(exports, "FFIDAnnouncementList", {
12
12
  enumerable: true,
13
- get: function () { return chunkXQL4YSTL_cjs.FFIDAnnouncementList; }
13
+ get: function () { return chunkOYCNHBMG_cjs.FFIDAnnouncementList; }
14
14
  });
15
15
  Object.defineProperty(exports, "FFIDInquiryForm", {
16
16
  enumerable: true,
17
- get: function () { return chunkXQL4YSTL_cjs.FFIDInquiryForm; }
17
+ get: function () { return chunkOYCNHBMG_cjs.FFIDInquiryForm; }
18
18
  });
19
19
  Object.defineProperty(exports, "FFIDLoginButton", {
20
20
  enumerable: true,
21
- get: function () { return chunkXQL4YSTL_cjs.FFIDLoginButton; }
21
+ get: function () { return chunkOYCNHBMG_cjs.FFIDLoginButton; }
22
22
  });
23
23
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
24
24
  enumerable: true,
25
- get: function () { return chunkXQL4YSTL_cjs.FFIDOrganizationSwitcher; }
25
+ get: function () { return chunkOYCNHBMG_cjs.FFIDOrganizationSwitcher; }
26
26
  });
27
27
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
28
28
  enumerable: true,
29
- get: function () { return chunkXQL4YSTL_cjs.FFIDSubscriptionBadge; }
29
+ get: function () { return chunkOYCNHBMG_cjs.FFIDSubscriptionBadge; }
30
30
  });
31
31
  Object.defineProperty(exports, "FFIDUserMenu", {
32
32
  enumerable: true,
33
- get: function () { return chunkXQL4YSTL_cjs.FFIDUserMenu; }
33
+ get: function () { return chunkOYCNHBMG_cjs.FFIDUserMenu; }
34
34
  });
@@ -1 +1 @@
1
- export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-P35ULJLM.js';
1
+ export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-P7HSNT4U.js';
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkXQL4YSTL_cjs = require('./chunk-XQL4YSTL.cjs');
3
+ var chunkOYCNHBMG_cjs = require('./chunk-OYCNHBMG.cjs');
4
4
  var react = require('react');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
 
@@ -53,8 +53,8 @@ function defaultRedirect(url) {
53
53
  }
54
54
  function useRequireActiveSubscription(options) {
55
55
  const { redirectTo, allowGrace = true, onRedirect } = options;
56
- const { isLoading, error } = chunkXQL4YSTL_cjs.useFFIDContext();
57
- const { effectiveStatus, isBlocked, isGrace } = chunkXQL4YSTL_cjs.useSubscription();
56
+ const { isLoading, error } = chunkOYCNHBMG_cjs.useFFIDContext();
57
+ const { effectiveStatus, isBlocked, isGrace } = chunkOYCNHBMG_cjs.useSubscription();
58
58
  const hasFetchError = error !== null && effectiveStatus === null;
59
59
  const shouldRedirect = !isLoading && !hasFetchError && (isBlocked || !allowGrace && isGrace || effectiveStatus === null);
60
60
  react.useEffect(() => {
@@ -75,7 +75,7 @@ function useRequireActiveSubscription(options) {
75
75
  }
76
76
  function withFFIDAuth(Component, options = {}) {
77
77
  const WrappedComponent = (props) => {
78
- const { isLoading, isAuthenticated, login } = chunkXQL4YSTL_cjs.useFFIDContext();
78
+ const { isLoading, isAuthenticated, login } = chunkOYCNHBMG_cjs.useFFIDContext();
79
79
  const hasRedirected = react.useRef(false);
80
80
  react.useEffect(() => {
81
81
  if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
@@ -104,115 +104,115 @@ var FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS = 1e3;
104
104
 
105
105
  Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
106
106
  enumerable: true,
107
- get: function () { return chunkXQL4YSTL_cjs.DEFAULT_API_BASE_URL; }
107
+ get: function () { return chunkOYCNHBMG_cjs.DEFAULT_API_BASE_URL; }
108
108
  });
109
109
  Object.defineProperty(exports, "DEFAULT_OAUTH_SCOPES", {
110
110
  enumerable: true,
111
- get: function () { return chunkXQL4YSTL_cjs.DEFAULT_OAUTH_SCOPES; }
111
+ get: function () { return chunkOYCNHBMG_cjs.DEFAULT_OAUTH_SCOPES; }
112
112
  });
113
113
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
114
114
  enumerable: true,
115
- get: function () { return chunkXQL4YSTL_cjs.FFIDAnnouncementBadge; }
115
+ get: function () { return chunkOYCNHBMG_cjs.FFIDAnnouncementBadge; }
116
116
  });
117
117
  Object.defineProperty(exports, "FFIDAnnouncementList", {
118
118
  enumerable: true,
119
- get: function () { return chunkXQL4YSTL_cjs.FFIDAnnouncementList; }
119
+ get: function () { return chunkOYCNHBMG_cjs.FFIDAnnouncementList; }
120
120
  });
121
121
  Object.defineProperty(exports, "FFIDInquiryForm", {
122
122
  enumerable: true,
123
- get: function () { return chunkXQL4YSTL_cjs.FFIDInquiryForm; }
123
+ get: function () { return chunkOYCNHBMG_cjs.FFIDInquiryForm; }
124
124
  });
125
125
  Object.defineProperty(exports, "FFIDLoginButton", {
126
126
  enumerable: true,
127
- get: function () { return chunkXQL4YSTL_cjs.FFIDLoginButton; }
127
+ get: function () { return chunkOYCNHBMG_cjs.FFIDLoginButton; }
128
128
  });
129
129
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
130
130
  enumerable: true,
131
- get: function () { return chunkXQL4YSTL_cjs.FFIDOrganizationSwitcher; }
131
+ get: function () { return chunkOYCNHBMG_cjs.FFIDOrganizationSwitcher; }
132
132
  });
133
133
  Object.defineProperty(exports, "FFIDProvider", {
134
134
  enumerable: true,
135
- get: function () { return chunkXQL4YSTL_cjs.FFIDProvider; }
135
+ get: function () { return chunkOYCNHBMG_cjs.FFIDProvider; }
136
136
  });
137
137
  Object.defineProperty(exports, "FFIDSDKError", {
138
138
  enumerable: true,
139
- get: function () { return chunkXQL4YSTL_cjs.FFIDSDKError; }
139
+ get: function () { return chunkOYCNHBMG_cjs.FFIDSDKError; }
140
140
  });
141
141
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
142
142
  enumerable: true,
143
- get: function () { return chunkXQL4YSTL_cjs.FFIDSubscriptionBadge; }
143
+ get: function () { return chunkOYCNHBMG_cjs.FFIDSubscriptionBadge; }
144
144
  });
145
145
  Object.defineProperty(exports, "FFIDUserMenu", {
146
146
  enumerable: true,
147
- get: function () { return chunkXQL4YSTL_cjs.FFIDUserMenu; }
147
+ get: function () { return chunkOYCNHBMG_cjs.FFIDUserMenu; }
148
148
  });
149
149
  Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
150
150
  enumerable: true,
151
- get: function () { return chunkXQL4YSTL_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
151
+ get: function () { return chunkOYCNHBMG_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
152
152
  });
153
153
  Object.defineProperty(exports, "FFID_INQUIRY_CATEGORIES", {
154
154
  enumerable: true,
155
- get: function () { return chunkXQL4YSTL_cjs.FFID_INQUIRY_CATEGORIES; }
155
+ get: function () { return chunkOYCNHBMG_cjs.FFID_INQUIRY_CATEGORIES; }
156
156
  });
157
157
  Object.defineProperty(exports, "FFID_INQUIRY_CATEGORIES_SITE_2026", {
158
158
  enumerable: true,
159
- get: function () { return chunkXQL4YSTL_cjs.FFID_INQUIRY_CATEGORIES_SITE_2026; }
159
+ get: function () { return chunkOYCNHBMG_cjs.FFID_INQUIRY_CATEGORIES_SITE_2026; }
160
160
  });
161
161
  Object.defineProperty(exports, "computeEffectiveStatusFromSession", {
162
162
  enumerable: true,
163
- get: function () { return chunkXQL4YSTL_cjs.computeEffectiveStatusFromSession; }
163
+ get: function () { return chunkOYCNHBMG_cjs.computeEffectiveStatusFromSession; }
164
164
  });
165
165
  Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
166
166
  enumerable: true,
167
- get: function () { return chunkXQL4YSTL_cjs.createFFIDAnnouncementsClient; }
167
+ get: function () { return chunkOYCNHBMG_cjs.createFFIDAnnouncementsClient; }
168
168
  });
169
169
  Object.defineProperty(exports, "createFFIDClient", {
170
170
  enumerable: true,
171
- get: function () { return chunkXQL4YSTL_cjs.createFFIDClient; }
171
+ get: function () { return chunkOYCNHBMG_cjs.createFFIDClient; }
172
172
  });
173
173
  Object.defineProperty(exports, "createTokenStore", {
174
174
  enumerable: true,
175
- get: function () { return chunkXQL4YSTL_cjs.createTokenStore; }
175
+ get: function () { return chunkOYCNHBMG_cjs.createTokenStore; }
176
176
  });
177
177
  Object.defineProperty(exports, "generateCodeChallenge", {
178
178
  enumerable: true,
179
- get: function () { return chunkXQL4YSTL_cjs.generateCodeChallenge; }
179
+ get: function () { return chunkOYCNHBMG_cjs.generateCodeChallenge; }
180
180
  });
181
181
  Object.defineProperty(exports, "generateCodeVerifier", {
182
182
  enumerable: true,
183
- get: function () { return chunkXQL4YSTL_cjs.generateCodeVerifier; }
183
+ get: function () { return chunkOYCNHBMG_cjs.generateCodeVerifier; }
184
184
  });
185
185
  Object.defineProperty(exports, "isFFIDInquiryCategorySite2026", {
186
186
  enumerable: true,
187
- get: function () { return chunkXQL4YSTL_cjs.isFFIDInquiryCategorySite2026; }
187
+ get: function () { return chunkOYCNHBMG_cjs.isFFIDInquiryCategorySite2026; }
188
188
  });
189
189
  Object.defineProperty(exports, "normalizeRedirectUri", {
190
190
  enumerable: true,
191
- get: function () { return chunkXQL4YSTL_cjs.normalizeRedirectUri; }
191
+ get: function () { return chunkOYCNHBMG_cjs.normalizeRedirectUri; }
192
192
  });
193
193
  Object.defineProperty(exports, "retrieveCodeVerifier", {
194
194
  enumerable: true,
195
- get: function () { return chunkXQL4YSTL_cjs.retrieveCodeVerifier; }
195
+ get: function () { return chunkOYCNHBMG_cjs.retrieveCodeVerifier; }
196
196
  });
197
197
  Object.defineProperty(exports, "storeCodeVerifier", {
198
198
  enumerable: true,
199
- get: function () { return chunkXQL4YSTL_cjs.storeCodeVerifier; }
199
+ get: function () { return chunkOYCNHBMG_cjs.storeCodeVerifier; }
200
200
  });
201
201
  Object.defineProperty(exports, "useFFID", {
202
202
  enumerable: true,
203
- get: function () { return chunkXQL4YSTL_cjs.useFFID; }
203
+ get: function () { return chunkOYCNHBMG_cjs.useFFID; }
204
204
  });
205
205
  Object.defineProperty(exports, "useFFIDAnnouncements", {
206
206
  enumerable: true,
207
- get: function () { return chunkXQL4YSTL_cjs.useFFIDAnnouncements; }
207
+ get: function () { return chunkOYCNHBMG_cjs.useFFIDAnnouncements; }
208
208
  });
209
209
  Object.defineProperty(exports, "useSubscription", {
210
210
  enumerable: true,
211
- get: function () { return chunkXQL4YSTL_cjs.useSubscription; }
211
+ get: function () { return chunkOYCNHBMG_cjs.useSubscription; }
212
212
  });
213
213
  Object.defineProperty(exports, "withSubscription", {
214
214
  enumerable: true,
215
- get: function () { return chunkXQL4YSTL_cjs.withSubscription; }
215
+ get: function () { return chunkOYCNHBMG_cjs.withSubscription; }
216
216
  });
217
217
  exports.FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS = FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS;
218
218
  exports.FFID_NEWSLETTER_TYPES = FFID_NEWSLETTER_TYPES;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { useFFIDContext, useSubscription } from './chunk-P35ULJLM.js';
2
- export { DEFAULT_API_BASE_URL, DEFAULT_OAUTH_SCOPES, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSDKError, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_INQUIRY_CATEGORIES, FFID_INQUIRY_CATEGORIES_SITE_2026, computeEffectiveStatusFromSession, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, isFFIDInquiryCategorySite2026, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-P35ULJLM.js';
1
+ import { useFFIDContext, useSubscription } from './chunk-P7HSNT4U.js';
2
+ export { DEFAULT_API_BASE_URL, DEFAULT_OAUTH_SCOPES, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSDKError, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_INQUIRY_CATEGORIES, FFID_INQUIRY_CATEGORIES_SITE_2026, computeEffectiveStatusFromSession, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, isFFIDInquiryCategorySite2026, normalizeRedirectUri, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-P7HSNT4U.js';
3
3
  import { useEffect, useRef } from 'react';
4
4
  import { jsx, Fragment } from 'react/jsx-runtime';
5
5
 
@@ -803,7 +803,7 @@ function createProfileMethods(deps) {
803
803
  }
804
804
 
805
805
  // src/client/version-check.ts
806
- var SDK_VERSION = "4.0.0";
806
+ var SDK_VERSION = "4.1.0";
807
807
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
808
808
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
809
809
  function sdkHeaders() {
@@ -802,7 +802,7 @@ function createProfileMethods(deps) {
802
802
  }
803
803
 
804
804
  // src/client/version-check.ts
805
- var SDK_VERSION = "4.0.0";
805
+ var SDK_VERSION = "4.1.0";
806
806
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
807
807
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
808
808
  function sdkHeaders() {
@@ -44,7 +44,7 @@ declare class FFIDWebhookPayloadError extends FFIDWebhookError {
44
44
  * Used by external services to handle real-time event notifications.
45
45
  */
46
46
  /** All supported webhook event types */
47
- type FFIDWebhookEventType = 'subscription.created' | 'subscription.updated' | 'subscription.canceled' | 'subscription.trial_ending' | 'subscription.payment_failed' | 'user.created' | 'user.updated' | 'user.deleted' | 'user.deletion_requested' | 'organization.created' | 'organization.updated' | 'organization.member.added' | 'organization.member.removed' | 'organization.member.role_changed' | 'legal.document.updated' | 'legal.agreement.required' | 'system.maintenance.scheduled' | 'system.maintenance.started' | 'system.maintenance.completed' | 'announcement.published' | 'test.ping';
47
+ type FFIDWebhookEventType = 'subscription.created' | 'subscription.updated' | 'subscription.canceled' | 'subscription.downgrade_scheduled' | 'subscription.downgrade_applied' | 'subscription.downgrade_canceled' | 'subscription.trial_ending' | 'subscription.payment_failed' | 'user.created' | 'user.updated' | 'user.deleted' | 'user.deletion_requested' | 'organization.created' | 'organization.updated' | 'organization.member.added' | 'organization.member.removed' | 'organization.member.role_changed' | 'legal.document.updated' | 'legal.agreement.required' | 'system.maintenance.scheduled' | 'system.maintenance.started' | 'system.maintenance.completed' | 'announcement.published' | 'test.ping';
48
48
  interface FFIDSubscriptionCreatedPayload {
49
49
  subscriptionId: string;
50
50
  organizationId?: string;
@@ -87,6 +87,48 @@ interface FFIDSubscriptionCanceledPayload {
87
87
  */
88
88
  expiredAt?: string;
89
89
  }
90
+ interface FFIDSubscriptionDowngradeScheduledPayload {
91
+ /** FFID subscription UUID. */
92
+ subscriptionId: string;
93
+ /** Organization UUID that owns the subscription. */
94
+ organizationId: string;
95
+ /** Plan UUID currently active on the subscription. */
96
+ currentPlanId: string;
97
+ /** Plan UUID scheduled to become active at period end. */
98
+ newPlanId: string;
99
+ /** Billing interval carried by the target period, typically 'monthly' or 'yearly'. */
100
+ billingInterval: string;
101
+ /** ISO timestamp when the downgrade was scheduled. */
102
+ scheduledAt: string;
103
+ /** ISO timestamp when the scheduled downgrade should take effect. */
104
+ effectiveAt: string;
105
+ }
106
+ interface FFIDSubscriptionDowngradeAppliedPayload {
107
+ /** FFID subscription UUID. */
108
+ subscriptionId: string;
109
+ /** Organization UUID that owns the subscription. */
110
+ organizationId: string;
111
+ /** Plan UUID active before the pending downgrade was applied. */
112
+ previousPlanId: string;
113
+ /** Plan UUID that became active after the downgrade was applied. */
114
+ newPlanId: string;
115
+ /** Billing interval on the applied downgraded plan, typically 'monthly' or 'yearly'. */
116
+ billingInterval: string;
117
+ /** ISO timestamp when FFID applied the pending downgrade. */
118
+ appliedAt: string;
119
+ }
120
+ interface FFIDSubscriptionDowngradeCanceledPayload {
121
+ /** FFID subscription UUID. */
122
+ subscriptionId: string;
123
+ /** Organization UUID that owns the subscription. */
124
+ organizationId: string;
125
+ /** Plan UUID that had been pending but was canceled before taking effect. */
126
+ canceledPlanId: string;
127
+ /** Plan UUID that remains active after canceling the pending downgrade. */
128
+ currentPlanId: string;
129
+ /** ISO timestamp when the pending downgrade was canceled. */
130
+ canceledAt: string;
131
+ }
90
132
  interface FFIDSubscriptionTrialEndingPayload {
91
133
  subscriptionId: string;
92
134
  organizationId?: string;
@@ -221,6 +263,9 @@ interface FFIDWebhookEventMap {
221
263
  'subscription.created': FFIDSubscriptionCreatedPayload;
222
264
  'subscription.updated': FFIDSubscriptionUpdatedPayload;
223
265
  'subscription.canceled': FFIDSubscriptionCanceledPayload;
266
+ 'subscription.downgrade_scheduled': FFIDSubscriptionDowngradeScheduledPayload;
267
+ 'subscription.downgrade_applied': FFIDSubscriptionDowngradeAppliedPayload;
268
+ 'subscription.downgrade_canceled': FFIDSubscriptionDowngradeCanceledPayload;
224
269
  'subscription.trial_ending': FFIDSubscriptionTrialEndingPayload;
225
270
  'subscription.payment_failed': FFIDSubscriptionPaymentFailedPayload;
226
271
  'user.created': FFIDUserCreatedPayload;
@@ -363,4 +408,4 @@ declare function createFFIDWebhookHandler(config: FFIDWebhookHandlerConfig): {
363
408
  /** Type of the FFID Webhook handler */
364
409
  type FFIDWebhookHandler = ReturnType<typeof createFFIDWebhookHandler>;
365
410
 
366
- export { DEFAULT_TOLERANCE_SECONDS, type FFIDLegalAgreementRequiredPayload, type FFIDLegalDocumentUpdatedPayload, type FFIDOrganizationCreatedPayload, type FFIDOrganizationMemberAddedPayload, type FFIDOrganizationMemberRemovedPayload, type FFIDOrganizationMemberRoleChangedPayload, type FFIDOrganizationUpdatedPayload, type FFIDSubscriptionCanceledPayload, type FFIDSubscriptionCreatedPayload, type FFIDSubscriptionPaymentFailedPayload, type FFIDSubscriptionTrialEndingPayload, type FFIDSubscriptionUpdatedPayload, type FFIDSystemMaintenancePayload, type FFIDTestPingPayload, type FFIDUserCreatedPayload, type FFIDUserDeletedPayload, type FFIDUserDeletionRequestedPayload, type FFIDUserUpdatedPayload, FFIDWebhookError, type FFIDWebhookEvent, type FFIDWebhookEventHandler, type FFIDWebhookEventMap, type FFIDWebhookEventType, type FFIDWebhookHandler, type FFIDWebhookHandlerConfig, type FFIDWebhookLogger, FFIDWebhookPayloadError, FFIDWebhookSignatureError, FFIDWebhookTimestampError, FFID_WEBHOOK_EVENT_ID_HEADER, FFID_WEBHOOK_SIGNATURE_HEADER, FFID_WEBHOOK_SIGNATURE_VERSION, FFID_WEBHOOK_TIMESTAMP_HEADER, computeSignature, createFFIDWebhookHandler, parseSignatureHeader, verifyWebhookSignature };
411
+ export { DEFAULT_TOLERANCE_SECONDS, type FFIDLegalAgreementRequiredPayload, type FFIDLegalDocumentUpdatedPayload, type FFIDOrganizationCreatedPayload, type FFIDOrganizationMemberAddedPayload, type FFIDOrganizationMemberRemovedPayload, type FFIDOrganizationMemberRoleChangedPayload, type FFIDOrganizationUpdatedPayload, type FFIDSubscriptionCanceledPayload, type FFIDSubscriptionCreatedPayload, type FFIDSubscriptionDowngradeAppliedPayload, type FFIDSubscriptionDowngradeCanceledPayload, type FFIDSubscriptionDowngradeScheduledPayload, type FFIDSubscriptionPaymentFailedPayload, type FFIDSubscriptionTrialEndingPayload, type FFIDSubscriptionUpdatedPayload, type FFIDSystemMaintenancePayload, type FFIDTestPingPayload, type FFIDUserCreatedPayload, type FFIDUserDeletedPayload, type FFIDUserDeletionRequestedPayload, type FFIDUserUpdatedPayload, FFIDWebhookError, type FFIDWebhookEvent, type FFIDWebhookEventHandler, type FFIDWebhookEventMap, type FFIDWebhookEventType, type FFIDWebhookHandler, type FFIDWebhookHandlerConfig, type FFIDWebhookLogger, FFIDWebhookPayloadError, FFIDWebhookSignatureError, FFIDWebhookTimestampError, FFID_WEBHOOK_EVENT_ID_HEADER, FFID_WEBHOOK_SIGNATURE_HEADER, FFID_WEBHOOK_SIGNATURE_VERSION, FFID_WEBHOOK_TIMESTAMP_HEADER, computeSignature, createFFIDWebhookHandler, parseSignatureHeader, verifyWebhookSignature };
@@ -44,7 +44,7 @@ declare class FFIDWebhookPayloadError extends FFIDWebhookError {
44
44
  * Used by external services to handle real-time event notifications.
45
45
  */
46
46
  /** All supported webhook event types */
47
- type FFIDWebhookEventType = 'subscription.created' | 'subscription.updated' | 'subscription.canceled' | 'subscription.trial_ending' | 'subscription.payment_failed' | 'user.created' | 'user.updated' | 'user.deleted' | 'user.deletion_requested' | 'organization.created' | 'organization.updated' | 'organization.member.added' | 'organization.member.removed' | 'organization.member.role_changed' | 'legal.document.updated' | 'legal.agreement.required' | 'system.maintenance.scheduled' | 'system.maintenance.started' | 'system.maintenance.completed' | 'announcement.published' | 'test.ping';
47
+ type FFIDWebhookEventType = 'subscription.created' | 'subscription.updated' | 'subscription.canceled' | 'subscription.downgrade_scheduled' | 'subscription.downgrade_applied' | 'subscription.downgrade_canceled' | 'subscription.trial_ending' | 'subscription.payment_failed' | 'user.created' | 'user.updated' | 'user.deleted' | 'user.deletion_requested' | 'organization.created' | 'organization.updated' | 'organization.member.added' | 'organization.member.removed' | 'organization.member.role_changed' | 'legal.document.updated' | 'legal.agreement.required' | 'system.maintenance.scheduled' | 'system.maintenance.started' | 'system.maintenance.completed' | 'announcement.published' | 'test.ping';
48
48
  interface FFIDSubscriptionCreatedPayload {
49
49
  subscriptionId: string;
50
50
  organizationId?: string;
@@ -87,6 +87,48 @@ interface FFIDSubscriptionCanceledPayload {
87
87
  */
88
88
  expiredAt?: string;
89
89
  }
90
+ interface FFIDSubscriptionDowngradeScheduledPayload {
91
+ /** FFID subscription UUID. */
92
+ subscriptionId: string;
93
+ /** Organization UUID that owns the subscription. */
94
+ organizationId: string;
95
+ /** Plan UUID currently active on the subscription. */
96
+ currentPlanId: string;
97
+ /** Plan UUID scheduled to become active at period end. */
98
+ newPlanId: string;
99
+ /** Billing interval carried by the target period, typically 'monthly' or 'yearly'. */
100
+ billingInterval: string;
101
+ /** ISO timestamp when the downgrade was scheduled. */
102
+ scheduledAt: string;
103
+ /** ISO timestamp when the scheduled downgrade should take effect. */
104
+ effectiveAt: string;
105
+ }
106
+ interface FFIDSubscriptionDowngradeAppliedPayload {
107
+ /** FFID subscription UUID. */
108
+ subscriptionId: string;
109
+ /** Organization UUID that owns the subscription. */
110
+ organizationId: string;
111
+ /** Plan UUID active before the pending downgrade was applied. */
112
+ previousPlanId: string;
113
+ /** Plan UUID that became active after the downgrade was applied. */
114
+ newPlanId: string;
115
+ /** Billing interval on the applied downgraded plan, typically 'monthly' or 'yearly'. */
116
+ billingInterval: string;
117
+ /** ISO timestamp when FFID applied the pending downgrade. */
118
+ appliedAt: string;
119
+ }
120
+ interface FFIDSubscriptionDowngradeCanceledPayload {
121
+ /** FFID subscription UUID. */
122
+ subscriptionId: string;
123
+ /** Organization UUID that owns the subscription. */
124
+ organizationId: string;
125
+ /** Plan UUID that had been pending but was canceled before taking effect. */
126
+ canceledPlanId: string;
127
+ /** Plan UUID that remains active after canceling the pending downgrade. */
128
+ currentPlanId: string;
129
+ /** ISO timestamp when the pending downgrade was canceled. */
130
+ canceledAt: string;
131
+ }
90
132
  interface FFIDSubscriptionTrialEndingPayload {
91
133
  subscriptionId: string;
92
134
  organizationId?: string;
@@ -221,6 +263,9 @@ interface FFIDWebhookEventMap {
221
263
  'subscription.created': FFIDSubscriptionCreatedPayload;
222
264
  'subscription.updated': FFIDSubscriptionUpdatedPayload;
223
265
  'subscription.canceled': FFIDSubscriptionCanceledPayload;
266
+ 'subscription.downgrade_scheduled': FFIDSubscriptionDowngradeScheduledPayload;
267
+ 'subscription.downgrade_applied': FFIDSubscriptionDowngradeAppliedPayload;
268
+ 'subscription.downgrade_canceled': FFIDSubscriptionDowngradeCanceledPayload;
224
269
  'subscription.trial_ending': FFIDSubscriptionTrialEndingPayload;
225
270
  'subscription.payment_failed': FFIDSubscriptionPaymentFailedPayload;
226
271
  'user.created': FFIDUserCreatedPayload;
@@ -363,4 +408,4 @@ declare function createFFIDWebhookHandler(config: FFIDWebhookHandlerConfig): {
363
408
  /** Type of the FFID Webhook handler */
364
409
  type FFIDWebhookHandler = ReturnType<typeof createFFIDWebhookHandler>;
365
410
 
366
- export { DEFAULT_TOLERANCE_SECONDS, type FFIDLegalAgreementRequiredPayload, type FFIDLegalDocumentUpdatedPayload, type FFIDOrganizationCreatedPayload, type FFIDOrganizationMemberAddedPayload, type FFIDOrganizationMemberRemovedPayload, type FFIDOrganizationMemberRoleChangedPayload, type FFIDOrganizationUpdatedPayload, type FFIDSubscriptionCanceledPayload, type FFIDSubscriptionCreatedPayload, type FFIDSubscriptionPaymentFailedPayload, type FFIDSubscriptionTrialEndingPayload, type FFIDSubscriptionUpdatedPayload, type FFIDSystemMaintenancePayload, type FFIDTestPingPayload, type FFIDUserCreatedPayload, type FFIDUserDeletedPayload, type FFIDUserDeletionRequestedPayload, type FFIDUserUpdatedPayload, FFIDWebhookError, type FFIDWebhookEvent, type FFIDWebhookEventHandler, type FFIDWebhookEventMap, type FFIDWebhookEventType, type FFIDWebhookHandler, type FFIDWebhookHandlerConfig, type FFIDWebhookLogger, FFIDWebhookPayloadError, FFIDWebhookSignatureError, FFIDWebhookTimestampError, FFID_WEBHOOK_EVENT_ID_HEADER, FFID_WEBHOOK_SIGNATURE_HEADER, FFID_WEBHOOK_SIGNATURE_VERSION, FFID_WEBHOOK_TIMESTAMP_HEADER, computeSignature, createFFIDWebhookHandler, parseSignatureHeader, verifyWebhookSignature };
411
+ export { DEFAULT_TOLERANCE_SECONDS, type FFIDLegalAgreementRequiredPayload, type FFIDLegalDocumentUpdatedPayload, type FFIDOrganizationCreatedPayload, type FFIDOrganizationMemberAddedPayload, type FFIDOrganizationMemberRemovedPayload, type FFIDOrganizationMemberRoleChangedPayload, type FFIDOrganizationUpdatedPayload, type FFIDSubscriptionCanceledPayload, type FFIDSubscriptionCreatedPayload, type FFIDSubscriptionDowngradeAppliedPayload, type FFIDSubscriptionDowngradeCanceledPayload, type FFIDSubscriptionDowngradeScheduledPayload, type FFIDSubscriptionPaymentFailedPayload, type FFIDSubscriptionTrialEndingPayload, type FFIDSubscriptionUpdatedPayload, type FFIDSystemMaintenancePayload, type FFIDTestPingPayload, type FFIDUserCreatedPayload, type FFIDUserDeletedPayload, type FFIDUserDeletionRequestedPayload, type FFIDUserUpdatedPayload, FFIDWebhookError, type FFIDWebhookEvent, type FFIDWebhookEventHandler, type FFIDWebhookEventMap, type FFIDWebhookEventType, type FFIDWebhookHandler, type FFIDWebhookHandlerConfig, type FFIDWebhookLogger, FFIDWebhookPayloadError, FFIDWebhookSignatureError, FFIDWebhookTimestampError, FFID_WEBHOOK_EVENT_ID_HEADER, FFID_WEBHOOK_SIGNATURE_HEADER, FFID_WEBHOOK_SIGNATURE_VERSION, FFID_WEBHOOK_TIMESTAMP_HEADER, computeSignature, createFFIDWebhookHandler, parseSignatureHeader, verifyWebhookSignature };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feelflow/ffid-sdk",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "FeelFlow ID Platform SDK for React/Next.js applications",
5
5
  "keywords": [
6
6
  "feelflow",