@sunggang/ui-lib 0.3.41 → 0.3.43
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/index.esm2.js +12 -4
- package/package.json +1 -1
- package/src/lib/Provider/LiffProvider.d.ts +2 -1
package/index.esm2.js
CHANGED
|
@@ -78388,7 +78388,7 @@ function _ts_generator(thisArg, body) {
|
|
|
78388
78388
|
}
|
|
78389
78389
|
var LiffContext = /*#__PURE__*/ createContext(undefined);
|
|
78390
78390
|
var LiffProvider = function(param) {
|
|
78391
|
-
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, customerRedirectUrl = param.customerRedirectUrl, inviteCode = param.inviteCode, handleLoginError = param.handleLoginError;
|
|
78391
|
+
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;
|
|
78392
78392
|
var _useState = _sliced_to_array(useState(null), 2), liffObject = _useState[0], setLiffObject = _useState[1];
|
|
78393
78393
|
var _useState1 = _sliced_to_array(useState(""), 2), accessToken = _useState1[0], setAccessToken = _useState1[1];
|
|
78394
78394
|
var _useState2 = _sliced_to_array(useState(null), 2), liffError = _useState2[0], setLiffError = _useState2[1];
|
|
@@ -78616,6 +78616,14 @@ var LiffProvider = function(param) {
|
|
|
78616
78616
|
// 未登入先進行登入
|
|
78617
78617
|
if (!liff.isLoggedIn()) {
|
|
78618
78618
|
redirectUri = customerRedirectUrl || "".concat(window.location.href);
|
|
78619
|
+
if (liffLogin) {
|
|
78620
|
+
liff.login({
|
|
78621
|
+
redirectUri: redirectUri
|
|
78622
|
+
});
|
|
78623
|
+
return [
|
|
78624
|
+
2
|
|
78625
|
+
];
|
|
78626
|
+
}
|
|
78619
78627
|
if (loginByUser || ignoreRoute) return [
|
|
78620
78628
|
2
|
|
78621
78629
|
];
|
|
@@ -78695,7 +78703,7 @@ var LiffProvider = function(param) {
|
|
|
78695
78703
|
}();
|
|
78696
78704
|
var accountLogin = function() {
|
|
78697
78705
|
var _ref = _async_to_generator(function(username, password) {
|
|
78698
|
-
var response,
|
|
78706
|
+
var response, token, tokenType, finalToken, err;
|
|
78699
78707
|
return _ts_generator(this, function(_state) {
|
|
78700
78708
|
switch(_state.label){
|
|
78701
78709
|
case 0:
|
|
@@ -78724,8 +78732,8 @@ var LiffProvider = function(param) {
|
|
|
78724
78732
|
3,
|
|
78725
78733
|
3
|
|
78726
78734
|
];
|
|
78727
|
-
token = response === null || response === void 0 ? void 0 :
|
|
78728
|
-
tokenType = response === null || response === void 0 ? void 0 :
|
|
78735
|
+
token = response === null || response === void 0 ? void 0 : response.access_token;
|
|
78736
|
+
tokenType = response === null || response === void 0 ? void 0 : response.token_type;
|
|
78729
78737
|
finalToken = "".concat(tokenType, " ").concat(token);
|
|
78730
78738
|
setAccessToken(finalToken);
|
|
78731
78739
|
setLoginType("account");
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@ type LiffContextType = {
|
|
|
12
12
|
accountLogin: (username: string, password: string) => Promise<void>;
|
|
13
13
|
};
|
|
14
14
|
export declare const LiffContext: React.Context<LiffContextType | undefined>;
|
|
15
|
-
export declare const LiffProvider: ({ children, liffId, localStorageKey, checkTokenUrl, loginUrl, accountLoginUrl, memberInfoUrl, openInApp, ignoreCheckAddFriend, ignoreRoute, loginByUser, customerRedirectUrl, inviteCode, handleLoginError, }: {
|
|
15
|
+
export declare const LiffProvider: ({ children, liffId, localStorageKey, checkTokenUrl, loginUrl, accountLoginUrl, memberInfoUrl, openInApp, ignoreCheckAddFriend, ignoreRoute, loginByUser, liffLogin, customerRedirectUrl, inviteCode, handleLoginError, }: {
|
|
16
16
|
children: React.ReactNode;
|
|
17
17
|
liffId: string;
|
|
18
18
|
localStorageKey: string;
|
|
@@ -24,6 +24,7 @@ export declare const LiffProvider: ({ children, liffId, localStorageKey, checkTo
|
|
|
24
24
|
ignoreCheckAddFriend?: boolean | undefined;
|
|
25
25
|
ignoreRoute?: boolean | undefined;
|
|
26
26
|
loginByUser?: boolean | undefined;
|
|
27
|
+
liffLogin?: boolean | undefined;
|
|
27
28
|
customerRedirectUrl?: string | undefined;
|
|
28
29
|
inviteCode?: string | undefined;
|
|
29
30
|
handleLoginError?: (() => void) | undefined;
|