@volter/twin-stripe 0.1.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/LICENSE +202 -0
- package/README.md +110 -0
- package/client/stripe-mirror.css +162 -0
- package/client/stripe-mirror.tsx +691 -0
- package/package.json +71 -0
- package/src/cli.ts +29 -0
- package/src/index.ts +52 -0
- package/src/stripe-capabilities.ts +3304 -0
- package/src/stripe-conformance.ts +110 -0
- package/src/stripe-connector.ts +373 -0
- package/src/stripe-events.ts +202 -0
- package/src/stripe-form.ts +35 -0
- package/src/stripe-mirror-ui.ts +345 -0
- package/src/stripe-server.ts +46 -0
- package/src/stripe-twin.ts +5227 -0
- package/src/stripe-ui-conformance.ts +125 -0
- package/src/stripe-ui-structure.ts +406 -0
- package/test-fixtures/stripe-known-deviations.json +85 -0
- package/test-fixtures/stripe-schemas.json +3364 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# @volter/twin-stripe
|
|
2
|
+
|
|
3
|
+
The **Stripe twin** — a local, spec-correct replica of the Stripe REST API on the
|
|
4
|
+
shared [`@volter/twin`](../control-plane) kernel. The real `stripe` SDK works against it
|
|
5
|
+
unmodified; it's the QA stack's authoritative local Stripe (it replaced the old
|
|
6
|
+
hand-made in-process mock).
|
|
7
|
+
|
|
8
|
+
## Surface
|
|
9
|
+
|
|
10
|
+
- **REST API** (`stripe-twin.ts` → `handleStripeTwinRequest`; HTTP wrapper
|
|
11
|
+
`stripe-server.ts` → `createStripeTwinServer`): charges, customers,
|
|
12
|
+
payment_intents, setup_intents, payment_methods, products, prices, invoices,
|
|
13
|
+
invoiceitems, subscriptions, refunds, coupons, promotion_codes, identity
|
|
14
|
+
verification sessions, ephemeral_keys, checkout sessions, billing/customer-portal
|
|
15
|
+
sessions + configurations.
|
|
16
|
+
- **Writes** are local transactions (action log); reads are the projection (R3/R5/R18).
|
|
17
|
+
- **Card declines** (`stripe-twin.ts`): Stripe's documented test cards get vendor-faithful
|
|
18
|
+
outcomes on charge create / PaymentIntent confirm — `4242…4242` (and `pm_card_visa`/`tok_visa`)
|
|
19
|
+
succeed; `4000…0002`, `4000…9995`, `4000…0069`, `4000…0127`, `4000…0119` (and the matching
|
|
20
|
+
`pm_card_*`/`tok_*` tokens) return the real `card_error` envelope (HTTP 402) and leave a
|
|
21
|
+
confirmed PaymentIntent at `requires_payment_method`. Unknown cards succeed. See
|
|
22
|
+
`_card.declines-test-set-only` in `stripe-known-deviations.json`.
|
|
23
|
+
- **Idempotency keys**: the `Idempotency-Key` header is honored on POST — a replay with the
|
|
24
|
+
same key returns the stored response without re-applying the write (`_idempotency.stored-per-root`).
|
|
25
|
+
- **Events** (`stripe-events.ts`): fires Stripe `event` objects on write
|
|
26
|
+
(`payment_intent.succeeded`, `customer.subscription.created`, `invoice.paid`, …).
|
|
27
|
+
- **Conformance** (`stripe-conformance.ts`): field name + type checked vs Stripe's
|
|
28
|
+
real OpenAPI (standing gate).
|
|
29
|
+
- **UI mirror** (`stripe-mirror-ui.ts`): a Stripe-dashboard-style React app over the
|
|
30
|
+
twin's own REST API.
|
|
31
|
+
|
|
32
|
+
## CLI
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
world-stripe serve [--read-only] [--port N] [--root DIR]
|
|
36
|
+
world-stripe mirror [--port N] [--root DIR]
|
|
37
|
+
world-stripe conformance [--fields FILE] [--root DIR]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`serve` defaults to `simulator` (the stack uses the twin as a writable Stripe).
|
|
41
|
+
Point the real `stripe` SDK at it with `{ host, port, protocol: 'http' }`.
|
|
42
|
+
|
|
43
|
+
## Four ways to use it
|
|
44
|
+
|
|
45
|
+
1. **Mock SDK** — *zero edits (preferred):* `STRIPE_TWIN_URL=http://127.0.0.1:PORT node --require @volter/twin/inject your-app` redirects the real `stripe` SDK from `api.stripe.com` to the twin (`cookbook/zero-edit-inject`). For the browser too: `volter-twin proxy --target <app> --map stripe=http://127.0.0.1:PORT` (browser + backend share one twin). *Or* override directly: `new Stripe(key, { host: '127.0.0.1', port: PORT, protocol: 'http' })`.
|
|
46
|
+
2. **API + CLI** — `world-stripe serve` (writable) + drive with `volter-twin status|plan|refs stripe`, then push.
|
|
47
|
+
3. **Read-only** — `world-stripe serve --read-only`: unlimited local reads, no rate limits; writes refuse like Stripe (4xx).
|
|
48
|
+
4. **UI mirror** — `world-stripe mirror` renders a Stripe-dashboard-style view of the twin's state.
|
|
49
|
+
|
|
50
|
+
(See the repo's GETTING-STARTED → "Four ways to use a twin".)
|
|
51
|
+
|
|
52
|
+
Stable on the twin rubric: fidelity, read/write/fork, sync, observability, event emission, and conformance are tracked with explicit coverage gaps.
|
|
53
|
+
|
|
54
|
+
## Coverage
|
|
55
|
+
|
|
56
|
+
Goal: **honest, explicitly tracked coverage of Stripe's core feature surface.** The only
|
|
57
|
+
accepted carve-outs are the explicit **out-of-scope** items listed below. Anything not done
|
|
58
|
+
or carved out is a gap to close.
|
|
59
|
+
|
|
60
|
+
**Done** — core resources: **customers**, **charges**, **payment_intents** (+ confirm),
|
|
61
|
+
**setup_intents** (+ confirm), **payment_methods** (+ detach), **subscriptions** (create/
|
|
62
|
+
update/cancel), **prices**, **products**, **invoices** (+ finalize/pay/void), **invoiceitems**,
|
|
63
|
+
**refunds**, **disputes** (+ update/close), **payouts** (+ cancel), **balance_transactions**,
|
|
64
|
+
**balance** (synthesized from the ledger), **events** (Events API list/retrieve),
|
|
65
|
+
**Checkout Sessions** (create/retrieve/list/`line_items`/expire + modeled completion that
|
|
66
|
+
creates+links a payment_intent/subscription/setup_intent; `amount_total` computed from
|
|
67
|
+
line_items), **Customer Portal** (`billing_portal` sessions + configurations create/retrieve/
|
|
68
|
+
list/update), **Connect** (connected **accounts** create/retrieve/list/update/delete +
|
|
69
|
+
`login_links`, and **transfers** platform→connected-account create/retrieve/list filtered by
|
|
70
|
+
destination; a new account starts un-onboarded with charges/payouts disabled + a `requirements`
|
|
71
|
+
hash), plus **ephemeral_keys**, **identity verification_sessions**, **file_links**
|
|
72
|
+
(synthesized) and **coupons**/**promotion_codes** (retrieve/list, seed-only). Cursor pagination
|
|
73
|
+
(`limit`/`starting_after`/`ending_before` + `has_more`); per-resource list filters; `expand[]`
|
|
74
|
+
on the modeled paths; vendor-faithful **test-card declines** (`4242…` succeeds; documented
|
|
75
|
+
decline PANs + `pm_card_*`/`tok_*` tokens return the real `card_error` 402); **idempotency keys**
|
|
76
|
+
(`Idempotency-Key` replay, no re-write); **events/webhooks** (`stripe-events.ts`); spec
|
|
77
|
+
**conformance** gate; **UI mirror** (rung-5 ✅, `client/stripe-mirror.tsx` + structure check);
|
|
78
|
+
**connector** pull (customers + subscriptions) + push (create/update/cancel/confirm/detach/
|
|
79
|
+
finalize/pay/void/close to the real REST surface).
|
|
80
|
+
|
|
81
|
+
This cycle added: **ACH/SEPA micro-deposit verification** (`payment_intents`/`setup_intents`
|
|
82
|
+
`/verify_microdeposits` — confirm with `pm_us_bank_account` → `requires_action` with a
|
|
83
|
+
`verify_with_microdeposits` next_action, then the 32/45 amounts or `SM11AA` descriptor →
|
|
84
|
+
`succeeded`), **Customer.list_payment_methods** (`/v1/customers/:id/payment_methods`),
|
|
85
|
+
**subscription items** CRUD (create/retrieve/list/update/delete, kept in sync with the parent
|
|
86
|
+
sub's `items` list), **subscriptions/invoices search**, **invoice line items**
|
|
87
|
+
(`/lines` + `add_lines`/`update_lines`/`remove_lines` with recomputed totals), **invoice
|
|
88
|
+
edge-action gating** (finalize/pay/mark_uncollectible/void state machine), **Tax transactions**
|
|
89
|
+
(`create_from_calculation` + `create_reversal` with negated lines), **quote** cancel-from-draft/
|
|
90
|
+
open lifecycle gates, **customer + subscription discount delete**, **promotion-code update**
|
|
91
|
+
(active toggle), **charge fraud-marking** (`fraud_details[user_report]`), and the **Radar**
|
|
92
|
+
family — **Reviews** (`/approve`), **Value Lists** (+ items), **Rules** — plus a **Radar
|
|
93
|
+
dashboard screen** in the UI mirror.
|
|
94
|
+
|
|
95
|
+
**Planned** (known-missing, will do) — **Issuing** (cardholders/cards/authorizations/
|
|
96
|
+
transactions + test helpers), **Terminal** (readers/locations/connection tokens), **Treasury**
|
|
97
|
+
(financial accounts), **Climate**, **Financial Connections**, **Entitlements**, **Billing**
|
|
98
|
+
credit grants + usage alerts, **Connect** remaining surfaces (account sessions, connected-account
|
|
99
|
+
payouts, top-ups, payout reverse), **Reporting/Sigma**, the legacy **Sources** API, and
|
|
100
|
+
additional list endpoints/filters as needed. (See `stripe-capabilities.ts` for the full honest
|
|
101
|
+
todo list — every entry not explicitly out-of-scope is a tracked gap.)
|
|
102
|
+
|
|
103
|
+
**Out of scope** (deliberately not modeled, with reason) —
|
|
104
|
+
- Pixel-rendering Stripe-**hosted** Checkout / Customer Portal *pages*: the hosted HTML is
|
|
105
|
+
Stripe's, not an API object — the twin models the **Session/API object + redirect `url`**
|
|
106
|
+
instead (now **Done**; the page pixels stay out of scope). See
|
|
107
|
+
`_checkout.hosted-page-pixels` in `stripe-known-deviations.json`.
|
|
108
|
+
- Real **money settlement / bank movement** (proposed — pending owner approval): actually moving
|
|
109
|
+
funds is real-world infra, not the API — the payout/balance_transaction/balance *objects* and
|
|
110
|
+
their lifecycle are modeled.
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--bg: #f6f8fa; --panel: #fff; --ink: #1a1f36; --muted: #697386;
|
|
3
|
+
--line: #e3e8ee; --brand: #635bff; --ok-bg: #e3f6ec; --ok: #138c50;
|
|
4
|
+
--warn-bg: #fcf0e4; --warn: #b25e09; --bad-bg: #fce4e4; --bad: #c0392b;
|
|
5
|
+
}
|
|
6
|
+
* { box-sizing: border-box; }
|
|
7
|
+
body { margin: 0; font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
|
|
8
|
+
.dash { height: 100vh; display: flex; flex-direction: column; }
|
|
9
|
+
|
|
10
|
+
.topbar { display: flex; align-items: center; gap: 16px; padding: 0 20px; height: 56px; background: #0a2540; color: #fff; }
|
|
11
|
+
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
|
|
12
|
+
.brand .dot { width: 14px; height: 14px; border-radius: 4px; background: var(--brand); }
|
|
13
|
+
.brand .tag { font-size: 11px; font-weight: 600; background: rgba(255,255,255,.15); padding: 2px 8px; border-radius: 999px; }
|
|
14
|
+
.topbar .search { flex: 1; max-width: 520px; background: rgba(255,255,255,.12); border: 0; color: #cdd6e4; padding: 7px 12px; border-radius: 7px; }
|
|
15
|
+
.topbar .mode { margin-left: auto; font-size: 12px; font-weight: 600; color: #f6b73c; background: rgba(246,183,60,.15); padding: 4px 10px; border-radius: 999px; }
|
|
16
|
+
|
|
17
|
+
.body { flex: 1; display: flex; min-height: 0; }
|
|
18
|
+
.side { width: 220px; background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
|
|
19
|
+
.side button { text-align: left; border: 0; background: none; padding: 8px 12px; border-radius: 7px; color: var(--ink); cursor: pointer; font-size: 14px; }
|
|
20
|
+
.side button:hover { background: var(--bg); }
|
|
21
|
+
.side button.active { background: #ecebff; color: var(--brand); font-weight: 600; }
|
|
22
|
+
.side button { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
|
|
23
|
+
.side .nav-count { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--bg); padding: 1px 7px; border-radius: 999px; }
|
|
24
|
+
.side button.active .nav-count { background: #fff; color: var(--brand); }
|
|
25
|
+
|
|
26
|
+
.content { flex: 1; min-width: 0; padding: 22px 26px; overflow: auto; }
|
|
27
|
+
.content-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; }
|
|
28
|
+
.content-head h2 { margin: 0; font-size: 22px; }
|
|
29
|
+
.content-head .count { color: var(--muted); font-weight: 600; }
|
|
30
|
+
.error { background: var(--warn-bg); color: var(--warn); padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
|
|
31
|
+
|
|
32
|
+
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
|
|
33
|
+
.list { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
|
|
34
|
+
.list-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); background: none; cursor: pointer; text-align: left; }
|
|
35
|
+
.list-row:last-child { border-bottom: 0; }
|
|
36
|
+
.list-row:hover { background: var(--bg); }
|
|
37
|
+
.list-row.active { background: #f5f4ff; box-shadow: inset 3px 0 0 var(--brand); }
|
|
38
|
+
.row-main { display: flex; flex-direction: column; min-width: 0; }
|
|
39
|
+
.row-title { font-weight: 600; }
|
|
40
|
+
.row-sub { color: var(--muted); font-size: 12px; }
|
|
41
|
+
.empty { padding: 28px; text-align: center; color: var(--muted); }
|
|
42
|
+
|
|
43
|
+
.detail { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; position: sticky; top: 0; }
|
|
44
|
+
.detail.empty { color: var(--muted); }
|
|
45
|
+
.detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
|
|
46
|
+
.detail dl { margin: 0; display: flex; flex-direction: column; gap: 8px; }
|
|
47
|
+
.detail .kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px; }
|
|
48
|
+
.detail dt { color: var(--muted); }
|
|
49
|
+
.detail dd { margin: 0; word-break: break-word; }
|
|
50
|
+
|
|
51
|
+
.pill { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: #eef1f6; color: var(--muted); white-space: nowrap; text-transform: capitalize; }
|
|
52
|
+
.pill.ok { background: var(--ok-bg); color: var(--ok); }
|
|
53
|
+
.pill.warn { background: var(--warn-bg); color: var(--warn); }
|
|
54
|
+
.pill.bad { background: var(--bad-bg); color: var(--bad); }
|
|
55
|
+
.mono { font-family: "SF Mono", ui-monospace, Menlo, monospace; font-size: 12px; }
|
|
56
|
+
|
|
57
|
+
/* Nested-object rendering — replaces the old "[object Object]" */
|
|
58
|
+
.detail-block { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
|
|
59
|
+
.detail-block h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
|
|
60
|
+
.nested { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
|
|
61
|
+
.nested-line { display: flex; gap: 8px; align-items: baseline; }
|
|
62
|
+
.nested-label { color: var(--muted); flex-shrink: 0; }
|
|
63
|
+
.nested-label::after { content: ":"; }
|
|
64
|
+
.nested-value { word-break: break-word; }
|
|
65
|
+
|
|
66
|
+
/* Cross-reference links */
|
|
67
|
+
.ref-inline { border: 0; background: none; padding: 0; color: var(--brand); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
|
|
68
|
+
.ref-inline:hover { color: #4b45cc; }
|
|
69
|
+
.ref-group { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
|
|
70
|
+
.ref-group:last-child { margin-bottom: 0; }
|
|
71
|
+
.ref-group-label { font-size: 11px; font-weight: 600; color: var(--muted); width: 100%; }
|
|
72
|
+
.ref-chip { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 1px; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 5px 10px; cursor: pointer; text-align: left; max-width: 100%; }
|
|
73
|
+
.ref-chip:hover { border-color: var(--brand); background: #f5f4ff; }
|
|
74
|
+
.ref-chip .ref-label { font-size: 12px; font-weight: 600; color: var(--ink); }
|
|
75
|
+
.ref-chip .ref-id { color: var(--muted); }
|
|
76
|
+
|
|
77
|
+
/* Test-card decline state — last_payment_error rendered as a prominent banner */
|
|
78
|
+
.pay-error { display: flex; flex-direction: column; gap: 2px; background: var(--bad-bg); color: var(--bad); border: 1px solid #f3c2c2; border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
|
|
79
|
+
.pay-error-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
|
|
80
|
+
.pay-error-text { font-size: 13px; }
|
|
81
|
+
|
|
82
|
+
/* Account balance summary — available / pending buckets */
|
|
83
|
+
.balance-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
|
|
84
|
+
.balance-bucket { flex: 1; min-width: 120px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--bg); display: flex; flex-direction: column; gap: 2px; }
|
|
85
|
+
.balance-bucket.available { background: var(--ok-bg); border-color: #bfe6cf; }
|
|
86
|
+
.balance-bucket-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
|
|
87
|
+
.balance-bucket.available .balance-bucket-label { color: var(--ok); }
|
|
88
|
+
.balance-bucket-amount { font-size: 16px; font-weight: 700; }
|
|
89
|
+
|
|
90
|
+
/* Connect — connected-account enablement flags + outstanding requirements */
|
|
91
|
+
.connect-panel { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
|
|
92
|
+
.connect-flags { display: flex; gap: 10px; flex-wrap: wrap; }
|
|
93
|
+
.connect-flag { flex: 1; min-width: 110px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; background: var(--bg); }
|
|
94
|
+
.connect-flag.ok { background: var(--ok-bg); border-color: #bfe6cf; }
|
|
95
|
+
.connect-flag.warn { background: var(--warn-bg); border-color: #f0dca6; }
|
|
96
|
+
.connect-flag-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
|
|
97
|
+
.connect-flag.ok .connect-flag-label { color: var(--ok); }
|
|
98
|
+
.connect-flag-state { font-size: 14px; font-weight: 700; }
|
|
99
|
+
.connect-requirements { border: 1px solid #f0dca6; background: var(--warn-bg); border-radius: 8px; padding: 10px 12px; }
|
|
100
|
+
.connect-req-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--warn); }
|
|
101
|
+
.connect-req-list { margin: 6px 0 0; padding-left: 18px; }
|
|
102
|
+
.connect-req-item { font-size: 12px; }
|
|
103
|
+
|
|
104
|
+
/* Product image thumbnails — actual <img> previews, not URL text */
|
|
105
|
+
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
|
|
106
|
+
.thumb { display: block; width: 64px; height: 64px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); }
|
|
107
|
+
.thumb:hover { border-color: var(--brand); }
|
|
108
|
+
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
|
|
109
|
+
|
|
110
|
+
/* Detail action bar — lifecycle verbs (Capture / Cancel) on a resource detail */
|
|
111
|
+
.detail-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
|
|
112
|
+
.action-btn { border: 1px solid var(--line); border-radius: 8px; padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer; background: var(--bg); }
|
|
113
|
+
.action-btn:hover:not(:disabled) { border-color: var(--brand); }
|
|
114
|
+
.action-btn:disabled { opacity: .5; cursor: default; }
|
|
115
|
+
.action-capture { background: var(--brand); color: #fff; border-color: var(--brand); }
|
|
116
|
+
.action-cancel { color: var(--bad, #c0392b); }
|
|
117
|
+
.action-error { font-size: 12px; color: var(--bad, #c0392b); }
|
|
118
|
+
|
|
119
|
+
/* Home / overview screen — top-line metric cards + recent payments */
|
|
120
|
+
.home-screen { display: flex; flex-direction: column; gap: 24px; }
|
|
121
|
+
.home-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
|
|
122
|
+
.metric-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--bg); display: flex; flex-direction: column; gap: 6px; }
|
|
123
|
+
.metric-label { font-size: 12px; color: var(--muted, #687385); text-transform: uppercase; letter-spacing: .04em; }
|
|
124
|
+
.metric-value { font-size: 22px; font-weight: 700; }
|
|
125
|
+
.home-recent { display: flex; flex-direction: column; gap: 4px; }
|
|
126
|
+
.home-recent h3 { margin: 0 0 8px; font-size: 14px; }
|
|
127
|
+
.home-recent-row { display: flex; gap: 12px; align-items: center; border: none; background: transparent; padding: 8px 4px; cursor: pointer; text-align: left; border-bottom: 1px solid var(--line); }
|
|
128
|
+
.home-recent-row:hover { background: var(--hover, #f6f8fa); }
|
|
129
|
+
|
|
130
|
+
/* Command bar (Cmd-K global search) */
|
|
131
|
+
.cmdk-overlay { position: fixed; inset: 0; background: rgba(20,25,35,.4); display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; z-index: 50; }
|
|
132
|
+
.cmdk { width: min(560px, 92vw); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,.25); overflow: hidden; }
|
|
133
|
+
.cmdk-input { width: 100%; box-sizing: border-box; border: none; border-bottom: 1px solid var(--line); padding: 16px 18px; font-size: 16px; outline: none; }
|
|
134
|
+
.cmdk-results { max-height: 50vh; overflow-y: auto; }
|
|
135
|
+
.cmdk-hit { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; border: none; background: transparent; padding: 10px 18px; cursor: pointer; border-bottom: 1px solid var(--line); }
|
|
136
|
+
.cmdk-hit:hover { background: var(--hover, #f6f8fa); }
|
|
137
|
+
.cmdk-hit-label { font-weight: 600; font-size: 14px; }
|
|
138
|
+
.cmdk-hit-sub { font-size: 12px; color: var(--muted, #687385); }
|
|
139
|
+
.cmdk-empty { padding: 18px; color: var(--muted, #687385); font-size: 14px; }
|
|
140
|
+
.search-trigger { text-align: left; color: var(--muted, #687385); cursor: pointer; }
|
|
141
|
+
.kbd { border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; font-size: 11px; }
|
|
142
|
+
|
|
143
|
+
/* Settings screen */
|
|
144
|
+
.settings-screen { display: flex; flex-direction: column; gap: 24px; max-width: 640px; }
|
|
145
|
+
.settings-block { border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
|
|
146
|
+
.settings-block h3 { margin: 0 0 12px; font-size: 15px; }
|
|
147
|
+
.api-key-row, .webhook-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
|
|
148
|
+
.api-key-label, .webhook-url { font-size: 13px; }
|
|
149
|
+
.settings-payout-schedule { font-weight: 600; }
|
|
150
|
+
|
|
151
|
+
/* Create / edit modal (write forms) */
|
|
152
|
+
.create-overlay { position: fixed; inset: 0; background: rgba(20,25,35,.4); display: flex; align-items: center; justify-content: center; z-index: 50; }
|
|
153
|
+
.create-modal { width: min(440px, 92vw); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 12px; }
|
|
154
|
+
.create-title { margin: 0; font-size: 16px; }
|
|
155
|
+
.create-field { display: flex; flex-direction: column; gap: 4px; }
|
|
156
|
+
.create-field-label { font-size: 12px; color: var(--muted, #687385); }
|
|
157
|
+
.create-field-input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
|
|
158
|
+
.create-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
|
|
159
|
+
.create-cancel, .create-submit { border: 1px solid var(--line); border-radius: 8px; padding: 7px 16px; font-size: 13px; font-weight: 600; cursor: pointer; background: var(--bg); }
|
|
160
|
+
.create-submit { background: var(--brand); color: #fff; border-color: var(--brand); }
|
|
161
|
+
.create-error { font-size: 12px; color: var(--bad, #c0392b); }
|
|
162
|
+
.create-trigger { margin-left: auto; border: 1px solid var(--brand); color: var(--brand); border-radius: 8px; padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer; background: var(--bg); }
|