@robylon/react-native-sdk 2.0.19-staging.9 → 2.0.20

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 (58) hide show
  1. package/lib/commonjs/Chatbotsdk.js +68 -1
  2. package/lib/commonjs/Chatbotsdk.js.map +1 -1
  3. package/lib/commonjs/FloatingButton.js +1 -1
  4. package/lib/commonjs/FloatingButton.js.map +1 -1
  5. package/lib/commonjs/config.js +1 -1
  6. package/lib/commonjs/config.js.map +1 -1
  7. package/lib/commonjs/constants.js +1 -1
  8. package/lib/commonjs/constants.js.map +1 -1
  9. package/lib/commonjs/versions/version.staging.js +1 -1
  10. package/lib/commonjs/versions/version.staging.js.map +1 -1
  11. package/lib/module/Chatbotsdk.js +68 -1
  12. package/lib/module/Chatbotsdk.js.map +1 -1
  13. package/lib/module/FloatingButton.js +1 -1
  14. package/lib/module/FloatingButton.js.map +1 -1
  15. package/lib/module/config.js +1 -1
  16. package/lib/module/config.js.map +1 -1
  17. package/lib/module/constants.js +1 -1
  18. package/lib/module/constants.js.map +1 -1
  19. package/lib/module/versions/version.staging.js +1 -1
  20. package/lib/module/versions/version.staging.js.map +1 -1
  21. package/lib/typescript/Chatbotsdk.d.ts.map +1 -1
  22. package/lib/typescript/FloatingButton.d.ts +1 -0
  23. package/lib/typescript/FloatingButton.d.ts.map +1 -1
  24. package/lib/typescript/versions/version.staging.d.ts +1 -1
  25. package/lib/typescript/versions/version.staging.d.ts.map +1 -1
  26. package/package.json +2 -2
  27. package/scripts/create-branch.js +39 -22
  28. package/scripts/validate-publish.js +30 -53
  29. package/src/ChatbotWebview.tsx +0 -44
  30. package/src/Chatbotsdk.tsx +0 -679
  31. package/src/FloatingButton.tsx +0 -74
  32. package/src/LoadingIndicator.tsx +0 -11
  33. package/src/Toast.tsx +0 -65
  34. package/src/components/DebugButton.tsx +0 -46
  35. package/src/components/ErrorBoundary.tsx +0 -38
  36. package/src/config.ts +0 -4
  37. package/src/constants/errorConstants.ts +0 -21
  38. package/src/constants.ts +0 -4
  39. package/src/global.d.ts +0 -11
  40. package/src/hooks/useChatbotEvents.ts +0 -93
  41. package/src/index.tsx +0 -10
  42. package/src/openChatbot.ts +0 -11
  43. package/src/openChatbot.tsx +0 -0
  44. package/src/services/ErrorTrackingService.ts +0 -217
  45. package/src/types/events.ts +0 -25
  46. package/src/types/react-native-flipper-performance-plugin.d.ts +0 -3
  47. package/src/types/react-native-globals.d.ts +0 -10
  48. package/src/utils/cookieUtils.ts +0 -7
  49. package/src/utils/debugConfig.ts +0 -56
  50. package/src/utils/debugMenu.ts +0 -14
  51. package/src/utils/errorHandler.ts +0 -58
  52. package/src/utils/logger.ts +0 -14
  53. package/src/utils/systemInfo.ts +0 -84
  54. package/src/utils/webViewStorage.ts +0 -62
  55. package/src/version.ts +0 -2
  56. package/src/versions/version.dev.ts +0 -2
  57. package/src/versions/version.production.ts +0 -2
  58. package/src/versions/version.staging.ts +0 -2
@@ -1,2 +1,2 @@
1
- Object.defineProperty(exports,"__esModule",{value:true});exports.SDK_VERSION=void 0;var SDK_VERSION=exports.SDK_VERSION='2.0.19-staging.9';
1
+ Object.defineProperty(exports,"__esModule",{value:true});exports.SDK_VERSION=void 0;var SDK_VERSION=exports.SDK_VERSION='2.0.19-staging.60';
2
2
  //# sourceMappingURL=version.staging.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["SDK_VERSION","exports"],"sourceRoot":"../../../src","sources":["versions/version.staging.ts"],"mappings":"oFACO,GAAM,CAAAA,WAAW,CAAAC,OAAA,CAAAD,WAAA,CAAG,kBAAkB","ignoreList":[]}
1
+ {"version":3,"names":["SDK_VERSION","exports"],"sourceRoot":"../../../src","sources":["versions/version.staging.ts"],"mappings":"oFACO,GAAM,CAAAA,WAAW,CAAAC,OAAA,CAAAD,WAAA,CAAG,mBAAmB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"Chatbotsdk.d.ts","sourceRoot":"","sources":["../../src/Chatbotsd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AAY,CAAC,EAAE;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,YAAY,CAAC,EAAE,OAAO,CAAC;KACxB,CAAC;IACF,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAED,UAAU,oBAAqB,SAAQ,YAAY;IACjD,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,IAAI,CAAC;IACnC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAcD,QAAA,MAAM,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA0jB3C,CAAC;AAwCF,eAAe,OAAO,CAAC"}
@@ -3,6 +3,7 @@ interface FloatingButtonProps {
3
3
  onPress: () => void;
4
4
  brandColor?: string;
5
5
  imageUrl?: string;
6
+ isWebViewVisible: boolean;
6
7
  }
7
8
  declare const FloatingButton: React.FC<FloatingButtonProps>;
8
9
  export default FloatingButton;
@@ -1 +1 @@
1
- {"version":3,"file":"FloatingButton.d.ts","sourceRoot":"","sources":["../../src/FloatingButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAgCjD,CAAC;AA8BF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"FloatingButton.d.ts","sourceRoot":"","sources":["../../src/FloatingButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,UAAU,mBAAmB;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,OAAO,CAAC;CAC3B;AAED,QAAA,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAuCjD,CAAC;AAoCF,eAAe,cAAc,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const SDK_VERSION = "2.0.19-staging.9";
1
+ export declare const SDK_VERSION = "2.0.19-staging.60";
2
2
  //# sourceMappingURL=version.staging.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.staging.d.ts","sourceRoot":"","sources":["../../../src/versions/version.staging.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,qBAAqB,CAAC"}
1
+ {"version":3,"file":"version.staging.d.ts","sourceRoot":"","sources":["../../../src/versions/version.staging.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW,sBAAsB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robylon/react-native-sdk",
3
- "version": "2.0.19-staging.9",
3
+ "version": "2.0.20",
4
4
  "description": "React Native SDK for Robylon",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -23,7 +23,7 @@
23
23
  "version:production": "npm version patch",
24
24
  "publish:dev": "npm run clean && npm run prebuild:dev && npm run version:dev && node scripts/update-version.js dev && npm run build:dev && npm publish --tag dev",
25
25
  "publish:staging": "node scripts/validate-publish.js staging && npm version $(node scripts/get-next-version.js staging) && node scripts/update-version.js staging && npm run build:staging && npm publish --tag staging",
26
- "publish:production": "node scripts/validate-publish.js production && npm version $(node scripts/get-next-version.js production) && node scripts/update-version.js production && npm run build:production && npm publish",
26
+ "publish:production": "node scripts/validate-publish.js production && npm run build:production && npm publish",
27
27
  "publish:hotfix": "node scripts/validate-publish.js hotfix && npm version $(node scripts/get-next-version.js hotfix) && node scripts/update-version.js production && npm run build:production && npm publish --tag hotfix",
28
28
  "postinstall": "node scripts/setup-git-hooks.js",
29
29
  "branch": "node scripts/create-branch.js",
@@ -147,6 +147,22 @@ const getRepoUrl = () => {
147
147
  .replace("git@github.com:", "https://github.com/");
148
148
  };
149
149
 
150
+ // Add this new function near the top with other helper functions
151
+ const updatePackageVersion = async (version, branchName) => {
152
+ try {
153
+ // Update version without creating git tag
154
+ execSync(`npm version ${version} --no-git-tag-version`);
155
+ execSync(`git add package.json package-lock.json`);
156
+ execSync(`git commit -m "chore: update version to ${version}"`);
157
+
158
+ // Push changes
159
+ console.log("\n📡 Pushing version update to remote...");
160
+ execSync(`git push origin ${branchName}`);
161
+ } catch (error) {
162
+ throw new Error(`Failed to update version: ${error.message}`);
163
+ }
164
+ };
165
+
150
166
  const createBranch = async () => {
151
167
  try {
152
168
  // Set environment variable to allow branch creation
@@ -259,10 +275,25 @@ const createBranch = async () => {
259
275
  );
260
276
 
261
277
  // Checkout the release branch
262
- execSync(`git fetch origin ${selectedRelease}`);
263
- execSync(
264
- `git checkout -b ${selectedRelease.split("origin/")[1]} ${selectedRelease}`
265
- );
278
+ const releaseBranchName = selectedRelease.split("origin/")[1];
279
+
280
+ // Check if branch exists locally
281
+ const localBranches = execSync("git branch").toString();
282
+ const branchExists = localBranches.includes(releaseBranchName);
283
+
284
+ if (branchExists) {
285
+ // If branch exists locally, just check it out
286
+ execSync(`git checkout ${releaseBranchName}`);
287
+ // Update to latest from remote
288
+ execSync(`git fetch origin ${releaseBranchName}`);
289
+ execSync(`git reset --hard origin/${releaseBranchName}`);
290
+ } else {
291
+ // If branch doesn't exist locally, create and track it
292
+ execSync(`git fetch origin ${releaseBranchName}`);
293
+ execSync(
294
+ `git checkout -b ${releaseBranchName} origin/${releaseBranchName}`
295
+ );
296
+ }
266
297
 
267
298
  // Merge selected features
268
299
  const selectedFeatures =
@@ -277,7 +308,7 @@ const createBranch = async () => {
277
308
  console.log(`\nMerging ${branch}...`);
278
309
  try {
279
310
  execSync(
280
- `git merge ${branch} --no-ff -m "Merge ${branch} into ${branchName}"`
311
+ `git merge ${branch} --no-ff -m "Merge ${branch} into ${releaseBranchName}"`
281
312
  );
282
313
  } catch (error) {
283
314
  console.log(`\n⚠️ Merge conflict detected with ${branch}!`);
@@ -293,7 +324,7 @@ const createBranch = async () => {
293
324
  console.log("\n🚨 MERGE CONFLICTS DETECTED 🚨");
294
325
  console.log("=====================================");
295
326
  conflictedBranches.forEach((branch) => {
296
- const prUrl = `${repoUrl}/compare/${branchName}...${branch}?expand=1`;
327
+ const prUrl = `${repoUrl}/compare/${releaseBranchName}...${branch}?expand=1`;
297
328
  console.log(`\n❌ ${branch}`);
298
329
  console.log(`🔗 Create PR: ${prUrl}`);
299
330
  });
@@ -389,22 +420,8 @@ const createBranch = async () => {
389
420
 
390
421
  execSync(`git checkout -b ${branchName}`);
391
422
 
392
- // Update version and commit
393
- execSync(`npm version ${releaseVersion} --no-git-tag-version`);
394
- execSync(`git add package.json package-lock.json`);
395
- execSync(`git commit -m "chore: update version to ${releaseVersion}"`);
396
-
397
- // Set up tracking and push to remote
398
- try {
399
- console.log("\n📡 Pushing to remote...");
400
- execSync(
401
- `git push -u origin ${branchName}${branchExists ? " --force" : ""}`
402
- );
403
- } catch (error) {
404
- throw new Error(
405
- `Failed to push to remote. Please check your permissions and try again.\nError: ${error.message}`
406
- );
407
- }
423
+ // Update version only during initial branch creation
424
+ await updatePackageVersion(releaseVersion, branchName);
408
425
 
409
426
  // Get all feature branches for next version
410
427
  const featureBranches = execSync("git branch -r")
@@ -1,71 +1,48 @@
1
1
  const { execSync } = require("child_process");
2
2
 
3
- const validatePublish = (type) => {
3
+ const validatePublish = () => {
4
4
  try {
5
5
  // Get current branch
6
6
  const currentBranch = execSync("git rev-parse --abbrev-ref HEAD")
7
7
  .toString()
8
8
  .trim();
9
+ console.log("Validating branch:", currentBranch);
9
10
 
10
- // Get version from package.json
11
- const { version } = require("../package.json");
12
- const baseVersion = version.split("-")[0];
11
+ if (!currentBranch.startsWith("release/v")) {
12
+ throw new Error("Publishing is only allowed from release branches");
13
+ }
13
14
 
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
- }
15
+ // Get version from branch name
16
+ const branchVersion = currentBranch.split("/v")[1];
25
17
 
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;
18
+ // Get version from package.json
19
+ const packageVersion = require("../package.json").version;
20
+ console.log("Current version:", packageVersion);
37
21
 
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;
22
+ // Get latest published version
23
+ const latestVersion = execSync("npm view @robylon/react-native-sdk version")
24
+ .toString()
25
+ .trim();
26
+ console.log("Latest published version:", latestVersion);
27
+
28
+ // Ensure branch version matches package.json version
29
+ if (branchVersion !== packageVersion) {
30
+ throw new Error(
31
+ `Release branch version (${branchVersion}) must match package.json version (${packageVersion})`
32
+ );
33
+ }
49
34
 
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;
35
+ // Validate version is greater than latest published
36
+ const semver = require("semver");
37
+ if (!semver.gt(packageVersion, latestVersion)) {
38
+ throw new Error(
39
+ `New version (${packageVersion}) must be greater than latest published version (${latestVersion})`
40
+ );
61
41
  }
62
42
  } catch (error) {
63
- console.error("\n❌ Publish validation failed:");
64
- console.error(error.message);
43
+ console.error("Error:", error.message);
65
44
  process.exit(1);
66
45
  }
67
46
  };
68
47
 
69
- // Get publish type from command line argument
70
- const publishType = process.argv[2];
71
- validatePublish(publishType);
48
+ validatePublish();
@@ -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
- };