@crowdin/app-project-module 2.2.0 → 2.3.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.
Files changed (45) hide show
  1. package/out/middlewares/ui-module.js +1 -2
  2. package/out/modules/about.d.ts +4 -0
  3. package/out/modules/about.js +25 -3
  4. package/out/static/css/styles.css +2 -342
  5. package/out/static/ui/about.bundle.js +542 -0
  6. package/out/static/ui/about.bundle.js.map +1 -0
  7. package/out/static/ui/error.bundle.js +120 -2
  8. package/out/static/ui/error.bundle.js.map +1 -1
  9. package/out/static/ui/form.bundle.js +164 -12
  10. package/out/static/ui/form.bundle.js.map +1 -1
  11. package/out/static/ui/install.bundle.js +8 -2
  12. package/out/static/ui/install.bundle.js.map +1 -1
  13. package/out/static/ui/login.bundle.js +425 -35
  14. package/out/static/ui/login.bundle.js.map +1 -1
  15. package/out/static/ui/main.bundle.js +718 -366
  16. package/out/static/ui/main.bundle.js.map +1 -1
  17. package/out/static/ui/oauth.bundle.js +8 -2
  18. package/out/static/ui/oauth.bundle.js.map +1 -1
  19. package/out/static/ui/subscription.bundle.js +542 -0
  20. package/out/static/ui/subscription.bundle.js.map +1 -0
  21. package/out/storage/drizzle/postgresql/migrations/0002_equal_skrulls.sql +3 -0
  22. package/out/storage/drizzle/postgresql/migrations/meta/0002_snapshot.json +646 -0
  23. package/out/storage/drizzle/postgresql/migrations/meta/_journal.json +7 -0
  24. package/out/storage/drizzle/postgresql/schema.js +2 -1
  25. package/out/storage/drizzle/sqlite/migrations/0001_new_rhodey.sql +26 -0
  26. package/out/storage/drizzle/sqlite/migrations/meta/0001_snapshot.json +687 -0
  27. package/out/storage/drizzle/sqlite/migrations/meta/_journal.json +7 -0
  28. package/out/storage/drizzle/sqlite/schema.js +2 -1
  29. package/out/util/jsx-renderer.d.ts +2 -1
  30. package/out/util/jsx-renderer.js +8 -8
  31. package/out/views/FormPage.js +2 -2
  32. package/out/views/index.d.ts +0 -2
  33. package/out/views/index.js +1 -5
  34. package/out/views/layout/Head.js +0 -10
  35. package/package.json +5 -2
  36. package/out/static/css/about.css +0 -128
  37. package/out/static/css/crowdin-ui-colors.css +0 -115
  38. package/out/static/js/dependent.js +0 -315
  39. package/out/static/js/main.js +0 -96
  40. package/out/static/js/polyfills/fetch.js +0 -494
  41. package/out/static/js/polyfills/promise.js +0 -375
  42. package/out/views/AboutPage.d.ts +0 -10
  43. package/out/views/AboutPage.js +0 -88
  44. package/out/views/SubscriptionPage.d.ts +0 -7
  45. package/out/views/SubscriptionPage.js +0 -26
@@ -518,6 +518,122 @@
518
518
 
519
519
  var clientExports = requireClient();
520
520
 
521
+ /// <reference path="../types.d.ts" />
522
+ const postPromises = {};
523
+ let isInitialized = false;
524
+ let origin = null;
525
+ let clientId = null;
526
+ let restParams = '';
527
+ function parseJson(value) {
528
+ try {
529
+ return JSON.parse(value);
530
+ }
531
+ catch {
532
+ return undefined;
533
+ }
534
+ }
535
+ function handleMessage(event) {
536
+ if (event.origin !== window.location.origin || typeof event.data !== 'string') {
537
+ return;
538
+ }
539
+ const eventData = parseJson(event.data);
540
+ if (!(eventData === null || eventData === void 0 ? void 0 : eventData.uid)) {
541
+ return;
542
+ }
543
+ const postPromise = postPromises[eventData.uid];
544
+ if (postPromise) {
545
+ delete postPromises[eventData.uid];
546
+ if (postPromise.timer) {
547
+ clearTimeout(postPromise.timer);
548
+ }
549
+ postPromise.resolve(eventData.data);
550
+ }
551
+ }
552
+ function initializeCrowdinIframeContext() {
553
+ if (isInitialized) {
554
+ return;
555
+ }
556
+ const urlParams = new URLSearchParams(window.location.search);
557
+ origin = urlParams.get('origin');
558
+ clientId = urlParams.get('client_id');
559
+ restParams = window.location.search;
560
+ JSON.parse(window.name);
561
+ window.addEventListener('message', handleMessage);
562
+ isInitialized = true;
563
+ }
564
+ function ensureInitialized() {
565
+ if (!isInitialized) {
566
+ initializeCrowdinIframeContext();
567
+ }
568
+ }
569
+ function showToast(message) {
570
+ if (message) {
571
+ const toasts = document.querySelector('crowdin-toasts');
572
+ if (toasts && toasts.pushToasts) {
573
+ toasts.pushToasts([message]);
574
+ }
575
+ }
576
+ }
577
+ function reloadLocation() {
578
+ ensureInitialized();
579
+ window.location.href =
580
+ window.location.protocol + '//' + window.location.host + window.location.pathname + restParams;
581
+ }
582
+ function catchRejection(e, message) {
583
+ var _a;
584
+ // session expired
585
+ if (e.code && e.code === 401) {
586
+ reloadLocation();
587
+ return;
588
+ }
589
+ // payment required
590
+ if (e.code && e.code === 402 && ((_a = window.app) === null || _a === void 0 ? void 0 : _a.subscriptionModal.current)) {
591
+ if (window.app.subscriptionLink) {
592
+ window.app.subscriptionLink.current = e.message || message;
593
+ }
594
+ window.app.openModal(window.app.subscriptionModal.current);
595
+ return;
596
+ }
597
+ showToast(e.message || message);
598
+ }
599
+ function checkResponse(response) {
600
+ return new Promise((resolve, reject) => {
601
+ if (response.status === 204) {
602
+ return resolve(undefined);
603
+ }
604
+ response
605
+ .json()
606
+ .then((res) => {
607
+ if (![200, 201, 202, 304].includes(response.status)) {
608
+ reject(res);
609
+ }
610
+ else {
611
+ if (res.message) {
612
+ setTimeout(() => showToast(res.message), 100);
613
+ }
614
+ resolve(res);
615
+ }
616
+ })
617
+ .catch((e) => {
618
+ reject(e);
619
+ });
620
+ });
621
+ }
622
+ function checkOrigin() {
623
+ ensureInitialized();
624
+ return new Promise((resolve) => {
625
+ AP.getJwtToken((jwtToken) => {
626
+ restParams = `?origin=${origin}&client_id=${clientId}&jwtToken=${jwtToken}`;
627
+ resolve(restParams);
628
+ });
629
+ });
630
+ }
631
+
632
+ function readPageProps() {
633
+ const element = document.getElementById('__PAGE_PROPS__');
634
+ return JSON.parse((element === null || element === void 0 ? void 0 : element.textContent) || '{}');
635
+ }
636
+
521
637
  const ErrorPage = ({ message, name, owners, hideActions, allowLogout }) => {
522
638
  function integrationLogout() {
523
639
  checkOrigin()
@@ -532,10 +648,12 @@
532
648
  AP.redirect(`${context.organization_id ? '/u' : ''}/messages/create/${userId}`);
533
649
  });
534
650
  }
535
- return (jsxRuntimeExports.jsx("div", { className: "i_w", children: jsxRuntimeExports.jsx("div", { className: "error-page", children: jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsxs("div", { className: "error-page-message", children: [jsxRuntimeExports.jsx("crowdin-h3", { children: message }), owners && (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("crowdin-p", { children: "This integration allows only one connection per project to ensure consistent configuration and prevent file import or synchronization issues." }), owners.length > 1 ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("crowdin-p", { class: "mt-2", children: "Managed by:" }), jsxRuntimeExports.jsx("ul", { children: owners.map((owner) => (jsxRuntimeExports.jsx("li", { children: jsxRuntimeExports.jsx("crowdin-a", { href: "#", onClick: () => contactUser(owner.id), children: owner.name }) }))) }), jsxRuntimeExports.jsx("crowdin-p", { class: "mt-2", children: "To request access, please contact one of the project members listed above." })] })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs("crowdin-p", { class: "mt-2", children: ["Managed by:", ' ', jsxRuntimeExports.jsx("crowdin-a", { href: "#", onClick: () => contactUser(owners[0].id), children: owners[0].name })] }), jsxRuntimeExports.jsx("crowdin-p", { class: "mt-2", children: "To request access, please contact the project member listed above." })] }))] }))] }), allowLogout && hideActions ? (jsxRuntimeExports.jsxs("crowdin-card", { "light-filled": true, children: [jsxRuntimeExports.jsx("crowdin-alert", { type: "warning", margin: true, message: "Deleting the integration will disconnect it and reset its settings for this project." }), jsxRuntimeExports.jsx("crowdin-button", { outlined: true, onClick: () => integrationLogout(), children: "Delete Integration" })] })) : (!hideActions && (jsxRuntimeExports.jsxs("div", { className: "error-page-action", children: [jsxRuntimeExports.jsx("crowdin-button", { outlined: true, onClick: () => integrationLogout(), children: "Log out" }), jsxRuntimeExports.jsxs("span", { children: [' ', "or", ' ', jsxRuntimeExports.jsx("crowdin-a", { href: "https://crowdin.com/contacts", target: "_blank", children: "contact us" }), ' ', "for help"] })] })))] }) }) }));
651
+ return (jsxRuntimeExports.jsx("div", { className: "mx-auto max-w-[1420px] px-6 py-4", children: jsxRuntimeExports.jsx("div", { className: "flex min-h-[500px] items-center justify-center", children: jsxRuntimeExports.jsxs("div", { children: [jsxRuntimeExports.jsxs("div", { className: "mb-6", children: [jsxRuntimeExports.jsx("crowdin-h3", { children: message }), owners && (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("crowdin-p", { children: "This integration allows only one connection per project to ensure consistent configuration and prevent file import or synchronization issues." }), owners.length > 1 ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx("crowdin-p", { class: "mt-4", children: "Managed by:" }), jsxRuntimeExports.jsx("ul", { children: owners.map((owner) => (jsxRuntimeExports.jsx("li", { children: jsxRuntimeExports.jsx("crowdin-a", { href: "#", onClick: () => contactUser(owner.id), children: owner.name }) }))) }), jsxRuntimeExports.jsx("crowdin-p", { class: "mt-4", children: "To request access, please contact one of the project members listed above." })] })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs("crowdin-p", { class: "mt-4", children: ["Managed by:", ' ', jsxRuntimeExports.jsx("crowdin-a", { href: "#", onClick: () => contactUser(owners[0].id), children: owners[0].name })] }), jsxRuntimeExports.jsx("crowdin-p", { class: "mt-4", children: "To request access, please contact the project member listed above." })] }))] }))] }), allowLogout && hideActions ? (jsxRuntimeExports.jsxs("crowdin-card", { "light-filled": true, children: [jsxRuntimeExports.jsx("crowdin-alert", { type: "warning", margin: true, message: "Deleting the integration will disconnect it and reset its settings for this project." }), jsxRuntimeExports.jsx("crowdin-button", { outlined: true, onClick: () => integrationLogout(), children: "Delete Integration" })] })) : (!hideActions && (jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntimeExports.jsx("crowdin-button", { outlined: true, onClick: () => integrationLogout(), children: "Log out" }), jsxRuntimeExports.jsxs("span", { children: [' ', "or", ' ', jsxRuntimeExports.jsx("crowdin-a", { href: "https://crowdin.com/contacts", target: "_blank", children: "contact us" }), ' ', "for help"] })] })))] }) }) }));
536
652
  };
537
653
 
538
- clientExports.createRoot(document.getElementById('root')).render(jsxRuntimeExports.jsx(ErrorPage, { ...window.__PAGE_PROPS__ }));
654
+ initializeCrowdinIframeContext();
655
+ const props = readPageProps();
656
+ clientExports.createRoot(document.getElementById('root')).render(jsxRuntimeExports.jsx(ErrorPage, { ...props }));
539
657
 
540
658
  })();
541
659
  //# sourceMappingURL=error.bundle.js.map