@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.d.ts +57 -2
- package/dist/index.js +1833 -279
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2298 -744
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -2572,7 +2572,7 @@ function PageTitle(props) {
|
|
|
2572
2572
|
}
|
|
2573
2573
|
|
|
2574
2574
|
// src/MioAuth/index.tsx
|
|
2575
|
-
import { Stack as
|
|
2575
|
+
import { Stack as Stack52, Typography as Typography34, useMediaQuery as useMediaQuery10, useTheme as useTheme16 } from "@mui/material";
|
|
2576
2576
|
|
|
2577
2577
|
// src/MioAuth/components/BannerSection/index.tsx
|
|
2578
2578
|
import { Stack as Stack7, useMediaQuery as useMediaQuery2, useTheme } from "@mui/material";
|
|
@@ -2602,7 +2602,7 @@ function BannerSection(props) {
|
|
|
2602
2602
|
}
|
|
2603
2603
|
|
|
2604
2604
|
// src/MioAuth/components/LoginSection/index.tsx
|
|
2605
|
-
import { Box as
|
|
2605
|
+
import { Box as Box26, Stack as Stack50, useMediaQuery as useMediaQuery8, useTheme as useTheme14 } from "@mui/material";
|
|
2606
2606
|
|
|
2607
2607
|
// src/MioAuth/components/Header/index.tsx
|
|
2608
2608
|
import { Stack as Stack8, Typography as Typography6 } from "@mui/material";
|
|
@@ -2637,15 +2637,15 @@ function Header(props) {
|
|
|
2637
2637
|
}
|
|
2638
2638
|
|
|
2639
2639
|
// src/MioAuth/components/LoginForm/index.tsx
|
|
2640
|
-
import { useState as
|
|
2640
|
+
import { useState as useState27 } from "react";
|
|
2641
2641
|
import {
|
|
2642
2642
|
useCredentials as useCredentials2,
|
|
2643
|
-
useValidations as
|
|
2643
|
+
useValidations as useValidations5
|
|
2644
2644
|
} from "@data-c/hooks";
|
|
2645
|
-
import { Alert as
|
|
2646
|
-
import { isAxiosError as
|
|
2647
|
-
import
|
|
2648
|
-
import
|
|
2645
|
+
import { Alert as Alert9, Divider as Divider6, Stack as Stack47, TextField as TextField12, Typography as Typography29 } from "@mui/material";
|
|
2646
|
+
import { isAxiosError as isAxiosError4 } from "axios";
|
|
2647
|
+
import Mail2 from "@mui/icons-material/Mail";
|
|
2648
|
+
import WhatsApp2 from "@mui/icons-material/WhatsApp";
|
|
2649
2649
|
|
|
2650
2650
|
// ../../node_modules/yup/index.esm.js
|
|
2651
2651
|
var import_property_expr = __toESM(require_property_expr());
|
|
@@ -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,
|
|
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(
|
|
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
|
|
2893
|
-
if (
|
|
2894
|
-
|
|
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(
|
|
2897
|
+
if (!isSchema(schema9))
|
|
2898
2898
|
throw new TypeError("conditions must return a schema object");
|
|
2899
|
-
return
|
|
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:
|
|
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 =
|
|
2986
|
-
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:
|
|
2997
|
+
label: schema9.spec.label,
|
|
2998
2998
|
path: overrides.path || path,
|
|
2999
|
-
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:
|
|
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(
|
|
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:
|
|
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
|
-
|
|
3078
|
+
schema9 = schema9.resolve({
|
|
3079
3079
|
context,
|
|
3080
3080
|
parent,
|
|
3081
3081
|
value
|
|
3082
3082
|
});
|
|
3083
|
-
let isTuple =
|
|
3083
|
+
let isTuple = schema9.type === "tuple";
|
|
3084
3084
|
let idx = isArray ? parseInt(part, 10) : 0;
|
|
3085
|
-
if (
|
|
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
|
-
|
|
3093
|
+
schema9 = isTuple ? schema9.spec.types[idx] : schema9.innerType;
|
|
3094
3094
|
}
|
|
3095
3095
|
if (!isArray) {
|
|
3096
|
-
if (!
|
|
3097
|
-
throw new Error(`The schema does not contain the path: ${path}. (failed at: ${lastPartDebug} which is a 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
|
-
|
|
3100
|
+
schema9 = schema9.fields[part];
|
|
3101
3101
|
}
|
|
3102
3102
|
lastPart = part;
|
|
3103
3103
|
lastPartDebug = isBracket ? "[" + _part + "]" : "." + _part;
|
|
3104
3104
|
});
|
|
3105
3105
|
return {
|
|
3106
|
-
schema:
|
|
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(
|
|
3315
|
-
if (!
|
|
3314
|
+
concat(schema9) {
|
|
3315
|
+
if (!schema9 || schema9 === this)
|
|
3316
3316
|
return this;
|
|
3317
|
-
if (
|
|
3318
|
-
throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${
|
|
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 =
|
|
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(
|
|
3325
|
-
combined._blacklist = base._blacklist.merge(
|
|
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
|
-
|
|
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
|
|
3348
|
-
if (
|
|
3349
|
-
let conditions =
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
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
|
|
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
|
|
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 :
|
|
3519
|
-
return new Promise((resolve, reject) =>
|
|
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
|
|
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 :
|
|
3537
|
-
|
|
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
|
|
3576
|
-
return
|
|
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
|
|
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
|
|
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:
|
|
3849
|
+
schema: schema9
|
|
3850
3850
|
} = getIn(this, path, value, options.context);
|
|
3851
|
-
return
|
|
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((
|
|
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((
|
|
4046
|
-
|
|
4047
|
-
return
|
|
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, _,
|
|
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
|
|
4449
|
+
return schema9.isType(parsed) ? parsed : value;
|
|
4450
4450
|
};
|
|
4451
|
-
function deepPartial(
|
|
4452
|
-
if ("fields" in
|
|
4451
|
+
function deepPartial(schema9) {
|
|
4452
|
+
if ("fields" in schema9) {
|
|
4453
4453
|
const partial = {};
|
|
4454
|
-
for (const [key2, fieldSchema] of Object.entries(
|
|
4454
|
+
for (const [key2, fieldSchema] of Object.entries(schema9.fields)) {
|
|
4455
4455
|
partial[key2] = deepPartial(fieldSchema);
|
|
4456
4456
|
}
|
|
4457
|
-
return
|
|
4457
|
+
return schema9.setFields(partial);
|
|
4458
4458
|
}
|
|
4459
|
-
if (
|
|
4460
|
-
const nextArray =
|
|
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 (
|
|
4466
|
-
return
|
|
4467
|
-
types:
|
|
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
|
|
4471
|
-
return
|
|
4470
|
+
if ("optional" in schema9) {
|
|
4471
|
+
return schema9.optional();
|
|
4472
4472
|
}
|
|
4473
|
-
return
|
|
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(
|
|
4608
|
-
let next = super.concat(
|
|
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, ...
|
|
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,
|
|
4664
|
-
partial[key2] = "optional" in
|
|
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(
|
|
4875
|
-
let next = super.concat(
|
|
4874
|
+
concat(schema9) {
|
|
4875
|
+
let next = super.concat(schema9);
|
|
4876
4876
|
next.innerType = this.innerType;
|
|
4877
|
-
if (
|
|
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(
|
|
4881
|
-
) :
|
|
4880
|
+
next.innerType.concat(schema9.innerType)
|
|
4881
|
+
) : schema9.innerType;
|
|
4882
4882
|
return next;
|
|
4883
4883
|
}
|
|
4884
|
-
of(
|
|
4884
|
+
of(schema9) {
|
|
4885
4885
|
let next = this.clone();
|
|
4886
|
-
if (!isSchema(
|
|
4887
|
-
throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: " + printValue(
|
|
4888
|
-
next.innerType =
|
|
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:
|
|
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((
|
|
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
|
|
5049
|
+
return schema9.describe(innerOptions);
|
|
5050
5050
|
});
|
|
5051
5051
|
return base;
|
|
5052
5052
|
}
|
|
@@ -5054,23 +5054,23 @@ var TupleSchema = class extends Schema {
|
|
|
5054
5054
|
create$1.prototype = TupleSchema.prototype;
|
|
5055
5055
|
|
|
5056
5056
|
// src/AlterarSenha/index.tsx
|
|
5057
|
-
import
|
|
5058
|
-
import { Alert as
|
|
5059
|
-
import { useState as
|
|
5057
|
+
import InfoOutlined2 from "@mui/icons-material/InfoOutlined";
|
|
5058
|
+
import { Alert as Alert8, Box as Box23, Divider as Divider5, Grid as Grid2, Typography as Typography28 } from "@mui/material";
|
|
5059
|
+
import { useState as useState26 } from "react";
|
|
5060
5060
|
import {
|
|
5061
5061
|
useCredentials,
|
|
5062
|
-
useForm,
|
|
5063
|
-
useValidations
|
|
5062
|
+
useForm as useForm3,
|
|
5063
|
+
useValidations as useValidations4
|
|
5064
5064
|
} from "@data-c/hooks";
|
|
5065
|
-
import { isAxiosError } from "axios";
|
|
5066
|
-
import { useEffect as
|
|
5067
|
-
import
|
|
5065
|
+
import { isAxiosError as isAxiosError3 } from "axios";
|
|
5066
|
+
import { useEffect as useEffect20 } from "react";
|
|
5067
|
+
import isStrongPassword2 from "validator/lib/isStrongPassword";
|
|
5068
5068
|
|
|
5069
5069
|
// src/PasswordTextField/index.tsx
|
|
5070
5070
|
import Visibility from "@mui/icons-material/Visibility";
|
|
5071
5071
|
import VisibilityOff from "@mui/icons-material/VisibilityOff";
|
|
5072
|
-
import { IconButton as
|
|
5073
|
-
import { useState as
|
|
5072
|
+
import { IconButton as IconButton14, InputAdornment as InputAdornment4 } from "@mui/material";
|
|
5073
|
+
import { useState as useState25 } from "react";
|
|
5074
5074
|
|
|
5075
5075
|
// src/v2/Header/HeaderContent.tsx
|
|
5076
5076
|
import { Stack as Stack9 } from "@mui/material";
|
|
@@ -10281,204 +10281,1857 @@ var CurrencyTextField = forwardRef2(
|
|
|
10281
10281
|
);
|
|
10282
10282
|
var CurrencyTextField_default = CurrencyTextField;
|
|
10283
10283
|
|
|
10284
|
-
// src/
|
|
10284
|
+
// src/v2/Auth/index.tsx
|
|
10285
|
+
import { Stack as Stack46, Typography as Typography26, useMediaQuery as useMediaQuery7, useTheme as useTheme12 } from "@mui/material";
|
|
10286
|
+
|
|
10287
|
+
// src/v2/Auth/components/BannerSection/index.tsx
|
|
10288
|
+
import { Stack as Stack39, useMediaQuery as useMediaQuery4, useTheme as useTheme8 } from "@mui/material";
|
|
10285
10289
|
import { jsx as jsx152 } from "react/jsx-runtime";
|
|
10286
|
-
function
|
|
10287
|
-
const {
|
|
10288
|
-
const
|
|
10289
|
-
|
|
10290
|
-
setShowPassword(!showPassword);
|
|
10291
|
-
}
|
|
10290
|
+
function BannerSection2(props) {
|
|
10291
|
+
const { children } = props;
|
|
10292
|
+
const theme2 = useTheme8();
|
|
10293
|
+
const fullScreen = useMediaQuery4(theme2.breakpoints.up("md"));
|
|
10292
10294
|
return /* @__PURE__ */ jsx152(
|
|
10293
|
-
|
|
10295
|
+
Stack39,
|
|
10294
10296
|
{
|
|
10295
|
-
|
|
10296
|
-
|
|
10297
|
-
|
|
10298
|
-
|
|
10299
|
-
|
|
10300
|
-
|
|
10301
|
-
|
|
10302
|
-
|
|
10303
|
-
|
|
10304
|
-
|
|
10305
|
-
|
|
10306
|
-
tabIndex: -1,
|
|
10307
|
-
onClick: handleClickShowPassword,
|
|
10308
|
-
edge: "end",
|
|
10309
|
-
children: showPassword ? /* @__PURE__ */ jsx152(VisibilityOff, {}) : /* @__PURE__ */ jsx152(Visibility, {})
|
|
10310
|
-
}
|
|
10311
|
-
) })
|
|
10312
|
-
}
|
|
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',
|
|
10313
10308
|
},
|
|
10314
|
-
|
|
10309
|
+
children
|
|
10315
10310
|
}
|
|
10316
10311
|
);
|
|
10317
10312
|
}
|
|
10318
10313
|
|
|
10319
|
-
// src/
|
|
10320
|
-
import
|
|
10321
|
-
import {
|
|
10314
|
+
// src/v2/Auth/components/DefaultBanner/index.tsx
|
|
10315
|
+
import ArrowRight from "@mui/icons-material/ArrowRight";
|
|
10316
|
+
import { Link, Stack as Stack40, Typography as Typography19, useMediaQuery as useMediaQuery5, useTheme as useTheme9 } from "@mui/material";
|
|
10322
10317
|
import { jsx as jsx153, jsxs as jsxs67 } from "react/jsx-runtime";
|
|
10323
|
-
function
|
|
10324
|
-
const
|
|
10325
|
-
const
|
|
10326
|
-
return /* @__PURE__ */
|
|
10327
|
-
|
|
10318
|
+
function DefaultBanner() {
|
|
10319
|
+
const theme2 = useTheme9();
|
|
10320
|
+
const fullScreen = useMediaQuery5(theme2.breakpoints.up("md"));
|
|
10321
|
+
return /* @__PURE__ */ jsx153(
|
|
10322
|
+
Stack40,
|
|
10328
10323
|
{
|
|
10324
|
+
component: "section",
|
|
10325
|
+
display: fullScreen ? "flex" : "none",
|
|
10326
|
+
width: "100%",
|
|
10327
|
+
direction: "row",
|
|
10328
|
+
justifyContent: "center",
|
|
10329
|
+
alignItems: "center",
|
|
10329
10330
|
sx: {
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
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"
|
|
10333
10335
|
},
|
|
10334
|
-
children: [
|
|
10336
|
+
children: /* @__PURE__ */ jsxs67(Stack40, { padding: "2rem", children: [
|
|
10335
10337
|
/* @__PURE__ */ jsx153(
|
|
10336
|
-
|
|
10338
|
+
Typography19,
|
|
10337
10339
|
{
|
|
10338
|
-
|
|
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"
|
|
10340
10348
|
}
|
|
10341
10349
|
),
|
|
10342
10350
|
/* @__PURE__ */ jsx153(
|
|
10343
10351
|
Typography19,
|
|
10344
10352
|
{
|
|
10345
|
-
|
|
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__ */ jsx153(
|
|
10364
|
+
Typography19,
|
|
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__ */ jsx153(Link, { href: "https://site.datac.com.br/services/", target: "_blank", children: /* @__PURE__ */ jsxs67(
|
|
10379
|
+
Button_default,
|
|
10380
|
+
{
|
|
10381
|
+
component: "a",
|
|
10382
|
+
variant: "text",
|
|
10346
10383
|
sx: {
|
|
10347
|
-
|
|
10348
|
-
|
|
10349
|
-
|
|
10350
|
-
fontSize: "
|
|
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"
|
|
10351
10398
|
},
|
|
10352
|
-
children:
|
|
10399
|
+
children: [
|
|
10400
|
+
"Conhe\xE7a nossos produtos",
|
|
10401
|
+
/* @__PURE__ */ jsx153(
|
|
10402
|
+
ArrowRight,
|
|
10403
|
+
{
|
|
10404
|
+
fontSize: "medium",
|
|
10405
|
+
sx: { color: (theme3) => theme3.palette.success.light }
|
|
10406
|
+
}
|
|
10407
|
+
)
|
|
10408
|
+
]
|
|
10353
10409
|
}
|
|
10354
|
-
)
|
|
10355
|
-
]
|
|
10410
|
+
) })
|
|
10411
|
+
] })
|
|
10356
10412
|
}
|
|
10357
10413
|
);
|
|
10358
10414
|
}
|
|
10359
10415
|
|
|
10360
|
-
// src/
|
|
10361
|
-
import {
|
|
10362
|
-
|
|
10363
|
-
|
|
10364
|
-
|
|
10365
|
-
|
|
10416
|
+
// src/v2/Auth/components/LoginSection/index.tsx
|
|
10417
|
+
import { Box as Box21, Stack as Stack45, useMediaQuery as useMediaQuery6, useTheme as useTheme11 } from "@mui/material";
|
|
10418
|
+
|
|
10419
|
+
// src/v2/Auth/components/EsqueciSenhaForm/index.tsx
|
|
10420
|
+
import { useState as useState17 } from "react";
|
|
10421
|
+
import { Alert as Alert3, Box as Box16, TextField as TextField6 } from "@mui/material";
|
|
10422
|
+
import { useValidations } from "@data-c/hooks";
|
|
10423
|
+
|
|
10424
|
+
// ../../node_modules/jwt-decode/build/esm/index.js
|
|
10425
|
+
var InvalidTokenError = class extends Error {
|
|
10366
10426
|
};
|
|
10367
|
-
|
|
10368
|
-
|
|
10369
|
-
|
|
10370
|
-
|
|
10371
|
-
|
|
10372
|
-
|
|
10373
|
-
|
|
10374
|
-
|
|
10375
|
-
|
|
10376
|
-
|
|
10377
|
-
|
|
10378
|
-
|
|
10379
|
-
|
|
10380
|
-
|
|
10381
|
-
|
|
10382
|
-
|
|
10383
|
-
|
|
10384
|
-
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
changeValue("senhaAtual", senhaAtual);
|
|
10391
|
-
}
|
|
10392
|
-
}, [senhaAtual]);
|
|
10393
|
-
useEffect15(() => {
|
|
10394
|
-
if (data.senhaNova) {
|
|
10395
|
-
setEhSegura(
|
|
10396
|
-
isStrongPassword(data.senhaNova, {
|
|
10397
|
-
minLength: 8,
|
|
10398
|
-
minLowercase: 1,
|
|
10399
|
-
minUppercase: 1,
|
|
10400
|
-
minNumbers: 1,
|
|
10401
|
-
minSymbols: 1
|
|
10402
|
-
})
|
|
10403
|
-
);
|
|
10404
|
-
}
|
|
10405
|
-
}, [data.senhaNova]);
|
|
10406
|
-
async function handleAlterarSenha() {
|
|
10407
|
-
setValidationErrors(null);
|
|
10408
|
-
setError(null);
|
|
10409
|
-
schema.validate(data, { abortEarly: false }).then(async () => {
|
|
10410
|
-
const { senhaAtual: senhaAtual2, senhaNova } = data;
|
|
10411
|
-
try {
|
|
10412
|
-
const response = await alterarSenha(senhaAtual2, senhaNova, email);
|
|
10413
|
-
if (response) {
|
|
10414
|
-
if (onSuccess)
|
|
10415
|
-
onSuccess();
|
|
10416
|
-
setData(defaultData);
|
|
10417
|
-
}
|
|
10418
|
-
} catch (error2) {
|
|
10419
|
-
if (onFailed)
|
|
10420
|
-
onFailed(error2);
|
|
10421
|
-
if (isAxiosError(error2)) {
|
|
10422
|
-
setError(error2.response?.data.message);
|
|
10423
|
-
return;
|
|
10424
|
-
}
|
|
10425
|
-
setError("Ocorreu um erro ao tentar alterar a senha");
|
|
10426
|
-
}
|
|
10427
|
-
}).catch((error2) => {
|
|
10428
|
-
console.log("Erros por campo:", error2.inner);
|
|
10429
|
-
console.log("Primeiro erro:", error2.errors);
|
|
10430
|
-
setValidationErrors(error2);
|
|
10431
|
-
});
|
|
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");
|
|
10432
10450
|
}
|
|
10433
|
-
|
|
10434
|
-
return
|
|
10451
|
+
try {
|
|
10452
|
+
return b64DecodeUnicode(output);
|
|
10453
|
+
} catch (err) {
|
|
10454
|
+
return atob(output);
|
|
10435
10455
|
}
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
|
|
10439
|
-
|
|
10440
|
-
}
|
|
10441
|
-
return false;
|
|
10456
|
+
}
|
|
10457
|
+
function jwtDecode(token, options) {
|
|
10458
|
+
if (typeof token !== "string") {
|
|
10459
|
+
throw new InvalidTokenError("Invalid token specified: must be a string");
|
|
10442
10460
|
}
|
|
10443
|
-
|
|
10444
|
-
|
|
10445
|
-
|
|
10446
|
-
|
|
10447
|
-
}
|
|
10448
|
-
return false;
|
|
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}`);
|
|
10449
10466
|
}
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
}
|
|
10455
|
-
return false;
|
|
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})`);
|
|
10456
10472
|
}
|
|
10457
|
-
|
|
10458
|
-
|
|
10459
|
-
|
|
10460
|
-
|
|
10461
|
-
}
|
|
10462
|
-
return false;
|
|
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})`);
|
|
10463
10477
|
}
|
|
10464
|
-
|
|
10465
|
-
|
|
10466
|
-
|
|
10478
|
+
}
|
|
10479
|
+
|
|
10480
|
+
// src/v2/Auth/context/CredentialsContext.tsx
|
|
10481
|
+
import {
|
|
10482
|
+
createContext as createContext5,
|
|
10483
|
+
useContext as useContext6,
|
|
10484
|
+
useEffect as useEffect15,
|
|
10485
|
+
useState as useState16
|
|
10486
|
+
} from "react";
|
|
10487
|
+
import { jsx as jsx154 } from "react/jsx-runtime";
|
|
10488
|
+
var CredentialsContext = createContext5(
|
|
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] = useState16(false);
|
|
10499
|
+
const [token, setTokenState] = useState16(
|
|
10500
|
+
() => localStorage.getItem(TOKEN_KEY)
|
|
10501
|
+
);
|
|
10502
|
+
const [refreshToken, setRefreshTokenState] = useState16(
|
|
10503
|
+
() => localStorage.getItem(REFRESH_TOKEN_KEY)
|
|
10504
|
+
);
|
|
10505
|
+
const [userLogged, setUserLogged] = useState16(
|
|
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 {
|
|
10516
|
+
return null;
|
|
10517
|
+
}
|
|
10518
|
+
}
|
|
10519
|
+
);
|
|
10520
|
+
const [isAuthenticated, setIsAuthenticated] = useState16(() => {
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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
|
+
useEffect15(() => {
|
|
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 = permissao?.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 response?.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 = prefix2.match(/:(.*?);/)?.[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__ */ jsx154(
|
|
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 = useContext6(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
|
+
import { jsx as jsx155, jsxs as jsxs68 } from "react/jsx-runtime";
|
|
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] = useState17("");
|
|
10819
|
+
const [isSubmitting, setSubmitting] = useState17(false);
|
|
10820
|
+
const [sucessoRecuperarSenha, setSucessoRecuperarSenha] = useState17(false);
|
|
10821
|
+
const [error, setError] = useState17(null);
|
|
10822
|
+
const { recuperarSenha } = useCredentialsContext();
|
|
10823
|
+
const { validationProps, setValidationErrors } = useValidations();
|
|
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(error2.response?.data.message);
|
|
10833
|
+
} finally {
|
|
10834
|
+
setSubmitting(false);
|
|
10835
|
+
}
|
|
10836
|
+
}).catch((error2) => {
|
|
10837
|
+
setValidationErrors(error2);
|
|
10838
|
+
});
|
|
10839
|
+
}
|
|
10840
|
+
return /* @__PURE__ */ jsxs68(Box16, { component: "form", children: [
|
|
10841
|
+
/* @__PURE__ */ jsx155(
|
|
10842
|
+
TextField6,
|
|
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__ */ jsx155(
|
|
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__ */ jsx155(
|
|
10865
|
+
ButtonContainer,
|
|
10866
|
+
{
|
|
10867
|
+
sx: {
|
|
10868
|
+
display: "inline-flex",
|
|
10869
|
+
justifyContent: "space-between",
|
|
10870
|
+
width: "100%",
|
|
10871
|
+
marginTop: 1
|
|
10872
|
+
},
|
|
10873
|
+
children: /* @__PURE__ */ jsx155(
|
|
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__ */ jsx155(
|
|
10890
|
+
Alert3,
|
|
10891
|
+
{
|
|
10892
|
+
severity: "success",
|
|
10893
|
+
action: /* @__PURE__ */ jsx155(
|
|
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__ */ jsx155(Alert3, { severity: "error", children: error })
|
|
10911
|
+
] });
|
|
10912
|
+
}
|
|
10913
|
+
|
|
10914
|
+
// src/v2/Auth/components/Header/index.tsx
|
|
10915
|
+
import { Stack as Stack41, Typography as Typography20 } from "@mui/material";
|
|
10916
|
+
import { jsx as jsx156, jsxs as jsxs69 } from "react/jsx-runtime";
|
|
10917
|
+
function Header3(props) {
|
|
10918
|
+
const { label, subTitle = "Acesse sua conta" } = props;
|
|
10919
|
+
return /* @__PURE__ */ jsxs69(Stack41, { component: "header", textAlign: "center", marginBottom: "3rem", children: [
|
|
10920
|
+
/* @__PURE__ */ jsx156(
|
|
10921
|
+
Typography20,
|
|
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__ */ jsx156(
|
|
10933
|
+
Typography20,
|
|
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
|
+
import { Box as Box17, MenuItem as MenuItem6, TextField as TextField7 } from "@mui/material";
|
|
10948
|
+
import { useEffect as useEffect16, useState as useState18 } from "react";
|
|
10949
|
+
import { jsx as jsx157, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
10950
|
+
function LicencaForm(props) {
|
|
10951
|
+
const { loginData, onLoginFailed, onLoginSuccess } = props;
|
|
10952
|
+
const [empresaId, setEmpresaId] = useState18("");
|
|
10953
|
+
const { selecionarLicenca, isSubmitting } = useCredentialsContext();
|
|
10954
|
+
useEffect16(() => {
|
|
10955
|
+
if (Array.isArray(loginData?.empresas)) {
|
|
10956
|
+
const empresa = loginData?.empresas[0];
|
|
10957
|
+
setEmpresaId(empresa?.uuid);
|
|
10958
|
+
}
|
|
10959
|
+
}, [loginData]);
|
|
10960
|
+
async function handleSelecionarLicenca() {
|
|
10961
|
+
try {
|
|
10962
|
+
const tokens = await selecionarLicenca(loginData?.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__ */ jsxs70(Box17, { component: "form", sx: { minWidth: "290px" }, children: [
|
|
10973
|
+
/* @__PURE__ */ jsx157(
|
|
10974
|
+
TextField7,
|
|
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: loginData?.empresas?.map((empresa) => /* @__PURE__ */ jsx157(MenuItem6, { value: empresa.uuid, children: empresa.nome }, empresa.uuid))
|
|
10985
|
+
}
|
|
10986
|
+
),
|
|
10987
|
+
/* @__PURE__ */ jsx157(
|
|
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
|
+
import { useState as useState20 } from "react";
|
|
11003
|
+
import { useValidations as useValidations3 } from "@data-c/hooks";
|
|
11004
|
+
import { Alert as Alert5, Divider as Divider4, Stack as Stack42, TextField as TextField8, Typography as Typography23 } from "@mui/material";
|
|
11005
|
+
import { isAxiosError as isAxiosError2 } from "axios";
|
|
11006
|
+
import Mail from "@mui/icons-material/Mail";
|
|
11007
|
+
import WhatsApp from "@mui/icons-material/WhatsApp";
|
|
11008
|
+
|
|
11009
|
+
// src/v2/Auth/components/AlterarSenhaV2/index.tsx
|
|
11010
|
+
import InfoOutlined from "@mui/icons-material/InfoOutlined";
|
|
11011
|
+
import { Alert as Alert4, Box as Box19, Divider as Divider3, Grid, Typography as Typography22 } from "@mui/material";
|
|
11012
|
+
import { useState as useState19 } from "react";
|
|
11013
|
+
import { useForm, useValidations as useValidations2 } from "@data-c/hooks";
|
|
11014
|
+
import { isAxiosError } from "axios";
|
|
11015
|
+
import { useEffect as useEffect17 } from "react";
|
|
11016
|
+
import isStrongPassword from "validator/lib/isStrongPassword";
|
|
11017
|
+
|
|
11018
|
+
// src/v2/Auth/components/AlterarSenhaV2/components/ValidatorMessage/index.tsx
|
|
11019
|
+
import Circle3 from "@mui/icons-material/Circle";
|
|
11020
|
+
import { Box as Box18, Typography as Typography21, useTheme as useTheme10 } from "@mui/material";
|
|
11021
|
+
import { jsx as jsx158, jsxs as jsxs71 } from "react/jsx-runtime";
|
|
11022
|
+
function ValidatorMessage(props) {
|
|
11023
|
+
const { isValid, message } = props;
|
|
11024
|
+
const theme2 = useTheme10();
|
|
11025
|
+
return /* @__PURE__ */ jsxs71(
|
|
11026
|
+
Box18,
|
|
11027
|
+
{
|
|
11028
|
+
sx: {
|
|
11029
|
+
display: "flex",
|
|
11030
|
+
flexDirection: "row",
|
|
11031
|
+
alignItems: "center"
|
|
11032
|
+
},
|
|
11033
|
+
children: [
|
|
11034
|
+
/* @__PURE__ */ jsx158(
|
|
11035
|
+
Circle3,
|
|
11036
|
+
{
|
|
11037
|
+
color: isValid ? "success" : "inherit",
|
|
11038
|
+
sx: { fontSize: "8pt" }
|
|
11039
|
+
}
|
|
11040
|
+
),
|
|
11041
|
+
/* @__PURE__ */ jsx158(
|
|
11042
|
+
Typography21,
|
|
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
|
+
import { jsx as jsx159, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
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 } = useValidations2();
|
|
11083
|
+
const { data, handleChange, setData, changeValue } = useForm(defaultData);
|
|
11084
|
+
const [ehSegura, setEhSegura] = useState19(false);
|
|
11085
|
+
const [error, setError] = useState19(null);
|
|
11086
|
+
useEffect17(() => {
|
|
11087
|
+
if (senhaAtual) {
|
|
11088
|
+
changeValue("senhaAtual", senhaAtual);
|
|
11089
|
+
}
|
|
11090
|
+
}, [senhaAtual]);
|
|
11091
|
+
useEffect17(() => {
|
|
11092
|
+
if (data.senhaNova) {
|
|
11093
|
+
setEhSegura(
|
|
11094
|
+
isStrongPassword(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 (isAxiosError(error2)) {
|
|
11120
|
+
setError(error2.response?.data.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 data?.senhaNova.length >= 8;
|
|
11133
|
+
}
|
|
11134
|
+
function temLetraMinuscula() {
|
|
11135
|
+
if (data?.senhaNova) {
|
|
11136
|
+
const result = data?.senhaNova.match(/[a-z]/g);
|
|
11137
|
+
return Array.isArray(result) && result.length > 0;
|
|
11138
|
+
}
|
|
11139
|
+
return false;
|
|
11140
|
+
}
|
|
11141
|
+
function temLetraMaisucula() {
|
|
11142
|
+
if (data?.senhaNova) {
|
|
11143
|
+
const result = data?.senhaNova.match(/[A-Z]/g);
|
|
11144
|
+
return Array.isArray(result) && result.length > 0;
|
|
11145
|
+
}
|
|
11146
|
+
return false;
|
|
11147
|
+
}
|
|
11148
|
+
function temNumero() {
|
|
11149
|
+
if (data?.senhaNova) {
|
|
11150
|
+
const result = data?.senhaNova.match(/\d/g);
|
|
11151
|
+
return Array.isArray(result) && result.length > 0;
|
|
11152
|
+
}
|
|
11153
|
+
return false;
|
|
11154
|
+
}
|
|
11155
|
+
function temCaracterEspecial() {
|
|
11156
|
+
if (data?.senhaNova) {
|
|
11157
|
+
const result = data?.senhaNova.match(/\W/g);
|
|
11158
|
+
return Array.isArray(result) && result.length > 0;
|
|
11159
|
+
}
|
|
11160
|
+
return false;
|
|
11161
|
+
}
|
|
11162
|
+
function asSenhasSaoIguais() {
|
|
11163
|
+
if (data?.senhaNova === "")
|
|
11164
|
+
return false;
|
|
11165
|
+
return data?.senhaNova === data?.senhaNovaConfirmar;
|
|
11166
|
+
}
|
|
11167
|
+
return /* @__PURE__ */ jsxs72(Dialog_default.Root, { open: isOpen, onClose: (_) => onClose(), maxWidth: "md", children: [
|
|
11168
|
+
/* @__PURE__ */ jsxs72(Dialog_default.Header, { children: [
|
|
11169
|
+
/* @__PURE__ */ jsx159(Dialog_default.Title, { children: "Alterar Senha" }),
|
|
11170
|
+
/* @__PURE__ */ jsx159(Dialog_default.ActionClose, { onClose })
|
|
11171
|
+
] }),
|
|
11172
|
+
/* @__PURE__ */ jsx159(Dialog_default.Content, { children: /* @__PURE__ */ jsxs72(Grid, { container: true, spacing: 2, children: [
|
|
11173
|
+
primeiroAcesso && /* @__PURE__ */ jsx159(Grid, { size: 12, children: /* @__PURE__ */ jsxs72(Alert4, { severity: "info", children: [
|
|
11174
|
+
"Voc\xEA est\xE1 acessando o sistema com uma senha tempor\xE1ria.",
|
|
11175
|
+
/* @__PURE__ */ jsx159("br", {}),
|
|
11176
|
+
"Cadastre uma senha segura para deixar sua conta mais protegida."
|
|
11177
|
+
] }) }),
|
|
11178
|
+
/* @__PURE__ */ jsxs72(Grid, { size: 12, children: [
|
|
11179
|
+
/* @__PURE__ */ jsx159(
|
|
11180
|
+
PasswordTextField,
|
|
11181
|
+
{
|
|
11182
|
+
name: "senhaAtual",
|
|
11183
|
+
label: "Senha Atual",
|
|
11184
|
+
value: data?.senhaAtual || "",
|
|
11185
|
+
onChange: handleChange,
|
|
11186
|
+
...validationProps("senhaAtual")
|
|
11187
|
+
}
|
|
11188
|
+
),
|
|
11189
|
+
/* @__PURE__ */ jsxs72(
|
|
11190
|
+
Box19,
|
|
11191
|
+
{
|
|
11192
|
+
sx: { display: "flex", alignItems: "center", gap: 0.5, mt: 0.5 },
|
|
11193
|
+
children: [
|
|
11194
|
+
/* @__PURE__ */ jsx159(InfoOutlined, { sx: { fontSize: 14, color: "text.secondary" } }),
|
|
11195
|
+
/* @__PURE__ */ jsx159(Typography22, { 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__ */ jsx159(Grid, { size: 12, children: /* @__PURE__ */ jsx159(Divider3, {}) }),
|
|
11201
|
+
/* @__PURE__ */ jsx159(Grid, { size: 12, children: /* @__PURE__ */ jsx159(
|
|
11202
|
+
PasswordTextField,
|
|
11203
|
+
{
|
|
11204
|
+
name: "senhaNova",
|
|
11205
|
+
label: "Nova Senha",
|
|
11206
|
+
value: data?.senhaNova || "",
|
|
11207
|
+
onChange: handleChange,
|
|
11208
|
+
...validationProps("senhaNova")
|
|
11209
|
+
}
|
|
11210
|
+
) }),
|
|
11211
|
+
/* @__PURE__ */ jsxs72(Grid, { size: 12, children: [
|
|
11212
|
+
/* @__PURE__ */ jsx159(
|
|
11213
|
+
PasswordTextField,
|
|
11214
|
+
{
|
|
11215
|
+
name: "senhaNovaConfirmar",
|
|
11216
|
+
label: "Confirmar Nova Senha",
|
|
11217
|
+
value: data?.senhaNovaConfirmar || "",
|
|
11218
|
+
onChange: handleChange,
|
|
11219
|
+
...validationProps("senhaNovaConfirmar")
|
|
11220
|
+
}
|
|
11221
|
+
),
|
|
11222
|
+
/* @__PURE__ */ jsxs72(
|
|
11223
|
+
Box19,
|
|
11224
|
+
{
|
|
11225
|
+
sx: { display: "flex", alignItems: "center", gap: 0.5, mt: 0.5 },
|
|
11226
|
+
children: [
|
|
11227
|
+
/* @__PURE__ */ jsx159(InfoOutlined, { sx: { fontSize: 14, color: "text.secondary" } }),
|
|
11228
|
+
/* @__PURE__ */ jsx159(Typography22, { variant: "caption", color: "text.secondary", children: "Informe nos campos acima a nova senha que deseja utilizar." })
|
|
11229
|
+
]
|
|
11230
|
+
}
|
|
11231
|
+
)
|
|
11232
|
+
] }),
|
|
11233
|
+
/* @__PURE__ */ jsxs72(Grid, { size: 12, children: [
|
|
11234
|
+
/* @__PURE__ */ jsx159(
|
|
11235
|
+
ValidatorMessage,
|
|
11236
|
+
{
|
|
11237
|
+
isValid: tem8caracteres(),
|
|
11238
|
+
message: "O tamanho m\xEDnimo da nova senha \xE9 de 8 caracteres"
|
|
11239
|
+
}
|
|
11240
|
+
),
|
|
11241
|
+
/* @__PURE__ */ jsx159(
|
|
11242
|
+
ValidatorMessage,
|
|
11243
|
+
{
|
|
11244
|
+
isValid: temLetraMinuscula(),
|
|
11245
|
+
message: "A nova senha deve ter ao menos uma letra min\xFAscula"
|
|
11246
|
+
}
|
|
11247
|
+
),
|
|
11248
|
+
/* @__PURE__ */ jsx159(
|
|
11249
|
+
ValidatorMessage,
|
|
11250
|
+
{
|
|
11251
|
+
isValid: temLetraMaisucula(),
|
|
11252
|
+
message: "A nova senha deve ter ao menos uma letra mai\xFAscula"
|
|
11253
|
+
}
|
|
11254
|
+
),
|
|
11255
|
+
/* @__PURE__ */ jsx159(
|
|
11256
|
+
ValidatorMessage,
|
|
11257
|
+
{
|
|
11258
|
+
isValid: temNumero(),
|
|
11259
|
+
message: "A nova senha deve ter ao menos um n\xFAmero"
|
|
11260
|
+
}
|
|
11261
|
+
),
|
|
11262
|
+
/* @__PURE__ */ jsx159(
|
|
11263
|
+
ValidatorMessage,
|
|
11264
|
+
{
|
|
11265
|
+
isValid: temCaracterEspecial(),
|
|
11266
|
+
message: "A nova senha deve ter ao menos um caracter especial"
|
|
11267
|
+
}
|
|
11268
|
+
),
|
|
11269
|
+
/* @__PURE__ */ jsx159(
|
|
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__ */ jsx159(Grid, { size: 12, children: /* @__PURE__ */ jsx159(Alert4, { severity: "error", children: error }) })
|
|
11278
|
+
] }) }),
|
|
11279
|
+
/* @__PURE__ */ jsx159(Dialog_default.Footer, { children: /* @__PURE__ */ jsxs72(Dialog_default.Actions, { children: [
|
|
11280
|
+
/* @__PURE__ */ jsx159(Dialog_default.ActionCancelar, { onClick: () => onClose() }),
|
|
11281
|
+
/* @__PURE__ */ jsx159(
|
|
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
|
+
import { jsx as jsx160, jsxs as jsxs73 } from "react/jsx-runtime";
|
|
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] = useState20("");
|
|
11303
|
+
const [password, setPassword] = useState20("");
|
|
11304
|
+
const [isLoading, setLoading] = useState20(false);
|
|
11305
|
+
const [exibirAlterarSenha, setExibirAlterarSenha] = useState20(false);
|
|
11306
|
+
const [sucessoAlterarSenha, setSucessoAlterarSenha] = useState20(false);
|
|
11307
|
+
const [error, setError] = useState20(null);
|
|
11308
|
+
const { login } = useCredentialsContext();
|
|
11309
|
+
const { validationProps, setValidationErrors } = useValidations3();
|
|
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 (isAxiosError2(err)) {
|
|
11322
|
+
const axiosError = err;
|
|
11323
|
+
if (axiosError.response?.data.code === "E_FIRST_ACCESS") {
|
|
11324
|
+
setExibirAlterarSenha(true);
|
|
11325
|
+
return;
|
|
11326
|
+
}
|
|
11327
|
+
setError(err.response?.data.message);
|
|
11328
|
+
}
|
|
11329
|
+
onLoginFailed(err);
|
|
11330
|
+
}
|
|
11331
|
+
}).catch((err) => {
|
|
11332
|
+
setValidationErrors(err);
|
|
11333
|
+
}).finally(() => {
|
|
11334
|
+
setLoading(false);
|
|
11335
|
+
});
|
|
11336
|
+
}
|
|
11337
|
+
return /* @__PURE__ */ jsxs73(Stack42, { component: "form", onSubmit: handleLogin, children: [
|
|
11338
|
+
/* @__PURE__ */ jsxs73(
|
|
11339
|
+
Stack42,
|
|
11340
|
+
{
|
|
11341
|
+
spacing: 2,
|
|
11342
|
+
children: [
|
|
11343
|
+
/* @__PURE__ */ jsx160(
|
|
11344
|
+
TextField8,
|
|
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__ */ jsx160(
|
|
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__ */ jsx160(
|
|
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__ */ jsx160(
|
|
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__ */ jsx160(Alert5, { severity: "error", children: error }),
|
|
11406
|
+
sucessoAlterarSenha && /* @__PURE__ */ jsxs73(Alert5, { severity: "success", children: [
|
|
11407
|
+
"Senha cadastrada com sucesso",
|
|
11408
|
+
/* @__PURE__ */ jsx160("br", {}),
|
|
11409
|
+
"Tudo pronto para voc\xEA fazer o login"
|
|
11410
|
+
] }),
|
|
11411
|
+
/* @__PURE__ */ jsxs73(
|
|
11412
|
+
Stack42,
|
|
11413
|
+
{
|
|
11414
|
+
direction: "row",
|
|
11415
|
+
justifyContent: "center",
|
|
11416
|
+
alignItems: "center",
|
|
11417
|
+
mt: 2,
|
|
11418
|
+
mb: 2,
|
|
11419
|
+
children: [
|
|
11420
|
+
/* @__PURE__ */ jsx160(Divider4, { sx: { flexGrow: 1, mr: 1 } }),
|
|
11421
|
+
/* @__PURE__ */ jsx160(Typography23, { children: "Ou fa\xE7a login com" }),
|
|
11422
|
+
/* @__PURE__ */ jsx160(Divider4, { sx: { flexGrow: 1, ml: 1 } })
|
|
11423
|
+
]
|
|
11424
|
+
}
|
|
11425
|
+
),
|
|
11426
|
+
/* @__PURE__ */ jsxs73(Stack42, { spacing: 1, children: [
|
|
11427
|
+
/* @__PURE__ */ jsx160(
|
|
11428
|
+
Button_default,
|
|
11429
|
+
{
|
|
11430
|
+
onClick: () => onOptionsClick("otp-email"),
|
|
11431
|
+
startIcon: /* @__PURE__ */ jsx160(Mail, {}),
|
|
11432
|
+
children: "Entrar com senha tempor\xE1ria"
|
|
11433
|
+
}
|
|
11434
|
+
),
|
|
11435
|
+
/* @__PURE__ */ jsx160(
|
|
11436
|
+
Button_default,
|
|
11437
|
+
{
|
|
11438
|
+
onClick: () => onOptionsClick("otp-whatsapp"),
|
|
11439
|
+
startIcon: /* @__PURE__ */ jsx160(WhatsApp, {}),
|
|
11440
|
+
children: "Entrar com senha tempor\xE1ria"
|
|
11441
|
+
}
|
|
11442
|
+
)
|
|
11443
|
+
] }),
|
|
11444
|
+
/* @__PURE__ */ jsx160(
|
|
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
|
+
import { useEffect as useEffect19, useState as useState24 } from "react";
|
|
11464
|
+
|
|
11465
|
+
// src/v2/Auth/components/OtpForm/index.tsx
|
|
11466
|
+
import { useForm as useForm2 } from "@data-c/hooks";
|
|
11467
|
+
import HelpOutline from "@mui/icons-material/HelpOutline";
|
|
11468
|
+
import { Alert as Alert7, IconButton as IconButton13, Stack as Stack44, TextField as TextField11, Typography as Typography25 } from "@mui/material";
|
|
11469
|
+
import { useState as useState23 } from "react";
|
|
11470
|
+
|
|
11471
|
+
// src/WhastappTextField/index.tsx
|
|
11472
|
+
import { useState as useState21, useMemo as useMemo10 } from "react";
|
|
11473
|
+
import TextField9 from "@mui/material/TextField";
|
|
11474
|
+
import { jsx as jsx161 } from "react/jsx-runtime";
|
|
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] = useState21("");
|
|
11491
|
+
const isControlled = propValue !== void 0;
|
|
11492
|
+
const displayedValue = useMemo10(() => {
|
|
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__ */ jsx161(
|
|
11512
|
+
TextField9,
|
|
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
|
+
import { Alert as Alert6, Stack as Stack43, Typography as Typography24 } from "@mui/material";
|
|
11524
|
+
import { useEffect as useEffect18, useState as useState22 } from "react";
|
|
11525
|
+
|
|
11526
|
+
// src/VerificationCodeInput/index.tsx
|
|
11527
|
+
import { useRef as useRef5 } from "react";
|
|
11528
|
+
import { Box as Box20, TextField as TextField10 } from "@mui/material";
|
|
11529
|
+
import { jsx as jsx162 } from "react/jsx-runtime";
|
|
11530
|
+
function VerificationCodeInput({
|
|
11531
|
+
length = 6,
|
|
11532
|
+
value,
|
|
11533
|
+
onChange
|
|
11534
|
+
}) {
|
|
11535
|
+
const inputsRef = useRef5([]);
|
|
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
|
+
inputsRef.current[index + 1]?.focus();
|
|
11545
|
+
}
|
|
11546
|
+
};
|
|
11547
|
+
const handleKeyDown = (index, event) => {
|
|
11548
|
+
if (event.key === "Backspace" && !value[index] && index > 0) {
|
|
11549
|
+
inputsRef.current[index - 1]?.focus();
|
|
11550
|
+
}
|
|
11551
|
+
};
|
|
11552
|
+
return /* @__PURE__ */ jsx162(Box20, { display: "flex", gap: 1, children: Array.from({ length }).map((_, i) => /* @__PURE__ */ jsx162(
|
|
11553
|
+
TextField10,
|
|
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
|
+
import { jsx as jsx163, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
11578
|
+
function DialogVerificarOtp(props) {
|
|
11579
|
+
const { open, onClose, payload, onLoginSuccess } = props;
|
|
11580
|
+
const [code, setCode] = useState22("");
|
|
11581
|
+
const [error, setError] = useState22(false);
|
|
11582
|
+
const [isLoading, setLoading] = useState22(false);
|
|
11583
|
+
const { validarOtpVerificationCode } = useCredentialsContext();
|
|
11584
|
+
useEffect18(() => {
|
|
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__ */ jsxs74(Dialog_default.Root, { open, onClose: (_) => onClose(), maxWidth: "xs", children: [
|
|
11610
|
+
/* @__PURE__ */ jsxs74(Dialog_default.Header, { children: [
|
|
11611
|
+
/* @__PURE__ */ jsx163(Dialog_default.Title, { children: "Entrar com senha tempor\xE1ria" }),
|
|
11612
|
+
/* @__PURE__ */ jsx163(Dialog_default.ActionClose, { onClose })
|
|
11613
|
+
] }),
|
|
11614
|
+
/* @__PURE__ */ jsx163(Dialog_default.Content, { children: /* @__PURE__ */ jsxs74(
|
|
11615
|
+
Stack43,
|
|
11616
|
+
{
|
|
11617
|
+
spacing: 2,
|
|
11618
|
+
justifyContent: "center",
|
|
11619
|
+
alignContent: "center",
|
|
11620
|
+
alignItems: "center",
|
|
11621
|
+
children: [
|
|
11622
|
+
/* @__PURE__ */ jsx163(
|
|
11623
|
+
Typography24,
|
|
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__ */ jsxs74(Typography24, { variant: "body1", sx: { fontSize: "10pt" }, children: [
|
|
11631
|
+
"Enviamos uma senha tempor\xE1ria para ",
|
|
11632
|
+
/* @__PURE__ */ jsx163("b", { children: payload.target }),
|
|
11633
|
+
". ",
|
|
11634
|
+
/* @__PURE__ */ jsx163("br", {}),
|
|
11635
|
+
"Digite o c\xF3digo abaixo para acessar sua conta."
|
|
11636
|
+
] }),
|
|
11637
|
+
/* @__PURE__ */ jsx163(
|
|
11638
|
+
VerificationCodeInput,
|
|
11639
|
+
{
|
|
11640
|
+
value: code,
|
|
11641
|
+
onChange: (value) => {
|
|
11642
|
+
setCode(value);
|
|
11643
|
+
}
|
|
11644
|
+
}
|
|
11645
|
+
),
|
|
11646
|
+
error && /* @__PURE__ */ jsx163(Alert6, { sx: { flexGrow: 1 }, severity: "error", children: error })
|
|
11647
|
+
]
|
|
11648
|
+
}
|
|
11649
|
+
) }),
|
|
11650
|
+
/* @__PURE__ */ jsx163(Dialog_default.Footer, { children: /* @__PURE__ */ jsxs74(Dialog_default.Actions, { children: [
|
|
11651
|
+
/* @__PURE__ */ jsx163(Dialog_default.ActionCancelar, { onClick: () => onClose() }),
|
|
11652
|
+
/* @__PURE__ */ jsx163(
|
|
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
|
+
import { Fragment as Fragment10, jsx as jsx164, jsxs as jsxs75 } from "react/jsx-runtime";
|
|
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] = useState23(false);
|
|
11675
|
+
const [error, setError] = useState23(false);
|
|
11676
|
+
const { gerarOtpVerificationCode } = useCredentialsContext();
|
|
11677
|
+
const { handleChange, changeValue, data, validate, validationErrors } = useForm2({ contato: "" }, contatoSchema);
|
|
11678
|
+
const [isOpenVerificar, setOpenVerificar] = useState23(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__ */ jsxs75(Fragment10, { children: [
|
|
11701
|
+
/* @__PURE__ */ jsx164("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs75(Stack44, { spacing: 2, children: [
|
|
11702
|
+
/* @__PURE__ */ jsx164(Typography25, { 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__ */ jsx164(
|
|
11704
|
+
TextField11,
|
|
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__ */ jsx164(
|
|
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__ */ jsxs75(Stack44, { children: [
|
|
11730
|
+
/* @__PURE__ */ jsx164(
|
|
11731
|
+
Button_default,
|
|
11732
|
+
{
|
|
11733
|
+
isLoading,
|
|
11734
|
+
type: "submit",
|
|
11735
|
+
variant: "contained",
|
|
11736
|
+
color: "primary",
|
|
11737
|
+
children: "Enviar c\xF3digo"
|
|
11738
|
+
}
|
|
11739
|
+
),
|
|
11740
|
+
/* @__PURE__ */ jsxs75(
|
|
11741
|
+
ButtonContainer,
|
|
11742
|
+
{
|
|
11743
|
+
sx: {
|
|
11744
|
+
display: "inline-flex",
|
|
11745
|
+
justifyContent: "space-between",
|
|
11746
|
+
width: "100%",
|
|
11747
|
+
marginTop: 1
|
|
11748
|
+
},
|
|
11749
|
+
children: [
|
|
11750
|
+
/* @__PURE__ */ jsx164(
|
|
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__ */ jsx164(
|
|
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__ */ jsx164(IconButton13, { children: /* @__PURE__ */ jsx164(HelpOutline, { color: "primary" }) })
|
|
11771
|
+
}
|
|
11772
|
+
)
|
|
11773
|
+
]
|
|
11774
|
+
}
|
|
11775
|
+
)
|
|
11776
|
+
] }),
|
|
11777
|
+
error && /* @__PURE__ */ jsx164(Alert7, { severity: "error", children: error })
|
|
11778
|
+
] }) }),
|
|
11779
|
+
/* @__PURE__ */ jsx164(
|
|
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
|
+
import { jsx as jsx165, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
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] = useState24();
|
|
11808
|
+
const { selecionarLicenca, isAuthenticated } = useCredentialsContext();
|
|
11809
|
+
const [view, setView] = useState24("login");
|
|
11810
|
+
const theme2 = useTheme11();
|
|
11811
|
+
const fullScreen = useMediaQuery6(theme2.breakpoints.up("md"));
|
|
11812
|
+
useEffect19(() => {
|
|
11813
|
+
if (isAuthenticated && onAlreadyLogged) {
|
|
11814
|
+
onAlreadyLogged();
|
|
11815
|
+
}
|
|
11816
|
+
}, [isAuthenticated]);
|
|
11817
|
+
async function handleLoginSuccess(_loginData) {
|
|
11818
|
+
try {
|
|
11819
|
+
if (Array.isArray(_loginData?.empresas)) {
|
|
11820
|
+
if (_loginData?.empresas.length === 1) {
|
|
11821
|
+
const tokens = await selecionarLicenca(
|
|
11822
|
+
_loginData?.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__ */ jsxs76(Stack45, { children: [
|
|
11850
|
+
/* @__PURE__ */ jsx165(Header3, { label: appName, subTitle: pageLabel }),
|
|
11851
|
+
/* @__PURE__ */ jsxs76(Box21, { sx: { marginTop: 2 }, children: [
|
|
11852
|
+
view === "login" && /* @__PURE__ */ jsx165(
|
|
11853
|
+
LoginForm,
|
|
11854
|
+
{
|
|
11855
|
+
onLoginSuccess: handleLoginSuccess,
|
|
11856
|
+
onLoginFailed: handleLoginFailed,
|
|
11857
|
+
onOptionsClick: handleOptionsClick
|
|
11858
|
+
}
|
|
11859
|
+
),
|
|
11860
|
+
view === "licensa" && /* @__PURE__ */ jsx165(
|
|
11861
|
+
LicencaForm,
|
|
11862
|
+
{
|
|
11863
|
+
loginData,
|
|
11864
|
+
onLoginSuccess,
|
|
11865
|
+
onLoginFailed
|
|
11866
|
+
}
|
|
11867
|
+
),
|
|
11868
|
+
view === "esqueci-senha" && /* @__PURE__ */ jsx165(EsqueciSenhaForm, { onLoginClick: handleExibirLogin }),
|
|
11869
|
+
view === "otp-email" && /* @__PURE__ */ jsx165(
|
|
11870
|
+
OtpForm,
|
|
11871
|
+
{
|
|
11872
|
+
onLoginClick: handleExibirLogin,
|
|
11873
|
+
onLoginSuccess: handleLoginSuccess,
|
|
11874
|
+
tipo: "otp-email"
|
|
11875
|
+
}
|
|
11876
|
+
),
|
|
11877
|
+
view === "otp-whatsapp" && /* @__PURE__ */ jsx165(
|
|
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
|
+
import { jsx as jsx166, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
11891
|
+
function LoginContainer({ children }) {
|
|
11892
|
+
const theme2 = useTheme12();
|
|
11893
|
+
const fullScreen = useMediaQuery7(theme2.breakpoints.up("md"));
|
|
11894
|
+
return /* @__PURE__ */ jsxs77(
|
|
11895
|
+
Stack46,
|
|
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__ */ jsx166(Stack46, { width: "100%", maxWidth: "28rem", margin: "auto 0", children }),
|
|
11906
|
+
/* @__PURE__ */ jsxs77(Stack46, { direction: "row", alignItems: "center", marginBottom: -3, children: [
|
|
11907
|
+
/* @__PURE__ */ jsx166(
|
|
11908
|
+
"img",
|
|
11909
|
+
{
|
|
11910
|
+
width: "60",
|
|
11911
|
+
src: "https://datac-site-assets.s3.sa-east-1.amazonaws.com/logomarca.png"
|
|
11912
|
+
}
|
|
11913
|
+
),
|
|
11914
|
+
/* @__PURE__ */ jsx166(
|
|
11915
|
+
Typography26,
|
|
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__ */ jsxs77(Stack46, { component: "main", direction: "row", height: "100vh", children: [
|
|
11932
|
+
banner ? /* @__PURE__ */ jsx166(BannerSection2, { children: banner }) : /* @__PURE__ */ jsx166(DefaultBanner, {}),
|
|
11933
|
+
/* @__PURE__ */ jsx166(LoginContainer, { children: loginSection ? loginSection : /* @__PURE__ */ jsx166(LoginSection, { ...loginSectionProps }) })
|
|
11934
|
+
] });
|
|
11935
|
+
}
|
|
11936
|
+
|
|
11937
|
+
// src/PasswordTextField/index.tsx
|
|
11938
|
+
import { jsx as jsx167 } from "react/jsx-runtime";
|
|
11939
|
+
function PasswordTextField(props) {
|
|
11940
|
+
const { name, label, value, onChange, onKeyDown, ...rest } = props;
|
|
11941
|
+
const [showPassword, setShowPassword] = useState25(false);
|
|
11942
|
+
function handleClickShowPassword() {
|
|
11943
|
+
setShowPassword(!showPassword);
|
|
11944
|
+
}
|
|
11945
|
+
return /* @__PURE__ */ jsx167(
|
|
11946
|
+
TextField5,
|
|
11947
|
+
{
|
|
11948
|
+
name,
|
|
11949
|
+
label,
|
|
11950
|
+
value: value || "",
|
|
11951
|
+
onChange,
|
|
11952
|
+
onKeyDown,
|
|
11953
|
+
type: showPassword ? "text" : "password",
|
|
11954
|
+
slotProps: {
|
|
11955
|
+
input: {
|
|
11956
|
+
endAdornment: /* @__PURE__ */ jsx167(InputAdornment4, { position: "end", children: /* @__PURE__ */ jsx167(
|
|
11957
|
+
IconButton14,
|
|
11958
|
+
{
|
|
11959
|
+
tabIndex: -1,
|
|
11960
|
+
onClick: handleClickShowPassword,
|
|
11961
|
+
edge: "end",
|
|
11962
|
+
children: showPassword ? /* @__PURE__ */ jsx167(VisibilityOff, {}) : /* @__PURE__ */ jsx167(Visibility, {})
|
|
11963
|
+
}
|
|
11964
|
+
) })
|
|
11965
|
+
}
|
|
11966
|
+
},
|
|
11967
|
+
...rest
|
|
11968
|
+
}
|
|
11969
|
+
);
|
|
11970
|
+
}
|
|
11971
|
+
|
|
11972
|
+
// src/AlterarSenha/components/ValidatorMessage/index.tsx
|
|
11973
|
+
import Circle4 from "@mui/icons-material/Circle";
|
|
11974
|
+
import { Box as Box22, Typography as Typography27, useTheme as useTheme13 } from "@mui/material";
|
|
11975
|
+
import { jsx as jsx168, jsxs as jsxs78 } from "react/jsx-runtime";
|
|
11976
|
+
function ValidatorMessage2(props) {
|
|
11977
|
+
const { isValid, message } = props;
|
|
11978
|
+
const theme2 = useTheme13();
|
|
11979
|
+
return /* @__PURE__ */ jsxs78(
|
|
11980
|
+
Box22,
|
|
11981
|
+
{
|
|
11982
|
+
sx: {
|
|
11983
|
+
display: "flex",
|
|
11984
|
+
flexDirection: "row",
|
|
11985
|
+
alignItems: "center"
|
|
11986
|
+
},
|
|
11987
|
+
children: [
|
|
11988
|
+
/* @__PURE__ */ jsx168(
|
|
11989
|
+
Circle4,
|
|
11990
|
+
{
|
|
11991
|
+
color: isValid ? "success" : "inherit",
|
|
11992
|
+
sx: { fontSize: "8pt" }
|
|
11993
|
+
}
|
|
11994
|
+
),
|
|
11995
|
+
/* @__PURE__ */ jsx168(
|
|
11996
|
+
Typography27,
|
|
11997
|
+
{
|
|
11998
|
+
variant: "body2",
|
|
11999
|
+
sx: {
|
|
12000
|
+
color: isValid ? theme2.palette.success.main : "inherit",
|
|
12001
|
+
textDecoration: isValid ? "line-through" : "none",
|
|
12002
|
+
ml: 1,
|
|
12003
|
+
fontSize: "10pt"
|
|
12004
|
+
},
|
|
12005
|
+
children: message
|
|
12006
|
+
}
|
|
12007
|
+
)
|
|
12008
|
+
]
|
|
12009
|
+
}
|
|
12010
|
+
);
|
|
12011
|
+
}
|
|
12012
|
+
|
|
12013
|
+
// src/AlterarSenha/index.tsx
|
|
12014
|
+
import { jsx as jsx169, jsxs as jsxs79 } from "react/jsx-runtime";
|
|
12015
|
+
var defaultData2 = {
|
|
12016
|
+
senhaAtual: "",
|
|
12017
|
+
senhaNova: "",
|
|
12018
|
+
senhaNovaConfirmar: ""
|
|
12019
|
+
};
|
|
12020
|
+
var schema4 = create$3().shape({
|
|
12021
|
+
senhaAtual: create$6().required("Informe a Senha Atual."),
|
|
12022
|
+
senhaNova: create$6().required("Informe a Nova Senha."),
|
|
12023
|
+
senhaNovaConfirmar: create$6().required("Informe a Nova Senha.").oneOf([create$9("senhaNova")], "As senhas devem ser iguais.")
|
|
12024
|
+
});
|
|
12025
|
+
function AlterarSenha(props) {
|
|
12026
|
+
const {
|
|
12027
|
+
isOpen,
|
|
12028
|
+
credentialsConfig,
|
|
12029
|
+
onClose,
|
|
12030
|
+
onSuccess,
|
|
12031
|
+
onFailed,
|
|
12032
|
+
primeiroAcesso,
|
|
12033
|
+
senhaAtual,
|
|
12034
|
+
email
|
|
12035
|
+
} = props;
|
|
12036
|
+
const { alterarSenha, isSubmitting } = useCredentials(credentialsConfig);
|
|
12037
|
+
const { setValidationErrors, validationProps } = useValidations4();
|
|
12038
|
+
const { data, handleChange, setData, changeValue } = useForm3(defaultData2);
|
|
12039
|
+
const [ehSegura, setEhSegura] = useState26(false);
|
|
12040
|
+
const [error, setError] = useState26(null);
|
|
12041
|
+
useEffect20(() => {
|
|
12042
|
+
if (senhaAtual) {
|
|
12043
|
+
changeValue("senhaAtual", senhaAtual);
|
|
12044
|
+
}
|
|
12045
|
+
}, [senhaAtual]);
|
|
12046
|
+
useEffect20(() => {
|
|
12047
|
+
if (data.senhaNova) {
|
|
12048
|
+
setEhSegura(
|
|
12049
|
+
isStrongPassword2(data.senhaNova, {
|
|
12050
|
+
minLength: 8,
|
|
12051
|
+
minLowercase: 1,
|
|
12052
|
+
minUppercase: 1,
|
|
12053
|
+
minNumbers: 1,
|
|
12054
|
+
minSymbols: 1
|
|
12055
|
+
})
|
|
12056
|
+
);
|
|
12057
|
+
}
|
|
12058
|
+
}, [data.senhaNova]);
|
|
12059
|
+
async function handleAlterarSenha() {
|
|
12060
|
+
setValidationErrors(null);
|
|
12061
|
+
setError(null);
|
|
12062
|
+
schema4.validate(data, { abortEarly: false }).then(async () => {
|
|
12063
|
+
const { senhaAtual: senhaAtual2, senhaNova } = data;
|
|
12064
|
+
try {
|
|
12065
|
+
const response = await alterarSenha(senhaAtual2, senhaNova, email);
|
|
12066
|
+
if (response) {
|
|
12067
|
+
if (onSuccess)
|
|
12068
|
+
onSuccess();
|
|
12069
|
+
setData(defaultData2);
|
|
12070
|
+
}
|
|
12071
|
+
} catch (error2) {
|
|
12072
|
+
if (onFailed)
|
|
12073
|
+
onFailed(error2);
|
|
12074
|
+
if (isAxiosError3(error2)) {
|
|
12075
|
+
setError(error2.response?.data.message);
|
|
12076
|
+
return;
|
|
12077
|
+
}
|
|
12078
|
+
setError("Ocorreu um erro ao tentar alterar a senha");
|
|
12079
|
+
}
|
|
12080
|
+
}).catch((error2) => {
|
|
12081
|
+
console.log("Erros por campo:", error2.inner);
|
|
12082
|
+
console.log("Primeiro erro:", error2.errors);
|
|
12083
|
+
setValidationErrors(error2);
|
|
12084
|
+
});
|
|
12085
|
+
}
|
|
12086
|
+
function tem8caracteres() {
|
|
12087
|
+
return data?.senhaNova.length >= 8;
|
|
12088
|
+
}
|
|
12089
|
+
function temLetraMinuscula() {
|
|
12090
|
+
if (data?.senhaNova) {
|
|
12091
|
+
const result = data?.senhaNova.match(/[a-z]/g);
|
|
12092
|
+
return Array.isArray(result) && result.length > 0;
|
|
12093
|
+
}
|
|
12094
|
+
return false;
|
|
12095
|
+
}
|
|
12096
|
+
function temLetraMaisucula() {
|
|
12097
|
+
if (data?.senhaNova) {
|
|
12098
|
+
const result = data?.senhaNova.match(/[A-Z]/g);
|
|
12099
|
+
return Array.isArray(result) && result.length > 0;
|
|
12100
|
+
}
|
|
12101
|
+
return false;
|
|
12102
|
+
}
|
|
12103
|
+
function temNumero() {
|
|
12104
|
+
if (data?.senhaNova) {
|
|
12105
|
+
const result = data?.senhaNova.match(/\d/g);
|
|
12106
|
+
return Array.isArray(result) && result.length > 0;
|
|
12107
|
+
}
|
|
12108
|
+
return false;
|
|
12109
|
+
}
|
|
12110
|
+
function temCaracterEspecial() {
|
|
12111
|
+
if (data?.senhaNova) {
|
|
12112
|
+
const result = data?.senhaNova.match(/\W/g);
|
|
12113
|
+
return Array.isArray(result) && result.length > 0;
|
|
12114
|
+
}
|
|
12115
|
+
return false;
|
|
12116
|
+
}
|
|
12117
|
+
function asSenhasSaoIguais() {
|
|
12118
|
+
if (data?.senhaNova === "")
|
|
12119
|
+
return false;
|
|
10467
12120
|
return data?.senhaNova === data?.senhaNovaConfirmar;
|
|
10468
12121
|
}
|
|
10469
|
-
return /* @__PURE__ */
|
|
10470
|
-
/* @__PURE__ */
|
|
10471
|
-
/* @__PURE__ */
|
|
10472
|
-
/* @__PURE__ */
|
|
12122
|
+
return /* @__PURE__ */ jsxs79(Dialog_default.Root, { open: isOpen, onClose: (_) => onClose(), maxWidth: "md", children: [
|
|
12123
|
+
/* @__PURE__ */ jsxs79(Dialog_default.Header, { children: [
|
|
12124
|
+
/* @__PURE__ */ jsx169(Dialog_default.Title, { children: "Alterar Senha" }),
|
|
12125
|
+
/* @__PURE__ */ jsx169(Dialog_default.ActionClose, { onClose })
|
|
10473
12126
|
] }),
|
|
10474
|
-
/* @__PURE__ */
|
|
10475
|
-
primeiroAcesso && /* @__PURE__ */
|
|
12127
|
+
/* @__PURE__ */ jsx169(Dialog_default.Content, { children: /* @__PURE__ */ jsxs79(Grid2, { container: true, spacing: 2, children: [
|
|
12128
|
+
primeiroAcesso && /* @__PURE__ */ jsx169(Grid2, { size: 12, children: /* @__PURE__ */ jsxs79(Alert8, { severity: "info", children: [
|
|
10476
12129
|
"Voc\xEA est\xE1 acessando o sistema com uma senha tempor\xE1ria.",
|
|
10477
|
-
/* @__PURE__ */
|
|
12130
|
+
/* @__PURE__ */ jsx169("br", {}),
|
|
10478
12131
|
"Cadastre uma senha segura para deixar sua conta mais protegida."
|
|
10479
12132
|
] }) }),
|
|
10480
|
-
/* @__PURE__ */
|
|
10481
|
-
/* @__PURE__ */
|
|
12133
|
+
/* @__PURE__ */ jsxs79(Grid2, { size: 12, children: [
|
|
12134
|
+
/* @__PURE__ */ jsx169(
|
|
10482
12135
|
PasswordTextField,
|
|
10483
12136
|
{
|
|
10484
12137
|
name: "senhaAtual",
|
|
@@ -10488,19 +12141,19 @@ function AlterarSenha(props) {
|
|
|
10488
12141
|
...validationProps("senhaAtual")
|
|
10489
12142
|
}
|
|
10490
12143
|
),
|
|
10491
|
-
/* @__PURE__ */
|
|
10492
|
-
|
|
12144
|
+
/* @__PURE__ */ jsxs79(
|
|
12145
|
+
Box23,
|
|
10493
12146
|
{
|
|
10494
12147
|
sx: { display: "flex", alignItems: "center", gap: 0.5, mt: 0.5 },
|
|
10495
12148
|
children: [
|
|
10496
|
-
/* @__PURE__ */
|
|
10497
|
-
/* @__PURE__ */
|
|
12149
|
+
/* @__PURE__ */ jsx169(InfoOutlined2, { sx: { fontSize: 14, color: "text.secondary" } }),
|
|
12150
|
+
/* @__PURE__ */ jsx169(Typography28, { variant: "caption", color: "text.secondary", children: "Essa \xE9 a senha que voc\xEA utiliza para acessar o sistema atualmente." })
|
|
10498
12151
|
]
|
|
10499
12152
|
}
|
|
10500
12153
|
)
|
|
10501
12154
|
] }),
|
|
10502
|
-
/* @__PURE__ */
|
|
10503
|
-
/* @__PURE__ */
|
|
12155
|
+
/* @__PURE__ */ jsx169(Grid2, { size: 12, children: /* @__PURE__ */ jsx169(Divider5, {}) }),
|
|
12156
|
+
/* @__PURE__ */ jsx169(Grid2, { size: 12, children: /* @__PURE__ */ jsx169(
|
|
10504
12157
|
PasswordTextField,
|
|
10505
12158
|
{
|
|
10506
12159
|
name: "senhaNova",
|
|
@@ -10510,8 +12163,8 @@ function AlterarSenha(props) {
|
|
|
10510
12163
|
...validationProps("senhaNova")
|
|
10511
12164
|
}
|
|
10512
12165
|
) }),
|
|
10513
|
-
/* @__PURE__ */
|
|
10514
|
-
/* @__PURE__ */
|
|
12166
|
+
/* @__PURE__ */ jsxs79(Grid2, { size: 12, children: [
|
|
12167
|
+
/* @__PURE__ */ jsx169(
|
|
10515
12168
|
PasswordTextField,
|
|
10516
12169
|
{
|
|
10517
12170
|
name: "senhaNovaConfirmar",
|
|
@@ -10521,66 +12174,66 @@ function AlterarSenha(props) {
|
|
|
10521
12174
|
...validationProps("senhaNovaConfirmar")
|
|
10522
12175
|
}
|
|
10523
12176
|
),
|
|
10524
|
-
/* @__PURE__ */
|
|
10525
|
-
|
|
12177
|
+
/* @__PURE__ */ jsxs79(
|
|
12178
|
+
Box23,
|
|
10526
12179
|
{
|
|
10527
12180
|
sx: { display: "flex", alignItems: "center", gap: 0.5, mt: 0.5 },
|
|
10528
12181
|
children: [
|
|
10529
|
-
/* @__PURE__ */
|
|
10530
|
-
/* @__PURE__ */
|
|
12182
|
+
/* @__PURE__ */ jsx169(InfoOutlined2, { sx: { fontSize: 14, color: "text.secondary" } }),
|
|
12183
|
+
/* @__PURE__ */ jsx169(Typography28, { variant: "caption", color: "text.secondary", children: "Informe nos campos acima a nova senha que deseja utilizar." })
|
|
10531
12184
|
]
|
|
10532
12185
|
}
|
|
10533
12186
|
)
|
|
10534
12187
|
] }),
|
|
10535
|
-
/* @__PURE__ */
|
|
10536
|
-
/* @__PURE__ */
|
|
10537
|
-
|
|
12188
|
+
/* @__PURE__ */ jsxs79(Grid2, { size: 12, children: [
|
|
12189
|
+
/* @__PURE__ */ jsx169(
|
|
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
|
-
/* @__PURE__ */
|
|
10544
|
-
|
|
12196
|
+
/* @__PURE__ */ jsx169(
|
|
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
|
-
/* @__PURE__ */
|
|
10551
|
-
|
|
12203
|
+
/* @__PURE__ */ jsx169(
|
|
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
|
-
/* @__PURE__ */
|
|
10558
|
-
|
|
12210
|
+
/* @__PURE__ */ jsx169(
|
|
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
|
-
/* @__PURE__ */
|
|
10565
|
-
|
|
12217
|
+
/* @__PURE__ */ jsx169(
|
|
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
|
-
/* @__PURE__ */
|
|
10572
|
-
|
|
12224
|
+
/* @__PURE__ */ jsx169(
|
|
12225
|
+
ValidatorMessage2,
|
|
10573
12226
|
{
|
|
10574
12227
|
isValid: asSenhasSaoIguais(),
|
|
10575
12228
|
message: "A confirma\xE7\xE3o da nova senha deve ser igual \xE0 nova senha"
|
|
10576
12229
|
}
|
|
10577
12230
|
)
|
|
10578
12231
|
] }),
|
|
10579
|
-
error && /* @__PURE__ */
|
|
12232
|
+
error && /* @__PURE__ */ jsx169(Grid2, { size: 12, children: /* @__PURE__ */ jsx169(Alert8, { severity: "error", children: error }) })
|
|
10580
12233
|
] }) }),
|
|
10581
|
-
/* @__PURE__ */
|
|
10582
|
-
/* @__PURE__ */
|
|
10583
|
-
/* @__PURE__ */
|
|
12234
|
+
/* @__PURE__ */ jsx169(Dialog_default.Footer, { children: /* @__PURE__ */ jsxs79(Dialog_default.Actions, { children: [
|
|
12235
|
+
/* @__PURE__ */ jsx169(Dialog_default.ActionCancelar, { onClick: () => onClose() }),
|
|
12236
|
+
/* @__PURE__ */ jsx169(
|
|
10584
12237
|
Dialog_default.ActionSalvar,
|
|
10585
12238
|
{
|
|
10586
12239
|
label: "Alterar Senha",
|
|
@@ -10594,25 +12247,25 @@ function AlterarSenha(props) {
|
|
|
10594
12247
|
}
|
|
10595
12248
|
|
|
10596
12249
|
// src/MioAuth/components/LoginForm/index.tsx
|
|
10597
|
-
import { jsx as
|
|
10598
|
-
var
|
|
12250
|
+
import { jsx as jsx170, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
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
|
|
12255
|
+
function LoginForm2(props) {
|
|
10603
12256
|
const { onLoginSuccess, onLoginFailed, onOptionsClick, credentialsConfig } = props;
|
|
10604
|
-
const [email, setEmail] =
|
|
10605
|
-
const [password, setPassword] =
|
|
10606
|
-
const [isLoading, setLoading] =
|
|
10607
|
-
const [exibirAlterarSenha, setExibirAlterarSenha] =
|
|
10608
|
-
const [sucessoAlterarSenha, setSucessoAlterarSenha] =
|
|
10609
|
-
const [error, setError] =
|
|
12257
|
+
const [email, setEmail] = useState27("");
|
|
12258
|
+
const [password, setPassword] = useState27("");
|
|
12259
|
+
const [isLoading, setLoading] = useState27(false);
|
|
12260
|
+
const [exibirAlterarSenha, setExibirAlterarSenha] = useState27(false);
|
|
12261
|
+
const [sucessoAlterarSenha, setSucessoAlterarSenha] = useState27(false);
|
|
12262
|
+
const [error, setError] = useState27(null);
|
|
10610
12263
|
const { login } = useCredentials2(credentialsConfig);
|
|
10611
|
-
const { validationProps, setValidationErrors } =
|
|
12264
|
+
const { validationProps, setValidationErrors } = useValidations5();
|
|
10612
12265
|
async function handleLogin() {
|
|
10613
12266
|
setValidationErrors(null);
|
|
10614
12267
|
setError(null);
|
|
10615
|
-
|
|
12268
|
+
schema5.validate({ email, password }, { abortEarly: false }).then(async () => {
|
|
10616
12269
|
setLoading(true);
|
|
10617
12270
|
try {
|
|
10618
12271
|
const loginResponse = await login(email, password);
|
|
@@ -10620,7 +12273,7 @@ function LoginForm(props) {
|
|
|
10620
12273
|
onLoginSuccess(loginResponse);
|
|
10621
12274
|
}
|
|
10622
12275
|
} catch (err) {
|
|
10623
|
-
if (
|
|
12276
|
+
if (isAxiosError4(err)) {
|
|
10624
12277
|
const axiosError = err;
|
|
10625
12278
|
if (axiosError.response?.data.code === "E_FIRST_ACCESS") {
|
|
10626
12279
|
setExibirAlterarSenha(true);
|
|
@@ -10636,14 +12289,14 @@ function LoginForm(props) {
|
|
|
10636
12289
|
setLoading(false);
|
|
10637
12290
|
});
|
|
10638
12291
|
}
|
|
10639
|
-
return /* @__PURE__ */
|
|
10640
|
-
/* @__PURE__ */
|
|
10641
|
-
|
|
12292
|
+
return /* @__PURE__ */ jsxs80(Stack47, { component: "form", onSubmit: handleLogin, children: [
|
|
12293
|
+
/* @__PURE__ */ jsxs80(
|
|
12294
|
+
Stack47,
|
|
10642
12295
|
{
|
|
10643
12296
|
spacing: 2,
|
|
10644
12297
|
children: [
|
|
10645
|
-
/* @__PURE__ */
|
|
10646
|
-
|
|
12298
|
+
/* @__PURE__ */ jsx170(
|
|
12299
|
+
TextField12,
|
|
10647
12300
|
{
|
|
10648
12301
|
name: "email",
|
|
10649
12302
|
label: "E-mail",
|
|
@@ -10654,7 +12307,7 @@ function LoginForm(props) {
|
|
|
10654
12307
|
...validationProps("email")
|
|
10655
12308
|
}
|
|
10656
12309
|
),
|
|
10657
|
-
/* @__PURE__ */
|
|
12310
|
+
/* @__PURE__ */ jsx170(
|
|
10658
12311
|
PasswordTextField,
|
|
10659
12312
|
{
|
|
10660
12313
|
name: "password",
|
|
@@ -10665,7 +12318,7 @@ function LoginForm(props) {
|
|
|
10665
12318
|
...validationProps("password")
|
|
10666
12319
|
}
|
|
10667
12320
|
),
|
|
10668
|
-
/* @__PURE__ */
|
|
12321
|
+
/* @__PURE__ */ jsx170(
|
|
10669
12322
|
Button_default,
|
|
10670
12323
|
{
|
|
10671
12324
|
fullWidth: true,
|
|
@@ -10679,7 +12332,7 @@ function LoginForm(props) {
|
|
|
10679
12332
|
]
|
|
10680
12333
|
}
|
|
10681
12334
|
),
|
|
10682
|
-
/* @__PURE__ */
|
|
12335
|
+
/* @__PURE__ */ jsx170(
|
|
10683
12336
|
Button_default,
|
|
10684
12337
|
{
|
|
10685
12338
|
onClick: () => onOptionsClick("esqueci-senha"),
|
|
@@ -10704,14 +12357,14 @@ function LoginForm(props) {
|
|
|
10704
12357
|
children: "Esqueci a senha"
|
|
10705
12358
|
}
|
|
10706
12359
|
),
|
|
10707
|
-
error && /* @__PURE__ */
|
|
10708
|
-
sucessoAlterarSenha && /* @__PURE__ */
|
|
12360
|
+
error && /* @__PURE__ */ jsx170(Alert9, { severity: "error", children: error }),
|
|
12361
|
+
sucessoAlterarSenha && /* @__PURE__ */ jsxs80(Alert9, { severity: "success", children: [
|
|
10709
12362
|
"Senha cadastrada com sucesso",
|
|
10710
|
-
/* @__PURE__ */
|
|
12363
|
+
/* @__PURE__ */ jsx170("br", {}),
|
|
10711
12364
|
"Tudo pronto para voc\xEA fazer o login"
|
|
10712
12365
|
] }),
|
|
10713
|
-
/* @__PURE__ */
|
|
10714
|
-
|
|
12366
|
+
/* @__PURE__ */ jsxs80(
|
|
12367
|
+
Stack47,
|
|
10715
12368
|
{
|
|
10716
12369
|
direction: "row",
|
|
10717
12370
|
justifyContent: "center",
|
|
@@ -10719,31 +12372,31 @@ function LoginForm(props) {
|
|
|
10719
12372
|
mt: 2,
|
|
10720
12373
|
mb: 2,
|
|
10721
12374
|
children: [
|
|
10722
|
-
/* @__PURE__ */
|
|
10723
|
-
/* @__PURE__ */
|
|
10724
|
-
/* @__PURE__ */
|
|
12375
|
+
/* @__PURE__ */ jsx170(Divider6, { sx: { flexGrow: 1, mr: 1 } }),
|
|
12376
|
+
/* @__PURE__ */ jsx170(Typography29, { children: "Ou fa\xE7a login com" }),
|
|
12377
|
+
/* @__PURE__ */ jsx170(Divider6, { sx: { flexGrow: 1, ml: 1 } })
|
|
10725
12378
|
]
|
|
10726
12379
|
}
|
|
10727
12380
|
),
|
|
10728
|
-
/* @__PURE__ */
|
|
10729
|
-
/* @__PURE__ */
|
|
12381
|
+
/* @__PURE__ */ jsxs80(Stack47, { spacing: 1, children: [
|
|
12382
|
+
/* @__PURE__ */ jsx170(
|
|
10730
12383
|
Button_default,
|
|
10731
12384
|
{
|
|
10732
12385
|
onClick: () => onOptionsClick("otp-email"),
|
|
10733
|
-
startIcon: /* @__PURE__ */
|
|
12386
|
+
startIcon: /* @__PURE__ */ jsx170(Mail2, {}),
|
|
10734
12387
|
children: "Entrar com senha tempor\xE1ria"
|
|
10735
12388
|
}
|
|
10736
12389
|
),
|
|
10737
|
-
/* @__PURE__ */
|
|
12390
|
+
/* @__PURE__ */ jsx170(
|
|
10738
12391
|
Button_default,
|
|
10739
12392
|
{
|
|
10740
12393
|
onClick: () => onOptionsClick("otp-whatsapp"),
|
|
10741
|
-
startIcon: /* @__PURE__ */
|
|
12394
|
+
startIcon: /* @__PURE__ */ jsx170(WhatsApp2, {}),
|
|
10742
12395
|
children: "Entrar com senha tempor\xE1ria"
|
|
10743
12396
|
}
|
|
10744
12397
|
)
|
|
10745
12398
|
] }),
|
|
10746
|
-
/* @__PURE__ */
|
|
12399
|
+
/* @__PURE__ */ jsx170(
|
|
10747
12400
|
AlterarSenha,
|
|
10748
12401
|
{
|
|
10749
12402
|
senhaAtual: password,
|
|
@@ -10763,24 +12416,24 @@ function LoginForm(props) {
|
|
|
10763
12416
|
}
|
|
10764
12417
|
|
|
10765
12418
|
// src/MioAuth/components/EsqueciSenhaForm/index.tsx
|
|
10766
|
-
import { useState as
|
|
10767
|
-
import { Alert as
|
|
10768
|
-
import { useCredentials as useCredentials3, useValidations as
|
|
10769
|
-
import { jsx as
|
|
10770
|
-
var
|
|
12419
|
+
import { useState as useState28 } from "react";
|
|
12420
|
+
import { Alert as Alert10, Box as Box24, TextField as TextField13 } from "@mui/material";
|
|
12421
|
+
import { useCredentials as useCredentials3, useValidations as useValidations6 } from "@data-c/hooks";
|
|
12422
|
+
import { jsx as jsx171, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
12423
|
+
var schema6 = create$3().shape({
|
|
10771
12424
|
email: create$6().required("Informe o e-mail")
|
|
10772
12425
|
});
|
|
10773
|
-
function
|
|
12426
|
+
function EsqueciSenhaForm2(props) {
|
|
10774
12427
|
const { onLoginClick, credentialsConfig } = props;
|
|
10775
|
-
const [email, setEmail] =
|
|
10776
|
-
const [isSubmitting, setSubmitting] =
|
|
10777
|
-
const [sucessoRecuperarSenha, setSucessoRecuperarSenha] =
|
|
10778
|
-
const [error, setError] =
|
|
12428
|
+
const [email, setEmail] = useState28("");
|
|
12429
|
+
const [isSubmitting, setSubmitting] = useState28(false);
|
|
12430
|
+
const [sucessoRecuperarSenha, setSucessoRecuperarSenha] = useState28(false);
|
|
12431
|
+
const [error, setError] = useState28(null);
|
|
10779
12432
|
const { recuperarSenha } = useCredentials3(credentialsConfig);
|
|
10780
|
-
const { validationProps, setValidationErrors } =
|
|
12433
|
+
const { validationProps, setValidationErrors } = useValidations6();
|
|
10781
12434
|
async function handleRecuperarSenha() {
|
|
10782
12435
|
setValidationErrors(null);
|
|
10783
|
-
|
|
12436
|
+
schema6.validate({ email }, { abortEarly: false }).then(async () => {
|
|
10784
12437
|
try {
|
|
10785
12438
|
setSubmitting(true);
|
|
10786
12439
|
await recuperarSenha(email);
|
|
@@ -10794,9 +12447,9 @@ function EsqueciSenhaForm(props) {
|
|
|
10794
12447
|
setValidationErrors(error2);
|
|
10795
12448
|
});
|
|
10796
12449
|
}
|
|
10797
|
-
return /* @__PURE__ */
|
|
10798
|
-
/* @__PURE__ */
|
|
10799
|
-
|
|
12450
|
+
return /* @__PURE__ */ jsxs81(Box24, { component: "form", children: [
|
|
12451
|
+
/* @__PURE__ */ jsx171(
|
|
12452
|
+
TextField13,
|
|
10800
12453
|
{
|
|
10801
12454
|
name: "email",
|
|
10802
12455
|
label: "E-mail",
|
|
@@ -10808,7 +12461,7 @@ function EsqueciSenhaForm(props) {
|
|
|
10808
12461
|
...validationProps("email")
|
|
10809
12462
|
}
|
|
10810
12463
|
),
|
|
10811
|
-
/* @__PURE__ */
|
|
12464
|
+
/* @__PURE__ */ jsx171(
|
|
10812
12465
|
Button_default,
|
|
10813
12466
|
{
|
|
10814
12467
|
fullWidth: true,
|
|
@@ -10818,7 +12471,7 @@ function EsqueciSenhaForm(props) {
|
|
|
10818
12471
|
children: "Recuperar minha senha"
|
|
10819
12472
|
}
|
|
10820
12473
|
),
|
|
10821
|
-
/* @__PURE__ */
|
|
12474
|
+
/* @__PURE__ */ jsx171(
|
|
10822
12475
|
ButtonContainer,
|
|
10823
12476
|
{
|
|
10824
12477
|
sx: {
|
|
@@ -10827,7 +12480,7 @@ function EsqueciSenhaForm(props) {
|
|
|
10827
12480
|
width: "100%",
|
|
10828
12481
|
marginTop: 1
|
|
10829
12482
|
},
|
|
10830
|
-
children: /* @__PURE__ */
|
|
12483
|
+
children: /* @__PURE__ */ jsx171(
|
|
10831
12484
|
Button_default,
|
|
10832
12485
|
{
|
|
10833
12486
|
onClick: onLoginClick,
|
|
@@ -10843,11 +12496,11 @@ function EsqueciSenhaForm(props) {
|
|
|
10843
12496
|
)
|
|
10844
12497
|
}
|
|
10845
12498
|
),
|
|
10846
|
-
sucessoRecuperarSenha && /* @__PURE__ */
|
|
10847
|
-
|
|
12499
|
+
sucessoRecuperarSenha && /* @__PURE__ */ jsx171(
|
|
12500
|
+
Alert10,
|
|
10848
12501
|
{
|
|
10849
12502
|
severity: "success",
|
|
10850
|
-
action: /* @__PURE__ */
|
|
12503
|
+
action: /* @__PURE__ */ jsx171(
|
|
10851
12504
|
Button_default,
|
|
10852
12505
|
{
|
|
10853
12506
|
onClick: onLoginClick,
|
|
@@ -10864,20 +12517,20 @@ function EsqueciSenhaForm(props) {
|
|
|
10864
12517
|
children: "Enviamos para o seu e-mail as instru\xE7\xF5es para recuperar a sua senha"
|
|
10865
12518
|
}
|
|
10866
12519
|
),
|
|
10867
|
-
error && /* @__PURE__ */
|
|
12520
|
+
error && /* @__PURE__ */ jsx171(Alert10, { severity: "error", children: error })
|
|
10868
12521
|
] });
|
|
10869
12522
|
}
|
|
10870
12523
|
|
|
10871
12524
|
// src/MioAuth/components/LicencaForm/index.tsx
|
|
10872
|
-
import { useEffect as
|
|
10873
|
-
import { Box as
|
|
12525
|
+
import { useEffect as useEffect21, useState as useState29 } from "react";
|
|
12526
|
+
import { Box as Box25, MenuItem as MenuItem7, TextField as TextField14 } from "@mui/material";
|
|
10874
12527
|
import { useCredentials as useCredentials4 } from "@data-c/hooks";
|
|
10875
|
-
import { jsx as
|
|
10876
|
-
function
|
|
12528
|
+
import { jsx as jsx172, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
12529
|
+
function LicencaForm2(props) {
|
|
10877
12530
|
const { loginData, credentialsConfig, onLoginFailed, onLoginSuccess } = props;
|
|
10878
|
-
const [empresaId, setEmpresaId] =
|
|
12531
|
+
const [empresaId, setEmpresaId] = useState29("");
|
|
10879
12532
|
const { selecionarLicenca, isSubmitting } = useCredentials4(credentialsConfig);
|
|
10880
|
-
|
|
12533
|
+
useEffect21(() => {
|
|
10881
12534
|
if (Array.isArray(loginData?.empresas)) {
|
|
10882
12535
|
const empresa = loginData?.empresas[0];
|
|
10883
12536
|
setEmpresaId(empresa?.uuid);
|
|
@@ -10895,9 +12548,9 @@ function LicencaForm(props) {
|
|
|
10895
12548
|
onLoginFailed(err);
|
|
10896
12549
|
}
|
|
10897
12550
|
}
|
|
10898
|
-
return /* @__PURE__ */
|
|
10899
|
-
/* @__PURE__ */
|
|
10900
|
-
|
|
12551
|
+
return /* @__PURE__ */ jsxs82(Box25, { component: "form", sx: { minWidth: "290px" }, children: [
|
|
12552
|
+
/* @__PURE__ */ jsx172(
|
|
12553
|
+
TextField14,
|
|
10901
12554
|
{
|
|
10902
12555
|
label: "Licen\xE7as",
|
|
10903
12556
|
margin: "normal",
|
|
@@ -10907,10 +12560,10 @@ function LicencaForm(props) {
|
|
|
10907
12560
|
onChange: (e) => {
|
|
10908
12561
|
setEmpresaId(e.target.value);
|
|
10909
12562
|
},
|
|
10910
|
-
children: loginData?.empresas?.map((empresa) => /* @__PURE__ */
|
|
12563
|
+
children: loginData?.empresas?.map((empresa) => /* @__PURE__ */ jsx172(MenuItem7, { value: empresa.uuid, children: empresa.nome }, empresa.uuid))
|
|
10911
12564
|
}
|
|
10912
12565
|
),
|
|
10913
|
-
/* @__PURE__ */
|
|
12566
|
+
/* @__PURE__ */ jsx172(
|
|
10914
12567
|
Button_default,
|
|
10915
12568
|
{
|
|
10916
12569
|
fullWidth: true,
|
|
@@ -10925,7 +12578,7 @@ function LicencaForm(props) {
|
|
|
10925
12578
|
}
|
|
10926
12579
|
|
|
10927
12580
|
// src/MioAuth/components/LoginSection/index.tsx
|
|
10928
|
-
import { useEffect as
|
|
12581
|
+
import { useEffect as useEffect23, useState as useState32 } from "react";
|
|
10929
12582
|
import {
|
|
10930
12583
|
useCredentials as useCredentials7
|
|
10931
12584
|
} from "@data-c/hooks";
|
|
@@ -10933,129 +12586,26 @@ import {
|
|
|
10933
12586
|
// src/MioAuth/components/OtpForm/index.tsx
|
|
10934
12587
|
import {
|
|
10935
12588
|
useCredentials as useCredentials6,
|
|
10936
|
-
useForm as
|
|
12589
|
+
useForm as useForm4
|
|
10937
12590
|
} from "@data-c/hooks";
|
|
10938
|
-
import
|
|
10939
|
-
import { Alert as
|
|
10940
|
-
import { useState as
|
|
10941
|
-
|
|
10942
|
-
// src/WhastappTextField/index.tsx
|
|
10943
|
-
import { useState as useState21, useMemo as useMemo10 } from "react";
|
|
10944
|
-
import TextField9 from "@mui/material/TextField";
|
|
10945
|
-
import { jsx as jsx158 } from "react/jsx-runtime";
|
|
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] = useState21("");
|
|
10962
|
-
const isControlled = propValue !== void 0;
|
|
10963
|
-
const displayedValue = useMemo10(() => {
|
|
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__ */ jsx158(
|
|
10983
|
-
TextField9,
|
|
10984
|
-
{
|
|
10985
|
-
value: displayedValue,
|
|
10986
|
-
onChange: handleChange,
|
|
10987
|
-
inputProps: { maxLength: 15 },
|
|
10988
|
-
...rest
|
|
10989
|
-
}
|
|
10990
|
-
);
|
|
10991
|
-
}
|
|
12591
|
+
import HelpOutline2 from "@mui/icons-material/HelpOutline";
|
|
12592
|
+
import { Alert as Alert12, IconButton as IconButton15, Stack as Stack49, TextField as TextField15, Typography as Typography31 } from "@mui/material";
|
|
12593
|
+
import { useState as useState31 } from "react";
|
|
10992
12594
|
|
|
10993
12595
|
// src/MioAuth/components/OtpForm/DialogVerificarOtp.tsx
|
|
10994
12596
|
import {
|
|
10995
12597
|
useCredentials as useCredentials5
|
|
10996
12598
|
} from "@data-c/hooks";
|
|
10997
|
-
import { Alert as
|
|
10998
|
-
import { useEffect as
|
|
10999
|
-
|
|
11000
|
-
|
|
11001
|
-
import { useRef as useRef5 } from "react";
|
|
11002
|
-
import { Box as Box20, TextField as TextField10 } from "@mui/material";
|
|
11003
|
-
import { jsx as jsx159 } from "react/jsx-runtime";
|
|
11004
|
-
function VerificationCodeInput({
|
|
11005
|
-
length = 6,
|
|
11006
|
-
value,
|
|
11007
|
-
onChange
|
|
11008
|
-
}) {
|
|
11009
|
-
const inputsRef = useRef5([]);
|
|
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
|
-
inputsRef.current[index + 1]?.focus();
|
|
11019
|
-
}
|
|
11020
|
-
};
|
|
11021
|
-
const handleKeyDown = (index, event) => {
|
|
11022
|
-
if (event.key === "Backspace" && !value[index] && index > 0) {
|
|
11023
|
-
inputsRef.current[index - 1]?.focus();
|
|
11024
|
-
}
|
|
11025
|
-
};
|
|
11026
|
-
return /* @__PURE__ */ jsx159(Box20, { display: "flex", gap: 1, children: Array.from({ length }).map((_, i) => /* @__PURE__ */ jsx159(
|
|
11027
|
-
TextField10,
|
|
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
|
-
import { jsx as jsx160, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
11052
|
-
function DialogVerificarOtp(props) {
|
|
12599
|
+
import { Alert as Alert11, Stack as Stack48, Typography as Typography30 } from "@mui/material";
|
|
12600
|
+
import { useEffect as useEffect22, useState as useState30 } from "react";
|
|
12601
|
+
import { jsx as jsx173, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
12602
|
+
function DialogVerificarOtp2(props) {
|
|
11053
12603
|
const { open, onClose, payload, onLoginSuccess, credentialsConfig } = props;
|
|
11054
|
-
const [code, setCode] =
|
|
11055
|
-
const [error, setError] =
|
|
11056
|
-
const [isLoading, setLoading] =
|
|
12604
|
+
const [code, setCode] = useState30("");
|
|
12605
|
+
const [error, setError] = useState30(false);
|
|
12606
|
+
const [isLoading, setLoading] = useState30(false);
|
|
11057
12607
|
const { validarOtpVerificationCode } = useCredentials5(credentialsConfig);
|
|
11058
|
-
|
|
12608
|
+
useEffect22(() => {
|
|
11059
12609
|
if (error) {
|
|
11060
12610
|
setTimeout(() => {
|
|
11061
12611
|
setError(false);
|
|
@@ -11080,35 +12630,35 @@ function DialogVerificarOtp(props) {
|
|
|
11080
12630
|
setLoading(false);
|
|
11081
12631
|
}
|
|
11082
12632
|
}
|
|
11083
|
-
return /* @__PURE__ */
|
|
11084
|
-
/* @__PURE__ */
|
|
11085
|
-
/* @__PURE__ */
|
|
11086
|
-
/* @__PURE__ */
|
|
12633
|
+
return /* @__PURE__ */ jsxs83(Dialog_default.Root, { open, onClose: (_) => onClose(), maxWidth: "xs", children: [
|
|
12634
|
+
/* @__PURE__ */ jsxs83(Dialog_default.Header, { children: [
|
|
12635
|
+
/* @__PURE__ */ jsx173(Dialog_default.Title, { children: "Entrar com senha tempor\xE1ria" }),
|
|
12636
|
+
/* @__PURE__ */ jsx173(Dialog_default.ActionClose, { onClose })
|
|
11087
12637
|
] }),
|
|
11088
|
-
/* @__PURE__ */
|
|
11089
|
-
|
|
12638
|
+
/* @__PURE__ */ jsx173(Dialog_default.Content, { children: /* @__PURE__ */ jsxs83(
|
|
12639
|
+
Stack48,
|
|
11090
12640
|
{
|
|
11091
12641
|
spacing: 2,
|
|
11092
12642
|
justifyContent: "center",
|
|
11093
12643
|
alignContent: "center",
|
|
11094
12644
|
alignItems: "center",
|
|
11095
12645
|
children: [
|
|
11096
|
-
/* @__PURE__ */
|
|
11097
|
-
|
|
12646
|
+
/* @__PURE__ */ jsx173(
|
|
12647
|
+
Typography30,
|
|
11098
12648
|
{
|
|
11099
12649
|
variant: "subtitle1",
|
|
11100
12650
|
sx: { fontWeight: "bolder", fontSize: "11pt" },
|
|
11101
12651
|
children: "\u{1F510} Digite a senha tempor\xE1ria para acessar sua conta"
|
|
11102
12652
|
}
|
|
11103
12653
|
),
|
|
11104
|
-
/* @__PURE__ */
|
|
12654
|
+
/* @__PURE__ */ jsxs83(Typography30, { variant: "body1", sx: { fontSize: "10pt" }, children: [
|
|
11105
12655
|
"Enviamos uma senha tempor\xE1ria para ",
|
|
11106
|
-
/* @__PURE__ */
|
|
12656
|
+
/* @__PURE__ */ jsx173("b", { children: payload.target }),
|
|
11107
12657
|
". ",
|
|
11108
|
-
/* @__PURE__ */
|
|
12658
|
+
/* @__PURE__ */ jsx173("br", {}),
|
|
11109
12659
|
"Digite o c\xF3digo abaixo para acessar sua conta."
|
|
11110
12660
|
] }),
|
|
11111
|
-
/* @__PURE__ */
|
|
12661
|
+
/* @__PURE__ */ jsx173(
|
|
11112
12662
|
VerificationCodeInput,
|
|
11113
12663
|
{
|
|
11114
12664
|
value: code,
|
|
@@ -11117,13 +12667,13 @@ function DialogVerificarOtp(props) {
|
|
|
11117
12667
|
}
|
|
11118
12668
|
}
|
|
11119
12669
|
),
|
|
11120
|
-
error && /* @__PURE__ */
|
|
12670
|
+
error && /* @__PURE__ */ jsx173(Alert11, { sx: { flexGrow: 1 }, severity: "error", children: error })
|
|
11121
12671
|
]
|
|
11122
12672
|
}
|
|
11123
12673
|
) }),
|
|
11124
|
-
/* @__PURE__ */
|
|
11125
|
-
/* @__PURE__ */
|
|
11126
|
-
/* @__PURE__ */
|
|
12674
|
+
/* @__PURE__ */ jsx173(Dialog_default.Footer, { children: /* @__PURE__ */ jsxs83(Dialog_default.Actions, { children: [
|
|
12675
|
+
/* @__PURE__ */ jsx173(Dialog_default.ActionCancelar, { onClick: () => onClose() }),
|
|
12676
|
+
/* @__PURE__ */ jsx173(
|
|
11127
12677
|
Dialog_default.ActionSalvar,
|
|
11128
12678
|
{
|
|
11129
12679
|
label: "Entrar",
|
|
@@ -11137,19 +12687,19 @@ function DialogVerificarOtp(props) {
|
|
|
11137
12687
|
}
|
|
11138
12688
|
|
|
11139
12689
|
// src/MioAuth/components/OtpForm/index.tsx
|
|
11140
|
-
import { Fragment as
|
|
11141
|
-
var
|
|
11142
|
-
contato: create$6().when("$tipo", ([tipo],
|
|
11143
|
-
return tipo === "otp-email" ?
|
|
12690
|
+
import { Fragment as Fragment11, jsx as jsx174, jsxs as jsxs84 } from "react/jsx-runtime";
|
|
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
|
|
12696
|
+
function OtpForm2(props) {
|
|
11147
12697
|
const { tipo, credentialsConfig, onLoginSuccess, onLoginClick } = props;
|
|
11148
|
-
const [isLoading, setLoading] =
|
|
11149
|
-
const [error, setError] =
|
|
12698
|
+
const [isLoading, setLoading] = useState31(false);
|
|
12699
|
+
const [error, setError] = useState31(false);
|
|
11150
12700
|
const { gerarOtpVerificationCode } = useCredentials6(credentialsConfig);
|
|
11151
|
-
const { handleChange, changeValue, data, validate, validationErrors } =
|
|
11152
|
-
const [isOpenVerificar, setOpenVerificar] =
|
|
12701
|
+
const { handleChange, changeValue, data, validate, validationErrors } = useForm4({ contato: "" }, contatoSchema2);
|
|
12702
|
+
const [isOpenVerificar, setOpenVerificar] = useState31(false);
|
|
11153
12703
|
const handleSubmit = async (e) => {
|
|
11154
12704
|
e.preventDefault();
|
|
11155
12705
|
validate(
|
|
@@ -11171,11 +12721,11 @@ function OtpForm(props) {
|
|
|
11171
12721
|
{ context: { tipo } }
|
|
11172
12722
|
);
|
|
11173
12723
|
};
|
|
11174
|
-
return /* @__PURE__ */
|
|
11175
|
-
/* @__PURE__ */
|
|
11176
|
-
/* @__PURE__ */
|
|
11177
|
-
tipo === "otp-email" && /* @__PURE__ */
|
|
11178
|
-
|
|
12724
|
+
return /* @__PURE__ */ jsxs84(Fragment11, { children: [
|
|
12725
|
+
/* @__PURE__ */ jsx174("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsxs84(Stack49, { spacing: 2, children: [
|
|
12726
|
+
/* @__PURE__ */ jsx174(Typography31, { 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" }),
|
|
12727
|
+
tipo === "otp-email" && /* @__PURE__ */ jsx174(
|
|
12728
|
+
TextField15,
|
|
11179
12729
|
{
|
|
11180
12730
|
autoFocus: true,
|
|
11181
12731
|
name: "contato",
|
|
@@ -11186,7 +12736,7 @@ function OtpForm(props) {
|
|
|
11186
12736
|
...validationErrors("contato")
|
|
11187
12737
|
}
|
|
11188
12738
|
),
|
|
11189
|
-
tipo === "otp-whatsapp" && /* @__PURE__ */
|
|
12739
|
+
tipo === "otp-whatsapp" && /* @__PURE__ */ jsx174(
|
|
11190
12740
|
WhatsAppTextField,
|
|
11191
12741
|
{
|
|
11192
12742
|
autoFocus: true,
|
|
@@ -11200,8 +12750,8 @@ function OtpForm(props) {
|
|
|
11200
12750
|
...validationErrors("contato")
|
|
11201
12751
|
}
|
|
11202
12752
|
),
|
|
11203
|
-
/* @__PURE__ */
|
|
11204
|
-
/* @__PURE__ */
|
|
12753
|
+
/* @__PURE__ */ jsxs84(Stack49, { children: [
|
|
12754
|
+
/* @__PURE__ */ jsx174(
|
|
11205
12755
|
Button_default,
|
|
11206
12756
|
{
|
|
11207
12757
|
isLoading,
|
|
@@ -11211,7 +12761,7 @@ function OtpForm(props) {
|
|
|
11211
12761
|
children: "Enviar c\xF3digo"
|
|
11212
12762
|
}
|
|
11213
12763
|
),
|
|
11214
|
-
/* @__PURE__ */
|
|
12764
|
+
/* @__PURE__ */ jsxs84(
|
|
11215
12765
|
ButtonContainer,
|
|
11216
12766
|
{
|
|
11217
12767
|
sx: {
|
|
@@ -11221,7 +12771,7 @@ function OtpForm(props) {
|
|
|
11221
12771
|
marginTop: 1
|
|
11222
12772
|
},
|
|
11223
12773
|
children: [
|
|
11224
|
-
/* @__PURE__ */
|
|
12774
|
+
/* @__PURE__ */ jsx174(
|
|
11225
12775
|
Button_default,
|
|
11226
12776
|
{
|
|
11227
12777
|
onClick: onLoginClick,
|
|
@@ -11235,23 +12785,23 @@ function OtpForm(props) {
|
|
|
11235
12785
|
children: "Voltar para o Login"
|
|
11236
12786
|
}
|
|
11237
12787
|
),
|
|
11238
|
-
/* @__PURE__ */
|
|
12788
|
+
/* @__PURE__ */ jsx174(
|
|
11239
12789
|
"a",
|
|
11240
12790
|
{
|
|
11241
12791
|
href: "https://datacsistemashelp.zendesk.com/hc/pt-br/articles/36489079108756-Login-OTP-via-WhatsApp",
|
|
11242
12792
|
target: "_blank",
|
|
11243
12793
|
rel: "noopener noreferrer",
|
|
11244
|
-
children: /* @__PURE__ */
|
|
12794
|
+
children: /* @__PURE__ */ jsx174(IconButton15, { children: /* @__PURE__ */ jsx174(HelpOutline2, { color: "primary" }) })
|
|
11245
12795
|
}
|
|
11246
12796
|
)
|
|
11247
12797
|
]
|
|
11248
12798
|
}
|
|
11249
12799
|
)
|
|
11250
12800
|
] }),
|
|
11251
|
-
error && /* @__PURE__ */
|
|
12801
|
+
error && /* @__PURE__ */ jsx174(Alert12, { severity: "error", children: error })
|
|
11252
12802
|
] }) }),
|
|
11253
|
-
/* @__PURE__ */
|
|
11254
|
-
|
|
12803
|
+
/* @__PURE__ */ jsx174(
|
|
12804
|
+
DialogVerificarOtp2,
|
|
11255
12805
|
{
|
|
11256
12806
|
onLoginSuccess,
|
|
11257
12807
|
open: isOpenVerificar,
|
|
@@ -11269,15 +12819,15 @@ function OtpForm(props) {
|
|
|
11269
12819
|
}
|
|
11270
12820
|
|
|
11271
12821
|
// src/MioAuth/components/LoginSection/index.tsx
|
|
11272
|
-
import { jsx as
|
|
11273
|
-
var
|
|
12822
|
+
import { jsx as jsx175, jsxs as jsxs85 } from "react/jsx-runtime";
|
|
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
|
|
12830
|
+
function LoginSection2(props) {
|
|
11281
12831
|
const {
|
|
11282
12832
|
credentialsConfig,
|
|
11283
12833
|
onLoginSuccess,
|
|
@@ -11285,12 +12835,12 @@ function LoginSection(props) {
|
|
|
11285
12835
|
onAlreadyLogged,
|
|
11286
12836
|
appName
|
|
11287
12837
|
} = props;
|
|
11288
|
-
const [loginData, setLoginData] =
|
|
12838
|
+
const [loginData, setLoginData] = useState32();
|
|
11289
12839
|
const { selecionarLicenca, isAuthenticated } = useCredentials7(credentialsConfig);
|
|
11290
|
-
const [view, setView] =
|
|
11291
|
-
const theme2 =
|
|
11292
|
-
const fullScreen =
|
|
11293
|
-
|
|
12840
|
+
const [view, setView] = useState32("login");
|
|
12841
|
+
const theme2 = useTheme14();
|
|
12842
|
+
const fullScreen = useMediaQuery8(theme2.breakpoints.up("md"));
|
|
12843
|
+
useEffect23(() => {
|
|
11294
12844
|
if (isAuthenticated && onAlreadyLogged) {
|
|
11295
12845
|
onAlreadyLogged();
|
|
11296
12846
|
}
|
|
@@ -11326,12 +12876,12 @@ function LoginSection(props) {
|
|
|
11326
12876
|
function handleExibirLogin() {
|
|
11327
12877
|
setView("login");
|
|
11328
12878
|
}
|
|
11329
|
-
const pageLabel =
|
|
11330
|
-
return /* @__PURE__ */
|
|
11331
|
-
/* @__PURE__ */
|
|
11332
|
-
/* @__PURE__ */
|
|
11333
|
-
view === "login" && /* @__PURE__ */
|
|
11334
|
-
|
|
12879
|
+
const pageLabel = pageLabelMap2[view];
|
|
12880
|
+
return /* @__PURE__ */ jsxs85(Stack50, { children: [
|
|
12881
|
+
/* @__PURE__ */ jsx175(Header, { label: appName, subTitle: pageLabel }),
|
|
12882
|
+
/* @__PURE__ */ jsxs85(Box26, { sx: { marginTop: 2 }, children: [
|
|
12883
|
+
view === "login" && /* @__PURE__ */ jsx175(
|
|
12884
|
+
LoginForm2,
|
|
11335
12885
|
{
|
|
11336
12886
|
credentialsConfig,
|
|
11337
12887
|
onLoginSuccess: handleLoginSuccess,
|
|
@@ -11339,8 +12889,8 @@ function LoginSection(props) {
|
|
|
11339
12889
|
onOptionsClick: handleOptionsClick
|
|
11340
12890
|
}
|
|
11341
12891
|
),
|
|
11342
|
-
view === "licensa" && /* @__PURE__ */
|
|
11343
|
-
|
|
12892
|
+
view === "licensa" && /* @__PURE__ */ jsx175(
|
|
12893
|
+
LicencaForm2,
|
|
11344
12894
|
{
|
|
11345
12895
|
loginData,
|
|
11346
12896
|
credentialsConfig,
|
|
@@ -11348,15 +12898,15 @@ function LoginSection(props) {
|
|
|
11348
12898
|
onLoginFailed
|
|
11349
12899
|
}
|
|
11350
12900
|
),
|
|
11351
|
-
view === "esqueci-senha" && /* @__PURE__ */
|
|
11352
|
-
|
|
12901
|
+
view === "esqueci-senha" && /* @__PURE__ */ jsx175(
|
|
12902
|
+
EsqueciSenhaForm2,
|
|
11353
12903
|
{
|
|
11354
12904
|
onLoginClick: handleExibirLogin,
|
|
11355
12905
|
credentialsConfig
|
|
11356
12906
|
}
|
|
11357
12907
|
),
|
|
11358
|
-
view === "otp-email" && /* @__PURE__ */
|
|
11359
|
-
|
|
12908
|
+
view === "otp-email" && /* @__PURE__ */ jsx175(
|
|
12909
|
+
OtpForm2,
|
|
11360
12910
|
{
|
|
11361
12911
|
onLoginClick: handleExibirLogin,
|
|
11362
12912
|
onLoginSuccess: handleLoginSuccess,
|
|
@@ -11364,8 +12914,8 @@ function LoginSection(props) {
|
|
|
11364
12914
|
credentialsConfig
|
|
11365
12915
|
}
|
|
11366
12916
|
),
|
|
11367
|
-
view === "otp-whatsapp" && /* @__PURE__ */
|
|
11368
|
-
|
|
12917
|
+
view === "otp-whatsapp" && /* @__PURE__ */ jsx175(
|
|
12918
|
+
OtpForm2,
|
|
11369
12919
|
{
|
|
11370
12920
|
onLoginClick: handleExibirLogin,
|
|
11371
12921
|
onLoginSuccess: handleLoginSuccess,
|
|
@@ -11378,14 +12928,14 @@ function LoginSection(props) {
|
|
|
11378
12928
|
}
|
|
11379
12929
|
|
|
11380
12930
|
// src/MioAuth/components/DefaultBanner/index.tsx
|
|
11381
|
-
import
|
|
11382
|
-
import { Link, Stack as
|
|
11383
|
-
import { jsx as
|
|
11384
|
-
function
|
|
11385
|
-
const theme2 =
|
|
11386
|
-
const fullScreen =
|
|
11387
|
-
return /* @__PURE__ */
|
|
11388
|
-
|
|
12931
|
+
import ArrowRight2 from "@mui/icons-material/ArrowRight";
|
|
12932
|
+
import { Link as Link2, Stack as Stack51, Typography as Typography33, useMediaQuery as useMediaQuery9, useTheme as useTheme15 } from "@mui/material";
|
|
12933
|
+
import { jsx as jsx176, jsxs as jsxs86 } from "react/jsx-runtime";
|
|
12934
|
+
function DefaultBanner2() {
|
|
12935
|
+
const theme2 = useTheme15();
|
|
12936
|
+
const fullScreen = useMediaQuery9(theme2.breakpoints.up("md"));
|
|
12937
|
+
return /* @__PURE__ */ jsx176(
|
|
12938
|
+
Stack51,
|
|
11389
12939
|
{
|
|
11390
12940
|
component: "section",
|
|
11391
12941
|
display: fullScreen ? "flex" : "none",
|
|
@@ -11399,9 +12949,9 @@ function DefaultBanner() {
|
|
|
11399
12949
|
backgroundPosition: "right",
|
|
11400
12950
|
backgroundRepeat: "no-repeat"
|
|
11401
12951
|
},
|
|
11402
|
-
children: /* @__PURE__ */
|
|
11403
|
-
/* @__PURE__ */
|
|
11404
|
-
|
|
12952
|
+
children: /* @__PURE__ */ jsxs86(Stack51, { padding: "2rem", children: [
|
|
12953
|
+
/* @__PURE__ */ jsx176(
|
|
12954
|
+
Typography33,
|
|
11405
12955
|
{
|
|
11406
12956
|
component: "h1",
|
|
11407
12957
|
fontSize: "3.5rem",
|
|
@@ -11413,8 +12963,8 @@ function DefaultBanner() {
|
|
|
11413
12963
|
children: "Inova\xE7\xE3o e tecnologia"
|
|
11414
12964
|
}
|
|
11415
12965
|
),
|
|
11416
|
-
/* @__PURE__ */
|
|
11417
|
-
|
|
12966
|
+
/* @__PURE__ */ jsx176(
|
|
12967
|
+
Typography33,
|
|
11418
12968
|
{
|
|
11419
12969
|
component: "h2",
|
|
11420
12970
|
color: "white",
|
|
@@ -11426,8 +12976,8 @@ function DefaultBanner() {
|
|
|
11426
12976
|
children: "para empresas de resultado"
|
|
11427
12977
|
}
|
|
11428
12978
|
),
|
|
11429
|
-
/* @__PURE__ */
|
|
11430
|
-
|
|
12979
|
+
/* @__PURE__ */ jsx176(
|
|
12980
|
+
Typography33,
|
|
11431
12981
|
{
|
|
11432
12982
|
component: "span",
|
|
11433
12983
|
fontSize: "1.25rem",
|
|
@@ -11441,7 +12991,7 @@ function DefaultBanner() {
|
|
|
11441
12991
|
children: "Mais de 30 anos de exist\xEAncia e muitas hist\xF3rias de sucesso."
|
|
11442
12992
|
}
|
|
11443
12993
|
),
|
|
11444
|
-
/* @__PURE__ */
|
|
12994
|
+
/* @__PURE__ */ jsx176(Link2, { href: "https://site.datac.com.br/services/", target: "_blank", children: /* @__PURE__ */ jsxs86(
|
|
11445
12995
|
Button_default,
|
|
11446
12996
|
{
|
|
11447
12997
|
component: "a",
|
|
@@ -11464,8 +13014,8 @@ function DefaultBanner() {
|
|
|
11464
13014
|
},
|
|
11465
13015
|
children: [
|
|
11466
13016
|
"Conhe\xE7a nossos produtos",
|
|
11467
|
-
/* @__PURE__ */
|
|
11468
|
-
|
|
13017
|
+
/* @__PURE__ */ jsx176(
|
|
13018
|
+
ArrowRight2,
|
|
11469
13019
|
{
|
|
11470
13020
|
fontSize: "medium",
|
|
11471
13021
|
sx: { color: (theme3) => theme3.palette.success.light }
|
|
@@ -11480,12 +13030,12 @@ function DefaultBanner() {
|
|
|
11480
13030
|
}
|
|
11481
13031
|
|
|
11482
13032
|
// src/MioAuth/index.tsx
|
|
11483
|
-
import { jsx as
|
|
11484
|
-
function
|
|
11485
|
-
const theme2 =
|
|
11486
|
-
const fullScreen =
|
|
11487
|
-
return /* @__PURE__ */
|
|
11488
|
-
|
|
13033
|
+
import { jsx as jsx177, jsxs as jsxs87 } from "react/jsx-runtime";
|
|
13034
|
+
function LoginContainer2({ children }) {
|
|
13035
|
+
const theme2 = useTheme16();
|
|
13036
|
+
const fullScreen = useMediaQuery10(theme2.breakpoints.up("md"));
|
|
13037
|
+
return /* @__PURE__ */ jsxs87(
|
|
13038
|
+
Stack52,
|
|
11489
13039
|
{
|
|
11490
13040
|
component: "section",
|
|
11491
13041
|
width: fullScreen ? "46%" : "100%",
|
|
@@ -11495,17 +13045,17 @@ function LoginContainer({ children }) {
|
|
|
11495
13045
|
alignItems: "center",
|
|
11496
13046
|
padding: "2rem",
|
|
11497
13047
|
children: [
|
|
11498
|
-
/* @__PURE__ */
|
|
11499
|
-
/* @__PURE__ */
|
|
11500
|
-
/* @__PURE__ */
|
|
13048
|
+
/* @__PURE__ */ jsx177(Stack52, { width: "100%", maxWidth: "28rem", margin: "auto 0", children }),
|
|
13049
|
+
/* @__PURE__ */ jsxs87(Stack52, { direction: "row", alignItems: "center", marginBottom: -3, children: [
|
|
13050
|
+
/* @__PURE__ */ jsx177(
|
|
11501
13051
|
"img",
|
|
11502
13052
|
{
|
|
11503
13053
|
width: "60",
|
|
11504
13054
|
src: "https://datac-site-assets.s3.sa-east-1.amazonaws.com/logomarca.png"
|
|
11505
13055
|
}
|
|
11506
13056
|
),
|
|
11507
|
-
/* @__PURE__ */
|
|
11508
|
-
|
|
13057
|
+
/* @__PURE__ */ jsx177(
|
|
13058
|
+
Typography34,
|
|
11509
13059
|
{
|
|
11510
13060
|
variant: "body1",
|
|
11511
13061
|
component: "span",
|
|
@@ -11521,25 +13071,25 @@ function LoginContainer({ children }) {
|
|
|
11521
13071
|
}
|
|
11522
13072
|
function MioAuth(props) {
|
|
11523
13073
|
const { banner, loginSection } = props;
|
|
11524
|
-
return /* @__PURE__ */
|
|
11525
|
-
banner ? /* @__PURE__ */
|
|
11526
|
-
/* @__PURE__ */
|
|
13074
|
+
return /* @__PURE__ */ jsxs87(Stack52, { component: "main", direction: "row", height: "100vh", children: [
|
|
13075
|
+
banner ? /* @__PURE__ */ jsx177(BannerSection, { children: banner }) : /* @__PURE__ */ jsx177(DefaultBanner2, {}),
|
|
13076
|
+
/* @__PURE__ */ jsx177(LoginContainer2, { children: loginSection ? loginSection : /* @__PURE__ */ jsx177(LoginSection2, { ...props }) })
|
|
11527
13077
|
] });
|
|
11528
13078
|
}
|
|
11529
13079
|
|
|
11530
13080
|
// src/AlterarLicenca/index.tsx
|
|
11531
13081
|
import { formatDocumento as formatDocumento2, normalizeText } from "@data-c/hooks";
|
|
11532
13082
|
import ArrowDropDown from "@mui/icons-material/ArrowDropDown";
|
|
11533
|
-
import { Button as Button12, Stack as
|
|
11534
|
-
import { useState as
|
|
11535
|
-
import { jsx as
|
|
13083
|
+
import { Button as Button12, Stack as Stack53, Typography as Typography35 } from "@mui/material";
|
|
13084
|
+
import { useState as useState33 } from "react";
|
|
13085
|
+
import { jsx as jsx178, jsxs as jsxs88 } from "react/jsx-runtime";
|
|
11536
13086
|
function AlterarLicenca(props) {
|
|
11537
13087
|
const { licencas, licencaSelecionada, onAlterarLicenca } = props;
|
|
11538
|
-
const [query, setQuery] =
|
|
13088
|
+
const [query, setQuery] = useState33("");
|
|
11539
13089
|
if (licencas.length === 0)
|
|
11540
|
-
return /* @__PURE__ */
|
|
11541
|
-
/* @__PURE__ */
|
|
11542
|
-
/* @__PURE__ */
|
|
13090
|
+
return /* @__PURE__ */ jsxs88(Stack53, { overflow: "hidden", children: [
|
|
13091
|
+
/* @__PURE__ */ jsx178(Typography35, { overflow: "hidden", textOverflow: "ellipsis", variant: "body1", children: licencaSelecionada.nome }),
|
|
13092
|
+
/* @__PURE__ */ jsx178(Typography35, { overflow: "hidden", textOverflow: "ellipsis", variant: "body2", children: formatDocumento2(licencaSelecionada.documento) })
|
|
11543
13093
|
] });
|
|
11544
13094
|
function handleSearch(val) {
|
|
11545
13095
|
setQuery(val);
|
|
@@ -11549,8 +13099,8 @@ function AlterarLicenca(props) {
|
|
|
11549
13099
|
(field) => normalizeText(String(item[field])).includes(normalizeText(query))
|
|
11550
13100
|
)
|
|
11551
13101
|
) : licencas;
|
|
11552
|
-
return /* @__PURE__ */
|
|
11553
|
-
/* @__PURE__ */
|
|
13102
|
+
return /* @__PURE__ */ jsxs88(Popover_default.Root, { children: [
|
|
13103
|
+
/* @__PURE__ */ jsx178(Popover_default.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs88(
|
|
11554
13104
|
Button12,
|
|
11555
13105
|
{
|
|
11556
13106
|
sx: {
|
|
@@ -11559,11 +13109,11 @@ function AlterarLicenca(props) {
|
|
|
11559
13109
|
variant: "text",
|
|
11560
13110
|
children: [
|
|
11561
13111
|
licencaSelecionada.nome,
|
|
11562
|
-
/* @__PURE__ */
|
|
13112
|
+
/* @__PURE__ */ jsx178(ArrowDropDown, {})
|
|
11563
13113
|
]
|
|
11564
13114
|
}
|
|
11565
13115
|
) }),
|
|
11566
|
-
/* @__PURE__ */
|
|
13116
|
+
/* @__PURE__ */ jsx178(
|
|
11567
13117
|
Popover_default.Content,
|
|
11568
13118
|
{
|
|
11569
13119
|
sx: {
|
|
@@ -11574,7 +13124,7 @@ function AlterarLicenca(props) {
|
|
|
11574
13124
|
p: 0.5
|
|
11575
13125
|
}
|
|
11576
13126
|
},
|
|
11577
|
-
children: /* @__PURE__ */
|
|
13127
|
+
children: /* @__PURE__ */ jsxs88(
|
|
11578
13128
|
List_default.Root,
|
|
11579
13129
|
{
|
|
11580
13130
|
sx: {
|
|
@@ -11584,16 +13134,16 @@ function AlterarLicenca(props) {
|
|
|
11584
13134
|
overflow: "auto"
|
|
11585
13135
|
},
|
|
11586
13136
|
children: [
|
|
11587
|
-
/* @__PURE__ */
|
|
11588
|
-
/* @__PURE__ */
|
|
11589
|
-
return /* @__PURE__ */
|
|
13137
|
+
/* @__PURE__ */ jsx178(SearchTextField, { autoFocus: true, onSearch: handleSearch }),
|
|
13138
|
+
/* @__PURE__ */ jsx178(List_default.Content, { children: filteredData.map((e) => {
|
|
13139
|
+
return /* @__PURE__ */ jsx178(Popover_default.Close, { asChild: true, children: /* @__PURE__ */ jsx178(
|
|
11590
13140
|
List_default.Item,
|
|
11591
13141
|
{
|
|
11592
13142
|
selected: licencaSelecionada.uuid === e.uuid,
|
|
11593
13143
|
onClick: () => onAlterarLicenca(e),
|
|
11594
|
-
children: /* @__PURE__ */
|
|
11595
|
-
/* @__PURE__ */
|
|
11596
|
-
/* @__PURE__ */
|
|
13144
|
+
children: /* @__PURE__ */ jsxs88(Stack53, { children: [
|
|
13145
|
+
/* @__PURE__ */ jsx178(Typography35, { variant: "body1", textOverflow: "ellipsis", children: e.nome }),
|
|
13146
|
+
/* @__PURE__ */ jsx178(Typography35, { variant: "body2", textOverflow: "ellipsis", children: formatDocumento2(e.documento) })
|
|
11597
13147
|
] })
|
|
11598
13148
|
}
|
|
11599
13149
|
) }, e.uuid);
|
|
@@ -11614,15 +13164,15 @@ import { styled as styled9 } from "@mui/material/styles";
|
|
|
11614
13164
|
import { List as List5 } from "@mui/material";
|
|
11615
13165
|
|
|
11616
13166
|
// src/DrawerMenu/components/FullMenu/components/FullMenuItem/index.tsx
|
|
11617
|
-
import { useState as
|
|
13167
|
+
import { useState as useState34 } from "react";
|
|
11618
13168
|
import ExpandLess from "@mui/icons-material/ExpandLess";
|
|
11619
13169
|
import ExpandMore from "@mui/icons-material/ExpandMore";
|
|
11620
|
-
import { Box as
|
|
13170
|
+
import { Box as Box27, Collapse as Collapse3, Icon as Icon4, ListItemText as ListItemText3 } from "@mui/material";
|
|
11621
13171
|
|
|
11622
13172
|
// src/DrawerMenu/components/MenuItem/index.tsx
|
|
11623
13173
|
import { MenuItem as MuiMenuItem } from "@mui/material";
|
|
11624
13174
|
import { styled as styled8 } from "@mui/material/styles";
|
|
11625
|
-
import { jsx as
|
|
13175
|
+
import { jsx as jsx179 } from "react/jsx-runtime";
|
|
11626
13176
|
var StyledMuiMenuItem = styled8(
|
|
11627
13177
|
MuiMenuItem,
|
|
11628
13178
|
{}
|
|
@@ -11658,14 +13208,14 @@ var StyledMuiMenuItem = styled8(
|
|
|
11658
13208
|
fontSize: "24px"
|
|
11659
13209
|
}
|
|
11660
13210
|
}));
|
|
11661
|
-
var
|
|
11662
|
-
var MenuItem_default =
|
|
13211
|
+
var MenuItem8 = (props) => /* @__PURE__ */ jsx179(StyledMuiMenuItem, { ...props });
|
|
13212
|
+
var MenuItem_default = MenuItem8;
|
|
11663
13213
|
|
|
11664
13214
|
// src/DrawerMenu/components/FullMenu/components/FullMenuItem/index.tsx
|
|
11665
|
-
import { jsx as
|
|
13215
|
+
import { jsx as jsx180, jsxs as jsxs89 } from "react/jsx-runtime";
|
|
11666
13216
|
function FullMenuItem2(props) {
|
|
11667
13217
|
const { menuItem, activeMenu, onMenuClick } = props;
|
|
11668
|
-
const [expanded, setExpanded] =
|
|
13218
|
+
const [expanded, setExpanded] = useState34(false);
|
|
11669
13219
|
if (!menuItem.visible)
|
|
11670
13220
|
return null;
|
|
11671
13221
|
const isExpandable = Boolean(
|
|
@@ -11674,8 +13224,8 @@ function FullMenuItem2(props) {
|
|
|
11674
13224
|
function toggleExpand() {
|
|
11675
13225
|
setExpanded(!expanded);
|
|
11676
13226
|
}
|
|
11677
|
-
return /* @__PURE__ */
|
|
11678
|
-
/* @__PURE__ */
|
|
13227
|
+
return /* @__PURE__ */ jsxs89(Box27, { children: [
|
|
13228
|
+
/* @__PURE__ */ jsxs89(
|
|
11679
13229
|
MenuItem_default,
|
|
11680
13230
|
{
|
|
11681
13231
|
onClick: () => {
|
|
@@ -11687,14 +13237,14 @@ function FullMenuItem2(props) {
|
|
|
11687
13237
|
},
|
|
11688
13238
|
selected: activeMenu === menuItem.link,
|
|
11689
13239
|
children: [
|
|
11690
|
-
!!menuItem.icon && /* @__PURE__ */
|
|
11691
|
-
/* @__PURE__ */
|
|
11692
|
-
isExpandable && !expanded && /* @__PURE__ */
|
|
11693
|
-
isExpandable && expanded && /* @__PURE__ */
|
|
13240
|
+
!!menuItem.icon && /* @__PURE__ */ jsx180(Icon4, { children: menuItem.icon }),
|
|
13241
|
+
/* @__PURE__ */ jsx180(ListItemText3, { primary: menuItem.label }),
|
|
13242
|
+
isExpandable && !expanded && /* @__PURE__ */ jsx180(ExpandMore, {}),
|
|
13243
|
+
isExpandable && expanded && /* @__PURE__ */ jsx180(ExpandLess, {})
|
|
11694
13244
|
]
|
|
11695
13245
|
}
|
|
11696
13246
|
),
|
|
11697
|
-
menuItem?.items && /* @__PURE__ */
|
|
13247
|
+
menuItem?.items && /* @__PURE__ */ jsx180(Collapse3, { in: expanded, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ jsx180(
|
|
11698
13248
|
FullMenu,
|
|
11699
13249
|
{
|
|
11700
13250
|
activeMenu,
|
|
@@ -11709,11 +13259,11 @@ function FullMenuItem2(props) {
|
|
|
11709
13259
|
}
|
|
11710
13260
|
|
|
11711
13261
|
// src/DrawerMenu/components/FullMenu/index.tsx
|
|
11712
|
-
import { jsx as
|
|
13262
|
+
import { jsx as jsx181 } from "react/jsx-runtime";
|
|
11713
13263
|
function FullMenu(props) {
|
|
11714
13264
|
const { menus, activeMenu, onMenuClick, ...rest } = props;
|
|
11715
|
-
return /* @__PURE__ */
|
|
11716
|
-
return /* @__PURE__ */
|
|
13265
|
+
return /* @__PURE__ */ jsx181(List5, { component: "nav", disablePadding: true, ...rest, children: menus.map((menuItem) => {
|
|
13266
|
+
return /* @__PURE__ */ jsx181(
|
|
11717
13267
|
FullMenuItem2,
|
|
11718
13268
|
{
|
|
11719
13269
|
onMenuClick,
|
|
@@ -11726,12 +13276,12 @@ function FullMenu(props) {
|
|
|
11726
13276
|
}
|
|
11727
13277
|
|
|
11728
13278
|
// src/DrawerMenu/components/MinMenu/index.tsx
|
|
11729
|
-
import { useState as
|
|
13279
|
+
import { useState as useState35 } from "react";
|
|
11730
13280
|
import { List as List6, Icon as Icon5, ListItemIcon as ListItemIcon3, Popper as Popper3 } from "@mui/material";
|
|
11731
|
-
import { jsx as
|
|
13281
|
+
import { jsx as jsx182, jsxs as jsxs90 } from "react/jsx-runtime";
|
|
11732
13282
|
function MinMenu(props) {
|
|
11733
13283
|
const { menus, activeMenu, onMenuClick } = props;
|
|
11734
|
-
const [opened, setOpened] =
|
|
13284
|
+
const [opened, setOpened] = useState35(null);
|
|
11735
13285
|
const handleOpen = (event, id, items) => {
|
|
11736
13286
|
setOpened({
|
|
11737
13287
|
element: event.currentTarget,
|
|
@@ -11742,10 +13292,10 @@ function MinMenu(props) {
|
|
|
11742
13292
|
const handleClose = () => {
|
|
11743
13293
|
setOpened(null);
|
|
11744
13294
|
};
|
|
11745
|
-
return /* @__PURE__ */
|
|
13295
|
+
return /* @__PURE__ */ jsx182(List6, { component: "nav", disablePadding: true, children: menus.map((menuItem) => {
|
|
11746
13296
|
if (!menuItem.visible)
|
|
11747
13297
|
return null;
|
|
11748
|
-
return /* @__PURE__ */
|
|
13298
|
+
return /* @__PURE__ */ jsxs90(
|
|
11749
13299
|
MenuItem_default,
|
|
11750
13300
|
{
|
|
11751
13301
|
onMouseEnter: (e) => {
|
|
@@ -11765,8 +13315,8 @@ function MinMenu(props) {
|
|
|
11765
13315
|
},
|
|
11766
13316
|
selected: activeMenu === menuItem.link,
|
|
11767
13317
|
children: [
|
|
11768
|
-
/* @__PURE__ */
|
|
11769
|
-
opened?.id === menuItem.id && /* @__PURE__ */
|
|
13318
|
+
/* @__PURE__ */ jsx182(ListItemIcon3, { children: /* @__PURE__ */ jsx182(Icon5, { children: menuItem.icon }) }),
|
|
13319
|
+
opened?.id === menuItem.id && /* @__PURE__ */ jsx182(
|
|
11770
13320
|
Popper3,
|
|
11771
13321
|
{
|
|
11772
13322
|
sx: {
|
|
@@ -11775,7 +13325,7 @@ function MinMenu(props) {
|
|
|
11775
13325
|
anchorEl: opened?.element,
|
|
11776
13326
|
open: Boolean(opened?.element),
|
|
11777
13327
|
placement: "right-start",
|
|
11778
|
-
children: /* @__PURE__ */
|
|
13328
|
+
children: /* @__PURE__ */ jsx182(
|
|
11779
13329
|
FullMenu,
|
|
11780
13330
|
{
|
|
11781
13331
|
activeMenu,
|
|
@@ -11800,7 +13350,7 @@ function MinMenu(props) {
|
|
|
11800
13350
|
}
|
|
11801
13351
|
|
|
11802
13352
|
// src/DrawerMenu/index.tsx
|
|
11803
|
-
import { jsx as
|
|
13353
|
+
import { jsx as jsx183, jsxs as jsxs91 } from "react/jsx-runtime";
|
|
11804
13354
|
var openedMixin2 = (width, theme2) => ({
|
|
11805
13355
|
width,
|
|
11806
13356
|
transition: theme2.transitions.create("width", {
|
|
@@ -11840,7 +13390,7 @@ var Drawer2 = styled9(MuiDrawer3, {
|
|
|
11840
13390
|
}));
|
|
11841
13391
|
function DrawerMenu(props) {
|
|
11842
13392
|
const { open, items, width, activeMenu, onMenuClick, toggleMenu, ...rest } = props;
|
|
11843
|
-
return /* @__PURE__ */
|
|
13393
|
+
return /* @__PURE__ */ jsxs91(
|
|
11844
13394
|
Drawer2,
|
|
11845
13395
|
{
|
|
11846
13396
|
width,
|
|
@@ -11848,8 +13398,8 @@ function DrawerMenu(props) {
|
|
|
11848
13398
|
onClose: () => toggleMenu(false),
|
|
11849
13399
|
...rest,
|
|
11850
13400
|
children: [
|
|
11851
|
-
/* @__PURE__ */
|
|
11852
|
-
open && /* @__PURE__ */
|
|
13401
|
+
/* @__PURE__ */ jsx183(Toolbar5, {}),
|
|
13402
|
+
open && /* @__PURE__ */ jsx183(
|
|
11853
13403
|
FullMenu,
|
|
11854
13404
|
{
|
|
11855
13405
|
onMenuClick,
|
|
@@ -11857,7 +13407,7 @@ function DrawerMenu(props) {
|
|
|
11857
13407
|
menus: items
|
|
11858
13408
|
}
|
|
11859
13409
|
),
|
|
11860
|
-
!open && /* @__PURE__ */
|
|
13410
|
+
!open && /* @__PURE__ */ jsx183(
|
|
11861
13411
|
MinMenu,
|
|
11862
13412
|
{
|
|
11863
13413
|
onMenuClick,
|
|
@@ -11871,11 +13421,11 @@ function DrawerMenu(props) {
|
|
|
11871
13421
|
}
|
|
11872
13422
|
|
|
11873
13423
|
// src/Content/index.tsx
|
|
11874
|
-
import { Box as
|
|
11875
|
-
import { jsx as
|
|
13424
|
+
import { Box as Box28 } from "@mui/material";
|
|
13425
|
+
import { jsx as jsx184 } from "react/jsx-runtime";
|
|
11876
13426
|
function Content2(props) {
|
|
11877
|
-
return /* @__PURE__ */
|
|
11878
|
-
|
|
13427
|
+
return /* @__PURE__ */ jsx184(
|
|
13428
|
+
Box28,
|
|
11879
13429
|
{
|
|
11880
13430
|
m: 2,
|
|
11881
13431
|
sx: {
|
|
@@ -11891,10 +13441,10 @@ function Content2(props) {
|
|
|
11891
13441
|
// src/Avatar/index.tsx
|
|
11892
13442
|
import { useUserContext } from "@data-c/providers";
|
|
11893
13443
|
import MuiAvatar from "@mui/material/Avatar";
|
|
11894
|
-
import { jsx as
|
|
13444
|
+
import { jsx as jsx185 } from "react/jsx-runtime";
|
|
11895
13445
|
function Avatar(props) {
|
|
11896
13446
|
const { user } = useUserContext();
|
|
11897
|
-
return /* @__PURE__ */
|
|
13447
|
+
return /* @__PURE__ */ jsx185(
|
|
11898
13448
|
MuiAvatar,
|
|
11899
13449
|
{
|
|
11900
13450
|
src: user?.avatarUrl,
|
|
@@ -11905,18 +13455,18 @@ function Avatar(props) {
|
|
|
11905
13455
|
}
|
|
11906
13456
|
|
|
11907
13457
|
// src/Profile/index.tsx
|
|
11908
|
-
import { Stack as
|
|
11909
|
-
import { useState as
|
|
13458
|
+
import { Stack as Stack58, Tab, Tabs } from "@mui/material";
|
|
13459
|
+
import { useState as useState40 } from "react";
|
|
11910
13460
|
|
|
11911
13461
|
// src/Profile/TabPanel.tsx
|
|
11912
|
-
import { Box as
|
|
11913
|
-
import { jsx as
|
|
13462
|
+
import { Box as Box29 } from "@mui/material";
|
|
13463
|
+
import { jsx as jsx186 } from "react/jsx-runtime";
|
|
11914
13464
|
function TabPanel(props) {
|
|
11915
13465
|
const { children, value, index, ...others } = props;
|
|
11916
13466
|
if (value !== index)
|
|
11917
13467
|
return null;
|
|
11918
|
-
return /* @__PURE__ */
|
|
11919
|
-
|
|
13468
|
+
return /* @__PURE__ */ jsx186(
|
|
13469
|
+
Box29,
|
|
11920
13470
|
{
|
|
11921
13471
|
role: "tabpanel",
|
|
11922
13472
|
hidden: value !== index,
|
|
@@ -11936,20 +13486,20 @@ function TabPanel(props) {
|
|
|
11936
13486
|
// src/Profile/MinhaConta.tsx
|
|
11937
13487
|
import {
|
|
11938
13488
|
useCredentials as useCredentials8,
|
|
11939
|
-
useForm as
|
|
13489
|
+
useForm as useForm5
|
|
11940
13490
|
} from "@data-c/hooks";
|
|
11941
13491
|
import {
|
|
11942
|
-
Alert as
|
|
11943
|
-
Divider as
|
|
11944
|
-
Grid as
|
|
11945
|
-
Stack as
|
|
11946
|
-
TextField as
|
|
11947
|
-
Typography as
|
|
13492
|
+
Alert as Alert13,
|
|
13493
|
+
Divider as Divider7,
|
|
13494
|
+
Grid as Grid3,
|
|
13495
|
+
Stack as Stack55,
|
|
13496
|
+
TextField as TextField16,
|
|
13497
|
+
Typography as Typography36
|
|
11948
13498
|
} from "@mui/material";
|
|
11949
|
-
import { useEffect as
|
|
13499
|
+
import { useEffect as useEffect24, useState as useState37 } from "react";
|
|
11950
13500
|
|
|
11951
13501
|
// src/Profile/AvatarUploader.tsx
|
|
11952
|
-
import { useState as
|
|
13502
|
+
import { useState as useState36, useCallback as useCallback5 } from "react";
|
|
11953
13503
|
import Cropper from "react-easy-crop";
|
|
11954
13504
|
import Slider from "@mui/material/Slider";
|
|
11955
13505
|
import Button13 from "@mui/material/Button";
|
|
@@ -11985,15 +13535,15 @@ function getCroppedImg(imageSrc, crop) {
|
|
|
11985
13535
|
}
|
|
11986
13536
|
|
|
11987
13537
|
// src/Profile/AvatarUploader.tsx
|
|
11988
|
-
import { Stack as
|
|
11989
|
-
import { jsx as
|
|
13538
|
+
import { Stack as Stack54 } from "@mui/material";
|
|
13539
|
+
import { jsx as jsx187, jsxs as jsxs92 } from "react/jsx-runtime";
|
|
11990
13540
|
var AvatarUploader = ({ onSave, src }) => {
|
|
11991
|
-
const [image, setImage] =
|
|
11992
|
-
const [croppedImage, setCroppedImage] =
|
|
11993
|
-
const [crop, setCrop] =
|
|
11994
|
-
const [zoom, setZoom] =
|
|
11995
|
-
const [croppedAreaPixels, setCroppedAreaPixels] =
|
|
11996
|
-
const [open, setOpen] =
|
|
13541
|
+
const [image, setImage] = useState36(null);
|
|
13542
|
+
const [croppedImage, setCroppedImage] = useState36(null);
|
|
13543
|
+
const [crop, setCrop] = useState36({ x: 0, y: 0 });
|
|
13544
|
+
const [zoom, setZoom] = useState36(1);
|
|
13545
|
+
const [croppedAreaPixels, setCroppedAreaPixels] = useState36(null);
|
|
13546
|
+
const [open, setOpen] = useState36(false);
|
|
11997
13547
|
const onCropComplete = useCallback5((_, croppedAreaPixels2) => {
|
|
11998
13548
|
setCroppedAreaPixels(croppedAreaPixels2);
|
|
11999
13549
|
}, []);
|
|
@@ -12018,23 +13568,23 @@ var AvatarUploader = ({ onSave, src }) => {
|
|
|
12018
13568
|
};
|
|
12019
13569
|
reader.readAsDataURL(file);
|
|
12020
13570
|
};
|
|
12021
|
-
return /* @__PURE__ */
|
|
12022
|
-
croppedImage ? /* @__PURE__ */
|
|
13571
|
+
return /* @__PURE__ */ jsxs92(Stack54, { direction: "row", spacing: 2, alignItems: "center", children: [
|
|
13572
|
+
croppedImage ? /* @__PURE__ */ jsx187(
|
|
12023
13573
|
Avatar2,
|
|
12024
13574
|
{
|
|
12025
13575
|
src: croppedImage,
|
|
12026
13576
|
alt: "Preview",
|
|
12027
13577
|
sx: { width: 64, height: 64, margin: "auto", mb: 2 }
|
|
12028
13578
|
}
|
|
12029
|
-
) : /* @__PURE__ */
|
|
13579
|
+
) : /* @__PURE__ */ jsx187(
|
|
12030
13580
|
Avatar2,
|
|
12031
13581
|
{
|
|
12032
13582
|
src,
|
|
12033
13583
|
sx: { width: 64, height: 64, margin: "auto", mb: 2 }
|
|
12034
13584
|
}
|
|
12035
13585
|
),
|
|
12036
|
-
/* @__PURE__ */
|
|
12037
|
-
/* @__PURE__ */
|
|
13586
|
+
/* @__PURE__ */ jsxs92("label", { children: [
|
|
13587
|
+
/* @__PURE__ */ jsx187(
|
|
12038
13588
|
"input",
|
|
12039
13589
|
{
|
|
12040
13590
|
type: "file",
|
|
@@ -12043,9 +13593,9 @@ var AvatarUploader = ({ onSave, src }) => {
|
|
|
12043
13593
|
style: { display: "none" }
|
|
12044
13594
|
}
|
|
12045
13595
|
),
|
|
12046
|
-
/* @__PURE__ */
|
|
13596
|
+
/* @__PURE__ */ jsx187(Button13, { variant: "contained", component: "span", children: "Alterar foto" })
|
|
12047
13597
|
] }),
|
|
12048
|
-
/* @__PURE__ */
|
|
13598
|
+
/* @__PURE__ */ jsxs92(
|
|
12049
13599
|
Dialog4,
|
|
12050
13600
|
{
|
|
12051
13601
|
open,
|
|
@@ -12053,7 +13603,7 @@ var AvatarUploader = ({ onSave, src }) => {
|
|
|
12053
13603
|
maxWidth: "sm",
|
|
12054
13604
|
fullWidth: true,
|
|
12055
13605
|
children: [
|
|
12056
|
-
/* @__PURE__ */
|
|
13606
|
+
/* @__PURE__ */ jsx187("div", { style: { position: "relative", height: 400, background: "#333" }, children: image && /* @__PURE__ */ jsx187(
|
|
12057
13607
|
Cropper,
|
|
12058
13608
|
{
|
|
12059
13609
|
image,
|
|
@@ -12067,8 +13617,8 @@ var AvatarUploader = ({ onSave, src }) => {
|
|
|
12067
13617
|
onCropComplete
|
|
12068
13618
|
}
|
|
12069
13619
|
) }),
|
|
12070
|
-
/* @__PURE__ */
|
|
12071
|
-
/* @__PURE__ */
|
|
13620
|
+
/* @__PURE__ */ jsxs92("div", { style: { padding: 20 }, children: [
|
|
13621
|
+
/* @__PURE__ */ jsx187(
|
|
12072
13622
|
Slider,
|
|
12073
13623
|
{
|
|
12074
13624
|
value: zoom,
|
|
@@ -12078,7 +13628,7 @@ var AvatarUploader = ({ onSave, src }) => {
|
|
|
12078
13628
|
onChange: (_, value) => setZoom(value)
|
|
12079
13629
|
}
|
|
12080
13630
|
),
|
|
12081
|
-
/* @__PURE__ */
|
|
13631
|
+
/* @__PURE__ */ jsx187(ButtonContainer, { children: /* @__PURE__ */ jsx187(Button13, { variant: "contained", onClick: handleSave, children: "Salvar" }) })
|
|
12082
13632
|
] })
|
|
12083
13633
|
]
|
|
12084
13634
|
}
|
|
@@ -12088,31 +13638,31 @@ var AvatarUploader = ({ onSave, src }) => {
|
|
|
12088
13638
|
var AvatarUploader_default = AvatarUploader;
|
|
12089
13639
|
|
|
12090
13640
|
// src/Profile/MinhaConta.tsx
|
|
12091
|
-
import { jsx as
|
|
12092
|
-
var
|
|
13641
|
+
import { jsx as jsx188, jsxs as jsxs93 } from "react/jsx-runtime";
|
|
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
|
-
const { data, setData, handleChange, validate, validationErrors } =
|
|
13647
|
+
const { data, setData, handleChange, validate, validationErrors } = useForm5(
|
|
12098
13648
|
usuario,
|
|
12099
|
-
|
|
13649
|
+
schema7
|
|
12100
13650
|
);
|
|
12101
|
-
const [error, setErro] =
|
|
12102
|
-
const [isAlterando, setAlterando] =
|
|
12103
|
-
const [isAlteradoComSucesso, setAlteradoComSucesso] =
|
|
13651
|
+
const [error, setErro] = useState37(false);
|
|
13652
|
+
const [isAlterando, setAlterando] = useState37(false);
|
|
13653
|
+
const [isAlteradoComSucesso, setAlteradoComSucesso] = useState37(false);
|
|
12104
13654
|
const { uploadAvatar, atualizarUsuario } = useCredentials8(credentialsConfig);
|
|
12105
|
-
|
|
13655
|
+
useEffect24(() => {
|
|
12106
13656
|
setData(usuario);
|
|
12107
13657
|
}, [usuario]);
|
|
12108
|
-
|
|
13658
|
+
useEffect24(() => {
|
|
12109
13659
|
if (isAlteradoComSucesso) {
|
|
12110
13660
|
setTimeout(() => {
|
|
12111
13661
|
setAlteradoComSucesso(false);
|
|
12112
13662
|
}, 3e3);
|
|
12113
13663
|
}
|
|
12114
13664
|
}, [isAlteradoComSucesso]);
|
|
12115
|
-
|
|
13665
|
+
useEffect24(() => {
|
|
12116
13666
|
if (error) {
|
|
12117
13667
|
setTimeout(() => {
|
|
12118
13668
|
setErro(false);
|
|
@@ -12132,9 +13682,9 @@ function MinhaConta(props) {
|
|
|
12132
13682
|
}
|
|
12133
13683
|
});
|
|
12134
13684
|
}
|
|
12135
|
-
return /* @__PURE__ */
|
|
12136
|
-
/* @__PURE__ */
|
|
12137
|
-
/* @__PURE__ */
|
|
13685
|
+
return /* @__PURE__ */ jsxs93(Stack55, { spacing: 2, children: [
|
|
13686
|
+
/* @__PURE__ */ jsx188(Typography36, { variant: "h6", children: "Avatar" }),
|
|
13687
|
+
/* @__PURE__ */ jsx188(
|
|
12138
13688
|
AvatarUploader_default,
|
|
12139
13689
|
{
|
|
12140
13690
|
src: data?.avatarUrl,
|
|
@@ -12154,11 +13704,11 @@ function MinhaConta(props) {
|
|
|
12154
13704
|
}
|
|
12155
13705
|
}
|
|
12156
13706
|
),
|
|
12157
|
-
/* @__PURE__ */
|
|
12158
|
-
/* @__PURE__ */
|
|
12159
|
-
/* @__PURE__ */
|
|
12160
|
-
/* @__PURE__ */
|
|
12161
|
-
|
|
13707
|
+
/* @__PURE__ */ jsx188(Divider7, {}),
|
|
13708
|
+
/* @__PURE__ */ jsx188(Typography36, { variant: "h6", children: "Informa\xE7\xF5es da Conta" }),
|
|
13709
|
+
/* @__PURE__ */ jsxs93(Grid3, { container: true, spacing: 1.5, children: [
|
|
13710
|
+
/* @__PURE__ */ jsx188(Grid3, { size: { xl: 4, lg: 4, md: 4, sm: 12, xs: 12 }, children: /* @__PURE__ */ jsx188(
|
|
13711
|
+
TextField16,
|
|
12162
13712
|
{
|
|
12163
13713
|
disabled: true,
|
|
12164
13714
|
fullWidth: true,
|
|
@@ -12166,8 +13716,8 @@ function MinhaConta(props) {
|
|
|
12166
13716
|
value: data?.email || ""
|
|
12167
13717
|
}
|
|
12168
13718
|
) }),
|
|
12169
|
-
/* @__PURE__ */
|
|
12170
|
-
|
|
13719
|
+
/* @__PURE__ */ jsx188(Grid3, { size: { xl: 4, lg: 4, md: 4, sm: 12, xs: 12 }, children: /* @__PURE__ */ jsx188(
|
|
13720
|
+
TextField16,
|
|
12171
13721
|
{
|
|
12172
13722
|
name: "name",
|
|
12173
13723
|
fullWidth: true,
|
|
@@ -12177,8 +13727,8 @@ function MinhaConta(props) {
|
|
|
12177
13727
|
...validationErrors("name")
|
|
12178
13728
|
}
|
|
12179
13729
|
) }),
|
|
12180
|
-
/* @__PURE__ */
|
|
12181
|
-
|
|
13730
|
+
/* @__PURE__ */ jsx188(Grid3, { size: { xl: 4, lg: 4, md: 4, sm: 12, xs: 12 }, children: /* @__PURE__ */ jsx188(
|
|
13731
|
+
TextField16,
|
|
12182
13732
|
{
|
|
12183
13733
|
name: "surname",
|
|
12184
13734
|
fullWidth: true,
|
|
@@ -12188,7 +13738,7 @@ function MinhaConta(props) {
|
|
|
12188
13738
|
}
|
|
12189
13739
|
) })
|
|
12190
13740
|
] }),
|
|
12191
|
-
/* @__PURE__ */
|
|
13741
|
+
/* @__PURE__ */ jsx188(Grid3, { size: { xl: 4, lg: 4, md: 4, sm: 12, xs: 12 }, children: /* @__PURE__ */ jsx188(ButtonContainer, { children: /* @__PURE__ */ jsx188(
|
|
12192
13742
|
Button_default,
|
|
12193
13743
|
{
|
|
12194
13744
|
isLoading: isAlterando,
|
|
@@ -12197,34 +13747,34 @@ function MinhaConta(props) {
|
|
|
12197
13747
|
children: "Salvar"
|
|
12198
13748
|
}
|
|
12199
13749
|
) }) }),
|
|
12200
|
-
isAlteradoComSucesso && /* @__PURE__ */
|
|
12201
|
-
error && /* @__PURE__ */
|
|
13750
|
+
isAlteradoComSucesso && /* @__PURE__ */ jsx188(Alert13, { children: "Dados da conta alterados com sucesso!" }),
|
|
13751
|
+
error && /* @__PURE__ */ jsx188(Alert13, { severity: "error", children: error })
|
|
12202
13752
|
] });
|
|
12203
13753
|
}
|
|
12204
13754
|
|
|
12205
13755
|
// src/Profile/LoginSeguranca.tsx
|
|
12206
13756
|
import {
|
|
12207
13757
|
useCredentials as useCredentials10,
|
|
12208
|
-
useForm as
|
|
13758
|
+
useForm as useForm6
|
|
12209
13759
|
} from "@data-c/hooks";
|
|
12210
13760
|
import Verified from "@mui/icons-material/Verified";
|
|
12211
|
-
import { Alert as
|
|
12212
|
-
import { useEffect as
|
|
13761
|
+
import { Alert as Alert15, Divider as Divider8, Stack as Stack57, Typography as Typography38 } from "@mui/material";
|
|
13762
|
+
import { useEffect as useEffect26, useState as useState39 } from "react";
|
|
12213
13763
|
|
|
12214
13764
|
// src/Profile/DialogVerificarWhastapp.tsx
|
|
12215
13765
|
import {
|
|
12216
13766
|
useCredentials as useCredentials9
|
|
12217
13767
|
} from "@data-c/hooks";
|
|
12218
|
-
import { Alert as
|
|
12219
|
-
import { useEffect as
|
|
12220
|
-
import { jsx as
|
|
13768
|
+
import { Alert as Alert14, Stack as Stack56, Typography as Typography37 } from "@mui/material";
|
|
13769
|
+
import { useEffect as useEffect25, useState as useState38 } from "react";
|
|
13770
|
+
import { jsx as jsx189, jsxs as jsxs94 } from "react/jsx-runtime";
|
|
12221
13771
|
function DialogVerificarWhastapp(props) {
|
|
12222
13772
|
const { open, onClose, payload, onCodigoVerificado, credentialsConfig } = props;
|
|
12223
|
-
const [code, setCode] =
|
|
12224
|
-
const [error, setError] =
|
|
12225
|
-
const [isLoading, setLoading] =
|
|
13773
|
+
const [code, setCode] = useState38("");
|
|
13774
|
+
const [error, setError] = useState38(false);
|
|
13775
|
+
const [isLoading, setLoading] = useState38(false);
|
|
12226
13776
|
const { validarCodigoWhatsapp } = useCredentials9(credentialsConfig);
|
|
12227
|
-
|
|
13777
|
+
useEffect25(() => {
|
|
12228
13778
|
if (error) {
|
|
12229
13779
|
setTimeout(() => {
|
|
12230
13780
|
setError(false);
|
|
@@ -12242,36 +13792,36 @@ function DialogVerificarWhastapp(props) {
|
|
|
12242
13792
|
setLoading(false);
|
|
12243
13793
|
}
|
|
12244
13794
|
}
|
|
12245
|
-
return /* @__PURE__ */
|
|
12246
|
-
/* @__PURE__ */
|
|
12247
|
-
/* @__PURE__ */
|
|
12248
|
-
/* @__PURE__ */
|
|
13795
|
+
return /* @__PURE__ */ jsxs94(Dialog_default.Root, { open, onClose: (_) => onClose(), maxWidth: "xs", children: [
|
|
13796
|
+
/* @__PURE__ */ jsxs94(Dialog_default.Header, { children: [
|
|
13797
|
+
/* @__PURE__ */ jsx189(Dialog_default.Title, { children: "Verifica\xE7\xE3o do seu n\xFAmero de WhatsApp" }),
|
|
13798
|
+
/* @__PURE__ */ jsx189(Dialog_default.ActionClose, { onClose })
|
|
12249
13799
|
] }),
|
|
12250
|
-
/* @__PURE__ */
|
|
12251
|
-
|
|
13800
|
+
/* @__PURE__ */ jsx189(Dialog_default.Content, { children: /* @__PURE__ */ jsxs94(
|
|
13801
|
+
Stack56,
|
|
12252
13802
|
{
|
|
12253
13803
|
spacing: 2,
|
|
12254
13804
|
justifyContent: "center",
|
|
12255
13805
|
alignContent: "center",
|
|
12256
13806
|
alignItems: "center",
|
|
12257
13807
|
children: [
|
|
12258
|
-
/* @__PURE__ */
|
|
12259
|
-
|
|
13808
|
+
/* @__PURE__ */ jsx189(
|
|
13809
|
+
Typography37,
|
|
12260
13810
|
{
|
|
12261
13811
|
variant: "subtitle1",
|
|
12262
13812
|
sx: { fontWeight: "bolder", fontSize: "11pt" },
|
|
12263
13813
|
children: "\u{1F510} Verifique seu n\xFAmero"
|
|
12264
13814
|
}
|
|
12265
13815
|
),
|
|
12266
|
-
/* @__PURE__ */
|
|
13816
|
+
/* @__PURE__ */ jsxs94(Typography37, { variant: "body1", sx: { fontSize: "10pt" }, children: [
|
|
12267
13817
|
"Enviamos um c\xF3digo via WhatsApp para +55",
|
|
12268
13818
|
" ",
|
|
12269
|
-
/* @__PURE__ */
|
|
13819
|
+
/* @__PURE__ */ jsx189("b", { children: `(${payload?.whatsappNumber?.slice(0, 2)}) ${payload?.whatsappNumber?.slice(2, 7)}-${payload?.whatsappNumber?.slice(7)}` }),
|
|
12270
13820
|
". ",
|
|
12271
|
-
/* @__PURE__ */
|
|
13821
|
+
/* @__PURE__ */ jsx189("br", {}),
|
|
12272
13822
|
"Digite o c\xF3digo abaixo para confirmar que este n\xFAmero \xE9 seu."
|
|
12273
13823
|
] }),
|
|
12274
|
-
/* @__PURE__ */
|
|
13824
|
+
/* @__PURE__ */ jsx189(
|
|
12275
13825
|
VerificationCodeInput,
|
|
12276
13826
|
{
|
|
12277
13827
|
value: code,
|
|
@@ -12280,13 +13830,13 @@ function DialogVerificarWhastapp(props) {
|
|
|
12280
13830
|
}
|
|
12281
13831
|
}
|
|
12282
13832
|
),
|
|
12283
|
-
error && /* @__PURE__ */
|
|
13833
|
+
error && /* @__PURE__ */ jsx189(Alert14, { sx: { flexGrow: 1 }, severity: "error", children: error })
|
|
12284
13834
|
]
|
|
12285
13835
|
}
|
|
12286
13836
|
) }),
|
|
12287
|
-
/* @__PURE__ */
|
|
12288
|
-
/* @__PURE__ */
|
|
12289
|
-
/* @__PURE__ */
|
|
13837
|
+
/* @__PURE__ */ jsx189(Dialog_default.Footer, { children: /* @__PURE__ */ jsxs94(Dialog_default.Actions, { children: [
|
|
13838
|
+
/* @__PURE__ */ jsx189(Dialog_default.ActionCancelar, { onClick: () => onClose() }),
|
|
13839
|
+
/* @__PURE__ */ jsx189(
|
|
12290
13840
|
Dialog_default.ActionSalvar,
|
|
12291
13841
|
{
|
|
12292
13842
|
label: "Verificar",
|
|
@@ -12300,19 +13850,19 @@ function DialogVerificarWhastapp(props) {
|
|
|
12300
13850
|
}
|
|
12301
13851
|
|
|
12302
13852
|
// src/Profile/LoginSeguranca.tsx
|
|
12303
|
-
import { jsx as
|
|
12304
|
-
var
|
|
13853
|
+
import { jsx as jsx190, jsxs as jsxs95 } from "react/jsx-runtime";
|
|
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) {
|
|
12308
13858
|
const { usuario, credentialsConfig, onWhastappSaved } = props;
|
|
12309
|
-
const [isOpenAlterarSenha, setOpenAlterarSenha] =
|
|
12310
|
-
const [isAlterando, setAlterando] =
|
|
12311
|
-
const { data, setData, changeValue, validate, validationErrors } =
|
|
12312
|
-
const [isGerandoNumero, setGerandoNumero] =
|
|
12313
|
-
const [isOpenVerificarWhastapp, setOpenVerificarWhatsapp] =
|
|
13859
|
+
const [isOpenAlterarSenha, setOpenAlterarSenha] = useState39(false);
|
|
13860
|
+
const [isAlterando, setAlterando] = useState39(false);
|
|
13861
|
+
const { data, setData, changeValue, validate, validationErrors } = useForm6(usuario);
|
|
13862
|
+
const [isGerandoNumero, setGerandoNumero] = useState39(false);
|
|
13863
|
+
const [isOpenVerificarWhastapp, setOpenVerificarWhatsapp] = useState39(false);
|
|
12314
13864
|
const { atualizarUsuario, gerarWhatsappVerificationCode } = useCredentials10(credentialsConfig);
|
|
12315
|
-
|
|
13865
|
+
useEffect26(() => {
|
|
12316
13866
|
setData(usuario);
|
|
12317
13867
|
}, [usuario]);
|
|
12318
13868
|
function handleSalvarWhastapp() {
|
|
@@ -12338,9 +13888,9 @@ function LoginSeguranca(props) {
|
|
|
12338
13888
|
setGerandoNumero(false);
|
|
12339
13889
|
}
|
|
12340
13890
|
}
|
|
12341
|
-
return /* @__PURE__ */
|
|
12342
|
-
/* @__PURE__ */
|
|
12343
|
-
/* @__PURE__ */
|
|
13891
|
+
return /* @__PURE__ */ jsxs95(Stack57, { spacing: 2, children: [
|
|
13892
|
+
/* @__PURE__ */ jsx190(Typography38, { variant: "h6", children: "Senha" }),
|
|
13893
|
+
/* @__PURE__ */ jsx190(
|
|
12344
13894
|
Button_default,
|
|
12345
13895
|
{
|
|
12346
13896
|
onClick: () => {
|
|
@@ -12352,7 +13902,7 @@ function LoginSeguranca(props) {
|
|
|
12352
13902
|
children: "Alterar Senha"
|
|
12353
13903
|
}
|
|
12354
13904
|
),
|
|
12355
|
-
/* @__PURE__ */
|
|
13905
|
+
/* @__PURE__ */ jsx190(
|
|
12356
13906
|
AlterarSenha,
|
|
12357
13907
|
{
|
|
12358
13908
|
isOpen: isOpenAlterarSenha,
|
|
@@ -12360,10 +13910,10 @@ function LoginSeguranca(props) {
|
|
|
12360
13910
|
credentialsConfig
|
|
12361
13911
|
}
|
|
12362
13912
|
),
|
|
12363
|
-
/* @__PURE__ */
|
|
12364
|
-
/* @__PURE__ */
|
|
12365
|
-
/* @__PURE__ */
|
|
12366
|
-
/* @__PURE__ */
|
|
13913
|
+
/* @__PURE__ */ jsx190(Divider8, {}),
|
|
13914
|
+
/* @__PURE__ */ jsx190(Typography38, { variant: "h6", children: "Login com Whastapp" }),
|
|
13915
|
+
/* @__PURE__ */ jsxs95(Stack57, { direction: "row", spacing: 2, children: [
|
|
13916
|
+
/* @__PURE__ */ jsx190(
|
|
12367
13917
|
WhatsAppTextField,
|
|
12368
13918
|
{
|
|
12369
13919
|
disabled: Boolean(data?.whatsappVerifiedAt),
|
|
@@ -12376,26 +13926,26 @@ function LoginSeguranca(props) {
|
|
|
12376
13926
|
}
|
|
12377
13927
|
}
|
|
12378
13928
|
),
|
|
12379
|
-
data.whatsappVerifiedAt && /* @__PURE__ */
|
|
12380
|
-
|
|
13929
|
+
data.whatsappVerifiedAt && /* @__PURE__ */ jsxs95(
|
|
13930
|
+
Stack57,
|
|
12381
13931
|
{
|
|
12382
13932
|
direction: "row",
|
|
12383
13933
|
spacing: 1,
|
|
12384
13934
|
justifyContent: "center",
|
|
12385
13935
|
alignItems: "center",
|
|
12386
13936
|
children: [
|
|
12387
|
-
/* @__PURE__ */
|
|
12388
|
-
/* @__PURE__ */
|
|
13937
|
+
/* @__PURE__ */ jsx190(Verified, { color: "success" }),
|
|
13938
|
+
/* @__PURE__ */ jsx190(Typography38, { variant: "body2", children: "N\xFAmero Verificado" })
|
|
12389
13939
|
]
|
|
12390
13940
|
}
|
|
12391
13941
|
),
|
|
12392
|
-
data.whatsappNumber && data.whatsappNumber.replace(/\D/g, "").length === 11 && !data.whatsappVerifiedAt && /* @__PURE__ */
|
|
13942
|
+
data.whatsappNumber && data.whatsappNumber.replace(/\D/g, "").length === 11 && !data.whatsappVerifiedAt && /* @__PURE__ */ jsx190(Button_default, { isLoading: isAlterando, onClick: handleSalvarWhastapp, children: "Salvar Whatsapp" })
|
|
12393
13943
|
] }),
|
|
12394
|
-
usuario.whatsappNumber && usuario.whatsappNumber.replace(/\D/g, "").length === 11 && !data.whatsappVerifiedAt && /* @__PURE__ */
|
|
12395
|
-
|
|
13944
|
+
usuario.whatsappNumber && usuario.whatsappNumber.replace(/\D/g, "").length === 11 && !data.whatsappVerifiedAt && /* @__PURE__ */ jsx190(
|
|
13945
|
+
Alert15,
|
|
12396
13946
|
{
|
|
12397
13947
|
severity: "warning",
|
|
12398
|
-
action: /* @__PURE__ */
|
|
13948
|
+
action: /* @__PURE__ */ jsx190(
|
|
12399
13949
|
Button_default,
|
|
12400
13950
|
{
|
|
12401
13951
|
isLoading: isGerandoNumero,
|
|
@@ -12406,7 +13956,7 @@ function LoginSeguranca(props) {
|
|
|
12406
13956
|
children: "O seu n\xFAmero de whatsapp ainda n\xE3o est\xE1 validado"
|
|
12407
13957
|
}
|
|
12408
13958
|
),
|
|
12409
|
-
/* @__PURE__ */
|
|
13959
|
+
/* @__PURE__ */ jsx190(
|
|
12410
13960
|
DialogVerificarWhastapp,
|
|
12411
13961
|
{
|
|
12412
13962
|
open: isOpenVerificarWhastapp,
|
|
@@ -12426,16 +13976,16 @@ function LoginSeguranca(props) {
|
|
|
12426
13976
|
|
|
12427
13977
|
// src/Profile/index.tsx
|
|
12428
13978
|
import { useUserContext as useUserContext2 } from "@data-c/providers";
|
|
12429
|
-
import { Fragment as
|
|
13979
|
+
import { Fragment as Fragment12, jsx as jsx191, jsxs as jsxs96 } from "react/jsx-runtime";
|
|
12430
13980
|
function Profile(props) {
|
|
12431
|
-
const [tabValue, setTabValue] =
|
|
13981
|
+
const [tabValue, setTabValue] = useState40(0);
|
|
12432
13982
|
const {
|
|
12433
13983
|
user: usuarioLogado,
|
|
12434
13984
|
setUser: setUsuarioLogado,
|
|
12435
13985
|
credentialsConfig
|
|
12436
13986
|
} = useUserContext2();
|
|
12437
|
-
return /* @__PURE__ */
|
|
12438
|
-
/* @__PURE__ */
|
|
13987
|
+
return /* @__PURE__ */ jsx191(Fragment12, { children: /* @__PURE__ */ jsxs96(Stack58, { spacing: 2, direction: "row", children: [
|
|
13988
|
+
/* @__PURE__ */ jsx191(Stack58, { sx: { width: "200px" }, children: /* @__PURE__ */ jsxs96(
|
|
12439
13989
|
Tabs,
|
|
12440
13990
|
{
|
|
12441
13991
|
orientation: "vertical",
|
|
@@ -12449,20 +13999,20 @@ function Profile(props) {
|
|
|
12449
13999
|
}
|
|
12450
14000
|
},
|
|
12451
14001
|
children: [
|
|
12452
|
-
/* @__PURE__ */
|
|
12453
|
-
/* @__PURE__ */
|
|
14002
|
+
/* @__PURE__ */ jsx191(Tab, { label: "Minha Conta", value: 0 }),
|
|
14003
|
+
/* @__PURE__ */ jsx191(Tab, { label: "Login e Seguran\xE7a", value: 1 })
|
|
12454
14004
|
]
|
|
12455
14005
|
}
|
|
12456
14006
|
) }),
|
|
12457
|
-
/* @__PURE__ */
|
|
12458
|
-
/* @__PURE__ */
|
|
14007
|
+
/* @__PURE__ */ jsxs96(Stack58, { sx: { flexGrow: 1 }, children: [
|
|
14008
|
+
/* @__PURE__ */ jsx191(TabPanel, { value: tabValue, index: 0, children: /* @__PURE__ */ jsx191(
|
|
12459
14009
|
MinhaConta,
|
|
12460
14010
|
{
|
|
12461
14011
|
credentialsConfig,
|
|
12462
14012
|
usuario: usuarioLogado || {}
|
|
12463
14013
|
}
|
|
12464
14014
|
) }),
|
|
12465
|
-
/* @__PURE__ */
|
|
14015
|
+
/* @__PURE__ */ jsx191(TabPanel, { value: tabValue, index: 1, children: /* @__PURE__ */ jsx191(
|
|
12466
14016
|
LoginSeguranca,
|
|
12467
14017
|
{
|
|
12468
14018
|
onWhastappSaved: (u) => {
|
|
@@ -12482,11 +14032,13 @@ import {
|
|
|
12482
14032
|
createTheme as createTheme2,
|
|
12483
14033
|
styled as styled10,
|
|
12484
14034
|
ThemeProvider,
|
|
12485
|
-
useTheme as
|
|
14035
|
+
useTheme as useTheme17
|
|
12486
14036
|
} from "@mui/material/styles";
|
|
12487
14037
|
export {
|
|
12488
14038
|
AlterarLicenca,
|
|
12489
14039
|
AlterarSenha,
|
|
14040
|
+
AlterarSenhaV2,
|
|
14041
|
+
Auth,
|
|
12490
14042
|
Autocomplete,
|
|
12491
14043
|
Avatar,
|
|
12492
14044
|
Breadcrumbs,
|
|
@@ -12499,6 +14051,7 @@ export {
|
|
|
12499
14051
|
ColorsGrid,
|
|
12500
14052
|
Content2 as Content,
|
|
12501
14053
|
ContentTitle_default as ContentTitle,
|
|
14054
|
+
CredentialsProvider,
|
|
12502
14055
|
default2 as CssBaseline,
|
|
12503
14056
|
CurrencyCellStyle,
|
|
12504
14057
|
CurrencyTextField_default as CurrencyTextField,
|
|
@@ -12544,11 +14097,12 @@ export {
|
|
|
12544
14097
|
renderMenuItems,
|
|
12545
14098
|
styled10 as styled,
|
|
12546
14099
|
theme_default as theme,
|
|
14100
|
+
useCredentialsContext,
|
|
12547
14101
|
useDialogs2 as useDialogs,
|
|
12548
14102
|
useFilter,
|
|
12549
14103
|
useFilterApi3 as useFilterApi,
|
|
12550
14104
|
useMenu,
|
|
12551
|
-
|
|
14105
|
+
useTheme17 as useTheme,
|
|
12552
14106
|
useTransporter
|
|
12553
14107
|
};
|
|
12554
14108
|
//# sourceMappingURL=index.mjs.map
|