@lifesg/web-frontend-engine 1.19.14 → 1.19.15
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.88131e38.js → file-upload-manager.1786802e.js} +2 -2
- package/chunks/{file-upload-manager.88131e38.js.map → file-upload-manager.1786802e.js.map} +1 -1
- package/chunks/{index.5a6b29eb.js → index.54c2add7.js} +2 -2
- package/chunks/{index.5a6b29eb.js.map → index.54c2add7.js.map} +1 -1
- package/chunks/{index.fc8f504e.js → index.a88ac40b.js} +5 -5
- package/chunks/{index.fc8f504e.js.map → index.a88ac40b.js.map} +1 -1
- package/chunks/{index.4b4ecdb7.js → index.b9888bc5.js} +2 -2
- package/chunks/{index.4b4ecdb7.js.map → index.b9888bc5.js.map} +1 -1
- package/chunks/{location-modal.ddb76a07.js → location-modal.53039680.js} +2 -2
- package/chunks/{location-modal.ddb76a07.js.map → location-modal.53039680.js.map} +1 -1
- package/cjs/chunks/{file-upload-manager.981ed57b.js → file-upload-manager.8b3a773b.js} +2 -2
- package/cjs/chunks/{file-upload-manager.981ed57b.js.map → file-upload-manager.8b3a773b.js.map} +1 -1
- package/cjs/chunks/{index.e35c6aea.js → index.b063ce55.js} +5 -5
- package/cjs/chunks/{index.e35c6aea.js.map → index.b063ce55.js.map} +1 -1
- package/cjs/chunks/{index.aa390365.js → index.ca424cf5.js} +2 -2
- package/cjs/chunks/{index.aa390365.js.map → index.ca424cf5.js.map} +1 -1
- package/cjs/chunks/{index.71a851b1.js → index.d42f693a.js} +2 -2
- package/cjs/chunks/{index.71a851b1.js.map → index.d42f693a.js.map} +1 -1
- package/cjs/chunks/{location-modal.d4929e93.js → location-modal.f9df87bc.js} +2 -2
- package/cjs/chunks/{location-modal.d4929e93.js.map → location-modal.f9df87bc.js.map} +1 -1
- package/cjs/index.js +1 -1
- package/index.js +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var t=require("react/jsx-runtime"),e=require("@lifesg/react-design-system"),i=require("./index.
|
|
1
|
+
"use strict";var t=require("react/jsx-runtime"),e=require("@lifesg/react-design-system"),i=require("./index.b063ce55.js"),n=require("react"),o=require("@lifesg/react-design-system/text");require("@lifesg/react-design-system/markup");var r=require("react-dom/server"),s=require("@lifesg/react-design-system/media"),a=require("@lifesg/react-design-system/modal"),l=require("styled-components"),h=require("@lifesg/react-icons/navigation"),c=require("@lifesg/react-icons/navigation-fill"),u=require("@lifesg/react-icons/pin-fill"),d=require("@lifesg/react-design-system/color"),p=require("@lifesg/react-icons/cross"),f=require("@lifesg/react-icons/magnifier"),m=require("@lifesg/react-design-system/button");function _(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/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/toggle"),require("@lifesg/react-design-system/checkbox"),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/design-token"),require("@lifesg/react-design-system/image-button"),require("@lifesg/react-design-system/radio-button");var g=_(r),v=_(l);const y="https://assets.life.gov.sg/web-frontend-engine/img/common/no-network.png";var x={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
|
|
@@ -342,4 +342,4 @@
|
|
|
342
342
|
max-width: 16.5rem;
|
|
343
343
|
}
|
|
344
344
|
`,pt=({id:e,cachedImage:n,refreshNetwork:o})=>t.jsxs(lt,{id:i.TestHelper.generateId(e,"no-internet-connectivity"),"data-testid":i.TestHelper.generateId(e,"no-internet-connectivity"),children:[t.jsx(ht,{src:n,alt:"no-connectivity"}),t.jsx(ct,{weight:"semibold",children:"No connection found"}),t.jsx(ut,{children:"Check your internet connection and try again."}),t.jsx(dt,{onClick:o,children:"Try again"})]});exports.default=({id:o="location-modal",className:r,formValues:s,showLocationModal:a,mapPanZoom:l,interactiveMapPinIconUrl:h,reverseGeoCodeEndpoint:c,convertLatLngToXYEndpoint:u,gettingCurrentLocationFetchMessage:d,mapBannerText:p,mustHavePostalCode:f,locationModalStyles:m,onClose:_,onConfirm:g,updateFormValues:v,locationListTitle:x,locationSelectionMode:b,disableSearch:w,addressFieldPlaceholder:L,searchBarIcon:P,bufferRadius:T})=>{const[M,z]=n.useState("double"),[k,Z]=n.useState({}),[A,O]=n.useState([]),[B,j]=n.useState(!0),[N,R]=n.useState(!1),{dispatchFieldEvent:D,addFieldEventListener:H,removeFieldEventListener:F}=i.useFieldEvent(),[W,q]=n.useState(!0),[$,V]=n.useState(!1),[G,U]=n.useState(!1),[K,Y]=n.useState(!1),[X,J]=n.useState(),Q=n.useRef(!0),tt=n.useCallback(((t,e)=>{z((i=>"double"===i||e&&i!==e?i:t))}),[]),et=n.useCallback((async()=>{R(!0);if(!!D("get-current-location",o)){const t={};try{t.payload=await i.GeoLocationHelper.getCurrentLocation()}catch(e){t.errors=e}return D("set-current-location",o,t),t.payload}}),[D,o]),it=n.useCallback((()=>{Z(s||{})}),[s]),nt=n.useCallback((()=>{Q.current=!0,_()}),[_]),ot=n.useCallback((()=>{it(),nt()}),[nt,it]),rt=n.useCallback((t=>{const e=i.lodash.exports.isEmpty(t?.detail)?k:t?.detail;g(e),nt()}),[nt,g,k]),st=()=>{!D("before-hide-permission-modal",o)||V(!1)};n.useEffect((()=>{const t={"error-end":t=>{const e=t.detail?.payload?.errorType;if(e)switch(e){case"OneMapError":case"GetLocationTimeoutError":nt()}},"set-selectable-pins":t=>{const e=t.detail.pins;Array.isArray(e)?O(e):U(!0)},"confirm-location":rt,"hide-permission-modal":()=>{V(!1)},"dismiss-location-modal":ot,"trigger-get-current-location":et};return Object.entries(t).forEach((([t,e])=>{H(t,o,e)})),()=>{Object.entries(t).forEach((([t,e])=>{F(t,o,e)}))}}),[H,et,ot,nt,rt,o,F]),n.useEffect((()=>{if(!window)return;const t=matchMedia(`(max-width: ${e.MediaWidths.tablet}px)`);z(t.matches?"map":"double");const i=()=>q(!0),n=()=>q(!1),o=t=>{z(t.matches?"map":"double")};return window.addEventListener("online",i),window.addEventListener("offline",n),t.addEventListener("change",o),()=>{window.removeEventListener("online",i),window.removeEventListener("offline",n),t.removeEventListener("change",o)}}),[]),n.useEffect((()=>{if(!a)return void z((t=>"double"!==t?"map":t));(async()=>{const{lat:t,lng:e}=s||{};t||e?Q.current&&D("get-selectable-pins",o,{lat:t,lng:e}):await et(),Q.current=!1})()}),[D,s,et,o,a]),n.useEffect((()=>{i.lodash.exports.isEmpty(k)||tt("map","search")}),[k,N,tt]),n.useEffect((()=>{Z(s||{})}),[s]);return t.jsxs(t.Fragment,{children:[t.jsx(I,{src:y,alt:"no internet connectivity"}),t.jsx(e.Modal,{id:i.TestHelper.generateId(o,"modal",a?"show":"hide"),className:`${r}-location-modal`,show:a,children:t.jsx(C,{id:i.TestHelper.generateId(o,"modal-box"),className:`${r}-modal-box`,showCloseButton:!1,locationModalStyles:m,children:W?t.jsxs(t.Fragment,{children:[t.jsx(at,{id:o,className:r,onCancel:ot,onConfirm:()=>{!D("click-confirm-location",o,k)||rt()},updateFormValues:v,gettingCurrentLocation:N,panelInputMode:M,selectedAddressInfo:k,mapPickedLatLng:X,formValues:s,onChangeSelectedAddressInfo:Z,handleApiErrors:t=>{const e=(e,i)=>{!D("error",o,{payload:{errorType:e},errors:t})||i()};R(!1),t instanceof i.OneMapError?e("OneMapError",(()=>{it(),U(!0)})):(j(!1),t instanceof i.GeolocationPositionErrorWrapper&&t?.code?.toString()===GeolocationPositionError.TIMEOUT.toString()?e("GetLocationTimeoutError",(()=>{Y(!0)})):e("GetLocationError",(()=>{V(!0)})))},onGetLocationCallback:()=>{R(!1),j(!0)},setSinglePanelMode:tt,showLocationModal:a,reverseGeoCodeEndpoint:c,convertLatLngToXYEndpoint:u,gettingCurrentLocationFetchMessage:d,mustHavePostalCode:f,locationListTitle:x,restrictLocationSelection:"pins-only"===b,selectablePins:A,disableSearch:w,addressFieldPlaceholder:L,searchBarIcon:P,bufferRadius:T}),t.jsx(S,{id:o,className:r,panelInputMode:M,locationAvailable:B,gettingCurrentLocation:N,showLocationModal:a,selectedLocationCoord:{lat:k.lat,lng:k.lng},getCurrentLocation:et,onMapCenterChange:t=>{J(t)},interactiveMapPinIconUrl:h,mapPanZoom:l,mapBannerText:p,disableSelectionFromMap:"pins-only"===b,disableCurrLocationMarker:"pins-only"===b,selectablePins:A})]}):t.jsx(pt,{id:o,cachedImage:y,refreshNetwork:()=>{try{navigator.onLine&&q(!0)}catch(t){}}})})}),(()=>{if(W&&a)return G?t.jsx(i.Prompt,{id:i.TestHelper.generateId(o,"onemap-error"),"data-testid":i.TestHelper.generateId(o,"onemap-error"),title:"Map not available",size:"large",show:!0,image:t.jsx(E,{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:()=>{U(!1),nt()}}]}):$?t.jsx(i.Prompt,{id:i.TestHelper.generateId(o,"get-location-error"),"data-testid":i.TestHelper.generateId(o,"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:st}]}):K?t.jsx(i.Prompt,{id:i.TestHelper.generateId(o,"get-location-timeout-error"),"data-testid":i.TestHelper.generateId(o,"get-location-timeout-error"),title:"Something went wrong",size:"large",show:!0,image:t.jsx(E,{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:()=>{Y(!1),nt()}}]}):void 0})()]})};
|
|
345
|
-
//# sourceMappingURL=location-modal.
|
|
345
|
+
//# sourceMappingURL=location-modal.f9df87bc.js.map
|