Skip to content

Latest commit

 

History

History
151 lines (126 loc) · 6.59 KB

README.zh.md

File metadata and controls

151 lines (126 loc) · 6.59 KB

bytedesk-web

Online customer service SDK, supporting multiple frameworks:

admin chat

English Document

Installation Steps

Install Dependencies

npm install bytedesk-web
#
yarn add bytedesk-web

导入组件

import { BytedeskReact } from 'bytedesk-web/react';
import type { BytedeskConfig } from 'bytedesk-web/react';

配置参数

const config: BytedeskConfig = {
  placement: 'bottom-right',
  marginBottom: 20,
  marginSide: 20,
  bubbleConfig: {
    show: true,
    icon: '👋',
    title: 'Need help?',
    subtitle: 'Click to chat'
  },
  buttonConfig: {
    show: true,
    width: 60,
    height: 60,
    // icon: '👋',
    // text: '需要帮助吗?',
  },
  chatConfig: {
    org: 'df_org_uid',  // 替换为您的组织ID
    t: "2",
    sid: 'df_rt_uid'      // 替换为您的SID
  }
};

使用组件

const App = () => {
  const handleInit = () => {
    console.log('BytedeskReact initialized');
  };

  return (
    <div>
      <BytedeskReact {...config} onInit={handleInit} />
      <button onClick={() => (window as any).bytedesk?.showChat()}>
        打开聊天
      </button>
    </div>
  );
};

可用方法

# 显示/隐藏按钮
(window as any).bytedesk?.showButton();
(window as any).bytedesk?.hideButton();

# 显示/隐藏气泡消息
(window as any).bytedesk?.showBubble();
(window as any).bytedesk?.hideBubble();

# 显示/隐藏聊天窗口
(window as any).bytedesk?.showChat();
(window as any).bytedesk?.hideChat();

# 显示/隐藏邀请对话框
(window as any).bytedesk?.showInviteDialog();
(window as any).bytedesk?.hideInviteDialog();

运行示例

yarn install
yarn demo:react    # Run React demo
yarn demo:vue      # Run Vue demo
yarn demo:svelte   # Run Svelte demo
yarn demo:vanilla  # Run Vanilla JS demo
yarn demo:angular  # Run Angular demo
yarn demo:nextjs   # Run Next.js demo

# JavaScript demo requires build first
yarn build
yarn demo:javascript

开源Demo + SDK

Project Description Forks Stars
iOS iOS GitHub forks GitHub Repo stars
Android Android GitHub forks GitHub Repo stars
Flutter Flutter GitHub forks GitHub Repo stars
UniApp Uniapp GitHub forks GitHub Repo stars
Web Vue/React/Angular/Next.js/JQuery/... GitHub forks GitHub Repo stars
Wordpress Wordpress GitHub forks GitHub Repo stars
Woocommerce woocommerce GitHub forks GitHub Repo stars
Magento Magento GitHub forks GitHub Repo stars
Prestashop Prestashop GitHub forks GitHub Repo stars
Shopify Shopify GitHub forks GitHub Repo stars
Opencart Opencart GitHub forks GitHub Repo stars
Laravel Laravel GitHub forks GitHub Repo stars
Django Django GitHub forks GitHub Repo stars