dinocollab-core 2.1.39 → 2.1.41

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.
@@ -1,2 +1,2 @@
1
- import{asyncToGenerator as r,regenerator as n,slicedToArray as e}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{authService as o,ApplicationPaths as t}from"partner-oidc-auth";var i=globalThis.ApiAlertContext;"development"===process.env.NODE_ENV&&(globalThis.authService=o);var u=function(r){return new Promise(function(n){return setTimeout(n,r)})},a=function(){var o=r(n().m(function r(o,t){var i,a,s;return n().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,Promise.all([o(),u(t)]);case 1:return i=r.v,a=e(i,1),s=a[0],r.a(2,s)}},r)}));return function(r,n){return o.apply(this,arguments)}}(),s=function(r){var n=process.env.APP_API_URL||window.location.origin||"";if(!r)return n;try{return new URL(r),r}catch(e){return"".concat(n).concat(r)}},l=function(r){var n,e,o,t,u,a=Object.values(null!==(n=null!==(e=null===(o=r.response)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.errors)&&void 0!==e?e:null===(t=r.response)||void 0===t?void 0:t.data)&&void 0!==n?n:{}).filter(function(r){return r.length>0}).map(function(r){return r[0]});a.length<1||null==i||null===(u=i.ApiAlert)||void 0===u||u.PushError(a.join("\n"))},c=function(){var e=r(n().m(function r(e){var u,a,s,l,c,d,v,p,f,h;return n().w(function(r){for(;;)switch(r.n){case 0:if(403!==(null===(u=e.response)||void 0===u?void 0:u.status)){r.n=7;break}d=e.response.data,h=d.Code,r.n=3===h?1:1===h?3:5;break;case 1:return r.n=2,o.signOut({returnUrl:o.getReturnUrl()});case 2:return r.a(3,6);case 3:return r.n=4,null===(v=o.userManager)||void 0===v?void 0:v.revokeTokens(["access_token"]);case 4:return window.location.replace(t.Origin("")),r.a(3,6);case 5:return window.location.replace(t.Origin(t.IdentityAccessDenied)),r.a(3,6);case 6:r.n=8;break;case 7:401===(null===(a=e.response)||void 0===a?void 0:a.status)||"ERR_CANCELED"===e.code||((null!==(s=null===(l=e.response)||void 0===l?void 0:l.status)&&void 0!==s?s:500)>=500?"ERR_CANCELED"!==e.code&&(null==i||null===(p=i.ApiAlert)||void 0===p||p.PushError("An error has occurred!")):404===(null===(c=e.response)||void 0===c?void 0:c.status)&&(null==i||null===(f=i.ApiAlert)||void 0===f||f.PushError("Resource not found!")));case 8:return r.a(2,Promise.reject(e))}},r)}));return function(r){return e.apply(this,arguments)}}();export{i as ApiAlertContext,a as fetchDelay,c as handleResponseError,l as processError,s as resolveBaseUrl,u as sleep};
1
+ import{asyncToGenerator as r,regenerator as e,slicedToArray as n}from"../../../_virtual/_rollupPluginBabelHelpers.js";import{authService as o,ApplicationPaths as t}from"partner-oidc-auth";var i=globalThis.ApiAlertContext;"development"===process.env.NODE_ENV&&(globalThis.authService=o);var u=function(r){return new Promise(function(e){return setTimeout(e,r)})},a=function(){var o=r(e().m(function r(o,t){var i,a,s;return e().w(function(r){for(;;)switch(r.n){case 0:return r.n=1,Promise.all([o(),u(t)]);case 1:return i=r.v,a=n(i,1),s=a[0],r.a(2,s)}},r)}));return function(r,e){return o.apply(this,arguments)}}(),s=function(r){var e=process.env.APP_API_URL||window.location.origin||"";if(!r)return e;try{return new URL(r),r}catch(n){return"".concat(e).concat(r)}},l=function(r){var e,n,o,t,u,a=Object.values(null!==(e=null!==(n=null===(o=r.response)||void 0===o||null===(o=o.data)||void 0===o?void 0:o.errors)&&void 0!==n?n:null===(t=r.response)||void 0===t?void 0:t.data)&&void 0!==e?e:{}).filter(function(r){return r.length>0}).map(function(r){return r[0]});a.length<1||null==i||null===(u=i.ApiAlert)||void 0===u||u.PushError(a.join("\n"))},c=function(){var n=r(e().m(function r(n){var u,a,s,l,c,d,v,p,f,h;return e().w(function(r){for(;;)switch(r.n){case 0:if(403!==(null===(u=n.response)||void 0===u?void 0:u.status)){r.n=8;break}if("number"==typeof(null==(d=n.response.data)?void 0:d.Code)){r.n=1;break}return r.a(2,Promise.reject(n));case 1:h=d.Code,r.n=3===h?2:1===h?4:6;break;case 2:return r.n=3,o.signOut({returnUrl:o.getReturnUrl()});case 3:return r.a(3,7);case 4:return r.n=5,null===(v=o.userManager)||void 0===v?void 0:v.revokeTokens(["access_token"]);case 5:return window.location.replace(t.Origin("")),r.a(3,7);case 6:return window.location.replace(t.Origin(t.IdentityAccessDenied)),r.a(3,7);case 7:r.n=9;break;case 8:401===(null===(a=n.response)||void 0===a?void 0:a.status)||"ERR_CANCELED"===n.code||((null!==(s=null===(l=n.response)||void 0===l?void 0:l.status)&&void 0!==s?s:500)>=500?"ERR_CANCELED"!==n.code&&(null==i||null===(p=i.ApiAlert)||void 0===p||p.PushError("An error has occurred!")):404===(null===(c=n.response)||void 0===c?void 0:c.status)&&(null==i||null===(f=i.ApiAlert)||void 0===f||f.PushError("Resource not found!")));case 9:return r.a(2,Promise.reject(n))}},r)}));return function(r){return n.apply(this,arguments)}}();export{i as ApiAlertContext,a as fetchDelay,c as handleResponseError,l as processError,s as resolveBaseUrl,u as sleep};
2
2
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sources":["../../../../src/http-service/base/helpers.ts"],"sourcesContent":["import { AxiosError } from 'axios'\r\nimport { ApplicationPaths, authService } from 'partner-oidc-auth'\r\nimport type { IApiContext } from './type.api-alert'\r\n\r\nexport const ApiAlertContext = (globalThis as any).ApiAlertContext as IApiContext | undefined\r\n\r\nif (process.env.NODE_ENV === 'development') {\r\n ;(globalThis as any).authService = authService\r\n}\r\n\r\nexport const sleep = (sec: number) => new Promise((res) => setTimeout(res, sec))\r\n\r\nexport const fetchDelay = async function <TModel>(action: () => Promise<TModel>, sec: number) {\r\n const [res] = await Promise.all([action(), sleep(sec)])\r\n return res\r\n}\r\n\r\n/**\r\n * Resolves a base URL string into a full base URL.\r\n * - If `baseUri` is already a full URL, it is returned as-is.\r\n * - Otherwise it is prefixed with `REACT_APP_ADMIN_API` or `window.location.origin`.\r\n *\r\n * This lets callers pass either a full URL (e.g. `https://api.example.com/v1`) or\r\n * a path suffix (e.g. `/api/v1`) and get a proper base URL for the HTTP client.\r\n */\r\nexport const resolveBaseUrl = (baseUri: string) => {\r\n const prefix = process.env.APP_API_URL || window.location.origin || ''\r\n if (!baseUri) return prefix\r\n try {\r\n // new URL will succeed for absolute URLs like \"https://...\" or \"http://...\".\r\n // If it parses, treat it as a full URL and return as-is.\r\n new URL(baseUri)\r\n return baseUri\r\n } catch {\r\n // For relative paths, prefix with configured API base or current origin.\r\n return `${prefix}${baseUri}`\r\n }\r\n}\r\n\r\ninterface ErrorModel {\r\n [key: string]: string[]\r\n}\r\n\r\n/**\r\n * Processes axios errors and displays error messages to the user\r\n * @param err - The axios error containing response data\r\n */\r\nexport const processError = (err: AxiosError<ErrorModel>) => {\r\n const errorMessages = Object.values(err.response?.data?.errors ?? err.response?.data ?? {})\r\n .filter((x) => x.length > 0)\r\n .map((x) => x[0])\r\n if (errorMessages.length < 1) return\r\n ApiAlertContext?.ApiAlert?.PushError(errorMessages.join('\\n'))\r\n}\r\n\r\n/**\r\n * Checks if the current user's token is expired.\r\n * @returns {Promise<boolean>} True if token is expired or user not logged in, false otherwise.\r\n */\r\nexport const checkTokenExpiry = async () => {\r\n try {\r\n const user = await authService.getUser()\r\n if (!user) {\r\n console.log('No user is currently logged in.')\r\n return true\r\n }\r\n\r\n const now = Math.floor(Date.now() / 1000) // Current time in seconds since epoch\r\n const expiresIn = user.exp - now\r\n\r\n if (expiresIn <= 0) {\r\n console.log('The token has expired.')\r\n return true\r\n } else {\r\n console.log(`The token will expire in ${expiresIn} seconds.`)\r\n return false\r\n }\r\n } catch (error) {\r\n console.error('Error checking token expiry:', error)\r\n return true\r\n }\r\n}\r\n/**\r\n * Refreshes the token once if at least 4 seconds have passed since the last refresh.\r\n * Uses localStorage key 'ltt' to track last refresh time.\r\n */\r\nexport const refreshTokenOnce = async () => {\r\n const timeStamp = new Date().getTime() - parseInt(localStorage.getItem('ltt') ?? '0')\r\n localStorage.setItem('ltt', new Date().getTime().toString())\r\n if (timeStamp >= 4000) {\r\n try {\r\n await authService.ensureUserManagerInitialized()\r\n await authService.signIn({})\r\n } catch (e) {\r\n console.log(e)\r\n }\r\n }\r\n}\r\n/**\r\n * Handles errors from Axios HTTP responses.\r\n * Redirects or signs out user based on error code and status.\r\n * @param {AxiosError} err - The error object from Axios.\r\n * @returns {Promise<never>} Always rejects with the error.\r\n */\r\nexport const handleResponseError = async (err: AxiosError) => {\r\n if (err.response?.status === 403) {\r\n const dataError: { Code: number; Message: string } = err.response.data as any\r\n switch (dataError.Code) {\r\n case 3: {\r\n await authService.signOut({ returnUrl: authService.getReturnUrl() })\r\n break\r\n }\r\n case 1: {\r\n await authService.userManager?.revokeTokens(['access_token'])\r\n window.location.replace(ApplicationPaths.Origin(''))\r\n break\r\n }\r\n default: {\r\n window.location.replace(ApplicationPaths.Origin(ApplicationPaths.IdentityAccessDenied))\r\n break\r\n }\r\n }\r\n } else if (err.response?.status === 401) {\r\n } else if (err.code === 'ERR_CANCELED') {\r\n } else if ((err.response?.status ?? 500) >= 500) {\r\n if (err.code !== 'ERR_CANCELED') {\r\n ApiAlertContext?.ApiAlert?.PushError('An error has occurred!')\r\n }\r\n } else if (err.response?.status === 404) {\r\n ApiAlertContext?.ApiAlert?.PushError('Resource not found!')\r\n }\r\n return Promise.reject(err)\r\n}\r\n"],"names":["ApiAlertContext","globalThis","process","env","NODE_ENV","authService","sleep","sec","Promise","res","setTimeout","fetchDelay","_ref","_asyncToGenerator","_regenerator","m","_callee","action","_yield$Promise$all","_yield$Promise$all2","w","_context","n","all","v","_slicedToArray","a","_x","_x2","apply","this","arguments","resolveBaseUrl","baseUri","prefix","APP_API_URL","window","location","origin","URL","_unused","concat","processError","err","_ref2","_err$response$data$er","_err$response","_err$response2","_ApiAlertContext$ApiA","errorMessages","Object","values","response","data","errors","filter","x","length","map","ApiAlert","PushError","join","handleResponseError","_ref5","_callee4","_err$response3","_err$response4","_err$response$status","_err$response5","_err$response6","dataError","_authService$userMana","_ApiAlertContext$ApiA2","_ApiAlertContext$ApiA3","_t3","_context4","status","Code","signOut","returnUrl","getReturnUrl","userManager","revokeTokens","replace","ApplicationPaths","Origin","IdentityAccessDenied","code","reject","_x3"],"mappings":"4LAIaA,IAAAA,EAAmBC,WAAmBD,gBAEtB,gBAAzBE,QAAQC,IAAIC,WACZH,WAAmBI,YAAcA,OAGxBC,EAAQ,SAACC,GAAW,OAAK,IAAIC,QAAQ,SAACC,GAAG,OAAKC,WAAWD,EAAKF,IAAK,EAEnEI,EAAU,WAAA,IAAAC,EAAAC,EAAAC,IAAAC,EAAG,SAAAC,EAAwBC,EAA+BV,GAAW,IAAAW,EAAAC,EAAAV,EAAA,OAAAK,IAAAM,EAAA,SAAAC,GAAA,cAAAA,EAAAC,GAAA,KAAA,EAAA,OAAAD,EAAAC,EAAA,EACtEd,QAAQe,IAAI,CAACN,IAAUX,EAAMC,KAAM,KAAA,EAA7C,OAA6CW,EAAAG,EAAAG,EAAAL,EAAAM,EAAAP,EAAA,GAAhDT,EAAGU,EAAA,GAAAE,EAAAK,EAAA,EACHjB,GAAG,EAAAO,MACX,OAAA,SAHsBW,EAAAC,GAAA,OAAAhB,EAAAiB,MAAAC,KAAAC,UAAA,CAAA,CAAA,GAaVC,EAAiB,SAACC,GAC7B,IAAMC,EAAShC,QAAQC,IAAIgC,aAAeC,OAAOC,SAASC,QAAU,GACpE,IAAKL,EAAS,OAAOC,EACrB,IAIE,OADA,IAAIK,IAAIN,GACDA,CACR,CAAC,MAAAO,GAEA,MAAA,GAAAC,OAAUP,GAAMO,OAAGR,EACpB,CACH,EAUaS,EAAe,SAACC,GAA+B,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EACpDC,EAAgBC,OAAOC,OAAuDP,QAAjDA,EAA2BC,QAA3BA,EAAa,QAAbC,EAACH,EAAIS,gBAAQ,IAAAN,GAAM,QAANA,EAAZA,EAAcO,YAAI,IAAAP,OAAA,EAAlBA,EAAo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EAAAjD,EAAA,EAAA,GAAA,KAAA,EAAAiD,EAAArD,EAAA,EAAA,MAAA,KAAA,EAIzD,OAAb,QAAZ4C,EAAAvB,EAAIS,gBAAQ,IAAAc,OAAA,EAAZA,EAAcU,SACD,iBAAbjC,EAAI4C,QACiB,QAArBpB,EAAaC,QAAbA,EAACzB,EAAIS,oBAAQgB,SAAZA,EAAcQ,cAAM,IAAAT,EAAAA,EAAI,MAAQ,IACzB,iBAAbxB,EAAI4C,OACNvF,SAAyBwE,QAAVA,EAAfxE,EAAiB2D,oBAAQa,GAAzBA,EAA2BZ,UAAU,2BAEL,OAAbS,QAAZA,EAAA1B,EAAIS,oBAAQiB,SAAZA,EAAcO,UACvB5E,SAAyByE,QAAVA,EAAfzE,EAAiB2D,oBAAQc,GAAzBA,EAA2Bb,UAAU,yBACtC,KAAA,EAAA,OAAAe,EAAAjD,EAAA,EACMlB,QAAQgF,OAAO7C,IAAI,EAAAqB,MAC3B,OA5BYF,SAAmB2B,GAAA,OAAA1B,EAAAlC,MAAAC,KAAAC,UAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"helpers.js","sources":["../../../../src/http-service/base/helpers.ts"],"sourcesContent":["import { AxiosError } from 'axios'\r\nimport { ApplicationPaths, authService } from 'partner-oidc-auth'\r\nimport type { IApiContext } from './type.api-alert'\r\n\r\nexport const ApiAlertContext = (globalThis as any).ApiAlertContext as IApiContext | undefined\r\n\r\nif (process.env.NODE_ENV === 'development') {\r\n ;(globalThis as any).authService = authService\r\n}\r\n\r\nexport const sleep = (sec: number) => new Promise((res) => setTimeout(res, sec))\r\n\r\nexport const fetchDelay = async function <TModel>(action: () => Promise<TModel>, sec: number) {\r\n const [res] = await Promise.all([action(), sleep(sec)])\r\n return res\r\n}\r\n\r\n/**\r\n * Resolves a base URL string into a full base URL.\r\n * - If `baseUri` is already a full URL, it is returned as-is.\r\n * - Otherwise it is prefixed with `REACT_APP_ADMIN_API` or `window.location.origin`.\r\n *\r\n * This lets callers pass either a full URL (e.g. `https://api.example.com/v1`) or\r\n * a path suffix (e.g. `/api/v1`) and get a proper base URL for the HTTP client.\r\n */\r\nexport const resolveBaseUrl = (baseUri: string) => {\r\n const prefix = process.env.APP_API_URL || window.location.origin || ''\r\n if (!baseUri) return prefix\r\n try {\r\n // new URL will succeed for absolute URLs like \"https://...\" or \"http://...\".\r\n // If it parses, treat it as a full URL and return as-is.\r\n new URL(baseUri)\r\n return baseUri\r\n } catch {\r\n // For relative paths, prefix with configured API base or current origin.\r\n return `${prefix}${baseUri}`\r\n }\r\n}\r\n\r\ninterface ErrorModel {\r\n [key: string]: string[]\r\n}\r\n\r\n/**\r\n * Processes axios errors and displays error messages to the user\r\n * @param err - The axios error containing response data\r\n */\r\nexport const processError = (err: AxiosError<ErrorModel>) => {\r\n const errorMessages = Object.values(err.response?.data?.errors ?? err.response?.data ?? {})\r\n .filter((x) => x.length > 0)\r\n .map((x) => x[0])\r\n if (errorMessages.length < 1) return\r\n ApiAlertContext?.ApiAlert?.PushError(errorMessages.join('\\n'))\r\n}\r\n\r\n/**\r\n * Checks if the current user's token is expired.\r\n * @returns {Promise<boolean>} True if token is expired or user not logged in, false otherwise.\r\n */\r\nexport const checkTokenExpiry = async () => {\r\n try {\r\n const user = await authService.getUser()\r\n if (!user) {\r\n console.log('No user is currently logged in.')\r\n return true\r\n }\r\n\r\n const now = Math.floor(Date.now() / 1000) // Current time in seconds since epoch\r\n const expiresIn = user.exp - now\r\n\r\n if (expiresIn <= 0) {\r\n console.log('The token has expired.')\r\n return true\r\n } else {\r\n console.log(`The token will expire in ${expiresIn} seconds.`)\r\n return false\r\n }\r\n } catch (error) {\r\n console.error('Error checking token expiry:', error)\r\n return true\r\n }\r\n}\r\n/**\r\n * Refreshes the token once if at least 4 seconds have passed since the last refresh.\r\n * Uses localStorage key 'ltt' to track last refresh time.\r\n */\r\nexport const refreshTokenOnce = async () => {\r\n const timeStamp = new Date().getTime() - parseInt(localStorage.getItem('ltt') ?? '0')\r\n localStorage.setItem('ltt', new Date().getTime().toString())\r\n if (timeStamp >= 4000) {\r\n try {\r\n await authService.ensureUserManagerInitialized()\r\n await authService.signIn({})\r\n } catch (e) {\r\n console.log(e)\r\n }\r\n }\r\n}\r\n/**\r\n * Handles errors from Axios HTTP responses.\r\n * Redirects or signs out user based on error code and status.\r\n * @param {AxiosError} err - The error object from Axios.\r\n * @returns {Promise<never>} Always rejects with the error.\r\n */\r\nexport const handleResponseError = async (err: AxiosError) => {\r\n if (err.response?.status === 403) {\r\n const dataError: { Code: number; Message: string } = err.response.data as any\r\n if (typeof dataError?.Code !== 'number') return Promise.reject(err)\r\n switch (dataError.Code) {\r\n case 3: {\r\n await authService.signOut({ returnUrl: authService.getReturnUrl() })\r\n break\r\n }\r\n case 1: {\r\n await authService.userManager?.revokeTokens(['access_token'])\r\n window.location.replace(ApplicationPaths.Origin(''))\r\n break\r\n }\r\n default: {\r\n window.location.replace(ApplicationPaths.Origin(ApplicationPaths.IdentityAccessDenied))\r\n break\r\n }\r\n }\r\n } else if (err.response?.status === 401) {\r\n } else if (err.code === 'ERR_CANCELED') {\r\n } else if ((err.response?.status ?? 500) >= 500) {\r\n if (err.code !== 'ERR_CANCELED') {\r\n ApiAlertContext?.ApiAlert?.PushError('An error has occurred!')\r\n }\r\n } else if (err.response?.status === 404) {\r\n ApiAlertContext?.ApiAlert?.PushError('Resource not found!')\r\n }\r\n return Promise.reject(err)\r\n}\r\n"],"names":["ApiAlertContext","globalThis","process","env","NODE_ENV","authService","sleep","sec","Promise","res","setTimeout","fetchDelay","_ref","_asyncToGenerator","_regenerator","m","_callee","action","_yield$Promise$all","_yield$Promise$all2","w","_context","n","all","v","_slicedToArray","a","_x","_x2","apply","this","arguments","resolveBaseUrl","baseUri","prefix","APP_API_URL","window","location","origin","URL","_unused","concat","processError","err","_ref2","_err$response$data$er","_err$response","_err$response2","_ApiAlertContext$ApiA","errorMessages","Object","values","response","data","errors","filter","x","length","map","ApiAlert","PushError","join","handleResponseError","_ref5","_callee4","_err$response3","_err$response4","_err$response$status","_err$response5","_err$response6","dataError","_authService$userMana","_ApiAlertContext$ApiA2","_ApiAlertContext$ApiA3","_t3","_context4","status","Code","reject","signOut","returnUrl","getReturnUrl","userManager","revokeTokens","replace","ApplicationPaths","Origin","IdentityAccessDenied","code","_x3"],"mappings":"4LAIaA,IAAAA,EAAmBC,WAAmBD,gBAEtB,gBAAzBE,QAAQC,IAAIC,WACZH,WAAmBI,YAAcA,OAGxBC,EAAQ,SAACC,GAAW,OAAK,IAAIC,QAAQ,SAACC,GAAG,OAAKC,WAAWD,EAAKF,IAAK,EAEnEI,EAAU,WAAA,IAAAC,EAAAC,EAAAC,IAAAC,EAAG,SAAAC,EAAwBC,EAA+BV,GAAW,IAAAW,EAAAC,EAAAV,EAAA,OAAAK,IAAAM,EAAA,SAAAC,GAAA,cAAAA,EAAAC,GAAA,KAAA,EAAA,OAAAD,EAAAC,EAAA,EACtEd,QAAQe,IAAI,CAACN,IAAUX,EAAMC,KAAM,KAAA,EAA7C,OAA6CW,EAAAG,EAAAG,EAAAL,EAAAM,EAAAP,EAAA,GAAhDT,EAAGU,EAAA,GAAAE,EAAAK,EAAA,EACHjB,GAAG,EAAAO,MACX,OAAA,SAHsBW,EAAAC,GAAA,OAAAhB,EAAAiB,MAAAC,KAAAC,UAAA,CAAA,CAAA,GAaVC,EAAiB,SAACC,GAC7B,IAAMC,EAAShC,QAAQC,IAAIgC,aAAeC,OAAOC,SAASC,QAAU,GACpE,IAAKL,EAAS,OAAOC,EACrB,IAIE,OADA,IAAIK,IAAIN,GACDA,CACR,CAAC,MAAAO,GAEA,MAAA,GAAAC,OAAUP,GAAMO,OAAGR,EACpB,CACH,EAUaS,EAAe,SAACC,GAA+B,IAAAC,EAAAC,EAAAC,EAAAC,EAAAC,EACpDC,EAAgBC,OAAOC,OAAuDP,QAAjDA,EAA2BC,QAA3BA,EAAa,QAAbC,EAACH,EAAIS,gBAAQ,IAAAN,GAAM,QAANA,EAAZA,EAAcO,YAA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AgB,KAAA,EACT,OAApD/C,OAAOC,SAAS+C,QAAQC,EAAiBC,OAAO,KAAIX,EAAAjD,EAAA,EAAA,GAAA,KAAA,EAImC,OAAvFU,OAAOC,SAAS+C,QAAQC,EAAiBC,OAAOD,EAAiBE,uBAAsBZ,EAAAjD,EAAA,EAAA,GAAA,KAAA,EAAAiD,EAAArD,EAAA,EAAA,MAAA,KAAA,EAIzD,OAAb,QAAZ4C,EAAAvB,EAAIS,gBAAQ,IAAAc,OAAA,EAAZA,EAAcU,SACD,iBAAbjC,EAAI6C,QACiB,QAArBrB,EAAaC,QAAbA,EAACzB,EAAIS,oBAAQgB,SAAZA,EAAcQ,cAAM,IAAAT,EAAAA,EAAI,MAAQ,IACzB,iBAAbxB,EAAI6C,OACNxF,SAAyBwE,QAAVA,EAAfxE,EAAiB2D,oBAAQa,GAAzBA,EAA2BZ,UAAU,2BAEL,OAAbS,QAAZA,EAAA1B,EAAIS,oBAAQiB,SAAZA,EAAcO,UACvB5E,SAAyByE,QAAVA,EAAfzE,EAAiB2D,oBAAQc,GAAzBA,EAA2Bb,UAAU,yBACtC,KAAA,EAAA,OAAAe,EAAAjD,EAAA,EACMlB,QAAQsE,OAAOnC,IAAI,EAAAqB,MAC3B,OA7BYF,SAAmB2B,GAAA,OAAA1B,EAAAlC,MAAAC,KAAAC,UAAA,CAAA,CAAA"}
@@ -1,2 +1,2 @@
1
- import{inherits as e,createClass as t,superPropGet as r,typeof as i,objectWithoutProperties as n,objectSpread2 as o,classCallCheck as a,callSuper as s,defineProperty as u}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as l,Fragment as c}from"react/jsx-runtime";import f from"events";import{forwardRef as v,useEffect as p}from"react";var g=["onClick","routeKey"],h=function(){function i(){var e;return a(this,i),e=s(this,i),u(e,"_createWrapListener",function(e){return function(){try{e.apply(void 0,arguments)}catch(e){console.error("Error in MfeBridge listener:",e)}}}),e}return e(i,f),t(i,[{key:"subscribe",value:function(e,t){var n=this,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?this._createWrapListener(t):t;return r(i,"addListener",this)([e,o]),function(){r(i,"removeListener",n)([e,o])}}}])}();function d(){if(void 0===("undefined"==typeof globalThis?"undefined":i(globalThis)))return null;void 0===globalThis.MfeNavigationEventStore&&(globalThis.MfeNavigationEventStore=new h);var e=globalThis.MfeNavigationEventStore;return e.setMaxListeners(50),e}var m=function(e){return p(function(){var t=d();if(t){var r=t.subscribe("navigation",function(t){e.navigation&&e.navigation(t.routeKey,t.options)});return function(){r()}}},[]),l(c,{})},b=v(function(e,t){var r=e.onClick,i=e.routeKey,a=n(e,g);return l("a",o(o({},a),{},{ref:t,onClick:function(e){if(r&&r(e),!e.defaultPrevented){var t=d();if(t&&i){e.preventDefault(),e.stopPropagation();var n=a.target,o=a.rel,s=a.href,u={message:"Link clicked"};n&&(u.target=n),o&&(u.rel=o),s&&(u.href=s),t.emit("navigation",{routeKey:i,options:u})}}}}))}),y=function(e,t){var r=d();r&&r.emit("navigation",{routeKey:e,options:o({message:"Navigating to ".concat(e)},t)})};export{b as MfeLink,h as MfeNavigationEventStore,m as MfeNavigationProvider,d as getMfeNavigationEventStore,y as mfeNavigation};
1
+ import{inherits as e,createClass as t,superPropGet as r,typeof as i,objectWithoutProperties as n,objectSpread2 as o,classCallCheck as a,callSuper as s,defineProperty as u}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as l,Fragment as c}from"react/jsx-runtime";import f from"events";import{forwardRef as v,useEffect as p}from"react";var g=["onClick","routeKey","site"],h=function(){function i(){var e;return a(this,i),e=s(this,i),u(e,"_createWrapListener",function(e){return function(){try{e.apply(void 0,arguments)}catch(e){console.error("Error in MfeBridge listener:",e)}}}),e}return e(i,f),t(i,[{key:"subscribe",value:function(e,t){var n=this,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2]?this._createWrapListener(t):t;return r(i,"addListener",this)([e,o]),function(){r(i,"removeListener",n)([e,o])}}}])}();function d(){if(void 0===("undefined"==typeof globalThis?"undefined":i(globalThis)))return null;void 0===globalThis.MfeNavigationEventStore&&(globalThis.MfeNavigationEventStore=new h);var e=globalThis.MfeNavigationEventStore;return e.setMaxListeners(50),e}var m=function(e){return p(function(){var t=d();if(t){var r=t.subscribe("navigation",function(t){e.navigation&&e.navigation(t.routeKey,t.options)});return function(){r()}}},[]),l(c,{})},b=v(function(e,t){var r=e.onClick,i=e.routeKey,a=e.site,s=n(e,g);return l("a",o(o({},s),{},{ref:t,onClick:function(e){if(r&&r(e),!e.defaultPrevented){var t=d();if(t&&i){e.preventDefault(),e.stopPropagation();var n=s.target,o=s.rel,u=s.href,l={message:"Link clicked"};n&&(l.target=n),o&&(l.rel=o),u&&(l.href=u),a&&(l.site=a),t.emit("navigation",{routeKey:i,options:l})}}}}))}),y=function(e,t){var r=d();r&&r.emit("navigation",{routeKey:e,options:o({message:"Navigating to ".concat(e)},t)})};export{b as MfeLink,h as MfeNavigationEventStore,m as MfeNavigationProvider,d as getMfeNavigationEventStore,y as mfeNavigation};
2
2
  //# sourceMappingURL=navigation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"navigation.js","sources":["../../../src/mfe-shared/navigation.tsx"],"sourcesContent":["import EventEmitter from 'events'\r\nimport { FC, forwardRef, useEffect } from 'react'\r\n\r\ninterface IEventOptions {\r\n message?: string\r\n href?: string\r\n target?: string\r\n rel?: string\r\n}\r\n\r\nexport interface IMfeNavigationEventConfigs {\r\n navigation: [{ routeKey?: string; options?: IEventOptions }]\r\n}\r\n\r\nexport class MfeNavigationEventStore extends EventEmitter<IMfeNavigationEventConfigs> {\r\n constructor() {\r\n super()\r\n }\r\n /**\r\n * Subscribe to a specific channel\r\n * @param channel The channel to subscribe to\r\n * @param callback Function to call when an event occurs on this channel\r\n * @returns Unsubscribe function to remove the event listener\r\n */\r\n _createWrapListener = (callback: (...payload: any[]) => void) => {\r\n return (...payload: any[]) => {\r\n try {\r\n callback(...payload)\r\n } catch (error) {\r\n console.error('Error in MfeBridge listener:', error)\r\n }\r\n }\r\n }\r\n subscribe<K extends keyof IMfeNavigationEventConfigs>(\r\n eventName: K,\r\n listener: K extends keyof IMfeNavigationEventConfigs\r\n ? IMfeNavigationEventConfigs[K] extends unknown[]\r\n ? (...args: IMfeNavigationEventConfigs[K]) => void\r\n : never\r\n : never,\r\n isTry: boolean = true\r\n ) {\r\n const action = isTry ? this._createWrapListener(listener) : listener\r\n super.addListener(eventName, action as any)\r\n return () => {\r\n super.removeListener(eventName, action as any)\r\n }\r\n }\r\n}\r\n\r\nexport function getMfeNavigationEventStore() {\r\n if (typeof globalThis === undefined) return null\r\n\r\n if (typeof (globalThis as any).MfeNavigationEventStore === 'undefined') {\r\n // If MfeNavigationEventStore is not defined globally, define it\r\n // This allows it to be used in other parts of the application\r\n // without needing to import it explicitly\r\n ;(globalThis as any).MfeNavigationEventStore = new MfeNavigationEventStore()\r\n }\r\n const eventEmitter = (globalThis as any).MfeNavigationEventStore as MfeNavigationEventStore\r\n eventEmitter.setMaxListeners(50)\r\n return eventEmitter\r\n}\r\n\r\ntype INavigationFunction = (routeKey?: string, options?: IEventOptions) => void\r\n\r\nexport interface IMfeNavigationProviderProps {\r\n navigation?: INavigationFunction\r\n}\r\n\r\nexport const MfeNavigationProvider: FC<IMfeNavigationProviderProps> = (props) => {\r\n useEffect(() => {\r\n const eventStore = getMfeNavigationEventStore()\r\n if (!eventStore) return\r\n\r\n const unsubscribe = eventStore.subscribe('navigation', (payload) => {\r\n if (props.navigation) {\r\n props.navigation(payload.routeKey, payload.options)\r\n }\r\n })\r\n\r\n return () => {\r\n unsubscribe()\r\n }\r\n }, [])\r\n\r\n return <></>\r\n}\r\n\r\nexport interface IMfeLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\r\n routeKey?: string\r\n}\r\n\r\nexport const MfeLink = forwardRef<HTMLAnchorElement, IMfeLinkProps>(({ onClick, routeKey, ...props }, ref) => {\r\n const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {\r\n if (onClick) {\r\n onClick(event)\r\n }\r\n if (event.defaultPrevented) {\r\n return // nothing to do if event already handled\r\n }\r\n const eventStore = getMfeNavigationEventStore()\r\n if (eventStore && !!routeKey) {\r\n event.preventDefault() // Prevent default link behavior\r\n event.stopPropagation() // Stop the event from bubbling up\r\n const { target, rel, href } = props\r\n const options: IEventOptions = { message: 'Link clicked' }\r\n if (target) options.target = target\r\n if (rel) options.rel = rel\r\n if (href) options.href = href\r\n eventStore.emit('navigation', { routeKey: routeKey, options })\r\n }\r\n }\r\n return <a {...props} ref={ref} onClick={handleClick} />\r\n})\r\n\r\nexport const mfeNavigation = (routeKey: string, options?: IEventOptions) => {\r\n const eventStore = getMfeNavigationEventStore()\r\n if (eventStore) {\r\n eventStore.emit('navigation', { routeKey: routeKey, options: { message: `Navigating to ${routeKey}`, ...options } })\r\n }\r\n}\r\n"],"names":["MfeNavigationEventStore","_this","_classCallCheck","_callSuper","this","_defineProperty","callback","apply","arguments","error","console","_inherits","EventEmitter","_createClass","key","value","eventName","listener","_this2","action","_createWrapListener","_superPropGet","getMfeNavigationEventStore","undefined","globalThis","_typeof","eventEmitter","setMaxListeners","MfeNavigationProvider","props","useEffect","eventStore","unsubscribe","subscribe","payload","navigation","routeKey","options","_jsx","MfeLink","forwardRef","_ref","ref","onClick","_objectWithoutProperties","_excluded","_objectSpread","event","defaultPrevented","preventDefault","stopPropagation","target","rel","href","message","emit","mfeNavigation","concat"],"mappings":"wXAcaA,aACX,SAAAA,IAAA,IAAAC,EAiBC,OAjBDC,OAAAF,GACEC,EAAAE,EAAAC,KAAAJ,GAEFK,EAAAJ,EAMsB,sBAAA,SAACK,GACrB,OAAO,WACL,IACEA,EAAQC,WAAAC,EAAAA,UACT,CAAC,MAAOC,GACPC,QAAQD,MAAM,+BAAgCA,EAC/C,CACF,IACFR,CAfD,CAAC,OAAAU,EAAAX,EAH0CY,GAG1CC,EAAAb,EAAA,CAAA,CAAAc,IAAA,YAAAC,MAgBD,SACEC,EACAC,GAKqB,IAAAC,EAA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,GACrD,CAXA,CAYF,IAEH,GAEamB,EAAgB,SAACpB,EAAkBC,GAC9C,IAAMN,EAAaT,IACfS,GACFA,EAAWwB,KAAK,aAAc,CAAEnB,SAAUA,EAAUC,QAAOS,EAAA,CAAIQ,QAAO,iBAAAG,OAAmBrB,IAAeC,IAE5G"}
1
+ {"version":3,"file":"navigation.js","sources":["../../../src/mfe-shared/navigation.tsx"],"sourcesContent":["import EventEmitter from 'events'\r\nimport { FC, forwardRef, useEffect } from 'react'\r\n\r\nexport type TSite = 'admin' | 'client' | 'music' | 'home' | (string & {})\r\n\r\ninterface IEventOptions {\r\n message?: string\r\n href?: string\r\n target?: string\r\n rel?: string\r\n site?: TSite\r\n}\r\n\r\nexport interface IMfeNavigationEventConfigs {\r\n navigation: [{ routeKey?: string; options?: IEventOptions }]\r\n}\r\n\r\nexport class MfeNavigationEventStore extends EventEmitter<IMfeNavigationEventConfigs> {\r\n constructor() {\r\n super()\r\n }\r\n /**\r\n * Subscribe to a specific channel\r\n * @param channel The channel to subscribe to\r\n * @param callback Function to call when an event occurs on this channel\r\n * @returns Unsubscribe function to remove the event listener\r\n */\r\n _createWrapListener = (callback: (...payload: any[]) => void) => {\r\n return (...payload: any[]) => {\r\n try {\r\n callback(...payload)\r\n } catch (error) {\r\n console.error('Error in MfeBridge listener:', error)\r\n }\r\n }\r\n }\r\n subscribe<K extends keyof IMfeNavigationEventConfigs>(\r\n eventName: K,\r\n listener: K extends keyof IMfeNavigationEventConfigs\r\n ? IMfeNavigationEventConfigs[K] extends unknown[]\r\n ? (...args: IMfeNavigationEventConfigs[K]) => void\r\n : never\r\n : never,\r\n isTry: boolean = true\r\n ) {\r\n const action = isTry ? this._createWrapListener(listener) : listener\r\n super.addListener(eventName, action as any)\r\n return () => {\r\n super.removeListener(eventName, action as any)\r\n }\r\n }\r\n}\r\n\r\nexport function getMfeNavigationEventStore() {\r\n if (typeof globalThis === undefined) return null\r\n\r\n if (typeof (globalThis as any).MfeNavigationEventStore === 'undefined') {\r\n // If MfeNavigationEventStore is not defined globally, define it\r\n // This allows it to be used in other parts of the application\r\n // without needing to import it explicitly\r\n ;(globalThis as any).MfeNavigationEventStore = new MfeNavigationEventStore()\r\n }\r\n const eventEmitter = (globalThis as any).MfeNavigationEventStore as MfeNavigationEventStore\r\n eventEmitter.setMaxListeners(50)\r\n return eventEmitter\r\n}\r\n\r\ntype INavigationFunction = (routeKey?: string, options?: IEventOptions) => void\r\n\r\nexport interface IMfeNavigationProviderProps {\r\n navigation?: INavigationFunction\r\n}\r\n\r\nexport const MfeNavigationProvider: FC<IMfeNavigationProviderProps> = (props) => {\r\n useEffect(() => {\r\n const eventStore = getMfeNavigationEventStore()\r\n if (!eventStore) return\r\n\r\n const unsubscribe = eventStore.subscribe('navigation', (payload) => {\r\n if (props.navigation) {\r\n props.navigation(payload.routeKey, payload.options)\r\n }\r\n })\r\n\r\n return () => {\r\n unsubscribe()\r\n }\r\n }, [])\r\n\r\n return <></>\r\n}\r\n\r\nexport interface IMfeLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\r\n routeKey?: string\r\n site?: TSite\r\n}\r\n\r\nexport const MfeLink = forwardRef<HTMLAnchorElement, IMfeLinkProps>(({ onClick, routeKey, site, ...props }, ref) => {\r\n const handleClick = (event: React.MouseEvent<HTMLAnchorElement>) => {\r\n if (onClick) {\r\n onClick(event)\r\n }\r\n if (event.defaultPrevented) {\r\n return // nothing to do if event already handled\r\n }\r\n const eventStore = getMfeNavigationEventStore()\r\n if (eventStore && !!routeKey) {\r\n event.preventDefault() // Prevent default link behavior\r\n event.stopPropagation() // Stop the event from bubbling up\r\n const { target, rel, href } = props\r\n const options: IEventOptions = { message: 'Link clicked' }\r\n if (target) options.target = target\r\n if (rel) options.rel = rel\r\n if (href) options.href = href\r\n if (site) options.site = site\r\n eventStore.emit('navigation', { routeKey: routeKey, options })\r\n }\r\n }\r\n return <a {...props} ref={ref} onClick={handleClick} />\r\n})\r\n\r\nexport const mfeNavigation = (routeKey: string, options?: IEventOptions) => {\r\n const eventStore = getMfeNavigationEventStore()\r\n if (eventStore) {\r\n eventStore.emit('navigation', { routeKey: routeKey, options: { message: `Navigating to ${routeKey}`, ...options } })\r\n }\r\n}\r\n"],"names":["MfeNavigationEventStore","_this","_classCallCheck","_callSuper","this","_defineProperty","callback","apply","arguments","error","console","_inherits","EventEmitter","_createClass","key","value","eventName","listener","_this2","action","_createWrapListener","_superPropGet","getMfeNavigationEventStore","undefined","globalThis","_typeof","eventEmitter","setMaxListeners","MfeNavigationProvider","props","useEffect","eventStore","unsubscribe","subscribe","payload","navigation","routeKey","options","_jsx","MfeLink","forwardRef","_ref","ref","onClick","site","_objectWithoutProperties","_excluded","_objectSpread","event","defaultPrevented","preventDefault","stopPropagation","target","rel","href","message","emit","mfeNavigation","concat"],"mappings":"+XAiBaA,aACX,SAAAA,IAAA,IAAAC,EAiBC,OAjBDC,OAAAF,GACEC,EAAAE,EAAAC,KAAAJ,GAEFK,EAAAJ,EAMsB,sBAAA,SAACK,GACrB,OAAO,WACL,IACEA,EAAQC,WAAAC,EAAAA,UACT,CAAC,MAAOC,GACPC,QAAQD,MAAM,+BAAgCA,EAC/C,CACF,IACFR,CAfD,CAAC,OAAAU,EAAAX,EAH0CY,GAG1CC,EAAAb,EAAA,CAAA,CAAAc,IAAA,YAAAC,MAgBD,SACEC,EACAC,GAKqB,IAAAC,EAAAd,KAEfe,6DAAiBf,KAAKgB,oBAAoBH,GAAYA,EAE5D,OADAI,EAAArB,EAAkBgB,cAAAA,KAAlBK,CAAkBL,CAAAA,EAAWG,IACtB,WACLE,EAAArB,EAAA,iBAAAkB,EAAAG,CAAqBL,CAAAA,EAAWG,GACjC,CACH,IAAC,aAGaG,IACd,QAA0BC,KAAL,oBAAVC,WAAU,YAAAC,EAAVD,aAA0B,OAAO,UAEe,IAA/CA,WAAmBxB,0BAI3BwB,WAAmBxB,wBAA0B,IAAIA,GAErD,IAAM0B,EAAgBF,WAAmBxB,wBAEzC,OADA0B,EAAaC,gBAAgB,IACtBD,CACT,KAQaE,EAAyD,SAACC,GAgBrE,OAfAC,EAAU,WACR,IAAMC,EAAaT,IACnB,GAAKS,EAAL,CAEA,IAAMC,EAAcD,EAAWE,UAAU,aAAc,SAACC,GAClDL,EAAMM,YACRN,EAAMM,WAAWD,EAAQE,SAAUF,EAAQG,QAE/C,GAEA,OAAO,WACLL,GACD,CAVgB,CAWlB,EAAE,IAEIM,OACT,EAOaC,EAAUC,EAA6C,SAAAC,EAAwCC,GAAO,IAA5CC,EAAOF,EAAPE,QAASP,EAAQK,EAARL,SAAUQ,EAAIH,EAAJG,KAASf,EAAKgB,EAAAJ,EAAAK,GAqBtG,OAAOR,EAAA,IAAAS,EAAAA,KAAOlB,GAAK,GAAA,CAAEa,IAAKA,EAAKC,QApBX,SAACK,GAInB,GAHIL,GACFA,EAAQK,IAENA,EAAMC,iBAAV,CAGA,IAAMlB,EAAaT,IACnB,GAAIS,GAAgBK,EAAU,CAC5BY,EAAME,iBACNF,EAAMG,kBACN,IAAQC,EAAsBvB,EAAtBuB,OAAQC,EAAcxB,EAAdwB,IAAKC,EAASzB,EAATyB,KACfjB,EAAyB,CAAEkB,QAAS,gBACtCH,IAAQf,EAAQe,OAASA,GACzBC,IAAKhB,EAAQgB,IAAMA,GACnBC,IAAMjB,EAAQiB,KAAOA,GACrBV,IAAMP,EAAQO,KAAOA,GACzBb,EAAWyB,KAAK,aAAc,CAAEpB,SAAUA,EAAUC,QAAAA,GACrD,CAZA,CAaF,IAEH,GAEaoB,EAAgB,SAACrB,EAAkBC,GAC9C,IAAMN,EAAaT,IACfS,GACFA,EAAWyB,KAAK,aAAc,CAAEpB,SAAUA,EAAUC,QAAOU,EAAA,CAAIQ,QAAO,iBAAAG,OAAmBtB,IAAeC,IAE5G"}
@@ -1,11 +1,13 @@
1
1
  /// <reference types="node" />
2
2
  import EventEmitter from 'events';
3
3
  import { FC } from 'react';
4
+ export type TSite = 'admin' | 'client' | 'music' | 'home' | (string & {});
4
5
  interface IEventOptions {
5
6
  message?: string;
6
7
  href?: string;
7
8
  target?: string;
8
9
  rel?: string;
10
+ site?: TSite;
9
11
  }
10
12
  export interface IMfeNavigationEventConfigs {
11
13
  navigation: [{
@@ -32,6 +34,7 @@ export interface IMfeNavigationProviderProps {
32
34
  export declare const MfeNavigationProvider: FC<IMfeNavigationProviderProps>;
33
35
  export interface IMfeLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
34
36
  routeKey?: string;
37
+ site?: TSite;
35
38
  }
36
39
  export declare const MfeLink: import("react").ForwardRefExoticComponent<IMfeLinkProps & import("react").RefAttributes<HTMLAnchorElement>>;
37
40
  export declare const mfeNavigation: (routeKey: string, options?: IEventOptions) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dinocollab-core",
3
- "version": "2.1.39",
3
+ "version": "2.1.41",
4
4
  "description": "Dinocollab core - libraries for building collaborative applications with React 18",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",