@data-c/ui 0.2.92 → 0.2.94

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.js CHANGED
@@ -2872,10 +2872,10 @@ var Condition = class {
2872
2872
  otherwise
2873
2873
  } = config;
2874
2874
  let check = typeof is === "function" ? is : (...values) => values.every((value) => value === is);
2875
- return new Condition(refs, (values, schema6) => {
2875
+ return new Condition(refs, (values, schema9) => {
2876
2876
  var _branch;
2877
2877
  let branch = check(...values) ? then : otherwise;
2878
- return (_branch = branch == null ? void 0 : branch(schema6)) != null ? _branch : schema6;
2878
+ return (_branch = branch == null ? void 0 : branch(schema9)) != null ? _branch : schema9;
2879
2879
  });
2880
2880
  }
2881
2881
  constructor(refs, builder) {
@@ -2889,14 +2889,14 @@ var Condition = class {
2889
2889
  // TODO: ? operator here?
2890
2890
  ref.getValue(options == null ? void 0 : options.value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context)
2891
2891
  ));
2892
- let schema6 = this.fn(values, base, options);
2893
- if (schema6 === void 0 || // @ts-ignore this can be base
2894
- schema6 === base) {
2892
+ let schema9 = this.fn(values, base, options);
2893
+ if (schema9 === void 0 || // @ts-ignore this can be base
2894
+ schema9 === base) {
2895
2895
  return base;
2896
2896
  }
2897
- if (!isSchema(schema6))
2897
+ if (!isSchema(schema9))
2898
2898
  throw new TypeError("conditions must return a schema object");
2899
- return schema6.resolve(options);
2899
+ return schema9.resolve(options);
2900
2900
  }
2901
2901
  };
2902
2902
  var prefixes = {
@@ -2970,7 +2970,7 @@ function createValidation(config) {
2970
2970
  path = "",
2971
2971
  options,
2972
2972
  originalValue,
2973
- schema: schema6
2973
+ schema: schema9
2974
2974
  }, panic, next) {
2975
2975
  const {
2976
2976
  name,
@@ -2982,8 +2982,8 @@ function createValidation(config) {
2982
2982
  let {
2983
2983
  parent,
2984
2984
  context,
2985
- abortEarly = schema6.spec.abortEarly,
2986
- disableStackTrace = schema6.spec.disableStackTrace
2985
+ abortEarly = schema9.spec.abortEarly,
2986
+ disableStackTrace = schema9.spec.disableStackTrace
2987
2987
  } = options;
2988
2988
  const resolveOptions = {
2989
2989
  value,
@@ -2994,9 +2994,9 @@ function createValidation(config) {
2994
2994
  const nextParams = resolveParams(Object.assign({
2995
2995
  value,
2996
2996
  originalValue,
2997
- label: schema6.spec.label,
2997
+ label: schema9.spec.label,
2998
2998
  path: overrides.path || path,
2999
- spec: schema6.spec,
2999
+ spec: schema9.spec,
3000
3000
  disableStackTrace: overrides.disableStackTrace || disableStackTrace
3001
3001
  }, params, overrides.params), resolveOptions);
3002
3002
  const error = new ValidationError(ValidationError.formatError(overrides.message || message, nextParams), value, nextParams.path, overrides.type || name, nextParams.disableStackTrace);
@@ -3015,7 +3015,7 @@ function createValidation(config) {
3015
3015
  },
3016
3016
  options,
3017
3017
  originalValue,
3018
- schema: schema6
3018
+ schema: schema9
3019
3019
  };
3020
3020
  const handleResult = (validOrError) => {
3021
3021
  if (ValidationError.isError(validOrError))
@@ -3065,24 +3065,24 @@ function resolveParams(params, options) {
3065
3065
  function resolveMaybeRef(item, options) {
3066
3066
  return Reference.isRef(item) ? item.getValue(options.value, options.parent, options.context) : item;
3067
3067
  }
3068
- function getIn(schema6, path, value, context = value) {
3068
+ function getIn(schema9, path, value, context = value) {
3069
3069
  let parent, lastPart, lastPartDebug;
3070
3070
  if (!path)
3071
3071
  return {
3072
3072
  parent,
3073
3073
  parentPath: path,
3074
- schema: schema6
3074
+ schema: schema9
3075
3075
  };
3076
3076
  (0, import_property_expr.forEach)(path, (_part, isBracket, isArray) => {
3077
3077
  let part = isBracket ? _part.slice(1, _part.length - 1) : _part;
3078
- schema6 = schema6.resolve({
3078
+ schema9 = schema9.resolve({
3079
3079
  context,
3080
3080
  parent,
3081
3081
  value
3082
3082
  });
3083
- let isTuple = schema6.type === "tuple";
3083
+ let isTuple = schema9.type === "tuple";
3084
3084
  let idx = isArray ? parseInt(part, 10) : 0;
3085
- if (schema6.innerType || isTuple) {
3085
+ if (schema9.innerType || isTuple) {
3086
3086
  if (isTuple && !isArray)
3087
3087
  throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${lastPartDebug}" must contain an index to the tuple element, e.g. "${lastPartDebug}[0]"`);
3088
3088
  if (value && idx >= value.length) {
@@ -3090,20 +3090,20 @@ function getIn(schema6, path, value, context = value) {
3090
3090
  }
3091
3091
  parent = value;
3092
3092
  value = value && value[idx];
3093
- schema6 = isTuple ? schema6.spec.types[idx] : schema6.innerType;
3093
+ schema9 = isTuple ? schema9.spec.types[idx] : schema9.innerType;
3094
3094
  }
3095
3095
  if (!isArray) {
3096
- if (!schema6.fields || !schema6.fields[part])
3097
- throw new Error(`The schema does not contain the path: ${path}. (failed at: ${lastPartDebug} which is a type: "${schema6.type}")`);
3096
+ if (!schema9.fields || !schema9.fields[part])
3097
+ throw new Error(`The schema does not contain the path: ${path}. (failed at: ${lastPartDebug} which is a type: "${schema9.type}")`);
3098
3098
  parent = value;
3099
3099
  value = value && value[part];
3100
- schema6 = schema6.fields[part];
3100
+ schema9 = schema9.fields[part];
3101
3101
  }
3102
3102
  lastPart = part;
3103
3103
  lastPartDebug = isBracket ? "[" + _part + "]" : "." + _part;
3104
3104
  });
3105
3105
  return {
3106
- schema: schema6,
3106
+ schema: schema9,
3107
3107
  parent,
3108
3108
  parentPath: lastPart
3109
3109
  };
@@ -3311,22 +3311,22 @@ var Schema = class {
3311
3311
  this._mutate = before;
3312
3312
  return result;
3313
3313
  }
3314
- concat(schema6) {
3315
- if (!schema6 || schema6 === this)
3314
+ concat(schema9) {
3315
+ if (!schema9 || schema9 === this)
3316
3316
  return this;
3317
- if (schema6.type !== this.type && this.type !== "mixed")
3318
- throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${schema6.type}`);
3317
+ if (schema9.type !== this.type && this.type !== "mixed")
3318
+ throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${schema9.type}`);
3319
3319
  let base = this;
3320
- let combined = schema6.clone();
3320
+ let combined = schema9.clone();
3321
3321
  const mergedSpec = Object.assign({}, base.spec, combined.spec);
3322
3322
  combined.spec = mergedSpec;
3323
3323
  combined.internalTests = Object.assign({}, base.internalTests, combined.internalTests);
3324
- combined._whitelist = base._whitelist.merge(schema6._whitelist, schema6._blacklist);
3325
- combined._blacklist = base._blacklist.merge(schema6._blacklist, schema6._whitelist);
3324
+ combined._whitelist = base._whitelist.merge(schema9._whitelist, schema9._blacklist);
3325
+ combined._blacklist = base._blacklist.merge(schema9._blacklist, schema9._whitelist);
3326
3326
  combined.tests = base.tests;
3327
3327
  combined.exclusiveTests = base.exclusiveTests;
3328
3328
  combined.withMutation((next) => {
3329
- schema6.tests.forEach((fn) => {
3329
+ schema9.tests.forEach((fn) => {
3330
3330
  next.test(fn.OPTIONS);
3331
3331
  });
3332
3332
  });
@@ -3344,15 +3344,15 @@ var Schema = class {
3344
3344
  return this._typeCheck(v);
3345
3345
  }
3346
3346
  resolve(options) {
3347
- let schema6 = this;
3348
- if (schema6.conditions.length) {
3349
- let conditions = schema6.conditions;
3350
- schema6 = schema6.clone();
3351
- schema6.conditions = [];
3352
- schema6 = conditions.reduce((prevSchema, condition) => condition.resolve(prevSchema, options), schema6);
3353
- schema6 = schema6.resolve(options);
3347
+ let schema9 = this;
3348
+ if (schema9.conditions.length) {
3349
+ let conditions = schema9.conditions;
3350
+ schema9 = schema9.clone();
3351
+ schema9.conditions = [];
3352
+ schema9 = conditions.reduce((prevSchema, condition) => condition.resolve(prevSchema, options), schema9);
3353
+ schema9 = schema9.resolve(options);
3354
3354
  }
3355
- return schema6;
3355
+ return schema9;
3356
3356
  }
3357
3357
  resolveOptions(options) {
3358
3358
  var _options$strict, _options$abortEarly, _options$recursive, _options$disableStack;
@@ -3512,11 +3512,11 @@ attempted value: ${formattedValue}
3512
3512
  }
3513
3513
  validate(value, options) {
3514
3514
  var _options$disableStack2;
3515
- let schema6 = this.resolve(Object.assign({}, options, {
3515
+ let schema9 = this.resolve(Object.assign({}, options, {
3516
3516
  value
3517
3517
  }));
3518
- let disableStackTrace = (_options$disableStack2 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack2 : schema6.spec.disableStackTrace;
3519
- return new Promise((resolve, reject) => schema6._validate(value, options, (error, parsed) => {
3518
+ let disableStackTrace = (_options$disableStack2 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack2 : schema9.spec.disableStackTrace;
3519
+ return new Promise((resolve, reject) => schema9._validate(value, options, (error, parsed) => {
3520
3520
  if (ValidationError.isError(error))
3521
3521
  error.value = parsed;
3522
3522
  reject(error);
@@ -3529,12 +3529,12 @@ attempted value: ${formattedValue}
3529
3529
  }
3530
3530
  validateSync(value, options) {
3531
3531
  var _options$disableStack3;
3532
- let schema6 = this.resolve(Object.assign({}, options, {
3532
+ let schema9 = this.resolve(Object.assign({}, options, {
3533
3533
  value
3534
3534
  }));
3535
3535
  let result;
3536
- let disableStackTrace = (_options$disableStack3 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack3 : schema6.spec.disableStackTrace;
3537
- schema6._validate(value, Object.assign({}, options, {
3536
+ let disableStackTrace = (_options$disableStack3 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack3 : schema9.spec.disableStackTrace;
3537
+ schema9._validate(value, Object.assign({}, options, {
3538
3538
  sync: true
3539
3539
  }), (error, parsed) => {
3540
3540
  if (ValidationError.isError(error))
@@ -3572,8 +3572,8 @@ attempted value: ${formattedValue}
3572
3572
  return typeof defaultValue === "function" ? defaultValue.call(this, options) : clone(defaultValue);
3573
3573
  }
3574
3574
  getDefault(options) {
3575
- let schema6 = this.resolve(options || {});
3576
- return schema6._getDefault(options);
3575
+ let schema9 = this.resolve(options || {});
3576
+ return schema9._getDefault(options);
3577
3577
  }
3578
3578
  default(def) {
3579
3579
  if (arguments.length === 0) {
@@ -3815,13 +3815,13 @@ attempted value: ${formattedValue}
3815
3815
  return description;
3816
3816
  }
3817
3817
  get ["~standard"]() {
3818
- const schema6 = this;
3818
+ const schema9 = this;
3819
3819
  const standard = {
3820
3820
  version: 1,
3821
3821
  vendor: "yup",
3822
3822
  async validate(value) {
3823
3823
  try {
3824
- const result = await schema6.validate(value, {
3824
+ const result = await schema9.validate(value, {
3825
3825
  abortEarly: false
3826
3826
  });
3827
3827
  return {
@@ -3846,9 +3846,9 @@ for (const method of ["validate", "validateSync"])
3846
3846
  const {
3847
3847
  parent,
3848
3848
  parentPath,
3849
- schema: schema6
3849
+ schema: schema9
3850
3850
  } = getIn(this, path, value, options.context);
3851
- return schema6[method](parent && parent[parentPath], Object.assign({}, options, {
3851
+ return schema9[method](parent && parent[parentPath], Object.assign({}, options, {
3852
3852
  parent,
3853
3853
  path
3854
3854
  }));
@@ -4034,7 +4034,7 @@ var StringSchema = class extends Schema {
4034
4034
  });
4035
4035
  }
4036
4036
  required(message) {
4037
- return super.required(message).withMutation((schema6) => schema6.test({
4037
+ return super.required(message).withMutation((schema9) => schema9.test({
4038
4038
  message: message || mixed.required,
4039
4039
  name: "required",
4040
4040
  skipAbsent: true,
@@ -4042,9 +4042,9 @@ var StringSchema = class extends Schema {
4042
4042
  }));
4043
4043
  }
4044
4044
  notRequired() {
4045
- return super.notRequired().withMutation((schema6) => {
4046
- schema6.tests = schema6.tests.filter((t) => t.OPTIONS.name !== "required");
4047
- return schema6;
4045
+ return super.notRequired().withMutation((schema9) => {
4046
+ schema9.tests = schema9.tests.filter((t) => t.OPTIONS.name !== "required");
4047
+ return schema9;
4048
4048
  });
4049
4049
  }
4050
4050
  length(length, message = string.length) {
@@ -4437,7 +4437,7 @@ function sortByKeyOrder(keys) {
4437
4437
  return findIndex(keys, a) - findIndex(keys, b);
4438
4438
  };
4439
4439
  }
4440
- var parseJson = (value, _, schema6) => {
4440
+ var parseJson = (value, _, schema9) => {
4441
4441
  if (typeof value !== "string") {
4442
4442
  return value;
4443
4443
  }
@@ -4446,31 +4446,31 @@ var parseJson = (value, _, schema6) => {
4446
4446
  parsed = JSON.parse(value);
4447
4447
  } catch (err) {
4448
4448
  }
4449
- return schema6.isType(parsed) ? parsed : value;
4449
+ return schema9.isType(parsed) ? parsed : value;
4450
4450
  };
4451
- function deepPartial(schema6) {
4452
- if ("fields" in schema6) {
4451
+ function deepPartial(schema9) {
4452
+ if ("fields" in schema9) {
4453
4453
  const partial = {};
4454
- for (const [key2, fieldSchema] of Object.entries(schema6.fields)) {
4454
+ for (const [key2, fieldSchema] of Object.entries(schema9.fields)) {
4455
4455
  partial[key2] = deepPartial(fieldSchema);
4456
4456
  }
4457
- return schema6.setFields(partial);
4457
+ return schema9.setFields(partial);
4458
4458
  }
4459
- if (schema6.type === "array") {
4460
- const nextArray = schema6.optional();
4459
+ if (schema9.type === "array") {
4460
+ const nextArray = schema9.optional();
4461
4461
  if (nextArray.innerType)
4462
4462
  nextArray.innerType = deepPartial(nextArray.innerType);
4463
4463
  return nextArray;
4464
4464
  }
4465
- if (schema6.type === "tuple") {
4466
- return schema6.optional().clone({
4467
- types: schema6.spec.types.map(deepPartial)
4465
+ if (schema9.type === "tuple") {
4466
+ return schema9.optional().clone({
4467
+ types: schema9.spec.types.map(deepPartial)
4468
4468
  });
4469
4469
  }
4470
- if ("optional" in schema6) {
4471
- return schema6.optional();
4470
+ if ("optional" in schema9) {
4471
+ return schema9.optional();
4472
4472
  }
4473
- return schema6;
4473
+ return schema9;
4474
4474
  }
4475
4475
  var deepHas = (obj, p) => {
4476
4476
  const path = [...(0, import_property_expr.normalizePath)(p)];
@@ -4604,8 +4604,8 @@ var ObjectSchema = class extends Schema {
4604
4604
  next._sortErrors = this._sortErrors;
4605
4605
  return next;
4606
4606
  }
4607
- concat(schema6) {
4608
- let next = super.concat(schema6);
4607
+ concat(schema9) {
4608
+ let next = super.concat(schema9);
4609
4609
  let nextFields = next.fields;
4610
4610
  for (let [field, schemaOrRef] of Object.entries(this.fields)) {
4611
4611
  const target = nextFields[field];
@@ -4613,7 +4613,7 @@ var ObjectSchema = class extends Schema {
4613
4613
  }
4614
4614
  return next.withMutation((s) => (
4615
4615
  // XXX: excludes here is wrong
4616
- s.setFields(nextFields, [...this._excludedEdges, ...schema6._excludedEdges])
4616
+ s.setFields(nextFields, [...this._excludedEdges, ...schema9._excludedEdges])
4617
4617
  ));
4618
4618
  }
4619
4619
  _getDefault(options) {
@@ -4660,8 +4660,8 @@ var ObjectSchema = class extends Schema {
4660
4660
  }
4661
4661
  partial() {
4662
4662
  const partial = {};
4663
- for (const [key2, schema6] of Object.entries(this.fields)) {
4664
- partial[key2] = "optional" in schema6 && schema6.optional instanceof Function ? schema6.optional() : schema6;
4663
+ for (const [key2, schema9] of Object.entries(this.fields)) {
4664
+ partial[key2] = "optional" in schema9 && schema9.optional instanceof Function ? schema9.optional() : schema9;
4665
4665
  }
4666
4666
  return this.setFields(partial);
4667
4667
  }
@@ -4871,23 +4871,23 @@ var ArraySchema = class extends Schema {
4871
4871
  json() {
4872
4872
  return this.transform(parseJson);
4873
4873
  }
4874
- concat(schema6) {
4875
- let next = super.concat(schema6);
4874
+ concat(schema9) {
4875
+ let next = super.concat(schema9);
4876
4876
  next.innerType = this.innerType;
4877
- if (schema6.innerType)
4877
+ if (schema9.innerType)
4878
4878
  next.innerType = next.innerType ? (
4879
4879
  // @ts-expect-error Lazy doesn't have concat and will break
4880
- next.innerType.concat(schema6.innerType)
4881
- ) : schema6.innerType;
4880
+ next.innerType.concat(schema9.innerType)
4881
+ ) : schema9.innerType;
4882
4882
  return next;
4883
4883
  }
4884
- of(schema6) {
4884
+ of(schema9) {
4885
4885
  let next = this.clone();
4886
- if (!isSchema(schema6))
4887
- throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: " + printValue(schema6));
4888
- next.innerType = schema6;
4886
+ if (!isSchema(schema9))
4887
+ throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: " + printValue(schema9));
4888
+ next.innerType = schema9;
4889
4889
  next.spec = Object.assign({}, next.spec, {
4890
- types: schema6
4890
+ types: schema9
4891
4891
  });
4892
4892
  return next;
4893
4893
  }
@@ -5037,7 +5037,7 @@ var TupleSchema = class extends Schema {
5037
5037
  describe(options) {
5038
5038
  const next = (options ? this.resolve(options) : this).clone();
5039
5039
  const base = super.describe(options);
5040
- base.innerType = next.spec.types.map((schema6, index) => {
5040
+ base.innerType = next.spec.types.map((schema9, index) => {
5041
5041
  var _innerOptions;
5042
5042
  let innerOptions = options;
5043
5043
  if ((_innerOptions = innerOptions) != null && _innerOptions.value) {
@@ -5046,7 +5046,7 @@ var TupleSchema = class extends Schema {
5046
5046
  value: innerOptions.value[index]
5047
5047
  });
5048
5048
  }
5049
- return schema6.describe(innerOptions);
5049
+ return schema9.describe(innerOptions);
5050
5050
  });
5051
5051
  return base;
5052
5052
  }
@@ -10281,6 +10281,1659 @@ var CurrencyTextField = _react.forwardRef.call(void 0,
10281
10281
  );
10282
10282
  var CurrencyTextField_default = CurrencyTextField;
10283
10283
 
10284
+ // src/v2/Auth/index.tsx
10285
+
10286
+
10287
+ // src/v2/Auth/components/BannerSection/index.tsx
10288
+
10289
+
10290
+ function BannerSection2(props) {
10291
+ const { children } = props;
10292
+ const theme2 = _material.useTheme.call(void 0, );
10293
+ const fullScreen = _material.useMediaQuery.call(void 0, theme2.breakpoints.up("md"));
10294
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10295
+ _material.Stack,
10296
+ {
10297
+ component: "section",
10298
+ display: fullScreen ? "flex" : "none",
10299
+ width: "100%",
10300
+ direction: "row",
10301
+ justifyContent: "center",
10302
+ alignItems: "center",
10303
+ sx: {
10304
+ // backgroundImage: `url(${backgroundLoginImage})`,
10305
+ // backgroundSize: 'cover',
10306
+ // backgroundPosition: 'right',
10307
+ // backgroundRepeat: 'no-repeat',
10308
+ },
10309
+ children
10310
+ }
10311
+ );
10312
+ }
10313
+
10314
+ // src/v2/Auth/components/DefaultBanner/index.tsx
10315
+ var _ArrowRight = require('@mui/icons-material/ArrowRight'); var _ArrowRight2 = _interopRequireDefault(_ArrowRight);
10316
+
10317
+
10318
+ function DefaultBanner() {
10319
+ const theme2 = _material.useTheme.call(void 0, );
10320
+ const fullScreen = _material.useMediaQuery.call(void 0, theme2.breakpoints.up("md"));
10321
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10322
+ _material.Stack,
10323
+ {
10324
+ component: "section",
10325
+ display: fullScreen ? "flex" : "none",
10326
+ width: "100%",
10327
+ direction: "row",
10328
+ justifyContent: "center",
10329
+ alignItems: "center",
10330
+ sx: {
10331
+ backgroundImage: `url(https://datac-site-assets.s3.sa-east-1.amazonaws.com/background_login.png)`,
10332
+ backgroundSize: "cover",
10333
+ backgroundPosition: "right",
10334
+ backgroundRepeat: "no-repeat"
10335
+ },
10336
+ children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { padding: "2rem", children: [
10337
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10338
+ _material.Typography,
10339
+ {
10340
+ component: "h1",
10341
+ fontSize: "3.5rem",
10342
+ lineHeight: "4rem",
10343
+ fontWeight: "bold",
10344
+ color: "white",
10345
+ fontFamily: "Montserrat",
10346
+ letterSpacing: 0,
10347
+ children: "Inova\xE7\xE3o e tecnologia"
10348
+ }
10349
+ ),
10350
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10351
+ _material.Typography,
10352
+ {
10353
+ component: "h2",
10354
+ color: "white",
10355
+ fontSize: "2.5rem",
10356
+ lineHeight: "3rem",
10357
+ letterSpacing: 0,
10358
+ fontWeight: "bold",
10359
+ fontFamily: "Montserrat",
10360
+ children: "para empresas de resultado"
10361
+ }
10362
+ ),
10363
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10364
+ _material.Typography,
10365
+ {
10366
+ component: "span",
10367
+ fontSize: "1.25rem",
10368
+ lineHeight: "1.25rem",
10369
+ fontWeight: "300",
10370
+ letterSpacing: 0,
10371
+ marginTop: "1.5rem",
10372
+ marginBottom: "3rem",
10373
+ fontFamily: "Montserrat",
10374
+ sx: { color: "rgb(68, 167, 255)" },
10375
+ children: "Mais de 30 anos de exist\xEAncia e muitas hist\xF3rias de sucesso."
10376
+ }
10377
+ ),
10378
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Link, { href: "https://site.datac.com.br/services/", target: "_blank", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
10379
+ Button_default,
10380
+ {
10381
+ component: "a",
10382
+ variant: "text",
10383
+ sx: {
10384
+ width: "fit-content",
10385
+ color: "rgb(255, 255, 255)",
10386
+ fontWeight: "400",
10387
+ fontSize: "0.875rem",
10388
+ lineHeight: "1.125rem",
10389
+ fontFamily: "Montserrat",
10390
+ backgroundColor: "rgb(22, 23, 101)",
10391
+ borderRadius: "30px",
10392
+ padding: "17px 48px",
10393
+ ":hover": {
10394
+ backgroundColor: "rgb(255, 255, 255)",
10395
+ color: "rgb(22, 23, 101)"
10396
+ },
10397
+ alignItems: "center"
10398
+ },
10399
+ children: [
10400
+ "Conhe\xE7a nossos produtos",
10401
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10402
+ _ArrowRight2.default,
10403
+ {
10404
+ fontSize: "medium",
10405
+ sx: { color: (theme3) => theme3.palette.success.light }
10406
+ }
10407
+ )
10408
+ ]
10409
+ }
10410
+ ) })
10411
+ ] })
10412
+ }
10413
+ );
10414
+ }
10415
+
10416
+ // src/v2/Auth/components/LoginSection/index.tsx
10417
+
10418
+
10419
+ // src/v2/Auth/components/EsqueciSenhaForm/index.tsx
10420
+
10421
+
10422
+
10423
+
10424
+ // ../../node_modules/jwt-decode/build/esm/index.js
10425
+ var InvalidTokenError = class extends Error {
10426
+ };
10427
+ InvalidTokenError.prototype.name = "InvalidTokenError";
10428
+ function b64DecodeUnicode(str) {
10429
+ return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
10430
+ let code = p.charCodeAt(0).toString(16).toUpperCase();
10431
+ if (code.length < 2) {
10432
+ code = "0" + code;
10433
+ }
10434
+ return "%" + code;
10435
+ }));
10436
+ }
10437
+ function base64UrlDecode(str) {
10438
+ let output = str.replace(/-/g, "+").replace(/_/g, "/");
10439
+ switch (output.length % 4) {
10440
+ case 0:
10441
+ break;
10442
+ case 2:
10443
+ output += "==";
10444
+ break;
10445
+ case 3:
10446
+ output += "=";
10447
+ break;
10448
+ default:
10449
+ throw new Error("base64 string is not of the correct length");
10450
+ }
10451
+ try {
10452
+ return b64DecodeUnicode(output);
10453
+ } catch (err) {
10454
+ return atob(output);
10455
+ }
10456
+ }
10457
+ function jwtDecode(token, options) {
10458
+ if (typeof token !== "string") {
10459
+ throw new InvalidTokenError("Invalid token specified: must be a string");
10460
+ }
10461
+ options || (options = {});
10462
+ const pos = options.header === true ? 0 : 1;
10463
+ const part = token.split(".")[pos];
10464
+ if (typeof part !== "string") {
10465
+ throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);
10466
+ }
10467
+ let decoded;
10468
+ try {
10469
+ decoded = base64UrlDecode(part);
10470
+ } catch (e) {
10471
+ throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);
10472
+ }
10473
+ try {
10474
+ return JSON.parse(decoded);
10475
+ } catch (e) {
10476
+ throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);
10477
+ }
10478
+ }
10479
+
10480
+ // src/v2/Auth/context/CredentialsContext.tsx
10481
+
10482
+
10483
+
10484
+
10485
+
10486
+
10487
+
10488
+ var CredentialsContext = _react.createContext.call(void 0,
10489
+ void 0
10490
+ );
10491
+ function CredentialsProvider({
10492
+ children,
10493
+ credentialsConfig
10494
+ }) {
10495
+ const TOKEN_KEY = credentialsConfig.tokenKey;
10496
+ const REFRESH_TOKEN_KEY = credentialsConfig.refreshTokenKey;
10497
+ const axios2 = credentialsConfig.axios;
10498
+ const [isSubmitting, setSubmitting] = _react.useState.call(void 0, false);
10499
+ const [token, setTokenState] = _react.useState.call(void 0,
10500
+ () => localStorage.getItem(TOKEN_KEY)
10501
+ );
10502
+ const [refreshToken, setRefreshTokenState] = _react.useState.call(void 0,
10503
+ () => localStorage.getItem(REFRESH_TOKEN_KEY)
10504
+ );
10505
+ const [userLogged, setUserLogged] = _react.useState.call(void 0,
10506
+ () => {
10507
+ const currentToken = localStorage.getItem(TOKEN_KEY);
10508
+ if (!currentToken)
10509
+ return null;
10510
+ try {
10511
+ const { data } = jwtDecode(
10512
+ currentToken
10513
+ );
10514
+ return data;
10515
+ } catch (e4) {
10516
+ return null;
10517
+ }
10518
+ }
10519
+ );
10520
+ const [isAuthenticated, setIsAuthenticated] = _react.useState.call(void 0, () => {
10521
+ const currentToken = localStorage.getItem(TOKEN_KEY);
10522
+ if (!currentToken)
10523
+ return false;
10524
+ try {
10525
+ const { exp } = jwtDecode(currentToken);
10526
+ const expDate = new Date(exp * 1e3).getTime();
10527
+ const nowDate = (/* @__PURE__ */ new Date()).getTime();
10528
+ return nowDate < expDate;
10529
+ } catch (e5) {
10530
+ return false;
10531
+ }
10532
+ });
10533
+ function decodeTokenFromValue(tokenValue) {
10534
+ if (!tokenValue)
10535
+ return null;
10536
+ try {
10537
+ const { data } = jwtDecode(tokenValue);
10538
+ return data;
10539
+ } catch (e6) {
10540
+ return null;
10541
+ }
10542
+ }
10543
+ function isTokenValid(tokenValue) {
10544
+ if (!tokenValue)
10545
+ return false;
10546
+ try {
10547
+ const { exp } = jwtDecode(tokenValue);
10548
+ const expDate = new Date(exp * 1e3).getTime();
10549
+ const nowDate = (/* @__PURE__ */ new Date()).getTime();
10550
+ return nowDate < expDate;
10551
+ } catch (e7) {
10552
+ return false;
10553
+ }
10554
+ }
10555
+ function syncAuthState(nextToken, nextRefreshToken) {
10556
+ setTokenState(nextToken);
10557
+ setRefreshTokenState(nextRefreshToken);
10558
+ setUserLogged(decodeTokenFromValue(nextToken));
10559
+ setIsAuthenticated(isTokenValid(nextToken));
10560
+ }
10561
+ _react.useEffect.call(void 0, () => {
10562
+ const onStorage = (event) => {
10563
+ if (event.key !== TOKEN_KEY && event.key !== REFRESH_TOKEN_KEY) {
10564
+ return;
10565
+ }
10566
+ const nextToken = localStorage.getItem(TOKEN_KEY);
10567
+ const nextRefreshToken = localStorage.getItem(REFRESH_TOKEN_KEY);
10568
+ syncAuthState(nextToken, nextRefreshToken);
10569
+ };
10570
+ window.addEventListener("storage", onStorage);
10571
+ return () => window.removeEventListener("storage", onStorage);
10572
+ }, [TOKEN_KEY, REFRESH_TOKEN_KEY]);
10573
+ function setToken(token2, refreshToken2) {
10574
+ localStorage.setItem(TOKEN_KEY, token2);
10575
+ if (refreshToken2) {
10576
+ localStorage.setItem(REFRESH_TOKEN_KEY, refreshToken2);
10577
+ } else {
10578
+ localStorage.removeItem(REFRESH_TOKEN_KEY);
10579
+ }
10580
+ syncAuthState(token2, refreshToken2 || null);
10581
+ }
10582
+ function logout() {
10583
+ localStorage.removeItem(TOKEN_KEY);
10584
+ localStorage.removeItem(REFRESH_TOKEN_KEY);
10585
+ syncAuthState(null, null);
10586
+ }
10587
+ function getToken() {
10588
+ return token;
10589
+ }
10590
+ function getRefreshToken() {
10591
+ return refreshToken;
10592
+ }
10593
+ function formatAndSetToken(_token, email, senha) {
10594
+ const toReturn = _token;
10595
+ if (toReturn) {
10596
+ const token3 = _token.token;
10597
+ const { data: decodedToken } = jwtDecode(token3);
10598
+ const permissoes = decodedToken.permissoes;
10599
+ const permissao = permissoes[credentialsConfig.applicationsId];
10600
+ const uuid = decodedToken.uuid;
10601
+ const name = decodedToken.name;
10602
+ toReturn.email = email;
10603
+ toReturn.password = senha;
10604
+ toReturn.userId = uuid;
10605
+ toReturn.userName = name;
10606
+ toReturn.empresas = _optionalChain([permissao, 'optionalAccess', _84 => _84.empresas]) || null;
10607
+ }
10608
+ const { token: token2, refreshToken: refreshToken2 } = _token;
10609
+ setToken(token2, refreshToken2);
10610
+ return toReturn;
10611
+ }
10612
+ async function login(email, password) {
10613
+ setSubmitting(true);
10614
+ try {
10615
+ const response = await axios2.post(
10616
+ "sessions",
10617
+ {
10618
+ email,
10619
+ password
10620
+ },
10621
+ {
10622
+ headers: {
10623
+ "DC-SISTEMA": credentialsConfig.applicationsIds
10624
+ }
10625
+ }
10626
+ );
10627
+ return formatAndSetToken(response.data, email, password);
10628
+ } catch (err) {
10629
+ throw err;
10630
+ } finally {
10631
+ setSubmitting(false);
10632
+ }
10633
+ }
10634
+ async function alterarSenha(senhaAtual, senhaNova, email) {
10635
+ const headers = {};
10636
+ const token2 = getToken();
10637
+ if (!email && token2) {
10638
+ headers.Authorization = `Bearer ${token2}`;
10639
+ }
10640
+ setSubmitting(true);
10641
+ try {
10642
+ const response = await axios2.put(
10643
+ "passwords/change",
10644
+ {
10645
+ old: senhaAtual,
10646
+ new: senhaNova,
10647
+ email
10648
+ },
10649
+ {
10650
+ headers
10651
+ }
10652
+ );
10653
+ return _optionalChain([response, 'optionalAccess', _85 => _85.data]);
10654
+ } catch (err) {
10655
+ throw err;
10656
+ } finally {
10657
+ setSubmitting(false);
10658
+ }
10659
+ }
10660
+ async function selecionarLicenca(loginToken, empresaId) {
10661
+ if (!loginToken) {
10662
+ throw new Error("As informa\xE7\xF5es de login foram perdidas");
10663
+ }
10664
+ setSubmitting(true);
10665
+ try {
10666
+ const response = await axios2.post(
10667
+ "selecionar-empresa",
10668
+ {
10669
+ permissao: credentialsConfig.applicationsId,
10670
+ empresaUuid: empresaId
10671
+ },
10672
+ {
10673
+ headers: {
10674
+ Authorization: `Bearer ${loginToken}`
10675
+ }
10676
+ }
10677
+ );
10678
+ if (!response) {
10679
+ throw new Error("Ocorreu um erro ao tentar selecionar a licen\xE7a");
10680
+ }
10681
+ const { token: token2, refreshToken: refreshToken2 } = response.data;
10682
+ setToken(token2, refreshToken2);
10683
+ return response.data;
10684
+ } catch (err) {
10685
+ throw err;
10686
+ } finally {
10687
+ setSubmitting(false);
10688
+ }
10689
+ }
10690
+ async function recuperarSenha(email) {
10691
+ const response = await axios2.put("/passwords/recover", { email });
10692
+ return response;
10693
+ }
10694
+ async function refreshAccessToken() {
10695
+ const token2 = getToken();
10696
+ const refreshToken2 = getRefreshToken();
10697
+ const response = await axios2.post("refresh-token", {
10698
+ token: token2,
10699
+ refreshToken: refreshToken2
10700
+ });
10701
+ setToken(response.data.token, response.data.refreshToken);
10702
+ return response.data.token;
10703
+ }
10704
+ async function obterUsuarioLogado() {
10705
+ const response = await axios2.get("/api/usuario");
10706
+ return response.data;
10707
+ }
10708
+ function base64ToBlob(base64) {
10709
+ const [prefix2, data] = base64.split(",");
10710
+ const mime = _optionalChain([prefix2, 'access', _86 => _86.match, 'call', _87 => _87(/:(.*?);/), 'optionalAccess', _88 => _88[1]]) || "image/jpeg";
10711
+ const binary = atob(data);
10712
+ const array2 = new Uint8Array(binary.length);
10713
+ for (let i = 0; i < binary.length; i++) {
10714
+ array2[i] = binary.charCodeAt(i);
10715
+ }
10716
+ return new Blob([array2], { type: mime });
10717
+ }
10718
+ async function uploadAvatar(base64Image) {
10719
+ try {
10720
+ const blob = base64ToBlob(base64Image);
10721
+ const file = new File([blob], "avatar.jpg", { type: blob.type });
10722
+ const formData = new FormData();
10723
+ formData.append("avatar", file);
10724
+ const response = await axios2.post(
10725
+ "/api/usuario/avatar",
10726
+ formData,
10727
+ {
10728
+ headers: {
10729
+ "Content-Type": "multipart/form-data"
10730
+ }
10731
+ }
10732
+ );
10733
+ return response.data;
10734
+ } catch (error) {
10735
+ throw error;
10736
+ }
10737
+ }
10738
+ async function atualizarUsuario(data) {
10739
+ const response = await axios2.put("/api/usuario", data);
10740
+ return response.data;
10741
+ }
10742
+ async function gerarWhatsappVerificationCode() {
10743
+ const response = await axios2.post(
10744
+ "/api/usuario/gerar-codigo-validacao-whatsapp"
10745
+ );
10746
+ return response.data;
10747
+ }
10748
+ async function gerarOtpVerificationCode(data) {
10749
+ const response = await axios2.post("/otp/generate", data);
10750
+ return response.data;
10751
+ }
10752
+ async function validarOtpVerificationCode(data) {
10753
+ const response = await axios2.post("/otp/verify", data, {
10754
+ headers: {
10755
+ "DC-SISTEMA": credentialsConfig.applicationsIds
10756
+ }
10757
+ });
10758
+ return formatAndSetToken(response.data, data.target);
10759
+ }
10760
+ async function validarCodigoWhatsapp(codigoVerificacao) {
10761
+ const response = await axios2.post(
10762
+ "/api/usuario/validar-codigo-whatsapp",
10763
+ {
10764
+ codigoVerificacao
10765
+ },
10766
+ {
10767
+ headers: {
10768
+ "DC-SISTEMA": credentialsConfig.applicationsIds
10769
+ }
10770
+ }
10771
+ );
10772
+ return response.data;
10773
+ }
10774
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10775
+ CredentialsContext.Provider,
10776
+ {
10777
+ value: {
10778
+ login,
10779
+ logout,
10780
+ isSubmitting,
10781
+ token,
10782
+ refreshToken,
10783
+ userLogged,
10784
+ isAuthenticated,
10785
+ selecionarLicenca,
10786
+ alterarSenha,
10787
+ recuperarSenha,
10788
+ refreshAccessToken,
10789
+ obterUsuarioLogado,
10790
+ uploadAvatar,
10791
+ atualizarUsuario,
10792
+ gerarWhatsappVerificationCode,
10793
+ validarCodigoWhatsapp,
10794
+ gerarOtpVerificationCode,
10795
+ validarOtpVerificationCode
10796
+ },
10797
+ children
10798
+ }
10799
+ );
10800
+ }
10801
+ function useCredentialsContext() {
10802
+ const context = _react.useContext.call(void 0, CredentialsContext);
10803
+ if (context === void 0) {
10804
+ throw new Error(
10805
+ "useCredentialsContext must be used within a CredentialsProvider"
10806
+ );
10807
+ }
10808
+ return context;
10809
+ }
10810
+
10811
+ // src/v2/Auth/components/EsqueciSenhaForm/index.tsx
10812
+
10813
+ var schema = create$3().shape({
10814
+ email: create$6().required("Informe o e-mail")
10815
+ });
10816
+ function EsqueciSenhaForm(props) {
10817
+ const { onLoginClick } = props;
10818
+ const [email, setEmail] = _react.useState.call(void 0, "");
10819
+ const [isSubmitting, setSubmitting] = _react.useState.call(void 0, false);
10820
+ const [sucessoRecuperarSenha, setSucessoRecuperarSenha] = _react.useState.call(void 0, false);
10821
+ const [error, setError] = _react.useState.call(void 0, null);
10822
+ const { recuperarSenha } = useCredentialsContext();
10823
+ const { validationProps, setValidationErrors } = _hooks.useValidations.call(void 0, );
10824
+ async function handleRecuperarSenha() {
10825
+ setValidationErrors(null);
10826
+ schema.validate({ email }, { abortEarly: false }).then(async () => {
10827
+ try {
10828
+ setSubmitting(true);
10829
+ await recuperarSenha(email);
10830
+ setSucessoRecuperarSenha(true);
10831
+ } catch (error2) {
10832
+ setError(_optionalChain([error2, 'access', _89 => _89.response, 'optionalAccess', _90 => _90.data, 'access', _91 => _91.message]));
10833
+ } finally {
10834
+ setSubmitting(false);
10835
+ }
10836
+ }).catch((error2) => {
10837
+ setValidationErrors(error2);
10838
+ });
10839
+ }
10840
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { component: "form", children: [
10841
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10842
+ _material.TextField,
10843
+ {
10844
+ name: "email",
10845
+ label: "E-mail",
10846
+ margin: "normal",
10847
+ placeholder: "Informe o e-mail utilizado para acessar o sistema",
10848
+ autoFocus: true,
10849
+ value: email || "",
10850
+ onChange: (e) => setEmail(e.target.value),
10851
+ ...validationProps("email")
10852
+ }
10853
+ ),
10854
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10855
+ Button_default,
10856
+ {
10857
+ fullWidth: true,
10858
+ variant: "contained",
10859
+ onClick: handleRecuperarSenha,
10860
+ isLoading: isSubmitting,
10861
+ children: "Recuperar minha senha"
10862
+ }
10863
+ ),
10864
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10865
+ ButtonContainer,
10866
+ {
10867
+ sx: {
10868
+ display: "inline-flex",
10869
+ justifyContent: "space-between",
10870
+ width: "100%",
10871
+ marginTop: 1
10872
+ },
10873
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10874
+ Button_default,
10875
+ {
10876
+ onClick: onLoginClick,
10877
+ variant: "text",
10878
+ sx: {
10879
+ fontWeight: "400",
10880
+ ":hover": {
10881
+ color: (theme2) => theme2.palette.primary.dark
10882
+ }
10883
+ },
10884
+ children: "Voltar para o Login"
10885
+ }
10886
+ )
10887
+ }
10888
+ ),
10889
+ sucessoRecuperarSenha && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10890
+ _material.Alert,
10891
+ {
10892
+ severity: "success",
10893
+ action: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10894
+ Button_default,
10895
+ {
10896
+ onClick: onLoginClick,
10897
+ variant: "text",
10898
+ sx: {
10899
+ fontWeight: "400",
10900
+ ":hover": {
10901
+ color: (theme2) => theme2.palette.primary.dark
10902
+ }
10903
+ },
10904
+ children: "Ir para o Login"
10905
+ }
10906
+ ),
10907
+ children: "Enviamos para o seu e-mail as instru\xE7\xF5es para recuperar a sua senha"
10908
+ }
10909
+ ),
10910
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Alert, { severity: "error", children: error })
10911
+ ] });
10912
+ }
10913
+
10914
+ // src/v2/Auth/components/Header/index.tsx
10915
+
10916
+
10917
+ function Header3(props) {
10918
+ const { label, subTitle = "Acesse sua conta" } = props;
10919
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { component: "header", textAlign: "center", marginBottom: "3rem", children: [
10920
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10921
+ _material.Typography,
10922
+ {
10923
+ component: "h2",
10924
+ fontSize: "2rem",
10925
+ fontWeight: "bold",
10926
+ variant: "body1",
10927
+ fontFamily: "Montserrat",
10928
+ sx: { color: (theme2) => theme2.palette.primary.dark },
10929
+ children: label
10930
+ }
10931
+ ),
10932
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10933
+ _material.Typography,
10934
+ {
10935
+ component: "h3",
10936
+ fontSize: "1.25rem",
10937
+ fontFamily: "Montserrat",
10938
+ color: "primary",
10939
+ variant: "body1",
10940
+ children: subTitle
10941
+ }
10942
+ )
10943
+ ] });
10944
+ }
10945
+
10946
+ // src/v2/Auth/components/LicencaForm/index.tsx
10947
+
10948
+
10949
+
10950
+ function LicencaForm(props) {
10951
+ const { loginData, onLoginFailed, onLoginSuccess } = props;
10952
+ const [empresaId, setEmpresaId] = _react.useState.call(void 0, "");
10953
+ const { selecionarLicenca, isSubmitting } = useCredentialsContext();
10954
+ _react.useEffect.call(void 0, () => {
10955
+ if (Array.isArray(_optionalChain([loginData, 'optionalAccess', _92 => _92.empresas]))) {
10956
+ const empresa = _optionalChain([loginData, 'optionalAccess', _93 => _93.empresas, 'access', _94 => _94[0]]);
10957
+ setEmpresaId(_optionalChain([empresa, 'optionalAccess', _95 => _95.uuid]));
10958
+ }
10959
+ }, [loginData]);
10960
+ async function handleSelecionarLicenca() {
10961
+ try {
10962
+ const tokens = await selecionarLicenca(_optionalChain([loginData, 'optionalAccess', _96 => _96.token]), empresaId);
10963
+ if (tokens) {
10964
+ onLoginSuccess(tokens);
10965
+ } else {
10966
+ onLoginFailed("Nenhuma token definida");
10967
+ }
10968
+ } catch (err) {
10969
+ onLoginFailed(err);
10970
+ }
10971
+ }
10972
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { component: "form", sx: { minWidth: "290px" }, children: [
10973
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10974
+ _material.TextField,
10975
+ {
10976
+ label: "Licen\xE7as",
10977
+ margin: "normal",
10978
+ select: true,
10979
+ autoFocus: true,
10980
+ value: empresaId,
10981
+ onChange: (e) => {
10982
+ setEmpresaId(e.target.value);
10983
+ },
10984
+ children: _optionalChain([loginData, 'optionalAccess', _97 => _97.empresas, 'optionalAccess', _98 => _98.map, 'call', _99 => _99((empresa) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.MenuItem, { value: empresa.uuid, children: empresa.nome }, empresa.uuid))])
10985
+ }
10986
+ ),
10987
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10988
+ Button_default,
10989
+ {
10990
+ fullWidth: true,
10991
+ variant: "contained",
10992
+ onClick: handleSelecionarLicenca,
10993
+ isLoading: isSubmitting,
10994
+ sx: { mt: 1 },
10995
+ children: "Confirmar"
10996
+ }
10997
+ )
10998
+ ] });
10999
+ }
11000
+
11001
+ // src/v2/Auth/components/LoginForm/index.tsx
11002
+
11003
+
11004
+
11005
+
11006
+
11007
+
11008
+
11009
+ // src/v2/Auth/components/AlterarSenhaV2/index.tsx
11010
+
11011
+
11012
+
11013
+
11014
+
11015
+
11016
+
11017
+
11018
+ // src/v2/Auth/components/AlterarSenhaV2/components/ValidatorMessage/index.tsx
11019
+
11020
+
11021
+
11022
+ function ValidatorMessage(props) {
11023
+ const { isValid, message } = props;
11024
+ const theme2 = _material.useTheme.call(void 0, );
11025
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
11026
+ _material.Box,
11027
+ {
11028
+ sx: {
11029
+ display: "flex",
11030
+ flexDirection: "row",
11031
+ alignItems: "center"
11032
+ },
11033
+ children: [
11034
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11035
+ _Circle2.default,
11036
+ {
11037
+ color: isValid ? "success" : "inherit",
11038
+ sx: { fontSize: "8pt" }
11039
+ }
11040
+ ),
11041
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11042
+ _material.Typography,
11043
+ {
11044
+ variant: "body2",
11045
+ sx: {
11046
+ color: isValid ? theme2.palette.success.main : "inherit",
11047
+ textDecoration: isValid ? "line-through" : "none",
11048
+ ml: 1,
11049
+ fontSize: "10pt"
11050
+ },
11051
+ children: message
11052
+ }
11053
+ )
11054
+ ]
11055
+ }
11056
+ );
11057
+ }
11058
+
11059
+ // src/v2/Auth/components/AlterarSenhaV2/index.tsx
11060
+
11061
+ var defaultData = {
11062
+ senhaAtual: "",
11063
+ senhaNova: "",
11064
+ senhaNovaConfirmar: ""
11065
+ };
11066
+ var schema2 = create$3().shape({
11067
+ senhaAtual: create$6().required("Informe a Senha Atual."),
11068
+ senhaNova: create$6().required("Informe a Nova Senha."),
11069
+ senhaNovaConfirmar: create$6().required("Informe a Nova Senha.").oneOf([create$9("senhaNova")], "As senhas devem ser iguais.")
11070
+ });
11071
+ function AlterarSenhaV2(props) {
11072
+ const {
11073
+ isOpen,
11074
+ onClose,
11075
+ onSuccess,
11076
+ onFailed,
11077
+ primeiroAcesso,
11078
+ senhaAtual,
11079
+ email
11080
+ } = props;
11081
+ const { alterarSenha, isSubmitting } = useCredentialsContext();
11082
+ const { setValidationErrors, validationProps } = _hooks.useValidations.call(void 0, );
11083
+ const { data, handleChange, setData, changeValue } = _hooks.useForm.call(void 0, defaultData);
11084
+ const [ehSegura, setEhSegura] = _react.useState.call(void 0, false);
11085
+ const [error, setError] = _react.useState.call(void 0, null);
11086
+ _react.useEffect.call(void 0, () => {
11087
+ if (senhaAtual) {
11088
+ changeValue("senhaAtual", senhaAtual);
11089
+ }
11090
+ }, [senhaAtual]);
11091
+ _react.useEffect.call(void 0, () => {
11092
+ if (data.senhaNova) {
11093
+ setEhSegura(
11094
+ _isStrongPassword2.default.call(void 0, data.senhaNova, {
11095
+ minLength: 8,
11096
+ minLowercase: 1,
11097
+ minUppercase: 1,
11098
+ minNumbers: 1,
11099
+ minSymbols: 1
11100
+ })
11101
+ );
11102
+ }
11103
+ }, [data.senhaNova]);
11104
+ async function handleAlterarSenha() {
11105
+ setValidationErrors(null);
11106
+ setError(null);
11107
+ schema2.validate(data, { abortEarly: false }).then(async () => {
11108
+ const { senhaAtual: senhaAtual2, senhaNova } = data;
11109
+ try {
11110
+ const response = await alterarSenha(senhaAtual2, senhaNova, email);
11111
+ if (response) {
11112
+ if (onSuccess)
11113
+ onSuccess();
11114
+ setData(defaultData);
11115
+ }
11116
+ } catch (error2) {
11117
+ if (onFailed)
11118
+ onFailed(error2);
11119
+ if (_axios.isAxiosError.call(void 0, error2)) {
11120
+ setError(_optionalChain([error2, 'access', _100 => _100.response, 'optionalAccess', _101 => _101.data, 'access', _102 => _102.message]));
11121
+ return;
11122
+ }
11123
+ setError("Ocorreu um erro ao tentar alterar a senha");
11124
+ }
11125
+ }).catch((error2) => {
11126
+ console.log("Erros por campo:", error2.inner);
11127
+ console.log("Primeiro erro:", error2.errors);
11128
+ setValidationErrors(error2);
11129
+ });
11130
+ }
11131
+ function tem8caracteres() {
11132
+ return _optionalChain([data, 'optionalAccess', _103 => _103.senhaNova, 'access', _104 => _104.length]) >= 8;
11133
+ }
11134
+ function temLetraMinuscula() {
11135
+ if (_optionalChain([data, 'optionalAccess', _105 => _105.senhaNova])) {
11136
+ const result = _optionalChain([data, 'optionalAccess', _106 => _106.senhaNova, 'access', _107 => _107.match, 'call', _108 => _108(/[a-z]/g)]);
11137
+ return Array.isArray(result) && result.length > 0;
11138
+ }
11139
+ return false;
11140
+ }
11141
+ function temLetraMaisucula() {
11142
+ if (_optionalChain([data, 'optionalAccess', _109 => _109.senhaNova])) {
11143
+ const result = _optionalChain([data, 'optionalAccess', _110 => _110.senhaNova, 'access', _111 => _111.match, 'call', _112 => _112(/[A-Z]/g)]);
11144
+ return Array.isArray(result) && result.length > 0;
11145
+ }
11146
+ return false;
11147
+ }
11148
+ function temNumero() {
11149
+ if (_optionalChain([data, 'optionalAccess', _113 => _113.senhaNova])) {
11150
+ const result = _optionalChain([data, 'optionalAccess', _114 => _114.senhaNova, 'access', _115 => _115.match, 'call', _116 => _116(/\d/g)]);
11151
+ return Array.isArray(result) && result.length > 0;
11152
+ }
11153
+ return false;
11154
+ }
11155
+ function temCaracterEspecial() {
11156
+ if (_optionalChain([data, 'optionalAccess', _117 => _117.senhaNova])) {
11157
+ const result = _optionalChain([data, 'optionalAccess', _118 => _118.senhaNova, 'access', _119 => _119.match, 'call', _120 => _120(/\W/g)]);
11158
+ return Array.isArray(result) && result.length > 0;
11159
+ }
11160
+ return false;
11161
+ }
11162
+ function asSenhasSaoIguais() {
11163
+ if (_optionalChain([data, 'optionalAccess', _121 => _121.senhaNova]) === "")
11164
+ return false;
11165
+ return _optionalChain([data, 'optionalAccess', _122 => _122.senhaNova]) === _optionalChain([data, 'optionalAccess', _123 => _123.senhaNovaConfirmar]);
11166
+ }
11167
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog_default.Root, { open: isOpen, onClose: (_) => onClose(), maxWidth: "md", children: [
11168
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog_default.Header, { children: [
11169
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.Title, { children: "Alterar Senha" }),
11170
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.ActionClose, { onClose })
11171
+ ] }),
11172
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.Content, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Grid, { container: true, spacing: 2, children: [
11173
+ primeiroAcesso && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid, { size: 12, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Alert, { severity: "info", children: [
11174
+ "Voc\xEA est\xE1 acessando o sistema com uma senha tempor\xE1ria.",
11175
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {}),
11176
+ "Cadastre uma senha segura para deixar sua conta mais protegida."
11177
+ ] }) }),
11178
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Grid, { size: 12, children: [
11179
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11180
+ PasswordTextField,
11181
+ {
11182
+ name: "senhaAtual",
11183
+ label: "Senha Atual",
11184
+ value: _optionalChain([data, 'optionalAccess', _124 => _124.senhaAtual]) || "",
11185
+ onChange: handleChange,
11186
+ ...validationProps("senhaAtual")
11187
+ }
11188
+ ),
11189
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
11190
+ _material.Box,
11191
+ {
11192
+ sx: { display: "flex", alignItems: "center", gap: 0.5, mt: 0.5 },
11193
+ children: [
11194
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _InfoOutlined2.default, { sx: { fontSize: 14, color: "text.secondary" } }),
11195
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "caption", color: "text.secondary", children: "Essa \xE9 a senha que voc\xEA utiliza para acessar o sistema atualmente." })
11196
+ ]
11197
+ }
11198
+ )
11199
+ ] }),
11200
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid, { size: 12, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Divider, {}) }),
11201
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid, { size: 12, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11202
+ PasswordTextField,
11203
+ {
11204
+ name: "senhaNova",
11205
+ label: "Nova Senha",
11206
+ value: _optionalChain([data, 'optionalAccess', _125 => _125.senhaNova]) || "",
11207
+ onChange: handleChange,
11208
+ ...validationProps("senhaNova")
11209
+ }
11210
+ ) }),
11211
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Grid, { size: 12, children: [
11212
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11213
+ PasswordTextField,
11214
+ {
11215
+ name: "senhaNovaConfirmar",
11216
+ label: "Confirmar Nova Senha",
11217
+ value: _optionalChain([data, 'optionalAccess', _126 => _126.senhaNovaConfirmar]) || "",
11218
+ onChange: handleChange,
11219
+ ...validationProps("senhaNovaConfirmar")
11220
+ }
11221
+ ),
11222
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
11223
+ _material.Box,
11224
+ {
11225
+ sx: { display: "flex", alignItems: "center", gap: 0.5, mt: 0.5 },
11226
+ children: [
11227
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _InfoOutlined2.default, { sx: { fontSize: 14, color: "text.secondary" } }),
11228
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "caption", color: "text.secondary", children: "Informe nos campos acima a nova senha que deseja utilizar." })
11229
+ ]
11230
+ }
11231
+ )
11232
+ ] }),
11233
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Grid, { size: 12, children: [
11234
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11235
+ ValidatorMessage,
11236
+ {
11237
+ isValid: tem8caracteres(),
11238
+ message: "O tamanho m\xEDnimo da nova senha \xE9 de 8 caracteres"
11239
+ }
11240
+ ),
11241
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11242
+ ValidatorMessage,
11243
+ {
11244
+ isValid: temLetraMinuscula(),
11245
+ message: "A nova senha deve ter ao menos uma letra min\xFAscula"
11246
+ }
11247
+ ),
11248
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11249
+ ValidatorMessage,
11250
+ {
11251
+ isValid: temLetraMaisucula(),
11252
+ message: "A nova senha deve ter ao menos uma letra mai\xFAscula"
11253
+ }
11254
+ ),
11255
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11256
+ ValidatorMessage,
11257
+ {
11258
+ isValid: temNumero(),
11259
+ message: "A nova senha deve ter ao menos um n\xFAmero"
11260
+ }
11261
+ ),
11262
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11263
+ ValidatorMessage,
11264
+ {
11265
+ isValid: temCaracterEspecial(),
11266
+ message: "A nova senha deve ter ao menos um caracter especial"
11267
+ }
11268
+ ),
11269
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11270
+ ValidatorMessage,
11271
+ {
11272
+ isValid: asSenhasSaoIguais(),
11273
+ message: "A confirma\xE7\xE3o da nova senha deve ser igual \xE0 nova senha"
11274
+ }
11275
+ )
11276
+ ] }),
11277
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid, { size: 12, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Alert, { severity: "error", children: error }) })
11278
+ ] }) }),
11279
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.Footer, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog_default.Actions, { children: [
11280
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.ActionCancelar, { onClick: () => onClose() }),
11281
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11282
+ Dialog_default.ActionSalvar,
11283
+ {
11284
+ label: "Alterar Senha",
11285
+ onClick: handleAlterarSenha,
11286
+ isLoading: isSubmitting,
11287
+ disabled: !ehSegura
11288
+ }
11289
+ )
11290
+ ] }) })
11291
+ ] });
11292
+ }
11293
+
11294
+ // src/v2/Auth/components/LoginForm/index.tsx
11295
+
11296
+ var schema3 = create$3().shape({
11297
+ email: create$6().required("Informe o e-mail"),
11298
+ password: create$6().required("Informe a senha")
11299
+ });
11300
+ function LoginForm(props) {
11301
+ const { onLoginSuccess, onLoginFailed, onOptionsClick } = props;
11302
+ const [email, setEmail] = _react.useState.call(void 0, "");
11303
+ const [password, setPassword] = _react.useState.call(void 0, "");
11304
+ const [isLoading, setLoading] = _react.useState.call(void 0, false);
11305
+ const [exibirAlterarSenha, setExibirAlterarSenha] = _react.useState.call(void 0, false);
11306
+ const [sucessoAlterarSenha, setSucessoAlterarSenha] = _react.useState.call(void 0, false);
11307
+ const [error, setError] = _react.useState.call(void 0, null);
11308
+ const { login } = useCredentialsContext();
11309
+ const { validationProps, setValidationErrors } = _hooks.useValidations.call(void 0, );
11310
+ async function handleLogin() {
11311
+ setValidationErrors(null);
11312
+ setError(null);
11313
+ schema3.validate({ email, password }, { abortEarly: false }).then(async () => {
11314
+ setLoading(true);
11315
+ try {
11316
+ const loginResponse = await login(email, password);
11317
+ if (loginResponse) {
11318
+ onLoginSuccess(loginResponse);
11319
+ }
11320
+ } catch (err) {
11321
+ if (_axios.isAxiosError.call(void 0, err)) {
11322
+ const axiosError = err;
11323
+ if (_optionalChain([axiosError, 'access', _127 => _127.response, 'optionalAccess', _128 => _128.data, 'access', _129 => _129.code]) === "E_FIRST_ACCESS") {
11324
+ setExibirAlterarSenha(true);
11325
+ return;
11326
+ }
11327
+ setError(_optionalChain([err, 'access', _130 => _130.response, 'optionalAccess', _131 => _131.data, 'access', _132 => _132.message]));
11328
+ }
11329
+ onLoginFailed(err);
11330
+ }
11331
+ }).catch((err) => {
11332
+ setValidationErrors(err);
11333
+ }).finally(() => {
11334
+ setLoading(false);
11335
+ });
11336
+ }
11337
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { component: "form", onSubmit: handleLogin, children: [
11338
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
11339
+ _material.Stack,
11340
+ {
11341
+ spacing: 2,
11342
+ children: [
11343
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11344
+ _material.TextField,
11345
+ {
11346
+ name: "email",
11347
+ label: "E-mail",
11348
+ margin: "normal",
11349
+ autoFocus: true,
11350
+ value: email || "",
11351
+ onChange: (e) => setEmail(e.target.value),
11352
+ ...validationProps("email")
11353
+ }
11354
+ ),
11355
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11356
+ PasswordTextField,
11357
+ {
11358
+ name: "password",
11359
+ label: "Senha",
11360
+ value: password || "",
11361
+ onChange: (e) => setPassword(e.target.value),
11362
+ onKeyDown: (e) => e.key === "Enter" && handleLogin(),
11363
+ ...validationProps("password")
11364
+ }
11365
+ ),
11366
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11367
+ Button_default,
11368
+ {
11369
+ fullWidth: true,
11370
+ variant: "contained",
11371
+ onClick: handleLogin,
11372
+ isLoading,
11373
+ sx: { mt: 1 },
11374
+ children: "Entrar"
11375
+ }
11376
+ )
11377
+ ]
11378
+ }
11379
+ ),
11380
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11381
+ Button_default,
11382
+ {
11383
+ onClick: () => onOptionsClick("esqueci-senha"),
11384
+ variant: "text",
11385
+ disableRipple: true,
11386
+ disableTouchRipple: true,
11387
+ sx: {
11388
+ justifyContent: "flex-start",
11389
+ // alinha o conteúdo à esquerda
11390
+ alignContent: "center",
11391
+ alignItems: "center",
11392
+ textAlign: "left",
11393
+ // alinha o texto internamente à esquerda
11394
+ width: "120px",
11395
+ // define uma largura para perceber o alinhamento
11396
+ marginTop: 0.5,
11397
+ fontWeight: "400",
11398
+ ":hover": {
11399
+ // color: (theme) => theme.palette.,
11400
+ }
11401
+ },
11402
+ children: "Esqueci a senha"
11403
+ }
11404
+ ),
11405
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Alert, { severity: "error", children: error }),
11406
+ sucessoAlterarSenha && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Alert, { severity: "success", children: [
11407
+ "Senha cadastrada com sucesso",
11408
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {}),
11409
+ "Tudo pronto para voc\xEA fazer o login"
11410
+ ] }),
11411
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
11412
+ _material.Stack,
11413
+ {
11414
+ direction: "row",
11415
+ justifyContent: "center",
11416
+ alignItems: "center",
11417
+ mt: 2,
11418
+ mb: 2,
11419
+ children: [
11420
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Divider, { sx: { flexGrow: 1, mr: 1 } }),
11421
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { children: "Ou fa\xE7a login com" }),
11422
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Divider, { sx: { flexGrow: 1, ml: 1 } })
11423
+ ]
11424
+ }
11425
+ ),
11426
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { spacing: 1, children: [
11427
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11428
+ Button_default,
11429
+ {
11430
+ onClick: () => onOptionsClick("otp-email"),
11431
+ startIcon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Mail2.default, {}),
11432
+ children: "Entrar com senha tempor\xE1ria"
11433
+ }
11434
+ ),
11435
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11436
+ Button_default,
11437
+ {
11438
+ onClick: () => onOptionsClick("otp-whatsapp"),
11439
+ startIcon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _WhatsApp2.default, {}),
11440
+ children: "Entrar com senha tempor\xE1ria"
11441
+ }
11442
+ )
11443
+ ] }),
11444
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11445
+ AlterarSenhaV2,
11446
+ {
11447
+ senhaAtual: password,
11448
+ email,
11449
+ primeiroAcesso: true,
11450
+ isOpen: exibirAlterarSenha,
11451
+ onClose: async () => setExibirAlterarSenha(false),
11452
+ onSuccess: () => {
11453
+ setExibirAlterarSenha(false);
11454
+ setSucessoAlterarSenha(true);
11455
+ setPassword("");
11456
+ }
11457
+ }
11458
+ )
11459
+ ] });
11460
+ }
11461
+
11462
+ // src/v2/Auth/components/LoginSection/index.tsx
11463
+
11464
+
11465
+ // src/v2/Auth/components/OtpForm/index.tsx
11466
+
11467
+ var _HelpOutline = require('@mui/icons-material/HelpOutline'); var _HelpOutline2 = _interopRequireDefault(_HelpOutline);
11468
+
11469
+
11470
+
11471
+ // src/WhastappTextField/index.tsx
11472
+
11473
+ var _TextField = require('@mui/material/TextField'); var _TextField2 = _interopRequireDefault(_TextField);
11474
+
11475
+ var formatPhone = (value) => {
11476
+ const digits = value.replace(/\D/g, "");
11477
+ if (digits.length <= 2) {
11478
+ return `(${digits}`;
11479
+ }
11480
+ if (digits.length <= 7) {
11481
+ return `(${digits.slice(0, 2)}) ${digits.slice(2)}`;
11482
+ }
11483
+ if (digits.length <= 11) {
11484
+ return `(${digits.slice(0, 2)}) ${digits.slice(2, 7)}-${digits.slice(7)}`;
11485
+ }
11486
+ return `(${digits.slice(0, 2)}) ${digits.slice(2, 7)}-${digits.slice(7, 11)}`;
11487
+ };
11488
+ function WhatsAppTextField(props) {
11489
+ const { value: propValue, onChange: propOnChange, ...rest } = props;
11490
+ const [internalValue, setInternalValue] = _react.useState.call(void 0, "");
11491
+ const isControlled = propValue !== void 0;
11492
+ const displayedValue = _react.useMemo.call(void 0, () => {
11493
+ return isControlled ? formatPhone(propValue || "") : internalValue;
11494
+ }, [propValue, internalValue, isControlled]);
11495
+ const handleChange = (event) => {
11496
+ const masked = formatPhone(event.target.value);
11497
+ if (!isControlled) {
11498
+ setInternalValue(masked);
11499
+ }
11500
+ if (propOnChange) {
11501
+ const customEvent = {
11502
+ ...event,
11503
+ target: {
11504
+ ...event.target,
11505
+ value: masked
11506
+ }
11507
+ };
11508
+ propOnChange(customEvent);
11509
+ }
11510
+ };
11511
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11512
+ _TextField2.default,
11513
+ {
11514
+ value: displayedValue,
11515
+ onChange: handleChange,
11516
+ inputProps: { maxLength: 15 },
11517
+ ...rest
11518
+ }
11519
+ );
11520
+ }
11521
+
11522
+ // src/v2/Auth/components/OtpForm/DialogVerificarOtp.tsx
11523
+
11524
+
11525
+
11526
+ // src/VerificationCodeInput/index.tsx
11527
+
11528
+
11529
+
11530
+ function VerificationCodeInput({
11531
+ length = 6,
11532
+ value,
11533
+ onChange
11534
+ }) {
11535
+ const inputsRef = _react.useRef.call(void 0, []);
11536
+ const handleChange = (index, digit) => {
11537
+ const chars = "ABCDEF0123456789";
11538
+ const cleanDigit = digit.toUpperCase().split("").find((char) => chars.includes(char)) || "";
11539
+ const nextValue = value.split("");
11540
+ nextValue[index] = cleanDigit;
11541
+ const updatedValue = nextValue.join("");
11542
+ onChange(updatedValue);
11543
+ if (cleanDigit && index < length - 1) {
11544
+ _optionalChain([inputsRef, 'access', _133 => _133.current, 'access', _134 => _134[index + 1], 'optionalAccess', _135 => _135.focus, 'call', _136 => _136()]);
11545
+ }
11546
+ };
11547
+ const handleKeyDown = (index, event) => {
11548
+ if (event.key === "Backspace" && !value[index] && index > 0) {
11549
+ _optionalChain([inputsRef, 'access', _137 => _137.current, 'access', _138 => _138[index - 1], 'optionalAccess', _139 => _139.focus, 'call', _140 => _140()]);
11550
+ }
11551
+ };
11552
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Box, { display: "flex", gap: 1, children: Array.from({ length }).map((_, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11553
+ _material.TextField,
11554
+ {
11555
+ autoFocus: i === 0,
11556
+ inputRef: (el) => inputsRef.current[i] = el,
11557
+ slotProps: {
11558
+ htmlInput: {
11559
+ maxLength: 1,
11560
+ style: {
11561
+ textAlign: "center",
11562
+ fontSize: "24px",
11563
+ width: "24px",
11564
+ height: "36px"
11565
+ }
11566
+ }
11567
+ },
11568
+ value: value[i] || "",
11569
+ onChange: (e) => handleChange(i, e.target.value),
11570
+ onKeyDown: (e) => handleKeyDown(i, e)
11571
+ },
11572
+ i
11573
+ )) });
11574
+ }
11575
+
11576
+ // src/v2/Auth/components/OtpForm/DialogVerificarOtp.tsx
11577
+
11578
+ function DialogVerificarOtp(props) {
11579
+ const { open, onClose, payload, onLoginSuccess } = props;
11580
+ const [code, setCode] = _react.useState.call(void 0, "");
11581
+ const [error, setError] = _react.useState.call(void 0, false);
11582
+ const [isLoading, setLoading] = _react.useState.call(void 0, false);
11583
+ const { validarOtpVerificationCode } = useCredentialsContext();
11584
+ _react.useEffect.call(void 0, () => {
11585
+ if (error) {
11586
+ setTimeout(() => {
11587
+ setError(false);
11588
+ }, 3e3);
11589
+ }
11590
+ }, [error]);
11591
+ async function handleOtpLogin() {
11592
+ try {
11593
+ setLoading(true);
11594
+ const loginResponse = await validarOtpVerificationCode({
11595
+ channel: payload.channel,
11596
+ target: payload.target,
11597
+ code
11598
+ });
11599
+ if (loginResponse) {
11600
+ onLoginSuccess(loginResponse);
11601
+ }
11602
+ onClose();
11603
+ } catch (err) {
11604
+ setError(err.response.data.message);
11605
+ } finally {
11606
+ setLoading(false);
11607
+ }
11608
+ }
11609
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog_default.Root, { open, onClose: (_) => onClose(), maxWidth: "xs", children: [
11610
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog_default.Header, { children: [
11611
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.Title, { children: "Entrar com senha tempor\xE1ria" }),
11612
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.ActionClose, { onClose })
11613
+ ] }),
11614
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.Content, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
11615
+ _material.Stack,
11616
+ {
11617
+ spacing: 2,
11618
+ justifyContent: "center",
11619
+ alignContent: "center",
11620
+ alignItems: "center",
11621
+ children: [
11622
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11623
+ _material.Typography,
11624
+ {
11625
+ variant: "subtitle1",
11626
+ sx: { fontWeight: "bolder", fontSize: "11pt" },
11627
+ children: "\u{1F510} Digite a senha tempor\xE1ria para acessar sua conta"
11628
+ }
11629
+ ),
11630
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body1", sx: { fontSize: "10pt" }, children: [
11631
+ "Enviamos uma senha tempor\xE1ria para ",
11632
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "b", { children: payload.target }),
11633
+ ". ",
11634
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {}),
11635
+ "Digite o c\xF3digo abaixo para acessar sua conta."
11636
+ ] }),
11637
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11638
+ VerificationCodeInput,
11639
+ {
11640
+ value: code,
11641
+ onChange: (value) => {
11642
+ setCode(value);
11643
+ }
11644
+ }
11645
+ ),
11646
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Alert, { sx: { flexGrow: 1 }, severity: "error", children: error })
11647
+ ]
11648
+ }
11649
+ ) }),
11650
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.Footer, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog_default.Actions, { children: [
11651
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.ActionCancelar, { onClick: () => onClose() }),
11652
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11653
+ Dialog_default.ActionSalvar,
11654
+ {
11655
+ label: "Entrar",
11656
+ onClick: handleOtpLogin,
11657
+ isLoading,
11658
+ disabled: code.length != 6
11659
+ }
11660
+ )
11661
+ ] }) })
11662
+ ] });
11663
+ }
11664
+
11665
+ // src/v2/Auth/components/OtpForm/index.tsx
11666
+
11667
+ var contatoSchema = create$3().shape({
11668
+ contato: create$6().when("$tipo", ([tipo], schema9) => {
11669
+ return tipo === "otp-email" ? schema9.email("E-mail inv\xE1lido").required("Informe o e-mail") : schema9.matches(/^\+?[1-9]\d{7,14}$/, "N\xFAmero de WhatsApp inv\xE1lido").required("Informe o WhatsApp");
11670
+ })
11671
+ });
11672
+ function OtpForm(props) {
11673
+ const { tipo, onLoginSuccess, onLoginClick } = props;
11674
+ const [isLoading, setLoading] = _react.useState.call(void 0, false);
11675
+ const [error, setError] = _react.useState.call(void 0, false);
11676
+ const { gerarOtpVerificationCode } = useCredentialsContext();
11677
+ const { handleChange, changeValue, data, validate, validationErrors } = _hooks.useForm.call(void 0, { contato: "" }, contatoSchema);
11678
+ const [isOpenVerificar, setOpenVerificar] = _react.useState.call(void 0, false);
11679
+ const handleSubmit = async (e) => {
11680
+ e.preventDefault();
11681
+ validate(
11682
+ async (validData) => {
11683
+ try {
11684
+ setError(false);
11685
+ setLoading(true);
11686
+ const usuario = await gerarOtpVerificationCode({
11687
+ channel: tipo === "otp-email" ? "email" : "whatsapp",
11688
+ target: validData.contato
11689
+ });
11690
+ setOpenVerificar(true);
11691
+ } catch (err) {
11692
+ setError(err.response.data.message);
11693
+ } finally {
11694
+ setLoading(false);
11695
+ }
11696
+ },
11697
+ { context: { tipo } }
11698
+ );
11699
+ };
11700
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
11701
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "form", { onSubmit: handleSubmit, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { spacing: 2, children: [
11702
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "subtitle2", children: tipo === "otp-email" ? " Informe seu e-mail para receber um c\xF3digo de acesso" : "Informe seu n\xFAmero de WhatsApp para receber um c\xF3digo de acesso" }),
11703
+ tipo === "otp-email" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11704
+ _material.TextField,
11705
+ {
11706
+ autoFocus: true,
11707
+ name: "contato",
11708
+ label: "E-mail",
11709
+ value: data.contato || "",
11710
+ onChange: handleChange,
11711
+ fullWidth: true,
11712
+ ...validationErrors("contato")
11713
+ }
11714
+ ),
11715
+ tipo === "otp-whatsapp" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11716
+ WhatsAppTextField,
11717
+ {
11718
+ autoFocus: true,
11719
+ name: "contato",
11720
+ label: "Whatsapp",
11721
+ value: data.contato || "",
11722
+ onChange: (e) => {
11723
+ changeValue("contato", e.target.value.replace(/[^\d+]/g, ""));
11724
+ },
11725
+ fullWidth: true,
11726
+ ...validationErrors("contato")
11727
+ }
11728
+ ),
11729
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { children: [
11730
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11731
+ Button_default,
11732
+ {
11733
+ isLoading,
11734
+ type: "submit",
11735
+ variant: "contained",
11736
+ color: "primary",
11737
+ children: "Enviar c\xF3digo"
11738
+ }
11739
+ ),
11740
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
11741
+ ButtonContainer,
11742
+ {
11743
+ sx: {
11744
+ display: "inline-flex",
11745
+ justifyContent: "space-between",
11746
+ width: "100%",
11747
+ marginTop: 1
11748
+ },
11749
+ children: [
11750
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11751
+ Button_default,
11752
+ {
11753
+ onClick: onLoginClick,
11754
+ variant: "text",
11755
+ sx: {
11756
+ fontWeight: "400",
11757
+ ":hover": {
11758
+ color: (theme2) => theme2.palette.primary.dark
11759
+ }
11760
+ },
11761
+ children: "Voltar para o Login"
11762
+ }
11763
+ ),
11764
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11765
+ "a",
11766
+ {
11767
+ href: "https://datacsistemashelp.zendesk.com/hc/pt-br/articles/36489079108756-Login-OTP-via-WhatsApp",
11768
+ target: "_blank",
11769
+ rel: "noopener noreferrer",
11770
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.IconButton, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _HelpOutline2.default, { color: "primary" }) })
11771
+ }
11772
+ )
11773
+ ]
11774
+ }
11775
+ )
11776
+ ] }),
11777
+ error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Alert, { severity: "error", children: error })
11778
+ ] }) }),
11779
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11780
+ DialogVerificarOtp,
11781
+ {
11782
+ onLoginSuccess,
11783
+ open: isOpenVerificar,
11784
+ onClose: async (_) => {
11785
+ setOpenVerificar(false);
11786
+ },
11787
+ payload: {
11788
+ target: data.contato,
11789
+ channel: tipo === "otp-email" ? "email" : "whatsapp"
11790
+ }
11791
+ }
11792
+ )
11793
+ ] });
11794
+ }
11795
+
11796
+ // src/v2/Auth/components/LoginSection/index.tsx
11797
+
11798
+ var pageLabelMap = {
11799
+ login: "Acesse sua conta",
11800
+ licensa: "Selecione a licen\xE7a",
11801
+ "esqueci-senha": "Recupere a sua senha",
11802
+ "otp-email": "Entrar com senha tempor\xE1ria (E-mail)",
11803
+ "otp-whatsapp": "Entrar com senha tempor\xE1ria (WhatsApp)"
11804
+ };
11805
+ function LoginSection(props) {
11806
+ const { onLoginSuccess, onLoginFailed, onAlreadyLogged, appName } = props;
11807
+ const [loginData, setLoginData] = _react.useState.call(void 0, );
11808
+ const { selecionarLicenca, isAuthenticated } = useCredentialsContext();
11809
+ const [view, setView] = _react.useState.call(void 0, "login");
11810
+ const theme2 = _material.useTheme.call(void 0, );
11811
+ const fullScreen = _material.useMediaQuery.call(void 0, theme2.breakpoints.up("md"));
11812
+ _react.useEffect.call(void 0, () => {
11813
+ if (isAuthenticated && onAlreadyLogged) {
11814
+ onAlreadyLogged();
11815
+ }
11816
+ }, [isAuthenticated]);
11817
+ async function handleLoginSuccess(_loginData) {
11818
+ try {
11819
+ if (Array.isArray(_optionalChain([_loginData, 'optionalAccess', _141 => _141.empresas]))) {
11820
+ if (_optionalChain([_loginData, 'optionalAccess', _142 => _142.empresas, 'access', _143 => _143.length]) === 1) {
11821
+ const tokens = await selecionarLicenca(
11822
+ _optionalChain([_loginData, 'optionalAccess', _144 => _144.token]),
11823
+ _loginData.empresas[0].uuid
11824
+ );
11825
+ if (tokens) {
11826
+ onLoginSuccess(tokens);
11827
+ }
11828
+ return;
11829
+ }
11830
+ setView("licensa");
11831
+ setLoginData(_loginData);
11832
+ return;
11833
+ }
11834
+ onLoginSuccess(_loginData);
11835
+ } catch (err) {
11836
+ onLoginFailed(err);
11837
+ }
11838
+ }
11839
+ async function handleLoginFailed(err) {
11840
+ onLoginFailed(err);
11841
+ }
11842
+ function handleOptionsClick(option) {
11843
+ setView(option);
11844
+ }
11845
+ function handleExibirLogin() {
11846
+ setView("login");
11847
+ }
11848
+ const pageLabel = pageLabelMap[view];
11849
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { children: [
11850
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Header3, { label: appName, subTitle: pageLabel }),
11851
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { marginTop: 2 }, children: [
11852
+ view === "login" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11853
+ LoginForm,
11854
+ {
11855
+ onLoginSuccess: handleLoginSuccess,
11856
+ onLoginFailed: handleLoginFailed,
11857
+ onOptionsClick: handleOptionsClick
11858
+ }
11859
+ ),
11860
+ view === "licensa" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11861
+ LicencaForm,
11862
+ {
11863
+ loginData,
11864
+ onLoginSuccess,
11865
+ onLoginFailed
11866
+ }
11867
+ ),
11868
+ view === "esqueci-senha" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EsqueciSenhaForm, { onLoginClick: handleExibirLogin }),
11869
+ view === "otp-email" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11870
+ OtpForm,
11871
+ {
11872
+ onLoginClick: handleExibirLogin,
11873
+ onLoginSuccess: handleLoginSuccess,
11874
+ tipo: "otp-email"
11875
+ }
11876
+ ),
11877
+ view === "otp-whatsapp" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11878
+ OtpForm,
11879
+ {
11880
+ onLoginClick: handleExibirLogin,
11881
+ onLoginSuccess: handleLoginSuccess,
11882
+ tipo: "otp-whatsapp"
11883
+ }
11884
+ )
11885
+ ] })
11886
+ ] });
11887
+ }
11888
+
11889
+ // src/v2/Auth/index.tsx
11890
+
11891
+ function LoginContainer({ children }) {
11892
+ const theme2 = _material.useTheme.call(void 0, );
11893
+ const fullScreen = _material.useMediaQuery.call(void 0, theme2.breakpoints.up("md"));
11894
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
11895
+ _material.Stack,
11896
+ {
11897
+ component: "section",
11898
+ width: fullScreen ? "46%" : "100%",
11899
+ minWidth: "420px",
11900
+ maxWidth: fullScreen ? "614px" : "initial",
11901
+ justifyContent: "center",
11902
+ alignItems: "center",
11903
+ padding: "2rem",
11904
+ children: [
11905
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Stack, { width: "100%", maxWidth: "28rem", margin: "auto 0", children }),
11906
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { direction: "row", alignItems: "center", marginBottom: -3, children: [
11907
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11908
+ "img",
11909
+ {
11910
+ width: "60",
11911
+ src: "https://datac-site-assets.s3.sa-east-1.amazonaws.com/logomarca.png"
11912
+ }
11913
+ ),
11914
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11915
+ _material.Typography,
11916
+ {
11917
+ variant: "body1",
11918
+ component: "span",
11919
+ fontSize: "0.7rem",
11920
+ sx: { color: (theme3) => theme3.palette.grey[500] },
11921
+ children: "Data C Sistemas"
11922
+ }
11923
+ )
11924
+ ] })
11925
+ ]
11926
+ }
11927
+ );
11928
+ }
11929
+ function Auth(props) {
11930
+ const { banner, loginSection, ...loginSectionProps } = props;
11931
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { component: "main", direction: "row", height: "100vh", children: [
11932
+ banner ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BannerSection2, { children: banner }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DefaultBanner, {}),
11933
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoginContainer, { children: loginSection ? loginSection : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoginSection, { ...loginSectionProps }) })
11934
+ ] });
11935
+ }
11936
+
10284
11937
  // src/PasswordTextField/index.tsx
10285
11938
 
10286
11939
  function PasswordTextField(props) {
@@ -10320,7 +11973,7 @@ function PasswordTextField(props) {
10320
11973
 
10321
11974
 
10322
11975
 
10323
- function ValidatorMessage(props) {
11976
+ function ValidatorMessage2(props) {
10324
11977
  const { isValid, message } = props;
10325
11978
  const theme2 = _material.useTheme.call(void 0, );
10326
11979
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
@@ -10359,12 +12012,12 @@ function ValidatorMessage(props) {
10359
12012
 
10360
12013
  // src/AlterarSenha/index.tsx
10361
12014
 
10362
- var defaultData = {
12015
+ var defaultData2 = {
10363
12016
  senhaAtual: "",
10364
12017
  senhaNova: "",
10365
12018
  senhaNovaConfirmar: ""
10366
12019
  };
10367
- var schema = create$3().shape({
12020
+ var schema4 = create$3().shape({
10368
12021
  senhaAtual: create$6().required("Informe a Senha Atual."),
10369
12022
  senhaNova: create$6().required("Informe a Nova Senha."),
10370
12023
  senhaNovaConfirmar: create$6().required("Informe a Nova Senha.").oneOf([create$9("senhaNova")], "As senhas devem ser iguais.")
@@ -10382,7 +12035,7 @@ function AlterarSenha(props) {
10382
12035
  } = props;
10383
12036
  const { alterarSenha, isSubmitting } = _hooks.useCredentials.call(void 0, credentialsConfig);
10384
12037
  const { setValidationErrors, validationProps } = _hooks.useValidations.call(void 0, );
10385
- const { data, handleChange, setData, changeValue } = _hooks.useForm.call(void 0, defaultData);
12038
+ const { data, handleChange, setData, changeValue } = _hooks.useForm.call(void 0, defaultData2);
10386
12039
  const [ehSegura, setEhSegura] = _react.useState.call(void 0, false);
10387
12040
  const [error, setError] = _react.useState.call(void 0, null);
10388
12041
  _react.useEffect.call(void 0, () => {
@@ -10406,20 +12059,20 @@ function AlterarSenha(props) {
10406
12059
  async function handleAlterarSenha() {
10407
12060
  setValidationErrors(null);
10408
12061
  setError(null);
10409
- schema.validate(data, { abortEarly: false }).then(async () => {
12062
+ schema4.validate(data, { abortEarly: false }).then(async () => {
10410
12063
  const { senhaAtual: senhaAtual2, senhaNova } = data;
10411
12064
  try {
10412
12065
  const response = await alterarSenha(senhaAtual2, senhaNova, email);
10413
12066
  if (response) {
10414
12067
  if (onSuccess)
10415
12068
  onSuccess();
10416
- setData(defaultData);
12069
+ setData(defaultData2);
10417
12070
  }
10418
12071
  } catch (error2) {
10419
12072
  if (onFailed)
10420
12073
  onFailed(error2);
10421
12074
  if (_axios.isAxiosError.call(void 0, error2)) {
10422
- setError(_optionalChain([error2, 'access', _84 => _84.response, 'optionalAccess', _85 => _85.data, 'access', _86 => _86.message]));
12075
+ setError(_optionalChain([error2, 'access', _145 => _145.response, 'optionalAccess', _146 => _146.data, 'access', _147 => _147.message]));
10423
12076
  return;
10424
12077
  }
10425
12078
  setError("Ocorreu um erro ao tentar alterar a senha");
@@ -10431,40 +12084,40 @@ function AlterarSenha(props) {
10431
12084
  });
10432
12085
  }
10433
12086
  function tem8caracteres() {
10434
- return _optionalChain([data, 'optionalAccess', _87 => _87.senhaNova, 'access', _88 => _88.length]) >= 8;
12087
+ return _optionalChain([data, 'optionalAccess', _148 => _148.senhaNova, 'access', _149 => _149.length]) >= 8;
10435
12088
  }
10436
12089
  function temLetraMinuscula() {
10437
- if (_optionalChain([data, 'optionalAccess', _89 => _89.senhaNova])) {
10438
- const result = _optionalChain([data, 'optionalAccess', _90 => _90.senhaNova, 'access', _91 => _91.match, 'call', _92 => _92(/[a-z]/g)]);
12090
+ if (_optionalChain([data, 'optionalAccess', _150 => _150.senhaNova])) {
12091
+ const result = _optionalChain([data, 'optionalAccess', _151 => _151.senhaNova, 'access', _152 => _152.match, 'call', _153 => _153(/[a-z]/g)]);
10439
12092
  return Array.isArray(result) && result.length > 0;
10440
12093
  }
10441
12094
  return false;
10442
12095
  }
10443
12096
  function temLetraMaisucula() {
10444
- if (_optionalChain([data, 'optionalAccess', _93 => _93.senhaNova])) {
10445
- const result = _optionalChain([data, 'optionalAccess', _94 => _94.senhaNova, 'access', _95 => _95.match, 'call', _96 => _96(/[A-Z]/g)]);
12097
+ if (_optionalChain([data, 'optionalAccess', _154 => _154.senhaNova])) {
12098
+ const result = _optionalChain([data, 'optionalAccess', _155 => _155.senhaNova, 'access', _156 => _156.match, 'call', _157 => _157(/[A-Z]/g)]);
10446
12099
  return Array.isArray(result) && result.length > 0;
10447
12100
  }
10448
12101
  return false;
10449
12102
  }
10450
12103
  function temNumero() {
10451
- if (_optionalChain([data, 'optionalAccess', _97 => _97.senhaNova])) {
10452
- const result = _optionalChain([data, 'optionalAccess', _98 => _98.senhaNova, 'access', _99 => _99.match, 'call', _100 => _100(/\d/g)]);
12104
+ if (_optionalChain([data, 'optionalAccess', _158 => _158.senhaNova])) {
12105
+ const result = _optionalChain([data, 'optionalAccess', _159 => _159.senhaNova, 'access', _160 => _160.match, 'call', _161 => _161(/\d/g)]);
10453
12106
  return Array.isArray(result) && result.length > 0;
10454
12107
  }
10455
12108
  return false;
10456
12109
  }
10457
12110
  function temCaracterEspecial() {
10458
- if (_optionalChain([data, 'optionalAccess', _101 => _101.senhaNova])) {
10459
- const result = _optionalChain([data, 'optionalAccess', _102 => _102.senhaNova, 'access', _103 => _103.match, 'call', _104 => _104(/\W/g)]);
12111
+ if (_optionalChain([data, 'optionalAccess', _162 => _162.senhaNova])) {
12112
+ const result = _optionalChain([data, 'optionalAccess', _163 => _163.senhaNova, 'access', _164 => _164.match, 'call', _165 => _165(/\W/g)]);
10460
12113
  return Array.isArray(result) && result.length > 0;
10461
12114
  }
10462
12115
  return false;
10463
12116
  }
10464
12117
  function asSenhasSaoIguais() {
10465
- if (_optionalChain([data, 'optionalAccess', _105 => _105.senhaNova]) === "")
12118
+ if (_optionalChain([data, 'optionalAccess', _166 => _166.senhaNova]) === "")
10466
12119
  return false;
10467
- return _optionalChain([data, 'optionalAccess', _106 => _106.senhaNova]) === _optionalChain([data, 'optionalAccess', _107 => _107.senhaNovaConfirmar]);
12120
+ return _optionalChain([data, 'optionalAccess', _167 => _167.senhaNova]) === _optionalChain([data, 'optionalAccess', _168 => _168.senhaNovaConfirmar]);
10468
12121
  }
10469
12122
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog_default.Root, { open: isOpen, onClose: (_) => onClose(), maxWidth: "md", children: [
10470
12123
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog_default.Header, { children: [
@@ -10483,7 +12136,7 @@ function AlterarSenha(props) {
10483
12136
  {
10484
12137
  name: "senhaAtual",
10485
12138
  label: "Senha Atual",
10486
- value: _optionalChain([data, 'optionalAccess', _108 => _108.senhaAtual]) || "",
12139
+ value: _optionalChain([data, 'optionalAccess', _169 => _169.senhaAtual]) || "",
10487
12140
  onChange: handleChange,
10488
12141
  ...validationProps("senhaAtual")
10489
12142
  }
@@ -10505,7 +12158,7 @@ function AlterarSenha(props) {
10505
12158
  {
10506
12159
  name: "senhaNova",
10507
12160
  label: "Nova Senha",
10508
- value: _optionalChain([data, 'optionalAccess', _109 => _109.senhaNova]) || "",
12161
+ value: _optionalChain([data, 'optionalAccess', _170 => _170.senhaNova]) || "",
10509
12162
  onChange: handleChange,
10510
12163
  ...validationProps("senhaNova")
10511
12164
  }
@@ -10516,7 +12169,7 @@ function AlterarSenha(props) {
10516
12169
  {
10517
12170
  name: "senhaNovaConfirmar",
10518
12171
  label: "Confirmar Nova Senha",
10519
- value: _optionalChain([data, 'optionalAccess', _110 => _110.senhaNovaConfirmar]) || "",
12172
+ value: _optionalChain([data, 'optionalAccess', _171 => _171.senhaNovaConfirmar]) || "",
10520
12173
  onChange: handleChange,
10521
12174
  ...validationProps("senhaNovaConfirmar")
10522
12175
  }
@@ -10534,42 +12187,42 @@ function AlterarSenha(props) {
10534
12187
  ] }),
10535
12188
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Grid, { size: 12, children: [
10536
12189
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10537
- ValidatorMessage,
12190
+ ValidatorMessage2,
10538
12191
  {
10539
12192
  isValid: tem8caracteres(),
10540
12193
  message: "O tamanho m\xEDnimo da nova senha \xE9 de 8 caracteres"
10541
12194
  }
10542
12195
  ),
10543
12196
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10544
- ValidatorMessage,
12197
+ ValidatorMessage2,
10545
12198
  {
10546
12199
  isValid: temLetraMinuscula(),
10547
12200
  message: "A nova senha deve ter ao menos uma letra min\xFAscula"
10548
12201
  }
10549
12202
  ),
10550
12203
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10551
- ValidatorMessage,
12204
+ ValidatorMessage2,
10552
12205
  {
10553
12206
  isValid: temLetraMaisucula(),
10554
12207
  message: "A nova senha deve ter ao menos uma letra mai\xFAscula"
10555
12208
  }
10556
12209
  ),
10557
12210
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10558
- ValidatorMessage,
12211
+ ValidatorMessage2,
10559
12212
  {
10560
12213
  isValid: temNumero(),
10561
12214
  message: "A nova senha deve ter ao menos um n\xFAmero"
10562
12215
  }
10563
12216
  ),
10564
12217
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10565
- ValidatorMessage,
12218
+ ValidatorMessage2,
10566
12219
  {
10567
12220
  isValid: temCaracterEspecial(),
10568
12221
  message: "A nova senha deve ter ao menos um caracter especial"
10569
12222
  }
10570
12223
  ),
10571
12224
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10572
- ValidatorMessage,
12225
+ ValidatorMessage2,
10573
12226
  {
10574
12227
  isValid: asSenhasSaoIguais(),
10575
12228
  message: "A confirma\xE7\xE3o da nova senha deve ser igual \xE0 nova senha"
@@ -10595,11 +12248,11 @@ function AlterarSenha(props) {
10595
12248
 
10596
12249
  // src/MioAuth/components/LoginForm/index.tsx
10597
12250
 
10598
- var schema2 = create$3().shape({
12251
+ var schema5 = create$3().shape({
10599
12252
  email: create$6().required("Informe o e-mail"),
10600
12253
  password: create$6().required("Informe a senha")
10601
12254
  });
10602
- function LoginForm(props) {
12255
+ function LoginForm2(props) {
10603
12256
  const { onLoginSuccess, onLoginFailed, onOptionsClick, credentialsConfig } = props;
10604
12257
  const [email, setEmail] = _react.useState.call(void 0, "");
10605
12258
  const [password, setPassword] = _react.useState.call(void 0, "");
@@ -10612,7 +12265,7 @@ function LoginForm(props) {
10612
12265
  async function handleLogin() {
10613
12266
  setValidationErrors(null);
10614
12267
  setError(null);
10615
- schema2.validate({ email, password }, { abortEarly: false }).then(async () => {
12268
+ schema5.validate({ email, password }, { abortEarly: false }).then(async () => {
10616
12269
  setLoading(true);
10617
12270
  try {
10618
12271
  const loginResponse = await login(email, password);
@@ -10622,11 +12275,11 @@ function LoginForm(props) {
10622
12275
  } catch (err) {
10623
12276
  if (_axios.isAxiosError.call(void 0, err)) {
10624
12277
  const axiosError = err;
10625
- if (_optionalChain([axiosError, 'access', _111 => _111.response, 'optionalAccess', _112 => _112.data, 'access', _113 => _113.code]) === "E_FIRST_ACCESS") {
12278
+ if (_optionalChain([axiosError, 'access', _172 => _172.response, 'optionalAccess', _173 => _173.data, 'access', _174 => _174.code]) === "E_FIRST_ACCESS") {
10626
12279
  setExibirAlterarSenha(true);
10627
12280
  return;
10628
12281
  }
10629
- setError(_optionalChain([err, 'access', _114 => _114.response, 'optionalAccess', _115 => _115.data, 'access', _116 => _116.message]));
12282
+ setError(_optionalChain([err, 'access', _175 => _175.response, 'optionalAccess', _176 => _176.data, 'access', _177 => _177.message]));
10630
12283
  }
10631
12284
  onLoginFailed(err);
10632
12285
  }
@@ -10767,10 +12420,10 @@ function LoginForm(props) {
10767
12420
 
10768
12421
 
10769
12422
 
10770
- var schema3 = create$3().shape({
12423
+ var schema6 = create$3().shape({
10771
12424
  email: create$6().required("Informe o e-mail")
10772
12425
  });
10773
- function EsqueciSenhaForm(props) {
12426
+ function EsqueciSenhaForm2(props) {
10774
12427
  const { onLoginClick, credentialsConfig } = props;
10775
12428
  const [email, setEmail] = _react.useState.call(void 0, "");
10776
12429
  const [isSubmitting, setSubmitting] = _react.useState.call(void 0, false);
@@ -10780,13 +12433,13 @@ function EsqueciSenhaForm(props) {
10780
12433
  const { validationProps, setValidationErrors } = _hooks.useValidations.call(void 0, );
10781
12434
  async function handleRecuperarSenha() {
10782
12435
  setValidationErrors(null);
10783
- schema3.validate({ email }, { abortEarly: false }).then(async () => {
12436
+ schema6.validate({ email }, { abortEarly: false }).then(async () => {
10784
12437
  try {
10785
12438
  setSubmitting(true);
10786
12439
  await recuperarSenha(email);
10787
12440
  setSucessoRecuperarSenha(true);
10788
12441
  } catch (error2) {
10789
- setError(_optionalChain([error2, 'access', _117 => _117.response, 'optionalAccess', _118 => _118.data, 'access', _119 => _119.message]));
12442
+ setError(_optionalChain([error2, 'access', _178 => _178.response, 'optionalAccess', _179 => _179.data, 'access', _180 => _180.message]));
10790
12443
  } finally {
10791
12444
  setSubmitting(false);
10792
12445
  }
@@ -10873,19 +12526,19 @@ function EsqueciSenhaForm(props) {
10873
12526
 
10874
12527
 
10875
12528
 
10876
- function LicencaForm(props) {
12529
+ function LicencaForm2(props) {
10877
12530
  const { loginData, credentialsConfig, onLoginFailed, onLoginSuccess } = props;
10878
12531
  const [empresaId, setEmpresaId] = _react.useState.call(void 0, "");
10879
12532
  const { selecionarLicenca, isSubmitting } = _hooks.useCredentials.call(void 0, credentialsConfig);
10880
12533
  _react.useEffect.call(void 0, () => {
10881
- if (Array.isArray(_optionalChain([loginData, 'optionalAccess', _120 => _120.empresas]))) {
10882
- const empresa = _optionalChain([loginData, 'optionalAccess', _121 => _121.empresas, 'access', _122 => _122[0]]);
10883
- setEmpresaId(_optionalChain([empresa, 'optionalAccess', _123 => _123.uuid]));
12534
+ if (Array.isArray(_optionalChain([loginData, 'optionalAccess', _181 => _181.empresas]))) {
12535
+ const empresa = _optionalChain([loginData, 'optionalAccess', _182 => _182.empresas, 'access', _183 => _183[0]]);
12536
+ setEmpresaId(_optionalChain([empresa, 'optionalAccess', _184 => _184.uuid]));
10884
12537
  }
10885
12538
  }, [loginData]);
10886
12539
  async function handleSelecionarLicenca() {
10887
12540
  try {
10888
- const tokens = await selecionarLicenca(_optionalChain([loginData, 'optionalAccess', _124 => _124.token]), empresaId);
12541
+ const tokens = await selecionarLicenca(_optionalChain([loginData, 'optionalAccess', _185 => _185.token]), empresaId);
10889
12542
  if (tokens) {
10890
12543
  onLoginSuccess(tokens);
10891
12544
  } else {
@@ -10907,7 +12560,7 @@ function LicencaForm(props) {
10907
12560
  onChange: (e) => {
10908
12561
  setEmpresaId(e.target.value);
10909
12562
  },
10910
- children: _optionalChain([loginData, 'optionalAccess', _125 => _125.empresas, 'optionalAccess', _126 => _126.map, 'call', _127 => _127((empresa) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.MenuItem, { value: empresa.uuid, children: empresa.nome }, empresa.uuid))])
12563
+ children: _optionalChain([loginData, 'optionalAccess', _186 => _186.empresas, 'optionalAccess', _187 => _187.map, 'call', _188 => _188((empresa) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.MenuItem, { value: empresa.uuid, children: empresa.nome }, empresa.uuid))])
10911
12564
  }
10912
12565
  ),
10913
12566
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -10935,60 +12588,9 @@ function LicencaForm(props) {
10935
12588
 
10936
12589
 
10937
12590
 
10938
- var _HelpOutline = require('@mui/icons-material/HelpOutline'); var _HelpOutline2 = _interopRequireDefault(_HelpOutline);
10939
-
10940
-
10941
12591
 
10942
- // src/WhastappTextField/index.tsx
10943
12592
 
10944
- var _TextField = require('@mui/material/TextField'); var _TextField2 = _interopRequireDefault(_TextField);
10945
12593
 
10946
- var formatPhone = (value) => {
10947
- const digits = value.replace(/\D/g, "");
10948
- if (digits.length <= 2) {
10949
- return `(${digits}`;
10950
- }
10951
- if (digits.length <= 7) {
10952
- return `(${digits.slice(0, 2)}) ${digits.slice(2)}`;
10953
- }
10954
- if (digits.length <= 11) {
10955
- return `(${digits.slice(0, 2)}) ${digits.slice(2, 7)}-${digits.slice(7)}`;
10956
- }
10957
- return `(${digits.slice(0, 2)}) ${digits.slice(2, 7)}-${digits.slice(7, 11)}`;
10958
- };
10959
- function WhatsAppTextField(props) {
10960
- const { value: propValue, onChange: propOnChange, ...rest } = props;
10961
- const [internalValue, setInternalValue] = _react.useState.call(void 0, "");
10962
- const isControlled = propValue !== void 0;
10963
- const displayedValue = _react.useMemo.call(void 0, () => {
10964
- return isControlled ? formatPhone(propValue || "") : internalValue;
10965
- }, [propValue, internalValue, isControlled]);
10966
- const handleChange = (event) => {
10967
- const masked = formatPhone(event.target.value);
10968
- if (!isControlled) {
10969
- setInternalValue(masked);
10970
- }
10971
- if (propOnChange) {
10972
- const customEvent = {
10973
- ...event,
10974
- target: {
10975
- ...event.target,
10976
- value: masked
10977
- }
10978
- };
10979
- propOnChange(customEvent);
10980
- }
10981
- };
10982
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
10983
- _TextField2.default,
10984
- {
10985
- value: displayedValue,
10986
- onChange: handleChange,
10987
- inputProps: { maxLength: 15 },
10988
- ...rest
10989
- }
10990
- );
10991
- }
10992
12594
 
10993
12595
  // src/MioAuth/components/OtpForm/DialogVerificarOtp.tsx
10994
12596
 
@@ -10997,59 +12599,7 @@ function WhatsAppTextField(props) {
10997
12599
 
10998
12600
 
10999
12601
 
11000
- // src/VerificationCodeInput/index.tsx
11001
-
11002
-
11003
-
11004
- function VerificationCodeInput({
11005
- length = 6,
11006
- value,
11007
- onChange
11008
- }) {
11009
- const inputsRef = _react.useRef.call(void 0, []);
11010
- const handleChange = (index, digit) => {
11011
- const chars = "ABCDEF0123456789";
11012
- const cleanDigit = digit.toUpperCase().split("").find((char) => chars.includes(char)) || "";
11013
- const nextValue = value.split("");
11014
- nextValue[index] = cleanDigit;
11015
- const updatedValue = nextValue.join("");
11016
- onChange(updatedValue);
11017
- if (cleanDigit && index < length - 1) {
11018
- _optionalChain([inputsRef, 'access', _128 => _128.current, 'access', _129 => _129[index + 1], 'optionalAccess', _130 => _130.focus, 'call', _131 => _131()]);
11019
- }
11020
- };
11021
- const handleKeyDown = (index, event) => {
11022
- if (event.key === "Backspace" && !value[index] && index > 0) {
11023
- _optionalChain([inputsRef, 'access', _132 => _132.current, 'access', _133 => _133[index - 1], 'optionalAccess', _134 => _134.focus, 'call', _135 => _135()]);
11024
- }
11025
- };
11026
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Box, { display: "flex", gap: 1, children: Array.from({ length }).map((_, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11027
- _material.TextField,
11028
- {
11029
- autoFocus: i === 0,
11030
- inputRef: (el) => inputsRef.current[i] = el,
11031
- slotProps: {
11032
- htmlInput: {
11033
- maxLength: 1,
11034
- style: {
11035
- textAlign: "center",
11036
- fontSize: "24px",
11037
- width: "24px",
11038
- height: "36px"
11039
- }
11040
- }
11041
- },
11042
- value: value[i] || "",
11043
- onChange: (e) => handleChange(i, e.target.value),
11044
- onKeyDown: (e) => handleKeyDown(i, e)
11045
- },
11046
- i
11047
- )) });
11048
- }
11049
-
11050
- // src/MioAuth/components/OtpForm/DialogVerificarOtp.tsx
11051
-
11052
- function DialogVerificarOtp(props) {
12602
+ function DialogVerificarOtp2(props) {
11053
12603
  const { open, onClose, payload, onLoginSuccess, credentialsConfig } = props;
11054
12604
  const [code, setCode] = _react.useState.call(void 0, "");
11055
12605
  const [error, setError] = _react.useState.call(void 0, false);
@@ -11138,17 +12688,17 @@ function DialogVerificarOtp(props) {
11138
12688
 
11139
12689
  // src/MioAuth/components/OtpForm/index.tsx
11140
12690
 
11141
- var contatoSchema = create$3().shape({
11142
- contato: create$6().when("$tipo", ([tipo], schema6) => {
11143
- return tipo === "otp-email" ? schema6.email("E-mail inv\xE1lido").required("Informe o e-mail") : schema6.matches(/^\+?[1-9]\d{7,14}$/, "N\xFAmero de WhatsApp inv\xE1lido").required("Informe o WhatsApp");
12691
+ var contatoSchema2 = create$3().shape({
12692
+ contato: create$6().when("$tipo", ([tipo], schema9) => {
12693
+ return tipo === "otp-email" ? schema9.email("E-mail inv\xE1lido").required("Informe o e-mail") : schema9.matches(/^\+?[1-9]\d{7,14}$/, "N\xFAmero de WhatsApp inv\xE1lido").required("Informe o WhatsApp");
11144
12694
  })
11145
12695
  });
11146
- function OtpForm(props) {
12696
+ function OtpForm2(props) {
11147
12697
  const { tipo, credentialsConfig, onLoginSuccess, onLoginClick } = props;
11148
12698
  const [isLoading, setLoading] = _react.useState.call(void 0, false);
11149
12699
  const [error, setError] = _react.useState.call(void 0, false);
11150
12700
  const { gerarOtpVerificationCode } = _hooks.useCredentials.call(void 0, credentialsConfig);
11151
- const { handleChange, changeValue, data, validate, validationErrors } = _hooks.useForm.call(void 0, { contato: "" }, contatoSchema);
12701
+ const { handleChange, changeValue, data, validate, validationErrors } = _hooks.useForm.call(void 0, { contato: "" }, contatoSchema2);
11152
12702
  const [isOpenVerificar, setOpenVerificar] = _react.useState.call(void 0, false);
11153
12703
  const handleSubmit = async (e) => {
11154
12704
  e.preventDefault();
@@ -11251,7 +12801,7 @@ function OtpForm(props) {
11251
12801
  error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Alert, { severity: "error", children: error })
11252
12802
  ] }) }),
11253
12803
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11254
- DialogVerificarOtp,
12804
+ DialogVerificarOtp2,
11255
12805
  {
11256
12806
  onLoginSuccess,
11257
12807
  open: isOpenVerificar,
@@ -11270,14 +12820,14 @@ function OtpForm(props) {
11270
12820
 
11271
12821
  // src/MioAuth/components/LoginSection/index.tsx
11272
12822
 
11273
- var pageLabelMap = {
12823
+ var pageLabelMap2 = {
11274
12824
  login: "Acesse sua conta",
11275
12825
  licensa: "Selecione a licen\xE7a",
11276
12826
  "esqueci-senha": "Recupere a sua senha",
11277
12827
  "otp-email": "Entrar com senha tempor\xE1ria (E-mail)",
11278
12828
  "otp-whatsapp": "Entrar com senha tempor\xE1ria (WhatsApp)"
11279
12829
  };
11280
- function LoginSection(props) {
12830
+ function LoginSection2(props) {
11281
12831
  const {
11282
12832
  credentialsConfig,
11283
12833
  onLoginSuccess,
@@ -11297,10 +12847,10 @@ function LoginSection(props) {
11297
12847
  }, [isAuthenticated]);
11298
12848
  async function handleLoginSuccess(_loginData) {
11299
12849
  try {
11300
- if (Array.isArray(_optionalChain([_loginData, 'optionalAccess', _136 => _136.empresas]))) {
11301
- if (_optionalChain([_loginData, 'optionalAccess', _137 => _137.empresas, 'access', _138 => _138.length]) === 1) {
12850
+ if (Array.isArray(_optionalChain([_loginData, 'optionalAccess', _189 => _189.empresas]))) {
12851
+ if (_optionalChain([_loginData, 'optionalAccess', _190 => _190.empresas, 'access', _191 => _191.length]) === 1) {
11302
12852
  const tokens = await selecionarLicenca(
11303
- _optionalChain([_loginData, 'optionalAccess', _139 => _139.token]),
12853
+ _optionalChain([_loginData, 'optionalAccess', _192 => _192.token]),
11304
12854
  _loginData.empresas[0].uuid
11305
12855
  );
11306
12856
  if (tokens) {
@@ -11326,12 +12876,12 @@ function LoginSection(props) {
11326
12876
  function handleExibirLogin() {
11327
12877
  setView("login");
11328
12878
  }
11329
- const pageLabel = pageLabelMap[view];
12879
+ const pageLabel = pageLabelMap2[view];
11330
12880
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { children: [
11331
12881
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Header, { label: appName, subTitle: pageLabel }),
11332
12882
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { marginTop: 2 }, children: [
11333
12883
  view === "login" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11334
- LoginForm,
12884
+ LoginForm2,
11335
12885
  {
11336
12886
  credentialsConfig,
11337
12887
  onLoginSuccess: handleLoginSuccess,
@@ -11340,7 +12890,7 @@ function LoginSection(props) {
11340
12890
  }
11341
12891
  ),
11342
12892
  view === "licensa" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11343
- LicencaForm,
12893
+ LicencaForm2,
11344
12894
  {
11345
12895
  loginData,
11346
12896
  credentialsConfig,
@@ -11349,14 +12899,14 @@ function LoginSection(props) {
11349
12899
  }
11350
12900
  ),
11351
12901
  view === "esqueci-senha" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11352
- EsqueciSenhaForm,
12902
+ EsqueciSenhaForm2,
11353
12903
  {
11354
12904
  onLoginClick: handleExibirLogin,
11355
12905
  credentialsConfig
11356
12906
  }
11357
12907
  ),
11358
12908
  view === "otp-email" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11359
- OtpForm,
12909
+ OtpForm2,
11360
12910
  {
11361
12911
  onLoginClick: handleExibirLogin,
11362
12912
  onLoginSuccess: handleLoginSuccess,
@@ -11365,7 +12915,7 @@ function LoginSection(props) {
11365
12915
  }
11366
12916
  ),
11367
12917
  view === "otp-whatsapp" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11368
- OtpForm,
12918
+ OtpForm2,
11369
12919
  {
11370
12920
  onLoginClick: handleExibirLogin,
11371
12921
  onLoginSuccess: handleLoginSuccess,
@@ -11378,10 +12928,10 @@ function LoginSection(props) {
11378
12928
  }
11379
12929
 
11380
12930
  // src/MioAuth/components/DefaultBanner/index.tsx
11381
- var _ArrowRight = require('@mui/icons-material/ArrowRight'); var _ArrowRight2 = _interopRequireDefault(_ArrowRight);
11382
12931
 
11383
12932
 
11384
- function DefaultBanner() {
12933
+
12934
+ function DefaultBanner2() {
11385
12935
  const theme2 = _material.useTheme.call(void 0, );
11386
12936
  const fullScreen = _material.useMediaQuery.call(void 0, theme2.breakpoints.up("md"));
11387
12937
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -11481,7 +13031,7 @@ function DefaultBanner() {
11481
13031
 
11482
13032
  // src/MioAuth/index.tsx
11483
13033
 
11484
- function LoginContainer({ children }) {
13034
+ function LoginContainer2({ children }) {
11485
13035
  const theme2 = _material.useTheme.call(void 0, );
11486
13036
  const fullScreen = _material.useMediaQuery.call(void 0, theme2.breakpoints.up("md"));
11487
13037
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
@@ -11522,8 +13072,8 @@ function LoginContainer({ children }) {
11522
13072
  function MioAuth(props) {
11523
13073
  const { banner, loginSection } = props;
11524
13074
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { component: "main", direction: "row", height: "100vh", children: [
11525
- banner ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BannerSection, { children: banner }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DefaultBanner, {}),
11526
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoginContainer, { children: loginSection ? loginSection : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoginSection, { ...props }) })
13075
+ banner ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BannerSection, { children: banner }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DefaultBanner2, {}),
13076
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoginContainer2, { children: loginSection ? loginSection : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoginSection2, { ...props }) })
11527
13077
  ] });
11528
13078
  }
11529
13079
 
@@ -11658,8 +13208,8 @@ var StyledMuiMenuItem = _styles.styled.call(void 0,
11658
13208
  fontSize: "24px"
11659
13209
  }
11660
13210
  }));
11661
- var MenuItem7 = (props) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, StyledMuiMenuItem, { ...props });
11662
- var MenuItem_default = MenuItem7;
13211
+ var MenuItem8 = (props) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, StyledMuiMenuItem, { ...props });
13212
+ var MenuItem_default = MenuItem8;
11663
13213
 
11664
13214
  // src/DrawerMenu/components/FullMenu/components/FullMenuItem/index.tsx
11665
13215
 
@@ -11669,7 +13219,7 @@ function FullMenuItem2(props) {
11669
13219
  if (!menuItem.visible)
11670
13220
  return null;
11671
13221
  const isExpandable = Boolean(
11672
- _optionalChain([menuItem, 'optionalAccess', _140 => _140.items]) && _optionalChain([menuItem, 'optionalAccess', _141 => _141.items, 'access', _142 => _142.length]) > 0
13222
+ _optionalChain([menuItem, 'optionalAccess', _193 => _193.items]) && _optionalChain([menuItem, 'optionalAccess', _194 => _194.items, 'access', _195 => _195.length]) > 0
11673
13223
  );
11674
13224
  function toggleExpand() {
11675
13225
  setExpanded(!expanded);
@@ -11679,7 +13229,7 @@ function FullMenuItem2(props) {
11679
13229
  MenuItem_default,
11680
13230
  {
11681
13231
  onClick: () => {
11682
- if (_optionalChain([menuItem, 'optionalAccess', _143 => _143.link])) {
13232
+ if (_optionalChain([menuItem, 'optionalAccess', _196 => _196.link])) {
11683
13233
  onMenuClick(menuItem.link);
11684
13234
  return;
11685
13235
  }
@@ -11694,14 +13244,14 @@ function FullMenuItem2(props) {
11694
13244
  ]
11695
13245
  }
11696
13246
  ),
11697
- _optionalChain([menuItem, 'optionalAccess', _144 => _144.items]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Collapse, { in: expanded, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
13247
+ _optionalChain([menuItem, 'optionalAccess', _197 => _197.items]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Collapse, { in: expanded, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11698
13248
  FullMenu,
11699
13249
  {
11700
13250
  activeMenu,
11701
13251
  sx: {
11702
13252
  pl: (theme2) => theme2.spacing(1.5)
11703
13253
  },
11704
- menus: _optionalChain([menuItem, 'optionalAccess', _145 => _145.items]) || [],
13254
+ menus: _optionalChain([menuItem, 'optionalAccess', _198 => _198.items]) || [],
11705
13255
  onMenuClick
11706
13256
  }
11707
13257
  ) })
@@ -11749,38 +13299,38 @@ function MinMenu(props) {
11749
13299
  MenuItem_default,
11750
13300
  {
11751
13301
  onMouseEnter: (e) => {
11752
- if (!_optionalChain([menuItem, 'optionalAccess', _146 => _146.link])) {
13302
+ if (!_optionalChain([menuItem, 'optionalAccess', _199 => _199.link])) {
11753
13303
  handleOpen(e, menuItem.id, menuItem.items);
11754
13304
  }
11755
13305
  },
11756
13306
  onMouseLeave: () => {
11757
- if (!_optionalChain([menuItem, 'optionalAccess', _147 => _147.link])) {
13307
+ if (!_optionalChain([menuItem, 'optionalAccess', _200 => _200.link])) {
11758
13308
  handleClose();
11759
13309
  }
11760
13310
  },
11761
13311
  onClick: () => {
11762
- if (_optionalChain([menuItem, 'optionalAccess', _148 => _148.link])) {
13312
+ if (_optionalChain([menuItem, 'optionalAccess', _201 => _201.link])) {
11763
13313
  onMenuClick(menuItem.link);
11764
13314
  }
11765
13315
  },
11766
13316
  selected: activeMenu === menuItem.link,
11767
13317
  children: [
11768
13318
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.ListItemIcon, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Icon, { children: menuItem.icon }) }),
11769
- _optionalChain([opened, 'optionalAccess', _149 => _149.id]) === menuItem.id && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
13319
+ _optionalChain([opened, 'optionalAccess', _202 => _202.id]) === menuItem.id && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11770
13320
  _material.Popper,
11771
13321
  {
11772
13322
  sx: {
11773
13323
  zIndex: 999999
11774
13324
  },
11775
- anchorEl: _optionalChain([opened, 'optionalAccess', _150 => _150.element]),
11776
- open: Boolean(_optionalChain([opened, 'optionalAccess', _151 => _151.element])),
13325
+ anchorEl: _optionalChain([opened, 'optionalAccess', _203 => _203.element]),
13326
+ open: Boolean(_optionalChain([opened, 'optionalAccess', _204 => _204.element])),
11777
13327
  placement: "right-start",
11778
13328
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11779
13329
  FullMenu,
11780
13330
  {
11781
13331
  activeMenu,
11782
13332
  onMenuClick,
11783
- menus: _optionalChain([menuItem, 'optionalAccess', _152 => _152.items]) || [],
13333
+ menus: _optionalChain([menuItem, 'optionalAccess', _205 => _205.items]) || [],
11784
13334
  sx: {
11785
13335
  minWidth: "240px",
11786
13336
  backgroundColor: theme_default.palette.background.paper,
@@ -11897,7 +13447,7 @@ function Avatar(props) {
11897
13447
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
11898
13448
  _Avatar2.default,
11899
13449
  {
11900
- src: _optionalChain([user, 'optionalAccess', _153 => _153.avatarUrl]),
13450
+ src: _optionalChain([user, 'optionalAccess', _206 => _206.avatarUrl]),
11901
13451
  sx: { width: 64, height: 64, margin: "auto", mb: 2 },
11902
13452
  ...props
11903
13453
  }
@@ -12008,7 +13558,7 @@ var AvatarUploader = ({ onSave, src }) => {
12008
13558
  }
12009
13559
  };
12010
13560
  const handleFileChange = (event) => {
12011
- const file = _optionalChain([event, 'access', _154 => _154.target, 'access', _155 => _155.files, 'optionalAccess', _156 => _156[0]]);
13561
+ const file = _optionalChain([event, 'access', _207 => _207.target, 'access', _208 => _208.files, 'optionalAccess', _209 => _209[0]]);
12012
13562
  if (!file)
12013
13563
  return;
12014
13564
  const reader = new FileReader();
@@ -12089,14 +13639,14 @@ var AvatarUploader_default = AvatarUploader;
12089
13639
 
12090
13640
  // src/Profile/MinhaConta.tsx
12091
13641
 
12092
- var schema4 = create$3().shape({
13642
+ var schema7 = create$3().shape({
12093
13643
  name: create$6().required("Informe o nome")
12094
13644
  });
12095
13645
  function MinhaConta(props) {
12096
13646
  const { usuario, credentialsConfig, onUploadComplete } = props;
12097
13647
  const { data, setData, handleChange, validate, validationErrors } = _hooks.useForm.call(void 0,
12098
13648
  usuario,
12099
- schema4
13649
+ schema7
12100
13650
  );
12101
13651
  const [error, setErro] = _react.useState.call(void 0, false);
12102
13652
  const [isAlterando, setAlterando] = _react.useState.call(void 0, false);
@@ -12137,7 +13687,7 @@ function MinhaConta(props) {
12137
13687
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
12138
13688
  AvatarUploader_default,
12139
13689
  {
12140
- src: _optionalChain([data, 'optionalAccess', _157 => _157.avatarUrl]),
13690
+ src: _optionalChain([data, 'optionalAccess', _210 => _210.avatarUrl]),
12141
13691
  onSave: (croppedImage) => {
12142
13692
  try {
12143
13693
  uploadAvatar(croppedImage);
@@ -12163,7 +13713,7 @@ function MinhaConta(props) {
12163
13713
  disabled: true,
12164
13714
  fullWidth: true,
12165
13715
  label: "E-mail",
12166
- value: _optionalChain([data, 'optionalAccess', _158 => _158.email]) || ""
13716
+ value: _optionalChain([data, 'optionalAccess', _211 => _211.email]) || ""
12167
13717
  }
12168
13718
  ) }),
12169
13719
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid, { size: { xl: 4, lg: 4, md: 4, sm: 12, xs: 12 }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -12172,7 +13722,7 @@ function MinhaConta(props) {
12172
13722
  name: "name",
12173
13723
  fullWidth: true,
12174
13724
  label: "Nome",
12175
- value: _optionalChain([data, 'optionalAccess', _159 => _159.name]) || "",
13725
+ value: _optionalChain([data, 'optionalAccess', _212 => _212.name]) || "",
12176
13726
  onChange: handleChange,
12177
13727
  ...validationErrors("name")
12178
13728
  }
@@ -12183,7 +13733,7 @@ function MinhaConta(props) {
12183
13733
  name: "surname",
12184
13734
  fullWidth: true,
12185
13735
  label: "Sobrenome",
12186
- value: _optionalChain([data, 'optionalAccess', _160 => _160.surname]) || "",
13736
+ value: _optionalChain([data, 'optionalAccess', _213 => _213.surname]) || "",
12187
13737
  onChange: handleChange
12188
13738
  }
12189
13739
  ) })
@@ -12266,7 +13816,7 @@ function DialogVerificarWhastapp(props) {
12266
13816
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body1", sx: { fontSize: "10pt" }, children: [
12267
13817
  "Enviamos um c\xF3digo via WhatsApp para +55",
12268
13818
  " ",
12269
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "b", { children: `(${_optionalChain([payload, 'optionalAccess', _161 => _161.whatsappNumber, 'optionalAccess', _162 => _162.slice, 'call', _163 => _163(0, 2)])}) ${_optionalChain([payload, 'optionalAccess', _164 => _164.whatsappNumber, 'optionalAccess', _165 => _165.slice, 'call', _166 => _166(2, 7)])}-${_optionalChain([payload, 'optionalAccess', _167 => _167.whatsappNumber, 'optionalAccess', _168 => _168.slice, 'call', _169 => _169(7)])}` }),
13819
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "b", { children: `(${_optionalChain([payload, 'optionalAccess', _214 => _214.whatsappNumber, 'optionalAccess', _215 => _215.slice, 'call', _216 => _216(0, 2)])}) ${_optionalChain([payload, 'optionalAccess', _217 => _217.whatsappNumber, 'optionalAccess', _218 => _218.slice, 'call', _219 => _219(2, 7)])}-${_optionalChain([payload, 'optionalAccess', _220 => _220.whatsappNumber, 'optionalAccess', _221 => _221.slice, 'call', _222 => _222(7)])}` }),
12270
13820
  ". ",
12271
13821
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {}),
12272
13822
  "Digite o c\xF3digo abaixo para confirmar que este n\xFAmero \xE9 seu."
@@ -12301,7 +13851,7 @@ function DialogVerificarWhastapp(props) {
12301
13851
 
12302
13852
  // src/Profile/LoginSeguranca.tsx
12303
13853
 
12304
- var schema5 = create$3().shape({
13854
+ var schema8 = create$3().shape({
12305
13855
  whatsappNumber: create$6().required("Informe o n\xFAmero do whastapp").length(15)
12306
13856
  });
12307
13857
  function LoginSeguranca(props) {
@@ -12366,7 +13916,7 @@ function LoginSeguranca(props) {
12366
13916
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
12367
13917
  WhatsAppTextField,
12368
13918
  {
12369
- disabled: Boolean(_optionalChain([data, 'optionalAccess', _170 => _170.whatsappVerifiedAt])),
13919
+ disabled: Boolean(_optionalChain([data, 'optionalAccess', _223 => _223.whatsappVerifiedAt])),
12370
13920
  fullWidth: false,
12371
13921
  name: "whatsappNumber",
12372
13922
  label: "Whastapp",
@@ -12550,5 +14100,9 @@ var _CssBaseline = require('@mui/material/CssBaseline'); var _CssBaseline2 = _in
12550
14100
 
12551
14101
 
12552
14102
 
12553
- exports.AlterarLicenca = AlterarLicenca; exports.AlterarSenha = AlterarSenha; exports.Autocomplete = Autocomplete; exports.Avatar = Avatar; exports.Breadcrumbs = Breadcrumbs; exports.Button = Button_default; exports.ButtonContainer = ButtonContainer; exports.ButtonGroup = ButtonGroup_default; exports.CEPTextField = CEPTextField; exports.Card = Card_default; exports.Checkbox = Checkbox; exports.ColorsGrid = ColorsGrid; exports.Content = Content2; exports.ContentTitle = ContentTitle_default; exports.CssBaseline = _CssBaseline2.default; exports.CurrencyCellStyle = CurrencyCellStyle; exports.CurrencyTextField = CurrencyTextField_default; exports.DataTable = DataTable_default; exports.DataTableOptions = DataTableOptions; exports.DatePicker = DatePicker; exports.DatePickerProvider = DatePickerProvider; exports.DateRangePicker = DateRangePicker; exports.Dialog = Dialog_default; exports.DocumentoTextField = DocumentoTextField; exports.DrawerMenu = DrawerMenu; exports.Editable = Editable; exports.Filter = Filter_default; exports.FilterApiContext = FilterApiContext; exports.FilterContainer = FilterContainer; exports.FilterControl = FilterControl; exports.FilterDataContext = FilterDataContext; exports.FilterProvider = FilterProvider; exports.Flag = Flag; exports.Header = Header_default; exports.Icon = Icon_default; exports.LabelValue = LabelValue; exports.List = List_default; exports.LucidIcon = LucidIcon_default; exports.Menu = Menu_default; exports.MioAuth = MioAuth; exports.NotaVersao = NotaVersao; exports.OptionStyles = OptionStyles; exports.Page = Page_default; exports.PageTitle = PageTitle; exports.PasswordTextField = PasswordTextField; exports.Popover = Popover_default; exports.Profile = Profile; exports.SearchTextField = SearchTextField; exports.Surface = Surface; exports.TelefoneTextField = TelefoneTextField; exports.TextField = TextField5; exports.ThemeProvider = _styles.ThemeProvider; exports.Title = Title4; exports.Tooltip = Tooltip_default; exports.Transporter = Transporter_default; exports.createTheme = _styles.createTheme; exports.renderMenuItems = renderMenuItems; exports.styled = _styles.styled; exports.theme = theme_default; exports.useDialogs = _core.useDialogs; exports.useFilter = useFilter; exports.useFilterApi = useFilterApi3; exports.useMenu = useMenu; exports.useTheme = _styles.useTheme; exports.useTransporter = useTransporter;
14103
+
14104
+
14105
+
14106
+
14107
+ exports.AlterarLicenca = AlterarLicenca; exports.AlterarSenha = AlterarSenha; exports.AlterarSenhaV2 = AlterarSenhaV2; exports.Auth = Auth; exports.Autocomplete = Autocomplete; exports.Avatar = Avatar; exports.Breadcrumbs = Breadcrumbs; exports.Button = Button_default; exports.ButtonContainer = ButtonContainer; exports.ButtonGroup = ButtonGroup_default; exports.CEPTextField = CEPTextField; exports.Card = Card_default; exports.Checkbox = Checkbox; exports.ColorsGrid = ColorsGrid; exports.Content = Content2; exports.ContentTitle = ContentTitle_default; exports.CredentialsProvider = CredentialsProvider; exports.CssBaseline = _CssBaseline2.default; exports.CurrencyCellStyle = CurrencyCellStyle; exports.CurrencyTextField = CurrencyTextField_default; exports.DataTable = DataTable_default; exports.DataTableOptions = DataTableOptions; exports.DatePicker = DatePicker; exports.DatePickerProvider = DatePickerProvider; exports.DateRangePicker = DateRangePicker; exports.Dialog = Dialog_default; exports.DocumentoTextField = DocumentoTextField; exports.DrawerMenu = DrawerMenu; exports.Editable = Editable; exports.Filter = Filter_default; exports.FilterApiContext = FilterApiContext; exports.FilterContainer = FilterContainer; exports.FilterControl = FilterControl; exports.FilterDataContext = FilterDataContext; exports.FilterProvider = FilterProvider; exports.Flag = Flag; exports.Header = Header_default; exports.Icon = Icon_default; exports.LabelValue = LabelValue; exports.List = List_default; exports.LucidIcon = LucidIcon_default; exports.Menu = Menu_default; exports.MioAuth = MioAuth; exports.NotaVersao = NotaVersao; exports.OptionStyles = OptionStyles; exports.Page = Page_default; exports.PageTitle = PageTitle; exports.PasswordTextField = PasswordTextField; exports.Popover = Popover_default; exports.Profile = Profile; exports.SearchTextField = SearchTextField; exports.Surface = Surface; exports.TelefoneTextField = TelefoneTextField; exports.TextField = TextField5; exports.ThemeProvider = _styles.ThemeProvider; exports.Title = Title4; exports.Tooltip = Tooltip_default; exports.Transporter = Transporter_default; exports.createTheme = _styles.createTheme; exports.renderMenuItems = renderMenuItems; exports.styled = _styles.styled; exports.theme = theme_default; exports.useCredentialsContext = useCredentialsContext; exports.useDialogs = _core.useDialogs; exports.useFilter = useFilter; exports.useFilterApi = useFilterApi3; exports.useMenu = useMenu; exports.useTheme = _styles.useTheme; exports.useTransporter = useTransporter;
12554
14108
  //# sourceMappingURL=index.js.map