@lifesg/web-frontend-engine 2.0.0-alpha.16 → 2.0.0-alpha.17
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/chunks/{file-upload-manager.9f118208.js → file-upload-manager.2b398bb3.js} +2 -2
- package/chunks/{file-upload-manager.9f118208.js.map → file-upload-manager.2b398bb3.js.map} +1 -1
- package/chunks/{index.c97fe9cd.js → index.5717ded2.js} +2 -2
- package/chunks/{index.c97fe9cd.js.map → index.5717ded2.js.map} +1 -1
- package/chunks/{index.f7bdb097.js → index.b12f3d48.js} +6 -6
- package/chunks/{index.f7bdb097.js.map → index.b12f3d48.js.map} +1 -1
- package/chunks/{index.cffe8c57.js → index.cb4dea03.js} +2 -2
- package/chunks/{index.cffe8c57.js.map → index.cb4dea03.js.map} +1 -1
- package/chunks/{location-modal.422d3eb2.js → location-modal.196e1cc7.js} +2 -2
- package/chunks/{location-modal.422d3eb2.js.map → location-modal.196e1cc7.js.map} +1 -1
- package/cjs/chunks/{file-upload-manager.d135168d.js → file-upload-manager.a0c694e9.js} +2 -2
- package/cjs/chunks/{file-upload-manager.d135168d.js.map → file-upload-manager.a0c694e9.js.map} +1 -1
- package/cjs/chunks/{index.9a5d993e.js → index.04ef1675.js} +2 -2
- package/cjs/chunks/{index.9a5d993e.js.map → index.04ef1675.js.map} +1 -1
- package/cjs/chunks/{index.088882e6.js → index.5744c5c8.js} +2 -2
- package/cjs/chunks/{index.088882e6.js.map → index.5744c5c8.js.map} +1 -1
- package/cjs/chunks/{index.75d6b664.js → index.999467ae.js} +6 -6
- package/cjs/chunks/{index.75d6b664.js.map → index.999467ae.js.map} +1 -1
- package/cjs/chunks/{location-modal.fa5b0c93.js → location-modal.2173a102.js} +2 -2
- package/cjs/chunks/{location-modal.fa5b0c93.js.map → location-modal.2173a102.js.map} +1 -1
- package/cjs/index.js +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var t=require("react/jsx-runtime"),e=require("@lifesg/react-design-system/modal"),n=require("@lifesg/react-design-system/theme"),i=require("./index.
|
|
1
|
+
"use strict";var t=require("react/jsx-runtime"),e=require("@lifesg/react-design-system/modal"),n=require("@lifesg/react-design-system/theme"),i=require("./index.999467ae.js"),o=require("react"),r=require("styled-components");require("@lifesg/react-design-system/markup");var s=require("react-dom/server"),a=require("@lifesg/react-design-system/typography"),l=require("@lifesg/react-icons/navigation"),h=require("@lifesg/react-icons/navigation-fill"),c=require("@lifesg/react-icons/pin-fill"),u=require("@lifesg/react-design-system/card"),d=require("@lifesg/react-icons/cross"),p=require("@lifesg/react-icons/magnifier"),f=require("@lifesg/react-design-system/button");function m(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}require("@lifesg/react-design-system/alert"),require("@lifesg/react-design-system/layout"),require("@lifesg/react-design-system/box-container"),require("@lifesg/react-design-system/divider"),require("@lifesg/react-design-system/v2_media"),require("@lifesg/react-design-system/text-list"),require("@lifesg/react-design-system/popover-v2"),require("@lifesg/react-icons"),require("@lifesg/react-design-system/tab"),require("@lifesg/react-icons/plus-circle-fill"),require("@lifesg/react-design-system/button-with-icon"),require("@lifesg/react-design-system/error-display"),require("@lifesg/react-design-system/filter"),require("@lifesg/react-design-system/uneditable-section"),require("@lifesg/react-design-system/timeline"),require("@lifesg/react-design-system/form"),require("@lifesg/react-design-system/checkbox"),require("@lifesg/react-design-system/toggle"),require("@lifesg/react-design-system/file-upload"),require("@lifesg/react-design-system/icon-button"),require("@lifesg/react-icons/bin"),require("@lifesg/react-icons/eraser"),require("@lifesg/react-icons/pencil"),require("@lifesg/react-icons/pencil-stroke"),require("@lifesg/react-icons/plus"),require("@lifesg/react-icons/exclamation-triangle"),require("@lifesg/react-design-system/image-button"),require("@lifesg/react-design-system/radio-button"),require("@lifesg/react-design-system/v2_layout");var _=m(r),g=m(s);const v="https://assets.life.gov.sg/web-frontend-engine/img/common/no-network.png";var y={exports:{}};
|
|
2
2
|
/* @preserve
|
|
3
3
|
* Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
|
|
4
4
|
* (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
|
|
@@ -344,4 +344,4 @@
|
|
|
344
344
|
max-width: 16.5rem;
|
|
345
345
|
}
|
|
346
346
|
`,dt=({id:e,cachedImage:n,refreshNetwork:o})=>t.jsxs(at,{id:i.TestHelper.generateId(e,"no-internet-connectivity"),"data-testid":i.TestHelper.generateId(e,"no-internet-connectivity"),children:[t.jsx(lt,{src:n,alt:"no-connectivity"}),t.jsx(ht,{weight:"semibold",children:"No connection found"}),t.jsx(ct,{children:"Check your internet connection and try again."}),t.jsx(ut,{onClick:o,children:"Try again"})]});exports.default=({id:s="location-modal",className:a,formValues:l,showLocationModal:h,mapPanZoom:c,interactiveMapPinIconUrl:u,reverseGeoCodeEndpoint:d,convertLatLngToXYEndpoint:p,gettingCurrentLocationFetchMessage:f,mapBannerText:m,mustHavePostalCode:_,locationModalStyles:g,onClose:y,onConfirm:x,updateFormValues:b,locationListTitle:w,locationSelectionMode:L,disableSearch:P,addressFieldPlaceholder:T,searchBarIcon:M,bufferRadius:z,pinsOnlyIndicateCurrentLocation:I})=>{const[Z,B]=o.useState("double"),[O,A]=o.useState({}),[j,N]=o.useState([]),[R,D]=o.useState(!0),[H,F]=o.useState(!1),{dispatchFieldEvent:$,addFieldEventListener:W,removeFieldEventListener:q}=i.useFieldEvent(),[V,G]=o.useState(!0),[U,K]=o.useState(!1),[Y,X]=o.useState(!1),[J,Q]=o.useState(!1),[tt,et]=o.useState(),[nt,it]=o.useState(),ot=o.useRef(!0),rt=o.useContext(r.ThemeContext),at=o.useCallback(((t,e)=>{B((n=>"double"===n||e&&n!==e?n:t))}),[]),lt=o.useCallback((async()=>{F(!0);if(!!$("get-current-location",s)){const t={};try{t.payload=await i.GeoLocationHelper.getCurrentLocation()}catch(e){t.errors=e}return $("set-current-location",s,t),t.payload}}),[$,s]),ht=o.useCallback((()=>{A(l||{})}),[l]),ct=o.useCallback((()=>{ot.current=!0,y()}),[y]),ut=o.useCallback((()=>{ht(),ct()}),[ct,ht]),pt=o.useCallback((t=>{const e=i.lodash.exports.isEmpty(t?.detail)?O:t?.detail;x(e),ct()}),[ct,x,O]),ft=()=>{!$("before-hide-permission-modal",s)||K(!1)};o.useEffect((()=>{const t={"error-end":t=>{const e=t.detail?.payload?.errorType;if(e)switch(e){case"OneMapError":case"GetLocationTimeoutError":ct()}},"set-selectable-pins":t=>{const e=t.detail.pins;Array.isArray(e)?N(e):X(!0)},"confirm-location":pt,"hide-permission-modal":()=>{K(!1)},"dismiss-location-modal":ut,"trigger-get-current-location":lt};return Object.entries(t).forEach((([t,e])=>{W(t,s,e)})),()=>{Object.entries(t).forEach((([t,e])=>{q(t,s,e)}))}}),[W,lt,ut,ct,pt,s,q]),o.useEffect((()=>{if(!window)return;const t=matchMedia(`(max-width: ${n.Breakpoint["lg-max"]({theme:rt})}px)`);B(t.matches?"map":"double");const e=()=>G(!0),i=()=>G(!1),o=t=>{B(t.matches?"map":"double")};return window.addEventListener("online",e),window.addEventListener("offline",i),t.addEventListener("change",o),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",i),t.removeEventListener("change",o)}}),[]),o.useEffect((()=>{if(!h)return void B((t=>"double"!==t?"map":t));(async()=>{const{lat:t,lng:e}=l||{};t||e?ot.current&&$("get-selectable-pins",s,{lat:t,lng:e}):await lt(),ot.current=!1})()}),[$,l,lt,s,h]),o.useEffect((()=>{i.lodash.exports.isEmpty(O)||at("map","search")}),[O,H,at]),o.useEffect((()=>{A(l||{})}),[l]);return t.jsxs(t.Fragment,{children:[t.jsx(E,{src:v,alt:"no internet connectivity"}),t.jsx(e.Modal,{id:i.TestHelper.generateId(s,"modal",h?"show":"hide"),className:`${a}-location-modal`,show:h,children:t.jsx(k,{id:i.TestHelper.generateId(s,"modal-box"),className:`${a}-modal-box`,showCloseButton:!1,locationModalStyles:g,children:V?t.jsxs(t.Fragment,{children:[t.jsx(st,{id:s,className:a,onCancel:ut,onConfirm:()=>{!$("click-confirm-location",s,O)||pt()},updateFormValues:b,gettingCurrentLocation:H,panelInputMode:Z,selectedAddressInfo:O,mapPickedLatLng:tt,formValues:l,onChangeSelectedAddressInfo:A,handleApiErrors:t=>{const e=(e,n)=>{!$("error",s,{payload:{errorType:e},errors:t})||n()};F(!1),t instanceof i.OneMapError?e("OneMapError",(()=>{ht(),X(!0)})):(D(!1),t instanceof i.GeolocationPositionErrorWrapper&&t?.code?.toString()===GeolocationPositionError.TIMEOUT.toString()?e("GetLocationTimeoutError",(()=>{Q(!0)})):e("GetLocationError",(()=>{K(!0)})))},onGetLocationCallback:(t,e)=>{F(!1),D(!0),it({lat:t,lng:e})},setSinglePanelMode:at,showLocationModal:h,reverseGeoCodeEndpoint:d,convertLatLngToXYEndpoint:p,gettingCurrentLocationFetchMessage:f,mustHavePostalCode:_,locationListTitle:w,restrictLocationSelection:"pins-only"===L,selectablePins:j,disableSearch:P,addressFieldPlaceholder:T,searchBarIcon:M,bufferRadius:z}),t.jsx(C,{id:s,className:a,panelInputMode:Z,locationAvailable:R,gettingCurrentLocation:H,showLocationModal:h,selectedLocationCoord:{lat:O.lat,lng:O.lng},getCurrentLocation:lt,onMapCenterChange:t=>{et(t)},interactiveMapPinIconUrl:u,mapPanZoom:c,mapBannerText:m,disableSelectionFromMap:"pins-only"===L,disableSelectedLocationMarker:"pins-only"===L,selectablePins:j,pinsOnlyIndicateCurrentLocation:I&&"pins-only"===L,currentLocation:nt})]}):t.jsx(dt,{id:s,cachedImage:v,refreshNetwork:()=>{try{navigator.onLine&&G(!0)}catch(t){}}})})}),(()=>{if(V&&h)return Y?t.jsx(i.Prompt,{id:i.TestHelper.generateId(s,"onemap-error"),"data-testid":i.TestHelper.generateId(s,"onemap-error"),title:"Map not available",size:"large",show:!0,image:t.jsx(S,{src:"https://assets.life.gov.sg/web-frontend-engine/img/common/error.svg"}),description:t.jsxs(i.Description,{weight:"regular",children:["Sorry, there was a problem with the map. You’ll not be able to enter the location right now. Please try again later.",t.jsx("br",{}),t.jsx("br",{}),"Do note that you’ll not be able to submit your report without entering the location."]}),buttons:[{id:"ok",title:"OK",onClick:()=>{X(!1),ct()}}]}):U?t.jsx(i.Prompt,{id:i.TestHelper.generateId(s,"get-location-error"),"data-testid":i.TestHelper.generateId(s,"get-location-error"),title:"Enable location settings",size:"large",show:!0,description:"We need your permission to determine your location. Enable location access in your browser and device settings, or enter your location manually.",buttons:[{id:"ok",title:"OK",onClick:ft}]}):J?t.jsx(i.Prompt,{id:i.TestHelper.generateId(s,"get-location-timeout-error"),"data-testid":i.TestHelper.generateId(s,"get-location-timeout-error"),title:"Something went wrong",size:"large",show:!0,image:t.jsx(S,{src:"https://assets.life.gov.sg/web-frontend-engine/img/icons/get-location-timeout.svg"}),description:t.jsx(i.Description,{weight:"regular",children:"It’s taking longer than expected to retrieve your location. Please exit the map and try again."}),buttons:[{id:"ok",title:"OK",onClick:()=>{Q(!1),ct()}}]}):void 0})()]})};
|
|
347
|
-
//# sourceMappingURL=location-modal.
|
|
347
|
+
//# sourceMappingURL=location-modal.2173a102.js.map
|