datastake-daf 0.6.575 → 0.6.577
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/build/favicon.ico +0 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +25 -0
- package/build/robots.txt +3 -0
- package/dist/components/index.js +199 -2
- package/dist/hooks/index.js +4655 -16
- package/dist/layouts/index.css +1 -1
- package/dist/layouts/index.js +14 -577
- package/dist/services/index.js +1 -2
- package/package.json +1 -1
- package/src/@daf/core/components/AuthForm/AuthForm.stories.js +421 -0
- package/src/@daf/core/components/AuthForm/index.jsx +200 -0
- package/src/@daf/services/ChannelsService.js +1 -2
- package/src/index.js +1 -0
- package/src/layouts.js +1 -3
- package/src/@daf/layouts/AuthLayout/AuthLayout.stories.js +0 -502
- package/src/@daf/layouts/AuthLayout/components/Navbar/config.js +0 -43
- package/src/@daf/layouts/AuthLayout/components/Navbar/index.jsx +0 -69
- package/src/@daf/layouts/AuthLayout/components/Navbar/index.scss +0 -169
- package/src/@daf/layouts/AuthLayout/components/Navbar/style.js +0 -149
- package/src/@daf/layouts/AuthLayout/index.jsx +0 -85
- package/src/@daf/layouts/AuthLayout/index.scss +0 -77
- package/src/@daf/layouts/AuthLayout/style.js +0 -418
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"short_name": "React App",
|
|
3
|
+
"name": "Create React App Sample",
|
|
4
|
+
"icons": [
|
|
5
|
+
{
|
|
6
|
+
"src": "favicon.ico",
|
|
7
|
+
"sizes": "64x64 32x32 24x24 16x16",
|
|
8
|
+
"type": "image/x-icon"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"src": "logo192.png",
|
|
12
|
+
"type": "image/png",
|
|
13
|
+
"sizes": "192x192"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"src": "logo512.png",
|
|
17
|
+
"type": "image/png",
|
|
18
|
+
"sizes": "512x512"
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"start_url": ".",
|
|
22
|
+
"display": "standalone",
|
|
23
|
+
"theme_color": "#000000",
|
|
24
|
+
"background_color": "#ffffff"
|
|
25
|
+
}
|
package/build/robots.txt
ADDED
package/dist/components/index.js
CHANGED
|
@@ -40497,6 +40497,203 @@ 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
|
+
|
|
40500
40697
|
var _templateObject$6;
|
|
40501
40698
|
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"])));
|
|
40502
40699
|
function ProgressBar(_ref) {
|
|
@@ -41275,9 +41472,8 @@ class ChannelsService extends BaseService {
|
|
|
41275
41472
|
});
|
|
41276
41473
|
}
|
|
41277
41474
|
return this.apiGet({
|
|
41278
|
-
url: `/
|
|
41475
|
+
url: `/store/channels`,
|
|
41279
41476
|
params,
|
|
41280
|
-
isStore: true,
|
|
41281
41477
|
headers: token ? {
|
|
41282
41478
|
Authorization: `Bearer ${token}`
|
|
41283
41479
|
} : undefined
|
|
@@ -59402,6 +59598,7 @@ exports.AjaxSelect = AjaxSelectMain;
|
|
|
59402
59598
|
exports.Animated = Animated;
|
|
59403
59599
|
exports.Applications = Applications;
|
|
59404
59600
|
exports.AreaChart = AreaChart;
|
|
59601
|
+
exports.AuthForm = AuthForm;
|
|
59405
59602
|
exports.AvatarGroup = AvatarGroup;
|
|
59406
59603
|
exports.Badge = Badge;
|
|
59407
59604
|
exports.BarChart = BarChart;
|