Skip to content

Commit 8e9949d

Browse files
committed
Mwe'll manually delete everything after we make sure everything went smoothly. manually or in batch.erge branch 'main' into migration-cli
2 parents 3d67adf + fe20451 commit 8e9949d

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

components/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
".": "./src/index.ts",
99
"./*": "./src/*.ts"
1010
},
11+
"sideEffects": [
12+
"./src/**/*.css"
13+
],
1114
"dependencies": {
1215
"@shared/utils": "workspace:^",
1316
"lit": "^3.3.2"

components/src/widget/views/confirmation/confirmation.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,4 +513,3 @@ export class PaymentConfirmation extends LitElement {
513513
`
514514
}
515515
}
516-
customElements.define('wm-payment-confirmation', PaymentConfirmation)

components/src/widget/views/interaction/interaction.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,4 +348,3 @@ export class PaymentInteraction extends LitElement {
348348
}
349349
}
350350
}
351-
customElements.define('wm-payment-interaction', PaymentInteraction)

components/src/widget/widget.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@ import type { WalletAddress } from '@interledger/open-payments'
1010
import { checkHrefFormat, toWalletAddressUrl } from '@shared/utils'
1111
import { WidgetController } from './controller'
1212
import type { WidgetConfig } from './types'
13+
import { PaymentConfirmation } from './views/confirmation/confirmation'
14+
import { PaymentInteraction } from './views/interaction/interaction'
1315
import widgetStyles from './widget.css?raw'
14-
import './views/confirmation/confirmation.js'
15-
import './views/interaction/interaction.js'
16+
17+
const COMPONENTS = {
18+
'wm-payment-confirmation': PaymentConfirmation,
19+
'wm-payment-interaction': PaymentInteraction,
20+
'wm-dots-loader': DotsLoader,
21+
'wm-close-btn': CloseBtn,
22+
}
1623

1724
const DEFAULT_WIDGET_DESCRIPTION =
1825
'Experience the new way to support our content. Activate Web Monetization in your browser. Every visit helps us keep creating the content you love! You can also support us by a one time donation below!'
@@ -39,11 +46,10 @@ export class PaymentWidget extends LitElement {
3946

4047
connectedCallback(): void {
4148
super.connectedCallback()
42-
if (!customElements.get('wm-dots-loader')) {
43-
customElements.define('wm-dots-loader', DotsLoader)
44-
}
45-
if (!customElements.get('wm-close-btn')) {
46-
customElements.define('wm-close-btn', CloseBtn)
49+
for (const [name, elConstructor] of Object.entries(COMPONENTS)) {
50+
if (!customElements.get(name)) {
51+
customElements.define(name, elConstructor)
52+
}
4753
}
4854
}
4955

0 commit comments

Comments
 (0)