@misebako/ui 0.0.0-stage → 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 +201 -0
- package/README.md +75 -2
- package/dist/checkout/checkout-amounts.d.ts +41 -0
- package/dist/checkout/checkout-amounts.js +20 -0
- package/dist/checkout/checkout-amounts.js.map +1 -0
- package/dist/checkout/quote-fields.d.ts +16 -0
- package/dist/checkout/quote-fields.js +45 -0
- package/dist/checkout/quote-fields.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/orders/delivery-codes.d.ts +12 -0
- package/dist/orders/delivery-codes.js +26 -0
- package/dist/orders/delivery-codes.js.map +1 -0
- package/dist/orders/order-status.d.ts +36 -0
- package/dist/orders/order-status.js +28 -0
- package/dist/orders/order-status.js.map +1 -0
- package/dist/primitives/appearance-menu.d.ts +11 -0
- package/dist/primitives/appearance-menu.js +15 -0
- package/dist/primitives/appearance-menu.js.map +1 -0
- package/dist/primitives/bot-check.d.ts +123 -0
- package/dist/primitives/bot-check.js +425 -0
- package/dist/primitives/bot-check.js.map +1 -0
- package/dist/primitives/link.d.ts +11 -0
- package/dist/primitives/link.js +7 -0
- package/dist/primitives/link.js.map +1 -0
- package/dist/primitives/otp-input.d.ts +16 -0
- package/dist/primitives/otp-input.js +109 -0
- package/dist/primitives/otp-input.js.map +1 -0
- package/dist/primitives/phone-verify-modal.d.ts +41 -0
- package/dist/primitives/phone-verify-modal.js +200 -0
- package/dist/primitives/phone-verify-modal.js.map +1 -0
- package/dist/primitives/region-menu.d.ts +32 -0
- package/dist/primitives/region-menu.js +129 -0
- package/dist/primitives/region-menu.js.map +1 -0
- package/dist/primitives/rich-text.d.ts +9 -0
- package/dist/primitives/rich-text.js +52 -0
- package/dist/primitives/rich-text.js.map +1 -0
- package/dist/storefront/home-hero.d.ts +33 -0
- package/dist/storefront/home-hero.js +13 -0
- package/dist/storefront/home-hero.js.map +1 -0
- package/dist/storefront/product-gallery.d.ts +24 -0
- package/dist/storefront/product-gallery.js +49 -0
- package/dist/storefront/product-gallery.js.map +1 -0
- package/dist/styles.css +146 -0
- package/dist/theme/index.d.ts +9 -0
- package/dist/theme/index.js +26 -0
- package/dist/theme/index.js.map +1 -0
- package/package.json +112 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,76 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @misebako/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Shared, router-agnostic React 19 + Mantine 9 commerce UI components, accessibility stylesheet, and high-contrast theme tokens for **Misebako** main stores and [**Noren**](https://github.com/misebako/noren) reseller stores.
|
|
4
|
+
|
|
5
|
+
## Requirements & Peer Dependencies
|
|
6
|
+
|
|
7
|
+
- **Node.js 24+** and ESM (`"type": "module"`)
|
|
8
|
+
- `react` `^19.0.0`, `react-dom` `^19.0.0`
|
|
9
|
+
- `@mantine/core` `^9.0.0`, `@mantine/hooks` `^9.0.0`
|
|
10
|
+
- `lucide-react` `>=0.400.0 || ^1.0.0`
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
pnpm add @misebako/ui @mantine/core @mantine/hooks lucide-react react react-dom
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import '@mantine/core/styles.css'
|
|
22
|
+
import '@misebako/ui/styles.css'
|
|
23
|
+
|
|
24
|
+
import { MantineProvider } from '@mantine/core'
|
|
25
|
+
import { norenTheme } from '@misebako/ui/theme'
|
|
26
|
+
|
|
27
|
+
export function App({ children }: { children: React.ReactNode }) {
|
|
28
|
+
return <MantineProvider theme={norenTheme}>{children}</MantineProvider>
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Subpath Exports
|
|
33
|
+
|
|
34
|
+
Import individual subpaths to avoid pulling unused client modules, or import from `@misebako/ui` for all component and theme exports:
|
|
35
|
+
|
|
36
|
+
| Entry Point | Exports & Purpose |
|
|
37
|
+
| --- | --- |
|
|
38
|
+
| `@misebako/ui` | Root barrel re-exporting all components, hooks, and theme presets. |
|
|
39
|
+
| `@misebako/ui/styles.css` | Accessible light/dark contrast tokens, mobile `16px` input zoom guard, `tabular-nums`, font smoothing, hero layout styles, and `.misebako-media` image outlines. |
|
|
40
|
+
| `@misebako/ui/theme` | High-contrast palettes and Mantine theme presets (`misebakoColors`, `createMisebakoTheme`, `misebakoTheme`, `norenTheme`). |
|
|
41
|
+
| `@misebako/ui/rich-text` | Safe ProseMirror/TipTap JSON renderer (`RichContent`, `isSafeHref`) usable in both Server and Client Components. |
|
|
42
|
+
| `@misebako/ui/otp-input` | Accessible 6-digit `OtpCodeInput` with clipboard paste, `one-time-code` autofill, and keyboard navigation (`'use client'`). |
|
|
43
|
+
| `@misebako/ui/phone-verify-modal` | In-site phone binding and two-step rebinding modal (`PhoneVerifyModal`) with international calling codes and Bot Check integration (`'use client'`). |
|
|
44
|
+
| `@misebako/ui/bot-check` | Multi-provider human verification hook and widgets (`useBotCheck`, `TurnstileWidget`, `HCaptchaWidget`, `RecaptchaWidget`, `BotCheckError`) (`'use client'`). |
|
|
45
|
+
| `@misebako/ui/appearance-menu` | Color-scheme switcher (`AppearanceMenu`: `auto` / `light` / `dark`) with cookie persistence (`'use client'`). |
|
|
46
|
+
| `@misebako/ui/region-menu` | Searchable language and display-currency picker (`RegionMenu`, `RegionMark`) (`'use client'`). |
|
|
47
|
+
| `@misebako/ui/product-gallery` | Product cover and multi-image gallery with broken-image placeholder fallback (`ProductCover`, `ProductGallery`) (`'use client'`). |
|
|
48
|
+
| `@misebako/ui/home-hero` | Responsive storefront hero with highlights, category shortcuts, and search form (`HomeHero`) (`'use client'`). |
|
|
49
|
+
| `@misebako/ui/quote-fields` | Dynamic fulfillment parameter inputs (`QuoteFormFields`) driven by `@misebako/sdk/schemas` (`'use client'`). |
|
|
50
|
+
| `@misebako/ui/checkout-amounts` | Order/cart pricing breakdown with promo savings and display FX conversion (`CheckoutAmounts`, `QuoteSummaryCard`) (`'use client'`). |
|
|
51
|
+
| `@misebako/ui/delivery-codes` | Delivered redeem-code / voucher viewer with one-click copy feedback (`DeliveryCodeList`) (`'use client'`). |
|
|
52
|
+
| `@misebako/ui/order-status` | Order status badge color mapping, paused-order credential submission, and action confirmation modals (`orderStateColor`, `isAwaitingInput`, `NeedsInputForm`, `OrderActionConfirm`) (`'use client'`). |
|
|
53
|
+
|
|
54
|
+
## Design Principles
|
|
55
|
+
|
|
56
|
+
- **Router-Agnostic:** Zero framework router imports (`next/*`); navigation components accept a pluggable `LinkComponent`, keeping them portable across Next.js 16, Cloudflare Workers (`vinext`), and Vite SPAs.
|
|
57
|
+
- **No i18n or Secret Lock-In:** Components contain no runtime secrets or hardcoded locale bundles; host applications pass localized labels explicitly.
|
|
58
|
+
- **Accessible by Default:** High-contrast light/dark palettes, `respectReducedMotion: true`, keyboard navigation, and mobile `16px` input zoom guards.
|
|
59
|
+
|
|
60
|
+
## Development
|
|
61
|
+
|
|
62
|
+
```sh
|
|
63
|
+
pnpm install --frozen-lockfile
|
|
64
|
+
pnpm typecheck
|
|
65
|
+
pnpm build
|
|
66
|
+
pnpm test
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Related Open-Source Projects
|
|
70
|
+
|
|
71
|
+
- [`@misebako/sdk`](https://github.com/misebako/sdk) — Shared TypeScript contracts, money helpers, HMAC verification, and typed reseller edge client.
|
|
72
|
+
- [`noren`](https://github.com/misebako/noren) — Cloudflare Workers edge reseller storefront built on `@misebako/sdk` and `@misebako/ui`.
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
Licensed under the [Apache License, Version 2.0](LICENSE).
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type Rounding } from '@misebako/sdk/money';
|
|
2
|
+
export interface CheckoutAmountsRate {
|
|
3
|
+
currency: string;
|
|
4
|
+
factorE8: string;
|
|
5
|
+
rounding: Rounding;
|
|
6
|
+
}
|
|
7
|
+
export interface CheckoutAmountsProps {
|
|
8
|
+
total: bigint | null;
|
|
9
|
+
currency: string;
|
|
10
|
+
locale: string;
|
|
11
|
+
reviewed: boolean;
|
|
12
|
+
calculator?: boolean;
|
|
13
|
+
rate?: CheckoutAmountsRate | null;
|
|
14
|
+
discount?: {
|
|
15
|
+
code: string;
|
|
16
|
+
savings: bigint;
|
|
17
|
+
};
|
|
18
|
+
labels: {
|
|
19
|
+
subtotal: string;
|
|
20
|
+
savings: string;
|
|
21
|
+
holdAmount: string;
|
|
22
|
+
cartTotal: string;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** Shared order/cart breakdown showing subtotal, promo discount, converted display reference, and final payable amount. */
|
|
26
|
+
export declare function CheckoutAmounts({ total, currency, locale, reviewed, calculator, rate, discount, labels, }: CheckoutAmountsProps): import("react").JSX.Element;
|
|
27
|
+
export interface QuoteSummaryCardProps {
|
|
28
|
+
backorder?: boolean;
|
|
29
|
+
cartLabel?: string | null;
|
|
30
|
+
accountMask?: string | null;
|
|
31
|
+
eligibilitySummary?: string | null;
|
|
32
|
+
expiryText: string;
|
|
33
|
+
amounts: CheckoutAmountsProps;
|
|
34
|
+
labels: {
|
|
35
|
+
backorderBadge: string;
|
|
36
|
+
targetAccount: string;
|
|
37
|
+
eligibility: string;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** Shared summary card for a quoted PriceRequest or direct checkout snapshot. */
|
|
41
|
+
export declare function QuoteSummaryCard({ backorder, cartLabel, accountMask, eligibilitySummary, expiryText, amounts, labels, }: QuoteSummaryCardProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Badge, Box, Group, Paper, Stack, Text } from '@mantine/core';
|
|
4
|
+
import { formatConversion, formatMoney, formatPrice } from '@misebako/sdk/money';
|
|
5
|
+
/** Shared order/cart breakdown showing subtotal, promo discount, converted display reference, and final payable amount. */
|
|
6
|
+
export function CheckoutAmounts({ total, currency, locale, reviewed, calculator = false, rate, discount, labels, }) {
|
|
7
|
+
const exact = total === null ? null : formatMoney(total, currency, locale);
|
|
8
|
+
const converted = total !== null && rate ? `≈ ${formatConversion(total, currency, rate, locale)}` : null;
|
|
9
|
+
const primary = total === null ? '—' : reviewed ? exact : converted ?? formatPrice(total, currency, locale);
|
|
10
|
+
const secondary = converted && rate && (reviewed ? `${converted} ${rate.currency}` : exact);
|
|
11
|
+
const breakdown = (amount) => (!reviewed && rate
|
|
12
|
+
? `≈ ${formatConversion(amount, currency, rate, locale)}`
|
|
13
|
+
: formatMoney(amount, currency, locale));
|
|
14
|
+
return (_jsxs(Stack, { component: "dl", m: 0, gap: "xs", "aria-live": "polite", "aria-atomic": "true", children: [(calculator || discount) && total !== null && (_jsxs(Group, { justify: "space-between", align: "baseline", gap: "xs", children: [_jsx(Text, { component: "dt", size: "sm", children: labels.subtotal }), _jsx(Text, { component: "dd", m: 0, ms: "auto", ta: "end", size: "sm", className: "tabular-nums", children: breakdown(total + (discount?.savings ?? 0n)) })] })), discount && total !== null && (_jsxs(Group, { justify: "space-between", align: "baseline", gap: "xs", children: [_jsxs(Text, { component: "dt", size: "sm", children: [labels.savings, ' ', _jsxs(Text, { component: "span", c: "dimmed", inherit: true, children: ["(", discount.code, ")"] })] }), _jsxs(Text, { component: "dd", m: 0, ms: "auto", ta: "end", size: "sm", className: "tabular-nums", children: [discount.savings > 0n && '−', breakdown(discount.savings)] })] })), _jsxs(Group, { justify: "space-between", align: "baseline", gap: "xs", pt: calculator || discount ? 'sm' : undefined, style: calculator || discount ? { borderBlockStart: '1px solid var(--mantine-color-default-border)' } : undefined, children: [_jsx(Text, { component: "dt", fw: 600, children: reviewed ? labels.holdAmount : labels.cartTotal }), _jsxs(Box, { component: "dd", m: 0, ms: "auto", maw: "100%", ta: "end", children: [_jsx(Text, { size: "xl", fw: 700, lh: 1.2, className: "tabular-nums", children: primary }), secondary && _jsx(Text, { size: "sm", c: "dimmed", mt: 2, className: "tabular-nums", children: secondary })] })] })] }));
|
|
15
|
+
}
|
|
16
|
+
/** Shared summary card for a quoted PriceRequest or direct checkout snapshot. */
|
|
17
|
+
export function QuoteSummaryCard({ backorder, cartLabel, accountMask, eligibilitySummary, expiryText, amounts, labels, }) {
|
|
18
|
+
return (_jsx(Paper, { withBorder: true, p: "md", radius: "md", children: _jsxs(Stack, { gap: "sm", children: [backorder && _jsx(Badge, { variant: "light", color: "gray", w: "fit-content", children: labels.backorderBadge }), cartLabel && _jsx(Text, { size: "sm", fw: 600, style: { overflowWrap: 'anywhere' }, children: cartLabel }), accountMask && (_jsxs(Group, { justify: "space-between", align: "baseline", gap: "xs", wrap: "wrap", children: [_jsx(Text, { size: "sm", c: "dimmed", children: labels.targetAccount }), _jsx(Text, { size: "sm", fw: 500, ta: "end", miw: 0, style: { overflowWrap: 'anywhere' }, children: accountMask })] })), eligibilitySummary && (_jsxs(Stack, { gap: 2, children: [_jsx(Text, { size: "xs", c: "dimmed", children: labels.eligibility }), _jsx(Text, { size: "sm", style: { overflowWrap: 'anywhere', whiteSpace: 'pre-line' }, children: eligibilitySummary })] })), _jsx(CheckoutAmounts, { ...amounts }), _jsx(Text, { size: "xs", c: "dimmed", children: expiryText })] }) }));
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=chec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AC,IAAI,IAAC,IAAI,EAAC,IAAI,EAAC,CAAC,EAAC,QAAQ,YAAE,UAAU,GAAQ,IACxC,GACF,CACT,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ResellerQuoteField } from '@misebako/sdk/schemas';
|
|
2
|
+
export interface QuoteFormFieldsProps {
|
|
3
|
+
fields: readonly ResellerQuoteField[];
|
|
4
|
+
values: Record<string, string>;
|
|
5
|
+
onChange: (key: string, value: string) => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
locale?: string;
|
|
8
|
+
labels?: {
|
|
9
|
+
stepRange?: (min: string, max: string, step: string) => string;
|
|
10
|
+
invalidStep?: string;
|
|
11
|
+
toggleSecret?: string;
|
|
12
|
+
selectPlaceholder?: string;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/** Render dynamic fulfillment / quote input fields declared by a product SKU matching Misebako's storefront modal. */
|
|
16
|
+
export declare function QuoteFormFields({ fields, values, onChange, disabled, locale, labels, }: QuoteFormFieldsProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { NativeSelect, NumberInput, PasswordInput, Stack, TextInput } from '@mantine/core';
|
|
4
|
+
import { isIntegerStepValid, resolvedQuoteFieldType } from '@misebako/sdk/quote-form';
|
|
5
|
+
function groupSeparator(locale) {
|
|
6
|
+
try {
|
|
7
|
+
return new Intl.NumberFormat(locale).formatToParts(1000).find(part => part.type === 'group')?.value ?? ',';
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return ',';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** Render dynamic fulfillment / quote input fields declared by a product SKU matching Misebako's storefront modal. */
|
|
14
|
+
export function QuoteFormFields({ fields, values, onChange, disabled, locale = 'en-US', labels, }) {
|
|
15
|
+
if (fields.length === 0)
|
|
16
|
+
return null;
|
|
17
|
+
const thousandSeparator = groupSeparator(locale);
|
|
18
|
+
return (_jsx(Stack, { gap: "sm", children: fields.map(field => {
|
|
19
|
+
const kind = resolvedQuoteFieldType(field);
|
|
20
|
+
const value = values[field.key] ?? '';
|
|
21
|
+
if (kind === 'select' && field.options?.length) {
|
|
22
|
+
return (_jsx(NativeSelect, { label: field.label, required: true, disabled: disabled, value: value, data: [
|
|
23
|
+
{ value: '', label: labels?.selectPlaceholder ?? '—', disabled: true },
|
|
24
|
+
...field.options.map(option => ({ value: option, label: option })),
|
|
25
|
+
], onChange: event => onChange(field.key, event.currentTarget.value) }, field.key));
|
|
26
|
+
}
|
|
27
|
+
if (kind === 'integer_step') {
|
|
28
|
+
const invalid = Boolean(value && !isIntegerStepValid(field, value));
|
|
29
|
+
const step = field.step ?? 1;
|
|
30
|
+
const description = field.min !== undefined && field.max !== undefined && labels?.stepRange
|
|
31
|
+
? labels.stepRange(field.min.toLocaleString(locale), field.max.toLocaleString(locale), step.toLocaleString(locale))
|
|
32
|
+
: undefined;
|
|
33
|
+
const fallbackError = description
|
|
34
|
+
?? (field.min !== undefined && field.max !== undefined
|
|
35
|
+
? `${field.min.toLocaleString(locale)}–${field.max.toLocaleString(locale)} (×${step.toLocaleString(locale)})`
|
|
36
|
+
: 'Enter a valid whole number.');
|
|
37
|
+
return (_jsx(NumberInput, { required: true, label: field.label, min: field.min, max: field.max, step: step, value: value, allowDecimal: false, allowNegative: false, thousandSeparator: thousandSeparator, styles: { input: { fontVariantNumeric: 'tabular-nums' } }, description: description, error: invalid ? (labels?.invalidStep ?? fallbackError) : undefined, disabled: disabled, onChange: next => onChange(field.key, next === '' ? '' : String(next)) }, field.key));
|
|
38
|
+
}
|
|
39
|
+
if (kind === 'credential') {
|
|
40
|
+
return (_jsx(PasswordInput, { required: true, label: field.label, maxLength: 32768, autoComplete: "off", spellCheck: false, disabled: disabled, value: value, visibilityToggleButtonProps: { 'aria-label': labels?.toggleSecret ?? 'Show or hide value' }, onChange: event => onChange(field.key, event.currentTarget.value) }, field.key));
|
|
41
|
+
}
|
|
42
|
+
return (_jsx(TextInput, { required: true, label: field.label, maxLength: 256, autoComplete: "off", disabled: disabled, value: value, onChange: event => onChange(field.key, event.currentTarget.value) }, field.key));
|
|
43
|
+
}) }));
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=quote-fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quote-fields.js","sourceRoot":"","sources":["../../src/checkout/quote-fields.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC1F,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAiBrF,SAAS,cAAc,CAAC,MAAc;IACpC,IAAI,CAAC;QACH,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,CAAC,EAAE,KAAK,IAAI,GAAG,CAAA;IAC5G,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAA;IACZ,CAAC;AACH,CAAC;AAED,sHAAsH;AACtH,MAAM,UAAU,eAAe,CAAC,EAC9B,MAAM,EACN,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,MAAM,GAAG,OAAO,EAChB,MAAM,GACe;IACrB,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACpC,MAAM,iBAAiB,GAAG,cAAc,CAAC,MAAM,CAAC,CAAA;IAEhD,OAAO,CACL,KAAC,KAAK,IAAC,GAAG,EAAC,IAAI,YACZ,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE;YAClB,MAAM,IAAI,GAAG,sBAAsB,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AAK,EAAE,KAAK,CAAC,KAAK,EAClB,SAAS,EAAE,KAAK,EAChB,YAAY,EAAC,KAAK,EAClB,UAAU,EAAE,KAAK,EACjB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,2BAA2B,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,IAAI,oBAAoB,EAAE,EAC3F,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,IAT5D,KAAK,CAAC,GAAG,CAUd,CACH,CAAA;YACH,CAAC;YAED,OAAO,CACL,KAAC,SAAS,IAER,QAAQ,QACR,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,SAAS,EAAE,GAAG,EACd,YAAY,EAAC,KAAK,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,IAP5D,KAAK,CAAC,GAAG,CAQd,CACH,CAAA;QACH,CAAC,CAAC,GACI,CACT,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { misebakoColors, createMisebakoTheme, misebakoTheme, norenTheme } from './theme/index.js';
|
|
2
|
+
export { DefaultStoreLink, type StoreLinkComponent, type StoreLinkProps } from './primitives/link.js';
|
|
3
|
+
export { isSafeHref, RichContent, type RichContentProps } from './primitives/rich-text.js';
|
|
4
|
+
export { OtpCodeInput, type OtpCodeInputProps } from './primitives/otp-input.js';
|
|
5
|
+
export { PhoneVerifyModal, type PhoneVerifyModalLabels, type SharedPhoneVerifyModalProps, } from './primitives/phone-verify-modal.js';
|
|
6
|
+
export { BotCheckError, HCaptchaWidget, RecaptchaWidget, TurnstileWidget, useBotCheck, type HCaptchaWidgetProps, type RecaptchaWidgetProps, type TurnstileWidgetProps, type UseBotCheckOptions, } from './primitives/bot-check.js';
|
|
7
|
+
export { AppearanceMenu, type AppearanceMenuProps } from './primitives/appearance-menu.js';
|
|
8
|
+
export { RegionMark, RegionMenu, type RegionMenuLabels, type RegionMenuLocaleOption, type RegionMenuProps, } from './primitives/region-menu.js';
|
|
9
|
+
export { ProductCover, ProductGallery, type ProductCoverProps, type ProductGalleryImage, type ProductGalleryProps } from './storefront/product-gallery.js';
|
|
10
|
+
export { HomeHero, type HomeHeroBullet, type HomeHeroCategory, type SharedHomeHeroProps } from './storefront/home-hero.js';
|
|
11
|
+
export { QuoteFormFields, type QuoteFormFieldsProps } from './checkout/quote-fields.js';
|
|
12
|
+
export { CheckoutAmounts, QuoteSummaryCard, type CheckoutAmountsProps, type CheckoutAmountsRate, type QuoteSummaryCardProps, } from './checkout/checkout-amounts.js';
|
|
13
|
+
export { DeliveryCodeList, type DeliveryCodeListProps } from './orders/delivery-codes.js';
|
|
14
|
+
export { isAwaitingInput, NeedsInputForm, OrderActionConfirm, orderStateColor, type NeedsInputFormProps, type OrderActionConfirmProps, } from './orders/order-status.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { misebakoColors, createMisebakoTheme, misebakoTheme, norenTheme } from './theme/index.js';
|
|
2
|
+
export { DefaultStoreLink } from './primitives/link.js';
|
|
3
|
+
export { isSafeHref, RichContent } from './primitives/rich-text.js';
|
|
4
|
+
export { OtpCodeInput } from './primitives/otp-input.js';
|
|
5
|
+
export { PhoneVerifyModal, } from './primitives/phone-verify-modal.js';
|
|
6
|
+
export { BotCheckError, HCaptchaWidget, RecaptchaWidget, TurnstileWidget, useBotCheck, } from './primitives/bot-check.js';
|
|
7
|
+
export { AppearanceMenu } from './primitives/appearance-menu.js';
|
|
8
|
+
export { RegionMark, RegionMenu, } from './primitives/region-menu.js';
|
|
9
|
+
export { ProductCover, ProductGallery } from './storefront/product-gallery.js';
|
|
10
|
+
export { HomeHero } from './storefront/home-hero.js';
|
|
11
|
+
export { QuoteFormFields } from './checkout/quote-fields.js';
|
|
12
|
+
export { CheckoutAmounts, QuoteSummaryCard, } from './checkout/checkout-amounts.js';
|
|
13
|
+
export { DeliveryCodeList } from './orders/delivery-codes.js';
|
|
14
|
+
export { isAwaitingInput, NeedsInputForm, OrderActionConfirm, orderStateColor, } from './orders/order-status.js';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACjG,OAAO,EAAE,gBAAgB,EAAgD,MAAM,sBAAsB,CAAA;AACrG,OAAO,EAAE,UAAU,EAAE,WAAW,EAAyB,MAAM,2BAA2B,CAAA;AAC1F,OAAO,EAAE,YAAY,EAA0B,MAAM,2BAA2B,CAAA;AAChF,OAAO,EACL,gBAAgB,GAGjB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,aAAa,EACb,cAAc,EACd,eAAe,EACf,eAAe,EACf,WAAW,GAKZ,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,cAAc,EAA4B,MAAM,iCAAiC,CAAA;AAC1F,OAAO,EACL,UAAU,EACV,UAAU,GAIX,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,cAAc,EAA8E,MAAM,iCAAiC,CAAA;AAC1J,OAAO,EAAE,QAAQ,EAAwE,MAAM,2BAA2B,CAAA;AAC1H,OAAO,EAAE,eAAe,EAA6B,MAAM,4BAA4B,CAAA;AACvF,OAAO,EACL,eAAe,EACf,gBAAgB,GAIjB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EAAE,gBAAgB,EAA8B,MAAM,4BAA4B,CAAA;AACzF,OAAO,EACL,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,eAAe,GAGhB,MAAM,0BAA0B,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface DeliveryCodeListProps {
|
|
2
|
+
items: readonly string[];
|
|
3
|
+
copyLabel?: string;
|
|
4
|
+
copiedLabel?: string;
|
|
5
|
+
copyAllLabel?: string;
|
|
6
|
+
copiedAllLabel?: string;
|
|
7
|
+
downloadLabel?: string;
|
|
8
|
+
downloadFileName?: string;
|
|
9
|
+
color?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Render delivered redeem codes or text vouchers with one-click copy and optional bulk actions. */
|
|
12
|
+
export declare function DeliveryCodeList({ items, copyLabel, copiedLabel, copyAllLabel, copiedAllLabel, downloadLabel, downloadFileName, color, }: DeliveryCodeListProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Button, Code, CopyButton, Group, Paper, Stack } from '@mantine/core';
|
|
4
|
+
import { Check, Copy, Download } from 'lucide-react';
|
|
5
|
+
/** Render delivered redeem codes or text vouchers with one-click copy and optional bulk actions. */
|
|
6
|
+
export function DeliveryCodeList({ items, copyLabel = 'Copy', copiedLabel = 'Copied', copyAllLabel, copiedAllLabel, downloadLabel, downloadFileName = 'codes.txt', color, }) {
|
|
7
|
+
if (items.length === 0)
|
|
8
|
+
return null;
|
|
9
|
+
const showBulkActions = items.length > 1 && Boolean(copyAllLabel || downloadLabel);
|
|
10
|
+
const joined = items.join('\n');
|
|
11
|
+
function handleDownload() {
|
|
12
|
+
if (typeof window === 'undefined')
|
|
13
|
+
return;
|
|
14
|
+
const blob = new Blob([`${joined}\n`], { type: 'text/plain;charset=utf-8' });
|
|
15
|
+
const url = URL.createObjectURL(blob);
|
|
16
|
+
const link = document.createElement('a');
|
|
17
|
+
link.href = url;
|
|
18
|
+
link.download = downloadFileName;
|
|
19
|
+
document.body.appendChild(link);
|
|
20
|
+
link.click();
|
|
21
|
+
link.remove();
|
|
22
|
+
setTimeout(() => URL.revokeObjectURL(url), 1000);
|
|
23
|
+
}
|
|
24
|
+
return (_jsxs(Stack, { gap: "xs", children: [showBulkActions && (_jsxs(Group, { justify: "flex-end", gap: "xs", wrap: "wrap", children: [copyAllLabel && (_jsx(CopyButton, { value: joined, children: ({ copied, copy }) => (_jsx(Button, { size: "xs", variant: copied ? 'filled' : 'default', color: copied ? color : undefined, leftSection: copied ? _jsx(Check, { size: 14, "aria-hidden": true }) : _jsx(Copy, { size: 14, "aria-hidden": true }), onClick: copy, children: copied ? (copiedAllLabel ?? copiedLabel) : copyAllLabel })) })), downloadLabel && (_jsx(Button, { size: "xs", variant: "default", leftSection: _jsx(Download, { size: 14, "aria-hidden": true }), onClick: handleDownload, children: downloadLabel }))] })), items.map((entry, idx) => (_jsx(Paper, { withBorder: true, radius: "md", p: "sm", children: _jsxs(Group, { justify: "space-between", wrap: "wrap", align: "center", gap: "sm", children: [_jsx(Code, { block: true, style: { flex: '1 1 12rem', minWidth: 0, whiteSpace: 'pre-wrap', wordBreak: 'break-all' }, children: entry }), _jsx(CopyButton, { value: entry, children: ({ copied, copy }) => (_jsxs(_Fragment, { children: [_jsx(Button, { size: "xs", radius: "xs", variant: copied ? 'filled' : 'light', color: color, leftSection: copied ? _jsx(Check, { size: 14, "aria-hidden": true }) : _jsx(Copy, { size: 14, "aria-hidden": true }), style: { flexShrink: 0 }, onClick: copy, children: copied ? copiedLabel : copyLabel }), _jsx("span", { className: "mantine-visually-hidden", role: "status", "aria-live": "polite", children: copied ? copiedLabel : '' })] })) })] }) }, `${idx}-${entry.slice(0, 12)}`)))] }));
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=delivery-codes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delivery-codes.js","sourceRoot":"","sources":["../../src/orders/delivery-codes.tsx"],"names":[],"mappings":"AAAA,YAAY,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AAG,EAAC,IAAI,aAChE,KAAC,IAAI,IAAC,KAAK,QAAC,KAAK,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAClG,KAAK,GACD,EACP,KAAC,UAAU,IAAC,KAAK,EAAE,KAAK,YACrB,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CACrB,8BACE,KAAC,MAAM,IACL,IAAI,EAAC,IAAI,EACT,MAAM,EAAC,IAAI,EACX,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,EACpC,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,KAAC,KAAK,IAAC,IAAI,EAAE,EAAE,wBAAgB,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAE,EAAE,wBAAgB,EACtF,KAAK,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,EACxB,OAAO,EAAE,IAAI,YAEZ,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,GAC1B,EACT,eAAM,SAAS,EAAC,yBAAyB,EAAC,IAAI,EAAC,QAAQ,eAAW,QAAQ,YACvE,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,GACrB,IACN,CACJ,GACU,IACP,IAzBE,GAAG,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CA0BlC,CACT,CAAC,IACI,CACT,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type FormEvent } from 'react';
|
|
2
|
+
import type { ResellerOrderNeedsInput } from '@misebako/sdk/schemas';
|
|
3
|
+
/** Map order states to consistent Mantine badge colors across Misebako and Noren. */
|
|
4
|
+
export declare function orderStateColor(status: string): string;
|
|
5
|
+
/** Check whether an active in-progress order is waiting on buyer credential input. */
|
|
6
|
+
export declare function isAwaitingInput(order: {
|
|
7
|
+
needsInput?: ResellerOrderNeedsInput | null;
|
|
8
|
+
status: string;
|
|
9
|
+
}): boolean;
|
|
10
|
+
export interface NeedsInputFormProps {
|
|
11
|
+
needsInput: ResellerOrderNeedsInput;
|
|
12
|
+
value: string;
|
|
13
|
+
onChange: (value: string) => void;
|
|
14
|
+
onSubmit: (event: FormEvent) => void;
|
|
15
|
+
busy?: boolean;
|
|
16
|
+
labels: {
|
|
17
|
+
title: string;
|
|
18
|
+
label: string;
|
|
19
|
+
note: string;
|
|
20
|
+
submit: string;
|
|
21
|
+
toggleSecret?: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** Shared orange alert + credential form when direct fulfillment pauses waiting for OTP / secondary verification. */
|
|
25
|
+
export declare function NeedsInputForm({ needsInput, value, onChange, onSubmit, busy, labels, }: NeedsInputFormProps): import("react").JSX.Element;
|
|
26
|
+
export interface OrderActionConfirmProps {
|
|
27
|
+
warning: string;
|
|
28
|
+
confirmLabel: string;
|
|
29
|
+
keepLabel: string;
|
|
30
|
+
submittingLabel?: string;
|
|
31
|
+
busy?: boolean;
|
|
32
|
+
onConfirm: () => void;
|
|
33
|
+
onCancel: () => void;
|
|
34
|
+
}
|
|
35
|
+
/** Shared inline cancel / refund confirmation warning box. */
|
|
36
|
+
export declare function OrderActionConfirm({ warning, confirmLabel, keepLabel, submittingLabel, busy, onConfirm, onCancel, }: OrderActionConfirmProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Alert, Button, Group, PasswordInput, Stack, Text } from '@mantine/core';
|
|
4
|
+
/** Map order states to consistent Mantine badge colors across Misebako and Noren. */
|
|
5
|
+
export function orderStateColor(status) {
|
|
6
|
+
switch (status) {
|
|
7
|
+
case 'DELIVERED':
|
|
8
|
+
return 'teal';
|
|
9
|
+
case 'REFUNDED':
|
|
10
|
+
case 'RELEASED':
|
|
11
|
+
return 'gray';
|
|
12
|
+
default:
|
|
13
|
+
return 'orange';
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/** Check whether an active in-progress order is waiting on buyer credential input. */
|
|
17
|
+
export function isAwaitingInput(order) {
|
|
18
|
+
return Boolean(order.needsInput) && (order.status === 'PENDING' || order.status === 'WAITING');
|
|
19
|
+
}
|
|
20
|
+
/** Shared orange alert + credential form when direct fulfillment pauses waiting for OTP / secondary verification. */
|
|
21
|
+
export function NeedsInputForm({ needsInput, value, onChange, onSubmit, busy = false, labels, }) {
|
|
22
|
+
return (_jsx("form", { onSubmit: onSubmit, children: _jsx(Alert, { color: "orange", title: labels.title, children: _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { size: "sm", style: { overflowWrap: 'anywhere', whiteSpace: 'pre-line' }, children: needsInput.hint }), _jsx(PasswordInput, { label: labels.label, description: labels.note, error: needsInput.reason || undefined, required: true, maxLength: 32768, autoComplete: "off", spellCheck: false, value: value, disabled: busy, visibilityToggleButtonProps: { 'aria-label': labels.toggleSecret ?? 'Show or hide value' }, onChange: event => onChange(event.currentTarget.value) }), _jsx(Group, { children: _jsx(Button, { type: "submit", color: "orange", loading: busy, disabled: !value.trim(), children: labels.submit }) })] }) }) }));
|
|
23
|
+
}
|
|
24
|
+
/** Shared inline cancel / refund confirmation warning box. */
|
|
25
|
+
export function OrderActionConfirm({ warning, confirmLabel, keepLabel, submittingLabel, busy = false, onConfirm, onCancel, }) {
|
|
26
|
+
return (_jsxs(Stack, { gap: "xs", children: [_jsx(Alert, { color: "red", children: warning }), _jsxs(Group, { gap: "xs", wrap: "wrap", children: [_jsx(Button, { color: "red", loading: busy, onClick: onConfirm, children: busy && submittingLabel ? submittingLabel : confirmLabel }), _jsx(Button, { variant: "default", disabled: busy, onClick: onCancel, children: keepLabel })] })] }));
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=order-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"order-status.js","sourceRoot":"","sources":["../../src/orders/order-status.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAGZ,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAGhF,qFAAqF;AACrF,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,WAAW;YACd,OAAO,MAAM,CAAA;QACf,KAAK,UAAU,CAAC;QAChB,KAAK,UAAU;YACb,OAAO,MAAM,CAAA;QACf;YACE,OAAO,QAAQ,CAAA;IACnB,CAAC;AACH,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,eAAe,CAAC,KAAsE;IACpG,OAAO,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAA;AAChG,CAAC;AAiBD,qHAAqH;AACrH,MAAM,UAAU,cAAc,CAAC,EAC7B,UAAU,EACV,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,IAAI,GAAG,KAAK,EACZ,MAAM,GACc;IACpB,OAAO,CACL,eAAM,QAAQ,EAAE,QAAQ,YACtB,KAAC,KAAK,IAAC,KAAK,EAAC,QAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,KAAK,YACvC,MAAC,KAAK,IAAC,GAAG,EAAC,IAAI,aACb,KAAC,IAAI,IAAC,IAAI,EAAC,IAAI,EAAC,KAAK,EAAE,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,YACxE,UAAU,CAAC,IAAI,GACX,EACP,KAAC,aAAa,IACZ,KAAK,EAAE,MAAM,CAAC,KAAK,EACnB,WAAW,EAAE,MAAM,CAAC,IAAI,EACxB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1,11 @@
|
|
|
1
|
+
export interface AppearanceMenuProps {
|
|
2
|
+
cookieName: string;
|
|
3
|
+
labels: {
|
|
4
|
+
title: string;
|
|
5
|
+
auto: string;
|
|
6
|
+
light: string;
|
|
7
|
+
dark: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/** Shared color-scheme switcher with instant transition suppression and cookie persistence. */
|
|
11
|
+
export declare function AppearanceMenu({ cookieName, labels }: AppearanceMenuProps): import("react").JSX.Element;
|