Giter VIP home page Giter VIP logo

react-usercentrics's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

react-usercentrics's Issues

Unable to find available languages using given settingsId and version.

I'm using the library with NextJs in a similar way as explained by #5

// _app.tsx

        <div>
            <UsercentricsScript
                settingsId={envVars.get("NEXT_PUBLIC_USERCENTRICS_ID")}
                version="production"
            />
            <UsercentricsProvider windowEventName="ucEvent">
                <MatomoProvider value={instance}>
                    <MatomoClient />
                    <Component {...pageProps} />
                </MatomoProvider>
            </UsercentricsProvider>
        </div>

On local, with version="preview" it does show the cookie consent with dummy data (I guess that's why it's preview).
However, on production, I'm running into

errorMessage:  "Unable to find available languages using given settingsId and version."

statusCode:  403

The main problem being with calling GET https://api.usercentrics.eu/settings/{:id}/production/languages.json (403)

Any advice?

Jest unit tests - SyntaxError: Unexpected token 'export'

My application codebase is in NextJs with React.
I have a component Media, that needs user consent to enable a script that collects data, so we created a hook that verifies if we can load this Media component.

I can run more atomic (atomic pattern design) unit tests without any problems, but when coming to organisms, I start getting this error.

Can you guys assist me on this?

yarn run v1.22.19
$ jest --silent Hero.spec.tsx
 FAIL  src/components/organisms/Hero/__tests__/Hero.spec.tsx
   Test suite failed to run

    Jest encountered an unexpected token

    Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.

    Out of the box Jest supports Babel, which will be used to transform your files into valid JS based on your Babel configuration.

    By default "node_modules" folder is ignored by transformers.

    Here's what you can do:
     • If you are trying to use ECMAScript Modules, see https://jestjs.io/docs/ecmascript-modules for how to enable it.
     • If you are trying to use TypeScript, see https://jestjs.io/docs/getting-started#using-typescript
     • To have some of your "node_modules" files transformed, you can specify a custom "transformIgnorePatterns" in your config.
     • If you need a custom transformation specify a "transform" option in your config.
     • If you simply want to mock your non-JS modules (e.g. binary assets) you can stub them out with the "moduleNameMapper" config option.

    You'll find more details and examples of these config options in the docs:
    https://jestjs.io/docs/configuration
    For information about custom transformations, see:
    https://jestjs.io/docs/code-transformation

    Details:

    /<APPLICATION>/node_modules/@s-group/react-usercentrics/dist/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export { UsercentricsDialogToggle } from './components/UsercentricsDialogToggle.js';
                                                                                      ^^^^^^

    SyntaxError: Unexpected token 'export'

    > 1 | import {
        | ^
      2 |   getServicesBaseInfo,
      3 |   hasServiceConsent,
      4 |   ServiceInfo,

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1505:14)
      at Object.<anonymous> (src/hooks/usePermission.ts:1:1)
      at Object.<anonymous> (src/hooks/useMarketo.ts:3:1)
      at Object.<anonymous> (src/hooks/index.ts:9:1)
      at Object.<anonymous> (src/components/molecules/media/Media.tsx:4:1)
      at Object.<anonymous> (src/components/molecules/media/index.ts:1:1)
      at Object.<anonymous> (src/components/organisms/Hero/Hero.tsx:7:1)
      at Object.<anonymous> (src/components/organisms/Hero/index.ts:1:1)
      at Object.<anonymous> (src/components/organisms/Hero/__tests__/Hero.spec.tsx:3:1)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        8.356 s
error Command failed with exit code 1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.