@cartridge/controller 0.5.5 → 0.5.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.
- package/.turbo/turbo-build$colon$deps.log +20 -20
- package/.turbo/turbo-build.log +21 -21
- package/dist/account.d.ts +1 -1
- package/dist/controller.d.ts +2 -2
- package/dist/controller.js +36 -11
- package/dist/controller.js.map +1 -1
- package/dist/iframe/base.d.ts +1 -1
- package/dist/iframe/base.js +8 -0
- package/dist/iframe/base.js.map +1 -1
- package/dist/iframe/index.d.ts +1 -1
- package/dist/iframe/index.js +15 -3
- package/dist/iframe/index.js.map +1 -1
- package/dist/iframe/keychain.d.ts +1 -1
- package/dist/iframe/keychain.js +8 -0
- package/dist/iframe/keychain.js.map +1 -1
- package/dist/iframe/profile.d.ts +1 -1
- package/dist/iframe/profile.js +15 -3
- package/dist/iframe/profile.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +269 -186
- package/dist/index.js.map +1 -1
- package/dist/provider.d.ts +1 -1
- package/dist/session/account.d.ts +1 -1
- package/dist/session/account.js.map +1 -1
- package/dist/session/index.d.ts +1 -1
- package/dist/session/index.js.map +1 -1
- package/dist/session/provider.d.ts +1 -1
- package/dist/telegram/provider.d.ts +1 -1
- package/dist/{types-CCH1I4-O.d.ts → types-BReKRAuh.d.ts} +6 -2
- package/dist/types.d.ts +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +3 -3
- package/src/controller.ts +20 -7
- package/src/iframe/base.ts +10 -0
- package/src/iframe/profile.ts +9 -3
- package/src/types.ts +2 -1
package/dist/iframe/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/iframe/base.ts"],"sourcesContent":["import { AsyncMethodReturns, connectToChild } from \"@cartridge/penpal\";\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 preset,\n theme,\n colorMode,\n onClose,\n onConnect,\n methods = {},\n }: Pick<ControllerOptions, \"theme\" | \"preset\" | \"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 if (theme) {\n url.searchParams.set(\"theme\", theme);\n }\n\n if (preset) {\n url.searchParams.set(\"preset\", preset);\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"],"mappings":";AAAA,SAA6B,sBAAsB;AAW5C,IAAM,SAAN,MAAqD;AAAA,EAM1D,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,CAAC;AAAA,EACb,GAMG;AACD,QAAI,OAAO,aAAa,aAAa;AACnC;AAAA,IACF;AAEA,QAAI,OAAO;AACT,UAAI,aAAa,IAAI,SAAS,KAAK;AAAA,IACrC;AAEA,QAAI,QAAQ;AACV,UAAI,aAAa,IAAI,UAAU,MAAM;AAAA,IACvC;AAEA,QAAI,WAAW;AACb,UAAI,aAAa,IAAI,aAAa,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BAAS,WAAW;AAAA,QACtB;AAAA,MACF;AAAA,IACF,CAAC;AAED,aAAS,QAAQ,SAAS,iBAAiB;AAAA,MACzC,WAAW;AAAA,MACX,SAAS;AAAA,IACX,CAAC;AAED,UAAM,qBAAqB,SAAS,eAAe,YAAY;AAC/D,QAAI,SAAS,MAAM;AACjB,UACG,OAAO,yBAAyB,CAAC,sBAClC,OAAO,sBACP;AACA,iBAAS,KAAK,YAAY,SAAS;AAAA,MACrC;AAAA,IACF;AAEA,SAAK,UAAU;AAAA,EACjB;AAAA,EAEA,OAAO;AACL,QAAI,CAAC,KAAK,UAAW;AACrB,aAAS,KAAK,MAAM,WAAW;AAE/B,SAAK,UAAU,MAAM,aAAa;AAClC,SAAK,UAAU,MAAM,UAAU;AAAA,EACjC;AAAA,EAEA,QAAQ;AACN,QAAI,CAAC,KAAK,UAAW;AACrB,SAAK,UAAU;AAEf,aAAS,KAAK,MAAM,WAAW;AAE/B,SAAK,UAAU,MAAM,aAAa;AAClC,SAAK,UAAU,MAAM,UAAU;AAAA,EACjC;AAAA,EAEQ,SAAS;AACf,QAAI,CAAC,KAAK,OAAQ;AAElB,SAAK,OAAO,MAAM,aAAa;AAE/B,QAAI,OAAO,aAAa,KAAK;AAC3B,WAAK,OAAO,MAAM,SAAS;AAC3B,WAAK,OAAO,MAAM,QAAQ;AAC1B,WAAK,OAAO,MAAM,eAAe;AACjC;AAAA,IACF;AAEA,SAAK,OAAO,MAAM,SAAS;AAC3B,SAAK,OAAO,MAAM,QAAQ;AAC1B,SAAK,OAAO,MAAM,eAAe;AAAA,EACnC;AACF;","names":["existingController"]}
|
|
1
|
+
{"version":3,"sources":["../../src/iframe/base.ts"],"sourcesContent":["import { AsyncMethodReturns, connectToChild } from \"@cartridge/penpal\";\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 preset,\n theme,\n colorMode,\n onClose,\n onConnect,\n methods = {},\n }: Pick<ControllerOptions, \"theme\" | \"preset\" | \"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 if (theme) {\n url.searchParams.set(\"theme\", theme);\n }\n\n if (preset) {\n url.searchParams.set(\"preset\", preset);\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 sendBackward() {\n if (!this.container) return;\n this.container.style.zIndex = \"9999\";\n }\n\n sendForward() {\n if (!this.container) return;\n this.container.style.zIndex = \"10000\";\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"],"mappings":";AAAA,SAA6B,sBAAsB;AAW5C,IAAM,SAAN,MAAqD;AAAA,EAM1D,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,CAAC;AAAA,EACb,GAMG;AACD,QAAI,OAAO,aAAa,aAAa;AACnC;AAAA,IACF;AAEA,QAAI,OAAO;AACT,UAAI,aAAa,IAAI,SAAS,KAAK;AAAA,IACrC;AAEA,QAAI,QAAQ;AACV,UAAI,aAAa,IAAI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AACF;","names":["existingController"]}
|
package/dist/iframe/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { o as IFrame, n as IFrameOptions, p as KeychainIFrame, r as ProfileIFrame, q as ProfileIFrameOptions } from '../types-
|
|
1
|
+
export { o as IFrame, n as IFrameOptions, p as KeychainIFrame, r as ProfileIFrame, q as ProfileIFrameOptions } from '../types-BReKRAuh.js';
|
|
2
2
|
import 'starknet';
|
|
3
3
|
import '@starknet-io/types-js';
|
|
4
4
|
import '@cartridge/penpal';
|
package/dist/iframe/index.js
CHANGED
|
@@ -94,6 +94,14 @@ var IFrame = class {
|
|
|
94
94
|
this.container.style.visibility = "hidden";
|
|
95
95
|
this.container.style.opacity = "0";
|
|
96
96
|
}
|
|
97
|
+
sendBackward() {
|
|
98
|
+
if (!this.container) return;
|
|
99
|
+
this.container.style.zIndex = "9999";
|
|
100
|
+
}
|
|
101
|
+
sendForward() {
|
|
102
|
+
if (!this.container) return;
|
|
103
|
+
this.container.style.zIndex = "10000";
|
|
104
|
+
}
|
|
97
105
|
resize() {
|
|
98
106
|
if (!this.iframe) return;
|
|
99
107
|
this.iframe.style.userSelect = "none";
|
|
@@ -136,20 +144,24 @@ var ProfileIFrame = class extends IFrame {
|
|
|
136
144
|
constructor({
|
|
137
145
|
profileUrl,
|
|
138
146
|
rpcUrl,
|
|
139
|
-
|
|
140
|
-
slot,
|
|
147
|
+
version,
|
|
141
148
|
username,
|
|
149
|
+
slot,
|
|
150
|
+
namespace,
|
|
142
151
|
tokens,
|
|
143
152
|
...iframeOptions
|
|
144
153
|
}) {
|
|
145
154
|
const _profileUrl = (profileUrl || PROFILE_URL).replace(/\/$/, "");
|
|
146
|
-
|
|
155
|
+
let _url = new URL(
|
|
147
156
|
slot ? namespace ? `${_profileUrl}/account/${username}/slot/${slot}?ps=${encodeURIComponent(
|
|
148
157
|
slot
|
|
149
158
|
)}&ns=${encodeURIComponent(namespace)}` : `${_profileUrl}/account/${username}/slot/${slot}?ps=${encodeURIComponent(
|
|
150
159
|
slot
|
|
151
160
|
)}` : `${_profileUrl}/account/${username}`
|
|
152
161
|
);
|
|
162
|
+
if (version) {
|
|
163
|
+
_url.searchParams.set("v", encodeURIComponent(version));
|
|
164
|
+
}
|
|
153
165
|
_url.searchParams.set("rpcUrl", encodeURIComponent(rpcUrl));
|
|
154
166
|
if (tokens?.erc20) {
|
|
155
167
|
_url.searchParams.set(
|
package/dist/iframe/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/iframe/base.ts","../../src/constants.ts","../../src/iframe/keychain.ts","../../src/iframe/profile.ts"],"sourcesContent":["import { AsyncMethodReturns, connectToChild } from \"@cartridge/penpal\";\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 preset,\n theme,\n colorMode,\n onClose,\n onConnect,\n methods = {},\n }: Pick<ControllerOptions, \"theme\" | \"preset\" | \"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 if (theme) {\n url.searchParams.set(\"theme\", theme);\n }\n\n if (preset) {\n url.searchParams.set(\"preset\", preset);\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","export const KEYCHAIN_URL = \"https://x.cartridge.gg\";\nexport const PROFILE_URL = \"https://profile.cartridge.gg\";\nexport const API_URL = \"https://api.cartridge.gg\";\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","import { PROFILE_URL } from \"../constants\";\nimport { Profile, ProfileOptions } from \"../types\";\nimport { IFrame, IFrameOptions } from \"./base\";\n\nexport type ProfileIFrameOptions = IFrameOptions<Profile> &\n ProfileOptions & {\n rpcUrl: string;\n username: string;\n slot?: string;\n namespace?: string;\n };\n\nexport class ProfileIFrame extends IFrame<Profile> {\n constructor({\n profileUrl,\n rpcUrl,\n namespace,\n slot,\n username,\n tokens,\n ...iframeOptions\n }: ProfileIFrameOptions) {\n const _profileUrl = (profileUrl || PROFILE_URL).replace(/\\/$/, \"\");\n const _url = new URL(\n slot\n ? namespace\n ? `${_profileUrl}/account/${username}/slot/${slot}?ps=${encodeURIComponent(\n slot,\n )}&ns=${encodeURIComponent(namespace)}`\n : `${_profileUrl}/account/${username}/slot/${slot}?ps=${encodeURIComponent(\n slot,\n )}`\n : `${_profileUrl}/account/${username}`,\n );\n\n _url.searchParams.set(\"rpcUrl\", encodeURIComponent(rpcUrl));\n\n if (tokens?.erc20) {\n _url.searchParams.set(\n \"erc20\",\n encodeURIComponent(tokens.erc20.toString()),\n );\n }\n\n super({\n ...iframeOptions,\n id: \"controller-profile\",\n url: _url,\n });\n }\n}\n"],"mappings":";AAAA,SAA6B,sBAAsB;AAW5C,IAAM,SAAN,MAAqD;AAAA,EAM1D,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,CAAC;AAAA,EACb,GAMG;AACD,QAAI,OAAO,aAAa,aAAa;AACnC;AAAA,IACF;AAEA,QAAI,OAAO;AACT,UAAI,aAAa,IAAI,SAAS,KAAK;AAAA,IACrC;AAEA,QAAI,QAAQ;AACV,UAAI,aAAa,IAAI,UAAU,MAAM;AAAA,IACvC;AAEA,QAAI,WAAW;AACb,UAAI,aAAa,IAAI,aAAa,SAAS;AAAA,IAC7C;AAEA,SAAK,MAAM;AAEX,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,MAAM,IAAI,SAAS;AAC1B,WAAO,KAAK;AACZ,WAAO,MAAM,SAAS;AACtB,WAAO,QAAQ,IAAI,aAAa;AAChC,WAAO,QAAQ,IAAI,cAAc;AACjC,WAAO,QAAQ,IAAI,eAAe;AAClC,WAAO,QAAQ,IAAI,mBAAmB;AACtC,WAAO,QACL;AACF,QAAI,CAAC,CAAC,SAAS,kBAAkB;AAC/B,aAAO,QAAQ,IAAI,yCAAyC;AAAA,IAC9D;AAEA,UAAM,YAAY,SAAS,cAAc,KAAK;AAC9C,cAAU,KAAK;AACf,cAAU,MAAM,WAAW;AAC3B,cAAU,MAAM,SAAS;AACzB,cAAU,MAAM,QAAQ;AACxB,cAAU,MAAM,MAAM;AACtB,cAAU,MAAM,OAAO;AACvB,cAAU,MAAM,SAAS;AACzB,cAAU,MAAM,kBAAkB;AAClC,cAAU,MAAM,UAAU;AAC1B,cAAU,MAAM,aAAa;AAC7B,cAAU,MAAM,iBAAiB;AACjC,cAAU,MAAM,aA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AAAA,QAChB;AAAA,QACA,mBAAmB,OAAO,MAAM,SAAS,CAAC;AAAA,MAC5C;AAAA,IACF;AAEA,UAAM;AAAA,MACJ,GAAG;AAAA,MACH,IAAI;AAAA,MACJ,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACF;","names":["existingController"]}
|
|
1
|
+
{"version":3,"sources":["../../src/iframe/base.ts","../../src/constants.ts","../../src/iframe/keychain.ts","../../src/iframe/profile.ts"],"sourcesContent":["import { AsyncMethodReturns, connectToChild } from \"@cartridge/penpal\";\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 preset,\n theme,\n colorMode,\n onClose,\n onConnect,\n methods = {},\n }: Pick<ControllerOptions, \"theme\" | \"preset\" | \"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 if (theme) {\n url.searchParams.set(\"theme\", theme);\n }\n\n if (preset) {\n url.searchParams.set(\"preset\", preset);\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 sendBackward() {\n if (!this.container) return;\n this.container.style.zIndex = \"9999\";\n }\n\n sendForward() {\n if (!this.container) return;\n this.container.style.zIndex = \"10000\";\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","export const KEYCHAIN_URL = \"https://x.cartridge.gg\";\nexport const PROFILE_URL = \"https://profile.cartridge.gg\";\nexport const API_URL = \"https://api.cartridge.gg\";\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","import { PROFILE_URL } from \"../constants\";\nimport { Profile, ProfileOptions } from \"../types\";\nimport { IFrame, IFrameOptions } from \"./base\";\n\nexport type ProfileIFrameOptions = IFrameOptions<Profile> &\n ProfileOptions & {\n rpcUrl: string;\n version?: string;\n username: string;\n slot?: string;\n namespace?: string;\n };\n\nexport class ProfileIFrame extends IFrame<Profile> {\n constructor({\n profileUrl,\n rpcUrl,\n version,\n username,\n slot,\n namespace,\n tokens,\n ...iframeOptions\n }: ProfileIFrameOptions) {\n const _profileUrl = (profileUrl || PROFILE_URL).replace(/\\/$/, \"\");\n let _url = new URL(\n slot\n ? namespace\n ? `${_profileUrl}/account/${username}/slot/${slot}?ps=${encodeURIComponent(\n slot,\n )}&ns=${encodeURIComponent(namespace)}`\n : `${_profileUrl}/account/${username}/slot/${slot}?ps=${encodeURIComponent(\n slot,\n )}`\n : `${_profileUrl}/account/${username}`,\n );\n\n if (version) {\n _url.searchParams.set(\"v\", encodeURIComponent(version));\n }\n\n _url.searchParams.set(\"rpcUrl\", encodeURIComponent(rpcUrl));\n\n if (tokens?.erc20) {\n _url.searchParams.set(\n \"erc20\",\n encodeURIComponent(tokens.erc20.toString()),\n );\n }\n\n super({\n ...iframeOptions,\n id: \"controller-profile\",\n url: _url,\n });\n }\n}\n"],"mappings":";AAAA,SAA6B,sBAAsB;AAW5C,IAAM,SAAN,MAAqD;AAAA,EAM1D,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,CAAC;AAAA,EACb,GAMG;AACD,QAAI,OAAO,aAAa,aAAa;AACnC;AAAA,IACF;AAEA,QAAI,OAAO;AACT,UAAI,aAAa,IAAI,SAAS,KAAK;AAAA,IACrC;AAEA,QAAI,QAAQ;AACV,UAAI,aAAa,IAAI,UAAU,MAAM;AAAA,IACvC;AAEA,QAAI,WAAW;AACb,UAAI,aAAa,IAAI,aAAa,SAAS;AAAA,IAC7C;AAEA,SAAK,MAAM;AAEX,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,MAAM,IAAI,SAAS;AAC1B,WAAO,KAAK;AACZ,WAAO,MAAM,SAAS;AACtB,WAAO,QAAQ,IAAI,aAAa;AAChC,WAAO,QAAQ,IAAI,cAAc;AACjC,WAAO,QAAQ,IAAI,eAAe;AAClC,WAAO,QAAQ,IAAI,mBAAmB;AACtC,WAAO,QACL;AACF,QAAI,CAAC,CAAC,SAAS,kBAAkB;AAC/B,aAAO,QAAQ,IAAI,yCAAyC;AAAA,IAC9D;AAEA,UAAM,YAAY,SAAS,cAAc,KAAK;AAC9C,cAAU,KAAK;AACf,cAAU,MAAM,WAAW;AAC3B,cAAU,MAAM,SAAS;AACzB,cAAU,MAAM,QAAQ;AACxB,cAAU,MAAM,MAAM;AACtB,cAAU,MAAM,OAAO;AACvB,cAAU,MAAM,SAAS;AACzB,cAAU,MAAM,kBAAkB;AAClC,cAAU,MAAM,UAAU;AAC1B,cAAU,MAAM,aAAa;A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,mBAAmB,SAAS,CAAC,KACrC,GAAG,WAAW,YAAY,QAAQ,SAAS,IAAI,OAAO;AAAA,QACpD;AAAA,MACF,CAAC,KACH,GAAG,WAAW,YAAY,QAAQ;AAAA,IACxC;AAEA,QAAI,SAAS;AACX,WAAK,aAAa,IAAI,KAAK,mBAAmB,OAAO,CAAC;AAAA,IACxD;AAEA,SAAK,aAAa,IAAI,UAAU,mBAAmB,MAAM,CAAC;AAE1D,QAAI,QAAQ,OAAO;AACjB,WAAK,aAAa;AAAA,QAChB;AAAA,QACA,mBAAmB,OAAO,MAAM,SAAS,CAAC;AAAA,MAC5C;AAAA,IACF;AAEA,UAAM;AAAA,MACJ,GAAG;AAAA,MACH,IAAI;AAAA,MACJ,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACF;","names":["existingController"]}
|
package/dist/iframe/keychain.js
CHANGED
|
@@ -97,6 +97,14 @@ var IFrame = class {
|
|
|
97
97
|
this.container.style.visibility = "hidden";
|
|
98
98
|
this.container.style.opacity = "0";
|
|
99
99
|
}
|
|
100
|
+
sendBackward() {
|
|
101
|
+
if (!this.container) return;
|
|
102
|
+
this.container.style.zIndex = "9999";
|
|
103
|
+
}
|
|
104
|
+
sendForward() {
|
|
105
|
+
if (!this.container) return;
|
|
106
|
+
this.container.style.zIndex = "10000";
|
|
107
|
+
}
|
|
100
108
|
resize() {
|
|
101
109
|
if (!this.iframe) return;
|
|
102
110
|
this.iframe.style.userSelect = "none";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/constants.ts","../../src/iframe/base.ts","../../src/iframe/keychain.ts"],"sourcesContent":["export const KEYCHAIN_URL = \"https://x.cartridge.gg\";\nexport const PROFILE_URL = \"https://profile.cartridge.gg\";\nexport const API_URL = \"https://api.cartridge.gg\";\n","import { AsyncMethodReturns, connectToChild } from \"@cartridge/penpal\";\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 preset,\n theme,\n colorMode,\n onClose,\n onConnect,\n methods = {},\n }: Pick<ControllerOptions, \"theme\" | \"preset\" | \"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 if (theme) {\n url.searchParams.set(\"theme\", theme);\n }\n\n if (preset) {\n url.searchParams.set(\"preset\", preset);\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 { 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,IA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,MAAM,QAAQ;AAC1B,WAAK,OAAO,MAAM,eAAe;AACjC;AAAA,IACF;AAEA,SAAK,OAAO,MAAM,SAAS;AAC3B,SAAK,OAAO,MAAM,QAAQ;AAC1B,SAAK,OAAO,MAAM,eAAe;AAAA,EACnC;AACF;;;
|
|
1
|
+
{"version":3,"sources":["../../src/constants.ts","../../src/iframe/base.ts","../../src/iframe/keychain.ts"],"sourcesContent":["export const KEYCHAIN_URL = \"https://x.cartridge.gg\";\nexport const PROFILE_URL = \"https://profile.cartridge.gg\";\nexport const API_URL = \"https://api.cartridge.gg\";\n","import { AsyncMethodReturns, connectToChild } from \"@cartridge/penpal\";\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 preset,\n theme,\n colorMode,\n onClose,\n onConnect,\n methods = {},\n }: Pick<ControllerOptions, \"theme\" | \"preset\" | \"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 if (theme) {\n url.searchParams.set(\"theme\", theme);\n }\n\n if (preset) {\n url.searchParams.set(\"preset\", preset);\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 sendBackward() {\n if (!this.container) return;\n this.container.style.zIndex = \"9999\";\n }\n\n sendForward() {\n if (!this.container) return;\n this.container.style.zIndex = \"10000\";\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 { 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;AAW5C,IAAM,SAAN,MAAqD;AAAA,EAM1D,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,CAAC;AAAA,EACb,GAMG;AACD,QAAI,OAAO,aAAa,aAAa;AACnC;AAAA,IACF;AAEA,QAAI,OAAO;AACT,UAAI,aAAa,IAAI,SAAS,KAAK;AAAA,IACrC;AAEA,QAAI,QAAQ;AACV,UAAI,aAAa,IAAI,UAAU,MAAM;AAAA,IACvC;AAEA,QAAI,WAAW;AACb,UAAI,aAAa,IAAI,aAAa,SAAS;AAAA,IAC7C;AAEA,SAAK,MAAM;AAEX,UAAM,SAAS,SAAS,cAAc,QAAQ;AAC9C,WAAO,MAAM,IAAI,SAAS;AAC1B,WAAO,KAAK;AACZ,WAAO,MAAM,SAAS;AACtB,WAAO,QAAQ,IAAI,aAAa;AAChC,WAAO,QAAQ,IAAI,cAAc;AACjC,WAAO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,IAAI;AAAA,MACJ,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACF;","names":["existingController"]}
|
package/dist/iframe/profile.d.ts
CHANGED
package/dist/iframe/profile.js
CHANGED
|
@@ -97,6 +97,14 @@ var IFrame = class {
|
|
|
97
97
|
this.container.style.visibility = "hidden";
|
|
98
98
|
this.container.style.opacity = "0";
|
|
99
99
|
}
|
|
100
|
+
sendBackward() {
|
|
101
|
+
if (!this.container) return;
|
|
102
|
+
this.container.style.zIndex = "9999";
|
|
103
|
+
}
|
|
104
|
+
sendForward() {
|
|
105
|
+
if (!this.container) return;
|
|
106
|
+
this.container.style.zIndex = "10000";
|
|
107
|
+
}
|
|
100
108
|
resize() {
|
|
101
109
|
if (!this.iframe) return;
|
|
102
110
|
this.iframe.style.userSelect = "none";
|
|
@@ -117,20 +125,24 @@ var ProfileIFrame = class extends IFrame {
|
|
|
117
125
|
constructor({
|
|
118
126
|
profileUrl,
|
|
119
127
|
rpcUrl,
|
|
120
|
-
|
|
121
|
-
slot,
|
|
128
|
+
version,
|
|
122
129
|
username,
|
|
130
|
+
slot,
|
|
131
|
+
namespace,
|
|
123
132
|
tokens,
|
|
124
133
|
...iframeOptions
|
|
125
134
|
}) {
|
|
126
135
|
const _profileUrl = (profileUrl || PROFILE_URL).replace(/\/$/, "");
|
|
127
|
-
|
|
136
|
+
let _url = new URL(
|
|
128
137
|
slot ? namespace ? `${_profileUrl}/account/${username}/slot/${slot}?ps=${encodeURIComponent(
|
|
129
138
|
slot
|
|
130
139
|
)}&ns=${encodeURIComponent(namespace)}` : `${_profileUrl}/account/${username}/slot/${slot}?ps=${encodeURIComponent(
|
|
131
140
|
slot
|
|
132
141
|
)}` : `${_profileUrl}/account/${username}`
|
|
133
142
|
);
|
|
143
|
+
if (version) {
|
|
144
|
+
_url.searchParams.set("v", encodeURIComponent(version));
|
|
145
|
+
}
|
|
134
146
|
_url.searchParams.set("rpcUrl", encodeURIComponent(rpcUrl));
|
|
135
147
|
if (tokens?.erc20) {
|
|
136
148
|
_url.searchParams.set(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/constants.ts","../../src/iframe/base.ts","../../src/iframe/profile.ts"],"sourcesContent":["export const KEYCHAIN_URL = \"https://x.cartridge.gg\";\nexport const PROFILE_URL = \"https://profile.cartridge.gg\";\nexport const API_URL = \"https://api.cartridge.gg\";\n","import { AsyncMethodReturns, connectToChild } from \"@cartridge/penpal\";\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 preset,\n theme,\n colorMode,\n onClose,\n onConnect,\n methods = {},\n }: Pick<ControllerOptions, \"theme\" | \"preset\" | \"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 if (theme) {\n url.searchParams.set(\"theme\", theme);\n }\n\n if (preset) {\n url.searchParams.set(\"preset\", preset);\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 { PROFILE_URL } from \"../constants\";\nimport { Profile, ProfileOptions } from \"../types\";\nimport { IFrame, IFrameOptions } from \"./base\";\n\nexport type ProfileIFrameOptions = IFrameOptions<Profile> &\n ProfileOptions & {\n rpcUrl: string;\n username: string;\n slot?: string;\n namespace?: string;\n };\n\nexport class ProfileIFrame extends IFrame<Profile> {\n constructor({\n profileUrl,\n rpcUrl,\n
|
|
1
|
+
{"version":3,"sources":["../../src/constants.ts","../../src/iframe/base.ts","../../src/iframe/profile.ts"],"sourcesContent":["export const KEYCHAIN_URL = \"https://x.cartridge.gg\";\nexport const PROFILE_URL = \"https://profile.cartridge.gg\";\nexport const API_URL = \"https://api.cartridge.gg\";\n","import { AsyncMethodReturns, connectToChild } from \"@cartridge/penpal\";\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 preset,\n theme,\n colorMode,\n onClose,\n onConnect,\n methods = {},\n }: Pick<ControllerOptions, \"theme\" | \"preset\" | \"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 if (theme) {\n url.searchParams.set(\"theme\", theme);\n }\n\n if (preset) {\n url.searchParams.set(\"preset\", preset);\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 sendBackward() {\n if (!this.container) return;\n this.container.style.zIndex = \"9999\";\n }\n\n sendForward() {\n if (!this.container) return;\n this.container.style.zIndex = \"10000\";\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 { PROFILE_URL } from \"../constants\";\nimport { Profile, ProfileOptions } from \"../types\";\nimport { IFrame, IFrameOptions } from \"./base\";\n\nexport type ProfileIFrameOptions = IFrameOptions<Profile> &\n ProfileOptions & {\n rpcUrl: string;\n version?: string;\n username: string;\n slot?: string;\n namespace?: string;\n };\n\nexport class ProfileIFrame extends IFrame<Profile> {\n constructor({\n profileUrl,\n rpcUrl,\n version,\n username,\n slot,\n namespace,\n tokens,\n ...iframeOptions\n }: ProfileIFrameOptions) {\n const _profileUrl = (profileUrl || PROFILE_URL).replace(/\\/$/, \"\");\n let _url = new URL(\n slot\n ? namespace\n ? `${_profileUrl}/account/${username}/slot/${slot}?ps=${encodeURIComponent(\n slot,\n )}&ns=${encodeURIComponent(namespace)}`\n : `${_profileUrl}/account/${username}/slot/${slot}?ps=${encodeURIComponent(\n slot,\n )}`\n : `${_profileUrl}/account/${username}`,\n );\n\n if (version) {\n _url.searchParams.set(\"v\", encodeURIComponent(version));\n }\n\n _url.searchParams.set(\"rpcUrl\", encodeURIComponent(rpcUrl));\n\n if (tokens?.erc20) {\n _url.searchParams.set(\n \"erc20\",\n encodeURIComponent(tokens.erc20.toString()),\n );\n }\n\n super({\n ...iframeOptions,\n id: \"controller-profile\",\n url: _url,\n });\n }\n}\n"],"mappings":";AACO,IAAM,cAAc;;;ACD3B,SAA6B,sBAAsB;AAW5C,IAAM,SAAN,MAAqD;AAAA,EAM1D,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,CAAC;AAAA,EACb,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Q;AAC1B,WAAK,OAAO,MAAM,eAAe;AACjC;AAAA,IACF;AAEA,SAAK,OAAO,MAAM,SAAS;AAC3B,SAAK,OAAO,MAAM,QAAQ;AAC1B,SAAK,OAAO,MAAM,eAAe;AAAA,EACnC;AACF;;;AC3JO,IAAM,gBAAN,cAA4B,OAAgB;AAAA,EACjD,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GAAyB;AACvB,UAAM,eAAe,cAAc,aAAa,QAAQ,OAAO,EAAE;AACjE,QAAI,OAAO,IAAI;AAAA,MACb,OACI,YACE,GAAG,WAAW,YAAY,QAAQ,SAAS,IAAI,OAAO;AAAA,QACpD;AAAA,MACF,CAAC,OAAO,mBAAmB,SAAS,CAAC,KACrC,GAAG,WAAW,YAAY,QAAQ,SAAS,IAAI,OAAO;AAAA,QACpD;AAAA,MACF,CAAC,KACH,GAAG,WAAW,YAAY,QAAQ;AAAA,IACxC;AAEA,QAAI,SAAS;AACX,WAAK,aAAa,IAAI,KAAK,mBAAmB,OAAO,CAAC;AAAA,IACxD;AAEA,SAAK,aAAa,IAAI,UAAU,mBAAmB,MAAM,CAAC;AAE1D,QAAI,QAAQ,OAAO;AACjB,WAAK,aAAa;AAAA,QAChB;AAAA,QACA,mBAAmB,OAAO,MAAM,SAAS,CAAC;AAAA,MAC5C;AAAA,IACF;AAEA,UAAM;AAAA,MACJ,GAAG;AAAA,MACH,IAAI;AAAA,MACJ,KAAK;AAAA,IACP,CAAC;AAAA,EACH;AACF;","names":["existingController"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { default } from './controller.js';
|
|
2
2
|
export { NotReadyToConnect } from './errors.js';
|
|
3
|
-
export { C as ConnectError, b as ConnectReply, e as ControllerAccounts, a as ControllerError, g as ControllerOptions, D as DeployReply, E as ExecuteReply, h as IFrameOptions, I as IFrames, K as Keychain, j as KeychainOptions, L as LookupRequest, d as LookupResponse, c as LookupResult, M as Modal, m as Prefund, P as ProbeReply, f as Profile, l as ProfileContextTypeVariant, k as ProfileOptions, i as ProviderOptions, R as ResponseCodes, S as Session, T as Tokens } from './types-
|
|
3
|
+
export { C as ConnectError, b as ConnectReply, e as ControllerAccounts, a as ControllerError, g as ControllerOptions, D as DeployReply, E as ExecuteReply, h as IFrameOptions, I as IFrames, K as Keychain, j as KeychainOptions, L as LookupRequest, d as LookupResponse, c as LookupResult, M as Modal, m as Prefund, P as ProbeReply, f as Profile, l as ProfileContextTypeVariant, k as ProfileOptions, i as ProviderOptions, R as ResponseCodes, S as Session, T as Tokens } from './types-BReKRAuh.js';
|
|
4
4
|
export { lookupAddresses, lookupUsernames } from './lookup.js';
|
|
5
5
|
export { toArray, toSessionPolicies, toWasmPolicies } from './utils.js';
|
|
6
6
|
export { C as CallPolicy, a as ColorMode, b as ContractPolicies, c as ContractPolicy, d as ControllerColor, e as ControllerColors, f as ControllerConfig, g as ControllerConfigs, h as ControllerTheme, E as EkuboERC20Metadata, M as Method, P as Policies, i as Policy, S as SessionPolicies, j as SignMessagePolicy, T as ThemeValue, k as TypedDataPolicy, l as controllerConfigs, m as defaultTheme, n as erc20Metadata } from './index.d-BbTUPBeO.js';
|