@feelflow/ffid-sdk 1.19.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-543CO3HP.cjs → chunk-4A5LAKNH.cjs} +135 -5
- package/dist/{chunk-3IV7STDJ.js → chunk-7OVB5XZV.js} +135 -5
- 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 +55 -2
- package/dist/index.d.ts +55 -2
- package/dist/index.js +2 -2
- package/dist/server/index.cjs +124 -4
- package/dist/server/index.d.cts +32 -1
- package/dist/server/index.d.ts +32 -1
- package/dist/server/index.js +124 -4
- 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 = "
|
|
603
|
+
var SDK_VERSION = "2.0.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,88 @@ 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 getSubscribeUrl(options) {
|
|
1488
|
+
return buildWizardUrl(baseUrl, "new-subscription", {
|
|
1489
|
+
service: serviceCode,
|
|
1490
|
+
redirect: options?.redirect
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1493
|
+
function redirectToSubscribe(options) {
|
|
1494
|
+
return performRedirect(getSubscribeUrl(options), logger);
|
|
1495
|
+
}
|
|
1496
|
+
function getChangePlanUrl(subscriptionId, options) {
|
|
1497
|
+
return buildWizardUrl(baseUrl, "change-plan", {
|
|
1498
|
+
subscription: subscriptionId,
|
|
1499
|
+
redirect: options?.redirect
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1502
|
+
function redirectToChangePlan(subscriptionId, options) {
|
|
1503
|
+
return performRedirect(getChangePlanUrl(subscriptionId, options), logger);
|
|
1504
|
+
}
|
|
1505
|
+
function getChangeSeatsUrl(subscriptionId, options) {
|
|
1506
|
+
return buildWizardUrl(baseUrl, "change-seats", {
|
|
1507
|
+
subscription: subscriptionId,
|
|
1508
|
+
redirect: options?.redirect
|
|
1509
|
+
});
|
|
1510
|
+
}
|
|
1511
|
+
function redirectToChangeSeats(subscriptionId, options) {
|
|
1512
|
+
return performRedirect(getChangeSeatsUrl(subscriptionId, options), logger);
|
|
1513
|
+
}
|
|
1514
|
+
function getRecoverPaymentUrl(subscriptionId, options) {
|
|
1515
|
+
return buildWizardUrl(baseUrl, "payment-recovery", {
|
|
1516
|
+
subscription: subscriptionId,
|
|
1517
|
+
redirect: options?.redirect
|
|
1518
|
+
});
|
|
1519
|
+
}
|
|
1520
|
+
function redirectToRecoverPayment(subscriptionId, options) {
|
|
1521
|
+
return performRedirect(getRecoverPaymentUrl(subscriptionId, options), logger);
|
|
1522
|
+
}
|
|
1523
|
+
function getResubscribeUrl(options) {
|
|
1524
|
+
return buildWizardUrl(baseUrl, "resubscribe", {
|
|
1525
|
+
service: options?.serviceCode ?? serviceCode,
|
|
1526
|
+
redirect: options?.redirect
|
|
1527
|
+
});
|
|
1528
|
+
}
|
|
1529
|
+
function redirectToResubscribe(options) {
|
|
1530
|
+
return performRedirect(getResubscribeUrl(options), logger);
|
|
1531
|
+
}
|
|
1532
|
+
return {
|
|
1533
|
+
getSubscribeUrl,
|
|
1534
|
+
redirectToSubscribe,
|
|
1535
|
+
getChangePlanUrl,
|
|
1536
|
+
redirectToChangePlan,
|
|
1537
|
+
getChangeSeatsUrl,
|
|
1538
|
+
redirectToChangeSeats,
|
|
1539
|
+
getRecoverPaymentUrl,
|
|
1540
|
+
redirectToRecoverPayment,
|
|
1541
|
+
getResubscribeUrl,
|
|
1542
|
+
redirectToResubscribe
|
|
1543
|
+
};
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1464
1546
|
// src/client/ffid-client.ts
|
|
1465
1547
|
var UNAUTHORIZED_STATUS2 = 401;
|
|
1466
1548
|
var SDK_LOG_PREFIX = "[FFID SDK]";
|
|
@@ -1655,16 +1737,28 @@ function createFFIDClient(config) {
|
|
|
1655
1737
|
logger
|
|
1656
1738
|
});
|
|
1657
1739
|
async function checkSubscription(params) {
|
|
1658
|
-
if (!params.
|
|
1740
|
+
if (!params.organizationId) {
|
|
1741
|
+
return {
|
|
1742
|
+
error: createError("VALIDATION_ERROR", "organizationId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1743
|
+
};
|
|
1744
|
+
}
|
|
1745
|
+
if (authMode === "token" && (params.userId === void 0 || !params.userId.trim())) {
|
|
1659
1746
|
return {
|
|
1660
|
-
error: createError("VALIDATION_ERROR", "
|
|
1747
|
+
error: createError("VALIDATION_ERROR", "token \u30E2\u30FC\u30C9\u3067\u306F userId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1748
|
+
};
|
|
1749
|
+
}
|
|
1750
|
+
if (params.userId !== void 0 && !params.userId.trim()) {
|
|
1751
|
+
return {
|
|
1752
|
+
error: createError("VALIDATION_ERROR", "userId \u3092\u6307\u5B9A\u3059\u308B\u5834\u5408\u3001\u7A7A\u6587\u5B57\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093")
|
|
1661
1753
|
};
|
|
1662
1754
|
}
|
|
1663
1755
|
const query = new URLSearchParams({
|
|
1664
|
-
userId: params.userId,
|
|
1665
1756
|
organizationId: params.organizationId,
|
|
1666
1757
|
serviceCode: config.serviceCode
|
|
1667
1758
|
});
|
|
1759
|
+
if (params.userId) {
|
|
1760
|
+
query.set("userId", params.userId);
|
|
1761
|
+
}
|
|
1668
1762
|
return fetchWithAuth(
|
|
1669
1763
|
`${EXT_CHECK_ENDPOINT}?${query.toString()}`
|
|
1670
1764
|
);
|
|
@@ -1701,6 +1795,22 @@ function createFFIDClient(config) {
|
|
|
1701
1795
|
fetchWithAuth,
|
|
1702
1796
|
errorCodes: FFID_ERROR_CODES
|
|
1703
1797
|
});
|
|
1798
|
+
const {
|
|
1799
|
+
getSubscribeUrl,
|
|
1800
|
+
redirectToSubscribe,
|
|
1801
|
+
getChangePlanUrl,
|
|
1802
|
+
redirectToChangePlan,
|
|
1803
|
+
getChangeSeatsUrl,
|
|
1804
|
+
redirectToChangeSeats,
|
|
1805
|
+
getRecoverPaymentUrl,
|
|
1806
|
+
redirectToRecoverPayment,
|
|
1807
|
+
getResubscribeUrl,
|
|
1808
|
+
redirectToResubscribe
|
|
1809
|
+
} = createContractWizardMethods({
|
|
1810
|
+
baseUrl,
|
|
1811
|
+
serviceCode: config.serviceCode,
|
|
1812
|
+
logger
|
|
1813
|
+
});
|
|
1704
1814
|
const { sendOtp, verifyOtp } = createOtpMethods({
|
|
1705
1815
|
baseUrl,
|
|
1706
1816
|
logger,
|
|
@@ -1744,6 +1854,16 @@ function createFFIDClient(config) {
|
|
|
1744
1854
|
cancelSubscription,
|
|
1745
1855
|
previewPlanChange,
|
|
1746
1856
|
verifyAccessToken,
|
|
1857
|
+
getSubscribeUrl,
|
|
1858
|
+
redirectToSubscribe,
|
|
1859
|
+
getChangePlanUrl,
|
|
1860
|
+
redirectToChangePlan,
|
|
1861
|
+
getChangeSeatsUrl,
|
|
1862
|
+
redirectToChangeSeats,
|
|
1863
|
+
getRecoverPaymentUrl,
|
|
1864
|
+
redirectToRecoverPayment,
|
|
1865
|
+
getResubscribeUrl,
|
|
1866
|
+
redirectToResubscribe,
|
|
1747
1867
|
requestPasswordReset,
|
|
1748
1868
|
verifyPasswordResetToken,
|
|
1749
1869
|
establishResetSession,
|
|
@@ -2059,7 +2179,17 @@ function useFFID() {
|
|
|
2059
2179
|
switchOrganization: context.switchOrganization,
|
|
2060
2180
|
refresh: context.refresh,
|
|
2061
2181
|
getLoginUrl: client.getLoginUrl,
|
|
2062
|
-
getSignupUrl: client.getSignupUrl
|
|
2182
|
+
getSignupUrl: client.getSignupUrl,
|
|
2183
|
+
getSubscribeUrl: client.getSubscribeUrl,
|
|
2184
|
+
redirectToSubscribe: client.redirectToSubscribe,
|
|
2185
|
+
getChangePlanUrl: client.getChangePlanUrl,
|
|
2186
|
+
redirectToChangePlan: client.redirectToChangePlan,
|
|
2187
|
+
getChangeSeatsUrl: client.getChangeSeatsUrl,
|
|
2188
|
+
redirectToChangeSeats: client.redirectToChangeSeats,
|
|
2189
|
+
getRecoverPaymentUrl: client.getRecoverPaymentUrl,
|
|
2190
|
+
redirectToRecoverPayment: client.redirectToRecoverPayment,
|
|
2191
|
+
getResubscribeUrl: client.getResubscribeUrl,
|
|
2192
|
+
redirectToResubscribe: client.redirectToResubscribe
|
|
2063
2193
|
};
|
|
2064
2194
|
}
|
|
2065
2195
|
function FFIDLoginButton({
|
|
@@ -598,7 +598,7 @@ function createMembersMethods(deps) {
|
|
|
598
598
|
}
|
|
599
599
|
|
|
600
600
|
// src/client/version-check.ts
|
|
601
|
-
var SDK_VERSION = "
|
|
601
|
+
var SDK_VERSION = "2.0.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,88 @@ 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 getSubscribeUrl(options) {
|
|
1486
|
+
return buildWizardUrl(baseUrl, "new-subscription", {
|
|
1487
|
+
service: serviceCode,
|
|
1488
|
+
redirect: options?.redirect
|
|
1489
|
+
});
|
|
1490
|
+
}
|
|
1491
|
+
function redirectToSubscribe(options) {
|
|
1492
|
+
return performRedirect(getSubscribeUrl(options), logger);
|
|
1493
|
+
}
|
|
1494
|
+
function getChangePlanUrl(subscriptionId, options) {
|
|
1495
|
+
return buildWizardUrl(baseUrl, "change-plan", {
|
|
1496
|
+
subscription: subscriptionId,
|
|
1497
|
+
redirect: options?.redirect
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
function redirectToChangePlan(subscriptionId, options) {
|
|
1501
|
+
return performRedirect(getChangePlanUrl(subscriptionId, options), logger);
|
|
1502
|
+
}
|
|
1503
|
+
function getChangeSeatsUrl(subscriptionId, options) {
|
|
1504
|
+
return buildWizardUrl(baseUrl, "change-seats", {
|
|
1505
|
+
subscription: subscriptionId,
|
|
1506
|
+
redirect: options?.redirect
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
function redirectToChangeSeats(subscriptionId, options) {
|
|
1510
|
+
return performRedirect(getChangeSeatsUrl(subscriptionId, options), logger);
|
|
1511
|
+
}
|
|
1512
|
+
function getRecoverPaymentUrl(subscriptionId, options) {
|
|
1513
|
+
return buildWizardUrl(baseUrl, "payment-recovery", {
|
|
1514
|
+
subscription: subscriptionId,
|
|
1515
|
+
redirect: options?.redirect
|
|
1516
|
+
});
|
|
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
|
+
|
|
1462
1544
|
// src/client/ffid-client.ts
|
|
1463
1545
|
var UNAUTHORIZED_STATUS2 = 401;
|
|
1464
1546
|
var SDK_LOG_PREFIX = "[FFID SDK]";
|
|
@@ -1653,16 +1735,28 @@ function createFFIDClient(config) {
|
|
|
1653
1735
|
logger
|
|
1654
1736
|
});
|
|
1655
1737
|
async function checkSubscription(params) {
|
|
1656
|
-
if (!params.
|
|
1738
|
+
if (!params.organizationId) {
|
|
1739
|
+
return {
|
|
1740
|
+
error: createError("VALIDATION_ERROR", "organizationId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1741
|
+
};
|
|
1742
|
+
}
|
|
1743
|
+
if (authMode === "token" && (params.userId === void 0 || !params.userId.trim())) {
|
|
1657
1744
|
return {
|
|
1658
|
-
error: createError("VALIDATION_ERROR", "
|
|
1745
|
+
error: createError("VALIDATION_ERROR", "token \u30E2\u30FC\u30C9\u3067\u306F userId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1746
|
+
};
|
|
1747
|
+
}
|
|
1748
|
+
if (params.userId !== void 0 && !params.userId.trim()) {
|
|
1749
|
+
return {
|
|
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")
|
|
1659
1751
|
};
|
|
1660
1752
|
}
|
|
1661
1753
|
const query = new URLSearchParams({
|
|
1662
|
-
userId: params.userId,
|
|
1663
1754
|
organizationId: params.organizationId,
|
|
1664
1755
|
serviceCode: config.serviceCode
|
|
1665
1756
|
});
|
|
1757
|
+
if (params.userId) {
|
|
1758
|
+
query.set("userId", params.userId);
|
|
1759
|
+
}
|
|
1666
1760
|
return fetchWithAuth(
|
|
1667
1761
|
`${EXT_CHECK_ENDPOINT}?${query.toString()}`
|
|
1668
1762
|
);
|
|
@@ -1699,6 +1793,22 @@ function createFFIDClient(config) {
|
|
|
1699
1793
|
fetchWithAuth,
|
|
1700
1794
|
errorCodes: FFID_ERROR_CODES
|
|
1701
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
|
+
});
|
|
1702
1812
|
const { sendOtp, verifyOtp } = createOtpMethods({
|
|
1703
1813
|
baseUrl,
|
|
1704
1814
|
logger,
|
|
@@ -1742,6 +1852,16 @@ function createFFIDClient(config) {
|
|
|
1742
1852
|
cancelSubscription,
|
|
1743
1853
|
previewPlanChange,
|
|
1744
1854
|
verifyAccessToken,
|
|
1855
|
+
getSubscribeUrl,
|
|
1856
|
+
redirectToSubscribe,
|
|
1857
|
+
getChangePlanUrl,
|
|
1858
|
+
redirectToChangePlan,
|
|
1859
|
+
getChangeSeatsUrl,
|
|
1860
|
+
redirectToChangeSeats,
|
|
1861
|
+
getRecoverPaymentUrl,
|
|
1862
|
+
redirectToRecoverPayment,
|
|
1863
|
+
getResubscribeUrl,
|
|
1864
|
+
redirectToResubscribe,
|
|
1745
1865
|
requestPasswordReset,
|
|
1746
1866
|
verifyPasswordResetToken,
|
|
1747
1867
|
establishResetSession,
|
|
@@ -2057,7 +2177,17 @@ function useFFID() {
|
|
|
2057
2177
|
switchOrganization: context.switchOrganization,
|
|
2058
2178
|
refresh: context.refresh,
|
|
2059
2179
|
getLoginUrl: client.getLoginUrl,
|
|
2060
|
-
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
|
|
2061
2191
|
};
|
|
2062
2192
|
}
|
|
2063
2193
|
function FFIDLoginButton({
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk4A5LAKNH_cjs = require('../chunk-4A5LAKNH.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 chunk4A5LAKNH_cjs.FFIDAnnouncementBadge; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunk4A5LAKNH_cjs.FFIDAnnouncementList; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunk4A5LAKNH_cjs.FFIDLoginButton; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunk4A5LAKNH_cjs.FFIDOrganizationSwitcher; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunk4A5LAKNH_cjs.FFIDSubscriptionBadge; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunk4A5LAKNH_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-7OVB5XZV.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk4A5LAKNH_cjs = require('./chunk-4A5LAKNH.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 } = chunk4A5LAKNH_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 chunk4A5LAKNH_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 chunk4A5LAKNH_cjs.FFIDAnnouncementBadge; }
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "FFIDAnnouncementList", {
|
|
81
81
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
82
|
+
get: function () { return chunk4A5LAKNH_cjs.FFIDAnnouncementList; }
|
|
83
83
|
});
|
|
84
84
|
Object.defineProperty(exports, "FFIDLoginButton", {
|
|
85
85
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
86
|
+
get: function () { return chunk4A5LAKNH_cjs.FFIDLoginButton; }
|
|
87
87
|
});
|
|
88
88
|
Object.defineProperty(exports, "FFIDOrganizationSwitcher", {
|
|
89
89
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
90
|
+
get: function () { return chunk4A5LAKNH_cjs.FFIDOrganizationSwitcher; }
|
|
91
91
|
});
|
|
92
92
|
Object.defineProperty(exports, "FFIDProvider", {
|
|
93
93
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
94
|
+
get: function () { return chunk4A5LAKNH_cjs.FFIDProvider; }
|
|
95
95
|
});
|
|
96
96
|
Object.defineProperty(exports, "FFIDSubscriptionBadge", {
|
|
97
97
|
enumerable: true,
|
|
98
|
-
get: function () { return
|
|
98
|
+
get: function () { return chunk4A5LAKNH_cjs.FFIDSubscriptionBadge; }
|
|
99
99
|
});
|
|
100
100
|
Object.defineProperty(exports, "FFIDUserMenu", {
|
|
101
101
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
102
|
+
get: function () { return chunk4A5LAKNH_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 chunk4A5LAKNH_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 chunk4A5LAKNH_cjs.createFFIDAnnouncementsClient; }
|
|
111
111
|
});
|
|
112
112
|
Object.defineProperty(exports, "createFFIDClient", {
|
|
113
113
|
enumerable: true,
|
|
114
|
-
get: function () { return
|
|
114
|
+
get: function () { return chunk4A5LAKNH_cjs.createFFIDClient; }
|
|
115
115
|
});
|
|
116
116
|
Object.defineProperty(exports, "createTokenStore", {
|
|
117
117
|
enumerable: true,
|
|
118
|
-
get: function () { return
|
|
118
|
+
get: function () { return chunk4A5LAKNH_cjs.createTokenStore; }
|
|
119
119
|
});
|
|
120
120
|
Object.defineProperty(exports, "generateCodeChallenge", {
|
|
121
121
|
enumerable: true,
|
|
122
|
-
get: function () { return
|
|
122
|
+
get: function () { return chunk4A5LAKNH_cjs.generateCodeChallenge; }
|
|
123
123
|
});
|
|
124
124
|
Object.defineProperty(exports, "generateCodeVerifier", {
|
|
125
125
|
enumerable: true,
|
|
126
|
-
get: function () { return
|
|
126
|
+
get: function () { return chunk4A5LAKNH_cjs.generateCodeVerifier; }
|
|
127
127
|
});
|
|
128
128
|
Object.defineProperty(exports, "retrieveCodeVerifier", {
|
|
129
129
|
enumerable: true,
|
|
130
|
-
get: function () { return
|
|
130
|
+
get: function () { return chunk4A5LAKNH_cjs.retrieveCodeVerifier; }
|
|
131
131
|
});
|
|
132
132
|
Object.defineProperty(exports, "storeCodeVerifier", {
|
|
133
133
|
enumerable: true,
|
|
134
|
-
get: function () { return
|
|
134
|
+
get: function () { return chunk4A5LAKNH_cjs.storeCodeVerifier; }
|
|
135
135
|
});
|
|
136
136
|
Object.defineProperty(exports, "useFFID", {
|
|
137
137
|
enumerable: true,
|
|
138
|
-
get: function () { return
|
|
138
|
+
get: function () { return chunk4A5LAKNH_cjs.useFFID; }
|
|
139
139
|
});
|
|
140
140
|
Object.defineProperty(exports, "useFFIDAnnouncements", {
|
|
141
141
|
enumerable: true,
|
|
142
|
-
get: function () { return
|
|
142
|
+
get: function () { return chunk4A5LAKNH_cjs.useFFIDAnnouncements; }
|
|
143
143
|
});
|
|
144
144
|
Object.defineProperty(exports, "useSubscription", {
|
|
145
145
|
enumerable: true,
|
|
146
|
-
get: function () { return
|
|
146
|
+
get: function () { return chunk4A5LAKNH_cjs.useSubscription; }
|
|
147
147
|
});
|
|
148
148
|
Object.defineProperty(exports, "withSubscription", {
|
|
149
149
|
enumerable: true,
|
|
150
|
-
get: function () { return
|
|
150
|
+
get: function () { return chunk4A5LAKNH_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 */
|
|
@@ -338,7 +361,7 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
338
361
|
exchangeCodeForTokens: (code: string, codeVerifier?: string) => Promise<FFIDApiResponse<void>>;
|
|
339
362
|
refreshAccessToken: () => Promise<FFIDApiResponse<void>>;
|
|
340
363
|
checkSubscription: (params: {
|
|
341
|
-
userId
|
|
364
|
+
userId?: string;
|
|
342
365
|
organizationId: string;
|
|
343
366
|
}) => Promise<FFIDApiResponse<FFIDSubscriptionCheckResponse>>;
|
|
344
367
|
listMembers: (params: {
|
|
@@ -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 */
|
|
@@ -338,7 +361,7 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
338
361
|
exchangeCodeForTokens: (code: string, codeVerifier?: string) => Promise<FFIDApiResponse<void>>;
|
|
339
362
|
refreshAccessToken: () => Promise<FFIDApiResponse<void>>;
|
|
340
363
|
checkSubscription: (params: {
|
|
341
|
-
userId
|
|
364
|
+
userId?: string;
|
|
342
365
|
organizationId: string;
|
|
343
366
|
}) => Promise<FFIDApiResponse<FFIDSubscriptionCheckResponse>>;
|
|
344
367
|
listMembers: (params: {
|
|
@@ -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-7OVB5XZV.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-7OVB5XZV.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 = "
|
|
599
|
+
var SDK_VERSION = "2.0.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,88 @@ 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 getSubscribeUrl(options) {
|
|
1471
|
+
return buildWizardUrl(baseUrl, "new-subscription", {
|
|
1472
|
+
service: serviceCode,
|
|
1473
|
+
redirect: options?.redirect
|
|
1474
|
+
});
|
|
1475
|
+
}
|
|
1476
|
+
function redirectToSubscribe(options) {
|
|
1477
|
+
return performRedirect(getSubscribeUrl(options), logger);
|
|
1478
|
+
}
|
|
1479
|
+
function getChangePlanUrl(subscriptionId, options) {
|
|
1480
|
+
return buildWizardUrl(baseUrl, "change-plan", {
|
|
1481
|
+
subscription: subscriptionId,
|
|
1482
|
+
redirect: options?.redirect
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
function redirectToChangePlan(subscriptionId, options) {
|
|
1486
|
+
return performRedirect(getChangePlanUrl(subscriptionId, options), logger);
|
|
1487
|
+
}
|
|
1488
|
+
function getChangeSeatsUrl(subscriptionId, options) {
|
|
1489
|
+
return buildWizardUrl(baseUrl, "change-seats", {
|
|
1490
|
+
subscription: subscriptionId,
|
|
1491
|
+
redirect: options?.redirect
|
|
1492
|
+
});
|
|
1493
|
+
}
|
|
1494
|
+
function redirectToChangeSeats(subscriptionId, options) {
|
|
1495
|
+
return performRedirect(getChangeSeatsUrl(subscriptionId, options), logger);
|
|
1496
|
+
}
|
|
1497
|
+
function getRecoverPaymentUrl(subscriptionId, options) {
|
|
1498
|
+
return buildWizardUrl(baseUrl, "payment-recovery", {
|
|
1499
|
+
subscription: subscriptionId,
|
|
1500
|
+
redirect: options?.redirect
|
|
1501
|
+
});
|
|
1502
|
+
}
|
|
1503
|
+
function redirectToRecoverPayment(subscriptionId, options) {
|
|
1504
|
+
return performRedirect(getRecoverPaymentUrl(subscriptionId, options), logger);
|
|
1505
|
+
}
|
|
1506
|
+
function getResubscribeUrl(options) {
|
|
1507
|
+
return buildWizardUrl(baseUrl, "resubscribe", {
|
|
1508
|
+
service: options?.serviceCode ?? serviceCode,
|
|
1509
|
+
redirect: options?.redirect
|
|
1510
|
+
});
|
|
1511
|
+
}
|
|
1512
|
+
function redirectToResubscribe(options) {
|
|
1513
|
+
return performRedirect(getResubscribeUrl(options), logger);
|
|
1514
|
+
}
|
|
1515
|
+
return {
|
|
1516
|
+
getSubscribeUrl,
|
|
1517
|
+
redirectToSubscribe,
|
|
1518
|
+
getChangePlanUrl,
|
|
1519
|
+
redirectToChangePlan,
|
|
1520
|
+
getChangeSeatsUrl,
|
|
1521
|
+
redirectToChangeSeats,
|
|
1522
|
+
getRecoverPaymentUrl,
|
|
1523
|
+
redirectToRecoverPayment,
|
|
1524
|
+
getResubscribeUrl,
|
|
1525
|
+
redirectToResubscribe
|
|
1526
|
+
};
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1447
1529
|
// src/client/ffid-client.ts
|
|
1448
1530
|
var UNAUTHORIZED_STATUS2 = 401;
|
|
1449
1531
|
var SDK_LOG_PREFIX = "[FFID SDK]";
|
|
@@ -1638,16 +1720,28 @@ function createFFIDClient(config) {
|
|
|
1638
1720
|
logger
|
|
1639
1721
|
});
|
|
1640
1722
|
async function checkSubscription(params) {
|
|
1641
|
-
if (!params.
|
|
1723
|
+
if (!params.organizationId) {
|
|
1724
|
+
return {
|
|
1725
|
+
error: createError("VALIDATION_ERROR", "organizationId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1726
|
+
};
|
|
1727
|
+
}
|
|
1728
|
+
if (authMode === "token" && (params.userId === void 0 || !params.userId.trim())) {
|
|
1642
1729
|
return {
|
|
1643
|
-
error: createError("VALIDATION_ERROR", "
|
|
1730
|
+
error: createError("VALIDATION_ERROR", "token \u30E2\u30FC\u30C9\u3067\u306F userId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1733
|
+
if (params.userId !== void 0 && !params.userId.trim()) {
|
|
1734
|
+
return {
|
|
1735
|
+
error: createError("VALIDATION_ERROR", "userId \u3092\u6307\u5B9A\u3059\u308B\u5834\u5408\u3001\u7A7A\u6587\u5B57\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093")
|
|
1644
1736
|
};
|
|
1645
1737
|
}
|
|
1646
1738
|
const query = new URLSearchParams({
|
|
1647
|
-
userId: params.userId,
|
|
1648
1739
|
organizationId: params.organizationId,
|
|
1649
1740
|
serviceCode: config.serviceCode
|
|
1650
1741
|
});
|
|
1742
|
+
if (params.userId) {
|
|
1743
|
+
query.set("userId", params.userId);
|
|
1744
|
+
}
|
|
1651
1745
|
return fetchWithAuth(
|
|
1652
1746
|
`${EXT_CHECK_ENDPOINT}?${query.toString()}`
|
|
1653
1747
|
);
|
|
@@ -1684,6 +1778,22 @@ function createFFIDClient(config) {
|
|
|
1684
1778
|
fetchWithAuth,
|
|
1685
1779
|
errorCodes: FFID_ERROR_CODES
|
|
1686
1780
|
});
|
|
1781
|
+
const {
|
|
1782
|
+
getSubscribeUrl,
|
|
1783
|
+
redirectToSubscribe,
|
|
1784
|
+
getChangePlanUrl,
|
|
1785
|
+
redirectToChangePlan,
|
|
1786
|
+
getChangeSeatsUrl,
|
|
1787
|
+
redirectToChangeSeats,
|
|
1788
|
+
getRecoverPaymentUrl,
|
|
1789
|
+
redirectToRecoverPayment,
|
|
1790
|
+
getResubscribeUrl,
|
|
1791
|
+
redirectToResubscribe
|
|
1792
|
+
} = createContractWizardMethods({
|
|
1793
|
+
baseUrl,
|
|
1794
|
+
serviceCode: config.serviceCode,
|
|
1795
|
+
logger
|
|
1796
|
+
});
|
|
1687
1797
|
const { sendOtp, verifyOtp } = createOtpMethods({
|
|
1688
1798
|
baseUrl,
|
|
1689
1799
|
logger,
|
|
@@ -1727,6 +1837,16 @@ function createFFIDClient(config) {
|
|
|
1727
1837
|
cancelSubscription,
|
|
1728
1838
|
previewPlanChange,
|
|
1729
1839
|
verifyAccessToken,
|
|
1840
|
+
getSubscribeUrl,
|
|
1841
|
+
redirectToSubscribe,
|
|
1842
|
+
getChangePlanUrl,
|
|
1843
|
+
redirectToChangePlan,
|
|
1844
|
+
getChangeSeatsUrl,
|
|
1845
|
+
redirectToChangeSeats,
|
|
1846
|
+
getRecoverPaymentUrl,
|
|
1847
|
+
redirectToRecoverPayment,
|
|
1848
|
+
getResubscribeUrl,
|
|
1849
|
+
redirectToResubscribe,
|
|
1730
1850
|
requestPasswordReset,
|
|
1731
1851
|
verifyPasswordResetToken,
|
|
1732
1852
|
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 */
|
|
@@ -644,7 +665,7 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
644
665
|
exchangeCodeForTokens: (code: string, codeVerifier?: string) => Promise<FFIDApiResponse<void>>;
|
|
645
666
|
refreshAccessToken: () => Promise<FFIDApiResponse<void>>;
|
|
646
667
|
checkSubscription: (params: {
|
|
647
|
-
userId
|
|
668
|
+
userId?: string;
|
|
648
669
|
organizationId: string;
|
|
649
670
|
}) => Promise<FFIDApiResponse<FFIDSubscriptionCheckResponse>>;
|
|
650
671
|
listMembers: (params: {
|
|
@@ -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 */
|
|
@@ -644,7 +665,7 @@ declare function createFFIDClient(config: FFIDConfig): {
|
|
|
644
665
|
exchangeCodeForTokens: (code: string, codeVerifier?: string) => Promise<FFIDApiResponse<void>>;
|
|
645
666
|
refreshAccessToken: () => Promise<FFIDApiResponse<void>>;
|
|
646
667
|
checkSubscription: (params: {
|
|
647
|
-
userId
|
|
668
|
+
userId?: string;
|
|
648
669
|
organizationId: string;
|
|
649
670
|
}) => Promise<FFIDApiResponse<FFIDSubscriptionCheckResponse>>;
|
|
650
671
|
listMembers: (params: {
|
|
@@ -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 = "
|
|
598
|
+
var SDK_VERSION = "2.0.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,88 @@ 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 getSubscribeUrl(options) {
|
|
1470
|
+
return buildWizardUrl(baseUrl, "new-subscription", {
|
|
1471
|
+
service: serviceCode,
|
|
1472
|
+
redirect: options?.redirect
|
|
1473
|
+
});
|
|
1474
|
+
}
|
|
1475
|
+
function redirectToSubscribe(options) {
|
|
1476
|
+
return performRedirect(getSubscribeUrl(options), logger);
|
|
1477
|
+
}
|
|
1478
|
+
function getChangePlanUrl(subscriptionId, options) {
|
|
1479
|
+
return buildWizardUrl(baseUrl, "change-plan", {
|
|
1480
|
+
subscription: subscriptionId,
|
|
1481
|
+
redirect: options?.redirect
|
|
1482
|
+
});
|
|
1483
|
+
}
|
|
1484
|
+
function redirectToChangePlan(subscriptionId, options) {
|
|
1485
|
+
return performRedirect(getChangePlanUrl(subscriptionId, options), logger);
|
|
1486
|
+
}
|
|
1487
|
+
function getChangeSeatsUrl(subscriptionId, options) {
|
|
1488
|
+
return buildWizardUrl(baseUrl, "change-seats", {
|
|
1489
|
+
subscription: subscriptionId,
|
|
1490
|
+
redirect: options?.redirect
|
|
1491
|
+
});
|
|
1492
|
+
}
|
|
1493
|
+
function redirectToChangeSeats(subscriptionId, options) {
|
|
1494
|
+
return performRedirect(getChangeSeatsUrl(subscriptionId, options), logger);
|
|
1495
|
+
}
|
|
1496
|
+
function getRecoverPaymentUrl(subscriptionId, options) {
|
|
1497
|
+
return buildWizardUrl(baseUrl, "payment-recovery", {
|
|
1498
|
+
subscription: subscriptionId,
|
|
1499
|
+
redirect: options?.redirect
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1502
|
+
function redirectToRecoverPayment(subscriptionId, options) {
|
|
1503
|
+
return performRedirect(getRecoverPaymentUrl(subscriptionId, options), logger);
|
|
1504
|
+
}
|
|
1505
|
+
function getResubscribeUrl(options) {
|
|
1506
|
+
return buildWizardUrl(baseUrl, "resubscribe", {
|
|
1507
|
+
service: options?.serviceCode ?? serviceCode,
|
|
1508
|
+
redirect: options?.redirect
|
|
1509
|
+
});
|
|
1510
|
+
}
|
|
1511
|
+
function redirectToResubscribe(options) {
|
|
1512
|
+
return performRedirect(getResubscribeUrl(options), logger);
|
|
1513
|
+
}
|
|
1514
|
+
return {
|
|
1515
|
+
getSubscribeUrl,
|
|
1516
|
+
redirectToSubscribe,
|
|
1517
|
+
getChangePlanUrl,
|
|
1518
|
+
redirectToChangePlan,
|
|
1519
|
+
getChangeSeatsUrl,
|
|
1520
|
+
redirectToChangeSeats,
|
|
1521
|
+
getRecoverPaymentUrl,
|
|
1522
|
+
redirectToRecoverPayment,
|
|
1523
|
+
getResubscribeUrl,
|
|
1524
|
+
redirectToResubscribe
|
|
1525
|
+
};
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1446
1528
|
// src/client/ffid-client.ts
|
|
1447
1529
|
var UNAUTHORIZED_STATUS2 = 401;
|
|
1448
1530
|
var SDK_LOG_PREFIX = "[FFID SDK]";
|
|
@@ -1637,16 +1719,28 @@ function createFFIDClient(config) {
|
|
|
1637
1719
|
logger
|
|
1638
1720
|
});
|
|
1639
1721
|
async function checkSubscription(params) {
|
|
1640
|
-
if (!params.
|
|
1722
|
+
if (!params.organizationId) {
|
|
1723
|
+
return {
|
|
1724
|
+
error: createError("VALIDATION_ERROR", "organizationId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1725
|
+
};
|
|
1726
|
+
}
|
|
1727
|
+
if (authMode === "token" && (params.userId === void 0 || !params.userId.trim())) {
|
|
1641
1728
|
return {
|
|
1642
|
-
error: createError("VALIDATION_ERROR", "
|
|
1729
|
+
error: createError("VALIDATION_ERROR", "token \u30E2\u30FC\u30C9\u3067\u306F userId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1730
|
+
};
|
|
1731
|
+
}
|
|
1732
|
+
if (params.userId !== void 0 && !params.userId.trim()) {
|
|
1733
|
+
return {
|
|
1734
|
+
error: createError("VALIDATION_ERROR", "userId \u3092\u6307\u5B9A\u3059\u308B\u5834\u5408\u3001\u7A7A\u6587\u5B57\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093")
|
|
1643
1735
|
};
|
|
1644
1736
|
}
|
|
1645
1737
|
const query = new URLSearchParams({
|
|
1646
|
-
userId: params.userId,
|
|
1647
1738
|
organizationId: params.organizationId,
|
|
1648
1739
|
serviceCode: config.serviceCode
|
|
1649
1740
|
});
|
|
1741
|
+
if (params.userId) {
|
|
1742
|
+
query.set("userId", params.userId);
|
|
1743
|
+
}
|
|
1650
1744
|
return fetchWithAuth(
|
|
1651
1745
|
`${EXT_CHECK_ENDPOINT}?${query.toString()}`
|
|
1652
1746
|
);
|
|
@@ -1683,6 +1777,22 @@ function createFFIDClient(config) {
|
|
|
1683
1777
|
fetchWithAuth,
|
|
1684
1778
|
errorCodes: FFID_ERROR_CODES
|
|
1685
1779
|
});
|
|
1780
|
+
const {
|
|
1781
|
+
getSubscribeUrl,
|
|
1782
|
+
redirectToSubscribe,
|
|
1783
|
+
getChangePlanUrl,
|
|
1784
|
+
redirectToChangePlan,
|
|
1785
|
+
getChangeSeatsUrl,
|
|
1786
|
+
redirectToChangeSeats,
|
|
1787
|
+
getRecoverPaymentUrl,
|
|
1788
|
+
redirectToRecoverPayment,
|
|
1789
|
+
getResubscribeUrl,
|
|
1790
|
+
redirectToResubscribe
|
|
1791
|
+
} = createContractWizardMethods({
|
|
1792
|
+
baseUrl,
|
|
1793
|
+
serviceCode: config.serviceCode,
|
|
1794
|
+
logger
|
|
1795
|
+
});
|
|
1686
1796
|
const { sendOtp, verifyOtp } = createOtpMethods({
|
|
1687
1797
|
baseUrl,
|
|
1688
1798
|
logger,
|
|
@@ -1726,6 +1836,16 @@ function createFFIDClient(config) {
|
|
|
1726
1836
|
cancelSubscription,
|
|
1727
1837
|
previewPlanChange,
|
|
1728
1838
|
verifyAccessToken,
|
|
1839
|
+
getSubscribeUrl,
|
|
1840
|
+
redirectToSubscribe,
|
|
1841
|
+
getChangePlanUrl,
|
|
1842
|
+
redirectToChangePlan,
|
|
1843
|
+
getChangeSeatsUrl,
|
|
1844
|
+
redirectToChangeSeats,
|
|
1845
|
+
getRecoverPaymentUrl,
|
|
1846
|
+
redirectToRecoverPayment,
|
|
1847
|
+
getResubscribeUrl,
|
|
1848
|
+
redirectToResubscribe,
|
|
1729
1849
|
requestPasswordReset,
|
|
1730
1850
|
verifyPasswordResetToken,
|
|
1731
1851
|
establishResetSession,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feelflow/ffid-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.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",
|