refactor: 将widget移动到apps中

pull/56/head
moonrailgun 2 years ago
parent b5e73ecec8
commit dbe2d91dd9

@ -12,7 +12,10 @@
<script type="module">
import { createTailchatWidget } from '../lib/index.js';
createTailchatWidget({});
createTailchatWidget({
groupId: '611e4e18d3e846001bd0223a',
panelId: '611e4e18d3e846001bd02239',
});
</script>
</body>

@ -15,6 +15,6 @@
"release": "yarn publish --patch"
},
"devDependencies": {
"typescript": "^4.4.4"
"typescript": "^4.8.2"
}
}

@ -4,14 +4,14 @@ export interface TailchatWidgetOptions {
*/
host?: string;
groupId: string;
channelId: string;
panelId: string;
widgetStyle?: Partial<CSSStyleDeclaration>;
iconStyle?: Partial<CSSStyleDeclaration>;
frameStyle?: Partial<CSSStyleDeclaration>;
}
const defaultTailchatWidgetOptions: Partial<TailchatWidgetOptions> = {
host: 'https://nightly.paw.msgbyte.com/',
host: 'https://nightly.paw.msgbyte.com',
};
const defaultWidgetStyle: Partial<CSSStyleDeclaration> = {
@ -50,7 +50,7 @@ const closeIconSvg = `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http:
export function createTailchatWidget(_options: TailchatWidgetOptions) {
const options = { ...defaultTailchatWidgetOptions, ..._options };
const url = `${options.host}${options.groupId}/${options.channelId}`;
const url = `${options.host}/panel/group/${options.groupId}/${options.panelId}`;
// 容器
const container = document.createElement('div');

@ -2,7 +2,7 @@
"compilerOptions": {
"target": "ES5",
"declaration": true,
"lib": ["DOM"],
"lib": ["DOM", "ESNext"],
"rootDir": "./src",
"outDir": "lib"
}

@ -1,8 +0,0 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
typescript@^4.4.4:
version "4.4.4"
resolved "https://registry.npmmirror.com/typescript/download/typescript-4.4.4.tgz#2cd01a1a1f160704d3101fd5a58ff0f9fcb8030c"
integrity sha1-LNAaGh8WBwTTEB/VpY/w+fy4Aww=

@ -156,6 +156,12 @@ importers:
ts-node: 10.9.1_k2dsl7zculo2nmh5s33pladmoa
typescript: 4.8.2
apps/widget:
specifiers:
typescript: ^4.8.2
devDependencies:
typescript: 4.8.2
client/packages/design:
specifiers:
'@babel/core': ^7.17.9
@ -11639,7 +11645,7 @@ packages:
babel-plugin-syntax-jsx: 6.18.0
lodash: 4.17.21
picomatch: 2.3.1
styled-components: 5.3.6_7i5myeigehqah43i5u7wbekgba
styled-components: 5.3.6_react@18.2.0
/babel-plugin-syntax-jsx/6.18.0:
resolution: {integrity: sha512-qrPaCSo9c8RHNRHIotaufGbuOBN8rtdC4QrrFFc43vyWCCz7Kl7GL1PGaXtMGQZUXrkCjNEgxDfmAuAabr/rlw==}
@ -19492,7 +19498,7 @@ packages:
pretty-format: 27.5.1
slash: 3.0.0
strip-json-comments: 3.1.1
ts-node: 10.9.1_bqee57coj3oib6dw4m24wknwqe
ts-node: 10.9.1_k2dsl7zculo2nmh5s33pladmoa
transitivePeerDependencies:
- bufferutil
- canvas
@ -28929,6 +28935,7 @@ packages:
react-is: 18.2.0
shallowequal: 1.1.0
supports-color: 5.5.0
dev: false
/styled-components/5.3.6_mdz3marskokvq6744hhidi3r5a:
resolution: {integrity: sha512-hGTZquGAaTqhGWldX7hhfzjnIYBZ0IXQXkCYdvF1Sq3DsUaLx6+NTHC5Jj1ooM2F68sBiVz3lvhfwQs/S3l6qg==}
@ -28974,7 +28981,6 @@ packages:
react: 18.2.0
shallowequal: 1.1.0
supports-color: 5.5.0
dev: true
/styled-system/5.1.5:
resolution: {integrity: sha512-7VoD0o2R3RKzOzPK0jYrVnS8iJdfkKsQJNiLRDjikOpQVqQHns/DXWaPZOH4tIKkhAT7I6wIsy9FWTWh2X3q+A==}

Loading…
Cancel
Save