@redneckz/wildless-cms-uni-blocks 0.14.1063 → 0.14.1065
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/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +52 -30
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/RatesTable/RatesTable.d.ts +3 -0
- package/bundle/components/RatesTable/RatesTableContent.d.ts +13 -3
- package/bundle/components/RatesTable/RatesTableItem.d.ts +2 -2
- package/bundle/hooks/useRates.d.ts +11 -2
- package/bundle/retail/model/RetailFormContent.d.ts +1 -0
- package/dist/components/ApplicationLeadForm/getInitialFormState.js +1 -0
- package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/dist/components/CreditCardForm/getDeliveryCreditCardData.js +0 -2
- package/dist/components/CreditCardForm/getDeliveryCreditCardData.js.map +1 -1
- package/dist/components/RatesTable/RatesTable.d.ts +3 -0
- package/dist/components/RatesTable/RatesTable.js +23 -5
- package/dist/components/RatesTable/RatesTable.js.map +1 -1
- package/dist/components/RatesTable/RatesTableContent.d.ts +13 -3
- package/dist/components/RatesTable/RatesTableItem.d.ts +2 -2
- package/dist/components/RatesTable/RatesTableItem.js.map +1 -1
- package/dist/hooks/useRates.d.ts +11 -2
- package/dist/hooks/useRates.js +28 -20
- package/dist/hooks/useRates.js.map +1 -1
- package/dist/retail/components/Fields/DeliveryDateField.js +1 -1
- package/dist/retail/components/Fields/DeliveryDateField.js.map +1 -1
- package/dist/retail/content.js +1 -0
- package/dist/retail/content.js.map +1 -1
- package/dist/retail/model/RetailFormContent.d.ts +1 -0
- package/lib/components/ApplicationLeadForm/getInitialFormState.js +1 -0
- package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/lib/components/CreditCardForm/getDeliveryCreditCardData.js +0 -2
- package/lib/components/CreditCardForm/getDeliveryCreditCardData.js.map +1 -1
- package/lib/components/RatesTable/RatesTable.d.ts +3 -0
- package/lib/components/RatesTable/RatesTable.fixture.d.ts +1 -1
- package/lib/components/RatesTable/RatesTable.fixture.mobile.d.ts +1 -1
- package/lib/components/RatesTable/RatesTable.js +23 -5
- package/lib/components/RatesTable/RatesTable.js.map +1 -1
- package/lib/components/RatesTable/RatesTableContent.d.ts +13 -3
- package/lib/components/RatesTable/RatesTableItem.d.ts +2 -2
- package/lib/components/RatesTable/RatesTableItem.js.map +1 -1
- package/lib/hooks/useRates.d.ts +11 -2
- package/lib/hooks/useRates.js +28 -20
- package/lib/hooks/useRates.js.map +1 -1
- package/lib/retail/components/Fields/DeliveryDateField.js +1 -1
- package/lib/retail/components/Fields/DeliveryDateField.js.map +1 -1
- package/lib/retail/content.js +1 -0
- package/lib/retail/content.js.map +1 -1
- package/lib/retail/model/RetailFormContent.d.ts +1 -0
- package/mobile/bundle/bundle.umd.js +52 -30
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/RatesTable/RatesTable.d.ts +3 -0
- package/mobile/bundle/components/RatesTable/RatesTableContent.d.ts +13 -3
- package/mobile/bundle/components/RatesTable/RatesTableItem.d.ts +2 -2
- package/mobile/bundle/hooks/useRates.d.ts +11 -2
- package/mobile/bundle/retail/model/RetailFormContent.d.ts +1 -0
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js +1 -0
- package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/dist/components/CreditCardForm/getDeliveryCreditCardData.js +0 -2
- package/mobile/dist/components/CreditCardForm/getDeliveryCreditCardData.js.map +1 -1
- package/mobile/dist/components/RatesTable/RatesTable.d.ts +3 -0
- package/mobile/dist/components/RatesTable/RatesTable.js +23 -5
- package/mobile/dist/components/RatesTable/RatesTable.js.map +1 -1
- package/mobile/dist/components/RatesTable/RatesTableContent.d.ts +13 -3
- package/mobile/dist/components/RatesTable/RatesTableItem.d.ts +2 -2
- package/mobile/dist/components/RatesTable/RatesTableItem.js.map +1 -1
- package/mobile/dist/hooks/useRates.d.ts +11 -2
- package/mobile/dist/hooks/useRates.js +28 -20
- package/mobile/dist/hooks/useRates.js.map +1 -1
- package/mobile/dist/retail/components/Fields/DeliveryDateField.js +1 -1
- package/mobile/dist/retail/components/Fields/DeliveryDateField.js.map +1 -1
- package/mobile/dist/retail/content.js +1 -0
- package/mobile/dist/retail/content.js.map +1 -1
- package/mobile/dist/retail/model/RetailFormContent.d.ts +1 -0
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js +1 -0
- package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
- package/mobile/lib/components/CreditCardForm/getDeliveryCreditCardData.js +0 -2
- package/mobile/lib/components/CreditCardForm/getDeliveryCreditCardData.js.map +1 -1
- package/mobile/lib/components/RatesTable/RatesTable.d.ts +3 -0
- package/mobile/lib/components/RatesTable/RatesTable.js +23 -5
- package/mobile/lib/components/RatesTable/RatesTable.js.map +1 -1
- package/mobile/lib/components/RatesTable/RatesTableContent.d.ts +13 -3
- package/mobile/lib/components/RatesTable/RatesTableItem.d.ts +2 -2
- package/mobile/lib/components/RatesTable/RatesTableItem.js.map +1 -1
- package/mobile/lib/hooks/useRates.d.ts +11 -2
- package/mobile/lib/hooks/useRates.js +28 -20
- package/mobile/lib/hooks/useRates.js.map +1 -1
- package/mobile/lib/retail/components/Fields/DeliveryDateField.js +1 -1
- package/mobile/lib/retail/components/Fields/DeliveryDateField.js.map +1 -1
- package/mobile/lib/retail/content.js +1 -0
- package/mobile/lib/retail/content.js.map +1 -1
- package/mobile/lib/retail/model/RetailFormContent.d.ts +1 -0
- package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +1 -0
- package/mobile/src/components/CreditCardForm/getDeliveryCreditCardData.ts +0 -2
- package/mobile/src/components/RatesTable/RatesTable.example.json +5 -3
- package/mobile/src/components/RatesTable/RatesTable.tsx +71 -16
- package/mobile/src/components/RatesTable/RatesTableContent.ts +14 -3
- package/mobile/src/components/RatesTable/RatesTableItem.tsx +2 -1
- package/mobile/src/hooks/useRates.ts +46 -23
- package/mobile/src/retail/components/Fields/DeliveryDateField.tsx +1 -0
- package/mobile/src/retail/content.tsx +1 -0
- package/mobile/src/retail/model/RetailFormContent.ts +1 -0
- package/package.json +1 -1
- package/src/components/ApplicationLeadForm/getInitialFormState.tsx +1 -0
- package/src/components/CreditCardForm/getDeliveryCreditCardData.ts +0 -2
- package/src/components/RatesTable/RatesTable.example.json +5 -3
- package/src/components/RatesTable/RatesTable.fixture.mobile.tsx +10 -5
- package/src/components/RatesTable/RatesTable.fixture.tsx +10 -5
- package/src/components/RatesTable/RatesTable.tsx +71 -16
- package/src/components/RatesTable/RatesTableContent.ts +14 -3
- package/src/components/RatesTable/RatesTableItem.tsx +2 -1
- package/src/hooks/useRates.ts +46 -23
- package/src/retail/components/Fields/DeliveryDateField.tsx +1 -0
- package/src/retail/content.tsx +1 -0
- package/src/retail/model/RetailFormContent.ts +1 -0
package/bundle/bundle.umd.js
CHANGED
|
@@ -6254,7 +6254,7 @@
|
|
|
6254
6254
|
}
|
|
6255
6255
|
return [];
|
|
6256
6256
|
}, [data]);
|
|
6257
|
-
return (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0438", ...field(input?.name ?? ''), minDate: minDate, weekends: isDebit ? weekends : [] }));
|
|
6257
|
+
return (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0438", ...field(input?.name ?? ''), ...input, minDate: minDate, weekends: isDebit ? weekends : [] }));
|
|
6258
6258
|
});
|
|
6259
6259
|
|
|
6260
6260
|
const DeliveryTimeField = JSX(({ field, input }) => {
|
|
@@ -8175,6 +8175,7 @@
|
|
|
8175
8175
|
limitedBirthday: new Date(savedForm?.limitedBirthday || 0),
|
|
8176
8176
|
...(!esiaAuthSuccess && {
|
|
8177
8177
|
esiaAccountTypeCd: { key: '' },
|
|
8178
|
+
confirmationIncome: { key: '', text: '' },
|
|
8178
8179
|
}),
|
|
8179
8180
|
};
|
|
8180
8181
|
}
|
|
@@ -10833,8 +10834,6 @@
|
|
|
10833
10834
|
? {
|
|
10834
10835
|
courierDeliveryFlg: isCourierDelivery,
|
|
10835
10836
|
deliveryDate: dateToISO(deliveryDate.toString().replace(/(GMT)[+-]\d{4}/, 'GMT+0000')),
|
|
10836
|
-
//TODO временный хардкод для тестирования, не забыть удалить
|
|
10837
|
-
office: { id: '3' },
|
|
10838
10837
|
...deliveryTimeCd,
|
|
10839
10838
|
}
|
|
10840
10839
|
: {};
|
|
@@ -11113,6 +11112,7 @@
|
|
|
11113
11112
|
name: 'methodObtain',
|
|
11114
11113
|
values: ['courier'],
|
|
11115
11114
|
},
|
|
11115
|
+
maxLength: 300,
|
|
11116
11116
|
},
|
|
11117
11117
|
],
|
|
11118
11118
|
},
|
|
@@ -14080,40 +14080,48 @@
|
|
|
14080
14080
|
return (jsx(BlockWrapper, { version: "transparent", className: style(className), defaultPadding: "p-0", ...rest, children: dataType === 'offices' ? jsx(OfficesMap, {}) : jsx(AtmsMap, { descriptionData: data }) }));
|
|
14081
14081
|
});
|
|
14082
14082
|
|
|
14083
|
-
const
|
|
14084
|
-
const
|
|
14085
|
-
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
const
|
|
14083
|
+
const EMPTY_RATES = [];
|
|
14084
|
+
const RATES_URL = {
|
|
14085
|
+
natural: `${API_BASE_URI}/rates`,
|
|
14086
|
+
cards: `${API_BASE_URI}/ratescards`,
|
|
14087
|
+
//archive: `${API_BASE_URI}/historyrates`,
|
|
14088
|
+
};
|
|
14089
|
+
const RATES_KEY = {
|
|
14090
|
+
natural: 'rates',
|
|
14091
|
+
cards: 'ratescards',
|
|
14092
|
+
//archive: 'historyrates',
|
|
14093
|
+
};
|
|
14094
|
+
// TODO: для архива прокинуть date
|
|
14095
|
+
function useRates({ ratesType = 'natural', fetchArchive = true }) {
|
|
14096
|
+
//const url = ratesType === 'archive' ? getArchiveRatesURL(date) : RATES_URL[ratesType];
|
|
14097
|
+
const url = RATES_URL[ratesType];
|
|
14098
|
+
const rateKey = RATES_KEY[ratesType];
|
|
14097
14099
|
const ratesStore = useLocalStore();
|
|
14098
14100
|
// проверяем, надо ли обновлять значения ставок
|
|
14099
|
-
const shouldUpdate = getShouldUpdate(
|
|
14101
|
+
const shouldUpdate = getShouldUpdate(rateKey, ratesStore, fetchArchive);
|
|
14100
14102
|
// костыль, не отправлять запрос на бэк, если уже был запрос менее 15 мин назад
|
|
14101
14103
|
const { data } = useAsyncData(shouldUpdate ? url : '', fetchJSONUnsafe);
|
|
14102
14104
|
// если есть data и значение надо обновить, то обновляем локалсторадж
|
|
14103
14105
|
if (shouldUpdate && data) {
|
|
14104
14106
|
const nextUpdate = getTimeAfter15Minutes();
|
|
14105
|
-
ratesStore[rateKey] = { rate: data, nextUpdate };
|
|
14107
|
+
ratesStore[rateKey] = { rate: data ?? [], nextUpdate };
|
|
14106
14108
|
}
|
|
14107
14109
|
// берем данные из локалсторадж
|
|
14108
14110
|
const rates = ratesStore[rateKey]?.rate;
|
|
14111
|
+
const isLoad = Array.isArray(rates);
|
|
14109
14112
|
// возвращаем данные из локалсторадж или заглушку
|
|
14110
|
-
return
|
|
14113
|
+
return { ratesList: rates ?? EMPTY_RATES, isLoad };
|
|
14111
14114
|
}
|
|
14112
14115
|
// Отсчитываем 15 минут с текущего момента
|
|
14113
14116
|
const getTimeAfter15Minutes = () => Date.now() + 15 * 60 * 1000;
|
|
14114
|
-
const getShouldUpdate = (
|
|
14115
|
-
? !ratesStore?.
|
|
14116
|
-
: !ratesStore?.
|
|
14117
|
+
const getShouldUpdate = (rateKey, ratesStore, fetchArchive) => rateKey === 'archive'
|
|
14118
|
+
? (!ratesStore?.[rateKey] || ratesStore?.[rateKey].nextUpdate <= Date.now()) && fetchArchive
|
|
14119
|
+
: !ratesStore?.[rateKey] || ratesStore?.[rateKey].nextUpdate <= Date.now();
|
|
14120
|
+
/*const getArchiveRatesURL = (date?: Date) => {
|
|
14121
|
+
const formattedDate = date && formatDate(date, true);
|
|
14122
|
+
|
|
14123
|
+
return formattedDate ? `${RATES_URL['archive']}?date=${formattedDate}` : RATES_URL['archive'];
|
|
14124
|
+
};*/
|
|
14117
14125
|
|
|
14118
14126
|
const useCarouselControls = (props, initialIndex = 0) => {
|
|
14119
14127
|
const { itemCount, visibleItemCount } = props;
|
|
@@ -14223,15 +14231,29 @@
|
|
|
14223
14231
|
return (jsxs("div", { className: "space-y-xl mb-3xl", children: [maxDate && renderDate({ dateString: maxDate, isArchive }), jsxs("div", { className: style(RATES_COLUMN_STYLE), children: [jsx(Text, { font: "font-medium", children: "\u0412\u0430\u043B\u044E\u0442\u0430" }), jsx(Text, { font: "font-medium", children: "\u041F\u043E\u043A\u0443\u043F\u043A\u0430" }), jsx(Text, { font: "font-medium", children: "\u041F\u0440\u043E\u0434\u0430\u0436\u0430" })] }), list.length > 0 ? (list.map((rate, i) => jsx(Rate, { ...rate }, String(i)))) : (jsx(Paragraph, { children: "\u041E\u0448\u0438\u0431\u043A\u0430 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u0434\u0430\u043D\u043D\u044B\u0445" })), jsx(Paragraph, { color: "text-secondary-text", children: infoMessage })] }));
|
|
14224
14232
|
});
|
|
14225
14233
|
|
|
14226
|
-
const renderDataPickForm = () => (jsxs("div", { className: "flex justify-start items-end space-x-xl", children: [jsx(DatePicker, { label: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0435\u043D\u044C", maxDate: new Date() }), jsx(SubmitButton$1, { className: "h-fit", children: "\u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C" })] }));
|
|
14227
|
-
|
|
14228
14234
|
const renderLink = (href) => (jsxs(Paragraph, { children: ["\u041F\u043E\u043B\u043D\u044B\u0439 \u0430\u0440\u0445\u0438\u0432 \u0432\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u043F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C ", jsx(Link, { href: href, children: "\u0437\u0434\u0435\u0441\u044C" })] }));
|
|
14229
14235
|
|
|
14230
|
-
const RatesTable = JSX(({ href, className = '', infoMessage,
|
|
14231
|
-
const
|
|
14232
|
-
const
|
|
14233
|
-
|
|
14236
|
+
const RatesTable = JSX(({ href, ratesType = 'natural', className = '', infoMessage, notFoundMessage, title, ...rest }) => {
|
|
14237
|
+
// const [date, setDate] = useState<Date>();
|
|
14238
|
+
const [fetchArchive, setFetchArchive] = useState(true);
|
|
14239
|
+
//const isArchive = ratesType === 'archive';
|
|
14240
|
+
const { ratesList, isLoad } = useRates({
|
|
14241
|
+
ratesType,
|
|
14242
|
+
fetchArchive,
|
|
14243
|
+
});
|
|
14244
|
+
useEffect(() => {
|
|
14245
|
+
setFetchArchive(false);
|
|
14246
|
+
}, []);
|
|
14247
|
+
const isRatesValid = ratesList?.length > 0;
|
|
14248
|
+
return (jsxs(BlockWrapper, { className: style('p-6xl space-y-xl', className), defaultPadding: "p-0", ...rest, children: [jsx(Heading, { className: "mb-xl", children: title }), isLoad ? (renderRatesContent({
|
|
14249
|
+
ratesList,
|
|
14250
|
+
isArchive: false,
|
|
14251
|
+
infoMessage,
|
|
14252
|
+
isRatesValid,
|
|
14253
|
+
notFoundMessage,
|
|
14254
|
+
})) : (jsx(Loader, { position: "static" })), href ? renderLink(href) : null] }));
|
|
14234
14255
|
});
|
|
14256
|
+
const renderRatesContent = ({ ratesList = [], isArchive = false, infoMessage, isRatesValid, notFoundMessage, }) => ratesList.length > 0 ? (ratesList.map((list, i) => (jsx(RatesTableItem, { list: list, isRatesValid: isRatesValid, isArchive: isArchive, infoMessage: infoMessage }, String(i))))) : (jsx(NotFound, { description: notFoundMessage }));
|
|
14235
14257
|
|
|
14236
14258
|
const inputs = [
|
|
14237
14259
|
{
|
|
@@ -14823,7 +14845,7 @@
|
|
|
14823
14845
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
14824
14846
|
});
|
|
14825
14847
|
|
|
14826
|
-
const packageVersion = "0.14.
|
|
14848
|
+
const packageVersion = "0.14.1064";
|
|
14827
14849
|
|
|
14828
14850
|
exports.Blocks = Blocks;
|
|
14829
14851
|
exports.ContentPage = ContentPage;
|