@wavemaker/app-rn-runtime 12.0.0-next.45031 → 12.0.0-next.45501

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. app-rn-runtime/components/advanced/carousel/carousel.component.js +18 -3
  2. app-rn-runtime/components/advanced/carousel/carousel.component.js.map +1 -1
  3. app-rn-runtime/components/advanced/webview/webview.component.js.map +1 -1
  4. app-rn-runtime/components/basic/anchor/anchor.component.js +2 -2
  5. app-rn-runtime/components/basic/anchor/anchor.component.js.map +1 -1
  6. app-rn-runtime/components/basic/animatedview.component.js +6 -2
  7. app-rn-runtime/components/basic/animatedview.component.js.map +1 -1
  8. app-rn-runtime/components/basic/audio/audio.component.js.map +1 -1
  9. app-rn-runtime/components/basic/button/button.component.js +5 -4
  10. app-rn-runtime/components/basic/button/button.component.js.map +1 -1
  11. app-rn-runtime/components/basic/icon/icon.component.js +4 -4
  12. app-rn-runtime/components/basic/icon/icon.component.js.map +1 -1
  13. app-rn-runtime/components/basic/label/label.component.js.map +1 -1
  14. app-rn-runtime/components/basic/label/label.styles.js.map +1 -1
  15. app-rn-runtime/components/basic/message/message.component.js.map +1 -1
  16. app-rn-runtime/components/basic/picture/picture.component.js +1 -2
  17. app-rn-runtime/components/basic/picture/picture.component.js.map +1 -1
  18. app-rn-runtime/components/basic/progress-bar/progress-bar.component.js +2 -2
  19. app-rn-runtime/components/basic/progress-bar/progress-bar.component.js.map +1 -1
  20. app-rn-runtime/components/basic/progress-circle/progress-circle.component.js +5 -5
  21. app-rn-runtime/components/basic/progress-circle/progress-circle.component.js.map +1 -1
  22. app-rn-runtime/components/basic/search/search.component.js.map +1 -1
  23. app-rn-runtime/components/basic/spinner/spinner.component.js +2 -3
  24. app-rn-runtime/components/basic/spinner/spinner.component.js.map +1 -1
  25. app-rn-runtime/components/basic/spinner/spinner.styles.js +3 -2
  26. app-rn-runtime/components/basic/spinner/spinner.styles.js.map +1 -1
  27. app-rn-runtime/components/basic/video/video.component.js.map +1 -1
  28. app-rn-runtime/components/basic/video/video.styles.js +4 -1
  29. app-rn-runtime/components/basic/video/video.styles.js.map +1 -1
  30. app-rn-runtime/components/chart/area-chart/area-chart.component.js.map +1 -1
  31. app-rn-runtime/components/chart/basechart.component.js +31 -2
  32. app-rn-runtime/components/chart/basechart.component.js.map +1 -1
  33. app-rn-runtime/components/chart/basechart.props.js +1 -0
  34. app-rn-runtime/components/chart/basechart.props.js.map +1 -1
  35. app-rn-runtime/components/chart/basechart.styles.js +4 -0
  36. app-rn-runtime/components/chart/basechart.styles.js.map +1 -1
  37. app-rn-runtime/components/chart/bubble-chart/bubble-chart.component.js +15 -3
  38. app-rn-runtime/components/chart/bubble-chart/bubble-chart.component.js.map +1 -1
  39. app-rn-runtime/components/chart/pie-chart/pie-chart.component.js +4 -1
  40. app-rn-runtime/components/chart/pie-chart/pie-chart.component.js.map +1 -1
  41. app-rn-runtime/components/chart/stack-chart/stack-chart.component.js +37 -11
  42. app-rn-runtime/components/chart/stack-chart/stack-chart.component.js.map +1 -1
  43. app-rn-runtime/components/container/accordion/accordion.component.js +3 -1
  44. app-rn-runtime/components/container/accordion/accordion.component.js.map +1 -1
  45. app-rn-runtime/components/container/accordion/accordion.styles.js +1 -0
  46. app-rn-runtime/components/container/accordion/accordion.styles.js.map +1 -1
  47. app-rn-runtime/components/container/layoutgrid/gridcolumn/gridcolumn.component.js.map +1 -1
  48. app-rn-runtime/components/container/panel/panel.component.js +4 -2
  49. app-rn-runtime/components/container/panel/panel.component.js.map +1 -1
  50. app-rn-runtime/components/container/tabs/tabheader/tabheader.component.js +2 -3
  51. app-rn-runtime/components/container/tabs/tabheader/tabheader.component.js.map +1 -1
  52. app-rn-runtime/components/container/tabs/tabs.component.js.map +1 -1
  53. app-rn-runtime/components/container/wizard/wizard.component.js +27 -11
  54. app-rn-runtime/components/container/wizard/wizard.component.js.map +1 -1
  55. app-rn-runtime/components/data/form/form-field/form-field.component.js.map +1 -1
  56. app-rn-runtime/components/data/list/list.component.js.map +1 -1
  57. app-rn-runtime/components/dialogs/dialog/dialog.component.js +5 -3
  58. app-rn-runtime/components/dialogs/dialog/dialog.component.js.map +1 -1
  59. app-rn-runtime/components/input/basedataset/basedataset.component.js.map +1 -1
  60. app-rn-runtime/components/input/baseinput/baseinput.component.js +11 -4
  61. app-rn-runtime/components/input/baseinput/baseinput.component.js.map +1 -1
  62. app-rn-runtime/components/input/baseinput/baseinput.props.js +1 -0
  63. app-rn-runtime/components/input/baseinput/baseinput.props.js.map +1 -1
  64. app-rn-runtime/components/input/basenumber/basenumber.component.js +25 -12
  65. app-rn-runtime/components/input/basenumber/basenumber.component.js.map +1 -1
  66. app-rn-runtime/components/input/basenumber/basenumber.props.js +2 -0
  67. app-rn-runtime/components/input/basenumber/basenumber.props.js.map +1 -1
  68. app-rn-runtime/components/input/checkbox/checkbox.component.js +5 -6
  69. app-rn-runtime/components/input/checkbox/checkbox.component.js.map +1 -1
  70. app-rn-runtime/components/input/checkboxset/checkboxset.component.js +3 -2
  71. app-rn-runtime/components/input/checkboxset/checkboxset.component.js.map +1 -1
  72. app-rn-runtime/components/input/chips/chips.component.js +3 -2
  73. app-rn-runtime/components/input/chips/chips.component.js.map +1 -1
  74. app-rn-runtime/components/input/currency/currency.component.js +16 -1
  75. app-rn-runtime/components/input/currency/currency.component.js.map +1 -1
  76. app-rn-runtime/components/input/epoch/base-datetime.component.js +22 -5
  77. app-rn-runtime/components/input/epoch/base-datetime.component.js.map +1 -1
  78. app-rn-runtime/components/input/epoch/wheel-date-picker.component.js +123 -12
  79. app-rn-runtime/components/input/epoch/wheel-date-picker.component.js.map +1 -1
  80. app-rn-runtime/components/input/epoch/wheelpicker/wheelpicker.component.js.map +1 -1
  81. app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.component.js +4 -0
  82. app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.component.js.map +1 -1
  83. app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.props.js +2 -0
  84. app-rn-runtime/components/input/epoch/wheelpickermodal/date/date-picker-modal.props.js.map +1 -1
  85. app-rn-runtime/components/input/number/number.component.js +6 -3
  86. app-rn-runtime/components/input/number/number.component.js.map +1 -1
  87. app-rn-runtime/components/input/radioset/radioset.component.js +6 -6
  88. app-rn-runtime/components/input/radioset/radioset.component.js.map +1 -1
  89. app-rn-runtime/components/input/select/select.component.js +23 -9
  90. app-rn-runtime/components/input/select/select.component.js.map +1 -1
  91. app-rn-runtime/components/input/switch/switch.component.js +2 -2
  92. app-rn-runtime/components/input/switch/switch.component.js.map +1 -1
  93. app-rn-runtime/components/input/toggle/toggle.component.js +2 -4
  94. app-rn-runtime/components/input/toggle/toggle.component.js.map +1 -1
  95. app-rn-runtime/components/navigation/appnavbar/appnavbar.component.js +2 -2
  96. app-rn-runtime/components/navigation/appnavbar/appnavbar.component.js.map +1 -1
  97. app-rn-runtime/components/navigation/basenav/basenav.component.js.map +1 -1
  98. app-rn-runtime/components/navigation/navitem/navitem.component.js +2 -3
  99. app-rn-runtime/components/navigation/navitem/navitem.component.js.map +1 -1
  100. app-rn-runtime/components/navigation/popover/popover.component.js.map +1 -1
  101. app-rn-runtime/components/page/tabbar/curve.js.map +1 -1
  102. app-rn-runtime/components/page/tabbar/tabbar.component.js.map +1 -1
  103. app-rn-runtime/core/base.component.js +2 -1
  104. app-rn-runtime/core/base.component.js.map +1 -1
  105. app-rn-runtime/core/components/textinput.component.js +4 -3
  106. app-rn-runtime/core/components/textinput.component.js.map +1 -1
  107. app-rn-runtime/core/formatters.js.map +1 -1
  108. app-rn-runtime/core/key.extractor.js.map +1 -1
  109. app-rn-runtime/core/props.provider.js +3 -0
  110. app-rn-runtime/core/props.provider.js.map +1 -1
  111. app-rn-runtime/core/storage.service.js.map +1 -1
  112. app-rn-runtime/core/tappable.component.js +26 -25
  113. app-rn-runtime/core/tappable.component.js.map +1 -1
  114. app-rn-runtime/core/ui-preferences.context.js +7 -0
  115. app-rn-runtime/core/ui-preferences.context.js.map +1 -0
  116. app-rn-runtime/core/utils.js +66 -4
  117. app-rn-runtime/core/utils.js.map +1 -1
  118. app-rn-runtime/package.json +28 -7
  119. app-rn-runtime/runtime/App.js +2 -1
  120. app-rn-runtime/runtime/App.js.map +1 -1
  121. app-rn-runtime/runtime/App.navigator.js.map +1 -1
  122. app-rn-runtime/runtime/base-fragment.component.js +15 -0
  123. app-rn-runtime/runtime/base-fragment.component.js.map +1 -1
  124. app-rn-runtime/runtime/base-page.component.js.map +1 -1
  125. app-rn-runtime/runtime/base-prefab.component.js.map +1 -1
  126. app-rn-runtime/runtime/navigator/stack.navigator.js.map +1 -1
  127. app-rn-runtime/runtime/services/app-i18n.service.js +10 -0
  128. app-rn-runtime/runtime/services/app-i18n.service.js.map +1 -1
  129. app-rn-runtime/runtime/services/app-security.service.js.map +1 -1
  130. app-rn-runtime/runtime/services/app-spinner.service.js +1 -1
  131. app-rn-runtime/runtime/services/app-spinner.service.js.map +1 -1
  132. app-rn-runtime/runtime/services/webprocess.service.js.map +1 -1
  133. app-rn-runtime/runtime/watcher.js.map +1 -1
  134. app-rn-runtime/styles/background.component.js +1 -0
  135. app-rn-runtime/styles/background.component.js.map +1 -1
  136. app-rn-runtime/styles/style-prop.validator.js.map +1 -1
  137. app-rn-runtime/styles/theme.js.map +1 -1
  138. app-rn-runtime/variables/base-variable.js.map +1 -1
  139. app-rn-runtime/variables/device/file/upload-file.operation.js.map +1 -1
  140. app-rn-runtime/variables/device-variable.js.map +1 -1
  141. app-rn-runtime/variables/service-variable.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["clone","isEqual","React","CommonActions","SplashScreen","WmPage","NavigationServiceProvider","AppSecurityService","AppSpinnerService","BaseFragment","Watcher","BasePage","constructor","props","_this$appConfig$drawe","_defineProperty","setTimeout","hideAsync","pageName","route","name","pageParams","params","appConfig","currentPage","drawer","setContent","serviceDefinitions","App","watcher","ROOT","create","canUserAccessPage","then","flag","cache","redirectToLogin","toHashURL","onComponentInit","w","targetWidget","refreshdataonattach","toggleDrawer","navigation","setDrawerContent","content","drawerContent","drawerType","hasDrawer","proxy","_this$appConfig$drawe2","_this$appConfig$drawe4","_this$appConfig$drawe3","createElement","value","setAnimation","onAttach","onFragmentReady","onContentReady","triggerPageReady","hide","cleanup","push","addListener","refresh","componentWillUnmount","goToPage","clearCahe","_params","dispatch","reset","index","routes","navigate","onDetach","destroyMe","closeDrawer","Promise","resolve","navigateToLandingPage","hash","paramStr","Object","keys","map","k","join","goBack","canGoBack","window","history","back","openUrl","url","startsWith","substring","splits","split","length","p","forEach","openBrowser","isActiveTabbarItem","label","link","links","possibleLinks","find","l","includes","renderWidget","renderPage"],"sources":["base-page.component.tsx"],"sourcesContent":["import { clone, isEqual } from 'lodash';\nimport React, { ReactNode } from 'react';\nimport { CommonActions } from '@react-navigation/native';\nimport * as SplashScreen from 'expo-splash-screen';\nimport { BaseComponent } from '@wavemaker/app-rn-runtime/core/base.component';\n\nimport WmPage from '@wavemaker/app-rn-runtime/components/page/page.component';\nimport NavigationService, { NavigationServiceProvider } from '@wavemaker/app-rn-runtime/core/navigation.service';\n\nimport AppSecurityService from './services/app-security.service';\nimport AppSpinnerService from './services/app-spinner.service';\nimport BaseFragment, { FragmentProps, FragmentState } from './base-fragment.component';\nimport { Watcher } from './watcher';\n\ndeclare const window: any;\n\nexport interface PageProps extends FragmentProps {\n route: any;\n navigation: any;\n destroyMe: Function;\n}\n\nexport interface PageState extends FragmentState<PageProps> {}\n\nexport default abstract class BasePage extends BaseFragment<PageProps, PageState> implements NavigationService {\n private pageName = null as unknown as string;\n private pageParams: any = {};\n private hasDrawer = false;\n private hasTabbar = false;\n private drawerContent = null as React.ReactNode;\n private drawerType = '';\n\n constructor(props: PageProps) {\n super(props);\n setTimeout(() => {\n SplashScreen.hideAsync();\n }, 300);\n this.pageName = props.route.name;\n this.pageParams = props.route.params;\n this.appConfig.currentPage = this;\n this.appConfig.drawer?.setContent(null);\n this.serviceDefinitions = this.App.serviceDefinitions;\n this.watcher = Watcher.ROOT.create();\n AppSecurityService.canUserAccessPage(this.pageName)\n .then(flag => {\n if (!flag) {\n this.cache = false;\n AppSecurityService.redirectToLogin(this.toHashURL());\n }\n });\n }\n\n onComponentInit(w: BaseComponent<any, any, any>) {\n super.onComponentInit(w);\n if (w instanceof WmPage) {\n this.targetWidget = w;\n const props = w.props as any;\n this.cache = !(props.cache === false);\n this.refreshdataonattach = !(props.refreshdataonattach === false);\n }\n }\n\n toggleDrawer() {\n (this.props as PageProps).navigation.toggleDrawer();\n }\n\n setDrawerContent(content = this.drawerContent, drawerType = this.drawerType) {\n if (!content) {\n return;\n }\n this.drawerContent = content;\n this.drawerType = drawerType;\n this.hasDrawer = true;\n setTimeout(() => {\n if (this.appConfig.currentPage === this \n || this.appConfig.currentPage.proxy === this) {\n this.appConfig.drawer?.setContent(null);\n setTimeout(() => {\n this.appConfig.drawer?.setContent((\n <NavigationServiceProvider value={this}>\n {content}\n </NavigationServiceProvider>));\n }, 500);\n this.appConfig.drawer?.setAnimation(drawerType);\n }\n }, 10);\n }\n\n onAttach() {\n super.onAttach();\n this.setDrawerContent();\n }\n\n onFragmentReady() {\n return super.onFragmentReady().then(() => {\n this.onContentReady();\n this.App.triggerPageReady(this.pageName, this.proxy as BasePage);\n AppSpinnerService.hide();\n this.cleanup.push((this.props as PageProps).navigation.addListener('focus', () => {\n if (this.appConfig.currentPage !== this) {\n this.appConfig.currentPage = this;\n this.onAttach();\n this.appConfig.refresh();\n }\n }));\n });\n }\n\n componentWillUnmount() {\n super.componentWillUnmount();\n }\n\n goToPage(pageName: string, params: any, clearCahe = false) {\n const navigation = (this.props as PageProps).navigation;\n const _params = clone(params);\n _params && delete _params['pageName'];\n if (pageName !== this.pageName || !isEqual(_params || null, this.pageParams || null)) {\n if (pageName === this.pageName) {\n navigation.push(pageName, _params);\n } else if (clearCahe) {\n navigation.dispatch(CommonActions.reset({\n index: 0,\n routes: [\n { name: pageName, params: params }\n ]}));\n } else {\n navigation.navigate(pageName, _params);\n }\n if (this.cache) {\n this.onDetach();\n } else {\n this.props.destroyMe();\n }\n } else {\n (this.props as PageProps).navigation.closeDrawer();\n }\n return Promise.resolve();\n }\n\n public navigateToLandingPage() {\n AppSecurityService.navigateToLandingPage();\n }\n\n public toHashURL() {\n const hash = `#/${this.pageName}`;\n const paramStr = Object.keys(this.pageParams || [])\n .map(k => k && `${k}=${this.pageParams[k]}`)\n .join('&');\n return hash + (paramStr ? `?${paramStr}` : '');\n }\n\n goBack() {\n const navigation = (this.props as PageProps).navigation;\n if (navigation.canGoBack()) {\n navigation.goBack();\n } else if (window && window.history) {\n window.history.back();\n }\n return Promise.resolve();\n }\n\n openUrl(url: string, params = {} as any) {\n if (url) {\n if (url.startsWith('#')) {\n url = url.substring(1);\n url = url.startsWith('/') ? url.substring(1) : url;\n const splits = url.split('?');\n const pageName = splits[0];\n let params = {} as any;\n if (splits.length > 1) {\n splits[1].split('&')\n .map(p => p.split('='))\n .forEach(p => params[p[0]] = p[1]);\n }\n return this.goToPage(pageName, params);\n } else {\n this.App.openBrowser(url, params);\n }\n }\n return Promise.resolve();\n }\n\n isActiveTabbarItem({label, link, links}: {label: string, link: string, links: string[]}) {\n const pageName = this.pageName;\n const possibleLinks = [pageName, '#' + pageName, '#/' + pageName];\n return links && links.find(l => possibleLinks.includes(l));\n }\n\n abstract renderPage(): ReactNode;\n\n renderWidget(props: PageProps) {\n return this.renderPage();\n }\n}\n"],"mappings":";;;AAAA,SAASA,KAAK,EAAEC,OAAO,QAAQ,QAAQ;AACvC,OAAOC,KAAK,MAAqB,OAAO;AACxC,SAASC,aAAa,QAAQ,0BAA0B;AACxD,OAAO,KAAKC,YAAY,MAAM,oBAAoB;AAGlD,OAAOC,MAAM,MAAM,0DAA0D;AAC7E,SAA4BC,yBAAyB,QAAQ,mDAAmD;AAEhH,OAAOC,kBAAkB,MAAM,iCAAiC;AAChE,OAAOC,iBAAiB,MAAM,gCAAgC;AAC9D,OAAOC,YAAY,MAAwC,2BAA2B;AACtF,SAASC,OAAO,QAAQ,W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ACL,IAAI,CAACM,GAAG,CAACyE,WAAW,CAACR,GAAG,EAAEvE,MAAM,CAAC;MACnC;IACF;IACA,OAAOuD,OAAO,CAACC,OAAO,CAAC,CAAC;EAC1B;EAEAwB,kBAAkBA,CAAC;IAACC,KAAK;IAAEC,IAAI;IAAEC;EAAqD,CAAC,EAAE;IACvF,MAAMvF,QAAQ,GAAG,IAAI,CAACA,QAAQ;IAC9B,MAAMwF,aAAa,GAAG,CAACxF,QAAQ,EAAE,GAAG,GAAGA,QAAQ,EAAE,IAAI,GAAGA,QAAQ,CAAC;IACjE,OAAOuF,KAAK,IAAIA,KAAK,CAACE,IAAI,CAACC,CAAC,IAAIF,aAAa,CAACG,QAAQ,CAACD,CAAC,CAAC,CAAC;EAC5D;EAIAE,YAAYA,CAACjG,KAAgB,EAAE;IAC7B,OAAO,IAAI,CAACkG,UAAU,CAAC,CAAC;EAC1B;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["clone","isEqual","React","CommonActions","SplashScreen","WmPage","NavigationServiceProvider","AppSecurityService","AppSpinnerService","BaseFragment","Watcher","BasePage","constructor","props","_this$appConfig$drawe","_defineProperty","setTimeout","hideAsync","pageName","route","name","pageParams","params","appConfig","currentPage","drawer","setContent","serviceDefinitions","App","watcher","ROOT","create","canUserAccessPage","then","flag","cache","redirectToLogin","toHashURL","onComponentInit","w","targetWidget","refreshdataonattach","toggleDrawer","navigation","setDrawerContent","content","drawerContent","drawerType","hasDrawer","proxy","_this$appConfig$drawe2","_this$appConfig$drawe4","_this$appConfig$drawe3","createElement","value","setAnimation","onAttach","onFragmentReady","onContentReady","triggerPageReady","hide","cleanup","push","addListener","refresh","componentWillUnmount","goToPage","clearCahe","_params","dispatch","reset","index","routes","navigate","onDetach","destroyMe","closeDrawer","Promise","resolve","navigateToLandingPage","hash","paramStr","Object","keys","map","k","join","goBack","canGoBack","window","history","back","openUrl","url","startsWith","substring","splits","split","length","p","forEach","openBrowser","isActiveTabbarItem","label","link","links","possibleLinks","find","l","includes","renderWidget","renderPage"],"sources":["base-page.component.tsx"],"sourcesContent":["import { clone, isEqual } from 'lodash';\nimport React, { ReactNode } from 'react';\nimport { CommonActions } from '@react-navigation/native';\nimport * as SplashScreen from 'expo-splash-screen';\nimport { BaseComponent } from '@wavemaker/app-rn-runtime/core/base.component';\n\nimport WmPage from '@wavemaker/app-rn-runtime/components/page/page.component';\nimport NavigationService, { NavigationServiceProvider } from '@wavemaker/app-rn-runtime/core/navigation.service';\n\nimport AppSecurityService from './services/app-security.service';\nimport AppSpinnerService from './services/app-spinner.service';\nimport BaseFragment, { FragmentProps, FragmentState } from './base-fragment.component';\nimport { Watcher } from './watcher';\n\ndeclare const window: any;\n\nexport interface PageProps extends FragmentProps {\n route: any;\n navigation: any;\n destroyMe: Function;\n}\n\nexport interface PageState extends FragmentState<PageProps> {}\n\nexport default abstract class BasePage extends BaseFragment<PageProps, PageState> implements NavigationService {\n private pageName = null as unknown as string;\n private pageParams: any = {};\n private hasDrawer = false;\n private hasTabbar = false;\n private drawerContent = null as React.ReactNode;\n private drawerType = '';\n\n constructor(props: PageProps) {\n super(props);\n setTimeout(() => {\n SplashScreen.hideAsync();\n }, 300);\n this.pageName = props.route.name;\n this.pageParams = props.route.params;\n this.appConfig.currentPage = this;\n this.appConfig.drawer?.setContent(null);\n this.serviceDefinitions = this.App.serviceDefinitions;\n this.watcher = Watcher.ROOT.create();\n AppSecurityService.canUserAccessPage(this.pageName)\n .then(flag => {\n if (!flag) {\n this.cache = false;\n AppSecurityService.redirectToLogin(this.toHashURL());\n }\n });\n }\n\n onComponentInit(w: BaseComponent<any, any, any>) {\n super.onComponentInit(w);\n if (w instanceof WmPage) {\n this.targetWidget = w;\n const props = w.props as any;\n this.cache = !(props.cache === false);\n this.refreshdataonattach = !(props.refreshdataonattach === false);\n }\n }\n\n toggleDrawer() {\n (this.props as PageProps).navigation.toggleDrawer();\n }\n\n setDrawerContent(content = this.drawerContent, drawerType = this.drawerType) {\n if (!content) {\n return;\n }\n this.drawerContent = content;\n this.drawerType = drawerType;\n this.hasDrawer = true;\n setTimeout(() => {\n if (this.appConfig.currentPage === this \n || this.appConfig.currentPage.proxy === this) {\n this.appConfig.drawer?.setContent(null);\n setTimeout(() => {\n this.appConfig.drawer?.setContent((\n <NavigationServiceProvider value={this}>\n {content}\n </NavigationServiceProvider>));\n }, 500);\n this.appConfig.drawer?.setAnimation(drawerType);\n }\n }, 10);\n }\n\n onAttach() {\n super.onAttach();\n this.setDrawerContent();\n }\n\n onFragmentReady() {\n return super.onFragmentReady().then(() => {\n this.onContentReady();\n this.App.triggerPageReady(this.pageName, this.proxy as BasePage);\n AppSpinnerService.hide();\n this.cleanup.push((this.props as PageProps).navigation.addListener('focus', () => {\n if (this.appConfig.currentPage !== this) {\n this.appConfig.currentPage = this;\n this.onAttach();\n this.appConfig.refresh();\n }\n }));\n });\n }\n\n componentWillUnmount() {\n super.componentWillUnmount();\n }\n\n goToPage(pageName: string, params: any, clearCahe = false) {\n const navigation = (this.props as PageProps).navigation;\n const _params = clone(params);\n _params && delete _params['pageName'];\n if (pageName !== this.pageName || !isEqual(_params || null, this.pageParams || null)) {\n if (pageName === this.pageName) {\n navigation.push(pageName, _params);\n } else if (clearCahe) {\n navigation.dispatch(CommonActions.reset({\n index: 0,\n routes: [\n { name: pageName, params: params }\n ]}));\n } else {\n navigation.navigate(pageName, _params);\n }\n if (this.cache) {\n this.onDetach();\n } else {\n this.props.destroyMe();\n }\n } else {\n (this.props as PageProps).navigation.closeDrawer();\n }\n return Promise.resolve();\n }\n\n public navigateToLandingPage() {\n AppSecurityService.navigateToLandingPage();\n }\n\n public toHashURL() {\n const hash = `#/${this.pageName}`;\n const paramStr = Object.keys(this.pageParams || [])\n .map(k => k && `${k}=${this.pageParams[k]}`)\n .join('&');\n return hash + (paramStr ? `?${paramStr}` : '');\n }\n\n goBack() {\n const navigation = (this.props as PageProps).navigation;\n if (navigation.canGoBack()) {\n navigation.goBack();\n } else if (window && window.history) {\n window.history.back();\n }\n return Promise.resolve();\n }\n\n openUrl(url: string, params = {} as any) {\n if (url) {\n if (url.startsWith('#')) {\n url = url.substring(1);\n url = url.startsWith('/') ? url.substring(1) : url;\n const splits = url.split('?');\n const pageName = splits[0];\n let params = {} as any;\n if (splits.length > 1) {\n splits[1].split('&')\n .map(p => p.split('='))\n .forEach(p => params[p[0]] = p[1]);\n }\n return this.goToPage(pageName, params);\n } else {\n this.App.openBrowser(url, params);\n }\n }\n return Promise.resolve();\n }\n\n isActiveTabbarItem({label, link, links}: {label: string, link: string, links: string[]}) {\n const pageName = this.pageName;\n const possibleLinks = [pageName, '#' + pageName, '#/' + pageName];\n return links && links.find(l => possibleLinks.includes(l));\n }\n\n abstract renderPage(): ReactNode;\n\n renderWidget(props: PageProps) {\n return this.renderPage();\n }\n}\n"],"mappings":";;;AAAA,SAASA,KAAK,EAAEC,OAAO,QAAQ,QAAQ;AACvC,OAAOC,KAAK,MAAqB,OAAO;AACxC,SAASC,aAAa,QAAQ,0BAA0B;AACxD,OAAO,KAAKC,YAAY,MAAM,oBAAoB;AAGlD,OAAOC,MAAM,MAAM,0DAA0D;AAC7E,SAA4BC,yBAAyB,QAAQ,mDAAmD;AAEhH,OAAOC,kBAAkB,MAAM,iCAAiC;AAChE,OAAOC,iBAAiB,MAAM,gCAAgC;AAC9D,OAAOC,YAAY,MAAwC,2BAA2B;AACtF,SAASC,OAAO,QAAQ,WAAW;AAYnC,eAAe,MAAeC,QAAQ,SAASF,YAAY,CAAoD;EAQ3GG,WAAWA,CAACC,KAAgB,EAAE;IAAA,IAAAC,qBAAA;IAC5B,KAAK,CAACD,KAAK,CAAC;IAACE,eAAA,mBARI,IAAI;IAAAA,eAAA,qBACG,CAAC,CAAC;IAAAA,eAAA,oBACR,KAAK;IAAAA,eAAA,oBACL,KAAK;IAAAA,eAAA,wBACD,IAAI;IAAAA,eAAA,qBACP,EAAE;IAIrBC,UAAU,CAAC,MAAM;MACfZ,YAAY,CAACa,SAAS,CAAC,CAAC;IAC1B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uF,KAAK,IAAIA,KAAK,CAACE,IAAI,CAACC,CAAC,IAAIF,aAAa,CAACG,QAAQ,CAACD,CAAC,CAAC,CAAC;EAC5D;EAIAE,YAAYA,CAACjG,KAAgB,EAAE;IAC7B,OAAO,IAAI,CAACkG,UAAU,CAAC,CAAC;EAC1B;AACJ","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["React","View","merge","PartialProvider","WmPrefabContainer","BaseFragment","axios","BasePrefab","constructor","props","defualtProps","partialService","_defineProperty","App","appConfig","app","Actions","Variables","appUrl","url","resourceBaseUrl","baseUrl","prefabname","watcher","parentWatcher","create","getServiceDefinitions","onComponentInit","w","targetWidget","onFragmentReady","_renderPrefab","component","renderPrefab","then","onContentReady","invokeEventCallback","refresh","Promise","resolve","resetAppLocale","appLocale","messages","prefabMessages","Object","values","fragments","forEach","f","componentWillUnmount","renderWidget","_props$styles","createElement","value","style","width","styles","root","_BasePrefab","prefabName","defs","SERVICE_DEFINITION_CACHE","get","catch","response","_response$data","serviceDefinitions","data","serviceDefs"],"sources":["base-prefab.component.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { merge } from 'lodash-es';\n\nimport { BaseComponent } from '@wavemaker/app-rn-runtime/core/base.component';\nimport PartialService, { PartialProvider } from '@wavemaker/app-rn-runtime/core/partial.service';\nimport WmPrefabContainer from '@wavemaker/app-rn-runtime/components/prefab/prefab-container.component';\nimport BaseFragment, { FragmentProps, FragmentState } from './base-fragment.component';\nimport axios from 'axios';\nimport { Watcher } from './watcher';\n\n\nexport interface PrefabProps extends FragmentProps {\n prefabname: string;\n parentWatcher: Watcher;\n}\n\nexport interface PrefabState extends FragmentState<PrefabProps> {}\n\nexport default abstract class BasePrefab extends BaseFragment<PrefabProps, PrefabState> {\n\n private static SERVICE_DEFINITION_CACHE = {} as any;\n\n public static getServiceDefinitions = (prefabName: string, url: string) => {\n const defs = BasePrefab.SERVICE_DEFINITION_CACHE[prefabName];\n if (defs) {\n return Promise.resolve(defs);\n } else {\n return axios.get(url + '/servicedefs')\n .catch(() => ({}))\n .then((response: any) => {\n const serviceDefinitions = response?.data?.serviceDefs || {};\n BasePrefab.SERVICE_DEFINITION_CACHE[prefabName] = serviceDefinitions;\n return Promise.resolve(serviceDefinitions);\n });\n }\n };\n\n private appUrl = '';\n private prefabParams: any = {};\n private _renderPrefab:() => React.ReactNode = null as any;\n\n constructor(props: PrefabProps, defualtProps: PrefabProps, private partialService: PartialService) {\n super(props, defualtProps);\n this.App = this.appConfig.app;\n this.Actions = {};\n this.Variables = {};\n this.appUrl = this.appConfig.url;\n this.resourceBaseUrl = `${this.baseUrl}/app/prefabs/${props.prefabname}`;\n this.baseUrl = `${this.baseUrl}/prefabs/${props.prefabname}`;\n this.watcher = props.parentWatcher.create();\n }\n\n getServiceDefinitions() {\n return BasePrefab.getServiceDefinitions(this.props.prefabname, `${this.appUrl}/services/prefabs/${this.props.prefabname}`);\n }\n\n onComponentInit(w: BaseComponent<any, any, any>) {\n super.onComponentInit(w);\n if (w instanceof WmPrefabContainer) {\n this.targetWidget = w;\n }\n }\n\n onFragmentReady(): Promise<void> {\n this._renderPrefab = () => {\n const component = this.renderPrefab();\n super.onFragmentReady()\n .then(() => {\n this.onContentReady();\n this.invokeEventCallback('onLoad', [null, this]);\n });\n this._renderPrefab = () => this.renderPrefab();\n return component;\n };\n this.refresh();\n return Promise.resolve();\n }\n\n resetAppLocale() {\n this.appLocale = merge({ }, this.appConfig.appLocale.messages, this.appConfig.appLocale.prefabMessages[this.props.prefabname]);\n Object.values(this.fragments).forEach((f: any) => (f as BaseFragment<any, any>).resetAppLocale());\n }\n\n componentWillUnmount() {\n super.componentWillUnmount();\n this.invokeEventCallback('onDestroy', [null, this]);\n }\n\n abstract renderPrefab(): React.ReactNode;\n\n renderWidget(props: PrefabProps) {\n return (\n <PartialProvider value={this.partialService}>\n <View style={[{width: '100%'}, props.styles?.root]}>\n {this._renderPrefab ? this._renderPrefab(): null}\n </View>\n </PartialProvider>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AAAoD,aAAA,CAACjD,eAAe;MAACkD,KAAK,EAAE,IAAI,CAAC1C;IAAe,gBAC1CX,KAAA,CAAAoD,aAAA,CAACnD,IAAI;MAACqD,KAAK,EAAE,CAAC;QAACC,KAAK,EAAE;MAAM,CAAC,GAAAJ,aAAA,GAAE1C,KAAK,CAAC+C,MAAM,cAAAL,aAAA,uBAAZA,aAAA,CAAcM,IAAI;IAAE,GAChD,IAAI,CAAC1B,aAAa,GAAG,IAAI,CAACA,aAAa,CAAC,CAAC,GAAE,IACxC,CACS,CAAC;EAEtB;AACJ;AAAC2B,WAAA,GAjF6BnD,UAAU;AAAAK,eAAA,CAAVL,UAAU,8BAEM,CAAC,CAAC;AAAAK,eAAA,CAFlBL,UAAU,2BAIE,CAACoD,UAAkB,EAAExC,GAAW,KAAK;EACzE,MAAMyC,IAAI,GAAGrD,WAAU,CAACsD,wBAAwB,CAACF,UAAU,CAAC;EAC5D,IAAIC,IAAI,EAAE;IACR,OAAOtB,OAAO,CAACC,OAAO,CAACqB,IAAI,CAAC;EAC9B,CAAC,MAAM;IACL,OAAOtD,KAAK,CAACwD,GAAG,CAAC3C,GAAG,GAAG,cAAc,CAAC,CACnC4C,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CACjB7B,IAAI,CAAE8B,QAAa,IAAK;MAAA,IAAAC,cAAA;MACrB,MAAMC,kBAAkB,GAAG,CAAAF,QAAQ,aAARA,QAAQ,gBAAAC,cAAA,GAARD,QAAQ,CAAEG,IAAI,cAAAF,cAAA,uBAAdA,cAAA,CAAgBG,WAAW,KAAI,CAAC,CAAC;MAC5D7D,WAAU,CAACsD,wBAAwB,CAACF,UAAU,CAAC,GAAGO,kBAAkB;MACpE,OAAO5B,OAAO,CAACC,OAAO,CAAC2B,kBAAkB,CAAC;IAC9C,CAAC,CAAC;EACN;AACF,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["React","View","merge","PartialProvider","WmPrefabContainer","BaseFragment","axios","BasePrefab","constructor","props","defualtProps","partialService","_defineProperty","App","appConfig","app","Actions","Variables","appUrl","url","resourceBaseUrl","baseUrl","prefabname","watcher","parentWatcher","create","getServiceDefinitions","onComponentInit","w","targetWidget","onFragmentReady","_renderPrefab","component","renderPrefab","then","onContentReady","invokeEventCallback","refresh","Promise","resolve","resetAppLocale","appLocale","messages","prefabMessages","Object","values","fragments","forEach","f","componentWillUnmount","renderWidget","_props$styles","createElement","value","style","width","styles","root","_BasePrefab","prefabName","defs","SERVICE_DEFINITION_CACHE","get","catch","response","_response$data","serviceDefinitions","data","serviceDefs"],"sources":["base-prefab.component.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { merge } from 'lodash-es';\n\nimport { BaseComponent } from '@wavemaker/app-rn-runtime/core/base.component';\nimport PartialService, { PartialProvider } from '@wavemaker/app-rn-runtime/core/partial.service';\nimport WmPrefabContainer from '@wavemaker/app-rn-runtime/components/prefab/prefab-container.component';\nimport BaseFragment, { FragmentProps, FragmentState } from './base-fragment.component';\nimport axios from 'axios';\nimport { Watcher } from './watcher';\n\n\nexport interface PrefabProps extends FragmentProps {\n prefabname: string;\n parentWatcher: Watcher;\n}\n\nexport interface PrefabState extends FragmentState<PrefabProps> {}\n\nexport default abstract class BasePrefab extends BaseFragment<PrefabProps, PrefabState> {\n\n private static SERVICE_DEFINITION_CACHE = {} as any;\n\n public static getServiceDefinitions = (prefabName: string, url: string) => {\n const defs = BasePrefab.SERVICE_DEFINITION_CACHE[prefabName];\n if (defs) {\n return Promise.resolve(defs);\n } else {\n return axios.get(url + '/servicedefs')\n .catch(() => ({}))\n .then((response: any) => {\n const serviceDefinitions = response?.data?.serviceDefs || {};\n BasePrefab.SERVICE_DEFINITION_CACHE[prefabName] = serviceDefinitions;\n return Promise.resolve(serviceDefinitions);\n });\n }\n };\n\n private appUrl = '';\n private prefabParams: any = {};\n private _renderPrefab:() => React.ReactNode = null as any;\n\n constructor(props: PrefabProps, defualtProps: PrefabProps, private partialService: PartialService) {\n super(props, defualtProps);\n this.App = this.appConfig.app;\n this.Actions = {};\n this.Variables = {};\n this.appUrl = this.appConfig.url;\n this.resourceBaseUrl = `${this.baseUrl}/app/prefabs/${props.prefabname}`;\n this.baseUrl = `${this.baseUrl}/prefabs/${props.prefabname}`;\n this.watcher = props.parentWatcher.create();\n }\n\n getServiceDefinitions() {\n return BasePrefab.getServiceDefinitions(this.props.prefabname, `${this.appUrl}/services/prefabs/${this.props.prefabname}`);\n }\n\n onComponentInit(w: BaseComponent<any, any, any>) {\n super.onComponentInit(w);\n if (w instanceof WmPrefabContainer) {\n this.targetWidget = w;\n }\n }\n\n onFragmentReady(): Promise<void> {\n this._renderPrefab = () => {\n const component = this.renderPrefab();\n super.onFragmentReady()\n .then(() => {\n this.onContentReady();\n this.invokeEventCallback('onLoad', [null, this]);\n });\n this._renderPrefab = () => this.renderPrefab();\n return component;\n };\n this.refresh();\n return Promise.resolve();\n }\n\n resetAppLocale() {\n this.appLocale = merge({ }, this.appConfig.appLocale.messages, this.appConfig.appLocale.prefabMessages[this.props.prefabname]);\n Object.values(this.fragments).forEach((f: any) => (f as BaseFragment<any, any>).resetAppLocale());\n }\n\n componentWillUnmount() {\n super.componentWillUnmount();\n this.invokeEventCallback('onDestroy', [null, this]);\n }\n\n abstract renderPrefab(): React.ReactNode;\n\n renderWidget(props: PrefabProps) {\n return (\n <PartialProvider value={this.partialService}>\n <View style={[{width: '100%'}, props.styles?.root]}>\n {this._renderPrefab ? this._renderPrefab(): null}\n </View>\n </PartialProvider>\n );\n }\n}\n"],"mappings":";;;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,KAAK,QAAQ,WAAW;AAGjC,SAAyBC,eAAe,QAAQ,gDAAgD;AAChG,OAAOC,iBAAiB,MAAM,wEAAwE;AACtG,OAAOC,YAAY,MAAwC,2BAA2B;AACtF,OAAOC,KAAK,MAAM,OAAO;AAWzB,eAAe,MAAeC,UAAU,SAASF,YAAY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,aAAa,CAAC,CAAC,GAAE,IACxC,CACS,CAAC;EAEtB;AACJ;AAAC2B,WAAA,GAjF6BnD,UAAU;AAAAK,eAAA,CAAVL,UAAU,8BAEM,CAAC,CAAC;AAAAK,eAAA,CAFlBL,UAAU,2BAIE,CAACoD,UAAkB,EAAExC,GAAW,KAAK;EACzE,MAAMyC,IAAI,GAAGrD,WAAU,CAACsD,wBAAwB,CAACF,UAAU,CAAC;EAC5D,IAAIC,IAAI,EAAE;IACR,OAAOtB,OAAO,CAACC,OAAO,CAACqB,IAAI,CAAC;EAC9B,CAAC,MAAM;IACL,OAAOtD,KAAK,CAACwD,GAAG,CAAC3C,GAAG,GAAG,cAAc,CAAC,CACnC4C,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CACjB7B,IAAI,CAAE8B,QAAa,IAAK;MAAA,IAAAC,cAAA;MACrB,MAAMC,kBAAkB,GAAG,CAAAF,QAAQ,aAARA,QAAQ,gBAAAC,cAAA,GAARD,QAAQ,CAAEG,IAAI,cAAAF,cAAA,uBAAdA,cAAA,CAAgBG,WAAW,KAAI,CAAC,CAAC;MAC5D7D,WAAU,CAACsD,wBAAwB,CAACF,UAAU,CAAC,GAAGO,kBAAkB;MACpE,OAAO5B,OAAO,CAACC,OAAO,CAAC2B,kBAAkB,CAAC;IAC9C,CAAC,CAAC;EACN;AACF,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["React","View","createStackNavigator","ThemeVariables","Stack","pages","Screen","Component","constructor","props","_defineProperty","state","renew","page","createPage","navigation","cleanUp","push","addListener","setState","createElement","route","name","component","destroyMe","setTimeout","componentWillUnmount","forEach","fn","render","getPageId","pageName","pageParams","pageParamsStr","Object","keys","sort","map","k","join","AppStackNavigator","Navigator","initialRouteName","landingPage","p","key","getId","params","options","headerShown","cardStyle","backgroundColor","INSTANCE","pageContentBgColor"],"sources":["stack.navigator.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { createStackNavigator } from '@react-navigation/stack';\nimport ThemeVariables from '@wavemaker/app-rn-runtime/styles/theme.variables';\n\nconst Stack = createStackNavigator();\n\ninterface AppStackNavigatorProps {\n pages: any[];\n landingPage: string; \n}\n\nconst pages = {} as any;\n\nclass Screen extends React.Component {\n\n private cleanUp = [] as Function[];\n\n constructor(props: any) {\n super(props);\n this.state = {\n renew: false,\n page: this.createPage()\n };\n const navigation = (this.props as any).navigation as any;\n this.cleanUp.push(navigation.addListener('focus', () => {\n const state = (this.state as any);\n if (state.renew) {\n state.page = this.createPage();\n this.setState(() => ({\n renew: false,\n page: state.page\n }));\n }\n }));\n }\n\n private createPage() {\n const props = this.props as any;\n return React.createElement(pages[props.route.name].component, {...props, destroyMe: () => {\n setTimeout(() => {\n this.setState(() => ({renew: true, page: null}));\n }, 100);\n }});\n }\n\n componentWillUnmount() {\n this.cleanUp.forEach(fn => fn && fn());\n }\n\n render() {\n return (this.state as any).page || (<View/>);\n }\n}\n\nconst getPageId = (pageName: string, pageParams: any) => {\n const pageParamsStr = pageParams ? Object.keys(pageParams)\n .sort()\n .map((k: string) => `${k}=${pageParams[k]}`)\n .join('&') : '';\n return `${pageName}?${pageParamsStr}`;\n}\n\nconst AppStackNavigator = (props: AppStackNavigatorProps) => {\n return (<Stack.Navigator initialRouteName={props.landingPage}>\n {props.pages.map(p => {\n pages[p.name] = p;\n return (\n <Stack.Screen key={p.name}\n name={p.name}\n component={Screen}\n getId={({params}) => getPageId(p.name, params)}\n options={{\n headerShown: false,\n cardStyle: {\n backgroundColor: ThemeVariables.INSTANCE.pageContentBgColor\n }\n }}\n />);\n })}\n </Stack.Navigator>);\n};\n\nexport default AppStackNavigator;"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,OAAOC,cAAc,MAAM,kDAAkD;AAE7E,MAAMC,KAAK,GAAGF,oBAAoB,CAAC,CAAC;AAOpC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b,iBAAiB","ignoreList":[]}
1
+ {"version":3,"names":["React","View","createStackNavigator","ThemeVariables","Stack","pages","Screen","Component","constructor","props","_defineProperty","state","renew","page","createPage","navigation","cleanUp","push","addListener","setState","createElement","route","name","component","destroyMe","setTimeout","componentWillUnmount","forEach","fn","render","getPageId","pageName","pageParams","pageParamsStr","Object","keys","sort","map","k","join","AppStackNavigator","Navigator","initialRouteName","landingPage","p","key","getId","params","options","headerShown","cardStyle","backgroundColor","INSTANCE","pageContentBgColor"],"sources":["stack.navigator.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { createStackNavigator } from '@react-navigation/stack';\nimport ThemeVariables from '@wavemaker/app-rn-runtime/styles/theme.variables';\n\nconst Stack = createStackNavigator();\n\ninterface AppStackNavigatorProps {\n pages: any[];\n landingPage: string; \n}\n\nconst pages = {} as any;\n\nclass Screen extends React.Component {\n\n private cleanUp = [] as Function[];\n\n constructor(props: any) {\n super(props);\n this.state = {\n renew: false,\n page: this.createPage()\n };\n const navigation = (this.props as any).navigation as any;\n this.cleanUp.push(navigation.addListener('focus', () => {\n const state = (this.state as any);\n if (state.renew) {\n state.page = this.createPage();\n this.setState(() => ({\n renew: false,\n page: state.page\n }));\n }\n }));\n }\n\n private createPage() {\n const props = this.props as any;\n return React.createElement(pages[props.route.name].component, {...props, destroyMe: () => {\n setTimeout(() => {\n this.setState(() => ({renew: true, page: null}));\n }, 100);\n }});\n }\n\n componentWillUnmount() {\n this.cleanUp.forEach(fn => fn && fn());\n }\n\n render() {\n return (this.state as any).page || (<View/>);\n }\n}\n\nconst getPageId = (pageName: string, pageParams: any) => {\n const pageParamsStr = pageParams ? Object.keys(pageParams)\n .sort()\n .map((k: string) => `${k}=${pageParams[k]}`)\n .join('&') : '';\n return `${pageName}?${pageParamsStr}`;\n}\n\nconst AppStackNavigator = (props: AppStackNavigatorProps) => {\n return (<Stack.Navigator initialRouteName={props.landingPage}>\n {props.pages.map(p => {\n pages[p.name] = p;\n return (\n <Stack.Screen key={p.name}\n name={p.name}\n component={Screen}\n getId={({params}) => getPageId(p.name, params)}\n options={{\n headerShown: false,\n cardStyle: {\n backgroundColor: ThemeVariables.INSTANCE.pageContentBgColor\n }\n }}\n />);\n })}\n </Stack.Navigator>);\n};\n\nexport default AppStackNavigator;"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,oBAAoB,QAAQ,yBAAyB;AAC9D,OAAOC,cAAc,MAAM,kDAAkD;AAE7E,MAAMC,KAAK,GAAGF,oBAAoB,CAAC,CAAC;AAOpC,MAAMG,KAAK,GAAG,CAAC,CAAQ;AAEvB,MAAMC,MAAM,SAASN,KAAK,CAACO,SAAS,CAAC;EAInCC,WAAWA,CAACC,KAAU,EAAE;IACtB,KAAK,CAACA,KAAK,CAAC;IAACC,eAAA,kBAHG,EAAE;IAIlB,IAAI,CAACC,KAAK,GAAG;MACXC,KAAK,EAAE,KAAK;MACZC,IAAI,EAAE,IAAI,CAACC,UAAU,CAAC;IACxB,CAAC;IACD,MAAMC,UAAU,GAAI,IAAI,CAACN,KAAK,CAASM,UAAiB;IACxD,IAAI,CAACC,OAAO,CAACC,IAAI,CAACF,UAAU,CAACG,WAAW,CAAC,OAAO,EAAE,MAAM;MACtD,MAAMP,KAAK,GAAI,IAAI,CAACA,KAAa;MACjC,IAAIA,KAAK,CAACC,KAAK,EAAE;QACfD,KAAK,CAACE,IAAI,GAAG,IAAI,CAACC,UAAU,CAAC,CAAC;QAC9B,IAAI,CAACK,QAAQ,CAAC,OAAO;UACnBP,KAAK,EAAE,KAAK;UACZC,IAAI,EAAEF,KAAK,CAACE;QACd,CAAC,CAAC,CAAC;MACL;IACF,CAAC,CAAC,CAAC;EACL;EAEQC,UAAUA,CAAA,EAAG;IACnB,MAAML,KAAK,GAAG,IAAI,CAACA,KAAY;IAC/B,oBAAOT,KAAK,CAACoB,aAAa,CAACf,KAAK,CAACI,KAAK,CAACY,KAA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,EAAED,CAAC,CAACtB,IAAK;MACxBA,IAAI,EAAEsB,CAAC,CAACtB,IAAK;MACbC,SAAS,EAAEjB,MAAO;MAClBwC,KAAK,EAAEA,CAAC;QAACC;MAAM,CAAC,KAAKjB,SAAS,CAACc,CAAC,CAACtB,IAAI,EAAEyB,MAAM,CAAE;MAC/CC,OAAO,EAAE;QACPC,WAAW,EAAE,KAAK;QAClBC,SAAS,EAAE;UACTC,eAAe,EAAEhD,cAAc,CAACiD,QAAQ,CAACC;QAC3C;MACF;IAAE,CACH,CAAC;EACJ,CAAC,CACY,CAAC;AACpB,CAAC;AAED,eAAeb,iBAAiB","ignoreList":[]}
@@ -51,6 +51,16 @@ class AppI18nService {
51
51
  });
52
52
  });
53
53
  }
54
+
55
+ // app defaults support same as web
56
+ get appDefaults() {
57
+ return {
58
+ dateFormat: this.dateFormat,
59
+ timeFormat: this.timeFormat,
60
+ currencyCode: this.currencyCode,
61
+ dateTimeFormat: this.dateTimeFormat
62
+ };
63
+ }
54
64
  setTimezone(timezone) {
55
65
  this.timezone = timezone;
56
66
  }
@@ -1 +1 @@
1
- {"version":3,"names":["axios","StorageService","isWebPreviewMode","I18nManager","APP_LOCALE_ROOT_PATH","STORAGE_KEY","RTL_LANGUAGE_CODES","map","forEach","v","AppI18nService","constructor","_defineProperty","init","selectedLocale","getItem","isRTLLocale","newLocale","setRTL","locale","flag","needsRestart","isRTL","forceRTL","loadAppLocaleBundle","url","Promise","resolve","then","path","get","bundle","dateFormat","data","formats","date","timeFormat","time","currencyCode","currency","dateTimeFormat","catch","console","warn","setTimezone","timezone","getTimezone","setSelectedLocale","setItem","getSelectedLocale","i18nService"],"sources":["app-i18n.service.tsx"],"sourcesContent":["import axios, { AxiosResponse } from 'axios';\nimport StorageService from '@wavemaker/app-rn-runtime/core/storage.service';\nimport { isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';\nimport { I18nManager, Platform } from 'react-native';\nimport { I18nService } from '@wavemaker/app-rn-runtime/core/i18n.service';\n\nconst APP_LOCALE_ROOT_PATH = '/resources/i18n';\nconst STORAGE_KEY = 'selectedLocale';\nconst RTL_LANGUAGE_CODES = (()=>{\n const map = {} as any;\n [\"ar\", \"ar-001\", \"ar-ae\", \"ar-bh\", \"ar-dz\", \"ar-eg\", \"ar-iq\", \"ar-jo\", \"ar-kw\", \"ar-lb\",\n \"ar-ly\", \"ar-ma\", \"ar-om\", \"ar-qa\", \"ar-sa\", \"ar-sd\", \"ar-sy\", \"ar-tn\", \"ar-ye\", \"arc\",\n \"bcc\", \"bqi\", \"ckb\", \"dv\", \"fa\", \"glk\", \"he\", \"ku\", \"mzn\", \"pnb\", \"ps\", \"sd\", \"ug\", \"ur\", \"yi\"].forEach(v=>{\n map[v] = true;\n });\n return map;\n })();\n\nclass AppI18nService implements I18nService{\n appLocale: any;\n defaultSupportedLocale = 'en';\n selectedLocale: any;\n dateFormat: string = '';\n timeFormat: string = '';\n dateTimeFormat: string = '';\n currencyCode: string = '';\n timezone: string = '';\n\n constructor() {}\n\n async init() {\n this.selectedLocale = await StorageService.getItem(STORAGE_KEY);\n }\n\n isRTLLocale(newLocale: string = this.selectedLocale){\n return !!(newLocale && RTL_LANGUAGE_CODES[newLocale]);\n }\n\n setRTL(locale?: string){\n const flag = this.isRTLLocale(locale);\n const needsRestart = !isWebPreviewMode() && I18nManager.isRTL !== flag;\n I18nManager.forceRTL(flag);\n return needsRestart; \n }\n\n loadAppLocaleBundle(url: string) {\n return Promise.resolve().then(() => {\n const path = `${url + APP_LOCALE_ROOT_PATH}/${this.selectedLocale}.json`;\n return axios.get(path)\n .then((bundle) => {\n this.dateFormat = bundle.data.formats.date;\n this.timeFormat = bundle.data.formats.time;\n this.currencyCode = bundle.data.formats.currency;\n this.dateTimeFormat = this.dateFormat + ' ' + this.timeFormat;\n return bundle;\n })\n .catch(() => {\n console.warn(`error loading locale resource from ${path}`);\n });\n\n });\n }\n\n setTimezone(timezone: string){\n this.timezone = timezone;\n }\n\n getTimezone(){\n return this.timezone;\n }\n\n setSelectedLocale(locale: string) {\n this.selectedLocale = locale;\n StorageService.setItem(STORAGE_KEY, locale);\n return this.setRTL(locale);\n }\n\n getSelectedLocale() {\n return this.selectedLocale;\n }\n}\n\nconst i18nService = new AppI18nService();\n\nexport default i18nService;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAyB,OAAO;AAC5C,OAAOC,cAAc,MAAM,gDAAgD;AAC3E,SAASC,gBAAgB,QAAQ,sCAAsC;AACvE,SAASC,WAAW,QAAkB,cAAc;AAGpD,MAAMC,oBAAoB,GAAG,iBAAiB;AAC9C,MAAMC,WAAW,GAAG,gBAAgB;AACpC,MAAMC,kBAAkB,GAAG,CAAC,MAAI;EAC9B,MAAMC,GAAG,GAAG,CAAC,CAAQ;EACrB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EACtF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EACrF,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAACC,OAAO,CAACC,CAAC,IAAE;IACzGF,GAAG,CAACE,CAAC,CAAC,GAAG,IAAI;EACf,CAAC,CAAC;EACF,OAAOF,GAAG;AACZ,CAAC,EAAE,CAAC;AAEN,MAAMG,cAAc,CAAuB;EAUvCC,WAAWA,CAAA,EAAG;IAAAC,eAAA;IAAAA,eAAA,iCARW,IAAI;IAAAA,eAAA;IAAAA,eAAA,qBAER,EAAE;IAAAA,eAAA,qBACF,EAAE;IAAAA,eAAA,yBACE,EAAE;IAAAA,e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AqCd,IAAK,EAAC,CAAC;MAC5D,CAAC,CAAC;IAEN,CAAC,CAAC;EACN;EAEAe,WAAWA,CAACC,QAAgB,EAAC;IAC3B,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC1B;EAEAC,WAAWA,CAAA,EAAE;IACX,OAAO,IAAI,CAACD,QAAQ;EACtB;EAEAE,iBAAiBA,CAAC5B,MAAc,EAAE;IAC9B,IAAI,CAACL,cAAc,GAAGK,MAAM;IAC5BlB,cAAc,CAAC+C,OAAO,CAAC3C,WAAW,EAAEc,MAAM,CAAC;IAC3C,OAAO,IAAI,CAACD,MAAM,CAACC,MAAM,CAAC;EAC9B;EAEA8B,iBAAiBA,CAAA,EAAG;IAClB,OAAO,IAAI,CAACnC,cAAc;EAC5B;AACJ;AAEA,MAAMoC,WAAW,GAAG,IAAIxC,cAAc,CAAC,CAAC;AAExC,eAAewC,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["axios","StorageService","isWebPreviewMode","I18nManager","APP_LOCALE_ROOT_PATH","STORAGE_KEY","RTL_LANGUAGE_CODES","map","forEach","v","AppI18nService","constructor","_defineProperty","init","selectedLocale","getItem","isRTLLocale","newLocale","setRTL","locale","flag","needsRestart","isRTL","forceRTL","loadAppLocaleBundle","url","Promise","resolve","then","path","get","bundle","dateFormat","data","formats","date","timeFormat","time","currencyCode","currency","dateTimeFormat","catch","console","warn","appDefaults","setTimezone","timezone","getTimezone","setSelectedLocale","setItem","getSelectedLocale","i18nService"],"sources":["app-i18n.service.tsx"],"sourcesContent":["import axios, { AxiosResponse } from 'axios';\nimport StorageService from '@wavemaker/app-rn-runtime/core/storage.service';\nimport { isWebPreviewMode } from '@wavemaker/app-rn-runtime/core/utils';\nimport { I18nManager, Platform } from 'react-native';\nimport { I18nService } from '@wavemaker/app-rn-runtime/core/i18n.service';\n\nconst APP_LOCALE_ROOT_PATH = '/resources/i18n';\nconst STORAGE_KEY = 'selectedLocale';\nconst RTL_LANGUAGE_CODES = (()=>{\n const map = {} as any;\n [\"ar\", \"ar-001\", \"ar-ae\", \"ar-bh\", \"ar-dz\", \"ar-eg\", \"ar-iq\", \"ar-jo\", \"ar-kw\", \"ar-lb\",\n \"ar-ly\", \"ar-ma\", \"ar-om\", \"ar-qa\", \"ar-sa\", \"ar-sd\", \"ar-sy\", \"ar-tn\", \"ar-ye\", \"arc\",\n \"bcc\", \"bqi\", \"ckb\", \"dv\", \"fa\", \"glk\", \"he\", \"ku\", \"mzn\", \"pnb\", \"ps\", \"sd\", \"ug\", \"ur\", \"yi\"].forEach(v=>{\n map[v] = true;\n });\n return map;\n })();\n\nclass AppI18nService implements I18nService{\n appLocale: any;\n defaultSupportedLocale = 'en';\n selectedLocale: any;\n dateFormat: string = '';\n timeFormat: string = '';\n dateTimeFormat: string = '';\n currencyCode: string = '';\n timezone: string = '';\n\n constructor() {}\n\n async init() {\n this.selectedLocale = await StorageService.getItem(STORAGE_KEY);\n }\n\n isRTLLocale(newLocale: string = this.selectedLocale){\n return !!(newLocale && RTL_LANGUAGE_CODES[newLocale]);\n }\n\n setRTL(locale?: string){\n const flag = this.isRTLLocale(locale);\n const needsRestart = !isWebPreviewMode() && I18nManager.isRTL !== flag;\n I18nManager.forceRTL(flag);\n return needsRestart; \n }\n\n loadAppLocaleBundle(url: string) {\n return Promise.resolve().then(() => {\n const path = `${url + APP_LOCALE_ROOT_PATH}/${this.selectedLocale}.json`;\n return axios.get(path)\n .then((bundle) => {\n this.dateFormat = bundle.data.formats.date;\n this.timeFormat = bundle.data.formats.time;\n this.currencyCode = bundle.data.formats.currency;\n this.dateTimeFormat = this.dateFormat + ' ' + this.timeFormat;\n return bundle;\n })\n .catch(() => {\n console.warn(`error loading locale resource from ${path}`);\n });\n\n });\n }\n\n // app defaults support same as web \n get appDefaults(){\n return {\n dateFormat : this.dateFormat,\n timeFormat : this.timeFormat,\n currencyCode: this.currencyCode,\n dateTimeFormat: this.dateTimeFormat\n }\n }\n\n setTimezone(timezone: string){\n this.timezone = timezone;\n }\n\n getTimezone(){\n return this.timezone;\n }\n\n setSelectedLocale(locale: string) {\n this.selectedLocale = locale;\n StorageService.setItem(STORAGE_KEY, locale);\n return this.setRTL(locale);\n }\n\n getSelectedLocale() {\n return this.selectedLocale;\n }\n}\n\nconst i18nService = new AppI18nService();\n\nexport default i18nService;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAyB,OAAO;AAC5C,OAAOC,cAAc,MAAM,gDAAgD;AAC3E,SAASC,gBAAgB,QAAQ,sCAAsC;AACvE,SAASC,WAAW,QAAkB,cAAc;AAGpD,MAAMC,oBAAoB,GAAG,iBAAiB;AAC9C,MAAMC,WAAW,GAAG,gBAAgB;AACpC,MAAMC,kBAAkB,GAAG,CAAC,MAAI;EAC9B,MAAMC,GAAG,GAAG,CAAC,CAAQ;EACrB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EACtF,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EACrF,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAACC,OAAO,CAACC,CAAC,IAAE;IACzGF,GAAG,CAACE,CAAC,CAAC,GAAG,IAAI;EACf,CAAC,CAAC;EACF,OAAOF,GAAG;AACZ,CAAC,EAAE,CAAC;AAEN,MAAMG,cAAc,CAAuB;EAUvCC,WAAWA,CAAA,EAAG;IAAAC,eAAA;IAAAA,eAAA,iCARW,IAAI;IAAAA,eAAA;IAAAA,eAAA,qBAER,EAAE;IAAAA,eAAA,qBACF,EAAE;IAAAA,eAAA,yBACE,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AAI,CAAC,sCAAsCd,IAAI,EAAE,CAAC;MAC5D,CAAC,CAAC;IAEN,CAAC,CAAC;EACN;;EAEA;EACA,IAAIe,WAAWA,CAAA,EAAE;IACf,OAAO;MACLZ,UAAU,EAAG,IAAI,CAACA,UAAU;MAC5BI,UAAU,EAAG,IAAI,CAACA,UAAU;MAC5BE,YAAY,EAAG,IAAI,CAACA,YAAY;MAChCE,cAAc,EAAE,IAAI,CAACA;IACvB,CAAC;EACH;EAEAK,WAAWA,CAACC,QAAgB,EAAC;IAC3B,IAAI,CAACA,QAAQ,GAAGA,QAAQ;EAC1B;EAEAC,WAAWA,CAAA,EAAE;IACX,OAAO,IAAI,CAACD,QAAQ;EACtB;EAEAE,iBAAiBA,CAAC7B,MAAc,EAAE;IAC9B,IAAI,CAACL,cAAc,GAAGK,MAAM;IAC5BlB,cAAc,CAACgD,OAAO,CAAC5C,WAAW,EAAEc,MAAM,CAAC;IAC3C,OAAO,IAAI,CAACD,MAAM,CAACC,MAAM,CAAC;EAC9B;EAEA+B,iBAAiBA,CAAA,EAAG;IAClB,OAAO,IAAI,CAACpC,cAAc;EAC5B;AACJ;AAEA,MAAMqC,WAAW,GAAG,IAAIzC,cAAc,CAAC,CAAC;AAExC,eAAeyC,WAAW","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["Platform","axios","each","includes","networkService","injector","StorageService","WebProcessService","USER_ROLE","authCookieStr","XSRF_COOKIE_NAME","xsrf_header_name","AppSecurityService","constructor","_defineProperty","interceptors","request","use","config","onBeforeServiceCall","appConfig","getAppConfig","baseUrl","url","getXsrfToken","then","token","_config$url","startsWith","headers","Promise","resolve","getItem","xsrf_token","get","navigateToLandingPage","_this$appConfig$curre","_this$appConfig$logge","currentPage","goToPage","loggedInUser","landingPage","setTimeout","_this$appConfig$curre2","openUrl","appLogin","options","payload","formData","value","name","encodeURIComponent","defaults","withCredentials","post","baseURL","response","xsrfCookieValue","data","setItem","isLoggedIn","load","userData","getLoggedInUserDetails","useDefaultSuccessHandler","app","triggerStartUpVariables","isConnected","getServiceDefinitions","defaultSecurityConfig","details","securityConfig","isSecurityEnabled","securityEnabled","authenticated","_appConfig$appPropert","isAuthenticated","roles","userInfo","userRoles","userName","id","userId","tenantId","userAttributes","dataSet","appProperties","homePage","redirectToLogin","redirectTo","_this$securityConfig","loginConfig","type","authUrl","OS","window","parent","location","href","execute","output","JSON","parse","replace","reject","refresh","_this$securityConfig$","_this$appConfig$curre3","loginPage","pageName","appLogout","catch","canUserAccessPage","_this$securityConfig2","res","status","matchRoles","widgetRoles","some","item","hasAccessToWidget","_this$loggedInUser$da","_this$loggedInUser$da2","_this$loggedInUser$da3","_this$loggedInUser$da4","widgetRolesArr","split","EVERYONE","ANONYMOUS","AUTHENTICATED","appSecurityService"],"sources":["app-security.service.tsx"],"sourcesContent":["import { Platform } from 'react-native';\nimport axios, { InternalAxiosRequestConfig, AxiosResponse } from 'axios';\nimport { each, includes } from 'lodash';\n\nimport networkService from '@wavemaker/app-rn-runtime/core/network.service';\nimport injector from '@wavemaker/app-rn-runtime/core/injector';\nimport AppConfig from '@wavemaker/app-rn-runtime/core/AppConfig';\nimport StorageService from '@wavemaker/app-rn-runtime/core/storage.service';\nimport { SecurityService } from '@wavemaker/app-rn-runtime/core/security.service';\n\nimport WebProcessService from './webprocess.service';\n\ndeclare const window: any;\n\ninterface LoggedInUserConfig {\n isAuthenticated: Boolean;\n isSecurityEnabled: Boolean;\n roles: Array<string>;\n name: String;\n id: String;\n tenantId: String;\n userAttributes: any;\n landingPage: string;\n}\n\nenum USER_ROLE {\n EVERYONE = 'Everyone',\n ANONYMOUS = 'Anonymous',\n AUTHENTICATED = 'Authenticated'\n}\n\nconst authCookieStr = 'AUTH_COOKIE';\nconst XSRF_COOKIE_NAME = 'wm_xsrf_token';\nconst xsrf_header_name = 'X-WM-XSRF-TOKEN';\n\nclass AppSecurityService implements SecurityService {\n\n securityConfig: any;\n isLoggedIn = false;\n loggedInUser: any = {};\n token: any;\n appConfig: any;\n baseUrl: string = '';\n defaultSecurityConfig: any;\n landingPage = '';\n\n constructor() {\n axios.interceptors.request.use((config: InternalAxiosRequestConfig) => this.onBeforeServiceCall(config));\n }\n\n onBeforeServiceCall(config: InternalAxiosRequestConfig) {\n if (!this.appConfig) {\n this.appConfig = this.getAppConfig();\n this.baseUrl = this.appConfig.url;\n }\n return this.getXsrfToken().then((token: string) => {\n if (config.url?.startsWith(this.baseUrl) && token) {\n if(config.headers) config.headers[xsrf_header_name] = token;\n }\n return config\n });\n }\n\n private getXsrfToken(): Promise<string> {\n if (this.token) {\n return Promise.resolve(this.token);\n }\n return StorageService.getItem(XSRF_COOKIE_NAME).then(xsrf_token => {\n this.token = xsrf_token;\n return this.token;\n });\n }\n\n private getAppConfig() {\n return injector.get<AppConfig>('APP_CONFIG');\n }\n\n public navigateToLandingPage() {\n this.appConfig.currentPage?.goToPage(\n this.appConfig.loggedInUser?.landingPage \n || this.appConfig.landingPage \n || 'Main', null, true);\n if (this.landingPage) {\n const landingPage = this.landingPage;\n this.landingPage = '';\n setTimeout(() => {\n this.appConfig.currentPage?.openUrl(landingPage);\n }, 100);\n }\n }\n\n public appLogin(options: any) {\n // encode all parameters\n let payload = '';\n each(options.formData, function (value, name) {\n payload += (payload ? '&' : '') + encodeURIComponent(name) + '=' + encodeURIComponent(value);\n });\n axios.defaults.withCredentials = true;\n return axios.post(options.baseURL + '/j_spring_security_check', payload, {\n withCredentials: true,\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded'\n }}).then((response: AxiosResponse) => {\n const xsrfCookieValue = response.data ? response.data[XSRF_COOKIE_NAME] : '';\n this.token = xsrfCookieValue;\n StorageService.setItem(XSRF_COOKIE_NAME, xsrfCookieValue);\n this.isLoggedIn = true;\n }).then(() => this.load(options.baseURL))\n .then(async () => {\n const userData = await this.getLoggedInUserDetails(options.baseURL, options.useDefaultSuccessHandler);\n await this.appConfig.app.triggerStartUpVariables();\n return userData;\n });\n }\n\n public load(baseURL: string) {\n return Promise.resolve().then(() => {\n if (networkService.isConnected()) {\n return axios.get(baseURL + '/services/security/info')\n .then((response: AxiosResponse) => response.data);\n }\n return this.appConfig.getServiceDefinitions(this.appConfig.url)\n .then(() => Promise.resolve(this.defaultSecurityConfig));\n }).then((details: any) => {\n const loggedInUser = {} as LoggedInUserConfig;\n this.securityConfig = details || {};\n this.securityConfig.isSecurityEnabled = !!details?.securityEnabled;\n const appConfig = this.appConfig;\n if (typeof details !== 'string' && (!details.securityEnabled || details.authenticated)) {\n if (details.authenticated) {\n loggedInUser.isAuthenticated = details.authenticated;\n loggedInUser.isSecurityEnabled = details.authenticated;\n loggedInUser.roles = details.userInfo.userRoles;\n loggedInUser.name = details.userInfo.userName;\n loggedInUser.id = details.userInfo.userId;\n loggedInUser.tenantId = details.userInfo.tenantId;\n loggedInUser.userAttributes = details.userInfo.userAttributes;\n loggedInUser.landingPage = details.userInfo.landingPage;\n appConfig.loggedInUser = loggedInUser;\n this.loggedInUser.dataSet = loggedInUser;\n appConfig.landingPage = appConfig.appProperties?.homePage;\n }\n return appConfig.getServiceDefinitions(appConfig.url)\n .then(() => {\n return details;\n });\n } else {\n return appConfig.getServiceDefinitions(appConfig.url)\n .then(() => {\n this.redirectToLogin();\n });\n }\n });\n }\n\n private getLoggedInUserDetails(baseURL: string, useDefaultSuccessHandler: boolean = true) {\n if (!baseURL) {\n this.loggedInUser = {};\n return Promise.resolve({});\n }\n return this.load(baseURL);\n }\n\n \n public redirectToLogin(redirectTo?: string) {\n if (this.securityConfig?.loginConfig?.type === 'SSO') {\n const authUrl = this.appConfig.url + '/services/security/ssologin';\n if (Platform.OS === 'web') {\n (window.parent || window).location.href = authUrl;\n } else {\n setTimeout(() => {\n WebProcessService.execute('LOGIN', '/services/security/ssologin', false, true)\n .then((output: any) => {\n if (output) {\n return JSON.parse(output.data && output.data.replace(/&quot;/g, \"\\\"\"));\n }\n return Promise.reject();\n }).then((output: any) => {\n if (output[XSRF_COOKIE_NAME]) {\n this.token = output[XSRF_COOKIE_NAME];\n StorageService.setItem(XSRF_COOKIE_NAME, output[XSRF_COOKIE_NAME]);\n }\n }).then(() => {\n this.appConfig.refresh(true);\n }).then(() => this.load(this.baseUrl)).then(() => {\n return this.getLoggedInUserDetails(this.baseUrl);\n });\n }, 1000);\n }\n } else {\n const loginPage = this.securityConfig.loginConfig?.pageName || 'Login';\n if (redirectTo && !redirectTo.startsWith('#/'+ loginPage)) {\n this.landingPage = redirectTo;\n }\n injector.get<AppConfig>('APP_CONFIG').landingPage = loginPage;\n this.appConfig.currentPage?.goToPage(loginPage, null, true);\n }\n this.appConfig.refresh();\n }\n\n public appLogout(options: any) {\n return axios.post(options.baseURL + '/j_spring_security_logout', null, {\n withCredentials: true\n }).catch(() => {}).then(() => {\n this.isLoggedIn = false;\n this.redirectToLogin();\n });\n }\n\n public canUserAccessPage(pageName: string) {\n if (this.baseUrl && this.securityConfig?.isSecurityEnabled) {\n return axios.get(this.baseUrl + `/pages/${pageName}/${pageName}.html`)\n .catch((res) => res)\n .then((res) => res.status === 200 || res.status === 304); \n } else {\n return Promise.resolve(true);\n }\n }\n\n private matchRoles(widgetRoles: Array<String>, userRoles: Array<String>) {\n return widgetRoles.some(function (item) {\n return includes(userRoles, item);\n });\n }\n\n public hasAccessToWidget(widgetRoles: String) {\n const widgetRolesArr = widgetRoles.split(',');\n // access the widget when 'Everyone' is chosen\n if (includes(widgetRolesArr, USER_ROLE.EVERYONE)) {\n return true;\n }\n\n // access the widget when 'Anonymous' is chosen and user is not authenticated\n if (includes(widgetRolesArr, USER_ROLE.ANONYMOUS) && !this.loggedInUser.dataSet?.isAuthenticated) {\n return true;\n }\n\n // access the widget when 'Only Authenticated Users' is chosen and user is authenticated\n if (includes(widgetRolesArr, USER_ROLE.AUTHENTICATED) && this.loggedInUser.dataSet?.isAuthenticated) {\n return true;\n }\n\n // access the widget when widget role and logged in user role matches\n return this.loggedInUser.dataSet?.isAuthenticated && this.matchRoles(widgetRolesArr, this.loggedInUser.dataSet?.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AC6C,OAAO,cAAAuC,sBAAA,uBAAzBA,sBAAA,CAA2B/C,KAAK,CAAC;EAC1H;AACJ;AAEA,MAAMqD,kBAAkB,GAAG,IAAItH,kBAAkB,CAAC,CAAC;AAEnD,eAAesH,kBAAkB","ignoreList":[]}
1
+ {"version":3,"names":["Platform","axios","each","includes","networkService","injector","StorageService","WebProcessService","USER_ROLE","authCookieStr","XSRF_COOKIE_NAME","xsrf_header_name","AppSecurityService","constructor","_defineProperty","interceptors","request","use","config","onBeforeServiceCall","appConfig","getAppConfig","baseUrl","url","getXsrfToken","then","token","_config$url","startsWith","headers","Promise","resolve","getItem","xsrf_token","get","navigateToLandingPage","_this$appConfig$curre","_this$appConfig$logge","currentPage","goToPage","loggedInUser","landingPage","setTimeout","_this$appConfig$curre2","openUrl","appLogin","options","payload","formData","value","name","encodeURIComponent","defaults","withCredentials","post","baseURL","response","xsrfCookieValue","data","setItem","isLoggedIn","load","userData","getLoggedInUserDetails","useDefaultSuccessHandler","app","triggerStartUpVariables","isConnected","getServiceDefinitions","defaultSecurityConfig","details","securityConfig","isSecurityEnabled","securityEnabled","authenticated","_appConfig$appPropert","isAuthenticated","roles","userInfo","userRoles","userName","id","userId","tenantId","userAttributes","dataSet","appProperties","homePage","redirectToLogin","redirectTo","_this$securityConfig","loginConfig","type","authUrl","OS","window","parent","location","href","execute","output","JSON","parse","replace","reject","refresh","_this$securityConfig$","_this$appConfig$curre3","loginPage","pageName","appLogout","catch","canUserAccessPage","_this$securityConfig2","res","status","matchRoles","widgetRoles","some","item","hasAccessToWidget","_this$loggedInUser$da","_this$loggedInUser$da2","_this$loggedInUser$da3","_this$loggedInUser$da4","widgetRolesArr","split","EVERYONE","ANONYMOUS","AUTHENTICATED","appSecurityService"],"sources":["app-security.service.tsx"],"sourcesContent":["import { Platform } from 'react-native';\nimport axios, { InternalAxiosRequestConfig, AxiosResponse } from 'axios';\nimport { each, includes } from 'lodash';\n\nimport networkService from '@wavemaker/app-rn-runtime/core/network.service';\nimport injector from '@wavemaker/app-rn-runtime/core/injector';\nimport AppConfig from '@wavemaker/app-rn-runtime/core/AppConfig';\nimport StorageService from '@wavemaker/app-rn-runtime/core/storage.service';\nimport { SecurityService } from '@wavemaker/app-rn-runtime/core/security.service';\n\nimport WebProcessService from './webprocess.service';\n\ndeclare const window: any;\n\ninterface LoggedInUserConfig {\n isAuthenticated: Boolean;\n isSecurityEnabled: Boolean;\n roles: Array<string>;\n name: String;\n id: String;\n tenantId: String;\n userAttributes: any;\n landingPage: string;\n}\n\nenum USER_ROLE {\n EVERYONE = 'Everyone',\n ANONYMOUS = 'Anonymous',\n AUTHENTICATED = 'Authenticated'\n}\n\nconst authCookieStr = 'AUTH_COOKIE';\nconst XSRF_COOKIE_NAME = 'wm_xsrf_token';\nconst xsrf_header_name = 'X-WM-XSRF-TOKEN';\n\nclass AppSecurityService implements SecurityService {\n\n securityConfig: any;\n isLoggedIn = false;\n loggedInUser: any = {};\n token: any;\n appConfig: any;\n baseUrl: string = '';\n defaultSecurityConfig: any;\n landingPage = '';\n\n constructor() {\n axios.interceptors.request.use((config: InternalAxiosRequestConfig) => this.onBeforeServiceCall(config));\n }\n\n onBeforeServiceCall(config: InternalAxiosRequestConfig) {\n if (!this.appConfig) {\n this.appConfig = this.getAppConfig();\n this.baseUrl = this.appConfig.url;\n }\n return this.getXsrfToken().then((token: string) => {\n if (config.url?.startsWith(this.baseUrl) && token) {\n if(config.headers) config.headers[xsrf_header_name] = token;\n }\n return config\n });\n }\n\n private getXsrfToken(): Promise<string> {\n if (this.token) {\n return Promise.resolve(this.token);\n }\n return StorageService.getItem(XSRF_COOKIE_NAME).then(xsrf_token => {\n this.token = xsrf_token;\n return this.token;\n });\n }\n\n private getAppConfig() {\n return injector.get<AppConfig>('APP_CONFIG');\n }\n\n public navigateToLandingPage() {\n this.appConfig.currentPage?.goToPage(\n this.appConfig.loggedInUser?.landingPage \n || this.appConfig.landingPage \n || 'Main', null, true);\n if (this.landingPage) {\n const landingPage = this.landingPage;\n this.landingPage = '';\n setTimeout(() => {\n this.appConfig.currentPage?.openUrl(landingPage);\n }, 100);\n }\n }\n\n public appLogin(options: any) {\n // encode all parameters\n let payload = '';\n each(options.formData, function (value, name) {\n payload += (payload ? '&' : '') + encodeURIComponent(name) + '=' + encodeURIComponent(value);\n });\n axios.defaults.withCredentials = true;\n return axios.post(options.baseURL + '/j_spring_security_check', payload, {\n withCredentials: true,\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded'\n }}).then((response: AxiosResponse) => {\n const xsrfCookieValue = response.data ? response.data[XSRF_COOKIE_NAME] : '';\n this.token = xsrfCookieValue;\n StorageService.setItem(XSRF_COOKIE_NAME, xsrfCookieValue);\n this.isLoggedIn = true;\n }).then(() => this.load(options.baseURL))\n .then(async () => {\n const userData = await this.getLoggedInUserDetails(options.baseURL, options.useDefaultSuccessHandler);\n await this.appConfig.app.triggerStartUpVariables();\n return userData;\n });\n }\n\n public load(baseURL: string) {\n return Promise.resolve().then(() => {\n if (networkService.isConnected()) {\n return axios.get(baseURL + '/services/security/info')\n .then((response: AxiosResponse) => response.data);\n }\n return this.appConfig.getServiceDefinitions(this.appConfig.url)\n .then(() => Promise.resolve(this.defaultSecurityConfig));\n }).then((details: any) => {\n const loggedInUser = {} as LoggedInUserConfig;\n this.securityConfig = details || {};\n this.securityConfig.isSecurityEnabled = !!details?.securityEnabled;\n const appConfig = this.appConfig;\n if (typeof details !== 'string' && (!details.securityEnabled || details.authenticated)) {\n if (details.authenticated) {\n loggedInUser.isAuthenticated = details.authenticated;\n loggedInUser.isSecurityEnabled = details.authenticated;\n loggedInUser.roles = details.userInfo.userRoles;\n loggedInUser.name = details.userInfo.userName;\n loggedInUser.id = details.userInfo.userId;\n loggedInUser.tenantId = details.userInfo.tenantId;\n loggedInUser.userAttributes = details.userInfo.userAttributes;\n loggedInUser.landingPage = details.userInfo.landingPage;\n appConfig.loggedInUser = loggedInUser;\n this.loggedInUser.dataSet = loggedInUser;\n appConfig.landingPage = appConfig.appProperties?.homePage;\n }\n return appConfig.getServiceDefinitions(appConfig.url)\n .then(() => {\n return details;\n });\n } else {\n return appConfig.getServiceDefinitions(appConfig.url)\n .then(() => {\n this.redirectToLogin();\n });\n }\n });\n }\n\n private getLoggedInUserDetails(baseURL: string, useDefaultSuccessHandler: boolean = true) {\n if (!baseURL) {\n this.loggedInUser = {};\n return Promise.resolve({});\n }\n return this.load(baseURL);\n }\n\n \n public redirectToLogin(redirectTo?: string) {\n if (this.securityConfig?.loginConfig?.type === 'SSO') {\n const authUrl = this.appConfig.url + '/services/security/ssologin';\n if (Platform.OS === 'web') {\n (window.parent || window).location.href = authUrl;\n } else {\n setTimeout(() => {\n WebProcessService.execute('LOGIN', '/services/security/ssologin', false, true)\n .then((output: any) => {\n if (output) {\n return JSON.parse(output.data && output.data.replace(/&quot;/g, \"\\\"\"));\n }\n return Promise.reject();\n }).then((output: any) => {\n if (output[XSRF_COOKIE_NAME]) {\n this.token = output[XSRF_COOKIE_NAME];\n StorageService.setItem(XSRF_COOKIE_NAME, output[XSRF_COOKIE_NAME]);\n }\n }).then(() => {\n this.appConfig.refresh(true);\n }).then(() => this.load(this.baseUrl)).then(() => {\n return this.getLoggedInUserDetails(this.baseUrl);\n });\n }, 1000);\n }\n } else {\n const loginPage = this.securityConfig.loginConfig?.pageName || 'Login';\n if (redirectTo && !redirectTo.startsWith('#/'+ loginPage)) {\n this.landingPage = redirectTo;\n }\n injector.get<AppConfig>('APP_CONFIG').landingPage = loginPage;\n this.appConfig.currentPage?.goToPage(loginPage, null, true);\n }\n this.appConfig.refresh();\n }\n\n public appLogout(options: any) {\n return axios.post(options.baseURL + '/j_spring_security_logout', null, {\n withCredentials: true\n }).catch(() => {}).then(() => {\n this.isLoggedIn = false;\n this.redirectToLogin();\n });\n }\n\n public canUserAccessPage(pageName: string) {\n if (this.baseUrl && this.securityConfig?.isSecurityEnabled) {\n return axios.get(this.baseUrl + `/pages/${pageName}/${pageName}.html`)\n .catch((res) => res)\n .then((res) => res.status === 200 || res.status === 304); \n } else {\n return Promise.resolve(true);\n }\n }\n\n private matchRoles(widgetRoles: Array<String>, userRoles: Array<String>) {\n return widgetRoles.some(function (item) {\n return includes(userRoles, item);\n });\n }\n\n public hasAccessToWidget(widgetRoles: String) {\n const widgetRolesArr = widgetRoles.split(',');\n // access the widget when 'Everyone' is chosen\n if (includes(widgetRolesArr, USER_ROLE.EVERYONE)) {\n return true;\n }\n\n // access the widget when 'Anonymous' is chosen and user is not authenticated\n if (includes(widgetRolesArr, USER_ROLE.ANONYMOUS) && !this.loggedInUser.dataSet?.isAuthenticated) {\n return true;\n }\n\n // access the widget when 'Only Authenticated Users' is chosen and user is authenticated\n if (includes(widgetRolesArr, USER_ROLE.AUTHENTICATED) && this.loggedInUser.dataSet?.isAuthenticated) {\n return true;\n }\n\n // access the widget when widget role and logged in user role matches\n return this.loggedInUser.dataSet?.isAuthenticated && this.matchRoles(widgetRolesArr, this.loggedInUser.dataSet?.roles);\n }\n}\n\nconst appSecurityService = new AppSecurityService();\n\nexport default appSecurityService;\n"],"mappings":";;;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,OAAOC,KAAK,MAAqD,OAAO;AACxE,SAASC,IAAI,EAAEC,QAAQ,QAAQ,QAAQ;AAEvC,OAAOC,cAAc,MAAM,gDAAgD;AAC3E,OAAOC,QAAQ,MAAM,yCAAyC;AAE9D,OAAOC,cAAc,MAAM,gDAAgD;AAG3E,OAAOC,iBAAiB,MAAM,sBAAsB;AAAC,IAehDC,SAAS,0BAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAAA,OAATA,SAAS;AAAA,EAATA,SAAS;AAMd,MAAMC,aAAa,GAAG,aAAa;AACnC,MAAMC,gBAAgB,GAAG,eAAe;AACxC,MAAMC,gBAAgB,GAAG,iBAAiB;AAE1C,MAAMC,kBAAkB,CAA4B;EAWhDC,WAAWA,CAAA,EAAG;IAAAC,eAAA;IAAAA,eAAA,qBARD,KAAK;IAAAA,e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A,IAAI5H,QAAQ,CAAC0H,cAAc,EAAErH,SAAS,CAACwH,SAAS,CAAC,IAAI,GAAAP,qBAAA,GAAC,IAAI,CAACjF,YAAY,CAAC6C,OAAO,cAAAoC,qBAAA,eAAzBA,qBAAA,CAA2B7C,eAAe,GAAE;MAC9F,OAAO,IAAI;IACf;;IAEA;IACA,IAAIzE,QAAQ,CAAC0H,cAAc,EAAErH,SAAS,CAACyH,aAAa,CAAC,KAAAP,sBAAA,GAAI,IAAI,CAAClF,YAAY,CAAC6C,OAAO,cAAAqC,sBAAA,eAAzBA,sBAAA,CAA2B9C,eAAe,EAAE;MACjG,OAAO,IAAI;IACf;;IAEA;IACA,OAAO,EAAA+C,sBAAA,OAAI,CAACnF,YAAY,CAAC6C,OAAO,cAAAsC,sBAAA,uBAAzBA,sBAAA,CAA2B/C,eAAe,KAAI,IAAI,CAACwC,UAAU,CAACS,cAAc,GAAAD,sBAAA,GAAE,IAAI,CAACpF,YAAY,CAAC6C,OAAO,cAAAuC,sBAAA,uBAAzBA,sBAAA,CAA2B/C,KAAK,CAAC;EAC1H;AACJ;AAEA,MAAMqD,kBAAkB,GAAG,IAAItH,kBAAkB,CAAC,CAAC;AAEnD,eAAesH,kBAAkB","ignoreList":[]}
@@ -44,7 +44,6 @@ export class AppSpinnerService {
44
44
  this.count++;
45
45
  }
46
46
  hide() {
47
- this.skeleton = false;
48
47
  if (this.count > 0) {
49
48
  this.count--;
50
49
  } else {
@@ -55,6 +54,7 @@ export class AppSpinnerService {
55
54
  if (!this.count && this.destroy) {
56
55
  this.destroy.call(this.displayManager);
57
56
  this.destroy = null;
57
+ this.skeleton = false;
58
58
  }
59
59
  }, 300);
60
60
  }
@@ -1 +1 @@
1
- {"version":3,"names":["React","View","appDisplayManagerService","WmSpinner","ThemeVariables","AppSpinnerService","constructor","displayManager","_defineProperty","setImage","path","image","setDefaultOptions","options","defaultDisplayOptions","show","skeleton","spinner","loader","count","destroy","setTimeout","content","createElement","Fragment","style","styles","appSpinnerContainer","backgroundColor","INSTANCE","pageContentBgColor","caption","message","classname","lottie","delay","hide","call","justifyContent","alignItems","width","height","opacity","spinnerService"],"sources":["app-spinner.service.tsx"],"sourcesContent":["import React from 'react';\n\nimport { View, ViewStyle } from 'react-native';\n\nimport { SpinnerService, DisplayOptions } from '@wavemaker/app-rn-runtime/core/spinner.service';\nimport { DisplayManager } from '@wavemaker/app-rn-runtime/core/display.manager';\nimport appDisplayManagerService from '@wavemaker/app-rn-runtime/runtime/services/app-display-manager.service';\nimport WmSpinner from '@wavemaker/app-rn-runtime/components/basic/spinner/spinner.component';\nimport ThemeVariables from '@wavemaker/app-rn-runtime/styles/theme.variables';\n\nexport class AppSpinnerService implements SpinnerService {\n public displayOptions = {} as DisplayOptions;\n public destroy: any;\n public delay = 0;\n private count = 0;\n private image: string = '';\n public skeleton: boolean = false;\n private defaultDisplayOptions: DisplayOptions = {} as any;\n constructor(private displayManager: DisplayManager) {}\n\n setImage(path: string) {\n this.image = path;\n }\n\n setDefaultOptions(options: DisplayOptions) {\n this.defaultDisplayOptions = options;\n }\n\n show(options: DisplayOptions = this.defaultDisplayOptions) {\n this.skeleton = options.spinner.loader == 'skeleton';\n if (this.count === 0 && !this.destroy) { \n setTimeout(() => {\n const content = (<>\n {!this.skeleton? \n <View style={[styles.appSpinnerContainer, { backgroundColor: ThemeVariables.INSTANCE.pageContentBgColor }]}>\n <WmSpinner\n caption={options.message || ''}\n classname=\"global-spinner\"\n lottie={options.spinner}></WmSpinner>\n </View> : null}\n </>);\n this.destroy = this.displayManager.show({ content: content });\n }, this.delay);\n }\n this.count++;\n }\n\n hide() {\n this.skeleton = false;\n if (this.count > 0) {\n this.count--;\n } else {\n this.count = 0;\n }\n if (this.count === 0) {\n setTimeout(() => {\n if (!this.count && this.destroy) {\n this.destroy.call(this.displayManager);\n this.destroy = null;\n }\n }, 300);\n }\n }\n}\n\nconst styles = {\n appSpinnerContainer:{ \n justifyContent: 'center', \n alignItems: 'center', \n width:'100%', \n height:'100%', \n opacity: 0.8 \n } as ViewStyle\n}\n\nconst spinnerService = new AppSpinnerService(appDisplayManagerService);\nexport default spinnerService;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,IAAI,QAAmB,cAAc;AAI9C,OAAOC,wBAAwB,MAAM,wEAAwE;AAC7G,OAAOC,SAAS,MAAM,sEAAsE;AAC5F,OAAOC,cAAc,MAAM,kDAAkD;AAE7E,OAAO,MAAMC,iBAAiB,CAA2B;EAQvDC,WAAWA,CAASC,cAA8B,EAAE;IAAA,KAAhCA,cAA8B,GAA9BA,cAA8B;IAAAC,eAAA,yBAP1B,CAAC,CAAC;IAAAA,eAAA;IAAAA,eAAA,gBAEX,CAAC;IAAAA,eAAA,gBACA,CAAC;IAAAA,eAAA,gBACO,EAAE;IAAAA,eAAA,mBACC,KAAK;IAAAA,eAAA,gCACiB,CAAC,CAAC;EACE;EAErDC,QAAQA,CAACC,IAAY,EAAE;IACrB,IAAI,CAACC,KAAK,GAAGD,IAAI;EACnB;EAEAE,iBAAiBA,CAACC,OAAuB,EAAE;IACzC,IAAI,CAACC,qBAAqB,GAAGD,OAAO;EACtC;EAEAE,IAAIA,CAACF,OAAuB,GAAG,IAAI,CAACC,qBAAqB,EAAE;IACzD,IAAI,CAACE,QAAQ,GAAGH,OAAO,CAACI,OAAO,CAACC,MAAM,IAAI,UAAU;IACpD,IAAI,IAAI,CAACC,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAACC,OAAO,EAAE;MACrCC,UAAU,CAAC,MAAM;QACf,MAAMC,OAAO,gBAAItB,KAAA,CAAAuB,aAAA,CAAAvB,KAAA,CAAAwB,QAAA,QACd,CAAC,IAAI,CAACR,QAAQ,gBACbhB,KAAA,CAAAuB,aAAA,CAACtB,IAAI;UAACwB,KAAK,EAAE,CAACC,MAAM,CAACC,mBAAmB,EAAE;YAAEC,eAAe,EAAExB,cAAc,CAACyB,QAAQ,CAACC;UAAmB,CAAC;QAAE,gBACzG9B,KAAA,CAAAuB,aAAA,CAACpB,SAAS;UACR4B,OAAO,EAAElB,OAAO,CAACmB,OAAO,IAAI,EAAG;UAC/BC,SAAS,EAAC,gBAAgB;UAC1BC,MAAM,EAAErB,OAAO,CAACI;QAAQ,CAAY,CAClC,CAAC,GAAG,IACR,CAAE;QACR,IAAI,CAACG,OAAO,GAAG,IAAI,CAACb,cAAc,CAACQ,IAAI,CAAC;UAAEO,OAAO,EAAEA;QAAQ,CAAC,CAAC;MAC/D,CAAC,EAAE,IAAI,CAACa,KAAK,CAAC;IAChB;IACA,IAAI,CAAChB,KAAK,EAAE;EACd;EAEAiB,IAAIA,CAAA,EAAG;IACL,IAAI,CAACpB,QAAQ,GAAG,KAAK;IACrB,IAAI,IAAI,CAACG,KAAK,GAAG,CAAC,EAAE;MAClB,IAAI,CAACA,KAAK,EAAE;IACd,CAAC,MAAM;MACL,IAAI,CAACA,KAAK,GAAG,CAAC;IAChB;IACA,IAAI,IAAI,CAACA,KAAK,KAAK,CAAC,EAAE;MACpBE,UAAU,CAAC,MAAM;QACf,IAAI,CAAC,IAAI,CAACF,KAAK,IAAI,IAAI,CAACC,OAAO,EAAE;UAC/B,IAAI,CAACA,OAAO,CAACiB,IAAI,CAAC,IAAI,CAAC9B,cAAc,CAAC;UACtC,IAAI,CAACa,OAAO,GAAG,IAAI;QACrB;MACF,CAAC,EAAE,GAAG,CAAC;IACT;EACF;AACF;AAEA,MAAMM,MAAM,GAAG;EACbC,mBAAmB,EAAC;IAClBW,cAAc,EAAE,QAAQ;IACxBC,UAAU,EAAE,QAAQ;IACpBC,KAAK,EAAC,MAAM;IACZC,MAAM,EAAC,MAAM;IACbC,OAAO,EAAE;EACX;AACF,CAAC;AAED,MAAMC,cAAc,GAAG,IAAItC,iBAAiB,CAACH,wBAAwB,CAAC;AACtE,eAAeyC,cAAc","ignoreList":[]}
1
+ {"version":3,"names":["React","View","appDisplayManagerService","WmSpinner","ThemeVariables","AppSpinnerService","constructor","displayManager","_defineProperty","setImage","path","image","setDefaultOptions","options","defaultDisplayOptions","show","skeleton","spinner","loader","count","destroy","setTimeout","content","createElement","Fragment","style","styles","appSpinnerContainer","backgroundColor","INSTANCE","pageContentBgColor","caption","message","classname","lottie","delay","hide","call","justifyContent","alignItems","width","height","opacity","spinnerService"],"sources":["app-spinner.service.tsx"],"sourcesContent":["import React from 'react';\n\nimport { View, ViewStyle } from 'react-native';\n\nimport { SpinnerService, DisplayOptions } from '@wavemaker/app-rn-runtime/core/spinner.service';\nimport { DisplayManager } from '@wavemaker/app-rn-runtime/core/display.manager';\nimport appDisplayManagerService from '@wavemaker/app-rn-runtime/runtime/services/app-display-manager.service';\nimport WmSpinner from '@wavemaker/app-rn-runtime/components/basic/spinner/spinner.component';\nimport ThemeVariables from '@wavemaker/app-rn-runtime/styles/theme.variables';\n\nexport class AppSpinnerService implements SpinnerService {\n public displayOptions = {} as DisplayOptions;\n public destroy: any;\n public delay = 0;\n private count = 0;\n private image: string = '';\n public skeleton: boolean = false;\n private defaultDisplayOptions: DisplayOptions = {} as any;\n constructor(private displayManager: DisplayManager) {}\n\n setImage(path: string) {\n this.image = path;\n }\n\n setDefaultOptions(options: DisplayOptions) {\n this.defaultDisplayOptions = options;\n }\n\n show(options: DisplayOptions = this.defaultDisplayOptions) {\n this.skeleton = options.spinner.loader == 'skeleton';\n if (this.count === 0 && !this.destroy) { \n setTimeout(() => {\n const content = (<>\n {!this.skeleton? \n <View style={[styles.appSpinnerContainer, { backgroundColor: ThemeVariables.INSTANCE.pageContentBgColor }]}>\n <WmSpinner\n caption={options.message || ''}\n classname=\"global-spinner\"\n lottie={options.spinner}></WmSpinner>\n </View> : null}\n </>);\n this.destroy = this.displayManager.show({ content: content });\n }, this.delay);\n }\n this.count++;\n }\n\n hide() {\n if (this.count > 0) {\n this.count--;\n } else {\n this.count = 0;\n }\n if (this.count === 0) {\n setTimeout(() => {\n if (!this.count && this.destroy) {\n this.destroy.call(this.displayManager);\n this.destroy = null;\n this.skeleton = false;\n }\n }, 300);\n }\n }\n}\n\nconst styles = {\n appSpinnerContainer:{ \n justifyContent: 'center', \n alignItems: 'center', \n width:'100%', \n height:'100%', \n opacity: 0.8 \n } as ViewStyle\n}\n\nconst spinnerService = new AppSpinnerService(appDisplayManagerService);\nexport default spinnerService;\n"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,IAAI,QAAmB,cAAc;AAI9C,OAAOC,wBAAwB,MAAM,wEAAwE;AAC7G,OAAOC,SAAS,MAAM,sEAAsE;AAC5F,OAAOC,cAAc,MAAM,kDAAkD;AAE7E,OAAO,MAAMC,iBAAiB,CAA2B;EAQvDC,WAAWA,CAASC,cAA8B,EAAE;IAAA,KAAhCA,cAA8B,GAA9BA,cAA8B;IAAAC,eAAA,yBAP1B,CAAC,CAAC;IAAAA,eAAA;IAAAA,eAAA,gBAEX,CAAC;IAAAA,eAAA,gBACA,CAAC;IAAAA,eAAA,gBACO,EAAE;IAAAA,eAAA,mBACC,KAAK;IAAAA,eAAA,gCACiB,CAAC,CAAC;EACE;EAErDC,QAAQA,CAACC,IAAY,EAAE;IACrB,IAAI,CAACC,KAAK,GAAGD,IAAI;EACnB;EAEAE,iBAAiBA,CAACC,OAAuB,EAAE;IACzC,IAAI,CAACC,qBAAqB,GAAGD,OAAO;EACtC;EAEAE,IAAIA,CAACF,OAAuB,GAAG,IAAI,CAACC,qBAAqB,EAAE;IACzD,IAAI,CAACE,QAAQ,GAAGH,OAAO,CAACI,OAAO,CAACC,MAAM,IAAI,UAAU;IACpD,IAAI,IAAI,CAACC,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAACC,OAAO,EAAE;MACrCC,UAAU,CAAC,MAAM;QACf,MAAMC,OAAO,gBAAItB,KAAA,CAAAuB,aAAA,CAAAvB,KAAA,CAAAwB,QAAA,QACd,CAAC,IAAI,CAACR,QAAQ,gBACbhB,KAAA,CAAAuB,aAAA,CAACtB,IAAI;UAACwB,KAAK,EAAE,CAACC,MA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cAAc","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["axios","React","Component","Dimensions","View","WmWebview","injector","AppDisplayManagerService","windowWidth","get","width","windowHeight","height","WebProcessWebViewProps","constructor","_defineProperty","WebProcessWebView","props","getScriptToInject","process","render","createElement","style","src","incognito","styles","root","onLoad","e","w","setTimeout","executeScript","then","output","onComplete","WebProcessService","execute","hookUrl","useSystemBrowser","baseUrl","url","withCredentials","response","executeWithSystemBrowser","data","executeWithInAppBrowser","processInfo","Promise","reject","resolve","destroyFn","show","content","encodeURIComponent","ouput","call"],"sources":["webprocess.service.tsx"],"sourcesContent":["import axios from \"axios\";\nimport React, { Component } from \"react\";\nimport { Dimensions, View } from \"react-native\";\n\nimport WmWebview from \"@wavemaker/app-rn-runtime/components/advanced/webview/webview.component\";\nimport AppConfig from \"@wavemaker/app-rn-runtime/core/AppConfig\";\nimport injector from \"@wavemaker/app-rn-runtime/core/injector\";\n\nimport AppDisplayManagerService from \"./app-display-manager.service\";\n\ndeclare const window: any, document: any, alert: any;\n\nconst windowWidth = Dimensions.get('window').width;\nconst windowHeight = Dimensions.get('window').height;\n\nclass WebProcessWebViewProps {\n src: string = \"\";\n process: string = \"\";\n incognito = false;\n onComplete?: (output: string) => any = null as any;\n}\n \nclass WebProcessWebView extends Component<WebProcessWebViewProps> {\n\n constructor(props: WebProcessWebViewProps) {\n super(props);\n }\n\n private getScriptToInject(process: string): string {\n return `(function() {\n var elements = document.querySelectorAll('body.flex>a.link');\n for (var i = 0; i < elements.length; i++) {\n var href = elements[i].href;\n if (href && href.indexOf('://services/webprocess/${process}?process_output=')) {\n return href.split('process_output=')[1];\n }\n }\n window.isWebLoginProcess = true;\n })()`;\n }\n\n render() {\n return(\n <View style={{\n width: windowWidth,\n height: windowHeight\n }}>\n <WmWebview src={this.props.src}\n incognito={this.props.incognito}\n styles={{\n root: {\n width: '100%',\n height: '100%'\n }\n }}\n onLoad={(e, w) => {\n setTimeout(() => {\n w.executeScript(this.getScriptToInject(this.props.process))\n .then((output) => {\n if (output) {\n const onComplete = this.props.onComplete;\n onComplete && onComplete(output as string);\n }\n });\n }, 1000);\n }}></WmWebview>\n </View>\n );\n }\n}\n\nexport class WebProcessService {\n\n baseUrl: string | null = null;\n\n constructor() {}\n\n public execute(process: string, hookUrl: string, useSystemBrowser = false, incognito = false): Promise<any> {\n if (!this.baseUrl) {\n this.baseUrl = injector.get<AppConfig>('APP_CONFIG').url;\n }\n return axios.get(this.baseUrl + `/services/webprocess/prepare?processName=${process}&hookUrl=${hookUrl}&requestSourceType=MOBILE`, {\n withCredentials: true\n })\n .then((response) => {\n if (useSystemBrowser) {\n return this.executeWithSystemBrowser(response.data);\n } else {\n return this.executeWithInAppBrowser(response.data, process, incognito);\n }\n }).then(output => {\n return axios.get(this.baseUrl + '/services/webprocess/decode?encodedProcessdata=' + output, {\n withCredentials: true\n });\n });\n }\n\n private executeWithSystemBrowser(processInfo: string): Promise<any> {\n return Promise.reject('Web Process in System browser is nor ready yet');\n }\n\n private executeWithInAppBrowser(processInfo: string, process: string, incognito: boolean): Promise<any> {\n return new Promise((resolve, reject) => {\n let destroyFn = () => {};\n destroyFn = AppDisplayManagerService.show({\n content: (\n <WebProcessWebView \n src={this.baseUrl + '/services/webprocess/start?process=' + encodeURIComponent(processInfo)}\n incognito={incognito}\n process={process}\n onComplete={(ouput) => {\n resolve(ouput);\n destroyFn.call(AppDisplayManagerService);\n }}></WebProcessWebView>\n ),\n \n });\n });\n }\n}\n\nexport default new WebProcessService();"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/C,OAAOC,SAAS,MAAM,yEAAyE;AAE/F,OAAOC,QAAQ,MAAM,yCAAyC;AAE9D,OAAOC,wBAAwB,MAAM,+BAA+B;AAIpE,MAAMC,WAAW,GAAGL,UAAU,CAACM,GAAG,CAAC,QAAQ,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GAAGA,CAAA,KAAM,CAAC,CAAC;MACxBA,SAAS,GAAG3C,wBAAwB,CAAC4C,IAAI,CAAC;QACtCC,OAAO,eACLnD,KAAA,CAAAoB,aAAA,CAACL,iBAAiB;UAChBO,GAAG,EAAE,IAAI,CAACgB,OAAO,GAAI,qCAAqC,GAAGc,kBAAkB,CAACP,WAAW,CAAE;UAC7FtB,SAAS,EAAEA,SAAU;UACrBL,OAAO,EAAEA,OAAQ;UACjBe,UAAU,EAAGoB,KAAK,IAAK;YACrBL,OAAO,CAACK,KAAK,CAAC;YACdJ,SAAS,CAACK,IAAI,CAAChD,wBAAwB,CAAC;UAC1C;QAAE,CAAoB;MAG5B,CAAC,CAAC;IACR,CAAC,CAAC;EACN;AACJ;AAEA,eAAe,IAAI4B,iBAAiB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["axios","React","Component","Dimensions","View","WmWebview","injector","AppDisplayManagerService","windowWidth","get","width","windowHeight","height","WebProcessWebViewProps","constructor","_defineProperty","WebProcessWebView","props","getScriptToInject","process","render","createElement","style","src","incognito","styles","root","onLoad","e","w","setTimeout","executeScript","then","output","onComplete","WebProcessService","execute","hookUrl","useSystemBrowser","baseUrl","url","withCredentials","response","executeWithSystemBrowser","data","executeWithInAppBrowser","processInfo","Promise","reject","resolve","destroyFn","show","content","encodeURIComponent","ouput","call"],"sources":["webprocess.service.tsx"],"sourcesContent":["import axios from \"axios\";\nimport React, { Component } from \"react\";\nimport { Dimensions, View } from \"react-native\";\n\nimport WmWebview from \"@wavemaker/app-rn-runtime/components/advanced/webview/webview.component\";\nimport AppConfig from \"@wavemaker/app-rn-runtime/core/AppConfig\";\nimport injector from \"@wavemaker/app-rn-runtime/core/injector\";\n\nimport AppDisplayManagerService from \"./app-display-manager.service\";\n\ndeclare const window: any, document: any, alert: any;\n\nconst windowWidth = Dimensions.get('window').width;\nconst windowHeight = Dimensions.get('window').height;\n\nclass WebProcessWebViewProps {\n src: string = \"\";\n process: string = \"\";\n incognito = false;\n onComplete?: (output: string) => any = null as any;\n}\n \nclass WebProcessWebView extends Component<WebProcessWebViewProps> {\n\n constructor(props: WebProcessWebViewProps) {\n super(props);\n }\n\n private getScriptToInject(process: string): string {\n return `(function() {\n var elements = document.querySelectorAll('body.flex>a.link');\n for (var i = 0; i < elements.length; i++) {\n var href = elements[i].href;\n if (href && href.indexOf('://services/webprocess/${process}?process_output=')) {\n return href.split('process_output=')[1];\n }\n }\n window.isWebLoginProcess = true;\n })()`;\n }\n\n render() {\n return(\n <View style={{\n width: windowWidth,\n height: windowHeight\n }}>\n <WmWebview src={this.props.src}\n incognito={this.props.incognito}\n styles={{\n root: {\n width: '100%',\n height: '100%'\n }\n }}\n onLoad={(e, w) => {\n setTimeout(() => {\n w.executeScript(this.getScriptToInject(this.props.process))\n .then((output) => {\n if (output) {\n const onComplete = this.props.onComplete;\n onComplete && onComplete(output as string);\n }\n });\n }, 1000);\n }}></WmWebview>\n </View>\n );\n }\n}\n\nexport class WebProcessService {\n\n baseUrl: string | null = null;\n\n constructor() {}\n\n public execute(process: string, hookUrl: string, useSystemBrowser = false, incognito = false): Promise<any> {\n if (!this.baseUrl) {\n this.baseUrl = injector.get<AppConfig>('APP_CONFIG').url;\n }\n return axios.get(this.baseUrl + `/services/webprocess/prepare?processName=${process}&hookUrl=${hookUrl}&requestSourceType=MOBILE`, {\n withCredentials: true\n })\n .then((response) => {\n if (useSystemBrowser) {\n return this.executeWithSystemBrowser(response.data);\n } else {\n return this.executeWithInAppBrowser(response.data, process, incognito);\n }\n }).then(output => {\n return axios.get(this.baseUrl + '/services/webprocess/decode?encodedProcessdata=' + output, {\n withCredentials: true\n });\n });\n }\n\n private executeWithSystemBrowser(processInfo: string): Promise<any> {\n return Promise.reject('Web Process in System browser is nor ready yet');\n }\n\n private executeWithInAppBrowser(processInfo: string, process: string, incognito: boolean): Promise<any> {\n return new Promise((resolve, reject) => {\n let destroyFn = () => {};\n destroyFn = AppDisplayManagerService.show({\n content: (\n <WebProcessWebView \n src={this.baseUrl + '/services/webprocess/start?process=' + encodeURIComponent(processInfo)}\n incognito={incognito}\n process={process}\n onComplete={(ouput) => {\n resolve(ouput);\n destroyFn.call(AppDisplayManagerService);\n }}></WebProcessWebView>\n ),\n \n });\n });\n }\n}\n\nexport default new WebProcessService();"],"mappings":";;;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAE/C,OAAOC,SAAS,MAAM,yEAAyE;AAE/F,OAAOC,QAAQ,MAAM,yCAAyC;AAE9D,OAAOC,wBAAwB,MAAM,+BAA+B;AAIpE,MAAMC,WAAW,GAAGL,UAAU,CAACM,GAAG,CAAC,QAAQ,CAAC,CAACC,KAAK;AAClD,MAAMC,YAAY,GAAGR,UAAU,CAACM,GAAG,CAAC,QAAQ,CAAC,CAACG,MAAM;AAEpD,MAAMC,sBAAsB,CAAC;EAAAC,YAAA;IAAAC,eAAA,cACX,EAAE;IAAAA,eAAA,kBACE,EAAE;IAAAA,eAAA,oBACR,KAAK;IAAAA,eAAA,qBACsB,IAAI;EAAA;AAC/C;AAEA,MAAMC,iBAAiB,SAASd,SAAS,CAAyB;EAE9DY,WAAWA,CAACG,KAA6B,EAAE;IACzC,KAAK,CAACA,KAAK,CAAC;EACd;EAEQC,iBAAiBA,CAACC,OAAe,EAAU;IAC/C,OAAO;AACf;AACA;AACA;AACA,mEAAmEA,OAAO;AAC1E;AACA;AACA;AACA;AACA,aAAa;EACT;EAEAC,MAAMA,CAAA,EAAG;IACP,oBACEnB,KAAA,CAAAoB,aAAA,CAACjB,IAAI;MAACkB,KAAK,EAAE;QACXZ,KAAK,EAAEF,WAAW;QAClBI,MAAM,EAAED;MACV;IAAE,gBACAV,KAAA,CAAAoB,aAAA,CAAChB,SAAS;MAACkB,GAAG,EAAE,IAAI,CAACN,KAAK,CAACM,GAAI;MAC7BC,SAAS,EAAE,IAAI,CAAC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O,EAAEK,SAAS,CAAC;MAC1E;IACJ,CAAC,CAAC,CAACQ,IAAI,CAACC,MAAM,IAAI;MACd,OAAOjC,KAAK,CAACS,GAAG,CAAC,IAAI,CAAC8B,OAAO,GAAG,iDAAiD,GAAGN,MAAM,EAAE;QAC1FQ,eAAe,EAAE;MACnB,CAAC,CAAC;IACN,CAAC,CAAC;EACV;EAEQE,wBAAwBA,CAACG,WAAmB,EAAgB;IAChE,OAAOC,OAAO,CAACC,MAAM,CAAC,gDAAgD,CAAC;EAC3E;EAEQH,uBAAuBA,CAACC,WAAmB,EAAE3B,OAAe,EAAEK,SAAkB,EAAgB;IACpG,OAAO,IAAIuB,OAAO,CAAC,CAACE,OAAO,EAAED,MAAM,KAAK;MACpC,IAAIE,SAAS,GAAGA,CAAA,KAAM,CAAC,CAAC;MACxBA,SAAS,GAAG3C,wBAAwB,CAAC4C,IAAI,CAAC;QACtCC,OAAO,eACLnD,KAAA,CAAAoB,aAAA,CAACL,iBAAiB;UAChBO,GAAG,EAAE,IAAI,CAACgB,OAAO,GAAI,qCAAqC,GAAGc,kBAAkB,CAACP,WAAW,CAAE;UAC7FtB,SAAS,EAAEA,SAAU;UACrBL,OAAO,EAAEA,OAAQ;UACjBe,UAAU,EAAGoB,KAAK,IAAK;YACrBL,OAAO,CAACK,KAAK,CAAC;YACdJ,SAAS,CAACK,IAAI,CAAChD,wBAAwB,CAAC;UAC1C;QAAE,CAAoB;MAG5B,CAAC,CAAC;IACR,CAAC,CAAC;EACN;AACJ;AAEA,eAAe,IAAI4B,iBAAiB,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["isArray","clone","useEffect","useState","WIDGET_LOGGER","WATCH_LOGGER","extend","WatchExpression","constructor","fn","onChange","_defineProperty","last","execute","getExpBody","expBody","expStr","toString","substring","indexOf","lastIndexOf","e","isEqual","$old","$new","isArrayObj","length","i","value","check","start","Date","now","changed","lastExecutionTime","debug","Watcher","isActive","expressions","forEach","expression","children","child","create","parent","push","remove","splice","destroy","clear","watch","count","_Watcher","useWatcher","change","watcher"],"sources":["watcher.ts"],"sourcesContent":["import { isEqual as _isEqual, isArray, isObject, clone, remove, reverse, sortBy } from 'lodash';\nimport { useEffect, useMemo, useState } from 'react';\nimport { WIDGET_LOGGER } from '@wavemaker/app-rn-runtime/core/base.component';\n\nconst WATCH_LOGGER = WIDGET_LOGGER.extend(\"watch\");\n\nclass WatchExpression {\n private last: any = null;\n private expBody: string = null as any;\n public lastExecutionTime = 0;\n\n constructor(private fn: Function, private onChange: (prev: any, now: any) => any) {\n this.last = this.execute();\n if (isArray(this.last)) {\n this.last = clone(this.last);\n }\n }\n\n private getExpBody() {\n if (!this.expBody) {\n const expStr = this.fn.toString();\n this.expBody = expStr.substring(\n expStr.indexOf('return ') + 7,\n expStr.lastIndexOf(';'));\n }\n return this.expBody;\n }\n \n private execute() {\n try {\n return this.fn();\n } catch(e) {\n //do nothing\n return null;\n }\n }\n\n private isEqual($old: any, $new: any) {\n const isArrayObj = isArray($old) || isArray($new);\n if (isArrayObj) {\n if (($old && !$new) \n || (!$old && $new)\n || $old.length !== $new.length) {\n return false;\n }\n for(let i = 0; i < $old.length; i++) {\n if ($old[i] !== $new[i]) {\n return false;\n }\n }\n return true;\n }\n return $old === $new;\n }\n\n get value() {\n return this.last;\n }\n\n public check() {\n const start = Date.now();\n const now = this.execute();\n const changed = !this.isEqual(this.last, now);\n this.lastExecutionTime = Date.now() - start;\n if (changed) {\n WATCH_LOGGER.debug(() => {\n if (this.getExpBody() !== 'fragment') {\n return `Watcher: <${this.getExpBody()}> Changed from ${this.last} to ${now} `;\n }\n return '';\n });\n this.onChange(this.last, now);\n this.last = now;\n if (isArray(this.last)) {\n this.last = clone(this.last);\n }\n return true;\n }\n return false;\n }\n}\n\nexport class Watcher {\n public static ROOT = new Watcher();\n public expressions = [] as WatchExpression[];\n public isActive = true;\n public parent: Watcher = null as any;\n public children = [] as Watcher[];\n private constructor() {}\n\n check() {\n if (this.isActive) {\n this.expressions.forEach(expression => expression.check());\n this.children.forEach(child => {\n child.check();\n });\n }\n }\n \n create() {\n const child = new Watcher();\n child.parent = this;\n this.children.push(child);\n return child;\n }\n\n remove(child: Watcher) {\n if (this.children.length > 0) {\n const i = this.children.indexOf(child);\n if (i >= 0) {\n this.children.splice(i, 1);\n }\n }\n }\n\n destroy() {\n this.clear();\n this.parent && this.parent.remove(this);\n }\n\n clear() {\n this.children = [];\n this.expressions = [];\n }\n\n watch(fn: Function, onChange: (prev: any, now: any) => any) {\n const expression = new WatchExpression(fn, onChange);\n this.expressions.push(expression);\n return expression;\n }\n\n count() {\n if (!this.isActive) {\n return 0;\n }\n let count = this.expressions.length;\n this.children.forEach(child => {\n count += child.count();\n });\n return count;\n }\n}\n\nexport function useWatcher(parent: Watcher) {\n const [change, onChange] = useState({});\n let [ watcher ] = useState(() => parent.create());\n watcher.clear();\n useEffect(() => { \n return () => {\n watcher.destroy();\n };\n }, []);\n return {\n watch: (fn: Function) => {\n return watcher.watch(fn, () => onChange({})).value;\n }\n };\n};"],"mappings":";;;;AAAA,SAA8BA,OAAO,EAAYC,KAAK,QAAiC,QAAQ;AAC/F,SAASC,SAAS,EAAWC,QAAQ,QAAQ,OAAO;AACpD,SAASC,aAAa,QAAQ,+CAA+C;AAE7E,MAAMC,YAAY,GAAGD,aAAa,CAACE,MAAM,CAAC,OAAO,CAAC;AAElD,MAAMC,eAAe,CAAC;EAKlBC,WAAWA,CAASC,EAAY,EAAUC,QAAsC,EAAE;IAAA,KAA9DD,EAAY,GAAZA,EAAY;IAAA,KAAUC,QAAsC,GAAtCA,QAAsC;IAAAC,eAAA,eAJ5D,IAAI;IAAAA,eAAA,kBACE,IAAI;IAAAA,eAAA,4BACH,CAAC;IAGxB,IAAI,CAACC,IAAI,GAAG,IAAI,CAACC,OAAO,CAAC,CAAC;IAC1B,IAAIb,OAAO,CAAC,IAAI,CAACY,IAAI,CAAC,EAAE;MACpB,IAAI,CAACA,IAAI,GAAGX,KAAK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AAC,CAAC;IACF,OAAOA,KAAK;EAChB;AACJ;AAACC,QAAA,GA3DYhB,OAAO;AAAAzB,eAAA,CAAPyB,OAAO,UACK,IAAIA,QAAO,CAAC,CAAC;AA4DtC,OAAO,SAASiB,UAAUA,CAACT,MAAe,EAAE;EACxC,MAAM,CAACU,MAAM,EAAE5C,QAAQ,CAAC,GAAGP,QAAQ,CAAC,CAAC,CAAC,CAAC;EACvC,IAAI,CAAEoD,OAAO,CAAE,GAAGpD,QAAQ,CAAC,MAAMyC,MAAM,CAACD,MAAM,CAAC,CAAC,CAAC;EACjDY,OAAO,CAACN,KAAK,CAAC,CAAC;EACf/C,SAAS,CAAC,MAAM;IACZ,OAAO,MAAM;MACTqD,OAAO,CAACP,OAAO,CAAC,CAAC;IACrB,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EACN,OAAO;IACHE,KAAK,EAAGzC,EAAY,IAAK;MACrB,OAAO8C,OAAO,CAACL,KAAK,CAACzC,EAAE,EAAE,MAAMC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAACkB,KAAK;IACtD;EACJ,CAAC;AACL;AAAC","ignoreList":[]}
1
+ {"version":3,"names":["isArray","clone","useEffect","useState","WIDGET_LOGGER","WATCH_LOGGER","extend","WatchExpression","constructor","fn","onChange","_defineProperty","last","execute","getExpBody","expBody","expStr","toString","substring","indexOf","lastIndexOf","e","isEqual","$old","$new","isArrayObj","length","i","value","check","start","Date","now","changed","lastExecutionTime","debug","Watcher","isActive","expressions","forEach","expression","children","child","create","parent","push","remove","splice","destroy","clear","watch","count","_Watcher","useWatcher","change","watcher"],"sources":["watcher.ts"],"sourcesContent":["import { isEqual as _isEqual, isArray, isObject, clone, remove, reverse, sortBy } from 'lodash';\nimport { useEffect, useMemo, useState } from 'react';\nimport { WIDGET_LOGGER } from '@wavemaker/app-rn-runtime/core/base.component';\n\nconst WATCH_LOGGER = WIDGET_LOGGER.extend(\"watch\");\n\nclass WatchExpression {\n private last: any = null;\n private expBody: string = null as any;\n public lastExecutionTime = 0;\n\n constructor(private fn: Function, private onChange: (prev: any, now: any) => any) {\n this.last = this.execute();\n if (isArray(this.last)) {\n this.last = clone(this.last);\n }\n }\n\n private getExpBody() {\n if (!this.expBody) {\n const expStr = this.fn.toString();\n this.expBody = expStr.substring(\n expStr.indexOf('return ') + 7,\n expStr.lastIndexOf(';'));\n }\n return this.expBody;\n }\n \n private execute() {\n try {\n return this.fn();\n } catch(e) {\n //do nothing\n return null;\n }\n }\n\n private isEqual($old: any, $new: any) {\n const isArrayObj = isArray($old) || isArray($new);\n if (isArrayObj) {\n if (($old && !$new) \n || (!$old && $new)\n || $old.length !== $new.length) {\n return false;\n }\n for(let i = 0; i < $old.length; i++) {\n if ($old[i] !== $new[i]) {\n return false;\n }\n }\n return true;\n }\n return $old === $new;\n }\n\n get value() {\n return this.last;\n }\n\n public check() {\n const start = Date.now();\n const now = this.execute();\n const changed = !this.isEqual(this.last, now);\n this.lastExecutionTime = Date.now() - start;\n if (changed) {\n WATCH_LOGGER.debug(() => {\n if (this.getExpBody() !== 'fragment') {\n return `Watcher: <${this.getExpBody()}> Changed from ${this.last} to ${now} `;\n }\n return '';\n });\n this.onChange(this.last, now);\n this.last = now;\n if (isArray(this.last)) {\n this.last = clone(this.last);\n }\n return true;\n }\n return false;\n }\n}\n\nexport class Watcher {\n public static ROOT = new Watcher();\n public expressions = [] as WatchExpression[];\n public isActive = true;\n public parent: Watcher = null as any;\n public children = [] as Watcher[];\n private constructor() {}\n\n check() {\n if (this.isActive) {\n this.expressions.forEach(expression => expression.check());\n this.children.forEach(child => {\n child.check();\n });\n }\n }\n \n create() {\n const child = new Watcher();\n child.parent = this;\n this.children.push(child);\n return child;\n }\n\n remove(child: Watcher) {\n if (this.children.length > 0) {\n const i = this.children.indexOf(child);\n if (i >= 0) {\n this.children.splice(i, 1);\n }\n }\n }\n\n destroy() {\n this.clear();\n this.parent && this.parent.remove(this);\n }\n\n clear() {\n this.children = [];\n this.expressions = [];\n }\n\n watch(fn: Function, onChange: (prev: any, now: any) => any) {\n const expression = new WatchExpression(fn, onChange);\n this.expressions.push(expression);\n return expression;\n }\n\n count() {\n if (!this.isActive) {\n return 0;\n }\n let count = this.expressions.length;\n this.children.forEach(child => {\n count += child.count();\n });\n return count;\n }\n}\n\nexport function useWatcher(parent: Watcher) {\n const [change, onChange] = useState({});\n let [ watcher ] = useState(() => parent.create());\n watcher.clear();\n useEffect(() => { \n return () => {\n watcher.destroy();\n };\n }, []);\n return {\n watch: (fn: Function) => {\n return watcher.watch(fn, () => onChange({})).value;\n }\n };\n};"],"mappings":";;;;AAAA,SAA8BA,OAAO,EAAYC,KAAK,QAAiC,QAAQ;AAC/F,SAASC,SAAS,EAAWC,QAAQ,QAAQ,OAAO;AACpD,SAASC,aAAa,QAAQ,+CAA+C;AAE7E,MAAMC,YAAY,GAAGD,aAAa,CAACE,MAAM,CAAC,OAAO,CAAC;AAElD,MAAMC,eAAe,CAAC;EAKlBC,WAAWA,CAASC,EAAY,EAAUC,QAAsC,EAAE;IAAA,KAA9DD,EAAY,GAAZA,EAAY;IAAA,KAAUC,QAAsC,GAAtCA,QAAsC;IAAAC,eAAA,eAJ5D,IAAI;IAAAA,eAAA,kBACE,IAAI;IAAAA,eAAA,4BACH,CAAC;IAGxB,IAAI,CAACC,IAAI,GAAG,IAAI,CAACC,OAAO,CAAC,CAAC;IAC1B,IAAIb,OAAO,CAAC,IAAI,CAACY,IAAI,CAAC,EAAE;MACpB,IAAI,CAACA,IAAI,GAAGX,KAAK,CAAC,IAAI,CAACW,IAAI,CAAC;IAChC;EACJ;EAEQE,UAAUA,CAAA,EAAG;IACjB,IAAI,CAAC,IAAI,CAACC,OAAO,EAAE;MACf,MAAMC,MAAM,GAAG,IAAI,CAACP,EAAE,CAACQ,QAAQ,CAAC,CAAC;MACjC,IAAI,CAACF,OAAO,GAAGC,MAAM,CAACE,SAAS,CAC3BF,MAAM,CAACG,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,EAC7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AAGpD,QAAQ,CAAC,MAAMyC,MAAM,CAACD,MAAM,CAAC,CAAC,CAAC;EACjDY,OAAO,CAACN,KAAK,CAAC,CAAC;EACf/C,SAAS,CAAC,MAAM;IACZ,OAAO,MAAM;MACTqD,OAAO,CAACP,OAAO,CAAC,CAAC;IACrB,CAAC;EACL,CAAC,EAAE,EAAE,CAAC;EACN,OAAO;IACHE,KAAK,EAAGzC,EAAY,IAAK;MACrB,OAAO8C,OAAO,CAACL,KAAK,CAACzC,EAAE,EAAE,MAAMC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAACkB,KAAK;IACtD;EACJ,CAAC;AACL;AAAC","ignoreList":[]}
@@ -94,6 +94,7 @@ export class LinearGradient extends React.Component {
94
94
  alignItems: 'center'
95
95
  } : null]
96
96
  }, /*#__PURE__*/React.createElement(ExpoLinearGradient, {
97
+ testID: "wm-expo-linear-gradient",
97
98
  colors: this.state.colors,
98
99
  locations: this.state.locations,
99
100
  start: this.state.start,