@sunggang/ui-lib 0.4.44 → 0.4.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.
@@ -456,14 +456,13 @@ var LiffContext = /*#__PURE__*/ React.createContext(undefined);
456
456
  var LiffProvider = function(param) {
457
457
  var children = param.children, liffId = param.liffId, _param_localStorageKey = param.localStorageKey, localStorageKey = _param_localStorageKey === void 0 ? "one-gobo-global-login" : _param_localStorageKey, checkTokenUrl = param.checkTokenUrl, loginUrl = param.loginUrl, accountLoginUrl = param.accountLoginUrl, memberInfoUrl = param.memberInfoUrl, _param_openInApp = param.openInApp, openInApp = _param_openInApp === void 0 ? false : _param_openInApp, _param_ignoreCheckAddFriend = param.ignoreCheckAddFriend, ignoreCheckAddFriend = _param_ignoreCheckAddFriend === void 0 ? false : _param_ignoreCheckAddFriend, _param_ignoreRoute = param.ignoreRoute, ignoreRoute = _param_ignoreRoute === void 0 ? false : _param_ignoreRoute, _param_loginByUser = param.loginByUser, loginByUser = _param_loginByUser === void 0 ? false : _param_loginByUser, _param_liffLogin = param.liffLogin, liffLogin = _param_liffLogin === void 0 ? false : _param_liffLogin, customerRedirectUrl = param.customerRedirectUrl, inviteCode = param.inviteCode, handleLoginError = param.handleLoginError;
458
458
  var _useState = _sliced_to_array(React.useState(null), 2), liffObject = _useState[0], setLiffObject = _useState[1];
459
- var _useState1 = _sliced_to_array(React.useState(false), 2), liffInitialized = _useState1[0], setLiffInitialized = _useState1[1];
460
- var _useState2 = _sliced_to_array(React.useState(""), 2), accessToken = _useState2[0], setAccessToken = _useState2[1];
461
- var _useState3 = _sliced_to_array(React.useState(null), 2), liffError = _useState3[0], setLiffError = _useState3[1];
462
- var _useState4 = _sliced_to_array(React.useState(null), 2), loginData = _useState4[0], setLoginData = _useState4[1];
463
- var _useState5 = _sliced_to_array(React.useState(null), 2), userInfo = _useState5[0], setUserInfo = _useState5[1];
464
- var _useState6 = _sliced_to_array(React.useState(null), 2), liffProfile = _useState6[0], setLiffProfile = _useState6[1];
465
- var _useState7 = _sliced_to_array(React.useState(null), 2), isFriendship = _useState7[0], setFriendship = _useState7[1];
466
- var _useState8 = _sliced_to_array(React.useState(null), 2), loginType = _useState8[0], setLoginType = _useState8[1];
459
+ var _useState1 = _sliced_to_array(React.useState(""), 2), accessToken = _useState1[0], setAccessToken = _useState1[1];
460
+ var _useState2 = _sliced_to_array(React.useState(null), 2), liffError = _useState2[0], setLiffError = _useState2[1];
461
+ var _useState3 = _sliced_to_array(React.useState(null), 2), loginData = _useState3[0], setLoginData = _useState3[1];
462
+ var _useState4 = _sliced_to_array(React.useState(null), 2), userInfo = _useState4[0], setUserInfo = _useState4[1];
463
+ var _useState5 = _sliced_to_array(React.useState(null), 2), liffProfile = _useState5[0], setLiffProfile = _useState5[1];
464
+ var _useState6 = _sliced_to_array(React.useState(null), 2), isFriendship = _useState6[0], setFriendship = _useState6[1];
465
+ var _useState7 = _sliced_to_array(React.useState(null), 2), loginType = _useState7[0], setLoginType = _useState7[1];
467
466
  // userInfo 的 localStorage key
468
467
  var userInfoStorageKey = "".concat(localStorageKey, "-userInfo");
469
468
  // liff profile 的 localStorage key
@@ -743,10 +742,9 @@ var LiffProvider = function(param) {
743
742
  ,
744
743
  11
745
744
  ]);
746
- // 確保 LIFF 已初始化(只執行一次)
747
745
  return [
748
746
  4,
749
- ensureLiffInitialized()
747
+ ensureLiffInitialized(isValid)
750
748
  ];
751
749
  case 1:
752
750
  _state.sent();
@@ -758,6 +756,9 @@ var LiffProvider = function(param) {
758
756
  imported = _state.sent();
759
757
  sdk = liffObject || imported.liff;
760
758
  setLiffObject(sdk);
759
+ if (sdk.isLoggedIn() && isValid) return [
760
+ 2
761
+ ];
761
762
  lineToken = sdk === null || sdk === void 0 ? void 0 : (_sdk_getAccessToken = sdk.getAccessToken) === null || _sdk_getAccessToken === void 0 ? void 0 : _sdk_getAccessToken.call(sdk);
762
763
  // 未登入先進行登入(呼叫 login 後立即 return,避免後續執行)
763
764
  if (!(sdk === null || sdk === void 0 ? void 0 : (_sdk_isLoggedIn = sdk.isLoggedIn) === null || _sdk_isLoggedIn === void 0 ? void 0 : _sdk_isLoggedIn.call(sdk))) {
@@ -857,76 +858,90 @@ var LiffProvider = function(param) {
857
858
  };
858
859
  }();
859
860
  // 確保 LIFF init 只執行一次且在需要時才執行
860
- var ensureLiffInitialized = React.useCallback(/*#__PURE__*/ _async_to_generator(function() {
861
- var customFetch, liff, originalFetch, e;
862
- return _ts_generator(this, function(_state) {
863
- switch(_state.label){
864
- case 0:
865
- if (liffInitialized) return [
866
- 2
867
- ];
868
- if (!liffId) {
869
- console.warn("liffId 未提供,跳過 liff.init()。");
861
+ var ensureLiffInitialized = React.useCallback(function() {
862
+ var _ref = _async_to_generator(function(isValid) {
863
+ var customFetch, liff, originalFetch, profile, e;
864
+ return _ts_generator(this, function(_state) {
865
+ switch(_state.label){
866
+ case 0:
867
+ if (!liffId) {
868
+ console.warn("liffId 未提供,跳過 liff.init()。");
869
+ return [
870
+ 2
871
+ ];
872
+ }
873
+ _state.label = 1;
874
+ case 1:
875
+ _state.trys.push([
876
+ 1,
877
+ 5,
878
+ ,
879
+ 6
880
+ ]);
881
+ customFetch = // 自訂 fetch 函數,避免每次請求都改變 URL
882
+ // eslint-disable-next-line no-inner-declarations
883
+ function customFetch(url, options) {
884
+ if (url.toString().startsWith("https://liffsdk.line-scdn.net/xlt/") && url.toString().endsWith(".json")) {
885
+ url = "".concat(url, "?ts=").concat(Math.random());
886
+ }
887
+ return originalFetch(url, options);
888
+ };
870
889
  return [
871
- 2
890
+ 4,
891
+ Promise.resolve().then(function () { return require('./index.cjs3.js'); })
872
892
  ];
873
- }
874
- _state.label = 1;
875
- case 1:
876
- _state.trys.push([
877
- 1,
878
- 4,
879
- ,
880
- 5
881
- ]);
882
- customFetch = // 自訂 fetch 函數,避免每次請求都改變 URL
883
- // eslint-disable-next-line no-inner-declarations
884
- function customFetch(url, options) {
885
- if (url.toString().startsWith("https://liffsdk.line-scdn.net/xlt/") && url.toString().endsWith(".json")) {
886
- url = "".concat(url, "?ts=").concat(Math.random());
893
+ case 2:
894
+ liff = _state.sent().liff;
895
+ originalFetch = window.fetch;
896
+ window.fetch = customFetch;
897
+ if (openInApp && !(liff === null || liff === void 0 ? void 0 : liff.isInClient()) && (liff === null || liff === void 0 ? void 0 : liff.getOS()) !== "web") window.location.href = "line://app/".concat(liffId);
898
+ if (liff.isLoggedIn() && isValid) {
899
+ console.log("LIFF already initialized.");
900
+ return [
901
+ 2
902
+ ];
887
903
  }
888
- return originalFetch(url, options);
889
- };
890
- return [
891
- 4,
892
- Promise.resolve().then(function () { return require('./index.cjs3.js'); })
893
- ];
894
- case 2:
895
- liff = _state.sent().liff;
896
- originalFetch = window.fetch;
897
- window.fetch = customFetch;
898
- if (openInApp && !(liff === null || liff === void 0 ? void 0 : liff.isInClient()) && (liff === null || liff === void 0 ? void 0 : liff.getOS()) !== "web") window.location.href = "line://app/".concat(liffId);
899
- return [
900
- 4,
901
- liff.init({
902
- liffId: liffId,
903
- withLoginOnExternalBrowser: false
904
- })
905
- ];
906
- case 3:
907
- _state.sent();
908
- setLiffObject(liff);
909
- setLiffInitialized(true);
910
- console.log("LIFF initialized.");
911
- return [
912
- 3,
913
- 5
914
- ];
915
- case 4:
916
- e = _state.sent();
917
- console.error("ensureLiffInitialized failed:", e);
918
- return [
919
- 3,
920
- 5
921
- ];
922
- case 5:
923
- return [
924
- 2
925
- ];
926
- }
904
+ return [
905
+ 4,
906
+ liff.init({
907
+ liffId: liffId,
908
+ withLoginOnExternalBrowser: false
909
+ })
910
+ ];
911
+ case 3:
912
+ _state.sent();
913
+ return [
914
+ 4,
915
+ liff.getProfile()
916
+ ];
917
+ case 4:
918
+ profile = _state.sent();
919
+ setLiffProfile(profile);
920
+ saveLiffProfileToStorage(profile);
921
+ setLiffObject(liff);
922
+ console.log("LIFF initialized.");
923
+ return [
924
+ 3,
925
+ 6
926
+ ];
927
+ case 5:
928
+ e = _state.sent();
929
+ console.error("ensureLiffInitialized failed:", e);
930
+ return [
931
+ 3,
932
+ 6
933
+ ];
934
+ case 6:
935
+ return [
936
+ 2
937
+ ];
938
+ }
939
+ });
927
940
  });
928
- }), [
929
- liffInitialized,
941
+ return function(isValid) {
942
+ return _ref.apply(this, arguments);
943
+ };
944
+ }(), [
930
945
  liffId,
931
946
  openInApp
932
947
  ]);
@@ -1001,77 +1016,6 @@ var LiffProvider = function(param) {
1001
1016
  return _ref.apply(this, arguments);
1002
1017
  };
1003
1018
  }();
1004
- // 取得 LIFF profile(LIFF 的會員資料,與 API 的 member 分開處理)
1005
- var getLiffProfile = React.useCallback(/*#__PURE__*/ _async_to_generator(function() {
1006
- var sdk, imported, profile, err;
1007
- return _ts_generator(this, function(_state) {
1008
- switch(_state.label){
1009
- case 0:
1010
- _state.trys.push([
1011
- 0,
1012
- 5,
1013
- ,
1014
- 6
1015
- ]);
1016
- // 確保 LIFF 已初始化
1017
- return [
1018
- 4,
1019
- ensureLiffInitialized()
1020
- ];
1021
- case 1:
1022
- _state.sent();
1023
- sdk = liffObject;
1024
- if (!!sdk) return [
1025
- 3,
1026
- 3
1027
- ];
1028
- return [
1029
- 4,
1030
- Promise.resolve().then(function () { return require('./index.cjs3.js'); })
1031
- ];
1032
- case 2:
1033
- imported = _state.sent();
1034
- sdk = imported.liff;
1035
- setLiffObject(sdk);
1036
- _state.label = 3;
1037
- case 3:
1038
- if (!sdk || typeof sdk.isLoggedIn !== "function" || !sdk.isLoggedIn()) {
1039
- console.warn("getLiffProfile: LIFF not initialized or user not logged in");
1040
- return [
1041
- 2,
1042
- null
1043
- ];
1044
- }
1045
- return [
1046
- 4,
1047
- sdk.getProfile()
1048
- ];
1049
- case 4:
1050
- profile = _state.sent();
1051
- setLiffProfile(profile);
1052
- saveLiffProfileToStorage(profile);
1053
- return [
1054
- 2,
1055
- profile
1056
- ];
1057
- case 5:
1058
- err = _state.sent();
1059
- console.error("取得 LIFF profile 失敗:", err);
1060
- return [
1061
- 2,
1062
- null
1063
- ];
1064
- case 6:
1065
- return [
1066
- 2
1067
- ];
1068
- }
1069
- });
1070
- }), [
1071
- liffObject,
1072
- ensureLiffInitialized,
1073
- saveLiffProfileToStorage
1074
- ]);
1075
1019
  var ensureLiffTokenValid = React.useCallback(/*#__PURE__*/ _async_to_generator(function() {
1076
1020
  var _parsedStore_data, _parsedStore_state, jwtTokenValue, jwtToken, parsedStore, isValid, _tmp, err;
1077
1021
  return _ts_generator(this, function(_state) {
@@ -1257,7 +1201,6 @@ var LiffProvider = function(param) {
1257
1201
  initializeLiff: function() {
1258
1202
  return initializeLiff(false);
1259
1203
  },
1260
- getLiffProfile: getLiffProfile,
1261
1204
  liffProfile: liffProfile,
1262
1205
  isFriendship: isFriendship,
1263
1206
  ensureLiffTokenValid: ensureLiffTokenValid,
@@ -452,14 +452,13 @@ var LiffContext = /*#__PURE__*/ createContext(undefined);
452
452
  var LiffProvider = function(param) {
453
453
  var children = param.children, liffId = param.liffId, _param_localStorageKey = param.localStorageKey, localStorageKey = _param_localStorageKey === void 0 ? "one-gobo-global-login" : _param_localStorageKey, checkTokenUrl = param.checkTokenUrl, loginUrl = param.loginUrl, accountLoginUrl = param.accountLoginUrl, memberInfoUrl = param.memberInfoUrl, _param_openInApp = param.openInApp, openInApp = _param_openInApp === void 0 ? false : _param_openInApp, _param_ignoreCheckAddFriend = param.ignoreCheckAddFriend, ignoreCheckAddFriend = _param_ignoreCheckAddFriend === void 0 ? false : _param_ignoreCheckAddFriend, _param_ignoreRoute = param.ignoreRoute, ignoreRoute = _param_ignoreRoute === void 0 ? false : _param_ignoreRoute, _param_loginByUser = param.loginByUser, loginByUser = _param_loginByUser === void 0 ? false : _param_loginByUser, _param_liffLogin = param.liffLogin, liffLogin = _param_liffLogin === void 0 ? false : _param_liffLogin, customerRedirectUrl = param.customerRedirectUrl, inviteCode = param.inviteCode, handleLoginError = param.handleLoginError;
454
454
  var _useState = _sliced_to_array(useState(null), 2), liffObject = _useState[0], setLiffObject = _useState[1];
455
- var _useState1 = _sliced_to_array(useState(false), 2), liffInitialized = _useState1[0], setLiffInitialized = _useState1[1];
456
- var _useState2 = _sliced_to_array(useState(""), 2), accessToken = _useState2[0], setAccessToken = _useState2[1];
457
- var _useState3 = _sliced_to_array(useState(null), 2), liffError = _useState3[0], setLiffError = _useState3[1];
458
- var _useState4 = _sliced_to_array(useState(null), 2), loginData = _useState4[0], setLoginData = _useState4[1];
459
- var _useState5 = _sliced_to_array(useState(null), 2), userInfo = _useState5[0], setUserInfo = _useState5[1];
460
- var _useState6 = _sliced_to_array(useState(null), 2), liffProfile = _useState6[0], setLiffProfile = _useState6[1];
461
- var _useState7 = _sliced_to_array(useState(null), 2), isFriendship = _useState7[0], setFriendship = _useState7[1];
462
- var _useState8 = _sliced_to_array(useState(null), 2), loginType = _useState8[0], setLoginType = _useState8[1];
455
+ var _useState1 = _sliced_to_array(useState(""), 2), accessToken = _useState1[0], setAccessToken = _useState1[1];
456
+ var _useState2 = _sliced_to_array(useState(null), 2), liffError = _useState2[0], setLiffError = _useState2[1];
457
+ var _useState3 = _sliced_to_array(useState(null), 2), loginData = _useState3[0], setLoginData = _useState3[1];
458
+ var _useState4 = _sliced_to_array(useState(null), 2), userInfo = _useState4[0], setUserInfo = _useState4[1];
459
+ var _useState5 = _sliced_to_array(useState(null), 2), liffProfile = _useState5[0], setLiffProfile = _useState5[1];
460
+ var _useState6 = _sliced_to_array(useState(null), 2), isFriendship = _useState6[0], setFriendship = _useState6[1];
461
+ var _useState7 = _sliced_to_array(useState(null), 2), loginType = _useState7[0], setLoginType = _useState7[1];
463
462
  // userInfo 的 localStorage key
464
463
  var userInfoStorageKey = "".concat(localStorageKey, "-userInfo");
465
464
  // liff profile 的 localStorage key
@@ -739,10 +738,9 @@ var LiffProvider = function(param) {
739
738
  ,
740
739
  11
741
740
  ]);
742
- // 確保 LIFF 已初始化(只執行一次)
743
741
  return [
744
742
  4,
745
- ensureLiffInitialized()
743
+ ensureLiffInitialized(isValid)
746
744
  ];
747
745
  case 1:
748
746
  _state.sent();
@@ -754,6 +752,9 @@ var LiffProvider = function(param) {
754
752
  imported = _state.sent();
755
753
  sdk = liffObject || imported.liff;
756
754
  setLiffObject(sdk);
755
+ if (sdk.isLoggedIn() && isValid) return [
756
+ 2
757
+ ];
757
758
  lineToken = sdk === null || sdk === void 0 ? void 0 : (_sdk_getAccessToken = sdk.getAccessToken) === null || _sdk_getAccessToken === void 0 ? void 0 : _sdk_getAccessToken.call(sdk);
758
759
  // 未登入先進行登入(呼叫 login 後立即 return,避免後續執行)
759
760
  if (!(sdk === null || sdk === void 0 ? void 0 : (_sdk_isLoggedIn = sdk.isLoggedIn) === null || _sdk_isLoggedIn === void 0 ? void 0 : _sdk_isLoggedIn.call(sdk))) {
@@ -853,76 +854,90 @@ var LiffProvider = function(param) {
853
854
  };
854
855
  }();
855
856
  // 確保 LIFF init 只執行一次且在需要時才執行
856
- var ensureLiffInitialized = useCallback(/*#__PURE__*/ _async_to_generator(function() {
857
- var customFetch, liff, originalFetch, e;
858
- return _ts_generator(this, function(_state) {
859
- switch(_state.label){
860
- case 0:
861
- if (liffInitialized) return [
862
- 2
863
- ];
864
- if (!liffId) {
865
- console.warn("liffId 未提供,跳過 liff.init()。");
857
+ var ensureLiffInitialized = useCallback(function() {
858
+ var _ref = _async_to_generator(function(isValid) {
859
+ var customFetch, liff, originalFetch, profile, e;
860
+ return _ts_generator(this, function(_state) {
861
+ switch(_state.label){
862
+ case 0:
863
+ if (!liffId) {
864
+ console.warn("liffId 未提供,跳過 liff.init()。");
865
+ return [
866
+ 2
867
+ ];
868
+ }
869
+ _state.label = 1;
870
+ case 1:
871
+ _state.trys.push([
872
+ 1,
873
+ 5,
874
+ ,
875
+ 6
876
+ ]);
877
+ customFetch = // 自訂 fetch 函數,避免每次請求都改變 URL
878
+ // eslint-disable-next-line no-inner-declarations
879
+ function customFetch(url, options) {
880
+ if (url.toString().startsWith("https://liffsdk.line-scdn.net/xlt/") && url.toString().endsWith(".json")) {
881
+ url = "".concat(url, "?ts=").concat(Math.random());
882
+ }
883
+ return originalFetch(url, options);
884
+ };
866
885
  return [
867
- 2
886
+ 4,
887
+ import('./index.esm3.js')
868
888
  ];
869
- }
870
- _state.label = 1;
871
- case 1:
872
- _state.trys.push([
873
- 1,
874
- 4,
875
- ,
876
- 5
877
- ]);
878
- customFetch = // 自訂 fetch 函數,避免每次請求都改變 URL
879
- // eslint-disable-next-line no-inner-declarations
880
- function customFetch(url, options) {
881
- if (url.toString().startsWith("https://liffsdk.line-scdn.net/xlt/") && url.toString().endsWith(".json")) {
882
- url = "".concat(url, "?ts=").concat(Math.random());
889
+ case 2:
890
+ liff = _state.sent().liff;
891
+ originalFetch = window.fetch;
892
+ window.fetch = customFetch;
893
+ if (openInApp && !(liff === null || liff === void 0 ? void 0 : liff.isInClient()) && (liff === null || liff === void 0 ? void 0 : liff.getOS()) !== "web") window.location.href = "line://app/".concat(liffId);
894
+ if (liff.isLoggedIn() && isValid) {
895
+ console.log("LIFF already initialized.");
896
+ return [
897
+ 2
898
+ ];
883
899
  }
884
- return originalFetch(url, options);
885
- };
886
- return [
887
- 4,
888
- import('./index.esm3.js')
889
- ];
890
- case 2:
891
- liff = _state.sent().liff;
892
- originalFetch = window.fetch;
893
- window.fetch = customFetch;
894
- if (openInApp && !(liff === null || liff === void 0 ? void 0 : liff.isInClient()) && (liff === null || liff === void 0 ? void 0 : liff.getOS()) !== "web") window.location.href = "line://app/".concat(liffId);
895
- return [
896
- 4,
897
- liff.init({
898
- liffId: liffId,
899
- withLoginOnExternalBrowser: false
900
- })
901
- ];
902
- case 3:
903
- _state.sent();
904
- setLiffObject(liff);
905
- setLiffInitialized(true);
906
- console.log("LIFF initialized.");
907
- return [
908
- 3,
909
- 5
910
- ];
911
- case 4:
912
- e = _state.sent();
913
- console.error("ensureLiffInitialized failed:", e);
914
- return [
915
- 3,
916
- 5
917
- ];
918
- case 5:
919
- return [
920
- 2
921
- ];
922
- }
900
+ return [
901
+ 4,
902
+ liff.init({
903
+ liffId: liffId,
904
+ withLoginOnExternalBrowser: false
905
+ })
906
+ ];
907
+ case 3:
908
+ _state.sent();
909
+ return [
910
+ 4,
911
+ liff.getProfile()
912
+ ];
913
+ case 4:
914
+ profile = _state.sent();
915
+ setLiffProfile(profile);
916
+ saveLiffProfileToStorage(profile);
917
+ setLiffObject(liff);
918
+ console.log("LIFF initialized.");
919
+ return [
920
+ 3,
921
+ 6
922
+ ];
923
+ case 5:
924
+ e = _state.sent();
925
+ console.error("ensureLiffInitialized failed:", e);
926
+ return [
927
+ 3,
928
+ 6
929
+ ];
930
+ case 6:
931
+ return [
932
+ 2
933
+ ];
934
+ }
935
+ });
923
936
  });
924
- }), [
925
- liffInitialized,
937
+ return function(isValid) {
938
+ return _ref.apply(this, arguments);
939
+ };
940
+ }(), [
926
941
  liffId,
927
942
  openInApp
928
943
  ]);
@@ -997,77 +1012,6 @@ var LiffProvider = function(param) {
997
1012
  return _ref.apply(this, arguments);
998
1013
  };
999
1014
  }();
1000
- // 取得 LIFF profile(LIFF 的會員資料,與 API 的 member 分開處理)
1001
- var getLiffProfile = useCallback(/*#__PURE__*/ _async_to_generator(function() {
1002
- var sdk, imported, profile, err;
1003
- return _ts_generator(this, function(_state) {
1004
- switch(_state.label){
1005
- case 0:
1006
- _state.trys.push([
1007
- 0,
1008
- 5,
1009
- ,
1010
- 6
1011
- ]);
1012
- // 確保 LIFF 已初始化
1013
- return [
1014
- 4,
1015
- ensureLiffInitialized()
1016
- ];
1017
- case 1:
1018
- _state.sent();
1019
- sdk = liffObject;
1020
- if (!!sdk) return [
1021
- 3,
1022
- 3
1023
- ];
1024
- return [
1025
- 4,
1026
- import('./index.esm3.js')
1027
- ];
1028
- case 2:
1029
- imported = _state.sent();
1030
- sdk = imported.liff;
1031
- setLiffObject(sdk);
1032
- _state.label = 3;
1033
- case 3:
1034
- if (!sdk || typeof sdk.isLoggedIn !== "function" || !sdk.isLoggedIn()) {
1035
- console.warn("getLiffProfile: LIFF not initialized or user not logged in");
1036
- return [
1037
- 2,
1038
- null
1039
- ];
1040
- }
1041
- return [
1042
- 4,
1043
- sdk.getProfile()
1044
- ];
1045
- case 4:
1046
- profile = _state.sent();
1047
- setLiffProfile(profile);
1048
- saveLiffProfileToStorage(profile);
1049
- return [
1050
- 2,
1051
- profile
1052
- ];
1053
- case 5:
1054
- err = _state.sent();
1055
- console.error("取得 LIFF profile 失敗:", err);
1056
- return [
1057
- 2,
1058
- null
1059
- ];
1060
- case 6:
1061
- return [
1062
- 2
1063
- ];
1064
- }
1065
- });
1066
- }), [
1067
- liffObject,
1068
- ensureLiffInitialized,
1069
- saveLiffProfileToStorage
1070
- ]);
1071
1015
  var ensureLiffTokenValid = useCallback(/*#__PURE__*/ _async_to_generator(function() {
1072
1016
  var _parsedStore_data, _parsedStore_state, jwtTokenValue, jwtToken, parsedStore, isValid, _tmp, err;
1073
1017
  return _ts_generator(this, function(_state) {
@@ -1253,7 +1197,6 @@ var LiffProvider = function(param) {
1253
1197
  initializeLiff: function() {
1254
1198
  return initializeLiff(false);
1255
1199
  },
1256
- getLiffProfile: getLiffProfile,
1257
1200
  liffProfile: liffProfile,
1258
1201
  isFriendship: isFriendship,
1259
1202
  ensureLiffTokenValid: ensureLiffTokenValid,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunggang/ui-lib",
3
- "version": "0.4.44",
3
+ "version": "0.4.46",
4
4
  "sideEffects": [
5
5
  "*.css",
6
6
  "./src/style.css",