@moonbase.sh/storefront 2.6.0 → 2.8.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 +20 -0
- package/dist/moonbase.d.ts +40 -0
- package/dist/moonbase.js +7241 -7192
- package/dist/moonbase.umd.cjs +16 -16
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -99,6 +99,10 @@ Moonbase.configure({
|
|
|
99
99
|
cart: {
|
|
100
100
|
quantity: 'single',
|
|
101
101
|
},
|
|
102
|
+
pricing: {
|
|
103
|
+
trailingZeros: 'always',
|
|
104
|
+
currencyDisplay: 'code',
|
|
105
|
+
},
|
|
102
106
|
theme: {
|
|
103
107
|
colors: {
|
|
104
108
|
primary: '#E5A000',
|
|
@@ -112,6 +116,22 @@ Moonbase.configure({
|
|
|
112
116
|
})
|
|
113
117
|
```
|
|
114
118
|
|
|
119
|
+
`pricing.trailingZeros` controls how whole prices render. The default `'auto'`
|
|
120
|
+
drops the decimals — a $10.00 product shows as `$10`. Set it to `'always'` to keep
|
|
121
|
+
the currency's own fraction digits instead (`$10.00`, and still `¥1000` for
|
|
122
|
+
zero-decimal currencies like JPY). It applies to the widget's own UI and to
|
|
123
|
+
`data-moonbase-render` price elements on your page alike.
|
|
124
|
+
|
|
125
|
+
`pricing.currencyDisplay` picks which marker identifies the currency. Taking $10 in
|
|
126
|
+
USD read from a British locale, the default `'narrowSymbol'` renders the shortest
|
|
127
|
+
symbol (`$10`), `'symbol'` the locale's usual one (`US$10`), `'code'` the ISO 4217
|
|
128
|
+
code (`USD 10`), and `'name'` spells it out in the visitor's language
|
|
129
|
+
(`10 US dollars`). The symbol and its placement still follow the visitor's own
|
|
130
|
+
locale — this only chooses between the four forms.
|
|
131
|
+
|
|
132
|
+
Both `pricing` options cover the widget's UI and your `data-moonbase-render` price
|
|
133
|
+
elements. The checkout itself is rendered by Moonbase and formats its own prices.
|
|
134
|
+
|
|
115
135
|
You can also control where the widget mounts by providing `target`.
|
|
116
136
|
|
|
117
137
|
## Events
|
package/dist/moonbase.d.ts
CHANGED
|
@@ -12,6 +12,15 @@ import { StorefrontProduct } from '@moonbase.sh/vue';
|
|
|
12
12
|
import { User } from '@moonbase.sh/vue';
|
|
13
13
|
import { Voucher } from '@moonbase.sh/vue';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Which marker identifies the currency, for `10` USD read in a British locale:
|
|
17
|
+
* - `'narrowSymbol'` (default) — the shortest symbol: `$10`.
|
|
18
|
+
* - `'symbol'` — the locale's usual symbol, disambiguated where it needs to be: `US$10`.
|
|
19
|
+
* - `'code'` — the ISO 4217 code: `USD 10`.
|
|
20
|
+
* - `'name'` — the currency spelled out in the visitor's language: `10 US dollars`.
|
|
21
|
+
*/
|
|
22
|
+
declare type CurrencyDisplay = 'narrowSymbol' | 'symbol' | 'code' | 'name';
|
|
23
|
+
|
|
15
24
|
declare type DeepPartial<T> = T extends object ? {
|
|
16
25
|
[P in keyof T]?: T[P] extends HTMLElement | undefined ? T[P] : DeepPartial<T[P]>;
|
|
17
26
|
} : T;
|
|
@@ -124,6 +133,7 @@ declare class MoonbaseImpl implements MoonbaseInstance {
|
|
|
124
133
|
private initialized;
|
|
125
134
|
private pinia;
|
|
126
135
|
private storefront;
|
|
136
|
+
private url;
|
|
127
137
|
private options;
|
|
128
138
|
private integrations;
|
|
129
139
|
private completedOrderIds;
|
|
@@ -281,6 +291,7 @@ export declare interface MoonbaseIntentArgs {
|
|
|
281
291
|
}[];
|
|
282
292
|
[MoonbaseIntent.Checkout]: {
|
|
283
293
|
complete?: boolean;
|
|
294
|
+
url?: string;
|
|
284
295
|
};
|
|
285
296
|
[MoonbaseIntent.CloseCheckout]: never;
|
|
286
297
|
[MoonbaseIntent.ViewAbout]: never;
|
|
@@ -351,6 +362,29 @@ export declare interface MoonbaseOptions {
|
|
|
351
362
|
buttons: 'outlined' | 'light';
|
|
352
363
|
cards: 'outlined' | 'shadow' | 'white';
|
|
353
364
|
};
|
|
365
|
+
pricing: {
|
|
366
|
+
/**
|
|
367
|
+
* How to render a price that lands on a whole number.
|
|
368
|
+
* - `'auto'` (default) drops the fraction entirely, so `10` renders `$10`.
|
|
369
|
+
* - `'always'` keeps the currency's own fraction digits, so `10` renders
|
|
370
|
+
* `$10.00` — and still `¥1000` for zero-decimal currencies like JPY.
|
|
371
|
+
*
|
|
372
|
+
* Prices that aren't whole are unaffected; they always show their decimals.
|
|
373
|
+
*/
|
|
374
|
+
trailingZeros: TrailingZeros;
|
|
375
|
+
/**
|
|
376
|
+
* Which marker identifies the currency. Taking `10` USD read in a British
|
|
377
|
+
* locale:
|
|
378
|
+
* - `'narrowSymbol'` (default) renders the shortest symbol, `$10`.
|
|
379
|
+
* - `'symbol'` renders the locale's usual symbol, `US$10`.
|
|
380
|
+
* - `'code'` renders the ISO 4217 code, `USD 10`.
|
|
381
|
+
* - `'name'` spells it out in the visitor's language, `10 US dollars`.
|
|
382
|
+
*
|
|
383
|
+
* The symbol and its placement always follow the visitor's own locale;
|
|
384
|
+
* this only picks which of the four forms to use.
|
|
385
|
+
*/
|
|
386
|
+
currencyDisplay: CurrencyDisplay;
|
|
387
|
+
};
|
|
354
388
|
target: HTMLElement | undefined;
|
|
355
389
|
/**
|
|
356
390
|
* When the host page declares a fixed-width mobile viewport (e.g. Wix's
|
|
@@ -375,6 +409,12 @@ export declare interface TikTokPixelConfig {
|
|
|
375
409
|
pixelId: string;
|
|
376
410
|
}
|
|
377
411
|
|
|
412
|
+
/**
|
|
413
|
+
* How a whole-number price renders: `'auto'` drops the fraction (`$10`),
|
|
414
|
+
* `'always'` keeps the currency's own fraction digits (`$10.00`, `¥1000`).
|
|
415
|
+
*/
|
|
416
|
+
declare type TrailingZeros = 'auto' | 'always';
|
|
417
|
+
|
|
378
418
|
export declare const urlKey: InjectionKey<string>;
|
|
379
419
|
|
|
380
420
|
export { }
|