@fasttrack-solutions/rewards 1.49.2 → 1.63.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.
- package/README.md +5 -2
- package/dist/chunks/{mini-game-engine-DYOSZNtK.js → mini-game-engine-O_zWW_gc.js} +15 -15
- package/dist/chunks/preview-data-DMBoY-6D.js +667 -0
- package/dist/chunks/sdkCallback-DWIZY_7s.js +10124 -0
- package/dist/rewards.js +8542 -6164
- package/package.json +2 -2
- package/dist/chunks/sdkCallback-DyNHkCK2.js +0 -11239
package/README.md
CHANGED
|
@@ -143,7 +143,8 @@ Everything goes under `window.fasttrack`:
|
|
|
143
143
|
| Event on `window` | When |
|
|
144
144
|
| --- | --- |
|
|
145
145
|
| `ft-rewards-ready` | Rewards started and is on for this player. |
|
|
146
|
-
| `ft-config-error` | The start stopped, or Rewards was turned off for this player. `event.detail.reason` is `'disabled'` (Rewards is off for this player) or `'unauthenticated'` (the backend refused the token). An event without a `reason` means the start failed; only that is an error, and `window.ftRewardsError.reason` is then `'failed'`. |
|
|
146
|
+
| `ft-config-error` | The start stopped, or Rewards was turned off for this player. `event.detail.reason` is `'disabled'` (Rewards is off for this player) or `'unauthenticated'` (the backend refused the token). An event without a `reason` means the start failed; only that is an error, and `window.ftRewardsError.reason` is then `'failed'`. For a player the backend does not know yet, it fires only when the SDK stops waiting for them, after 3 minutes. |
|
|
147
|
+
| `ft-rewards-pending` | The backend does not know the player yet: the CRM has not processed their registration, which is common right after sign-up. Not an error: widgets show their loading state and the SDK tries again by itself about every 30 s (a hidden page once it shows), firing this event each time with `detail: { reason: 'player_not_ready', retryInMs }`. `ft-rewards-ready` follows once the player is known, so there is no need to start Rewards again. The last try runs 3 minutes after the first one; if the player is still unknown then, `ft-config-error` fires. A player whose Rewards is already on screen keeps it, and this event does not fire. |
|
|
147
148
|
| `ft-rewards-signed-out` | The player logged out. |
|
|
148
149
|
|
|
149
150
|
To open or close the rewards modal from your own code, dispatch `show-my-rewards` or `close-my-rewards` on `window`, for example `window.dispatchEvent(new CustomEvent('show-my-rewards'))`. They are commands, not notifications: closing the modal with its close button or Escape fires neither.
|
|
@@ -193,7 +194,9 @@ elements and the events stay the same.
|
|
|
193
194
|
The SDK adds its styles as `<style>` elements, so it needs `style-src 'unsafe-inline'`.
|
|
194
195
|
`connect-src` must allow your Fast Track API URL and its WebSocket, `img-src` the hosts your
|
|
195
196
|
operators put reward images on (and `https://crm-lib.fasttrack-solutions.com` for a few default
|
|
196
|
-
images), and `frame-src` the host of the mini games.
|
|
197
|
+
images), and `frame-src` the host of the mini games. Custom games, once your operators use them,
|
|
198
|
+
open in a frame from a short-lived signed link to your Fast Track instance's storage
|
|
199
|
+
(`https://<bucket>.s3.<region>.amazonaws.com`), so `frame-src` must allow that host too.
|
|
197
200
|
|
|
198
201
|
## What still leaves your site
|
|
199
202
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as e, ti as t } from "./sdkCallback-DWIZY_7s.js";
|
|
2
2
|
//#region node_modules/.pnpm/gsap@3.15.0/node_modules/gsap/gsap-core.js
|
|
3
3
|
function n(e) {
|
|
4
4
|
if (e === void 0) throw ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
@@ -1852,7 +1852,7 @@ function gi(e) {
|
|
|
1852
1852
|
let n = t.match(/^([a-z]+)\.(easeIn|easeOut|easeInOut)$/i);
|
|
1853
1853
|
return n ? `${n[1].toLowerCase()}.${n[2].replace("ease", "").replace("InOut", "inOut").replace("In", "in").replace("Out", "out")}` : t;
|
|
1854
1854
|
}
|
|
1855
|
-
function Q(
|
|
1855
|
+
function Q(t, n) {
|
|
1856
1856
|
let r = {
|
|
1857
1857
|
canvasId: "canvas",
|
|
1858
1858
|
centerX: null,
|
|
@@ -1882,16 +1882,16 @@ function Q(e, n) {
|
|
|
1882
1882
|
wheelImage: null,
|
|
1883
1883
|
imageDirection: "N"
|
|
1884
1884
|
};
|
|
1885
|
-
for (var a in r)
|
|
1886
|
-
if (
|
|
1885
|
+
for (var a in r) t != null && t[a] !== void 0 ? this[a] = t[a] : this[a] = r[a];
|
|
1886
|
+
if (t != null) for (var a in t) this[a] === void 0 && (this[a] = t[a]);
|
|
1887
1887
|
if (this.canvasId) {
|
|
1888
1888
|
let e = this.canvasId === "wheel" ? "ft-wheel-customizable" : "ft-wheel-legacy";
|
|
1889
1889
|
this.canvas = document.getElementById(this.canvasId) || document.querySelector("ft-wheel-component")?.shadowRoot?.querySelector(e)?.shadowRoot?.getElementById(this.canvasId), this.canvas ? (this.centerX ??= this.canvas.width / 2, this.centerY ??= this.canvas.height / 2, this.outerRadius ?? (this.canvas.width < this.canvas.height ? this.outerRadius = this.canvas.width / 2 - this.lineWidth : this.outerRadius = this.canvas.height / 2 - this.lineWidth), this.ctx = this.canvas.getContext("2d")) : (this.canvas = null, this.ctx = null);
|
|
1890
1890
|
} else this.cavnas = null, this.ctx = null;
|
|
1891
1891
|
this.segments = [null];
|
|
1892
|
-
for (let
|
|
1893
|
-
if (this.updateSegmentSizes(), this.textMargin === null && (this.textMargin = this.textFontSize / 1.7),
|
|
1894
|
-
else if (this.drawMode == "segmentImage") for ($ = this, Ci = !1, y = 1; y <= this.numSegments; y++) this.segments[y].image !== null && (this.segments[y].imgData = new Image(), this.segments[y].imgData.onload =
|
|
1892
|
+
for (let e = 1; e <= this.numSegments; e++) t != null && t.segments && t.segments[e - 1] !== void 0 ? this.segments[e] = new yi(t.segments[e - 1]) : this.segments[e] = new yi();
|
|
1893
|
+
if (this.updateSegmentSizes(), this.textMargin === null && (this.textMargin = this.textFontSize / 1.7), t != null && t.animation && t.animation !== void 0 ? this.animation = new vi(t.animation) : this.animation = new vi(), t != null && t.pins && t.pins !== void 0 && (this.pins = new _i(t.pins)), this.drawMode == "image" || this.drawMode == "segmentImage" ? (t.fillStyle === void 0 && (this.fillStyle = null), t.strokeStyle === void 0 && (this.strokeStyle = "red"), t.drawText === void 0 && (this.drawText = !1), t.lineWidth === void 0 && (this.lineWidth = 1), n === void 0 && (n = !1)) : n === void 0 && (n = !0), t != null && t.pointerGuide && t.pointerGuide !== void 0 ? this.pointerGuide = new bi(t.pointerGuide) : this.pointerGuide = new bi(), n == 1) this.draw(this.clearTheCanvas);
|
|
1894
|
+
else if (this.drawMode == "segmentImage") for ($ = this, Ci = !1, y = 1; y <= this.numSegments; y++) this.segments[y].image !== null && (this.segments[y].imgData = new Image(), this.segments[y].imgData.onload = e(wi), this.segments[y].imgData.src = this.segments[y].image);
|
|
1895
1895
|
}
|
|
1896
1896
|
Q.prototype.updateSegmentSizes = function() {
|
|
1897
1897
|
if (this.segments) {
|
|
@@ -2062,12 +2062,12 @@ Q.prototype.updateSegmentSizes = function() {
|
|
|
2062
2062
|
}, Q.prototype.startAnimation = function() {
|
|
2063
2063
|
if (this.animation) {
|
|
2064
2064
|
this.computeAnimation(), $ = this;
|
|
2065
|
-
var
|
|
2066
|
-
if (this.animation.propertyName && (
|
|
2067
|
-
let
|
|
2068
|
-
this.animation.easing =
|
|
2065
|
+
var t = {};
|
|
2066
|
+
if (this.animation.propertyName && (t[this.animation.propertyName] = this.animation.propertyValue), t.yoyo = this.animation.yoyo, t.repeat = this.animation.repeat, t.overwrite = "auto", this.animation.easing) {
|
|
2067
|
+
let e = gi(this.animation.easing);
|
|
2068
|
+
this.animation.easing = e, t.ease = e;
|
|
2069
2069
|
}
|
|
2070
|
-
|
|
2070
|
+
t.onUpdate = e(xi), t.onComplete = e(Si), typeof this.animation.onRepeat == "function" && (t.onRepeat = this.animation.onRepeat), this.tween = mi.to(this, this.animation.duration, t);
|
|
2071
2071
|
}
|
|
2072
2072
|
}, Q.prototype.stopAnimation = function(e) {
|
|
2073
2073
|
$ && ($.tween && $.tween.kill(), Si(e)), $ = this;
|
|
@@ -2144,8 +2144,8 @@ function yi(e) {
|
|
|
2144
2144
|
if (e != null) for (var n in e) this[n] === void 0 && (this[n] = e[n]);
|
|
2145
2145
|
this.startAngle = 0, this.endAngle = 0;
|
|
2146
2146
|
}
|
|
2147
|
-
yi.prototype.changeImage = function(
|
|
2148
|
-
this.image =
|
|
2147
|
+
yi.prototype.changeImage = function(t, n) {
|
|
2148
|
+
this.image = t, this.imgData = null, n && (this.imageDirection = n), Ci = !1, this.imgData = new Image(), this.imgData.onload = e(wi), this.imgData.src = this.image;
|
|
2149
2149
|
};
|
|
2150
2150
|
function bi(e) {
|
|
2151
2151
|
let t = {
|
|
@@ -2172,7 +2172,7 @@ function wi() {
|
|
|
2172
2172
|
}
|
|
2173
2173
|
//#endregion
|
|
2174
2174
|
//#region src/core/runtime/sdkCallback.engine.ts
|
|
2175
|
-
var Ti = (/* @__PURE__ */
|
|
2175
|
+
var Ti = (/* @__PURE__ */ t(((e) => {
|
|
2176
2176
|
(function() {
|
|
2177
2177
|
var t = function() {
|
|
2178
2178
|
this.init();
|