s-platform-landing-section 0.1.36-beta.10 → 0.1.36-beta.11
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/angle-small-left~biOSnepC.svg +2 -0
- package/dist/angle-small-right~rycMvNof.svg +2 -0
- package/dist/index.js +193 -0
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +193 -1
- package/dist/index.modern.js.map +1 -1
- package/dist/no-photo~HEpaubbO.svg +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" id="Outline" viewBox="0 0 24 24" width="512" height="512"><path d="M10.6,12.71a1,1,0,0,1,0-1.42l4.59-4.58a1,1,0,0,0,0-1.42,1,1,0,0,0-1.41,0L9.19,9.88a3,3,0,0,0,0,4.24l4.59,4.59a1,1,0,0,0,.7.29,1,1,0,0,0,.71-.29,1,1,0,0,0,0-1.42Z"/></svg>
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" id="Outline" viewBox="0 0 24 24" width="512" height="512"><path d="M15.4,9.88,10.81,5.29a1,1,0,0,0-1.41,0,1,1,0,0,0,0,1.42L14,11.29a1,1,0,0,1,0,1.42L9.4,17.29a1,1,0,0,0,1.41,1.42l4.59-4.59A3,3,0,0,0,15.4,9.88Z"/></svg>
|
package/dist/index.js
CHANGED
|
@@ -8504,6 +8504,8 @@ var ModalNotification = function ModalNotification(props) {
|
|
|
8504
8504
|
onCloseFormBooking = props.onCloseFormBooking,
|
|
8505
8505
|
_props$isButtonClose = props.isButtonClose,
|
|
8506
8506
|
isButtonClose = _props$isButtonClose === void 0 ? true : _props$isButtonClose,
|
|
8507
|
+
_props$isMaskClose = props.isMaskClose,
|
|
8508
|
+
isMaskClose = _props$isMaskClose === void 0 ? false : _props$isMaskClose,
|
|
8507
8509
|
_props$className = props.className,
|
|
8508
8510
|
className = _props$className === void 0 ? "" : _props$className,
|
|
8509
8511
|
_props$style = props.style,
|
|
@@ -8518,6 +8520,9 @@ var ModalNotification = function ModalNotification(props) {
|
|
|
8518
8520
|
}, []);
|
|
8519
8521
|
var handleClickOutside = function handleClickOutside(event) {
|
|
8520
8522
|
event.stopPropagation();
|
|
8523
|
+
if (isMaskClose) {
|
|
8524
|
+
return;
|
|
8525
|
+
}
|
|
8521
8526
|
if (onClose) {
|
|
8522
8527
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
8523
8528
|
}
|
|
@@ -16469,6 +16474,193 @@ var NewsDetail1 = function NewsDetail1(props) {
|
|
|
16469
16474
|
}))) : null);
|
|
16470
16475
|
};
|
|
16471
16476
|
|
|
16477
|
+
var submitFormApi = function submitFormApi(landingShopConfigId, data) {
|
|
16478
|
+
return api({
|
|
16479
|
+
method: "post",
|
|
16480
|
+
url: endpointLandingShop + "/" + landingShopConfigId + "/form",
|
|
16481
|
+
data: data
|
|
16482
|
+
});
|
|
16483
|
+
};
|
|
16484
|
+
|
|
16485
|
+
var Form = function Form(props) {
|
|
16486
|
+
var _data$data, _data$data2, _data$data3;
|
|
16487
|
+
var _props$shopConfigStyl = props.shopConfigStyle,
|
|
16488
|
+
shopConfigStyle = _props$shopConfigStyl === void 0 ? {} : _props$shopConfigStyl,
|
|
16489
|
+
_props$shopConfig = props.shopConfig,
|
|
16490
|
+
shopConfig = _props$shopConfig === void 0 ? {} : _props$shopConfig,
|
|
16491
|
+
_props$data = props.data,
|
|
16492
|
+
data = _props$data === void 0 ? {} : _props$data,
|
|
16493
|
+
_props$SectionTitle = props.SectionTitle,
|
|
16494
|
+
SectionTitle = _props$SectionTitle === void 0 ? null : _props$SectionTitle,
|
|
16495
|
+
_props$router = props.router,
|
|
16496
|
+
router = _props$router === void 0 ? function () {} : _props$router;
|
|
16497
|
+
var _shopConfigStyle$colo = shopConfigStyle.color,
|
|
16498
|
+
_shopConfigStyle$colo2 = _shopConfigStyle$colo === void 0 ? {} : _shopConfigStyle$colo,
|
|
16499
|
+
_shopConfigStyle$colo3 = _shopConfigStyle$colo2.background,
|
|
16500
|
+
background = _shopConfigStyle$colo3 === void 0 ? "#fff" : _shopConfigStyle$colo3;
|
|
16501
|
+
var fields = (data === null || data === void 0 ? void 0 : (_data$data = data.data) === null || _data$data === void 0 ? void 0 : _data$data.fields) || [];
|
|
16502
|
+
var redirectUrl = (data === null || data === void 0 ? void 0 : (_data$data2 = data.data) === null || _data$data2 === void 0 ? void 0 : _data$data2.redirect_url) || "";
|
|
16503
|
+
var srcImage = data === null || data === void 0 ? void 0 : (_data$data3 = data.data) === null || _data$data3 === void 0 ? void 0 : _data$data3.srcImage;
|
|
16504
|
+
var _useState = React.useState(false),
|
|
16505
|
+
isLoading = _useState[0],
|
|
16506
|
+
setIsLoading = _useState[1];
|
|
16507
|
+
var fieldRefs = React.useRef({});
|
|
16508
|
+
var getFieldRef = function getFieldRef(key) {
|
|
16509
|
+
if (!fieldRefs.current[key]) {
|
|
16510
|
+
fieldRefs.current[key] = React__default.createRef();
|
|
16511
|
+
}
|
|
16512
|
+
return fieldRefs.current[key];
|
|
16513
|
+
};
|
|
16514
|
+
var formatFieldsWithValue = function formatFieldsWithValue() {
|
|
16515
|
+
return fields.map(function (field, index) {
|
|
16516
|
+
var _ref$current;
|
|
16517
|
+
var key = (field === null || field === void 0 ? void 0 : field.title) || "field-" + index;
|
|
16518
|
+
var ref = getFieldRef(key);
|
|
16519
|
+
var getValue = ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getValue;
|
|
16520
|
+
var value = getValue ? getValue() : undefined;
|
|
16521
|
+
return _extends({}, field, {
|
|
16522
|
+
value: value
|
|
16523
|
+
});
|
|
16524
|
+
});
|
|
16525
|
+
};
|
|
16526
|
+
var handleSubmit = function handleSubmit() {
|
|
16527
|
+
try {
|
|
16528
|
+
setIsLoading(true);
|
|
16529
|
+
return Promise.resolve(_finallyRethrows(function () {
|
|
16530
|
+
return _catch(function () {
|
|
16531
|
+
var isValid = true;
|
|
16532
|
+
var payload = {};
|
|
16533
|
+
fields.forEach(function (field, index) {
|
|
16534
|
+
var _ref$current2, _ref$current3;
|
|
16535
|
+
var key = (field === null || field === void 0 ? void 0 : field.title) || "field-" + index;
|
|
16536
|
+
var ref = getFieldRef(key);
|
|
16537
|
+
var validate = ref === null || ref === void 0 ? void 0 : (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.validateData;
|
|
16538
|
+
var getValue = ref === null || ref === void 0 ? void 0 : (_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.getValue;
|
|
16539
|
+
var ok = validate ? validate() : true;
|
|
16540
|
+
if (ok === false) {
|
|
16541
|
+
isValid = false;
|
|
16542
|
+
}
|
|
16543
|
+
payload[key] = getValue ? getValue() : undefined;
|
|
16544
|
+
});
|
|
16545
|
+
if (!isValid) return;
|
|
16546
|
+
var fieldsWithValue = formatFieldsWithValue();
|
|
16547
|
+
var body = {
|
|
16548
|
+
title: data === null || data === void 0 ? void 0 : data.sectionTitle,
|
|
16549
|
+
data: JSON.stringify(fieldsWithValue)
|
|
16550
|
+
};
|
|
16551
|
+
var _temp = function () {
|
|
16552
|
+
if (shopConfig !== null && shopConfig !== void 0 && shopConfig.landingShopConfigId) {
|
|
16553
|
+
return Promise.resolve(submitFormApi(shopConfig === null || shopConfig === void 0 ? void 0 : shopConfig.landingShopConfigId, body)).then(function (res) {
|
|
16554
|
+
var _res$data, _res$data$status;
|
|
16555
|
+
if ((res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : (_res$data$status = _res$data.status) === null || _res$data$status === void 0 ? void 0 : _res$data$status.code) == '200') {
|
|
16556
|
+
router === null || router === void 0 ? void 0 : router.push(redirectUrl || "/");
|
|
16557
|
+
}
|
|
16558
|
+
});
|
|
16559
|
+
}
|
|
16560
|
+
}();
|
|
16561
|
+
if (_temp && _temp.then) return _temp.then(function () {});
|
|
16562
|
+
}, function (error) {
|
|
16563
|
+
console.log(error);
|
|
16564
|
+
});
|
|
16565
|
+
}, function (_wasThrown, _result) {
|
|
16566
|
+
setIsLoading(false);
|
|
16567
|
+
if (_wasThrown) throw _result;
|
|
16568
|
+
return _result;
|
|
16569
|
+
}));
|
|
16570
|
+
} catch (e) {
|
|
16571
|
+
return Promise.reject(e);
|
|
16572
|
+
}
|
|
16573
|
+
};
|
|
16574
|
+
var renderField = function renderField(field, index) {
|
|
16575
|
+
var _field$title;
|
|
16576
|
+
var key = (field === null || field === void 0 ? void 0 : field.title) || "field-" + index;
|
|
16577
|
+
var commonProps = {
|
|
16578
|
+
label: field === null || field === void 0 ? void 0 : field.title,
|
|
16579
|
+
placeholder: "Nh\u1EADp " + ((field === null || field === void 0 ? void 0 : (_field$title = field.title) === null || _field$title === void 0 ? void 0 : _field$title.toLowerCase()) || ""),
|
|
16580
|
+
className: "!bg-bgSecondary",
|
|
16581
|
+
rules: field !== null && field !== void 0 && field.required ? [{
|
|
16582
|
+
type: "required",
|
|
16583
|
+
message: "Bắt buộc nhập"
|
|
16584
|
+
}] : [],
|
|
16585
|
+
labelClassName: "font-medium"
|
|
16586
|
+
};
|
|
16587
|
+
if ((field === null || field === void 0 ? void 0 : field.type) === "phone") {
|
|
16588
|
+
return /*#__PURE__*/React__default.createElement(InputPhoneNumber, _extends({
|
|
16589
|
+
key: key
|
|
16590
|
+
}, commonProps, {
|
|
16591
|
+
rules: [].concat(commonProps.rules, [{
|
|
16592
|
+
type: "pattern",
|
|
16593
|
+
pattern: pattern === null || pattern === void 0 ? void 0 : pattern.phoneNumberPattern,
|
|
16594
|
+
message: "Số điện thoại không hợp lệ!"
|
|
16595
|
+
}]),
|
|
16596
|
+
className: "bg-white",
|
|
16597
|
+
wrapClassName: "w-full",
|
|
16598
|
+
ref: getFieldRef(key)
|
|
16599
|
+
}));
|
|
16600
|
+
}
|
|
16601
|
+
if ((field === null || field === void 0 ? void 0 : field.type) === "area") {
|
|
16602
|
+
return /*#__PURE__*/React__default.createElement(TextArea, _extends({
|
|
16603
|
+
key: key
|
|
16604
|
+
}, commonProps, {
|
|
16605
|
+
className: "w-full",
|
|
16606
|
+
textareaClassName: "w-full p-3 bg-white",
|
|
16607
|
+
ref: getFieldRef(key)
|
|
16608
|
+
}));
|
|
16609
|
+
}
|
|
16610
|
+
var extraRules = [];
|
|
16611
|
+
if ((field === null || field === void 0 ? void 0 : field.type) === "email") {
|
|
16612
|
+
extraRules.push({
|
|
16613
|
+
type: "pattern",
|
|
16614
|
+
pattern: /\S+@\S+\.\S+/,
|
|
16615
|
+
message: "Email không hợp lệ"
|
|
16616
|
+
});
|
|
16617
|
+
}
|
|
16618
|
+
return /*#__PURE__*/React__default.createElement(Input, _extends({
|
|
16619
|
+
key: key
|
|
16620
|
+
}, commonProps, {
|
|
16621
|
+
type: (field === null || field === void 0 ? void 0 : field.type) === "email" ? "email" : "text",
|
|
16622
|
+
ref: getFieldRef(key),
|
|
16623
|
+
rules: [].concat(commonProps.rules, extraRules)
|
|
16624
|
+
}));
|
|
16625
|
+
};
|
|
16626
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
16627
|
+
className: "relative w-full px-4 xl:px-20 py-12",
|
|
16628
|
+
style: {
|
|
16629
|
+
backgroundColor: background
|
|
16630
|
+
}
|
|
16631
|
+
}, SectionTitle ? /*#__PURE__*/React__default.createElement(SectionTitle, {
|
|
16632
|
+
data: data,
|
|
16633
|
+
shopConfigStyle: shopConfigStyle
|
|
16634
|
+
}) : null, /*#__PURE__*/React__default.createElement("div", {
|
|
16635
|
+
className: "mt-12 grid grid-cols-1 gap-6 md:grid-cols-2 md:gap-12 items-start"
|
|
16636
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
16637
|
+
className: "space-y-4"
|
|
16638
|
+
}, srcImage ? /*#__PURE__*/React__default.createElement("div", {
|
|
16639
|
+
className: "w-full"
|
|
16640
|
+
}, /*#__PURE__*/React__default.createElement("img", {
|
|
16641
|
+
src: srcImage,
|
|
16642
|
+
alt: "form-banner",
|
|
16643
|
+
className: "w-full h-auto rounded-xl object-cover"
|
|
16644
|
+
})) : null), /*#__PURE__*/React__default.createElement("div", {
|
|
16645
|
+
className: "grid gap-4 rounded-2xl p-6 border bg-white"
|
|
16646
|
+
}, fields !== null && fields !== void 0 && fields.length ? /*#__PURE__*/React__default.createElement("div", {
|
|
16647
|
+
className: "grid grid-cols-1 gap-4"
|
|
16648
|
+
}, fields === null || fields === void 0 ? void 0 : fields.map(renderField)) : /*#__PURE__*/React__default.createElement("div", null, "Ch\u01B0a c\xF3 c\u1EA5u h\xECnh tr\u01B0\u1EDDng"), /*#__PURE__*/React__default.createElement("div", {
|
|
16649
|
+
className: "text-center"
|
|
16650
|
+
}, isLoading ? /*#__PURE__*/React__default.createElement("div", {
|
|
16651
|
+
className: "flex gap-2 justify-center items-center"
|
|
16652
|
+
}, /*#__PURE__*/React__default.createElement(Loading, {
|
|
16653
|
+
size: 24
|
|
16654
|
+
}), /*#__PURE__*/React__default.createElement("span", {
|
|
16655
|
+
className: "ml-2"
|
|
16656
|
+
}, "\u0110ang g\u1EEDi th\xF4ng tin...")) : /*#__PURE__*/React__default.createElement(Button, {
|
|
16657
|
+
label: "Gửi thông tin",
|
|
16658
|
+
shopConfigStyle: shopConfigStyle,
|
|
16659
|
+
onClick: handleSubmit,
|
|
16660
|
+
disabled: isLoading
|
|
16661
|
+
})))));
|
|
16662
|
+
};
|
|
16663
|
+
|
|
16472
16664
|
exports.About1 = About1;
|
|
16473
16665
|
exports.About5 = About5;
|
|
16474
16666
|
exports.About6 = About6;
|
|
@@ -16499,6 +16691,7 @@ exports.Features2 = Features2;
|
|
|
16499
16691
|
exports.Features3 = Features3;
|
|
16500
16692
|
exports.Footer1 = Footer1;
|
|
16501
16693
|
exports.Footer7 = Footer7;
|
|
16694
|
+
exports.Form = Form;
|
|
16502
16695
|
exports.Gallery1 = Gallery1;
|
|
16503
16696
|
exports.Gallery2 = Gallery2;
|
|
16504
16697
|
exports.Gallery3 = Gallery3;
|