@plitzi/sdk-interactions 0.39.12 → 0.39.14
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/CHANGELOG.md +22 -0
- package/dist/declarations/index.d.ts +1 -0
- package/dist/declarations/index.mjs +3 -2
- package/dist/utility/index.d.ts +5 -0
- package/dist/utility/index.mjs +8 -6
- package/dist/utility/share.d.ts +17 -0
- package/dist/utility/share.mjs +30 -0
- package/dist/utility/shareSpec.d.ts +7 -0
- package/dist/utility/shareSpec.mjs +27 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @plitzi/sdk-interactions
|
|
2
2
|
|
|
3
|
+
## 0.39.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- f1922cf: Released with every `@plitzi` package at this version. What changed in each, and what to do when you upgrade, is in
|
|
8
|
+
`@plitzi/cli`'s `CHANGELOG.md`: one copy of the notes, not one per package.
|
|
9
|
+
- Updated dependencies [f1922cf]
|
|
10
|
+
- @plitzi/sdk-auth@0.39.14
|
|
11
|
+
- @plitzi/sdk-event-bridge@0.39.14
|
|
12
|
+
- @plitzi/sdk-shared@0.39.14
|
|
13
|
+
|
|
14
|
+
## 0.39.13
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 919736b: Released with every `@plitzi` package at this version. What changed in each, and what to do when you upgrade, is in
|
|
19
|
+
`@plitzi/cli`'s `CHANGELOG.md`: one copy of the notes, not one per package.
|
|
20
|
+
- Updated dependencies [919736b]
|
|
21
|
+
- @plitzi/sdk-auth@0.39.13
|
|
22
|
+
- @plitzi/sdk-event-bridge@0.39.13
|
|
23
|
+
- @plitzi/sdk-shared@0.39.13
|
|
24
|
+
|
|
3
25
|
## 0.39.12
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -12,4 +12,5 @@ export { navigationCallbacks } from '../sources/NavigationSource/callbacks';
|
|
|
12
12
|
export { queriesCallbacks } from '../sources/QueriesSource/callbacks';
|
|
13
13
|
export { stateCallbacks } from '../sources/StateSource/callbacks';
|
|
14
14
|
export { copyToClipboardSpec } from '../utility/copyToClipboardSpec';
|
|
15
|
+
export { shareSpec } from '../utility/shareSpec';
|
|
15
16
|
export { webHookSpec } from '../utility/webHookSpec';
|
|
@@ -5,5 +5,6 @@ import { navigationCallbacks as r } from "../sources/NavigationSource/callbacks.
|
|
|
5
5
|
import { queriesCallbacks as i } from "../sources/QueriesSource/callbacks.mjs";
|
|
6
6
|
import { stateCallbacks as a } from "../sources/StateSource/callbacks.mjs";
|
|
7
7
|
import { copyToClipboardSpec as o } from "../utility/copyToClipboardSpec.mjs";
|
|
8
|
-
import {
|
|
9
|
-
|
|
8
|
+
import { shareSpec as s } from "../utility/shareSpec.mjs";
|
|
9
|
+
import { webHookSpec as c } from "../utility/webHookSpec.mjs";
|
|
10
|
+
export { e as actionsCallbacks, t as authCallbacks, o as copyToClipboardSpec, n as hostCallbacks, r as navigationCallbacks, i as queriesCallbacks, s as shareSpec, a as stateCallbacks, c as webHookSpec };
|
package/dist/utility/index.d.ts
CHANGED
|
@@ -5,6 +5,11 @@ declare const _default: {
|
|
|
5
5
|
delayTime: import('@plitzi/sdk-shared').InteractionCallback<{
|
|
6
6
|
time: number;
|
|
7
7
|
}>;
|
|
8
|
+
share: import('@plitzi/sdk-shared').InteractionCallback<{
|
|
9
|
+
url?: string;
|
|
10
|
+
title?: string;
|
|
11
|
+
text?: string;
|
|
12
|
+
}>;
|
|
8
13
|
twigTemplate: import('@plitzi/sdk-shared').InteractionCallback<{
|
|
9
14
|
returnMode: "jsonObject" | "json" | "text";
|
|
10
15
|
template: string;
|
package/dist/utility/index.mjs
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import e from "./copyToClipboard.mjs";
|
|
2
2
|
import t from "./delayTime.mjs";
|
|
3
|
-
import n from "./
|
|
4
|
-
import r from "./
|
|
3
|
+
import n from "./share.mjs";
|
|
4
|
+
import r from "./twigTemplate.mjs";
|
|
5
|
+
import i from "./webHook.mjs";
|
|
5
6
|
// src/utility/index.ts
|
|
6
|
-
var
|
|
7
|
+
var a = {
|
|
7
8
|
copyToClipboard: e,
|
|
8
9
|
delayTime: t,
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
share: n,
|
|
11
|
+
twigTemplate: r,
|
|
12
|
+
webHook: i
|
|
11
13
|
};
|
|
12
|
-
export {
|
|
14
|
+
export { a as default };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type ShareParams = {
|
|
2
|
+
url?: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
text?: string;
|
|
5
|
+
};
|
|
6
|
+
/** What a share came to: through the device's sheet, or the address copied where there is no sheet. */
|
|
7
|
+
export type ShareResult = {
|
|
8
|
+
shared: boolean;
|
|
9
|
+
copied: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Shares an address through the device's own sheet — the apps, the contacts — and, where the browser has none, copies
|
|
13
|
+
* it instead: `copied` says which, so a flow says "Link copied" only when it was. A sheet the visitor closed is not a
|
|
14
|
+
* failure (`shared: false`); a page with neither a sheet nor a clipboard fails, and the flow's `onFailure` runs.
|
|
15
|
+
*/
|
|
16
|
+
declare const share: import('@plitzi/sdk-shared').InteractionCallback<ShareParams>;
|
|
17
|
+
export default share;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { shareSpec as e } from "./shareSpec.mjs";
|
|
2
|
+
import { clipboardWriter as t } from "@plitzi/sdk-shared/helpers";
|
|
3
|
+
import { toInteractionCallback as n } from "@plitzi/sdk-shared/authoring";
|
|
4
|
+
// src/utility/share.ts
|
|
5
|
+
var r = n("share", e, async ({ url: e, title: n, text: r }) => {
|
|
6
|
+
let i = e || window.location.href, a = {
|
|
7
|
+
url: i,
|
|
8
|
+
...n ? { title: n } : {},
|
|
9
|
+
...r ? { text: r } : {}
|
|
10
|
+
};
|
|
11
|
+
if (typeof navigator.share == "function" && (typeof navigator.canShare != "function" || navigator.canShare(a))) try {
|
|
12
|
+
return await navigator.share(a), {
|
|
13
|
+
shared: !0,
|
|
14
|
+
copied: !1
|
|
15
|
+
};
|
|
16
|
+
} catch (e) {
|
|
17
|
+
if (e instanceof DOMException && e.name === "AbortError") return {
|
|
18
|
+
shared: !1,
|
|
19
|
+
copied: !1
|
|
20
|
+
};
|
|
21
|
+
throw e;
|
|
22
|
+
}
|
|
23
|
+
let o = t();
|
|
24
|
+
if (!o) throw Error("This page can neither share nor copy: the browser offers no sheet and no clipboard here");
|
|
25
|
+
return await o(i), {
|
|
26
|
+
shared: !1,
|
|
27
|
+
copied: !0
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
export { r as default };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BuiltinActionSpec } from '@plitzi/sdk-shared/authoring';
|
|
2
|
+
/**
|
|
3
|
+
* The share step, as the editor and anything authoring one offline read it: what is shared — an address, its title and
|
|
4
|
+
* a line about it — each a template like any step's param. It answers `{ shared, copied }`: shared through the
|
|
5
|
+
* device's own sheet, or, where there is none (a desktop's Firefox), the address copied for the visitor to paste.
|
|
6
|
+
*/
|
|
7
|
+
export declare const shareSpec: BuiltinActionSpec;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// src/utility/shareSpec.ts
|
|
2
|
+
var e = {
|
|
3
|
+
title: "Share",
|
|
4
|
+
type: "utility",
|
|
5
|
+
strictParams: !0,
|
|
6
|
+
params: {
|
|
7
|
+
url: {
|
|
8
|
+
type: "text",
|
|
9
|
+
description: "The address to share. Empty, this page’s — {{ navigation.href }}.",
|
|
10
|
+
default: "",
|
|
11
|
+
label: "Address"
|
|
12
|
+
},
|
|
13
|
+
title: {
|
|
14
|
+
type: "text",
|
|
15
|
+
description: "Its title, where the app it is shared to shows one.",
|
|
16
|
+
default: "",
|
|
17
|
+
label: "Title"
|
|
18
|
+
},
|
|
19
|
+
text: {
|
|
20
|
+
type: "text",
|
|
21
|
+
description: "A line about it, said with the address.",
|
|
22
|
+
default: "",
|
|
23
|
+
label: "Text"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
export { e as shareSpec };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-interactions",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.14",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@plitzi/nexus": "^1.5.1",
|
|
42
42
|
"@plitzi/plitzi-ui": "^1.6.41",
|
|
43
|
-
"@plitzi/sdk-auth": "0.39.
|
|
44
|
-
"@plitzi/sdk-event-bridge": "0.39.
|
|
45
|
-
"@plitzi/sdk-shared": "0.39.
|
|
43
|
+
"@plitzi/sdk-auth": "0.39.14",
|
|
44
|
+
"@plitzi/sdk-event-bridge": "0.39.14",
|
|
45
|
+
"@plitzi/sdk-shared": "0.39.14"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": "^19"
|