@crowdin/app-project-module 2.2.0 → 2.4.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/out/middlewares/ui-module.js +1 -2
- package/out/modules/about.d.ts +4 -0
- package/out/modules/about.js +25 -3
- package/out/static/css/styles.css +2 -342
- package/out/static/ui/about.bundle.js +542 -0
- package/out/static/ui/about.bundle.js.map +1 -0
- package/out/static/ui/error.bundle.js +120 -2
- package/out/static/ui/error.bundle.js.map +1 -1
- package/out/static/ui/form.bundle.js +164 -12
- package/out/static/ui/form.bundle.js.map +1 -1
- package/out/static/ui/install.bundle.js +8 -2
- package/out/static/ui/install.bundle.js.map +1 -1
- package/out/static/ui/login.bundle.js +425 -35
- package/out/static/ui/login.bundle.js.map +1 -1
- package/out/static/ui/main.bundle.js +1798 -1377
- package/out/static/ui/main.bundle.js.map +1 -1
- package/out/static/ui/oauth.bundle.js +8 -2
- package/out/static/ui/oauth.bundle.js.map +1 -1
- package/out/static/ui/subscription.bundle.js +542 -0
- package/out/static/ui/subscription.bundle.js.map +1 -0
- package/out/storage/drizzle/postgresql/migrations/0002_equal_skrulls.sql +3 -0
- package/out/storage/drizzle/postgresql/migrations/meta/0002_snapshot.json +646 -0
- package/out/storage/drizzle/postgresql/migrations/meta/_journal.json +7 -0
- package/out/storage/drizzle/postgresql/schema.js +2 -1
- package/out/storage/drizzle/sqlite/migrations/0001_new_rhodey.sql +26 -0
- package/out/storage/drizzle/sqlite/migrations/meta/0001_snapshot.json +687 -0
- package/out/storage/drizzle/sqlite/migrations/meta/_journal.json +7 -0
- package/out/storage/drizzle/sqlite/schema.js +2 -1
- package/out/util/jsx-renderer.d.ts +2 -1
- package/out/util/jsx-renderer.js +8 -8
- package/out/views/FormPage.js +2 -2
- package/out/views/index.d.ts +0 -2
- package/out/views/index.js +1 -5
- package/out/views/layout/Head.js +0 -10
- package/package.json +5 -2
- package/out/static/css/about.css +0 -128
- package/out/static/css/crowdin-ui-colors.css +0 -115
- package/out/static/js/dependent.js +0 -315
- package/out/static/js/main.js +0 -96
- package/out/static/js/polyfills/fetch.js +0 -494
- package/out/static/js/polyfills/promise.js +0 -375
- package/out/views/AboutPage.d.ts +0 -10
- package/out/views/AboutPage.js +0 -88
- package/out/views/SubscriptionPage.d.ts +0 -7
- package/out/views/SubscriptionPage.js +0 -26
|
@@ -46388,6 +46388,122 @@ export default theme;`;
|
|
|
46388
46388
|
|
|
46389
46389
|
var clientExports = requireClient();
|
|
46390
46390
|
|
|
46391
|
+
/// <reference path="../types.d.ts" />
|
|
46392
|
+
const postPromises = {};
|
|
46393
|
+
let isInitialized = false;
|
|
46394
|
+
let origin = null;
|
|
46395
|
+
let clientId = null;
|
|
46396
|
+
let restParams = '';
|
|
46397
|
+
let frameData$1;
|
|
46398
|
+
function parseJson(value) {
|
|
46399
|
+
try {
|
|
46400
|
+
return JSON.parse(value);
|
|
46401
|
+
}
|
|
46402
|
+
catch {
|
|
46403
|
+
return undefined;
|
|
46404
|
+
}
|
|
46405
|
+
}
|
|
46406
|
+
function handleMessage(event) {
|
|
46407
|
+
if (event.origin !== window.location.origin || typeof event.data !== 'string') {
|
|
46408
|
+
return;
|
|
46409
|
+
}
|
|
46410
|
+
const eventData = parseJson(event.data);
|
|
46411
|
+
if (!(eventData === null || eventData === void 0 ? void 0 : eventData.uid)) {
|
|
46412
|
+
return;
|
|
46413
|
+
}
|
|
46414
|
+
const postPromise = postPromises[eventData.uid];
|
|
46415
|
+
if (postPromise) {
|
|
46416
|
+
delete postPromises[eventData.uid];
|
|
46417
|
+
if (postPromise.timer) {
|
|
46418
|
+
clearTimeout(postPromise.timer);
|
|
46419
|
+
}
|
|
46420
|
+
postPromise.resolve(eventData.data);
|
|
46421
|
+
}
|
|
46422
|
+
}
|
|
46423
|
+
function initializeCrowdinIframeContext() {
|
|
46424
|
+
if (isInitialized) {
|
|
46425
|
+
return;
|
|
46426
|
+
}
|
|
46427
|
+
const urlParams = new URLSearchParams(window.location.search);
|
|
46428
|
+
origin = urlParams.get('origin');
|
|
46429
|
+
clientId = urlParams.get('client_id');
|
|
46430
|
+
restParams = window.location.search;
|
|
46431
|
+
frameData$1 = JSON.parse(window.name);
|
|
46432
|
+
window.addEventListener('message', handleMessage);
|
|
46433
|
+
isInitialized = true;
|
|
46434
|
+
}
|
|
46435
|
+
function ensureInitialized() {
|
|
46436
|
+
if (!isInitialized) {
|
|
46437
|
+
initializeCrowdinIframeContext();
|
|
46438
|
+
}
|
|
46439
|
+
}
|
|
46440
|
+
function getFrameData() {
|
|
46441
|
+
ensureInitialized();
|
|
46442
|
+
return frameData$1;
|
|
46443
|
+
}
|
|
46444
|
+
function showToast(message) {
|
|
46445
|
+
if (message) {
|
|
46446
|
+
const toasts = document.querySelector('crowdin-toasts');
|
|
46447
|
+
if (toasts && toasts.pushToasts) {
|
|
46448
|
+
toasts.pushToasts([message]);
|
|
46449
|
+
}
|
|
46450
|
+
}
|
|
46451
|
+
}
|
|
46452
|
+
function reloadLocation() {
|
|
46453
|
+
ensureInitialized();
|
|
46454
|
+
window.location.href =
|
|
46455
|
+
window.location.protocol + '//' + window.location.host + window.location.pathname + restParams;
|
|
46456
|
+
}
|
|
46457
|
+
function catchRejection(e, message) {
|
|
46458
|
+
var _a;
|
|
46459
|
+
// session expired
|
|
46460
|
+
if (e.code && e.code === 401) {
|
|
46461
|
+
reloadLocation();
|
|
46462
|
+
return;
|
|
46463
|
+
}
|
|
46464
|
+
// payment required
|
|
46465
|
+
if (e.code && e.code === 402 && ((_a = window.app) === null || _a === void 0 ? void 0 : _a.subscriptionModal.current)) {
|
|
46466
|
+
if (window.app.subscriptionLink) {
|
|
46467
|
+
window.app.subscriptionLink.current = e.message || message;
|
|
46468
|
+
}
|
|
46469
|
+
window.app.openModal(window.app.subscriptionModal.current);
|
|
46470
|
+
return;
|
|
46471
|
+
}
|
|
46472
|
+
showToast(e.message || message);
|
|
46473
|
+
}
|
|
46474
|
+
function checkResponse(response) {
|
|
46475
|
+
return new Promise((resolve, reject) => {
|
|
46476
|
+
if (response.status === 204) {
|
|
46477
|
+
return resolve(undefined);
|
|
46478
|
+
}
|
|
46479
|
+
response
|
|
46480
|
+
.json()
|
|
46481
|
+
.then((res) => {
|
|
46482
|
+
if (![200, 201, 202, 304].includes(response.status)) {
|
|
46483
|
+
reject(res);
|
|
46484
|
+
}
|
|
46485
|
+
else {
|
|
46486
|
+
if (res.message) {
|
|
46487
|
+
setTimeout(() => showToast(res.message), 100);
|
|
46488
|
+
}
|
|
46489
|
+
resolve(res);
|
|
46490
|
+
}
|
|
46491
|
+
})
|
|
46492
|
+
.catch((e) => {
|
|
46493
|
+
reject(e);
|
|
46494
|
+
});
|
|
46495
|
+
});
|
|
46496
|
+
}
|
|
46497
|
+
function checkOrigin() {
|
|
46498
|
+
ensureInitialized();
|
|
46499
|
+
return new Promise((resolve) => {
|
|
46500
|
+
AP.getJwtToken((jwtToken) => {
|
|
46501
|
+
restParams = `?origin=${origin}&client_id=${clientId}&jwtToken=${jwtToken}`;
|
|
46502
|
+
resolve(restParams);
|
|
46503
|
+
});
|
|
46504
|
+
});
|
|
46505
|
+
}
|
|
46506
|
+
|
|
46391
46507
|
const validateWidgetValue = (value) => {
|
|
46392
46508
|
if (Array.isArray(value)) {
|
|
46393
46509
|
return value;
|
|
@@ -47471,6 +47587,8 @@ export default theme;`;
|
|
|
47471
47587
|
} }));
|
|
47472
47588
|
};
|
|
47473
47589
|
|
|
47590
|
+
initializeCrowdinIframeContext();
|
|
47591
|
+
const frameData = getFrameData();
|
|
47474
47592
|
const defaultAppearance = 'light';
|
|
47475
47593
|
const getAppearance = (crowdinAppearance) => {
|
|
47476
47594
|
if (!['light', 'dark'].includes(crowdinAppearance)) {
|
|
@@ -47483,9 +47601,25 @@ export default theme;`;
|
|
|
47483
47601
|
palette: {
|
|
47484
47602
|
mode,
|
|
47485
47603
|
},
|
|
47486
|
-
|
|
47487
|
-
|
|
47488
|
-
|
|
47604
|
+
components: {
|
|
47605
|
+
MuiButton: {
|
|
47606
|
+
styleOverrides: {
|
|
47607
|
+
root: ({ ownerState }) => ownerState.type === 'submit'
|
|
47608
|
+
? {
|
|
47609
|
+
background: '#fff',
|
|
47610
|
+
color: '#263238',
|
|
47611
|
+
boxShadow: 'none',
|
|
47612
|
+
border: '1px solid rgba(38,50,56,.24)',
|
|
47613
|
+
'&:hover': {
|
|
47614
|
+
background: 'rgba(236, 239, 241, .54)',
|
|
47615
|
+
boxShadow: 'none',
|
|
47616
|
+
},
|
|
47617
|
+
}
|
|
47618
|
+
: {},
|
|
47619
|
+
},
|
|
47620
|
+
},
|
|
47621
|
+
...(mode === 'dark'
|
|
47622
|
+
? {
|
|
47489
47623
|
MuiTypography: {
|
|
47490
47624
|
styleOverrides: {
|
|
47491
47625
|
root: {
|
|
@@ -47501,9 +47635,9 @@ export default theme;`;
|
|
|
47501
47635
|
},
|
|
47502
47636
|
},
|
|
47503
47637
|
},
|
|
47504
|
-
}
|
|
47505
|
-
|
|
47506
|
-
|
|
47638
|
+
}
|
|
47639
|
+
: {}),
|
|
47640
|
+
},
|
|
47507
47641
|
});
|
|
47508
47642
|
}
|
|
47509
47643
|
const Form = withTheme({
|
|
@@ -47535,7 +47669,7 @@ export default theme;`;
|
|
|
47535
47669
|
}
|
|
47536
47670
|
return id.join('-');
|
|
47537
47671
|
}
|
|
47538
|
-
function FormContainer({ formData, formSchema, formUiSchema, onFormRef }) {
|
|
47672
|
+
function FormContainer({ formData, formSchema, formUiSchema, onFormRef, canSubmitForm }) {
|
|
47539
47673
|
const [theme, setTheme] = reactExports.useState(null);
|
|
47540
47674
|
const ref = reactExports.useRef();
|
|
47541
47675
|
reactExports.useEffect(() => {
|
|
@@ -47561,7 +47695,16 @@ export default theme;`;
|
|
|
47561
47695
|
monacoEditorWidget: (props) => jsxRuntimeExports.jsx(MonacoEditorWidget, { ...props, theme: theme }),
|
|
47562
47696
|
jsonataEditorWidget: (props) => jsxRuntimeExports.jsx(JsonataEditorWidget, { ...props, theme: theme }),
|
|
47563
47697
|
};
|
|
47564
|
-
|
|
47698
|
+
const preparedFormUiSchema = canSubmitForm
|
|
47699
|
+
? formUiSchema
|
|
47700
|
+
: {
|
|
47701
|
+
...formUiSchema,
|
|
47702
|
+
'ui:submitButtonOptions': {
|
|
47703
|
+
...((formUiSchema === null || formUiSchema === void 0 ? void 0 : formUiSchema['ui:submitButtonOptions']) || {}),
|
|
47704
|
+
norender: true,
|
|
47705
|
+
},
|
|
47706
|
+
};
|
|
47707
|
+
return (jsxRuntimeExports.jsx(ThemeProvider, { theme: theme, children: jsxRuntimeExports.jsx(Form, { ref: ref, widgets: widgets, formData: formData, validator: validator, schema: formSchema, uiSchema: preparedFormUiSchema, onSubmit: (e) => {
|
|
47565
47708
|
submitForm(e.formData);
|
|
47566
47709
|
}, onChange: (e) => {
|
|
47567
47710
|
window.currentFormData = e.formData;
|
|
@@ -47585,6 +47728,12 @@ export default theme;`;
|
|
|
47585
47728
|
card.parentElement.style.padding = '16px';
|
|
47586
47729
|
card.parentElement.style.paddingBottom = '0px';
|
|
47587
47730
|
}
|
|
47731
|
+
function setFullWidthFormContainer() {
|
|
47732
|
+
const card = document.getElementById('card');
|
|
47733
|
+
card.parentElement.style.maxWidth = '100%';
|
|
47734
|
+
card.parentElement.style.padding = '0px';
|
|
47735
|
+
card.parentElement.style.paddingBottom = '0px';
|
|
47736
|
+
}
|
|
47588
47737
|
function checkIfCurrentModuleCanSubmitForm() {
|
|
47589
47738
|
const modulesWithoutSubmit = ['ai-prompt-provider', 'workflow-step-type', 'automation-action'];
|
|
47590
47739
|
return !(AP && AP._data && AP._data.app && modulesWithoutSubmit.includes(AP._data.app.type));
|
|
@@ -47592,14 +47741,17 @@ export default theme;`;
|
|
|
47592
47741
|
function renderForm(formData = {}, formSchema, formUiSchema) {
|
|
47593
47742
|
const root = clientExports.createRoot(document.getElementById('form'));
|
|
47594
47743
|
const modulesWithoutBorders = ['modal', 'editor-right-panel'];
|
|
47744
|
+
const canSubmitForm = checkIfCurrentModuleCanSubmitForm();
|
|
47595
47745
|
if (AP && AP._data && AP._data.app && AP._data.app.type) {
|
|
47596
47746
|
const htmlElement = document.getElementsByTagName('html')[0];
|
|
47597
47747
|
htmlElement.className += ' ' + AP._data.app.type + '-form';
|
|
47748
|
+
if (AP._data.app.type === 'ai-provider') {
|
|
47749
|
+
setFullWidthFormContainer();
|
|
47750
|
+
}
|
|
47598
47751
|
}
|
|
47599
|
-
if (!
|
|
47752
|
+
if (!canSubmitForm) {
|
|
47600
47753
|
removeBorders();
|
|
47601
|
-
|
|
47602
|
-
htmlElement.className += ' form-without-submit';
|
|
47754
|
+
setFullWidthFormContainer();
|
|
47603
47755
|
}
|
|
47604
47756
|
if (AP && AP._data && AP._data.app && modulesWithoutBorders.includes(AP._data.app.type)) {
|
|
47605
47757
|
removeBorders();
|
|
@@ -47612,7 +47764,7 @@ export default theme;`;
|
|
|
47612
47764
|
window.currentFormUiSchema = formUiSchema;
|
|
47613
47765
|
root.render(jsxRuntimeExports.jsx(FormContainer, { onFormRef: (ref) => {
|
|
47614
47766
|
window.formRef = ref.current;
|
|
47615
|
-
}, formData: formData, formSchema: formSchema || window.formSchema, formUiSchema: formUiSchema || window.formUiSchema }));
|
|
47767
|
+
}, formData: formData, formSchema: formSchema || window.formSchema, formUiSchema: formUiSchema || window.formUiSchema, canSubmitForm: canSubmitForm }));
|
|
47616
47768
|
document.getElementById('form-loading').style.display = 'none';
|
|
47617
47769
|
}
|
|
47618
47770
|
function submitForm(formData) {
|