@planningcenter/chat-react-native 3.40.2-qa-789.0 → 3.41.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.
Files changed (23) hide show
  1. package/build/components/display/badge.d.ts +2 -1
  2. package/build/components/display/badge.d.ts.map +1 -1
  3. package/build/components/display/badge.js +2 -0
  4. package/build/components/display/badge.js.map +1 -1
  5. package/build/hooks/use_new_conversation_entry.d.ts +6 -1
  6. package/build/hooks/use_new_conversation_entry.d.ts.map +1 -1
  7. package/build/hooks/use_new_conversation_entry.js +19 -5
  8. package/build/hooks/use_new_conversation_entry.js.map +1 -1
  9. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.d.ts.map +1 -1
  10. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js +4 -0
  11. package/build/screens/conversation_select_recipients/conversation_new_entry_screen.js.map +1 -1
  12. package/build/screens/conversation_select_type_screen.d.ts.map +1 -1
  13. package/build/screens/conversation_select_type_screen.js +4 -6
  14. package/build/screens/conversation_select_type_screen.js.map +1 -1
  15. package/build/screens/conversations/components/list_header_component.d.ts.map +1 -1
  16. package/build/screens/conversations/components/list_header_component.js +6 -0
  17. package/build/screens/conversations/components/list_header_component.js.map +1 -1
  18. package/package.json +3 -3
  19. package/src/components/display/badge.tsx +5 -2
  20. package/src/hooks/use_new_conversation_entry.ts +39 -11
  21. package/src/screens/conversation_select_recipients/conversation_new_entry_screen.tsx +6 -0
  22. package/src/screens/conversation_select_type_screen.tsx +5 -6
  23. package/src/screens/conversations/components/list_header_component.tsx +7 -0
@@ -4,6 +4,7 @@ import { IconString } from './icon';
4
4
  import { type StatusAppearanceUnion } from './utils/status_colors';
5
5
  type VariantUnion = 'default' | 'meta' | 'metaSubtle';
6
6
  type ProductLogoName = 'Groups' | 'Services' | 'groups' | 'services';
7
+ type ProductIconName = 'Chat' | 'chat';
7
8
  export interface BadgeProps {
8
9
  /**
9
10
  * Renders the main text.
@@ -24,7 +25,7 @@ export interface BadgeProps {
24
25
  /**
25
26
  * Adds a product logo to the left of the text.
26
27
  */
27
- productLogoName?: ProductLogoName;
28
+ productLogoName?: ProductLogoName | ProductIconName;
28
29
  /**
29
30
  * Shows an icon of the user choice to the left of the text.
30
31
  */
@@ -1 +1 @@
1
- {"version":3,"file":"badge.d.ts","sourceRoot":"","sources":["../../../src/components/display/badge.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,KAAK,EAAwB,SAAS,EAAE,MAAM,cAAc,CAAA;AAMnE,OAAO,EAAQ,UAAU,EAAE,MAAM,QAAQ,CAAA;AAEzC,OAAO,EAA+B,KAAK,qBAAqB,EAAE,MAAM,uBAAuB,CAAA;AAM/F,KAAK,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,YAAY,CAAA;AAiBrD,KAAK,eAAe,GAAG,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,UAAU,CAAA;AAcpE,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,qBAAqB,CAAA;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAA;IACtB;;OAEG;IACH,eAAe,CAAC,EAAE,eAAe,CAAA;IACjC;;OAEG;IACH,QAAQ,CAAC,EAAE,UAAU,CAAA;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,UAAU,CAAA;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB;;OAEG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAA;CAChC;AAED,wBAAgB,KAAK,CAAC,EACpB,UAAsB,EACtB,SAAS,EACT,KAA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SAAS,EACT,KAAK,EACL,QAAQ,EACR,aAAa,EACb,KAAK,EACL,eAAe,EACf,OAAmB,EACnB,qBAAqB,EACrB,sBAA0B,EAC1B,OAAO,GACR,EAAE,UAAU,eAwCZ"}
@@ -19,11 +19,13 @@ export function Badge({ appearance = 'neutral', metaLabel, style, iconName, icon
19
19
  const isMetaSubtle = variant === 'metaSubtle';
20
20
  const hasMetaLabel = Boolean(metaLabel);
21
21
  const showLogo = showBadgeProductLogo && productLogoName;
22
+ const isChatLogo = productLogoName?.toLowerCase() === 'chat';
22
23
  const ProductLogoSvg = showLogo && PRODUCT_LOGO_COMPONENT_MAP[productLogoName];
23
24
  const badgeLabel = isMetaSubtle && hasMetaLabel ? `${label}:` : label;
24
25
  return (<BadgeWrapper style={[styles.badgeWrapper, style]} onPress={onPress} accessibilityRole="button">
25
26
  <View style={styles.badge}>
26
27
  {showLogo && ProductLogoSvg && <ProductLogoSvg logoSize={styles.logo.fontSize}/>}
28
+ {showLogo && isChatLogo && <Icon name="general.textMessage" style={styles.icon}/>}
27
29
  {iconName && <Icon name={iconName} style={styles.icon}/>}
28
30
  <Text variant="footnote" style={styles.label} numberOfLines={1} maxFontSizeMultiplier={maxFontSizeMultiplier}>
29
31
  {badgeLabel}
@@ -1 +1 @@
1
- {"version":3,"file":"badge.js","sourceRoot":"","sources":["../../../src/components/display/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAc,MAAM,OAAO,CAAA;AAElC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,GAAG,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;A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CAAC,CAAC,SAAS,CAAC,SAAS,EACtC;QAAA,EAAE,cAAc,CAClB;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,GAAG,CAAC,CACP,CAAA;AACH,CAAC;AAED,SAAS,YAAY,CAAC,EAAE,QAAQ,EAAoB;IAClD,OAAO,CACL,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CACrE;MAAA,CAAC,IAAI,CACH,QAAQ,CAAC,SAAS,CAClB,QAAQ,CAAC,SAAS,CAClB,CAAC,CAAC,unBAAunB,CACznB,IAAI,CAAC,gCAAgC,EAEvC;MAAA,CAAC,IAAI,CACH;QAAA,CAAC,cAAc,CACb,EAAE,CAAC,0BAA0B,CAC7B,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CACb,EAAE,CAAC,CAAC,MAAM,CAAC,CACX,EAAE,CAAC,CAAC,OAAO,CAAC,CACZ,EAAE,CAAC,CAAC,OAAO,CAAC,CACZ,aAAa,CAAC,gBAAgB,CAE9B;UAAA,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EACzB;UAAA,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,EACtC;QAAA,EAAE,cAAc,CAClB;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,GAAG,CAAC,CACP,CAAA;AACH,CAAC","sourcesContent":["import React, { JSX } from 'react'\nimport type { TextStyle, ViewProps, ViewStyle } from 'react-native'\nimport { Pressable, StyleSheet, View } from 'react-native'\nimport Svg, { Defs, LinearGradient, Path, Stop } from 'react-native-svg'\nimport { useFontScale, useTheme } from '../../hooks'\nimport { platformFontWeightMedium } from '../../utils'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { Icon, IconString } from './icon'\nimport { Text } from './text'\nimport { useStatusColorAppearanceMap, type StatusAppearanceUnion } from './utils/status_colors'\n\n// =================================\n// ====== Constants ================\n// =================================\n\ntype VariantUnion = 'default' | 'meta' | 'metaSubtle'\n\ntype VariantStyles = Record<\n VariantUnion,\n {\n backgroundColor: string\n paddingHorizontal: number\n paddingVertical: number\n borderWidth: number\n borderRadius: number\n textColor: string\n gap: number\n metaLabelPaddingLeft: number\n fontWeight: TextStyle['fontWeight']\n }\n>\n\ntype ProductLogoName = 'Groups' | 'Services' | 'groups' | 'services'\ntype ProductLogoComponent = ({ logoSize }: { logoSize: number }) => JSX.Element\n\nconst PRODUCT_LOGO_COMPONENT_MAP: Record<ProductLogoName, ProductLogoComponent> = {\n Groups: GroupsLogo,\n groups: GroupsLogo,\n services: ServicesIcon,\n Services: ServicesIcon,\n}\n\n// =================================\n// ====== Component ================\n// =================================\n\nexport interface BadgeProps {\n /**\n * Renders the main text.\n */\n label: string\n /**\n * Renders secondary meta text to the right of the label.\n */\n metaLabel?: string\n /**\n * Changes the status color for the badge and icon.\n */\n appearance?: StatusAppearanceUnion\n /**\n * Changes form of the logo to support a meta label and badge\n */\n variant?: VariantUnion\n /**\n * Adds a product logo to the left of the text.\n */\n productLogoName?: ProductLogoName\n /**\n * Shows an icon of the user choice to the left of the text.\n */\n iconName?: IconString\n /**\n * Shows an icon of the user choice to the right of the text.\n */\n iconNameRight?: IconString\n /**\n * Styles badge wrapper.\n */\n style?: ViewStyle\n /**\n * Specifies the maximum size a font can reach when allowFontScaling is enabled.\n */\n maxFontSizeMultiplier?: number\n /**\n * Callback function when the badge is pressed.\n */\n onPress?: () => void\n /**\n * Specifies the number of lines for the meta label before truncating.\n */\n numberOfLinesMetaLabel?: number\n}\n\nexport function Badge({\n appearance = 'neutral',\n metaLabel,\n style,\n iconName,\n iconNameRight,\n label,\n productLogoName,\n variant = 'default',\n maxFontSizeMultiplier,\n numberOfLinesMetaLabel = 1,\n onPress,\n}: BadgeProps) {\n const styles = useStyles({ appearance, maxFontSizeMultiplier, variant })\n const { showBadgeProductLogo } = useTheme()\n\n const isMetaSubtle = variant === 'metaSubtle'\n const hasMetaLabel = Boolean(metaLabel)\n\n const showLogo = showBadgeProductLogo && productLogoName\n const ProductLogoSvg = showLogo && PRODUCT_LOGO_COMPONENT_MAP[productLogoName]\n const badgeLabel = isMetaSubtle && hasMetaLabel ? `${label}:` : label\n\n return (\n <BadgeWrapper style={[styles.badgeWrapper, style]} onPress={onPress} accessibilityRole=\"button\">\n <View style={styles.badge}>\n {showLogo && ProductLogoSvg && <ProductLogoSvg logoSize={styles.logo.fontSize} />}\n {iconName && <Icon name={iconName} style={styles.icon} />}\n <Text\n variant=\"footnote\"\n style={styles.label}\n numberOfLines={1}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n >\n {badgeLabel}\n </Text>\n {iconNameRight && <Icon name={iconNameRight} style={styles.iconRight} />}\n </View>\n {hasMetaLabel && (\n <Text\n variant=\"footnote\"\n style={styles.metaLabel}\n numberOfLines={numberOfLinesMetaLabel}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n >\n {metaLabel}\n </Text>\n )}\n </BadgeWrapper>\n )\n}\n\nconst BadgeWrapper = ({\n children,\n onPress,\n accessibilityRole,\n ...restProps\n}: ViewProps & Pick<BadgeProps, 'onPress'>) => {\n if (onPress) {\n return (\n <Pressable accessibilityRole={accessibilityRole} onPress={onPress} {...restProps}>\n {children}\n </Pressable>\n )\n }\n\n return <View {...restProps}>{children}</View>\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = ({\n appearance = 'neutral',\n maxFontSizeMultiplier,\n variant = 'default',\n}: Partial<BadgeProps>) => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier })\n\n const statusColorMap = useStatusColorAppearanceMap()\n\n const badgeGap = 4 * fontScale\n const badgePaddingHorizontal = 8\n const badgePaddingVertical = 4\n const badgeFontSize = 12\n\n const variantStylesMap: VariantStyles = {\n default: {\n gap: badgeGap,\n backgroundColor: statusColorMap[appearance].background,\n metaLabelPaddingLeft: badgePaddingHorizontal,\n paddingHorizontal: badgePaddingHorizontal,\n paddingVertical: badgePaddingVertical,\n borderWidth: tokens.borderSizeDefault * fontScale,\n borderRadius: tokens.borderRadiusMd * fontScale,\n textColor: statusColorMap[appearance].text,\n fontWeight: 'normal',\n },\n meta: {\n gap: badgeGap,\n backgroundColor: statusColorMap[appearance].background,\n metaLabelPaddingLeft: badgePaddingHorizontal,\n paddingHorizontal: badgePaddingHorizontal,\n paddingVertical: badgePaddingVertical,\n borderWidth: tokens.borderSizeDefault * fontScale,\n borderRadius: tokens.borderRadiusMd * fontScale,\n textColor: statusColorMap[appearance].text,\n fontWeight: platformFontWeightMedium,\n },\n metaSubtle: {\n gap: badgeGap,\n backgroundColor: 'transparent',\n metaLabelPaddingLeft: badgeGap,\n paddingHorizontal: 0,\n paddingVertical: 0,\n borderWidth: 0,\n borderRadius: 0,\n textColor: colors.textColorDefaultSecondary,\n fontWeight: platformFontWeightMedium,\n },\n }\n\n return StyleSheet.create({\n badgeWrapper: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignSelf: 'flex-start',\n borderRadius: variantStylesMap[variant].borderRadius,\n borderWidth: variantStylesMap[variant].borderWidth,\n borderColor: statusColorMap[appearance].background,\n },\n badge: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: variantStylesMap[variant].gap,\n paddingVertical: variantStylesMap[variant].paddingVertical,\n paddingHorizontal: variantStylesMap[variant].paddingHorizontal,\n backgroundColor: variantStylesMap[variant].backgroundColor,\n borderRadius: variantStylesMap[variant].borderRadius - 2,\n },\n icon: {\n color: statusColorMap[appearance].icon,\n fontSize: badgeFontSize,\n },\n iconRight: {\n color: statusColorMap[appearance].icon,\n fontSize: badgeFontSize - 2,\n },\n logo: {\n fontSize: badgeFontSize * fontScale,\n },\n label: {\n color: variantStylesMap[variant].textColor,\n fontWeight: variantStylesMap[variant].fontWeight,\n fontSize: badgeFontSize,\n flexShrink: 1,\n },\n metaLabel: {\n paddingHorizontal: variantStylesMap[variant].paddingHorizontal,\n fontSize: badgeFontSize,\n alignSelf: 'center',\n flexShrink: 1,\n paddingLeft: variantStylesMap[variant].metaLabelPaddingLeft,\n },\n })\n}\n\n// =================================\n// ====== Product Logos ============\n// =================================\n\ninterface ProductLogoProps {\n logoSize: number\n}\n\nfunction GroupsLogo({ logoSize }: ProductLogoProps) {\n return (\n <Svg width={logoSize} height={logoSize} viewBox=\"0 0 16 16\" fill=\"none\">\n <Path\n d=\"M9.06 6.14H6.94c-.152.36-.438.646-.797.798v2.12c.359.152.645.438.797.797h2.117c.152-.359.437-.645.796-.797V6.94a1.502 1.502 0 01-.793-.8zM8 0C1.6 0 0 1.595 0 8s1.6 8 8 8 8-1.595 8-8-1.595-8-8-8zm3.939 10.44a1.5 1.5 0 01-2.882.585H6.94a1.5 1.5 0 11-1.963-1.963v-2.12A1.501 1.501 0 116.94 4.98h2.12a1.5 1.5 0 111.963 1.968v2.11a1.501 1.501 0 01.916 1.383z\"\n fill=\"url(#paint0_linear_2632_26363)\"\n />\n <Defs>\n <LinearGradient\n id=\"paint0_linear_2632_26363\"\n x1={-5.6338}\n y1={5.6338}\n x2={5.6338}\n y2={16.9014}\n gradientUnits=\"userSpaceOnUse\"\n >\n <Stop stopColor=\"#FF962D\" />\n <Stop offset={1} stopColor=\"#FC7638\" />\n </LinearGradient>\n </Defs>\n </Svg>\n )\n}\n\nfunction ServicesIcon({ logoSize }: ProductLogoProps) {\n return (\n <Svg width={logoSize} height={logoSize} viewBox=\"0 0 16 16\" fill=\"none\">\n <Path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M.116 8c0-6.4 1.6-8 8-8s8 1.6 8 8-1.6 8-8 8-8-1.6-8-8zm4.123 3.464a.848.848 0 10.943-1.41.848.848 0 00-.943 1.41zm.001-2.76a.848.848 0 10.948-1.408.848.848 0 00-.948 1.407zm0-2.759a.849.849 0 10.948-1.408.849.849 0 00-.948 1.408zm8.1 5.34a.388.388 0 00.03-.149v-.755a.39.39 0 00-.39-.39H6.87a.39.39 0 00-.39.39v.755a.39.39 0 00.39.39h5.11a.39.39 0 00.36-.24zm0-2.758a.388.388 0 00.03-.149v-.757a.387.387 0 00-.39-.388H6.87a.388.388 0 00-.39.388v.757a.388.388 0 00.39.388h5.11a.388.388 0 00.36-.24zm0-2.76a.388.388 0 00.03-.148v-.754a.39.39 0 00-.39-.389H6.87a.39.39 0 00-.39.387v.756a.39.39 0 00.39.39h5.11a.389.389 0 00.36-.241z\"\n fill=\"url(#paint0_linear_2632_56586)\"\n />\n <Defs>\n <LinearGradient\n id=\"paint0_linear_2632_56586\"\n x1={-5.51759}\n y1={5.6338}\n x2={5.75001}\n y2={16.9014}\n gradientUnits=\"userSpaceOnUse\"\n >\n <Stop stopColor=\"#6BB23D\" />\n <Stop offset={1} stopColor=\"#659630\" />\n </LinearGradient>\n </Defs>\n </Svg>\n )\n}\n"]}
1
+ {"version":3,"file":"badge.js","sourceRoot":"","sources":["../../../src/components/display/badge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAc,MAAM,OAAO,CAAA;AAElC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC1D,OAAO,GAAG,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AACrD,OAAO,EAAE,IAAI,EAAc,MAAM,QAAQ,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,2BAA2B,EAA8B,MAAM,uBAAuB,CAAA;AA2B/F,MAAM,0BAA0B,GAAkD;IAChF,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,UAAU;IAClB,QAAQ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AA,EAAE,cAAc,CAClB;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,GAAG,CAAC,CACP,CAAA;AACH,CAAC;AAED,SAAS,YAAY,CAAC,EAAE,QAAQ,EAAoB;IAClD,OAAO,CACL,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CACrE;MAAA,CAAC,IAAI,CACH,QAAQ,CAAC,SAAS,CAClB,QAAQ,CAAC,SAAS,CAClB,CAAC,CAAC,unBAAunB,CACznB,IAAI,CAAC,gCAAgC,EAEvC;MAAA,CAAC,IAAI,CACH;QAAA,CAAC,cAAc,CACb,EAAE,CAAC,0BAA0B,CAC7B,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CACb,EAAE,CAAC,CAAC,MAAM,CAAC,CACX,EAAE,CAAC,CAAC,OAAO,CAAC,CACZ,EAAE,CAAC,CAAC,OAAO,CAAC,CACZ,aAAa,CAAC,gBAAgB,CAE9B;UAAA,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EACzB;UAAA,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,SAAS,EACtC;QAAA,EAAE,cAAc,CAClB;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,GAAG,CAAC,CACP,CAAA;AACH,CAAC","sourcesContent":["import React, { JSX } from 'react'\nimport type { TextStyle, ViewProps, ViewStyle } from 'react-native'\nimport { Pressable, StyleSheet, View } from 'react-native'\nimport Svg, { Defs, LinearGradient, Path, Stop } from 'react-native-svg'\nimport { useFontScale, useTheme } from '../../hooks'\nimport { platformFontWeightMedium } from '../../utils'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { Icon, IconString } from './icon'\nimport { Text } from './text'\nimport { useStatusColorAppearanceMap, type StatusAppearanceUnion } from './utils/status_colors'\n\n// =================================\n// ====== Constants ================\n// =================================\n\ntype VariantUnion = 'default' | 'meta' | 'metaSubtle'\n\ntype VariantStyles = Record<\n VariantUnion,\n {\n backgroundColor: string\n paddingHorizontal: number\n paddingVertical: number\n borderWidth: number\n borderRadius: number\n textColor: string\n gap: number\n metaLabelPaddingLeft: number\n fontWeight: TextStyle['fontWeight']\n }\n>\n\ntype ProductLogoName = 'Groups' | 'Services' | 'groups' | 'services'\ntype ProductIconName = 'Chat' | 'chat'\ntype ProductLogoComponent = ({ logoSize }: { logoSize: number }) => JSX.Element\n\nconst PRODUCT_LOGO_COMPONENT_MAP: Record<ProductLogoName, ProductLogoComponent> = {\n Groups: GroupsLogo,\n groups: GroupsLogo,\n services: ServicesIcon,\n Services: ServicesIcon,\n}\n\n// =================================\n// ====== Component ================\n// =================================\n\nexport interface BadgeProps {\n /**\n * Renders the main text.\n */\n label: string\n /**\n * Renders secondary meta text to the right of the label.\n */\n metaLabel?: string\n /**\n * Changes the status color for the badge and icon.\n */\n appearance?: StatusAppearanceUnion\n /**\n * Changes form of the logo to support a meta label and badge\n */\n variant?: VariantUnion\n /**\n * Adds a product logo to the left of the text.\n */\n productLogoName?: ProductLogoName | ProductIconName\n /**\n * Shows an icon of the user choice to the left of the text.\n */\n iconName?: IconString\n /**\n * Shows an icon of the user choice to the right of the text.\n */\n iconNameRight?: IconString\n /**\n * Styles badge wrapper.\n */\n style?: ViewStyle\n /**\n * Specifies the maximum size a font can reach when allowFontScaling is enabled.\n */\n maxFontSizeMultiplier?: number\n /**\n * Callback function when the badge is pressed.\n */\n onPress?: () => void\n /**\n * Specifies the number of lines for the meta label before truncating.\n */\n numberOfLinesMetaLabel?: number\n}\n\nexport function Badge({\n appearance = 'neutral',\n metaLabel,\n style,\n iconName,\n iconNameRight,\n label,\n productLogoName,\n variant = 'default',\n maxFontSizeMultiplier,\n numberOfLinesMetaLabel = 1,\n onPress,\n}: BadgeProps) {\n const styles = useStyles({ appearance, maxFontSizeMultiplier, variant })\n const { showBadgeProductLogo } = useTheme()\n\n const isMetaSubtle = variant === 'metaSubtle'\n const hasMetaLabel = Boolean(metaLabel)\n\n const showLogo = showBadgeProductLogo && productLogoName\n const isChatLogo = productLogoName?.toLowerCase() === 'chat'\n const ProductLogoSvg = showLogo && PRODUCT_LOGO_COMPONENT_MAP[productLogoName as ProductLogoName]\n const badgeLabel = isMetaSubtle && hasMetaLabel ? `${label}:` : label\n\n return (\n <BadgeWrapper style={[styles.badgeWrapper, style]} onPress={onPress} accessibilityRole=\"button\">\n <View style={styles.badge}>\n {showLogo && ProductLogoSvg && <ProductLogoSvg logoSize={styles.logo.fontSize} />}\n {showLogo && isChatLogo && <Icon name=\"general.textMessage\" style={styles.icon} />}\n {iconName && <Icon name={iconName} style={styles.icon} />}\n <Text\n variant=\"footnote\"\n style={styles.label}\n numberOfLines={1}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n >\n {badgeLabel}\n </Text>\n {iconNameRight && <Icon name={iconNameRight} style={styles.iconRight} />}\n </View>\n {hasMetaLabel && (\n <Text\n variant=\"footnote\"\n style={styles.metaLabel}\n numberOfLines={numberOfLinesMetaLabel}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n >\n {metaLabel}\n </Text>\n )}\n </BadgeWrapper>\n )\n}\n\nconst BadgeWrapper = ({\n children,\n onPress,\n accessibilityRole,\n ...restProps\n}: ViewProps & Pick<BadgeProps, 'onPress'>) => {\n if (onPress) {\n return (\n <Pressable accessibilityRole={accessibilityRole} onPress={onPress} {...restProps}>\n {children}\n </Pressable>\n )\n }\n\n return <View {...restProps}>{children}</View>\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = ({\n appearance = 'neutral',\n maxFontSizeMultiplier,\n variant = 'default',\n}: Partial<BadgeProps>) => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier })\n\n const statusColorMap = useStatusColorAppearanceMap()\n\n const badgeGap = 4 * fontScale\n const badgePaddingHorizontal = 8\n const badgePaddingVertical = 4\n const badgeFontSize = 12\n\n const variantStylesMap: VariantStyles = {\n default: {\n gap: badgeGap,\n backgroundColor: statusColorMap[appearance].background,\n metaLabelPaddingLeft: badgePaddingHorizontal,\n paddingHorizontal: badgePaddingHorizontal,\n paddingVertical: badgePaddingVertical,\n borderWidth: tokens.borderSizeDefault * fontScale,\n borderRadius: tokens.borderRadiusMd * fontScale,\n textColor: statusColorMap[appearance].text,\n fontWeight: 'normal',\n },\n meta: {\n gap: badgeGap,\n backgroundColor: statusColorMap[appearance].background,\n metaLabelPaddingLeft: badgePaddingHorizontal,\n paddingHorizontal: badgePaddingHorizontal,\n paddingVertical: badgePaddingVertical,\n borderWidth: tokens.borderSizeDefault * fontScale,\n borderRadius: tokens.borderRadiusMd * fontScale,\n textColor: statusColorMap[appearance].text,\n fontWeight: platformFontWeightMedium,\n },\n metaSubtle: {\n gap: badgeGap,\n backgroundColor: 'transparent',\n metaLabelPaddingLeft: badgeGap,\n paddingHorizontal: 0,\n paddingVertical: 0,\n borderWidth: 0,\n borderRadius: 0,\n textColor: colors.textColorDefaultSecondary,\n fontWeight: platformFontWeightMedium,\n },\n }\n\n return StyleSheet.create({\n badgeWrapper: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignSelf: 'flex-start',\n borderRadius: variantStylesMap[variant].borderRadius,\n borderWidth: variantStylesMap[variant].borderWidth,\n borderColor: statusColorMap[appearance].background,\n },\n badge: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: variantStylesMap[variant].gap,\n paddingVertical: variantStylesMap[variant].paddingVertical,\n paddingHorizontal: variantStylesMap[variant].paddingHorizontal,\n backgroundColor: variantStylesMap[variant].backgroundColor,\n borderRadius: variantStylesMap[variant].borderRadius - 2,\n },\n icon: {\n color: statusColorMap[appearance].icon,\n fontSize: badgeFontSize,\n },\n iconRight: {\n color: statusColorMap[appearance].icon,\n fontSize: badgeFontSize - 2,\n },\n logo: {\n fontSize: badgeFontSize * fontScale,\n },\n label: {\n color: variantStylesMap[variant].textColor,\n fontWeight: variantStylesMap[variant].fontWeight,\n fontSize: badgeFontSize,\n flexShrink: 1,\n },\n metaLabel: {\n paddingHorizontal: variantStylesMap[variant].paddingHorizontal,\n fontSize: badgeFontSize,\n alignSelf: 'center',\n flexShrink: 1,\n paddingLeft: variantStylesMap[variant].metaLabelPaddingLeft,\n },\n })\n}\n\n// =================================\n// ====== Product Logos ============\n// =================================\n\ninterface ProductLogoProps {\n logoSize: number\n}\n\nfunction GroupsLogo({ logoSize }: ProductLogoProps) {\n return (\n <Svg width={logoSize} height={logoSize} viewBox=\"0 0 16 16\" fill=\"none\">\n <Path\n d=\"M9.06 6.14H6.94c-.152.36-.438.646-.797.798v2.12c.359.152.645.438.797.797h2.117c.152-.359.437-.645.796-.797V6.94a1.502 1.502 0 01-.793-.8zM8 0C1.6 0 0 1.595 0 8s1.6 8 8 8 8-1.595 8-8-1.595-8-8-8zm3.939 10.44a1.5 1.5 0 01-2.882.585H6.94a1.5 1.5 0 11-1.963-1.963v-2.12A1.501 1.501 0 116.94 4.98h2.12a1.5 1.5 0 111.963 1.968v2.11a1.501 1.501 0 01.916 1.383z\"\n fill=\"url(#paint0_linear_2632_26363)\"\n />\n <Defs>\n <LinearGradient\n id=\"paint0_linear_2632_26363\"\n x1={-5.6338}\n y1={5.6338}\n x2={5.6338}\n y2={16.9014}\n gradientUnits=\"userSpaceOnUse\"\n >\n <Stop stopColor=\"#FF962D\" />\n <Stop offset={1} stopColor=\"#FC7638\" />\n </LinearGradient>\n </Defs>\n </Svg>\n )\n}\n\nfunction ServicesIcon({ logoSize }: ProductLogoProps) {\n return (\n <Svg width={logoSize} height={logoSize} viewBox=\"0 0 16 16\" fill=\"none\">\n <Path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M.116 8c0-6.4 1.6-8 8-8s8 1.6 8 8-1.6 8-8 8-8-1.6-8-8zm4.123 3.464a.848.848 0 10.943-1.41.848.848 0 00-.943 1.41zm.001-2.76a.848.848 0 10.948-1.408.848.848 0 00-.948 1.407zm0-2.759a.849.849 0 10.948-1.408.849.849 0 00-.948 1.408zm8.1 5.34a.388.388 0 00.03-.149v-.755a.39.39 0 00-.39-.39H6.87a.39.39 0 00-.39.39v.755a.39.39 0 00.39.39h5.11a.39.39 0 00.36-.24zm0-2.758a.388.388 0 00.03-.149v-.757a.387.387 0 00-.39-.388H6.87a.388.388 0 00-.39.388v.757a.388.388 0 00.39.388h5.11a.388.388 0 00.36-.24zm0-2.76a.388.388 0 00.03-.148v-.754a.39.39 0 00-.39-.389H6.87a.39.39 0 00-.39.387v.756a.39.39 0 00.39.39h5.11a.389.389 0 00.36-.241z\"\n fill=\"url(#paint0_linear_2632_56586)\"\n />\n <Defs>\n <LinearGradient\n id=\"paint0_linear_2632_56586\"\n x1={-5.51759}\n y1={5.6338}\n x2={5.75001}\n y2={16.9014}\n gradientUnits=\"userSpaceOnUse\"\n >\n <Stop stopColor=\"#6BB23D\" />\n <Stop offset={1} stopColor=\"#659630\" />\n </LinearGradient>\n </Defs>\n </Svg>\n )\n}\n"]}
@@ -1,3 +1,8 @@
1
- export type NewConversationEntryMode = 'select_type' | 'groups' | 'teams' | 'none';
1
+ export type NewConversationEntryMode = 'select_type' | 'groups' | 'teams' | 'direct_message' | 'none';
2
+ export declare function useConversationTypeAccess(): {
3
+ canCreateGroupsConversations: boolean | undefined;
4
+ canCreateServicesConversations: boolean | undefined;
5
+ canCreateDirectMessages: boolean | undefined;
6
+ };
2
7
  export declare function useNewConversationEntry(): NewConversationEntryMode;
3
8
  //# sourceMappingURL=use_new_conversation_entry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use_new_conversation_entry.d.ts","sourceRoot":"","sources":["../../src/hooks/use_new_conversation_entry.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,wBAAwB,GAAG,aAAa,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;AAElF,wBAAgB,uBAAuB,IAAI,wBAAwB,CAyBlE"}
1
+ {"version":3,"file":"use_new_conversation_entry.d.ts","sourceRoot":"","sources":["../../src/hooks/use_new_conversation_entry.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,wBAAwB,GAChC,aAAa,GACb,QAAQ,GACR,OAAO,GACP,gBAAgB,GAChB,MAAM,CAAA;AAEV,wBAAgB,yBAAyB;;;;EAiBxC;AAED,wBAAgB,uBAAuB,IAAI,wBAAwB,CA6BlE"}
@@ -1,11 +1,22 @@
1
1
  import { useMemo } from 'react';
2
2
  import { useAppGrants } from './use_chat_permissions';
3
- export function useNewConversationEntry() {
3
+ export function useConversationTypeAccess() {
4
4
  const appGrants = useAppGrants();
5
+ return useMemo(() => ({
6
+ canCreateGroupsConversations: appGrants.data?.some(g => g.createConversations && g.appName === 'Groups'),
7
+ canCreateServicesConversations: appGrants.data?.some(g => g.createConversations && g.appName === 'Services'),
8
+ canCreateDirectMessages: appGrants.data?.some(g => g.createConversations && g.appName === 'Chat'),
9
+ }), [appGrants.data]);
10
+ }
11
+ export function useNewConversationEntry() {
12
+ const { canCreateGroupsConversations, canCreateServicesConversations, canCreateDirectMessages } = useConversationTypeAccess();
5
13
  return useMemo(() => {
6
- const canCreateGroupsConversations = appGrants.data?.some(g => g.createConversations && g.appName === 'Groups');
7
- const canCreateServicesConversations = appGrants.data?.some(g => g.createConversations && g.appName === 'Services');
8
- if (canCreateGroupsConversations && canCreateServicesConversations) {
14
+ const availableCount = [
15
+ canCreateGroupsConversations,
16
+ canCreateServicesConversations,
17
+ canCreateDirectMessages,
18
+ ].filter(Boolean).length;
19
+ if (availableCount > 1) {
9
20
  return 'select_type';
10
21
  }
11
22
  if (canCreateGroupsConversations) {
@@ -14,7 +25,10 @@ export function useNewConversationEntry() {
14
25
  if (canCreateServicesConversations) {
15
26
  return 'teams';
16
27
  }
28
+ if (canCreateDirectMessages) {
29
+ return 'direct_message';
30
+ }
17
31
  return 'none';
18
- }, [appGrants.data]);
32
+ }, [canCreateGroupsConversations, canCreateServicesConversations, canCreateDirectMessages]);
19
33
  }
20
34
  //# sourceMappingURL=use_new_conversation_entry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use_new_conversation_entry.js","sourceRoot":"","sources":["../../src/hooks/use_new_conversation_entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAIrD,MAAM,UAAU,uBAAuB;IACrC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAEhC,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,MAAM,4BAA4B,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,CACvD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAmB,IAAI,CAAC,CAAC,OAAO,KAAK,QAAQ,CACrD,CAAA;QACD,MAAM,8BAA8B,GAAG,SAAS,CAAC,IAAI,EAAE,IAAI,CACzD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAmB,IAAI,CAAC,CAAC,OAAO,KAAK,UAAU,CACvD,CAAA;QAED,IAAI,4BAA4B,IAAI,8BAA8B,EAAE,CAAC;YACnE,OAAO,aAAa,CAAA;QACtB,CAAC;QAED,IAAI,4BAA4B,EAAE,CAAC;YACjC,OAAO,QAAQ,CAAA;QACjB,CAAC;QAED,IAAI,8BAA8B,EAAE,CAAC;YACnC,OAAO,OAAO,CAAA;QAChB,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;AACtB,CAAC","sourcesContent":["import { useMemo } from 'react'\nimport { useAppGrants } from './use_chat_permissions'\n\nexport type NewConversationEntryMode = 'select_type' | 'groups' | 'teams' | 'none'\n\nexport function useNewConversationEntry(): NewConversationEntryMode {\n const appGrants = useAppGrants()\n\n return useMemo(() => {\n const canCreateGroupsConversations = appGrants.data?.some(\n g => g.createConversations && g.appName === 'Groups'\n )\n const canCreateServicesConversations = appGrants.data?.some(\n g => g.createConversations && g.appName === 'Services'\n )\n\n if (canCreateGroupsConversations && canCreateServicesConversations) {\n return 'select_type'\n }\n\n if (canCreateGroupsConversations) {\n return 'groups'\n }\n\n if (canCreateServicesConversations) {\n return 'teams'\n }\n\n return 'none'\n }, [appGrants.data])\n}\n"]}
1
+ {"version":3,"file":"use_new_conversation_entry.js","sourceRoot":"","sources":["../../src/hooks/use_new_conversation_entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AASrD,MAAM,UAAU,yBAAyB;IACvC,MAAM,SAAS,GAAG,YAAY,EAAE,CAAA;IAEhC,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,4BAA4B,EAAE,SAAS,CAAC,IAAI,EAAE,IAAI,CAChD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAmB,IAAI,CAAC,CAAC,OAAO,KAAK,QAAQ,CACrD;QACD,8BAA8B,EAAE,SAAS,CAAC,IAAI,EAAE,IAAI,CAClD,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAmB,IAAI,CAAC,CAAC,OAAO,KAAK,UAAU,CACvD;QACD,uBAAuB,EAAE,SAAS,CAAC,IAAI,EAAE,IAAI,CAC3C,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAmB,IAAI,CAAC,CAAC,OAAO,KAAK,MAAM,CACnD;KACF,CAAC,EACF,CAAC,SAAS,CAAC,IAAI,CAAC,CACjB,CAAA;AACH,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,MAAM,EAAE,4BAA4B,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,GAC7F,yBAAyB,EAAE,CAAA;IAE7B,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,MAAM,cAAc,GAAG;YACrB,4BAA4B;YAC5B,8BAA8B;YAC9B,uBAAuB;SACxB,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAA;QAExB,IAAI,cAAc,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,aAAa,CAAA;QACtB,CAAC;QAED,IAAI,4BAA4B,EAAE,CAAC;YACjC,OAAO,QAAQ,CAAA;QACjB,CAAC;QAED,IAAI,8BAA8B,EAAE,CAAC;YACnC,OAAO,OAAO,CAAA;QAChB,CAAC;QAED,IAAI,uBAAuB,EAAE,CAAC;YAC5B,OAAO,gBAAgB,CAAA;QACzB,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC,EAAE,CAAC,4BAA4B,EAAE,8BAA8B,EAAE,uBAAuB,CAAC,CAAC,CAAA;AAC7F,CAAC","sourcesContent":["import { useMemo } from 'react'\nimport { useAppGrants } from './use_chat_permissions'\n\nexport type NewConversationEntryMode =\n | 'select_type'\n | 'groups'\n | 'teams'\n | 'direct_message'\n | 'none'\n\nexport function useConversationTypeAccess() {\n const appGrants = useAppGrants()\n\n return useMemo(\n () => ({\n canCreateGroupsConversations: appGrants.data?.some(\n g => g.createConversations && g.appName === 'Groups'\n ),\n canCreateServicesConversations: appGrants.data?.some(\n g => g.createConversations && g.appName === 'Services'\n ),\n canCreateDirectMessages: appGrants.data?.some(\n g => g.createConversations && g.appName === 'Chat'\n ),\n }),\n [appGrants.data]\n )\n}\n\nexport function useNewConversationEntry(): NewConversationEntryMode {\n const { canCreateGroupsConversations, canCreateServicesConversations, canCreateDirectMessages } =\n useConversationTypeAccess()\n\n return useMemo(() => {\n const availableCount = [\n canCreateGroupsConversations,\n canCreateServicesConversations,\n canCreateDirectMessages,\n ].filter(Boolean).length\n\n if (availableCount > 1) {\n return 'select_type'\n }\n\n if (canCreateGroupsConversations) {\n return 'groups'\n }\n\n if (canCreateServicesConversations) {\n return 'teams'\n }\n\n if (canCreateDirectMessages) {\n return 'direct_message'\n }\n\n return 'none'\n }, [canCreateGroupsConversations, canCreateServicesConversations, canCreateDirectMessages])\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_new_entry_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_new_entry_screen.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAOxC,OAAO,KAAK,EAEV,uCAAuC,EACxC,MAAM,sBAAsB,CAAA;AAQ7B,eAAO,MAAM,0BAA0B,GAAI,WAAW,uCAAuC,sBAyD5F,CAAA"}
1
+ {"version":3,"file":"conversation_new_entry_screen.d.ts","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_new_entry_screen.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAA;AAOxC,OAAO,KAAK,EAEV,uCAAuC,EACxC,MAAM,sBAAsB,CAAA;AAS7B,eAAO,MAAM,0BAA0B,GAAI,WAAW,uCAAuC,sBA8D5F,CAAA"}
@@ -19,6 +19,10 @@ export const ConversationNewEntryScreen = ({ route }) => {
19
19
  navigation.replace('ConversationSelectTeamsILeadRecipients', route.params);
20
20
  return;
21
21
  }
22
+ if (entryMode === 'direct_message') {
23
+ navigation.replace('ConversationSelectDirectMessageRecipients', route.params);
24
+ return;
25
+ }
22
26
  if (entryMode === 'none') {
23
27
  navigation.goBack();
24
28
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_new_entry_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_new_entry_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAExD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA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ackNavigationProp } from '@react-navigation/native-stack'\nimport React, { useEffect } from 'react'\nimport { ScrollView, StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Button, Heading } from '../../components'\nimport { DefaultLoading } from '../../components/page/loading'\nimport { useNewConversationEntry } from '../../hooks/use_new_conversation_entry'\nimport { Haptic } from '../../utils/native_adapters'\nimport type {\n ConversationSelectRecipientsParams,\n ConversationSelectRecipientsScreenProps,\n} from './types/screen_props'\n\ntype NewConversationStackParamList = {\n ConversationNewEntry: ConversationSelectRecipientsParams | undefined\n ConversationSelectGroupRecipients: ConversationSelectRecipientsParams | undefined\n ConversationSelectTeamsILeadRecipients: ConversationSelectRecipientsParams | undefined\n}\n\nexport const ConversationNewEntryScreen = ({ route }: ConversationSelectRecipientsScreenProps) => {\n const styles = useStyles()\n const navigation = useNavigation<NativeStackNavigationProp<NewConversationStackParamList>>()\n const entryMode = useNewConversationEntry()\n\n useEffect(() => {\n if (entryMode === 'groups') {\n navigation.replace('ConversationSelectGroupRecipients', route.params)\n return\n }\n\n if (entryMode === 'teams') {\n navigation.replace('ConversationSelectTeamsILeadRecipients', route.params)\n return\n }\n\n if (entryMode === 'none') {\n navigation.goBack()\n return\n }\n }, [entryMode, navigation, route.params])\n\n if (entryMode !== 'select_type') return <DefaultLoading />\n\n const handleGroupPress = () => {\n Haptic.impactLight()\n navigation.navigate('ConversationSelectGroupRecipients', route.params)\n }\n\n const handleTeamPress = () => {\n Haptic.impactLight()\n navigation.navigate('ConversationSelectTeamsILeadRecipients', route.params)\n }\n\n return (\n <ScrollView contentContainerStyle={styles.contentContainer}>\n <View style={styles.header}>\n <Heading variant=\"h2\">Start a conversation by</Heading>\n </View>\n <View style={styles.actions}>\n <Button\n title=\"Group\"\n onPress={handleGroupPress}\n size=\"lg\"\n variant=\"outline\"\n accessibilityHint=\"Opens group selection screen\"\n />\n <Button\n title=\"Team\"\n onPress={handleTeamPress}\n size=\"lg\"\n variant=\"outline\"\n accessibilityHint=\"Opens team selection screen\"\n />\n </View>\n </ScrollView>\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n contentContainer: {\n flexGrow: 1,\n padding: 16,\n paddingBottom: 16 + bottom,\n justifyContent: 'center',\n },\n header: {\n marginBottom: 24,\n alignItems: 'center',\n },\n actions: {\n gap: 12,\n flexDirection: 'row',\n justifyContent: 'center',\n },\n })\n}\n"]}
1
+ {"version":3,"file":"conversation_new_entry_screen.js","sourceRoot":"","sources":["../../../src/screens/conversation_select_recipients/conversation_new_entry_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAExD,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAA;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAA;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAA;AAapD,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EAAE,KAAK,EAA2C,EAAE,EAAE;IAC/F,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,UAAU,GAAG,aAAa,EAA4D,CAAA;IAC5F,MAAM,SAAS,GAAG,uBAAuB,EAAE,CAAA;IAE3C,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;YAC3B,UAAU,CAAC,OAAO,CAAC,mCAAmC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;YACrE,OAAM;QACR,CAAC;QAED,IAAI,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AAC,OAAO,CACb,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAC1B,IAAI,CAAC,IAAI,CACT,OAAO,CAAC,SAAS,CACjB,iBAAiB,CAAC,8BAA8B,EAElD;QAAA,CAAC,MAAM,CACL,KAAK,CAAC,MAAM,CACZ,OAAO,CAAC,CAAC,eAAe,CAAC,CACzB,IAAI,CAAC,IAAI,CACT,OAAO,CAAC,SAAS,CACjB,iBAAiB,CAAC,6BAA6B,EAEnD;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,UAAU,CAAC,CACd,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAA;IAEtC,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,gBAAgB,EAAE;YAChB,QAAQ,EAAE,CAAC;YACX,OAAO,EAAE,EAAE;YACX,aAAa,EAAE,EAAE,GAAG,MAAM;YAC1B,cAAc,EAAE,QAAQ;SACzB;QACD,MAAM,EAAE;YACN,YAAY,EAAE,EAAE;YAChB,UAAU,EAAE,QAAQ;SACrB;QACD,OAAO,EAAE;YACP,GAAG,EAAE,EAAE;YACP,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,QAAQ;SACzB;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport type { NativeStackNavigationProp } from '@react-navigation/native-stack'\nimport React, { useEffect } from 'react'\nimport { ScrollView, StyleSheet, View } from 'react-native'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\nimport { Button, Heading } from '../../components'\nimport { DefaultLoading } from '../../components/page/loading'\nimport { useNewConversationEntry } from '../../hooks/use_new_conversation_entry'\nimport { Haptic } from '../../utils/native_adapters'\nimport type {\n ConversationSelectRecipientsParams,\n ConversationSelectRecipientsScreenProps,\n} from './types/screen_props'\n\ntype NewConversationStackParamList = {\n ConversationNewEntry: ConversationSelectRecipientsParams | undefined\n ConversationSelectGroupRecipients: ConversationSelectRecipientsParams | undefined\n ConversationSelectTeamsILeadRecipients: ConversationSelectRecipientsParams | undefined\n ConversationSelectDirectMessageRecipients: ConversationSelectRecipientsParams | undefined\n}\n\nexport const ConversationNewEntryScreen = ({ route }: ConversationSelectRecipientsScreenProps) => {\n const styles = useStyles()\n const navigation = useNavigation<NativeStackNavigationProp<NewConversationStackParamList>>()\n const entryMode = useNewConversationEntry()\n\n useEffect(() => {\n if (entryMode === 'groups') {\n navigation.replace('ConversationSelectGroupRecipients', route.params)\n return\n }\n\n if (entryMode === 'teams') {\n navigation.replace('ConversationSelectTeamsILeadRecipients', route.params)\n return\n }\n\n if (entryMode === 'direct_message') {\n navigation.replace('ConversationSelectDirectMessageRecipients', route.params)\n return\n }\n\n if (entryMode === 'none') {\n navigation.goBack()\n return\n }\n }, [entryMode, navigation, route.params])\n\n if (entryMode !== 'select_type') return <DefaultLoading />\n\n const handleGroupPress = () => {\n Haptic.impactLight()\n navigation.navigate('ConversationSelectGroupRecipients', route.params)\n }\n\n const handleTeamPress = () => {\n Haptic.impactLight()\n navigation.navigate('ConversationSelectTeamsILeadRecipients', route.params)\n }\n\n return (\n <ScrollView contentContainerStyle={styles.contentContainer}>\n <View style={styles.header}>\n <Heading variant=\"h2\">Start a conversation by</Heading>\n </View>\n <View style={styles.actions}>\n <Button\n title=\"Group\"\n onPress={handleGroupPress}\n size=\"lg\"\n variant=\"outline\"\n accessibilityHint=\"Opens group selection screen\"\n />\n <Button\n title=\"Team\"\n onPress={handleTeamPress}\n size=\"lg\"\n variant=\"outline\"\n accessibilityHint=\"Opens team selection screen\"\n />\n </View>\n </ScrollView>\n )\n}\n\nconst useStyles = () => {\n const { bottom } = useSafeAreaInsets()\n\n return StyleSheet.create({\n contentContainer: {\n flexGrow: 1,\n padding: 16,\n paddingBottom: 16 + bottom,\n justifyContent: 'center',\n },\n header: {\n marginBottom: 24,\n alignItems: 'center',\n },\n actions: {\n gap: 12,\n flexDirection: 'row',\n justifyContent: 'center',\n },\n })\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_select_type_screen.d.ts","sourceRoot":"","sources":["../../src/screens/conversation_select_type_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAA;AAC1F,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAA;AAG3D,eAAO,MAAM,mCAAmC,uEAE9C,CAAA;AAEF,MAAM,MAAM,iCAAiC,GAAG,iBAAiB,CAAC;IAChE,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,yBAAyB,CAAC,EAAE,yBAAyB,CAAA;CACtD,CAAC,CAAA;AAOF,wBAAgB,4BAA4B,CAAC,EAAE,KAAK,EAAE,EAAE,iCAAiC,qBA0FxF"}
1
+ {"version":3,"file":"conversation_select_type_screen.d.ts","sourceRoot":"","sources":["../../src/screens/conversation_select_type_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAA;AAC1F,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAA;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAA;AAG3D,eAAO,MAAM,mCAAmC,uEAE9C,CAAA;AAEF,MAAM,MAAM,iCAAiC,GAAG,iBAAiB,CAAC;IAChE,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,yBAAyB,CAAC,EAAE,yBAAyB,CAAA;CACtD,CAAC,CAAA;AAOF,wBAAgB,4BAA4B,CAAC,EAAE,KAAK,EAAE,EAAE,iCAAiC,qBAyFxF"}
@@ -3,20 +3,18 @@ import React from 'react';
3
3
  import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet';
4
4
  import { useCurrentPerson } from '../hooks/use_current_person';
5
5
  import { availableFeatures, useFeatures } from '../hooks/use_features';
6
- import { useNewConversationEntry } from '../hooks/use_new_conversation_entry';
6
+ import { useConversationTypeAccess } from '../hooks/use_new_conversation_entry';
7
7
  import { Haptic } from '../utils/native_adapters';
8
8
  export const ConversationSelectTypeScreenOptions = getFormSheetScreenOptions({
9
9
  headerTitle: 'New conversation',
10
10
  });
11
11
  export function ConversationSelectTypeScreen({ route }) {
12
12
  const navigation = useNavigation();
13
- const entryMode = useNewConversationEntry();
13
+ const { canCreateGroupsConversations, canCreateServicesConversations } = useConversationTypeAccess();
14
14
  const { featureEnabled } = useFeatures();
15
15
  const { directMessagesDisabled, under_18 } = useCurrentPerson();
16
16
  const { newConversationFromFilter, chat_group_graph_id, group_source_app_name } = route.params || {};
17
17
  const filterParams = { chat_group_graph_id, group_source_app_name };
18
- const canCreateGroups = entryMode === 'select_type' || entryMode === 'groups';
19
- const canCreateTeams = entryMode === 'select_type' || entryMode === 'teams';
20
18
  const dmFeatureEnabled = featureEnabled(availableFeatures.direct_messages_eap);
21
19
  const handleFilterPress = () => {
22
20
  if (!newConversationFromFilter)
@@ -59,8 +57,8 @@ export function ConversationSelectTypeScreen({ route }) {
59
57
  <FormSheet.HeaderTitle>Start a conversation by</FormSheet.HeaderTitle>
60
58
  </FormSheet.Header>
61
59
  {newConversationFromFilter && (<FormSheet.Action title={`New conversation in ${newConversationFromFilter.name}`} onPress={handleFilterPress} accessibilityHint="Creates a conversation pre-scoped to the current filter"/>)}
62
- {canCreateGroups && (<FormSheet.Action title="Group" onPress={handleGroupPress} accessibilityHint="Opens group selection screen"/>)}
63
- {canCreateTeams && (<FormSheet.Action title="Team" onPress={handleTeamPress} accessibilityHint="Opens team selection screen"/>)}
60
+ {canCreateGroupsConversations && (<FormSheet.Action title="Group" onPress={handleGroupPress} accessibilityHint="Opens group selection screen"/>)}
61
+ {canCreateServicesConversations && (<FormSheet.Action title="Team" onPress={handleTeamPress} accessibilityHint="Opens team selection screen"/>)}
64
62
  {dmFeatureEnabled && !under_18 && (<FormSheet.Action title="Direct message" onPress={handleDirectMessagePress} disabled={directMessagesDisabled} disabledReason={directMessagesDisabled ? 'Disabled in chat settings' : undefined} accessibilityHint="Opens direct message recipient selection screen"/>)}
65
63
  </FormSheet.Root>);
66
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"conversation_select_type_screen.js","sourceRoot":"","sources":["../../src/screens/conversation_select_type_screen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAqB,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAC3E,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,SAAS,EAAE,EAAE,yBAAyB,EAAE,MAAM,oCAAoC,CAAA;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAA;AAC9D,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAA;AAI7E,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAA;AAEjD,MAAM,CAAC,MAAM,mCAAmC,GAAG,yBAAyB,CAAC;IAC3E,WAAW,EAAE,kBAAkB;CAChC,CAAC,CAAA;AAaF,MAAM,UAAU,4BAA4B,CAAC,EAAE,KAAK,EAAqC;IACvF,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAClC,MAAM,SAAS,GAAG,uBAAuB,EAAE,CAAA;IAC3C,MAAM,EAAE,cAAc,EAAE,GAAG,WAAW,EAAE,CAAA;IACxC,MAAM,EAAE,sBAAsB,EAAE,QAAQ,EAAE,GAAG,g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gBAAgB,CACtB,OAAO,CAAC,CAAC,wBAAwB,CAAC,CAClC,QAAQ,CAAC,CAAC,sBAAsB,CAAC,CACjC,cAAc,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,SAAS,CAAC,CACjF,iBAAiB,CAAC,iDAAiD,EACnE,CACH,CACH;IAAA,EAAE,SAAS,CAAC,IAAI,CAAC,CAClB,CAAA;AACH,CAAC","sourcesContent":["import { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React from 'react'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\nimport { useCurrentPerson } from '../hooks/use_current_person'\nimport { availableFeatures, useFeatures } from '../hooks/use_features'\nimport { useNewConversationEntry } from '../hooks/use_new_conversation_entry'\nimport type { NewConversationFromFilter } from '../hooks/use_new_conversation_from_filter'\nimport { AppName } from '../types/resources/app_name'\nimport { GraphId } from '../types/resources/group_resource'\nimport { Haptic } from '../utils/native_adapters'\n\nexport const ConversationSelectTypeScreenOptions = getFormSheetScreenOptions({\n headerTitle: 'New conversation',\n})\n\nexport type ConversationSelectTypeScreenProps = StaticScreenProps<{\n chat_group_graph_id?: GraphId\n group_source_app_name?: AppName\n newConversationFromFilter?: NewConversationFromFilter\n}>\n\ntype NewConversationTypeScreen =\n | 'ConversationSelectGroupRecipients'\n | 'ConversationSelectTeamsILeadRecipients'\n | 'ConversationSelectDirectMessageRecipients'\n\nexport function ConversationSelectTypeScreen({ route }: ConversationSelectTypeScreenProps) {\n const navigation = useNavigation()\n const entryMode = useNewConversationEntry()\n const { featureEnabled } = useFeatures()\n const { directMessagesDisabled, under_18 } = useCurrentPerson()\n const { newConversationFromFilter, chat_group_graph_id, group_source_app_name } =\n route.params || {}\n\n const filterParams = { chat_group_graph_id, group_source_app_name }\n const canCreateGroups = entryMode === 'select_type' || entryMode === 'groups'\n const canCreateTeams = entryMode === 'select_type' || entryMode === 'teams'\n const dmFeatureEnabled = featureEnabled(availableFeatures.direct_messages_eap)\n\n const handleFilterPress = () => {\n if (!newConversationFromFilter) return\n\n Haptic.impactLight()\n navigation.goBack()\n requestAnimationFrame(() => {\n if (newConversationFromFilter.sourceAppName === 'groups') {\n navigation.navigate('New', {\n screen: 'ConversationNew',\n params: {\n ...filterParams,\n source_app_name: 'Groups' as AppName,\n group_id: newConversationFromFilter.groupId,\n },\n })\n } else {\n navigation.navigate('New', {\n screen: 'ConversationNew',\n params: {\n ...filterParams,\n source_app_name: 'Services' as AppName,\n team_ids: newConversationFromFilter.teamIds,\n },\n })\n }\n })\n }\n\n const navigateToNewConversationType = (screen: NewConversationTypeScreen) => {\n Haptic.impactLight()\n navigation.goBack()\n requestAnimationFrame(() => navigation.navigate('New', { screen, params: filterParams }))\n }\n\n const handleGroupPress = () => navigateToNewConversationType('ConversationSelectGroupRecipients')\n const handleTeamPress = () =>\n navigateToNewConversationType('ConversationSelectTeamsILeadRecipients')\n const handleDirectMessagePress = () =>\n navigateToNewConversationType('ConversationSelectDirectMessageRecipients')\n\n return (\n <FormSheet.Root>\n <FormSheet.Header>\n <FormSheet.HeaderTitle>Start a conversation by</FormSheet.HeaderTitle>\n </FormSheet.Header>\n {newConversationFromFilter && (\n <FormSheet.Action\n title={`New conversation in ${newConversationFromFilter.name}`}\n onPress={handleFilterPress}\n accessibilityHint=\"Creates a conversation pre-scoped to the current filter\"\n />\n )}\n {canCreateGroups && (\n <FormSheet.Action\n title=\"Group\"\n onPress={handleGroupPress}\n accessibilityHint=\"Opens group selection screen\"\n />\n )}\n {canCreateTeams && (\n <FormSheet.Action\n title=\"Team\"\n onPress={handleTeamPress}\n accessibilityHint=\"Opens team selection screen\"\n />\n )}\n {dmFeatureEnabled && !under_18 && (\n <FormSheet.Action\n title=\"Direct message\"\n onPress={handleDirectMessagePress}\n disabled={directMessagesDisabled}\n disabledReason={directMessagesDisabled ? 'Disabled in chat settings' : undefined}\n accessibilityHint=\"Opens direct message recipient selection screen\"\n />\n )}\n </FormSheet.Root>\n )\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AW,CAAC,uBAAuB,EAAE,SAAS,CAAC,WAAW,CACvE;MAAA,EAAE,SAAS,CAAC,MAAM,CAClB;MAAA,CAAC,yBAAyB,IAAI,CAC5B,CAAC,SAAS,CAAC,MAAM,CACf,KAAK,CAAC,CAAC,uBAAuB,yBAAyB,CAAC,IAAI,EAAE,CAAC,CAC/D,OAAO,CAAC,CAAC,iBAAiB,CAAC,CAC3B,iBAAiB,CAAC,yDAAyD,EAC3E,CACH,CACD;MAAA,CAAC,4BAA4B,IAAI,CAC/B,CAAC,SAAS,CAAC,MAAM,CACf,KAAK,CAAC,OAAO,CACb,OAAO,CAAC,CAAC,gBAAgB,CAAC,CAC1B,iBAAiB,CAAC,8BAA8B,EAChD,CACH,CACD;MAAA,CAAC,8BAA8B,IAAI,CACjC,CAAC,SAAS,CAAC,MAAM,CACf,KAAK,CAAC,MAAM,CACZ,OAAO,CAAC,CAAC,eAAe,CAAC,CACzB,iBAAiB,CAAC,6BAA6B,EAC/C,CACH,CACD;MAAA,CAAC,gBAAgB,IAAI,CAAC,QAAQ,IAAI,CAChC,CAAC,SAAS,CAAC,MAAM,CACf,KAAK,CAAC,gBAAgB,CACtB,OAAO,CAAC,CAAC,wBAAwB,CAAC,CAClC,QAAQ,CAAC,CAAC,sBAAsB,CAAC,CACjC,cAAc,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,SAAS,CAAC,CACjF,iBAAiB,CAAC,iDAAiD,EACnE,CACH,CACH;IAAA,EAAE,SAAS,CAAC,IAAI,CAAC,CAClB,CAAA;AACH,CAAC","sourcesContent":["import { StaticScreenProps, useNavigation } from '@react-navigation/native'\nimport React from 'react'\nimport FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'\nimport { useCurrentPerson } from '../hooks/use_current_person'\nimport { availableFeatures, useFeatures } from '../hooks/use_features'\nimport { useConversationTypeAccess } from '../hooks/use_new_conversation_entry'\nimport type { NewConversationFromFilter } from '../hooks/use_new_conversation_from_filter'\nimport { AppName } from '../types/resources/app_name'\nimport { GraphId } from '../types/resources/group_resource'\nimport { Haptic } from '../utils/native_adapters'\n\nexport const ConversationSelectTypeScreenOptions = getFormSheetScreenOptions({\n headerTitle: 'New conversation',\n})\n\nexport type ConversationSelectTypeScreenProps = StaticScreenProps<{\n chat_group_graph_id?: GraphId\n group_source_app_name?: AppName\n newConversationFromFilter?: NewConversationFromFilter\n}>\n\ntype NewConversationTypeScreen =\n | 'ConversationSelectGroupRecipients'\n | 'ConversationSelectTeamsILeadRecipients'\n | 'ConversationSelectDirectMessageRecipients'\n\nexport function ConversationSelectTypeScreen({ route }: ConversationSelectTypeScreenProps) {\n const navigation = useNavigation()\n const { canCreateGroupsConversations, canCreateServicesConversations } =\n useConversationTypeAccess()\n const { featureEnabled } = useFeatures()\n const { directMessagesDisabled, under_18 } = useCurrentPerson()\n const { newConversationFromFilter, chat_group_graph_id, group_source_app_name } =\n route.params || {}\n\n const filterParams = { chat_group_graph_id, group_source_app_name }\n const dmFeatureEnabled = featureEnabled(availableFeatures.direct_messages_eap)\n\n const handleFilterPress = () => {\n if (!newConversationFromFilter) return\n\n Haptic.impactLight()\n navigation.goBack()\n requestAnimationFrame(() => {\n if (newConversationFromFilter.sourceAppName === 'groups') {\n navigation.navigate('New', {\n screen: 'ConversationNew',\n params: {\n ...filterParams,\n source_app_name: 'Groups' as AppName,\n group_id: newConversationFromFilter.groupId,\n },\n })\n } else {\n navigation.navigate('New', {\n screen: 'ConversationNew',\n params: {\n ...filterParams,\n source_app_name: 'Services' as AppName,\n team_ids: newConversationFromFilter.teamIds,\n },\n })\n }\n })\n }\n\n const navigateToNewConversationType = (screen: NewConversationTypeScreen) => {\n Haptic.impactLight()\n navigation.goBack()\n requestAnimationFrame(() => navigation.navigate('New', { screen, params: filterParams }))\n }\n\n const handleGroupPress = () => navigateToNewConversationType('ConversationSelectGroupRecipients')\n const handleTeamPress = () =>\n navigateToNewConversationType('ConversationSelectTeamsILeadRecipients')\n const handleDirectMessagePress = () =>\n navigateToNewConversationType('ConversationSelectDirectMessageRecipients')\n\n return (\n <FormSheet.Root>\n <FormSheet.Header>\n <FormSheet.HeaderTitle>Start a conversation by</FormSheet.HeaderTitle>\n </FormSheet.Header>\n {newConversationFromFilter && (\n <FormSheet.Action\n title={`New conversation in ${newConversationFromFilter.name}`}\n onPress={handleFilterPress}\n accessibilityHint=\"Creates a conversation pre-scoped to the current filter\"\n />\n )}\n {canCreateGroupsConversations && (\n <FormSheet.Action\n title=\"Group\"\n onPress={handleGroupPress}\n accessibilityHint=\"Opens group selection screen\"\n />\n )}\n {canCreateServicesConversations && (\n <FormSheet.Action\n title=\"Team\"\n onPress={handleTeamPress}\n accessibilityHint=\"Opens team selection screen\"\n />\n )}\n {dmFeatureEnabled && !under_18 && (\n <FormSheet.Action\n title=\"Direct message\"\n onPress={handleDirectMessagePress}\n disabled={directMessagesDisabled}\n disabledReason={directMessagesDisabled ? 'Disabled in chat settings' : undefined}\n accessibilityHint=\"Opens direct message recipient selection screen\"\n />\n )}\n </FormSheet.Root>\n )\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"list_header_component.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversations/components/list_header_component.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAgCnD,eAAO,MAAM,mBAAmB,yBAiN/B,CAAA"}
1
+ {"version":3,"file":"list_header_component.d.ts","sourceRoot":"","sources":["../../../../src/screens/conversations/components/list_header_component.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAgCnD,eAAO,MAAM,mBAAmB,yBAwN/B,CAAA"}
@@ -67,6 +67,12 @@ export const ListHeaderComponent = () => {
67
67
  params: { ...route.params },
68
68
  });
69
69
  }
70
+ if (entryMode === 'direct_message') {
71
+ return navigation.navigate('New', {
72
+ screen: 'ConversationSelectDirectMessageRecipients',
73
+ params: { ...route.params },
74
+ });
75
+ }
70
76
  }, [navigation, route.params, entryMode, newConversationFromFilter]);
71
77
  const handleChatSettings = useCallback(() => {
72
78
  navigation.navigate('ChatSettings', {});
@@ -1 +1 @@
1
- {"version":3,"file":"list_header_component.js","sourceRoot":"","sources":["../../../../src/screens/conversations/components/list_header_component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAC7E,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,QAAQ,GACT,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,0CAA0C,CAAA;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,iDAAiD,CAAA;AAE9F,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAA;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAA;AAEvD,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE,MAAM,sBAAsB,GAAG,EAAE,CAAA;AAEjC,IAAK,WAMJ;AAND,WAAK,WAAW;IACd,0BAAW,CAAA;IACX,gCAAiB,CAAA;IACjB,8BAAe,CAAA;IACf,0BAAW,CAAA;IACX,4BAAa,CAAA;AACf,CAAC,EANI,WAAW,KAAX,WAAW,QAMf;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAA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AAC,CAAC,KAAK;YACvD,UAAU,EAAE,qBAAqB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ;YAC3D,cAAc,EAAE,eAAe;YAC/B,aAAa,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5C,iBAAiB,EAAE,sBAAsB;SAC1C;QACD,cAAc,EAAE;YACd,GAAG,EAAE,CAAC;SACP;QACD,gBAAgB,EAAE;YAChB,aAAa,EAAE,KAAK;YACpB,GAAG,EAAE,CAAC;YACN,UAAU,EAAE,QAAQ;SACrB;QACD,cAAc,EAAE;YACd,aAAa,EAAE,CAAC;SACjB;QACD,SAAS,EAAE;YACT,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,YAAY;YAC5B,GAAG,EAAE,CAAC;YACN,iBAAiB,EAAE,sBAAsB;YACzC,QAAQ,EAAE,CAAC;SACZ;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,CAAC;YACP,QAAQ,EAAE,EAAE;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'\nimport React, { useCallback, useMemo } from 'react'\nimport { Alert, ScrollView, StyleSheet, View } from 'react-native'\nimport { Heading, TextButton, ToggleButton } from '../../../components'\nimport {\n useAtFontScaleBreakpoint,\n useCanCreateConversations,\n useCurrentPersonCache,\n useDirectMessagesEnabled,\n useHasDirectMessages,\n useNewConversationEntry,\n useTheme,\n} from '../../../hooks'\nimport { useMarkAllRead } from '../../../hooks/use_conversations_actions'\nimport { useCanDisplayGroups } from '../../../hooks/use_groups'\nimport { useNewConversationFromFilter } from '../../../hooks/use_new_conversation_from_filter'\nimport { GraphId } from '../../../types/resources/group_resource'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../../utils'\nimport { Haptic } from '../../../utils/native_adapters'\nimport { ConversationsScreenProps } from '../conversations_screen'\nimport { ChatGroupBadge } from './chat_group_badge'\nimport { ListHeaderActionButton } from './list_header_action_button'\n\nconst ROW_PADDING_HORIZONTAL = 16\n\nenum FilterTypes {\n All = 'All',\n Groups = 'Groups',\n Teams = 'Teams',\n DMs = 'DMs',\n More = 'More',\n}\n\nexport const ListHeaderComponent = () => {\n const navigation = useNavigation()\n const canFilterByTeams = useCanDisplayGroups({ source_app_name: 'Services', source_type: 'Team' })\n const canFilterByGroups = useCanDisplayGroups({ source_app_name: 'Groups', source_type: 'Group' })\n const directMessagesEnabled = useDirectMessagesEnabled()\n const hasDirectMessages = useHasDirectMessages()\n const canFilterByDMs = directMessagesEnabled && hasDirectMessages\n const route = useRoute<RouteProp<ConversationsScreenProps['route']>>()\n const {\n chat_group_graph_id,\n group_source_app_name = '',\n show_direct_messages,\n } = route.params || {}\n const currentPersonCache = useCurrentPersonCache()\n const { markAllRead, isPending } = useMarkAllRead()\n const canCreateConversations = useCanCreateConversations()\n const entryMode = useNewConversationEntry()\n const newConversationFromFilter = useNewConversationFromFilter(\n chat_group_graph_id as GraphId | undefined\n )\n\n const active: FilterTypes = useMemo(() => {\n if (chat_group_graph_id) {\n return FilterTypes.More\n } else if (/groups/i.test(group_source_app_name)) {\n return FilterTypes.Groups\n } else if (/services/i.test(group_source_app_name)) {\n return FilterTypes.Teams\n } else if (show_direct_messages) {\n return FilterTypes.DMs\n }\n\n return FilterTypes.All\n }, [chat_group_graph_id, group_source_app_name, show_direct_messages])\n\n const handleNewConversationNavigation = useCallback(() => {\n if (newConversationFromFilter || entryMode === 'select_type') {\n return navigation.navigate('ConversationSelectType', {\n ...route.params,\n newConversationFromFilter,\n })\n }\n\n if (entryMode === 'groups') {\n return navigation.navigate('New', {\n screen: 'ConversationSelectGroupRecipients',\n params: { ...route.params },\n })\n }\n\n if (entryMode === 'teams') {\n return navigation.navigate('New', {\n screen: 'ConversationSelectTeamsILeadRecipients',\n params: { ...route.params },\n })\n }\n }, [navigation, route.params, entryMode, newConversationFromFilter])\n\n const handleChatSettings = useCallback(() => {\n navigation.navigate('ChatSettings', {})\n }, [navigation])\n\n const handleOpenConversationFilters = useCallback(() => {\n navigation.navigate('ConversationFilters', {\n chat_group_graph_id,\n group_source_app_name,\n show_direct_messages,\n })\n }, [navigation, chat_group_graph_id, group_source_app_name, show_direct_messages])\n\n const handleMarkAllRead = useCallback(() => {\n currentPersonCache.update({ unreadCount: 0 })\n Haptic.notificationSuccess()\n markAllRead()\n }, [currentPersonCache, markAllRead])\n\n const alertMarkAllRead = useCallback(() => {\n if (active === FilterTypes.All) return handleMarkAllRead()\n\n Alert.alert('Mark all read', 'This includes conversations not shown by the current filter.', [\n { text: 'Cancel' },\n { text: 'OK', onPress: () => handleMarkAllRead() },\n ])\n }, [active, handleMarkAllRead])\n\n const hasSomeSourceFilterCapability = canFilterByTeams || canFilterByGroups\n const hasMultiSourceFilterCapabilities = canFilterByTeams && canFilterByGroups\n const showFilterRow = hasMultiSourceFilterCapabilities || canFilterByDMs\n const shouldShowHeaderFiltersButton = hasSomeSourceFilterCapability && !showFilterRow\n const moreFiltersButtonA11yLabel = shouldShowHeaderFiltersButton\n ? 'View filters'\n : 'View more filters'\n\n const moreFiltersButtonProps = {\n onPress: handleOpenConversationFilters,\n active: active === FilterTypes.More,\n iconNameRight: 'general.threeReducingHorizontalBars' as const,\n accessibilityLabel: moreFiltersButtonA11yLabel,\n }\n\n const styles = useStyles({ shouldShowHeaderFiltersButton })\n\n return (\n <View style={styles.listHeader}>\n <View style={styles.headingRow}>\n <View style={styles.titleContainer}>\n <Heading numberOfLines={1} variant=\"h2\">\n Conversations\n </Heading>\n <TextButton\n onPress={alertMarkAllRead}\n disabled={isPending}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle=\"Mark all read\"\n >\n Mark all read\n </TextButton>\n </View>\n <View style={styles.actionsContainer}>\n {canCreateConversations && (\n <ListHeaderActionButton\n name=\"churchCenter.signups\"\n onPress={handleNewConversationNavigation}\n accessibilityLabel=\"New conversation\"\n testID=\"conversations-new-conversation-button\"\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n />\n )}\n <ListHeaderActionButton\n name=\"general.cog\"\n onPress={handleChatSettings}\n accessibilityLabel=\"Chat settings\"\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n />\n {shouldShowHeaderFiltersButton && <ToggleButton {...moreFiltersButtonProps} />}\n </View>\n </View>\n {showFilterRow && (\n <ScrollView\n horizontal\n showsHorizontalScrollIndicator={false}\n contentContainerStyle={styles.filterRow}\n accessibilityRole=\"toolbar\"\n >\n <ToggleButton\n title={FilterTypes.All}\n active={active === FilterTypes.All}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: undefined,\n show_direct_messages: undefined,\n })\n }\n accessibilityLabel=\"Show all conversations\"\n style={styles.filterButton}\n />\n {canFilterByGroups && (\n <ToggleButton\n title={FilterTypes.Groups}\n active={active === FilterTypes.Groups}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: 'Groups',\n show_direct_messages: undefined,\n })\n }\n accessibilityLabel=\"Filter to group conversations\"\n style={styles.filterButton}\n />\n )}\n {canFilterByTeams && (\n <ToggleButton\n title={FilterTypes.Teams}\n active={active === FilterTypes.Teams}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: 'Services',\n show_direct_messages: undefined,\n })\n }\n accessibilityLabel=\"Filter to team conversations\"\n style={styles.filterButton}\n />\n )}\n {canFilterByDMs && (\n <ToggleButton\n title={FilterTypes.DMs}\n active={active === FilterTypes.DMs}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: undefined,\n show_direct_messages: true,\n })\n }\n accessibilityLabel=\"Filter to direct message conversations\"\n style={styles.filterButton}\n />\n )}\n <ToggleButton {...moreFiltersButtonProps} />\n </ScrollView>\n )}\n <ChatGroupBadge rowPaddingHorizontal={ROW_PADDING_HORIZONTAL} />\n </View>\n )\n}\n\nconst useStyles = ({\n shouldShowHeaderFiltersButton,\n}: {\n shouldShowHeaderFiltersButton: boolean\n}) => {\n const theme = useTheme()\n const atFontScaleBreakpoint = useAtFontScaleBreakpoint(\n shouldShowHeaderFiltersButton ? 1.2 : undefined\n )\n\n return StyleSheet.create({\n listHeader: {\n borderBottomWidth: 1,\n borderBottomColor: theme.colors.fillColorNeutral050Base,\n paddingBottom: 16,\n gap: 16,\n },\n headingRow: {\n gap: 12,\n flexDirection: atFontScaleBreakpoint ? 'column' : 'row',\n alignItems: atFontScaleBreakpoint ? 'flex-start' : 'center',\n justifyContent: 'space-between',\n paddingBottom: atFontScaleBreakpoint ? 4 : 0,\n paddingHorizontal: ROW_PADDING_HORIZONTAL,\n },\n titleContainer: {\n gap: 8,\n },\n actionsContainer: {\n flexDirection: 'row',\n gap: 8,\n alignItems: 'center',\n },\n markAllReadRow: {\n paddingBottom: 4,\n },\n filterRow: {\n flexDirection: 'row',\n justifyContent: 'flex-start',\n gap: 8,\n paddingHorizontal: ROW_PADDING_HORIZONTAL,\n flexGrow: 1,\n },\n filterButton: {\n flex: 1,\n minWidth: 65,\n },\n })\n}\n"]}
1
+ {"version":3,"file":"list_header_component.js","sourceRoot":"","sources":["../../../../src/screens/conversations/components/list_header_component.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,aAAa,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAC7E,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvE,OAAO,EACL,wBAAwB,EACxB,yBAAyB,EACzB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB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EAAE,QAAQ;SACrB;QACD,cAAc,EAAE;YACd,aAAa,EAAE,CAAC;SACjB;QACD,SAAS,EAAE;YACT,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,YAAY;YAC5B,GAAG,EAAE,CAAC;YACN,iBAAiB,EAAE,sBAAsB;YACzC,QAAQ,EAAE,CAAC;SACZ;QACD,YAAY,EAAE;YACZ,IAAI,EAAE,CAAC;YACP,QAAQ,EAAE,EAAE;SACb;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { RouteProp, useNavigation, useRoute } from '@react-navigation/native'\nimport React, { useCallback, useMemo } from 'react'\nimport { Alert, ScrollView, StyleSheet, View } from 'react-native'\nimport { Heading, TextButton, ToggleButton } from '../../../components'\nimport {\n useAtFontScaleBreakpoint,\n useCanCreateConversations,\n useCurrentPersonCache,\n useDirectMessagesEnabled,\n useHasDirectMessages,\n useNewConversationEntry,\n useTheme,\n} from '../../../hooks'\nimport { useMarkAllRead } from '../../../hooks/use_conversations_actions'\nimport { useCanDisplayGroups } from '../../../hooks/use_groups'\nimport { useNewConversationFromFilter } from '../../../hooks/use_new_conversation_from_filter'\nimport { GraphId } from '../../../types/resources/group_resource'\nimport { MAX_FONT_SIZE_MULTIPLIER_LANDMARK } from '../../../utils'\nimport { Haptic } from '../../../utils/native_adapters'\nimport { ConversationsScreenProps } from '../conversations_screen'\nimport { ChatGroupBadge } from './chat_group_badge'\nimport { ListHeaderActionButton } from './list_header_action_button'\n\nconst ROW_PADDING_HORIZONTAL = 16\n\nenum FilterTypes {\n All = 'All',\n Groups = 'Groups',\n Teams = 'Teams',\n DMs = 'DMs',\n More = 'More',\n}\n\nexport const ListHeaderComponent = () => {\n const navigation = useNavigation()\n const canFilterByTeams = useCanDisplayGroups({ source_app_name: 'Services', source_type: 'Team' })\n const canFilterByGroups = useCanDisplayGroups({ source_app_name: 'Groups', source_type: 'Group' })\n const directMessagesEnabled = useDirectMessagesEnabled()\n const hasDirectMessages = useHasDirectMessages()\n const canFilterByDMs = directMessagesEnabled && hasDirectMessages\n const route = useRoute<RouteProp<ConversationsScreenProps['route']>>()\n const {\n chat_group_graph_id,\n group_source_app_name = '',\n show_direct_messages,\n } = route.params || {}\n const currentPersonCache = useCurrentPersonCache()\n const { markAllRead, isPending } = useMarkAllRead()\n const canCreateConversations = useCanCreateConversations()\n const entryMode = useNewConversationEntry()\n const newConversationFromFilter = useNewConversationFromFilter(\n chat_group_graph_id as GraphId | undefined\n )\n\n const active: FilterTypes = useMemo(() => {\n if (chat_group_graph_id) {\n return FilterTypes.More\n } else if (/groups/i.test(group_source_app_name)) {\n return FilterTypes.Groups\n } else if (/services/i.test(group_source_app_name)) {\n return FilterTypes.Teams\n } else if (show_direct_messages) {\n return FilterTypes.DMs\n }\n\n return FilterTypes.All\n }, [chat_group_graph_id, group_source_app_name, show_direct_messages])\n\n const handleNewConversationNavigation = useCallback(() => {\n if (newConversationFromFilter || entryMode === 'select_type') {\n return navigation.navigate('ConversationSelectType', {\n ...route.params,\n newConversationFromFilter,\n })\n }\n\n if (entryMode === 'groups') {\n return navigation.navigate('New', {\n screen: 'ConversationSelectGroupRecipients',\n params: { ...route.params },\n })\n }\n\n if (entryMode === 'teams') {\n return navigation.navigate('New', {\n screen: 'ConversationSelectTeamsILeadRecipients',\n params: { ...route.params },\n })\n }\n\n if (entryMode === 'direct_message') {\n return navigation.navigate('New', {\n screen: 'ConversationSelectDirectMessageRecipients',\n params: { ...route.params },\n })\n }\n }, [navigation, route.params, entryMode, newConversationFromFilter])\n\n const handleChatSettings = useCallback(() => {\n navigation.navigate('ChatSettings', {})\n }, [navigation])\n\n const handleOpenConversationFilters = useCallback(() => {\n navigation.navigate('ConversationFilters', {\n chat_group_graph_id,\n group_source_app_name,\n show_direct_messages,\n })\n }, [navigation, chat_group_graph_id, group_source_app_name, show_direct_messages])\n\n const handleMarkAllRead = useCallback(() => {\n currentPersonCache.update({ unreadCount: 0 })\n Haptic.notificationSuccess()\n markAllRead()\n }, [currentPersonCache, markAllRead])\n\n const alertMarkAllRead = useCallback(() => {\n if (active === FilterTypes.All) return handleMarkAllRead()\n\n Alert.alert('Mark all read', 'This includes conversations not shown by the current filter.', [\n { text: 'Cancel' },\n { text: 'OK', onPress: () => handleMarkAllRead() },\n ])\n }, [active, handleMarkAllRead])\n\n const hasSomeSourceFilterCapability = canFilterByTeams || canFilterByGroups\n const hasMultiSourceFilterCapabilities = canFilterByTeams && canFilterByGroups\n const showFilterRow = hasMultiSourceFilterCapabilities || canFilterByDMs\n const shouldShowHeaderFiltersButton = hasSomeSourceFilterCapability && !showFilterRow\n const moreFiltersButtonA11yLabel = shouldShowHeaderFiltersButton\n ? 'View filters'\n : 'View more filters'\n\n const moreFiltersButtonProps = {\n onPress: handleOpenConversationFilters,\n active: active === FilterTypes.More,\n iconNameRight: 'general.threeReducingHorizontalBars' as const,\n accessibilityLabel: moreFiltersButtonA11yLabel,\n }\n\n const styles = useStyles({ shouldShowHeaderFiltersButton })\n\n return (\n <View style={styles.listHeader}>\n <View style={styles.headingRow}>\n <View style={styles.titleContainer}>\n <Heading numberOfLines={1} variant=\"h2\">\n Conversations\n </Heading>\n <TextButton\n onPress={alertMarkAllRead}\n disabled={isPending}\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n accessibilityShowsLargeContentViewer\n accessibilityLargeContentTitle=\"Mark all read\"\n >\n Mark all read\n </TextButton>\n </View>\n <View style={styles.actionsContainer}>\n {canCreateConversations && (\n <ListHeaderActionButton\n name=\"churchCenter.signups\"\n onPress={handleNewConversationNavigation}\n accessibilityLabel=\"New conversation\"\n testID=\"conversations-new-conversation-button\"\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n />\n )}\n <ListHeaderActionButton\n name=\"general.cog\"\n onPress={handleChatSettings}\n accessibilityLabel=\"Chat settings\"\n maxFontSizeMultiplier={MAX_FONT_SIZE_MULTIPLIER_LANDMARK}\n />\n {shouldShowHeaderFiltersButton && <ToggleButton {...moreFiltersButtonProps} />}\n </View>\n </View>\n {showFilterRow && (\n <ScrollView\n horizontal\n showsHorizontalScrollIndicator={false}\n contentContainerStyle={styles.filterRow}\n accessibilityRole=\"toolbar\"\n >\n <ToggleButton\n title={FilterTypes.All}\n active={active === FilterTypes.All}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: undefined,\n show_direct_messages: undefined,\n })\n }\n accessibilityLabel=\"Show all conversations\"\n style={styles.filterButton}\n />\n {canFilterByGroups && (\n <ToggleButton\n title={FilterTypes.Groups}\n active={active === FilterTypes.Groups}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: 'Groups',\n show_direct_messages: undefined,\n })\n }\n accessibilityLabel=\"Filter to group conversations\"\n style={styles.filterButton}\n />\n )}\n {canFilterByTeams && (\n <ToggleButton\n title={FilterTypes.Teams}\n active={active === FilterTypes.Teams}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: 'Services',\n show_direct_messages: undefined,\n })\n }\n accessibilityLabel=\"Filter to team conversations\"\n style={styles.filterButton}\n />\n )}\n {canFilterByDMs && (\n <ToggleButton\n title={FilterTypes.DMs}\n active={active === FilterTypes.DMs}\n onPress={() =>\n navigation.setParams({\n chat_group_graph_id: undefined,\n group_source_app_name: undefined,\n show_direct_messages: true,\n })\n }\n accessibilityLabel=\"Filter to direct message conversations\"\n style={styles.filterButton}\n />\n )}\n <ToggleButton {...moreFiltersButtonProps} />\n </ScrollView>\n )}\n <ChatGroupBadge rowPaddingHorizontal={ROW_PADDING_HORIZONTAL} />\n </View>\n )\n}\n\nconst useStyles = ({\n shouldShowHeaderFiltersButton,\n}: {\n shouldShowHeaderFiltersButton: boolean\n}) => {\n const theme = useTheme()\n const atFontScaleBreakpoint = useAtFontScaleBreakpoint(\n shouldShowHeaderFiltersButton ? 1.2 : undefined\n )\n\n return StyleSheet.create({\n listHeader: {\n borderBottomWidth: 1,\n borderBottomColor: theme.colors.fillColorNeutral050Base,\n paddingBottom: 16,\n gap: 16,\n },\n headingRow: {\n gap: 12,\n flexDirection: atFontScaleBreakpoint ? 'column' : 'row',\n alignItems: atFontScaleBreakpoint ? 'flex-start' : 'center',\n justifyContent: 'space-between',\n paddingBottom: atFontScaleBreakpoint ? 4 : 0,\n paddingHorizontal: ROW_PADDING_HORIZONTAL,\n },\n titleContainer: {\n gap: 8,\n },\n actionsContainer: {\n flexDirection: 'row',\n gap: 8,\n alignItems: 'center',\n },\n markAllReadRow: {\n paddingBottom: 4,\n },\n filterRow: {\n flexDirection: 'row',\n justifyContent: 'flex-start',\n gap: 8,\n paddingHorizontal: ROW_PADDING_HORIZONTAL,\n flexGrow: 1,\n },\n filterButton: {\n flex: 1,\n minWidth: 65,\n },\n })\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/chat-react-native",
3
- "version": "3.40.2-qa-789.0",
3
+ "version": "3.41.0",
4
4
  "description": "",
5
5
  "main": "build/index.js",
6
6
  "react-native": "./src/index.tsx",
@@ -26,7 +26,7 @@
26
26
  "dependencies": {
27
27
  "@fortawesome/fontawesome-svg-core": "^7.2.0",
28
28
  "@fortawesome/react-native-fontawesome": "^0.3.2",
29
- "@planningcenter/emoji-keyboard": "3.40.2-qa-789.0",
29
+ "@planningcenter/emoji-keyboard": "3.38.0",
30
30
  "lodash-inflection": "^1.5.0",
31
31
  "react-compiler-runtime": "^1.0.0"
32
32
  },
@@ -72,5 +72,5 @@
72
72
  "react-native-url-polyfill": "^2.0.0",
73
73
  "typescript": "~5.9.2"
74
74
  },
75
- "gitHead": "2730505be59bc51fe17224c5246155965ce4cff3"
75
+ "gitHead": "cd30a30a10939724e6378698eaf549c114870a8e"
76
76
  }
@@ -31,6 +31,7 @@ type VariantStyles = Record<
31
31
  >
32
32
 
33
33
  type ProductLogoName = 'Groups' | 'Services' | 'groups' | 'services'
34
+ type ProductIconName = 'Chat' | 'chat'
34
35
  type ProductLogoComponent = ({ logoSize }: { logoSize: number }) => JSX.Element
35
36
 
36
37
  const PRODUCT_LOGO_COMPONENT_MAP: Record<ProductLogoName, ProductLogoComponent> = {
@@ -64,7 +65,7 @@ export interface BadgeProps {
64
65
  /**
65
66
  * Adds a product logo to the left of the text.
66
67
  */
67
- productLogoName?: ProductLogoName
68
+ productLogoName?: ProductLogoName | ProductIconName
68
69
  /**
69
70
  * Shows an icon of the user choice to the left of the text.
70
71
  */
@@ -111,13 +112,15 @@ export function Badge({
111
112
  const hasMetaLabel = Boolean(metaLabel)
112
113
 
113
114
  const showLogo = showBadgeProductLogo && productLogoName
114
- const ProductLogoSvg = showLogo && PRODUCT_LOGO_COMPONENT_MAP[productLogoName]
115
+ const isChatLogo = productLogoName?.toLowerCase() === 'chat'
116
+ const ProductLogoSvg = showLogo && PRODUCT_LOGO_COMPONENT_MAP[productLogoName as ProductLogoName]
115
117
  const badgeLabel = isMetaSubtle && hasMetaLabel ? `${label}:` : label
116
118
 
117
119
  return (
118
120
  <BadgeWrapper style={[styles.badgeWrapper, style]} onPress={onPress} accessibilityRole="button">
119
121
  <View style={styles.badge}>
120
122
  {showLogo && ProductLogoSvg && <ProductLogoSvg logoSize={styles.logo.fontSize} />}
123
+ {showLogo && isChatLogo && <Icon name="general.textMessage" style={styles.icon} />}
121
124
  {iconName && <Icon name={iconName} style={styles.icon} />}
122
125
  <Text
123
126
  variant="footnote"
@@ -1,20 +1,44 @@
1
1
  import { useMemo } from 'react'
2
2
  import { useAppGrants } from './use_chat_permissions'
3
3
 
4
- export type NewConversationEntryMode = 'select_type' | 'groups' | 'teams' | 'none'
4
+ export type NewConversationEntryMode =
5
+ | 'select_type'
6
+ | 'groups'
7
+ | 'teams'
8
+ | 'direct_message'
9
+ | 'none'
5
10
 
6
- export function useNewConversationEntry(): NewConversationEntryMode {
11
+ export function useConversationTypeAccess() {
7
12
  const appGrants = useAppGrants()
8
13
 
14
+ return useMemo(
15
+ () => ({
16
+ canCreateGroupsConversations: appGrants.data?.some(
17
+ g => g.createConversations && g.appName === 'Groups'
18
+ ),
19
+ canCreateServicesConversations: appGrants.data?.some(
20
+ g => g.createConversations && g.appName === 'Services'
21
+ ),
22
+ canCreateDirectMessages: appGrants.data?.some(
23
+ g => g.createConversations && g.appName === 'Chat'
24
+ ),
25
+ }),
26
+ [appGrants.data]
27
+ )
28
+ }
29
+
30
+ export function useNewConversationEntry(): NewConversationEntryMode {
31
+ const { canCreateGroupsConversations, canCreateServicesConversations, canCreateDirectMessages } =
32
+ useConversationTypeAccess()
33
+
9
34
  return useMemo(() => {
10
- const canCreateGroupsConversations = appGrants.data?.some(
11
- g => g.createConversations && g.appName === 'Groups'
12
- )
13
- const canCreateServicesConversations = appGrants.data?.some(
14
- g => g.createConversations && g.appName === 'Services'
15
- )
16
-
17
- if (canCreateGroupsConversations && canCreateServicesConversations) {
35
+ const availableCount = [
36
+ canCreateGroupsConversations,
37
+ canCreateServicesConversations,
38
+ canCreateDirectMessages,
39
+ ].filter(Boolean).length
40
+
41
+ if (availableCount > 1) {
18
42
  return 'select_type'
19
43
  }
20
44
 
@@ -26,6 +50,10 @@ export function useNewConversationEntry(): NewConversationEntryMode {
26
50
  return 'teams'
27
51
  }
28
52
 
53
+ if (canCreateDirectMessages) {
54
+ return 'direct_message'
55
+ }
56
+
29
57
  return 'none'
30
- }, [appGrants.data])
58
+ }, [canCreateGroupsConversations, canCreateServicesConversations, canCreateDirectMessages])
31
59
  }
@@ -16,6 +16,7 @@ type NewConversationStackParamList = {
16
16
  ConversationNewEntry: ConversationSelectRecipientsParams | undefined
17
17
  ConversationSelectGroupRecipients: ConversationSelectRecipientsParams | undefined
18
18
  ConversationSelectTeamsILeadRecipients: ConversationSelectRecipientsParams | undefined
19
+ ConversationSelectDirectMessageRecipients: ConversationSelectRecipientsParams | undefined
19
20
  }
20
21
 
21
22
  export const ConversationNewEntryScreen = ({ route }: ConversationSelectRecipientsScreenProps) => {
@@ -34,6 +35,11 @@ export const ConversationNewEntryScreen = ({ route }: ConversationSelectRecipien
34
35
  return
35
36
  }
36
37
 
38
+ if (entryMode === 'direct_message') {
39
+ navigation.replace('ConversationSelectDirectMessageRecipients', route.params)
40
+ return
41
+ }
42
+
37
43
  if (entryMode === 'none') {
38
44
  navigation.goBack()
39
45
  return
@@ -3,7 +3,7 @@ import React from 'react'
3
3
  import FormSheet, { getFormSheetScreenOptions } from '../components/primitive/form_sheet'
4
4
  import { useCurrentPerson } from '../hooks/use_current_person'
5
5
  import { availableFeatures, useFeatures } from '../hooks/use_features'
6
- import { useNewConversationEntry } from '../hooks/use_new_conversation_entry'
6
+ import { useConversationTypeAccess } from '../hooks/use_new_conversation_entry'
7
7
  import type { NewConversationFromFilter } from '../hooks/use_new_conversation_from_filter'
8
8
  import { AppName } from '../types/resources/app_name'
9
9
  import { GraphId } from '../types/resources/group_resource'
@@ -26,15 +26,14 @@ type NewConversationTypeScreen =
26
26
 
27
27
  export function ConversationSelectTypeScreen({ route }: ConversationSelectTypeScreenProps) {
28
28
  const navigation = useNavigation()
29
- const entryMode = useNewConversationEntry()
29
+ const { canCreateGroupsConversations, canCreateServicesConversations } =
30
+ useConversationTypeAccess()
30
31
  const { featureEnabled } = useFeatures()
31
32
  const { directMessagesDisabled, under_18 } = useCurrentPerson()
32
33
  const { newConversationFromFilter, chat_group_graph_id, group_source_app_name } =
33
34
  route.params || {}
34
35
 
35
36
  const filterParams = { chat_group_graph_id, group_source_app_name }
36
- const canCreateGroups = entryMode === 'select_type' || entryMode === 'groups'
37
- const canCreateTeams = entryMode === 'select_type' || entryMode === 'teams'
38
37
  const dmFeatureEnabled = featureEnabled(availableFeatures.direct_messages_eap)
39
38
 
40
39
  const handleFilterPress = () => {
@@ -89,14 +88,14 @@ export function ConversationSelectTypeScreen({ route }: ConversationSelectTypeSc
89
88
  accessibilityHint="Creates a conversation pre-scoped to the current filter"
90
89
  />
91
90
  )}
92
- {canCreateGroups && (
91
+ {canCreateGroupsConversations && (
93
92
  <FormSheet.Action
94
93
  title="Group"
95
94
  onPress={handleGroupPress}
96
95
  accessibilityHint="Opens group selection screen"
97
96
  />
98
97
  )}
99
- {canCreateTeams && (
98
+ {canCreateServicesConversations && (
100
99
  <FormSheet.Action
101
100
  title="Team"
102
101
  onPress={handleTeamPress}
@@ -87,6 +87,13 @@ export const ListHeaderComponent = () => {
87
87
  params: { ...route.params },
88
88
  })
89
89
  }
90
+
91
+ if (entryMode === 'direct_message') {
92
+ return navigation.navigate('New', {
93
+ screen: 'ConversationSelectDirectMessageRecipients',
94
+ params: { ...route.params },
95
+ })
96
+ }
90
97
  }, [navigation, route.params, entryMode, newConversationFromFilter])
91
98
 
92
99
  const handleChatSettings = useCallback(() => {