@planningcenter/chat-react-native 4.7.1-qa-staging.4 → 4.7.1-qa-staging.6

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 (102) hide show
  1. package/build/components/conversation/attachments/expanded_link.js +8 -8
  2. package/build/components/conversation/attachments/expanded_link.js.map +1 -1
  3. package/build/components/conversation/attachments/generic_file_attachment.d.ts.map +1 -1
  4. package/build/components/conversation/attachments/generic_file_attachment.js +2 -2
  5. package/build/components/conversation/attachments/generic_file_attachment.js.map +1 -1
  6. package/build/components/conversation/attachments/giphy_attachment.d.ts.map +1 -1
  7. package/build/components/conversation/attachments/giphy_attachment.js +2 -2
  8. package/build/components/conversation/attachments/giphy_attachment.js.map +1 -1
  9. package/build/components/conversation/attachments/image_attachment.js +2 -2
  10. package/build/components/conversation/attachments/image_attachment.js.map +1 -1
  11. package/build/components/conversation/message_form.js +2 -2
  12. package/build/components/conversation/message_form.js.map +1 -1
  13. package/build/components/conversation/message_markdown.js +2 -2
  14. package/build/components/conversation/message_markdown.js.map +1 -1
  15. package/build/hooks/groups/use_group_chat_conversation_payload.d.ts +1 -11
  16. package/build/hooks/groups/use_group_chat_conversation_payload.d.ts.map +1 -1
  17. package/build/hooks/groups/use_group_chat_conversation_payload.js +47 -92
  18. package/build/hooks/groups/use_group_chat_conversation_payload.js.map +1 -1
  19. package/build/hooks/groups/use_group_members_for_new_conversation.d.ts +25 -27
  20. package/build/hooks/groups/use_group_members_for_new_conversation.d.ts.map +1 -1
  21. package/build/hooks/groups/use_group_members_for_new_conversation.js +110 -125
  22. package/build/hooks/groups/use_group_members_for_new_conversation.js.map +1 -1
  23. package/build/hooks/groups/use_groups_conversation_create.d.ts.map +1 -1
  24. package/build/hooks/groups/use_groups_conversation_create.js +31 -39
  25. package/build/hooks/groups/use_groups_conversation_create.js.map +1 -1
  26. package/build/hooks/use_features.d.ts +0 -1
  27. package/build/hooks/use_features.d.ts.map +1 -1
  28. package/build/hooks/use_features.js +1 -2
  29. package/build/hooks/use_features.js.map +1 -1
  30. package/build/hooks/use_groups_groups.d.ts.map +1 -1
  31. package/build/hooks/use_groups_groups.js +9 -25
  32. package/build/hooks/use_groups_groups.js.map +1 -1
  33. package/build/hooks/use_new_conversation_from_filter.d.ts.map +1 -1
  34. package/build/hooks/use_new_conversation_from_filter.js +1 -11
  35. package/build/hooks/use_new_conversation_from_filter.js.map +1 -1
  36. package/build/screens/age_check/age_check_underage_screen.js +3 -3
  37. package/build/screens/age_check/age_check_underage_screen.js.map +1 -1
  38. package/build/screens/attachment_actions/attachment_actions_screen.js +2 -2
  39. package/build/screens/attachment_actions/attachment_actions_screen.js.map +1 -1
  40. package/build/screens/bug_report_screen.js +4 -4
  41. package/build/screens/bug_report_screen.js.map +1 -1
  42. package/build/screens/conversation_new/components/groups_form.d.ts.map +1 -1
  43. package/build/screens/conversation_new/components/groups_form.js +93 -96
  44. package/build/screens/conversation_new/components/groups_form.js.map +1 -1
  45. package/build/screens/get_help_screen.js +4 -4
  46. package/build/screens/get_help_screen.js.map +1 -1
  47. package/build/types/resources/groups/groups_group_resource.d.ts +1 -1
  48. package/build/types/resources/groups/groups_group_resource.d.ts.map +1 -1
  49. package/build/types/resources/groups/groups_group_resource.js.map +1 -1
  50. package/build/types/resources/groups/index.d.ts +0 -1
  51. package/build/types/resources/groups/index.d.ts.map +1 -1
  52. package/build/types/resources/groups/index.js +0 -1
  53. package/build/types/resources/groups/index.js.map +1 -1
  54. package/build/utils/index.d.ts +0 -1
  55. package/build/utils/index.d.ts.map +1 -1
  56. package/build/utils/index.js +0 -1
  57. package/build/utils/index.js.map +1 -1
  58. package/build/utils/native_adapters/linking.d.ts.map +1 -1
  59. package/build/utils/native_adapters/linking.js +48 -2
  60. package/build/utils/native_adapters/linking.js.map +1 -1
  61. package/package.json +3 -3
  62. package/src/__tests__/components/conversation/attachments/giphy_attachment.test.tsx +1 -1
  63. package/src/__tests__/hooks/use_group_chat_conversation_payload.test.tsx +0 -31
  64. package/src/__tests__/screens/get_help_screen.test.ts +1 -1
  65. package/src/components/conversation/attachments/expanded_link.tsx +4 -4
  66. package/src/components/conversation/attachments/generic_file_attachment.tsx +5 -2
  67. package/src/components/conversation/attachments/giphy_attachment.tsx +4 -2
  68. package/src/components/conversation/attachments/image_attachment.tsx +2 -2
  69. package/src/components/conversation/message_form.tsx +2 -2
  70. package/src/components/conversation/message_markdown.tsx +2 -2
  71. package/src/hooks/groups/use_group_chat_conversation_payload.ts +12 -30
  72. package/src/hooks/groups/use_group_members_for_new_conversation.ts +18 -49
  73. package/src/hooks/groups/use_groups_conversation_create.ts +14 -10
  74. package/src/hooks/use_features.ts +0 -1
  75. package/src/hooks/use_groups_groups.ts +16 -21
  76. package/src/hooks/use_new_conversation_from_filter.ts +5 -13
  77. package/src/screens/age_check/age_check_underage_screen.tsx +3 -3
  78. package/src/screens/attachment_actions/attachment_actions_screen.tsx +2 -2
  79. package/src/screens/bug_report_screen.tsx +4 -4
  80. package/src/screens/conversation_new/components/groups_form.tsx +9 -11
  81. package/src/screens/get_help_screen.tsx +4 -4
  82. package/src/types/resources/groups/groups_group_resource.ts +1 -1
  83. package/src/types/resources/groups/index.ts +0 -1
  84. package/src/utils/index.ts +0 -1
  85. package/src/utils/native_adapters/__tests__/linking.test.ts +60 -4
  86. package/src/utils/native_adapters/linking.ts +50 -2
  87. package/build/hooks/groups/use_groups_proxy.d.ts +0 -2
  88. package/build/hooks/groups/use_groups_proxy.d.ts.map +0 -1
  89. package/build/hooks/groups/use_groups_proxy.js +0 -18
  90. package/build/hooks/groups/use_groups_proxy.js.map +0 -1
  91. package/build/types/resources/groups/groups_membership_resource.d.ts +0 -11
  92. package/build/types/resources/groups/groups_membership_resource.d.ts.map +0 -1
  93. package/build/types/resources/groups/groups_membership_resource.js +0 -2
  94. package/build/types/resources/groups/groups_membership_resource.js.map +0 -1
  95. package/build/utils/open_url.d.ts +0 -11
  96. package/build/utils/open_url.d.ts.map +0 -1
  97. package/build/utils/open_url.js +0 -46
  98. package/build/utils/open_url.js.map +0 -1
  99. package/src/hooks/groups/use_groups_proxy.ts +0 -6
  100. package/src/types/resources/groups/groups_membership_resource.ts +0 -10
  101. package/src/utils/__tests__/open_url.test.ts +0 -67
  102. package/src/utils/open_url.ts +0 -47
@@ -10,7 +10,6 @@ export * from './host_bridge';
10
10
  export * from './liquid_glass';
11
11
  export * from './membership_sync_info_text';
12
12
  export * from './native_adapters';
13
- export * from './open_url';
14
13
  export * from './pluralize';
15
14
  export * from './conversation_safety_constants';
16
15
  export * from './reaction_constants';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './archived_conversation'\nexport * from './assert_keys_are_numbers'\nexport * from './attachment_kind'\nexport * from './chat_type_label'\nexport * from './cache'\nexport * from './client'\nexport * from './convert_attachments_for_create'\nexport * from './destructure_chat_group_graph_id'\nexport * from './host_bridge'\nexport * from './liquid_glass'\nexport * from './membership_sync_info_text'\nexport * from './native_adapters'\nexport * from './open_url'\nexport * from './pluralize'\nexport * from './conversation_safety_constants'\nexport * from './reaction_constants'\nexport * from './session'\nexport * from './styles'\nexport * from './system_messages'\nexport * from './theme'\nexport * from './uri'\n"],"mappings":"AAAA,cAAc,yBAAyB;AACvC,cAAc,2BAA2B;AACzC,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,kCAAkC;AAChD,cAAc,mCAAmC;AACjD,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,6BAA6B;AAC3C,cAAc,mBAAmB;AACjC,cAAc,YAAY;AAC1B,cAAc,aAAa;AAC3B,cAAc,iCAAiC;AAC/C,cAAc,sBAAsB;AACpC,cAAc,WAAW;AACzB,cAAc,UAAU;AACxB,cAAc,mBAAmB;AACjC,cAAc,SAAS;AACvB,cAAc,OAAO","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './archived_conversation'\nexport * from './assert_keys_are_numbers'\nexport * from './attachment_kind'\nexport * from './chat_type_label'\nexport * from './cache'\nexport * from './client'\nexport * from './convert_attachments_for_create'\nexport * from './destructure_chat_group_graph_id'\nexport * from './host_bridge'\nexport * from './liquid_glass'\nexport * from './membership_sync_info_text'\nexport * from './native_adapters'\nexport * from './pluralize'\nexport * from './conversation_safety_constants'\nexport * from './reaction_constants'\nexport * from './session'\nexport * from './styles'\nexport * from './system_messages'\nexport * from './theme'\nexport * from './uri'\n"],"mappings":"AAAA,cAAc,yBAAyB;AACvC,cAAc,2BAA2B;AACzC,cAAc,mBAAmB;AACjC,cAAc,mBAAmB;AACjC,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,kCAAkC;AAChD,cAAc,mCAAmC;AACjD,cAAc,eAAe;AAC7B,cAAc,gBAAgB;AAC9B,cAAc,6BAA6B;AAC3C,cAAc,mBAAmB;AACjC,cAAc,aAAa;AAC3B,cAAc,iCAAiC;AAC/C,cAAc,sBAAsB;AACpC,cAAc,WAAW;AACzB,cAAc,UAAU;AACxB,cAAc,mBAAmB;AACjC,cAAc,SAAS;AACvB,cAAc,OAAO","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"linking.d.ts","sourceRoot":"","sources":["../../../src/utils/native_adapters/linking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,MAAM,qBAAqB,GAAG;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAC3E,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;CAClC,CAAA;AAED,qBAAa,cAAc;IACzB,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;IAClC,UAAU,EAAE,cAAc,CAAC,YAAY,CAAC,CAAA;gBAE5B,OAAO,EAAE,cAAc;CAIpC"}
1
+ {"version":3,"file":"linking.d.ts","sourceRoot":"","sources":["../../../src/utils/native_adapters/linking.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,OAAO,EAAE,MAAM,cAAc,CAAA;AAG7C,MAAM,MAAM,qBAAqB,GAAG;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED,KAAK,cAAc,GAAG;IACpB,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAA;IAC3E,UAAU,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;CAClC,CAAA;AAID,qBAAa,cAAc;IACzB,OAAO,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;IAClC,UAAU,EAAE,cAAc,CAAC,YAAY,CAAC,CAAA;gBAE5B,OAAO,EAAE,cAAc;CAYpC"}
@@ -1,8 +1,54 @@
1
- import { Linking } from 'react-native';
1
+ import { Alert, Linking } from 'react-native';
2
+ import { Clipboard, Log } from './configuration';
3
+ const CONTACT_SCHEME = /^(mailto|tel):/i;
2
4
  export class LinkingAdapter {
3
5
  constructor(methods) {
4
- this.openURL = methods.openURL.bind(Linking);
6
+ const openURL = methods.openURL.bind(Linking);
7
+ this.openURL = async (...args) => {
8
+ try {
9
+ await openURL(...args);
10
+ } catch (error) {
11
+ handleOpenFailure(args[0], error);
12
+ }
13
+ };
5
14
  this.canOpenURL = methods.canOpenURL.bind(Linking);
6
15
  }
7
16
  }
17
+
18
+ /**
19
+ * mailto: and tel: links fail for ordinary reasons (no mail app, no phone),
20
+ * so the user gets an alert offering to copy the address. Any other failure
21
+ * is reported through the Log adapter so it stays visible as a handled error.
22
+ */
23
+ function handleOpenFailure(url, error) {
24
+ if (CONTACT_SCHEME.test(url)) {
25
+ alertUnableToOpen(url);
26
+ return;
27
+ }
28
+ Log.reportError(toError(error, url), {
29
+ extra: {
30
+ url
31
+ }
32
+ });
33
+ }
34
+ function alertUnableToOpen(url) {
35
+ const address = readableAddress(url);
36
+ Alert.alert('Oops', `Unable to open: ${address}`, [{
37
+ text: 'Copy to clipboard',
38
+ onPress: () => Clipboard.setStringAsync(address)
39
+ }, {
40
+ text: 'OK'
41
+ }]);
42
+ }
43
+ function readableAddress(url) {
44
+ const address = url.replace(CONTACT_SCHEME, '');
45
+ try {
46
+ return decodeURIComponent(address);
47
+ } catch {
48
+ return address;
49
+ }
50
+ }
51
+ function toError(error, url) {
52
+ return error instanceof Error ? error : new Error(`Unable to open URL: ${url}`);
53
+ }
8
54
  //# sourceMappingURL=linking.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"linking.js","names":["Linking","LinkingAdapter","constructor","methods","openURL","bind","canOpenURL"],"sources":["../../../src/utils/native_adapters/linking.ts"],"sourcesContent":["import { Linking } from 'react-native'\n\nexport type LinkingOpenURLOptions = {\n forceOpenInBrowser?: boolean\n}\n\ntype LinkingMethods = {\n openURL: (url: string, options?: LinkingOpenURLOptions) => Promise<unknown>\n canOpenURL: Linking['canOpenURL']\n}\n\nexport class LinkingAdapter {\n openURL: LinkingMethods['openURL']\n canOpenURL: LinkingMethods['canOpenURL']\n\n constructor(methods: LinkingMethods) {\n this.openURL = methods.openURL.bind(Linking)\n this.canOpenURL = methods.canOpenURL.bind(Linking)\n }\n}\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,cAAc;AAWtC,OAAO,MAAMC,cAAc,CAAC;EAI1BC,WAAWA,CAACC,OAAuB,EAAE;IACnC,IAAI,CAACC,OAAO,GAAGD,OAAO,CAACC,OAAO,CAACC,IAAI,CAACL,OAAO,CAAC;IAC5C,IAAI,CAACM,UAAU,GAAGH,OAAO,CAACG,UAAU,CAACD,IAAI,CAACL,OAAO,CAAC;EACpD;AACF","ignoreList":[]}
1
+ {"version":3,"file":"linking.js","names":["Alert","Linking","Clipboard","Log","CONTACT_SCHEME","LinkingAdapter","constructor","methods","openURL","bind","args","error","handleOpenFailure","canOpenURL","url","test","alertUnableToOpen","reportError","toError","extra","address","readableAddress","alert","text","onPress","setStringAsync","replace","decodeURIComponent","Error"],"sources":["../../../src/utils/native_adapters/linking.ts"],"sourcesContent":["import { Alert, Linking } from 'react-native'\nimport { Clipboard, Log } from './configuration'\n\nexport type LinkingOpenURLOptions = {\n forceOpenInBrowser?: boolean\n}\n\ntype LinkingMethods = {\n openURL: (url: string, options?: LinkingOpenURLOptions) => Promise<unknown>\n canOpenURL: Linking['canOpenURL']\n}\n\nconst CONTACT_SCHEME = /^(mailto|tel):/i\n\nexport class LinkingAdapter {\n openURL: LinkingMethods['openURL']\n canOpenURL: LinkingMethods['canOpenURL']\n\n constructor(methods: LinkingMethods) {\n const openURL = methods.openURL.bind(Linking)\n\n this.openURL = async (...args) => {\n try {\n await openURL(...args)\n } catch (error) {\n handleOpenFailure(args[0], error)\n }\n }\n this.canOpenURL = methods.canOpenURL.bind(Linking)\n }\n}\n\n/**\n * mailto: and tel: links fail for ordinary reasons (no mail app, no phone),\n * so the user gets an alert offering to copy the address. Any other failure\n * is reported through the Log adapter so it stays visible as a handled error.\n */\nfunction handleOpenFailure(url: string, error: unknown) {\n if (CONTACT_SCHEME.test(url)) {\n alertUnableToOpen(url)\n return\n }\n\n Log.reportError(toError(error, url), { extra: { url } })\n}\n\nfunction alertUnableToOpen(url: string) {\n const address = readableAddress(url)\n\n Alert.alert('Oops', `Unable to open: ${address}`, [\n { text: 'Copy to clipboard', onPress: () => Clipboard.setStringAsync(address) },\n { text: 'OK' },\n ])\n}\n\nfunction readableAddress(url: string) {\n const address = url.replace(CONTACT_SCHEME, '')\n\n try {\n return decodeURIComponent(address)\n } catch {\n return address\n }\n}\n\nfunction toError(error: unknown, url: string) {\n return error instanceof Error ? error : new Error(`Unable to open URL: ${url}`)\n}\n"],"mappings":"AAAA,SAASA,KAAK,EAAEC,OAAO,QAAQ,cAAc;AAC7C,SAASC,SAAS,EAAEC,GAAG,QAAQ,iBAAiB;AAWhD,MAAMC,cAAc,GAAG,iBAAiB;AAExC,OAAO,MAAMC,cAAc,CAAC;EAI1BC,WAAWA,CAACC,OAAuB,EAAE;IACnC,MAAMC,OAAO,GAAGD,OAAO,CAACC,OAAO,CAACC,IAAI,CAACR,OAAO,CAAC;IAE7C,IAAI,CAACO,OAAO,GAAG,OAAO,GAAGE,IAAI,KAAK;MAChC,IAAI;QACF,MAAMF,OAAO,CAAC,GAAGE,IAAI,CAAC;MACxB,CAAC,CAAC,OAAOC,KAAK,EAAE;QACdC,iBAAiB,CAACF,IAAI,CAAC,CAAC,CAAC,EAAEC,KAAK,CAAC;MACnC;IACF,CAAC;IACD,IAAI,CAACE,UAAU,GAAGN,OAAO,CAACM,UAAU,CAACJ,IAAI,CAACR,OAAO,CAAC;EACpD;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA,SAASW,iBAAiBA,CAACE,GAAW,EAAEH,KAAc,EAAE;EACtD,IAAIP,cAAc,CAACW,IAAI,CAACD,GAAG,CAAC,EAAE;IAC5BE,iBAAiB,CAACF,GAAG,CAAC;IACtB;EACF;EAEAX,GAAG,CAACc,WAAW,CAACC,OAAO,CAACP,KAAK,EAAEG,GAAG,CAAC,EAAE;IAAEK,KAAK,EAAE;MAAEL;IAAI;EAAE,CAAC,CAAC;AAC1D;AAEA,SAASE,iBAAiBA,CAACF,GAAW,EAAE;EACtC,MAAMM,OAAO,GAAGC,eAAe,CAACP,GAAG,CAAC;EAEpCd,KAAK,CAACsB,KAAK,CAAC,MAAM,EAAE,mBAAmBF,OAAO,EAAE,EAAE,CAChD;IAAEG,IAAI,EAAE,mBAAmB;IAAEC,OAAO,EAAEA,CAAA,KAAMtB,SAAS,CAACuB,cAAc,CAACL,OAAO;EAAE,CAAC,EAC/E;IAAEG,IAAI,EAAE;EAAK,CAAC,CACf,CAAC;AACJ;AAEA,SAASF,eAAeA,CAACP,GAAW,EAAE;EACpC,MAAMM,OAAO,GAAGN,GAAG,CAACY,OAAO,CAACtB,cAAc,EAAE,EAAE,CAAC;EAE/C,IAAI;IACF,OAAOuB,kBAAkB,CAACP,OAAO,CAAC;EACpC,CAAC,CAAC,MAAM;IACN,OAAOA,OAAO;EAChB;AACF;AAEA,SAASF,OAAOA,CAACP,KAAc,EAAEG,GAAW,EAAE;EAC5C,OAAOH,KAAK,YAAYiB,KAAK,GAAGjB,KAAK,GAAG,IAAIiB,KAAK,CAAC,uBAAuBd,GAAG,EAAE,CAAC;AACjF","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@planningcenter/chat-react-native",
3
- "version": "4.7.1-qa-staging.4",
3
+ "version": "4.7.1-qa-staging.6",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -33,7 +33,7 @@
33
33
  "dependencies": {
34
34
  "@fortawesome/fontawesome-svg-core": "^7.2.0",
35
35
  "@fortawesome/react-native-fontawesome": "^0.3.2",
36
- "@planningcenter/emoji-keyboard": "4.7.1-qa-staging.4",
36
+ "@planningcenter/emoji-keyboard": "4.7.1-qa-staging.6",
37
37
  "lodash-inflection": "^1.5.0"
38
38
  },
39
39
  "peerDependencies": {
@@ -84,5 +84,5 @@
84
84
  "sf-symbols-typescript": "^2.2.0",
85
85
  "typescript": "~6.0.3"
86
86
  },
87
- "gitHead": "5797252d23174cbd0c8f0309a27b9e2b0edef8f3"
87
+ "gitHead": "8b0e0dd2325e3e6851c5730bd761c4665e1cd0c6"
88
88
  }
@@ -70,7 +70,7 @@ describe('GiphyAttachment', () => {
70
70
 
71
71
  fireEvent.press(getByText('/giphy'))
72
72
 
73
- expect(hostOpenURL).toHaveBeenCalledWith('https://giphy.com/gifs/cat', undefined)
73
+ expect(hostOpenURL).toHaveBeenCalledWith('https://giphy.com/gifs/cat')
74
74
  expect(rnOpenURL).not.toHaveBeenCalled()
75
75
  })
76
76
  })
@@ -5,11 +5,6 @@ import { buildTestQueryClient } from '../../__utils__/query_client'
5
5
  import { useGroupChatConversationPayload } from '../../hooks/groups/use_group_chat_conversation_payload'
6
6
  import * as useApiClientModule from '../../hooks/use_api_client'
7
7
 
8
- const mockGroupsProxy = jest.fn(() => false)
9
- jest.mock('../../hooks/groups/use_groups_proxy', () => ({
10
- useGroupsProxy: () => mockGroupsProxy(),
11
- }))
12
-
13
8
  const mockGroupsPost = (impl: jest.Mock) => {
14
9
  jest.spyOn(useApiClientModule, 'useApiClient').mockReturnValue({
15
10
  groups: { post: impl },
@@ -27,7 +22,6 @@ const resolveWith = (value: string) =>
27
22
  describe('useGroupChatConversationPayload', () => {
28
23
  afterEach(() => {
29
24
  jest.restoreAllMocks()
30
- mockGroupsProxy.mockReturnValue(false)
31
25
  })
32
26
 
33
27
  it('refetches on mount even when a fresh payload is already cached', async () => {
@@ -53,29 +47,4 @@ describe('useGroupChatConversationPayload', () => {
53
47
  await waitFor(() => expect(post).toHaveBeenCalledTimes(1))
54
48
  await waitFor(() => expect(result.current.payload).toBe('fresh'))
55
49
  })
56
-
57
- it('asks Chat for the payload when Groups loads through Chat', async () => {
58
- mockGroupsProxy.mockReturnValue(true)
59
- const post = resolveWith('proxied')
60
- const groupsPost = jest.fn()
61
- jest.spyOn(useApiClientModule, 'useApiClient').mockReturnValue({
62
- chat: { post },
63
- groups: { post: groupsPost },
64
- } as unknown as ReturnType<typeof useApiClientModule.useApiClient>)
65
- const queryClient = buildTestQueryClient()
66
- const wrapper = ({ children }: { children: React.ReactNode }) => (
67
- <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
68
- )
69
-
70
- const { result } = renderHook(() => useGroupChatConversationPayload({ groupId: 1 }), {
71
- wrapper,
72
- })
73
-
74
- await waitFor(() => expect(result.current.payload).toBe('proxied'))
75
- expect(post).toHaveBeenCalledWith({
76
- url: '/me/groups_groups/1/chat_conversation_payload',
77
- data: { data: { type: 'GroupsChatConversationPayload', attributes: { title: '' } } },
78
- })
79
- expect(groupsPost).not.toHaveBeenCalled()
80
- })
81
50
  })
@@ -31,6 +31,6 @@ describe('sendEmail', () => {
31
31
  it("opens mailto through the host app's linking adapter", () => {
32
32
  sendEmail('help@example.com')
33
33
 
34
- expect(hostOpenURL).toHaveBeenCalledWith('mailto:help@example.com', undefined)
34
+ expect(hostOpenURL).toHaveBeenCalledWith('mailto:help@example.com')
35
35
  })
36
36
  })
@@ -3,7 +3,7 @@ import React from 'react'
3
3
  import { Image, StyleSheet, Text, View } from 'react-native'
4
4
  import { useTheme } from '../../../hooks'
5
5
  import { DenormalizedExpandedLinkAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'
6
- import { openUrl } from '../../../utils'
6
+ import { Linking } from '../../../utils'
7
7
  import { tokens } from '../../../vendor/tapestry/tokens'
8
8
 
9
9
  export function ExpandedLink({
@@ -20,15 +20,15 @@ export function ExpandedLink({
20
20
 
21
21
  const aspectRatio = imageWidth && imageHeight ? imageWidth / imageHeight : 1
22
22
 
23
- function handlePress() {
24
- if (url) openUrl(url)
23
+ async function openUrl() {
24
+ if (url) Linking.openURL(url)
25
25
  }
26
26
 
27
27
  return (
28
28
  <PlatformPressable
29
29
  style={styles.container}
30
30
  android_ripple={{ color: colors.androidRippleNeutral, foreground: true }}
31
- onPress={handlePress}
31
+ onPress={openUrl}
32
32
  onLongPress={onMessageLongPress}
33
33
  >
34
34
  {imageUrl && (
@@ -3,7 +3,7 @@ import React from 'react'
3
3
  import { StyleSheet, View } from 'react-native'
4
4
  import { useTheme } from '../../../hooks'
5
5
  import { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'
6
- import { getAttachmentIconName, openUrl } from '../../../utils'
6
+ import { Linking, getAttachmentIconName } from '../../../utils'
7
7
  import { tokens } from '../../../vendor/tapestry/tokens'
8
8
  import { Icon } from '../../display'
9
9
  import { AttachmentCard, AttachmentCardTitle } from './attachment_card'
@@ -26,7 +26,10 @@ export function GenericFileAttachment({
26
26
  const fileTypeLabel = contentType === 'application/pdf' ? 'PDF' : 'file'
27
27
 
28
28
  async function handleDownload() {
29
- if (url) openUrl(url)
29
+ if (url) {
30
+ // Open link in the default web browser
31
+ Linking.openURL(url)
32
+ }
30
33
  }
31
34
 
32
35
  return (
@@ -3,7 +3,7 @@ import React from 'react'
3
3
  import { Text, StyleSheet } from 'react-native'
4
4
  import { useTheme } from '../../../hooks'
5
5
  import { DenormalizedGiphyAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'
6
- import { assertKeysAreNumbers, openUrl } from '../../../utils'
6
+ import { assertKeysAreNumbers, Linking } from '../../../utils'
7
7
  import { tokens } from '../../../vendor/tapestry/tokens'
8
8
  import { Image } from '../../display'
9
9
 
@@ -21,7 +21,9 @@ export function GiphyAttachment({
21
21
  const styles = useStyles({ imageWidth: width, imageHeight: height })
22
22
 
23
23
  function handlePress() {
24
- if (titleLink) openUrl(titleLink)
24
+ if (titleLink) {
25
+ Linking.openURL(titleLink)
26
+ }
25
27
  }
26
28
 
27
29
  return (
@@ -29,7 +29,7 @@ import Animated, {
29
29
  import { useSafeAreaInsets, SafeAreaProvider } from 'react-native-safe-area-context'
30
30
  import { useTheme } from '../../../hooks'
31
31
  import { DenormalizedMessageAttachmentResource } from '../../../types/resources/denormalized_attachment_resource'
32
- import { Haptic, openUrl, platformFontWeightMedium } from '../../../utils'
32
+ import { Haptic, Linking, platformFontWeightMedium } from '../../../utils'
33
33
  import { formatDatePreview } from '../../../utils/date'
34
34
  import { tokens } from '../../../vendor/tapestry/tokens'
35
35
  import { IconButton, Image, Heading, Text } from '../../display'
@@ -211,7 +211,7 @@ const LightboxGallery = ({
211
211
  HANDLERS
212
212
  ============================ */
213
213
  const handleOpenInBrowser = useCallback(() => {
214
- openUrl(urlMedium || url, { forceOpenInBrowser: true })
214
+ Linking.openURL(urlMedium || url, { forceOpenInBrowser: true })
215
215
  }, [urlMedium, url])
216
216
 
217
217
  // Helper to enable or disable FlatList scroll state after gestures have ended
@@ -33,9 +33,9 @@ import {
33
33
  FileAttachment,
34
34
  } from '../../types/resources/denormalized_attachment_resource_for_create'
35
35
  import {
36
+ Linking,
36
37
  Log,
37
38
  MAX_FONT_SIZE_MULTIPLIER_LANDMARK,
38
- openUrl,
39
39
  platformFontWeightMedium,
40
40
  platformPressedOpacityStyle,
41
41
  } from '../../utils'
@@ -430,7 +430,7 @@ function BannerMessage({ isSingular, fileType }: { isSingular: boolean; fileType
430
430
  <Text
431
431
  style={styles.flaggedBannerLink}
432
432
  onPress={() =>
433
- openUrl(
433
+ Linking.openURL(
434
434
  'https://www.planningcenter.com/terms#:~:text=4.%20Acceptable%20Use%20of%20Planning%20Center'
435
435
  )
436
436
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react'
2
2
  import { StyleSheet } from 'react-native'
3
- import { openUrl } from '../../utils/open_url'
3
+ import { Linking } from '../../utils/native_adapters'
4
4
  import { parseSimpleMarkdown } from '../../utils/parse_simple_markdown'
5
5
  import { Text, TextInlineButton } from '../display'
6
6
 
@@ -36,7 +36,7 @@ export function MessageMarkdown({ text }: Props) {
36
36
  return (
37
37
  <TextInlineButton
38
38
  key={i}
39
- onPress={() => openUrl(part.content)}
39
+ onPress={() => Linking.openURL(part.content)}
40
40
  accessibilityRole="link"
41
41
  accessibilityHint="Opens browser"
42
42
  >
@@ -1,8 +1,7 @@
1
1
  import { useQuery } from '@tanstack/react-query'
2
2
  import { ApiResource, ResourceObject } from '../../types'
3
3
  import { toMs } from '../../utils/time'
4
- import { App, useApiClient } from '../use_api_client'
5
- import { useGroupsProxy } from './use_groups_proxy'
4
+ import { useApiClient } from '../use_api_client'
6
5
 
7
6
  const STALE_TIME_MS = toMs(25, 'minutes') // under Groups' 30-min server-side expiry
8
7
 
@@ -13,13 +12,20 @@ interface Props {
13
12
 
14
13
  export function useGroupChatConversationPayload({ groupId, enabled = true }: Props) {
15
14
  const apiClient = useApiClient()
16
- const proxied = useGroupsProxy()
17
- const { app, url, data: body } = groupChatConversationPayloadRequest({ groupId, proxied })
15
+ const url = `/me/groups/${groupId}/chat_conversation_payload`
18
16
 
19
17
  const { data, ...rest } = useQuery({
20
18
  queryKey: ['groups', url],
21
19
  queryFn: () =>
22
- apiClient[app].post<ApiResource<GroupChatConversationPayload>>({ url, data: body }),
20
+ apiClient.groups.post<ApiResource<GroupChatConversationPayload>>({
21
+ url,
22
+ data: {
23
+ data: {
24
+ type: 'GroupChatConversationPayload',
25
+ attributes: { title: '' },
26
+ },
27
+ },
28
+ }),
23
29
  staleTime: STALE_TIME_MS,
24
30
  refetchOnMount: 'always',
25
31
  enabled,
@@ -28,31 +34,7 @@ export function useGroupChatConversationPayload({ groupId, enabled = true }: Pro
28
34
  return { payload: data?.data.value, ...rest }
29
35
  }
30
36
 
31
- export function groupChatConversationPayloadRequest({
32
- groupId,
33
- title = '',
34
- proxied,
35
- }: {
36
- groupId: number
37
- title?: string
38
- proxied: boolean
39
- }): { app: App; url: string; data: object } {
40
- if (proxied) {
41
- return {
42
- app: 'chat',
43
- url: `/me/groups_groups/${groupId}/chat_conversation_payload`,
44
- data: { data: { type: 'GroupsChatConversationPayload', attributes: { title } } },
45
- }
46
- }
47
-
48
- return {
49
- app: 'groups',
50
- url: `/me/groups/${groupId}/chat_conversation_payload`,
51
- data: { data: { type: 'GroupChatConversationPayload', attributes: { title } } },
52
- }
53
- }
54
-
55
37
  interface GroupChatConversationPayload extends ResourceObject {
56
- type: 'GroupChatConversationPayload' | 'GroupsChatConversationPayload'
38
+ type: 'GroupChatConversationPayload'
57
39
  value: string
58
40
  }
@@ -1,18 +1,14 @@
1
1
  import { keepPreviousData } from '@tanstack/react-query'
2
2
  import { useMemo } from 'react'
3
3
  import { MemberResource, ResourceObject } from '../../types'
4
- import { GroupsMembershipResource } from '../../types/resources/groups'
5
4
  import { GroupsGroupMemberResource } from '../../types/resources/groups/groups_member_resource_with_person'
6
5
  import { useApiPaginator } from '../use_api'
7
6
  import { useEnrichPeople } from '../use_enrich_people'
8
- import { useGroupsProxy } from './use_groups_proxy'
9
-
10
- type Membership = GroupsGroupMemberResource | GroupsMembershipResource
11
7
 
12
8
  type UseApiPaginatorResult<T extends ResourceObject> = ReturnType<typeof useApiPaginator<T>>
13
9
 
14
10
  export type GroupMembersForNewConversationResult = Omit<
15
- UseApiPaginatorResult<Membership>, // We are passing our own "members" data shape
11
+ UseApiPaginatorResult<GroupsGroupMemberResource>, // We are passing our own "members" data shape
16
12
  'data'
17
13
  > & {
18
14
  data: MemberResource[]
@@ -27,41 +23,20 @@ export function useGroupMembersForNewConversation({
27
23
  id: number
28
24
  gender: string | null
29
25
  }) {
30
- const proxied = useGroupsProxy()
31
- const where = gender ? { where: { gender } } : {}
32
- const response = useApiPaginator<Membership>(
33
- proxied
34
- ? {
35
- url: `/me/groups_groups/${id}/memberships`,
36
- data: {
37
- perPage: 100,
38
- fields: {
39
- GroupsMembership: [
40
- 'role',
41
- 'first_name',
42
- 'last_name',
43
- 'avatar_url',
44
- 'gender',
45
- 'child',
46
- ],
47
- },
48
- ...where,
49
- },
50
- app: 'chat',
51
- }
52
- : {
53
- url: `/me/groups/${id}/memberships`,
54
- data: {
55
- perPage: 100,
56
- include: ['person'],
57
- fields: {
58
- Membership: ['person, role'],
59
- Person: ['avatar_url', 'name', 'first_name', 'last_name', 'child', 'gender'],
60
- },
61
- ...where,
62
- },
63
- app: 'groups',
26
+ const response = useApiPaginator<GroupsGroupMemberResource>(
27
+ {
28
+ url: `/me/groups/${id}/memberships`,
29
+ data: {
30
+ perPage: 100,
31
+ include: ['person'],
32
+ fields: {
33
+ Membership: ['person, role'],
34
+ Person: ['avatar_url', 'name', 'first_name', 'last_name', 'child', 'gender'],
64
35
  },
36
+ ...(gender ? { where: { gender } } : {}),
37
+ },
38
+ app: 'groups',
39
+ },
65
40
  {
66
41
  throwOnError: (_error, query) => query.state.data === undefined,
67
42
  placeholderData: keepPreviousData,
@@ -69,11 +44,11 @@ export function useGroupMembersForNewConversation({
69
44
  )
70
45
 
71
46
  const { data: memberships = [] } = response
72
- const people = useMemo(() => memberships.map(membershipPerson), [memberships])
73
- const personIds = useMemo(() => people.map(person => +person.id), [people])
47
+ const personIds = useMemo(() => memberships.map(m => +m.person.id), [memberships])
74
48
  const enrichmentMap = useEnrichPeople({ personIds, groupId: id })
75
49
 
76
- const members: MemberResource[] = people.map(person => {
50
+ const members: MemberResource[] = memberships.map(membership => {
51
+ const { person } = membership
77
52
  const enrichment = enrichmentMap.get(+person.id)
78
53
  return {
79
54
  type: 'Member',
@@ -84,7 +59,7 @@ export function useGroupMembersForNewConversation({
84
59
  id: +person.id,
85
60
  name: `${person.firstName} ${person.lastName}`,
86
61
  source: [],
87
- role: person.role,
62
+ role: membership.role,
88
63
  }
89
64
  })
90
65
 
@@ -98,9 +73,3 @@ export function useGroupMembersForNewConversation({
98
73
  childMembers,
99
74
  }
100
75
  }
101
-
102
- function membershipPerson(membership: Membership) {
103
- if (membership.type === 'GroupsMembership') return membership
104
-
105
- return { ...membership.person, role: membership.role }
106
- }
@@ -2,8 +2,6 @@ import { useMutation } from '@tanstack/react-query'
2
2
  import { ApiResource, ConversationResource, ResourceObject } from '../../types'
3
3
  import { throwResponseError } from '../../utils/response_error'
4
4
  import { useApiClient } from '../use_api_client'
5
- import { groupChatConversationPayloadRequest } from './use_group_chat_conversation_payload'
6
- import { useGroupsProxy } from './use_groups_proxy'
7
5
 
8
6
  interface Props {
9
7
  groupId: number
@@ -14,18 +12,25 @@ interface Props {
14
12
 
15
13
  export function useGroupsConversationCreate({ groupId, title, genderId, onSuccess }: Props) {
16
14
  const apiClient = useApiClient()
17
- const proxied = useGroupsProxy()
18
15
 
19
16
  return useMutation({
20
17
  throwOnError: true,
21
18
  onSuccess: result => {
22
19
  onSuccess(result.data.id)
23
20
  },
24
- mutationFn: () => {
25
- const { app, url, data } = groupChatConversationPayloadRequest({ groupId, title, proxied })
26
-
27
- return apiClient[app]
28
- .post<ApiResource<ChatConversationPayload>>({ url, data })
21
+ mutationFn: () =>
22
+ apiClient.groups
23
+ .post<ApiResource<ChatConversationPayload>>({
24
+ url: `/me/groups/${groupId}/chat_conversation_payload`,
25
+ data: {
26
+ data: {
27
+ type: 'GroupChatConversationPayload',
28
+ attributes: {
29
+ title,
30
+ },
31
+ },
32
+ },
33
+ })
29
34
  .then(res => res.data.value)
30
35
  .then(payload =>
31
36
  apiClient.chat.post<ApiResource<ConversationResource>>({
@@ -41,8 +46,7 @@ export function useGroupsConversationCreate({ groupId, title, genderId, onSucces
41
46
  },
42
47
  })
43
48
  )
44
- .catch(throwResponseError)
45
- },
49
+ .catch(throwResponseError),
46
50
  })
47
51
  }
48
52
 
@@ -62,7 +62,6 @@ export const availableFeatures = {
62
62
  manual_archiving: 'QA_MOBILE_manual_archiving',
63
63
  manual_archiving_rollout: 'ROLLOUT_MOBILE_manual_archiving',
64
64
  hide_conversations: 'ROLLOUT_hide_conversations',
65
- groups_proxy: 'ROLLOUT_groups_proxy',
66
65
  } as const satisfies Record<string, `${'QA' | 'ROLLOUT'}_${string}`>
67
66
 
68
67
  const featureNames = Object.values(availableFeatures)
@@ -1,31 +1,26 @@
1
1
  import { GroupsGroupResource } from '../types'
2
2
  import { FIVE_MINUTES } from '../utils/time'
3
- import { useGroupsProxy } from './groups/use_groups_proxy'
4
3
  import { useApiPaginator } from './use_api'
5
4
 
6
- const GROUP_FIELDS = [
7
- 'can_create_conversation',
8
- 'can_create_conversation_reason_code',
9
- 'name',
10
- 'header_image',
11
- 'memberships_count',
12
- ]
13
-
14
5
  export const useGroupsGroups = () => {
15
- const proxied = useGroupsProxy()
16
-
17
6
  return useApiPaginator<GroupsGroupResource>(
18
- proxied
19
- ? {
20
- url: '/me/groups_groups',
21
- data: { perPage: 100, fields: { GroupsGroup: GROUP_FIELDS } },
22
- app: 'chat',
23
- }
24
- : {
25
- url: '/me/groups',
26
- data: { perPage: 100, fields: { Group: GROUP_FIELDS }, order: 'name' },
27
- app: 'groups',
7
+ {
8
+ url: '/me/groups',
9
+ data: {
10
+ perPage: 100,
11
+ fields: {
12
+ Group: [
13
+ 'can_create_conversation',
14
+ 'can_create_conversation_reason_code',
15
+ 'name',
16
+ 'header_image',
17
+ 'memberships_count',
18
+ ],
28
19
  },
20
+ order: 'name',
21
+ },
22
+ app: 'groups',
23
+ },
29
24
  { staleTime: FIVE_MINUTES }
30
25
  )
31
26
  }
@@ -2,7 +2,6 @@ import { useMemo } from 'react'
2
2
  import { GroupResource, GraphId } from '../types/resources/group_resource'
3
3
  import { GroupsGroupResource } from '../types/resources/groups/groups_group_resource'
4
4
  import { destructureChatGroupGraphId } from '../utils'
5
- import { useGroupsProxy } from './groups/use_groups_proxy'
6
5
  import { useApiGet } from './use_api'
7
6
  import { useNewConversationEntry } from './use_new_conversation_entry'
8
7
 
@@ -23,7 +22,6 @@ export function useNewConversationFromFilter(
23
22
  ): NewConversationFromFilter | undefined {
24
23
  const { sourceAppName, sourceType, sourceId } = destructureChatGroupGraphId(chatGroupGraphId)
25
24
  const entryMode = useNewConversationEntry()
26
- const proxied = useGroupsProxy()
27
25
  const isGroupsGroup = sourceAppName === 'Groups' && sourceType === 'Group'
28
26
  const isServicesTeam = sourceAppName === 'Services' && sourceType === 'Team'
29
27
 
@@ -33,17 +31,11 @@ export function useNewConversationFromFilter(
33
31
  )
34
32
 
35
33
  const { data: groupsGroup } = useApiGet<GroupsGroupResource>(
36
- proxied
37
- ? {
38
- url: `/me/groups_groups/${sourceId}`,
39
- data: { fields: { GroupsGroup: ['can_create_conversation'] } },
40
- app: 'chat',
41
- }
42
- : {
43
- url: `/me/groups/${sourceId}`,
44
- data: { fields: { Group: ['can_create_conversation'] } },
45
- app: 'groups',
46
- },
34
+ {
35
+ url: `/me/groups/${sourceId}`,
36
+ data: { fields: { Group: ['can_create_conversation'] } },
37
+ app: 'groups',
38
+ },
47
39
  { enabled: isGroupsGroup && !!sourceId }
48
40
  )
49
41