@robylon/react-native-sdk 2.0.19-staging.9 → 2.0.21-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/lib/commonjs/ChatbotWebview.js +1 -1
  2. package/lib/commonjs/ChatbotWebview.js.map +1 -1
  3. package/lib/commonjs/Chatbotsdk.js +69 -2
  4. package/lib/commonjs/Chatbotsdk.js.map +1 -1
  5. package/lib/commonjs/FloatingButton.js +1 -1
  6. package/lib/commonjs/FloatingButton.js.map +1 -1
  7. package/lib/commonjs/Toast.js +1 -1
  8. package/lib/commonjs/Toast.js.map +1 -1
  9. package/lib/commonjs/constants.js +1 -1
  10. package/lib/commonjs/constants.js.map +1 -1
  11. package/lib/commonjs/openChatbot.js +2 -1
  12. package/lib/commonjs/openChatbot.js.map +1 -1
  13. package/lib/commonjs/version.js +1 -1
  14. package/lib/commonjs/versions/version.dev.js +1 -1
  15. package/lib/commonjs/versions/version.dev.js.map +1 -1
  16. package/lib/commonjs/versions/version.staging.js +1 -1
  17. package/lib/commonjs/versions/version.staging.js.map +1 -1
  18. package/lib/module/ChatbotWebview.js +1 -1
  19. package/lib/module/ChatbotWebview.js.map +1 -1
  20. package/lib/module/Chatbotsdk.js +69 -2
  21. package/lib/module/Chatbotsdk.js.map +1 -1
  22. package/lib/module/FloatingButton.js +1 -1
  23. package/lib/module/FloatingButton.js.map +1 -1
  24. package/lib/module/Toast.js +1 -1
  25. package/lib/module/Toast.js.map +1 -1
  26. package/lib/module/constants.js +1 -1
  27. package/lib/module/constants.js.map +1 -1
  28. package/lib/module/version.js +1 -1
  29. package/lib/module/versions/version.dev.js +1 -1
  30. package/lib/module/versions/version.dev.js.map +1 -1
  31. package/lib/module/versions/version.staging.js +1 -1
  32. package/lib/module/versions/version.staging.js.map +1 -1
  33. package/lib/typescript/Chatbotsdk.d.ts +40 -0
  34. package/lib/typescript/Chatbotsdk.d.ts.map +1 -1
  35. package/lib/typescript/FloatingButton.d.ts +1 -0
  36. package/lib/typescript/FloatingButton.d.ts.map +1 -1
  37. package/lib/typescript/version.d.ts +1 -1
  38. package/lib/typescript/version.d.ts.map +1 -1
  39. package/lib/typescript/versions/version.dev.d.ts +1 -1
  40. package/lib/typescript/versions/version.dev.d.ts.map +1 -1
  41. package/lib/typescript/versions/version.staging.d.ts +1 -1
  42. package/lib/typescript/versions/version.staging.d.ts.map +1 -1
  43. package/package.json +2 -2
  44. package/usage/react-native-ios-docs.md +185 -0
  45. package/.npmignore.development +0 -18
  46. package/.npmignore.production +0 -8
  47. package/.npmignore.staging +0 -7
  48. package/babel.config.js +0 -17
  49. package/scripts/create-branch.js +0 -560
  50. package/scripts/create-version-tag.js +0 -29
  51. package/scripts/get-next-version.js +0 -29
  52. package/scripts/husky-setup.js +0 -32
  53. package/scripts/prevent-direct-branch.js +0 -37
  54. package/scripts/publish-version.js +0 -13
  55. package/scripts/release.js +0 -77
  56. package/scripts/setup-git-hooks.js +0 -18
  57. package/scripts/update-version.js +0 -28
  58. package/scripts/validate-branch-name.sh +0 -65
  59. package/scripts/validate-publish.js +0 -71
  60. package/src/ChatbotWebview.tsx +0 -44
  61. package/src/Chatbotsdk.tsx +0 -679
  62. package/src/FloatingButton.tsx +0 -74
  63. package/src/LoadingIndicator.tsx +0 -11
  64. package/src/Toast.tsx +0 -65
  65. package/src/components/DebugButton.tsx +0 -46
  66. package/src/components/ErrorBoundary.tsx +0 -38
  67. package/src/config.ts +0 -4
  68. package/src/constants/errorConstants.ts +0 -21
  69. package/src/constants.ts +0 -4
  70. package/src/global.d.ts +0 -11
  71. package/src/hooks/useChatbotEvents.ts +0 -93
  72. package/src/index.tsx +0 -10
  73. package/src/openChatbot.ts +0 -11
  74. package/src/openChatbot.tsx +0 -0
  75. package/src/services/ErrorTrackingService.ts +0 -217
  76. package/src/types/events.ts +0 -25
  77. package/src/types/react-native-flipper-performance-plugin.d.ts +0 -3
  78. package/src/types/react-native-globals.d.ts +0 -10
  79. package/src/utils/cookieUtils.ts +0 -7
  80. package/src/utils/debugConfig.ts +0 -56
  81. package/src/utils/debugMenu.ts +0 -14
  82. package/src/utils/errorHandler.ts +0 -58
  83. package/src/utils/logger.ts +0 -14
  84. package/src/utils/systemInfo.ts +0 -84
  85. package/src/utils/webViewStorage.ts +0 -62
  86. package/src/version.ts +0 -2
  87. package/src/versions/version.dev.ts +0 -2
  88. package/src/versions/version.production.ts +0 -2
  89. package/src/versions/version.staging.ts +0 -2
  90. package/tsconfig.build.json +0 -16
  91. package/tsconfig.json +0 -26
@@ -1,13 +0,0 @@
1
- const { execSync } = require("child_process");
2
-
3
- // Get current branch name
4
- const branch = execSync("git rev-parse --abbrev-ref HEAD").toString().trim();
5
-
6
- // If we're on a release branch, don't increment version
7
- if (branch.startsWith("release/v")) {
8
- console.log("On release branch - skipping version increment");
9
- process.exit(0);
10
- } else {
11
- // For other branches, increment patch version
12
- execSync("npm version patch", { stdio: "inherit" });
13
- }
@@ -1,77 +0,0 @@
1
- const { execSync } = require("child_process");
2
- const readline = require("readline");
3
-
4
- const rl = readline.createInterface({
5
- input: process.stdin,
6
- output: process.stdout,
7
- });
8
-
9
- const release = async () => {
10
- try {
11
- // 1. Validate current branch is a release branch
12
- const currentBranch = execSync("git rev-parse --abbrev-ref HEAD")
13
- .toString()
14
- .trim();
15
-
16
- if (!currentBranch.startsWith("release/v")) {
17
- throw new Error(
18
- "Release process must be started from a release branch.\n" +
19
- `Current branch: ${currentBranch}\n` +
20
- "Expected format: release/v{version}"
21
- );
22
- }
23
-
24
- // 2. Check if version is already published
25
- const version = currentBranch.split("/v")[1];
26
- const publishedVersions = execSync(
27
- "npm view @robylon/web-react-sdk versions --json"
28
- ).toString();
29
-
30
- if (publishedVersions.includes(version)) {
31
- throw new Error(
32
- `Version ${version} is already published to npm.\n` +
33
- "Please create a new release branch with a different version."
34
- );
35
- }
36
-
37
- // 3. Confirm release process
38
- console.log("\n📦 Starting release process for version", version);
39
- console.log("\nThis will:");
40
- console.log("1. Publish to npm");
41
- console.log("2. Create git tag");
42
- console.log("3. Merge to main");
43
-
44
- const proceed = await new Promise((resolve) =>
45
- rl.question("\nProceed with release? (y/N): ", resolve)
46
- );
47
-
48
- if (proceed.toLowerCase() !== "y") {
49
- throw new Error("Release cancelled by user");
50
- }
51
-
52
- // 4. Run publish
53
- console.log("\n🚀 Publishing to npm...");
54
- execSync("npm run publish:production", { stdio: "inherit" });
55
-
56
- // 5. Merge to main
57
- console.log("\n🔄 Merging to main...");
58
- execSync("git checkout main");
59
- execSync("git pull origin main");
60
- execSync(
61
- `git merge ${currentBranch} --no-ff -m "chore: release version ${version}"`
62
- );
63
- execSync("git push origin main");
64
-
65
- console.log("\n✅ Release completed successfully!");
66
- console.log(`Version ${version} is now available on npm`);
67
- console.log("Changes have been merged to main");
68
- } catch (error) {
69
- console.error("\n❌ Release failed:");
70
- console.error(error.message);
71
- process.exit(1);
72
- } finally {
73
- rl.close();
74
- }
75
- };
76
-
77
- release();
@@ -1,18 +0,0 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
- const { execSync } = require("child_process");
4
-
5
- // Create .git/hooks directory if it doesn't exist
6
- const hooksDir = path.join(__dirname, "../.git/hooks");
7
- if (!fs.existsSync(hooksDir)) {
8
- fs.mkdirSync(hooksDir, { recursive: true });
9
- }
10
-
11
- // Copy the validate-branch-name script
12
- const sourcePath = path.join(__dirname, "validate-branch-name.sh");
13
- const targetPath = path.join(hooksDir, "commit-msg");
14
-
15
- fs.copyFileSync(sourcePath, targetPath);
16
- fs.chmodSync(targetPath, "755");
17
-
18
- console.log("Git hooks installed successfully!");
@@ -1,28 +0,0 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
-
4
- function updateVersion(env) {
5
- const packageJson = require("../package.json");
6
- const version = packageJson.version;
7
-
8
- const content = `// This file is auto-generated. Do not modify it manually.
9
- export const SDK_VERSION = '${version}';\n`;
10
-
11
- const versionFile = path.join(__dirname, `../src/versions/version.${env}.ts`);
12
- fs.writeFileSync(versionFile, content);
13
-
14
- // Create/update the main version file that imports the correct version
15
- const mainVersionContent = `// This file is auto-generated. Do not modify it manually.
16
- export { SDK_VERSION } from './versions/version.${env}';\n`;
17
-
18
- fs.writeFileSync(
19
- path.join(__dirname, "../src/version.ts"),
20
- mainVersionContent
21
- );
22
-
23
- console.log(`Updated ${env} SDK_VERSION to ${version}`);
24
- }
25
-
26
- // Get environment from command line argument or default to 'staging'
27
- const env = process.argv[2] || "staging";
28
- updateVersion(env);
@@ -1,65 +0,0 @@
1
- #!/bin/bash
2
-
3
- echo "DEBUG: Script executed from: $0"
4
- echo "DEBUG: PWD: $(pwd)"
5
-
6
- # Get the full version including staging suffix if present
7
- FULL_VERSION=$(node -p "require('./package.json').version")
8
-
9
- # Check if this is a staging version before any other operations
10
- if [[ $FULL_VERSION == *"-staging."* ]]; then
11
- echo "Staging version detected. Skipping branch name validation."
12
- exit 0
13
- fi
14
-
15
- # Get base version without pre-release tags (e.g., 1.1.14 from 1.1.14-staging.0)
16
- BASE_VERSION=$(echo $FULL_VERSION | cut -d'-' -f1)
17
-
18
- # Get the branch name
19
- BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
20
-
21
- # Get latest published version from npm
22
- LATEST_VERSION=$(npm view @robylon/web-react-sdk version 2>/dev/null || echo "0.0.0")
23
-
24
- # Regular expression for valid branch names
25
- FEATURE_PATTERN="^feature/v[0-9]+\.[0-9]+\.[0-9]+/[a-z0-9-]+$"
26
- RELEASE_PATTERN="^release/v${BASE_VERSION}$"
27
- HOTFIX_PATTERN="^hotfix/v[0-9]+\.[0-9]+\.[0-9]+(-patch\.[0-9]+)?$"
28
-
29
- echo "Validating branch: $BRANCH_NAME"
30
- echo "Current version: $BASE_VERSION"
31
- echo "Latest published version: $LATEST_VERSION"
32
-
33
- # For release branches, ensure version matches branch exactly
34
- if [[ $BRANCH_NAME =~ ^release/v ]]; then
35
- # Extract version from branch name
36
- BRANCH_VERSION=$(echo $BRANCH_NAME | sed 's/release\/v//')
37
-
38
- # Check if branch version matches package version
39
- if [[ "$BRANCH_VERSION" != "$BASE_VERSION" ]]; then
40
- echo "Error: Release branch version ($BRANCH_VERSION) must match package.json version ($BASE_VERSION)"
41
- exit 1
42
- fi
43
-
44
- # Check if trying to publish a version behind latest
45
- if [[ $(node -p "require('semver').lt('$BASE_VERSION', '$LATEST_VERSION')") == "true" ]]; then
46
- echo "Error: Cannot publish version $BASE_VERSION as it is behind the latest published version $LATEST_VERSION"
47
- exit 1
48
- fi
49
-
50
- echo "✅ Valid release branch name and version"
51
- exit 0
52
- fi
53
-
54
- # Validate other branch types
55
- if [[ $BRANCH_NAME =~ $FEATURE_PATTERN ]] || [[ $BRANCH_NAME =~ $HOTFIX_PATTERN ]]; then
56
- echo "✅ Valid branch name"
57
- exit 0
58
- else
59
- echo "Error: Invalid branch name format."
60
- echo "Branch names must follow these formats:"
61
- echo "- For feature branches: feature/v{version}/{feature-name}"
62
- echo "- For release branches: release/v{version}"
63
- echo "- For hotfix branches: hotfix/v{version}-patch.{number}"
64
- exit 1
65
- fi
@@ -1,71 +0,0 @@
1
- const { execSync } = require("child_process");
2
-
3
- const validatePublish = (type) => {
4
- try {
5
- // Get current branch
6
- const currentBranch = execSync("git rev-parse --abbrev-ref HEAD")
7
- .toString()
8
- .trim();
9
-
10
- // Get version from package.json
11
- const { version } = require("../package.json");
12
- const baseVersion = version.split("-")[0];
13
-
14
- switch (type) {
15
- case "production":
16
- if (!currentBranch.startsWith("release/v")) {
17
- throw new Error(
18
- "Production publishing is only allowed from release branches.\n" +
19
- "Current branch: " +
20
- currentBranch +
21
- "\n" +
22
- "Expected format: release/v{version}"
23
- );
24
- }
25
-
26
- // Verify release branch version matches package version
27
- const releaseBranchVersion = currentBranch.split("/v")[1];
28
- if (releaseBranchVersion !== baseVersion) {
29
- throw new Error(
30
- "Release branch version does not match package.json version.\n" +
31
- `Branch version: ${releaseBranchVersion}\n` +
32
- `Package version: ${baseVersion}\n` +
33
- "Please update package.json version to match the release branch"
34
- );
35
- }
36
- break;
37
-
38
- case "hotfix":
39
- if (!currentBranch.startsWith("hotfix/v")) {
40
- throw new Error(
41
- "Hotfix publishing is only allowed from hotfix branches.\n" +
42
- "Current branch: " +
43
- currentBranch +
44
- "\n" +
45
- "Expected format: hotfix/v{version}-patch.{number}"
46
- );
47
- }
48
- break;
49
-
50
- case "staging":
51
- if (!currentBranch.startsWith("feature/v")) {
52
- throw new Error(
53
- "Staging publishing is only allowed from feature branches.\n" +
54
- "Current branch: " +
55
- currentBranch +
56
- "\n" +
57
- "Expected format: feature/v{version}/{feature-name}"
58
- );
59
- }
60
- break;
61
- }
62
- } catch (error) {
63
- console.error("\n❌ Publish validation failed:");
64
- console.error(error.message);
65
- process.exit(1);
66
- }
67
- };
68
-
69
- // Get publish type from command line argument
70
- const publishType = process.argv[2];
71
- validatePublish(publishType);
@@ -1,44 +0,0 @@
1
- // File: src/ChatbotWebview.tsx
2
- import React, { useEffect, useState } from "react";
3
- import { View } from "react-native";
4
- import { WebView } from "react-native-webview";
5
- import { BASE_CHATBOT_URL } from "./constants";
6
- import LoadingIndicator from "./LoadingIndicator";
7
-
8
- interface ChatbotWebviewProps {
9
- chatbotId: string;
10
- additionalParams?: Record<string, string>;
11
- }
12
-
13
- const constructUrl = (
14
- chatbotId: string,
15
- additionalParams: Record<string, string> = {}
16
- ): string => {
17
- const params = new URLSearchParams({ id: chatbotId, ...additionalParams });
18
- return `${BASE_CHATBOT_URL}?${params.toString()}`;
19
- };
20
-
21
- export const ChatbotWebview: React.FC<ChatbotWebviewProps> = ({
22
- chatbotId,
23
- additionalParams,
24
- }) => {
25
- const [url, setUrl] = useState<string>("");
26
-
27
- useEffect(() => {
28
- setUrl(constructUrl(chatbotId, additionalParams));
29
- }, [chatbotId, additionalParams]);
30
-
31
- return (
32
- <View style={{ flex: 1 }}>
33
- {url ? (
34
- <WebView
35
- source={{ uri: url }}
36
- startInLoadingState={true}
37
- renderLoading={() => <LoadingIndicator />}
38
- />
39
- ) : (
40
- <LoadingIndicator />
41
- )}
42
- </View>
43
- );
44
- };