0.1.69 • Published 3 months ago

@touchcastllc/touchcast-metaverse-widget-context v0.1.69

Weekly downloads
-
License
ISC
Repository
-
Last release
3 months ago

Touchcast widget context

Touchcast widget context allowing you to interact with Touchcast backend and another widgets on the same call, send commands, receive updates.

Usage/Examples

<WidgetFrameContextProvider>
    // Your design
</WidgetFrameContextProvider>

// Your design container should use  HOC 'withWidget'
export default withWidget(WidgetContainer);

Documentation

Context functions :

  • sendCommandV2 - sending command
    this.sendCommand(CommandType.RunSequence, [ "Main Sequence" ])

    sendCommand = (name: CommandType, args: string[]) => {
        const { sendCommandV2, setWidgetData, widgetData } = this.props;



        sendCommandV2({
            name: name,
            arguments: args
        });
    }
  • setWidgetData - allowing widget communication
        setWidgetData({
            ...widgetData,
            currentCommand: {
                Type: name,
                Args: args
            }
        });
  • sendMuteAllUpdate - allowing mute all participants
    onMuteAllClicked = () => {
        const { isMuteAllEnabled, sendMuteAllUpdate } = this.props;
        sendMuteAllUpdate(!isMuteAllEnabled);
    };
  • setActiveSpeaker - allowing set active speaker
  const speakerPersonas = participants.speakers;
    <Stack tokens={{ childrenGap: 8 }}>
        {speakerPersonas && speakerPersonas.map((props, i) => (
            <SpeakerPersona
                {...(props as Omit<IMetaversePersonaProps, "ref">)}
                key={i}
                onClick={() => {
                    this.onChangeActiveSpeaker(props.partcipantId);
                }} />
        ))}
    </Stack>


    onChangeActiveSpeaker = async (id?: string) => {
        const { setActiveSpeaker } = this.props;
        const speakerId = id ?? null;
        setActiveSpeaker(speakerId);
    }
  • changeWidgetContainerVisibility - show/hide widget
 if (isBuyer === undefined) {
            console.log("No Widget");
            changeWidgetContainerVisibility(false);
            return (<div></div>);
        }

Context props :

  • isBuyer - is it a buyer or a seller the widget should be shown to,
  • widgetData - this basically your data that will be send from one widget to another to update widget state,
  • participants - list of participants of the call,
  • isMuteAllEnabled - is muted
0.1.69

3 months ago

0.1.68

3 months ago

0.1.67

3 months ago

0.1.66

4 months ago

0.1.65

4 months ago

0.1.64

4 months ago

0.1.63

4 months ago

0.1.62

4 months ago

0.1.61

5 months ago

0.1.60

5 months ago

0.1.59

5 months ago

0.1.52

8 months ago

0.1.53

8 months ago

0.1.54

8 months ago

0.1.55

8 months ago

0.1.56

8 months ago

0.1.57

8 months ago

0.1.58

6 months ago

0.1.50

9 months ago

0.1.51

9 months ago

0.1.49

9 months ago

0.1.41

10 months ago

0.1.42

10 months ago

0.1.43

10 months ago

0.1.44

10 months ago

0.1.45

9 months ago

0.1.46

9 months ago

0.1.47

9 months ago

0.1.48

9 months ago

0.1.40

10 months ago

0.1.38

10 months ago

0.1.39

10 months ago

0.1.30

10 months ago

0.1.31

10 months ago

0.1.32

10 months ago

0.1.33

10 months ago

0.1.34

10 months ago

0.1.35

10 months ago

0.1.36

10 months ago

0.1.37

10 months ago

0.1.29

10 months ago

0.1.28

11 months ago

0.1.23

1 year ago

0.1.24

1 year ago

0.1.25

1 year ago

0.1.26

1 year ago

0.1.27

1 year ago

0.1.20

1 year ago

0.1.21

1 year ago

0.1.22

1 year ago

0.1.14

1 year ago

0.1.15

1 year ago

0.1.16

1 year ago

0.1.17

1 year ago

0.1.18

1 year ago

0.1.19

1 year ago

0.1.13

1 year ago

0.1.12

1 year ago