@glideidentity/web-client-sdk 5.1.3 → 6.0.0-beta.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 (203) hide show
  1. package/README.md +337 -526
  2. package/dist/browser/web-client-sdk.min.js +1 -1
  3. package/dist/cjs/adapters/index.js +15 -0
  4. package/dist/cjs/adapters/react.js +192 -0
  5. package/dist/cjs/adapters/vanilla.js +38 -0
  6. package/dist/cjs/adapters/vue.js +187 -0
  7. package/dist/cjs/browser.js +58 -0
  8. package/dist/cjs/client/http.js +159 -0
  9. package/dist/cjs/client/index.js +19 -0
  10. package/dist/cjs/client/logger.js +135 -0
  11. package/dist/cjs/client/phone-auth-client.js +428 -0
  12. package/dist/cjs/client/strategies/polling.js +177 -0
  13. package/dist/cjs/core/errors.js +204 -0
  14. package/dist/cjs/core/index.js +83 -0
  15. package/dist/cjs/core/type-guards.js +196 -0
  16. package/dist/cjs/core/types.js +25 -0
  17. package/dist/{core/phone-auth/validation-utils.js → cjs/core/validators.js} +70 -23
  18. package/dist/cjs/index.js +81 -0
  19. package/dist/cjs/ui/index.js +11 -0
  20. package/dist/{core/phone-auth → cjs}/ui/mobile-debug-console.js +149 -78
  21. package/dist/cjs/ui/modal.js +1122 -0
  22. package/dist/esm/adapters/index.js +11 -0
  23. package/dist/esm/adapters/react.js +182 -0
  24. package/dist/esm/adapters/vanilla.js +29 -0
  25. package/dist/esm/adapters/vue.js +177 -0
  26. package/dist/esm/browser.js +30 -11
  27. package/dist/esm/client/http.js +156 -0
  28. package/dist/esm/client/index.js +11 -0
  29. package/dist/esm/client/logger.js +131 -0
  30. package/dist/esm/client/phone-auth-client.js +424 -0
  31. package/dist/esm/client/strategies/polling.js +174 -0
  32. package/dist/esm/core/errors.js +193 -0
  33. package/dist/esm/core/index.js +60 -0
  34. package/dist/esm/core/type-guards.js +181 -0
  35. package/dist/esm/core/types.js +22 -1
  36. package/dist/esm/core/{phone-auth/validation-utils.js → validators.js} +66 -21
  37. package/dist/esm/index.js +45 -17
  38. package/dist/esm/ui/index.js +5 -0
  39. package/dist/esm/{core/phone-auth/ui → ui}/mobile-debug-console.js +149 -78
  40. package/dist/esm/ui/modal.js +1117 -0
  41. package/dist/types/adapters/index.d.ts +10 -0
  42. package/dist/types/adapters/index.d.ts.map +1 -0
  43. package/dist/types/adapters/react.d.ts +70 -0
  44. package/dist/types/adapters/react.d.ts.map +1 -0
  45. package/dist/types/adapters/vanilla.d.ts +29 -0
  46. package/dist/types/adapters/vanilla.d.ts.map +1 -0
  47. package/dist/types/adapters/vue.d.ts +71 -0
  48. package/dist/types/adapters/vue.d.ts.map +1 -0
  49. package/dist/types/browser.d.ts +27 -0
  50. package/dist/types/browser.d.ts.map +1 -0
  51. package/dist/types/client/http.d.ts +41 -0
  52. package/dist/types/client/http.d.ts.map +1 -0
  53. package/dist/types/client/index.d.ts +10 -0
  54. package/dist/types/client/index.d.ts.map +1 -0
  55. package/dist/types/client/logger.d.ts +36 -0
  56. package/dist/types/client/logger.d.ts.map +1 -0
  57. package/dist/types/client/phone-auth-client.d.ts +91 -0
  58. package/dist/types/client/phone-auth-client.d.ts.map +1 -0
  59. package/dist/types/client/strategies/polling.d.ts +36 -0
  60. package/dist/types/client/strategies/polling.d.ts.map +1 -0
  61. package/dist/types/core/errors.d.ts +71 -0
  62. package/dist/types/core/errors.d.ts.map +1 -0
  63. package/dist/types/core/index.d.ts +38 -0
  64. package/dist/types/core/index.d.ts.map +1 -0
  65. package/dist/types/core/type-guards.d.ts +118 -0
  66. package/dist/types/core/type-guards.d.ts.map +1 -0
  67. package/dist/types/core/types.d.ts +535 -0
  68. package/dist/types/core/types.d.ts.map +1 -0
  69. package/dist/types/core/validators.d.ts +63 -0
  70. package/dist/types/core/validators.d.ts.map +1 -0
  71. package/dist/types/index.d.ts +40 -0
  72. package/dist/types/index.d.ts.map +1 -0
  73. package/dist/types/ui/index.d.ts +6 -0
  74. package/dist/types/ui/index.d.ts.map +1 -0
  75. package/dist/{esm/core/phone-auth → types}/ui/mobile-debug-console.d.ts +1 -0
  76. package/dist/types/ui/mobile-debug-console.d.ts.map +1 -0
  77. package/dist/types/ui/modal.d.ts +87 -0
  78. package/dist/types/ui/modal.d.ts.map +1 -0
  79. package/package.json +48 -34
  80. package/dist/adapters/angular/client.service.d.ts +0 -7
  81. package/dist/adapters/angular/client.service.js +0 -30
  82. package/dist/adapters/angular/index.d.ts +0 -3
  83. package/dist/adapters/angular/index.js +0 -18
  84. package/dist/adapters/angular/phone-auth.service.d.ts +0 -38
  85. package/dist/adapters/angular/phone-auth.service.js +0 -130
  86. package/dist/adapters/react/index.d.ts +0 -9
  87. package/dist/adapters/react/index.js +0 -28
  88. package/dist/adapters/react/useClient.d.ts +0 -26
  89. package/dist/adapters/react/useClient.js +0 -121
  90. package/dist/adapters/react/usePhoneAuth.d.ts +0 -23
  91. package/dist/adapters/react/usePhoneAuth.js +0 -95
  92. package/dist/adapters/vanilla/client.d.ts +0 -8
  93. package/dist/adapters/vanilla/client.js +0 -33
  94. package/dist/adapters/vanilla/index.d.ts +0 -3
  95. package/dist/adapters/vanilla/index.js +0 -18
  96. package/dist/adapters/vanilla/phone-auth.d.ts +0 -46
  97. package/dist/adapters/vanilla/phone-auth.js +0 -138
  98. package/dist/adapters/vue/index.d.ts +0 -10
  99. package/dist/adapters/vue/index.js +0 -36
  100. package/dist/adapters/vue/useClient.d.ts +0 -115
  101. package/dist/adapters/vue/useClient.js +0 -131
  102. package/dist/adapters/vue/usePhoneAuth.d.ts +0 -94
  103. package/dist/adapters/vue/usePhoneAuth.js +0 -103
  104. package/dist/browser.d.ts +0 -7
  105. package/dist/browser.js +0 -31
  106. package/dist/core/client.d.ts +0 -22
  107. package/dist/core/client.js +0 -77
  108. package/dist/core/logger.d.ts +0 -130
  109. package/dist/core/logger.js +0 -370
  110. package/dist/core/phone-auth/api-types.d.ts +0 -593
  111. package/dist/core/phone-auth/api-types.js +0 -215
  112. package/dist/core/phone-auth/client.d.ts +0 -189
  113. package/dist/core/phone-auth/client.js +0 -1441
  114. package/dist/core/phone-auth/error-utils.d.ts +0 -110
  115. package/dist/core/phone-auth/error-utils.js +0 -350
  116. package/dist/core/phone-auth/index.d.ts +0 -7
  117. package/dist/core/phone-auth/index.js +0 -50
  118. package/dist/core/phone-auth/status-types.d.ts +0 -107
  119. package/dist/core/phone-auth/status-types.js +0 -31
  120. package/dist/core/phone-auth/strategies/desktop.d.ts +0 -122
  121. package/dist/core/phone-auth/strategies/desktop.js +0 -596
  122. package/dist/core/phone-auth/strategies/index.d.ts +0 -11
  123. package/dist/core/phone-auth/strategies/index.js +0 -15
  124. package/dist/core/phone-auth/strategies/link.d.ts +0 -89
  125. package/dist/core/phone-auth/strategies/link.js +0 -384
  126. package/dist/core/phone-auth/strategies/ts43.d.ts +0 -32
  127. package/dist/core/phone-auth/strategies/ts43.js +0 -161
  128. package/dist/core/phone-auth/strategies/types.d.ts +0 -18
  129. package/dist/core/phone-auth/strategies/types.js +0 -6
  130. package/dist/core/phone-auth/type-guards.d.ts +0 -143
  131. package/dist/core/phone-auth/type-guards.js +0 -198
  132. package/dist/core/phone-auth/types.d.ts +0 -237
  133. package/dist/core/phone-auth/types.js +0 -93
  134. package/dist/core/phone-auth/ui/mobile-debug-console.d.ts +0 -25
  135. package/dist/core/phone-auth/ui/modal.d.ts +0 -88
  136. package/dist/core/phone-auth/ui/modal.js +0 -598
  137. package/dist/core/phone-auth/validation-utils.d.ts +0 -44
  138. package/dist/core/types.d.ts +0 -62
  139. package/dist/core/types.js +0 -2
  140. package/dist/core/version.d.ts +0 -1
  141. package/dist/core/version.js +0 -5
  142. package/dist/esm/adapters/angular/client.service.d.ts +0 -7
  143. package/dist/esm/adapters/angular/client.service.js +0 -27
  144. package/dist/esm/adapters/angular/index.d.ts +0 -3
  145. package/dist/esm/adapters/angular/index.js +0 -4
  146. package/dist/esm/adapters/angular/phone-auth.service.d.ts +0 -38
  147. package/dist/esm/adapters/angular/phone-auth.service.js +0 -127
  148. package/dist/esm/adapters/react/index.d.ts +0 -9
  149. package/dist/esm/adapters/react/index.js +0 -8
  150. package/dist/esm/adapters/react/useClient.d.ts +0 -26
  151. package/dist/esm/adapters/react/useClient.js +0 -116
  152. package/dist/esm/adapters/react/usePhoneAuth.d.ts +0 -23
  153. package/dist/esm/adapters/react/usePhoneAuth.js +0 -92
  154. package/dist/esm/adapters/vanilla/client.d.ts +0 -8
  155. package/dist/esm/adapters/vanilla/client.js +0 -29
  156. package/dist/esm/adapters/vanilla/index.d.ts +0 -3
  157. package/dist/esm/adapters/vanilla/index.js +0 -4
  158. package/dist/esm/adapters/vanilla/phone-auth.d.ts +0 -46
  159. package/dist/esm/adapters/vanilla/phone-auth.js +0 -134
  160. package/dist/esm/adapters/vue/index.d.ts +0 -10
  161. package/dist/esm/adapters/vue/index.js +0 -11
  162. package/dist/esm/adapters/vue/useClient.d.ts +0 -115
  163. package/dist/esm/adapters/vue/useClient.js +0 -127
  164. package/dist/esm/adapters/vue/usePhoneAuth.d.ts +0 -94
  165. package/dist/esm/adapters/vue/usePhoneAuth.js +0 -100
  166. package/dist/esm/browser.d.ts +0 -7
  167. package/dist/esm/core/client.d.ts +0 -22
  168. package/dist/esm/core/client.js +0 -70
  169. package/dist/esm/core/logger.d.ts +0 -130
  170. package/dist/esm/core/logger.js +0 -359
  171. package/dist/esm/core/phone-auth/api-types.d.ts +0 -593
  172. package/dist/esm/core/phone-auth/api-types.js +0 -203
  173. package/dist/esm/core/phone-auth/client.d.ts +0 -189
  174. package/dist/esm/core/phone-auth/client.js +0 -1404
  175. package/dist/esm/core/phone-auth/error-utils.d.ts +0 -110
  176. package/dist/esm/core/phone-auth/error-utils.js +0 -338
  177. package/dist/esm/core/phone-auth/index.d.ts +0 -7
  178. package/dist/esm/core/phone-auth/index.js +0 -8
  179. package/dist/esm/core/phone-auth/status-types.d.ts +0 -107
  180. package/dist/esm/core/phone-auth/status-types.js +0 -26
  181. package/dist/esm/core/phone-auth/strategies/desktop.d.ts +0 -122
  182. package/dist/esm/core/phone-auth/strategies/desktop.js +0 -590
  183. package/dist/esm/core/phone-auth/strategies/index.d.ts +0 -11
  184. package/dist/esm/core/phone-auth/strategies/index.js +0 -7
  185. package/dist/esm/core/phone-auth/strategies/link.d.ts +0 -89
  186. package/dist/esm/core/phone-auth/strategies/link.js +0 -380
  187. package/dist/esm/core/phone-auth/strategies/ts43.d.ts +0 -32
  188. package/dist/esm/core/phone-auth/strategies/ts43.js +0 -157
  189. package/dist/esm/core/phone-auth/strategies/types.d.ts +0 -18
  190. package/dist/esm/core/phone-auth/strategies/types.js +0 -5
  191. package/dist/esm/core/phone-auth/type-guards.d.ts +0 -143
  192. package/dist/esm/core/phone-auth/type-guards.js +0 -185
  193. package/dist/esm/core/phone-auth/types.d.ts +0 -237
  194. package/dist/esm/core/phone-auth/types.js +0 -76
  195. package/dist/esm/core/phone-auth/ui/modal.d.ts +0 -88
  196. package/dist/esm/core/phone-auth/ui/modal.js +0 -594
  197. package/dist/esm/core/phone-auth/validation-utils.d.ts +0 -44
  198. package/dist/esm/core/types.d.ts +0 -62
  199. package/dist/esm/core/version.d.ts +0 -1
  200. package/dist/esm/core/version.js +0 -2
  201. package/dist/esm/index.d.ts +0 -12
  202. package/dist/index.d.ts +0 -12
  203. package/dist/index.js +0 -55
@@ -1,24 +1,38 @@
1
1
  "use strict";
2
2
  /**
3
- * Validation utilities for phone authentication
3
+ * Validation utilities for phone authentication.
4
+ *
5
+ * Pure functions with no runtime dependencies.
6
+ * All validators return { valid: boolean; error?: string }.
4
7
  */
5
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.E164_REGEX = void 0;
6
10
  exports.validatePhoneNumber = validatePhoneNumber;
7
11
  exports.validatePlmn = validatePlmn;
8
12
  exports.validateUseCaseRequirements = validateUseCaseRequirements;
9
- exports.createValidationError = createValidationError;
10
- const api_types_1 = require("./api-types");
13
+ exports.validateNonce = validateNonce;
14
+ exports.validateSessionKey = validateSessionKey;
15
+ const types_1 = require("./types");
16
+ /** E.164 phone number regex */
17
+ exports.E164_REGEX = /^\+[1-9]\d{1,14}$/;
11
18
  /**
12
- * Validates E.164 phone number format
19
+ * Validates E.164 phone number format.
20
+ *
13
21
  * @param phoneNumber - Phone number to validate
14
22
  * @returns Validation result with error if invalid
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const result = validatePhoneNumber('+14155551234');
27
+ * if (!result.valid) {
28
+ * console.error(result.error);
29
+ * }
30
+ * ```
15
31
  */
16
32
  function validatePhoneNumber(phoneNumber) {
17
33
  if (!phoneNumber) {
18
34
  return { valid: true }; // Phone number is optional for GetPhoneNumber
19
35
  }
20
- // E.164 format validation - strict, no cleaning
21
- const e164Regex = /^\+[1-9]\d{1,14}$/;
22
36
  if (!phoneNumber.startsWith('+')) {
23
37
  return {
24
38
  valid: false,
@@ -37,14 +51,14 @@ function validatePhoneNumber(phoneNumber) {
37
51
  error: 'Phone number too long for E.164 format (maximum 15 digits after +)'
38
52
  };
39
53
  }
40
- // Check for any invalid characters (spaces, dashes, parentheses, etc.)
54
+ // Check for invalid characters (spaces, dashes, parentheses, etc.)
41
55
  if (!/^\+\d+$/.test(phoneNumber)) {
42
56
  return {
43
57
  valid: false,
44
58
  error: 'Phone number contains invalid characters. E.164 format only allows + followed by digits'
45
59
  };
46
60
  }
47
- if (!e164Regex.test(phoneNumber)) {
61
+ if (!exports.E164_REGEX.test(phoneNumber)) {
48
62
  return {
49
63
  valid: false,
50
64
  error: 'Invalid E.164 phone number format'
@@ -53,7 +67,11 @@ function validatePhoneNumber(phoneNumber) {
53
67
  return { valid: true };
54
68
  }
55
69
  /**
56
- * Validates PLMN (MCC/MNC) values
70
+ * Validates PLMN (MCC/MNC) values.
71
+ *
72
+ * @deprecated PLMN validation will be removed with PLMN support.
73
+ * TODO: Remove in next major version
74
+ *
57
75
  * @param plmn - PLMN object with MCC and MNC
58
76
  * @returns Validation result
59
77
  */
@@ -76,19 +94,19 @@ function validatePlmn(plmn) {
76
94
  error: 'MNC must be 2 or 3 digits'
77
95
  };
78
96
  }
79
- // No range validation - allowing unofficial MCCs for telco labs
80
97
  return { valid: true };
81
98
  }
82
99
  /**
83
- * Validates use case and phone number combination
100
+ * Validates use case and required parameters combination.
101
+ *
84
102
  * @param useCase - The use case
85
103
  * @param phoneNumber - The phone number (required for VerifyPhoneNumber)
86
- * @param hasParentSessionId - Whether parent_session_id is provided (allows skipping normal validation)
104
+ * @param hasParentSessionId - Whether parent_session_id is provided
87
105
  * @returns Validation result
88
106
  */
89
107
  function validateUseCaseRequirements(useCase, phoneNumber, hasParentSessionId) {
90
108
  // VerifyPhoneNumber requires a phone number (unless parent_session_id is provided)
91
- if (useCase === api_types_1.USE_CASE.VERIFY_PHONE_NUMBER && !phoneNumber && !hasParentSessionId) {
109
+ if (useCase === types_1.USE_CASE.VERIFY_PHONE_NUMBER && !phoneNumber && !hasParentSessionId) {
92
110
  return {
93
111
  valid: false,
94
112
  error: 'Phone number is required for VerifyPhoneNumber use case'
@@ -97,16 +115,45 @@ function validateUseCaseRequirements(useCase, phoneNumber, hasParentSessionId) {
97
115
  return { valid: true };
98
116
  }
99
117
  /**
100
- * Creates a validation error
101
- * @param code - Error code
102
- * @param message - Error message
103
- * @param field - Field that failed validation
118
+ * Validates nonce format.
119
+ *
120
+ * @param nonce - Nonce string to validate
121
+ * @returns Validation result
122
+ */
123
+ function validateNonce(nonce) {
124
+ const base64urlRegex = /^[A-Za-z0-9_-]+$/;
125
+ if (!nonce || nonce.length === 0) {
126
+ return {
127
+ valid: false,
128
+ error: 'Nonce is required'
129
+ };
130
+ }
131
+ if (!base64urlRegex.test(nonce)) {
132
+ return {
133
+ valid: false,
134
+ error: 'Nonce must be base64url encoded'
135
+ };
136
+ }
137
+ if (nonce.length < 32 || nonce.length > 128) {
138
+ return {
139
+ valid: false,
140
+ error: 'Nonce must be between 32 and 128 characters'
141
+ };
142
+ }
143
+ return { valid: true };
144
+ }
145
+ /**
146
+ * Validates session key format.
147
+ *
148
+ * @param sessionKey - Session key to validate
149
+ * @returns Validation result
104
150
  */
105
- function createValidationError(code, message, field) {
106
- const error = new Error(message);
107
- error.code = code;
108
- if (field) {
109
- error.field = field;
151
+ function validateSessionKey(sessionKey) {
152
+ if (!sessionKey || sessionKey.length < 16) {
153
+ return {
154
+ valid: false,
155
+ error: 'Session key is required and must be at least 16 characters'
156
+ };
110
157
  }
111
- return error;
158
+ return { valid: true };
112
159
  }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ /**
3
+ * Glide Phone Authentication SDK
4
+ *
5
+ * @example Basic Usage
6
+ * ```typescript
7
+ * import { PhoneAuthClient } from '@glideidentity/web-client-sdk';
8
+ *
9
+ * const client = new PhoneAuthClient({ debug: true });
10
+ * const result = await client.authenticate({
11
+ * use_case: 'VerifyPhoneNumber',
12
+ * phone_number: '+14155551234'
13
+ * });
14
+ * ```
15
+ *
16
+ * @example React
17
+ * ```typescript
18
+ * import { usePhoneAuth } from '@glideidentity/web-client-sdk/react';
19
+ * ```
20
+ *
21
+ * @example Vue
22
+ * ```typescript
23
+ * import { usePhoneAuth } from '@glideidentity/web-client-sdk/vue';
24
+ * ```
25
+ *
26
+ * @example Core Types Only
27
+ * ```typescript
28
+ * import type { PrepareRequest } from '@glideidentity/web-client-sdk/core';
29
+ * ```
30
+ */
31
+ Object.defineProperty(exports, "__esModule", { value: true });
32
+ exports.createQRCodeDataFromDesktop = exports.AuthModal = exports.createNoopLogger = exports.createLogger = exports.createHttpClient = exports.E164_REGEX = exports.validateSessionKey = exports.validateNonce = exports.validateUseCaseRequirements = exports.validatePlmn = exports.validatePhoneNumber = exports.isErrorResponse = exports.isVerifyPhoneNumberResponse = exports.isGetPhoneNumberResponse = exports.isDesktopData = exports.isLinkData = exports.isTS43Data = exports.isCancellable = exports.isDesktopStrategy = exports.isLinkStrategy = exports.isTS43Strategy = exports.isAuthCredential = exports.isInvokeResult = exports.parseBackendError = exports.createAuthError = exports.getUserMessage = exports.isRetryableError = exports.isClientError = exports.isAuthError = exports.ERROR_CODES = exports.AUTHENTICATION_STRATEGY = exports.USE_CASE = exports.PhoneAuthClient = void 0;
33
+ // Main client
34
+ var phone_auth_client_1 = require("./client/phone-auth-client");
35
+ Object.defineProperty(exports, "PhoneAuthClient", { enumerable: true, get: function () { return phone_auth_client_1.PhoneAuthClient; } });
36
+ // Constants
37
+ var types_1 = require("./core/types");
38
+ Object.defineProperty(exports, "USE_CASE", { enumerable: true, get: function () { return types_1.USE_CASE; } });
39
+ Object.defineProperty(exports, "AUTHENTICATION_STRATEGY", { enumerable: true, get: function () { return types_1.AUTHENTICATION_STRATEGY; } });
40
+ // Error codes and utilities
41
+ var errors_1 = require("./core/errors");
42
+ Object.defineProperty(exports, "ERROR_CODES", { enumerable: true, get: function () { return errors_1.ERROR_CODES; } });
43
+ var errors_2 = require("./core/errors");
44
+ Object.defineProperty(exports, "isAuthError", { enumerable: true, get: function () { return errors_2.isAuthError; } });
45
+ Object.defineProperty(exports, "isClientError", { enumerable: true, get: function () { return errors_2.isClientError; } });
46
+ Object.defineProperty(exports, "isRetryableError", { enumerable: true, get: function () { return errors_2.isRetryableError; } });
47
+ Object.defineProperty(exports, "getUserMessage", { enumerable: true, get: function () { return errors_2.getUserMessage; } });
48
+ Object.defineProperty(exports, "createAuthError", { enumerable: true, get: function () { return errors_2.createAuthError; } });
49
+ Object.defineProperty(exports, "parseBackendError", { enumerable: true, get: function () { return errors_2.parseBackendError; } });
50
+ // Type guards
51
+ var type_guards_1 = require("./core/type-guards");
52
+ Object.defineProperty(exports, "isInvokeResult", { enumerable: true, get: function () { return type_guards_1.isInvokeResult; } });
53
+ Object.defineProperty(exports, "isAuthCredential", { enumerable: true, get: function () { return type_guards_1.isAuthCredential; } });
54
+ Object.defineProperty(exports, "isTS43Strategy", { enumerable: true, get: function () { return type_guards_1.isTS43Strategy; } });
55
+ Object.defineProperty(exports, "isLinkStrategy", { enumerable: true, get: function () { return type_guards_1.isLinkStrategy; } });
56
+ Object.defineProperty(exports, "isDesktopStrategy", { enumerable: true, get: function () { return type_guards_1.isDesktopStrategy; } });
57
+ Object.defineProperty(exports, "isCancellable", { enumerable: true, get: function () { return type_guards_1.isCancellable; } });
58
+ Object.defineProperty(exports, "isTS43Data", { enumerable: true, get: function () { return type_guards_1.isTS43Data; } });
59
+ Object.defineProperty(exports, "isLinkData", { enumerable: true, get: function () { return type_guards_1.isLinkData; } });
60
+ Object.defineProperty(exports, "isDesktopData", { enumerable: true, get: function () { return type_guards_1.isDesktopData; } });
61
+ Object.defineProperty(exports, "isGetPhoneNumberResponse", { enumerable: true, get: function () { return type_guards_1.isGetPhoneNumberResponse; } });
62
+ Object.defineProperty(exports, "isVerifyPhoneNumberResponse", { enumerable: true, get: function () { return type_guards_1.isVerifyPhoneNumberResponse; } });
63
+ Object.defineProperty(exports, "isErrorResponse", { enumerable: true, get: function () { return type_guards_1.isErrorResponse; } });
64
+ // Validators
65
+ var validators_1 = require("./core/validators");
66
+ Object.defineProperty(exports, "validatePhoneNumber", { enumerable: true, get: function () { return validators_1.validatePhoneNumber; } });
67
+ Object.defineProperty(exports, "validatePlmn", { enumerable: true, get: function () { return validators_1.validatePlmn; } });
68
+ Object.defineProperty(exports, "validateUseCaseRequirements", { enumerable: true, get: function () { return validators_1.validateUseCaseRequirements; } });
69
+ Object.defineProperty(exports, "validateNonce", { enumerable: true, get: function () { return validators_1.validateNonce; } });
70
+ Object.defineProperty(exports, "validateSessionKey", { enumerable: true, get: function () { return validators_1.validateSessionKey; } });
71
+ Object.defineProperty(exports, "E164_REGEX", { enumerable: true, get: function () { return validators_1.E164_REGEX; } });
72
+ // Client utilities (for advanced use)
73
+ var http_1 = require("./client/http");
74
+ Object.defineProperty(exports, "createHttpClient", { enumerable: true, get: function () { return http_1.createHttpClient; } });
75
+ var logger_1 = require("./client/logger");
76
+ Object.defineProperty(exports, "createLogger", { enumerable: true, get: function () { return logger_1.createLogger; } });
77
+ Object.defineProperty(exports, "createNoopLogger", { enumerable: true, get: function () { return logger_1.createNoopLogger; } });
78
+ // UI components
79
+ var modal_1 = require("./ui/modal");
80
+ Object.defineProperty(exports, "AuthModal", { enumerable: true, get: function () { return modal_1.AuthModal; } });
81
+ Object.defineProperty(exports, "createQRCodeDataFromDesktop", { enumerable: true, get: function () { return modal_1.createQRCodeDataFromDesktop; } });
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * UI Components for Phone Authentication SDK
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.MobileDebugConsole = exports.createQRCodeDataFromDesktop = exports.AuthModal = void 0;
7
+ var modal_1 = require("./modal");
8
+ Object.defineProperty(exports, "AuthModal", { enumerable: true, get: function () { return modal_1.AuthModal; } });
9
+ Object.defineProperty(exports, "createQRCodeDataFromDesktop", { enumerable: true, get: function () { return modal_1.createQRCodeDataFromDesktop; } });
10
+ var mobile_debug_console_1 = require("./mobile-debug-console");
11
+ Object.defineProperty(exports, "MobileDebugConsole", { enumerable: true, get: function () { return mobile_debug_console_1.MobileDebugConsole; } });
@@ -53,24 +53,31 @@ class MobileDebugConsole {
53
53
  try {
54
54
  return JSON.stringify(arg, null, 2);
55
55
  }
56
- catch (_a) {
56
+ catch {
57
57
  return '[Object]';
58
58
  }
59
59
  }
60
60
  return String(arg);
61
61
  }).join(' ');
62
- // Create colored log entry
62
+ // Color scheme for log types
63
63
  const colors = {
64
- log: '#fff',
65
- error: '#ff6b6b',
66
- warn: '#ffd93d',
67
- info: '#6bcf7f',
68
- debug: '#95a5a6'
64
+ log: '#abb2bf', // Light gray
65
+ error: '#e06c75', // Soft red
66
+ warn: '#e5c07b', // Yellow/gold
67
+ info: '#61afef', // Blue
68
+ debug: '#5c6370' // Dim gray
69
+ };
70
+ const badges = {
71
+ log: '#3c3c3c',
72
+ error: 'rgba(224, 108, 117, 0.2)',
73
+ warn: 'rgba(229, 192, 123, 0.2)',
74
+ info: 'rgba(97, 175, 239, 0.2)',
75
+ debug: '#2d2d2d'
69
76
  };
70
77
  const logHtml = `
71
- <div style="margin: 4px 0; font-family: monospace; font-size: 11px; color: ${colors[type] || '#fff'};">
72
- <span style="color: #666;">[${timestamp}]</span>
73
- <span style="color: ${colors[type]}; font-weight: bold; text-transform: uppercase; font-size: 9px;">[${type}]</span>
78
+ <div style="margin: 3px 0; font-family: 'SF Mono', Menlo, Monaco, monospace; font-size: 11px; color: ${colors[type] || '#abb2bf'}; line-height: 1.5;">
79
+ <span style="color: #5c6370; font-size: 10px;">${timestamp}</span>
80
+ <span style="background: ${badges[type]}; color: ${colors[type]}; padding: 1px 5px; border-radius: 3px; font-size: 9px; font-weight: 500; text-transform: uppercase; margin: 0 6px;">${type}</span>
74
81
  <span style="white-space: pre-wrap; word-break: break-all;">${this.escapeHtml(content)}</span>
75
82
  </div>
76
83
  `;
@@ -103,12 +110,14 @@ class MobileDebugConsole {
103
110
  left: 0;
104
111
  right: 0;
105
112
  height: 45vh;
106
- background: rgba(0, 0, 0, 0.95);
113
+ background: #1e1e1e;
107
114
  z-index: 999999;
108
115
  display: flex;
109
116
  flex-direction: column;
110
- font-family: monospace;
111
- transition: transform 0.3s ease;
117
+ font-family: 'SF Mono', Menlo, Monaco, 'Courier New', monospace;
118
+ transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
119
+ border-top: 1px solid #3c3c3c;
120
+ box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
112
121
  }
113
122
 
114
123
  #mobile-debug-console.hidden {
@@ -119,74 +128,136 @@ class MobileDebugConsole {
119
128
  display: flex;
120
129
  justify-content: space-between;
121
130
  align-items: center;
122
- padding: 10px;
123
- background: #1a1a1a;
124
- border-top: 2px solid #333;
131
+ padding: 8px 12px;
132
+ background: #2d2d2d;
133
+ border-bottom: 1px solid #3c3c3c;
134
+ min-height: 36px;
125
135
  }
126
136
 
127
137
  #debug-title {
128
- color: #0f0;
138
+ display: flex;
139
+ align-items: center;
140
+ gap: 8px;
141
+ color: #9da5b4;
129
142
  font-size: 12px;
130
- font-weight: bold;
143
+ font-weight: 500;
144
+ letter-spacing: 0.3px;
145
+ }
146
+
147
+ #debug-title svg {
148
+ width: 14px;
149
+ height: 14px;
150
+ opacity: 0.8;
131
151
  }
132
152
 
133
- #debug-buttons {
153
+ /* Traffic light buttons - using ID for specificity */
154
+ #mobile-debug-console .debug-traffic-lights {
134
155
  display: flex;
135
- gap: 10px;
156
+ gap: 8px;
157
+ align-items: center;
136
158
  }
137
159
 
138
- #debug-buttons button {
139
- padding: 5px 10px;
140
- background: #333;
141
- color: #fff;
142
- border: 1px solid #555;
143
- border-radius: 3px;
144
- font-size: 11px;
160
+ #mobile-debug-console button.debug-traffic-btn {
161
+ width: 16px;
162
+ height: 16px;
163
+ min-width: 16px;
164
+ min-height: 16px;
165
+ border-radius: 50%;
166
+ border: none;
145
167
  cursor: pointer;
168
+ display: flex;
169
+ align-items: center;
170
+ justify-content: center;
171
+ padding: 0;
172
+ font-size: 0;
173
+ line-height: 1;
174
+ }
175
+
176
+ #mobile-debug-console .debug-traffic-btn svg {
177
+ width: 8px;
178
+ height: 8px;
179
+ }
180
+
181
+ #mobile-debug-console .debug-traffic-btn.close {
182
+ background: #ff5f57;
183
+ }
184
+
185
+ #mobile-debug-console .debug-traffic-btn.close svg {
186
+ stroke: #820005;
187
+ stroke-width: 2;
188
+ }
189
+
190
+ #mobile-debug-console .debug-traffic-btn.clear {
191
+ background: #febc2e;
146
192
  }
147
193
 
148
- #debug-buttons button:active {
149
- background: #555;
194
+ #mobile-debug-console .debug-traffic-btn.minimize {
195
+ background: #28c840;
196
+ }
197
+
198
+ #mobile-debug-console .debug-traffic-btn.minimize svg {
199
+ stroke: #006500;
200
+ stroke-width: 2;
201
+ }
202
+
203
+ #mobile-debug-console .debug-traffic-btn:active {
204
+ filter: brightness(0.85);
150
205
  }
151
206
 
152
207
  #debug-logs {
153
208
  flex: 1;
154
209
  overflow-y: auto;
155
- padding: 10px;
210
+ padding: 12px;
211
+ background: #1e1e1e;
156
212
  -webkit-overflow-scrolling: touch;
157
213
  }
158
214
 
159
- #debug-floating-toggle {
160
- position: fixed;
161
- bottom: 20px;
162
- right: 20px;
163
- width: 50px;
164
- height: 50px;
165
- border-radius: 50%;
166
- background: rgba(0, 0, 0, 0.8);
167
- border: 2px solid #0f0;
168
- color: #0f0;
169
- cursor: pointer;
170
- z-index: 999998;
215
+ button#debug-floating-toggle {
216
+ position: fixed !important;
217
+ bottom: 20px !important;
218
+ right: 20px !important;
219
+ width: 42px !important;
220
+ height: 42px !important;
221
+ min-width: 42px !important;
222
+ min-height: 42px !important;
223
+ border-radius: 8px !important;
224
+ background: #2d2d2d !important;
225
+ border: 1px solid #3c3c3c !important;
226
+ color: #9da5b4 !important;
227
+ cursor: pointer !important;
228
+ z-index: 999998 !important;
171
229
  display: none;
172
- align-items: center;
173
- justify-content: center;
174
- font-size: 24px;
175
- box-shadow: 0 2px 10px rgba(0, 255, 0, 0.3);
176
- transition: all 0.3s ease;
230
+ align-items: center !important;
231
+ justify-content: center !important;
232
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
233
+ transition: all 0.2s ease !important;
234
+ padding: 0 !important;
235
+ margin: 0 !important;
177
236
  }
178
237
 
179
- #debug-floating-toggle:hover {
180
- background: rgba(0, 0, 0, 0.9);
181
- transform: scale(1.1);
182
- box-shadow: 0 4px 15px rgba(0, 255, 0, 0.5);
238
+ button#debug-floating-toggle:hover {
239
+ background: #3c3c3c !important;
240
+ color: #fff !important;
241
+ transform: translateY(-2px) !important;
242
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
183
243
  }
184
244
 
185
- #debug-floating-toggle.visible {
186
- display: flex;
245
+ button#debug-floating-toggle:active {
246
+ transform: translateY(0) !important;
247
+ }
248
+
249
+ button#debug-floating-toggle.visible {
250
+ display: flex !important;
251
+ }
252
+
253
+ button#debug-floating-toggle svg {
254
+ width: 20px !important;
255
+ height: 20px !important;
187
256
  }
188
257
  `;
189
258
  document.head.appendChild(style);
259
+ // Terminal icon SVG (>_)
260
+ const terminalIcon = `<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 17 10 11 4 5"></polyline><line x1="12" y1="19" x2="20" y2="19"></line></svg>`;
190
261
  // Create container
191
262
  this.container = document.createElement('div');
192
263
  this.container.id = 'mobile-debug-console';
@@ -198,27 +269,33 @@ class MobileDebugConsole {
198
269
  header.id = 'debug-header';
199
270
  const title = document.createElement('div');
200
271
  title.id = 'debug-title';
201
- title.textContent = '📱 Mobile Debug Console';
202
- const buttons = document.createElement('div');
203
- buttons.id = 'debug-buttons';
204
- // Clear button
272
+ title.innerHTML = `${terminalIcon}<span>Mobile Console</span>`;
273
+ // Traffic light control buttons
274
+ const trafficLights = document.createElement('div');
275
+ trafficLights.className = 'debug-traffic-lights';
276
+ // Close button (red) - ×
277
+ const closeBtn = document.createElement('button');
278
+ closeBtn.className = 'debug-traffic-btn close';
279
+ closeBtn.title = 'Close';
280
+ closeBtn.innerHTML = `<svg viewBox="0 0 10 10" fill="none"><line x1="2.5" y1="2.5" x2="7.5" y2="7.5" stroke="currentColor"/><line x1="7.5" y1="2.5" x2="2.5" y2="7.5" stroke="currentColor"/></svg>`;
281
+ closeBtn.onclick = () => this.cleanup();
282
+ // Clear button (yellow) - trash icon
205
283
  const clearBtn = document.createElement('button');
206
- clearBtn.textContent = 'Clear';
284
+ clearBtn.className = 'debug-traffic-btn clear';
285
+ clearBtn.title = 'Clear';
286
+ clearBtn.innerHTML = `<svg viewBox="0 0 16 16" fill="currentColor"><path d="M5.5 5.5A.5.5 0 0 1 6 6v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m2.5 0a.5.5 0 0 1 .5.5v6a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m3 .5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z"/><path d="M14.5 3a1 1 0 0 1-1 1H13v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V4h-.5a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1H6a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1h3.5a1 1 0 0 1 1 1zM4.118 4 4 4.059V13a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1V4.059L11.882 4zM2.5 3h11V2h-11z"/></svg>`;
207
287
  clearBtn.onclick = () => this.clear();
208
- // Show/Hide button
288
+ // Minimize button (green) - minimize to floating button
209
289
  const toggleBtn = document.createElement('button');
210
- toggleBtn.textContent = 'Hide';
290
+ toggleBtn.className = 'debug-traffic-btn minimize';
291
+ toggleBtn.title = 'Minimize';
292
+ toggleBtn.innerHTML = `<svg viewBox="0 0 10 10" fill="none"><path d="M2 3L5 6L8 3" stroke="currentColor" fill="none"/></svg>`;
211
293
  toggleBtn.onclick = () => this.toggle();
212
- // Close button
213
- const closeBtn = document.createElement('button');
214
- closeBtn.textContent = '✕';
215
- closeBtn.style.color = '#ff6b6b';
216
- closeBtn.onclick = () => this.cleanup();
217
- buttons.appendChild(clearBtn);
218
- buttons.appendChild(toggleBtn);
219
- buttons.appendChild(closeBtn);
294
+ trafficLights.appendChild(closeBtn);
295
+ trafficLights.appendChild(clearBtn);
296
+ trafficLights.appendChild(toggleBtn);
297
+ header.appendChild(trafficLights);
220
298
  header.appendChild(title);
221
- header.appendChild(buttons);
222
299
  // Create logs container
223
300
  this.logsContainer = document.createElement('div');
224
301
  this.logsContainer.id = 'debug-logs';
@@ -230,15 +307,13 @@ class MobileDebugConsole {
230
307
  this.container.appendChild(header);
231
308
  this.container.appendChild(this.logsContainer);
232
309
  document.body.appendChild(this.container);
233
- // Create floating toggle button
310
+ // Create floating toggle button with terminal icon
234
311
  this.floatingToggle = document.createElement('button');
235
312
  this.floatingToggle.id = 'debug-floating-toggle';
236
- this.floatingToggle.innerHTML = '🖥️'; // Console icon
237
- this.floatingToggle.title = 'Show Debug Console';
313
+ this.floatingToggle.innerHTML = terminalIcon;
314
+ this.floatingToggle.title = 'Show Console';
238
315
  this.floatingToggle.onclick = () => this.toggle();
239
316
  document.body.appendChild(this.floatingToggle);
240
- // Store reference for toggle button
241
- window.__debugToggleBtn = toggleBtn;
242
317
  }
243
318
  escapeHtml(text) {
244
319
  const div = document.createElement('div');
@@ -251,13 +326,11 @@ class MobileDebugConsole {
251
326
  if (this.isVisible) {
252
327
  this.container.classList.remove('hidden');
253
328
  this.floatingToggle.classList.remove('visible');
254
- window.__debugToggleBtn.textContent = 'Hide';
255
329
  this.updateDisplay();
256
330
  }
257
331
  else {
258
332
  this.container.classList.add('hidden');
259
333
  this.floatingToggle.classList.add('visible');
260
- window.__debugToggleBtn.textContent = 'Show';
261
334
  }
262
335
  }
263
336
  }
@@ -280,8 +353,6 @@ class MobileDebugConsole {
280
353
  if (this.floatingToggle) {
281
354
  this.floatingToggle.remove();
282
355
  }
283
- // Clean up references
284
- delete window.__debugToggleBtn;
285
356
  }
286
357
  }
287
358
  exports.MobileDebugConsole = MobileDebugConsole;