Fix build
This commit is contained in:
parent
c2023a9f02
commit
0912f1b4ca
|
@ -103,6 +103,7 @@ export class RegisterComponent implements OnInit {
|
||||||
|
|
||||||
const body: UserRegister = await this.hooks.wrapObject(
|
const body: UserRegister = await this.hooks.wrapObject(
|
||||||
Object.assign(this.formStepUser.value, { channel: this.formStepChannel.value }),
|
Object.assign(this.formStepUser.value, { channel: this.formStepChannel.value }),
|
||||||
|
'signup',
|
||||||
'filter:api.signup.registration.create.params'
|
'filter:api.signup.registration.create.params'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -18,11 +18,10 @@ export class HooksService {
|
||||||
|
|
||||||
wrapObsFun
|
wrapObsFun
|
||||||
<P, R, H1 extends ClientFilterHookName, H2 extends ClientFilterHookName>
|
<P, R, H1 extends ClientFilterHookName, H2 extends ClientFilterHookName>
|
||||||
(fun: ObservableFunction<P, R>, params: P, scope: PluginClientScope, hookParamName: H1, hookResultName: H2)
|
(fun: ObservableFunction<P, R>, params: P, scope: PluginClientScope, hookParamName: H1, hookResultName: H2) {
|
||||||
{
|
|
||||||
return from(this.pluginService.ensurePluginsAreLoaded(scope))
|
return from(this.pluginService.ensurePluginsAreLoaded(scope))
|
||||||
.pipe(
|
.pipe(
|
||||||
mergeMap(() => this.wrapObject(params, hookParamName)),
|
mergeMap(() => this.wrapObjectWithoutScopeLoad(params, hookParamName)),
|
||||||
switchMap(params => fun(params)),
|
switchMap(params => fun(params)),
|
||||||
mergeMap(result => this.pluginService.runHook(hookResultName, result, params))
|
mergeMap(result => this.pluginService.runHook(hookResultName, result, params))
|
||||||
)
|
)
|
||||||
|
@ -30,11 +29,10 @@ export class HooksService {
|
||||||
|
|
||||||
async wrapFun
|
async wrapFun
|
||||||
<P, R, H1 extends ClientFilterHookName, H2 extends ClientFilterHookName>
|
<P, R, H1 extends ClientFilterHookName, H2 extends ClientFilterHookName>
|
||||||
(fun: RawFunction<P, R>, params: P, scope: PluginClientScope, hookParamName: H1, hookResultName: H2)
|
(fun: RawFunction<P, R>, params: P, scope: PluginClientScope, hookParamName: H1, hookResultName: H2) {
|
||||||
{
|
|
||||||
await this.pluginService.ensurePluginsAreLoaded(scope)
|
await this.pluginService.ensurePluginsAreLoaded(scope)
|
||||||
|
|
||||||
const newParams = await this.wrapObject(params, hookParamName)
|
const newParams = await this.wrapObjectWithoutScopeLoad(params, hookParamName)
|
||||||
const result = fun(newParams)
|
const result = fun(newParams)
|
||||||
|
|
||||||
return this.pluginService.runHook(hookResultName, result, params)
|
return this.pluginService.runHook(hookResultName, result, params)
|
||||||
|
@ -46,7 +44,13 @@ export class HooksService {
|
||||||
.catch((err: any) => console.error('Fatal hook error.', { err }))
|
.catch((err: any) => console.error('Fatal hook error.', { err }))
|
||||||
}
|
}
|
||||||
|
|
||||||
private wrapObject<T, U extends ClientFilterHookName> (result: T, hookName: U) {
|
async wrapObject<T, U extends ClientFilterHookName> (result: T, scope: PluginClientScope, hookName: U) {
|
||||||
|
await this.pluginService.ensurePluginsAreLoaded(scope)
|
||||||
|
|
||||||
|
return this.wrapObjectWithoutScopeLoad(result, hookName)
|
||||||
|
}
|
||||||
|
|
||||||
|
private wrapObjectWithoutScopeLoad<T, U extends ClientFilterHookName> (result: T, hookName: U) {
|
||||||
return this.pluginService.runHook(hookName, result)
|
return this.pluginService.runHook(hookName, result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue