@thestatic-tv/dcl-sdk 2.11.0 → 2.11.1

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/dist/index.js CHANGED
@@ -3408,6 +3408,25 @@ function BlockedNotice(props) {
3408
3408
  );
3409
3409
  }
3410
3410
 
3411
+ // src/ui/trial-text.ts
3412
+ function trialHours(trialSparks) {
3413
+ if (typeof trialSparks !== "number" || !Number.isFinite(trialSparks) || trialSparks <= 0) return null;
3414
+ return Math.round(trialSparks / 60 * 10) / 10;
3415
+ }
3416
+ var hoursWord = (h) => h === 1 ? "hour" : "hours";
3417
+ function trialButtonText(trialSparks) {
3418
+ const h = trialHours(trialSparks);
3419
+ return h === null ? "Start Free Trial" : `Start Free ${h}-Hour Trial`;
3420
+ }
3421
+ function trialNoteText(trialSparks) {
3422
+ const h = trialHours(trialSparks);
3423
+ return h === null ? "One-time streaming trial" : `One-time trial \u2022 ${h} ${hoursWord(h)} of streaming`;
3424
+ }
3425
+ function trialActivatedText(hoursGranted) {
3426
+ const h = typeof hoursGranted === "number" && Number.isFinite(hoursGranted) && hoursGranted > 0 ? hoursGranted : null;
3427
+ return h === null ? "Streaming trial activated!" : `${h}-hour streaming trial activated!`;
3428
+ }
3429
+
3411
3430
  // src/utils/player-wait.ts
3412
3431
  var PLAYER_WAIT_STEP_MS = 1e3;
3413
3432
  var PLAYER_WAIT_MAX_MS = 30 * 1e3;
@@ -3910,12 +3929,12 @@ var AdminPanelUIModule = class {
3910
3929
  {
3911
3930
  uiTransform: { width: this.s(200), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
3912
3931
  uiBackground: { color: this.trialClaiming ? C2.btn : C2.green },
3913
- value: this.trialClaiming ? "Claiming..." : "Start Free 4-Hour Trial",
3932
+ value: this.trialClaiming ? "Claiming..." : trialButtonText(this.streamData?.trialSparks),
3914
3933
  fontSize: t.button,
3915
3934
  color: C2.text,
3916
3935
  onMouseDown: () => this.claimTrial()
3917
3936
  }
3918
- ), this.trialClaimError && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: this.trialClaimError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: "One-time trial \u2022 4 hours of streaming", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })), !this.streamData?.trialAvailable && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column" } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
3937
+ ), this.trialClaimError && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: this.trialClaimError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.Label, { value: trialNoteText(this.streamData?.trialSparks), fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })), !this.streamData?.trialAvailable && /* @__PURE__ */ import_react_ecs6.default.createElement(import_react_ecs6.UiEntity, { uiTransform: { flexDirection: "column" } }, /* @__PURE__ */ import_react_ecs6.default.createElement(
3919
3938
  import_react_ecs6.Button,
3920
3939
  {
3921
3940
  uiTransform: { width: this.s(170), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
@@ -5096,7 +5115,7 @@ var AdminPanelUIModule = class {
5096
5115
  this.log("Trial claimed:", data.channel);
5097
5116
  this.streamFetched = false;
5098
5117
  await this.fetchStreamData();
5099
- this.config.onBroadcast?.(`4-hour streaming trial activated!`);
5118
+ this.config.onBroadcast?.(trialActivatedText(data.trial?.hoursGranted));
5100
5119
  } else {
5101
5120
  this.trialClaimError = data.error || "Failed to claim trial";
5102
5121
  this.log("Trial claim failed:", data.error);
package/dist/index.mjs CHANGED
@@ -3357,6 +3357,25 @@ function BlockedNotice(props) {
3357
3357
  );
3358
3358
  }
3359
3359
 
3360
+ // src/ui/trial-text.ts
3361
+ function trialHours(trialSparks) {
3362
+ if (typeof trialSparks !== "number" || !Number.isFinite(trialSparks) || trialSparks <= 0) return null;
3363
+ return Math.round(trialSparks / 60 * 10) / 10;
3364
+ }
3365
+ var hoursWord = (h) => h === 1 ? "hour" : "hours";
3366
+ function trialButtonText(trialSparks) {
3367
+ const h = trialHours(trialSparks);
3368
+ return h === null ? "Start Free Trial" : `Start Free ${h}-Hour Trial`;
3369
+ }
3370
+ function trialNoteText(trialSparks) {
3371
+ const h = trialHours(trialSparks);
3372
+ return h === null ? "One-time streaming trial" : `One-time trial \u2022 ${h} ${hoursWord(h)} of streaming`;
3373
+ }
3374
+ function trialActivatedText(hoursGranted) {
3375
+ const h = typeof hoursGranted === "number" && Number.isFinite(hoursGranted) && hoursGranted > 0 ? hoursGranted : null;
3376
+ return h === null ? "Streaming trial activated!" : `${h}-hour streaming trial activated!`;
3377
+ }
3378
+
3360
3379
  // src/utils/player-wait.ts
3361
3380
  var PLAYER_WAIT_STEP_MS = 1e3;
3362
3381
  var PLAYER_WAIT_MAX_MS = 30 * 1e3;
@@ -3859,12 +3878,12 @@ var AdminPanelUIModule = class {
3859
3878
  {
3860
3879
  uiTransform: { width: this.s(200), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
3861
3880
  uiBackground: { color: this.trialClaiming ? C2.btn : C2.green },
3862
- value: this.trialClaiming ? "Claiming..." : "Start Free 4-Hour Trial",
3881
+ value: this.trialClaiming ? "Claiming..." : trialButtonText(this.streamData?.trialSparks),
3863
3882
  fontSize: t.button,
3864
3883
  color: C2.text,
3865
3884
  onMouseDown: () => this.claimTrial()
3866
3885
  }
3867
- ), this.trialClaimError && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: this.trialClaimError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: "One-time trial \u2022 4 hours of streaming", fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })), !this.streamData?.trialAvailable && /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column" } }, /* @__PURE__ */ ReactEcs6.createElement(
3886
+ ), this.trialClaimError && /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: this.trialClaimError, fontSize: t.status, color: C2.red }), /* @__PURE__ */ ReactEcs6.createElement(Label6, { value: trialNoteText(this.streamData?.trialSparks), fontSize: t.labelSmall, color: C2.textDim, uiTransform: { margin: { top: 4 } } })), !this.streamData?.trialAvailable && /* @__PURE__ */ ReactEcs6.createElement(UiEntity6, { uiTransform: { flexDirection: "column" } }, /* @__PURE__ */ ReactEcs6.createElement(
3868
3887
  Button4,
3869
3888
  {
3870
3889
  uiTransform: { width: this.s(170), height: this.s(UI_DIMENSIONS.admin.buttonHeight), margin: { bottom: 6 } },
@@ -5045,7 +5064,7 @@ var AdminPanelUIModule = class {
5045
5064
  this.log("Trial claimed:", data.channel);
5046
5065
  this.streamFetched = false;
5047
5066
  await this.fetchStreamData();
5048
- this.config.onBroadcast?.(`4-hour streaming trial activated!`);
5067
+ this.config.onBroadcast?.(trialActivatedText(data.trial?.hoursGranted));
5049
5068
  } else {
5050
5069
  this.trialClaimError = data.error || "Failed to claim trial";
5051
5070
  this.log("Trial claim failed:", data.error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thestatic-tv/dcl-sdk",
3
- "version": "2.11.0",
3
+ "version": "2.11.1",
4
4
  "description": "Connect your Decentraland scene to thestatic.tv - full channel lineup, metrics tracking, and interactions",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",