@applicaster/zapp-react-native-utils 15.0.0-rc.123 → 15.0.0-rc.124
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.
|
@@ -315,6 +315,44 @@ export function withActionExecutor(Component) {
|
|
|
315
315
|
return ActionResult.Error;
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
+
const navigationAction = action.options?.navigationAction;
|
|
319
|
+
const entrySource = action.options?.entry;
|
|
320
|
+
|
|
321
|
+
const entry = entrySource
|
|
322
|
+
? entrySource === "@{entry/}"
|
|
323
|
+
? context?.entry
|
|
324
|
+
: entrySource
|
|
325
|
+
: null;
|
|
326
|
+
|
|
327
|
+
if (entry) {
|
|
328
|
+
if (typeof entry !== "object") {
|
|
329
|
+
log_error(
|
|
330
|
+
`navigateToScreen: entry option is not an object, entry: ${entry}`
|
|
331
|
+
);
|
|
332
|
+
|
|
333
|
+
return ActionResult.Error;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
log_info(
|
|
337
|
+
`navigateToScreen: navigating to screen type: ${screenType} with entry id: ${entry.id}`
|
|
338
|
+
);
|
|
339
|
+
|
|
340
|
+
const overriddenEntry = {
|
|
341
|
+
...entry,
|
|
342
|
+
type: {
|
|
343
|
+
value: screenType,
|
|
344
|
+
},
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
if (navigationAction === "push") {
|
|
348
|
+
navigator.push(overriddenEntry);
|
|
349
|
+
} else {
|
|
350
|
+
navigator.replace(overriddenEntry);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
return ActionResult.Success;
|
|
354
|
+
}
|
|
355
|
+
|
|
318
356
|
const screenId = contentTypes?.[screenType]?.screen_id || null;
|
|
319
357
|
|
|
320
358
|
if (!screenId) {
|
|
@@ -334,7 +372,12 @@ export function withActionExecutor(Component) {
|
|
|
334
372
|
}
|
|
335
373
|
|
|
336
374
|
context?.callback?.({ success: false, error: null, abort: true });
|
|
337
|
-
|
|
375
|
+
|
|
376
|
+
if (navigationAction === "push") {
|
|
377
|
+
navigator.push(river);
|
|
378
|
+
} else {
|
|
379
|
+
navigator.replace(river);
|
|
380
|
+
}
|
|
338
381
|
|
|
339
382
|
return ActionResult.Success;
|
|
340
383
|
}
|
|
@@ -11,6 +11,10 @@ import { HOOKS_EVENTS, HOOKS_TYPE } from "./constants";
|
|
|
11
11
|
|
|
12
12
|
import { hooksManagerLogger } from "./logger";
|
|
13
13
|
import { HookManager, HookManagerArgs } from "./types";
|
|
14
|
+
import {
|
|
15
|
+
actionExecutor,
|
|
16
|
+
ActionResult,
|
|
17
|
+
} from "../../actionsExecutor/ActionExecutor";
|
|
14
18
|
|
|
15
19
|
/**
|
|
16
20
|
* orders the hooks according to their weight
|
|
@@ -280,6 +284,8 @@ export function HooksManager({
|
|
|
280
284
|
{}
|
|
281
285
|
);
|
|
282
286
|
|
|
287
|
+
actionExecutor.unregisterAction("finishHook");
|
|
288
|
+
|
|
283
289
|
return;
|
|
284
290
|
}
|
|
285
291
|
|
|
@@ -294,6 +300,8 @@ export function HooksManager({
|
|
|
294
300
|
}
|
|
295
301
|
);
|
|
296
302
|
|
|
303
|
+
actionExecutor.unregisterAction("finishHook");
|
|
304
|
+
|
|
297
305
|
return hookPlugin.setStateAndNotify(HOOKS_EVENTS.ERROR, {
|
|
298
306
|
error,
|
|
299
307
|
hookPlugin,
|
|
@@ -316,6 +324,8 @@ export function HooksManager({
|
|
|
316
324
|
// TODO: Temporary hack to pass getLoginProtocol to other plugins to refresh in case token expired, need be deleted later
|
|
317
325
|
delete payload.getLoginProtocol;
|
|
318
326
|
|
|
327
|
+
actionExecutor.unregisterAction("finishHook");
|
|
328
|
+
|
|
319
329
|
hookPlugin.setStateAndNotify(HOOKS_EVENTS.CANCEL, {
|
|
320
330
|
hookPlugin,
|
|
321
331
|
payload,
|
|
@@ -381,6 +391,27 @@ export function HooksManager({
|
|
|
381
391
|
};
|
|
382
392
|
}
|
|
383
393
|
|
|
394
|
+
function registerFinishHookAction(payload, callback) {
|
|
395
|
+
// Ensure no stale finishHook remains (e.g. presentUI re-entry from runInBackground)
|
|
396
|
+
actionExecutor.unregisterAction("finishHook");
|
|
397
|
+
|
|
398
|
+
actionExecutor.registerAction("finishHook", async (action: ActionType) => {
|
|
399
|
+
const { success, errorMessage, abort } = action.options;
|
|
400
|
+
|
|
401
|
+
actionExecutor.unregisterAction("finishHook");
|
|
402
|
+
|
|
403
|
+
if (errorMessage) {
|
|
404
|
+
callback({ success, error: new Error(errorMessage), payload, abort });
|
|
405
|
+
} else {
|
|
406
|
+
callback({ success, error: null, payload, abort });
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
hooksManagerLogger.info("finishHook action executed, finishing flow");
|
|
410
|
+
|
|
411
|
+
return ActionResult.Success;
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
|
|
384
415
|
/**
|
|
385
416
|
* presents a screen hook by triggering an event invoking the handler with
|
|
386
417
|
* the appropriate route & payload
|
|
@@ -408,6 +439,8 @@ export function HooksManager({
|
|
|
408
439
|
}
|
|
409
440
|
);
|
|
410
441
|
|
|
442
|
+
registerFinishHookAction(payload, callback);
|
|
443
|
+
|
|
411
444
|
hookPlugin.setStateAndNotify(HOOKS_EVENTS.PRESENT_SCREEN_HOOK, {
|
|
412
445
|
hookPlugin,
|
|
413
446
|
route: targetScreenRoute,
|
|
@@ -467,6 +500,8 @@ export function HooksManager({
|
|
|
467
500
|
}
|
|
468
501
|
);
|
|
469
502
|
|
|
503
|
+
registerFinishHookAction(payload, callback);
|
|
504
|
+
|
|
470
505
|
hookPlugin.module.runInBackground(
|
|
471
506
|
payload,
|
|
472
507
|
callback,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applicaster/zapp-react-native-utils",
|
|
3
|
-
"version": "15.0.0-rc.
|
|
3
|
+
"version": "15.0.0-rc.124",
|
|
4
4
|
"description": "Applicaster Zapp React Native utilities package",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"homepage": "https://github.com/applicaster/quickbrick#readme",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@applicaster/applicaster-types": "15.0.0-rc.
|
|
30
|
+
"@applicaster/applicaster-types": "15.0.0-rc.124",
|
|
31
31
|
"buffer": "^5.2.1",
|
|
32
32
|
"camelize": "^1.0.0",
|
|
33
33
|
"dayjs": "^1.11.10",
|
|
34
|
-
"handlebars": "4.7.
|
|
34
|
+
"handlebars": "4.7.9",
|
|
35
35
|
"memoizee": "0.4.15",
|
|
36
36
|
"prop-types": "^15.0.0"
|
|
37
37
|
},
|