Skip to content

Commit

Permalink
replace errors to info
Browse files Browse the repository at this point in the history
  • Loading branch information
nirgur committed Nov 21, 2024
1 parent 3a9c024 commit f957365
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions packages/sdks/web-component/src/lib/helpers/templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,22 +146,27 @@ const setCssVars = (
rootEle: HTMLElement,
cssVars: CssVars,
logger: {
error: (message: string, description: string) => void,
info: (message: string, description: string) => void,
}
error: (message: string, description: string) => void;
info: (message: string, description: string) => void;
},
) => {
if (!cssVars) {
return;
}

Object.keys(cssVars).forEach((componentName) => {
if(!nextPageTemplate.querySelector(componentName)){
logger.info(`Skipping css vars for component "${componentName}}"`, `Got css vars for component ${componentName} but Could not find it on next page` );
if (!nextPageTemplate.querySelector(componentName)) {
logger.info(
`Skipping css vars for component "${componentName}}"`,
`Got css vars for component ${componentName} but Could not find it on next page`,
);
}
const componentClass: CustomElementConstructor & { cssVarList: CssVars } | undefined = customElements.get(componentName) as any;
const componentClass:
| (CustomElementConstructor & { cssVarList: CssVars })
| undefined = customElements.get(componentName) as any;

if (!componentClass) {
logger.error(
logger.info(
`Could not find component class for ${componentName}`,
'Check if the component is registered',
);
Expand All @@ -173,7 +178,7 @@ const setCssVars = (
const varName = componentClass?.cssVarList?.[cssVarKey];

if (!varName) {
logger.error(
logger.info(
`Could not find css variable name for ${cssVarKey} in ${componentName}`,
'Check if the css variable is defined in the component',
);
Expand All @@ -183,10 +188,9 @@ const setCssVars = (
const value = componentCssVars[cssVarKey];

rootEle.style.setProperty(varName, value);
})
});
});
}

};

const setElementConfig = (
baseEle: DocumentFragment,
Expand Down Expand Up @@ -222,8 +226,6 @@ const setElementConfig = (
});
};



const setImageVariable = (
rootEle: HTMLElement,
name: string,
Expand Down

0 comments on commit f957365

Please sign in to comment.