klaro-js icon indicating copy to clipboard operation
klaro-js copied to clipboard

Uncaught ReferenceError: klaro is not defined

Open mischa-geiger opened this issue 7 months ago • 5 comments

Hello,

I downloaded klaro-no-translations-no-css.js in the current version 0.7.22 from the CDN and installed it locally. Initially the content banner was loaded with my config, but it could not be called later with klaro.show();. I always received the error message

Uncaught ReferenceError: klaro is not defined

After some searching I realized that in klaro-no-translations-no-css.js since v0.7.20 the object is exported with the name 'klaro-no-translations' instead of klaro.

See: v.0.7.18: https://cdn.kiprotect.com/klaro/v0.7.18/klaro-no-translations-no-css.js v.0.7.20: https://cdn.kiprotect.com/klaro/v0.7.20/klaro-no-translations-no-css.js v.0.7.22: https://cdn.kiprotect.com/klaro/v0.7.22/klaro-no-translations-no-css.js

Shouldn't it also be named 'klaro' here?

Thanks Mischa

mischa-geiger avatar Apr 16 '25 14:04 mischa-geiger

See https://github.com/kiprotect/klaro/pull/529 Is already merged and you can use the dev version.

werk21 avatar Apr 16 '25 17:04 werk21

Ok, thanks! I have seen this issue, but I am a bit confused. I just downloaded the latest klaro-no-translations-no-css.js following the instructions on the Klaro website and here. Whether I take the file from the CDN or here from the dist directory of the repo, I always get the incorrect version. Am I missing something and how can I get the dev version?

mischa-geiger avatar Apr 17 '25 07:04 mischa-geiger

You have to download the repo and build your own version, But I think in the next days (weeks?) the maintainer will release a new version.

In the meantime, you are welcome to use these versions that we have built ourselves for implementation in Drupal CMS: https://git.drupalcode.org/project/klaro_js (Please download the files and dont use them from this repo directly.)

Direct link: https://git.drupalcode.org/project/klaro_js/-/blob/3.0.x/dist/klaro-no-translations-no-css.js?ref_type=heads

We also use this version for Klaro Module in Drupal CMS.

Best regards from Berlin :-)

werk21 avatar Apr 17 '25 08:04 werk21

I already use the Drupal module in projects ;) That's how I noticed the differences between the versions.

Many thanks and best regards also from Berlin :-)

mischa-geiger avatar Apr 17 '25 08:04 mischa-geiger

Oh, cool! Feel free to open issues, feature request etc. on drupal.org :)

Jan Kellermann

werk21 avatar Apr 17 '25 08:04 werk21