import { Plugin, SchemaComponent } from '@nocobase/client';
import PluginVerificationClient from '@nocobase/plugin-verification/client';
import React from 'react';
const CustomSMSProviderSettingsForm: React.FC = () => {
return <SchemaComponent schema={{
type: 'void',
properties: {
accessKeyId: {
title: `{{t("Access Key ID", { ns: "${NAMESPACE}" })}}`,
type: 'string',
'x-decorator': 'FormItem',
'x-component': 'TextAreaWithGlobalScope',
required: true,
},
accessKeySecret: {
title: `{{t("Access Key Secret", { ns: "${NAMESPACE}" })}}`,
type: 'string',
'x-decorator': 'FormItem',
'x-component': 'TextAreaWithGlobalScope',
'x-component-props': { password: true },
required: true,
},
}
}} />
}
class PluginCustomSMSProviderClient extends Plugin {
async load() {
const plugin = this.app.pm.get('verification') as PluginVerificationClient;
plugin.smsOTPProviderManager.registerProvider('custom-sms-provider-name', {
components: {
AdminSettingsForm: CustomSMSProviderSettingsForm,
},
});
}
}