@yorkjs/hive-biz 0.2.5 → 0.2.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yorkjs/hive-biz",
3
- "version": "0.2.5",
3
+ "version": "0.2.6",
4
4
  "description": "util function",
5
5
  "main": "dist/hive-biz.esm.js",
6
6
  "module": "dist/hive-biz.esm.js",
@@ -54,6 +54,12 @@ export declare const COUPON_EXPAND_TYPE_EXTRA = "extra";
54
54
  export declare const COUPON_EXPAND_TYPE_REASON = "reason";
55
55
  /** 没有可展开内容 */
56
56
  export declare const COUPON_EXPAND_TYPE_NONE = "none";
57
+ /** 券实例状态章:已使用。对齐 coupon.status = 3 */
58
+ export declare const COUPON_STATUS_STAMP_USED = "used";
59
+ /** 券实例状态章:已过期。对齐 coupon.status = 4 */
60
+ export declare const COUPON_STATUS_STAMP_EXPIRED = "expired";
61
+ /** 券实例状态章:已注销。对齐 coupon.status = 5 */
62
+ export declare const COUPON_STATUS_STAMP_CANCELED = "canceled";
57
63
  /** confirm 未选券时的默认提示 */
58
64
  export declare const COUPON_CONFIRM_EMPTY_MSG = "\u8BF7\u9009\u62E9\u4F18\u60E0\u5238";
59
65
  /** 实例票面:过期时间展示具体截止日期 */
@@ -1,4 +1,4 @@
1
- import { CouponExpandType, CouponExpireMode, CouponFormatItem, ICoupon, ICouponKvLine, ICouponViewItem } from './type';
1
+ import { CouponExpandType, CouponExpireMode, CouponFormatItem, CouponStatusStamp, ICoupon, ICouponKvLine, ICouponViewItem } from './type';
2
2
  /** id 统一转字符串再比,避免 number / string 回显对不上 */
3
3
  export declare function isSameCouponId(a?: string | number, b?: string | number): boolean;
4
4
  /**
@@ -62,6 +62,11 @@ export declare function hasCouponAvailableRepeat(coupon: ICoupon): boolean;
62
62
  export declare function hasCouponUseLimit(coupon: ICoupon): boolean;
63
63
  /** 把「键:值」拆回键值行;没有分隔符则整句当 value */
64
64
  export declare function parseCouponKvLine(text: string): ICouponKvLine;
65
+ /**
66
+ * 券实例状态章。已使用 / 已过期 / 已注销不展开。
67
+ * 模板下线也是 status 3,但发券不传 status,不会进这里。
68
+ */
69
+ export declare function getCouponStatusStamp(coupon: Pick<ICoupon, 'status'>): CouponStatusStamp | undefined;
65
70
  /** 展开区键值行。extra 走 extraLines 或生成规则,reason 为本单不可用原因 */
66
71
  export declare function getCouponExpandKvLines(coupon: ICoupon): ICouponKvLine[];
67
72
  /** 当前券应展示的展开类型:extra / reason / none */
@@ -1,4 +1,4 @@
1
- import { COUPON_EXPAND_TYPE_EXTRA, COUPON_EXPAND_TYPE_NONE, COUPON_EXPAND_TYPE_REASON } from './constant';
1
+ import { COUPON_EXPAND_TYPE_EXTRA, COUPON_EXPAND_TYPE_NONE, COUPON_EXPAND_TYPE_REASON, COUPON_STATUS_STAMP_CANCELED, COUPON_STATUS_STAMP_EXPIRED, COUPON_STATUS_STAMP_USED } from './constant';
2
2
  /**
3
3
  * 票面过期 / 有效期展示模式。
4
4
  * - deadline:已领券实例,展示「过期时间」+ 截止日期
@@ -15,6 +15,11 @@ export type CouponFormatItem = (item: any) => ICoupon | null | undefined;
15
15
  * extra:可用券的使用规则;reason:不可用原因;none:没有可展开内容。
16
16
  */
17
17
  export type CouponExpandType = typeof COUPON_EXPAND_TYPE_EXTRA | typeof COUPON_EXPAND_TYPE_REASON | typeof COUPON_EXPAND_TYPE_NONE;
18
+ /**
19
+ * 券实例右下角状态章。
20
+ * 只表示该盖哪张图,图片本身放各端项目里,不进 hive-biz。
21
+ */
22
+ export type CouponStatusStamp = typeof COUPON_STATUS_STAMP_USED | typeof COUPON_STATUS_STAMP_EXPIRED | typeof COUPON_STATUS_STAMP_CANCELED;
18
23
  /**
19
24
  * 选券内部标准结构。后端字段未知时由 formatItem 映射到这里,
20
25
  * UI 只消费 getView() 里的展示字段。
@@ -148,6 +153,11 @@ export interface ICouponViewItem {
148
153
  expandType: CouponExpandType;
149
154
  /** 展开区文案。reason 时为原因正文,extra 时为「键:值」 */
150
155
  expandLines: string[];
156
+ /**
157
+ * 右下角状态章。已使用 / 已过期 / 已注销才有。
158
+ * 有值时不展开,箭头不展示。
159
+ */
160
+ statusStamp?: CouponStatusStamp;
151
161
  }
152
162
  /** CouponSelector.getView() 的列表快照 */
153
163
  export interface ICouponSelectorView {