@moonbase.sh/storefront 3.12.0 → 3.13.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 +24 -9
- package/dist/moonbase.d.ts +11 -0
- package/dist/moonbase.js +12915 -12281
- package/dist/moonbase.umd.cjs +17 -17
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -68,15 +68,18 @@ Hosts that ship a fixed-width legacy mobile viewport (for example Wix's classic
|
|
|
68
68
|
|
|
69
69
|
### Captchas
|
|
70
70
|
|
|
71
|
-
A merchant can ask customers to solve a captcha before they sign up
|
|
72
|
-
widget's sign-up
|
|
73
|
-
`https://<account-id>.moonbase.sh`. A site with a
|
|
74
|
-
address in `frame-src`, which it already needs for
|
|
75
|
-
captcha provider itself.
|
|
71
|
+
A merchant can ask customers to solve a captcha before they sign up or subscribe to the
|
|
72
|
+
newsletter. With that turned on, the widget's sign-up and subscribe forms show one, drawn in a
|
|
73
|
+
frame from the store's own `https://<account-id>.moonbase.sh`. A site with a
|
|
74
|
+
Content-Security-Policy only has to allow that address in `frame-src`, which it already needs for
|
|
75
|
+
the checkout overlay, and nothing for the captcha provider itself. A newsletter form of your own
|
|
76
|
+
cannot hold the frame, so the widget draws it in the drawer instead (see
|
|
77
|
+
[On a store that asks for a captcha](#on-a-store-that-asks-for-a-captcha)).
|
|
76
78
|
|
|
77
79
|
Widget versions from before captchas (3.7 and earlier) cannot show one, so while captchas are on,
|
|
78
|
-
signing up from a site pinned to one of those fails.
|
|
79
|
-
|
|
80
|
+
signing up from a site pinned to one of those fails. The same goes for newsletter sign-ups from a
|
|
81
|
+
site pinned to 3.12 or earlier, which predate the captcha on them. Checkout is unaffected by the
|
|
82
|
+
widget version: it runs in Moonbase's own checkout, which shows its own captcha.
|
|
80
83
|
|
|
81
84
|
## Trigger intents
|
|
82
85
|
|
|
@@ -426,10 +429,10 @@ closed, and the widget reports progress on the form itself for you to style:
|
|
|
426
429
|
|
|
427
430
|
| `data-moonbase-state` | When |
|
|
428
431
|
| --- | --- |
|
|
429
|
-
| `submitting` | The request is out. The form's submit buttons are disabled until it returns. |
|
|
432
|
+
| `submitting` | The request is out. The form's submit buttons are disabled until it returns, and on a store that asks for a captcha until the visitor has solved it. |
|
|
430
433
|
| `subscribed` | The visitor is on the list. |
|
|
431
434
|
| `confirmation_sent` | Double opt-in: a confirmation email went out, and the visitor is on the list once they click it. |
|
|
432
|
-
| `error` | The server turned the email down, or the
|
|
435
|
+
| `error` | The server turned the email down, the request failed, or the visitor closed the captcha unsolved. |
|
|
433
436
|
|
|
434
437
|
A `[data-moonbase-message]` element inside the form gets the outcome as text, worded as the
|
|
435
438
|
drawer words it, and is made a live region so screen readers announce it. Leave it out to show
|
|
@@ -452,6 +455,18 @@ who is subscribed already. With double opt-in on, nearly every sign-up ends in
|
|
|
452
455
|
`data-moonbase-state` is set in the default mode as well, so a spinner can cover the moment
|
|
453
456
|
before the drawer opens.
|
|
454
457
|
|
|
458
|
+
### On a store that asks for a captcha
|
|
459
|
+
|
|
460
|
+
With the captcha on, the store refuses a newsletter sign-up until the visitor has solved it, and
|
|
461
|
+
your form has no room for the challenge. So the drawer opens with the challenge alone, "Confirm
|
|
462
|
+
you're not a robot to finish subscribing", in either mode. It usually solves itself within a
|
|
463
|
+
second or two. Once it is solved, the widget sends the form again: the drawer then shows the
|
|
464
|
+
outcome, or with `data-moonbase-feedback="inline"` closes, and the outcome goes on your form as
|
|
465
|
+
above.
|
|
466
|
+
|
|
467
|
+
If the visitor closes the drawer without solving it, nothing is sent, and the form ends in
|
|
468
|
+
`error` with "Please confirm you're not a robot." Sending it again opens the challenge again.
|
|
469
|
+
|
|
455
470
|
### Reacting in code
|
|
456
471
|
|
|
457
472
|
Every successful sign-up emits `subscribed`, from these forms and from the drawer's own:
|
package/dist/moonbase.d.ts
CHANGED
|
@@ -429,6 +429,13 @@ export declare interface MoonbaseIntentArgs {
|
|
|
429
429
|
quantity?: number;
|
|
430
430
|
offer_id?: string;
|
|
431
431
|
show_cart?: boolean;
|
|
432
|
+
/**
|
|
433
|
+
* The customer's license this purchase upgrades or renews, for a product whose licenses cover
|
|
434
|
+
* only some releases. Buying it extends that license instead of issuing another, at the price
|
|
435
|
+
* the storefront quotes for that license. Each license is a cart line of its own, always one
|
|
436
|
+
* unit. Products only. Left out, the purchase issues a new license.
|
|
437
|
+
*/
|
|
438
|
+
license_id?: string;
|
|
432
439
|
};
|
|
433
440
|
[MoonbaseIntent.Purchase]: {
|
|
434
441
|
product_id?: string;
|
|
@@ -436,12 +443,16 @@ export declare interface MoonbaseIntentArgs {
|
|
|
436
443
|
variation_id?: string;
|
|
437
444
|
quantity?: number;
|
|
438
445
|
coupon_code?: string;
|
|
446
|
+
/** The customer's license this purchase upgrades or renews, always one unit. Products only. */
|
|
447
|
+
license_id?: string;
|
|
439
448
|
} | {
|
|
440
449
|
product_id?: string;
|
|
441
450
|
bundle_id?: string;
|
|
442
451
|
variation_id?: string;
|
|
443
452
|
quantity?: number;
|
|
444
453
|
coupon_code?: string;
|
|
454
|
+
/** The customer's license this purchase upgrades or renews, always one unit. Products only. */
|
|
455
|
+
license_id?: string;
|
|
445
456
|
}[];
|
|
446
457
|
[MoonbaseIntent.Checkout]: {
|
|
447
458
|
complete?: boolean;
|