@moonbase.sh/storefront 3.15.0 → 3.16.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 +15 -0
- package/dist/moonbase.d.ts +10 -0
- package/dist/moonbase.js +783 -751
- package/dist/moonbase.umd.cjs +15 -15
- package/dist-loader/moonbase.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -706,6 +706,21 @@ const { payload } = await jwtVerify(token, jwks, {
|
|
|
706
706
|
|
|
707
707
|
Don't read the widget's `localStorage` entry yourself: it holds the refresh token as well, which must never leave the browser.
|
|
708
708
|
|
|
709
|
+
## Saving the customer's address
|
|
710
|
+
|
|
711
|
+
`Moonbase.updateAddress(address)` saves the signed-in customer's address and resolves to the customer as saved. Their next checkout starts from it; a checkout they have already entered billing details in keeps those. It rejects when nobody is signed in, and for an address the store can't use: it needs a known country, a street address, a city or a region, and in the US a postal code.
|
|
712
|
+
|
|
713
|
+
```ts
|
|
714
|
+
const user = await Moonbase.updateAddress({
|
|
715
|
+
countryCode: 'AU',
|
|
716
|
+
streetAddress1: '1 George Street',
|
|
717
|
+
streetAddress2: null,
|
|
718
|
+
locality: 'Sydney',
|
|
719
|
+
region: 'NSW',
|
|
720
|
+
postCode: '2000',
|
|
721
|
+
})
|
|
722
|
+
```
|
|
723
|
+
|
|
709
724
|
## Integrations
|
|
710
725
|
|
|
711
726
|
The widget can forward its commerce and auth events to common marketing/analytics SDKs without any extra glue code. Enable a provider by passing its config in `integrations`:
|
package/dist/moonbase.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ActivationRequestFulfillmentType } from '@moonbase.sh/vue';
|
|
2
|
+
import { Address } from '@moonbase.sh/vue';
|
|
2
3
|
import { CartItem } from '@moonbase.sh/vue';
|
|
3
4
|
import { CheckoutBackdropColor } from '@moonbase.sh/vue';
|
|
4
5
|
import { CheckoutBackdropOpacity } from '@moonbase.sh/vue';
|
|
@@ -288,6 +289,7 @@ declare class MoonbaseImpl implements MoonbaseInstance {
|
|
|
288
289
|
configure(options: DeepPartial<MoonbaseOptions>): void;
|
|
289
290
|
on<TEvent extends MoonbaseEvent>(eventType: TEvent, callback: (event: MoonbaseEventArgs[TEvent]) => void): void;
|
|
290
291
|
getAccessToken(): Promise<string | null>;
|
|
292
|
+
updateAddress(address: Address): Promise<User>;
|
|
291
293
|
private handleLocationIntent;
|
|
292
294
|
sign_in(parameters?: MoonbaseIntentArgs['sign_in']): void;
|
|
293
295
|
sign_up(parameters?: MoonbaseIntentArgs['sign_up']): void;
|
|
@@ -330,6 +332,14 @@ export declare type MoonbaseInstance = MoonbaseInstanceIntents & {
|
|
|
330
332
|
* account's public key, at `/api/key/jwks` on your Moonbase address.
|
|
331
333
|
*/
|
|
332
334
|
getAccessToken: () => Promise<string | null>;
|
|
335
|
+
/**
|
|
336
|
+
* Saves the signed-in customer's address, which their next checkout starts from, and
|
|
337
|
+
* resolves to the customer as saved. A checkout they have already entered billing details
|
|
338
|
+
* in keeps those. Rejects when nobody is signed in, and for an address the store can't
|
|
339
|
+
* use: it needs a known country, a street address, a city or a region, and in the US a
|
|
340
|
+
* postal code.
|
|
341
|
+
*/
|
|
342
|
+
updateAddress: (address: Address) => Promise<User>;
|
|
333
343
|
};
|
|
334
344
|
|
|
335
345
|
declare type MoonbaseInstanceIntents = {
|