@yaoxiu/marketing-dsl 1.5.2 → 2.0.0
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 +120 -17
- package/dist/{chunk-FKZKLCVV.js → chunk-BSJDNS6C.js} +121 -2
- package/dist/docs/index.cjs +191 -43
- package/dist/docs/index.d.cts +1 -1
- package/dist/docs/index.d.ts +1 -1
- package/dist/docs/index.js +164 -44
- package/dist/index.cjs +167 -15
- package/dist/index.d.cts +63 -4
- package/dist/index.d.ts +63 -4
- package/dist/index.js +46 -16
- package/dist/report/index.cjs +47 -30
- package/dist/report/index.d.cts +80 -31
- package/dist/report/index.d.ts +80 -31
- package/dist/report/index.js +46 -31
- package/dist/{types-BgUaJUAu.d.cts → types-Bj0xyWnx.d.cts} +54 -2
- package/dist/{types-BgUaJUAu.d.ts → types-Bj0xyWnx.d.ts} +54 -2
- package/package.json +1 -1
|
@@ -213,7 +213,12 @@ interface RenderLayer {
|
|
|
213
213
|
interface RenderTree {
|
|
214
214
|
/** 数据没回来或加载失败时为 false,框架层什么都不画 */
|
|
215
215
|
ready: boolean;
|
|
216
|
-
/**
|
|
216
|
+
/**
|
|
217
|
+
* 当前视图栈里是否有弹窗视图。
|
|
218
|
+
*
|
|
219
|
+
* 注意不是「配置里有没有 popup 视图」——多视图配置(如公告条点击弹出弹窗)在弹出之前
|
|
220
|
+
* 这里是 `false`,根容器保持 `relative`,宿主的流式坑位才不会被脱流的根节点撑塌。
|
|
221
|
+
*/
|
|
217
222
|
hasPopup: boolean;
|
|
218
223
|
/** 根容器样式,已按 hasPopup 算好 */
|
|
219
224
|
rootStyle: CssStyle;
|
|
@@ -225,6 +230,51 @@ interface RenderTree {
|
|
|
225
230
|
}
|
|
226
231
|
type DslSource = (params: Record<string, unknown>, user: Record<string, unknown>) => unknown | Promise<unknown>;
|
|
227
232
|
type DslHandler = (params: Record<string, unknown>) => void;
|
|
233
|
+
/**
|
|
234
|
+
* 一次交互(手势 / 时机)的触发来源。
|
|
235
|
+
*
|
|
236
|
+
* - `show`:视图的 `stage.onShow` 被触发(曝光时机)
|
|
237
|
+
* - `close`:视图的 `stage.onClose` 被触发(关闭时机)
|
|
238
|
+
* - `action`:用户点了带 `action` 的节点(含关闭按钮、tab、倒计时 `onEnd`)
|
|
239
|
+
*/
|
|
240
|
+
type DslInteractionTrigger = 'show' | 'close' | 'action';
|
|
241
|
+
/**
|
|
242
|
+
* 一次交互的汇总事件(`interaction`),**专供上报**。
|
|
243
|
+
*
|
|
244
|
+
* 【为什么要有它】`track` / `navigate` 是**动作**粒度的事件,一次手势里配
|
|
245
|
+
* `sequence: [track, navigate]`(先埋点再跳转)是标准写法,按动作上报必然把点击量翻倍;
|
|
246
|
+
* 而 `track` 还能挂在 `stage.onShow` / `stage.onClose` 上,动作粒度看不出时机,
|
|
247
|
+
* 一律算成点击会把曝光和关闭也计成点击。
|
|
248
|
+
*
|
|
249
|
+
* 所以在**时机**粒度上再派发一条汇总事件:一次手势 = 一条 `interaction`,
|
|
250
|
+
* `sequence` 里有 N 个动作也只汇总成一条。原有的 `track` / `navigate` / `close` /
|
|
251
|
+
* `call` / `error` 事件语义不变、照常派发(宿主要靠它们做跳转、接自有埋点系统),
|
|
252
|
+
* `interaction` 是**新增**的,不替代任何既有事件。
|
|
253
|
+
*/
|
|
254
|
+
interface DslInteractionEvent {
|
|
255
|
+
/** 触发时机 */
|
|
256
|
+
trigger: DslInteractionTrigger;
|
|
257
|
+
/** 关闭原因,仅 `trigger='close'` 时有值 */
|
|
258
|
+
reason?: string;
|
|
259
|
+
/** 这次交互里的埋点动作;`sequence` 里有多个 `track` 时只取第一个 */
|
|
260
|
+
track?: {
|
|
261
|
+
event: string;
|
|
262
|
+
params?: Record<string, unknown>;
|
|
263
|
+
};
|
|
264
|
+
/** 这次交互里的跳转动作;有多个 `navigate` 时只取第一个 */
|
|
265
|
+
navigate?: {
|
|
266
|
+
url: string;
|
|
267
|
+
target?: string;
|
|
268
|
+
};
|
|
269
|
+
/**
|
|
270
|
+
* 这次交互里执行了关闭动作(`close` / `closeAll`)。
|
|
271
|
+
*
|
|
272
|
+
* 用来把「点关闭按钮」和「点营销内容」区分开:前者的本质是关闭,不该再算一次点击。
|
|
273
|
+
* 运营常把埋点配进关闭按钮的 `sequence: [track, close]`,不标记的话这一下会同时
|
|
274
|
+
* 产出 close 和 click 两条,点击量照样虚增。埋点名不会丢 —— 宿主把它并进 close 上报。
|
|
275
|
+
*/
|
|
276
|
+
closes?: boolean;
|
|
277
|
+
}
|
|
228
278
|
interface RuntimeEvents {
|
|
229
279
|
ready: {
|
|
230
280
|
keys: string[];
|
|
@@ -244,6 +294,8 @@ interface RuntimeEvents {
|
|
|
244
294
|
name: string;
|
|
245
295
|
params: Record<string, unknown>;
|
|
246
296
|
};
|
|
297
|
+
/** 一次交互的汇总事件,专供上报,见 {@link DslInteractionEvent} */
|
|
298
|
+
interaction: DslInteractionEvent;
|
|
247
299
|
'state-change': Record<string, unknown>;
|
|
248
300
|
'view-change': {
|
|
249
301
|
view: string;
|
|
@@ -290,4 +342,4 @@ interface RuntimeOptions {
|
|
|
290
342
|
emit?: RuntimeEmit;
|
|
291
343
|
}
|
|
292
344
|
|
|
293
|
-
export type { DslHandler as A,
|
|
345
|
+
export type { DslHandler as A, DslInteractionTrigger as B, CssStyle as C, Dsl as D, DslInteractionEvent as E, RuntimeEvents as F, RuntimeEventName as G, RuntimeEmit as H, RuntimeOptions as R, RenderTree as a, DslView as b, DslStyle as c, DslViewType as d, DslNodeType as e, DslLength as f, DslRect as g, DslActionBase as h, DslNavigateAction as i, DslCloseAction as j, DslCloseAllAction as k, DslOpenAction as l, DslSetStateAction as m, DslTrackAction as n, DslCallAction as o, DslSequenceAction as p, DslAction as q, DslNode as r, DslClosePosition as s, DslCloseButton as t, DslStage as u, DslSourceRef as v, DslDerived as w, RenderElement as x, RenderLayer as y, DslSource as z };
|