@crowdin/app-project-module 1.0.0 → 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.
- package/out/modules/integration/handlers/sync-settings-save.js +6 -5
- package/out/modules/integration/util/cron.js +1 -1
- package/out/modules/integration/util/files.d.ts +2 -0
- package/out/modules/integration/util/files.js +9 -1
- package/out/static/js/main.js +5 -3
- package/out/static/ui/main.bundle.js +11 -0
- package/out/static/ui/main.bundle.js.map +1 -1
- package/package.json +1 -1
|
@@ -16,10 +16,6 @@ const files_1 = require("../util/files");
|
|
|
16
16
|
const job_1 = require("../util/job");
|
|
17
17
|
const types_1 = require("../util/types");
|
|
18
18
|
const types_2 = require("../types");
|
|
19
|
-
function checkAutoSyncSettings(integration, settings, provider) {
|
|
20
|
-
var _a;
|
|
21
|
-
return !!(!integration.webhooks && ((_a = integration.syncNewElements) === null || _a === void 0 ? void 0 : _a[provider]) && settings[`new-${provider}-files`]);
|
|
22
|
-
}
|
|
23
19
|
function handle(config, integration) {
|
|
24
20
|
return (0, util_1.runAsyncWrapper)((req, res) => __awaiter(this, void 0, void 0, function* () {
|
|
25
21
|
const { files, provider, expandIntegrationFolders, hasLoadMoreElements } = req.body;
|
|
@@ -51,6 +47,7 @@ function handle(config, integration) {
|
|
|
51
47
|
jobType: types_1.JobClientType.MANUAL,
|
|
52
48
|
jobStoreType: integration.jobStoreType,
|
|
53
49
|
jobCallback: (job) => __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
var _a;
|
|
54
51
|
if (Array.isArray(expandIntegrationFolders) && expandIntegrationFolders.length) {
|
|
55
52
|
const expandedFiles = hasLoadMoreElements
|
|
56
53
|
? yield (0, files_1.expandFilesTreeWithPagination)(expandIntegrationFolders, req, integration, job)
|
|
@@ -79,7 +76,11 @@ function handle(config, integration) {
|
|
|
79
76
|
});
|
|
80
77
|
}
|
|
81
78
|
const settings = req.integrationSettings || {};
|
|
82
|
-
|
|
79
|
+
const syncFiles = (0, files_1.prepareSyncFiles)(files);
|
|
80
|
+
const needsSnapshot = !integration.webhooks &&
|
|
81
|
+
((_a = integration.syncNewElements) === null || _a === void 0 ? void 0 : _a[provider]) &&
|
|
82
|
+
(settings[`new-${provider}-files`] || (0, files_1.hasFolders)(syncFiles));
|
|
83
|
+
if (needsSnapshot) {
|
|
83
84
|
yield (0, snapshot_1.createOrUpdateFileSnapshot)(config, integration, req, provider);
|
|
84
85
|
}
|
|
85
86
|
}),
|
|
@@ -236,7 +236,7 @@ function processSyncSettings({ config, integration, period, syncSettings, }) {
|
|
|
236
236
|
let currentFileSnapshot = [];
|
|
237
237
|
const needsSnapshotForNewFiles = !integration.webhooks &&
|
|
238
238
|
((_a = integration.syncNewElements) === null || _a === void 0 ? void 0 : _a[syncSettings.provider]) &&
|
|
239
|
-
intConfig[`new-${syncSettings.provider}-files`];
|
|
239
|
+
(intConfig[`new-${syncSettings.provider}-files`] || (0, files_1.hasFolders)(files));
|
|
240
240
|
const needsIntegrationSnapshot = needsSnapshotForNewFiles && syncSettings.provider !== types_1.Provider.CROWDIN;
|
|
241
241
|
const needsCrowdinSnapshot = needsSnapshotForNewFiles && syncSettings.provider === types_1.Provider.CROWDIN;
|
|
242
242
|
if (needsIntegrationSnapshot) {
|
|
@@ -2,6 +2,8 @@ import { ExtendedResult, IntegrationFile, IntegrationLogic, IntegrationRequest,
|
|
|
2
2
|
import { JobClient } from './types';
|
|
3
3
|
import Crowdin from '@crowdin/crowdin-api-client';
|
|
4
4
|
import { SourceFilesModel } from '@crowdin/crowdin-api-client';
|
|
5
|
+
export declare function isFolder(item: any): boolean;
|
|
6
|
+
export declare function hasFolders(files: any[]): boolean;
|
|
5
7
|
export declare function skipFilesByRegex(files: TreeItem[] | undefined, skipIntegrationNodes?: SkipIntegrationNodes): TreeItem[];
|
|
6
8
|
export declare function expandFilesTree(nodes: IntegrationFile[], req: IntegrationRequest, integration: IntegrationLogic, job?: JobClient): Promise<IntegrationFile[]>;
|
|
7
9
|
export declare function attachFileStatus(files: any[], clientId: string, crowdinId: string, integration: IntegrationLogic): Promise<any[]>;
|
|
@@ -9,12 +9,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.filterSyncedData = exports.updateSyncedData = exports.filterFilesByPath = exports.filterFilesByPatterns = exports.getParentFiles = exports.getParentPaths = exports.buildPath = exports.prepareSyncFiles = exports.uniqueFileLanguages = exports.filterLanguages = exports.getExcludedTargetLanguages = exports.markUnsyncedFiles = exports.isMatchingResultType = exports.isExtendedResultType = exports.expandFilesTreeWithPagination = exports.attachFileStatus = exports.expandFilesTree = exports.skipFilesByRegex = void 0;
|
|
12
|
+
exports.filterSyncedData = exports.updateSyncedData = exports.filterFilesByPath = exports.filterFilesByPatterns = exports.getParentFiles = exports.getParentPaths = exports.buildPath = exports.prepareSyncFiles = exports.uniqueFileLanguages = exports.filterLanguages = exports.getExcludedTargetLanguages = exports.markUnsyncedFiles = exports.isMatchingResultType = exports.isExtendedResultType = exports.expandFilesTreeWithPagination = exports.attachFileStatus = exports.expandFilesTree = exports.skipFilesByRegex = exports.hasFolders = exports.isFolder = void 0;
|
|
13
13
|
const types_1 = require("../types");
|
|
14
14
|
const types_2 = require("./types");
|
|
15
15
|
const storage_1 = require("../../../storage");
|
|
16
16
|
const util_1 = require("../../../util");
|
|
17
17
|
const minimatch_1 = require("minimatch");
|
|
18
|
+
function isFolder(item) {
|
|
19
|
+
return !item.type || item.node_type === '0';
|
|
20
|
+
}
|
|
21
|
+
exports.isFolder = isFolder;
|
|
22
|
+
function hasFolders(files) {
|
|
23
|
+
return Array.isArray(files) && files.some(isFolder);
|
|
24
|
+
}
|
|
25
|
+
exports.hasFolders = hasFolders;
|
|
18
26
|
function skipFilesByRegex(files, skipIntegrationNodes) {
|
|
19
27
|
if (!Array.isArray(files)) {
|
|
20
28
|
return [];
|
package/out/static/js/main.js
CHANGED
|
@@ -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
|
-
|
|
53
|
-
|
|
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;
|