@lifesg/web-frontend-engine 1.19.18 → 1.19.19
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.58d10a8b.js → file-upload-manager.ea8e699a.js} +2 -2
- package/chunks/file-upload-manager.ea8e699a.js.map +1 -0
- package/chunks/{index.2a117e92.js → index.2eea32e5.js} +6 -6
- package/chunks/{index.2a117e92.js.map → index.2eea32e5.js.map} +1 -1
- package/chunks/{index.e11ec601.js → index.35f47b02.js} +2 -2
- package/chunks/{index.e11ec601.js.map → index.35f47b02.js.map} +1 -1
- package/chunks/{index.3396b1bb.js → index.3ad3ddcb.js} +2 -2
- package/chunks/{index.3396b1bb.js.map → index.3ad3ddcb.js.map} +1 -1
- package/chunks/{location-modal.559a916a.js → location-modal.f2d21ab1.js} +2 -2
- package/chunks/{location-modal.559a916a.js.map → location-modal.f2d21ab1.js.map} +1 -1
- package/cjs/chunks/file-upload-manager.037bf56f.js +2 -0
- package/cjs/chunks/file-upload-manager.037bf56f.js.map +1 -0
- package/cjs/chunks/{index.f8611425.js → index.1502ccf3.js} +2 -2
- package/cjs/chunks/{index.f8611425.js.map → index.1502ccf3.js.map} +1 -1
- package/cjs/chunks/{index.62020cb0.js → index.71069a70.js} +6 -6
- package/cjs/chunks/{index.62020cb0.js.map → index.71069a70.js.map} +1 -1
- package/cjs/chunks/{index.252a45d0.js → index.ef5ba9a2.js} +2 -2
- package/cjs/chunks/{index.252a45d0.js.map → index.ef5ba9a2.js.map} +1 -1
- package/cjs/chunks/{location-modal.17dc94b3.js → location-modal.c73280bf.js} +2 -2
- package/cjs/chunks/{location-modal.17dc94b3.js.map → location-modal.c73280bf.js.map} +1 -1
- package/cjs/index.js +1 -1
- package/components/shared/error-messages.d.ts +1 -0
- package/context-providers/yup/types.d.ts +8 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/chunks/file-upload-manager.58d10a8b.js.map +0 -1
- package/cjs/chunks/file-upload-manager.3328a5eb.js +0 -2
- package/cjs/chunks/file-upload-manager.3328a5eb.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as t,jsxs as e,Fragment as n}from"react/jsx-runtime";import{Card as i,MediaWidths as o,Color as r,BaseTheme as s,MediaQuery as a,Text as l,Button as h,Modal as c}from"@lifesg/react-design-system";import{h as u,b as d,L as p,T as m,O as f,i as _,j as g,G as v,l as y,S as x,P as b,k as w,D as P}from"./index.
|
|
1
|
+
import{jsx as t,jsxs as e,Fragment as n}from"react/jsx-runtime";import{Card as i,MediaWidths as o,Color as r,BaseTheme as s,MediaQuery as a,Text as l,Button as h,Modal as c}from"@lifesg/react-design-system";import{h as u,b as d,L as p,T as m,O as f,i as _,j as g,G as v,l as y,S as x,P as b,k as w,D as P}from"./index.2eea32e5.js";import{useRef as T,useEffect as M,useState as z,useCallback as k}from"react";import{Text as C}from"@lifesg/react-design-system/text";import"@lifesg/react-design-system/markup";import S from"react-dom/server";import{MediaQuery as E,MediaWidths as I}from"@lifesg/react-design-system/media";import{Modal as Z}from"@lifesg/react-design-system/modal";import A,{useTheme as O,keyframes as B}from"styled-components";import{NavigationIcon as N}from"@lifesg/react-icons/navigation";import{NavigationFillIcon as R}from"@lifesg/react-icons/navigation-fill";import{PinFillIcon as D}from"@lifesg/react-icons/pin-fill";import{Color as j}from"@lifesg/react-design-system/color";import{CrossIcon as F}from"@lifesg/react-icons/cross";import{MagnifierIcon as W}from"@lifesg/react-icons/magnifier";import{Button as H}from"@lifesg/react-design-system/button";import"@lifesg/react-design-system/alert";import"@lifesg/react-design-system/layout";import"@lifesg/react-design-system/box-container";import"@lifesg/react-design-system/divider";import"@lifesg/react-design-system/text-list";import"@lifesg/react-design-system/popover-v2";import"@lifesg/react-icons";import"@lifesg/react-design-system/tab";import"@lifesg/react-icons/plus-circle-fill";import"@lifesg/react-design-system/button-with-icon";import"@lifesg/react-design-system/error-display";import"@lifesg/react-design-system/filter";import"@lifesg/react-design-system/uneditable-section";import"@lifesg/react-design-system/timeline";import"@lifesg/react-design-system/form";import"@lifesg/react-design-system/toggle";import"@lifesg/react-design-system/checkbox";import"@lifesg/react-design-system/file-upload";import"@lifesg/react-design-system/icon-button";import"@lifesg/react-icons/bin";import"@lifesg/react-icons/eraser";import"@lifesg/react-icons/pencil";import"@lifesg/react-icons/pencil-stroke";import"@lifesg/react-icons/plus";import"@lifesg/react-icons/exclamation-triangle";import"@lifesg/react-design-system/design-token";import"@lifesg/react-design-system/image-button";import"@lifesg/react-design-system/radio-button";const $="https://assets.life.gov.sg/web-frontend-engine/img/common/no-network.png";var V={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
|
|
@@ -343,4 +343,4 @@ import{jsx as t,jsxs as e,Fragment as n}from"react/jsx-runtime";import{Card as i
|
|
|
343
343
|
max-width: 16.5rem;
|
|
344
344
|
}
|
|
345
345
|
`,Nt=({id:n,cachedImage:i,refreshNetwork:o})=>e(It,{id:m.generateId(n,"no-internet-connectivity"),"data-testid":m.generateId(n,"no-internet-connectivity"),children:[t(Zt,{src:i,alt:"no-connectivity"}),t(At,{weight:"semibold",children:"No connection found"}),t(Ot,{children:"Check your internet connection and try again."}),t(Bt,{onClick:o,children:"Try again"})]}),Rt=({id:i="location-modal",className:r,formValues:s,showLocationModal:a,mapPanZoom:l,interactiveMapPinIconUrl:h,reverseGeoCodeEndpoint:u,convertLatLngToXYEndpoint:p,gettingCurrentLocationFetchMessage:_,mapBannerText:g,mustHavePostalCode:x,locationModalStyles:L,onClose:C,onConfirm:S,updateFormValues:E,locationListTitle:I,locationSelectionMode:Z,disableSearch:A,addressFieldPlaceholder:O,searchBarIcon:B,bufferRadius:N,pinsOnlyIndicateCurrentLocation:R})=>{const[D,j]=z("double"),[F,W]=z({}),[H,V]=z([]),[U,G]=z(!0),[q,K]=z(!1),{dispatchFieldEvent:Y,addFieldEventListener:X,removeFieldEventListener:J}=d(),[it,ot]=z(!0),[rt,st]=z(!1),[at,lt]=z(!1),[ht,ct]=z(!1),[ut,dt]=z(),[pt,mt]=z(),ft=T(!0),_t=k(((t,e)=>{j((n=>"double"===n||e&&n!==e?n:t))}),[]),gt=k((async()=>{K(!0);if(!!Y("get-current-location",i)){const t={};try{t.payload=await w.getCurrentLocation()}catch(e){t.errors=e}return Y("set-current-location",i,t),t.payload}}),[Y,i]),vt=k((()=>{W(s||{})}),[s]),yt=k((()=>{ft.current=!0,C()}),[C]),xt=k((()=>{vt(),yt()}),[yt,vt]),bt=k((t=>{const e=y.exports.isEmpty(t?.detail)?F:t?.detail;S(e),yt()}),[yt,S,F]),wt=()=>{!Y("before-hide-permission-modal",i)||st(!1)};M((()=>{const t={"error-end":t=>{const e=t.detail?.payload?.errorType;if(e)switch(e){case"OneMapError":case"GetLocationTimeoutError":yt()}},"set-selectable-pins":t=>{const e=t.detail.pins;Array.isArray(e)?V(e):lt(!0)},"confirm-location":bt,"hide-permission-modal":()=>{st(!1)},"dismiss-location-modal":xt,"trigger-get-current-location":gt};return Object.entries(t).forEach((([t,e])=>{X(t,i,e)})),()=>{Object.entries(t).forEach((([t,e])=>{J(t,i,e)}))}}),[X,gt,xt,yt,bt,i,J]),M((()=>{if(!window)return;const t=matchMedia(`(max-width: ${o.tablet}px)`);j(t.matches?"map":"double");const e=()=>ot(!0),n=()=>ot(!1),i=t=>{j(t.matches?"map":"double")};return window.addEventListener("online",e),window.addEventListener("offline",n),t.addEventListener("change",i),()=>{window.removeEventListener("online",e),window.removeEventListener("offline",n),t.removeEventListener("change",i)}}),[]),M((()=>{if(!a)return void j((t=>"double"!==t?"map":t));(async()=>{const{lat:t,lng:e}=s||{};t||e?ft.current&&Y("get-selectable-pins",i,{lat:t,lng:e}):await gt(),ft.current=!1})()}),[Y,s,gt,i,a]),M((()=>{y.exports.isEmpty(F)||_t("map","search")}),[F,q,_t]),M((()=>{W(s||{})}),[s]);return e(n,{children:[t(nt,{src:$,alt:"no internet connectivity"}),t(c,{id:m.generateId(i,"modal",a?"show":"hide"),className:`${r}-location-modal`,show:a,children:t(Q,{id:m.generateId(i,"modal-box"),className:`${r}-modal-box`,showCloseButton:!1,locationModalStyles:L,children:it?e(n,{children:[t(Et,{id:i,className:r,onCancel:xt,onConfirm:()=>{!Y("click-confirm-location",i,F)||bt()},updateFormValues:E,gettingCurrentLocation:q,panelInputMode:D,selectedAddressInfo:F,mapPickedLatLng:ut,formValues:s,onChangeSelectedAddressInfo:W,handleApiErrors:t=>{const e=(e,n)=>{!Y("error",i,{payload:{errorType:e},errors:t})||n()};K(!1),t instanceof f?e("OneMapError",(()=>{vt(),lt(!0)})):(G(!1),t instanceof v&&t?.code?.toString()===GeolocationPositionError.TIMEOUT.toString()?e("GetLocationTimeoutError",(()=>{ct(!0)})):e("GetLocationError",(()=>{st(!0)})))},onGetLocationCallback:(t,e)=>{K(!1),G(!0),mt({lat:t,lng:e})},setSinglePanelMode:_t,showLocationModal:a,reverseGeoCodeEndpoint:u,convertLatLngToXYEndpoint:p,gettingCurrentLocationFetchMessage:_,mustHavePostalCode:x,locationListTitle:I,restrictLocationSelection:"pins-only"===Z,selectablePins:H,disableSearch:A,addressFieldPlaceholder:O,searchBarIcon:B,bufferRadius:N}),t(tt,{id:i,className:r,panelInputMode:D,locationAvailable:U,gettingCurrentLocation:q,showLocationModal:a,selectedLocationCoord:{lat:F.lat,lng:F.lng},getCurrentLocation:gt,onMapCenterChange:t=>{dt(t)},interactiveMapPinIconUrl:h,mapPanZoom:l,mapBannerText:g,disableSelectionFromMap:"pins-only"===Z,disableSelectedLocationMarker:"pins-only"===Z,selectablePins:H,pinsOnlyIndicateCurrentLocation:R&&"pins-only"===Z,currentLocation:pt})]}):t(Nt,{id:i,cachedImage:$,refreshNetwork:()=>{try{navigator.onLine&&ot(!0)}catch(t){}}})})}),(()=>{if(it&&a)return at?t(b,{id:m.generateId(i,"onemap-error"),"data-testid":m.generateId(i,"onemap-error"),title:"Map not available",size:"large",show:!0,image:t(et,{src:"https://assets.life.gov.sg/web-frontend-engine/img/common/error.svg"}),description:e(P,{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("br",{}),t("br",{}),"Do note that you’ll not be able to submit your report without entering the location."]}),buttons:[{id:"ok",title:"OK",onClick:()=>{lt(!1),yt()}}]}):rt?t(b,{id:m.generateId(i,"get-location-error"),"data-testid":m.generateId(i,"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:wt}]}):ht?t(b,{id:m.generateId(i,"get-location-timeout-error"),"data-testid":m.generateId(i,"get-location-timeout-error"),title:"Something went wrong",size:"large",show:!0,image:t(et,{src:"https://assets.life.gov.sg/web-frontend-engine/img/icons/get-location-timeout.svg"}),description:t(P,{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:()=>{ct(!1),yt()}}]}):void 0})()]})};export{Rt as default};
|
|
346
|
-
//# sourceMappingURL=location-modal.
|
|
346
|
+
//# sourceMappingURL=location-modal.f2d21ab1.js.map
|