Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • applications/etuc/hubl
  • applications/hubl
  • decentral1se/hubl
  • rngadam/hubl
  • jvtrudel/hubl
  • 3wc/hubl
6 results
Show changes
Showing
with 223 additions and 453 deletions
File deleted
This diff is collapsed.
File deleted
File deleted
File deleted
-
var __env = locals[process.env.ENV]
for(k in __env){
eval(`var ${k} = __env[${JSON.stringify(k)}]`);
}
\ No newline at end of file
#logo
sib-link(next='members')
img(src='/images/logo.png' width=111 height=32)
//- #search-bar
//- input#search-input(type='search')
//- i#search-icon.icon-magnifier(aria-hidden='true')
//- i#close-search-icon.icon-close(aria-hidden='true')
sib-notifications(
nested-field="inbox"
bind-user
)
include templates/hd-user-avatar.pug
details#user-controls
summary(tabindex='0' role='button')
sib-display#user-controls__profile(
fields='firstName, account.picture'
extra-context='{firstName:"first_name"}'
widget-account.picture='hd-user-avatar'
bind-user
)
#user-controls__panel
include page-user-panel.pug
button(role='log in' onclick="document.querySelector('sib-auth').login();") Login
sib-auth
sib-auth-provider(
data-authority=`${authority}`
data-id=`${authorityName || "paris"}`
data-client-name=`${clientName || "SIB App"}`
)
const convertStringToBoolean = (value) => {
if (typeof value === "string") {
if (value.toLowerCase() === "false") {
return false;
}
if (value.toLowerCase() === "true") {
return true;
}
}
return value;
};
export default convertStringToBoolean;
/**
* Generates a unique random string using the Math.random() method.
*
* @return {string} A unique random string.
*/
export default function generateUniq() {
return Math.random().toString(16).slice(2);
}
/**
* Generates an array of URL objects based on the provided federation and path.
*
* @param {Array<string>} federation - An array of federation base URLs.
* @param {string} path - The path to be appended to each federation base URL.
* @returns {Array<Object>} An array of objects, each containing the generated URL and type.
*/
const generateUrl = (federation, path) => {
const result = [];
for(const target of federation) {
result.push({
"@id": target + path.replace(/federation:\//, ''),
"@type": "sib:federatedContainer"
});
}
return result;
}
export default generateUrl;
/**
* Retrieves a component of a specified type from the components list.
*
* @param {string} type - The type of the component to retrieve.
* @param {boolean} [returnFirst=false] - Whether to return the first available component if multiple are found.
* @returns {Object|undefined} - The found component object, or undefined if no component is found or if there are multiple components and returnFirst is false.
*/
const getComponent = (type, returnFirst = false) => {
const availables = components.filter((c) => c.type === type || c.uniq === type);
if (availables.length > 1) {
if (returnFirst) {
return availables[0];
}
if (import.meta.env.DEV) {
console.error(`Too much components availables for type ${type}`);
}
} else if (availables.length < 1 && import.meta.env.DEV) {
console.error(`No component found for type ${type}`);
} else {
return availables[0];
}
return false;
};
export default getComponent;
/**
* Retrieves a component of a specified route from the components list.
*
* @param {string} route - The route of the component to retrieve.
* @returns {Object|undefined} - The found component object, or undefined if no component is found or if there are multiple components and returnFirst is false.
*/
const getComponentFromRoute = (route) => {
return components.find((c) => c.route === route);
};
export default getComponentFromRoute;
/**
* Retrieves the default route from the list of components.
* If a component with a default route is found, its route is returned.
* Otherwise, the default route "dashboard" is returned.
*
* @returns {string} The default route.
*/
const getDefaultRoute = () => {
const defaultComponent = components.filter(
(e) => e.defaultRoute !== undefined
);
let defaultRoute = "dashboard";
if (defaultComponent.length === 1) {
defaultRoute = defaultComponent[0].route;
}
return defaultRoute;
};
export default getDefaultRoute;
/**
* Retrieves the route for a given component type.
*
* @param {string} type - The type or unique identifier of the component.
* @param {boolean} [returnFirst=false] - If true, returns the first available route; otherwise, returns the last available route.
* @param {boolean} [ignoreError=false] - If true, suppresses error logging when no component is found.
* @returns {string|undefined} - The route of the matched component, or undefined if no component is found and ignoreError is true.
*/
const getRoute = (type, returnFirst = false, ignoreError = false) => {
const availables = components.filter((c) => c.type === type || c.uniq === type);
for (const c of components) {
if (c.extensions) {
for (const e of c.extensions) {
if (e.type === type || e.uniq === type) {
availables.push(e);
}
}
}
}
if (availables.length > 1) {
if (returnFirst) {
return availables[0].route;
}
return availables[availables.length - 1].route;
}
if (availables.length < 1) {
if (!ignoreError && import.meta.env.DEV)
console.error(`No component found for route ${type}`);
} else {
return availables[0].route;
}
return false;
};
export default getRoute;
let coreInstance = null;
/**
* Function to retrieve the singleton instance of the core version.
*
* @return {Promise} The promise that resolves to the core instance.
*/
export default async function importCore() {
if (!coreInstance) {
const coreNpm = npm.find((e) => e.package === "@startinblox/core");
const productionCore =
coreNpm.path ||
`https://cdn.jsdelivr.net/npm/@startinblox/core@${coreNpm?.version || "latest"}/dist/index.js`;
if (import.meta.env.DEV) {
try {
coreInstance = await import(
/* @vite-ignore */ "http://localhost:3000/dist/index.js"
);
} catch {
coreInstance = await import(/* @vite-ignore */ productionCore);
}
} else {
// In production, only return the skypack version
coreInstance = await import(/* @vite-ignore */ productionCore);
}
}
return coreInstance;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
src/images/favicon.png

1.74 KiB