@moonbase.sh/storefront 2.7.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 +38 -0
- package/dist/moonbase.js +7098 -7079
- 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;
|
|
@@ -353,6 +362,29 @@ export declare interface MoonbaseOptions {
|
|
|
353
362
|
buttons: 'outlined' | 'light';
|
|
354
363
|
cards: 'outlined' | 'shadow' | 'white';
|
|
355
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
|
+
};
|
|
356
388
|
target: HTMLElement | undefined;
|
|
357
389
|
/**
|
|
358
390
|
* When the host page declares a fixed-width mobile viewport (e.g. Wix's
|
|
@@ -377,6 +409,12 @@ export declare interface TikTokPixelConfig {
|
|
|
377
409
|
pixelId: string;
|
|
378
410
|
}
|
|
379
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
|
+
|
|
380
418
|
export declare const urlKey: InjectionKey<string>;
|
|
381
419
|
|
|
382
420
|
export { }
|