@pisell/pisellos 2.3.55 → 2.3.57

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.
Files changed (28) hide show
  1. package/dist/core/index.js +0 -1
  2. package/dist/modules/BookingContext/utils/productExtend.js +5 -9
  3. package/dist/modules/BookingContext/utils/timeSlices.js +24 -3
  4. package/dist/modules/Order/index.d.ts +8 -2
  5. package/dist/modules/Order/index.js +636 -645
  6. package/dist/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
  7. package/dist/modules/Order/utils/discountProductLineIdentity.js +227 -0
  8. package/dist/modules/Rules/index.js +46 -5
  9. package/dist/solution/BaseSales/index.js +53 -34
  10. package/dist/solution/BaseSales/utils/cartPromotion.js +19 -1
  11. package/dist/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
  12. package/dist/solution/BookingByStep/index.d.ts +1 -1
  13. package/dist/solution/BookingTicket/index.js +1 -4
  14. package/lib/core/index.js +0 -1
  15. package/lib/model/strategy/adapter/promotion/index.js +0 -51
  16. package/lib/modules/BookingContext/utils/productExtend.js +4 -3
  17. package/lib/modules/BookingContext/utils/timeSlices.js +18 -3
  18. package/lib/modules/Order/index.d.ts +8 -2
  19. package/lib/modules/Order/index.js +161 -118
  20. package/lib/modules/Order/utils/discountProductLineIdentity.d.ts +45 -0
  21. package/lib/modules/Order/utils/discountProductLineIdentity.js +170 -0
  22. package/lib/modules/Rules/index.js +47 -3
  23. package/lib/solution/BaseSales/index.js +26 -6
  24. package/lib/solution/BaseSales/utils/cartPromotion.js +18 -0
  25. package/lib/solution/BaseSales/utils/transformBaseProductToOrderProduct.js +1 -1
  26. package/lib/solution/BookingByStep/index.d.ts +1 -1
  27. package/lib/solution/BookingTicket/index.js +1 -4
  28. package/package.json +1 -1
@@ -0,0 +1,170 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/modules/Order/utils/discountProductLineIdentity.ts
20
+ var discountProductLineIdentity_exports = {};
21
+ __export(discountProductLineIdentity_exports, {
22
+ DISCOUNT_SPLIT_ORIGIN_UID_KEY: () => DISCOUNT_SPLIT_ORIGIN_UID_KEY,
23
+ consolidateDiscountFreeProductLines: () => consolidateDiscountFreeProductLines,
24
+ ensureUniqueProductLineUids: () => ensureUniqueProductLineUids
25
+ });
26
+ module.exports = __toCommonJS(discountProductLineIdentity_exports);
27
+ var import_lodash_es = require("lodash-es");
28
+ var import_utils = require("../../../solution/ScanOrder/utils");
29
+ var import_orderCollectionIdentity = require("./orderCollectionIdentity");
30
+ var DISCOUNT_SPLIT_ORIGIN_UID_KEY = "discountSplitOriginUid";
31
+ function getProductLineUid(product) {
32
+ var _a;
33
+ if (!product || typeof product !== "object")
34
+ return null;
35
+ const uid = ((_a = product.metadata) == null ? void 0 : _a.unique_identification_number) ?? product.unique_identification_number;
36
+ if (uid === void 0 || uid === null || uid === "")
37
+ return null;
38
+ return String(uid);
39
+ }
40
+ function getProductSkuOptions(product) {
41
+ var _a;
42
+ return Array.isArray((_a = product.product_sku) == null ? void 0 : _a.option) ? product.product_sku.option : [];
43
+ }
44
+ function hasProductLineNote(product) {
45
+ return typeof product.note === "string" && product.note.trim().length > 0;
46
+ }
47
+ function isManualProductDiscountLine(product) {
48
+ var _a, _b;
49
+ return ((_a = product.metadata) == null ? void 0 : _a.is_manual_discount) === true || ((_b = product.metadata) == null ? void 0 : _b.is_manual_discount) === 1 || (product.discount_list || []).some((item) => (item == null ? void 0 : item.type) === "product");
50
+ }
51
+ function ensureProductsByUid(tempOrder) {
52
+ if (!tempOrder._extend || typeof tempOrder._extend !== "object") {
53
+ tempOrder._extend = { productsByUid: {} };
54
+ }
55
+ if (!tempOrder._extend.productsByUid) {
56
+ tempOrder._extend.productsByUid = {};
57
+ }
58
+ return tempOrder._extend.productsByUid;
59
+ }
60
+ function ensureUniqueProductLineUids(tempOrder) {
61
+ const usedUids = /* @__PURE__ */ new Set();
62
+ const productsByUid = ensureProductsByUid(tempOrder);
63
+ tempOrder.products = (tempOrder.products || []).map((product) => {
64
+ const sourceUid = getProductLineUid(product);
65
+ if (!sourceUid)
66
+ return product;
67
+ if (!usedUids.has(sourceUid)) {
68
+ usedUids.add(sourceUid);
69
+ return product;
70
+ }
71
+ let splitUid = (0, import_orderCollectionIdentity.createUuidV4)();
72
+ while (usedUids.has(splitUid)) {
73
+ splitUid = (0, import_orderCollectionIdentity.createUuidV4)();
74
+ }
75
+ product.metadata = {
76
+ ...product.metadata || {},
77
+ unique_identification_number: splitUid
78
+ };
79
+ const sourceRuntime = productsByUid[sourceUid] || {};
80
+ const discountSplitOriginUid = String(
81
+ sourceRuntime[DISCOUNT_SPLIT_ORIGIN_UID_KEY] || sourceUid
82
+ );
83
+ productsByUid[sourceUid] = {
84
+ ...sourceRuntime,
85
+ [DISCOUNT_SPLIT_ORIGIN_UID_KEY]: discountSplitOriginUid
86
+ };
87
+ productsByUid[splitUid] = {
88
+ ...(0, import_lodash_es.cloneDeep)(sourceRuntime),
89
+ [DISCOUNT_SPLIT_ORIGIN_UID_KEY]: discountSplitOriginUid
90
+ };
91
+ usedUids.add(splitUid);
92
+ return product;
93
+ });
94
+ }
95
+ function consolidateDiscountFreeProductLines(tempOrder) {
96
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
97
+ const consolidatedProducts = [];
98
+ const productIndexByKey = /* @__PURE__ */ new Map();
99
+ for (const product of tempOrder.products || []) {
100
+ const productBundle = Array.isArray(product.product_bundle) ? product.product_bundle : [];
101
+ const hasDiscount = (product.discount_list || []).length > 0 || productBundle.some((bundle) => ((bundle == null ? void 0 : bundle.discount_list) || []).length > 0);
102
+ const bookingUid = product.booking_uid ?? ((_a = product.metadata) == null ? void 0 : _a.booking_uid);
103
+ const bookingId = product.booking_id ?? ((_b = product.metadata) == null ? void 0 : _b.booking_id);
104
+ const orderDetailId = product.order_detail_id ?? product.orderDetailId;
105
+ const holderId = product.holder_id ?? ((_c = product.metadata) == null ? void 0 : _c.holder_id);
106
+ const hasMergeBoundary = hasDiscount || Boolean(((_d = product.metadata) == null ? void 0 : _d._giftInfo) || product._giftInfo) || Boolean((_e = product.metadata) == null ? void 0 : _e._promotion) || isManualProductDiscountLine(product) || hasProductLineNote(product) || Number(((_f = product.product_sku) == null ? void 0 : _f.open_sold_weight) || 0) === 1 || ((_g = product.metadata) == null ? void 0 : _g.is_edit_for_runtime) === true || bookingId !== void 0 && bookingId !== null && bookingId !== 0 && bookingId !== "0" || bookingUid !== void 0 && bookingUid !== null && String(bookingUid) !== "" || holderId !== void 0 && holderId !== null && String(holderId) !== "" || orderDetailId !== void 0 && orderDetailId !== null && orderDetailId !== "";
107
+ if (hasMergeBoundary) {
108
+ consolidatedProducts.push(product);
109
+ continue;
110
+ }
111
+ const productUid = getProductLineUid(product);
112
+ const discountSplitOriginUid = productUid ? (_j = (_i = (_h = tempOrder._extend) == null ? void 0 : _h.productsByUid) == null ? void 0 : _i[productUid]) == null ? void 0 : _j[DISCOUNT_SPLIT_ORIGIN_UID_KEY] : void 0;
113
+ if (!discountSplitOriginUid) {
114
+ consolidatedProducts.push(product);
115
+ continue;
116
+ }
117
+ const fingerprint = (0, import_utils.buildProductLineFingerprint)(
118
+ getProductSkuOptions(product),
119
+ productBundle
120
+ );
121
+ const priceSignature = JSON.stringify({
122
+ selling_price: String(product.selling_price ?? ""),
123
+ original_price: String(product.original_price ?? ""),
124
+ custom_price: String(product.custom_price ?? ""),
125
+ is_charge_tax: Number(product.is_charge_tax ?? 0),
126
+ gift_card: Number(product.gift_card ?? 0),
127
+ bundle_edit: Number(product.bundle_edit ?? 0),
128
+ price_schema_version: ((_k = product.metadata) == null ? void 0 : _k.price_schema_version) ?? "",
129
+ source_product_price: String(((_l = product.metadata) == null ? void 0 : _l.source_product_price) ?? ""),
130
+ main_product_selling_price: String(
131
+ ((_m = product.metadata) == null ? void 0 : _m.main_product_selling_price) ?? ""
132
+ ),
133
+ main_product_original_price: String(
134
+ ((_n = product.metadata) == null ? void 0 : _n.main_product_original_price) ?? ""
135
+ ),
136
+ bundle: productBundle.map((bundle) => ({
137
+ bundle_id: (bundle == null ? void 0 : bundle.bundle_id) ?? (bundle == null ? void 0 : bundle.id) ?? "",
138
+ product_id: (bundle == null ? void 0 : bundle.bundle_product_id) ?? (bundle == null ? void 0 : bundle._bundle_product_id) ?? (bundle == null ? void 0 : bundle.product_id) ?? "",
139
+ product_variant_id: (bundle == null ? void 0 : bundle.bundle_variant_id) ?? (bundle == null ? void 0 : bundle.variant_id) ?? (bundle == null ? void 0 : bundle.product_variant_id) ?? 0,
140
+ price: String((bundle == null ? void 0 : bundle.price) ?? ""),
141
+ original_price: String((bundle == null ? void 0 : bundle.original_price) ?? ""),
142
+ bundle_selling_price: String((bundle == null ? void 0 : bundle.bundle_selling_price) ?? "")
143
+ }))
144
+ });
145
+ const mergeKey = [
146
+ discountSplitOriginUid,
147
+ product.product_id,
148
+ product.product_variant_id ?? 0,
149
+ fingerprint,
150
+ priceSignature
151
+ ].join("#");
152
+ const matchedIndex = productIndexByKey.get(mergeKey);
153
+ if (matchedIndex === void 0) {
154
+ productIndexByKey.set(mergeKey, consolidatedProducts.length);
155
+ consolidatedProducts.push(product);
156
+ continue;
157
+ }
158
+ const matchedProduct = consolidatedProducts[matchedIndex];
159
+ matchedProduct.num = (0, import_utils.getSafeProductNum)(
160
+ Number(matchedProduct.num || 0) + Number(product.num || 0)
161
+ );
162
+ }
163
+ tempOrder.products = consolidatedProducts;
164
+ }
165
+ // Annotate the CommonJS export names for ESM import in node:
166
+ 0 && (module.exports = {
167
+ DISCOUNT_SPLIT_ORIGIN_UID_KEY,
168
+ consolidateDiscountFreeProductLines,
169
+ ensureUniqueProductLineUids
170
+ });
@@ -1045,16 +1045,60 @@ var RulesModule = class extends import_BaseModule.BaseModule {
1045
1045
  const arr = [];
1046
1046
  if (flatItem.type === "main") {
1047
1047
  if (splitCount < totalQuantity && isNeedSplit) {
1048
+ const remainingQuantity = totalQuantity - splitCount;
1049
+ const applicableNonGoodPassById = new Map(
1050
+ applicableDiscounts.filter((discount) => (discount.tag || discount.type) !== "good_pass").map((discount) => [String(discount.id), discount])
1051
+ );
1052
+ const remainderDiscountList = (product.discount_list || []).filter((discount) => {
1053
+ var _a3;
1054
+ const discountType = discount.tag || discount.type;
1055
+ if (discountType === "promotion")
1056
+ return true;
1057
+ if (discountType === "good_pass")
1058
+ return false;
1059
+ const resourceId = ((_a3 = discount.discount) == null ? void 0 : _a3.resource_id) ?? discount.id;
1060
+ return resourceId !== void 0 && resourceId !== null && applicableNonGoodPassById.has(String(resourceId));
1061
+ }).map((discount) => {
1062
+ var _a3;
1063
+ if ((discount.tag || discount.type) === "promotion")
1064
+ return discount;
1065
+ const resourceId = ((_a3 = discount.discount) == null ? void 0 : _a3.resource_id) ?? discount.id;
1066
+ const matchedDiscount = applicableNonGoodPassById.get(String(resourceId));
1067
+ if (matchedDiscount) {
1068
+ usedDiscounts.set(matchedDiscount.id, true);
1069
+ const appliedProducts = appliedDiscountProducts.get(matchedDiscount.id) || [];
1070
+ appliedProducts.push({
1071
+ ...discount,
1072
+ _num: remainingQuantity
1073
+ });
1074
+ appliedDiscountProducts.set(matchedDiscount.id, appliedProducts);
1075
+ }
1076
+ return {
1077
+ ...discount,
1078
+ // _num 是 Rules 运行态的行数量;Order 写回 tempOrder 时会裁剪该字段。
1079
+ _num: remainingQuantity
1080
+ };
1081
+ });
1082
+ const hasRetainedWalletDiscount = remainderDiscountList.some(
1083
+ (discount) => !["promotion", "good_pass"].includes(discount.tag || discount.type)
1084
+ );
1048
1085
  let total = product.origin_total ?? product.total;
1049
1086
  if ((product.discount_list || []).some((item) => item.type === "promotion")) {
1050
1087
  total = product.total ?? product.origin_total;
1051
1088
  }
1052
1089
  arr.push(
1053
1090
  this.hooks.setProduct(originProduct, {
1054
- discount_list: this.filterDiscountListByType(product.discount_list, "promotion"),
1055
- quantity: totalQuantity - splitCount,
1091
+ // 商品券只替换被拆出的 splitCount 件。余量行原本仍有效的折扣卡
1092
+ // 不能随 good_pass 拆分一起清除;已取消或已失效的折扣不会进入此列表。
1093
+ discount_list: remainderDiscountList,
1094
+ quantity: remainingQuantity,
1056
1095
  _id: product._id.split("___")[0],
1057
- total
1096
+ total,
1097
+ // 保留余量行当前的折后主价;Order.applyProductDiscountPrices 随后会基于
1098
+ // source_product_price + discount_list 再归一化,避免出现重复折扣。
1099
+ ...hasRetainedWalletDiscount ? {
1100
+ main_product_selling_price: product.main_product_selling_price ?? product.price
1101
+ } : {}
1058
1102
  })
1059
1103
  );
1060
1104
  }
@@ -73,8 +73,11 @@ function isRejectedSalesSubmitResult(result) {
73
73
  return candidates.some((candidate) => {
74
74
  if (!candidate || typeof candidate !== "object")
75
75
  return false;
76
- const responseCode = Number(candidate.code ?? candidate.statusCode);
77
- if (Number.isFinite(responseCode) && responseCode >= 400)
76
+ if (candidate.code !== void 0 && candidate.code !== 200 && candidate.code !== "200") {
77
+ return true;
78
+ }
79
+ const statusCode = Number(candidate.statusCode);
80
+ if (Number.isFinite(statusCode) && statusCode >= 400)
78
81
  return true;
79
82
  if (candidate.status === false || candidate.success === false || candidate.result === false) {
80
83
  return true;
@@ -84,9 +87,9 @@ function isRejectedSalesSubmitResult(result) {
84
87
  );
85
88
  });
86
89
  }
87
- function getSalesSubmitErrorMessage(result) {
90
+ function getSalesSubmitErrorMessage(result, fallbackMessage) {
88
91
  var _a, _b;
89
- return (result == null ? void 0 : result.message) || (result == null ? void 0 : result.msg) || ((_a = result == null ? void 0 : result.data) == null ? void 0 : _a.message) || ((_b = result == null ? void 0 : result.data) == null ? void 0 : _b.msg) || "Wallet 支付确认失败";
92
+ return (result == null ? void 0 : result.message) || (result == null ? void 0 : result.msg) || ((_a = result == null ? void 0 : result.data) == null ? void 0 : _a.message) || ((_b = result == null ? void 0 : result.data) == null ? void 0 : _b.msg) || fallbackMessage;
90
93
  }
91
94
  function toWalletFundValue(value) {
92
95
  try {
@@ -2658,7 +2661,12 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
2658
2661
  async scanWalletAsset(code) {
2659
2662
  if (!this.store.payment)
2660
2663
  throw new Error("payment 模块未初始化");
2661
- const result = await this.store.payment.wallet.scanWalletAssetAsync(code);
2664
+ const wallet = this.store.payment.wallet;
2665
+ const businessData = this.buildWalletInitBusinessData();
2666
+ if (businessData) {
2667
+ wallet.generateWalletParams(businessData);
2668
+ }
2669
+ const result = await wallet.scanWalletAssetAsync(code);
2662
2670
  if (result.type === "normalCode") {
2663
2671
  await this.syncSelectedWalletAssets(result.state);
2664
2672
  await this.publishWalletAssetsState(result.state);
@@ -2786,7 +2794,9 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
2786
2794
  confirmPendingVoucherPayments: true
2787
2795
  });
2788
2796
  if (isRejectedSalesSubmitResult(submitResult)) {
2789
- throw new Error(getSalesSubmitErrorMessage(submitResult));
2797
+ throw new Error(
2798
+ getSalesSubmitErrorMessage(submitResult, "Wallet 支付确认失败")
2799
+ );
2790
2800
  }
2791
2801
  } catch (error) {
2792
2802
  this.store.order.setOrderPayments(beforePayments);
@@ -2889,6 +2899,11 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
2889
2899
  smallTicketDataFlag: 1,
2890
2900
  confirmPendingVoucherPayments: true
2891
2901
  });
2902
+ if (isRejectedSalesSubmitResult(syncResult.submitResult)) {
2903
+ throw new Error(
2904
+ getSalesSubmitErrorMessage(syncResult.submitResult, "订单提交失败")
2905
+ );
2906
+ }
2892
2907
  if (this.store.payment) {
2893
2908
  const committed = this.getCommittedWalletAssets();
2894
2909
  const walletState = this.store.payment.wallet.setCommittedWalletAssets(
@@ -2999,6 +3014,11 @@ var BaseSalesImpl = class extends import_BaseModule.BaseModule {
2999
3014
  smallTicketDataFlag: 1,
3000
3015
  confirmPendingVoucherPayments: true
3001
3016
  });
3017
+ if (isRejectedSalesSubmitResult(syncResult.submitResult)) {
3018
+ throw new Error(
3019
+ getSalesSubmitErrorMessage(syncResult.submitResult, "订单提交失败")
3020
+ );
3021
+ }
3002
3022
  if (this.store.payment) {
3003
3023
  const committed = this.getCommittedWalletAssets();
3004
3024
  const walletState = this.store.payment.wallet.setCommittedWalletAssets(
@@ -366,11 +366,29 @@ function getProductLineNoteSignature(product) {
366
366
  const uid = getOrderProductUid(product);
367
367
  return uid ? `note:${uid}` : `note:${normalizedNote}`;
368
368
  }
369
+ function hasGoodPassDiscount(product) {
370
+ var _a, _b;
371
+ const productBundle = Array.isArray(product == null ? void 0 : product.product_bundle) ? product.product_bundle : [];
372
+ const extendedBundle = Array.isArray((_b = (_a = product == null ? void 0 : product._extend) == null ? void 0 : _a.other) == null ? void 0 : _b.bundle) ? product._extend.other.bundle : [];
373
+ const discountLists = [
374
+ product == null ? void 0 : product.discount_list,
375
+ ...productBundle.map((item) => item == null ? void 0 : item.discount_list),
376
+ ...extendedBundle.map((item) => item == null ? void 0 : item.discount_list)
377
+ ];
378
+ return discountLists.some(
379
+ (discountList) => Array.isArray(discountList) && discountList.some(
380
+ (item) => (item == null ? void 0 : item.type) === "good_pass" || (item == null ? void 0 : item.tag) === "good_pass"
381
+ )
382
+ );
383
+ }
369
384
  function getPromotionLineMergeBoundary(product) {
370
385
  var _a, _b;
371
386
  if ((product == null ? void 0 : product.product_id) === void 0 || (product == null ? void 0 : product.product_id) === null) {
372
387
  return `custom:${getOrderProductUid(product)}`;
373
388
  }
389
+ if (hasGoodPassDiscount(product)) {
390
+ return `good-pass:${getOrderProductUid(product)}`;
391
+ }
374
392
  if (Number(((_a = product == null ? void 0 : product.product_sku) == null ? void 0 : _a.open_sold_weight) || 0) === 1) {
375
393
  return `weighing:${getOrderProductUid(product)}`;
376
394
  }
@@ -217,7 +217,7 @@ function transformBaseProductToOrderProduct(params) {
217
217
  }
218
218
  const productTitle = {
219
219
  ...(sourceProduct == null ? void 0 : sourceProduct.title_i18n) || {},
220
- original: (sourceProduct == null ? void 0 : sourceProduct.title) || ""
220
+ original: (sourceProduct == null ? void 0 : sourceProduct.original_title) || (sourceProduct == null ? void 0 : sourceProduct.title) || ""
221
221
  };
222
222
  return {
223
223
  product_id: productId,
@@ -326,7 +326,7 @@ export declare class BookingByStepImpl extends BaseModule implements Module {
326
326
  date: string;
327
327
  status: string;
328
328
  week: string;
329
- weekNum: 0 | 2 | 1 | 6 | 4 | 5 | 3;
329
+ weekNum: 0 | 2 | 1 | 3 | 4 | 5 | 6;
330
330
  }[]>;
331
331
  submitTimeSlot(timeSlots: TimeSliceItem): void;
332
332
  private getScheduleDataByIds;
@@ -1576,10 +1576,7 @@ var BookingTicketImpl = class extends import_BaseSales.BaseSalesImpl {
1576
1576
  });
1577
1577
  }
1578
1578
  if (typeof this.store.order.addProductsToOrder === "function") {
1579
- return this.store.order.addProductsToOrder(orderLines, {
1580
- skipEditDiscountConfigRefresh: true,
1581
- skipDiscountRecalculation: true
1582
- });
1579
+ return this.store.order.addProductsToOrder(orderLines);
1583
1580
  }
1584
1581
  const result = [];
1585
1582
  for (const line of orderLines) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "@pisell/pisellos",
4
- "version": "2.3.55",
4
+ "version": "2.3.57",
5
5
  "description": "一个可扩展的前端模块化SDK框架,支持插件系统",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",