@eventop/sdk 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.
@@ -1,12 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var require$$0 = require('react');
3
+ var react = require('react');
4
+ var jsxRuntime = require('react/jsx-runtime');
4
5
 
5
6
  /**
6
7
  * Root context — holds the global feature registry.
7
8
  * Set by EventopAIProvider at the root of the app.
8
9
  */
9
- const EventopRegistryContext = /*#__PURE__*/require$$0.createContext(null);
10
+ const EventopRegistryContext = /*#__PURE__*/react.createContext(null);
10
11
 
11
12
  /**
12
13
  * Feature scope context — set by EventopTarget.
@@ -15,14 +16,14 @@ const EventopRegistryContext = /*#__PURE__*/require$$0.createContext(null);
15
16
  * the feature id. Also supports explicit feature="id" on EventopStep
16
17
  * for steps that live outside their parent EventopTarget in the tree.
17
18
  */
18
- const EventopFeatureScopeContext = /*#__PURE__*/require$$0.createContext(null);
19
+ const EventopFeatureScopeContext = /*#__PURE__*/react.createContext(null);
19
20
  function useRegistry() {
20
- const ctx = require$$0.useContext(EventopRegistryContext);
21
+ const ctx = react.useContext(EventopRegistryContext);
21
22
  if (!ctx) throw new Error('[EventopAI] Must be used inside <EventopAIProvider>.');
22
23
  return ctx;
23
24
  }
24
25
  function useFeatureScope() {
25
- return require$$0.useContext(EventopFeatureScopeContext); // null is fine — steps can declare feature explicitly
26
+ return react.useContext(EventopFeatureScopeContext); // null is fine — steps can declare feature explicitly
26
27
  }
27
28
 
28
29
  /**
@@ -187,290 +188,6 @@ function createFeatureRegistry() {
187
188
  };
188
189
  }
189
190
 
190
- var jsxRuntime = {exports: {}};
191
-
192
- var reactJsxRuntime_production = {};
193
-
194
- /**
195
- * @license React
196
- * react-jsx-runtime.production.js
197
- *
198
- * Copyright (c) Meta Platforms, Inc. and affiliates.
199
- *
200
- * This source code is licensed under the MIT license found in the
201
- * LICENSE file in the root directory of this source tree.
202
- */
203
- var hasRequiredReactJsxRuntime_production;
204
- function requireReactJsxRuntime_production() {
205
- if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
206
- hasRequiredReactJsxRuntime_production = 1;
207
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
208
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
209
- function jsxProd(type, config, maybeKey) {
210
- var key = null;
211
- void 0 !== maybeKey && (key = "" + maybeKey);
212
- void 0 !== config.key && (key = "" + config.key);
213
- if ("key" in config) {
214
- maybeKey = {};
215
- for (var propName in config) "key" !== propName && (maybeKey[propName] = config[propName]);
216
- } else maybeKey = config;
217
- config = maybeKey.ref;
218
- return {
219
- $$typeof: REACT_ELEMENT_TYPE,
220
- type: type,
221
- key: key,
222
- ref: void 0 !== config ? config : null,
223
- props: maybeKey
224
- };
225
- }
226
- reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
227
- reactJsxRuntime_production.jsx = jsxProd;
228
- reactJsxRuntime_production.jsxs = jsxProd;
229
- return reactJsxRuntime_production;
230
- }
231
-
232
- var reactJsxRuntime_development = {};
233
-
234
- /**
235
- * @license React
236
- * react-jsx-runtime.development.js
237
- *
238
- * Copyright (c) Meta Platforms, Inc. and affiliates.
239
- *
240
- * This source code is licensed under the MIT license found in the
241
- * LICENSE file in the root directory of this source tree.
242
- */
243
- var hasRequiredReactJsxRuntime_development;
244
- function requireReactJsxRuntime_development() {
245
- if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
246
- hasRequiredReactJsxRuntime_development = 1;
247
- "production" !== process.env.NODE_ENV && function () {
248
- function getComponentNameFromType(type) {
249
- if (null == type) return null;
250
- if ("function" === typeof type) return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
251
- if ("string" === typeof type) return type;
252
- switch (type) {
253
- case REACT_FRAGMENT_TYPE:
254
- return "Fragment";
255
- case REACT_PROFILER_TYPE:
256
- return "Profiler";
257
- case REACT_STRICT_MODE_TYPE:
258
- return "StrictMode";
259
- case REACT_SUSPENSE_TYPE:
260
- return "Suspense";
261
- case REACT_SUSPENSE_LIST_TYPE:
262
- return "SuspenseList";
263
- case REACT_ACTIVITY_TYPE:
264
- return "Activity";
265
- }
266
- if ("object" === typeof type) switch ("number" === typeof type.tag && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
267
- case REACT_PORTAL_TYPE:
268
- return "Portal";
269
- case REACT_CONTEXT_TYPE:
270
- return type.displayName || "Context";
271
- case REACT_CONSUMER_TYPE:
272
- return (type._context.displayName || "Context") + ".Consumer";
273
- case REACT_FORWARD_REF_TYPE:
274
- var innerType = type.render;
275
- type = type.displayName;
276
- type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
277
- return type;
278
- case REACT_MEMO_TYPE:
279
- return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
280
- case REACT_LAZY_TYPE:
281
- innerType = type._payload;
282
- type = type._init;
283
- try {
284
- return getComponentNameFromType(type(innerType));
285
- } catch (x) {}
286
- }
287
- return null;
288
- }
289
- function testStringCoercion(value) {
290
- return "" + value;
291
- }
292
- function checkKeyStringCoercion(value) {
293
- try {
294
- testStringCoercion(value);
295
- var JSCompiler_inline_result = !1;
296
- } catch (e) {
297
- JSCompiler_inline_result = true;
298
- }
299
- if (JSCompiler_inline_result) {
300
- JSCompiler_inline_result = console;
301
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
302
- var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
303
- JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
304
- return testStringCoercion(value);
305
- }
306
- }
307
- function getTaskName(type) {
308
- if (type === REACT_FRAGMENT_TYPE) return "<>";
309
- if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE) return "<...>";
310
- try {
311
- var name = getComponentNameFromType(type);
312
- return name ? "<" + name + ">" : "<...>";
313
- } catch (x) {
314
- return "<...>";
315
- }
316
- }
317
- function getOwner() {
318
- var dispatcher = ReactSharedInternals.A;
319
- return null === dispatcher ? null : dispatcher.getOwner();
320
- }
321
- function UnknownOwner() {
322
- return Error("react-stack-top-frame");
323
- }
324
- function hasValidKey(config) {
325
- if (hasOwnProperty.call(config, "key")) {
326
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
327
- if (getter && getter.isReactWarning) return false;
328
- }
329
- return void 0 !== config.key;
330
- }
331
- function defineKeyPropWarningGetter(props, displayName) {
332
- function warnAboutAccessingKey() {
333
- specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
334
- }
335
- warnAboutAccessingKey.isReactWarning = true;
336
- Object.defineProperty(props, "key", {
337
- get: warnAboutAccessingKey,
338
- configurable: true
339
- });
340
- }
341
- function elementRefGetterWithDeprecationWarning() {
342
- var componentName = getComponentNameFromType(this.type);
343
- didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
344
- componentName = this.props.ref;
345
- return void 0 !== componentName ? componentName : null;
346
- }
347
- function ReactElement(type, key, props, owner, debugStack, debugTask) {
348
- var refProp = props.ref;
349
- type = {
350
- $$typeof: REACT_ELEMENT_TYPE,
351
- type: type,
352
- key: key,
353
- props: props,
354
- _owner: owner
355
- };
356
- null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
357
- enumerable: false,
358
- get: elementRefGetterWithDeprecationWarning
359
- }) : Object.defineProperty(type, "ref", {
360
- enumerable: false,
361
- value: null
362
- });
363
- type._store = {};
364
- Object.defineProperty(type._store, "validated", {
365
- configurable: false,
366
- enumerable: false,
367
- writable: true,
368
- value: 0
369
- });
370
- Object.defineProperty(type, "_debugInfo", {
371
- configurable: false,
372
- enumerable: false,
373
- writable: true,
374
- value: null
375
- });
376
- Object.defineProperty(type, "_debugStack", {
377
- configurable: false,
378
- enumerable: false,
379
- writable: true,
380
- value: debugStack
381
- });
382
- Object.defineProperty(type, "_debugTask", {
383
- configurable: false,
384
- enumerable: false,
385
- writable: true,
386
- value: debugTask
387
- });
388
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
389
- return type;
390
- }
391
- function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
392
- var children = config.children;
393
- if (void 0 !== children) if (isStaticChildren) {
394
- if (isArrayImpl(children)) {
395
- for (isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++) validateChildKeys(children[isStaticChildren]);
396
- Object.freeze && Object.freeze(children);
397
- } else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
398
- } else validateChildKeys(children);
399
- if (hasOwnProperty.call(config, "key")) {
400
- children = getComponentNameFromType(type);
401
- var keys = Object.keys(config).filter(function (k) {
402
- return "key" !== k;
403
- });
404
- isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
405
- didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', isStaticChildren, children, keys, children), didWarnAboutKeySpread[children + isStaticChildren] = true);
406
- }
407
- children = null;
408
- void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
409
- hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
410
- if ("key" in config) {
411
- maybeKey = {};
412
- for (var propName in config) "key" !== propName && (maybeKey[propName] = config[propName]);
413
- } else maybeKey = config;
414
- children && defineKeyPropWarningGetter(maybeKey, "function" === typeof type ? type.displayName || type.name || "Unknown" : type);
415
- return ReactElement(type, children, maybeKey, getOwner(), debugStack, debugTask);
416
- }
417
- function validateChildKeys(node) {
418
- isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
419
- }
420
- function isValidElement(object) {
421
- return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
422
- }
423
- var React = require$$0,
424
- REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
425
- REACT_PORTAL_TYPE = Symbol.for("react.portal"),
426
- REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
427
- REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
428
- REACT_PROFILER_TYPE = Symbol.for("react.profiler"),
429
- REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
430
- REACT_CONTEXT_TYPE = Symbol.for("react.context"),
431
- REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
432
- REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
433
- REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
434
- REACT_MEMO_TYPE = Symbol.for("react.memo"),
435
- REACT_LAZY_TYPE = Symbol.for("react.lazy"),
436
- REACT_ACTIVITY_TYPE = Symbol.for("react.activity"),
437
- REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"),
438
- ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,
439
- hasOwnProperty = Object.prototype.hasOwnProperty,
440
- isArrayImpl = Array.isArray,
441
- createTask = console.createTask ? console.createTask : function () {
442
- return null;
443
- };
444
- React = {
445
- react_stack_bottom_frame: function (callStackForError) {
446
- return callStackForError();
447
- }
448
- };
449
- var specialPropKeyWarningShown;
450
- var didWarnAboutElementRef = {};
451
- var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(React, UnknownOwner)();
452
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
453
- var didWarnAboutKeySpread = {};
454
- reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
455
- reactJsxRuntime_development.jsx = function (type, config, maybeKey) {
456
- var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
457
- return jsxDEVImpl(type, config, maybeKey, false, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
458
- };
459
- reactJsxRuntime_development.jsxs = function (type, config, maybeKey) {
460
- var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
461
- return jsxDEVImpl(type, config, maybeKey, true, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
462
- };
463
- }();
464
- return reactJsxRuntime_development;
465
- }
466
-
467
- if (process.env.NODE_ENV === 'production') {
468
- jsxRuntime.exports = requireReactJsxRuntime_production();
469
- } else {
470
- jsxRuntime.exports = requireReactJsxRuntime_development();
471
- }
472
- var jsxRuntimeExports = jsxRuntime.exports;
473
-
474
191
  function EventopProvider({
475
192
  children,
476
193
  provider,
@@ -482,15 +199,15 @@ function EventopProvider({
482
199
  }) {
483
200
  if (!provider) throw new Error('[Eventop] <EventopProvider> requires a provider prop.');
484
201
  if (!appName) throw new Error('[Eventop] <EventopProvider> requires an appName prop.');
485
- const registry = require$$0.useRef(createFeatureRegistry()).current;
486
- const sdkReady = require$$0.useRef(false);
487
- const syncToSDK = require$$0.useCallback(() => {
202
+ const registry = react.useRef(createFeatureRegistry()).current;
203
+ const sdkReady = react.useRef(false);
204
+ const syncToSDK = react.useCallback(() => {
488
205
  if (!sdkReady.current || !window.Eventop) return;
489
206
  window.Eventop._updateConfig?.({
490
207
  features: registry.snapshot()
491
208
  });
492
209
  }, [registry]);
493
- require$$0.useEffect(() => {
210
+ react.useEffect(() => {
494
211
  function boot() {
495
212
  window.Eventop.init({
496
213
  provider,
@@ -521,7 +238,7 @@ function EventopProvider({
521
238
  unregisterStep: registry.unregisterStep,
522
239
  isRegistered: registry.isRegistered
523
240
  };
524
- return /*#__PURE__*/jsxRuntimeExports.jsx(EventopRegistryContext.Provider, {
241
+ return /*#__PURE__*/jsxRuntime.jsx(EventopRegistryContext.Provider, {
525
242
  value: ctx,
526
243
  children: children
527
244
  });
@@ -539,10 +256,10 @@ function EventopTarget({
539
256
  ...rest
540
257
  }) {
541
258
  const registry = useRegistry();
542
- const ref = require$$0.useRef(null);
259
+ const ref = react.useRef(null);
543
260
  const dataAttr = `data-evtp-${id}`;
544
261
  const selector = `[${dataAttr}]`;
545
- require$$0.useEffect(() => {
262
+ react.useEffect(() => {
546
263
  if (!id || !name) {
547
264
  console.warn('[Eventop] <EventopTarget> requires id and name props.');
548
265
  return;
@@ -562,10 +279,10 @@ function EventopTarget({
562
279
  });
563
280
  return () => registry.unregisterFeature(id);
564
281
  }, [id, name, description]);
565
- const child = require$$0.Children.only(children);
282
+ const child = react.Children.only(children);
566
283
  let wrapped;
567
284
  try {
568
- wrapped = /*#__PURE__*/require$$0.cloneElement(child, {
285
+ wrapped = /*#__PURE__*/react.cloneElement(child, {
569
286
  [dataAttr]: '',
570
287
  ref: node => {
571
288
  ref.current = node;
@@ -574,7 +291,7 @@ function EventopTarget({
574
291
  }
575
292
  });
576
293
  } catch {
577
- wrapped = /*#__PURE__*/jsxRuntimeExports.jsx("span", {
294
+ wrapped = /*#__PURE__*/jsxRuntime.jsx("span", {
578
295
  [dataAttr]: '',
579
296
  ref: ref,
580
297
  style: {
@@ -583,7 +300,7 @@ function EventopTarget({
583
300
  children: child
584
301
  });
585
302
  }
586
- return /*#__PURE__*/jsxRuntimeExports.jsx(EventopFeatureScopeContext.Provider, {
303
+ return /*#__PURE__*/jsxRuntime.jsx(EventopFeatureScopeContext.Provider, {
587
304
  value: id,
588
305
  children: wrapped
589
306
  });
@@ -600,7 +317,7 @@ function EventopStep({
600
317
  const registry = useRegistry();
601
318
  const featureScope = useFeatureScope();
602
319
  const featureId = feature || featureScope;
603
- const ref = require$$0.useRef(null);
320
+ const ref = react.useRef(null);
604
321
  if (!featureId) {
605
322
  console.warn('[Eventop] <EventopStep> needs either a feature prop or an <EventopTarget> ancestor.');
606
323
  }
@@ -609,7 +326,7 @@ function EventopStep({
609
326
  }
610
327
  const dataAttr = `data-evtp-step-${featureId}-${parentStep != null ? `${parentStep}-` : ''}${index}`;
611
328
  const selector = `[${dataAttr}]`;
612
- require$$0.useEffect(() => {
329
+ react.useEffect(() => {
613
330
  if (!featureId || index == null) return;
614
331
  registry.registerStep(featureId, index, parentStep ?? null, {
615
332
  selector,
@@ -621,10 +338,10 @@ function EventopStep({
621
338
  });
622
339
  return () => registry.unregisterStep(featureId, index, parentStep ?? null);
623
340
  }, [featureId, index, parentStep]);
624
- const child = require$$0.Children.only(children);
341
+ const child = react.Children.only(children);
625
342
  let wrapped;
626
343
  try {
627
- wrapped = /*#__PURE__*/require$$0.cloneElement(child, {
344
+ wrapped = /*#__PURE__*/react.cloneElement(child, {
628
345
  [dataAttr]: '',
629
346
  ref: node => {
630
347
  ref.current = node;
@@ -633,7 +350,7 @@ function EventopStep({
633
350
  }
634
351
  });
635
352
  } catch {
636
- wrapped = /*#__PURE__*/jsxRuntimeExports.jsx("span", {
353
+ wrapped = /*#__PURE__*/jsxRuntime.jsx("span", {
637
354
  [dataAttr]: '',
638
355
  ref: ref,
639
356
  style: {
@@ -698,11 +415,11 @@ function useEventopAI() {
698
415
  // ═══════════════════════════════════════════════════════════════════════════
699
416
 
700
417
  function useEventopTour() {
701
- const [state, setState] = require$$0.useState({
418
+ const [state, setState] = react.useState({
702
419
  isActive: false,
703
420
  isPaused: false
704
421
  });
705
- require$$0.useEffect(() => {
422
+ react.useEffect(() => {
706
423
  const id = setInterval(() => {
707
424
  const sdk = window.Eventop;
708
425
  if (!sdk) return;
@@ -716,10 +433,10 @@ function useEventopTour() {
716
433
  }, []);
717
434
  return {
718
435
  ...state,
719
- resume: require$$0.useCallback(() => window.Eventop?.resumeTour(), []),
720
- cancel: require$$0.useCallback(() => window.Eventop?.cancelTour(), []),
721
- open: require$$0.useCallback(() => window.Eventop?.open(), []),
722
- close: require$$0.useCallback(() => window.Eventop?.close(), [])
436
+ resume: react.useCallback(() => window.Eventop?.resumeTour(), []),
437
+ cancel: react.useCallback(() => window.Eventop?.cancelTour(), []),
438
+ open: react.useCallback(() => window.Eventop?.open(), []),
439
+ close: react.useCallback(() => window.Eventop?.close(), [])
723
440
  };
724
441
  }
725
442