commerce-kit 0.62.0 → 0.65.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 +35 -0
- package/dist/api-types.d.ts +234 -44
- package/dist/payment-icons.d.ts +177 -0
- package/dist/payment-icons.js +24 -0
- package/dist/payment-icons.js.map +1 -0
- package/package.json +6 -1
package/README.md
CHANGED
|
@@ -129,6 +129,21 @@ const updated = await commerce.ticketsUpdate(
|
|
|
129
129
|
const ticket = await commerce.ticketAttendeeGet({ token: 'a1b2c3...' });
|
|
130
130
|
```
|
|
131
131
|
|
|
132
|
+
## Newsletter
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
const subscriber = await commerce.subscriberCreate({ email: 'jane@example.com', marketingConsent: true });
|
|
136
|
+
|
|
137
|
+
// Double opt-in stores return pending: true — the address joins the list only after the
|
|
138
|
+
// shopper clicks the link in the confirmation email. Tell them to check their inbox.
|
|
139
|
+
if (subscriber.pending) { /* "Check your inbox to confirm" */ }
|
|
140
|
+
|
|
141
|
+
await commerce.subscriberDelete('jane@example.com');
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Confirmation and unsubscribe links in emails point at pages hosted by Your Next Store, so a
|
|
145
|
+
storefront needs no `/confirm-subscription` or `/unsubscribe` route of its own.
|
|
146
|
+
|
|
132
147
|
## Collections & Categories
|
|
133
148
|
|
|
134
149
|
Full CRUD for product collections, product categories, and blog categories. Mutations are
|
|
@@ -155,6 +170,26 @@ await commerce.blogCategoryUpdate({ idOrSlug: 'guides' }, { description: null })
|
|
|
155
170
|
await commerce.blogCategoryDelete({ idOrSlug: 'guides' });
|
|
156
171
|
```
|
|
157
172
|
|
|
173
|
+
## Payment Icons
|
|
174
|
+
|
|
175
|
+
Official payment marks (cards, wallets, BLIK, Przelewy24, Klarna, PayU, …) from
|
|
176
|
+
[activemerchant/payment_icons](https://github.com/activemerchant/payment_icons) (MIT), keyed by
|
|
177
|
+
Stripe's payment method type names. Each renders as a 38×24 `<img>` with the method's name as
|
|
178
|
+
alt text. Render them from a Server Component: the module carries every icon (~75 KB).
|
|
179
|
+
|
|
180
|
+
```tsx
|
|
181
|
+
import { PaymentIcon } from 'commerce-kit/payment-icons';
|
|
182
|
+
|
|
183
|
+
<ul aria-label="Payment methods" className="flex gap-2">
|
|
184
|
+
{(['visa', 'mastercard', 'blik', 'p24', 'apple_pay'] as const).map((method) => (
|
|
185
|
+
<li key={method}><PaymentIcon method={method} className="h-6 w-auto" /></li>
|
|
186
|
+
))}
|
|
187
|
+
</ul>;
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
To add or refresh icons, edit the list in `scripts/payment-icons.ts` and run
|
|
191
|
+
`bun scripts/payment-icons.ts [commit-sha]`.
|
|
192
|
+
|
|
158
193
|
## Raw API Requests
|
|
159
194
|
|
|
160
195
|
For endpoints not yet implemented in the SDK, use the `request()` method:
|