How to use the @codesandbox/common/lib/utils/analytics function in @codesandbox/common

To help you get started, we’ve selected a few @codesandbox/common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codesandbox / codesandbox-client / packages / app / src / app / pages / Dashboard / Content / routes / CreateTeam / index.js View on Github external
const submit = e => {
              e.preventDefault();
              e.stopPropagation();
              const name = this.state.inputValue;

              track('Team - Create Team');

              mutate({
                variables: {
                  name,
                },
                optimisticResponse: {
                  __typename: 'Mutation',
                  createTeam: {
                    __typename: 'Team',
                    id: 'new-team',
                    name,
                  },
                },
                update: (proxy, { data: { createTeam } }) => {
                  // Read the data from our cache for this query.
                  const d = proxy.readQuery({
github codesandbox / codesandbox-client / packages / app / src / app / pages / Dashboard / Content / SandboxGrid / index.tsx View on Github external
this.setState({
          localSandboxesSelected: sandboxIds,
        });
      } else {
        this.props.sandboxesSelected({
          sandboxIds,
        });
        this.setState({
          localSandboxesSelected: null,
        });
      }
    };

    if (range === true) {
      if (!delay) {
        track('Dashboard - Sandbox Shift Selection');
      }
      const indexedSandboxes = sandboxes.map((sandbox, i) => ({ sandbox, i }));

      // We need to select a range
      const firstIndexInfo = indexedSandboxes.find(({ sandbox }) =>
        selectedSandboxes.includes(sandbox.id)
      );

      const [id] = ids;

      const lastIndexInfo = indexedSandboxes.find(
        ({ sandbox }) => sandbox.id === id
      );

      if (firstIndexInfo && lastIndexInfo) {
        const indexes = [firstIndexInfo.i, lastIndexInfo.i].sort();
github codesandbox / codesandbox-client / packages / app / src / app / store / modules / files / actions.js View on Github external
const signal = controller.getSignal('editor.codeChanged');
        signal({
          code: recoverData.code,
          moduleShortid: module.shortid,
        });

        return true;
      }

      return false;
    })
    .filter(Boolean);
  const numRecoveredFiles = recoveredList.length;

  if (numRecoveredFiles > 0) {
    track('Files Recovered', { fileCount: numRecoveredFiles });

    notificationState.addNotification({
      message: `We recovered ${numRecoveredFiles} unsaved ${
        numRecoveredFiles > 1 ? 'files' : 'file'
      } from a previous session`,
      status: NotificationStatus.NOTICE,
    });
  }

  return {};
}
github codesandbox / codesandbox-client / packages / app / src / app / store / modules / workspace / sequences.js View on Github external
({ props: givenProps }) => {
    track('Sandbox - Update Privacy', {
      source: 'editor',
      privacy: givenProps.privacy,
    });
  },
  when(
github codesandbox / codesandbox-client / packages / app / src / app / pages / Dashboard / Content / routes / TeamView / index.js View on Github external
{(mutate, { loading: revokeLoading }) => {
                                    track('Team - Revoke Invitation');

                                    const handleClick = () =>
                                      mutate({
                                        variables: { userId: user.id, teamId },
                                      });

                                    return (
github codesandbox / codesandbox-client / packages / app / src / app / pages / common / UserMenu / Menu / index.tsx View on Github external
useEffect(() => {
    if (menuProps.visible) {
      track('User Menu Open');
    }
  }, [menuProps.visible]);
github codesandbox / codesandbox-client / packages / app / src / app / store / modules / workspace / sequences.js View on Github external
if (
          state.get('workspace.project.description') &&
          state.get(
            `editor.sandboxes.${state.get('editor.currentId')}.description`
          ) !== state.get('workspace.project.description')
        ) {
          track('Sandbox - Update Description');
        }

        if (
          state.get('workspace.project.alias') &&
          state.get(
            `editor.sandboxes.${state.get('editor.currentId')}.alias`
          ) !== state.get('workspace.project.alias')
        ) {
          track('Sandbox - Update Alias');
        }
      },
github codesandbox / codesandbox-client / packages / app / src / app / store / modules / workspace / sequences.js View on Github external
if (
          state.get('workspace.project.title') &&
          state.get(
            `editor.sandboxes.${state.get('editor.currentId')}.title`
          ) !== state.get('workspace.project.title')
        ) {
          track('Sandbox - Update Title');
        }

        if (
          state.get('workspace.project.description') &&
          state.get(
            `editor.sandboxes.${state.get('editor.currentId')}.description`
          ) !== state.get('workspace.project.description')
        ) {
          track('Sandbox - Update Description');
        }

        if (
          state.get('workspace.project.alias') &&
          state.get(
            `editor.sandboxes.${state.get('editor.currentId')}.alias`
          ) !== state.get('workspace.project.alias')
        ) {
          track('Sandbox - Update Alias');
        }
      },
github codesandbox / codesandbox-client / packages / app / src / app / pages / Dashboard / Sidebar / SandboxesItem / FolderEntry / CreateFolderEntry.tsx View on Github external
onSubmit={e => {
            e.preventDefault();
            const path = basePath + '/' + input.value;

            track('Dashboard - Create Directory', {
              path,
            });

            mutate({
              variables: { path, teamId },
              optimisticResponse: {
                __typename: 'Mutation',
                createCollection: {
                  id: 'optimistic-id',
                  path,
                  __typename: 'Collection',
                },
              },
              update: (proxy, { data: { createCollection } }) => {
                const variables: { teamId?: string } = {};
                if (teamId) {