@wireai/activation 0.14.2 → 0.15.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 (67) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +144 -0
  3. package/README.md +23 -9
  4. package/dist/analytics/index.d.mts +5 -5
  5. package/dist/analytics/index.d.ts +5 -5
  6. package/dist/analytics/index.js.map +1 -1
  7. package/dist/analytics/index.mjs.map +1 -1
  8. package/dist/coachmarks/index.d.mts +13 -5
  9. package/dist/coachmarks/index.d.ts +13 -5
  10. package/dist/coachmarks/index.js +252 -58
  11. package/dist/coachmarks/index.js.map +1 -1
  12. package/dist/coachmarks/index.mjs +204 -9
  13. package/dist/coachmarks/index.mjs.map +1 -1
  14. package/dist/{currentSession-CW_5Mq4O.d.ts → currentSession-CFSRZ2wg.d.ts} +10 -4
  15. package/dist/{currentSession-CUvTOchb.d.mts → currentSession-orZy5p1e.d.mts} +10 -4
  16. package/dist/{decision-Bgo17oH7.d.mts → decision-3vWLuBlO.d.ts} +11 -2
  17. package/dist/{decision-Bkh_LigV.d.ts → decision-yBj2AyPW.d.mts} +11 -2
  18. package/dist/index.d.mts +2 -2
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/questionnaire/index.d.mts +3 -3
  23. package/dist/questionnaire/index.d.ts +3 -3
  24. package/dist/questionnaire/index.js +48 -3
  25. package/dist/questionnaire/index.js.map +1 -1
  26. package/dist/questionnaire/index.mjs +48 -3
  27. package/dist/questionnaire/index.mjs.map +1 -1
  28. package/dist/reviews/index.d.mts +10 -6
  29. package/dist/reviews/index.d.ts +10 -6
  30. package/dist/reviews/index.js +167 -18
  31. package/dist/reviews/index.js.map +1 -1
  32. package/dist/reviews/index.mjs +167 -18
  33. package/dist/reviews/index.mjs.map +1 -1
  34. package/dist/showcase/index.d.mts +1 -1
  35. package/dist/showcase/index.d.ts +1 -1
  36. package/dist/showcase/index.js +282 -48
  37. package/dist/showcase/index.js.map +1 -1
  38. package/dist/showcase/index.mjs +248 -12
  39. package/dist/showcase/index.mjs.map +1 -1
  40. package/dist/{transport-j5gFfJhK.d.mts → transport-s5QxA-ci.d.mts} +18 -13
  41. package/dist/{transport-B_0SgCBe.d.ts → transport-xqqSFqxs.d.ts} +18 -13
  42. package/dist/{types-Cju-1_jT.d.mts → types-Byx306Kv.d.mts} +25 -10
  43. package/dist/{types-BcmagF6K.d.mts → types-D_0B0yay.d.mts} +7 -2
  44. package/dist/{types-BcmagF6K.d.ts → types-D_0B0yay.d.ts} +7 -2
  45. package/dist/{types-h2BZvl1t.d.ts → types-tdATL5z0.d.ts} +25 -10
  46. package/metro/index.js +16 -5
  47. package/package.json +1 -1
  48. package/src/WireOnboarding.tsx +4 -1
  49. package/src/coachmarks/GestureHint.tsx +16 -7
  50. package/src/coachmarks/SpotlightOverlay.tsx +19 -13
  51. package/src/coachmarks/index.ts +7 -2
  52. package/src/coachmarks/reanimated.ts +342 -0
  53. package/src/coachmarks/runtime.ts +103 -2
  54. package/src/coachmarks/types.ts +7 -2
  55. package/src/context/deviceId.ts +32 -0
  56. package/src/reviews/ReviewGate.tsx +86 -37
  57. package/src/reviews/decision.ts +11 -1
  58. package/src/reviews/idempotency.ts +71 -0
  59. package/src/reviews/index.ts +4 -2
  60. package/src/reviews/runtime.ts +5 -3
  61. package/src/reviews/transport.ts +17 -12
  62. package/src/reviews/types.ts +7 -0
  63. package/src/showcase/FeatureShowcase.tsx +25 -9
  64. package/src/showcase/blazejOnboarding.ts +136 -0
  65. package/src/showcase/index.ts +8 -4
  66. package/src/types.ts +10 -4
  67. package/src/utils/submitResult.ts +17 -9
@@ -1,9 +1,9 @@
1
1
  import React__default from 'react';
2
2
  import { O as OnboardingTheme } from '../types-BKfpdZzX.mjs';
3
- import { C as CoachmarkStorage } from '../types-BcmagF6K.mjs';
3
+ import { C as CoachmarkStorage } from '../types-D_0B0yay.mjs';
4
4
  import { a as WireFeatures, b as WireFeaturesConfig } from '../types-BpwiRpA8.mjs';
5
- import { S as SubmitResult } from '../types-Cju-1_jT.mjs';
6
- export { G as GateRules, a as GateSignals, e as evaluateGate, r as resolveRules } from '../decision-Bgo17oH7.mjs';
5
+ import { S as SubmitResult } from '../types-Byx306Kv.mjs';
6
+ export { G as GateRules, a as GateSignals, e as evaluateGate, r as resolveRules } from '../decision-yBj2AyPW.mjs';
7
7
 
8
8
  /**
9
9
  * The firing verdict - the SAME contract on both sides of the seam. `decideQuestionnaire`
@@ -1,9 +1,9 @@
1
1
  import React__default from 'react';
2
2
  import { O as OnboardingTheme } from '../types-BKfpdZzX.js';
3
- import { C as CoachmarkStorage } from '../types-BcmagF6K.js';
3
+ import { C as CoachmarkStorage } from '../types-D_0B0yay.js';
4
4
  import { a as WireFeatures, b as WireFeaturesConfig } from '../types-BpwiRpA8.js';
5
- import { S as SubmitResult } from '../types-h2BZvl1t.js';
6
- export { G as GateRules, a as GateSignals, e as evaluateGate, r as resolveRules } from '../decision-Bkh_LigV.js';
5
+ import { S as SubmitResult } from '../types-tdATL5z0.js';
6
+ export { G as GateRules, a as GateSignals, e as evaluateGate, r as resolveRules } from '../decision-3vWLuBlO.js';
7
7
 
8
8
  /**
9
9
  * The firing verdict - the SAME contract on both sides of the seam. `decideQuestionnaire`
@@ -1135,9 +1135,54 @@ var coachmarkRuntime = () => {
1135
1135
  var getCoachmarkStorage = () => coachmarkRuntime().storage;
1136
1136
  var isCoachmarkTesting = () => coachmarkRuntime().testing;
1137
1137
  var SEEN_VALUE = "1";
1138
+ var GATE_PROBE_KEY = "wire_gate_probe";
1139
+ var ASYNC_GATE_STORAGE_WARNED_SLOT = /* @__PURE__ */ Symbol.for(
1140
+ "@wireai/activation:asyncGateStorageWarned"
1141
+ );
1142
+ var asyncGateWarnGlobal = globalThis;
1143
+ var closedGateStorage = Object.freeze({
1144
+ getItem: () => SEEN_VALUE,
1145
+ setItem: () => {
1146
+ }
1147
+ });
1148
+ var syncGateAdapters = /* @__PURE__ */ new WeakSet();
1149
+ var asyncGateAdapters = /* @__PURE__ */ new WeakSet();
1150
+ var warnAsyncGateStorage = () => {
1151
+ if (asyncGateWarnGlobal[ASYNC_GATE_STORAGE_WARNED_SLOT]) return;
1152
+ if (typeof __DEV__ === "undefined" || !__DEV__) return;
1153
+ if (typeof console === "undefined" || !console.warn) return;
1154
+ asyncGateWarnGlobal[ASYNC_GATE_STORAGE_WARNED_SLOT] = true;
1155
+ console.warn(
1156
+ "[wireai] the gate storage's getItem returned a Promise \u2014 an async adapter (e.g. AsyncStorage) cannot drive the once-per-user gates, so coachmark tours, showcases and the review/questionnaire gates are all DISABLED (fail closed: nothing shows, nothing fires) until a synchronous adapter is provided. Pass a sync adapter (e.g. MMKV: `{ getItem: (k) => mmkv.getString(k) ?? null, setItem: (k, v) => mmkv.set(k, v) }`) to CoachmarkProvider or the gate's `storage` prop."
1157
+ );
1158
+ };
1159
+ var validateGateStorage = (storage) => {
1160
+ if (!storage) return null;
1161
+ if (syncGateAdapters.has(storage)) return storage;
1162
+ if (asyncGateAdapters.has(storage)) return closedGateStorage;
1163
+ let probed;
1164
+ try {
1165
+ probed = storage.getItem(GATE_PROBE_KEY);
1166
+ } catch {
1167
+ syncGateAdapters.add(storage);
1168
+ return storage;
1169
+ }
1170
+ if (probed != null && typeof probed.then === "function") {
1171
+ asyncGateAdapters.add(storage);
1172
+ try {
1173
+ probed.then(void 0, () => {
1174
+ });
1175
+ } catch {
1176
+ }
1177
+ warnAsyncGateStorage();
1178
+ return closedGateStorage;
1179
+ }
1180
+ syncGateAdapters.add(storage);
1181
+ return storage;
1182
+ };
1138
1183
  var hasSeenGate = (key, storageOverride, testingOverride) => {
1139
1184
  if (testingOverride != null ? testingOverride : isCoachmarkTesting()) return false;
1140
- const storage = storageOverride != null ? storageOverride : getCoachmarkStorage();
1185
+ const storage = validateGateStorage(storageOverride != null ? storageOverride : getCoachmarkStorage());
1141
1186
  if (!storage) return false;
1142
1187
  try {
1143
1188
  return storage.getItem(key) === SEEN_VALUE;
@@ -1147,7 +1192,7 @@ var hasSeenGate = (key, storageOverride, testingOverride) => {
1147
1192
  };
1148
1193
  var markSeenGate = (key, storageOverride, testingOverride) => {
1149
1194
  if (testingOverride != null ? testingOverride : isCoachmarkTesting()) return;
1150
- const storage = storageOverride != null ? storageOverride : getCoachmarkStorage();
1195
+ const storage = validateGateStorage(storageOverride != null ? storageOverride : getCoachmarkStorage());
1151
1196
  if (!storage) return;
1152
1197
  try {
1153
1198
  storage.setItem(key, SEEN_VALUE);
@@ -1340,7 +1385,7 @@ var globalSlot = globalThis;
1340
1385
  var getCurrentSessionId = () => globalSlot[CURRENT_SESSION_ID_SLOT];
1341
1386
 
1342
1387
  // src/reviews/runtime.ts
1343
- var resolveStorage = (override) => override != null ? override : getCoachmarkStorage();
1388
+ var resolveStorage = (override) => validateGateStorage(override != null ? override : getCoachmarkStorage());
1344
1389
  var NO_STORAGE_WARNED_SLOT = /* @__PURE__ */ Symbol.for(
1345
1390
  "@wireai/activation:gateStorageWarned"
1346
1391
  );