@sunggang/ui-lib 0.3.45 → 0.3.46

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 (2) hide show
  1. package/index.esm2.js +13 -8
  2. package/package.json +1 -1
package/index.esm2.js CHANGED
@@ -78396,7 +78396,7 @@ var LiffProvider = function(param) {
78396
78396
  var _useState4 = _sliced_to_array(useState(null), 2), userInfo = _useState4[0], setUserInfo = _useState4[1];
78397
78397
  var _useState5 = _sliced_to_array(useState(null), 2), isFriendship = _useState5[0], setFriendship = _useState5[1];
78398
78398
  var _useState6 = _sliced_to_array(useState(null), 2), loginType = _useState6[0], setLoginType = _useState6[1];
78399
- var _useState7 = _sliced_to_array(useState(null), 2), queryToken = _useState7[0], setQueryToken = _useState7[1];
78399
+ var _useState7 = _sliced_to_array(useState(null), 2); _useState7[0]; _useState7[1];
78400
78400
  var fetchMemberInfo = function() {
78401
78401
  var _ref = _async_to_generator(function(token) {
78402
78402
  var response, err;
@@ -78857,12 +78857,16 @@ var LiffProvider = function(param) {
78857
78857
  }), [
78858
78858
  liffObject
78859
78859
  ]);
78860
+ var normalizeToken = function(token) {
78861
+ var trimmed = token.trim();
78862
+ return trimmed.toLowerCase().startsWith("bearer ") ? trimmed : "Bearer ".concat(trimmed);
78863
+ };
78860
78864
  var searchParams = typeof window !== "undefined" ? new URLSearchParams(window.location.search) : null;
78861
78865
  // 客戶端初始化 LIFF
78862
78866
  useEffect(function() {
78863
78867
  var checkAndInitialize = function() {
78864
78868
  var _ref = _async_to_generator(function() {
78865
- var tokenFromQuery, isValid, loginStore, jwtToken, _parsedStore_data, _parsedStore_state, parsedStore, isValid1, _tmp;
78869
+ var tokenFromQuery, finalToken, isValid, loginStore, jwtToken, _parsedStore_data, _parsedStore_state, parsedStore, isValid1, _tmp;
78866
78870
  return _ts_generator(this, function(_state) {
78867
78871
  switch(_state.label){
78868
78872
  case 0:
@@ -78871,13 +78875,16 @@ var LiffProvider = function(param) {
78871
78875
  3,
78872
78876
  2
78873
78877
  ];
78874
- setQueryToken(tokenFromQuery);
78878
+ finalToken = normalizeToken(tokenFromQuery);
78879
+ console.log("finalToken:", finalToken);
78880
+ setAccessToken(finalToken);
78875
78881
  return [
78876
78882
  4,
78877
- checkTokenFunc(tokenFromQuery)
78883
+ checkTokenFunc(finalToken)
78878
78884
  ];
78879
78885
  case 1:
78880
78886
  isValid = _state.sent();
78887
+ console.log("tokenFromQuery isValid:", isValid);
78881
78888
  if (isValid) return [
78882
78889
  2
78883
78890
  ];
@@ -78944,8 +78951,7 @@ var LiffProvider = function(param) {
78944
78951
  isFriendship: isFriendship,
78945
78952
  ensureLiffTokenValid: ensureLiffTokenValid,
78946
78953
  accountLogin: accountLogin,
78947
- loginType: loginType,
78948
- queryToken: queryToken
78954
+ loginType: loginType
78949
78955
  };
78950
78956
  }, [
78951
78957
  liffObject,
@@ -78956,8 +78962,7 @@ var LiffProvider = function(param) {
78956
78962
  isFriendship,
78957
78963
  ensureLiffTokenValid,
78958
78964
  accountLogin,
78959
- loginType,
78960
- queryToken
78965
+ loginType
78961
78966
  ]);
78962
78967
  return /*#__PURE__*/ jsx(LiffContext.Provider, {
78963
78968
  value: contextValue,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunggang/ui-lib",
3
- "version": "0.3.45",
3
+ "version": "0.3.46",
4
4
  "dependencies": {
5
5
  "@emotion/react": "^11.14.0",
6
6
  "@emotion/styled": "^11.14.0",