@developer_tribe/react-native-comnyx 0.1.0 → 0.2.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/lib/commonjs/App.js +59 -0
- package/lib/commonjs/App.js.map +1 -0
- package/lib/commonjs/__dev__.js +29 -0
- package/lib/commonjs/__dev__.js.map +1 -0
- package/lib/commonjs/api/api.js +22 -0
- package/lib/commonjs/api/api.js.map +1 -0
- package/lib/commonjs/api/conversations.js +37 -0
- package/lib/commonjs/api/conversations.js.map +1 -0
- package/lib/commonjs/api/customers.js +15 -0
- package/lib/commonjs/api/customers.js.map +1 -0
- package/lib/commonjs/api/index.js +33 -0
- package/lib/commonjs/api/index.js.map +1 -0
- package/lib/commonjs/api/messages.js +27 -0
- package/lib/commonjs/api/messages.js.map +1 -0
- package/lib/commonjs/assets/clock.png +0 -0
- package/lib/commonjs/assets/double-check.png +0 -0
- package/lib/commonjs/assets/down.png +0 -0
- package/lib/commonjs/assets/send.png +0 -0
- package/lib/commonjs/components/AppText.js +38 -0
- package/lib/commonjs/components/AppText.js.map +1 -0
- package/lib/commonjs/components/ChatList.js +268 -0
- package/lib/commonjs/components/ChatList.js.map +1 -0
- package/lib/commonjs/components/CustomerForm.js +213 -0
- package/lib/commonjs/components/CustomerForm.js.map +1 -0
- package/lib/commonjs/components/EmptyList.js +40 -0
- package/lib/commonjs/components/EmptyList.js.map +1 -0
- package/lib/commonjs/components/InitFailed.js +51 -0
- package/lib/commonjs/components/InitFailed.js.map +1 -0
- package/lib/commonjs/components/MessageInput.js +119 -0
- package/lib/commonjs/components/MessageInput.js.map +1 -0
- package/lib/commonjs/components/MessageItem.js +117 -0
- package/lib/commonjs/components/MessageItem.js.map +1 -0
- package/lib/commonjs/constants/translations.js +219 -0
- package/lib/commonjs/constants/translations.js.map +1 -0
- package/lib/commonjs/data/fake/conversations.js +95 -0
- package/lib/commonjs/data/fake/conversations.js.map +1 -0
- package/lib/commonjs/data/fake/customers.js +24 -0
- package/lib/commonjs/data/fake/customers.js.map +1 -0
- package/lib/commonjs/data/fake/messages.js +67 -0
- package/lib/commonjs/data/fake/messages.js.map +1 -0
- package/lib/commonjs/hooks/useLocalize.js +20 -0
- package/lib/commonjs/hooks/useLocalize.js.map +1 -0
- package/lib/commonjs/hooks/usePolling.js +50 -0
- package/lib/commonjs/hooks/usePolling.js.map +1 -0
- package/lib/commonjs/hooks/useThemeColors.js +17 -0
- package/lib/commonjs/hooks/useThemeColors.js.map +1 -0
- package/lib/commonjs/index.js +15 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/register.js +21 -0
- package/lib/commonjs/register.js.map +1 -0
- package/lib/commonjs/store.js +79 -0
- package/lib/commonjs/store.js.map +1 -0
- package/lib/commonjs/types/ApiOptions.js +2 -0
- package/lib/commonjs/types/ApiOptions.js.map +1 -0
- package/lib/commonjs/types/Conversation.js +2 -0
- package/lib/commonjs/types/Conversation.js.map +1 -0
- package/lib/commonjs/types/Customer.js +2 -0
- package/lib/commonjs/types/Customer.js.map +1 -0
- package/lib/commonjs/types/Language.js +2 -0
- package/lib/commonjs/types/Language.js.map +1 -0
- package/lib/commonjs/types/LocalizationKeys.js +2 -0
- package/lib/commonjs/types/LocalizationKeys.js.map +1 -0
- package/lib/commonjs/types/MessageResponse.js +2 -0
- package/lib/commonjs/types/MessageResponse.js.map +1 -0
- package/lib/commonjs/types/Theme.js +29 -0
- package/lib/commonjs/types/Theme.js.map +1 -0
- package/lib/commonjs/utils/date.js +17 -0
- package/lib/commonjs/utils/date.js.map +1 -0
- package/lib/module/App.js +55 -0
- package/lib/module/App.js.map +1 -0
- package/lib/module/__dev__.js +29 -0
- package/lib/module/__dev__.js.map +1 -0
- package/lib/module/api/api.js +17 -0
- package/lib/module/api/api.js.map +1 -0
- package/lib/module/api/conversations.js +32 -0
- package/lib/module/api/conversations.js.map +1 -0
- package/lib/module/api/customers.js +11 -0
- package/lib/module/api/customers.js.map +1 -0
- package/lib/module/api/index.js +6 -0
- package/lib/module/api/index.js.map +1 -0
- package/lib/module/api/messages.js +23 -0
- package/lib/module/api/messages.js.map +1 -0
- package/lib/module/assets/clock.png +0 -0
- package/lib/module/assets/double-check.png +0 -0
- package/lib/module/assets/down.png +0 -0
- package/lib/module/assets/send.png +0 -0
- package/lib/module/components/AppText.js +34 -0
- package/lib/module/components/AppText.js.map +1 -0
- package/lib/module/components/ChatList.js +265 -0
- package/lib/module/components/ChatList.js.map +1 -0
- package/lib/module/components/CustomerForm.js +209 -0
- package/lib/module/components/CustomerForm.js.map +1 -0
- package/lib/module/components/EmptyList.js +36 -0
- package/lib/module/components/EmptyList.js.map +1 -0
- package/lib/module/components/InitFailed.js +47 -0
- package/lib/module/components/InitFailed.js.map +1 -0
- package/lib/module/components/MessageInput.js +115 -0
- package/lib/module/components/MessageInput.js.map +1 -0
- package/lib/module/components/MessageItem.js +114 -0
- package/lib/module/components/MessageItem.js.map +1 -0
- package/lib/module/constants/translations.js +215 -0
- package/lib/module/constants/translations.js.map +1 -0
- package/lib/module/data/fake/conversations.js +88 -0
- package/lib/module/data/fake/conversations.js.map +1 -0
- package/lib/module/data/fake/customers.js +20 -0
- package/lib/module/data/fake/customers.js.map +1 -0
- package/lib/module/data/fake/messages.js +63 -0
- package/lib/module/data/fake/messages.js.map +1 -0
- package/lib/module/hooks/useLocalize.js +16 -0
- package/lib/module/hooks/useLocalize.js.map +1 -0
- package/lib/module/hooks/usePolling.js +46 -0
- package/lib/module/hooks/usePolling.js.map +1 -0
- package/lib/module/hooks/useThemeColors.js +13 -0
- package/lib/module/hooks/useThemeColors.js.map +1 -0
- package/lib/module/index.js +3 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/register.js +17 -0
- package/lib/module/register.js.map +1 -0
- package/lib/module/store.js +74 -0
- package/lib/module/store.js.map +1 -0
- package/lib/module/types/ApiOptions.js +2 -0
- package/lib/module/types/ApiOptions.js.map +1 -0
- package/lib/module/types/Conversation.js +2 -0
- package/lib/module/types/Conversation.js.map +1 -0
- package/lib/module/types/Customer.js +2 -0
- package/lib/module/types/Customer.js.map +1 -0
- package/lib/module/types/Language.js +2 -0
- package/lib/module/types/Language.js.map +1 -0
- package/lib/module/types/LocalizationKeys.js +2 -0
- package/lib/module/types/LocalizationKeys.js.map +1 -0
- package/lib/module/types/MessageResponse.js +2 -0
- package/lib/module/types/MessageResponse.js.map +1 -0
- package/lib/module/types/Theme.js +25 -0
- package/lib/module/types/Theme.js.map +1 -0
- package/lib/module/utils/date.js +12 -0
- package/lib/module/utils/date.js.map +1 -0
- package/lib/typescript/commonjs/src/App.d.ts +9 -0
- package/lib/typescript/commonjs/src/App.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/__dev__.d.ts +2 -0
- package/lib/typescript/commonjs/src/__dev__.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/api/api.d.ts +4 -0
- package/lib/typescript/commonjs/src/api/api.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/api/conversations.d.ts +7 -0
- package/lib/typescript/commonjs/src/api/conversations.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/api/customers.d.ts +4 -0
- package/lib/typescript/commonjs/src/api/customers.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/api/index.d.ts +4 -0
- package/lib/typescript/commonjs/src/api/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/api/messages.d.ts +4 -0
- package/lib/typescript/commonjs/src/api/messages.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/AppText.d.ts +10 -0
- package/lib/typescript/commonjs/src/components/AppText.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/ChatList.d.ts +2 -0
- package/lib/typescript/commonjs/src/components/ChatList.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/CustomerForm.d.ts +2 -0
- package/lib/typescript/commonjs/src/components/CustomerForm.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/EmptyList.d.ts +2 -0
- package/lib/typescript/commonjs/src/components/EmptyList.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/InitFailed.d.ts +6 -0
- package/lib/typescript/commonjs/src/components/InitFailed.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/MessageInput.d.ts +4 -0
- package/lib/typescript/commonjs/src/components/MessageInput.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/components/MessageItem.d.ts +5 -0
- package/lib/typescript/commonjs/src/components/MessageItem.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/constants/translations.d.ts +4 -0
- package/lib/typescript/commonjs/src/constants/translations.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/data/fake/conversations.d.ts +5 -0
- package/lib/typescript/commonjs/src/data/fake/conversations.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/data/fake/customers.d.ts +3 -0
- package/lib/typescript/commonjs/src/data/fake/customers.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/data/fake/messages.d.ts +3 -0
- package/lib/typescript/commonjs/src/data/fake/messages.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/useLocalize.d.ts +3 -0
- package/lib/typescript/commonjs/src/hooks/useLocalize.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/usePolling.d.ts +2 -0
- package/lib/typescript/commonjs/src/hooks/usePolling.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/hooks/useThemeColors.d.ts +3 -0
- package/lib/typescript/commonjs/src/hooks/useThemeColors.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +4 -1
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/register.d.ts +5 -0
- package/lib/typescript/commonjs/src/register.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/store.d.ts +35 -0
- package/lib/typescript/commonjs/src/store.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/ApiOptions.d.ts +4 -0
- package/lib/typescript/commonjs/src/types/ApiOptions.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/Conversation.d.ts +26 -0
- package/lib/typescript/commonjs/src/types/Conversation.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/Customer.d.ts +30 -0
- package/lib/typescript/commonjs/src/types/Customer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/Language.d.ts +2 -0
- package/lib/typescript/commonjs/src/types/Language.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/LocalizationKeys.d.ts +22 -0
- package/lib/typescript/commonjs/src/types/LocalizationKeys.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/MessageResponse.d.ts +59 -0
- package/lib/typescript/commonjs/src/types/MessageResponse.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/types/Theme.d.ts +18 -0
- package/lib/typescript/commonjs/src/types/Theme.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/date.d.ts +7 -0
- package/lib/typescript/commonjs/src/utils/date.d.ts.map +1 -0
- package/lib/typescript/module/src/App.d.ts +9 -0
- package/lib/typescript/module/src/App.d.ts.map +1 -0
- package/lib/typescript/module/src/__dev__.d.ts +2 -0
- package/lib/typescript/module/src/__dev__.d.ts.map +1 -0
- package/lib/typescript/module/src/api/api.d.ts +4 -0
- package/lib/typescript/module/src/api/api.d.ts.map +1 -0
- package/lib/typescript/module/src/api/conversations.d.ts +7 -0
- package/lib/typescript/module/src/api/conversations.d.ts.map +1 -0
- package/lib/typescript/module/src/api/customers.d.ts +4 -0
- package/lib/typescript/module/src/api/customers.d.ts.map +1 -0
- package/lib/typescript/module/src/api/index.d.ts +4 -0
- package/lib/typescript/module/src/api/index.d.ts.map +1 -0
- package/lib/typescript/module/src/api/messages.d.ts +4 -0
- package/lib/typescript/module/src/api/messages.d.ts.map +1 -0
- package/lib/typescript/module/src/components/AppText.d.ts +10 -0
- package/lib/typescript/module/src/components/AppText.d.ts.map +1 -0
- package/lib/typescript/module/src/components/ChatList.d.ts +2 -0
- package/lib/typescript/module/src/components/ChatList.d.ts.map +1 -0
- package/lib/typescript/module/src/components/CustomerForm.d.ts +2 -0
- package/lib/typescript/module/src/components/CustomerForm.d.ts.map +1 -0
- package/lib/typescript/module/src/components/EmptyList.d.ts +2 -0
- package/lib/typescript/module/src/components/EmptyList.d.ts.map +1 -0
- package/lib/typescript/module/src/components/InitFailed.d.ts +6 -0
- package/lib/typescript/module/src/components/InitFailed.d.ts.map +1 -0
- package/lib/typescript/module/src/components/MessageInput.d.ts +4 -0
- package/lib/typescript/module/src/components/MessageInput.d.ts.map +1 -0
- package/lib/typescript/module/src/components/MessageItem.d.ts +5 -0
- package/lib/typescript/module/src/components/MessageItem.d.ts.map +1 -0
- package/lib/typescript/module/src/constants/translations.d.ts +4 -0
- package/lib/typescript/module/src/constants/translations.d.ts.map +1 -0
- package/lib/typescript/module/src/data/fake/conversations.d.ts +5 -0
- package/lib/typescript/module/src/data/fake/conversations.d.ts.map +1 -0
- package/lib/typescript/module/src/data/fake/customers.d.ts +3 -0
- package/lib/typescript/module/src/data/fake/customers.d.ts.map +1 -0
- package/lib/typescript/module/src/data/fake/messages.d.ts +3 -0
- package/lib/typescript/module/src/data/fake/messages.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/useLocalize.d.ts +3 -0
- package/lib/typescript/module/src/hooks/useLocalize.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/usePolling.d.ts +2 -0
- package/lib/typescript/module/src/hooks/usePolling.d.ts.map +1 -0
- package/lib/typescript/module/src/hooks/useThemeColors.d.ts +3 -0
- package/lib/typescript/module/src/hooks/useThemeColors.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +4 -1
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/register.d.ts +5 -0
- package/lib/typescript/module/src/register.d.ts.map +1 -0
- package/lib/typescript/module/src/store.d.ts +35 -0
- package/lib/typescript/module/src/store.d.ts.map +1 -0
- package/lib/typescript/module/src/types/ApiOptions.d.ts +4 -0
- package/lib/typescript/module/src/types/ApiOptions.d.ts.map +1 -0
- package/lib/typescript/module/src/types/Conversation.d.ts +26 -0
- package/lib/typescript/module/src/types/Conversation.d.ts.map +1 -0
- package/lib/typescript/module/src/types/Customer.d.ts +30 -0
- package/lib/typescript/module/src/types/Customer.d.ts.map +1 -0
- package/lib/typescript/module/src/types/Language.d.ts +2 -0
- package/lib/typescript/module/src/types/Language.d.ts.map +1 -0
- package/lib/typescript/module/src/types/LocalizationKeys.d.ts +22 -0
- package/lib/typescript/module/src/types/LocalizationKeys.d.ts.map +1 -0
- package/lib/typescript/module/src/types/MessageResponse.d.ts +59 -0
- package/lib/typescript/module/src/types/MessageResponse.d.ts.map +1 -0
- package/lib/typescript/module/src/types/Theme.d.ts +18 -0
- package/lib/typescript/module/src/types/Theme.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/date.d.ts +7 -0
- package/lib/typescript/module/src/utils/date.d.ts.map +1 -0
- package/package.json +10 -2
- package/src/App.tsx +59 -0
- package/src/__dev__.ts +22 -0
- package/src/api/api.ts +16 -0
- package/src/api/conversations.ts +53 -0
- package/src/api/customers.ts +16 -0
- package/src/api/index.ts +6 -0
- package/src/api/messages.ts +33 -0
- package/src/assets/clock.png +0 -0
- package/src/assets/double-check.png +0 -0
- package/src/assets/down.png +0 -0
- package/src/assets/send.png +0 -0
- package/src/components/AppText.tsx +43 -0
- package/src/components/ChatList.tsx +305 -0
- package/src/components/CustomerForm.tsx +203 -0
- package/src/components/EmptyList.tsx +32 -0
- package/src/components/InitFailed.tsx +46 -0
- package/src/components/MessageInput.tsx +133 -0
- package/src/components/MessageItem.tsx +141 -0
- package/src/constants/translations.ts +232 -0
- package/src/data/fake/conversations.ts +558 -0
- package/src/data/fake/customers.ts +19 -0
- package/src/data/fake/messages.ts +64 -0
- package/src/hooks/useLocalize.ts +18 -0
- package/src/hooks/usePolling.ts +46 -0
- package/src/hooks/useThemeColors.ts +10 -0
- package/src/index.tsx +4 -5
- package/src/register.ts +17 -0
- package/src/store.ts +85 -0
- package/src/types/ApiOptions.ts +4 -0
- package/src/types/Conversation.ts +29 -0
- package/src/types/Customer.ts +31 -0
- package/src/types/Language.ts +11 -0
- package/src/types/LocalizationKeys.ts +21 -0
- package/src/types/MessageResponse.ts +58 -0
- package/src/types/Theme.ts +40 -0
- package/src/utils/date.ts +11 -0
- package/.editorconfig +0 -15
- package/.gitattributes +0 -3
- package/.github/ISSUE_TEMPLATE/bug_report.yml +0 -68
- package/.github/ISSUE_TEMPLATE/config.yml +0 -8
- package/.github/actions/setup/action.yml +0 -36
- package/.github/workflows/ci.yml +0 -165
- package/.gitignore +0 -86
- package/.idea/.gitignore +0 -8
- package/.idea/codeStyles/Project.xml +0 -59
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/comnyx-rn.iml +0 -12
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -71
- package/.nvmrc +0 -1
- package/.watchmanconfig +0 -1
- package/.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs +0 -541
- package/.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs +0 -28
- package/.yarn/releases/yarn-3.6.1.cjs +0 -874
- package/.yarnrc.yml +0 -10
- package/CODE_OF_CONDUCT.md +0 -133
- package/CONTRIBUTING.md +0 -130
- package/babel.config.js +0 -3
- package/example/.bundle/config +0 -2
- package/example/.watchmanconfig +0 -1
- package/example/Gemfile +0 -10
- package/example/README.md +0 -97
- package/example/android/app/build.gradle +0 -133
- package/example/android/app/debug.keystore +0 -0
- package/example/android/app/proguard-rules.pro +0 -10
- package/example/android/app/src/debug/AndroidManifest.xml +0 -9
- package/example/android/app/src/main/AndroidManifest.xml +0 -26
- package/example/android/app/src/main/java/comnyx/example/MainActivity.kt +0 -22
- package/example/android/app/src/main/java/comnyx/example/MainApplication.kt +0 -44
- package/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +0 -37
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/example/android/app/src/main/res/values/strings.xml +0 -3
- package/example/android/app/src/main/res/values/styles.xml +0 -9
- package/example/android/build.gradle +0 -21
- package/example/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/example/android/gradle/wrapper/gradle-wrapper.properties +0 -7
- package/example/android/gradle.properties +0 -39
- package/example/android/gradlew +0 -251
- package/example/android/gradlew.bat +0 -94
- package/example/android/settings.gradle +0 -6
- package/example/app.json +0 -4
- package/example/babel.config.js +0 -12
- package/example/index.js +0 -5
- package/example/ios/.xcode.env +0 -11
- package/example/ios/ComnyxExample/AppDelegate.swift +0 -30
- package/example/ios/ComnyxExample/Images.xcassets/AppIcon.appiconset/Contents.json +0 -53
- package/example/ios/ComnyxExample/Images.xcassets/Contents.json +0 -6
- package/example/ios/ComnyxExample/Info.plist +0 -52
- package/example/ios/ComnyxExample/LaunchScreen.storyboard +0 -47
- package/example/ios/ComnyxExample/PrivacyInfo.xcprivacy +0 -37
- package/example/ios/ComnyxExample.xcodeproj/project.pbxproj +0 -505
- package/example/ios/ComnyxExample.xcodeproj/xcshareddata/xcschemes/ComnyxExample.xcscheme +0 -88
- package/example/ios/Podfile +0 -43
- package/example/jest.config.js +0 -3
- package/example/metro.config.js +0 -18
- package/example/package.json +0 -31
- package/example/react-native.config.js +0 -21
- package/example/src/App.tsx +0 -20
- package/lefthook.yml +0 -14
- package/lib/typescript/commonjs/src/__tests__/index.test.d.ts +0 -1
- package/lib/typescript/commonjs/src/__tests__/index.test.d.ts.map +0 -1
- package/lib/typescript/module/src/__tests__/index.test.d.ts +0 -1
- package/lib/typescript/module/src/__tests__/index.test.d.ts.map +0 -1
- package/src/__tests__/index.test.tsx +0 -1
- package/tsconfig.build.json +0 -4
- package/tsconfig.json +0 -30
- package/turbo.json +0 -36
- package/yarn.lock +0 -9251
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useAppStore } from '../store';
|
|
3
|
+
import { getNewCustomerConversation } from '../api';
|
|
4
|
+
|
|
5
|
+
const NEW_MESSAGES_CHECK_INTERVAL = 10000;
|
|
6
|
+
|
|
7
|
+
export function usePolling() {
|
|
8
|
+
const { customer, data, setData } = useAppStore((s) => ({
|
|
9
|
+
customer: s.customer,
|
|
10
|
+
data: s.data,
|
|
11
|
+
setData: s.setData,
|
|
12
|
+
}));
|
|
13
|
+
const lastMessage = data ? data[data.length - 1] : null;
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const created_at = lastMessage?.created_at;
|
|
16
|
+
let interval: NodeJS.Timeout | null = null;
|
|
17
|
+
if (customer?.external_id && created_at) {
|
|
18
|
+
interval = setInterval(() => {
|
|
19
|
+
getNewCustomerConversation(customer.external_id, created_at, {
|
|
20
|
+
fake: useAppStore.getState().fake,
|
|
21
|
+
}).then((newData) => {
|
|
22
|
+
setData((prevData) => {
|
|
23
|
+
const newMessages = newData.page.data;
|
|
24
|
+
const existingIds = new Set(prevData?.map((msg) => msg.id));
|
|
25
|
+
const uniqueNewMessages = newMessages.filter(
|
|
26
|
+
(msg) => !existingIds.has(msg.id)
|
|
27
|
+
);
|
|
28
|
+
return [
|
|
29
|
+
...uniqueNewMessages.map((u) => ({
|
|
30
|
+
...u,
|
|
31
|
+
created_at: new Date(u.created_at),
|
|
32
|
+
approved: true,
|
|
33
|
+
})),
|
|
34
|
+
...(prevData ?? []),
|
|
35
|
+
];
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
}, NEW_MESSAGES_CHECK_INTERVAL);
|
|
39
|
+
}
|
|
40
|
+
return () => {
|
|
41
|
+
if (interval) {
|
|
42
|
+
clearInterval(interval);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}, [customer?.external_id, lastMessage?.created_at, setData]);
|
|
46
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useAppStore } from '../store';
|
|
2
|
+
import { lightTheme, darkTheme, type ThemeColors } from '../types/Theme';
|
|
3
|
+
|
|
4
|
+
export function useThemeColors(): ThemeColors {
|
|
5
|
+
const { theme } = useAppStore((s) => ({
|
|
6
|
+
theme: s.theme,
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
return theme === 'light' ? lightTheme : darkTheme;
|
|
10
|
+
}
|
package/src/index.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
}
|
|
1
|
+
import './__dev__';
|
|
2
|
+
export { registerComnyx } from './register';
|
|
3
|
+
export type { CreateCustomerRequest } from './types/Customer';
|
|
4
|
+
export { Comnyx } from './App';
|
package/src/register.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { initApi } from './api/api';
|
|
2
|
+
import { useAppStore } from './store';
|
|
3
|
+
|
|
4
|
+
export function registerComnyx(registerOptions: {
|
|
5
|
+
externalId: string;
|
|
6
|
+
token: string;
|
|
7
|
+
}) {
|
|
8
|
+
if (!registerOptions.externalId) {
|
|
9
|
+
throw new Error('External ID is required for initialization');
|
|
10
|
+
}
|
|
11
|
+
if (!registerOptions.token) {
|
|
12
|
+
throw new Error('Authentication token is required');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
initApi(registerOptions.token);
|
|
16
|
+
useAppStore.getState().init({ externalId: registerOptions.externalId });
|
|
17
|
+
}
|
package/src/store.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createJSONStorage, persist } from 'zustand/middleware';
|
|
2
|
+
import { shallow } from 'zustand/shallow';
|
|
3
|
+
import { createWithEqualityFn } from 'zustand/traditional';
|
|
4
|
+
import type { StateCreator } from 'zustand';
|
|
5
|
+
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
6
|
+
import type { Customer } from './types/Customer';
|
|
7
|
+
import type { AppConversationMessage } from './types/Conversation';
|
|
8
|
+
import type { LanguageCode } from './types/Language';
|
|
9
|
+
|
|
10
|
+
interface AppStoreState {
|
|
11
|
+
initialized: boolean;
|
|
12
|
+
customer: Customer | null;
|
|
13
|
+
data: AppConversationMessage[] | null;
|
|
14
|
+
externalId: string | null;
|
|
15
|
+
language: LanguageCode;
|
|
16
|
+
theme: 'light' | 'dark';
|
|
17
|
+
fake: boolean;
|
|
18
|
+
firstMessage: AppConversationMessage | null;
|
|
19
|
+
setData: (
|
|
20
|
+
cb: (
|
|
21
|
+
prevData: AppConversationMessage[] | null
|
|
22
|
+
) => AppConversationMessage[] | null
|
|
23
|
+
) => void;
|
|
24
|
+
setFirstMessage: (message: AppConversationMessage | null) => void;
|
|
25
|
+
init: ({ externalId }: { externalId: string }) => void;
|
|
26
|
+
initForm: (createCustomerResponse: Customer) => void;
|
|
27
|
+
setLanguage: (language: LanguageCode) => void;
|
|
28
|
+
setTheme: (theme: 'light' | 'dark') => void;
|
|
29
|
+
setFake: (fake: boolean) => void;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const storeCreator: StateCreator<AppStoreState> = (set, get) => ({
|
|
33
|
+
initialized: false,
|
|
34
|
+
customer: null,
|
|
35
|
+
data: null,
|
|
36
|
+
externalId: null,
|
|
37
|
+
language: 'en',
|
|
38
|
+
theme: 'light',
|
|
39
|
+
fake: false,
|
|
40
|
+
firstMessage: null,
|
|
41
|
+
setData: (cb) => {
|
|
42
|
+
const newData = cb(get().data);
|
|
43
|
+
set({ data: newData });
|
|
44
|
+
},
|
|
45
|
+
setFirstMessage: (message) => {
|
|
46
|
+
set({ firstMessage: message });
|
|
47
|
+
},
|
|
48
|
+
init: ({ externalId }: { externalId: string }) => {
|
|
49
|
+
set({ externalId: externalId, initialized: true });
|
|
50
|
+
},
|
|
51
|
+
initForm: (createCustomerResponse: Customer) => {
|
|
52
|
+
set({ customer: createCustomerResponse });
|
|
53
|
+
},
|
|
54
|
+
setLanguage: (language: LanguageCode) => {
|
|
55
|
+
set({ language });
|
|
56
|
+
},
|
|
57
|
+
setTheme: (theme: 'light' | 'dark') => {
|
|
58
|
+
set({ theme });
|
|
59
|
+
},
|
|
60
|
+
setFake: (fake: boolean) => {
|
|
61
|
+
set({ fake });
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export const useAppStore = createWithEqualityFn<AppStoreState>()(
|
|
66
|
+
persist(storeCreator, {
|
|
67
|
+
name: 'appStore-9',
|
|
68
|
+
storage: createJSONStorage(() => AsyncStorage),
|
|
69
|
+
skipHydration: false,
|
|
70
|
+
partialize: (state) => ({
|
|
71
|
+
customer: state.customer,
|
|
72
|
+
externalId: state.externalId,
|
|
73
|
+
data: [],
|
|
74
|
+
/* data: state.data
|
|
75
|
+
?.filter((message) => message.approved)
|
|
76
|
+
.map((message) => ({
|
|
77
|
+
...message,
|
|
78
|
+
created_at: message.created_at
|
|
79
|
+
? new Date(message.created_at)
|
|
80
|
+
: undefined,
|
|
81
|
+
})),*/
|
|
82
|
+
}),
|
|
83
|
+
}),
|
|
84
|
+
shallow
|
|
85
|
+
);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export interface ConversationMessage {
|
|
2
|
+
id: number;
|
|
3
|
+
content: string;
|
|
4
|
+
created_at: string;
|
|
5
|
+
user: any | null;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface AppConversationMessage
|
|
9
|
+
extends Omit<ConversationMessage, 'id' | 'created_at'> {
|
|
10
|
+
id: number | null;
|
|
11
|
+
approved?: boolean;
|
|
12
|
+
created_at: Date;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface ConversationPage {
|
|
16
|
+
current_page: number;
|
|
17
|
+
data: ConversationMessage[];
|
|
18
|
+
first_page_url: string;
|
|
19
|
+
from: number;
|
|
20
|
+
next_page_url: string | null;
|
|
21
|
+
path: string;
|
|
22
|
+
per_page: number; //TODO: backend string gönderiyor, number yapılabilir.
|
|
23
|
+
prev_page_url: string | null;
|
|
24
|
+
to: number;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ConversationResponse {
|
|
28
|
+
page: ConversationPage;
|
|
29
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface CustomParameter {
|
|
2
|
+
name: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface CreateCustomerRequest {
|
|
7
|
+
name: string;
|
|
8
|
+
country: string;
|
|
9
|
+
language: string;
|
|
10
|
+
externalId: string;
|
|
11
|
+
email: string;
|
|
12
|
+
phone: string;
|
|
13
|
+
ipAddress: string;
|
|
14
|
+
customParameters?: CustomParameter[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface Customer {
|
|
18
|
+
id: number;
|
|
19
|
+
project_id: number;
|
|
20
|
+
external_id: string;
|
|
21
|
+
name: string;
|
|
22
|
+
country: string;
|
|
23
|
+
language: string;
|
|
24
|
+
email: string;
|
|
25
|
+
phone: string;
|
|
26
|
+
ip_address: string;
|
|
27
|
+
custom_parameters: string;
|
|
28
|
+
user_code: string;
|
|
29
|
+
updated_at: string;
|
|
30
|
+
created_at: string;
|
|
31
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type LocalizationKeys = {
|
|
2
|
+
'customer.form.title': string;
|
|
3
|
+
'customer.form.email': string;
|
|
4
|
+
'customer.form.phone': string;
|
|
5
|
+
'customer.form.country': string;
|
|
6
|
+
'customer.form.submit': string;
|
|
7
|
+
'customer.form.error': string;
|
|
8
|
+
'customer.form.instructions': string;
|
|
9
|
+
'customer.form.error.country': string;
|
|
10
|
+
'customer.form.error.email': string;
|
|
11
|
+
'customer.form.error.phone': string;
|
|
12
|
+
'customer.form.placeholder.name': string;
|
|
13
|
+
'customer.form.placeholder.country': string;
|
|
14
|
+
'customer.form.placeholder.email': string;
|
|
15
|
+
'customer.form.placeholder.phone': string;
|
|
16
|
+
'chat.messageInput.placeholder': string;
|
|
17
|
+
'app.initialization.required': string;
|
|
18
|
+
'chat.load.error': string;
|
|
19
|
+
'chat.init.error': string;
|
|
20
|
+
'chat.empty': string;
|
|
21
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export interface MessageResponse {
|
|
2
|
+
message: {
|
|
3
|
+
conversation_id: number;
|
|
4
|
+
content: string;
|
|
5
|
+
is_note: boolean;
|
|
6
|
+
updated_at: string;
|
|
7
|
+
created_at: string;
|
|
8
|
+
id: number;
|
|
9
|
+
user: null | any;
|
|
10
|
+
conversation: {
|
|
11
|
+
id: number;
|
|
12
|
+
project_id: number;
|
|
13
|
+
customer_id: number;
|
|
14
|
+
created_at: string;
|
|
15
|
+
updated_at: string;
|
|
16
|
+
deleted_at: null | string;
|
|
17
|
+
language: string;
|
|
18
|
+
use_ai_answers: number;
|
|
19
|
+
project: {
|
|
20
|
+
id: number;
|
|
21
|
+
name: string;
|
|
22
|
+
organization_id: number;
|
|
23
|
+
created_at: string;
|
|
24
|
+
updated_at: string;
|
|
25
|
+
deleted_at: null | string;
|
|
26
|
+
uuid: string;
|
|
27
|
+
organization: {
|
|
28
|
+
id: number;
|
|
29
|
+
name: string;
|
|
30
|
+
created_at: string;
|
|
31
|
+
updated_at: string;
|
|
32
|
+
deleted_at: null | string;
|
|
33
|
+
owner: Array<{
|
|
34
|
+
id: number;
|
|
35
|
+
name: string;
|
|
36
|
+
email: string;
|
|
37
|
+
email_verified_at: null | string;
|
|
38
|
+
created_at: string;
|
|
39
|
+
updated_at: string;
|
|
40
|
+
avatar: null | string;
|
|
41
|
+
two_factor_secret: null | string;
|
|
42
|
+
two_factor_recovery_codes: null | string;
|
|
43
|
+
is_bot: boolean;
|
|
44
|
+
profile_photo_url: string;
|
|
45
|
+
pivot: {
|
|
46
|
+
organization_id: number;
|
|
47
|
+
user_id: number;
|
|
48
|
+
role: string;
|
|
49
|
+
created_at: string;
|
|
50
|
+
updated_at: string;
|
|
51
|
+
};
|
|
52
|
+
}>;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
events: any[];
|
|
57
|
+
};
|
|
58
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export interface ThemeColors {
|
|
2
|
+
primary: string;
|
|
3
|
+
secondary: string;
|
|
4
|
+
background: string;
|
|
5
|
+
text: string;
|
|
6
|
+
error: string;
|
|
7
|
+
success: string;
|
|
8
|
+
warning: string;
|
|
9
|
+
info: string;
|
|
10
|
+
border: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const lightTheme: ThemeColors = {
|
|
14
|
+
primary: '#4361EE',
|
|
15
|
+
secondary: '#3A0CA3',
|
|
16
|
+
background: '#FFFFFF',
|
|
17
|
+
text: '#212529',
|
|
18
|
+
error: '#FF3B30',
|
|
19
|
+
success: '#34C759',
|
|
20
|
+
warning: '#FF9500',
|
|
21
|
+
info: '#007AFF',
|
|
22
|
+
border: '#E9ECEF',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const darkTheme: ThemeColors = {
|
|
26
|
+
primary: '#4361EE',
|
|
27
|
+
secondary: '#3A0CA3',
|
|
28
|
+
background: '#121212',
|
|
29
|
+
text: '#FFFFFF',
|
|
30
|
+
error: '#FF453A',
|
|
31
|
+
success: '#32D74B',
|
|
32
|
+
warning: '#FF9F0A',
|
|
33
|
+
info: '#0A84FF',
|
|
34
|
+
border: '#2C2C2C',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export interface Theme {
|
|
38
|
+
light: ThemeColors;
|
|
39
|
+
dark: ThemeColors;
|
|
40
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a Date object to Unix timestamp (seconds)
|
|
3
|
+
* @param date - The Date object to convert
|
|
4
|
+
* @returns Unix timestamp in seconds, or undefined if date is undefined
|
|
5
|
+
*/
|
|
6
|
+
export const dateToUnixTimestamp = (
|
|
7
|
+
date: Date | undefined
|
|
8
|
+
): number | undefined => {
|
|
9
|
+
if (!date) return undefined;
|
|
10
|
+
return Math.floor(date.getTime() / 1000);
|
|
11
|
+
};
|
package/.editorconfig
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# EditorConfig helps developers define and maintain consistent
|
|
2
|
-
# coding styles between different editors and IDEs
|
|
3
|
-
# editorconfig.org
|
|
4
|
-
|
|
5
|
-
root = true
|
|
6
|
-
|
|
7
|
-
[*]
|
|
8
|
-
|
|
9
|
-
indent_style = space
|
|
10
|
-
indent_size = 2
|
|
11
|
-
|
|
12
|
-
end_of_line = lf
|
|
13
|
-
charset = utf-8
|
|
14
|
-
trim_trailing_whitespace = true
|
|
15
|
-
insert_final_newline = true
|
package/.gitattributes
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
name: 🐛 Bug report
|
|
2
|
-
description: Report a reproducible bug or regression in this library.
|
|
3
|
-
labels: [bug]
|
|
4
|
-
body:
|
|
5
|
-
- type: markdown
|
|
6
|
-
attributes:
|
|
7
|
-
value: |
|
|
8
|
-
# Bug report
|
|
9
|
-
|
|
10
|
-
👋 Hi!
|
|
11
|
-
|
|
12
|
-
**Please fill the following carefully before opening a new issue ❗**
|
|
13
|
-
*(Your issue may be closed if it doesn't provide the required pieces of information)*
|
|
14
|
-
- type: checkboxes
|
|
15
|
-
attributes:
|
|
16
|
-
label: Before submitting a new issue
|
|
17
|
-
description: Please perform simple checks first.
|
|
18
|
-
options:
|
|
19
|
-
- label: I tested using the latest version of the library, as the bug might be already fixed.
|
|
20
|
-
required: true
|
|
21
|
-
- label: I tested using a [supported version](https://github.com/reactwg/react-native-releases/blob/main/docs/support.md) of react native.
|
|
22
|
-
required: true
|
|
23
|
-
- label: I checked for possible duplicate issues, with possible answers.
|
|
24
|
-
required: true
|
|
25
|
-
- type: textarea
|
|
26
|
-
id: summary
|
|
27
|
-
attributes:
|
|
28
|
-
label: Bug summary
|
|
29
|
-
description: |
|
|
30
|
-
Provide a clear and concise description of what the bug is.
|
|
31
|
-
If needed, you can also provide other samples: error messages / stack traces, screenshots, gifs, etc.
|
|
32
|
-
validations:
|
|
33
|
-
required: true
|
|
34
|
-
- type: input
|
|
35
|
-
id: library-version
|
|
36
|
-
attributes:
|
|
37
|
-
label: Library version
|
|
38
|
-
description: What version of the library are you using?
|
|
39
|
-
placeholder: "x.x.x"
|
|
40
|
-
validations:
|
|
41
|
-
required: true
|
|
42
|
-
- type: textarea
|
|
43
|
-
id: react-native-info
|
|
44
|
-
attributes:
|
|
45
|
-
label: Environment info
|
|
46
|
-
description: Run `react-native info` in your terminal and paste the results here.
|
|
47
|
-
render: shell
|
|
48
|
-
validations:
|
|
49
|
-
required: true
|
|
50
|
-
- type: textarea
|
|
51
|
-
id: steps-to-reproduce
|
|
52
|
-
attributes:
|
|
53
|
-
label: Steps to reproduce
|
|
54
|
-
description: |
|
|
55
|
-
You must provide a clear list of steps and code to reproduce the problem.
|
|
56
|
-
value: |
|
|
57
|
-
1. …
|
|
58
|
-
2. …
|
|
59
|
-
validations:
|
|
60
|
-
required: true
|
|
61
|
-
- type: input
|
|
62
|
-
id: reproducible-example
|
|
63
|
-
attributes:
|
|
64
|
-
label: Reproducible example repository
|
|
65
|
-
description: Please provide a link to a repository on GitHub with a reproducible example.
|
|
66
|
-
render: js
|
|
67
|
-
validations:
|
|
68
|
-
required: true
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
blank_issues_enabled: false
|
|
2
|
-
contact_links:
|
|
3
|
-
- name: Feature Request 💡
|
|
4
|
-
url: https://www.npmjs.com/discussions/new?category=ideas
|
|
5
|
-
about: If you have a feature request, please create a new discussion on GitHub.
|
|
6
|
-
- name: Discussions on GitHub 💬
|
|
7
|
-
url: https://www.npmjs.com/discussions
|
|
8
|
-
about: If this library works as promised but you need help, please ask questions there.
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
name: Setup
|
|
2
|
-
description: Setup Node.js and install dependencies
|
|
3
|
-
|
|
4
|
-
runs:
|
|
5
|
-
using: composite
|
|
6
|
-
steps:
|
|
7
|
-
- name: Setup Node.js
|
|
8
|
-
uses: actions/setup-node@v4
|
|
9
|
-
with:
|
|
10
|
-
node-version-file: .nvmrc
|
|
11
|
-
|
|
12
|
-
- name: Restore dependencies
|
|
13
|
-
id: yarn-cache
|
|
14
|
-
uses: actions/cache/restore@v4
|
|
15
|
-
with:
|
|
16
|
-
path: |
|
|
17
|
-
**/node_modules
|
|
18
|
-
.yarn/install-state.gz
|
|
19
|
-
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
|
|
20
|
-
restore-keys: |
|
|
21
|
-
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
|
|
22
|
-
${{ runner.os }}-yarn-
|
|
23
|
-
|
|
24
|
-
- name: Install dependencies
|
|
25
|
-
if: steps.yarn-cache.outputs.cache-hit != 'true'
|
|
26
|
-
run: yarn install --immutable
|
|
27
|
-
shell: bash
|
|
28
|
-
|
|
29
|
-
- name: Cache dependencies
|
|
30
|
-
if: steps.yarn-cache.outputs.cache-hit != 'true'
|
|
31
|
-
uses: actions/cache/save@v4
|
|
32
|
-
with:
|
|
33
|
-
path: |
|
|
34
|
-
**/node_modules
|
|
35
|
-
.yarn/install-state.gz
|
|
36
|
-
key: ${{ steps.yarn-cache.outputs.cache-primary-key }}
|
package/.github/workflows/ci.yml
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches:
|
|
5
|
-
- main
|
|
6
|
-
pull_request:
|
|
7
|
-
branches:
|
|
8
|
-
- main
|
|
9
|
-
merge_group:
|
|
10
|
-
types:
|
|
11
|
-
- checks_requested
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
lint:
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
steps:
|
|
17
|
-
- name: Checkout
|
|
18
|
-
uses: actions/checkout@v4
|
|
19
|
-
|
|
20
|
-
- name: Setup
|
|
21
|
-
uses: ./.github/actions/setup
|
|
22
|
-
|
|
23
|
-
- name: Lint files
|
|
24
|
-
run: yarn lint
|
|
25
|
-
|
|
26
|
-
- name: Typecheck files
|
|
27
|
-
run: yarn typecheck
|
|
28
|
-
|
|
29
|
-
test:
|
|
30
|
-
runs-on: ubuntu-latest
|
|
31
|
-
steps:
|
|
32
|
-
- name: Checkout
|
|
33
|
-
uses: actions/checkout@v4
|
|
34
|
-
|
|
35
|
-
- name: Setup
|
|
36
|
-
uses: ./.github/actions/setup
|
|
37
|
-
|
|
38
|
-
- name: Run unit tests
|
|
39
|
-
run: yarn test --maxWorkers=2 --coverage
|
|
40
|
-
|
|
41
|
-
build-library:
|
|
42
|
-
runs-on: ubuntu-latest
|
|
43
|
-
steps:
|
|
44
|
-
- name: Checkout
|
|
45
|
-
uses: actions/checkout@v4
|
|
46
|
-
|
|
47
|
-
- name: Setup
|
|
48
|
-
uses: ./.github/actions/setup
|
|
49
|
-
|
|
50
|
-
- name: Build package
|
|
51
|
-
run: yarn prepare
|
|
52
|
-
|
|
53
|
-
build-android:
|
|
54
|
-
runs-on: ubuntu-latest
|
|
55
|
-
env:
|
|
56
|
-
TURBO_CACHE_DIR: .turbo/android
|
|
57
|
-
steps:
|
|
58
|
-
- name: Checkout
|
|
59
|
-
uses: actions/checkout@v4
|
|
60
|
-
|
|
61
|
-
- name: Setup
|
|
62
|
-
uses: ./.github/actions/setup
|
|
63
|
-
|
|
64
|
-
- name: Cache turborepo for Android
|
|
65
|
-
uses: actions/cache@v4
|
|
66
|
-
with:
|
|
67
|
-
path: ${{ env.TURBO_CACHE_DIR }}
|
|
68
|
-
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
|
|
69
|
-
restore-keys: |
|
|
70
|
-
${{ runner.os }}-turborepo-android-
|
|
71
|
-
|
|
72
|
-
- name: Check turborepo cache for Android
|
|
73
|
-
run: |
|
|
74
|
-
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")
|
|
75
|
-
|
|
76
|
-
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
|
|
77
|
-
echo "turbo_cache_hit=1" >> $GITHUB_ENV
|
|
78
|
-
fi
|
|
79
|
-
|
|
80
|
-
- name: Install JDK
|
|
81
|
-
if: env.turbo_cache_hit != 1
|
|
82
|
-
uses: actions/setup-java@v4
|
|
83
|
-
with:
|
|
84
|
-
distribution: 'zulu'
|
|
85
|
-
java-version: '17'
|
|
86
|
-
|
|
87
|
-
- name: Finalize Android SDK
|
|
88
|
-
if: env.turbo_cache_hit != 1
|
|
89
|
-
run: |
|
|
90
|
-
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
|
|
91
|
-
|
|
92
|
-
- name: Cache Gradle
|
|
93
|
-
if: env.turbo_cache_hit != 1
|
|
94
|
-
uses: actions/cache@v4
|
|
95
|
-
with:
|
|
96
|
-
path: |
|
|
97
|
-
~/.gradle/wrapper
|
|
98
|
-
~/.gradle/caches
|
|
99
|
-
key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
|
|
100
|
-
restore-keys: |
|
|
101
|
-
${{ runner.os }}-gradle-
|
|
102
|
-
|
|
103
|
-
- name: Build example for Android
|
|
104
|
-
env:
|
|
105
|
-
JAVA_OPTS: "-XX:MaxHeapSize=6g"
|
|
106
|
-
run: |
|
|
107
|
-
yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
|
|
108
|
-
|
|
109
|
-
build-ios:
|
|
110
|
-
runs-on: macos-latest
|
|
111
|
-
env:
|
|
112
|
-
TURBO_CACHE_DIR: .turbo/ios
|
|
113
|
-
steps:
|
|
114
|
-
- name: Checkout
|
|
115
|
-
uses: actions/checkout@v4
|
|
116
|
-
|
|
117
|
-
- name: Setup
|
|
118
|
-
uses: ./.github/actions/setup
|
|
119
|
-
|
|
120
|
-
- name: Cache turborepo for iOS
|
|
121
|
-
uses: actions/cache@v4
|
|
122
|
-
with:
|
|
123
|
-
path: ${{ env.TURBO_CACHE_DIR }}
|
|
124
|
-
key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }}
|
|
125
|
-
restore-keys: |
|
|
126
|
-
${{ runner.os }}-turborepo-ios-
|
|
127
|
-
|
|
128
|
-
- name: Check turborepo cache for iOS
|
|
129
|
-
run: |
|
|
130
|
-
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status")
|
|
131
|
-
|
|
132
|
-
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
|
|
133
|
-
echo "turbo_cache_hit=1" >> $GITHUB_ENV
|
|
134
|
-
fi
|
|
135
|
-
|
|
136
|
-
- name: Restore cocoapods
|
|
137
|
-
if: env.turbo_cache_hit != 1
|
|
138
|
-
id: cocoapods-cache
|
|
139
|
-
uses: actions/cache/restore@v4
|
|
140
|
-
with:
|
|
141
|
-
path: |
|
|
142
|
-
**/ios/Pods
|
|
143
|
-
key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }}
|
|
144
|
-
restore-keys: |
|
|
145
|
-
${{ runner.os }}-cocoapods-
|
|
146
|
-
|
|
147
|
-
- name: Install cocoapods
|
|
148
|
-
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
|
|
149
|
-
run: |
|
|
150
|
-
cd example/ios
|
|
151
|
-
pod install
|
|
152
|
-
env:
|
|
153
|
-
NO_FLIPPER: 1
|
|
154
|
-
|
|
155
|
-
- name: Cache cocoapods
|
|
156
|
-
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
|
|
157
|
-
uses: actions/cache/save@v4
|
|
158
|
-
with:
|
|
159
|
-
path: |
|
|
160
|
-
**/ios/Pods
|
|
161
|
-
key: ${{ steps.cocoapods-cache.outputs.cache-key }}
|
|
162
|
-
|
|
163
|
-
- name: Build example for iOS
|
|
164
|
-
run: |
|
|
165
|
-
yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"
|