0.2.0 • Published 2 years ago

@questflow/canvas v0.2.0

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago
interface CanvasProps {
  idToken: string; // 通过"获取用户的id_token"获取
  theme?: 'light' | 'dark'; // 主题,默认为light
  template?: { [key: string]: any }; // 模板对象,默认没有模板对象
  flowName?: string; // 新建流程的名称,默认为New Flow
  flowDescription?: string; // 新建流程的描述,默认为New Flow description
  onPublish?: (publishedFlow: PublishedFlow) => void; // 发布后回调
  onPre?: () => void; // 当点击返回时候的回调
  showPublishAsTemplate?: boolean; // 是否展示 publish as template按钮,默认不展示
  showPublish?: boolean; // 是否展示 publish 按钮,默认不展示
  showSave?: boolean; // 是否展示 save 按钮,默认不展示
  questflowURL?: string; // questflow地址,用于组件与questflow服务器通信
}

onPublish回调参数

interface PublishedFlow {
  createdAt: Date; // 创建时间
  name: string; // 流程名称
  isPublished: boolean; // 是否已经发布
  publishedAt: Date; // 发布时间
  flowId: string; // 流程id
  webhook?: string; // 执行流程的webhook
}

###一个使用的示例,可以使用create-react-app,然后替换App.tsx文件内容

import React from 'react';
import ReactDOM from 'react-dom';
import Canvas, { PublishedFlow } from '@questflow/canvas';

function App() {
  const idToken = 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImRQRmFnYnhObW1KM21zdHk2RXpuTmV1WGhpTE5LMGpmSlZhdlZDWXZtRWMifQ.eyJzdWIiOiI2NDVjYWFhMGVhM2UwZDk3YjcyNWNmY2UiLCJhdF9oYXNoIjoiUWljOEtpV0pBenRuUEliQnNSamdEdyIsInNpZCI6Ik9qeFhHQXVJa2lNWU1iaGpVVEtGTSIsImF1ZCI6ImZvb3RwcmludCIsImV4cCI6MTY4MzgyNjg5MCwiaWF0IjoxNjgzODIzMjkwLCJpc3MiOiJodHRwOi8vbG9jYWxob3N0OjMwMDAvYXBpL29pZGMifQ.S8Rrrn-r2mOwUpclVkWd2P6Rv3oNhOWvHwnDIjRTVjFMkeujBMWgH3aTWhvtoGBKPy3si7E2EmV5O572UTaaEr_mBljSjIiCabzvdYhbwnSw6MSpwNdt-io-G9Rxb8Zm9VFHsvnxNif2ueHc50eo9vPtAI6m47e1MU6irVBOOOmEz_6xHMCv397PXxVfpTF4peHsMNueceK-BYgjAbiXP52JJ4AeIvgwOEo5vR4ZdLMzS5KdSvELa08j_ag8KumKuK2njlaontIo2-56j_f2SvUSs7hWJfHC7F1k0VYMWcLjdmxcbucHIaViIyWszS-hmZXjQvkjUaM8blvjSd_Zfg'

  const onPublish = (flow: PublishedFlow) => {
    console.log(flow)
  }

  return (
    <div className="App">
      <Canvas flowId="644a36d563b13a9b5199b672" idToken={idToken} questflowURL={'https://staging.questflow.ai'} onPublish={onPublish}
        showSave={true} showPublish={true} />
    </div >
  );
}

export default App;
@apollo/client@aws-sdk/client-scheduler@aws-sdk/client-sqs@codemirror/lang-javascript@codemirror/lang-json@codemirror/search@codemirror/theme-one-dark@editorjs/checklist@editorjs/code@editorjs/delimiter@editorjs/editorjs@editorjs/embed@editorjs/header@editorjs/image@editorjs/inline-code@editorjs/link@editorjs/list@editorjs/marker@editorjs/nested-list@editorjs/paragraph@editorjs/quote@editorjs/raw@editorjs/simple-image@editorjs/table@editorjs/warning@headlessui/react@heroicons/react@lexical/react@m7eio/pob-core@m7eio/pob-general-workflow@m7eio/pob-js-sdk@moralisweb3/common-evm-utils@nextui-org/react@particle-network/auth@particle-network/rainbowkit-ext@radix-ui/react-accordion@radix-ui/react-alert-dialog@radix-ui/react-aspect-ratio@radix-ui/react-avatar@radix-ui/react-checkbox@radix-ui/react-collapsible@radix-ui/react-dialog@radix-ui/react-dropdown-menu@radix-ui/react-label@radix-ui/react-popover@radix-ui/react-radio-group@radix-ui/react-scroll-area@radix-ui/react-select@radix-ui/react-separator@radix-ui/react-slider@radix-ui/react-switch@radix-ui/react-tabs@radix-ui/react-tooltip@rainbow-me/rainbowkit@rainbow-me/rainbowkit-siwe-next-auth@reach/skip-nav@react-aria/button@react-aria/dialog@react-aria/focus@react-aria/overlays@react-editor-js/core@react-stately/overlays@sentry/nextjs@stripe/react-stripe-js@stripe/stripe-js@tailwindcss/aspect-ratio@tailwindcss/line-clamp@tailwindcss/typography@tryghost/nql@types/react-datepicker@types/store@types/uuid@uiw/react-codemirror@vercel/analyticsahooksanimate.cssaxioscanvas-confetticlass-variance-authorityclassnamescmdkcron-validated3-hierarchydaisyuidayjsdiscord-interactionseditorjs-blocks-react-renderereditorjs-drag-dropeditorjs-undoejsetherseventemitter3filepondfilepond-plugin-image-cropfilepond-plugin-image-editfilepond-plugin-image-exif-orientationfilepond-plugin-image-previewfilepond-plugin-image-resizefilepond-plugin-image-transformformikgraphqlgraphql-requesthtml-minifierhumanloopjoilexicallodashmongodbmongoosemongoose-paginate-v2moralisnextnext-authnext-connectnext-http-proxy-middlewarenext-intlnext-joinext-sitemapnext-themesnextjs-progressbaroidc-providerp-queuephosphor-reactqrcode.reactqsraw-bodyrc-imagerc-paginationrc-pickerrc-selectrc-sliderrc-uploadreact-ariareact-colorreact-copy-to-clipboardreact-datepickerreact-edit-textreact-editor-jsreact-filepondreact-imagereact-infinite-scroll-componentreact-json-treereact-lines-ellipsisreact-modern-drawerreact-playerreact-responsivereact-scrollreact-selectreact-sharereact-toastifyreactflowrekvsiweslateslate-historyslate-reactstorestripeswipertailwind-mergetailwindcssumi-requestuse-count-upuuidwagmiweb3web3-utilsyup
0.2.0

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago