@kiosinc/commons-rn 0.1.54 → 0.1.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/lib/commonjs/auth/hooks/useTermsOfService.js +60 -0
  2. package/lib/commonjs/auth/hooks/useTermsOfService.js.map +1 -0
  3. package/lib/commonjs/auth/index.js +14 -0
  4. package/lib/commonjs/auth/index.js.map +1 -1
  5. package/lib/commonjs/auth/screens/ChangePassword.js +8 -4
  6. package/lib/commonjs/auth/screens/ChangePassword.js.map +1 -1
  7. package/lib/commonjs/auth/screens/SignUpPassword.js +8 -4
  8. package/lib/commonjs/auth/screens/SignUpPassword.js.map +1 -1
  9. package/lib/commonjs/auth/screens/TermsOfService.js +129 -0
  10. package/lib/commonjs/auth/screens/TermsOfService.js.map +1 -0
  11. package/lib/commonjs/selectBusiness/queryKeys.js +2 -1
  12. package/lib/commonjs/selectBusiness/queryKeys.js.map +1 -1
  13. package/lib/commonjs/utils/index.js +9 -1
  14. package/lib/commonjs/utils/index.js.map +1 -1
  15. package/lib/module/auth/hooks/useTermsOfService.js +52 -0
  16. package/lib/module/auth/hooks/useTermsOfService.js.map +1 -0
  17. package/lib/module/auth/index.js +2 -0
  18. package/lib/module/auth/index.js.map +1 -1
  19. package/lib/module/auth/screens/ChangePassword.js +8 -4
  20. package/lib/module/auth/screens/ChangePassword.js.map +1 -1
  21. package/lib/module/auth/screens/SignUpPassword.js +8 -4
  22. package/lib/module/auth/screens/SignUpPassword.js.map +1 -1
  23. package/lib/module/auth/screens/TermsOfService.js +120 -0
  24. package/lib/module/auth/screens/TermsOfService.js.map +1 -0
  25. package/lib/module/selectBusiness/queryKeys.js +2 -1
  26. package/lib/module/selectBusiness/queryKeys.js.map +1 -1
  27. package/lib/module/utils/index.js +6 -0
  28. package/lib/module/utils/index.js.map +1 -1
  29. package/lib/typescript/src/auth/hooks/useTermsOfService.d.ts +5 -0
  30. package/lib/typescript/src/auth/hooks/useTermsOfService.d.ts.map +1 -0
  31. package/lib/typescript/src/auth/index.d.ts +2 -0
  32. package/lib/typescript/src/auth/index.d.ts.map +1 -1
  33. package/lib/typescript/src/auth/screens/ChangePassword.d.ts.map +1 -1
  34. package/lib/typescript/src/auth/screens/SignUpPassword.d.ts.map +1 -1
  35. package/lib/typescript/src/auth/screens/TermsOfService.d.ts +9 -0
  36. package/lib/typescript/src/auth/screens/TermsOfService.d.ts.map +1 -0
  37. package/lib/typescript/src/selectBusiness/queryKeys.d.ts +1 -0
  38. package/lib/typescript/src/selectBusiness/queryKeys.d.ts.map +1 -1
  39. package/lib/typescript/src/utils/index.d.ts +1 -0
  40. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  41. package/package.json +3 -1
  42. package/src/auth/hooks/useTermsOfService.ts +70 -0
  43. package/src/auth/index.ts +2 -0
  44. package/src/auth/screens/ChangePassword.tsx +7 -3
  45. package/src/auth/screens/SignUpPassword.tsx +7 -3
  46. package/src/auth/screens/TermsOfService.tsx +130 -0
  47. package/src/selectBusiness/queryKeys.ts +1 -0
  48. package/src/utils/index.ts +8 -0
@@ -1 +1 @@
1
- {"version":3,"names":["ParentView","Text","View","Button","KeyboardAvoidingView","TextInput","Header","React","useTranslation","Controller","useForm","yupResolver","passwordVerificationSchema","useAuthentication","SignUpPassword","route","params","t","useVerifyPhoneNumber","mutate","verifyPhoneNumber","isLoading","isVerifyingPhoneNumber","passwordExpectations","handleSubmit","control","formState","errors","isSubmitted","criteriaMode","resolver","defaultValues","password","onSubmit","data","createElement","px","title","flex","alignSelf","justifyContent","width","phone","tablet","render","field","onChange","onBlur","value","passwordErrors","Object","values","types","flat","error","message","my","secureTextEntry","mode","autoComplete","onChangeText","label","pt","map","expectation","index","didExpectationFoundInErrors","includes","flexDirection","alignItems","key","variant","color","name","mt","loading","onPress"],"sourceRoot":"../../../../src","sources":["auth/screens/SignUpPassword.tsx"],"mappings":"AAAA,SACEA,UAAU,EACVC,IAAI,EACJC,IAAI,EACJC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EAC5DM,oBAAoB,CAACwC,GAAG,CAAC,CAACC,WAAW,EAAEC,KAAK,KAAK;QAChD,MAAMC,2BAA2B,GAC/BjB,cAAc,EAAEkB,QAAQ,CAACH,WAAW,CAAC,IAAI,KAAK;QAEhD,oBACEzD,KAAA,CAAA4B,aAAA,CAACjC,IAAI;UAACkE,aAAa,EAAC,KAAK;UAACC,UAAU,EAAC,QAAQ;UAACC,GAAG,EAAEL;QAAM,gBACvD1D,KAAA,CAAA4B,aAAA,CAAClC,IAAI;UACHsE,OAAO,EAAC,WAAW;UACnBC,KAAK,EACH5C,WAAW,GACPsC,2BAA2B,GACzB,OAAO,GACP,SAAS,GACX;QACL,GAEA,KAAK,GAAGF,WACL,CACF,CAAC;MAEX,CAAC,CACG,CAAC;IAEX,CAAE;IACFS,IAAI,EAAC;EAAU,CAChB,CAAC,eACFlE,KAAA,CAAA4B,aAAA,CAAChC,MAAM;IACLuE,EAAE,EAAC,IAAI;IACPC,OAAO,EAAErD,sBAAuB;IAChCoC,IAAI,EAAC,WAAW;IAChBkB,OAAO,EAAEpD,YAAY,CAACS,QAAQ;EAAE,GAE/BhB,CAAC,CAAC,UAAU,CACP,CACY,CAClB,CACI,CAAC;AAEjB,CAAC"}
1
+ {"version":3,"names":["ParentView","Text","View","Button","KeyboardAvoidingView","TextInput","Header","React","useTranslation","Controller","useForm","yupResolver","passwordVerificationSchema","useAuthentication","SignUpPassword","route","params","t","useVerifyPhoneNumber","mutate","verifyPhoneNumber","isLoading","isVerifyingPhoneNumber","passwordExpectations","handleSubmit","control","formState","errors","isDirty","trigger","criteriaMode","resolver","defaultValues","password","onSubmit","data","createElement","px","title","flex","alignSelf","justifyContent","width","phone","tablet","render","field","onChange","onBlur","value","passwordErrors","Object","values","types","flat","error","message","my","secureTextEntry","mode","autoComplete","onChangeText","text","label","pt","map","expectation","index","didExpectationFoundInErrors","includes","flexDirection","alignItems","key","variant","color","name","mt","loading","onPress"],"sourceRoot":"../../../../src","sources":["auth/screens/SignU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E9C,CAAC,CAAC,yBAAyB;MAAE,CACrC,CAAC,eACFV,KAAA,CAAA6B,aAAA,CAACnC,IAAI;QAAC+D,EAAE,EAAC;MAAG,GAAE/C,CAAC,CAAC,oCAAoC,CAAQ,CAAC,EAC5DM,oBAAoB,CAAC0C,GAAG,CAAC,CAACC,WAAW,EAAEC,KAAK,KAAK;QAChD,MAAMC,2BAA2B,GAC/BlB,cAAc,EAAEmB,QAAQ,CAACH,WAAW,CAAC,IAAI,KAAK;QAEhD,oBACE3D,KAAA,CAAA6B,aAAA,CAAClC,IAAI;UAACoE,aAAa,EAAC,KAAK;UAACC,UAAU,EAAC,QAAQ;UAACC,GAAG,EAAEL;QAAM,gBACvD5D,KAAA,CAAA6B,aAAA,CAACnC,IAAI;UACHwE,OAAO,EAAC,WAAW;UACnBC,KAAK,EACH9C,OAAO,GACHwC,2BAA2B,GACzB,OAAO,GACP,SAAS,GACX;QACL,GAEA,KAAK,GAAGF,WACL,CACF,CAAC;MAEX,CAAC,CACG,CAAC;IAEX,CAAE;IACFS,IAAI,EAAC;EAAU,CAChB,CAAC,eACFpE,KAAA,CAAA6B,aAAA,CAACjC,MAAM;IACLyE,EAAE,EAAC,IAAI;IACPC,OAAO,EAAEvD,sBAAuB;IAChCqC,IAAI,EAAC,WAAW;IAChBmB,OAAO,EAAEtD,YAAY,CAACU,QAAQ;EAAE,GAE/BjB,CAAC,CAAC,UAAU,CACP,CACY,CAClB,CACI,CAAC;AAEjB,CAAC"}
@@ -0,0 +1,120 @@
1
+ import { BottomSheet, Button, IconButton, ParentView, Text, View, useSingleSnapBottomSheetRef } from '@kiosinc/commons-rn';
2
+ import React from 'react';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { ActivityIndicator, useTheme } from 'react-native-paper';
5
+ import WebView from 'react-native-webview';
6
+ import { StyleSheet } from 'react-native';
7
+ import { useTermsOfService } from '../hooks/useTermsOfService';
8
+ import { MMKV_KEYS, TERMS_OF_SERVICE } from '../../constants';
9
+ import auth from '@react-native-firebase/auth';
10
+ import FastImage from 'react-native-fast-image';
11
+ import { useQueryClient } from '@tanstack/react-query';
12
+ import { useMMKVString } from 'react-native-mmkv';
13
+ import Config from 'react-native-config';
14
+ export const CloseBottomSheet = ({
15
+ bottomSheetRef
16
+ }) => {
17
+ const [_, setBusinessId] = useMMKVString(MMKV_KEYS.BUSINESS_ID);
18
+ const {
19
+ t
20
+ } = useTranslation();
21
+ const queryClient = useQueryClient();
22
+ const handleLogout = () => {
23
+ auth().signOut().finally(() => {
24
+ Config.APP_NAME !== 'gusteau' && queryClient.clear();
25
+ FastImage.clearMemoryCache();
26
+ FastImage.clearDiskCache();
27
+ setBusinessId(undefined);
28
+ });
29
+ };
30
+ return /*#__PURE__*/React.createElement(BottomSheet, {
31
+ close: bottomSheetRef.close,
32
+ pressBehavior: "close",
33
+ ref: bottomSheetRef.ref
34
+ }, /*#__PURE__*/React.createElement(View, {
35
+ px: "16",
36
+ bg: "background",
37
+ flex: 1,
38
+ my: "16"
39
+ }, /*#__PURE__*/React.createElement(Text, {
40
+ variant: "titleLarge"
41
+ }, t('home.termsOfServiceModal.title')), /*#__PURE__*/React.createElement(Text, {
42
+ pt: "16",
43
+ variant: "bodyMedium",
44
+ color: "secondary"
45
+ }, t('home.termsOfServiceModal.description')), /*#__PURE__*/React.createElement(Button, {
46
+ mode: "contained",
47
+ my: "16",
48
+ onPress: bottomSheetRef.close
49
+ }, t('home.termsOfServiceModal.review')), /*#__PURE__*/React.createElement(Button, {
50
+ mode: "outlined",
51
+ onPress: handleLogout
52
+ }, t('profile.logout'))));
53
+ };
54
+ export const TermsOfService = () => {
55
+ const {
56
+ useAgreeTermsOfService
57
+ } = useTermsOfService();
58
+ const {
59
+ mutate: agreeTermsOfService,
60
+ isLoading
61
+ } = useAgreeTermsOfService();
62
+ const theme = useTheme();
63
+ const bottomSheetRef = useSingleSnapBottomSheetRef();
64
+ const {
65
+ t
66
+ } = useTranslation();
67
+ return /*#__PURE__*/React.createElement(ParentView, {
68
+ flex: 1
69
+ }, /*#__PURE__*/React.createElement(View, {
70
+ flexDirection: "row",
71
+ alignItems: "center"
72
+ }, /*#__PURE__*/React.createElement(IconButton, {
73
+ iconColor: theme.colors.onSurfaceVariant,
74
+ backgroundColor: "transparent",
75
+ icon: "close",
76
+ onPress: bottomSheetRef.expand
77
+ }), /*#__PURE__*/React.createElement(Text, {
78
+ variant: "labelLarge"
79
+ }, t('home.termsTitle'))), /*#__PURE__*/React.createElement(View, {
80
+ style: styles.view,
81
+ mx: "16",
82
+ flex: 1,
83
+ borderWidth: 1,
84
+ borderColor: "onSurfaceDisabled",
85
+ borderRadius: "12",
86
+ padding: "8"
87
+ }, /*#__PURE__*/React.createElement(WebView, {
88
+ startInLoadingState: true,
89
+ renderLoading: () => /*#__PURE__*/React.createElement(View, {
90
+ alignItems: "center",
91
+ bottom: 0,
92
+ justifyContent: "center",
93
+ left: 0,
94
+ position: "absolute",
95
+ right: 0,
96
+ top: 0
97
+ }, /*#__PURE__*/React.createElement(ActivityIndicator, {
98
+ size: "large"
99
+ })),
100
+ javaScriptEnabled: true,
101
+ source: {
102
+ uri: TERMS_OF_SERVICE
103
+ }
104
+ })), /*#__PURE__*/React.createElement(Button, {
105
+ mx: "16",
106
+ mode: "contained",
107
+ my: "16",
108
+ height: 40,
109
+ onPress: () => agreeTermsOfService(),
110
+ loading: isLoading
111
+ }, t('home.acceptTerms')), /*#__PURE__*/React.createElement(CloseBottomSheet, {
112
+ bottomSheetRef: bottomSheetRef
113
+ }));
114
+ };
115
+ const styles = StyleSheet.create({
116
+ view: {
117
+ backgroundColor: 'white'
118
+ }
119
+ });
120
+ //# sourceMappingURL=TermsOfService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["BottomSheet","Button","IconButton","ParentView","Text","View","useSingleSnapBottomSheetRef","React","useTranslation","ActivityIndicator","useTheme","WebView","StyleSheet","useTermsOfService","MMKV_KEYS","TERMS_OF_SERVICE","auth","FastImage","useQueryClient","useMMKVString","Config","CloseBottomSheet","bottomSheetRef","_","setBusinessId","BUSINESS_ID","t","queryClient","handleLogout","signOut","finally","APP_NAME","clear","clearMemoryCache","clearDiskCache","undefined","createElement","close","pressBehavior","ref","px","bg","flex","my","variant","pt","color","mode","onPress","TermsOfService","useAgreeTermsOfService","mutate","agreeTermsOfService","isLoading","theme","flexDirection","alignItems","iconColor","colors","onSurfaceVariant","backgroundColor","icon","expand","style","styles","view","mx","borderWidth","borderColor","borderRadius","padding","startInLoadingState","renderLoading","bottom","justifyContent","left","position","right","top","size","javaScriptEnabled","source","uri","height","loading","create"],"sourceRoot":"../../../../src","sources":["auth/screens/TermsOfService.tsx"],"mappings":"AAAA,SACEA,WAAW,EACXC,MAAM,EACNC,UAAU,EACVC,UAAU,EAEVC,IAAI,EACJC,IAAI,EACJC,2BAA2B,QACtB,qBAAqB;AAC5B,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,cAAc,QAAQ,eAAe;AAC9C,SAASC,iBAAiB,EAAEC,QAAQ,QAAQ,oBAAoB;AAChE,OAAOC,OAAO,MAAM,sBAAsB;AAC1C,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,iBAAiB,QAAQ,4BAA4B;AAC9D,SAASC,SAAS,EAAEC,gBAAgB,QAAQ,iBAAiB;AAC7D,OAAOC,IAAI,MAAM,6BAA6B;AAC9C,OAAOC,SAAS,MAAM,yBAAyB;AAC/C,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAASC,aAAa,QAAQ,mBAAmB;AACjD,OAAOC,MAAM,MAAM,qBAAqB;AAMxC,OAAO,MAAMC,gBAAgB,GAAGA,CAAC;EAAEC;AAAsC,CAAC,KAAK;EAC7E,MAAM,CAACC,CAAC,EAAEC,aAAa,CAAC,GAAGL,aAAa,CAACL,SAAS,CAACW,WAAW,CAAC;EAC/D,MAAM;IAAEC;EAAE,CAAC,GAAGlB,cAAc,CAAC,CAAC;EAC9B,MAAMmB,WAAW,GAAGT,cAAc,CAAC,CAAC;EAEpC,MAA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ACVC,cAAc,EAAC,QAAQ;MACvBC,IAAI,EAAE,CAAE;MACRC,QAAQ,EAAC,UAAU;MACnBC,KAAK,EAAE,CAAE;MACTC,GAAG,EAAE;IAAE,gBAEPvE,KAAA,CAAA6B,aAAA,CAAC3B,iBAAiB;MAACsE,IAAI,EAAC;IAAO,CAAE,CAC7B,CACN;IACFC,iBAAiB,EAAE,IAAK;IACxBC,MAAM,EAAE;MACNC,GAAG,EAAEnE;IACP;EAAE,CACH,CACG,CAAC,eACPR,KAAA,CAAA6B,aAAA,CAACnC,MAAM;IACLiE,EAAE,EAAC,IAAI;IACPnB,IAAI,EAAC,WAAW;IAChBJ,EAAE,EAAC,IAAI;IACPwC,MAAM,EAAE,EAAG;IACXnC,OAAO,EAAEA,CAAA,KAAMI,mBAAmB,CAAC,CAAE;IACrCgC,OAAO,EAAE/B;EAAU,GAElB3B,CAAC,CAAC,kBAAkB,CACf,CAAC,eACTnB,KAAA,CAAA6B,aAAA,CAACf,gBAAgB;IAACC,cAAc,EAAEA;EAAe,CAAE,CACzC,CAAC;AAEjB,CAAC;AAED,MAAM0C,MAAM,GAAGpD,UAAU,CAACyE,MAAM,CAAC;EAC/BpB,IAAI,EAAE;IAAEL,eAAe,EAAE;EAAQ;AACnC,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export const queryKeys = {
2
- BUSINESSES: 'BUSINESSES'
2
+ BUSINESSES: 'BUSINESSES',
3
+ TERMS_AND_CONDITIONS: 'TERMS_AND_CONDITIONS'
3
4
  };
4
5
  export const DEFAULT_STALE_TIME = 60 * (60 * 1000); // 60 mins
5
6
  //# sourceMappingURL=queryKeys.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["queryKeys","BUSINESSES","DEFAULT_STALE_TIME"],"sourceRoot":"../../../src","sources":["selectBusiness/queryKeys.ts"],"mappings":"AAAA,OAAO,MAAMA,SAAS,GAAG;EACvBC,UAAU,EAAE;AACd,CAAC;AAED,OAAO,MAAMC,kBAAkB,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC"}
1
+ {"version":3,"names":["queryKeys","BUSINESSES","TERMS_AND_CONDITIONS","DEFAULT_STALE_TIME"],"sourceRoot":"../../../src","sources":["selectBusiness/queryKeys.ts"],"mappings":"AAAA,OAAO,MAAMA,SAAS,GAAG;EACvBC,UAAU,EAAE,YAAY;EACxBC,oBAAoB,EAAE;AACxB,CAAC;AAED,OAAO,MAAMC,kBAAkB,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC"}
@@ -1,7 +1,13 @@
1
1
  import { Dimensions } from 'react-native';
2
2
  import { initialWindowMetrics } from 'react-native-safe-area-context';
3
+ import firestore from '@react-native-firebase/firestore';
3
4
  export const getPercentageFromHeight = height => {
4
5
  const totalHeight = Dimensions.get('window').height - (initialWindowMetrics?.insets?.top ?? 0) - (initialWindowMetrics?.insets?.bottom ?? 0);
5
6
  return Math.ceil(height / totalHeight * 100) + '%';
6
7
  };
8
+ export const getCurrentTimestamp = () => {
9
+ const firestoreTimestamp = firestore.Timestamp.now().toDate();
10
+ const formattedTimestamp = firestoreTimestamp.toISOString();
11
+ return formattedTimestamp;
12
+ };
7
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Dimensions","initialWindowMetrics","getPercentageFromHeight","height","totalHeight","get","insets","top","bottom","Math","ceil"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,oBAAoB,QAAQ,gCAAgC;AAErE,OAAO,MAAMC,uBAAuB,GAAIC,MAAc,IAAa;EACjE,MAAMC,WAAW,GACfJ,UAAU,CAACK,GAAG,CAAC,QAAQ,CAAC,CAACF,MAAM,IAC9BF,oBAAoB,EAAEK,MAAM,EAAEC,GAAG,IAAI,CAAC,CAAC,IACvCN,oBAAoB,EAAEK,MAAM,EAAEE,MAAM,IAAI,CAAC,CAAC;EAE7C,OAAOC,IAAI,CAACC,IAAI,CAAEP,MAAM,GAAGC,WAAW,GAAI,GAAG,CAAC,GAAG,GAAG;AACtD,CAAC"}
1
+ {"version":3,"names":["Dimensions","initialWindowMetrics","firestore","getPercentageFromHeight","height","totalHeight","get","insets","top","bottom","Math","ceil","getCurrentTimestamp","firestoreTimestamp","Timestamp","now","toDate","formattedTimestamp","toISOString"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":"AAAA,SAASA,UAAU,QAAQ,cAAc;AACzC,SAASC,oBAAoB,QAAQ,gCAAgC;AACrE,OAAOC,SAAS,MAAM,kCAAkC;AAExD,OAAO,MAAMC,uBAAuB,GAAIC,MAAc,IAAa;EACjE,MAAMC,WAAW,GACfL,UAAU,CAACM,GAAG,CAAC,QAAQ,CAAC,CAACF,MAAM,IAC9BH,oBAAoB,EAAEM,MAAM,EAAEC,GAAG,IAAI,CAAC,CAAC,IACvCP,oBAAoB,EAAEM,MAAM,EAAEE,MAAM,IAAI,CAAC,CAAC;EAE7C,OAAOC,IAAI,CAACC,IAAI,CAAEP,MAAM,GAAGC,WAAW,GAAI,GAAG,CAAC,GAAG,GAAG;AACtD,CAAC;AAED,OAAO,MAAMO,mBAAmB,GAAGA,CAAA,KAAM;EACvC,MAAMC,kBAAkB,GAAGX,SAAS,CAACY,SAAS,CAACC,GAAG,CAAC,CAAC,CAACC,MAAM,CAAC,CAAC;EAC7D,MAAMC,kBAAkB,GAAGJ,kBAAkB,CAACK,WAAW,CAAC,CAAC;EAE3D,OAAOD,kBAAkB;AAC3B,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const useTermsOfService: () => {
2
+ useShouldShowTermsOfService: () => import("@tanstack/react-query").UseQueryResult<boolean, unknown>;
3
+ useAgreeTermsOfService: () => import("@tanstack/react-query").UseMutationResult<void, unknown, void, unknown>;
4
+ };
5
+ //# sourceMappingURL=useTermsOfService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTermsOfService.d.ts","sourceRoot":"","sources":["../../../../../src/auth/hooks/useTermsOfService.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB;;;CA+D7B,CAAC"}
@@ -2,4 +2,6 @@ export { renderAuthNavigator, renderAppNavigator } from './screens';
2
2
  export { useAuthentication, useAuthenticationDispatch, changeUser, } from './providers/authentication';
3
3
  export { AuthenticationProvider } from './providers/authentication';
4
4
  export { useDeactivateAccount } from './hooks/useDeactivateAccount';
5
+ export { useTermsOfService } from './hooks/useTermsOfService';
6
+ export { TermsOfService } from './screens/TermsOfService';
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,UAAU,GACX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,EACL,iBAAiB,EACjB,yBAAyB,EACzB,UAAU,GACX,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ChangePassword.d.ts","sourceRoot":"","sources":["../../../../../src/auth/screens/ChangePassword.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAgBxC,OAAO,EAAE,SAAS,EAAiB,MAAM,0BAA0B,CAAC;AAIpE,MAAM,MAAM,aAAa,GAAG;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,SAAS,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;CACnD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAgJxD,CAAC"}
1
+ {"version":3,"file":"ChangePassword.d.ts","sourceRoot":"","sources":["../../../../../src/auth/screens/ChangePassword.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAgBxC,OAAO,EAAE,SAAS,EAAiB,MAAM,0BAA0B,CAAC;AAIpE,MAAM,MAAM,aAAa,GAAG;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,SAAS,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;CACnD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAoJxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SignUpPassword.d.ts","sourceRoot":"","sources":["../../../../../src/auth/screens/SignUpPassword.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,SAAS,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;CACnD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAqGxD,CAAC"}
1
+ {"version":3,"file":"SignUpPassword.d.ts","sourceRoot":"","sources":["../../../../../src/auth/screens/SignUpPassword.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,KAAK,mBAAmB,GAAG;IACzB,KAAK,EAAE,SAAS,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC;CACnD,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAyGxD,CAAC"}
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { TSingleSnapBottomSheetRef } from '@kiosinc/commons-rn';
3
+ type CloseBottomSheetProps = {
4
+ bottomSheetRef: TSingleSnapBottomSheetRef;
5
+ };
6
+ export declare const CloseBottomSheet: ({ bottomSheetRef }: CloseBottomSheetProps) => JSX.Element;
7
+ export declare const TermsOfService: () => JSX.Element;
8
+ export {};
9
+ //# sourceMappingURL=TermsOfService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TermsOfService.d.ts","sourceRoot":"","sources":["../../../../../src/auth/screens/TermsOfService.tsx"],"names":[],"mappings":";AAAA,OAAO,EAKL,yBAAyB,EAI1B,MAAM,qBAAqB,CAAC;AAc7B,KAAK,qBAAqB,GAAG;IAC3B,cAAc,EAAE,yBAAyB,CAAC;CAC3C,CAAC;AAEF,eAAO,MAAM,gBAAgB,uBAAwB,qBAAqB,gBAmCzE,CAAC;AAEF,eAAO,MAAM,cAAc,mBA6D1B,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export declare const queryKeys: {
2
2
  BUSINESSES: string;
3
+ TERMS_AND_CONDITIONS: string;
3
4
  };
4
5
  export declare const DEFAULT_STALE_TIME: number;
5
6
  //# sourceMappingURL=queryKeys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"queryKeys.d.ts","sourceRoot":"","sources":["../../../../src/selectBusiness/queryKeys.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;CAErB,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAmB,CAAC"}
1
+ {"version":3,"file":"queryKeys.d.ts","sourceRoot":"","sources":["../../../../src/selectBusiness/queryKeys.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS;;;CAGrB,CAAC;AAEF,eAAO,MAAM,kBAAkB,QAAmB,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export declare const getPercentageFromHeight: (height: number) => string;
2
+ export declare const getCurrentTimestamp: () => any;
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,uBAAuB,WAAY,MAAM,KAAG,MAOxD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,uBAAuB,WAAY,MAAM,KAAG,MAOxD,CAAC;AAEF,eAAO,MAAM,mBAAmB,WAK/B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiosinc/commons-rn",
3
- "version": "0.1.54",
3
+ "version": "0.1.56",
4
4
  "description": "Common Code",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -183,6 +183,7 @@
183
183
  "dependencies": {
184
184
  "@gorhom/bottom-sheet": "^4.6.1",
185
185
  "@hookform/resolvers": "^3.3.2",
186
+ "@react-native-firebase/firestore": "^19.2.2",
186
187
  "@react-navigation/material-top-tabs": "^6.6.13",
187
188
  "@shopify/restyle": "^2.4.2",
188
189
  "@tanstack/react-query": "^4.32.6",
@@ -199,6 +200,7 @@
199
200
  "react-native-paper": "^5.11.1",
200
201
  "react-native-size-matters": "^0.4.2",
201
202
  "react-native-video": "^5.2.1",
203
+ "react-native-webview": "^13.10.2",
202
204
  "yup": "^1.3.2"
203
205
  }
204
206
  }
@@ -0,0 +1,70 @@
1
+ import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
2
+ import firestore from '@react-native-firebase/firestore';
3
+ import { DEFAULT_STALE_TIME, queryKeys } from '../../selectBusiness/queryKeys';
4
+ import { useAuthentication } from '../providers/authentication';
5
+ import { getCurrentTimestamp } from '../../utils';
6
+
7
+ export const useTermsOfService = () => {
8
+ const queryClient = useQueryClient();
9
+ const { user } = useAuthentication();
10
+
11
+ return {
12
+ useShouldShowTermsOfService: () =>
13
+ useQuery(
14
+ [user?.uid, queryKeys.TERMS_AND_CONDITIONS],
15
+ async () => {
16
+ if (!user?.uid) return false;
17
+ const customerSnapshot = await firestore()
18
+ .doc(`customers/${user.uid}`)
19
+ .get();
20
+
21
+ if (customerSnapshot.exists) {
22
+ const customer = customerSnapshot.data();
23
+
24
+ if (!customer.agreementsUpdated) {
25
+ return true;
26
+ } else {
27
+ const system = (
28
+ await firestore().doc('_firebase_ext_/agreements').get()
29
+ ).data() as { updated: string };
30
+
31
+ if (
32
+ new Date(system.updated) > new Date(customer.agreementsUpdated)
33
+ ) {
34
+ return true;
35
+ }
36
+ }
37
+ } else {
38
+ return true;
39
+ }
40
+ return false;
41
+ },
42
+ {
43
+ staleTime: DEFAULT_STALE_TIME,
44
+ }
45
+ ),
46
+ useAgreeTermsOfService: () =>
47
+ useMutation(async () => {
48
+ if (!user?.uid) return;
49
+ const query = await firestore().doc(`customers/${user.uid}`);
50
+ const customerSnapshot = await query.get();
51
+
52
+ if (customerSnapshot.exists) {
53
+ await query.update({
54
+ updated: getCurrentTimestamp(),
55
+ agreementsUpdated: new Date().toISOString(),
56
+ });
57
+ } else {
58
+ await query.set({
59
+ uid: user.uid,
60
+ created: getCurrentTimestamp(),
61
+ agreementsUpdated: new Date().toISOString(),
62
+ });
63
+ }
64
+ await queryClient.invalidateQueries([
65
+ user.uid,
66
+ queryKeys.TERMS_AND_CONDITIONS,
67
+ ]);
68
+ }),
69
+ };
70
+ };
package/src/auth/index.ts CHANGED
@@ -6,3 +6,5 @@ export {
6
6
  } from './providers/authentication';
7
7
  export { AuthenticationProvider } from './providers/authentication';
8
8
  export { useDeactivateAccount } from './hooks/useDeactivateAccount';
9
+ export { useTermsOfService } from './hooks/useTermsOfService';
10
+ export { TermsOfService } from './screens/TermsOfService';
@@ -34,7 +34,8 @@ export const ChangePassword: React.FC<ChangePasswordProps> = ({ route }) => {
34
34
  const {
35
35
  handleSubmit,
36
36
  control,
37
- formState: { errors, isSubmitted },
37
+ formState: { errors, isDirty },
38
+ trigger,
38
39
  } = useForm<TPasswordForm>({
39
40
  criteriaMode: 'all',
40
41
  resolver: yupResolver(changePasswordSchema(t)),
@@ -127,7 +128,10 @@ export const ChangePassword: React.FC<ChangePasswordProps> = ({ route }) => {
127
128
  mode="outlined"
128
129
  autoComplete="new-password"
129
130
  onBlur={onBlur}
130
- onChangeText={onChange}
131
+ onChangeText={(text) => {
132
+ onChange(text);
133
+ trigger();
134
+ }}
131
135
  value={value}
132
136
  label={t('authentication.password')}
133
137
  />
@@ -141,7 +145,7 @@ export const ChangePassword: React.FC<ChangePasswordProps> = ({ route }) => {
141
145
  <Text
142
146
  variant="bodySmall"
143
147
  color={
144
- isSubmitted
148
+ isDirty
145
149
  ? didExpectationFoundInErrors
146
150
  ? 'error'
147
151
  : 'primary'
@@ -40,7 +40,8 @@ export const SignUpPassword: React.FC<SignUpPasswordProps> = ({ route }) => {
40
40
  const {
41
41
  handleSubmit,
42
42
  control,
43
- formState: { errors, isSubmitted },
43
+ formState: { errors, isDirty },
44
+ trigger,
44
45
  } = useForm<FormData>({
45
46
  criteriaMode: 'all',
46
47
  resolver: yupResolver(passwordVerificationSchema(t)),
@@ -81,7 +82,10 @@ export const SignUpPassword: React.FC<SignUpPasswordProps> = ({ route }) => {
81
82
  mode="outlined"
82
83
  autoComplete="new-password"
83
84
  onBlur={onBlur}
84
- onChangeText={onChange}
85
+ onChangeText={(text) => {
86
+ onChange(text);
87
+ trigger();
88
+ }}
85
89
  value={value}
86
90
  label={t('authentication.password')}
87
91
  />
@@ -95,7 +99,7 @@ export const SignUpPassword: React.FC<SignUpPasswordProps> = ({ route }) => {
95
99
  <Text
96
100
  variant="bodySmall"
97
101
  color={
98
- isSubmitted
102
+ isDirty
99
103
  ? didExpectationFoundInErrors
100
104
  ? 'error'
101
105
  : 'primary'
@@ -0,0 +1,130 @@
1
+ import {
2
+ BottomSheet,
3
+ Button,
4
+ IconButton,
5
+ ParentView,
6
+ TSingleSnapBottomSheetRef,
7
+ Text,
8
+ View,
9
+ useSingleSnapBottomSheetRef,
10
+ } from '@kiosinc/commons-rn';
11
+ import React from 'react';
12
+ import { useTranslation } from 'react-i18next';
13
+ import { ActivityIndicator, useTheme } from 'react-native-paper';
14
+ import WebView from 'react-native-webview';
15
+ import { StyleSheet } from 'react-native';
16
+ import { useTermsOfService } from '../hooks/useTermsOfService';
17
+ import { MMKV_KEYS, TERMS_OF_SERVICE } from '../../constants';
18
+ import auth from '@react-native-firebase/auth';
19
+ import FastImage from 'react-native-fast-image';
20
+ import { useQueryClient } from '@tanstack/react-query';
21
+ import { useMMKVString } from 'react-native-mmkv';
22
+ import Config from 'react-native-config';
23
+
24
+ type CloseBottomSheetProps = {
25
+ bottomSheetRef: TSingleSnapBottomSheetRef;
26
+ };
27
+
28
+ export const CloseBottomSheet = ({ bottomSheetRef }: CloseBottomSheetProps) => {
29
+ const [_, setBusinessId] = useMMKVString(MMKV_KEYS.BUSINESS_ID);
30
+ const { t } = useTranslation();
31
+ const queryClient = useQueryClient();
32
+
33
+ const handleLogout = () => {
34
+ auth()
35
+ .signOut()
36
+ .finally(() => {
37
+ Config.APP_NAME !== 'gusteau' && queryClient.clear();
38
+ FastImage.clearMemoryCache();
39
+ FastImage.clearDiskCache();
40
+ setBusinessId(undefined);
41
+ });
42
+ };
43
+ return (
44
+ <BottomSheet
45
+ close={bottomSheetRef.close}
46
+ pressBehavior="close"
47
+ ref={bottomSheetRef.ref}
48
+ >
49
+ <View px="16" bg="background" flex={1} my="16">
50
+ <Text variant="titleLarge">{t('home.termsOfServiceModal.title')}</Text>
51
+ <Text pt="16" variant="bodyMedium" color="secondary">
52
+ {t('home.termsOfServiceModal.description')}
53
+ </Text>
54
+ <Button mode="contained" my="16" onPress={bottomSheetRef.close}>
55
+ {t('home.termsOfServiceModal.review')}
56
+ </Button>
57
+ <Button mode="outlined" onPress={handleLogout}>
58
+ {t('profile.logout')}
59
+ </Button>
60
+ </View>
61
+ </BottomSheet>
62
+ );
63
+ };
64
+
65
+ export const TermsOfService = () => {
66
+ const { useAgreeTermsOfService } = useTermsOfService();
67
+ const { mutate: agreeTermsOfService, isLoading } = useAgreeTermsOfService();
68
+ const theme = useTheme();
69
+ const bottomSheetRef = useSingleSnapBottomSheetRef();
70
+ const { t } = useTranslation();
71
+
72
+ return (
73
+ <ParentView flex={1}>
74
+ <View flexDirection="row" alignItems="center">
75
+ <IconButton
76
+ iconColor={theme.colors.onSurfaceVariant}
77
+ backgroundColor="transparent"
78
+ icon="close"
79
+ onPress={bottomSheetRef.expand}
80
+ />
81
+ <Text variant="labelLarge">{t('home.termsTitle')}</Text>
82
+ </View>
83
+ <View
84
+ style={styles.view}
85
+ mx="16"
86
+ flex={1}
87
+ borderWidth={1}
88
+ borderColor="onSurfaceDisabled"
89
+ borderRadius="12"
90
+ padding="8"
91
+ >
92
+ <WebView
93
+ startInLoadingState
94
+ renderLoading={() => (
95
+ <View
96
+ alignItems="center"
97
+ bottom={0}
98
+ justifyContent="center"
99
+ left={0}
100
+ position="absolute"
101
+ right={0}
102
+ top={0}
103
+ >
104
+ <ActivityIndicator size="large" />
105
+ </View>
106
+ )}
107
+ javaScriptEnabled={true}
108
+ source={{
109
+ uri: TERMS_OF_SERVICE,
110
+ }}
111
+ />
112
+ </View>
113
+ <Button
114
+ mx="16"
115
+ mode="contained"
116
+ my="16"
117
+ height={40}
118
+ onPress={() => agreeTermsOfService()}
119
+ loading={isLoading}
120
+ >
121
+ {t('home.acceptTerms')}
122
+ </Button>
123
+ <CloseBottomSheet bottomSheetRef={bottomSheetRef} />
124
+ </ParentView>
125
+ );
126
+ };
127
+
128
+ const styles = StyleSheet.create({
129
+ view: { backgroundColor: 'white' },
130
+ });
@@ -1,5 +1,6 @@
1
1
  export const queryKeys = {
2
2
  BUSINESSES: 'BUSINESSES',
3
+ TERMS_AND_CONDITIONS: 'TERMS_AND_CONDITIONS',
3
4
  };
4
5
 
5
6
  export const DEFAULT_STALE_TIME = 60 * (60 * 1000); // 60 mins
@@ -1,5 +1,6 @@
1
1
  import { Dimensions } from 'react-native';
2
2
  import { initialWindowMetrics } from 'react-native-safe-area-context';
3
+ import firestore from '@react-native-firebase/firestore';
3
4
 
4
5
  export const getPercentageFromHeight = (height: number): string => {
5
6
  const totalHeight =
@@ -9,3 +10,10 @@ export const getPercentageFromHeight = (height: number): string => {
9
10
 
10
11
  return Math.ceil((height / totalHeight) * 100) + '%';
11
12
  };
13
+
14
+ export const getCurrentTimestamp = () => {
15
+ const firestoreTimestamp = firestore.Timestamp.now().toDate();
16
+ const formattedTimestamp = firestoreTimestamp.toISOString();
17
+
18
+ return formattedTimestamp;
19
+ };