@tma.js/sdk-solid 2.0.3 → 2.1.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/dist/dts/SDKProvider/SDKContext.d.ts +8 -0
- package/dist/dts/SDKProvider/SDKProvider.d.ts +8 -0
- package/dist/dts/SDKProvider/SDKProvider.types.d.ts +37 -0
- package/dist/dts/createHOC.d.ts +15 -0
- package/dist/dts/createHook.d.ts +11 -12
- package/dist/dts/hooks-hocs/back-button.d.ts +8 -0
- package/dist/dts/hooks-hocs/biometry-manager.d.ts +8 -0
- package/dist/dts/hooks-hocs/closing-behavior.d.ts +8 -0
- package/dist/dts/hooks-hocs/cloud-storage.d.ts +8 -0
- package/dist/dts/hooks-hocs/haptic-feedback.d.ts +8 -0
- package/dist/dts/hooks-hocs/init-data.d.ts +8 -0
- package/dist/dts/hooks-hocs/invoice.d.ts +8 -0
- package/dist/dts/hooks-hocs/main-button.d.ts +8 -0
- package/dist/dts/hooks-hocs/mini-app.d.ts +8 -0
- package/dist/dts/hooks-hocs/popup.d.ts +8 -0
- package/dist/dts/hooks-hocs/qr-scanner.d.ts +8 -0
- package/dist/dts/hooks-hocs/settings-button.d.ts +8 -0
- package/dist/dts/hooks-hocs/theme-params.d.ts +8 -0
- package/dist/dts/hooks-hocs/utils.d.ts +8 -0
- package/dist/dts/hooks-hocs/viewport.d.ts +8 -0
- package/dist/dts/index.d.ts +19 -4
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +2939 -0
- package/dist/index.js.map +1 -0
- package/package.json +8 -8
- package/dist/dts/DisplayGate.d.ts +0 -24
- package/dist/dts/provider/SDKContext.d.ts +0 -2
- package/dist/dts/provider/SDKProvider.d.ts +0 -2
- package/dist/dts/provider/index.d.ts +0 -6
- package/dist/dts/provider/types.d.ts +0 -22
- package/dist/dts/provider/useInitResultDynamicValue.d.ts +0 -3
- package/dist/dts/provider/useInitResultValue.d.ts +0 -8
- package/dist/dts/provider/useSDKContext.d.ts +0 -5
- package/dist/dts/tools/back-button.d.ts +0 -4
- package/dist/dts/tools/closing-behavior.d.ts +0 -4
- package/dist/dts/tools/cloud-storage.d.ts +0 -4
- package/dist/dts/tools/haptic-feedback.d.ts +0 -4
- package/dist/dts/tools/index.d.ts +0 -17
- package/dist/dts/tools/init-data-raw.d.ts +0 -4
- package/dist/dts/tools/init-data.d.ts +0 -4
- package/dist/dts/tools/invoice.d.ts +0 -4
- package/dist/dts/tools/launch-params.d.ts +0 -5
- package/dist/dts/tools/main-button.d.ts +0 -4
- package/dist/dts/tools/mini-app.d.ts +0 -4
- package/dist/dts/tools/popup.d.ts +0 -4
- package/dist/dts/tools/post-event.d.ts +0 -4
- package/dist/dts/tools/qr-scanner.d.ts +0 -4
- package/dist/dts/tools/settings-button.d.ts +0 -4
- package/dist/dts/tools/theme-params.d.ts +0 -4
- package/dist/dts/tools/utils.d.ts +0 -4
- package/dist/dts/tools/viewport.d.ts +0 -4
- package/dist/dts/types.d.ts +0 -23
- package/dist/index.mjs +0 -115
package/dist/dts/types.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { InitOptions, InitResult } from '@tma.js/sdk';
|
|
2
|
-
export { InitOptions, InitResult };
|
|
3
|
-
export interface Trackable {
|
|
4
|
-
on(event: 'change', listener: () => void): () => void;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* SDK init result keys, which describe values with trackable changes.
|
|
8
|
-
*/
|
|
9
|
-
export type DynamicInitResultKey = {
|
|
10
|
-
[K in InitResultKey]-?: InitResultValue<K> extends Trackable ? K : never;
|
|
11
|
-
}[InitResultKey];
|
|
12
|
-
/**
|
|
13
|
-
* SDK init result keys, which describe static values.
|
|
14
|
-
*/
|
|
15
|
-
export type StaticInitResultKey = Exclude<InitResultKey, DynamicInitResultKey>;
|
|
16
|
-
/**
|
|
17
|
-
* SDK initialization result key.
|
|
18
|
-
*/
|
|
19
|
-
export type InitResultKey = keyof InitResult;
|
|
20
|
-
/**
|
|
21
|
-
* Returns SDK init result value type by its key.
|
|
22
|
-
*/
|
|
23
|
-
export type InitResultValue<K extends InitResultKey> = InitResult[K];
|
package/dist/index.mjs
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import { createContext as h, createResource as f, createMemo as u, createComponent as o, useContext as m, createSignal as v, createEffect as S, onCleanup as p, Switch as D, Match as a } from "solid-js";
|
|
2
|
-
import { init as w, retrieveLaunchParams as B } from "@tma.js/sdk";
|
|
3
|
-
const l = h({
|
|
4
|
-
loading: () => !1,
|
|
5
|
-
error: () => {
|
|
6
|
-
},
|
|
7
|
-
initResult: () => {
|
|
8
|
-
}
|
|
9
|
-
}, { name: "SDKContext" });
|
|
10
|
-
function k(t) {
|
|
11
|
-
const [e] = f(() => t.options, w), r = u(() => e.state === "ready" ? e() : void 0), i = u(() => e.loading), s = u(() => e.error === void 0 ? null : e.error);
|
|
12
|
-
return o(l.Provider, {
|
|
13
|
-
value: {
|
|
14
|
-
initResult: r,
|
|
15
|
-
loading: i,
|
|
16
|
-
error: s
|
|
17
|
-
},
|
|
18
|
-
get children() {
|
|
19
|
-
return t.children;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
function d() {
|
|
24
|
-
return m(l);
|
|
25
|
-
}
|
|
26
|
-
function g(t) {
|
|
27
|
-
const { initResult: e } = d();
|
|
28
|
-
return u(() => {
|
|
29
|
-
const r = e();
|
|
30
|
-
if (!r)
|
|
31
|
-
throw new Error(`Unable to get init result key "${t}" as long as SDK is not initialized`);
|
|
32
|
-
return r[t];
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
function R(t) {
|
|
36
|
-
const e = g(t), [r, i] = v(e(), { equals: !1 });
|
|
37
|
-
return S(() => {
|
|
38
|
-
p(
|
|
39
|
-
e().on("change", () => {
|
|
40
|
-
i((s) => s);
|
|
41
|
-
})
|
|
42
|
-
);
|
|
43
|
-
}), r;
|
|
44
|
-
}
|
|
45
|
-
function n(t, e) {
|
|
46
|
-
return e ? () => R(t) : () => g(t);
|
|
47
|
-
}
|
|
48
|
-
const x = n("backButton", !0), b = n("closingBehavior", !0), I = n("cloudStorage"), E = n("hapticFeedback"), K = n("initData"), M = n("initDataRaw"), y = n("invoice", !0);
|
|
49
|
-
function V() {
|
|
50
|
-
return B();
|
|
51
|
-
}
|
|
52
|
-
const q = n("mainButton", !0), A = n("miniApp", !0), F = n("popup", !0), H = n("postEvent"), L = n("qrScanner", !0), U = n("settingsButton", !0), z = n("themeParams", !0), G = n("viewport", !0), Q = n("utils");
|
|
53
|
-
function c(t, e = {}) {
|
|
54
|
-
return typeof t == "function" ? o(t, e) : t;
|
|
55
|
-
}
|
|
56
|
-
function T(t) {
|
|
57
|
-
const {
|
|
58
|
-
loading: e,
|
|
59
|
-
error: r,
|
|
60
|
-
initResult: i
|
|
61
|
-
} = d();
|
|
62
|
-
return o(D, {
|
|
63
|
-
get fallback() {
|
|
64
|
-
return c(t.initial);
|
|
65
|
-
},
|
|
66
|
-
get children() {
|
|
67
|
-
return [o(a, {
|
|
68
|
-
get when() {
|
|
69
|
-
return i();
|
|
70
|
-
},
|
|
71
|
-
get children() {
|
|
72
|
-
return t.children;
|
|
73
|
-
}
|
|
74
|
-
}), o(a, {
|
|
75
|
-
get when() {
|
|
76
|
-
return r();
|
|
77
|
-
},
|
|
78
|
-
get children() {
|
|
79
|
-
return c(t.error, {
|
|
80
|
-
error: r()
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}), o(a, {
|
|
84
|
-
get when() {
|
|
85
|
-
return e();
|
|
86
|
-
},
|
|
87
|
-
get children() {
|
|
88
|
-
return c(t.loading);
|
|
89
|
-
}
|
|
90
|
-
})];
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
export {
|
|
95
|
-
T as DisplayGate,
|
|
96
|
-
k as SDKProvider,
|
|
97
|
-
x as useBackButton,
|
|
98
|
-
b as useClosingBehavior,
|
|
99
|
-
I as useCloudStorage,
|
|
100
|
-
E as useHapticFeedback,
|
|
101
|
-
K as useInitData,
|
|
102
|
-
M as useInitDataRaw,
|
|
103
|
-
y as useInvoice,
|
|
104
|
-
V as useLaunchParams,
|
|
105
|
-
q as useMainButton,
|
|
106
|
-
A as useMiniApp,
|
|
107
|
-
F as usePopup,
|
|
108
|
-
H as usePostEvent,
|
|
109
|
-
L as useQRScanner,
|
|
110
|
-
d as useSDKContext,
|
|
111
|
-
U as useSettingsButton,
|
|
112
|
-
z as useThemeParams,
|
|
113
|
-
Q as useUtils,
|
|
114
|
-
G as useViewport
|
|
115
|
-
};
|