@djangocfg/api 2.1.476 → 2.1.478
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/auth.cjs +173 -121
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +36 -2
- package/dist/auth.d.ts +36 -2
- package/dist/auth.mjs +173 -121
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +18 -0
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +49 -0
- package/dist/clients.d.ts +49 -0
- package/dist/clients.mjs +18 -0
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +133 -1
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +61 -1
- package/dist/hooks.d.ts +61 -1
- package/dist/hooks.mjs +133 -1
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +18 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +72 -4
- package/dist/index.d.ts +72 -4
- package/dist/index.mjs +18 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/_api/generated/_cfg_accounts/hooks/index.ts +1 -0
- package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpConsentPolicyRetrieve.ts +74 -0
- package/src/_api/generated/_cfg_accounts/openapi.json +76 -0
- package/src/_api/generated/_cfg_accounts/schemas/ConsentPolicy.ts +13 -0
- package/src/_api/generated/_cfg_accounts/schemas/MarketingConsentDefaultEnum.ts +9 -0
- package/src/_api/generated/_cfg_accounts/schemas/OTPRequestRequest.ts +2 -0
- package/src/_api/generated/_cfg_accounts/schemas/index.ts +2 -0
- package/src/_api/generated/openapi.json +76 -0
- package/src/_api/generated/sdk.gen.ts +40 -21
- package/src/_api/generated/types.gen.ts +47 -0
- package/src/auth/context/AuthContext.tsx +12 -4
- package/src/auth/context/types.ts +2 -2
- package/src/auth/hooks/useAuthForm.ts +15 -3
- package/src/auth/hooks/useAuthFormState.ts +5 -0
- package/src/auth/types/form.ts +27 -0
- package/src/auth/types/index.ts +1 -0
- package/src/hooks/index.ts +6 -0
package/dist/hooks.cjs
CHANGED
|
@@ -31,7 +31,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
// src/hooks/index.ts
|
|
32
32
|
var hooks_exports = {};
|
|
33
33
|
__export(hooks_exports, {
|
|
34
|
-
useApiKey: () => useApiKey
|
|
34
|
+
useApiKey: () => useApiKey,
|
|
35
|
+
useCfgAccountsOtpConsentPolicyRetrieve: () => useCfgAccountsOtpConsentPolicyRetrieve
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(hooks_exports);
|
|
37
38
|
|
|
@@ -1585,6 +1586,72 @@ var CfgAccountsApiKey = class {
|
|
|
1585
1586
|
});
|
|
1586
1587
|
}
|
|
1587
1588
|
};
|
|
1589
|
+
var CfgAccounts = class {
|
|
1590
|
+
static {
|
|
1591
|
+
__name(this, "CfgAccounts");
|
|
1592
|
+
}
|
|
1593
|
+
/**
|
|
1594
|
+
* Marketing-consent checkbox policy for the caller's jurisdiction.
|
|
1595
|
+
*
|
|
1596
|
+
* Derived from the edge-provided CF-IPCountry — the same signal stored
|
|
1597
|
+
* as consent evidence at request time. Unknown country fails safe to
|
|
1598
|
+
* "unchecked".
|
|
1599
|
+
*/
|
|
1600
|
+
static cfgAccountsOtpConsentPolicyRetrieve(options) {
|
|
1601
|
+
return (options?.client ?? client).get({
|
|
1602
|
+
security: [
|
|
1603
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
1604
|
+
{ scheme: "bearer", type: "http" },
|
|
1605
|
+
{ name: "Authorization", type: "apiKey" }
|
|
1606
|
+
],
|
|
1607
|
+
url: "/cfg/accounts/otp/consent-policy/",
|
|
1608
|
+
...options
|
|
1609
|
+
});
|
|
1610
|
+
}
|
|
1611
|
+
/**
|
|
1612
|
+
* Request OTP code to email.
|
|
1613
|
+
*/
|
|
1614
|
+
static cfgAccountsOtpRequestCreate(options) {
|
|
1615
|
+
return (options.client ?? client).post({
|
|
1616
|
+
security: [
|
|
1617
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
1618
|
+
{ scheme: "bearer", type: "http" },
|
|
1619
|
+
{ name: "Authorization", type: "apiKey" }
|
|
1620
|
+
],
|
|
1621
|
+
url: "/cfg/accounts/otp/request/",
|
|
1622
|
+
...options,
|
|
1623
|
+
headers: {
|
|
1624
|
+
"Content-Type": "application/json",
|
|
1625
|
+
...options.headers
|
|
1626
|
+
}
|
|
1627
|
+
});
|
|
1628
|
+
}
|
|
1629
|
+
/**
|
|
1630
|
+
* Verify OTP code and return JWT tokens or 2FA session.
|
|
1631
|
+
*
|
|
1632
|
+
* If user has 2FA enabled:
|
|
1633
|
+
* - Returns requires_2fa=True with session_id
|
|
1634
|
+
* - Client must complete 2FA verification at /cfg/totp/verify/
|
|
1635
|
+
*
|
|
1636
|
+
* If user has no 2FA:
|
|
1637
|
+
* - Returns JWT tokens and user data directly
|
|
1638
|
+
*/
|
|
1639
|
+
static cfgAccountsOtpVerifyCreate(options) {
|
|
1640
|
+
return (options.client ?? client).post({
|
|
1641
|
+
security: [
|
|
1642
|
+
{ name: "X-API-Key", type: "apiKey" },
|
|
1643
|
+
{ scheme: "bearer", type: "http" },
|
|
1644
|
+
{ name: "Authorization", type: "apiKey" }
|
|
1645
|
+
],
|
|
1646
|
+
url: "/cfg/accounts/otp/verify/",
|
|
1647
|
+
...options,
|
|
1648
|
+
headers: {
|
|
1649
|
+
"Content-Type": "application/json",
|
|
1650
|
+
...options.headers
|
|
1651
|
+
}
|
|
1652
|
+
});
|
|
1653
|
+
}
|
|
1654
|
+
};
|
|
1588
1655
|
|
|
1589
1656
|
// src/_api/generated/_cfg_accounts/schemas/APIKeyRegenerate.ts
|
|
1590
1657
|
var import_zod = require("zod");
|
|
@@ -1868,4 +1935,69 @@ function useApiKey() {
|
|
|
1868
1935
|
};
|
|
1869
1936
|
}
|
|
1870
1937
|
__name(useApiKey, "useApiKey");
|
|
1938
|
+
|
|
1939
|
+
// src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpConsentPolicyRetrieve.ts
|
|
1940
|
+
var import_swr2 = __toESM(require("swr"), 1);
|
|
1941
|
+
|
|
1942
|
+
// src/_api/generated/_cfg_accounts/schemas/ConsentPolicy.ts
|
|
1943
|
+
var import_zod6 = require("zod");
|
|
1944
|
+
|
|
1945
|
+
// src/_api/generated/_cfg_accounts/schemas/MarketingConsentDefaultEnum.ts
|
|
1946
|
+
var import_zod5 = require("zod");
|
|
1947
|
+
var MarketingConsentDefaultEnumSchema = import_zod5.z.enum(["checked", "unchecked"]);
|
|
1948
|
+
|
|
1949
|
+
// src/_api/generated/_cfg_accounts/schemas/ConsentPolicy.ts
|
|
1950
|
+
var ConsentPolicySchema = import_zod6.z.object({
|
|
1951
|
+
country: import_zod6.z.string(),
|
|
1952
|
+
marketing_consent_default: MarketingConsentDefaultEnumSchema
|
|
1953
|
+
});
|
|
1954
|
+
|
|
1955
|
+
// src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpConsentPolicyRetrieve.ts
|
|
1956
|
+
function useCfgAccountsOtpConsentPolicyRetrieve(args, config) {
|
|
1957
|
+
const { enabled = true, ...swrConfig } = config ?? {};
|
|
1958
|
+
const key = enabled ? ["cfg_accounts_otp_consent_policy_retrieve", args ?? {}] : null;
|
|
1959
|
+
return (0, import_swr2.default)(
|
|
1960
|
+
key,
|
|
1961
|
+
async () => {
|
|
1962
|
+
const res = await CfgAccounts.cfgAccountsOtpConsentPolicyRetrieve({ ...args ?? {}, throwOnError: true });
|
|
1963
|
+
const data = res.data;
|
|
1964
|
+
const parsed = ConsentPolicySchema.safeParse(data);
|
|
1965
|
+
if (!parsed.success) {
|
|
1966
|
+
console.warn(
|
|
1967
|
+
"[zod] response did not match schema",
|
|
1968
|
+
{
|
|
1969
|
+
operation: "cfg_accounts_otp_consent_policy_retrieve",
|
|
1970
|
+
method: "GET",
|
|
1971
|
+
path: "/cfg/accounts/otp/consent-policy/",
|
|
1972
|
+
issues: parsed.error.issues,
|
|
1973
|
+
data
|
|
1974
|
+
}
|
|
1975
|
+
);
|
|
1976
|
+
if (typeof window !== "undefined") {
|
|
1977
|
+
try {
|
|
1978
|
+
window.dispatchEvent(
|
|
1979
|
+
new CustomEvent("zod-validation-error", {
|
|
1980
|
+
detail: {
|
|
1981
|
+
operation: "cfg_accounts_otp_consent_policy_retrieve",
|
|
1982
|
+
method: "GET",
|
|
1983
|
+
path: "/cfg/accounts/otp/consent-policy/",
|
|
1984
|
+
issues: parsed.error.issues,
|
|
1985
|
+
data,
|
|
1986
|
+
timestamp: /* @__PURE__ */ new Date()
|
|
1987
|
+
},
|
|
1988
|
+
bubbles: true,
|
|
1989
|
+
cancelable: false
|
|
1990
|
+
})
|
|
1991
|
+
);
|
|
1992
|
+
} catch {
|
|
1993
|
+
}
|
|
1994
|
+
}
|
|
1995
|
+
return data;
|
|
1996
|
+
}
|
|
1997
|
+
return parsed.data;
|
|
1998
|
+
},
|
|
1999
|
+
swrConfig
|
|
2000
|
+
);
|
|
2001
|
+
}
|
|
2002
|
+
__name(useCfgAccountsOtpConsentPolicyRetrieve, "useCfgAccountsOtpConsentPolicyRetrieve");
|
|
1871
2003
|
//# sourceMappingURL=hooks.cjs.map
|