@orderly.network/ui-share 2.0.0-alpha.1
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/dist/index.d.mts +98 -0
- package/dist/index.d.ts +98 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +13 -0
- package/dist/index.mjs.map +1 -0
- package/dist/styles.css +1 -0
- package/package.json +45 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type layoutInfo = {
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
fontSize?: number;
|
|
7
|
+
color?: string;
|
|
8
|
+
textAlign?: CanvasTextAlign;
|
|
9
|
+
textBaseline?: CanvasTextBaseline;
|
|
10
|
+
position: Partial<{
|
|
11
|
+
left: number;
|
|
12
|
+
right: number;
|
|
13
|
+
top: number;
|
|
14
|
+
bottom: number;
|
|
15
|
+
}>;
|
|
16
|
+
};
|
|
17
|
+
type PosterLayoutConfig = {
|
|
18
|
+
message?: layoutInfo;
|
|
19
|
+
domain?: layoutInfo;
|
|
20
|
+
position?: layoutInfo;
|
|
21
|
+
unrealizedPnl?: layoutInfo & {
|
|
22
|
+
secondaryColor: string;
|
|
23
|
+
secondaryFontSize: number;
|
|
24
|
+
};
|
|
25
|
+
informations?: layoutInfo & {
|
|
26
|
+
labelColor?: string;
|
|
27
|
+
};
|
|
28
|
+
updateTime?: layoutInfo;
|
|
29
|
+
};
|
|
30
|
+
type SharePnLParams = {
|
|
31
|
+
position: any;
|
|
32
|
+
leverage?: number;
|
|
33
|
+
refCode?: string;
|
|
34
|
+
refSlogan?: string;
|
|
35
|
+
refLink?: string;
|
|
36
|
+
};
|
|
37
|
+
type SharePnLConfig = {
|
|
38
|
+
/**
|
|
39
|
+
* defualt is Manrope
|
|
40
|
+
*/
|
|
41
|
+
fontFamily?: string;
|
|
42
|
+
/**
|
|
43
|
+
* can not empty
|
|
44
|
+
*/
|
|
45
|
+
backgroundImages: string[];
|
|
46
|
+
/**
|
|
47
|
+
* posterLayoutConfig
|
|
48
|
+
*/
|
|
49
|
+
layout?: PosterLayoutConfig;
|
|
50
|
+
/**
|
|
51
|
+
* norma text color, default is "rgba(255, 255, 255, 0.98)"
|
|
52
|
+
*/
|
|
53
|
+
color?: string;
|
|
54
|
+
/**
|
|
55
|
+
* profit text color, default is "rgb(0,181,159)"
|
|
56
|
+
*/
|
|
57
|
+
profitColor?: string;
|
|
58
|
+
/**
|
|
59
|
+
* loss text color, default is "rgb(255,103,194)"
|
|
60
|
+
*/
|
|
61
|
+
lossColor?: string;
|
|
62
|
+
/**
|
|
63
|
+
* brand color, default is "rgb(0,181,159)"
|
|
64
|
+
*/
|
|
65
|
+
brandColor?: string;
|
|
66
|
+
};
|
|
67
|
+
type ReferralType = {
|
|
68
|
+
code?: string;
|
|
69
|
+
link?: string;
|
|
70
|
+
slogan?: string;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
declare const useSharePnLScript: (props: {
|
|
74
|
+
pnl?: (SharePnLConfig & SharePnLParams) | undefined;
|
|
75
|
+
hide?: () => void;
|
|
76
|
+
}) => {
|
|
77
|
+
position: any;
|
|
78
|
+
leverage: number | undefined;
|
|
79
|
+
baseDp: any;
|
|
80
|
+
quoteDp: any;
|
|
81
|
+
referralInfo: ReferralType | undefined;
|
|
82
|
+
shareOptions: SharePnLConfig;
|
|
83
|
+
hide: (() => void) | undefined;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
declare const SharePnLBottomSheetWidget: (props: {
|
|
87
|
+
hide?: () => void;
|
|
88
|
+
pnl?: SharePnLConfig & SharePnLParams;
|
|
89
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
90
|
+
declare const SharePnLDialogWidget: (props: {
|
|
91
|
+
hide?: () => void;
|
|
92
|
+
pnl?: SharePnLConfig & SharePnLParams;
|
|
93
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
94
|
+
|
|
95
|
+
declare const SharePnLDialogId = "sharePnLDialog";
|
|
96
|
+
declare const SharePnLBottomSheetId = "sharePnLBottomSheet";
|
|
97
|
+
|
|
98
|
+
export { SharePnLBottomSheetId, SharePnLBottomSheetWidget, type SharePnLConfig, SharePnLDialogId, SharePnLDialogWidget, type SharePnLParams, useSharePnLScript };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type layoutInfo = {
|
|
4
|
+
width?: number;
|
|
5
|
+
height?: number;
|
|
6
|
+
fontSize?: number;
|
|
7
|
+
color?: string;
|
|
8
|
+
textAlign?: CanvasTextAlign;
|
|
9
|
+
textBaseline?: CanvasTextBaseline;
|
|
10
|
+
position: Partial<{
|
|
11
|
+
left: number;
|
|
12
|
+
right: number;
|
|
13
|
+
top: number;
|
|
14
|
+
bottom: number;
|
|
15
|
+
}>;
|
|
16
|
+
};
|
|
17
|
+
type PosterLayoutConfig = {
|
|
18
|
+
message?: layoutInfo;
|
|
19
|
+
domain?: layoutInfo;
|
|
20
|
+
position?: layoutInfo;
|
|
21
|
+
unrealizedPnl?: layoutInfo & {
|
|
22
|
+
secondaryColor: string;
|
|
23
|
+
secondaryFontSize: number;
|
|
24
|
+
};
|
|
25
|
+
informations?: layoutInfo & {
|
|
26
|
+
labelColor?: string;
|
|
27
|
+
};
|
|
28
|
+
updateTime?: layoutInfo;
|
|
29
|
+
};
|
|
30
|
+
type SharePnLParams = {
|
|
31
|
+
position: any;
|
|
32
|
+
leverage?: number;
|
|
33
|
+
refCode?: string;
|
|
34
|
+
refSlogan?: string;
|
|
35
|
+
refLink?: string;
|
|
36
|
+
};
|
|
37
|
+
type SharePnLConfig = {
|
|
38
|
+
/**
|
|
39
|
+
* defualt is Manrope
|
|
40
|
+
*/
|
|
41
|
+
fontFamily?: string;
|
|
42
|
+
/**
|
|
43
|
+
* can not empty
|
|
44
|
+
*/
|
|
45
|
+
backgroundImages: string[];
|
|
46
|
+
/**
|
|
47
|
+
* posterLayoutConfig
|
|
48
|
+
*/
|
|
49
|
+
layout?: PosterLayoutConfig;
|
|
50
|
+
/**
|
|
51
|
+
* norma text color, default is "rgba(255, 255, 255, 0.98)"
|
|
52
|
+
*/
|
|
53
|
+
color?: string;
|
|
54
|
+
/**
|
|
55
|
+
* profit text color, default is "rgb(0,181,159)"
|
|
56
|
+
*/
|
|
57
|
+
profitColor?: string;
|
|
58
|
+
/**
|
|
59
|
+
* loss text color, default is "rgb(255,103,194)"
|
|
60
|
+
*/
|
|
61
|
+
lossColor?: string;
|
|
62
|
+
/**
|
|
63
|
+
* brand color, default is "rgb(0,181,159)"
|
|
64
|
+
*/
|
|
65
|
+
brandColor?: string;
|
|
66
|
+
};
|
|
67
|
+
type ReferralType = {
|
|
68
|
+
code?: string;
|
|
69
|
+
link?: string;
|
|
70
|
+
slogan?: string;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
declare const useSharePnLScript: (props: {
|
|
74
|
+
pnl?: (SharePnLConfig & SharePnLParams) | undefined;
|
|
75
|
+
hide?: () => void;
|
|
76
|
+
}) => {
|
|
77
|
+
position: any;
|
|
78
|
+
leverage: number | undefined;
|
|
79
|
+
baseDp: any;
|
|
80
|
+
quoteDp: any;
|
|
81
|
+
referralInfo: ReferralType | undefined;
|
|
82
|
+
shareOptions: SharePnLConfig;
|
|
83
|
+
hide: (() => void) | undefined;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
declare const SharePnLBottomSheetWidget: (props: {
|
|
87
|
+
hide?: () => void;
|
|
88
|
+
pnl?: SharePnLConfig & SharePnLParams;
|
|
89
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
90
|
+
declare const SharePnLDialogWidget: (props: {
|
|
91
|
+
hide?: () => void;
|
|
92
|
+
pnl?: SharePnLConfig & SharePnLParams;
|
|
93
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
94
|
+
|
|
95
|
+
declare const SharePnLDialogId = "sharePnLDialog";
|
|
96
|
+
declare const SharePnLBottomSheetId = "sharePnLBottomSheet";
|
|
97
|
+
|
|
98
|
+
export { SharePnLBottomSheetId, SharePnLBottomSheetWidget, type SharePnLConfig, SharePnLDialogId, SharePnLDialogWidget, type SharePnLParams, useSharePnLScript };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var ui = require('@orderly.network/ui');
|
|
4
|
+
var hooks = require('@orderly.network/hooks');
|
|
5
|
+
var p = require('react');
|
|
6
|
+
var utils = require('@orderly.network/utils');
|
|
7
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
8
|
+
var Xe = require('embla-carousel-react');
|
|
9
|
+
|
|
10
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
|
|
12
|
+
function _interopNamespace(e) {
|
|
13
|
+
if (e && e.__esModule) return e;
|
|
14
|
+
var n = Object.create(null);
|
|
15
|
+
if (e) {
|
|
16
|
+
Object.keys(e).forEach(function (k) {
|
|
17
|
+
if (k !== 'default') {
|
|
18
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return e[k]; }
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
n.default = e;
|
|
27
|
+
return Object.freeze(n);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var p__namespace = /*#__PURE__*/_interopNamespace(p);
|
|
31
|
+
var Xe__default = /*#__PURE__*/_interopDefault(Xe);
|
|
32
|
+
|
|
33
|
+
var Y=e=>{let{pnl:t,hide:o}=e,a=t?.position,n=hooks.useSymbolsInfo(),{getFirstRefCode:r}=hooks.useReferralInfo(),l=n[a?.symbol]("base_dp"),i=n[a?.symbol]("quote_dp"),c=p.useMemo(()=>{let s=r()?.code;return {code:t?.refCode??s,slogan:t?.refSlogan,link:t?.refLink}},[r,t]);return {position:a,leverage:t?.leverage,baseDp:l,quoteDp:i,referralInfo:c,shareOptions:t,hide:o}};function Z(e,t,o,a,n,r,l,i,c){let{symbol:s,currency:u}=Ve(e.symbol),h={symbol:s,currency:u,side:e.position_qty>0?"LONG":"SHORT"};switch(n){case"pnl":{"unrealized_pnl"in e&&(h.pnl=new utils.Decimal(e.unrealized_pnl).toFixed(2,utils.Decimal.ROUND_DOWN));break}case"roi":{"unrealized_pnl_ROI"in e&&(h.ROI=new utils.Decimal(e.unrealized_pnl_ROI*100).toFixed(2,utils.Decimal.ROUND_DOWN));break}case"roi_pnl":{"unrealized_pnl"in e&&(h.pnl=new utils.Decimal(e.unrealized_pnl).toFixed(2,utils.Decimal.ROUND_DOWN)),"unrealized_pnl_ROI"in e&&(h.ROI=new utils.Decimal(e.unrealized_pnl_ROI*100).toFixed(2,utils.Decimal.ROUND_DOWN));break}}let v=[];r.has("leverage")&&(h.leverage=t),["openPrice","openTime","markPrice","quantity"].forEach(b=>{if(r.has(b))switch(b){case"leverage":break;case"openPrice":{v.push({title:"Open price",value:te(e.average_open_price,i||2)});break}case"openTime":{v.push({title:"Opened at",value:Qe(e.timestamp)});break}case"markPrice":{v.push({title:"Mark price",value:te(e.mark_price,i||2)});break}case"quantity":v.push({title:"Quantity",value:te(e.position_qty,l||2)});}}),h.informations=v;let S={position:h,updateTime:Ke(new Date),domain:a};return o.length>0&&(S.message=o),typeof c<"u"&&c.code!==void 0&&(S.referral=c),S}function Ve(e){let t=e.split("_");if(t.length!==3)return {symbol:e,currency:"USDC"};let[o,a,n]=t;return {symbol:`${a}-${o}`,currency:n||"USDC"}}function Ke(e){let t=e instanceof Date?e:new Date(e),o={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h24"},n=new Intl.DateTimeFormat("en-US",o).formatToParts(t),r=n.find(u=>u.type==="year"?u.value:"")?.value,l=n.find(u=>u.type==="month"?u.value:"")?.value,i=n.find(u=>u.type==="day"?u.value:"")?.value,c=n.find(u=>u.type==="hour"?u.value:"")?.value,s=n.find(u=>u.type==="minute"?u.value:"")?.value;return `${r}-${l}-${i} ${c}:${s}`}function Qe(e){let t=e instanceof Date?e:new Date(e),o={year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"},n=new Intl.DateTimeFormat("en-US",o).formatToParts(t),r=n.find(s=>s.type==="month"?s.value:"")?.value,l=n.find(s=>s.type==="day"?s.value:"")?.value,i=n.find(s=>s.type==="hour"?s.value:"")?.value,c=n.find(s=>s.type==="minute"?s.value:"")?.value;return `${r}-${l} ${i}:${c}`}function te(e,t){return new utils.Decimal(e).toFixed(t,utils.Decimal.ROUND_DOWN)}function G(e,t,o,a){localStorage.setItem("pnl_config_key",JSON.stringify({bgIndex:o,pnlFormat:e,options:Array.from(t),message:a}));}function X(){let e=localStorage.getItem("pnl_config_key");if(e&&e.length>0)try{return JSON.parse(e)}catch{}return {bgIndex:0,pnlFormat:"roi_pnl",options:["openPrice","openTime","markPrice","quantity","leverage"],message:""}}var W=p.forwardRef((e,t)=>{let{width:o,height:a,className:n,data:r,style:l}=e,{ref:i,download:c,toDataURL:s,copy:u,toBlob:h}=hooks.usePoster(r,{ratio:e.ratio});return p.useImperativeHandle(t,()=>({download:c,toDataURL:s,toBlob:h,copy:u})),jsxRuntime.jsx("canvas",{ref:i,width:o,height:a,className:n,style:l})});var ge=e=>{let{children:t,...o}=e;return jsxRuntime.jsx("button",{...o,children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{width:"20",height:"20",rx:"10",fill:"#333948"}),jsxRuntime.jsx("path",{d:"M11.186 5.348a.67.67 0 0 0-.436.27l-2.657 4a.69.69 0 0 0 0 .75l2.657 4a.68.68 0 0 0 .934.188.685.685 0 0 0 .187-.937L9.463 9.993 11.87 6.37a.685.685 0 0 0-.187-.938.65.65 0 0 0-.498-.083",fill:"#fff",fillOpacity:".54"})]})})},ye=e=>{let{children:t,...o}=e;return jsxRuntime.jsx("button",{...o,children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("rect",{width:"20",height:"20",rx:"10",fill:"#333948"}),jsxRuntime.jsx("path",{d:"M8.777 5.348a.65.65 0 0 0-.498.083.685.685 0 0 0-.187.938L10.5 9.993 8.092 13.62a.685.685 0 0 0 .187.937.68.68 0 0 0 .934-.187l2.657-4a.69.69 0 0 0 0-.75l-2.657-4a.67.67 0 0 0-.436-.271",fill:"#fff",fillOpacity:".54"})]})})};var xe=e=>{let{backgroundImages:t,selectedSnap:o,setSelectedSnap:a}=e,[n,r]=Xe__default.default({containScroll:"keepSnaps",dragFree:!0}),l=p.useCallback(()=>{r&&r.scrollPrev();},[r]),i=p.useCallback(()=>{r&&r.scrollNext();},[r]),c=p.useCallback(s=>{a(s.selectedScrollSnap());},[]);return p.useEffect(()=>{r&&(c(r),r.on("reInit",c),r.on("select",c),r?.scrollTo(o));},[r,c]),jsxRuntime.jsxs(ui.Flex,{mt:4,px:2,children:[jsxRuntime.jsx(ge,{onClick:l}),jsxRuntime.jsx("div",{ref:n,className:"oui-w-full oui-overflow oui-overflow-x-auto oui-scrollbar-hidden oui-hide-scrollbar oui-mx-0",children:jsxRuntime.jsx(ui.Flex,{children:t.map((s,u)=>jsxRuntime.jsx(ui.Box,{onClick:()=>{r?.scrollTo(u);},mx:2,my:1,mr:6,r:"base",className:ui.cn("oui-shrink-0 oui-w-[162px]",o===u&&"oui-outline oui-outline-1 oui-outline-primary"),children:jsxRuntime.jsx("img",{src:s,className:"oui-rounded-sm"})},s))})}),jsxRuntime.jsx(ye,{onClick:i})]})};var Se=e=>{let{type:t,curType:o,setPnlFormat:a}=e,n=p.useMemo(()=>{switch(t){case"roi_pnl":return "ROI & PnL";case"roi":return "ROI";case"pnl":return "PnL"}},[t]),r=t===o,l="oui-flex oui-items-center oui-gap-1 oui-cursor-pointer";return r?l+=" oui-text-base-contrast":l+="",jsxRuntime.jsxs("div",{className:l,onClick:()=>{a(t);},children:[jsxRuntime.jsx(st,{sel:r}),jsxRuntime.jsx(ui.Text,{size:"xs",intensity:54,className:ui.cn("oui-ml-2 "),children:n})]})},st=e=>jsxRuntime.jsx("button",{type:"button",children:e.sel===!0?jsxRuntime.jsx(it,{}):jsxRuntime.jsx(lt,{})}),it=()=>jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"oui-fill-primary",children:[jsxRuntime.jsx("path",{d:"M8.01 1.333a6.667 6.667 0 1 0 0 13.333 6.667 6.667 0 0 0 0-13.333m0 1.333a5.334 5.334 0 1 1-.001 10.667 5.334 5.334 0 0 1 0-10.667",fill:"#fff",fillOpacity:".36"}),jsxRuntime.jsx("circle",{cx:"8",cy:"8",r:"3.333"})]}),lt=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M8.01 1.333a6.667 6.667 0 1 0 0 13.333 6.667 6.667 0 0 0 0-13.333m0 1.333a5.334 5.334 0 1 1-.001 10.667 5.334 5.334 0 0 1 0-10.667",fill:"#fff",fillOpacity:".54"})});var j=e=>{let{size:t=16,className:o}=e;return jsxRuntime.jsx("button",{type:"button",onClick:a=>{e.onCheckedChange(!e.checked);},className:o,children:e.checked?jsxRuntime.jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.66 1.953A2.667 2.667 0 0 0 1.995 4.62v6.667a2.667 2.667 0 0 0 2.667 2.666h6.666a2.667 2.667 0 0 0 2.667-2.666V4.62a2.667 2.667 0 0 0-2.667-2.667zm6.664 2.922a.8.8 0 0 1 .557-.208c.2 0 .406.063.558.208a.734.734 0 0 1 0 1.063l-5.434 5.179a.826.826 0 0 1-1.115 0l-2.33-2.22a.736.736 0 0 1 0-1.063.827.827 0 0 1 1.117 0l1.77 1.687z",fill:"#fff",fillOpacity:".8"})}):jsxRuntime.jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4.66 1.953A2.667 2.667 0 0 0 1.995 4.62v6.667a2.667 2.667 0 0 0 2.667 2.666h6.666a2.667 2.667 0 0 0 2.667-2.666V4.62a2.667 2.667 0 0 0-2.667-2.667zm0 1.334h6.667c.737 0 1.334.596 1.334 1.333v6.667c0 .736-.597 1.333-1.334 1.333H4.661a1.333 1.333 0 0 1-1.334-1.333V4.62c0-.737.597-1.333 1.334-1.333",fill:"#fff",fillOpacity:".8"})})})};var we=e=>{let{type:t,curType:o,setShareOption:a}=e,n=p.useMemo(()=>{switch(t){case"openPrice":return "Open price";case"openTime":return "Opened at";case"markPrice":return "Mark price";case"quantity":return "Quantity";case"leverage":return "Leverage"}},[t]),r=o.has(t);return jsxRuntime.jsxs(ui.Flex,{itemAlign:"center",gap:1,className:ui.cn("hover:oui-cursor-pointer"),onClick:()=>{a(l=>{let i=new Set(l);return r?i.delete(t):i.add(t),i});},children:[jsxRuntime.jsx(j,{size:16,checked:r,className:"oui-pt-[2px]",onCheckedChange:l=>{a(i=>{let c=new Set(i);return r?c.delete(t):c.add(t),c});}}),jsxRuntime.jsx(ui.Text,{size:"xs",intensity:54,children:n})]})};var Ne=e=>{let{message:t,setMessage:o,check:a,setCheck:n}=e,[r,l]=p.useState(!1),i=p.useRef(null);return jsxRuntime.jsxs("div",{className:"oui-mt-3 oui-mb-6 oui-flex oui-items-center",children:[jsxRuntime.jsx(j,{className:"oui-mt-[2px]",checked:a,onCheckedChange:c=>{n(c);}}),jsxRuntime.jsx("div",{className:"oui-text-xs oui-text-base-contrast-54 oui-ml-1 hover:oui-cursor-pointer",onClick:()=>{n(!e.check);},children:"Your message"}),jsxRuntime.jsx("div",{className:"oui-bg-base-900 oui-mx-2 oui-rounded-sm",children:jsxRuntime.jsx(ui.Input,{ref:i,placeholder:"Max 25 characters",classNames:{root:"oui-w-[320px]"},size:"sm",value:t,autoFocus:!1,suffix:r&&jsxRuntime.jsx("button",{className:"oui-mr-3 oui-cursor-pointer",onMouseDown:c=>{o(""),setTimeout(()=>{i.current?.focus();},50),c.stopPropagation();},children:jsxRuntime.jsx(ui.CloseCircleFillIcon,{size:18,color:"white"})}),onFocus:()=>l(!0),onBlur:()=>l(!1),onChange:c=>{if(c.target.value.length>25){ui.toast.error("Maximum support of 25 characters");return}n(c.target.value.length>0),o(c.target.value);}})})]})};var De=e=>{let{onClickDownload:t,onClickCopy:o}=e;return jsxRuntime.jsxs(ui.Flex,{px:8,gap:3,mt:3,itemAlign:"center",children:[jsxRuntime.jsxs(ui.Button,{color:"secondary",className:"oui-flex-1 oui-flex oui-gap-1",onClick:t,children:[jsxRuntime.jsx("span",{children:jsxRuntime.jsx(St,{})}),"Download"]}),jsxRuntime.jsxs(ui.Button,{className:"oui-flex-1 oui-flex oui-gap-1",onClick:o,children:[jsxRuntime.jsx("span",{children:jsxRuntime.jsx(bt,{})}),"Copy"]})]})},St=()=>jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M4.66 1.994A2.667 2.667 0 0 0 1.995 4.66v6.666a2.667 2.667 0 0 0 2.667 2.667h6.666a2.667 2.667 0 0 0 2.667-2.667V4.661a2.667 2.667 0 0 0-2.667-2.667zM7.995 4.66c.368 0 .667.298.667.666V8.66h2l-2.667 2.666L5.328 8.66h2V5.327c0-.368.299-.667.667-.667",fill:"#fff",fillOpacity:".98"})}),bt=()=>jsxRuntime.jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{d:"M5.166 1.994A2.667 2.667 0 0 0 2.499 4.66v4a2.667 2.667 0 0 0 2.667 2.667 2.667 2.667 0 0 0 2.666 2.667h4a2.667 2.667 0 0 0 2.667-2.667v-4a2.667 2.667 0 0 0-2.667-2.667 2.667 2.667 0 0 0-2.666-2.666zm6.666 4c.737 0 1.334.596 1.334 1.333v4c0 .737-.597 1.334-1.334 1.334h-4A1.333 1.333 0 0 1 6.5 11.327h2.667a2.667 2.667 0 0 0 2.666-2.667z",fill:"#fff",fillOpacity:".98"})});var Oe=e=>{let{shareOptions:t}=e,o=X(),[a,n]=p.useState(o.pnlFormat),[r,l]=p.useState(new Set(o.options)),[i,c]=p.useState(o.bgIndex),[s,u]=p.useState(o.message),[h,v]=p.useState(!1),{backgroundImages:M,...S}=t??{backgroundImages:[]},[b,I]=p.useState(""),C=p.useRef(null);p.useEffect(()=>{let w=window.location.hostname;I(w);},[]);let P=p.useMemo(()=>t?.backgroundImages[i],[t?.backgroundImages,i]),O=Z(e.position,e.leverage,h?s:"",b,a,r,e.baseDp,e.quoteDp,e.referral),R=()=>{C.current?.copy().then(()=>{e.hide?.(),ui.toast.success("Image copied");}).catch(w=>{ui.toast.error(()=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{children:"Copy failed"}),jsxRuntime.jsx("div",{className:"oui-text-2xs oui-max-w-[396px] oui-mt-2 oui-text-base-contrast-54",children:"Browser version outdated, please update in order to copy image to clipboard."})]}));});},z=()=>{C.current?.download("Poster.png"),e.hide?.();},g=["roi_pnl","roi","pnl"],ee=["openPrice","markPrice","openTime","leverage","quantity"];return G(a,r,i,s),jsxRuntime.jsxs("div",{className:"oui-h-full oui-flex oui-flex-col oui-relative oui-w-full",children:[jsxRuntime.jsxs("div",{className:"oui-flex-1 oui-h-full oui-overflow-y-auto",children:[jsxRuntime.jsxs(ui.Box,{mt:9,height:422,children:[jsxRuntime.jsx(ui.Flex,{itemAlign:"center",justify:"center",children:jsxRuntime.jsx(W,{width:552,height:310,data:{backgroundImg:P,...S,data:O},ratio:3,ref:C})}),jsxRuntime.jsx(xe,{backgroundImages:t?.backgroundImages??[],selectedSnap:i,setSelectedSnap:c})]}),jsxRuntime.jsxs(ui.Flex,{direction:"column",px:10,mt:6,justify:"start",itemAlign:"start",width:"100%",children:[jsxRuntime.jsx(ui.Text,{size:"sm",intensity:80,children:"PnL display format"}),jsxRuntime.jsx(ui.Flex,{pt:3,gap:3,itemAlign:"center",children:g.map(w=>jsxRuntime.jsx(Se,{setPnlFormat:n,type:w,curType:a}))}),jsxRuntime.jsx(ui.Divider,{className:"oui-w-full oui-pt-6 oui-border-white/10"}),jsxRuntime.jsxs(ui.Flex,{mt:6,direction:"column",justify:"start",itemAlign:"start",children:[jsxRuntime.jsx(ui.Text,{size:"sm",intensity:80,children:"Optional information to share"}),jsxRuntime.jsx(ui.Flex,{mt:3,gap:4,children:ee.map(w=>jsxRuntime.jsx(we,{setShareOption:l,type:w,curType:r}))})]}),jsxRuntime.jsx(Ne,{message:s,setMessage:u,check:h,setCheck:v})]})]}),jsxRuntime.jsx(De,{onClickCopy:R,onClickDownload:z}),jsxRuntime.jsx("button",{onClick:()=>{e.hide();},className:"oui-absolute oui-top-0 oui-right-0 oui-w-[40px] oui-h-[40px] oui-flex oui-justify-center oui-items-center",children:jsxRuntime.jsx(ui.CloseIcon,{size:12,className:"oui-fill-base-contrast-54"})})]})};var Fe=p__namespace.createContext(null);function T(){let e=p__namespace.useContext(Fe);if(!e)throw new Error("useCarousel must be used within a <Carousel />");return e}var ne=p__namespace.forwardRef(({orientation:e="horizontal",opts:t,setApi:o,plugins:a,className:n,children:r,...l},i)=>{let[c,s]=Xe__default.default({...t,axis:e==="horizontal"?"x":"y"},a),[u,h]=p__namespace.useState(!1),[v,M]=p__namespace.useState(!1),[S,b]=p__namespace.useState(l.initIndex||0),[I,C]=p__namespace.useState([]),P=p__namespace.useCallback(g=>{g&&(I.length===0&&C(g.scrollSnapList()),b(g.selectedScrollSnap()),h(g.canScrollPrev()),M(g.canScrollNext()));},[I]),O=p__namespace.useCallback(()=>{s?.scrollPrev();},[s]),R=p__namespace.useCallback(()=>{s?.scrollNext();},[s]),z=p__namespace.useCallback(g=>{g.key==="ArrowLeft"?(g.preventDefault(),O()):g.key==="ArrowRight"&&(g.preventDefault(),R());},[O,R]);return p__namespace.useEffect(()=>{!s||!o||o(s);},[s,o]),p__namespace.useEffect(()=>{if(s)return P(s),s.on("reInit",P),s.on("select",P),l.initIndex&&s.scrollTo(l.initIndex),()=>{s?.off("select",P);}},[s,P]),jsxRuntime.jsx(Fe.Provider,{value:{carouselRef:c,api:s,opts:t,orientation:e||(t?.axis==="y"?"vertical":"horizontal"),scrollPrev:O,scrollNext:R,canScrollPrev:u,canScrollNext:v,selectedIndex:S,scrollSnaps:I},children:jsxRuntime.jsx("div",{ref:i,onKeyDownCapture:z,className:ui.cn("oui-relative",n),role:"region","aria-roledescription":"carousel",...l,children:r})})});ne.displayName="Carousel";var K=p__namespace.forwardRef(({className:e,...t},o)=>{let{carouselRef:a,orientation:n}=T();return jsxRuntime.jsx("div",{ref:a,className:"oui-overflow-hidden",children:jsxRuntime.jsx("div",{ref:o,className:ui.cn("oui-flex",n==="horizontal"?"oui--ml-4":"oui--mt-4 oui-flex-col",e),...t})})});K.displayName="CarouselContent";var Q=p__namespace.forwardRef(({className:e,...t},o)=>{let{orientation:a}=T();return jsxRuntime.jsx("div",{ref:o,role:"group","aria-roledescription":"slide",className:ui.cn("oui-min-w-0 oui-shrink-0 oui-grow-0 oui-basis-full",a==="horizontal"?"oui-pl-4":"oui-pt-4",e),...t})});Q.displayName="CarouselItem";var ae=p__namespace.forwardRef(({className:e,variant:t="contained",size:o="icon",...a},n)=>{let{orientation:r,scrollPrev:l,canScrollPrev:i}=T();return jsxRuntime.jsxs(ui.Button,{ref:n,variant:t,className:ui.cn("oui-absolute oui-h-8 oui-w-8 oui-rounded-full",r==="horizontal"?"oui--left-12 oui-top-1/2 oui--translate-y-1/2":"oui--top-12 oui-left-1/2 oui--translate-x-1/2 oui-rotate-90",e),disabled:!i,onClick:l,...a,children:[jsxRuntime.jsx(ChevronLeft,{size:20}),jsxRuntime.jsx("span",{className:"oui-sr-only",children:"Previous slide"})]})});ae.displayName="CarouselPrevious";var se=p__namespace.forwardRef(({className:e,variant:t="contained",size:o="icon",...a},n)=>{let{orientation:r,scrollNext:l,canScrollNext:i}=T();return jsxRuntime.jsxs(ui.Button,{ref:n,variant:t,className:ui.cn("oui-absolute oui-h-8 oui-w-8 oui-rounded-full",r==="horizontal"?"oui--right-12 oui-top-1/2 oui--translate-y-1/2":"oui--bottom-12 oui-left-1/2 oui--translate-x-1/2 oui-rotate-90",e),disabled:!i,onClick:l,...a,children:[jsxRuntime.jsx(ChevronRight,{size:20}),jsxRuntime.jsx("span",{className:"oui-sr-only",children:"Next slide"})]})});se.displayName="CarouselNext";var ie=e=>{let{scrollSnaps:t,selectedIndex:o}=T();return jsxRuntime.jsx("div",{className:ui.cn("oui-flex oui-gap-1",e.className),children:t.map((a,n)=>jsxRuntime.jsx(le,{index:n,active:n===o,onClick:e.onClick,className:e.dotClassName,activeClassName:e.dotActiveClassName},n))})};ie.displayName="CarouselIdentifier";var le=({index:e,active:t,onClick:o,className:a,activeClassName:n})=>jsxRuntime.jsx("button",{onClick:()=>o?.(e),className:ui.cn("oui-w-2 oui-h-2 oui-rounded-full oui-bg-white/30",a,t&&`active ${n||"oui-bg-primary"}`)});var B=ne;B.Content=K;B.Item=Q;B.Next=se;B.Previous=ae;B.indentify=ie;var Me=e=>{let{shareOptions:t}=e,o=X(),[a,n]=p.useState(o.pnlFormat),[r,l]=p.useState(new Set(o.options)),[i,c]=p.useState(o.message),[s,u]=p.useState(o.bgIndex),{backgroundImages:h,...v}=t??{backgroundImages:[]},[M,S]=p.useState(""),b=t?.backgroundImages.map(()=>p.useRef(null));p.useEffect(()=>{let d=window.location.hostname;S(d);},[]);let I=Z(e.position,e.leverage,i,M,a,r,e.baseDp,e.quoteDp,e.referral),C=p.useRef(),P=552/310,[O,R]=p.useState(1),[z,g]=p.useState(0),[ee,w]=p.useState(!1),he=p.useRef(null);p.useEffect(()=>{if(C.current){let d=C.current.offsetWidth,_=d/P;g(_),R(d/552);}},[C,M]);let He=async d=>{if(!d.current)return;let _=d.current?.toDataURL(),qe=Mt(_);try{navigator.share&&await navigator.share({text:i,files:[new File([qe],"image.png",{type:"image/png"})]}),e.hide?.();}catch{}};return G(a,r,s,i),jsxRuntime.jsxs("div",{className:"oui-w-full",children:[jsxRuntime.jsx("div",{ref:C,className:"oui-w-full oui-mt-4 oui-overflow-hidden",style:{height:`${z+20}px`},children:jsxRuntime.jsxs(B,{className:"oui-w-full oui-overflow-hidden",opts:{align:"start"},initIndex:s,children:[jsxRuntime.jsx(K,{style:{height:`${z}px`},children:t?.backgroundImages.map((d,_)=>jsxRuntime.jsx(Q,{children:jsxRuntime.jsx(W,{className:"oui-transform oui-origin-top-left",style:{scale:`${O}`},width:552,height:310,data:{backgroundImg:d,...v,data:I},ratio:3,ref:b?.[_]})},_))}),jsxRuntime.jsx("div",{className:"oui-mt-2 oui-mb-1 oui-flex oui-justify-center",children:jsxRuntime.jsx(zt,{dotClassName:"oui-w-[16px] oui-h-[4px] oui-bg-base-300",dotActiveClassName:"!oui-bg-primary oui-w-[20px]",setSelectIndex:u})})]})}),jsxRuntime.jsxs(ui.ScrollArea,{className:"oui-max-h-[200px] oui-overflow-y-auto",children:[jsxRuntime.jsxs("div",{className:"oui-mt-4",children:[jsxRuntime.jsx("div",{className:"oui-text-3xs oui-text-base-contrast-54",children:"PnL display format"}),jsxRuntime.jsxs("div",{className:"oui-pt-3 oui-px-1 oui-flex oui-justify-between oui-gap-3",children:[jsxRuntime.jsx(ue,{setPnlFormat:n,type:"roi_pnl",curType:a}),jsxRuntime.jsx(ue,{setPnlFormat:n,type:"roi",curType:a}),jsxRuntime.jsx(ue,{setPnlFormat:n,type:"pnl",curType:a})]})]}),jsxRuntime.jsxs("div",{className:"oui-mt-3",children:[jsxRuntime.jsx("div",{className:"oui-text-3xs oui-text-base-contrast-54 oui-h-[18px]",children:"Optional information to share"}),jsxRuntime.jsxs("div",{className:"oui-flex oui-flex-wrap oui-gap-3 oui-mt-3",children:[jsxRuntime.jsx(J,{setShareOption:l,type:"openPrice",curType:r}),jsxRuntime.jsx(J,{setShareOption:l,type:"openTime",curType:r}),jsxRuntime.jsx(J,{setShareOption:l,type:"leverage",curType:r}),jsxRuntime.jsx(J,{setShareOption:l,type:"markPrice",curType:r}),jsxRuntime.jsx(J,{setShareOption:l,type:"quantity",curType:r})]})]}),jsxRuntime.jsxs("div",{className:"oui-mt-3 oui-mb-8",children:[jsxRuntime.jsx("div",{className:"oui-text-3xs oui-text-base-contrast-54 oui-h-[18px]",children:"Your message"}),jsxRuntime.jsx("div",{className:"oui-mt-3 oui-h-[48px] oui-bg-base-600 oui-mx-1",children:jsxRuntime.jsx(ui.Input,{placeholder:"Max 25 characters",containerClassName:"oui-bg-transparent oui-h-[48px]",value:i,autoFocus:!1,onChange:d=>{if(d.target.value.length>25){ui.toast.error("Maximum support of 25 characters");return}c(d.target.value);},ref:he,onFocus:()=>w(!0),onBlur:()=>w(!1),suffix:ee&&jsxRuntime.jsx("button",{className:"oui-mr-3 oui-cursor-pointer",onMouseDown:d=>{c(""),setTimeout(()=>{he.current?.focus();},50),d.stopPropagation();},children:jsxRuntime.jsx(ui.CloseCircleFillIcon,{size:18,color:"white"})})})})]})]}),jsxRuntime.jsx("div",{className:"oui-pt-2",children:jsxRuntime.jsx(ui.Button,{fullWidth:!0,className:"oui-h-[40px] oui-text-[16px]",onClick:()=>{let d=b?.[s];d&&He(d);},children:"Share"})})]})},ue=e=>{let{type:t,curType:o,setPnlFormat:a}=e,n=p.useMemo(()=>{switch(t){case"roi_pnl":return "ROI & PnL";case"roi":return "ROI";case"pnl":return "PnL"}},[t]);return jsxRuntime.jsx("div",{className:ui.cn("oui-shadow-lg oui-rounded-lg oui-h-[46px] oui-flex-1 oui-bg-base-4 hover:oui-cursor-pointer oui-flex oui-items-center oui-px-3 oui-referral-shadow",t===o&&"oui-bg-primary oui-dot-sel"),onClick:()=>{a(t);},children:jsxRuntime.jsx("div",{className:"oui-text-sm oui-text-base-contrast",children:n})})},J=e=>{let{type:t,curType:o,setShareOption:a}=e,n=p.useMemo(()=>{switch(t){case"openPrice":return "Open price";case"openTime":return "Opened at";case"markPrice":return "Mark price";case"quantity":return "Quantity";case"leverage":return "Leverage"}},[t]),r=o.has(t);return jsxRuntime.jsxs("div",{className:ui.cn("oui-shadow-lg oui-rounded-lg oui-h-[46px] oui-mt-0 oui-w-[calc(50%-6px)] oui-bg-base-4 hover:oui-cursor-pointer oui-items-center oui-flex oui-p-3 oui-referral-shadow"),onClick:()=>{a(l=>{let i=new Set(l);return r?i.delete(t):i.add(t),i});},children:[jsxRuntime.jsx("div",{className:"oui-text-sm oui-flex-1 oui-text-base-contrast",children:n}),r&&jsxRuntime.jsx(_t,{})]})};function Mt(e){let t=atob(e.split(",")[1]),o=e.split(",")[0].split(":")[1].split(";")[0],a=new ArrayBuffer(t.length),n=new Uint8Array(a);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return new Blob([a],{type:o})}var zt=e=>{let{scrollSnaps:t,selectedIndex:o}=T();return p.useEffect(()=>{e.setSelectIndex(o);},[o]),jsxRuntime.jsx("div",{className:ui.cn("oui-flex oui-gap-1"),children:t.map((a,n)=>jsxRuntime.jsx(le,{index:n,active:n===o,onClick:e.onClick,className:e.dotClassName,activeClassName:e.dotActiveClassName},n))})},_t=()=>jsxRuntime.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.01416 11.9989C2.01416 6.47589 6.49136 1.9989 12.0142 1.9989C17.5372 1.9989 22.0142 6.47589 22.0142 11.9989C22.0142 17.5219 17.5372 21.9989 12.0142 21.9989C6.49136 21.9989 2.01416 17.5219 2.01416 11.9989ZM16.9853 7.31211C17.2125 7.09537 17.5236 7 17.8218 7C18.1201 7 18.4312 7.09537 18.6583 7.31211C19.1139 7.74546 19.1139 8.47384 18.6583 8.9072L10.5077 16.675C10.0534 17.1083 9.28909 17.1083 8.83472 16.675L5.34077 13.3459C4.88641 12.9126 4.88641 12.1841 5.34077 11.7508C5.79631 11.3175 6.56057 11.3175 7.01493 11.7508L9.67122 14.2822L16.9853 7.31211Z",fill:"white","fill-opacity":"1"})});var ze=e=>{let{leverage:t,position:o,baseDp:a,quoteDp:n,referralInfo:r,shareOptions:l,hide:i}=e,[c,s]=p.useState(window.innerHeight<900?660:807);return p.useEffect(()=>{let u=()=>{s(window.innerHeight<900?660:807);};return window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u);}},[]),jsxRuntime.jsx(Oe,{position:o,leverage:`${t}`,hide:i,baseDp:a,quoteDp:n,referral:r,shareOptions:l})},_e=e=>{let{leverage:t,position:o,baseDp:a,quoteDp:n,referralInfo:r,shareOptions:l,hide:i}=e;return jsxRuntime.jsx(Me,{position:o,leverage:t,hide:i,baseDp:a,quoteDp:n,referral:r,shareOptions:l})};var de=e=>{let t=Y({hide:e.hide,pnl:e.pnl});return jsxRuntime.jsx(_e,{...t})},fe=e=>{let t=Y({hide:e.hide,pnl:e.pnl});return jsxRuntime.jsx(ze,{...t})};var Ut="sharePnLDialog",Wt="sharePnLBottomSheet";ui.registerSimpleDialog(Ut,fe,{contentClassName:"!oui-max-w-[624px] oui-p-0"});ui.registerSimpleSheet(Wt,de,{title:"Share PnL"});
|
|
34
|
+
|
|
35
|
+
exports.SharePnLBottomSheetId = Wt;
|
|
36
|
+
exports.SharePnLBottomSheetWidget = de;
|
|
37
|
+
exports.SharePnLDialogId = Ut;
|
|
38
|
+
exports.SharePnLDialogWidget = fe;
|
|
39
|
+
exports.useSharePnLScript = Y;
|
|
40
|
+
//# sourceMappingURL=out.js.map
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/sharePnL/sharePnL.script.tsx","../src/sharePnL/sharePnL.ui.tsx","../src/sharePnL/desktop/content.tsx","../src/sharePnL/utils/utils.tsx","../src/sharePnL/poster/poster.tsx","../src/sharePnL/desktop/carousel.tsx","../src/sharePnL/desktop/buttons.tsx","../src/sharePnL/desktop/pnlFormat.tsx","../src/sharePnL/desktop/options.tsx","../src/sharePnL/desktop/checkbox.tsx","../src/sharePnL/desktop/message.tsx","../src/sharePnL/desktop/bottomBtns.tsx","../src/sharePnL/mobile/content.tsx","../src/sharePnL/carousel/carousel.tsx","../src/sharePnL/carousel/index.tsx","../src/sharePnL/sharePnL.widget.tsx"],"names":["registerSimpleDialog","registerSimpleSheet","useReferralInfo","useSymbolsInfo","useMemo","useSharePnLScript","props","pnl","hide","position","symbolInfo","getFirstRefCode","base_dp","quote_dp","referralInfo","code","useEffect","useState","useRef","Decimal","getPnLPosterData","leverage","message","domain","pnlType","options","baseDp","quoteDp","referral","symbol","currency","processSymbol","positionData","informations","key","formatFixed","formatOpenTime","data","formatShareTime","tokens","symbol1","symbol2","symbol3","input","date","formattedParts","year","part","month","day","hour","minute","value","dp","savePnlInfo","format","bgIndex","getPnlInfo","str","CloseIcon","Divider","Flex","toast","Text","Box","usePoster","forwardRef","useImperativeHandle","jsx","Poster","parentRef","width","height","className","style","ref","download","toDataURL","copy","toBlob","useEmblaCarousel","useCallback","jsxs","PrevButton","children","restProps","NextButton","cn","CarouselBackgroundImage","backgroundImages","selectedSnap","setSelectedSnap","emblaRef","emblaApi","onPrevButtonClick","onNextButtonClick","onSelect","e","index","PnlFormatView","type","curType","setPnlFormat","text","isSelected","clsName","RadioButton","SelIcon","UnselIcon","Checkbox","size","ShareOption","setShareOption","updateSet","checked","CloseCircleFillIcon","Input","Message","setMessage","check","setCheck","focus","setFocus","inputRef","Button","BottomButtons","onClickDownload","onClickCopy","DownloadIcon","CopyIcon","DesktopSharePnLContent","shareOptions","localPnlConfig","pnlFormat","shareOption","resetOptions","setDomain","posterRef","currentDomain","curBgImg","posterData","onCopy","onDownload","formats","item","ScrollArea","React","CarouselContext","useCarousel","context","Carousel","orientation","opts","setApi","plugins","carouselRef","api","canScrollPrev","setCanScrollPrev","canScrollNext","setCanScrollNext","selectedIndex","setSelectedIndex","scrollSnaps","setScrollSnaps","scrollPrev","scrollNext","handleKeyDown","event","CarouselContent","CarouselItem","CarouselPrevious","variant","CarouselNext","CarouselIdentifier","_","Dot","active","onClick","activeClassName","MobileSharePnLContent","selectIndex","setSelectIndex","posterRefs","aspectRatio","scale","setScale","carouselHeight","setCarouselHeight","divWidth","divHeight","onSharePnL","blob","dataURItoBlob","MyIdentifier","ChoicesFillIcon","dataURI","byteString","mimeString","ab","ia","i","DesktopSharePnL","viewportHeight","setViewportHeight","handleResize","MobileSharePnL","SharePnLBottomSheetWidget","state","SharePnLDialogWidget","SharePnLDialogId","SharePnLBottomSheetId"],"mappings":"AAAA,OAAS,wBAAAA,GAAsB,uBAAAC,OAA2B,sBCA1D,OAAS,mBAAAC,GAAiB,kBAAAC,OAAsB,yBAChD,OAAS,WAAAC,OAAe,QAGjB,IAAMC,EAAqBC,GAG5B,CACJ,GAAM,CAAE,IAAAC,EAAK,KAAAC,CAAK,EAAIF,EAChBG,EAAWF,GAAK,SAChBG,EAAaP,GAAe,EAC5B,CAAE,gBAAAQ,CAAgB,EAAIT,GAAgB,EACtCU,EAAUF,EAAWD,GAAU,MAAM,EAAE,SAAS,EAChDI,EAAWH,EAAWD,GAAU,MAAM,EAAE,UAAU,EAElDK,EAAeV,GAAQ,IAAgC,CAC3D,IAAMW,EAAOJ,EAAgB,GAAG,KAOhC,MANa,CACX,KAAMJ,GAAK,SAAWQ,EACtB,OAAQR,GAAK,UACb,KAAMA,GAA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BAE9BnN,GAAqBkN,GAAkBD,GAAsB,CAG3D,iBAAkB,4BACpB,CAAC,EAEDhN,GAAoBkN,GAAuBJ,GAA2B,CACpE,MAAO,WACT,CAAC","sourcesContent":["import { registerSimpleDialog, registerSimpleSheet } from \"@orderly.network/ui\";\nimport {\n SharePnLDialogWidget,\n SharePnLBottomSheetWidget,\n} from \"./sharePnL/sharePnL.widget\";\n\nconst SharePnLDialogId = \"sharePnLDialog\";\nconst SharePnLBottomSheetId = \"sharePnLBottomSheet\";\n\nregisterSimpleDialog(SharePnLDialogId, SharePnLDialogWidget, {\n // title: \"Max account leverage\",\n // size: \"2xl\",\n contentClassName: \"!oui-max-w-[624px] oui-p-0\",\n});\n\nregisterSimpleSheet(SharePnLBottomSheetId, SharePnLBottomSheetWidget, {\n title: \"Share PnL\",\n});\n\nexport * from \"./sharePnL\";\nexport { SharePnLDialogId, SharePnLBottomSheetId };\nexport type { SharePnLConfig, SharePnLParams } from \"./types/types\";\n","import { useReferralInfo, useSymbolsInfo } from \"@orderly.network/hooks\";\nimport { useMemo } from \"react\";\nimport { ReferralType, SharePnLConfig, SharePnLParams } from \"../types/types\";\n\nexport const useSharePnLScript = (props: {\n pnl?: (SharePnLConfig & SharePnLParams) | undefined;\n hide?: () => void;\n}) => {\n const { pnl, hide } = props;\n const position = pnl?.position;\n const symbolInfo = useSymbolsInfo();\n const { getFirstRefCode } = useReferralInfo();\n const base_dp = symbolInfo[position?.symbol](\"base_dp\");\n const quote_dp = symbolInfo[position?.symbol](\"quote_dp\");\n\n const referralInfo = useMemo((): ReferralType | undefined => {\n const code = getFirstRefCode()?.code;\n const info = {\n code: pnl?.refCode ?? code,\n slogan: pnl?.refSlogan,\n link: pnl?.refLink,\n };\n\n return info;\n }, [getFirstRefCode, pnl]);\n return {\n position,\n leverage: pnl?.leverage,\n baseDp:base_dp,\n quoteDp:quote_dp,\n referralInfo,\n shareOptions: pnl as SharePnLConfig,\n hide,\n };\n};\n\nexport type SharePnLState = ReturnType<typeof useSharePnLScript>;\n","import { FC, PropsWithChildren, useEffect, useState } from \"react\";\nimport { Box } from \"@orderly.network/ui\";\nimport { SharePnLState } from \"./sharePnL.script\";\nimport { DesktopSharePnLContent } from \"./desktop/content\";\nimport { MobileSharePnLContent } from \"./mobile/content\";\n\nexport const DesktopSharePnL: FC<SharePnLState> = (props) => {\n const {\n leverage,\n position,\n baseDp,\n quoteDp,\n referralInfo,\n shareOptions,\n hide,\n } = props;\n\n const [viewportHeight, setViewportHeight] = useState(\n window.innerHeight < 900 ? 660 : 807\n );\n\n useEffect(() => {\n const handleResize = () => {\n setViewportHeight(window.innerHeight < 900 ? 660 : 807);\n };\n\n window.addEventListener(\"resize\", handleResize);\n\n return () => {\n window.removeEventListener(\"resize\", handleResize);\n };\n }, []);\n return (\n <DesktopSharePnLContent\n position={position}\n leverage={`${leverage}`}\n hide={hide}\n baseDp={baseDp}\n quoteDp={quoteDp}\n referral={referralInfo}\n shareOptions={shareOptions}\n />\n );\n};\n\nexport const MobileSharePnL: FC<SharePnLState> = (props) => {\n const {\n leverage,\n position,\n baseDp,\n quoteDp,\n referralInfo,\n shareOptions,\n hide,\n } = props;\n\n return (\n <MobileSharePnLContent\n position={position}\n leverage={leverage}\n hide={hide}\n baseDp={baseDp}\n quoteDp={quoteDp}\n referral={referralInfo}\n shareOptions={shareOptions}\n />\n );\n};\n","import { FC, useEffect, useMemo, useRef, useState } from \"react\";\nimport {\n PnLDisplayFormat,\n ReferralType,\n ShareOptions,\n SharePnLConfig,\n} from \"../../types/types\";\nimport { getPnlInfo, getPnLPosterData, savePnlInfo } from \"../utils/utils\";\nimport { CloseIcon, Divider, Flex, toast, Text, Box } from \"@orderly.network/ui\";\nimport { Poster } from \"../poster\";\nimport { CarouselBackgroundImage } from \"./carousel\";\nimport { PnlFormatView } from \"./pnlFormat\";\nimport { ShareOption } from \"./options\";\nimport { Message } from \"./message\";\nimport { BottomButtons } from \"./bottomBtns\";\nimport { PosterRef } from \"../poster/poster\";\n\nexport const DesktopSharePnLContent: FC<{\n position: any;\n leverage: number | string;\n hide: any;\n baseDp?: number;\n quoteDp?: number;\n referral?: ReferralType;\n shareOptions: SharePnLConfig;\n}> = (props) => {\n const { shareOptions } = props;\n const localPnlConfig = getPnlInfo();\n\n const [pnlFormat, setPnlFormat] = useState<PnLDisplayFormat>(\n localPnlConfig.pnlFormat\n );\n const [shareOption, setShareOption] = useState<Set<ShareOptions>>(\n new Set(localPnlConfig.options)\n );\n const [selectedSnap, setSelectedSnap] = useState(localPnlConfig.bgIndex);\n const [message, setMessage] = useState(localPnlConfig.message);\n const [check, setCheck] = useState(false);\n // const { shareOptions } = useTradingPageContext();\n const { backgroundImages, ...resetOptions } = shareOptions ?? {\n backgroundImages: [],\n };\n\n const [domain, setDomain] = useState(\"\");\n\n const posterRef = useRef<PosterRef | null>(null);\n\n useEffect(() => {\n const currentDomain = window.location.hostname;\n setDomain(currentDomain);\n }, []);\n\n const curBgImg = useMemo(() => {\n return shareOptions?.backgroundImages[selectedSnap];\n }, [shareOptions?.backgroundImages, selectedSnap]);\n\n const posterData = getPnLPosterData(\n props.position,\n props.leverage,\n check ? message : \"\",\n domain,\n pnlFormat,\n shareOption,\n props.baseDp,\n props.quoteDp,\n props.referral\n );\n\n console.log(\"posterData is\", posterData);\n\n const onCopy = () => {\n posterRef.current\n ?.copy()\n .then(() => {\n props.hide?.();\n toast.success(\"Image copied\");\n })\n .catch((e: any) => {\n toast.error(() => {\n return (\n <div>\n <div>Copy failed</div>\n <div className=\"oui-text-2xs oui-max-w-[396px] oui-mt-2 oui-text-base-contrast-54\">\n Browser version outdated, please update in order to copy image\n to clipboard.\n </div>\n </div>\n );\n });\n });\n };\n const onDownload = () => {\n posterRef.current?.download(\"Poster.png\");\n props.hide?.();\n };\n\n const formats: PnLDisplayFormat[] = [\"roi_pnl\", \"roi\", \"pnl\"];\n const options: ShareOptions[] = [\n \"openPrice\",\n \"markPrice\",\n \"openTime\",\n \"leverage\",\n \"quantity\",\n ];\n\n savePnlInfo(pnlFormat, shareOption, selectedSnap, message);\n\n return (\n <div className=\"oui-h-full oui-flex oui-flex-col oui-relative oui-w-full\">\n <div className=\"oui-flex-1 oui-h-full oui-overflow-y-auto\">\n <Box mt={9} height={422} >\n <Flex itemAlign={\"center\"} justify={\"center\"}>\n <Poster\n // className=\"oui-mx-11\"\n width={552}\n height={310}\n data={{\n backgroundImg: curBgImg,\n ...resetOptions,\n data: posterData,\n }}\n ratio={3}\n ref={posterRef}\n />\n </Flex>\n <CarouselBackgroundImage\n backgroundImages={shareOptions?.backgroundImages ?? []}\n selectedSnap={selectedSnap}\n setSelectedSnap={setSelectedSnap}\n />\n </Box>\n\n <Flex\n direction={\"column\"}\n px={10}\n mt={6}\n justify={\"start\"}\n itemAlign={\"start\"}\n width={\"100%\"}\n >\n <Text size=\"sm\" intensity={80}>\n PnL display format\n </Text>\n <Flex pt={3} gap={3} itemAlign={\"center\"}>\n {formats.map((e) => (\n <PnlFormatView\n setPnlFormat={setPnlFormat}\n type={e}\n curType={pnlFormat}\n />\n ))}\n </Flex>\n\n <Divider className=\"oui-w-full oui-pt-6 oui-border-white/10\" />\n\n <Flex\n mt={6}\n direction={\"column\"}\n justify={\"start\"}\n itemAlign={\"start\"}\n >\n <Text size=\"sm\" intensity={80}>\n Optional information to share\n </Text>\n <Flex mt={3} gap={4}>\n {options.map((item) => (\n <ShareOption\n setShareOption={setShareOption}\n type={item}\n curType={shareOption}\n />\n ))}\n </Flex>\n </Flex>\n\n <Message\n message={message}\n setMessage={setMessage}\n check={check}\n setCheck={setCheck}\n />\n </Flex>\n </div>\n\n <BottomButtons onClickCopy={onCopy} onClickDownload={onDownload} />\n\n <button\n onClick={() => {\n props.hide();\n }}\n className=\"oui-absolute oui-top-0 oui-right-0 oui-w-[40px] oui-h-[40px] oui-flex oui-justify-center oui-items-center\"\n >\n <CloseIcon size={12} className=\"oui-fill-base-contrast-54\" />\n </button>\n </div>\n );\n};\n","/*\n{\n message: \"I am the Orderly KING.\",\n domain: \"ordely.network\",\n updateTime: \"2022-JAN-01 23:23\",\n position: {\n symbol: \"BTC-PERP\",\n currency: \"USDC\",\n side: \"LONG\",\n leverage: 20,\n pnl: 10432.23,\n ROI: 20.25,\n informations: [\n { title: \"Open Price\", value: 0.12313 },\n { title: \"Opened at\", value: \"Jan-01 23:23\" },\n { title: \"Mark price\", value: \"0.12341\" },\n { title: \"Quantity\", value: \"0.123\" },\n ],\n },\n referral: {\n code: \"WRECKED\",\n link: \"https://orderly.network\",\n slogan: \"Try Orderly now with:\",\n }\n }\n*/\n\nimport { Decimal } from \"@orderly.network/utils\";\nimport { PnLDisplayFormat, ShareOptions } from \"../../types/types\";\n// import { PnLDisplayFormat, ShareOptions } from \"./type\";\n\nexport type ReferralType = {\n code?: string;\n link?: string;\n slogan?: string;\n};\n\nexport function getPnLPosterData(\n position: any,\n leverage: number | string,\n message: string,\n domain: string,\n pnlType: PnLDisplayFormat,\n options: Set<ShareOptions>,\n baseDp?: number,\n quoteDp?: number,\n referral?: ReferralType\n) {\n const { symbol, currency } = processSymbol(position.symbol);\n const positionData: any = {\n symbol,\n currency,\n side: position.position_qty > 0 ? \"LONG\" : \"SHORT\",\n };\n\n switch (pnlType) {\n case \"pnl\": {\n if (\"unrealized_pnl\" in position) {\n positionData[\"pnl\"] = new Decimal(position.unrealized_pnl).toFixed(\n 2,\n Decimal.ROUND_DOWN\n );\n }\n break;\n }\n case \"roi\": {\n if (\"unrealized_pnl_ROI\" in position) {\n positionData[\"ROI\"] = new Decimal(\n position.unrealized_pnl_ROI * 100\n ).toFixed(2, Decimal.ROUND_DOWN);\n }\n break;\n }\n case \"roi_pnl\": {\n if (\"unrealized_pnl\" in position) {\n positionData[\"pnl\"] = new Decimal(position.unrealized_pnl).toFixed(\n 2,\n Decimal.ROUND_DOWN\n );\n }\n if (\"unrealized_pnl_ROI\" in position) {\n positionData[\"ROI\"] = new Decimal(\n position.unrealized_pnl_ROI * 100\n ).toFixed(2, Decimal.ROUND_DOWN);\n }\n break;\n }\n }\n\n const informations: { title: string; value: any }[] = [];\n\n if (options.has(\"leverage\")) {\n positionData[\"leverage\"] = leverage;\n }\n const array: ShareOptions[] = [\n \"openPrice\",\n \"openTime\",\n \"markPrice\",\n \"quantity\",\n ];\n array.forEach((key) => {\n if (options.has(key)) {\n switch (key) {\n case \"leverage\": {\n break;\n }\n case \"openPrice\": {\n informations.push({\n title: \"Open price\",\n value: formatFixed(position.average_open_price, quoteDp || 2),\n });\n break;\n }\n case \"openTime\": {\n informations.push({\n title: \"Opened at\",\n value: formatOpenTime(position.timestamp),\n });\n break;\n }\n case \"markPrice\": {\n informations.push({\n title: \"Mark price\",\n value: formatFixed(position.mark_price, quoteDp || 2),\n });\n break;\n }\n case \"quantity\": {\n informations.push({\n title: \"Quantity\",\n value: formatFixed(position.position_qty, baseDp || 2),\n });\n }\n default:\n break;\n }\n }\n });\n\n positionData[\"informations\"] = informations;\n\n const data: any = {\n position: positionData,\n updateTime: formatShareTime(new Date()),\n domain,\n };\n if (message.length > 0) {\n data[\"message\"] = message;\n }\n\n if (typeof referral !== \"undefined\" && referral[\"code\"] !== undefined) {\n data[\"referral\"] = referral;\n }\n\n return data;\n}\n\ninterface SymbolResult {\n symbol: string;\n currency: string;\n}\n\nfunction processSymbol(symbol: string): SymbolResult {\n const tokens = symbol.split(\"_\");\n if (tokens.length !== 3) {\n return {\n symbol: symbol,\n currency: \"USDC\",\n };\n }\n\n const [symbol1, symbol2, symbol3] = tokens;\n const formattedString = `${symbol2}-${symbol1}`;\n\n return {\n symbol: formattedString,\n currency: symbol3 || \"USDC\",\n };\n}\n\nfunction formatShareTime(input: number): string;\nfunction formatShareTime(input: Date): string;\nfunction formatShareTime(input: number | Date): string {\n const date = input instanceof Date ? input : new Date(input);\n const options: Intl.DateTimeFormatOptions = {\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n hourCycle: \"h24\",\n };\n\n const formatter = new Intl.DateTimeFormat(\"en-US\", options);\n const formattedParts = formatter.formatToParts(date);\n\n // console.log(\"formattedParts\", formattedParts);\n\n const year = formattedParts.find((part) =>\n part.type === \"year\" ? part.value : \"\"\n )?.value;\n const month = formattedParts.find((part) =>\n part.type === \"month\" ? part.value : \"\"\n )?.value;\n const day = formattedParts.find((part) =>\n part.type === \"day\" ? part.value : \"\"\n )?.value;\n const hour = formattedParts.find((part) =>\n part.type === \"hour\" ? part.value : \"\"\n )?.value;\n const minute = formattedParts.find((part) =>\n part.type === \"minute\" ? part.value : \"\"\n )?.value;\n\n return `${year}-${month}-${day} ${hour}:${minute}`;\n}\n\nfunction formatOpenTime(input: number | Date): string {\n const date = input instanceof Date ? input : new Date(input);\n const options: Intl.DateTimeFormatOptions = {\n year: \"numeric\",\n month: \"short\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n };\n\n const formatter = new Intl.DateTimeFormat(\"en-US\", options);\n const formattedParts = formatter.formatToParts(date);\n\n // console.log(\"formattedParts\", formattedParts);\n\n const month = formattedParts.find((part) =>\n part.type === \"month\" ? part.value : \"\"\n )?.value;\n const day = formattedParts.find((part) =>\n part.type === \"day\" ? part.value : \"\"\n )?.value;\n const hour = formattedParts.find((part) =>\n part.type === \"hour\" ? part.value : \"\"\n )?.value;\n const minute = formattedParts.find((part) =>\n part.type === \"minute\" ? part.value : \"\"\n )?.value;\n\n return `${month}-${day} ${hour}:${minute}`;\n}\n\nfunction formatFixed(value: number, dp: number) {\n return new Decimal(value).toFixed(dp, Decimal.ROUND_DOWN);\n}\n\nexport function savePnlInfo(\n format: PnLDisplayFormat,\n options: Set<ShareOptions>,\n bgIndex: number,\n message: string\n) {\n localStorage.setItem(\n \"pnl_config_key\",\n JSON.stringify({\n bgIndex: bgIndex,\n pnlFormat: format,\n options: Array.from(options),\n message: message,\n })\n );\n}\n\nexport function getPnlInfo(): {\n bgIndex: number;\n pnlFormat: PnLDisplayFormat;\n options: ShareOptions[];\n message: \"\";\n} {\n const str = localStorage.getItem(\"pnl_config_key\");\n\n if (str && str.length > 0) {\n try {\n const json = JSON.parse(str);\n console.log(\"local json\", json);\n\n return json;\n } catch (e) {}\n }\n return {\n bgIndex: 0,\n pnlFormat: \"roi_pnl\",\n options: [\"openPrice\", \"openTime\", \"markPrice\", \"quantity\", \"leverage\"],\n message: \"\",\n };\n}\n","import { type DrawOptions, usePoster } from \"@orderly.network/hooks\";\nimport { FC, forwardRef, useImperativeHandle } from \"react\";\n\nexport type PosterProps = {\n width: number;\n height: number;\n className?: string;\n ratio?: number;\n data: DrawOptions;\n style?: React.CSSProperties;\n};\n\nexport type PosterRef = {\n download: (filename: string, type?: string, encoderOptions?: number) => void;\n toDataURL: (type?: string, encoderOptions?: number) => string;\n toBlob: (type?: string, encoderOptions?: number) => Promise<Blob | null>;\n copy: () => Promise<void>;\n};\n\nexport const Poster = forwardRef<PosterRef, PosterProps>((props, parentRef) => {\n const { width, height, className, data, style } = props;\n\n const { ref, download, toDataURL, copy, toBlob } = usePoster(data, {\n ratio: props.ratio,\n });\n\n useImperativeHandle(parentRef, () => ({\n download,\n toDataURL,\n toBlob,\n copy,\n }));\n\n return (\n <canvas\n ref={ref}\n width={width}\n height={height}\n className={className}\n style={style}\n />\n );\n});\n","import useEmblaCarousel from \"embla-carousel-react\";\nimport { FC, useCallback, useEffect } from \"react\";\nimport { NextButton, PrevButton } from \"./buttons\";\nimport { Box, cn, Flex } from \"@orderly.network/ui\";\n\nexport const CarouselBackgroundImage: FC<{\n backgroundImages: string[];\n selectedSnap: number;\n setSelectedSnap: any;\n}> = (props) => {\n const { backgroundImages, selectedSnap, setSelectedSnap } = props;\n\n const [emblaRef, emblaApi] = useEmblaCarousel({\n // loop: true,\n containScroll: \"keepSnaps\",\n dragFree: true,\n });\n\n const onPrevButtonClick = useCallback(() => {\n if (!emblaApi) return;\n emblaApi.scrollPrev();\n }, [emblaApi]);\n\n const onNextButtonClick = useCallback(() => {\n if (!emblaApi) return;\n emblaApi.scrollNext();\n }, [emblaApi]);\n\n const onSelect = useCallback((emblaApi: any) => {\n // setPrevBtnDisabled(!emblaApi.canScrollPrev());\n // setNextBtnDisabled(!emblaApi.canScrollNext());\n setSelectedSnap(emblaApi.selectedScrollSnap());\n }, []);\n\n useEffect(() => {\n if (!emblaApi) return;\n\n onSelect(emblaApi);\n emblaApi.on(\"reInit\", onSelect);\n emblaApi.on(\"select\", onSelect);\n emblaApi?.scrollTo(selectedSnap);\n }, [emblaApi, onSelect]);\n\n return (\n <Flex mt={4} px={2} >\n <PrevButton onClick={onPrevButtonClick} />\n <div\n ref={emblaRef}\n className=\"oui-w-full oui-overflow oui-overflow-x-auto oui-scrollbar-hidden oui-hide-scrollbar oui-mx-0\"\n >\n <Flex>\n {backgroundImages.map((e, index) => (\n <Box\n key={e}\n onClick={() => {\n\n emblaApi?.scrollTo(index);\n }}\n mx={2}\n my={1}\n mr={6}\n r=\"base\"\n className={cn(\n \"oui-shrink-0 oui-w-[162px]\",\n selectedSnap === index &&\n \"oui-outline oui-outline-1 oui-outline-primary\"\n )}\n >\n <img src={e} className=\"oui-rounded-sm\" />\n </Box>\n ))}\n </Flex>\n </div>\n <NextButton onClick={onNextButtonClick} />\n </Flex>\n );\n};\n","import { FC, PropsWithChildren } from \"react\";\n\ntype PropType = PropsWithChildren<\n React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >\n>;\n\nexport const PrevButton: FC<PropType> = (props) => {\n const { children, ...restProps } = props;\n\n return (\n <button {...restProps}>\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <rect width=\"20\" height=\"20\" rx=\"10\" fill=\"#333948\" />\n <path\n d=\"M11.186 5.348a.67.67 0 0 0-.436.27l-2.657 4a.69.69 0 0 0 0 .75l2.657 4a.68.68 0 0 0 .934.188.685.685 0 0 0 .187-.937L9.463 9.993 11.87 6.37a.685.685 0 0 0-.187-.938.65.65 0 0 0-.498-.083\"\n fill=\"#fff\"\n fillOpacity=\".54\"\n />\n </svg>\n </button>\n );\n};\n\nexport const NextButton: FC<PropType> = (props) => {\n const { children, ...restProps } = props;\n\n return (\n <button {...restProps}>\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <rect width=\"20\" height=\"20\" rx=\"10\" fill=\"#333948\" />\n <path\n d=\"M8.777 5.348a.65.65 0 0 0-.498.083.685.685 0 0 0-.187.938L10.5 9.993 8.092 13.62a.685.685 0 0 0 .187.937.68.68 0 0 0 .934-.187l2.657-4a.69.69 0 0 0 0-.75l-2.657-4a.67.67 0 0 0-.436-.271\"\n fill=\"#fff\"\n fillOpacity=\".54\"\n />\n </svg>\n </button>\n );\n};\n","import { FC, useMemo } from \"react\";\nimport { PnLDisplayFormat } from \"../../types/types\";\nimport { Text, cn } from \"@orderly.network/ui\";\n\nexport const PnlFormatView: FC<{\n type: PnLDisplayFormat;\n curType?: PnLDisplayFormat;\n setPnlFormat: any;\n}> = (props) => {\n const { type, curType, setPnlFormat } = props;\n\n const text = useMemo(() => {\n switch (type) {\n case \"roi_pnl\":\n return \"ROI & PnL\";\n case \"roi\":\n return \"ROI\";\n case \"pnl\":\n return \"PnL\";\n }\n }, [type]);\n\n const isSelected = type === curType;\n\n let clsName = \"oui-flex oui-items-center oui-gap-1 oui-cursor-pointer\";\n if (isSelected) {\n clsName += \" oui-text-base-contrast\";\n } else {\n clsName += \"\";\n }\n\n return (\n <div\n className={clsName}\n onClick={() => {\n setPnlFormat(type);\n }}\n >\n <RadioButton sel={isSelected} />\n <Text\n size=\"xs\"\n intensity={54}\n className={cn(\n \"oui-ml-2 \",\n // isSelected && \"oui-text-base-contrast\"\n )}\n >\n {text}\n </Text>\n </div>\n );\n};\n\nconst RadioButton = (props: {\n sel?: boolean;\n // onChange?: (sel: boolean) => void;\n}) => {\n return (\n <button\n type=\"button\"\n // onClick={(e) => {\n // e.stopPropagation();\n // }}\n >\n {props.sel === true ? <SelIcon /> : <UnselIcon />}\n </button>\n );\n};\n\nconst SelIcon = () => {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"currentColor\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"oui-fill-primary\"\n >\n <path\n d=\"M8.01 1.333a6.667 6.667 0 1 0 0 13.333 6.667 6.667 0 0 0 0-13.333m0 1.333a5.334 5.334 0 1 1-.001 10.667 5.334 5.334 0 0 1 0-10.667\"\n fill=\"#fff\"\n fillOpacity=\".36\"\n />\n <circle cx=\"8\" cy=\"8\" r=\"3.333\" />\n </svg>\n );\n};\n\nconst UnselIcon = () => {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M8.01 1.333a6.667 6.667 0 1 0 0 13.333 6.667 6.667 0 0 0 0-13.333m0 1.333a5.334 5.334 0 1 1-.001 10.667 5.334 5.334 0 0 1 0-10.667\"\n fill=\"#fff\"\n fillOpacity=\".54\"\n />\n </svg>\n );\n};\n","import { FC, useMemo } from \"react\";\nimport { ShareOptions } from \"../../types/types\";\nimport { Flex, Text, cn } from \"@orderly.network/ui\";\nimport { Checkbox } from \"./checkbox\";\n\nexport const ShareOption: FC<{\n type: ShareOptions;\n curType: Set<ShareOptions>;\n setShareOption: any;\n}> = (props) => {\n const { type, curType, setShareOption } = props;\n\n const text = useMemo(() => {\n switch (type) {\n case \"openPrice\":\n return \"Open price\";\n case \"openTime\":\n return \"Opened at\";\n case \"markPrice\":\n return \"Mark price\";\n case \"quantity\":\n return \"Quantity\";\n case \"leverage\":\n return \"Leverage\";\n }\n }, [type]);\n\n const isSelected = curType.has(type);\n\n return (\n <Flex\n itemAlign={\"center\"}\n gap={1}\n className={cn(\"hover:oui-cursor-pointer\")}\n onClick={() => {\n // setPnlFormat(type);\n setShareOption((value: Set<ShareOptions>) => {\n const updateSet = new Set(value);\n if (isSelected) {\n updateSet.delete(type);\n } else {\n updateSet.add(type);\n }\n return updateSet;\n });\n }}\n >\n <Checkbox\n size={16}\n checked={isSelected}\n className=\"oui-pt-[2px]\"\n onCheckedChange={(checked: boolean) => {\n setShareOption((value: Set<ShareOptions>) => {\n const updateSet = new Set(value);\n if (isSelected) {\n updateSet.delete(type);\n } else {\n updateSet.add(type);\n }\n return updateSet;\n });\n }}\n />\n\n <Text size=\"xs\" intensity={54} >\n {text}\n </Text>\n </Flex>\n );\n};\n","export const Checkbox = (props: {\n size?: number;\n className?: string;\n checked: boolean;\n onCheckedChange: (checked: boolean) => void;\n}) => {\n const { size = 16, className } = props;\n return (\n <button\n type=\"button\"\n onClick={(e) => {\n props.onCheckedChange(!props.checked);\n }}\n className={className}\n >\n {props.checked ? (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M4.66 1.953A2.667 2.667 0 0 0 1.995 4.62v6.667a2.667 2.667 0 0 0 2.667 2.666h6.666a2.667 2.667 0 0 0 2.667-2.666V4.62a2.667 2.667 0 0 0-2.667-2.667zm6.664 2.922a.8.8 0 0 1 .557-.208c.2 0 .406.063.558.208a.734.734 0 0 1 0 1.063l-5.434 5.179a.826.826 0 0 1-1.115 0l-2.33-2.22a.736.736 0 0 1 0-1.063.827.827 0 0 1 1.117 0l1.77 1.687z\"\n fill=\"#fff\"\n fillOpacity=\".8\"\n />\n </svg>\n ) : (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M4.66 1.953A2.667 2.667 0 0 0 1.995 4.62v6.667a2.667 2.667 0 0 0 2.667 2.666h6.666a2.667 2.667 0 0 0 2.667-2.666V4.62a2.667 2.667 0 0 0-2.667-2.667zm0 1.334h6.667c.737 0 1.334.596 1.334 1.333v6.667c0 .736-.597 1.333-1.334 1.333H4.661a1.333 1.333 0 0 1-1.334-1.333V4.62c0-.737.597-1.333 1.334-1.333\"\n fill=\"#fff\"\n fillOpacity=\".8\"\n />\n </svg>\n )}\n </button>\n );\n};\n","import {\n CloseCircleFillIcon,\n Input,\n toast,\n} from \"@orderly.network/ui\";\nimport { FC, useRef, useState } from \"react\";\nimport { Checkbox } from \"./checkbox\";\n\nexport const Message: FC<{\n message: string;\n setMessage: any;\n check: boolean;\n setCheck: any;\n}> = (props) => {\n const { message, setMessage, check, setCheck } = props;\n const [focus, setFocus] = useState(false);\n const inputRef = useRef<HTMLInputElement | null>(null);\n return (\n <div className=\"oui-mt-3 oui-mb-6 oui-flex oui-items-center\">\n <Checkbox\n className=\"oui-mt-[2px]\"\n checked={check}\n onCheckedChange={(e: boolean) => {\n setCheck(e);\n }}\n />\n <div\n className=\"oui-text-xs oui-text-base-contrast-54 oui-ml-1 hover:oui-cursor-pointer\"\n onClick={() => {\n setCheck(!props.check);\n }}\n >\n Your message\n </div>\n <div className=\"oui-bg-base-900 oui-mx-2 oui-rounded-sm\">\n <Input\n ref={inputRef}\n placeholder=\"Max 25 characters\"\n classNames={{\n root: \"oui-w-[320px]\"\n }}\n size=\"sm\"\n value={message}\n autoFocus={false}\n suffix={\n focus && (\n <button\n className=\"oui-mr-3 oui-cursor-pointer\"\n onMouseDown={(e) => {\n console.log(\"set message to empty\");\n\n setMessage(\"\");\n setTimeout(() => {\n inputRef.current?.focus();\n }, 50);\n e.stopPropagation();\n }}\n >\n <CloseCircleFillIcon size={18} color=\"white\" />\n </button>\n )\n }\n onFocus={() => setFocus(true)}\n onBlur={() => setFocus(false)}\n onChange={(e) => {\n if (e.target.value.length > 25) {\n toast.error(\"Maximum support of 25 characters\");\n return;\n }\n setCheck(e.target.value.length > 0);\n setMessage(e.target.value);\n }}\n />\n </div>\n </div>\n );\n};\n","import { FC } from \"react\";\nimport { Button, Flex } from \"@orderly.network/ui\";\n\nexport const BottomButtons: FC<{\n onClickDownload: any;\n onClickCopy: any;\n}> = (props) => {\n const { onClickDownload, onClickCopy } = props;\n\n return (\n <Flex px={8} gap={3} mt={3} itemAlign={\"center\"} >\n <Button\n color={\"secondary\"}\n className=\"oui-flex-1 oui-flex oui-gap-1\"\n onClick={onClickDownload}\n >\n <span>\n <DownloadIcon />\n </span>\n Download\n </Button>\n\n <Button\n className=\"oui-flex-1 oui-flex oui-gap-1\"\n onClick={onClickCopy}\n >\n <span>\n <CopyIcon />\n </span>\n Copy\n </Button>\n </Flex>\n );\n};\n\nconst DownloadIcon = () => {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M4.66 1.994A2.667 2.667 0 0 0 1.995 4.66v6.666a2.667 2.667 0 0 0 2.667 2.667h6.666a2.667 2.667 0 0 0 2.667-2.667V4.661a2.667 2.667 0 0 0-2.667-2.667zM7.995 4.66c.368 0 .667.298.667.666V8.66h2l-2.667 2.666L5.328 8.66h2V5.327c0-.368.299-.667.667-.667\"\n fill=\"#fff\"\n fillOpacity=\".98\"\n />\n </svg>\n );\n};\n\nconst CopyIcon = () => {\n return (\n <svg\n width=\"17\"\n height=\"16\"\n viewBox=\"0 0 17 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M5.166 1.994A2.667 2.667 0 0 0 2.499 4.66v4a2.667 2.667 0 0 0 2.667 2.667 2.667 2.667 0 0 0 2.666 2.667h4a2.667 2.667 0 0 0 2.667-2.667v-4a2.667 2.667 0 0 0-2.667-2.667 2.667 2.667 0 0 0-2.666-2.666zm6.666 4c.737 0 1.334.596 1.334 1.333v4c0 .737-.597 1.334-1.334 1.334h-4A1.333 1.333 0 0 1 6.5 11.327h2.667a2.667 2.667 0 0 0 2.666-2.667z\"\n fill=\"#fff\"\n fillOpacity=\".98\"\n />\n </svg>\n );\n};\n","import { FC, useEffect, useMemo, useRef, useState } from \"react\";\nimport { Poster } from \"../poster\";\nimport { PosterRef } from \"../poster/poster\";\nimport {\n PnLDisplayFormat,\n ReferralType,\n ShareOptions,\n SharePnLConfig,\n} from \"../../types/types\";\nimport { getPnlInfo, getPnLPosterData, savePnlInfo } from \"../utils/utils\";\nimport {\n Box,\n Button,\n CloseCircleFillIcon,\n cn,\n Input,\n ScrollArea,\n toast,\n} from \"@orderly.network/ui\";\nimport { Carousel } from \"../carousel\";\nimport {\n CarouselContent,\n CarouselItem,\n Dot,\n useCarousel,\n} from \"../carousel/carousel\";\n\nexport const MobileSharePnLContent: FC<{\n position: any;\n leverage: any;\n hide: any;\n baseDp?: number;\n quoteDp?: number;\n referral?: ReferralType;\n shareOptions: SharePnLConfig;\n}> = (props) => {\n const { shareOptions } = props;\n const localPnlConfig = getPnlInfo();\n\n const [pnlFormat, setPnlFormat] = useState<PnLDisplayFormat>(\n localPnlConfig.pnlFormat\n );\n const [shareOption, setShareOption] = useState<Set<ShareOptions>>(\n new Set(localPnlConfig.options)\n );\n const [message, setMessage] = useState<string>(localPnlConfig.message);\n const [selectIndex, setSelectIndex] = useState(localPnlConfig.bgIndex);\n // const { shareOptions } = useTradingPageContext();\n const { backgroundImages, ...resetOptions } = shareOptions ?? {\n backgroundImages: [],\n };\n\n const [domain, setDomain] = useState(\"\");\n\n const posterRefs = shareOptions?.backgroundImages.map(() =>\n useRef<PosterRef | null>(null)\n );\n\n useEffect(() => {\n const currentDomain = window.location.hostname;\n setDomain(currentDomain);\n }, []);\n\n const posterData = getPnLPosterData(\n props.position,\n props.leverage,\n message,\n domain,\n pnlFormat,\n shareOption,\n props.baseDp,\n props.quoteDp,\n props.referral\n );\n // console.log(\"pster data\", posterData, props.position);\n\n const carouselRef = useRef<any>();\n const aspectRatio = 552 / 310;\n const [scale, setScale] = useState(1);\n const [carouselHeight, setCarouselHeight] = useState(0);\n\n const [focus, setFocus] = useState(false);\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n useEffect(() => {\n if (carouselRef.current) {\n const divWidth = carouselRef.current.offsetWidth;\n const divHeight = divWidth / aspectRatio;\n setCarouselHeight(divHeight);\n setScale(divWidth / 552);\n }\n }, [carouselRef, domain]);\n\n const onSharePnL = async (\n posterRef: React.MutableRefObject<PosterRef | null>\n ) => {\n if (!posterRef.current) return;\n const data = posterRef.current?.toDataURL();\n const blob = dataURItoBlob(data);\n try {\n // Check if the browser supports the share feature\n if (navigator.share) {\n await navigator.share({\n // title: \"Share PnL\",\n text: message,\n // url: imageUrl,\n files: [new File([blob], \"image.png\", { type: \"image/png\" })],\n });\n console.log(\"Image shared successfully!\");\n } else {\n console.log(\"Share API is not supported in this browser.\");\n }\n props.hide?.();\n } catch (error) {\n console.error(\"Error sharing image:\", error);\n }\n };\n\n savePnlInfo(pnlFormat, shareOption, selectIndex, message);\n\n return (\n <div className=\"oui-w-full\">\n {/* <div>{`leverage: ${props.leverage}x`}</div> */}\n <div\n ref={carouselRef}\n className=\"oui-w-full oui-mt-4 oui-overflow-hidden\"\n style={{ height: `${carouselHeight + 20}px` }}\n >\n <Carousel\n className=\"oui-w-full oui-overflow-hidden\"\n opts={{ align: \"start\" }}\n initIndex={selectIndex}\n >\n <CarouselContent style={{ height: `${carouselHeight}px` }}>\n {shareOptions?.backgroundImages.map((item, index) => (\n <CarouselItem key={index}>\n <Poster\n className=\"oui-transform oui-origin-top-left\"\n style={{ scale: `${scale}` }}\n width={552}\n height={310}\n data={{\n backgroundImg: item,\n ...resetOptions,\n data: posterData,\n }}\n ratio={3}\n ref={posterRefs?.[index]}\n />\n </CarouselItem>\n ))}\n </CarouselContent>\n <div className=\"oui-mt-2 oui-mb-1 oui-flex oui-justify-center\">\n <MyIdentifier\n dotClassName=\"oui-w-[16px] oui-h-[4px] oui-bg-base-300\"\n dotActiveClassName=\"!oui-bg-primary oui-w-[20px]\"\n setSelectIndex={setSelectIndex}\n />\n </div>\n </Carousel>\n </div>\n\n <ScrollArea className=\"oui-max-h-[200px] oui-overflow-y-auto\">\n <div className=\"oui-mt-4\">\n <div className=\"oui-text-3xs oui-text-base-contrast-54\">\n PnL display format\n </div>\n <div className=\"oui-pt-3 oui-px-1 oui-flex oui-justify-between oui-gap-3\">\n <PnlFormatView\n setPnlFormat={setPnlFormat}\n type=\"roi_pnl\"\n curType={pnlFormat}\n />\n <PnlFormatView\n setPnlFormat={setPnlFormat}\n type=\"roi\"\n curType={pnlFormat}\n />\n <PnlFormatView\n setPnlFormat={setPnlFormat}\n type=\"pnl\"\n curType={pnlFormat}\n />\n </div>\n </div>\n\n <div className=\"oui-mt-3\">\n <div className=\"oui-text-3xs oui-text-base-contrast-54 oui-h-[18px]\">\n Optional information to share\n </div>\n <div className=\"oui-flex oui-flex-wrap oui-gap-3 oui-mt-3\">\n <ShareOption\n setShareOption={setShareOption}\n type=\"openPrice\"\n curType={shareOption}\n />\n <ShareOption\n setShareOption={setShareOption}\n type=\"openTime\"\n curType={shareOption}\n />\n <ShareOption\n setShareOption={setShareOption}\n type=\"leverage\"\n curType={shareOption}\n />\n <ShareOption\n setShareOption={setShareOption}\n type=\"markPrice\"\n curType={shareOption}\n />\n <ShareOption\n setShareOption={setShareOption}\n type=\"quantity\"\n curType={shareOption}\n />\n </div>\n </div>\n\n <div className=\"oui-mt-3 oui-mb-8\">\n <div className=\"oui-text-3xs oui-text-base-contrast-54 oui-h-[18px]\">\n Your message\n </div>\n <div className=\"oui-mt-3 oui-h-[48px] oui-bg-base-600 oui-mx-1\">\n <Input\n placeholder=\"Max 25 characters\"\n containerClassName=\"oui-bg-transparent oui-h-[48px]\"\n value={message}\n autoFocus={false}\n onChange={(e) => {\n if (e.target.value.length > 25) {\n toast.error(\"Maximum support of 25 characters\");\n return;\n }\n setMessage(e.target.value);\n }}\n ref={inputRef}\n onFocus={() => setFocus(true)}\n onBlur={() => setFocus(false)}\n suffix={\n focus && (\n <button\n className=\"oui-mr-3 oui-cursor-pointer\"\n onMouseDown={(e) => {\n console.log(\"set message to empty\");\n\n setMessage(\"\");\n setTimeout(() => {\n inputRef.current?.focus();\n }, 50);\n e.stopPropagation();\n }}\n >\n <CloseCircleFillIcon size={18} color=\"white\" />\n </button>\n )\n }\n />\n </div>\n </div>\n </ScrollArea>\n\n <div className=\"oui-pt-2\">\n <Button\n fullWidth\n className=\"oui-h-[40px] oui-text-[16px]\"\n onClick={() => {\n const ref = posterRefs?.[selectIndex];\n if (ref) {\n onSharePnL(ref);\n }\n }}\n >\n Share\n </Button>\n </div>\n </div>\n );\n};\n\nconst PnlFormatView: FC<{\n type: PnLDisplayFormat;\n curType?: PnLDisplayFormat;\n setPnlFormat: any;\n}> = (props) => {\n const { type, curType, setPnlFormat } = props;\n\n const text = useMemo(() => {\n switch (type) {\n case \"roi_pnl\":\n return \"ROI & PnL\";\n case \"roi\":\n return \"ROI\";\n case \"pnl\":\n return \"PnL\";\n }\n }, [type]);\n\n const isSelected = type === curType;\n\n return (\n <div\n className={cn(\n \"oui-shadow-lg oui-rounded-lg oui-h-[46px] oui-flex-1 oui-bg-base-4 hover:oui-cursor-pointer oui-flex oui-items-center oui-px-3 oui-referral-shadow\",\n isSelected && \"oui-bg-primary oui-dot-sel\"\n )}\n onClick={() => {\n setPnlFormat(type);\n }}\n >\n <div className=\"oui-text-sm oui-text-base-contrast\">{text}</div>\n {/* {isSelected && <RadioIcon size={20} />} */}\n </div>\n );\n};\n\nconst ShareOption: FC<{\n type: ShareOptions;\n curType: Set<ShareOptions>;\n setShareOption: any;\n}> = (props) => {\n const { type, curType, setShareOption } = props;\n\n const text = useMemo(() => {\n switch (type) {\n case \"openPrice\":\n return \"Open price\";\n case \"openTime\":\n return \"Opened at\";\n case \"markPrice\":\n return \"Mark price\";\n case \"quantity\":\n return \"Quantity\";\n case \"leverage\":\n return \"Leverage\";\n }\n }, [type]);\n\n const isSelected = curType.has(type);\n\n return (\n <div\n className={cn(\n \"oui-shadow-lg oui-rounded-lg oui-h-[46px] oui-mt-0 oui-w-[calc(50%-6px)] oui-bg-base-4 hover:oui-cursor-pointer oui-items-center oui-flex oui-p-3 oui-referral-shadow\"\n )}\n onClick={() => {\n // setPnlFormat(type);\n setShareOption((value: Set<ShareOptions>) => {\n const updateSet = new Set(value);\n if (isSelected) {\n updateSet.delete(type);\n } else {\n updateSet.add(type);\n }\n return updateSet;\n });\n }}\n >\n <div className=\"oui-text-sm oui-flex-1 oui-text-base-contrast\">\n {text}\n </div>\n {isSelected && <ChoicesFillIcon />}\n </div>\n );\n};\nfunction dataURItoBlob(dataURI: string) {\n const byteString = atob(dataURI.split(\",\")[1]);\n const mimeString = dataURI.split(\",\")[0].split(\":\")[1].split(\";\")[0];\n const ab = new ArrayBuffer(byteString.length);\n const ia = new Uint8Array(ab);\n for (let i = 0; i < byteString.length; i++) {\n ia[i] = byteString.charCodeAt(i);\n }\n return new Blob([ab], { type: mimeString });\n}\n\nconst MyIdentifier: FC<{\n setSelectIndex: any;\n className?: string;\n dotClassName?: string;\n dotActiveClassName?: string;\n onClick?: (index: number) => void;\n}> = (props) => {\n const { scrollSnaps, selectedIndex } = useCarousel();\n useEffect(() => {\n props.setSelectIndex(selectedIndex);\n }, [selectedIndex]);\n\n console.log(\"setSelectIndex is\", selectedIndex);\n\n return (\n <div className={cn(\"oui-flex oui-gap-1\")}>\n {scrollSnaps.map((_: any, index: number) => {\n return (\n <Dot\n key={index}\n index={index}\n active={index === selectedIndex}\n onClick={props.onClick}\n className={props.dotClassName}\n activeClassName={props.dotActiveClassName}\n />\n );\n })}\n </div>\n );\n};\n\nconst ChoicesFillIcon = () => {\n return (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M2.01416 11.9989C2.01416 6.47589 6.49136 1.9989 12.0142 1.9989C17.5372 1.9989 22.0142 6.47589 22.0142 11.9989C22.0142 17.5219 17.5372 21.9989 12.0142 21.9989C6.49136 21.9989 2.01416 17.5219 2.01416 11.9989ZM16.9853 7.31211C17.2125 7.09537 17.5236 7 17.8218 7C18.1201 7 18.4312 7.09537 18.6583 7.31211C19.1139 7.74546 19.1139 8.47384 18.6583 8.9072L10.5077 16.675C10.0534 17.1083 9.28909 17.1083 8.83472 16.675L5.34077 13.3459C4.88641 12.9126 4.88641 12.1841 5.34077 11.7508C5.79631 11.3175 6.56057 11.3175 7.01493 11.7508L9.67122 14.2822L16.9853 7.31211Z\"\n fill=\"white\"\n fill-opacity=\"1\"\n />\n </svg>\n );\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport useEmblaCarousel, {\n type UseEmblaCarouselType,\n} from \"embla-carousel-react\";\nimport { Button, cn } from \"@orderly.network/ui\";\n\n\n\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\ntype CarouselProps = {\n opts?: CarouselOptions;\n plugins?: CarouselPlugin;\n orientation?: \"horizontal\" | \"vertical\";\n setApi?: (api: CarouselApi) => void;\n initIndex?: number,\n};\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n api: ReturnType<typeof useEmblaCarousel>[1];\n scrollPrev: () => void;\n scrollNext: () => void;\n canScrollPrev: boolean;\n canScrollNext: boolean;\n selectedIndex: number;\n scrollSnaps: number[];\n} & CarouselProps;\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null);\n\nexport function useCarousel() {\n const context = React.useContext(CarouselContext);\n\n if (!context) {\n throw new Error(\"useCarousel must be used within a <Carousel />\");\n }\n\n return context;\n}\n\nconst Carousel = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & CarouselProps\n>(\n (\n {\n orientation = \"horizontal\",\n opts,\n setApi,\n plugins,\n className,\n children,\n ...props\n },\n ref\n ) => {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === \"horizontal\" ? \"x\" : \"y\",\n },\n plugins\n );\n const [canScrollPrev, setCanScrollPrev] = React.useState(false);\n const [canScrollNext, setCanScrollNext] = React.useState(false);\n const [selectedIndex, setSelectedIndex] = React.useState(props.initIndex ||0);\n const [scrollSnaps, setScrollSnaps] = React.useState<number[]>([]);\n\n const onSelect = React.useCallback(\n (api: CarouselApi) => {\n if (!api) {\n return;\n }\n\n // console.log(\"selected\", api.scrollSnapList());\n\n if (scrollSnaps.length === 0) {\n setScrollSnaps(api.scrollSnapList());\n }\n\n setSelectedIndex(api.selectedScrollSnap());\n\n setCanScrollPrev(api.canScrollPrev());\n setCanScrollNext(api.canScrollNext());\n },\n [scrollSnaps]\n );\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === \"ArrowRight\") {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext]\n );\n\n React.useEffect(() => {\n if (!api || !setApi) {\n return;\n }\n\n setApi(api);\n }, [api, setApi]);\n\n React.useEffect(() => {\n if (!api) {\n return;\n }\n\n onSelect(api);\n api.on(\"reInit\", onSelect);\n api.on(\"select\", onSelect);\n\n if (props.initIndex) {\n api.scrollTo(props.initIndex);\n }\n return () => {\n api?.off(\"select\", onSelect);\n };\n }, [api, onSelect]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation:\n orientation || (opts?.axis === \"y\" ? \"vertical\" : \"horizontal\"),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n selectedIndex,\n scrollSnaps,\n }}\n >\n <div\n ref={ref}\n onKeyDownCapture={handleKeyDown}\n className={cn(\"oui-relative\", className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n );\n }\n);\nCarousel.displayName = \"Carousel\";\n\nconst CarouselContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const { carouselRef, orientation } = useCarousel();\n\n \n\n return (\n <div ref={carouselRef} className=\"oui-overflow-hidden\">\n <div\n ref={ref}\n className={cn(\n \"oui-flex\",\n orientation === \"horizontal\"\n ? \"oui--ml-4\"\n : \"oui--mt-4 oui-flex-col\",\n className\n )}\n {...props}\n />\n </div>\n );\n});\nCarouselContent.displayName = \"CarouselContent\";\n\nconst CarouselItem = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const { orientation } = useCarousel();\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-roledescription=\"slide\"\n className={cn(\n \"oui-min-w-0 oui-shrink-0 oui-grow-0 oui-basis-full\",\n orientation === \"horizontal\" ? \"oui-pl-4\" : \"oui-pt-4\",\n className\n )}\n {...props}\n />\n );\n});\nCarouselItem.displayName = \"CarouselItem\";\n\nconst CarouselPrevious = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<typeof Button>\n>(({ className, variant = \"contained\", size = \"icon\", ...props }, ref) => {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n\n return (\n <Button\n // @ts-ignore\n ref={ref}\n variant={variant}\n // size={size}\n className={cn(\n \"oui-absolute oui-h-8 oui-w-8 oui-rounded-full\",\n orientation === \"horizontal\"\n ? \"oui--left-12 oui-top-1/2 oui--translate-y-1/2\"\n : \"oui--top-12 oui-left-1/2 oui--translate-x-1/2 oui-rotate-90\",\n className\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n {/* @ts-ignore */}\n <ChevronLeft size={20} />\n <span className=\"oui-sr-only\">Previous slide</span>\n </Button>\n );\n});\nCarouselPrevious.displayName = \"CarouselPrevious\";\n\nconst CarouselNext = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<typeof Button>\n>(({ className, variant = \"contained\", size = \"icon\", ...props }, ref) => {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n\n return (\n <Button\n // @ts-ignore\n ref={ref}\n variant={variant}\n // size={size}\n className={cn(\n \"oui-absolute oui-h-8 oui-w-8 oui-rounded-full\",\n orientation === \"horizontal\"\n ? \"oui--right-12 oui-top-1/2 oui--translate-y-1/2\"\n : \"oui--bottom-12 oui-left-1/2 oui--translate-x-1/2 oui-rotate-90\",\n className\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n {/* @ts-ignore */}\n <ChevronRight size={20} />\n <span className=\"oui-sr-only\">Next slide</span>\n </Button>\n );\n});\nCarouselNext.displayName = \"CarouselNext\";\n\nexport type CarouselIdentifierProps = {\n className?: string;\n dotClassName?: string;\n dotActiveClassName?: string;\n onClick?: (index: number) => void;\n // asChild?: boolean;\n};\nconst CarouselIdentifier: React.FC<CarouselIdentifierProps> = (props) => {\n const { scrollSnaps, selectedIndex } = useCarousel();\n\n return (\n <div className={cn(\"oui-flex oui-gap-1\", props.className)}>\n {scrollSnaps.map((_, index) => {\n return (\n <Dot\n key={index}\n index={index}\n active={index === selectedIndex}\n onClick={props.onClick}\n className={props.dotClassName}\n activeClassName={props.dotActiveClassName}\n />\n );\n })}\n </div>\n );\n};\n\nCarouselIdentifier.displayName = \"CarouselIdentifier\";\n\nexport const Dot: React.FC<{\n index: number;\n active: boolean;\n onClick?: (index: number) => void;\n className?: string;\n activeClassName?: string;\n}> = ({ index, active, onClick, className, activeClassName }) => {\n const activedClassName = activeClassName || \"oui-bg-primary\";\n console.log(\"activedClassName is\", activedClassName);\n \n return (\n <button\n onClick={() => onClick?.(index)}\n className={cn(\n \"oui-w-2 oui-h-2 oui-rounded-full oui-bg-white/30\",\n className,\n active && `active ${activedClassName}`\n )}\n />\n );\n};\n\nexport {\n type CarouselApi,\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselPrevious,\n CarouselNext,\n CarouselIdentifier,\n};\n","import {\n Carousel as OriginCarousel,\n CarouselContent,\n CarouselItem,\n CarouselNext,\n CarouselPrevious,\n CarouselIdentifier,\n} from \"./carousel\";\n\nexport type Carousel = typeof OriginCarousel & {\n Content: typeof CarouselContent;\n Item: typeof CarouselItem;\n Next: typeof CarouselNext;\n Previous: typeof CarouselPrevious;\n indentify: typeof CarouselIdentifier;\n};\n\nconst Carousel = OriginCarousel as Carousel;\n\nCarousel.Content = CarouselContent;\nCarousel.Item = CarouselItem;\nCarousel.Next = CarouselNext;\nCarousel.Previous = CarouselPrevious;\nCarousel.indentify = CarouselIdentifier;\n\nexport { Carousel };\n","\nimport { SharePnLConfig, SharePnLParams } from \"../types/types\";\nimport { useSharePnLScript } from \"./sharePnL.script\";\nimport { DesktopSharePnL, MobileSharePnL } from \"./sharePnL.ui\";\n\nexport const SharePnLBottomSheetWidget = (props: {\n hide?: () => void;\n pnl?: SharePnLConfig & SharePnLParams;\n}) => {\n const state = useSharePnLScript({\n hide: props.hide,\n pnl: props.pnl,\n });\n return <MobileSharePnL {...state} />;\n};\n\nexport const SharePnLDialogWidget = (props: {\n hide?: () => void;\n pnl?: SharePnLConfig & SharePnLParams;\n}) => {\n const state = useSharePnLScript({\n hide: props.hide,\n pnl: props.pnl,\n });\n return <DesktopSharePnL {...state} />;\n};\n"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cn, Button, registerSimpleDialog, registerSimpleSheet, Box, Flex, Text, Divider, CloseIcon, ScrollArea, Input, toast, CloseCircleFillIcon } from '@orderly.network/ui';
|
|
2
|
+
import { usePoster, useSymbolsInfo, useReferralInfo } from '@orderly.network/hooks';
|
|
3
|
+
import * as p from 'react';
|
|
4
|
+
import { forwardRef, useImperativeHandle, useMemo, useState, useEffect, useRef, useCallback } from 'react';
|
|
5
|
+
import { Decimal } from '@orderly.network/utils';
|
|
6
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
+
import Xe from 'embla-carousel-react';
|
|
8
|
+
|
|
9
|
+
var Y=e=>{let{pnl:t,hide:o}=e,a=t?.position,n=useSymbolsInfo(),{getFirstRefCode:r}=useReferralInfo(),l=n[a?.symbol]("base_dp"),i=n[a?.symbol]("quote_dp"),c=useMemo(()=>{let s=r()?.code;return {code:t?.refCode??s,slogan:t?.refSlogan,link:t?.refLink}},[r,t]);return {position:a,leverage:t?.leverage,baseDp:l,quoteDp:i,referralInfo:c,shareOptions:t,hide:o}};function Z(e,t,o,a,n,r,l,i,c){let{symbol:s,currency:u}=Ve(e.symbol),h={symbol:s,currency:u,side:e.position_qty>0?"LONG":"SHORT"};switch(n){case"pnl":{"unrealized_pnl"in e&&(h.pnl=new Decimal(e.unrealized_pnl).toFixed(2,Decimal.ROUND_DOWN));break}case"roi":{"unrealized_pnl_ROI"in e&&(h.ROI=new Decimal(e.unrealized_pnl_ROI*100).toFixed(2,Decimal.ROUND_DOWN));break}case"roi_pnl":{"unrealized_pnl"in e&&(h.pnl=new Decimal(e.unrealized_pnl).toFixed(2,Decimal.ROUND_DOWN)),"unrealized_pnl_ROI"in e&&(h.ROI=new Decimal(e.unrealized_pnl_ROI*100).toFixed(2,Decimal.ROUND_DOWN));break}}let v=[];r.has("leverage")&&(h.leverage=t),["openPrice","openTime","markPrice","quantity"].forEach(b=>{if(r.has(b))switch(b){case"leverage":break;case"openPrice":{v.push({title:"Open price",value:te(e.average_open_price,i||2)});break}case"openTime":{v.push({title:"Opened at",value:Qe(e.timestamp)});break}case"markPrice":{v.push({title:"Mark price",value:te(e.mark_price,i||2)});break}case"quantity":v.push({title:"Quantity",value:te(e.position_qty,l||2)});}}),h.informations=v;let S={position:h,updateTime:Ke(new Date),domain:a};return o.length>0&&(S.message=o),typeof c<"u"&&c.code!==void 0&&(S.referral=c),S}function Ve(e){let t=e.split("_");if(t.length!==3)return {symbol:e,currency:"USDC"};let[o,a,n]=t;return {symbol:`${a}-${o}`,currency:n||"USDC"}}function Ke(e){let t=e instanceof Date?e:new Date(e),o={year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hourCycle:"h24"},n=new Intl.DateTimeFormat("en-US",o).formatToParts(t),r=n.find(u=>u.type==="year"?u.value:"")?.value,l=n.find(u=>u.type==="month"?u.value:"")?.value,i=n.find(u=>u.type==="day"?u.value:"")?.value,c=n.find(u=>u.type==="hour"?u.value:"")?.value,s=n.find(u=>u.type==="minute"?u.value:"")?.value;return `${r}-${l}-${i} ${c}:${s}`}function Qe(e){let t=e instanceof Date?e:new Date(e),o={year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit"},n=new Intl.DateTimeFormat("en-US",o).formatToParts(t),r=n.find(s=>s.type==="month"?s.value:"")?.value,l=n.find(s=>s.type==="day"?s.value:"")?.value,i=n.find(s=>s.type==="hour"?s.value:"")?.value,c=n.find(s=>s.type==="minute"?s.value:"")?.value;return `${r}-${l} ${i}:${c}`}function te(e,t){return new Decimal(e).toFixed(t,Decimal.ROUND_DOWN)}function G(e,t,o,a){localStorage.setItem("pnl_config_key",JSON.stringify({bgIndex:o,pnlFormat:e,options:Array.from(t),message:a}));}function X(){let e=localStorage.getItem("pnl_config_key");if(e&&e.length>0)try{return JSON.parse(e)}catch{}return {bgIndex:0,pnlFormat:"roi_pnl",options:["openPrice","openTime","markPrice","quantity","leverage"],message:""}}var W=forwardRef((e,t)=>{let{width:o,height:a,className:n,data:r,style:l}=e,{ref:i,download:c,toDataURL:s,copy:u,toBlob:h}=usePoster(r,{ratio:e.ratio});return useImperativeHandle(t,()=>({download:c,toDataURL:s,toBlob:h,copy:u})),jsx("canvas",{ref:i,width:o,height:a,className:n,style:l})});var ge=e=>{let{children:t,...o}=e;return jsx("button",{...o,children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{width:"20",height:"20",rx:"10",fill:"#333948"}),jsx("path",{d:"M11.186 5.348a.67.67 0 0 0-.436.27l-2.657 4a.69.69 0 0 0 0 .75l2.657 4a.68.68 0 0 0 .934.188.685.685 0 0 0 .187-.937L9.463 9.993 11.87 6.37a.685.685 0 0 0-.187-.938.65.65 0 0 0-.498-.083",fill:"#fff",fillOpacity:".54"})]})})},ye=e=>{let{children:t,...o}=e;return jsx("button",{...o,children:jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsx("rect",{width:"20",height:"20",rx:"10",fill:"#333948"}),jsx("path",{d:"M8.777 5.348a.65.65 0 0 0-.498.083.685.685 0 0 0-.187.938L10.5 9.993 8.092 13.62a.685.685 0 0 0 .187.937.68.68 0 0 0 .934-.187l2.657-4a.69.69 0 0 0 0-.75l-2.657-4a.67.67 0 0 0-.436-.271",fill:"#fff",fillOpacity:".54"})]})})};var xe=e=>{let{backgroundImages:t,selectedSnap:o,setSelectedSnap:a}=e,[n,r]=Xe({containScroll:"keepSnaps",dragFree:!0}),l=useCallback(()=>{r&&r.scrollPrev();},[r]),i=useCallback(()=>{r&&r.scrollNext();},[r]),c=useCallback(s=>{a(s.selectedScrollSnap());},[]);return useEffect(()=>{r&&(c(r),r.on("reInit",c),r.on("select",c),r?.scrollTo(o));},[r,c]),jsxs(Flex,{mt:4,px:2,children:[jsx(ge,{onClick:l}),jsx("div",{ref:n,className:"oui-w-full oui-overflow oui-overflow-x-auto oui-scrollbar-hidden oui-hide-scrollbar oui-mx-0",children:jsx(Flex,{children:t.map((s,u)=>jsx(Box,{onClick:()=>{r?.scrollTo(u);},mx:2,my:1,mr:6,r:"base",className:cn("oui-shrink-0 oui-w-[162px]",o===u&&"oui-outline oui-outline-1 oui-outline-primary"),children:jsx("img",{src:s,className:"oui-rounded-sm"})},s))})}),jsx(ye,{onClick:i})]})};var Se=e=>{let{type:t,curType:o,setPnlFormat:a}=e,n=useMemo(()=>{switch(t){case"roi_pnl":return "ROI & PnL";case"roi":return "ROI";case"pnl":return "PnL"}},[t]),r=t===o,l="oui-flex oui-items-center oui-gap-1 oui-cursor-pointer";return r?l+=" oui-text-base-contrast":l+="",jsxs("div",{className:l,onClick:()=>{a(t);},children:[jsx(st,{sel:r}),jsx(Text,{size:"xs",intensity:54,className:cn("oui-ml-2 "),children:n})]})},st=e=>jsx("button",{type:"button",children:e.sel===!0?jsx(it,{}):jsx(lt,{})}),it=()=>jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",className:"oui-fill-primary",children:[jsx("path",{d:"M8.01 1.333a6.667 6.667 0 1 0 0 13.333 6.667 6.667 0 0 0 0-13.333m0 1.333a5.334 5.334 0 1 1-.001 10.667 5.334 5.334 0 0 1 0-10.667",fill:"#fff",fillOpacity:".36"}),jsx("circle",{cx:"8",cy:"8",r:"3.333"})]}),lt=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M8.01 1.333a6.667 6.667 0 1 0 0 13.333 6.667 6.667 0 0 0 0-13.333m0 1.333a5.334 5.334 0 1 1-.001 10.667 5.334 5.334 0 0 1 0-10.667",fill:"#fff",fillOpacity:".54"})});var j=e=>{let{size:t=16,className:o}=e;return jsx("button",{type:"button",onClick:a=>{e.onCheckedChange(!e.checked);},className:o,children:e.checked?jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.66 1.953A2.667 2.667 0 0 0 1.995 4.62v6.667a2.667 2.667 0 0 0 2.667 2.666h6.666a2.667 2.667 0 0 0 2.667-2.666V4.62a2.667 2.667 0 0 0-2.667-2.667zm6.664 2.922a.8.8 0 0 1 .557-.208c.2 0 .406.063.558.208a.734.734 0 0 1 0 1.063l-5.434 5.179a.826.826 0 0 1-1.115 0l-2.33-2.22a.736.736 0 0 1 0-1.063.827.827 0 0 1 1.117 0l1.77 1.687z",fill:"#fff",fillOpacity:".8"})}):jsx("svg",{width:t,height:t,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M4.66 1.953A2.667 2.667 0 0 0 1.995 4.62v6.667a2.667 2.667 0 0 0 2.667 2.666h6.666a2.667 2.667 0 0 0 2.667-2.666V4.62a2.667 2.667 0 0 0-2.667-2.667zm0 1.334h6.667c.737 0 1.334.596 1.334 1.333v6.667c0 .736-.597 1.333-1.334 1.333H4.661a1.333 1.333 0 0 1-1.334-1.333V4.62c0-.737.597-1.333 1.334-1.333",fill:"#fff",fillOpacity:".8"})})})};var we=e=>{let{type:t,curType:o,setShareOption:a}=e,n=useMemo(()=>{switch(t){case"openPrice":return "Open price";case"openTime":return "Opened at";case"markPrice":return "Mark price";case"quantity":return "Quantity";case"leverage":return "Leverage"}},[t]),r=o.has(t);return jsxs(Flex,{itemAlign:"center",gap:1,className:cn("hover:oui-cursor-pointer"),onClick:()=>{a(l=>{let i=new Set(l);return r?i.delete(t):i.add(t),i});},children:[jsx(j,{size:16,checked:r,className:"oui-pt-[2px]",onCheckedChange:l=>{a(i=>{let c=new Set(i);return r?c.delete(t):c.add(t),c});}}),jsx(Text,{size:"xs",intensity:54,children:n})]})};var Ne=e=>{let{message:t,setMessage:o,check:a,setCheck:n}=e,[r,l]=useState(!1),i=useRef(null);return jsxs("div",{className:"oui-mt-3 oui-mb-6 oui-flex oui-items-center",children:[jsx(j,{className:"oui-mt-[2px]",checked:a,onCheckedChange:c=>{n(c);}}),jsx("div",{className:"oui-text-xs oui-text-base-contrast-54 oui-ml-1 hover:oui-cursor-pointer",onClick:()=>{n(!e.check);},children:"Your message"}),jsx("div",{className:"oui-bg-base-900 oui-mx-2 oui-rounded-sm",children:jsx(Input,{ref:i,placeholder:"Max 25 characters",classNames:{root:"oui-w-[320px]"},size:"sm",value:t,autoFocus:!1,suffix:r&&jsx("button",{className:"oui-mr-3 oui-cursor-pointer",onMouseDown:c=>{o(""),setTimeout(()=>{i.current?.focus();},50),c.stopPropagation();},children:jsx(CloseCircleFillIcon,{size:18,color:"white"})}),onFocus:()=>l(!0),onBlur:()=>l(!1),onChange:c=>{if(c.target.value.length>25){toast.error("Maximum support of 25 characters");return}n(c.target.value.length>0),o(c.target.value);}})})]})};var De=e=>{let{onClickDownload:t,onClickCopy:o}=e;return jsxs(Flex,{px:8,gap:3,mt:3,itemAlign:"center",children:[jsxs(Button,{color:"secondary",className:"oui-flex-1 oui-flex oui-gap-1",onClick:t,children:[jsx("span",{children:jsx(St,{})}),"Download"]}),jsxs(Button,{className:"oui-flex-1 oui-flex oui-gap-1",onClick:o,children:[jsx("span",{children:jsx(bt,{})}),"Copy"]})]})},St=()=>jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M4.66 1.994A2.667 2.667 0 0 0 1.995 4.66v6.666a2.667 2.667 0 0 0 2.667 2.667h6.666a2.667 2.667 0 0 0 2.667-2.667V4.661a2.667 2.667 0 0 0-2.667-2.667zM7.995 4.66c.368 0 .667.298.667.666V8.66h2l-2.667 2.666L5.328 8.66h2V5.327c0-.368.299-.667.667-.667",fill:"#fff",fillOpacity:".98"})}),bt=()=>jsx("svg",{width:"17",height:"16",viewBox:"0 0 17 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{d:"M5.166 1.994A2.667 2.667 0 0 0 2.499 4.66v4a2.667 2.667 0 0 0 2.667 2.667 2.667 2.667 0 0 0 2.666 2.667h4a2.667 2.667 0 0 0 2.667-2.667v-4a2.667 2.667 0 0 0-2.667-2.667 2.667 2.667 0 0 0-2.666-2.666zm6.666 4c.737 0 1.334.596 1.334 1.333v4c0 .737-.597 1.334-1.334 1.334h-4A1.333 1.333 0 0 1 6.5 11.327h2.667a2.667 2.667 0 0 0 2.666-2.667z",fill:"#fff",fillOpacity:".98"})});var Oe=e=>{let{shareOptions:t}=e,o=X(),[a,n]=useState(o.pnlFormat),[r,l]=useState(new Set(o.options)),[i,c]=useState(o.bgIndex),[s,u]=useState(o.message),[h,v]=useState(!1),{backgroundImages:M,...S}=t??{backgroundImages:[]},[b,I]=useState(""),C=useRef(null);useEffect(()=>{let w=window.location.hostname;I(w);},[]);let P=useMemo(()=>t?.backgroundImages[i],[t?.backgroundImages,i]),O=Z(e.position,e.leverage,h?s:"",b,a,r,e.baseDp,e.quoteDp,e.referral),R=()=>{C.current?.copy().then(()=>{e.hide?.(),toast.success("Image copied");}).catch(w=>{toast.error(()=>jsxs("div",{children:[jsx("div",{children:"Copy failed"}),jsx("div",{className:"oui-text-2xs oui-max-w-[396px] oui-mt-2 oui-text-base-contrast-54",children:"Browser version outdated, please update in order to copy image to clipboard."})]}));});},z=()=>{C.current?.download("Poster.png"),e.hide?.();},g=["roi_pnl","roi","pnl"],ee=["openPrice","markPrice","openTime","leverage","quantity"];return G(a,r,i,s),jsxs("div",{className:"oui-h-full oui-flex oui-flex-col oui-relative oui-w-full",children:[jsxs("div",{className:"oui-flex-1 oui-h-full oui-overflow-y-auto",children:[jsxs(Box,{mt:9,height:422,children:[jsx(Flex,{itemAlign:"center",justify:"center",children:jsx(W,{width:552,height:310,data:{backgroundImg:P,...S,data:O},ratio:3,ref:C})}),jsx(xe,{backgroundImages:t?.backgroundImages??[],selectedSnap:i,setSelectedSnap:c})]}),jsxs(Flex,{direction:"column",px:10,mt:6,justify:"start",itemAlign:"start",width:"100%",children:[jsx(Text,{size:"sm",intensity:80,children:"PnL display format"}),jsx(Flex,{pt:3,gap:3,itemAlign:"center",children:g.map(w=>jsx(Se,{setPnlFormat:n,type:w,curType:a}))}),jsx(Divider,{className:"oui-w-full oui-pt-6 oui-border-white/10"}),jsxs(Flex,{mt:6,direction:"column",justify:"start",itemAlign:"start",children:[jsx(Text,{size:"sm",intensity:80,children:"Optional information to share"}),jsx(Flex,{mt:3,gap:4,children:ee.map(w=>jsx(we,{setShareOption:l,type:w,curType:r}))})]}),jsx(Ne,{message:s,setMessage:u,check:h,setCheck:v})]})]}),jsx(De,{onClickCopy:R,onClickDownload:z}),jsx("button",{onClick:()=>{e.hide();},className:"oui-absolute oui-top-0 oui-right-0 oui-w-[40px] oui-h-[40px] oui-flex oui-justify-center oui-items-center",children:jsx(CloseIcon,{size:12,className:"oui-fill-base-contrast-54"})})]})};var Fe=p.createContext(null);function T(){let e=p.useContext(Fe);if(!e)throw new Error("useCarousel must be used within a <Carousel />");return e}var ne=p.forwardRef(({orientation:e="horizontal",opts:t,setApi:o,plugins:a,className:n,children:r,...l},i)=>{let[c,s]=Xe({...t,axis:e==="horizontal"?"x":"y"},a),[u,h]=p.useState(!1),[v,M]=p.useState(!1),[S,b]=p.useState(l.initIndex||0),[I,C]=p.useState([]),P=p.useCallback(g=>{g&&(I.length===0&&C(g.scrollSnapList()),b(g.selectedScrollSnap()),h(g.canScrollPrev()),M(g.canScrollNext()));},[I]),O=p.useCallback(()=>{s?.scrollPrev();},[s]),R=p.useCallback(()=>{s?.scrollNext();},[s]),z=p.useCallback(g=>{g.key==="ArrowLeft"?(g.preventDefault(),O()):g.key==="ArrowRight"&&(g.preventDefault(),R());},[O,R]);return p.useEffect(()=>{!s||!o||o(s);},[s,o]),p.useEffect(()=>{if(s)return P(s),s.on("reInit",P),s.on("select",P),l.initIndex&&s.scrollTo(l.initIndex),()=>{s?.off("select",P);}},[s,P]),jsx(Fe.Provider,{value:{carouselRef:c,api:s,opts:t,orientation:e||(t?.axis==="y"?"vertical":"horizontal"),scrollPrev:O,scrollNext:R,canScrollPrev:u,canScrollNext:v,selectedIndex:S,scrollSnaps:I},children:jsx("div",{ref:i,onKeyDownCapture:z,className:cn("oui-relative",n),role:"region","aria-roledescription":"carousel",...l,children:r})})});ne.displayName="Carousel";var K=p.forwardRef(({className:e,...t},o)=>{let{carouselRef:a,orientation:n}=T();return jsx("div",{ref:a,className:"oui-overflow-hidden",children:jsx("div",{ref:o,className:cn("oui-flex",n==="horizontal"?"oui--ml-4":"oui--mt-4 oui-flex-col",e),...t})})});K.displayName="CarouselContent";var Q=p.forwardRef(({className:e,...t},o)=>{let{orientation:a}=T();return jsx("div",{ref:o,role:"group","aria-roledescription":"slide",className:cn("oui-min-w-0 oui-shrink-0 oui-grow-0 oui-basis-full",a==="horizontal"?"oui-pl-4":"oui-pt-4",e),...t})});Q.displayName="CarouselItem";var ae=p.forwardRef(({className:e,variant:t="contained",size:o="icon",...a},n)=>{let{orientation:r,scrollPrev:l,canScrollPrev:i}=T();return jsxs(Button,{ref:n,variant:t,className:cn("oui-absolute oui-h-8 oui-w-8 oui-rounded-full",r==="horizontal"?"oui--left-12 oui-top-1/2 oui--translate-y-1/2":"oui--top-12 oui-left-1/2 oui--translate-x-1/2 oui-rotate-90",e),disabled:!i,onClick:l,...a,children:[jsx(ChevronLeft,{size:20}),jsx("span",{className:"oui-sr-only",children:"Previous slide"})]})});ae.displayName="CarouselPrevious";var se=p.forwardRef(({className:e,variant:t="contained",size:o="icon",...a},n)=>{let{orientation:r,scrollNext:l,canScrollNext:i}=T();return jsxs(Button,{ref:n,variant:t,className:cn("oui-absolute oui-h-8 oui-w-8 oui-rounded-full",r==="horizontal"?"oui--right-12 oui-top-1/2 oui--translate-y-1/2":"oui--bottom-12 oui-left-1/2 oui--translate-x-1/2 oui-rotate-90",e),disabled:!i,onClick:l,...a,children:[jsx(ChevronRight,{size:20}),jsx("span",{className:"oui-sr-only",children:"Next slide"})]})});se.displayName="CarouselNext";var ie=e=>{let{scrollSnaps:t,selectedIndex:o}=T();return jsx("div",{className:cn("oui-flex oui-gap-1",e.className),children:t.map((a,n)=>jsx(le,{index:n,active:n===o,onClick:e.onClick,className:e.dotClassName,activeClassName:e.dotActiveClassName},n))})};ie.displayName="CarouselIdentifier";var le=({index:e,active:t,onClick:o,className:a,activeClassName:n})=>jsx("button",{onClick:()=>o?.(e),className:cn("oui-w-2 oui-h-2 oui-rounded-full oui-bg-white/30",a,t&&`active ${n||"oui-bg-primary"}`)});var B=ne;B.Content=K;B.Item=Q;B.Next=se;B.Previous=ae;B.indentify=ie;var Me=e=>{let{shareOptions:t}=e,o=X(),[a,n]=useState(o.pnlFormat),[r,l]=useState(new Set(o.options)),[i,c]=useState(o.message),[s,u]=useState(o.bgIndex),{backgroundImages:h,...v}=t??{backgroundImages:[]},[M,S]=useState(""),b=t?.backgroundImages.map(()=>useRef(null));useEffect(()=>{let d=window.location.hostname;S(d);},[]);let I=Z(e.position,e.leverage,i,M,a,r,e.baseDp,e.quoteDp,e.referral),C=useRef(),P=552/310,[O,R]=useState(1),[z,g]=useState(0),[ee,w]=useState(!1),he=useRef(null);useEffect(()=>{if(C.current){let d=C.current.offsetWidth,_=d/P;g(_),R(d/552);}},[C,M]);let He=async d=>{if(!d.current)return;let _=d.current?.toDataURL(),qe=Mt(_);try{navigator.share&&await navigator.share({text:i,files:[new File([qe],"image.png",{type:"image/png"})]}),e.hide?.();}catch{}};return G(a,r,s,i),jsxs("div",{className:"oui-w-full",children:[jsx("div",{ref:C,className:"oui-w-full oui-mt-4 oui-overflow-hidden",style:{height:`${z+20}px`},children:jsxs(B,{className:"oui-w-full oui-overflow-hidden",opts:{align:"start"},initIndex:s,children:[jsx(K,{style:{height:`${z}px`},children:t?.backgroundImages.map((d,_)=>jsx(Q,{children:jsx(W,{className:"oui-transform oui-origin-top-left",style:{scale:`${O}`},width:552,height:310,data:{backgroundImg:d,...v,data:I},ratio:3,ref:b?.[_]})},_))}),jsx("div",{className:"oui-mt-2 oui-mb-1 oui-flex oui-justify-center",children:jsx(zt,{dotClassName:"oui-w-[16px] oui-h-[4px] oui-bg-base-300",dotActiveClassName:"!oui-bg-primary oui-w-[20px]",setSelectIndex:u})})]})}),jsxs(ScrollArea,{className:"oui-max-h-[200px] oui-overflow-y-auto",children:[jsxs("div",{className:"oui-mt-4",children:[jsx("div",{className:"oui-text-3xs oui-text-base-contrast-54",children:"PnL display format"}),jsxs("div",{className:"oui-pt-3 oui-px-1 oui-flex oui-justify-between oui-gap-3",children:[jsx(ue,{setPnlFormat:n,type:"roi_pnl",curType:a}),jsx(ue,{setPnlFormat:n,type:"roi",curType:a}),jsx(ue,{setPnlFormat:n,type:"pnl",curType:a})]})]}),jsxs("div",{className:"oui-mt-3",children:[jsx("div",{className:"oui-text-3xs oui-text-base-contrast-54 oui-h-[18px]",children:"Optional information to share"}),jsxs("div",{className:"oui-flex oui-flex-wrap oui-gap-3 oui-mt-3",children:[jsx(J,{setShareOption:l,type:"openPrice",curType:r}),jsx(J,{setShareOption:l,type:"openTime",curType:r}),jsx(J,{setShareOption:l,type:"leverage",curType:r}),jsx(J,{setShareOption:l,type:"markPrice",curType:r}),jsx(J,{setShareOption:l,type:"quantity",curType:r})]})]}),jsxs("div",{className:"oui-mt-3 oui-mb-8",children:[jsx("div",{className:"oui-text-3xs oui-text-base-contrast-54 oui-h-[18px]",children:"Your message"}),jsx("div",{className:"oui-mt-3 oui-h-[48px] oui-bg-base-600 oui-mx-1",children:jsx(Input,{placeholder:"Max 25 characters",containerClassName:"oui-bg-transparent oui-h-[48px]",value:i,autoFocus:!1,onChange:d=>{if(d.target.value.length>25){toast.error("Maximum support of 25 characters");return}c(d.target.value);},ref:he,onFocus:()=>w(!0),onBlur:()=>w(!1),suffix:ee&&jsx("button",{className:"oui-mr-3 oui-cursor-pointer",onMouseDown:d=>{c(""),setTimeout(()=>{he.current?.focus();},50),d.stopPropagation();},children:jsx(CloseCircleFillIcon,{size:18,color:"white"})})})})]})]}),jsx("div",{className:"oui-pt-2",children:jsx(Button,{fullWidth:!0,className:"oui-h-[40px] oui-text-[16px]",onClick:()=>{let d=b?.[s];d&&He(d);},children:"Share"})})]})},ue=e=>{let{type:t,curType:o,setPnlFormat:a}=e,n=useMemo(()=>{switch(t){case"roi_pnl":return "ROI & PnL";case"roi":return "ROI";case"pnl":return "PnL"}},[t]);return jsx("div",{className:cn("oui-shadow-lg oui-rounded-lg oui-h-[46px] oui-flex-1 oui-bg-base-4 hover:oui-cursor-pointer oui-flex oui-items-center oui-px-3 oui-referral-shadow",t===o&&"oui-bg-primary oui-dot-sel"),onClick:()=>{a(t);},children:jsx("div",{className:"oui-text-sm oui-text-base-contrast",children:n})})},J=e=>{let{type:t,curType:o,setShareOption:a}=e,n=useMemo(()=>{switch(t){case"openPrice":return "Open price";case"openTime":return "Opened at";case"markPrice":return "Mark price";case"quantity":return "Quantity";case"leverage":return "Leverage"}},[t]),r=o.has(t);return jsxs("div",{className:cn("oui-shadow-lg oui-rounded-lg oui-h-[46px] oui-mt-0 oui-w-[calc(50%-6px)] oui-bg-base-4 hover:oui-cursor-pointer oui-items-center oui-flex oui-p-3 oui-referral-shadow"),onClick:()=>{a(l=>{let i=new Set(l);return r?i.delete(t):i.add(t),i});},children:[jsx("div",{className:"oui-text-sm oui-flex-1 oui-text-base-contrast",children:n}),r&&jsx(_t,{})]})};function Mt(e){let t=atob(e.split(",")[1]),o=e.split(",")[0].split(":")[1].split(";")[0],a=new ArrayBuffer(t.length),n=new Uint8Array(a);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return new Blob([a],{type:o})}var zt=e=>{let{scrollSnaps:t,selectedIndex:o}=T();return useEffect(()=>{e.setSelectIndex(o);},[o]),jsx("div",{className:cn("oui-flex oui-gap-1"),children:t.map((a,n)=>jsx(le,{index:n,active:n===o,onClick:e.onClick,className:e.dotClassName,activeClassName:e.dotActiveClassName},n))})},_t=()=>jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M2.01416 11.9989C2.01416 6.47589 6.49136 1.9989 12.0142 1.9989C17.5372 1.9989 22.0142 6.47589 22.0142 11.9989C22.0142 17.5219 17.5372 21.9989 12.0142 21.9989C6.49136 21.9989 2.01416 17.5219 2.01416 11.9989ZM16.9853 7.31211C17.2125 7.09537 17.5236 7 17.8218 7C18.1201 7 18.4312 7.09537 18.6583 7.31211C19.1139 7.74546 19.1139 8.47384 18.6583 8.9072L10.5077 16.675C10.0534 17.1083 9.28909 17.1083 8.83472 16.675L5.34077 13.3459C4.88641 12.9126 4.88641 12.1841 5.34077 11.7508C5.79631 11.3175 6.56057 11.3175 7.01493 11.7508L9.67122 14.2822L16.9853 7.31211Z",fill:"white","fill-opacity":"1"})});var ze=e=>{let{leverage:t,position:o,baseDp:a,quoteDp:n,referralInfo:r,shareOptions:l,hide:i}=e,[c,s]=useState(window.innerHeight<900?660:807);return useEffect(()=>{let u=()=>{s(window.innerHeight<900?660:807);};return window.addEventListener("resize",u),()=>{window.removeEventListener("resize",u);}},[]),jsx(Oe,{position:o,leverage:`${t}`,hide:i,baseDp:a,quoteDp:n,referral:r,shareOptions:l})},_e=e=>{let{leverage:t,position:o,baseDp:a,quoteDp:n,referralInfo:r,shareOptions:l,hide:i}=e;return jsx(Me,{position:o,leverage:t,hide:i,baseDp:a,quoteDp:n,referral:r,shareOptions:l})};var de=e=>{let t=Y({hide:e.hide,pnl:e.pnl});return jsx(_e,{...t})},fe=e=>{let t=Y({hide:e.hide,pnl:e.pnl});return jsx(ze,{...t})};var Ut="sharePnLDialog",Wt="sharePnLBottomSheet";registerSimpleDialog(Ut,fe,{contentClassName:"!oui-max-w-[624px] oui-p-0"});registerSimpleSheet(Wt,de,{title:"Share PnL"});
|
|
10
|
+
|
|
11
|
+
export { Wt as SharePnLBottomSheetId, de as SharePnLBottomSheetWidget, Ut as SharePnLDialogId, fe as SharePnLDialogWidget, Y as useSharePnLScript };
|
|
12
|
+
//# sourceMappingURL=out.js.map
|
|
13
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/sharePnL/sharePnL.script.tsx","../src/sharePnL/sharePnL.ui.tsx","../src/sharePnL/desktop/content.tsx","../src/sharePnL/utils/utils.tsx","../src/sharePnL/poster/poster.tsx","../src/sharePnL/desktop/carousel.tsx","../src/sharePnL/desktop/buttons.tsx","../src/sharePnL/desktop/pnlFormat.tsx","../src/sharePnL/desktop/options.tsx","../src/sharePnL/desktop/checkbox.tsx","../src/sharePnL/desktop/message.tsx","../src/sharePnL/desktop/bottomBtns.tsx","../src/sharePnL/mobile/content.tsx","../src/sharePnL/carousel/carousel.tsx","../src/sharePnL/carousel/index.tsx","../src/sharePnL/sharePnL.widget.tsx"],"names":["registerSimpleDialog","registerSimpleSheet","useReferralInfo","useSymbolsInfo","useMemo","useSharePnLScript","props","pnl","hide","position","symbolInfo","getFirstRefCode","base_dp","quote_dp","referralInfo","code","useEffect","useState","useRef","Decimal","getPnLPosterData","leverage","message","domain","pnlType","options","baseDp","quoteDp","referral","symbol","currency","processSymbol","positionData","informations","key","formatFixed","formatOpenTime","data","formatShareTime","tokens","symbol1","symbol2","symbol3","input","date","formattedParts","year","part","month","day","hour","minute","value","dp","savePnlInfo","format","bgIndex","getPnlInfo","str","CloseIcon","Divider","Flex","toast","Text","Box","usePoster","forwardRef","useImperativeHandle","jsx","Poster","parentRef","width","height","className","style","ref","download","toDataURL","copy","toBlob","useEmblaCarousel","useCallback","jsxs","PrevButton","children","restProps","NextButton","cn","CarouselBackgroundImage","backgroundImages","selectedSnap","setSelectedSnap","emblaRef","emblaApi","onPrevButtonClick","onNextButtonClick","onSelect","e","index","PnlFormatView","type","curType","setPnlFormat","text","isSelected","clsName","RadioButton","SelIcon","UnselIcon","Checkbox","size","ShareOption","setShareOption","updateSet","checked","CloseCircleFillIcon","Input","Message","setMessage","check","setCheck","focus","setFocus","inputRef","Button","BottomButtons","onClickDownload","onClickCopy","DownloadIcon","CopyIcon","DesktopSharePnLContent","shareOptions","localPnlConfig","pnlFormat","shareOption","resetOptions","setDomain","posterRef","currentDomain","curBgImg","posterData","onCopy","onDownload","formats","item","ScrollArea","React","CarouselContext","useCarousel","context","Carousel","orientation","opts","setApi","plugins","carouselRef","api","canScrollPrev","setCanScrollPrev","canScrollNext","setCanScrollNext","selectedIndex","setSelectedIndex","scrollSnaps","setScrollSnaps","scrollPrev","scrollNext","handleKeyDown","event","CarouselContent","CarouselItem","CarouselPrevious","variant","CarouselNext","CarouselIdentifier","_","Dot","active","onClick","activeClassName","MobileSharePnLContent","selectIndex","setSelectIndex","posterRefs","aspectRatio","scale","setScale","carouselHeight","setCarouselHeight","divWidth","divHeight","onSharePnL","blob","dataURItoBlob","MyIdentifier","ChoicesFillIcon","dataURI","byteString","mimeString","ab","ia","i","DesktopSharePnL","viewportHeight","setViewportHeight","handleResize","MobileSharePnL","SharePnLBottomSheetWidget","state","SharePnLDialogWidget","SharePnLDialogId","SharePnLBottomSheetId"],"mappings":"AAAA,OAAS,wBAAAA,GAAsB,uBAAAC,OAA2B,sBCA1D,OAAS,mBAAAC,GAAiB,kBAAAC,OAAsB,yBAChD,OAAS,WAAAC,OAAe,QAGjB,IAAMC,EAAqBC,GAG5B,CACJ,GAAM,CAAE,IAAAC,EAAK,KAAAC,CAAK,EAAIF,EAChBG,EAAWF,GAAK,SAChBG,EAAaP,GAAe,EAC5B,CAAE,gBAAAQ,CAAgB,EAAIT,GAAgB,EACtCU,EAAUF,EAAWD,GAAU,MAAM,EAAE,SAAS,EAChDI,EAAWH,EAAWD,GAAU,MAAM,EAAE,UAAU,EAElDK,EAAeV,GAAQ,IAAgC,CAC3D,IAAMW,EAAOJ,EAAgB,GAAG,KAOhC,MANa,CACX,KAAMJ,GAAK,SAAWQ,EACtB,OAAQR,GAAK,UACb,KAAMA,GAAK,OACb,CAGF,EAAG,CAACI,EAAiBJ,CAAG,CAAC,EACzB,MAAO,CACL,SAAAE,EACA,SAAUF,GAAK,SACf,OAAOK,EACP,QAAQC,EACR,aAAAC,EACA,aAAcP,EACd,KAAAC,CACF,CACF,EClCA,OAAgC,aAAAQ,GAAW,YAAAC,OAAgB,QCA3D,OAAa,aAAAD,GAAW,WAAAZ,GAAS,UAAAc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AAU,IAAM,CACd,IAAM6L,EAAe,IAAM,CACzBD,EAAkB,OAAO,YAAc,IAAM,IAAM,GAAG,CACxD,EAEA,cAAO,iBAAiB,SAAUC,CAAY,EAEvC,IAAM,CACX,OAAO,oBAAoB,SAAUA,CAAY,CACnD,CACF,EAAG,CAAC,CAAC,EAEHzI,GAAC8D,GAAA,CACC,SAAUzH,EACV,SAAU,GAAGY,CAAQ,GACrB,KAAMb,EACN,OAAQkB,EACR,QAASC,EACT,SAAUb,EACV,aAAcqH,EAChB,CAEJ,EAEa2E,GAAqCxM,GAAU,CAC1D,GAAM,CACJ,SAAAe,EACA,SAAAZ,EACA,OAAAiB,EACA,QAAAC,EACA,aAAAb,EACA,aAAAqH,EACA,KAAA3H,CACF,EAAIF,EAEJ,OACE8D,GAACgH,GAAA,CACC,SAAU3K,EACV,SAAUY,EACV,KAAMb,EACN,OAAQkB,EACR,QAASC,EACT,SAAUb,EACV,aAAcqH,EAChB,CAEJ,EctDS,cAAA/D,OAAA,oBARF,IAAM2I,GAA6BzM,GAGpC,CACJ,IAAM0M,EAAQ3M,EAAkB,CAC9B,KAAMC,EAAM,KACZ,IAAKA,EAAM,GACb,CAAC,EACD,OAAO8D,GAAC0I,GAAA,CAAgB,GAAGE,EAAO,CACpC,EAEaC,GAAwB3M,GAG/B,CACJ,IAAM0M,EAAQ3M,EAAkB,CAC9B,KAAMC,EAAM,KACZ,IAAKA,EAAM,GACb,CAAC,EACD,OAAO8D,GAACsI,GAAA,CAAiB,GAAGM,EAAO,CACrC,EhBnBA,IAAME,GAAmB,iBACnBC,GAAwB,sBAE9BnN,GAAqBkN,GAAkBD,GAAsB,CAG3D,iBAAkB,4BACpB,CAAC,EAEDhN,GAAoBkN,GAAuBJ,GAA2B,CACpE,MAAO,WACT,CAAC","sourcesContent":["import { registerSimpleDialog, registerSimpleSheet } from \"@orderly.network/ui\";\nimport {\n SharePnLDialogWidget,\n SharePnLBottomSheetWidget,\n} from \"./sharePnL/sharePnL.widget\";\n\nconst SharePnLDialogId = \"sharePnLDialog\";\nconst SharePnLBottomSheetId = \"sharePnLBottomSheet\";\n\nregisterSimpleDialog(SharePnLDialogId, SharePnLDialogWidget, {\n // title: \"Max account leverage\",\n // size: \"2xl\",\n contentClassName: \"!oui-max-w-[624px] oui-p-0\",\n});\n\nregisterSimpleSheet(SharePnLBottomSheetId, SharePnLBottomSheetWidget, {\n title: \"Share PnL\",\n});\n\nexport * from \"./sharePnL\";\nexport { SharePnLDialogId, SharePnLBottomSheetId };\nexport type { SharePnLConfig, SharePnLParams } from \"./types/types\";\n","import { useReferralInfo, useSymbolsInfo } from \"@orderly.network/hooks\";\nimport { useMemo } from \"react\";\nimport { ReferralType, SharePnLConfig, SharePnLParams } from \"../types/types\";\n\nexport const useSharePnLScript = (props: {\n pnl?: (SharePnLConfig & SharePnLParams) | undefined;\n hide?: () => void;\n}) => {\n const { pnl, hide } = props;\n const position = pnl?.position;\n const symbolInfo = useSymbolsInfo();\n const { getFirstRefCode } = useReferralInfo();\n const base_dp = symbolInfo[position?.symbol](\"base_dp\");\n const quote_dp = symbolInfo[position?.symbol](\"quote_dp\");\n\n const referralInfo = useMemo((): ReferralType | undefined => {\n const code = getFirstRefCode()?.code;\n const info = {\n code: pnl?.refCode ?? code,\n slogan: pnl?.refSlogan,\n link: pnl?.refLink,\n };\n\n return info;\n }, [getFirstRefCode, pnl]);\n return {\n position,\n leverage: pnl?.leverage,\n baseDp:base_dp,\n quoteDp:quote_dp,\n referralInfo,\n shareOptions: pnl as SharePnLConfig,\n hide,\n };\n};\n\nexport type SharePnLState = ReturnType<typeof useSharePnLScript>;\n","import { FC, PropsWithChildren, useEffect, useState } from \"react\";\nimport { Box } from \"@orderly.network/ui\";\nimport { SharePnLState } from \"./sharePnL.script\";\nimport { DesktopSharePnLContent } from \"./desktop/content\";\nimport { MobileSharePnLContent } from \"./mobile/content\";\n\nexport const DesktopSharePnL: FC<SharePnLState> = (props) => {\n const {\n leverage,\n position,\n baseDp,\n quoteDp,\n referralInfo,\n shareOptions,\n hide,\n } = props;\n\n const [viewportHeight, setViewportHeight] = useState(\n window.innerHeight < 900 ? 660 : 807\n );\n\n useEffect(() => {\n const handleResize = () => {\n setViewportHeight(window.innerHeight < 900 ? 660 : 807);\n };\n\n window.addEventListener(\"resize\", handleResize);\n\n return () => {\n window.removeEventListener(\"resize\", handleResize);\n };\n }, []);\n return (\n <DesktopSharePnLContent\n position={position}\n leverage={`${leverage}`}\n hide={hide}\n baseDp={baseDp}\n quoteDp={quoteDp}\n referral={referralInfo}\n shareOptions={shareOptions}\n />\n );\n};\n\nexport const MobileSharePnL: FC<SharePnLState> = (props) => {\n const {\n leverage,\n position,\n baseDp,\n quoteDp,\n referralInfo,\n shareOptions,\n hide,\n } = props;\n\n return (\n <MobileSharePnLContent\n position={position}\n leverage={leverage}\n hide={hide}\n baseDp={baseDp}\n quoteDp={quoteDp}\n referral={referralInfo}\n shareOptions={shareOptions}\n />\n );\n};\n","import { FC, useEffect, useMemo, useRef, useState } from \"react\";\nimport {\n PnLDisplayFormat,\n ReferralType,\n ShareOptions,\n SharePnLConfig,\n} from \"../../types/types\";\nimport { getPnlInfo, getPnLPosterData, savePnlInfo } from \"../utils/utils\";\nimport { CloseIcon, Divider, Flex, toast, Text, Box } from \"@orderly.network/ui\";\nimport { Poster } from \"../poster\";\nimport { CarouselBackgroundImage } from \"./carousel\";\nimport { PnlFormatView } from \"./pnlFormat\";\nimport { ShareOption } from \"./options\";\nimport { Message } from \"./message\";\nimport { BottomButtons } from \"./bottomBtns\";\nimport { PosterRef } from \"../poster/poster\";\n\nexport const DesktopSharePnLContent: FC<{\n position: any;\n leverage: number | string;\n hide: any;\n baseDp?: number;\n quoteDp?: number;\n referral?: ReferralType;\n shareOptions: SharePnLConfig;\n}> = (props) => {\n const { shareOptions } = props;\n const localPnlConfig = getPnlInfo();\n\n const [pnlFormat, setPnlFormat] = useState<PnLDisplayFormat>(\n localPnlConfig.pnlFormat\n );\n const [shareOption, setShareOption] = useState<Set<ShareOptions>>(\n new Set(localPnlConfig.options)\n );\n const [selectedSnap, setSelectedSnap] = useState(localPnlConfig.bgIndex);\n const [message, setMessage] = useState(localPnlConfig.message);\n const [check, setCheck] = useState(false);\n // const { shareOptions } = useTradingPageContext();\n const { backgroundImages, ...resetOptions } = shareOptions ?? {\n backgroundImages: [],\n };\n\n const [domain, setDomain] = useState(\"\");\n\n const posterRef = useRef<PosterRef | null>(null);\n\n useEffect(() => {\n const currentDomain = window.location.hostname;\n setDomain(currentDomain);\n }, []);\n\n const curBgImg = useMemo(() => {\n return shareOptions?.backgroundImages[selectedSnap];\n }, [shareOptions?.backgroundImages, selectedSnap]);\n\n const posterData = getPnLPosterData(\n props.position,\n props.leverage,\n check ? message : \"\",\n domain,\n pnlFormat,\n shareOption,\n props.baseDp,\n props.quoteDp,\n props.referral\n );\n\n console.log(\"posterData is\", posterData);\n\n const onCopy = () => {\n posterRef.current\n ?.copy()\n .then(() => {\n props.hide?.();\n toast.success(\"Image copied\");\n })\n .catch((e: any) => {\n toast.error(() => {\n return (\n <div>\n <div>Copy failed</div>\n <div className=\"oui-text-2xs oui-max-w-[396px] oui-mt-2 oui-text-base-contrast-54\">\n Browser version outdated, please update in order to copy image\n to clipboard.\n </div>\n </div>\n );\n });\n });\n };\n const onDownload = () => {\n posterRef.current?.download(\"Poster.png\");\n props.hide?.();\n };\n\n const formats: PnLDisplayFormat[] = [\"roi_pnl\", \"roi\", \"pnl\"];\n const options: ShareOptions[] = [\n \"openPrice\",\n \"markPrice\",\n \"openTime\",\n \"leverage\",\n \"quantity\",\n ];\n\n savePnlInfo(pnlFormat, shareOption, selectedSnap, message);\n\n return (\n <div className=\"oui-h-full oui-flex oui-flex-col oui-relative oui-w-full\">\n <div className=\"oui-flex-1 oui-h-full oui-overflow-y-auto\">\n <Box mt={9} height={422} >\n <Flex itemAlign={\"center\"} justify={\"center\"}>\n <Poster\n // className=\"oui-mx-11\"\n width={552}\n height={310}\n data={{\n backgroundImg: curBgImg,\n ...resetOptions,\n data: posterData,\n }}\n ratio={3}\n ref={posterRef}\n />\n </Flex>\n <CarouselBackgroundImage\n backgroundImages={shareOptions?.backgroundImages ?? []}\n selectedSnap={selectedSnap}\n setSelectedSnap={setSelectedSnap}\n />\n </Box>\n\n <Flex\n direction={\"column\"}\n px={10}\n mt={6}\n justify={\"start\"}\n itemAlign={\"start\"}\n width={\"100%\"}\n >\n <Text size=\"sm\" intensity={80}>\n PnL display format\n </Text>\n <Flex pt={3} gap={3} itemAlign={\"center\"}>\n {formats.map((e) => (\n <PnlFormatView\n setPnlFormat={setPnlFormat}\n type={e}\n curType={pnlFormat}\n />\n ))}\n </Flex>\n\n <Divider className=\"oui-w-full oui-pt-6 oui-border-white/10\" />\n\n <Flex\n mt={6}\n direction={\"column\"}\n justify={\"start\"}\n itemAlign={\"start\"}\n >\n <Text size=\"sm\" intensity={80}>\n Optional information to share\n </Text>\n <Flex mt={3} gap={4}>\n {options.map((item) => (\n <ShareOption\n setShareOption={setShareOption}\n type={item}\n curType={shareOption}\n />\n ))}\n </Flex>\n </Flex>\n\n <Message\n message={message}\n setMessage={setMessage}\n check={check}\n setCheck={setCheck}\n />\n </Flex>\n </div>\n\n <BottomButtons onClickCopy={onCopy} onClickDownload={onDownload} />\n\n <button\n onClick={() => {\n props.hide();\n }}\n className=\"oui-absolute oui-top-0 oui-right-0 oui-w-[40px] oui-h-[40px] oui-flex oui-justify-center oui-items-center\"\n >\n <CloseIcon size={12} className=\"oui-fill-base-contrast-54\" />\n </button>\n </div>\n );\n};\n","/*\n{\n message: \"I am the Orderly KING.\",\n domain: \"ordely.network\",\n updateTime: \"2022-JAN-01 23:23\",\n position: {\n symbol: \"BTC-PERP\",\n currency: \"USDC\",\n side: \"LONG\",\n leverage: 20,\n pnl: 10432.23,\n ROI: 20.25,\n informations: [\n { title: \"Open Price\", value: 0.12313 },\n { title: \"Opened at\", value: \"Jan-01 23:23\" },\n { title: \"Mark price\", value: \"0.12341\" },\n { title: \"Quantity\", value: \"0.123\" },\n ],\n },\n referral: {\n code: \"WRECKED\",\n link: \"https://orderly.network\",\n slogan: \"Try Orderly now with:\",\n }\n }\n*/\n\nimport { Decimal } from \"@orderly.network/utils\";\nimport { PnLDisplayFormat, ShareOptions } from \"../../types/types\";\n// import { PnLDisplayFormat, ShareOptions } from \"./type\";\n\nexport type ReferralType = {\n code?: string;\n link?: string;\n slogan?: string;\n};\n\nexport function getPnLPosterData(\n position: any,\n leverage: number | string,\n message: string,\n domain: string,\n pnlType: PnLDisplayFormat,\n options: Set<ShareOptions>,\n baseDp?: number,\n quoteDp?: number,\n referral?: ReferralType\n) {\n const { symbol, currency } = processSymbol(position.symbol);\n const positionData: any = {\n symbol,\n currency,\n side: position.position_qty > 0 ? \"LONG\" : \"SHORT\",\n };\n\n switch (pnlType) {\n case \"pnl\": {\n if (\"unrealized_pnl\" in position) {\n positionData[\"pnl\"] = new Decimal(position.unrealized_pnl).toFixed(\n 2,\n Decimal.ROUND_DOWN\n );\n }\n break;\n }\n case \"roi\": {\n if (\"unrealized_pnl_ROI\" in position) {\n positionData[\"ROI\"] = new Decimal(\n position.unrealized_pnl_ROI * 100\n ).toFixed(2, Decimal.ROUND_DOWN);\n }\n break;\n }\n case \"roi_pnl\": {\n if (\"unrealized_pnl\" in position) {\n positionData[\"pnl\"] = new Decimal(position.unrealized_pnl).toFixed(\n 2,\n Decimal.ROUND_DOWN\n );\n }\n if (\"unrealized_pnl_ROI\" in position) {\n positionData[\"ROI\"] = new Decimal(\n position.unrealized_pnl_ROI * 100\n ).toFixed(2, Decimal.ROUND_DOWN);\n }\n break;\n }\n }\n\n const informations: { title: string; value: any }[] = [];\n\n if (options.has(\"leverage\")) {\n positionData[\"leverage\"] = leverage;\n }\n const array: ShareOptions[] = [\n \"openPrice\",\n \"openTime\",\n \"markPrice\",\n \"quantity\",\n ];\n array.forEach((key) => {\n if (options.has(key)) {\n switch (key) {\n case \"leverage\": {\n break;\n }\n case \"openPrice\": {\n informations.push({\n title: \"Open price\",\n value: formatFixed(position.average_open_price, quoteDp || 2),\n });\n break;\n }\n case \"openTime\": {\n informations.push({\n title: \"Opened at\",\n value: formatOpenTime(position.timestamp),\n });\n break;\n }\n case \"markPrice\": {\n informations.push({\n title: \"Mark price\",\n value: formatFixed(position.mark_price, quoteDp || 2),\n });\n break;\n }\n case \"quantity\": {\n informations.push({\n title: \"Quantity\",\n value: formatFixed(position.position_qty, baseDp || 2),\n });\n }\n default:\n break;\n }\n }\n });\n\n positionData[\"informations\"] = informations;\n\n const data: any = {\n position: positionData,\n updateTime: formatShareTime(new Date()),\n domain,\n };\n if (message.length > 0) {\n data[\"message\"] = message;\n }\n\n if (typeof referral !== \"undefined\" && referral[\"code\"] !== undefined) {\n data[\"referral\"] = referral;\n }\n\n return data;\n}\n\ninterface SymbolResult {\n symbol: string;\n currency: string;\n}\n\nfunction processSymbol(symbol: string): SymbolResult {\n const tokens = symbol.split(\"_\");\n if (tokens.length !== 3) {\n return {\n symbol: symbol,\n currency: \"USDC\",\n };\n }\n\n const [symbol1, symbol2, symbol3] = tokens;\n const formattedString = `${symbol2}-${symbol1}`;\n\n return {\n symbol: formattedString,\n currency: symbol3 || \"USDC\",\n };\n}\n\nfunction formatShareTime(input: number): string;\nfunction formatShareTime(input: Date): string;\nfunction formatShareTime(input: number | Date): string {\n const date = input instanceof Date ? input : new Date(input);\n const options: Intl.DateTimeFormatOptions = {\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n hourCycle: \"h24\",\n };\n\n const formatter = new Intl.DateTimeFormat(\"en-US\", options);\n const formattedParts = formatter.formatToParts(date);\n\n // console.log(\"formattedParts\", formattedParts);\n\n const year = formattedParts.find((part) =>\n part.type === \"year\" ? part.value : \"\"\n )?.value;\n const month = formattedParts.find((part) =>\n part.type === \"month\" ? part.value : \"\"\n )?.value;\n const day = formattedParts.find((part) =>\n part.type === \"day\" ? part.value : \"\"\n )?.value;\n const hour = formattedParts.find((part) =>\n part.type === \"hour\" ? part.value : \"\"\n )?.value;\n const minute = formattedParts.find((part) =>\n part.type === \"minute\" ? part.value : \"\"\n )?.value;\n\n return `${year}-${month}-${day} ${hour}:${minute}`;\n}\n\nfunction formatOpenTime(input: number | Date): string {\n const date = input instanceof Date ? input : new Date(input);\n const options: Intl.DateTimeFormatOptions = {\n year: \"numeric\",\n month: \"short\",\n day: \"2-digit\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n };\n\n const formatter = new Intl.DateTimeFormat(\"en-US\", options);\n const formattedParts = formatter.formatToParts(date);\n\n // console.log(\"formattedParts\", formattedParts);\n\n const month = formattedParts.find((part) =>\n part.type === \"month\" ? part.value : \"\"\n )?.value;\n const day = formattedParts.find((part) =>\n part.type === \"day\" ? part.value : \"\"\n )?.value;\n const hour = formattedParts.find((part) =>\n part.type === \"hour\" ? part.value : \"\"\n )?.value;\n const minute = formattedParts.find((part) =>\n part.type === \"minute\" ? part.value : \"\"\n )?.value;\n\n return `${month}-${day} ${hour}:${minute}`;\n}\n\nfunction formatFixed(value: number, dp: number) {\n return new Decimal(value).toFixed(dp, Decimal.ROUND_DOWN);\n}\n\nexport function savePnlInfo(\n format: PnLDisplayFormat,\n options: Set<ShareOptions>,\n bgIndex: number,\n message: string\n) {\n localStorage.setItem(\n \"pnl_config_key\",\n JSON.stringify({\n bgIndex: bgIndex,\n pnlFormat: format,\n options: Array.from(options),\n message: message,\n })\n );\n}\n\nexport function getPnlInfo(): {\n bgIndex: number;\n pnlFormat: PnLDisplayFormat;\n options: ShareOptions[];\n message: \"\";\n} {\n const str = localStorage.getItem(\"pnl_config_key\");\n\n if (str && str.length > 0) {\n try {\n const json = JSON.parse(str);\n console.log(\"local json\", json);\n\n return json;\n } catch (e) {}\n }\n return {\n bgIndex: 0,\n pnlFormat: \"roi_pnl\",\n options: [\"openPrice\", \"openTime\", \"markPrice\", \"quantity\", \"leverage\"],\n message: \"\",\n };\n}\n","import { type DrawOptions, usePoster } from \"@orderly.network/hooks\";\nimport { FC, forwardRef, useImperativeHandle } from \"react\";\n\nexport type PosterProps = {\n width: number;\n height: number;\n className?: string;\n ratio?: number;\n data: DrawOptions;\n style?: React.CSSProperties;\n};\n\nexport type PosterRef = {\n download: (filename: string, type?: string, encoderOptions?: number) => void;\n toDataURL: (type?: string, encoderOptions?: number) => string;\n toBlob: (type?: string, encoderOptions?: number) => Promise<Blob | null>;\n copy: () => Promise<void>;\n};\n\nexport const Poster = forwardRef<PosterRef, PosterProps>((props, parentRef) => {\n const { width, height, className, data, style } = props;\n\n const { ref, download, toDataURL, copy, toBlob } = usePoster(data, {\n ratio: props.ratio,\n });\n\n useImperativeHandle(parentRef, () => ({\n download,\n toDataURL,\n toBlob,\n copy,\n }));\n\n return (\n <canvas\n ref={ref}\n width={width}\n height={height}\n className={className}\n style={style}\n />\n );\n});\n","import useEmblaCarousel from \"embla-carousel-react\";\nimport { FC, useCallback, useEffect } from \"react\";\nimport { NextButton, PrevButton } from \"./buttons\";\nimport { Box, cn, Flex } from \"@orderly.network/ui\";\n\nexport const CarouselBackgroundImage: FC<{\n backgroundImages: string[];\n selectedSnap: number;\n setSelectedSnap: any;\n}> = (props) => {\n const { backgroundImages, selectedSnap, setSelectedSnap } = props;\n\n const [emblaRef, emblaApi] = useEmblaCarousel({\n // loop: true,\n containScroll: \"keepSnaps\",\n dragFree: true,\n });\n\n const onPrevButtonClick = useCallback(() => {\n if (!emblaApi) return;\n emblaApi.scrollPrev();\n }, [emblaApi]);\n\n const onNextButtonClick = useCallback(() => {\n if (!emblaApi) return;\n emblaApi.scrollNext();\n }, [emblaApi]);\n\n const onSelect = useCallback((emblaApi: any) => {\n // setPrevBtnDisabled(!emblaApi.canScrollPrev());\n // setNextBtnDisabled(!emblaApi.canScrollNext());\n setSelectedSnap(emblaApi.selectedScrollSnap());\n }, []);\n\n useEffect(() => {\n if (!emblaApi) return;\n\n onSelect(emblaApi);\n emblaApi.on(\"reInit\", onSelect);\n emblaApi.on(\"select\", onSelect);\n emblaApi?.scrollTo(selectedSnap);\n }, [emblaApi, onSelect]);\n\n return (\n <Flex mt={4} px={2} >\n <PrevButton onClick={onPrevButtonClick} />\n <div\n ref={emblaRef}\n className=\"oui-w-full oui-overflow oui-overflow-x-auto oui-scrollbar-hidden oui-hide-scrollbar oui-mx-0\"\n >\n <Flex>\n {backgroundImages.map((e, index) => (\n <Box\n key={e}\n onClick={() => {\n\n emblaApi?.scrollTo(index);\n }}\n mx={2}\n my={1}\n mr={6}\n r=\"base\"\n className={cn(\n \"oui-shrink-0 oui-w-[162px]\",\n selectedSnap === index &&\n \"oui-outline oui-outline-1 oui-outline-primary\"\n )}\n >\n <img src={e} className=\"oui-rounded-sm\" />\n </Box>\n ))}\n </Flex>\n </div>\n <NextButton onClick={onNextButtonClick} />\n </Flex>\n );\n};\n","import { FC, PropsWithChildren } from \"react\";\n\ntype PropType = PropsWithChildren<\n React.DetailedHTMLProps<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n HTMLButtonElement\n >\n>;\n\nexport const PrevButton: FC<PropType> = (props) => {\n const { children, ...restProps } = props;\n\n return (\n <button {...restProps}>\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <rect width=\"20\" height=\"20\" rx=\"10\" fill=\"#333948\" />\n <path\n d=\"M11.186 5.348a.67.67 0 0 0-.436.27l-2.657 4a.69.69 0 0 0 0 .75l2.657 4a.68.68 0 0 0 .934.188.685.685 0 0 0 .187-.937L9.463 9.993 11.87 6.37a.685.685 0 0 0-.187-.938.65.65 0 0 0-.498-.083\"\n fill=\"#fff\"\n fillOpacity=\".54\"\n />\n </svg>\n </button>\n );\n};\n\nexport const NextButton: FC<PropType> = (props) => {\n const { children, ...restProps } = props;\n\n return (\n <button {...restProps}>\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 20 20\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <rect width=\"20\" height=\"20\" rx=\"10\" fill=\"#333948\" />\n <path\n d=\"M8.777 5.348a.65.65 0 0 0-.498.083.685.685 0 0 0-.187.938L10.5 9.993 8.092 13.62a.685.685 0 0 0 .187.937.68.68 0 0 0 .934-.187l2.657-4a.69.69 0 0 0 0-.75l-2.657-4a.67.67 0 0 0-.436-.271\"\n fill=\"#fff\"\n fillOpacity=\".54\"\n />\n </svg>\n </button>\n );\n};\n","import { FC, useMemo } from \"react\";\nimport { PnLDisplayFormat } from \"../../types/types\";\nimport { Text, cn } from \"@orderly.network/ui\";\n\nexport const PnlFormatView: FC<{\n type: PnLDisplayFormat;\n curType?: PnLDisplayFormat;\n setPnlFormat: any;\n}> = (props) => {\n const { type, curType, setPnlFormat } = props;\n\n const text = useMemo(() => {\n switch (type) {\n case \"roi_pnl\":\n return \"ROI & PnL\";\n case \"roi\":\n return \"ROI\";\n case \"pnl\":\n return \"PnL\";\n }\n }, [type]);\n\n const isSelected = type === curType;\n\n let clsName = \"oui-flex oui-items-center oui-gap-1 oui-cursor-pointer\";\n if (isSelected) {\n clsName += \" oui-text-base-contrast\";\n } else {\n clsName += \"\";\n }\n\n return (\n <div\n className={clsName}\n onClick={() => {\n setPnlFormat(type);\n }}\n >\n <RadioButton sel={isSelected} />\n <Text\n size=\"xs\"\n intensity={54}\n className={cn(\n \"oui-ml-2 \",\n // isSelected && \"oui-text-base-contrast\"\n )}\n >\n {text}\n </Text>\n </div>\n );\n};\n\nconst RadioButton = (props: {\n sel?: boolean;\n // onChange?: (sel: boolean) => void;\n}) => {\n return (\n <button\n type=\"button\"\n // onClick={(e) => {\n // e.stopPropagation();\n // }}\n >\n {props.sel === true ? <SelIcon /> : <UnselIcon />}\n </button>\n );\n};\n\nconst SelIcon = () => {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"currentColor\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"oui-fill-primary\"\n >\n <path\n d=\"M8.01 1.333a6.667 6.667 0 1 0 0 13.333 6.667 6.667 0 0 0 0-13.333m0 1.333a5.334 5.334 0 1 1-.001 10.667 5.334 5.334 0 0 1 0-10.667\"\n fill=\"#fff\"\n fillOpacity=\".36\"\n />\n <circle cx=\"8\" cy=\"8\" r=\"3.333\" />\n </svg>\n );\n};\n\nconst UnselIcon = () => {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M8.01 1.333a6.667 6.667 0 1 0 0 13.333 6.667 6.667 0 0 0 0-13.333m0 1.333a5.334 5.334 0 1 1-.001 10.667 5.334 5.334 0 0 1 0-10.667\"\n fill=\"#fff\"\n fillOpacity=\".54\"\n />\n </svg>\n );\n};\n","import { FC, useMemo } from \"react\";\nimport { ShareOptions } from \"../../types/types\";\nimport { Flex, Text, cn } from \"@orderly.network/ui\";\nimport { Checkbox } from \"./checkbox\";\n\nexport const ShareOption: FC<{\n type: ShareOptions;\n curType: Set<ShareOptions>;\n setShareOption: any;\n}> = (props) => {\n const { type, curType, setShareOption } = props;\n\n const text = useMemo(() => {\n switch (type) {\n case \"openPrice\":\n return \"Open price\";\n case \"openTime\":\n return \"Opened at\";\n case \"markPrice\":\n return \"Mark price\";\n case \"quantity\":\n return \"Quantity\";\n case \"leverage\":\n return \"Leverage\";\n }\n }, [type]);\n\n const isSelected = curType.has(type);\n\n return (\n <Flex\n itemAlign={\"center\"}\n gap={1}\n className={cn(\"hover:oui-cursor-pointer\")}\n onClick={() => {\n // setPnlFormat(type);\n setShareOption((value: Set<ShareOptions>) => {\n const updateSet = new Set(value);\n if (isSelected) {\n updateSet.delete(type);\n } else {\n updateSet.add(type);\n }\n return updateSet;\n });\n }}\n >\n <Checkbox\n size={16}\n checked={isSelected}\n className=\"oui-pt-[2px]\"\n onCheckedChange={(checked: boolean) => {\n setShareOption((value: Set<ShareOptions>) => {\n const updateSet = new Set(value);\n if (isSelected) {\n updateSet.delete(type);\n } else {\n updateSet.add(type);\n }\n return updateSet;\n });\n }}\n />\n\n <Text size=\"xs\" intensity={54} >\n {text}\n </Text>\n </Flex>\n );\n};\n","export const Checkbox = (props: {\n size?: number;\n className?: string;\n checked: boolean;\n onCheckedChange: (checked: boolean) => void;\n}) => {\n const { size = 16, className } = props;\n return (\n <button\n type=\"button\"\n onClick={(e) => {\n props.onCheckedChange(!props.checked);\n }}\n className={className}\n >\n {props.checked ? (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M4.66 1.953A2.667 2.667 0 0 0 1.995 4.62v6.667a2.667 2.667 0 0 0 2.667 2.666h6.666a2.667 2.667 0 0 0 2.667-2.666V4.62a2.667 2.667 0 0 0-2.667-2.667zm6.664 2.922a.8.8 0 0 1 .557-.208c.2 0 .406.063.558.208a.734.734 0 0 1 0 1.063l-5.434 5.179a.826.826 0 0 1-1.115 0l-2.33-2.22a.736.736 0 0 1 0-1.063.827.827 0 0 1 1.117 0l1.77 1.687z\"\n fill=\"#fff\"\n fillOpacity=\".8\"\n />\n </svg>\n ) : (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M4.66 1.953A2.667 2.667 0 0 0 1.995 4.62v6.667a2.667 2.667 0 0 0 2.667 2.666h6.666a2.667 2.667 0 0 0 2.667-2.666V4.62a2.667 2.667 0 0 0-2.667-2.667zm0 1.334h6.667c.737 0 1.334.596 1.334 1.333v6.667c0 .736-.597 1.333-1.334 1.333H4.661a1.333 1.333 0 0 1-1.334-1.333V4.62c0-.737.597-1.333 1.334-1.333\"\n fill=\"#fff\"\n fillOpacity=\".8\"\n />\n </svg>\n )}\n </button>\n );\n};\n","import {\n CloseCircleFillIcon,\n Input,\n toast,\n} from \"@orderly.network/ui\";\nimport { FC, useRef, useState } from \"react\";\nimport { Checkbox } from \"./checkbox\";\n\nexport const Message: FC<{\n message: string;\n setMessage: any;\n check: boolean;\n setCheck: any;\n}> = (props) => {\n const { message, setMessage, check, setCheck } = props;\n const [focus, setFocus] = useState(false);\n const inputRef = useRef<HTMLInputElement | null>(null);\n return (\n <div className=\"oui-mt-3 oui-mb-6 oui-flex oui-items-center\">\n <Checkbox\n className=\"oui-mt-[2px]\"\n checked={check}\n onCheckedChange={(e: boolean) => {\n setCheck(e);\n }}\n />\n <div\n className=\"oui-text-xs oui-text-base-contrast-54 oui-ml-1 hover:oui-cursor-pointer\"\n onClick={() => {\n setCheck(!props.check);\n }}\n >\n Your message\n </div>\n <div className=\"oui-bg-base-900 oui-mx-2 oui-rounded-sm\">\n <Input\n ref={inputRef}\n placeholder=\"Max 25 characters\"\n classNames={{\n root: \"oui-w-[320px]\"\n }}\n size=\"sm\"\n value={message}\n autoFocus={false}\n suffix={\n focus && (\n <button\n className=\"oui-mr-3 oui-cursor-pointer\"\n onMouseDown={(e) => {\n console.log(\"set message to empty\");\n\n setMessage(\"\");\n setTimeout(() => {\n inputRef.current?.focus();\n }, 50);\n e.stopPropagation();\n }}\n >\n <CloseCircleFillIcon size={18} color=\"white\" />\n </button>\n )\n }\n onFocus={() => setFocus(true)}\n onBlur={() => setFocus(false)}\n onChange={(e) => {\n if (e.target.value.length > 25) {\n toast.error(\"Maximum support of 25 characters\");\n return;\n }\n setCheck(e.target.value.length > 0);\n setMessage(e.target.value);\n }}\n />\n </div>\n </div>\n );\n};\n","import { FC } from \"react\";\nimport { Button, Flex } from \"@orderly.network/ui\";\n\nexport const BottomButtons: FC<{\n onClickDownload: any;\n onClickCopy: any;\n}> = (props) => {\n const { onClickDownload, onClickCopy } = props;\n\n return (\n <Flex px={8} gap={3} mt={3} itemAlign={\"center\"} >\n <Button\n color={\"secondary\"}\n className=\"oui-flex-1 oui-flex oui-gap-1\"\n onClick={onClickDownload}\n >\n <span>\n <DownloadIcon />\n </span>\n Download\n </Button>\n\n <Button\n className=\"oui-flex-1 oui-flex oui-gap-1\"\n onClick={onClickCopy}\n >\n <span>\n <CopyIcon />\n </span>\n Copy\n </Button>\n </Flex>\n );\n};\n\nconst DownloadIcon = () => {\n return (\n <svg\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 16 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M4.66 1.994A2.667 2.667 0 0 0 1.995 4.66v6.666a2.667 2.667 0 0 0 2.667 2.667h6.666a2.667 2.667 0 0 0 2.667-2.667V4.661a2.667 2.667 0 0 0-2.667-2.667zM7.995 4.66c.368 0 .667.298.667.666V8.66h2l-2.667 2.666L5.328 8.66h2V5.327c0-.368.299-.667.667-.667\"\n fill=\"#fff\"\n fillOpacity=\".98\"\n />\n </svg>\n );\n};\n\nconst CopyIcon = () => {\n return (\n <svg\n width=\"17\"\n height=\"16\"\n viewBox=\"0 0 17 16\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n d=\"M5.166 1.994A2.667 2.667 0 0 0 2.499 4.66v4a2.667 2.667 0 0 0 2.667 2.667 2.667 2.667 0 0 0 2.666 2.667h4a2.667 2.667 0 0 0 2.667-2.667v-4a2.667 2.667 0 0 0-2.667-2.667 2.667 2.667 0 0 0-2.666-2.666zm6.666 4c.737 0 1.334.596 1.334 1.333v4c0 .737-.597 1.334-1.334 1.334h-4A1.333 1.333 0 0 1 6.5 11.327h2.667a2.667 2.667 0 0 0 2.666-2.667z\"\n fill=\"#fff\"\n fillOpacity=\".98\"\n />\n </svg>\n );\n};\n","import { FC, useEffect, useMemo, useRef, useState } from \"react\";\nimport { Poster } from \"../poster\";\nimport { PosterRef } from \"../poster/poster\";\nimport {\n PnLDisplayFormat,\n ReferralType,\n ShareOptions,\n SharePnLConfig,\n} from \"../../types/types\";\nimport { getPnlInfo, getPnLPosterData, savePnlInfo } from \"../utils/utils\";\nimport {\n Box,\n Button,\n CloseCircleFillIcon,\n cn,\n Input,\n ScrollArea,\n toast,\n} from \"@orderly.network/ui\";\nimport { Carousel } from \"../carousel\";\nimport {\n CarouselContent,\n CarouselItem,\n Dot,\n useCarousel,\n} from \"../carousel/carousel\";\n\nexport const MobileSharePnLContent: FC<{\n position: any;\n leverage: any;\n hide: any;\n baseDp?: number;\n quoteDp?: number;\n referral?: ReferralType;\n shareOptions: SharePnLConfig;\n}> = (props) => {\n const { shareOptions } = props;\n const localPnlConfig = getPnlInfo();\n\n const [pnlFormat, setPnlFormat] = useState<PnLDisplayFormat>(\n localPnlConfig.pnlFormat\n );\n const [shareOption, setShareOption] = useState<Set<ShareOptions>>(\n new Set(localPnlConfig.options)\n );\n const [message, setMessage] = useState<string>(localPnlConfig.message);\n const [selectIndex, setSelectIndex] = useState(localPnlConfig.bgIndex);\n // const { shareOptions } = useTradingPageContext();\n const { backgroundImages, ...resetOptions } = shareOptions ?? {\n backgroundImages: [],\n };\n\n const [domain, setDomain] = useState(\"\");\n\n const posterRefs = shareOptions?.backgroundImages.map(() =>\n useRef<PosterRef | null>(null)\n );\n\n useEffect(() => {\n const currentDomain = window.location.hostname;\n setDomain(currentDomain);\n }, []);\n\n const posterData = getPnLPosterData(\n props.position,\n props.leverage,\n message,\n domain,\n pnlFormat,\n shareOption,\n props.baseDp,\n props.quoteDp,\n props.referral\n );\n // console.log(\"pster data\", posterData, props.position);\n\n const carouselRef = useRef<any>();\n const aspectRatio = 552 / 310;\n const [scale, setScale] = useState(1);\n const [carouselHeight, setCarouselHeight] = useState(0);\n\n const [focus, setFocus] = useState(false);\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n useEffect(() => {\n if (carouselRef.current) {\n const divWidth = carouselRef.current.offsetWidth;\n const divHeight = divWidth / aspectRatio;\n setCarouselHeight(divHeight);\n setScale(divWidth / 552);\n }\n }, [carouselRef, domain]);\n\n const onSharePnL = async (\n posterRef: React.MutableRefObject<PosterRef | null>\n ) => {\n if (!posterRef.current) return;\n const data = posterRef.current?.toDataURL();\n const blob = dataURItoBlob(data);\n try {\n // Check if the browser supports the share feature\n if (navigator.share) {\n await navigator.share({\n // title: \"Share PnL\",\n text: message,\n // url: imageUrl,\n files: [new File([blob], \"image.png\", { type: \"image/png\" })],\n });\n console.log(\"Image shared successfully!\");\n } else {\n console.log(\"Share API is not supported in this browser.\");\n }\n props.hide?.();\n } catch (error) {\n console.error(\"Error sharing image:\", error);\n }\n };\n\n savePnlInfo(pnlFormat, shareOption, selectIndex, message);\n\n return (\n <div className=\"oui-w-full\">\n {/* <div>{`leverage: ${props.leverage}x`}</div> */}\n <div\n ref={carouselRef}\n className=\"oui-w-full oui-mt-4 oui-overflow-hidden\"\n style={{ height: `${carouselHeight + 20}px` }}\n >\n <Carousel\n className=\"oui-w-full oui-overflow-hidden\"\n opts={{ align: \"start\" }}\n initIndex={selectIndex}\n >\n <CarouselContent style={{ height: `${carouselHeight}px` }}>\n {shareOptions?.backgroundImages.map((item, index) => (\n <CarouselItem key={index}>\n <Poster\n className=\"oui-transform oui-origin-top-left\"\n style={{ scale: `${scale}` }}\n width={552}\n height={310}\n data={{\n backgroundImg: item,\n ...resetOptions,\n data: posterData,\n }}\n ratio={3}\n ref={posterRefs?.[index]}\n />\n </CarouselItem>\n ))}\n </CarouselContent>\n <div className=\"oui-mt-2 oui-mb-1 oui-flex oui-justify-center\">\n <MyIdentifier\n dotClassName=\"oui-w-[16px] oui-h-[4px] oui-bg-base-300\"\n dotActiveClassName=\"!oui-bg-primary oui-w-[20px]\"\n setSelectIndex={setSelectIndex}\n />\n </div>\n </Carousel>\n </div>\n\n <ScrollArea className=\"oui-max-h-[200px] oui-overflow-y-auto\">\n <div className=\"oui-mt-4\">\n <div className=\"oui-text-3xs oui-text-base-contrast-54\">\n PnL display format\n </div>\n <div className=\"oui-pt-3 oui-px-1 oui-flex oui-justify-between oui-gap-3\">\n <PnlFormatView\n setPnlFormat={setPnlFormat}\n type=\"roi_pnl\"\n curType={pnlFormat}\n />\n <PnlFormatView\n setPnlFormat={setPnlFormat}\n type=\"roi\"\n curType={pnlFormat}\n />\n <PnlFormatView\n setPnlFormat={setPnlFormat}\n type=\"pnl\"\n curType={pnlFormat}\n />\n </div>\n </div>\n\n <div className=\"oui-mt-3\">\n <div className=\"oui-text-3xs oui-text-base-contrast-54 oui-h-[18px]\">\n Optional information to share\n </div>\n <div className=\"oui-flex oui-flex-wrap oui-gap-3 oui-mt-3\">\n <ShareOption\n setShareOption={setShareOption}\n type=\"openPrice\"\n curType={shareOption}\n />\n <ShareOption\n setShareOption={setShareOption}\n type=\"openTime\"\n curType={shareOption}\n />\n <ShareOption\n setShareOption={setShareOption}\n type=\"leverage\"\n curType={shareOption}\n />\n <ShareOption\n setShareOption={setShareOption}\n type=\"markPrice\"\n curType={shareOption}\n />\n <ShareOption\n setShareOption={setShareOption}\n type=\"quantity\"\n curType={shareOption}\n />\n </div>\n </div>\n\n <div className=\"oui-mt-3 oui-mb-8\">\n <div className=\"oui-text-3xs oui-text-base-contrast-54 oui-h-[18px]\">\n Your message\n </div>\n <div className=\"oui-mt-3 oui-h-[48px] oui-bg-base-600 oui-mx-1\">\n <Input\n placeholder=\"Max 25 characters\"\n containerClassName=\"oui-bg-transparent oui-h-[48px]\"\n value={message}\n autoFocus={false}\n onChange={(e) => {\n if (e.target.value.length > 25) {\n toast.error(\"Maximum support of 25 characters\");\n return;\n }\n setMessage(e.target.value);\n }}\n ref={inputRef}\n onFocus={() => setFocus(true)}\n onBlur={() => setFocus(false)}\n suffix={\n focus && (\n <button\n className=\"oui-mr-3 oui-cursor-pointer\"\n onMouseDown={(e) => {\n console.log(\"set message to empty\");\n\n setMessage(\"\");\n setTimeout(() => {\n inputRef.current?.focus();\n }, 50);\n e.stopPropagation();\n }}\n >\n <CloseCircleFillIcon size={18} color=\"white\" />\n </button>\n )\n }\n />\n </div>\n </div>\n </ScrollArea>\n\n <div className=\"oui-pt-2\">\n <Button\n fullWidth\n className=\"oui-h-[40px] oui-text-[16px]\"\n onClick={() => {\n const ref = posterRefs?.[selectIndex];\n if (ref) {\n onSharePnL(ref);\n }\n }}\n >\n Share\n </Button>\n </div>\n </div>\n );\n};\n\nconst PnlFormatView: FC<{\n type: PnLDisplayFormat;\n curType?: PnLDisplayFormat;\n setPnlFormat: any;\n}> = (props) => {\n const { type, curType, setPnlFormat } = props;\n\n const text = useMemo(() => {\n switch (type) {\n case \"roi_pnl\":\n return \"ROI & PnL\";\n case \"roi\":\n return \"ROI\";\n case \"pnl\":\n return \"PnL\";\n }\n }, [type]);\n\n const isSelected = type === curType;\n\n return (\n <div\n className={cn(\n \"oui-shadow-lg oui-rounded-lg oui-h-[46px] oui-flex-1 oui-bg-base-4 hover:oui-cursor-pointer oui-flex oui-items-center oui-px-3 oui-referral-shadow\",\n isSelected && \"oui-bg-primary oui-dot-sel\"\n )}\n onClick={() => {\n setPnlFormat(type);\n }}\n >\n <div className=\"oui-text-sm oui-text-base-contrast\">{text}</div>\n {/* {isSelected && <RadioIcon size={20} />} */}\n </div>\n );\n};\n\nconst ShareOption: FC<{\n type: ShareOptions;\n curType: Set<ShareOptions>;\n setShareOption: any;\n}> = (props) => {\n const { type, curType, setShareOption } = props;\n\n const text = useMemo(() => {\n switch (type) {\n case \"openPrice\":\n return \"Open price\";\n case \"openTime\":\n return \"Opened at\";\n case \"markPrice\":\n return \"Mark price\";\n case \"quantity\":\n return \"Quantity\";\n case \"leverage\":\n return \"Leverage\";\n }\n }, [type]);\n\n const isSelected = curType.has(type);\n\n return (\n <div\n className={cn(\n \"oui-shadow-lg oui-rounded-lg oui-h-[46px] oui-mt-0 oui-w-[calc(50%-6px)] oui-bg-base-4 hover:oui-cursor-pointer oui-items-center oui-flex oui-p-3 oui-referral-shadow\"\n )}\n onClick={() => {\n // setPnlFormat(type);\n setShareOption((value: Set<ShareOptions>) => {\n const updateSet = new Set(value);\n if (isSelected) {\n updateSet.delete(type);\n } else {\n updateSet.add(type);\n }\n return updateSet;\n });\n }}\n >\n <div className=\"oui-text-sm oui-flex-1 oui-text-base-contrast\">\n {text}\n </div>\n {isSelected && <ChoicesFillIcon />}\n </div>\n );\n};\nfunction dataURItoBlob(dataURI: string) {\n const byteString = atob(dataURI.split(\",\")[1]);\n const mimeString = dataURI.split(\",\")[0].split(\":\")[1].split(\";\")[0];\n const ab = new ArrayBuffer(byteString.length);\n const ia = new Uint8Array(ab);\n for (let i = 0; i < byteString.length; i++) {\n ia[i] = byteString.charCodeAt(i);\n }\n return new Blob([ab], { type: mimeString });\n}\n\nconst MyIdentifier: FC<{\n setSelectIndex: any;\n className?: string;\n dotClassName?: string;\n dotActiveClassName?: string;\n onClick?: (index: number) => void;\n}> = (props) => {\n const { scrollSnaps, selectedIndex } = useCarousel();\n useEffect(() => {\n props.setSelectIndex(selectedIndex);\n }, [selectedIndex]);\n\n console.log(\"setSelectIndex is\", selectedIndex);\n\n return (\n <div className={cn(\"oui-flex oui-gap-1\")}>\n {scrollSnaps.map((_: any, index: number) => {\n return (\n <Dot\n key={index}\n index={index}\n active={index === selectedIndex}\n onClick={props.onClick}\n className={props.dotClassName}\n activeClassName={props.dotActiveClassName}\n />\n );\n })}\n </div>\n );\n};\n\nconst ChoicesFillIcon = () => {\n return (\n <svg\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M2.01416 11.9989C2.01416 6.47589 6.49136 1.9989 12.0142 1.9989C17.5372 1.9989 22.0142 6.47589 22.0142 11.9989C22.0142 17.5219 17.5372 21.9989 12.0142 21.9989C6.49136 21.9989 2.01416 17.5219 2.01416 11.9989ZM16.9853 7.31211C17.2125 7.09537 17.5236 7 17.8218 7C18.1201 7 18.4312 7.09537 18.6583 7.31211C19.1139 7.74546 19.1139 8.47384 18.6583 8.9072L10.5077 16.675C10.0534 17.1083 9.28909 17.1083 8.83472 16.675L5.34077 13.3459C4.88641 12.9126 4.88641 12.1841 5.34077 11.7508C5.79631 11.3175 6.56057 11.3175 7.01493 11.7508L9.67122 14.2822L16.9853 7.31211Z\"\n fill=\"white\"\n fill-opacity=\"1\"\n />\n </svg>\n );\n};\n","\"use client\";\n\nimport * as React from \"react\";\nimport useEmblaCarousel, {\n type UseEmblaCarouselType,\n} from \"embla-carousel-react\";\nimport { Button, cn } from \"@orderly.network/ui\";\n\n\n\n\ntype CarouselApi = UseEmblaCarouselType[1];\ntype UseCarouselParameters = Parameters<typeof useEmblaCarousel>;\ntype CarouselOptions = UseCarouselParameters[0];\ntype CarouselPlugin = UseCarouselParameters[1];\n\ntype CarouselProps = {\n opts?: CarouselOptions;\n plugins?: CarouselPlugin;\n orientation?: \"horizontal\" | \"vertical\";\n setApi?: (api: CarouselApi) => void;\n initIndex?: number,\n};\n\ntype CarouselContextProps = {\n carouselRef: ReturnType<typeof useEmblaCarousel>[0];\n api: ReturnType<typeof useEmblaCarousel>[1];\n scrollPrev: () => void;\n scrollNext: () => void;\n canScrollPrev: boolean;\n canScrollNext: boolean;\n selectedIndex: number;\n scrollSnaps: number[];\n} & CarouselProps;\n\nconst CarouselContext = React.createContext<CarouselContextProps | null>(null);\n\nexport function useCarousel() {\n const context = React.useContext(CarouselContext);\n\n if (!context) {\n throw new Error(\"useCarousel must be used within a <Carousel />\");\n }\n\n return context;\n}\n\nconst Carousel = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement> & CarouselProps\n>(\n (\n {\n orientation = \"horizontal\",\n opts,\n setApi,\n plugins,\n className,\n children,\n ...props\n },\n ref\n ) => {\n const [carouselRef, api] = useEmblaCarousel(\n {\n ...opts,\n axis: orientation === \"horizontal\" ? \"x\" : \"y\",\n },\n plugins\n );\n const [canScrollPrev, setCanScrollPrev] = React.useState(false);\n const [canScrollNext, setCanScrollNext] = React.useState(false);\n const [selectedIndex, setSelectedIndex] = React.useState(props.initIndex ||0);\n const [scrollSnaps, setScrollSnaps] = React.useState<number[]>([]);\n\n const onSelect = React.useCallback(\n (api: CarouselApi) => {\n if (!api) {\n return;\n }\n\n // console.log(\"selected\", api.scrollSnapList());\n\n if (scrollSnaps.length === 0) {\n setScrollSnaps(api.scrollSnapList());\n }\n\n setSelectedIndex(api.selectedScrollSnap());\n\n setCanScrollPrev(api.canScrollPrev());\n setCanScrollNext(api.canScrollNext());\n },\n [scrollSnaps]\n );\n\n const scrollPrev = React.useCallback(() => {\n api?.scrollPrev();\n }, [api]);\n\n const scrollNext = React.useCallback(() => {\n api?.scrollNext();\n }, [api]);\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n scrollPrev();\n } else if (event.key === \"ArrowRight\") {\n event.preventDefault();\n scrollNext();\n }\n },\n [scrollPrev, scrollNext]\n );\n\n React.useEffect(() => {\n if (!api || !setApi) {\n return;\n }\n\n setApi(api);\n }, [api, setApi]);\n\n React.useEffect(() => {\n if (!api) {\n return;\n }\n\n onSelect(api);\n api.on(\"reInit\", onSelect);\n api.on(\"select\", onSelect);\n\n if (props.initIndex) {\n api.scrollTo(props.initIndex);\n }\n return () => {\n api?.off(\"select\", onSelect);\n };\n }, [api, onSelect]);\n\n return (\n <CarouselContext.Provider\n value={{\n carouselRef,\n api: api,\n opts,\n orientation:\n orientation || (opts?.axis === \"y\" ? \"vertical\" : \"horizontal\"),\n scrollPrev,\n scrollNext,\n canScrollPrev,\n canScrollNext,\n selectedIndex,\n scrollSnaps,\n }}\n >\n <div\n ref={ref}\n onKeyDownCapture={handleKeyDown}\n className={cn(\"oui-relative\", className)}\n role=\"region\"\n aria-roledescription=\"carousel\"\n {...props}\n >\n {children}\n </div>\n </CarouselContext.Provider>\n );\n }\n);\nCarousel.displayName = \"Carousel\";\n\nconst CarouselContent = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const { carouselRef, orientation } = useCarousel();\n\n \n\n return (\n <div ref={carouselRef} className=\"oui-overflow-hidden\">\n <div\n ref={ref}\n className={cn(\n \"oui-flex\",\n orientation === \"horizontal\"\n ? \"oui--ml-4\"\n : \"oui--mt-4 oui-flex-col\",\n className\n )}\n {...props}\n />\n </div>\n );\n});\nCarouselContent.displayName = \"CarouselContent\";\n\nconst CarouselItem = React.forwardRef<\n HTMLDivElement,\n React.HTMLAttributes<HTMLDivElement>\n>(({ className, ...props }, ref) => {\n const { orientation } = useCarousel();\n\n return (\n <div\n ref={ref}\n role=\"group\"\n aria-roledescription=\"slide\"\n className={cn(\n \"oui-min-w-0 oui-shrink-0 oui-grow-0 oui-basis-full\",\n orientation === \"horizontal\" ? \"oui-pl-4\" : \"oui-pt-4\",\n className\n )}\n {...props}\n />\n );\n});\nCarouselItem.displayName = \"CarouselItem\";\n\nconst CarouselPrevious = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<typeof Button>\n>(({ className, variant = \"contained\", size = \"icon\", ...props }, ref) => {\n const { orientation, scrollPrev, canScrollPrev } = useCarousel();\n\n return (\n <Button\n // @ts-ignore\n ref={ref}\n variant={variant}\n // size={size}\n className={cn(\n \"oui-absolute oui-h-8 oui-w-8 oui-rounded-full\",\n orientation === \"horizontal\"\n ? \"oui--left-12 oui-top-1/2 oui--translate-y-1/2\"\n : \"oui--top-12 oui-left-1/2 oui--translate-x-1/2 oui-rotate-90\",\n className\n )}\n disabled={!canScrollPrev}\n onClick={scrollPrev}\n {...props}\n >\n {/* @ts-ignore */}\n <ChevronLeft size={20} />\n <span className=\"oui-sr-only\">Previous slide</span>\n </Button>\n );\n});\nCarouselPrevious.displayName = \"CarouselPrevious\";\n\nconst CarouselNext = React.forwardRef<\n HTMLButtonElement,\n React.ComponentProps<typeof Button>\n>(({ className, variant = \"contained\", size = \"icon\", ...props }, ref) => {\n const { orientation, scrollNext, canScrollNext } = useCarousel();\n\n return (\n <Button\n // @ts-ignore\n ref={ref}\n variant={variant}\n // size={size}\n className={cn(\n \"oui-absolute oui-h-8 oui-w-8 oui-rounded-full\",\n orientation === \"horizontal\"\n ? \"oui--right-12 oui-top-1/2 oui--translate-y-1/2\"\n : \"oui--bottom-12 oui-left-1/2 oui--translate-x-1/2 oui-rotate-90\",\n className\n )}\n disabled={!canScrollNext}\n onClick={scrollNext}\n {...props}\n >\n {/* @ts-ignore */}\n <ChevronRight size={20} />\n <span className=\"oui-sr-only\">Next slide</span>\n </Button>\n );\n});\nCarouselNext.displayName = \"CarouselNext\";\n\nexport type CarouselIdentifierProps = {\n className?: string;\n dotClassName?: string;\n dotActiveClassName?: string;\n onClick?: (index: number) => void;\n // asChild?: boolean;\n};\nconst CarouselIdentifier: React.FC<CarouselIdentifierProps> = (props) => {\n const { scrollSnaps, selectedIndex } = useCarousel();\n\n return (\n <div className={cn(\"oui-flex oui-gap-1\", props.className)}>\n {scrollSnaps.map((_, index) => {\n return (\n <Dot\n key={index}\n index={index}\n active={index === selectedIndex}\n onClick={props.onClick}\n className={props.dotClassName}\n activeClassName={props.dotActiveClassName}\n />\n );\n })}\n </div>\n );\n};\n\nCarouselIdentifier.displayName = \"CarouselIdentifier\";\n\nexport const Dot: React.FC<{\n index: number;\n active: boolean;\n onClick?: (index: number) => void;\n className?: string;\n activeClassName?: string;\n}> = ({ index, active, onClick, className, activeClassName }) => {\n const activedClassName = activeClassName || \"oui-bg-primary\";\n console.log(\"activedClassName is\", activedClassName);\n \n return (\n <button\n onClick={() => onClick?.(index)}\n className={cn(\n \"oui-w-2 oui-h-2 oui-rounded-full oui-bg-white/30\",\n className,\n active && `active ${activedClassName}`\n )}\n />\n );\n};\n\nexport {\n type CarouselApi,\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselPrevious,\n CarouselNext,\n CarouselIdentifier,\n};\n","import {\n Carousel as OriginCarousel,\n CarouselContent,\n CarouselItem,\n CarouselNext,\n CarouselPrevious,\n CarouselIdentifier,\n} from \"./carousel\";\n\nexport type Carousel = typeof OriginCarousel & {\n Content: typeof CarouselContent;\n Item: typeof CarouselItem;\n Next: typeof CarouselNext;\n Previous: typeof CarouselPrevious;\n indentify: typeof CarouselIdentifier;\n};\n\nconst Carousel = OriginCarousel as Carousel;\n\nCarousel.Content = CarouselContent;\nCarousel.Item = CarouselItem;\nCarousel.Next = CarouselNext;\nCarousel.Previous = CarouselPrevious;\nCarousel.indentify = CarouselIdentifier;\n\nexport { Carousel };\n","\nimport { SharePnLConfig, SharePnLParams } from \"../types/types\";\nimport { useSharePnLScript } from \"./sharePnL.script\";\nimport { DesktopSharePnL, MobileSharePnL } from \"./sharePnL.ui\";\n\nexport const SharePnLBottomSheetWidget = (props: {\n hide?: () => void;\n pnl?: SharePnLConfig & SharePnLParams;\n}) => {\n const state = useSharePnLScript({\n hide: props.hide,\n pnl: props.pnl,\n });\n return <MobileSharePnL {...state} />;\n};\n\nexport const SharePnLDialogWidget = (props: {\n hide?: () => void;\n pnl?: SharePnLConfig & SharePnLParams;\n}) => {\n const state = useSharePnLScript({\n hide: props.hide,\n pnl: props.pnl,\n });\n return <DesktopSharePnL {...state} />;\n};\n"]}
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.oui-hide-scrollbar::-webkit-scrollbar,.oui-hide-scrollbar::-webkit-scrollbar-thumb{display:none}.oui-sr-only{clip:rect(0,0,0,0);border-width:0;height:1px;margin:-1px;overflow:hidden;padding:0;white-space:nowrap;width:1px}.oui-absolute,.oui-sr-only{position:absolute}.oui-relative{position:relative}.oui--bottom-12{bottom:-3rem}.oui--left-12{left:-3rem}.oui--right-12{right:-3rem}.oui--top-12{top:-3rem}.oui-left-1\/2{left:50%}.oui-right-0{right:0}.oui-top-0{top:0}.oui-top-1\/2{top:50%}.oui-mx-0{margin-left:0;margin-right:0}.oui-mx-1{margin-left:.25rem;margin-right:.25rem}.oui-mx-11{margin-left:2.75rem;margin-right:2.75rem}.oui-mx-2{margin-left:.5rem;margin-right:.5rem}.oui--ml-4{margin-left:-1rem}.oui--mt-4{margin-top:-1rem}.oui-mb-1{margin-bottom:.25rem}.oui-mb-6{margin-bottom:1.5rem}.oui-mb-8{margin-bottom:2rem}.oui-ml-1{margin-left:.25rem}.oui-ml-2{margin-left:.5rem}.oui-mr-3{margin-right:.75rem}.oui-mt-0{margin-top:0}.oui-mt-2{margin-top:.5rem}.oui-mt-3{margin-top:.75rem}.oui-mt-4{margin-top:1rem}.oui-mt-\[2px\]{margin-top:2px}.oui-flex{display:flex}.oui-h-2{height:.5rem}.oui-h-8{height:2rem}.oui-h-\[18px\]{height:18px}.oui-h-\[40px\]{height:40px}.oui-h-\[46px\]{height:46px}.oui-h-\[48px\]{height:48px}.oui-h-\[4px\]{height:4px}.oui-h-full{height:100%}.oui-max-h-\[200px\]{max-height:200px}.oui-w-2{width:.5rem}.oui-w-8{width:2rem}.oui-w-\[162px\]{width:162px}.oui-w-\[16px\]{width:16px}.oui-w-\[20px\]{width:20px}.oui-w-\[320px\]{width:320px}.oui-w-\[40px\]{width:40px}.oui-w-\[calc\(50\%-6px\)\]{width:calc(50% - 6px)}.oui-w-full{width:100%}.oui-min-w-0{min-width:0}.\!oui-max-w-\[624px\]{max-width:624px!important}.oui-max-w-\[396px\]{max-width:396px}.oui-flex-1{flex:1 1 0%}.oui-shrink-0{flex-shrink:0}.oui-grow-0{flex-grow:0}.oui-basis-full{flex-basis:100%}.oui-origin-top-left{transform-origin:top left}.oui--translate-x-1\/2{--tw-translate-x:-50%}.oui--translate-x-1\/2,.oui--translate-y-1\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.oui--translate-y-1\/2{--tw-translate-y:-50%}.oui-rotate-90{--tw-rotate:90deg}.oui-rotate-90,.oui-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.oui-cursor-pointer{cursor:pointer}.oui-flex-col{flex-direction:column}.oui-flex-wrap{flex-wrap:wrap}.oui-items-center{align-items:center}.oui-justify-center{justify-content:center}.oui-justify-between{justify-content:space-between}.oui-gap-1{gap:.25rem}.oui-gap-3{gap:.75rem}.oui-overflow-hidden{overflow:hidden}.oui-overflow-x-auto{overflow-x:auto}.oui-overflow-y-auto{overflow-y:auto}.oui-rounded-full{border-radius:9999px}.oui-rounded-lg{border-radius:.5rem}.oui-rounded-sm{border-radius:.125rem}.oui-border-white\/10{border-color:hsla(0,0%,100%,.1)}.\!oui-bg-primary{--tw-bg-opacity:1!important;background-color:rgb(var(--oui-color-primary)/var(--tw-bg-opacity))!important}.oui-bg-base-4{--tw-bg-opacity:1;background-color:rgb(var(--oui-color-base-4)/var(--tw-bg-opacity))}.oui-bg-primary{--tw-bg-opacity:1;background-color:rgb(var(--oui-color-primary)/var(--tw-bg-opacity))}.oui-bg-transparent{background-color:transparent}.oui-bg-white\/30{background-color:hsla(0,0%,100%,.3)}.oui-fill-base-contrast-54{fill:rgb(var(--oui-color-base-foreground)/.54)}.oui-fill-primary{fill:rgb(var(--oui-color-primary)/1)}.oui-p-0{padding:0}.oui-p-3{padding:.75rem}.oui-px-1{padding-left:.25rem;padding-right:.25rem}.oui-px-3{padding-left:.75rem;padding-right:.75rem}.oui-pl-4{padding-left:1rem}.oui-pt-2{padding-top:.5rem}.oui-pt-3{padding-top:.75rem}.oui-pt-4{padding-top:1rem}.oui-pt-6{padding-top:1.5rem}.oui-pt-\[2px\]{padding-top:2px}.oui-text-2xs{font-size:var(--oui-font-size-2xs,.75rem);line-height:1.125rem}.oui-text-3xs{font-size:var(--oui-font-size-3xs,.625rem);line-height:.625rem}.oui-text-\[16px\]{font-size:16px}.oui-text-sm{font-size:var(--oui-font-size-sm,.875rem);line-height:1.25rem}.oui-text-xs{font-size:var(--oui-font-size-xs,calc(.875rem - 1px));line-height:1.25rem}.oui-text-base-contrast{color:rgb(var(--oui-color-base-foreground)/.98)}.oui-text-base-contrast-54{color:rgb(var(--oui-color-base-foreground)/.54)}.oui-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.oui-outline{outline-style:solid}.oui-outline-1{outline-width:1px}.oui-outline-primary{outline-color:rgb(var(--oui-color-primary)/1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.hover\:oui-cursor-pointer:hover{cursor:pointer}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@orderly.network/ui-share",
|
|
3
|
+
"version": "2.0.0-alpha.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/index.mjs",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"Orderly",
|
|
9
|
+
"Share"
|
|
10
|
+
],
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"embla-carousel-react": "^8.2.0",
|
|
19
|
+
"@orderly.network/hooks": "2.0.0-alpha.1",
|
|
20
|
+
"@orderly.network/ui": "2.0.0-alpha.1",
|
|
21
|
+
"@orderly.network/types": "2.0.0-alpha.1",
|
|
22
|
+
"@orderly.network/utils": "2.0.0-alpha.1"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@swc/cli": "^0.3.12",
|
|
26
|
+
"@swc/core": "^1.4.12",
|
|
27
|
+
"@types/react": "^18.3.2",
|
|
28
|
+
"@types/react-dom": "^18.3.0",
|
|
29
|
+
"react": "^18.3.1",
|
|
30
|
+
"react-dom": "^18.2.0",
|
|
31
|
+
"tailwindcss": "^3.4.4",
|
|
32
|
+
"tsup": "^7.1.0",
|
|
33
|
+
"tsconfig": "0.3.12"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"react": "^18.3.1",
|
|
37
|
+
"react-dom": "^18.2.0",
|
|
38
|
+
"@orderly.network/ui": "2.0.0-alpha.1"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsup && pnpm run build:css",
|
|
42
|
+
"build:css": "tailwindcss build -i src/tailwind.css -o dist/styles.css --minify",
|
|
43
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
44
|
+
}
|
|
45
|
+
}
|