@frak-labs/components 1.0.9 → 1.0.10
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/cdn/Banner.De5nN3cX.js +167 -0
- package/cdn/{ButtonShare.D9-F0jJJ.js → ButtonShare.DHSekTjv.js} +1 -1
- package/cdn/{ButtonWallet.B0buPR_z.js → ButtonWallet.Cvp_1Tx2.js} +1 -1
- package/cdn/{GiftIcon.eRNTGQ_r.js → GiftIcon.DnSW4dJQ.js} +1 -1
- package/cdn/{OpenInAppButton.Dgb-qhM8.js → OpenInAppButton.CpO_E-l-.js} +1 -1
- package/cdn/{PostPurchase.BYxnAEyn.js → PostPurchase.CuO1kjaz.js} +2 -2
- package/cdn/components.js +1 -1
- package/cdn/formatReward.DNFkBh_E.js +1 -0
- package/cdn/loader.js +1 -1
- package/cdn/{useGlobalComponents.TG9kIYSc.js → useGlobalComponents.pjgSwLk9.js} +1 -1
- package/cdn/{useLightDomStyles.tjNBKcOr.js → useLightDomStyles.2RQE6Iby.js} +1 -1
- package/cdn/usePlacement.CRfzWKVY.js +58 -0
- package/cdn/useReward.DSMOMYCh.js +1 -0
- package/dist/{GiftIcon-BIp9FTJs.js → GiftIcon-WEWSJ8kV.js} +1 -1
- package/dist/banner.d.ts +1 -2
- package/dist/banner.js +63 -69
- package/dist/buttonShare.d.ts +1 -2
- package/dist/buttonShare.js +4 -4
- package/dist/buttonWallet.d.ts +1 -2
- package/dist/buttonWallet.js +2 -2
- package/dist/{formatReward-Cf2KpA3x.js → formatReward-D3CkH7It.js} +8 -2
- package/dist/openInApp.d.ts +1 -3
- package/dist/openInApp.js +2 -2
- package/dist/postPurchase.d.ts +1 -2
- package/dist/postPurchase.js +6 -5
- package/dist/{useLightDomStyles-CgAkUlb_.js → useLightDomStyles-DPKMhggr.js} +1 -1
- package/dist/{usePlacement-rmDVnK7X.js → usePlacement-DTN6H6vW.js} +55 -1
- package/dist/{useReward-ClVShg45.js → useReward-DSrQsn3r.js} +2 -2
- package/package.json +2 -2
- package/cdn/Banner.CcOWT4lZ.js +0 -178
- package/cdn/formatReward.B1ZyoceC.js +0 -1
- package/cdn/usePlacement.BgMXY5CX.js +0 -58
- package/cdn/useReward.BtBpuMwt.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as formatEstimatedReward } from "./formatReward-
|
|
1
|
+
import { n as formatEstimatedReward } from "./formatReward-D3CkH7It.js";
|
|
2
2
|
import { getCurrencyAmountKey, getSupportedCurrency } from "@frak-labs/core-sdk";
|
|
3
3
|
import { getMerchantInformation } from "@frak-labs/core-sdk/actions";
|
|
4
4
|
import { useEffect, useState } from "preact/hooks";
|
|
@@ -9,7 +9,7 @@ import { useEffect, useState } from "preact/hooks";
|
|
|
9
9
|
function getRewardValue(reward, key) {
|
|
10
10
|
switch (reward.payoutType) {
|
|
11
11
|
case "fixed": return reward.amount[key];
|
|
12
|
-
case "tiered": return reward.tiers.reduce((acc, tier) => Math.max(acc, tier.amount[key]), 0);
|
|
12
|
+
case "tiered": return reward.tiers.reduce((acc, tier) => "amount" in tier ? Math.max(acc, tier.amount[key]) : acc, 0);
|
|
13
13
|
case "percentage": return 0;
|
|
14
14
|
}
|
|
15
15
|
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"url": "https://twitter.com/QNivelais"
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
|
-
"version": "1.0.
|
|
14
|
+
"version": "1.0.10",
|
|
15
15
|
"description": "Frak Wallet components, helping any person to interact with the Frak wallet.",
|
|
16
16
|
"repository": {
|
|
17
17
|
"url": "https://github.com/frak-id/wallet",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"publish": "echo 'Publishing components...'"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@frak-labs/core-sdk": "1.1.
|
|
89
|
+
"@frak-labs/core-sdk": "1.1.5",
|
|
90
90
|
"@frak-labs/frame-connector": "0.2.0",
|
|
91
91
|
"preact": "^10.29.0",
|
|
92
92
|
"preact-custom-element": "^4.6.0",
|
package/cdn/Banner.CcOWT4lZ.js
DELETED
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import{T as e,b as t,d as n,s as r,u as i,v as a}from"./loader.js";import{a as o,c as s,d as c,i as l,l as u,o as d,s as f,t as ee,u as p}from"./usePlacement.BgMXY5CX.js";import{a as m,i as h,n as g,r as te,t as _}from"./GiftIcon.eRNTGQ_r.js";import{t as v}from"./useGlobalComponents.TG9kIYSc.js";import{t as ne}from"./useLightDomStyles.tjNBKcOr.js";import{t as re}from"./useReward.BtBpuMwt.js";var y=`inAppBanner_body__1ibpiy75`,b=`inAppBanner_closeButton__1ibpiy78`,x=`inAppBanner_container__1ibpiy71`,S=`inAppBanner_cta__1ibpiy77`,C=`inAppBanner_description__1ibpiy76`,w=`inAppBanner_header__1ibpiy72`,T=`inAppBanner_iconWrapper__1ibpiy73`,E=`inAppBanner_title__1ibpiy74`;function D({title:e,description:t,cta:n,dismissLabel:r,onAction:i,onDismiss:a,className:o,classNames:s}){return p(`div`,{className:`${x}${o?` ${o}`:``}`,role:`alert`,children:[p(`div`,{className:w,children:[p(`span`,{className:`${T}${s?.icon?` ${s.icon}`:``}`,children:p(g,{width:20,height:20})}),p(`p`,{className:`${E}${s?.title?` ${s.title}`:``}`,children:e})]}),p(`div`,{className:y,children:[p(`p`,{className:`${C}${s?.description?` ${s.description}`:``}`,children:t}),p(`button`,{type:`button`,className:`${S}${s?.cta?` ${s.cta}`:``}`,onClick:i,children:[n,p(h,{width:14,height:14})]})]}),p(`button`,{type:`button`,className:`${b}${s?.close?` ${s.close}`:``}`,onClick:a,"aria-label":r,children:p(m,{width:16,height:16})})]})}var O=`Banner_frakLogo__1gnumzia`,k=`Banner_iconSvg__1gnumzi2`,A=`Banner_referral__1gnumzi3 reset_base__1831jhd0 Banner_rootBase__1gnumzi1`,j=`Banner_referralBody__1gnumzi6`,M=`Banner_referralCta__1gnumzi9 sharedBaseCss_buttonReset__7cswil0`,ie=`Banner_referralDescription__1gnumzi8 reset_base__1831jhd0`,ae=`Banner_referralIconWrapper__1gnumzi4`,N=`Banner_referralImage__1gnumzi5`,P=`Banner_referralTitle__1gnumzi7 reset_base__1831jhd0`;function F({placement:c,classname:m=``,interaction:h,referralTitle:g,referralDescription:y,referralCta:b,inappTitle:x,inappDescription:S,inappCta:C,imageUrl:w,preview:T,previewMode:E,allowInappRedirect:F}){let I=!!T,L=E===`inapp`?`inapp`:`referral`,R=F===!0||F===`true`,z=ee(c),{shouldRender:B,isHidden:V,isClientReady:H}=l();ne(`frak-banner`,c,z?.components?.banner?.css,`@keyframes inAppBanner_fadeIn__1ibpiy70 {
|
|
2
|
-
from {
|
|
3
|
-
opacity: 0;
|
|
4
|
-
transform: translateY(-4px);
|
|
5
|
-
}
|
|
6
|
-
to {
|
|
7
|
-
opacity: 1;
|
|
8
|
-
transform: translateY(0);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
.inAppBanner_container__1ibpiy71 {
|
|
12
|
-
position: fixed;
|
|
13
|
-
top: max(8px, env(safe-area-inset-top));
|
|
14
|
-
left: 16px;
|
|
15
|
-
right: 16px;
|
|
16
|
-
z-index: 1000;
|
|
17
|
-
display: flex;
|
|
18
|
-
flex-direction: column;
|
|
19
|
-
gap: 4px;
|
|
20
|
-
padding: 12px 16px;
|
|
21
|
-
padding-right: 32px;
|
|
22
|
-
border-radius: 12px;
|
|
23
|
-
background-color: #000000CC;
|
|
24
|
-
backdrop-filter: blur(12px);
|
|
25
|
-
-webkit-backdrop-filter: blur(12px);
|
|
26
|
-
color: #ffffff;
|
|
27
|
-
animation: inAppBanner_fadeIn__1ibpiy70 300ms ease-out;
|
|
28
|
-
}
|
|
29
|
-
.inAppBanner_header__1ibpiy72 {
|
|
30
|
-
display: flex;
|
|
31
|
-
align-items: center;
|
|
32
|
-
gap: 8px;
|
|
33
|
-
}
|
|
34
|
-
.inAppBanner_iconWrapper__1ibpiy73 {
|
|
35
|
-
flex-shrink: 0;
|
|
36
|
-
width: 20px;
|
|
37
|
-
height: 20px;
|
|
38
|
-
display: flex;
|
|
39
|
-
align-items: center;
|
|
40
|
-
justify-content: center;
|
|
41
|
-
color: #ffffff;
|
|
42
|
-
}
|
|
43
|
-
.inAppBanner_title__1ibpiy74 {
|
|
44
|
-
margin: 0;
|
|
45
|
-
padding: 0;
|
|
46
|
-
font-size: 16px;
|
|
47
|
-
font-weight: 500;
|
|
48
|
-
line-height: 26px;
|
|
49
|
-
color: var(--text-onAction__pbq4ak6);
|
|
50
|
-
}
|
|
51
|
-
.inAppBanner_body__1ibpiy75 {
|
|
52
|
-
display: flex;
|
|
53
|
-
flex-wrap: wrap;
|
|
54
|
-
align-items: baseline;
|
|
55
|
-
gap: 0 4px;
|
|
56
|
-
}
|
|
57
|
-
.inAppBanner_description__1ibpiy76 {
|
|
58
|
-
margin: 0;
|
|
59
|
-
padding: 0;
|
|
60
|
-
font-size: 14px;
|
|
61
|
-
color: var(--text-onAction__pbq4ak6);
|
|
62
|
-
line-height: 22px;
|
|
63
|
-
opacity: 0.96;
|
|
64
|
-
}
|
|
65
|
-
.inAppBanner_cta__1ibpiy77 {
|
|
66
|
-
all: unset;
|
|
67
|
-
display: inline-flex;
|
|
68
|
-
align-items: center;
|
|
69
|
-
gap: 4px;
|
|
70
|
-
color: #2BB2FF;
|
|
71
|
-
font-size: 14px;
|
|
72
|
-
font-weight: 600;
|
|
73
|
-
text-decoration: underline;
|
|
74
|
-
text-underline-offset: 2px;
|
|
75
|
-
cursor: pointer;
|
|
76
|
-
}
|
|
77
|
-
.inAppBanner_cta__1ibpiy77:focus-visible {
|
|
78
|
-
outline: 2px solid #2BB2FF;
|
|
79
|
-
outline-offset: 2px;
|
|
80
|
-
border-radius: 4px;
|
|
81
|
-
}
|
|
82
|
-
.inAppBanner_closeButton__1ibpiy78 {
|
|
83
|
-
all: unset;
|
|
84
|
-
position: absolute;
|
|
85
|
-
top: 8px;
|
|
86
|
-
right: 8px;
|
|
87
|
-
width: 28px;
|
|
88
|
-
height: 28px;
|
|
89
|
-
display: flex;
|
|
90
|
-
align-items: center;
|
|
91
|
-
justify-content: center;
|
|
92
|
-
border-radius: 9999px;
|
|
93
|
-
color: rgba(255, 255, 255, 0.6);
|
|
94
|
-
cursor: pointer;
|
|
95
|
-
}
|
|
96
|
-
.inAppBanner_closeButton__1ibpiy78:focus-visible {
|
|
97
|
-
outline: 2px solid #ffffff;
|
|
98
|
-
outline-offset: 2px;
|
|
99
|
-
}@keyframes Banner_fadeIn__1gnumzi0 {
|
|
100
|
-
from {
|
|
101
|
-
opacity: 0;
|
|
102
|
-
transform: translateY(-4px);
|
|
103
|
-
}
|
|
104
|
-
to {
|
|
105
|
-
opacity: 1;
|
|
106
|
-
transform: translateY(0);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
.Banner_rootBase__1gnumzi1 {
|
|
110
|
-
position: relative;
|
|
111
|
-
display: flex;
|
|
112
|
-
animation: Banner_fadeIn__1gnumzi0 300ms ease-out;
|
|
113
|
-
}
|
|
114
|
-
.Banner_iconSvg__1gnumzi2 {
|
|
115
|
-
width: 100%;
|
|
116
|
-
height: 100%;
|
|
117
|
-
}
|
|
118
|
-
.Banner_referral__1gnumzi3 {
|
|
119
|
-
flex-direction: row;
|
|
120
|
-
align-items: center;
|
|
121
|
-
gap: 16px;
|
|
122
|
-
padding: 16px;
|
|
123
|
-
background-color: #ffffff;
|
|
124
|
-
color: var(--text-primary__pbq4ak0);
|
|
125
|
-
border: 1px solid var(--border-default__pbq4akv);
|
|
126
|
-
border-radius: 12px;
|
|
127
|
-
}
|
|
128
|
-
.Banner_referralIconWrapper__1gnumzi4 {
|
|
129
|
-
flex-shrink: 0;
|
|
130
|
-
align-self: flex-start;
|
|
131
|
-
display: flex;
|
|
132
|
-
align-items: center;
|
|
133
|
-
justify-content: center;
|
|
134
|
-
width: 40px;
|
|
135
|
-
height: 40px;
|
|
136
|
-
overflow: hidden;
|
|
137
|
-
}
|
|
138
|
-
.Banner_referralImage__1gnumzi5 {
|
|
139
|
-
max-width: 100%;
|
|
140
|
-
max-height: 100%;
|
|
141
|
-
width: auto;
|
|
142
|
-
height: auto;
|
|
143
|
-
object-fit: contain;
|
|
144
|
-
display: block;
|
|
145
|
-
}
|
|
146
|
-
.Banner_referralBody__1gnumzi6 {
|
|
147
|
-
flex: 1;
|
|
148
|
-
min-width: 0;
|
|
149
|
-
}
|
|
150
|
-
.Banner_referralTitle__1gnumzi7 {
|
|
151
|
-
font-size: 16px;
|
|
152
|
-
font-weight: 600;
|
|
153
|
-
color: var(--text-primary__pbq4ak0);
|
|
154
|
-
line-height: 22px;
|
|
155
|
-
}
|
|
156
|
-
.Banner_referralDescription__1gnumzi8 {
|
|
157
|
-
margin-bottom: 8px;
|
|
158
|
-
font-size: 14px;
|
|
159
|
-
color: #979797;
|
|
160
|
-
line-height: 22px;
|
|
161
|
-
}
|
|
162
|
-
.Banner_referralCta__1gnumzi9 {
|
|
163
|
-
display: inline-block;
|
|
164
|
-
padding: 8px 16px;
|
|
165
|
-
border: 1px solid #000000;
|
|
166
|
-
border-radius: 9999px;
|
|
167
|
-
color: var(--text-primary__pbq4ak0);
|
|
168
|
-
font-size: 10px;
|
|
169
|
-
font-weight: 700;
|
|
170
|
-
line-height: 12px;
|
|
171
|
-
text-transform: uppercase;
|
|
172
|
-
}
|
|
173
|
-
.Banner_frakLogo__1gnumzia {
|
|
174
|
-
position: absolute;
|
|
175
|
-
right: 16px;
|
|
176
|
-
bottom: 12px;
|
|
177
|
-
pointer-events: none;
|
|
178
|
-
}`,e);let[U,W]=f(!1),[G,K]=f(()=>I?L:R&&a?`inapp`:null),q=o(null);u(()=>{I&&K(L)},[I,L]);let{reward:J}=re(G===`referral`&&H,h),[Y,X]=f(null);u(()=>{let e=window.FrakSetup?.client;G!==`inapp`||I||!H||!e||r(e).then(e=>X(e)).catch(()=>{})},[G,I,H]),u(()=>{I||!G||U||q.current!==G&&H&&(t(window.FrakSetup?.client,`banner_impression`,{placement:c,variant:G,has_reward:G===`referral`?!!J:void 0}),q.current=G)},[G,U,H,I,c]),u(()=>{if(I||G===`inapp`)return;let e=()=>K(`referral`);return window.addEventListener(i,e),()=>window.removeEventListener(i,e)},[I,G]);let Z=s(async()=>{if(I)return;if(t(window.FrakSetup?.client,`banner_resolved`,{placement:c,variant:G??`referral`,outcome:`clicked`}),G===`referral`){W(!0);return}let e=Y;if(!e&&window.FrakSetup?.client)try{e=await r(window.FrakSetup?.client)}catch{}let i=window.location.href;if(e){let t=new URL(i);t.searchParams.set(`fmt`,e),i=t.toString()}n(i)},[I,G,Y,c]),oe=s(()=>{I||(t(window.FrakSetup?.client,`banner_resolved`,{placement:c,variant:G??`referral`,outcome:`dismissed`}),W(!0))},[I,G,c]),se=v(),Q=z?.components?.banner??se?.banner,$=d(()=>{if(G===`referral`){let e=J?`Earn ${J} on purchases on this site`:`You've been referred!`;return{title:g??Q?.referralTitle??e,description:y??Q?.referralDescription??`Earn rewards after your purchase via the Frak partner app.`,cta:b??Q?.referralCta??`Got it`}}return{title:x??Q?.inappTitle??`Open in your browser`,description:S??Q?.inappDescription??`For a better experience and to earn your rewards, open this page in your default browser.`,cta:C??Q?.inappCta??`Open browser`}},[G,J,Q,g,y,b,x,S,C]);if(!G||!I&&(!B||V||U))return null;let ce=[A,`frak-banner`,`frak-banner--${G}`,m].filter(Boolean).join(` `);return G===`inapp`?p(D,{title:$.title,description:$.description,cta:$.cta,dismissLabel:`Dismiss`,onAction:Z,onDismiss:oe,className:[`frak-banner`,`frak-banner--inapp`,m].filter(Boolean).join(` `),classNames:{icon:`frak-banner__icon`,title:`frak-banner__title`,description:`frak-banner__description`,cta:`frak-banner__cta`,close:`frak-banner__close`}}):p(`div`,{class:ce,role:`alert`,children:[p(`div`,{class:`${ae} frak-banner__icon`,children:w?p(`img`,{src:w,alt:``,class:N}):p(_,{class:k})}),p(`div`,{class:`${j} frak-banner__text`,children:[p(`p`,{class:`${P} frak-banner__title`,children:$.title}),p(`p`,{class:`${ie} frak-banner__description`,children:$.description}),p(`button`,{type:`button`,class:`${M} frak-banner__cta`,onClick:Z,children:$.cta})]}),p(te,{class:`${O} frak-banner__logo`,width:42,height:24})]})}c(F,`frak-banner`,[`placement`,`classname`,`interaction`,`referralTitle`,`referralDescription`,`referralCta`,`inappTitle`,`inappDescription`,`inappCta`,`preview`,`previewMode`,`imageUrl`,`allowInappRedirect`],{shadow:!1});export{F as Banner};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as e,h as t,p as n}from"./loader.js";function r(r,i,a){let o=t(i),s=n(o);switch(r.payoutType){case`fixed`:return e(Math.round(r.amount[s]),o);case`percentage`:return a===void 0?`${r.percent} %`:e(Math.round(r.percent*a/100),o);case`tiered`:{let t=r.tiers.reduce((e,t)=>Math.max(e,t.amount[s]),0);return e(Math.round(t),o)}}}function i(e,t){return t?e.replace(`{REWARD}`,t):e.replace(`{REWARD}`,``)}export{r as n,i as t};
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import{C as e,n as t,t as n,y as r}from"./loader.js";var i,a,o,s,c,l,u,d,f,p,m,h={},g=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,v=Array.isArray;function y(e,t){for(var n in t)e[n]=t[n];return e}function b(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function x(e,t,n){var r,a,o,s={};for(o in t)o==`key`?r=t[o]:o==`ref`?a=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?i.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(o in e.defaultProps)s[o]===void 0&&(s[o]=e.defaultProps[o]);return S(e,s,r,a,null)}function S(e,t,n,r,i){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++o,__i:-1,__u:0};return i==null&&a.vnode!=null&&a.vnode(s),s}function C(e){return e.children}function w(e,t){this.props=e,this.context=t}function T(e,t){if(t==null)return e.__?T(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?T(e):null}function E(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],o=y({},t);o.__v=t.__v+1,a.vnode&&a.vnode(o),F(e.__P,o,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??T(t),!!(32&t.__u),i),o.__v=t.__v,o.__.__k[o.__i]=o,re(r,o,i),t.__e=t.__=null,o.__e!=n&&D(o)}}function D(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),D(e)}function O(e){(!e.__d&&(e.__d=!0)&&s.push(e)&&!k.__r++||c!=a.debounceRendering)&&((c=a.debounceRendering)||l)(k)}function k(){try{for(var e,t=1;s.length;)s.length>t&&s.sort(u),e=s.shift(),t=s.length,E(e)}finally{s.length=k.__r=0}}function ee(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,_,v,y,b=r&&r.__k||g,x=t.length;for(c=A(n,t,b,c,x),d=0;d<x;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&b[p.__i]||h,p.__i=d,v=F(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&L(f.ref,null,p),u.push(p.ref,p.__c||m,p)),_==null&&m!=null&&(_=m),(y=!!(4&p.__u))||f.__k===p.__k?c=j(p,c,e,y):typeof p.type==`function`&&v!==void 0?c=v:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=_,c}function A(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=S(null,o,null,null,null):v(o)?o=e.__k[a]=S(C,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=S(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=te(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=T(s)),oe(s,s));return r}function j(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=j(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=T(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function M(e,t){return t||=[],e==null||typeof e==`boolean`||(v(e)?e.some(function(e){M(e,t)}):t.push(e)),t}function te(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function ne(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||_.test(t)?n:n+`px`}function N(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||ne(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||ne(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(d,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n.u=r.u:(n.u=f,e.addEventListener(t,a?m:p,a)):e.removeEventListener(t,a?m:p,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function P(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=f++;else if(t.t<n.u)return;return n(a.event?a.event(t):t)}}}function F(e,t,n,r,i,o,s,c,l,u){var d,f,p,m,h,_,x,S,T,E,D,O,k,A,j,M=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),o=[c=t.__e=n.__e]),(d=a.__b)&&d(t);n:if(typeof M==`function`)try{if(S=t.props,T=M.prototype&&M.prototype.render,E=(d=M.contextType)&&r[d.__c],D=d?E?E.props.value:d.__:r,n.__c?x=(f=t.__c=n.__c).__=f.__E:(T?t.__c=f=new M(S,D):(t.__c=f=new w(S,D),f.constructor=M,f.render=se),E&&E.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),T&&f.__s==null&&(f.__s=f.state),T&&M.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=y({},f.__s)),y(f.__s,M.getDerivedStateFromProps(S,f.__s))),m=f.props,h=f.state,f.__v=t,p)T&&M.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),T&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(T&&M.getDerivedStateFromProps==null&&S!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(S,D),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(S,f.__s,D)){t.__v!=n.__v&&(f.props=S,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),g.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&s.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(S,f.__s,D),T&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,_)})}if(f.context=D,f.props=S,f.__P=e,f.__e=!1,O=a.__r,k=0,T)f.state=f.__s,f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),g.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,O&&O(t),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++k<25);f.state=f.__s,f.getChildContext!=null&&(r=y(y({},r),f.getChildContext())),T&&!p&&f.getSnapshotBeforeUpdate!=null&&(_=f.getSnapshotBeforeUpdate(m,h)),A=d!=null&&d.type===C&&d.key==null?ie(d.props.children):d,c=ee(e,v(A)?A:[A],t,n,r,i,o,s,c,l,u),f.base=t.__e,t.__u&=-161,f.__h.length&&s.push(f),x&&(f.__E=f.__=null)}catch(e){if(t.__v=null,l||o!=null)if(e.then){for(t.__u|=l?160:128;c&&c.nodeType==8&&c.nextSibling;)c=c.nextSibling;o[o.indexOf(c)]=null,t.__e=c}else{for(j=o.length;j--;)b(o[j]);I(t)}else t.__e=n.__e,t.__k=n.__k,e.then||I(t);a.__e(e,t,n)}else o==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):c=t.__e=ae(n.__e,t,n,r,i,o,s,l,u);return(d=a.diffed)&&d(t),128&t.__u?void 0:c}function I(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(I))}function re(e,t,n){for(var r=0;r<n.length;r++)L(n[r],n[++r],n[++r]);a.__c&&a.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){a.__e(e,t.__v)}})}function ie(e){return typeof e!=`object`||!e||e.__b>0?e:v(e)?e.map(ie):y({},e)}function ae(e,t,n,r,o,s,c,l,u){var d,f,p,m,g,_,y,x=n.props||h,S=t.props,C=t.type;if(C==`svg`?o=`http://www.w3.org/2000/svg`:C==`math`?o=`http://www.w3.org/1998/Math/MathML`:o||=`http://www.w3.org/1999/xhtml`,s!=null){for(d=0;d<s.length;d++)if((g=s[d])&&`setAttribute`in g==!!C&&(C?g.localName==C:g.nodeType==3)){e=g,s[d]=null;break}}if(e==null){if(C==null)return document.createTextNode(S);e=document.createElementNS(o,C,S.is&&S),l&&=(a.__m&&a.__m(t,s),!1),s=null}if(C==null)x===S||l&&e.data==S||(e.data=S);else{if(s&&=i.call(e.childNodes),!l&&s!=null)for(x={},d=0;d<e.attributes.length;d++)x[(g=e.attributes[d]).name]=g.value;for(d in x)g=x[d],d==`dangerouslySetInnerHTML`?p=g:d==`children`||d in S||d==`value`&&`defaultValue`in S||d==`checked`&&`defaultChecked`in S||N(e,d,null,g,o);for(d in S)g=S[d],d==`children`?m=g:d==`dangerouslySetInnerHTML`?f=g:d==`value`?_=g:d==`checked`?y=g:l&&typeof g!=`function`||x[d]===g||N(e,d,g,x[d],o);if(f)l||p&&(f.__html==p.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(p&&(e.innerHTML=``),ee(t.type==`template`?e.content:e,v(m)?m:[m],t,n,r,C==`foreignObject`?`http://www.w3.org/1999/xhtml`:o,s,c,s?s[0]:n.__k&&T(n,0),l,u),s!=null)for(d=s.length;d--;)b(s[d]);l||(d=`value`,C==`progress`&&_==null?e.removeAttribute(`value`):_!=null&&(_!==e[d]||C==`progress`&&!_||C==`option`&&_!=x[d])&&N(e,d,_,x[d],o),d=`checked`,y!=null&&y!=e[d]&&N(e,d,y,x[d],o))}return e}function L(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){a.__e(e,n)}}function oe(e,t,n){var r,i;if(a.unmount&&a.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||L(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){a.__e(e,t)}r.base=r.__P=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&oe(r[i],t,n||typeof e.type!=`function`);n||b(e.__e),e.__c=e.__=e.__e=void 0}function se(e,t,n){return this.constructor(e,n)}function R(e,t,n){var r,o,s,c;t==document&&(t=document.documentElement),a.__&&a.__(e,t),o=(r=typeof n==`function`)?null:n&&n.__k||t.__k,s=[],c=[],F(t,e=(!r&&n||t).__k=x(C,null,[e]),o||h,h,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?i.call(t.childNodes):null,s,!r&&n?n:o?o.__e:t.firstChild,r,c),re(s,e,c)}function ce(e,t){R(e,t,ce)}function z(e,t,n){var r,a,o,s,c=y({},e.props);for(o in e.type&&e.type.defaultProps&&(s=e.type.defaultProps),t)o==`key`?r=t[o]:o==`ref`?a=t[o]:c[o]=t[o]===void 0&&s!=null?s[o]:t[o];return arguments.length>2&&(c.children=arguments.length>3?i.call(arguments,2):n),S(e.type,c,r||e.key,a||e.ref,null)}i=g.slice,a={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},o=0,w.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=y({},this.state);typeof e==`function`&&(e=e(y({},n),this.props)),e&&y(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),O(this))},w.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),O(this))},w.prototype.render=C,s=[],l=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,u=function(e,t){return e.__v.__b-t.__v.__b},k.__r=0,d=/(PointerCapture)$|Capture$/i,f=0,p=P(!1),m=P(!0);function B(){return B=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},B.apply(this,arguments)}function V(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}var le=[`context`,`children`],ue=[`useFragment`];function de(e,t,n,r){function i(){var t,n=Reflect.construct(HTMLElement,[],i);return n._vdomComponent=e,r&&r.shadow?(n._root=n.attachShadow({mode:r.mode||`open`,serializable:(t=r.serializable)!=null&&t}),r.adoptedStyleSheets&&(n._root.adoptedStyleSheets=r.adoptedStyleSheets)):n._root=n,n}return(i.prototype=Object.create(HTMLElement.prototype)).constructor=i,i.prototype.connectedCallback=function(){pe.call(this,r)},i.prototype.attributeChangedCallback=me,i.prototype.disconnectedCallback=he,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),i.observedAttributes=n,e.formAssociated&&(i.formAssociated=!0),n.forEach(function(e){Object.defineProperty(i.prototype,e,{get:function(){return this._vdom?this._vdom.props[e]:this._props[e]},set:function(t){this._vdom?this.attributeChangedCallback(e,null,t):(this._props||={},this._props[e]=t);var n=typeof t;t!=null&&n!==`string`&&n!==`boolean`&&n!==`number`||this.setAttribute(e,t)}})}),customElements.define(t||e.tagName||e.displayName||e.name,i),i}function fe(e){this.getChildContext=function(){return e.context};var t=e.children;return z(t,V(e,le))}function pe(e){var t=new CustomEvent(`_preact`,{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(t),this._vdom=x(fe,B({},this._props,{context:t.detail.context}),_e(this,this._vdomComponent,e)),(this.hasAttribute(`hydrate`)?ce:R)(this._vdom,this._root)}function H(e){return e.replace(/-(\w)/g,function(e,t){return t?t.toUpperCase():``})}function me(e,t,n){if(this._vdom){var r={};r[e]=n??=void 0,r[H(e)]=n,this._vdom=z(this._vdom,r),R(this._vdom,this._root)}}function he(){R(this._vdom=null,this._root)}function ge(e,t){var n=this,r=e.useFragment,i=V(e,ue);return x(r?C:`slot`,B({},i,{ref:function(e){e?(n.ref=e,n._listener||(n._listener=function(e){e.stopPropagation(),e.detail.context=t},e.addEventListener(`_preact`,n._listener))):n.ref.removeEventListener(`_preact`,n._listener)}}))}function _e(e,t,n){if(e.nodeType===3)return e.data;if(e.nodeType!==1)return null;var r=[],i={},a=0,o=e.attributes,s=e.childNodes;for(a=o.length;a--;)o[a].name!==`slot`&&(i[o[a].name]=o[a].value,i[H(o[a].name)]=o[a].value);for(a=s.length;a--;){var c=_e(s[a],null,n),l=s[a].slot;l?i[l]=x(ge,{name:l},c):r[a]=c}var u=!(!n||!n.shadow),d=t?x(ge,{useFragment:!u},r):r;return!u&&t&&(e.innerHTML=``),x(t||e.nodeName.toLowerCase(),i,d)}function ve(t,r,i=[],a={shadow:!0}){typeof window<`u`&&(e(n),customElements.get(r)||de(t,r,i,a))}var ye=0;Array.isArray;function be(e,t,n,r,i,o){t||={};var s,c,l=t;if(`ref`in l)for(c in l={},t)c==`ref`?s=t[c]:l[c]=t[c];var u={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--ye,__i:-1,__u:0,__source:i,__self:o};if(typeof e==`function`&&(s=e.defaultProps))for(c in s)l[c]===void 0&&(l[c]=s[c]);return a.vnode&&a.vnode(u),u}var U,W,G,xe,K=0,Se=[],q=a,Ce=q.__b,we=q.__r,Te=q.diffed,Ee=q.__c,De=q.unmount,Oe=q.__;function J(e,t){q.__h&&q.__h(W,e,K||t),K=0;var n=W.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Y(e){return K=1,ke(Ie,e)}function ke(e,t,n){var r=J(U++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ie(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter(function(e){return e.__c});if(i.every(function(e){return!e.__N}))return!a||a.call(this,e,t,n);var o=r.__c.props!==e;return i.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a&&a.call(this,e,t,n)||o};W.__f=!0;var a=W.shouldComponentUpdate,o=W.componentWillUpdate;W.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},W.shouldComponentUpdate=i}return r.__N||r.__}function X(e,t){var n=J(U++,3);!q.__s&&Fe(n.__H,t)&&(n.__=e,n.u=t,W.__H.__h.push(n))}function Ae(e){return K=5,Z(function(){return{current:e}},[])}function Z(e,t){var n=J(U++,7);return Fe(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function je(e,t){return K=8,Z(function(){return e},t)}function Me(){for(var e;e=Se.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Q),t.__h.some($),t.__h=[]}catch(n){t.__h=[],q.__e(n,e.__v)}}}q.__b=function(e){W=null,Ce&&Ce(e)},q.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Oe&&Oe(e,t)},q.__r=function(e){we&&we(e),U=0;var t=(W=e.__c).__H;t&&(G===W?(t.__h=[],W.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(Q),t.__h.some($),t.__h=[],U=0)),G=W},q.diffed=function(e){Te&&Te(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Se.push(t)!==1&&xe===q.requestAnimationFrame||((xe=q.requestAnimationFrame)||Pe)(Me)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),G=W=null},q.__c=function(e,t){t.some(function(e){try{e.__h.some(Q),e.__h=e.__h.filter(function(e){return!e.__||$(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],q.__e(n,e.__v)}}),Ee&&Ee(e,t)},q.unmount=function(e){De&&De(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{Q(e)}catch(e){t=e}}),n.__H=void 0,t&&q.__e(t,n.__v))};var Ne=typeof requestAnimationFrame==`function`;function Pe(e){var t,n=function(){clearTimeout(r),Ne&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ne&&(t=requestAnimationFrame(n))}function Q(e){var t=W,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),W=t}function $(e){var t=W;e.__c=e.__(),W=t}function Fe(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Ie(e,t){return typeof t==`function`?t(e):t}function Le(){let[e,n]=Y(()=>window.FrakSetup?.config?.waitForBackendConfig===!1?!0:r.isResolved),[i,a]=Y(()=>r.getConfig().hidden??!1),[o,s]=Y(()=>!!window.FrakSetup?.client);return X(()=>{let e=r.getConfig();e.isResolved&&(n(!0),a(e.hidden??!1)),window.FrakSetup?.client&&s(!0);let i=e=>{let t=e.detail;t.isResolved&&n(!0),a(t.hidden??!1)};window.addEventListener(`frak:config`,i);let o=()=>s(!0);return t(`add`,o),()=>{window.removeEventListener(`frak:config`,i),t(`remove`,o)}},[]),{shouldRender:e,isHidden:i,isClientReady:o}}const Re=`
|
|
2
|
-
:host {
|
|
3
|
-
display: contents;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
:host([hidden]) {
|
|
7
|
-
display: none;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.button:disabled {
|
|
11
|
-
opacity: 0.7;
|
|
12
|
-
cursor: default;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.button__fadeIn {
|
|
16
|
-
animation: frak-fadeIn 300ms ease-in;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@keyframes frak-fadeIn {
|
|
20
|
-
from {
|
|
21
|
-
opacity: 0;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
to {
|
|
25
|
-
opacity: 1;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
`;function ze(e,t){return t?`${Re}\n${e}\n${t}`:`${Re}\n${e}`}const Be=`
|
|
29
|
-
:where(frak-button-share, frak-open-in-app) {
|
|
30
|
-
display: contents;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
:where(frak-button-share .button, frak-open-in-app .button) {
|
|
34
|
-
display: flex;
|
|
35
|
-
align-items: center;
|
|
36
|
-
justify-content: center;
|
|
37
|
-
gap: 10px;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
:where(frak-button-share .button:disabled, frak-open-in-app .button:disabled) {
|
|
41
|
-
opacity: 0.7;
|
|
42
|
-
cursor: default;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
:where(frak-button-share .button__fadeIn, frak-open-in-app .button__fadeIn) {
|
|
46
|
-
animation: frak-fadeIn 300ms ease-in;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@keyframes frak-fadeIn {
|
|
50
|
-
from {
|
|
51
|
-
opacity: 0;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
to {
|
|
55
|
-
opacity: 1;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
`;function Ve(e){return r.getConfig().placements?.[e]}function He(e){let[t,n]=Y(0);return X(()=>{let e=e=>{n(e=>e+1)};return window.addEventListener(`frak:config`,e),n(e=>e+1),()=>window.removeEventListener(`frak:config`,e)},[]),Z(()=>e?Ve(e):void 0,[e,t])}export{Ae as a,je as c,ve as d,M as f,w as g,a as h,Le as i,X as l,C as m,ze as n,Z as o,x as p,Be as r,Y as s,He as t,be as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c as e,h as t,p as n}from"./loader.js";import{l as r,s as i}from"./usePlacement.BgMXY5CX.js";import{n as a}from"./formatReward.B1ZyoceC.js";function o(e,t){switch(e.payoutType){case`fixed`:return e.amount[t];case`tiered`:return e.tiers.reduce((e,n)=>Math.max(e,n.amount[t]),0);case`percentage`:return 0}}function s({rewards:e},r,i){let s=(i?e.filter(e=>e.interactionTypeKey===i):e).map(e=>e.referrer).filter(e=>e!==void 0);if(s.length===0)return;let c=n(t(r)),l=s[0],u=o(l,c);for(let e=1;e<s.length;e++){let t=o(s[e],c);t>u&&(l=s[e],u=t)}if(u<=0){let e=s.find(e=>e.payoutType===`percentage`);if(!e)return;l=e}return a(l,r)}function c(t,n){let[a,o]=i(void 0);return r(()=>{if(!t)return;let r=window.FrakSetup?.client;r&&e(r).then(e=>{let t=r.config.metadata?.currency,i=s(e,t,n);i&&o(i)}).catch(()=>{})},[t,n]),{reward:a}}export{c as t};
|