@tencent-rtc/mcp 1.0.6 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/index.js +7 -8
- package/index.js.map +1 -1
- package/libs/@tencent/aegis-node-sdk/CHANGELOG.md +8 -0
- package/libs/@tencent/aegis-node-sdk/LICENSE +21 -0
- package/libs/@tencent/aegis-node-sdk/README.md +562 -0
- package/libs/@tencent/aegis-node-sdk/lib/aegis.min.js +1 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/constant/config.d.ts +14 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/constant/global.d.ts +1 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/constant/index.d.ts +9 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/constant/report-ignore.d.ts +2 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/core.d.ts +85 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/afterRequestHooks.d.ts +3 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/beforeRequestHooks.d.ts +9 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/hooks/modifyRequestHooks.d.ts +3 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/index.d.ts +9 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/interface/config.d.ts +62 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/interface/env.d.ts +11 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/interface/index.d.ts +4 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/interface/log.d.ts +130 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/interface/send.d.ts +34 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/format.d.ts +2 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/index.d.ts +18 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/length-limit.d.ts +8 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/pv.d.ts +8 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/remove-payload.d.ts +2 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/repeat-limit.d.ts +4 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/report.d.ts +10 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/sample.d.ts +3 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/throttle.d.ts +3 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/index.d.ts +34 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/jwt.d.ts +12 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/ot-js.d.ts +14 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/trace/uuid.d.ts +2 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/whitelist.d.ts +12 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/pipes/write-before.d.ts +3 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/plugin.d.ts +33 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/polyfill.d.ts +0 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/util/destroy.d.ts +2 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/util/event-emitter.d.ts +18 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/core/src/util/index.d.ts +60 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/index.d.ts +15 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/interface/selector.d.ts +5 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/pipes/batch-report-pipe.d.ts +6 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/protocol/protocol_base.d.ts +18 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/protocol/protocol_http.d.ts +12 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/ip_selector.d.ts +10 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/polaris_selector.d.ts +20 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/selector/selector_base.d.ts +27 -0
- package/libs/@tencent/aegis-node-sdk/lib/packages/node-sdk/src/util/eval_require.d.ts +2 -0
- package/libs/@tencent/aegis-node-sdk/package.json +19 -0
- package/libs/@tencent/polaris/README.md +407 -0
- package/libs/@tencent/polaris/dist/consumer/health.d.ts +126 -0
- package/libs/@tencent/polaris/dist/consumer/health.js +283 -0
- package/libs/@tencent/polaris/dist/consumer/health.js.map +1 -0
- package/libs/@tencent/polaris/dist/consumer/index.d.ts +120 -0
- package/libs/@tencent/polaris/dist/consumer/index.js +348 -0
- package/libs/@tencent/polaris/dist/consumer/index.js.map +1 -0
- package/libs/@tencent/polaris/dist/consumer/monitor.d.ts +145 -0
- package/libs/@tencent/polaris/dist/consumer/monitor.js +343 -0
- package/libs/@tencent/polaris/dist/consumer/monitor.js.map +1 -0
- package/libs/@tencent/polaris/dist/consumer/selector.d.ts +73 -0
- package/libs/@tencent/polaris/dist/consumer/selector.js +316 -0
- package/libs/@tencent/polaris/dist/consumer/selector.js.map +1 -0
- package/libs/@tencent/polaris/dist/errors.d.ts +373 -0
- package/libs/@tencent/polaris/dist/errors.js +154 -0
- package/libs/@tencent/polaris/dist/errors.js.map +1 -0
- package/libs/@tencent/polaris/dist/global.d.ts +16 -0
- package/libs/@tencent/polaris/dist/global.js +18 -0
- package/libs/@tencent/polaris/dist/global.js.map +1 -0
- package/libs/@tencent/polaris/dist/index.d.ts +62 -0
- package/libs/@tencent/polaris/dist/index.js +145 -0
- package/libs/@tencent/polaris/dist/index.js.map +1 -0
- package/libs/@tencent/polaris/dist/instance.d.ts +109 -0
- package/libs/@tencent/polaris/dist/instance.js +38 -0
- package/libs/@tencent/polaris/dist/instance.js.map +1 -0
- package/libs/@tencent/polaris/dist/limiter/bucket.d.ts +51 -0
- package/libs/@tencent/polaris/dist/limiter/bucket.js +152 -0
- package/libs/@tencent/polaris/dist/limiter/bucket.js.map +1 -0
- package/libs/@tencent/polaris/dist/limiter/index.d.ts +73 -0
- package/libs/@tencent/polaris/dist/limiter/index.js +149 -0
- package/libs/@tencent/polaris/dist/limiter/index.js.map +1 -0
- package/libs/@tencent/polaris/dist/limiter/ratelimit.d.ts +27 -0
- package/libs/@tencent/polaris/dist/limiter/ratelimit.js +134 -0
- package/libs/@tencent/polaris/dist/limiter/ratelimit.js.map +1 -0
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/base.d.ts +17 -0
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/base.js +15 -0
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/base.js.map +1 -0
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/global.d.ts +59 -0
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/global.js +397 -0
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/global.js.map +1 -0
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/index.d.ts +3 -0
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/index.js +19 -0
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/index.js.map +1 -0
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/local.d.ts +17 -0
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/local.js +52 -0
- package/libs/@tencent/polaris/dist/limiter/ratelimiter/local.js.map +1 -0
- package/libs/@tencent/polaris/dist/location.d.ts +48 -0
- package/libs/@tencent/polaris/dist/location.js +67 -0
- package/libs/@tencent/polaris/dist/location.js.map +1 -0
- package/libs/@tencent/polaris/dist/logging.d.ts +106 -0
- package/libs/@tencent/polaris/dist/logging.js +130 -0
- package/libs/@tencent/polaris/dist/logging.js.map +1 -0
- package/libs/@tencent/polaris/dist/metadata.d.ts +78 -0
- package/libs/@tencent/polaris/dist/metadata.js +119 -0
- package/libs/@tencent/polaris/dist/metadata.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/breaker/polaris.d.ts +47 -0
- package/libs/@tencent/polaris/dist/plugins/breaker/polaris.js +162 -0
- package/libs/@tencent/polaris/dist/plugins/breaker/polaris.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/lb/base.d.ts +24 -0
- package/libs/@tencent/polaris/dist/plugins/lb/base.js +32 -0
- package/libs/@tencent/polaris/dist/plugins/lb/base.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/lb/edf.d.ts +24 -0
- package/libs/@tencent/polaris/dist/plugins/lb/edf.js +77 -0
- package/libs/@tencent/polaris/dist/plugins/lb/edf.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/lb/hashring.d.ts +24 -0
- package/libs/@tencent/polaris/dist/plugins/lb/hashring.js +53 -0
- package/libs/@tencent/polaris/dist/plugins/lb/hashring.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/lb/sticky.d.ts +31 -0
- package/libs/@tencent/polaris/dist/plugins/lb/sticky.js +88 -0
- package/libs/@tencent/polaris/dist/plugins/lb/sticky.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/lb/swrr.d.ts +25 -0
- package/libs/@tencent/polaris/dist/plugins/lb/swrr.js +72 -0
- package/libs/@tencent/polaris/dist/plugins/lb/swrr.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/lb/wr.d.ts +17 -0
- package/libs/@tencent/polaris/dist/plugins/lb/wr.js +50 -0
- package/libs/@tencent/polaris/dist/plugins/lb/wr.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/lb/wrr.d.ts +19 -0
- package/libs/@tencent/polaris/dist/plugins/lb/wrr.js +81 -0
- package/libs/@tencent/polaris/dist/plugins/lb/wrr.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/logging/console.d.ts +10 -0
- package/libs/@tencent/polaris/dist/plugins/logging/console.js +38 -0
- package/libs/@tencent/polaris/dist/plugins/logging/console.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/naming/local-server/index.d.ts +32 -0
- package/libs/@tencent/polaris/dist/plugins/naming/local-server/index.js +88 -0
- package/libs/@tencent/polaris/dist/plugins/naming/local-server/index.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.d.ts +124 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.js +398 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/base.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.d.ts +27 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.js +287 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/discover.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.d.ts +15 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.js +43 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/index.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.d.ts +28 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.js +249 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/monitor.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.d.ts +19 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.js +222 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/adapter/ratelimit.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.d.ts +26 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.js +99 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/bidi.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.d.ts +60 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.js +259 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/index.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/discover.proto +24 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/monitor.proto +18 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/grpc/pb/ratelimit.proto +12 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.d.ts +39 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.js +115 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/connector/http/index.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/api.proto +24 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/client.proto +22 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/model.proto +28 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/ratelimit.proto +80 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/request.proto +18 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/response.proto +65 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/routing.proto +66 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/service.proto +95 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/discover-pb/types.d.ts +1568 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/index.d.ts +36 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/index.js +51 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/index.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/api.proto +18 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/circuitbreak.proto +67 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/request.proto +82 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/response.proto +11 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdkcache.proto +46 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdkconfiguration.proto +16 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/sdktoken.proto +10 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/monitor-pb/types.d.ts +1102 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/pool.d.ts +29 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/pool.js +77 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/pool.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/api.proto +12 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/ratelimit.proto +28 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/ratelimit-pb/types.d.ts +395 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/rules.d.ts +13 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/rules.js +116 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/rules.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/types.d.ts +67 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/types.js +67 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/types.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/utils.d.ts +99 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/utils.js +217 -0
- package/libs/@tencent/polaris/dist/plugins/naming/polaris-server/utils.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/registry/memory.d.ts +10 -0
- package/libs/@tencent/polaris/dist/plugins/registry/memory.js +50 -0
- package/libs/@tencent/polaris/dist/plugins/registry/memory.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/router/polaris/nearby.d.ts +51 -0
- package/libs/@tencent/polaris/dist/plugins/router/polaris/nearby.js +145 -0
- package/libs/@tencent/polaris/dist/plugins/router/polaris/nearby.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/router/polaris/rule.d.ts +11 -0
- package/libs/@tencent/polaris/dist/plugins/router/polaris/rule.js +174 -0
- package/libs/@tencent/polaris/dist/plugins/router/polaris/rule.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/router/trpc/canary.d.ts +25 -0
- package/libs/@tencent/polaris/dist/plugins/router/trpc/canary.js +36 -0
- package/libs/@tencent/polaris/dist/plugins/router/trpc/canary.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/router/trpc/env.d.ts +10 -0
- package/libs/@tencent/polaris/dist/plugins/router/trpc/env.js +34 -0
- package/libs/@tencent/polaris/dist/plugins/router/trpc/env.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/router/trpc/set.d.ts +56 -0
- package/libs/@tencent/polaris/dist/plugins/router/trpc/set.js +106 -0
- package/libs/@tencent/polaris/dist/plugins/router/trpc/set.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/shaping/unirate.d.ts +31 -0
- package/libs/@tencent/polaris/dist/plugins/shaping/unirate.js +124 -0
- package/libs/@tencent/polaris/dist/plugins/shaping/unirate.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/shaping/warmup.d.ts +61 -0
- package/libs/@tencent/polaris/dist/plugins/shaping/warmup.js +171 -0
- package/libs/@tencent/polaris/dist/plugins/shaping/warmup.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins/weight/polaris.d.ts +23 -0
- package/libs/@tencent/polaris/dist/plugins/weight/polaris.js +159 -0
- package/libs/@tencent/polaris/dist/plugins/weight/polaris.js.map +1 -0
- package/libs/@tencent/polaris/dist/plugins.d.ts +619 -0
- package/libs/@tencent/polaris/dist/plugins.js +91 -0
- package/libs/@tencent/polaris/dist/plugins.js.map +1 -0
- package/libs/@tencent/polaris/dist/polaris.d.ts +33 -0
- package/libs/@tencent/polaris/dist/polaris.js +59 -0
- package/libs/@tencent/polaris/dist/polaris.js.map +1 -0
- package/libs/@tencent/polaris/dist/provider/index.d.ts +102 -0
- package/libs/@tencent/polaris/dist/provider/index.js +168 -0
- package/libs/@tencent/polaris/dist/provider/index.js.map +1 -0
- package/libs/@tencent/polaris/dist/registry.d.ts +174 -0
- package/libs/@tencent/polaris/dist/registry.js +660 -0
- package/libs/@tencent/polaris/dist/registry.js.map +1 -0
- package/libs/@tencent/polaris/dist/rules.d.ts +163 -0
- package/libs/@tencent/polaris/dist/rules.js +24 -0
- package/libs/@tencent/polaris/dist/rules.js.map +1 -0
- package/libs/@tencent/polaris/dist/scripts/postinstall.d.ts +1 -0
- package/libs/@tencent/polaris/dist/scripts/postinstall.js +71 -0
- package/libs/@tencent/polaris/dist/scripts/postinstall.js.map +1 -0
- package/libs/@tencent/polaris/dist/service.d.ts +18 -0
- package/libs/@tencent/polaris/dist/service.js +3 -0
- package/libs/@tencent/polaris/dist/service.js.map +1 -0
- package/libs/@tencent/polaris/dist/skeleton.d.ts +87 -0
- package/libs/@tencent/polaris/dist/skeleton.js +282 -0
- package/libs/@tencent/polaris/dist/skeleton.js.map +1 -0
- package/libs/@tencent/polaris/dist/utils.d.ts +36 -0
- package/libs/@tencent/polaris/dist/utils.js +74 -0
- package/libs/@tencent/polaris/dist/utils.js.map +1 -0
- package/libs/@tencent/polaris/dist/weak.d.ts +11 -0
- package/libs/@tencent/polaris/dist/weak.js +44 -0
- package/libs/@tencent/polaris/dist/weak.js.map +1 -0
- package/libs/@tencent/polaris/package.json +114 -0
- package/libs/lib-generate-test-usersig-es.min.d.ts +6 -0
- package/libs/lib-generate-test-usersig-es.min.js +2 -0
- package/package.json +2 -1
- package/resource/doc/chatuikit/react/components/avatar.md +137 -0
- package/resource/doc/chatuikit/react/components/chat.md +44 -0
- package/resource/doc/chatuikit/react/components/chatheader.md +189 -0
- package/resource/doc/chatuikit/react/components/component-list.md +48 -0
- package/resource/doc/chatuikit/react/components/conversation-list.md +1017 -0
- package/resource/doc/chatuikit/react/components/message-input.md +950 -0
- package/resource/doc/chatuikit/react/components/message-list.md +485 -0
- package/resource/doc/chatuikit/react/components/tuikit.md +80 -0
- package/resource/doc/chatuikit/react/create-group.md +23 -0
- package/resource/doc/chatuikit/react/integration.md +83 -0
- package/resource/doc/chatuikit/react/login.md +26 -0
- package/resource/doc/chatuikit/vue/components/avatar.md +137 -0
- package/resource/doc/chatuikit/vue/components/chat.md +42 -0
- package/resource/doc/chatuikit/vue/components/chatheader.md +189 -0
- package/resource/doc/chatuikit/vue/components/component-list.md +102 -0
- package/resource/doc/chatuikit/vue/components/conversation-list.md +765 -0
- package/resource/doc/chatuikit/vue/components/message-input.md +1272 -0
- package/resource/doc/chatuikit/vue/components/message-list.md +662 -0
- package/resource/doc/chatuikit/vue/components/tuikit.md +45 -0
- package/resource/doc/chatuikit/vue/components/userpicker.md +315 -0
- package/resource/doc/chatuikit/vue/create-group.md +25 -0
- package/resource/doc/chatuikit/vue/integration.md +256 -0
- package/resource/doc/chatuikit/vue/login.md +31 -0
- package/resource/doc/chatuikit/vue3/components/MessageInput.md +1272 -0
- package/resource/doc/chatuikit/vue3/components/avatar.md +137 -0
- package/resource/doc/chatuikit/vue3/components/chatheader.md +189 -0
- package/resource/doc/chatuikit/vue3/components/component-list.md +102 -0
- package/resource/doc/chatuikit/vue3/components/userpicker.md +315 -0
- package/resource/doc/chatuikit/vue3/integration.md +256 -0
- package/server.js +10 -181
- package/server.js.map +1 -1
- package/streamable-http.js +69 -0
- package/streamable-http.js.map +1 -0
- package/tools/call/get-call-faq.js +32 -0
- package/tools/call/get-call-faq.js.map +1 -0
- package/tools/call/get-native-call-integration-guide.js +36 -0
- package/tools/call/get-native-call-integration-guide.js.map +1 -0
- package/tools/call/get-native-call-integration.js +35 -0
- package/tools/call/get-native-call-integration.js.map +1 -0
- package/tools/call/get-web-call-integration-guide.js +35 -0
- package/tools/call/get-web-call-integration-guide.js.map +1 -0
- package/tools/call/get-web-call-integration.js +35 -0
- package/tools/call/get-web-call-integration.js.map +1 -0
- package/tools/chat/create-group.js +30 -0
- package/tools/chat/create-group.js.map +1 -0
- package/tools/chat/get-chat-faq.js +32 -0
- package/tools/chat/get-chat-faq.js.map +1 -0
- package/tools/chat/get-native-chat-integration-guide.js +34 -0
- package/tools/chat/get-native-chat-integration-guide.js.map +1 -0
- package/tools/chat/get-native-chat-integration.js +34 -0
- package/tools/chat/get-native-chat-integration.js.map +1 -0
- package/tools/chat/get-web-chat-component-detail.js +36 -0
- package/tools/chat/get-web-chat-component-detail.js.map +1 -0
- package/tools/chat/get-web-chat-integration-guide.js +35 -0
- package/tools/chat/get-web-chat-integration-guide.js.map +1 -0
- package/tools/chat/get-web-chat-integration.js +37 -0
- package/tools/chat/get-web-chat-integration.js.map +1 -0
- package/tools/chat/get-web-chat-uikit-login.js +30 -0
- package/tools/chat/get-web-chat-uikit-login.js.map +1 -0
- package/tools/common/get-usersig.js +35 -0
- package/tools/common/get-usersig.js.map +1 -0
- package/tools/common/present-framework-choice.js +23 -0
- package/tools/common/present-framework-choice.js.map +1 -0
- package/tools/common/record-prompt.js +31 -0
- package/tools/common/record-prompt.js.map +1 -0
- package/tools/common/record-result.js +36 -0
- package/tools/common/record-result.js.map +1 -0
- package/tools/index.js +41 -0
- package/tools/index.js.map +1 -0
- package/tools/rtcengine/get-rtcengine-integration-guide.js +33 -0
- package/tools/rtcengine/get-rtcengine-integration-guide.js.map +1 -0
- package/tools/rtcengine/get-rtcenigne-faq.js +32 -0
- package/tools/rtcengine/get-rtcenigne-faq.js.map +1 -0
- package/utils/aegis-client.js +8 -0
- package/utils/aegis-client.js.map +1 -0
- package/utils/generate-usersig.js +14 -0
- package/utils/generate-usersig.js.map +1 -0
- package/utils/get-doc-content.js +47 -0
- package/utils/get-doc-content.js.map +1 -0
- package/utils/handle-component-name.js +12 -0
- package/utils/handle-component-name.js.map +1 -0
- package/utils/handle-framework.js +9 -0
- package/utils/handle-framework.js.map +1 -0
|
@@ -0,0 +1,950 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
|
|
3
|
+
MessageInput is a fully functional message input component with core chat input features including text editing, emoji selection, file attachment, and a send button. It supports various custom options such as input behavior configuration, toolbar customization, component replacement, and slot expansion, meeting the demands of different chat scenarios with personalized requirements.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## Props Configuration
|
|
7
|
+
<table>
|
|
8
|
+
<tr>
|
|
9
|
+
<td rowspan="1" colSpan="1" >Field</td>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
<td rowspan="1" colSpan="1" >Type</td>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<td rowspan="1" colSpan="1" >Default Value</td>
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
<td rowspan="1" colSpan="1" >Description</td>
|
|
19
|
+
</tr>
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
<tr>
|
|
23
|
+
<td rowspan="1" colSpan="1" >[autoFocus](https://write.woa.com/document/181344257863962624)</td>
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
<td rowspan="1" colSpan="1" >boolean</td>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
<td rowspan="1" colSpan="1" >true</td>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<td rowspan="1" colSpan="1" >Auto-focus to input box</td>
|
|
33
|
+
</tr>
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
<tr>
|
|
37
|
+
<td rowspan="1" colSpan="1" >[disabled](https://write.woa.com/document/181344257863962624)</td>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<td rowspan="1" colSpan="1" >boolean</td>
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
<td rowspan="1" colSpan="1" >false</td>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<td rowspan="1" colSpan="1" >Disable input component</td>
|
|
47
|
+
</tr>
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
<tr>
|
|
51
|
+
<td rowspan="1" colSpan="1" >[hideSendButton](https://write.woa.com/document/181344257863962624)</td>
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
<td rowspan="1" colSpan="1" >boolean</td>
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
<td rowspan="1" colSpan="1" >false</td>
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
<td rowspan="1" colSpan="1" >Whether to hide send button</td>
|
|
61
|
+
</tr>
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
<tr>
|
|
65
|
+
<td rowspan="1" colSpan="1" >[placeholder](https://write.woa.com/document/181344257863962624)</td>
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
<td rowspan="1" colSpan="1" >string</td>
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
<td rowspan="1" colSpan="1" >''</td>
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
<td rowspan="1" colSpan="1" >Input box placeholder text</td>
|
|
75
|
+
</tr>
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
<tr>
|
|
79
|
+
<td rowspan="1" colSpan="1" >[className](https://write.woa.com/document/181344257863962624)</td>
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
<td rowspan="1" colSpan="1" >string</td>
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
<td rowspan="1" colSpan="1" >Root container custom CSS class</td>
|
|
89
|
+
</tr>
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
<tr>
|
|
93
|
+
<td rowspan="1" colSpan="1" >[style](https://write.woa.com/document/181344257863962624)</td>
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
<td rowspan="1" colSpan="1" >React.CSSProperties</td>
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
<td rowspan="1" colSpan="1" >Root container inline style</td>
|
|
103
|
+
</tr>
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
<tr>
|
|
107
|
+
<td rowspan="1" colSpan="1" >[attachmentPickerMode](https://write.woa.com/document/181344257863962624)</td>
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
<td rowspan="1" colSpan="1" >'collapsed' \| 'expanded'</td>
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
<td rowspan="1" colSpan="1" >'collapsed'</td>
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
<td rowspan="1" colSpan="1" >Attachment selector display mode</td>
|
|
117
|
+
</tr>
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
<tr>
|
|
121
|
+
<td rowspan="1" colSpan="1" >[actions](https://write.woa.com/document/181344257863962624)</td>
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
<td rowspan="1" colSpan="1" >MessageInputActions</td>
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
<td rowspan="1" colSpan="1" >['EmojiPicker', 'AttachmentPicker']</td>
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
<td rowspan="1" colSpan="1" >Toolbar button configuration</td>
|
|
131
|
+
</tr>
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
<tr>
|
|
135
|
+
<td rowspan="1" colSpan="1" >[slots](https://write.woa.com/document/181344257863962624)</td>
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
<td rowspan="1" colSpan="1" >MessageInputSlots</td>
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
<td rowspan="1" colSpan="1" >Slot configuration object</td>
|
|
145
|
+
</tr>
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
<tr>
|
|
149
|
+
<td rowspan="1" colSpan="1" >[TextEditor](https://write.woa.com/document/181344257863962624)</td>
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
<td rowspan="1" colSpan="1" >JSX.Element</td>
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
<td rowspan="1" colSpan="1" >Custom text editor component</td>
|
|
159
|
+
</tr>
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
<tr>
|
|
163
|
+
<td rowspan="1" colSpan="1" >[EmojiPicker](https://write.woa.com/document/181344257863962624)</td>
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
<td rowspan="1" colSpan="1" >JSX.Element</td>
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
<td rowspan="1" colSpan="1" >Custom emoji selector component</td>
|
|
173
|
+
</tr>
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
<tr>
|
|
177
|
+
<td rowspan="1" colSpan="1" >[AttachmentPicker](https://write.woa.com/document/181344257863962624)</td>
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
<td rowspan="1" colSpan="1" >JSX.Element</td>
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
<td rowspan="1" colSpan="1" >Custom attachment selector component</td>
|
|
187
|
+
</tr>
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
<tr>
|
|
191
|
+
<td rowspan="1" colSpan="1" >[FilePicker](https://write.woa.com/document/181344257863962624)</td>
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
<td rowspan="1" colSpan="1" >JSX.Element</td>
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
<td rowspan="1" colSpan="1" >Custom file selector component</td>
|
|
201
|
+
</tr>
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
<tr>
|
|
205
|
+
<td rowspan="1" colSpan="1" >[ImagePicker](https://write.woa.com/document/181344257863962624)</td>
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
<td rowspan="1" colSpan="1" >JSX.Element</td>
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
<td rowspan="1" colSpan="1" >Custom image selector component</td>
|
|
215
|
+
</tr>
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
<tr>
|
|
219
|
+
<td rowspan="1" colSpan="1" >[VideoPicker](https://write.woa.com/document/181344257863962624)</td>
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
<td rowspan="1" colSpan="1" >JSX.Element</td>
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
<td rowspan="1" colSpan="1" >undefined</td>
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
<td rowspan="1" colSpan="1" >Custom video selector component</td>
|
|
229
|
+
</tr>
|
|
230
|
+
</table>
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
Custom Function Explanation
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
### autoFocus
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
Parameter type: `boolean`
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
autoFocus is used to set whether to auto-focus into the input box when mounting, default value is `true`.
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
### disabled
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
Parameter type: `boolean`
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
disabled is used to set whether to disable the entire input component, including text input and all operation buttons, default value is `false`.
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
### hideSendButton
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
Parameter type: `boolean`
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
hideSendButton is used to set whether to hide the send button, suitable for scenarios where custom trigger modes are needed, default value is `false`.
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
### placeholder
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
Parameter type: `string`
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
placeholder is used to set the placeholder text for the input box, default value is an empty string.
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
### className
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
Parameter type: `string`
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
className is used to set the root container's custom CSS class name, default value is `undefined`.
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
### style
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
Parameter type: `React.CSSProperties`
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
style is used to set the root container's custom inline style, default value is `undefined`.
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
### attachmentPickerMode
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
Parameter type: `'collapsed' | 'expanded'`
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
attachmentPickerMode is used to set the display mode of the attachment selector, default value is `'collapsed'`.
|
|
299
|
+
- `collapsed`: Collapse mode, unfold options after clicking
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
- `expanded`: Expand mode, display all options directly
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
**Note:**
|
|
307
|
+
>
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
By default, AttachmentPicker refers to the attachment selector, including file selection, image selection, and video selection.
|
|
311
|
+
>
|
|
312
|
+
When the attachmentPickerModel is "collapsed", clicking the attachment selector pops up a menu displaying file selection, image selection, and video selection.
|
|
313
|
+
2. When the attachmentPickerModel is "expanded", the attachment selector will expand by default, showing file selection, image selection, and video selection in tile display.
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
### actions
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
Parameter type: `MessageInputActions`
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
actions for configuration toolbar display buttons, default value `['EmojiPicker', 'AttachmentPicker']`.
|
|
325
|
+
``` ts
|
|
326
|
+
type BuiltInAction =
|
|
327
|
+
| 'EmojiPicker'
|
|
328
|
+
| 'ImagePicker'
|
|
329
|
+
| 'FilePicker'
|
|
330
|
+
| 'VideoPicker'
|
|
331
|
+
| 'AttachmentPicker';
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
type CustomAction = {
|
|
335
|
+
key: string;
|
|
336
|
+
label?: string | undefined;
|
|
337
|
+
component?: React.ComponentType<any> | undefined;
|
|
338
|
+
className?: string | undefined;
|
|
339
|
+
style?: React.CSSProperties | undefined;
|
|
340
|
+
iconSize?: number | undefined;
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
type MessageInputActions = Array<BuiltInAction | CustomAction>;
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
#### Example 1: Custom toolbar button sequence
|
|
349
|
+
``` tsx
|
|
350
|
+
import { Chat, MessageInput } from '@tencentcloud/chat-uikit-react';
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
function ChatWithCustomActions() {
|
|
354
|
+
Custom button sequence: file, image, video, emoji
|
|
355
|
+
const customActions = ['FilePicker', 'ImagePicker', 'VideoPicker', 'EmojiPicker'];
|
|
356
|
+
|
|
357
|
+
return (
|
|
358
|
+
<Chat>
|
|
359
|
+
<MessageInput actions={customActions} />
|
|
360
|
+
</Chat>
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
#### Example 2: Add custom action button - Quick reply for customer service system
|
|
367
|
+
``` tsx
|
|
368
|
+
import { Chat, MessageInput } from '@tencentcloud/chat-uikit-react';
|
|
369
|
+
import { useMessageInputState } from '@/states';
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
Quick reply component
|
|
373
|
+
function QuickReplyPicker() {
|
|
374
|
+
const { setContent } = useMessageInputState();
|
|
375
|
+
|
|
376
|
+
const quickReplies = [
|
|
377
|
+
Hello, glad to serve you.
|
|
378
|
+
Please wait, I'll check for you...
|
|
379
|
+
Thank you for your consultation. Any other issues?
|
|
380
|
+
The issue has been resolved. Have a pleasant life!
|
|
381
|
+
];
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
const handleQuickReply = (text: string) => {
|
|
385
|
+
setContent(text);
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
return (
|
|
390
|
+
<div style={{ position: 'relative' }}>
|
|
391
|
+
<button title="quick reply">⚡</button>
|
|
392
|
+
<div style={{
|
|
393
|
+
position: 'absolute',
|
|
394
|
+
bottom: '100%',
|
|
395
|
+
left: 0,
|
|
396
|
+
background: 'white',
|
|
397
|
+
border: '1px solid #ccc',
|
|
398
|
+
borderRadius: '4px',
|
|
399
|
+
padding: '8px',
|
|
400
|
+
minWidth: '200px'
|
|
401
|
+
}}>
|
|
402
|
+
{quickReplies.map((reply, index) => (
|
|
403
|
+
<div
|
|
404
|
+
key={index}
|
|
405
|
+
onClick={() => handleQuickReply(reply)}
|
|
406
|
+
style={{
|
|
407
|
+
padding: '4px 8px',
|
|
408
|
+
cursor: 'pointer',
|
|
409
|
+
borderRadius: '2px'
|
|
410
|
+
}}
|
|
411
|
+
>
|
|
412
|
+
{reply}
|
|
413
|
+
</div>
|
|
414
|
+
))}
|
|
415
|
+
</div>
|
|
416
|
+
</div>
|
|
417
|
+
);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
function CustomerServiceChat() {
|
|
422
|
+
const actions = [
|
|
423
|
+
{
|
|
424
|
+
key: 'quickReply',
|
|
425
|
+
quick reply
|
|
426
|
+
component: QuickReplyPicker
|
|
427
|
+
},
|
|
428
|
+
'EmojiPicker',
|
|
429
|
+
'FilePicker'
|
|
430
|
+
];
|
|
431
|
+
|
|
432
|
+
return (
|
|
433
|
+
<Chat>
|
|
434
|
+
<MessageInput actions={actions} />
|
|
435
|
+
</Chat>
|
|
436
|
+
);
|
|
437
|
+
}
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
|
|
441
|
+
### slots
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
Parameter type: `MessageInputSlots`
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
slots for inserting custom content in specific locations of the input component, default value is `undefined`.
|
|
448
|
+
``` ts
|
|
449
|
+
interface MessageInputSlots {
|
|
450
|
+
headerToolbar?: () => React.ReactNode;
|
|
451
|
+
footerToolbar?: () => React.ReactNode;
|
|
452
|
+
leftInline?: () => React.ReactNode;
|
|
453
|
+
rightInline?: () => React.ReactNode;
|
|
454
|
+
inputPrefix?: () => React.ReactNode;
|
|
455
|
+
inputSuffix?: () => React.ReactNode;
|
|
456
|
+
}
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+

|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
MessageInput structure diagram
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
#### Example 1: Add message statistics display
|
|
469
|
+
``` tsx
|
|
470
|
+
import { Chat, MessageInput } from '@tencentcloud/chat-uikit-react';
|
|
471
|
+
import { useMessageInputState } from '@/states';
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
function ChatWithMessageStats() {
|
|
475
|
+
const { inputRawValue } = useMessageInputState();
|
|
476
|
+
|
|
477
|
+
Header toolbar: Display character statistics
|
|
478
|
+
const HeaderToolbar = () => !inputRawValue
|
|
479
|
+
? null
|
|
480
|
+
: (
|
|
481
|
+
<div style={{
|
|
482
|
+
padding: '4px 12px',
|
|
483
|
+
fontSize: '12px',
|
|
484
|
+
color: '#666',
|
|
485
|
+
borderBottom: '1px solid #eee',
|
|
486
|
+
}}
|
|
487
|
+
>
|
|
488
|
+
Number of characters
|
|
489
|
+
{' '}
|
|
490
|
+
{inputRawValue?.reduce((acc, item) => acc + (item.type === 'text' ? item.content.length : 1), 0) || 0}
|
|
491
|
+
/500
|
|
492
|
+
</div>
|
|
493
|
+
);
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
// toolbar: display sending notification
|
|
497
|
+
const FooterToolbar = () => (
|
|
498
|
+
<div style={{
|
|
499
|
+
padding: '4px 12px',
|
|
500
|
+
fontSize: '12px',
|
|
501
|
+
color: '#999',
|
|
502
|
+
textAlign: 'right'
|
|
503
|
+
}}>
|
|
504
|
+
Press Ctrl+Enter to wrap text
|
|
505
|
+
</div>
|
|
506
|
+
);
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
return (
|
|
510
|
+
<Chat>
|
|
511
|
+
<MessageInput
|
|
512
|
+
slots={{
|
|
513
|
+
headerToolbar: HeaderToolbar,
|
|
514
|
+
footerToolbar: FooterToolbar
|
|
515
|
+
}}
|
|
516
|
+
/>
|
|
517
|
+
</Chat>
|
|
518
|
+
);
|
|
519
|
+
}
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
#### Example 2: Input box prefix/suffix feature
|
|
524
|
+
``` tsx
|
|
525
|
+
import { Chat, MessageInput } from '@tencentcloud/chat-uikit-react';
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
function ChatWithInputPrefixSuffix() {
|
|
529
|
+
@reminder feature in input box
|
|
530
|
+
const InputPrefix = () => (
|
|
531
|
+
<button
|
|
532
|
+
style={{
|
|
533
|
+
border: 'none',
|
|
534
|
+
background: 'transparent',
|
|
535
|
+
color: '#1890ff',
|
|
536
|
+
cursor: 'pointer'
|
|
537
|
+
}}
|
|
538
|
+
onClick={() => {
|
|
539
|
+
// Trigger @user selection
|
|
540
|
+
console.log('turn on @user selection');
|
|
541
|
+
}}
|
|
542
|
+
>
|
|
543
|
+
@
|
|
544
|
+
</button>
|
|
545
|
+
);
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
voice input in input box
|
|
549
|
+
const InputSuffix = () => (
|
|
550
|
+
<button
|
|
551
|
+
style={{
|
|
552
|
+
border: 'none',
|
|
553
|
+
background: 'transparent',
|
|
554
|
+
cursor: 'pointer'
|
|
555
|
+
}}
|
|
556
|
+
onClick={() => {
|
|
557
|
+
Start voice input
|
|
558
|
+
console.log('start voice input');
|
|
559
|
+
}}
|
|
560
|
+
>
|
|
561
|
+
🎤
|
|
562
|
+
</button>
|
|
563
|
+
);
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
return (
|
|
567
|
+
<Chat>
|
|
568
|
+
<MessageInput
|
|
569
|
+
slots={{
|
|
570
|
+
inputPrefix: InputPrefix,
|
|
571
|
+
inputSuffix: InputSuffix
|
|
572
|
+
}}
|
|
573
|
+
/>
|
|
574
|
+
</Chat>
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
#### Example 3: Full customization of left and right toolbars
|
|
581
|
+
``` tsx
|
|
582
|
+
import { Chat, MessageInput } from '@tencentcloud/chat-uikit-react';
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
function ChatWithCustomToolbars() {
|
|
586
|
+
// Left toolbar: Only retain emoji and images
|
|
587
|
+
const LeftInline = () => (
|
|
588
|
+
<div style={{ display: 'flex', gap: '8px' }}>
|
|
589
|
+
<button>😊</button>
|
|
590
|
+
<button>📷</button>
|
|
591
|
+
</div>
|
|
592
|
+
);
|
|
593
|
+
|
|
594
|
+
|
|
595
|
+
// the tool bar on the right: custom send area
|
|
596
|
+
const RightInline = () => (
|
|
597
|
+
<div style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
|
|
598
|
+
<span style={{ fontSize: '12px', color: '#666' }}>
|
|
599
|
+
Enter
|
|
600
|
+
</span>
|
|
601
|
+
<button
|
|
602
|
+
style={{
|
|
603
|
+
padding: '6px 12px',
|
|
604
|
+
background: '#1890ff',
|
|
605
|
+
color: 'white',
|
|
606
|
+
border: 'none',
|
|
607
|
+
borderRadius: '4px',
|
|
608
|
+
cursor: 'pointer'
|
|
609
|
+
}}
|
|
610
|
+
>
|
|
611
|
+
Send
|
|
612
|
+
</button>
|
|
613
|
+
</div>
|
|
614
|
+
);
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
return (
|
|
618
|
+
<Chat>
|
|
619
|
+
<MessageInput
|
|
620
|
+
slots={{
|
|
621
|
+
leftInline: LeftInline,
|
|
622
|
+
rightInline: RightInline
|
|
623
|
+
}}
|
|
624
|
+
/>
|
|
625
|
+
</Chat>
|
|
626
|
+
);
|
|
627
|
+
}
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
### TextEditor
|
|
632
|
+
|
|
633
|
+
|
|
634
|
+
Parameter type: `JSX.Element`
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
TextEditor replaces the default text editor component. Default value: `undefined`.
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
Integrate a rich text editor
|
|
641
|
+
``` tsx
|
|
642
|
+
import { Chat, MessageInput, useMessageInputState } from '@tencentcloud/chat-uikit-react';
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
// Custom rich text editor
|
|
646
|
+
function RichTextEditor() {
|
|
647
|
+
const { sendMessage } = useMessageInputState();
|
|
648
|
+
const [inputValue, setInputValue] = useState('');
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
const handleContentChange = (content: string) => {
|
|
652
|
+
setInputValue(content);
|
|
653
|
+
};
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
const handleKeyDown = (e: React.KeyboardEvent) => {
|
|
657
|
+
// Press Enter to send a message
|
|
658
|
+
if (e.key === 'Enter') {
|
|
659
|
+
// Trigger send logic
|
|
660
|
+
e.preventDefault();
|
|
661
|
+
sendMessage(inputValue);
|
|
662
|
+
Clear input
|
|
663
|
+
const editableDiv = document.querySelector('.editable-div');
|
|
664
|
+
if (editableDiv) {
|
|
665
|
+
editableDiv.textContent = '';
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
};
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
return (
|
|
672
|
+
<div style={{
|
|
673
|
+
flex: 1,
|
|
674
|
+
border: '1px solid #d9d9d9',
|
|
675
|
+
borderRadius: '6px',
|
|
676
|
+
padding: '8px 12px',
|
|
677
|
+
minHeight: '32px',
|
|
678
|
+
maxHeight: '120px',
|
|
679
|
+
overflow: 'auto',
|
|
680
|
+
}}
|
|
681
|
+
>
|
|
682
|
+
<div
|
|
683
|
+
contentEditable
|
|
684
|
+
className="editable-div"
|
|
685
|
+
style={{
|
|
686
|
+
outline: 'none',
|
|
687
|
+
minHeight: '20px',
|
|
688
|
+
lineHeight: '20px',
|
|
689
|
+
}}
|
|
690
|
+
onInput={(e) => {
|
|
691
|
+
handleContentChange(e.currentTarget.textContent || '');
|
|
692
|
+
}}
|
|
693
|
+
onKeyDown={handleKeyDown}
|
|
694
|
+
/>
|
|
695
|
+
</div>
|
|
696
|
+
);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
function ChatWithRichTextEditor() {
|
|
701
|
+
return (
|
|
702
|
+
<Chat>
|
|
703
|
+
<MessageInput TextEditor={<RichTextEditor />} />
|
|
704
|
+
</Chat>
|
|
705
|
+
);
|
|
706
|
+
}
|
|
707
|
+
```
|
|
708
|
+
|
|
709
|
+
|
|
710
|
+
### EmojiPicker
|
|
711
|
+
|
|
712
|
+
|
|
713
|
+
Parameter type: `JSX.Element`
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
EmojiPicker replaces the default emoji selector component with a default value of `undefined`.
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
#### Example: Custom emoji panel
|
|
720
|
+
``` tsx
|
|
721
|
+
import { Chat, MessageInput } from '@tencentcloud/chat-uikit-react';
|
|
722
|
+
import { useMessageInputState } from '@/states';
|
|
723
|
+
|
|
724
|
+
|
|
725
|
+
Custom emoji selector
|
|
726
|
+
function CustomEmojiPicker() {
|
|
727
|
+
const { insertContent } = useMessageInputState();
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
const emojiCategories = {
|
|
731
|
+
Common: ['😀', '😂', '🥰', '😍', '🤔', '😭', '😡', '👍']
|
|
732
|
+
Gestures: ['👋', '🤝', '👏', '🙏', '✌️', '🤞', '🤟', '👌']
|
|
733
|
+
Animals: ['🐶', '🐱', '🐭', '🐹', '🐰', '🦊', '🐻', '🐼']
|
|
734
|
+
};
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
const [activeCategory, setActiveCategory] = useState('Common');
|
|
738
|
+
const [showPicker, setShowPicker] = useState(false);
|
|
739
|
+
|
|
740
|
+
|
|
741
|
+
const insertEmoji = (emoji: string) => {
|
|
742
|
+
insertContent(emoji);
|
|
743
|
+
setShowPicker(false);
|
|
744
|
+
};
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
return (
|
|
748
|
+
<div style={{ position: 'relative' }}>
|
|
749
|
+
<button
|
|
750
|
+
onClick={() => setShowPicker(!showPicker)}
|
|
751
|
+
style={{ border: 'none', background: 'transparent', cursor: 'pointer' }}
|
|
752
|
+
>
|
|
753
|
+
😊
|
|
754
|
+
</button>
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
{showPicker && (
|
|
758
|
+
<div style={{
|
|
759
|
+
position: 'absolute',
|
|
760
|
+
bottom: '100%',
|
|
761
|
+
left: 0,
|
|
762
|
+
background: 'white',
|
|
763
|
+
border: '1px solid #ccc',
|
|
764
|
+
borderRadius: '8px',
|
|
765
|
+
padding: '12px',
|
|
766
|
+
width: '280px',
|
|
767
|
+
boxShadow: '0 4px 12px rgba(0,0,0,0.1)',
|
|
768
|
+
}}
|
|
769
|
+
>
|
|
770
|
+
category tag
|
|
771
|
+
<div style={{ display: 'flex', marginBottom: '8px' }}>
|
|
772
|
+
{Object.keys(emojiCategories).map(category => (
|
|
773
|
+
<button
|
|
774
|
+
key={category}
|
|
775
|
+
onClick={() => setActiveCategory(category)}
|
|
776
|
+
style={{
|
|
777
|
+
padding: '4px 8px',
|
|
778
|
+
border: 'none',
|
|
779
|
+
background: activeCategory === category ? '#1890ff' : 'transparent',
|
|
780
|
+
color: activeCategory === category ? 'white' : '#666',
|
|
781
|
+
borderRadius: '4px',
|
|
782
|
+
cursor: 'pointer',
|
|
783
|
+
fontSize: '12px',
|
|
784
|
+
}}
|
|
785
|
+
>
|
|
786
|
+
{category}
|
|
787
|
+
</button>
|
|
788
|
+
))}
|
|
789
|
+
</div>
|
|
790
|
+
|
|
791
|
+
|
|
792
|
+
{/* Emoji grid */}
|
|
793
|
+
<div style={{
|
|
794
|
+
display: 'grid',
|
|
795
|
+
gridTemplateColumns: 'repeat(8, 1fr)',
|
|
796
|
+
gap: '4px',
|
|
797
|
+
}}
|
|
798
|
+
>
|
|
799
|
+
{emojiCategories[activeCategory].map(emoji => (
|
|
800
|
+
<button
|
|
801
|
+
key={emoji}
|
|
802
|
+
onClick={() => insertEmoji(emoji)}
|
|
803
|
+
style={{
|
|
804
|
+
border: 'none',
|
|
805
|
+
background: 'transparent',
|
|
806
|
+
fontSize: '20px',
|
|
807
|
+
cursor: 'pointer',
|
|
808
|
+
padding: '4px',
|
|
809
|
+
borderRadius: '4px',
|
|
810
|
+
}}
|
|
811
|
+
>
|
|
812
|
+
{emoji}
|
|
813
|
+
</button>
|
|
814
|
+
))}
|
|
815
|
+
</div>
|
|
816
|
+
</div>
|
|
817
|
+
)}
|
|
818
|
+
</div>
|
|
819
|
+
);
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
function ChatWithCustomEmoji() {
|
|
824
|
+
return (
|
|
825
|
+
<Chat>
|
|
826
|
+
<MessageInput EmojiPicker={<CustomEmojiPicker />} />
|
|
827
|
+
</Chat>
|
|
828
|
+
);
|
|
829
|
+
}
|
|
830
|
+
```
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
### AttachmentPicker
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
Parameter type: `JSX.Element`
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
AttachmentPicker is used to replace the default attachment selector component, default value is `undefined`.
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
Storage integration attachment selector
|
|
843
|
+
``` tsx
|
|
844
|
+
import { Chat, MessageInput } from '@tencentcloud/chat-uikit-react';
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
// Cloud storage attachment selector with seamless integration
|
|
848
|
+
function CloudAttachmentPicker() {
|
|
849
|
+
const [showPicker, setShowPicker] = useState(false);
|
|
850
|
+
|
|
851
|
+
const attachmentTypes = [
|
|
852
|
+
{ key: 'local', label: 'Local file', icon: '📁' },
|
|
853
|
+
{ key: 'cloud', label: 'Cloud file', icon: '☁️' },
|
|
854
|
+
{ key: 'recent', label: 'Recent files', icon: '🕒' },
|
|
855
|
+
{ key: 'screenshot', label: 'Screenshot', icon: '📷' }
|
|
856
|
+
];
|
|
857
|
+
|
|
858
|
+
|
|
859
|
+
const handleAttachmentSelect = async (type: string) => {
|
|
860
|
+
switch (type) {
|
|
861
|
+
case 'local':
|
|
862
|
+
Open local file selection
|
|
863
|
+
const input = document.createElement('input');
|
|
864
|
+
input.type = 'file';
|
|
865
|
+
input.multiple = true;
|
|
866
|
+
input.onchange = (e) => {
|
|
867
|
+
const files = (e.target as HTMLInputElement).files;
|
|
868
|
+
console.log('selected local files:', files);
|
|
869
|
+
};
|
|
870
|
+
input.click();
|
|
871
|
+
break;
|
|
872
|
+
|
|
873
|
+
case 'cloud':
|
|
874
|
+
Open cloud-based file selection
|
|
875
|
+
console.log('Open cloud-based file selection');
|
|
876
|
+
break;
|
|
877
|
+
|
|
878
|
+
case 'recent':
|
|
879
|
+
Display recent files
|
|
880
|
+
console.log('display recent files');
|
|
881
|
+
break;
|
|
882
|
+
|
|
883
|
+
case 'screenshot':
|
|
884
|
+
Start screenshot
|
|
885
|
+
console.log('start screenshot');
|
|
886
|
+
break;
|
|
887
|
+
}
|
|
888
|
+
setShowPicker(false);
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
return (
|
|
893
|
+
<div style={{ position: 'relative' }}>
|
|
894
|
+
<button
|
|
895
|
+
onClick={() => setShowPicker(!showPicker)}
|
|
896
|
+
style={{ border: 'none', background: 'transparent', cursor: 'pointer' }}
|
|
897
|
+
>
|
|
898
|
+
📎
|
|
899
|
+
</button>
|
|
900
|
+
|
|
901
|
+
{showPicker && (
|
|
902
|
+
<div style={{
|
|
903
|
+
position: 'absolute',
|
|
904
|
+
bottom: '100%',
|
|
905
|
+
left: 0,
|
|
906
|
+
background: 'white',
|
|
907
|
+
border: '1px solid #ccc',
|
|
908
|
+
borderRadius: '8px',
|
|
909
|
+
padding: '8px',
|
|
910
|
+
minWidth: '160px',
|
|
911
|
+
boxShadow: '0 4px 12px rgba(0,0,0,0.1)'
|
|
912
|
+
}}>
|
|
913
|
+
{attachmentTypes.map(type => (
|
|
914
|
+
<div
|
|
915
|
+
key={type.key}
|
|
916
|
+
onClick={() => handleAttachmentSelect(type.key)}
|
|
917
|
+
style={{
|
|
918
|
+
display: 'flex',
|
|
919
|
+
alignItems: 'center',
|
|
920
|
+
gap: '8px',
|
|
921
|
+
padding: '8px 12px',
|
|
922
|
+
cursor: 'pointer',
|
|
923
|
+
borderRadius: '4px',
|
|
924
|
+
fontSize: '14px'
|
|
925
|
+
}}
|
|
926
|
+
>
|
|
927
|
+
<span>{type.icon}</span>
|
|
928
|
+
<span>{type.label}</span>
|
|
929
|
+
</div>
|
|
930
|
+
))}
|
|
931
|
+
</div>
|
|
932
|
+
)}
|
|
933
|
+
</div>
|
|
934
|
+
);
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
|
|
938
|
+
function ChatWithCloudAttachment() {
|
|
939
|
+
return (
|
|
940
|
+
<Chat>
|
|
941
|
+
<MessageInput AttachmentPicker={<CloudAttachmentPicker />} />
|
|
942
|
+
</Chat>
|
|
943
|
+
);
|
|
944
|
+
}
|
|
945
|
+
```
|
|
946
|
+
|
|
947
|
+
|
|
948
|
+
## Summary
|
|
949
|
+
|
|
950
|
+
The MessageInput component provides complete message input functionality and various custom options. By reasonably configuring Props and using the slot system, you can create an input interface that meets specific business requirements. It is advisable to choose appropriate customized schemes based on actual use scenes and maintain good user experience and performance.
|