web-monetization-extension icon indicating copy to clipboard operation
web-monetization-extension copied to clipboard

Expose `MonetizationCurrencyAmount`

Open sidvishnoi opened this issue 1 year ago • 3 comments

Spec says it's exposed on Window. Also, make sure amountSent is an instance of MonetizationCurrencyAmount.

sidvishnoi avatar Aug 12 '24 14:08 sidvishnoi

On a second thought, I think it should not be exposed to Window (spec bug). If MonetizationCurrencyAmount maps directly to PaymentCurrencyAmount, why it's an interface and not a dictionary like PaymentCurrencyAmount?

sidvishnoi avatar Aug 12 '24 14:08 sidvishnoi

If MonetizationCurrencyAmount maps directly to PaymentCurrencyAmount, why it's an interface and not a dictionary like PaymentCurrencyAmount?

Yeah, I agree as well. I do not see any point in exposing this to Window as long as its only use is for the event.

This then also makes me wonder if it is needed at all. The amountSent member of the MonetizationEventInit dictionary already directly references PaymentCurrencyAmount. I don't know what the best practice is here, but maybe we could just remove the definition within the Web Monetization spec?

Can you transfer this issue to the spec repo? Or should I create a new one?

MichaelKohler avatar Apr 07 '25 09:04 MichaelKohler

We cannot use a dictionary as the attribute type of a member in an interface (here MonetizationEvent) - WebIDL prohibits it. Even if the definition was same as PaymentCurrencyAmount, the interface still needs to be there. But I'm considering if it can be an internal interface - not exposed to Window, and if that can cause issues.

sidvishnoi avatar Apr 24 '25 08:04 sidvishnoi