@feelflow/ffid-sdk 2.11.0 → 2.12.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/{chunk-BEHDXUB2.cjs → chunk-5ZMR3NNO.cjs} +147 -4
- package/dist/{chunk-2OAFWUEL.js → chunk-KJUA77BM.js} +147 -5
- package/dist/components/index.cjs +8 -8
- package/dist/components/index.js +1 -1
- package/dist/index.cjs +28 -24
- package/dist/index.d.cts +70 -1
- package/dist/index.d.ts +70 -1
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +146 -4
- package/dist/server/index.d.cts +57 -0
- package/dist/server/index.d.ts +57 -0
- package/dist/server/index.js +146 -4
- package/package.json +1 -1
|
@@ -457,9 +457,118 @@ function createBillingMethods(deps) {
|
|
|
457
457
|
var EXT_PLANS_ENDPOINT = "/api/v1/subscriptions/ext/plans";
|
|
458
458
|
var EXT_SUBSCRIPTION_ENDPOINT = "/api/v1/subscriptions/ext";
|
|
459
459
|
var EXT_SUBSCRIBE_ENDPOINT = "/api/v1/subscriptions/ext/subscribe";
|
|
460
|
+
var FFIDSDKError = class extends Error {
|
|
461
|
+
code;
|
|
462
|
+
constructor(code, message) {
|
|
463
|
+
super(message);
|
|
464
|
+
this.name = "FFIDSDKError";
|
|
465
|
+
this.code = code;
|
|
466
|
+
}
|
|
467
|
+
};
|
|
460
468
|
function isBlankString(value) {
|
|
461
469
|
return typeof value !== "string" || value.trim() === "";
|
|
462
470
|
}
|
|
471
|
+
var MALFORMED_PREVIEW_CODE = "MALFORMED_PLAN_CHANGE_PREVIEW";
|
|
472
|
+
var MALFORMED_SEAT_PREVIEW_CODE = "MALFORMED_SEAT_CHANGE_PREVIEW";
|
|
473
|
+
var SEAT_ESTIMATE_REASONS = /* @__PURE__ */ new Set(["no_stripe_data", "custom_pricing", "stripe_error"]);
|
|
474
|
+
function validatePlanChangePreview(preview) {
|
|
475
|
+
if (preview === null || typeof preview !== "object") {
|
|
476
|
+
throw new FFIDSDKError(
|
|
477
|
+
MALFORMED_PREVIEW_CODE,
|
|
478
|
+
"SDK: server returned malformed PlanChangePreview \u2014 expected object, got " + (preview === null ? "null" : typeof preview)
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
const p = preview;
|
|
482
|
+
const flag = p.willApplyAtPeriodEnd;
|
|
483
|
+
if (typeof flag !== "boolean") {
|
|
484
|
+
throw new FFIDSDKError(
|
|
485
|
+
MALFORMED_PREVIEW_CODE,
|
|
486
|
+
`SDK: server returned malformed PlanChangePreview \u2014 willApplyAtPeriodEnd must be boolean (got ${typeof flag})`
|
|
487
|
+
);
|
|
488
|
+
}
|
|
489
|
+
const { proratedAmount, effectiveDate } = p;
|
|
490
|
+
if (flag === true) {
|
|
491
|
+
if (proratedAmount !== 0) {
|
|
492
|
+
throw new FFIDSDKError(
|
|
493
|
+
MALFORMED_PREVIEW_CODE,
|
|
494
|
+
`SDK: server returned malformed PlanChangePreview \u2014 willApplyAtPeriodEnd=true requires proratedAmount=0 (got ${JSON.stringify(proratedAmount)})`
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
if (effectiveDate !== null && typeof effectiveDate !== "string") {
|
|
498
|
+
throw new FFIDSDKError(
|
|
499
|
+
MALFORMED_PREVIEW_CODE,
|
|
500
|
+
`SDK: server returned malformed PlanChangePreview \u2014 willApplyAtPeriodEnd=true requires effectiveDate to be string or null (got ${typeof effectiveDate})`
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
if (effectiveDate !== null) {
|
|
506
|
+
throw new FFIDSDKError(
|
|
507
|
+
MALFORMED_PREVIEW_CODE,
|
|
508
|
+
`SDK: server returned malformed PlanChangePreview \u2014 willApplyAtPeriodEnd=false requires effectiveDate=null (got ${JSON.stringify(effectiveDate)})`
|
|
509
|
+
);
|
|
510
|
+
}
|
|
511
|
+
if (typeof proratedAmount !== "number") {
|
|
512
|
+
throw new FFIDSDKError(
|
|
513
|
+
MALFORMED_PREVIEW_CODE,
|
|
514
|
+
`SDK: server returned malformed PlanChangePreview \u2014 willApplyAtPeriodEnd=false requires proratedAmount to be a number (got ${typeof proratedAmount})`
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
function validateSeatChangePreview(preview) {
|
|
519
|
+
if (preview === null || typeof preview !== "object") {
|
|
520
|
+
throw new FFIDSDKError(
|
|
521
|
+
MALFORMED_SEAT_PREVIEW_CODE,
|
|
522
|
+
"SDK: server returned malformed SeatChangePreview \u2014 expected object, got " + (preview === null ? "null" : typeof preview)
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
const p = preview;
|
|
526
|
+
if (p.type !== "seat-change") {
|
|
527
|
+
throw new FFIDSDKError(
|
|
528
|
+
MALFORMED_SEAT_PREVIEW_CODE,
|
|
529
|
+
`SDK: server returned malformed SeatChangePreview \u2014 type must be 'seat-change' (got ${JSON.stringify(p.type)})`
|
|
530
|
+
);
|
|
531
|
+
}
|
|
532
|
+
const numericFields = [
|
|
533
|
+
"currentQuantity",
|
|
534
|
+
"newQuantity",
|
|
535
|
+
"unitPrice",
|
|
536
|
+
"proratedAmount",
|
|
537
|
+
"nextInvoiceAmount"
|
|
538
|
+
];
|
|
539
|
+
for (const key of numericFields) {
|
|
540
|
+
if (typeof p[key] !== "number") {
|
|
541
|
+
throw new FFIDSDKError(
|
|
542
|
+
MALFORMED_SEAT_PREVIEW_CODE,
|
|
543
|
+
`SDK: server returned malformed SeatChangePreview \u2014 ${key} must be a number (got ${typeof p[key]})`
|
|
544
|
+
);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
if (p.nextInvoiceDate !== null && typeof p.nextInvoiceDate !== "string") {
|
|
548
|
+
throw new FFIDSDKError(
|
|
549
|
+
MALFORMED_SEAT_PREVIEW_CODE,
|
|
550
|
+
`SDK: server returned malformed SeatChangePreview \u2014 nextInvoiceDate must be string or null (got ${typeof p.nextInvoiceDate})`
|
|
551
|
+
);
|
|
552
|
+
}
|
|
553
|
+
if (typeof p.isEstimate !== "boolean") {
|
|
554
|
+
throw new FFIDSDKError(
|
|
555
|
+
MALFORMED_SEAT_PREVIEW_CODE,
|
|
556
|
+
`SDK: server returned malformed SeatChangePreview \u2014 isEstimate must be boolean (got ${typeof p.isEstimate})`
|
|
557
|
+
);
|
|
558
|
+
}
|
|
559
|
+
if (p.estimateReason !== void 0 && !SEAT_ESTIMATE_REASONS.has(p.estimateReason)) {
|
|
560
|
+
throw new FFIDSDKError(
|
|
561
|
+
MALFORMED_SEAT_PREVIEW_CODE,
|
|
562
|
+
`SDK: server returned malformed SeatChangePreview \u2014 estimateReason must be one of 'no_stripe_data' | 'custom_pricing' | 'stripe_error' (got ${JSON.stringify(p.estimateReason)})`
|
|
563
|
+
);
|
|
564
|
+
}
|
|
565
|
+
if (!Array.isArray(p.lineItems)) {
|
|
566
|
+
throw new FFIDSDKError(
|
|
567
|
+
MALFORMED_SEAT_PREVIEW_CODE,
|
|
568
|
+
`SDK: server returned malformed SeatChangePreview \u2014 lineItems must be an array (got ${typeof p.lineItems})`
|
|
569
|
+
);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
463
572
|
function createSubscriptionMethods(deps) {
|
|
464
573
|
const { fetchWithAuth, createError } = deps;
|
|
465
574
|
async function listPlans() {
|
|
@@ -546,7 +655,7 @@ function createSubscriptionMethods(deps) {
|
|
|
546
655
|
error: createError("VALIDATION_ERROR", "subscriptionId \u3068 planCode \u306F\u5FC5\u9808\u3067\u3059")
|
|
547
656
|
};
|
|
548
657
|
}
|
|
549
|
-
|
|
658
|
+
const response = await fetchWithAuth(
|
|
550
659
|
`${EXT_SUBSCRIPTION_ENDPOINT}/${encodeURIComponent(params.subscriptionId)}/plan/preview`,
|
|
551
660
|
{
|
|
552
661
|
method: "POST",
|
|
@@ -556,6 +665,36 @@ function createSubscriptionMethods(deps) {
|
|
|
556
665
|
})
|
|
557
666
|
}
|
|
558
667
|
);
|
|
668
|
+
if (response.data !== void 0) {
|
|
669
|
+
validatePlanChangePreview(response.data.preview);
|
|
670
|
+
}
|
|
671
|
+
return response;
|
|
672
|
+
}
|
|
673
|
+
async function previewSeatChange(params) {
|
|
674
|
+
if (isBlankString(params.subscriptionId)) {
|
|
675
|
+
return {
|
|
676
|
+
error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
|
|
677
|
+
};
|
|
678
|
+
}
|
|
679
|
+
if (typeof params.quantity !== "number" || !Number.isInteger(params.quantity) || params.quantity < 1) {
|
|
680
|
+
return {
|
|
681
|
+
error: createError(
|
|
682
|
+
"VALIDATION_ERROR",
|
|
683
|
+
`quantity \u306F 1 \u4EE5\u4E0A\u306E\u6574\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059 (received: ${String(params.quantity)})`
|
|
684
|
+
)
|
|
685
|
+
};
|
|
686
|
+
}
|
|
687
|
+
const response = await fetchWithAuth(
|
|
688
|
+
`${EXT_SUBSCRIPTION_ENDPOINT}/${encodeURIComponent(params.subscriptionId)}/seats/preview`,
|
|
689
|
+
{
|
|
690
|
+
method: "POST",
|
|
691
|
+
body: JSON.stringify({ quantity: params.quantity })
|
|
692
|
+
}
|
|
693
|
+
);
|
|
694
|
+
if (response.data !== void 0) {
|
|
695
|
+
validateSeatChangePreview(response.data.preview);
|
|
696
|
+
}
|
|
697
|
+
return response;
|
|
559
698
|
}
|
|
560
699
|
return {
|
|
561
700
|
listPlans,
|
|
@@ -564,7 +703,8 @@ function createSubscriptionMethods(deps) {
|
|
|
564
703
|
changePlan,
|
|
565
704
|
cancelSubscription,
|
|
566
705
|
cancelPendingDowngrade,
|
|
567
|
-
previewPlanChange
|
|
706
|
+
previewPlanChange,
|
|
707
|
+
previewSeatChange
|
|
568
708
|
};
|
|
569
709
|
}
|
|
570
710
|
|
|
@@ -621,7 +761,7 @@ function createMembersMethods(deps) {
|
|
|
621
761
|
}
|
|
622
762
|
|
|
623
763
|
// src/client/version-check.ts
|
|
624
|
-
var SDK_VERSION = "2.
|
|
764
|
+
var SDK_VERSION = "2.12.0";
|
|
625
765
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
626
766
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
627
767
|
function sdkHeaders() {
|
|
@@ -1958,7 +2098,8 @@ function createFFIDClient(config) {
|
|
|
1958
2098
|
changePlan,
|
|
1959
2099
|
cancelSubscription,
|
|
1960
2100
|
cancelPendingDowngrade,
|
|
1961
|
-
previewPlanChange
|
|
2101
|
+
previewPlanChange,
|
|
2102
|
+
previewSeatChange
|
|
1962
2103
|
} = createSubscriptionMethods({
|
|
1963
2104
|
fetchWithAuth,
|
|
1964
2105
|
createError
|
|
@@ -2048,6 +2189,7 @@ function createFFIDClient(config) {
|
|
|
2048
2189
|
cancelSubscription,
|
|
2049
2190
|
cancelPendingDowngrade,
|
|
2050
2191
|
previewPlanChange,
|
|
2192
|
+
previewSeatChange,
|
|
2051
2193
|
verifyAccessToken,
|
|
2052
2194
|
getSubscribeUrl,
|
|
2053
2195
|
redirectToSubscribe,
|
|
@@ -3982,6 +4124,7 @@ exports.FFIDInquiryForm = FFIDInquiryForm;
|
|
|
3982
4124
|
exports.FFIDLoginButton = FFIDLoginButton;
|
|
3983
4125
|
exports.FFIDOrganizationSwitcher = FFIDOrganizationSwitcher;
|
|
3984
4126
|
exports.FFIDProvider = FFIDProvider;
|
|
4127
|
+
exports.FFIDSDKError = FFIDSDKError;
|
|
3985
4128
|
exports.FFIDSubscriptionBadge = FFIDSubscriptionBadge;
|
|
3986
4129
|
exports.FFIDUserMenu = FFIDUserMenu;
|
|
3987
4130
|
exports.FFID_ANNOUNCEMENTS_ERROR_CODES = FFID_ANNOUNCEMENTS_ERROR_CODES;
|
|
@@ -455,9 +455,118 @@ function createBillingMethods(deps) {
|
|
|
455
455
|
var EXT_PLANS_ENDPOINT = "/api/v1/subscriptions/ext/plans";
|
|
456
456
|
var EXT_SUBSCRIPTION_ENDPOINT = "/api/v1/subscriptions/ext";
|
|
457
457
|
var EXT_SUBSCRIBE_ENDPOINT = "/api/v1/subscriptions/ext/subscribe";
|
|
458
|
+
var FFIDSDKError = class extends Error {
|
|
459
|
+
code;
|
|
460
|
+
constructor(code, message) {
|
|
461
|
+
super(message);
|
|
462
|
+
this.name = "FFIDSDKError";
|
|
463
|
+
this.code = code;
|
|
464
|
+
}
|
|
465
|
+
};
|
|
458
466
|
function isBlankString(value) {
|
|
459
467
|
return typeof value !== "string" || value.trim() === "";
|
|
460
468
|
}
|
|
469
|
+
var MALFORMED_PREVIEW_CODE = "MALFORMED_PLAN_CHANGE_PREVIEW";
|
|
470
|
+
var MALFORMED_SEAT_PREVIEW_CODE = "MALFORMED_SEAT_CHANGE_PREVIEW";
|
|
471
|
+
var SEAT_ESTIMATE_REASONS = /* @__PURE__ */ new Set(["no_stripe_data", "custom_pricing", "stripe_error"]);
|
|
472
|
+
function validatePlanChangePreview(preview) {
|
|
473
|
+
if (preview === null || typeof preview !== "object") {
|
|
474
|
+
throw new FFIDSDKError(
|
|
475
|
+
MALFORMED_PREVIEW_CODE,
|
|
476
|
+
"SDK: server returned malformed PlanChangePreview \u2014 expected object, got " + (preview === null ? "null" : typeof preview)
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
const p = preview;
|
|
480
|
+
const flag = p.willApplyAtPeriodEnd;
|
|
481
|
+
if (typeof flag !== "boolean") {
|
|
482
|
+
throw new FFIDSDKError(
|
|
483
|
+
MALFORMED_PREVIEW_CODE,
|
|
484
|
+
`SDK: server returned malformed PlanChangePreview \u2014 willApplyAtPeriodEnd must be boolean (got ${typeof flag})`
|
|
485
|
+
);
|
|
486
|
+
}
|
|
487
|
+
const { proratedAmount, effectiveDate } = p;
|
|
488
|
+
if (flag === true) {
|
|
489
|
+
if (proratedAmount !== 0) {
|
|
490
|
+
throw new FFIDSDKError(
|
|
491
|
+
MALFORMED_PREVIEW_CODE,
|
|
492
|
+
`SDK: server returned malformed PlanChangePreview \u2014 willApplyAtPeriodEnd=true requires proratedAmount=0 (got ${JSON.stringify(proratedAmount)})`
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
if (effectiveDate !== null && typeof effectiveDate !== "string") {
|
|
496
|
+
throw new FFIDSDKError(
|
|
497
|
+
MALFORMED_PREVIEW_CODE,
|
|
498
|
+
`SDK: server returned malformed PlanChangePreview \u2014 willApplyAtPeriodEnd=true requires effectiveDate to be string or null (got ${typeof effectiveDate})`
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
if (effectiveDate !== null) {
|
|
504
|
+
throw new FFIDSDKError(
|
|
505
|
+
MALFORMED_PREVIEW_CODE,
|
|
506
|
+
`SDK: server returned malformed PlanChangePreview \u2014 willApplyAtPeriodEnd=false requires effectiveDate=null (got ${JSON.stringify(effectiveDate)})`
|
|
507
|
+
);
|
|
508
|
+
}
|
|
509
|
+
if (typeof proratedAmount !== "number") {
|
|
510
|
+
throw new FFIDSDKError(
|
|
511
|
+
MALFORMED_PREVIEW_CODE,
|
|
512
|
+
`SDK: server returned malformed PlanChangePreview \u2014 willApplyAtPeriodEnd=false requires proratedAmount to be a number (got ${typeof proratedAmount})`
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
function validateSeatChangePreview(preview) {
|
|
517
|
+
if (preview === null || typeof preview !== "object") {
|
|
518
|
+
throw new FFIDSDKError(
|
|
519
|
+
MALFORMED_SEAT_PREVIEW_CODE,
|
|
520
|
+
"SDK: server returned malformed SeatChangePreview \u2014 expected object, got " + (preview === null ? "null" : typeof preview)
|
|
521
|
+
);
|
|
522
|
+
}
|
|
523
|
+
const p = preview;
|
|
524
|
+
if (p.type !== "seat-change") {
|
|
525
|
+
throw new FFIDSDKError(
|
|
526
|
+
MALFORMED_SEAT_PREVIEW_CODE,
|
|
527
|
+
`SDK: server returned malformed SeatChangePreview \u2014 type must be 'seat-change' (got ${JSON.stringify(p.type)})`
|
|
528
|
+
);
|
|
529
|
+
}
|
|
530
|
+
const numericFields = [
|
|
531
|
+
"currentQuantity",
|
|
532
|
+
"newQuantity",
|
|
533
|
+
"unitPrice",
|
|
534
|
+
"proratedAmount",
|
|
535
|
+
"nextInvoiceAmount"
|
|
536
|
+
];
|
|
537
|
+
for (const key of numericFields) {
|
|
538
|
+
if (typeof p[key] !== "number") {
|
|
539
|
+
throw new FFIDSDKError(
|
|
540
|
+
MALFORMED_SEAT_PREVIEW_CODE,
|
|
541
|
+
`SDK: server returned malformed SeatChangePreview \u2014 ${key} must be a number (got ${typeof p[key]})`
|
|
542
|
+
);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
if (p.nextInvoiceDate !== null && typeof p.nextInvoiceDate !== "string") {
|
|
546
|
+
throw new FFIDSDKError(
|
|
547
|
+
MALFORMED_SEAT_PREVIEW_CODE,
|
|
548
|
+
`SDK: server returned malformed SeatChangePreview \u2014 nextInvoiceDate must be string or null (got ${typeof p.nextInvoiceDate})`
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
if (typeof p.isEstimate !== "boolean") {
|
|
552
|
+
throw new FFIDSDKError(
|
|
553
|
+
MALFORMED_SEAT_PREVIEW_CODE,
|
|
554
|
+
`SDK: server returned malformed SeatChangePreview \u2014 isEstimate must be boolean (got ${typeof p.isEstimate})`
|
|
555
|
+
);
|
|
556
|
+
}
|
|
557
|
+
if (p.estimateReason !== void 0 && !SEAT_ESTIMATE_REASONS.has(p.estimateReason)) {
|
|
558
|
+
throw new FFIDSDKError(
|
|
559
|
+
MALFORMED_SEAT_PREVIEW_CODE,
|
|
560
|
+
`SDK: server returned malformed SeatChangePreview \u2014 estimateReason must be one of 'no_stripe_data' | 'custom_pricing' | 'stripe_error' (got ${JSON.stringify(p.estimateReason)})`
|
|
561
|
+
);
|
|
562
|
+
}
|
|
563
|
+
if (!Array.isArray(p.lineItems)) {
|
|
564
|
+
throw new FFIDSDKError(
|
|
565
|
+
MALFORMED_SEAT_PREVIEW_CODE,
|
|
566
|
+
`SDK: server returned malformed SeatChangePreview \u2014 lineItems must be an array (got ${typeof p.lineItems})`
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
461
570
|
function createSubscriptionMethods(deps) {
|
|
462
571
|
const { fetchWithAuth, createError } = deps;
|
|
463
572
|
async function listPlans() {
|
|
@@ -544,7 +653,7 @@ function createSubscriptionMethods(deps) {
|
|
|
544
653
|
error: createError("VALIDATION_ERROR", "subscriptionId \u3068 planCode \u306F\u5FC5\u9808\u3067\u3059")
|
|
545
654
|
};
|
|
546
655
|
}
|
|
547
|
-
|
|
656
|
+
const response = await fetchWithAuth(
|
|
548
657
|
`${EXT_SUBSCRIPTION_ENDPOINT}/${encodeURIComponent(params.subscriptionId)}/plan/preview`,
|
|
549
658
|
{
|
|
550
659
|
method: "POST",
|
|
@@ -554,6 +663,36 @@ function createSubscriptionMethods(deps) {
|
|
|
554
663
|
})
|
|
555
664
|
}
|
|
556
665
|
);
|
|
666
|
+
if (response.data !== void 0) {
|
|
667
|
+
validatePlanChangePreview(response.data.preview);
|
|
668
|
+
}
|
|
669
|
+
return response;
|
|
670
|
+
}
|
|
671
|
+
async function previewSeatChange(params) {
|
|
672
|
+
if (isBlankString(params.subscriptionId)) {
|
|
673
|
+
return {
|
|
674
|
+
error: createError("VALIDATION_ERROR", "subscriptionId \u306F\u5FC5\u9808\u3067\u3059")
|
|
675
|
+
};
|
|
676
|
+
}
|
|
677
|
+
if (typeof params.quantity !== "number" || !Number.isInteger(params.quantity) || params.quantity < 1) {
|
|
678
|
+
return {
|
|
679
|
+
error: createError(
|
|
680
|
+
"VALIDATION_ERROR",
|
|
681
|
+
`quantity \u306F 1 \u4EE5\u4E0A\u306E\u6574\u6570\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059 (received: ${String(params.quantity)})`
|
|
682
|
+
)
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
const response = await fetchWithAuth(
|
|
686
|
+
`${EXT_SUBSCRIPTION_ENDPOINT}/${encodeURIComponent(params.subscriptionId)}/seats/preview`,
|
|
687
|
+
{
|
|
688
|
+
method: "POST",
|
|
689
|
+
body: JSON.stringify({ quantity: params.quantity })
|
|
690
|
+
}
|
|
691
|
+
);
|
|
692
|
+
if (response.data !== void 0) {
|
|
693
|
+
validateSeatChangePreview(response.data.preview);
|
|
694
|
+
}
|
|
695
|
+
return response;
|
|
557
696
|
}
|
|
558
697
|
return {
|
|
559
698
|
listPlans,
|
|
@@ -562,7 +701,8 @@ function createSubscriptionMethods(deps) {
|
|
|
562
701
|
changePlan,
|
|
563
702
|
cancelSubscription,
|
|
564
703
|
cancelPendingDowngrade,
|
|
565
|
-
previewPlanChange
|
|
704
|
+
previewPlanChange,
|
|
705
|
+
previewSeatChange
|
|
566
706
|
};
|
|
567
707
|
}
|
|
568
708
|
|
|
@@ -619,7 +759,7 @@ function createMembersMethods(deps) {
|
|
|
619
759
|
}
|
|
620
760
|
|
|
621
761
|
// src/client/version-check.ts
|
|
622
|
-
var SDK_VERSION = "2.
|
|
762
|
+
var SDK_VERSION = "2.12.0";
|
|
623
763
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
624
764
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
625
765
|
function sdkHeaders() {
|
|
@@ -1956,7 +2096,8 @@ function createFFIDClient(config) {
|
|
|
1956
2096
|
changePlan,
|
|
1957
2097
|
cancelSubscription,
|
|
1958
2098
|
cancelPendingDowngrade,
|
|
1959
|
-
previewPlanChange
|
|
2099
|
+
previewPlanChange,
|
|
2100
|
+
previewSeatChange
|
|
1960
2101
|
} = createSubscriptionMethods({
|
|
1961
2102
|
fetchWithAuth,
|
|
1962
2103
|
createError
|
|
@@ -2046,6 +2187,7 @@ function createFFIDClient(config) {
|
|
|
2046
2187
|
cancelSubscription,
|
|
2047
2188
|
cancelPendingDowngrade,
|
|
2048
2189
|
previewPlanChange,
|
|
2190
|
+
previewSeatChange,
|
|
2049
2191
|
verifyAccessToken,
|
|
2050
2192
|
getSubscribeUrl,
|
|
2051
2193
|
redirectToSubscribe,
|
|
@@ -3973,4 +4115,4 @@ function FFIDInquiryForm({
|
|
|
3973
4115
|
);
|
|
3974
4116
|
}
|
|
3975
4117
|
|
|
3976
|
-
export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_INQUIRY_CATEGORIES, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useFFIDContext, useSubscription, withSubscription };
|
|
4118
|
+
export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSDKError, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, FFID_INQUIRY_CATEGORIES, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useFFIDContext, useSubscription, withSubscription };
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk5ZMR3NNO_cjs = require('../chunk-5ZMR3NNO.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "FFIDAnnouncementBadge", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFIDAnnouncementBadge; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFIDAnnouncementList; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "FFIDInquiryForm", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFIDInquiryForm; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFIDLoginButton; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFIDOrganizationSwitcher; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFIDSubscriptionBadge; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFIDUserMenu; }
|
|
34
34
|
});
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-
|
|
1
|
+
export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDInquiryForm, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-KJUA77BM.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk5ZMR3NNO_cjs = require('./chunk-5ZMR3NNO.cjs');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
|
|
@@ -46,7 +46,7 @@ function createKVCacheAdapter(kv) {
|
|
|
46
46
|
}
|
|
47
47
|
function withFFIDAuth(Component, options = {}) {
|
|
48
48
|
const WrappedComponent = (props) => {
|
|
49
|
-
const { isLoading, isAuthenticated, login } =
|
|
49
|
+
const { isLoading, isAuthenticated, login } = chunk5ZMR3NNO_cjs.useFFIDContext();
|
|
50
50
|
const hasRedirected = react.useRef(false);
|
|
51
51
|
react.useEffect(() => {
|
|
52
52
|
if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
|
|
@@ -74,91 +74,95 @@ var FFID_NEWSLETTER_TYPES = ["inquiry_followup", "general"];
|
|
|
74
74
|
|
|
75
75
|
Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
|
|
76
76
|
enumerable: true,
|
|
77
|
-
get: function () { return
|
|
77
|
+
get: function () { return chunk5ZMR3NNO_cjs.DEFAULT_API_BASE_URL; }
|
|
78
78
|
});
|
|
79
79
|
Object.defineProperty(exports, "FFIDAnnouncementBadge", {
|
|
80
80
|
enumerable: true,
|
|
81
|
-
get: function () { return
|
|
81
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFIDAnnouncementBadge; }
|
|
82
82
|
});
|
|
83
83
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
84
84
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
85
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFIDAnnouncementList; }
|
|
86
86
|
});
|
|
87
87
|
Object.defineProperty(exports, "FFIDInquiryForm", {
|
|
88
88
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
89
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFIDInquiryForm; }
|
|
90
90
|
});
|
|
91
91
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
92
92
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
93
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFIDLoginButton; }
|
|
94
94
|
});
|
|
95
95
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
96
96
|
enumerable: true,
|
|
97
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFIDOrganizationSwitcher; }
|
|
98
98
|
});
|
|
99
99
|
Object.defineProperty(exports, "FFIDProvider", {
|
|
100
100
|
enumerable: true,
|
|
101
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFIDProvider; }
|
|
102
|
+
});
|
|
103
|
+
Object.defineProperty(exports, "FFIDSDKError", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFIDSDKError; }
|
|
102
106
|
});
|
|
103
107
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
104
108
|
enumerable: true,
|
|
105
|
-
get: function () { return
|
|
109
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFIDSubscriptionBadge; }
|
|
106
110
|
});
|
|
107
111
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
108
112
|
enumerable: true,
|
|
109
|
-
get: function () { return
|
|
113
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFIDUserMenu; }
|
|
110
114
|
});
|
|
111
115
|
Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
|
|
112
116
|
enumerable: true,
|
|
113
|
-
get: function () { return
|
|
117
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
|
|
114
118
|
});
|
|
115
119
|
Object.defineProperty(exports, "FFID_INQUIRY_CATEGORIES", {
|
|
116
120
|
enumerable: true,
|
|
117
|
-
get: function () { return
|
|
121
|
+
get: function () { return chunk5ZMR3NNO_cjs.FFID_INQUIRY_CATEGORIES; }
|
|
118
122
|
});
|
|
119
123
|
Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
|
|
120
124
|
enumerable: true,
|
|
121
|
-
get: function () { return
|
|
125
|
+
get: function () { return chunk5ZMR3NNO_cjs.createFFIDAnnouncementsClient; }
|
|
122
126
|
});
|
|
123
127
|
Object.defineProperty(exports, "createFFIDClient", {
|
|
124
128
|
enumerable: true,
|
|
125
|
-
get: function () { return
|
|
129
|
+
get: function () { return chunk5ZMR3NNO_cjs.createFFIDClient; }
|
|
126
130
|
});
|
|
127
131
|
Object.defineProperty(exports, "createTokenStore", {
|
|
128
132
|
enumerable: true,
|
|
129
|
-
get: function () { return
|
|
133
|
+
get: function () { return chunk5ZMR3NNO_cjs.createTokenStore; }
|
|
130
134
|
});
|
|
131
135
|
Object.defineProperty(exports, "generateCodeChallenge", {
|
|
132
136
|
enumerable: true,
|
|
133
|
-
get: function () { return
|
|
137
|
+
get: function () { return chunk5ZMR3NNO_cjs.generateCodeChallenge; }
|
|
134
138
|
});
|
|
135
139
|
Object.defineProperty(exports, "generateCodeVerifier", {
|
|
136
140
|
enumerable: true,
|
|
137
|
-
get: function () { return
|
|
141
|
+
get: function () { return chunk5ZMR3NNO_cjs.generateCodeVerifier; }
|
|
138
142
|
});
|
|
139
143
|
Object.defineProperty(exports, "retrieveCodeVerifier", {
|
|
140
144
|
enumerable: true,
|
|
141
|
-
get: function () { return
|
|
145
|
+
get: function () { return chunk5ZMR3NNO_cjs.retrieveCodeVerifier; }
|
|
142
146
|
});
|
|
143
147
|
Object.defineProperty(exports, "storeCodeVerifier", {
|
|
144
148
|
enumerable: true,
|
|
145
|
-
get: function () { return
|
|
149
|
+
get: function () { return chunk5ZMR3NNO_cjs.storeCodeVerifier; }
|
|
146
150
|
});
|
|
147
151
|
Object.defineProperty(exports, "useFFID", {
|
|
148
152
|
enumerable: true,
|
|
149
|
-
get: function () { return
|
|
153
|
+
get: function () { return chunk5ZMR3NNO_cjs.useFFID; }
|
|
150
154
|
});
|
|
151
155
|
Object.defineProperty(exports, "useFFIDAnnouncements", {
|
|
152
156
|
enumerable: true,
|
|
153
|
-
get: function () { return
|
|
157
|
+
get: function () { return chunk5ZMR3NNO_cjs.useFFIDAnnouncements; }
|
|
154
158
|
});
|
|
155
159
|
Object.defineProperty(exports, "useSubscription", {
|
|
156
160
|
enumerable: true,
|
|
157
|
-
get: function () { return
|
|
161
|
+
get: function () { return chunk5ZMR3NNO_cjs.useSubscription; }
|
|
158
162
|
});
|
|
159
163
|
Object.defineProperty(exports, "withSubscription", {
|
|
160
164
|
enumerable: true,
|
|
161
|
-
get: function () { return
|
|
165
|
+
get: function () { return chunk5ZMR3NNO_cjs.withSubscription; }
|
|
162
166
|
});
|
|
163
167
|
exports.FFID_NEWSLETTER_TYPES = FFID_NEWSLETTER_TYPES;
|
|
164
168
|
exports.createKVCacheAdapter = createKVCacheAdapter;
|