@opencampus/ocid-connect-js 2.0.4 → 2.0.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/CHANGELOG.md ADDED
@@ -0,0 +1,65 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [v2.0.6] - 2025-04-29
6
+ ### Changed
7
+ - add emailPlaceHolder as param in signinWithRedirect
8
+ - add emailPlaceHolder as property in LoginButton
9
+ - remove emailPlaceHolder as param in opts
10
+
11
+ ## [v2.0.5] - 2025-11-06
12
+ ### Changed
13
+ - Add option to send email to login process.
14
+
15
+ ## [v2.0.3] - 2025-04-29
16
+ ### Changed
17
+ - Allow overriding state in LoginButton
18
+
19
+ ## [v2.0.2] - 2025-04-28
20
+ ### Changed
21
+ - Update for React v19
22
+
23
+ ## [v2.0.1] - 2025-04-03
24
+ ### Changed
25
+ - Add optional storage key override to allow overlap cookie domain to distinguish their own storage states.
26
+
27
+ ## [v2.0.0] - 2025-03-28
28
+ ### Changed
29
+ - Authentication Client Id.
30
+ - New updated spinner while waiting for token exchange.
31
+
32
+ ## [v1.2.3] - 2024-11-04
33
+ ### Changed
34
+ - Add logoutReturnTo as an optional parameter to logout method so users can instruct OC Service to return to a designation url after logging out.
35
+
36
+ ## [v1.2.2] - 2024-10-16
37
+ ### Changed
38
+ - Add new properties to OCAuthCore:
39
+ - OCId
40
+ - ethAddress
41
+ - State parameters (from signup process)
42
+
43
+ ## [v1.2.1] - 2024-10-03
44
+ ### Changed
45
+ - Add methods to access parsed data from idToken and accessToken
46
+
47
+ ## [v1.2.0] - 2024-09-22
48
+ ### Added
49
+ - Add logout function to instruct OC to log user out of OC Service
50
+
51
+ ## [v1.1.2] - 2024-08-28
52
+ ### Changed
53
+ - Add option to send referral code to registration process.
54
+ - Referral code is used in OpenCampus for bonus points.
55
+
56
+ ## [v1.1.0] - 2024-08-22
57
+ ### Added
58
+ - Improved cross-domain storage handling
59
+ - Implemented cookie-based storage option:
60
+ - Added `storageType: 'cookie'` option
61
+ - Added `cookieDomain` configuration for domain specification
62
+
63
+ ## [v1.0.1] - 2024-08-06
64
+ ### Added
65
+ - Initial release
package/README.md CHANGED
@@ -357,7 +357,7 @@ Main Methods of Auth SDK
357
357
 
358
358
  | Method | Description |
359
359
  | --- | --- |
360
- | signInWithRedirect | Initialize login process. Accept "state" as an input |
360
+ | signInWithRedirect | Initialize login process. Accept "state" & "emailPlaceholder" as an input |
361
361
  | handleLoginRedirect | Return the auth state of the login process |
362
362
  | getAuthState | Return auth state data { accessToken, idToken, OCId, ethAddress, isAuthenticated } |
363
363
  | getStateParameter() | Return the state that was initialized in signin process |
@@ -371,6 +371,7 @@ import { OCAuthSandbox } from '@opencampus/ocid-connect-js';
371
371
  const authSdk = new OCAuthSandbox()
372
372
  await authSdk.signInWithRedirect( {
373
373
  state: 'opencampus',
374
+ emailPlaceholder: 'test@test.com'
374
375
  });
375
376
  ```
376
377
 
@@ -257,7 +257,8 @@ function LoginButton(_ref) {
257
257
  var pill = _ref.pill,
258
258
  disabled = _ref.disabled,
259
259
  theme = _ref.theme,
260
- state = _ref.state;
260
+ state = _ref.state,
261
+ emailPlaceholder = _ref.emailPlaceholder;
261
262
  var _useOCAuth = Object(_OCContext__WEBPACK_IMPORTED_MODULE_1__["useOCAuth"])(),
262
263
  ocAuth = _useOCAuth.ocAuth;
263
264
  var customTheme = themes[theme] || themes['ocBlue'];
@@ -268,7 +269,8 @@ function LoginButton(_ref) {
268
269
  case 0:
269
270
  _context.next = 2;
270
271
  return ocAuth.signInWithRedirect({
271
- state: state
272
+ state: state,
273
+ emailPlaceholder: emailPlaceholder
272
274
  });
273
275
  case 2:
274
276
  case "end":
@@ -1188,9 +1190,10 @@ var OCAuthCore = /*#__PURE__*/function () {
1188
1190
  meta = Object(_utils__WEBPACK_IMPORTED_MODULE_4__["createPkceMeta"])(signinParams);
1189
1191
  this.transactionManager.save(meta);
1190
1192
  signinParams.referralCode = this.referralCode;
1193
+ signinParams.emailPlaceholder = paramsClone.emailPlaceholder;
1191
1194
  requestUrl = Object(_endpoints__WEBPACK_IMPORTED_MODULE_5__["buildAuthEndpointUrl"])(signinParams, this.loginEndPoint);
1192
1195
  window.location.assign(requestUrl);
1193
- case 11:
1196
+ case 12:
1194
1197
  case "end":
1195
1198
  return _context2.stop();
1196
1199
  }
@@ -2684,6 +2687,11 @@ var buildAuthEndpointUrl = function buildAuthEndpointUrl(signInParams, loginEndP
2684
2687
  if (signInParams.referralCode) {
2685
2688
  loginUrl.searchParams.append('ref', signInParams.referralCode);
2686
2689
  }
2690
+
2691
+ // email data for register workflow
2692
+ if (signInParams.emailPlaceholder) {
2693
+ loginUrl.searchParams.append('emailPlaceholder', signInParams.emailPlaceholder);
2694
+ }
2687
2695
  return loginUrl.href;
2688
2696
  };
2689
2697