@openreceive/elements 0.4.2 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/dist/{chunk-VJBC57J6.js → chunk-4APDZW7L.js} +45 -49
- package/dist/{define-elements-ClzBXJCH.d.ts → define-elements-bLhlu_xC.d.ts} +1 -18
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/wrapper-shared.d.ts +1 -1
- package/dist/wrapper-shared.js +1 -1
- package/package.json +5 -3
- package/skills/integrate-openreceive/SKILL.md +16 -5
- package/skills/integrate-openreceive/references/btcpay.md +193 -0
- package/skills/integrate-openreceive/references/django.md +667 -0
- package/skills/integrate-openreceive/references/fastapi.md +537 -0
- package/skills/integrate-openreceive/references/fastify.md +529 -0
- package/skills/integrate-openreceive/references/laravel.md +658 -0
- package/skills/integrate-openreceive/references/next.md +580 -0
- package/skills/integrate-openreceive/references/node.md +33 -14
- package/skills/integrate-openreceive/references/php.md +598 -0
- package/skills/integrate-openreceive/references/rails.md +72 -27
- package/skills/integrate-openreceive/references/woocommerce.md +153 -0
package/README.md
CHANGED
|
@@ -26,11 +26,12 @@ It dispatches plain DOM `CustomEvent`s (`openreceive-settled`,
|
|
|
26
26
|
handler props over the shared binding at
|
|
27
27
|
`@openreceive/elements/wrapper-shared`.
|
|
28
28
|
|
|
29
|
-
##
|
|
29
|
+
## Images
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
Everything the checkout draws — payment-method icons, wallet logos, pay
|
|
32
|
+
tutorials — ships inside the JavaScript; nothing to copy, serve or configure,
|
|
33
|
+
under any bundler. If your Content-Security-Policy has a strict `img-src`,
|
|
34
|
+
allow `data:`. See
|
|
35
|
+
[Images in `@openreceive/browser`](https://github.com/openreceive/openreceive/blob/master/packages/js/browser/README.md#images).
|
|
35
36
|
|
|
36
37
|
Part of [OpenReceive](https://openreceive.org). Start with the [Node quickstart](https://github.com/openreceive/openreceive/blob/master/docs/guides/quickstart-node.md); the full API is in the [API reference](https://github.com/openreceive/openreceive/blob/master/docs/guides/api-reference.md).
|
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
import {
|
|
14
14
|
buildMethodGridEntries as buildMethodGridEntries2,
|
|
15
15
|
copyInvoice,
|
|
16
|
-
createAssetBaseUrlResolver,
|
|
17
16
|
createCheckoutActionEvent,
|
|
18
17
|
createCheckoutController,
|
|
19
18
|
createCheckoutErrorEvent,
|
|
@@ -29,6 +28,7 @@ import {
|
|
|
29
28
|
deriveStatus as deriveStatus2,
|
|
30
29
|
enterCheckoutResumePath,
|
|
31
30
|
getSwapRefundFormError,
|
|
31
|
+
loadPayTutorialImages,
|
|
32
32
|
OPENRECEIVE_CHECKOUT_DATA_SELECTORS,
|
|
33
33
|
OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES as OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3,
|
|
34
34
|
OPENRECEIVE_CHECKOUT_ELEMENT_EVENTS,
|
|
@@ -204,6 +204,10 @@ function createElementCheckoutSession(host) {
|
|
|
204
204
|
function currentPrefix() {
|
|
205
205
|
return host.element.getAttribute(OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES2.prefix) ?? OPENRECEIVE_DEFAULT_PREFIX;
|
|
206
206
|
}
|
|
207
|
+
function currentCsrfHeader() {
|
|
208
|
+
const name = host.element.getAttribute(OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES2.csrfHeader);
|
|
209
|
+
return name === null || name.length === 0 ? void 0 : name;
|
|
210
|
+
}
|
|
207
211
|
function currentReference() {
|
|
208
212
|
const reference = host.element.getAttribute(OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES2.reference);
|
|
209
213
|
return reference === null || reference.length === 0 ? void 0 : reference;
|
|
@@ -242,10 +246,12 @@ function createElementCheckoutSession(host) {
|
|
|
242
246
|
reference: currentReference,
|
|
243
247
|
requestCheckout: (reference) => {
|
|
244
248
|
const metadata = host.createMetadata();
|
|
249
|
+
const csrfHeader = currentCsrfHeader();
|
|
245
250
|
return requestCheckout({
|
|
246
251
|
prefix: currentPrefix(),
|
|
247
252
|
reference,
|
|
248
253
|
...metadata === void 0 ? {} : { metadata },
|
|
254
|
+
...csrfHeader === void 0 ? {} : { csrfHeader },
|
|
249
255
|
fetch: globalThis.fetch
|
|
250
256
|
});
|
|
251
257
|
},
|
|
@@ -254,6 +260,7 @@ function createElementCheckoutSession(host) {
|
|
|
254
260
|
selection: host.swapSelection,
|
|
255
261
|
prefix: () => host.resolvePollPrefix(currentReference()),
|
|
256
262
|
fetch: () => globalThis.fetch,
|
|
263
|
+
csrfHeader: currentCsrfHeader,
|
|
257
264
|
// A swap attempt is NOT written back as attributes: a bolt11 attribute
|
|
258
265
|
// would take the element out of create mode. It re-keys the poll
|
|
259
266
|
// controller onto the merged snapshot and nothing else.
|
|
@@ -273,6 +280,7 @@ function createElementCheckoutSession(host) {
|
|
|
273
280
|
const reference = currentReference();
|
|
274
281
|
if (reference === void 0) return;
|
|
275
282
|
const prefix = currentPrefix();
|
|
283
|
+
const csrfHeader = currentCsrfHeader();
|
|
276
284
|
const key = `${prefix}::${reference}`;
|
|
277
285
|
if (creating) return;
|
|
278
286
|
if (createdKey === key) {
|
|
@@ -288,17 +296,23 @@ function createElementCheckoutSession(host) {
|
|
|
288
296
|
const prepared = await prepareCheckout({
|
|
289
297
|
prefix,
|
|
290
298
|
reference,
|
|
299
|
+
...csrfHeader === void 0 ? {} : { csrfHeader },
|
|
291
300
|
fetch: globalThis.fetch
|
|
292
301
|
});
|
|
293
302
|
const resumeHash = host.resumePaymentHash();
|
|
294
303
|
const checkout = resumeHash === void 0 ? prepared : await resumeSwapAttempt({
|
|
295
304
|
fetch: globalThis.fetch,
|
|
296
305
|
prefix,
|
|
306
|
+
...csrfHeader === void 0 ? {} : { csrfHeader },
|
|
297
307
|
reference,
|
|
298
308
|
paymentHash: resumeHash,
|
|
299
309
|
snapshot: prepared
|
|
300
310
|
});
|
|
301
311
|
if (currentCreateKey() !== key) return;
|
|
312
|
+
if (checkout.active?.swap !== void 0) {
|
|
313
|
+
host.swapSelection.setSelectedAsset(checkout.active.swap.pay_in_asset);
|
|
314
|
+
host.swapSelection.setDismissedInvoiceId(null);
|
|
315
|
+
}
|
|
302
316
|
host.handleControllerSnapshot(checkout);
|
|
303
317
|
applyOwnAttributes(
|
|
304
318
|
createCheckoutElementAttributes(checkout, {
|
|
@@ -440,16 +454,8 @@ import {
|
|
|
440
454
|
} from "@openreceive/browser/headless";
|
|
441
455
|
|
|
442
456
|
// src/payment-icon.ts
|
|
443
|
-
import {
|
|
444
|
-
escapeHtml as escapeHtml2,
|
|
445
|
-
paymentIconPaths,
|
|
446
|
-
paymentIconSvgs
|
|
447
|
-
} from "@openreceive/browser/headless";
|
|
457
|
+
import { escapeHtml as escapeHtml2, paymentIconSvgs } from "@openreceive/browser/headless";
|
|
448
458
|
function renderPaymentIconHtml(id, options) {
|
|
449
|
-
if (options.resolveAssetUrl !== void 0) {
|
|
450
|
-
const src = escapeHtml2(options.resolveAssetUrl(paymentIconPaths[id]));
|
|
451
|
-
return `<img class="${options.className}" alt="" src="${src}">`;
|
|
452
|
-
}
|
|
453
459
|
return paymentIconSvgs[id].replace(
|
|
454
460
|
/^<svg\b([^>]*)>/,
|
|
455
461
|
(_match, attributes) => `<svg${attributes.replace(/\s(?:class|role|aria-label)="[^"]*"/g, "")} class="${options.className}" role="img" aria-label="${escapeHtml2(options.label)}">`
|
|
@@ -501,7 +507,9 @@ function renderTutorialModalHtml(routes, activeProviderId, activeTutorialIndex,
|
|
|
501
507
|
</div>
|
|
502
508
|
` : `
|
|
503
509
|
<div part="tutorial-frame" class="${orClasses2.tutorialFrame}">
|
|
504
|
-
|
|
510
|
+
${// No `<img>` until the lazily loaded screenshot is in hand: an
|
|
511
|
+
// empty src is a request for the page itself.
|
|
512
|
+
tutorial?.image === void 0 ? "" : `<img part="tutorial-image" class="${orClasses2.tutorialImage}" alt="${escapeHtml3(tutorial.caption)}" src="${escapeHtml3(tutorial.image)}">`}
|
|
505
513
|
</div>
|
|
506
514
|
<p part="tutorial-caption" class="${orClasses2.tutorialCaption}">${escapeHtml3(tutorial?.caption ?? "")}</p>
|
|
507
515
|
`;
|
|
@@ -1010,12 +1018,9 @@ function renderPaymentWizardHtml(view = {}) {
|
|
|
1010
1018
|
const model = createPaymentWizardModel(selection);
|
|
1011
1019
|
const { wizard } = model;
|
|
1012
1020
|
const routeAssetDisplays = createWizardRouteAssetDisplays(model.routeAssets, {
|
|
1013
|
-
selectedRoute: model.selectedRoute
|
|
1014
|
-
...view.resolveAssetUrl === void 0 ? {} : { resolveAssetUrl: view.resolveAssetUrl }
|
|
1015
|
-
});
|
|
1016
|
-
const routeDisplays = createWizardRouteDisplays(wizard.routes, {
|
|
1017
|
-
...view.resolveAssetUrl === void 0 ? {} : { resolveAssetUrl: view.resolveAssetUrl }
|
|
1021
|
+
selectedRoute: model.selectedRoute
|
|
1018
1022
|
});
|
|
1023
|
+
const routeDisplays = createWizardRouteDisplays(wizard.routes);
|
|
1019
1024
|
const showRoutePicker = routeAssetDisplays.length > 0 && (model.selectedRoute === null || routeDisplays.length === 0);
|
|
1020
1025
|
const breadcrumbs = selection.selectedMethod === null ? "" : renderWizardBreadcrumbsHtml({
|
|
1021
1026
|
method: selection.selectedMethod,
|
|
@@ -1104,8 +1109,7 @@ function renderPaymentWizardHtml(view = {}) {
|
|
|
1104
1109
|
>
|
|
1105
1110
|
${renderPaymentIconHtml(asset.iconId, {
|
|
1106
1111
|
className: orClasses5.methodIcon,
|
|
1107
|
-
label: asset.label
|
|
1108
|
-
resolveAssetUrl: view.resolveAssetUrl
|
|
1112
|
+
label: asset.label
|
|
1109
1113
|
})}
|
|
1110
1114
|
<strong class="${orClasses5.methodTitle}">${escapeHtml6(asset.label)}</strong>
|
|
1111
1115
|
<small class="${orClasses5.methodDetail}">${escapeHtml6(asset.subtitle)}</small>
|
|
@@ -1215,8 +1219,7 @@ function renderElementCompactPaymentSelectorHtml(swapAssetOptions, view) {
|
|
|
1215
1219
|
<span aria-hidden="true" class="${orClasses5.methodIconWrap}">
|
|
1216
1220
|
${renderPaymentIconHtml(getPaymentMethodIconId(method.id), {
|
|
1217
1221
|
className: orClasses5.methodIcon,
|
|
1218
|
-
label: method.title
|
|
1219
|
-
resolveAssetUrl: view.resolveAssetUrl
|
|
1222
|
+
label: method.title
|
|
1220
1223
|
})}
|
|
1221
1224
|
</span>
|
|
1222
1225
|
<span class="${orClasses5.methodTitleWrap}">
|
|
@@ -1278,8 +1281,7 @@ function renderElementNetworkSelectorHtml(group, view, continueButtonHtml, mobil
|
|
|
1278
1281
|
<span aria-hidden="true" class="grid size-6 shrink-0 place-items-center">
|
|
1279
1282
|
${renderPaymentIconHtml(getNetworkIconId(option.network_label), {
|
|
1280
1283
|
className: orClasses5.methodNetworkIcon,
|
|
1281
|
-
label: option.network_label
|
|
1282
|
-
resolveAssetUrl: view.resolveAssetUrl
|
|
1284
|
+
label: option.network_label
|
|
1283
1285
|
})}
|
|
1284
1286
|
</span>
|
|
1285
1287
|
<span class="truncate">${escapeHtml6(option.network_label)}</span>
|
|
@@ -1367,8 +1369,7 @@ function renderElementSwapMethodGroupHtml(group, view, gridBusy, continueButtonH
|
|
|
1367
1369
|
<span aria-hidden="true" class="${orClasses5.methodIconWrap}">
|
|
1368
1370
|
${starting ? `<span part="spinner" class="${orClasses5.spinner}" aria-hidden="true"></span>` : renderPaymentIconHtml(getSwapOptionIconId(displayOption), {
|
|
1369
1371
|
className: orClasses5.methodIcon,
|
|
1370
|
-
label: group.label
|
|
1371
|
-
resolveAssetUrl: view.resolveAssetUrl
|
|
1372
|
+
label: group.label
|
|
1372
1373
|
})}
|
|
1373
1374
|
</span>
|
|
1374
1375
|
<span class="${orClasses5.methodTitleWrap}">
|
|
@@ -1596,7 +1597,6 @@ function checkoutSnapshotDisplayKey(snapshot) {
|
|
|
1596
1597
|
)
|
|
1597
1598
|
});
|
|
1598
1599
|
}
|
|
1599
|
-
var warnedAssetSeamConflict = false;
|
|
1600
1600
|
function defineElements(options = {}) {
|
|
1601
1601
|
const registry = options.registry ?? globalThis.customElements;
|
|
1602
1602
|
const HTMLElementCtor = globalThis.HTMLElement;
|
|
@@ -1631,6 +1631,7 @@ function defineElements(options = {}) {
|
|
|
1631
1631
|
refundAddressDraftSelectionEnd = null;
|
|
1632
1632
|
/** Tutorial provider whose dialog was last focused, so re-renders don't re-steal focus. */
|
|
1633
1633
|
focusedTutorialProviderId = null;
|
|
1634
|
+
tutorialImagesRequested = false;
|
|
1634
1635
|
/**
|
|
1635
1636
|
* Create mode's whole request lifecycle — prepare-once, the deferred
|
|
1636
1637
|
* Lightning mint, the swap start — plus the guard that keeps attributes the
|
|
@@ -1683,6 +1684,7 @@ function defineElements(options = {}) {
|
|
|
1683
1684
|
return [
|
|
1684
1685
|
OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.reference,
|
|
1685
1686
|
OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.prefix,
|
|
1687
|
+
OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.csrfHeader,
|
|
1686
1688
|
OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.invoiceId,
|
|
1687
1689
|
OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.invoice,
|
|
1688
1690
|
OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.rail,
|
|
@@ -1701,8 +1703,7 @@ function defineElements(options = {}) {
|
|
|
1701
1703
|
OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.resumable,
|
|
1702
1704
|
OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.polling,
|
|
1703
1705
|
OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.pollIntervalMs,
|
|
1704
|
-
OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.decodeLinkUrl
|
|
1705
|
-
OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.assetBaseUrl
|
|
1706
|
+
OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.decodeLinkUrl
|
|
1706
1707
|
];
|
|
1707
1708
|
}
|
|
1708
1709
|
connectedCallback() {
|
|
@@ -1717,13 +1718,13 @@ function defineElements(options = {}) {
|
|
|
1717
1718
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
1718
1719
|
if (!this.isConnected || this.session.applyingOwnAttributes) return;
|
|
1719
1720
|
if (oldValue === newValue) return;
|
|
1720
|
-
const displayOnly = name === OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.theme || name === OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.syncUrl || name === OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.resumePathPrefix || name === OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.routeReference || name === OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.resumable || name === OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.decodeLinkUrl
|
|
1721
|
+
const displayOnly = name === OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.theme || name === OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.syncUrl || name === OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.resumePathPrefix || name === OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.routeReference || name === OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.resumable || name === OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.decodeLinkUrl;
|
|
1721
1722
|
if (displayOnly) {
|
|
1722
1723
|
this.render();
|
|
1723
1724
|
this.syncThemeAncestorObserver();
|
|
1724
1725
|
return;
|
|
1725
1726
|
}
|
|
1726
|
-
const pollingChanged = name === OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.polling || name === OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.pollIntervalMs;
|
|
1727
|
+
const pollingChanged = name === OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.polling || name === OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.pollIntervalMs || name === OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.csrfHeader;
|
|
1727
1728
|
if (pollingChanged) {
|
|
1728
1729
|
this.render();
|
|
1729
1730
|
this.syncThemeAncestorObserver();
|
|
@@ -1751,25 +1752,19 @@ function defineElements(options = {}) {
|
|
|
1751
1752
|
this.stopThemeAncestorObserver();
|
|
1752
1753
|
}
|
|
1753
1754
|
/**
|
|
1754
|
-
* The
|
|
1755
|
-
*
|
|
1756
|
-
*
|
|
1757
|
-
* included, since `defineElements` is first-write-wins and all three call it
|
|
1758
|
-
* with no options. Setting both is a host mistake worth naming once.
|
|
1755
|
+
* The tutorial screenshots are the one image set behind a dynamic import.
|
|
1756
|
+
* The first tutorial open fetches them and re-renders; until then (or if
|
|
1757
|
+
* the chunk never arrives) the dialog draws the caption alone.
|
|
1759
1758
|
*/
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
return options.resolveAssetUrl;
|
|
1770
|
-
}
|
|
1771
|
-
if (base === null || base.trim() === "") return void 0;
|
|
1772
|
-
return createAssetBaseUrlResolver(base);
|
|
1759
|
+
loadTutorialImages() {
|
|
1760
|
+
if (this.tutorialImagesRequested) return;
|
|
1761
|
+
this.tutorialImagesRequested = true;
|
|
1762
|
+
loadPayTutorialImages().then(
|
|
1763
|
+
() => {
|
|
1764
|
+
if (this.isConnected) this.render();
|
|
1765
|
+
},
|
|
1766
|
+
() => void 0
|
|
1767
|
+
);
|
|
1773
1768
|
}
|
|
1774
1769
|
// Create mode: a `reference` is set but no `invoice` snapshot is provided. The element
|
|
1775
1770
|
// owns the whole lifecycle — it prepares the checkout against
|
|
@@ -1899,7 +1894,6 @@ function defineElements(options = {}) {
|
|
|
1899
1894
|
const invoice = invoiceAttr ?? "";
|
|
1900
1895
|
const lightningRequested = !this.isCreateMode() || this.session.lightningRequested || invoice.length > 0;
|
|
1901
1896
|
const decodeLinkUrl = this.getAttribute(OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.decodeLinkUrl) ?? void 0;
|
|
1902
|
-
const assetUrlResolver = this.resolveAssetUrlResolver();
|
|
1903
1897
|
const selectedQuote = this.selectedSwapAsset === null ? void 0 : this.session.swapQuotes[this.selectedSwapAsset];
|
|
1904
1898
|
const unavailableSwapQuote = selectedQuote?.available === false ? selectedQuote : void 0;
|
|
1905
1899
|
const { root, inlineStyles } = this.prepareShadowRoot();
|
|
@@ -1941,7 +1935,6 @@ function defineElements(options = {}) {
|
|
|
1941
1935
|
...this.latestCheckoutSnapshot?.checkout_id === void 0 ? {} : { checkoutId: this.latestCheckoutSnapshot.checkout_id },
|
|
1942
1936
|
lightningInvoice: invoice,
|
|
1943
1937
|
...decodeLinkUrl === void 0 ? {} : { decodeLinkUrl },
|
|
1944
|
-
...assetUrlResolver === void 0 ? {} : { resolveAssetUrl: assetUrlResolver },
|
|
1945
1938
|
...this.getAttribute(OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.paymentHash) === null ? {} : {
|
|
1946
1939
|
paymentHash: this.getAttribute(OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.paymentHash) ?? void 0
|
|
1947
1940
|
},
|
|
@@ -2029,10 +2022,12 @@ function defineElements(options = {}) {
|
|
|
2029
2022
|
this.getAttribute(OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.pollIntervalMs),
|
|
2030
2023
|
{ label: "poll-interval-ms" }
|
|
2031
2024
|
);
|
|
2025
|
+
const csrfHeader = this.getAttribute(OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES3.csrfHeader);
|
|
2032
2026
|
this.stopCheckoutController();
|
|
2033
2027
|
this.controller = createCheckoutController({
|
|
2034
2028
|
snapshot,
|
|
2035
2029
|
...prefix === void 0 ? {} : { prefix },
|
|
2030
|
+
...csrfHeader === null || csrfHeader.length === 0 ? {} : { csrfHeader },
|
|
2036
2031
|
polling,
|
|
2037
2032
|
...pollIntervalMs === void 0 ? {} : { pollIntervalMs },
|
|
2038
2033
|
logger: options.logger,
|
|
@@ -2384,6 +2379,7 @@ function defineElements(options = {}) {
|
|
|
2384
2379
|
}
|
|
2385
2380
|
this.activeTutorialProviderId = providerId;
|
|
2386
2381
|
this.activeTutorialIndex = Number.isSafeInteger(index) && index >= 0 ? index : 0;
|
|
2382
|
+
this.loadTutorialImages();
|
|
2387
2383
|
this.render();
|
|
2388
2384
|
});
|
|
2389
2385
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Status, PaymentMethod, CheckoutPaymentMethod,
|
|
1
|
+
import { Status, PaymentMethod, CheckoutPaymentMethod, CheckoutInvoiceSnapshot, SwapLimitContext, CheckoutState, QrEncoder, BrowserLoggerOption } from '@openreceive/browser/headless';
|
|
2
2
|
|
|
3
3
|
interface CheckoutView {
|
|
4
4
|
readonly invoice_id?: string;
|
|
@@ -81,16 +81,6 @@ interface ElementsWizardView {
|
|
|
81
81
|
readonly lightningInvoice?: string;
|
|
82
82
|
/** Host-chosen bolt11 decoder base URL; omitted, the tutorial shows no decode link. */
|
|
83
83
|
readonly decodeLinkUrl?: string;
|
|
84
|
-
/**
|
|
85
|
-
* Rewrite a packaged asset path (`assets/provider-icons/strike.png`,
|
|
86
|
-
* `assets/pay_tutorials/strike-1.webp`) into a URL this host can serve. The
|
|
87
|
-
* packaged URLs only resolve under Vite/Rollup; every other bundler needs
|
|
88
|
-
* this or the provider images come out as dead `file://` links. The
|
|
89
|
-
* payment-method icons are drawn inline from compiled-in markup and need
|
|
90
|
-
* nothing; given a resolver they are served as files through it instead.
|
|
91
|
-
* `defineElements` passes its own down to here.
|
|
92
|
-
*/
|
|
93
|
-
readonly resolveAssetUrl?: AssetUrlResolver;
|
|
94
84
|
readonly paymentHash?: string;
|
|
95
85
|
readonly swapInvoice?: CheckoutInvoiceSnapshot;
|
|
96
86
|
readonly activeTutorialProviderId?: string | null;
|
|
@@ -116,13 +106,6 @@ interface DefineElementsOptions {
|
|
|
116
106
|
readonly registry?: CustomElementRegistry;
|
|
117
107
|
readonly qrEncoder?: QrEncoder;
|
|
118
108
|
readonly logger?: BrowserLoggerOption;
|
|
119
|
-
/**
|
|
120
|
-
* Element-owned, like `qrEncoder` and `logger`: how this host resolves the
|
|
121
|
-
* packaged provider-image paths. Omitted, the packaged URLs are used —
|
|
122
|
-
* correct under Vite/Rollup and dead `file://` links under anything else.
|
|
123
|
-
* (Payment-method icons are compiled in and unaffected.)
|
|
124
|
-
*/
|
|
125
|
-
readonly resolveAssetUrl?: AssetUrlResolver;
|
|
126
109
|
}
|
|
127
110
|
|
|
128
111
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TransactionDetailsSource } from '@openreceive/browser/headless';
|
|
2
2
|
export { OPENRECEIVE_CHECKOUT_ELEMENT_ATTRIBUTES, OPENRECEIVE_CHECKOUT_ELEMENT_EVENTS, OPENRECEIVE_CHECKOUT_ELEMENT_TAG_NAME, OPENRECEIVE_THEME_TOGGLE_ELEMENT_ATTRIBUTES, OPENRECEIVE_THEME_TOGGLE_ELEMENT_EVENTS, OPENRECEIVE_THEME_TOGGLE_ELEMENT_TAG_NAME, TransactionDetailsSource, createThemeToggleElement } from '@openreceive/browser/headless';
|
|
3
|
-
import { C as CheckoutView } from './define-elements-
|
|
4
|
-
export { D as DefineElementsOptions, E as ElementsWizardView, d as defineElements } from './define-elements-
|
|
3
|
+
import { C as CheckoutView } from './define-elements-bLhlu_xC.js';
|
|
4
|
+
export { D as DefineElementsOptions, E as ElementsWizardView, d as defineElements } from './define-elements-bLhlu_xC.js';
|
|
5
5
|
|
|
6
6
|
declare function renderCheckoutHtml(view: CheckoutView): string;
|
|
7
7
|
/**
|
package/dist/index.js
CHANGED