@innspel/core 0.2.1 → 0.4.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 +11 -0
- package/dist/index.cjs +102 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -4
- package/dist/index.d.ts +31 -4
- package/dist/index.js +102 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -353,11 +353,17 @@ interface InnspelOptions {
|
|
|
353
353
|
/** Tidsavbrudd per kall i millisekunder. Standard 10 000 (wireframe 2i). */
|
|
354
354
|
timeoutMs?: number;
|
|
355
355
|
}
|
|
356
|
-
/**
|
|
356
|
+
/**
|
|
357
|
+
* Leietakerens innstillinger slik klienten kjenner dem. Starter som opsjonene fra
|
|
358
|
+
* `init()` (strammest mulig uten dem), og oppdateres av `loadSettings()` fra
|
|
359
|
+
* `GET /v1/ingest/config` (M2.5) — samme objekt, så en holdt referanse følger med.
|
|
360
|
+
*/
|
|
357
361
|
interface ResolvedSettings {
|
|
358
362
|
textMaxLength: TextMaxLength;
|
|
359
363
|
minTextLength: number;
|
|
360
364
|
screenshotsEnabled: boolean;
|
|
365
|
+
/** Leietakerens personvernerklæring — «hva samles inn». Finnes først etter `loadSettings()`. */
|
|
366
|
+
privacyUrl?: string;
|
|
361
367
|
}
|
|
362
368
|
/**
|
|
363
369
|
* Bildet slik verten gir det fra seg — Blob (React Native og nettleser),
|
|
@@ -500,12 +506,20 @@ interface InnspelClient {
|
|
|
500
506
|
readonly version: string;
|
|
501
507
|
/** `true` når `identityProvider` er `null` — innsendinger kan ikke følges opp. */
|
|
502
508
|
readonly isAnonymous: boolean;
|
|
503
|
-
/** Leietakerens grenser slik klienten kjenner dem. */
|
|
509
|
+
/** Leietakerens grenser slik klienten kjenner dem. Oppdateres på plass av {@link loadSettings}. */
|
|
504
510
|
readonly settings: ResolvedSettings;
|
|
505
511
|
/** Konteksten som følger hver innsending, med `sdkVersion` satt av kjernen. */
|
|
506
512
|
readonly context: ContextInput & {
|
|
507
513
|
sdkVersion: string;
|
|
508
514
|
};
|
|
515
|
+
/**
|
|
516
|
+
* Henter leietakerens klientkonfigurasjon (`GET /v1/ingest/config`, M2.5): tegngrense,
|
|
517
|
+
* minste antall tegn, skjermbilde og personvernlenke — det verten ellers måtte
|
|
518
|
+
* duplisere i `init()`. Kalles av widgeten ved åpning, aldri ved oppstart (DD-41).
|
|
519
|
+
* Svarer ikke kallet, beholdes det klienten alt har: konfigurasjonen er et tilbud,
|
|
520
|
+
* aldri en sperre. Returnerer `settings` — samme objekt, oppdatert.
|
|
521
|
+
*/
|
|
522
|
+
loadSettings(): Promise<ResolvedSettings>;
|
|
509
523
|
capture(input: CaptureInput): Promise<CaptureResult>;
|
|
510
524
|
readonly knownIssues: {
|
|
511
525
|
/** Kortene som vises FØR feltet i feilsporet (DD-03). Feiler oppslaget, er lista tom. */
|
|
@@ -519,7 +533,20 @@ interface InnspelClient {
|
|
|
519
533
|
status(submissionId: string): Promise<SubmissionsSubmissionStatusView>;
|
|
520
534
|
};
|
|
521
535
|
readonly programs: {
|
|
536
|
+
/** Alt om betaprogram for innsenderen i ett kall: invitasjoner til banneret (DD-12), deltakelser til fanen, og oppfølginger som venter. */
|
|
522
537
|
list(): Promise<ProgramsMyPrograms>;
|
|
538
|
+
/**
|
|
539
|
+
* Aksepterer invitasjonen etter forventningsavklaringen (DD-13, DD-32).
|
|
540
|
+
* Tokenet kom fra leietakerens egen kanal — plattformen sender aldri (DD-12).
|
|
541
|
+
* Er det brukt, utløpt eller utstedt til noen andre, kommer 404
|
|
542
|
+
* `invitation_invalid`. Gjentak fra samme innsender er trygt: svaret er den
|
|
543
|
+
* samme deltakelsen.
|
|
544
|
+
*/
|
|
545
|
+
accept(invitationToken: string): Promise<ProgramsParticipationView>;
|
|
546
|
+
/** Avslår invitasjonen. Ingen årsak spørres. Et nei etter ja er {@link withdraw}, ikke avslag. */
|
|
547
|
+
decline(invitationToken: string): Promise<void>;
|
|
548
|
+
/** «Gå ut» (DD-36): umiddelbart, alltid tilgjengelig, og aldri en straff. Idempotent. */
|
|
549
|
+
withdraw(participationId: string): Promise<ProgramsParticipationView>;
|
|
523
550
|
};
|
|
524
551
|
readonly attachments: {
|
|
525
552
|
/**
|
|
@@ -728,6 +755,6 @@ declare function dekkerAlt(rekter: readonly MaskRect[], bilde: {
|
|
|
728
755
|
* ikke kan lese JSON, og `test/versjon.test.ts` holder den i takt med
|
|
729
756
|
* `package.json`.
|
|
730
757
|
*/
|
|
731
|
-
declare const VERSJON = "0.
|
|
758
|
+
declare const VERSJON = "0.4.0";
|
|
732
759
|
|
|
733
|
-
export { type AttachmentBody, type AttachmentInput, type SubmissionsAttachmentMime as AttachmentMime, type AttachmentOutcome, type SubmissionsAttachmentView as AttachmentView, type CaptureFeil, type CaptureInput, type CaptureOnske, type CaptureResult, type ContextInput, type CommonCorrelation as Correlation, type CommonErrorCode as ErrorCode, type FlushResult, type IdentityProvider, InnspelApiError, type InnspelClient, InnspelConfigError, type InnspelOptions, InnspelQueueFullError, type InnspelStorage, KONTEKST_FELTER, KO_TAK, type KnownIssuesKnownIssueCard as KnownIssueCard, type KnownIssueQuery, type SubmissionsKnownIssueRef as KnownIssueRef, type KnownIssuesKnownIssueStatus as KnownIssueStatus, type MaskPoint, type MaskRect, type ProgramsMyPrograms as MyPrograms, type MySubmission, type OpenFeedbackOptions, type PatternFinding, type PatternKind, type CommonPlatform as Platform, type Presenter, type QueuedSubmission, type SubmissionsReasonCode as ReasonCode, type SubmissionsReplyView as ReplyView, type ResolvedSettings, type SubmissionsStatusType as StatusType, type SubmissionsSubmissionStatus as SubmissionStatus, type SubmissionsSubmissionStatusView as SubmissionStatusView, type SubmissionsSubmissionType as SubmissionType, TILLATTE_MIME, type Telemetry, type TelemetryEvent, type TextMaxLength, VEDLEGG_GRENSER, VERSJON, dekkerAlt, init, klipp, scanText, skaler, strokTilRekter, treffer, trykkTilRekt };
|
|
760
|
+
export { type AttachmentBody, type AttachmentInput, type SubmissionsAttachmentMime as AttachmentMime, type AttachmentOutcome, type SubmissionsAttachmentView as AttachmentView, type CaptureFeil, type CaptureInput, type CaptureOnske, type CaptureResult, type ContextInput, type CommonCorrelation as Correlation, type CommonErrorCode as ErrorCode, type FlushResult, type IdentityProvider, InnspelApiError, type InnspelClient, InnspelConfigError, type InnspelOptions, InnspelQueueFullError, type InnspelStorage, type ProgramsInvitationView as InvitationView, KONTEKST_FELTER, KO_TAK, type KnownIssuesKnownIssueCard as KnownIssueCard, type KnownIssueQuery, type SubmissionsKnownIssueRef as KnownIssueRef, type KnownIssuesKnownIssueStatus as KnownIssueStatus, type MaskPoint, type MaskRect, type ProgramsMyPrograms as MyPrograms, type MySubmission, type OpenFeedbackOptions, type ProgramsParticipationView as ParticipationView, type PatternFinding, type PatternKind, type CommonPlatform as Platform, type Presenter, type ProgramsTask as ProgramTask, type ProgramsProgramView as ProgramView, type QueuedSubmission, type SubmissionsReasonCode as ReasonCode, type SubmissionsReplyView as ReplyView, type ResolvedSettings, type SubmissionsStatusType as StatusType, type SubmissionsSubmissionStatus as SubmissionStatus, type SubmissionsSubmissionStatusView as SubmissionStatusView, type SubmissionsSubmissionType as SubmissionType, TILLATTE_MIME, type ProgramsTaskOutcome as TaskOutcome, type Telemetry, type TelemetryEvent, type TextMaxLength, VEDLEGG_GRENSER, VERSJON, dekkerAlt, init, klipp, scanText, skaler, strokTilRekter, treffer, trykkTilRekt };
|
package/dist/index.d.ts
CHANGED
|
@@ -353,11 +353,17 @@ interface InnspelOptions {
|
|
|
353
353
|
/** Tidsavbrudd per kall i millisekunder. Standard 10 000 (wireframe 2i). */
|
|
354
354
|
timeoutMs?: number;
|
|
355
355
|
}
|
|
356
|
-
/**
|
|
356
|
+
/**
|
|
357
|
+
* Leietakerens innstillinger slik klienten kjenner dem. Starter som opsjonene fra
|
|
358
|
+
* `init()` (strammest mulig uten dem), og oppdateres av `loadSettings()` fra
|
|
359
|
+
* `GET /v1/ingest/config` (M2.5) — samme objekt, så en holdt referanse følger med.
|
|
360
|
+
*/
|
|
357
361
|
interface ResolvedSettings {
|
|
358
362
|
textMaxLength: TextMaxLength;
|
|
359
363
|
minTextLength: number;
|
|
360
364
|
screenshotsEnabled: boolean;
|
|
365
|
+
/** Leietakerens personvernerklæring — «hva samles inn». Finnes først etter `loadSettings()`. */
|
|
366
|
+
privacyUrl?: string;
|
|
361
367
|
}
|
|
362
368
|
/**
|
|
363
369
|
* Bildet slik verten gir det fra seg — Blob (React Native og nettleser),
|
|
@@ -500,12 +506,20 @@ interface InnspelClient {
|
|
|
500
506
|
readonly version: string;
|
|
501
507
|
/** `true` når `identityProvider` er `null` — innsendinger kan ikke følges opp. */
|
|
502
508
|
readonly isAnonymous: boolean;
|
|
503
|
-
/** Leietakerens grenser slik klienten kjenner dem. */
|
|
509
|
+
/** Leietakerens grenser slik klienten kjenner dem. Oppdateres på plass av {@link loadSettings}. */
|
|
504
510
|
readonly settings: ResolvedSettings;
|
|
505
511
|
/** Konteksten som følger hver innsending, med `sdkVersion` satt av kjernen. */
|
|
506
512
|
readonly context: ContextInput & {
|
|
507
513
|
sdkVersion: string;
|
|
508
514
|
};
|
|
515
|
+
/**
|
|
516
|
+
* Henter leietakerens klientkonfigurasjon (`GET /v1/ingest/config`, M2.5): tegngrense,
|
|
517
|
+
* minste antall tegn, skjermbilde og personvernlenke — det verten ellers måtte
|
|
518
|
+
* duplisere i `init()`. Kalles av widgeten ved åpning, aldri ved oppstart (DD-41).
|
|
519
|
+
* Svarer ikke kallet, beholdes det klienten alt har: konfigurasjonen er et tilbud,
|
|
520
|
+
* aldri en sperre. Returnerer `settings` — samme objekt, oppdatert.
|
|
521
|
+
*/
|
|
522
|
+
loadSettings(): Promise<ResolvedSettings>;
|
|
509
523
|
capture(input: CaptureInput): Promise<CaptureResult>;
|
|
510
524
|
readonly knownIssues: {
|
|
511
525
|
/** Kortene som vises FØR feltet i feilsporet (DD-03). Feiler oppslaget, er lista tom. */
|
|
@@ -519,7 +533,20 @@ interface InnspelClient {
|
|
|
519
533
|
status(submissionId: string): Promise<SubmissionsSubmissionStatusView>;
|
|
520
534
|
};
|
|
521
535
|
readonly programs: {
|
|
536
|
+
/** Alt om betaprogram for innsenderen i ett kall: invitasjoner til banneret (DD-12), deltakelser til fanen, og oppfølginger som venter. */
|
|
522
537
|
list(): Promise<ProgramsMyPrograms>;
|
|
538
|
+
/**
|
|
539
|
+
* Aksepterer invitasjonen etter forventningsavklaringen (DD-13, DD-32).
|
|
540
|
+
* Tokenet kom fra leietakerens egen kanal — plattformen sender aldri (DD-12).
|
|
541
|
+
* Er det brukt, utløpt eller utstedt til noen andre, kommer 404
|
|
542
|
+
* `invitation_invalid`. Gjentak fra samme innsender er trygt: svaret er den
|
|
543
|
+
* samme deltakelsen.
|
|
544
|
+
*/
|
|
545
|
+
accept(invitationToken: string): Promise<ProgramsParticipationView>;
|
|
546
|
+
/** Avslår invitasjonen. Ingen årsak spørres. Et nei etter ja er {@link withdraw}, ikke avslag. */
|
|
547
|
+
decline(invitationToken: string): Promise<void>;
|
|
548
|
+
/** «Gå ut» (DD-36): umiddelbart, alltid tilgjengelig, og aldri en straff. Idempotent. */
|
|
549
|
+
withdraw(participationId: string): Promise<ProgramsParticipationView>;
|
|
523
550
|
};
|
|
524
551
|
readonly attachments: {
|
|
525
552
|
/**
|
|
@@ -728,6 +755,6 @@ declare function dekkerAlt(rekter: readonly MaskRect[], bilde: {
|
|
|
728
755
|
* ikke kan lese JSON, og `test/versjon.test.ts` holder den i takt med
|
|
729
756
|
* `package.json`.
|
|
730
757
|
*/
|
|
731
|
-
declare const VERSJON = "0.
|
|
758
|
+
declare const VERSJON = "0.4.0";
|
|
732
759
|
|
|
733
|
-
export { type AttachmentBody, type AttachmentInput, type SubmissionsAttachmentMime as AttachmentMime, type AttachmentOutcome, type SubmissionsAttachmentView as AttachmentView, type CaptureFeil, type CaptureInput, type CaptureOnske, type CaptureResult, type ContextInput, type CommonCorrelation as Correlation, type CommonErrorCode as ErrorCode, type FlushResult, type IdentityProvider, InnspelApiError, type InnspelClient, InnspelConfigError, type InnspelOptions, InnspelQueueFullError, type InnspelStorage, KONTEKST_FELTER, KO_TAK, type KnownIssuesKnownIssueCard as KnownIssueCard, type KnownIssueQuery, type SubmissionsKnownIssueRef as KnownIssueRef, type KnownIssuesKnownIssueStatus as KnownIssueStatus, type MaskPoint, type MaskRect, type ProgramsMyPrograms as MyPrograms, type MySubmission, type OpenFeedbackOptions, type PatternFinding, type PatternKind, type CommonPlatform as Platform, type Presenter, type QueuedSubmission, type SubmissionsReasonCode as ReasonCode, type SubmissionsReplyView as ReplyView, type ResolvedSettings, type SubmissionsStatusType as StatusType, type SubmissionsSubmissionStatus as SubmissionStatus, type SubmissionsSubmissionStatusView as SubmissionStatusView, type SubmissionsSubmissionType as SubmissionType, TILLATTE_MIME, type Telemetry, type TelemetryEvent, type TextMaxLength, VEDLEGG_GRENSER, VERSJON, dekkerAlt, init, klipp, scanText, skaler, strokTilRekter, treffer, trykkTilRekt };
|
|
760
|
+
export { type AttachmentBody, type AttachmentInput, type SubmissionsAttachmentMime as AttachmentMime, type AttachmentOutcome, type SubmissionsAttachmentView as AttachmentView, type CaptureFeil, type CaptureInput, type CaptureOnske, type CaptureResult, type ContextInput, type CommonCorrelation as Correlation, type CommonErrorCode as ErrorCode, type FlushResult, type IdentityProvider, InnspelApiError, type InnspelClient, InnspelConfigError, type InnspelOptions, InnspelQueueFullError, type InnspelStorage, type ProgramsInvitationView as InvitationView, KONTEKST_FELTER, KO_TAK, type KnownIssuesKnownIssueCard as KnownIssueCard, type KnownIssueQuery, type SubmissionsKnownIssueRef as KnownIssueRef, type KnownIssuesKnownIssueStatus as KnownIssueStatus, type MaskPoint, type MaskRect, type ProgramsMyPrograms as MyPrograms, type MySubmission, type OpenFeedbackOptions, type ProgramsParticipationView as ParticipationView, type PatternFinding, type PatternKind, type CommonPlatform as Platform, type Presenter, type ProgramsTask as ProgramTask, type ProgramsProgramView as ProgramView, type QueuedSubmission, type SubmissionsReasonCode as ReasonCode, type SubmissionsReplyView as ReplyView, type ResolvedSettings, type SubmissionsStatusType as StatusType, type SubmissionsSubmissionStatus as SubmissionStatus, type SubmissionsSubmissionStatusView as SubmissionStatusView, type SubmissionsSubmissionType as SubmissionType, TILLATTE_MIME, type ProgramsTaskOutcome as TaskOutcome, type Telemetry, type TelemetryEvent, type TextMaxLength, VEDLEGG_GRENSER, VERSJON, dekkerAlt, init, klipp, scanText, skaler, strokTilRekter, treffer, trykkTilRekt };
|
package/dist/index.js
CHANGED
|
@@ -800,6 +800,33 @@ var attachmentsComplete = (options) => (options.client ?? client).post({
|
|
|
800
800
|
url: "/v1/ingest/attachments/{id}/complete",
|
|
801
801
|
...options
|
|
802
802
|
});
|
|
803
|
+
var configGet = (options) => (options?.client ?? client).get({
|
|
804
|
+
security: [{ name: "X-Innspel-Tenant-Key", type: "apiKey" }, {
|
|
805
|
+
key: "FeedbackTokenAuth",
|
|
806
|
+
scheme: "bearer",
|
|
807
|
+
type: "http"
|
|
808
|
+
}],
|
|
809
|
+
url: "/v1/ingest/config",
|
|
810
|
+
...options
|
|
811
|
+
});
|
|
812
|
+
var programsAccept = (options) => (options.client ?? client).post({
|
|
813
|
+
security: [{ name: "X-Innspel-Tenant-Key", type: "apiKey" }, {
|
|
814
|
+
key: "FeedbackTokenAuth",
|
|
815
|
+
scheme: "bearer",
|
|
816
|
+
type: "http"
|
|
817
|
+
}],
|
|
818
|
+
url: "/v1/ingest/invitations/{token}/accept",
|
|
819
|
+
...options
|
|
820
|
+
});
|
|
821
|
+
var programsDecline = (options) => (options.client ?? client).post({
|
|
822
|
+
security: [{ name: "X-Innspel-Tenant-Key", type: "apiKey" }, {
|
|
823
|
+
key: "FeedbackTokenAuth",
|
|
824
|
+
scheme: "bearer",
|
|
825
|
+
type: "http"
|
|
826
|
+
}],
|
|
827
|
+
url: "/v1/ingest/invitations/{token}/decline",
|
|
828
|
+
...options
|
|
829
|
+
});
|
|
803
830
|
var knownIssuesList2 = (options) => (options?.client ?? client).get({
|
|
804
831
|
security: [{ name: "X-Innspel-Tenant-Key", type: "apiKey" }, {
|
|
805
832
|
key: "FeedbackTokenAuth",
|
|
@@ -822,6 +849,15 @@ var knownIssuesConfirm = (options) => (options.client ?? client).post({
|
|
|
822
849
|
...options.headers
|
|
823
850
|
}
|
|
824
851
|
});
|
|
852
|
+
var programsWithdraw = (options) => (options.client ?? client).post({
|
|
853
|
+
security: [{ name: "X-Innspel-Tenant-Key", type: "apiKey" }, {
|
|
854
|
+
key: "FeedbackTokenAuth",
|
|
855
|
+
scheme: "bearer",
|
|
856
|
+
type: "http"
|
|
857
|
+
}],
|
|
858
|
+
url: "/v1/ingest/participations/{id}/withdraw",
|
|
859
|
+
...options
|
|
860
|
+
});
|
|
825
861
|
var programsListMine = (options) => (options?.client ?? client).get({
|
|
826
862
|
security: [{ name: "X-Innspel-Tenant-Key", type: "apiKey" }, {
|
|
827
863
|
key: "FeedbackTokenAuth",
|
|
@@ -1208,7 +1244,7 @@ async function lastOppTilLagring(fetchImpl, presign, body, signal) {
|
|
|
1208
1244
|
}
|
|
1209
1245
|
|
|
1210
1246
|
// src/versjon.ts
|
|
1211
|
-
var VERSJON = "0.
|
|
1247
|
+
var VERSJON = "0.4.0";
|
|
1212
1248
|
|
|
1213
1249
|
// src/klient.ts
|
|
1214
1250
|
var STANDARD_TIMEOUT_MS = 1e4;
|
|
@@ -1280,8 +1316,9 @@ function tilApiFeil(status, kropp, response) {
|
|
|
1280
1316
|
function init(options) {
|
|
1281
1317
|
validerOpsjoner(options);
|
|
1282
1318
|
const settings = {
|
|
1283
|
-
// Strammest mulig
|
|
1284
|
-
//
|
|
1319
|
+
// Strammest mulig til loadSettings() har svart: 140 / 10 / skjermbilde av er
|
|
1320
|
+
// verdiene ved minorsPresent (K18). Verten kan overstyre startverdiene, men
|
|
1321
|
+
// det leietakeren har satt i panelet vinner når konfigurasjonen er hentet.
|
|
1285
1322
|
textMaxLength: options.textMaxLength ?? 140,
|
|
1286
1323
|
minTextLength: options.minTextLength ?? 10,
|
|
1287
1324
|
screenshotsEnabled: options.screenshotsEnabled ?? false
|
|
@@ -1317,6 +1354,14 @@ function init(options) {
|
|
|
1317
1354
|
if (!res.response.ok) throw tilApiFeil(res.response.status, res.error, res.response);
|
|
1318
1355
|
return res.data;
|
|
1319
1356
|
}
|
|
1357
|
+
function krevInvitasjonstoken(token) {
|
|
1358
|
+
if (typeof token !== "string" || token.length === 0) {
|
|
1359
|
+
throw new InnspelConfigError(
|
|
1360
|
+
"invitationToken",
|
|
1361
|
+
"mangler \u2014 det er engangs-tokenet leietakeren sendte i sin egen kanal (dyplenke, varsel eller e-post)"
|
|
1362
|
+
);
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1320
1365
|
function krevToken() {
|
|
1321
1366
|
if (anonym) {
|
|
1322
1367
|
throw new InnspelApiError(
|
|
@@ -1385,6 +1430,19 @@ function init(options) {
|
|
|
1385
1430
|
isAnonymous: anonym,
|
|
1386
1431
|
settings,
|
|
1387
1432
|
context: kontekst,
|
|
1433
|
+
async loadSettings() {
|
|
1434
|
+
try {
|
|
1435
|
+
const cfg = await medToken(
|
|
1436
|
+
(h) => configGet({ client: klient, headers: h, signal: signal() })
|
|
1437
|
+
);
|
|
1438
|
+
if (cfg?.textMaxLength === 140 || cfg?.textMaxLength === 280) settings.textMaxLength = cfg.textMaxLength;
|
|
1439
|
+
if (typeof cfg?.minTextLength === "number" && cfg.minTextLength >= 1) settings.minTextLength = cfg.minTextLength;
|
|
1440
|
+
if (typeof cfg?.screenshotsEnabled === "boolean") settings.screenshotsEnabled = cfg.screenshotsEnabled;
|
|
1441
|
+
if (typeof cfg?.privacyUrl === "string" && cfg.privacyUrl) settings.privacyUrl = cfg.privacyUrl;
|
|
1442
|
+
} catch {
|
|
1443
|
+
}
|
|
1444
|
+
return settings;
|
|
1445
|
+
},
|
|
1388
1446
|
async capture(input) {
|
|
1389
1447
|
const tekst = input.text ?? "";
|
|
1390
1448
|
if (tekst.length < settings.minTextLength) {
|
|
@@ -1517,6 +1575,47 @@ function init(options) {
|
|
|
1517
1575
|
return medToken(
|
|
1518
1576
|
(h) => programsListMine({ client: klient, headers: h, signal: signal() })
|
|
1519
1577
|
);
|
|
1578
|
+
},
|
|
1579
|
+
async accept(invitationToken) {
|
|
1580
|
+
krevInvitasjonstoken(invitationToken);
|
|
1581
|
+
krevToken();
|
|
1582
|
+
const svar = await medToken(
|
|
1583
|
+
(h) => programsAccept({
|
|
1584
|
+
client: klient,
|
|
1585
|
+
headers: h,
|
|
1586
|
+
signal: signal(),
|
|
1587
|
+
path: { token: invitationToken }
|
|
1588
|
+
})
|
|
1589
|
+
);
|
|
1590
|
+
telemetri.emit({ name: "invitation_accepted" });
|
|
1591
|
+
return svar;
|
|
1592
|
+
},
|
|
1593
|
+
async decline(invitationToken) {
|
|
1594
|
+
krevInvitasjonstoken(invitationToken);
|
|
1595
|
+
krevToken();
|
|
1596
|
+
await medToken(
|
|
1597
|
+
(h) => programsDecline({
|
|
1598
|
+
client: klient,
|
|
1599
|
+
headers: h,
|
|
1600
|
+
signal: signal(),
|
|
1601
|
+
path: { token: invitationToken }
|
|
1602
|
+
})
|
|
1603
|
+
);
|
|
1604
|
+
telemetri.emit({ name: "invitation_declined" });
|
|
1605
|
+
},
|
|
1606
|
+
async withdraw(participationId) {
|
|
1607
|
+
if (typeof participationId !== "string" || participationId.length === 0) {
|
|
1608
|
+
throw new InnspelConfigError("participationId", "mangler \u2014 bruk id fra deltakelsen i programs.list()");
|
|
1609
|
+
}
|
|
1610
|
+
krevToken();
|
|
1611
|
+
return medToken(
|
|
1612
|
+
(h) => programsWithdraw({
|
|
1613
|
+
client: klient,
|
|
1614
|
+
headers: h,
|
|
1615
|
+
signal: signal(),
|
|
1616
|
+
path: { id: participationId }
|
|
1617
|
+
})
|
|
1618
|
+
);
|
|
1520
1619
|
}
|
|
1521
1620
|
},
|
|
1522
1621
|
attachments: {
|