@planningcenter/chat-react-native 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/conversations.d.ts.map +1 -1
- package/build/components/conversations.js +29 -8
- package/build/components/conversations.js.map +1 -1
- package/build/components/display/button.d.ts +71 -0
- package/build/components/display/button.d.ts.map +1 -0
- package/build/components/display/button.js +136 -0
- package/build/components/display/button.js.map +1 -0
- package/build/components/display/button_color_utils.d.ts +24 -0
- package/build/components/display/button_color_utils.d.ts.map +1 -0
- package/build/components/display/button_color_utils.js +43 -0
- package/build/components/display/button_color_utils.js.map +1 -0
- package/build/components/display/heading.d.ts +4 -0
- package/build/components/display/heading.d.ts.map +1 -1
- package/build/components/display/heading.js +3 -0
- package/build/components/display/heading.js.map +1 -1
- package/build/components/display/icon.d.ts +8 -4
- package/build/components/display/icon.d.ts.map +1 -1
- package/build/components/display/icon.js +21 -13
- package/build/components/display/icon.js.map +1 -1
- package/build/components/display/image.d.ts +7 -2
- package/build/components/display/image.d.ts.map +1 -1
- package/build/components/display/image.js +5 -5
- package/build/components/display/image.js.map +1 -1
- package/build/components/display/index.d.ts +10 -7
- package/build/components/display/index.d.ts.map +1 -1
- package/build/components/display/index.js +10 -7
- package/build/components/display/index.js.map +1 -1
- package/build/components/display/spinner.d.ts +5 -1
- package/build/components/display/spinner.d.ts.map +1 -1
- package/build/components/display/spinner.js +19 -13
- package/build/components/display/spinner.js.map +1 -1
- package/build/components/display/text.d.ts +13 -3
- package/build/components/display/text.d.ts.map +1 -1
- package/build/components/display/text.js +17 -5
- package/build/components/display/text.js.map +1 -1
- package/build/components/display/text_button.d.ts +37 -0
- package/build/components/display/text_button.d.ts.map +1 -0
- package/build/components/display/text_button.js +36 -0
- package/build/components/display/text_button.js.map +1 -0
- package/build/components/display/text_inline_button.d.ts +12 -0
- package/build/components/display/text_inline_button.d.ts.map +1 -0
- package/build/components/display/text_inline_button.js +53 -0
- package/build/components/display/text_inline_button.js.map +1 -0
- package/build/components/index.d.ts +1 -0
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +1 -0
- package/build/components/index.js.map +1 -1
- package/build/components/primitive/avatar_primitive.d.ts +1 -1
- package/build/components/primitive/avatar_primitive.d.ts.map +1 -1
- package/build/components/primitive/avatar_primitive.js +6 -9
- package/build/components/primitive/avatar_primitive.js.map +1 -1
- package/build/contexts/api_provider.d.ts +4 -6
- package/build/contexts/api_provider.d.ts.map +1 -1
- package/build/contexts/api_provider.js +13 -20
- package/build/contexts/api_provider.js.map +1 -1
- package/build/contexts/chat_context.d.ts +7 -5
- package/build/contexts/chat_context.d.ts.map +1 -1
- package/build/contexts/chat_context.js +40 -4
- package/build/contexts/chat_context.js.map +1 -1
- package/build/hooks/index.d.ts +4 -0
- package/build/hooks/index.d.ts.map +1 -1
- package/build/hooks/index.js +4 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/use_create_android_ripple_color.d.ts +4 -0
- package/build/hooks/use_create_android_ripple_color.d.ts.map +1 -0
- package/build/hooks/use_create_android_ripple_color.js +15 -0
- package/build/hooks/use_create_android_ripple_color.js.map +1 -0
- package/build/hooks/use_current_person.d.ts +3 -0
- package/build/hooks/use_current_person.d.ts.map +1 -0
- package/build/hooks/use_current_person.js +13 -0
- package/build/hooks/use_current_person.js.map +1 -0
- package/build/hooks/use_font_scale.d.ts +4 -0
- package/build/hooks/use_font_scale.d.ts.map +1 -0
- package/build/hooks/use_font_scale.js +8 -0
- package/build/hooks/use_font_scale.js.map +1 -0
- package/build/hooks/use_suspense_api.d.ts +61 -0
- package/build/hooks/use_suspense_api.d.ts.map +1 -0
- package/build/hooks/use_suspense_api.js +39 -0
- package/build/hooks/use_suspense_api.js.map +1 -0
- package/build/navigation/index.d.ts +1 -0
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +7 -4
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +59 -6
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/display.d.ts.map +1 -1
- package/build/screens/display.js +277 -51
- package/build/screens/display.js.map +1 -1
- package/build/screens/not_found.js +1 -1
- package/build/screens/not_found.js.map +1 -1
- package/build/types/api_primitives.d.ts +23 -0
- package/build/types/api_primitives.d.ts.map +1 -0
- package/build/types/api_primitives.js +2 -0
- package/build/types/api_primitives.js.map +1 -0
- package/build/types/index.d.ts +4 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/index.js +4 -0
- package/build/types/index.js.map +1 -0
- package/build/types/resources/conversation.d.ts +15 -0
- package/build/types/resources/conversation.d.ts.map +1 -0
- package/build/types/resources/conversation.js +2 -0
- package/build/types/resources/conversation.js.map +1 -0
- package/build/types/resources/index.d.ts +5 -0
- package/build/types/resources/index.d.ts.map +1 -0
- package/build/types/resources/index.js +5 -0
- package/build/types/resources/index.js.map +1 -0
- package/build/types/resources/message.d.ts +16 -0
- package/build/types/resources/message.d.ts.map +1 -0
- package/build/types/resources/message.js +2 -0
- package/build/types/resources/message.js.map +1 -0
- package/build/types/resources/oauth_token.d.ts +9 -0
- package/build/types/resources/oauth_token.d.ts.map +1 -0
- package/build/types/resources/oauth_token.js +2 -0
- package/build/types/resources/oauth_token.js.map +1 -0
- package/build/types/resources/person.d.ts +9 -0
- package/build/types/resources/person.d.ts.map +1 -0
- package/build/types/resources/person.js +2 -0
- package/build/types/resources/person.js.map +1 -0
- package/build/types/resources/reaction.d.ts +10 -0
- package/build/types/resources/reaction.d.ts.map +1 -0
- package/build/types/resources/reaction.js +2 -0
- package/build/types/resources/reaction.js.map +1 -0
- package/build/types/utils/index.d.ts +4 -0
- package/build/types/utils/index.d.ts.map +1 -0
- package/build/types/utils/index.js +4 -0
- package/build/types/utils/index.js.map +1 -0
- package/build/utils/client/client.d.ts +21 -12
- package/build/utils/client/client.d.ts.map +1 -1
- package/build/utils/client/client.js +24 -22
- package/build/utils/client/client.js.map +1 -1
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +1 -0
- package/build/utils/index.js.map +1 -1
- package/build/utils/session.d.ts +0 -5
- package/build/utils/session.d.ts.map +1 -1
- package/build/utils/session.js +0 -10
- package/build/utils/session.js.map +1 -1
- package/build/utils/styles.d.ts +5 -0
- package/build/utils/styles.d.ts.map +1 -1
- package/build/utils/styles.js +9 -0
- package/build/utils/styles.js.map +1 -1
- package/build/utils/theme.d.ts +3 -1
- package/build/utils/theme.d.ts.map +1 -1
- package/build/utils/theme.js +6 -2
- package/build/utils/theme.js.map +1 -1
- package/build/vendor/tapestry/alias_tokens_color_map.d.ts +8 -0
- package/build/vendor/tapestry/alias_tokens_color_map.d.ts.map +1 -1
- package/build/vendor/tapestry/alias_tokens_color_map.js +8 -0
- package/build/vendor/tapestry/alias_tokens_color_map.js.map +1 -1
- package/build/vendor/tapestry/tokens.d.ts +21 -0
- package/build/vendor/tapestry/tokens.d.ts.map +1 -1
- package/build/vendor/tapestry/tokens.js +21 -0
- package/build/vendor/tapestry/tokens.js.map +1 -1
- package/package.json +4 -3
- package/src/__tests__/client.ts +72 -19
- package/src/__tests__/session.ts +0 -11
- package/src/__utils__/handlers.ts +1 -1
- package/src/components/conversations.tsx +33 -11
- package/src/components/display/button.tsx +293 -0
- package/src/components/display/button_color_utils.ts +72 -0
- package/src/components/display/heading.tsx +12 -0
- package/src/components/display/icon.tsx +35 -16
- package/src/components/display/image.tsx +29 -7
- package/src/components/display/index.ts +10 -7
- package/src/components/display/spinner.tsx +42 -13
- package/src/components/display/text.tsx +34 -13
- package/src/components/display/text_button.tsx +102 -0
- package/src/components/display/text_inline_button.tsx +91 -0
- package/src/components/index.tsx +1 -0
- package/src/components/primitive/avatar_primitive.tsx +12 -6
- package/src/contexts/api_provider.tsx +18 -26
- package/src/contexts/chat_context.tsx +61 -7
- package/src/hooks/index.ts +4 -0
- package/src/hooks/use_create_android_ripple_color.ts +18 -0
- package/src/hooks/use_current_person.ts +15 -0
- package/src/hooks/use_font_scale.ts +9 -0
- package/src/hooks/use_suspense_api.ts +60 -0
- package/src/navigation/index.tsx +14 -4
- package/src/screens/conversation_screen.tsx +83 -7
- package/src/screens/display.tsx +447 -51
- package/src/screens/not_found.tsx +1 -1
- package/src/types/api_primitives.ts +24 -0
- package/src/types/index.ts +3 -0
- package/src/types/resources/conversation.ts +15 -0
- package/src/types/resources/index.ts +4 -0
- package/src/types/resources/message.ts +18 -0
- package/src/types/resources/oauth_token.ts +8 -0
- package/src/types/resources/person.ts +9 -0
- package/src/types/resources/reaction.ts +9 -0
- package/src/types/utils/index.ts +6 -0
- package/src/utils/client/client.ts +41 -34
- package/src/utils/client/types.d.ts +2 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/session.ts +0 -13
- package/src/utils/styles.ts +12 -0
- package/src/utils/theme.ts +9 -3
- package/src/vendor/tapestry/alias_tokens_color_map.ts +12 -0
- package/src/vendor/tapestry/tokens.ts +21 -0
- package/build/utils/api.d.ts +0 -9
- package/build/utils/api.d.ts.map +0 -1
- package/build/utils/api.js +0 -36
- package/build/utils/api.js.map +0 -1
- package/src/types.d.ts +0 -35
- package/src/utils/api.ts +0 -47
|
@@ -41,6 +41,10 @@ const semanticAliasesLight = {
|
|
|
41
41
|
textColorDefaultPlaceholder: neutralsLight.fillColorNeutral030,
|
|
42
42
|
textColorDefaultInverted: tokens.colorNeutral100White,
|
|
43
43
|
fillColorInteractionOnlineDefault: tokens.colorInteractionOnlineDefault,
|
|
44
|
+
fillColorInteractionDefault: tokens.fillColorInteractionDefault,
|
|
45
|
+
fillColorStatusErrorMedium: tokens.fillColorStatusErrorMedium,
|
|
46
|
+
fillColorButtonNeutralSolidDisabled: neutralsLight.fillColorNeutral070,
|
|
47
|
+
androidRippleNeutral: tokens.fillColorTransparencyDark020,
|
|
44
48
|
};
|
|
45
49
|
const semanticAliasesDark = {
|
|
46
50
|
name: 'dark',
|
|
@@ -56,6 +60,10 @@ const semanticAliasesDark = {
|
|
|
56
60
|
textColorDefaultPlaceholder: neutralsDark.fillColorNeutral030,
|
|
57
61
|
textColorDefaultInverted: tokens.colorNeutral7,
|
|
58
62
|
fillColorInteractionOnlineDefault: tokens.colorInteractionOnlineDefault,
|
|
63
|
+
fillColorInteractionDefault: tokens.fillColorInteractionDefaultDark,
|
|
64
|
+
fillColorStatusErrorMedium: tokens.fillColorStatusErrorMedium,
|
|
65
|
+
fillColorButtonNeutralSolidDisabled: neutralsDark.fillColorNeutral070,
|
|
66
|
+
androidRippleNeutral: tokens.fillColorTransparencyLight020,
|
|
59
67
|
};
|
|
60
68
|
export const aliasTokensColorMap = {
|
|
61
69
|
light: { ...neutralsLight, ...semanticAliasesLight },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alias_tokens_color_map.js","sourceRoot":"","sources":["../../../src/vendor/tapestry/alias_tokens_color_map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAqBjC,MAAM,aAAa,GAAkB;IACnC,IAAI,EAAE,OAAO;IACb,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,uBAAuB,EAAE,MAAM,CAAC,cAAc;IAC9C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,2BAA2B,EAAE,MAAM,CAAC,oBAAoB;CAChD,CAAA;AAEV,MAAM,YAAY,GAAkB;IAClC,IAAI,EAAE,MAAM;IACZ,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC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,mBAAmB;IAC1D,wBAAwB,EAAE,YAAY,CAAC,2BAA2B;IAClE,wBAAwB,EAAE,YAAY,CAAC,mBAAmB;IAC1D,uBAAuB,EAAE,YAAY,CAAC,mBAAmB;IACzD,yBAAyB,EAAE,YAAY,CAAC,mBAAmB;IAC3D,wBAAwB,EAAE,YAAY,CAAC,mBAAmB;IAC1D,2BAA2B,EAAE,YAAY,CAAC,mBAAmB;IAC7D,wBAAwB,EAAE,MAAM,CAAC,aAAa;IAC9C,iCAAiC,EAAE,MAAM,CAAC,6BAA6B;IACvE,2BAA2B,EAAE,MAAM,CAAC,+BAA+B;IACnE,0BAA0B,EAAE,MAAM,CAAC,0BAA0B;IAC7D,mCAAmC,EAAE,YAAY,CAAC,mBAAmB;IACrE,oBAAoB,EAAE,MAAM,CAAC,6BAA6B;CAC3D,CAAA;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,KAAK,EAAE,EAAE,GAAG,aAAa,EAAE,GAAG,oBAAoB,EAAE;IACpD,IAAI,EAAE,EAAE,GAAG,YAAY,EAAE,GAAG,mBAAmB,EAAE;CACzC,CAAA","sourcesContent":["import { tokens } from './tokens'\n\n// Copied from `@planningcenter/tapestry` package.\n// Defining these tokens locally is a temporary solution until the package supports mobile.\n// Tokens Reference: https://planningcenter.github.io/tapestry/?path=/docs/foundations-design-tokens--docs\n\ninterface NeutralColors {\n name: string\n fillColorNeutral000: string\n fillColorNeutral010: string\n fillColorNeutral020: string\n fillColorNeutral030: string\n fillColorNeutral040: string\n fillColorNeutral050Base: string\n fillColorNeutral060: string\n fillColorNeutral070: string\n fillColorNeutral080: string\n fillColorNeutral090: string\n fillColorNeutral100Inverted: string\n}\n\nconst neutralsLight: NeutralColors = {\n name: 'light',\n fillColorNeutral000: tokens.colorNeutral12,\n fillColorNeutral010: tokens.colorNeutral24,\n fillColorNeutral020: tokens.colorNeutral45,\n fillColorNeutral030: tokens.colorNeutral58,\n fillColorNeutral040: tokens.colorNeutral81,\n fillColorNeutral050Base: tokens.colorNeutral88,\n fillColorNeutral060: tokens.colorNeutral93,\n fillColorNeutral070: tokens.colorNeutral95,\n fillColorNeutral080: tokens.colorNeutral97,\n fillColorNeutral090: tokens.colorNeutral98,\n fillColorNeutral100Inverted: tokens.colorNeutral100White,\n} as const\n\nconst neutralsDark: NeutralColors = {\n name: 'dark',\n fillColorNeutral000: tokens.colorNeutral98,\n fillColorNeutral010: tokens.colorNeutral88,\n fillColorNeutral020: tokens.colorNeutral68,\n fillColorNeutral030: tokens.colorNeutral50,\n fillColorNeutral040: tokens.colorNeutral32,\n fillColorNeutral050Base: tokens.colorNeutral24,\n fillColorNeutral060: tokens.colorNeutral19,\n fillColorNeutral070: tokens.colorNeutral17,\n fillColorNeutral080: tokens.colorNeutral15,\n fillColorNeutral090: tokens.colorNeutral12,\n fillColorNeutral100Inverted: tokens.colorNeutral7,\n} as const\n\ninterface SemanticAliasesColors {\n name: string\n iconColorDefaultPrimary: string\n iconColorDefaultSecondary: string\n iconColorDefaultDim: string\n iconColorDefaultDisabled: string\n iconColorDefaultInverted: string\n textColorDefaultHeadline: string\n textColorDefaultPrimary: string\n textColorDefaultSecondary: string\n textColorDefaultDisabled: string\n textColorDefaultPlaceholder: string\n textColorDefaultInverted: string\n fillColorInteractionOnlineDefault: string\n fillColorInteractionDefault: string\n fillColorStatusErrorMedium: string\n fillColorButtonNeutralSolidDisabled: string\n androidRippleNeutral: string\n}\n\nconst semanticAliasesLight: SemanticAliasesColors = {\n name: 'light',\n iconColorDefaultPrimary: neutralsLight.fillColorNeutral010,\n iconColorDefaultSecondary: neutralsLight.fillColorNeutral020,\n iconColorDefaultDim: neutralsLight.fillColorNeutral030,\n iconColorDefaultDisabled: neutralsLight.fillColorNeutral040,\n iconColorDefaultInverted: neutralsLight.fillColorNeutral100Inverted,\n textColorDefaultHeadline: neutralsLight.fillColorNeutral000,\n textColorDefaultPrimary: neutralsLight.fillColorNeutral010,\n textColorDefaultSecondary: neutralsLight.fillColorNeutral020,\n textColorDefaultDisabled: neutralsLight.fillColorNeutral040,\n textColorDefaultPlaceholder: neutralsLight.fillColorNeutral030,\n textColorDefaultInverted: tokens.colorNeutral100White,\n fillColorInteractionOnlineDefault: tokens.colorInteractionOnlineDefault,\n fillColorInteractionDefault: tokens.fillColorInteractionDefault,\n fillColorStatusErrorMedium: tokens.fillColorStatusErrorMedium,\n fillColorButtonNeutralSolidDisabled: neutralsLight.fillColorNeutral070,\n androidRippleNeutral: tokens.fillColorTransparencyDark020,\n} as const\n\nconst semanticAliasesDark: SemanticAliasesColors = {\n name: 'dark',\n iconColorDefaultPrimary: neutralsDark.fillColorNeutral010,\n iconColorDefaultSecondary: neutralsDark.fillColorNeutral020,\n iconColorDefaultDim: neutralsDark.fillColorNeutral030,\n iconColorDefaultDisabled: neutralsDark.fillColorNeutral040,\n iconColorDefaultInverted: neutralsDark.fillColorNeutral100Inverted,\n textColorDefaultHeadline: neutralsDark.fillColorNeutral000,\n textColorDefaultPrimary: neutralsDark.fillColorNeutral010,\n textColorDefaultSecondary: neutralsDark.fillColorNeutral020,\n textColorDefaultDisabled: neutralsDark.fillColorNeutral040,\n textColorDefaultPlaceholder: neutralsDark.fillColorNeutral030,\n textColorDefaultInverted: tokens.colorNeutral7,\n fillColorInteractionOnlineDefault: tokens.colorInteractionOnlineDefault,\n fillColorInteractionDefault: tokens.fillColorInteractionDefaultDark,\n fillColorStatusErrorMedium: tokens.fillColorStatusErrorMedium,\n fillColorButtonNeutralSolidDisabled: neutralsDark.fillColorNeutral070,\n androidRippleNeutral: tokens.fillColorTransparencyLight020,\n}\n\nexport const aliasTokensColorMap = {\n light: { ...neutralsLight, ...semanticAliasesLight },\n dark: { ...neutralsDark, ...semanticAliasesDark },\n} as const\n"]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export declare const tokens: {
|
|
2
2
|
colorInteractionOnlineDefault: "hsl(123, 38%, 57%)";
|
|
3
|
+
fillColorInteractionDefaultDark: "hsl(204, 100%, 40%)";
|
|
4
|
+
fillColorStatusErrorMedium: "hsl(0, 72%, 45%)";
|
|
3
5
|
borderRadiusDefault: 4;
|
|
4
6
|
spacingFourth: 2;
|
|
5
7
|
spacingHalf: 4;
|
|
@@ -48,5 +50,24 @@ export declare const tokens: {
|
|
|
48
50
|
colorNeutral97: "hsl(0, 0%, 97%)";
|
|
49
51
|
colorNeutral98: "hsl(0, 0%, 98%)";
|
|
50
52
|
colorNeutral100White: "hsl(0, 0%, 100%)";
|
|
53
|
+
fillColorInteractionDefault: "hsl(204, 100%, 40%)";
|
|
54
|
+
fillColorTransparencyLight010: "hsla(0, 0%, 100%, 0.1)";
|
|
55
|
+
fillColorTransparencyLight020: "hsla(0, 0%, 100%, 0.2)";
|
|
56
|
+
fillColorTransparencyLight030: "hsla(0, 0%, 100%, 0.3)";
|
|
57
|
+
fillColorTransparencyLight040: "hsla(0, 0%, 100%, 0.4)";
|
|
58
|
+
fillColorTransparencyLight050: "hsla(0, 0%, 100%, 0.5)";
|
|
59
|
+
fillColorTransparencyLight060: "hsla(0, 0%, 100%, 0.6)";
|
|
60
|
+
fillColorTransparencyLight070: "hsla(0, 0%, 100%, 0.7)";
|
|
61
|
+
fillColorTransparencyLight080: "hsla(0, 0%, 100%, 0.8)";
|
|
62
|
+
fillColorTransparencyLight090: "hsla(0, 0%, 100%, 0.9)";
|
|
63
|
+
fillColorTransparencyDark010: "hsla(0, 0%, 0%, 0.1)";
|
|
64
|
+
fillColorTransparencyDark020: "hsla(0, 0%, 0%, 0.2)";
|
|
65
|
+
fillColorTransparencyDark030: "hsla(0, 0%, 0%, 0.3)";
|
|
66
|
+
fillColorTransparencyDark040: "hsla(0, 0%, 0%, 0.4)";
|
|
67
|
+
fillColorTransparencyDark050: "hsla(0, 0%, 0%, 0.5)";
|
|
68
|
+
fillColorTransparencyDark060: "hsla(0, 0%, 0%, 0.6)";
|
|
69
|
+
fillColorTransparencyDark070: "hsla(0, 0%, 0%, 0.7)";
|
|
70
|
+
fillColorTransparencyDark080: "hsla(0, 0%, 0%, 0.8)";
|
|
71
|
+
fillColorTransparencyDark090: "hsla(0, 0%, 0%, 0.9)";
|
|
51
72
|
};
|
|
52
73
|
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/vendor/tapestry/tokens.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/vendor/tapestry/tokens.ts"],"names":[],"mappings":"AAuFA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKlB,CAAA"}
|
|
@@ -20,6 +20,25 @@ const colorPrimitives = {
|
|
|
20
20
|
colorNeutral97: 'hsl(0, 0%, 97%)',
|
|
21
21
|
colorNeutral98: 'hsl(0, 0%, 98%)',
|
|
22
22
|
colorNeutral100White: 'hsl(0, 0%, 100%)',
|
|
23
|
+
fillColorInteractionDefault: 'hsl(204, 100%, 40%)',
|
|
24
|
+
fillColorTransparencyLight010: 'hsla(0, 0%, 100%, 0.1)',
|
|
25
|
+
fillColorTransparencyLight020: 'hsla(0, 0%, 100%, 0.2)',
|
|
26
|
+
fillColorTransparencyLight030: 'hsla(0, 0%, 100%, 0.3)',
|
|
27
|
+
fillColorTransparencyLight040: 'hsla(0, 0%, 100%, 0.4)',
|
|
28
|
+
fillColorTransparencyLight050: 'hsla(0, 0%, 100%, 0.5)',
|
|
29
|
+
fillColorTransparencyLight060: 'hsla(0, 0%, 100%, 0.6)',
|
|
30
|
+
fillColorTransparencyLight070: 'hsla(0, 0%, 100%, 0.7)',
|
|
31
|
+
fillColorTransparencyLight080: 'hsla(0, 0%, 100%, 0.8)',
|
|
32
|
+
fillColorTransparencyLight090: 'hsla(0, 0%, 100%, 0.9)',
|
|
33
|
+
fillColorTransparencyDark010: 'hsla(0, 0%, 0%, 0.1)',
|
|
34
|
+
fillColorTransparencyDark020: 'hsla(0, 0%, 0%, 0.2)',
|
|
35
|
+
fillColorTransparencyDark030: 'hsla(0, 0%, 0%, 0.3)',
|
|
36
|
+
fillColorTransparencyDark040: 'hsla(0, 0%, 0%, 0.4)',
|
|
37
|
+
fillColorTransparencyDark050: 'hsla(0, 0%, 0%, 0.5)',
|
|
38
|
+
fillColorTransparencyDark060: 'hsla(0, 0%, 0%, 0.6)',
|
|
39
|
+
fillColorTransparencyDark070: 'hsla(0, 0%, 0%, 0.7)',
|
|
40
|
+
fillColorTransparencyDark080: 'hsla(0, 0%, 0%, 0.8)',
|
|
41
|
+
fillColorTransparencyDark090: 'hsla(0, 0%, 0%, 0.9)',
|
|
23
42
|
};
|
|
24
43
|
const numericPrimtives = {
|
|
25
44
|
spacingFourth: 2,
|
|
@@ -58,6 +77,8 @@ const numericAliases = {
|
|
|
58
77
|
// These tokens are specfic to Chat will not be replaced by the Tapestry library
|
|
59
78
|
const localChatTokens = {
|
|
60
79
|
colorInteractionOnlineDefault: 'hsl(123, 38%, 57%)',
|
|
80
|
+
fillColorInteractionDefaultDark: 'hsl(204, 100%, 40%)',
|
|
81
|
+
fillColorStatusErrorMedium: 'hsl(0, 72%, 45%)',
|
|
61
82
|
};
|
|
62
83
|
export const tokens = {
|
|
63
84
|
...colorPrimitives,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/vendor/tapestry/tokens.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,2FAA2F;AAC3F,0GAA0G;AAE1G,MAAM,eAAe,GAAG;IACtB,aAAa,EAAE,gBAAgB;IAC/B,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAA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eAAe;IAClB,GAAG,gBAAgB;IACnB,GAAG,cAAc;IACjB,GAAG,eAAe;CACnB,CAAA","sourcesContent":["// Copied from `@planningcenter/tapestry` package.\n// Defining these tokens locally is a temporary solution until the package supports mobile.\n// Tokens Reference: https://planningcenter.github.io/tapestry/?path=/docs/foundations-design-tokens--docs\n\nconst colorPrimitives = {\n colorNeutral7: 'hsl(0, 0%, 7%)',\n colorNeutral12: 'hsl(0, 0%, 12%)',\n colorNeutral15: 'hsl(0, 0%, 15%)',\n colorNeutral17: 'hsl(0, 0%, 17%)',\n colorNeutral19: 'hsl(0, 0%, 19%)',\n colorNeutral24: 'hsl(0, 0%, 24%)',\n colorNeutral32: 'hsl(0, 0%, 32%)',\n colorNeutral45: 'hsl(0, 0%, 45%)',\n colorNeutral50: 'hsl(0, 0%, 50%)',\n colorNeutral58: 'hsl(0, 0%, 58%)',\n colorNeutral68: 'hsl(0, 0%, 68%)',\n colorNeutral81: 'hsl(0, 0%, 81%)',\n colorNeutral88: 'hsl(0, 0%, 88%)',\n colorNeutral93: 'hsl(0, 0%, 93%)',\n colorNeutral95: 'hsl(0, 0%, 95%)',\n colorNeutral97: 'hsl(0, 0%, 97%)',\n colorNeutral98: 'hsl(0, 0%, 98%)',\n colorNeutral100White: 'hsl(0, 0%, 100%)',\n fillColorInteractionDefault: 'hsl(204, 100%, 40%)',\n fillColorTransparencyLight010: 'hsla(0, 0%, 100%, 0.1)',\n fillColorTransparencyLight020: 'hsla(0, 0%, 100%, 0.2)',\n fillColorTransparencyLight030: 'hsla(0, 0%, 100%, 0.3)',\n fillColorTransparencyLight040: 'hsla(0, 0%, 100%, 0.4)',\n fillColorTransparencyLight050: 'hsla(0, 0%, 100%, 0.5)',\n fillColorTransparencyLight060: 'hsla(0, 0%, 100%, 0.6)',\n fillColorTransparencyLight070: 'hsla(0, 0%, 100%, 0.7)',\n fillColorTransparencyLight080: 'hsla(0, 0%, 100%, 0.8)',\n fillColorTransparencyLight090: 'hsla(0, 0%, 100%, 0.9)',\n fillColorTransparencyDark010: 'hsla(0, 0%, 0%, 0.1)',\n fillColorTransparencyDark020: 'hsla(0, 0%, 0%, 0.2)',\n fillColorTransparencyDark030: 'hsla(0, 0%, 0%, 0.3)',\n fillColorTransparencyDark040: 'hsla(0, 0%, 0%, 0.4)',\n fillColorTransparencyDark050: 'hsla(0, 0%, 0%, 0.5)',\n fillColorTransparencyDark060: 'hsla(0, 0%, 0%, 0.6)',\n fillColorTransparencyDark070: 'hsla(0, 0%, 0%, 0.7)',\n fillColorTransparencyDark080: 'hsla(0, 0%, 0%, 0.8)',\n fillColorTransparencyDark090: 'hsla(0, 0%, 0%, 0.9)',\n} as const\n\nconst numericPrimtives = {\n spacingFourth: 2,\n spacingHalf: 4,\n spacing1: 8,\n spacing2: 16,\n spacing3: 24,\n spacing4: 32,\n spacing5: 40,\n spacing6: 48,\n spacing7: 56,\n borderRadiusSm: 2,\n borderRadiusMd: 4,\n borderRadiusLg: 8,\n borderRadiusXl: 16,\n borderRadiusRound: 56,\n borderSizeDefault: 1,\n borderSizeThick: 2,\n fontWeightNormal: '400',\n fontWeightMedium: '500',\n fontWeightSemiBold: '600',\n fontWeightBold: '700',\n fontSize4xl: 32,\n fontSize3xl: 28,\n fontSize2xl: 24,\n fontSizeXl: 20,\n fontSizeLg: 18,\n fontSizeMd: 16,\n fontSizeSm: 14,\n fontSizeXs: 12,\n fontSize2xs: 10,\n} as const\n\nconst numericAliases = {\n borderRadiusDefault: numericPrimtives.borderRadiusMd,\n} as const\n\n// These tokens are specfic to Chat will not be replaced by the Tapestry library\nconst localChatTokens = {\n colorInteractionOnlineDefault: 'hsl(123, 38%, 57%)',\n fillColorInteractionDefaultDark: 'hsl(204, 100%, 40%)',\n fillColorStatusErrorMedium: 'hsl(0, 72%, 45%)',\n} as const\n\nexport const tokens = {\n ...colorPrimitives,\n ...numericPrimtives,\n ...numericAliases,\n ...localChatTokens,\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"prepublishOnly": "expo-module prepublishOnly"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@planningcenter/chat-core": "^1.5.0",
|
|
21
20
|
"fast-text-encoding": "^1.0.6",
|
|
22
21
|
"jest-fetch-mock": "^3.0.3",
|
|
23
22
|
"lodash-inflection": "^1.5.0",
|
|
@@ -30,10 +29,12 @@
|
|
|
30
29
|
"@react-navigation/native": ">=7.0.0",
|
|
31
30
|
"@react-navigation/native-stack": ">=7.0.0",
|
|
32
31
|
"@tanstack/react-query": "^5.0.0",
|
|
32
|
+
"color": "^3.1.2",
|
|
33
33
|
"lodash": "*",
|
|
34
34
|
"react": "*",
|
|
35
35
|
"react-native": "*",
|
|
36
36
|
"react-native-device-info": "*",
|
|
37
|
+
"react-native-linear-gradient": "^2.8.3",
|
|
37
38
|
"react-native-svg": "*"
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
@@ -45,5 +46,5 @@
|
|
|
45
46
|
"prettier": "^3.4.2",
|
|
46
47
|
"typescript": "<5.6.0"
|
|
47
48
|
},
|
|
48
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "885163bbbf48e2583d601930ffba8dd9f1fc962b"
|
|
49
50
|
}
|
package/src/__tests__/client.ts
CHANGED
|
@@ -3,26 +3,13 @@ import Client from '../utils/client/client'
|
|
|
3
3
|
import { Session } from '../utils/session'
|
|
4
4
|
import DefaultFixtures from '../__utils__/fixtures/defaults'
|
|
5
5
|
import { BASE_URL } from '../__utils__/handlers'
|
|
6
|
+
import { OAuthToken } from '../types'
|
|
6
7
|
|
|
7
8
|
const APP_BASE_URL = BASE_URL
|
|
8
9
|
|
|
9
|
-
let session
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
app: 'chat',
|
|
13
|
-
version: '2018-11-01',
|
|
14
|
-
session,
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
const clientWithDefaultHeaders = new Client({
|
|
18
|
-
app: 'chat',
|
|
19
|
-
version: '2018-11-01',
|
|
20
|
-
defaultHeaders: {
|
|
21
|
-
'X-Custom-Default-Header': 'important data',
|
|
22
|
-
},
|
|
23
|
-
session,
|
|
24
|
-
})
|
|
25
|
-
|
|
10
|
+
let session: Session
|
|
11
|
+
let client: Client
|
|
12
|
+
let clientWithDefaultHeaders: Client
|
|
26
13
|
let fetchSpy: jest.SpyInstance
|
|
27
14
|
|
|
28
15
|
beforeAll(() => MockServer.server().listen())
|
|
@@ -32,6 +19,22 @@ afterAll(() => MockServer.server().close())
|
|
|
32
19
|
beforeEach(() => {
|
|
33
20
|
jest.clearAllMocks()
|
|
34
21
|
fetchSpy = jest.spyOn(globalThis, 'fetch')
|
|
22
|
+
session = new Session({ env: 'development' })
|
|
23
|
+
client = new Client({
|
|
24
|
+
app: 'chat',
|
|
25
|
+
version: '2018-11-01',
|
|
26
|
+
session,
|
|
27
|
+
onTokenExpired: () => {},
|
|
28
|
+
})
|
|
29
|
+
clientWithDefaultHeaders = new Client({
|
|
30
|
+
app: 'chat',
|
|
31
|
+
version: '2018-11-01',
|
|
32
|
+
defaultHeaders: {
|
|
33
|
+
'X-Custom-Default-Header': 'important data',
|
|
34
|
+
},
|
|
35
|
+
session,
|
|
36
|
+
onTokenExpired: () => {},
|
|
37
|
+
})
|
|
35
38
|
})
|
|
36
39
|
|
|
37
40
|
describe('get', () => {
|
|
@@ -341,13 +344,14 @@ describe('url switching', () => {
|
|
|
341
344
|
const prodBase = 'https://api.planningcenteronline.com/chat/v2'
|
|
342
345
|
const stagingBase = 'https://api-staging.planningcenteronline.com/chat/v2'
|
|
343
346
|
|
|
344
|
-
MockServer.get(prodBase + '/records', {}, 200)
|
|
345
|
-
MockServer.get(stagingBase + '/records', {}, 200)
|
|
347
|
+
MockServer.get(prodBase + '/records', {}, 200, { once: true })
|
|
348
|
+
MockServer.get(stagingBase + '/records', {}, 200, { once: true })
|
|
346
349
|
|
|
347
350
|
const newClient = new Client({
|
|
348
351
|
app: 'chat',
|
|
349
352
|
session,
|
|
350
353
|
version: '2018-11-01',
|
|
354
|
+
onTokenExpired: () => {},
|
|
351
355
|
})
|
|
352
356
|
|
|
353
357
|
await newClient.get({
|
|
@@ -385,4 +389,53 @@ describe('url switching', () => {
|
|
|
385
389
|
expect.any(Object)
|
|
386
390
|
)
|
|
387
391
|
})
|
|
392
|
+
|
|
393
|
+
it('Changes to session switches the base url with custom headers', async () => {
|
|
394
|
+
const token: OAuthToken = {
|
|
395
|
+
access_token: 'foo',
|
|
396
|
+
token_type: undefined,
|
|
397
|
+
created_at: 0,
|
|
398
|
+
expires_in: undefined,
|
|
399
|
+
scope: '',
|
|
400
|
+
refresh_token: undefined,
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
session.token = token
|
|
404
|
+
|
|
405
|
+
await client.get({
|
|
406
|
+
url: '/records',
|
|
407
|
+
data: { fields: { Record: ['id'] } },
|
|
408
|
+
})
|
|
409
|
+
|
|
410
|
+
requestHeadersShouldContain({
|
|
411
|
+
...fetchSpy.mock.calls[0][1],
|
|
412
|
+
key: 'Authorization',
|
|
413
|
+
value: 'foo',
|
|
414
|
+
})
|
|
415
|
+
|
|
416
|
+
session.token.access_token = 'bar'
|
|
417
|
+
|
|
418
|
+
await client.get({
|
|
419
|
+
url: '/records',
|
|
420
|
+
data: { fields: { Record: ['id'] } },
|
|
421
|
+
})
|
|
422
|
+
|
|
423
|
+
requestHeadersShouldContain({
|
|
424
|
+
...fetchSpy.mock.calls[1][1],
|
|
425
|
+
key: 'Authorization',
|
|
426
|
+
value: 'bar',
|
|
427
|
+
})
|
|
428
|
+
})
|
|
388
429
|
})
|
|
430
|
+
|
|
431
|
+
const requestHeadersShouldContain = ({
|
|
432
|
+
headers,
|
|
433
|
+
key,
|
|
434
|
+
value,
|
|
435
|
+
}: {
|
|
436
|
+
headers: Record<string, unknown>
|
|
437
|
+
key: string
|
|
438
|
+
value: unknown
|
|
439
|
+
}) => {
|
|
440
|
+
expect(headers[key]).toContain(value)
|
|
441
|
+
}
|
package/src/__tests__/session.ts
CHANGED
|
@@ -25,17 +25,6 @@ describe('Session', () => {
|
|
|
25
25
|
})
|
|
26
26
|
})
|
|
27
27
|
|
|
28
|
-
describe('urls', () => {
|
|
29
|
-
it('should return the correct base url', () => {
|
|
30
|
-
const session = new Session({ env: 'production' })
|
|
31
|
-
expect(session.baseUrl).toBe('https://api.planningcenteronline.com')
|
|
32
|
-
session.env = 'development'
|
|
33
|
-
expect(session.baseUrl).toBe('http://api.pco.test')
|
|
34
|
-
session.env = 'staging'
|
|
35
|
-
expect(session.baseUrl).toBe('https://api-staging.planningcenteronline.com')
|
|
36
|
-
})
|
|
37
|
-
})
|
|
38
|
-
|
|
39
28
|
describe('hydrate', () => {
|
|
40
29
|
describe('success', () => {
|
|
41
30
|
it('should return a hydrated Session instance', () => {
|
|
@@ -1,27 +1,43 @@
|
|
|
1
|
-
import { ConversationResource, JSONAPICollection } from '@planningcenter/chat-core'
|
|
2
1
|
import { useNavigation } from '@react-navigation/native'
|
|
3
|
-
import { useSuspenseQuery } from '@tanstack/react-query'
|
|
4
2
|
import React from 'react'
|
|
5
3
|
import { FlatList, Pressable, StyleSheet } from 'react-native'
|
|
6
4
|
import { useTheme } from '../hooks'
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
import { useSuspensePaginator } from '../hooks/use_suspense_api'
|
|
6
|
+
import { ConversationResource } from '../types'
|
|
7
|
+
import { GetRequest } from '../utils/client/types'
|
|
8
|
+
import { Heading, Text } from './display'
|
|
10
9
|
|
|
11
10
|
export const Conversations = () => {
|
|
12
11
|
const styles = useStyles()
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
const request: GetRequest = {
|
|
13
|
+
url: '/me/conversations',
|
|
14
|
+
data: {
|
|
15
|
+
perPage: 20,
|
|
16
|
+
order: '-last_message',
|
|
17
|
+
fields: {
|
|
18
|
+
Conversation: [
|
|
19
|
+
'title',
|
|
20
|
+
'last_message_created_at',
|
|
21
|
+
'last_message_author_name',
|
|
22
|
+
'last_message_text_preview',
|
|
23
|
+
'unread_count',
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
const { data: conversations, fetchNextPage } = useSuspensePaginator<ConversationResource>(request)
|
|
29
|
+
|
|
30
|
+
// TODO: Filter using the API
|
|
31
|
+
const nonEmptyConversations = conversations.filter(c => c.lastMessageTextPreview) || []
|
|
32
|
+
|
|
16
33
|
const navigation = useNavigation()
|
|
17
34
|
|
|
18
35
|
return (
|
|
19
36
|
<FlatList
|
|
20
|
-
data={
|
|
37
|
+
data={nonEmptyConversations}
|
|
21
38
|
contentContainerStyle={styles.container}
|
|
22
39
|
style={styles.scrollView}
|
|
23
40
|
ListEmptyComponent={<Text>No conversations found</Text>}
|
|
24
|
-
ListHeaderComponent={<Text style={styles.foo}>Conversations</Text>}
|
|
25
41
|
renderItem={({ item }) => (
|
|
26
42
|
<Pressable
|
|
27
43
|
onPress={() =>
|
|
@@ -31,9 +47,15 @@ export const Conversations = () => {
|
|
|
31
47
|
})
|
|
32
48
|
}
|
|
33
49
|
>
|
|
34
|
-
<
|
|
50
|
+
<Heading numberOfLines={1} variant="h3">
|
|
51
|
+
{item.title}
|
|
52
|
+
</Heading>
|
|
53
|
+
<Text style={styles.listItem}>
|
|
54
|
+
{item.lastMessageAuthorName}: {item.lastMessageTextPreview}
|
|
55
|
+
</Text>
|
|
35
56
|
</Pressable>
|
|
36
57
|
)}
|
|
58
|
+
onEndReached={() => fetchNextPage()}
|
|
37
59
|
/>
|
|
38
60
|
)
|
|
39
61
|
}
|