@pubflow/react 0.4.13 → 0.4.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1655,6 +1655,11 @@ interface UseTwoFactorResult {
1655
1655
  message?: string;
1656
1656
  error?: string;
1657
1657
  }>;
1658
+ /**
1659
+ * Send a verification code to an existing active method (re-auth / sensitive action).
1660
+ * Call this BEFORE showing the code input for disable or remove flows.
1661
+ */
1662
+ sendCode: (methodId: string, method: string, action?: string) => Promise<TwoFactorStartResult>;
1658
1663
  }
1659
1664
  /**
1660
1665
  * Hook for managing 2FA settings.
package/dist/index.esm.js CHANGED
@@ -10155,6 +10155,16 @@ function useTwoFactor(instanceId) {
10155
10155
  setIsLoading(false);
10156
10156
  }
10157
10157
  }, [instance, refresh]);
10158
+ const sendCode = useCallback(async (methodId, method, action = 'sensitive_action') => {
10159
+ if (!instance)
10160
+ return { success: false, error: 'Pubflow not initialized' };
10161
+ try {
10162
+ return await instance.twoFactorService.start(methodId, method, action);
10163
+ }
10164
+ catch (e) {
10165
+ return { success: false, error: (e === null || e === void 0 ? void 0 : e.message) || 'Failed to send code' };
10166
+ }
10167
+ }, [instance]);
10158
10168
  return {
10159
10169
  systemEnabled,
10160
10170
  availableMethods,
@@ -10166,6 +10176,7 @@ function useTwoFactor(instanceId) {
10166
10176
  confirmSetup,
10167
10177
  toggle,
10168
10178
  removeMethod,
10179
+ sendCode,
10169
10180
  };
10170
10181
  }
10171
10182