@feelflow/ffid-sdk 2.2.0 → 2.4.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.
@@ -600,7 +600,7 @@ function createMembersMethods(deps) {
600
600
  }
601
601
 
602
602
  // src/client/version-check.ts
603
- var SDK_VERSION = "2.2.0";
603
+ var SDK_VERSION = "2.4.0";
604
604
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
605
605
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
606
606
  function sdkHeaders() {
@@ -1488,13 +1488,15 @@ function createContractWizardMethods(deps) {
1488
1488
  return buildWizardUrl(baseUrl, flow, {
1489
1489
  service: serviceCode,
1490
1490
  subscription: subscriptionId,
1491
- redirect: options?.redirect
1491
+ redirect: options?.redirect,
1492
+ org: options?.organizationId
1492
1493
  });
1493
1494
  }
1494
1495
  function getSubscribeUrl(options) {
1495
1496
  return buildWizardUrl(baseUrl, "new-subscription", {
1496
1497
  service: serviceCode,
1497
- redirect: options?.redirect
1498
+ redirect: options?.redirect,
1499
+ org: options?.organizationId
1498
1500
  });
1499
1501
  }
1500
1502
  function redirectToSubscribe(options) {
@@ -1521,7 +1523,8 @@ function createContractWizardMethods(deps) {
1521
1523
  function getResubscribeUrl(options) {
1522
1524
  return buildWizardUrl(baseUrl, "resubscribe", {
1523
1525
  service: options?.serviceCode ?? serviceCode,
1524
- redirect: options?.redirect
1526
+ redirect: options?.redirect,
1527
+ org: options?.organizationId
1525
1528
  });
1526
1529
  }
1527
1530
  function redirectToResubscribe(options) {
@@ -598,7 +598,7 @@ function createMembersMethods(deps) {
598
598
  }
599
599
 
600
600
  // src/client/version-check.ts
601
- var SDK_VERSION = "2.2.0";
601
+ var SDK_VERSION = "2.4.0";
602
602
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
603
603
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
604
604
  function sdkHeaders() {
@@ -1486,13 +1486,15 @@ function createContractWizardMethods(deps) {
1486
1486
  return buildWizardUrl(baseUrl, flow, {
1487
1487
  service: serviceCode,
1488
1488
  subscription: subscriptionId,
1489
- redirect: options?.redirect
1489
+ redirect: options?.redirect,
1490
+ org: options?.organizationId
1490
1491
  });
1491
1492
  }
1492
1493
  function getSubscribeUrl(options) {
1493
1494
  return buildWizardUrl(baseUrl, "new-subscription", {
1494
1495
  service: serviceCode,
1495
- redirect: options?.redirect
1496
+ redirect: options?.redirect,
1497
+ org: options?.organizationId
1496
1498
  });
1497
1499
  }
1498
1500
  function redirectToSubscribe(options) {
@@ -1519,7 +1521,8 @@ function createContractWizardMethods(deps) {
1519
1521
  function getResubscribeUrl(options) {
1520
1522
  return buildWizardUrl(baseUrl, "resubscribe", {
1521
1523
  service: options?.serviceCode ?? serviceCode,
1522
- redirect: options?.redirect
1524
+ redirect: options?.redirect,
1525
+ org: options?.organizationId
1523
1526
  });
1524
1527
  }
1525
1528
  function redirectToResubscribe(options) {
@@ -1,30 +1,30 @@
1
1
  'use strict';
2
2
 
3
- var chunkNO4ZVVPY_cjs = require('../chunk-NO4ZVVPY.cjs');
3
+ var chunkCECTOY4A_cjs = require('../chunk-CECTOY4A.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
8
8
  enumerable: true,
9
- get: function () { return chunkNO4ZVVPY_cjs.FFIDAnnouncementBadge; }
9
+ get: function () { return chunkCECTOY4A_cjs.FFIDAnnouncementBadge; }
10
10
  });
11
11
  Object.defineProperty(exports, "FFIDAnnouncementList", {
12
12
  enumerable: true,
13
- get: function () { return chunkNO4ZVVPY_cjs.FFIDAnnouncementList; }
13
+ get: function () { return chunkCECTOY4A_cjs.FFIDAnnouncementList; }
14
14
  });
15
15
  Object.defineProperty(exports, "FFIDLoginButton", {
16
16
  enumerable: true,
17
- get: function () { return chunkNO4ZVVPY_cjs.FFIDLoginButton; }
17
+ get: function () { return chunkCECTOY4A_cjs.FFIDLoginButton; }
18
18
  });
19
19
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
20
20
  enumerable: true,
21
- get: function () { return chunkNO4ZVVPY_cjs.FFIDOrganizationSwitcher; }
21
+ get: function () { return chunkCECTOY4A_cjs.FFIDOrganizationSwitcher; }
22
22
  });
23
23
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
24
24
  enumerable: true,
25
- get: function () { return chunkNO4ZVVPY_cjs.FFIDSubscriptionBadge; }
25
+ get: function () { return chunkCECTOY4A_cjs.FFIDSubscriptionBadge; }
26
26
  });
27
27
  Object.defineProperty(exports, "FFIDUserMenu", {
28
28
  enumerable: true,
29
- get: function () { return chunkNO4ZVVPY_cjs.FFIDUserMenu; }
29
+ get: function () { return chunkCECTOY4A_cjs.FFIDUserMenu; }
30
30
  });
@@ -1 +1 @@
1
- export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-5SNBQVJQ.js';
1
+ export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-VJHI6RQQ.js';
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkNO4ZVVPY_cjs = require('./chunk-NO4ZVVPY.cjs');
3
+ var chunkCECTOY4A_cjs = require('./chunk-CECTOY4A.cjs');
4
4
  var react = require('react');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
 
@@ -46,7 +46,7 @@ function createKVCacheAdapter(kv) {
46
46
  }
47
47
  function withFFIDAuth(Component, options = {}) {
48
48
  const WrappedComponent = (props) => {
49
- const { isLoading, isAuthenticated, login } = chunkNO4ZVVPY_cjs.useFFIDContext();
49
+ const { isLoading, isAuthenticated, login } = chunkCECTOY4A_cjs.useFFIDContext();
50
50
  const hasRedirected = react.useRef(false);
51
51
  react.useEffect(() => {
52
52
  if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
@@ -71,83 +71,83 @@ function withFFIDAuth(Component, options = {}) {
71
71
 
72
72
  Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
73
73
  enumerable: true,
74
- get: function () { return chunkNO4ZVVPY_cjs.DEFAULT_API_BASE_URL; }
74
+ get: function () { return chunkCECTOY4A_cjs.DEFAULT_API_BASE_URL; }
75
75
  });
76
76
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
77
77
  enumerable: true,
78
- get: function () { return chunkNO4ZVVPY_cjs.FFIDAnnouncementBadge; }
78
+ get: function () { return chunkCECTOY4A_cjs.FFIDAnnouncementBadge; }
79
79
  });
80
80
  Object.defineProperty(exports, "FFIDAnnouncementList", {
81
81
  enumerable: true,
82
- get: function () { return chunkNO4ZVVPY_cjs.FFIDAnnouncementList; }
82
+ get: function () { return chunkCECTOY4A_cjs.FFIDAnnouncementList; }
83
83
  });
84
84
  Object.defineProperty(exports, "FFIDLoginButton", {
85
85
  enumerable: true,
86
- get: function () { return chunkNO4ZVVPY_cjs.FFIDLoginButton; }
86
+ get: function () { return chunkCECTOY4A_cjs.FFIDLoginButton; }
87
87
  });
88
88
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
89
89
  enumerable: true,
90
- get: function () { return chunkNO4ZVVPY_cjs.FFIDOrganizationSwitcher; }
90
+ get: function () { return chunkCECTOY4A_cjs.FFIDOrganizationSwitcher; }
91
91
  });
92
92
  Object.defineProperty(exports, "FFIDProvider", {
93
93
  enumerable: true,
94
- get: function () { return chunkNO4ZVVPY_cjs.FFIDProvider; }
94
+ get: function () { return chunkCECTOY4A_cjs.FFIDProvider; }
95
95
  });
96
96
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
97
97
  enumerable: true,
98
- get: function () { return chunkNO4ZVVPY_cjs.FFIDSubscriptionBadge; }
98
+ get: function () { return chunkCECTOY4A_cjs.FFIDSubscriptionBadge; }
99
99
  });
100
100
  Object.defineProperty(exports, "FFIDUserMenu", {
101
101
  enumerable: true,
102
- get: function () { return chunkNO4ZVVPY_cjs.FFIDUserMenu; }
102
+ get: function () { return chunkCECTOY4A_cjs.FFIDUserMenu; }
103
103
  });
104
104
  Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
105
105
  enumerable: true,
106
- get: function () { return chunkNO4ZVVPY_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
106
+ get: function () { return chunkCECTOY4A_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
107
107
  });
108
108
  Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
109
109
  enumerable: true,
110
- get: function () { return chunkNO4ZVVPY_cjs.createFFIDAnnouncementsClient; }
110
+ get: function () { return chunkCECTOY4A_cjs.createFFIDAnnouncementsClient; }
111
111
  });
112
112
  Object.defineProperty(exports, "createFFIDClient", {
113
113
  enumerable: true,
114
- get: function () { return chunkNO4ZVVPY_cjs.createFFIDClient; }
114
+ get: function () { return chunkCECTOY4A_cjs.createFFIDClient; }
115
115
  });
116
116
  Object.defineProperty(exports, "createTokenStore", {
117
117
  enumerable: true,
118
- get: function () { return chunkNO4ZVVPY_cjs.createTokenStore; }
118
+ get: function () { return chunkCECTOY4A_cjs.createTokenStore; }
119
119
  });
120
120
  Object.defineProperty(exports, "generateCodeChallenge", {
121
121
  enumerable: true,
122
- get: function () { return chunkNO4ZVVPY_cjs.generateCodeChallenge; }
122
+ get: function () { return chunkCECTOY4A_cjs.generateCodeChallenge; }
123
123
  });
124
124
  Object.defineProperty(exports, "generateCodeVerifier", {
125
125
  enumerable: true,
126
- get: function () { return chunkNO4ZVVPY_cjs.generateCodeVerifier; }
126
+ get: function () { return chunkCECTOY4A_cjs.generateCodeVerifier; }
127
127
  });
128
128
  Object.defineProperty(exports, "retrieveCodeVerifier", {
129
129
  enumerable: true,
130
- get: function () { return chunkNO4ZVVPY_cjs.retrieveCodeVerifier; }
130
+ get: function () { return chunkCECTOY4A_cjs.retrieveCodeVerifier; }
131
131
  });
132
132
  Object.defineProperty(exports, "storeCodeVerifier", {
133
133
  enumerable: true,
134
- get: function () { return chunkNO4ZVVPY_cjs.storeCodeVerifier; }
134
+ get: function () { return chunkCECTOY4A_cjs.storeCodeVerifier; }
135
135
  });
136
136
  Object.defineProperty(exports, "useFFID", {
137
137
  enumerable: true,
138
- get: function () { return chunkNO4ZVVPY_cjs.useFFID; }
138
+ get: function () { return chunkCECTOY4A_cjs.useFFID; }
139
139
  });
140
140
  Object.defineProperty(exports, "useFFIDAnnouncements", {
141
141
  enumerable: true,
142
- get: function () { return chunkNO4ZVVPY_cjs.useFFIDAnnouncements; }
142
+ get: function () { return chunkCECTOY4A_cjs.useFFIDAnnouncements; }
143
143
  });
144
144
  Object.defineProperty(exports, "useSubscription", {
145
145
  enumerable: true,
146
- get: function () { return chunkNO4ZVVPY_cjs.useSubscription; }
146
+ get: function () { return chunkCECTOY4A_cjs.useSubscription; }
147
147
  });
148
148
  Object.defineProperty(exports, "withSubscription", {
149
149
  enumerable: true,
150
- get: function () { return chunkNO4ZVVPY_cjs.withSubscription; }
150
+ get: function () { return chunkCECTOY4A_cjs.withSubscription; }
151
151
  });
152
152
  exports.createKVCacheAdapter = createKVCacheAdapter;
153
153
  exports.createMemoryCacheAdapter = createMemoryCacheAdapter;
package/dist/index.d.cts CHANGED
@@ -147,6 +147,14 @@ interface FFIDSubscriptionDetail {
147
147
  trialEnd: string | null;
148
148
  canceledAt: string | null;
149
149
  cancelAtPeriodEnd: boolean;
150
+ /** Pending period-end downgrade info (null = no scheduled downgrade) */
151
+ pendingDowngrade: {
152
+ planCode: string;
153
+ planName: string;
154
+ billingInterval: FFIDBillingInterval;
155
+ scheduledAt: string;
156
+ requestedAt: string;
157
+ } | null;
150
158
  createdAt: string;
151
159
  }
152
160
  /** Parameters for subscribing to a plan */
@@ -223,6 +231,12 @@ interface FFIDChangePlanResponse {
223
231
  status: FFIDSubscriptionStatus;
224
232
  isUpgrade: boolean;
225
233
  };
234
+ /** Present when downgrade is scheduled for period end instead of immediate */
235
+ pendingDowngrade?: {
236
+ planCode: string;
237
+ planName: string;
238
+ scheduledAt: string;
239
+ };
226
240
  }
227
241
  /** Parameters for canceling subscription */
228
242
  interface FFIDCancelSubscriptionParams {
@@ -325,6 +339,8 @@ type ContractWizardFlowType = 'new-subscription' | 'resubscribe' | 'change-plan'
325
339
  interface ContractWizardSubscribeOptions {
326
340
  /** URL to redirect back to after completion */
327
341
  redirect?: string;
342
+ /** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
343
+ organizationId?: string;
328
344
  }
329
345
  /** Options for the resubscribe wizard flow */
330
346
  interface ContractWizardResubscribeOptions {
@@ -332,11 +348,15 @@ interface ContractWizardResubscribeOptions {
332
348
  serviceCode?: string;
333
349
  /** URL to redirect back to after completion */
334
350
  redirect?: string;
351
+ /** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
352
+ organizationId?: string;
335
353
  }
336
354
  /** Options for wizard flows that operate on an existing subscription */
337
355
  interface ContractWizardSubscriptionOptions {
338
356
  /** URL to redirect back to after completion */
339
357
  redirect?: string;
358
+ /** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
359
+ organizationId?: string;
340
360
  }
341
361
 
342
362
  /** Redirect and URL generation - redirectToLogin / redirectToAuthorize / redirectToLogout / getLoginUrl / getSignupUrl / getLogoutUrl */
package/dist/index.d.ts CHANGED
@@ -147,6 +147,14 @@ interface FFIDSubscriptionDetail {
147
147
  trialEnd: string | null;
148
148
  canceledAt: string | null;
149
149
  cancelAtPeriodEnd: boolean;
150
+ /** Pending period-end downgrade info (null = no scheduled downgrade) */
151
+ pendingDowngrade: {
152
+ planCode: string;
153
+ planName: string;
154
+ billingInterval: FFIDBillingInterval;
155
+ scheduledAt: string;
156
+ requestedAt: string;
157
+ } | null;
150
158
  createdAt: string;
151
159
  }
152
160
  /** Parameters for subscribing to a plan */
@@ -223,6 +231,12 @@ interface FFIDChangePlanResponse {
223
231
  status: FFIDSubscriptionStatus;
224
232
  isUpgrade: boolean;
225
233
  };
234
+ /** Present when downgrade is scheduled for period end instead of immediate */
235
+ pendingDowngrade?: {
236
+ planCode: string;
237
+ planName: string;
238
+ scheduledAt: string;
239
+ };
226
240
  }
227
241
  /** Parameters for canceling subscription */
228
242
  interface FFIDCancelSubscriptionParams {
@@ -325,6 +339,8 @@ type ContractWizardFlowType = 'new-subscription' | 'resubscribe' | 'change-plan'
325
339
  interface ContractWizardSubscribeOptions {
326
340
  /** URL to redirect back to after completion */
327
341
  redirect?: string;
342
+ /** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
343
+ organizationId?: string;
328
344
  }
329
345
  /** Options for the resubscribe wizard flow */
330
346
  interface ContractWizardResubscribeOptions {
@@ -332,11 +348,15 @@ interface ContractWizardResubscribeOptions {
332
348
  serviceCode?: string;
333
349
  /** URL to redirect back to after completion */
334
350
  redirect?: string;
351
+ /** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
352
+ organizationId?: string;
335
353
  }
336
354
  /** Options for wizard flows that operate on an existing subscription */
337
355
  interface ContractWizardSubscriptionOptions {
338
356
  /** URL to redirect back to after completion */
339
357
  redirect?: string;
358
+ /** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
359
+ organizationId?: string;
340
360
  }
341
361
 
342
362
  /** Redirect and URL generation - redirectToLogin / redirectToAuthorize / redirectToLogout / getLoginUrl / getSignupUrl / getLogoutUrl */
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { useFFIDContext } from './chunk-5SNBQVJQ.js';
2
- export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-5SNBQVJQ.js';
1
+ import { useFFIDContext } from './chunk-VJHI6RQQ.js';
2
+ export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-VJHI6RQQ.js';
3
3
  import { useRef, useEffect } from 'react';
4
4
  import { jsx, Fragment } from 'react/jsx-runtime';
5
5
 
@@ -596,7 +596,7 @@ function createMembersMethods(deps) {
596
596
  }
597
597
 
598
598
  // src/client/version-check.ts
599
- var SDK_VERSION = "2.2.0";
599
+ var SDK_VERSION = "2.4.0";
600
600
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
601
601
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
602
602
  function sdkHeaders() {
@@ -1471,13 +1471,15 @@ function createContractWizardMethods(deps) {
1471
1471
  return buildWizardUrl(baseUrl, flow, {
1472
1472
  service: serviceCode,
1473
1473
  subscription: subscriptionId,
1474
- redirect: options?.redirect
1474
+ redirect: options?.redirect,
1475
+ org: options?.organizationId
1475
1476
  });
1476
1477
  }
1477
1478
  function getSubscribeUrl(options) {
1478
1479
  return buildWizardUrl(baseUrl, "new-subscription", {
1479
1480
  service: serviceCode,
1480
- redirect: options?.redirect
1481
+ redirect: options?.redirect,
1482
+ org: options?.organizationId
1481
1483
  });
1482
1484
  }
1483
1485
  function redirectToSubscribe(options) {
@@ -1504,7 +1506,8 @@ function createContractWizardMethods(deps) {
1504
1506
  function getResubscribeUrl(options) {
1505
1507
  return buildWizardUrl(baseUrl, "resubscribe", {
1506
1508
  service: options?.serviceCode ?? serviceCode,
1507
- redirect: options?.redirect
1509
+ redirect: options?.redirect,
1510
+ org: options?.organizationId
1508
1511
  });
1509
1512
  }
1510
1513
  function redirectToResubscribe(options) {
@@ -76,6 +76,14 @@ interface FFIDSubscriptionDetail {
76
76
  trialEnd: string | null;
77
77
  canceledAt: string | null;
78
78
  cancelAtPeriodEnd: boolean;
79
+ /** Pending period-end downgrade info (null = no scheduled downgrade) */
80
+ pendingDowngrade: {
81
+ planCode: string;
82
+ planName: string;
83
+ billingInterval: FFIDBillingInterval;
84
+ scheduledAt: string;
85
+ requestedAt: string;
86
+ } | null;
79
87
  createdAt: string;
80
88
  }
81
89
  /** Parameters for subscribing to a plan */
@@ -152,6 +160,12 @@ interface FFIDChangePlanResponse {
152
160
  status: FFIDSubscriptionStatus;
153
161
  isUpgrade: boolean;
154
162
  };
163
+ /** Present when downgrade is scheduled for period end instead of immediate */
164
+ pendingDowngrade?: {
165
+ planCode: string;
166
+ planName: string;
167
+ scheduledAt: string;
168
+ };
155
169
  }
156
170
  /** Parameters for canceling subscription */
157
171
  interface FFIDCancelSubscriptionParams {
@@ -588,6 +602,8 @@ type FFIDPasswordResetConfirmResponse = FFIDPasswordResetResponse;
588
602
  interface ContractWizardSubscribeOptions {
589
603
  /** URL to redirect back to after completion */
590
604
  redirect?: string;
605
+ /** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
606
+ organizationId?: string;
591
607
  }
592
608
  /** Options for the resubscribe wizard flow */
593
609
  interface ContractWizardResubscribeOptions {
@@ -595,11 +611,15 @@ interface ContractWizardResubscribeOptions {
595
611
  serviceCode?: string;
596
612
  /** URL to redirect back to after completion */
597
613
  redirect?: string;
614
+ /** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
615
+ organizationId?: string;
598
616
  }
599
617
  /** Options for wizard flows that operate on an existing subscription */
600
618
  interface ContractWizardSubscriptionOptions {
601
619
  /** URL to redirect back to after completion */
602
620
  redirect?: string;
621
+ /** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
622
+ organizationId?: string;
603
623
  }
604
624
 
605
625
  /** Redirect and URL generation - redirectToLogin / redirectToAuthorize / redirectToLogout / getLoginUrl / getSignupUrl / getLogoutUrl */
@@ -76,6 +76,14 @@ interface FFIDSubscriptionDetail {
76
76
  trialEnd: string | null;
77
77
  canceledAt: string | null;
78
78
  cancelAtPeriodEnd: boolean;
79
+ /** Pending period-end downgrade info (null = no scheduled downgrade) */
80
+ pendingDowngrade: {
81
+ planCode: string;
82
+ planName: string;
83
+ billingInterval: FFIDBillingInterval;
84
+ scheduledAt: string;
85
+ requestedAt: string;
86
+ } | null;
79
87
  createdAt: string;
80
88
  }
81
89
  /** Parameters for subscribing to a plan */
@@ -152,6 +160,12 @@ interface FFIDChangePlanResponse {
152
160
  status: FFIDSubscriptionStatus;
153
161
  isUpgrade: boolean;
154
162
  };
163
+ /** Present when downgrade is scheduled for period end instead of immediate */
164
+ pendingDowngrade?: {
165
+ planCode: string;
166
+ planName: string;
167
+ scheduledAt: string;
168
+ };
155
169
  }
156
170
  /** Parameters for canceling subscription */
157
171
  interface FFIDCancelSubscriptionParams {
@@ -588,6 +602,8 @@ type FFIDPasswordResetConfirmResponse = FFIDPasswordResetResponse;
588
602
  interface ContractWizardSubscribeOptions {
589
603
  /** URL to redirect back to after completion */
590
604
  redirect?: string;
605
+ /** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
606
+ organizationId?: string;
591
607
  }
592
608
  /** Options for the resubscribe wizard flow */
593
609
  interface ContractWizardResubscribeOptions {
@@ -595,11 +611,15 @@ interface ContractWizardResubscribeOptions {
595
611
  serviceCode?: string;
596
612
  /** URL to redirect back to after completion */
597
613
  redirect?: string;
614
+ /** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
615
+ organizationId?: string;
598
616
  }
599
617
  /** Options for wizard flows that operate on an existing subscription */
600
618
  interface ContractWizardSubscriptionOptions {
601
619
  /** URL to redirect back to after completion */
602
620
  redirect?: string;
621
+ /** Organization ID — passed as ?org= so middleware auto-sets the org cookie */
622
+ organizationId?: string;
603
623
  }
604
624
 
605
625
  /** Redirect and URL generation - redirectToLogin / redirectToAuthorize / redirectToLogout / getLoginUrl / getSignupUrl / getLogoutUrl */
@@ -595,7 +595,7 @@ function createMembersMethods(deps) {
595
595
  }
596
596
 
597
597
  // src/client/version-check.ts
598
- var SDK_VERSION = "2.2.0";
598
+ var SDK_VERSION = "2.4.0";
599
599
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
600
600
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
601
601
  function sdkHeaders() {
@@ -1470,13 +1470,15 @@ function createContractWizardMethods(deps) {
1470
1470
  return buildWizardUrl(baseUrl, flow, {
1471
1471
  service: serviceCode,
1472
1472
  subscription: subscriptionId,
1473
- redirect: options?.redirect
1473
+ redirect: options?.redirect,
1474
+ org: options?.organizationId
1474
1475
  });
1475
1476
  }
1476
1477
  function getSubscribeUrl(options) {
1477
1478
  return buildWizardUrl(baseUrl, "new-subscription", {
1478
1479
  service: serviceCode,
1479
- redirect: options?.redirect
1480
+ redirect: options?.redirect,
1481
+ org: options?.organizationId
1480
1482
  });
1481
1483
  }
1482
1484
  function redirectToSubscribe(options) {
@@ -1503,7 +1505,8 @@ function createContractWizardMethods(deps) {
1503
1505
  function getResubscribeUrl(options) {
1504
1506
  return buildWizardUrl(baseUrl, "resubscribe", {
1505
1507
  service: options?.serviceCode ?? serviceCode,
1506
- redirect: options?.redirect
1508
+ redirect: options?.redirect,
1509
+ org: options?.organizationId
1507
1510
  });
1508
1511
  }
1509
1512
  function redirectToResubscribe(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feelflow/ffid-sdk",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "FeelFlow ID Platform SDK for React/Next.js applications",
5
5
  "keywords": [
6
6
  "feelflow",