@cartridge/controller 0.5.0-alpha.4 → 0.5.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/.turbo/turbo-build$colon$deps.log +116 -4
  2. package/dist/account.d.ts +9 -6
  3. package/dist/account.js +84 -74
  4. package/dist/account.js.map +1 -1
  5. package/dist/constants.d.ts +4 -2
  6. package/dist/constants.js +7 -2
  7. package/dist/constants.js.map +1 -1
  8. package/dist/controller.d.ts +12 -5
  9. package/dist/controller.js +739 -182
  10. package/dist/controller.js.map +1 -1
  11. package/dist/errors.d.ts +3 -1
  12. package/dist/errors.js +10 -6
  13. package/dist/errors.js.map +1 -1
  14. package/dist/icon.d.ts +3 -1
  15. package/dist/icon.js +5 -1
  16. package/dist/icon.js.map +1 -1
  17. package/dist/iframe/base.d.ts +5 -23
  18. package/dist/iframe/base.js +272 -98
  19. package/dist/iframe/base.js.map +1 -1
  20. package/dist/iframe/index.d.ts +5 -3
  21. package/dist/iframe/index.js +331 -3
  22. package/dist/iframe/index.js.map +1 -1
  23. package/dist/iframe/keychain.d.ts +5 -7
  24. package/dist/iframe/keychain.js +294 -13
  25. package/dist/iframe/keychain.js.map +1 -1
  26. package/dist/iframe/profile.d.ts +5 -11
  27. package/dist/iframe/profile.js +308 -16
  28. package/dist/iframe/profile.js.map +1 -1
  29. package/dist/index.d.ts +9 -4
  30. package/dist/index.js +767 -4
  31. package/dist/index.js.map +1 -1
  32. package/dist/presets.d.ts +9 -2
  33. package/dist/presets.js +159 -146
  34. package/dist/presets.js.map +1 -1
  35. package/dist/provider.d.ts +9 -4
  36. package/dist/provider.js +138 -124
  37. package/dist/provider.js.map +1 -1
  38. package/dist/session/account.d.ts +14 -8
  39. package/dist/session/account.js +235 -27
  40. package/dist/session/account.js.map +1 -1
  41. package/dist/session/backend.d.ts +4 -2
  42. package/dist/session/backend.js +38 -37
  43. package/dist/session/backend.js.map +1 -1
  44. package/dist/session/index.d.ts +9 -5
  45. package/dist/session/index.js +467 -5
  46. package/dist/session/index.js.map +1 -1
  47. package/dist/session/provider.d.ts +12 -8
  48. package/dist/session/provider.js +281 -81
  49. package/dist/session/provider.js.map +1 -1
  50. package/dist/telegram/backend.d.ts +5 -2
  51. package/dist/telegram/backend.js +38 -37
  52. package/dist/telegram/backend.js.map +1 -1
  53. package/dist/telegram/provider.d.ts +7 -4
  54. package/dist/telegram/provider.js +283 -70
  55. package/dist/telegram/provider.js.map +1 -1
  56. package/dist/types-DIeWpu0p.d.ts +196 -0
  57. package/dist/types.d.ts +5 -159
  58. package/dist/types.js +12 -8
  59. package/dist/types.js.map +1 -1
  60. package/dist/utils.d.ts +7 -3
  61. package/dist/utils.js +12 -8
  62. package/dist/utils.js.map +1 -1
  63. package/package.json +17 -14
  64. package/src/controller.ts +13 -25
  65. package/src/iframe/base.ts +3 -0
  66. package/src/iframe/profile.ts +17 -9
  67. package/src/presets.ts +10 -1
  68. package/src/session/provider.ts +1 -2
  69. package/src/types.ts +3 -7
  70. package/tsconfig.json +4 -1
  71. package/tsconfig.tsbuildinfo +0 -1
@@ -1,16 +1,297 @@
1
- import { KEYCHAIN_URL } from "../constants";
2
- import { IFrame } from "./base";
3
- export class KeychainIFrame extends IFrame {
4
- constructor({ url, policies, ...iframeOptions }) {
5
- const _url = new URL(url ?? KEYCHAIN_URL);
6
- if (policies) {
7
- _url.searchParams.set("policies", encodeURIComponent(JSON.stringify(policies)));
1
+ // src/constants.ts
2
+ var KEYCHAIN_URL = "https://x.cartridge.gg";
3
+
4
+ // src/iframe/base.ts
5
+ import { connectToChild } from "@cartridge/penpal";
6
+
7
+ // src/presets.ts
8
+ var defaultPresets = {
9
+ cartridge: {
10
+ id: "cartridge",
11
+ name: "Cartridge",
12
+ icon: "/whitelabel/cartridge/icon.svg",
13
+ cover: {
14
+ light: "/whitelabel/cartridge/cover-light.png",
15
+ dark: "/whitelabel/cartridge/cover-dark.png"
16
+ }
17
+ },
18
+ "force-prime": {
19
+ id: "force-prime",
20
+ name: "Force Prime",
21
+ icon: "/whitelabel/force-prime/icon.png",
22
+ cover: "/whitelabel/force-prime/cover.png",
23
+ colors: {
24
+ primary: "#E1CC89"
25
+ }
26
+ },
27
+ paved: {
28
+ id: "paved",
29
+ name: "Paved",
30
+ icon: "/whitelabel/paved/icon.svg",
31
+ cover: "/whitelabel/paved/cover.png",
32
+ colors: {
33
+ primary: "#B0CAF8"
34
+ }
35
+ },
36
+ eternum: {
37
+ id: "eternum",
38
+ name: "Eternum",
39
+ icon: "/whitelabel/eternum/icon.gif",
40
+ cover: "/whitelabel/eternum/cover.png",
41
+ colors: {
42
+ primary: "#CE9822"
43
+ }
44
+ },
45
+ pistols: {
46
+ id: "pistols",
47
+ name: "Pistols at Ten Blocks",
48
+ icon: "/whitelabel/pistols/icon.png",
49
+ cover: "/whitelabel/pistols/cover.png",
50
+ colors: {
51
+ primary: "#EF9758"
52
+ }
53
+ },
54
+ pixelaw: {
55
+ id: "pixelaw",
56
+ name: "Pixelaw",
57
+ icon: "/whitelabel/pixelaw/icon.svg",
58
+ cover: "/whitelabel/pixelaw/cover.png",
59
+ colors: {
60
+ primary: "#7C00B1",
61
+ primaryForeground: "white"
62
+ }
63
+ },
64
+ "dope-wars": {
65
+ id: "dope-wars",
66
+ name: "Dope Wars",
67
+ icon: "/whitelabel/dope-wars/icon.png",
68
+ cover: "/whitelabel/dope-wars/cover.png",
69
+ colors: {
70
+ primary: "#11ED83"
71
+ }
72
+ },
73
+ zkastle: {
74
+ id: "zkastle",
75
+ name: "zKastle",
76
+ icon: "/whitelabel/zkastle/icon.svg",
77
+ cover: "/whitelabel/zkastle/cover.png",
78
+ colors: {
79
+ primary: "#E50D2C"
80
+ }
81
+ },
82
+ "loot-survivor": {
83
+ id: "loot-survivor",
84
+ name: "Loot Survivor",
85
+ icon: "/whitelabel/loot-survivor/icon.png",
86
+ cover: "/whitelabel/loot-survivor/cover.png",
87
+ colors: {
88
+ primary: "#33FF33"
89
+ }
90
+ },
91
+ "tale-weaver": {
92
+ id: "tale-weaver",
93
+ name: "Tale Weaver",
94
+ icon: "/whitelabel/tale-weaver/icon.png",
95
+ cover: "/whitelabel/tale-weaver/cover.png",
96
+ colors: {
97
+ primary: "#fce377"
98
+ }
99
+ },
100
+ "realm-of-ra": {
101
+ id: "realm-of-ra",
102
+ name: "Realm of Ra",
103
+ icon: "/whitelabel/realm-of-ra/icon.png",
104
+ cover: "/whitelabel/realm-of-ra/cover.png",
105
+ colors: {
106
+ primary: "#de9534"
107
+ }
108
+ },
109
+ "jokers-of-neon": {
110
+ id: "jokers-of-neon",
111
+ name: "Jokers of Neon",
112
+ icon: "/whitelabel/jokers-of-neon/icon.png",
113
+ cover: "/whitelabel/jokers-of-neon/cover.png",
114
+ colors: {
115
+ primary: "#A144B2"
116
+ }
117
+ },
118
+ flippyflop: {
119
+ id: "flippyflop",
120
+ name: "FlippyFlop",
121
+ icon: "/whitelabel/flippyflop/icon.png",
122
+ cover: "/whitelabel/flippyflop/cover.png",
123
+ colors: {
124
+ primary: "#F38332"
125
+ }
126
+ },
127
+ "savage-summit": {
128
+ id: "savage-summit",
129
+ name: "Savage Summit",
130
+ icon: "/whitelabel/savage-summit/icon.png",
131
+ cover: "/whitelabel/savage-summit/cover.png",
132
+ colors: {
133
+ primary: "#fbf7da"
134
+ }
135
+ },
136
+ "dark-shuffle": {
137
+ id: "dark-shuffle",
138
+ name: "Dark Shuffle",
139
+ icon: "/whitelabel/dark-shuffle/icon.svg",
140
+ cover: "/whitelabel/dark-shuffle/cover.png",
141
+ colors: {
142
+ primary: "#F59100"
143
+ }
144
+ },
145
+ "blob-arena": {
146
+ id: "blob-arena",
147
+ name: "Blob Arena",
148
+ icon: "/whitelabel/blob-arena/icon.png",
149
+ cover: "/whitelabel/blob-arena/cover.png",
150
+ colors: {
151
+ primary: "#980f06"
152
+ }
153
+ },
154
+ zkube: {
155
+ id: "zkube",
156
+ name: "zKube",
157
+ icon: "/whitelabel/zkube/icon.png",
158
+ cover: "/whitelabel/zkube/cover.png",
159
+ colors: {
160
+ primary: "#5bc3e6"
161
+ }
162
+ }
163
+ };
164
+
165
+ // src/iframe/base.ts
166
+ var IFrame = class {
167
+ constructor({
168
+ id,
169
+ url,
170
+ theme,
171
+ config,
172
+ colorMode,
173
+ onClose,
174
+ onConnect,
175
+ methods = {}
176
+ }) {
177
+ if (typeof document === "undefined") {
178
+ return;
179
+ }
180
+ url.searchParams.set(
181
+ "theme",
182
+ encodeURIComponent(
183
+ JSON.stringify(
184
+ config?.presets?.[theme ?? "cartridge"] ?? defaultPresets.cartridge
185
+ )
186
+ )
187
+ );
188
+ if (colorMode) {
189
+ url.searchParams.set("colorMode", colorMode);
190
+ }
191
+ this.url = url;
192
+ const iframe = document.createElement("iframe");
193
+ iframe.src = url.toString();
194
+ iframe.id = id;
195
+ iframe.style.border = "none";
196
+ iframe.sandbox.add("allow-forms");
197
+ iframe.sandbox.add("allow-popups");
198
+ iframe.sandbox.add("allow-scripts");
199
+ iframe.sandbox.add("allow-same-origin");
200
+ iframe.allow = "publickey-credentials-create *; publickey-credentials-get *; clipboard-write";
201
+ if (!!document.hasStorageAccess) {
202
+ iframe.sandbox.add("allow-storage-access-by-user-activation");
203
+ }
204
+ const container = document.createElement("div");
205
+ container.id = "controller";
206
+ container.style.position = "fixed";
207
+ container.style.height = "100%";
208
+ container.style.width = "100%";
209
+ container.style.top = "0";
210
+ container.style.left = "0";
211
+ container.style.zIndex = "10000";
212
+ container.style.backgroundColor = "rgba(0,0,0,0.6)";
213
+ container.style.display = "flex";
214
+ container.style.alignItems = "center";
215
+ container.style.justifyContent = "center";
216
+ container.style.visibility = "hidden";
217
+ container.style.opacity = "0";
218
+ container.style.transition = "opacity 0.2s ease";
219
+ container.appendChild(iframe);
220
+ this.iframe = iframe;
221
+ this.container = container;
222
+ connectToChild({
223
+ iframe: this.iframe,
224
+ methods: { close: () => this.close(), ...methods }
225
+ }).promise.then(onConnect);
226
+ this.resize();
227
+ window.addEventListener("resize", () => this.resize());
228
+ const observer = new MutationObserver(() => {
229
+ const existingController2 = document.getElementById("controller");
230
+ if (document.body) {
231
+ if (id === "controller-keychain" && !existingController2 || id === "controller-profile") {
232
+ document.body.appendChild(container);
233
+ observer.disconnect();
8
234
  }
9
- super({
10
- ...iframeOptions,
11
- id: "controller-keychain",
12
- url: _url,
13
- });
235
+ }
236
+ });
237
+ observer.observe(document.documentElement, {
238
+ childList: true,
239
+ subtree: true
240
+ });
241
+ const existingController = document.getElementById("controller");
242
+ if (document.body) {
243
+ if (id === "controller-keychain" && !existingController || id === "controller-profile") {
244
+ document.body.appendChild(container);
245
+ }
246
+ }
247
+ this.onClose = onClose;
248
+ }
249
+ open() {
250
+ if (!this.container) return;
251
+ document.body.style.overflow = "hidden";
252
+ this.container.style.visibility = "visible";
253
+ this.container.style.opacity = "1";
254
+ }
255
+ close() {
256
+ if (!this.container) return;
257
+ this.onClose?.();
258
+ document.body.style.overflow = "auto";
259
+ this.container.style.visibility = "hidden";
260
+ this.container.style.opacity = "0";
261
+ }
262
+ resize() {
263
+ if (!this.iframe) return;
264
+ this.iframe.style.userSelect = "none";
265
+ if (window.innerWidth < 768) {
266
+ this.iframe.style.height = "100%";
267
+ this.iframe.style.width = "100%";
268
+ this.iframe.style.borderRadius = "0";
269
+ return;
270
+ }
271
+ this.iframe.style.height = "600px";
272
+ this.iframe.style.width = "432px";
273
+ this.iframe.style.borderRadius = "8px";
274
+ }
275
+ };
276
+
277
+ // src/iframe/keychain.ts
278
+ var KeychainIFrame = class extends IFrame {
279
+ constructor({ url, policies, ...iframeOptions }) {
280
+ const _url = new URL(url ?? KEYCHAIN_URL);
281
+ if (policies) {
282
+ _url.searchParams.set(
283
+ "policies",
284
+ encodeURIComponent(JSON.stringify(policies))
285
+ );
14
286
  }
15
- }
287
+ super({
288
+ ...iframeOptions,
289
+ id: "controller-keychain",
290
+ url: _url
291
+ });
292
+ }
293
+ };
294
+ export {
295
+ KeychainIFrame
296
+ };
16
297
  //# sourceMappingURL=keychain.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"keychain.js","sourceRoot":"","sources":["../../src/iframe/keychain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C,OAAO,EAAE,MAAM,EAAiB,MAAM,QAAQ,CAAC;AAI/C,MAAM,OAAO,cAAe,SAAQ,MAAgB;IAClD,YAAY,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,aAAa,EAAyB;QACpE,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,YAAY,CAAC,CAAC;QAE1C,IAAI,QAAQ,EAAE,CAAC;YACb,IAAI,CAAC,YAAY,CAAC,GAAG,CACnB,UAAU,EACV,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAC7C,CAAC;QACJ,CAAC;QAED,KAAK,CAAC;YACJ,GAAG,aAAa;YAChB,EAAE,EAAE,qBAAqB;YACzB,GAAG,EAAE,IAAI;SACV,CAAC,CAAC;IACL,CAAC;CACF"}
1
+ {"version":3,"sources":["../../src/constants.ts","../../src/iframe/base.ts","../../src/presets.ts","../../src/iframe/keychain.ts"],"sourcesContent":["export const KEYCHAIN_URL = \"https://x.cartridge.gg\";\nexport const PROFILE_URL = \"https://profile.cartridge.gg\";\n","import { AsyncMethodReturns, connectToChild } from \"@cartridge/penpal\";\nimport { defaultPresets } from \"../presets\";\nimport { ControllerOptions, Modal } from \"../types\";\n\nexport type IFrameOptions<CallSender> = Omit<\n ConstructorParameters<typeof IFrame>[0],\n \"id\" | \"url\" | \"onConnect\"\n> & {\n url?: string;\n onConnect: (child: AsyncMethodReturns<CallSender>) => void;\n};\n\nexport class IFrame<CallSender extends {}> implements Modal {\n url?: URL;\n private iframe?: HTMLIFrameElement;\n private container?: HTMLDivElement;\n private onClose?: () => void;\n\n constructor({\n id,\n url,\n theme,\n config,\n colorMode,\n onClose,\n onConnect,\n methods = {},\n }: Pick<ControllerOptions, \"theme\" | \"config\" | \"colorMode\"> & {\n id: string;\n url: URL;\n onClose?: () => void;\n onConnect: (child: AsyncMethodReturns<CallSender>) => void;\n methods?: { [key: string]: (...args: any[]) => void };\n }) {\n if (typeof document === \"undefined\") {\n return;\n }\n\n url.searchParams.set(\n \"theme\",\n encodeURIComponent(\n JSON.stringify(\n config?.presets?.[theme ?? \"cartridge\"] ?? defaultPresets.cartridge,\n ),\n ),\n );\n\n if (colorMode) {\n url.searchParams.set(\"colorMode\", colorMode);\n }\n\n this.url = url;\n\n const iframe = document.createElement(\"iframe\");\n iframe.src = url.toString();\n iframe.id = id;\n iframe.style.border = \"none\";\n iframe.sandbox.add(\"allow-forms\");\n iframe.sandbox.add(\"allow-popups\");\n iframe.sandbox.add(\"allow-scripts\");\n iframe.sandbox.add(\"allow-same-origin\");\n iframe.allow =\n \"publickey-credentials-create *; publickey-credentials-get *; clipboard-write\";\n if (!!document.hasStorageAccess) {\n iframe.sandbox.add(\"allow-storage-access-by-user-activation\");\n }\n\n const container = document.createElement(\"div\");\n container.id = \"controller\";\n container.style.position = \"fixed\";\n container.style.height = \"100%\";\n container.style.width = \"100%\";\n container.style.top = \"0\";\n container.style.left = \"0\";\n container.style.zIndex = \"10000\";\n container.style.backgroundColor = \"rgba(0,0,0,0.6)\";\n container.style.display = \"flex\";\n container.style.alignItems = \"center\";\n container.style.justifyContent = \"center\";\n container.style.visibility = \"hidden\";\n container.style.opacity = \"0\";\n container.style.transition = \"opacity 0.2s ease\";\n container.appendChild(iframe);\n\n this.iframe = iframe;\n this.container = container;\n\n connectToChild<CallSender>({\n iframe: this.iframe,\n methods: { close: () => this.close(), ...methods },\n }).promise.then(onConnect);\n\n this.resize();\n window.addEventListener(\"resize\", () => this.resize());\n\n const observer = new MutationObserver(() => {\n const existingController = document.getElementById(\"controller\");\n if (document.body) {\n if (\n (id === \"controller-keychain\" && !existingController) ||\n id === \"controller-profile\"\n ) {\n document.body.appendChild(container);\n observer.disconnect();\n }\n }\n });\n\n observer.observe(document.documentElement, {\n childList: true,\n subtree: true,\n });\n\n const existingController = document.getElementById(\"controller\");\n if (document.body) {\n if (\n (id === \"controller-keychain\" && !existingController) ||\n id === \"controller-profile\"\n ) {\n document.body.appendChild(container);\n }\n }\n\n this.onClose = onClose;\n }\n\n open() {\n if (!this.container) return;\n document.body.style.overflow = \"hidden\";\n\n this.container.style.visibility = \"visible\";\n this.container.style.opacity = \"1\";\n }\n\n close() {\n if (!this.container) return;\n this.onClose?.();\n\n document.body.style.overflow = \"auto\";\n\n this.container.style.visibility = \"hidden\";\n this.container.style.opacity = \"0\";\n }\n\n private resize() {\n if (!this.iframe) return;\n\n this.iframe.style.userSelect = \"none\";\n\n if (window.innerWidth < 768) {\n this.iframe.style.height = \"100%\";\n this.iframe.style.width = \"100%\";\n this.iframe.style.borderRadius = \"0\";\n return;\n }\n\n this.iframe.style.height = \"600px\";\n this.iframe.style.width = \"432px\";\n this.iframe.style.borderRadius = \"8px\";\n }\n}\n","import { ControllerThemePresets } from \"./types\";\n\nexport const defaultPresets: ControllerThemePresets = {\n cartridge: {\n id: \"cartridge\",\n name: \"Cartridge\",\n icon: \"/whitelabel/cartridge/icon.svg\",\n cover: {\n light: \"/whitelabel/cartridge/cover-light.png\",\n dark: \"/whitelabel/cartridge/cover-dark.png\",\n },\n },\n \"force-prime\": {\n id: \"force-prime\",\n name: \"Force Prime\",\n icon: \"/whitelabel/force-prime/icon.png\",\n cover: \"/whitelabel/force-prime/cover.png\",\n colors: {\n primary: \"#E1CC89\",\n },\n },\n paved: {\n id: \"paved\",\n name: \"Paved\",\n icon: \"/whitelabel/paved/icon.svg\",\n cover: \"/whitelabel/paved/cover.png\",\n colors: {\n primary: \"#B0CAF8\",\n },\n },\n eternum: {\n id: \"eternum\",\n name: \"Eternum\",\n icon: \"/whitelabel/eternum/icon.gif\",\n cover: \"/whitelabel/eternum/cover.png\",\n colors: {\n primary: \"#CE9822\",\n },\n },\n pistols: {\n id: \"pistols\",\n name: \"Pistols at Ten Blocks\",\n icon: \"/whitelabel/pistols/icon.png\",\n cover: \"/whitelabel/pistols/cover.png\",\n colors: {\n primary: \"#EF9758\",\n },\n },\n pixelaw: {\n id: \"pixelaw\",\n name: \"Pixelaw\",\n icon: \"/whitelabel/pixelaw/icon.svg\",\n cover: \"/whitelabel/pixelaw/cover.png\",\n colors: {\n primary: \"#7C00B1\",\n primaryForeground: \"white\",\n },\n },\n \"dope-wars\": {\n id: \"dope-wars\",\n name: \"Dope Wars\",\n icon: \"/whitelabel/dope-wars/icon.png\",\n cover: \"/whitelabel/dope-wars/cover.png\",\n colors: {\n primary: \"#11ED83\",\n },\n },\n zkastle: {\n id: \"zkastle\",\n name: \"zKastle\",\n icon: \"/whitelabel/zkastle/icon.svg\",\n cover: \"/whitelabel/zkastle/cover.png\",\n colors: {\n primary: \"#E50D2C\",\n },\n },\n \"loot-survivor\": {\n id: \"loot-survivor\",\n name: \"Loot Survivor\",\n icon: \"/whitelabel/loot-survivor/icon.png\",\n cover: \"/whitelabel/loot-survivor/cover.png\",\n colors: {\n primary: \"#33FF33\",\n },\n },\n \"tale-weaver\": {\n id: \"tale-weaver\",\n name: \"Tale Weaver\",\n icon: \"/whitelabel/tale-weaver/icon.png\",\n cover: \"/whitelabel/tale-weaver/cover.png\",\n colors: {\n primary: \"#fce377\",\n },\n },\n \"realm-of-ra\": {\n id: \"realm-of-ra\",\n name: \"Realm of Ra\",\n icon: \"/whitelabel/realm-of-ra/icon.png\",\n cover: \"/whitelabel/realm-of-ra/cover.png\",\n colors: {\n primary: \"#de9534\",\n },\n },\n \"jokers-of-neon\": {\n id: \"jokers-of-neon\",\n name: \"Jokers of Neon\",\n icon: \"/whitelabel/jokers-of-neon/icon.png\",\n cover: \"/whitelabel/jokers-of-neon/cover.png\",\n colors: {\n primary: \"#A144B2\",\n },\n },\n flippyflop: {\n id: \"flippyflop\",\n name: \"FlippyFlop\",\n icon: \"/whitelabel/flippyflop/icon.png\",\n cover: \"/whitelabel/flippyflop/cover.png\",\n colors: {\n primary: \"#F38332\",\n },\n },\n \"savage-summit\": {\n id: \"savage-summit\",\n name: \"Savage Summit\",\n icon: \"/whitelabel/savage-summit/icon.png\",\n cover: \"/whitelabel/savage-summit/cover.png\",\n colors: {\n primary: \"#fbf7da\",\n },\n },\n \"dark-shuffle\": {\n id: \"dark-shuffle\",\n name: \"Dark Shuffle\",\n icon: \"/whitelabel/dark-shuffle/icon.svg\",\n cover: \"/whitelabel/dark-shuffle/cover.png\",\n colors: {\n primary: \"#F59100\",\n },\n },\n \"blob-arena\": {\n id: \"blob-arena\",\n name: \"Blob Arena\",\n icon: \"/whitelabel/blob-arena/icon.png\",\n cover: \"/whitelabel/blob-arena/cover.png\",\n colors: {\n primary: \"#980f06\",\n },\n },\n zkube: {\n id: \"zkube\",\n name: \"zKube\",\n icon: \"/whitelabel/zkube/icon.png\",\n cover: \"/whitelabel/zkube/cover.png\",\n colors: {\n primary: \"#5bc3e6\",\n },\n },\n};\n","import { KEYCHAIN_URL } from \"../constants\";\nimport { Keychain, KeychainOptions } from \"../types\";\nimport { IFrame, IFrameOptions } from \"./base\";\n\ntype KeychainIframeOptions = IFrameOptions<Keychain> & KeychainOptions;\n\nexport class KeychainIFrame extends IFrame<Keychain> {\n constructor({ url, policies, ...iframeOptions }: KeychainIframeOptions) {\n const _url = new URL(url ?? KEYCHAIN_URL);\n\n if (policies) {\n _url.searchParams.set(\n \"policies\",\n encodeURIComponent(JSON.stringify(policies)),\n );\n }\n\n super({\n ...iframeOptions,\n id: \"controller-keychain\",\n url: _url,\n });\n }\n}\n"],"mappings":";AAAO,IAAM,eAAe;;;ACA5B,SAA6B,sBAAsB;;;ACE5C,IAAM,iBAAyC;AAAA,EACpD,WAAW;AAAA,IACT,IAAI;AAAA,IACJ,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,MACL,OAAO;AAAA,MACP,MAAM;AAAA,IACR;AAAA,EACF;AAAA,EACA,eAAe;AAAA,I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OAAiB;AAAA,EACnD,YAAY,EAAE,KAAK,UAAU,GAAG,cAAc,GAA0B;AACtE,UAAM,OAAO,IAAI,IAAI,OAAO,YAAY;AAExC,QAAI,UAAU;AACZ,WAAK,aAAa;AAAA,QAChB;AAAA,QACA,mBAAmB,KAAK,UAAU,QAAQ,CAAC;AAAA,MAC7C;AAAA,IACF;AAEA,UAAM;AAAA,MACJ,GAAG;AAAA,MACH,IAAI;AAAA,MACJ,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACF;","names":["existingController"]}
@@ -1,11 +1,5 @@
1
- import { Profile, ProfileOptions } from "../types";
2
- import { IFrame, IFrameOptions } from "./base";
3
- export type ProfileIFrameOptions = IFrameOptions<Profile> & ProfileOptions & {
4
- username: string;
5
- indexerUrl: string;
6
- namespace: string;
7
- rpcUrl: string;
8
- };
9
- export declare class ProfileIFrame extends IFrame<Profile> {
10
- constructor({ profileUrl, username, indexerUrl, namespace, rpcUrl, tokens, ...iframeOptions }: ProfileIFrameOptions);
11
- }
1
+ export { x as ProfileIFrame, w as ProfileIFrameOptions } from '../types-DIeWpu0p.js';
2
+ import 'starknet';
3
+ import '@starknet-io/types-js';
4
+ import '@cartridge/penpal';
5
+ import '@cartridge/account-wasm/controller';
@@ -1,19 +1,311 @@
1
- import { PROFILE_URL } from "../constants";
2
- import { IFrame } from "./base";
3
- export class ProfileIFrame extends IFrame {
4
- constructor({ profileUrl, username, indexerUrl, namespace, rpcUrl, tokens, ...iframeOptions }) {
5
- const _url = new URL(`${profileUrl ?? PROFILE_URL}/account/${username}`);
6
- _url.searchParams.set("indexerUrl", encodeURIComponent(indexerUrl));
7
- _url.searchParams.set("namespace", encodeURIComponent(namespace));
8
- _url.searchParams.set("rpcUrl", encodeURIComponent(rpcUrl));
9
- if (tokens?.erc20) {
10
- _url.searchParams.set("erc20", encodeURIComponent(tokens.erc20.toString()));
1
+ // src/constants.ts
2
+ var PROFILE_URL = "https://profile.cartridge.gg";
3
+
4
+ // src/iframe/base.ts
5
+ import { connectToChild } from "@cartridge/penpal";
6
+
7
+ // src/presets.ts
8
+ var defaultPresets = {
9
+ cartridge: {
10
+ id: "cartridge",
11
+ name: "Cartridge",
12
+ icon: "/whitelabel/cartridge/icon.svg",
13
+ cover: {
14
+ light: "/whitelabel/cartridge/cover-light.png",
15
+ dark: "/whitelabel/cartridge/cover-dark.png"
16
+ }
17
+ },
18
+ "force-prime": {
19
+ id: "force-prime",
20
+ name: "Force Prime",
21
+ icon: "/whitelabel/force-prime/icon.png",
22
+ cover: "/whitelabel/force-prime/cover.png",
23
+ colors: {
24
+ primary: "#E1CC89"
25
+ }
26
+ },
27
+ paved: {
28
+ id: "paved",
29
+ name: "Paved",
30
+ icon: "/whitelabel/paved/icon.svg",
31
+ cover: "/whitelabel/paved/cover.png",
32
+ colors: {
33
+ primary: "#B0CAF8"
34
+ }
35
+ },
36
+ eternum: {
37
+ id: "eternum",
38
+ name: "Eternum",
39
+ icon: "/whitelabel/eternum/icon.gif",
40
+ cover: "/whitelabel/eternum/cover.png",
41
+ colors: {
42
+ primary: "#CE9822"
43
+ }
44
+ },
45
+ pistols: {
46
+ id: "pistols",
47
+ name: "Pistols at Ten Blocks",
48
+ icon: "/whitelabel/pistols/icon.png",
49
+ cover: "/whitelabel/pistols/cover.png",
50
+ colors: {
51
+ primary: "#EF9758"
52
+ }
53
+ },
54
+ pixelaw: {
55
+ id: "pixelaw",
56
+ name: "Pixelaw",
57
+ icon: "/whitelabel/pixelaw/icon.svg",
58
+ cover: "/whitelabel/pixelaw/cover.png",
59
+ colors: {
60
+ primary: "#7C00B1",
61
+ primaryForeground: "white"
62
+ }
63
+ },
64
+ "dope-wars": {
65
+ id: "dope-wars",
66
+ name: "Dope Wars",
67
+ icon: "/whitelabel/dope-wars/icon.png",
68
+ cover: "/whitelabel/dope-wars/cover.png",
69
+ colors: {
70
+ primary: "#11ED83"
71
+ }
72
+ },
73
+ zkastle: {
74
+ id: "zkastle",
75
+ name: "zKastle",
76
+ icon: "/whitelabel/zkastle/icon.svg",
77
+ cover: "/whitelabel/zkastle/cover.png",
78
+ colors: {
79
+ primary: "#E50D2C"
80
+ }
81
+ },
82
+ "loot-survivor": {
83
+ id: "loot-survivor",
84
+ name: "Loot Survivor",
85
+ icon: "/whitelabel/loot-survivor/icon.png",
86
+ cover: "/whitelabel/loot-survivor/cover.png",
87
+ colors: {
88
+ primary: "#33FF33"
89
+ }
90
+ },
91
+ "tale-weaver": {
92
+ id: "tale-weaver",
93
+ name: "Tale Weaver",
94
+ icon: "/whitelabel/tale-weaver/icon.png",
95
+ cover: "/whitelabel/tale-weaver/cover.png",
96
+ colors: {
97
+ primary: "#fce377"
98
+ }
99
+ },
100
+ "realm-of-ra": {
101
+ id: "realm-of-ra",
102
+ name: "Realm of Ra",
103
+ icon: "/whitelabel/realm-of-ra/icon.png",
104
+ cover: "/whitelabel/realm-of-ra/cover.png",
105
+ colors: {
106
+ primary: "#de9534"
107
+ }
108
+ },
109
+ "jokers-of-neon": {
110
+ id: "jokers-of-neon",
111
+ name: "Jokers of Neon",
112
+ icon: "/whitelabel/jokers-of-neon/icon.png",
113
+ cover: "/whitelabel/jokers-of-neon/cover.png",
114
+ colors: {
115
+ primary: "#A144B2"
116
+ }
117
+ },
118
+ flippyflop: {
119
+ id: "flippyflop",
120
+ name: "FlippyFlop",
121
+ icon: "/whitelabel/flippyflop/icon.png",
122
+ cover: "/whitelabel/flippyflop/cover.png",
123
+ colors: {
124
+ primary: "#F38332"
125
+ }
126
+ },
127
+ "savage-summit": {
128
+ id: "savage-summit",
129
+ name: "Savage Summit",
130
+ icon: "/whitelabel/savage-summit/icon.png",
131
+ cover: "/whitelabel/savage-summit/cover.png",
132
+ colors: {
133
+ primary: "#fbf7da"
134
+ }
135
+ },
136
+ "dark-shuffle": {
137
+ id: "dark-shuffle",
138
+ name: "Dark Shuffle",
139
+ icon: "/whitelabel/dark-shuffle/icon.svg",
140
+ cover: "/whitelabel/dark-shuffle/cover.png",
141
+ colors: {
142
+ primary: "#F59100"
143
+ }
144
+ },
145
+ "blob-arena": {
146
+ id: "blob-arena",
147
+ name: "Blob Arena",
148
+ icon: "/whitelabel/blob-arena/icon.png",
149
+ cover: "/whitelabel/blob-arena/cover.png",
150
+ colors: {
151
+ primary: "#980f06"
152
+ }
153
+ },
154
+ zkube: {
155
+ id: "zkube",
156
+ name: "zKube",
157
+ icon: "/whitelabel/zkube/icon.png",
158
+ cover: "/whitelabel/zkube/cover.png",
159
+ colors: {
160
+ primary: "#5bc3e6"
161
+ }
162
+ }
163
+ };
164
+
165
+ // src/iframe/base.ts
166
+ var IFrame = class {
167
+ constructor({
168
+ id,
169
+ url,
170
+ theme,
171
+ config,
172
+ colorMode,
173
+ onClose,
174
+ onConnect,
175
+ methods = {}
176
+ }) {
177
+ if (typeof document === "undefined") {
178
+ return;
179
+ }
180
+ url.searchParams.set(
181
+ "theme",
182
+ encodeURIComponent(
183
+ JSON.stringify(
184
+ config?.presets?.[theme ?? "cartridge"] ?? defaultPresets.cartridge
185
+ )
186
+ )
187
+ );
188
+ if (colorMode) {
189
+ url.searchParams.set("colorMode", colorMode);
190
+ }
191
+ this.url = url;
192
+ const iframe = document.createElement("iframe");
193
+ iframe.src = url.toString();
194
+ iframe.id = id;
195
+ iframe.style.border = "none";
196
+ iframe.sandbox.add("allow-forms");
197
+ iframe.sandbox.add("allow-popups");
198
+ iframe.sandbox.add("allow-scripts");
199
+ iframe.sandbox.add("allow-same-origin");
200
+ iframe.allow = "publickey-credentials-create *; publickey-credentials-get *; clipboard-write";
201
+ if (!!document.hasStorageAccess) {
202
+ iframe.sandbox.add("allow-storage-access-by-user-activation");
203
+ }
204
+ const container = document.createElement("div");
205
+ container.id = "controller";
206
+ container.style.position = "fixed";
207
+ container.style.height = "100%";
208
+ container.style.width = "100%";
209
+ container.style.top = "0";
210
+ container.style.left = "0";
211
+ container.style.zIndex = "10000";
212
+ container.style.backgroundColor = "rgba(0,0,0,0.6)";
213
+ container.style.display = "flex";
214
+ container.style.alignItems = "center";
215
+ container.style.justifyContent = "center";
216
+ container.style.visibility = "hidden";
217
+ container.style.opacity = "0";
218
+ container.style.transition = "opacity 0.2s ease";
219
+ container.appendChild(iframe);
220
+ this.iframe = iframe;
221
+ this.container = container;
222
+ connectToChild({
223
+ iframe: this.iframe,
224
+ methods: { close: () => this.close(), ...methods }
225
+ }).promise.then(onConnect);
226
+ this.resize();
227
+ window.addEventListener("resize", () => this.resize());
228
+ const observer = new MutationObserver(() => {
229
+ const existingController2 = document.getElementById("controller");
230
+ if (document.body) {
231
+ if (id === "controller-keychain" && !existingController2 || id === "controller-profile") {
232
+ document.body.appendChild(container);
233
+ observer.disconnect();
11
234
  }
12
- super({
13
- ...iframeOptions,
14
- id: "controller-profile",
15
- url: _url,
16
- });
235
+ }
236
+ });
237
+ observer.observe(document.documentElement, {
238
+ childList: true,
239
+ subtree: true
240
+ });
241
+ const existingController = document.getElementById("controller");
242
+ if (document.body) {
243
+ if (id === "controller-keychain" && !existingController || id === "controller-profile") {
244
+ document.body.appendChild(container);
245
+ }
246
+ }
247
+ this.onClose = onClose;
248
+ }
249
+ open() {
250
+ if (!this.container) return;
251
+ document.body.style.overflow = "hidden";
252
+ this.container.style.visibility = "visible";
253
+ this.container.style.opacity = "1";
254
+ }
255
+ close() {
256
+ if (!this.container) return;
257
+ this.onClose?.();
258
+ document.body.style.overflow = "auto";
259
+ this.container.style.visibility = "hidden";
260
+ this.container.style.opacity = "0";
261
+ }
262
+ resize() {
263
+ if (!this.iframe) return;
264
+ this.iframe.style.userSelect = "none";
265
+ if (window.innerWidth < 768) {
266
+ this.iframe.style.height = "100%";
267
+ this.iframe.style.width = "100%";
268
+ this.iframe.style.borderRadius = "0";
269
+ return;
270
+ }
271
+ this.iframe.style.height = "600px";
272
+ this.iframe.style.width = "432px";
273
+ this.iframe.style.borderRadius = "8px";
274
+ }
275
+ };
276
+
277
+ // src/iframe/profile.ts
278
+ var ProfileIFrame = class extends IFrame {
279
+ constructor({
280
+ profileUrl,
281
+ rpcUrl,
282
+ namespace,
283
+ slot,
284
+ username,
285
+ tokens,
286
+ ...iframeOptions
287
+ }) {
288
+ const _profileUrl = profileUrl || PROFILE_URL;
289
+ const _url = new URL(
290
+ slot ? namespace ? `${_profileUrl}/account/${username}/slot/${slot}?ns=${encodeURIComponent(
291
+ namespace
292
+ )}` : `${_profileUrl}/account/${username}/slot/${slot}` : `${_profileUrl}/account/${username}`
293
+ );
294
+ _url.searchParams.set("rpcUrl", encodeURIComponent(rpcUrl));
295
+ if (tokens?.erc20) {
296
+ _url.searchParams.set(
297
+ "erc20",
298
+ encodeURIComponent(tokens.erc20.toString())
299
+ );
17
300
  }
18
- }
301
+ super({
302
+ ...iframeOptions,
303
+ id: "controller-profile",
304
+ url: _url
305
+ });
306
+ }
307
+ };
308
+ export {
309
+ ProfileIFrame
310
+ };
19
311
  //# sourceMappingURL=profile.js.map