promogame-player 0.0.21 → 0.0.24

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,3 +1,4 @@
1
+ import { EventName } from '../../types.ts';
1
2
  import * as React from 'react';
2
3
  export interface PromogamePlayerProps extends React.RefAttributes<HTMLCanvasElement> {
3
4
  apiUrl: string;
@@ -14,7 +15,7 @@ export interface PromogamePlayerProps extends React.RefAttributes<HTMLCanvasElem
14
15
  userPhone?: string;
15
16
  userAvatar?: string;
16
17
  userDisplayName?: string;
17
- registerEvents?: string[];
18
- onEventReceived?: (eventName: string, params: unknown) => void;
18
+ registerEvents?: EventName[];
19
+ onEventReceived?: (eventName: EventName, params: unknown) => void;
19
20
  }
20
21
  export declare const PromogamePlayer: React.ForwardRefExoticComponent<Omit<PromogamePlayerProps, "ref"> & React.RefAttributes<HTMLCanvasElement>>;
@@ -1,3 +1,4 @@
1
+ import { EventName } from '../../types.ts';
1
2
  import * as React from 'react';
2
3
  export interface UnityGameProps extends React.RefAttributes<HTMLCanvasElement> {
3
4
  gameLink?: string;
@@ -5,7 +6,7 @@ export interface UnityGameProps extends React.RefAttributes<HTMLCanvasElement> {
5
6
  progress: number;
6
7
  }>;
7
8
  className?: string;
8
- registerEvents?: string[];
9
- onEventReceived?: (eventName: string, params: unknown) => void;
9
+ registerEvents?: EventName[];
10
+ onEventReceived?: (eventName: EventName, params: unknown) => void;
10
11
  }
11
12
  export declare const UnityGame: React.ForwardRefExoticComponent<Omit<UnityGameProps, "ref"> & React.RefAttributes<HTMLCanvasElement>>;
@@ -1,12 +1,12 @@
1
1
  import { jsxs as P, Fragment as le, jsx as $ } from "react/jsx-runtime";
2
2
  import * as ce from "react";
3
- import h, { useRef as de, useEffect as B } from "react";
3
+ import g, { useRef as de, useEffect as B } from "react";
4
4
  import { cn as ve } from "../../utils.js";
5
5
  var j = {}, L = {}, S = {}, F;
6
6
  function fe() {
7
7
  if (F) return S;
8
8
  F = 1, Object.defineProperty(S, "__esModule", { value: !0 }), S.useUnityCanvasId = void 0;
9
- var l = h, c = 0, a = "react-unity-webgl-canvas", y = function(v) {
9
+ var l = g, c = 0, a = "react-unity-webgl-canvas", y = function(v) {
10
10
  if (v.id !== void 0)
11
11
  return v.id;
12
12
  var b = (0, l.useMemo)(function() {
@@ -120,7 +120,7 @@ function ye() {
120
120
  }
121
121
  };
122
122
  Object.defineProperty(w, "__esModule", { value: !0 }), w.useUnityInstance = void 0;
123
- var a = h, y = Z(), v = A(), b = function(m, o, n, e) {
123
+ var a = g, y = Z(), v = A(), b = function(m, o, n, e) {
124
124
  (0, a.useEffect)(function() {
125
125
  (function() {
126
126
  return l(void 0, void 0, void 0, function() {
@@ -162,7 +162,7 @@ var M = {}, z;
162
162
  function Ue() {
163
163
  if (z) return M;
164
164
  z = 1, Object.defineProperty(M, "__esModule", { value: !0 }), M.useUnityArguments = void 0;
165
- var l = h, c = function(a) {
165
+ var l = g, c = function(a) {
166
166
  return (0, l.useMemo)(function() {
167
167
  return {
168
168
  // Assigns the data URL, framework URL, and code URL to the Unity
@@ -241,7 +241,7 @@ var x = {}, V;
241
241
  function me() {
242
242
  if (V) return x;
243
243
  V = 1, Object.defineProperty(x, "__esModule", { value: !0 }), x.useUnityLoader = void 0;
244
- var l = h, c = A(), a = Z(), y = function(v) {
244
+ var l = g, c = A(), a = Z(), y = function(v) {
245
245
  var b = (0, l.useState)(a.UnityLoaderStatus.Loading), m = b[0], o = b[1];
246
246
  return (0, l.useEffect)(function() {
247
247
  if (c.isBrowserEnvironment !== !1) {
@@ -270,7 +270,7 @@ var W;
270
270
  function be() {
271
271
  if (W) return L;
272
272
  W = 1, Object.defineProperty(L, "__esModule", { value: !0 }), L.Unity = void 0;
273
- var l = h, c = h, a = fe(), y = ye(), v = Ue(), b = me(), m = (0, c.forwardRef)(
273
+ var l = g, c = g, a = fe(), y = ye(), v = Ue(), b = me(), m = (0, c.forwardRef)(
274
274
  /**
275
275
  * @param unityProps The Unity props provided the the Unity component.
276
276
  * @param forwardedRef The forwarded ref to the Unity component.
@@ -291,7 +291,7 @@ function be() {
291
291
  );
292
292
  return L.Unity = m, L;
293
293
  }
294
- var g = {}, k = {}, Q;
294
+ var h = {}, k = {}, Q;
295
295
  function ee() {
296
296
  if (Q) return k;
297
297
  Q = 1, Object.defineProperty(k, "__esModule", { value: !0 }), k.errorMessages = void 0;
@@ -343,7 +343,7 @@ function _e() {
343
343
  return o.concat(t || Array.prototype.slice.call(n));
344
344
  };
345
345
  Object.defineProperty(I, "__esModule", { value: !0 }), I.useEventSystem = void 0;
346
- var c = h, a = ee(), y = A(), v = [], b = function(o) {
346
+ var c = g, a = ee(), y = A(), v = [], b = function(o) {
347
347
  for (var n = [], e = 1; e < arguments.length; e++)
348
348
  n[e - 1] = arguments[e];
349
349
  var u = void 0;
@@ -409,16 +409,16 @@ var N = {}, J;
409
409
  function we() {
410
410
  if (J) return N;
411
411
  J = 1, Object.defineProperty(N, "__esModule", { value: !0 }), N.useNullableState = void 0;
412
- var l = h, c = function(a) {
412
+ var l = g, c = function(a) {
413
413
  return (0, l.useState)(a || null);
414
414
  };
415
415
  return N.useNullableState = c, N;
416
416
  }
417
417
  var K;
418
- function ge() {
419
- if (K) return g;
418
+ function he() {
419
+ if (K) return h;
420
420
  K = 1;
421
- var l = g && g.__awaiter || function(o, n, e, u) {
421
+ var l = h && h.__awaiter || function(o, n, e, u) {
422
422
  function r(t) {
423
423
  return t instanceof e ? t : new e(function(d) {
424
424
  d(t);
@@ -444,7 +444,7 @@ function ge() {
444
444
  }
445
445
  i((u = u.apply(o, n || [])).next());
446
446
  });
447
- }, c = g && g.__generator || function(o, n) {
447
+ }, c = h && h.__generator || function(o, n) {
448
448
  var e = { label: 0, sent: function() {
449
449
  if (t[0] & 1) throw t[1];
450
450
  return t[1];
@@ -504,8 +504,8 @@ function ge() {
504
504
  return { value: i[0] ? i[1] : void 0, done: !0 };
505
505
  }
506
506
  };
507
- Object.defineProperty(g, "__esModule", { value: !0 }), g.useUnityContext = void 0;
508
- var a = h, y = ee(), v = _e(), b = we(), m = function(o) {
507
+ Object.defineProperty(h, "__esModule", { value: !0 }), h.useUnityContext = void 0;
508
+ var a = g, y = ee(), v = _e(), b = we(), m = function(o) {
509
509
  var n = (0, b.useNullableState)(), e = n[0], u = n[1], r = (0, a.useState)(0), t = r[0], d = r[1], f = (0, a.useState)(!1), s = f[0], i = f[1], U = (0, b.useNullableState)(), C = U[0], te = U[1], O = (0, v.useEventSystem)(), ne = (0, a.useRef)({
510
510
  setLoadingProgression: d,
511
511
  setInitialisationError: te,
@@ -606,23 +606,23 @@ function ge() {
606
606
  removeEventListener: O.removeEventListener
607
607
  };
608
608
  };
609
- return g.useUnityContext = m, g;
609
+ return h.useUnityContext = m, h;
610
610
  }
611
611
  var X;
612
- function he() {
612
+ function ge() {
613
613
  return X || (X = 1, function(l) {
614
614
  Object.defineProperty(l, "__esModule", { value: !0 }), l.useUnityContext = l.Unity = void 0;
615
615
  var c = be();
616
616
  Object.defineProperty(l, "Unity", { enumerable: !0, get: function() {
617
617
  return c.Unity;
618
618
  } });
619
- var a = ge();
619
+ var a = he();
620
620
  Object.defineProperty(l, "useUnityContext", { enumerable: !0, get: function() {
621
621
  return a.useUnityContext;
622
622
  } });
623
623
  }(j)), j;
624
624
  }
625
- var Y = he();
625
+ var Y = ge();
626
626
  const Le = ce.forwardRef(
627
627
  ({ className: l, gameLink: c, loadingComponent: a, registerEvents: y, onEventReceived: v }, b) => {
628
628
  const {
@@ -648,11 +648,11 @@ const Le = ce.forwardRef(
648
648
  const s = (i) => {
649
649
  v == null || v(f, i);
650
650
  };
651
- u(f, s), console.log("registered event", f), d.push({ key: f, event: s });
651
+ u(f, s), d.push({ key: f, event: s });
652
652
  }
653
653
  return t.current = [...t.current, ...d], () => {
654
654
  for (const { key: f, event: s } of t.current)
655
- console.log("unregistered event", s), r(f, s);
655
+ r(f, s);
656
656
  t.current = [];
657
657
  };
658
658
  }, [y, u, r, v]), B(() => {
package/dist/types.d.ts CHANGED
@@ -9,3 +9,6 @@ declare global {
9
9
  unityInstance: UnityInstance;
10
10
  }
11
11
  }
12
+ export declare enum EventName {
13
+ OPEN_GIFT_LINK = "openGiftLink"
14
+ }
package/dist/types.js CHANGED
@@ -1 +1,4 @@
1
-
1
+ var e = /* @__PURE__ */ ((r) => (r.OPEN_GIFT_LINK = "openGiftLink", r))(e || {});
2
+ export {
3
+ e as EventName
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promogame-player",
3
- "version": "0.0.21",
3
+ "version": "0.0.24",
4
4
  "type": "module",
5
5
  "main": "dist/main.js",
6
6
  "types": "dist/main.d.ts",