@pisell/private-materials 6.3.216 → 6.3.218

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.
@@ -5,12 +5,12 @@ import { getResourceTitle } from "../../utils.js";
5
5
  import ProgressBar from "../../../eventBooking/components/progressBar/index.js";
6
6
  import { contextUtils, useAppointmentBookingProduct, useAppointmentBookingSetting, useAppointmentBookingStep, useInterceptBrowserBack, useShopDiscount } from "../../hooks.js";
7
7
  import { useAppointmentBookingContext } from "../../context.js";
8
- import React, { useMemo, useRef } from "react";
9
- import { locales } from "@pisell/utils";
8
+ import React, { useCallback, useEffect, useMemo, useRef } from "react";
9
+ import { locales, sendWarningLog } from "@pisell/utils";
10
10
  import "./index.less";
11
11
  //#region src/components/appointmentBooking/components/Header/index.tsx
12
12
  const Header = () => {
13
- var _currentStep$step3, _currentStep$index;
13
+ var _context$appHelper, _context$appHelper$is, _utils$getData, _utils$getData2, _utils$getStore, _utils$getStore$getSt, _currentStep$step3, _currentStep$index;
14
14
  const { currentStep, appointmentBooking, setTimes, carts, currentStepParams, currentSelectedResources } = useAppointmentBookingContext();
15
15
  const shopDiscount = useShopDiscount();
16
16
  const context = useEngineContext();
@@ -19,6 +19,63 @@ const Header = () => {
19
19
  const { checkProductType } = useAppointmentBookingProduct();
20
20
  const utils = contextUtils();
21
21
  const progressBarRef = useRef(null);
22
+ const userAgent = typeof navigator === "undefined" ? "" : navigator.userAgent;
23
+ const appHelperIsIOS = Boolean((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper$is = _context$appHelper.isIOS) === null || _context$appHelper$is === void 0 ? void 0 : _context$appHelper$is.call(_context$appHelper));
24
+ const isIOS = /iPad|iPhone|iPod/.test(userAgent) || typeof navigator !== "undefined" && navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
25
+ const shopId = (_utils$getData = (_utils$getData2 = utils.getData) === null || _utils$getData2 === void 0 ? void 0 : _utils$getData2.call(utils, "shop_id")) !== null && _utils$getData !== void 0 ? _utils$getData : (_utils$getStore = utils.getStore) === null || _utils$getStore === void 0 || (_utils$getStore = _utils$getStore.call(utils)) === null || _utils$getStore === void 0 || (_utils$getStore$getSt = _utils$getStore.getState) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.call(_utils$getStore)) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.global) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.shop) === null || _utils$getStore$getSt === void 0 ? void 0 : _utils$getStore$getSt.id;
26
+ const isBackDiagnosisShop = String(shopId) === "8610";
27
+ const logBackDiagnosis = useCallback((event) => {
28
+ if (!isBackDiagnosisShop || typeof window === "undefined") return;
29
+ const diagnostics = {
30
+ event,
31
+ shopId,
32
+ href: window.location.href,
33
+ isIOS,
34
+ appHelperIsIOS,
35
+ userAgent
36
+ };
37
+ console.info("[appointment-booking][back-diagnosis]", diagnostics);
38
+ sendWarningLog({
39
+ title: "Shop8610-appointment-back-diagnosis",
40
+ content: [
41
+ {
42
+ key: "event",
43
+ value: event
44
+ },
45
+ {
46
+ key: "shopId",
47
+ value: String(shopId)
48
+ },
49
+ {
50
+ key: "href",
51
+ value: diagnostics.href
52
+ },
53
+ {
54
+ key: "isIOS",
55
+ value: String(isIOS)
56
+ },
57
+ {
58
+ key: "appHelperIsIOS",
59
+ value: String(appHelperIsIOS)
60
+ },
61
+ {
62
+ key: "userAgent",
63
+ value: userAgent
64
+ }
65
+ ]
66
+ }).catch((error) => {
67
+ console.warn("[appointment-booking][back-diagnosis] send log failed", error);
68
+ });
69
+ }, [
70
+ appHelperIsIOS,
71
+ isBackDiagnosisShop,
72
+ isIOS,
73
+ shopId,
74
+ userAgent
75
+ ]);
76
+ useEffect(() => {
77
+ logBackDiagnosis("header-mounted");
78
+ }, [logBackDiagnosis]);
22
79
  /**
23
80
  * @title: 获取资源名称
24
81
  * @description:
@@ -105,6 +162,7 @@ const Header = () => {
105
162
  * 移动端浏览器/系统返回键:逐步触发 handleBack,第一步时打开关闭确认弹窗。
106
163
  */
107
164
  const { restoreBackTrap } = useInterceptBrowserBack({
165
+ enabled: !isIOS,
108
166
  stepIndex: (_currentStep$index = currentStep === null || currentStep === void 0 ? void 0 : currentStep.index) !== null && _currentStep$index !== void 0 ? _currentStep$index : 0,
109
167
  canGoBack: () => {
110
168
  var _currentStep$index2;
@@ -113,7 +171,8 @@ const Header = () => {
113
171
  onBack: handleBack,
114
172
  onExit: () => {
115
173
  var _progressBarRef$curre;
116
- return (_progressBarRef$curre = progressBarRef.current) === null || _progressBarRef$curre === void 0 ? void 0 : _progressBarRef$curre.triggerClose();
174
+ logBackDiagnosis("back-trap-exit");
175
+ (_progressBarRef$curre = progressBarRef.current) === null || _progressBarRef$curre === void 0 || _progressBarRef$curre.triggerClose();
117
176
  }
118
177
  });
119
178
  return /* @__PURE__ */ React.createElement(ProgressBar, {
@@ -1,10 +1,10 @@
1
1
  import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js";
2
2
  import dayjs from "dayjs";
3
- import timezonePlugin from "dayjs/plugin/timezone";
4
- import utcPlugin from "dayjs/plugin/utc";
3
+ import timezone from "dayjs/plugin/timezone";
4
+ import utc from "dayjs/plugin/utc";
5
5
  //#region src/plus/saasDevice/devicePasscodes/model.ts
6
- dayjs.extend(utcPlugin);
7
- dayjs.extend(timezonePlugin);
6
+ dayjs.extend(utc);
7
+ dayjs.extend(timezone);
8
8
  const INITIAL_DEVICE_PASSCODE_STATE = {
9
9
  deviceIds: [],
10
10
  devicesById: {}
@@ -6,12 +6,12 @@ import React, { useCallback, useMemo } from "react";
6
6
  import { locales } from "@pisell/utils";
7
7
  import { Button, PisellEmpty, PisellModal, PisellStatisticList, Skeleton, Timeline, usePisellConfig } from "@pisell/materials";
8
8
  import { useRequest } from "ahooks";
9
- import timezonePlugin from "dayjs/plugin/timezone";
10
- import utcPlugin from "dayjs/plugin/utc";
9
+ import timezone from "dayjs/plugin/timezone";
10
+ import utc from "dayjs/plugin/utc";
11
11
  import "./index.less";
12
12
  //#region src/plus/walletPassGallery/components/timelineSection/index.tsx
13
- dayjs.extend(timezonePlugin);
14
- dayjs.extend(utcPlugin);
13
+ dayjs.extend(timezone);
14
+ dayjs.extend(utc);
15
15
  const stateTimeUnix = 1723255863;
16
16
  const TimelineSection = (props) => {
17
17
  const { code, tag, timezone, apiPrefix, isTerminalEnv, interaction, locale, translation, virtualCurrencyDisplay } = props;
@@ -12,7 +12,7 @@ let _pisell_utils = require("@pisell/utils");
12
12
  require("./index.less");
13
13
  //#region src/components/appointmentBooking/components/Header/index.tsx
14
14
  const Header = () => {
15
- var _currentStep$step3, _currentStep$index;
15
+ var _context$appHelper, _context$appHelper$is, _utils$getData, _utils$getData2, _utils$getStore, _utils$getStore$getSt, _currentStep$step3, _currentStep$index;
16
16
  const { currentStep, appointmentBooking, setTimes, carts, currentStepParams, currentSelectedResources } = require_context.useAppointmentBookingContext();
17
17
  const shopDiscount = require_hooks.useShopDiscount();
18
18
  const context = require_useEngineContext.default();
@@ -21,6 +21,63 @@ const Header = () => {
21
21
  const { checkProductType } = require_hooks.useAppointmentBookingProduct();
22
22
  const utils = require_hooks.contextUtils();
23
23
  const progressBarRef = (0, react.useRef)(null);
24
+ const userAgent = typeof navigator === "undefined" ? "" : navigator.userAgent;
25
+ const appHelperIsIOS = Boolean((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 || (_context$appHelper = _context$appHelper.utils) === null || _context$appHelper === void 0 || (_context$appHelper$is = _context$appHelper.isIOS) === null || _context$appHelper$is === void 0 ? void 0 : _context$appHelper$is.call(_context$appHelper));
26
+ const isIOS = /iPad|iPhone|iPod/.test(userAgent) || typeof navigator !== "undefined" && navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
27
+ const shopId = (_utils$getData = (_utils$getData2 = utils.getData) === null || _utils$getData2 === void 0 ? void 0 : _utils$getData2.call(utils, "shop_id")) !== null && _utils$getData !== void 0 ? _utils$getData : (_utils$getStore = utils.getStore) === null || _utils$getStore === void 0 || (_utils$getStore = _utils$getStore.call(utils)) === null || _utils$getStore === void 0 || (_utils$getStore$getSt = _utils$getStore.getState) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.call(_utils$getStore)) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.global) === null || _utils$getStore$getSt === void 0 || (_utils$getStore$getSt = _utils$getStore$getSt.shop) === null || _utils$getStore$getSt === void 0 ? void 0 : _utils$getStore$getSt.id;
28
+ const isBackDiagnosisShop = String(shopId) === "8610";
29
+ const logBackDiagnosis = (0, react.useCallback)((event) => {
30
+ if (!isBackDiagnosisShop || typeof window === "undefined") return;
31
+ const diagnostics = {
32
+ event,
33
+ shopId,
34
+ href: window.location.href,
35
+ isIOS,
36
+ appHelperIsIOS,
37
+ userAgent
38
+ };
39
+ console.info("[appointment-booking][back-diagnosis]", diagnostics);
40
+ (0, _pisell_utils.sendWarningLog)({
41
+ title: "Shop8610-appointment-back-diagnosis",
42
+ content: [
43
+ {
44
+ key: "event",
45
+ value: event
46
+ },
47
+ {
48
+ key: "shopId",
49
+ value: String(shopId)
50
+ },
51
+ {
52
+ key: "href",
53
+ value: diagnostics.href
54
+ },
55
+ {
56
+ key: "isIOS",
57
+ value: String(isIOS)
58
+ },
59
+ {
60
+ key: "appHelperIsIOS",
61
+ value: String(appHelperIsIOS)
62
+ },
63
+ {
64
+ key: "userAgent",
65
+ value: userAgent
66
+ }
67
+ ]
68
+ }).catch((error) => {
69
+ console.warn("[appointment-booking][back-diagnosis] send log failed", error);
70
+ });
71
+ }, [
72
+ appHelperIsIOS,
73
+ isBackDiagnosisShop,
74
+ isIOS,
75
+ shopId,
76
+ userAgent
77
+ ]);
78
+ (0, react.useEffect)(() => {
79
+ logBackDiagnosis("header-mounted");
80
+ }, [logBackDiagnosis]);
24
81
  /**
25
82
  * @title: 获取资源名称
26
83
  * @description:
@@ -107,6 +164,7 @@ const Header = () => {
107
164
  * 移动端浏览器/系统返回键:逐步触发 handleBack,第一步时打开关闭确认弹窗。
108
165
  */
109
166
  const { restoreBackTrap } = require_hooks.useInterceptBrowserBack({
167
+ enabled: !isIOS,
110
168
  stepIndex: (_currentStep$index = currentStep === null || currentStep === void 0 ? void 0 : currentStep.index) !== null && _currentStep$index !== void 0 ? _currentStep$index : 0,
111
169
  canGoBack: () => {
112
170
  var _currentStep$index2;
@@ -115,7 +173,8 @@ const Header = () => {
115
173
  onBack: handleBack,
116
174
  onExit: () => {
117
175
  var _progressBarRef$curre;
118
- return (_progressBarRef$curre = progressBarRef.current) === null || _progressBarRef$curre === void 0 ? void 0 : _progressBarRef$curre.triggerClose();
176
+ logBackDiagnosis("back-trap-exit");
177
+ (_progressBarRef$curre = progressBarRef.current) === null || _progressBarRef$curre === void 0 || _progressBarRef$curre.triggerClose();
119
178
  }
120
179
  });
121
180
  return /* @__PURE__ */ react.default.createElement(require_index.default, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.3.216",
3
+ "version": "6.3.218",
4
4
  "scripts": {
5
5
  "dev": "father dev",
6
6
  "build": "father build",