@nocios/crudify-components 2.0.61 → 2.0.88
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/README.md +21 -0
- package/dist/api-jcCTCqPD.d.mts +61 -0
- package/dist/api-jcCTCqPD.d.ts +61 -0
- package/dist/chunk-4I767MRM.mjs +142 -0
- package/dist/chunk-5V5ILPP3.js +1 -0
- package/dist/chunk-BJEDX2HU.js +142 -0
- package/dist/chunk-GZOB4JDB.js +1 -0
- package/dist/chunk-ODKXUEH5.js +1 -0
- package/dist/chunk-U335FNUD.mjs +1 -0
- package/dist/chunk-YRU7AXYV.mjs +1 -0
- package/dist/chunk-Z75DRSTN.mjs +1 -0
- package/dist/{errorTranslation-CF-5JClP.d.ts → errorTranslation-BdqG-dXD.d.ts} +97 -26
- package/dist/{errorTranslation-BcX8AaK7.d.mts → errorTranslation-BxJmBGx0.d.mts} +97 -26
- package/dist/hooks.d.mts +3 -4
- package/dist/hooks.d.ts +3 -4
- package/dist/hooks.js +1 -1
- package/dist/hooks.mjs +1 -1
- package/dist/{index-D06kTP0C.d.mts → index-Cx9P3ZCG.d.mts} +225 -139
- package/dist/{index-DEDnmsdO.d.ts → index-rHtWMls-.d.ts} +225 -139
- package/dist/index.d.mts +508 -213
- package/dist/index.d.ts +508 -213
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/public-policies.d.mts +7 -0
- package/dist/public-policies.d.ts +7 -0
- package/dist/public-policies.js +1 -0
- package/dist/public-policies.mjs +1 -0
- package/dist/utils.d.mts +94 -26
- package/dist/utils.d.ts +94 -26
- package/dist/utils.js +1 -1
- package/dist/utils.mjs +1 -1
- package/package.json +44 -42
- package/.github/workflows/ci.yml +0 -70
- package/.husky/pre-commit +0 -26
- package/.husky/pre-push +0 -30
- package/.nvmrc +0 -1
- package/.prettierignore +0 -18
- package/.prettierrc +0 -9
- package/README_DEPTH.md +0 -1237
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/coverage-final.json +0 -120
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -686
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -686
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov.info +0 -22388
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -210
- package/dist/CrudiaMarkdownField-CkiBwG-U.d.ts +0 -343
- package/dist/CrudiaMarkdownField-D-DqiXMQ.d.mts +0 -343
- package/dist/GlobalNotificationProvider-CdwdNv_8.d.mts +0 -96
- package/dist/GlobalNotificationProvider-CdwdNv_8.d.ts +0 -96
- package/dist/chunk-2WAUZ6KI.js +0 -1
- package/dist/chunk-3IGZNZCT.mjs +0 -1
- package/dist/chunk-43L2PP77.mjs +0 -1
- package/dist/chunk-6VS5OT3A.mjs +0 -1
- package/dist/chunk-BWJTTMKS.js +0 -1
- package/dist/chunk-EMPPCCVU.js +0 -1
- package/dist/chunk-J43UPGBE.js +0 -1
- package/dist/chunk-K6ZRXOJ7.mjs +0 -1
- package/dist/chunk-RYQQZTEP.js +0 -1
- package/dist/chunk-VTMSOK4V.mjs +0 -1
- package/dist/components.d.mts +0 -24
- package/dist/components.d.ts +0 -24
- package/dist/components.js +0 -1
- package/dist/components.mjs +0 -1
- package/dist/tenantConfig-CYnS9TPV.d.mts +0 -318
- package/dist/tenantConfig-CYnS9TPV.d.ts +0 -318
- package/eslint.config.mjs +0 -140
- package/scripts/bump-version.cjs +0 -23
- package/sonar-project.properties +0 -23
- package/tests/helpers/testUtils.tsx +0 -89
- package/tests/hooks/useSession/testUtils.tsx +0 -212
- package/tests/setup.ts +0 -139
- package/tests/vitest.d.ts +0 -1
- package/vitest.config.ts +0 -39
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var k=[/password[^:]*[:=]\s*[^\s,}]+/gi,/token[^:]*[:=]\s*[^\s,}]+/gi,/key[^:]*[:=]\s*["']?[^\s,}"']+/gi,/secret[^:]*[:=]\s*[^\s,}]+/gi,/authorization[^:]*[:=]\s*[^\s,}]+/gi,/mongodb(\+srv)?:\/\/[^\s]+/gi,/postgres:\/\/[^\s]+/gi,/mysql:\/\/[^\s]+/gi],F=e=>e==="prod"||e==="production"||e==="api",V=e=>e instanceof Error?{errorName:e.name,errorMessage:e.message,stack:e.stack}:e,ye=(...e)=>{if(e.length!==0){if(e.length===1&&e[0]instanceof Error){let r=e[0];return{errorName:r.name,errorMessage:r.message,stack:r.stack}}return e.length===1&&typeof e[0]=="object"&&e[0]!==null&&!(e[0]instanceof Error)?e[0]:e.length===1?{value:e[0]}:{args:e.map(r=>r instanceof Error?{errorName:r.name,errorMessage:r.message}:r)}}},O=class{explicitEnvironment=null;config;sanitizePatterns;constructor(e){this.config=e,this.sanitizePatterns=e.sanitizePatterns??k}setEnvironment(e){this.explicitEnvironment=e}clearEnvironment(){this.explicitEnvironment=null}getEnvironment(){return this.explicitEnvironment??this.config.getEnvironment()}isExplicitlyConfigured(){return this.explicitEnvironment!==null}sanitizeMessage(e){let r=e;for(let t of this.sanitizePatterns)r=r.replace(t,"[REDACTED]");return r}sanitizeValue(e,r){if(r!=null){if(e==="userId"&&typeof r=="string")return r.length>8?`${r.substring(0,8)}***`:r;if(e==="email"&&typeof r=="string"){let[t,n]=r.split("@");return t&&n?`${t.substring(0,3)}***@${n}`:"[REDACTED]"}return typeof r=="string"?this.sanitizeMessage(r):Array.isArray(r)?r.map(t=>this.sanitizeValue(e,t)):typeof r=="object"?this.sanitizeContext(r):r}}sanitizeContext(e){let r={};for(let[t,n]of Object.entries(e)){let i=this.sanitizeValue(t,n);i!==void 0&&(r[t]=i)}return r}shouldLog(e){if(this.config.isForcedLogging?.())return!0;let r=this.getEnvironment();return this.config.shouldLogLevel?this.config.shouldLogLevel(e,r):!(F(r)&&e!=="error")}write(e,r,t){if(!this.shouldLog(e))return;let n=this.sanitizeMessage(r),i=t?this.sanitizeContext(t):void 0,a={timestamp:new Date().toISOString(),level:e,environment:this.getEnvironment(),service:this.config.prefix,message:n,...i&&Object.keys(i).length>0&&{context:i}},c=JSON.stringify(a);switch(e){case"error":console.error(c);break;case"warn":console.warn(c);break;case"info":console.info(c);break;case"debug":console.log(c);break}}error(e,r){this.write("error",e,V(r))}warn(e,r){this.write("warn",e,r)}info(e,r){this.write("info",e,r)}debug(e,r){this.write("debug",e,r)}},K=/^[A-Za-z0-9+/_-]+={0,2}$/,M=e=>{let r=e.replaceAll("-","+").replaceAll("_","/"),t=(4-r.length%4)%4;return r+"=".repeat(t)},B=e=>{if(typeof e!="string"||e.length===0)return!1;let r=e.split(".");return r.length!==3?!1:r.every(t=>t.length>0&&K.test(t))},S=e=>{if(!B(e))return null;try{let r=e.split(".")[1];if(!r)return null;let t=atob(M(r)),n=JSON.parse(t);return typeof n!="object"||n===null?null:n}catch{return null}},b=(e,r=Date.now())=>{if(!e||typeof e.exp!="number")return!0;let t=Math.floor(r/1e3);return e.exp<t},C=(e,r)=>{if(!e)return null;for(let t of r){let n=e[t];if(typeof n=="string"&&n.trim()!=="")return n}return null},N="AES-GCM",z=256,$=12,W=16,Y=1e5,h="v2:";async function H(e){let t=new TextEncoder().encode(e),n=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n)).map(a=>a.toString(16).padStart(2,"0")).join("")}async function w(e,r){let t=new TextEncoder,n=await crypto.subtle.importKey("raw",t.encode(e),"PBKDF2",!1,["deriveKey"]);return crypto.subtle.deriveKey({name:"PBKDF2",salt:r.buffer,iterations:Y,hash:"SHA-256"},n,{name:N,length:z},!1,["encrypt","decrypt"])}async function j(e,r,t){let n=new TextEncoder,i=crypto.getRandomValues(new Uint8Array($)),a=await crypto.subtle.encrypt({name:N,iv:i},r,n.encode(e)),c=T(i),u=T(t),g=T(new Uint8Array(a));return`${h}${c}:${u}:${g}`}async function G(e,r){if(!e.startsWith(h))return null;try{let t=e.slice(h.length).split(":");if(t.length!==3)return null;let[n,i,a]=t,c=m(n),u=m(i),g=m(a),E=await w(r,u),s=await crypto.subtle.decrypt({name:N,iv:c.buffer},E,g.buffer);return new TextDecoder().decode(s)}catch{return null}}function J(){return crypto.getRandomValues(new Uint8Array(W))}function A(e){return e.startsWith(h)}function T(e){let r="";for(let t of e)r+=String.fromCodePoint(t);return btoa(r)}function m(e){let r=atob(e),t=new Uint8Array(r.length),n=0;for(let i of r)t[n]=i.codePointAt(0)??0,n++;return t}var Re=class{storage;storageVersionKey;saltKey;currentVersion;fingerprintSeed;defaultTokenExpiryMinutes;logger;encryptionKey=null;salt=null;initPromise=null;initialized=!1;constructor(e,r){this.storage=e==="localStorage"?globalThis.localStorage:globalThis.sessionStorage,this.storageVersionKey=`${r.namespace}_storage_version`,this.saltKey=`${r.namespace}_encryption_salt`,this.currentVersion=r.currentVersion??2,this.fingerprintSeed=r.fingerprintSeed,this.defaultTokenExpiryMinutes=r.defaultTokenExpiryMinutes??1440,this.logger=r.logger}logError(e,r){if(this.logger){if(r instanceof Error){this.logger.error(e,r);return}this.logger.error(e,{error:r})}}logWarn(e,r){this.logger&&this.logger.warn(e,r)}async ensureInitialized(){if(!(this.initialized&&this.encryptionKey)){if(this.initPromise){await this.initPromise;return}this.initPromise=this.initialize(),await this.initPromise}}async initialize(){try{Number.parseInt(this.storage.getItem(this.storageVersionKey)??"1",10)<this.currentVersion&&(this.clearLegacyData(),this.storage.setItem(this.storageVersionKey,this.currentVersion.toString()));let r=this.storage.getItem(this.saltKey);r&&A(`v2:x:${r}:x`)?this.salt=this.base64ToUint8Array(r):(this.salt=J(),this.storage.setItem(this.saltKey,this.uint8ArrayToBase64(this.salt)));let t=await this.generateFingerprint();this.encryptionKey=await w(t,this.salt),this.initialized=!0}catch(e){this.logError("SecureStorage initialization failed",e),this.initialized=!1}}async generateFingerprint(){let e=[navigator.userAgent,navigator.language,new Date().getTimezoneOffset().toString(),screen.colorDepth.toString(),screen.width.toString(),screen.height.toString(),this.fingerprintSeed].join("|");return H(e)}clearLegacyData(){let e=[];for(let r=0;r<this.storage.length;r++){let t=this.storage.key(r);t&&!t.startsWith(this.storageVersionKey)&&!t.startsWith(this.saltKey)&&e.push(t)}e.forEach(r=>this.storage.removeItem(r))}async setItem(e,r,t){try{if(await this.ensureInitialized(),!this.encryptionKey||!this.salt){this.logWarn("SecureStorage not properly initialized");return}let n=await j(r,this.encryptionKey,this.salt);if(this.storage.setItem(e,n),typeof t=="number"&&t>0){let i=Date.now()+t*60*1e3;this.storage.setItem(`${e}_expiry`,i.toString())}}catch(n){this.logError("Failed to encrypt and store data",n)}}async getItem(e){try{await this.ensureInitialized();let r=`${e}_expiry`,t=this.storage.getItem(r);if(t){let c=Number.parseInt(t,10);if(Date.now()>c)return this.removeItem(e),null}let n=this.storage.getItem(e);if(!n)return null;if(!A(n))return this.removeItem(e),null;let i=await this.generateFingerprint(),a=await G(n,i);return a||(this.logWarn("Failed to decrypt stored data - may be corrupted"),this.removeItem(e),null)}catch(r){return this.logError("Failed to decrypt data",r),this.removeItem(e),null}}removeItem(e){this.storage.removeItem(e),this.storage.removeItem(`${e}_expiry`)}clear(){this.storage.clear()}async setToken(e){try{let r=e.split(".");if(r.length===3&&r[1]){let t=JSON.parse(atob(r[1]));if(typeof t.exp=="number"){let n=t.exp*1e3,i=Date.now(),a=Math.floor((n-i)/(60*1e3));if(a>0){await this.setItem("authToken",e,a);return}}}}catch{this.logWarn("Failed to parse token expiry, using default expiry")}await this.setItem("authToken",e,this.defaultTokenExpiryMinutes)}async getToken(){let e=await this.getItem("authToken");if(e)try{let r=e.split(".");if(r.length===3&&r[1]){let t=JSON.parse(atob(r[1]));if(typeof t.exp=="number"){let n=Math.floor(Date.now()/1e3);if(t.exp<n)return this.removeItem("authToken"),null}}}catch{return this.logWarn("Failed to validate token expiry"),this.removeItem("authToken"),null}return e}async hasValidToken(){return await this.getToken()!==null}async migrateFromLocalStorage(e){let r=globalThis.localStorage.getItem(e);r&&(globalThis.localStorage.removeItem(e),e==="authToken"?await this.setToken(r):await this.setItem(e,r))}uint8ArrayToBase64(e){let r="";for(let t of e)r+=String.fromCodePoint(t);return btoa(r)}base64ToUint8Array(e){let r=atob(e),t=new Uint8Array(r.length),n=0;for(let i of r)t[n]=i.codePointAt(0)??0,n++;return t}};function Q(){if(globalThis.window===void 0)return"prod";let e=globalThis.window.__TENANT_CONFIG__;return e?.environment&&["dev","stg","api","prod"].includes(e.environment)?e.environment:globalThis.window.__CRUDIFY_ENV__?globalThis.window.__CRUDIFY_ENV__:"prod"}var y=null,I=class{core;constructor(){this.core=new O({prefix:"CrudifyUI",getEnvironment:()=>y??Q(),isForcedLogging:()=>globalThis.window?.__CRUDIFY_DEBUG_MODE__===!0}),y&&this.core.setEnvironment(y)}error(r,t){this.core.error(r,t)}warn(r,t){this.core.warn(r,t)}info(r,t){this.core.info(r,t)}debug(r,t){this.core.debug(r,t)}getEnvironment(){return this.core.getEnvironment()}setEnvironment(r){if(this.core.setEnvironment(r),y=r,globalThis.window!==void 0){let t=["dev","stg","api","prod"];globalThis.window.__CRUDIFY_ENV__=t.includes(r)?r:void 0}}isExplicitlyConfigured(){return this.core.isExplicitlyConfigured()}},l=new I;var q=new Set(["dev","stg","api","prod"]);function Z(e){return!!e&&q.has(e)}function X(){if(globalThis.window===void 0)return null;let e=globalThis.window.__TENANT_CONFIG__;return e?.publicApiKey?e:null}function v(e={}){let{publicApiKey:r,env:t,appName:n,logo:i,loginActions:a,featureKeys:c,theme:u,enabledServices:g,enableDebug:E=!1}=e,s=X();if(s){E&&l.info("[TenantConfig] Using INJECTED configuration (Lambda@Edge)",{hasApiKey:!!s.publicApiKey,environment:s.environment,hasAppName:!!s.appName,hasLogo:!!s.logo,loginActionsCount:s.loginActions?.length,featureKeysCount:s.featureKeys?.length,hasTheme:!!s.theme});let d=Z(s.environment)?s.environment:"prod";return{publicApiKey:s.publicApiKey,environment:d,appName:s.appName,logo:s.logo,loginActions:s.loginActions,featureKeys:s.featureKeys,theme:s.theme,enabledServices:s.enabledServices,configSource:"injected"}}return r?(E&&l.info("[TenantConfig] Using PROPS configuration (development)",{environment:t,hasAppName:!!n,hasLogo:!!i,loginActionsCount:a?.length,featureKeysCount:c?.length,hasTheme:!!u}),{publicApiKey:r,environment:t||"prod",appName:n,logo:i,loginActions:a,featureKeys:c,theme:u,enabledServices:g,configSource:"props"}):(E&&l.error("[TenantConfig] No configuration found! Ensure Lambda@Edge injects window.__TENANT_CONFIG__ (production) or provide props (development)."),{configSource:"none"})}function Ae(e={}){return v(e)}function ee(e){return e==="injected"?"cookies":e}function re(e={}){let r={publicApiKey:e.publicApiKey,env:e.env,appName:e.appName,logo:e.logo,loginActions:e.loginActions,featureKeys:e.featureKeys,enableDebug:e.enableDebug},t=v(r),n={publicApiKey:t.publicApiKey,env:t.environment,appName:t.appName,logo:t.logo,loginActions:t.loginActions,featureKeys:t.featureKeys,theme:t.theme,configSource:ee(t.configSource)};return e.enableDebug&&globalThis.window!==void 0&&(globalThis.window.__CRUDIFY_RESOLVED_CONFIG=n),n}function be(e={}){return re(e)}var _=class e{static instance;listeners=new Set;isHandlingAuthError=!1;lastErrorTime=0;lastEventType=null;DEBOUNCE_TIME=1e3;constructor(){}static getInstance(){return e.instance||(e.instance=new e),e.instance}emit(r,t){let n=Date.now();if(this.isHandlingAuthError&&this.lastEventType===r&&n-this.lastErrorTime<this.DEBOUNCE_TIME){l.debug(`AuthEventBus: Ignoring duplicate ${r} event (debounced)`);return}this.isHandlingAuthError=!0,this.lastErrorTime=n,this.lastEventType=r,l.debug(`AuthEventBus: Emitting ${r} event`,t?{details:t}:void 0);let i={type:r,details:t,timestamp:n};this.listeners.forEach(a=>{try{a(i)}catch(c){l.error("AuthEventBus: Error in listener",c instanceof Error?c:{message:String(c)})}}),setTimeout(()=>{this.isHandlingAuthError=!1,this.lastEventType=null},2e3)}subscribe(r){return this.listeners.add(r),()=>{this.listeners.delete(r)}}clear(){this.listeners.clear(),this.isHandlingAuthError=!1,this.lastEventType=null}isHandling(){return this.isHandlingAuthError}},De=_.getInstance();var te=["errors.{category}.{code}","errors.{code}","login.{code}","error.{code}","messages.{code}","{code}"],ne={INVALID_CREDENTIALS:"auth",UNAUTHORIZED:"auth",INVALID_API_KEY:"auth",USER_NOT_FOUND:"auth",USER_NOT_ACTIVE:"auth",NO_PERMISSION:"auth",SESSION_EXPIRED:"auth",ITEM_NOT_FOUND:"data",NOT_FOUND:"data",IN_USE:"data",DUPLICATE_ENTRY:"data",FIELD_ERROR:"validation",BAD_REQUEST:"validation",INVALID_EMAIL:"validation",INVALID_CODE:"validation",REQUIRED_FIELD:"validation",INTERNAL_SERVER_ERROR:"system",DATABASE_CONNECTION_ERROR:"system",INVALID_CONFIGURATION:"system",UNKNOWN_OPERATION:"system",TIMEOUT_ERROR:"system",NETWORK_ERROR:"system",TOO_MANY_REQUESTS:"rate_limit"},oe={INVALID_CREDENTIALS:"Invalid username or password",UNAUTHORIZED:"You are not authorized to perform this action",SESSION_EXPIRED:"Your session has expired. Please log in again.",USER_NOT_FOUND:"User not found",ITEM_NOT_FOUND:"Item not found",FIELD_ERROR:"Invalid field value",INTERNAL_SERVER_ERROR:"An internal error occurred",NETWORK_ERROR:"Network connection error",TIMEOUT_ERROR:"Request timeout",UNKNOWN_OPERATION:"Unknown operation",INVALID_EMAIL:"Invalid email format",INVALID_CODE:"Invalid code",TOO_MANY_REQUESTS:"Too many requests, please try again later"};function f(e,r){let{translateFn:t,currentLanguage:n,enableDebug:i}=r;i&&l.debug(`[ErrorTranslation] Translating error code: ${e} (lang: ${n||"unknown"})`);let a=e.toUpperCase(),c=ne[a],u=te.map(s=>s.replace("{category}",c||"general").replace("{code}",a));i&&l.debug("[ErrorTranslation] Searching keys:",{translationKeys:u});for(let s of u){let d=t(s);if(i&&l.debug(`[ErrorTranslation] Checking key: "${s}" -> result: "${d}" (same as key: ${d===s})`),d&&d!==s)return i&&l.debug(`[ErrorTranslation] Found translation at key: ${s} = "${d}"`),d}let g=oe[a];if(g)return i&&l.debug(`[ErrorTranslation] Using default message: "${g}"`),g;let E=a.replaceAll("_"," ").toLowerCase().replaceAll(/\b\w/g,s=>s.toUpperCase());return i&&l.debug(`[ErrorTranslation] No translation found, using friendly code: "${E}"`),E}function ie(e,r){return e.map(t=>f(t,r))}function se(e,r){let{enableDebug:t}=r;t&&l.debug("[ErrorTranslation] Translating error:",{error:e});let n=f(e.code,r);return n!==e.code.toUpperCase()&&n!==e.code?(t&&l.debug(`[ErrorTranslation] Using hierarchical translation: "${n}"`),e.field?`${e.field}: ${n}`:n):e.message&&!e.message.includes("Error:")&&e.message.length>0&&e.message!==e.code?(t&&l.debug(`[ErrorTranslation] No hierarchical translation found, using API message: "${e.message}"`),e.message):(t&&l.debug(`[ErrorTranslation] Using final fallback: "${n}"`),e.field?`${e.field}: ${n}`:n)}function Pe(e,r={}){let t={translateFn:e,currentLanguage:r.currentLanguage,enableDebug:r.enableDebug||!1};return{translateErrorCode:n=>f(n,t),translateErrorCodes:n=>ie(n,t),translateError:n=>se(n,t),translateApiError:n=>n?.data?.response?.status?f(n.data.response.status,t):n?.status?f(n.status,t):n?.code?f(n.code,t):"Unknown error"}}var D=class e{static instance=null;isPatched=!1;refCount=0;listeners=new Set;originalPushState;originalReplaceState;constructor(){this.originalPushState=globalThis.history.pushState,this.originalReplaceState=globalThis.history.replaceState}static getInstance(){return e.instance??=new e,e.instance}subscribe(r){return this.listeners.add(r),this.refCount++,this.isPatched||this.applyPatches(),()=>{this.unsubscribe(r)}}unsubscribe(r){this.listeners.delete(r),this.refCount--,this.refCount===0&&this.isPatched&&this.removePatches()}applyPatches(){globalThis.history.pushState=(...r)=>{let t=this.originalPushState.apply(globalThis.history,r);return this.notifyListeners(),t},globalThis.history.replaceState=(...r)=>{let t=this.originalReplaceState.apply(globalThis.history,r);return this.notifyListeners(),t},this.isPatched=!0}removePatches(){globalThis.history.pushState=this.originalPushState,globalThis.history.replaceState=this.originalReplaceState,this.isPatched=!1}notifyListeners(){this.listeners.forEach(r=>{try{r()}catch(t){l.error("NavigationTracker: Error in navigation listener",t instanceof Error?t:{message:String(t)})}})}static reset(){e.instance?.isPatched&&e.instance.removePatches(),e.instance=null}getSubscriberCount(){return this.refCount}isActive(){return this.isPatched}};var U=e=>{let r=S(e);return r||(l.warn("Invalid JWT format: token must have 3 parts"),null)},Me=()=>{try{let e=null;if(e=sessionStorage.getItem("authToken"),e||(e=sessionStorage.getItem("token")),e||(e=localStorage.getItem("authToken")||localStorage.getItem("token")),!e)return null;let r=U(e);return r?C(r,["email","cognito:username"]):null}catch(e){return l.warn("Failed to get current user email",e instanceof Error?{errorMessage:e.message}:{message:String(e)}),null}},Be=e=>{let r=U(e);return b(r)};var o={INVALID_CREDENTIALS:"INVALID_CREDENTIALS",UNAUTHORIZED:"UNAUTHORIZED",INVALID_API_KEY:"INVALID_API_KEY",USER_NOT_FOUND:"USER_NOT_FOUND",USER_NOT_ACTIVE:"USER_NOT_ACTIVE",NO_PERMISSION:"NO_PERMISSION",ITEM_NOT_FOUND:"ITEM_NOT_FOUND",NOT_FOUND:"NOT_FOUND",IN_USE:"IN_USE",FIELD_ERROR:"FIELD_ERROR",BAD_REQUEST:"BAD_REQUEST",INVALID_EMAIL:"INVALID_EMAIL",INVALID_CODE:"INVALID_CODE",INTERNAL_SERVER_ERROR:"INTERNAL_SERVER_ERROR",DATABASE_CONNECTION_ERROR:"DATABASE_CONNECTION_ERROR",INVALID_CONFIGURATION:"INVALID_CONFIGURATION",UNKNOWN_OPERATION:"UNKNOWN_OPERATION",TOO_MANY_REQUESTS:"TOO_MANY_REQUESTS",NETWORK_ERROR:"NETWORK_ERROR",TIMEOUT_ERROR:"TIMEOUT_ERROR"},R={[o.INVALID_CREDENTIALS]:"warning",[o.UNAUTHORIZED]:"warning",[o.INVALID_API_KEY]:"error",[o.USER_NOT_FOUND]:"warning",[o.USER_NOT_ACTIVE]:"warning",[o.NO_PERMISSION]:"warning",[o.ITEM_NOT_FOUND]:"info",[o.NOT_FOUND]:"info",[o.IN_USE]:"warning",[o.FIELD_ERROR]:"warning",[o.BAD_REQUEST]:"warning",[o.INVALID_EMAIL]:"warning",[o.INVALID_CODE]:"warning",[o.INTERNAL_SERVER_ERROR]:"error",[o.DATABASE_CONNECTION_ERROR]:"error",[o.INVALID_CONFIGURATION]:"error",[o.UNKNOWN_OPERATION]:"error",[o.TOO_MANY_REQUESTS]:"warning",[o.NETWORK_ERROR]:"error",[o.TIMEOUT_ERROR]:"error"};function ae(e){let r=[];return Object.entries(e).forEach(([t,n])=>{Array.isArray(n)&&n.length>0&&r.push({code:o.FIELD_ERROR,message:n[0],severity:"warning",field:t})}),r}function le(e){let r=e;return R[r]?{code:r,message:p(r),severity:R[r]}:null}function ce(e){if(!e.data||typeof e.data!="object")return[];let r=e.data;if(!r.response)return[];let t=[],{status:n,fieldsWarning:i}=r.response;if(i&&typeof i=="object"&&t.push(...ae(i)),n&&typeof n=="string"){let a=le(n);a&&t.push(a)}return t}function L(e){return e.map(r=>{let t=typeof r=="string"&&x(r)?r:o.BAD_REQUEST;return{code:t,message:typeof r=="string"?r:p(t),severity:R[t]||"warning"}})}function ue(e){let r=[];return e.forEach(t=>{if(typeof t=="string"){let n=x(t)?t:o.BAD_REQUEST;r.push({code:n,message:p(n),severity:R[n]||"warning"})}}),r}function ge(e,r){return{code:o.FIELD_ERROR,message:typeof r[0]=="string"?r[0]:"Validation error",severity:"warning",field:e}}function Ee(e){let r=[];return Object.entries(e).forEach(([t,n])=>{!Array.isArray(n)||n.length===0||(t==="_error"?r.push(...L(n)):t==="_graphql"?r.push(...ue(n)):r.push(ge(t,n)))}),r}function de(e){return e.errors?typeof e.errors=="string"?[{code:o.BAD_REQUEST,message:e.errors,severity:"warning"}]:Array.isArray(e.errors)?L(e.errors):typeof e.errors=="object"?Ee(e.errors):[]:[]}function P(e){let r=[];try{let t=e;r.push(...ce(t),...de(t)),r.length===0&&t.success===!1&&r.push({code:o.BAD_REQUEST,message:"Request failed",severity:"warning"})}catch(t){r.push({code:o.INTERNAL_SERVER_ERROR,message:"Failed to parse error response",severity:"error",details:{originalError:t}})}return r.length>0?r:[{code:o.INTERNAL_SERVER_ERROR,message:"Unknown error occurred",severity:"error"}]}function fe(e){try{let r=e;if(r.data&&Array.isArray(r.data)){let t=[];return r.data.forEach((n,i)=>{n.response?.status==="TOO_MANY_REQUESTS"?t.push({code:o.TOO_MANY_REQUESTS,message:p(o.TOO_MANY_REQUESTS),severity:"warning",details:{transactionIndex:i}}):n.response?.status!=="OK"&&t.push({code:o.BAD_REQUEST,message:"Transaction failed",severity:"warning",details:{transactionIndex:i,response:n.response}})}),t}return P(e)}catch(r){return[{code:o.INTERNAL_SERVER_ERROR,message:"Failed to parse transaction error",severity:"error",details:{originalError:r}}]}}function x(e){return Object.values(o).includes(e)}function p(e){return{[o.INVALID_CREDENTIALS]:"Invalid email or password",[o.UNAUTHORIZED]:"You are not authorized to perform this action",[o.INVALID_API_KEY]:"Invalid API key",[o.USER_NOT_FOUND]:"User not found",[o.USER_NOT_ACTIVE]:"User account is not active",[o.NO_PERMISSION]:"You do not have permission to perform this action",[o.ITEM_NOT_FOUND]:"Item not found",[o.NOT_FOUND]:"Resource not found",[o.IN_USE]:"Resource is currently in use",[o.FIELD_ERROR]:"Validation error",[o.BAD_REQUEST]:"Invalid request",[o.INVALID_EMAIL]:"Please enter a valid email address",[o.INVALID_CODE]:"Invalid or expired code",[o.INTERNAL_SERVER_ERROR]:"Internal server error",[o.DATABASE_CONNECTION_ERROR]:"Database connection error",[o.INVALID_CONFIGURATION]:"Invalid configuration",[o.UNKNOWN_OPERATION]:"Unknown operation",[o.TOO_MANY_REQUESTS]:"Too many requests. Please try again later.",[o.NETWORK_ERROR]:"Network error. Please check your connection.",[o.TIMEOUT_ERROR]:"Request timed out. Please try again."}[e]||"An unknown error occurred"}function pe(e){return e instanceof Error?e.name==="AbortError"?{code:o.TIMEOUT_ERROR,message:"Request was cancelled",severity:"info"}:e.message.includes("NetworkError")||e.message.includes("Failed to fetch")?{code:o.NETWORK_ERROR,message:p(o.NETWORK_ERROR),severity:"error"}:{code:o.INTERNAL_SERVER_ERROR,message:e.message||"An unexpected error occurred",severity:"error",details:{originalError:e}}:{code:o.INTERNAL_SERVER_ERROR,message:"An unknown error occurred",severity:"error",details:{originalError:e}}}function he(e){if(!(!e||typeof e!="object"))return Reflect.get(e,"data")}function $e(e){if(e instanceof Error)return[pe(e)];if(typeof e=="object"&&e!==null){let r=he(e);return Array.isArray(r)?fe(e):P(e)}return[{code:o.INTERNAL_SERVER_ERROR,message:"An unknown error occurred",severity:"error",details:{originalError:e}}]}export{ye as a,O as b,H as c,w as d,j as e,G as f,J as g,A as h,Re as i,l as j,v as k,Ae as l,re as m,be as n,De as o,f as p,ie as q,se as r,Pe as s,D as t,U as u,Me as v,Be as w,o as x,R as y,P as z,fe as A,p as B,pe as C,$e as D};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as t,j as o}from"./chunk-YRU7AXYV.mjs";var g={error:(e,r)=>{if(r instanceof Error){o.error(e,r);return}if(typeof r=="object"&&r!==null){o.error(e,r);return}o.error(e)},warn:(e,r)=>{if(typeof r=="object"&&r!==null){o.warn(e,r);return}o.warn(e)}},n=class extends t{constructor(r="sessionStorage"){super(r,{namespace:"crudify_login",fingerprintSeed:"crudify-login",logger:g})}},i=new n("sessionStorage"),u=new n("localStorage");export{i as a,u as b};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { J as JwtPayload } from './
|
|
1
|
+
import { J as JwtPayload } from './api-jcCTCqPD.js';
|
|
2
|
+
import { FrontendEnvironment } from '@nocios/frontend-types';
|
|
3
|
+
import { SecureStorage as SecureStorage$1 } from '@nocios/frontend-types/shared';
|
|
2
4
|
|
|
3
5
|
interface JWTPayload extends JwtPayload {
|
|
4
6
|
'cognito:username'?: string;
|
|
@@ -7,31 +9,100 @@ declare const decodeJwtSafely: (token: string) => JWTPayload | null;
|
|
|
7
9
|
declare const getCurrentUserEmail: () => string | null;
|
|
8
10
|
declare const isTokenExpired: (token: string) => boolean;
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Centralized tenant configuration system for crudify-components
|
|
14
|
+
*
|
|
15
|
+
* This module provides a unified way to access tenant configuration
|
|
16
|
+
* that is injected by Lambda@Edge in production or provided via props
|
|
17
|
+
* in development.
|
|
18
|
+
*
|
|
19
|
+
* PRIORITY:
|
|
20
|
+
* 1. window.__TENANT_CONFIG__ (production - injected by Lambda@Edge)
|
|
21
|
+
* 2. Props (development - from .env variables)
|
|
22
|
+
* 3. Error (no configuration available)
|
|
23
|
+
*
|
|
24
|
+
* This replaces the cookie-based system to avoid race conditions
|
|
25
|
+
* where cookies from Set-Cookie headers are not immediately available
|
|
26
|
+
* to JavaScript on the first page load.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
type CrudifyEnvironment = FrontendEnvironment;
|
|
30
|
+
interface ResolvedTenantConfig {
|
|
31
|
+
publicApiKey?: string;
|
|
32
|
+
environment?: FrontendEnvironment;
|
|
33
|
+
appName?: string;
|
|
34
|
+
logo?: string;
|
|
35
|
+
loginActions?: string[];
|
|
36
|
+
featureKeys?: string[];
|
|
37
|
+
theme?: Record<string, unknown>;
|
|
38
|
+
enabledServices?: string[];
|
|
39
|
+
configSource: 'injected' | 'props' | 'none';
|
|
40
|
+
}
|
|
41
|
+
interface TenantConfigOptions {
|
|
42
|
+
publicApiKey?: string;
|
|
43
|
+
env?: FrontendEnvironment;
|
|
44
|
+
appName?: string;
|
|
45
|
+
logo?: string;
|
|
46
|
+
loginActions?: string[];
|
|
47
|
+
featureKeys?: string[];
|
|
48
|
+
theme?: Record<string, unknown>;
|
|
49
|
+
enabledServices?: string[];
|
|
50
|
+
enableDebug?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolves tenant configuration with the following priority:
|
|
54
|
+
* 1. window.__TENANT_CONFIG__ (production - injected by Lambda@Edge) - HIGHEST PRIORITY
|
|
55
|
+
* 2. Props (development - from .env variables) - FALLBACK
|
|
56
|
+
* 3. None (error - no configuration available)
|
|
57
|
+
*
|
|
58
|
+
* @param options - Configuration options including props for development
|
|
59
|
+
* @returns Resolved configuration with source indicator
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* // In production (Lambda@Edge injects window.__TENANT_CONFIG__)
|
|
64
|
+
* const config = resolveTenantConfig();
|
|
65
|
+
* console.log(config.publicApiKey); // From injected config
|
|
66
|
+
* console.log(config.configSource); // "injected"
|
|
67
|
+
*
|
|
68
|
+
* // In development (with .env variables)
|
|
69
|
+
* const config = resolveTenantConfig({
|
|
70
|
+
* publicApiKey: import.meta.env.VITE_PUBLIC_API_KEY,
|
|
71
|
+
* env: import.meta.env.VITE_ENV,
|
|
72
|
+
* });
|
|
73
|
+
* console.log(config.configSource); // "props"
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
declare function resolveTenantConfig(options?: TenantConfigOptions): ResolvedTenantConfig;
|
|
77
|
+
/**
|
|
78
|
+
* React hook to access tenant configuration
|
|
79
|
+
*
|
|
80
|
+
* @param options - Configuration options
|
|
81
|
+
* @returns Resolved tenant configuration
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* function MyComponent() {
|
|
86
|
+
* const config = useTenantConfig();
|
|
87
|
+
*
|
|
88
|
+
* if (config.configSource === "none") {
|
|
89
|
+
* return <Error>No configuration available</Error>;
|
|
90
|
+
* }
|
|
91
|
+
*
|
|
92
|
+
* return <div>API Key: {config.publicApiKey}</div>;
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
declare function useTenantConfig(options?: TenantConfigOptions): ResolvedTenantConfig;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* SecureStorage wrapper for CrudifyLogin.
|
|
100
|
+
*
|
|
101
|
+
* Implementation is centralized in @nocios/frontend-types/shared.
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
declare class SecureStorage extends SecureStorage$1 {
|
|
16
105
|
constructor(storageType?: 'localStorage' | 'sessionStorage');
|
|
17
|
-
/**
|
|
18
|
-
* Initialize encryption key asynchronously
|
|
19
|
-
* Must be called before using encryption methods
|
|
20
|
-
*/
|
|
21
|
-
private ensureInitialized;
|
|
22
|
-
private initialize;
|
|
23
|
-
private generateFingerprint;
|
|
24
|
-
private clearLegacyData;
|
|
25
|
-
setItem(key: string, value: string, expiryMinutes?: number): Promise<void>;
|
|
26
|
-
getItem(key: string): Promise<string | null>;
|
|
27
|
-
removeItem(key: string): void;
|
|
28
|
-
clear(): void;
|
|
29
|
-
setToken(token: string): Promise<void>;
|
|
30
|
-
getToken(): Promise<string | null>;
|
|
31
|
-
hasValidToken(): Promise<boolean>;
|
|
32
|
-
migrateFromLocalStorage(key: string): Promise<void>;
|
|
33
|
-
private uint8ArrayToBase64;
|
|
34
|
-
private base64ToUint8Array;
|
|
35
106
|
}
|
|
36
107
|
declare const secureSessionStorage: SecureStorage;
|
|
37
108
|
declare const secureLocalStorage: SecureStorage;
|
|
@@ -138,4 +209,4 @@ declare function createErrorTranslator(translateFn: (key: string) => string, opt
|
|
|
138
209
|
} | null | undefined) => string;
|
|
139
210
|
};
|
|
140
211
|
|
|
141
|
-
export { ERROR_CODES as E, type ParsedError as P, ERROR_SEVERITY_MAP as a, type ErrorCode as b, type ErrorSeverity as c, type ErrorTranslationConfig as d, createErrorTranslator as e, decodeJwtSafely as f, getCurrentUserEmail as g, getErrorMessage as h, handleCrudifyError as i, isTokenExpired as j, parseJavaScriptError as k, parseTransactionError as l, secureSessionStorage as m, translateErrorCode as n, translateErrorCodes as o, parseApiError as p, secureLocalStorage as s, translateError as t };
|
|
212
|
+
export { type CrudifyEnvironment as C, ERROR_CODES as E, type ParsedError as P, type ResolvedTenantConfig as R, type TenantConfigOptions as T, ERROR_SEVERITY_MAP as a, type ErrorCode as b, type ErrorSeverity as c, type ErrorTranslationConfig as d, createErrorTranslator as e, decodeJwtSafely as f, getCurrentUserEmail as g, getErrorMessage as h, handleCrudifyError as i, isTokenExpired as j, parseJavaScriptError as k, parseTransactionError as l, secureSessionStorage as m, translateErrorCode as n, translateErrorCodes as o, parseApiError as p, resolveTenantConfig as r, secureLocalStorage as s, translateError as t, useTenantConfig as u };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { J as JwtPayload } from './
|
|
1
|
+
import { J as JwtPayload } from './api-jcCTCqPD.mjs';
|
|
2
|
+
import { FrontendEnvironment } from '@nocios/frontend-types';
|
|
3
|
+
import { SecureStorage as SecureStorage$1 } from '@nocios/frontend-types/shared';
|
|
2
4
|
|
|
3
5
|
interface JWTPayload extends JwtPayload {
|
|
4
6
|
'cognito:username'?: string;
|
|
@@ -7,31 +9,100 @@ declare const decodeJwtSafely: (token: string) => JWTPayload | null;
|
|
|
7
9
|
declare const getCurrentUserEmail: () => string | null;
|
|
8
10
|
declare const isTokenExpired: (token: string) => boolean;
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Centralized tenant configuration system for crudify-components
|
|
14
|
+
*
|
|
15
|
+
* This module provides a unified way to access tenant configuration
|
|
16
|
+
* that is injected by Lambda@Edge in production or provided via props
|
|
17
|
+
* in development.
|
|
18
|
+
*
|
|
19
|
+
* PRIORITY:
|
|
20
|
+
* 1. window.__TENANT_CONFIG__ (production - injected by Lambda@Edge)
|
|
21
|
+
* 2. Props (development - from .env variables)
|
|
22
|
+
* 3. Error (no configuration available)
|
|
23
|
+
*
|
|
24
|
+
* This replaces the cookie-based system to avoid race conditions
|
|
25
|
+
* where cookies from Set-Cookie headers are not immediately available
|
|
26
|
+
* to JavaScript on the first page load.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
type CrudifyEnvironment = FrontendEnvironment;
|
|
30
|
+
interface ResolvedTenantConfig {
|
|
31
|
+
publicApiKey?: string;
|
|
32
|
+
environment?: FrontendEnvironment;
|
|
33
|
+
appName?: string;
|
|
34
|
+
logo?: string;
|
|
35
|
+
loginActions?: string[];
|
|
36
|
+
featureKeys?: string[];
|
|
37
|
+
theme?: Record<string, unknown>;
|
|
38
|
+
enabledServices?: string[];
|
|
39
|
+
configSource: 'injected' | 'props' | 'none';
|
|
40
|
+
}
|
|
41
|
+
interface TenantConfigOptions {
|
|
42
|
+
publicApiKey?: string;
|
|
43
|
+
env?: FrontendEnvironment;
|
|
44
|
+
appName?: string;
|
|
45
|
+
logo?: string;
|
|
46
|
+
loginActions?: string[];
|
|
47
|
+
featureKeys?: string[];
|
|
48
|
+
theme?: Record<string, unknown>;
|
|
49
|
+
enabledServices?: string[];
|
|
50
|
+
enableDebug?: boolean;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolves tenant configuration with the following priority:
|
|
54
|
+
* 1. window.__TENANT_CONFIG__ (production - injected by Lambda@Edge) - HIGHEST PRIORITY
|
|
55
|
+
* 2. Props (development - from .env variables) - FALLBACK
|
|
56
|
+
* 3. None (error - no configuration available)
|
|
57
|
+
*
|
|
58
|
+
* @param options - Configuration options including props for development
|
|
59
|
+
* @returns Resolved configuration with source indicator
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* // In production (Lambda@Edge injects window.__TENANT_CONFIG__)
|
|
64
|
+
* const config = resolveTenantConfig();
|
|
65
|
+
* console.log(config.publicApiKey); // From injected config
|
|
66
|
+
* console.log(config.configSource); // "injected"
|
|
67
|
+
*
|
|
68
|
+
* // In development (with .env variables)
|
|
69
|
+
* const config = resolveTenantConfig({
|
|
70
|
+
* publicApiKey: import.meta.env.VITE_PUBLIC_API_KEY,
|
|
71
|
+
* env: import.meta.env.VITE_ENV,
|
|
72
|
+
* });
|
|
73
|
+
* console.log(config.configSource); // "props"
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
declare function resolveTenantConfig(options?: TenantConfigOptions): ResolvedTenantConfig;
|
|
77
|
+
/**
|
|
78
|
+
* React hook to access tenant configuration
|
|
79
|
+
*
|
|
80
|
+
* @param options - Configuration options
|
|
81
|
+
* @returns Resolved tenant configuration
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* function MyComponent() {
|
|
86
|
+
* const config = useTenantConfig();
|
|
87
|
+
*
|
|
88
|
+
* if (config.configSource === "none") {
|
|
89
|
+
* return <Error>No configuration available</Error>;
|
|
90
|
+
* }
|
|
91
|
+
*
|
|
92
|
+
* return <div>API Key: {config.publicApiKey}</div>;
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
declare function useTenantConfig(options?: TenantConfigOptions): ResolvedTenantConfig;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* SecureStorage wrapper for CrudifyLogin.
|
|
100
|
+
*
|
|
101
|
+
* Implementation is centralized in @nocios/frontend-types/shared.
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
declare class SecureStorage extends SecureStorage$1 {
|
|
16
105
|
constructor(storageType?: 'localStorage' | 'sessionStorage');
|
|
17
|
-
/**
|
|
18
|
-
* Initialize encryption key asynchronously
|
|
19
|
-
* Must be called before using encryption methods
|
|
20
|
-
*/
|
|
21
|
-
private ensureInitialized;
|
|
22
|
-
private initialize;
|
|
23
|
-
private generateFingerprint;
|
|
24
|
-
private clearLegacyData;
|
|
25
|
-
setItem(key: string, value: string, expiryMinutes?: number): Promise<void>;
|
|
26
|
-
getItem(key: string): Promise<string | null>;
|
|
27
|
-
removeItem(key: string): void;
|
|
28
|
-
clear(): void;
|
|
29
|
-
setToken(token: string): Promise<void>;
|
|
30
|
-
getToken(): Promise<string | null>;
|
|
31
|
-
hasValidToken(): Promise<boolean>;
|
|
32
|
-
migrateFromLocalStorage(key: string): Promise<void>;
|
|
33
|
-
private uint8ArrayToBase64;
|
|
34
|
-
private base64ToUint8Array;
|
|
35
106
|
}
|
|
36
107
|
declare const secureSessionStorage: SecureStorage;
|
|
37
108
|
declare const secureLocalStorage: SecureStorage;
|
|
@@ -138,4 +209,4 @@ declare function createErrorTranslator(translateFn: (key: string) => string, opt
|
|
|
138
209
|
} | null | undefined) => string;
|
|
139
210
|
};
|
|
140
211
|
|
|
141
|
-
export { ERROR_CODES as E, type ParsedError as P, ERROR_SEVERITY_MAP as a, type ErrorCode as b, type ErrorSeverity as c, type ErrorTranslationConfig as d, createErrorTranslator as e, decodeJwtSafely as f, getCurrentUserEmail as g, getErrorMessage as h, handleCrudifyError as i, isTokenExpired as j, parseJavaScriptError as k, parseTransactionError as l, secureSessionStorage as m, translateErrorCode as n, translateErrorCodes as o, parseApiError as p, secureLocalStorage as s, translateError as t };
|
|
212
|
+
export { type CrudifyEnvironment as C, ERROR_CODES as E, type ParsedError as P, type ResolvedTenantConfig as R, type TenantConfigOptions as T, ERROR_SEVERITY_MAP as a, type ErrorCode as b, type ErrorSeverity as c, type ErrorTranslationConfig as d, createErrorTranslator as e, decodeJwtSafely as f, getCurrentUserEmail as g, getErrorMessage as h, handleCrudifyError as i, isTokenExpired as j, parseJavaScriptError as k, parseTransactionError as l, secureSessionStorage as m, translateErrorCode as n, translateErrorCodes as o, parseApiError as p, resolveTenantConfig as r, secureLocalStorage as s, translateError as t, useTenantConfig as u };
|
package/dist/hooks.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { F as FileItem, a as FileStatus,
|
|
2
|
-
|
|
3
|
-
import './
|
|
1
|
+
export { A as AutoGenerateConfig, F as FileItem, a as FileStatus, i as SessionState, U as UseAuthReturn, l as UseAutoGenerateOptions, m as UseAutoGenerateReturn, n as UseDataReturn, o as UseFileUploadOptions, p as UseFileUploadReturn, q as UseSessionOptions, r as UseUserDataOptions, s as UseUserDataReturn, t as UserData, u as useAuth, v as useAutoGenerate, w as useCrudifyWithNotifications, x as useData, y as useFileUpload, B as useSession, D as useUserData, E as useUserProfile } from './index-Cx9P3ZCG.mjs';
|
|
2
|
+
import '@nocios/frontend-types';
|
|
3
|
+
import './api-jcCTCqPD.mjs';
|
|
4
4
|
import 'react/jsx-runtime';
|
|
5
5
|
import 'react';
|
|
6
|
-
import '@nocios/crudify-sdk';
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export { F as FileItem, a as FileStatus,
|
|
2
|
-
|
|
3
|
-
import './
|
|
1
|
+
export { A as AutoGenerateConfig, F as FileItem, a as FileStatus, i as SessionState, U as UseAuthReturn, l as UseAutoGenerateOptions, m as UseAutoGenerateReturn, n as UseDataReturn, o as UseFileUploadOptions, p as UseFileUploadReturn, q as UseSessionOptions, r as UseUserDataOptions, s as UseUserDataReturn, t as UserData, u as useAuth, v as useAutoGenerate, w as useCrudifyWithNotifications, x as useData, y as useFileUpload, B as useSession, D as useUserData, E as useUserProfile } from './index-rHtWMls-.js';
|
|
2
|
+
import '@nocios/frontend-types';
|
|
3
|
+
import './api-jcCTCqPD.js';
|
|
4
4
|
import 'react/jsx-runtime';
|
|
5
5
|
import 'react';
|
|
6
|
-
import '@nocios/crudify-sdk';
|
package/dist/hooks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkBJEDX2HUjs = require('./chunk-BJEDX2HU.js');require('./chunk-GZOB4JDB.js');exports.useAuth = _chunkBJEDX2HUjs.v; exports.useAutoGenerate = _chunkBJEDX2HUjs.q; exports.useCrudifyWithNotifications = _chunkBJEDX2HUjs.x; exports.useData = _chunkBJEDX2HUjs.w; exports.useFileUpload = _chunkBJEDX2HUjs.t; exports.useSession = _chunkBJEDX2HUjs.g; exports.useUserData = _chunkBJEDX2HUjs.u; exports.useUserProfile = _chunkBJEDX2HUjs.p;
|
package/dist/hooks.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{g as e,p as t,q as o,t as r,u as s,v as p,w as u,x as a}from"./chunk-4I767MRM.mjs";import"./chunk-YRU7AXYV.mjs";export{p as useAuth,o as useAutoGenerate,a as useCrudifyWithNotifications,u as useData,r as useFileUpload,e as useSession,s as useUserData,t as useUserProfile};
|