@bounded-sh/client 0.0.13 → 0.0.14
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/dist/auth/providers/offchain-auth-provider.d.ts +7 -13
- package/dist/index.js +214 -250
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +214 -250
- package/dist/index.mjs.map +1 -1
- package/dist/{index.native-BYEVhmbt.mjs → index.native-B4qib0WI.mjs} +217 -253
- package/dist/index.native-B4qib0WI.mjs.map +1 -0
- package/dist/{index.native-CcBTbnBg.js → index.native-fDOSSF3W.js} +217 -253
- package/dist/index.native-fDOSSF3W.js.map +1 -0
- package/dist/index.native.js +1 -1
- package/dist/index.native.mjs +1 -1
- package/dist/{phantom-wallet-provider-Cn6MzUUo.js → phantom-wallet-provider-B4iCTaUq.js} +2 -2
- package/dist/{phantom-wallet-provider-Cn6MzUUo.js.map → phantom-wallet-provider-B4iCTaUq.js.map} +1 -1
- package/dist/{phantom-wallet-provider-D_AzfLq0.mjs → phantom-wallet-provider-DGvW6ecv.mjs} +2 -2
- package/dist/{phantom-wallet-provider-D_AzfLq0.mjs.map → phantom-wallet-provider-DGvW6ecv.mjs.map} +1 -1
- package/dist/{privy-wallet-provider-DtWAtbUl.js → privy-wallet-provider-B3FEM7RO.js} +3 -3
- package/dist/{privy-wallet-provider-DtWAtbUl.js.map → privy-wallet-provider-B3FEM7RO.js.map} +1 -1
- package/dist/{privy-wallet-provider-AC4xL6bN.mjs → privy-wallet-provider-CpA0SzjA.mjs} +3 -3
- package/dist/{privy-wallet-provider-AC4xL6bN.mjs.map → privy-wallet-provider-CpA0SzjA.mjs.map} +1 -1
- package/dist/{solana-mobile-wallet-provider-X6BM07gm.mjs → solana-mobile-wallet-provider-B-Ue0EG9.mjs} +3 -3
- package/dist/solana-mobile-wallet-provider-B-Ue0EG9.mjs.map +1 -0
- package/dist/{solana-mobile-wallet-provider-Cos9gu7k.js → solana-mobile-wallet-provider-CWidNUHT.js} +3 -3
- package/dist/solana-mobile-wallet-provider-CWidNUHT.js.map +1 -0
- package/package.json +2 -2
- package/dist/index.native-BYEVhmbt.mjs.map +0 -1
- package/dist/index.native-CcBTbnBg.js.map +0 -1
- package/dist/solana-mobile-wallet-provider-Cos9gu7k.js.map +0 -1
- package/dist/solana-mobile-wallet-provider-X6BM07gm.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -11125,39 +11125,8 @@ async function get(path, opts = {}) {
|
|
|
11125
11125
|
}
|
|
11126
11126
|
// Create a new request promise and store it
|
|
11127
11127
|
const requestPromise = (async () => {
|
|
11128
|
-
var _a;
|
|
11129
11128
|
try {
|
|
11130
|
-
// For realtime chains, prefer WebSocket reads (lower latency, already connected)
|
|
11131
|
-
const config = await getConfig();
|
|
11132
11129
|
const pathIsDocument = normalizedPath.split("/").length % 2 === 0;
|
|
11133
|
-
if (((_a = config.chain) === null || _a === void 0 ? void 0 : _a.startsWith('realtime_')) && !config.isServer && !opts.prompt && !opts.shape && !opts.cursor && !opts.includeSubPaths && !opts.filter && !opts.sort) {
|
|
11134
|
-
try {
|
|
11135
|
-
const { wsGet, wsQuery, hasActiveConnection } = await Promise.resolve().then(function () { return subscriptionV2; });
|
|
11136
|
-
if (hasActiveConnection()) {
|
|
11137
|
-
if (pathIsDocument) {
|
|
11138
|
-
const wsResult = await wsGet(normalizedPath);
|
|
11139
|
-
const responseData = normalizeReadResult(wsResult, true);
|
|
11140
|
-
if (!opts.bypassCache) {
|
|
11141
|
-
getCache[cacheKey] = { data: responseData, expiresAt: now + GET_CACHE_TTL };
|
|
11142
|
-
}
|
|
11143
|
-
return responseData;
|
|
11144
|
-
}
|
|
11145
|
-
else if (!opts.limit) {
|
|
11146
|
-
const wsResult = await wsQuery(normalizedPath, {
|
|
11147
|
-
filter: undefined,
|
|
11148
|
-
sort: undefined,
|
|
11149
|
-
includeSubPaths: opts.includeSubPaths,
|
|
11150
|
-
});
|
|
11151
|
-
const responseData = normalizeReadResult(wsResult, false);
|
|
11152
|
-
if (!opts.bypassCache) {
|
|
11153
|
-
getCache[cacheKey] = { data: responseData, expiresAt: now + GET_CACHE_TTL };
|
|
11154
|
-
}
|
|
11155
|
-
return responseData;
|
|
11156
|
-
}
|
|
11157
|
-
}
|
|
11158
|
-
}
|
|
11159
|
-
catch ( /* fall through to HTTP */_b) { /* fall through to HTTP */ }
|
|
11160
|
-
}
|
|
11161
11130
|
// Cache miss or bypass - proceed with HTTP API request
|
|
11162
11131
|
let response;
|
|
11163
11132
|
// Build common query params
|
|
@@ -11410,7 +11379,7 @@ async function set(path, document, options) {
|
|
|
11410
11379
|
return result;
|
|
11411
11380
|
}
|
|
11412
11381
|
async function setMany(many, options) {
|
|
11413
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
11382
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
11414
11383
|
// Returns the data that was set, or undefined if the document was already set.
|
|
11415
11384
|
try {
|
|
11416
11385
|
const config = await getConfig();
|
|
@@ -11447,40 +11416,13 @@ async function setMany(many, options) {
|
|
|
11447
11416
|
}
|
|
11448
11417
|
let setResponse;
|
|
11449
11418
|
try {
|
|
11450
|
-
|
|
11451
|
-
const useWs = ((_c = config.chain) === null || _c === void 0 ? void 0 : _c.startsWith('realtime_')) && !config.isServer;
|
|
11452
|
-
if (useWs) {
|
|
11453
|
-
try {
|
|
11454
|
-
const { wsSet, hasActiveConnection } = await Promise.resolve().then(function () { return subscriptionV2; });
|
|
11455
|
-
if (hasActiveConnection()) {
|
|
11456
|
-
// Connection is active — send via WS. If this throws, the write
|
|
11457
|
-
// may have been applied server-side (ack lost). Do NOT fall through
|
|
11458
|
-
// to HTTP, as that would double-apply non-idempotent ops (Increment).
|
|
11459
|
-
const wsResult = await wsSet(documents);
|
|
11460
|
-
setResponse = { data: wsResult, status: 200 };
|
|
11461
|
-
}
|
|
11462
|
-
}
|
|
11463
|
-
catch (wsError) {
|
|
11464
|
-
// Only fall through to HTTP if the request was never sent (connection not available).
|
|
11465
|
-
// If the request was sent and ack was lost (timeout), the server may have
|
|
11466
|
-
// applied it — re-sending via HTTP risks double-write for non-idempotent ops.
|
|
11467
|
-
const msg = (_d = wsError === null || wsError === void 0 ? void 0 : wsError.message) !== null && _d !== void 0 ? _d : '';
|
|
11468
|
-
const neverSent = msg.includes('not available') || msg.includes('connection timeout');
|
|
11469
|
-
if (!neverSent) {
|
|
11470
|
-
throw wsError;
|
|
11471
|
-
}
|
|
11472
|
-
// Safe to retry via HTTP — request was never sent
|
|
11473
|
-
}
|
|
11474
|
-
}
|
|
11475
|
-
if (!setResponse) {
|
|
11476
|
-
setResponse = await makeApiRequest('PUT', `items`, { documents }, options === null || options === void 0 ? void 0 : options._overrides);
|
|
11477
|
-
}
|
|
11419
|
+
setResponse = await makeApiRequest('PUT', `items`, { documents }, options === null || options === void 0 ? void 0 : options._overrides);
|
|
11478
11420
|
}
|
|
11479
11421
|
catch (error) {
|
|
11480
11422
|
if ((error === null || error === void 0 ? void 0 : error.statusCode) === 402 && (error === null || error === void 0 ? void 0 : error.error) === 'INSUFFICIENT_BALANCE') {
|
|
11481
|
-
const deficitLamports = Number((
|
|
11482
|
-
const deficitSol = Number((
|
|
11483
|
-
throw new InsufficientBalanceError(String((
|
|
11423
|
+
const deficitLamports = Number((_c = error.deficitLamports) !== null && _c !== void 0 ? _c : 0);
|
|
11424
|
+
const deficitSol = Number((_d = error.deficitSol) !== null && _d !== void 0 ? _d : deficitLamports / 1000000000);
|
|
11425
|
+
throw new InsufficientBalanceError(String((_e = error.address) !== null && _e !== void 0 ? _e : ''), Number((_f = error.balanceLamports) !== null && _f !== void 0 ? _f : 0), Number((_g = error.estimatedCostLamports) !== null && _g !== void 0 ? _g : 0), deficitLamports, deficitSol);
|
|
11484
11426
|
}
|
|
11485
11427
|
throw error;
|
|
11486
11428
|
}
|
|
@@ -11527,7 +11469,7 @@ async function setMany(many, options) {
|
|
|
11527
11469
|
else if (setResponse.data &&
|
|
11528
11470
|
typeof setResponse.data === 'object' &&
|
|
11529
11471
|
setResponse.data.success === true) {
|
|
11530
|
-
const
|
|
11472
|
+
const _h = setResponse.data, { success: _success } = _h, rest = __rest$1(_h, ["success"]);
|
|
11531
11473
|
return Object.assign(Object.assign(Object.assign({}, documents.map(d => d.document)), rest), { transactionId: null });
|
|
11532
11474
|
}
|
|
11533
11475
|
else {
|
|
@@ -13055,23 +12997,6 @@ async function wsGetMany(paths) {
|
|
|
13055
12997
|
}));
|
|
13056
12998
|
}
|
|
13057
12999
|
|
|
13058
|
-
var subscriptionV2 = /*#__PURE__*/Object.freeze({
|
|
13059
|
-
__proto__: null,
|
|
13060
|
-
clearCacheV2: clearCacheV2,
|
|
13061
|
-
closeAllSubscriptionsV2: closeAllSubscriptionsV2,
|
|
13062
|
-
getCachedDataV2: getCachedDataV2,
|
|
13063
|
-
hasActiveConnection: hasActiveConnection,
|
|
13064
|
-
reconnectWithNewAuthV2: reconnectWithNewAuthV2,
|
|
13065
|
-
subscribeV2: subscribeV2,
|
|
13066
|
-
wsDelete: wsDelete,
|
|
13067
|
-
wsGet: wsGet,
|
|
13068
|
-
wsGetMany: wsGetMany,
|
|
13069
|
-
wsIntent: wsIntent,
|
|
13070
|
-
wsIntentReliable: wsIntentReliable,
|
|
13071
|
-
wsQuery: wsQuery,
|
|
13072
|
-
wsSet: wsSet
|
|
13073
|
-
});
|
|
13074
|
-
|
|
13075
13000
|
/**
|
|
13076
13001
|
* WebSocket Subscription Module
|
|
13077
13002
|
*
|
|
@@ -14882,7 +14807,7 @@ class OffchainAuthProvider {
|
|
|
14882
14807
|
// Create modal container
|
|
14883
14808
|
this.modalContainer = document.createElement("div");
|
|
14884
14809
|
this.modalContainer.id = "poofnet-unsupported-modal";
|
|
14885
|
-
this.modalContainer.
|
|
14810
|
+
this.modalContainer.appendChild(this.buildUnsupportedModalContent());
|
|
14886
14811
|
document.body.appendChild(this.modalContainer);
|
|
14887
14812
|
// Add styles
|
|
14888
14813
|
const style = document.createElement("style");
|
|
@@ -14938,38 +14863,6 @@ class OffchainAuthProvider {
|
|
|
14938
14863
|
document.addEventListener("keydown", escHandler);
|
|
14939
14864
|
});
|
|
14940
14865
|
}
|
|
14941
|
-
getUnsupportedModalHTML() {
|
|
14942
|
-
return `
|
|
14943
|
-
<div class="poofnet-modal-overlay">
|
|
14944
|
-
<div class="poofnet-modal-content">
|
|
14945
|
-
<button id="poofnet-close-btn" class="poofnet-close-btn" aria-label="Close">
|
|
14946
|
-
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
14947
|
-
<path d="M1 1L13 13M1 13L13 1" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
|
|
14948
|
-
</svg>
|
|
14949
|
-
</button>
|
|
14950
|
-
<div class="poofnet-modal-header">
|
|
14951
|
-
<div class="poofnet-modal-icon">⚠️</div>
|
|
14952
|
-
<h2 class="poofnet-modal-title">Transaction Not Supported</h2>
|
|
14953
|
-
<p class="poofnet-modal-subtitle">Poofnet Simulated Blockchain</p>
|
|
14954
|
-
</div>
|
|
14955
|
-
|
|
14956
|
-
<div class="poofnet-modal-body">
|
|
14957
|
-
<div class="poofnet-info-box" style="background: #fef3c7;">
|
|
14958
|
-
<span class="poofnet-info-icon">ℹ️</span>
|
|
14959
|
-
<span class="poofnet-info-text" style="color: #92400e;">
|
|
14960
|
-
Poofnet is a simulated blockchain and does not support real Solana transactions.
|
|
14961
|
-
Deploy your project to mainnet to test real transactions.
|
|
14962
|
-
</span>
|
|
14963
|
-
</div>
|
|
14964
|
-
</div>
|
|
14965
|
-
|
|
14966
|
-
<div class="poofnet-modal-footer">
|
|
14967
|
-
<button id="poofnet-cancel-btn" class="poofnet-btn poofnet-btn-cancel" style="flex: 1;">Close</button>
|
|
14968
|
-
</div>
|
|
14969
|
-
</div>
|
|
14970
|
-
</div>
|
|
14971
|
-
`;
|
|
14972
|
-
}
|
|
14973
14866
|
async showTransactionModal(message) {
|
|
14974
14867
|
return new Promise((resolve) => {
|
|
14975
14868
|
// Parse the transaction message for display
|
|
@@ -14983,7 +14876,7 @@ class OffchainAuthProvider {
|
|
|
14983
14876
|
// Create modal container
|
|
14984
14877
|
this.modalContainer = document.createElement("div");
|
|
14985
14878
|
this.modalContainer.id = "poofnet-tx-modal";
|
|
14986
|
-
this.modalContainer.
|
|
14879
|
+
this.modalContainer.appendChild(this.buildTransactionModalContent(parsed, message));
|
|
14987
14880
|
document.body.appendChild(this.modalContainer);
|
|
14988
14881
|
// Add styles
|
|
14989
14882
|
const style = document.createElement("style");
|
|
@@ -15066,24 +14959,59 @@ class OffchainAuthProvider {
|
|
|
15066
14959
|
}, 200);
|
|
15067
14960
|
}
|
|
15068
14961
|
}
|
|
15069
|
-
|
|
15070
|
-
|
|
15071
|
-
|
|
15072
|
-
|
|
15073
|
-
|
|
15074
|
-
|
|
15075
|
-
|
|
15076
|
-
|
|
15077
|
-
|
|
15078
|
-
|
|
15079
|
-
|
|
15080
|
-
|
|
15081
|
-
|
|
15082
|
-
|
|
15083
|
-
|
|
15084
|
-
|
|
15085
|
-
|
|
15086
|
-
|
|
14962
|
+
createElement(tag, className, text) {
|
|
14963
|
+
const el = document.createElement(tag);
|
|
14964
|
+
if (className)
|
|
14965
|
+
el.className = className;
|
|
14966
|
+
if (text !== undefined)
|
|
14967
|
+
el.textContent = text;
|
|
14968
|
+
return el;
|
|
14969
|
+
}
|
|
14970
|
+
appendTextElement(parent, tag, className, text) {
|
|
14971
|
+
const el = this.createElement(tag, className, text);
|
|
14972
|
+
parent.appendChild(el);
|
|
14973
|
+
return el;
|
|
14974
|
+
}
|
|
14975
|
+
buildModalShell(icon, title) {
|
|
14976
|
+
const overlay = this.createElement("div", "poofnet-modal-overlay");
|
|
14977
|
+
const content = this.createElement("div", "poofnet-modal-content");
|
|
14978
|
+
overlay.appendChild(content);
|
|
14979
|
+
const close = this.createElement("button", "poofnet-close-btn", "×");
|
|
14980
|
+
close.id = "poofnet-close-btn";
|
|
14981
|
+
close.setAttribute("aria-label", "Close");
|
|
14982
|
+
close.type = "button";
|
|
14983
|
+
content.appendChild(close);
|
|
14984
|
+
const header = this.createElement("div", "poofnet-modal-header");
|
|
14985
|
+
this.appendTextElement(header, "div", "poofnet-modal-icon", icon);
|
|
14986
|
+
this.appendTextElement(header, "h2", "poofnet-modal-title", title);
|
|
14987
|
+
this.appendTextElement(header, "p", "poofnet-modal-subtitle", "Poofnet Simulated Blockchain");
|
|
14988
|
+
content.appendChild(header);
|
|
14989
|
+
const body = this.createElement("div", "poofnet-modal-body");
|
|
14990
|
+
content.appendChild(body);
|
|
14991
|
+
const footer = this.createElement("div", "poofnet-modal-footer");
|
|
14992
|
+
content.appendChild(footer);
|
|
14993
|
+
return { overlay, body, footer };
|
|
14994
|
+
}
|
|
14995
|
+
buildInfoBox(text, warning = false) {
|
|
14996
|
+
const info = this.createElement("div", "poofnet-info-box");
|
|
14997
|
+
if (warning)
|
|
14998
|
+
info.style.background = "#fef3c7";
|
|
14999
|
+
this.appendTextElement(info, "span", "poofnet-info-icon", "ℹ️");
|
|
15000
|
+
const infoText = this.createElement("span", "poofnet-info-text", text);
|
|
15001
|
+
if (warning)
|
|
15002
|
+
infoText.style.color = "#92400e";
|
|
15003
|
+
info.appendChild(infoText);
|
|
15004
|
+
return info;
|
|
15005
|
+
}
|
|
15006
|
+
buildUnsupportedModalContent() {
|
|
15007
|
+
const { overlay, body, footer } = this.buildModalShell("⚠️", "Transaction Not Supported");
|
|
15008
|
+
body.appendChild(this.buildInfoBox("Poofnet is a simulated blockchain and does not support real Solana transactions. Deploy your project to mainnet to test real transactions.", true));
|
|
15009
|
+
const close = this.createElement("button", "poofnet-btn poofnet-btn-cancel", "Close");
|
|
15010
|
+
close.id = "poofnet-cancel-btn";
|
|
15011
|
+
close.type = "button";
|
|
15012
|
+
close.style.flex = "1";
|
|
15013
|
+
footer.appendChild(close);
|
|
15014
|
+
return overlay;
|
|
15087
15015
|
}
|
|
15088
15016
|
formatPath(path) {
|
|
15089
15017
|
const parts = path.split("/").filter(Boolean);
|
|
@@ -15116,59 +15044,11 @@ class OffchainAuthProvider {
|
|
|
15116
15044
|
return `Delete from ${collection}`;
|
|
15117
15045
|
return isNew ? `Create in ${collection}` : `Update ${collection}`;
|
|
15118
15046
|
}
|
|
15119
|
-
|
|
15047
|
+
buildTransactionModalContent(parsed, rawMessage) {
|
|
15120
15048
|
const instructions = parsed.instructions || [];
|
|
15121
15049
|
// Group instructions by type for summary
|
|
15122
15050
|
const sets = instructions.filter((i) => i.type === "set");
|
|
15123
15051
|
const deletes = instructions.filter((i) => i.type === "delete");
|
|
15124
|
-
const instructionsList = instructions
|
|
15125
|
-
.map((inst) => {
|
|
15126
|
-
const { collection, documentId } = this.formatPath(inst.path);
|
|
15127
|
-
const isDelete = inst.type === "delete";
|
|
15128
|
-
const icon = isDelete ? "🗑️" : "✏️";
|
|
15129
|
-
const actionClass = isDelete
|
|
15130
|
-
? "poofnet-action-delete"
|
|
15131
|
-
: "poofnet-action-set";
|
|
15132
|
-
// Format data fields for display
|
|
15133
|
-
let fieldsHtml = "";
|
|
15134
|
-
if (inst.data && !isDelete) {
|
|
15135
|
-
const fields = Object.entries(inst.data)
|
|
15136
|
-
.filter(([key]) => !key.startsWith("_")) // Hide internal fields
|
|
15137
|
-
.slice(0, 4);
|
|
15138
|
-
if (fields.length > 0) {
|
|
15139
|
-
fieldsHtml = `
|
|
15140
|
-
<div class="poofnet-fields">
|
|
15141
|
-
${fields
|
|
15142
|
-
.map(([key, value]) => `
|
|
15143
|
-
<div class="poofnet-field">
|
|
15144
|
-
<span class="poofnet-field-key">${this.escapeHtml(key)}:</span>
|
|
15145
|
-
<span class="poofnet-field-value">${this.escapeHtml(this.formatFieldValue(value))}</span>
|
|
15146
|
-
</div>
|
|
15147
|
-
`)
|
|
15148
|
-
.join("")}
|
|
15149
|
-
${Object.keys(inst.data).filter((k) => !k.startsWith("_"))
|
|
15150
|
-
.length > 4
|
|
15151
|
-
? `<div class="poofnet-field-more">+${Object.keys(inst.data).filter((k) => !k.startsWith("_")).length - 4} more fields</div>`
|
|
15152
|
-
: ""}
|
|
15153
|
-
</div>
|
|
15154
|
-
`;
|
|
15155
|
-
}
|
|
15156
|
-
}
|
|
15157
|
-
return `
|
|
15158
|
-
<div class="poofnet-instruction ${actionClass}">
|
|
15159
|
-
<div class="poofnet-instruction-header">
|
|
15160
|
-
<span class="poofnet-instruction-icon">${icon}</span>
|
|
15161
|
-
<span class="poofnet-instruction-action">${isDelete ? "Delete" : "Save"}</span>
|
|
15162
|
-
<span class="poofnet-instruction-collection">${this.escapeHtml(collection)}</span>
|
|
15163
|
-
</div>
|
|
15164
|
-
${documentId
|
|
15165
|
-
? `<div class="poofnet-instruction-id">ID: ${this.escapeHtml(documentId)}</div>`
|
|
15166
|
-
: ""}
|
|
15167
|
-
${fieldsHtml}
|
|
15168
|
-
</div>
|
|
15169
|
-
`;
|
|
15170
|
-
})
|
|
15171
|
-
.join("");
|
|
15172
15052
|
// Create summary text
|
|
15173
15053
|
let summaryText = "";
|
|
15174
15054
|
if (sets.length > 0 && deletes.length > 0) {
|
|
@@ -15180,50 +15060,65 @@ class OffchainAuthProvider {
|
|
|
15180
15060
|
else if (deletes.length > 0) {
|
|
15181
15061
|
summaryText = `${deletes.length} delete${deletes.length > 1 ? "s" : ""}`;
|
|
15182
15062
|
}
|
|
15183
|
-
|
|
15184
|
-
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
|
|
15188
|
-
|
|
15189
|
-
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
|
|
15193
|
-
|
|
15194
|
-
|
|
15195
|
-
|
|
15196
|
-
|
|
15197
|
-
|
|
15198
|
-
|
|
15199
|
-
|
|
15200
|
-
|
|
15201
|
-
|
|
15202
|
-
|
|
15203
|
-
|
|
15204
|
-
|
|
15205
|
-
|
|
15206
|
-
|
|
15207
|
-
|
|
15208
|
-
|
|
15209
|
-
|
|
15210
|
-
|
|
15211
|
-
|
|
15212
|
-
|
|
15213
|
-
|
|
15214
|
-
|
|
15215
|
-
|
|
15216
|
-
|
|
15217
|
-
|
|
15218
|
-
|
|
15219
|
-
|
|
15220
|
-
|
|
15221
|
-
|
|
15222
|
-
|
|
15223
|
-
|
|
15224
|
-
|
|
15225
|
-
|
|
15226
|
-
|
|
15063
|
+
const { overlay, body, footer } = this.buildModalShell("🔐", "Confirm Transaction");
|
|
15064
|
+
if (instructions.length > 0) {
|
|
15065
|
+
if (summaryText) {
|
|
15066
|
+
this.appendTextElement(body, "div", "poofnet-summary", summaryText);
|
|
15067
|
+
}
|
|
15068
|
+
const list = this.createElement("div", "poofnet-instructions-list");
|
|
15069
|
+
for (const inst of instructions) {
|
|
15070
|
+
list.appendChild(this.buildInstructionElement(inst));
|
|
15071
|
+
}
|
|
15072
|
+
body.appendChild(list);
|
|
15073
|
+
}
|
|
15074
|
+
else {
|
|
15075
|
+
const section = this.createElement("div", "poofnet-section");
|
|
15076
|
+
this.appendTextElement(section, "h3", "poofnet-section-title", "Message");
|
|
15077
|
+
const raw = this.createElement("pre", "poofnet-raw-message", rawMessage.slice(0, 200) + (rawMessage.length > 200 ? "..." : ""));
|
|
15078
|
+
section.appendChild(raw);
|
|
15079
|
+
body.appendChild(section);
|
|
15080
|
+
}
|
|
15081
|
+
body.appendChild(this.buildInfoBox("This is a simulated transaction. No real fees will be charged."));
|
|
15082
|
+
const cancel = this.createElement("button", "poofnet-btn poofnet-btn-cancel", "Cancel");
|
|
15083
|
+
cancel.id = "poofnet-cancel-btn";
|
|
15084
|
+
cancel.type = "button";
|
|
15085
|
+
footer.appendChild(cancel);
|
|
15086
|
+
const confirm = this.createElement("button", "poofnet-btn poofnet-btn-confirm", "Confirm");
|
|
15087
|
+
confirm.id = "poofnet-confirm-btn";
|
|
15088
|
+
confirm.type = "button";
|
|
15089
|
+
footer.appendChild(confirm);
|
|
15090
|
+
return overlay;
|
|
15091
|
+
}
|
|
15092
|
+
buildInstructionElement(inst) {
|
|
15093
|
+
const { collection, documentId } = this.formatPath(inst.path);
|
|
15094
|
+
const isDelete = inst.type === "delete";
|
|
15095
|
+
const card = this.createElement("div", `poofnet-instruction ${isDelete ? "poofnet-action-delete" : "poofnet-action-set"}`);
|
|
15096
|
+
const header = this.createElement("div", "poofnet-instruction-header");
|
|
15097
|
+
this.appendTextElement(header, "span", "poofnet-instruction-icon", isDelete ? "🗑️" : "✏️");
|
|
15098
|
+
this.appendTextElement(header, "span", "poofnet-instruction-action", isDelete ? "Delete" : "Save");
|
|
15099
|
+
this.appendTextElement(header, "span", "poofnet-instruction-collection", collection);
|
|
15100
|
+
card.appendChild(header);
|
|
15101
|
+
if (documentId) {
|
|
15102
|
+
this.appendTextElement(card, "div", "poofnet-instruction-id", `ID: ${documentId}`);
|
|
15103
|
+
}
|
|
15104
|
+
if (inst.data && !isDelete) {
|
|
15105
|
+
const fieldKeys = Object.keys(inst.data).filter((key) => !key.startsWith("_"));
|
|
15106
|
+
const visibleFields = fieldKeys.slice(0, 4);
|
|
15107
|
+
if (visibleFields.length > 0) {
|
|
15108
|
+
const fields = this.createElement("div", "poofnet-fields");
|
|
15109
|
+
for (const key of visibleFields) {
|
|
15110
|
+
const row = this.createElement("div", "poofnet-field");
|
|
15111
|
+
this.appendTextElement(row, "span", "poofnet-field-key", `${key}:`);
|
|
15112
|
+
this.appendTextElement(row, "span", "poofnet-field-value", this.formatFieldValue(inst.data[key]));
|
|
15113
|
+
fields.appendChild(row);
|
|
15114
|
+
}
|
|
15115
|
+
if (fieldKeys.length > 4) {
|
|
15116
|
+
this.appendTextElement(fields, "div", "poofnet-field-more", `+${fieldKeys.length - 4} more fields`);
|
|
15117
|
+
}
|
|
15118
|
+
card.appendChild(fields);
|
|
15119
|
+
}
|
|
15120
|
+
}
|
|
15121
|
+
return card;
|
|
15227
15122
|
}
|
|
15228
15123
|
getModalStyles() {
|
|
15229
15124
|
return `
|
|
@@ -18559,9 +18454,7 @@ const emailProviderSingleton = new EmailAuthProvider();
|
|
|
18559
18454
|
function openEmailModal() {
|
|
18560
18455
|
return new Promise((resolve) => {
|
|
18561
18456
|
var _a;
|
|
18562
|
-
const root =
|
|
18563
|
-
root.id = 'bounded-auth-modal';
|
|
18564
|
-
root.innerHTML = MODAL_HTML;
|
|
18457
|
+
const root = createEmailModalTree();
|
|
18565
18458
|
const style = document.createElement('style');
|
|
18566
18459
|
style.textContent = MODAL_CSS;
|
|
18567
18460
|
root.appendChild(style);
|
|
@@ -18649,26 +18542,97 @@ function openEmailModal() {
|
|
|
18649
18542
|
});
|
|
18650
18543
|
});
|
|
18651
18544
|
}
|
|
18652
|
-
|
|
18653
|
-
|
|
18654
|
-
|
|
18655
|
-
|
|
18656
|
-
|
|
18657
|
-
|
|
18658
|
-
|
|
18659
|
-
|
|
18660
|
-
|
|
18661
|
-
|
|
18662
|
-
|
|
18663
|
-
|
|
18664
|
-
|
|
18665
|
-
|
|
18666
|
-
|
|
18667
|
-
|
|
18668
|
-
|
|
18669
|
-
|
|
18670
|
-
|
|
18671
|
-
|
|
18545
|
+
function createEmailModalTree() {
|
|
18546
|
+
const root = document.createElement('div');
|
|
18547
|
+
root.id = 'bounded-auth-modal';
|
|
18548
|
+
const overlay = document.createElement('div');
|
|
18549
|
+
overlay.className = 'ba-overlay';
|
|
18550
|
+
root.appendChild(overlay);
|
|
18551
|
+
const card = document.createElement('div');
|
|
18552
|
+
card.className = 'ba-card';
|
|
18553
|
+
card.setAttribute('role', 'dialog');
|
|
18554
|
+
card.setAttribute('aria-modal', 'true');
|
|
18555
|
+
card.setAttribute('aria-label', 'Sign in');
|
|
18556
|
+
overlay.appendChild(card);
|
|
18557
|
+
const close = document.createElement('button');
|
|
18558
|
+
close.id = 'ba-close';
|
|
18559
|
+
close.className = 'ba-x';
|
|
18560
|
+
close.setAttribute('aria-label', 'Close');
|
|
18561
|
+
close.type = 'button';
|
|
18562
|
+
close.textContent = '×';
|
|
18563
|
+
card.appendChild(close);
|
|
18564
|
+
const brand = document.createElement('div');
|
|
18565
|
+
brand.className = 'ba-brand';
|
|
18566
|
+
const dot = document.createElement('span');
|
|
18567
|
+
dot.className = 'ba-dot';
|
|
18568
|
+
brand.appendChild(dot);
|
|
18569
|
+
brand.appendChild(document.createTextNode(' Sign in'));
|
|
18570
|
+
card.appendChild(brand);
|
|
18571
|
+
const emailStep = document.createElement('div');
|
|
18572
|
+
emailStep.id = 'ba-email-step';
|
|
18573
|
+
card.appendChild(emailStep);
|
|
18574
|
+
const emailLabel = document.createElement('label');
|
|
18575
|
+
emailLabel.className = 'ba-label';
|
|
18576
|
+
emailLabel.htmlFor = 'ba-email';
|
|
18577
|
+
emailLabel.textContent = 'Email';
|
|
18578
|
+
emailStep.appendChild(emailLabel);
|
|
18579
|
+
const emailInput = document.createElement('input');
|
|
18580
|
+
emailInput.id = 'ba-email';
|
|
18581
|
+
emailInput.className = 'ba-input';
|
|
18582
|
+
emailInput.type = 'email';
|
|
18583
|
+
emailInput.inputMode = 'email';
|
|
18584
|
+
emailInput.autocomplete = 'email';
|
|
18585
|
+
emailInput.placeholder = 'you@example.com';
|
|
18586
|
+
emailStep.appendChild(emailInput);
|
|
18587
|
+
const emailButton = document.createElement('button');
|
|
18588
|
+
emailButton.id = 'ba-email-btn';
|
|
18589
|
+
emailButton.className = 'ba-btn';
|
|
18590
|
+
emailButton.type = 'button';
|
|
18591
|
+
emailButton.textContent = 'Continue';
|
|
18592
|
+
emailStep.appendChild(emailButton);
|
|
18593
|
+
const otpStep = document.createElement('div');
|
|
18594
|
+
otpStep.id = 'ba-otp-step';
|
|
18595
|
+
otpStep.className = 'hidden';
|
|
18596
|
+
card.appendChild(otpStep);
|
|
18597
|
+
const otpLabel = document.createElement('label');
|
|
18598
|
+
otpLabel.className = 'ba-label';
|
|
18599
|
+
otpLabel.htmlFor = 'ba-otp';
|
|
18600
|
+
otpLabel.appendChild(document.createTextNode('Enter the code sent to '));
|
|
18601
|
+
const sentTo = document.createElement('span');
|
|
18602
|
+
sentTo.id = 'ba-sent-to';
|
|
18603
|
+
sentTo.className = 'ba-em';
|
|
18604
|
+
otpLabel.appendChild(sentTo);
|
|
18605
|
+
otpStep.appendChild(otpLabel);
|
|
18606
|
+
const otpInput = document.createElement('input');
|
|
18607
|
+
otpInput.id = 'ba-otp';
|
|
18608
|
+
otpInput.className = 'ba-input ba-code';
|
|
18609
|
+
otpInput.inputMode = 'numeric';
|
|
18610
|
+
otpInput.autocomplete = 'one-time-code';
|
|
18611
|
+
otpInput.maxLength = 8;
|
|
18612
|
+
otpInput.placeholder = '······';
|
|
18613
|
+
otpStep.appendChild(otpInput);
|
|
18614
|
+
const otpButton = document.createElement('button');
|
|
18615
|
+
otpButton.id = 'ba-otp-btn';
|
|
18616
|
+
otpButton.className = 'ba-btn';
|
|
18617
|
+
otpButton.type = 'button';
|
|
18618
|
+
otpButton.textContent = 'Verify & continue';
|
|
18619
|
+
otpStep.appendChild(otpButton);
|
|
18620
|
+
const backButton = document.createElement('button');
|
|
18621
|
+
backButton.id = 'ba-back';
|
|
18622
|
+
backButton.className = 'ba-link';
|
|
18623
|
+
backButton.type = 'button';
|
|
18624
|
+
backButton.textContent = 'Use a different email';
|
|
18625
|
+
otpStep.appendChild(backButton);
|
|
18626
|
+
const msg = document.createElement('div');
|
|
18627
|
+
msg.id = 'ba-msg';
|
|
18628
|
+
msg.className = 'ba-msg';
|
|
18629
|
+
card.appendChild(msg);
|
|
18630
|
+
const foot = document.createElement('div');
|
|
18631
|
+
foot.className = 'ba-foot';
|
|
18632
|
+
foot.textContent = 'Secured by Bounded';
|
|
18633
|
+
card.appendChild(foot);
|
|
18634
|
+
return root;
|
|
18635
|
+
}
|
|
18672
18636
|
const MODAL_CSS = `
|
|
18673
18637
|
#bounded-auth-modal .ba-overlay{position:fixed;inset:0;background:rgba(8,10,18,.62);backdrop-filter:blur(4px);
|
|
18674
18638
|
display:flex;align-items:center;justify-content:center;z-index:2147483000;opacity:1;transition:opacity .16s ease;
|
|
@@ -21406,7 +21370,7 @@ async function awaitSignInGestureAndSign(theme, signFn, noResultError = 'MWA ret
|
|
|
21406
21370
|
].join('; ');
|
|
21407
21371
|
const closeBtn = document.createElement('button');
|
|
21408
21372
|
closeBtn.setAttribute('aria-label', 'Close');
|
|
21409
|
-
closeBtn.textContent = '×';
|
|
21373
|
+
closeBtn.textContent = '×';
|
|
21410
21374
|
closeBtn.style.cssText = [
|
|
21411
21375
|
'position: absolute',
|
|
21412
21376
|
'top: 12px',
|