Fix LS close overlay event
This commit is contained in:
@@ -6,7 +6,7 @@ interface LemonSqueezyWindow extends Window {
|
|||||||
createLemonSqueezy: () => void;
|
createLemonSqueezy: () => void;
|
||||||
LemonSqueezy: {
|
LemonSqueezy: {
|
||||||
Setup: (options: {
|
Setup: (options: {
|
||||||
eventHandler: (event: { event: string }) => void;
|
eventHandler: (event: { event: string } | string) => void;
|
||||||
}) => void;
|
}) => void;
|
||||||
Refresh: () => void;
|
Refresh: () => void;
|
||||||
Url: {
|
Url: {
|
||||||
@@ -43,6 +43,14 @@ function useLoadScript(
|
|||||||
if (onClose) {
|
if (onClose) {
|
||||||
win.LemonSqueezy.Setup({
|
win.LemonSqueezy.Setup({
|
||||||
eventHandler: (event) => {
|
eventHandler: (event) => {
|
||||||
|
if (typeof event === 'string') {
|
||||||
|
if (event === 'close') {
|
||||||
|
onClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (event.event === 'PaymentMethodUpdate.Closed') {
|
if (event.event === 'PaymentMethodUpdate.Closed') {
|
||||||
onClose();
|
onClose();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user