datastake-daf 0.6.571 → 0.6.573
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/components/index.js +2 -199
- package/dist/hooks/index.js +16 -4655
- package/dist/layouts/index.css +1 -1
- package/dist/layouts/index.js +144 -0
- package/dist/services/index.js +2 -1
- package/package.json +1 -1
- package/src/@daf/layouts/AuthLayout/AuthLayout.stories.js +502 -0
- package/src/@daf/layouts/AuthLayout/components/NavbarComponent.jsx +69 -0
- package/src/@daf/layouts/AuthLayout/components/index.scss +165 -0
- package/src/@daf/layouts/AuthLayout/index.jsx +83 -0
- package/src/@daf/layouts/AuthLayout/index.scss +77 -0
- package/src/@daf/services/ChannelsService.js +2 -1
- package/src/index.js +0 -1
- package/src/layouts.js +3 -1
- package/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +0 -25
- package/build/robots.txt +0 -3
- package/src/@daf/core/components/AuthForm/AuthForm.stories.js +0 -421
- package/src/@daf/core/components/AuthForm/index.jsx +0 -200
package/dist/components/index.js
CHANGED
|
@@ -40497,203 +40497,6 @@ const Navigation = _ref => {
|
|
|
40497
40497
|
}) : null;
|
|
40498
40498
|
};
|
|
40499
40499
|
|
|
40500
|
-
function AuthForm(_ref) {
|
|
40501
|
-
var _steps$currentStep;
|
|
40502
|
-
let {
|
|
40503
|
-
steps,
|
|
40504
|
-
fields,
|
|
40505
|
-
onSubmit,
|
|
40506
|
-
initialValues = {},
|
|
40507
|
-
submitText = "Submit",
|
|
40508
|
-
form,
|
|
40509
|
-
errors,
|
|
40510
|
-
t = key => key,
|
|
40511
|
-
executeRecaptcha = () => {}
|
|
40512
|
-
} = _ref;
|
|
40513
|
-
const [formInstance] = antd.Form.useForm(form);
|
|
40514
|
-
const [currentStep, setCurrentStep] = React.useState(0);
|
|
40515
|
-
const [allFormValues, setAllFormValues] = React.useState(initialValues);
|
|
40516
|
-
const [formErrors, setFormErrors] = React.useState(null);
|
|
40517
|
-
console.log({
|
|
40518
|
-
errors
|
|
40519
|
-
});
|
|
40520
|
-
const isMultiStep = !!steps;
|
|
40521
|
-
const currentFields = isMultiStep ? steps === null || steps === void 0 || (_steps$currentStep = steps[currentStep]) === null || _steps$currentStep === void 0 ? void 0 : _steps$currentStep.fields : fields || [];
|
|
40522
|
-
React.useEffect(() => {
|
|
40523
|
-
if (isMultiStep && Object.keys(allFormValues).length > 0) {
|
|
40524
|
-
formInstance.setFieldsValue(allFormValues);
|
|
40525
|
-
}
|
|
40526
|
-
}, [currentStep, allFormValues, formInstance, isMultiStep]);
|
|
40527
|
-
const handleReCaptchaVerify = React.useCallback(async () => {
|
|
40528
|
-
if (!executeRecaptcha) {
|
|
40529
|
-
console.log('Execute recaptcha not yet available');
|
|
40530
|
-
return;
|
|
40531
|
-
}
|
|
40532
|
-
const token = await executeRecaptcha('submit');
|
|
40533
|
-
return token;
|
|
40534
|
-
}, [executeRecaptcha]);
|
|
40535
|
-
const next = async () => {
|
|
40536
|
-
try {
|
|
40537
|
-
await formInstance.validateFields(currentFields.map(f => f.name));
|
|
40538
|
-
// Save current step values before moving to next step
|
|
40539
|
-
const currentValues = formInstance.getFieldsValue();
|
|
40540
|
-
setAllFormValues(prev => _objectSpread2(_objectSpread2({}, prev), currentValues));
|
|
40541
|
-
setCurrentStep(prev => prev + 1);
|
|
40542
|
-
} catch (err) {
|
|
40543
|
-
console.error("Please fix the validation errors before continuing.");
|
|
40544
|
-
}
|
|
40545
|
-
};
|
|
40546
|
-
const prev = () => setCurrentStep(prev => prev - 1);
|
|
40547
|
-
const handleSubmit = async values => {
|
|
40548
|
-
try {
|
|
40549
|
-
await formInstance.validateFields();
|
|
40550
|
-
const token = await handleReCaptchaVerify();
|
|
40551
|
-
if (!token) {
|
|
40552
|
-
console.error('reCAPTCHA verification failed');
|
|
40553
|
-
return;
|
|
40554
|
-
}
|
|
40555
|
-
setFormErrors(null);
|
|
40556
|
-
if (!isMultiStep) return onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit(values);
|
|
40557
|
-
if (currentStep < (steps === null || steps === void 0 ? void 0 : steps.length) - 1) return next();
|
|
40558
|
-
const finalValues = _objectSpread2(_objectSpread2({}, allFormValues), values);
|
|
40559
|
-
onSubmit === null || onSubmit === void 0 || onSubmit(finalValues);
|
|
40560
|
-
} catch (err) {
|
|
40561
|
-
console.error("Validation failed:", err);
|
|
40562
|
-
}
|
|
40563
|
-
};
|
|
40564
|
-
const checkRequiredFieldsFilled = (changedValues, allValues) => {
|
|
40565
|
-
const requiredFields = currentFields.filter(f => f.required).map(f => f.name);
|
|
40566
|
-
return requiredFields.every(fieldName => {
|
|
40567
|
-
const value = allValues[fieldName];
|
|
40568
|
-
return value !== undefined && value !== null && value !== '';
|
|
40569
|
-
});
|
|
40570
|
-
};
|
|
40571
|
-
React.useEffect(() => {
|
|
40572
|
-
setFormErrors(errors);
|
|
40573
|
-
}, [errors]);
|
|
40574
|
-
const renderErrors = (err, t) => {
|
|
40575
|
-
document.querySelectorAll('.ant-form-item').forEach(input => input.classList.add('ant-form-item-has-error'));
|
|
40576
|
-
return Object.keys(err).map(key => {
|
|
40577
|
-
return err[key].map(error => /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
40578
|
-
className: "ant-form-item-explain errors-cont",
|
|
40579
|
-
style: {
|
|
40580
|
-
color: '#ff4d4f'
|
|
40581
|
-
},
|
|
40582
|
-
children: t(error)
|
|
40583
|
-
}, error));
|
|
40584
|
-
});
|
|
40585
|
-
};
|
|
40586
|
-
const renderField = field => {
|
|
40587
|
-
var _field$options;
|
|
40588
|
-
let inputNode = null;
|
|
40589
|
-
switch (field.type) {
|
|
40590
|
-
case "input":
|
|
40591
|
-
case "email":
|
|
40592
|
-
case "number":
|
|
40593
|
-
inputNode = /*#__PURE__*/jsxRuntime.jsx(antd.Input, _objectSpread2({
|
|
40594
|
-
type: field.type,
|
|
40595
|
-
placeholder: field.placeholder
|
|
40596
|
-
}, field.props));
|
|
40597
|
-
break;
|
|
40598
|
-
case "password":
|
|
40599
|
-
inputNode = /*#__PURE__*/jsxRuntime.jsx(antd.Input.Password, _objectSpread2({
|
|
40600
|
-
placeholder: field.placeholder
|
|
40601
|
-
}, field.props));
|
|
40602
|
-
break;
|
|
40603
|
-
case "textarea":
|
|
40604
|
-
inputNode = /*#__PURE__*/jsxRuntime.jsx(antd.Input.TextArea, _objectSpread2({
|
|
40605
|
-
placeholder: field.placeholder
|
|
40606
|
-
}, field.props));
|
|
40607
|
-
break;
|
|
40608
|
-
case "select":
|
|
40609
|
-
inputNode = /*#__PURE__*/jsxRuntime.jsx(antd.Select, _objectSpread2(_objectSpread2({
|
|
40610
|
-
placeholder: field.placeholder
|
|
40611
|
-
}, field.props), {}, {
|
|
40612
|
-
children: (_field$options = field.options) === null || _field$options === void 0 ? void 0 : _field$options.map(opt => /*#__PURE__*/jsxRuntime.jsx(antd.Select.Option, {
|
|
40613
|
-
value: opt.value,
|
|
40614
|
-
children: opt.label
|
|
40615
|
-
}, opt.value))
|
|
40616
|
-
}));
|
|
40617
|
-
break;
|
|
40618
|
-
case "custom":
|
|
40619
|
-
inputNode = field.component;
|
|
40620
|
-
break;
|
|
40621
|
-
default:
|
|
40622
|
-
inputNode = /*#__PURE__*/jsxRuntime.jsx(antd.Input, _objectSpread2({
|
|
40623
|
-
placeholder: field.placeholder
|
|
40624
|
-
}, field.props));
|
|
40625
|
-
}
|
|
40626
|
-
return /*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
40627
|
-
name: field.name,
|
|
40628
|
-
label: field.label,
|
|
40629
|
-
rules: field.rules,
|
|
40630
|
-
style: {
|
|
40631
|
-
marginBottom: 0
|
|
40632
|
-
},
|
|
40633
|
-
children: inputNode
|
|
40634
|
-
}, field.name);
|
|
40635
|
-
};
|
|
40636
|
-
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
40637
|
-
children: /*#__PURE__*/jsxRuntime.jsxs(antd.Form, {
|
|
40638
|
-
form: formInstance,
|
|
40639
|
-
layout: "vertical",
|
|
40640
|
-
initialValues: initialValues,
|
|
40641
|
-
onFinish: handleSubmit,
|
|
40642
|
-
children: [currentFields.map(renderField), formErrors ? renderErrors(formErrors, t) : null, isMultiStep && currentStep > 0 ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
40643
|
-
className: "flex flex-column gap-2",
|
|
40644
|
-
style: {
|
|
40645
|
-
width: '100%'
|
|
40646
|
-
},
|
|
40647
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
|
|
40648
|
-
noStyle: true,
|
|
40649
|
-
shouldUpdate: true,
|
|
40650
|
-
children: form => {
|
|
40651
|
-
const isLastStep = currentStep === (steps === null || steps === void 0 ? void 0 : steps.length) - 1;
|
|
40652
|
-
const allFieldsFilled = checkRequiredFieldsFilled({}, form.getFieldsValue());
|
|
40653
|
-
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
40654
|
-
className: "buttons",
|
|
40655
|
-
style: {
|
|
40656
|
-
marginTop: 0
|
|
40657
|
-
},
|
|
40658
|
-
children: /*#__PURE__*/jsxRuntime.jsx(BorderedButton, {
|
|
40659
|
-
type: "primary",
|
|
40660
|
-
htmlType: "submit",
|
|
40661
|
-
disabled: isLastStep && !allFieldsFilled,
|
|
40662
|
-
block: true,
|
|
40663
|
-
className: "normal-br",
|
|
40664
|
-
children: isLastStep ? submitText : t("Next")
|
|
40665
|
-
})
|
|
40666
|
-
});
|
|
40667
|
-
}
|
|
40668
|
-
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
40669
|
-
className: "buttons",
|
|
40670
|
-
style: {
|
|
40671
|
-
marginTop: 0
|
|
40672
|
-
},
|
|
40673
|
-
children: /*#__PURE__*/jsxRuntime.jsx(BorderedButton, {
|
|
40674
|
-
onClick: prev,
|
|
40675
|
-
block: true,
|
|
40676
|
-
className: "normal-br",
|
|
40677
|
-
children: t("Back")
|
|
40678
|
-
})
|
|
40679
|
-
})]
|
|
40680
|
-
}) : /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
40681
|
-
className: "buttons",
|
|
40682
|
-
style: {
|
|
40683
|
-
marginTop: 0
|
|
40684
|
-
},
|
|
40685
|
-
children: /*#__PURE__*/jsxRuntime.jsx(BorderedButton, {
|
|
40686
|
-
type: "primary",
|
|
40687
|
-
htmlType: "submit",
|
|
40688
|
-
block: true,
|
|
40689
|
-
className: "normal-br",
|
|
40690
|
-
children: isMultiStep ? t("Next") : submitText
|
|
40691
|
-
})
|
|
40692
|
-
})]
|
|
40693
|
-
})
|
|
40694
|
-
});
|
|
40695
|
-
}
|
|
40696
|
-
|
|
40697
40500
|
var _templateObject$6;
|
|
40698
40501
|
const Style$s = dt.div(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteral(["\n width: 99px;\n height: 10px;\n border-radius: 8px;\n background: var(--base-gray-40);\n overflow: hidden;\n\n .bar {\n height: 100%;\n background: var(--color-primary-70);\n }\n"])));
|
|
40699
40502
|
function ProgressBar(_ref) {
|
|
@@ -41472,8 +41275,9 @@ class ChannelsService extends BaseService {
|
|
|
41472
41275
|
});
|
|
41473
41276
|
}
|
|
41474
41277
|
return this.apiGet({
|
|
41475
|
-
url: `/
|
|
41278
|
+
url: `/api/channels`,
|
|
41476
41279
|
params,
|
|
41280
|
+
isStore: true,
|
|
41477
41281
|
headers: token ? {
|
|
41478
41282
|
Authorization: `Bearer ${token}`
|
|
41479
41283
|
} : undefined
|
|
@@ -59598,7 +59402,6 @@ exports.AjaxSelect = AjaxSelectMain;
|
|
|
59598
59402
|
exports.Animated = Animated;
|
|
59599
59403
|
exports.Applications = Applications;
|
|
59600
59404
|
exports.AreaChart = AreaChart;
|
|
59601
|
-
exports.AuthForm = AuthForm;
|
|
59602
59405
|
exports.AvatarGroup = AvatarGroup;
|
|
59603
59406
|
exports.Badge = Badge;
|
|
59604
59407
|
exports.BarChart = BarChart;
|