@feelflow/ffid-sdk 4.3.0 → 5.0.1

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,7 @@
1
1
  'use strict';
2
2
 
3
- var chunk5MO7G2JW_cjs = require('./chunk-5MO7G2JW.cjs');
3
+ var chunk223MPEBU_cjs = require('./chunk-223MPEBU.cjs');
4
+ var chunkIIC2LBD2_cjs = require('./chunk-IIC2LBD2.cjs');
4
5
  var react = require('react');
5
6
  var jsxRuntime = require('react/jsx-runtime');
6
7
 
@@ -53,8 +54,8 @@ function defaultRedirect(url) {
53
54
  }
54
55
  function useRequireActiveSubscription(options) {
55
56
  const { redirectTo, allowGrace = true, onRedirect } = options;
56
- const { isLoading, error } = chunk5MO7G2JW_cjs.useFFIDContext();
57
- const { effectiveStatus, isBlocked, isGrace } = chunk5MO7G2JW_cjs.useSubscription();
57
+ const { isLoading, error } = chunk223MPEBU_cjs.useFFIDContext();
58
+ const { effectiveStatus, isBlocked, isGrace } = chunk223MPEBU_cjs.useSubscription();
58
59
  const hasFetchError = error !== null && effectiveStatus === null;
59
60
  const shouldRedirect = !isLoading && !hasFetchError && (isBlocked || !allowGrace && isGrace || effectiveStatus === null);
60
61
  react.useEffect(() => {
@@ -75,7 +76,7 @@ function useRequireActiveSubscription(options) {
75
76
  }
76
77
  function withFFIDAuth(Component, options = {}) {
77
78
  const WrappedComponent = (props) => {
78
- const { isLoading, isAuthenticated, login } = chunk5MO7G2JW_cjs.useFFIDContext();
79
+ const { isLoading, isAuthenticated, login } = chunk223MPEBU_cjs.useFFIDContext();
79
80
  const hasRedirected = react.useRef(false);
80
81
  react.useEffect(() => {
81
82
  if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
@@ -104,115 +105,179 @@ var FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS = 1e3;
104
105
 
105
106
  Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
106
107
  enumerable: true,
107
- get: function () { return chunk5MO7G2JW_cjs.DEFAULT_API_BASE_URL; }
108
+ get: function () { return chunk223MPEBU_cjs.DEFAULT_API_BASE_URL; }
108
109
  });
109
110
  Object.defineProperty(exports, "DEFAULT_OAUTH_SCOPES", {
110
111
  enumerable: true,
111
- get: function () { return chunk5MO7G2JW_cjs.DEFAULT_OAUTH_SCOPES; }
112
+ get: function () { return chunk223MPEBU_cjs.DEFAULT_OAUTH_SCOPES; }
112
113
  });
113
114
  Object.defineProperty(exports, "FFIDAnnouncementBadge", {
114
115
  enumerable: true,
115
- get: function () { return chunk5MO7G2JW_cjs.FFIDAnnouncementBadge; }
116
+ get: function () { return chunk223MPEBU_cjs.FFIDAnnouncementBadge; }
116
117
  });
117
118
  Object.defineProperty(exports, "FFIDAnnouncementList", {
118
119
  enumerable: true,
119
- get: function () { return chunk5MO7G2JW_cjs.FFIDAnnouncementList; }
120
+ get: function () { return chunk223MPEBU_cjs.FFIDAnnouncementList; }
120
121
  });
121
122
  Object.defineProperty(exports, "FFIDInquiryForm", {
122
123
  enumerable: true,
123
- get: function () { return chunk5MO7G2JW_cjs.FFIDInquiryForm; }
124
+ get: function () { return chunk223MPEBU_cjs.FFIDInquiryForm; }
124
125
  });
125
126
  Object.defineProperty(exports, "FFIDLoginButton", {
126
127
  enumerable: true,
127
- get: function () { return chunk5MO7G2JW_cjs.FFIDLoginButton; }
128
+ get: function () { return chunk223MPEBU_cjs.FFIDLoginButton; }
128
129
  });
129
130
  Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
130
131
  enumerable: true,
131
- get: function () { return chunk5MO7G2JW_cjs.FFIDOrganizationSwitcher; }
132
+ get: function () { return chunk223MPEBU_cjs.FFIDOrganizationSwitcher; }
132
133
  });
133
134
  Object.defineProperty(exports, "FFIDProvider", {
134
135
  enumerable: true,
135
- get: function () { return chunk5MO7G2JW_cjs.FFIDProvider; }
136
+ get: function () { return chunk223MPEBU_cjs.FFIDProvider; }
136
137
  });
137
138
  Object.defineProperty(exports, "FFIDSDKError", {
138
139
  enumerable: true,
139
- get: function () { return chunk5MO7G2JW_cjs.FFIDSDKError; }
140
+ get: function () { return chunk223MPEBU_cjs.FFIDSDKError; }
140
141
  });
141
142
  Object.defineProperty(exports, "FFIDSubscriptionBadge", {
142
143
  enumerable: true,
143
- get: function () { return chunk5MO7G2JW_cjs.FFIDSubscriptionBadge; }
144
+ get: function () { return chunk223MPEBU_cjs.FFIDSubscriptionBadge; }
144
145
  });
145
146
  Object.defineProperty(exports, "FFIDUserMenu", {
146
147
  enumerable: true,
147
- get: function () { return chunk5MO7G2JW_cjs.FFIDUserMenu; }
148
+ get: function () { return chunk223MPEBU_cjs.FFIDUserMenu; }
148
149
  });
149
150
  Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
150
151
  enumerable: true,
151
- get: function () { return chunk5MO7G2JW_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
152
+ get: function () { return chunk223MPEBU_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
152
153
  });
153
154
  Object.defineProperty(exports, "FFID_INQUIRY_CATEGORIES", {
154
155
  enumerable: true,
155
- get: function () { return chunk5MO7G2JW_cjs.FFID_INQUIRY_CATEGORIES; }
156
+ get: function () { return chunk223MPEBU_cjs.FFID_INQUIRY_CATEGORIES; }
156
157
  });
157
158
  Object.defineProperty(exports, "FFID_INQUIRY_CATEGORIES_SITE_2026", {
158
159
  enumerable: true,
159
- get: function () { return chunk5MO7G2JW_cjs.FFID_INQUIRY_CATEGORIES_SITE_2026; }
160
+ get: function () { return chunk223MPEBU_cjs.FFID_INQUIRY_CATEGORIES_SITE_2026; }
160
161
  });
161
162
  Object.defineProperty(exports, "computeEffectiveStatusFromSession", {
162
163
  enumerable: true,
163
- get: function () { return chunk5MO7G2JW_cjs.computeEffectiveStatusFromSession; }
164
+ get: function () { return chunk223MPEBU_cjs.computeEffectiveStatusFromSession; }
164
165
  });
165
166
  Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
166
167
  enumerable: true,
167
- get: function () { return chunk5MO7G2JW_cjs.createFFIDAnnouncementsClient; }
168
+ get: function () { return chunk223MPEBU_cjs.createFFIDAnnouncementsClient; }
168
169
  });
169
170
  Object.defineProperty(exports, "createFFIDClient", {
170
171
  enumerable: true,
171
- get: function () { return chunk5MO7G2JW_cjs.createFFIDClient; }
172
+ get: function () { return chunk223MPEBU_cjs.createFFIDClient; }
172
173
  });
173
174
  Object.defineProperty(exports, "createTokenStore", {
174
175
  enumerable: true,
175
- get: function () { return chunk5MO7G2JW_cjs.createTokenStore; }
176
+ get: function () { return chunk223MPEBU_cjs.createTokenStore; }
176
177
  });
177
178
  Object.defineProperty(exports, "generateCodeChallenge", {
178
179
  enumerable: true,
179
- get: function () { return chunk5MO7G2JW_cjs.generateCodeChallenge; }
180
+ get: function () { return chunk223MPEBU_cjs.generateCodeChallenge; }
180
181
  });
181
182
  Object.defineProperty(exports, "generateCodeVerifier", {
182
183
  enumerable: true,
183
- get: function () { return chunk5MO7G2JW_cjs.generateCodeVerifier; }
184
+ get: function () { return chunk223MPEBU_cjs.generateCodeVerifier; }
184
185
  });
185
186
  Object.defineProperty(exports, "isFFIDInquiryCategorySite2026", {
186
187
  enumerable: true,
187
- get: function () { return chunk5MO7G2JW_cjs.isFFIDInquiryCategorySite2026; }
188
+ get: function () { return chunk223MPEBU_cjs.isFFIDInquiryCategorySite2026; }
188
189
  });
189
190
  Object.defineProperty(exports, "normalizeRedirectUri", {
190
191
  enumerable: true,
191
- get: function () { return chunk5MO7G2JW_cjs.normalizeRedirectUri; }
192
+ get: function () { return chunk223MPEBU_cjs.normalizeRedirectUri; }
192
193
  });
193
194
  Object.defineProperty(exports, "retrieveCodeVerifier", {
194
195
  enumerable: true,
195
- get: function () { return chunk5MO7G2JW_cjs.retrieveCodeVerifier; }
196
+ get: function () { return chunk223MPEBU_cjs.retrieveCodeVerifier; }
196
197
  });
197
198
  Object.defineProperty(exports, "storeCodeVerifier", {
198
199
  enumerable: true,
199
- get: function () { return chunk5MO7G2JW_cjs.storeCodeVerifier; }
200
+ get: function () { return chunk223MPEBU_cjs.storeCodeVerifier; }
200
201
  });
201
202
  Object.defineProperty(exports, "useFFID", {
202
203
  enumerable: true,
203
- get: function () { return chunk5MO7G2JW_cjs.useFFID; }
204
+ get: function () { return chunk223MPEBU_cjs.useFFID; }
204
205
  });
205
206
  Object.defineProperty(exports, "useFFIDAnnouncements", {
206
207
  enumerable: true,
207
- get: function () { return chunk5MO7G2JW_cjs.useFFIDAnnouncements; }
208
+ get: function () { return chunk223MPEBU_cjs.useFFIDAnnouncements; }
208
209
  });
209
210
  Object.defineProperty(exports, "useSubscription", {
210
211
  enumerable: true,
211
- get: function () { return chunk5MO7G2JW_cjs.useSubscription; }
212
+ get: function () { return chunk223MPEBU_cjs.useSubscription; }
212
213
  });
213
214
  Object.defineProperty(exports, "withSubscription", {
214
215
  enumerable: true,
215
- get: function () { return chunk5MO7G2JW_cjs.withSubscription; }
216
+ get: function () { return chunk223MPEBU_cjs.withSubscription; }
217
+ });
218
+ Object.defineProperty(exports, "ALL_DENIED_EXCEPT_NECESSARY", {
219
+ enumerable: true,
220
+ get: function () { return chunkIIC2LBD2_cjs.ALL_DENIED_EXCEPT_NECESSARY; }
221
+ });
222
+ Object.defineProperty(exports, "CONSENT_COOKIE_NAME", {
223
+ enumerable: true,
224
+ get: function () { return chunkIIC2LBD2_cjs.CONSENT_COOKIE_NAME; }
225
+ });
226
+ Object.defineProperty(exports, "COOKIE_VERSION", {
227
+ enumerable: true,
228
+ get: function () { return chunkIIC2LBD2_cjs.COOKIE_VERSION; }
229
+ });
230
+ Object.defineProperty(exports, "DEFAULT_CONSENT_ERROR_MESSAGES", {
231
+ enumerable: true,
232
+ get: function () { return chunkIIC2LBD2_cjs.DEFAULT_CONSENT_ERROR_MESSAGES; }
233
+ });
234
+ Object.defineProperty(exports, "FFIDAnalyticsProvider", {
235
+ enumerable: true,
236
+ get: function () { return chunkIIC2LBD2_cjs.FFIDAnalyticsProvider; }
237
+ });
238
+ Object.defineProperty(exports, "FFIDConsentError", {
239
+ enumerable: true,
240
+ get: function () { return chunkIIC2LBD2_cjs.FFIDConsentError; }
241
+ });
242
+ Object.defineProperty(exports, "FFIDCookieBanner", {
243
+ enumerable: true,
244
+ get: function () { return chunkIIC2LBD2_cjs.FFIDCookieBanner; }
245
+ });
246
+ Object.defineProperty(exports, "FFIDCookieLink", {
247
+ enumerable: true,
248
+ get: function () { return chunkIIC2LBD2_cjs.FFIDCookieLink; }
249
+ });
250
+ Object.defineProperty(exports, "FFIDCookieSettings", {
251
+ enumerable: true,
252
+ get: function () { return chunkIIC2LBD2_cjs.FFIDCookieSettings; }
253
+ });
254
+ Object.defineProperty(exports, "FFID_CONSENT_ERROR_CODES", {
255
+ enumerable: true,
256
+ get: function () { return chunkIIC2LBD2_cjs.FFID_CONSENT_ERROR_CODES; }
257
+ });
258
+ Object.defineProperty(exports, "decodeConsentCookie", {
259
+ enumerable: true,
260
+ get: function () { return chunkIIC2LBD2_cjs.decodeConsentCookie; }
261
+ });
262
+ Object.defineProperty(exports, "encodeConsentCookie", {
263
+ enumerable: true,
264
+ get: function () { return chunkIIC2LBD2_cjs.encodeConsentCookie; }
265
+ });
266
+ Object.defineProperty(exports, "readConsentCookie", {
267
+ enumerable: true,
268
+ get: function () { return chunkIIC2LBD2_cjs.readConsentCookie; }
269
+ });
270
+ Object.defineProperty(exports, "useFFIDConsent", {
271
+ enumerable: true,
272
+ get: function () { return chunkIIC2LBD2_cjs.useFFIDConsent; }
273
+ });
274
+ Object.defineProperty(exports, "useFFIDConsentPreferences", {
275
+ enumerable: true,
276
+ get: function () { return chunkIIC2LBD2_cjs.useFFIDConsentPreferences; }
277
+ });
278
+ Object.defineProperty(exports, "writeConsentCookie", {
279
+ enumerable: true,
280
+ get: function () { return chunkIIC2LBD2_cjs.writeConsentCookie; }
216
281
  });
217
282
  exports.FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS = FFID_NEWSLETTER_DISPATCH_MAX_RECIPIENTS;
218
283
  exports.FFID_NEWSLETTER_TYPES = FFID_NEWSLETTER_TYPES;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,9 @@
1
1
  import { F as FFIDSubscriptionStatus, a as FFIDConfig, b as FFIDApiResponse, c as FFIDSessionResponse, d as FFIDRedirectResult, e as FFIDError, f as FFIDSubscriptionCheckResponse, g as FFIDCheckServiceAccessParams, h as FFIDServiceAccessDecision, i as FFIDListMembersResponse, j as FFIDAddMemberParams, k as FFIDAddMemberResponse, l as FFIDAddMemberRequest, m as FFIDMemberRole, n as FFIDUpdateMemberRoleResponse, o as FFIDRemoveMemberResponse, p as FFIDProfileCallOptions, q as FFIDUserProfile, r as FFIDUpdateUserProfileRequest, s as FFIDAnalyticsConfig, t as FFIDCreateCheckoutParams, u as FFIDCheckoutSessionResponse, v as FFIDCreatePortalParams, w as FFIDPortalSessionResponse, x as FFIDVerifyAccessTokenOptions, y as FFIDOAuthUserInfo, z as FFIDInquiryCreateParams, A as FFIDInquiryCreateResponse, B as FFIDAuthMode, C as FFIDLogger, D as FFIDCacheAdapter, E as FFIDUser, G as FFIDOrganization, H as FFIDSubscription, I as FFIDSubscriptionContextValue, J as EffectiveSubscriptionStatus, K as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, M as FFIDAnnouncementsApiResponse, N as AnnouncementListResponse, O as FFIDAnnouncementsLogger } from './index-CInGR4I9.cjs';
2
2
  export { P as Announcement, Q as AnnouncementStatus, R as AnnouncementType, S as FFIDAnnouncementBadge, T as FFIDAnnouncementList, U as FFIDAnnouncementsError, V as FFIDAnnouncementsErrorCode, W as FFIDAnnouncementsServerResponse, X as FFIDAssignableMemberRole, Y as FFIDCacheConfig, Z as FFIDContextValue, _ as FFIDInquiryCategory, $ as FFIDInquiryCategorySite2026, a0 as FFIDInquiryForm, a1 as FFIDInquiryFormCategoryItem, a2 as FFIDInquiryFormClassNames, a3 as FFIDInquiryFormLegalLayout, a4 as FFIDInquiryFormOrganization, a5 as FFIDInquiryFormPlaceholderContext, a6 as FFIDInquiryFormPrefill, a7 as FFIDInquiryFormProps, a8 as FFIDInquiryFormSubmitData, a9 as FFIDInquiryFormSubmitResult, aa as FFIDJwtClaims, ab as FFIDLoginButton, ac as FFIDMemberStatus, ad as FFIDOAuthTokenResponse, ae as FFIDOAuthUserInfoMemberRole, af as FFIDOAuthUserInfoSubscription, ag as FFIDOrganizationMember, ah as FFIDOrganizationSwitcher, ai as FFIDRedirectErrorCode, aj as FFIDSeatModel, ak as FFIDServiceAccessDenialReason, al as FFIDServiceAccessFailPolicy, am as FFIDSubscriptionBadge, an as FFIDTokenIntrospectionResponse, ao as FFIDUserMenu, ap as FFID_INQUIRY_CATEGORIES, aq as FFID_INQUIRY_CATEGORIES_SITE_2026, ar as UseFFIDAnnouncementsOptions, as as UseFFIDAnnouncementsReturn, at as isFFIDInquiryCategorySite2026, au as useFFIDAnnouncements } from './index-CInGR4I9.cjs';
3
+ export { A as ALL_DENIED_EXCEPT_NECESSARY, i as CONSENT_COOKIE_NAME, k as COOKIE_VERSION, D as DEFAULT_CONSENT_ERROR_MESSAGES, n as FFIDAnalyticsProvider, o as FFIDAnalyticsProviderProps, c as FFIDConsentCategories, q as FFIDConsentCategoryCode, e as FFIDConsentCategoryMetadata, v as FFIDConsentError, w as FFIDConsentErrorCode, x as FFIDConsentMergeStrategy, z as FFIDConsentMergeWarning, F as FFIDConsentResult, E as FFIDConsentSource, a as FFIDConsentState, d as FFIDConsentSyncResult, K as FFIDCookieBanner, L as FFIDCookieBannerClassNames, M as FFIDCookieBannerProps, N as FFIDCookieLink, O as FFIDCookieLinkProps, f as FFIDCookiePolicy, R as FFIDCookieSettings, S as FFIDCookieSettingsClassNames, T as FFIDCookieSettingsProps, Y as FFID_CONSENT_ERROR_CODES, ac as UseFFIDConsentPreferencesReturn, ad as UseFFIDConsentReturn, ag as decodeConsentCookie, ai as encodeConsentCookie, ak as readConsentCookie, am as useFFIDConsent, an as useFFIDConsentPreferences, ao as writeConsentCookie } from './FFIDCookieLink-VYI2cSAB.cjs';
3
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
5
  import { ReactNode, ComponentType, FC } from 'react';
6
+ import 'zod';
5
7
 
6
8
  /**
7
9
  * FFID SDK Shared Constants
package/dist/index.d.ts CHANGED
@@ -1,7 +1,9 @@
1
1
  import { F as FFIDSubscriptionStatus, a as FFIDConfig, b as FFIDApiResponse, c as FFIDSessionResponse, d as FFIDRedirectResult, e as FFIDError, f as FFIDSubscriptionCheckResponse, g as FFIDCheckServiceAccessParams, h as FFIDServiceAccessDecision, i as FFIDListMembersResponse, j as FFIDAddMemberParams, k as FFIDAddMemberResponse, l as FFIDAddMemberRequest, m as FFIDMemberRole, n as FFIDUpdateMemberRoleResponse, o as FFIDRemoveMemberResponse, p as FFIDProfileCallOptions, q as FFIDUserProfile, r as FFIDUpdateUserProfileRequest, s as FFIDAnalyticsConfig, t as FFIDCreateCheckoutParams, u as FFIDCheckoutSessionResponse, v as FFIDCreatePortalParams, w as FFIDPortalSessionResponse, x as FFIDVerifyAccessTokenOptions, y as FFIDOAuthUserInfo, z as FFIDInquiryCreateParams, A as FFIDInquiryCreateResponse, B as FFIDAuthMode, C as FFIDLogger, D as FFIDCacheAdapter, E as FFIDUser, G as FFIDOrganization, H as FFIDSubscription, I as FFIDSubscriptionContextValue, J as EffectiveSubscriptionStatus, K as FFIDAnnouncementsClientConfig, L as ListAnnouncementsOptions, M as FFIDAnnouncementsApiResponse, N as AnnouncementListResponse, O as FFIDAnnouncementsLogger } from './index-CInGR4I9.js';
2
2
  export { P as Announcement, Q as AnnouncementStatus, R as AnnouncementType, S as FFIDAnnouncementBadge, T as FFIDAnnouncementList, U as FFIDAnnouncementsError, V as FFIDAnnouncementsErrorCode, W as FFIDAnnouncementsServerResponse, X as FFIDAssignableMemberRole, Y as FFIDCacheConfig, Z as FFIDContextValue, _ as FFIDInquiryCategory, $ as FFIDInquiryCategorySite2026, a0 as FFIDInquiryForm, a1 as FFIDInquiryFormCategoryItem, a2 as FFIDInquiryFormClassNames, a3 as FFIDInquiryFormLegalLayout, a4 as FFIDInquiryFormOrganization, a5 as FFIDInquiryFormPlaceholderContext, a6 as FFIDInquiryFormPrefill, a7 as FFIDInquiryFormProps, a8 as FFIDInquiryFormSubmitData, a9 as FFIDInquiryFormSubmitResult, aa as FFIDJwtClaims, ab as FFIDLoginButton, ac as FFIDMemberStatus, ad as FFIDOAuthTokenResponse, ae as FFIDOAuthUserInfoMemberRole, af as FFIDOAuthUserInfoSubscription, ag as FFIDOrganizationMember, ah as FFIDOrganizationSwitcher, ai as FFIDRedirectErrorCode, aj as FFIDSeatModel, ak as FFIDServiceAccessDenialReason, al as FFIDServiceAccessFailPolicy, am as FFIDSubscriptionBadge, an as FFIDTokenIntrospectionResponse, ao as FFIDUserMenu, ap as FFID_INQUIRY_CATEGORIES, aq as FFID_INQUIRY_CATEGORIES_SITE_2026, ar as UseFFIDAnnouncementsOptions, as as UseFFIDAnnouncementsReturn, at as isFFIDInquiryCategorySite2026, au as useFFIDAnnouncements } from './index-CInGR4I9.js';
3
+ export { A as ALL_DENIED_EXCEPT_NECESSARY, i as CONSENT_COOKIE_NAME, k as COOKIE_VERSION, D as DEFAULT_CONSENT_ERROR_MESSAGES, n as FFIDAnalyticsProvider, o as FFIDAnalyticsProviderProps, c as FFIDConsentCategories, q as FFIDConsentCategoryCode, e as FFIDConsentCategoryMetadata, v as FFIDConsentError, w as FFIDConsentErrorCode, x as FFIDConsentMergeStrategy, z as FFIDConsentMergeWarning, F as FFIDConsentResult, E as FFIDConsentSource, a as FFIDConsentState, d as FFIDConsentSyncResult, K as FFIDCookieBanner, L as FFIDCookieBannerClassNames, M as FFIDCookieBannerProps, N as FFIDCookieLink, O as FFIDCookieLinkProps, f as FFIDCookiePolicy, R as FFIDCookieSettings, S as FFIDCookieSettingsClassNames, T as FFIDCookieSettingsProps, Y as FFID_CONSENT_ERROR_CODES, ac as UseFFIDConsentPreferencesReturn, ad as UseFFIDConsentReturn, ag as decodeConsentCookie, ai as encodeConsentCookie, ak as readConsentCookie, am as useFFIDConsent, an as useFFIDConsentPreferences, ao as writeConsentCookie } from './FFIDCookieLink-VYI2cSAB.js';
3
4
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
5
  import { ReactNode, ComponentType, FC } from 'react';
6
+ import 'zod';
5
7
 
6
8
  /**
7
9
  * FFID SDK Shared Constants
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
- import { useFFIDContext, useSubscription } from './chunk-35UOD62N.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-35UOD62N.js';
1
+ import { useFFIDContext, useSubscription } from './chunk-YOJJ433H.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-YOJJ433H.js';
3
+ export { ALL_DENIED_EXCEPT_NECESSARY, CONSENT_COOKIE_NAME, COOKIE_VERSION, DEFAULT_CONSENT_ERROR_MESSAGES, FFIDAnalyticsProvider, FFIDConsentError, FFIDCookieBanner, FFIDCookieLink, FFIDCookieSettings, FFID_CONSENT_ERROR_CODES, decodeConsentCookie, encodeConsentCookie, readConsentCookie, useFFIDConsent, useFFIDConsentPreferences, writeConsentCookie } from './chunk-VSHBWZXK.js';
3
4
  import { useEffect, useRef } from 'react';
4
5
  import { jsx, Fragment } from 'react/jsx-runtime';
5
6
 
@@ -835,7 +835,7 @@ function createProfileMethods(deps) {
835
835
  }
836
836
 
837
837
  // src/client/version-check.ts
838
- var SDK_VERSION = "4.3.0";
838
+ var SDK_VERSION = "5.0.1";
839
839
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
840
840
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
841
841
  function sdkHeaders() {
@@ -2760,6 +2760,97 @@ function createKVCacheAdapter(kv) {
2760
2760
  };
2761
2761
  }
2762
2762
 
2763
+ // src/consent/storage/encode.ts
2764
+ var COOKIE_VERSION = "v1";
2765
+ var ALL_DENIED_EXCEPT_NECESSARY = {
2766
+ necessary: true,
2767
+ functional: false,
2768
+ analytics: false,
2769
+ marketing: false
2770
+ };
2771
+ var CATEGORY_LETTERS = {
2772
+ n: "necessary",
2773
+ f: "functional",
2774
+ a: "analytics",
2775
+ m: "marketing"
2776
+ };
2777
+ var ORDERED_LETTERS = ["n", "f", "a", "m"];
2778
+ function encodeConsentCookie(cats) {
2779
+ const parts = ORDERED_LETTERS.map((letter) => {
2780
+ const key = CATEGORY_LETTERS[letter];
2781
+ return `${letter}${cats[key] ? "+" : "-"}`;
2782
+ });
2783
+ return `${COOKIE_VERSION}:${parts.join(",")}`;
2784
+ }
2785
+ function decodeConsentCookie(raw) {
2786
+ if (typeof raw !== "string" || raw.length === 0) {
2787
+ return { ...ALL_DENIED_EXCEPT_NECESSARY };
2788
+ }
2789
+ const colonIdx = raw.indexOf(":");
2790
+ if (colonIdx === -1) {
2791
+ return { ...ALL_DENIED_EXCEPT_NECESSARY };
2792
+ }
2793
+ const version = raw.slice(0, colonIdx);
2794
+ if (version !== COOKIE_VERSION) {
2795
+ return { ...ALL_DENIED_EXCEPT_NECESSARY };
2796
+ }
2797
+ const body = raw.slice(colonIdx + 1);
2798
+ if (body.length === 0) {
2799
+ return { ...ALL_DENIED_EXCEPT_NECESSARY };
2800
+ }
2801
+ const tokens = body.split(",");
2802
+ if (tokens.length !== ORDERED_LETTERS.length) {
2803
+ return { ...ALL_DENIED_EXCEPT_NECESSARY };
2804
+ }
2805
+ const seen = /* @__PURE__ */ new Set();
2806
+ const result = {};
2807
+ for (const token of tokens) {
2808
+ if (token.length !== 2) {
2809
+ return { ...ALL_DENIED_EXCEPT_NECESSARY };
2810
+ }
2811
+ const letter = token[0];
2812
+ const value = token[1];
2813
+ if (!CATEGORY_LETTERS[letter] || value !== "+" && value !== "-") {
2814
+ return { ...ALL_DENIED_EXCEPT_NECESSARY };
2815
+ }
2816
+ if (seen.has(letter)) {
2817
+ return { ...ALL_DENIED_EXCEPT_NECESSARY };
2818
+ }
2819
+ seen.add(letter);
2820
+ const key = CATEGORY_LETTERS[letter];
2821
+ result[key] = value === "+";
2822
+ }
2823
+ if (result.necessary !== true) {
2824
+ return { ...ALL_DENIED_EXCEPT_NECESSARY };
2825
+ }
2826
+ return {
2827
+ necessary: true,
2828
+ functional: result.functional ?? false,
2829
+ analytics: result.analytics ?? false,
2830
+ marketing: result.marketing ?? false
2831
+ };
2832
+ }
2833
+
2834
+ // src/consent/storage/cookie.ts
2835
+ var CONSENT_COOKIE_NAME = "ffid_consent";
2836
+
2837
+ // src/server/cookie-consent.ts
2838
+ function getFFIDConsentFromCookies(store) {
2839
+ if (!store) return { ...ALL_DENIED_EXCEPT_NECESSARY };
2840
+ const entry = store.get(CONSENT_COOKIE_NAME);
2841
+ if (!entry) return { ...ALL_DENIED_EXCEPT_NECESSARY };
2842
+ return decodeConsentCookie(entry.value);
2843
+ }
2844
+ function getFFIDConsentFromCookieHeader(cookieHeader) {
2845
+ if (typeof cookieHeader !== "string" || cookieHeader.length === 0) {
2846
+ return { ...ALL_DENIED_EXCEPT_NECESSARY };
2847
+ }
2848
+ const raw = cookieHeader.split(";").map((c) => c.trim()).find((c) => c.startsWith(`${CONSENT_COOKIE_NAME}=`));
2849
+ if (!raw) return { ...ALL_DENIED_EXCEPT_NECESSARY };
2850
+ const value = raw.slice(CONSENT_COOKIE_NAME.length + 1);
2851
+ return decodeConsentCookie(decodeURIComponent(value));
2852
+ }
2853
+
2763
2854
  Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
2764
2855
  enumerable: true,
2765
2856
  get: function () { return chunkMDHKSVLP_cjs.DEFAULT_API_BASE_URL; }
@@ -2768,8 +2859,15 @@ Object.defineProperty(exports, "DEFAULT_OAUTH_SCOPES", {
2768
2859
  enumerable: true,
2769
2860
  get: function () { return chunkMDHKSVLP_cjs.DEFAULT_OAUTH_SCOPES; }
2770
2861
  });
2862
+ exports.ALL_DENIED_EXCEPT_NECESSARY = ALL_DENIED_EXCEPT_NECESSARY;
2863
+ exports.CONSENT_COOKIE_NAME = CONSENT_COOKIE_NAME;
2864
+ exports.COOKIE_VERSION = COOKIE_VERSION;
2771
2865
  exports.createFFIDClient = createFFIDClient;
2772
2866
  exports.createKVCacheAdapter = createKVCacheAdapter;
2773
2867
  exports.createMemoryCacheAdapter = createMemoryCacheAdapter;
2774
2868
  exports.createTokenStore = createTokenStore;
2775
2869
  exports.createVerifyAccessToken = createVerifyAccessToken;
2870
+ exports.decodeConsentCookie = decodeConsentCookie;
2871
+ exports.encodeConsentCookie = encodeConsentCookie;
2872
+ exports.getFFIDConsentFromCookieHeader = getFFIDConsentFromCookieHeader;
2873
+ exports.getFFIDConsentFromCookies = getFFIDConsentFromCookies;
@@ -1,6 +1,7 @@
1
1
  import { F as FFIDLogger, a as FFIDError, b as FFIDCacheAdapter, c as FFIDVerifyAccessTokenOptions, d as FFIDApiResponse, e as FFIDOAuthUserInfo } from '../ffid-client-DgprK2ec.cjs';
2
2
  export { f as FFIDAddMemberParams, g as FFIDAddMemberRequest, h as FFIDAddMemberResponse, i as FFIDAssignableMemberRole, j as FFIDCacheConfig, k as FFIDClient, l as FFIDConfig, m as FFIDListMembersResponse, n as FFIDMemberRole, o as FFIDOrganization, p as FFIDOrganizationMember, q as FFIDOtpSendResponse, r as FFIDOtpVerifyResponse, s as FFIDPasswordResetConfirmResponse, t as FFIDPasswordResetResponse, u as FFIDPasswordResetVerifyResponse, v as FFIDProfileCallOptions, w as FFIDRemoveMemberResponse, x as FFIDResetSessionResponse, y as FFIDSubscription, z as FFIDUpdateMemberRoleResponse, A as FFIDUpdateUserProfileRequest, B as FFIDUser, C as FFIDUserProfile, T as TokenData, D as TokenStore, E as createFFIDClient, G as createTokenStore } from '../ffid-client-DgprK2ec.cjs';
3
3
  export { D as DEFAULT_API_BASE_URL, a as DEFAULT_OAUTH_SCOPES } from '../constants-D61jqRIO.cjs';
4
+ import { z } from 'zod';
4
5
  import '../types-5g_Bg6Ey.cjs';
5
6
 
6
7
  /** Token verification - verifyAccessToken() implementation */
@@ -57,4 +58,151 @@ interface KVNamespaceLike {
57
58
  */
58
59
  declare function createKVCacheAdapter(kv: KVNamespaceLike): FFIDCacheAdapter;
59
60
 
60
- export { FFIDCacheAdapter, FFIDOAuthUserInfo, FFIDVerifyAccessTokenOptions, type KVNamespaceLike, createKVCacheAdapter, createMemoryCacheAdapter, createVerifyAccessToken };
61
+ /**
62
+ * Cookie Consent — Zod schemas (canonical source of truth).
63
+ *
64
+ * Two layers of schemas live in this file:
65
+ *
66
+ * 1. **SDK consumer-facing schemas** (camelCase, discriminated union). These
67
+ * are what `useFFIDConsent()` / `useFFIDConsentPreferences()` surface to
68
+ * React code, and what spec §6.4 documents as the SDK public contract.
69
+ *
70
+ * 2. **Wire schemas** (`*WireSchema`, snake_case envelopes). These mirror the
71
+ * actual FFID API responses from `src/app/api/v1/ext/consent/*`, which
72
+ * follow the FFID server-side convention of snake_case body fields plus
73
+ * nullable `consent` envelopes. `consent-client.ts` parses responses with
74
+ * these and then maps to the consumer-facing types via `mappers.ts`.
75
+ *
76
+ * TypeScript types are derived in `types.ts` via `z.infer<>`.
77
+ * `as` casting is forbidden; cross-trust-boundary data must be safe-parsed.
78
+ *
79
+ * Refs: docs/02-design/COOKIE_CONSENT.md §6.4 + §5
80
+ */
81
+
82
+ declare const FFIDConsentCategoryCodeSchema: z.ZodEnum<{
83
+ necessary: "necessary";
84
+ functional: "functional";
85
+ analytics: "analytics";
86
+ marketing: "marketing";
87
+ }>;
88
+ /**
89
+ * Consent state per category. `necessary` is enforced to be `true` at both
90
+ * type and runtime levels (`z.literal(true)`). The DB CHECK constraint
91
+ * `ucc_necessary_always_true` mirrors this on the storage side.
92
+ */
93
+ declare const FFIDConsentCategoriesSchema: z.ZodObject<{
94
+ necessary: z.ZodLiteral<true>;
95
+ functional: z.ZodBoolean;
96
+ analytics: z.ZodBoolean;
97
+ marketing: z.ZodBoolean;
98
+ }, z.core.$strip>;
99
+
100
+ /**
101
+ * Cookie Consent — TypeScript types derived from Zod schemas.
102
+ *
103
+ * Always derive types via `z.infer<>`; never hand-roll TypeScript types that
104
+ * could drift from the canonical Zod schema. Refs: schemas.ts
105
+ */
106
+
107
+ type FFIDConsentCategoryCode = z.infer<typeof FFIDConsentCategoryCodeSchema>;
108
+ type FFIDConsentCategories = z.infer<typeof FFIDConsentCategoriesSchema>;
109
+
110
+ /**
111
+ * Server-side cookie consent helpers for RSC / Server Actions.
112
+ *
113
+ * These are intentionally cookie-only (no DB / API calls) so they remain
114
+ * cheap for every request. The semantics mirror `readConsentCookie()` on the
115
+ * client side — fail-safe to `ALL_DENIED_EXCEPT_NECESSARY` on any error.
116
+ *
117
+ * @example
118
+ * ```tsx
119
+ * // app/page.tsx (Next.js App Router)
120
+ * import { cookies } from 'next/headers'
121
+ * import { getFFIDConsentFromCookies } from '@feelflow/ffid-sdk/server'
122
+ *
123
+ * export default async function Page() {
124
+ * const cookieStore = await cookies()
125
+ * const consent = getFFIDConsentFromCookies(cookieStore)
126
+ * if (consent.analytics) { ... }
127
+ * }
128
+ * ```
129
+ *
130
+ * Refs: docs/02-design/COOKIE_CONSENT.md §6.6
131
+ */
132
+
133
+ /**
134
+ * Structural type that matches both `next/headers` `cookies()` return value
135
+ * (`RequestCookies`) and any custom store with a `get(name)` method that
136
+ * returns `{ value }` or `undefined`.
137
+ */
138
+ interface FFIDCookieStoreLike {
139
+ get(name: string): {
140
+ value: string;
141
+ } | undefined;
142
+ }
143
+ /**
144
+ * Read the FFID consent cookie from a Next.js `cookies()` store (or any
145
+ * compatible object) and decode it.
146
+ *
147
+ * Returns `ALL_DENIED_EXCEPT_NECESSARY` when the cookie is absent,
148
+ * malformed, or the store is undefined — `decodeConsentCookie` never throws.
149
+ */
150
+ declare function getFFIDConsentFromCookies(store: FFIDCookieStoreLike | undefined | null): FFIDConsentCategories;
151
+ /**
152
+ * Parse a raw cookie header string (`document.cookie` shape: "k=v; k2=v2").
153
+ * Useful when working with raw Request headers in Edge runtimes that don't
154
+ * expose a `cookies()` API.
155
+ */
156
+ declare function getFFIDConsentFromCookieHeader(cookieHeader: string | null | undefined): FFIDConsentCategories;
157
+
158
+ /**
159
+ * Cookie Consent codec — encode / decode the `ffid_consent` 1st-party cookie.
160
+ *
161
+ * Format: `v1:n+,f+,a-,m+`
162
+ * - `v1:` version prefix (forward-compat for v2+)
163
+ * - n=necessary, f=functional, a=analytics, m=marketing
164
+ * - `+` (granted) / `-` (denied)
165
+ *
166
+ * **Safe-parse contract**: `decodeConsentCookie` NEVER throws. Any malformed,
167
+ * truncated, future-version, or otherwise unparseable input returns
168
+ * `ALL_DENIED_EXCEPT_NECESSARY`. Callers are responsible for logging via
169
+ * `cookie_consent_parse_failed` errorId if needed.
170
+ *
171
+ * This codec is **byte-compatible** with the FFID server-side implementation
172
+ * (`src/lib/cookie-consent/codec.ts`). Both implementations must produce and
173
+ * accept the identical wire format — a roundtrip through either codec must
174
+ * yield the same bytes.
175
+ *
176
+ * Refs: docs/02-design/COOKIE_CONSENT.md §6.5
177
+ */
178
+
179
+ declare const COOKIE_VERSION: "v1";
180
+ declare const ALL_DENIED_EXCEPT_NECESSARY: FFIDConsentCategories;
181
+ declare function encodeConsentCookie(cats: FFIDConsentCategories): string;
182
+ /**
183
+ * Safely decode the consent cookie string.
184
+ * Returns `ALL_DENIED_EXCEPT_NECESSARY` on any failure (fail-safe).
185
+ */
186
+ declare function decodeConsentCookie(raw: string | null | undefined): FFIDConsentCategories;
187
+
188
+ /**
189
+ * Cookie Consent — browser cookie read/write with read-back verification.
190
+ *
191
+ * Spec §6.5:
192
+ * - Key: `ffid_consent`
193
+ * - 1st-party, SameSite=Lax, Secure (production only — localhost dev uses
194
+ * non-Secure)
195
+ * - TTL: 1 year
196
+ * - Write must be verified by read-back; failure -> caller surfaces
197
+ * `cookie_consent_cookie_write_failed` and falls back to sessionStorage.
198
+ *
199
+ * This module is SSR-safe: all functions become no-ops when `document` is
200
+ * unavailable (server-side rendering), so calling code does not need to
201
+ * `typeof window` check itself.
202
+ *
203
+ * Refs: docs/02-design/COOKIE_CONSENT.md §6.5
204
+ */
205
+
206
+ declare const CONSENT_COOKIE_NAME = "ffid_consent";
207
+
208
+ export { ALL_DENIED_EXCEPT_NECESSARY, CONSENT_COOKIE_NAME, COOKIE_VERSION, FFIDCacheAdapter, type FFIDConsentCategories, type FFIDConsentCategoryCode, type FFIDCookieStoreLike, FFIDOAuthUserInfo, FFIDVerifyAccessTokenOptions, type KVNamespaceLike, createKVCacheAdapter, createMemoryCacheAdapter, createVerifyAccessToken, decodeConsentCookie, encodeConsentCookie, getFFIDConsentFromCookieHeader, getFFIDConsentFromCookies };