@chenchaolong/plugin-trade-compliance-workbench 1.0.35 → 1.0.37
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/dist/lib/remote-components/trade-compliance-workbench/app.css +1 -1
- package/dist/lib/remote-components/trade-compliance-workbench/app.js +5 -5
- package/dist/lib/remote-components/trade-compliance-workbench/editor-source.mjs +70 -1
- package/dist/lib/remote-components/trade-compliance-workbench/editor.css +1 -1
- package/dist/lib/remote-components/trade-compliance-workbench/editor.js +140 -136
- package/dist/lib/remote-ui/model.js +1 -1
- package/dist/lib/remote-ui/model.js.map +1 -1
- package/dist/lib/remote-ui/pages/analytics.d.ts.map +1 -1
- package/dist/lib/remote-ui/pages/analytics.js +64 -3
- package/dist/lib/remote-ui/pages/analytics.js.map +1 -1
- package/dist/lib/remote-ui/pages/contracts.js +1 -1
- package/dist/lib/remote-ui/pages/contracts.js.map +1 -1
- package/dist/lib/remote-ui/pages/settings.css +3 -0
- package/dist/lib/remote-ui/pages/settings.d.ts.map +1 -1
- package/dist/lib/remote-ui/pages/settings.js +22 -5
- package/dist/lib/remote-ui/pages/settings.js.map +1 -1
- package/dist/lib/remote-ui/settings-contracts.d.ts +1 -0
- package/dist/lib/remote-ui/settings-contracts.d.ts.map +1 -1
- package/dist/lib/remote-ui/styles.css +80 -0
- package/dist/lib/sales-file.service.d.ts.map +1 -1
- package/dist/lib/sales-file.service.js +86 -2
- package/dist/lib/sales-file.service.js.map +1 -1
- package/dist/lib/workbench-view.provider.d.ts +38 -2
- package/dist/lib/workbench-view.provider.d.ts.map +1 -1
- package/dist/lib/workbench.service.d.ts +21 -1
- package/dist/lib/workbench.service.d.ts.map +1 -1
- package/dist/lib/workbench.service.js +30 -1
- package/dist/lib/workbench.service.js.map +1 -1
- package/package.json +23 -21
|
@@ -2789,7 +2789,7 @@ let TradeComplianceWorkbenchService = class TradeComplianceWorkbenchService {
|
|
|
2789
2789
|
this.dataSource.getRepository(BankAccountSettings).find({ where: activeScope(scope), order: { bankType: 'ASC' } }),
|
|
2790
2790
|
this.listMonthlyRates(scope, rateQuery)
|
|
2791
2791
|
]);
|
|
2792
|
-
return { company, banks, profit, rates };
|
|
2792
|
+
return { company: await this.companySettingsView(scope, company), banks, profit, rates };
|
|
2793
2793
|
}
|
|
2794
2794
|
async saveSettings(scope, type, input, expectedRevision) {
|
|
2795
2795
|
if (type === 'company') {
|
|
@@ -2959,6 +2959,26 @@ let TradeComplianceWorkbenchService = class TradeComplianceWorkbenchService {
|
|
|
2959
2959
|
throw new DomainError(DomainErrorCodes.INVALID_INPUT, '公司 Logo 文件不可读取,请重新上传或恢复默认', { assetId, cause: error instanceof Error ? error.message : String(error) });
|
|
2960
2960
|
}
|
|
2961
2961
|
}
|
|
2962
|
+
async companySettingsView(scope, company) {
|
|
2963
|
+
if (!company)
|
|
2964
|
+
return company;
|
|
2965
|
+
return { ...company, logoPreviewUrl: await this.companyLogoPreviewUrl(scope, company.logoFileId) };
|
|
2966
|
+
}
|
|
2967
|
+
async companyLogoPreviewUrl(scope, assetId) {
|
|
2968
|
+
if (!assetId || !this.storage)
|
|
2969
|
+
return null;
|
|
2970
|
+
const asset = await this.dataSource.getRepository(ManagedAsset).findOne({ where: { ...activeScope(scope), id: assetId, assetType: 'COMPANY_LOGO', status: 'ACTIVE', deletedAt: IsNull() } });
|
|
2971
|
+
if (!asset)
|
|
2972
|
+
return null;
|
|
2973
|
+
try {
|
|
2974
|
+
const buffer = await this.storage.read(asset.storageFileId);
|
|
2975
|
+
const mimeType = imageMimeType(buffer);
|
|
2976
|
+
return mimeType ? `data:${mimeType};base64,${buffer.toString('base64')}` : null;
|
|
2977
|
+
}
|
|
2978
|
+
catch {
|
|
2979
|
+
return null;
|
|
2980
|
+
}
|
|
2981
|
+
}
|
|
2962
2982
|
async persistMonthlyRate(scope, input, changes, expectedRevision) {
|
|
2963
2983
|
return this.dataSource.transaction(async (manager) => {
|
|
2964
2984
|
const repo = manager.getRepository(MonthlySafeExchangeRate);
|
|
@@ -3709,6 +3729,15 @@ function assertExpectedRevision(actual, expected) {
|
|
|
3709
3729
|
function settingString(value, label) { if (typeof value !== 'string')
|
|
3710
3730
|
throw new DomainError(DomainErrorCodes.INVALID_INPUT, `${label}必须是字符串`); return value; }
|
|
3711
3731
|
function settingNullableString(value, label) { return value == null ? null : settingString(value, label); }
|
|
3732
|
+
function imageMimeType(buffer) {
|
|
3733
|
+
if (buffer.subarray(0, 4).equals(Buffer.from([0x89, 0x50, 0x4e, 0x47])))
|
|
3734
|
+
return 'image/png';
|
|
3735
|
+
if (buffer.subarray(0, 3).equals(Buffer.from([0xff, 0xd8, 0xff])))
|
|
3736
|
+
return 'image/jpeg';
|
|
3737
|
+
if (buffer.subarray(0, 4).toString('ascii') === 'RIFF' && buffer.subarray(8, 12).toString('ascii') === 'WEBP')
|
|
3738
|
+
return 'image/webp';
|
|
3739
|
+
return null;
|
|
3740
|
+
}
|
|
3712
3741
|
function finiteDecimalSetting(value, label) { try {
|
|
3713
3742
|
const parsed = new Decimal(value);
|
|
3714
3743
|
if (parsed.isFinite())
|