brainerce 2.8.0 → 2.9.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 +86 -10
- package/dist/index.d.mts +105 -3
- package/dist/index.d.ts +105 -3
- package/dist/index.js +10 -1
- package/dist/index.mjs +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -201,7 +201,7 @@ These sequences are non-negotiable. The order of SDK calls matters.
|
|
|
201
201
|
```ts
|
|
202
202
|
const providers = await client.getPaymentProviders();
|
|
203
203
|
```
|
|
204
|
-
Each provider has a `renderType`: `'sdk-widget'` (Stripe, PayPal, Grow), `'iframe'` (Cardcom), `'redirect'
|
|
204
|
+
Each provider has a `renderType`: `'sdk-widget'` (Stripe, PayPal, Grow), `'iframe'` (Cardcom), `'redirect'` (Morning, Takbull, iCredit), `'sandbox'`. Branch on `renderType`, never on provider name. A provider's `clientSdk.displayModes` lists every mode it can serve; you may ask for one with `createPaymentIntent(checkoutId, { preferredRenderType: 'iframe' | 'redirect' })`, and the platform honours it only from that list, so still branch on what comes back.
|
|
205
205
|
5. Confirm payment using the provider's flow (Stripe Elements `stripe.confirmCardPayment`, PayPal button, redirect, etc.).
|
|
206
206
|
6. On the confirmation page, **always call both**:
|
|
207
207
|
```ts
|
|
@@ -433,6 +433,7 @@ The SDK exports these utility functions for common UI tasks:
|
|
|
433
433
|
| `isCouponApplicableToProduct(coupon, product)` | Check if coupon applies | `isCouponApplicableToProduct(coupon, product)` |
|
|
434
434
|
| `isAllowedPaymentUrl(url, options?)` | Validate a payment URL host | `isAllowedPaymentUrl(intent.clientSecret)` → `true` |
|
|
435
435
|
| `safePaymentRedirect(url, options?)` | Validate then `window.location.href` | `safePaymentRedirect(intent.clientSecret)` |
|
|
436
|
+
| `resolveRenderType(clientSdk, preferred?)` | Predict the `renderType` an intent will come back with (the platform's own rule), so you can pick `successUrl` before creating it | `resolveRenderType(provider.clientSdk, 'iframe')` → `'iframe'` |
|
|
436
437
|
| `buildProductJsonLd(product, opts)` | schema.org Product JSON-LD (PDPs only) | See SEO section |
|
|
437
438
|
| `buildArticleJsonLd(post, opts)` | schema.org Article JSON-LD for blog posts | See SEO section |
|
|
438
439
|
| `buildOrganizationJsonLd(store, opts)` | schema.org Organization for the homepage | See SEO section |
|
|
@@ -1323,9 +1324,9 @@ The SDK uses **server-side carts for all users**. Guests get automatic session c
|
|
|
1323
1324
|
> operation — that one pushes to external platforms, not to your storefront.
|
|
1324
1325
|
|
|
1325
1326
|
> **A shopper cart holds at most 50 distinct lines.** Adding a 51st _different_
|
|
1326
|
-
> product throws `400
|
|
1327
|
-
>
|
|
1328
|
-
> setting. **It applies in channel (`salesChannelId: 'vc_*'`) and store
|
|
1327
|
+
> product throws a `400` carrying the error code `CART_LINE_LIMIT_REACHED`, with
|
|
1328
|
+
> the limit itself on `details.maxLines`. It is a fixed platform limit with no
|
|
1329
|
+
> per-store setting. **It applies in channel (`salesChannelId: 'vc_*'`) and store
|
|
1329
1330
|
> (`storeId`) mode only — an admin (`apiKey: 'brainerce_*'`) cart is not
|
|
1330
1331
|
> capped**, because a B2B or bulk-import cart legitimately runs long, so the same
|
|
1331
1332
|
> call can succeed for one client and fail for another. The cap counts distinct
|
|
@@ -1337,6 +1338,23 @@ The SDK uses **server-side carts for all users**. Guests get automatic session c
|
|
|
1337
1338
|
> the earlier products of that bundle in the cart, so re-read the cart after a
|
|
1338
1339
|
> failed bundle add.
|
|
1339
1340
|
|
|
1341
|
+
**Detect a full cart by the code, not by the sentence.** The SDK hands the whole parsed
|
|
1342
|
+
error body back on `BrainerceError.details`, so the code is one level in and the limit sits
|
|
1343
|
+
beside it — `err.code` is NOT where it lives:
|
|
1344
|
+
|
|
1345
|
+
```typescript
|
|
1346
|
+
catch (err) {
|
|
1347
|
+
const body = (err as BrainerceError).details as
|
|
1348
|
+
{ code?: string; details?: { maxLines?: number } } | undefined;
|
|
1349
|
+
if (body?.code === 'CART_LINE_LIMIT_REACHED') showCartFull(body.details?.maxLines ?? 50);
|
|
1350
|
+
}
|
|
1351
|
+
```
|
|
1352
|
+
|
|
1353
|
+
⛔ **Keep any existing match on the message as a fallback.** The wording is byte-for-byte
|
|
1354
|
+
unchanged on purpose — storefronts written before the code existed still depend on it, and a
|
|
1355
|
+
storefront can be talking to a backend that has not been redeployed yet. Branch on the code
|
|
1356
|
+
first, then fall through to the prose match.
|
|
1357
|
+
|
|
1340
1358
|
```typescript
|
|
1341
1359
|
// Add to cart (guest or logged-in — same code!)
|
|
1342
1360
|
await client.smartAddToCart({ productId: 'prod_123', quantity: 2 });
|
|
@@ -2627,8 +2645,10 @@ await client.smartAddToCart({
|
|
|
2627
2645
|
> `MODIFIER_VALIDATION_FAILED` envelope on `BrainerceError.details`.
|
|
2628
2646
|
>
|
|
2629
2647
|
> **The 50-distinct-line cap applies here too** (channel and store mode; not
|
|
2630
|
-
> admin). A 51st different product throws `400
|
|
2631
|
-
>
|
|
2648
|
+
> admin). A 51st different product throws a `400` carrying the error code
|
|
2649
|
+
> `CART_LINE_LIMIT_REACHED` on `BrainerceError.details.code`, with the limit on
|
|
2650
|
+
> `BrainerceError.details.details.maxLines`. Branch on the code and keep any existing match on
|
|
2651
|
+
> the (unchanged) message text as a fallback — see
|
|
2632
2652
|
> [Cart (Unified for All Users)](#cart-unified-for-all-users) above.
|
|
2633
2653
|
|
|
2634
2654
|
#### Get Cart
|
|
@@ -2895,9 +2915,11 @@ const cart = await client.addToCart(cartId, {
|
|
|
2895
2915
|
```
|
|
2896
2916
|
|
|
2897
2917
|
> **Capped at 50 distinct lines** in channel and store mode (not admin): a 51st
|
|
2898
|
-
> different product throws `400
|
|
2899
|
-
>
|
|
2900
|
-
>
|
|
2918
|
+
> different product throws a `400` carrying the error code
|
|
2919
|
+
> `CART_LINE_LIMIT_REACHED` on `BrainerceError.details.code`, with the limit on
|
|
2920
|
+
> `BrainerceError.details.details.maxLines`. Branch on the code and keep any existing match on
|
|
2921
|
+
> the (unchanged) message text as a fallback. Quantity changes on an already-full
|
|
2922
|
+
> cart still work — only a new line is refused. See
|
|
2901
2923
|
> [Cart (Unified for All Users)](#cart-unified-for-all-users).
|
|
2902
2924
|
|
|
2903
2925
|
#### Update Cart Item
|
|
@@ -3641,7 +3663,7 @@ const config = await client.getPaymentConfig();
|
|
|
3641
3663
|
|
|
3642
3664
|
// Returns:
|
|
3643
3665
|
// {
|
|
3644
|
-
// provider: string, // 'stripe' | 'paypal' | 'grow' | 'cardcom' | any
|
|
3666
|
+
// provider: string, // 'stripe' | 'paypal' | 'grow' | 'cardcom' | 'icredit' | any
|
|
3645
3667
|
// // installed marketplace payment app — NOT a
|
|
3646
3668
|
// // closed union. Never switch on it exhaustively.
|
|
3647
3669
|
// publicKey: 'pk_live_xxx...', // Stripe publishable key or PayPal client ID
|
|
@@ -3666,6 +3688,7 @@ const intent = await client.createPaymentIntent(checkout.id);
|
|
|
3666
3688
|
// status: 'requires_payment_method',
|
|
3667
3689
|
// provider: 'stripe', // which processor took the intent
|
|
3668
3690
|
// clientSdk: { renderType: 'sdk-widget', /* … */ }, // HOW to render — see below
|
|
3691
|
+
// renderModeResolution: 'provider-default', // why renderType is what it is — see "Asking for a mode"
|
|
3669
3692
|
// }
|
|
3670
3693
|
```
|
|
3671
3694
|
|
|
@@ -3687,6 +3710,48 @@ Branch on `clientSdk?.renderType`. **Never** branch on "does `clientSdk` exist":
|
|
|
3687
3710
|
every provider returns one, sandbox included. And never hard-code by provider name.
|
|
3688
3711
|
Only `provider === 'stripe'` has a `clientSdk.initConfig.publishableKey`.
|
|
3689
3712
|
|
|
3713
|
+
#### Asking for a mode (`preferredRenderType`)
|
|
3714
|
+
|
|
3715
|
+
Some providers can present their payment surface more than one way. Each
|
|
3716
|
+
`getPaymentProviders()` entry carries `clientSdk.displayModes`, every mode the
|
|
3717
|
+
provider can serve, beside `clientSdk.renderType`, its default. Pass
|
|
3718
|
+
`preferredRenderType: 'iframe' | 'redirect'` and the platform returns that mode
|
|
3719
|
+
when `displayModes` lists it, and the provider's default otherwise. Asking is
|
|
3720
|
+
never an error. The intent's `renderModeResolution` tells you which happened:
|
|
3721
|
+
`'preferred'`, `'fallback'` (you asked for a mode the provider does not declare),
|
|
3722
|
+
or `'provider-default'` (you did not ask, or the intent is a sandbox one).
|
|
3723
|
+
|
|
3724
|
+
An iframe intent returns the shopper **inside the frame**, to a same-origin page
|
|
3725
|
+
that posts `brainerce:payment-complete` to the parent; a redirect intent returns
|
|
3726
|
+
them straight to your confirmation page. So predict the mode **before** the call
|
|
3727
|
+
and pass the matching `successUrl`. `resolveRenderType()` is the platform's own
|
|
3728
|
+
rule, exported so the two never disagree:
|
|
3729
|
+
|
|
3730
|
+
```typescript
|
|
3731
|
+
import { resolveRenderType } from 'brainerce';
|
|
3732
|
+
|
|
3733
|
+
const { defaultProvider } = await client.getPaymentProviders();
|
|
3734
|
+
const expected = resolveRenderType(defaultProvider?.clientSdk, 'iframe');
|
|
3735
|
+
const successUrl =
|
|
3736
|
+
expected === 'iframe'
|
|
3737
|
+
? `${origin}/payment-complete?checkout_id=${checkout.id}`
|
|
3738
|
+
: `${origin}/order-confirmation?checkout_id=${checkout.id}`;
|
|
3739
|
+
|
|
3740
|
+
const intent = await client.createPaymentIntent(checkout.id, {
|
|
3741
|
+
preferredRenderType: 'iframe',
|
|
3742
|
+
successUrl,
|
|
3743
|
+
});
|
|
3744
|
+
// Still branch on intent.clientSdk?.renderType — never on 'iframe'.
|
|
3745
|
+
```
|
|
3746
|
+
|
|
3747
|
+
Omit the option to take the provider's default, which is exactly what every
|
|
3748
|
+
storefront did before it existed. There is no merchant-dashboard setting for
|
|
3749
|
+
this: the storefront knows whether it has a frame to render into, the merchant
|
|
3750
|
+
does not. Only ask for `'iframe'` when you do, and when the provider's iframe has
|
|
3751
|
+
been verified on a real checkout. Any other value is rejected with `400`;
|
|
3752
|
+
`'sdk-widget'`, `'embedded-fields'` and `'sandbox'` are integration mechanisms,
|
|
3753
|
+
not presentation preferences.
|
|
3754
|
+
|
|
3690
3755
|
#### Confirm an SDK / redirect payment
|
|
3691
3756
|
|
|
3692
3757
|
```typescript
|
|
@@ -3728,6 +3793,13 @@ Do **not** call it on your `cancelUrl`. The buyer abandoned; just let them retry
|
|
|
3728
3793
|
> `getPaymentProviders()` and `waitForOrder()` are **sales-channel mode only**;
|
|
3729
3794
|
> they throw `BrainerceError` 400 on a `storeId` or `apiKey` client.
|
|
3730
3795
|
|
|
3796
|
+
> **`createPaymentIntent()` can throw `BrainerceError` 503 with
|
|
3797
|
+
> `err.details.code === 'PAYMENTS_PAUSED'`.** The platform pauses a store's payments
|
|
3798
|
+
> while its ownership is being transferred, until the new owner connects a payment
|
|
3799
|
+
> provider, which can take days. Show `err.message` ("Payments are temporarily
|
|
3800
|
+
> unavailable for this store") at the payment step, keep the cart and checkout, and
|
|
3801
|
+
> do not retry in a loop: nothing the storefront does lifts it.
|
|
3802
|
+
|
|
3731
3803
|
**Routing to a specific provider (`providerId`).** With `getPaymentProviders()` you
|
|
3732
3804
|
render additive **express buttons** (e.g. PayPal as a `WALLET`) alongside the primary
|
|
3733
3805
|
card form. When the buyer taps one, pass that provider's `id` so the charge routes to
|
|
@@ -3747,6 +3819,9 @@ Omit `providerId` to settle through the primary card processor (`defaultProvider
|
|
|
3747
3819
|
The platform scopes it to the store, so only that store's own installed providers are
|
|
3748
3820
|
selectable.
|
|
3749
3821
|
|
|
3822
|
+
The full options object is `{ providerId?, successUrl?, cancelUrl?, saveCard?,
|
|
3823
|
+
preferredRenderType? }`.
|
|
3824
|
+
|
|
3750
3825
|
#### Confirm Payment with Stripe.js
|
|
3751
3826
|
|
|
3752
3827
|
Use the client secret with Stripe.js to collect payment:
|
|
@@ -8397,6 +8472,7 @@ const handleCheckout = async () => {
|
|
|
8397
8472
|
| `Product not found` | Unknown product ID, or a valid one that is `draft`/`archived`, or not published to this sales channel. The 404 is identical for all three, so it cannot be used to probe another channel's catalogue. |
|
|
8398
8473
|
| `Insufficient inventory` | Not enough stock |
|
|
8399
8474
|
| `Invalid quantity` | Quantity < 1 or > available |
|
|
8475
|
+
| `Payments are temporarily unavailable for this store` | `createPaymentIntent()` returned 503 `PAYMENTS_PAUSED`: the store is mid ownership transfer and stays paused until the new owner connects a payment provider. Show the message, keep the cart, do not retry in a loop. |
|
|
8400
8476
|
|
|
8401
8477
|
### Custom Hook for SDK Operations (Optional)
|
|
8402
8478
|
|
package/dist/index.d.mts
CHANGED
|
@@ -5030,9 +5030,38 @@ interface PublishProductResponse {
|
|
|
5030
5030
|
* Returned by the backend in provider config and payment intents.
|
|
5031
5031
|
* The frontend dynamically loads the SDK script and calls init/render methods.
|
|
5032
5032
|
*/
|
|
5033
|
+
/**
|
|
5034
|
+
* Every way a provider can present its payment surface. `PaymentClientSdk.renderType`
|
|
5035
|
+
* is one of these; `PaymentClientSdk.displayModes` lists the ones the provider
|
|
5036
|
+
* can serve.
|
|
5037
|
+
*/
|
|
5038
|
+
type PaymentRenderType = 'sdk-widget' | 'iframe' | 'redirect' | 'sandbox' | 'embedded-fields';
|
|
5039
|
+
/**
|
|
5040
|
+
* The render modes a storefront may ASK for via
|
|
5041
|
+
* `createPaymentIntent(id, { preferredRenderType })`. Deliberately only the
|
|
5042
|
+
* two presentation choices: `sdk-widget`, `embedded-fields` and `sandbox` are
|
|
5043
|
+
* integration mechanisms a storefront cannot substitute at will.
|
|
5044
|
+
*/
|
|
5045
|
+
type PreferredRenderType = 'redirect' | 'iframe';
|
|
5046
|
+
/**
|
|
5047
|
+
* Why the `clientSdk.renderType` on a `PaymentIntent` is what it is.
|
|
5048
|
+
*
|
|
5049
|
+
* - `'preferred'` — you asked for a mode and the provider supports it.
|
|
5050
|
+
* - `'fallback'` — you asked for a mode the provider does not declare;
|
|
5051
|
+
* you got the provider's default instead.
|
|
5052
|
+
* - `'provider-default'` — you did not ask (or the intent is a sandbox one).
|
|
5053
|
+
*/
|
|
5054
|
+
type RenderModeResolution = 'preferred' | 'fallback' | 'provider-default';
|
|
5033
5055
|
interface PaymentClientSdk {
|
|
5034
5056
|
/** How the payment UI is rendered: 'sdk-widget' (JS SDK), 'iframe', 'redirect', 'sandbox' (test orders), or 'embedded-fields' (PCI-compliant provider-hosted fields embedded in merchant DOM, e.g. Cardcom OpenFields, Stripe Elements) */
|
|
5035
|
-
renderType:
|
|
5057
|
+
renderType: PaymentRenderType;
|
|
5058
|
+
/**
|
|
5059
|
+
* Every render mode this provider can serve. `renderType` is the default;
|
|
5060
|
+
* `preferredRenderType` on `createPaymentIntent` is honoured only if it is in
|
|
5061
|
+
* this list. Absent on legacy manifests — treat as `[renderType]`, which is
|
|
5062
|
+
* exactly what `resolveRenderType()` does.
|
|
5063
|
+
*/
|
|
5064
|
+
displayModes?: PaymentRenderType[];
|
|
5036
5065
|
/** URL of the main SDK script to load */
|
|
5037
5066
|
scriptUrl?: string;
|
|
5038
5067
|
/** Name of the global variable set by the SDK script (e.g., 'growPayment') */
|
|
@@ -5202,6 +5231,14 @@ interface PaymentIntent {
|
|
|
5202
5231
|
provider?: string;
|
|
5203
5232
|
/** Runtime client SDK overrides (merged with provider manifest config) */
|
|
5204
5233
|
clientSdk?: PaymentClientSdk;
|
|
5234
|
+
/**
|
|
5235
|
+
* Why the returned `clientSdk.renderType` is what it is — see
|
|
5236
|
+
* `RenderModeResolution`. Lets a storefront that asked for `iframe` and got
|
|
5237
|
+
* `redirect` tell "the provider does not support iframe" (`'fallback'`) from
|
|
5238
|
+
* "I never asked" (`'provider-default'`). Absent from older backends; always
|
|
5239
|
+
* branch on the `renderType` you got back, never on what you asked for.
|
|
5240
|
+
*/
|
|
5241
|
+
renderModeResolution?: RenderModeResolution;
|
|
5205
5242
|
}
|
|
5206
5243
|
/**
|
|
5207
5244
|
* The stored payment-record vocabulary. **UPPERCASE.**
|
|
@@ -8182,8 +8219,20 @@ interface TrackEventPayload {
|
|
|
8182
8219
|
/** Active dwell time in ms. Only meaningful for `eventType: 'engagement'`. Max 1 800 000 (30 min). */
|
|
8183
8220
|
engagedMs?: number;
|
|
8184
8221
|
}
|
|
8222
|
+
/**
|
|
8223
|
+
* The JSON body of any non-2xx response. `BrainerceError.details` holds a value
|
|
8224
|
+
* of this shape (the raw parsed body), so from a caught SDK error the code is
|
|
8225
|
+
* at `err.details.code`, one level deeper than it sits on the wire.
|
|
8226
|
+
*/
|
|
8185
8227
|
interface BrainerceApiError {
|
|
8186
8228
|
statusCode: number;
|
|
8229
|
+
/**
|
|
8230
|
+
* The stable, machine-readable error code — switch on THIS, never on
|
|
8231
|
+
* `message`, whose wording can change at any time. Always present: the API
|
|
8232
|
+
* derives a generic code from the status when a route supplies none.
|
|
8233
|
+
* The full list is at https://brainerce.com/docs/api/errors.
|
|
8234
|
+
*/
|
|
8235
|
+
code?: string;
|
|
8187
8236
|
message: string;
|
|
8188
8237
|
error?: string;
|
|
8189
8238
|
details?: unknown;
|
|
@@ -12145,6 +12194,25 @@ declare class BrainerceClient {
|
|
|
12145
12194
|
* subscription features.
|
|
12146
12195
|
*/
|
|
12147
12196
|
saveCard?: boolean;
|
|
12197
|
+
/**
|
|
12198
|
+
* How you would like the provider's payment surface presented. The
|
|
12199
|
+
* platform honours it when the provider supports that mode (it is
|
|
12200
|
+
* listed in the provider's `clientSdk.displayModes`), and otherwise
|
|
12201
|
+
* falls back to the provider's default — so always branch on the
|
|
12202
|
+
* `clientSdk.renderType` you get BACK, never on what you asked for.
|
|
12203
|
+
* The response's `renderModeResolution` says which happened. Omit to
|
|
12204
|
+
* take the provider's default.
|
|
12205
|
+
*
|
|
12206
|
+
* To pick the matching `successUrl` up front, call
|
|
12207
|
+
* `resolveRenderType(provider.clientSdk, preferred)` on the entry from
|
|
12208
|
+
* `getPaymentProviders()` — it applies the same rule the platform does.
|
|
12209
|
+
* An iframe intent returns the shopper INSIDE the frame, so its
|
|
12210
|
+
* `successUrl` must be a same-origin page that posts to the parent; a
|
|
12211
|
+
* redirect intent can return straight to the confirmation page.
|
|
12212
|
+
*
|
|
12213
|
+
* A value outside `'redirect' | 'iframe'` is rejected with 400.
|
|
12214
|
+
*/
|
|
12215
|
+
preferredRenderType?: PreferredRenderType;
|
|
12148
12216
|
}): Promise<PaymentIntent>;
|
|
12149
12217
|
/**
|
|
12150
12218
|
* Get payment status for a checkout.
|
|
@@ -14303,7 +14371,7 @@ declare class BrainerceError extends Error {
|
|
|
14303
14371
|
constructor(message: string, statusCode: number, details?: unknown);
|
|
14304
14372
|
}
|
|
14305
14373
|
|
|
14306
|
-
declare const SDK_VERSION = "2.
|
|
14374
|
+
declare const SDK_VERSION = "2.9.0";
|
|
14307
14375
|
|
|
14308
14376
|
/**
|
|
14309
14377
|
* Verify a webhook signature from Brainerce
|
|
@@ -14406,6 +14474,40 @@ declare function isAllowedPaymentUrl(url: string, options?: PaymentUrlOptions):
|
|
|
14406
14474
|
*/
|
|
14407
14475
|
declare function safePaymentRedirect(url: string, options?: PaymentUrlOptions): void;
|
|
14408
14476
|
|
|
14477
|
+
/**
|
|
14478
|
+
* Predict the `clientSdk.renderType` the platform will return for a given
|
|
14479
|
+
* provider and preference.
|
|
14480
|
+
*
|
|
14481
|
+
* Rules (identical to the platform's):
|
|
14482
|
+
* 1. No preference → the provider default.
|
|
14483
|
+
* 2. Preference declared in `displayModes` → the preference.
|
|
14484
|
+
* 3. Preference NOT declared → the provider default (the platform reports
|
|
14485
|
+
* `renderModeResolution: 'fallback'` on the intent).
|
|
14486
|
+
* 4. `displayModes` absent (legacy manifest) → treated as `[renderType]`.
|
|
14487
|
+
*
|
|
14488
|
+
* @param sdk - The `clientSdk` of an entry from `getPaymentProviders()`
|
|
14489
|
+
* (`defaultProvider.clientSdk` or `providers[i].clientSdk`).
|
|
14490
|
+
* @param preferred - The mode you intend to pass as `preferredRenderType`.
|
|
14491
|
+
* @returns The mode the intent will come back with. `'redirect'` when there is
|
|
14492
|
+
* no provider at all, so a storefront can always pick a return URL.
|
|
14493
|
+
*
|
|
14494
|
+
* @example
|
|
14495
|
+
* ```typescript
|
|
14496
|
+
* const { defaultProvider } = await client.getPaymentProviders();
|
|
14497
|
+
* const expected = resolveRenderType(defaultProvider?.clientSdk, 'iframe');
|
|
14498
|
+
* const successUrl = expected === 'iframe'
|
|
14499
|
+
* ? `${origin}/payment-complete?checkout_id=${checkoutId}`
|
|
14500
|
+
* : `${origin}/order-confirmation?checkout_id=${checkoutId}`;
|
|
14501
|
+
* const intent = await client.createPaymentIntent(checkoutId, {
|
|
14502
|
+
* preferredRenderType: 'iframe',
|
|
14503
|
+
* successUrl,
|
|
14504
|
+
* });
|
|
14505
|
+
* // Still branch on what came BACK — never on what you asked for.
|
|
14506
|
+
* if (intent.clientSdk?.renderType === 'iframe') { ... }
|
|
14507
|
+
* ```
|
|
14508
|
+
*/
|
|
14509
|
+
declare function resolveRenderType(sdk: Pick<PaymentClientSdk, 'renderType' | 'displayModes'> | null | undefined, preferred?: PreferredRenderType): PaymentRenderType;
|
|
14510
|
+
|
|
14409
14511
|
interface FormatProductPriceOptions {
|
|
14410
14512
|
/**
|
|
14411
14513
|
* BCP-47 locale for `Intl.NumberFormat`. Controls number grouping and
|
|
@@ -14804,4 +14906,4 @@ interface CategorySitemapOptions {
|
|
|
14804
14906
|
*/
|
|
14805
14907
|
declare function getCategorySitemapEntries(client: BrainerceClient, opts: CategorySitemapOptions): Promise<SitemapEntry[]>;
|
|
14806
14908
|
|
|
14807
|
-
export { type AddToCartDto, type AddressDetailsResult, type AddressSuggestion, type AiTranslateBulkInput, type AiTranslateBulkResult, type AiTranslateSingleInput, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AssignTaxClassDto, type AttachModifierGroupInput, type Attribute, type AttributeDisplayType, type AttributeOption, type AttributeSource, type AutoRegionResponse, type AvailabilityClock, type BlogPost, type BlogPostListParams, type BlogPostListResponse, type BlogSitemapOptions, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkCreateProductsDto, type BulkCreateProductsError, type BulkCreateProductsJob, type BulkCreateProductsStatus, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type BusinessHoursWindow, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundleOfferOfferedProduct, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartItemUnavailableReason, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryDetail, type CategoryNode, type CategorySitemapOptions, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CheckoutTender, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateContentInput, type CreateCouponDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateRegionDto, type CreateReturnLabelDto as CreateReturnLabelInput, type CreateReturnLabelResponse, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateStockAlertInput, type CreateTagDto as CreateTagInput, type CreateTaxClassDto, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type CustomizationFieldOption, type DateAvailabilityConstraints, type DateAvailabilitySurface, type DateFieldParseResult, type DeleteProductResponse, type DeliveryType, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GiftCardAdmin, type GiftCardAdminDetail, type GiftCardBalance, type GiftCardLiability, type GiftCardTransaction, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type I18nSettings, type IdempotentRequestOptions, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type IssueGiftCardAdminDto, type IssuedGiftCardAdmin, type JsonLdOptions, type ListModifierGroupsParams, type ListNewsletterBenefitGrantsParams, type LocalCart, type LocalCartItem, type LocaleTranslation, type LockedVariant, type LoyaltyBadge, type LoyaltyMembershipPlan, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyRewardRecommendation, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldFilter, type MetafieldFilterValue, type MetafieldFiltersResponse, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type ModifierValidationFailedError, type MyProductReview, type NestedModifierSelection, type NewsletterBenefitDiscountKind, type NewsletterBenefitGrant, type NewsletterBenefitGrantState, type NewsletterBenefitSettings, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthErrorCode, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomFieldDefinition, type OrderCustomFieldValues, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaidMembershipInfo, type ParsedDateFieldValue, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentRecordStatus, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type PriceDriftError, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductInventoryResponse, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductReviewImage, type ProductReviewImageAdmin, type ProductSitemapOptions, type ProductStatus, type ProductSuggestion, type ProductUnavailableError, type ProductVariant, type PublicMetafieldDefinition, type PublicNewsletterBenefitOffer, type PublicRegion, type PublicRegionDetail, type PublicRegionPaymentProvider, type PublicTaxClass, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type Region, type RegionPaymentProvider, type RegisterCustomerDto, type ReissuedGiftCardAdmin, type RelativeDateBounds, type ResendNewsletterBenefitResult, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type ReturnLabelParcel, type ReviewPhotoUpload, type ReviewStatus, type RichTextContent, SDK_VERSION, type SavedPaymentMethodSummary, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type SetTranslationFields, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingSummaryEntry, type ShippingZone, type ShippingZoneQueryParams, type SitemapEntry, type StockAlertResponse, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreCapabilities, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type StoreTracking, type StorefrontSavedPaymentMethod, type SubmitProductReviewInput, type SubscribeMarketingInput, type SubscribeMarketingResponse, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxClass, type TaxEstimateResponse, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type TrackingEventItem, type TrackingEventName, type TrackingEventPayload, type TranslatableEntityType, type TranslationStatusEntry, type TranslationsMap, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateNewsletterBenefitSettingsInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateRegionDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxClassDto, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsellSettings, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, buildArticleJsonLd, buildBreadcrumbJsonLd, buildCollectionPageJsonLd, buildOrganizationJsonLd, buildProductFaqJsonLd, buildProductJsonLd, buildWebsiteJsonLd, computeAvailableSlots, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getBlogSitemapEntries, getBusinessHoursForDate, getCartItemImage, getCartItemName, getCartTotals, getCategorySitemapEntries, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSitemapEntries, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCalendarDateAllowed, isCouponApplicableToProduct, isDateValueAllowed, isHtmlDescription, isWebhookEventType, jsonLdScriptProps, parseDateFieldValue, parseWebhookEvent, resolveRelativeBounds, resolveStoreLocalParts, safePaymentRedirect, stripHtml, validateDateAvailabilityConfig, verifyWebhook };
|
|
14909
|
+
export { type AddToCartDto, type AddressDetailsResult, type AddressSuggestion, type AiTranslateBulkInput, type AiTranslateBulkResult, type AiTranslateSingleInput, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AssignTaxClassDto, type AttachModifierGroupInput, type Attribute, type AttributeDisplayType, type AttributeOption, type AttributeSource, type AutoRegionResponse, type AvailabilityClock, type BlogPost, type BlogPostListParams, type BlogPostListResponse, type BlogSitemapOptions, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkCreateProductsDto, type BulkCreateProductsError, type BulkCreateProductsJob, type BulkCreateProductsStatus, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type BusinessHoursWindow, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundleOfferOfferedProduct, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartItemUnavailableReason, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryDetail, type CategoryNode, type CategorySitemapOptions, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CheckoutTender, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateContentInput, type CreateCouponDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateRegionDto, type CreateReturnLabelDto as CreateReturnLabelInput, type CreateReturnLabelResponse, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateStockAlertInput, type CreateTagDto as CreateTagInput, type CreateTaxClassDto, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type CustomizationFieldOption, type DateAvailabilityConstraints, type DateAvailabilitySurface, type DateFieldParseResult, type DeleteProductResponse, type DeliveryType, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GiftCardAdmin, type GiftCardAdminDetail, type GiftCardBalance, type GiftCardLiability, type GiftCardTransaction, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type I18nSettings, type IdempotentRequestOptions, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type IssueGiftCardAdminDto, type IssuedGiftCardAdmin, type JsonLdOptions, type ListModifierGroupsParams, type ListNewsletterBenefitGrantsParams, type LocalCart, type LocalCartItem, type LocaleTranslation, type LockedVariant, type LoyaltyBadge, type LoyaltyMembershipPlan, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyRewardRecommendation, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldFilter, type MetafieldFilterValue, type MetafieldFiltersResponse, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type ModifierValidationFailedError, type MyProductReview, type NestedModifierSelection, type NewsletterBenefitDiscountKind, type NewsletterBenefitGrant, type NewsletterBenefitGrantState, type NewsletterBenefitSettings, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthErrorCode, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomFieldDefinition, type OrderCustomFieldValues, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaidMembershipInfo, type ParsedDateFieldValue, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentRecordStatus, type PaymentRenderType, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreferredRenderType, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type PriceDriftError, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductInventoryResponse, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductReviewImage, type ProductReviewImageAdmin, type ProductSitemapOptions, type ProductStatus, type ProductSuggestion, type ProductUnavailableError, type ProductVariant, type PublicMetafieldDefinition, type PublicNewsletterBenefitOffer, type PublicRegion, type PublicRegionDetail, type PublicRegionPaymentProvider, type PublicTaxClass, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type Region, type RegionPaymentProvider, type RegisterCustomerDto, type ReissuedGiftCardAdmin, type RelativeDateBounds, type RenderModeResolution, type ResendNewsletterBenefitResult, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type ReturnLabelParcel, type ReviewPhotoUpload, type ReviewStatus, type RichTextContent, SDK_VERSION, type SavedPaymentMethodSummary, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type SetTranslationFields, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingSummaryEntry, type ShippingZone, type ShippingZoneQueryParams, type SitemapEntry, type StockAlertResponse, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreCapabilities, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type StoreTracking, type StorefrontSavedPaymentMethod, type SubmitProductReviewInput, type SubscribeMarketingInput, type SubscribeMarketingResponse, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxClass, type TaxEstimateResponse, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type TrackingEventItem, type TrackingEventName, type TrackingEventPayload, type TranslatableEntityType, type TranslationStatusEntry, type TranslationsMap, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateNewsletterBenefitSettingsInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateRegionDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxClassDto, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsellSettings, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, buildArticleJsonLd, buildBreadcrumbJsonLd, buildCollectionPageJsonLd, buildOrganizationJsonLd, buildProductFaqJsonLd, buildProductJsonLd, buildWebsiteJsonLd, computeAvailableSlots, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getBlogSitemapEntries, getBusinessHoursForDate, getCartItemImage, getCartItemName, getCartTotals, getCategorySitemapEntries, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSitemapEntries, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCalendarDateAllowed, isCouponApplicableToProduct, isDateValueAllowed, isHtmlDescription, isWebhookEventType, jsonLdScriptProps, parseDateFieldValue, parseWebhookEvent, resolveRelativeBounds, resolveRenderType, resolveStoreLocalParts, safePaymentRedirect, stripHtml, validateDateAvailabilityConfig, verifyWebhook };
|
package/dist/index.d.ts
CHANGED
|
@@ -5030,9 +5030,38 @@ interface PublishProductResponse {
|
|
|
5030
5030
|
* Returned by the backend in provider config and payment intents.
|
|
5031
5031
|
* The frontend dynamically loads the SDK script and calls init/render methods.
|
|
5032
5032
|
*/
|
|
5033
|
+
/**
|
|
5034
|
+
* Every way a provider can present its payment surface. `PaymentClientSdk.renderType`
|
|
5035
|
+
* is one of these; `PaymentClientSdk.displayModes` lists the ones the provider
|
|
5036
|
+
* can serve.
|
|
5037
|
+
*/
|
|
5038
|
+
type PaymentRenderType = 'sdk-widget' | 'iframe' | 'redirect' | 'sandbox' | 'embedded-fields';
|
|
5039
|
+
/**
|
|
5040
|
+
* The render modes a storefront may ASK for via
|
|
5041
|
+
* `createPaymentIntent(id, { preferredRenderType })`. Deliberately only the
|
|
5042
|
+
* two presentation choices: `sdk-widget`, `embedded-fields` and `sandbox` are
|
|
5043
|
+
* integration mechanisms a storefront cannot substitute at will.
|
|
5044
|
+
*/
|
|
5045
|
+
type PreferredRenderType = 'redirect' | 'iframe';
|
|
5046
|
+
/**
|
|
5047
|
+
* Why the `clientSdk.renderType` on a `PaymentIntent` is what it is.
|
|
5048
|
+
*
|
|
5049
|
+
* - `'preferred'` — you asked for a mode and the provider supports it.
|
|
5050
|
+
* - `'fallback'` — you asked for a mode the provider does not declare;
|
|
5051
|
+
* you got the provider's default instead.
|
|
5052
|
+
* - `'provider-default'` — you did not ask (or the intent is a sandbox one).
|
|
5053
|
+
*/
|
|
5054
|
+
type RenderModeResolution = 'preferred' | 'fallback' | 'provider-default';
|
|
5033
5055
|
interface PaymentClientSdk {
|
|
5034
5056
|
/** How the payment UI is rendered: 'sdk-widget' (JS SDK), 'iframe', 'redirect', 'sandbox' (test orders), or 'embedded-fields' (PCI-compliant provider-hosted fields embedded in merchant DOM, e.g. Cardcom OpenFields, Stripe Elements) */
|
|
5035
|
-
renderType:
|
|
5057
|
+
renderType: PaymentRenderType;
|
|
5058
|
+
/**
|
|
5059
|
+
* Every render mode this provider can serve. `renderType` is the default;
|
|
5060
|
+
* `preferredRenderType` on `createPaymentIntent` is honoured only if it is in
|
|
5061
|
+
* this list. Absent on legacy manifests — treat as `[renderType]`, which is
|
|
5062
|
+
* exactly what `resolveRenderType()` does.
|
|
5063
|
+
*/
|
|
5064
|
+
displayModes?: PaymentRenderType[];
|
|
5036
5065
|
/** URL of the main SDK script to load */
|
|
5037
5066
|
scriptUrl?: string;
|
|
5038
5067
|
/** Name of the global variable set by the SDK script (e.g., 'growPayment') */
|
|
@@ -5202,6 +5231,14 @@ interface PaymentIntent {
|
|
|
5202
5231
|
provider?: string;
|
|
5203
5232
|
/** Runtime client SDK overrides (merged with provider manifest config) */
|
|
5204
5233
|
clientSdk?: PaymentClientSdk;
|
|
5234
|
+
/**
|
|
5235
|
+
* Why the returned `clientSdk.renderType` is what it is — see
|
|
5236
|
+
* `RenderModeResolution`. Lets a storefront that asked for `iframe` and got
|
|
5237
|
+
* `redirect` tell "the provider does not support iframe" (`'fallback'`) from
|
|
5238
|
+
* "I never asked" (`'provider-default'`). Absent from older backends; always
|
|
5239
|
+
* branch on the `renderType` you got back, never on what you asked for.
|
|
5240
|
+
*/
|
|
5241
|
+
renderModeResolution?: RenderModeResolution;
|
|
5205
5242
|
}
|
|
5206
5243
|
/**
|
|
5207
5244
|
* The stored payment-record vocabulary. **UPPERCASE.**
|
|
@@ -8182,8 +8219,20 @@ interface TrackEventPayload {
|
|
|
8182
8219
|
/** Active dwell time in ms. Only meaningful for `eventType: 'engagement'`. Max 1 800 000 (30 min). */
|
|
8183
8220
|
engagedMs?: number;
|
|
8184
8221
|
}
|
|
8222
|
+
/**
|
|
8223
|
+
* The JSON body of any non-2xx response. `BrainerceError.details` holds a value
|
|
8224
|
+
* of this shape (the raw parsed body), so from a caught SDK error the code is
|
|
8225
|
+
* at `err.details.code`, one level deeper than it sits on the wire.
|
|
8226
|
+
*/
|
|
8185
8227
|
interface BrainerceApiError {
|
|
8186
8228
|
statusCode: number;
|
|
8229
|
+
/**
|
|
8230
|
+
* The stable, machine-readable error code — switch on THIS, never on
|
|
8231
|
+
* `message`, whose wording can change at any time. Always present: the API
|
|
8232
|
+
* derives a generic code from the status when a route supplies none.
|
|
8233
|
+
* The full list is at https://brainerce.com/docs/api/errors.
|
|
8234
|
+
*/
|
|
8235
|
+
code?: string;
|
|
8187
8236
|
message: string;
|
|
8188
8237
|
error?: string;
|
|
8189
8238
|
details?: unknown;
|
|
@@ -12145,6 +12194,25 @@ declare class BrainerceClient {
|
|
|
12145
12194
|
* subscription features.
|
|
12146
12195
|
*/
|
|
12147
12196
|
saveCard?: boolean;
|
|
12197
|
+
/**
|
|
12198
|
+
* How you would like the provider's payment surface presented. The
|
|
12199
|
+
* platform honours it when the provider supports that mode (it is
|
|
12200
|
+
* listed in the provider's `clientSdk.displayModes`), and otherwise
|
|
12201
|
+
* falls back to the provider's default — so always branch on the
|
|
12202
|
+
* `clientSdk.renderType` you get BACK, never on what you asked for.
|
|
12203
|
+
* The response's `renderModeResolution` says which happened. Omit to
|
|
12204
|
+
* take the provider's default.
|
|
12205
|
+
*
|
|
12206
|
+
* To pick the matching `successUrl` up front, call
|
|
12207
|
+
* `resolveRenderType(provider.clientSdk, preferred)` on the entry from
|
|
12208
|
+
* `getPaymentProviders()` — it applies the same rule the platform does.
|
|
12209
|
+
* An iframe intent returns the shopper INSIDE the frame, so its
|
|
12210
|
+
* `successUrl` must be a same-origin page that posts to the parent; a
|
|
12211
|
+
* redirect intent can return straight to the confirmation page.
|
|
12212
|
+
*
|
|
12213
|
+
* A value outside `'redirect' | 'iframe'` is rejected with 400.
|
|
12214
|
+
*/
|
|
12215
|
+
preferredRenderType?: PreferredRenderType;
|
|
12148
12216
|
}): Promise<PaymentIntent>;
|
|
12149
12217
|
/**
|
|
12150
12218
|
* Get payment status for a checkout.
|
|
@@ -14303,7 +14371,7 @@ declare class BrainerceError extends Error {
|
|
|
14303
14371
|
constructor(message: string, statusCode: number, details?: unknown);
|
|
14304
14372
|
}
|
|
14305
14373
|
|
|
14306
|
-
declare const SDK_VERSION = "2.
|
|
14374
|
+
declare const SDK_VERSION = "2.9.0";
|
|
14307
14375
|
|
|
14308
14376
|
/**
|
|
14309
14377
|
* Verify a webhook signature from Brainerce
|
|
@@ -14406,6 +14474,40 @@ declare function isAllowedPaymentUrl(url: string, options?: PaymentUrlOptions):
|
|
|
14406
14474
|
*/
|
|
14407
14475
|
declare function safePaymentRedirect(url: string, options?: PaymentUrlOptions): void;
|
|
14408
14476
|
|
|
14477
|
+
/**
|
|
14478
|
+
* Predict the `clientSdk.renderType` the platform will return for a given
|
|
14479
|
+
* provider and preference.
|
|
14480
|
+
*
|
|
14481
|
+
* Rules (identical to the platform's):
|
|
14482
|
+
* 1. No preference → the provider default.
|
|
14483
|
+
* 2. Preference declared in `displayModes` → the preference.
|
|
14484
|
+
* 3. Preference NOT declared → the provider default (the platform reports
|
|
14485
|
+
* `renderModeResolution: 'fallback'` on the intent).
|
|
14486
|
+
* 4. `displayModes` absent (legacy manifest) → treated as `[renderType]`.
|
|
14487
|
+
*
|
|
14488
|
+
* @param sdk - The `clientSdk` of an entry from `getPaymentProviders()`
|
|
14489
|
+
* (`defaultProvider.clientSdk` or `providers[i].clientSdk`).
|
|
14490
|
+
* @param preferred - The mode you intend to pass as `preferredRenderType`.
|
|
14491
|
+
* @returns The mode the intent will come back with. `'redirect'` when there is
|
|
14492
|
+
* no provider at all, so a storefront can always pick a return URL.
|
|
14493
|
+
*
|
|
14494
|
+
* @example
|
|
14495
|
+
* ```typescript
|
|
14496
|
+
* const { defaultProvider } = await client.getPaymentProviders();
|
|
14497
|
+
* const expected = resolveRenderType(defaultProvider?.clientSdk, 'iframe');
|
|
14498
|
+
* const successUrl = expected === 'iframe'
|
|
14499
|
+
* ? `${origin}/payment-complete?checkout_id=${checkoutId}`
|
|
14500
|
+
* : `${origin}/order-confirmation?checkout_id=${checkoutId}`;
|
|
14501
|
+
* const intent = await client.createPaymentIntent(checkoutId, {
|
|
14502
|
+
* preferredRenderType: 'iframe',
|
|
14503
|
+
* successUrl,
|
|
14504
|
+
* });
|
|
14505
|
+
* // Still branch on what came BACK — never on what you asked for.
|
|
14506
|
+
* if (intent.clientSdk?.renderType === 'iframe') { ... }
|
|
14507
|
+
* ```
|
|
14508
|
+
*/
|
|
14509
|
+
declare function resolveRenderType(sdk: Pick<PaymentClientSdk, 'renderType' | 'displayModes'> | null | undefined, preferred?: PreferredRenderType): PaymentRenderType;
|
|
14510
|
+
|
|
14409
14511
|
interface FormatProductPriceOptions {
|
|
14410
14512
|
/**
|
|
14411
14513
|
* BCP-47 locale for `Intl.NumberFormat`. Controls number grouping and
|
|
@@ -14804,4 +14906,4 @@ interface CategorySitemapOptions {
|
|
|
14804
14906
|
*/
|
|
14805
14907
|
declare function getCategorySitemapEntries(client: BrainerceClient, opts: CategorySitemapOptions): Promise<SitemapEntry[]>;
|
|
14806
14908
|
|
|
14807
|
-
export { type AddToCartDto, type AddressDetailsResult, type AddressSuggestion, type AiTranslateBulkInput, type AiTranslateBulkResult, type AiTranslateSingleInput, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AssignTaxClassDto, type AttachModifierGroupInput, type Attribute, type AttributeDisplayType, type AttributeOption, type AttributeSource, type AutoRegionResponse, type AvailabilityClock, type BlogPost, type BlogPostListParams, type BlogPostListResponse, type BlogSitemapOptions, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkCreateProductsDto, type BulkCreateProductsError, type BulkCreateProductsJob, type BulkCreateProductsStatus, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type BusinessHoursWindow, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundleOfferOfferedProduct, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartItemUnavailableReason, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryDetail, type CategoryNode, type CategorySitemapOptions, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CheckoutTender, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateContentInput, type CreateCouponDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateRegionDto, type CreateReturnLabelDto as CreateReturnLabelInput, type CreateReturnLabelResponse, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateStockAlertInput, type CreateTagDto as CreateTagInput, type CreateTaxClassDto, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type CustomizationFieldOption, type DateAvailabilityConstraints, type DateAvailabilitySurface, type DateFieldParseResult, type DeleteProductResponse, type DeliveryType, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GiftCardAdmin, type GiftCardAdminDetail, type GiftCardBalance, type GiftCardLiability, type GiftCardTransaction, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type I18nSettings, type IdempotentRequestOptions, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type IssueGiftCardAdminDto, type IssuedGiftCardAdmin, type JsonLdOptions, type ListModifierGroupsParams, type ListNewsletterBenefitGrantsParams, type LocalCart, type LocalCartItem, type LocaleTranslation, type LockedVariant, type LoyaltyBadge, type LoyaltyMembershipPlan, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyRewardRecommendation, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldFilter, type MetafieldFilterValue, type MetafieldFiltersResponse, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type ModifierValidationFailedError, type MyProductReview, type NestedModifierSelection, type NewsletterBenefitDiscountKind, type NewsletterBenefitGrant, type NewsletterBenefitGrantState, type NewsletterBenefitSettings, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthErrorCode, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomFieldDefinition, type OrderCustomFieldValues, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaidMembershipInfo, type ParsedDateFieldValue, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentRecordStatus, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type PriceDriftError, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductInventoryResponse, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductReviewImage, type ProductReviewImageAdmin, type ProductSitemapOptions, type ProductStatus, type ProductSuggestion, type ProductUnavailableError, type ProductVariant, type PublicMetafieldDefinition, type PublicNewsletterBenefitOffer, type PublicRegion, type PublicRegionDetail, type PublicRegionPaymentProvider, type PublicTaxClass, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type Region, type RegionPaymentProvider, type RegisterCustomerDto, type ReissuedGiftCardAdmin, type RelativeDateBounds, type ResendNewsletterBenefitResult, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type ReturnLabelParcel, type ReviewPhotoUpload, type ReviewStatus, type RichTextContent, SDK_VERSION, type SavedPaymentMethodSummary, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type SetTranslationFields, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingSummaryEntry, type ShippingZone, type ShippingZoneQueryParams, type SitemapEntry, type StockAlertResponse, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreCapabilities, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type StoreTracking, type StorefrontSavedPaymentMethod, type SubmitProductReviewInput, type SubscribeMarketingInput, type SubscribeMarketingResponse, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxClass, type TaxEstimateResponse, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type TrackingEventItem, type TrackingEventName, type TrackingEventPayload, type TranslatableEntityType, type TranslationStatusEntry, type TranslationsMap, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateNewsletterBenefitSettingsInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateRegionDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxClassDto, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsellSettings, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, buildArticleJsonLd, buildBreadcrumbJsonLd, buildCollectionPageJsonLd, buildOrganizationJsonLd, buildProductFaqJsonLd, buildProductJsonLd, buildWebsiteJsonLd, computeAvailableSlots, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getBlogSitemapEntries, getBusinessHoursForDate, getCartItemImage, getCartItemName, getCartTotals, getCategorySitemapEntries, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSitemapEntries, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCalendarDateAllowed, isCouponApplicableToProduct, isDateValueAllowed, isHtmlDescription, isWebhookEventType, jsonLdScriptProps, parseDateFieldValue, parseWebhookEvent, resolveRelativeBounds, resolveStoreLocalParts, safePaymentRedirect, stripHtml, validateDateAvailabilityConfig, verifyWebhook };
|
|
14909
|
+
export { type AddToCartDto, type AddressDetailsResult, type AddressSuggestion, type AiTranslateBulkInput, type AiTranslateBulkResult, type AiTranslateSingleInput, type AnnouncementContent, type AnnouncementSeverity, type AppliedDiscount, type ApplyCouponDto, type AssignTaxClassDto, type AttachModifierGroupInput, type Attribute, type AttributeDisplayType, type AttributeOption, type AttributeSource, type AutoRegionResponse, type AvailabilityClock, type BlogPost, type BlogPostListParams, type BlogPostListResponse, type BlogSitemapOptions, type BrainerceApiError, BrainerceClient, type BrainerceClientOptions, BrainerceError, type Brand, type BulkCreateProductsDto, type BulkCreateProductsError, type BulkCreateProductsJob, type BulkCreateProductsStatus, type BulkInventoryResponse, type BulkSaveVariantsDto, type BulkSaveVariantsResponse, type BulkVariantInput, type BusinessHoursWindow, type Cart, type CartAppliedDiscount, type CartBundleOffer, type CartBundleOfferOfferedProduct, type CartBundlesResponse, type CartIncludeOption, type CartIncludeOptions, type CartItem, type CartItemModifierLine, type CartItemUnavailableReason, type CartNudge, type CartRecommendationsResponse, type CartStatus, type CartUpgradeSuggestion, type CartUpgradesResponse, type CartWithIncludes, type Category, type CategoryDetail, type CategoryNode, type CategorySitemapOptions, type CategorySuggestion, type Checkout, type CheckoutAddress, type CheckoutBumpsResponse, type CheckoutCustomFieldDefinition, type CheckoutFieldPricing, type CheckoutFieldVisibility, type CheckoutLineItem, type CheckoutPrefillData, type CheckoutStatus, type CheckoutTender, type CompleteCheckoutResponse, type CompleteDraftDto, type ConfigureOAuthProviderDto as ConfigureOAuthProviderInput, type ConflictStatus, type ConnectorPlatform, type ContactFormFieldType, type ContactFormFieldValidation, type ContactFormPublic, type ContactFormPublicField, type ContactFormSummary, type Content, type ContentDataMap, type ContentStatus, type ContentSummary, type ContentType, type Coupon, type CouponCreateResponse, type CouponQueryParams, type CouponStatus, type CouponType, type CouponValidationWarning, type CreateAddressDto, type CreateAttributeDto as CreateAttributeInput, type CreateAttributeOptionDto as CreateAttributeOptionInput, type CreateBrandDto as CreateBrandInput, type CreateCategoryDto as CreateCategoryInput, type CreateCheckoutDto, type CreateContentInput, type CreateCouponDto, type CreateCustomerDto, type CreateEmailTemplateDto as CreateEmailTemplateInput, type CreateGuestOrderDto, type CreateInquiryInput, type CreateInquiryResponse, type CreateMetafieldDefinitionDto as CreateMetafieldDefinitionInput, type CreateModifierGroupInput, type CreateModifierInput, type CreateOrderDto, type CreateProductDto, type CreateRefundDto, type CreateRegionDto, type CreateReturnLabelDto as CreateReturnLabelInput, type CreateReturnLabelResponse, type CreateShippingRateDto as CreateShippingRateInput, type CreateShippingZoneDto as CreateShippingZoneInput, type CreateStockAlertInput, type CreateTagDto as CreateTagInput, type CreateTaxClassDto, type CreateTaxRateDto as CreateTaxRateInput, type CreateVariantDto, type Customer, type CustomerAddress, type CustomerAuthResponse, type CustomerOAuthProvider, type CustomerProfile, type CustomerQueryParams, type CustomizationFieldOption, type DateAvailabilityConstraints, type DateAvailabilitySurface, type DateFieldParseResult, type DeleteProductResponse, type DeliveryType, type DiscountBanner, type DiscountRuleType, type DownloadFile, type DraftLineItem, type EditInventoryDto, type EmailDomain, type EmailEventSettings, type EmailEventType, type EmailSettings, type EmailTemplate, type EmailTemplatePreview, type EmailTemplatesResponse, type EmailVerificationResponse, type ExtendReservationResponse, type FaqContent, type FaqItem, type FooterColumn, type FooterContent, type FooterLink, type FooterSocialLink, type FormatPriceOptions, type FormatProductPriceOptions, type FreeAllocationPolicy, type FulfillOrderDto, type GiftCardAdmin, type GiftCardAdminDetail, type GiftCardBalance, type GiftCardLiability, type GiftCardTransaction, type GuestCheckoutStartResponse, type GuestOrderResponse, type HeaderContent, type HeaderCta, type HeaderLogo, type HeaderNavItem, type I18nSettings, type IdempotentRequestOptions, type InsufficientStockError, type InventoryInfo, type InventoryReservationStrategy, type InventorySyncStatus, type InventoryTrackingMode, type InvitationStatus, type InviteMemberDto as InviteMemberInput, type InviteStoreMemberDto as InviteStoreMemberInput, type IssueGiftCardAdminDto, type IssuedGiftCardAdmin, type JsonLdOptions, type ListModifierGroupsParams, type ListNewsletterBenefitGrantsParams, type LocalCart, type LocalCartItem, type LocaleTranslation, type LockedVariant, type LoyaltyBadge, type LoyaltyMembershipPlan, type LoyaltyNextTierSummary, type LoyaltyReward, type LoyaltyRewardRecommendation, type LoyaltyStatus, type LoyaltyTierSummary, type MergeCartsDto, type MetafieldConflict, type MetafieldConflictResolution, type MetafieldDefinition, type MetafieldFilter, type MetafieldFilterValue, type MetafieldFiltersResponse, type MetafieldType, type Modifier, type ModifierGroup, type ModifierSelection, type ModifierSelectionType, type ModifierValidationCode, type ModifierValidationError, type ModifierValidationFailedError, type MyProductReview, type NestedModifierSelection, type NewsletterBenefitDiscountKind, type NewsletterBenefitGrant, type NewsletterBenefitGrantState, type NewsletterBenefitSettings, type OAuthAuthorizeResponse, type OAuthCallbackResponse, type OAuthConnection, type OAuthConnectionsResponse, type OAuthErrorCode, type OAuthProviderConfig, type OAuthProviderType, type OAuthProvidersResponse, type Order, type OrderAddress, type OrderBump, type OrderCustomFieldDefinition, type OrderCustomFieldValues, type OrderCustomer, type OrderDownloadLink, type OrderItem, type OrderQueryParams, type OrderStatus, type OrderStatusChange, type PageContent, type PageSeo, type PaginatedResponse, type PaidMembershipInfo, type ParsedDateFieldValue, type PaymentClientSdk, type PaymentConfig, type PaymentIntent, type PaymentProvider, type PaymentProviderConfig, type PaymentProvidersConfig, type PaymentRecordStatus, type PaymentRenderType, type PaymentStatus, type PaymentUrlOptions, type PickupLocation, type PlatformCouponCapabilities, type PlatformMetafieldMetadata, type PreferredRenderType, type PreviewEmailTemplateDto as PreviewEmailTemplateInput, type PriceDriftError, type Product, type ProductAttributeInput, type ProductAvailability, type ProductCustomizationField, type ProductDiscount, type ProductDiscountBadge, type ProductImage, type ProductInventoryResponse, type ProductMetafield, type ProductMetafieldValue, type ProductModifierGroupAttachment, type ProductQueryParams, type ProductRecommendation, type ProductRecommendationsResponse, type ProductRelationType, type ProductReview, type ProductReviewAdmin, type ProductReviewImage, type ProductReviewImageAdmin, type ProductSitemapOptions, type ProductStatus, type ProductSuggestion, type ProductUnavailableError, type ProductVariant, type PublicMetafieldDefinition, type PublicNewsletterBenefitOffer, type PublicRegion, type PublicRegionDetail, type PublicRegionPaymentProvider, type PublicTaxClass, type PublishProductResponse, RTL_LOCALES, type RecommendationVariant, type ReconcileInventoryResponse, type RedeemRewardResult, type ReferralInfo, type Refund, type RefundLineItem, type RefundLineItemResponse, type RefundType, type Region, type RegionPaymentProvider, type RegisterCustomerDto, type ReissuedGiftCardAdmin, type RelativeDateBounds, type RenderModeResolution, type ResendNewsletterBenefitResult, type ReservationInfo, type ResolveMetafieldConflictDto as ResolveMetafieldConflictInput, type ResolveSyncConflictDto as ResolveSyncConflictInput, type ReturnLabelParcel, type ReviewPhotoUpload, type ReviewStatus, type RichTextContent, SDK_VERSION, type SavedPaymentMethodSummary, type SearchSuggestions, type SelectPickupLocationDto, type SelectShippingMethodDto, type SendInvoiceDto, type SessionCartRef, type SetBillingAddressDto, type SetCheckoutCustomFieldsDto, type SetCheckoutCustomerDto, type SetDefinitionProductsDto as SetDefinitionProductsInput, type SetMetafieldPlatformsDto as SetMetafieldPlatformsInput, type SetShippingAddressDto, type SetShippingAddressResponse, type SetTranslationFields, type ShippingDestinations, type ShippingLine, type ShippingRate, type ShippingRateConfig, type ShippingRateType, type ShippingSummaryEntry, type ShippingZone, type ShippingZoneQueryParams, type SitemapEntry, type StockAlertResponse, type StockAvailabilityRequest, type StockAvailabilityResponse, type StockAvailabilityResult, type StoreCapabilities, type StoreInfo, type StoreInvitation, type StoreInvitationDetails, type StoreMember, type StorePermission, type StoreRole, type StoreTeamResponse, type StoreTracking, type StorefrontSavedPaymentMethod, type SubmitProductReviewInput, type SubscribeMarketingInput, type SubscribeMarketingResponse, type SupportedLocaleObject, type SyncConflict, type SyncConflictResolution, type SyncJob, type Tag, type TaxBreakdown, type TaxBreakdownItem, type TaxClass, type TaxEstimateResponse, type TaxRate, type TaxonomyQueryParams, type TeamInvitation, type TeamInvitationsResponse, type TeamMember, type TeamMembersResponse, type TeamRole, type TrackingEventItem, type TrackingEventName, type TrackingEventPayload, type TranslatableEntityType, type TranslationStatusEntry, type TranslationsMap, type UpdateAddressDto, type UpdateAttachmentInput, type UpdateAttributeDto as UpdateAttributeInput, type UpdateAttributeOptionDto as UpdateAttributeOptionInput, type UpdateBrandDto as UpdateBrandInput, type UpdateCartItemDto, type UpdateCategoryDto as UpdateCategoryInput, type UpdateContentInput, type UpdateCouponDto, type UpdateCustomerDto, type UpdateDraftDto, type UpdateEmailSettingsDto as UpdateEmailSettingsInput, type UpdateEmailTemplateDto as UpdateEmailTemplateInput, type UpdateInventoryDto, type UpdateMemberRoleDto as UpdateMemberRoleInput, type UpdateMetafieldDefinitionDto as UpdateMetafieldDefinitionInput, type UpdateModifierGroupInput, type UpdateModifierInput, type UpdateNewsletterBenefitSettingsInput, type UpdateOAuthProviderDto as UpdateOAuthProviderInput, type UpdateOrderDto, type UpdateOrderShippingDto, type UpdateProductDto, type UpdateRegionDto, type UpdateShippingRateDto as UpdateShippingRateInput, type UpdateShippingZoneDto as UpdateShippingZoneInput, type UpdateStoreMemberDto as UpdateStoreMemberInput, type UpdateTagDto as UpdateTagInput, type UpdateTaxClassDto, type UpdateTaxRateDto as UpdateTaxRateInput, type UpdateVariantDto, type UpdateVariantInventoryDto, type UpsellSettings, type UpsertProductMetafieldDto as UpsertProductMetafieldInput, type UserStore, type UserStorePermissions, type VariantInventoryResponse, type VariantPlatformOverlay, type VariantStatus, type WaitForOrderOptions, type WaitForOrderResult, type WebhookEvent, type WebhookEventType, type WriteProductReviewInput, buildArticleJsonLd, buildBreadcrumbJsonLd, buildCollectionPageJsonLd, buildOrganizationJsonLd, buildProductFaqJsonLd, buildProductJsonLd, buildWebsiteJsonLd, computeAvailableSlots, createWebhookHandler, deriveSeoDescription, enableDevGuards, formatMoney, formatPrice, formatProductPrice, formatVariantPrice, getBlogSitemapEntries, getBusinessHoursForDate, getCartItemImage, getCartItemName, getCartTotals, getCategorySitemapEntries, getDescriptionContent, getDirectionForLocale, formatPrice as getPriceDisplay, getProductCustomizationFields, getProductMetafield, getProductMetafieldValue, getProductMetafieldsByType, getProductPrice, getProductPriceInfo, getProductSitemapEntries, getProductSwatches, getStockStatus, getVariantOptions, getVariantPrice, isAllowedPaymentUrl, isCalendarDateAllowed, isCouponApplicableToProduct, isDateValueAllowed, isHtmlDescription, isWebhookEventType, jsonLdScriptProps, parseDateFieldValue, parseWebhookEvent, resolveRelativeBounds, resolveRenderType, resolveStoreLocalParts, safePaymentRedirect, stripHtml, validateDateAvailabilityConfig, verifyWebhook };
|
package/dist/index.js
CHANGED
|
@@ -79,6 +79,7 @@ __export(index_exports, {
|
|
|
79
79
|
parseDateFieldValue: () => parseDateFieldValue,
|
|
80
80
|
parseWebhookEvent: () => parseWebhookEvent,
|
|
81
81
|
resolveRelativeBounds: () => resolveRelativeBounds,
|
|
82
|
+
resolveRenderType: () => resolveRenderType,
|
|
82
83
|
resolveStoreLocalParts: () => resolveStoreLocalParts,
|
|
83
84
|
safePaymentRedirect: () => safePaymentRedirect,
|
|
84
85
|
stripHtml: () => stripHtml2,
|
|
@@ -204,7 +205,7 @@ function isDevGuardsEnabled() {
|
|
|
204
205
|
}
|
|
205
206
|
|
|
206
207
|
// src/version.ts
|
|
207
|
-
var SDK_VERSION = "2.
|
|
208
|
+
var SDK_VERSION = "2.9.0";
|
|
208
209
|
|
|
209
210
|
// src/client.ts
|
|
210
211
|
var DEFAULT_BASE_URL = "https://api.brainerce.com";
|
|
@@ -11378,6 +11379,13 @@ function safePaymentRedirect(url, options) {
|
|
|
11378
11379
|
}
|
|
11379
11380
|
}
|
|
11380
11381
|
|
|
11382
|
+
// src/render-mode.ts
|
|
11383
|
+
function resolveRenderType(sdk, preferred) {
|
|
11384
|
+
if (!sdk) return "redirect";
|
|
11385
|
+
const declared = sdk.displayModes?.length ? sdk.displayModes : [sdk.renderType];
|
|
11386
|
+
return preferred && declared.includes(preferred) ? preferred : sdk.renderType;
|
|
11387
|
+
}
|
|
11388
|
+
|
|
11381
11389
|
// src/format-price.ts
|
|
11382
11390
|
var DEFAULT_LOCALE = "en";
|
|
11383
11391
|
function formatProductPrice(product, options = {}) {
|
|
@@ -12420,6 +12428,7 @@ function isCouponApplicableToProduct(coupon, productId) {
|
|
|
12420
12428
|
parseDateFieldValue,
|
|
12421
12429
|
parseWebhookEvent,
|
|
12422
12430
|
resolveRelativeBounds,
|
|
12431
|
+
resolveRenderType,
|
|
12423
12432
|
resolveStoreLocalParts,
|
|
12424
12433
|
safePaymentRedirect,
|
|
12425
12434
|
stripHtml,
|
package/dist/index.mjs
CHANGED
|
@@ -115,7 +115,7 @@ function isDevGuardsEnabled() {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
// src/version.ts
|
|
118
|
-
var SDK_VERSION = "2.
|
|
118
|
+
var SDK_VERSION = "2.9.0";
|
|
119
119
|
|
|
120
120
|
// src/client.ts
|
|
121
121
|
var DEFAULT_BASE_URL = "https://api.brainerce.com";
|
|
@@ -11289,6 +11289,13 @@ function safePaymentRedirect(url, options) {
|
|
|
11289
11289
|
}
|
|
11290
11290
|
}
|
|
11291
11291
|
|
|
11292
|
+
// src/render-mode.ts
|
|
11293
|
+
function resolveRenderType(sdk, preferred) {
|
|
11294
|
+
if (!sdk) return "redirect";
|
|
11295
|
+
const declared = sdk.displayModes?.length ? sdk.displayModes : [sdk.renderType];
|
|
11296
|
+
return preferred && declared.includes(preferred) ? preferred : sdk.renderType;
|
|
11297
|
+
}
|
|
11298
|
+
|
|
11292
11299
|
// src/format-price.ts
|
|
11293
11300
|
var DEFAULT_LOCALE = "en";
|
|
11294
11301
|
function formatProductPrice(product, options = {}) {
|
|
@@ -12330,6 +12337,7 @@ export {
|
|
|
12330
12337
|
parseDateFieldValue,
|
|
12331
12338
|
parseWebhookEvent,
|
|
12332
12339
|
resolveRelativeBounds,
|
|
12340
|
+
resolveRenderType,
|
|
12333
12341
|
resolveStoreLocalParts,
|
|
12334
12342
|
safePaymentRedirect,
|
|
12335
12343
|
stripHtml2 as stripHtml,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brainerce",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "Official SDK for building e-commerce storefronts with Brainerce Platform. Perfect for vibe-coded sites, AI-built stores (Cursor, Lovable, v0), and custom storefronts.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|