@robylon/react-native-sdk 2.0.19-staging.8 ā 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.
- package/lib/commonjs/Chatbotsdk.js +2 -2
- package/lib/commonjs/Chatbotsdk.js.map +1 -1
- package/lib/commonjs/FloatingButton.js +1 -1
- package/lib/commonjs/FloatingButton.js.map +1 -1
- package/lib/commonjs/config.js +1 -1
- package/lib/commonjs/config.js.map +1 -1
- package/lib/commonjs/constants.js +1 -1
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/versions/version.staging.js +1 -1
- package/lib/commonjs/versions/version.staging.js.map +1 -1
- package/lib/module/Chatbotsdk.js +2 -2
- package/lib/module/Chatbotsdk.js.map +1 -1
- package/lib/module/FloatingButton.js +1 -1
- package/lib/module/FloatingButton.js.map +1 -1
- package/lib/module/config.js +1 -1
- package/lib/module/config.js.map +1 -1
- package/lib/module/constants.js +1 -1
- package/lib/module/constants.js.map +1 -1
- package/lib/module/versions/version.staging.js +1 -1
- package/lib/module/versions/version.staging.js.map +1 -1
- package/lib/typescript/Chatbotsdk.d.ts.map +1 -1
- package/lib/typescript/FloatingButton.d.ts +1 -0
- package/lib/typescript/FloatingButton.d.ts.map +1 -1
- package/lib/typescript/versions/version.staging.d.ts +1 -1
- package/lib/typescript/versions/version.staging.d.ts.map +1 -1
- package/package.json +2 -2
- package/scripts/create-branch.js +39 -22
- package/scripts/validate-publish.js +30 -53
- package/src/ChatbotWebview.tsx +0 -44
- package/src/Chatbotsdk.tsx +0 -679
- package/src/FloatingButton.tsx +0 -74
- package/src/LoadingIndicator.tsx +0 -11
- package/src/Toast.tsx +0 -65
- package/src/components/DebugButton.tsx +0 -46
- package/src/components/ErrorBoundary.tsx +0 -38
- package/src/config.ts +0 -4
- package/src/constants/errorConstants.ts +0 -21
- package/src/constants.ts +0 -4
- package/src/global.d.ts +0 -11
- package/src/hooks/useChatbotEvents.ts +0 -93
- package/src/index.tsx +0 -10
- package/src/openChatbot.ts +0 -11
- package/src/openChatbot.tsx +0 -0
- package/src/services/ErrorTrackingService.ts +0 -217
- package/src/types/events.ts +0 -25
- package/src/types/react-native-flipper-performance-plugin.d.ts +0 -3
- package/src/types/react-native-globals.d.ts +0 -10
- package/src/utils/cookieUtils.ts +0 -7
- package/src/utils/debugConfig.ts +0 -56
- package/src/utils/debugMenu.ts +0 -14
- package/src/utils/errorHandler.ts +0 -58
- package/src/utils/logger.ts +0 -14
- package/src/utils/systemInfo.ts +0 -84
- package/src/utils/webViewStorage.ts +0 -62
- package/src/version.ts +0 -2
- package/src/versions/version.dev.ts +0 -2
- package/src/versions/version.production.ts +0 -2
- package/src/versions/version.staging.ts +0 -2
package/scripts/create-branch.js
CHANGED
|
@@ -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
|
-
|
|
263
|
-
|
|
264
|
-
|
|
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 ${
|
|
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/${
|
|
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
|
|
393
|
-
|
|
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 = (
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
if (!currentBranch.startsWith("release/v")) {
|
|
12
|
+
throw new Error("Publishing is only allowed from release branches");
|
|
13
|
+
}
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
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
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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("
|
|
64
|
-
console.error(error.message);
|
|
43
|
+
console.error("Error:", error.message);
|
|
65
44
|
process.exit(1);
|
|
66
45
|
}
|
|
67
46
|
};
|
|
68
47
|
|
|
69
|
-
|
|
70
|
-
const publishType = process.argv[2];
|
|
71
|
-
validatePublish(publishType);
|
|
48
|
+
validatePublish();
|
package/src/ChatbotWebview.tsx
DELETED
|
@@ -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
|
-
};
|