This commit is contained in:
Park Byung Eun 2020-08-10 14:05:57 +09:00
parent 62314da2ad
commit 0c9867beb9
416 changed files with 7971 additions and 4423 deletions

View File

@ -1526,6 +1526,166 @@
}
}
}
},
"api-webex": {
"projectType": "library",
"root": "projects/api-webex",
"sourceRoot": "projects/api-webex/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/api-webex/tsconfig.lib.json",
"project": "projects/api-webex/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/api-webex/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/api-webex/src/test.ts",
"tsConfig": "projects/api-webex/tsconfig.spec.json",
"karmaConfig": "projects/api-webex/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/api-webex/tsconfig.lib.json",
"projects/api-webex/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"ui-call": {
"projectType": "library",
"root": "projects/ui-call",
"sourceRoot": "projects/ui-call/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/ui-call/tsconfig.lib.json",
"project": "projects/ui-call/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/ui-call/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/ui-call/src/test.ts",
"tsConfig": "projects/ui-call/tsconfig.spec.json",
"karmaConfig": "projects/ui-call/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/ui-call/tsconfig.lib.json",
"projects/ui-call/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"api-contact": {
"projectType": "library",
"root": "projects/api-contact",
"sourceRoot": "projects/api-contact/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/api-contact/tsconfig.lib.json",
"project": "projects/api-contact/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/api-contact/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/api-contact/src/test.ts",
"tsConfig": "projects/api-contact/tsconfig.spec.json",
"karmaConfig": "projects/api-contact/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/api-contact/tsconfig.lib.json",
"projects/api-contact/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"store-call": {
"projectType": "library",
"root": "projects/store-call",
"sourceRoot": "projects/store-call/src",
"prefix": "lib",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "projects/store-call/tsconfig.lib.json",
"project": "projects/store-call/ng-package.json"
},
"configurations": {
"production": {
"tsConfig": "projects/store-call/tsconfig.lib.prod.json"
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/store-call/src/test.ts",
"tsConfig": "projects/store-call/tsconfig.spec.json",
"karmaConfig": "projects/store-call/karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"projects/store-call/tsconfig.lib.json",
"projects/store-call/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"cli": {

4613
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -7,12 +7,14 @@
"start": "ng serve",
"build": "ng build",
"build:all": "npm-run-all -s build:logger build:core build:util:all build:api:all build:protocol:all build:native:all build:store:all build:ui-material:all build:ui:all build:ui-skin:all",
"build:api:all": "npm-run-all -s build:api-common build:api-external build:api-message build:api-prompt build:api-public build:pi",
"build:api:all": "npm-run-all -s build:api-common build:api-external build:api-message build:api-prompt build:api-webex build:api-contact build:api-public build:pi",
"build:api-common": "node ./scripts/build.js api-common",
"build:api-external": "node ./scripts/build.js api-external",
"build:api-message": "node ./scripts/build.js api-message",
"build:api-prompt": "node ./scripts/build.js api-prompt",
"build:api-public": "node ./scripts/build.js api-public",
"build:api-webex": "node ./scripts/build.js api-webex",
"build:api-contact": "node ./scripts/build.js api-contact",
"build:pi": "node ./scripts/build.js pi",
"build:core": "node ./scripts/build.js core",
"build:logger": "node ./scripts/build.js logger",
@ -39,28 +41,32 @@
"build:web-socket": "node ./scripts/build.js web-socket",
"build:web-storage": "node ./scripts/build.js web-storage",
"build:i18n": "node ./scripts/build.js i18n",
"build:store:all": "npm-run-all -s build:store-authentication build:store-organization build:store-group build:store-chat",
"build:store:all": "npm-run-all -s build:store-authentication build:store-organization build:store-group build:store-chat build:store-call",
"build:store-authentication": "node ./scripts/build.js store-authentication",
"build:store-chat": "node ./scripts/build.js store-chat",
"build:store-group": "node ./scripts/build.js store-group",
"build:store-organization": "node ./scripts/build.js store-organization",
"build:store-call": "node ./scripts/build.js store-call",
"build:ui-material:all": "npm-run-all -s build:ui-material",
"build:ui-material": "node ./scripts/build.js ui-material useScssBundle",
"build:ui:all": "npm-run-all -s build:ui build:ui-organization build:ui-authentication build:ui-group build:ui-chat",
"build:ui:all": "npm-run-all -s build:ui build:ui-organization build:ui-authentication build:ui-group build:ui-chat build:ui-call",
"build:ui": "node ./scripts/build.js ui useScssBundle",
"build:ui-organization": "node ./scripts/build.js ui-organization useScssBundle",
"build:ui-authentication": "node ./scripts/build.js ui-authentication useScssBundle",
"build:ui-group": "node ./scripts/build.js ui-group useScssBundle",
"build:ui-chat": "node ./scripts/build.js ui-chat useScssBundle",
"build:ui-call": "node ./scripts/build.js ui-call useScssBundle",
"build:ui-skin:all": "npm-run-all -s build:ui-skin-default",
"build:ui-skin-default": "node ./scripts/build.js ui-skin-default useScssBundle",
"publish:all": "npm-run-all -s publish:logger publish:core publish:util:all publish:api:all publish:protocol:all publish:native:all publish:store:all publish:ui-material:all publish:ui:all publish:ui-skin:all",
"publish:api:all": "npm-run-all -s publish:api-common publish:api-external publish:api-message publish:api-prompt publish:api-public publish:pi",
"publish:api:all": "npm-run-all -s publish:api-common publish:api-external publish:api-message publish:api-prompt publish:api-webex publish:api-contact publish:api-public publish:pi",
"publish:api-common": "cd ./dist/api-common && npm publish",
"publish:api-external": "cd ./dist/api-external && npm publish",
"publish:api-message": "cd ./dist/api-message && npm publish",
"publish:api-prompt": "cd ./dist/api-prompt && npm publish",
"publish:api-public": "cd ./dist/api-public && npm publish",
"publish:api-webex": "cd ./dist/api-webex && npm publish",
"publish:api-contact": "cd ./dist/api-contact && npm publish",
"publish:pi": "cd ./dist/pi && npm publish",
"publish:core": "cd ./dist/core && npm publish",
"publish:logger": "cd ./dist/logger && npm publish",
@ -87,19 +93,21 @@
"publish:web-socket": "cd ./dist/web-socket && npm publish",
"publish:web-storage": "cd ./dist/web-storage && npm publish",
"publish:i18n": "cd ./dist/i18n && npm publish",
"publish:store:all": "npm-run-all -s publish:store-organization publish:store-authentication publish:store-group publish:store-chat",
"publish:store:all": "npm-run-all -s publish:store-organization publish:store-authentication publish:store-group publish:store-chat publish:store-call",
"publish:store-authentication": "cd ./dist/store-authentication && npm publish",
"publish:store-chat": "cd ./dist/store-chat && npm publish",
"publish:store-group": "cd ./dist/store-group && npm publish",
"publish:store-organization": "cd ./dist/store-organization && npm publish",
"publish:store-call": "cd ./dist/store-call && npm publish",
"publish:ui-material:all": "npm-run-all -s publish:ui-material",
"publish:ui-material": "cd ./dist/ui-material && npm publish",
"publish:ui:all": "npm-run-all -s publish:ui publish:ui-organization publish:ui-authentication publish:ui-group publish:ui-chat",
"publish:ui:all": "npm-run-all -s publish:ui publish:ui-organization publish:ui-authentication publish:ui-group publish:ui-chat publish:ui-call",
"publish:ui": "cd ./dist/ui && npm publish",
"publish:ui-organization": "cd ./dist/ui-organization && npm publish",
"publish:ui-authentication": "cd ./dist/ui-authentication && npm publish",
"publish:ui-group": "cd ./dist/ui-group && npm publish",
"publish:ui-chat": "cd ./dist/ui-chat && npm publish",
"publish:ui-call": "cd ./dist/ui-call && npm publish",
"publish:ui-skin:all": "npm-run-all -s publish:ui-skin-default",
"publish:ui-skin-default": "cd ./dist/ui-skin-default && npm publish",
"test": "ng test",
@ -108,7 +116,9 @@
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook"
},
"dependencies": {},
"dependencies": {
"tslib": "^1.10.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.900.6",
"@angular-devkit/build-ng-packagr": "^0.900.6",
@ -143,24 +153,38 @@
"@types/jasminewd2": "~2.0.3",
"@types/moment-timezone": "^0.5.12",
"@types/node": "^12.12.30",
"@ucap/api": "~0.0.1",
"@ucap/api-common": "~0.0.7",
"@ucap/api-external": "~0.0.2",
"@ucap/api-message": "~0.0.1",
"@ucap/api-prompt": "~0.0.1",
"@ucap/api-public": "~0.0.1",
"@ucap/core": "~0.0.14",
"@ucap/logger": "~0.0.12",
"@ucap/native": "~0.0.19",
"@ucap/api": "~0.0.5",
"@ucap/api-common": "~0.0.12",
"@ucap/api-contact": "~0.0.5",
"@ucap/api-external": "~0.0.8",
"@ucap/api-message": "~0.0.7",
"@ucap/api-prompt": "~0.0.6",
"@ucap/api-public": "~0.0.6",
"@ucap/api-webex": "~0.0.2",
"@ucap/core": "~0.0.15",
"@ucap/domain-authentication": "~0.0.4",
"@ucap/domain-authorization": "~0.0.3",
"@ucap/domain-call": "~0.0.4",
"@ucap/domain-chat": "~0.0.3",
"@ucap/domain-common": "~0.0.1",
"@ucap/domain-group": "~0.0.2",
"@ucap/domain-message": "~0.0.1",
"@ucap/domain-organization": "~0.0.1",
"@ucap/domain-status": "~0.0.1",
"@ucap/i18n": "~0.0.2",
"@ucap/logger": "~0.0.14",
"@ucap/native": "~0.0.27",
"@ucap/ng-api-common": "file:pack/ucap-ng-api-common-0.0.1.tgz",
"@ucap/ng-api-contact": "file:pack/ucap-ng-api-contact-0.0.2.tgz",
"@ucap/ng-api-external": "file:pack/ucap-ng-api-external-0.0.1.tgz",
"@ucap/ng-api-message": "file:pack/ucap-ng-api-message-0.0.1.tgz",
"@ucap/ng-api-prompt": "file:pack/ucap-ng-api-prompt-0.0.1.tgz",
"@ucap/ng-api-public": "file:pack/ucap-ng-api-public-0.0.1.tgz",
"@ucap/ng-core": "file:pack/ucap-ng-core-0.0.7.tgz",
"@ucap/ng-i18n": "file:pack/ucap-ng-i18n-0.0.6.tgz",
"@ucap/ng-api-webex": "file:pack/ucap-ng-api-webex-0.0.1.tgz",
"@ucap/ng-core": "file:pack/ucap-ng-core-0.0.9.tgz",
"@ucap/ng-i18n": "file:pack/ucap-ng-i18n-0.0.8.tgz",
"@ucap/ng-logger": "file:pack/ucap-ng-logger-0.0.2.tgz",
"@ucap/ng-native": "file:pack/ucap-ng-native-0.0.5.tgz",
"@ucap/ng-native": "file:pack/ucap-ng-native-0.0.12.tgz",
"@ucap/ng-pi": "file:pack/ucap-ng-pi-0.0.1.tgz",
"@ucap/ng-protocol": "file:pack/ucap-ng-protocol-0.0.3.tgz",
"@ucap/ng-protocol-authentication": "file:pack/ucap-ng-protocol-authentication-0.0.3.tgz",
@ -178,39 +202,41 @@
"@ucap/ng-protocol-status": "file:pack/ucap-ng-protocol-status-0.0.3.tgz",
"@ucap/ng-protocol-sync": "file:pack/ucap-ng-protocol-sync-0.0.3.tgz",
"@ucap/ng-protocol-umg": "file:pack/ucap-ng-protocol-umg-0.0.3.tgz",
"@ucap/ng-store-authentication": "file:pack/ucap-ng-store-authentication-0.0.14.tgz",
"@ucap/ng-store-chat": "file:pack/ucap-ng-store-chat-0.0.66.tgz",
"@ucap/ng-store-group": "file:pack/ucap-ng-store-group-0.0.22.tgz",
"@ucap/ng-store-organization": "file:pack/ucap-ng-store-organization-0.0.20.tgz",
"@ucap/ng-ui": "file:pack/ucap-ng-ui-0.0.97.tgz",
"@ucap/ng-ui-authentication": "file:pack/ucap-ng-ui-authentication-0.0.29.tgz",
"@ucap/ng-ui-chat": "file:pack/ucap-ng-ui-chat-0.0.72.tgz",
"@ucap/ng-ui-group": "file:pack/ucap-ng-ui-group-0.0.78.tgz",
"@ucap/ng-store-authentication": "file:pack/ucap-ng-store-authentication-0.0.17.tgz",
"@ucap/ng-store-call": "file:pack/ucap-ng-store-call-0.0.7.tgz",
"@ucap/ng-store-chat": "file:pack/ucap-ng-store-chat-0.0.74.tgz",
"@ucap/ng-store-group": "file:pack/ucap-ng-store-group-0.0.25.tgz",
"@ucap/ng-store-organization": "file:pack/ucap-ng-store-organization-0.0.23.tgz",
"@ucap/ng-ui": "file:pack/ucap-ng-ui-0.0.108.tgz",
"@ucap/ng-ui-authentication": "file:pack/ucap-ng-ui-authentication-0.0.32.tgz",
"@ucap/ng-ui-call": "file:pack/ucap-ng-ui-call-0.0.15.tgz",
"@ucap/ng-ui-chat": "file:pack/ucap-ng-ui-chat-0.0.80.tgz",
"@ucap/ng-ui-group": "file:pack/ucap-ng-ui-group-0.0.87.tgz",
"@ucap/ng-ui-material": "file:pack/ucap-ng-ui-material-0.0.4.tgz",
"@ucap/ng-ui-organization": "file:pack/ucap-ng-ui-organization-0.0.202.tgz",
"@ucap/ng-ui-organization": "file:pack/ucap-ng-ui-organization-0.0.222.tgz",
"@ucap/ng-ui-skin-default": "file:pack/ucap-ng-ui-skin-default-0.0.1.tgz",
"@ucap/ng-web-socket": "file:pack/ucap-ng-web-socket-0.0.2.tgz",
"@ucap/ng-web-storage": "file:pack/ucap-ng-web-storage-0.0.3.tgz",
"@ucap/pi": "~0.0.8",
"@ucap/protocol": "~0.0.11",
"@ucap/protocol-authentication": "~0.0.5",
"@ucap/protocol-buddy": "~0.0.5",
"@ucap/protocol-event": "~0.0.6",
"@ucap/protocol-file": "~0.0.6",
"@ucap/protocol-group": "~0.0.5",
"@ucap/protocol-info": "~0.0.9",
"@ucap/protocol-inner": "~0.0.4",
"@ucap/protocol-option": "~0.0.7",
"@ucap/protocol-ping": "~0.0.4",
"@ucap/protocol-query": "~0.0.5",
"@ucap/protocol-room": "~0.0.7",
"@ucap/protocol-service": "~0.0.4",
"@ucap/protocol-status": "~0.0.5",
"@ucap/protocol-sync": "~0.0.6",
"@ucap/pi": "~0.0.9",
"@ucap/protocol": "~0.0.20",
"@ucap/protocol-authentication": "~0.0.7",
"@ucap/protocol-buddy": "~0.0.6",
"@ucap/protocol-event": "~0.0.11",
"@ucap/protocol-file": "~0.0.7",
"@ucap/protocol-group": "~0.0.6",
"@ucap/protocol-info": "~0.0.10",
"@ucap/protocol-inner": "~0.0.5",
"@ucap/protocol-option": "~0.0.9",
"@ucap/protocol-ping": "~0.0.7",
"@ucap/protocol-query": "~0.0.8",
"@ucap/protocol-room": "~0.0.9",
"@ucap/protocol-service": "~0.0.5",
"@ucap/protocol-status": "~0.0.6",
"@ucap/protocol-sync": "~0.0.8",
"@ucap/protocol-umg": "~0.0.5",
"@ucap/ui-scss": "~0.0.5",
"@ucap/web-socket": "~0.0.5",
"@ucap/web-storage": "~0.0.5",
"@ucap/web-socket": "~0.0.10",
"@ucap/web-storage": "~0.0.9",
"autolinker": "^3.13.0",
"axios": "^0.19.2",
"babel-loader": "^8.1.0",

View File

@ -0,0 +1,24 @@
# ApiContact
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.11.
## Code scaffolding
Run `ng generate component component-name --project api-contact` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project api-contact`.
> Note: Don't forget to add `--project api-contact` or else it will be added to the default project in your `angular.json` file.
## Build
Run `ng build api-contact` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
After building your library with `ng build api-contact`, go to the dist folder `cd dist/api-contact` and run `npm publish`.
## Running unit tests
Run `ng test api-contact` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

View File

@ -0,0 +1,32 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/api-contact'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

View File

@ -0,0 +1,11 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/api-contact",
"lib": {
"entryFile": "src/public-api.ts",
"umdModuleIds": {
"@ucap/api-contact": "@ucap/api-contact",
"@ucap/ng-core": "@ucap/ng-core"
}
}
}

View File

@ -0,0 +1,16 @@
{
"name": "@ucap/ng-api-contact",
"version": "0.0.2",
"publishConfig": {
"registry": "https://nexus.loafle.net/repository/npm-ucap/"
},
"peerDependencies": {
"@angular/common": "^9.0.2",
"@angular/core": "^9.0.2",
"@ucap/api-contact": "~0.0.1",
"@ucap/ng-core": "~0.0.1",
"axios": "^0.19.2",
"rxjs": "~6.5.4",
"tslib": "^1.10.0"
}
}

View File

@ -0,0 +1,5 @@
import { InjectionToken } from '@angular/core';
export const _MODULE_CONFIG = new InjectionToken(
'@ucap/ng api-contact config of module'
);

View File

@ -0,0 +1,24 @@
import { NgModule, ModuleWithProviders } from '@angular/core';
import { ModuleConfig } from '@ucap/api-contact';
import { _MODULE_CONFIG } from './config/token';
import { ContactApiService } from './services/contact-api.service';
const SERVICES = [ContactApiService];
@NgModule({})
export class ContactApiRootModule {}
@NgModule({})
export class ContactApiModule {
public static forRoot(
config: ModuleConfig
): ModuleWithProviders<ContactApiRootModule> {
return {
ngModule: ContactApiRootModule,
providers: [{ provide: _MODULE_CONFIG, useValue: config }, ...SERVICES]
};
}
}

View File

@ -0,0 +1,24 @@
import { TestBed } from '@angular/core/testing';
import { AXIOS_INSTANCE } from '@ucap/ng-core';
import { ContactApiService } from './contact-api.service';
import { _MODULE_CONFIG } from '../config/token';
describe('ContactApiService', () => {
let service: ContactApiService;
beforeEach(() => {
TestBed.configureTestingModule({
providers: [
{ provide: _MODULE_CONFIG, useValue: _MODULE_CONFIG },
{ provide: AXIOS_INSTANCE, useValue: AXIOS_INSTANCE }
]
});
service = TestBed.inject(ContactApiService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});

View File

@ -0,0 +1,24 @@
import { Injectable, Inject } from '@angular/core';
import { AxiosInstance } from 'axios';
import {
ModuleConfig,
ContactApiService as UcapContactApiService
} from '@ucap/api-contact';
import { AXIOS_INSTANCE } from '@ucap/ng-core';
import { _MODULE_CONFIG } from '../config/token';
@Injectable({
providedIn: 'root'
})
export class ContactApiService extends UcapContactApiService {
constructor(
@Inject(_MODULE_CONFIG) moduleConfig: ModuleConfig,
@Inject(AXIOS_INSTANCE) axios: AxiosInstance
) {
super(moduleConfig, axios);
}
}

View File

@ -0,0 +1,6 @@
/*
* Public API Surface of api-contact
*/
export * from './lib/services/contact-api.service';
export * from './lib/contact-api.module';

View File

@ -0,0 +1,26 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

View File

@ -0,0 +1,23 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"declaration": true,
"inlineSources": true,
"types": [],
"lib": [
"dom",
"es2018"
]
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"enableResourceInlining": true
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}

View File

@ -0,0 +1,6 @@
{
"extends": "./tsconfig.lib.json",
"angularCompilerOptions": {
"enableIvy": false
}
}

View File

@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"src/test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

View File

@ -0,0 +1,17 @@
{
"extends": "../../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"lib",
"camelCase"
],
"component-selector": [
true,
"element",
"lib",
"kebab-case"
]
}
}

View File

@ -0,0 +1,24 @@
# ApiWebex
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.11.
## Code scaffolding
Run `ng generate component component-name --project api-webex` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project api-webex`.
> Note: Don't forget to add `--project api-webex` or else it will be added to the default project in your `angular.json` file.
## Build
Run `ng build api-webex` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
After building your library with `ng build api-webex`, go to the dist folder `cd dist/api-webex` and run `npm publish`.
## Running unit tests
Run `ng test api-webex` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

View File

@ -0,0 +1,32 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/api-webex'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

View File

@ -0,0 +1,11 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/api-webex",
"lib": {
"entryFile": "src/public-api.ts",
"umdModuleIds": {
"@ucap/api-webex": "@ucap/api-webex",
"@ucap/ng-core": "@ucap/ng-core"
}
}
}

View File

@ -0,0 +1,16 @@
{
"name": "@ucap/ng-api-webex",
"version": "0.0.1",
"publishConfig": {
"registry": "https://nexus.loafle.net/repository/npm-ucap/"
},
"peerDependencies": {
"@angular/common": "^9.0.2",
"@angular/core": "^9.0.2",
"@ucap/api-webex": "~0.0.1",
"@ucap/ng-core": "~0.0.1",
"axios": "^0.19.2",
"rxjs": "~6.5.4",
"tslib": "^1.10.0"
}
}

View File

@ -0,0 +1,5 @@
import { InjectionToken } from '@angular/core';
export const _MODULE_CONFIG = new InjectionToken(
'@ucap/ng-api-webex config of module'
);

View File

@ -0,0 +1,17 @@
import { Injectable, Inject } from '@angular/core';
import {
ModuleConfig,
ConferenceService as UcapConferenceService
} from '@ucap/api-webex';
import { _MODULE_CONFIG } from '../config/token';
@Injectable({
providedIn: 'root'
})
export class ConferenceService extends UcapConferenceService {
constructor(@Inject(_MODULE_CONFIG) moduleConfig: ModuleConfig) {
super(moduleConfig);
}
}

View File

@ -0,0 +1,24 @@
import { NgModule, ModuleWithProviders } from '@angular/core';
import { ModuleConfig } from '@ucap/api-webex';
import { _MODULE_CONFIG } from './config/token';
import { ConferenceService } from './services/conference.service';
const SERVICES = [ConferenceService];
@NgModule({})
export class WebexApiRootModule {}
@NgModule({})
export class WebexApiModule {
public static forRoot(
config: ModuleConfig
): ModuleWithProviders<WebexApiRootModule> {
return {
ngModule: WebexApiRootModule,
providers: [{ provide: _MODULE_CONFIG, useValue: config }, ...SERVICES]
};
}
}

View File

@ -0,0 +1,7 @@
/*
* Public API Surface of api-webex
*/
export * from './lib/services/conference.service';
export * from './lib/webex-api.module';

View File

@ -0,0 +1,26 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

View File

@ -0,0 +1,23 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"declaration": true,
"inlineSources": true,
"types": [],
"lib": [
"dom",
"es2018"
]
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"enableResourceInlining": true
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}

View File

@ -0,0 +1,6 @@
{
"extends": "./tsconfig.lib.json",
"angularCompilerOptions": {
"enableIvy": false
}
}

View File

@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"src/test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

View File

@ -0,0 +1,17 @@
{
"extends": "../../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"lib",
"camelCase"
],
"component-selector": [
true,
"element",
"lib",
"kebab-case"
]
}
}

View File

@ -1,6 +1,6 @@
{
"name": "@ucap/ng-core",
"version": "0.0.7",
"version": "0.0.9",
"publishConfig": {
"registry": "https://nexus.loafle.net/repository/npm-ucap/"
},

View File

@ -5,12 +5,43 @@ import { StringUtil as UcapStringUtil } from '@ucap/core';
export class StringUtil extends UcapStringUtil {
public static checkSpecialCharacter(): ValidatorFn {
const fn = (control: AbstractControl): { [key: string]: any } | null => {
const forbidden = /[\{\}\[\]\/?.;:|\)*~`!^+<>@\#$%&\\\=\(\'\"]/g.test(
control.value
);
// const forbidden = /[\{\}\[\]\/?.;:|\)*~`!^+<>@\#$%&\\\=\(\'\"]/g.test(
// control.value
// );
const forbidden = new RegExp(
'[\\{\\}\\[\\]\\/?.;:|\\)*~`!^+<>@\\#$%&\\\\\\=\\(\\\'\\"|\\u00a1-' +
'\\u00ac|\\u00ae-\\u00ff|\\u0100-\\u017f|\\u0180-\\u024f|\\' +
'u1e02-\\u1ef3|\\u0259-\\u0292|\\u02b0-\\u02ff|\\u0370-\\u' +
'03ff|\\u1f00-\\u1fff|\\u0400-\\u04ff|\\u2013-\\u204a|\\u2' +
'010-\\u206f|\\u2070-\\u209f|\\u20a0-\\u20bf|\\u2100-\\u21' +
'4f|\\u2150-\\u218f|\\u2190-\\u21ff|\\u2200-\\u22ff|\\u230' +
'0-\\u23ff|\\u2460-\\u24ff|\\u2500-\\u257f|\\u2580-\\u259f' +
'|\\u25a0-\\u25ff|\\u2600-\\u26ff|\\u3041-\\u309f|\\u30a0-' +
'\\u30ff|\\u3100-\\u312f|\\u2e80-\\u2eff|\\u31c0-\\u31ef|\\' +
'u3000-\\u303f|\\u3200-\\u32ff|\\uff00-\\uffef|\\u3190-\\u' +
'319f|\\u2f00-\\u2fdf|\\u31f0-\\u31ff|\\ua4d0-\\ua4ff|\\ua' +
'700-\\ua71f|\\ufe50-\\ufe6f|\\ufe10-\\ufe1f|\\ua000-\\ua4' +
'8c|\\ua490-\\ua4cf|\\u33c2-\\u33d8]',
'g'
).test(control.value);
return forbidden ? { groupName: { value: control.value } } : null;
};
return fn;
}
public static getProfileSubDir(info: string): string {
let imgUrl: string;
const tempImgInfo: string = info.toLowerCase();
const findIdx = tempImgInfo.indexOf('profileimage');
if (findIdx > -1) {
const startIdx = info.indexOf('/', findIdx);
imgUrl = info.substring(startIdx);
} else {
imgUrl = info;
}
return imgUrl;
}
}

View File

@ -6,6 +6,7 @@
"umdModuleIds": {
"i18next": "i18next",
"@ucap/core": "@ucap/core",
"@ucap/i18n": "@ucap/i18n",
"@ucap/ng-logger": "@ucap/ng-logger"
}
}

View File

@ -1,12 +1,13 @@
{
"name": "@ucap/ng-i18n",
"version": "0.0.6",
"version": "0.0.8",
"publishConfig": {
"registry": "https://nexus.loafle.net/repository/npm-ucap/"
},
"peerDependencies": {
"@angular/common": "^9.0.6",
"@angular/core": "^9.0.6",
"@ucap/i18n": "~0.0.1",
"i18next": "^19.3.2",
"tslib": "^1.10.0"
}

View File

@ -1,7 +1,8 @@
import { NgModule, ModuleWithProviders } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ModuleConfig } from './config/module-config';
import { ModuleConfig } from '@ucap/i18n';
import { _MODULE_CONFIG } from './config/token';
import { I18nPipe } from './pipes/i18n.pipe';

View File

@ -1,254 +1,16 @@
import { BehaviorSubject, Subject, Observable } from 'rxjs';
import { share } from 'rxjs/operators';
import { Injectable, OnDestroy, Inject } from '@angular/core';
import { Injectable, OnDestroy } from '@angular/core';
import { ModuleConfig, I18nService as UCAPI18nService } from '@ucap/i18n';
import i18next, {
InitOptions,
Module,
Newable,
ThirdPartyModule,
TOptions,
StringMap
} from 'i18next';
import { LogService } from '@ucap/ng-logger';
import { I18nextEvents } from '../types/i18next.event';
import { _MODULE_CONFIG } from '../config/token';
@Injectable()
export class I18nService implements OnDestroy {
readonly initialized$: Observable<InitOptions>;
readonly loaded$: Observable<boolean>;
readonly failedLoading$: Observable<{
lng: string;
ns: string;
msg: string;
}>;
readonly missingKey$: Observable<{
lngs: string[];
ns: string;
key: string;
res: string;
}>;
readonly added$: Observable<{ lng: string; ns: string }>;
readonly removed$: Observable<{ lng: string; ns: string }>;
readonly languageChanged$: Observable<string>;
get options(): InitOptions {
return i18next.options;
}
get currentLng(): string {
return this._currentLng;
}
private readonly initializedSubject = new BehaviorSubject<InitOptions>(null);
private readonly loadedSubject = new BehaviorSubject<boolean>(false);
private readonly failedLoadingSubject = new Subject<{
lng: string;
ns: string;
msg: string;
}>();
private readonly missingKeySubject = new Subject<{
lngs: string[];
ns: string;
key: string;
res: string;
}>();
private readonly addedSubject = new Subject<{ lng: string; ns: string }>();
private readonly removedSubject = new Subject<{ lng: string; ns: string }>();
private readonly languageChangedSubject = new BehaviorSubject<string>(null);
// tslint:disable-next-line: variable-name
private _currentLng: string;
constructor(private logService: LogService) {
this.initialized$ = this.initializedSubject.asObservable().pipe(share());
this.loaded$ = this.loadedSubject.asObservable().pipe(share());
this.failedLoading$ = this.failedLoadingSubject
.asObservable()
.pipe(share());
this.missingKey$ = this.missingKeySubject.asObservable().pipe(share());
this.added$ = this.addedSubject.asObservable().pipe(share());
this.removed$ = this.removedSubject.asObservable().pipe(share());
this.languageChanged$ = this.languageChangedSubject
.asObservable()
.pipe(share());
export class I18nService extends UCAPI18nService implements OnDestroy {
constructor(@Inject(_MODULE_CONFIG) moduleConfig: ModuleConfig) {
super(moduleConfig);
}
ngOnDestroy(): void {
this.initializedSubject.next(null);
this.initializedSubject.complete();
this.loadedSubject.next(null);
this.loadedSubject.complete();
this.failedLoadingSubject.next(null);
this.failedLoadingSubject.complete();
this.missingKeySubject.next(null);
this.missingKeySubject.complete();
this.addedSubject.next(null);
this.addedSubject.complete();
this.removedSubject.next(null);
this.removedSubject.complete();
this.languageChangedSubject.next(null);
this.languageChangedSubject.complete();
}
use<T extends Module>(
module: T | Newable<T> | ThirdPartyModule[] | Newable<ThirdPartyModule>[]
) {
i18next.use(module);
return this;
}
init(options?: InitOptions) {
options = options || {};
this.subscribeEvents();
return i18next.init(options);
}
changeLanguage(lng: string) {
const self = this;
return new Promise<void>((resolve, reject) => {
if (lng === self.currentLng) {
resolve();
return;
}
i18next
.changeLanguage(lng)
.then(v => {
self.logService.info('changeLanguage', lng);
resolve();
})
.catch(reason => {
reject(reason);
});
});
}
loadNamespaces(ns: string | string[]) {
return i18next.loadNamespaces(ns);
}
loadLanguages(lngs: string | string[]) {
return i18next.loadLanguages(lngs);
}
reloadResources(lngs?: string | string[], ns?: string | string[]) {
return i18next.reloadResources(lngs, ns);
}
getResource(
lng: string,
ns: string,
key: string,
options?: { keySeparator?: string }
) {
return i18next.getResource(lng, ns, key, options);
}
addResource(
lng: string,
ns: string,
key: string,
value: string,
options?: { keySeparator?: string }
) {
i18next.addResource(lng, ns, key, value, options);
}
addResources(lng: string, ns: string, resources: any) {
i18next.addResources(lng, ns, resources);
}
addResourceBundle(
lng: string,
ns: string,
resources: any,
deep?: boolean,
overwrite?: boolean
) {
i18next.addResourceBundle(lng, ns, resources, deep, overwrite);
}
hasResourceBundle(lng: string, ns: string) {
return i18next.hasResourceBundle(lng, ns);
}
getResourceBundle(lng: string, ns: string) {
return i18next.getResourceBundle(lng, ns);
}
removeResourceBundle(lng: string, ns: string) {
i18next.removeResourceBundle(lng, ns);
}
t(
key: string | string[],
optionsOrDefault?: string | TOptions<StringMap>
): string;
t(
key: string | string[],
optionsOrDefaultValue?: string,
options?: string | TOptions<StringMap>
): string {
return i18next.t(key, optionsOrDefaultValue, options);
}
format(value: any, format?: string, lng?: string) {
return i18next.format(value, format, lng);
}
exists(key: string | string[], options: TOptions<StringMap>) {
return i18next.exists(key, options);
}
getFixedT(lng: string | string[], ns?: string | string[]) {
return i18next.getFixedT(lng, ns);
}
setDefaultNamespace(ns: string) {
i18next.setDefaultNamespace(ns);
}
dir(lng?: string) {
return i18next.dir(lng);
}
private subscribeEvents() {
// tslint:disable-next-line: variable-name
const __this = this;
i18next.on(I18nextEvents.initialized, options => {
__this.initializedSubject.next(options);
});
i18next.on(I18nextEvents.loaded, loaded => {
__this.loadedSubject.next(loaded);
});
i18next.on(I18nextEvents.failedLoading, (lng, ns, msg) => {
__this.failedLoadingSubject.next({ lng, ns, msg });
});
i18next.on(I18nextEvents.languageChanged, lng => {
__this.languageChangedSubject.next(lng);
this._currentLng = lng;
});
i18next.on(I18nextEvents.missingKey, (lngs, ns, key, res) => {
__this.missingKeySubject.next({ lngs, ns, key, res });
});
i18next.on(I18nextEvents.added, (lng, ns) => {
__this.addedSubject.next({ lng, ns });
});
i18next.on(I18nextEvents.removed, (lng, ns) => {
__this.removedSubject.next({ lng, ns });
});
this.destroy();
}
}

View File

@ -1,9 +0,0 @@
export enum I18nextEvents {
initialized = 'initialized',
loaded = 'loaded',
failedLoading = 'failedLoading',
languageChanged = 'languageChanged',
missingKey = 'missingKey',
added = 'added',
removed = 'removed'
}

View File

@ -2,13 +2,12 @@
* Public API Surface of i18n
*/
export * from './lib/config/module-config';
export * from './lib/config/token';
export * from './lib/pipes/i18n.pipe';
export * from './lib/services/i18n.service';
export * from './lib/types/i18next.event';
export * from './lib/types/token';
export * from './lib/i18n.module';

View File

@ -5,6 +5,7 @@
"entryFile": "src/public-api.ts",
"umdModuleIds": {
"@ucap/core": "@ucap/core",
"@ucap/domain-status": "@ucap/domain-status",
"@ucap/native": "@ucap/native",
"@ucap/ng-core": "@ucap/ng-core"
}

View File

@ -1,6 +1,6 @@
{
"name": "@ucap/ng-native",
"version": "0.0.5",
"version": "0.0.12",
"publishConfig": {
"registry": "https://nexus.loafle.net/repository/npm-ucap/"
},
@ -8,6 +8,7 @@
"@angular/common": "^9.0.2",
"@angular/core": "^9.0.2",
"@ucap/core": "~0.0.1",
"@ucap/domain-status": "~0.0.1",
"@ucap/native": "~0.0.1",
"axios": "^0.19.2",
"rxjs": "~6.5.4",

View File

@ -2,7 +2,9 @@ import { Subject, BehaviorSubject } from 'rxjs';
import { AxiosInstance } from 'axios';
import { StatusCode, FileUtil } from '@ucap/core';
import { FileUtil } from '@ucap/core';
import { StatusCode } from '@ucap/domain-status';
import {
NativeService,
UpdateCheckConfig,
@ -11,7 +13,8 @@ import {
WindowState,
WindowIdle,
NotificationRequest,
NotificationType
NotificationType,
AppInitInfo
} from '@ucap/native';
import { NotificationService } from './notification.service';
@ -228,34 +231,46 @@ export class BrowserNativeService extends NativeService {
});
}
window_state(): Promise<WindowState> {
return new Promise<WindowState>((resolve, reject) => {
try {
resolve(undefined);
} catch (error) {
reject(error);
}
});
}
window_onState$(): BehaviorSubject<WindowState> {
return super.window_onState$();
}
window_focused(): Promise<boolean> {
return new Promise<boolean>((resolve, reject) => {
try {
resolve(document.hasFocus());
} catch (error) {
reject(error);
}
});
}
window_onFocus$(): BehaviorSubject<boolean> {
if (!this._window_onFocusSubject) {
// tslint:disable-next-line: variable-name
const __this = this;
const onFocus = (event: Event) => {
__this._window_onFocusSubject.next(true);
};
const onBlur = (event: Event) => {
__this._window_onFocusSubject.next(false);
};
window.addEventListener('focus', onFocus);
window.addEventListener('blur', onBlur);
super.window_onFocus$().subscribe(
(focus) => {},
(error) => {},
() => {
window.removeEventListener('focus', onFocus);
window.removeEventListener('blur', onBlur);
}
window.addEventListener(
'focus',
this._window_onFocus$CallBack.bind(this)
);
window.addEventListener('blur', this._window_onFocus$CallBack.bind(this));
this.window_focused().then((focused) => {
this._window_onFocusSubject.next(focused);
});
}
return super.window_onFocus$();
}
_window_onFocus$CallBack(event: Event) {
if (!!this._window_onFocusSubject) {
this._window_onFocusSubject.next(document.hasFocus());
}
}
window_close(): Promise<void> {
return new Promise<void>((resolve, reject) => {
try {
@ -274,7 +289,7 @@ export class BrowserNativeService extends NativeService {
}
});
}
window_maximize(): Promise<void> {
window_maximize(altKey: boolean = false): Promise<void> {
return new Promise<void>((resolve, reject) => {
try {
resolve();
@ -293,28 +308,14 @@ export class BrowserNativeService extends NativeService {
this._idle_checker = new WindowIdleChecker({
limitTime,
onIdle: () => {
onChange: (idle: WindowIdle) => {
if (!!this._idle_onStateSubject) {
this._idle_onStateSubject.next(WindowIdle.Idle);
}
},
onActive: () => {
if (!!this._idle_onStateSubject) {
this._idle_onStateSubject.next(WindowIdle.Active);
}
},
onHide: () => {
if (!!this._idle_onStateSubject) {
this._idle_onStateSubject.next(WindowIdle.Idle);
}
},
onShow: () => {
if (!!this._idle_onStateSubject) {
this._idle_onStateSubject.next(WindowIdle.Active);
this._idle_onStateSubject.next(idle);
}
}
});
this._idle_checker.start();
super.idle_onState$();
resolve();
} catch (error) {
@ -367,10 +368,10 @@ export class BrowserNativeService extends NativeService {
}
});
}
app_postInit(): Promise<void> {
return new Promise<void>((resolve, reject) => {
app_postInit(): Promise<AppInitInfo> {
return new Promise<AppInitInfo>((resolve, reject) => {
try {
resolve();
resolve({});
} catch (error) {
reject(error);
}
@ -510,12 +511,25 @@ export class BrowserNativeService extends NativeService {
app_onShowSetting$(): Subject<void> {
return super.app_onShowSetting$();
}
app_onExit$(): Subject<void> {
return super.app_onExit$();
}
chat_onOpen$(): BehaviorSubject<string> {
chat_openRoom(openUrl: string): Promise<void> {
return new Promise<void>((resolve, reject) => {
try {
window.open(openUrl);
resolve();
} catch (error) {
reject(error);
}
});
}
chat_onOpen$(): Subject<string> {
return super.chat_onOpen$();
}
message_onOpen$(): BehaviorSubject<string> {
message_onOpen$(): Subject<string> {
return super.message_onOpen$();
}
}
@ -523,49 +537,72 @@ export class BrowserNativeService extends NativeService {
interface WindowIdleCheckerConfig {
limitTime?: number;
events?: string[];
onIdle?: () => void;
onActive?: () => void;
visibilityEvents?: string[];
onHide?: () => void;
onShow?: () => void;
onChange?: (idle: WindowIdle) => void;
}
const defaultWindowIdleCheckerConfig: WindowIdleCheckerConfig = {
limitTime: 5 * 60 * 1000,
events: ['mousemove', 'keydown', 'mousedown', 'touchstart'],
onIdle: () => {},
onActive: () => {},
onHide: () => {},
onShow: () => {},
visibilityEvents: [
'visibilitychange',
'webkitvisibilitychange',
'mozvisibilitychange',
'msvisibilitychange'
]
onChange: (idle: WindowIdle) => {}
};
const WEBKIT_HIDDEN = 'webkitHidden';
const MOZ_HIDDEN = 'mozHidden';
const MS_HIDDEN = 'msHidden';
abstract class WindowListener {
// tslint:disable-next-line: variable-name
protected events: string[];
class WindowIdleChecker {
constructor() {}
start() {
// tslint:disable-next-line: variable-name
const __this = this;
this._addEventListerner(this.events, this._onEvent.bind(this));
}
stop() {
this._removeEventListerner(this.events, this._onEvent.bind(this));
}
protected abstract onEvent(event: Event): void;
private _onEvent(event: Event) {
this.onEvent(event);
}
private _addEventListerner(
events: string[],
callback: (event: Event) => void
) {
events.forEach((e) => {
window.addEventListener(e, callback);
});
}
private _removeEventListerner(
events: string[],
callback: (event: Event) => void
) {
events.forEach((e) => {
window.removeEventListener(e, callback);
});
}
}
class WindowIdleChecker extends WindowListener {
// tslint:disable-next-line: variable-name
private _timerId: any;
// tslint:disable-next-line: variable-name
private _status: WindowIdle;
// tslint:disable-next-line: variable-name
private _visible: boolean;
// tslint:disable-next-line: variable-name
private _started: boolean;
constructor(
// tslint:disable-next-line: variable-name
private _config: WindowIdleCheckerConfig
) {
super();
this._config = Object.assign({}, defaultWindowIdleCheckerConfig, _config);
this._status = WindowIdle.Active;
this._visible = true;
this.events = this._config.events;
}
start() {
@ -576,7 +613,7 @@ class WindowIdleChecker {
this._timerId = setInterval(() => {
if (WindowIdle.Active === this._status) {
this._status = WindowIdle.Idle;
this._config.onIdle();
this._config.onChange(this._status);
}
}, this._config.limitTime);
@ -584,14 +621,7 @@ class WindowIdleChecker {
this._started = true;
}
this._addEventListerner(this._config.events, this._onActive);
if (!!this._config.onShow || !!this._config.onHide) {
this._addEventListerner(
this._config.visibilityEvents,
this._onVisibility
);
}
super.start();
}
stop() {
@ -601,14 +631,7 @@ class WindowIdleChecker {
}
if (!!this._started) {
this._removeEventListerner(this._config.events, this._onActive);
if (!!this._config.onShow || !!this._config.onHide) {
this._removeEventListerner(
this._config.visibilityEvents,
this._onVisibility
);
}
super.stop();
}
}
@ -620,47 +643,10 @@ class WindowIdleChecker {
this.start();
}
private _onActive(event: Event) {
protected onEvent(event: Event): void {
if (WindowIdle.Idle === this._status) {
this._status = WindowIdle.Active;
this._config.onActive();
this._config.onChange(this._status);
}
}
private _onVisibility(event: Event) {
if (
!!document.hidden ||
!!document[WEBKIT_HIDDEN] ||
!!document[MOZ_HIDDEN] ||
!!document[MS_HIDDEN]
) {
if (this._visible) {
this._visible = false;
this._config.onHide();
}
} else {
if (!this._visible) {
this._visible = true;
this._config.onShow();
}
}
}
private _addEventListerner(
events: string[],
callback: (event: Event) => void
) {
events.forEach((e) => {
window.addEventListener(e, callback.bind(this));
});
}
private _removeEventListerner(
events: string[],
callback: (event: Event) => void
) {
events.forEach((e) => {
window.removeEventListener(e, callback.bind(this));
});
}
}

View File

@ -7,6 +7,7 @@
"@ngrx/store": "@ngrx/store",
"@ngrx/effects": "@ngrx/effects",
"@ucap/core": "@ucap/core",
"@ucap/domain-authentication": "@ucap/domain-authentication",
"@ucap/api-public": "@ucap/api-public",
"@ucap/api-external": "@ucap/api-external",
"@ucap/pi": "@ucap/pi",

View File

@ -1,6 +1,6 @@
{
"name": "@ucap/ng-store-authentication",
"version": "0.0.14",
"version": "0.0.17",
"publishConfig": {
"registry": "https://nexus.loafle.net/repository/npm-ucap/"
},
@ -11,6 +11,7 @@
"@ngrx/entity": "^9.0.0",
"@ngrx/store": "^9.0.0",
"@ucap/core": "~0.0.1",
"@ucap/domain-authentication": "~0.0.1",
"@ucap/api-public": "~0.0.1",
"@ucap/api-external": "~0.0.1",
"@ucap/pi": "~0.0.1",

View File

@ -1,7 +1,10 @@
import { createAction, props } from '@ngrx/store';
import { AuthRequest, AuthResponse } from '@ucap/protocol-query';
import { RegViewRequest, RegViewResponse } from '@ucap/protocol-option';
import { UserPermission } from '@ucap/domain-authorization';
import { AuthRequest } from '@ucap/protocol-query';
import { RegViewRequest } from '@ucap/protocol-option';
import { Settings } from '@ucap/domain-authentication';
/**
* retrieve authorization information
@ -15,7 +18,7 @@ export const auth = createAction(
*/
export const authSuccess = createAction(
'[ucap::authentication::authorization] auth Success',
props<{ res: AuthResponse }>()
props<{ userPermission: UserPermission }>()
);
/**
* Failure of auth request
@ -37,7 +40,7 @@ export const regView = createAction(
*/
export const regViewSuccess = createAction(
'[ucap::authentication::authorization] regView Success',
props<{ res: RegViewResponse }>()
props<{ settings: Settings }>()
);
/**
* Failure of regView request

View File

@ -27,7 +27,7 @@ export class Effects {
sessionCreatedForAuth$ = createEffect(() => {
return this.actions$.pipe(
ofType(LoginActions.sessionCreated),
map(action =>
map((action) =>
auth({ req: { deviceType: action.loginSession.deviceType } })
)
);
@ -36,15 +36,15 @@ export class Effects {
auth$ = createEffect(() =>
this.actions$.pipe(
ofType(auth),
map(action => action.req),
exhaustMap(req => {
map((action) => action.req),
exhaustMap((req) => {
return this.queryProtocolService.auth(req).pipe(
map((res: AuthResponse) => {
return authSuccess({
res
userPermission: res.userPermission
});
}),
catchError(error => of(authFailure({ error })))
catchError((error) => of(authFailure({ error })))
);
})
)
@ -53,22 +53,22 @@ export class Effects {
sessionCreatedForRegView$ = createEffect(() => {
return this.actions$.pipe(
ofType(LoginActions.sessionCreated),
map(action => regView({ req: {} }))
map((action) => regView({ req: {} }))
);
});
regView$ = createEffect(() =>
this.actions$.pipe(
ofType(regView),
map(action => action.req),
exhaustMap(req => {
map((action) => action.req),
exhaustMap((req) => {
return this.optionProtocolService.regView(req).pipe(
map((res: RegViewResponse) => {
return regViewSuccess({
res
settings: res.settings
});
}),
catchError(error => of(regViewFailure({ error })))
catchError((error) => of(regViewFailure({ error })))
);
})
)

View File

@ -8,18 +8,18 @@ export const reducer = createReducer(
on(authSuccess, (state, action) => {
return {
...state,
authResponse: {
...state.authResponse,
...action.res
userPermission: {
...state.userPermission,
...action.userPermission
}
};
}),
on(regViewSuccess, (state, action) => {
return {
...state,
regViewResponse: {
...state.regViewResponse,
...action.res
settings: {
...state.settings,
...action.settings
}
};
})

View File

@ -1,27 +1,24 @@
import { Selector, createSelector } from '@ngrx/store';
import { AuthResponse } from '@ucap/protocol-query';
import { RegViewResponse } from '@ucap/protocol-option';
import { Settings } from '@ucap/domain-authentication';
import { UserPermission } from '@ucap/domain-authorization';
export interface State {
authResponse?: AuthResponse | null;
regViewResponse: RegViewResponse | null;
userPermission: UserPermission | null;
settings: Settings | null;
}
export const initialState: State = {
authResponse: null,
regViewResponse: null
userPermission: null,
settings: null
};
export function selectors<S>(selector: Selector<any, State>) {
return {
authResponse: createSelector(
userPermission: createSelector(
selector,
(state: State) => state.authResponse
(state: State) => state.userPermission
),
regViewResponse: createSelector(
selector,
(state: State) => state.regViewResponse
)
settings: createSelector(selector, (state: State) => state.settings)
};
}

View File

@ -1,7 +1,8 @@
import { createAction, props } from '@ngrx/store';
import { VersionInfo2Response, VersionInfo2Request } from '@ucap/api-public';
import { UrlInfoRequest, UrlInfoResponse } from '@ucap/api-external';
import { VersionInfo2Request } from '@ucap/api-public';
import { UrlInfoRequest } from '@ucap/api-external';
import { VersionInfo, UrlInfo } from '@ucap/domain-authentication';
export const versionInfo2 = createAction(
'[ucap::authentication::configuration] versionInfo2',
@ -10,7 +11,7 @@ export const versionInfo2 = createAction(
export const versionInfo2Success = createAction(
'[ucap::authentication::configuration] versionInfo2 Success',
props<{ res: VersionInfo2Response }>()
props<{ versionInfo: VersionInfo }>()
);
export const versionInfo2Failure = createAction(
@ -25,7 +26,7 @@ export const urlInfo = createAction(
export const urlInfoSuccess = createAction(
'[ucap::authentication::configuration] urlInfo Success',
props<{ res: UrlInfoResponse }>()
props<{ urlInfo: UrlInfo }>()
);
export const urlInfoFailure = createAction(

View File

@ -7,18 +7,18 @@ export const reducer = createReducer(
on(versionInfo2Success, (state, action) => {
return {
...state,
versionInfo2Response: {
...state.versionInfo2Response,
...action.res
versionInfo: {
...state.versionInfo,
...action.versionInfo
}
};
}),
on(urlInfoSuccess, (state, action) => {
return {
...state,
urlInfoResponse: {
...state.urlInfoResponse,
...action.res
urlInfo: {
...state.urlInfo,
...action.urlInfo
}
};
})

View File

@ -1,27 +1,20 @@
import { Selector, createSelector } from '@ngrx/store';
import { VersionInfo2Response } from '@ucap/api-public';
import { UrlInfoResponse } from '@ucap/api-external';
import { VersionInfo, UrlInfo } from '@ucap/domain-authentication';
export interface State {
versionInfo2Response: VersionInfo2Response | null;
urlInfoResponse: UrlInfoResponse | null;
versionInfo: VersionInfo | null;
urlInfo: UrlInfo | null;
}
export const initialState: State = {
versionInfo2Response: null,
urlInfoResponse: null
versionInfo: null,
urlInfo: null
};
export function selectors<S>(selector: Selector<any, State>) {
return {
versionInfo2Response: createSelector(
selector,
(state: State) => state.versionInfo2Response
),
urlInfoResponse: createSelector(
selector,
(state: State) => state.urlInfoResponse
)
versionInfo: createSelector(selector, (state: State) => state.versionInfo),
urlInfo: createSelector(selector, (state: State) => state.urlInfo)
};
}

View File

@ -1,12 +1,9 @@
import { createAction, props } from '@ngrx/store';
import { LoginSession } from '@ucap/core';
import { LoginSession, LoginInfo } from '@ucap/domain-authentication';
import { Login2Response } from '@ucap/pi';
import {
LoginRequest,
LoginResponse,
LogoutResponse
} from '@ucap/protocol-authentication';
import { LoginRequest, LogoutResponse } from '@ucap/protocol-authentication';
/**
* request of web login
@ -58,7 +55,7 @@ export const login = createAction(
export const loginSuccess = createAction(
'[ucap::authentication::login] login Success',
props<{
res: LoginResponse;
loginInfo: LoginInfo;
loginSession: LoginSession;
}>()
);
@ -95,7 +92,7 @@ export const logoutFailure = createAction(
export const sessionCreated = createAction(
'[ucap::authentication::login] session Created',
props<{
res: LoginResponse;
loginInfo: LoginInfo;
loginSession: LoginSession;
}>()
);

View File

@ -30,22 +30,22 @@ export class Effects {
() =>
this.actions$.pipe(
ofType(loginSuccess),
map((params) => params.res),
tap((loginRes) => {
map((result) => result.loginInfo),
tap((loginInfo) => {
this.store.dispatch(
UserActions.init({
user: {
info: loginRes.userInfo,
companyCode: loginRes.companyCode,
departmentCode: loginRes.departmentCode,
statusMessage1: loginRes.statusMessage1,
statusMessage2: loginRes.statusMessage2,
statusMessage3: loginRes.statusMessage3,
madn: loginRes.madn,
hardPhoneSadn: loginRes.hardPhoneSadn,
fmcSadn: loginRes.fmcSadn,
pbxIndex: loginRes.pbxIndex,
talkWithMeBotSeq: loginRes.talkWithMeBotSeq
info: loginInfo.userInfo,
companyCode: loginInfo.companyCode,
departmentCode: loginInfo.departmentCode,
statusMessage1: loginInfo.statusMessage1,
statusMessage2: loginInfo.statusMessage2,
statusMessage3: loginInfo.statusMessage3,
madn: loginInfo.madn,
hardPhoneSadn: loginInfo.hardPhoneSadn,
fmcSadn: loginInfo.fmcSadn,
pbxIndex: loginInfo.pbxIndex,
talkWithMeBotSeq: loginInfo.talkWithMeBotSeq
}
})
);

View File

@ -8,7 +8,7 @@ export const reducer = createReducer(
on(loginSuccess, (state, action) => {
return {
...state,
loginRes: action.res
loginInfo: action.loginInfo
};
}),

View File

@ -1,17 +1,17 @@
import { Selector, createSelector } from '@ngrx/store';
import { LoginResponse } from '@ucap/protocol-authentication';
import { LoginInfo } from '@ucap/domain-authentication';
export interface State {
loginRes: LoginResponse | null;
loginInfo: LoginInfo | null;
}
export const initialState: State = {
loginRes: null
loginInfo: null
};
export function selectors<S>(selector: Selector<any, State>) {
return {
loginRes: createSelector(selector, (state: State) => state.loginRes)
loginInfo: createSelector(selector, (state: State) => state.loginInfo)
};
}

View File

@ -0,0 +1,24 @@
# StoreCall
This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 9.1.11.
## Code scaffolding
Run `ng generate component component-name --project store-call` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project store-call`.
> Note: Don't forget to add `--project store-call` or else it will be added to the default project in your `angular.json` file.
## Build
Run `ng build store-call` to build the project. The build artifacts will be stored in the `dist/` directory.
## Publishing
After building your library with `ng build store-call`, go to the dist folder `cd dist/store-call` and run `npm publish`.
## Running unit tests
Run `ng test store-call` to execute the unit tests via [Karma](https://karma-runner.github.io).
## Further help
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).

View File

@ -0,0 +1,32 @@
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../../coverage/store-call'),
reports: ['html', 'lcovonly', 'text-summary'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};

View File

@ -0,0 +1,17 @@
{
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
"dest": "../../dist/store-call",
"lib": {
"entryFile": "src/public-api.ts",
"umdModuleIds": {
"@ngrx/store": "@ngrx/store",
"@ngrx/entity": "@ngrx/entity",
"@ngrx/effects": "@ngrx/effects",
"moment": "moment",
"@ucap/core": "@ucap/core",
"@ucap/domain-call": "@ucap/domain-call",
"@ucap/api-contact": "@ucap/api-contact",
"@ucap/ng-api-contact": "@ucap/ng-api-contact"
}
}
}

View File

@ -0,0 +1,16 @@
{
"name": "@ucap/ng-store-call",
"version": "0.0.7",
"publishConfig": {
"registry": "https://nexus.loafle.net/repository/npm-ucap/"
},
"peerDependencies": {
"@angular/common": "^9.0.2",
"@angular/core": "^9.0.2",
"@ucap/core": "~0.0.1",
"@ucap/api-contact": "~0.0.1",
"@ucap/ng-api-contact": "~0.0.1",
"@ucap/domain-call": "~0.0.2",
"tslib": "^1.10.0"
}
}

View File

@ -0,0 +1,31 @@
import { NgModule, ModuleWithProviders } from '@angular/core';
import { StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { ModuleConfig } from './config/module-config';
import { _MODULE_CONFIG } from './config/token';
import { KEY_FEATURE } from './store/state';
import { effects } from './store/effects';
import { reducers } from './store/reducers';
@NgModule({
imports: [
StoreModule.forFeature(KEY_FEATURE, reducers),
EffectsModule.forFeature([...effects])
]
})
export class CallStoreRootModule {}
@NgModule({})
export class CallStoreModule {
public static forRoot(
config: ModuleConfig
): ModuleWithProviders<CallStoreRootModule> {
return {
ngModule: CallStoreRootModule,
providers: [{ provide: _MODULE_CONFIG, useValue: config }]
};
}
}

View File

@ -0,0 +1,6 @@
import { ModuleConfig as CoreModuleConfig } from '@ucap/core';
// tslint:disable-next-line: no-empty-interface
export interface ModuleConfig extends CoreModuleConfig {
historyRequestDefaultCount?: number;
}

View File

@ -0,0 +1,5 @@
import { InjectionToken } from '@angular/core';
export const _MODULE_CONFIG = new InjectionToken(
'@ucap/ng-store-call config of module'
);

View File

@ -0,0 +1,55 @@
import { createAction, props } from '@ngrx/store';
import {
CallHistoryInfoRequest,
CallHistoryInfoResponse,
CallHistoryDelRequest,
CallHistoryDelResponse
} from '@ucap/api-contact';
import { AuthRequest, AuthResponse } from '@ucap/protocol-query';
// import { RegViewRequest, RegViewResponse } from '@ucap/protocol-option';
/**
* retrieve call history
*/
export const callHistory = createAction(
'[ucap::call::call] call history',
props<{ req: CallHistoryInfoRequest }>()
);
/**
* Success of call history request
*/
export const callHistorySuccess = createAction(
'[ucap::call::call] call history Success',
props<{ res: CallHistoryInfoResponse; remainHistory: boolean }>()
);
/**
* Failure of call history request
*/
export const callHistoryFailure = createAction(
'[ucap::call::call] call history Failure',
props<{ error: any }>()
);
/**
* retrieve delete call history
*/
export const del = createAction(
'[ucap::call::call] delete call history',
props<{ req: CallHistoryDelRequest }>()
);
/**
* Success of delete call history request
*/
export const delSuccess = createAction(
'[ucap::call::call] delete call history Success',
props<{ callLogSeq: number }>()
);
/**
* Failure of delete call history request
*/
export const delFailure = createAction(
'[ucap::call::call] delete call history Failure',
props<{ error: any }>()
);

View File

@ -0,0 +1,91 @@
import { Injectable, Inject } from '@angular/core';
import { of } from 'rxjs';
import { map, catchError, exhaustMap } from 'rxjs/operators';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import {
CallHistoryInfoResponse,
CallHistoryDelResponse
} from '@ucap/api-contact';
import { ContactApiService } from '@ucap/ng-api-contact';
import { StatusCode } from '@ucap/api';
import {
callHistory,
callHistorySuccess,
callHistoryFailure,
del,
delSuccess,
delFailure
} from './actions';
import { ModuleConfig } from '../../config/module-config';
import { _MODULE_CONFIG } from '../../config/token';
@Injectable()
export class Effects {
callHistory$ = createEffect(() =>
this.actions$.pipe(
ofType(callHistory),
map((action) => action.req),
exhaustMap((req) => {
return this.contactApiService.callHistoryList(req).pipe(
map((res: CallHistoryInfoResponse) => {
if (res.statusCode === StatusCode.Success) {
const remainHistory =
!!res.historyList &&
res.historyList.length >=
this.moduleConfig.historyRequestDefaultCount
? true
: false;
return callHistorySuccess({
res,
remainHistory
});
} else {
return callHistoryFailure({ error: res.errorMessage });
}
}),
catchError((error) => of(callHistoryFailure({ error })))
);
})
)
);
del$ = createEffect(() =>
this.actions$.pipe(
ofType(del),
map((action) => action.req),
exhaustMap((req) => {
const callLogSeq = !!req.targetReceiverCallLogSeq
? Number(req.targetReceiverCallLogSeq)
: !!req.targetSenderCallLogSeq
? Number(req.targetSenderCallLogSeq)
: undefined;
if (!!callLogSeq) {
return this.contactApiService.callHistoryDel(req).pipe(
map((res: CallHistoryDelResponse) => {
if (res.statusCode === StatusCode.Success) {
return delSuccess({
callLogSeq
});
} else {
return delFailure({ error: 'error statusCode' });
}
}),
catchError((error) => of(delFailure({ error })))
);
} else {
return of(delFailure({ error: 'not target calllogseq' }));
}
})
)
);
constructor(
private actions$: Actions,
@Inject(_MODULE_CONFIG) private moduleConfig: ModuleConfig,
private contactApiService: ContactApiService
) {}
}

View File

@ -0,0 +1,29 @@
import { createReducer, on } from '@ngrx/store';
import { initialState, adapterCallHistory } from './state';
import { callHistorySuccess, delSuccess } from './actions';
export const reducer = createReducer(
initialState,
on(callHistorySuccess, (state, action) => {
return {
...state,
searchDate: action.res.searchDate,
searchDirection: action.res.searchDirection,
historyList: adapterCallHistory.upsertMany(action.res.historyList, {
...state.historyList
}),
remainHistory: action.remainHistory
};
}),
on(delSuccess, (state, action) => {
return {
...state,
historyList: adapterCallHistory.removeOne(action.callLogSeq, {
...state.historyList
})
};
})
);

View File

@ -0,0 +1,49 @@
import { Selector, createSelector } from '@ngrx/store';
import { SearchDirectionByDateType, CallHistory } from '@ucap/domain-call';
import { EntityState, createEntityAdapter } from '@ngrx/entity';
export interface CallHistoryState extends EntityState<CallHistory> {}
export const adapterCallHistory = createEntityAdapter<CallHistory>({
selectId: (callHistory) => callHistory.callLogSeq,
sortComparer: (a, b) => {
return b.callLogSeq - a.callLogSeq;
}
});
const callHistoryInitialState: CallHistoryState = adapterCallHistory.getInitialState();
const {
selectAll: selectAllForCallHistory,
selectEntities: selectEntitiesForCallHistory,
selectIds: selectIdsForCallHistory,
selectTotal: selectTotalForCallHistory
} = adapterCallHistory.getSelectors();
export interface State {
searchDate?: string | null;
searchDirection?: SearchDirectionByDateType | null;
remainHistory?: boolean | null;
historyList: CallHistoryState;
}
export const initialState: State = {
searchDate: null,
searchDirection: null,
remainHistory: null,
historyList: callHistoryInitialState
};
export function selectors<S>(selector: Selector<any, State>) {
const selectCallHistory = createSelector(
selector,
(state: State) => state.historyList
);
return {
callHistory: createSelector(selectCallHistory, selectAllForCallHistory),
searchDate: createSelector(selector, (state: State) => state.searchDate),
searchDirection: createSelector(
selector,
(state: State) => state.searchDirection
)
};
}

View File

@ -0,0 +1,3 @@
import { createAction } from '@ngrx/store';
export const init = createAction('[ucap::call::common] init');

View File

@ -0,0 +1,8 @@
import { Injectable } from '@angular/core';
import { Actions } from '@ngrx/effects';
@Injectable()
export class Effects {
constructor(private actions$: Actions) {}
}

View File

@ -0,0 +1,5 @@
import { createReducer, on } from '@ngrx/store';
import { initialState } from './state';
export const reducer = createReducer(initialState);

View File

@ -0,0 +1,10 @@
import { Selector } from '@ngrx/store';
// tslint:disable-next-line: no-empty-interface
export interface State {}
export const initialState: State = {};
export function selectors<S>(selector: Selector<any, State>) {
return {};
}

View File

@ -0,0 +1,6 @@
import { Type } from '@angular/core';
import { Effects as CommonEffects } from './common/effects';
import { Effects as CallEffects } from './call/effects';
export const effects: Type<any>[] = [CommonEffects, CallEffects];

View File

@ -0,0 +1,11 @@
import { combineReducers, Action } from '@ngrx/store';
import { reducer as CommonReducer } from './common/reducers';
import { reducer as CallReducer } from './call/reducers';
export function reducers(state: any | undefined, action: Action) {
return combineReducers({
common: CommonReducer,
call: CallReducer
})(state, action);
}

View File

@ -0,0 +1,21 @@
import { createFeatureSelector, createSelector } from '@ngrx/store';
import * as CommonState from './common/state';
import * as CallState from './call/state';
export const KEY_FEATURE = 'call';
export interface State {
common: CommonState.State;
call: CallState.State;
}
export const Selector = createFeatureSelector<State>(KEY_FEATURE);
export const CommonSelector = CommonState.selectors(
createSelector(Selector, (state: State) => state.common)
);
export const CallSelector = CallState.selectors(
createSelector(Selector, (state: State) => state.call)
);

View File

@ -0,0 +1,14 @@
/*
* Public API Surface of store-call
*/
import * as CommonActions from './lib/store/common/actions';
import * as CallActions from './lib/store/call/actions';
export * from './lib/config/module-config';
export { CommonActions, CallActions };
export * from './lib/store/state';
export * from './lib/call-store.module';

View File

@ -0,0 +1,26 @@
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
import 'zone.js/dist/zone';
import 'zone.js/dist/zone-testing';
import { getTestBed } from '@angular/core/testing';
import {
BrowserDynamicTestingModule,
platformBrowserDynamicTesting
} from '@angular/platform-browser-dynamic/testing';
declare const require: {
context(path: string, deep?: boolean, filter?: RegExp): {
keys(): string[];
<T>(id: string): T;
};
};
// First, initialize the Angular testing environment.
getTestBed().initTestEnvironment(
BrowserDynamicTestingModule,
platformBrowserDynamicTesting()
);
// Then we find all the tests.
const context = require.context('./', true, /\.spec\.ts$/);
// And load the modules.
context.keys().map(context);

View File

@ -0,0 +1,23 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/lib",
"target": "es2015",
"declaration": true,
"inlineSources": true,
"types": [],
"lib": [
"dom",
"es2018"
]
},
"angularCompilerOptions": {
"skipTemplateCodegen": true,
"strictMetadataEmit": true,
"enableResourceInlining": true
},
"exclude": [
"src/test.ts",
"**/*.spec.ts"
]
}

View File

@ -0,0 +1,6 @@
{
"extends": "./tsconfig.lib.json",
"angularCompilerOptions": {
"enableIvy": false
}
}

View File

@ -0,0 +1,17 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "../../out-tsc/spec",
"types": [
"jasmine",
"node"
]
},
"files": [
"src/test.ts"
],
"include": [
"**/*.spec.ts",
"**/*.d.ts"
]
}

View File

@ -0,0 +1,17 @@
{
"extends": "../../tslint.json",
"rules": {
"directive-selector": [
true,
"attribute",
"lib",
"camelCase"
],
"component-selector": [
true,
"element",
"lib",
"kebab-case"
]
}
}

View File

@ -8,6 +8,9 @@
"@ngrx/store": "@ngrx/store",
"@ngrx/entity": "@ngrx/entity",
"@ngrx/effects": "@ngrx/effects",
"@ucap/domain-common": "@ucap/domain-common",
"@ucap/domain-organization": "@ucap/domain-organization",
"@ucap/domain-chat": "@ucap/domain-chat",
"@ucap/api": "@ucap/api",
"@ucap/pi": "@ucap/pi",
"@ucap/protocol-event": "@ucap/protocol-event",
@ -16,6 +19,7 @@
"@ucap/protocol-room": "@ucap/protocol-room",
"@ucap/protocol-sync": "@ucap/protocol-sync",
"@ucap/ng-i18n": "@ucap/ng-i18n",
"@ucap/ng-core": "@ucap/ng-core",
"@ucap/ng-api-common": "@ucap/ng-api-common",
"@ucap/ng-protocol-room": "@ucap/ng-protocol-room",
"@ucap/ng-protocol-event": "@ucap/ng-protocol-event",

View File

@ -1,6 +1,6 @@
{
"name": "@ucap/ng-store-chat",
"version": "0.0.66",
"version": "0.0.74",
"publishConfig": {
"registry": "https://nexus.loafle.net/repository/npm-ucap/"
},
@ -8,12 +8,23 @@
"@angular/common": "^9.0.2",
"@angular/core": "^9.0.2",
"@ucap/core": "~0.0.1",
"@ucap/domain-common": "~0.0.1",
"@ucap/domain-organization": "~0.0.1",
"@ucap/domain-chat": "~0.0.1",
"@ucap/api": "~0.0.1",
"@ucap/api-common": "~0.0.1",
"@ucap/protocol-event": "~0.0.1",
"@ucap/protocol-file": "~0.0.1",
"@ucap/protocol-room": "~0.0.1",
"@ucap/protocol-sync": "~0.0.1",
"@ucap/ng-i18n": "~0.0.1",
"@ucap/ng-core": "~0.0.1",
"@ucap/ng-api-common": "~0.0.1",
"@ucap/ng-protocol-event": "~0.0.1",
"@ucap/ng-protocol-room": "~0.0.1",
"@ucap/ng-protocol-file": "~0.0.1",
"@ucap/ng-protocol-sync": "~0.0.1",
"@ucap/ng-store-organization": "~0.0.1",
"@ucap/ng-store-authentication": "~0.0.1",
"tslib": "^1.10.0"
}

View File

@ -1,11 +1,16 @@
import { createAction, props } from '@ngrx/store';
import { DeviceType } from '@ucap/core';
import { DeviceType } from '@ucap/domain-common';
import {
Info,
FileDownloadInfo,
FileInfo,
EventJson,
RoomEventInfo
} from '@ucap/domain-chat';
import {
InfoRequest as EventInfoRequest,
InfoResponse as EventInfoResponse,
SendRequest as SendEventRequest,
SendResponse as SendEventResponse,
ReadRequest,
@ -17,7 +22,6 @@ import {
ReadNotification,
CancelNotification,
DelNotification,
EventJson,
ReadResponse,
SendRequest
} from '@ucap/protocol-event';
@ -25,8 +29,6 @@ import {
import {
InfoRequest as FileInfoRequest,
InfoResponse as FileInfoResponse,
FileDownloadInfo,
FileInfo,
DownCheckRequest,
DownCheckResponse
} from '@ucap/protocol-file';
@ -45,7 +47,7 @@ export const eventsSuccess = createAction(
'[ucap::chat::chatting] events Success',
props<{
eventInfoList: Info<EventJson>[];
res: EventInfoResponse;
roomEventInfo: RoomEventInfo;
remainEvent: boolean;
}>()
);

View File

@ -7,7 +7,6 @@ import {
exhaustMap,
concatMap,
withLatestFrom,
debounceTime,
mergeMap,
take
} from 'rxjs/operators';
@ -18,8 +17,22 @@ import { Store, select } from '@ngrx/store';
import { Actions, createEffect, ofType } from '@ngrx/effects';
import { Dictionary } from '@ngrx/entity';
import moment from 'moment';
import { LocaleCode } from '@ucap/domain-common';
import {
Info,
RoomType,
FileType,
EventType,
FileEventJson,
EventJson
} from '@ucap/domain-chat';
import { StatusCode } from '@ucap/api';
import { FileTalkShareRequest, FileTalkShareResponse } from '@ucap/api-common';
import {
OpenResponse as CreateResponse,
Open3Response as CreateTimerResponse,
ExitResponse as DeleteResponse,
@ -28,23 +41,12 @@ import {
import {
InfoRequest,
ReadResponse,
FileType,
EventType,
DelResponse,
SendResponse,
CancelResponse,
FileEventJson,
decodeFileEventJson,
Info,
EventJson
decodeFileEventJson
} from '@ucap/protocol-event';
import moment from 'moment';
import { LocaleCode } from '@ucap/core';
import { StatusCode } from '@ucap/api';
import { FileTalkShareRequest, FileTalkShareResponse } from '@ucap/api-common';
import { I18nService } from '@ucap/ng-i18n';
import { CommonApiService } from '@ucap/ng-api-common';
import { EventProtocolService } from '@ucap/ng-protocol-event';
@ -103,14 +105,14 @@ export class Effects {
map((action) => action.req),
switchMap((req) => {
return this.eventProtocolService.info(req).pipe(
map((res) => {
if (!!res && !!res.res) {
const infoList = res.infoList;
map((result) => {
if (!!result && !!result.res) {
const infoList = result.infoList;
this.store.dispatch(
eventsSuccess({
eventInfoList: infoList,
res: res.res,
roomEventInfo: result.res.roomEventInfo,
remainEvent:
infoList.length === req.requestCount ? true : false
})
@ -135,7 +137,7 @@ export class Effects {
this.store.dispatch(
fileInfos({
req: {
roomId: res.res.roomId,
roomId: result.res.roomEventInfo.roomId,
// { 파일타입 } cf) I : 이미지 V: 동영상 F: 파일 "" 빈값이면 모든 타입을 내려줌
type: FileType.All
}
@ -488,9 +490,9 @@ export class Effects {
ofType(forwarForFileEvent),
withLatestFrom(
this.store.pipe(select(UserSelector.user)),
this.store.pipe(select(LoginSelector.loginRes))
this.store.pipe(select(LoginSelector.loginInfo))
),
tap(([actionReq, user, loginRes]) => {
tap(([actionReq, user, loginInfo]) => {
const fileEventJson: FileEventJson = decodeFileEventJson(
actionReq.sendReq.sentMessage
);
@ -498,7 +500,7 @@ export class Effects {
const req: FileTalkShareRequest = {
userSeq: String(user.info.seq),
deviceType: actionReq.deviceType,
token: loginRes.tokenString,
token: loginInfo.tokenString,
attachmentsSeq: fileEventJson.attachmentSeq.toString(),
roomId: actionReq.trgtRoomId,
synapKey: ''
@ -690,7 +692,6 @@ export class Effects {
() => {
return this.actions$.pipe(
ofType(RoomActions.selectedRoomSuccess),
debounceTime(300),
tap((action) => {
const requestCount = this.moduleConfig?.eventRequestInitCount || 50;
const req: InfoRequest = {

View File

@ -1,7 +1,6 @@
import { createReducer, on } from '@ngrx/store';
import { FileInfo } from '@ucap/protocol-file';
import { Info, EventJson, EventType } from '@ucap/protocol-event';
import { Info, FileInfo, EventType, EventJson } from '@ucap/domain-chat';
import * as RoomActions from '../room/actions';
@ -29,7 +28,7 @@ export const reducer = createReducer(
initialState,
on(eventsSuccess, (state, action) => {
const roomId = action.res.roomId;
const roomId = action.roomEventInfo.roomId;
const chatting = state.chattings.entities[roomId] || {};
let trgtChatting: Chatting = {
@ -82,7 +81,7 @@ export const reducer = createReducer(
eventList: adapterEventList.upsertMany(trgtEventInfoList, {
...trgtChatting.eventList
}),
eventStatus: action.res,
eventStatus: action.roomEventInfo,
remainEvent:
trgtChatting.remainEvent === false ? false : action.remainEvent, // 재조회를 위한 처리.
eventListProcessing: false
@ -278,12 +277,13 @@ export const reducer = createReducer(
};
// 파일이 회수되었을 경우 fileInfoList 에서도 삭제 한다.
if (chatting.eventList.entities[eventSeq].type === EventType.File) {
const currentEvent = chatting.eventList.entities[eventSeq];
if (!!currentEvent && currentEvent.type === EventType.File) {
const fileInfoList = chatting.fileInfoList;
if (!!chatting && !!fileInfoList) {
fileInfoList.ids.forEach((id) => {
const fileInfo: FileInfo = fileInfoList.entities[id];
if (action.eventSeq === fileInfo.eventSeq) {
if (!!fileInfo && action.eventSeq === fileInfo.eventSeq) {
fileInfoSeq = id;
}
});

View File

@ -1,8 +1,13 @@
import { Selector, createSelector } from '@ngrx/store';
import { EntityState, createEntityAdapter, Dictionary } from '@ngrx/entity';
import { EntityState, createEntityAdapter } from '@ngrx/entity';
import { InfoResponse, Info, EventJson } from '@ucap/protocol-event';
import { FileInfo, FileDownloadInfo } from '@ucap/protocol-file';
import {
Info,
FileInfo,
FileDownloadInfo,
EventJson,
RoomEventInfo
} from '@ucap/domain-chat';
export interface EventListState extends EntityState<Info<EventJson>> {}
export interface FileInfoListState extends EntityState<FileInfo> {}
@ -63,7 +68,7 @@ export interface Chatting {
eventListProcessing?: boolean;
eventList?: EventListState;
eventStatus?: InfoResponse | null;
eventStatus?: RoomEventInfo | null;
remainEvent?: boolean | null;
fileInfoListProcessing?: boolean;

View File

@ -1,10 +1,9 @@
import { createAction, props } from '@ngrx/store';
import { LocaleCode } from '@ucap/core';
import { LocaleCode } from '@ucap/domain-common';
import { RoomInfo, UserInfo, UserInfoShort } from '@ucap/domain-chat';
import {
RoomInfo,
UserInfo as RoomUserInfo,
InfoRequest as RoomRequest,
InviteNotification,
OpenRequest as CreateRequest,
@ -23,8 +22,6 @@ import {
ExitForcingResponse,
UpdateTimerSetRequest,
UpdateTimerSetResponse,
UserInfo,
UserInfoShort,
InfoResponse
} from '@ucap/protocol-room';
@ -76,7 +73,7 @@ export const roomsSuccess = createAction(
props<{
roomList: RoomInfo[];
roomUserInfoMap: {
[param: string]: RoomUserInfo[];
[param: string]: UserInfo[];
};
syncDate: string;
}>()
@ -100,7 +97,7 @@ export const rooms2Success = createAction(
roomUserInfoMap: {
[param: string]: {
userInfoShortList: UserInfoShort[];
userInfoList: RoomUserInfo[];
userInfoList: UserInfo[];
};
};
syncDate: string;
@ -128,7 +125,7 @@ export const roomSuccess = createAction(
'[ucap::chat::room] room Success',
props<{
roomInfo: RoomInfo;
userInfoList: RoomUserInfo[];
userInfoList: UserInfo[];
}>()
);
/**
@ -148,7 +145,7 @@ export const room2Success = createAction(
roomInfo: RoomInfo;
roomUserInfo: {
userInfoShortList: UserInfoShort[];
userInfoList: RoomUserInfo[];
userInfoList: UserInfo[];
};
}>()
);

View File

@ -14,7 +14,10 @@ import { Injectable } from '@angular/core';
import { Store, select } from '@ngrx/store';
import { Actions, ofType, createEffect } from '@ngrx/effects';
import { LocaleCode } from '@ucap/core';
import { LocaleCode } from '@ucap/domain-common';
import { UserInfoUpdateType } from '@ucap/domain-organization';
import { UserInfoShort, UserInfo, RoomInfo } from '@ucap/domain-chat';
import {
OpenResponse as CreateResponse,
Open3Response as CreateTimerResponse,
@ -24,13 +27,11 @@ import {
InviteResponse,
ExitForcingResponse,
UpdateTimerSetResponse,
InfoRequest,
UserInfoShort,
UserInfo,
RoomInfo
InfoRequest
} from '@ucap/protocol-room';
import { UserNotification, UserInfoUpdateType } from '@ucap/protocol-info';
import { UserNotification } from '@ucap/protocol-info';
import { StringUtil } from '@ucap/ng-core';
import { I18nService } from '@ucap/ng-i18n';
import { RoomProtocolService } from '@ucap/ng-protocol-room';
import { SyncProtocolService } from '@ucap/ng-protocol-sync';
@ -606,13 +607,7 @@ export class Effects {
userInfoS?: UserInfoShort[];
}[] = [];
const findIdx = noti.info.indexOf('ProfileImage');
let imgInfo: string = noti.info;
if (findIdx > -1) {
const startIdx = noti.info.indexOf('/', findIdx);
imgInfo = noti.info.substring(startIdx);
}
const imgInfo = StringUtil.getProfileSubDir(noti.info);
for (const ru of roomUsers) {
ru.userInfos.every((u) => {

View File

@ -1,7 +1,6 @@
import { createReducer, on } from '@ngrx/store';
import { RoomInfo } from '@ucap/protocol-room';
import { Info, EventJson } from '@ucap/protocol-event';
import { Info, RoomInfo, EventJson } from '@ucap/domain-chat';
import * as ChattingActions from '../chatting/actions';
import { ChatUtil } from '../../utils/chat.util';
@ -49,12 +48,42 @@ export const reducer = createReducer(
// tslint:disable-next-line: forin
for (const key in state.rooms.entities) {
const value = state.rooms.entities[key];
unreadTotal += isNaN(value.noReadCnt) ? 0 : value.noReadCnt;
const matchedInfo = action.roomList.find(
(item) => item.roomId === value.roomId
);
if (!!matchedInfo) {
unreadTotal += isNaN(matchedInfo.noReadCnt) ? 0 : matchedInfo.noReadCnt;
} else {
unreadTotal += isNaN(value.noReadCnt) ? 0 : value.noReadCnt;
}
}
/**
* Correcting expiredFileStdSeq.
* 'RoomInfo' 'SyncRoomInfo' expiredFileStdSeq 0 .
* 'SyncRoomInfo' expiredFileStdSeq 0 .(DB )
*/
const trgtRoomList = action.roomList.map((roomInfo) => {
let rtnValue: RoomInfo = roomInfo;
// tslint:disable-next-line: forin
for (const key in state.rooms.entities) {
const value = state.rooms.entities[key];
if (value.roomId === roomInfo.roomId && value.expiredFileStdSeq > 0) {
rtnValue = {
...rtnValue,
expiredFileStdSeq: value.expiredFileStdSeq
};
break;
}
}
return rtnValue;
});
return {
...state,
rooms: adapterRoom.upsertMany(action.roomList, {
rooms: adapterRoom.upsertMany(trgtRoomList, {
...state.rooms,
syncDate: action.syncDate
}),
@ -92,13 +121,42 @@ export const reducer = createReducer(
// tslint:disable-next-line: forin
for (const key in state.rooms.entities) {
const value = state.rooms.entities[key];
unreadTotal += isNaN(value.noReadCnt) ? 0 : value.noReadCnt;
const matchedInfo = action.roomList.find(
(item) => item.roomId === value.roomId
);
if (!!matchedInfo) {
unreadTotal += isNaN(matchedInfo.noReadCnt) ? 0 : matchedInfo.noReadCnt;
} else {
unreadTotal += isNaN(value.noReadCnt) ? 0 : value.noReadCnt;
}
}
action.roomList.map((item) => (unreadTotal += item.noReadCnt));
/**
* Correcting expiredFileStdSeq.
* 'RoomInfo' 'SyncRoomInfo' expiredFileStdSeq 0 .
* 'SyncRoomInfo' expiredFileStdSeq 0 .(DB )
*/
const trgtRoomList = action.roomList.map((roomInfo) => {
let rtnValue: RoomInfo = roomInfo;
// tslint:disable-next-line: forin
for (const key in state.rooms.entities) {
const value = state.rooms.entities[key];
if (value.roomId === roomInfo.roomId && value.expiredFileStdSeq > 0) {
rtnValue = {
...rtnValue,
expiredFileStdSeq: value.expiredFileStdSeq
};
break;
}
}
return rtnValue;
});
return {
...state,
rooms: adapterRoom.upsertMany(action.roomList, {
rooms: adapterRoom.upsertMany(trgtRoomList, {
...state.rooms,
syncDate: action.syncDate
}),

View File

@ -7,7 +7,7 @@ import {
RoomInfo,
UserInfo as RoomUserInfo,
UserInfoShort as RoomUserInfoShort
} from '@ucap/protocol-room';
} from '@ucap/domain-chat';
export interface RoomState extends EntityState<RoomInfo> {
syncDate: string;

View File

@ -1,5 +1,4 @@
import {
EventJson,
EventType,
FileEventJson,
FileType,
@ -9,8 +8,9 @@ import {
TranslationEventJson,
MassTranslationEventJson,
PlanEventJson,
PlanContentType
} from '@ucap/protocol-event';
PlanContentType,
EventJson
} from '@ucap/domain-chat';
export class ChatUtil {
public static convertFinalEventMessage(

View File

@ -9,12 +9,14 @@
"@ngrx/effects": "@ngrx/effects",
"moment": "moment",
"@ucap/core": "@ucap/core",
"@ucap/domain-organization": "@ucap/domain-organization",
"@ucap/pi": "@ucap/pi",
"@ucap/protocol-sync": "@ucap/protocol-sync",
"@ucap/protocol-group": "@ucap/protocol-group",
"@ucap/protocol-buddy": "@ucap/protocol-buddy",
"@ucap/protocol-query": "@ucap/protocol-query",
"@ucap/protocol-info": "@ucap/protocol-info",
"@ucap/ng-core": "@ucap/ng-core",
"@ucap/ng-protocol-buddy": "@ucap/ng-protocol-buddy",
"@ucap/ng-protocol-group": "@ucap/ng-protocol-group",
"@ucap/ng-protocol-sync": "@ucap/ng-protocol-sync",

View File

@ -1,6 +1,6 @@
{
"name": "@ucap/ng-store-group",
"version": "0.0.22",
"version": "0.0.25",
"publishConfig": {
"registry": "https://nexus.loafle.net/repository/npm-ucap/"
},
@ -8,6 +8,7 @@
"@angular/common": "^9.0.2",
"@angular/core": "^9.0.2",
"@ucap/core": "~0.0.1",
"@ucap/domain-organization": "~0.0.1",
"@ucap/protocol-buddy": "~0.0.1",
"@ucap/protocol-group": "~0.0.1",
"@ucap/protocol-query": "~0.0.1",
@ -16,9 +17,9 @@
"@ucap/ng-protocol-buddy": "~0.0.1",
"@ucap/ng-protocol-group": "~0.0.1",
"@ucap/ng-protocol-sync": "~0.0.1",
"@ucap/ng-protocol-info": "~0.0.1",
"@ucap/ng-store-organization": "~0.0.1",
"@ucap/ng-store-authentication": "~0.0.1",
"@ucap/ng-protocol-info": "~0.0.1",
"tslib": "^1.10.0"
}
}

View File

@ -1,6 +1,6 @@
import { createAction, props } from '@ngrx/store';
import { UserInfo } from '@ucap/protocol-sync';
import { UserInfoF } from '@ucap/domain-organization';
import {
AddRequest as BuddyAddRequest,
AddResponse as BuddyAddResponse,
@ -24,7 +24,7 @@ export const buddy2 = createAction('[ucap::group::buddy] buddy2');
*/
export const buddy2Success = createAction(
'[ucap::group::buddy] buddy2 Success',
props<{ buddyList: UserInfo[]; syncDate: string }>()
props<{ buddyList: UserInfoF[]; syncDate: string }>()
);
/**
* Failure of buddy2 request

View File

@ -25,7 +25,7 @@ import {
} from '@ucap/protocol-info';
import { SyncProtocolService } from '@ucap/ng-protocol-sync';
import { InfoProtocolService } from '@ucap/ng-protocol-info';
import { BuddyProtocolService } from '@ucap/ng-protocol-buddy';
import {
@ -62,7 +62,6 @@ import { BuddySelector, GroupSelector } from '../state';
import { ModuleConfig } from '../../config/module-config';
import { _MODULE_CONFIG } from '../../config/token';
import { InfoProtocolService } from '@ucap/ng-protocol-info';
@Injectable()
export class Effects {

View File

@ -1,7 +1,8 @@
import { createReducer, on } from '@ngrx/store';
import { UserInfoUpdateType } from '@ucap/protocol-info';
import { UserInfo } from '@ucap/protocol-sync';
import { UserInfoUpdateType, UserInfoF } from '@ucap/domain-organization';
import { StringUtil } from '@ucap/ng-core';
import { initialState, adapterBuddy } from './state';
import {
@ -36,7 +37,7 @@ export const reducer = createReducer(
on(updateSuccess, (state, action) => {
const res = action.res;
const userInfo: UserInfo = {
const userInfo: UserInfoF = {
...state.buddies.entities[res.seq],
isFavorit: res.isFavorit
};
@ -49,7 +50,7 @@ export const reducer = createReducer(
on(nicknameSuccess, (state, action) => {
const res = action.res;
const userInfo: UserInfo = {
const userInfo: UserInfoF = {
...state.buddies.entities[res.userSeq],
nickName: res.nickname
};
@ -62,18 +63,12 @@ export const reducer = createReducer(
on(buddyInfoUpdate, (state, action) => {
const noti = action.noti;
let buddyInfo: UserInfo;
let buddyInfo: UserInfoF;
switch (noti.type) {
case UserInfoUpdateType.Image:
{
const findIdx = noti.info.indexOf('ProfileImage');
let imgInfo: string = noti.info;
if (findIdx > -1) {
const startIdx = noti.info.indexOf('/', findIdx);
imgInfo = noti.info.substring(startIdx);
}
const imgInfo = StringUtil.getProfileSubDir(noti.info);
buddyInfo = {
...state.buddies.entities[noti.SENDER_SEQ],

View File

@ -1,12 +1,12 @@
import { Selector, createSelector } from '@ngrx/store';
import { EntityState, createEntityAdapter } from '@ngrx/entity';
import { UserInfo } from '@ucap/protocol-sync';
import { UserInfoF } from '@ucap/domain-organization';
export interface BuddyState extends EntityState<UserInfo> {
export interface BuddyState extends EntityState<UserInfoF> {
syncDate: string;
}
export const adapterBuddy = createEntityAdapter<UserInfo>({
export const adapterBuddy = createEntityAdapter<UserInfoF>({
selectId: (userInfo) => userInfo.seq
});

View File

@ -1,5 +1,6 @@
import { createAction, props } from '@ngrx/store';
import { GroupRequest, GroupDetailData } from '@ucap/protocol-sync';
import { GroupInfoDetail } from '@ucap/domain-group';
import {
AddResponse as GroupAddResponse,
UpdateRequest as GroupUpdateRequest,
@ -17,7 +18,7 @@ export const groups = createAction('[ucap::group::group] groups');
*/
export const groupsSuccess = createAction(
'[ucap::group::group] groups Success',
props<{ groupList: GroupDetailData[]; syncDate: string }>()
props<{ groupList: GroupInfoDetail[]; syncDate: string }>()
);
/**
* Failure of groups request
@ -33,7 +34,7 @@ export const groupsFailure = createAction(
export const updateMember = createAction(
'[ucap::group::group] updateMember',
props<{
targetGroup: GroupDetailData;
targetGroup: GroupInfoDetail;
targetUserSeqs: string[];
}>()
);
@ -43,7 +44,7 @@ export const updateMember = createAction(
export const updateMemberSuccess = createAction(
'[ucap::group::group] updateMember Success',
props<{
targetGroup: GroupDetailData;
targetGroup: GroupInfoDetail;
targetUserSeqs: string[];
userSeqsForDelete?: string[];
}>()
@ -62,8 +63,8 @@ export const updateMemberFailure = createAction(
export const moveMember = createAction(
'[ucap::group::group] moveMember',
props<{
fromGroup: GroupDetailData;
toGroup: GroupDetailData;
fromGroup: GroupInfoDetail;
toGroup: GroupInfoDetail;
targetUserSeq: string[];
}>()
);
@ -133,7 +134,7 @@ export const updateFailure = createAction(
export const del = createAction(
'[ucap::group::group] del',
props<{
group: GroupDetailData;
group: GroupInfoDetail;
}>()
);
/**

View File

@ -1,6 +1,6 @@
import { createReducer, on } from '@ngrx/store';
import { GroupDetailData } from '@ucap/protocol-sync';
import { GroupInfoDetail } from '@ucap/domain-group';
import { initialState, adapterGroup } from './state';
import { groupsSuccess, createSuccess, delSuccess } from './actions';
@ -21,7 +21,7 @@ export const reducer = createReducer(
/** 새 그룹 추가. */
on(createSuccess, (state, action) => {
const res = action.res;
const groupInfo: GroupDetailData = {
const groupInfo: GroupInfoDetail = {
seq: res.groupSeq,
name: res.groupName,
isActive: true,

View File

@ -1,12 +1,12 @@
import { Selector, createSelector } from '@ngrx/store';
import { EntityState, createEntityAdapter } from '@ngrx/entity';
import { GroupDetailData } from '@ucap/protocol-sync';
import { GroupInfoDetail } from '@ucap/domain-group';
export interface GroupState extends EntityState<GroupDetailData> {
export interface GroupState extends EntityState<GroupInfoDetail> {
syncDate: string;
}
export const adapterGroup = createEntityAdapter<GroupDetailData>({
selectId: groupDetailData => groupDetailData.seq
export const adapterGroup = createEntityAdapter<GroupInfoDetail>({
selectId: (groupDetailData) => groupDetailData.seq
});
export interface State {
@ -35,7 +35,7 @@ export function selectors<S>(selector: Selector<any, State>) {
groups: createSelector(selectGroups, selectAllForGroup),
groupSyncDate: createSelector(
selectGroups,
groupState => groupState.syncDate
(groupState) => groupState.syncDate
)
};
}

View File

@ -8,8 +8,11 @@
"@ngrx/effects": "@ngrx/effects",
"@ngrx/entity": "@ngrx/entity",
"@ucap/domain-organization": "@ucap/domain-organization",
"@ucap/domain-status": "@ucap/domain-status",
"@ucap/protocol-query": "@ucap/protocol-query",
"@ucap/protocol-status": "@ucap/protocol-status",
"@ucap/ng-core": "@ucap/ng-core",
"@ucap/ng-api-external": "@ucap/ng-api-external",
"@ucap/ng-protocol-info": "@ucap/ng-protocol-info",
"@ucap/ng-protocol-query": "@ucap/ng-protocol-query",

View File

@ -1,17 +1,26 @@
{
"name": "@ucap/ng-store-organization",
"version": "0.0.20",
"version": "0.0.23",
"publishConfig": {
"registry": "https://nexus.loafle.net/repository/npm-ucap/"
},
"peerDependencies": {
"@angular/common": "^9.0.0",
"@angular/core": "^9.0.0",
"@ngrx/store": "^9.2.0",
"@ngrx/effects": "^9.2.0",
"@ucap/core": "~0.0.1",
"@ucap/domain-organization": "~0.0.1",
"@ucap/domain-status": "~0.0.1",
"@ucap/api-external": "~0.0.1",
"@ucap/protocol-info": "~0.0.1",
"@ucap/protocol-query": "~0.0.1",
"@ucap/protocol-status": "~0.0.1",
"@ucap/ng-api-external": "~0.0.1",
"@ucap/ng-protocol-info": "~0.0.1",
"@ucap/ng-protocol-query": "~0.0.1",
"@ucap/ng-protocol-status": "~0.0.1",
"rxjs": "~6.5.4",
"tslib": "^1.10.0"
}
}

Some files were not shown because too many files have changed in this diff Show More