incyclist-services 1.9.29 → 1.9.30

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.
Files changed (82) hide show
  1. package/lib/cjs/activities/ride/service.js +72 -33
  2. package/lib/cjs/base/dialogs/index.js +17 -0
  3. package/lib/cjs/base/dialogs/service.js +34 -0
  4. package/lib/cjs/base/dialogs/types.js +2 -0
  5. package/lib/cjs/settings/dialog/index.js +17 -0
  6. package/lib/cjs/settings/dialog/support/base/service.js +177 -0
  7. package/lib/cjs/settings/dialog/support/base/types.js +2 -0
  8. package/lib/cjs/settings/dialog/support/desktop/service.js +68 -0
  9. package/lib/cjs/settings/dialog/support/index.js +19 -0
  10. package/lib/cjs/settings/dialog/support/mobile/service.js +68 -0
  11. package/lib/cjs/settings/dialog/support/types.js +2 -0
  12. package/lib/cjs/settings/display/support/service.js +138 -21
  13. package/lib/cjs/settings/page/index.js +17 -0
  14. package/lib/cjs/settings/page/support/base/service.js +178 -0
  15. package/lib/cjs/settings/page/support/base/types.js +2 -0
  16. package/lib/cjs/settings/page/support/desktop/service.js +68 -0
  17. package/lib/cjs/settings/page/support/index.js +19 -0
  18. package/lib/cjs/settings/page/support/mobile/service.js +68 -0
  19. package/lib/cjs/settings/page/support/types.js +2 -0
  20. package/lib/cjs/settings/support/copy.js +48 -0
  21. package/lib/cjs/settings/support/donation.js +21 -0
  22. package/lib/cjs/settings/support/index.js +19 -0
  23. package/lib/cjs/settings/support/mailto.js +31 -0
  24. package/lib/cjs/settings/support/types.js +2 -0
  25. package/lib/cjs/settings/support/urls.js +27 -0
  26. package/lib/esm/activities/ride/service.js +72 -33
  27. package/lib/esm/base/dialogs/index.js +1 -0
  28. package/lib/esm/base/dialogs/service.js +30 -0
  29. package/lib/esm/base/dialogs/types.js +1 -0
  30. package/lib/esm/settings/dialog/index.js +1 -0
  31. package/lib/esm/settings/dialog/support/base/service.js +174 -0
  32. package/lib/esm/settings/dialog/support/base/types.js +1 -0
  33. package/lib/esm/settings/dialog/support/desktop/service.js +65 -0
  34. package/lib/esm/settings/dialog/support/index.js +12 -0
  35. package/lib/esm/settings/dialog/support/mobile/service.js +65 -0
  36. package/lib/esm/settings/dialog/support/types.js +1 -0
  37. package/lib/esm/settings/display/support/dialog-types.js +1 -0
  38. package/lib/esm/settings/display/support/service.js +138 -21
  39. package/lib/esm/settings/page/index.js +1 -0
  40. package/lib/esm/settings/page/support/base/service.js +175 -0
  41. package/lib/esm/settings/page/support/base/types.js +1 -0
  42. package/lib/esm/settings/page/support/desktop/service.js +65 -0
  43. package/lib/esm/settings/page/support/index.js +12 -0
  44. package/lib/esm/settings/page/support/mobile/service.js +65 -0
  45. package/lib/esm/settings/page/support/types.js +1 -0
  46. package/lib/esm/settings/support/copy.js +43 -0
  47. package/lib/esm/settings/support/donation.js +16 -0
  48. package/lib/esm/settings/support/index.js +3 -0
  49. package/lib/esm/settings/support/mailto.js +27 -0
  50. package/lib/esm/settings/support/types.js +1 -0
  51. package/lib/esm/settings/support/urls.js +16 -0
  52. package/lib/types/activities/ride/index.d.ts +1 -0
  53. package/lib/types/activities/ride/service.d.ts +16 -4
  54. package/lib/types/activities/ride/types.d.ts +13 -0
  55. package/lib/types/base/dialogs/index.d.ts +2 -0
  56. package/lib/types/base/dialogs/service.d.ts +15 -0
  57. package/lib/types/base/dialogs/types.d.ts +6 -0
  58. package/lib/types/settings/dialog/index.d.ts +1 -0
  59. package/lib/types/settings/dialog/support/base/service.d.ts +22 -0
  60. package/lib/types/settings/dialog/support/base/types.d.ts +61 -0
  61. package/lib/types/settings/dialog/support/desktop/service.d.ts +6 -0
  62. package/lib/types/settings/dialog/support/index.d.ts +7 -0
  63. package/lib/types/settings/dialog/support/mobile/service.d.ts +6 -0
  64. package/lib/types/settings/dialog/support/types.d.ts +1 -0
  65. package/lib/types/settings/display/support/dialog-types.d.ts +61 -0
  66. package/lib/types/settings/display/support/index.d.ts +1 -0
  67. package/lib/types/settings/display/support/service.d.ts +11 -1
  68. package/lib/types/settings/display/support/types.d.ts +59 -0
  69. package/lib/types/settings/page/index.d.ts +1 -0
  70. package/lib/types/settings/page/support/base/service.d.ts +25 -0
  71. package/lib/types/settings/page/support/base/types.d.ts +68 -0
  72. package/lib/types/settings/page/support/desktop/service.d.ts +6 -0
  73. package/lib/types/settings/page/support/index.d.ts +7 -0
  74. package/lib/types/settings/page/support/mobile/service.d.ts +6 -0
  75. package/lib/types/settings/page/support/types.d.ts +1 -0
  76. package/lib/types/settings/support/copy.d.ts +43 -0
  77. package/lib/types/settings/support/donation.d.ts +4 -0
  78. package/lib/types/settings/support/index.d.ts +3 -0
  79. package/lib/types/settings/support/mailto.d.ts +14 -0
  80. package/lib/types/settings/support/types.d.ts +9 -0
  81. package/lib/types/settings/support/urls.d.ts +9 -0
  82. package/package.json +1 -1
@@ -48,6 +48,8 @@ const incyclist_devices_1 = require("incyclist-devices");
48
48
  const devices_1 = require("../../devices");
49
49
  const base_1 = require("../base");
50
50
  const uuid_1 = require("uuid");
51
+ const copy_1 = require("../../settings/support/copy");
52
+ const donation_1 = require("../../settings/support/donation");
51
53
  const workouts_1 = require("../../workouts");
52
54
  const route_1 = require("../../routes/base/utils/route");
53
55
  const route_2 = require("../../routes/base/model/route");
@@ -64,6 +66,12 @@ const i18n_1 = require("../../i18n");
64
66
  const utils_3 = require("../list/utils");
65
67
  const sleep_1 = require("../../utils/sleep");
66
68
  const SAVE_INTERVAL = 5000;
69
+ const DAY = 24 * 60 * 60 * 1000;
70
+ const DONATE_CLICKED_PAUSE = 365 * DAY;
71
+ const DONATE_SHOWN_PAUSE = 30 * DAY;
72
+ const DONATE_MIN_TIME = 600;
73
+ const DONATE_MIN_DISTANCE = 2000;
74
+ const DONATE_MIN_ACTIVITIES = 10;
67
75
  let ActivityRideService = (() => {
68
76
  let _classDecorators = [types_1.Singleton];
69
77
  let _classDescriptor;
@@ -99,7 +107,7 @@ let ActivityRideService = (() => {
99
107
  prevEmit;
100
108
  saveObserver;
101
109
  isSaveDone;
102
- isDonateShown;
110
+ donateDecision;
103
111
  isSummaryShown;
104
112
  stopPromise;
105
113
  statsCalculator;
@@ -172,7 +180,7 @@ let ActivityRideService = (() => {
172
180
  this.tsStart = Date.now();
173
181
  this.tsPauseStart = undefined;
174
182
  this.isSaveDone = false;
175
- this.isDonateShown = false;
183
+ this.donateDecision = undefined;
176
184
  this.isSummaryShown = false;
177
185
  this.logEvent({ message: 'activity started', sport: this.activity.sport ?? 'cycling' });
178
186
  this.startWorker();
@@ -452,6 +460,7 @@ let ActivityRideService = (() => {
452
460
  this.logEvent({ message: 'activity summary shown', showSave, showContinue, showMap, showWorkoutSummary, fileLink: this.activity?.fitFileName });
453
461
  }
454
462
  this.isSummaryShown = true;
463
+ const donation = this.buildDonation();
455
464
  const props = {
456
465
  activity: (0, utils_3.createUIActivityDetails)(this.activity),
457
466
  showSave,
@@ -460,7 +469,8 @@ let ActivityRideService = (() => {
460
469
  showMap,
461
470
  showWorkoutSummary,
462
471
  workoutGraph,
463
- showDonate: this.canShowDonate(),
472
+ donation,
473
+ showDonate: !!donation,
464
474
  preview,
465
475
  units: this.getUnitConverter().getDefaultUnits()
466
476
  };
@@ -501,43 +511,72 @@ let ActivityRideService = (() => {
501
511
  }
502
512
  canShowDonate() {
503
513
  try {
504
- if (this.isDonateShown) {
505
- return true;
506
- }
507
- const trialGroup = 'A';
508
- if (this.saveObserver || this.isSaveDone || trialGroup === 'B') {
509
- const lastClicked = this.getUserSettings().getValue('state.donateClicked', 0);
510
- if (Date.now() - lastClicked < 1000 * 60 * 60 * 24 * 365) {
511
- if (this.saveObserver)
512
- this.logEvent({ message: 'donate check ', showDonate: false, lastClicked: new Date(lastClicked).toISOString() });
513
- return false;
514
- }
515
- const lastShown = this.getUserSettings().getValue('state.donateShown', 0);
516
- if (Date.now() - lastShown < 1000 * 60 * 60 * 24 * 14) {
517
- if (this.saveObserver)
518
- this.logEvent({ message: 'donate check ', showDonate: false, lastClicked: new Date(lastShown).toISOString() });
519
- return false;
520
- }
521
- const activities = this.getRepo().getAll();
522
- const lastYear = new Date();
523
- lastYear.setFullYear(lastYear.getFullYear() - 1);
524
- const activitiesLastYear = activities.filter(a => a.summary?.startTime > lastYear.getTime() && a.summary?.distance > 2000);
525
- if (this.saveObserver)
526
- this.logEvent({ message: 'donate check ', trialGroup, showDonate: activitiesLastYear?.length >= 10, activities: activitiesLastYear?.length });
527
- if (activitiesLastYear.length < 10)
528
- return false;
529
- this.getUserSettings().set('state.donateShown', Date.now());
530
- this.isDonateShown = true;
531
- return true;
532
- }
514
+ if (this.donateDecision !== undefined)
515
+ return this.donateDecision;
516
+ const mode = (0, donation_1.getDonationMode)();
517
+ if (mode === 'website')
518
+ return this.setDonateDecision(false, { mode, reason: 'website-mode' });
519
+ if (!this.isSaveDone)
520
+ return undefined;
521
+ const { reason, activities } = this.getDonateBlockReason();
522
+ if (reason)
523
+ return this.setDonateDecision(false, { mode, reason, activities });
524
+ this.getUserSettings().set('state.donateShown', Date.now());
525
+ this.logEvent({ message: 'donate shown', mode, activities });
526
+ return this.setDonateDecision(true, { mode, activities });
533
527
  }
534
528
  catch (err) {
535
529
  this.logError(err, 'canShowDonate');
536
530
  }
537
531
  return false;
538
532
  }
539
- onDonateClicked() {
533
+ setDonateDecision(showDonate, info) {
534
+ this.donateDecision = showDonate;
535
+ const event = { message: 'donate check', showDonate, mode: info.mode };
536
+ if (info.reason !== undefined)
537
+ event.reason = info.reason;
538
+ if (info.activities !== undefined)
539
+ event.activities = info.activities;
540
+ this.logEvent(event);
541
+ return showDonate;
542
+ }
543
+ getDonateBlockReason() {
544
+ const settings = this.getUserSettings();
545
+ const now = Date.now();
546
+ if (settings.getValue('state.donateHidden', 0))
547
+ return { reason: 'hidden' };
548
+ if (now - settings.getValue('state.donateClicked', 0) < DONATE_CLICKED_PAUSE)
549
+ return { reason: 'clicked' };
550
+ if (now - settings.getValue('state.donateShown', 0) < DONATE_SHOWN_PAUSE)
551
+ return { reason: 'recently-shown' };
552
+ if ((this.activity?.time ?? 0) < DONATE_MIN_TIME || (this.activity?.distance ?? 0) < DONATE_MIN_DISTANCE)
553
+ return { reason: 'short-ride' };
554
+ const lastYear = new Date();
555
+ lastYear.setFullYear(lastYear.getFullYear() - 1);
556
+ const activities = this.getRepo().getAll()
557
+ .filter(a => a.summary?.startTime > lastYear.getTime() && a.summary?.distance > DONATE_MIN_DISTANCE).length;
558
+ if (activities < DONATE_MIN_ACTIVITIES)
559
+ return { reason: 'usage', activities };
560
+ return { activities };
561
+ }
562
+ buildDonation() {
563
+ if (this.canShowDonate() !== true)
564
+ return undefined;
565
+ return {
566
+ text: copy_1.COPY.summaryText,
567
+ shortText: copy_1.COPY.summaryShortText,
568
+ links: (0, donation_1.getDonationChannels)().map(c => ({ id: c.id, label: c.label, url: c.url })),
569
+ hideLabel: copy_1.COPY.hideLabel,
570
+ };
571
+ }
572
+ onDonateClicked(channelId) {
540
573
  this.getUserSettings().set('state.donateClicked', Date.now());
574
+ this.logEvent({ message: 'donate clicked', donationChannel: channelId ?? 'unknown', source: 'summary' });
575
+ }
576
+ onDonateHidden() {
577
+ this.getUserSettings().set('state.donateHidden', Date.now());
578
+ this.donateDecision = false;
579
+ this.logEvent({ message: 'donate hidden', source: 'summary' });
541
580
  }
542
581
  getActivity() {
543
582
  return this.activity;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./service"), exports);
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IncyclistDialogService = void 0;
4
+ const service_1 = require("../service");
5
+ const types_1 = require("../types");
6
+ class IncyclistDialogService extends service_1.IncyclistService {
7
+ name;
8
+ dialogObserver;
9
+ constructor(name) {
10
+ super(name);
11
+ this.name = name;
12
+ }
13
+ openDialog(..._args) {
14
+ this.stopDialogObserver();
15
+ this.dialogObserver = new types_1.Observer();
16
+ return this.dialogObserver;
17
+ }
18
+ closeDialog() {
19
+ this.stopDialogObserver();
20
+ }
21
+ getDialogObserver() {
22
+ return this.dialogObserver;
23
+ }
24
+ emitDialogUpdate() {
25
+ this.dialogObserver?.emit('dialog-update', this.getDialogDisplayProps());
26
+ }
27
+ stopDialogObserver() {
28
+ if (this.dialogObserver) {
29
+ this.dialogObserver.stop();
30
+ delete this.dialogObserver;
31
+ }
32
+ }
33
+ }
34
+ exports.IncyclistDialogService = IncyclistDialogService;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./support"), exports);
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
3
+ var useValue = arguments.length > 2;
4
+ for (var i = 0; i < initializers.length; i++) {
5
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
6
+ }
7
+ return useValue ? value : void 0;
8
+ };
9
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
10
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
11
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
12
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
13
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
14
+ var _, done = false;
15
+ for (var i = decorators.length - 1; i >= 0; i--) {
16
+ var context = {};
17
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
18
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
19
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
20
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
21
+ if (kind === "accessor") {
22
+ if (result === void 0) continue;
23
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
24
+ if (_ = accept(result.get)) descriptor.get = _;
25
+ if (_ = accept(result.set)) descriptor.set = _;
26
+ if (_ = accept(result.init)) initializers.unshift(_);
27
+ }
28
+ else if (_ = accept(result)) {
29
+ if (kind === "field") initializers.unshift(_);
30
+ else descriptor[key] = _;
31
+ }
32
+ }
33
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
34
+ done = true;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.SupportSettingsDialogService = void 0;
38
+ const service_1 = require("../../../../base/dialogs/service");
39
+ const decorators_1 = require("../../../../base/decorators");
40
+ const api_1 = require("../../../../api");
41
+ const service_2 = require("../../../service");
42
+ const copy_1 = require("../../../support/copy");
43
+ const donation_1 = require("../../../support/donation");
44
+ const mailto_1 = require("../../../support/mailto");
45
+ const urls_1 = require("../../../support/urls");
46
+ let SupportSettingsDialogService = (() => {
47
+ let _classSuper = service_1.IncyclistDialogService;
48
+ let _instanceExtraInitializers = [];
49
+ let _getBindings_decorators;
50
+ let _getUserSettings_decorators;
51
+ return class SupportSettingsDialogService extends _classSuper {
52
+ static {
53
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
54
+ _getBindings_decorators = [decorators_1.Injectable];
55
+ _getUserSettings_decorators = [decorators_1.Injectable];
56
+ __esDecorate(this, null, _getBindings_decorators, { kind: "method", name: "getBindings", static: false, private: false, access: { has: obj => "getBindings" in obj, get: obj => obj.getBindings }, metadata: _metadata }, null, _instanceExtraInitializers);
57
+ __esDecorate(this, null, _getUserSettings_decorators, { kind: "method", name: "getUserSettings", static: false, private: false, access: { has: obj => "getUserSettings" in obj, get: obj => obj.getUserSettings }, metadata: _metadata }, null, _instanceExtraInitializers);
58
+ if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
59
+ }
60
+ constructor() {
61
+ super('SupportSettingsDialog');
62
+ __runInitializers(this, _instanceExtraInitializers);
63
+ }
64
+ openDialog() {
65
+ const observer = super.openDialog();
66
+ this.safeLog({ message: 'support settings opened', mode: (0, donation_1.getDonationMode)(this.getBindings()) });
67
+ return observer;
68
+ }
69
+ getDialogDisplayProps() {
70
+ return {
71
+ appInfo: this.buildAppInfo(),
72
+ helpTitle: copy_1.COPY.helpTitle,
73
+ helpLinks: this.buildHelpLinks(),
74
+ donation: this.buildDonation(),
75
+ };
76
+ }
77
+ onLinkClicked(id) {
78
+ this.safeLog({ message: 'support link clicked', link: id });
79
+ }
80
+ onDonationClicked(id) {
81
+ this.safeLog({ message: 'donation link clicked', donationChannel: id, mode: (0, donation_1.getDonationMode)(this.getBindings()), source: 'settings' });
82
+ }
83
+ onEmailOpenResult(result, error) {
84
+ const event = { message: 'support email opened', openResult: result };
85
+ if (result === 'failed' && error !== undefined)
86
+ event.error = String(error).replace(/mailto:\S*/gi, 'mailto:<redacted>').slice(0, 200);
87
+ this.safeLog(event);
88
+ }
89
+ onDetailsCopied(trigger, result) {
90
+ this.safeLog({ message: 'support details copied', trigger, copyResult: result });
91
+ }
92
+ safeLog(event) {
93
+ try {
94
+ this.logEvent(event);
95
+ }
96
+ catch { }
97
+ }
98
+ buildAppInfo() {
99
+ const appInfo = this.getBindings().appInfo;
100
+ const appVersion = appInfo.getAppVersion();
101
+ const uiVersion = appInfo.getUIVersion();
102
+ return {
103
+ title: copy_1.COPY.appInfoTitle,
104
+ appVersion,
105
+ uiVersion,
106
+ uuid: this.getUserSettings().get('uuid', null),
107
+ privacyUrl: (0, urls_1.getPrivacyUrl)(),
108
+ labels: {
109
+ appVersion: copy_1.COPY.appVersionLabel,
110
+ uiVersion: copy_1.COPY.uiVersionLabel,
111
+ uuid: copy_1.COPY.uuidLabel,
112
+ privacy: copy_1.COPY.privacyLabel,
113
+ privacyLink: copy_1.COPY.privacyLinkLabel,
114
+ },
115
+ compactVersionText: (0, copy_1.compactVersionText)(appVersion, uiVersion),
116
+ uuidActionLabel: this.getUuidActionLabel(),
117
+ };
118
+ }
119
+ buildHelpLinks() {
120
+ const appInfo = this.getBindings().appInfo;
121
+ const mail = (0, mailto_1.buildSupportEmail)({
122
+ address: (0, urls_1.getSupportEmail)(),
123
+ uuid: this.getUserSettings().get('uuid', null),
124
+ appVersion: appInfo.getAppVersion(),
125
+ uiVersion: appInfo.getUIVersion(),
126
+ });
127
+ return [
128
+ { id: 'strava', label: copy_1.COPY.stravaLabel, shortLabel: copy_1.COPY.stravaShortLabel, url: (0, urls_1.getStravaUrl)() },
129
+ { id: 'slack', label: copy_1.COPY.slackLabel, shortLabel: copy_1.COPY.slackShortLabel, url: (0, urls_1.getSlackUrl)() },
130
+ {
131
+ id: 'email', label: mail.address, shortLabel: copy_1.COPY.emailShortLabel, url: mail.url,
132
+ email: {
133
+ address: mail.address,
134
+ subject: mail.subject,
135
+ body: mail.body,
136
+ copyText: mail.copyText,
137
+ copyLabel: this.getCopyLabel(),
138
+ copiedMessage: this.getCopiedMessage(mail.address),
139
+ }
140
+ },
141
+ ];
142
+ }
143
+ buildDonation() {
144
+ const mode = (0, donation_1.getDonationMode)(this.getBindings());
145
+ const base = {
146
+ title: copy_1.COPY.donationTitle,
147
+ promise: copy_1.COPY.promise,
148
+ mode,
149
+ note: copy_1.COPY.note,
150
+ otherHelpLinks: [
151
+ { id: 'strava', label: copy_1.COPY.stravaLabel, url: (0, urls_1.getStravaUrl)() },
152
+ { id: 'github', label: copy_1.COPY.gitHubLabel, url: (0, urls_1.getGitHubUrl)() },
153
+ ],
154
+ };
155
+ if (mode === 'website') {
156
+ const url = (0, urls_1.getSupportPageUrl)();
157
+ return { ...base, channels: [], websiteLink: { label: copy_1.COPY.websiteLabel, url, host: this.getHost(url) } };
158
+ }
159
+ return { ...base, fundsText: copy_1.COPY.fundsText, channels: (0, donation_1.getDonationChannels)() };
160
+ }
161
+ getHost(url) {
162
+ try {
163
+ return new URL(url).host;
164
+ }
165
+ catch {
166
+ return url;
167
+ }
168
+ }
169
+ getBindings() {
170
+ return (0, api_1.getBindings)();
171
+ }
172
+ getUserSettings() {
173
+ return (0, service_2.useUserSettings)();
174
+ }
175
+ };
176
+ })();
177
+ exports.SupportSettingsDialogService = SupportSettingsDialogService;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.DesktopSupportSettingsDialogService = void 0;
38
+ const decorators_1 = require("../../../../base/decorators");
39
+ const copy_1 = require("../../../support/copy");
40
+ const service_1 = require("../base/service");
41
+ let DesktopSupportSettingsDialogService = (() => {
42
+ let _classDecorators = [decorators_1.Singleton];
43
+ let _classDescriptor;
44
+ let _classExtraInitializers = [];
45
+ let _classThis;
46
+ let _classSuper = service_1.SupportSettingsDialogService;
47
+ var DesktopSupportSettingsDialogService = class extends _classSuper {
48
+ static { _classThis = this; }
49
+ static {
50
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
51
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
52
+ DesktopSupportSettingsDialogService = _classThis = _classDescriptor.value;
53
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
54
+ __runInitializers(_classThis, _classExtraInitializers);
55
+ }
56
+ getCopyLabel() {
57
+ return copy_1.COPY.copyDetailsLabel;
58
+ }
59
+ getUuidActionLabel() {
60
+ return copy_1.COPY.uuidCopyAction;
61
+ }
62
+ getCopiedMessage(address) {
63
+ return (0, copy_1.copiedMessage)(address);
64
+ }
65
+ };
66
+ return DesktopSupportSettingsDialogService = _classThis;
67
+ })();
68
+ exports.DesktopSupportSettingsDialogService = DesktopSupportSettingsDialogService;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSupportSettingsDialogService = exports.MobileSupportSettingsDialogService = exports.DesktopSupportSettingsDialogService = exports.SupportSettingsDialogService = void 0;
4
+ const api_1 = require("../../../api");
5
+ const service_1 = require("./desktop/service");
6
+ const service_2 = require("./mobile/service");
7
+ var service_3 = require("./base/service");
8
+ Object.defineProperty(exports, "SupportSettingsDialogService", { enumerable: true, get: function () { return service_3.SupportSettingsDialogService; } });
9
+ var service_4 = require("./desktop/service");
10
+ Object.defineProperty(exports, "DesktopSupportSettingsDialogService", { enumerable: true, get: function () { return service_4.DesktopSupportSettingsDialogService; } });
11
+ var service_5 = require("./mobile/service");
12
+ Object.defineProperty(exports, "MobileSupportSettingsDialogService", { enumerable: true, get: function () { return service_5.MobileSupportSettingsDialogService; } });
13
+ const getSupportSettingsDialogService = () => {
14
+ const channel = (0, api_1.getBindings)().appInfo.getChannel();
15
+ if (channel === 'desktop' || channel === 'web')
16
+ return new service_1.DesktopSupportSettingsDialogService();
17
+ return new service_2.MobileSupportSettingsDialogService();
18
+ };
19
+ exports.getSupportSettingsDialogService = getSupportSettingsDialogService;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
3
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
4
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
5
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
6
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
7
+ var _, done = false;
8
+ for (var i = decorators.length - 1; i >= 0; i--) {
9
+ var context = {};
10
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
11
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
12
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
13
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
14
+ if (kind === "accessor") {
15
+ if (result === void 0) continue;
16
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
17
+ if (_ = accept(result.get)) descriptor.get = _;
18
+ if (_ = accept(result.set)) descriptor.set = _;
19
+ if (_ = accept(result.init)) initializers.unshift(_);
20
+ }
21
+ else if (_ = accept(result)) {
22
+ if (kind === "field") initializers.unshift(_);
23
+ else descriptor[key] = _;
24
+ }
25
+ }
26
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
27
+ done = true;
28
+ };
29
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
30
+ var useValue = arguments.length > 2;
31
+ for (var i = 0; i < initializers.length; i++) {
32
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
33
+ }
34
+ return useValue ? value : void 0;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.MobileSupportSettingsDialogService = void 0;
38
+ const decorators_1 = require("../../../../base/decorators");
39
+ const copy_1 = require("../../../support/copy");
40
+ const service_1 = require("../base/service");
41
+ let MobileSupportSettingsDialogService = (() => {
42
+ let _classDecorators = [decorators_1.Singleton];
43
+ let _classDescriptor;
44
+ let _classExtraInitializers = [];
45
+ let _classThis;
46
+ let _classSuper = service_1.SupportSettingsDialogService;
47
+ var MobileSupportSettingsDialogService = class extends _classSuper {
48
+ static { _classThis = this; }
49
+ static {
50
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
51
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
52
+ MobileSupportSettingsDialogService = _classThis = _classDescriptor.value;
53
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
54
+ __runInitializers(_classThis, _classExtraInitializers);
55
+ }
56
+ getCopyLabel() {
57
+ return copy_1.COPY.shareDetailsLabel;
58
+ }
59
+ getUuidActionLabel() {
60
+ return copy_1.COPY.uuidShareAction;
61
+ }
62
+ getCopiedMessage(_address) {
63
+ return undefined;
64
+ }
65
+ };
66
+ return MobileSupportSettingsDialogService = _classThis;
67
+ })();
68
+ exports.MobileSupportSettingsDialogService = MobileSupportSettingsDialogService;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });