@sunggang/ui-lib 0.4.53 → 0.4.54

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.
@@ -765,177 +765,235 @@ var LiffProvider = function(param) {
765
765
  };
766
766
  }();
767
767
  // 初始化 LIFF
768
+ var initPromiseRef = React.useRef(null);
768
769
  var initializeLiff = function() {
769
770
  var _ref = _async_to_generator(function(isValid) {
770
- var customFetch, liff, originalFetch, storedProfileExists, profile, profileErr, lineToken, redirectUri, tempFriendship, friendship, friendFlag, error, err;
771
771
  return _ts_generator(this, function(_state) {
772
- switch(_state.label){
773
- case 0:
774
- _state.trys.push([
775
- 0,
776
- 15,
777
- ,
778
- 16
779
- ]);
780
- customFetch = // 自訂 fetch 函數,避免每次請求都改變 URL
781
- // eslint-disable-next-line no-inner-declarations
782
- function customFetch(url, options) {
783
- if (url.toString().startsWith("https://liffsdk.line-scdn.net/xlt/") && url.toString().endsWith(".json")) {
784
- url = "".concat(url, "?ts=").concat(Math.random());
785
- }
786
- return originalFetch(url, options);
787
- };
788
- return [
789
- 4,
790
- Promise.resolve().then(function () { return require('./index.cjs3.js'); })
791
- ];
792
- case 1:
793
- liff = _state.sent().liff;
794
- originalFetch = window.fetch;
795
- window.fetch = customFetch;
796
- 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);
797
- return [
798
- 4,
799
- liff.init({
800
- liffId: liffId,
801
- withLoginOnExternalBrowser: false
802
- })
803
- ];
804
- case 2:
805
- _state.sent();
806
- console.log("LIFF init succeeded.");
807
- setLiffObject(liff);
808
- // 如果 localStorage 或 state 已有 profile,就跳過重複呼叫
809
- storedProfileExists = false;
810
- try {
811
- storedProfileExists = !!window.localStorage.getItem(liffUserInfoStorageKey);
812
- } catch (e) {
813
- storedProfileExists = false;
814
- }
815
- if (!(!storedProfileExists && !liffProfile)) return [
816
- 3,
817
- 7
818
- ];
819
- _state.label = 3;
820
- case 3:
821
- _state.trys.push([
822
- 3,
823
- 5,
824
- ,
825
- 6
826
- ]);
827
- return [
828
- 4,
829
- liff.getProfile()
830
- ];
831
- case 4:
832
- profile = _state.sent();
833
- setLiffProfile(profile);
834
- saveLiffUserInfoToStorage(profile);
835
- return [
836
- 3,
837
- 6
838
- ];
839
- case 5:
840
- profileErr = _state.sent();
841
- console.warn("取得 LIFF profile 失敗(非致命):", profileErr);
842
- return [
843
- 3,
844
- 6
845
- ];
846
- case 6:
847
- return [
848
- 3,
849
- 8
850
- ];
851
- case 7:
852
- // 已有快取,跳過呼叫
853
- console.log("跳過 liff.getProfile():已由 localStorage 或 state 取得 profile");
854
- _state.label = 8;
855
- case 8:
856
- lineToken = liff === null || liff === void 0 ? void 0 : liff.getAccessToken();
857
- // 未登入先進行登入
858
- if (!liff.isLoggedIn()) {
859
- redirectUri = customerRedirectUrl || "".concat(window.location.href);
860
- if (liffLogin) {
861
- liff.login({
862
- redirectUri: redirectUri
863
- });
772
+ // 如果已有執行中的 initialize promise,直接等待它
773
+ if (initPromiseRef.current) return [
774
+ 2,
775
+ initPromiseRef.current
776
+ ];
777
+ initPromiseRef.current = _async_to_generator(function() {
778
+ var customFetch, initializedFlagKey, alreadyInitialized, liffModule, e, liff, originalFetch, storedProfileExists, profile, profileErr, lineToken, redirectUri, tempFriendship, friendship, friendFlag, error, err;
779
+ return _ts_generator(this, function(_state) {
780
+ switch(_state.label){
781
+ case 0:
782
+ _state.trys.push([
783
+ 0,
784
+ 19,
785
+ 20,
786
+ 21
787
+ ]);
788
+ customFetch = // eslint-disable-next-line no-inner-declarations
789
+ function customFetch(url, options) {
790
+ if (url.toString().startsWith("https://liffsdk.line-scdn.net/xlt/") && url.toString().endsWith(".json")) {
791
+ url = "".concat(url, "?ts=").concat(Math.random());
792
+ }
793
+ return originalFetch(url, options);
794
+ };
795
+ initializedFlagKey = "".concat(localStorageKey, "-liffInitialized");
796
+ // 若之前已紀錄為 initialized,嘗試直接載入 SDK 並重用
797
+ alreadyInitialized = !!window.localStorage.getItem(initializedFlagKey);
798
+ liffModule = null;
799
+ _state.label = 1;
800
+ case 1:
801
+ _state.trys.push([
802
+ 1,
803
+ 3,
804
+ ,
805
+ 4
806
+ ]);
807
+ return [
808
+ 4,
809
+ Promise.resolve().then(function () { return require('./index.cjs3.js'); })
810
+ ];
811
+ case 2:
812
+ liffModule = _state.sent();
813
+ return [
814
+ 3,
815
+ 4
816
+ ];
817
+ case 3:
818
+ e = _state.sent();
819
+ console.warn("載入 @line/liff 失敗:", e);
820
+ throw e;
821
+ case 4:
822
+ liff = liffModule.liff;
823
+ originalFetch = window.fetch;
824
+ window.fetch = customFetch;
825
+ // 如果記錄存在,嘗試重用 SDK 物件(不一定需要再呼叫 init)
826
+ if (alreadyInitialized) {
827
+ try {
828
+ setLiffObject(liff);
829
+ console.log("Reused LIFF SDK from persisted flag.");
830
+ } catch (e) {
831
+ console.warn("重用 LIFF SDK 失敗,將重新 init", e);
832
+ }
833
+ }
834
+ if (!!alreadyInitialized) return [
835
+ 3,
836
+ 6
837
+ ];
838
+ 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);
839
+ return [
840
+ 4,
841
+ liff.init({
842
+ liffId: liffId,
843
+ withLoginOnExternalBrowser: false
844
+ })
845
+ ];
846
+ case 5:
847
+ _state.sent();
848
+ // 設定 persisted flag,避免重新整理時重複 init
849
+ try {
850
+ window.localStorage.setItem(initializedFlagKey, "1");
851
+ } catch (e) {
852
+ // ignore
853
+ }
854
+ console.log("LIFF init succeeded.");
855
+ setLiffObject(liff);
856
+ _state.label = 6;
857
+ case 6:
858
+ // 如果 localStorage 或 state 已有 profile,就跳過重複呼叫
859
+ storedProfileExists = false;
860
+ try {
861
+ storedProfileExists = !!window.localStorage.getItem(liffUserInfoStorageKey);
862
+ } catch (e) {
863
+ storedProfileExists = false;
864
+ }
865
+ if (!(!storedProfileExists && !liffProfile)) return [
866
+ 3,
867
+ 11
868
+ ];
869
+ _state.label = 7;
870
+ case 7:
871
+ _state.trys.push([
872
+ 7,
873
+ 9,
874
+ ,
875
+ 10
876
+ ]);
877
+ return [
878
+ 4,
879
+ liff.getProfile()
880
+ ];
881
+ case 8:
882
+ profile = _state.sent();
883
+ setLiffProfile(profile);
884
+ saveLiffUserInfoToStorage(profile);
885
+ return [
886
+ 3,
887
+ 10
888
+ ];
889
+ case 9:
890
+ profileErr = _state.sent();
891
+ console.warn("取得 LIFF profile 失敗(非致命):", profileErr);
892
+ return [
893
+ 3,
894
+ 10
895
+ ];
896
+ case 10:
897
+ return [
898
+ 3,
899
+ 12
900
+ ];
901
+ case 11:
902
+ console.log("跳過 liff.getProfile():已由 localStorage 或 state 取得 profile");
903
+ _state.label = 12;
904
+ case 12:
905
+ lineToken = liff === null || liff === void 0 ? void 0 : liff.getAccessToken();
906
+ // 未登入先進行登入
907
+ if (!liff.isLoggedIn()) {
908
+ redirectUri = customerRedirectUrl || "".concat(window.location.href);
909
+ if (liffLogin) {
910
+ liff.login({
911
+ redirectUri: redirectUri
912
+ });
913
+ return [
914
+ 2
915
+ ];
916
+ }
917
+ if (loginByUser || ignoreRoute) return [
918
+ 2
919
+ ];
920
+ liff.login({
921
+ redirectUri: redirectUri
922
+ });
923
+ }
924
+ tempFriendship = null;
925
+ if (!lineToken) return [
926
+ 3,
927
+ 18
928
+ ];
929
+ _state.label = 13;
930
+ case 13:
931
+ _state.trys.push([
932
+ 13,
933
+ 15,
934
+ ,
935
+ 16
936
+ ]);
937
+ return [
938
+ 4,
939
+ liff.getFriendship()
940
+ ];
941
+ case 14:
942
+ friendship = _state.sent();
943
+ friendFlag = friendship === null || friendship === void 0 ? void 0 : friendship.friendFlag;
944
+ setFriendship(friendFlag);
945
+ tempFriendship = friendFlag;
946
+ console.log("isFriendship", friendFlag);
947
+ return [
948
+ 3,
949
+ 16
950
+ ];
951
+ case 15:
952
+ error = _state.sent();
953
+ console.error("Error in liff.getFriendship():", error);
954
+ return [
955
+ 3,
956
+ 16
957
+ ];
958
+ case 16:
959
+ console.log("isValid", isValid);
960
+ if (tempFriendship && isValid) return [
961
+ 2
962
+ ];
963
+ return [
964
+ 4,
965
+ loginInit(lineToken)
966
+ ];
967
+ case 17:
968
+ _state.sent();
969
+ _state.label = 18;
970
+ case 18:
971
+ return [
972
+ 3,
973
+ 21
974
+ ];
975
+ case 19:
976
+ err = _state.sent();
977
+ setLiffError((err === null || err === void 0 ? void 0 : err.toString) ? err.toString() : String(err));
978
+ console.log("LIFF init failed.", err);
979
+ throw err;
980
+ case 20:
981
+ // 清除 reference,允許下次再次初始化(若需要)
982
+ initPromiseRef.current = null;
983
+ return [
984
+ 7
985
+ ];
986
+ case 21:
864
987
  return [
865
988
  2
866
989
  ];
867
- }
868
- if (loginByUser || ignoreRoute) return [
869
- 2
870
- ];
871
- liff.login({
872
- redirectUri: redirectUri
873
- });
874
990
  }
875
- tempFriendship = null;
876
- if (!lineToken) return [
877
- 3,
878
- 14
879
- ];
880
- _state.label = 9;
881
- case 9:
882
- _state.trys.push([
883
- 9,
884
- 11,
885
- ,
886
- 12
887
- ]);
888
- return [
889
- 4,
890
- liff.getFriendship()
891
- ];
892
- case 10:
893
- friendship = _state.sent();
894
- friendFlag = friendship === null || friendship === void 0 ? void 0 : friendship.friendFlag;
895
- setFriendship(friendFlag);
896
- tempFriendship = friendFlag;
897
- console.log("isFriendship", friendFlag);
898
- return [
899
- 3,
900
- 12
901
- ];
902
- case 11:
903
- error = _state.sent();
904
- console.error("Error in liff.getFriendship():", error);
905
- return [
906
- 3,
907
- 12
908
- ];
909
- case 12:
910
- console.log("isValid", isValid);
911
- if (tempFriendship && isValid) return [
912
- 2
913
- ];
914
- return [
915
- 4,
916
- loginInit(lineToken)
917
- ];
918
- case 13:
919
- _state.sent();
920
- _state.label = 14;
921
- case 14:
922
- return [
923
- 3,
924
- 16
925
- ];
926
- case 15:
927
- err = _state.sent();
928
- setLiffError(err.toString());
929
- console.log("LIFF init failed.", err);
930
- return [
931
- 3,
932
- 16
933
- ];
934
- case 16:
935
- return [
936
- 2
937
- ];
938
- }
991
+ });
992
+ })();
993
+ return [
994
+ 2,
995
+ initPromiseRef.current
996
+ ];
939
997
  });
940
998
  });
941
999
  return function initializeLiff(isValid) {
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { createContext, useState, useCallback, useEffect, useMemo, useContext } from 'react';
2
+ import { createContext, useState, useRef, useCallback, useEffect, useMemo, useContext } from 'react';
3
3
 
4
4
  function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
5
5
  try {
@@ -761,177 +761,235 @@ var LiffProvider = function(param) {
761
761
  };
762
762
  }();
763
763
  // 初始化 LIFF
764
+ var initPromiseRef = useRef(null);
764
765
  var initializeLiff = function() {
765
766
  var _ref = _async_to_generator(function(isValid) {
766
- var customFetch, liff, originalFetch, storedProfileExists, profile, profileErr, lineToken, redirectUri, tempFriendship, friendship, friendFlag, error, err;
767
767
  return _ts_generator(this, function(_state) {
768
- switch(_state.label){
769
- case 0:
770
- _state.trys.push([
771
- 0,
772
- 15,
773
- ,
774
- 16
775
- ]);
776
- customFetch = // 自訂 fetch 函數,避免每次請求都改變 URL
777
- // eslint-disable-next-line no-inner-declarations
778
- function customFetch(url, options) {
779
- if (url.toString().startsWith("https://liffsdk.line-scdn.net/xlt/") && url.toString().endsWith(".json")) {
780
- url = "".concat(url, "?ts=").concat(Math.random());
781
- }
782
- return originalFetch(url, options);
783
- };
784
- return [
785
- 4,
786
- import('./index.esm3.js')
787
- ];
788
- case 1:
789
- liff = _state.sent().liff;
790
- originalFetch = window.fetch;
791
- window.fetch = customFetch;
792
- 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);
793
- return [
794
- 4,
795
- liff.init({
796
- liffId: liffId,
797
- withLoginOnExternalBrowser: false
798
- })
799
- ];
800
- case 2:
801
- _state.sent();
802
- console.log("LIFF init succeeded.");
803
- setLiffObject(liff);
804
- // 如果 localStorage 或 state 已有 profile,就跳過重複呼叫
805
- storedProfileExists = false;
806
- try {
807
- storedProfileExists = !!window.localStorage.getItem(liffUserInfoStorageKey);
808
- } catch (e) {
809
- storedProfileExists = false;
810
- }
811
- if (!(!storedProfileExists && !liffProfile)) return [
812
- 3,
813
- 7
814
- ];
815
- _state.label = 3;
816
- case 3:
817
- _state.trys.push([
818
- 3,
819
- 5,
820
- ,
821
- 6
822
- ]);
823
- return [
824
- 4,
825
- liff.getProfile()
826
- ];
827
- case 4:
828
- profile = _state.sent();
829
- setLiffProfile(profile);
830
- saveLiffUserInfoToStorage(profile);
831
- return [
832
- 3,
833
- 6
834
- ];
835
- case 5:
836
- profileErr = _state.sent();
837
- console.warn("取得 LIFF profile 失敗(非致命):", profileErr);
838
- return [
839
- 3,
840
- 6
841
- ];
842
- case 6:
843
- return [
844
- 3,
845
- 8
846
- ];
847
- case 7:
848
- // 已有快取,跳過呼叫
849
- console.log("跳過 liff.getProfile():已由 localStorage 或 state 取得 profile");
850
- _state.label = 8;
851
- case 8:
852
- lineToken = liff === null || liff === void 0 ? void 0 : liff.getAccessToken();
853
- // 未登入先進行登入
854
- if (!liff.isLoggedIn()) {
855
- redirectUri = customerRedirectUrl || "".concat(window.location.href);
856
- if (liffLogin) {
857
- liff.login({
858
- redirectUri: redirectUri
859
- });
768
+ // 如果已有執行中的 initialize promise,直接等待它
769
+ if (initPromiseRef.current) return [
770
+ 2,
771
+ initPromiseRef.current
772
+ ];
773
+ initPromiseRef.current = _async_to_generator(function() {
774
+ var customFetch, initializedFlagKey, alreadyInitialized, liffModule, e, liff, originalFetch, storedProfileExists, profile, profileErr, lineToken, redirectUri, tempFriendship, friendship, friendFlag, error, err;
775
+ return _ts_generator(this, function(_state) {
776
+ switch(_state.label){
777
+ case 0:
778
+ _state.trys.push([
779
+ 0,
780
+ 19,
781
+ 20,
782
+ 21
783
+ ]);
784
+ customFetch = // eslint-disable-next-line no-inner-declarations
785
+ function customFetch(url, options) {
786
+ if (url.toString().startsWith("https://liffsdk.line-scdn.net/xlt/") && url.toString().endsWith(".json")) {
787
+ url = "".concat(url, "?ts=").concat(Math.random());
788
+ }
789
+ return originalFetch(url, options);
790
+ };
791
+ initializedFlagKey = "".concat(localStorageKey, "-liffInitialized");
792
+ // 若之前已紀錄為 initialized,嘗試直接載入 SDK 並重用
793
+ alreadyInitialized = !!window.localStorage.getItem(initializedFlagKey);
794
+ liffModule = null;
795
+ _state.label = 1;
796
+ case 1:
797
+ _state.trys.push([
798
+ 1,
799
+ 3,
800
+ ,
801
+ 4
802
+ ]);
803
+ return [
804
+ 4,
805
+ import('./index.esm3.js')
806
+ ];
807
+ case 2:
808
+ liffModule = _state.sent();
809
+ return [
810
+ 3,
811
+ 4
812
+ ];
813
+ case 3:
814
+ e = _state.sent();
815
+ console.warn("載入 @line/liff 失敗:", e);
816
+ throw e;
817
+ case 4:
818
+ liff = liffModule.liff;
819
+ originalFetch = window.fetch;
820
+ window.fetch = customFetch;
821
+ // 如果記錄存在,嘗試重用 SDK 物件(不一定需要再呼叫 init)
822
+ if (alreadyInitialized) {
823
+ try {
824
+ setLiffObject(liff);
825
+ console.log("Reused LIFF SDK from persisted flag.");
826
+ } catch (e) {
827
+ console.warn("重用 LIFF SDK 失敗,將重新 init", e);
828
+ }
829
+ }
830
+ if (!!alreadyInitialized) return [
831
+ 3,
832
+ 6
833
+ ];
834
+ 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);
835
+ return [
836
+ 4,
837
+ liff.init({
838
+ liffId: liffId,
839
+ withLoginOnExternalBrowser: false
840
+ })
841
+ ];
842
+ case 5:
843
+ _state.sent();
844
+ // 設定 persisted flag,避免重新整理時重複 init
845
+ try {
846
+ window.localStorage.setItem(initializedFlagKey, "1");
847
+ } catch (e) {
848
+ // ignore
849
+ }
850
+ console.log("LIFF init succeeded.");
851
+ setLiffObject(liff);
852
+ _state.label = 6;
853
+ case 6:
854
+ // 如果 localStorage 或 state 已有 profile,就跳過重複呼叫
855
+ storedProfileExists = false;
856
+ try {
857
+ storedProfileExists = !!window.localStorage.getItem(liffUserInfoStorageKey);
858
+ } catch (e) {
859
+ storedProfileExists = false;
860
+ }
861
+ if (!(!storedProfileExists && !liffProfile)) return [
862
+ 3,
863
+ 11
864
+ ];
865
+ _state.label = 7;
866
+ case 7:
867
+ _state.trys.push([
868
+ 7,
869
+ 9,
870
+ ,
871
+ 10
872
+ ]);
873
+ return [
874
+ 4,
875
+ liff.getProfile()
876
+ ];
877
+ case 8:
878
+ profile = _state.sent();
879
+ setLiffProfile(profile);
880
+ saveLiffUserInfoToStorage(profile);
881
+ return [
882
+ 3,
883
+ 10
884
+ ];
885
+ case 9:
886
+ profileErr = _state.sent();
887
+ console.warn("取得 LIFF profile 失敗(非致命):", profileErr);
888
+ return [
889
+ 3,
890
+ 10
891
+ ];
892
+ case 10:
893
+ return [
894
+ 3,
895
+ 12
896
+ ];
897
+ case 11:
898
+ console.log("跳過 liff.getProfile():已由 localStorage 或 state 取得 profile");
899
+ _state.label = 12;
900
+ case 12:
901
+ lineToken = liff === null || liff === void 0 ? void 0 : liff.getAccessToken();
902
+ // 未登入先進行登入
903
+ if (!liff.isLoggedIn()) {
904
+ redirectUri = customerRedirectUrl || "".concat(window.location.href);
905
+ if (liffLogin) {
906
+ liff.login({
907
+ redirectUri: redirectUri
908
+ });
909
+ return [
910
+ 2
911
+ ];
912
+ }
913
+ if (loginByUser || ignoreRoute) return [
914
+ 2
915
+ ];
916
+ liff.login({
917
+ redirectUri: redirectUri
918
+ });
919
+ }
920
+ tempFriendship = null;
921
+ if (!lineToken) return [
922
+ 3,
923
+ 18
924
+ ];
925
+ _state.label = 13;
926
+ case 13:
927
+ _state.trys.push([
928
+ 13,
929
+ 15,
930
+ ,
931
+ 16
932
+ ]);
933
+ return [
934
+ 4,
935
+ liff.getFriendship()
936
+ ];
937
+ case 14:
938
+ friendship = _state.sent();
939
+ friendFlag = friendship === null || friendship === void 0 ? void 0 : friendship.friendFlag;
940
+ setFriendship(friendFlag);
941
+ tempFriendship = friendFlag;
942
+ console.log("isFriendship", friendFlag);
943
+ return [
944
+ 3,
945
+ 16
946
+ ];
947
+ case 15:
948
+ error = _state.sent();
949
+ console.error("Error in liff.getFriendship():", error);
950
+ return [
951
+ 3,
952
+ 16
953
+ ];
954
+ case 16:
955
+ console.log("isValid", isValid);
956
+ if (tempFriendship && isValid) return [
957
+ 2
958
+ ];
959
+ return [
960
+ 4,
961
+ loginInit(lineToken)
962
+ ];
963
+ case 17:
964
+ _state.sent();
965
+ _state.label = 18;
966
+ case 18:
967
+ return [
968
+ 3,
969
+ 21
970
+ ];
971
+ case 19:
972
+ err = _state.sent();
973
+ setLiffError((err === null || err === void 0 ? void 0 : err.toString) ? err.toString() : String(err));
974
+ console.log("LIFF init failed.", err);
975
+ throw err;
976
+ case 20:
977
+ // 清除 reference,允許下次再次初始化(若需要)
978
+ initPromiseRef.current = null;
979
+ return [
980
+ 7
981
+ ];
982
+ case 21:
860
983
  return [
861
984
  2
862
985
  ];
863
- }
864
- if (loginByUser || ignoreRoute) return [
865
- 2
866
- ];
867
- liff.login({
868
- redirectUri: redirectUri
869
- });
870
986
  }
871
- tempFriendship = null;
872
- if (!lineToken) return [
873
- 3,
874
- 14
875
- ];
876
- _state.label = 9;
877
- case 9:
878
- _state.trys.push([
879
- 9,
880
- 11,
881
- ,
882
- 12
883
- ]);
884
- return [
885
- 4,
886
- liff.getFriendship()
887
- ];
888
- case 10:
889
- friendship = _state.sent();
890
- friendFlag = friendship === null || friendship === void 0 ? void 0 : friendship.friendFlag;
891
- setFriendship(friendFlag);
892
- tempFriendship = friendFlag;
893
- console.log("isFriendship", friendFlag);
894
- return [
895
- 3,
896
- 12
897
- ];
898
- case 11:
899
- error = _state.sent();
900
- console.error("Error in liff.getFriendship():", error);
901
- return [
902
- 3,
903
- 12
904
- ];
905
- case 12:
906
- console.log("isValid", isValid);
907
- if (tempFriendship && isValid) return [
908
- 2
909
- ];
910
- return [
911
- 4,
912
- loginInit(lineToken)
913
- ];
914
- case 13:
915
- _state.sent();
916
- _state.label = 14;
917
- case 14:
918
- return [
919
- 3,
920
- 16
921
- ];
922
- case 15:
923
- err = _state.sent();
924
- setLiffError(err.toString());
925
- console.log("LIFF init failed.", err);
926
- return [
927
- 3,
928
- 16
929
- ];
930
- case 16:
931
- return [
932
- 2
933
- ];
934
- }
987
+ });
988
+ })();
989
+ return [
990
+ 2,
991
+ initPromiseRef.current
992
+ ];
935
993
  });
936
994
  });
937
995
  return function initializeLiff(isValid) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunggang/ui-lib",
3
- "version": "0.4.53",
3
+ "version": "0.4.54",
4
4
  "sideEffects": [
5
5
  "*.css",
6
6
  "./src/style.css",