rampkit-expo-dev 0.0.85 → 0.0.87
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/RampkitOverlay.js +167 -64
- package/package.json +1 -1
package/build/RampkitOverlay.js
CHANGED
|
@@ -1127,6 +1127,124 @@ function Overlay(props) {
|
|
|
1127
1127
|
detail: { screenIndex: ${screenIndex}, screenId: '${screenId}' }
|
|
1128
1128
|
}));
|
|
1129
1129
|
} catch(e) {}
|
|
1130
|
+
|
|
1131
|
+
// Process on-open actions (SDK-side handling)
|
|
1132
|
+
// This ensures actions run when screen becomes VISIBLE, not when loaded
|
|
1133
|
+
try {
|
|
1134
|
+
if (window.__rampkitOnOpenActionsProcessed) return; // Only run once per screen visibility
|
|
1135
|
+
window.__rampkitOnOpenActionsProcessed = true;
|
|
1136
|
+
|
|
1137
|
+
var elements = document.querySelectorAll('[data-on-open-actions]');
|
|
1138
|
+
elements.forEach(function(el) {
|
|
1139
|
+
try {
|
|
1140
|
+
var actionsStr = el.getAttribute('data-on-open-actions');
|
|
1141
|
+
if (!actionsStr) return;
|
|
1142
|
+
|
|
1143
|
+
// Decode HTML entities
|
|
1144
|
+
actionsStr = actionsStr.replace(/"/g, '"').replace(/"/g, '"')
|
|
1145
|
+
.replace(/'/g, "'").replace(/'/g, "'")
|
|
1146
|
+
.replace(/</g, '<').replace(/>/g, '>')
|
|
1147
|
+
.replace(/&/g, '&');
|
|
1148
|
+
|
|
1149
|
+
var actions = JSON.parse(actionsStr);
|
|
1150
|
+
if (!Array.isArray(actions)) return;
|
|
1151
|
+
|
|
1152
|
+
console.log('[RampKit] Processing on-open actions:', actions.length);
|
|
1153
|
+
|
|
1154
|
+
// Execute actions in sequence with delays
|
|
1155
|
+
var executeActions = function(actionList, index) {
|
|
1156
|
+
if (index >= actionList.length) return;
|
|
1157
|
+
if (!window.__rampkitScreenVisible) return; // Stop if screen became inactive
|
|
1158
|
+
|
|
1159
|
+
var action = actionList[index];
|
|
1160
|
+
var actionType = action.type || action.actionType;
|
|
1161
|
+
|
|
1162
|
+
console.log('[RampKit] Executing on-open action:', actionType);
|
|
1163
|
+
|
|
1164
|
+
if (actionType === 'wait') {
|
|
1165
|
+
var waitMs = action.waitMs || action.duration || 1000;
|
|
1166
|
+
setTimeout(function() {
|
|
1167
|
+
executeActions(actionList, index + 1);
|
|
1168
|
+
}, waitMs);
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
if (actionType === 'navigate' || actionType === 'continue') {
|
|
1173
|
+
var target = action.targetScreenId || action.target || '__continue__';
|
|
1174
|
+
var animation = action.animation || 'fade';
|
|
1175
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
1176
|
+
type: 'rampkit:navigate',
|
|
1177
|
+
targetScreenId: target,
|
|
1178
|
+
animation: animation,
|
|
1179
|
+
fromOnOpen: true
|
|
1180
|
+
}));
|
|
1181
|
+
// Don't continue to next action after navigate
|
|
1182
|
+
return;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
if (actionType === 'goBack') {
|
|
1186
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
1187
|
+
type: 'rampkit:goBack',
|
|
1188
|
+
animation: action.animation || 'fade',
|
|
1189
|
+
fromOnOpen: true
|
|
1190
|
+
}));
|
|
1191
|
+
return;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
if (actionType === 'requestReview' || actionType === 'request-review') {
|
|
1195
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
1196
|
+
type: 'rampkit:request-review',
|
|
1197
|
+
fromOnOpen: true
|
|
1198
|
+
}));
|
|
1199
|
+
executeActions(actionList, index + 1);
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
if (actionType === 'requestNotificationPermission' || actionType === 'request-notification-permission') {
|
|
1204
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
1205
|
+
type: 'rampkit:request-notification-permission',
|
|
1206
|
+
ios: action.ios,
|
|
1207
|
+
android: action.android,
|
|
1208
|
+
behavior: action.behavior,
|
|
1209
|
+
fromOnOpen: true
|
|
1210
|
+
}));
|
|
1211
|
+
executeActions(actionList, index + 1);
|
|
1212
|
+
return;
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
if (actionType === 'haptic') {
|
|
1216
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
1217
|
+
type: 'rampkit:haptic',
|
|
1218
|
+
hapticType: action.hapticType || 'impact',
|
|
1219
|
+
impactStyle: action.impactStyle || 'Medium',
|
|
1220
|
+
fromOnOpen: true
|
|
1221
|
+
}));
|
|
1222
|
+
executeActions(actionList, index + 1);
|
|
1223
|
+
return;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
if (actionType === 'close') {
|
|
1227
|
+
window.ReactNativeWebView.postMessage(JSON.stringify({
|
|
1228
|
+
type: 'rampkit:close',
|
|
1229
|
+
fromOnOpen: true
|
|
1230
|
+
}));
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
// Unknown action, continue to next
|
|
1235
|
+
executeActions(actionList, index + 1);
|
|
1236
|
+
};
|
|
1237
|
+
|
|
1238
|
+
// Start executing actions
|
|
1239
|
+
executeActions(actions, 0);
|
|
1240
|
+
|
|
1241
|
+
} catch(e) {
|
|
1242
|
+
console.log('[RampKit] Error processing on-open actions:', e);
|
|
1243
|
+
}
|
|
1244
|
+
});
|
|
1245
|
+
} catch(e) {
|
|
1246
|
+
console.log('[RampKit] Error finding on-open actions:', e);
|
|
1247
|
+
}
|
|
1130
1248
|
})();`;
|
|
1131
1249
|
// @ts-ignore: injectJavaScript exists on WebView instance
|
|
1132
1250
|
wv.injectJavaScript(activateScript);
|
|
@@ -1143,6 +1261,7 @@ function Overlay(props) {
|
|
|
1143
1261
|
}
|
|
1144
1262
|
const deactivateScript = `(function() {
|
|
1145
1263
|
window.__rampkitScreenVisible = false;
|
|
1264
|
+
window.__rampkitOnOpenActionsProcessed = false; // Reset so on-open can run again if user returns
|
|
1146
1265
|
console.log('🔒 Screen ${screenIndex} DEACTIVATED');
|
|
1147
1266
|
|
|
1148
1267
|
// Pause all Lottie animations
|
|
@@ -1988,56 +2107,48 @@ function Overlay(props) {
|
|
|
1988
2107
|
}
|
|
1989
2108
|
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:continue" ||
|
|
1990
2109
|
(data === null || data === void 0 ? void 0 : data.type) === "continue") {
|
|
1991
|
-
|
|
1992
|
-
// Queue if screen is not active (e.g., on-open actions during preload)
|
|
2110
|
+
// Only process from active screen (on-open actions are handled by SDK in activateScreen)
|
|
1993
2111
|
if (!isScreenActive(i)) {
|
|
1994
2112
|
if (__DEV__)
|
|
1995
|
-
console.log(`[Rampkit]
|
|
1996
|
-
queueAction(i, executeContinue);
|
|
2113
|
+
console.log(`[Rampkit] Ignoring continue from inactive screen ${i} (SDK handles on-open)`);
|
|
1997
2114
|
return;
|
|
1998
2115
|
}
|
|
1999
|
-
|
|
2116
|
+
handleAdvance(i, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
|
|
2000
2117
|
return;
|
|
2001
2118
|
}
|
|
2002
2119
|
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:navigate") {
|
|
2003
|
-
|
|
2004
|
-
const executeNavigate = () => {
|
|
2005
|
-
if (target === "__goBack__") {
|
|
2006
|
-
handleGoBack(i, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
|
|
2007
|
-
return;
|
|
2008
|
-
}
|
|
2009
|
-
if (!target || target === "__continue__") {
|
|
2010
|
-
handleAdvance(i, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
|
|
2011
|
-
return;
|
|
2012
|
-
}
|
|
2013
|
-
const targetIndex = props.screens.findIndex((s) => s.id === target);
|
|
2014
|
-
if (targetIndex >= 0) {
|
|
2015
|
-
navigateToIndex(targetIndex, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
|
|
2016
|
-
}
|
|
2017
|
-
else {
|
|
2018
|
-
handleAdvance(i);
|
|
2019
|
-
}
|
|
2020
|
-
};
|
|
2021
|
-
// Queue if screen is not active (e.g., on-open actions during preload)
|
|
2120
|
+
// Only process from active screen (on-open actions are handled by SDK in activateScreen)
|
|
2022
2121
|
if (!isScreenActive(i)) {
|
|
2023
2122
|
if (__DEV__)
|
|
2024
|
-
console.log(`[Rampkit]
|
|
2025
|
-
|
|
2123
|
+
console.log(`[Rampkit] Ignoring navigate from inactive screen ${i} (SDK handles on-open)`);
|
|
2124
|
+
return;
|
|
2125
|
+
}
|
|
2126
|
+
const target = data === null || data === void 0 ? void 0 : data.targetScreenId;
|
|
2127
|
+
if (target === "__goBack__") {
|
|
2128
|
+
handleGoBack(i, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
|
|
2026
2129
|
return;
|
|
2027
2130
|
}
|
|
2028
|
-
|
|
2131
|
+
if (!target || target === "__continue__") {
|
|
2132
|
+
handleAdvance(i, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
|
|
2133
|
+
return;
|
|
2134
|
+
}
|
|
2135
|
+
const targetIndex = props.screens.findIndex((s) => s.id === target);
|
|
2136
|
+
if (targetIndex >= 0) {
|
|
2137
|
+
navigateToIndex(targetIndex, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
|
|
2138
|
+
}
|
|
2139
|
+
else {
|
|
2140
|
+
handleAdvance(i);
|
|
2141
|
+
}
|
|
2029
2142
|
return;
|
|
2030
2143
|
}
|
|
2031
2144
|
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:goBack") {
|
|
2032
|
-
|
|
2033
|
-
// Queue if screen is not active (e.g., on-open actions during preload)
|
|
2145
|
+
// Only process from active screen (on-open actions are handled by SDK in activateScreen)
|
|
2034
2146
|
if (!isScreenActive(i)) {
|
|
2035
2147
|
if (__DEV__)
|
|
2036
|
-
console.log(`[Rampkit]
|
|
2037
|
-
queueAction(i, executeGoBack);
|
|
2148
|
+
console.log(`[Rampkit] Ignoring goBack from inactive screen ${i} (SDK handles on-open)`);
|
|
2038
2149
|
return;
|
|
2039
2150
|
}
|
|
2040
|
-
|
|
2151
|
+
handleGoBack(i, (data === null || data === void 0 ? void 0 : data.animation) || "fade");
|
|
2041
2152
|
return;
|
|
2042
2153
|
}
|
|
2043
2154
|
if ((data === null || data === void 0 ? void 0 : data.type) === "rampkit:close") {
|
|
@@ -2059,15 +2170,13 @@ function Overlay(props) {
|
|
|
2059
2170
|
if (raw === "rampkit:tap" ||
|
|
2060
2171
|
raw === "next" ||
|
|
2061
2172
|
raw === "continue") {
|
|
2062
|
-
|
|
2063
|
-
// Queue if screen is not active (e.g., on-open actions during preload)
|
|
2173
|
+
// Only process from active screen (on-open actions are handled by SDK in activateScreen)
|
|
2064
2174
|
if (!isScreenActive(i)) {
|
|
2065
2175
|
if (__DEV__)
|
|
2066
|
-
console.log(`[Rampkit]
|
|
2067
|
-
queueAction(i, executeAdvance);
|
|
2176
|
+
console.log(`[Rampkit] Ignoring ${raw} from inactive screen ${i} (SDK handles on-open)`);
|
|
2068
2177
|
return;
|
|
2069
2178
|
}
|
|
2070
|
-
|
|
2179
|
+
handleAdvance(i);
|
|
2071
2180
|
return;
|
|
2072
2181
|
}
|
|
2073
2182
|
if (raw === "rampkit:request-review" || raw === "rampkit:review") {
|
|
@@ -2121,44 +2230,38 @@ function Overlay(props) {
|
|
|
2121
2230
|
return;
|
|
2122
2231
|
}
|
|
2123
2232
|
if (raw === "rampkit:goBack") {
|
|
2124
|
-
|
|
2125
|
-
// Queue if screen is not active (e.g., on-open actions during preload)
|
|
2233
|
+
// Only process from active screen (on-open actions are handled by SDK in activateScreen)
|
|
2126
2234
|
if (!isScreenActive(i)) {
|
|
2127
2235
|
if (__DEV__)
|
|
2128
|
-
console.log(`[Rampkit]
|
|
2129
|
-
queueAction(i, executeGoBack);
|
|
2236
|
+
console.log(`[Rampkit] Ignoring goBack (raw) from inactive screen ${i} (SDK handles on-open)`);
|
|
2130
2237
|
return;
|
|
2131
2238
|
}
|
|
2132
|
-
|
|
2239
|
+
handleGoBack(i);
|
|
2133
2240
|
return;
|
|
2134
2241
|
}
|
|
2135
2242
|
if (raw.startsWith("rampkit:navigate:")) {
|
|
2136
|
-
|
|
2137
|
-
const executeNavigate = () => {
|
|
2138
|
-
if (target === "__goBack__") {
|
|
2139
|
-
handleGoBack(i);
|
|
2140
|
-
return;
|
|
2141
|
-
}
|
|
2142
|
-
if (!target || target === "__continue__") {
|
|
2143
|
-
handleAdvance(i);
|
|
2144
|
-
return;
|
|
2145
|
-
}
|
|
2146
|
-
const targetIndex = props.screens.findIndex((s) => s.id === target);
|
|
2147
|
-
if (targetIndex >= 0) {
|
|
2148
|
-
navigateToIndex(targetIndex);
|
|
2149
|
-
}
|
|
2150
|
-
else {
|
|
2151
|
-
handleAdvance(i);
|
|
2152
|
-
}
|
|
2153
|
-
};
|
|
2154
|
-
// Queue if screen is not active (e.g., on-open actions during preload)
|
|
2243
|
+
// Only process from active screen (on-open actions are handled by SDK in activateScreen)
|
|
2155
2244
|
if (!isScreenActive(i)) {
|
|
2156
2245
|
if (__DEV__)
|
|
2157
|
-
console.log(`[Rampkit]
|
|
2158
|
-
queueAction(i, executeNavigate);
|
|
2246
|
+
console.log(`[Rampkit] Ignoring navigate (raw) from inactive screen ${i} (SDK handles on-open)`);
|
|
2159
2247
|
return;
|
|
2160
2248
|
}
|
|
2161
|
-
|
|
2249
|
+
const target = raw.slice("rampkit:navigate:".length);
|
|
2250
|
+
if (target === "__goBack__") {
|
|
2251
|
+
handleGoBack(i);
|
|
2252
|
+
return;
|
|
2253
|
+
}
|
|
2254
|
+
if (!target || target === "__continue__") {
|
|
2255
|
+
handleAdvance(i);
|
|
2256
|
+
return;
|
|
2257
|
+
}
|
|
2258
|
+
const targetIndex = props.screens.findIndex((s) => s.id === target);
|
|
2259
|
+
if (targetIndex >= 0) {
|
|
2260
|
+
navigateToIndex(targetIndex);
|
|
2261
|
+
}
|
|
2262
|
+
else {
|
|
2263
|
+
handleAdvance(i);
|
|
2264
|
+
}
|
|
2162
2265
|
return;
|
|
2163
2266
|
}
|
|
2164
2267
|
if (raw === "rampkit:close") {
|
package/package.json
CHANGED