@feelflow/ffid-sdk 5.25.0 → 5.28.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.
@@ -118,6 +118,16 @@ function normalizeEntitlements(raw) {
118
118
  return trimmed.length > 0 ? [trimmed] : [];
119
119
  });
120
120
  }
121
+ function normalizeSeatAssignmentClaim(raw, organizationId, subscriptionId) {
122
+ if (!raw || typeof raw !== "object") return null;
123
+ const { organization_id, subscription_id, status } = raw;
124
+ if (typeof organization_id !== "string" || typeof subscription_id !== "string" || typeof status !== "string" || !["active", "revoking", "revoked"].includes(status) || organization_id !== organizationId || subscription_id !== subscriptionId) return null;
125
+ return {
126
+ organizationId: organization_id,
127
+ subscriptionId: subscription_id,
128
+ status
129
+ };
130
+ }
121
131
  function normalizeUserinfo(raw) {
122
132
  const hasOrganizationId = hasOwnKey(raw, "organization_id");
123
133
  const hasOrganizationName = hasOwnKey(raw, "organization_name");
@@ -151,6 +161,11 @@ function normalizeUserinfo(raw) {
151
161
  organizationId: raw.subscription.organization_id ?? null,
152
162
  organizationName: hasOwnKey(raw.subscription, "organization_name") ? raw.subscription.organization_name ?? null : null,
153
163
  hasSeatAssignment: raw.subscription.has_seat_assignment ?? false,
164
+ seatAssignment: hasOwnKey(raw.subscription, "seat_assignment") ? normalizeSeatAssignmentClaim(
165
+ raw.subscription.seat_assignment,
166
+ raw.subscription.organization_id ?? null,
167
+ raw.subscription.subscription_id ?? null
168
+ ) : void 0,
154
169
  // #3464: legacy FFID (< this issue) omits the field on the wire.
155
170
  // The "unknown" axis is unused — no consumer differentiates "server
156
171
  // didn't tell us" from "definitely not scheduled" because the
@@ -449,6 +464,7 @@ function createVerifyAccessToken(deps) {
449
464
  organization_id: introspectResponse.subscription.organization_id,
450
465
  organization_name: introspectResponse.subscription.organization_name ?? null,
451
466
  has_seat_assignment: introspectResponse.subscription.has_seat_assignment ?? false,
467
+ ...Object.prototype.hasOwnProperty.call(introspectResponse.subscription, "seat_assignment") ? { seat_assignment: introspectResponse.subscription.seat_assignment } : {},
452
468
  // #4333: forward pack entitlement codes through the introspect →
453
469
  // userinfo normalization boundary. normalizeUserinfo guards the
454
470
  // value, so an older FFID that omits it degrades to `[]`.
@@ -823,6 +839,364 @@ function createSubscriptionMethods(deps) {
823
839
  };
824
840
  }
825
841
 
842
+ // src/types/published-catalog.ts
843
+ var FFID_CATALOG_ENVIRONMENTS = ["staging", "production"];
844
+ var FFID_CATALOG_PUBLICATION_STATUSES = [
845
+ "approved",
846
+ "superseded",
847
+ "revoking",
848
+ "revoked"
849
+ ];
850
+
851
+ // src/shared/catalog-hash.ts
852
+ var CATALOG_HASH_PATTERN = /^[0-9a-f]{64}$/;
853
+ var HEX_RADIX = 16;
854
+ var HEX_DIGITS_PER_BYTE = 2;
855
+ var FFIDCatalogHashError = class extends Error {
856
+ constructor(message) {
857
+ super(message);
858
+ this.name = "FFIDCatalogHashError";
859
+ }
860
+ };
861
+ function isPlainObject(value) {
862
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
863
+ return false;
864
+ }
865
+ const proto = Object.getPrototypeOf(value);
866
+ return proto === Object.prototype || proto === null;
867
+ }
868
+ function canonicalize(value, path) {
869
+ if (value === null) return "null";
870
+ switch (typeof value) {
871
+ case "string":
872
+ return JSON.stringify(value);
873
+ case "boolean":
874
+ return value ? "true" : "false";
875
+ case "number":
876
+ if (!Number.isFinite(value)) {
877
+ throw new FFIDCatalogHashError(
878
+ `canonicalize: non-finite number at ${path} \u2014 hashes require finite numbers`
879
+ );
880
+ }
881
+ return JSON.stringify(value);
882
+ case "undefined":
883
+ throw new FFIDCatalogHashError(
884
+ `canonicalize: undefined at ${path} \u2014 omit the key entirely or use null`
885
+ );
886
+ }
887
+ if (Array.isArray(value)) {
888
+ const items = value.map((item, index) => canonicalize(item, `${path}[${index}]`));
889
+ return `[${items.join(",")}]`;
890
+ }
891
+ if (isPlainObject(value)) {
892
+ const keys = Object.keys(value).sort();
893
+ const entries = [];
894
+ for (const key of keys) {
895
+ const child = value[key];
896
+ if (child === void 0) {
897
+ throw new FFIDCatalogHashError(
898
+ `canonicalize: undefined at ${path}.${key} \u2014 omit the key entirely or use null`
899
+ );
900
+ }
901
+ entries.push(`${JSON.stringify(key)}:${canonicalize(child, `${path}.${key}`)}`);
902
+ }
903
+ return `{${entries.join(",")}}`;
904
+ }
905
+ throw new FFIDCatalogHashError(
906
+ `canonicalize: unsupported value type (${typeof value}${typeof value === "object" ? `: ${Object.prototype.toString.call(value)}` : ""}) at ${path} \u2014 only JSON-plain values are hashable`
907
+ );
908
+ }
909
+ function canonicalizeCatalogValue(value) {
910
+ return canonicalize(value, "$");
911
+ }
912
+ async function sha256Hex(text) {
913
+ const subtle = globalThis.crypto?.subtle;
914
+ if (!subtle) {
915
+ throw new FFIDCatalogHashError(
916
+ "sha256Hex: Web Crypto (crypto.subtle) is not available in this runtime"
917
+ );
918
+ }
919
+ const digest = await subtle.digest("SHA-256", new TextEncoder().encode(text));
920
+ return Array.from(new Uint8Array(digest)).map((byte) => byte.toString(HEX_RADIX).padStart(HEX_DIGITS_PER_BYTE, "0")).join("");
921
+ }
922
+ async function hashCanonicalJson(value) {
923
+ return sha256Hex(canonicalizeCatalogValue(value));
924
+ }
925
+ function assertHashFormat(hash, field) {
926
+ if (!CATALOG_HASH_PATTERN.test(hash)) {
927
+ throw new FFIDCatalogHashError(
928
+ `${field} must be lowercase SHA-256 hex (64 chars), got: ${JSON.stringify(hash)}`
929
+ );
930
+ }
931
+ }
932
+ function normalizeStringSet(values) {
933
+ return [...new Set(values)].sort();
934
+ }
935
+ function compareByCodeUnits(a, b) {
936
+ if (a.code < b.code) return -1;
937
+ if (a.code > b.code) return 1;
938
+ return 0;
939
+ }
940
+ async function computePraxisCopyHash(presentation) {
941
+ return hashCanonicalJson(presentation);
942
+ }
943
+ async function computeFFIDCheckoutCopyHash(checkoutCopy) {
944
+ return hashCanonicalJson(checkoutCopy);
945
+ }
946
+ async function computeLegalDisclosureHash(canonicalText) {
947
+ return sha256Hex(canonicalText.replace(/\r\n?/g, "\n"));
948
+ }
949
+ async function computeTaxConfigurationHash(config) {
950
+ return hashCanonicalJson({
951
+ allowedCountries: normalizeStringSet(config.allowedCountries),
952
+ stripeTaxRegistrations: normalizeStringSet(config.stripeTaxRegistrations),
953
+ billingAddressRequired: config.billingAddressRequired,
954
+ planTaxCodes: config.planTaxCodes,
955
+ planTaxBehaviors: config.planTaxBehaviors
956
+ });
957
+ }
958
+ async function computePaymentConfigurationHash(config) {
959
+ return hashCanonicalJson({
960
+ environment: config.environment,
961
+ currency: config.currency,
962
+ paymentMethodTypes: normalizeStringSet(config.paymentMethodTypes),
963
+ dynamicPaymentMethodsEnabled: config.dynamicPaymentMethodsEnabled,
964
+ manualInvoiceAllowed: config.manualInvoiceAllowed,
965
+ customerBalanceAllowed: config.customerBalanceAllowed,
966
+ delayedPaymentMethodsAllowed: config.delayedPaymentMethodsAllowed,
967
+ customerInvoiceBalanceRequired: config.customerInvoiceBalanceRequired
968
+ });
969
+ }
970
+ async function computeScopeHash(input) {
971
+ assertHashFormat(input.praxisCopyHash, "praxisCopyHash");
972
+ assertHashFormat(input.ffidCheckoutCopyHash, "ffidCheckoutCopyHash");
973
+ assertHashFormat(input.legalDisclosureHash, "legalDisclosureHash");
974
+ assertHashFormat(input.taxConfigurationHash, "taxConfigurationHash");
975
+ assertHashFormat(input.paymentConfigurationHash, "paymentConfigurationHash");
976
+ const seenCodes = /* @__PURE__ */ new Set();
977
+ for (const plan of input.plans) {
978
+ if (seenCodes.has(plan.code)) {
979
+ throw new FFIDCatalogHashError(
980
+ `computeScopeHash: duplicate plan code ${JSON.stringify(plan.code)}`
981
+ );
982
+ }
983
+ seenCodes.add(plan.code);
984
+ }
985
+ const plans = [...input.plans].sort(compareByCodeUnits).map((plan) => ({
986
+ code: plan.code,
987
+ priceMonthly: plan.priceMonthly,
988
+ priceYearly: plan.priceYearly,
989
+ currency: plan.currency,
990
+ // Set semantics — interval order must not flip the digest.
991
+ billingIntervals: normalizeStringSet(plan.billingIntervals),
992
+ taxBehavior: plan.taxBehavior,
993
+ minSeats: plan.minSeats
994
+ }));
995
+ return hashCanonicalJson({
996
+ plans,
997
+ praxisCopyHash: input.praxisCopyHash,
998
+ ffidCheckoutCopyHash: input.ffidCheckoutCopyHash,
999
+ legalDisclosureHash: input.legalDisclosureHash,
1000
+ taxConfigurationHash: input.taxConfigurationHash,
1001
+ paymentConfigurationHash: input.paymentConfigurationHash
1002
+ });
1003
+ }
1004
+
1005
+ // src/client/catalog-methods.ts
1006
+ var EXT_CATALOG_ENDPOINT = "/api/v1/subscriptions/ext/catalog";
1007
+ var MALFORMED_CATALOG_CODE = "MALFORMED_PUBLISHED_CATALOG";
1008
+ var PUBLICATION_STATUSES = new Set(
1009
+ FFID_CATALOG_PUBLICATION_STATUSES
1010
+ );
1011
+ var CATALOG_ENVIRONMENTS = new Set(FFID_CATALOG_ENVIRONMENTS);
1012
+ var BILLING_INTERVALS = /* @__PURE__ */ new Set(["monthly", "yearly"]);
1013
+ var TAX_BEHAVIORS = /* @__PURE__ */ new Set(["inclusive", "exclusive"]);
1014
+ var PUBLICATION_HASH_FIELDS = [
1015
+ "praxisCopyHash",
1016
+ "ffidCheckoutCopyHash",
1017
+ "legalDisclosureHash",
1018
+ "taxConfigurationHash",
1019
+ "paymentConfigurationHash",
1020
+ "scopeHash"
1021
+ ];
1022
+ var PUBLICATION_REQUIRED_TIMESTAMP_FIELDS = ["reviewedAt", "effectiveAt"];
1023
+ var PUBLICATION_NULLABLE_TIMESTAMP_FIELDS = [
1024
+ "supersededAt",
1025
+ "sellThroughUntil",
1026
+ "revocationEffectiveAt"
1027
+ ];
1028
+ function malformed(detail) {
1029
+ return new FFIDSDKError(
1030
+ MALFORMED_CATALOG_CODE,
1031
+ `SDK: server returned malformed PublishedCatalog \u2014 ${detail}`
1032
+ );
1033
+ }
1034
+ function isNullableIsoString(value) {
1035
+ return value === null || typeof value === "string" && value.trim() !== "";
1036
+ }
1037
+ function isNonNegativeIntOrNull(value) {
1038
+ return value === null || typeof value === "number" && Number.isInteger(value) && value >= 0;
1039
+ }
1040
+ function validatePublishedPlan(plan, index) {
1041
+ if (plan === null || typeof plan !== "object") {
1042
+ throw malformed(`plans[${index}] must be an object`);
1043
+ }
1044
+ const record = plan;
1045
+ for (const key of Object.keys(record)) {
1046
+ if (/stripe/i.test(key)) {
1047
+ throw malformed(
1048
+ `plans[${index}] contains a Stripe identifier field (${JSON.stringify(key)}) \u2014 published catalogs must never expose Stripe IDs`
1049
+ );
1050
+ }
1051
+ }
1052
+ if (isBlankString(record.code)) {
1053
+ throw malformed(`plans[${index}].code must be a non-empty string`);
1054
+ }
1055
+ if (isBlankString(record.name)) {
1056
+ throw malformed(`plans[${index}].name must be a non-empty string`);
1057
+ }
1058
+ if (record.description !== null && typeof record.description !== "string") {
1059
+ throw malformed(`plans[${index}].description must be string or null`);
1060
+ }
1061
+ if (isBlankString(record.currency)) {
1062
+ throw malformed(`plans[${index}].currency must be a non-empty string`);
1063
+ }
1064
+ if (!isNonNegativeIntOrNull(record.priceMonthly)) {
1065
+ throw malformed(`plans[${index}].priceMonthly must be a non-negative integer or null`);
1066
+ }
1067
+ if (!isNonNegativeIntOrNull(record.priceYearly)) {
1068
+ throw malformed(`plans[${index}].priceYearly must be a non-negative integer or null`);
1069
+ }
1070
+ if (typeof record.taxBehavior !== "string" || !TAX_BEHAVIORS.has(record.taxBehavior)) {
1071
+ throw malformed(
1072
+ `plans[${index}].taxBehavior must be inclusive | exclusive (got ${JSON.stringify(record.taxBehavior)})`
1073
+ );
1074
+ }
1075
+ const intervals = record.billingIntervals;
1076
+ if (!Array.isArray(intervals) || intervals.length === 0 || intervals.some((interval) => typeof interval !== "string" || !BILLING_INTERVALS.has(interval))) {
1077
+ throw malformed(
1078
+ `plans[${index}].billingIntervals must be a non-empty array of monthly | yearly`
1079
+ );
1080
+ }
1081
+ if (intervals.includes("monthly") && record.priceMonthly === null) {
1082
+ throw malformed(`plans[${index}] offers monthly billing but priceMonthly is null`);
1083
+ }
1084
+ if (intervals.includes("yearly") && record.priceYearly === null) {
1085
+ throw malformed(`plans[${index}] offers yearly billing but priceYearly is null`);
1086
+ }
1087
+ if (typeof record.minSeats !== "number" || !Number.isInteger(record.minSeats) || record.minSeats < 1) {
1088
+ throw malformed(`plans[${index}].minSeats must be a positive integer`);
1089
+ }
1090
+ if (record.maxSeats !== null && (typeof record.maxSeats !== "number" || !Number.isInteger(record.maxSeats) || record.maxSeats < 1)) {
1091
+ throw malformed(`plans[${index}].maxSeats must be a positive integer or null`);
1092
+ }
1093
+ if (record.maxSeats !== null && record.maxSeats < record.minSeats) {
1094
+ throw malformed(`plans[${index}].maxSeats must be >= minSeats`);
1095
+ }
1096
+ if (typeof record.displayOrder !== "number" || !Number.isInteger(record.displayOrder)) {
1097
+ throw malformed(`plans[${index}].displayOrder must be an integer`);
1098
+ }
1099
+ }
1100
+ function validatePublishedCatalog(catalog) {
1101
+ if (catalog === null || typeof catalog !== "object") {
1102
+ throw malformed(
1103
+ `expected object, got ${catalog === null ? "null" : typeof catalog}`
1104
+ );
1105
+ }
1106
+ const c = catalog;
1107
+ const service = c.service;
1108
+ if (service === null || typeof service !== "object") {
1109
+ throw malformed("service must be an object");
1110
+ }
1111
+ const s = service;
1112
+ if (isBlankString(s.code)) {
1113
+ throw malformed("service.code must be a non-empty string");
1114
+ }
1115
+ if (isBlankString(s.name)) {
1116
+ throw malformed("service.name must be a non-empty string");
1117
+ }
1118
+ if (isBlankString(c.catalogVersion)) {
1119
+ throw malformed("catalogVersion must be a non-empty string");
1120
+ }
1121
+ const publication = c.publication;
1122
+ if (publication === null || typeof publication !== "object") {
1123
+ throw malformed("publication must be an object");
1124
+ }
1125
+ const p = publication;
1126
+ if (isBlankString(p.serviceCode)) {
1127
+ throw malformed("publication.serviceCode must be a non-empty string");
1128
+ }
1129
+ if (typeof p.environment !== "string" || !CATALOG_ENVIRONMENTS.has(p.environment)) {
1130
+ throw malformed(
1131
+ `publication.environment must be staging | production (got ${JSON.stringify(p.environment)})`
1132
+ );
1133
+ }
1134
+ if (p.catalogVersion !== c.catalogVersion) {
1135
+ throw malformed(
1136
+ `publication.catalogVersion (${JSON.stringify(p.catalogVersion)}) does not match top-level catalogVersion (${JSON.stringify(c.catalogVersion)})`
1137
+ );
1138
+ }
1139
+ if (typeof p.status !== "string" || !PUBLICATION_STATUSES.has(p.status)) {
1140
+ throw malformed(
1141
+ `publication.status must be one of approved | superseded | revoking | revoked (got ${JSON.stringify(p.status)})`
1142
+ );
1143
+ }
1144
+ for (const field of PUBLICATION_HASH_FIELDS) {
1145
+ const value = p[field];
1146
+ if (typeof value !== "string" || !CATALOG_HASH_PATTERN.test(value)) {
1147
+ throw malformed(`publication.${field} must be lowercase SHA-256 hex (64 chars)`);
1148
+ }
1149
+ }
1150
+ if (typeof p.salesEpoch !== "number" || !Number.isInteger(p.salesEpoch) || p.salesEpoch < 1) {
1151
+ throw malformed(
1152
+ `publication.salesEpoch must be a positive integer (got ${JSON.stringify(p.salesEpoch)})`
1153
+ );
1154
+ }
1155
+ if (isBlankString(p.approvalId)) {
1156
+ throw malformed("publication.approvalId must be a non-empty string");
1157
+ }
1158
+ for (const field of PUBLICATION_REQUIRED_TIMESTAMP_FIELDS) {
1159
+ if (isBlankString(p[field])) {
1160
+ throw malformed(`publication.${field} must be a non-empty ISO 8601 string`);
1161
+ }
1162
+ }
1163
+ for (const field of PUBLICATION_NULLABLE_TIMESTAMP_FIELDS) {
1164
+ if (!isNullableIsoString(p[field])) {
1165
+ throw malformed(`publication.${field} must be a non-empty ISO 8601 string or null`);
1166
+ }
1167
+ }
1168
+ if (!Array.isArray(c.plans)) {
1169
+ throw malformed(`plans must be an array (got ${typeof c.plans})`);
1170
+ }
1171
+ for (const [index, plan] of c.plans.entries()) {
1172
+ validatePublishedPlan(plan, index);
1173
+ }
1174
+ }
1175
+ function createCatalogMethods(deps) {
1176
+ const { fetchWithAuth, createError } = deps;
1177
+ async function getPublishedCatalog(serviceCode) {
1178
+ if (isBlankString(serviceCode)) {
1179
+ return {
1180
+ error: createError("VALIDATION_ERROR", "serviceCode \u306F\u5FC5\u9808\u3067\u3059")
1181
+ };
1182
+ }
1183
+ const requestedCode = serviceCode.trim();
1184
+ const response = await fetchWithAuth(
1185
+ `${EXT_CATALOG_ENDPOINT}/${encodeURIComponent(requestedCode)}`
1186
+ );
1187
+ if (response.data !== void 0) {
1188
+ validatePublishedCatalog(response.data);
1189
+ if (response.data.service.code !== requestedCode || response.data.publication.serviceCode !== requestedCode) {
1190
+ throw malformed(
1191
+ `response is for service ${JSON.stringify(response.data.service.code)} (publication: ${JSON.stringify(response.data.publication.serviceCode)}) but ${JSON.stringify(requestedCode)} was requested`
1192
+ );
1193
+ }
1194
+ }
1195
+ return response;
1196
+ }
1197
+ return { getPublishedCatalog };
1198
+ }
1199
+
826
1200
  // src/client/members-methods.ts
827
1201
  var EXT_MEMBERS_ENDPOINT = "/api/v1/organizations/ext/members";
828
1202
  function createMembersMethods(deps) {
@@ -1265,7 +1639,7 @@ function validateTokenResponse(tokenResponse) {
1265
1639
  }
1266
1640
 
1267
1641
  // src/client/version-check.ts
1268
- var SDK_VERSION = "5.25.0";
1642
+ var SDK_VERSION = "5.28.0";
1269
1643
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
1270
1644
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
1271
1645
  function sdkHeaders() {
@@ -2677,6 +3051,11 @@ function createInquiryMethods(deps) {
2677
3051
  name,
2678
3052
  message,
2679
3053
  category: params.category,
3054
+ // Normalize null ("survey not collected", e.g. forwarded verbatim
3055
+ // from FFIDInquiryFormSubmitData) to undefined so JSON.stringify
3056
+ // drops the key entirely — older FFID deployments never see it and
3057
+ // current ones treat the omission as NULL.
3058
+ acquisitionSource: params.acquisitionSource ?? void 0,
2680
3059
  company: params.company,
2681
3060
  phone: params.phone,
2682
3061
  locale: params.locale,
@@ -2709,39 +3088,7 @@ var BLOCKING_EFFECTIVE_STATUSES = [
2709
3088
  "trial_expired"
2710
3089
  ];
2711
3090
 
2712
- // src/client/error-codes.ts
2713
- var FFID_ERROR_CODES = {
2714
- NETWORK_ERROR: "NETWORK_ERROR",
2715
- PARSE_ERROR: "PARSE_ERROR",
2716
- UNKNOWN_ERROR: "UNKNOWN_ERROR",
2717
- TOKEN_EXCHANGE_ERROR: "TOKEN_EXCHANGE_ERROR",
2718
- TOKEN_REFRESH_ERROR: "TOKEN_REFRESH_ERROR",
2719
- NO_TOKENS: "NO_TOKENS",
2720
- TOKEN_VERIFICATION_ERROR: "TOKEN_VERIFICATION_ERROR",
2721
- TOKEN_EXPIRED: "TOKEN_EXPIRED",
2722
- STATE_MISMATCH_ERROR: "STATE_MISMATCH_ERROR"
2723
- };
2724
-
2725
- // src/client/ffid-client.ts
2726
- var UNAUTHORIZED_STATUS2 = 401;
2727
- var SDK_LOG_PREFIX = "[FFID SDK]";
2728
- var noopLogger = {
2729
- debug: () => {
2730
- },
2731
- info: () => {
2732
- },
2733
- warn: () => {
2734
- },
2735
- error: () => {
2736
- }
2737
- };
2738
- var consoleLogger = {
2739
- debug: (...args) => console.debug(SDK_LOG_PREFIX, ...args),
2740
- info: (...args) => console.info(SDK_LOG_PREFIX, ...args),
2741
- warn: (...args) => console.warn(SDK_LOG_PREFIX, ...args),
2742
- error: (...args) => console.error(SDK_LOG_PREFIX, ...args)
2743
- };
2744
- var EXT_CHECK_ENDPOINT = "/api/v1/subscriptions/ext/check";
3091
+ // src/client/service-access-decision.ts
2745
3092
  var DEFAULT_ALLOW_GRACE = true;
2746
3093
  var DEFAULT_SERVICE_ACCESS_FAIL_POLICY = "failClosed";
2747
3094
  var SERVICE_ACCESS_DENIED_CODE = "SERVICE_ACCESS_DENIED";
@@ -2808,6 +3155,40 @@ function failClosedServiceAccessDecision(params, error) {
2808
3155
  error
2809
3156
  };
2810
3157
  }
3158
+
3159
+ // src/client/error-codes.ts
3160
+ var FFID_ERROR_CODES = {
3161
+ NETWORK_ERROR: "NETWORK_ERROR",
3162
+ PARSE_ERROR: "PARSE_ERROR",
3163
+ UNKNOWN_ERROR: "UNKNOWN_ERROR",
3164
+ TOKEN_EXCHANGE_ERROR: "TOKEN_EXCHANGE_ERROR",
3165
+ TOKEN_REFRESH_ERROR: "TOKEN_REFRESH_ERROR",
3166
+ NO_TOKENS: "NO_TOKENS",
3167
+ TOKEN_VERIFICATION_ERROR: "TOKEN_VERIFICATION_ERROR",
3168
+ TOKEN_EXPIRED: "TOKEN_EXPIRED",
3169
+ STATE_MISMATCH_ERROR: "STATE_MISMATCH_ERROR"
3170
+ };
3171
+
3172
+ // src/client/ffid-client.ts
3173
+ var UNAUTHORIZED_STATUS2 = 401;
3174
+ var SDK_LOG_PREFIX = "[FFID SDK]";
3175
+ var noopLogger = {
3176
+ debug: () => {
3177
+ },
3178
+ info: () => {
3179
+ },
3180
+ warn: () => {
3181
+ },
3182
+ error: () => {
3183
+ }
3184
+ };
3185
+ var consoleLogger = {
3186
+ debug: (...args) => console.debug(SDK_LOG_PREFIX, ...args),
3187
+ info: (...args) => console.info(SDK_LOG_PREFIX, ...args),
3188
+ warn: (...args) => console.warn(SDK_LOG_PREFIX, ...args),
3189
+ error: (...args) => console.error(SDK_LOG_PREFIX, ...args)
3190
+ };
3191
+ var EXT_CHECK_ENDPOINT = "/api/v1/subscriptions/ext/check";
2811
3192
  function resolveRedirectUri(raw, logger) {
2812
3193
  if (raw === null) return null;
2813
3194
  try {
@@ -3125,6 +3506,10 @@ function createFFIDClient(config) {
3125
3506
  fetchWithAuth,
3126
3507
  createError
3127
3508
  });
3509
+ const { getPublishedCatalog } = createCatalogMethods({
3510
+ fetchWithAuth,
3511
+ createError
3512
+ });
3128
3513
  const { listMembers, addMember, updateMemberRole, removeMember } = createMembersMethods({
3129
3514
  fetchWithAuth,
3130
3515
  createError,
@@ -3251,6 +3636,7 @@ function createFFIDClient(config) {
3251
3636
  assignSeats,
3252
3637
  unassignSeat,
3253
3638
  listPlans,
3639
+ getPublishedCatalog,
3254
3640
  getSubscription,
3255
3641
  subscribe,
3256
3642
  changePlan,
@@ -3431,11 +3817,11 @@ function getFFIDConsentFromCookieHeader(cookieHeader) {
3431
3817
 
3432
3818
  // src/server/auth/server-state.ts
3433
3819
  var STATE_RANDOM_BYTES2 = 16;
3434
- var HEX_RADIX = 16;
3820
+ var HEX_RADIX2 = 16;
3435
3821
  function generateServerState() {
3436
3822
  const bytes = new Uint8Array(STATE_RANDOM_BYTES2);
3437
3823
  globalThis.crypto.getRandomValues(bytes);
3438
- return Array.from(bytes, (b) => b.toString(HEX_RADIX).padStart(2, "0")).join("");
3824
+ return Array.from(bytes, (b) => b.toString(HEX_RADIX2).padStart(2, "0")).join("");
3439
3825
  }
3440
3826
 
3441
3827
  // src/server/auth/server-oauth-token.ts
@@ -3685,4 +4071,4 @@ function clear(opts = {}) {
3685
4071
  }
3686
4072
  var sessionCookies = { serialize, read, clear };
3687
4073
 
3688
- export { ALL_DENIED_EXCEPT_NECESSARY, CONSENT_COOKIE_NAME, COOKIE_VERSION, FFID_ERROR_CODES, FFID_SESSION_COOKIE_NAME, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createServerAuthClient, createTokenStore, createVerifyAccessToken, decodeConsentCookie, encodeConsentCookie, generateServerState, getFFIDConsentFromCookieHeader, getFFIDConsentFromCookies, sessionCookies };
4074
+ export { ALL_DENIED_EXCEPT_NECESSARY, CATALOG_HASH_PATTERN, CONSENT_COOKIE_NAME, COOKIE_VERSION, FFIDCatalogHashError, FFID_CATALOG_ENVIRONMENTS, FFID_CATALOG_PUBLICATION_STATUSES, FFID_ERROR_CODES, FFID_SESSION_COOKIE_NAME, canonicalizeCatalogValue, computeFFIDCheckoutCopyHash, computeLegalDisclosureHash, computePaymentConfigurationHash, computePraxisCopyHash, computeScopeHash, computeTaxConfigurationHash, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createServerAuthClient, createTokenStore, createVerifyAccessToken, decodeConsentCookie, encodeConsentCookie, generateServerState, getFFIDConsentFromCookieHeader, getFFIDConsentFromCookies, hashCanonicalJson, sessionCookies, sha256Hex, validatePublishedCatalog };
@@ -1,4 +1,4 @@
1
- import { k as FFIDClient, e as FFIDOAuthUserInfo } from '../../ffid-client-BZERrMAF.cjs';
1
+ import { q as FFIDClient, e as FFIDOAuthUserInfo } from '../../ffid-client-B_VBvIt4.cjs';
2
2
  import '../../types-Cjb9J0rL.cjs';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { k as FFIDClient, e as FFIDOAuthUserInfo } from '../../ffid-client-CFZPX5ej.js';
1
+ import { q as FFIDClient, e as FFIDOAuthUserInfo } from '../../ffid-client-DEM1nYqe.js';
2
2
  import '../../types-Cjb9J0rL.js';
3
3
 
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feelflow/ffid-sdk",
3
- "version": "5.25.0",
3
+ "version": "5.28.0",
4
4
  "description": "FeelFlow ID Platform SDK for React/Next.js applications",
5
5
  "keywords": [
6
6
  "feelflow",