incyclist-services 1.9.28 → 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.
- package/lib/cjs/activities/ride/service.js +72 -33
- package/lib/cjs/base/dialogs/index.js +17 -0
- package/lib/cjs/base/dialogs/service.js +34 -0
- package/lib/cjs/base/dialogs/types.js +2 -0
- package/lib/cjs/settings/dialog/index.js +17 -0
- package/lib/cjs/settings/dialog/support/base/service.js +177 -0
- package/lib/cjs/settings/dialog/support/base/types.js +2 -0
- package/lib/cjs/settings/dialog/support/desktop/service.js +68 -0
- package/lib/cjs/settings/dialog/support/index.js +19 -0
- package/lib/cjs/settings/dialog/support/mobile/service.js +68 -0
- package/lib/cjs/settings/dialog/support/types.js +2 -0
- package/lib/cjs/settings/display/support/service.js +138 -21
- package/lib/cjs/settings/page/index.js +17 -0
- package/lib/cjs/settings/page/support/base/service.js +178 -0
- package/lib/cjs/settings/page/support/base/types.js +2 -0
- package/lib/cjs/settings/page/support/desktop/service.js +68 -0
- package/lib/cjs/settings/page/support/index.js +19 -0
- package/lib/cjs/settings/page/support/mobile/service.js +68 -0
- package/lib/cjs/settings/page/support/types.js +2 -0
- package/lib/cjs/settings/support/copy.js +48 -0
- package/lib/cjs/settings/support/donation.js +21 -0
- package/lib/cjs/settings/support/index.js +19 -0
- package/lib/cjs/settings/support/mailto.js +31 -0
- package/lib/cjs/settings/support/types.js +2 -0
- package/lib/cjs/settings/support/urls.js +27 -0
- package/lib/cjs/workouts/page/base/service.js +129 -1
- package/lib/cjs/workouts/page/desktop/service.js +57 -30
- package/lib/cjs/workouts/page/mobile/service.js +0 -121
- package/lib/esm/activities/ride/service.js +72 -33
- package/lib/esm/base/dialogs/index.js +1 -0
- package/lib/esm/base/dialogs/service.js +30 -0
- package/lib/esm/base/dialogs/types.js +1 -0
- package/lib/esm/settings/dialog/index.js +1 -0
- package/lib/esm/settings/dialog/support/base/service.js +174 -0
- package/lib/esm/settings/dialog/support/base/types.js +1 -0
- package/lib/esm/settings/dialog/support/desktop/service.js +65 -0
- package/lib/esm/settings/dialog/support/index.js +12 -0
- package/lib/esm/settings/dialog/support/mobile/service.js +65 -0
- package/lib/esm/settings/dialog/support/types.js +1 -0
- package/lib/esm/settings/display/support/dialog-types.js +1 -0
- package/lib/esm/settings/display/support/service.js +138 -21
- package/lib/esm/settings/page/index.js +1 -0
- package/lib/esm/settings/page/support/base/service.js +175 -0
- package/lib/esm/settings/page/support/base/types.js +1 -0
- package/lib/esm/settings/page/support/desktop/service.js +65 -0
- package/lib/esm/settings/page/support/index.js +12 -0
- package/lib/esm/settings/page/support/mobile/service.js +65 -0
- package/lib/esm/settings/page/support/types.js +1 -0
- package/lib/esm/settings/support/copy.js +43 -0
- package/lib/esm/settings/support/donation.js +16 -0
- package/lib/esm/settings/support/index.js +3 -0
- package/lib/esm/settings/support/mailto.js +27 -0
- package/lib/esm/settings/support/types.js +1 -0
- package/lib/esm/settings/support/urls.js +16 -0
- package/lib/esm/workouts/page/base/service.js +128 -0
- package/lib/esm/workouts/page/desktop/service.js +58 -31
- package/lib/esm/workouts/page/mobile/service.js +0 -121
- package/lib/types/activities/ride/index.d.ts +1 -0
- package/lib/types/activities/ride/service.d.ts +16 -4
- package/lib/types/activities/ride/types.d.ts +13 -0
- package/lib/types/base/dialogs/index.d.ts +2 -0
- package/lib/types/base/dialogs/service.d.ts +15 -0
- package/lib/types/base/dialogs/types.d.ts +6 -0
- package/lib/types/settings/dialog/index.d.ts +1 -0
- package/lib/types/settings/dialog/support/base/service.d.ts +22 -0
- package/lib/types/settings/dialog/support/base/types.d.ts +61 -0
- package/lib/types/settings/dialog/support/desktop/service.d.ts +6 -0
- package/lib/types/settings/dialog/support/index.d.ts +7 -0
- package/lib/types/settings/dialog/support/mobile/service.d.ts +6 -0
- package/lib/types/settings/dialog/support/types.d.ts +1 -0
- package/lib/types/settings/display/support/dialog-types.d.ts +61 -0
- package/lib/types/settings/display/support/index.d.ts +1 -0
- package/lib/types/settings/display/support/service.d.ts +11 -1
- package/lib/types/settings/display/support/types.d.ts +59 -0
- package/lib/types/settings/page/index.d.ts +1 -0
- package/lib/types/settings/page/support/base/service.d.ts +25 -0
- package/lib/types/settings/page/support/base/types.d.ts +68 -0
- package/lib/types/settings/page/support/desktop/service.d.ts +6 -0
- package/lib/types/settings/page/support/index.d.ts +7 -0
- package/lib/types/settings/page/support/mobile/service.d.ts +6 -0
- package/lib/types/settings/page/support/types.d.ts +1 -0
- package/lib/types/settings/support/copy.d.ts +43 -0
- package/lib/types/settings/support/donation.d.ts +4 -0
- package/lib/types/settings/support/index.d.ts +3 -0
- package/lib/types/settings/support/mailto.d.ts +14 -0
- package/lib/types/settings/support/types.d.ts +9 -0
- package/lib/types/settings/support/urls.d.ts +9 -0
- package/lib/types/workouts/page/base/service.d.ts +17 -2
- package/lib/types/workouts/page/base/types.d.ts +22 -0
- package/lib/types/workouts/page/desktop/service.d.ts +11 -6
- package/lib/types/workouts/page/desktop/types.d.ts +11 -6
- package/lib/types/workouts/page/mobile/service.d.ts +1 -21
- package/lib/types/workouts/page/mobile/types.d.ts +2 -20
- package/package.json +1 -1
|
@@ -40,12 +40,10 @@ const decorators_1 = require("../../../base/decorators");
|
|
|
40
40
|
const service_1 = require("../../../base/service");
|
|
41
41
|
const types_1 = require("../../../base/types");
|
|
42
42
|
const service_2 = require("../../service");
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const DEFAULT_GITHUB_URL = 'https://github.com/incyclist';
|
|
48
|
-
const DEFAULT_DONATION_URL = 'https://www.paypal.com/paypalme/incyclist';
|
|
43
|
+
const copy_1 = require("../../support/copy");
|
|
44
|
+
const donation_1 = require("../../support/donation");
|
|
45
|
+
const mailto_1 = require("../../support/mailto");
|
|
46
|
+
const urls_1 = require("../../support/urls");
|
|
49
47
|
let SupportSettingsDisplayService = (() => {
|
|
50
48
|
let _classDecorators = [decorators_1.Singleton];
|
|
51
49
|
let _classDescriptor;
|
|
@@ -74,29 +72,148 @@ let SupportSettingsDisplayService = (() => {
|
|
|
74
72
|
super('SupportSettings');
|
|
75
73
|
}
|
|
76
74
|
open() {
|
|
77
|
-
|
|
78
|
-
this.
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
try {
|
|
76
|
+
if (this.observer)
|
|
77
|
+
this.close();
|
|
78
|
+
this.observer = new types_1.Observer();
|
|
79
|
+
this.safeLog({ message: 'support settings opened', mode: (0, donation_1.getDonationMode)(this.getBindings()) });
|
|
80
|
+
return this.observer;
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
this.logError(err, 'open');
|
|
84
|
+
}
|
|
81
85
|
}
|
|
82
86
|
close() {
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
try {
|
|
88
|
+
if (!this.observer)
|
|
89
|
+
return;
|
|
90
|
+
this.observer.stop();
|
|
91
|
+
delete this.observer;
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
this.logError(err, 'close');
|
|
95
|
+
}
|
|
85
96
|
}
|
|
86
97
|
getDisplayProps() {
|
|
98
|
+
try {
|
|
99
|
+
return {
|
|
100
|
+
uuid: this.getUserSettings().get('uuid', null),
|
|
101
|
+
appVersion: this.getAppInfo().getAppVersion(),
|
|
102
|
+
uiVersion: this.getAppInfo().getUIVersion(),
|
|
103
|
+
privacyUrl: (0, urls_1.getPrivacyUrl)(),
|
|
104
|
+
supportUrls: [
|
|
105
|
+
{ label: 'Slack', text: 'Incyclist Slack Workspace', url: (0, urls_1.getSlackUrl)() },
|
|
106
|
+
{ label: 'Strava', text: 'Incyclist Strava Club', url: (0, urls_1.getStravaUrl)() },
|
|
107
|
+
{ label: 'Email', text: (0, urls_1.getSupportEmail)(), url: `mailto:${(0, urls_1.getSupportEmail)()}` },
|
|
108
|
+
],
|
|
109
|
+
gitHubUrl: (0, urls_1.getGitHubUrl)(),
|
|
110
|
+
donationUrl: (0, urls_1.getDonationUrl)(),
|
|
111
|
+
appInfo: this.buildAppInfo(),
|
|
112
|
+
helpTitle: copy_1.COPY.helpTitle,
|
|
113
|
+
helpLinks: this.buildHelpLinks(),
|
|
114
|
+
donation: this.buildDonation(),
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
this.logError(err, 'getDisplayProps');
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
onLinkClicked(id) {
|
|
122
|
+
this.safeLog({ message: 'support link clicked', link: id });
|
|
123
|
+
}
|
|
124
|
+
onDonationClicked(id) {
|
|
125
|
+
this.safeLog({ message: 'donation link clicked', donationChannel: id, mode: (0, donation_1.getDonationMode)(this.getBindings()), source: 'settings' });
|
|
126
|
+
}
|
|
127
|
+
onEmailOpenResult(result, error) {
|
|
128
|
+
const event = { message: 'support email opened', openResult: result };
|
|
129
|
+
if (result === 'failed' && error !== undefined)
|
|
130
|
+
event.error = String(error).replace(/mailto:\S*/gi, 'mailto:<redacted>').slice(0, 200);
|
|
131
|
+
this.safeLog(event);
|
|
132
|
+
}
|
|
133
|
+
onDetailsCopied(trigger, result) {
|
|
134
|
+
this.safeLog({ message: 'support details copied', trigger, copyResult: result });
|
|
135
|
+
}
|
|
136
|
+
safeLog(event) {
|
|
137
|
+
try {
|
|
138
|
+
this.logEvent(event);
|
|
139
|
+
}
|
|
140
|
+
catch { }
|
|
141
|
+
}
|
|
142
|
+
isDesktop() {
|
|
143
|
+
const channel = this.getAppInfo().getChannel();
|
|
144
|
+
return channel === 'desktop' || channel === 'web';
|
|
145
|
+
}
|
|
146
|
+
buildAppInfo() {
|
|
147
|
+
const appInfo = this.getAppInfo();
|
|
148
|
+
const appVersion = appInfo.getAppVersion();
|
|
149
|
+
const uiVersion = appInfo.getUIVersion();
|
|
87
150
|
return {
|
|
151
|
+
title: copy_1.COPY.appInfoTitle,
|
|
152
|
+
appVersion,
|
|
153
|
+
uiVersion,
|
|
154
|
+
uuid: this.getUserSettings().get('uuid', null),
|
|
155
|
+
privacyUrl: (0, urls_1.getPrivacyUrl)(),
|
|
156
|
+
labels: {
|
|
157
|
+
appVersion: copy_1.COPY.appVersionLabel,
|
|
158
|
+
uiVersion: copy_1.COPY.uiVersionLabel,
|
|
159
|
+
uuid: copy_1.COPY.uuidLabel,
|
|
160
|
+
privacy: copy_1.COPY.privacyLabel,
|
|
161
|
+
privacyLink: copy_1.COPY.privacyLinkLabel,
|
|
162
|
+
},
|
|
163
|
+
compactVersionText: (0, copy_1.compactVersionText)(appVersion, uiVersion),
|
|
164
|
+
uuidActionLabel: this.isDesktop() ? copy_1.COPY.uuidCopyAction : copy_1.COPY.uuidShareAction,
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
buildHelpLinks() {
|
|
168
|
+
const appInfo = this.getAppInfo();
|
|
169
|
+
const desktop = this.isDesktop();
|
|
170
|
+
const mail = (0, mailto_1.buildSupportEmail)({
|
|
171
|
+
address: (0, urls_1.getSupportEmail)(),
|
|
88
172
|
uuid: this.getUserSettings().get('uuid', null),
|
|
89
|
-
appVersion:
|
|
90
|
-
uiVersion:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
173
|
+
appVersion: appInfo.getAppVersion(),
|
|
174
|
+
uiVersion: appInfo.getUIVersion(),
|
|
175
|
+
});
|
|
176
|
+
return [
|
|
177
|
+
{ id: 'strava', label: copy_1.COPY.stravaLabel, shortLabel: copy_1.COPY.stravaShortLabel, url: (0, urls_1.getStravaUrl)() },
|
|
178
|
+
{ id: 'slack', label: copy_1.COPY.slackLabel, shortLabel: copy_1.COPY.slackShortLabel, url: (0, urls_1.getSlackUrl)() },
|
|
179
|
+
{
|
|
180
|
+
id: 'email', label: mail.address, shortLabel: copy_1.COPY.emailShortLabel, url: mail.url,
|
|
181
|
+
email: {
|
|
182
|
+
address: mail.address,
|
|
183
|
+
subject: mail.subject,
|
|
184
|
+
body: mail.body,
|
|
185
|
+
copyText: mail.copyText,
|
|
186
|
+
copyLabel: desktop ? copy_1.COPY.copyDetailsLabel : copy_1.COPY.shareDetailsLabel,
|
|
187
|
+
copiedMessage: desktop ? (0, copy_1.copiedMessage)(mail.address) : undefined,
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
];
|
|
191
|
+
}
|
|
192
|
+
buildDonation() {
|
|
193
|
+
const mode = (0, donation_1.getDonationMode)(this.getBindings());
|
|
194
|
+
const base = {
|
|
195
|
+
title: copy_1.COPY.donationTitle,
|
|
196
|
+
promise: copy_1.COPY.promise,
|
|
197
|
+
mode,
|
|
198
|
+
note: copy_1.COPY.note,
|
|
199
|
+
otherHelpLinks: [
|
|
200
|
+
{ id: 'strava', label: copy_1.COPY.stravaLabel, url: (0, urls_1.getStravaUrl)() },
|
|
201
|
+
{ id: 'github', label: copy_1.COPY.gitHubLabel, url: (0, urls_1.getGitHubUrl)() },
|
|
96
202
|
],
|
|
97
|
-
gitHubUrl: process.env.GITHUB_URL ?? DEFAULT_GITHUB_URL,
|
|
98
|
-
donationUrl: process.env.DONATION_URL ?? DEFAULT_DONATION_URL
|
|
99
203
|
};
|
|
204
|
+
if (mode === 'website') {
|
|
205
|
+
const url = (0, urls_1.getSupportPageUrl)();
|
|
206
|
+
return { ...base, channels: [], websiteLink: { label: copy_1.COPY.websiteLabel, url, host: this.getHost(url) } };
|
|
207
|
+
}
|
|
208
|
+
return { ...base, fundsText: copy_1.COPY.fundsText, channels: (0, donation_1.getDonationChannels)() };
|
|
209
|
+
}
|
|
210
|
+
getHost(url) {
|
|
211
|
+
try {
|
|
212
|
+
return new URL(url).host;
|
|
213
|
+
}
|
|
214
|
+
catch {
|
|
215
|
+
return url;
|
|
216
|
+
}
|
|
100
217
|
}
|
|
101
218
|
getAppInfo() {
|
|
102
219
|
return this.getBindings().appInfo;
|
|
@@ -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,178 @@
|
|
|
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.SupportSettingsPageService = void 0;
|
|
38
|
+
const service_1 = require("../../../../base/pages/service");
|
|
39
|
+
const decorators_1 = require("../../../../base/decorators");
|
|
40
|
+
const types_1 = require("../../../../base/types");
|
|
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 SupportSettingsPageService = (() => {
|
|
47
|
+
let _classSuper = service_1.IncyclistPageService;
|
|
48
|
+
let _instanceExtraInitializers = [];
|
|
49
|
+
let _getUserSettings_decorators;
|
|
50
|
+
return class SupportSettingsPageService extends _classSuper {
|
|
51
|
+
static {
|
|
52
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
53
|
+
_getUserSettings_decorators = [decorators_1.Injectable];
|
|
54
|
+
__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);
|
|
55
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
56
|
+
}
|
|
57
|
+
dialogObserver = __runInitializers(this, _instanceExtraInitializers);
|
|
58
|
+
constructor() {
|
|
59
|
+
super('supportSettings');
|
|
60
|
+
}
|
|
61
|
+
openPage() {
|
|
62
|
+
this.dialogObserver?.stop();
|
|
63
|
+
this.dialogObserver = new types_1.Observer();
|
|
64
|
+
return this.dialogObserver;
|
|
65
|
+
}
|
|
66
|
+
closePage() {
|
|
67
|
+
this.dialogObserver?.stop();
|
|
68
|
+
delete this.dialogObserver;
|
|
69
|
+
}
|
|
70
|
+
getPageObserver() {
|
|
71
|
+
return this.dialogObserver;
|
|
72
|
+
}
|
|
73
|
+
getPageDisplayProps() {
|
|
74
|
+
return {
|
|
75
|
+
appInfo: this.buildAppInfo(),
|
|
76
|
+
helpTitle: copy_1.COPY.helpTitle,
|
|
77
|
+
helpLinks: this.buildHelpLinks(),
|
|
78
|
+
donation: this.buildDonation(),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
onLinkClicked(id) {
|
|
82
|
+
this.safeLog({ message: 'support link clicked', link: id });
|
|
83
|
+
}
|
|
84
|
+
onDonationClicked(id) {
|
|
85
|
+
this.safeLog({ message: 'donation link clicked', donationChannel: id, mode: (0, donation_1.getDonationMode)(this.getBindings()), source: 'settings' });
|
|
86
|
+
}
|
|
87
|
+
onEmailOpenResult(result, error) {
|
|
88
|
+
const event = { message: 'support email opened', openResult: result };
|
|
89
|
+
if (result === 'failed' && error !== undefined)
|
|
90
|
+
event.error = String(error).replace(/mailto:\S*/gi, 'mailto:<redacted>').slice(0, 200);
|
|
91
|
+
this.safeLog(event);
|
|
92
|
+
}
|
|
93
|
+
onDetailsCopied(trigger, result) {
|
|
94
|
+
this.safeLog({ message: 'support details copied', trigger, copyResult: result });
|
|
95
|
+
}
|
|
96
|
+
safeLog(event) {
|
|
97
|
+
try {
|
|
98
|
+
this.logEvent(event);
|
|
99
|
+
}
|
|
100
|
+
catch { }
|
|
101
|
+
}
|
|
102
|
+
buildAppInfo() {
|
|
103
|
+
const appInfo = this.getBindings().appInfo;
|
|
104
|
+
const appVersion = appInfo.getAppVersion();
|
|
105
|
+
const uiVersion = appInfo.getUIVersion();
|
|
106
|
+
return {
|
|
107
|
+
title: copy_1.COPY.appInfoTitle,
|
|
108
|
+
appVersion,
|
|
109
|
+
uiVersion,
|
|
110
|
+
uuid: this.getUserSettings().get('uuid', null),
|
|
111
|
+
privacyUrl: (0, urls_1.getPrivacyUrl)(),
|
|
112
|
+
labels: {
|
|
113
|
+
appVersion: copy_1.COPY.appVersionLabel,
|
|
114
|
+
uiVersion: copy_1.COPY.uiVersionLabel,
|
|
115
|
+
uuid: copy_1.COPY.uuidLabel,
|
|
116
|
+
privacy: copy_1.COPY.privacyLabel,
|
|
117
|
+
privacyLink: copy_1.COPY.privacyLinkLabel,
|
|
118
|
+
},
|
|
119
|
+
compactVersionText: (0, copy_1.compactVersionText)(appVersion, uiVersion),
|
|
120
|
+
uuidActionLabel: this.getUuidActionLabel(),
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
buildHelpLinks() {
|
|
124
|
+
const appInfo = this.getBindings().appInfo;
|
|
125
|
+
const mail = (0, mailto_1.buildSupportEmail)({
|
|
126
|
+
address: (0, urls_1.getSupportEmail)(),
|
|
127
|
+
uuid: this.getUserSettings().get('uuid', null),
|
|
128
|
+
appVersion: appInfo.getAppVersion(),
|
|
129
|
+
uiVersion: appInfo.getUIVersion(),
|
|
130
|
+
});
|
|
131
|
+
return [
|
|
132
|
+
{ id: 'strava', label: copy_1.COPY.stravaLabel, shortLabel: copy_1.COPY.stravaShortLabel, url: (0, urls_1.getStravaUrl)() },
|
|
133
|
+
{ id: 'slack', label: copy_1.COPY.slackLabel, shortLabel: copy_1.COPY.slackShortLabel, url: (0, urls_1.getSlackUrl)() },
|
|
134
|
+
{
|
|
135
|
+
id: 'email', label: mail.address, shortLabel: copy_1.COPY.emailShortLabel, url: mail.url,
|
|
136
|
+
email: {
|
|
137
|
+
address: mail.address,
|
|
138
|
+
subject: mail.subject,
|
|
139
|
+
body: mail.body,
|
|
140
|
+
copyText: mail.copyText,
|
|
141
|
+
copyLabel: this.getCopyLabel(),
|
|
142
|
+
copiedMessage: this.getCopiedMessage(mail.address),
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
];
|
|
146
|
+
}
|
|
147
|
+
buildDonation() {
|
|
148
|
+
const mode = (0, donation_1.getDonationMode)(this.getBindings());
|
|
149
|
+
const base = {
|
|
150
|
+
title: copy_1.COPY.donationTitle,
|
|
151
|
+
promise: copy_1.COPY.promise,
|
|
152
|
+
mode,
|
|
153
|
+
note: copy_1.COPY.note,
|
|
154
|
+
otherHelpLinks: [
|
|
155
|
+
{ id: 'strava', label: copy_1.COPY.stravaLabel, url: (0, urls_1.getStravaUrl)() },
|
|
156
|
+
{ id: 'github', label: copy_1.COPY.gitHubLabel, url: (0, urls_1.getGitHubUrl)() },
|
|
157
|
+
],
|
|
158
|
+
};
|
|
159
|
+
if (mode === 'website') {
|
|
160
|
+
const url = (0, urls_1.getSupportPageUrl)();
|
|
161
|
+
return { ...base, channels: [], websiteLink: { label: copy_1.COPY.websiteLabel, url, host: this.getHost(url) } };
|
|
162
|
+
}
|
|
163
|
+
return { ...base, fundsText: copy_1.COPY.fundsText, channels: (0, donation_1.getDonationChannels)() };
|
|
164
|
+
}
|
|
165
|
+
getHost(url) {
|
|
166
|
+
try {
|
|
167
|
+
return new URL(url).host;
|
|
168
|
+
}
|
|
169
|
+
catch {
|
|
170
|
+
return url;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
getUserSettings() {
|
|
174
|
+
return (0, service_2.useUserSettings)();
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
})();
|
|
178
|
+
exports.SupportSettingsPageService = SupportSettingsPageService;
|
|
@@ -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.DesktopSupportSettingsPageService = 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 DesktopSupportSettingsPageService = (() => {
|
|
42
|
+
let _classDecorators = [decorators_1.Singleton];
|
|
43
|
+
let _classDescriptor;
|
|
44
|
+
let _classExtraInitializers = [];
|
|
45
|
+
let _classThis;
|
|
46
|
+
let _classSuper = service_1.SupportSettingsPageService;
|
|
47
|
+
var DesktopSupportSettingsPageService = 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
|
+
DesktopSupportSettingsPageService = _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 DesktopSupportSettingsPageService = _classThis;
|
|
67
|
+
})();
|
|
68
|
+
exports.DesktopSupportSettingsPageService = DesktopSupportSettingsPageService;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSupportSettingsPageService = exports.MobileSupportSettingsPageService = exports.DesktopSupportSettingsPageService = exports.SupportSettingsPageService = 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, "SupportSettingsPageService", { enumerable: true, get: function () { return service_3.SupportSettingsPageService; } });
|
|
9
|
+
var service_4 = require("./desktop/service");
|
|
10
|
+
Object.defineProperty(exports, "DesktopSupportSettingsPageService", { enumerable: true, get: function () { return service_4.DesktopSupportSettingsPageService; } });
|
|
11
|
+
var service_5 = require("./mobile/service");
|
|
12
|
+
Object.defineProperty(exports, "MobileSupportSettingsPageService", { enumerable: true, get: function () { return service_5.MobileSupportSettingsPageService; } });
|
|
13
|
+
const getSupportSettingsPageService = () => {
|
|
14
|
+
const channel = (0, api_1.getBindings)().appInfo.getChannel();
|
|
15
|
+
if (channel === 'desktop' || channel === 'web')
|
|
16
|
+
return new service_1.DesktopSupportSettingsPageService();
|
|
17
|
+
return new service_2.MobileSupportSettingsPageService();
|
|
18
|
+
};
|
|
19
|
+
exports.getSupportSettingsPageService = getSupportSettingsPageService;
|
|
@@ -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.MobileSupportSettingsPageService = 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 MobileSupportSettingsPageService = (() => {
|
|
42
|
+
let _classDecorators = [decorators_1.Singleton];
|
|
43
|
+
let _classDescriptor;
|
|
44
|
+
let _classExtraInitializers = [];
|
|
45
|
+
let _classThis;
|
|
46
|
+
let _classSuper = service_1.SupportSettingsPageService;
|
|
47
|
+
var MobileSupportSettingsPageService = 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
|
+
MobileSupportSettingsPageService = _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 MobileSupportSettingsPageService = _classThis;
|
|
67
|
+
})();
|
|
68
|
+
exports.MobileSupportSettingsPageService = MobileSupportSettingsPageService;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EMAIL_COPY = exports.copiedMessage = exports.compactVersionText = exports.COPY = void 0;
|
|
4
|
+
exports.COPY = {
|
|
5
|
+
appInfoTitle: 'App info',
|
|
6
|
+
helpTitle: 'Need help?',
|
|
7
|
+
donationTitle: 'Support Incyclist',
|
|
8
|
+
promise: 'Incyclist is free and stays free. There is no subscription and nothing to unlock.',
|
|
9
|
+
fundsText: "If you'd like to help, donations pay for the server, app-store fees and code signing.",
|
|
10
|
+
note: 'Donating is entirely voluntary and changes nothing in the app. You can also help by answering questions in the Strava club or contributing on GitHub.',
|
|
11
|
+
paypalLabel: 'PayPal',
|
|
12
|
+
paypalSubLabel: 'one-time',
|
|
13
|
+
sponsorsLabel: 'GitHub Sponsors',
|
|
14
|
+
sponsorsSubLabel: 'one-time or monthly',
|
|
15
|
+
websiteLabel: 'Ways to support Incyclist ↗',
|
|
16
|
+
stravaLabel: 'Incyclist Strava Club',
|
|
17
|
+
stravaShortLabel: 'Strava club',
|
|
18
|
+
slackLabel: 'Incyclist Slack Workspace',
|
|
19
|
+
slackShortLabel: 'Slack',
|
|
20
|
+
emailShortLabel: 'Email',
|
|
21
|
+
gitHubLabel: 'GitHub',
|
|
22
|
+
copyDetailsLabel: 'Copy details',
|
|
23
|
+
shareDetailsLabel: 'Share details',
|
|
24
|
+
appVersionLabel: 'App version',
|
|
25
|
+
uiVersionLabel: 'UI version',
|
|
26
|
+
uuidLabel: 'uuid',
|
|
27
|
+
privacyLabel: 'Privacy',
|
|
28
|
+
privacyLinkLabel: 'Privacy Statement',
|
|
29
|
+
uuidCopyAction: 'Copy',
|
|
30
|
+
uuidShareAction: 'Share',
|
|
31
|
+
summaryText: "Incyclist is free and stays free. If you'd like to help with server and app-store costs:",
|
|
32
|
+
summaryShortText: 'Incyclist is free and stays free. Like to help with costs?',
|
|
33
|
+
hideLabel: 'Hide',
|
|
34
|
+
};
|
|
35
|
+
const compactVersionText = (appVersion, uiVersion) => `Version: App ${appVersion} · UI ${uiVersion}`;
|
|
36
|
+
exports.compactVersionText = compactVersionText;
|
|
37
|
+
const copiedMessage = (address) => `Copied. Paste it into an email to ${address}.`;
|
|
38
|
+
exports.copiedMessage = copiedMessage;
|
|
39
|
+
exports.EMAIL_COPY = {
|
|
40
|
+
subject: 'Incyclist support request',
|
|
41
|
+
greeting: 'Hello,',
|
|
42
|
+
prompt: '[Describe your problem here. What did you do, and what happened?]',
|
|
43
|
+
divider: '--------------------------------------------',
|
|
44
|
+
keepNote: 'Please keep the details below. They help us find your logs.',
|
|
45
|
+
uuidLabel: 'uuid',
|
|
46
|
+
appVersionLabel: 'App version',
|
|
47
|
+
uiVersionLabel: 'UI version',
|
|
48
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDonationChannels = exports.getDonationMode = void 0;
|
|
4
|
+
const api_1 = require("../../api");
|
|
5
|
+
const copy_1 = require("./copy");
|
|
6
|
+
const urls_1 = require("./urls");
|
|
7
|
+
const getDonationMode = (bindings = (0, api_1.getBindings)()) => {
|
|
8
|
+
try {
|
|
9
|
+
const platform = bindings?.appInfo?.getOS()?.platform;
|
|
10
|
+
return platform === 'ios' ? 'website' : 'direct';
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return 'direct';
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
exports.getDonationMode = getDonationMode;
|
|
17
|
+
const getDonationChannels = () => [
|
|
18
|
+
{ id: 'paypal', label: copy_1.COPY.paypalLabel, subLabel: copy_1.COPY.paypalSubLabel, url: (0, urls_1.getDonationUrl)(), primary: true },
|
|
19
|
+
{ id: 'github-sponsors', label: copy_1.COPY.sponsorsLabel, subLabel: copy_1.COPY.sponsorsSubLabel, url: (0, urls_1.getSponsorUrl)(), primary: false },
|
|
20
|
+
];
|
|
21
|
+
exports.getDonationChannels = getDonationChannels;
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./urls"), exports);
|
|
18
|
+
__exportStar(require("./donation"), exports);
|
|
19
|
+
__exportStar(require("./mailto"), exports);
|