@pisell/pisellos 0.0.5

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 (138) hide show
  1. package/README.md +180 -0
  2. package/dist/core/index.d.ts +30 -0
  3. package/dist/core/index.js +360 -0
  4. package/dist/effects/index.d.ts +17 -0
  5. package/dist/effects/index.js +162 -0
  6. package/dist/index.d.ts +11 -0
  7. package/dist/index.js +17 -0
  8. package/dist/modules/Account/index.d.ts +21 -0
  9. package/dist/modules/Account/index.js +212 -0
  10. package/dist/modules/Account/types.d.ts +41 -0
  11. package/dist/modules/Account/types.js +19 -0
  12. package/dist/modules/BaseModule.d.ts +11 -0
  13. package/dist/modules/BaseModule.js +27 -0
  14. package/dist/modules/Cart/index.d.ts +33 -0
  15. package/dist/modules/Cart/index.js +242 -0
  16. package/dist/modules/Cart/types.d.ts +35 -0
  17. package/dist/modules/Cart/types.js +19 -0
  18. package/dist/modules/Date/index.d.ts +17 -0
  19. package/dist/modules/Date/index.js +133 -0
  20. package/dist/modules/Date/types.d.ts +32 -0
  21. package/dist/modules/Date/types.js +17 -0
  22. package/dist/modules/Guests/index.d.ts +17 -0
  23. package/dist/modules/Guests/index.js +259 -0
  24. package/dist/modules/Guests/types.d.ts +43 -0
  25. package/dist/modules/Guests/types.js +23 -0
  26. package/dist/modules/Order/index.d.ts +17 -0
  27. package/dist/modules/Order/index.js +228 -0
  28. package/dist/modules/Order/types.d.ts +57 -0
  29. package/dist/modules/Order/types.js +29 -0
  30. package/dist/modules/Payment/index.d.ts +18 -0
  31. package/dist/modules/Payment/index.js +243 -0
  32. package/dist/modules/Payment/types.d.ts +49 -0
  33. package/dist/modules/Payment/types.js +31 -0
  34. package/dist/modules/Product/index.d.ts +39 -0
  35. package/dist/modules/Product/index.js +118 -0
  36. package/dist/modules/Product/types.d.ts +387 -0
  37. package/dist/modules/Product/types.js +1 -0
  38. package/dist/modules/ProductList/index.d.ts +16 -0
  39. package/dist/modules/ProductList/index.js +158 -0
  40. package/dist/modules/ProductList/types.d.ts +9 -0
  41. package/dist/modules/ProductList/types.js +5 -0
  42. package/dist/modules/Resource/index.d.ts +15 -0
  43. package/dist/modules/Resource/index.js +219 -0
  44. package/dist/modules/Resource/types.d.ts +44 -0
  45. package/dist/modules/Resource/types.js +22 -0
  46. package/dist/modules/index.d.ts +3 -0
  47. package/dist/modules/index.js +3 -0
  48. package/dist/plugins/index.d.ts +2 -0
  49. package/dist/plugins/index.js +2 -0
  50. package/dist/plugins/request.d.ts +127 -0
  51. package/dist/plugins/request.js +592 -0
  52. package/dist/plugins/window.d.ts +115 -0
  53. package/dist/plugins/window.js +328 -0
  54. package/dist/solution/BookingByStep/index.d.ts +12 -0
  55. package/dist/solution/BookingByStep/index.js +77 -0
  56. package/dist/solution/BookingByStep/types.d.ts +27 -0
  57. package/dist/solution/BookingByStep/types.js +10 -0
  58. package/dist/solution/BuyTickets/index.d.ts +26 -0
  59. package/dist/solution/BuyTickets/index.js +339 -0
  60. package/dist/solution/BuyTickets/types.d.ts +24 -0
  61. package/dist/solution/BuyTickets/types.js +19 -0
  62. package/dist/solution/PlaceOrder/index.d.ts +0 -0
  63. package/dist/solution/PlaceOrder/index.js +54 -0
  64. package/dist/solution/index.d.ts +1 -0
  65. package/dist/solution/index.js +1 -0
  66. package/dist/store/createStore.d.ts +3 -0
  67. package/dist/store/createStore.js +43 -0
  68. package/dist/types/index.d.ts +85 -0
  69. package/dist/types/index.js +1 -0
  70. package/lib/core/index.d.ts +30 -0
  71. package/lib/core/index.js +212 -0
  72. package/lib/effects/index.d.ts +17 -0
  73. package/lib/effects/index.js +78 -0
  74. package/lib/index.d.ts +11 -0
  75. package/lib/index.js +51 -0
  76. package/lib/modules/Account/index.d.ts +21 -0
  77. package/lib/modules/Account/index.js +93 -0
  78. package/lib/modules/Account/types.d.ts +41 -0
  79. package/lib/modules/Account/types.js +35 -0
  80. package/lib/modules/BaseModule.d.ts +11 -0
  81. package/lib/modules/BaseModule.js +40 -0
  82. package/lib/modules/Cart/index.d.ts +33 -0
  83. package/lib/modules/Cart/index.js +104 -0
  84. package/lib/modules/Cart/types.d.ts +35 -0
  85. package/lib/modules/Cart/types.js +35 -0
  86. package/lib/modules/Date/index.d.ts +17 -0
  87. package/lib/modules/Date/index.js +75 -0
  88. package/lib/modules/Date/types.d.ts +32 -0
  89. package/lib/modules/Date/types.js +33 -0
  90. package/lib/modules/Guests/index.d.ts +17 -0
  91. package/lib/modules/Guests/index.js +95 -0
  92. package/lib/modules/Guests/types.d.ts +43 -0
  93. package/lib/modules/Guests/types.js +35 -0
  94. package/lib/modules/Order/index.d.ts +17 -0
  95. package/lib/modules/Order/index.js +95 -0
  96. package/lib/modules/Order/types.d.ts +57 -0
  97. package/lib/modules/Order/types.js +35 -0
  98. package/lib/modules/Payment/index.d.ts +18 -0
  99. package/lib/modules/Payment/index.js +103 -0
  100. package/lib/modules/Payment/types.d.ts +49 -0
  101. package/lib/modules/Payment/types.js +35 -0
  102. package/lib/modules/Product/index.d.ts +39 -0
  103. package/lib/modules/Product/index.js +87 -0
  104. package/lib/modules/Product/types.d.ts +387 -0
  105. package/lib/modules/Product/types.js +17 -0
  106. package/lib/modules/ProductList/index.d.ts +16 -0
  107. package/lib/modules/ProductList/index.js +71 -0
  108. package/lib/modules/ProductList/types.d.ts +9 -0
  109. package/lib/modules/ProductList/types.js +33 -0
  110. package/lib/modules/Resource/index.d.ts +15 -0
  111. package/lib/modules/Resource/index.js +91 -0
  112. package/lib/modules/Resource/types.d.ts +44 -0
  113. package/lib/modules/Resource/types.js +34 -0
  114. package/lib/modules/index.d.ts +3 -0
  115. package/lib/modules/index.js +27 -0
  116. package/lib/plugins/index.d.ts +2 -0
  117. package/lib/plugins/index.js +25 -0
  118. package/lib/plugins/request.d.ts +127 -0
  119. package/lib/plugins/request.js +297 -0
  120. package/lib/plugins/window.d.ts +115 -0
  121. package/lib/plugins/window.js +252 -0
  122. package/lib/solution/BookingByStep/index.d.ts +12 -0
  123. package/lib/solution/BookingByStep/index.js +53 -0
  124. package/lib/solution/BookingByStep/types.d.ts +27 -0
  125. package/lib/solution/BookingByStep/types.js +38 -0
  126. package/lib/solution/BuyTickets/index.d.ts +26 -0
  127. package/lib/solution/BuyTickets/index.js +122 -0
  128. package/lib/solution/BuyTickets/types.d.ts +24 -0
  129. package/lib/solution/BuyTickets/types.js +40 -0
  130. package/lib/solution/PlaceOrder/index.d.ts +0 -0
  131. package/lib/solution/PlaceOrder/index.js +0 -0
  132. package/lib/solution/index.d.ts +1 -0
  133. package/lib/solution/index.js +23 -0
  134. package/lib/store/createStore.d.ts +3 -0
  135. package/lib/store/createStore.js +46 -0
  136. package/lib/types/index.d.ts +85 -0
  137. package/lib/types/index.js +17 -0
  138. package/package.json +65 -0
@@ -0,0 +1,115 @@
1
+ import { Plugin } from '../types';
2
+ /**
3
+ * WindowPlugin 接口定义
4
+ */
5
+ export interface WindowPlugin extends Plugin {
6
+ setTimeout: typeof setTimeout;
7
+ clearTimeout: typeof clearTimeout;
8
+ setInterval: typeof setInterval;
9
+ clearInterval: typeof clearInterval;
10
+ localStorage: Storage;
11
+ sessionStorage: Storage;
12
+ location: Partial<Location>;
13
+ navigator: Partial<Navigator>;
14
+ document: Partial<Document>;
15
+ history: History;
16
+ }
17
+ /**
18
+ * 简单的 Storage 接口实现
19
+ */
20
+ declare class SimpleStorage implements Storage {
21
+ private items;
22
+ get length(): number;
23
+ key(index: number): string | null;
24
+ getItem(key: string): string | null;
25
+ setItem(key: string, value: string): void;
26
+ removeItem(key: string): void;
27
+ clear(): void;
28
+ }
29
+ /**
30
+ * 简单的 Location 类实现
31
+ */
32
+ declare class SimpleLocation implements Partial<Location> {
33
+ hash: string;
34
+ host: string;
35
+ hostname: string;
36
+ href: string;
37
+ origin: string;
38
+ pathname: string;
39
+ port: string;
40
+ protocol: string;
41
+ search: string;
42
+ ancestorOrigins: DOMStringList;
43
+ assign(url: string | URL): void;
44
+ reload(): void;
45
+ replace(url: string | URL): void;
46
+ toString(): string;
47
+ }
48
+ /**
49
+ * 简单的 Navigator 类实现
50
+ */
51
+ declare class SimpleNavigator implements Partial<Navigator> {
52
+ userAgent: string;
53
+ language: string;
54
+ languages: string[];
55
+ onLine: boolean;
56
+ cookieEnabled: boolean;
57
+ readonly appCodeName: string;
58
+ readonly appName: string;
59
+ readonly appVersion: string;
60
+ readonly platform: string;
61
+ readonly product: string;
62
+ javaEnabled(): boolean;
63
+ }
64
+ /**
65
+ * 简单的 History 接口实现
66
+ */
67
+ declare class SimpleHistory implements History {
68
+ length: number;
69
+ scrollRestoration: ScrollRestoration;
70
+ state: any;
71
+ back(): void;
72
+ forward(): void;
73
+ go(): void;
74
+ pushState(): void;
75
+ replaceState(): void;
76
+ }
77
+ /**
78
+ * 简单的 Document 类实现
79
+ */
80
+ declare class SimpleDocument implements Partial<Document> {
81
+ private elements;
82
+ createElement(tagName: string): HTMLElement;
83
+ getElementById(id: string): HTMLElement | null;
84
+ readonly URL: string;
85
+ readonly documentURI: string;
86
+ readonly origin: string;
87
+ readonly characterSet: string;
88
+ readonly contentType: string;
89
+ readonly compatMode: string;
90
+ querySelector(): Element | null;
91
+ querySelectorAll(): NodeListOf<Element>;
92
+ getElementsByTagName(): HTMLCollectionOf<Element>;
93
+ getElementsByClassName(): HTMLCollectionOf<Element>;
94
+ }
95
+ /**
96
+ * Window 插件实现
97
+ */
98
+ declare class WindowPluginImpl implements WindowPlugin {
99
+ name: string;
100
+ version: string;
101
+ setTimeout: typeof setTimeout;
102
+ clearTimeout: typeof clearTimeout;
103
+ setInterval: typeof setInterval;
104
+ clearInterval: typeof clearInterval;
105
+ localStorage: SimpleStorage;
106
+ sessionStorage: SimpleStorage;
107
+ location: SimpleLocation;
108
+ navigator: SimpleNavigator;
109
+ document: SimpleDocument;
110
+ history: SimpleHistory;
111
+ initialize(): void;
112
+ destroy(): void;
113
+ }
114
+ declare const _default: WindowPluginImpl;
115
+ export default _default;
@@ -0,0 +1,328 @@
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
3
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
4
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
5
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
+ /**
9
+ * WindowPlugin 接口定义
10
+ */
11
+ /**
12
+ * 简单的 Storage 接口实现
13
+ */
14
+ var SimpleStorage = /*#__PURE__*/function () {
15
+ function SimpleStorage() {
16
+ _classCallCheck(this, SimpleStorage);
17
+ _defineProperty(this, "items", {});
18
+ }
19
+ _createClass(SimpleStorage, [{
20
+ key: "length",
21
+ get: function get() {
22
+ return Object.keys(this.items).length;
23
+ }
24
+ }, {
25
+ key: "key",
26
+ value: function key(index) {
27
+ var keys = Object.keys(this.items);
28
+ return index >= 0 && index < keys.length ? keys[index] : null;
29
+ }
30
+ }, {
31
+ key: "getItem",
32
+ value: function getItem(key) {
33
+ return key in this.items ? this.items[key] : null;
34
+ }
35
+ }, {
36
+ key: "setItem",
37
+ value: function setItem(key, value) {
38
+ this.items[key] = value;
39
+ }
40
+ }, {
41
+ key: "removeItem",
42
+ value: function removeItem(key) {
43
+ delete this.items[key];
44
+ }
45
+ }, {
46
+ key: "clear",
47
+ value: function clear() {
48
+ this.items = {};
49
+ }
50
+ }]);
51
+ return SimpleStorage;
52
+ }();
53
+ /**
54
+ * 简单的 Location 类实现
55
+ */
56
+ var SimpleLocation = /*#__PURE__*/function () {
57
+ function SimpleLocation() {
58
+ _classCallCheck(this, SimpleLocation);
59
+ _defineProperty(this, "hash", '');
60
+ _defineProperty(this, "host", 'localhost');
61
+ _defineProperty(this, "hostname", 'localhost');
62
+ _defineProperty(this, "href", 'https://localhost');
63
+ _defineProperty(this, "origin", 'https://localhost');
64
+ _defineProperty(this, "pathname", '/');
65
+ _defineProperty(this, "port", '');
66
+ _defineProperty(this, "protocol", 'https:');
67
+ _defineProperty(this, "search", '');
68
+ _defineProperty(this, "ancestorOrigins", {});
69
+ }
70
+ _createClass(SimpleLocation, [{
71
+ key: "assign",
72
+ value: function assign(url) {}
73
+ }, {
74
+ key: "reload",
75
+ value: function reload() {}
76
+ }, {
77
+ key: "replace",
78
+ value: function replace(url) {}
79
+ }, {
80
+ key: "toString",
81
+ value: function toString() {
82
+ return this.href;
83
+ }
84
+ }]);
85
+ return SimpleLocation;
86
+ }();
87
+ /**
88
+ * 简单的 Navigator 类实现
89
+ */
90
+ var SimpleNavigator = /*#__PURE__*/function () {
91
+ function SimpleNavigator() {
92
+ _classCallCheck(this, SimpleNavigator);
93
+ _defineProperty(this, "userAgent", 'PisellOS/1.0');
94
+ _defineProperty(this, "language", 'zh-CN');
95
+ _defineProperty(this, "languages", ['zh-CN', 'en-US']);
96
+ _defineProperty(this, "onLine", true);
97
+ _defineProperty(this, "cookieEnabled", true);
98
+ // 以下属性只提供必要实现
99
+ _defineProperty(this, "appCodeName", 'PisellOS');
100
+ _defineProperty(this, "appName", 'PisellOS');
101
+ _defineProperty(this, "appVersion", '1.0');
102
+ _defineProperty(this, "platform", 'PisellOS');
103
+ _defineProperty(this, "product", 'PisellOS');
104
+ }
105
+ _createClass(SimpleNavigator, [{
106
+ key: "javaEnabled",
107
+ value: function javaEnabled() {
108
+ return false;
109
+ }
110
+ }]);
111
+ return SimpleNavigator;
112
+ }();
113
+ /**
114
+ * 简单的 History 接口实现
115
+ */
116
+ var SimpleHistory = /*#__PURE__*/function () {
117
+ function SimpleHistory() {
118
+ _classCallCheck(this, SimpleHistory);
119
+ _defineProperty(this, "length", 0);
120
+ _defineProperty(this, "scrollRestoration", 'auto');
121
+ _defineProperty(this, "state", null);
122
+ }
123
+ _createClass(SimpleHistory, [{
124
+ key: "back",
125
+ value: function back() {}
126
+ }, {
127
+ key: "forward",
128
+ value: function forward() {}
129
+ }, {
130
+ key: "go",
131
+ value: function go() {}
132
+ }, {
133
+ key: "pushState",
134
+ value: function pushState() {}
135
+ }, {
136
+ key: "replaceState",
137
+ value: function replaceState() {}
138
+ }]);
139
+ return SimpleHistory;
140
+ }();
141
+ /**
142
+ * 简单 HTMLElement 接口
143
+ */
144
+ /**
145
+ * 简单的 Document 类实现
146
+ */
147
+ var SimpleDocument = /*#__PURE__*/function () {
148
+ function SimpleDocument() {
149
+ _classCallCheck(this, SimpleDocument);
150
+ // 仅实现基本功能
151
+ _defineProperty(this, "elements", {});
152
+ // Document 接口的必要属性
153
+ _defineProperty(this, "URL", 'https://localhost');
154
+ _defineProperty(this, "documentURI", 'https://localhost');
155
+ _defineProperty(this, "origin", 'https://localhost');
156
+ _defineProperty(this, "characterSet", 'UTF-8');
157
+ _defineProperty(this, "contentType", 'text/html');
158
+ _defineProperty(this, "compatMode", 'CSS1Compat');
159
+ }
160
+ _createClass(SimpleDocument, [{
161
+ key: "createElement",
162
+ value: function createElement(tagName) {
163
+ var element = {
164
+ tagName: tagName.toUpperCase(),
165
+ id: '',
166
+ className: '',
167
+ innerHTML: '',
168
+ style: {},
169
+ dataset: {},
170
+ attributes: {},
171
+ children: [],
172
+ parentElement: null,
173
+ addEventListener: function addEventListener() {},
174
+ removeEventListener: function removeEventListener() {},
175
+ getAttribute: function getAttribute(name) {
176
+ return element.attributes[name];
177
+ },
178
+ setAttribute: function setAttribute(name, value) {
179
+ element.attributes[name] = value;
180
+ },
181
+ removeAttribute: function removeAttribute(name) {
182
+ delete element.attributes[name];
183
+ },
184
+ appendChild: function appendChild(child) {
185
+ element.children.push(child);
186
+ return child;
187
+ },
188
+ removeChild: function removeChild(child) {
189
+ var index = element.children.indexOf(child);
190
+ if (index !== -1) {
191
+ element.children.splice(index, 1);
192
+ }
193
+ return child;
194
+ }
195
+ };
196
+ return element;
197
+ }
198
+ }, {
199
+ key: "getElementById",
200
+ value: function getElementById(id) {
201
+ return this.elements[id] || null;
202
+ }
203
+ }, {
204
+ key: "querySelector",
205
+ value: function querySelector() {
206
+ return null;
207
+ }
208
+ }, {
209
+ key: "querySelectorAll",
210
+ value: function querySelectorAll() {
211
+ return [];
212
+ }
213
+ }, {
214
+ key: "getElementsByTagName",
215
+ value: function getElementsByTagName() {
216
+ return [];
217
+ }
218
+ }, {
219
+ key: "getElementsByClassName",
220
+ value: function getElementsByClassName() {
221
+ return [];
222
+ }
223
+ }]);
224
+ return SimpleDocument;
225
+ }();
226
+ /**
227
+ * Window 插件实现
228
+ */
229
+ var WindowPluginImpl = /*#__PURE__*/function () {
230
+ function WindowPluginImpl() {
231
+ _classCallCheck(this, WindowPluginImpl);
232
+ _defineProperty(this, "name", 'window');
233
+ _defineProperty(this, "version", '1.0.0');
234
+ // 定时器相关
235
+ _defineProperty(this, "setTimeout", Object.assign(function (handler, timeout) {
236
+ for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
237
+ args[_key - 2] = arguments[_key];
238
+ }
239
+ if (typeof globalThis !== 'undefined' && globalThis.setTimeout) {
240
+ return globalThis.setTimeout.apply(globalThis, [handler, timeout].concat(args));
241
+ }
242
+ // Fallback 实现,使用 Promise 模拟
243
+ var timeoutId = Date.now();
244
+ Promise.resolve().then(function () {
245
+ setTimeout(function () {
246
+ if (typeof handler === 'function') {
247
+ handler.apply(void 0, args);
248
+ } else {
249
+ eval(handler);
250
+ }
251
+ }, timeout || 0);
252
+ });
253
+ return timeoutId;
254
+ }, {
255
+ __promisify__: function __promisify__(delay, value) {
256
+ return new Promise(function (resolve) {
257
+ return setTimeout(resolve, delay, value);
258
+ });
259
+ }
260
+ }));
261
+ _defineProperty(this, "clearTimeout", function (timeout) {
262
+ if (typeof globalThis !== 'undefined' && globalThis.clearTimeout) {
263
+ globalThis.clearTimeout(timeout);
264
+ }
265
+ // Fallback 不做任何操作
266
+ });
267
+ _defineProperty(this, "setInterval", Object.assign(function (handler, timeout) {
268
+ var _this = this;
269
+ for (var _len2 = arguments.length, args = new Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
270
+ args[_key2 - 2] = arguments[_key2];
271
+ }
272
+ if (typeof globalThis !== 'undefined' && globalThis.setInterval) {
273
+ return globalThis.setInterval.apply(globalThis, [handler, timeout].concat(args));
274
+ }
275
+ // Fallback 实现,使用递归 setTimeout 模拟
276
+ var intervalId = Date.now();
277
+ var recursiveTimeout = function recursiveTimeout() {
278
+ _this.setTimeout(function () {
279
+ if (typeof handler === 'function') {
280
+ handler.apply(void 0, args);
281
+ } else {
282
+ eval(handler);
283
+ }
284
+ recursiveTimeout();
285
+ }, timeout || 0);
286
+ };
287
+ recursiveTimeout();
288
+ return intervalId;
289
+ }, {
290
+ __promisify__: function __promisify__(delay, value) {
291
+ return new Promise(function (resolve) {
292
+ return setInterval(resolve, delay, value);
293
+ });
294
+ }
295
+ }));
296
+ _defineProperty(this, "clearInterval", function (timeout) {
297
+ if (typeof globalThis !== 'undefined' && globalThis.clearInterval) {
298
+ globalThis.clearInterval(timeout);
299
+ }
300
+ // Fallback 不做任何操作
301
+ });
302
+ // 存储相关
303
+ _defineProperty(this, "localStorage", new SimpleStorage());
304
+ _defineProperty(this, "sessionStorage", new SimpleStorage());
305
+ // 浏览器环境对象
306
+ _defineProperty(this, "location", new SimpleLocation());
307
+ _defineProperty(this, "navigator", new SimpleNavigator());
308
+ _defineProperty(this, "document", new SimpleDocument());
309
+ _defineProperty(this, "history", new SimpleHistory());
310
+ }
311
+ _createClass(WindowPluginImpl, [{
312
+ key: "initialize",
313
+ value:
314
+ // 初始化方法
315
+ function initialize() {
316
+ console.log('[WindowPlugin] 初始化完成');
317
+ }
318
+
319
+ // 销毁方法
320
+ }, {
321
+ key: "destroy",
322
+ value: function destroy() {
323
+ console.log('[WindowPlugin] 已销毁');
324
+ }
325
+ }]);
326
+ return WindowPluginImpl;
327
+ }();
328
+ export default new WindowPluginImpl();
@@ -0,0 +1,12 @@
1
+ import { Module, PisellCore } from '../../types';
2
+ import { BaseModule } from "../../modules/BaseModule";
3
+ export declare class BookingByStepImpl extends BaseModule implements Module {
4
+ protected defaultName: string;
5
+ protected defaultVersion: string;
6
+ isSolution: boolean;
7
+ private request;
8
+ private window;
9
+ private store;
10
+ private otherParams;
11
+ initialize(core: PisellCore, options: any): Promise<void>;
12
+ }
@@ -0,0 +1,77 @@
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 _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
9
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
10
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
11
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
12
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
13
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
14
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
15
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
17
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
+ import { BaseModule } from "../../modules/BaseModule";
19
+ import { BookingByStepHooks } from "./types";
20
+ export var BookingByStepImpl = /*#__PURE__*/function (_BaseModule) {
21
+ _inherits(BookingByStepImpl, _BaseModule);
22
+ var _super = _createSuper(BookingByStepImpl);
23
+ function BookingByStepImpl() {
24
+ var _this;
25
+ _classCallCheck(this, BookingByStepImpl);
26
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27
+ args[_key] = arguments[_key];
28
+ }
29
+ _this = _super.call.apply(_super, [this].concat(args));
30
+ _defineProperty(_assertThisInitialized(_this), "defaultName", 'bookingByStep');
31
+ _defineProperty(_assertThisInitialized(_this), "defaultVersion", '1.0.0');
32
+ _defineProperty(_assertThisInitialized(_this), "isSolution", true);
33
+ _defineProperty(_assertThisInitialized(_this), "request", void 0);
34
+ _defineProperty(_assertThisInitialized(_this), "window", void 0);
35
+ _defineProperty(_assertThisInitialized(_this), "store", void 0);
36
+ _defineProperty(_assertThisInitialized(_this), "otherParams", {});
37
+ return _this;
38
+ }
39
+ _createClass(BookingByStepImpl, [{
40
+ key: "initialize",
41
+ value: function () {
42
+ var _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(core, options) {
43
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
44
+ while (1) switch (_context.prev = _context.next) {
45
+ case 0:
46
+ this.core = core;
47
+ this.store = options.store || {};
48
+ this.otherParams = options.otherParams || {};
49
+ console.log('[BuyTickets] 初始化完成');
50
+ // 获取依赖的插件
51
+ this.request = core.getPlugin('request');
52
+ this.window = core.getPlugin('window');
53
+ if (this.request) {
54
+ _context.next = 8;
55
+ break;
56
+ }
57
+ throw new Error('tickets解决方案需要 request 插件支持');
58
+ case 8:
59
+ if (this.otherParams.prodctIds) {
60
+ // await this.loadProductsByIds(this.otherParams.prodctIds)
61
+ }
62
+ _context.next = 11;
63
+ return this.core.effects.emit(BookingByStepHooks.onInited, {});
64
+ case 11:
65
+ case "end":
66
+ return _context.stop();
67
+ }
68
+ }, _callee, this);
69
+ }));
70
+ function initialize(_x, _x2) {
71
+ return _initialize.apply(this, arguments);
72
+ }
73
+ return initialize;
74
+ }()
75
+ }]);
76
+ return BookingByStepImpl;
77
+ }(BaseModule);
@@ -0,0 +1,27 @@
1
+ import { ProductList, CartModule } from "../../modules";
2
+ import { AccountModule } from "../../modules/Account";
3
+ import { DateModule } from "../../modules/Date";
4
+ import { GuestListModule } from "../../modules/Guests";
5
+ import { OrderModule } from "../../modules/Order";
6
+ import { PaymentModule } from "../../modules/Payment";
7
+ import { ResourceListModule } from "../../modules/Resource";
8
+ export interface BookingByStepState {
9
+ cart: CartModule;
10
+ currentStep: number;
11
+ products: ProductList;
12
+ guests: GuestListModule;
13
+ date: DateModule;
14
+ resources: ResourceListModule[];
15
+ account: AccountModule;
16
+ order: OrderModule;
17
+ payment: PaymentModule;
18
+ }
19
+ export declare enum BookingByStepHooks {
20
+ onInited = "bookingByStep:onInited",
21
+ onDestroy = "bookingByStep:onDestroy",
22
+ onProductsLoaded = "bookingByStep:onProductsLoaded",
23
+ onGuestsLoaded = "bookingByStep:onGuestsLoaded",
24
+ onDateLoaded = "bookingByStep:onDateLoaded",
25
+ onResourcesLoaded = "bookingByStep:onResourcesLoaded",
26
+ onAccountLoaded = "bookingByStep:onAccountLoaded"
27
+ }
@@ -0,0 +1,10 @@
1
+ export var BookingByStepHooks = /*#__PURE__*/function (BookingByStepHooks) {
2
+ BookingByStepHooks["onInited"] = "bookingByStep:onInited";
3
+ BookingByStepHooks["onDestroy"] = "bookingByStep:onDestroy";
4
+ BookingByStepHooks["onProductsLoaded"] = "bookingByStep:onProductsLoaded";
5
+ BookingByStepHooks["onGuestsLoaded"] = "bookingByStep:onGuestsLoaded";
6
+ BookingByStepHooks["onDateLoaded"] = "bookingByStep:onDateLoaded";
7
+ BookingByStepHooks["onResourcesLoaded"] = "bookingByStep:onResourcesLoaded";
8
+ BookingByStepHooks["onAccountLoaded"] = "bookingByStep:onAccountLoaded";
9
+ return BookingByStepHooks;
10
+ }({});
@@ -0,0 +1,26 @@
1
+ import { Module, PisellCore } from '../../types';
2
+ import { Product, ProductData } from '../../modules/';
3
+ import { BaseModule } from '../../modules/BaseModule';
4
+ export * from './types';
5
+ export declare class BuyTicketsImpl extends BaseModule implements Module {
6
+ protected defaultName: string;
7
+ protected defaultVersion: string;
8
+ isSolution: boolean;
9
+ private request;
10
+ private window;
11
+ private store;
12
+ private otherParams;
13
+ constructor(name?: string, version?: string);
14
+ initialize(core: PisellCore, options: any): Promise<void>;
15
+ loadProductsByIds(ids: number[]): Promise<void>;
16
+ loadProductsByCategory(categoryId: number): Promise<void>;
17
+ destroy(): Promise<void>;
18
+ getProducts(): Promise<ProductData[]>;
19
+ getProduct(id: number): Promise<Product>;
20
+ listSubmit(data: Record<string, any>): Promise<{
21
+ status: boolean;
22
+ data: any;
23
+ } | undefined>;
24
+ cartSubmit(data: Record<string, any>): Promise<void>;
25
+ checkoutSubmit(data: Record<string, any>): Promise<void>;
26
+ }