@pisell/private-materials 6.3.33 → 6.3.34
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/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +23 -8
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +23 -8
- package/es/components/index.d.ts +1 -2
- package/es/components/index.js +1 -2
- package/es/components/walletList/index.d.ts +0 -25
- package/es/components/walletList/index.js +98 -66
- package/es/components/walletList/serve.d.ts +4 -0
- package/es/components/walletList/serve.js +46 -13
- package/es/components/walletList/types/index.d.ts +12 -12
- package/es/components/walletList/types/index.js +2 -2
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/plus/productSelect/CategoryTabs/index.d.ts +2 -0
- package/es/plus/productSelect/CategoryTabs/index.js +6 -3
- package/es/plus/productSelect/components/TabsStructure/TabsStructure.less +0 -11
- package/es/plus/productSelect/utils.js +0 -1
- package/es/plus/walletEditor/WalletEditor.d.ts +5 -0
- package/es/plus/walletEditor/WalletEditor.js +316 -0
- package/es/plus/walletEditor/WalletEditor.less +129 -0
- package/es/plus/walletEditor/components/ImageUpload/index.d.ts +8 -0
- package/es/plus/walletEditor/components/ImageUpload/index.js +223 -0
- package/es/plus/walletEditor/components/JsonEditor/index.d.ts +11 -0
- package/es/plus/walletEditor/components/JsonEditor/index.js +68 -0
- package/es/plus/walletEditor/components/JsonEditor/index.less +4 -0
- package/es/plus/walletEditor/components/ValidityPeriodSelector/index.d.ts +20 -0
- package/es/plus/walletEditor/components/ValidityPeriodSelector/index.js +222 -0
- package/es/plus/walletEditor/components/ValidityPeriodSelector/index.less +4 -0
- package/es/plus/walletEditor/components/relationProduct/index.d.ts +6 -0
- package/es/plus/walletEditor/components/relationProduct/index.js +49 -0
- package/es/plus/walletEditor/components/relationProduct/index.less +15 -0
- package/es/plus/walletEditor/components/sortableWalletPassTypes/index.d.ts +37 -0
- package/es/plus/walletEditor/components/sortableWalletPassTypes/index.js +193 -0
- package/es/plus/walletEditor/components/sortableWalletPassTypes/index.less +110 -0
- package/es/plus/walletEditor/index.d.ts +3 -0
- package/es/plus/walletEditor/index.js +3 -0
- package/es/plus/walletEditor/locales.d.ts +126 -0
- package/es/plus/walletEditor/locales.js +143 -0
- package/es/plus/walletEditor/types.d.ts +52 -0
- package/es/plus/walletEditor/types.js +1 -0
- package/es/plus/walletPassGallery/components/footerButton/index.d.ts +14 -0
- package/es/plus/walletPassGallery/components/footerButton/index.js +247 -0
- package/es/plus/walletPassGallery/components/footerButton/index.less +93 -0
- package/es/plus/walletPassGallery/components/passDetail/index.d.ts +8 -0
- package/es/plus/walletPassGallery/components/passDetail/index.js +274 -0
- package/es/plus/walletPassGallery/components/passDetail/index.less +57 -0
- package/es/plus/walletPassGallery/components/passList/index.d.ts +11 -0
- package/es/plus/walletPassGallery/components/passList/index.js +115 -0
- package/es/plus/walletPassGallery/components/recharge/index.d.ts +11 -0
- package/es/plus/walletPassGallery/components/recharge/index.js +134 -0
- package/es/plus/walletPassGallery/components/recharge/index.less +16 -0
- package/es/plus/walletPassGallery/components/timelineSection/index.d.ts +8 -0
- package/es/plus/walletPassGallery/components/timelineSection/index.js +176 -0
- package/es/plus/walletPassGallery/components/timelineSection/index.less +67 -0
- package/es/plus/walletPassGallery/components/usageRule/index.d.ts +9 -0
- package/es/plus/walletPassGallery/components/usageRule/index.js +248 -0
- package/es/plus/walletPassGallery/components/usageRule/index.less +157 -0
- package/es/plus/walletPassGallery/index.d.ts +6 -0
- package/es/plus/walletPassGallery/index.js +602 -0
- package/es/plus/walletPassGallery/index.less +115 -0
- package/es/plus/walletPassGallery/locales.d.ts +270 -0
- package/es/plus/walletPassGallery/locales.js +279 -0
- package/es/plus/walletPassGallery/serve.d.ts +218 -0
- package/es/plus/walletPassGallery/serve.js +289 -0
- package/es/pro/Login2.0/Login2.js +4 -0
- package/es/pro/Login2.0/locales.js +93 -93
- package/lib/components/index.d.ts +1 -2
- package/lib/components/index.js +0 -3
- package/lib/components/walletList/index.d.ts +0 -25
- package/lib/components/walletList/index.js +90 -51
- package/lib/components/walletList/serve.d.ts +4 -0
- package/lib/components/walletList/serve.js +12 -0
- package/lib/components/walletList/types/index.d.ts +12 -12
- package/lib/index.d.ts +2 -1
- package/lib/index.js +6 -3
- package/lib/plus/productSelect/CategoryTabs/index.d.ts +2 -0
- package/lib/plus/productSelect/CategoryTabs/index.js +84 -69
- package/lib/plus/productSelect/components/TabsStructure/TabsStructure.less +0 -11
- package/lib/plus/productSelect/utils.js +0 -1
- package/lib/plus/walletEditor/WalletEditor.d.ts +5 -0
- package/lib/plus/walletEditor/WalletEditor.js +354 -0
- package/lib/plus/walletEditor/WalletEditor.less +129 -0
- package/lib/plus/walletEditor/components/ImageUpload/index.d.ts +8 -0
- package/lib/plus/walletEditor/components/ImageUpload/index.js +201 -0
- package/lib/plus/walletEditor/components/JsonEditor/index.d.ts +11 -0
- package/lib/plus/walletEditor/components/JsonEditor/index.js +89 -0
- package/lib/plus/walletEditor/components/JsonEditor/index.less +4 -0
- package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.d.ts +20 -0
- package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.js +176 -0
- package/lib/plus/walletEditor/components/ValidityPeriodSelector/index.less +4 -0
- package/lib/plus/walletEditor/components/relationProduct/index.d.ts +6 -0
- package/lib/plus/walletEditor/components/relationProduct/index.js +73 -0
- package/lib/plus/walletEditor/components/relationProduct/index.less +15 -0
- package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.d.ts +37 -0
- package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.js +211 -0
- package/lib/plus/walletEditor/components/sortableWalletPassTypes/index.less +110 -0
- package/lib/plus/walletEditor/index.d.ts +3 -0
- package/lib/plus/walletEditor/index.js +42 -0
- package/lib/plus/walletEditor/locales.d.ts +126 -0
- package/lib/plus/walletEditor/locales.js +167 -0
- package/lib/plus/walletEditor/types.d.ts +52 -0
- package/lib/plus/walletEditor/types.js +17 -0
- package/lib/plus/walletPassGallery/components/footerButton/index.d.ts +14 -0
- package/lib/plus/walletPassGallery/components/footerButton/index.js +187 -0
- package/lib/plus/walletPassGallery/components/footerButton/index.less +93 -0
- package/lib/plus/walletPassGallery/components/passDetail/index.d.ts +8 -0
- package/lib/plus/walletPassGallery/components/passDetail/index.js +287 -0
- package/lib/plus/walletPassGallery/components/passDetail/index.less +57 -0
- package/lib/plus/walletPassGallery/components/passList/index.d.ts +11 -0
- package/lib/plus/walletPassGallery/components/passList/index.js +136 -0
- package/lib/plus/walletPassGallery/components/recharge/index.d.ts +11 -0
- package/lib/plus/walletPassGallery/components/recharge/index.js +146 -0
- package/lib/plus/walletPassGallery/components/recharge/index.less +16 -0
- package/lib/plus/walletPassGallery/components/timelineSection/index.d.ts +8 -0
- package/lib/plus/walletPassGallery/components/timelineSection/index.js +212 -0
- package/lib/plus/walletPassGallery/components/timelineSection/index.less +67 -0
- package/lib/plus/walletPassGallery/components/usageRule/index.d.ts +9 -0
- package/lib/plus/walletPassGallery/components/usageRule/index.js +209 -0
- package/lib/plus/walletPassGallery/components/usageRule/index.less +157 -0
- package/lib/plus/walletPassGallery/index.d.ts +6 -0
- package/lib/plus/walletPassGallery/index.js +498 -0
- package/lib/plus/walletPassGallery/index.less +115 -0
- package/lib/plus/walletPassGallery/locales.d.ts +270 -0
- package/lib/plus/walletPassGallery/locales.js +299 -0
- package/lib/plus/walletPassGallery/serve.d.ts +218 -0
- package/lib/plus/walletPassGallery/serve.js +98 -0
- package/lib/pro/Login2.0/Login2.js +3 -0
- package/lib/pro/Login2.0/locales.js +93 -93
- package/lowcode/sortable-wallet-pass-types/meta.ts +267 -0
- package/lowcode/wallet-editor/meta.ts +57 -0
- package/lowcode/wallet-editor/snippets.ts +13 -0
- package/lowcode/wallet-pass-gallery/meta.ts +35 -0
- package/package.json +4 -4
- package/lowcode/wallet/meta.ts +0 -79
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
6
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
7
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
8
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
|
+
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; } }
|
|
10
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
import React, { useState } from 'react';
|
|
12
|
+
import { Button } from 'antd';
|
|
13
|
+
import { PisellModal, PisellToast } from '@pisell/materials';
|
|
14
|
+
//@ts-ignore
|
|
15
|
+
import { isIos, locales } from '@pisell/utils';
|
|
16
|
+
import "./index.less";
|
|
17
|
+
/**
|
|
18
|
+
* 通用底部按钮组件
|
|
19
|
+
* 根据step不同显示不同的按钮组
|
|
20
|
+
*/
|
|
21
|
+
var FooterButtons = function FooterButtons(_ref) {
|
|
22
|
+
var onRechargeClick = _ref.onRechargeClick,
|
|
23
|
+
_ref$platform = _ref.platform,
|
|
24
|
+
platform = _ref$platform === void 0 ? 'h5' : _ref$platform,
|
|
25
|
+
appleWalletUrl = _ref.appleWalletUrl,
|
|
26
|
+
googleWalletUrl = _ref.googleWalletUrl;
|
|
27
|
+
// 如果是PC端,部分页面可能不需要底部按钮
|
|
28
|
+
if (platform === 'pc') {
|
|
29
|
+
return null; // PC端不显示底部固定按钮
|
|
30
|
+
}
|
|
31
|
+
var _useState = useState(false),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
addWalletLoading = _useState2[0],
|
|
34
|
+
setAddWalletLoading = _useState2[1];
|
|
35
|
+
var _useState3 = useState(false),
|
|
36
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
37
|
+
wechatModalOpen = _useState4[0],
|
|
38
|
+
setWechatModalOpen = _useState4[1];
|
|
39
|
+
var _useState5 = useState(''),
|
|
40
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
41
|
+
copyUrl = _useState6[0],
|
|
42
|
+
setCopyUrl = _useState6[1];
|
|
43
|
+
var addWalletPass = /*#__PURE__*/function () {
|
|
44
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, type) {
|
|
45
|
+
var response, passData, blob, downloadUrl, a;
|
|
46
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
47
|
+
while (1) switch (_context.prev = _context.next) {
|
|
48
|
+
case 0:
|
|
49
|
+
if (url) {
|
|
50
|
+
_context.next = 3;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
PisellToast({
|
|
54
|
+
content: locales.getText('wallet-pass-gallery.urlEmpty') || '钱包链接为空',
|
|
55
|
+
duration: 2
|
|
56
|
+
});
|
|
57
|
+
return _context.abrupt("return", false);
|
|
58
|
+
case 3:
|
|
59
|
+
if (!isWechat()) {
|
|
60
|
+
_context.next = 7;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
setWechatModalOpen(true);
|
|
64
|
+
setCopyUrl(url);
|
|
65
|
+
return _context.abrupt("return", false);
|
|
66
|
+
case 7:
|
|
67
|
+
setAddWalletLoading(true);
|
|
68
|
+
_context.prev = 8;
|
|
69
|
+
if (!(type === 'apple')) {
|
|
70
|
+
_context.next = 27;
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
_context.next = 12;
|
|
74
|
+
return fetch(url);
|
|
75
|
+
case 12:
|
|
76
|
+
response = _context.sent;
|
|
77
|
+
if (response.ok) {
|
|
78
|
+
_context.next = 15;
|
|
79
|
+
break;
|
|
80
|
+
}
|
|
81
|
+
throw new Error("HTTP error! status: ".concat(response.status));
|
|
82
|
+
case 15:
|
|
83
|
+
_context.next = 17;
|
|
84
|
+
return response.arrayBuffer();
|
|
85
|
+
case 17:
|
|
86
|
+
passData = _context.sent;
|
|
87
|
+
blob = new Blob([passData], {
|
|
88
|
+
type: 'application/vnd.apple.pkpass'
|
|
89
|
+
});
|
|
90
|
+
downloadUrl = URL.createObjectURL(blob);
|
|
91
|
+
a = document.createElement('a');
|
|
92
|
+
a.href = downloadUrl;
|
|
93
|
+
a.download = 'pass.pkpass';
|
|
94
|
+
a.click();
|
|
95
|
+
URL.revokeObjectURL(downloadUrl); // 清理创建的URL
|
|
96
|
+
_context.next = 28;
|
|
97
|
+
break;
|
|
98
|
+
case 27:
|
|
99
|
+
window.open(url);
|
|
100
|
+
case 28:
|
|
101
|
+
_context.next = 34;
|
|
102
|
+
break;
|
|
103
|
+
case 30:
|
|
104
|
+
_context.prev = 30;
|
|
105
|
+
_context.t0 = _context["catch"](8);
|
|
106
|
+
console.error('Failed to add wallet:', _context.t0);
|
|
107
|
+
PisellToast({
|
|
108
|
+
content: locales.getText('wallet-pass-gallery.error.addFailed'),
|
|
109
|
+
duration: 3
|
|
110
|
+
});
|
|
111
|
+
case 34:
|
|
112
|
+
_context.prev = 34;
|
|
113
|
+
setAddWalletLoading(false);
|
|
114
|
+
return _context.finish(34);
|
|
115
|
+
case 37:
|
|
116
|
+
case "end":
|
|
117
|
+
return _context.stop();
|
|
118
|
+
}
|
|
119
|
+
}, _callee, null, [[8, 30, 34, 37]]);
|
|
120
|
+
}));
|
|
121
|
+
return function addWalletPass(_x, _x2) {
|
|
122
|
+
return _ref2.apply(this, arguments);
|
|
123
|
+
};
|
|
124
|
+
}();
|
|
125
|
+
var onAppleClick = /*#__PURE__*/function () {
|
|
126
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
127
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
128
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
129
|
+
case 0:
|
|
130
|
+
_context2.next = 2;
|
|
131
|
+
return addWalletPass(appleWalletUrl || '', 'apple');
|
|
132
|
+
case 2:
|
|
133
|
+
case "end":
|
|
134
|
+
return _context2.stop();
|
|
135
|
+
}
|
|
136
|
+
}, _callee2);
|
|
137
|
+
}));
|
|
138
|
+
return function onAppleClick() {
|
|
139
|
+
return _ref3.apply(this, arguments);
|
|
140
|
+
};
|
|
141
|
+
}();
|
|
142
|
+
var onGoogleClick = /*#__PURE__*/function () {
|
|
143
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
144
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
145
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
146
|
+
case 0:
|
|
147
|
+
_context3.next = 2;
|
|
148
|
+
return addWalletPass(googleWalletUrl || '', 'google');
|
|
149
|
+
case 2:
|
|
150
|
+
case "end":
|
|
151
|
+
return _context3.stop();
|
|
152
|
+
}
|
|
153
|
+
}, _callee3);
|
|
154
|
+
}));
|
|
155
|
+
return function onGoogleClick() {
|
|
156
|
+
return _ref4.apply(this, arguments);
|
|
157
|
+
};
|
|
158
|
+
}();
|
|
159
|
+
var isWechat = function isWechat() {
|
|
160
|
+
return /MicroMessenger/i.test(window.navigator.userAgent);
|
|
161
|
+
};
|
|
162
|
+
var httpCopyToClipboard = function httpCopyToClipboard(text) {
|
|
163
|
+
var textArea = document.createElement('textarea');
|
|
164
|
+
textArea.value = text;
|
|
165
|
+
textArea.style.position = 'fixed';
|
|
166
|
+
textArea.style.top = '-10000px';
|
|
167
|
+
textArea.style.left = '-10000px';
|
|
168
|
+
document.body.appendChild(textArea);
|
|
169
|
+
textArea.focus();
|
|
170
|
+
textArea.select();
|
|
171
|
+
document.execCommand('copy');
|
|
172
|
+
document.body.removeChild(textArea);
|
|
173
|
+
};
|
|
174
|
+
var copyToClipboard = function copyToClipboard(text) {
|
|
175
|
+
if (navigator.clipboard) {
|
|
176
|
+
return navigator.clipboard.writeText(text);
|
|
177
|
+
} else {
|
|
178
|
+
return httpCopyToClipboard(text);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
var onCopyClick = function onCopyClick() {
|
|
182
|
+
copyToClipboard(copyUrl);
|
|
183
|
+
PisellToast({
|
|
184
|
+
content: locales.getText('wallet-pass-gallery.copySuccess'),
|
|
185
|
+
duration: 2
|
|
186
|
+
});
|
|
187
|
+
setWechatModalOpen(false);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
// 根据不同步骤渲染不同按钮
|
|
191
|
+
var renderButtons = function renderButtons() {
|
|
192
|
+
// 创建按钮数组
|
|
193
|
+
var buttons = [];
|
|
194
|
+
// 添加到钱包按钮
|
|
195
|
+
if (appleWalletUrl || googleWalletUrl) {
|
|
196
|
+
buttons.push( /*#__PURE__*/React.createElement(Button, {
|
|
197
|
+
loading: addWalletLoading,
|
|
198
|
+
key: "add-wallet",
|
|
199
|
+
onClick: isIos() ? onAppleClick : onGoogleClick,
|
|
200
|
+
size: "large",
|
|
201
|
+
className: "pisell-wallet-pass-gallery_footer-buttons-item pisell-wallet-pass-gallery_footer-buttons-item-secondary"
|
|
202
|
+
}, isIos() ? locales.getText('wallet-pass-gallery.button.addToAppleWallet') : locales.getText('wallet-pass-gallery.button.addToGoogleWallet')));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// 充值按钮
|
|
206
|
+
if (onRechargeClick) {
|
|
207
|
+
buttons.push( /*#__PURE__*/React.createElement(Button, {
|
|
208
|
+
key: "recharge",
|
|
209
|
+
type: "primary",
|
|
210
|
+
onClick: onRechargeClick,
|
|
211
|
+
size: "large",
|
|
212
|
+
className: "pisell-wallet-pass-gallery_footer-buttons-item pisell-wallet-pass-gallery_footer-buttons-item-primary"
|
|
213
|
+
}, locales.getText('wallet-pass-gallery.recharge')));
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// 根据按钮数量设置不同的类名
|
|
217
|
+
var buttonCount = buttons.length;
|
|
218
|
+
var className = "pisell-wallet-pass-gallery_footer-buttons pisell-wallet-pass-gallery_footer-buttons-count-".concat(buttonCount);
|
|
219
|
+
return buttons.length > 0 ? /*#__PURE__*/React.createElement("div", {
|
|
220
|
+
className: className
|
|
221
|
+
}, buttons) : null;
|
|
222
|
+
};
|
|
223
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
224
|
+
className: "pisell-wallet-pass-gallery_footer"
|
|
225
|
+
}, renderButtons()), /*#__PURE__*/React.createElement(PisellModal, {
|
|
226
|
+
platform: platform,
|
|
227
|
+
mobileModalHeight: "auto",
|
|
228
|
+
headerDivider: false,
|
|
229
|
+
closable: true,
|
|
230
|
+
maskClosable: true,
|
|
231
|
+
onCancel: function onCancel() {
|
|
232
|
+
setWechatModalOpen(false);
|
|
233
|
+
},
|
|
234
|
+
open: wechatModalOpen,
|
|
235
|
+
footer: [/*#__PURE__*/React.createElement(Button, {
|
|
236
|
+
onClick: onCopyClick,
|
|
237
|
+
block: true,
|
|
238
|
+
type: "primary",
|
|
239
|
+
size: "large"
|
|
240
|
+
}, locales.getText('wallet-pass-gallery.copyButton'))]
|
|
241
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
242
|
+
className: "pisell-wallet-pass-gallery_footer-copy-title"
|
|
243
|
+
}, locales.getText('wallet-pass-gallery.copyTitle')), /*#__PURE__*/React.createElement("div", {
|
|
244
|
+
className: "pisell-wallet-pass-gallery_footer-copy-text"
|
|
245
|
+
}, locales.getText('wallet-pass-gallery.copyText'))));
|
|
246
|
+
};
|
|
247
|
+
export default FooterButtons;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
.pisell-wallet-pass-gallery_footer {
|
|
2
|
+
position: relative;
|
|
3
|
+
left: 0;
|
|
4
|
+
right: 0;
|
|
5
|
+
bottom: 0;
|
|
6
|
+
background-color: #fff;
|
|
7
|
+
padding: 24px;
|
|
8
|
+
z-index: 100;
|
|
9
|
+
border-top: 1px solid #d0d5de;
|
|
10
|
+
margin-left: -20px;
|
|
11
|
+
margin-right: -20px;
|
|
12
|
+
&-buttons {
|
|
13
|
+
display: flex;
|
|
14
|
+
gap: 12px;
|
|
15
|
+
width: 100%;
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
.pisell-wallet-pass-gallery_footer-buttons-item-secondary{
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
display: flex;
|
|
21
|
+
>span{
|
|
22
|
+
display: block;
|
|
23
|
+
// width: 100%;
|
|
24
|
+
flex:1;
|
|
25
|
+
white-space: nowrap;
|
|
26
|
+
overflow: hidden;
|
|
27
|
+
text-overflow: ellipsis;
|
|
28
|
+
text-wrap: nowrap;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
// 按钮数量样式
|
|
34
|
+
// 单个按钮占满宽度
|
|
35
|
+
&-count-1 {
|
|
36
|
+
.pisell-wallet-pass-gallery_footer-buttons-item {
|
|
37
|
+
flex: 1;
|
|
38
|
+
width: 100%;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// 两个按钮各占一半
|
|
43
|
+
&-count-2 {
|
|
44
|
+
.pisell-wallet-pass-gallery_footer-buttons-item {
|
|
45
|
+
flex: 1;
|
|
46
|
+
width: calc(50% - 6px);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// 三个按钮各占三分之一
|
|
51
|
+
&-count-3 {
|
|
52
|
+
.pisell-wallet-pass-gallery_footer-buttons-item {
|
|
53
|
+
flex: 1;
|
|
54
|
+
width: calc(33.33% - 8px);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 四个按钮各占四分之一
|
|
59
|
+
&-count-4 {
|
|
60
|
+
.pisell-wallet-pass-gallery_footer-buttons-item {
|
|
61
|
+
flex: 1;
|
|
62
|
+
width: calc(25% - 9px);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Ant Design按钮覆盖样式
|
|
67
|
+
:global(.ant-btn) {
|
|
68
|
+
height: 48px;
|
|
69
|
+
border-radius: 6px;
|
|
70
|
+
font-size: 16px;
|
|
71
|
+
font-weight: 500;
|
|
72
|
+
width: 100%;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&-item {
|
|
76
|
+
// 修饰符:主按钮
|
|
77
|
+
&-primary {
|
|
78
|
+
background-color: var(--theme-color, #7F56D9);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// 修饰符:次按钮
|
|
82
|
+
&-secondary {
|
|
83
|
+
background-color: #fff;
|
|
84
|
+
border-color: #d0d5de;
|
|
85
|
+
color: var(--Gray-700, #344054);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.pisell-wallet-pass-gallery_footer:empty {
|
|
92
|
+
display: none;
|
|
93
|
+
}
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
4
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
|
+
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; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import React, { useCallback, useMemo, useState, useRef, useEffect } from 'react';
|
|
8
|
+
import { Button, Empty, Typography } from 'antd';
|
|
9
|
+
import { useRequest } from 'ahooks';
|
|
10
|
+
import classNames from 'classnames';
|
|
11
|
+
import { locales } from '@pisell/utils';
|
|
12
|
+
import { PisellStatisticList, usePisellConfig } from '@pisell/materials';
|
|
13
|
+
import { getOffsetTopRelativeToScrollContainer } from "../../../productSelect/utils";
|
|
14
|
+
import CategoryTabs from "../../../productSelect/CategoryTabs";
|
|
15
|
+
import IntersectionObserverProvider, { IntersectionTrigger } from "../../../productSelect/components/IntersectionObserver";
|
|
16
|
+
import { getDetailApi } from "../../serve";
|
|
17
|
+
import UsageRules from "../usageRule";
|
|
18
|
+
import TimelineSection from "../timelineSection";
|
|
19
|
+
import Recharge from "../recharge";
|
|
20
|
+
import FooterButtons from "../footerButton";
|
|
21
|
+
import useEngineContext from "../../../../hooks/useEngineContext";
|
|
22
|
+
import "./index.less";
|
|
23
|
+
var Text = Typography.Text;
|
|
24
|
+
var PassDetail = function PassDetail(props) {
|
|
25
|
+
var _context$appHelper, _store$getState, _dataSource$machineco, _getDetail$data, _getDetail$data2, _dataSource$machineco2;
|
|
26
|
+
if (!props.dataSource) return null;
|
|
27
|
+
var _usePisellConfig = usePisellConfig(),
|
|
28
|
+
_usePisellConfig$symb = _usePisellConfig.symbol,
|
|
29
|
+
symbol = _usePisellConfig$symb === void 0 ? '$' : _usePisellConfig$symb;
|
|
30
|
+
var dataSource = props.dataSource,
|
|
31
|
+
_props$platform = props.platform,
|
|
32
|
+
platform = _props$platform === void 0 ? 'pc' : _props$platform;
|
|
33
|
+
var _useState = useState('detail'),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
activeKey = _useState2[0],
|
|
36
|
+
setActiveKey = _useState2[1];
|
|
37
|
+
var _useState3 = useState(false),
|
|
38
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
39
|
+
rechargeOpen = _useState4[0],
|
|
40
|
+
setRechargeOpen = _useState4[1];
|
|
41
|
+
|
|
42
|
+
// tab相关
|
|
43
|
+
var containerRef = useRef(null);
|
|
44
|
+
var isIndicatorVisibleRef = useRef(false);
|
|
45
|
+
var context = useEngineContext();
|
|
46
|
+
var _ref = ((_context$appHelper = context.appHelper) === null || _context$appHelper === void 0 ? void 0 : _context$appHelper.utils) || {
|
|
47
|
+
store: {}
|
|
48
|
+
},
|
|
49
|
+
store = _ref.store;
|
|
50
|
+
var timezone = (store === null || store === void 0 || (_store$getState = store.getState) === null || _store$getState === void 0 || (_store$getState = _store$getState.call(store)) === null || _store$getState === void 0 || (_store$getState = _store$getState.global) === null || _store$getState === void 0 || (_store$getState = _store$getState.symbol) === null || _store$getState === void 0 ? void 0 : _store$getState.shop.timezone) || 'Asia/Shanghai';
|
|
51
|
+
var _ref2 = dataSource || {},
|
|
52
|
+
_ref2$id = _ref2.id,
|
|
53
|
+
id = _ref2$id === void 0 ? '' : _ref2$id,
|
|
54
|
+
_ref2$code = _ref2.code,
|
|
55
|
+
code = _ref2$code === void 0 ? '' : _ref2$code,
|
|
56
|
+
_ref2$tag = _ref2.tag,
|
|
57
|
+
tag = _ref2$tag === void 0 ? '' : _ref2$tag,
|
|
58
|
+
_ref2$product_title = _ref2.product_title,
|
|
59
|
+
product_title = _ref2$product_title === void 0 ? '' : _ref2$product_title,
|
|
60
|
+
_ref2$encoded = _ref2.encoded,
|
|
61
|
+
encoded = _ref2$encoded === void 0 ? '' : _ref2$encoded,
|
|
62
|
+
balance = _ref2.balance,
|
|
63
|
+
_ref2$expire_date = _ref2.expire_date,
|
|
64
|
+
expire_date = _ref2$expire_date === void 0 ? '' : _ref2$expire_date,
|
|
65
|
+
_ref2$product = _ref2.product,
|
|
66
|
+
product = _ref2$product === void 0 ? {} : _ref2$product;
|
|
67
|
+
var _ref3 = product || {},
|
|
68
|
+
_ref3$description = _ref3.description,
|
|
69
|
+
description = _ref3$description === void 0 ? '' : _ref3$description,
|
|
70
|
+
_ref3$extension_data = _ref3.extension_data,
|
|
71
|
+
extension_data = _ref3$extension_data === void 0 ? [] : _ref3$extension_data,
|
|
72
|
+
_ref3$customer_order_ = _ref3.customer_order_behavior_count,
|
|
73
|
+
customer_order_behavior_count = _ref3$customer_order_ === void 0 ? 0 : _ref3$customer_order_;
|
|
74
|
+
var _getDetail = useRequest(function () {
|
|
75
|
+
return getDetailApi({
|
|
76
|
+
id: id
|
|
77
|
+
});
|
|
78
|
+
}, {
|
|
79
|
+
ready: !!id,
|
|
80
|
+
refreshDeps: [id]
|
|
81
|
+
});
|
|
82
|
+
useEffect(function () {
|
|
83
|
+
if (tag === 'product_discount_card') {
|
|
84
|
+
setActiveKey('detail');
|
|
85
|
+
}
|
|
86
|
+
if (containerRef.current) {
|
|
87
|
+
containerRef.current.scrollTop = 0;
|
|
88
|
+
}
|
|
89
|
+
}, [id, tag]);
|
|
90
|
+
var _anchorOptions = useMemo(function () {
|
|
91
|
+
// 始终包含detail选项
|
|
92
|
+
var options = [{
|
|
93
|
+
key: 'detail',
|
|
94
|
+
label: locales.getText('wallet-pass-gallery.detail')
|
|
95
|
+
}];
|
|
96
|
+
|
|
97
|
+
// 仅在tag不等于product_discount_card时添加activityLog选项
|
|
98
|
+
if (tag !== 'product_discount_card') {
|
|
99
|
+
options.push({
|
|
100
|
+
key: 'activityLog',
|
|
101
|
+
label: locales.getText('wallet-pass-gallery.activelog')
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
return options;
|
|
105
|
+
}, [dataSource === null || dataSource === void 0 ? void 0 : dataSource.tag]);
|
|
106
|
+
var debounceIndicator = useCallback(function (delay) {
|
|
107
|
+
isIndicatorVisibleRef.current = true;
|
|
108
|
+
var timeoutId = setTimeout(function () {
|
|
109
|
+
isIndicatorVisibleRef.current = false;
|
|
110
|
+
}, delay);
|
|
111
|
+
return function () {
|
|
112
|
+
return clearTimeout(timeoutId);
|
|
113
|
+
};
|
|
114
|
+
}, []);
|
|
115
|
+
var descs = useMemo(function () {
|
|
116
|
+
var data = [{
|
|
117
|
+
label: locales.getText('wallet-pass-gallery.cardName'),
|
|
118
|
+
value: product_title
|
|
119
|
+
}, {
|
|
120
|
+
label: locales.getText('wallet-pass-gallery.carNumber'),
|
|
121
|
+
value: encoded,
|
|
122
|
+
isLink: false
|
|
123
|
+
}, {
|
|
124
|
+
label: locales.getText('wallet-pass-gallery.validDate'),
|
|
125
|
+
value: expire_date ? expire_date : locales.getText('wallet-pass-gallery.expireDate')
|
|
126
|
+
}];
|
|
127
|
+
//折扣卡显示折扣字段 其他显示余额字段
|
|
128
|
+
if (tag === 'product_discount_card') {
|
|
129
|
+
var _dataSource$metadata;
|
|
130
|
+
var isFixedAmount = ((_dataSource$metadata = dataSource.metadata) === null || _dataSource$metadata === void 0 ? void 0 : _dataSource$metadata.discount_card_type) === 'fixed_amount';
|
|
131
|
+
data.splice(2, 0, {
|
|
132
|
+
label: locales.getText('wallet-pass-gallery.discount'),
|
|
133
|
+
value: balance ? isFixedAmount ? "".concat(symbol).concat(Number(balance)) : "".concat(Number(balance), "%") : ''
|
|
134
|
+
});
|
|
135
|
+
} else if (tag === 'point_card') {
|
|
136
|
+
data.splice(2, 0, {
|
|
137
|
+
label: locales.getText('wallet-pass-gallery.points'),
|
|
138
|
+
value: balance ? "".concat(Number(balance)) : ''
|
|
139
|
+
});
|
|
140
|
+
} else if (tag === 'good_pass') {
|
|
141
|
+
data.splice(2, 0, {
|
|
142
|
+
label: locales.getText('wallet-pass-gallery.goodPass'),
|
|
143
|
+
value: balance ? "".concat(Number(balance)) : ''
|
|
144
|
+
});
|
|
145
|
+
} else {
|
|
146
|
+
data.splice(2, 0, {
|
|
147
|
+
label: locales.getText('wallet-pass-gallery.balance'),
|
|
148
|
+
value: balance ? "".concat(symbol).concat(Number(balance)) : ''
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
return data;
|
|
152
|
+
}, [dataSource]);
|
|
153
|
+
|
|
154
|
+
// 项目进入视口时的回调
|
|
155
|
+
var handleItemIntersectionIn = useCallback(function (_key) {
|
|
156
|
+
if (!isIndicatorVisibleRef.current && _key) {
|
|
157
|
+
setActiveKey(_key);
|
|
158
|
+
}
|
|
159
|
+
}, []);
|
|
160
|
+
if (!dataSource) {
|
|
161
|
+
return /*#__PURE__*/React.createElement(Empty, null);
|
|
162
|
+
}
|
|
163
|
+
var _switchCategory = function _switchCategory(key) {
|
|
164
|
+
setActiveKey(key);
|
|
165
|
+
debounceIndicator(300);
|
|
166
|
+
var categoryIndex = _anchorOptions.findIndex(function (item) {
|
|
167
|
+
return item.key === key;
|
|
168
|
+
});
|
|
169
|
+
// 获取可滚动祖先元素
|
|
170
|
+
var _scrollParent = containerRef.current;
|
|
171
|
+
if (!_scrollParent) return;
|
|
172
|
+
var target = document.querySelector("[data-anchor=\"".concat(key, "\"]"));
|
|
173
|
+
if (!target) return;
|
|
174
|
+
// 获取产品选择器包装容器
|
|
175
|
+
var detailWrapper = document.querySelector(".pisell-wallet-pass-gallery_detail-content");
|
|
176
|
+
// 获取标签页包装容器
|
|
177
|
+
var tabsWrapper = document.querySelector(".pisell-wallet-pass-gallery-tabs-wrapper");
|
|
178
|
+
var tabsHeight = (tabsWrapper === null || tabsWrapper === void 0 ? void 0 : tabsWrapper.offsetHeight) || 0;
|
|
179
|
+
if (categoryIndex === 0) {
|
|
180
|
+
// 如果是第一个tab,滚动到产品选择器包装容器的位置
|
|
181
|
+
if (detailWrapper) {
|
|
182
|
+
var wrapperOffsetTop = getOffsetTopRelativeToScrollContainer(detailWrapper, _scrollParent);
|
|
183
|
+
_scrollParent.scrollTop = wrapperOffsetTop;
|
|
184
|
+
}
|
|
185
|
+
return;
|
|
186
|
+
} else {
|
|
187
|
+
// 其他tab,滚动到对应列表元素位置,需要减去标签页高度
|
|
188
|
+
var listOffsetTop = getOffsetTopRelativeToScrollContainer(target, _scrollParent);
|
|
189
|
+
_scrollParent.scrollTop = listOffsetTop - tabsHeight;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
var renderTimeLine = function renderTimeLine() {
|
|
193
|
+
if (tag === 'product_discount_card') return null;
|
|
194
|
+
return /*#__PURE__*/React.createElement(TimelineSection, {
|
|
195
|
+
code: code,
|
|
196
|
+
tag: tag,
|
|
197
|
+
timezone: timezone
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
201
|
+
className: classNames("pisell-wallet-pass-gallery_detail", "pisell-wallet-pass-gallery_detail-".concat(platform))
|
|
202
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
203
|
+
className: "pisell-wallet-pass-gallery_detail-content",
|
|
204
|
+
ref: containerRef
|
|
205
|
+
}, _anchorOptions.length > 1 && /*#__PURE__*/React.createElement(CategoryTabs, {
|
|
206
|
+
key: id,
|
|
207
|
+
className: "pisell-wallet-pass-gallery-tabs-wrapper",
|
|
208
|
+
activeKey: activeKey,
|
|
209
|
+
items: _anchorOptions,
|
|
210
|
+
onChange: _switchCategory,
|
|
211
|
+
loading: false,
|
|
212
|
+
style: {
|
|
213
|
+
padding: 0
|
|
214
|
+
}
|
|
215
|
+
}), /*#__PURE__*/React.createElement(IntersectionObserverProvider, {
|
|
216
|
+
rootMargin: "-70px 0px -270px 0px",
|
|
217
|
+
priorityMode: "top"
|
|
218
|
+
}, /*#__PURE__*/React.createElement(IntersectionTrigger, {
|
|
219
|
+
style: {
|
|
220
|
+
height: '1px'
|
|
221
|
+
},
|
|
222
|
+
onShow: function onShow() {
|
|
223
|
+
return handleItemIntersectionIn('detail');
|
|
224
|
+
}
|
|
225
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
226
|
+
"data-anchor": "detail"
|
|
227
|
+
})), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Text, {
|
|
228
|
+
className: "pisell-wallet-pass-gallery_detail-title"
|
|
229
|
+
}, locales.getText('wallet-pass-gallery.details')), platform === 'pc' && tag === 'gift_card' && (dataSource === null || dataSource === void 0 || (_dataSource$machineco = dataSource.machinecode_config) === null || _dataSource$machineco === void 0 ? void 0 : _dataSource$machineco.hide_recharge) === 0 && /*#__PURE__*/React.createElement(Button, {
|
|
230
|
+
type: "primary",
|
|
231
|
+
size: "large",
|
|
232
|
+
onClick: function onClick() {
|
|
233
|
+
return setRechargeOpen(true);
|
|
234
|
+
}
|
|
235
|
+
}, locales.getText('wallet-pass-gallery.recharge')), /*#__PURE__*/React.createElement(PisellStatisticList, {
|
|
236
|
+
data: descs,
|
|
237
|
+
labelColor: "#667085",
|
|
238
|
+
valueColor: "#101828",
|
|
239
|
+
backgroundColors: ['#fff'],
|
|
240
|
+
isHasBorder: false
|
|
241
|
+
}), description && /*#__PURE__*/React.createElement("div", {
|
|
242
|
+
className: "pisell-wallet-pass-gallery_detail-card-content-tip"
|
|
243
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
244
|
+
dangerouslySetInnerHTML: {
|
|
245
|
+
__html: description
|
|
246
|
+
}
|
|
247
|
+
})), /*#__PURE__*/React.createElement(UsageRules, {
|
|
248
|
+
dataSource: _getDetail.data
|
|
249
|
+
})), /*#__PURE__*/React.createElement(IntersectionTrigger, {
|
|
250
|
+
style: {
|
|
251
|
+
height: '1px'
|
|
252
|
+
},
|
|
253
|
+
onShow: function onShow() {
|
|
254
|
+
return handleItemIntersectionIn('activityLog');
|
|
255
|
+
}
|
|
256
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
257
|
+
"data-anchor": "activityLog"
|
|
258
|
+
})), /*#__PURE__*/React.createElement("div", null, renderTimeLine())))), platform === 'h5' && tag === 'gift_card' ? /*#__PURE__*/React.createElement(FooterButtons, {
|
|
259
|
+
appleWalletUrl: (_getDetail$data = _getDetail.data) === null || _getDetail$data === void 0 ? void 0 : _getDetail$data.apple_wallet_url,
|
|
260
|
+
googleWalletUrl: (_getDetail$data2 = _getDetail.data) === null || _getDetail$data2 === void 0 ? void 0 : _getDetail$data2.google_wallet_url,
|
|
261
|
+
onRechargeClick: (dataSource === null || dataSource === void 0 || (_dataSource$machineco2 = dataSource.machinecode_config) === null || _dataSource$machineco2 === void 0 ? void 0 : _dataSource$machineco2.hide_recharge) === 0 ? function () {
|
|
262
|
+
return setRechargeOpen(true);
|
|
263
|
+
} : undefined,
|
|
264
|
+
platform: platform
|
|
265
|
+
}) : null, /*#__PURE__*/React.createElement(Recharge, {
|
|
266
|
+
platform: platform,
|
|
267
|
+
detailData: _getDetail.data,
|
|
268
|
+
open: rechargeOpen,
|
|
269
|
+
onClose: function onClose() {
|
|
270
|
+
return setRechargeOpen(false);
|
|
271
|
+
}
|
|
272
|
+
}));
|
|
273
|
+
};
|
|
274
|
+
export default PassDetail;
|