Closed mattsafaii closed 10 months ago
I don't think the @duffel/components/custom-elements
import is necessarily wrong, we use that in one of our examples too:
https://github.com/duffelhq/duffel-components/blob/cd724b366da530f637929273d576e813ae3233a9/src/examples/payments-just-typescript/src/index.ts#L5
We might need to update the guide to reflect that.
I've never used Sveltekit, but I can look into it further. First I just wanted to quickly check - a google search brings up some suggestions that maybe something needs to changed perhaps in the tsconfig or the way you import:
Does any of this seem relevant or help you with the error?
I'm going to close this issue due to inactivity. Please let us know if you still need help.
@andrejak That's fine you can keep this closed. Those links didn't help unfortunately and I didn't want to spend too much time on it. I decided to use the CDN instead and got a different error which I opened an issue for here: #184
Hey Duffel Team!
I'm using the Duffel Ancillaries component in a Sveltekit application I am building.
I have followed the steps listed in your docs for the Ancillaries component here: Using the component in non-React environments
Version of @duffel/components:
^3.1.5
I am installing it using
npm i @duffel/components --save
The framework I am using is Sveltekit.
I have created a component in the Ancillaries.svelte file with the following code taken directly from your docs:
I have tried using "@duffel/components" in the import statement but got the following errors:
Module '"@duffel/components"' has no exported member 'onDuffelAncillariesPayloadReady'.
Module '"@duffel/components"' has no exported member 'renderDuffelAncillariesCustomElement'.
When I changed the import from
@duffel/components
to@duffel/components/custom-elements
the error went away.I'm not sure if this is the correct file that should be imported. However, when I run the application locally I get a 500 error that says:
I recorded a Loom going through a fresh install of
@duffel/components
which you can watch here: Duffel Ancillaries ImplementationIt seems like the initial import from
@duffel/components
is where the error is coming from. I shouldn't have to import from `@duffel/components/custom-elements'I don't know what could be wrong with my implementation, but if the error is due to the
offer_id
,services
, orpassengers
objects having the wrong data, I would expect the component to render with an error.Please let me know if there is something I am doing wrong here. Otherwise, would love to see a patch for this so I can just import from
@duffel/components
and be able to use the Ancillaries component in my Checkout flow.Looking forward to your response!
-Matt