@feelflow/ffid-sdk 1.19.1 → 2.1.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-JT7IIDMS.cjs → chunk-C6Z4JPYE.cjs} +123 -2
- package/dist/{chunk-66HJMEHY.js → chunk-NHVOLBE5.js} +123 -2
- package/dist/components/index.cjs +7 -7
- package/dist/components/index.js +1 -1
- package/dist/index.cjs +22 -22
- package/dist/index.d.cts +54 -1
- package/dist/index.d.ts +54 -1
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +112 -1
- package/dist/server/index.d.cts +31 -0
- package/dist/server/index.d.ts +31 -0
- package/dist/server/index.js +112 -1
- package/package.json +3 -1
|
@@ -600,7 +600,7 @@ function createMembersMethods(deps) {
|
|
|
600
600
|
}
|
|
601
601
|
|
|
602
602
|
// src/client/version-check.ts
|
|
603
|
-
var SDK_VERSION = "1.
|
|
603
|
+
var SDK_VERSION = "2.1.0";
|
|
604
604
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
605
605
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
606
606
|
function sdkHeaders() {
|
|
@@ -1461,6 +1461,86 @@ function createOtpMethods(deps) {
|
|
|
1461
1461
|
};
|
|
1462
1462
|
}
|
|
1463
1463
|
|
|
1464
|
+
// src/client/contract-wizard-methods.ts
|
|
1465
|
+
var CONTRACT_WIZARD_PATH = "/contract-wizard";
|
|
1466
|
+
function buildWizardUrl(baseUrl, flow, params) {
|
|
1467
|
+
const query = new URLSearchParams();
|
|
1468
|
+
query.set("flow", flow);
|
|
1469
|
+
for (const [key, value] of Object.entries(params)) {
|
|
1470
|
+
if (value !== void 0) {
|
|
1471
|
+
query.set(key, value);
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
return `${baseUrl}${CONTRACT_WIZARD_PATH}?${query.toString()}`;
|
|
1475
|
+
}
|
|
1476
|
+
function performRedirect(url, logger) {
|
|
1477
|
+
if (typeof window === "undefined") {
|
|
1478
|
+
logger.warn("SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093");
|
|
1479
|
+
return { success: false, error: "SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093" };
|
|
1480
|
+
}
|
|
1481
|
+
logger.debug("Redirecting to contract wizard:", url);
|
|
1482
|
+
window.location.href = url;
|
|
1483
|
+
return { success: true };
|
|
1484
|
+
}
|
|
1485
|
+
function createContractWizardMethods(deps) {
|
|
1486
|
+
const { baseUrl, serviceCode, logger } = deps;
|
|
1487
|
+
function buildSubscriptionWizardUrl(flow, subscriptionId, options) {
|
|
1488
|
+
return buildWizardUrl(baseUrl, flow, {
|
|
1489
|
+
service: serviceCode,
|
|
1490
|
+
subscription: subscriptionId,
|
|
1491
|
+
redirect: options?.redirect
|
|
1492
|
+
});
|
|
1493
|
+
}
|
|
1494
|
+
function getSubscribeUrl(options) {
|
|
1495
|
+
return buildWizardUrl(baseUrl, "new-subscription", {
|
|
1496
|
+
service: serviceCode,
|
|
1497
|
+
redirect: options?.redirect
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
function redirectToSubscribe(options) {
|
|
1501
|
+
return performRedirect(getSubscribeUrl(options), logger);
|
|
1502
|
+
}
|
|
1503
|
+
function getChangePlanUrl(subscriptionId, options) {
|
|
1504
|
+
return buildSubscriptionWizardUrl("change-plan", subscriptionId, options);
|
|
1505
|
+
}
|
|
1506
|
+
function redirectToChangePlan(subscriptionId, options) {
|
|
1507
|
+
return performRedirect(getChangePlanUrl(subscriptionId, options), logger);
|
|
1508
|
+
}
|
|
1509
|
+
function getChangeSeatsUrl(subscriptionId, options) {
|
|
1510
|
+
return buildSubscriptionWizardUrl("change-seats", subscriptionId, options);
|
|
1511
|
+
}
|
|
1512
|
+
function redirectToChangeSeats(subscriptionId, options) {
|
|
1513
|
+
return performRedirect(getChangeSeatsUrl(subscriptionId, options), logger);
|
|
1514
|
+
}
|
|
1515
|
+
function getRecoverPaymentUrl(subscriptionId, options) {
|
|
1516
|
+
return buildSubscriptionWizardUrl("payment-recovery", subscriptionId, options);
|
|
1517
|
+
}
|
|
1518
|
+
function redirectToRecoverPayment(subscriptionId, options) {
|
|
1519
|
+
return performRedirect(getRecoverPaymentUrl(subscriptionId, options), logger);
|
|
1520
|
+
}
|
|
1521
|
+
function getResubscribeUrl(options) {
|
|
1522
|
+
return buildWizardUrl(baseUrl, "resubscribe", {
|
|
1523
|
+
service: options?.serviceCode ?? serviceCode,
|
|
1524
|
+
redirect: options?.redirect
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
function redirectToResubscribe(options) {
|
|
1528
|
+
return performRedirect(getResubscribeUrl(options), logger);
|
|
1529
|
+
}
|
|
1530
|
+
return {
|
|
1531
|
+
getSubscribeUrl,
|
|
1532
|
+
redirectToSubscribe,
|
|
1533
|
+
getChangePlanUrl,
|
|
1534
|
+
redirectToChangePlan,
|
|
1535
|
+
getChangeSeatsUrl,
|
|
1536
|
+
redirectToChangeSeats,
|
|
1537
|
+
getRecoverPaymentUrl,
|
|
1538
|
+
redirectToRecoverPayment,
|
|
1539
|
+
getResubscribeUrl,
|
|
1540
|
+
redirectToResubscribe
|
|
1541
|
+
};
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1464
1544
|
// src/client/ffid-client.ts
|
|
1465
1545
|
var UNAUTHORIZED_STATUS2 = 401;
|
|
1466
1546
|
var SDK_LOG_PREFIX = "[FFID SDK]";
|
|
@@ -1660,6 +1740,11 @@ function createFFIDClient(config) {
|
|
|
1660
1740
|
error: createError("VALIDATION_ERROR", "organizationId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1661
1741
|
};
|
|
1662
1742
|
}
|
|
1743
|
+
if (authMode === "token" && (params.userId === void 0 || !params.userId.trim())) {
|
|
1744
|
+
return {
|
|
1745
|
+
error: createError("VALIDATION_ERROR", "token \u30E2\u30FC\u30C9\u3067\u306F userId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1746
|
+
};
|
|
1747
|
+
}
|
|
1663
1748
|
if (params.userId !== void 0 && !params.userId.trim()) {
|
|
1664
1749
|
return {
|
|
1665
1750
|
error: createError("VALIDATION_ERROR", "userId \u3092\u6307\u5B9A\u3059\u308B\u5834\u5408\u3001\u7A7A\u6587\u5B57\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093")
|
|
@@ -1708,6 +1793,22 @@ function createFFIDClient(config) {
|
|
|
1708
1793
|
fetchWithAuth,
|
|
1709
1794
|
errorCodes: FFID_ERROR_CODES
|
|
1710
1795
|
});
|
|
1796
|
+
const {
|
|
1797
|
+
getSubscribeUrl,
|
|
1798
|
+
redirectToSubscribe,
|
|
1799
|
+
getChangePlanUrl,
|
|
1800
|
+
redirectToChangePlan,
|
|
1801
|
+
getChangeSeatsUrl,
|
|
1802
|
+
redirectToChangeSeats,
|
|
1803
|
+
getRecoverPaymentUrl,
|
|
1804
|
+
redirectToRecoverPayment,
|
|
1805
|
+
getResubscribeUrl,
|
|
1806
|
+
redirectToResubscribe
|
|
1807
|
+
} = createContractWizardMethods({
|
|
1808
|
+
baseUrl,
|
|
1809
|
+
serviceCode: config.serviceCode,
|
|
1810
|
+
logger
|
|
1811
|
+
});
|
|
1711
1812
|
const { sendOtp, verifyOtp } = createOtpMethods({
|
|
1712
1813
|
baseUrl,
|
|
1713
1814
|
logger,
|
|
@@ -1751,6 +1852,16 @@ function createFFIDClient(config) {
|
|
|
1751
1852
|
cancelSubscription,
|
|
1752
1853
|
previewPlanChange,
|
|
1753
1854
|
verifyAccessToken,
|
|
1855
|
+
getSubscribeUrl,
|
|
1856
|
+
redirectToSubscribe,
|
|
1857
|
+
getChangePlanUrl,
|
|
1858
|
+
redirectToChangePlan,
|
|
1859
|
+
getChangeSeatsUrl,
|
|
1860
|
+
redirectToChangeSeats,
|
|
1861
|
+
getRecoverPaymentUrl,
|
|
1862
|
+
redirectToRecoverPayment,
|
|
1863
|
+
getResubscribeUrl,
|
|
1864
|
+
redirectToResubscribe,
|
|
1754
1865
|
requestPasswordReset,
|
|
1755
1866
|
verifyPasswordResetToken,
|
|
1756
1867
|
establishResetSession,
|
|
@@ -2066,7 +2177,17 @@ function useFFID() {
|
|
|
2066
2177
|
switchOrganization: context.switchOrganization,
|
|
2067
2178
|
refresh: context.refresh,
|
|
2068
2179
|
getLoginUrl: client.getLoginUrl,
|
|
2069
|
-
getSignupUrl: client.getSignupUrl
|
|
2180
|
+
getSignupUrl: client.getSignupUrl,
|
|
2181
|
+
getSubscribeUrl: client.getSubscribeUrl,
|
|
2182
|
+
redirectToSubscribe: client.redirectToSubscribe,
|
|
2183
|
+
getChangePlanUrl: client.getChangePlanUrl,
|
|
2184
|
+
redirectToChangePlan: client.redirectToChangePlan,
|
|
2185
|
+
getChangeSeatsUrl: client.getChangeSeatsUrl,
|
|
2186
|
+
redirectToChangeSeats: client.redirectToChangeSeats,
|
|
2187
|
+
getRecoverPaymentUrl: client.getRecoverPaymentUrl,
|
|
2188
|
+
redirectToRecoverPayment: client.redirectToRecoverPayment,
|
|
2189
|
+
getResubscribeUrl: client.getResubscribeUrl,
|
|
2190
|
+
redirectToResubscribe: client.redirectToResubscribe
|
|
2070
2191
|
};
|
|
2071
2192
|
}
|
|
2072
2193
|
function FFIDLoginButton({
|
|
@@ -598,7 +598,7 @@ function createMembersMethods(deps) {
|
|
|
598
598
|
}
|
|
599
599
|
|
|
600
600
|
// src/client/version-check.ts
|
|
601
|
-
var SDK_VERSION = "1.
|
|
601
|
+
var SDK_VERSION = "2.1.0";
|
|
602
602
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
603
603
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
604
604
|
function sdkHeaders() {
|
|
@@ -1459,6 +1459,86 @@ function createOtpMethods(deps) {
|
|
|
1459
1459
|
};
|
|
1460
1460
|
}
|
|
1461
1461
|
|
|
1462
|
+
// src/client/contract-wizard-methods.ts
|
|
1463
|
+
var CONTRACT_WIZARD_PATH = "/contract-wizard";
|
|
1464
|
+
function buildWizardUrl(baseUrl, flow, params) {
|
|
1465
|
+
const query = new URLSearchParams();
|
|
1466
|
+
query.set("flow", flow);
|
|
1467
|
+
for (const [key, value] of Object.entries(params)) {
|
|
1468
|
+
if (value !== void 0) {
|
|
1469
|
+
query.set(key, value);
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
return `${baseUrl}${CONTRACT_WIZARD_PATH}?${query.toString()}`;
|
|
1473
|
+
}
|
|
1474
|
+
function performRedirect(url, logger) {
|
|
1475
|
+
if (typeof window === "undefined") {
|
|
1476
|
+
logger.warn("SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093");
|
|
1477
|
+
return { success: false, error: "SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093" };
|
|
1478
|
+
}
|
|
1479
|
+
logger.debug("Redirecting to contract wizard:", url);
|
|
1480
|
+
window.location.href = url;
|
|
1481
|
+
return { success: true };
|
|
1482
|
+
}
|
|
1483
|
+
function createContractWizardMethods(deps) {
|
|
1484
|
+
const { baseUrl, serviceCode, logger } = deps;
|
|
1485
|
+
function buildSubscriptionWizardUrl(flow, subscriptionId, options) {
|
|
1486
|
+
return buildWizardUrl(baseUrl, flow, {
|
|
1487
|
+
service: serviceCode,
|
|
1488
|
+
subscription: subscriptionId,
|
|
1489
|
+
redirect: options?.redirect
|
|
1490
|
+
});
|
|
1491
|
+
}
|
|
1492
|
+
function getSubscribeUrl(options) {
|
|
1493
|
+
return buildWizardUrl(baseUrl, "new-subscription", {
|
|
1494
|
+
service: serviceCode,
|
|
1495
|
+
redirect: options?.redirect
|
|
1496
|
+
});
|
|
1497
|
+
}
|
|
1498
|
+
function redirectToSubscribe(options) {
|
|
1499
|
+
return performRedirect(getSubscribeUrl(options), logger);
|
|
1500
|
+
}
|
|
1501
|
+
function getChangePlanUrl(subscriptionId, options) {
|
|
1502
|
+
return buildSubscriptionWizardUrl("change-plan", subscriptionId, options);
|
|
1503
|
+
}
|
|
1504
|
+
function redirectToChangePlan(subscriptionId, options) {
|
|
1505
|
+
return performRedirect(getChangePlanUrl(subscriptionId, options), logger);
|
|
1506
|
+
}
|
|
1507
|
+
function getChangeSeatsUrl(subscriptionId, options) {
|
|
1508
|
+
return buildSubscriptionWizardUrl("change-seats", subscriptionId, options);
|
|
1509
|
+
}
|
|
1510
|
+
function redirectToChangeSeats(subscriptionId, options) {
|
|
1511
|
+
return performRedirect(getChangeSeatsUrl(subscriptionId, options), logger);
|
|
1512
|
+
}
|
|
1513
|
+
function getRecoverPaymentUrl(subscriptionId, options) {
|
|
1514
|
+
return buildSubscriptionWizardUrl("payment-recovery", subscriptionId, options);
|
|
1515
|
+
}
|
|
1516
|
+
function redirectToRecoverPayment(subscriptionId, options) {
|
|
1517
|
+
return performRedirect(getRecoverPaymentUrl(subscriptionId, options), logger);
|
|
1518
|
+
}
|
|
1519
|
+
function getResubscribeUrl(options) {
|
|
1520
|
+
return buildWizardUrl(baseUrl, "resubscribe", {
|
|
1521
|
+
service: options?.serviceCode ?? serviceCode,
|
|
1522
|
+
redirect: options?.redirect
|
|
1523
|
+
});
|
|
1524
|
+
}
|
|
1525
|
+
function redirectToResubscribe(options) {
|
|
1526
|
+
return performRedirect(getResubscribeUrl(options), logger);
|
|
1527
|
+
}
|
|
1528
|
+
return {
|
|
1529
|
+
getSubscribeUrl,
|
|
1530
|
+
redirectToSubscribe,
|
|
1531
|
+
getChangePlanUrl,
|
|
1532
|
+
redirectToChangePlan,
|
|
1533
|
+
getChangeSeatsUrl,
|
|
1534
|
+
redirectToChangeSeats,
|
|
1535
|
+
getRecoverPaymentUrl,
|
|
1536
|
+
redirectToRecoverPayment,
|
|
1537
|
+
getResubscribeUrl,
|
|
1538
|
+
redirectToResubscribe
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1462
1542
|
// src/client/ffid-client.ts
|
|
1463
1543
|
var UNAUTHORIZED_STATUS2 = 401;
|
|
1464
1544
|
var SDK_LOG_PREFIX = "[FFID SDK]";
|
|
@@ -1658,6 +1738,11 @@ function createFFIDClient(config) {
|
|
|
1658
1738
|
error: createError("VALIDATION_ERROR", "organizationId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1659
1739
|
};
|
|
1660
1740
|
}
|
|
1741
|
+
if (authMode === "token" && (params.userId === void 0 || !params.userId.trim())) {
|
|
1742
|
+
return {
|
|
1743
|
+
error: createError("VALIDATION_ERROR", "token \u30E2\u30FC\u30C9\u3067\u306F userId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1744
|
+
};
|
|
1745
|
+
}
|
|
1661
1746
|
if (params.userId !== void 0 && !params.userId.trim()) {
|
|
1662
1747
|
return {
|
|
1663
1748
|
error: createError("VALIDATION_ERROR", "userId \u3092\u6307\u5B9A\u3059\u308B\u5834\u5408\u3001\u7A7A\u6587\u5B57\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093")
|
|
@@ -1706,6 +1791,22 @@ function createFFIDClient(config) {
|
|
|
1706
1791
|
fetchWithAuth,
|
|
1707
1792
|
errorCodes: FFID_ERROR_CODES
|
|
1708
1793
|
});
|
|
1794
|
+
const {
|
|
1795
|
+
getSubscribeUrl,
|
|
1796
|
+
redirectToSubscribe,
|
|
1797
|
+
getChangePlanUrl,
|
|
1798
|
+
redirectToChangePlan,
|
|
1799
|
+
getChangeSeatsUrl,
|
|
1800
|
+
redirectToChangeSeats,
|
|
1801
|
+
getRecoverPaymentUrl,
|
|
1802
|
+
redirectToRecoverPayment,
|
|
1803
|
+
getResubscribeUrl,
|
|
1804
|
+
redirectToResubscribe
|
|
1805
|
+
} = createContractWizardMethods({
|
|
1806
|
+
baseUrl,
|
|
1807
|
+
serviceCode: config.serviceCode,
|
|
1808
|
+
logger
|
|
1809
|
+
});
|
|
1709
1810
|
const { sendOtp, verifyOtp } = createOtpMethods({
|
|
1710
1811
|
baseUrl,
|
|
1711
1812
|
logger,
|
|
@@ -1749,6 +1850,16 @@ function createFFIDClient(config) {
|
|
|
1749
1850
|
cancelSubscription,
|
|
1750
1851
|
previewPlanChange,
|
|
1751
1852
|
verifyAccessToken,
|
|
1853
|
+
getSubscribeUrl,
|
|
1854
|
+
redirectToSubscribe,
|
|
1855
|
+
getChangePlanUrl,
|
|
1856
|
+
redirectToChangePlan,
|
|
1857
|
+
getChangeSeatsUrl,
|
|
1858
|
+
redirectToChangeSeats,
|
|
1859
|
+
getRecoverPaymentUrl,
|
|
1860
|
+
redirectToRecoverPayment,
|
|
1861
|
+
getResubscribeUrl,
|
|
1862
|
+
redirectToResubscribe,
|
|
1752
1863
|
requestPasswordReset,
|
|
1753
1864
|
verifyPasswordResetToken,
|
|
1754
1865
|
establishResetSession,
|
|
@@ -2064,7 +2175,17 @@ function useFFID() {
|
|
|
2064
2175
|
switchOrganization: context.switchOrganization,
|
|
2065
2176
|
refresh: context.refresh,
|
|
2066
2177
|
getLoginUrl: client.getLoginUrl,
|
|
2067
|
-
getSignupUrl: client.getSignupUrl
|
|
2178
|
+
getSignupUrl: client.getSignupUrl,
|
|
2179
|
+
getSubscribeUrl: client.getSubscribeUrl,
|
|
2180
|
+
redirectToSubscribe: client.redirectToSubscribe,
|
|
2181
|
+
getChangePlanUrl: client.getChangePlanUrl,
|
|
2182
|
+
redirectToChangePlan: client.redirectToChangePlan,
|
|
2183
|
+
getChangeSeatsUrl: client.getChangeSeatsUrl,
|
|
2184
|
+
redirectToChangeSeats: client.redirectToChangeSeats,
|
|
2185
|
+
getRecoverPaymentUrl: client.getRecoverPaymentUrl,
|
|
2186
|
+
redirectToRecoverPayment: client.redirectToRecoverPayment,
|
|
2187
|
+
getResubscribeUrl: client.getResubscribeUrl,
|
|
2188
|
+
redirectToResubscribe: client.redirectToResubscribe
|
|
2068
2189
|
};
|
|
2069
2190
|
}
|
|
2070
2191
|
function FFIDLoginButton({
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkC6Z4JPYE_cjs = require('../chunk-C6Z4JPYE.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 chunkC6Z4JPYE_cjs.FFIDAnnouncementBadge; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkC6Z4JPYE_cjs.FFIDAnnouncementList; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkC6Z4JPYE_cjs.FFIDLoginButton; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkC6Z4JPYE_cjs.FFIDOrganizationSwitcher; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkC6Z4JPYE_cjs.FFIDSubscriptionBadge; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkC6Z4JPYE_cjs.FFIDUserMenu; }
|
|
30
30
|
});
|
package/dist/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-
|
|
1
|
+
export { FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDSubscriptionBadge, FFIDUserMenu } from '../chunk-NHVOLBE5.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkC6Z4JPYE_cjs = require('./chunk-C6Z4JPYE.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 } = chunkC6Z4JPYE_cjs.useFFIDContext();
|
|
50
50
|
const hasRedirected = react.useRef(false);
|
|
51
51
|
react.useEffect(() => {
|
|
52
52
|
if (!isLoading && !isAuthenticated && options.redirectToLogin && !hasRedirected.current) {
|
|
@@ -71,83 +71,83 @@ function withFFIDAuth(Component, options = {}) {
|
|
|
71
71
|
|
|
72
72
|
Object.defineProperty(exports, "DEFAULT_API_BASE_URL", {
|
|
73
73
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunkC6Z4JPYE_cjs.DEFAULT_API_BASE_URL; }
|
|
75
75
|
});
|
|
76
76
|
Object.defineProperty(exports, "FFIDAnnouncementBadge", {
|
|
77
77
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
78
|
+
get: function () { return chunkC6Z4JPYE_cjs.FFIDAnnouncementBadge; }
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
81
81
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
82
|
+
get: function () { return chunkC6Z4JPYE_cjs.FFIDAnnouncementList; }
|
|
83
83
|
});
|
|
84
84
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
85
85
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
86
|
+
get: function () { return chunkC6Z4JPYE_cjs.FFIDLoginButton; }
|
|
87
87
|
});
|
|
88
88
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
89
89
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
90
|
+
get: function () { return chunkC6Z4JPYE_cjs.FFIDOrganizationSwitcher; }
|
|
91
91
|
});
|
|
92
92
|
Object.defineProperty(exports, "FFIDProvider", {
|
|
93
93
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
94
|
+
get: function () { return chunkC6Z4JPYE_cjs.FFIDProvider; }
|
|
95
95
|
});
|
|
96
96
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
97
97
|
enumerable: true,
|
|
98
|
-
get: function () { return
|
|
98
|
+
get: function () { return chunkC6Z4JPYE_cjs.FFIDSubscriptionBadge; }
|
|
99
99
|
});
|
|
100
100
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
101
101
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
102
|
+
get: function () { return chunkC6Z4JPYE_cjs.FFIDUserMenu; }
|
|
103
103
|
});
|
|
104
104
|
Object.defineProperty(exports, "FFID_ANNOUNCEMENTS_ERROR_CODES", {
|
|
105
105
|
enumerable: true,
|
|
106
|
-
get: function () { return
|
|
106
|
+
get: function () { return chunkC6Z4JPYE_cjs.FFID_ANNOUNCEMENTS_ERROR_CODES; }
|
|
107
107
|
});
|
|
108
108
|
Object.defineProperty(exports, "createFFIDAnnouncementsClient", {
|
|
109
109
|
enumerable: true,
|
|
110
|
-
get: function () { return
|
|
110
|
+
get: function () { return chunkC6Z4JPYE_cjs.createFFIDAnnouncementsClient; }
|
|
111
111
|
});
|
|
112
112
|
Object.defineProperty(exports, "createFFIDClient", {
|
|
113
113
|
enumerable: true,
|
|
114
|
-
get: function () { return
|
|
114
|
+
get: function () { return chunkC6Z4JPYE_cjs.createFFIDClient; }
|
|
115
115
|
});
|
|
116
116
|
Object.defineProperty(exports, "createTokenStore", {
|
|
117
117
|
enumerable: true,
|
|
118
|
-
get: function () { return
|
|
118
|
+
get: function () { return chunkC6Z4JPYE_cjs.createTokenStore; }
|
|
119
119
|
});
|
|
120
120
|
Object.defineProperty(exports, "generateCodeChallenge", {
|
|
121
121
|
enumerable: true,
|
|
122
|
-
get: function () { return
|
|
122
|
+
get: function () { return chunkC6Z4JPYE_cjs.generateCodeChallenge; }
|
|
123
123
|
});
|
|
124
124
|
Object.defineProperty(exports, "generateCodeVerifier", {
|
|
125
125
|
enumerable: true,
|
|
126
|
-
get: function () { return
|
|
126
|
+
get: function () { return chunkC6Z4JPYE_cjs.generateCodeVerifier; }
|
|
127
127
|
});
|
|
128
128
|
Object.defineProperty(exports, "retrieveCodeVerifier", {
|
|
129
129
|
enumerable: true,
|
|
130
|
-
get: function () { return
|
|
130
|
+
get: function () { return chunkC6Z4JPYE_cjs.retrieveCodeVerifier; }
|
|
131
131
|
});
|
|
132
132
|
Object.defineProperty(exports, "storeCodeVerifier", {
|
|
133
133
|
enumerable: true,
|
|
134
|
-
get: function () { return
|
|
134
|
+
get: function () { return chunkC6Z4JPYE_cjs.storeCodeVerifier; }
|
|
135
135
|
});
|
|
136
136
|
Object.defineProperty(exports, "useFFID", {
|
|
137
137
|
enumerable: true,
|
|
138
|
-
get: function () { return
|
|
138
|
+
get: function () { return chunkC6Z4JPYE_cjs.useFFID; }
|
|
139
139
|
});
|
|
140
140
|
Object.defineProperty(exports, "useFFIDAnnouncements", {
|
|
141
141
|
enumerable: true,
|
|
142
|
-
get: function () { return
|
|
142
|
+
get: function () { return chunkC6Z4JPYE_cjs.useFFIDAnnouncements; }
|
|
143
143
|
});
|
|
144
144
|
Object.defineProperty(exports, "useSubscription", {
|
|
145
145
|
enumerable: true,
|
|
146
|
-
get: function () { return
|
|
146
|
+
get: function () { return chunkC6Z4JPYE_cjs.useSubscription; }
|
|
147
147
|
});
|
|
148
148
|
Object.defineProperty(exports, "withSubscription", {
|
|
149
149
|
enumerable: true,
|
|
150
|
-
get: function () { return
|
|
150
|
+
get: function () { return chunkC6Z4JPYE_cjs.withSubscription; }
|
|
151
151
|
});
|
|
152
152
|
exports.createKVCacheAdapter = createKVCacheAdapter;
|
|
153
153
|
exports.createMemoryCacheAdapter = createMemoryCacheAdapter;
|
package/dist/index.d.cts
CHANGED
|
@@ -113,6 +113,7 @@ interface FFIDPlanInfo {
|
|
|
113
113
|
description: string | null;
|
|
114
114
|
minSeats: number;
|
|
115
115
|
maxSeats: number | null;
|
|
116
|
+
seatSelectionEnabled: boolean;
|
|
116
117
|
trialDays: number;
|
|
117
118
|
priceMonthly: number;
|
|
118
119
|
priceYearly: number | null;
|
|
@@ -316,6 +317,28 @@ type FFIDResetSessionResponse = FFIDPasswordResetResponse;
|
|
|
316
317
|
/** Response from confirmPasswordReset */
|
|
317
318
|
type FFIDPasswordResetConfirmResponse = FFIDPasswordResetResponse;
|
|
318
319
|
|
|
320
|
+
/** Contract Wizard navigation methods — URL generation and browser redirect for contract flows */
|
|
321
|
+
|
|
322
|
+
/** Contract wizard flow types */
|
|
323
|
+
type ContractWizardFlowType = 'new-subscription' | 'resubscribe' | 'change-plan' | 'change-seats' | 'payment-recovery';
|
|
324
|
+
/** Options for the new-subscription wizard flow */
|
|
325
|
+
interface ContractWizardSubscribeOptions {
|
|
326
|
+
/** URL to redirect back to after completion */
|
|
327
|
+
redirect?: string;
|
|
328
|
+
}
|
|
329
|
+
/** Options for the resubscribe wizard flow */
|
|
330
|
+
interface ContractWizardResubscribeOptions {
|
|
331
|
+
/** Service code to resubscribe to (defaults to SDK's serviceCode) */
|
|
332
|
+
serviceCode?: string;
|
|
333
|
+
/** URL to redirect back to after completion */
|
|
334
|
+
redirect?: string;
|
|
335
|
+
}
|
|
336
|
+
/** Options for wizard flows that operate on an existing subscription */
|
|
337
|
+
interface ContractWizardSubscriptionOptions {
|
|
338
|
+
/** URL to redirect back to after completion */
|
|
339
|
+
redirect?: string;
|
|
340
|
+
}
|
|
341
|
+
|
|
319
342
|
/** Redirect and URL generation - redirectToLogin / redirectToAuthorize / redirectToLogout / getLoginUrl / getSignupUrl / getLogoutUrl */
|
|
320
343
|
|
|
321
344
|
/** Options for redirectToAuthorize */
|
|
@@ -362,6 +385,16 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
362
385
|
cancelSubscription: (params: FFIDCancelSubscriptionParams) => Promise<FFIDApiResponse<FFIDCancelSubscriptionResponse>>;
|
|
363
386
|
previewPlanChange: (params: FFIDPreviewPlanChangeParams) => Promise<FFIDApiResponse<FFIDPlanChangePreviewResponse>>;
|
|
364
387
|
verifyAccessToken: (accessToken: string, options?: FFIDVerifyAccessTokenOptions) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
|
|
388
|
+
getSubscribeUrl: (options?: ContractWizardSubscribeOptions) => string;
|
|
389
|
+
redirectToSubscribe: (options?: ContractWizardSubscribeOptions) => FFIDRedirectResult;
|
|
390
|
+
getChangePlanUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
391
|
+
redirectToChangePlan: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
392
|
+
getChangeSeatsUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
393
|
+
redirectToChangeSeats: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
394
|
+
getRecoverPaymentUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
395
|
+
redirectToRecoverPayment: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
396
|
+
getResubscribeUrl: (options?: ContractWizardResubscribeOptions) => string;
|
|
397
|
+
redirectToResubscribe: (options?: ContractWizardResubscribeOptions) => FFIDRedirectResult;
|
|
365
398
|
requestPasswordReset: (email: string) => Promise<FFIDApiResponse<FFIDPasswordResetResponse>>;
|
|
366
399
|
verifyPasswordResetToken: (accessToken: string) => Promise<FFIDApiResponse<FFIDPasswordResetVerifyResponse>>;
|
|
367
400
|
establishResetSession: (accessToken: string, refreshToken: string) => Promise<FFIDApiResponse<FFIDResetSessionResponse>>;
|
|
@@ -462,6 +495,26 @@ interface UseFFIDReturn {
|
|
|
462
495
|
getLoginUrl: (redirectUrl?: string) => string;
|
|
463
496
|
/** Get signup URL with redirect parameter */
|
|
464
497
|
getSignupUrl: (redirectUrl?: string) => string;
|
|
498
|
+
/** Get URL for new subscription contract wizard */
|
|
499
|
+
getSubscribeUrl: (options?: ContractWizardSubscribeOptions) => string;
|
|
500
|
+
/** Redirect to new subscription contract wizard */
|
|
501
|
+
redirectToSubscribe: (options?: ContractWizardSubscribeOptions) => FFIDRedirectResult;
|
|
502
|
+
/** Get URL for plan change contract wizard */
|
|
503
|
+
getChangePlanUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
504
|
+
/** Redirect to plan change contract wizard */
|
|
505
|
+
redirectToChangePlan: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
506
|
+
/** Get URL for seat count change contract wizard */
|
|
507
|
+
getChangeSeatsUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
508
|
+
/** Redirect to seat count change contract wizard */
|
|
509
|
+
redirectToChangeSeats: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
510
|
+
/** Get URL for payment recovery contract wizard */
|
|
511
|
+
getRecoverPaymentUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
512
|
+
/** Redirect to payment recovery contract wizard */
|
|
513
|
+
redirectToRecoverPayment: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
514
|
+
/** Get URL for resubscribe contract wizard */
|
|
515
|
+
getResubscribeUrl: (options?: ContractWizardResubscribeOptions) => string;
|
|
516
|
+
/** Redirect to resubscribe contract wizard */
|
|
517
|
+
redirectToResubscribe: (options?: ContractWizardResubscribeOptions) => FFIDRedirectResult;
|
|
465
518
|
}
|
|
466
519
|
/**
|
|
467
520
|
* Hook to access FFID authentication and user data
|
|
@@ -641,4 +694,4 @@ declare function createFFIDAnnouncementsClient(config?: FFIDAnnouncementsClientC
|
|
|
641
694
|
/** Type of the FFID Announcements client */
|
|
642
695
|
type FFIDAnnouncementsClient = ReturnType<typeof createFFIDAnnouncementsClient>;
|
|
643
696
|
|
|
644
|
-
export { AnnouncementListResponse, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, FFIDMemberRole, FFIDOAuthUserInfo, FFIDOrganization, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, FFIDRemoveMemberResponse, type FFIDResetSessionResponse, type FFIDServiceInfo, FFIDSessionResponse, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, FFIDUpdateMemberRoleResponse, FFIDUser, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, type KVNamespaceLike, ListAnnouncementsOptions, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
|
|
697
|
+
export { AnnouncementListResponse, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, FFIDMemberRole, FFIDOAuthUserInfo, FFIDOrganization, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, FFIDRemoveMemberResponse, type FFIDResetSessionResponse, type FFIDServiceInfo, FFIDSessionResponse, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, FFIDUpdateMemberRoleResponse, FFIDUser, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, type KVNamespaceLike, ListAnnouncementsOptions, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
|
package/dist/index.d.ts
CHANGED
|
@@ -113,6 +113,7 @@ interface FFIDPlanInfo {
|
|
|
113
113
|
description: string | null;
|
|
114
114
|
minSeats: number;
|
|
115
115
|
maxSeats: number | null;
|
|
116
|
+
seatSelectionEnabled: boolean;
|
|
116
117
|
trialDays: number;
|
|
117
118
|
priceMonthly: number;
|
|
118
119
|
priceYearly: number | null;
|
|
@@ -316,6 +317,28 @@ type FFIDResetSessionResponse = FFIDPasswordResetResponse;
|
|
|
316
317
|
/** Response from confirmPasswordReset */
|
|
317
318
|
type FFIDPasswordResetConfirmResponse = FFIDPasswordResetResponse;
|
|
318
319
|
|
|
320
|
+
/** Contract Wizard navigation methods — URL generation and browser redirect for contract flows */
|
|
321
|
+
|
|
322
|
+
/** Contract wizard flow types */
|
|
323
|
+
type ContractWizardFlowType = 'new-subscription' | 'resubscribe' | 'change-plan' | 'change-seats' | 'payment-recovery';
|
|
324
|
+
/** Options for the new-subscription wizard flow */
|
|
325
|
+
interface ContractWizardSubscribeOptions {
|
|
326
|
+
/** URL to redirect back to after completion */
|
|
327
|
+
redirect?: string;
|
|
328
|
+
}
|
|
329
|
+
/** Options for the resubscribe wizard flow */
|
|
330
|
+
interface ContractWizardResubscribeOptions {
|
|
331
|
+
/** Service code to resubscribe to (defaults to SDK's serviceCode) */
|
|
332
|
+
serviceCode?: string;
|
|
333
|
+
/** URL to redirect back to after completion */
|
|
334
|
+
redirect?: string;
|
|
335
|
+
}
|
|
336
|
+
/** Options for wizard flows that operate on an existing subscription */
|
|
337
|
+
interface ContractWizardSubscriptionOptions {
|
|
338
|
+
/** URL to redirect back to after completion */
|
|
339
|
+
redirect?: string;
|
|
340
|
+
}
|
|
341
|
+
|
|
319
342
|
/** Redirect and URL generation - redirectToLogin / redirectToAuthorize / redirectToLogout / getLoginUrl / getSignupUrl / getLogoutUrl */
|
|
320
343
|
|
|
321
344
|
/** Options for redirectToAuthorize */
|
|
@@ -362,6 +385,16 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
362
385
|
cancelSubscription: (params: FFIDCancelSubscriptionParams) => Promise<FFIDApiResponse<FFIDCancelSubscriptionResponse>>;
|
|
363
386
|
previewPlanChange: (params: FFIDPreviewPlanChangeParams) => Promise<FFIDApiResponse<FFIDPlanChangePreviewResponse>>;
|
|
364
387
|
verifyAccessToken: (accessToken: string, options?: FFIDVerifyAccessTokenOptions) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
|
|
388
|
+
getSubscribeUrl: (options?: ContractWizardSubscribeOptions) => string;
|
|
389
|
+
redirectToSubscribe: (options?: ContractWizardSubscribeOptions) => FFIDRedirectResult;
|
|
390
|
+
getChangePlanUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
391
|
+
redirectToChangePlan: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
392
|
+
getChangeSeatsUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
393
|
+
redirectToChangeSeats: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
394
|
+
getRecoverPaymentUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
395
|
+
redirectToRecoverPayment: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
396
|
+
getResubscribeUrl: (options?: ContractWizardResubscribeOptions) => string;
|
|
397
|
+
redirectToResubscribe: (options?: ContractWizardResubscribeOptions) => FFIDRedirectResult;
|
|
365
398
|
requestPasswordReset: (email: string) => Promise<FFIDApiResponse<FFIDPasswordResetResponse>>;
|
|
366
399
|
verifyPasswordResetToken: (accessToken: string) => Promise<FFIDApiResponse<FFIDPasswordResetVerifyResponse>>;
|
|
367
400
|
establishResetSession: (accessToken: string, refreshToken: string) => Promise<FFIDApiResponse<FFIDResetSessionResponse>>;
|
|
@@ -462,6 +495,26 @@ interface UseFFIDReturn {
|
|
|
462
495
|
getLoginUrl: (redirectUrl?: string) => string;
|
|
463
496
|
/** Get signup URL with redirect parameter */
|
|
464
497
|
getSignupUrl: (redirectUrl?: string) => string;
|
|
498
|
+
/** Get URL for new subscription contract wizard */
|
|
499
|
+
getSubscribeUrl: (options?: ContractWizardSubscribeOptions) => string;
|
|
500
|
+
/** Redirect to new subscription contract wizard */
|
|
501
|
+
redirectToSubscribe: (options?: ContractWizardSubscribeOptions) => FFIDRedirectResult;
|
|
502
|
+
/** Get URL for plan change contract wizard */
|
|
503
|
+
getChangePlanUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
504
|
+
/** Redirect to plan change contract wizard */
|
|
505
|
+
redirectToChangePlan: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
506
|
+
/** Get URL for seat count change contract wizard */
|
|
507
|
+
getChangeSeatsUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
508
|
+
/** Redirect to seat count change contract wizard */
|
|
509
|
+
redirectToChangeSeats: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
510
|
+
/** Get URL for payment recovery contract wizard */
|
|
511
|
+
getRecoverPaymentUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
512
|
+
/** Redirect to payment recovery contract wizard */
|
|
513
|
+
redirectToRecoverPayment: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
514
|
+
/** Get URL for resubscribe contract wizard */
|
|
515
|
+
getResubscribeUrl: (options?: ContractWizardResubscribeOptions) => string;
|
|
516
|
+
/** Redirect to resubscribe contract wizard */
|
|
517
|
+
redirectToResubscribe: (options?: ContractWizardResubscribeOptions) => FFIDRedirectResult;
|
|
465
518
|
}
|
|
466
519
|
/**
|
|
467
520
|
* Hook to access FFID authentication and user data
|
|
@@ -641,4 +694,4 @@ declare function createFFIDAnnouncementsClient(config?: FFIDAnnouncementsClientC
|
|
|
641
694
|
/** Type of the FFID Announcements client */
|
|
642
695
|
type FFIDAnnouncementsClient = ReturnType<typeof createFFIDAnnouncementsClient>;
|
|
643
696
|
|
|
644
|
-
export { AnnouncementListResponse, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, FFIDMemberRole, FFIDOAuthUserInfo, FFIDOrganization, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, FFIDRemoveMemberResponse, type FFIDResetSessionResponse, type FFIDServiceInfo, FFIDSessionResponse, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, FFIDUpdateMemberRoleResponse, FFIDUser, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, type KVNamespaceLike, ListAnnouncementsOptions, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
|
|
697
|
+
export { AnnouncementListResponse, type ContractWizardFlowType, type ContractWizardResubscribeOptions, type ContractWizardSubscribeOptions, type ContractWizardSubscriptionOptions, DEFAULT_API_BASE_URL, FFIDAnnouncementsApiResponse, type FFIDAnnouncementsClient, FFIDAnnouncementsClientConfig, FFIDAnnouncementsLogger, FFIDApiResponse, type FFIDBillingInterval, FFIDCacheAdapter, type FFIDCancelSubscriptionParams, type FFIDCancelSubscriptionResponse, type FFIDChangePlanParams, type FFIDChangePlanResponse, FFIDCheckoutSessionResponse, type FFIDClient, FFIDConfig, FFIDCreateCheckoutParams, FFIDCreatePortalParams, FFIDError, FFIDListMembersResponse, type FFIDListPlansResponse, FFIDLogger, FFIDMemberRole, FFIDOAuthUserInfo, FFIDOrganization, type FFIDOtpSendResponse, type FFIDOtpVerifyResponse, type FFIDPasswordResetConfirmResponse, type FFIDPasswordResetResponse, type FFIDPasswordResetVerifyResponse, type FFIDPlanChangeLineItem, type FFIDPlanChangePreviewResponse, type FFIDPlanInfo, FFIDPortalSessionResponse, type FFIDPreviewPlanChangeParams, FFIDProvider, type FFIDProviderProps, FFIDRedirectResult, FFIDRemoveMemberResponse, type FFIDResetSessionResponse, type FFIDServiceInfo, FFIDSessionResponse, type FFIDSubscribeParams, type FFIDSubscribeResponse, FFIDSubscription, FFIDSubscriptionCheckResponse, FFIDSubscriptionContextValue, type FFIDSubscriptionDetail, FFIDSubscriptionStatus, type FFIDSubscriptionSummary, FFIDUpdateMemberRoleResponse, FFIDUser, FFIDVerifyAccessTokenOptions, FFID_ANNOUNCEMENTS_ERROR_CODES, type KVNamespaceLike, ListAnnouncementsOptions, type RedirectToAuthorizeOptions, type TokenData, type TokenStore, type UseFFIDReturn, type WithFFIDAuthOptions, type WithSubscriptionOptions, createFFIDAnnouncementsClient, createFFIDClient, createKVCacheAdapter, createMemoryCacheAdapter, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useSubscription, withFFIDAuth, withSubscription };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useFFIDContext } from './chunk-
|
|
2
|
-
export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-
|
|
1
|
+
import { useFFIDContext } from './chunk-NHVOLBE5.js';
|
|
2
|
+
export { DEFAULT_API_BASE_URL, FFIDAnnouncementBadge, FFIDAnnouncementList, FFIDLoginButton, FFIDOrganizationSwitcher, FFIDProvider, FFIDSubscriptionBadge, FFIDUserMenu, FFID_ANNOUNCEMENTS_ERROR_CODES, createFFIDAnnouncementsClient, createFFIDClient, createTokenStore, generateCodeChallenge, generateCodeVerifier, retrieveCodeVerifier, storeCodeVerifier, useFFID, useFFIDAnnouncements, useSubscription, withSubscription } from './chunk-NHVOLBE5.js';
|
|
3
3
|
import { useRef, useEffect } from 'react';
|
|
4
4
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
5
5
|
|
package/dist/server/index.cjs
CHANGED
|
@@ -596,7 +596,7 @@ function createMembersMethods(deps) {
|
|
|
596
596
|
}
|
|
597
597
|
|
|
598
598
|
// src/client/version-check.ts
|
|
599
|
-
var SDK_VERSION = "1.
|
|
599
|
+
var SDK_VERSION = "2.1.0";
|
|
600
600
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
601
601
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
602
602
|
function sdkHeaders() {
|
|
@@ -1444,6 +1444,86 @@ function createOtpMethods(deps) {
|
|
|
1444
1444
|
};
|
|
1445
1445
|
}
|
|
1446
1446
|
|
|
1447
|
+
// src/client/contract-wizard-methods.ts
|
|
1448
|
+
var CONTRACT_WIZARD_PATH = "/contract-wizard";
|
|
1449
|
+
function buildWizardUrl(baseUrl, flow, params) {
|
|
1450
|
+
const query = new URLSearchParams();
|
|
1451
|
+
query.set("flow", flow);
|
|
1452
|
+
for (const [key, value] of Object.entries(params)) {
|
|
1453
|
+
if (value !== void 0) {
|
|
1454
|
+
query.set(key, value);
|
|
1455
|
+
}
|
|
1456
|
+
}
|
|
1457
|
+
return `${baseUrl}${CONTRACT_WIZARD_PATH}?${query.toString()}`;
|
|
1458
|
+
}
|
|
1459
|
+
function performRedirect(url, logger) {
|
|
1460
|
+
if (typeof window === "undefined") {
|
|
1461
|
+
logger.warn("SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093");
|
|
1462
|
+
return { success: false, error: "SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093" };
|
|
1463
|
+
}
|
|
1464
|
+
logger.debug("Redirecting to contract wizard:", url);
|
|
1465
|
+
window.location.href = url;
|
|
1466
|
+
return { success: true };
|
|
1467
|
+
}
|
|
1468
|
+
function createContractWizardMethods(deps) {
|
|
1469
|
+
const { baseUrl, serviceCode, logger } = deps;
|
|
1470
|
+
function buildSubscriptionWizardUrl(flow, subscriptionId, options) {
|
|
1471
|
+
return buildWizardUrl(baseUrl, flow, {
|
|
1472
|
+
service: serviceCode,
|
|
1473
|
+
subscription: subscriptionId,
|
|
1474
|
+
redirect: options?.redirect
|
|
1475
|
+
});
|
|
1476
|
+
}
|
|
1477
|
+
function getSubscribeUrl(options) {
|
|
1478
|
+
return buildWizardUrl(baseUrl, "new-subscription", {
|
|
1479
|
+
service: serviceCode,
|
|
1480
|
+
redirect: options?.redirect
|
|
1481
|
+
});
|
|
1482
|
+
}
|
|
1483
|
+
function redirectToSubscribe(options) {
|
|
1484
|
+
return performRedirect(getSubscribeUrl(options), logger);
|
|
1485
|
+
}
|
|
1486
|
+
function getChangePlanUrl(subscriptionId, options) {
|
|
1487
|
+
return buildSubscriptionWizardUrl("change-plan", subscriptionId, options);
|
|
1488
|
+
}
|
|
1489
|
+
function redirectToChangePlan(subscriptionId, options) {
|
|
1490
|
+
return performRedirect(getChangePlanUrl(subscriptionId, options), logger);
|
|
1491
|
+
}
|
|
1492
|
+
function getChangeSeatsUrl(subscriptionId, options) {
|
|
1493
|
+
return buildSubscriptionWizardUrl("change-seats", subscriptionId, options);
|
|
1494
|
+
}
|
|
1495
|
+
function redirectToChangeSeats(subscriptionId, options) {
|
|
1496
|
+
return performRedirect(getChangeSeatsUrl(subscriptionId, options), logger);
|
|
1497
|
+
}
|
|
1498
|
+
function getRecoverPaymentUrl(subscriptionId, options) {
|
|
1499
|
+
return buildSubscriptionWizardUrl("payment-recovery", subscriptionId, options);
|
|
1500
|
+
}
|
|
1501
|
+
function redirectToRecoverPayment(subscriptionId, options) {
|
|
1502
|
+
return performRedirect(getRecoverPaymentUrl(subscriptionId, options), logger);
|
|
1503
|
+
}
|
|
1504
|
+
function getResubscribeUrl(options) {
|
|
1505
|
+
return buildWizardUrl(baseUrl, "resubscribe", {
|
|
1506
|
+
service: options?.serviceCode ?? serviceCode,
|
|
1507
|
+
redirect: options?.redirect
|
|
1508
|
+
});
|
|
1509
|
+
}
|
|
1510
|
+
function redirectToResubscribe(options) {
|
|
1511
|
+
return performRedirect(getResubscribeUrl(options), logger);
|
|
1512
|
+
}
|
|
1513
|
+
return {
|
|
1514
|
+
getSubscribeUrl,
|
|
1515
|
+
redirectToSubscribe,
|
|
1516
|
+
getChangePlanUrl,
|
|
1517
|
+
redirectToChangePlan,
|
|
1518
|
+
getChangeSeatsUrl,
|
|
1519
|
+
redirectToChangeSeats,
|
|
1520
|
+
getRecoverPaymentUrl,
|
|
1521
|
+
redirectToRecoverPayment,
|
|
1522
|
+
getResubscribeUrl,
|
|
1523
|
+
redirectToResubscribe
|
|
1524
|
+
};
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1447
1527
|
// src/client/ffid-client.ts
|
|
1448
1528
|
var UNAUTHORIZED_STATUS2 = 401;
|
|
1449
1529
|
var SDK_LOG_PREFIX = "[FFID SDK]";
|
|
@@ -1643,6 +1723,11 @@ function createFFIDClient(config) {
|
|
|
1643
1723
|
error: createError("VALIDATION_ERROR", "organizationId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1644
1724
|
};
|
|
1645
1725
|
}
|
|
1726
|
+
if (authMode === "token" && (params.userId === void 0 || !params.userId.trim())) {
|
|
1727
|
+
return {
|
|
1728
|
+
error: createError("VALIDATION_ERROR", "token \u30E2\u30FC\u30C9\u3067\u306F userId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1729
|
+
};
|
|
1730
|
+
}
|
|
1646
1731
|
if (params.userId !== void 0 && !params.userId.trim()) {
|
|
1647
1732
|
return {
|
|
1648
1733
|
error: createError("VALIDATION_ERROR", "userId \u3092\u6307\u5B9A\u3059\u308B\u5834\u5408\u3001\u7A7A\u6587\u5B57\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093")
|
|
@@ -1691,6 +1776,22 @@ function createFFIDClient(config) {
|
|
|
1691
1776
|
fetchWithAuth,
|
|
1692
1777
|
errorCodes: FFID_ERROR_CODES
|
|
1693
1778
|
});
|
|
1779
|
+
const {
|
|
1780
|
+
getSubscribeUrl,
|
|
1781
|
+
redirectToSubscribe,
|
|
1782
|
+
getChangePlanUrl,
|
|
1783
|
+
redirectToChangePlan,
|
|
1784
|
+
getChangeSeatsUrl,
|
|
1785
|
+
redirectToChangeSeats,
|
|
1786
|
+
getRecoverPaymentUrl,
|
|
1787
|
+
redirectToRecoverPayment,
|
|
1788
|
+
getResubscribeUrl,
|
|
1789
|
+
redirectToResubscribe
|
|
1790
|
+
} = createContractWizardMethods({
|
|
1791
|
+
baseUrl,
|
|
1792
|
+
serviceCode: config.serviceCode,
|
|
1793
|
+
logger
|
|
1794
|
+
});
|
|
1694
1795
|
const { sendOtp, verifyOtp } = createOtpMethods({
|
|
1695
1796
|
baseUrl,
|
|
1696
1797
|
logger,
|
|
@@ -1734,6 +1835,16 @@ function createFFIDClient(config) {
|
|
|
1734
1835
|
cancelSubscription,
|
|
1735
1836
|
previewPlanChange,
|
|
1736
1837
|
verifyAccessToken,
|
|
1838
|
+
getSubscribeUrl,
|
|
1839
|
+
redirectToSubscribe,
|
|
1840
|
+
getChangePlanUrl,
|
|
1841
|
+
redirectToChangePlan,
|
|
1842
|
+
getChangeSeatsUrl,
|
|
1843
|
+
redirectToChangeSeats,
|
|
1844
|
+
getRecoverPaymentUrl,
|
|
1845
|
+
redirectToRecoverPayment,
|
|
1846
|
+
getResubscribeUrl,
|
|
1847
|
+
redirectToResubscribe,
|
|
1737
1848
|
requestPasswordReset,
|
|
1738
1849
|
verifyPasswordResetToken,
|
|
1739
1850
|
establishResetSession,
|
package/dist/server/index.d.cts
CHANGED
|
@@ -42,6 +42,7 @@ interface FFIDPlanInfo {
|
|
|
42
42
|
description: string | null;
|
|
43
43
|
minSeats: number;
|
|
44
44
|
maxSeats: number | null;
|
|
45
|
+
seatSelectionEnabled: boolean;
|
|
45
46
|
trialDays: number;
|
|
46
47
|
priceMonthly: number;
|
|
47
48
|
priceYearly: number | null;
|
|
@@ -581,6 +582,26 @@ type FFIDResetSessionResponse = FFIDPasswordResetResponse;
|
|
|
581
582
|
/** Response from confirmPasswordReset */
|
|
582
583
|
type FFIDPasswordResetConfirmResponse = FFIDPasswordResetResponse;
|
|
583
584
|
|
|
585
|
+
/** Contract Wizard navigation methods — URL generation and browser redirect for contract flows */
|
|
586
|
+
|
|
587
|
+
/** Options for the new-subscription wizard flow */
|
|
588
|
+
interface ContractWizardSubscribeOptions {
|
|
589
|
+
/** URL to redirect back to after completion */
|
|
590
|
+
redirect?: string;
|
|
591
|
+
}
|
|
592
|
+
/** Options for the resubscribe wizard flow */
|
|
593
|
+
interface ContractWizardResubscribeOptions {
|
|
594
|
+
/** Service code to resubscribe to (defaults to SDK's serviceCode) */
|
|
595
|
+
serviceCode?: string;
|
|
596
|
+
/** URL to redirect back to after completion */
|
|
597
|
+
redirect?: string;
|
|
598
|
+
}
|
|
599
|
+
/** Options for wizard flows that operate on an existing subscription */
|
|
600
|
+
interface ContractWizardSubscriptionOptions {
|
|
601
|
+
/** URL to redirect back to after completion */
|
|
602
|
+
redirect?: string;
|
|
603
|
+
}
|
|
604
|
+
|
|
584
605
|
/** Redirect and URL generation - redirectToLogin / redirectToAuthorize / redirectToLogout / getLoginUrl / getSignupUrl / getLogoutUrl */
|
|
585
606
|
|
|
586
607
|
/** Options for redirectToAuthorize */
|
|
@@ -668,6 +689,16 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
668
689
|
cancelSubscription: (params: FFIDCancelSubscriptionParams) => Promise<FFIDApiResponse<FFIDCancelSubscriptionResponse>>;
|
|
669
690
|
previewPlanChange: (params: FFIDPreviewPlanChangeParams) => Promise<FFIDApiResponse<FFIDPlanChangePreviewResponse>>;
|
|
670
691
|
verifyAccessToken: (accessToken: string, options?: FFIDVerifyAccessTokenOptions) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
|
|
692
|
+
getSubscribeUrl: (options?: ContractWizardSubscribeOptions) => string;
|
|
693
|
+
redirectToSubscribe: (options?: ContractWizardSubscribeOptions) => FFIDRedirectResult;
|
|
694
|
+
getChangePlanUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
695
|
+
redirectToChangePlan: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
696
|
+
getChangeSeatsUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
697
|
+
redirectToChangeSeats: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
698
|
+
getRecoverPaymentUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
699
|
+
redirectToRecoverPayment: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
700
|
+
getResubscribeUrl: (options?: ContractWizardResubscribeOptions) => string;
|
|
701
|
+
redirectToResubscribe: (options?: ContractWizardResubscribeOptions) => FFIDRedirectResult;
|
|
671
702
|
requestPasswordReset: (email: string) => Promise<FFIDApiResponse<FFIDPasswordResetResponse>>;
|
|
672
703
|
verifyPasswordResetToken: (accessToken: string) => Promise<FFIDApiResponse<FFIDPasswordResetVerifyResponse>>;
|
|
673
704
|
establishResetSession: (accessToken: string, refreshToken: string) => Promise<FFIDApiResponse<FFIDResetSessionResponse>>;
|
package/dist/server/index.d.ts
CHANGED
|
@@ -42,6 +42,7 @@ interface FFIDPlanInfo {
|
|
|
42
42
|
description: string | null;
|
|
43
43
|
minSeats: number;
|
|
44
44
|
maxSeats: number | null;
|
|
45
|
+
seatSelectionEnabled: boolean;
|
|
45
46
|
trialDays: number;
|
|
46
47
|
priceMonthly: number;
|
|
47
48
|
priceYearly: number | null;
|
|
@@ -581,6 +582,26 @@ type FFIDResetSessionResponse = FFIDPasswordResetResponse;
|
|
|
581
582
|
/** Response from confirmPasswordReset */
|
|
582
583
|
type FFIDPasswordResetConfirmResponse = FFIDPasswordResetResponse;
|
|
583
584
|
|
|
585
|
+
/** Contract Wizard navigation methods — URL generation and browser redirect for contract flows */
|
|
586
|
+
|
|
587
|
+
/** Options for the new-subscription wizard flow */
|
|
588
|
+
interface ContractWizardSubscribeOptions {
|
|
589
|
+
/** URL to redirect back to after completion */
|
|
590
|
+
redirect?: string;
|
|
591
|
+
}
|
|
592
|
+
/** Options for the resubscribe wizard flow */
|
|
593
|
+
interface ContractWizardResubscribeOptions {
|
|
594
|
+
/** Service code to resubscribe to (defaults to SDK's serviceCode) */
|
|
595
|
+
serviceCode?: string;
|
|
596
|
+
/** URL to redirect back to after completion */
|
|
597
|
+
redirect?: string;
|
|
598
|
+
}
|
|
599
|
+
/** Options for wizard flows that operate on an existing subscription */
|
|
600
|
+
interface ContractWizardSubscriptionOptions {
|
|
601
|
+
/** URL to redirect back to after completion */
|
|
602
|
+
redirect?: string;
|
|
603
|
+
}
|
|
604
|
+
|
|
584
605
|
/** Redirect and URL generation - redirectToLogin / redirectToAuthorize / redirectToLogout / getLoginUrl / getSignupUrl / getLogoutUrl */
|
|
585
606
|
|
|
586
607
|
/** Options for redirectToAuthorize */
|
|
@@ -668,6 +689,16 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
668
689
|
cancelSubscription: (params: FFIDCancelSubscriptionParams) => Promise<FFIDApiResponse<FFIDCancelSubscriptionResponse>>;
|
|
669
690
|
previewPlanChange: (params: FFIDPreviewPlanChangeParams) => Promise<FFIDApiResponse<FFIDPlanChangePreviewResponse>>;
|
|
670
691
|
verifyAccessToken: (accessToken: string, options?: FFIDVerifyAccessTokenOptions) => Promise<FFIDApiResponse<FFIDOAuthUserInfo>>;
|
|
692
|
+
getSubscribeUrl: (options?: ContractWizardSubscribeOptions) => string;
|
|
693
|
+
redirectToSubscribe: (options?: ContractWizardSubscribeOptions) => FFIDRedirectResult;
|
|
694
|
+
getChangePlanUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
695
|
+
redirectToChangePlan: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
696
|
+
getChangeSeatsUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
697
|
+
redirectToChangeSeats: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
698
|
+
getRecoverPaymentUrl: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => string;
|
|
699
|
+
redirectToRecoverPayment: (subscriptionId: string, options?: ContractWizardSubscriptionOptions) => FFIDRedirectResult;
|
|
700
|
+
getResubscribeUrl: (options?: ContractWizardResubscribeOptions) => string;
|
|
701
|
+
redirectToResubscribe: (options?: ContractWizardResubscribeOptions) => FFIDRedirectResult;
|
|
671
702
|
requestPasswordReset: (email: string) => Promise<FFIDApiResponse<FFIDPasswordResetResponse>>;
|
|
672
703
|
verifyPasswordResetToken: (accessToken: string) => Promise<FFIDApiResponse<FFIDPasswordResetVerifyResponse>>;
|
|
673
704
|
establishResetSession: (accessToken: string, refreshToken: string) => Promise<FFIDApiResponse<FFIDResetSessionResponse>>;
|
package/dist/server/index.js
CHANGED
|
@@ -595,7 +595,7 @@ function createMembersMethods(deps) {
|
|
|
595
595
|
}
|
|
596
596
|
|
|
597
597
|
// src/client/version-check.ts
|
|
598
|
-
var SDK_VERSION = "1.
|
|
598
|
+
var SDK_VERSION = "2.1.0";
|
|
599
599
|
var SDK_USER_AGENT = `FFID-SDK/${SDK_VERSION} (TypeScript)`;
|
|
600
600
|
var SDK_VERSION_HEADER = "X-FFID-SDK-Version";
|
|
601
601
|
function sdkHeaders() {
|
|
@@ -1443,6 +1443,86 @@ function createOtpMethods(deps) {
|
|
|
1443
1443
|
};
|
|
1444
1444
|
}
|
|
1445
1445
|
|
|
1446
|
+
// src/client/contract-wizard-methods.ts
|
|
1447
|
+
var CONTRACT_WIZARD_PATH = "/contract-wizard";
|
|
1448
|
+
function buildWizardUrl(baseUrl, flow, params) {
|
|
1449
|
+
const query = new URLSearchParams();
|
|
1450
|
+
query.set("flow", flow);
|
|
1451
|
+
for (const [key, value] of Object.entries(params)) {
|
|
1452
|
+
if (value !== void 0) {
|
|
1453
|
+
query.set(key, value);
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
return `${baseUrl}${CONTRACT_WIZARD_PATH}?${query.toString()}`;
|
|
1457
|
+
}
|
|
1458
|
+
function performRedirect(url, logger) {
|
|
1459
|
+
if (typeof window === "undefined") {
|
|
1460
|
+
logger.warn("SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093");
|
|
1461
|
+
return { success: false, error: "SSR \u74B0\u5883\u3067\u306F\u30EA\u30C0\u30A4\u30EC\u30AF\u30C8\u3067\u304D\u307E\u305B\u3093" };
|
|
1462
|
+
}
|
|
1463
|
+
logger.debug("Redirecting to contract wizard:", url);
|
|
1464
|
+
window.location.href = url;
|
|
1465
|
+
return { success: true };
|
|
1466
|
+
}
|
|
1467
|
+
function createContractWizardMethods(deps) {
|
|
1468
|
+
const { baseUrl, serviceCode, logger } = deps;
|
|
1469
|
+
function buildSubscriptionWizardUrl(flow, subscriptionId, options) {
|
|
1470
|
+
return buildWizardUrl(baseUrl, flow, {
|
|
1471
|
+
service: serviceCode,
|
|
1472
|
+
subscription: subscriptionId,
|
|
1473
|
+
redirect: options?.redirect
|
|
1474
|
+
});
|
|
1475
|
+
}
|
|
1476
|
+
function getSubscribeUrl(options) {
|
|
1477
|
+
return buildWizardUrl(baseUrl, "new-subscription", {
|
|
1478
|
+
service: serviceCode,
|
|
1479
|
+
redirect: options?.redirect
|
|
1480
|
+
});
|
|
1481
|
+
}
|
|
1482
|
+
function redirectToSubscribe(options) {
|
|
1483
|
+
return performRedirect(getSubscribeUrl(options), logger);
|
|
1484
|
+
}
|
|
1485
|
+
function getChangePlanUrl(subscriptionId, options) {
|
|
1486
|
+
return buildSubscriptionWizardUrl("change-plan", subscriptionId, options);
|
|
1487
|
+
}
|
|
1488
|
+
function redirectToChangePlan(subscriptionId, options) {
|
|
1489
|
+
return performRedirect(getChangePlanUrl(subscriptionId, options), logger);
|
|
1490
|
+
}
|
|
1491
|
+
function getChangeSeatsUrl(subscriptionId, options) {
|
|
1492
|
+
return buildSubscriptionWizardUrl("change-seats", subscriptionId, options);
|
|
1493
|
+
}
|
|
1494
|
+
function redirectToChangeSeats(subscriptionId, options) {
|
|
1495
|
+
return performRedirect(getChangeSeatsUrl(subscriptionId, options), logger);
|
|
1496
|
+
}
|
|
1497
|
+
function getRecoverPaymentUrl(subscriptionId, options) {
|
|
1498
|
+
return buildSubscriptionWizardUrl("payment-recovery", subscriptionId, options);
|
|
1499
|
+
}
|
|
1500
|
+
function redirectToRecoverPayment(subscriptionId, options) {
|
|
1501
|
+
return performRedirect(getRecoverPaymentUrl(subscriptionId, options), logger);
|
|
1502
|
+
}
|
|
1503
|
+
function getResubscribeUrl(options) {
|
|
1504
|
+
return buildWizardUrl(baseUrl, "resubscribe", {
|
|
1505
|
+
service: options?.serviceCode ?? serviceCode,
|
|
1506
|
+
redirect: options?.redirect
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
function redirectToResubscribe(options) {
|
|
1510
|
+
return performRedirect(getResubscribeUrl(options), logger);
|
|
1511
|
+
}
|
|
1512
|
+
return {
|
|
1513
|
+
getSubscribeUrl,
|
|
1514
|
+
redirectToSubscribe,
|
|
1515
|
+
getChangePlanUrl,
|
|
1516
|
+
redirectToChangePlan,
|
|
1517
|
+
getChangeSeatsUrl,
|
|
1518
|
+
redirectToChangeSeats,
|
|
1519
|
+
getRecoverPaymentUrl,
|
|
1520
|
+
redirectToRecoverPayment,
|
|
1521
|
+
getResubscribeUrl,
|
|
1522
|
+
redirectToResubscribe
|
|
1523
|
+
};
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1446
1526
|
// src/client/ffid-client.ts
|
|
1447
1527
|
var UNAUTHORIZED_STATUS2 = 401;
|
|
1448
1528
|
var SDK_LOG_PREFIX = "[FFID SDK]";
|
|
@@ -1642,6 +1722,11 @@ function createFFIDClient(config) {
|
|
|
1642
1722
|
error: createError("VALIDATION_ERROR", "organizationId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1643
1723
|
};
|
|
1644
1724
|
}
|
|
1725
|
+
if (authMode === "token" && (params.userId === void 0 || !params.userId.trim())) {
|
|
1726
|
+
return {
|
|
1727
|
+
error: createError("VALIDATION_ERROR", "token \u30E2\u30FC\u30C9\u3067\u306F userId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1728
|
+
};
|
|
1729
|
+
}
|
|
1645
1730
|
if (params.userId !== void 0 && !params.userId.trim()) {
|
|
1646
1731
|
return {
|
|
1647
1732
|
error: createError("VALIDATION_ERROR", "userId \u3092\u6307\u5B9A\u3059\u308B\u5834\u5408\u3001\u7A7A\u6587\u5B57\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093")
|
|
@@ -1690,6 +1775,22 @@ function createFFIDClient(config) {
|
|
|
1690
1775
|
fetchWithAuth,
|
|
1691
1776
|
errorCodes: FFID_ERROR_CODES
|
|
1692
1777
|
});
|
|
1778
|
+
const {
|
|
1779
|
+
getSubscribeUrl,
|
|
1780
|
+
redirectToSubscribe,
|
|
1781
|
+
getChangePlanUrl,
|
|
1782
|
+
redirectToChangePlan,
|
|
1783
|
+
getChangeSeatsUrl,
|
|
1784
|
+
redirectToChangeSeats,
|
|
1785
|
+
getRecoverPaymentUrl,
|
|
1786
|
+
redirectToRecoverPayment,
|
|
1787
|
+
getResubscribeUrl,
|
|
1788
|
+
redirectToResubscribe
|
|
1789
|
+
} = createContractWizardMethods({
|
|
1790
|
+
baseUrl,
|
|
1791
|
+
serviceCode: config.serviceCode,
|
|
1792
|
+
logger
|
|
1793
|
+
});
|
|
1693
1794
|
const { sendOtp, verifyOtp } = createOtpMethods({
|
|
1694
1795
|
baseUrl,
|
|
1695
1796
|
logger,
|
|
@@ -1733,6 +1834,16 @@ function createFFIDClient(config) {
|
|
|
1733
1834
|
cancelSubscription,
|
|
1734
1835
|
previewPlanChange,
|
|
1735
1836
|
verifyAccessToken,
|
|
1837
|
+
getSubscribeUrl,
|
|
1838
|
+
redirectToSubscribe,
|
|
1839
|
+
getChangePlanUrl,
|
|
1840
|
+
redirectToChangePlan,
|
|
1841
|
+
getChangeSeatsUrl,
|
|
1842
|
+
redirectToChangeSeats,
|
|
1843
|
+
getRecoverPaymentUrl,
|
|
1844
|
+
redirectToRecoverPayment,
|
|
1845
|
+
getResubscribeUrl,
|
|
1846
|
+
redirectToResubscribe,
|
|
1736
1847
|
requestPasswordReset,
|
|
1737
1848
|
verifyPasswordResetToken,
|
|
1738
1849
|
establishResetSession,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feelflow/ffid-sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "FeelFlow ID Platform SDK for React/Next.js applications",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"feelflow",
|
|
@@ -99,6 +99,8 @@
|
|
|
99
99
|
"@testing-library/react": "^16.0.0",
|
|
100
100
|
"@types/react": "^19.0.0",
|
|
101
101
|
"@types/react-dom": "^19.0.0",
|
|
102
|
+
"@typescript-eslint/eslint-plugin": "^8.58.0",
|
|
103
|
+
"@typescript-eslint/parser": "^8.58.0",
|
|
102
104
|
"eslint-plugin-react-hooks": "^7.0.1",
|
|
103
105
|
"jsdom": "^27.0.0",
|
|
104
106
|
"react": "^19.0.0",
|