sa2kit 1.6.80 → 1.6.83

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.
@@ -999,7 +999,7 @@ var ShowMasterpieceMiniappPage = ({
999
999
  onClick: goToCart
1000
1000
  },
1001
1001
  /* @__PURE__ */ React11.createElement(Text, { className: "text-lg text-white" }, "\u{1F6D2}"),
1002
- cartCount > 0 && /* @__PURE__ */ React11.createElement(View, { className: "absolute -right-1 -top-1 flex min-h-4 min-w-4 items-center justify-center rounded-full bg-rose-500 px-1" }, /* @__PURE__ */ React11.createElement(Text, { className: "text-[10px] font-semibold text-white" }, cartCount > 99 ? "99+" : cartCount))
1002
+ cartCount > 0 && /* @__PURE__ */ React11.createElement(View, { className: "absolute -right-1 -top-1 flex min-h-4 min-w-4 items-center justify-center rounded-full bg-rose-500 px-1" }, /* @__PURE__ */ React11.createElement(Text, { className: "text-xs font-semibold text-white" }, cartCount > 99 ? "99+" : cartCount))
1003
1003
  ), miniappFloatingButtons.showHistory && /* @__PURE__ */ React11.createElement(
1004
1004
  View,
1005
1005
  {
@@ -1010,6 +1010,55 @@ var ShowMasterpieceMiniappPage = ({
1010
1010
  )));
1011
1011
  };
1012
1012
  var ShowMasterpiecePage_default = ShowMasterpieceMiniappPage;
1013
+ var CONSENT_STORAGE_KEY = "__showmasterpiece_privacy_consent_v1__";
1014
+ var SERVICE_TERMS_TEXT = "\u300A\u7528\u6237\u670D\u52A1\u534F\u8BAE\u300B\u6458\u8981\uFF1A\u672C\u670D\u52A1\u7528\u4E8E\u753B\u96C6\u6D4F\u89C8\u3001\u8D2D\u7269\u8F66\u4E0B\u5355\u4E0E\u5386\u53F2\u67E5\u8BE2\uFF1B\u63D0\u4EA4\u4FE1\u606F\u4EC5\u7528\u4E8E\u8BA2\u5355\u5904\u7406\u3001\u53D1\u8D27\u53CA\u552E\u540E\u6C9F\u901A\u3002";
1015
+ var PRIVACY_POLICY_TEXT = "\u300A\u9690\u79C1\u653F\u7B56\u300B\u6458\u8981\uFF1A\u6211\u4EEC\u4F1A\u6536\u96C6\u60A8\u4E3B\u52A8\u586B\u5199\u7684QQ\u53F7\u3001\u8054\u7CFB\u65B9\u5F0F\u4E0E\u6536\u8D27\u4FE1\u606F\uFF0C\u7528\u4E8E\u9884\u8BA2\u8054\u7CFB\u4E0E\u5C65\u7EA6\uFF1B\u4EC5\u5728\u5FC5\u8981\u671F\u9650\u5185\u4FDD\u5B58\uFF0C\u4E0D\u4F5C\u65E0\u5173\u7528\u9014\u3002";
1016
+ var hasPrivacyConsent = () => {
1017
+ try {
1018
+ return Taro2.getStorageSync(CONSENT_STORAGE_KEY) === true;
1019
+ } catch {
1020
+ return false;
1021
+ }
1022
+ };
1023
+ var markPrivacyConsent = () => {
1024
+ try {
1025
+ Taro2.setStorageSync(CONSENT_STORAGE_KEY, true);
1026
+ } catch (error) {
1027
+ console.error("[privacy-consent] persist failed", error);
1028
+ }
1029
+ };
1030
+ var showAgreementDoc = async (type) => {
1031
+ const title = type === "service" ? "\u7528\u6237\u670D\u52A1\u534F\u8BAE" : "\u9690\u79C1\u653F\u7B56";
1032
+ const content = type === "service" ? SERVICE_TERMS_TEXT : PRIVACY_POLICY_TEXT;
1033
+ await Taro2.showModal({
1034
+ title,
1035
+ content,
1036
+ showCancel: false,
1037
+ confirmText: "\u6211\u77E5\u9053\u4E86"
1038
+ });
1039
+ };
1040
+ var ensurePrivacyConsent = async () => {
1041
+ if (hasPrivacyConsent()) return true;
1042
+ try {
1043
+ const { tapIndex } = await Taro2.showActionSheet({
1044
+ itemList: ["\u67E5\u770B\u300A\u7528\u6237\u670D\u52A1\u534F\u8BAE\u300B", "\u67E5\u770B\u300A\u9690\u79C1\u653F\u7B56\u300B", "\u540C\u610F\u5E76\u7EE7\u7EED"]
1045
+ });
1046
+ if (tapIndex === 0) {
1047
+ await showAgreementDoc("service");
1048
+ return ensurePrivacyConsent();
1049
+ }
1050
+ if (tapIndex === 1) {
1051
+ await showAgreementDoc("privacy");
1052
+ return ensurePrivacyConsent();
1053
+ }
1054
+ markPrivacyConsent();
1055
+ return true;
1056
+ } catch {
1057
+ return false;
1058
+ }
1059
+ };
1060
+
1061
+ // src/showmasterpiece/ui/miniapp/pages/CartPage.tsx
1013
1062
  var CartMiniappPage = ({ apiBaseUrl = DEFAULT_BASE_URL }) => {
1014
1063
  const [cart, setCart] = useState(() => getCart());
1015
1064
  const [qqNumber, setQqNumber] = useState("");
@@ -1018,6 +1067,7 @@ var CartMiniappPage = ({ apiBaseUrl = DEFAULT_BASE_URL }) => {
1018
1067
  const [shippingInfo, setShippingInfo] = useState("");
1019
1068
  const [submitting, setSubmitting] = useState(false);
1020
1069
  const [pendingCheckout, setPendingCheckout] = useState(false);
1070
+ const [privacyConsented, setPrivacyConsented] = useState(() => hasPrivacyConsent());
1021
1071
  const [formErrors, setFormErrors] = useState({});
1022
1072
  const {
1023
1073
  configs: popupConfigs,
@@ -1037,6 +1087,7 @@ var CartMiniappPage = ({ apiBaseUrl = DEFAULT_BASE_URL }) => {
1037
1087
  }, []);
1038
1088
  useDidShow(() => {
1039
1089
  refreshCart();
1090
+ setPrivacyConsented(hasPrivacyConsent());
1040
1091
  });
1041
1092
  const handleUpdateQuantity = (collectionId, quantity) => {
1042
1093
  const next = updateCartItem(collectionId, quantity);
@@ -1113,6 +1164,12 @@ var CartMiniappPage = ({ apiBaseUrl = DEFAULT_BASE_URL }) => {
1113
1164
  }
1114
1165
  };
1115
1166
  const handleCheckout = async () => {
1167
+ const consented = await ensurePrivacyConsent();
1168
+ if (!consented) {
1169
+ Taro2.showToast({ title: "\u8BF7\u5148\u9605\u8BFB\u5E76\u540C\u610F\u534F\u8BAE", icon: "none" });
1170
+ return;
1171
+ }
1172
+ setPrivacyConsented(true);
1116
1173
  if (!validateForm()) {
1117
1174
  Taro2.showToast({ title: "\u8BF7\u5148\u4FEE\u6B63\u8868\u5355\u9519\u8BEF", icon: "none" });
1118
1175
  return;
@@ -1200,7 +1257,21 @@ var CartMiniappPage = ({ apiBaseUrl = DEFAULT_BASE_URL }) => {
1200
1257
  disabled: submitting,
1201
1258
  error: formErrors.pickupMethod
1202
1259
  }
1203
- ), /* @__PURE__ */ React11.createElement(View, { className: "mt-5 flex items-center justify-between gap-3" }, /* @__PURE__ */ React11.createElement(
1260
+ ), /* @__PURE__ */ React11.createElement(View, { className: "mt-4 rounded-xl bg-prussian-blue-50 px-3 py-3" }, /* @__PURE__ */ React11.createElement(Text, { className: "text-xs text-prussian-blue-700" }, "\u63D0\u4EA4\u524D\u8BF7\u9605\u8BFB\u5E76\u540C\u610F"), /* @__PURE__ */ React11.createElement(
1261
+ Text,
1262
+ {
1263
+ className: "ml-1 text-xs text-blue-600",
1264
+ onClick: () => showAgreementDoc("service")
1265
+ },
1266
+ "\u300A\u7528\u6237\u670D\u52A1\u534F\u8BAE\u300B"
1267
+ ), /* @__PURE__ */ React11.createElement(Text, { className: "text-xs text-prussian-blue-700" }, "\u4E0E"), /* @__PURE__ */ React11.createElement(
1268
+ Text,
1269
+ {
1270
+ className: "ml-1 text-xs text-blue-600",
1271
+ onClick: () => showAgreementDoc("privacy")
1272
+ },
1273
+ "\u300A\u9690\u79C1\u653F\u7B56\u300B"
1274
+ ), /* @__PURE__ */ React11.createElement(Text, { className: "ml-1 text-xs text-prussian-blue-700" }, privacyConsented ? "\uFF08\u5DF2\u540C\u610F\uFF09" : "\uFF08\u672A\u540C\u610F\uFF09")), /* @__PURE__ */ React11.createElement(View, { className: "mt-5 flex items-center justify-between gap-3" }, /* @__PURE__ */ React11.createElement(
1204
1275
  View,
1205
1276
  {
1206
1277
  className: "flex h-11 flex-1 items-center justify-center rounded-xl bg-prussian-blue-100",
@@ -1232,7 +1303,17 @@ var HistoryMiniappPage = ({ apiBaseUrl = DEFAULT_BASE_URL }) => {
1232
1303
  const [error, setError] = useState(null);
1233
1304
  const [records, setRecords] = useState([]);
1234
1305
  const [hasSearched, setHasSearched] = useState(false);
1306
+ const [privacyConsented, setPrivacyConsented] = useState(() => hasPrivacyConsent());
1307
+ useDidShow(() => {
1308
+ setPrivacyConsented(hasPrivacyConsent());
1309
+ });
1235
1310
  const handleSearch = async () => {
1311
+ const consented = await ensurePrivacyConsent();
1312
+ if (!consented) {
1313
+ Taro2.showToast({ title: "\u8BF7\u5148\u9605\u8BFB\u5E76\u540C\u610F\u534F\u8BAE", icon: "none" });
1314
+ return;
1315
+ }
1316
+ setPrivacyConsented(true);
1236
1317
  if (!qqNumber.trim() && !phoneNumber.trim()) {
1237
1318
  Taro2.showToast({ title: "\u8BF7\u8F93\u5165QQ\u53F7\u6216\u8054\u7CFB\u65B9\u5F0F", icon: "none" });
1238
1319
  return;
@@ -1291,7 +1372,21 @@ var HistoryMiniappPage = ({ apiBaseUrl = DEFAULT_BASE_URL }) => {
1291
1372
  onChange: setPhoneNumber,
1292
1373
  disabled: loading
1293
1374
  }
1294
- ), /* @__PURE__ */ React11.createElement(
1375
+ ), /* @__PURE__ */ React11.createElement(View, { className: "mt-4 rounded-xl bg-prussian-blue-50 px-3 py-3" }, /* @__PURE__ */ React11.createElement(Text, { className: "text-xs text-prussian-blue-700" }, "\u67E5\u8BE2\u524D\u8BF7\u9605\u8BFB\u5E76\u540C\u610F"), /* @__PURE__ */ React11.createElement(
1376
+ Text,
1377
+ {
1378
+ className: "ml-1 text-xs text-blue-600",
1379
+ onClick: () => showAgreementDoc("service")
1380
+ },
1381
+ "\u300A\u7528\u6237\u670D\u52A1\u534F\u8BAE\u300B"
1382
+ ), /* @__PURE__ */ React11.createElement(Text, { className: "text-xs text-prussian-blue-700" }, "\u4E0E"), /* @__PURE__ */ React11.createElement(
1383
+ Text,
1384
+ {
1385
+ className: "ml-1 text-xs text-blue-600",
1386
+ onClick: () => showAgreementDoc("privacy")
1387
+ },
1388
+ "\u300A\u9690\u79C1\u653F\u7B56\u300B"
1389
+ ), /* @__PURE__ */ React11.createElement(Text, { className: "ml-1 text-xs text-prussian-blue-700" }, privacyConsented ? "\uFF08\u5DF2\u540C\u610F\uFF09" : "\uFF08\u672A\u540C\u610F\uFF09")), /* @__PURE__ */ React11.createElement(
1295
1390
  View,
1296
1391
  {
1297
1392
  className: "mt-5 flex h-10 w-full items-center justify-center rounded-full",