@forgerock/login-widget 1.2.0-beta.3 → 1.2.0-beta.4

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 CHANGED
@@ -1,3 +1,11 @@
1
+ # [1.2.0-beta.4](https://github.com/forgerock/forgerock-web-login-framework/compare/v1.2.0-beta.3...v1.2.0-beta.4) (2023-10-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **css:** fix base css with link specificity issue ([e7d69bf](https://github.com/forgerock/forgerock-web-login-framework/commit/e7d69bf3675d175628afe284bc3d94c07ff370ab))
7
+ * **widget-api:** fix oauth and user disablement in journey config ([c527d38](https://github.com/forgerock/forgerock-web-login-framework/commit/c527d3806258a18e9b4a6b387e74b6e4951948d9))
8
+
1
9
  # [1.2.0-beta.3](https://github.com/forgerock/forgerock-web-login-framework/compare/v1.2.0-beta.2...v1.2.0-beta.3) (2023-10-05)
2
10
 
3
11
 
package/index.cjs CHANGED
@@ -5536,7 +5536,8 @@ class ParseStatus {
5536
5536
  status.dirty();
5537
5537
  if (value.status === "dirty")
5538
5538
  status.dirty();
5539
- if (typeof value.value !== "undefined" || pair.alwaysSet) {
5539
+ if (key.value !== "__proto__" &&
5540
+ (typeof value.value !== "undefined" || pair.alwaysSet)) {
5540
5541
  finalObject[key.value] = value.value;
5541
5542
  }
5542
5543
  }
@@ -5644,6 +5645,7 @@ class ZodType {
5644
5645
  this.catch = this.catch.bind(this);
5645
5646
  this.describe = this.describe.bind(this);
5646
5647
  this.pipe = this.pipe.bind(this);
5648
+ this.readonly = this.readonly.bind(this);
5647
5649
  this.isNullable = this.isNullable.bind(this);
5648
5650
  this.isOptional = this.isOptional.bind(this);
5649
5651
  }
@@ -5860,6 +5862,9 @@ class ZodType {
5860
5862
  pipe(target) {
5861
5863
  return ZodPipeline.create(this, target);
5862
5864
  }
5865
+ readonly() {
5866
+ return ZodReadonly.create(this);
5867
+ }
5863
5868
  isOptional() {
5864
5869
  return this.safeParse(undefined).success;
5865
5870
  }
@@ -5870,14 +5875,24 @@ class ZodType {
5870
5875
  const cuidRegex = /^c[^\s-]{8,}$/i;
5871
5876
  const cuid2Regex = /^[a-z][a-z0-9]*$/;
5872
5877
  const ulidRegex = /[0-9A-HJKMNP-TV-Z]{26}/;
5873
- const uuidRegex = /^([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;
5878
+ // const uuidRegex =
5879
+ // /^([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;
5880
+ 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;
5874
5881
  // from https://stackoverflow.com/a/46181/1550155
5875
5882
  // old version: too slow, didn't support unicode
5876
5883
  // 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;
5877
5884
  //old email regex
5878
5885
  // const emailRegex = /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@((?!-)([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{1,})[^-<>()[\].,;:\s@"]$/i;
5879
5886
  // eslint-disable-next-line
5880
- const emailRegex = /^(([^<>()[\]\\.,;:\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,})+))$/;
5887
+ // const emailRegex =
5888
+ // /^(([^<>()[\]\\.,;:\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,})+))$/;
5889
+ // const emailRegex =
5890
+ // /^[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])?)*$/;
5891
+ // const emailRegex =
5892
+ // /^(?:[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;
5893
+ const emailRegex = /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
5894
+ // const emailRegex =
5895
+ // /^[a-z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-z0-9-]+(?:\.[a-z0-9\-]+)*$/i;
5881
5896
  // from https://thekevinscott.com/emojis-in-javascript/#writing-a-regular-expression
5882
5897
  const emojiRegex = /^(\p{Extended_Pictographic}|\p{Emoji_Component})+$/u;
5883
5898
  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}))$/;
@@ -7988,6 +8003,12 @@ class ZodRecord extends ZodType {
7988
8003
  }
7989
8004
  }
7990
8005
  class ZodMap extends ZodType {
8006
+ get keySchema() {
8007
+ return this._def.keyType;
8008
+ }
8009
+ get valueSchema() {
8010
+ return this._def.valueType;
8011
+ }
7991
8012
  _parse(input) {
7992
8013
  const { status, ctx } = this._processInputParams(input);
7993
8014
  if (ctx.parsedType !== ZodParsedType.map) {
@@ -8184,16 +8205,20 @@ class ZodFunction extends ZodType {
8184
8205
  const params = { errorMap: ctx.common.contextualErrorMap };
8185
8206
  const fn = ctx.data;
8186
8207
  if (this._def.returns instanceof ZodPromise) {
8187
- return OK(async (...args) => {
8208
+ // Would love a way to avoid disabling this rule, but we need
8209
+ // an alias (using an arrow function was what caused 2651).
8210
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
8211
+ const me = this;
8212
+ return OK(async function (...args) {
8188
8213
  const error = new ZodError([]);
8189
- const parsedArgs = await this._def.args
8214
+ const parsedArgs = await me._def.args
8190
8215
  .parseAsync(args, params)
8191
8216
  .catch((e) => {
8192
8217
  error.addIssue(makeArgsIssue(args, e));
8193
8218
  throw error;
8194
8219
  });
8195
- const result = await fn(...parsedArgs);
8196
- const parsedReturns = await this._def.returns._def.type
8220
+ const result = await Reflect.apply(fn, this, parsedArgs);
8221
+ const parsedReturns = await me._def.returns._def.type
8197
8222
  .parseAsync(result, params)
8198
8223
  .catch((e) => {
8199
8224
  error.addIssue(makeReturnsIssue(result, e));
@@ -8203,13 +8228,17 @@ class ZodFunction extends ZodType {
8203
8228
  });
8204
8229
  }
8205
8230
  else {
8206
- return OK((...args) => {
8207
- const parsedArgs = this._def.args.safeParse(args, params);
8231
+ // Would love a way to avoid disabling this rule, but we need
8232
+ // an alias (using an arrow function was what caused 2651).
8233
+ // eslint-disable-next-line @typescript-eslint/no-this-alias
8234
+ const me = this;
8235
+ return OK(function (...args) {
8236
+ const parsedArgs = me._def.args.safeParse(args, params);
8208
8237
  if (!parsedArgs.success) {
8209
8238
  throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
8210
8239
  }
8211
- const result = fn(...parsedArgs.data);
8212
- const parsedReturns = this._def.returns.safeParse(result, params);
8240
+ const result = Reflect.apply(fn, this, parsedArgs.data);
8241
+ const parsedReturns = me._def.returns.safeParse(result, params);
8213
8242
  if (!parsedReturns.success) {
8214
8243
  throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
8215
8244
  }
@@ -8297,7 +8326,7 @@ ZodLiteral.create = (value, params) => {
8297
8326
  };
8298
8327
  function createZodEnum(values, params) {
8299
8328
  return new ZodEnum({
8300
- values: values,
8329
+ values,
8301
8330
  typeName: ZodFirstPartyTypeKind.ZodEnum,
8302
8331
  ...processCreateParams(params),
8303
8332
  });
@@ -8439,8 +8468,29 @@ class ZodEffects extends ZodType {
8439
8468
  _parse(input) {
8440
8469
  const { status, ctx } = this._processInputParams(input);
8441
8470
  const effect = this._def.effect || null;
8471
+ const checkCtx = {
8472
+ addIssue: (arg) => {
8473
+ addIssueToContext(ctx, arg);
8474
+ if (arg.fatal) {
8475
+ status.abort();
8476
+ }
8477
+ else {
8478
+ status.dirty();
8479
+ }
8480
+ },
8481
+ get path() {
8482
+ return ctx.path;
8483
+ },
8484
+ };
8485
+ checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
8442
8486
  if (effect.type === "preprocess") {
8443
- const processed = effect.transform(ctx.data);
8487
+ const processed = effect.transform(ctx.data, checkCtx);
8488
+ if (ctx.common.issues.length) {
8489
+ return {
8490
+ status: "dirty",
8491
+ value: ctx.data,
8492
+ };
8493
+ }
8444
8494
  if (ctx.common.async) {
8445
8495
  return Promise.resolve(processed).then((processed) => {
8446
8496
  return this._def.schema._parseAsync({
@@ -8458,21 +8508,6 @@ class ZodEffects extends ZodType {
8458
8508
  });
8459
8509
  }
8460
8510
  }
8461
- const checkCtx = {
8462
- addIssue: (arg) => {
8463
- addIssueToContext(ctx, arg);
8464
- if (arg.fatal) {
8465
- status.abort();
8466
- }
8467
- else {
8468
- status.dirty();
8469
- }
8470
- },
8471
- get path() {
8472
- return ctx.path;
8473
- },
8474
- };
8475
- checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
8476
8511
  if (effect.type === "refinement") {
8477
8512
  const executeRefinement = (acc
8478
8513
  // effect: RefinementEffect<any>
@@ -8776,6 +8811,22 @@ class ZodPipeline extends ZodType {
8776
8811
  });
8777
8812
  }
8778
8813
  }
8814
+ class ZodReadonly extends ZodType {
8815
+ _parse(input) {
8816
+ const result = this._def.innerType._parse(input);
8817
+ if (isValid(result)) {
8818
+ result.value = Object.freeze(result.value);
8819
+ }
8820
+ return result;
8821
+ }
8822
+ }
8823
+ ZodReadonly.create = (type, params) => {
8824
+ return new ZodReadonly({
8825
+ innerType: type,
8826
+ typeName: ZodFirstPartyTypeKind.ZodReadonly,
8827
+ ...processCreateParams(params),
8828
+ });
8829
+ };
8779
8830
  const custom = (check, params = {},
8780
8831
  /*
8781
8832
  * @deprecated
@@ -8844,6 +8895,7 @@ var ZodFirstPartyTypeKind;
8844
8895
  ZodFirstPartyTypeKind["ZodPromise"] = "ZodPromise";
8845
8896
  ZodFirstPartyTypeKind["ZodBranded"] = "ZodBranded";
8846
8897
  ZodFirstPartyTypeKind["ZodPipeline"] = "ZodPipeline";
8898
+ ZodFirstPartyTypeKind["ZodReadonly"] = "ZodReadonly";
8847
8899
  })(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
8848
8900
  const instanceOfType = (
8849
8901
  // const instanceOfType = <T extends new (...args: any[]) => any>(
@@ -8957,6 +9009,7 @@ var z = /*#__PURE__*/Object.freeze({
8957
9009
  BRAND: BRAND,
8958
9010
  ZodBranded: ZodBranded,
8959
9011
  ZodPipeline: ZodPipeline,
9012
+ ZodReadonly: ZodReadonly,
8960
9013
  custom: custom,
8961
9014
  Schema: ZodType,
8962
9015
  ZodSchema: ZodType,
@@ -12331,8 +12384,8 @@ function widgetApiFactory(componentApi) {
12331
12384
  if (!journeyStore || !oauthStore || !userStore) {
12332
12385
  logErrorAndThrow('missingStores');
12333
12386
  }
12334
- const requestsOauth = options?.oauth || true;
12335
- const requestsUser = options?.user || true;
12387
+ const requestsOauth = options?.oauth ?? true;
12388
+ const requestsUser = options?.user ?? true;
12336
12389
  const { subscribe, } = derived([journeyStore, oauthStore, userStore], ([$journeyStore, $oauthStore, $userStore], set) => {
12337
12390
  set({
12338
12391
  journey: $journeyStore,