@redneckz/wildless-cms-uni-blocks 0.14.982 → 0.14.984

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.
Files changed (84) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +21 -18
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/RichTextBlock/RichTextBlock.d.ts +5 -1
  5. package/bundle/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
  6. package/bundle/utils/getFormatDynamicText.d.ts +2 -0
  7. package/bundle/utils/getQueryParamValue.d.ts +1 -0
  8. package/dist/components/ProductBlock/ProductBlock.js +2 -13
  9. package/dist/components/ProductBlock/ProductBlock.js.map +1 -1
  10. package/dist/components/RichTextBlock/RichTextBlock.d.ts +5 -1
  11. package/dist/components/RichTextBlock/RichTextBlock.js +6 -4
  12. package/dist/components/RichTextBlock/RichTextBlock.js.map +1 -1
  13. package/dist/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
  14. package/dist/retail/components/Fields/RegionRetailField.js +2 -2
  15. package/dist/retail/components/Fields/RegionRetailField.js.map +1 -1
  16. package/dist/utils/getFormatDynamicText.d.ts +2 -0
  17. package/dist/utils/getFormatDynamicText.js +13 -0
  18. package/dist/utils/getFormatDynamicText.js.map +1 -0
  19. package/dist/utils/getQueryParamValue.d.ts +1 -0
  20. package/dist/utils/getQueryParamValue.js +8 -0
  21. package/dist/utils/getQueryParamValue.js.map +1 -0
  22. package/lib/components/ProductBlock/ProductBlock.js +2 -13
  23. package/lib/components/ProductBlock/ProductBlock.js.map +1 -1
  24. package/lib/components/RichTextBlock/RichTextBlock.d.ts +5 -1
  25. package/lib/components/RichTextBlock/RichTextBlock.fixture.d.ts +1 -0
  26. package/lib/components/RichTextBlock/RichTextBlock.js +6 -4
  27. package/lib/components/RichTextBlock/RichTextBlock.js.map +1 -1
  28. package/lib/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
  29. package/lib/retail/components/Fields/RegionRetailField.js +2 -2
  30. package/lib/retail/components/Fields/RegionRetailField.js.map +1 -1
  31. package/lib/utils/getFormatDynamicText.d.ts +2 -0
  32. package/lib/utils/getFormatDynamicText.js +10 -0
  33. package/lib/utils/getFormatDynamicText.js.map +1 -0
  34. package/lib/utils/getQueryParamValue.d.ts +1 -0
  35. package/lib/utils/getQueryParamValue.js +5 -0
  36. package/lib/utils/getQueryParamValue.js.map +1 -0
  37. package/mobile/bundle/bundle.umd.js +21 -18
  38. package/mobile/bundle/bundle.umd.min.js +1 -1
  39. package/mobile/bundle/components/RichTextBlock/RichTextBlock.d.ts +5 -1
  40. package/mobile/bundle/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
  41. package/mobile/bundle/utils/getFormatDynamicText.d.ts +2 -0
  42. package/mobile/bundle/utils/getQueryParamValue.d.ts +1 -0
  43. package/mobile/dist/components/ProductBlock/ProductBlock.js +2 -13
  44. package/mobile/dist/components/ProductBlock/ProductBlock.js.map +1 -1
  45. package/mobile/dist/components/RichTextBlock/RichTextBlock.d.ts +5 -1
  46. package/mobile/dist/components/RichTextBlock/RichTextBlock.js +6 -4
  47. package/mobile/dist/components/RichTextBlock/RichTextBlock.js.map +1 -1
  48. package/mobile/dist/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
  49. package/mobile/dist/retail/components/Fields/RegionRetailField.js +2 -2
  50. package/mobile/dist/retail/components/Fields/RegionRetailField.js.map +1 -1
  51. package/mobile/dist/utils/getFormatDynamicText.d.ts +2 -0
  52. package/mobile/dist/utils/getFormatDynamicText.js +13 -0
  53. package/mobile/dist/utils/getFormatDynamicText.js.map +1 -0
  54. package/mobile/dist/utils/getQueryParamValue.d.ts +1 -0
  55. package/mobile/dist/utils/getQueryParamValue.js +8 -0
  56. package/mobile/dist/utils/getQueryParamValue.js.map +1 -0
  57. package/mobile/lib/components/ProductBlock/ProductBlock.js +2 -13
  58. package/mobile/lib/components/ProductBlock/ProductBlock.js.map +1 -1
  59. package/mobile/lib/components/RichTextBlock/RichTextBlock.d.ts +5 -1
  60. package/mobile/lib/components/RichTextBlock/RichTextBlock.js +6 -4
  61. package/mobile/lib/components/RichTextBlock/RichTextBlock.js.map +1 -1
  62. package/mobile/lib/components/RichTextBlock/RichTextBlockContent.d.ts +2 -1
  63. package/mobile/lib/retail/components/Fields/RegionRetailField.js +2 -2
  64. package/mobile/lib/retail/components/Fields/RegionRetailField.js.map +1 -1
  65. package/mobile/lib/utils/getFormatDynamicText.d.ts +2 -0
  66. package/mobile/lib/utils/getFormatDynamicText.js +10 -0
  67. package/mobile/lib/utils/getFormatDynamicText.js.map +1 -0
  68. package/mobile/lib/utils/getQueryParamValue.d.ts +1 -0
  69. package/mobile/lib/utils/getQueryParamValue.js +5 -0
  70. package/mobile/lib/utils/getQueryParamValue.js.map +1 -0
  71. package/mobile/src/components/ProductBlock/ProductBlock.tsx +2 -24
  72. package/mobile/src/components/RichTextBlock/RichTextBlock.tsx +19 -5
  73. package/mobile/src/components/RichTextBlock/RichTextBlockContent.ts +2 -1
  74. package/mobile/src/retail/components/Fields/RegionRetailField.tsx +2 -4
  75. package/mobile/src/utils/getFormatDynamicText.ts +18 -0
  76. package/mobile/src/utils/getQueryParamValue.ts +5 -0
  77. package/package.json +1 -1
  78. package/src/components/ProductBlock/ProductBlock.tsx +2 -24
  79. package/src/components/RichTextBlock/RichTextBlock.fixture.tsx +18 -1
  80. package/src/components/RichTextBlock/RichTextBlock.tsx +19 -5
  81. package/src/components/RichTextBlock/RichTextBlockContent.ts +2 -1
  82. package/src/retail/components/Fields/RegionRetailField.tsx +2 -4
  83. package/src/utils/getFormatDynamicText.ts +18 -0
  84. package/src/utils/getQueryParamValue.ts +5 -0
@@ -977,6 +977,11 @@
977
977
  return OutputComponent;
978
978
  }
979
979
 
980
+ const getQueryParamValue = (queryParam, queryString) => {
981
+ const params = new URLSearchParams(queryString);
982
+ return params.get(queryParam);
983
+ };
984
+
980
985
  const QUERY_STORAGE_KEY = 'rshb-query-params';
981
986
  function saveSessionQuery() {
982
987
  const result = globalThis.location?.search || globalThis.sessionStorage?.getItem(QUERY_STORAGE_KEY) || '';
@@ -986,26 +991,23 @@
986
991
  return result;
987
992
  }
988
993
 
994
+ const getFormatDynamicText = (dynamicQueryParamText = {}, valuesList = [], text = '') => {
995
+ const { queryParam, value } = dynamicQueryParamText;
996
+ const sessionQuery = saveSessionQuery();
997
+ const utmValue = getQueryParamValue(queryParam ?? 'utm_source', sessionQuery);
998
+ const dynamicValue = valuesList.find((item) => item?.id?.toLowerCase() === utmValue?.toLowerCase())?.value;
999
+ return dynamicValue ? text?.replace(String(value), dynamicValue) : text;
1000
+ };
1001
+
989
1002
  const ProductBlock = UniBlock(({ className, padding, defaultPadding, dynamicQueryParamText = {}, dynamicTextSource, description, title, ...rest }) => {
990
1003
  const { textType } = dynamicQueryParamText;
991
- const formatText = getFormatDescription(dynamicQueryParamText, dynamicTextSource?.list, textType === 'title' ? title : description);
1004
+ const formatText = getFormatDynamicText(dynamicQueryParamText, dynamicTextSource?.list, textType === 'title' ? title : description);
992
1005
  const textProps = {
993
1006
  title: textType === 'title' ? formatText : title,
994
1007
  description: textType === 'description' ? formatText : description,
995
1008
  };
996
1009
  return (jsx(BlockWrapper, { className: style('overflow-hidden flex flex-col gap-3xl box-border', className), padding: "p-0", ...rest, children: jsx(BaseProductTile, { defaultPadding: defaultPadding || 'p-6xl', padding: padding, className: "grow h-full", ...textProps, ...rest }) }));
997
1010
  });
998
- const getFormatDescription = (dynamicQueryParamText = {}, valuesList = [], text = '') => {
999
- const { queryParam, value } = dynamicQueryParamText;
1000
- const sessionQuery = saveSessionQuery();
1001
- const utmValue = getQueryParamValue(queryParam ?? 'utm_source', sessionQuery);
1002
- const dynamicValue = valuesList.find((item) => item?.id?.toLowerCase() === utmValue?.toLowerCase())?.value;
1003
- return dynamicValue ? text?.replace(String(value), dynamicValue) : text;
1004
- };
1005
- const getQueryParamValue = (queryParam, queryString) => {
1006
- const params = new URLSearchParams(queryString);
1007
- return params.get(queryParam);
1008
- };
1009
1011
 
1010
1012
  const AdTile = JSX((props) => {
1011
1013
  const { items } = (props.options?.page?.adSourceBook ?? {});
@@ -5792,12 +5794,12 @@
5792
5794
  handleChangeRegionHasDelivery?.(checkRegionDeliveryStatus(DEFAULT_BIBLIOLOBUS_VALUES.region));
5793
5795
  handleChangeMethodObtain?.('office');
5794
5796
  }
5795
- if (isSalaryCard) {
5797
+ else if (isSalaryCard) {
5796
5798
  handleChangeRegion?.(DEFAULT_SALARY_CARD_VALUES.region);
5797
5799
  handleChangeOffice?.(DEFAULT_SALARY_CARD_VALUES.office);
5798
5800
  handleChangeMethodObtain?.('office');
5799
5801
  }
5800
- if (regionRetail) {
5802
+ else if (regionRetail) {
5801
5803
  const regionHasDelivery = checkRegionDeliveryStatus(regionRetail);
5802
5804
  handleChangeRegionHasDelivery?.(regionHasDelivery);
5803
5805
  handleChangeMethodObtain?.(regionHasDelivery ? 'courier' : 'office');
@@ -12524,9 +12526,10 @@
12524
12526
  return (jsx(BlockWrapper, { version: "transparent", className: style(className), defaultPadding: "p-0", ...rest, children: dataType === 'offices' ? jsx(OfficesMap, {}) : jsx(AtmsMap, { descriptionData: data }) }));
12525
12527
  });
12526
12528
 
12527
- const RichTextBlock = JSX((props) => {
12528
- const { __html, richVersion = '', ...rest } = props;
12529
- return (jsx(BlockWrapper, { defaultPadding: "p-0", ...rest, children: jsx(RichText, { __html: __html, richVersion: richVersion }) }));
12529
+ const RichTextBlock = UniBlock((props) => {
12530
+ const { __html, dynamicQueryParamText = {}, dynamicTextSource, richVersion = '', ...rest } = props;
12531
+ const formatText = getFormatDynamicText(dynamicQueryParamText, dynamicTextSource?.list, __html);
12532
+ return (jsx(BlockWrapper, { defaultPadding: "p-0", ...rest, children: jsx(RichText, { __html: formatText, richVersion: richVersion }) }));
12530
12533
  });
12531
12534
 
12532
12535
  const getFoldableStyles = (isMobile = false) => isMobile ? 'flex flex-wrap group-last:last:pb-0' : 'grid grid-cols-12 [&>*]:pb-m';
@@ -13137,7 +13140,7 @@
13137
13140
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
13138
13141
  });
13139
13142
 
13140
- const packageVersion = "0.14.981";
13143
+ const packageVersion = "0.14.983";
13141
13144
 
13142
13145
  exports.Blocks = Blocks;
13143
13146
  exports.ContentPage = ContentPage;