@crowdin/app-project-module 1.0.1 → 1.0.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.
@@ -48,9 +48,11 @@ function catchRejection(e, message) {
48
48
  return;
49
49
  }
50
50
  //payment required
51
- if (e.code && e.code === 402 && subscriptionModal) {
52
- subscriptionLink = e.message || message;
53
- openModal(subscriptionModal);
51
+ if (e.code && e.code === 402 && window.app?.subscriptionModal.current) {
52
+ if (window.app.subscriptionLink) {
53
+ window.app.subscriptionLink.current = e.message || message;
54
+ }
55
+ window.app.openModal(window.app.subscriptionModal.current);
54
56
  return;
55
57
  }
56
58
  showToast(e.message || message);
@@ -622,6 +622,17 @@
622
622
  }
623
623
  };
624
624
  }, []);
625
+ // Expose centralized API to global scope for main.js compatibility
626
+ reactExports.useEffect(() => {
627
+ window.app = {
628
+ subscriptionModal: subscriptionModal,
629
+ subscriptionLink: subscriptionLink,
630
+ openModal: openModal,
631
+ };
632
+ return () => {
633
+ delete window.app;
634
+ };
635
+ }, []);
625
636
  // crowdin-users-select doesn't trigger onChange reliably, using native event listener instead
626
637
  reactExports.useEffect(() => {
627
638
  const selectElement = usersSelectRef.current;