@gaddario98/react-core 2.0.4 → 2.0.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.
- package/dist/auth/index.d.ts +13 -3
- package/dist/index.d.ts +28 -8
- package/dist/index.js +133 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +133 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -20718,4 +20718,136 @@ function createExtractor(allData, cache, usedKeys) {
|
|
|
20718
20718
|
*/
|
|
20719
20719
|
function withMemo(Component, propsAreEqual) {
|
|
20720
20720
|
return memo(Component, propsAreEqual);
|
|
20721
|
-
}
|
|
20721
|
+
}const {
|
|
20722
|
+
useState: useNotificationState
|
|
20723
|
+
} = atomStateGenerator$1({
|
|
20724
|
+
defaultValue: null,
|
|
20725
|
+
key: 'reactNotificationAtom',
|
|
20726
|
+
persist: false
|
|
20727
|
+
});const useNotificationSet = () => {
|
|
20728
|
+
const [, setValue] = useNotificationState();
|
|
20729
|
+
return setValue;
|
|
20730
|
+
};
|
|
20731
|
+
const useNotification = t0 => {
|
|
20732
|
+
const $ = c(10);
|
|
20733
|
+
const ns = "notifications" ;
|
|
20734
|
+
const setNotification = useNotificationSet();
|
|
20735
|
+
let t1;
|
|
20736
|
+
if ($[0] !== ns || $[1] !== setNotification) {
|
|
20737
|
+
t1 = {
|
|
20738
|
+
setNotification,
|
|
20739
|
+
ns
|
|
20740
|
+
};
|
|
20741
|
+
$[0] = ns;
|
|
20742
|
+
$[1] = setNotification;
|
|
20743
|
+
$[2] = t1;
|
|
20744
|
+
} else {
|
|
20745
|
+
t1 = $[2];
|
|
20746
|
+
}
|
|
20747
|
+
const ref = useRef(t1);
|
|
20748
|
+
let t2;
|
|
20749
|
+
let t3;
|
|
20750
|
+
if ($[3] !== ns || $[4] !== setNotification) {
|
|
20751
|
+
t2 = () => {
|
|
20752
|
+
ref.current = {
|
|
20753
|
+
setNotification,
|
|
20754
|
+
ns
|
|
20755
|
+
};
|
|
20756
|
+
};
|
|
20757
|
+
t3 = [setNotification, ns];
|
|
20758
|
+
$[3] = ns;
|
|
20759
|
+
$[4] = setNotification;
|
|
20760
|
+
$[5] = t2;
|
|
20761
|
+
$[6] = t3;
|
|
20762
|
+
} else {
|
|
20763
|
+
t2 = $[5];
|
|
20764
|
+
t3 = $[6];
|
|
20765
|
+
}
|
|
20766
|
+
useEffect(t2, t3);
|
|
20767
|
+
let t4;
|
|
20768
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
20769
|
+
t4 = notification => {
|
|
20770
|
+
ref.current.setNotification(Object.assign(Object.assign({
|
|
20771
|
+
ns: ref.current.ns
|
|
20772
|
+
}, notification), {
|
|
20773
|
+
id: Date.now().toString()
|
|
20774
|
+
}));
|
|
20775
|
+
};
|
|
20776
|
+
$[7] = t4;
|
|
20777
|
+
} else {
|
|
20778
|
+
t4 = $[7];
|
|
20779
|
+
}
|
|
20780
|
+
const showNotification = t4;
|
|
20781
|
+
let t5;
|
|
20782
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
20783
|
+
t5 = () => {
|
|
20784
|
+
ref.current.setNotification(null);
|
|
20785
|
+
};
|
|
20786
|
+
$[8] = t5;
|
|
20787
|
+
} else {
|
|
20788
|
+
t5 = $[8];
|
|
20789
|
+
}
|
|
20790
|
+
const clearNotification = t5;
|
|
20791
|
+
let t6;
|
|
20792
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
20793
|
+
t6 = {
|
|
20794
|
+
showNotification,
|
|
20795
|
+
clearNotification
|
|
20796
|
+
};
|
|
20797
|
+
$[9] = t6;
|
|
20798
|
+
} else {
|
|
20799
|
+
t6 = $[9];
|
|
20800
|
+
}
|
|
20801
|
+
return t6;
|
|
20802
|
+
};/**
|
|
20803
|
+
* Hook per accedere a tutte le configurazioni dei plugin di core
|
|
20804
|
+
* Fornisce un'interfaccia centralizzata per le impostazioni dell'applicazione
|
|
20805
|
+
*/
|
|
20806
|
+
const isLogged = authState => !!(authState === null || authState === void 0 ? void 0 : authState.id) && !!authState.isLogged;
|
|
20807
|
+
const useCoreConfig = ({
|
|
20808
|
+
form,
|
|
20809
|
+
localization,
|
|
20810
|
+
pages,
|
|
20811
|
+
apiConfig
|
|
20812
|
+
}) => {
|
|
20813
|
+
const auth = useAuthValue();
|
|
20814
|
+
const {
|
|
20815
|
+
t: translateText
|
|
20816
|
+
} = useTranslation();
|
|
20817
|
+
const {
|
|
20818
|
+
showNotification
|
|
20819
|
+
} = useNotification();
|
|
20820
|
+
const [currentFormConfig, setFormConfig] = useFormConfigState();
|
|
20821
|
+
const [currentLocalizationConfig, setLocalizationConfig] = useLocalizationConfigState();
|
|
20822
|
+
const [currentPageConfig, setPageConfig] = usePageConfigState();
|
|
20823
|
+
const [currentApiConfig, setApiConfig] = useApiConfigState();
|
|
20824
|
+
useEffect(() => {
|
|
20825
|
+
setFormConfig(Object.assign(Object.assign({
|
|
20826
|
+
translateText,
|
|
20827
|
+
showNotification
|
|
20828
|
+
}, currentFormConfig), form));
|
|
20829
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20830
|
+
}, [translateText, showNotification, form]);
|
|
20831
|
+
useEffect(() => {
|
|
20832
|
+
setLocalizationConfig(Object.assign(Object.assign({}, currentLocalizationConfig), localization));
|
|
20833
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20834
|
+
}, [JSON.stringify(localization)]);
|
|
20835
|
+
useEffect(() => {
|
|
20836
|
+
setPageConfig(Object.assign(Object.assign(Object.assign({
|
|
20837
|
+
authValues: auth
|
|
20838
|
+
}, currentPageConfig), pages), {
|
|
20839
|
+
isLogged
|
|
20840
|
+
}));
|
|
20841
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20842
|
+
}, [pages, JSON.stringify(auth)]);
|
|
20843
|
+
useEffect(() => {
|
|
20844
|
+
setApiConfig(Object.assign(Object.assign({
|
|
20845
|
+
defaultHeaders: {
|
|
20846
|
+
Authorization: (auth === null || auth === void 0 ? void 0 : auth.token) ? `Bearer ${auth.token}` : ""
|
|
20847
|
+
},
|
|
20848
|
+
showNotification,
|
|
20849
|
+
validateAuthFn: () => !!(auth === null || auth === void 0 ? void 0 : auth.isLogged)
|
|
20850
|
+
}, currentApiConfig), apiConfig));
|
|
20851
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
20852
|
+
}, [apiConfig, showNotification, JSON.stringify(auth)]);
|
|
20853
|
+
};export{AppProviders,DEFAULT_FORM_ENTRY,DEFAULT_MUTATION_ENTRY,DEFAULT_QUERY_ENTRY,DefaultContainer,DefaultFormContainer,FormField,FormManager,MemoizationCache,MetadataStoreProvider,PageGenerator,QueriesProvider,RenderComponents,ab2str,algorithm,apiConfigAtom,apiRequest,applyMetadataToDom,atomStateGenerator,authAtom,buildArticleJsonLd,buildBreadcrumbListJsonLd,buildFAQPageJsonLd,buildOrganizationJsonLd,buildProductJsonLd,buildWebSiteJsonLd,clearMetadataLog,cn,collectMetadataToHtml,createExtractor,createFormSelector,createMetadataStore,createMutationSelector,createQuerySelector,createScopeFormsAtom,createScopeMutationsAtom,createScopePageVariablesAtom,createScopeQueriesAtom,createServerTranslator,decryptData,deepEqual,encryptData,fetchRequest,formAtom,formConfigAtom,generateLlmsFullTxt,generateLlmsTxt,generateRobotsTxt,generateSitemapEntries,generateSitemapXml,getCompositeKey,getFormCompositeKey,getMetadata,getMetadataLog,getPageConfig,getPageVariablesCompositeKey,importKey,isStableValue,localizationConfigAtom,logMetadata,memoPropsComparator,memoize,mutationsAtom,optimizeDeps,pageConfigAtom,pageToMarkdown,pageVariablesAtom,pageVariablesAtomFamily,queriesAtom,resetMetadata,resolveMetadata,resolveTranslation,setCustomStorage,setDefaultFormContainer,setMetadata,setMetadataLogging,shallowEqual,storage,str2ab,toNextHeadTags,toNextMetadata,useApi,useApiConfigReset,useApiConfigState,useApiConfigValue,useApiValues,useApplyMetadata,useAuthState,useAuthValue,useCoreConfig,useFormConfigReset,useFormConfigState,useFormConfigValue,useFormData,useFormManager,useFormState,useFormValue,useFormValues,useGenerateContent,useGenerateContentRender,useInvalidateQueries,useJotaiForm,useJotaiMutations,useJotaiQueries,useLocalizationActions,useLocalizationConfigReset,useLocalizationConfigState,useLocalizationConfigValue,useMetadata,useMetadataStore,useMultipleMutation,useMultipleQuery,useMultipleWebSocket,useMutateApi,usePageConfig,usePageConfigReset,usePageConfigState,usePageConfigValue,useQueryApi,useSetFormState,useTranslatedText,useTranslation,useViewSettings,useWebSocket,withMemo};//# sourceMappingURL=index.mjs.map
|