@pisell/private-materials 6.11.59 → 6.11.61

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.
@@ -19,7 +19,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
19
19
  function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
20
20
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
21
  import useEngineContext from "../../hooks/useEngineContext";
22
- import React, { useEffect, useState } from 'react';
22
+ import React, { useEffect, useState, useLayoutEffect } from 'react';
23
23
  import PaymentModal from "./PaymentModal";
24
24
  import { _getBookingDetail } from "../booking/editBookingModal/serve";
25
25
  import { _formatBookingDetail } from "../ticketBooking/components/ticketBooking";
@@ -60,20 +60,28 @@ var PaymentModalContent = function PaymentModalContent(_ref) {
60
60
  pisellosAllModule = _context$appHelper$ut.pisellosAllModule;
61
61
  var Toast = useToast();
62
62
  var logger = useLogger();
63
- var _ref2 = pisellosAllModule || {},
64
- BookingTicket = _ref2.BookingTicket;
63
+ useLayoutEffect(function () {
64
+ var _ref2 = pisellosAllModule || {},
65
+ BookingTicket = _ref2.BookingTicket;
66
+ var bookingTicketModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule(getBookingTicketKey('ticket'));
67
+ if (BookingTicket && !bookingTicketModule) {
68
+ pisellos === null || pisellos === void 0 || pisellos.registerModule(new BookingTicket(getBookingTicketKey('ticket')), {
69
+ initialState: {},
70
+ otherParams: {
71
+ cacheId: getBookingTicketKey('ticket'),
72
+ platform: 'shop'
73
+ }
74
+ });
75
+ }
65
76
 
66
- // 检查下现在是否有 bookingTicket OS 实例,如果没有我们这边先 new 一个
67
- var bookingTicketModule = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule(getBookingTicketKey('ticket'));
68
- if (BookingTicket && !bookingTicketModule) {
69
- pisellos === null || pisellos === void 0 || pisellos.registerModule(new BookingTicket(getBookingTicketKey('ticket')), {
70
- initialState: {},
71
- otherParams: {
72
- cacheId: getBookingTicketKey('ticket'),
73
- platform: 'shop'
74
- }
75
- });
76
- }
77
+ // 关键:调用 initPeripheralsListener 挂载 peripheralsResult
78
+ // 如果模块已存在则直接调用,否则注册后调用
79
+ setTimeout(function () {
80
+ var _module$initPeriphera;
81
+ var module = pisellos === null || pisellos === void 0 ? void 0 : pisellos.getModule(getBookingTicketKey('ticket'));
82
+ module === null || module === void 0 || (_module$initPeriphera = module.initPeripheralsListener) === null || _module$initPeriphera === void 0 || _module$initPeriphera.call(module);
83
+ }, 0);
84
+ }, []);
77
85
  var getDataFromHost = function getDataFromHost() {
78
86
  try {
79
87
  var is_price_include_tax = getData('is_price_include_tax');
@@ -56,17 +56,24 @@ var PaymentModalContent = ({ state, dispatch }) => {
56
56
  const { getData, pisellos, pisellosAllModule } = context.appHelper.utils;
57
57
  const Toast = (0, import_materials.useToast)();
58
58
  const logger = (0, import_useLogger.default)();
59
- const { BookingTicket } = pisellosAllModule || {};
60
- const bookingTicketModule = pisellos == null ? void 0 : pisellos.getModule((0, import_utils4.getBookingTicketKey)("ticket"));
61
- if (BookingTicket && !bookingTicketModule) {
62
- pisellos == null ? void 0 : pisellos.registerModule(new BookingTicket((0, import_utils4.getBookingTicketKey)("ticket")), {
63
- initialState: {},
64
- otherParams: {
65
- cacheId: (0, import_utils4.getBookingTicketKey)("ticket"),
66
- platform: "shop"
67
- }
68
- });
69
- }
59
+ (0, import_react.useLayoutEffect)(() => {
60
+ const { BookingTicket } = pisellosAllModule || {};
61
+ const bookingTicketModule = pisellos == null ? void 0 : pisellos.getModule((0, import_utils4.getBookingTicketKey)("ticket"));
62
+ if (BookingTicket && !bookingTicketModule) {
63
+ pisellos == null ? void 0 : pisellos.registerModule(new BookingTicket((0, import_utils4.getBookingTicketKey)("ticket")), {
64
+ initialState: {},
65
+ otherParams: {
66
+ cacheId: (0, import_utils4.getBookingTicketKey)("ticket"),
67
+ platform: "shop"
68
+ }
69
+ });
70
+ }
71
+ setTimeout(() => {
72
+ var _a2;
73
+ const module2 = pisellos == null ? void 0 : pisellos.getModule((0, import_utils4.getBookingTicketKey)("ticket"));
74
+ (_a2 = module2 == null ? void 0 : module2.initPeripheralsListener) == null ? void 0 : _a2.call(module2);
75
+ }, 0);
76
+ }, []);
70
77
  const getDataFromHost = () => {
71
78
  try {
72
79
  const is_price_include_tax = getData("is_price_include_tax");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/private-materials",
3
- "version": "6.11.59",
3
+ "version": "6.11.61",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./es/index.js",
6
6
  "types": "./lib/index.d.ts",