@data-c/ui 0.2.92 → 0.2.93
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 +1476 -279
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1948 -751
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -2872,10 +2872,10 @@ var Condition = class {
|
|
|
2872
2872
|
otherwise
|
|
2873
2873
|
} = config;
|
|
2874
2874
|
let check = typeof is === "function" ? is : (...values) => values.every((value) => value === is);
|
|
2875
|
-
return new Condition(refs, (values,
|
|
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
|
}
|
|
@@ -10281,6 +10281,1302 @@ var CurrencyTextField = _react.forwardRef.call(void 0,
|
|
|
10281
10281
|
);
|
|
10282
10282
|
var CurrencyTextField_default = CurrencyTextField;
|
|
10283
10283
|
|
|
10284
|
+
// src/v2/Auth/index.tsx
|
|
10285
|
+
|
|
10286
|
+
|
|
10287
|
+
// src/v2/Auth/components/BannerSection/index.tsx
|
|
10288
|
+
|
|
10289
|
+
|
|
10290
|
+
function BannerSection2(props) {
|
|
10291
|
+
const { children } = props;
|
|
10292
|
+
const theme2 = _material.useTheme.call(void 0, );
|
|
10293
|
+
const fullScreen = _material.useMediaQuery.call(void 0, theme2.breakpoints.up("md"));
|
|
10294
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10295
|
+
_material.Stack,
|
|
10296
|
+
{
|
|
10297
|
+
component: "section",
|
|
10298
|
+
display: fullScreen ? "flex" : "none",
|
|
10299
|
+
width: "100%",
|
|
10300
|
+
direction: "row",
|
|
10301
|
+
justifyContent: "center",
|
|
10302
|
+
alignItems: "center",
|
|
10303
|
+
sx: {
|
|
10304
|
+
// backgroundImage: `url(${backgroundLoginImage})`,
|
|
10305
|
+
// backgroundSize: 'cover',
|
|
10306
|
+
// backgroundPosition: 'right',
|
|
10307
|
+
// backgroundRepeat: 'no-repeat',
|
|
10308
|
+
},
|
|
10309
|
+
children
|
|
10310
|
+
}
|
|
10311
|
+
);
|
|
10312
|
+
}
|
|
10313
|
+
|
|
10314
|
+
// src/v2/Auth/components/DefaultBanner/index.tsx
|
|
10315
|
+
var _ArrowRight = require('@mui/icons-material/ArrowRight'); var _ArrowRight2 = _interopRequireDefault(_ArrowRight);
|
|
10316
|
+
|
|
10317
|
+
|
|
10318
|
+
function DefaultBanner() {
|
|
10319
|
+
const theme2 = _material.useTheme.call(void 0, );
|
|
10320
|
+
const fullScreen = _material.useMediaQuery.call(void 0, theme2.breakpoints.up("md"));
|
|
10321
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10322
|
+
_material.Stack,
|
|
10323
|
+
{
|
|
10324
|
+
component: "section",
|
|
10325
|
+
display: fullScreen ? "flex" : "none",
|
|
10326
|
+
width: "100%",
|
|
10327
|
+
direction: "row",
|
|
10328
|
+
justifyContent: "center",
|
|
10329
|
+
alignItems: "center",
|
|
10330
|
+
sx: {
|
|
10331
|
+
backgroundImage: `url(https://datac-site-assets.s3.sa-east-1.amazonaws.com/background_login.png)`,
|
|
10332
|
+
backgroundSize: "cover",
|
|
10333
|
+
backgroundPosition: "right",
|
|
10334
|
+
backgroundRepeat: "no-repeat"
|
|
10335
|
+
},
|
|
10336
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { padding: "2rem", children: [
|
|
10337
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10338
|
+
_material.Typography,
|
|
10339
|
+
{
|
|
10340
|
+
component: "h1",
|
|
10341
|
+
fontSize: "3.5rem",
|
|
10342
|
+
lineHeight: "4rem",
|
|
10343
|
+
fontWeight: "bold",
|
|
10344
|
+
color: "white",
|
|
10345
|
+
fontFamily: "Montserrat",
|
|
10346
|
+
letterSpacing: 0,
|
|
10347
|
+
children: "Inova\xE7\xE3o e tecnologia"
|
|
10348
|
+
}
|
|
10349
|
+
),
|
|
10350
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10351
|
+
_material.Typography,
|
|
10352
|
+
{
|
|
10353
|
+
component: "h2",
|
|
10354
|
+
color: "white",
|
|
10355
|
+
fontSize: "2.5rem",
|
|
10356
|
+
lineHeight: "3rem",
|
|
10357
|
+
letterSpacing: 0,
|
|
10358
|
+
fontWeight: "bold",
|
|
10359
|
+
fontFamily: "Montserrat",
|
|
10360
|
+
children: "para empresas de resultado"
|
|
10361
|
+
}
|
|
10362
|
+
),
|
|
10363
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10364
|
+
_material.Typography,
|
|
10365
|
+
{
|
|
10366
|
+
component: "span",
|
|
10367
|
+
fontSize: "1.25rem",
|
|
10368
|
+
lineHeight: "1.25rem",
|
|
10369
|
+
fontWeight: "300",
|
|
10370
|
+
letterSpacing: 0,
|
|
10371
|
+
marginTop: "1.5rem",
|
|
10372
|
+
marginBottom: "3rem",
|
|
10373
|
+
fontFamily: "Montserrat",
|
|
10374
|
+
sx: { color: "rgb(68, 167, 255)" },
|
|
10375
|
+
children: "Mais de 30 anos de exist\xEAncia e muitas hist\xF3rias de sucesso."
|
|
10376
|
+
}
|
|
10377
|
+
),
|
|
10378
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Link, { href: "https://site.datac.com.br/services/", target: "_blank", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
10379
|
+
Button_default,
|
|
10380
|
+
{
|
|
10381
|
+
component: "a",
|
|
10382
|
+
variant: "text",
|
|
10383
|
+
sx: {
|
|
10384
|
+
width: "fit-content",
|
|
10385
|
+
color: "rgb(255, 255, 255)",
|
|
10386
|
+
fontWeight: "400",
|
|
10387
|
+
fontSize: "0.875rem",
|
|
10388
|
+
lineHeight: "1.125rem",
|
|
10389
|
+
fontFamily: "Montserrat",
|
|
10390
|
+
backgroundColor: "rgb(22, 23, 101)",
|
|
10391
|
+
borderRadius: "30px",
|
|
10392
|
+
padding: "17px 48px",
|
|
10393
|
+
":hover": {
|
|
10394
|
+
backgroundColor: "rgb(255, 255, 255)",
|
|
10395
|
+
color: "rgb(22, 23, 101)"
|
|
10396
|
+
},
|
|
10397
|
+
alignItems: "center"
|
|
10398
|
+
},
|
|
10399
|
+
children: [
|
|
10400
|
+
"Conhe\xE7a nossos produtos",
|
|
10401
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10402
|
+
_ArrowRight2.default,
|
|
10403
|
+
{
|
|
10404
|
+
fontSize: "medium",
|
|
10405
|
+
sx: { color: (theme3) => theme3.palette.success.light }
|
|
10406
|
+
}
|
|
10407
|
+
)
|
|
10408
|
+
]
|
|
10409
|
+
}
|
|
10410
|
+
) })
|
|
10411
|
+
] })
|
|
10412
|
+
}
|
|
10413
|
+
);
|
|
10414
|
+
}
|
|
10415
|
+
|
|
10416
|
+
// src/v2/Auth/components/LoginSection/index.tsx
|
|
10417
|
+
|
|
10418
|
+
|
|
10419
|
+
// src/v2/Auth/components/EsqueciSenhaForm/index.tsx
|
|
10420
|
+
|
|
10421
|
+
|
|
10422
|
+
|
|
10423
|
+
|
|
10424
|
+
// src/v2/Auth/context/CredentialsContext.tsx
|
|
10425
|
+
|
|
10426
|
+
|
|
10427
|
+
|
|
10428
|
+
var CredentialsContext = _react.createContext.call(void 0,
|
|
10429
|
+
void 0
|
|
10430
|
+
);
|
|
10431
|
+
function CredentialsProvider({
|
|
10432
|
+
children,
|
|
10433
|
+
credentialsConfig
|
|
10434
|
+
}) {
|
|
10435
|
+
const credentials = _hooks.useCredentials.call(void 0, credentialsConfig);
|
|
10436
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10437
|
+
CredentialsContext.Provider,
|
|
10438
|
+
{
|
|
10439
|
+
value: credentials,
|
|
10440
|
+
children
|
|
10441
|
+
}
|
|
10442
|
+
);
|
|
10443
|
+
}
|
|
10444
|
+
function useCredentialsContext() {
|
|
10445
|
+
const context = _react.useContext.call(void 0, CredentialsContext);
|
|
10446
|
+
if (context === void 0) {
|
|
10447
|
+
throw new Error(
|
|
10448
|
+
"useCredentialsContext must be used within a CredentialsProvider"
|
|
10449
|
+
);
|
|
10450
|
+
}
|
|
10451
|
+
return context;
|
|
10452
|
+
}
|
|
10453
|
+
|
|
10454
|
+
// src/v2/Auth/components/EsqueciSenhaForm/index.tsx
|
|
10455
|
+
|
|
10456
|
+
var schema = create$3().shape({
|
|
10457
|
+
email: create$6().required("Informe o e-mail")
|
|
10458
|
+
});
|
|
10459
|
+
function EsqueciSenhaForm(props) {
|
|
10460
|
+
const { onLoginClick } = props;
|
|
10461
|
+
const [email, setEmail] = _react.useState.call(void 0, "");
|
|
10462
|
+
const [isSubmitting, setSubmitting] = _react.useState.call(void 0, false);
|
|
10463
|
+
const [sucessoRecuperarSenha, setSucessoRecuperarSenha] = _react.useState.call(void 0, false);
|
|
10464
|
+
const [error, setError] = _react.useState.call(void 0, null);
|
|
10465
|
+
const { recuperarSenha } = useCredentialsContext();
|
|
10466
|
+
const { validationProps, setValidationErrors } = _hooks.useValidations.call(void 0, );
|
|
10467
|
+
async function handleRecuperarSenha() {
|
|
10468
|
+
setValidationErrors(null);
|
|
10469
|
+
schema.validate({ email }, { abortEarly: false }).then(async () => {
|
|
10470
|
+
try {
|
|
10471
|
+
setSubmitting(true);
|
|
10472
|
+
await recuperarSenha(email);
|
|
10473
|
+
setSucessoRecuperarSenha(true);
|
|
10474
|
+
} catch (error2) {
|
|
10475
|
+
setError(_optionalChain([error2, 'access', _84 => _84.response, 'optionalAccess', _85 => _85.data, 'access', _86 => _86.message]));
|
|
10476
|
+
} finally {
|
|
10477
|
+
setSubmitting(false);
|
|
10478
|
+
}
|
|
10479
|
+
}).catch((error2) => {
|
|
10480
|
+
setValidationErrors(error2);
|
|
10481
|
+
});
|
|
10482
|
+
}
|
|
10483
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { component: "form", children: [
|
|
10484
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10485
|
+
_material.TextField,
|
|
10486
|
+
{
|
|
10487
|
+
name: "email",
|
|
10488
|
+
label: "E-mail",
|
|
10489
|
+
margin: "normal",
|
|
10490
|
+
placeholder: "Informe o e-mail utilizado para acessar o sistema",
|
|
10491
|
+
autoFocus: true,
|
|
10492
|
+
value: email || "",
|
|
10493
|
+
onChange: (e) => setEmail(e.target.value),
|
|
10494
|
+
...validationProps("email")
|
|
10495
|
+
}
|
|
10496
|
+
),
|
|
10497
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10498
|
+
Button_default,
|
|
10499
|
+
{
|
|
10500
|
+
fullWidth: true,
|
|
10501
|
+
variant: "contained",
|
|
10502
|
+
onClick: handleRecuperarSenha,
|
|
10503
|
+
isLoading: isSubmitting,
|
|
10504
|
+
children: "Recuperar minha senha"
|
|
10505
|
+
}
|
|
10506
|
+
),
|
|
10507
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10508
|
+
ButtonContainer,
|
|
10509
|
+
{
|
|
10510
|
+
sx: {
|
|
10511
|
+
display: "inline-flex",
|
|
10512
|
+
justifyContent: "space-between",
|
|
10513
|
+
width: "100%",
|
|
10514
|
+
marginTop: 1
|
|
10515
|
+
},
|
|
10516
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10517
|
+
Button_default,
|
|
10518
|
+
{
|
|
10519
|
+
onClick: onLoginClick,
|
|
10520
|
+
variant: "text",
|
|
10521
|
+
sx: {
|
|
10522
|
+
fontWeight: "400",
|
|
10523
|
+
":hover": {
|
|
10524
|
+
color: (theme2) => theme2.palette.primary.dark
|
|
10525
|
+
}
|
|
10526
|
+
},
|
|
10527
|
+
children: "Voltar para o Login"
|
|
10528
|
+
}
|
|
10529
|
+
)
|
|
10530
|
+
}
|
|
10531
|
+
),
|
|
10532
|
+
sucessoRecuperarSenha && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10533
|
+
_material.Alert,
|
|
10534
|
+
{
|
|
10535
|
+
severity: "success",
|
|
10536
|
+
action: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10537
|
+
Button_default,
|
|
10538
|
+
{
|
|
10539
|
+
onClick: onLoginClick,
|
|
10540
|
+
variant: "text",
|
|
10541
|
+
sx: {
|
|
10542
|
+
fontWeight: "400",
|
|
10543
|
+
":hover": {
|
|
10544
|
+
color: (theme2) => theme2.palette.primary.dark
|
|
10545
|
+
}
|
|
10546
|
+
},
|
|
10547
|
+
children: "Ir para o Login"
|
|
10548
|
+
}
|
|
10549
|
+
),
|
|
10550
|
+
children: "Enviamos para o seu e-mail as instru\xE7\xF5es para recuperar a sua senha"
|
|
10551
|
+
}
|
|
10552
|
+
),
|
|
10553
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Alert, { severity: "error", children: error })
|
|
10554
|
+
] });
|
|
10555
|
+
}
|
|
10556
|
+
|
|
10557
|
+
// src/v2/Auth/components/Header/index.tsx
|
|
10558
|
+
|
|
10559
|
+
|
|
10560
|
+
function Header3(props) {
|
|
10561
|
+
const { label, subTitle = "Acesse sua conta" } = props;
|
|
10562
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { component: "header", textAlign: "center", marginBottom: "3rem", children: [
|
|
10563
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10564
|
+
_material.Typography,
|
|
10565
|
+
{
|
|
10566
|
+
component: "h2",
|
|
10567
|
+
fontSize: "2rem",
|
|
10568
|
+
fontWeight: "bold",
|
|
10569
|
+
variant: "body1",
|
|
10570
|
+
fontFamily: "Montserrat",
|
|
10571
|
+
sx: { color: (theme2) => theme2.palette.primary.dark },
|
|
10572
|
+
children: label
|
|
10573
|
+
}
|
|
10574
|
+
),
|
|
10575
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10576
|
+
_material.Typography,
|
|
10577
|
+
{
|
|
10578
|
+
component: "h3",
|
|
10579
|
+
fontSize: "1.25rem",
|
|
10580
|
+
fontFamily: "Montserrat",
|
|
10581
|
+
color: "primary",
|
|
10582
|
+
variant: "body1",
|
|
10583
|
+
children: subTitle
|
|
10584
|
+
}
|
|
10585
|
+
)
|
|
10586
|
+
] });
|
|
10587
|
+
}
|
|
10588
|
+
|
|
10589
|
+
// src/v2/Auth/components/LicencaForm/index.tsx
|
|
10590
|
+
|
|
10591
|
+
|
|
10592
|
+
|
|
10593
|
+
function LicencaForm(props) {
|
|
10594
|
+
const { loginData, onLoginFailed, onLoginSuccess } = props;
|
|
10595
|
+
const [empresaId, setEmpresaId] = _react.useState.call(void 0, "");
|
|
10596
|
+
const { selecionarLicenca, isSubmitting } = useCredentialsContext();
|
|
10597
|
+
_react.useEffect.call(void 0, () => {
|
|
10598
|
+
if (Array.isArray(_optionalChain([loginData, 'optionalAccess', _87 => _87.empresas]))) {
|
|
10599
|
+
const empresa = _optionalChain([loginData, 'optionalAccess', _88 => _88.empresas, 'access', _89 => _89[0]]);
|
|
10600
|
+
setEmpresaId(_optionalChain([empresa, 'optionalAccess', _90 => _90.uuid]));
|
|
10601
|
+
}
|
|
10602
|
+
}, [loginData]);
|
|
10603
|
+
async function handleSelecionarLicenca() {
|
|
10604
|
+
try {
|
|
10605
|
+
const tokens = await selecionarLicenca(_optionalChain([loginData, 'optionalAccess', _91 => _91.token]), empresaId);
|
|
10606
|
+
if (tokens) {
|
|
10607
|
+
onLoginSuccess(tokens);
|
|
10608
|
+
} else {
|
|
10609
|
+
onLoginFailed("Nenhuma token definida");
|
|
10610
|
+
}
|
|
10611
|
+
} catch (err) {
|
|
10612
|
+
onLoginFailed(err);
|
|
10613
|
+
}
|
|
10614
|
+
}
|
|
10615
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { component: "form", sx: { minWidth: "290px" }, children: [
|
|
10616
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10617
|
+
_material.TextField,
|
|
10618
|
+
{
|
|
10619
|
+
label: "Licen\xE7as",
|
|
10620
|
+
margin: "normal",
|
|
10621
|
+
select: true,
|
|
10622
|
+
autoFocus: true,
|
|
10623
|
+
value: empresaId,
|
|
10624
|
+
onChange: (e) => {
|
|
10625
|
+
setEmpresaId(e.target.value);
|
|
10626
|
+
},
|
|
10627
|
+
children: _optionalChain([loginData, 'optionalAccess', _92 => _92.empresas, 'optionalAccess', _93 => _93.map, 'call', _94 => _94((empresa) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.MenuItem, { value: empresa.uuid, children: empresa.nome }, empresa.uuid))])
|
|
10628
|
+
}
|
|
10629
|
+
),
|
|
10630
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10631
|
+
Button_default,
|
|
10632
|
+
{
|
|
10633
|
+
fullWidth: true,
|
|
10634
|
+
variant: "contained",
|
|
10635
|
+
onClick: handleSelecionarLicenca,
|
|
10636
|
+
isLoading: isSubmitting,
|
|
10637
|
+
sx: { mt: 1 },
|
|
10638
|
+
children: "Confirmar"
|
|
10639
|
+
}
|
|
10640
|
+
)
|
|
10641
|
+
] });
|
|
10642
|
+
}
|
|
10643
|
+
|
|
10644
|
+
// src/v2/Auth/components/LoginForm/index.tsx
|
|
10645
|
+
|
|
10646
|
+
|
|
10647
|
+
|
|
10648
|
+
|
|
10649
|
+
|
|
10650
|
+
|
|
10651
|
+
|
|
10652
|
+
// src/v2/Auth/components/AlterarSenhaV2/index.tsx
|
|
10653
|
+
|
|
10654
|
+
|
|
10655
|
+
|
|
10656
|
+
|
|
10657
|
+
|
|
10658
|
+
|
|
10659
|
+
|
|
10660
|
+
|
|
10661
|
+
// src/v2/Auth/components/AlterarSenhaV2/components/ValidatorMessage/index.tsx
|
|
10662
|
+
|
|
10663
|
+
|
|
10664
|
+
|
|
10665
|
+
function ValidatorMessage(props) {
|
|
10666
|
+
const { isValid, message } = props;
|
|
10667
|
+
const theme2 = _material.useTheme.call(void 0, );
|
|
10668
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
10669
|
+
_material.Box,
|
|
10670
|
+
{
|
|
10671
|
+
sx: {
|
|
10672
|
+
display: "flex",
|
|
10673
|
+
flexDirection: "row",
|
|
10674
|
+
alignItems: "center"
|
|
10675
|
+
},
|
|
10676
|
+
children: [
|
|
10677
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10678
|
+
_Circle2.default,
|
|
10679
|
+
{
|
|
10680
|
+
color: isValid ? "success" : "inherit",
|
|
10681
|
+
sx: { fontSize: "8pt" }
|
|
10682
|
+
}
|
|
10683
|
+
),
|
|
10684
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10685
|
+
_material.Typography,
|
|
10686
|
+
{
|
|
10687
|
+
variant: "body2",
|
|
10688
|
+
sx: {
|
|
10689
|
+
color: isValid ? theme2.palette.success.main : "inherit",
|
|
10690
|
+
textDecoration: isValid ? "line-through" : "none",
|
|
10691
|
+
ml: 1,
|
|
10692
|
+
fontSize: "10pt"
|
|
10693
|
+
},
|
|
10694
|
+
children: message
|
|
10695
|
+
}
|
|
10696
|
+
)
|
|
10697
|
+
]
|
|
10698
|
+
}
|
|
10699
|
+
);
|
|
10700
|
+
}
|
|
10701
|
+
|
|
10702
|
+
// src/v2/Auth/components/AlterarSenhaV2/index.tsx
|
|
10703
|
+
|
|
10704
|
+
var defaultData = {
|
|
10705
|
+
senhaAtual: "",
|
|
10706
|
+
senhaNova: "",
|
|
10707
|
+
senhaNovaConfirmar: ""
|
|
10708
|
+
};
|
|
10709
|
+
var schema2 = create$3().shape({
|
|
10710
|
+
senhaAtual: create$6().required("Informe a Senha Atual."),
|
|
10711
|
+
senhaNova: create$6().required("Informe a Nova Senha."),
|
|
10712
|
+
senhaNovaConfirmar: create$6().required("Informe a Nova Senha.").oneOf([create$9("senhaNova")], "As senhas devem ser iguais.")
|
|
10713
|
+
});
|
|
10714
|
+
function AlterarSenhaV2(props) {
|
|
10715
|
+
const {
|
|
10716
|
+
isOpen,
|
|
10717
|
+
onClose,
|
|
10718
|
+
onSuccess,
|
|
10719
|
+
onFailed,
|
|
10720
|
+
primeiroAcesso,
|
|
10721
|
+
senhaAtual,
|
|
10722
|
+
email
|
|
10723
|
+
} = props;
|
|
10724
|
+
const { alterarSenha, isSubmitting } = useCredentialsContext();
|
|
10725
|
+
const { setValidationErrors, validationProps } = _hooks.useValidations.call(void 0, );
|
|
10726
|
+
const { data, handleChange, setData, changeValue } = _hooks.useForm.call(void 0, defaultData);
|
|
10727
|
+
const [ehSegura, setEhSegura] = _react.useState.call(void 0, false);
|
|
10728
|
+
const [error, setError] = _react.useState.call(void 0, null);
|
|
10729
|
+
_react.useEffect.call(void 0, () => {
|
|
10730
|
+
if (senhaAtual) {
|
|
10731
|
+
changeValue("senhaAtual", senhaAtual);
|
|
10732
|
+
}
|
|
10733
|
+
}, [senhaAtual]);
|
|
10734
|
+
_react.useEffect.call(void 0, () => {
|
|
10735
|
+
if (data.senhaNova) {
|
|
10736
|
+
setEhSegura(
|
|
10737
|
+
_isStrongPassword2.default.call(void 0, data.senhaNova, {
|
|
10738
|
+
minLength: 8,
|
|
10739
|
+
minLowercase: 1,
|
|
10740
|
+
minUppercase: 1,
|
|
10741
|
+
minNumbers: 1,
|
|
10742
|
+
minSymbols: 1
|
|
10743
|
+
})
|
|
10744
|
+
);
|
|
10745
|
+
}
|
|
10746
|
+
}, [data.senhaNova]);
|
|
10747
|
+
async function handleAlterarSenha() {
|
|
10748
|
+
setValidationErrors(null);
|
|
10749
|
+
setError(null);
|
|
10750
|
+
schema2.validate(data, { abortEarly: false }).then(async () => {
|
|
10751
|
+
const { senhaAtual: senhaAtual2, senhaNova } = data;
|
|
10752
|
+
try {
|
|
10753
|
+
const response = await alterarSenha(senhaAtual2, senhaNova, email);
|
|
10754
|
+
if (response) {
|
|
10755
|
+
if (onSuccess)
|
|
10756
|
+
onSuccess();
|
|
10757
|
+
setData(defaultData);
|
|
10758
|
+
}
|
|
10759
|
+
} catch (error2) {
|
|
10760
|
+
if (onFailed)
|
|
10761
|
+
onFailed(error2);
|
|
10762
|
+
if (_axios.isAxiosError.call(void 0, error2)) {
|
|
10763
|
+
setError(_optionalChain([error2, 'access', _95 => _95.response, 'optionalAccess', _96 => _96.data, 'access', _97 => _97.message]));
|
|
10764
|
+
return;
|
|
10765
|
+
}
|
|
10766
|
+
setError("Ocorreu um erro ao tentar alterar a senha");
|
|
10767
|
+
}
|
|
10768
|
+
}).catch((error2) => {
|
|
10769
|
+
console.log("Erros por campo:", error2.inner);
|
|
10770
|
+
console.log("Primeiro erro:", error2.errors);
|
|
10771
|
+
setValidationErrors(error2);
|
|
10772
|
+
});
|
|
10773
|
+
}
|
|
10774
|
+
function tem8caracteres() {
|
|
10775
|
+
return _optionalChain([data, 'optionalAccess', _98 => _98.senhaNova, 'access', _99 => _99.length]) >= 8;
|
|
10776
|
+
}
|
|
10777
|
+
function temLetraMinuscula() {
|
|
10778
|
+
if (_optionalChain([data, 'optionalAccess', _100 => _100.senhaNova])) {
|
|
10779
|
+
const result = _optionalChain([data, 'optionalAccess', _101 => _101.senhaNova, 'access', _102 => _102.match, 'call', _103 => _103(/[a-z]/g)]);
|
|
10780
|
+
return Array.isArray(result) && result.length > 0;
|
|
10781
|
+
}
|
|
10782
|
+
return false;
|
|
10783
|
+
}
|
|
10784
|
+
function temLetraMaisucula() {
|
|
10785
|
+
if (_optionalChain([data, 'optionalAccess', _104 => _104.senhaNova])) {
|
|
10786
|
+
const result = _optionalChain([data, 'optionalAccess', _105 => _105.senhaNova, 'access', _106 => _106.match, 'call', _107 => _107(/[A-Z]/g)]);
|
|
10787
|
+
return Array.isArray(result) && result.length > 0;
|
|
10788
|
+
}
|
|
10789
|
+
return false;
|
|
10790
|
+
}
|
|
10791
|
+
function temNumero() {
|
|
10792
|
+
if (_optionalChain([data, 'optionalAccess', _108 => _108.senhaNova])) {
|
|
10793
|
+
const result = _optionalChain([data, 'optionalAccess', _109 => _109.senhaNova, 'access', _110 => _110.match, 'call', _111 => _111(/\d/g)]);
|
|
10794
|
+
return Array.isArray(result) && result.length > 0;
|
|
10795
|
+
}
|
|
10796
|
+
return false;
|
|
10797
|
+
}
|
|
10798
|
+
function temCaracterEspecial() {
|
|
10799
|
+
if (_optionalChain([data, 'optionalAccess', _112 => _112.senhaNova])) {
|
|
10800
|
+
const result = _optionalChain([data, 'optionalAccess', _113 => _113.senhaNova, 'access', _114 => _114.match, 'call', _115 => _115(/\W/g)]);
|
|
10801
|
+
return Array.isArray(result) && result.length > 0;
|
|
10802
|
+
}
|
|
10803
|
+
return false;
|
|
10804
|
+
}
|
|
10805
|
+
function asSenhasSaoIguais() {
|
|
10806
|
+
if (_optionalChain([data, 'optionalAccess', _116 => _116.senhaNova]) === "")
|
|
10807
|
+
return false;
|
|
10808
|
+
return _optionalChain([data, 'optionalAccess', _117 => _117.senhaNova]) === _optionalChain([data, 'optionalAccess', _118 => _118.senhaNovaConfirmar]);
|
|
10809
|
+
}
|
|
10810
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog_default.Root, { open: isOpen, onClose: (_) => onClose(), maxWidth: "md", children: [
|
|
10811
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog_default.Header, { children: [
|
|
10812
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.Title, { children: "Alterar Senha" }),
|
|
10813
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.ActionClose, { onClose })
|
|
10814
|
+
] }),
|
|
10815
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.Content, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Grid, { container: true, spacing: 2, children: [
|
|
10816
|
+
primeiroAcesso && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid, { size: 12, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Alert, { severity: "info", children: [
|
|
10817
|
+
"Voc\xEA est\xE1 acessando o sistema com uma senha tempor\xE1ria.",
|
|
10818
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {}),
|
|
10819
|
+
"Cadastre uma senha segura para deixar sua conta mais protegida."
|
|
10820
|
+
] }) }),
|
|
10821
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Grid, { size: 12, children: [
|
|
10822
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10823
|
+
PasswordTextField,
|
|
10824
|
+
{
|
|
10825
|
+
name: "senhaAtual",
|
|
10826
|
+
label: "Senha Atual",
|
|
10827
|
+
value: _optionalChain([data, 'optionalAccess', _119 => _119.senhaAtual]) || "",
|
|
10828
|
+
onChange: handleChange,
|
|
10829
|
+
...validationProps("senhaAtual")
|
|
10830
|
+
}
|
|
10831
|
+
),
|
|
10832
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
10833
|
+
_material.Box,
|
|
10834
|
+
{
|
|
10835
|
+
sx: { display: "flex", alignItems: "center", gap: 0.5, mt: 0.5 },
|
|
10836
|
+
children: [
|
|
10837
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _InfoOutlined2.default, { sx: { fontSize: 14, color: "text.secondary" } }),
|
|
10838
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "caption", color: "text.secondary", children: "Essa \xE9 a senha que voc\xEA utiliza para acessar o sistema atualmente." })
|
|
10839
|
+
]
|
|
10840
|
+
}
|
|
10841
|
+
)
|
|
10842
|
+
] }),
|
|
10843
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid, { size: 12, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Divider, {}) }),
|
|
10844
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid, { size: 12, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10845
|
+
PasswordTextField,
|
|
10846
|
+
{
|
|
10847
|
+
name: "senhaNova",
|
|
10848
|
+
label: "Nova Senha",
|
|
10849
|
+
value: _optionalChain([data, 'optionalAccess', _120 => _120.senhaNova]) || "",
|
|
10850
|
+
onChange: handleChange,
|
|
10851
|
+
...validationProps("senhaNova")
|
|
10852
|
+
}
|
|
10853
|
+
) }),
|
|
10854
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Grid, { size: 12, children: [
|
|
10855
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10856
|
+
PasswordTextField,
|
|
10857
|
+
{
|
|
10858
|
+
name: "senhaNovaConfirmar",
|
|
10859
|
+
label: "Confirmar Nova Senha",
|
|
10860
|
+
value: _optionalChain([data, 'optionalAccess', _121 => _121.senhaNovaConfirmar]) || "",
|
|
10861
|
+
onChange: handleChange,
|
|
10862
|
+
...validationProps("senhaNovaConfirmar")
|
|
10863
|
+
}
|
|
10864
|
+
),
|
|
10865
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
10866
|
+
_material.Box,
|
|
10867
|
+
{
|
|
10868
|
+
sx: { display: "flex", alignItems: "center", gap: 0.5, mt: 0.5 },
|
|
10869
|
+
children: [
|
|
10870
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _InfoOutlined2.default, { sx: { fontSize: 14, color: "text.secondary" } }),
|
|
10871
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "caption", color: "text.secondary", children: "Informe nos campos acima a nova senha que deseja utilizar." })
|
|
10872
|
+
]
|
|
10873
|
+
}
|
|
10874
|
+
)
|
|
10875
|
+
] }),
|
|
10876
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Grid, { size: 12, children: [
|
|
10877
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10878
|
+
ValidatorMessage,
|
|
10879
|
+
{
|
|
10880
|
+
isValid: tem8caracteres(),
|
|
10881
|
+
message: "O tamanho m\xEDnimo da nova senha \xE9 de 8 caracteres"
|
|
10882
|
+
}
|
|
10883
|
+
),
|
|
10884
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10885
|
+
ValidatorMessage,
|
|
10886
|
+
{
|
|
10887
|
+
isValid: temLetraMinuscula(),
|
|
10888
|
+
message: "A nova senha deve ter ao menos uma letra min\xFAscula"
|
|
10889
|
+
}
|
|
10890
|
+
),
|
|
10891
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10892
|
+
ValidatorMessage,
|
|
10893
|
+
{
|
|
10894
|
+
isValid: temLetraMaisucula(),
|
|
10895
|
+
message: "A nova senha deve ter ao menos uma letra mai\xFAscula"
|
|
10896
|
+
}
|
|
10897
|
+
),
|
|
10898
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10899
|
+
ValidatorMessage,
|
|
10900
|
+
{
|
|
10901
|
+
isValid: temNumero(),
|
|
10902
|
+
message: "A nova senha deve ter ao menos um n\xFAmero"
|
|
10903
|
+
}
|
|
10904
|
+
),
|
|
10905
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10906
|
+
ValidatorMessage,
|
|
10907
|
+
{
|
|
10908
|
+
isValid: temCaracterEspecial(),
|
|
10909
|
+
message: "A nova senha deve ter ao menos um caracter especial"
|
|
10910
|
+
}
|
|
10911
|
+
),
|
|
10912
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10913
|
+
ValidatorMessage,
|
|
10914
|
+
{
|
|
10915
|
+
isValid: asSenhasSaoIguais(),
|
|
10916
|
+
message: "A confirma\xE7\xE3o da nova senha deve ser igual \xE0 nova senha"
|
|
10917
|
+
}
|
|
10918
|
+
)
|
|
10919
|
+
] }),
|
|
10920
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid, { size: 12, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Alert, { severity: "error", children: error }) })
|
|
10921
|
+
] }) }),
|
|
10922
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.Footer, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog_default.Actions, { children: [
|
|
10923
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.ActionCancelar, { onClick: () => onClose() }),
|
|
10924
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10925
|
+
Dialog_default.ActionSalvar,
|
|
10926
|
+
{
|
|
10927
|
+
label: "Alterar Senha",
|
|
10928
|
+
onClick: handleAlterarSenha,
|
|
10929
|
+
isLoading: isSubmitting,
|
|
10930
|
+
disabled: !ehSegura
|
|
10931
|
+
}
|
|
10932
|
+
)
|
|
10933
|
+
] }) })
|
|
10934
|
+
] });
|
|
10935
|
+
}
|
|
10936
|
+
|
|
10937
|
+
// src/v2/Auth/components/LoginForm/index.tsx
|
|
10938
|
+
|
|
10939
|
+
var schema3 = create$3().shape({
|
|
10940
|
+
email: create$6().required("Informe o e-mail"),
|
|
10941
|
+
password: create$6().required("Informe a senha")
|
|
10942
|
+
});
|
|
10943
|
+
function LoginForm(props) {
|
|
10944
|
+
const { onLoginSuccess, onLoginFailed, onOptionsClick } = props;
|
|
10945
|
+
const [email, setEmail] = _react.useState.call(void 0, "");
|
|
10946
|
+
const [password, setPassword] = _react.useState.call(void 0, "");
|
|
10947
|
+
const [isLoading, setLoading] = _react.useState.call(void 0, false);
|
|
10948
|
+
const [exibirAlterarSenha, setExibirAlterarSenha] = _react.useState.call(void 0, false);
|
|
10949
|
+
const [sucessoAlterarSenha, setSucessoAlterarSenha] = _react.useState.call(void 0, false);
|
|
10950
|
+
const [error, setError] = _react.useState.call(void 0, null);
|
|
10951
|
+
const { login } = useCredentialsContext();
|
|
10952
|
+
const { validationProps, setValidationErrors } = _hooks.useValidations.call(void 0, );
|
|
10953
|
+
async function handleLogin() {
|
|
10954
|
+
setValidationErrors(null);
|
|
10955
|
+
setError(null);
|
|
10956
|
+
schema3.validate({ email, password }, { abortEarly: false }).then(async () => {
|
|
10957
|
+
setLoading(true);
|
|
10958
|
+
try {
|
|
10959
|
+
const loginResponse = await login(email, password);
|
|
10960
|
+
if (loginResponse) {
|
|
10961
|
+
onLoginSuccess(loginResponse);
|
|
10962
|
+
}
|
|
10963
|
+
} catch (err) {
|
|
10964
|
+
if (_axios.isAxiosError.call(void 0, err)) {
|
|
10965
|
+
const axiosError = err;
|
|
10966
|
+
if (_optionalChain([axiosError, 'access', _122 => _122.response, 'optionalAccess', _123 => _123.data, 'access', _124 => _124.code]) === "E_FIRST_ACCESS") {
|
|
10967
|
+
setExibirAlterarSenha(true);
|
|
10968
|
+
return;
|
|
10969
|
+
}
|
|
10970
|
+
setError(_optionalChain([err, 'access', _125 => _125.response, 'optionalAccess', _126 => _126.data, 'access', _127 => _127.message]));
|
|
10971
|
+
}
|
|
10972
|
+
onLoginFailed(err);
|
|
10973
|
+
}
|
|
10974
|
+
}).catch((err) => {
|
|
10975
|
+
setValidationErrors(err);
|
|
10976
|
+
}).finally(() => {
|
|
10977
|
+
setLoading(false);
|
|
10978
|
+
});
|
|
10979
|
+
}
|
|
10980
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { component: "form", onSubmit: handleLogin, children: [
|
|
10981
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
10982
|
+
_material.Stack,
|
|
10983
|
+
{
|
|
10984
|
+
spacing: 2,
|
|
10985
|
+
children: [
|
|
10986
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10987
|
+
_material.TextField,
|
|
10988
|
+
{
|
|
10989
|
+
name: "email",
|
|
10990
|
+
label: "E-mail",
|
|
10991
|
+
margin: "normal",
|
|
10992
|
+
autoFocus: true,
|
|
10993
|
+
value: email || "",
|
|
10994
|
+
onChange: (e) => setEmail(e.target.value),
|
|
10995
|
+
...validationProps("email")
|
|
10996
|
+
}
|
|
10997
|
+
),
|
|
10998
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10999
|
+
PasswordTextField,
|
|
11000
|
+
{
|
|
11001
|
+
name: "password",
|
|
11002
|
+
label: "Senha",
|
|
11003
|
+
value: password || "",
|
|
11004
|
+
onChange: (e) => setPassword(e.target.value),
|
|
11005
|
+
onKeyDown: (e) => e.key === "Enter" && handleLogin(),
|
|
11006
|
+
...validationProps("password")
|
|
11007
|
+
}
|
|
11008
|
+
),
|
|
11009
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11010
|
+
Button_default,
|
|
11011
|
+
{
|
|
11012
|
+
fullWidth: true,
|
|
11013
|
+
variant: "contained",
|
|
11014
|
+
onClick: handleLogin,
|
|
11015
|
+
isLoading,
|
|
11016
|
+
sx: { mt: 1 },
|
|
11017
|
+
children: "Entrar"
|
|
11018
|
+
}
|
|
11019
|
+
)
|
|
11020
|
+
]
|
|
11021
|
+
}
|
|
11022
|
+
),
|
|
11023
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11024
|
+
Button_default,
|
|
11025
|
+
{
|
|
11026
|
+
onClick: () => onOptionsClick("esqueci-senha"),
|
|
11027
|
+
variant: "text",
|
|
11028
|
+
disableRipple: true,
|
|
11029
|
+
disableTouchRipple: true,
|
|
11030
|
+
sx: {
|
|
11031
|
+
justifyContent: "flex-start",
|
|
11032
|
+
// alinha o conteúdo à esquerda
|
|
11033
|
+
alignContent: "center",
|
|
11034
|
+
alignItems: "center",
|
|
11035
|
+
textAlign: "left",
|
|
11036
|
+
// alinha o texto internamente à esquerda
|
|
11037
|
+
width: "120px",
|
|
11038
|
+
// define uma largura para perceber o alinhamento
|
|
11039
|
+
marginTop: 0.5,
|
|
11040
|
+
fontWeight: "400",
|
|
11041
|
+
":hover": {
|
|
11042
|
+
// color: (theme) => theme.palette.,
|
|
11043
|
+
}
|
|
11044
|
+
},
|
|
11045
|
+
children: "Esqueci a senha"
|
|
11046
|
+
}
|
|
11047
|
+
),
|
|
11048
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Alert, { severity: "error", children: error }),
|
|
11049
|
+
sucessoAlterarSenha && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Alert, { severity: "success", children: [
|
|
11050
|
+
"Senha cadastrada com sucesso",
|
|
11051
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {}),
|
|
11052
|
+
"Tudo pronto para voc\xEA fazer o login"
|
|
11053
|
+
] }),
|
|
11054
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
11055
|
+
_material.Stack,
|
|
11056
|
+
{
|
|
11057
|
+
direction: "row",
|
|
11058
|
+
justifyContent: "center",
|
|
11059
|
+
alignItems: "center",
|
|
11060
|
+
mt: 2,
|
|
11061
|
+
mb: 2,
|
|
11062
|
+
children: [
|
|
11063
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Divider, { sx: { flexGrow: 1, mr: 1 } }),
|
|
11064
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { children: "Ou fa\xE7a login com" }),
|
|
11065
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Divider, { sx: { flexGrow: 1, ml: 1 } })
|
|
11066
|
+
]
|
|
11067
|
+
}
|
|
11068
|
+
),
|
|
11069
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { spacing: 1, children: [
|
|
11070
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11071
|
+
Button_default,
|
|
11072
|
+
{
|
|
11073
|
+
onClick: () => onOptionsClick("otp-email"),
|
|
11074
|
+
startIcon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Mail2.default, {}),
|
|
11075
|
+
children: "Entrar com senha tempor\xE1ria"
|
|
11076
|
+
}
|
|
11077
|
+
),
|
|
11078
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11079
|
+
Button_default,
|
|
11080
|
+
{
|
|
11081
|
+
onClick: () => onOptionsClick("otp-whatsapp"),
|
|
11082
|
+
startIcon: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _WhatsApp2.default, {}),
|
|
11083
|
+
children: "Entrar com senha tempor\xE1ria"
|
|
11084
|
+
}
|
|
11085
|
+
)
|
|
11086
|
+
] }),
|
|
11087
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11088
|
+
AlterarSenhaV2,
|
|
11089
|
+
{
|
|
11090
|
+
senhaAtual: password,
|
|
11091
|
+
email,
|
|
11092
|
+
primeiroAcesso: true,
|
|
11093
|
+
isOpen: exibirAlterarSenha,
|
|
11094
|
+
onClose: async () => setExibirAlterarSenha(false),
|
|
11095
|
+
onSuccess: () => {
|
|
11096
|
+
setExibirAlterarSenha(false);
|
|
11097
|
+
setSucessoAlterarSenha(true);
|
|
11098
|
+
setPassword("");
|
|
11099
|
+
}
|
|
11100
|
+
}
|
|
11101
|
+
)
|
|
11102
|
+
] });
|
|
11103
|
+
}
|
|
11104
|
+
|
|
11105
|
+
// src/v2/Auth/components/LoginSection/index.tsx
|
|
11106
|
+
|
|
11107
|
+
|
|
11108
|
+
// src/v2/Auth/components/OtpForm/index.tsx
|
|
11109
|
+
|
|
11110
|
+
var _HelpOutline = require('@mui/icons-material/HelpOutline'); var _HelpOutline2 = _interopRequireDefault(_HelpOutline);
|
|
11111
|
+
|
|
11112
|
+
|
|
11113
|
+
|
|
11114
|
+
// src/WhastappTextField/index.tsx
|
|
11115
|
+
|
|
11116
|
+
var _TextField = require('@mui/material/TextField'); var _TextField2 = _interopRequireDefault(_TextField);
|
|
11117
|
+
|
|
11118
|
+
var formatPhone = (value) => {
|
|
11119
|
+
const digits = value.replace(/\D/g, "");
|
|
11120
|
+
if (digits.length <= 2) {
|
|
11121
|
+
return `(${digits}`;
|
|
11122
|
+
}
|
|
11123
|
+
if (digits.length <= 7) {
|
|
11124
|
+
return `(${digits.slice(0, 2)}) ${digits.slice(2)}`;
|
|
11125
|
+
}
|
|
11126
|
+
if (digits.length <= 11) {
|
|
11127
|
+
return `(${digits.slice(0, 2)}) ${digits.slice(2, 7)}-${digits.slice(7)}`;
|
|
11128
|
+
}
|
|
11129
|
+
return `(${digits.slice(0, 2)}) ${digits.slice(2, 7)}-${digits.slice(7, 11)}`;
|
|
11130
|
+
};
|
|
11131
|
+
function WhatsAppTextField(props) {
|
|
11132
|
+
const { value: propValue, onChange: propOnChange, ...rest } = props;
|
|
11133
|
+
const [internalValue, setInternalValue] = _react.useState.call(void 0, "");
|
|
11134
|
+
const isControlled = propValue !== void 0;
|
|
11135
|
+
const displayedValue = _react.useMemo.call(void 0, () => {
|
|
11136
|
+
return isControlled ? formatPhone(propValue || "") : internalValue;
|
|
11137
|
+
}, [propValue, internalValue, isControlled]);
|
|
11138
|
+
const handleChange = (event) => {
|
|
11139
|
+
const masked = formatPhone(event.target.value);
|
|
11140
|
+
if (!isControlled) {
|
|
11141
|
+
setInternalValue(masked);
|
|
11142
|
+
}
|
|
11143
|
+
if (propOnChange) {
|
|
11144
|
+
const customEvent = {
|
|
11145
|
+
...event,
|
|
11146
|
+
target: {
|
|
11147
|
+
...event.target,
|
|
11148
|
+
value: masked
|
|
11149
|
+
}
|
|
11150
|
+
};
|
|
11151
|
+
propOnChange(customEvent);
|
|
11152
|
+
}
|
|
11153
|
+
};
|
|
11154
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11155
|
+
_TextField2.default,
|
|
11156
|
+
{
|
|
11157
|
+
value: displayedValue,
|
|
11158
|
+
onChange: handleChange,
|
|
11159
|
+
inputProps: { maxLength: 15 },
|
|
11160
|
+
...rest
|
|
11161
|
+
}
|
|
11162
|
+
);
|
|
11163
|
+
}
|
|
11164
|
+
|
|
11165
|
+
// src/v2/Auth/components/OtpForm/DialogVerificarOtp.tsx
|
|
11166
|
+
|
|
11167
|
+
|
|
11168
|
+
|
|
11169
|
+
// src/VerificationCodeInput/index.tsx
|
|
11170
|
+
|
|
11171
|
+
|
|
11172
|
+
|
|
11173
|
+
function VerificationCodeInput({
|
|
11174
|
+
length = 6,
|
|
11175
|
+
value,
|
|
11176
|
+
onChange
|
|
11177
|
+
}) {
|
|
11178
|
+
const inputsRef = _react.useRef.call(void 0, []);
|
|
11179
|
+
const handleChange = (index, digit) => {
|
|
11180
|
+
const chars = "ABCDEF0123456789";
|
|
11181
|
+
const cleanDigit = digit.toUpperCase().split("").find((char) => chars.includes(char)) || "";
|
|
11182
|
+
const nextValue = value.split("");
|
|
11183
|
+
nextValue[index] = cleanDigit;
|
|
11184
|
+
const updatedValue = nextValue.join("");
|
|
11185
|
+
onChange(updatedValue);
|
|
11186
|
+
if (cleanDigit && index < length - 1) {
|
|
11187
|
+
_optionalChain([inputsRef, 'access', _128 => _128.current, 'access', _129 => _129[index + 1], 'optionalAccess', _130 => _130.focus, 'call', _131 => _131()]);
|
|
11188
|
+
}
|
|
11189
|
+
};
|
|
11190
|
+
const handleKeyDown = (index, event) => {
|
|
11191
|
+
if (event.key === "Backspace" && !value[index] && index > 0) {
|
|
11192
|
+
_optionalChain([inputsRef, 'access', _132 => _132.current, 'access', _133 => _133[index - 1], 'optionalAccess', _134 => _134.focus, 'call', _135 => _135()]);
|
|
11193
|
+
}
|
|
11194
|
+
};
|
|
11195
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Box, { display: "flex", gap: 1, children: Array.from({ length }).map((_, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11196
|
+
_material.TextField,
|
|
11197
|
+
{
|
|
11198
|
+
autoFocus: i === 0,
|
|
11199
|
+
inputRef: (el) => inputsRef.current[i] = el,
|
|
11200
|
+
slotProps: {
|
|
11201
|
+
htmlInput: {
|
|
11202
|
+
maxLength: 1,
|
|
11203
|
+
style: {
|
|
11204
|
+
textAlign: "center",
|
|
11205
|
+
fontSize: "24px",
|
|
11206
|
+
width: "24px",
|
|
11207
|
+
height: "36px"
|
|
11208
|
+
}
|
|
11209
|
+
}
|
|
11210
|
+
},
|
|
11211
|
+
value: value[i] || "",
|
|
11212
|
+
onChange: (e) => handleChange(i, e.target.value),
|
|
11213
|
+
onKeyDown: (e) => handleKeyDown(i, e)
|
|
11214
|
+
},
|
|
11215
|
+
i
|
|
11216
|
+
)) });
|
|
11217
|
+
}
|
|
11218
|
+
|
|
11219
|
+
// src/v2/Auth/components/OtpForm/DialogVerificarOtp.tsx
|
|
11220
|
+
|
|
11221
|
+
function DialogVerificarOtp(props) {
|
|
11222
|
+
const { open, onClose, payload, onLoginSuccess } = props;
|
|
11223
|
+
const [code, setCode] = _react.useState.call(void 0, "");
|
|
11224
|
+
const [error, setError] = _react.useState.call(void 0, false);
|
|
11225
|
+
const [isLoading, setLoading] = _react.useState.call(void 0, false);
|
|
11226
|
+
const { validarOtpVerificationCode } = useCredentialsContext();
|
|
11227
|
+
_react.useEffect.call(void 0, () => {
|
|
11228
|
+
if (error) {
|
|
11229
|
+
setTimeout(() => {
|
|
11230
|
+
setError(false);
|
|
11231
|
+
}, 3e3);
|
|
11232
|
+
}
|
|
11233
|
+
}, [error]);
|
|
11234
|
+
async function handleOtpLogin() {
|
|
11235
|
+
try {
|
|
11236
|
+
setLoading(true);
|
|
11237
|
+
const loginResponse = await validarOtpVerificationCode({
|
|
11238
|
+
channel: payload.channel,
|
|
11239
|
+
target: payload.target,
|
|
11240
|
+
code
|
|
11241
|
+
});
|
|
11242
|
+
if (loginResponse) {
|
|
11243
|
+
onLoginSuccess(loginResponse);
|
|
11244
|
+
}
|
|
11245
|
+
onClose();
|
|
11246
|
+
} catch (err) {
|
|
11247
|
+
setError(err.response.data.message);
|
|
11248
|
+
} finally {
|
|
11249
|
+
setLoading(false);
|
|
11250
|
+
}
|
|
11251
|
+
}
|
|
11252
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog_default.Root, { open, onClose: (_) => onClose(), maxWidth: "xs", children: [
|
|
11253
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog_default.Header, { children: [
|
|
11254
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.Title, { children: "Entrar com senha tempor\xE1ria" }),
|
|
11255
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.ActionClose, { onClose })
|
|
11256
|
+
] }),
|
|
11257
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.Content, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
11258
|
+
_material.Stack,
|
|
11259
|
+
{
|
|
11260
|
+
spacing: 2,
|
|
11261
|
+
justifyContent: "center",
|
|
11262
|
+
alignContent: "center",
|
|
11263
|
+
alignItems: "center",
|
|
11264
|
+
children: [
|
|
11265
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11266
|
+
_material.Typography,
|
|
11267
|
+
{
|
|
11268
|
+
variant: "subtitle1",
|
|
11269
|
+
sx: { fontWeight: "bolder", fontSize: "11pt" },
|
|
11270
|
+
children: "\u{1F510} Digite a senha tempor\xE1ria para acessar sua conta"
|
|
11271
|
+
}
|
|
11272
|
+
),
|
|
11273
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body1", sx: { fontSize: "10pt" }, children: [
|
|
11274
|
+
"Enviamos uma senha tempor\xE1ria para ",
|
|
11275
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "b", { children: payload.target }),
|
|
11276
|
+
". ",
|
|
11277
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {}),
|
|
11278
|
+
"Digite o c\xF3digo abaixo para acessar sua conta."
|
|
11279
|
+
] }),
|
|
11280
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11281
|
+
VerificationCodeInput,
|
|
11282
|
+
{
|
|
11283
|
+
value: code,
|
|
11284
|
+
onChange: (value) => {
|
|
11285
|
+
setCode(value);
|
|
11286
|
+
}
|
|
11287
|
+
}
|
|
11288
|
+
),
|
|
11289
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Alert, { sx: { flexGrow: 1 }, severity: "error", children: error })
|
|
11290
|
+
]
|
|
11291
|
+
}
|
|
11292
|
+
) }),
|
|
11293
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.Footer, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog_default.Actions, { children: [
|
|
11294
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Dialog_default.ActionCancelar, { onClick: () => onClose() }),
|
|
11295
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11296
|
+
Dialog_default.ActionSalvar,
|
|
11297
|
+
{
|
|
11298
|
+
label: "Entrar",
|
|
11299
|
+
onClick: handleOtpLogin,
|
|
11300
|
+
isLoading,
|
|
11301
|
+
disabled: code.length != 6
|
|
11302
|
+
}
|
|
11303
|
+
)
|
|
11304
|
+
] }) })
|
|
11305
|
+
] });
|
|
11306
|
+
}
|
|
11307
|
+
|
|
11308
|
+
// src/v2/Auth/components/OtpForm/index.tsx
|
|
11309
|
+
|
|
11310
|
+
var contatoSchema = create$3().shape({
|
|
11311
|
+
contato: create$6().when("$tipo", ([tipo], schema9) => {
|
|
11312
|
+
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");
|
|
11313
|
+
})
|
|
11314
|
+
});
|
|
11315
|
+
function OtpForm(props) {
|
|
11316
|
+
const { tipo, onLoginSuccess, onLoginClick } = props;
|
|
11317
|
+
const [isLoading, setLoading] = _react.useState.call(void 0, false);
|
|
11318
|
+
const [error, setError] = _react.useState.call(void 0, false);
|
|
11319
|
+
const { gerarOtpVerificationCode } = useCredentialsContext();
|
|
11320
|
+
const { handleChange, changeValue, data, validate, validationErrors } = _hooks.useForm.call(void 0, { contato: "" }, contatoSchema);
|
|
11321
|
+
const [isOpenVerificar, setOpenVerificar] = _react.useState.call(void 0, false);
|
|
11322
|
+
const handleSubmit = async (e) => {
|
|
11323
|
+
e.preventDefault();
|
|
11324
|
+
validate(
|
|
11325
|
+
async (validData) => {
|
|
11326
|
+
try {
|
|
11327
|
+
setError(false);
|
|
11328
|
+
setLoading(true);
|
|
11329
|
+
const usuario = await gerarOtpVerificationCode({
|
|
11330
|
+
channel: tipo === "otp-email" ? "email" : "whatsapp",
|
|
11331
|
+
target: validData.contato
|
|
11332
|
+
});
|
|
11333
|
+
setOpenVerificar(true);
|
|
11334
|
+
} catch (err) {
|
|
11335
|
+
setError(err.response.data.message);
|
|
11336
|
+
} finally {
|
|
11337
|
+
setLoading(false);
|
|
11338
|
+
}
|
|
11339
|
+
},
|
|
11340
|
+
{ context: { tipo } }
|
|
11341
|
+
);
|
|
11342
|
+
};
|
|
11343
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
11344
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "form", { onSubmit: handleSubmit, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { spacing: 2, children: [
|
|
11345
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "subtitle2", children: tipo === "otp-email" ? " Informe seu e-mail para receber um c\xF3digo de acesso" : "Informe seu n\xFAmero de WhatsApp para receber um c\xF3digo de acesso" }),
|
|
11346
|
+
tipo === "otp-email" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11347
|
+
_material.TextField,
|
|
11348
|
+
{
|
|
11349
|
+
autoFocus: true,
|
|
11350
|
+
name: "contato",
|
|
11351
|
+
label: "E-mail",
|
|
11352
|
+
value: data.contato || "",
|
|
11353
|
+
onChange: handleChange,
|
|
11354
|
+
fullWidth: true,
|
|
11355
|
+
...validationErrors("contato")
|
|
11356
|
+
}
|
|
11357
|
+
),
|
|
11358
|
+
tipo === "otp-whatsapp" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11359
|
+
WhatsAppTextField,
|
|
11360
|
+
{
|
|
11361
|
+
autoFocus: true,
|
|
11362
|
+
name: "contato",
|
|
11363
|
+
label: "Whatsapp",
|
|
11364
|
+
value: data.contato || "",
|
|
11365
|
+
onChange: (e) => {
|
|
11366
|
+
changeValue("contato", e.target.value.replace(/[^\d+]/g, ""));
|
|
11367
|
+
},
|
|
11368
|
+
fullWidth: true,
|
|
11369
|
+
...validationErrors("contato")
|
|
11370
|
+
}
|
|
11371
|
+
),
|
|
11372
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { children: [
|
|
11373
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11374
|
+
Button_default,
|
|
11375
|
+
{
|
|
11376
|
+
isLoading,
|
|
11377
|
+
type: "submit",
|
|
11378
|
+
variant: "contained",
|
|
11379
|
+
color: "primary",
|
|
11380
|
+
children: "Enviar c\xF3digo"
|
|
11381
|
+
}
|
|
11382
|
+
),
|
|
11383
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
11384
|
+
ButtonContainer,
|
|
11385
|
+
{
|
|
11386
|
+
sx: {
|
|
11387
|
+
display: "inline-flex",
|
|
11388
|
+
justifyContent: "space-between",
|
|
11389
|
+
width: "100%",
|
|
11390
|
+
marginTop: 1
|
|
11391
|
+
},
|
|
11392
|
+
children: [
|
|
11393
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11394
|
+
Button_default,
|
|
11395
|
+
{
|
|
11396
|
+
onClick: onLoginClick,
|
|
11397
|
+
variant: "text",
|
|
11398
|
+
sx: {
|
|
11399
|
+
fontWeight: "400",
|
|
11400
|
+
":hover": {
|
|
11401
|
+
color: (theme2) => theme2.palette.primary.dark
|
|
11402
|
+
}
|
|
11403
|
+
},
|
|
11404
|
+
children: "Voltar para o Login"
|
|
11405
|
+
}
|
|
11406
|
+
),
|
|
11407
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11408
|
+
"a",
|
|
11409
|
+
{
|
|
11410
|
+
href: "https://datacsistemashelp.zendesk.com/hc/pt-br/articles/36489079108756-Login-OTP-via-WhatsApp",
|
|
11411
|
+
target: "_blank",
|
|
11412
|
+
rel: "noopener noreferrer",
|
|
11413
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.IconButton, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _HelpOutline2.default, { color: "primary" }) })
|
|
11414
|
+
}
|
|
11415
|
+
)
|
|
11416
|
+
]
|
|
11417
|
+
}
|
|
11418
|
+
)
|
|
11419
|
+
] }),
|
|
11420
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Alert, { severity: "error", children: error })
|
|
11421
|
+
] }) }),
|
|
11422
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11423
|
+
DialogVerificarOtp,
|
|
11424
|
+
{
|
|
11425
|
+
onLoginSuccess,
|
|
11426
|
+
open: isOpenVerificar,
|
|
11427
|
+
onClose: async (_) => {
|
|
11428
|
+
setOpenVerificar(false);
|
|
11429
|
+
},
|
|
11430
|
+
payload: {
|
|
11431
|
+
target: data.contato,
|
|
11432
|
+
channel: tipo === "otp-email" ? "email" : "whatsapp"
|
|
11433
|
+
}
|
|
11434
|
+
}
|
|
11435
|
+
)
|
|
11436
|
+
] });
|
|
11437
|
+
}
|
|
11438
|
+
|
|
11439
|
+
// src/v2/Auth/components/LoginSection/index.tsx
|
|
11440
|
+
|
|
11441
|
+
var pageLabelMap = {
|
|
11442
|
+
login: "Acesse sua conta",
|
|
11443
|
+
licensa: "Selecione a licen\xE7a",
|
|
11444
|
+
"esqueci-senha": "Recupere a sua senha",
|
|
11445
|
+
"otp-email": "Entrar com senha tempor\xE1ria (E-mail)",
|
|
11446
|
+
"otp-whatsapp": "Entrar com senha tempor\xE1ria (WhatsApp)"
|
|
11447
|
+
};
|
|
11448
|
+
function LoginSection(props) {
|
|
11449
|
+
const { onLoginSuccess, onLoginFailed, onAlreadyLogged, appName } = props;
|
|
11450
|
+
const [loginData, setLoginData] = _react.useState.call(void 0, );
|
|
11451
|
+
const { selecionarLicenca, isAuthenticated } = useCredentialsContext();
|
|
11452
|
+
const [view, setView] = _react.useState.call(void 0, "login");
|
|
11453
|
+
const theme2 = _material.useTheme.call(void 0, );
|
|
11454
|
+
const fullScreen = _material.useMediaQuery.call(void 0, theme2.breakpoints.up("md"));
|
|
11455
|
+
_react.useEffect.call(void 0, () => {
|
|
11456
|
+
if (isAuthenticated && onAlreadyLogged) {
|
|
11457
|
+
onAlreadyLogged();
|
|
11458
|
+
}
|
|
11459
|
+
}, [isAuthenticated]);
|
|
11460
|
+
async function handleLoginSuccess(_loginData) {
|
|
11461
|
+
try {
|
|
11462
|
+
if (Array.isArray(_optionalChain([_loginData, 'optionalAccess', _136 => _136.empresas]))) {
|
|
11463
|
+
if (_optionalChain([_loginData, 'optionalAccess', _137 => _137.empresas, 'access', _138 => _138.length]) === 1) {
|
|
11464
|
+
const tokens = await selecionarLicenca(
|
|
11465
|
+
_optionalChain([_loginData, 'optionalAccess', _139 => _139.token]),
|
|
11466
|
+
_loginData.empresas[0].uuid
|
|
11467
|
+
);
|
|
11468
|
+
if (tokens) {
|
|
11469
|
+
onLoginSuccess(tokens);
|
|
11470
|
+
}
|
|
11471
|
+
return;
|
|
11472
|
+
}
|
|
11473
|
+
setView("licensa");
|
|
11474
|
+
setLoginData(_loginData);
|
|
11475
|
+
return;
|
|
11476
|
+
}
|
|
11477
|
+
onLoginSuccess(_loginData);
|
|
11478
|
+
} catch (err) {
|
|
11479
|
+
onLoginFailed(err);
|
|
11480
|
+
}
|
|
11481
|
+
}
|
|
11482
|
+
async function handleLoginFailed(err) {
|
|
11483
|
+
onLoginFailed(err);
|
|
11484
|
+
}
|
|
11485
|
+
function handleOptionsClick(option) {
|
|
11486
|
+
setView(option);
|
|
11487
|
+
}
|
|
11488
|
+
function handleExibirLogin() {
|
|
11489
|
+
setView("login");
|
|
11490
|
+
}
|
|
11491
|
+
const pageLabel = pageLabelMap[view];
|
|
11492
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { children: [
|
|
11493
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Header3, { label: appName, subTitle: pageLabel }),
|
|
11494
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { marginTop: 2 }, children: [
|
|
11495
|
+
view === "login" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11496
|
+
LoginForm,
|
|
11497
|
+
{
|
|
11498
|
+
onLoginSuccess: handleLoginSuccess,
|
|
11499
|
+
onLoginFailed: handleLoginFailed,
|
|
11500
|
+
onOptionsClick: handleOptionsClick
|
|
11501
|
+
}
|
|
11502
|
+
),
|
|
11503
|
+
view === "licensa" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11504
|
+
LicencaForm,
|
|
11505
|
+
{
|
|
11506
|
+
loginData,
|
|
11507
|
+
onLoginSuccess,
|
|
11508
|
+
onLoginFailed
|
|
11509
|
+
}
|
|
11510
|
+
),
|
|
11511
|
+
view === "esqueci-senha" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, EsqueciSenhaForm, { onLoginClick: handleExibirLogin }),
|
|
11512
|
+
view === "otp-email" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11513
|
+
OtpForm,
|
|
11514
|
+
{
|
|
11515
|
+
onLoginClick: handleExibirLogin,
|
|
11516
|
+
onLoginSuccess: handleLoginSuccess,
|
|
11517
|
+
tipo: "otp-email"
|
|
11518
|
+
}
|
|
11519
|
+
),
|
|
11520
|
+
view === "otp-whatsapp" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11521
|
+
OtpForm,
|
|
11522
|
+
{
|
|
11523
|
+
onLoginClick: handleExibirLogin,
|
|
11524
|
+
onLoginSuccess: handleLoginSuccess,
|
|
11525
|
+
tipo: "otp-whatsapp"
|
|
11526
|
+
}
|
|
11527
|
+
)
|
|
11528
|
+
] })
|
|
11529
|
+
] });
|
|
11530
|
+
}
|
|
11531
|
+
|
|
11532
|
+
// src/v2/Auth/index.tsx
|
|
11533
|
+
|
|
11534
|
+
function LoginContainer({ children }) {
|
|
11535
|
+
const theme2 = _material.useTheme.call(void 0, );
|
|
11536
|
+
const fullScreen = _material.useMediaQuery.call(void 0, theme2.breakpoints.up("md"));
|
|
11537
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
11538
|
+
_material.Stack,
|
|
11539
|
+
{
|
|
11540
|
+
component: "section",
|
|
11541
|
+
width: fullScreen ? "46%" : "100%",
|
|
11542
|
+
minWidth: "420px",
|
|
11543
|
+
maxWidth: fullScreen ? "614px" : "initial",
|
|
11544
|
+
justifyContent: "center",
|
|
11545
|
+
alignItems: "center",
|
|
11546
|
+
padding: "2rem",
|
|
11547
|
+
children: [
|
|
11548
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Stack, { width: "100%", maxWidth: "28rem", margin: "auto 0", children }),
|
|
11549
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { direction: "row", alignItems: "center", marginBottom: -3, children: [
|
|
11550
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11551
|
+
"img",
|
|
11552
|
+
{
|
|
11553
|
+
width: "60",
|
|
11554
|
+
src: "https://datac-site-assets.s3.sa-east-1.amazonaws.com/logomarca.png"
|
|
11555
|
+
}
|
|
11556
|
+
),
|
|
11557
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11558
|
+
_material.Typography,
|
|
11559
|
+
{
|
|
11560
|
+
variant: "body1",
|
|
11561
|
+
component: "span",
|
|
11562
|
+
fontSize: "0.7rem",
|
|
11563
|
+
sx: { color: (theme3) => theme3.palette.grey[500] },
|
|
11564
|
+
children: "Data C Sistemas"
|
|
11565
|
+
}
|
|
11566
|
+
)
|
|
11567
|
+
] })
|
|
11568
|
+
]
|
|
11569
|
+
}
|
|
11570
|
+
);
|
|
11571
|
+
}
|
|
11572
|
+
function Auth(props) {
|
|
11573
|
+
const { banner, loginSection, ...loginSectionProps } = props;
|
|
11574
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { component: "main", direction: "row", height: "100vh", children: [
|
|
11575
|
+
banner ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BannerSection2, { children: banner }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DefaultBanner, {}),
|
|
11576
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoginContainer, { children: loginSection ? loginSection : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoginSection, { ...loginSectionProps }) })
|
|
11577
|
+
] });
|
|
11578
|
+
}
|
|
11579
|
+
|
|
10284
11580
|
// src/PasswordTextField/index.tsx
|
|
10285
11581
|
|
|
10286
11582
|
function PasswordTextField(props) {
|
|
@@ -10320,7 +11616,7 @@ function PasswordTextField(props) {
|
|
|
10320
11616
|
|
|
10321
11617
|
|
|
10322
11618
|
|
|
10323
|
-
function
|
|
11619
|
+
function ValidatorMessage2(props) {
|
|
10324
11620
|
const { isValid, message } = props;
|
|
10325
11621
|
const theme2 = _material.useTheme.call(void 0, );
|
|
10326
11622
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -10359,12 +11655,12 @@ function ValidatorMessage(props) {
|
|
|
10359
11655
|
|
|
10360
11656
|
// src/AlterarSenha/index.tsx
|
|
10361
11657
|
|
|
10362
|
-
var
|
|
11658
|
+
var defaultData2 = {
|
|
10363
11659
|
senhaAtual: "",
|
|
10364
11660
|
senhaNova: "",
|
|
10365
11661
|
senhaNovaConfirmar: ""
|
|
10366
11662
|
};
|
|
10367
|
-
var
|
|
11663
|
+
var schema4 = create$3().shape({
|
|
10368
11664
|
senhaAtual: create$6().required("Informe a Senha Atual."),
|
|
10369
11665
|
senhaNova: create$6().required("Informe a Nova Senha."),
|
|
10370
11666
|
senhaNovaConfirmar: create$6().required("Informe a Nova Senha.").oneOf([create$9("senhaNova")], "As senhas devem ser iguais.")
|
|
@@ -10382,7 +11678,7 @@ function AlterarSenha(props) {
|
|
|
10382
11678
|
} = props;
|
|
10383
11679
|
const { alterarSenha, isSubmitting } = _hooks.useCredentials.call(void 0, credentialsConfig);
|
|
10384
11680
|
const { setValidationErrors, validationProps } = _hooks.useValidations.call(void 0, );
|
|
10385
|
-
const { data, handleChange, setData, changeValue } = _hooks.useForm.call(void 0,
|
|
11681
|
+
const { data, handleChange, setData, changeValue } = _hooks.useForm.call(void 0, defaultData2);
|
|
10386
11682
|
const [ehSegura, setEhSegura] = _react.useState.call(void 0, false);
|
|
10387
11683
|
const [error, setError] = _react.useState.call(void 0, null);
|
|
10388
11684
|
_react.useEffect.call(void 0, () => {
|
|
@@ -10406,20 +11702,20 @@ function AlterarSenha(props) {
|
|
|
10406
11702
|
async function handleAlterarSenha() {
|
|
10407
11703
|
setValidationErrors(null);
|
|
10408
11704
|
setError(null);
|
|
10409
|
-
|
|
11705
|
+
schema4.validate(data, { abortEarly: false }).then(async () => {
|
|
10410
11706
|
const { senhaAtual: senhaAtual2, senhaNova } = data;
|
|
10411
11707
|
try {
|
|
10412
11708
|
const response = await alterarSenha(senhaAtual2, senhaNova, email);
|
|
10413
11709
|
if (response) {
|
|
10414
11710
|
if (onSuccess)
|
|
10415
11711
|
onSuccess();
|
|
10416
|
-
setData(
|
|
11712
|
+
setData(defaultData2);
|
|
10417
11713
|
}
|
|
10418
11714
|
} catch (error2) {
|
|
10419
11715
|
if (onFailed)
|
|
10420
11716
|
onFailed(error2);
|
|
10421
11717
|
if (_axios.isAxiosError.call(void 0, error2)) {
|
|
10422
|
-
setError(_optionalChain([error2, 'access',
|
|
11718
|
+
setError(_optionalChain([error2, 'access', _140 => _140.response, 'optionalAccess', _141 => _141.data, 'access', _142 => _142.message]));
|
|
10423
11719
|
return;
|
|
10424
11720
|
}
|
|
10425
11721
|
setError("Ocorreu um erro ao tentar alterar a senha");
|
|
@@ -10431,40 +11727,40 @@ function AlterarSenha(props) {
|
|
|
10431
11727
|
});
|
|
10432
11728
|
}
|
|
10433
11729
|
function tem8caracteres() {
|
|
10434
|
-
return _optionalChain([data, 'optionalAccess',
|
|
11730
|
+
return _optionalChain([data, 'optionalAccess', _143 => _143.senhaNova, 'access', _144 => _144.length]) >= 8;
|
|
10435
11731
|
}
|
|
10436
11732
|
function temLetraMinuscula() {
|
|
10437
|
-
if (_optionalChain([data, 'optionalAccess',
|
|
10438
|
-
const result = _optionalChain([data, 'optionalAccess',
|
|
11733
|
+
if (_optionalChain([data, 'optionalAccess', _145 => _145.senhaNova])) {
|
|
11734
|
+
const result = _optionalChain([data, 'optionalAccess', _146 => _146.senhaNova, 'access', _147 => _147.match, 'call', _148 => _148(/[a-z]/g)]);
|
|
10439
11735
|
return Array.isArray(result) && result.length > 0;
|
|
10440
11736
|
}
|
|
10441
11737
|
return false;
|
|
10442
11738
|
}
|
|
10443
11739
|
function temLetraMaisucula() {
|
|
10444
|
-
if (_optionalChain([data, 'optionalAccess',
|
|
10445
|
-
const result = _optionalChain([data, 'optionalAccess',
|
|
11740
|
+
if (_optionalChain([data, 'optionalAccess', _149 => _149.senhaNova])) {
|
|
11741
|
+
const result = _optionalChain([data, 'optionalAccess', _150 => _150.senhaNova, 'access', _151 => _151.match, 'call', _152 => _152(/[A-Z]/g)]);
|
|
10446
11742
|
return Array.isArray(result) && result.length > 0;
|
|
10447
11743
|
}
|
|
10448
11744
|
return false;
|
|
10449
11745
|
}
|
|
10450
11746
|
function temNumero() {
|
|
10451
|
-
if (_optionalChain([data, 'optionalAccess',
|
|
10452
|
-
const result = _optionalChain([data, 'optionalAccess',
|
|
11747
|
+
if (_optionalChain([data, 'optionalAccess', _153 => _153.senhaNova])) {
|
|
11748
|
+
const result = _optionalChain([data, 'optionalAccess', _154 => _154.senhaNova, 'access', _155 => _155.match, 'call', _156 => _156(/\d/g)]);
|
|
10453
11749
|
return Array.isArray(result) && result.length > 0;
|
|
10454
11750
|
}
|
|
10455
11751
|
return false;
|
|
10456
11752
|
}
|
|
10457
11753
|
function temCaracterEspecial() {
|
|
10458
|
-
if (_optionalChain([data, 'optionalAccess',
|
|
10459
|
-
const result = _optionalChain([data, 'optionalAccess',
|
|
11754
|
+
if (_optionalChain([data, 'optionalAccess', _157 => _157.senhaNova])) {
|
|
11755
|
+
const result = _optionalChain([data, 'optionalAccess', _158 => _158.senhaNova, 'access', _159 => _159.match, 'call', _160 => _160(/\W/g)]);
|
|
10460
11756
|
return Array.isArray(result) && result.length > 0;
|
|
10461
11757
|
}
|
|
10462
11758
|
return false;
|
|
10463
11759
|
}
|
|
10464
11760
|
function asSenhasSaoIguais() {
|
|
10465
|
-
if (_optionalChain([data, 'optionalAccess',
|
|
11761
|
+
if (_optionalChain([data, 'optionalAccess', _161 => _161.senhaNova]) === "")
|
|
10466
11762
|
return false;
|
|
10467
|
-
return _optionalChain([data, 'optionalAccess',
|
|
11763
|
+
return _optionalChain([data, 'optionalAccess', _162 => _162.senhaNova]) === _optionalChain([data, 'optionalAccess', _163 => _163.senhaNovaConfirmar]);
|
|
10468
11764
|
}
|
|
10469
11765
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog_default.Root, { open: isOpen, onClose: (_) => onClose(), maxWidth: "md", children: [
|
|
10470
11766
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, Dialog_default.Header, { children: [
|
|
@@ -10483,7 +11779,7 @@ function AlterarSenha(props) {
|
|
|
10483
11779
|
{
|
|
10484
11780
|
name: "senhaAtual",
|
|
10485
11781
|
label: "Senha Atual",
|
|
10486
|
-
value: _optionalChain([data, 'optionalAccess',
|
|
11782
|
+
value: _optionalChain([data, 'optionalAccess', _164 => _164.senhaAtual]) || "",
|
|
10487
11783
|
onChange: handleChange,
|
|
10488
11784
|
...validationProps("senhaAtual")
|
|
10489
11785
|
}
|
|
@@ -10505,7 +11801,7 @@ function AlterarSenha(props) {
|
|
|
10505
11801
|
{
|
|
10506
11802
|
name: "senhaNova",
|
|
10507
11803
|
label: "Nova Senha",
|
|
10508
|
-
value: _optionalChain([data, 'optionalAccess',
|
|
11804
|
+
value: _optionalChain([data, 'optionalAccess', _165 => _165.senhaNova]) || "",
|
|
10509
11805
|
onChange: handleChange,
|
|
10510
11806
|
...validationProps("senhaNova")
|
|
10511
11807
|
}
|
|
@@ -10516,7 +11812,7 @@ function AlterarSenha(props) {
|
|
|
10516
11812
|
{
|
|
10517
11813
|
name: "senhaNovaConfirmar",
|
|
10518
11814
|
label: "Confirmar Nova Senha",
|
|
10519
|
-
value: _optionalChain([data, 'optionalAccess',
|
|
11815
|
+
value: _optionalChain([data, 'optionalAccess', _166 => _166.senhaNovaConfirmar]) || "",
|
|
10520
11816
|
onChange: handleChange,
|
|
10521
11817
|
...validationProps("senhaNovaConfirmar")
|
|
10522
11818
|
}
|
|
@@ -10534,42 +11830,42 @@ function AlterarSenha(props) {
|
|
|
10534
11830
|
] }),
|
|
10535
11831
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Grid, { size: 12, children: [
|
|
10536
11832
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10537
|
-
|
|
11833
|
+
ValidatorMessage2,
|
|
10538
11834
|
{
|
|
10539
11835
|
isValid: tem8caracteres(),
|
|
10540
11836
|
message: "O tamanho m\xEDnimo da nova senha \xE9 de 8 caracteres"
|
|
10541
11837
|
}
|
|
10542
11838
|
),
|
|
10543
11839
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10544
|
-
|
|
11840
|
+
ValidatorMessage2,
|
|
10545
11841
|
{
|
|
10546
11842
|
isValid: temLetraMinuscula(),
|
|
10547
11843
|
message: "A nova senha deve ter ao menos uma letra min\xFAscula"
|
|
10548
11844
|
}
|
|
10549
11845
|
),
|
|
10550
11846
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10551
|
-
|
|
11847
|
+
ValidatorMessage2,
|
|
10552
11848
|
{
|
|
10553
11849
|
isValid: temLetraMaisucula(),
|
|
10554
11850
|
message: "A nova senha deve ter ao menos uma letra mai\xFAscula"
|
|
10555
11851
|
}
|
|
10556
11852
|
),
|
|
10557
11853
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10558
|
-
|
|
11854
|
+
ValidatorMessage2,
|
|
10559
11855
|
{
|
|
10560
11856
|
isValid: temNumero(),
|
|
10561
11857
|
message: "A nova senha deve ter ao menos um n\xFAmero"
|
|
10562
11858
|
}
|
|
10563
11859
|
),
|
|
10564
11860
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10565
|
-
|
|
11861
|
+
ValidatorMessage2,
|
|
10566
11862
|
{
|
|
10567
11863
|
isValid: temCaracterEspecial(),
|
|
10568
11864
|
message: "A nova senha deve ter ao menos um caracter especial"
|
|
10569
11865
|
}
|
|
10570
11866
|
),
|
|
10571
11867
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10572
|
-
|
|
11868
|
+
ValidatorMessage2,
|
|
10573
11869
|
{
|
|
10574
11870
|
isValid: asSenhasSaoIguais(),
|
|
10575
11871
|
message: "A confirma\xE7\xE3o da nova senha deve ser igual \xE0 nova senha"
|
|
@@ -10595,11 +11891,11 @@ function AlterarSenha(props) {
|
|
|
10595
11891
|
|
|
10596
11892
|
// src/MioAuth/components/LoginForm/index.tsx
|
|
10597
11893
|
|
|
10598
|
-
var
|
|
11894
|
+
var schema5 = create$3().shape({
|
|
10599
11895
|
email: create$6().required("Informe o e-mail"),
|
|
10600
11896
|
password: create$6().required("Informe a senha")
|
|
10601
11897
|
});
|
|
10602
|
-
function
|
|
11898
|
+
function LoginForm2(props) {
|
|
10603
11899
|
const { onLoginSuccess, onLoginFailed, onOptionsClick, credentialsConfig } = props;
|
|
10604
11900
|
const [email, setEmail] = _react.useState.call(void 0, "");
|
|
10605
11901
|
const [password, setPassword] = _react.useState.call(void 0, "");
|
|
@@ -10612,7 +11908,7 @@ function LoginForm(props) {
|
|
|
10612
11908
|
async function handleLogin() {
|
|
10613
11909
|
setValidationErrors(null);
|
|
10614
11910
|
setError(null);
|
|
10615
|
-
|
|
11911
|
+
schema5.validate({ email, password }, { abortEarly: false }).then(async () => {
|
|
10616
11912
|
setLoading(true);
|
|
10617
11913
|
try {
|
|
10618
11914
|
const loginResponse = await login(email, password);
|
|
@@ -10622,11 +11918,11 @@ function LoginForm(props) {
|
|
|
10622
11918
|
} catch (err) {
|
|
10623
11919
|
if (_axios.isAxiosError.call(void 0, err)) {
|
|
10624
11920
|
const axiosError = err;
|
|
10625
|
-
if (_optionalChain([axiosError, 'access',
|
|
11921
|
+
if (_optionalChain([axiosError, 'access', _167 => _167.response, 'optionalAccess', _168 => _168.data, 'access', _169 => _169.code]) === "E_FIRST_ACCESS") {
|
|
10626
11922
|
setExibirAlterarSenha(true);
|
|
10627
11923
|
return;
|
|
10628
11924
|
}
|
|
10629
|
-
setError(_optionalChain([err, 'access',
|
|
11925
|
+
setError(_optionalChain([err, 'access', _170 => _170.response, 'optionalAccess', _171 => _171.data, 'access', _172 => _172.message]));
|
|
10630
11926
|
}
|
|
10631
11927
|
onLoginFailed(err);
|
|
10632
11928
|
}
|
|
@@ -10767,10 +12063,10 @@ function LoginForm(props) {
|
|
|
10767
12063
|
|
|
10768
12064
|
|
|
10769
12065
|
|
|
10770
|
-
var
|
|
12066
|
+
var schema6 = create$3().shape({
|
|
10771
12067
|
email: create$6().required("Informe o e-mail")
|
|
10772
12068
|
});
|
|
10773
|
-
function
|
|
12069
|
+
function EsqueciSenhaForm2(props) {
|
|
10774
12070
|
const { onLoginClick, credentialsConfig } = props;
|
|
10775
12071
|
const [email, setEmail] = _react.useState.call(void 0, "");
|
|
10776
12072
|
const [isSubmitting, setSubmitting] = _react.useState.call(void 0, false);
|
|
@@ -10780,13 +12076,13 @@ function EsqueciSenhaForm(props) {
|
|
|
10780
12076
|
const { validationProps, setValidationErrors } = _hooks.useValidations.call(void 0, );
|
|
10781
12077
|
async function handleRecuperarSenha() {
|
|
10782
12078
|
setValidationErrors(null);
|
|
10783
|
-
|
|
12079
|
+
schema6.validate({ email }, { abortEarly: false }).then(async () => {
|
|
10784
12080
|
try {
|
|
10785
12081
|
setSubmitting(true);
|
|
10786
12082
|
await recuperarSenha(email);
|
|
10787
12083
|
setSucessoRecuperarSenha(true);
|
|
10788
12084
|
} catch (error2) {
|
|
10789
|
-
setError(_optionalChain([error2, 'access',
|
|
12085
|
+
setError(_optionalChain([error2, 'access', _173 => _173.response, 'optionalAccess', _174 => _174.data, 'access', _175 => _175.message]));
|
|
10790
12086
|
} finally {
|
|
10791
12087
|
setSubmitting(false);
|
|
10792
12088
|
}
|
|
@@ -10873,19 +12169,19 @@ function EsqueciSenhaForm(props) {
|
|
|
10873
12169
|
|
|
10874
12170
|
|
|
10875
12171
|
|
|
10876
|
-
function
|
|
12172
|
+
function LicencaForm2(props) {
|
|
10877
12173
|
const { loginData, credentialsConfig, onLoginFailed, onLoginSuccess } = props;
|
|
10878
12174
|
const [empresaId, setEmpresaId] = _react.useState.call(void 0, "");
|
|
10879
12175
|
const { selecionarLicenca, isSubmitting } = _hooks.useCredentials.call(void 0, credentialsConfig);
|
|
10880
12176
|
_react.useEffect.call(void 0, () => {
|
|
10881
|
-
if (Array.isArray(_optionalChain([loginData, 'optionalAccess',
|
|
10882
|
-
const empresa = _optionalChain([loginData, 'optionalAccess',
|
|
10883
|
-
setEmpresaId(_optionalChain([empresa, 'optionalAccess',
|
|
12177
|
+
if (Array.isArray(_optionalChain([loginData, 'optionalAccess', _176 => _176.empresas]))) {
|
|
12178
|
+
const empresa = _optionalChain([loginData, 'optionalAccess', _177 => _177.empresas, 'access', _178 => _178[0]]);
|
|
12179
|
+
setEmpresaId(_optionalChain([empresa, 'optionalAccess', _179 => _179.uuid]));
|
|
10884
12180
|
}
|
|
10885
12181
|
}, [loginData]);
|
|
10886
12182
|
async function handleSelecionarLicenca() {
|
|
10887
12183
|
try {
|
|
10888
|
-
const tokens = await selecionarLicenca(_optionalChain([loginData, 'optionalAccess',
|
|
12184
|
+
const tokens = await selecionarLicenca(_optionalChain([loginData, 'optionalAccess', _180 => _180.token]), empresaId);
|
|
10889
12185
|
if (tokens) {
|
|
10890
12186
|
onLoginSuccess(tokens);
|
|
10891
12187
|
} else {
|
|
@@ -10907,7 +12203,7 @@ function LicencaForm(props) {
|
|
|
10907
12203
|
onChange: (e) => {
|
|
10908
12204
|
setEmpresaId(e.target.value);
|
|
10909
12205
|
},
|
|
10910
|
-
children: _optionalChain([loginData, 'optionalAccess',
|
|
12206
|
+
children: _optionalChain([loginData, 'optionalAccess', _181 => _181.empresas, 'optionalAccess', _182 => _182.map, 'call', _183 => _183((empresa) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.MenuItem, { value: empresa.uuid, children: empresa.nome }, empresa.uuid))])
|
|
10911
12207
|
}
|
|
10912
12208
|
),
|
|
10913
12209
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -10935,60 +12231,9 @@ function LicencaForm(props) {
|
|
|
10935
12231
|
|
|
10936
12232
|
|
|
10937
12233
|
|
|
10938
|
-
var _HelpOutline = require('@mui/icons-material/HelpOutline'); var _HelpOutline2 = _interopRequireDefault(_HelpOutline);
|
|
10939
|
-
|
|
10940
12234
|
|
|
10941
12235
|
|
|
10942
|
-
// src/WhastappTextField/index.tsx
|
|
10943
|
-
|
|
10944
|
-
var _TextField = require('@mui/material/TextField'); var _TextField2 = _interopRequireDefault(_TextField);
|
|
10945
12236
|
|
|
10946
|
-
var formatPhone = (value) => {
|
|
10947
|
-
const digits = value.replace(/\D/g, "");
|
|
10948
|
-
if (digits.length <= 2) {
|
|
10949
|
-
return `(${digits}`;
|
|
10950
|
-
}
|
|
10951
|
-
if (digits.length <= 7) {
|
|
10952
|
-
return `(${digits.slice(0, 2)}) ${digits.slice(2)}`;
|
|
10953
|
-
}
|
|
10954
|
-
if (digits.length <= 11) {
|
|
10955
|
-
return `(${digits.slice(0, 2)}) ${digits.slice(2, 7)}-${digits.slice(7)}`;
|
|
10956
|
-
}
|
|
10957
|
-
return `(${digits.slice(0, 2)}) ${digits.slice(2, 7)}-${digits.slice(7, 11)}`;
|
|
10958
|
-
};
|
|
10959
|
-
function WhatsAppTextField(props) {
|
|
10960
|
-
const { value: propValue, onChange: propOnChange, ...rest } = props;
|
|
10961
|
-
const [internalValue, setInternalValue] = _react.useState.call(void 0, "");
|
|
10962
|
-
const isControlled = propValue !== void 0;
|
|
10963
|
-
const displayedValue = _react.useMemo.call(void 0, () => {
|
|
10964
|
-
return isControlled ? formatPhone(propValue || "") : internalValue;
|
|
10965
|
-
}, [propValue, internalValue, isControlled]);
|
|
10966
|
-
const handleChange = (event) => {
|
|
10967
|
-
const masked = formatPhone(event.target.value);
|
|
10968
|
-
if (!isControlled) {
|
|
10969
|
-
setInternalValue(masked);
|
|
10970
|
-
}
|
|
10971
|
-
if (propOnChange) {
|
|
10972
|
-
const customEvent = {
|
|
10973
|
-
...event,
|
|
10974
|
-
target: {
|
|
10975
|
-
...event.target,
|
|
10976
|
-
value: masked
|
|
10977
|
-
}
|
|
10978
|
-
};
|
|
10979
|
-
propOnChange(customEvent);
|
|
10980
|
-
}
|
|
10981
|
-
};
|
|
10982
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
10983
|
-
_TextField2.default,
|
|
10984
|
-
{
|
|
10985
|
-
value: displayedValue,
|
|
10986
|
-
onChange: handleChange,
|
|
10987
|
-
inputProps: { maxLength: 15 },
|
|
10988
|
-
...rest
|
|
10989
|
-
}
|
|
10990
|
-
);
|
|
10991
|
-
}
|
|
10992
12237
|
|
|
10993
12238
|
// src/MioAuth/components/OtpForm/DialogVerificarOtp.tsx
|
|
10994
12239
|
|
|
@@ -10997,59 +12242,7 @@ function WhatsAppTextField(props) {
|
|
|
10997
12242
|
|
|
10998
12243
|
|
|
10999
12244
|
|
|
11000
|
-
|
|
11001
|
-
|
|
11002
|
-
|
|
11003
|
-
|
|
11004
|
-
function VerificationCodeInput({
|
|
11005
|
-
length = 6,
|
|
11006
|
-
value,
|
|
11007
|
-
onChange
|
|
11008
|
-
}) {
|
|
11009
|
-
const inputsRef = _react.useRef.call(void 0, []);
|
|
11010
|
-
const handleChange = (index, digit) => {
|
|
11011
|
-
const chars = "ABCDEF0123456789";
|
|
11012
|
-
const cleanDigit = digit.toUpperCase().split("").find((char) => chars.includes(char)) || "";
|
|
11013
|
-
const nextValue = value.split("");
|
|
11014
|
-
nextValue[index] = cleanDigit;
|
|
11015
|
-
const updatedValue = nextValue.join("");
|
|
11016
|
-
onChange(updatedValue);
|
|
11017
|
-
if (cleanDigit && index < length - 1) {
|
|
11018
|
-
_optionalChain([inputsRef, 'access', _128 => _128.current, 'access', _129 => _129[index + 1], 'optionalAccess', _130 => _130.focus, 'call', _131 => _131()]);
|
|
11019
|
-
}
|
|
11020
|
-
};
|
|
11021
|
-
const handleKeyDown = (index, event) => {
|
|
11022
|
-
if (event.key === "Backspace" && !value[index] && index > 0) {
|
|
11023
|
-
_optionalChain([inputsRef, 'access', _132 => _132.current, 'access', _133 => _133[index - 1], 'optionalAccess', _134 => _134.focus, 'call', _135 => _135()]);
|
|
11024
|
-
}
|
|
11025
|
-
};
|
|
11026
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Box, { display: "flex", gap: 1, children: Array.from({ length }).map((_, i) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11027
|
-
_material.TextField,
|
|
11028
|
-
{
|
|
11029
|
-
autoFocus: i === 0,
|
|
11030
|
-
inputRef: (el) => inputsRef.current[i] = el,
|
|
11031
|
-
slotProps: {
|
|
11032
|
-
htmlInput: {
|
|
11033
|
-
maxLength: 1,
|
|
11034
|
-
style: {
|
|
11035
|
-
textAlign: "center",
|
|
11036
|
-
fontSize: "24px",
|
|
11037
|
-
width: "24px",
|
|
11038
|
-
height: "36px"
|
|
11039
|
-
}
|
|
11040
|
-
}
|
|
11041
|
-
},
|
|
11042
|
-
value: value[i] || "",
|
|
11043
|
-
onChange: (e) => handleChange(i, e.target.value),
|
|
11044
|
-
onKeyDown: (e) => handleKeyDown(i, e)
|
|
11045
|
-
},
|
|
11046
|
-
i
|
|
11047
|
-
)) });
|
|
11048
|
-
}
|
|
11049
|
-
|
|
11050
|
-
// src/MioAuth/components/OtpForm/DialogVerificarOtp.tsx
|
|
11051
|
-
|
|
11052
|
-
function DialogVerificarOtp(props) {
|
|
12245
|
+
function DialogVerificarOtp2(props) {
|
|
11053
12246
|
const { open, onClose, payload, onLoginSuccess, credentialsConfig } = props;
|
|
11054
12247
|
const [code, setCode] = _react.useState.call(void 0, "");
|
|
11055
12248
|
const [error, setError] = _react.useState.call(void 0, false);
|
|
@@ -11138,17 +12331,17 @@ function DialogVerificarOtp(props) {
|
|
|
11138
12331
|
|
|
11139
12332
|
// src/MioAuth/components/OtpForm/index.tsx
|
|
11140
12333
|
|
|
11141
|
-
var
|
|
11142
|
-
contato: create$6().when("$tipo", ([tipo],
|
|
11143
|
-
return tipo === "otp-email" ?
|
|
12334
|
+
var contatoSchema2 = create$3().shape({
|
|
12335
|
+
contato: create$6().when("$tipo", ([tipo], schema9) => {
|
|
12336
|
+
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
12337
|
})
|
|
11145
12338
|
});
|
|
11146
|
-
function
|
|
12339
|
+
function OtpForm2(props) {
|
|
11147
12340
|
const { tipo, credentialsConfig, onLoginSuccess, onLoginClick } = props;
|
|
11148
12341
|
const [isLoading, setLoading] = _react.useState.call(void 0, false);
|
|
11149
12342
|
const [error, setError] = _react.useState.call(void 0, false);
|
|
11150
12343
|
const { gerarOtpVerificationCode } = _hooks.useCredentials.call(void 0, credentialsConfig);
|
|
11151
|
-
const { handleChange, changeValue, data, validate, validationErrors } = _hooks.useForm.call(void 0, { contato: "" },
|
|
12344
|
+
const { handleChange, changeValue, data, validate, validationErrors } = _hooks.useForm.call(void 0, { contato: "" }, contatoSchema2);
|
|
11152
12345
|
const [isOpenVerificar, setOpenVerificar] = _react.useState.call(void 0, false);
|
|
11153
12346
|
const handleSubmit = async (e) => {
|
|
11154
12347
|
e.preventDefault();
|
|
@@ -11251,7 +12444,7 @@ function OtpForm(props) {
|
|
|
11251
12444
|
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Alert, { severity: "error", children: error })
|
|
11252
12445
|
] }) }),
|
|
11253
12446
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11254
|
-
|
|
12447
|
+
DialogVerificarOtp2,
|
|
11255
12448
|
{
|
|
11256
12449
|
onLoginSuccess,
|
|
11257
12450
|
open: isOpenVerificar,
|
|
@@ -11270,14 +12463,14 @@ function OtpForm(props) {
|
|
|
11270
12463
|
|
|
11271
12464
|
// src/MioAuth/components/LoginSection/index.tsx
|
|
11272
12465
|
|
|
11273
|
-
var
|
|
12466
|
+
var pageLabelMap2 = {
|
|
11274
12467
|
login: "Acesse sua conta",
|
|
11275
12468
|
licensa: "Selecione a licen\xE7a",
|
|
11276
12469
|
"esqueci-senha": "Recupere a sua senha",
|
|
11277
12470
|
"otp-email": "Entrar com senha tempor\xE1ria (E-mail)",
|
|
11278
12471
|
"otp-whatsapp": "Entrar com senha tempor\xE1ria (WhatsApp)"
|
|
11279
12472
|
};
|
|
11280
|
-
function
|
|
12473
|
+
function LoginSection2(props) {
|
|
11281
12474
|
const {
|
|
11282
12475
|
credentialsConfig,
|
|
11283
12476
|
onLoginSuccess,
|
|
@@ -11297,10 +12490,10 @@ function LoginSection(props) {
|
|
|
11297
12490
|
}, [isAuthenticated]);
|
|
11298
12491
|
async function handleLoginSuccess(_loginData) {
|
|
11299
12492
|
try {
|
|
11300
|
-
if (Array.isArray(_optionalChain([_loginData, 'optionalAccess',
|
|
11301
|
-
if (_optionalChain([_loginData, 'optionalAccess',
|
|
12493
|
+
if (Array.isArray(_optionalChain([_loginData, 'optionalAccess', _184 => _184.empresas]))) {
|
|
12494
|
+
if (_optionalChain([_loginData, 'optionalAccess', _185 => _185.empresas, 'access', _186 => _186.length]) === 1) {
|
|
11302
12495
|
const tokens = await selecionarLicenca(
|
|
11303
|
-
_optionalChain([_loginData, 'optionalAccess',
|
|
12496
|
+
_optionalChain([_loginData, 'optionalAccess', _187 => _187.token]),
|
|
11304
12497
|
_loginData.empresas[0].uuid
|
|
11305
12498
|
);
|
|
11306
12499
|
if (tokens) {
|
|
@@ -11326,12 +12519,12 @@ function LoginSection(props) {
|
|
|
11326
12519
|
function handleExibirLogin() {
|
|
11327
12520
|
setView("login");
|
|
11328
12521
|
}
|
|
11329
|
-
const pageLabel =
|
|
12522
|
+
const pageLabel = pageLabelMap2[view];
|
|
11330
12523
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { children: [
|
|
11331
12524
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Header, { label: appName, subTitle: pageLabel }),
|
|
11332
12525
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { marginTop: 2 }, children: [
|
|
11333
12526
|
view === "login" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11334
|
-
|
|
12527
|
+
LoginForm2,
|
|
11335
12528
|
{
|
|
11336
12529
|
credentialsConfig,
|
|
11337
12530
|
onLoginSuccess: handleLoginSuccess,
|
|
@@ -11340,7 +12533,7 @@ function LoginSection(props) {
|
|
|
11340
12533
|
}
|
|
11341
12534
|
),
|
|
11342
12535
|
view === "licensa" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11343
|
-
|
|
12536
|
+
LicencaForm2,
|
|
11344
12537
|
{
|
|
11345
12538
|
loginData,
|
|
11346
12539
|
credentialsConfig,
|
|
@@ -11349,14 +12542,14 @@ function LoginSection(props) {
|
|
|
11349
12542
|
}
|
|
11350
12543
|
),
|
|
11351
12544
|
view === "esqueci-senha" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11352
|
-
|
|
12545
|
+
EsqueciSenhaForm2,
|
|
11353
12546
|
{
|
|
11354
12547
|
onLoginClick: handleExibirLogin,
|
|
11355
12548
|
credentialsConfig
|
|
11356
12549
|
}
|
|
11357
12550
|
),
|
|
11358
12551
|
view === "otp-email" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11359
|
-
|
|
12552
|
+
OtpForm2,
|
|
11360
12553
|
{
|
|
11361
12554
|
onLoginClick: handleExibirLogin,
|
|
11362
12555
|
onLoginSuccess: handleLoginSuccess,
|
|
@@ -11365,7 +12558,7 @@ function LoginSection(props) {
|
|
|
11365
12558
|
}
|
|
11366
12559
|
),
|
|
11367
12560
|
view === "otp-whatsapp" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11368
|
-
|
|
12561
|
+
OtpForm2,
|
|
11369
12562
|
{
|
|
11370
12563
|
onLoginClick: handleExibirLogin,
|
|
11371
12564
|
onLoginSuccess: handleLoginSuccess,
|
|
@@ -11378,10 +12571,10 @@ function LoginSection(props) {
|
|
|
11378
12571
|
}
|
|
11379
12572
|
|
|
11380
12573
|
// src/MioAuth/components/DefaultBanner/index.tsx
|
|
11381
|
-
var _ArrowRight = require('@mui/icons-material/ArrowRight'); var _ArrowRight2 = _interopRequireDefault(_ArrowRight);
|
|
11382
12574
|
|
|
11383
12575
|
|
|
11384
|
-
|
|
12576
|
+
|
|
12577
|
+
function DefaultBanner2() {
|
|
11385
12578
|
const theme2 = _material.useTheme.call(void 0, );
|
|
11386
12579
|
const fullScreen = _material.useMediaQuery.call(void 0, theme2.breakpoints.up("md"));
|
|
11387
12580
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -11481,7 +12674,7 @@ function DefaultBanner() {
|
|
|
11481
12674
|
|
|
11482
12675
|
// src/MioAuth/index.tsx
|
|
11483
12676
|
|
|
11484
|
-
function
|
|
12677
|
+
function LoginContainer2({ children }) {
|
|
11485
12678
|
const theme2 = _material.useTheme.call(void 0, );
|
|
11486
12679
|
const fullScreen = _material.useMediaQuery.call(void 0, theme2.breakpoints.up("md"));
|
|
11487
12680
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
@@ -11522,8 +12715,8 @@ function LoginContainer({ children }) {
|
|
|
11522
12715
|
function MioAuth(props) {
|
|
11523
12716
|
const { banner, loginSection } = props;
|
|
11524
12717
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Stack, { component: "main", direction: "row", height: "100vh", children: [
|
|
11525
|
-
banner ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BannerSection, { children: banner }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11526
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
12718
|
+
banner ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, BannerSection, { children: banner }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, DefaultBanner2, {}),
|
|
12719
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoginContainer2, { children: loginSection ? loginSection : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoginSection2, { ...props }) })
|
|
11527
12720
|
] });
|
|
11528
12721
|
}
|
|
11529
12722
|
|
|
@@ -11658,8 +12851,8 @@ var StyledMuiMenuItem = _styles.styled.call(void 0,
|
|
|
11658
12851
|
fontSize: "24px"
|
|
11659
12852
|
}
|
|
11660
12853
|
}));
|
|
11661
|
-
var
|
|
11662
|
-
var MenuItem_default =
|
|
12854
|
+
var MenuItem8 = (props) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, StyledMuiMenuItem, { ...props });
|
|
12855
|
+
var MenuItem_default = MenuItem8;
|
|
11663
12856
|
|
|
11664
12857
|
// src/DrawerMenu/components/FullMenu/components/FullMenuItem/index.tsx
|
|
11665
12858
|
|
|
@@ -11669,7 +12862,7 @@ function FullMenuItem2(props) {
|
|
|
11669
12862
|
if (!menuItem.visible)
|
|
11670
12863
|
return null;
|
|
11671
12864
|
const isExpandable = Boolean(
|
|
11672
|
-
_optionalChain([menuItem, 'optionalAccess',
|
|
12865
|
+
_optionalChain([menuItem, 'optionalAccess', _188 => _188.items]) && _optionalChain([menuItem, 'optionalAccess', _189 => _189.items, 'access', _190 => _190.length]) > 0
|
|
11673
12866
|
);
|
|
11674
12867
|
function toggleExpand() {
|
|
11675
12868
|
setExpanded(!expanded);
|
|
@@ -11679,7 +12872,7 @@ function FullMenuItem2(props) {
|
|
|
11679
12872
|
MenuItem_default,
|
|
11680
12873
|
{
|
|
11681
12874
|
onClick: () => {
|
|
11682
|
-
if (_optionalChain([menuItem, 'optionalAccess',
|
|
12875
|
+
if (_optionalChain([menuItem, 'optionalAccess', _191 => _191.link])) {
|
|
11683
12876
|
onMenuClick(menuItem.link);
|
|
11684
12877
|
return;
|
|
11685
12878
|
}
|
|
@@ -11694,14 +12887,14 @@ function FullMenuItem2(props) {
|
|
|
11694
12887
|
]
|
|
11695
12888
|
}
|
|
11696
12889
|
),
|
|
11697
|
-
_optionalChain([menuItem, 'optionalAccess',
|
|
12890
|
+
_optionalChain([menuItem, 'optionalAccess', _192 => _192.items]) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Collapse, { in: expanded, timeout: "auto", unmountOnExit: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11698
12891
|
FullMenu,
|
|
11699
12892
|
{
|
|
11700
12893
|
activeMenu,
|
|
11701
12894
|
sx: {
|
|
11702
12895
|
pl: (theme2) => theme2.spacing(1.5)
|
|
11703
12896
|
},
|
|
11704
|
-
menus: _optionalChain([menuItem, 'optionalAccess',
|
|
12897
|
+
menus: _optionalChain([menuItem, 'optionalAccess', _193 => _193.items]) || [],
|
|
11705
12898
|
onMenuClick
|
|
11706
12899
|
}
|
|
11707
12900
|
) })
|
|
@@ -11749,38 +12942,38 @@ function MinMenu(props) {
|
|
|
11749
12942
|
MenuItem_default,
|
|
11750
12943
|
{
|
|
11751
12944
|
onMouseEnter: (e) => {
|
|
11752
|
-
if (!_optionalChain([menuItem, 'optionalAccess',
|
|
12945
|
+
if (!_optionalChain([menuItem, 'optionalAccess', _194 => _194.link])) {
|
|
11753
12946
|
handleOpen(e, menuItem.id, menuItem.items);
|
|
11754
12947
|
}
|
|
11755
12948
|
},
|
|
11756
12949
|
onMouseLeave: () => {
|
|
11757
|
-
if (!_optionalChain([menuItem, 'optionalAccess',
|
|
12950
|
+
if (!_optionalChain([menuItem, 'optionalAccess', _195 => _195.link])) {
|
|
11758
12951
|
handleClose();
|
|
11759
12952
|
}
|
|
11760
12953
|
},
|
|
11761
12954
|
onClick: () => {
|
|
11762
|
-
if (_optionalChain([menuItem, 'optionalAccess',
|
|
12955
|
+
if (_optionalChain([menuItem, 'optionalAccess', _196 => _196.link])) {
|
|
11763
12956
|
onMenuClick(menuItem.link);
|
|
11764
12957
|
}
|
|
11765
12958
|
},
|
|
11766
12959
|
selected: activeMenu === menuItem.link,
|
|
11767
12960
|
children: [
|
|
11768
12961
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.ListItemIcon, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Icon, { children: menuItem.icon }) }),
|
|
11769
|
-
_optionalChain([opened, 'optionalAccess',
|
|
12962
|
+
_optionalChain([opened, 'optionalAccess', _197 => _197.id]) === menuItem.id && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11770
12963
|
_material.Popper,
|
|
11771
12964
|
{
|
|
11772
12965
|
sx: {
|
|
11773
12966
|
zIndex: 999999
|
|
11774
12967
|
},
|
|
11775
|
-
anchorEl: _optionalChain([opened, 'optionalAccess',
|
|
11776
|
-
open: Boolean(_optionalChain([opened, 'optionalAccess',
|
|
12968
|
+
anchorEl: _optionalChain([opened, 'optionalAccess', _198 => _198.element]),
|
|
12969
|
+
open: Boolean(_optionalChain([opened, 'optionalAccess', _199 => _199.element])),
|
|
11777
12970
|
placement: "right-start",
|
|
11778
12971
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11779
12972
|
FullMenu,
|
|
11780
12973
|
{
|
|
11781
12974
|
activeMenu,
|
|
11782
12975
|
onMenuClick,
|
|
11783
|
-
menus: _optionalChain([menuItem, 'optionalAccess',
|
|
12976
|
+
menus: _optionalChain([menuItem, 'optionalAccess', _200 => _200.items]) || [],
|
|
11784
12977
|
sx: {
|
|
11785
12978
|
minWidth: "240px",
|
|
11786
12979
|
backgroundColor: theme_default.palette.background.paper,
|
|
@@ -11897,7 +13090,7 @@ function Avatar(props) {
|
|
|
11897
13090
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
11898
13091
|
_Avatar2.default,
|
|
11899
13092
|
{
|
|
11900
|
-
src: _optionalChain([user, 'optionalAccess',
|
|
13093
|
+
src: _optionalChain([user, 'optionalAccess', _201 => _201.avatarUrl]),
|
|
11901
13094
|
sx: { width: 64, height: 64, margin: "auto", mb: 2 },
|
|
11902
13095
|
...props
|
|
11903
13096
|
}
|
|
@@ -12008,7 +13201,7 @@ var AvatarUploader = ({ onSave, src }) => {
|
|
|
12008
13201
|
}
|
|
12009
13202
|
};
|
|
12010
13203
|
const handleFileChange = (event) => {
|
|
12011
|
-
const file = _optionalChain([event, 'access',
|
|
13204
|
+
const file = _optionalChain([event, 'access', _202 => _202.target, 'access', _203 => _203.files, 'optionalAccess', _204 => _204[0]]);
|
|
12012
13205
|
if (!file)
|
|
12013
13206
|
return;
|
|
12014
13207
|
const reader = new FileReader();
|
|
@@ -12089,14 +13282,14 @@ var AvatarUploader_default = AvatarUploader;
|
|
|
12089
13282
|
|
|
12090
13283
|
// src/Profile/MinhaConta.tsx
|
|
12091
13284
|
|
|
12092
|
-
var
|
|
13285
|
+
var schema7 = create$3().shape({
|
|
12093
13286
|
name: create$6().required("Informe o nome")
|
|
12094
13287
|
});
|
|
12095
13288
|
function MinhaConta(props) {
|
|
12096
13289
|
const { usuario, credentialsConfig, onUploadComplete } = props;
|
|
12097
13290
|
const { data, setData, handleChange, validate, validationErrors } = _hooks.useForm.call(void 0,
|
|
12098
13291
|
usuario,
|
|
12099
|
-
|
|
13292
|
+
schema7
|
|
12100
13293
|
);
|
|
12101
13294
|
const [error, setErro] = _react.useState.call(void 0, false);
|
|
12102
13295
|
const [isAlterando, setAlterando] = _react.useState.call(void 0, false);
|
|
@@ -12137,7 +13330,7 @@ function MinhaConta(props) {
|
|
|
12137
13330
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
12138
13331
|
AvatarUploader_default,
|
|
12139
13332
|
{
|
|
12140
|
-
src: _optionalChain([data, 'optionalAccess',
|
|
13333
|
+
src: _optionalChain([data, 'optionalAccess', _205 => _205.avatarUrl]),
|
|
12141
13334
|
onSave: (croppedImage) => {
|
|
12142
13335
|
try {
|
|
12143
13336
|
uploadAvatar(croppedImage);
|
|
@@ -12163,7 +13356,7 @@ function MinhaConta(props) {
|
|
|
12163
13356
|
disabled: true,
|
|
12164
13357
|
fullWidth: true,
|
|
12165
13358
|
label: "E-mail",
|
|
12166
|
-
value: _optionalChain([data, 'optionalAccess',
|
|
13359
|
+
value: _optionalChain([data, 'optionalAccess', _206 => _206.email]) || ""
|
|
12167
13360
|
}
|
|
12168
13361
|
) }),
|
|
12169
13362
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Grid, { size: { xl: 4, lg: 4, md: 4, sm: 12, xs: 12 }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -12172,7 +13365,7 @@ function MinhaConta(props) {
|
|
|
12172
13365
|
name: "name",
|
|
12173
13366
|
fullWidth: true,
|
|
12174
13367
|
label: "Nome",
|
|
12175
|
-
value: _optionalChain([data, 'optionalAccess',
|
|
13368
|
+
value: _optionalChain([data, 'optionalAccess', _207 => _207.name]) || "",
|
|
12176
13369
|
onChange: handleChange,
|
|
12177
13370
|
...validationErrors("name")
|
|
12178
13371
|
}
|
|
@@ -12183,7 +13376,7 @@ function MinhaConta(props) {
|
|
|
12183
13376
|
name: "surname",
|
|
12184
13377
|
fullWidth: true,
|
|
12185
13378
|
label: "Sobrenome",
|
|
12186
|
-
value: _optionalChain([data, 'optionalAccess',
|
|
13379
|
+
value: _optionalChain([data, 'optionalAccess', _208 => _208.surname]) || "",
|
|
12187
13380
|
onChange: handleChange
|
|
12188
13381
|
}
|
|
12189
13382
|
) })
|
|
@@ -12266,7 +13459,7 @@ function DialogVerificarWhastapp(props) {
|
|
|
12266
13459
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body1", sx: { fontSize: "10pt" }, children: [
|
|
12267
13460
|
"Enviamos um c\xF3digo via WhatsApp para +55",
|
|
12268
13461
|
" ",
|
|
12269
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "b", { children: `(${_optionalChain([payload, 'optionalAccess',
|
|
13462
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "b", { children: `(${_optionalChain([payload, 'optionalAccess', _209 => _209.whatsappNumber, 'optionalAccess', _210 => _210.slice, 'call', _211 => _211(0, 2)])}) ${_optionalChain([payload, 'optionalAccess', _212 => _212.whatsappNumber, 'optionalAccess', _213 => _213.slice, 'call', _214 => _214(2, 7)])}-${_optionalChain([payload, 'optionalAccess', _215 => _215.whatsappNumber, 'optionalAccess', _216 => _216.slice, 'call', _217 => _217(7)])}` }),
|
|
12270
13463
|
". ",
|
|
12271
13464
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "br", {}),
|
|
12272
13465
|
"Digite o c\xF3digo abaixo para confirmar que este n\xFAmero \xE9 seu."
|
|
@@ -12301,7 +13494,7 @@ function DialogVerificarWhastapp(props) {
|
|
|
12301
13494
|
|
|
12302
13495
|
// src/Profile/LoginSeguranca.tsx
|
|
12303
13496
|
|
|
12304
|
-
var
|
|
13497
|
+
var schema8 = create$3().shape({
|
|
12305
13498
|
whatsappNumber: create$6().required("Informe o n\xFAmero do whastapp").length(15)
|
|
12306
13499
|
});
|
|
12307
13500
|
function LoginSeguranca(props) {
|
|
@@ -12366,7 +13559,7 @@ function LoginSeguranca(props) {
|
|
|
12366
13559
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
12367
13560
|
WhatsAppTextField,
|
|
12368
13561
|
{
|
|
12369
|
-
disabled: Boolean(_optionalChain([data, 'optionalAccess',
|
|
13562
|
+
disabled: Boolean(_optionalChain([data, 'optionalAccess', _218 => _218.whatsappVerifiedAt])),
|
|
12370
13563
|
fullWidth: false,
|
|
12371
13564
|
name: "whatsappNumber",
|
|
12372
13565
|
label: "Whastapp",
|
|
@@ -12550,5 +13743,9 @@ var _CssBaseline = require('@mui/material/CssBaseline'); var _CssBaseline2 = _in
|
|
|
12550
13743
|
|
|
12551
13744
|
|
|
12552
13745
|
|
|
12553
|
-
|
|
13746
|
+
|
|
13747
|
+
|
|
13748
|
+
|
|
13749
|
+
|
|
13750
|
+
exports.AlterarLicenca = AlterarLicenca; exports.AlterarSenha = AlterarSenha; exports.AlterarSenhaV2 = AlterarSenhaV2; exports.Auth = Auth; exports.Autocomplete = Autocomplete; exports.Avatar = Avatar; exports.Breadcrumbs = Breadcrumbs; exports.Button = Button_default; exports.ButtonContainer = ButtonContainer; exports.ButtonGroup = ButtonGroup_default; exports.CEPTextField = CEPTextField; exports.Card = Card_default; exports.Checkbox = Checkbox; exports.ColorsGrid = ColorsGrid; exports.Content = Content2; exports.ContentTitle = ContentTitle_default; exports.CredentialsProvider = CredentialsProvider; exports.CssBaseline = _CssBaseline2.default; exports.CurrencyCellStyle = CurrencyCellStyle; exports.CurrencyTextField = CurrencyTextField_default; exports.DataTable = DataTable_default; exports.DataTableOptions = DataTableOptions; exports.DatePicker = DatePicker; exports.DatePickerProvider = DatePickerProvider; exports.DateRangePicker = DateRangePicker; exports.Dialog = Dialog_default; exports.DocumentoTextField = DocumentoTextField; exports.DrawerMenu = DrawerMenu; exports.Editable = Editable; exports.Filter = Filter_default; exports.FilterApiContext = FilterApiContext; exports.FilterContainer = FilterContainer; exports.FilterControl = FilterControl; exports.FilterDataContext = FilterDataContext; exports.FilterProvider = FilterProvider; exports.Flag = Flag; exports.Header = Header_default; exports.Icon = Icon_default; exports.LabelValue = LabelValue; exports.List = List_default; exports.LucidIcon = LucidIcon_default; exports.Menu = Menu_default; exports.MioAuth = MioAuth; exports.NotaVersao = NotaVersao; exports.OptionStyles = OptionStyles; exports.Page = Page_default; exports.PageTitle = PageTitle; exports.PasswordTextField = PasswordTextField; exports.Popover = Popover_default; exports.Profile = Profile; exports.SearchTextField = SearchTextField; exports.Surface = Surface; exports.TelefoneTextField = TelefoneTextField; exports.TextField = TextField5; exports.ThemeProvider = _styles.ThemeProvider; exports.Title = Title4; exports.Tooltip = Tooltip_default; exports.Transporter = Transporter_default; exports.createTheme = _styles.createTheme; exports.renderMenuItems = renderMenuItems; exports.styled = _styles.styled; exports.theme = theme_default; exports.useCredentialsContext = useCredentialsContext; exports.useDialogs = _core.useDialogs; exports.useFilter = useFilter; exports.useFilterApi = useFilterApi3; exports.useMenu = useMenu; exports.useTheme = _styles.useTheme; exports.useTransporter = useTransporter;
|
|
12554
13751
|
//# sourceMappingURL=index.js.map
|