Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Here you find all information related to a Trixta space.
Here you will find all information related to Trixta Roles, Actions, Reactions
All types mentioned in the docs can be found here.
/**
* Combine all reducers in this file and export the combined reducers.
*/
import { combineReducers } from '@reduxjs/toolkit';
import { phoenixReducer } from '@trixtateam/phoenix-to-redux';
import { trixtaReducer } from '@trixtateam/trixta-js-core-core';
export default function createReducer() {
const rootReducer = combineReducers({
trixta: trixtaReducer,
phoenix: phoenixReducer,
});
return rootReducer;
}import { configureStore, getDefaultMiddleware } from '@reduxjs/toolkit';
import { createPhoenixChannelMiddleware } from '@trixtateam/phoenix-to-redux';
import createSagaMiddleware from 'redux-saga';
import { createReducer } from './reducers';
export default function configureStore() {
const reduxSagaMonitorOptions = {};
// Makes redux connected to phoenix channels
const phoenixChannelMiddleWare = createPhoenixChannelMiddleware();
const sagaMiddleware = createSagaMiddleware(reduxSagaMonitorOptions);
// Create the store with saga middleware
const middlewares = [sagaMiddleware,phoenixChannelMiddleWare];
const enhancers = [];
const store = configureStore({
reducer: createReducer(),
middleware: [
...getDefaultMiddleware({
thunk: false,
immutableCheck: {
ignore: ['socket', 'channel', 'trixta', 'phoenix', 'router'],
},
serializableCheck: false,
}),
...middlewares,
],
devTools:
/* istanbul ignore next line */
process.env.NODE_ENV !== 'production' ||
process.env.PUBLIC_URL.length > 0,
enhancers,
});
return store;
}import { configureStore, getDefaultMiddleware } from '@reduxjs/toolkit';
import { createPhoenixChannelMiddleware } from '@trixtateam/phoenix-to-redux';
import createSagaMiddleware from 'redux-saga';
import { setupTrixtaSaga } from '@trixtateam/trixta-js-core';
import createReducer from './reducers';
export default function configureStore() {
const reduxSagaMonitorOptions = {};
// Makes redux connected to phoenix channels
const phoenixChannelMiddleWare = createPhoenixChannelMiddleware();
const sagaMiddleware = createSagaMiddleware(reduxSagaMonitorOptions);
const middlewares = [sagaMiddleware,phoenixChannelMiddleWare];
const enhancers = [];
const store = configureStore({
reducer: createReducer(),
middleware: [
...getDefaultMiddleware({
thunk: false,
immutableCheck: {
ignore: ['socket', 'channel', 'trixta', 'phoenix', 'router'],
},
serializableCheck: false,
}),
...middlewares,
],
devTools:
/* istanbul ignore next line */
process.env.NODE_ENV !== 'production' ||
process.env.PUBLIC_URL.length > 0,
enhancers,
});
sagaMiddleware.run(setupTrixtaSaga);
return store;
}import { put, select, takeLatest, takeEvery, fork } from 'redux-saga/effects';
import { setupTrixtaSaga } from '@trixtateam/trixta-js-core';
export default function* rootSaga() {
yield fork(setupTrixtaSaga);
}import { configureStore, getDefaultMiddleware } from '@reduxjs/toolkit';
import { createPhoenixChannelMiddleware } from '@trixtateam/phoenix-to-redux';
import createSagaMiddleware from 'redux-saga';
import rootSaga from './rootSaga';
import createReducer from './reducers';
export default function configureStore() {
const reduxSagaMonitorOptions = {};
// Makes redux connected to phoenix channels
const phoenixChannelMiddleWare = createPhoenixChannelMiddleware();
const sagaMiddleware = createSagaMiddleware(reduxSagaMonitorOptions);
const middlewares = [sagaMiddleware,phoenixChannelMiddleWare];
const enhancers = [];
const store = configureStore({
reducer: createReducer(),
middleware: [
...getDefaultMiddleware({
thunk: false,
immutableCheck: {
ignore: ['socket', 'channel', 'trixta', 'phoenix', 'router'],
},
serializableCheck: false,
}),
...middlewares,
],
devTools:
/* istanbul ignore next line */
process.env.NODE_ENV !== 'production' ||
process.env.PUBLIC_URL.length > 0,
enhancers,
});
sagaMiddleware.run(rootSaga);
return store;
}import * as React from 'react';
import { useTrixtaSpace } from '@trixtateam/trixta-js-core';
import Providers from './Providers';
import Routes from './Routes';
export function App() {
useTrixtaSpace({ space: 'trixta-demo.space.trixta.io', params: {}});
return (<Providers>
<Routes />
</Providers>)
}
export default App;import { put, select, takeLatest, takeEvery, fork } from 'redux-saga/effects';
import { connectTrixta } from '@trixtateam/trixta-js-core';
export function* connectTrixtaSaga() {
yield put(connectTrixta({ space: 'trixta-demo.space.trixta.io'}));
}
export default function* rootSaga() {
yield fork(setupTrixtaSaga);
yield call(connectTrixtaSaga);
}yarn add @trixtateam/trixta-js-core @trixtateam/phoenix-to-reduxnpm i @trixtateam/trixta-js-core @trixtateam/phoenix-to-reduxThis method will attempt to reset the progress status in the Trixta Reducer for the given roleName and reactionName
This method will attempt to respond to a Trixta Reaction for the given roleName and reactionName
Trixta action related methods can be found here.
import {
clearTrixtaReactionRequestStatus
} from '@trixtateam/trixta-js-core';import {
submitTrixtaReactionResponse
} from '@trixtateam/trixta-js-core';Here you can find information all the react methods that you can dispatch.
This method will attempt to clear a responses in the Trixta Reducer for the given roleName and reactionName
import {
clearTrixtaReactionResponse
} from '@trixtateam/trixta-js-core';This method will attempt to leave the given Trixta Role on connected Trixta Space
This method will attempt to send a request to the given roleName and actionName
Here you will find all saga helper methods.
import {
removeTrixtaRole
} from '@trixtateam/trixta-js-core';import {
submitTrixtaActionResponse
} from '@trixtateam/trixta-js-core';Here you can find information on all the react components.
This helper method will return the react redux dispatch event for a given roleName and reactionName. This can be used to listen for reactions in saga using the takeEvery effect
{
slowdown: number;
inspect: boolean;
debug_broadcast: {
role: string;
}
}Trixta reaction related methods can be found here.
export const EXAMPLE_RESPONSE = 'app/EXAMPLE_RESPONSE';
export function functionToDispatch(payload) {
return {
type: EXAMPLE_RESPONSE,
payload,
}
}import { put,takeEvery } from 'redux-saga/effects';
import { listenForTrixtaReactionResponse } from '@trixtateam/trixta-js-core';
export default function* checkReactionSaga({ meta, reactionDetails }) {
const { reactionDetails } = payload;
const { reactionName, roleName } = meta;
if(reactionName === 'name of Trixta reaction'){
yield put(functionToDispatch(reactionDetails.initial_data));
}
}
export default function* globalSaga() {
yield takeEvery(listenForTrixtaReactionResponse({
roleName: // name of Trixta role
reactionName: // name of Trixta reaction
}),checkReactionSaga);
}Will listen for a Trixta reaction for the given roleName and reactionName, dispatching the data to actionToDispatch or dispatchResponseTo parameters
export const EXAMPLE_RESPONSE = 'app/EXAMPLE_RESPONSE';
export function functionToDispatch(payload) {
return {
type: EXAMPLE_RESPONSE,
payload,
}
}import { fork } from '@redux-saga/core/effects';
import { respondToTrixtaReactionEffectSaga } from '@trixtateam/trixta-js-core';
export default function* defaultSaga() {
yield fork(respondToTrixtaReactionEffectSaga, {
roleName: "",
reactionName: "",
actionToDispatch: functionToDispatch,
});
}import { fork } from '@redux-saga/core/effects';
import { respondToTrixtaReactionEffectSaga } from '@trixtateam/trixta-js-core';
export const EXAMPLE_RESPONSE = 'app/EXAMPLE_RESPONSE';
export default function* defaultSaga() {
yield fork(respondToTrixtaReactionEffectSaga, {
roleName: "",
reactionName: "",
dispatchResponseTo: EXAMPLE_RESPONSE,
});
}React component used to pass Trixta Reaction Response Props to your child component or function.
React component used to pass Trixta Reaction Props to your child component or function.
React component used to respond to many Trixta reaction effect or response by dispatching the response / initialData to actionToDispatch or dispatchResponseTo props.
Trixta reaction related components can be found here.
React component used to respond to the latest Trixta reaction effect or response when shouldRespond is true, by dispatching the response / initialData to actionToDispatch or dispatchResponseTo props.
Here you can find information on all the react hooks.
Trixta reaction related hooks can be found here.
Trixta action related components can be found here.
import {
TrixtaReactionResponseComponent,
TrixtaReactionComponentArgs
} from '@trixtateam/trixta-js-core';
<TrixtaReactionResponseComponent
roleName=""
reactionName=""
debugMode={false}
>
{({
isInProgress,
loading,
instance,
response,
data,
}: TrixtaReactionComponentArgs<
TInitialData,TFormDataType,TSuccessType,TErrorType
>) => (
{function | <component />}
)}
</TrixtaReactionResponseComponent>import {
TrixtaReactionComponent,
TrixtaReactionComponentArgs
} from '@trixtateam/trixta-js-core';
<TrixtaReactionComponent
roleName=""
reactionName=""
includeResponse={false}
initialData={}
extraData={}
requestForEffect={false}
defaultComponent={<Component/>}
debugMode={false}
requestEvent=""
responseEvent=""
errorEvent=""
timeoutEvent=""
timeout={1500}
setTimeoutEventAsErrorEvent={false}
>
{({
submit,
isInProgress,
loading,
instance,
response,
data,
}: TrixtaReactionComponentArgs<
TInitialData,TFormDataType,TSuccessType,TErrorType
>) => (
{function | <component />}
)}
</TrixtaReactionComponent>export function functionToDispatch(payload) {
return {
type: '',
payload,
}
}import {
RespondToReactionsComponent,
} from '@trixtateam/trixta-js-core';
<RespondToReactionsComponent
roleName=""
reactions={[{name,actionToDispatch,dispatchResponseTo,requestForEffect}]}
/>export function functionToDispatch(payload) {
return {
type: '',
payload,
}
}import {
RespondToReactionComponent,
} from '@trixtateam/trixta-js-core';
<RespondToReactionComponent
roleName=""
reactionName=""
formData={}
shouldRespond={false}
actionToDispatch={functionToDispatch}
dispatchResponseTo=""
requestForEffect={false}
/>React component used to pass Trixta Action Props to your child component or function.
import {
TrixtaActionComponent,
TrixtaActionComponentArgs
} from '@trixtateam/trixta-js-core';
<TrixtaActionComponent
roleName=""
actionName=""
initialData={}
extraData={}
debugOptions={}
debugMode={false}
requestEvent=""
responseEvent=""
errorEvent=""
timeoutEvent=""
timeout={1500}
setTimeoutEventAsErrorEvent={false}
actionOptions={}
>
{({
submit,
isInProgress,
instances,
response,
initialData,
}: TrixtaActionComponentArgs<
TFormDataType,TSuccessType,TErrorType
>) => (
{function | <component />}
)}
</TrixtaActionComponent>React component used to only render a child component or function, if you have access to the passed roleName.
React hook used to interact with a Trixta reaction that does not require a response for a given roleName. Will trigger the callBack when a reaction is received.
import {
TrixtaAuthComponent,
} from '@trixtateam/trixta-js-core';
<TrixtaAuthComponent
roleName=""
>
{children}
</TrixtaAuthComponent>import { useRespondToReactionEffect } from '@trixtateam/trixta-js-core';
const {
hasRoleAccess,
} = useRespondToReactionEffect<TInitialData>({
roleName:"",
reactionName:"",
callBack: (payload?: TInitialData) => {},
debugMode: false,
});React hook used to interact with a Trixta reaction that does require a response for a given roleName. Will trigger the callBack when a reaction is received.
true, enables Trixta console debuggingReact component used to pass Trixta Action Response Props to your child component or function.
import {
TrixtaActionResponseComponent,
TrixtaActionResponseComponentArgs
} from '@trixtateam/trixta-js-core';
<TrixtaActionResponseComponent
roleName=""
actionName=""
debugMode={false}
>
{({
instance,
response,
}: TrixtaActionResponseComponentArgs<
TSuccessType,TErrorType
>) => (
{function | <component />}
)}
</TrixtaActionResponseComponent>A react hook that will attempt to connect to the passed Trixta space and optional params, on mount of component. This hook should be used in the entry point of your react application.
A react hook that will return authentication and authorization info.
import { useTrixtaSpace } from '@trixtateam/trixta-js-core';
useTrixtaSpace({space,params});
import { useTrixtaAuth } from '@trixtateam/trixta-js-core';
const {
isAuthenticated,
hasRole,
hasAccess,
isAuthorizing
} = useTrixtaAuth({ roleName });
React hook used to interact with a Trixta action for a given roleName.
import { useTrixtaAction } from '@trixtateam/trixta-js-core';
const {
hasRoleAccess,
isInProgress,
hasResponse,
loading,
latestInstance,
response,
submitTrixtaAction,
clearActionResponses,
} = useTrixtaAction<TSuccessType,TErrorType>({ roleName:"",
actionName:"",
actionParameters:{
data:{},
extraData:{},
timeout:1500,
timeoutEvent:"",
loadingStatusRef:"",
requestEvent:"",
responseEvent:"",
errorEvent:""
},
loadingStatusRef:"",
options: {
debugMode: false,
autoSubmit: false,
setTimeoutEventAsErrorEvent: false,
clearResponsesOnCallback: false,
},
onSuccess:(success)=>{},
onError:(errror)=>{}
});React hook used to interact with a Trixta reaction for a given roleName.
import { useTrixtaReaction } from '@trixtateam/trixta-js-core';
const {
hasRoleAccess,
isInProgress,
latestResponse,
loading,
latestInstance,
instances,
initialData,
hasResponse,
submitTrixtaReaction,
clearReactionResponses,
} = useTrixtaReaction<TInitialData,TSuccessType,TErrorType>({ roleName:"",
reactionName:"",
requestForEffect:false,
loadingStatusRef:"",
debugMode: false,
setTimeoutEventAsErrorEvent: false,
clearResponsesOnCallback: false,
onSuccess:(success)=>{},
onError:(errror)=>{}
});true, this Trixta reaction is not waiting for a response and the only expect to use the initialDatatrue, enables Trixta console debuggingReact hook used to interact with a Trixta action and reaction for a given roleName. This hook uses a combination of both the useTrixtaAction and useTrixtaReaction hooks.
Here you can find more information on the Trixta Reducer
import { useTrixtaActionReaction } from '@trixtateam/trixta-js-core';
const {
hasRoleAccess,
initialData,
isInProgress,
hasResponse,
hasActionResponse,
hasReactionResponse,
loading,
actionResponse,
reactionResponse,
submitTrixtaActionResponse,
submitTrixtaReactionResponse,
clearActionResponses,
clearReactionResponses,
} = useTrixtaActionReaction<TInitialData,
TActionResponseType,
TActionErrorType,
TReactionResponseType,
TReactionErrorType
>({
actionProps:{
roleName:"",
actionName:"",
},
reactionProps:{
roleName:"",
reactionName:"",
},
autoSubmit:false,
actionParameters:{
data:{},
extraData:{},
timeout:1500,
timeoutEvent:"",
loadingStatusRef:"",
requestEvent:"",
responseEvent:"",
errorEvent:""
}
});true, this Trixta reaction is not waiting for a response and the only expect to use the initialData