{"version":3,"file":"guidely-react.umd.cjs","sources":["../src/GuidelyContext.ts","../src/createGuidelyStore.ts","../src/GuidelyProvider.tsx","../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js","../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js","../../../node_modules/use-sync-external-store/shim/index.js","../src/useGuidely.ts","../src/useGuidelyEvent.ts"],"sourcesContent":["import { createContext } from \"react\";\nimport type { TGuidelyRuntimeSnapshot } from \"@sendsay-ru/guidely\";\nimport type { TGuidelyStore } from \"./types\";\n\nexport const emptySnapshot: TGuidelyRuntimeSnapshot = {\n  activeFlow: null,\n  promptedFlow: null,\n  locale: \"en\",\n  status: \"idle\",\n  isDestroyed: false,\n};\n\nexport const GuidelyContext = createContext<TGuidelyStore | null>(null);\n","import type { TGuidely, TGuidelyRuntimeSnapshot } from \"@sendsay-ru/guidely\";\nimport { emptySnapshot } from \"./GuidelyContext\";\nimport type { TGuidelyStore } from \"./types\";\n\nexport function createGuidelyStore(): TGuidelyStore {\n  const listeners = new Set<() => void>();\n  let instance: TGuidely | null = null;\n  let unsubscribeFromInstance: (() => void) | null = null;\n  let snapshot: TGuidelyRuntimeSnapshot = emptySnapshot;\n\n  const readSnapshot = (): TGuidelyRuntimeSnapshot => instance?.getSnapshot() ?? emptySnapshot;\n\n  const refreshSnapshot = (force = false): void => {\n    const nextSnapshot = readSnapshot();\n\n    if (force || !areSnapshotsEqual(snapshot, nextSnapshot)) {\n      snapshot = nextSnapshot;\n    }\n  };\n\n  const notify = (): void => {\n    refreshSnapshot();\n    listeners.forEach((listener) => listener());\n  };\n\n  return {\n    getInstance(): TGuidely | null {\n      return instance;\n    },\n\n    setInstance(nextInstance: TGuidely | null): void {\n      unsubscribeFromInstance?.();\n      unsubscribeFromInstance = null;\n      instance = nextInstance;\n      refreshSnapshot(true);\n\n      if (nextInstance) {\n        unsubscribeFromInstance = nextInstance.subscribe(notify);\n      }\n\n      notify();\n    },\n\n    subscribe(listener: () => void): () => void {\n      listeners.add(listener);\n\n      return () => {\n        listeners.delete(listener);\n      };\n    },\n\n    getSnapshot(): TGuidelyRuntimeSnapshot {\n      return snapshot;\n    },\n  };\n}\n\nfunction areSnapshotsEqual(\n  current: TGuidelyRuntimeSnapshot,\n  next: TGuidelyRuntimeSnapshot,\n): boolean {\n  return (\n    current.locale === next.locale &&\n    current.status === next.status &&\n    current.isDestroyed === next.isDestroyed &&\n    current.activeFlow?.flowId === next.activeFlow?.flowId &&\n    current.activeFlow?.stepId === next.activeFlow?.stepId &&\n    current.activeFlow?.index === next.activeFlow?.index &&\n    current.promptedFlow?.flowId === next.promptedFlow?.flowId &&\n    current.promptedFlow?.stepId === next.promptedFlow?.stepId\n  );\n}\n","import { createElement, useEffect, useMemo, useRef } from \"react\";\nimport { createGuidely } from \"@sendsay-ru/guidely\";\nimport { GuidelyContext } from \"./GuidelyContext\";\nimport { createGuidelyStore } from \"./createGuidelyStore\";\nimport type { TGuidelyProviderProps } from \"./types\";\n\nexport function GuidelyProvider({\n  children,\n  config,\n  adapter,\n  onEvent,\n  locale,\n  labels,\n  theme,\n  container,\n  targetResolver,\n  autoPromote,\n  path,\n  enabled = true,\n}: TGuidelyProviderProps) {\n  const store = useMemo(() => createGuidelyStore(), []);\n  // The locale and the path change while the app runs. They reach the running instance through\n  // `setLocale` and `setPath`, because recreating it would drop the running tour, and a new\n  // instance starts from their latest values.\n  const localeRef = useRef(locale);\n  const pathRef = useRef(path);\n\n  // Declared before the effect that creates the instance, so an instance recreated in the same\n  // render already starts from the new values.\n  useEffect(() => {\n    localeRef.current = locale;\n\n    if (locale) {\n      store.getInstance()?.setLocale(locale);\n    }\n  }, [locale, store]);\n\n  useEffect(() => {\n    pathRef.current = path;\n\n    if (path !== undefined) {\n      store.getInstance()?.setPath(path);\n    }\n  }, [path, store]);\n\n  useEffect(() => {\n    if (!enabled || !adapter) {\n      store.setInstance(null);\n\n      return undefined;\n    }\n\n    const options = {\n      config,\n      adapter,\n      ...(onEvent ? { onEvent } : {}),\n      ...(localeRef.current ? { locale: localeRef.current } : {}),\n      ...(labels ? { labels } : {}),\n      ...(theme ? { theme } : {}),\n      ...(container ? { container } : {}),\n      ...(targetResolver ? { targetResolver } : {}),\n      ...(autoPromote !== undefined ? { autoPromote } : {}),\n      ...(pathRef.current !== undefined ? { path: pathRef.current } : {}),\n    };\n    const guidely = createGuidely(options);\n\n    store.setInstance(guidely);\n\n    return () => {\n      store.setInstance(null);\n      guidely.destroy();\n    };\n  }, [\n    adapter,\n    autoPromote,\n    config,\n    container,\n    enabled,\n    labels,\n    onEvent,\n    store,\n    targetResolver,\n    theme,\n  ]);\n\n  return createElement(GuidelyContext.Provider, { value: store }, children);\n}\n","/**\n * @license React\n * use-sync-external-store-shim.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\");\nfunction is(x, y) {\n  return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n  useState = React.useState,\n  useEffect = React.useEffect,\n  useLayoutEffect = React.useLayoutEffect,\n  useDebugValue = React.useDebugValue;\nfunction useSyncExternalStore$2(subscribe, getSnapshot) {\n  var value = getSnapshot(),\n    _useState = useState({ inst: { value: value, getSnapshot: getSnapshot } }),\n    inst = _useState[0].inst,\n    forceUpdate = _useState[1];\n  useLayoutEffect(\n    function () {\n      inst.value = value;\n      inst.getSnapshot = getSnapshot;\n      checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n    },\n    [subscribe, value, getSnapshot]\n  );\n  useEffect(\n    function () {\n      checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n      return subscribe(function () {\n        checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n      });\n    },\n    [subscribe]\n  );\n  useDebugValue(value);\n  return value;\n}\nfunction checkIfSnapshotChanged(inst) {\n  var latestGetSnapshot = inst.getSnapshot;\n  inst = inst.value;\n  try {\n    var nextValue = latestGetSnapshot();\n    return !objectIs(inst, nextValue);\n  } catch (error) {\n    return !0;\n  }\n}\nfunction useSyncExternalStore$1(subscribe, getSnapshot) {\n  return getSnapshot();\n}\nvar shim =\n  \"undefined\" === typeof window ||\n  \"undefined\" === typeof window.document ||\n  \"undefined\" === typeof window.document.createElement\n    ? useSyncExternalStore$1\n    : useSyncExternalStore$2;\nexports.useSyncExternalStore =\n  void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;\n","/**\n * @license React\n * use-sync-external-store-shim.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n  (function () {\n    function is(x, y) {\n      return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n    }\n    function useSyncExternalStore$2(subscribe, getSnapshot) {\n      didWarnOld18Alpha ||\n        void 0 === React.startTransition ||\n        ((didWarnOld18Alpha = !0),\n        console.error(\n          \"You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release.\"\n        ));\n      var value = getSnapshot();\n      if (!didWarnUncachedGetSnapshot) {\n        var cachedValue = getSnapshot();\n        objectIs(value, cachedValue) ||\n          (console.error(\n            \"The result of getSnapshot should be cached to avoid an infinite loop\"\n          ),\n          (didWarnUncachedGetSnapshot = !0));\n      }\n      cachedValue = useState({\n        inst: { value: value, getSnapshot: getSnapshot }\n      });\n      var inst = cachedValue[0].inst,\n        forceUpdate = cachedValue[1];\n      useLayoutEffect(\n        function () {\n          inst.value = value;\n          inst.getSnapshot = getSnapshot;\n          checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n        },\n        [subscribe, value, getSnapshot]\n      );\n      useEffect(\n        function () {\n          checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n          return subscribe(function () {\n            checkIfSnapshotChanged(inst) && forceUpdate({ inst: inst });\n          });\n        },\n        [subscribe]\n      );\n      useDebugValue(value);\n      return value;\n    }\n    function checkIfSnapshotChanged(inst) {\n      var latestGetSnapshot = inst.getSnapshot;\n      inst = inst.value;\n      try {\n        var nextValue = latestGetSnapshot();\n        return !objectIs(inst, nextValue);\n      } catch (error) {\n        return !0;\n      }\n    }\n    function useSyncExternalStore$1(subscribe, getSnapshot) {\n      return getSnapshot();\n    }\n    \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n      \"function\" ===\n        typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&\n      __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());\n    var React = require(\"react\"),\n      objectIs = \"function\" === typeof Object.is ? Object.is : is,\n      useState = React.useState,\n      useEffect = React.useEffect,\n      useLayoutEffect = React.useLayoutEffect,\n      useDebugValue = React.useDebugValue,\n      didWarnOld18Alpha = !1,\n      didWarnUncachedGetSnapshot = !1,\n      shim =\n        \"undefined\" === typeof window ||\n        \"undefined\" === typeof window.document ||\n        \"undefined\" === typeof window.document.createElement\n          ? useSyncExternalStore$1\n          : useSyncExternalStore$2;\n    exports.useSyncExternalStore =\n      void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim;\n    \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n      \"function\" ===\n        typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&\n      __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());\n  })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n  module.exports = require('../cjs/use-sync-external-store-shim.production.js');\n} else {\n  module.exports = require('../cjs/use-sync-external-store-shim.development.js');\n}\n","import { useContext, useMemo } from \"react\";\nimport { useSyncExternalStore } from \"use-sync-external-store/shim\";\nimport { GuidelyContext, emptySnapshot } from \"./GuidelyContext\";\nimport type { TGuidelyStore, TUseGuidelyResult } from \"./types\";\n\nexport function useGuidely(): TUseGuidelyResult {\n  const store = useContext(GuidelyContext);\n\n  if (!store) {\n    throw new Error(\"useGuidely must be used inside GuidelyProvider\");\n  }\n\n  const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, () => emptySnapshot);\n  const actions = useMemo(\n    () => ({\n      start: (flowId: string, opts?: Parameters<TUseGuidelyResult[\"start\"]>[1]) =>\n        startGuidely(store, flowId, opts),\n      next: () => callGuidely(store, (guidely) => guidely.next()),\n      prev: () => callGuidely(store, (guidely) => guidely.prev()),\n      skip: () => callGuidely(store, (guidely) => guidely.skip()),\n      complete: () => callGuidely(store, (guidely) => guidely.complete()),\n      goTo: (stepId: string) => callGuidely(store, (guidely) => guidely.goTo(stepId)),\n      stop: () => callGuidely(store, (guidely) => guidely.stop()),\n      setLocale: (locale: string) => callGuidely(store, (guidely) => guidely.setLocale(locale)),\n    }),\n    [store],\n  );\n\n  return useMemo(\n    () => ({\n      activeFlow: snapshot.activeFlow,\n      promptedFlow: snapshot.promptedFlow,\n      isReady: store.getInstance() !== null,\n      snapshot,\n      ...actions,\n    }),\n    [actions, snapshot, store],\n  );\n}\n\nfunction startGuidely(\n  store: TGuidelyStore,\n  flowId: string,\n  opts?: Parameters<TUseGuidelyResult[\"start\"]>[1],\n) {\n  const guidely = store.getInstance();\n\n  if (!guidely) {\n    return Promise.resolve({ started: false, reason: \"not_ready\" } as const);\n  }\n\n  return guidely.start(flowId, opts);\n}\n\nfunction callGuidely(\n  store: TGuidelyStore,\n  callback: (guidely: NonNullable<ReturnType<TGuidelyStore[\"getInstance\"]>>) => void,\n): void {\n  const guidely = store.getInstance();\n\n  if (guidely) {\n    callback(guidely);\n  }\n}\n","import { useContext, useEffect, useRef } from \"react\";\nimport { useSyncExternalStore } from \"use-sync-external-store/shim\";\nimport type { TGuidelyEvent } from \"@sendsay-ru/guidely\";\nimport { GuidelyContext, emptySnapshot } from \"./GuidelyContext\";\n\nexport function useGuidelyEvent(listener: (event: TGuidelyEvent) => void): void {\n  const store = useContext(GuidelyContext);\n\n  if (!store) {\n    throw new Error(\"useGuidelyEvent must be used inside GuidelyProvider\");\n  }\n\n  useSyncExternalStore(store.subscribe, store.getSnapshot, () => emptySnapshot);\n\n  const listenerRef = useRef(listener);\n  listenerRef.current = listener;\n\n  const guidely = store.getInstance();\n\n  useEffect(() => {\n    if (!guidely) {\n      return undefined;\n    }\n\n    return guidely.subscribeEvents((event) => listenerRef.current(event));\n  }, [guidely]);\n}\n"],"names":["emptySnapshot","GuidelyContext","createContext","createGuidelyStore","listeners","instance","unsubscribeFromInstance","snapshot","readSnapshot","refreshSnapshot","force","nextSnapshot","areSnapshotsEqual","notify","listener","nextInstance","current","next","_a","_b","_c","_d","_e","_f","_g","_h","_i","_j","GuidelyProvider","children","config","adapter","onEvent","locale","labels","theme","container","targetResolver","autoPromote","path","enabled","store","useMemo","localeRef","useRef","pathRef","useEffect","options","guidely","createGuidely","createElement","React","require$$0","is","x","y","objectIs","useState","useLayoutEffect","useDebugValue","useSyncExternalStore$2","subscribe","getSnapshot","value","_useState","inst","forceUpdate","checkIfSnapshotChanged","latestGetSnapshot","nextValue","useSyncExternalStore$1","shim","useSyncExternalStoreShim_production","didWarnOld18Alpha","didWarnUncachedGetSnapshot","cachedValue","useSyncExternalStoreShim_development","shimModule","require$$1","useGuidely","useContext","useSyncExternalStore","actions","flowId","opts","startGuidely","callGuidely","stepId","callback","useGuidelyEvent","listenerRef","event"],"mappings":"yUAIO,MAAMA,EAAyC,CACpD,WAAY,KACZ,aAAc,KACd,OAAQ,KACR,OAAQ,OACR,YAAa,EACf,EAEaC,EAAiBC,EAAAA,cAAoC,IAAI,ECR/D,SAASC,GAAoC,CAClD,MAAMC,MAAgB,IACtB,IAAIC,EAA4B,KAC5BC,EAA+C,KAC/CC,EAAoCP,EAExC,MAAMQ,EAAe,KAA+BH,GAAA,YAAAA,EAAU,gBAAiBL,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