@sunggang/ui-lib 0.4.56 → 0.4.57

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.
@@ -463,7 +463,6 @@ var LiffProvider = function(param) {
463
463
  var _useState5 = _sliced_to_array(React.useState(null), 2), liffProfile = _useState5[0], setLiffProfile = _useState5[1];
464
464
  var _useState6 = _sliced_to_array(React.useState(null), 2), isFriendship = _useState6[0], setFriendship = _useState6[1];
465
465
  var _useState7 = _sliced_to_array(React.useState(null), 2), loginType = _useState7[0], setLoginType = _useState7[1];
466
- var isProcessingLiffCallback = React.useRef(false);
467
466
  // userInfo 的 localStorage key
468
467
  var userInfoStorageKey = "".concat(localStorageKey, "-userInfo");
469
468
  // liff profile 的 localStorage key
@@ -768,7 +767,7 @@ var LiffProvider = function(param) {
768
767
  // 初始化 LIFF
769
768
  var initializeLiff = function() {
770
769
  var _ref = _async_to_generator(function(isValid) {
771
- var customFetch, liff, urlParams, hasLiffParams, originalFetch, storedProfileExists, profile, profileErr, lineToken, redirectUri, tempFriendship, friendship, friendFlag, error, err;
770
+ var customFetch, liff, originalFetch, storedProfileExists, profile, profileErr, lineToken, redirectUri, tempFriendship, friendship, friendFlag, error, err;
772
771
  return _ts_generator(this, function(_state) {
773
772
  switch(_state.label){
774
773
  case 0:
@@ -792,17 +791,9 @@ var LiffProvider = function(param) {
792
791
  ];
793
792
  case 1:
794
793
  liff = _state.sent().liff;
795
- urlParams = new URLSearchParams(window.location.search);
796
- hasLiffParams = urlParams.has("liffClientId") || urlParams.has("liffRedirectUri");
797
794
  originalFetch = window.fetch;
798
795
  window.fetch = customFetch;
799
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);
800
- if (hasLiffParams || isProcessingLiffCallback.current) {
801
- isProcessingLiffCallback.current = true;
802
- return [
803
- 2
804
- ];
805
- }
806
797
  return [
807
798
  4,
808
799
  liff.init({
@@ -813,7 +804,6 @@ var LiffProvider = function(param) {
813
804
  case 2:
814
805
  _state.sent();
815
806
  console.log("LIFF init succeeded.");
816
- isProcessingLiffCallback.current = true;
817
807
  setLiffObject(liff);
818
808
  // 如果 localStorage 或 state 已有 profile,就跳過重複呼叫
819
809
  storedProfileExists = false;
@@ -821,7 +811,6 @@ var LiffProvider = function(param) {
821
811
  storedProfileExists = !!window.localStorage.getItem(liffUserInfoStorageKey);
822
812
  } catch (e) {
823
813
  storedProfileExists = false;
824
- isProcessingLiffCallback.current = false;
825
814
  }
826
815
  if (!(!storedProfileExists && !liffProfile)) return [
827
816
  3,
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { createContext, useState, useRef, useCallback, useEffect, useMemo, useContext } from 'react';
2
+ import { createContext, useState, useCallback, useEffect, useMemo, useContext } from 'react';
3
3
 
4
4
  function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
5
5
  try {
@@ -459,7 +459,6 @@ var LiffProvider = function(param) {
459
459
  var _useState5 = _sliced_to_array(useState(null), 2), liffProfile = _useState5[0], setLiffProfile = _useState5[1];
460
460
  var _useState6 = _sliced_to_array(useState(null), 2), isFriendship = _useState6[0], setFriendship = _useState6[1];
461
461
  var _useState7 = _sliced_to_array(useState(null), 2), loginType = _useState7[0], setLoginType = _useState7[1];
462
- var isProcessingLiffCallback = useRef(false);
463
462
  // userInfo 的 localStorage key
464
463
  var userInfoStorageKey = "".concat(localStorageKey, "-userInfo");
465
464
  // liff profile 的 localStorage key
@@ -764,7 +763,7 @@ var LiffProvider = function(param) {
764
763
  // 初始化 LIFF
765
764
  var initializeLiff = function() {
766
765
  var _ref = _async_to_generator(function(isValid) {
767
- var customFetch, liff, urlParams, hasLiffParams, originalFetch, storedProfileExists, profile, profileErr, lineToken, redirectUri, tempFriendship, friendship, friendFlag, error, err;
766
+ var customFetch, liff, originalFetch, storedProfileExists, profile, profileErr, lineToken, redirectUri, tempFriendship, friendship, friendFlag, error, err;
768
767
  return _ts_generator(this, function(_state) {
769
768
  switch(_state.label){
770
769
  case 0:
@@ -788,17 +787,9 @@ var LiffProvider = function(param) {
788
787
  ];
789
788
  case 1:
790
789
  liff = _state.sent().liff;
791
- urlParams = new URLSearchParams(window.location.search);
792
- hasLiffParams = urlParams.has("liffClientId") || urlParams.has("liffRedirectUri");
793
790
  originalFetch = window.fetch;
794
791
  window.fetch = customFetch;
795
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);
796
- if (hasLiffParams || isProcessingLiffCallback.current) {
797
- isProcessingLiffCallback.current = true;
798
- return [
799
- 2
800
- ];
801
- }
802
793
  return [
803
794
  4,
804
795
  liff.init({
@@ -809,7 +800,6 @@ var LiffProvider = function(param) {
809
800
  case 2:
810
801
  _state.sent();
811
802
  console.log("LIFF init succeeded.");
812
- isProcessingLiffCallback.current = true;
813
803
  setLiffObject(liff);
814
804
  // 如果 localStorage 或 state 已有 profile,就跳過重複呼叫
815
805
  storedProfileExists = false;
@@ -817,7 +807,6 @@ var LiffProvider = function(param) {
817
807
  storedProfileExists = !!window.localStorage.getItem(liffUserInfoStorageKey);
818
808
  } catch (e) {
819
809
  storedProfileExists = false;
820
- isProcessingLiffCallback.current = false;
821
810
  }
822
811
  if (!(!storedProfileExists && !liffProfile)) return [
823
812
  3,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sunggang/ui-lib",
3
- "version": "0.4.56",
3
+ "version": "0.4.57",
4
4
  "sideEffects": [
5
5
  "*.css",
6
6
  "./src/style.css",