@openwebf/react-router 0.3.2 → 0.3.4

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.
@@ -1,147 +0,0 @@
1
- import type { P2POrder, P2PTrading } from '@internal/types';
2
- export type GetRouteState<T extends RoutePath> = T extends keyof RouteState ? RouteState[T] & DeepLinkParams : never;
3
- export type GetNativeRouteState<T extends NativePath> = T extends keyof NativeState ? NativeState[T] : never;
4
- export type GetH5State<T extends H5Path> = T extends keyof H5State ? H5State[T] : never;
5
- export interface DeepLinkParams {
6
- /**
7
- * 完整的深链参数
8
- */
9
- dp_origin_query?: string;
10
- /**
11
- * 在深链中指定页面路径,适用于希望根路由保持为首页,但又能跳转到指定路径的场景
12
- */
13
- $target?: 'order';
14
- utm_source?: string;
15
- utm_medium?: string;
16
- utm_campaign?: string;
17
- [key: string]: any;
18
- }
19
- export declare enum RoutePath {
20
- /** P2P 首页 */
21
- P2P = "/p2p",
22
- /** P2P 下单页 */
23
- P2PCheckout = "/p2p/checkout",
24
- /** P2P 下单结果页 */
25
- P2PCheckoutResult = "/p2p/checkout-result",
26
- /** P2P 订单 - 已创建 */
27
- P2POrderCreated = "/p2p/order/created",
28
- /** P2P 订单 - 等待买家付款 */
29
- P2POrderPendingPayment = "/p2p/order/pending-payment",
30
- /** P2P 订单 - 等待卖家放币 */
31
- P2POrderPendingRelease = "/p2p/order/pending-release",
32
- /** P2P 订单 - 终态 */
33
- P2POrderResult = "/p2p/order/result",
34
- /** P2P 订单 - 聊天页 */
35
- P2POrderChat = "/p2p/order/chat",
36
- /** P2P 订单列表 */
37
- P2POrderList = "/p2p/orders",
38
- /** P2P 广告列表 */
39
- P2PAdvertisingList = "/p2p/ads",
40
- /** P2P 商家发广告 */
41
- P2PAdvertisingDetail = "/p2p/ads/detail",
42
- /** P2P 个人中心 */
43
- P2PUserCenter = "/p2p/manage",
44
- /** P2P 个人中心 - 支付方式列表 */
45
- P2PPaymentMethod = "/p2p/manage/payment-method",
46
- /** P2P 个人中心 - 支付方式详情 */
47
- P2PPaymentMethodDetail = "/p2p/manage/payment-method/detail",
48
- /** P2P 订单 - 申诉详情 */
49
- P2POrderAppealDetail = "/p2p/order/appeal-detail"
50
- }
51
- export interface RouteState {
52
- [RoutePath.P2PCheckout]: {
53
- market: P2PTrading.Market;
54
- };
55
- [RoutePath.P2PCheckoutResult]: {
56
- orderInfo: P2POrder.OrderInfo;
57
- };
58
- [RoutePath.P2POrderCreated]: P2POrderPageState;
59
- [RoutePath.P2POrderPendingPayment]: P2POrderPageState;
60
- [RoutePath.P2POrderPendingRelease]: P2POrderPageState;
61
- [RoutePath.P2POrderResult]: P2POrderPageState;
62
- [RoutePath.P2POrderAppealDetail]: {
63
- id: string | undefined;
64
- orderInfo: P2POrder.OrderInfo;
65
- };
66
- [RoutePath.P2PPaymentMethodDetail]: {
67
- /** 来源 */
68
- source?: 'p2p_user_center';
69
- /** 当前需要编辑的用户支付方式 ID,不允许用户更改 */
70
- userPaymentMethodId?: number;
71
- /** 当前需要锁定的支付方式 ID,不允许用户更改 */
72
- lockedPaymentMethodId?: number;
73
- };
74
- }
75
- export type P2POrderPageState = {
76
- /** 订单 ID */
77
- orderId: string;
78
- /** 订单详情 */
79
- orderInfo: P2POrder.OrderInfo;
80
- };
81
- /**
82
- * 获取每个页面的中文名称,主要用于各种事件上报
83
- */
84
- export declare function getRouteName(route: RoutePath): string;
85
- /**
86
- * App 内部链接
87
- *
88
- * @see https://l7jipx1bfq.larksuite.com/wiki/H1ekwDc40imVQ2kym7qu87sVsEe?sheet=51ac2c
89
- */
90
- export declare enum NativePath {
91
- /** 合约交易 */
92
- Contract = "mexc://page/main/future",
93
- /** 现货交易 */
94
- Spot = "mexc://page/main/trade",
95
- /** 资产 Tab */
96
- Assets = "mexc://page/main/asset",
97
- /** 划转 */
98
- Transfer = "mexc://page/asset/transfer",
99
- /** 账户中心 */
100
- Account = "mexc://page/account",
101
- /** 安全中心 */
102
- Security = "mexc://page/security",
103
- /** KYC 主页*/
104
- KYC = "mexc://page/kyc",
105
- /** 登录注册 */
106
- Login = "mexc://page/auth/login-register",
107
- /** 绑定手机 */
108
- BindMobile = "mexc://page/security/bind/mobile",
109
- /** 绑定邮箱 */
110
- BindEmail = "mexc://page/security/bind/email",
111
- /** 客服 */
112
- CustomerService = "mexc://page/support/customer-service"
113
- }
114
- /** App 内部链接参数 */
115
- export interface NativeState {
116
- [NativePath.Assets]: {
117
- tab?: 'overview' | 'spot' | 'dex' | 'future' | 'fiat' | 'strategy';
118
- };
119
- [NativePath.Contract]: {
120
- symbol?: string;
121
- source?: string;
122
- };
123
- [NativePath.Transfer]: {
124
- coin_id: string;
125
- };
126
- }
127
- export declare enum H5Path {
128
- /** P2P 商家主页 */
129
- P2PMerchant = "/buy-crypto/merchant",
130
- /** P2P 订单聊天页 */
131
- P2POrderDetailForChat = "/buy-crypto/order-processing",
132
- /** P2P 订单列表 */
133
- P2POrderList = "/buy-crypto/order-processing/fiat-order-list?initOrderState=2",
134
- /** P2P 我的广告列表 */
135
- P2PAdvertiseList = "/buy-crypto/create-advertising/list",
136
- /** P2P 个人中心 */
137
- P2PUserCenter = "/buy-crypto/payment"
138
- }
139
- export interface H5State {
140
- [H5Path.P2POrderDetailForChat]: {
141
- id: string;
142
- };
143
- [H5Path.P2PMerchant]: {
144
- id: string;
145
- };
146
- }
147
- //# sourceMappingURL=routerConfig.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"routerConfig.d.ts","sourceRoot":"","sources":["../../src/routes/routerConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE3D,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,SAAS,IAAI,CAAC,SAAS,MAAM,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,cAAc,GAAG,KAAK,CAAA;AAEpH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,UAA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C;CACzD;AAED,iBAAiB;AACjB,MAAM,WAAW,WAAW;IAC1B,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE;QACnB,GAAG,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAA;KACnE,CAAA;IACD,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QACrB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;QACrB,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;CACF;AAED,oBAAY,MAAM;IAChB,eAAe;IACf,WAAW,yBAAyB;IACpC,gBAAgB;IAChB,qBAAqB,iCAAiC;IACtD,eAAe;IACf,YAAY,kEAAkE;IAC9E,iBAAiB;IACjB,gBAAgB,wCAAwC;IACxD,eAAe;IACf,aAAa,wBAAwB;CACtC;AAED,MAAM,WAAW,OAAO;IACtB,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE;QAC9B,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;IACD,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;QACpB,EAAE,EAAE,MAAM,CAAA;KACX,CAAA;CACF"}
@@ -1,86 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2018 Google LLC
4
- * SPDX-License-Identifier: BSD-3-Clause
5
- */
6
- import React from 'react';
7
- type DistributiveOmit<T, K extends string | number | symbol> = T extends any ? (K extends keyof T ? Omit<T, K> : T) : T;
8
- type PropsWithoutRef<T> = DistributiveOmit<T, 'ref'>;
9
- /**
10
- * Creates a type to be used for the props of a web component used directly in
11
- * React JSX.
12
- *
13
- * Example:
14
- *
15
- * ```ts
16
- * declare module "react" {
17
- * namespace JSX {
18
- * interface IntrinsicElements {
19
- * 'x-foo': WebComponentProps<XFoo>;
20
- * }
21
- * }
22
- * }
23
- * ```
24
- */
25
- export type WebComponentProps<I extends HTMLElement> = React.DetailedHTMLProps<React.HTMLAttributes<I>, I> & ElementProps<I>;
26
- /**
27
- * Type of the React component wrapping the web component. This is the return
28
- * type of `createComponent`.
29
- */
30
- export type ReactWebComponent<I extends HTMLElement, E extends EventNames = {}> = React.ForwardRefExoticComponent<PropsWithoutRef<ComponentProps<I, E>> & React.RefAttributes<I>>;
31
- type ElementProps<I> = Partial<Omit<I, keyof HTMLElement>>;
32
- type ComponentProps<I, E extends EventNames = {}> = Omit<React.HTMLAttributes<I>, keyof E | keyof ElementProps<I>> & ElementProps<I>;
33
- /**
34
- * Type used to cast an event name with an event type when providing the
35
- * `events` option to `createComponent` for better typing of the event handler
36
- * prop.
37
- *
38
- * Example:
39
- *
40
- * ```ts
41
- * const FooComponent = createComponent({
42
- * ...
43
- * events: {
44
- * onfoo: 'foo' as EventName<FooEvent>,
45
- * }
46
- * });
47
- * ```
48
- *
49
- * `onfoo` prop will have the type `(e: FooEvent) => void`.
50
- */
51
- export type EventName<T extends Event = Event> = string & {
52
- __eventType: T;
53
- };
54
- type EventNames = Record<string, EventName | string>;
55
- export interface Options<E extends EventNames = {}> {
56
- tagName: string;
57
- events?: E;
58
- displayName?: string;
59
- }
60
- /**
61
- * Creates a React component for a custom element. Properties are distinguished
62
- * from attributes automatically, and events can be configured so they are added
63
- * to the custom element as event listeners.
64
- *
65
- * @param options An options bag containing the parameters needed to generate a
66
- * wrapped web component.
67
- *
68
- * @param options.react The React module, typically imported from the `react`
69
- * npm package.
70
- * @param options.tagName The custom element tag name registered via
71
- * `customElements.define`.
72
- * @param options.elementClass The custom element class registered via
73
- * `customElements.define`.
74
- * @param options.events An object listing events to which the component can
75
- * listen. The object keys are the event property names passed in via React
76
- * props and the object values are the names of the corresponding events
77
- * generated by the custom element. For example, given `{onactivate:
78
- * 'activate'}` an event function may be passed via the component's `onactivate`
79
- * prop and will be called when the custom element fires its `activate` event.
80
- * @param options.displayName A React component display name, used in debugging
81
- * messages. Default value is inferred from the name of custom element class
82
- * registered via `customElements.define`.
83
- */
84
- export declare const createComponent: <E extends any, I extends any>({ tagName, events, displayName }: Options) => ReactWebComponent<E, I>;
85
- export {};
86
- //# sourceMappingURL=CreateComponent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CreateComponent.d.ts","sourceRoot":"","sources":["../../src/utils/CreateComponent.tsx"],"names":[],"mappings":"AAKA;;;;GAIG;AAEH,OAAO,KAA0E,MAAM,OAAO,CAAA;AAM9F,KAAK,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,MAAM,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;AACvH,KAAK,eAAe,CAAC,CAAC,IAAI,gBAAgB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;AAEpD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,WAAW,IAAI,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GACxG,YAAY,CAAC,CAAC,CAAC,CAAA;AAEjB;;;GAGG;AACH,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,WAAW,EAAE,CAAC,SAAS,UAAU,GAAG,EAAE,IAAI,KAAK,CAAC,yBAAyB,CAG/G,eAAe,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAC/D,CAAA;AAMD,KAAK,YAAY,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,WAAW,CAAC,CAAC,CAAA;AAG1D,KAAK,cAAc,CAAC,CAAC,EAAE,CAAC,SAAS,UAAU,GAAG,EAAE,IAAI,IAAI,CACtD,KAAK,CAA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