@dotted-labs/ngx-supabase-stripe 0.4.0 → 0.4.2
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.
|
@@ -333,6 +333,7 @@ class StripeClientService {
|
|
|
333
333
|
/**
|
|
334
334
|
* Initialize the embedded checkout
|
|
335
335
|
* @param clientSecret The client secret for the checkout session
|
|
336
|
+
* @see https://docs.stripe.com/js/embedded_checkout/init - v8 supports optional appearance, defaultValues, etc.
|
|
336
337
|
*/
|
|
337
338
|
async initEmbeddedCheckout(clientSecret) {
|
|
338
339
|
const stripe = await this.getStripe();
|
|
@@ -349,12 +350,20 @@ class StripeClientService {
|
|
|
349
350
|
}
|
|
350
351
|
/**
|
|
351
352
|
* Destroy the embedded checkout
|
|
353
|
+
* Wrapped in try/catch to handle multiple destroy() calls (stripe-js throws IntegrationError when instance already destroyed)
|
|
352
354
|
*/
|
|
353
355
|
destroyEmbeddedCheckout() {
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
356
|
+
if (!this.embeddedCheckout)
|
|
357
|
+
return;
|
|
358
|
+
try {
|
|
359
|
+
this.embeddedCheckout.destroy();
|
|
360
|
+
}
|
|
361
|
+
catch {
|
|
362
|
+
// Already destroyed or error - ignore silently
|
|
363
|
+
}
|
|
364
|
+
finally {
|
|
365
|
+
this.embeddedCheckout = null;
|
|
366
|
+
}
|
|
358
367
|
}
|
|
359
368
|
/**
|
|
360
369
|
* Create a checkout session
|