Support named imports
See original GitHub issueCurrently, the Amazon Connect Streams package cannot be imported as a named module, i.e. these do not work:
import { connect } from 'amazon-connect-streams'
TypeError: Cannot read property ‘core’ of undefined
import { core } from 'amazon-connect-streams'
TypeError: Cannot read property ‘initCCP’ of undefined
import * as connect from 'amazon-connect-streams'
TypeError: Cannot read property ‘initCCP’ of undefined
import connect from 'amazon-connect-streams'
TypeError: Cannot read property ‘initCCP’ of undefined
Instead, the only option that we have is to import the package to the global namespace:
import 'amazon-connect-streams';
where it will define a global variable connect
.
This inflexibility leads to a conflict (and possible confusion) with other packages that are named connect
, for example the Redux connect
. But more importantly, it prevents importing only certain parts of the Streams package in various parts of the web app - for example, importing only ContactEvents
to use in tests.
I’d add the enhancement
tag to this request, but it doesn’t seem as though I can
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
I tried to use
const connect = require('amazon-connect-streams')
inside aif (typeof window !== undefined)
block, due tonavigator is not defined
for SSR in gatsby. Howeverconnect
turned out to be an empty object.Yes, we’re using Next.js and imported the component as follows from a page component:
(where the path
../components/AmazonConnectChat
leads to theExample
component above in my earlier example)