@c8y/ngx-components
Version:
Angular modules for Cumulocity IoT applications
219 lines (213 loc) • 11.1 kB
JavaScript
import * as i1 from '@c8y/ngx-components';
import { gettext, Permissions, ProviderConfigurationModule, hookPatternMessages } from '@c8y/ngx-components';
import * as i0 from '@angular/core';
import { Injectable, NgModule } from '@angular/core';
const MESSAGES_SMS_GATEWAY = {
'^Sender name$': {
gettext: gettext('Sender name')
},
'^Sender name used for sent SMS$': {
gettext: gettext('Sender name used for sent SMS')
},
'^Sender address$': {
gettext: gettext('Sender address')
},
'^Sender address used for sent SMS$': {
gettext: gettext('Sender address used for sent SMS')
},
'^Username$': {
gettext: gettext('Username')
},
'^Password$': {
gettext: gettext('Password')
},
'^Licence key$': {
gettext: gettext('License key')
},
'^Key$': {
gettext: gettext('Key')
},
'^API base URL$': {
gettext: gettext('API base URL')
},
'^API URL$': {
gettext: gettext('API URL')
},
'^oauth$': {
gettext: gettext('OAuth')
},
'^basic$': {
gettext: gettext('Basic')
},
'^Authentication method$': {
gettext: gettext('Authentication method')
},
'^Defines which authentication method is used with the provider$': {
gettext: gettext('Defines which authentication method is used with the provider')
},
'^Static headers$': {
gettext: gettext('Static headers')
},
'^Static headers that should be added to requests towards the provider$': {
gettext: gettext('Static headers that should be added to requests towards the provider')
},
'^OAuth token URL$': {
gettext: gettext('OAuth token URL')
},
'^URL where the OAuth token is requested from (required if OAuth method is chosen)$': {
gettext: gettext('URL where the OAuth token is requested from (required if OAuth method is selected)')
},
'^OAuth toke mime type$': {
gettext: gettext('OAuth token mime type')
},
'^Overrides the OAuth token response mime type$': {
gettext: gettext('Overrides the OAuth token response mime type')
},
'^OAuth access toke type$': {
gettext: gettext('OAuth access token type')
},
'^Overrides the OAuth access token type$': {
gettext: gettext('Overrides the OAuth access token type')
},
'^Global configuration$': {
gettext: gettext('Global configuration')
},
'^Enables or disables if the settings may be used globally for all tenants (Only possible in management tenant)$': {
gettext: gettext('Enables or disables the settings globally for all tenants (only possible in management tenant)')
},
'^API key$': {
gettext: gettext('API key')
},
'^Inherit to subtenants$': {
gettext: gettext('Inherit to subtenants')
},
"^Enables or disables if this tenant's configuration may be inherited to subtenants$": {
gettext: gettext('Enables or disables the option to inherit the tenant configuration to subtenants')
},
'^Login$': {
gettext: gettext('Login')
},
'^Source business unit ID$': {
gettext: gettext('Source business unit ID')
},
'^Client ID$': {
gettext: gettext('Client ID')
},
'^Client secret$': {
gettext: gettext('Client secret')
}
};
class SmsGatewayGuard {
static { this.applicationName = 'sms-gateway'; }
constructor(permissions, appState) {
this.permissions = permissions;
this.appState = appState;
}
canActivate() {
if (this.showSMSProvider === undefined) {
const hasRole = Promise.resolve(this.permissions.hasRole(Permissions.ROLE_SMS_READ));
this.showSMSProvider = hasRole.then((hasPermissions) => hasPermissions && this.appState.isApplicationAvailable(SmsGatewayGuard.applicationName));
}
return this.showSMSProvider;
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SmsGatewayGuard, deps: [{ token: i1.Permissions }, { token: i1.AppStateService }], target: i0.ɵɵFactoryTarget.Injectable }); }
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SmsGatewayGuard }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SmsGatewayGuard, decorators: [{
type: Injectable
}], ctorParameters: () => [{ type: i1.Permissions }, { type: i1.AppStateService }] });
class SmsGatewayModule {
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SmsGatewayModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.14", ngImport: i0, type: SmsGatewayModule, imports: [i1.ProviderConfigurationModule] }); }
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SmsGatewayModule, providers: [SmsGatewayGuard, hookPatternMessages(MESSAGES_SMS_GATEWAY)], imports: [ProviderConfigurationModule.config([
{
navigation: {
label: gettext('SMS provider'),
path: 'smsgateway',
icon: 'envelope-o',
parent: gettext('Settings'),
priority: 1000,
canActivate: [SmsGatewayGuard]
},
layout: {
pageTitle: gettext('SMS provider'),
cardTitle: gettext('Credentials'),
description: gettext('Enter your credentials from your SMS provider. This enables platform features that utilize SMS services (for example, two-factor authentication and user notifications).'),
providerName: gettext('SMS provider'),
providerNamePlaceholder: gettext('Select or type to filter providers'),
providerNameNoMatchesHint: gettext('Select one of the existing providers.'),
deleteRoles: [Permissions.ROLE_SMS_ADMIN],
deleteBtnLabel: gettext('Delete'),
saveRoles: [Permissions.ROLE_SMS_ADMIN],
saveBtnLabel: gettext('Save'),
configurationUpdatedSuccessMsg: gettext('Credentials updated.'),
deleteConfigurationModalTitle: gettext('Delete credentials'),
deleteConfigurationModalBody: gettext(`You are about to delete SMS provider credentials. Deleting credentials will lock out any users with SMS-based two-factor authentication and deactivate the SMS-based smart rules and device communication. Do you want to proceed?`),
deleteConfigurationModalOkBtnLabel: gettext('Delete'),
configurationDeletedSuccessMsg: gettext('Credentials deleted.')
},
endpoint: {
definitionsEndpoint: {
baseUrl: 'service/messaging/providers',
listUrl: 'definitions'
},
configurationEndpoint: {
baseUrl: 'service/messaging/providers',
listUrl: 'configuration'
}
}
}
])] }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImport: i0, type: SmsGatewayModule, decorators: [{
type: NgModule,
args: [{
imports: [
ProviderConfigurationModule.config([
{
navigation: {
label: gettext('SMS provider'),
path: 'smsgateway',
icon: 'envelope-o',
parent: gettext('Settings'),
priority: 1000,
canActivate: [SmsGatewayGuard]
},
layout: {
pageTitle: gettext('SMS provider'),
cardTitle: gettext('Credentials'),
description: gettext('Enter your credentials from your SMS provider. This enables platform features that utilize SMS services (for example, two-factor authentication and user notifications).'),
providerName: gettext('SMS provider'),
providerNamePlaceholder: gettext('Select or type to filter providers'),
providerNameNoMatchesHint: gettext('Select one of the existing providers.'),
deleteRoles: [Permissions.ROLE_SMS_ADMIN],
deleteBtnLabel: gettext('Delete'),
saveRoles: [Permissions.ROLE_SMS_ADMIN],
saveBtnLabel: gettext('Save'),
configurationUpdatedSuccessMsg: gettext('Credentials updated.'),
deleteConfigurationModalTitle: gettext('Delete credentials'),
deleteConfigurationModalBody: gettext(`You are about to delete SMS provider credentials. Deleting credentials will lock out any users with SMS-based two-factor authentication and deactivate the SMS-based smart rules and device communication. Do you want to proceed?`),
deleteConfigurationModalOkBtnLabel: gettext('Delete'),
configurationDeletedSuccessMsg: gettext('Credentials deleted.')
},
endpoint: {
definitionsEndpoint: {
baseUrl: 'service/messaging/providers',
listUrl: 'definitions'
},
configurationEndpoint: {
baseUrl: 'service/messaging/providers',
listUrl: 'configuration'
}
}
}
])
],
providers: [SmsGatewayGuard, hookPatternMessages(MESSAGES_SMS_GATEWAY)]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { MESSAGES_SMS_GATEWAY, SmsGatewayGuard, SmsGatewayModule };
//# sourceMappingURL=c8y-ngx-components-sms-gateway.mjs.map