@pushwoosh/smart-components-kit 1.0.64 → 1.0.65
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/DynamicContentPickerForm/hooks.d.ts +1 -1
- package/DynamicContentPickerForm/hooks.js +1 -1
- package/EmailTemplatePreview/EmailTemplatePreview.js +1 -1
- package/ExportCSV/useExportService/useExportService.js +1 -1
- package/LanguagesSelector/LanguagesSelectFormLoader.js +1 -1
- package/ModalCloningJourney/ModalCloningJourney.js +1 -1
- package/OpenActions/components/OpenActionsSummary/OpenActionsSummary.js +1 -1
- package/OpenActions/usePresetOpenActions.js +1 -1
- package/SystemParcel/SystemParcel.js +1 -1
- package/_devel/index.d.ts +1 -1
- package/_devel/index.js +1 -1
- package/hooks/useEventBusListener.js +1 -1
- package/hooks/useSession.js +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +2 -8
- package/context/SimpleEventEmitter.d.ts +0 -11
- package/context/SimpleEventEmitter.js +0 -43
- package/context/UniversalKeyValueStore.d.ts +0 -32
- package/context/UniversalKeyValueStore.js +0 -140
- package/context/context.d.ts +0 -2
- package/context/context.js +0 -2
- package/context/index.d.ts +0 -7
- package/context/index.js +0 -6
- package/context/types.d.ts +0 -38
- package/context/types.js +0 -1
- package/context/useSPAContext.d.ts +0 -1
- package/context/useSPAContext.js +0 -9
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Event } from '@pushwoosh/rpc-v2-http-api-data/events';
|
|
2
|
-
import { type SPAContextType } from '
|
|
2
|
+
import { type SPAContextType } from '@pushwoosh/spa-context';
|
|
3
3
|
import { type FullTagData } from './types';
|
|
4
4
|
export declare function fetchDynamicContentTags(context: SPAContextType): Promise<FullTagData[]>;
|
|
5
5
|
export declare function useDynamicContentTags(): {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DynamicContentModifiers } from '@pushwoosh/kit-constants';
|
|
2
2
|
import { useAsync } from '@pushwoosh/kit-helpers';
|
|
3
|
+
import { useSPAContext } from '@pushwoosh/spa-context';
|
|
3
4
|
import { collectPaginatedData } from '../asyncHelpers';
|
|
4
|
-
import { useSPAContext } from '../context';
|
|
5
5
|
const ignoreTagTypes = ['BOOLEAN', 'LIST'];
|
|
6
6
|
const numberTypes = ['INTEGER', 'PRICE'];
|
|
7
7
|
export async function fetchDynamicContentTags(context) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { EmailTemplatePreview as DumbPreview, RectangularSkeleton } from '@pushwoosh/dumb-components';
|
|
3
3
|
import { useAsync } from '@pushwoosh/kit-helpers';
|
|
4
|
-
import { useSPAContext } from '
|
|
4
|
+
import { useSPAContext } from '@pushwoosh/spa-context';
|
|
5
5
|
export const EmailTemplatePreview = ({
|
|
6
6
|
code,
|
|
7
7
|
width,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { useSPAContext } from '@pushwoosh/spa-context';
|
|
2
3
|
import { API_CHECK_INTERVAL, MAX_RETRIES } from './constants';
|
|
3
|
-
import { useSPAContext } from '../../context';
|
|
4
4
|
export const useExportService = () => {
|
|
5
5
|
const [error, setError] = useState('');
|
|
6
6
|
const [progress, setProgress] = useState(0);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Spinner } from '@pushwoosh/dumb-components';
|
|
3
3
|
import { Horizontal, useAsync } from '@pushwoosh/kit-helpers';
|
|
4
|
+
import { useSPAContext } from '@pushwoosh/spa-context';
|
|
4
5
|
import { langCodes } from './constants';
|
|
5
6
|
import { LanguagesSelectForm } from './LanguagesSelectForm';
|
|
6
7
|
import { useGetLangName } from './utils';
|
|
7
|
-
import { useSPAContext } from '../context';
|
|
8
8
|
export const LanguagesSelectFormLoader = ({
|
|
9
9
|
application,
|
|
10
10
|
value,
|
|
@@ -4,7 +4,7 @@ import { useParams } from 'react-router-dom';
|
|
|
4
4
|
import { FieldBox, Modal, ModalBody, ModalHeader, ModalFooter, NativeInput, Select, Button, Banner } from '@pushwoosh/dumb-components';
|
|
5
5
|
import { Horizontal, trackMixpanelEvent, useAsync, Vertical } from '@pushwoosh/kit-helpers';
|
|
6
6
|
import { H3, Paragraph } from '@pushwoosh/kit-typography';
|
|
7
|
-
import { useSPAContext } from '
|
|
7
|
+
import { useSPAContext } from '@pushwoosh/spa-context';
|
|
8
8
|
export function ModalCloningJourney({
|
|
9
9
|
journeyId,
|
|
10
10
|
journeyTitle,
|
|
@@ -5,8 +5,8 @@ import { Color, PlatformsIcons, PlatformsLabels, Tag } from '@pushwoosh/kit-cons
|
|
|
5
5
|
import { Horizontal, Vertical, useAsync } from '@pushwoosh/kit-helpers';
|
|
6
6
|
import { OpenIcon, PlatformLogoIcon } from '@pushwoosh/kit-icons';
|
|
7
7
|
import { Text } from '@pushwoosh/kit-typography';
|
|
8
|
+
import { useSPAContext } from '@pushwoosh/spa-context';
|
|
8
9
|
import { LinkRow, ClickActionSection } from './styles';
|
|
9
|
-
import { useSPAContext } from '../../../context';
|
|
10
10
|
import { getSafariUrl, isWebLink } from '../../helpers';
|
|
11
11
|
export const OpenActionsSummary = ({
|
|
12
12
|
openActions
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback, useEffect, useState } from 'react';
|
|
2
2
|
import { useToast } from '@pushwoosh/dumb-components';
|
|
3
|
-
import { useSPAContext } from '
|
|
3
|
+
import { useSPAContext } from '@pushwoosh/spa-context';
|
|
4
4
|
import { formatDeeplink, isWebLink } from './helpers';
|
|
5
5
|
const WEB_PLATFORM_KEY = 0;
|
|
6
6
|
export const usePresetOpenActions = pushPreset => {
|
package/_devel/index.d.ts
CHANGED
package/_devel/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { createRoot } from 'react-dom/client';
|
|
3
3
|
import { Router, Route, Switch, Link } from 'react-router-dom';
|
|
4
|
-
import { SPAContextProvider } from '
|
|
4
|
+
import { SPAContextProvider } from '@pushwoosh/spa-context';
|
|
5
5
|
import { Lib } from './lib';
|
|
6
6
|
import { TestPlace } from './test-place';
|
|
7
7
|
export function parcel(container) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { usePersistentFunction } from '@pushwoosh/kit-helpers';
|
|
3
|
-
import { useSPAContext } from '
|
|
3
|
+
import { useSPAContext } from '@pushwoosh/spa-context';
|
|
4
4
|
export function useEventBusListener(eventName, handler, callImmediately) {
|
|
5
5
|
const {
|
|
6
6
|
eventBus
|
package/hooks/useSession.js
CHANGED
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -26,14 +26,13 @@
|
|
|
26
26
|
"@pushwoosh/kit-helpers": "^4.8.9",
|
|
27
27
|
"@pushwoosh/kit-icons": "^2.1.6",
|
|
28
28
|
"@pushwoosh/kit-typography": "^1.7.3",
|
|
29
|
+
"@pushwoosh/spa-context": "^1.0.0",
|
|
29
30
|
"idb-keyval": "^6.2.2",
|
|
30
31
|
"react-hook-form": "^7.68.0",
|
|
31
32
|
"react-router-dom": "^5.3.4"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
35
|
"@pushwoosh/frontend-builder-engine": "^1.0.21",
|
|
35
|
-
"@pushwoosh/http-client": "^2.5.0",
|
|
36
|
-
"@pushwoosh/session-store": "^2.5.0",
|
|
37
36
|
"@svgr/webpack": "^8.1.0",
|
|
38
37
|
"@types/react": "^18.3.5",
|
|
39
38
|
"@types/react-dom": "^18.3.0",
|
|
@@ -45,13 +44,8 @@
|
|
|
45
44
|
"styled-components": "^5.3.11"
|
|
46
45
|
},
|
|
47
46
|
"peerDependencies": {
|
|
48
|
-
"@pushwoosh/http-client": "^2.5.0",
|
|
49
|
-
"@pushwoosh/rpc-gateway-journey-data": "^0.26.206",
|
|
50
|
-
"@pushwoosh/rpc-gateway-payment-data": "^0.2.135",
|
|
51
|
-
"@pushwoosh/rpc-v2-http-api-data": "^0.1.566",
|
|
52
|
-
"@pushwoosh/session-store": "^2.5.0",
|
|
53
47
|
"react": "^16.14.0 || ^18.0.0",
|
|
54
48
|
"react-dom": "^16.14.0 || ^18.0.0"
|
|
55
49
|
},
|
|
56
|
-
"version": "1.0.
|
|
50
|
+
"version": "1.0.65"
|
|
57
51
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type Listener<T> = (payload: T) => void;
|
|
2
|
-
export declare class SimpleEventEmitter {
|
|
3
|
-
private listeners;
|
|
4
|
-
private lastPayloads;
|
|
5
|
-
on<T>(eventName: string, fn: Listener<T>, callImmediately?: boolean): () => void;
|
|
6
|
-
off<T>(eventName: string, fn: Listener<T>): void;
|
|
7
|
-
emit<T>(eventName: string, payload: T): void;
|
|
8
|
-
getLastPayload<T>(eventName: string): T | undefined;
|
|
9
|
-
clear(eventName?: string): void;
|
|
10
|
-
}
|
|
11
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
export class SimpleEventEmitter {
|
|
2
|
-
listeners = {};
|
|
3
|
-
lastPayloads = {};
|
|
4
|
-
on(eventName, fn, callImmediately) {
|
|
5
|
-
if (!this.listeners[eventName]) {
|
|
6
|
-
this.listeners[eventName] = [];
|
|
7
|
-
}
|
|
8
|
-
this.listeners[eventName].push(fn);
|
|
9
|
-
// Call immediately with last payload if requested and available
|
|
10
|
-
if (callImmediately && eventName in this.lastPayloads) {
|
|
11
|
-
fn(this.lastPayloads[eventName]);
|
|
12
|
-
}
|
|
13
|
-
return () => {
|
|
14
|
-
this.off(eventName, fn);
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
off(eventName, fn) {
|
|
18
|
-
if (!this.listeners[eventName]) return;
|
|
19
|
-
this.listeners[eventName] = this.listeners[eventName].filter(l => l !== fn);
|
|
20
|
-
if (this.listeners[eventName].length === 0) {
|
|
21
|
-
delete this.listeners[eventName];
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
emit(eventName, payload) {
|
|
25
|
-
// Store last payload
|
|
26
|
-
this.lastPayloads[eventName] = payload;
|
|
27
|
-
if (!this.listeners[eventName]) return;
|
|
28
|
-
// Copy to avoid reentrancy issues if a listener removes itself
|
|
29
|
-
[...this.listeners[eventName]].forEach(l => l(payload));
|
|
30
|
-
}
|
|
31
|
-
getLastPayload(eventName) {
|
|
32
|
-
return this.lastPayloads[eventName];
|
|
33
|
-
}
|
|
34
|
-
clear(eventName) {
|
|
35
|
-
if (eventName) {
|
|
36
|
-
delete this.listeners[eventName];
|
|
37
|
-
delete this.lastPayloads[eventName];
|
|
38
|
-
} else {
|
|
39
|
-
this.listeners = {};
|
|
40
|
-
this.lastPayloads = {};
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export type ChangeType = 'init' | 'set' | 'remove';
|
|
2
|
-
export interface KeyValueChange<K extends IDBValidKey = IDBValidKey, V = unknown> {
|
|
3
|
-
key: K;
|
|
4
|
-
value: V | undefined;
|
|
5
|
-
inMemory: boolean;
|
|
6
|
-
type: ChangeType;
|
|
7
|
-
}
|
|
8
|
-
export interface UniversalKeyValueStoreOptions<K extends IDBValidKey = IDBValidKey> {
|
|
9
|
-
memoryKeys?: K[];
|
|
10
|
-
}
|
|
11
|
-
export declare class UniversalKeyValueStore<K extends IDBValidKey = IDBValidKey, V = unknown> {
|
|
12
|
-
private readonly store;
|
|
13
|
-
private readonly memoryKeySet;
|
|
14
|
-
private readonly memory;
|
|
15
|
-
private readonly emitter;
|
|
16
|
-
private constructor();
|
|
17
|
-
static initialize<K extends IDBValidKey = IDBValidKey, V = unknown>(dbName: string, tableName: string, options: UniversalKeyValueStoreOptions<K>): Promise<UniversalKeyValueStore<K, V>>;
|
|
18
|
-
private init;
|
|
19
|
-
static makeEventName(key: IDBValidKey): string;
|
|
20
|
-
private toStorageKey;
|
|
21
|
-
private isMemoryKey;
|
|
22
|
-
private emitEvent;
|
|
23
|
-
get(key: K): Promise<V | undefined>;
|
|
24
|
-
getMemory(key: K): V | undefined;
|
|
25
|
-
set(key: K, value: V): Promise<void>;
|
|
26
|
-
remove(key: K): Promise<void>;
|
|
27
|
-
getAll(): Promise<Record<string, V>>;
|
|
28
|
-
getAllMemory(): Record<string, V>;
|
|
29
|
-
subscribe(key: K, listener: (change: KeyValueChange<K, V>) => void, options?: {
|
|
30
|
-
callImmediately?: boolean;
|
|
31
|
-
}): () => void;
|
|
32
|
-
}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { createStore, get as idbGet, set as idbSet, del as idbDel, entries as idbEntries } from 'idb-keyval';
|
|
2
|
-
import { SimpleEventEmitter } from './SimpleEventEmitter';
|
|
3
|
-
export class UniversalKeyValueStore {
|
|
4
|
-
store;
|
|
5
|
-
memoryKeySet;
|
|
6
|
-
memory;
|
|
7
|
-
emitter;
|
|
8
|
-
constructor(dbName, tableName, options) {
|
|
9
|
-
const {
|
|
10
|
-
memoryKeys = []
|
|
11
|
-
} = options;
|
|
12
|
-
this.store = createStore(dbName, tableName);
|
|
13
|
-
this.memoryKeySet = new Set(memoryKeys);
|
|
14
|
-
this.memory = new Map();
|
|
15
|
-
this.emitter = new SimpleEventEmitter();
|
|
16
|
-
}
|
|
17
|
-
static async initialize(dbName, tableName, options) {
|
|
18
|
-
const instance = new UniversalKeyValueStore(dbName, tableName, options);
|
|
19
|
-
await instance.init();
|
|
20
|
-
return instance;
|
|
21
|
-
}
|
|
22
|
-
async init() {
|
|
23
|
-
if (this.memoryKeySet.size > 0) {
|
|
24
|
-
for (const key of this.memoryKeySet) {
|
|
25
|
-
try {
|
|
26
|
-
const value = await idbGet(this.toStorageKey(key), this.store);
|
|
27
|
-
if (value !== undefined) {
|
|
28
|
-
this.memory.set(key, value);
|
|
29
|
-
}
|
|
30
|
-
} catch (e) {
|
|
31
|
-
console.error('Failed to init memory key from IndexedDB', {
|
|
32
|
-
key,
|
|
33
|
-
error: e
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
static makeEventName(key) {
|
|
40
|
-
return `key:${String(key)}`;
|
|
41
|
-
}
|
|
42
|
-
toStorageKey(key) {
|
|
43
|
-
return key;
|
|
44
|
-
}
|
|
45
|
-
isMemoryKey(key) {
|
|
46
|
-
return this.memoryKeySet.has(key);
|
|
47
|
-
}
|
|
48
|
-
emitEvent(eventName, payload) {
|
|
49
|
-
try {
|
|
50
|
-
this.emitter.emit(eventName, payload);
|
|
51
|
-
} catch (e) {
|
|
52
|
-
console.error('Failed to emit event', {
|
|
53
|
-
eventName,
|
|
54
|
-
payload,
|
|
55
|
-
error: e
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
async get(key) {
|
|
60
|
-
if (this.isMemoryKey(key) && this.memory.has(key)) {
|
|
61
|
-
return this.memory.get(key);
|
|
62
|
-
}
|
|
63
|
-
const value = await idbGet(this.toStorageKey(key), this.store);
|
|
64
|
-
if (this.isMemoryKey(key) && value !== undefined) {
|
|
65
|
-
this.memory.set(key, value);
|
|
66
|
-
}
|
|
67
|
-
return value;
|
|
68
|
-
}
|
|
69
|
-
getMemory(key) {
|
|
70
|
-
if (this.isMemoryKey(key)) {
|
|
71
|
-
return this.memory.get(key);
|
|
72
|
-
}
|
|
73
|
-
return undefined;
|
|
74
|
-
}
|
|
75
|
-
async set(key, value) {
|
|
76
|
-
const inMemory = this.isMemoryKey(key);
|
|
77
|
-
if (inMemory) {
|
|
78
|
-
this.memory.set(key, value);
|
|
79
|
-
}
|
|
80
|
-
const payload = {
|
|
81
|
-
key,
|
|
82
|
-
value,
|
|
83
|
-
inMemory,
|
|
84
|
-
type: 'set'
|
|
85
|
-
};
|
|
86
|
-
this.emitEvent(UniversalKeyValueStore.makeEventName(key), payload);
|
|
87
|
-
await idbSet(this.toStorageKey(key), value, this.store);
|
|
88
|
-
}
|
|
89
|
-
async remove(key) {
|
|
90
|
-
const inMemory = this.isMemoryKey(key);
|
|
91
|
-
if (inMemory) {
|
|
92
|
-
this.memory.delete(key);
|
|
93
|
-
}
|
|
94
|
-
const payload = {
|
|
95
|
-
key,
|
|
96
|
-
value: undefined,
|
|
97
|
-
inMemory,
|
|
98
|
-
type: 'remove'
|
|
99
|
-
};
|
|
100
|
-
this.emitEvent(UniversalKeyValueStore.makeEventName(key), payload);
|
|
101
|
-
await idbDel(this.toStorageKey(key), this.store);
|
|
102
|
-
}
|
|
103
|
-
async getAll() {
|
|
104
|
-
const persistentRaw = await idbEntries(this.store);
|
|
105
|
-
const persistent = {};
|
|
106
|
-
for (const [storageKey, value] of Object.entries(persistentRaw)) {
|
|
107
|
-
persistent[storageKey] = value;
|
|
108
|
-
}
|
|
109
|
-
const result = {
|
|
110
|
-
...persistent
|
|
111
|
-
};
|
|
112
|
-
for (const [key, value] of this.memory.entries()) {
|
|
113
|
-
result[String(key)] = value;
|
|
114
|
-
}
|
|
115
|
-
return result;
|
|
116
|
-
}
|
|
117
|
-
getAllMemory() {
|
|
118
|
-
return Array.from(this.memory.entries()).reduce((acc, [key, value]) => {
|
|
119
|
-
acc[String(key)] = value;
|
|
120
|
-
return acc;
|
|
121
|
-
}, {});
|
|
122
|
-
}
|
|
123
|
-
subscribe(key, listener, options) {
|
|
124
|
-
const eventName = UniversalKeyValueStore.makeEventName(key);
|
|
125
|
-
const unsubscribe = this.emitter.on(eventName, listener, false);
|
|
126
|
-
if (options !== null && options !== void 0 && options.callImmediately) {
|
|
127
|
-
this.get(key).then(value => {
|
|
128
|
-
if (value !== undefined) {
|
|
129
|
-
listener({
|
|
130
|
-
key,
|
|
131
|
-
value,
|
|
132
|
-
inMemory: this.isMemoryKey(key),
|
|
133
|
-
type: 'init'
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
return unsubscribe;
|
|
139
|
-
}
|
|
140
|
-
}
|
package/context/context.d.ts
DELETED
package/context/context.js
DELETED
package/context/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SimpleEventEmitter } from './SimpleEventEmitter';
|
|
2
|
-
import type { SPAContextType } from './types';
|
|
3
|
-
import { UniversalKeyValueStore } from './UniversalKeyValueStore';
|
|
4
|
-
import { useSPAContext } from './useSPAContext';
|
|
5
|
-
export type { SPAContextType };
|
|
6
|
-
export { useSPAContext, SimpleEventEmitter, UniversalKeyValueStore };
|
|
7
|
-
export declare const SPAContextProvider: import("react").Provider<SPAContextType | undefined>;
|
package/context/index.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { SPAContext } from './context';
|
|
2
|
-
import { SimpleEventEmitter } from './SimpleEventEmitter';
|
|
3
|
-
import { UniversalKeyValueStore } from './UniversalKeyValueStore';
|
|
4
|
-
import { useSPAContext } from './useSPAContext';
|
|
5
|
-
export { useSPAContext, SimpleEventEmitter, UniversalKeyValueStore };
|
|
6
|
-
export const SPAContextProvider = SPAContext.Provider;
|
package/context/types.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { type History } from 'history';
|
|
2
|
-
import type { GrpcClient, HttpClient, RpcClient } from '@pushwoosh/http-client';
|
|
3
|
-
import type { API as RpcGatewayJourneyAPI } from '@pushwoosh/rpc-gateway-journey-data';
|
|
4
|
-
import type { API as RpcGatewayPaymentAPI } from '@pushwoosh/rpc-gateway-payment-data';
|
|
5
|
-
import type { API as RpcGatewayAPI } from '@pushwoosh/rpc-v2-http-api-data';
|
|
6
|
-
import type { SessionStore } from '@pushwoosh/session-store';
|
|
7
|
-
import type { SimpleEventEmitter } from './SimpleEventEmitter';
|
|
8
|
-
import type { UniversalKeyValueStore } from './UniversalKeyValueStore';
|
|
9
|
-
export type Environment = {
|
|
10
|
-
isPWI: boolean;
|
|
11
|
-
isPushwoosh: boolean;
|
|
12
|
-
isWavesend: boolean;
|
|
13
|
-
isOMO: boolean;
|
|
14
|
-
};
|
|
15
|
-
export type SPAContextType = {
|
|
16
|
-
readonly history: History;
|
|
17
|
-
readonly httpClient: HttpClient;
|
|
18
|
-
readonly rpcClient: RpcClient;
|
|
19
|
-
readonly grpcClient: GrpcClient;
|
|
20
|
-
readonly grpcBridge: {
|
|
21
|
-
readonly clients: {
|
|
22
|
-
readonly billingGrpcClient: GrpcClient;
|
|
23
|
-
};
|
|
24
|
-
};
|
|
25
|
-
readonly sessionStore: SessionStore;
|
|
26
|
-
readonly rpcGateway: RpcGatewayAPI;
|
|
27
|
-
readonly rpcGatewayJourney: RpcGatewayJourneyAPI;
|
|
28
|
-
readonly rpcGatewayPayment: RpcGatewayPaymentAPI;
|
|
29
|
-
readonly language: string;
|
|
30
|
-
readonly helpers: {
|
|
31
|
-
readonly getApiOrigin: (name: string) => string;
|
|
32
|
-
readonly getJsonApiUrl: (method: string) => string;
|
|
33
|
-
};
|
|
34
|
-
readonly eventBus: SimpleEventEmitter;
|
|
35
|
-
readonly environment: Environment;
|
|
36
|
-
readonly keyValueStorage: UniversalKeyValueStore;
|
|
37
|
-
readonly __smartComponentsCache: Record<string, any>;
|
|
38
|
-
};
|
package/context/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useSPAContext(): import("./types").SPAContextType;
|
package/context/useSPAContext.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { SPAContext } from './context';
|
|
3
|
-
export function useSPAContext() {
|
|
4
|
-
const contextValue = useContext(SPAContext);
|
|
5
|
-
if (!contextValue) {
|
|
6
|
-
throw new Error('useSPAContext must be used within a SPAContextProvider');
|
|
7
|
-
}
|
|
8
|
-
return contextValue;
|
|
9
|
-
}
|