@rocapine/react-native-onboarding 1.75.0 → 1.76.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 (87) hide show
  1. package/dist/index.d.ts +5 -3
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +16 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/onboarding-example.d.ts +140 -0
  6. package/dist/onboarding-example.d.ts.map +1 -1
  7. package/dist/onboarding-example.js +41 -1
  8. package/dist/onboarding-example.js.map +1 -1
  9. package/dist/paywalls/PaywallProvider.d.ts +71 -5
  10. package/dist/paywalls/PaywallProvider.d.ts.map +1 -1
  11. package/dist/paywalls/PaywallProvider.js +237 -57
  12. package/dist/paywalls/PaywallProvider.js.map +1 -1
  13. package/dist/paywalls/customScreens.d.ts +31 -0
  14. package/dist/paywalls/customScreens.d.ts.map +1 -1
  15. package/dist/paywalls/observer.d.ts +129 -0
  16. package/dist/paywalls/observer.d.ts.map +1 -0
  17. package/dist/paywalls/observer.js +211 -0
  18. package/dist/paywalls/observer.js.map +1 -0
  19. package/dist/paywalls/present.d.ts +19 -15
  20. package/dist/paywalls/present.d.ts.map +1 -1
  21. package/dist/paywalls/present.js +21 -17
  22. package/dist/paywalls/present.js.map +1 -1
  23. package/dist/paywalls/types.d.ts +3 -1
  24. package/dist/paywalls/types.d.ts.map +1 -1
  25. package/dist/products/adapters/expoIap.d.ts +38 -1
  26. package/dist/products/adapters/expoIap.d.ts.map +1 -1
  27. package/dist/products/adapters/expoIap.js +509 -75
  28. package/dist/products/adapters/expoIap.js.map +1 -1
  29. package/dist/products/index.d.ts +1 -0
  30. package/dist/products/index.d.ts.map +1 -1
  31. package/dist/products/index.js.map +1 -1
  32. package/dist/products/types.d.ts +13 -0
  33. package/dist/products/types.d.ts.map +1 -1
  34. package/dist/screens/completingActions.d.ts +55 -3
  35. package/dist/screens/completingActions.d.ts.map +1 -1
  36. package/dist/screens/completingActions.js +209 -15
  37. package/dist/screens/completingActions.js.map +1 -1
  38. package/dist/screens/elementTypeRegistry.d.ts +14 -0
  39. package/dist/screens/elementTypeRegistry.d.ts.map +1 -1
  40. package/dist/screens/elementTypeRegistry.js +38 -1
  41. package/dist/screens/elementTypeRegistry.js.map +1 -1
  42. package/dist/screens/elements/ButtonElement.d.ts +3 -2
  43. package/dist/screens/elements/ButtonElement.d.ts.map +1 -1
  44. package/dist/screens/elements/ButtonElement.js +5 -1
  45. package/dist/screens/elements/ButtonElement.js.map +1 -1
  46. package/dist/screens/types.d.ts +2 -2
  47. package/dist/screens/types.d.ts.map +1 -1
  48. package/dist/screens/types.js +5 -1
  49. package/dist/screens/types.js.map +1 -1
  50. package/dist/screens/unknownKeys.d.ts +25 -4
  51. package/dist/screens/unknownKeys.d.ts.map +1 -1
  52. package/dist/screens/unknownKeys.js +81 -2
  53. package/dist/screens/unknownKeys.js.map +1 -1
  54. package/dist/steps/common.types.d.ts +178 -6
  55. package/dist/steps/common.types.d.ts.map +1 -1
  56. package/dist/steps/common.types.js +64 -3
  57. package/dist/steps/common.types.js.map +1 -1
  58. package/package.json +1 -1
  59. package/src/__tests__/authoringDocEscapes.test.ts +59 -0
  60. package/src/__tests__/completingActions.test.ts +371 -1
  61. package/src/__tests__/customActionHooks.test.ts +224 -0
  62. package/src/__tests__/onboardingExampleElements.test.ts +47 -0
  63. package/src/__tests__/requestPermissionAction.test.ts +138 -0
  64. package/src/__tests__/retryIdempotencyDocs.test.ts +57 -0
  65. package/src/__tests__/unknownKeys.test.ts +110 -0
  66. package/src/index.ts +33 -1
  67. package/src/onboarding-example.ts +41 -1
  68. package/src/paywalls/PaywallProvider.tsx +370 -66
  69. package/src/paywalls/__tests__/PaywallProvider.observer.test.tsx +866 -0
  70. package/src/paywalls/__tests__/observer.test.ts +401 -0
  71. package/src/paywalls/__tests__/present.test.ts +0 -18
  72. package/src/paywalls/customScreens.ts +34 -1
  73. package/src/paywalls/observer.ts +308 -0
  74. package/src/paywalls/present.ts +24 -18
  75. package/src/paywalls/types.ts +3 -1
  76. package/src/products/adapters/__tests__/expoIap.contract.test.ts +648 -0
  77. package/src/products/adapters/__tests__/expoIap.test.ts +25 -11
  78. package/src/products/adapters/__tests__/expoIap5Fake.ts +288 -0
  79. package/src/products/adapters/expoIap.ts +609 -78
  80. package/src/products/index.ts +1 -0
  81. package/src/products/types.ts +13 -0
  82. package/src/screens/completingActions.ts +223 -15
  83. package/src/screens/elementTypeRegistry.ts +34 -0
  84. package/src/screens/elements/ButtonElement.ts +9 -1
  85. package/src/screens/types.ts +2 -2
  86. package/src/screens/unknownKeys.ts +113 -7
  87. package/src/steps/common.types.ts +213 -6
@@ -1211,6 +1211,19 @@ export const onboardingExample = {
1211
1211
  },
1212
1212
  ],
1213
1213
  },
1214
+ // #191 — the runtime publishes `actions.pending.<elementId>` while
1215
+ // that element's action list is awaiting, so a pending state needs
1216
+ // no host code and no new element type.
1217
+ {
1218
+ id: "hero-button-pending",
1219
+ type: "Text",
1220
+ renderWhen: {
1221
+ variable: "actions.pending.hero-button",
1222
+ operator: "eq",
1223
+ value: "true",
1224
+ },
1225
+ props: { content: "One moment…", fontSize: 14, color: "#6B7280" },
1226
+ },
1214
1227
  {
1215
1228
  id: "hero-button",
1216
1229
  type: "Button",
@@ -1219,8 +1232,35 @@ export const onboardingExample = {
1219
1232
  variant: "filled",
1220
1233
  marginVertical: 8,
1221
1234
  haptic: "medium",
1235
+ // Deliberately NOT the `onResolve: ["continue"]` async-gate
1236
+ // shape (review round 1, findings 1 and 7). This payload is
1237
+ // the exported `fallbackOnboarding`, rendered by apps that
1238
+ // pass no `customActions` at all — `trackCta` is registered
1239
+ // nowhere in the SDK — and a gate puts the screen's only way
1240
+ // forward behind a handler that host may not have. The
1241
+ // trailing `"continue"` runs on the resolve path, and
1242
+ // `onError` covers the other two. The async gate is where
1243
+ // its handler is guaranteed: `example/app/example/
1244
+ // composable-screen.tsx` (`async-gate`), which is not that
1245
+ // screen's only CTA either.
1222
1246
  actions: [
1223
- { type: "custom", function: "trackCta", variables: ["name", "plan", "goals"] },
1247
+ {
1248
+ type: "custom",
1249
+ function: "trackCta",
1250
+ variables: ["name", "plan", "goals"],
1251
+ // One attempt, bounded (#264). `trackCta` is analytics —
1252
+ // if the host's handler never settles, the press never
1253
+ // finishes, the trailing `"continue"` never runs, and the
1254
+ // single-flight claim drops every further tap: a dead CTA
1255
+ // on the screen apps get when they pass no payload at
1256
+ // all. 8s is generous for a fire-and-forget beacon.
1257
+ retry: { maxAttempts: 1, timeoutMs: 8000 },
1258
+ // Kept although the trailing `"continue"` now runs on
1259
+ // every outcome (semantics decision 1 on #191): it makes
1260
+ // the intent explicit at the point a reader asks "what
1261
+ // happens offline?", and it is where failure UI would go.
1262
+ onError: ["continue"],
1263
+ },
1224
1264
  "continue",
1225
1265
  ],
1226
1266
  },