anear-js-api 1.1.1 → 1.1.3

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.
@@ -1799,7 +1799,19 @@ const AnearEventMachineFunctions = ({
1799
1799
  await publishPromise
1800
1800
  return members
1801
1801
  }),
1802
- transitionToLive: fromPromise(({ input }) => AnearApi.transitionEvent(input.context.anearEvent.id, 'live')),
1802
+ transitionToLive: fromPromise(async ({ input }) => {
1803
+ const { context } = input
1804
+ // Transition the event to 'live' via ANAPI and publish an EVENT_TRANSITION
1805
+ // message so ABRs can react immediately (e.g., auto-close expanded QR).
1806
+ const transitionPromise = AnearApi.transitionEvent(context.anearEvent.id, 'live')
1807
+ const publishPromise = RealtimeMessaging.publish(
1808
+ context.eventChannel,
1809
+ 'EVENT_TRANSITION',
1810
+ { content: { state: 'live' } }
1811
+ )
1812
+ await Promise.all([transitionPromise, publishPromise])
1813
+ return 'done'
1814
+ }),
1803
1815
  transitionToClosed: fromPromise(({ input }) => AnearApi.transitionEvent(input.context.anearEvent.id, 'closed')),
1804
1816
  transitionToCanceled: fromPromise(({ input }) => AnearApi.transitionEvent(input.context.anearEvent.id, 'canceled')),
1805
1817
  eventTransitionClosed: fromPromise(async ({ input }) => {
@@ -234,7 +234,10 @@ const AnearParticipantMachineConfig = participantId => ({
234
234
  input: ({ context, event }) => ({ context, event }),
235
235
  onDone: [
236
236
  { guard: 'hasActionTimeout', actions: 'updateActionTimeout', target: 'waitParticipantResponse' },
237
- { target: 'idle' }
237
+ // If this display does not configure a timeout, explicitly clear any
238
+ // previously-running action timeout. Otherwise, a stale actionTimeoutStart
239
+ // from an older prompt can be "resumed" later and immediately fire.
240
+ { actions: 'nullActionTimeout', target: 'idle' }
238
241
  ],
239
242
  onError: {
240
243
  target: '#error'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anear-js-api",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Javascript Developer API for Anear Apps",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {