@directcryptopay/sdk 0.2.4 → 0.3.0
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/README.md +51 -87
- package/dist/core/config.d.ts +9 -46
- package/dist/core/iframe.d.ts +16 -0
- package/dist/dcp-sdk.umd.js +1 -12811
- package/dist/dcp.d.ts +12 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +219 -2
- package/dist/types.d.ts +26 -164
- package/package.json +3 -13
- package/dist/ExchangeController-CbO41bcH.js +0 -217
- package/dist/HelpersUtil-DHm6EVSE.js +0 -120
- package/dist/NavigationUtil-kj9LEOOd.js +0 -8
- package/dist/PhArrowCircleDown-lsK25DCk.js +0 -73
- package/dist/PhArrowClockwise-NeKHZ1co.js +0 -73
- package/dist/PhArrowDown-C9AkNvLs.js +0 -73
- package/dist/PhArrowLeft-RNfIQP1X.js +0 -73
- package/dist/PhArrowRight-DM1tna0G.js +0 -73
- package/dist/PhArrowSquareOut-S5XYbAZj.js +0 -73
- package/dist/PhArrowUp-DmktzOWy.js +0 -73
- package/dist/PhArrowUpRight-BkNeW_5i.js +0 -73
- package/dist/PhArrowsClockwise-CQ4pG76b.js +0 -73
- package/dist/PhArrowsDownUp-H6gxaNM6.js +0 -73
- package/dist/PhArrowsLeftRight-DZSsfMR6.js +0 -73
- package/dist/PhBank-4_9QzqIB.js +0 -73
- package/dist/PhBrowser-B-JSznId.js +0 -73
- package/dist/PhCaretDown-vV5oHMNi.js +0 -73
- package/dist/PhCaretLeft-BLo6Y_f4.js +0 -73
- package/dist/PhCaretRight-CqQN4TT3.js +0 -73
- package/dist/PhCaretUp-Df7UCAHy.js +0 -73
- package/dist/PhCheck-gtpfK4ed.js +0 -73
- package/dist/PhCircleHalf-Uq7dwDYw.js +0 -73
- package/dist/PhClock-SDCW-NmF.js +0 -73
- package/dist/PhCompass-B7hgtdx-.js +0 -73
- package/dist/PhCopy-BcnhyXCy.js +0 -73
- package/dist/PhCreditCard-BJjByVgu.js +0 -73
- package/dist/PhCurrencyDollar-B7ZXqXBy.js +0 -73
- package/dist/PhDesktop-B3VKPuJx.js +0 -73
- package/dist/PhDeviceMobile-Bnd0TYEH.js +0 -73
- package/dist/PhDotsThree-yyMWyZ-R.js +0 -73
- package/dist/PhEnvelope-67uzHbI9.js +0 -73
- package/dist/PhFunnelSimple-B-DCsloI.js +0 -73
- package/dist/PhGlobe-TMm_6qGk.js +0 -73
- package/dist/PhIdentificationCard-CePPD2xc.js +0 -73
- package/dist/PhImage-gY96WtHR.js +0 -73
- package/dist/PhInfo-DRQM_ZDP.js +0 -73
- package/dist/PhLightbulb-B0TxPfZ1.js +0 -73
- package/dist/PhMagnifyingGlass-B8si5_6W.js +0 -73
- package/dist/PhPaperPlaneRight-DVu5PLYd.js +0 -73
- package/dist/PhPlus-BfTsQnUz.js +0 -73
- package/dist/PhPower-CxYUGOWn.js +0 -73
- package/dist/PhPuzzlePiece-CQ4wh0gV.js +0 -73
- package/dist/PhQrCode-BuJ97NYJ.js +0 -73
- package/dist/PhQuestion-kJoP8Mja.js +0 -73
- package/dist/PhQuestionMark-C46ZkFpu.js +0 -73
- package/dist/PhSealCheck-Eh8jVqSN.js +0 -73
- package/dist/PhSignOut-jk97OSVt.js +0 -73
- package/dist/PhSpinner-CiYOhwMg.js +0 -73
- package/dist/PhTrash-pxerMqzd.js +0 -73
- package/dist/PhUser-BMg0VV4A.js +0 -73
- package/dist/PhVault-DYQvx5A-.js +0 -73
- package/dist/PhWarning-NLC5Mj87.js +0 -73
- package/dist/PhWarningCircle-Ch2jU9fA.js +0 -73
- package/dist/PhX-Bx4wpwm3.js +0 -73
- package/dist/SwapController-Ch0FFTEt.js +0 -457
- package/dist/ccip-BrGhNXIM.js +0 -150
- package/dist/core/api.d.ts +0 -39
- package/dist/core/logic.d.ts +0 -2
- package/dist/core/wallet.d.ts +0 -55
- package/dist/data-capture-CpafmuCb.js +0 -490
- package/dist/email-Dcg4jlai.js +0 -344
- package/dist/embedded-wallet-DeoRdAPw.js +0 -820
- package/dist/features-B9Nde43h.js +0 -274
- package/dist/hashTypedData-a7b8tdkO.js +0 -197
- package/dist/if-defined-k21LutCn.js +0 -10
- package/dist/index-9vLw53Xl.js +0 -228
- package/dist/index-B5wUyynz.js +0 -107
- package/dist/index-B8LkUrww.js +0 -86
- package/dist/index-BA0VwKg0.js +0 -8189
- package/dist/index-BB9JJ24N.js +0 -125
- package/dist/index-BCkEvPQ6.js +0 -172
- package/dist/index-BDeO_csr.js +0 -171
- package/dist/index-Bb7babLF.js +0 -1281
- package/dist/index-BjOhprVS.js +0 -199
- package/dist/index-BjyMgZsf.js +0 -218
- package/dist/index-BkThIDLX.js +0 -159
- package/dist/index-BmFs6nb7.js +0 -209
- package/dist/index-C1QEJL-2.js +0 -572
- package/dist/index-C4qc4PdD.js +0 -387
- package/dist/index-CAPvUh14.js +0 -1750
- package/dist/index-CBMU3PTE.js +0 -65
- package/dist/index-CGwPkJLF.js +0 -355
- package/dist/index-CNGEqX3D.js +0 -153
- package/dist/index-CRlCq6IB.js +0 -7981
- package/dist/index-Cg_o-i9X.js +0 -118
- package/dist/index-D1BvhCbI.js +0 -62
- package/dist/index-DFi8TiHc.js +0 -128
- package/dist/index-DLwuveL9.js +0 -555
- package/dist/index-DMn7ktUQ.js +0 -56
- package/dist/index-DOXwtuwa.js +0 -117
- package/dist/index-DPPOW_Tp.js +0 -118
- package/dist/index-DQpzHpW-.js +0 -517
- package/dist/index-DXHg5C-W.js +0 -276
- package/dist/index-DcYjZV4H.js +0 -110
- package/dist/index-DeL88Lwc.js +0 -41655
- package/dist/index-DrWVlf8b.js +0 -46
- package/dist/index-Dsfuc4rB.js +0 -123
- package/dist/index-DuTny38n.js +0 -1175
- package/dist/index-Nfjb6bV0.js +0 -21991
- package/dist/index-WwwdQSN2.js +0 -85
- package/dist/index-Yha9Afch.js +0 -174
- package/dist/index-cbQHN7GC.js +0 -100
- package/dist/index-hyG3cYsv.js +0 -1083
- package/dist/index-qLxmmPaL.js +0 -257
- package/dist/localBatchGatewayRequest-vfcvRH0G.js +0 -91
- package/dist/onramp-BSiyOX4L.js +0 -855
- package/dist/parseSignature-CdCMAPZN.js +0 -3304
- package/dist/pay-with-exchange-CduNoMEz.js +0 -525
- package/dist/property-Bd8U3_QP.js +0 -618
- package/dist/receive-CrmptJlq.js +0 -232
- package/dist/ref-SOwYtCZb.js +0 -107
- package/dist/send-oMcHMEr6.js +0 -1166
- package/dist/socials-C0A4-FbY.js +0 -620
- package/dist/swaps-CbJJ9Ciu.js +0 -1760
- package/dist/transactions-BDfCoBS5.js +0 -37
- package/dist/ui/Modal.d.ts +0 -9
- package/dist/ui/index.d.ts +0 -6
- package/dist/w3m-modal-BjsTkny7.js +0 -1706
package/dist/socials-C0A4-FbY.js
DELETED
|
@@ -1,620 +0,0 @@
|
|
|
1
|
-
import { cU as O, cX as _, d8 as S, cM as h, dw as W, d0 as f, cL as T, cY as c, cG as C, dx as F, d6 as D, cE as d, d1 as P, dg as N, cF as u, dn as A, cH as v, dy as M, df as R, di as y } from "./index-DeL88Lwc.js";
|
|
2
|
-
import { n as j, r as l, c as I } from "./index-DuTny38n.js";
|
|
3
|
-
import { o as $ } from "./if-defined-k21LutCn.js";
|
|
4
|
-
import { O as U } from "./index-qLxmmPaL.js";
|
|
5
|
-
import { e as q } from "./index-Yha9Afch.js";
|
|
6
|
-
import "./index-Cg_o-i9X.js";
|
|
7
|
-
import "./index-CBMU3PTE.js";
|
|
8
|
-
import "./index-BmFs6nb7.js";
|
|
9
|
-
import "./index-CAPvUh14.js";
|
|
10
|
-
import "./index-D1BvhCbI.js";
|
|
11
|
-
const z = O`
|
|
12
|
-
:host {
|
|
13
|
-
margin-top: ${({ spacing: t }) => t[1]};
|
|
14
|
-
}
|
|
15
|
-
wui-separator {
|
|
16
|
-
margin: ${({ spacing: t }) => t[3]} calc(${({ spacing: t }) => t[3]} * -1)
|
|
17
|
-
${({ spacing: t }) => t[2]} calc(${({ spacing: t }) => t[3]} * -1);
|
|
18
|
-
width: calc(100% + ${({ spacing: t }) => t[3]} * 2);
|
|
19
|
-
}
|
|
20
|
-
`;
|
|
21
|
-
var g = function(t, e, o, r) {
|
|
22
|
-
var n = arguments.length, i = n < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, o) : r, s;
|
|
23
|
-
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(t, e, o, r);
|
|
24
|
-
else for (var a = t.length - 1; a >= 0; a--) (s = t[a]) && (i = (n < 3 ? s(i) : n > 3 ? s(e, o, i) : s(e, o)) || i);
|
|
25
|
-
return n > 3 && i && Object.defineProperty(e, o, i), i;
|
|
26
|
-
};
|
|
27
|
-
let p = class extends _ {
|
|
28
|
-
constructor() {
|
|
29
|
-
super(), this.unsubscribe = [], this.tabIdx = void 0, this.connectors = S.state.connectors, this.authConnector = this.connectors.find((e) => e.type === "AUTH"), this.remoteFeatures = h.state.remoteFeatures, this.isPwaLoading = !1, this.hasExceededUsageLimit = W.state.plan.hasExceededUsageLimit, this.unsubscribe.push(S.subscribeKey("connectors", (e) => {
|
|
30
|
-
this.connectors = e, this.authConnector = this.connectors.find((o) => o.type === "AUTH");
|
|
31
|
-
}), h.subscribeKey("remoteFeatures", (e) => this.remoteFeatures = e));
|
|
32
|
-
}
|
|
33
|
-
connectedCallback() {
|
|
34
|
-
super.connectedCallback(), this.handlePwaFrameLoad();
|
|
35
|
-
}
|
|
36
|
-
disconnectedCallback() {
|
|
37
|
-
this.unsubscribe.forEach((e) => e());
|
|
38
|
-
}
|
|
39
|
-
render() {
|
|
40
|
-
var i;
|
|
41
|
-
let e = ((i = this.remoteFeatures) == null ? void 0 : i.socials) || [];
|
|
42
|
-
const o = !!this.authConnector, r = e == null ? void 0 : e.length, n = f.state.view === "ConnectSocials";
|
|
43
|
-
return (!o || !r) && !n ? null : (n && !r && (e = T.DEFAULT_SOCIALS), c` <wui-flex flexDirection="column" gap="2">
|
|
44
|
-
${e.map((s) => c`<wui-list-social
|
|
45
|
-
@click=${() => {
|
|
46
|
-
this.onSocialClick(s);
|
|
47
|
-
}}
|
|
48
|
-
data-testid=${`social-selector-${s}`}
|
|
49
|
-
name=${s}
|
|
50
|
-
logo=${s}
|
|
51
|
-
?disabled=${this.isPwaLoading}
|
|
52
|
-
></wui-list-social>`)}
|
|
53
|
-
</wui-flex>`);
|
|
54
|
-
}
|
|
55
|
-
async onSocialClick(e) {
|
|
56
|
-
if (this.hasExceededUsageLimit) {
|
|
57
|
-
f.push("UsageExceeded");
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
e && await q(e);
|
|
61
|
-
}
|
|
62
|
-
async handlePwaFrameLoad() {
|
|
63
|
-
var e;
|
|
64
|
-
if (C.isPWA()) {
|
|
65
|
-
this.isPwaLoading = !0;
|
|
66
|
-
try {
|
|
67
|
-
((e = this.authConnector) == null ? void 0 : e.provider) instanceof F && await this.authConnector.provider.init();
|
|
68
|
-
} catch (o) {
|
|
69
|
-
D.open({
|
|
70
|
-
displayMessage: "Error loading embedded wallet in PWA",
|
|
71
|
-
debugMessage: o.message
|
|
72
|
-
}, "error");
|
|
73
|
-
} finally {
|
|
74
|
-
this.isPwaLoading = !1;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
p.styles = z;
|
|
80
|
-
g([
|
|
81
|
-
j()
|
|
82
|
-
], p.prototype, "tabIdx", void 0);
|
|
83
|
-
g([
|
|
84
|
-
l()
|
|
85
|
-
], p.prototype, "connectors", void 0);
|
|
86
|
-
g([
|
|
87
|
-
l()
|
|
88
|
-
], p.prototype, "authConnector", void 0);
|
|
89
|
-
g([
|
|
90
|
-
l()
|
|
91
|
-
], p.prototype, "remoteFeatures", void 0);
|
|
92
|
-
g([
|
|
93
|
-
l()
|
|
94
|
-
], p.prototype, "isPwaLoading", void 0);
|
|
95
|
-
g([
|
|
96
|
-
l()
|
|
97
|
-
], p.prototype, "hasExceededUsageLimit", void 0);
|
|
98
|
-
p = g([
|
|
99
|
-
I("w3m-social-login-list")
|
|
100
|
-
], p);
|
|
101
|
-
const G = O`
|
|
102
|
-
wui-flex {
|
|
103
|
-
max-height: clamp(360px, 540px, 80vh);
|
|
104
|
-
overflow: scroll;
|
|
105
|
-
scrollbar-width: none;
|
|
106
|
-
transition: opacity ${({ durations: t }) => t.md}
|
|
107
|
-
${({ easings: t }) => t["ease-out-power-1"]};
|
|
108
|
-
will-change: opacity;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
wui-flex::-webkit-scrollbar {
|
|
112
|
-
display: none;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
wui-flex.disabled {
|
|
116
|
-
opacity: 0.3;
|
|
117
|
-
pointer-events: none;
|
|
118
|
-
user-select: none;
|
|
119
|
-
}
|
|
120
|
-
`;
|
|
121
|
-
var k = function(t, e, o, r) {
|
|
122
|
-
var n = arguments.length, i = n < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, o) : r, s;
|
|
123
|
-
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(t, e, o, r);
|
|
124
|
-
else for (var a = t.length - 1; a >= 0; a--) (s = t[a]) && (i = (n < 3 ? s(i) : n > 3 ? s(e, o, i) : s(e, o)) || i);
|
|
125
|
-
return n > 3 && i && Object.defineProperty(e, o, i), i;
|
|
126
|
-
};
|
|
127
|
-
let L = class extends _ {
|
|
128
|
-
constructor() {
|
|
129
|
-
super(), this.unsubscribe = [], this.checked = U.state.isLegalCheckboxChecked, this.unsubscribe.push(U.subscribeKey("isLegalCheckboxChecked", (e) => {
|
|
130
|
-
this.checked = e;
|
|
131
|
-
}));
|
|
132
|
-
}
|
|
133
|
-
disconnectedCallback() {
|
|
134
|
-
this.unsubscribe.forEach((e) => e());
|
|
135
|
-
}
|
|
136
|
-
render() {
|
|
137
|
-
var E;
|
|
138
|
-
const { termsConditionsUrl: e, privacyPolicyUrl: o } = h.state, r = (E = h.state.features) == null ? void 0 : E.legalCheckbox, s = !!(e || o) && !!r && !this.checked, a = s ? -1 : void 0;
|
|
139
|
-
return c`
|
|
140
|
-
<w3m-legal-checkbox></w3m-legal-checkbox>
|
|
141
|
-
<wui-flex
|
|
142
|
-
flexDirection="column"
|
|
143
|
-
.padding=${["0", "3", "3", "3"]}
|
|
144
|
-
gap="01"
|
|
145
|
-
class=${$(s ? "disabled" : void 0)}
|
|
146
|
-
>
|
|
147
|
-
<w3m-social-login-list tabIdx=${$(a)}></w3m-social-login-list>
|
|
148
|
-
</wui-flex>
|
|
149
|
-
`;
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
L.styles = G;
|
|
153
|
-
k([
|
|
154
|
-
l()
|
|
155
|
-
], L.prototype, "checked", void 0);
|
|
156
|
-
L = k([
|
|
157
|
-
I("w3m-connect-socials-view")
|
|
158
|
-
], L);
|
|
159
|
-
const B = O`
|
|
160
|
-
wui-logo {
|
|
161
|
-
width: 80px;
|
|
162
|
-
height: 80px;
|
|
163
|
-
border-radius: ${({ borderRadius: t }) => t[8]};
|
|
164
|
-
}
|
|
165
|
-
@keyframes shake {
|
|
166
|
-
0% {
|
|
167
|
-
transform: translateX(0);
|
|
168
|
-
}
|
|
169
|
-
25% {
|
|
170
|
-
transform: translateX(3px);
|
|
171
|
-
}
|
|
172
|
-
50% {
|
|
173
|
-
transform: translateX(-3px);
|
|
174
|
-
}
|
|
175
|
-
75% {
|
|
176
|
-
transform: translateX(3px);
|
|
177
|
-
}
|
|
178
|
-
100% {
|
|
179
|
-
transform: translateX(0);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
wui-flex:first-child:not(:only-child) {
|
|
183
|
-
position: relative;
|
|
184
|
-
}
|
|
185
|
-
wui-loading-thumbnail {
|
|
186
|
-
position: absolute;
|
|
187
|
-
}
|
|
188
|
-
wui-icon-box {
|
|
189
|
-
position: absolute;
|
|
190
|
-
right: calc(${({ spacing: t }) => t[1]} * -1);
|
|
191
|
-
bottom: calc(${({ spacing: t }) => t[1]} * -1);
|
|
192
|
-
opacity: 0;
|
|
193
|
-
transform: scale(0.5);
|
|
194
|
-
transition: all ${({ easings: t }) => t["ease-out-power-2"]}
|
|
195
|
-
${({ durations: t }) => t.lg};
|
|
196
|
-
}
|
|
197
|
-
wui-text[align='center'] {
|
|
198
|
-
width: 100%;
|
|
199
|
-
padding: 0px ${({ spacing: t }) => t[4]};
|
|
200
|
-
}
|
|
201
|
-
[data-error='true'] wui-icon-box {
|
|
202
|
-
opacity: 1;
|
|
203
|
-
transform: scale(1);
|
|
204
|
-
}
|
|
205
|
-
[data-error='true'] > wui-flex:first-child {
|
|
206
|
-
animation: shake 250ms ${({ easings: t }) => t["ease-out-power-2"]} both;
|
|
207
|
-
}
|
|
208
|
-
.capitalize {
|
|
209
|
-
text-transform: capitalize;
|
|
210
|
-
}
|
|
211
|
-
`;
|
|
212
|
-
var b = function(t, e, o, r) {
|
|
213
|
-
var n = arguments.length, i = n < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, o) : r, s;
|
|
214
|
-
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(t, e, o, r);
|
|
215
|
-
else for (var a = t.length - 1; a >= 0; a--) (s = t[a]) && (i = (n < 3 ? s(i) : n > 3 ? s(e, o, i) : s(e, o)) || i);
|
|
216
|
-
return n > 3 && i && Object.defineProperty(e, o, i), i;
|
|
217
|
-
};
|
|
218
|
-
let m = class extends _ {
|
|
219
|
-
constructor() {
|
|
220
|
-
var o, r, n;
|
|
221
|
-
super(), this.unsubscribe = [], this.socialProvider = (o = d.getAccountData()) == null ? void 0 : o.socialProvider, this.socialWindow = (r = d.getAccountData()) == null ? void 0 : r.socialWindow, this.error = !1, this.connecting = !1, this.message = "Connect in the provider window", this.remoteFeatures = h.state.remoteFeatures, this.address = (n = d.getAccountData()) == null ? void 0 : n.address, this.connectionsByNamespace = P.getConnections(d.state.activeChain), this.hasMultipleConnections = this.connectionsByNamespace.length > 0, this.authConnector = S.getAuthConnector(), this.handleSocialConnection = async (i) => {
|
|
222
|
-
var s;
|
|
223
|
-
if ((s = i.data) != null && s.resultUri)
|
|
224
|
-
if (i.origin === N.SECURE_SITE_ORIGIN) {
|
|
225
|
-
window.removeEventListener("message", this.handleSocialConnection, !1);
|
|
226
|
-
try {
|
|
227
|
-
if (this.authConnector && !this.connecting) {
|
|
228
|
-
this.connecting = !0;
|
|
229
|
-
const a = this.parseURLError(i.data.resultUri);
|
|
230
|
-
if (a) {
|
|
231
|
-
this.handleSocialError(a);
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
this.closeSocialWindow(), this.updateMessage();
|
|
235
|
-
const E = i.data.resultUri;
|
|
236
|
-
this.socialProvider && u.sendEvent({
|
|
237
|
-
type: "track",
|
|
238
|
-
event: "SOCIAL_LOGIN_REQUEST_USER_DATA",
|
|
239
|
-
properties: { provider: this.socialProvider }
|
|
240
|
-
}), await P.connectExternal({
|
|
241
|
-
id: this.authConnector.id,
|
|
242
|
-
type: this.authConnector.type,
|
|
243
|
-
socialUri: E
|
|
244
|
-
}, this.authConnector.chain), this.socialProvider && (A.setConnectedSocialProvider(this.socialProvider), u.sendEvent({
|
|
245
|
-
type: "track",
|
|
246
|
-
event: "SOCIAL_LOGIN_SUCCESS",
|
|
247
|
-
properties: { provider: this.socialProvider }
|
|
248
|
-
}));
|
|
249
|
-
}
|
|
250
|
-
} catch (a) {
|
|
251
|
-
this.error = !0, this.updateMessage(), this.socialProvider && u.sendEvent({
|
|
252
|
-
type: "track",
|
|
253
|
-
event: "SOCIAL_LOGIN_ERROR",
|
|
254
|
-
properties: {
|
|
255
|
-
provider: this.socialProvider,
|
|
256
|
-
message: C.parseError(a)
|
|
257
|
-
}
|
|
258
|
-
});
|
|
259
|
-
}
|
|
260
|
-
} else
|
|
261
|
-
f.goBack(), v.showError("Untrusted Origin"), this.socialProvider && u.sendEvent({
|
|
262
|
-
type: "track",
|
|
263
|
-
event: "SOCIAL_LOGIN_ERROR",
|
|
264
|
-
properties: {
|
|
265
|
-
provider: this.socialProvider,
|
|
266
|
-
message: "Untrusted Origin"
|
|
267
|
-
}
|
|
268
|
-
});
|
|
269
|
-
}, M.EmbeddedWalletAbortController.signal.addEventListener("abort", () => {
|
|
270
|
-
this.closeSocialWindow();
|
|
271
|
-
}), this.unsubscribe.push(d.subscribeChainProp("accountState", (i) => {
|
|
272
|
-
var s;
|
|
273
|
-
if (i && (this.socialProvider = i.socialProvider, i.socialWindow && (this.socialWindow = i.socialWindow), i.address)) {
|
|
274
|
-
const a = (s = this.remoteFeatures) == null ? void 0 : s.multiWallet;
|
|
275
|
-
i.address !== this.address && (this.hasMultipleConnections && a ? (f.replace("ProfileWallets"), v.showSuccess("New Wallet Added"), this.address = i.address) : (R.state.open || h.state.enableEmbedded) && R.close());
|
|
276
|
-
}
|
|
277
|
-
}), h.subscribeKey("remoteFeatures", (i) => {
|
|
278
|
-
this.remoteFeatures = i;
|
|
279
|
-
})), this.authConnector && this.connectSocial();
|
|
280
|
-
}
|
|
281
|
-
disconnectedCallback() {
|
|
282
|
-
this.unsubscribe.forEach((o) => o()), window.removeEventListener("message", this.handleSocialConnection, !1), !d.state.activeCaipAddress && this.socialProvider && !this.connecting && u.sendEvent({
|
|
283
|
-
type: "track",
|
|
284
|
-
event: "SOCIAL_LOGIN_CANCELED",
|
|
285
|
-
properties: { provider: this.socialProvider }
|
|
286
|
-
}), this.closeSocialWindow();
|
|
287
|
-
}
|
|
288
|
-
render() {
|
|
289
|
-
return c`
|
|
290
|
-
<wui-flex
|
|
291
|
-
data-error=${$(this.error)}
|
|
292
|
-
flexDirection="column"
|
|
293
|
-
alignItems="center"
|
|
294
|
-
.padding=${["10", "5", "5", "5"]}
|
|
295
|
-
gap="6"
|
|
296
|
-
>
|
|
297
|
-
<wui-flex justifyContent="center" alignItems="center">
|
|
298
|
-
<wui-logo logo=${$(this.socialProvider)}></wui-logo>
|
|
299
|
-
${this.error ? null : this.loaderTemplate()}
|
|
300
|
-
<wui-icon-box color="error" icon="close" size="sm"></wui-icon-box>
|
|
301
|
-
</wui-flex>
|
|
302
|
-
<wui-flex flexDirection="column" alignItems="center" gap="2">
|
|
303
|
-
<wui-text align="center" variant="lg-medium" color="primary"
|
|
304
|
-
>Log in with
|
|
305
|
-
<span class="capitalize">${this.socialProvider ?? "Social"}</span></wui-text
|
|
306
|
-
>
|
|
307
|
-
<wui-text align="center" variant="lg-regular" color=${this.error ? "error" : "secondary"}
|
|
308
|
-
>${this.message}</wui-text
|
|
309
|
-
></wui-flex
|
|
310
|
-
>
|
|
311
|
-
</wui-flex>
|
|
312
|
-
`;
|
|
313
|
-
}
|
|
314
|
-
loaderTemplate() {
|
|
315
|
-
const e = y.state.themeVariables["--w3m-border-radius-master"], o = e ? parseInt(e.replace("px", ""), 10) : 4;
|
|
316
|
-
return c`<wui-loading-thumbnail radius=${o * 9}></wui-loading-thumbnail>`;
|
|
317
|
-
}
|
|
318
|
-
parseURLError(e) {
|
|
319
|
-
try {
|
|
320
|
-
const o = "error=", r = e.indexOf(o);
|
|
321
|
-
return r === -1 ? null : e.substring(r + o.length);
|
|
322
|
-
} catch {
|
|
323
|
-
return null;
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
connectSocial() {
|
|
327
|
-
const e = setInterval(() => {
|
|
328
|
-
var o;
|
|
329
|
-
(o = this.socialWindow) != null && o.closed && (!this.connecting && f.state.view === "ConnectingSocial" && f.goBack(), clearInterval(e));
|
|
330
|
-
}, 1e3);
|
|
331
|
-
window.addEventListener("message", this.handleSocialConnection, !1);
|
|
332
|
-
}
|
|
333
|
-
updateMessage() {
|
|
334
|
-
this.error ? this.message = "Something went wrong" : this.connecting ? this.message = "Retrieving user data" : this.message = "Connect in the provider window";
|
|
335
|
-
}
|
|
336
|
-
handleSocialError(e) {
|
|
337
|
-
this.error = !0, this.updateMessage(), this.socialProvider && u.sendEvent({
|
|
338
|
-
type: "track",
|
|
339
|
-
event: "SOCIAL_LOGIN_ERROR",
|
|
340
|
-
properties: { provider: this.socialProvider, message: e }
|
|
341
|
-
}), this.closeSocialWindow();
|
|
342
|
-
}
|
|
343
|
-
closeSocialWindow() {
|
|
344
|
-
this.socialWindow && (this.socialWindow.close(), d.setAccountProp("socialWindow", void 0, d.state.activeChain));
|
|
345
|
-
}
|
|
346
|
-
};
|
|
347
|
-
m.styles = B;
|
|
348
|
-
b([
|
|
349
|
-
l()
|
|
350
|
-
], m.prototype, "socialProvider", void 0);
|
|
351
|
-
b([
|
|
352
|
-
l()
|
|
353
|
-
], m.prototype, "socialWindow", void 0);
|
|
354
|
-
b([
|
|
355
|
-
l()
|
|
356
|
-
], m.prototype, "error", void 0);
|
|
357
|
-
b([
|
|
358
|
-
l()
|
|
359
|
-
], m.prototype, "connecting", void 0);
|
|
360
|
-
b([
|
|
361
|
-
l()
|
|
362
|
-
], m.prototype, "message", void 0);
|
|
363
|
-
b([
|
|
364
|
-
l()
|
|
365
|
-
], m.prototype, "remoteFeatures", void 0);
|
|
366
|
-
m = b([
|
|
367
|
-
I("w3m-connecting-social-view")
|
|
368
|
-
], m);
|
|
369
|
-
const V = O`
|
|
370
|
-
wui-shimmer {
|
|
371
|
-
width: 100%;
|
|
372
|
-
aspect-ratio: 1 / 1;
|
|
373
|
-
border-radius: ${({ borderRadius: t }) => t[4]};
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
wui-qr-code {
|
|
377
|
-
opacity: 0;
|
|
378
|
-
animation-duration: ${({ durations: t }) => t.xl};
|
|
379
|
-
animation-timing-function: ${({ easings: t }) => t["ease-out-power-2"]};
|
|
380
|
-
animation-name: fade-in;
|
|
381
|
-
animation-fill-mode: forwards;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
wui-logo {
|
|
385
|
-
width: 80px;
|
|
386
|
-
height: 80px;
|
|
387
|
-
border-radius: ${({ borderRadius: t }) => t[8]};
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
wui-flex:first-child:not(:only-child) {
|
|
391
|
-
position: relative;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
wui-loading-thumbnail {
|
|
395
|
-
position: absolute;
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
wui-icon-box {
|
|
399
|
-
position: absolute;
|
|
400
|
-
right: calc(${({ spacing: t }) => t[1]} * -1);
|
|
401
|
-
bottom: calc(${({ spacing: t }) => t[1]} * -1);
|
|
402
|
-
opacity: 0;
|
|
403
|
-
transform: scale(0.5);
|
|
404
|
-
transition:
|
|
405
|
-
opacity ${({ durations: t }) => t.lg} ${({ easings: t }) => t["ease-out-power-2"]},
|
|
406
|
-
transform ${({ durations: t }) => t.lg}
|
|
407
|
-
${({ easings: t }) => t["ease-out-power-2"]};
|
|
408
|
-
will-change: opacity, transform;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
@keyframes fade-in {
|
|
412
|
-
from {
|
|
413
|
-
opacity: 0;
|
|
414
|
-
}
|
|
415
|
-
to {
|
|
416
|
-
opacity: 1;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
`;
|
|
420
|
-
var x = function(t, e, o, r) {
|
|
421
|
-
var n = arguments.length, i = n < 3 ? e : r === null ? r = Object.getOwnPropertyDescriptor(e, o) : r, s;
|
|
422
|
-
if (typeof Reflect == "object" && typeof Reflect.decorate == "function") i = Reflect.decorate(t, e, o, r);
|
|
423
|
-
else for (var a = t.length - 1; a >= 0; a--) (s = t[a]) && (i = (n < 3 ? s(i) : n > 3 ? s(e, o, i) : s(e, o)) || i);
|
|
424
|
-
return n > 3 && i && Object.defineProperty(e, o, i), i;
|
|
425
|
-
};
|
|
426
|
-
let w = class extends _ {
|
|
427
|
-
constructor() {
|
|
428
|
-
var e, o;
|
|
429
|
-
super(), this.unsubscribe = [], this.timeout = void 0, this.socialProvider = (e = d.getAccountData()) == null ? void 0 : e.socialProvider, this.uri = (o = d.getAccountData()) == null ? void 0 : o.farcasterUrl, this.ready = !1, this.loading = !1, this.remoteFeatures = h.state.remoteFeatures, this.authConnector = S.getAuthConnector(), this.forceUpdate = () => {
|
|
430
|
-
this.requestUpdate();
|
|
431
|
-
}, this.unsubscribe.push(d.subscribeChainProp("accountState", (r) => {
|
|
432
|
-
this.socialProvider = r == null ? void 0 : r.socialProvider, this.uri = r == null ? void 0 : r.farcasterUrl, this.connectFarcaster();
|
|
433
|
-
}), h.subscribeKey("remoteFeatures", (r) => {
|
|
434
|
-
this.remoteFeatures = r;
|
|
435
|
-
})), window.addEventListener("resize", this.forceUpdate);
|
|
436
|
-
}
|
|
437
|
-
disconnectedCallback() {
|
|
438
|
-
super.disconnectedCallback(), clearTimeout(this.timeout), window.removeEventListener("resize", this.forceUpdate), !d.state.activeCaipAddress && this.socialProvider && (this.uri || this.loading) && u.sendEvent({
|
|
439
|
-
type: "track",
|
|
440
|
-
event: "SOCIAL_LOGIN_CANCELED",
|
|
441
|
-
properties: { provider: this.socialProvider }
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
render() {
|
|
445
|
-
return this.onRenderProxy(), c`${this.platformTemplate()}`;
|
|
446
|
-
}
|
|
447
|
-
platformTemplate() {
|
|
448
|
-
return C.isMobile() ? c`${this.mobileTemplate()}` : c`${this.desktopTemplate()}`;
|
|
449
|
-
}
|
|
450
|
-
desktopTemplate() {
|
|
451
|
-
return this.loading ? c`${this.loadingTemplate()}` : c`${this.qrTemplate()}`;
|
|
452
|
-
}
|
|
453
|
-
qrTemplate() {
|
|
454
|
-
return c` <wui-flex
|
|
455
|
-
flexDirection="column"
|
|
456
|
-
alignItems="center"
|
|
457
|
-
.padding=${["0", "5", "5", "5"]}
|
|
458
|
-
gap="5"
|
|
459
|
-
>
|
|
460
|
-
<wui-shimmer width="100%"> ${this.qrCodeTemplate()} </wui-shimmer>
|
|
461
|
-
|
|
462
|
-
<wui-text variant="lg-medium" color="primary"> Scan this QR Code with your phone </wui-text>
|
|
463
|
-
${this.copyTemplate()}
|
|
464
|
-
</wui-flex>`;
|
|
465
|
-
}
|
|
466
|
-
loadingTemplate() {
|
|
467
|
-
return c`
|
|
468
|
-
<wui-flex
|
|
469
|
-
flexDirection="column"
|
|
470
|
-
alignItems="center"
|
|
471
|
-
.padding=${["5", "5", "5", "5"]}
|
|
472
|
-
gap="5"
|
|
473
|
-
>
|
|
474
|
-
<wui-flex justifyContent="center" alignItems="center">
|
|
475
|
-
<wui-logo logo="farcaster"></wui-logo>
|
|
476
|
-
${this.loaderTemplate()}
|
|
477
|
-
<wui-icon-box color="error" icon="close" size="sm"></wui-icon-box>
|
|
478
|
-
</wui-flex>
|
|
479
|
-
<wui-flex flexDirection="column" alignItems="center" gap="2">
|
|
480
|
-
<wui-text align="center" variant="md-medium" color="primary">
|
|
481
|
-
Loading user data
|
|
482
|
-
</wui-text>
|
|
483
|
-
<wui-text align="center" variant="sm-regular" color="secondary">
|
|
484
|
-
Please wait a moment while we load your data.
|
|
485
|
-
</wui-text>
|
|
486
|
-
</wui-flex>
|
|
487
|
-
</wui-flex>
|
|
488
|
-
`;
|
|
489
|
-
}
|
|
490
|
-
mobileTemplate() {
|
|
491
|
-
return c` <wui-flex
|
|
492
|
-
flexDirection="column"
|
|
493
|
-
alignItems="center"
|
|
494
|
-
.padding=${["10", "5", "5", "5"]}
|
|
495
|
-
gap="5"
|
|
496
|
-
>
|
|
497
|
-
<wui-flex justifyContent="center" alignItems="center">
|
|
498
|
-
<wui-logo logo="farcaster"></wui-logo>
|
|
499
|
-
${this.loaderTemplate()}
|
|
500
|
-
<wui-icon-box
|
|
501
|
-
color="error"
|
|
502
|
-
icon="close"
|
|
503
|
-
size="sm"
|
|
504
|
-
></wui-icon-box>
|
|
505
|
-
</wui-flex>
|
|
506
|
-
<wui-flex flexDirection="column" alignItems="center" gap="2">
|
|
507
|
-
<wui-text align="center" variant="md-medium" color="primary"
|
|
508
|
-
>Continue in Farcaster</span></wui-text
|
|
509
|
-
>
|
|
510
|
-
<wui-text align="center" variant="sm-regular" color="secondary"
|
|
511
|
-
>Accept connection request in the app</wui-text
|
|
512
|
-
></wui-flex
|
|
513
|
-
>
|
|
514
|
-
${this.mobileLinkTemplate()}
|
|
515
|
-
</wui-flex>`;
|
|
516
|
-
}
|
|
517
|
-
loaderTemplate() {
|
|
518
|
-
const e = y.state.themeVariables["--w3m-border-radius-master"], o = e ? parseInt(e.replace("px", ""), 10) : 4;
|
|
519
|
-
return c`<wui-loading-thumbnail radius=${o * 9}></wui-loading-thumbnail>`;
|
|
520
|
-
}
|
|
521
|
-
async connectFarcaster() {
|
|
522
|
-
var e, o;
|
|
523
|
-
if (this.authConnector)
|
|
524
|
-
try {
|
|
525
|
-
await ((e = this.authConnector) == null ? void 0 : e.provider.connectFarcaster()), this.socialProvider && (A.setConnectedSocialProvider(this.socialProvider), u.sendEvent({
|
|
526
|
-
type: "track",
|
|
527
|
-
event: "SOCIAL_LOGIN_REQUEST_USER_DATA",
|
|
528
|
-
properties: { provider: this.socialProvider }
|
|
529
|
-
})), this.loading = !0;
|
|
530
|
-
const n = P.getConnections(this.authConnector.chain).length > 0;
|
|
531
|
-
await P.connectExternal(this.authConnector, this.authConnector.chain);
|
|
532
|
-
const i = (o = this.remoteFeatures) == null ? void 0 : o.multiWallet;
|
|
533
|
-
this.socialProvider && u.sendEvent({
|
|
534
|
-
type: "track",
|
|
535
|
-
event: "SOCIAL_LOGIN_SUCCESS",
|
|
536
|
-
properties: { provider: this.socialProvider }
|
|
537
|
-
}), this.loading = !1, n && i ? (f.replace("ProfileWallets"), v.showSuccess("New Wallet Added")) : R.close();
|
|
538
|
-
} catch (r) {
|
|
539
|
-
this.socialProvider && u.sendEvent({
|
|
540
|
-
type: "track",
|
|
541
|
-
event: "SOCIAL_LOGIN_ERROR",
|
|
542
|
-
properties: { provider: this.socialProvider, message: C.parseError(r) }
|
|
543
|
-
}), f.goBack(), v.showError(r);
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
mobileLinkTemplate() {
|
|
547
|
-
return c`<wui-button
|
|
548
|
-
size="md"
|
|
549
|
-
?loading=${this.loading}
|
|
550
|
-
?disabled=${!this.uri || this.loading}
|
|
551
|
-
@click=${() => {
|
|
552
|
-
this.uri && C.openHref(this.uri, "_blank");
|
|
553
|
-
}}
|
|
554
|
-
>
|
|
555
|
-
Open farcaster</wui-button
|
|
556
|
-
>`;
|
|
557
|
-
}
|
|
558
|
-
onRenderProxy() {
|
|
559
|
-
!this.ready && this.uri && (this.timeout = setTimeout(() => {
|
|
560
|
-
this.ready = !0;
|
|
561
|
-
}, 200));
|
|
562
|
-
}
|
|
563
|
-
qrCodeTemplate() {
|
|
564
|
-
if (!this.uri || !this.ready)
|
|
565
|
-
return null;
|
|
566
|
-
const e = this.getBoundingClientRect().width - 40, o = y.state.themeVariables["--apkt-qr-color"] ?? y.state.themeVariables["--w3m-qr-color"];
|
|
567
|
-
return c` <wui-qr-code
|
|
568
|
-
size=${e}
|
|
569
|
-
theme=${y.state.themeMode}
|
|
570
|
-
uri=${this.uri}
|
|
571
|
-
?farcaster=${!0}
|
|
572
|
-
data-testid="wui-qr-code"
|
|
573
|
-
color=${$(o)}
|
|
574
|
-
></wui-qr-code>`;
|
|
575
|
-
}
|
|
576
|
-
copyTemplate() {
|
|
577
|
-
const e = !this.uri || !this.ready;
|
|
578
|
-
return c`<wui-button
|
|
579
|
-
.disabled=${e}
|
|
580
|
-
@click=${this.onCopyUri}
|
|
581
|
-
variant="neutral-secondary"
|
|
582
|
-
size="sm"
|
|
583
|
-
data-testid="copy-wc2-uri"
|
|
584
|
-
>
|
|
585
|
-
<wui-icon size="sm" color="default" slot="iconRight" name="copy"></wui-icon>
|
|
586
|
-
Copy link
|
|
587
|
-
</wui-button>`;
|
|
588
|
-
}
|
|
589
|
-
onCopyUri() {
|
|
590
|
-
try {
|
|
591
|
-
this.uri && (C.copyToClopboard(this.uri), v.showSuccess("Link copied"));
|
|
592
|
-
} catch {
|
|
593
|
-
v.showError("Failed to copy");
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
};
|
|
597
|
-
w.styles = V;
|
|
598
|
-
x([
|
|
599
|
-
l()
|
|
600
|
-
], w.prototype, "socialProvider", void 0);
|
|
601
|
-
x([
|
|
602
|
-
l()
|
|
603
|
-
], w.prototype, "uri", void 0);
|
|
604
|
-
x([
|
|
605
|
-
l()
|
|
606
|
-
], w.prototype, "ready", void 0);
|
|
607
|
-
x([
|
|
608
|
-
l()
|
|
609
|
-
], w.prototype, "loading", void 0);
|
|
610
|
-
x([
|
|
611
|
-
l()
|
|
612
|
-
], w.prototype, "remoteFeatures", void 0);
|
|
613
|
-
w = x([
|
|
614
|
-
I("w3m-connecting-farcaster-view")
|
|
615
|
-
], w);
|
|
616
|
-
export {
|
|
617
|
-
L as W3mConnectSocialsView,
|
|
618
|
-
w as W3mConnectingFarcasterView,
|
|
619
|
-
m as W3mConnectingSocialView
|
|
620
|
-
};
|