@forgerock/login-widget 1.2.0-beta.3 → 1.2.0-beta.5
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/CHANGELOG.md +15 -0
- package/index.cjs +118 -46
- package/index.cjs.map +1 -1
- package/index.d.ts +77 -62
- package/index.js +118 -46
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +77 -62
- package/widget.css +18 -4
package/index.d.ts
CHANGED
|
@@ -1041,6 +1041,7 @@ declare abstract class ZodType<Output = any, Def extends ZodTypeDef = ZodTypeDef
|
|
|
1041
1041
|
_refinement(refinement: RefinementEffect<Output>["refinement"]): ZodEffects<this, Output, Input>;
|
|
1042
1042
|
superRefine<RefinedOutput extends Output>(refinement: (arg: Output, ctx: RefinementCtx) => arg is RefinedOutput): ZodEffects<this, RefinedOutput, Input>;
|
|
1043
1043
|
superRefine(refinement: (arg: Output, ctx: RefinementCtx) => void): ZodEffects<this, Output, Input>;
|
|
1044
|
+
superRefine(refinement: (arg: Output, ctx: RefinementCtx) => Promise<void>): ZodEffects<this, Output, Input>;
|
|
1044
1045
|
constructor(def: Def);
|
|
1045
1046
|
optional(): ZodOptional<this>;
|
|
1046
1047
|
nullable(): ZodNullable<this>;
|
|
@@ -1060,6 +1061,7 @@ declare abstract class ZodType<Output = any, Def extends ZodTypeDef = ZodTypeDef
|
|
|
1060
1061
|
}) => Output): ZodCatch<this>;
|
|
1061
1062
|
describe(description: string): this;
|
|
1062
1063
|
pipe<T extends ZodTypeAny>(target: T): ZodPipeline<this, T>;
|
|
1064
|
+
readonly(): ZodReadonly<this>;
|
|
1063
1065
|
isOptional(): boolean;
|
|
1064
1066
|
isNullable(): boolean;
|
|
1065
1067
|
}
|
|
@@ -1515,7 +1517,7 @@ declare type TransformEffect<T> = {
|
|
|
1515
1517
|
};
|
|
1516
1518
|
declare type PreprocessEffect<T> = {
|
|
1517
1519
|
type: "preprocess";
|
|
1518
|
-
transform: (arg: T) => any;
|
|
1520
|
+
transform: (arg: T, ctx: RefinementCtx) => any;
|
|
1519
1521
|
};
|
|
1520
1522
|
declare type Effect<T> = RefinementEffect<T> | TransformEffect<T> | PreprocessEffect<T>;
|
|
1521
1523
|
interface ZodEffectsDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
@@ -1528,7 +1530,7 @@ declare class ZodEffects<T extends ZodTypeAny, Output = output<T>, Input = input
|
|
|
1528
1530
|
sourceType(): T;
|
|
1529
1531
|
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1530
1532
|
static create: <I extends ZodTypeAny>(schema: I, effect: Effect<I["_output"]>, params?: RawCreateParams) => ZodEffects<I, I["_output"], input<I>>;
|
|
1531
|
-
static createWithPreprocess: <I extends ZodTypeAny>(preprocess: (arg: unknown) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
|
|
1533
|
+
static createWithPreprocess: <I extends ZodTypeAny>(preprocess: (arg: unknown, ctx: RefinementCtx) => unknown, schema: I, params?: RawCreateParams) => ZodEffects<I, I["_output"], unknown>;
|
|
1532
1534
|
}
|
|
1533
1535
|
|
|
1534
1536
|
interface ZodOptionalDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
@@ -1609,6 +1611,18 @@ declare class ZodPipeline<A extends ZodTypeAny, B extends ZodTypeAny> extends Zo
|
|
|
1609
1611
|
_parse(input: ParseInput): ParseReturnType<any>;
|
|
1610
1612
|
static create<A extends ZodTypeAny, B extends ZodTypeAny>(a: A, b: B): ZodPipeline<A, B>;
|
|
1611
1613
|
}
|
|
1614
|
+
declare type BuiltIn = (((...args: any[]) => any) | (new (...args: any[]) => any)) | {
|
|
1615
|
+
readonly [Symbol.toStringTag]: string;
|
|
1616
|
+
} | Date | Error | Generator | Promise<unknown> | RegExp;
|
|
1617
|
+
declare type MakeReadonly<T> = T extends Map<infer K, infer V> ? ReadonlyMap<K, V> : T extends Set<infer V> ? ReadonlySet<V> : T extends [infer Head, ...infer Tail] ? readonly [Head, ...Tail] : T extends Array<infer V> ? ReadonlyArray<V> : T extends BuiltIn ? T : Readonly<T>;
|
|
1618
|
+
interface ZodReadonlyDef<T extends ZodTypeAny = ZodTypeAny> extends ZodTypeDef {
|
|
1619
|
+
innerType: T;
|
|
1620
|
+
typeName: ZodFirstPartyTypeKind.ZodReadonly;
|
|
1621
|
+
}
|
|
1622
|
+
declare class ZodReadonly<T extends ZodTypeAny> extends ZodType<MakeReadonly<T["_output"]>, ZodReadonlyDef<T>, T["_input"]> {
|
|
1623
|
+
_parse(input: ParseInput): ParseReturnType<this["_output"]>;
|
|
1624
|
+
static create: <T_1 extends ZodTypeAny>(type: T_1, params?: RawCreateParams) => ZodReadonly<T_1>;
|
|
1625
|
+
}
|
|
1612
1626
|
declare enum ZodFirstPartyTypeKind {
|
|
1613
1627
|
ZodString = "ZodString",
|
|
1614
1628
|
ZodNumber = "ZodNumber",
|
|
@@ -1644,7 +1658,8 @@ declare enum ZodFirstPartyTypeKind {
|
|
|
1644
1658
|
ZodCatch = "ZodCatch",
|
|
1645
1659
|
ZodPromise = "ZodPromise",
|
|
1646
1660
|
ZodBranded = "ZodBranded",
|
|
1647
|
-
ZodPipeline = "ZodPipeline"
|
|
1661
|
+
ZodPipeline = "ZodPipeline",
|
|
1662
|
+
ZodReadonly = "ZodReadonly"
|
|
1648
1663
|
}
|
|
1649
1664
|
|
|
1650
1665
|
declare const partialConfigSchema: ZodObject<{
|
|
@@ -1702,55 +1717,55 @@ declare const partialConfigSchema: ZodObject<{
|
|
|
1702
1717
|
serverConfig: ZodOptional<ZodObject<{
|
|
1703
1718
|
baseUrl: ZodString;
|
|
1704
1719
|
paths: ZodOptional<ZodObject<{
|
|
1705
|
-
authenticate: ZodString
|
|
1706
|
-
authorize: ZodString
|
|
1707
|
-
accessToken: ZodString
|
|
1708
|
-
endSession: ZodString
|
|
1709
|
-
userInfo: ZodString
|
|
1710
|
-
revoke: ZodString
|
|
1711
|
-
sessions: ZodString
|
|
1712
|
-
}, "
|
|
1713
|
-
authenticate
|
|
1714
|
-
authorize
|
|
1715
|
-
accessToken
|
|
1716
|
-
endSession
|
|
1717
|
-
userInfo
|
|
1718
|
-
revoke
|
|
1719
|
-
sessions
|
|
1720
|
+
authenticate: ZodOptional<ZodString>;
|
|
1721
|
+
authorize: ZodOptional<ZodString>;
|
|
1722
|
+
accessToken: ZodOptional<ZodString>;
|
|
1723
|
+
endSession: ZodOptional<ZodString>;
|
|
1724
|
+
userInfo: ZodOptional<ZodString>;
|
|
1725
|
+
revoke: ZodOptional<ZodString>;
|
|
1726
|
+
sessions: ZodOptional<ZodString>;
|
|
1727
|
+
}, "strict", ZodTypeAny, {
|
|
1728
|
+
authenticate?: string | undefined;
|
|
1729
|
+
authorize?: string | undefined;
|
|
1730
|
+
accessToken?: string | undefined;
|
|
1731
|
+
endSession?: string | undefined;
|
|
1732
|
+
userInfo?: string | undefined;
|
|
1733
|
+
revoke?: string | undefined;
|
|
1734
|
+
sessions?: string | undefined;
|
|
1720
1735
|
}, {
|
|
1721
|
-
authenticate
|
|
1722
|
-
authorize
|
|
1723
|
-
accessToken
|
|
1724
|
-
endSession
|
|
1725
|
-
userInfo
|
|
1726
|
-
revoke
|
|
1727
|
-
sessions
|
|
1736
|
+
authenticate?: string | undefined;
|
|
1737
|
+
authorize?: string | undefined;
|
|
1738
|
+
accessToken?: string | undefined;
|
|
1739
|
+
endSession?: string | undefined;
|
|
1740
|
+
userInfo?: string | undefined;
|
|
1741
|
+
revoke?: string | undefined;
|
|
1742
|
+
sessions?: string | undefined;
|
|
1728
1743
|
}>>;
|
|
1729
|
-
timeout: ZodNumber
|
|
1730
|
-
}, "
|
|
1731
|
-
timeout: number;
|
|
1744
|
+
timeout: ZodOptional<ZodNumber>;
|
|
1745
|
+
}, "strict", ZodTypeAny, {
|
|
1732
1746
|
baseUrl: string;
|
|
1733
1747
|
paths?: {
|
|
1734
|
-
authenticate
|
|
1735
|
-
authorize
|
|
1736
|
-
accessToken
|
|
1737
|
-
endSession
|
|
1738
|
-
userInfo
|
|
1739
|
-
revoke
|
|
1740
|
-
sessions
|
|
1748
|
+
authenticate?: string | undefined;
|
|
1749
|
+
authorize?: string | undefined;
|
|
1750
|
+
accessToken?: string | undefined;
|
|
1751
|
+
endSession?: string | undefined;
|
|
1752
|
+
userInfo?: string | undefined;
|
|
1753
|
+
revoke?: string | undefined;
|
|
1754
|
+
sessions?: string | undefined;
|
|
1741
1755
|
} | undefined;
|
|
1756
|
+
timeout?: number | undefined;
|
|
1742
1757
|
}, {
|
|
1743
|
-
timeout: number;
|
|
1744
1758
|
baseUrl: string;
|
|
1745
1759
|
paths?: {
|
|
1746
|
-
authenticate
|
|
1747
|
-
authorize
|
|
1748
|
-
accessToken
|
|
1749
|
-
endSession
|
|
1750
|
-
userInfo
|
|
1751
|
-
revoke
|
|
1752
|
-
sessions
|
|
1760
|
+
authenticate?: string | undefined;
|
|
1761
|
+
authorize?: string | undefined;
|
|
1762
|
+
accessToken?: string | undefined;
|
|
1763
|
+
endSession?: string | undefined;
|
|
1764
|
+
userInfo?: string | undefined;
|
|
1765
|
+
revoke?: string | undefined;
|
|
1766
|
+
sessions?: string | undefined;
|
|
1753
1767
|
} | undefined;
|
|
1768
|
+
timeout?: number | undefined;
|
|
1754
1769
|
}>>;
|
|
1755
1770
|
support: ZodOptional<ZodOptional<ZodUnion<[ZodLiteral<"legacy">, ZodLiteral<"modern">]>>>;
|
|
1756
1771
|
tokenStore: ZodOptional<ZodOptional<ZodUnion<[ZodObject<{
|
|
@@ -1772,7 +1787,7 @@ declare const partialConfigSchema: ZodObject<{
|
|
|
1772
1787
|
}>>>;
|
|
1773
1788
|
set: ZodFunction<ZodTuple<[ZodString], ZodUnknown>, ZodPromise<ZodVoid>>;
|
|
1774
1789
|
remove: ZodFunction<ZodTuple<[ZodString], ZodUnknown>, ZodPromise<ZodVoid>>;
|
|
1775
|
-
}, "
|
|
1790
|
+
}, "strict", ZodTypeAny, {
|
|
1776
1791
|
set: (args_0: string, ...args_1: unknown[]) => Promise<void>;
|
|
1777
1792
|
remove: (args_0: string, ...args_1: unknown[]) => Promise<void>;
|
|
1778
1793
|
get: (args_0: string, ...args_1: unknown[]) => Promise<{
|
|
@@ -1813,17 +1828,17 @@ declare const partialConfigSchema: ZodObject<{
|
|
|
1813
1828
|
redirectUri?: string | undefined;
|
|
1814
1829
|
scope?: string | undefined;
|
|
1815
1830
|
serverConfig?: {
|
|
1816
|
-
timeout: number;
|
|
1817
1831
|
baseUrl: string;
|
|
1818
1832
|
paths?: {
|
|
1819
|
-
authenticate
|
|
1820
|
-
authorize
|
|
1821
|
-
accessToken
|
|
1822
|
-
endSession
|
|
1823
|
-
userInfo
|
|
1824
|
-
revoke
|
|
1825
|
-
sessions
|
|
1833
|
+
authenticate?: string | undefined;
|
|
1834
|
+
authorize?: string | undefined;
|
|
1835
|
+
accessToken?: string | undefined;
|
|
1836
|
+
endSession?: string | undefined;
|
|
1837
|
+
userInfo?: string | undefined;
|
|
1838
|
+
revoke?: string | undefined;
|
|
1839
|
+
sessions?: string | undefined;
|
|
1826
1840
|
} | undefined;
|
|
1841
|
+
timeout?: number | undefined;
|
|
1827
1842
|
} | undefined;
|
|
1828
1843
|
support?: "legacy" | "modern" | undefined;
|
|
1829
1844
|
tokenStore?: "localStorage" | "sessionStorage" | {
|
|
@@ -1858,17 +1873,17 @@ declare const partialConfigSchema: ZodObject<{
|
|
|
1858
1873
|
redirectUri?: string | undefined;
|
|
1859
1874
|
scope?: string | undefined;
|
|
1860
1875
|
serverConfig?: {
|
|
1861
|
-
timeout: number;
|
|
1862
1876
|
baseUrl: string;
|
|
1863
1877
|
paths?: {
|
|
1864
|
-
authenticate
|
|
1865
|
-
authorize
|
|
1866
|
-
accessToken
|
|
1867
|
-
endSession
|
|
1868
|
-
userInfo
|
|
1869
|
-
revoke
|
|
1870
|
-
sessions
|
|
1878
|
+
authenticate?: string | undefined;
|
|
1879
|
+
authorize?: string | undefined;
|
|
1880
|
+
accessToken?: string | undefined;
|
|
1881
|
+
endSession?: string | undefined;
|
|
1882
|
+
userInfo?: string | undefined;
|
|
1883
|
+
revoke?: string | undefined;
|
|
1884
|
+
sessions?: string | undefined;
|
|
1871
1885
|
} | undefined;
|
|
1886
|
+
timeout?: number | undefined;
|
|
1872
1887
|
} | undefined;
|
|
1873
1888
|
support?: "legacy" | "modern" | undefined;
|
|
1874
1889
|
tokenStore?: "localStorage" | "sessionStorage" | {
|
|
@@ -2255,14 +2270,14 @@ declare const partialStyleSchema: ZodObject<{
|
|
|
2255
2270
|
}>>>;
|
|
2256
2271
|
sections: ZodOptional<ZodOptional<ZodObject<{
|
|
2257
2272
|
header: ZodOptional<ZodBoolean>;
|
|
2258
|
-
}, "
|
|
2273
|
+
}, "strict", ZodTypeAny, {
|
|
2259
2274
|
header?: boolean | undefined;
|
|
2260
2275
|
}, {
|
|
2261
2276
|
header?: boolean | undefined;
|
|
2262
2277
|
}>>>;
|
|
2263
2278
|
stage: ZodOptional<ZodOptional<ZodObject<{
|
|
2264
2279
|
icon: ZodOptional<ZodBoolean>;
|
|
2265
|
-
}, "
|
|
2280
|
+
}, "strict", ZodTypeAny, {
|
|
2266
2281
|
icon?: boolean | undefined;
|
|
2267
2282
|
}, {
|
|
2268
2283
|
icon?: boolean | undefined;
|
package/index.js
CHANGED
|
@@ -5532,7 +5532,8 @@ class ParseStatus {
|
|
|
5532
5532
|
status.dirty();
|
|
5533
5533
|
if (value.status === "dirty")
|
|
5534
5534
|
status.dirty();
|
|
5535
|
-
if (
|
|
5535
|
+
if (key.value !== "__proto__" &&
|
|
5536
|
+
(typeof value.value !== "undefined" || pair.alwaysSet)) {
|
|
5536
5537
|
finalObject[key.value] = value.value;
|
|
5537
5538
|
}
|
|
5538
5539
|
}
|
|
@@ -5640,6 +5641,7 @@ class ZodType {
|
|
|
5640
5641
|
this.catch = this.catch.bind(this);
|
|
5641
5642
|
this.describe = this.describe.bind(this);
|
|
5642
5643
|
this.pipe = this.pipe.bind(this);
|
|
5644
|
+
this.readonly = this.readonly.bind(this);
|
|
5643
5645
|
this.isNullable = this.isNullable.bind(this);
|
|
5644
5646
|
this.isOptional = this.isOptional.bind(this);
|
|
5645
5647
|
}
|
|
@@ -5856,6 +5858,9 @@ class ZodType {
|
|
|
5856
5858
|
pipe(target) {
|
|
5857
5859
|
return ZodPipeline.create(this, target);
|
|
5858
5860
|
}
|
|
5861
|
+
readonly() {
|
|
5862
|
+
return ZodReadonly.create(this);
|
|
5863
|
+
}
|
|
5859
5864
|
isOptional() {
|
|
5860
5865
|
return this.safeParse(undefined).success;
|
|
5861
5866
|
}
|
|
@@ -5866,14 +5871,24 @@ class ZodType {
|
|
|
5866
5871
|
const cuidRegex = /^c[^\s-]{8,}$/i;
|
|
5867
5872
|
const cuid2Regex = /^[a-z][a-z0-9]*$/;
|
|
5868
5873
|
const ulidRegex = /[0-9A-HJKMNP-TV-Z]{26}/;
|
|
5869
|
-
const uuidRegex =
|
|
5874
|
+
// const uuidRegex =
|
|
5875
|
+
// /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
5876
|
+
const uuidRegex = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
|
|
5870
5877
|
// from https://stackoverflow.com/a/46181/1550155
|
|
5871
5878
|
// old version: too slow, didn't support unicode
|
|
5872
5879
|
// const emailRegex = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;
|
|
5873
5880
|
//old email regex
|
|
5874
5881
|
// const emailRegex = /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@((?!-)([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{1,})[^-<>()[\].,;:\s@"]$/i;
|
|
5875
5882
|
// eslint-disable-next-line
|
|
5876
|
-
const emailRegex =
|
|
5883
|
+
// const emailRegex =
|
|
5884
|
+
// /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\])|(\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\.[A-Za-z]{2,})+))$/;
|
|
5885
|
+
// const emailRegex =
|
|
5886
|
+
// /^[a-zA-Z0-9\.\!\#\$\%\&\'\*\+\/\=\?\^\_\`\{\|\}\~\-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
|
5887
|
+
// const emailRegex =
|
|
5888
|
+
// /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i;
|
|
5889
|
+
const emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
5890
|
+
// const emailRegex =
|
|
5891
|
+
// /^[a-z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\.[a-z0-9\-]+)*$/i;
|
|
5877
5892
|
// from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
|
|
5878
5893
|
const emojiRegex = /^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u;
|
|
5879
5894
|
const ipv4Regex = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;
|
|
@@ -7984,6 +7999,12 @@ class ZodRecord extends ZodType {
|
|
|
7984
7999
|
}
|
|
7985
8000
|
}
|
|
7986
8001
|
class ZodMap extends ZodType {
|
|
8002
|
+
get keySchema() {
|
|
8003
|
+
return this._def.keyType;
|
|
8004
|
+
}
|
|
8005
|
+
get valueSchema() {
|
|
8006
|
+
return this._def.valueType;
|
|
8007
|
+
}
|
|
7987
8008
|
_parse(input) {
|
|
7988
8009
|
const { status, ctx } = this._processInputParams(input);
|
|
7989
8010
|
if (ctx.parsedType !== ZodParsedType.map) {
|
|
@@ -8180,16 +8201,20 @@ class ZodFunction extends ZodType {
|
|
|
8180
8201
|
const params = { errorMap: ctx.common.contextualErrorMap };
|
|
8181
8202
|
const fn = ctx.data;
|
|
8182
8203
|
if (this._def.returns instanceof ZodPromise) {
|
|
8183
|
-
|
|
8204
|
+
// Would love a way to avoid disabling this rule, but we need
|
|
8205
|
+
// an alias (using an arrow function was what caused 2651).
|
|
8206
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
8207
|
+
const me = this;
|
|
8208
|
+
return OK(async function (...args) {
|
|
8184
8209
|
const error = new ZodError([]);
|
|
8185
|
-
const parsedArgs = await
|
|
8210
|
+
const parsedArgs = await me._def.args
|
|
8186
8211
|
.parseAsync(args, params)
|
|
8187
8212
|
.catch((e) => {
|
|
8188
8213
|
error.addIssue(makeArgsIssue(args, e));
|
|
8189
8214
|
throw error;
|
|
8190
8215
|
});
|
|
8191
|
-
const result = await fn
|
|
8192
|
-
const parsedReturns = await
|
|
8216
|
+
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
8217
|
+
const parsedReturns = await me._def.returns._def.type
|
|
8193
8218
|
.parseAsync(result, params)
|
|
8194
8219
|
.catch((e) => {
|
|
8195
8220
|
error.addIssue(makeReturnsIssue(result, e));
|
|
@@ -8199,13 +8224,17 @@ class ZodFunction extends ZodType {
|
|
|
8199
8224
|
});
|
|
8200
8225
|
}
|
|
8201
8226
|
else {
|
|
8202
|
-
|
|
8203
|
-
|
|
8227
|
+
// Would love a way to avoid disabling this rule, but we need
|
|
8228
|
+
// an alias (using an arrow function was what caused 2651).
|
|
8229
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
8230
|
+
const me = this;
|
|
8231
|
+
return OK(function (...args) {
|
|
8232
|
+
const parsedArgs = me._def.args.safeParse(args, params);
|
|
8204
8233
|
if (!parsedArgs.success) {
|
|
8205
8234
|
throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
|
|
8206
8235
|
}
|
|
8207
|
-
const result = fn
|
|
8208
|
-
const parsedReturns =
|
|
8236
|
+
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
8237
|
+
const parsedReturns = me._def.returns.safeParse(result, params);
|
|
8209
8238
|
if (!parsedReturns.success) {
|
|
8210
8239
|
throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
|
|
8211
8240
|
}
|
|
@@ -8293,7 +8322,7 @@ ZodLiteral.create = (value, params) => {
|
|
|
8293
8322
|
};
|
|
8294
8323
|
function createZodEnum(values, params) {
|
|
8295
8324
|
return new ZodEnum({
|
|
8296
|
-
values
|
|
8325
|
+
values,
|
|
8297
8326
|
typeName: ZodFirstPartyTypeKind.ZodEnum,
|
|
8298
8327
|
...processCreateParams(params),
|
|
8299
8328
|
});
|
|
@@ -8435,8 +8464,29 @@ class ZodEffects extends ZodType {
|
|
|
8435
8464
|
_parse(input) {
|
|
8436
8465
|
const { status, ctx } = this._processInputParams(input);
|
|
8437
8466
|
const effect = this._def.effect || null;
|
|
8467
|
+
const checkCtx = {
|
|
8468
|
+
addIssue: (arg) => {
|
|
8469
|
+
addIssueToContext(ctx, arg);
|
|
8470
|
+
if (arg.fatal) {
|
|
8471
|
+
status.abort();
|
|
8472
|
+
}
|
|
8473
|
+
else {
|
|
8474
|
+
status.dirty();
|
|
8475
|
+
}
|
|
8476
|
+
},
|
|
8477
|
+
get path() {
|
|
8478
|
+
return ctx.path;
|
|
8479
|
+
},
|
|
8480
|
+
};
|
|
8481
|
+
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
8438
8482
|
if (effect.type === "preprocess") {
|
|
8439
|
-
const processed = effect.transform(ctx.data);
|
|
8483
|
+
const processed = effect.transform(ctx.data, checkCtx);
|
|
8484
|
+
if (ctx.common.issues.length) {
|
|
8485
|
+
return {
|
|
8486
|
+
status: "dirty",
|
|
8487
|
+
value: ctx.data,
|
|
8488
|
+
};
|
|
8489
|
+
}
|
|
8440
8490
|
if (ctx.common.async) {
|
|
8441
8491
|
return Promise.resolve(processed).then((processed) => {
|
|
8442
8492
|
return this._def.schema._parseAsync({
|
|
@@ -8454,21 +8504,6 @@ class ZodEffects extends ZodType {
|
|
|
8454
8504
|
});
|
|
8455
8505
|
}
|
|
8456
8506
|
}
|
|
8457
|
-
const checkCtx = {
|
|
8458
|
-
addIssue: (arg) => {
|
|
8459
|
-
addIssueToContext(ctx, arg);
|
|
8460
|
-
if (arg.fatal) {
|
|
8461
|
-
status.abort();
|
|
8462
|
-
}
|
|
8463
|
-
else {
|
|
8464
|
-
status.dirty();
|
|
8465
|
-
}
|
|
8466
|
-
},
|
|
8467
|
-
get path() {
|
|
8468
|
-
return ctx.path;
|
|
8469
|
-
},
|
|
8470
|
-
};
|
|
8471
|
-
checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
|
|
8472
8507
|
if (effect.type === "refinement") {
|
|
8473
8508
|
const executeRefinement = (acc
|
|
8474
8509
|
// effect: RefinementEffect<any>
|
|
@@ -8772,6 +8807,22 @@ class ZodPipeline extends ZodType {
|
|
|
8772
8807
|
});
|
|
8773
8808
|
}
|
|
8774
8809
|
}
|
|
8810
|
+
class ZodReadonly extends ZodType {
|
|
8811
|
+
_parse(input) {
|
|
8812
|
+
const result = this._def.innerType._parse(input);
|
|
8813
|
+
if (isValid(result)) {
|
|
8814
|
+
result.value = Object.freeze(result.value);
|
|
8815
|
+
}
|
|
8816
|
+
return result;
|
|
8817
|
+
}
|
|
8818
|
+
}
|
|
8819
|
+
ZodReadonly.create = (type, params) => {
|
|
8820
|
+
return new ZodReadonly({
|
|
8821
|
+
innerType: type,
|
|
8822
|
+
typeName: ZodFirstPartyTypeKind.ZodReadonly,
|
|
8823
|
+
...processCreateParams(params),
|
|
8824
|
+
});
|
|
8825
|
+
};
|
|
8775
8826
|
const custom = (check, params = {},
|
|
8776
8827
|
/*
|
|
8777
8828
|
* @deprecated
|
|
@@ -8840,6 +8891,7 @@ var ZodFirstPartyTypeKind;
|
|
|
8840
8891
|
ZodFirstPartyTypeKind["ZodPromise"] = "ZodPromise";
|
|
8841
8892
|
ZodFirstPartyTypeKind["ZodBranded"] = "ZodBranded";
|
|
8842
8893
|
ZodFirstPartyTypeKind["ZodPipeline"] = "ZodPipeline";
|
|
8894
|
+
ZodFirstPartyTypeKind["ZodReadonly"] = "ZodReadonly";
|
|
8843
8895
|
})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
|
|
8844
8896
|
const instanceOfType = (
|
|
8845
8897
|
// const instanceOfType = <T extends new (...args: any[]) => any>(
|
|
@@ -8953,6 +9005,7 @@ var z = /*#__PURE__*/Object.freeze({
|
|
|
8953
9005
|
BRAND: BRAND,
|
|
8954
9006
|
ZodBranded: ZodBranded,
|
|
8955
9007
|
ZodPipeline: ZodPipeline,
|
|
9008
|
+
ZodReadonly: ZodReadonly,
|
|
8956
9009
|
custom: custom,
|
|
8957
9010
|
Schema: ZodType,
|
|
8958
9011
|
ZodSchema: ZodType,
|
|
@@ -9032,7 +9085,8 @@ const configSchema = z
|
|
|
9032
9085
|
realmPath: z.string(),
|
|
9033
9086
|
redirectUri: z.string().optional(),
|
|
9034
9087
|
scope: z.string().optional(),
|
|
9035
|
-
serverConfig: z
|
|
9088
|
+
serverConfig: z
|
|
9089
|
+
.object({
|
|
9036
9090
|
baseUrl: z
|
|
9037
9091
|
.string({
|
|
9038
9092
|
invalid_type_error: '`serverConfig.baseUrl` is a required URL string (this is generated by the Zod library).',
|
|
@@ -9043,25 +9097,28 @@ const configSchema = z
|
|
|
9043
9097
|
}),
|
|
9044
9098
|
paths: z
|
|
9045
9099
|
.object({
|
|
9046
|
-
authenticate: z.string(),
|
|
9047
|
-
authorize: z.string(),
|
|
9048
|
-
accessToken: z.string(),
|
|
9049
|
-
endSession: z.string(),
|
|
9050
|
-
userInfo: z.string(),
|
|
9051
|
-
revoke: z.string(),
|
|
9052
|
-
sessions: z.string(),
|
|
9100
|
+
authenticate: z.string().optional(),
|
|
9101
|
+
authorize: z.string().optional(),
|
|
9102
|
+
accessToken: z.string().optional(),
|
|
9103
|
+
endSession: z.string().optional(),
|
|
9104
|
+
userInfo: z.string().optional(),
|
|
9105
|
+
revoke: z.string().optional(),
|
|
9106
|
+
sessions: z.string().optional(),
|
|
9053
9107
|
})
|
|
9108
|
+
.strict()
|
|
9054
9109
|
.optional(),
|
|
9055
|
-
|
|
9056
|
-
|
|
9110
|
+
timeout: z
|
|
9111
|
+
.number({
|
|
9057
9112
|
invalid_type_error: '`serverConfig.timeout` is a required number and in milliseconds (this is generated by the Zod library).',
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
})
|
|
9113
|
+
})
|
|
9114
|
+
.optional(),
|
|
9115
|
+
})
|
|
9116
|
+
.strict(),
|
|
9061
9117
|
support: z.union([z.literal('legacy'), z.literal('modern')]).optional(),
|
|
9062
9118
|
tokenStore: z
|
|
9063
9119
|
.union([
|
|
9064
|
-
z
|
|
9120
|
+
z
|
|
9121
|
+
.object({
|
|
9065
9122
|
get: z
|
|
9066
9123
|
.function()
|
|
9067
9124
|
.args(z.string())
|
|
@@ -9073,7 +9130,8 @@ const configSchema = z
|
|
|
9073
9130
|
}))),
|
|
9074
9131
|
set: z.function().args(z.string()).returns(z.promise(z.void())),
|
|
9075
9132
|
remove: z.function().args(z.string()).returns(z.promise(z.void())),
|
|
9076
|
-
})
|
|
9133
|
+
})
|
|
9134
|
+
.strict(),
|
|
9077
9135
|
z.literal('sessionStorage'),
|
|
9078
9136
|
z.literal('localStorage'),
|
|
9079
9137
|
])
|
|
@@ -12015,7 +12073,9 @@ function initialize$3(customLinks) {
|
|
|
12015
12073
|
return linksStore;
|
|
12016
12074
|
}
|
|
12017
12075
|
|
|
12076
|
+
const authorizationTimedOut = 'Authorization timed out';
|
|
12018
12077
|
const interactionNeeded = 'The request requires some interaction that is not allowed.';
|
|
12078
|
+
const timeoutErrorMessage = 'Timeouts are likely an issue with OAuth client misconfiguration. If you are getting a 4xx error in the network tab, copy the full `/authorize` URL and paste it directly into your browsers URL field to directly visit the page. The error should be displayed on the page.';
|
|
12019
12079
|
const sessionCookieConsentMessage = `The user either doesn't have a valid session, the cookie is not being sent due to third-party cookies being disabled, or the user is needing to provide consent as the OAuth client setting does not have "implied consent" enabled.`;
|
|
12020
12080
|
const oauthStore = writable({
|
|
12021
12081
|
completed: false,
|
|
@@ -12024,6 +12084,16 @@ const oauthStore = writable({
|
|
|
12024
12084
|
successful: false,
|
|
12025
12085
|
response: null,
|
|
12026
12086
|
});
|
|
12087
|
+
function getTroubleshootingMessage(message) {
|
|
12088
|
+
switch (message) {
|
|
12089
|
+
case interactionNeeded:
|
|
12090
|
+
return sessionCookieConsentMessage;
|
|
12091
|
+
case authorizationTimedOut:
|
|
12092
|
+
return timeoutErrorMessage;
|
|
12093
|
+
default:
|
|
12094
|
+
return '';
|
|
12095
|
+
}
|
|
12096
|
+
}
|
|
12027
12097
|
/**
|
|
12028
12098
|
* @function initialize - Initializes the OAuth store with a get function and a reset function
|
|
12029
12099
|
* @param {object} initOptions - The options to pass to the TokenManager.getTokens function
|
|
@@ -12064,7 +12134,7 @@ function initialize$2(initOptions) {
|
|
|
12064
12134
|
completed: true,
|
|
12065
12135
|
error: {
|
|
12066
12136
|
message: err.message,
|
|
12067
|
-
troubleshoot: err.message
|
|
12137
|
+
troubleshoot: getTroubleshootingMessage(err.message),
|
|
12068
12138
|
},
|
|
12069
12139
|
loading: false,
|
|
12070
12140
|
successful: false,
|
|
@@ -12190,11 +12260,13 @@ const styleSchema = z
|
|
|
12190
12260
|
.object({
|
|
12191
12261
|
header: z.boolean().optional(),
|
|
12192
12262
|
})
|
|
12263
|
+
.strict()
|
|
12193
12264
|
.optional(),
|
|
12194
12265
|
stage: z
|
|
12195
12266
|
.object({
|
|
12196
12267
|
icon: z.boolean().optional(),
|
|
12197
12268
|
})
|
|
12269
|
+
.strict()
|
|
12198
12270
|
.optional(),
|
|
12199
12271
|
})
|
|
12200
12272
|
.strict();
|
|
@@ -12327,8 +12399,8 @@ function widgetApiFactory(componentApi) {
|
|
|
12327
12399
|
if (!journeyStore || !oauthStore || !userStore) {
|
|
12328
12400
|
logErrorAndThrow('missingStores');
|
|
12329
12401
|
}
|
|
12330
|
-
const requestsOauth = options?.oauth
|
|
12331
|
-
const requestsUser = options?.user
|
|
12402
|
+
const requestsOauth = options?.oauth ?? true;
|
|
12403
|
+
const requestsUser = options?.user ?? true;
|
|
12332
12404
|
const { subscribe, } = derived([journeyStore, oauthStore, userStore], ([$journeyStore, $oauthStore, $userStore], set) => {
|
|
12333
12405
|
set({
|
|
12334
12406
|
journey: $journeyStore,
|