| @@ -14,19 +14,6 @@ export const paymentPath = window.location.href.match("localhost:3000") ? `${hos | |||||
| export const delBugMode = true; | export const delBugMode = true; | ||||
| /** | |||||
| * Testing: | |||||
| * Domain: apigw-isit.staging-eid.gov.hk | |||||
| * URL: hk.gov.iamsmart.testapp:// | |||||
| * | |||||
| * Production | |||||
| * Domain: apigw.iamsmart.gov.hk | |||||
| * URL: hk.gov.iamsmart:// | |||||
| */ | |||||
| export const iAmSmartPath = `https://apigw-isit.staging-eid.gov.hk`; | |||||
| export const iAmSmartAppPath = `hk.gov.iamsmart.testapp://`; | |||||
| export const clientId = "cf61fa7c121e4869966f69c8694b1cd2"; | |||||
| export const iAmSmartCallbackPath = () => { | export const iAmSmartCallbackPath = () => { | ||||
| let hostname = window.location.hostname; | let hostname = window.location.hostname; | ||||
| if (hostname.match("pnspsuat")) { | if (hostname.match("pnspsuat")) { | ||||
| @@ -313,6 +313,9 @@ const UserInformationCard_Individual = ({ formData, loadDataFun }) => { | |||||
| return; | return; | ||||
| } | } | ||||
| formik.setFieldValue("idDocType", newValue.type); | formik.setFieldValue("idDocType", newValue.type); | ||||
| if (newValue.type !== "HKID") { | |||||
| formik.setFieldValue("checkDigit", "") | |||||
| } | |||||
| }, | }, | ||||
| form: formik | form: formik | ||||
| })} | })} | ||||
| @@ -8,9 +8,12 @@ import { | |||||
| import Typography from '@mui/material/Typography'; | import Typography from '@mui/material/Typography'; | ||||
| import banner from 'assets/images/bg_ml.jpg'; | import banner from 'assets/images/bg_ml.jpg'; | ||||
| import { Stack } from '../../../node_modules/@mui/material/index'; | import { Stack } from '../../../node_modules/@mui/material/index'; | ||||
| import { iAmSmartPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath } from 'auth/utils' | |||||
| import { getBowserType, isAppBowser, iAmSmartCallbackPath } from 'auth/utils' | |||||
| import { IAmSmartButton } from "components/iAmSmartButton"; | import { IAmSmartButton } from "components/iAmSmartButton"; | ||||
| import * as HttpUtils from "utils/HttpUtils"; | |||||
| import { I_AM_SMART_PATH } from "utils/ApiPathConst"; | |||||
| import * as React from 'react'; | import * as React from 'react'; | ||||
| import { FormattedMessage, useIntl } from "react-intl"; | import { FormattedMessage, useIntl } from "react-intl"; | ||||
| @@ -36,30 +39,45 @@ const RegisterCustom = () => { | |||||
| const openQR = () => { | const openQR = () => { | ||||
| let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/registrycallback"; | let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/registrycallback"; | ||||
| let url = iAmSmartPath + "/api/v1/auth/getQR" | |||||
| + "?clientID=" + clientId | |||||
| + "&responseType=code" | |||||
| + "&source=" + getBowserType() | |||||
| + "&redirectURI=" + encodeURIComponent(callbackUrl) | |||||
| + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles") | |||||
| + "&lang=" + (locale === 'en' ? "en-US" : locale === 'zh-HK' ? "zh-HK" : "zh-CN") | |||||
| //+"&state=" | |||||
| + "&brokerPage=false" | |||||
| window.location.assign(url); | |||||
| HttpUtils.get({ | |||||
| url: I_AM_SMART_PATH, | |||||
| onSuccess: (responseData) => { | |||||
| let url = responseData.iAmSmartPath + "/api/v1/auth/getQR" | |||||
| + "?clientID=" + responseData.ci | |||||
| + "&responseType=code" | |||||
| + "&source=" + getBowserType() | |||||
| + "&redirectURI=" + encodeURIComponent(callbackUrl) | |||||
| + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles") | |||||
| + "&lang=" + (locale === 'en' ? "en-US" : locale === 'zh-HK' ? "zh-HK" : "zh-CN") | |||||
| //+"&state=" | |||||
| + "&brokerPage=false" | |||||
| window.location.assign(url); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| const openApp = () => { | const openApp = () => { | ||||
| //not support open app, just call QR link | |||||
| let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/registrycallback"; | let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/registrycallback"; | ||||
| let url = iAmSmartPath + "/api/v1/auth/getQR" | |||||
| + "?clientID=" + clientId | |||||
| + "&responseType=code" | |||||
| + "&source=" + getBowserType() | |||||
| + "&redirectURI=" + encodeURIComponent(callbackUrl) | |||||
| + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles") | |||||
| + "&lang=" + (locale === 'en' ? "en-US" : locale === 'zh-HK' ? "zh-HK" : "zh-CN") | |||||
| //+"&state=" | |||||
| + "&brokerPage=true" | |||||
| window.location.assign(url); | |||||
| HttpUtils.get({ | |||||
| url: I_AM_SMART_PATH, | |||||
| onSuccess: (responseData) => { | |||||
| let url = responseData.iAmSmartPath + "/api/v1/auth/getQR" | |||||
| + "?clientID=" + responseData.ci | |||||
| + "&responseType=code" | |||||
| + "&source=" + getBowserType() | |||||
| + "&redirectURI=" + encodeURIComponent(callbackUrl) | |||||
| + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles") | |||||
| + "&lang=" + (locale === 'en' ? "en-US" : locale === 'zh-HK' ? "zh-HK" : "zh-CN") | |||||
| //+"&state=" | |||||
| + "&brokerPage=false" | |||||
| window.location.assign(url); | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| return ( | return ( | ||||
| @@ -7,7 +7,11 @@ import { | |||||
| import { Link as RouterLink } from 'react-router-dom'; | import { Link as RouterLink } from 'react-router-dom'; | ||||
| import { useNavigate } from 'react-router-dom'; | import { useNavigate } from 'react-router-dom'; | ||||
| import { useForm, } from 'react-hook-form' | import { useForm, } from 'react-hook-form' | ||||
| import { iAmSmartPath, clientId, getBowserType, isAppBowser, iAmSmartCallbackPath } from 'auth/utils' | |||||
| import { getBowserType, isAppBowser, iAmSmartCallbackPath } from 'auth/utils' | |||||
| import * as HttpUtils from "utils/HttpUtils"; | |||||
| import { I_AM_SMART_PATH } from "utils/ApiPathConst"; | |||||
| //iAmSmartAppPath | //iAmSmartAppPath | ||||
| // material-ui | // material-ui | ||||
| @@ -214,16 +218,23 @@ const AuthLoginCustom = () => { | |||||
| const openQR = () => { | const openQR = () => { | ||||
| let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/authcallback"; | let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/authcallback"; | ||||
| let url = iAmSmartPath + "/api/v1/auth/getQR" | |||||
| + "?clientID=" + clientId | |||||
| + "&responseType=code" | |||||
| + "&source=" + getBowserType() | |||||
| + "&redirectURI=" + encodeURIComponent(callbackUrl) | |||||
| + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles") | |||||
| + "&lang=" + (locale === 'en' ? "en-US" : locale === 'zh-HK' ? "zh-HK" : "zh-CN") | |||||
| //+"&state=" | |||||
| + "&brokerPage=false" | |||||
| window.location = url; | |||||
| HttpUtils.get({ | |||||
| url: I_AM_SMART_PATH, | |||||
| onSuccess: (responseData) => { | |||||
| let url = responseData.iAmSmartPath + "/api/v1/auth/getQR" | |||||
| + "?clientID=" + responseData.ci | |||||
| + "&responseType=code" | |||||
| + "&source=" + getBowserType() | |||||
| + "&redirectURI=" + encodeURIComponent(callbackUrl) | |||||
| + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles") | |||||
| + "&lang=" + (locale === 'en' ? "en-US" : locale === 'zh-HK' ? "zh-HK" : "zh-CN") | |||||
| //+"&state=" | |||||
| + "&brokerPage=false" | |||||
| window.location = url; | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| const openApp = () => { | const openApp = () => { | ||||
| @@ -246,16 +257,21 @@ const AuthLoginCustom = () => { | |||||
| // window.location=url; | // window.location=url; | ||||
| let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/authcallback"; | let callbackUrl = "https://" + iAmSmartCallbackPath() + "/iamsmart/authcallback"; | ||||
| let url = iAmSmartPath + "/api/v1/auth/getQR" | |||||
| + "?clientID=" + clientId | |||||
| + "&responseType=code" | |||||
| + "&source=" + getBowserType() | |||||
| + "&redirectURI=" + encodeURIComponent(callbackUrl) | |||||
| + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles") | |||||
| + "&lang=" + (locale === 'en' ? "en-US" : locale === 'zh-HK' ? "zh-HK" : "zh-CN") | |||||
| //+"&state=" | |||||
| + "&brokerPage=true" | |||||
| window.location = url; | |||||
| HttpUtils.get({ | |||||
| url: I_AM_SMART_PATH, | |||||
| onSuccess: (responseData) => { | |||||
| let url = responseData.iAmSmartPath + "/api/v1/auth/getQR" | |||||
| + "?clientID=" + responseData.ci | |||||
| + "&responseType=code" | |||||
| + "&source=" + getBowserType() | |||||
| + "&redirectURI=" + encodeURIComponent(callbackUrl) | |||||
| + "&scope=" + encodeURIComponent("eidapi_auth eidapi_profiles") | |||||
| + "&lang=" + (locale === 'en' ? "en-US" : locale === 'zh-HK' ? "zh-HK" : "zh-CN") | |||||
| //+"&state=" | |||||
| + "&brokerPage=false" | |||||
| window.location = url; | |||||
| } | |||||
| }); | |||||
| } | } | ||||
| @@ -10,6 +10,9 @@ export const CHANGE_PASSWORD_PATH = "/user/change-password" | |||||
| export const GET_SYS_PARAMS = apiPath+'/settings'; | export const GET_SYS_PARAMS = apiPath+'/settings'; | ||||
| export const PRIVACY_POLICY_PATH = apiPath+'/privacyPolicy'; | export const PRIVACY_POLICY_PATH = apiPath+'/privacyPolicy'; | ||||
| export const I_AM_SMART_PATH = apiPath+'/smart/call/iAmSmart'; | |||||
| export const I_AM_SMART_APP_PATH = apiPath+'/smart/call/app/iAmSmart'; | |||||
| //Group Config | //Group Config | ||||
| export const GET_GROUP_LIST_PATH = apiPath+'/group'; | export const GET_GROUP_LIST_PATH = apiPath+'/group'; | ||||
| export const GET_GROUP_COMBO_PATH = '/group/combo'; | export const GET_GROUP_COMBO_PATH = '/group/combo'; | ||||