@keyringnetwork/keyring-connect-sdk 3.2.0 → 4.1.0-alpha.2

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 (68) hide show
  1. package/dist/core/VerificationSession.d.ts +62 -0
  2. package/dist/core/VerificationSession.js +404 -0
  3. package/dist/core/errors.d.ts +49 -0
  4. package/dist/core/errors.js +81 -0
  5. package/dist/core/htppClient.d.ts +17 -0
  6. package/dist/core/htppClient.js +160 -0
  7. package/dist/{main.d.ts → core/keyringConnectExtension.d.ts} +6 -4
  8. package/dist/{main.js → core/keyringConnectExtension.js} +33 -16
  9. package/dist/core/websocketClient.d.ts +23 -0
  10. package/dist/core/websocketClient.js +220 -0
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.js +3 -3
  13. package/dist/types/api.d.ts +24 -0
  14. package/dist/types/api.js +2 -0
  15. package/dist/types/core.d.ts +78 -0
  16. package/dist/types/core.js +2 -0
  17. package/dist/{types.d.ts → types/extension.d.ts} +2 -49
  18. package/dist/types/index.d.ts +4 -0
  19. package/dist/types/index.js +20 -0
  20. package/dist/types/websocket.d.ts +68 -0
  21. package/dist/types/websocket.js +3 -0
  22. package/dist/ui/UIManager.d.ts +52 -0
  23. package/dist/ui/UIManager.js +257 -0
  24. package/dist/ui/components/keyring-button.d.ts +12 -0
  25. package/dist/ui/components/keyring-button.js +140 -0
  26. package/dist/ui/components/keyring-text.d.ts +12 -0
  27. package/dist/ui/components/keyring-text.js +169 -0
  28. package/dist/ui/composites/keyring-complete-modal.d.ts +19 -0
  29. package/dist/ui/composites/keyring-complete-modal.js +200 -0
  30. package/dist/ui/composites/keyring-mobile-modal.d.ts +25 -0
  31. package/dist/ui/composites/keyring-mobile-modal.js +308 -0
  32. package/dist/ui/composites/keyring-qr-modal.d.ts +32 -0
  33. package/dist/ui/composites/keyring-qr-modal.js +464 -0
  34. package/dist/ui/composites/keyring-selection-modal.d.ts +25 -0
  35. package/dist/ui/composites/keyring-selection-modal.js +342 -0
  36. package/dist/ui/composites/keyring-terminated-modal.d.ts +14 -0
  37. package/dist/ui/composites/keyring-terminated-modal.js +121 -0
  38. package/dist/ui/icons/apple-icon.d.ts +4 -0
  39. package/dist/ui/icons/apple-icon.js +47 -0
  40. package/dist/ui/icons/check-circle.d.ts +4 -0
  41. package/dist/ui/icons/check-circle.js +35 -0
  42. package/dist/ui/icons/checkmark.d.ts +4 -0
  43. package/dist/ui/icons/checkmark.js +37 -0
  44. package/dist/ui/icons/close-circle.d.ts +4 -0
  45. package/dist/ui/icons/close-circle.js +35 -0
  46. package/dist/ui/icons/error-circle.d.ts +4 -0
  47. package/dist/ui/icons/error-circle.js +48 -0
  48. package/dist/ui/icons/extension-grid.d.ts +4 -0
  49. package/dist/ui/icons/extension-grid.js +79 -0
  50. package/dist/ui/icons/google-icon.d.ts +4 -0
  51. package/dist/ui/icons/google-icon.js +55 -0
  52. package/dist/ui/icons/gradient-donut.d.ts +8 -0
  53. package/dist/ui/icons/gradient-donut.js +85 -0
  54. package/dist/ui/icons/keyring.d.ts +4 -0
  55. package/dist/ui/icons/keyring.js +71 -0
  56. package/dist/ui/icons/mobile-grid.d.ts +4 -0
  57. package/dist/ui/icons/mobile-grid.js +68 -0
  58. package/dist/ui/icons/success.d.ts +4 -0
  59. package/dist/ui/icons/success.js +54 -0
  60. package/dist/utils/environment.d.ts +34 -0
  61. package/dist/utils/environment.js +67 -0
  62. package/dist/utils/logger.d.ts +7 -0
  63. package/dist/utils/logger.js +40 -0
  64. package/dist/utils/platformUtils.d.ts +24 -0
  65. package/dist/utils/platformUtils.js +64 -0
  66. package/package.json +29 -14
  67. package/readme.md +57 -105
  68. /package/dist/{types.js → types/extension.js} +0 -0
@@ -0,0 +1,169 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.KeyringText = void 0;
10
+ const lit_1 = require("lit");
11
+ const decorators_js_1 = require("lit/decorators.js");
12
+ let KeyringText = class KeyringText extends lit_1.LitElement {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.variant = "text-base";
16
+ this.color = "primary";
17
+ this.align = "left";
18
+ this.weight = "normal";
19
+ }
20
+ render() {
21
+ return (0, lit_1.html) `
22
+ <p class="text ${this.variant} ${this.weight} ${this.color} ${this.align}">
23
+ <slot></slot>
24
+ </p>
25
+ `;
26
+ }
27
+ };
28
+ exports.KeyringText = KeyringText;
29
+ KeyringText.styles = (0, lit_1.css) `
30
+ :host {
31
+ display: block;
32
+ /* CSS Variables */
33
+ --text-xs: 0.75rem; /* 12px */
34
+ --text-xs--line-height: 1.333; /* calc(1 / 0.75) */
35
+
36
+ --text-sm: 0.875rem; /* 14px */
37
+ --text-sm--line-height: 1.429; /* calc(1.25 / 0.875) */
38
+
39
+ --text-base: 1rem; /* 16px */
40
+ --text-base--line-height: 1.5; /* calc(1.5 / 1) */
41
+
42
+ --text-lg: 1.125rem; /* 18px */
43
+ --text-lg--line-height: 1.556; /* calc(1.75 / 1.125) */
44
+
45
+ --text-xl: 1.25rem; /* 20px */
46
+ --text-xl--line-height: 1.4; /* calc(1.75 / 1.25) */
47
+
48
+ --text-2xl: 1.5rem; /* 24px */
49
+ --text-2xl--line-height: 1.333; /* calc(2 / 1.5) */
50
+
51
+ --text-3xl: 1.875rem; /* 30px */
52
+ --text-3xl--line-height: 1.2; /* calc(2.25 / 1.875) */
53
+ }
54
+
55
+ .text {
56
+ margin: 0;
57
+ font-family: Inter, "Segoe UI", Roboto, sans-serif;
58
+ }
59
+
60
+ /* Size Variants */
61
+ .text-xs {
62
+ font-size: var(--text-xs);
63
+ line-height: var(--text-xs--line-height);
64
+ }
65
+
66
+ .text-sm {
67
+ font-size: var(--text-sm);
68
+ line-height: var(--text-sm--line-height);
69
+ }
70
+
71
+ .text-base {
72
+ font-size: var(--text-base);
73
+ line-height: var(--text-base--line-height);
74
+ }
75
+
76
+ .text-lg {
77
+ font-size: var(--text-lg);
78
+ line-height: var(--text-lg--line-height);
79
+ }
80
+
81
+ .text-xl {
82
+ font-size: var(--text-xl);
83
+ line-height: var(--text-xl--line-height);
84
+ }
85
+
86
+ .text-2xl {
87
+ font-size: var(--text-2xl);
88
+ line-height: var(--text-2xl--line-height);
89
+ }
90
+
91
+ .text-3xl {
92
+ font-size: var(--text-3xl);
93
+ line-height: var(--text-3xl--line-height);
94
+ }
95
+
96
+ /* Font Weight Variants */
97
+ .light {
98
+ font-weight: 300;
99
+ }
100
+
101
+ .normal {
102
+ font-weight: 400;
103
+ }
104
+
105
+ .medium {
106
+ font-weight: 500;
107
+ }
108
+
109
+ .semibold {
110
+ font-weight: 600;
111
+ }
112
+
113
+ .bold {
114
+ font-weight: 700;
115
+ }
116
+
117
+ /* Colors */
118
+ .primary {
119
+ color: #0f2830;
120
+ }
121
+
122
+ .secondary {
123
+ color: #75849a;
124
+ }
125
+
126
+ .success {
127
+ color: #24af75;
128
+ }
129
+
130
+ .warning {
131
+ color: #f59e0b;
132
+ }
133
+
134
+ .error {
135
+ color: #eb4577;
136
+ }
137
+
138
+ .white {
139
+ color: #ffffff;
140
+ }
141
+
142
+ /* Alignment */
143
+ .left {
144
+ text-align: left;
145
+ }
146
+
147
+ .center {
148
+ text-align: center;
149
+ }
150
+
151
+ .right {
152
+ text-align: right;
153
+ }
154
+ `;
155
+ __decorate([
156
+ (0, decorators_js_1.property)()
157
+ ], KeyringText.prototype, "variant", void 0);
158
+ __decorate([
159
+ (0, decorators_js_1.property)()
160
+ ], KeyringText.prototype, "color", void 0);
161
+ __decorate([
162
+ (0, decorators_js_1.property)()
163
+ ], KeyringText.prototype, "align", void 0);
164
+ __decorate([
165
+ (0, decorators_js_1.property)()
166
+ ], KeyringText.prototype, "weight", void 0);
167
+ exports.KeyringText = KeyringText = __decorate([
168
+ (0, decorators_js_1.customElement)("keyring-text")
169
+ ], KeyringText);
@@ -0,0 +1,19 @@
1
+ import { LitElement } from "lit";
2
+ import "../components/keyring-button";
3
+ import "../components/keyring-text";
4
+ import "../icons/check-circle";
5
+ import "../icons/keyring";
6
+ import "../icons/success";
7
+ export declare class KeyringCompleteModal extends LitElement {
8
+ title: string;
9
+ subtitle: string;
10
+ entityType: string;
11
+ dataSource: string;
12
+ dataSourceIcon: string;
13
+ static styles: import("lit").CSSResult;
14
+ connectedCallback(): void;
15
+ render(): import("lit").TemplateResult<1>;
16
+ private handleDone;
17
+ private stopPropagation;
18
+ private trapFocus;
19
+ }
@@ -0,0 +1,200 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.KeyringCompleteModal = void 0;
10
+ const lit_1 = require("lit");
11
+ const decorators_js_1 = require("lit/decorators.js");
12
+ require("../components/keyring-button");
13
+ require("../components/keyring-text");
14
+ require("../icons/check-circle");
15
+ require("../icons/keyring");
16
+ require("../icons/success");
17
+ let KeyringCompleteModal = class KeyringCompleteModal extends lit_1.LitElement {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.title = "Verification Completed";
21
+ this.subtitle = "Your verification has been completed successfully.";
22
+ this.entityType = "Individual";
23
+ this.dataSource = "Binance";
24
+ this.dataSourceIcon = "";
25
+ }
26
+ connectedCallback() {
27
+ super.connectedCallback();
28
+ this.trapFocus();
29
+ }
30
+ render() {
31
+ return (0, lit_1.html) `
32
+ <div class="modal" @click=${this.stopPropagation}>
33
+ <div class="content">
34
+ <success-icon></success-icon>
35
+
36
+ <div class="text-wrapper">
37
+ <keyring-text variant="text-3xl" weight="medium">${this.title}</keyring-text>
38
+ <keyring-text variant="text-sm">${this.subtitle}</keyring-text>
39
+ </div>
40
+
41
+ <div class="info-box">
42
+ <div class="info-row">
43
+ <keyring-text>Entity Type</keyring-text>
44
+ <keyring-text weight="semibold">${this.entityType}</keyring-text>
45
+ </div>
46
+
47
+ <div class="divider"></div>
48
+
49
+ <div class="info-row">
50
+ <keyring-text>Data Source</keyring-text>
51
+ <div class="data-source-value">
52
+ ${this.dataSourceIcon
53
+ ? (0, lit_1.html) `<div class="data-source-icon">
54
+ <img src="${this.dataSourceIcon}" alt="${this.dataSource} icon" />
55
+ </div>`
56
+ : ""}
57
+ <keyring-text weight="semibold">${this.dataSource}</keyring-text>
58
+ </div>
59
+ </div>
60
+ </div>
61
+
62
+ <keyring-button class="done-button" @click=${this.handleDone}>Done</keyring-button>
63
+ </div>
64
+ </div>
65
+ `;
66
+ }
67
+ // Event handlers
68
+ handleDone() {
69
+ this.dispatchEvent(new CustomEvent("close", { bubbles: true, composed: true }));
70
+ }
71
+ stopPropagation(e) {
72
+ e.stopPropagation();
73
+ }
74
+ trapFocus() {
75
+ var _a;
76
+ // Simple focus trap implementation
77
+ const focusableElements = (_a = this.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');
78
+ if (focusableElements && focusableElements.length > 0) {
79
+ focusableElements[0].focus();
80
+ }
81
+ }
82
+ };
83
+ exports.KeyringCompleteModal = KeyringCompleteModal;
84
+ KeyringCompleteModal.styles = (0, lit_1.css) `
85
+ :host {
86
+ position: fixed;
87
+ top: 0;
88
+ left: 0;
89
+ right: 0;
90
+ bottom: 0;
91
+ background-color: rgba(15, 40, 48, 0.45);
92
+ display: flex;
93
+ align-items: center;
94
+ justify-content: center;
95
+ z-index: 10000;
96
+ font-family: Inter, "Segoe UI", Roboto, sans-serif;
97
+ }
98
+
99
+ .modal {
100
+ background: white;
101
+ border-radius: 20px;
102
+ display: flex;
103
+ gap: 24px;
104
+ padding: 40px 24px 40px 24px;
105
+ flex-direction: column;
106
+ align-items: center;
107
+ max-width: 524px;
108
+ width: 100%;
109
+ max-height: 90vh;
110
+ overflow-y: auto;
111
+ box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
112
+ }
113
+
114
+ .content {
115
+ width: 100%;
116
+ display: flex;
117
+ flex-direction: column;
118
+ align-items: center;
119
+ justify-content: center;
120
+ gap: 24px;
121
+ }
122
+
123
+ .text-wrapper {
124
+ display: flex;
125
+ flex-direction: column;
126
+ align-items: center;
127
+ justify-content: center;
128
+ gap: 12px;
129
+ width: 100%;
130
+ }
131
+
132
+ .info-box {
133
+ width: 100%;
134
+ border: 1px solid #e3e7ee;
135
+ border-radius: 16px;
136
+ background: linear-gradient(0deg, #f3f5fa 0%, #f3f5fa 100%);
137
+ padding: 12px 16px;
138
+ display: flex;
139
+ flex-direction: column;
140
+ gap: 16px;
141
+ box-sizing: border-box;
142
+ }
143
+
144
+ .info-row {
145
+ display: flex;
146
+ align-items: center;
147
+ justify-content: space-between;
148
+ width: 100%;
149
+ }
150
+
151
+ .data-source-value {
152
+ display: flex;
153
+ align-items: center;
154
+ gap: 4px;
155
+ }
156
+
157
+ .divider {
158
+ width: 100%;
159
+ height: 1px;
160
+ background-color: rgba(15, 40, 48, 0.12);
161
+ }
162
+
163
+ .data-source-icon {
164
+ width: 18px;
165
+ height: 18px;
166
+ display: flex;
167
+ align-items: center;
168
+ justify-content: center;
169
+ }
170
+
171
+ .data-source-icon img {
172
+ width: 100%;
173
+ height: 100%;
174
+ object-fit: contain;
175
+ }
176
+
177
+ .done-button {
178
+ width: 100%;
179
+ max-width: 200px;
180
+ margin: 0 auto;
181
+ }
182
+ `;
183
+ __decorate([
184
+ (0, decorators_js_1.property)()
185
+ ], KeyringCompleteModal.prototype, "title", void 0);
186
+ __decorate([
187
+ (0, decorators_js_1.property)()
188
+ ], KeyringCompleteModal.prototype, "subtitle", void 0);
189
+ __decorate([
190
+ (0, decorators_js_1.property)({ attribute: "entity-type" })
191
+ ], KeyringCompleteModal.prototype, "entityType", void 0);
192
+ __decorate([
193
+ (0, decorators_js_1.property)({ attribute: "data-source" })
194
+ ], KeyringCompleteModal.prototype, "dataSource", void 0);
195
+ __decorate([
196
+ (0, decorators_js_1.property)({ attribute: "data-source-icon" })
197
+ ], KeyringCompleteModal.prototype, "dataSourceIcon", void 0);
198
+ exports.KeyringCompleteModal = KeyringCompleteModal = __decorate([
199
+ (0, decorators_js_1.customElement)("keyring-complete-modal")
200
+ ], KeyringCompleteModal);
@@ -0,0 +1,25 @@
1
+ import { LitElement } from "lit";
2
+ import "../components/keyring-button";
3
+ import "../components/keyring-text";
4
+ import "../icons/checkmark";
5
+ import "../icons/gradient-donut";
6
+ import "../icons/keyring";
7
+ import { ModalStatus } from "./keyring-qr-modal";
8
+ export declare class KeyringMobileModal extends LitElement {
9
+ qrData: string;
10
+ expiresAt: number;
11
+ private status;
12
+ private statusMessage;
13
+ private timeLeft;
14
+ private countdownInterval?;
15
+ static styles: import("lit").CSSResult;
16
+ connectedCallback(): void;
17
+ disconnectedCallback(): void;
18
+ render(): import("lit").TemplateResult<1>;
19
+ updateStatus(message: string, status: ModalStatus): void;
20
+ private handleCancel;
21
+ private stopPropagation;
22
+ private trapFocus;
23
+ private startCountdown;
24
+ private getStatusIcon;
25
+ }