@planningcenter/chat-react-native 1.4.1 → 1.4.2-qa-84.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/display/heading.d.ts +8 -0
- package/build/components/display/heading.d.ts.map +1 -0
- package/build/components/display/heading.js +53 -0
- package/build/components/display/heading.js.map +1 -0
- package/build/components/display/index.d.ts +1 -0
- package/build/components/display/index.d.ts.map +1 -1
- package/build/components/display/index.js +1 -0
- package/build/components/display/index.js.map +1 -1
- package/build/components/display/text.d.ts.map +1 -1
- package/build/components/display/text.js +5 -4
- package/build/components/display/text.js.map +1 -1
- package/build/components/index.d.ts +3 -0
- package/build/components/index.d.ts.map +1 -0
- package/build/components/index.js +3 -0
- package/build/components/index.js.map +1 -0
- package/build/contexts/api_provider.d.ts.map +1 -1
- package/build/contexts/api_provider.js +7 -15
- package/build/contexts/api_provider.js.map +1 -1
- package/build/contexts/index.d.ts +3 -0
- package/build/contexts/index.d.ts.map +1 -0
- package/build/contexts/index.js +3 -0
- package/build/contexts/index.js.map +1 -0
- package/build/hooks/index.d.ts +2 -1
- package/build/hooks/index.d.ts.map +1 -1
- package/build/hooks/index.js +2 -1
- package/build/hooks/index.js.map +1 -1
- package/build/index.d.ts +4 -6
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -4
- package/build/index.js.map +1 -1
- package/build/screens/display.d.ts.map +1 -1
- package/build/screens/display.js +12 -5
- package/build/screens/display.js.map +1 -1
- package/build/utils/api.d.ts +9 -0
- package/build/utils/api.d.ts.map +1 -0
- package/build/utils/api.js +36 -0
- package/build/utils/api.js.map +1 -0
- package/build/utils/index.d.ts +3 -0
- package/build/utils/index.d.ts.map +1 -0
- package/build/utils/index.js +3 -0
- package/build/utils/index.js.map +1 -0
- package/build/utils/platform_styles.d.ts +2 -0
- package/build/utils/platform_styles.d.ts.map +1 -0
- package/build/utils/platform_styles.js +7 -0
- package/build/utils/platform_styles.js.map +1 -0
- package/build/utils/session.d.ts +2 -0
- package/build/utils/session.d.ts.map +1 -1
- package/build/utils/session.js +12 -0
- package/build/utils/session.js.map +1 -1
- package/build/utils/space.d.ts +3 -0
- package/build/utils/space.d.ts.map +1 -0
- package/build/utils/space.js +22 -0
- package/build/utils/space.js.map +1 -0
- package/build/vendor/tapestry/tokens.d.ts +14 -0
- package/build/vendor/tapestry/tokens.d.ts.map +1 -1
- package/build/vendor/tapestry/tokens.js +13 -0
- package/build/vendor/tapestry/tokens.js.map +1 -1
- package/package.json +7 -5
- package/src/__tests__/session.tsx +43 -8
- package/src/__tests__/utils/space.tsx +60 -0
- package/src/components/display/heading.tsx +71 -0
- package/src/components/display/index.ts +1 -0
- package/src/components/display/text.tsx +5 -4
- package/src/components/index.tsx +2 -0
- package/src/contexts/api_provider.tsx +9 -18
- package/src/contexts/index.ts +2 -0
- package/src/hooks/index.ts +2 -1
- package/src/index.tsx +4 -15
- package/src/screens/display.tsx +12 -5
- package/src/utils/api.ts +47 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/platform_styles.ts +7 -0
- package/src/utils/session.ts +13 -0
- package/src/utils/space.ts +39 -0
- package/src/vendor/tapestry/tokens.ts +28 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TextProps as ReactNativeTextProps } from 'react-native';
|
|
3
|
+
interface TextProps extends ReactNativeTextProps {
|
|
4
|
+
variant?: 'h1' | 'h2' | 'h3' | 'h4';
|
|
5
|
+
}
|
|
6
|
+
export declare function Heading({ style, variant, children, ...rest }: TextProps): React.JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=heading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../../src/components/display/heading.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAIL,SAAS,IAAI,oBAAoB,EAClC,MAAM,cAAc,CAAA;AAIrB,UAAU,SAAU,SAAQ,oBAAoB;IAC9C,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CACpC;AAED,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,OAAc,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,SAAS,qBAkB9E"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { useTheme } from '../../hooks';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Platform, StyleSheet, Text as ReactNativeText, } from 'react-native';
|
|
4
|
+
import { tokens } from '../../vendor/tapestry/tokens';
|
|
5
|
+
import { platformFontWeightBold } from '../../utils/platform_styles';
|
|
6
|
+
export function Heading({ style, variant = 'h1', children, ...rest }) {
|
|
7
|
+
const styles = useStyles();
|
|
8
|
+
const variantStyleMap = {
|
|
9
|
+
h1: styles.heading1,
|
|
10
|
+
h2: styles.heading2,
|
|
11
|
+
h3: styles.heading3,
|
|
12
|
+
h4: styles.heading4,
|
|
13
|
+
};
|
|
14
|
+
return (<ReactNativeText style={[styles.global, variantStyleMap[variant], style]} accessibilityRole="header" {...rest}>
|
|
15
|
+
{children}
|
|
16
|
+
</ReactNativeText>);
|
|
17
|
+
}
|
|
18
|
+
const useStyles = () => {
|
|
19
|
+
const { colors } = useTheme();
|
|
20
|
+
return StyleSheet.create({
|
|
21
|
+
global: {
|
|
22
|
+
fontFamily: Platform.select({
|
|
23
|
+
ios: 'System',
|
|
24
|
+
android: 'normal',
|
|
25
|
+
}),
|
|
26
|
+
},
|
|
27
|
+
heading1: {
|
|
28
|
+
color: colors.textColorDefaultHeadline,
|
|
29
|
+
fontSize: 25, // Todo: Check with UX on correct token
|
|
30
|
+
lineHeight: 32,
|
|
31
|
+
},
|
|
32
|
+
heading2: {
|
|
33
|
+
color: colors.textColorDefaultHeadline,
|
|
34
|
+
fontWeight: platformFontWeightBold,
|
|
35
|
+
fontSize: 21, // Todo: Check with UX on correct token
|
|
36
|
+
lineHeight: 24,
|
|
37
|
+
},
|
|
38
|
+
heading3: {
|
|
39
|
+
color: colors.textColorDefaultHeadline,
|
|
40
|
+
fontWeight: platformFontWeightBold,
|
|
41
|
+
fontSize: tokens.fontSizeLg,
|
|
42
|
+
lineHeight: 22,
|
|
43
|
+
},
|
|
44
|
+
heading4: {
|
|
45
|
+
color: colors.textColorDefaultSecondary,
|
|
46
|
+
fontWeight: platformFontWeightBold,
|
|
47
|
+
fontSize: tokens.fontSizeSm,
|
|
48
|
+
lineHeight: 20,
|
|
49
|
+
textTransform: 'uppercase',
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=heading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.js","sourceRoot":"","sources":["../../../src/components/display/heading.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EACL,QAAQ,EACR,UAAU,EACV,IAAI,IAAI,eAAe,GAExB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAMpE,MAAM,UAAU,OAAO,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAa;IAC7E,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,eAAe,GAAG;QACtB,EAAE,EAAE,MAAM,CAAC,QAAQ;QACnB,EAAE,EAAE,MAAM,CAAC,QAAQ;QACnB,EAAE,EAAE,MAAM,CAAC,QAAQ;QACnB,EAAE,EAAE,MAAM,CAAC,QAAQ;KACpB,CAAA;IAED,OAAO,CACL,CAAC,eAAe,CACd,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,CAAC,CACxD,iBAAiB,CAAC,QAAQ,CAC1B,IAAI,IAAI,CAAC,CAET;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,eAAe,CAAC,CACnB,CAAA;AACH,CAAC;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,MAAM,EAAE;YACN,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC;gBAC1B,GAAG,EAAE,QAAQ;gBACb,OAAO,EAAE,QAAQ;aAClB,CAAC;SACH;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,MAAM,CAAC,wBAAwB;YACtC,QAAQ,EAAE,EAAE,EAAE,uCAAuC;YACrD,UAAU,EAAE,EAAE;SACf;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,MAAM,CAAC,wBAAwB;YACtC,UAAU,EAAE,sBAAsB;YAClC,QAAQ,EAAE,EAAE,EAAE,uCAAuC;YACrD,UAAU,EAAE,EAAE;SACf;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,MAAM,CAAC,wBAAwB;YACtC,UAAU,EAAE,sBAAsB;YAClC,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,UAAU,EAAE,EAAE;SACf;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,MAAM,CAAC,yBAAyB;YACvC,UAAU,EAAE,sBAAsB;YAClC,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,WAAW;SAC3B;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useTheme } from '../../hooks'\nimport React from 'react'\nimport {\n Platform,\n StyleSheet,\n Text as ReactNativeText,\n TextProps as ReactNativeTextProps,\n} from 'react-native'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { platformFontWeightBold } from '../../utils/platform_styles'\n\ninterface TextProps extends ReactNativeTextProps {\n variant?: 'h1' | 'h2' | 'h3' | 'h4'\n}\n\nexport function Heading({ style, variant = 'h1', children, ...rest }: TextProps) {\n const styles = useStyles()\n const variantStyleMap = {\n h1: styles.heading1,\n h2: styles.heading2,\n h3: styles.heading3,\n h4: styles.heading4,\n }\n\n return (\n <ReactNativeText\n style={[styles.global, variantStyleMap[variant], style]}\n accessibilityRole=\"header\"\n {...rest}\n >\n {children}\n </ReactNativeText>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n global: {\n fontFamily: Platform.select({\n ios: 'System',\n android: 'normal',\n }),\n },\n heading1: {\n color: colors.textColorDefaultHeadline,\n fontSize: 25, // Todo: Check with UX on correct token\n lineHeight: 32,\n },\n heading2: {\n color: colors.textColorDefaultHeadline,\n fontWeight: platformFontWeightBold,\n fontSize: 21, // Todo: Check with UX on correct token\n lineHeight: 24,\n },\n heading3: {\n color: colors.textColorDefaultHeadline,\n fontWeight: platformFontWeightBold,\n fontSize: tokens.fontSizeLg,\n lineHeight: 22,\n },\n heading4: {\n color: colors.textColorDefaultSecondary,\n fontWeight: platformFontWeightBold,\n fontSize: tokens.fontSizeSm,\n lineHeight: 20,\n textTransform: 'uppercase',\n },\n })\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/display/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/display/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/display/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA","sourcesContent":["export { Spinner } from './spinner'\nexport { Image } from './image'\nexport { Text } from './text'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/display/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA","sourcesContent":["export { Spinner } from './spinner'\nexport { Image } from './image'\nexport { Heading } from './heading'\nexport { Text } from './text'\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/components/display/text.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAIL,SAAS,IAAI,oBAAoB,EAClC,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../src/components/display/text.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAIL,SAAS,IAAI,oBAAoB,EAClC,MAAM,cAAc,CAAA;AAGrB,UAAU,SAAU,SAAQ,oBAAoB;IAC9C,OAAO,CAAC,EAAE,OAAO,GAAG,WAAW,GAAG,UAAU,GAAG,UAAU,CAAA;CAC1D;AAED,wBAAgB,IAAI,CAAC,EAAE,KAAK,EAAE,OAAiB,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,SAAS,qBAc9E"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useTheme } from '../../hooks';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Platform, StyleSheet, Text as ReactNativeText, } from 'react-native';
|
|
4
|
+
import { tokens } from '../../vendor/tapestry/tokens';
|
|
4
5
|
export function Text({ style, variant = 'plain', children, ...rest }) {
|
|
5
6
|
const styles = useStyles();
|
|
6
7
|
const variantStyleMap = {
|
|
@@ -24,22 +25,22 @@ const useStyles = () => {
|
|
|
24
25
|
},
|
|
25
26
|
plain: {
|
|
26
27
|
color: colors.textColorDefaultPrimary,
|
|
27
|
-
fontSize:
|
|
28
|
+
fontSize: tokens.fontSizeMd,
|
|
28
29
|
lineHeight: 24,
|
|
29
30
|
},
|
|
30
31
|
secondary: {
|
|
31
32
|
color: colors.textColorDefaultPrimary,
|
|
32
|
-
fontSize: 15,
|
|
33
|
+
fontSize: 15, // TODO: Check with UX on correct token
|
|
33
34
|
lineHeight: 22,
|
|
34
35
|
},
|
|
35
36
|
tertiary: {
|
|
36
37
|
color: colors.textColorDefaultPrimary,
|
|
37
|
-
fontSize:
|
|
38
|
+
fontSize: tokens.fontSizeSm,
|
|
38
39
|
lineHeight: 20,
|
|
39
40
|
},
|
|
40
41
|
footnote: {
|
|
41
42
|
color: colors.textColorDefaultSecondary,
|
|
42
|
-
fontSize: 13,
|
|
43
|
+
fontSize: 13, // TODO: Check with UX on correct token
|
|
43
44
|
lineHeight: 16,
|
|
44
45
|
},
|
|
45
46
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../src/components/display/text.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,KAAK,MAAM,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YACL,KAAK,EAAE,MAAM,CAAC,uBAAuB;YACrC,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,UAAU,EAAE,EAAE;SACf;QACD,SAAS,EAAE;YACT,KAAK,EAAE,MAAM,CAAC,uBAAuB;YACrC,QAAQ,EAAE,EAAE,EAAE,uCAAuC;YACrD,UAAU,EAAE,EAAE;SACf;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,MAAM,CAAC,uBAAuB;YACrC,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,UAAU,EAAE,EAAE;SACf;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,MAAM,CAAC,yBAAyB;YACvC,QAAQ,EAAE,EAAE,EAAE,uCAAuC;YACrD,UAAU,EAAE,EAAE;SACf;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useTheme } from '../../hooks'\nimport React from 'react'\nimport {\n Platform,\n StyleSheet,\n Text as ReactNativeText,\n TextProps as ReactNativeTextProps,\n} from 'react-native'\nimport { tokens } from '../../vendor/tapestry/tokens'\n\ninterface TextProps extends ReactNativeTextProps {\n variant?: 'plain' | 'secondary' | 'tertiary' | 'footnote'\n}\n\nexport function Text({ style, variant = 'plain', children, ...rest }: TextProps) {\n const styles = useStyles()\n const variantStyleMap = {\n plain: styles.plain,\n secondary: styles.secondary,\n tertiary: styles.tertiary,\n footnote: styles.footnote,\n }\n\n return (\n <ReactNativeText style={[styles.global, variantStyleMap[variant], style]} {...rest}>\n {children}\n </ReactNativeText>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n return StyleSheet.create({\n global: {\n fontFamily: Platform.select({\n ios: 'System',\n android: 'normal',\n }),\n },\n plain: {\n color: colors.textColorDefaultPrimary,\n fontSize: tokens.fontSizeMd,\n lineHeight: 24,\n },\n secondary: {\n color: colors.textColorDefaultPrimary,\n fontSize: 15, // TODO: Check with UX on correct token\n lineHeight: 22,\n },\n tertiary: {\n color: colors.textColorDefaultPrimary,\n fontSize: tokens.fontSizeSm,\n lineHeight: 20,\n },\n footnote: {\n color: colors.textColorDefaultSecondary,\n fontSize: 13, // TODO: Check with UX on correct token\n lineHeight: 16,\n },\n })\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.tsx"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,kBAAkB,CAAA","sourcesContent":["export * from './conversations'\nexport * from './error_boundary'\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api_provider.d.ts","sourceRoot":"","sources":["../../src/contexts/api_provider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api_provider.d.ts","sourceRoot":"","sources":["../../src/contexts/api_provider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAiC,MAAM,uBAAuB,CAAA;AAClF,OAAO,KAAoB,MAAM,OAAO,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC,OAAO,EAAE,GAAG,EAAW,MAAM,kBAAkB,CAAA;AAqB/C,eAAO,MAAM,WAAW,aAMtB,CAAA;AAEF,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,GAAkB,EAClB,KAAK,EACL,cAAc,GACf,EAAE,SAAS,GAAG;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAAC,cAAc,EAAE,MAAM,IAAI,CAAA;CAAE,qBAU3E"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import apiRequest from '../utils/api';
|
|
3
4
|
import { session } from '../utils/session';
|
|
4
5
|
let handleTokenExpired;
|
|
5
6
|
const defaultQueryFn = ({ queryKey }) => {
|
|
@@ -7,13 +8,8 @@ const defaultQueryFn = ({ queryKey }) => {
|
|
|
7
8
|
throw new Error('No token present');
|
|
8
9
|
}
|
|
9
10
|
const url = `${session.baseUrl}${queryKey[0]}`;
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
Authorization: `Bearer ${session.token?.access_token}`,
|
|
13
|
-
},
|
|
14
|
-
})
|
|
15
|
-
.then(validateResponse)
|
|
16
|
-
.then(response => response.json())
|
|
11
|
+
return apiRequest(url)
|
|
12
|
+
.then(r => r.json)
|
|
17
13
|
.catch(error => {
|
|
18
14
|
if (error.message === 'Token expired') {
|
|
19
15
|
handleTokenExpired();
|
|
@@ -32,13 +28,9 @@ export function ApiProvider({ children, env = 'production', token, onTokenExpire
|
|
|
32
28
|
session.env = env;
|
|
33
29
|
session.token = token;
|
|
34
30
|
handleTokenExpired = onTokenExpired;
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
queryClient.invalidateQueries();
|
|
33
|
+
}, [env, token]);
|
|
35
34
|
return <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>;
|
|
36
35
|
}
|
|
37
|
-
const validateResponse = (response) => {
|
|
38
|
-
const isExpired = response.status === 401;
|
|
39
|
-
if (isExpired) {
|
|
40
|
-
throw new Error('Token expired');
|
|
41
|
-
}
|
|
42
|
-
return response;
|
|
43
|
-
};
|
|
44
36
|
//# sourceMappingURL=api_provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api_provider.js","sourceRoot":"","sources":["../../src/contexts/api_provider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"api_provider.js","sourceRoot":"","sources":["../../src/contexts/api_provider.tsx"],"names":[],"mapp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AAC,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAA;IAEhB,OAAO,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,CAAA;AACnF,CAAC","sourcesContent":["import { JSONAPIResponse } from '@planningcenter/chat-core'\nimport { QueryClient, QueryClientProvider, QueryKey } from '@tanstack/react-query'\nimport React, { useEffect } from 'react'\nimport { ViewProps } from 'react-native'\nimport { OAuthToken } from '../types'\nimport apiRequest from '../utils/api'\nimport { ENV, session } from '../utils/session'\n\nlet handleTokenExpired: () => void\n\nconst defaultQueryFn = ({ queryKey }: { queryKey: QueryKey }) => {\n if (!session.token) {\n throw new Error('No token present')\n }\n\n const url = `${session.baseUrl}${queryKey[0]}`\n\n return apiRequest<JSONAPIResponse>(url)\n .then(r => r.json)\n .catch(error => {\n if (error.message === 'Token expired') {\n handleTokenExpired()\n }\n return null\n })\n}\n\nexport const queryClient = new QueryClient({\n defaultOptions: {\n queries: {\n queryFn: defaultQueryFn,\n },\n },\n})\n\nexport function ApiProvider({\n children,\n env = 'production',\n token,\n onTokenExpired,\n}: ViewProps & { env?: ENV; token?: OAuthToken; onTokenExpired: () => void }) {\n session.env = env\n session.token = token\n handleTokenExpired = onTokenExpired\n\n useEffect(() => {\n queryClient.invalidateQueries()\n }, [env, token])\n\n return <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,gBAAgB,CAAA","sourcesContent":["export * from './api_provider'\nexport * from './chat_context'\n"]}
|
package/build/hooks/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA"}
|
package/build/hooks/index.js
CHANGED
package/build/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA","sourcesContent":["export * from './use_async_storage'\nexport * from './use_theme'\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import { baseUrlMap, uploadUrlMap } from './utils/session';
|
|
5
|
-
import { TemporaryDefaultColorsType } from './utils/theme';
|
|
1
|
+
export * from './components';
|
|
2
|
+
export * from './contexts';
|
|
3
|
+
export * from './hooks';
|
|
6
4
|
export * from './screens';
|
|
7
|
-
export
|
|
5
|
+
export * from './utils';
|
|
8
6
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export * from './components';
|
|
2
|
+
export * from './contexts';
|
|
3
|
+
export * from './hooks';
|
|
4
4
|
export * from './screens';
|
|
5
|
-
export
|
|
5
|
+
export * from './utils';
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA","sourcesContent":["export * from './components'\nexport * from './contexts'\nexport * from './hooks'\nexport * from './screens'\nexport * from './utils'\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/screens/display.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/screens/display.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAMzB,wBAAgB,aAAa,sBAiC5B"}
|
package/build/screens/display.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ScrollView, StyleSheet, View } from 'react-native';
|
|
3
3
|
import { useTheme } from '../hooks';
|
|
4
|
-
import { Image, Spinner, Text } from '../components/display';
|
|
4
|
+
import { Heading, Image, Spinner, Text } from '../components/display';
|
|
5
|
+
import { space } from '../utils/space';
|
|
5
6
|
export function DisplayScreen() {
|
|
6
7
|
const styles = useStyles();
|
|
7
8
|
return (<ScrollView contentContainerStyle={styles.container} style={styles.scrollView}>
|
|
@@ -21,6 +22,12 @@ export function DisplayScreen() {
|
|
|
21
22
|
<Text variant="tertiary">Tertiary</Text>
|
|
22
23
|
<Text variant="footnote">Footnote</Text>
|
|
23
24
|
</View>
|
|
25
|
+
<View style={styles.row}>
|
|
26
|
+
<Heading>Heading 1</Heading>
|
|
27
|
+
<Heading variant="h2">Heading 2</Heading>
|
|
28
|
+
<Heading variant="h3">Heading 3</Heading>
|
|
29
|
+
<Heading variant="h4">Heading 4</Heading>
|
|
30
|
+
</View>
|
|
24
31
|
</View>
|
|
25
32
|
</ScrollView>);
|
|
26
33
|
}
|
|
@@ -28,18 +35,18 @@ const useStyles = () => {
|
|
|
28
35
|
const { colors } = useTheme();
|
|
29
36
|
return StyleSheet.create({
|
|
30
37
|
scrollView: { flex: 1, backgroundColor: colors.fillColorNeutral090 },
|
|
31
|
-
container: { gap:
|
|
38
|
+
container: { gap: space(2), padding: space(3) },
|
|
32
39
|
listItem: { color: colors.fillColorNeutral020 },
|
|
33
40
|
row: {
|
|
34
|
-
gap:
|
|
41
|
+
gap: space(2),
|
|
35
42
|
flexDirection: 'row',
|
|
36
43
|
alignItems: 'center',
|
|
37
44
|
justifyContent: 'center',
|
|
38
45
|
flexWrap: 'wrap',
|
|
39
46
|
},
|
|
40
|
-
column: { gap:
|
|
47
|
+
column: { gap: space(4) },
|
|
41
48
|
spinnerContainer: {
|
|
42
|
-
height:
|
|
49
|
+
height: space(2.5),
|
|
43
50
|
},
|
|
44
51
|
image: {
|
|
45
52
|
width: 100,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/screens/display.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,QAAQ,E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AAC,mBAAmB,EAAE;QAC/C,GAAG,EAAE;YACH,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;YACb,aAAa,EAAE,KAAK;YACpB,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,QAAQ,EAAE,MAAM;SACjB;QACD,MAAM,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE;QACzB,gBAAgB,EAAE;YAChB,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC;SACnB;QACD,KAAK,EAAE;YACL,KAAK,EAAE,GAAG;YACV,MAAM,EAAE,GAAG;SACZ;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { ScrollView, StyleSheet, View } from 'react-native'\nimport { useTheme } from '../hooks'\nimport { Heading, Image, Spinner, Text } from '../components/display'\nimport { space } from '../utils/space'\n\nexport function DisplayScreen() {\n const styles = useStyles()\n\n return (\n <ScrollView contentContainerStyle={styles.container} style={styles.scrollView}>\n <View style={styles.column}>\n <View style={[styles.row, styles.spinnerContainer]}>\n <Spinner size={24} />\n </View>\n <View style={styles.row}>\n <Image source={{ uri: 'https://broken.url' }} style={styles.image} />\n <Image\n source={{\n uri: 'https://picsum.photos/seed/picsum/200',\n }}\n style={styles.image}\n />\n </View>\n <View style={styles.row}>\n <Text>Plain text</Text>\n <Text variant=\"secondary\">Secondary</Text>\n <Text variant=\"tertiary\">Tertiary</Text>\n <Text variant=\"footnote\">Footnote</Text>\n </View>\n <View style={styles.row}>\n <Heading>Heading 1</Heading>\n <Heading variant=\"h2\">Heading 2</Heading>\n <Heading variant=\"h3\">Heading 3</Heading>\n <Heading variant=\"h4\">Heading 4</Heading>\n </View>\n </View>\n </ScrollView>\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n scrollView: { flex: 1, backgroundColor: colors.fillColorNeutral090 },\n container: { gap: space(2), padding: space(3) },\n listItem: { color: colors.fillColorNeutral020 },\n row: {\n gap: space(2),\n flexDirection: 'row',\n alignItems: 'center',\n justifyContent: 'center',\n flexWrap: 'wrap',\n },\n column: { gap: space(4) },\n spinnerContainer: {\n height: space(2.5),\n },\n image: {\n width: 100,\n height: 100,\n },\n })\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/utils/api.ts"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,CAAC,GAAG,OAAO,EAC5C,GAAG,EAAE,MAAM,EACX,EAAE,MAAc,EAAE,IAAW,EAAE;;;CAAK,GACnC,OAAO,CAAC;IAAE,IAAI,EAAE,CAAC,CAAC;IAAC,EAAE,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,QAAQ,CAAA;CAAE,CAAC,CAuBvD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import DeviceInfo from 'react-native-device-info';
|
|
2
|
+
import { session } from './session';
|
|
3
|
+
const brand = DeviceInfo.getBrand();
|
|
4
|
+
const model = DeviceInfo.getModel();
|
|
5
|
+
const systemName = DeviceInfo.getSystemName();
|
|
6
|
+
const systemVersion = DeviceInfo.getSystemVersion();
|
|
7
|
+
const readableVersion = DeviceInfo.getReadableVersion();
|
|
8
|
+
const appName = DeviceInfo.getApplicationName();
|
|
9
|
+
export default function apiRequest(url, { method = 'GET', data = null } = {}) {
|
|
10
|
+
const options = {
|
|
11
|
+
headers: {
|
|
12
|
+
Accept: 'application/vnd.api+json',
|
|
13
|
+
'Content-Type': 'application/json',
|
|
14
|
+
'User-Agent': `${appName}/${readableVersion} (${brand}, ${model}, ${systemName}, ${systemVersion})`,
|
|
15
|
+
Authorization: `Bearer ${session.token?.access_token}`,
|
|
16
|
+
},
|
|
17
|
+
method,
|
|
18
|
+
};
|
|
19
|
+
if (data && method !== 'GET') {
|
|
20
|
+
options.body = JSON.stringify(data);
|
|
21
|
+
}
|
|
22
|
+
return fetch(url, options)
|
|
23
|
+
.then(validateResponse)
|
|
24
|
+
.then(response => response
|
|
25
|
+
.json()
|
|
26
|
+
.then(json => ({ json: json, ok: response.ok, response }))
|
|
27
|
+
.catch(() => ({ json: null, ok: response.ok, response })));
|
|
28
|
+
}
|
|
29
|
+
const validateResponse = (response) => {
|
|
30
|
+
const isExpired = response.status === 401;
|
|
31
|
+
if (isExpired) {
|
|
32
|
+
throw new Error('Token expired');
|
|
33
|
+
}
|
|
34
|
+
return response;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/utils/api.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,0BAA0B,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAA;AACnC,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAA;AACnC,MAAM,UAAU,GAAG,UAAU,CAAC,aAAa,EAAE,CAAA;AAC7C,MAAM,aAAa,GAAG,UAAU,CAAC,gBAAgB,EAAE,CAAA;AACnD,MAAM,eAAe,GAAG,UAAU,CAAC,kBAAkB,EAAE,CAAA;AACvD,MAAM,OAAO,GAAG,UAAU,CAAC,kBAAkB,EAAE,CAAA;AAE/C,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,GAAW,EACX,EAAE,MAAM,GAAG,KAAK,EAAE,IAAI,GAAG,IAAI,EAAE,GAAG,EAAE;IAEpC,MAAM,OAAO,GAAgB;QAC3B,OAAO,EAAE;YACP,MAAM,EAAE,0BAA0B;YAClC,cAAc,EAAE,kBAAkB;YAClC,YAAY,EAAE,GAAG,OAAO,IAAI,eAAe,KAAK,KAAK,KAAK,KAAK,KAAK,UAAU,KAAK,aAAa,GAAG;YACnG,aAAa,EAAE,UAAU,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE;SACvD;QACD,MAAM;KACP,CAAA;IAED,IAAI,IAAI,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QAC7B,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;IACrC,CAAC;IAED,OAAO,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC;SACvB,IAAI,CAAC,gBAAgB,CAAC;SACtB,IAAI,CAAC,QAAQ,CAAC,EAAE,CACf,QAAQ;SACL,IAAI,EAAE;SACN,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAS,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;SAC9D,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAS,EAAE,EAAE,EAAE,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,CACjE,CAAA;AACL,CAAC;AAED,MAAM,gBAAgB,GAAG,CAAC,QAAkB,EAAE,EAAE;IAC9C,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAA;IAEzC,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;IAClC,CAAC;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA","sourcesContent":["import DeviceInfo from 'react-native-device-info'\nimport { session } from './session'\n\nconst brand = DeviceInfo.getBrand()\nconst model = DeviceInfo.getModel()\nconst systemName = DeviceInfo.getSystemName()\nconst systemVersion = DeviceInfo.getSystemVersion()\nconst readableVersion = DeviceInfo.getReadableVersion()\nconst appName = DeviceInfo.getApplicationName()\n\nexport default function apiRequest<T = unknown>(\n url: string,\n { method = 'GET', data = null } = {}\n): Promise<{ json: T; ok: boolean; response: Response }> {\n const options: RequestInit = {\n headers: {\n Accept: 'application/vnd.api+json',\n 'Content-Type': 'application/json',\n 'User-Agent': `${appName}/${readableVersion} (${brand}, ${model}, ${systemName}, ${systemVersion})`,\n Authorization: `Bearer ${session.token?.access_token}`,\n },\n method,\n }\n\n if (data && method !== 'GET') {\n options.body = JSON.stringify(data)\n }\n\n return fetch(url, options)\n .then(validateResponse)\n .then(response =>\n response\n .json()\n .then(json => ({ json: json as T, ok: response.ok, response }))\n .catch(() => ({ json: null as T, ok: response.ok, response }))\n )\n}\n\nconst validateResponse = (response: Response) => {\n const isExpired = response.status === 401\n\n if (isExpired) {\n throw new Error('Token expired')\n }\n\n return response\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA","sourcesContent":["export * from './session'\nexport * from './theme'\n"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const platformFontWeightBold: "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | "ultralight" | "thin" | "light" | "medium" | "regular" | "semibold" | "condensedBold" | "condensed" | "heavy" | "black" | undefined;
|
|
2
|
+
//# sourceMappingURL=platform_styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform_styles.d.ts","sourceRoot":"","sources":["../../src/utils/platform_styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,sBAAsB,uRAGjC,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
2
|
+
import { tokens } from '../vendor/tapestry/tokens';
|
|
3
|
+
export const platformFontWeightBold = Platform.select({
|
|
4
|
+
ios: tokens.fontWeightSemiBold,
|
|
5
|
+
android: tokens.fontWeightBold,
|
|
6
|
+
});
|
|
7
|
+
//# sourceMappingURL=platform_styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform_styles.js","sourceRoot":"","sources":["../../src/utils/platform_styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,MAAM,CAAC,MAAM,sBAAsB,GAAG,QAAQ,CAAC,MAAM,CAAC;IACpD,GAAG,EAAE,MAAM,CAAC,kBAAkB;IAC9B,OAAO,EAAE,MAAM,CAAC,cAAc;CAC/B,CAAC,CAAA","sourcesContent":["import { Platform } from 'react-native'\nimport { tokens } from '../vendor/tapestry/tokens'\n\nexport const platformFontWeightBold = Platform.select({\n ios: tokens.fontWeightSemiBold,\n android: tokens.fontWeightBold,\n})\n"]}
|
package/build/utils/session.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/utils/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC,MAAM,MAAM,GAAG,GAAG,YAAY,GAAG,SAAS,GAAG,aAAa,CAAA;AAE1D,eAAO,MAAM,UAAU;;;;CAItB,CAAA;AAED,eAAO,MAAM,YAAY;;;;CAIxB,CAAA;AAED,KAAK,YAAY,GAAG;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,UAAU,CAAA;CAAE,GAAG,SAAS,CAAA;AAEjE;;;;GAIG;AACH,qBAAa,OAAO;IAClB,GAAG,EAAE,GAAG,CAAA;IACR,KAAK,EAAE,UAAU,GAAG,SAAS,CAAA;gBAEjB,KAAK,CAAC,EAAE,YAAY;IAMhC,IAAI,eAAe,YAElB;IAED,IAAI,OAAO,WAEV;IAED,IAAI,SAAS,WAEZ;
|
|
1
|
+
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../../src/utils/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC,MAAM,MAAM,GAAG,GAAG,YAAY,GAAG,SAAS,GAAG,aAAa,CAAA;AAE1D,eAAO,MAAM,UAAU;;;;CAItB,CAAA;AAED,eAAO,MAAM,YAAY;;;;CAIxB,CAAA;AAED,KAAK,YAAY,GAAG;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC;IAAC,KAAK,CAAC,EAAE,UAAU,CAAA;CAAE,GAAG,SAAS,CAAA;AAEjE;;;;GAIG;AACH,qBAAa,OAAO;IAClB,GAAG,EAAE,GAAG,CAAA;IACR,KAAK,EAAE,UAAU,GAAG,SAAS,CAAA;gBAEjB,KAAK,CAAC,EAAE,YAAY;IAMhC,IAAI,eAAe,YAElB;IAED,IAAI,OAAO,WAEV;IAED,IAAI,SAAS,WAEZ;IAED,QAAQ;IAIR,MAAM,CAAC,OAAO,CAAC,aAAa,EAAE,MAAM;CAQrC;AAED,eAAO,MAAM,OAAO,SAAsC,CAAA"}
|
package/build/utils/session.js
CHANGED
|
@@ -30,6 +30,18 @@ export class Session {
|
|
|
30
30
|
get uploadUrl() {
|
|
31
31
|
return uploadUrlMap[this.env];
|
|
32
32
|
}
|
|
33
|
+
toString() {
|
|
34
|
+
return JSON.stringify({ env: this.env, token: this.token });
|
|
35
|
+
}
|
|
36
|
+
static hydrate(sessionString) {
|
|
37
|
+
try {
|
|
38
|
+
const props = JSON.parse(sessionString);
|
|
39
|
+
return new Session(props);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
return new Session();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
33
45
|
}
|
|
34
46
|
export const session = new Session({ env: 'development' });
|
|
35
47
|
//# sourceMappingURL=session.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/utils/session.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,UAAU,EAAE,sCAAsC;IAClD,OAAO,EAAE,8CAA8C;IACvD,WAAW,EAAE,qBAAqB;CACnC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,UAAU,EAAE,kDAAkD;IAC9D,OAAO,EAAE,0DAA0D;IACnE,WAAW,EAAE,kDAAkD;CAChE,CAAA;AAID;;;;GAIG;AACH,MAAM,OAAO,OAAO;IAClB,GAAG,CAAK;IACR,KAAK,CAAwB;IAE7B,YAAY,KAAoB;QAC9B,MAAM,EAAE,GAAG,GAAG,aAAa,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,EAAE,CAAA;QAClD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC5B,CAAC;IAED,IAAI,OAAO;QACT,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC7B,CAAC;IAED,IAAI,SAAS;QACX,OAAO,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC/B,CAAC;CACF;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC,CAAA","sourcesContent":["import { OAuthToken } from '../types'\n\nexport type ENV = 'production' | 'staging' | 'development'\n\nexport const baseUrlMap = {\n production: 'https://api.planningcenteronline.com',\n staging: 'https://api-staging.planningcenteronline.com',\n development: 'http://api.pco.test',\n}\n\nexport const uploadUrlMap = {\n production: 'https://upload.planningcenteronline.com/v2/files',\n staging: 'https://upload-staging.planningcenteronline.com/v2/files',\n development: 'https://upload.planningcenteronline.com/v2/files',\n}\n\ntype SessionProps = { env?: ENV; token?: OAuthToken } | undefined\n\n/**\n * Session class to track the environment and token\n * Not intended to make network requests or handle authentication\n * - returns urls for convenience only\n */\nexport class Session {\n env: ENV\n token: OAuthToken | undefined\n\n constructor(props?: SessionProps) {\n const { env = 'development', token } = props || {}\n this.env = env\n this.token = token\n }\n\n get isAuthenticated() {\n return Boolean(this.token)\n }\n\n get baseUrl() {\n return baseUrlMap[this.env]\n }\n\n get uploadUrl() {\n return uploadUrlMap[this.env]\n }\n}\n\nexport const session = new Session({ env: 'development' })\n"]}
|
|
1
|
+
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/utils/session.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,UAAU,EAAE,sCAAsC;IAClD,OAAO,EAAE,8CAA8C;IACvD,WAAW,EAAE,qBAAqB;CACnC,CAAA;AAED,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,UAAU,EAAE,kDAAkD;IAC9D,OAAO,EAAE,0DAA0D;IACnE,WAAW,EAAE,kDAAkD;CAChE,CAAA;AAID;;;;GAIG;AACH,MAAM,OAAO,OAAO;IAClB,GAAG,CAAK;IACR,KAAK,CAAwB;IAE7B,YAAY,KAAoB;QAC9B,MAAM,EAAE,GAAG,GAAG,aAAa,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,EAAE,CAAA;QAClD,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,IAAI,eAAe;QACjB,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC5B,CAAC;IAED,IAAI,OAAO;QACT,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC7B,CAAC;IAED,IAAI,SAAS;QACX,OAAO,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC/B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;IAC7D,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,aAAqB;QAClC,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;YACvC,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,CAAA;QAC3B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,IAAI,OAAO,EAAE,CAAA;QACtB,CAAC;IACH,CAAC;CACF;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,GAAG,EAAE,aAAa,EAAE,CAAC,CAAA","sourcesContent":["import { OAuthToken } from '../types'\n\nexport type ENV = 'production' | 'staging' | 'development'\n\nexport const baseUrlMap = {\n production: 'https://api.planningcenteronline.com',\n staging: 'https://api-staging.planningcenteronline.com',\n development: 'http://api.pco.test',\n}\n\nexport const uploadUrlMap = {\n production: 'https://upload.planningcenteronline.com/v2/files',\n staging: 'https://upload-staging.planningcenteronline.com/v2/files',\n development: 'https://upload.planningcenteronline.com/v2/files',\n}\n\ntype SessionProps = { env?: ENV; token?: OAuthToken } | undefined\n\n/**\n * Session class to track the environment and token\n * Not intended to make network requests or handle authentication\n * - returns urls for convenience only\n */\nexport class Session {\n env: ENV\n token: OAuthToken | undefined\n\n constructor(props?: SessionProps) {\n const { env = 'development', token } = props || {}\n this.env = env\n this.token = token\n }\n\n get isAuthenticated() {\n return Boolean(this.token)\n }\n\n get baseUrl() {\n return baseUrlMap[this.env]\n }\n\n get uploadUrl() {\n return uploadUrlMap[this.env]\n }\n\n toString() {\n return JSON.stringify({ env: this.env, token: this.token })\n }\n\n static hydrate(sessionString: string) {\n try {\n const props = JSON.parse(sessionString)\n return new Session(props)\n } catch (error) {\n return new Session()\n }\n }\n}\n\nexport const session = new Session({ env: 'development' })\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../src/utils/space.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,aAAa,GACrB,IAAI,GACJ,GAAG,GACH,CAAC,GACD,GAAG,GACH,CAAC,GACD,GAAG,GACH,CAAC,GACD,GAAG,GACH,CAAC,GACD,GAAG,GACH,CAAC,GACD,GAAG,GACH,CAAC,GACD,GAAG,GACH,CAAC,GACD,GAAG,CAAA;AAEP,wBAAgB,KAAK,CAAC,KAAK,EAAE,aAAa,GAAG,MAAM,CAalD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { tokens } from '../vendor/tapestry/tokens';
|
|
2
|
+
export function space(value) {
|
|
3
|
+
if (value === 0.25)
|
|
4
|
+
return tokens.spacingFourth;
|
|
5
|
+
if (value === 0.5)
|
|
6
|
+
return tokens.spacingHalf;
|
|
7
|
+
if (value < 1 || value > 7.5)
|
|
8
|
+
return handleInvalidSpace(value);
|
|
9
|
+
// Reject fractional values that are not 0 or 0.5
|
|
10
|
+
const wholeValue = Math.floor(value);
|
|
11
|
+
const fractionalValue = value % 1;
|
|
12
|
+
if (fractionalValue !== 0 && fractionalValue !== 0.5)
|
|
13
|
+
return handleInvalidSpace(value);
|
|
14
|
+
// Deliver a whole value or add a half spacing token to it
|
|
15
|
+
const remainderValue = fractionalValue === 0.5 ? tokens.spacingHalf : 0;
|
|
16
|
+
return tokens[`spacing${wholeValue}`] + remainderValue;
|
|
17
|
+
}
|
|
18
|
+
function handleInvalidSpace(value) {
|
|
19
|
+
console.warn(`Invalid space value: ${value} — Must be a whole or half number between 1–7.`);
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=space.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space.js","sourceRoot":"","sources":["../../src/utils/space.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAoBlD,MAAM,UAAU,KAAK,CAAC,KAAoB;IACxC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC,aAAa,CAAA;IAC/C,IAAI,KAAK,KAAK,GAAG;QAAE,OAAO,MAAM,CAAC,WAAW,CAAA;IAC5C,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,GAAG,GAAG;QAAE,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAA;IAE9D,iDAAiD;IACjD,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACpC,MAAM,eAAe,GAAG,KAAK,GAAG,CAAC,CAAA;IACjC,IAAI,eAAe,KAAK,CAAC,IAAI,eAAe,KAAK,GAAG;QAAE,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAA;IAEtF,0DAA0D;IAC1D,MAAM,cAAc,GAAG,eAAe,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;IACvE,OAAO,MAAM,CAAC,UAAU,UAAU,EAAE,CAAC,GAAG,cAAc,CAAA;AACxD,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAa;IACvC,OAAO,CAAC,IAAI,CAAC,wBAAwB,KAAK,gDAAgD,CAAC,CAAA;IAC3F,OAAO,CAAC,CAAA;AACV,CAAC","sourcesContent":["import { tokens } from '../vendor/tapestry/tokens'\n\nexport type SpacingValues =\n | 0.25\n | 0.5\n | 1\n | 1.5\n | 2\n | 2.5\n | 3\n | 3.5\n | 4\n | 4.5\n | 5\n | 5.5\n | 6\n | 6.5\n | 7\n | 7.5\n\nexport function space(value: SpacingValues): number {\n if (value === 0.25) return tokens.spacingFourth\n if (value === 0.5) return tokens.spacingHalf\n if (value < 1 || value > 7.5) return handleInvalidSpace(value)\n\n // Reject fractional values that are not 0 or 0.5\n const wholeValue = Math.floor(value)\n const fractionalValue = value % 1\n if (fractionalValue !== 0 && fractionalValue !== 0.5) return handleInvalidSpace(value)\n\n // Deliver a whole value or add a half spacing token to it\n const remainderValue = fractionalValue === 0.5 ? tokens.spacingHalf : 0\n return tokens[`spacing${wholeValue}`] + remainderValue\n}\n\nfunction handleInvalidSpace(value: number) {\n console.warn(`Invalid space value: ${value} — Must be a whole or half number between 1–7.`)\n return 0\n}\n"]}
|