@taole/newgiftbar 0.0.1-rc.1

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 ADDED
@@ -0,0 +1,49 @@
1
+ # @taole/newgiftbar
2
+
3
+ 聊天室 / IM 礼物栏独立模块。底本对照厅内 `ddgift.js` / `pay.js`;IM 与厅内大部分一致,差异用 `isImSource()` 分流。
4
+
5
+ 不要 publish,不要删旧栏:厅内 `giftbar=0` 回 `DdGift`,IM `giftbar=0` 回 `@taole/ddgift`。
6
+
7
+ 特赦卡 type=29 在包内闭环。「使用」由礼物类型决定,不按来源关掉。
8
+
9
+ ## 开发
10
+
11
+ ```bash
12
+ npm install
13
+ npm run dev
14
+ ```
15
+
16
+ ## 打包(给宿主吃编译产物)
17
+
18
+ ```bash
19
+ npm run build:npm
20
+ ```
21
+
22
+ 产出 `npm/newgiftbar.es.js` + `npm/newgiftbar.css`。聊天室和 IM 开发期都用 `"file:../newgiftbar"` 引用,不走 registry。改栏时跑 `npm run build:npm:watch`。方案文档:[07-newgiftbar包.md](../聊天室礼物栏文档和方案/07-newgiftbar包.md)。
23
+
24
+
25
+
26
+ ## 打包发布
27
+
28
+ ```bash
29
+ npm run build:npm
30
+ npm publish . --access=public --registry=https://registry.npmjs.org/ --tag rc
31
+ ```
32
+
33
+ 发布认证、token 配置、常见报错排查见:[docs/npm-publish.md](./docs/npm-publish.md)
34
+
35
+ ## 宿主接入
36
+
37
+ ```js
38
+ import giftBar from '@taole/newgiftbar/npm/newgiftbar.es.js';
39
+ import '@taole/newgiftbar/npm/newgiftbar.css';
40
+ import { GIFT_BAR_EXTRA, payGiftAction } from '@taole/newgiftbar/npm/newgiftbar.es.js';
41
+
42
+ giftBar.init({
43
+ source: 'room',
44
+ target: rootEl,
45
+ request: (url) => hostRequest(url),
46
+ getPayContext: () => ({ cid, selfUid }),
47
+ resolveUsers: () => users,
48
+ });
49
+ ```