@rhinestone/deposit-modal 0.16.0 → 0.18.0
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 +68 -0
- package/dist/{DepositModalReown-IFN6YLZJ.cjs → DepositModalReown-TVO3ZQQK.cjs} +17 -17
- package/dist/{DepositModalReown-R7UROJPJ.mjs → DepositModalReown-VCY65DJX.mjs} +4 -4
- package/dist/WithdrawModal-GR3HLYXU.cjs +11 -0
- package/dist/{WithdrawModal-XKSSHVEJ.mjs → WithdrawModal-RMCYJJ4S.mjs} +3 -3
- package/dist/bearer-transport-CVHNBgoV.d.cts +14 -0
- package/dist/bearer-transport-CVHNBgoV.d.ts +14 -0
- package/dist/{chunk-24N4KMJX.cjs → chunk-34JVJZEZ.cjs} +71 -71
- package/dist/{chunk-3HCCR54R.mjs → chunk-3TEVMP76.mjs} +1 -1
- package/dist/chunk-ADEWTBSN.cjs +19 -0
- package/dist/{chunk-EA5CE2UZ.mjs → chunk-AIZKGFVA.mjs} +675 -233
- package/dist/{chunk-F6ROQ6RJ.mjs → chunk-EKC2IRQG.mjs} +185 -69
- package/dist/{chunk-V466XQSG.cjs → chunk-JV5OGG53.cjs} +630 -514
- package/dist/{chunk-H4O22O7Y.cjs → chunk-N3AAT6BS.cjs} +826 -384
- package/dist/{chunk-5CM3ZQ5U.cjs → chunk-N6JJG57R.cjs} +1 -1
- package/dist/chunk-O4JZKKCZ.cjs +41 -0
- package/dist/chunk-PP4QE32S.mjs +19 -0
- package/dist/{chunk-HMB2XQGD.mjs → chunk-R2B6VD4E.mjs} +1 -1
- package/dist/chunk-X4EUXBHJ.mjs +41 -0
- package/dist/compliance.cjs +14 -0
- package/dist/compliance.d.cts +10 -0
- package/dist/compliance.d.ts +10 -0
- package/dist/compliance.mjs +14 -0
- package/dist/constants.cjs +3 -3
- package/dist/constants.d.cts +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.mjs +3 -3
- package/dist/deposit.cjs +4 -4
- package/dist/deposit.d.cts +2 -2
- package/dist/deposit.d.ts +2 -2
- package/dist/deposit.mjs +3 -3
- package/dist/embed.cjs +16 -16
- package/dist/embed.d.cts +1 -1
- package/dist/embed.d.ts +1 -1
- package/dist/embed.mjs +8 -8
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +4 -4
- package/dist/offramp.cjs +25 -0
- package/dist/offramp.d.cts +28 -0
- package/dist/offramp.d.ts +28 -0
- package/dist/offramp.mjs +25 -0
- package/dist/onramp.cjs +27 -0
- package/dist/onramp.d.cts +37 -0
- package/dist/onramp.d.ts +37 -0
- package/dist/onramp.mjs +27 -0
- package/dist/ramp-types-C6aUz4SZ.d.cts +43 -0
- package/dist/ramp-types-C6aUz4SZ.d.ts +43 -0
- package/dist/server.cjs +54 -2
- package/dist/server.d.cts +13 -1
- package/dist/server.d.ts +13 -1
- package/dist/server.mjs +52 -0
- package/dist/styles.css +22 -0
- package/dist/{types-B9SbZQIG.d.ts → types-CZYypODQ.d.ts} +3 -2
- package/dist/{types-SwGGf0eH.d.cts → types-CbUs4boj.d.cts} +3 -2
- package/dist/withdraw.cjs +4 -4
- package/dist/withdraw.d.cts +2 -2
- package/dist/withdraw.d.ts +2 -2
- package/dist/withdraw.mjs +3 -3
- package/package.json +35 -5
- package/dist/WithdrawModal-SZEAI473.cjs +0 -11
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { C as CustomerSessionOptions } from './bearer-transport-CVHNBgoV.js';
|
|
2
|
+
export { a as CustomerSession, S as ScopedRequestError } from './bearer-transport-CVHNBgoV.js';
|
|
3
|
+
import { B as BankIntent, R as RampPayment, P as PaymentLegStatus, a as PaymentReturnStatus, b as RampSession, c as RampPage, d as RampOption, e as RampPagination } from './ramp-types-C6aUz4SZ.js';
|
|
4
|
+
export { H as HostedNextAction, f as RampCurrency } from './ramp-types-C6aUz4SZ.js';
|
|
5
|
+
|
|
6
|
+
interface OfframpSessionRequest extends BankIntent {
|
|
7
|
+
purpose: "beneficiary_collection";
|
|
8
|
+
}
|
|
9
|
+
interface OfframpOptionsRequest extends BankIntent {
|
|
10
|
+
/** Decimal fiat major units the recipient receives, not crypto input. */
|
|
11
|
+
amount: string;
|
|
12
|
+
}
|
|
13
|
+
interface OfframpPayment extends RampPayment {
|
|
14
|
+
funding: PaymentLegStatus;
|
|
15
|
+
payout: PaymentLegStatus;
|
|
16
|
+
reversal: PaymentReturnStatus;
|
|
17
|
+
cryptoReturn: PaymentReturnStatus;
|
|
18
|
+
}
|
|
19
|
+
/** No requests until an offramp method is called. */
|
|
20
|
+
declare function createOfframpService(options: CustomerSessionOptions): {
|
|
21
|
+
createSession: (body: OfframpSessionRequest) => Promise<RampSession>;
|
|
22
|
+
getSession: (id: string) => Promise<RampSession>;
|
|
23
|
+
getOptions: (intent: OfframpOptionsRequest) => Promise<RampPage<RampOption>>;
|
|
24
|
+
listPayments: (page?: RampPagination) => Promise<RampPage<OfframpPayment>>;
|
|
25
|
+
getPayment: (id: string) => Promise<OfframpPayment>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export { CustomerSessionOptions, type OfframpOptionsRequest, type OfframpPayment, type OfframpSessionRequest, PaymentLegStatus, PaymentReturnStatus, RampOption, RampPage, RampPagination, RampSession, createOfframpService };
|
package/dist/offramp.mjs
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {
|
|
2
|
+
rampQuery,
|
|
3
|
+
rampResourceId
|
|
4
|
+
} from "./chunk-PP4QE32S.mjs";
|
|
5
|
+
import {
|
|
6
|
+
ScopedRequestError,
|
|
7
|
+
createBearerTransport
|
|
8
|
+
} from "./chunk-X4EUXBHJ.mjs";
|
|
9
|
+
import "./chunk-3TEVMP76.mjs";
|
|
10
|
+
|
|
11
|
+
// src/core/offramp-service.ts
|
|
12
|
+
function createOfframpService(options) {
|
|
13
|
+
const request = createBearerTransport(options);
|
|
14
|
+
return {
|
|
15
|
+
createSession: (body) => request("/offramp/sessions", body),
|
|
16
|
+
getSession: (id) => request(`/offramp/sessions/${rampResourceId(id)}`),
|
|
17
|
+
getOptions: (intent) => request(`/offramp/options?${rampQuery(intent)}`),
|
|
18
|
+
listPayments: (page = {}) => request(`/offramp/payments?${rampQuery(page)}`),
|
|
19
|
+
getPayment: (id) => request(`/offramp/payments/${rampResourceId(id)}`)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
ScopedRequestError,
|
|
24
|
+
createOfframpService
|
|
25
|
+
};
|
package/dist/onramp.cjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkADEWTBSNcjs = require('./chunk-ADEWTBSN.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkO4JZKKCZcjs = require('./chunk-O4JZKKCZ.cjs');
|
|
9
|
+
require('./chunk-N6JJG57R.cjs');
|
|
10
|
+
|
|
11
|
+
// src/core/onramp-service.ts
|
|
12
|
+
function createOnrampService(options) {
|
|
13
|
+
const request = _chunkO4JZKKCZcjs.createBearerTransport.call(void 0, options);
|
|
14
|
+
return {
|
|
15
|
+
createSession: (body) => request("/onramp/sessions", body),
|
|
16
|
+
getSession: (id) => request(`/onramp/sessions/${_chunkADEWTBSNcjs.rampResourceId.call(void 0, id)}`),
|
|
17
|
+
getOptions: (intent) => request(`/onramp/options?${_chunkADEWTBSNcjs.rampQuery.call(void 0, intent)}`),
|
|
18
|
+
listAccounts: (page = {}) => request(`/onramp/accounts?${_chunkADEWTBSNcjs.rampQuery.call(void 0, page)}`),
|
|
19
|
+
getAccount: (id) => request(`/onramp/accounts/${_chunkADEWTBSNcjs.rampResourceId.call(void 0, id)}`),
|
|
20
|
+
listPayments: (page = {}) => request(`/onramp/payments?${_chunkADEWTBSNcjs.rampQuery.call(void 0, page)}`),
|
|
21
|
+
getPayment: (id) => request(`/onramp/payments/${_chunkADEWTBSNcjs.rampResourceId.call(void 0, id)}`)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
exports.ScopedRequestError = _chunkO4JZKKCZcjs.ScopedRequestError; exports.createOnrampService = createOnrampService;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { C as CustomerSessionOptions } from './bearer-transport-CVHNBgoV.cjs';
|
|
2
|
+
export { a as CustomerSession, S as ScopedRequestError } from './bearer-transport-CVHNBgoV.cjs';
|
|
3
|
+
import { f as RampCurrency, B as BankIntent, R as RampPayment, P as PaymentLegStatus, a as PaymentReturnStatus, b as RampSession, c as RampPage, d as RampOption, e as RampPagination } from './ramp-types-C6aUz4SZ.cjs';
|
|
4
|
+
export { H as HostedNextAction } from './ramp-types-C6aUz4SZ.cjs';
|
|
5
|
+
|
|
6
|
+
interface OnrampSessionRequest extends BankIntent {
|
|
7
|
+
purpose: "account_setup";
|
|
8
|
+
}
|
|
9
|
+
interface OnrampOptionsRequest extends BankIntent {
|
|
10
|
+
/** Decimal fiat major units sent; the actual transfer determines payment amount. */
|
|
11
|
+
amount?: string;
|
|
12
|
+
}
|
|
13
|
+
interface OnrampPayment extends RampPayment {
|
|
14
|
+
bankReceipt: PaymentLegStatus;
|
|
15
|
+
conversion: PaymentLegStatus;
|
|
16
|
+
cryptoDelivery: PaymentLegStatus;
|
|
17
|
+
refund: PaymentReturnStatus;
|
|
18
|
+
adjustment: PaymentReturnStatus;
|
|
19
|
+
}
|
|
20
|
+
interface OnrampAccount {
|
|
21
|
+
id: string;
|
|
22
|
+
currency: RampCurrency;
|
|
23
|
+
paymentMethod: "bank_transfer";
|
|
24
|
+
status: "pending" | "active" | "disabled";
|
|
25
|
+
}
|
|
26
|
+
/** No requests until an onramp method is called. */
|
|
27
|
+
declare function createOnrampService(options: CustomerSessionOptions): {
|
|
28
|
+
createSession: (body: OnrampSessionRequest) => Promise<RampSession>;
|
|
29
|
+
getSession: (id: string) => Promise<RampSession>;
|
|
30
|
+
getOptions: (intent: OnrampOptionsRequest) => Promise<RampPage<RampOption>>;
|
|
31
|
+
listAccounts: (page?: RampPagination) => Promise<RampPage<OnrampAccount>>;
|
|
32
|
+
getAccount: (id: string) => Promise<OnrampAccount>;
|
|
33
|
+
listPayments: (page?: RampPagination) => Promise<RampPage<OnrampPayment>>;
|
|
34
|
+
getPayment: (id: string) => Promise<OnrampPayment>;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { CustomerSessionOptions, type OnrampAccount, type OnrampOptionsRequest, type OnrampPayment, type OnrampSessionRequest, PaymentLegStatus, PaymentReturnStatus, RampCurrency, RampOption, RampPage, RampPagination, RampSession, createOnrampService };
|
package/dist/onramp.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { C as CustomerSessionOptions } from './bearer-transport-CVHNBgoV.js';
|
|
2
|
+
export { a as CustomerSession, S as ScopedRequestError } from './bearer-transport-CVHNBgoV.js';
|
|
3
|
+
import { f as RampCurrency, B as BankIntent, R as RampPayment, P as PaymentLegStatus, a as PaymentReturnStatus, b as RampSession, c as RampPage, d as RampOption, e as RampPagination } from './ramp-types-C6aUz4SZ.js';
|
|
4
|
+
export { H as HostedNextAction } from './ramp-types-C6aUz4SZ.js';
|
|
5
|
+
|
|
6
|
+
interface OnrampSessionRequest extends BankIntent {
|
|
7
|
+
purpose: "account_setup";
|
|
8
|
+
}
|
|
9
|
+
interface OnrampOptionsRequest extends BankIntent {
|
|
10
|
+
/** Decimal fiat major units sent; the actual transfer determines payment amount. */
|
|
11
|
+
amount?: string;
|
|
12
|
+
}
|
|
13
|
+
interface OnrampPayment extends RampPayment {
|
|
14
|
+
bankReceipt: PaymentLegStatus;
|
|
15
|
+
conversion: PaymentLegStatus;
|
|
16
|
+
cryptoDelivery: PaymentLegStatus;
|
|
17
|
+
refund: PaymentReturnStatus;
|
|
18
|
+
adjustment: PaymentReturnStatus;
|
|
19
|
+
}
|
|
20
|
+
interface OnrampAccount {
|
|
21
|
+
id: string;
|
|
22
|
+
currency: RampCurrency;
|
|
23
|
+
paymentMethod: "bank_transfer";
|
|
24
|
+
status: "pending" | "active" | "disabled";
|
|
25
|
+
}
|
|
26
|
+
/** No requests until an onramp method is called. */
|
|
27
|
+
declare function createOnrampService(options: CustomerSessionOptions): {
|
|
28
|
+
createSession: (body: OnrampSessionRequest) => Promise<RampSession>;
|
|
29
|
+
getSession: (id: string) => Promise<RampSession>;
|
|
30
|
+
getOptions: (intent: OnrampOptionsRequest) => Promise<RampPage<RampOption>>;
|
|
31
|
+
listAccounts: (page?: RampPagination) => Promise<RampPage<OnrampAccount>>;
|
|
32
|
+
getAccount: (id: string) => Promise<OnrampAccount>;
|
|
33
|
+
listPayments: (page?: RampPagination) => Promise<RampPage<OnrampPayment>>;
|
|
34
|
+
getPayment: (id: string) => Promise<OnrampPayment>;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { CustomerSessionOptions, type OnrampAccount, type OnrampOptionsRequest, type OnrampPayment, type OnrampSessionRequest, PaymentLegStatus, PaymentReturnStatus, RampCurrency, RampOption, RampPage, RampPagination, RampSession, createOnrampService };
|
package/dist/onramp.mjs
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
rampQuery,
|
|
3
|
+
rampResourceId
|
|
4
|
+
} from "./chunk-PP4QE32S.mjs";
|
|
5
|
+
import {
|
|
6
|
+
ScopedRequestError,
|
|
7
|
+
createBearerTransport
|
|
8
|
+
} from "./chunk-X4EUXBHJ.mjs";
|
|
9
|
+
import "./chunk-3TEVMP76.mjs";
|
|
10
|
+
|
|
11
|
+
// src/core/onramp-service.ts
|
|
12
|
+
function createOnrampService(options) {
|
|
13
|
+
const request = createBearerTransport(options);
|
|
14
|
+
return {
|
|
15
|
+
createSession: (body) => request("/onramp/sessions", body),
|
|
16
|
+
getSession: (id) => request(`/onramp/sessions/${rampResourceId(id)}`),
|
|
17
|
+
getOptions: (intent) => request(`/onramp/options?${rampQuery(intent)}`),
|
|
18
|
+
listAccounts: (page = {}) => request(`/onramp/accounts?${rampQuery(page)}`),
|
|
19
|
+
getAccount: (id) => request(`/onramp/accounts/${rampResourceId(id)}`),
|
|
20
|
+
listPayments: (page = {}) => request(`/onramp/payments?${rampQuery(page)}`),
|
|
21
|
+
getPayment: (id) => request(`/onramp/payments/${rampResourceId(id)}`)
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
ScopedRequestError,
|
|
26
|
+
createOnrampService
|
|
27
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
type RampCurrency = "EUR" | "USD";
|
|
2
|
+
interface BankIntent {
|
|
3
|
+
country: string;
|
|
4
|
+
currency: RampCurrency;
|
|
5
|
+
paymentMethod: "bank_transfer";
|
|
6
|
+
optionId?: string;
|
|
7
|
+
}
|
|
8
|
+
interface HostedNextAction {
|
|
9
|
+
type: "hosted";
|
|
10
|
+
url: string;
|
|
11
|
+
presentation: "iframe";
|
|
12
|
+
}
|
|
13
|
+
interface RampSession {
|
|
14
|
+
id: string;
|
|
15
|
+
/** Interaction completion never proves settlement. */
|
|
16
|
+
status: "pending" | "completed" | "expired" | "failed";
|
|
17
|
+
expiresAt: string;
|
|
18
|
+
nextAction?: HostedNextAction;
|
|
19
|
+
}
|
|
20
|
+
interface RampOption {
|
|
21
|
+
optionId: string;
|
|
22
|
+
currency: RampCurrency;
|
|
23
|
+
paymentMethod: "bank_transfer";
|
|
24
|
+
}
|
|
25
|
+
type PaymentLegStatus = "not_started" | "pending" | "on_hold" | "processing" | "submitted" | "completed" | "failed";
|
|
26
|
+
type PaymentReturnStatus = "none" | "pending" | "processing" | "completed" | "failed";
|
|
27
|
+
interface RampPayment {
|
|
28
|
+
id: string;
|
|
29
|
+
amount: string;
|
|
30
|
+
currency: RampCurrency;
|
|
31
|
+
createdAt: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
}
|
|
34
|
+
interface RampPage<T> {
|
|
35
|
+
items: T[];
|
|
36
|
+
nextCursor?: string;
|
|
37
|
+
}
|
|
38
|
+
interface RampPagination {
|
|
39
|
+
cursor?: string;
|
|
40
|
+
limit?: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type { BankIntent as B, HostedNextAction as H, PaymentLegStatus as P, RampPayment as R, PaymentReturnStatus as a, RampSession as b, RampPage as c, RampOption as d, RampPagination as e, RampCurrency as f };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
type RampCurrency = "EUR" | "USD";
|
|
2
|
+
interface BankIntent {
|
|
3
|
+
country: string;
|
|
4
|
+
currency: RampCurrency;
|
|
5
|
+
paymentMethod: "bank_transfer";
|
|
6
|
+
optionId?: string;
|
|
7
|
+
}
|
|
8
|
+
interface HostedNextAction {
|
|
9
|
+
type: "hosted";
|
|
10
|
+
url: string;
|
|
11
|
+
presentation: "iframe";
|
|
12
|
+
}
|
|
13
|
+
interface RampSession {
|
|
14
|
+
id: string;
|
|
15
|
+
/** Interaction completion never proves settlement. */
|
|
16
|
+
status: "pending" | "completed" | "expired" | "failed";
|
|
17
|
+
expiresAt: string;
|
|
18
|
+
nextAction?: HostedNextAction;
|
|
19
|
+
}
|
|
20
|
+
interface RampOption {
|
|
21
|
+
optionId: string;
|
|
22
|
+
currency: RampCurrency;
|
|
23
|
+
paymentMethod: "bank_transfer";
|
|
24
|
+
}
|
|
25
|
+
type PaymentLegStatus = "not_started" | "pending" | "on_hold" | "processing" | "submitted" | "completed" | "failed";
|
|
26
|
+
type PaymentReturnStatus = "none" | "pending" | "processing" | "completed" | "failed";
|
|
27
|
+
interface RampPayment {
|
|
28
|
+
id: string;
|
|
29
|
+
amount: string;
|
|
30
|
+
currency: RampCurrency;
|
|
31
|
+
createdAt: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
}
|
|
34
|
+
interface RampPage<T> {
|
|
35
|
+
items: T[];
|
|
36
|
+
nextCursor?: string;
|
|
37
|
+
}
|
|
38
|
+
interface RampPagination {
|
|
39
|
+
cursor?: string;
|
|
40
|
+
limit?: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type { BankIntent as B, HostedNextAction as H, PaymentLegStatus as P, RampPayment as R, PaymentReturnStatus as a, RampSession as b, RampPage as c, RampOption as d, RampPagination as e, RampCurrency as f };
|
package/dist/server.cjs
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/server.ts
|
|
2
2
|
var DEFAULT_PROCESSOR_URL = "https://v1.orchestrator.rhinestone.dev/deposit-processor";
|
|
3
|
+
function createCustomerSessionHandler(options) {
|
|
4
|
+
const url = `${(_nullishCoalesce(options.processorUrl, () => ( DEFAULT_PROCESSOR_URL))).replace(
|
|
5
|
+
/\/$/,
|
|
6
|
+
""
|
|
7
|
+
)}/compliance/sessions`;
|
|
8
|
+
const responseHeaders = {
|
|
9
|
+
"Content-Type": "application/json",
|
|
10
|
+
"Cache-Control": "no-store"
|
|
11
|
+
};
|
|
12
|
+
const error = (status, message) => new Response(JSON.stringify({ error: message }), {
|
|
13
|
+
status,
|
|
14
|
+
headers: responseHeaders
|
|
15
|
+
});
|
|
16
|
+
return async (request) => {
|
|
17
|
+
if (request.method !== "POST") return error(405, "Method not allowed");
|
|
18
|
+
try {
|
|
19
|
+
const identity = await options.authorize(request);
|
|
20
|
+
if (!identity) return error(401, "Unauthorized");
|
|
21
|
+
const upstream = await fetch(url, {
|
|
22
|
+
method: "POST",
|
|
23
|
+
headers: {
|
|
24
|
+
"Content-Type": "application/json",
|
|
25
|
+
"x-api-key": options.apiKey
|
|
26
|
+
},
|
|
27
|
+
body: JSON.stringify({
|
|
28
|
+
externalCustomerId: identity.externalCustomerId,
|
|
29
|
+
...identity.smartAccount ? { smartAccount: identity.smartAccount } : {}
|
|
30
|
+
}),
|
|
31
|
+
cache: "no-store",
|
|
32
|
+
redirect: "manual",
|
|
33
|
+
signal: AbortSignal.timeout(15e3)
|
|
34
|
+
});
|
|
35
|
+
if (!upstream.ok)
|
|
36
|
+
return error(
|
|
37
|
+
upstream.status >= 400 && upstream.status < 500 ? upstream.status : 502,
|
|
38
|
+
"Customer session unavailable"
|
|
39
|
+
);
|
|
40
|
+
const value = await upstream.json();
|
|
41
|
+
if (!value || typeof value !== "object")
|
|
42
|
+
return error(502, "Invalid customer session");
|
|
43
|
+
const { token, expiresAt } = value;
|
|
44
|
+
if (typeof token !== "string" || !token || /\s/.test(token) || typeof expiresAt !== "string" || !Number.isFinite(Date.parse(expiresAt)) || Date.parse(expiresAt) <= Date.now() || Date.parse(expiresAt) > Date.now() + 15 * 6e4)
|
|
45
|
+
return error(502, "Invalid customer session");
|
|
46
|
+
return new Response(JSON.stringify({ token, expiresAt }), {
|
|
47
|
+
headers: responseHeaders
|
|
48
|
+
});
|
|
49
|
+
} catch (e) {
|
|
50
|
+
return error(502, "Customer session unavailable");
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
3
54
|
function jsonError(message, status) {
|
|
4
55
|
return new Response(JSON.stringify({ error: message }), {
|
|
5
56
|
status,
|
|
@@ -79,7 +130,7 @@ function createRefundHandler(options) {
|
|
|
79
130
|
let body_;
|
|
80
131
|
try {
|
|
81
132
|
body_ = JSON.parse(text);
|
|
82
|
-
} catch (
|
|
133
|
+
} catch (e2) {
|
|
83
134
|
return new Response(text, {
|
|
84
135
|
status: upstream.status,
|
|
85
136
|
headers: { "Content-Type": "application/json" }
|
|
@@ -93,4 +144,5 @@ function createRefundHandler(options) {
|
|
|
93
144
|
}
|
|
94
145
|
|
|
95
146
|
|
|
96
|
-
|
|
147
|
+
|
|
148
|
+
exports.createCustomerSessionHandler = createCustomerSessionHandler; exports.createRefundHandler = createRefundHandler;
|
package/dist/server.d.cts
CHANGED
|
@@ -8,6 +8,18 @@
|
|
|
8
8
|
* Whether a deposit belongs to a given user is something only your app knows,
|
|
9
9
|
* so that one decision is yours (`authorize`) and everything else is here.
|
|
10
10
|
*/
|
|
11
|
+
interface CustomerSessionAuthorization {
|
|
12
|
+
externalCustomerId: string;
|
|
13
|
+
smartAccount?: string;
|
|
14
|
+
}
|
|
15
|
+
interface CreateCustomerSessionHandlerOptions {
|
|
16
|
+
apiKey: string;
|
|
17
|
+
processorUrl?: string;
|
|
18
|
+
/** Authenticate and enforce your CSRF policy. Derive identity server-side, never from the request body. */
|
|
19
|
+
authorize: (request: Request) => CustomerSessionAuthorization | null | Promise<CustomerSessionAuthorization | null>;
|
|
20
|
+
}
|
|
21
|
+
/** Server-only token minting endpoint. Never mount this on an unauthenticated proxy. */
|
|
22
|
+
declare function createCustomerSessionHandler(options: CreateCustomerSessionHandlerOptions): (request: Request) => Promise<Response>;
|
|
11
23
|
/** Body your own UI POSTs to your endpoint. Never trusted on its own. */
|
|
12
24
|
interface RefundRequestBody {
|
|
13
25
|
chain: string;
|
|
@@ -62,4 +74,4 @@ interface CreateRefundHandlerOptions {
|
|
|
62
74
|
*/
|
|
63
75
|
declare function createRefundHandler(options: CreateRefundHandlerOptions): (request: Request) => Promise<Response>;
|
|
64
76
|
|
|
65
|
-
export { type CreateRefundHandlerOptions, type RefundAuthorization, createRefundHandler };
|
|
77
|
+
export { type CreateCustomerSessionHandlerOptions, type CreateRefundHandlerOptions, type CustomerSessionAuthorization, type RefundAuthorization, createCustomerSessionHandler, createRefundHandler };
|
package/dist/server.d.ts
CHANGED
|
@@ -8,6 +8,18 @@
|
|
|
8
8
|
* Whether a deposit belongs to a given user is something only your app knows,
|
|
9
9
|
* so that one decision is yours (`authorize`) and everything else is here.
|
|
10
10
|
*/
|
|
11
|
+
interface CustomerSessionAuthorization {
|
|
12
|
+
externalCustomerId: string;
|
|
13
|
+
smartAccount?: string;
|
|
14
|
+
}
|
|
15
|
+
interface CreateCustomerSessionHandlerOptions {
|
|
16
|
+
apiKey: string;
|
|
17
|
+
processorUrl?: string;
|
|
18
|
+
/** Authenticate and enforce your CSRF policy. Derive identity server-side, never from the request body. */
|
|
19
|
+
authorize: (request: Request) => CustomerSessionAuthorization | null | Promise<CustomerSessionAuthorization | null>;
|
|
20
|
+
}
|
|
21
|
+
/** Server-only token minting endpoint. Never mount this on an unauthenticated proxy. */
|
|
22
|
+
declare function createCustomerSessionHandler(options: CreateCustomerSessionHandlerOptions): (request: Request) => Promise<Response>;
|
|
11
23
|
/** Body your own UI POSTs to your endpoint. Never trusted on its own. */
|
|
12
24
|
interface RefundRequestBody {
|
|
13
25
|
chain: string;
|
|
@@ -62,4 +74,4 @@ interface CreateRefundHandlerOptions {
|
|
|
62
74
|
*/
|
|
63
75
|
declare function createRefundHandler(options: CreateRefundHandlerOptions): (request: Request) => Promise<Response>;
|
|
64
76
|
|
|
65
|
-
export { type CreateRefundHandlerOptions, type RefundAuthorization, createRefundHandler };
|
|
77
|
+
export { type CreateCustomerSessionHandlerOptions, type CreateRefundHandlerOptions, type CustomerSessionAuthorization, type RefundAuthorization, createCustomerSessionHandler, createRefundHandler };
|
package/dist/server.mjs
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
// src/server.ts
|
|
2
2
|
var DEFAULT_PROCESSOR_URL = "https://v1.orchestrator.rhinestone.dev/deposit-processor";
|
|
3
|
+
function createCustomerSessionHandler(options) {
|
|
4
|
+
const url = `${(options.processorUrl ?? DEFAULT_PROCESSOR_URL).replace(
|
|
5
|
+
/\/$/,
|
|
6
|
+
""
|
|
7
|
+
)}/compliance/sessions`;
|
|
8
|
+
const responseHeaders = {
|
|
9
|
+
"Content-Type": "application/json",
|
|
10
|
+
"Cache-Control": "no-store"
|
|
11
|
+
};
|
|
12
|
+
const error = (status, message) => new Response(JSON.stringify({ error: message }), {
|
|
13
|
+
status,
|
|
14
|
+
headers: responseHeaders
|
|
15
|
+
});
|
|
16
|
+
return async (request) => {
|
|
17
|
+
if (request.method !== "POST") return error(405, "Method not allowed");
|
|
18
|
+
try {
|
|
19
|
+
const identity = await options.authorize(request);
|
|
20
|
+
if (!identity) return error(401, "Unauthorized");
|
|
21
|
+
const upstream = await fetch(url, {
|
|
22
|
+
method: "POST",
|
|
23
|
+
headers: {
|
|
24
|
+
"Content-Type": "application/json",
|
|
25
|
+
"x-api-key": options.apiKey
|
|
26
|
+
},
|
|
27
|
+
body: JSON.stringify({
|
|
28
|
+
externalCustomerId: identity.externalCustomerId,
|
|
29
|
+
...identity.smartAccount ? { smartAccount: identity.smartAccount } : {}
|
|
30
|
+
}),
|
|
31
|
+
cache: "no-store",
|
|
32
|
+
redirect: "manual",
|
|
33
|
+
signal: AbortSignal.timeout(15e3)
|
|
34
|
+
});
|
|
35
|
+
if (!upstream.ok)
|
|
36
|
+
return error(
|
|
37
|
+
upstream.status >= 400 && upstream.status < 500 ? upstream.status : 502,
|
|
38
|
+
"Customer session unavailable"
|
|
39
|
+
);
|
|
40
|
+
const value = await upstream.json();
|
|
41
|
+
if (!value || typeof value !== "object")
|
|
42
|
+
return error(502, "Invalid customer session");
|
|
43
|
+
const { token, expiresAt } = value;
|
|
44
|
+
if (typeof token !== "string" || !token || /\s/.test(token) || typeof expiresAt !== "string" || !Number.isFinite(Date.parse(expiresAt)) || Date.parse(expiresAt) <= Date.now() || Date.parse(expiresAt) > Date.now() + 15 * 6e4)
|
|
45
|
+
return error(502, "Invalid customer session");
|
|
46
|
+
return new Response(JSON.stringify({ token, expiresAt }), {
|
|
47
|
+
headers: responseHeaders
|
|
48
|
+
});
|
|
49
|
+
} catch {
|
|
50
|
+
return error(502, "Customer session unavailable");
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
3
54
|
function jsonError(message, status) {
|
|
4
55
|
return new Response(JSON.stringify({ error: message }), {
|
|
5
56
|
status,
|
|
@@ -92,5 +143,6 @@ function createRefundHandler(options) {
|
|
|
92
143
|
};
|
|
93
144
|
}
|
|
94
145
|
export {
|
|
146
|
+
createCustomerSessionHandler,
|
|
95
147
|
createRefundHandler
|
|
96
148
|
};
|
package/dist/styles.css
CHANGED
|
@@ -2572,6 +2572,18 @@
|
|
|
2572
2572
|
border: 1px solid var(--rs-warning-border);
|
|
2573
2573
|
}
|
|
2574
2574
|
|
|
2575
|
+
/* Served arrival expectation on the pending screen. Occupies the same slot as
|
|
2576
|
+
the delay Callout below, so crossing a delay threshold swaps this block's
|
|
2577
|
+
content instead of reflowing the screen above it. */
|
|
2578
|
+
.rs-pending-expectation {
|
|
2579
|
+
font-size: 13px;
|
|
2580
|
+
font-weight: 500;
|
|
2581
|
+
line-height: 16px;
|
|
2582
|
+
color: var(--rs-muted);
|
|
2583
|
+
text-align: center;
|
|
2584
|
+
margin: 0;
|
|
2585
|
+
}
|
|
2586
|
+
|
|
2575
2587
|
/* Generic inline error / warning notice (Callout). Two-line truncation keeps
|
|
2576
2588
|
long messages from blowing out the modal height. */
|
|
2577
2589
|
.rs-callout {
|
|
@@ -4515,6 +4527,16 @@
|
|
|
4515
4527
|
text-decoration: underline;
|
|
4516
4528
|
}
|
|
4517
4529
|
|
|
4530
|
+
/* Timing stays in the disclosure footer so collapsed rows remain easy to scan.
|
|
4531
|
+
Delay severity is carried by the wording, not warning/error colour. */
|
|
4532
|
+
.rs-history-card-timing {
|
|
4533
|
+
padding-top: 4px;
|
|
4534
|
+
color: var(--rs-muted);
|
|
4535
|
+
font-size: 12px;
|
|
4536
|
+
font-weight: 500;
|
|
4537
|
+
line-height: 18px;
|
|
4538
|
+
}
|
|
4539
|
+
|
|
4518
4540
|
/* Status badges */
|
|
4519
4541
|
.rs-history-badge {
|
|
4520
4542
|
display: inline-flex;
|
|
@@ -87,8 +87,9 @@ type RecoveryErrorCode = "DEPOSIT_NOT_RECOVERABLE" | "RECOVERY_UNSUPPORTED" | "S
|
|
|
87
87
|
/**
|
|
88
88
|
* How a `GET /deposits` row reads on screen, and which rows are on screen at
|
|
89
89
|
* all. Shared rather than private to the history panel: the header's status dot
|
|
90
|
-
* derives from the same rows the panel lists,
|
|
91
|
-
*
|
|
90
|
+
* derives from the same rows the panel lists, the arrival expectation inside a
|
|
91
|
+
* row is gated on the same statuses, and a second copy of any of those answers
|
|
92
|
+
* would let the badge, the list and the arrival line disagree.
|
|
92
93
|
*/
|
|
93
94
|
type HistoryStatus = "pending" | "processing" | "completed" | "failed" | "refunded" | "spam";
|
|
94
95
|
|
|
@@ -87,8 +87,9 @@ type RecoveryErrorCode = "DEPOSIT_NOT_RECOVERABLE" | "RECOVERY_UNSUPPORTED" | "S
|
|
|
87
87
|
/**
|
|
88
88
|
* How a `GET /deposits` row reads on screen, and which rows are on screen at
|
|
89
89
|
* all. Shared rather than private to the history panel: the header's status dot
|
|
90
|
-
* derives from the same rows the panel lists,
|
|
91
|
-
*
|
|
90
|
+
* derives from the same rows the panel lists, the arrival expectation inside a
|
|
91
|
+
* row is gated on the same statuses, and a second copy of any of those answers
|
|
92
|
+
* would let the badge, the list and the arrival line disagree.
|
|
92
93
|
*/
|
|
93
94
|
type HistoryStatus = "pending" | "processing" | "completed" | "failed" | "refunded" | "spam";
|
|
94
95
|
|
package/dist/withdraw.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-5CM3ZQ5U.cjs');
|
|
3
|
+
var _chunk34JVJZEZcjs = require('./chunk-34JVJZEZ.cjs');
|
|
4
|
+
require('./chunk-N3AAT6BS.cjs');
|
|
6
5
|
require('./chunk-OY5N3E6L.cjs');
|
|
6
|
+
require('./chunk-N6JJG57R.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.WithdrawModal =
|
|
9
|
+
exports.WithdrawModal = _chunk34JVJZEZcjs.WithdrawModal;
|
package/dist/withdraw.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { af as WithdrawModalProps } from './types-
|
|
3
|
-
export { A as AnalyticsEventEnvelope, a as AnalyticsIngestFailureEvent, b as AnalyticsIngestFailureReason, c as AnalyticsReasonFamily, e as AssetOption, f as ClaimAnalyticsAbandonmentReason, g as ClaimAnalyticsCloseSource, h as ClaimAnalyticsCorrelation, i as ClaimAnalyticsEntrySource, j as ClaimAnalyticsEvent, k as ClaimAnalyticsEventPayload, l as ClaimAnalyticsFailureReason, m as ClaimAnalyticsSessionProperties, n as ClaimAnalyticsStep, o as ClaimAnalyticsUiOutcome, p as ConnectedEventData, V as ErrorEventData, X as HistoryAnalyticsBadge, Y as HistoryClaimEntrySource, Z as HistoryStatus, a0 as RecoveryErrorCode, a1 as RpcUrlMap, a2 as SignRecovery, a3 as SignRecoveryPayload, a4 as WithdrawAnalyticsAbandonmentReason, a5 as WithdrawAnalyticsCloseSource, a6 as WithdrawAnalyticsEvent, a7 as WithdrawAnalyticsEventPayload, a8 as WithdrawAnalyticsFailureReason, a9 as WithdrawAnalyticsSessionProperties, aa as WithdrawAnalyticsStep, ab as WithdrawAnalyticsUiOutcome, ac as WithdrawCompleteEventData, ad as WithdrawFailedEventData, ag as WithdrawSubmittedEventData, ah as WithdrawTransferRequest } from './types-
|
|
2
|
+
import { af as WithdrawModalProps } from './types-CbUs4boj.cjs';
|
|
3
|
+
export { A as AnalyticsEventEnvelope, a as AnalyticsIngestFailureEvent, b as AnalyticsIngestFailureReason, c as AnalyticsReasonFamily, e as AssetOption, f as ClaimAnalyticsAbandonmentReason, g as ClaimAnalyticsCloseSource, h as ClaimAnalyticsCorrelation, i as ClaimAnalyticsEntrySource, j as ClaimAnalyticsEvent, k as ClaimAnalyticsEventPayload, l as ClaimAnalyticsFailureReason, m as ClaimAnalyticsSessionProperties, n as ClaimAnalyticsStep, o as ClaimAnalyticsUiOutcome, p as ConnectedEventData, V as ErrorEventData, X as HistoryAnalyticsBadge, Y as HistoryClaimEntrySource, Z as HistoryStatus, a0 as RecoveryErrorCode, a1 as RpcUrlMap, a2 as SignRecovery, a3 as SignRecoveryPayload, a4 as WithdrawAnalyticsAbandonmentReason, a5 as WithdrawAnalyticsCloseSource, a6 as WithdrawAnalyticsEvent, a7 as WithdrawAnalyticsEventPayload, a8 as WithdrawAnalyticsFailureReason, a9 as WithdrawAnalyticsSessionProperties, aa as WithdrawAnalyticsStep, ab as WithdrawAnalyticsUiOutcome, ac as WithdrawCompleteEventData, ad as WithdrawFailedEventData, ag as WithdrawSubmittedEventData, ah as WithdrawTransferRequest } from './types-CbUs4boj.cjs';
|
|
4
4
|
import './caip-BMi-9t09.cjs';
|
|
5
5
|
import 'viem';
|
|
6
6
|
|
package/dist/withdraw.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { af as WithdrawModalProps } from './types-
|
|
3
|
-
export { A as AnalyticsEventEnvelope, a as AnalyticsIngestFailureEvent, b as AnalyticsIngestFailureReason, c as AnalyticsReasonFamily, e as AssetOption, f as ClaimAnalyticsAbandonmentReason, g as ClaimAnalyticsCloseSource, h as ClaimAnalyticsCorrelation, i as ClaimAnalyticsEntrySource, j as ClaimAnalyticsEvent, k as ClaimAnalyticsEventPayload, l as ClaimAnalyticsFailureReason, m as ClaimAnalyticsSessionProperties, n as ClaimAnalyticsStep, o as ClaimAnalyticsUiOutcome, p as ConnectedEventData, V as ErrorEventData, X as HistoryAnalyticsBadge, Y as HistoryClaimEntrySource, Z as HistoryStatus, a0 as RecoveryErrorCode, a1 as RpcUrlMap, a2 as SignRecovery, a3 as SignRecoveryPayload, a4 as WithdrawAnalyticsAbandonmentReason, a5 as WithdrawAnalyticsCloseSource, a6 as WithdrawAnalyticsEvent, a7 as WithdrawAnalyticsEventPayload, a8 as WithdrawAnalyticsFailureReason, a9 as WithdrawAnalyticsSessionProperties, aa as WithdrawAnalyticsStep, ab as WithdrawAnalyticsUiOutcome, ac as WithdrawCompleteEventData, ad as WithdrawFailedEventData, ag as WithdrawSubmittedEventData, ah as WithdrawTransferRequest } from './types-
|
|
2
|
+
import { af as WithdrawModalProps } from './types-CZYypODQ.js';
|
|
3
|
+
export { A as AnalyticsEventEnvelope, a as AnalyticsIngestFailureEvent, b as AnalyticsIngestFailureReason, c as AnalyticsReasonFamily, e as AssetOption, f as ClaimAnalyticsAbandonmentReason, g as ClaimAnalyticsCloseSource, h as ClaimAnalyticsCorrelation, i as ClaimAnalyticsEntrySource, j as ClaimAnalyticsEvent, k as ClaimAnalyticsEventPayload, l as ClaimAnalyticsFailureReason, m as ClaimAnalyticsSessionProperties, n as ClaimAnalyticsStep, o as ClaimAnalyticsUiOutcome, p as ConnectedEventData, V as ErrorEventData, X as HistoryAnalyticsBadge, Y as HistoryClaimEntrySource, Z as HistoryStatus, a0 as RecoveryErrorCode, a1 as RpcUrlMap, a2 as SignRecovery, a3 as SignRecoveryPayload, a4 as WithdrawAnalyticsAbandonmentReason, a5 as WithdrawAnalyticsCloseSource, a6 as WithdrawAnalyticsEvent, a7 as WithdrawAnalyticsEventPayload, a8 as WithdrawAnalyticsFailureReason, a9 as WithdrawAnalyticsSessionProperties, aa as WithdrawAnalyticsStep, ab as WithdrawAnalyticsUiOutcome, ac as WithdrawCompleteEventData, ad as WithdrawFailedEventData, ag as WithdrawSubmittedEventData, ah as WithdrawTransferRequest } from './types-CZYypODQ.js';
|
|
4
4
|
import './caip-BMi-9t09.js';
|
|
5
5
|
import 'viem';
|
|
6
6
|
|
package/dist/withdraw.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WithdrawModal
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-3HCCR54R.mjs";
|
|
3
|
+
} from "./chunk-R2B6VD4E.mjs";
|
|
4
|
+
import "./chunk-AIZKGFVA.mjs";
|
|
6
5
|
import "./chunk-EAGMY3QE.mjs";
|
|
6
|
+
import "./chunk-3TEVMP76.mjs";
|
|
7
7
|
export {
|
|
8
8
|
WithdrawModal
|
|
9
9
|
};
|