@feelflow/ffid-sdk 1.19.1 → 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-JT7IIDMS.cjs → chunk-4A5LAKNH.cjs} +125 -2
- package/dist/{chunk-66HJMEHY.js → chunk-7OVB5XZV.js} +125 -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 +114 -1
- package/dist/server/index.d.cts +31 -0
- package/dist/server/index.d.ts +31 -0
- package/dist/server/index.js +114 -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 = "
|
|
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]";
|
|
@@ -1660,6 +1742,11 @@ function createFFIDClient(config) {
|
|
|
1660
1742
|
error: createError("VALIDATION_ERROR", "organizationId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1661
1743
|
};
|
|
1662
1744
|
}
|
|
1745
|
+
if (authMode === "token" && (params.userId === void 0 || !params.userId.trim())) {
|
|
1746
|
+
return {
|
|
1747
|
+
error: createError("VALIDATION_ERROR", "token \u30E2\u30FC\u30C9\u3067\u306F userId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1748
|
+
};
|
|
1749
|
+
}
|
|
1663
1750
|
if (params.userId !== void 0 && !params.userId.trim()) {
|
|
1664
1751
|
return {
|
|
1665
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")
|
|
@@ -1708,6 +1795,22 @@ function createFFIDClient(config) {
|
|
|
1708
1795
|
fetchWithAuth,
|
|
1709
1796
|
errorCodes: FFID_ERROR_CODES
|
|
1710
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
|
+
});
|
|
1711
1814
|
const { sendOtp, verifyOtp } = createOtpMethods({
|
|
1712
1815
|
baseUrl,
|
|
1713
1816
|
logger,
|
|
@@ -1751,6 +1854,16 @@ function createFFIDClient(config) {
|
|
|
1751
1854
|
cancelSubscription,
|
|
1752
1855
|
previewPlanChange,
|
|
1753
1856
|
verifyAccessToken,
|
|
1857
|
+
getSubscribeUrl,
|
|
1858
|
+
redirectToSubscribe,
|
|
1859
|
+
getChangePlanUrl,
|
|
1860
|
+
redirectToChangePlan,
|
|
1861
|
+
getChangeSeatsUrl,
|
|
1862
|
+
redirectToChangeSeats,
|
|
1863
|
+
getRecoverPaymentUrl,
|
|
1864
|
+
redirectToRecoverPayment,
|
|
1865
|
+
getResubscribeUrl,
|
|
1866
|
+
redirectToResubscribe,
|
|
1754
1867
|
requestPasswordReset,
|
|
1755
1868
|
verifyPasswordResetToken,
|
|
1756
1869
|
establishResetSession,
|
|
@@ -2066,7 +2179,17 @@ function useFFID() {
|
|
|
2066
2179
|
switchOrganization: context.switchOrganization,
|
|
2067
2180
|
refresh: context.refresh,
|
|
2068
2181
|
getLoginUrl: client.getLoginUrl,
|
|
2069
|
-
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
|
|
2070
2193
|
};
|
|
2071
2194
|
}
|
|
2072
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]";
|
|
@@ -1658,6 +1740,11 @@ function createFFIDClient(config) {
|
|
|
1658
1740
|
error: createError("VALIDATION_ERROR", "organizationId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1659
1741
|
};
|
|
1660
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
|
+
}
|
|
1661
1748
|
if (params.userId !== void 0 && !params.userId.trim()) {
|
|
1662
1749
|
return {
|
|
1663
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")
|
|
@@ -1706,6 +1793,22 @@ function createFFIDClient(config) {
|
|
|
1706
1793
|
fetchWithAuth,
|
|
1707
1794
|
errorCodes: FFID_ERROR_CODES
|
|
1708
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
|
+
});
|
|
1709
1812
|
const { sendOtp, verifyOtp } = createOtpMethods({
|
|
1710
1813
|
baseUrl,
|
|
1711
1814
|
logger,
|
|
@@ -1749,6 +1852,16 @@ function createFFIDClient(config) {
|
|
|
1749
1852
|
cancelSubscription,
|
|
1750
1853
|
previewPlanChange,
|
|
1751
1854
|
verifyAccessToken,
|
|
1855
|
+
getSubscribeUrl,
|
|
1856
|
+
redirectToSubscribe,
|
|
1857
|
+
getChangePlanUrl,
|
|
1858
|
+
redirectToChangePlan,
|
|
1859
|
+
getChangeSeatsUrl,
|
|
1860
|
+
redirectToChangeSeats,
|
|
1861
|
+
getRecoverPaymentUrl,
|
|
1862
|
+
redirectToRecoverPayment,
|
|
1863
|
+
getResubscribeUrl,
|
|
1864
|
+
redirectToResubscribe,
|
|
1752
1865
|
requestPasswordReset,
|
|
1753
1866
|
verifyPasswordResetToken,
|
|
1754
1867
|
establishResetSession,
|
|
@@ -2064,7 +2177,17 @@ function useFFID() {
|
|
|
2064
2177
|
switchOrganization: context.switchOrganization,
|
|
2065
2178
|
refresh: context.refresh,
|
|
2066
2179
|
getLoginUrl: client.getLoginUrl,
|
|
2067
|
-
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
|
|
2068
2191
|
};
|
|
2069
2192
|
}
|
|
2070
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 */
|
|
@@ -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-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]";
|
|
@@ -1643,6 +1725,11 @@ function createFFIDClient(config) {
|
|
|
1643
1725
|
error: createError("VALIDATION_ERROR", "organizationId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1644
1726
|
};
|
|
1645
1727
|
}
|
|
1728
|
+
if (authMode === "token" && (params.userId === void 0 || !params.userId.trim())) {
|
|
1729
|
+
return {
|
|
1730
|
+
error: createError("VALIDATION_ERROR", "token \u30E2\u30FC\u30C9\u3067\u306F userId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1731
|
+
};
|
|
1732
|
+
}
|
|
1646
1733
|
if (params.userId !== void 0 && !params.userId.trim()) {
|
|
1647
1734
|
return {
|
|
1648
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")
|
|
@@ -1691,6 +1778,22 @@ function createFFIDClient(config) {
|
|
|
1691
1778
|
fetchWithAuth,
|
|
1692
1779
|
errorCodes: FFID_ERROR_CODES
|
|
1693
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
|
+
});
|
|
1694
1797
|
const { sendOtp, verifyOtp } = createOtpMethods({
|
|
1695
1798
|
baseUrl,
|
|
1696
1799
|
logger,
|
|
@@ -1734,6 +1837,16 @@ function createFFIDClient(config) {
|
|
|
1734
1837
|
cancelSubscription,
|
|
1735
1838
|
previewPlanChange,
|
|
1736
1839
|
verifyAccessToken,
|
|
1840
|
+
getSubscribeUrl,
|
|
1841
|
+
redirectToSubscribe,
|
|
1842
|
+
getChangePlanUrl,
|
|
1843
|
+
redirectToChangePlan,
|
|
1844
|
+
getChangeSeatsUrl,
|
|
1845
|
+
redirectToChangeSeats,
|
|
1846
|
+
getRecoverPaymentUrl,
|
|
1847
|
+
redirectToRecoverPayment,
|
|
1848
|
+
getResubscribeUrl,
|
|
1849
|
+
redirectToResubscribe,
|
|
1737
1850
|
requestPasswordReset,
|
|
1738
1851
|
verifyPasswordResetToken,
|
|
1739
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 */
|
|
@@ -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 = "
|
|
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]";
|
|
@@ -1642,6 +1724,11 @@ function createFFIDClient(config) {
|
|
|
1642
1724
|
error: createError("VALIDATION_ERROR", "organizationId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1643
1725
|
};
|
|
1644
1726
|
}
|
|
1727
|
+
if (authMode === "token" && (params.userId === void 0 || !params.userId.trim())) {
|
|
1728
|
+
return {
|
|
1729
|
+
error: createError("VALIDATION_ERROR", "token \u30E2\u30FC\u30C9\u3067\u306F userId \u306F\u5FC5\u9808\u3067\u3059")
|
|
1730
|
+
};
|
|
1731
|
+
}
|
|
1645
1732
|
if (params.userId !== void 0 && !params.userId.trim()) {
|
|
1646
1733
|
return {
|
|
1647
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")
|
|
@@ -1690,6 +1777,22 @@ function createFFIDClient(config) {
|
|
|
1690
1777
|
fetchWithAuth,
|
|
1691
1778
|
errorCodes: FFID_ERROR_CODES
|
|
1692
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
|
+
});
|
|
1693
1796
|
const { sendOtp, verifyOtp } = createOtpMethods({
|
|
1694
1797
|
baseUrl,
|
|
1695
1798
|
logger,
|
|
@@ -1733,6 +1836,16 @@ function createFFIDClient(config) {
|
|
|
1733
1836
|
cancelSubscription,
|
|
1734
1837
|
previewPlanChange,
|
|
1735
1838
|
verifyAccessToken,
|
|
1839
|
+
getSubscribeUrl,
|
|
1840
|
+
redirectToSubscribe,
|
|
1841
|
+
getChangePlanUrl,
|
|
1842
|
+
redirectToChangePlan,
|
|
1843
|
+
getChangeSeatsUrl,
|
|
1844
|
+
redirectToChangeSeats,
|
|
1845
|
+
getRecoverPaymentUrl,
|
|
1846
|
+
redirectToRecoverPayment,
|
|
1847
|
+
getResubscribeUrl,
|
|
1848
|
+
redirectToResubscribe,
|
|
1736
1849
|
requestPasswordReset,
|
|
1737
1850
|
verifyPasswordResetToken,
|
|
1738
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",
|