@feelflow/ffid-sdk 9.0.0 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { useFFIDContext, useSubscription } from './chunk-TUXIJEEZ.js';
2
- export { ACCESS_GRANTING_EFFECTIVE_STATUSES, AGENCY_INVITE_COOKIE_MAX_AGE_SEC, AGENCY_INVITE_COOKIE_NAME, AGENCY_INVITE_TOKEN_PARAM, AGENCY_INVITE_TOKEN_REDACTION, BLOCKING_EFFECTIVE_STATUSES, CATALOG_HASH_PATTERN, DEFAULT_API_BASE_URL, DEFAULT_OAUTH_SCOPES, EFFECTIVE_SUBSCRIPTION_STATUSES, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDCatalogHashError, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSDKError, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ALLOWED_ORGANIZATION_LOGO_MIME_TYPES, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_CATALOG_ENVIRONMENTS, FFID_CATALOG_PUBLICATION_STATUSES, FFID_COMPANY_SIZE_CODES, FFID_ERROR_CODES, FFID_INDUSTRY_CODES, FFID_INQUIRY_ACQUISITION_SOURCES, FFID_INQUIRY_CATEGORIES, FFID_INQUIRY_CATEGORIES_SITE_2026, FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_BYTES, FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_MB, FFID_ORGANIZATION_PROFILE_ERROR_CODES, FFID_SUBSCRIPTION_ERROR_CODES, canonicalizeCatalogValue, captureAgencyInviteToken, clearAgencyInviteToken, cleanupStateStorage as clearState, computeEffectiveStatusFromSession, computeFFIDCheckoutCopyHash, computeLegalDisclosureHash, computePaymentConfigurationHash, computePraxisCopyHash, computeScopeHash, computeTaxConfigurationHash, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, handleRedirectCallback, hasAccessFromUserinfo, hashCanonicalJson, isBlockedFromUserinfo, isFFIDInquiryAcquisitionSource, isFFIDInquiryCategorySite2026, normalizeRedirectUri, readAgencyInviteCookie, readAgencyInviteToken, redactAgencyInviteToken, retrieveCodeVerifier, retrieveState, sha256Hex, storeCodeVerifier, storeState, useFFID, useFFIDAnnouncements, useSubscription, validatePublishedCatalog, withSubscription } from './chunk-TUXIJEEZ.js';
1
+ import { useFFIDContext, useSubscription } from './chunk-OXW6QSTO.js';
2
+ export { ACCESS_GRANTING_EFFECTIVE_STATUSES, AGENCY_INVITE_COOKIE_MAX_AGE_SEC, AGENCY_INVITE_COOKIE_NAME, AGENCY_INVITE_TOKEN_PARAM, AGENCY_INVITE_TOKEN_REDACTION, BLOCKING_EFFECTIVE_STATUSES, CATALOG_HASH_PATTERN, DEFAULT_API_BASE_URL, DEFAULT_OAUTH_SCOPES, EFFECTIVE_SUBSCRIPTION_STATUSES, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDCatalogHashError, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSDKError, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ALLOWED_ORGANIZATION_LOGO_MIME_TYPES, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_CATALOG_ENVIRONMENTS, FFID_CATALOG_PUBLICATION_STATUSES, FFID_COMPANY_SIZE_CODES, FFID_CREDITS_CONSUME_MAX_AMOUNT, FFID_CREDITS_CONSUME_MIN_AMOUNT, FFID_CREDITS_ERROR_CODES, FFID_CREDITS_FEATURE_PATTERN, FFID_CREDITS_HISTORY_DEFAULT_LIMIT, FFID_CREDITS_HISTORY_MAX_LIMIT, FFID_CREDITS_HISTORY_MIN_LIMIT, FFID_CREDITS_IDEMPOTENCY_KEY_PATTERN, FFID_CREDITS_LOW_THRESHOLD_PERCENT, FFID_CREDITS_METADATA_MAX_BYTES, FFID_CREDIT_GRANT_KINDS, FFID_CREDIT_HISTORY_TYPES, FFID_CREDIT_PACK_MAX_QUANTITY, FFID_CREDIT_PACK_MIN_QUANTITY, FFID_ERROR_CODES, FFID_INDUSTRY_CODES, FFID_INQUIRY_ACQUISITION_SOURCES, FFID_INQUIRY_CATEGORIES, FFID_INQUIRY_CATEGORIES_SITE_2026, FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_BYTES, FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_MB, FFID_ORGANIZATION_PROFILE_ERROR_CODES, FFID_SUBSCRIPTION_ERROR_CODES, canonicalizeCatalogValue, captureAgencyInviteToken, clearAgencyInviteToken, cleanupStateStorage as clearState, computeEffectiveStatusFromSession, computeFFIDCheckoutCopyHash, computeLegalDisclosureHash, computePaymentConfigurationHash, computePraxisCopyHash, computeScopeHash, computeTaxConfigurationHash, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, handleRedirectCallback, hasAccessFromUserinfo, hashCanonicalJson, isBlockedFromUserinfo, isFFIDInquiryAcquisitionSource, isFFIDInquiryCategorySite2026, normalizeRedirectUri, readAgencyInviteCookie, readAgencyInviteToken, redactAgencyInviteToken, retrieveCodeVerifier, retrieveState, sha256Hex, storeCodeVerifier, storeState, useFFID, useFFIDAnnouncements, useSubscription, validatePublishedCatalog, withSubscription } from './chunk-OXW6QSTO.js';
3
3
  export { ALL_DENIED_EXCEPT_NECESSARY, CONSENT_COOKIE_NAME, CONSENT_DISMISSAL_TIMESTAMP_KEY, COOKIE_VERSION, DEFAULT_CONSENT_ERROR_MESSAGES, FFIDAnalyticsProvider, FFIDConsentError, FFIDCookieBanner, FFIDCookieLink, FFIDCookieSettings, FFID_CONSENT_ERROR_CODES, clearConsentDismissalTimestamp, decodeConsentCookie, encodeConsentCookie, readConsentCookie, readConsentDismissalTimestamp, useFFIDConsent, useFFIDConsentPreferences, writeConsentCookie, writeConsentDismissalTimestamp } from './chunk-S2AEBJRX.js';
4
4
  import { useEffect, useRef } from 'react';
5
5
  import { jsx, Fragment } from 'react/jsx-runtime';
@@ -1371,7 +1371,7 @@ var FFID_ORGANIZATION_PROFILE_ERROR_CODES = {
1371
1371
  };
1372
1372
 
1373
1373
  // src/client/version-check.ts
1374
- var SDK_VERSION = "9.0.0";
1374
+ var SDK_VERSION = "10.0.0";
1375
1375
  var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
1376
1376
  var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
1377
1377
  function sdkHeaders() {
@@ -1727,8 +1727,11 @@ function createProvisioningMethods(deps) {
1727
1727
  }
1728
1728
 
1729
1729
  // src/client/seat-methods.ts
1730
+ function seatSummaryEndpoint(subscriptionId) {
1731
+ return `/api/v1/subscriptions/ext/${encodeURIComponent(subscriptionId)}/seats`;
1732
+ }
1730
1733
  function seatsEndpoint(subscriptionId) {
1731
- return `/api/v1/subscriptions/ext/${encodeURIComponent(subscriptionId)}/seats/assignments`;
1734
+ return `${seatSummaryEndpoint(subscriptionId)}/assignments`;
1732
1735
  }
1733
1736
  function createSeatMethods(deps) {
1734
1737
  const { fetchWithAuth, createError } = deps;
@@ -1738,6 +1741,12 @@ function createSeatMethods(deps) {
1738
1741
  }
1739
1742
  return fetchWithAuth(seatsEndpoint(params.subscriptionId));
1740
1743
  }
1744
+ async function getSeats(subscriptionId) {
1745
+ if (!subscriptionId || !subscriptionId.trim()) {
1746
+ return { error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059") };
1747
+ }
1748
+ return fetchWithAuth(seatSummaryEndpoint(subscriptionId));
1749
+ }
1741
1750
  async function assignSeats(params) {
1742
1751
  if (!params.subscriptionId) {
1743
1752
  return { error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059") };
@@ -1762,7 +1771,7 @@ function createSeatMethods(deps) {
1762
1771
  { method: "DELETE" }
1763
1772
  );
1764
1773
  }
1765
- return { listSeatAssignments, assignSeats, unassignSeat };
1774
+ return { listSeatAssignments, getSeats, assignSeats, unassignSeat };
1766
1775
  }
1767
1776
 
1768
1777
  // src/client/profile-methods.ts
@@ -3489,6 +3498,222 @@ function createInquiryMethods(deps) {
3489
3498
  return { create };
3490
3499
  }
3491
3500
 
3501
+ // src/types/credits.ts
3502
+ var FFID_CREDITS_CONSUME_MIN_AMOUNT = 1;
3503
+ var FFID_CREDITS_CONSUME_MAX_AMOUNT = 1e6;
3504
+ var FFID_CREDITS_METADATA_MAX_BYTES = 4096;
3505
+ var FFID_CREDITS_HISTORY_MIN_LIMIT = 1;
3506
+ var FFID_CREDITS_HISTORY_MAX_LIMIT = 100;
3507
+ var FFID_CREDIT_PACK_MIN_QUANTITY = 1;
3508
+ var FFID_CREDIT_PACK_MAX_QUANTITY = 10;
3509
+ var FFID_CREDITS_IDEMPOTENCY_KEY_PATTERN = /^[A-Za-z0-9._:-]{8,128}$/;
3510
+ var FFID_CREDITS_FEATURE_PATTERN = /^[a-z0-9][a-z0-9._-]{0,63}$/;
3511
+ var FFID_CREDIT_HISTORY_TYPES = ["grant", "consumption", "revocation"];
3512
+
3513
+ // src/client/credits-methods.ts
3514
+ var EXT_SUBSCRIPTIONS_PATH = "/api/v1/subscriptions/ext";
3515
+ var CREDIT_PACKS_ENDPOINT = `${EXT_SUBSCRIPTIONS_PATH}/credits/packs`;
3516
+ var CREDIT_PACK_CHECKOUT_ENDPOINT = `${CREDIT_PACKS_ENDPOINT}/checkout`;
3517
+ var PORTAL_SUBSCRIPTION_PATH = "/subscriptions";
3518
+ var BUY_CREDITS_QUERY = { key: "purchase", value: "credits" };
3519
+ var ORG_QUERY_KEY = "org";
3520
+ var FFID_CONTRACT_ID_PREFIX = "ffid:";
3521
+ var STRIPE_SUBSCRIPTION_ID_PREFIX = "sub_";
3522
+ var UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
3523
+ var VALIDATION_ERROR = "VALIDATION_ERROR";
3524
+ var FORBIDDEN = "FORBIDDEN";
3525
+ var utf8Encoder = new TextEncoder();
3526
+ function creditsEndpoint(subscriptionId, action) {
3527
+ return `${EXT_SUBSCRIPTIONS_PATH}/${encodeURIComponent(subscriptionId)}/credits/${action}`;
3528
+ }
3529
+ function isPlainObject2(value) {
3530
+ return typeof value === "object" && value !== null && !Array.isArray(value);
3531
+ }
3532
+ function isIntegerInRange(value, min, max) {
3533
+ return typeof value === "number" && Number.isInteger(value) && value >= min && value <= max;
3534
+ }
3535
+ function createCreditsMethods(deps) {
3536
+ const { fetchWithAuth, createError, authMode, baseUrl, serviceCode, logger } = deps;
3537
+ function validationError(field, message) {
3538
+ return { error: { ...createError(VALIDATION_ERROR, message), details: { field } } };
3539
+ }
3540
+ function forbidden(reason, message) {
3541
+ return { error: { ...createError(FORBIDDEN, message), details: { reason } } };
3542
+ }
3543
+ function missingSubscriptionId(subscriptionId) {
3544
+ return subscriptionId && subscriptionId.trim() ? null : validationError("subscriptionId", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059");
3545
+ }
3546
+ async function getBalance(subscriptionId) {
3547
+ const invalid = missingSubscriptionId(subscriptionId);
3548
+ if (invalid) return invalid;
3549
+ return fetchWithAuth(creditsEndpoint(subscriptionId, "balance"));
3550
+ }
3551
+ async function listHistory(subscriptionId, options = {}) {
3552
+ const invalid = missingSubscriptionId(subscriptionId);
3553
+ if (invalid) return invalid;
3554
+ const query = new URLSearchParams();
3555
+ if (options.cursor !== void 0) query.set("cursor", options.cursor);
3556
+ if (options.limit !== void 0) {
3557
+ if (!isIntegerInRange(options.limit, FFID_CREDITS_HISTORY_MIN_LIMIT, FFID_CREDITS_HISTORY_MAX_LIMIT)) {
3558
+ return validationError(
3559
+ "limit",
3560
+ `limit \u306F ${FFID_CREDITS_HISTORY_MIN_LIMIT}\u301C${FFID_CREDITS_HISTORY_MAX_LIMIT} \u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`
3561
+ );
3562
+ }
3563
+ query.set("limit", String(options.limit));
3564
+ }
3565
+ if (options.type !== void 0) {
3566
+ if (!FFID_CREDIT_HISTORY_TYPES.includes(options.type)) {
3567
+ return validationError("type", `type \u306F ${FFID_CREDIT_HISTORY_TYPES.join(" / ")} \u306E\u3044\u305A\u308C\u304B\u3067\u3059`);
3568
+ }
3569
+ query.set("type", options.type);
3570
+ }
3571
+ const qs = query.toString();
3572
+ return fetchWithAuth(
3573
+ `${creditsEndpoint(subscriptionId, "history")}${qs ? `?${qs}` : ""}`
3574
+ );
3575
+ }
3576
+ async function listPacks(packServiceCode) {
3577
+ const resolved = packServiceCode ?? (authMode === "service-key" ? void 0 : serviceCode);
3578
+ if (resolved !== void 0 && !resolved.trim()) {
3579
+ return validationError("serviceCode", "serviceCode \u3092\u6307\u5B9A\u3059\u308B\u5834\u5408\u3001\u7A7A\u6587\u5B57\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093");
3580
+ }
3581
+ const qs = resolved === void 0 ? "" : `?${new URLSearchParams({ serviceCode: resolved }).toString()}`;
3582
+ return fetchWithAuth(`${CREDIT_PACKS_ENDPOINT}${qs}`);
3583
+ }
3584
+ async function createPackCheckout(params) {
3585
+ if (authMode !== "token") {
3586
+ return forbidden(
3587
+ "bearer_required",
3588
+ "createPackCheckout \u306F token \u30E2\u30FC\u30C9\uFF08Bearer\uFF09\u3067\u306E\u307F\u5229\u7528\u3067\u304D\u307E\u3059\u3002\u8CFC\u5165\u8005\u306E\u8A18\u9332\u306B\u5B9F\u30E6\u30FC\u30B6\u30FC\u304C\u5FC5\u8981\u306A\u305F\u3081\u3067\u3059"
3589
+ );
3590
+ }
3591
+ const invalid = missingSubscriptionId(params.subscriptionId);
3592
+ if (invalid) return invalid;
3593
+ for (const field of ["packCode", "successUrl", "cancelUrl"]) {
3594
+ if (!params[field] || !params[field].trim()) {
3595
+ return validationError(field, `${field} \u306F\u5FC5\u9808\u3067\u3059`);
3596
+ }
3597
+ }
3598
+ if (params.quantity !== void 0 && !isIntegerInRange(params.quantity, FFID_CREDIT_PACK_MIN_QUANTITY, FFID_CREDIT_PACK_MAX_QUANTITY)) {
3599
+ return validationError(
3600
+ "quantity",
3601
+ `quantity \u306F ${FFID_CREDIT_PACK_MIN_QUANTITY}\u301C${FFID_CREDIT_PACK_MAX_QUANTITY} \u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`
3602
+ );
3603
+ }
3604
+ const body = {
3605
+ subscriptionId: params.subscriptionId,
3606
+ packCode: params.packCode,
3607
+ successUrl: params.successUrl,
3608
+ cancelUrl: params.cancelUrl
3609
+ };
3610
+ if (params.quantity !== void 0) body.quantity = params.quantity;
3611
+ return fetchWithAuth(CREDIT_PACK_CHECKOUT_ENDPOINT, {
3612
+ method: "POST",
3613
+ body: JSON.stringify(body)
3614
+ });
3615
+ }
3616
+ function validateConsume(params) {
3617
+ const invalid = missingSubscriptionId(params.subscriptionId);
3618
+ if (invalid) return invalid;
3619
+ if (!isIntegerInRange(params.amount, FFID_CREDITS_CONSUME_MIN_AMOUNT, FFID_CREDITS_CONSUME_MAX_AMOUNT)) {
3620
+ return validationError(
3621
+ "amount",
3622
+ `amount \u306F ${FFID_CREDITS_CONSUME_MIN_AMOUNT}\u301C${FFID_CREDITS_CONSUME_MAX_AMOUNT} \u306E\u6574\u6570\u3067\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044`
3623
+ );
3624
+ }
3625
+ if (typeof params.idempotencyKey !== "string" || !FFID_CREDITS_IDEMPOTENCY_KEY_PATTERN.test(params.idempotencyKey)) {
3626
+ return validationError(
3627
+ "idempotencyKey",
3628
+ "idempotencyKey \u306E\u5F62\u5F0F\u304C\u4E0D\u6B63\u3067\u3059\uFF08\u82F1\u6570\u5B57\u3068 . _ : - \u306E 8\u301C128 \u6587\u5B57\u3002\u63A8\u5968\u306F feature:requestId\uFF09"
3629
+ );
3630
+ }
3631
+ if (typeof params.feature !== "string" || !FFID_CREDITS_FEATURE_PATTERN.test(params.feature)) {
3632
+ return validationError("feature", "feature \u306E\u5F62\u5F0F\u304C\u4E0D\u6B63\u3067\u3059\uFF08\u5C0F\u6587\u5B57\u82F1\u6570\u5B57\u3067\u59CB\u307E\u308B\u3001\u5C0F\u6587\u5B57\u82F1\u6570\u5B57\u3068 . _ - \u306E 1\u301C64 \u6587\u5B57\uFF09");
3633
+ }
3634
+ if (params.metadata !== void 0) {
3635
+ if (!isPlainObject2(params.metadata)) {
3636
+ return validationError("metadata", "metadata \u306F JSON \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059");
3637
+ }
3638
+ let serialized;
3639
+ try {
3640
+ serialized = JSON.stringify(params.metadata);
3641
+ } catch {
3642
+ return validationError("metadata", "metadata \u306F JSON \u306B\u5909\u63DB\u3067\u304D\u308B\u5024\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\uFF08BigInt\u30FB\u5FAA\u74B0\u53C2\u7167\u306F\u4E0D\u53EF\uFF09");
3643
+ }
3644
+ if (utf8Encoder.encode(serialized).byteLength > FFID_CREDITS_METADATA_MAX_BYTES) {
3645
+ return validationError("metadata", `metadata \u306F ${FFID_CREDITS_METADATA_MAX_BYTES} \u30D0\u30A4\u30C8\u4EE5\u4E0B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059`);
3646
+ }
3647
+ }
3648
+ if (params.userId !== void 0 && !UUID_PATTERN.test(params.userId)) {
3649
+ return validationError("userId", "userId \u306F\u6709\u52B9\u306AUUID\u5F62\u5F0F\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059");
3650
+ }
3651
+ return null;
3652
+ }
3653
+ async function consume(params) {
3654
+ if (authMode !== "service-key") {
3655
+ return forbidden(
3656
+ "api_key_required",
3657
+ "credits.consume \u306F service-key \u8A8D\u8A3C\uFF08X-Service-Api-Key\uFF09\u3067\u306E\u307F\u5229\u7528\u3067\u304D\u307E\u3059\u3002\u6D88\u8CBB\u306E\u5831\u544A\u306F\u30B5\u30FC\u30D3\u30B9\u306E\u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u304B\u3089\u884C\u3063\u3066\u304F\u3060\u3055\u3044"
3658
+ );
3659
+ }
3660
+ const invalid = validateConsume(params);
3661
+ if (invalid) return invalid;
3662
+ const body = {
3663
+ amount: params.amount,
3664
+ idempotencyKey: params.idempotencyKey,
3665
+ feature: params.feature
3666
+ };
3667
+ if (params.metadata !== void 0) body.metadata = params.metadata;
3668
+ if (params.userId !== void 0) body.userId = params.userId;
3669
+ return fetchWithAuth(creditsEndpoint(params.subscriptionId, "consume"), {
3670
+ method: "POST",
3671
+ body: JSON.stringify(body)
3672
+ });
3673
+ }
3674
+ function getBuyCreditsUrl(params) {
3675
+ const raw = params.subscriptionId?.trim() ?? "";
3676
+ if (raw.startsWith(STRIPE_SUBSCRIPTION_ID_PREFIX)) {
3677
+ return validationError(
3678
+ "subscriptionId",
3679
+ "getBuyCreditsUrl \u306B\u306F\u5951\u7D04\u306E UUID\uFF08\u307E\u305F\u306F ffid:<uuid>\uFF09\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002Stripe \u306E sub_... \u306F\u4F7F\u3048\u307E\u305B\u3093"
3680
+ );
3681
+ }
3682
+ const uuid = raw.startsWith(FFID_CONTRACT_ID_PREFIX) ? raw.slice(FFID_CONTRACT_ID_PREFIX.length) : raw;
3683
+ if (!UUID_PATTERN.test(uuid)) {
3684
+ return validationError("subscriptionId", "subscriptionId \u306F\u5951\u7D04\u306E UUID\uFF08\u307E\u305F\u306F ffid:<uuid>\uFF09\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059");
3685
+ }
3686
+ const query = new URLSearchParams({ [BUY_CREDITS_QUERY.key]: BUY_CREDITS_QUERY.value });
3687
+ if (params.orgId !== void 0 && params.orgId.trim()) {
3688
+ query.set(ORG_QUERY_KEY, params.orgId);
3689
+ }
3690
+ return { data: `${baseUrl}${PORTAL_SUBSCRIPTION_PATH}/${encodeURIComponent(uuid)}?${query.toString()}` };
3691
+ }
3692
+ function redirectToBuyCredits(params) {
3693
+ const result = getBuyCreditsUrl(params);
3694
+ if (result.error) {
3695
+ logger.warn("redirectToBuyCredits:", result.error.message);
3696
+ return { success: false, error: result.error.message };
3697
+ }
3698
+ if (typeof window === "undefined") {
3699
+ logger.warn("SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093");
3700
+ return { success: false, error: "SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093" };
3701
+ }
3702
+ logger.debug("Redirecting to buy credits:", result.data);
3703
+ window.location.href = result.data;
3704
+ return { success: true };
3705
+ }
3706
+ return {
3707
+ getBalance,
3708
+ listHistory,
3709
+ listPacks,
3710
+ createPackCheckout,
3711
+ consume,
3712
+ getBuyCreditsUrl,
3713
+ redirectToBuyCredits
3714
+ };
3715
+ }
3716
+
3492
3717
  // src/subscriptions/userinfo-helpers.ts
3493
3718
  var ACCESS_GRANTING_EFFECTIVE_STATUSES = [
3494
3719
  "active",
@@ -3547,7 +3772,12 @@ function toServiceAccessDecision(response, allowGrace) {
3547
3772
  planCode: response.planCode,
3548
3773
  currentPeriodEnd: response.currentPeriodEnd,
3549
3774
  gracePeriodEndsAt: response.gracePeriodEndsAt ?? null,
3550
- reactivatable: response.reactivatable ?? false
3775
+ reactivatable: response.reactivatable ?? false,
3776
+ // Informational pass-through (10.0.0). Deliberately not part of hasAccess /
3777
+ // denialReason: credits and the member limit never gate access (CREDITS_API §1-5).
3778
+ ...response.pricingModel !== void 0 ? { pricingModel: response.pricingModel } : {},
3779
+ ...response.credits !== void 0 ? { credits: response.credits } : {},
3780
+ ...response.memberLimitReached !== void 0 ? { memberLimitReached: response.memberLimitReached } : {}
3551
3781
  };
3552
3782
  }
3553
3783
  function failClosedServiceAccessDecision(params, error) {
@@ -3909,7 +4139,7 @@ function createFFIDClient(config) {
3909
4139
  fetchWithAuth,
3910
4140
  createError
3911
4141
  });
3912
- const { listSeatAssignments, assignSeats, unassignSeat } = createSeatMethods({
4142
+ const { listSeatAssignments, getSeats, assignSeats, unassignSeat } = createSeatMethods({
3913
4143
  fetchWithAuth,
3914
4144
  createError
3915
4145
  });
@@ -4016,6 +4246,14 @@ function createFFIDClient(config) {
4016
4246
  fetchWithAuth,
4017
4247
  createError
4018
4248
  });
4249
+ const credits = createCreditsMethods({
4250
+ fetchWithAuth,
4251
+ createError,
4252
+ authMode,
4253
+ baseUrl,
4254
+ serviceCode: config.serviceCode,
4255
+ logger
4256
+ });
4019
4257
  const verifyAccessToken = createVerifyAccessToken({
4020
4258
  authMode,
4021
4259
  baseUrl,
@@ -4071,6 +4309,7 @@ function createFFIDClient(config) {
4071
4309
  getInvoice,
4072
4310
  retryPayment,
4073
4311
  listSeatAssignments,
4312
+ getSeats,
4074
4313
  assignSeats,
4075
4314
  unassignSeat,
4076
4315
  listPlans,
@@ -4081,13 +4320,16 @@ function createFFIDClient(config) {
4081
4320
  cancelSubscription,
4082
4321
  cancelPendingDowngrade,
4083
4322
  previewPlanChange,
4323
+ /** @deprecated 10.0.0: per_seat (praxis) only; removed in 11.0.0 */
4084
4324
  previewSeatChange,
4085
4325
  verifyAccessToken,
4086
4326
  getSubscribeUrl,
4087
4327
  redirectToSubscribe,
4088
4328
  getChangePlanUrl,
4089
4329
  redirectToChangePlan,
4330
+ /** @deprecated 10.0.0: per_seat (praxis) only; removed in 11.0.0 */
4090
4331
  getChangeSeatsUrl,
4332
+ /** @deprecated 10.0.0: per_seat (praxis) only; removed in 11.0.0 */
4091
4333
  redirectToChangeSeats,
4092
4334
  getRecoverPaymentUrl,
4093
4335
  redirectToRecoverPayment,
@@ -4103,6 +4345,8 @@ function createFFIDClient(config) {
4103
4345
  newsletter,
4104
4346
  /** Inquiry methods (create) */
4105
4347
  inquiry,
4348
+ /** Credits methods for flat plans (consume / balance / history / packs) */
4349
+ credits,
4106
4350
  /** Token store (token mode only) */
4107
4351
  tokenStore,
4108
4352
  /**
@@ -1,5 +1,5 @@
1
- import { F as FFIDLogger, a as FFIDError, b as FFIDCacheAdapter, c as FFIDVerifyAccessTokenOptions, d as FFIDApiResponse, e as FFIDOAuthUserInfo, f as FFIDCatalogEnvironment, g as FFIDBillingInterval, h as FFIDTaxBehavior, i as FFIDPublishedCatalog } from '../ffid-client-6aLs9Fqc.cjs';
2
- export { j as FFIDAddMemberParams, k as FFIDAddMemberRequest, l as FFIDAddMemberResponse, m as FFIDAllowedLogoMimeType, n as FFIDAssignableMemberRole, o as FFIDCacheConfig, p as FFIDCatalogPublication, q as FFIDCatalogPublicationStatus, r as FFIDClient, s as FFIDCompanySizeCode, t as FFIDConfig, u as FFIDIndustryCode, v as FFIDListMembersResponse, w as FFIDListingConsentInput, x as FFIDLogoWallEntry, y as FFIDLogoWallResponse, z as FFIDMemberRole, A as FFIDOrganization, B as FFIDOrganizationLogoUploadResponse, C as FFIDOrganizationMember, D as FFIDOrganizationProfile, E as FFIDOrganizationProfileErrorCode, G as FFIDOrganizationProfileResponse, H as FFIDOtpSendResponse, I as FFIDOtpVerifyResponse, J as FFIDPasswordResetConfirmResponse, K as FFIDPasswordResetResponse, L as FFIDPasswordResetVerifyResponse, M as FFIDProfileCallOptions, N as FFIDProvisionMemberPlan, O as FFIDProvisionMemberPlanStatus, P as FFIDProvisionMemberResult, Q as FFIDProvisionMemberStatus, R as FFIDProvisionOrganizationDryRun, S as FFIDProvisionOrganizationMemberInput, T as FFIDProvisionOrganizationOutcome, U as FFIDProvisionOrganizationParams, V as FFIDProvisionOrganizationResponse, W as FFIDProvisionUserDryRun, X as FFIDProvisionUserOutcome, Y as FFIDProvisionUserParams, Z as FFIDProvisionUserProfileInput, _ as FFIDProvisionUserResponse, $ as FFIDProvisionedOrganization, a0 as FFIDProvisionedUser, a1 as FFIDPublishedPlan, a2 as FFIDRemoveMemberResponse, a3 as FFIDResetSessionResponse, a4 as FFIDSubscription, a5 as FFIDUpdateMemberRoleResponse, a6 as FFIDUpdateUserProfileRequest, a7 as FFIDUploadOrganizationLogoParams, a8 as FFIDUpsertOrganizationProfileParams, a9 as FFIDUpsertOrganizationProfileRequest, aa as FFIDUser, ab as FFIDUserProfile, ac as FFID_ALLOWED_ORGANIZATION_LOGO_MIME_TYPES, ad as FFID_CATALOG_ENVIRONMENTS, ae as FFID_CATALOG_PUBLICATION_STATUSES, af as FFID_COMPANY_SIZE_CODES, ag as FFID_INDUSTRY_CODES, ah as FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_BYTES, ai as FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_MB, aj as FFID_ORGANIZATION_PROFILE_ERROR_CODES, ak as TokenData, al as TokenStore, am as createFFIDClient, an as createTokenStore } from '../ffid-client-6aLs9Fqc.cjs';
1
+ import { F as FFIDLogger, a as FFIDError, b as FFIDCacheAdapter, c as FFIDVerifyAccessTokenOptions, d as FFIDApiResponse, e as FFIDOAuthUserInfo, f as FFIDCatalogEnvironment, g as FFIDBillingInterval, h as FFIDTaxBehavior, i as FFIDPublishedCatalog } from '../ffid-client-CumygXXz.cjs';
2
+ export { j as FFIDAddMemberParams, k as FFIDAddMemberRequest, l as FFIDAddMemberResponse, m as FFIDAllowedLogoMimeType, n as FFIDAssignableMemberRole, o as FFIDCacheConfig, p as FFIDCatalogPublication, q as FFIDCatalogPublicationStatus, r as FFIDClient, s as FFIDCompanySizeCode, t as FFIDConfig, u as FFIDIndustryCode, v as FFIDListMembersResponse, w as FFIDListingConsentInput, x as FFIDLogoWallEntry, y as FFIDLogoWallResponse, z as FFIDMemberRole, A as FFIDOrganization, B as FFIDOrganizationLogoUploadResponse, C as FFIDOrganizationMember, D as FFIDOrganizationProfile, E as FFIDOrganizationProfileErrorCode, G as FFIDOrganizationProfileResponse, H as FFIDOtpSendResponse, I as FFIDOtpVerifyResponse, J as FFIDPasswordResetConfirmResponse, K as FFIDPasswordResetResponse, L as FFIDPasswordResetVerifyResponse, M as FFIDProfileCallOptions, N as FFIDProvisionMemberPlan, O as FFIDProvisionMemberPlanStatus, P as FFIDProvisionMemberResult, Q as FFIDProvisionMemberStatus, R as FFIDProvisionOrganizationDryRun, S as FFIDProvisionOrganizationMemberInput, T as FFIDProvisionOrganizationOutcome, U as FFIDProvisionOrganizationParams, V as FFIDProvisionOrganizationResponse, W as FFIDProvisionUserDryRun, X as FFIDProvisionUserOutcome, Y as FFIDProvisionUserParams, Z as FFIDProvisionUserProfileInput, _ as FFIDProvisionUserResponse, $ as FFIDProvisionedOrganization, a0 as FFIDProvisionedUser, a1 as FFIDPublishedPlan, a2 as FFIDRemoveMemberResponse, a3 as FFIDResetSessionResponse, a4 as FFIDSubscription, a5 as FFIDUpdateMemberRoleResponse, a6 as FFIDUpdateUserProfileRequest, a7 as FFIDUploadOrganizationLogoParams, a8 as FFIDUpsertOrganizationProfileParams, a9 as FFIDUpsertOrganizationProfileRequest, aa as FFIDUser, ab as FFIDUserProfile, ac as FFID_ALLOWED_ORGANIZATION_LOGO_MIME_TYPES, ad as FFID_CATALOG_ENVIRONMENTS, ae as FFID_CATALOG_PUBLICATION_STATUSES, af as FFID_COMPANY_SIZE_CODES, ag as FFID_INDUSTRY_CODES, ah as FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_BYTES, ai as FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_MB, aj as FFID_ORGANIZATION_PROFILE_ERROR_CODES, ak as TokenData, al as TokenStore, am as createFFIDClient, an as createTokenStore } from '../ffid-client-CumygXXz.cjs';
3
3
  export { D as DEFAULT_API_BASE_URL, a as DEFAULT_OAUTH_SCOPES } from '../constants-Ce2eXQtB.cjs';
4
4
  import { z } from 'zod';
5
5
  import '../types-Cjb9J0rL.cjs';
@@ -1,5 +1,5 @@
1
- import { F as FFIDLogger, a as FFIDError, b as FFIDCacheAdapter, c as FFIDVerifyAccessTokenOptions, d as FFIDApiResponse, e as FFIDOAuthUserInfo, f as FFIDCatalogEnvironment, g as FFIDBillingInterval, h as FFIDTaxBehavior, i as FFIDPublishedCatalog } from '../ffid-client-B0cORHac.js';
2
- export { j as FFIDAddMemberParams, k as FFIDAddMemberRequest, l as FFIDAddMemberResponse, m as FFIDAllowedLogoMimeType, n as FFIDAssignableMemberRole, o as FFIDCacheConfig, p as FFIDCatalogPublication, q as FFIDCatalogPublicationStatus, r as FFIDClient, s as FFIDCompanySizeCode, t as FFIDConfig, u as FFIDIndustryCode, v as FFIDListMembersResponse, w as FFIDListingConsentInput, x as FFIDLogoWallEntry, y as FFIDLogoWallResponse, z as FFIDMemberRole, A as FFIDOrganization, B as FFIDOrganizationLogoUploadResponse, C as FFIDOrganizationMember, D as FFIDOrganizationProfile, E as FFIDOrganizationProfileErrorCode, G as FFIDOrganizationProfileResponse, H as FFIDOtpSendResponse, I as FFIDOtpVerifyResponse, J as FFIDPasswordResetConfirmResponse, K as FFIDPasswordResetResponse, L as FFIDPasswordResetVerifyResponse, M as FFIDProfileCallOptions, N as FFIDProvisionMemberPlan, O as FFIDProvisionMemberPlanStatus, P as FFIDProvisionMemberResult, Q as FFIDProvisionMemberStatus, R as FFIDProvisionOrganizationDryRun, S as FFIDProvisionOrganizationMemberInput, T as FFIDProvisionOrganizationOutcome, U as FFIDProvisionOrganizationParams, V as FFIDProvisionOrganizationResponse, W as FFIDProvisionUserDryRun, X as FFIDProvisionUserOutcome, Y as FFIDProvisionUserParams, Z as FFIDProvisionUserProfileInput, _ as FFIDProvisionUserResponse, $ as FFIDProvisionedOrganization, a0 as FFIDProvisionedUser, a1 as FFIDPublishedPlan, a2 as FFIDRemoveMemberResponse, a3 as FFIDResetSessionResponse, a4 as FFIDSubscription, a5 as FFIDUpdateMemberRoleResponse, a6 as FFIDUpdateUserProfileRequest, a7 as FFIDUploadOrganizationLogoParams, a8 as FFIDUpsertOrganizationProfileParams, a9 as FFIDUpsertOrganizationProfileRequest, aa as FFIDUser, ab as FFIDUserProfile, ac as FFID_ALLOWED_ORGANIZATION_LOGO_MIME_TYPES, ad as FFID_CATALOG_ENVIRONMENTS, ae as FFID_CATALOG_PUBLICATION_STATUSES, af as FFID_COMPANY_SIZE_CODES, ag as FFID_INDUSTRY_CODES, ah as FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_BYTES, ai as FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_MB, aj as FFID_ORGANIZATION_PROFILE_ERROR_CODES, ak as TokenData, al as TokenStore, am as createFFIDClient, an as createTokenStore } from '../ffid-client-B0cORHac.js';
1
+ import { F as FFIDLogger, a as FFIDError, b as FFIDCacheAdapter, c as FFIDVerifyAccessTokenOptions, d as FFIDApiResponse, e as FFIDOAuthUserInfo, f as FFIDCatalogEnvironment, g as FFIDBillingInterval, h as FFIDTaxBehavior, i as FFIDPublishedCatalog } from '../ffid-client-5uxXRgIO.js';
2
+ export { j as FFIDAddMemberParams, k as FFIDAddMemberRequest, l as FFIDAddMemberResponse, m as FFIDAllowedLogoMimeType, n as FFIDAssignableMemberRole, o as FFIDCacheConfig, p as FFIDCatalogPublication, q as FFIDCatalogPublicationStatus, r as FFIDClient, s as FFIDCompanySizeCode, t as FFIDConfig, u as FFIDIndustryCode, v as FFIDListMembersResponse, w as FFIDListingConsentInput, x as FFIDLogoWallEntry, y as FFIDLogoWallResponse, z as FFIDMemberRole, A as FFIDOrganization, B as FFIDOrganizationLogoUploadResponse, C as FFIDOrganizationMember, D as FFIDOrganizationProfile, E as FFIDOrganizationProfileErrorCode, G as FFIDOrganizationProfileResponse, H as FFIDOtpSendResponse, I as FFIDOtpVerifyResponse, J as FFIDPasswordResetConfirmResponse, K as FFIDPasswordResetResponse, L as FFIDPasswordResetVerifyResponse, M as FFIDProfileCallOptions, N as FFIDProvisionMemberPlan, O as FFIDProvisionMemberPlanStatus, P as FFIDProvisionMemberResult, Q as FFIDProvisionMemberStatus, R as FFIDProvisionOrganizationDryRun, S as FFIDProvisionOrganizationMemberInput, T as FFIDProvisionOrganizationOutcome, U as FFIDProvisionOrganizationParams, V as FFIDProvisionOrganizationResponse, W as FFIDProvisionUserDryRun, X as FFIDProvisionUserOutcome, Y as FFIDProvisionUserParams, Z as FFIDProvisionUserProfileInput, _ as FFIDProvisionUserResponse, $ as FFIDProvisionedOrganization, a0 as FFIDProvisionedUser, a1 as FFIDPublishedPlan, a2 as FFIDRemoveMemberResponse, a3 as FFIDResetSessionResponse, a4 as FFIDSubscription, a5 as FFIDUpdateMemberRoleResponse, a6 as FFIDUpdateUserProfileRequest, a7 as FFIDUploadOrganizationLogoParams, a8 as FFIDUpsertOrganizationProfileParams, a9 as FFIDUpsertOrganizationProfileRequest, aa as FFIDUser, ab as FFIDUserProfile, ac as FFID_ALLOWED_ORGANIZATION_LOGO_MIME_TYPES, ad as FFID_CATALOG_ENVIRONMENTS, ae as FFID_CATALOG_PUBLICATION_STATUSES, af as FFID_COMPANY_SIZE_CODES, ag as FFID_INDUSTRY_CODES, ah as FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_BYTES, ai as FFID_MAX_ORGANIZATION_LOGO_FILE_SIZE_MB, aj as FFID_ORGANIZATION_PROFILE_ERROR_CODES, ak as TokenData, al as TokenStore, am as createFFIDClient, an as createTokenStore } from '../ffid-client-5uxXRgIO.js';
3
3
  export { D as DEFAULT_API_BASE_URL, a as DEFAULT_OAUTH_SCOPES } from '../constants-Ce2eXQtB.js';
4
4
  import { z } from 'zod';
5
5
  import '../types-Cjb9J0rL.js';