@gaddario98/react-core 2.1.3 → 2.1.5

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.
@@ -313,7 +313,7 @@ const PageContentItemInner = ({
313
313
  pageId
314
314
  });
315
315
  const isHidden = useMemo(() => {
316
- if (typeof item.hidden === 'function') {
316
+ if (typeof item.hidden === "function") {
317
317
  return item.hidden({
318
318
  get,
319
319
  set
@@ -326,12 +326,12 @@ const PageContentItemInner = ({
326
326
  content: item,
327
327
  ns: ns,
328
328
  pageId: pageId
329
- }, (_a = item.key) !== null && _a !== void 0 ? _a : '');
329
+ }, (_a = item.key) !== null && _a !== void 0 ? _a : "");
330
330
  };
331
331
  const PageContentItem = memo(PageContentItemInner);
332
332
  const useGenerateContentRender = ({
333
333
  pageId,
334
- ns = '',
334
+ ns = "",
335
335
  contents = [],
336
336
  formData
337
337
  }) => {
@@ -342,7 +342,7 @@ const useGenerateContentRender = ({
342
342
  pageId
343
343
  });
344
344
  const contentsWithQueriesDeps = useMemo(() => {
345
- if (typeof contents === 'function') {
345
+ if (typeof contents === "function") {
346
346
  return contents({
347
347
  get,
348
348
  set
@@ -374,7 +374,10 @@ const useGenerateContentRender = ({
374
374
  };
375
375
  }), [contentsWithQueriesDeps, ns, pageId]);
376
376
  // Merge and sort - only when either array changes
377
- const memorizedContents = useMemo(() => [...dynamicElements, ...formElementsWithKey].sort((a, b) => a.index - b.index || String(a.key).localeCompare(String(b.key))), [dynamicElements, formElementsWithKey]);
377
+ const memorizedContents = useMemo(() => {
378
+ var _a_0, _b;
379
+ return (_b = (_a_0 = [...dynamicElements, ...formElementsWithKey].sort((a, b) => a.index - b.index || String(a.key).localeCompare(String(b.key)))) === null || _a_0 === void 0 ? void 0 : _a_0.filter(item => item.element !== null)) !== null && _b !== void 0 ? _b : [];
380
+ }, [dynamicElements, formElementsWithKey]);
378
381
  return {
379
382
  components: memorizedContents,
380
383
  allContents: [...contentsWithQueriesDeps, ...formData.formContents]
@@ -422,7 +425,7 @@ const useGenerateContentRender = ({
422
425
  } = useGenerateContentRender(t4);
423
426
  let t5;
424
427
  if ($[7] !== components) {
425
- t5 = components.filter(_temp$1).map(_temp2$1);
428
+ t5 = components.filter(_temp$2).map(_temp2$2);
426
429
  $[7] = components;
427
430
  $[8] = t5;
428
431
  } else {
@@ -465,10 +468,10 @@ const useGenerateContentRender = ({
465
468
  }
466
469
  return t8;
467
470
  };
468
- function _temp$1(el) {
471
+ function _temp$2(el) {
469
472
  return !el.renderInFooter && !el.renderInHeader;
470
473
  }
471
- function _temp2$1(item) {
474
+ function _temp2$2(item) {
472
475
  return item.element;
473
476
  }
474
477
  function _temp3(el_0) {
@@ -1445,7 +1448,7 @@ function useFormData({
1445
1448
  const hiddenMapped = useCallback(() => {
1446
1449
  const isHidden = form === null || form === void 0 ? void 0 : form.hidden;
1447
1450
  if (!isHidden) return false;
1448
- if (typeof isHidden === 'function') {
1451
+ if (typeof isHidden === "function") {
1449
1452
  return isHidden({
1450
1453
  get,
1451
1454
  set
@@ -1457,16 +1460,14 @@ function useFormData({
1457
1460
  const mappedFormData = useMemo(() => {
1458
1461
  if (!(form === null || form === void 0 ? void 0 : form.data) || hiddenMapped()) return [];
1459
1462
  return form.data.map(el => {
1460
- if (typeof el === 'function') {
1463
+ if (typeof el === "function") {
1461
1464
  return el({
1462
1465
  get,
1463
1466
  set
1464
1467
  });
1465
1468
  }
1466
1469
  return el;
1467
- })
1468
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1469
- .filter(el_0 => !!el_0).map((el_1, i) => {
1470
+ }).filter(el_0 => !!el_0).map((el_1, i) => {
1470
1471
  var _a;
1471
1472
  return Object.assign(Object.assign({}, el_1), {
1472
1473
  key: (_a = el_1.key) !== null && _a !== void 0 ? _a : `${i}`
@@ -1476,7 +1477,7 @@ function useFormData({
1476
1477
  const formSubmit = useMemo(() => {
1477
1478
  if (!(form === null || form === void 0 ? void 0 : form.submit) || hiddenMapped()) return [];
1478
1479
  const submitFn = form.submit;
1479
- return (typeof submitFn === 'function' ? submitFn({
1480
+ return (typeof submitFn === "function" ? submitFn({
1480
1481
  get,
1481
1482
  set
1482
1483
  }) : submitFn).map((el_2, i_0) => {
@@ -1520,8 +1521,8 @@ function useFormData({
1520
1521
  return () => unsubscribe();
1521
1522
  }, [form === null || form === void 0 ? void 0 : form.defaultValueQueryKey, form === null || form === void 0 ? void 0 : form.defaultValues, queryClient]);
1522
1523
  const defaultValues = useMemo(() => {
1523
- var _a, _b;
1524
- return Object.assign(Object.assign({}, defaultValueQuery !== null && defaultValueQuery !== void 0 ? defaultValueQuery : {}), (_b = (_a = form === null || form === void 0 ? void 0 : form.defaultValueQueryMap) === null || _a === void 0 ? void 0 : _a.call(form, defaultValueQuery)) !== null && _b !== void 0 ? _b : {});
1524
+ var _a, _b, _c;
1525
+ return Object.assign({}, (_c = (_b = (_a = form === null || form === void 0 ? void 0 : form.defaultValueQueryMap) === null || _a === void 0 ? void 0 : _a.call(form, defaultValueQuery)) !== null && _b !== void 0 ? _b : defaultValueQuery) !== null && _c !== void 0 ? _c : {});
1525
1526
  }, [defaultValueQuery, form]);
1526
1527
  const {
1527
1528
  mappedFormData,
@@ -1845,6 +1846,27 @@ function useApplyMetadata() {
1845
1846
  t0 = $[1];
1846
1847
  }
1847
1848
  return t0;
1849
+ }const usePageUtiles = () => {
1850
+ const $ = c(1);
1851
+ const getContentProps = _temp$1;
1852
+ const getContentItems = _temp2$1;
1853
+ let t0;
1854
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1855
+ t0 = {
1856
+ getContentProps,
1857
+ getContentItems
1858
+ };
1859
+ $[0] = t0;
1860
+ } else {
1861
+ t0 = $[0];
1862
+ }
1863
+ return t0;
1864
+ };
1865
+ function _temp$1(props) {
1866
+ return props;
1867
+ }
1868
+ function _temp2$1(props_0) {
1869
+ return props_0;
1848
1870
  }/**
1849
1871
  * Headless component that manages metadata injection.
1850
1872
  * On web: injects metadata into `<head>`.
@@ -1908,20 +1930,20 @@ const MetadataManager = MetadataManagerImpl;const PageGenerator = _a => {
1908
1930
  } = usePageConfigValue();
1909
1931
  const isUnlogged = useMemo(() => enableAuthControl && !isLogged(authValues ? authValues : null), [enableAuthControl, authValues, isLogged]);
1910
1932
  const selectedProps = useMemo(() => {
1911
- return enableAuthControl && isUnlogged ? authPageProps : props;
1912
- }, [enableAuthControl, isUnlogged, authPageProps, props]);
1933
+ return isUnlogged ? authPageProps : props;
1934
+ }, [isUnlogged, authPageProps, props]);
1913
1935
  const {
1914
1936
  contents = [],
1915
1937
  queries = [],
1916
1938
  form,
1917
- id = 'default-page-id',
1939
+ id = "default-page-id",
1918
1940
  viewSettings,
1919
1941
  ns
1920
1942
  } = useMemo(() => selectedProps, [selectedProps]);
1921
1943
  const config = usePageConfig({
1922
1944
  queries,
1923
1945
  form,
1924
- ns: ns !== null && ns !== void 0 ? ns : '',
1946
+ ns: ns !== null && ns !== void 0 ? ns : "",
1925
1947
  viewSettings,
1926
1948
  pageId: id,
1927
1949
  variables
@@ -2923,4 +2945,4 @@ function pageToMarkdown(options) {
2923
2945
  lines.push('');
2924
2946
  lines.push(options.content);
2925
2947
  return lines.join('\n');
2926
- }export{MemoizationCache,MetadataStoreProvider,PageGenerator,RenderComponents,applyMetadataToDom,buildArticleJsonLd,buildBreadcrumbListJsonLd,buildFAQPageJsonLd,buildOrganizationJsonLd,buildProductJsonLd,buildWebSiteJsonLd,clearMetadataLog,collectMetadataToHtml,createMetadataStore,createScopePageVariablesAtom,deepEqual,generateLlmsFullTxt,generateLlmsTxt,generateRobotsTxt,generateSitemapEntries,generateSitemapXml,getMetadata,getMetadataLog,getPageConfig,getPageVariablesCompositeKey,isStableValue,logMetadata,memoPropsComparator,memoize,optimizeDeps,pageConfigAtom,pageToMarkdown,pageVariablesAtom,pageVariablesAtomFamily,resetMetadata,resolveMetadata,setMetadata,setMetadataLogging,shallowEqual,toNextHeadTags,toNextMetadata,useApplyMetadata,useFormData,useGenerateContent,useGenerateContentRender,useMetadata,useMetadataStore,usePageConfig,usePageConfigReset,usePageConfigState,usePageConfigValue,useViewSettings};//# sourceMappingURL=index.mjs.map
2948
+ }export{MemoizationCache,MetadataStoreProvider,PageGenerator,RenderComponents,applyMetadataToDom,buildArticleJsonLd,buildBreadcrumbListJsonLd,buildFAQPageJsonLd,buildOrganizationJsonLd,buildProductJsonLd,buildWebSiteJsonLd,clearMetadataLog,collectMetadataToHtml,createMetadataStore,createScopePageVariablesAtom,deepEqual,generateLlmsFullTxt,generateLlmsTxt,generateRobotsTxt,generateSitemapEntries,generateSitemapXml,getMetadata,getMetadataLog,getPageConfig,getPageVariablesCompositeKey,isStableValue,logMetadata,memoPropsComparator,memoize,optimizeDeps,pageConfigAtom,pageToMarkdown,pageVariablesAtom,pageVariablesAtomFamily,resetMetadata,resolveMetadata,setMetadata,setMetadataLogging,shallowEqual,toNextHeadTags,toNextMetadata,useApplyMetadata,useFormData,useGenerateContent,useGenerateContentRender,useMetadata,useMetadataStore,usePageConfig,usePageConfigReset,usePageConfigState,usePageConfigValue,usePageUtiles,useViewSettings};//# sourceMappingURL=index.mjs.map