@pushwoosh/smart-components-kit 1.0.39 → 1.0.41

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.
@@ -25,11 +25,8 @@ export const usePresetOpenActions = pushPreset => {
25
25
  return '';
26
26
  }
27
27
  }, [openToast, rpcGateway]);
28
- const getOpenActionsByPreset = useCallback(async () => {
28
+ const getOpenActionsFromV2Preset = useCallback(async pushPreset => {
29
29
  var _pushPreset$localized, _pushPreset$openActio, _pushPreset$openActio2;
30
- if (!pushPreset) {
31
- return;
32
- }
33
30
  const safariUrlArgs = ((_pushPreset$localized = pushPreset.localizedProperties.default) === null || _pushPreset$localized === void 0 || (_pushPreset$localized = _pushPreset$localized.safari) === null || _pushPreset$localized === void 0 || (_pushPreset$localized = _pushPreset$localized.urlArguments) === null || _pushPreset$localized === void 0 ? void 0 : _pushPreset$localized[0]) ?? null;
34
31
  const webPageUrl = isWebLink(pushPreset.url) ? pushPreset.url : null;
35
32
  const {
@@ -46,18 +43,25 @@ export const usePresetOpenActions = pushPreset => {
46
43
  const deeplinkManual = pushPreset.openAction.kind.data;
47
44
  defaultDeeplinkUrl = deeplinkManual.url;
48
45
  }
46
+ return {
47
+ webPageUrl,
48
+ defaultDeeplinkUrl,
49
+ platformsDeeplinkUrls,
50
+ safariUrlArgs,
51
+ showRichmedia
52
+ };
53
+ }, [getDeeplinkUrl]);
54
+ const getOpenActionsByPreset = useCallback(async () => {
55
+ if (!pushPreset) {
56
+ return;
57
+ }
58
+ const openActions = pushPreset.isV2 ? await getOpenActionsFromV2Preset(pushPreset) : await getOpenActionsFromV1Preset(pushPreset);
49
59
  // setTimeout нужен, чтобы не получать ошибку 'ResizeObserver loop completed with undelivered notifications.'
50
60
  // Она возникает, когда этот хук вызывается ВНУТРИ Modal и с пересчетом её размера. Подробности в тикете FRONT-750
51
61
  setTimeout(() => {
52
- setOpenActions({
53
- webPageUrl,
54
- defaultDeeplinkUrl,
55
- platformsDeeplinkUrls,
56
- safariUrlArgs,
57
- showRichmedia
58
- });
62
+ setOpenActions(openActions);
59
63
  }, 0);
60
- }, [getDeeplinkUrl, pushPreset]);
64
+ }, [getOpenActionsFromV2Preset, pushPreset]);
61
65
  useEffect(() => {
62
66
  getOpenActionsByPreset();
63
67
  }, [getOpenActionsByPreset]);
@@ -93,4 +97,20 @@ const getPlatformDeeplinksByOpenActions = async (pushPreset, getDeeplinkUrl) =>
93
97
  platformsDeeplinkUrls,
94
98
  showRichmedia
95
99
  };
100
+ };
101
+ const getOpenActionsFromV1Preset = async pushPreset => {
102
+ var _pushPreset$localized2, _pushPreset$localized3;
103
+ const webPageUrl = !pushPreset.deeplink && isWebLink(pushPreset.url) ? pushPreset.url : null;
104
+ const defaultDeeplinkUrl = pushPreset.deeplink && pushPreset.url ? pushPreset.url : null;
105
+ const showRichmedia = pushPreset.richmedia ? {
106
+ code: pushPreset.richmedia
107
+ } : null;
108
+ const safariUrlArgs = ((_pushPreset$localized2 = pushPreset.localizedProperties.default) === null || _pushPreset$localized2 === void 0 || (_pushPreset$localized2 = _pushPreset$localized2.safari) === null || _pushPreset$localized2 === void 0 || (_pushPreset$localized2 = _pushPreset$localized2.urlArguments) === null || _pushPreset$localized2 === void 0 ? void 0 : _pushPreset$localized2[0]) ?? ((_pushPreset$localized3 = pushPreset.localizedProperties.en) === null || _pushPreset$localized3 === void 0 || (_pushPreset$localized3 = _pushPreset$localized3.safari) === null || _pushPreset$localized3 === void 0 || (_pushPreset$localized3 = _pushPreset$localized3.urlArguments) === null || _pushPreset$localized3 === void 0 ? void 0 : _pushPreset$localized3[0]) ?? null;
109
+ return {
110
+ webPageUrl,
111
+ defaultDeeplinkUrl,
112
+ platformsDeeplinkUrls: {},
113
+ safariUrlArgs,
114
+ showRichmedia
115
+ };
96
116
  };
@@ -1,5 +1,4 @@
1
1
  import { type History } from 'history';
2
- import type { GrpcBridge } from '@pushwoosh/grpc-bridge';
3
2
  import type { GrpcClient, HttpClient, RpcClient } from '@pushwoosh/http-client';
4
3
  import type { API as RpcGatewayJourneyAPI } from '@pushwoosh/rpc-gateway-journey-data';
5
4
  import type { API as RpcGatewayAPI } from '@pushwoosh/rpc-v2-http-api-data';
@@ -9,7 +8,11 @@ export type SPAContextType = {
9
8
  readonly httpClient: HttpClient;
10
9
  readonly rpcClient: RpcClient;
11
10
  readonly grpcClient: GrpcClient;
12
- readonly grpcBridge: GrpcBridge;
11
+ readonly grpcBridge: {
12
+ clients: {
13
+ billingGrpcClient: GrpcClient;
14
+ };
15
+ };
13
16
  readonly sessionStore: SessionStore;
14
17
  readonly rpcGateway: RpcGatewayAPI;
15
18
  readonly rpcGatewayJourney: RpcGatewayJourneyAPI;
package/package.json CHANGED
@@ -16,7 +16,6 @@
16
16
  },
17
17
  "pre-commit": "check",
18
18
  "dependencies": {
19
- "@emoji-mart/react": "^1.1.1",
20
19
  "@floating-ui/react-dom": "^2.1.2",
21
20
  "@pushwoosh/dumb-components": "^1.1.2",
22
21
  "@pushwoosh/kit-constants": "^1.6.9",
@@ -26,7 +25,6 @@
26
25
  },
27
26
  "devDependencies": {
28
27
  "@pushwoosh/frontend-builder-engine": "^1.0.17",
29
- "@pushwoosh/grpc-bridge": "^1.5.36",
30
28
  "@pushwoosh/http-client": "^2.5.0",
31
29
  "@pushwoosh/session-store": "^2.5.0",
32
30
  "@types/react": "^18.3.5",
@@ -40,7 +38,6 @@
40
38
  "typescript": "^5.8.2"
41
39
  },
42
40
  "peerDependencies": {
43
- "@pushwoosh/grpc-bridge": "^1.5.36",
44
41
  "@pushwoosh/http-client": "^2.5.0",
45
42
  "@pushwoosh/rpc-gateway-journey-data": "^0.26.206",
46
43
  "@pushwoosh/rpc-v2-http-api-data": "^0.1.566",
@@ -51,5 +48,5 @@
51
48
  "engines": {
52
49
  "node": ">= 18"
53
50
  },
54
- "version": "1.0.39"
51
+ "version": "1.0.41"
55
52
  }