@cloudparse/up-miniapps-sdk 0.6.8 → 0.7.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 +12 -0
- package/dist/index.browser.min.js +104 -101
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.cjs +952 -988
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +62 -2
- package/dist/index.d.ts +62 -2
- package/dist/index.js +919 -954
- package/dist/index.js.map +1 -1
- package/dist/style.css +96 -18
- package/package.json +3 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { ReactNode } from 'react';
|
|
2
|
+
import React__default, { ReactNode, TouchEvent } from 'react';
|
|
3
3
|
import { R as RouteResponse, a as RouteStep, b as RouteRequest, c as RoutingBackendConfig } from './index-B9dDciJq.cjs';
|
|
4
4
|
export { C as ClearRouteRequest, D as DrawRouteRequest, h as handleClearRoute, d as handleDrawRoute, e as handleRouteRequest } from './index-B9dDciJq.cjs';
|
|
5
5
|
import { ViewState, StyleSpecification, ImmutableLike } from '@vis.gl/react-maplibre';
|
|
@@ -211,6 +211,37 @@ interface IFidelityTransaction {
|
|
|
211
211
|
/** Type of transaction */
|
|
212
212
|
type: FidelityTransactionTypeType;
|
|
213
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Achievement Types
|
|
216
|
+
*/
|
|
217
|
+
/**
|
|
218
|
+
* A player's progress towards a single named Achievement. The Hub tracks a
|
|
219
|
+
* raw in-app action count per Achievement `slug` (reported server-to-server
|
|
220
|
+
* by each mini-app's own backend — never by this SDK, see `sdk.achievement`/
|
|
221
|
+
* `sdk.achievements` doc comments in `sdk.ts`) and auto-credits UP+XP once
|
|
222
|
+
* `playerActionCount` reaches `totalActionCount`. This is a read-only view
|
|
223
|
+
* for rendering progress (e.g. a progress bar) — there is no "claim" step.
|
|
224
|
+
*/
|
|
225
|
+
interface IAchievement {
|
|
226
|
+
/** Unique slug identifying the Achievement (e.g. "explore-5-pois"). */
|
|
227
|
+
slug: string;
|
|
228
|
+
/** Display title. */
|
|
229
|
+
title: string;
|
|
230
|
+
/** Display description. */
|
|
231
|
+
description: string;
|
|
232
|
+
/** The player's current raw in-app action count towards this Achievement. */
|
|
233
|
+
playerActionCount: number;
|
|
234
|
+
/** The action count required to complete this Achievement. */
|
|
235
|
+
totalActionCount: number;
|
|
236
|
+
/** UP points credited automatically once completed. */
|
|
237
|
+
upReward: number;
|
|
238
|
+
/** XP credited automatically once completed. */
|
|
239
|
+
xpReward: number;
|
|
240
|
+
/** Whether `playerActionCount` has reached `totalActionCount`. */
|
|
241
|
+
completed: boolean;
|
|
242
|
+
/** Optional illustration/icon URL. */
|
|
243
|
+
imageUrl?: string;
|
|
244
|
+
}
|
|
214
245
|
/**
|
|
215
246
|
* The initialization options required to set up the Mini-App SDK.
|
|
216
247
|
*/
|
|
@@ -553,6 +584,16 @@ type BridgeMessageType = {
|
|
|
553
584
|
type: "GET_FIDELITY_HISTORY";
|
|
554
585
|
payload: IFidelityHistoryParams;
|
|
555
586
|
callbackId: string;
|
|
587
|
+
} | {
|
|
588
|
+
type: "GET_ACHIEVEMENT";
|
|
589
|
+
payload: {
|
|
590
|
+
slug: string;
|
|
591
|
+
};
|
|
592
|
+
callbackId: string;
|
|
593
|
+
} | {
|
|
594
|
+
type: "GET_ACHIEVEMENTS";
|
|
595
|
+
payload?: unknown;
|
|
596
|
+
callbackId: string;
|
|
556
597
|
} | {
|
|
557
598
|
type: "EXIT";
|
|
558
599
|
payload?: unknown;
|
|
@@ -1259,6 +1300,12 @@ interface SwipeCarouselProps {
|
|
|
1259
1300
|
}
|
|
1260
1301
|
declare const SwipeCarousel: ({ items, activeId, onActiveChange, peek, gap, className, itemClassName, axisPriority, verticalDrag, overscan, visibleOverscan, }: SwipeCarouselProps) => React.JSX.Element;
|
|
1261
1302
|
|
|
1303
|
+
declare const useTapAction: (action: () => void) => {
|
|
1304
|
+
onClick: () => void;
|
|
1305
|
+
onTouchEnd: (e: TouchEvent<HTMLElement>) => void;
|
|
1306
|
+
onTouchStart: (e: TouchEvent<HTMLElement>) => void;
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1262
1309
|
declare class MiniAppSDK {
|
|
1263
1310
|
/**
|
|
1264
1311
|
* Map services.
|
|
@@ -1565,6 +1612,19 @@ declare class MiniAppSDK {
|
|
|
1565
1612
|
* Returns `null` before the first successful `initialize()`/context push.
|
|
1566
1613
|
*/
|
|
1567
1614
|
getEnv<T extends Record<string, unknown> = Record<string, unknown>>(): T | null;
|
|
1615
|
+
/**
|
|
1616
|
+
* Fetches a single Achievement's current progress by slug — read-only, for
|
|
1617
|
+
* rendering things like a progress bar. Progress is reported server-side
|
|
1618
|
+
* by the mini-app's own backend calling the Hub's M2M endpoint directly;
|
|
1619
|
+
* there is no corresponding "report progress" method on this SDK.
|
|
1620
|
+
* @param slug Unique slug identifying the Achievement.
|
|
1621
|
+
*/
|
|
1622
|
+
achievement(slug: string): Promise<IAchievement>;
|
|
1623
|
+
/**
|
|
1624
|
+
* Fetches every Achievement (with current progress) visible to this
|
|
1625
|
+
* mini-app — read-only, same boundary as {@link MiniAppSDK.achievement}.
|
|
1626
|
+
*/
|
|
1627
|
+
achievements(): Promise<IAchievement[]>;
|
|
1568
1628
|
/**
|
|
1569
1629
|
* Registers a callback for a specific event from the native shell.
|
|
1570
1630
|
* @param event The name of the event to listen for.
|
|
@@ -1825,4 +1885,4 @@ interface BroadcastWsServiceClient<TMessage extends WsMessage = WsMessage> {
|
|
|
1825
1885
|
declare function createWsService<TMessage extends WsMessage = WsMessage>(options: CreateChannelWsServiceOptions<TMessage>): WsServiceClient<TMessage>;
|
|
1826
1886
|
declare function createWsService<TMessage extends WsMessage = WsMessage>(options: CreateBroadcastWsServiceOptions<TMessage>): BroadcastWsServiceClient<TMessage>;
|
|
1827
1887
|
|
|
1828
|
-
export { type ApiServiceClient, type BridgeMessageType, BridgeMocker, type BridgeMockerProps, type BroadcastWsServiceClient, type CenterCallbackParams, type CreateApiServiceOptions, type CreateBroadcastWsServiceOptions, type CreateChannelWsServiceOptions, type CreateWsServiceOptions, type CustomControl, DebugConsole, type DebugConsoleProps, type DeclarativeJourneyOptions, type DrawerState, type EtaData, type FidelityTransactionTypeType, type FlyToParams, GeolocationEvent, GlobalEvent, type HapticStyleType, type IBridgeEnvelope, type IContextState, type IEdgeInsets, type IFidelityBalance, type IFidelityHistoryParams, type IFidelityTransaction, type IGenerateQrCodeOptions, type IInitializationOptions, type IInitializationResponse, type ILocationData, type INetworkOptions, type INetworkResponse, type IPaymentRequest, type IPickImageResult, type ISaveImageResult, type IUserProfile, type LiveRoutingOptions, type LiveRoutingResult, type LocationStreamConfig, Map, MapControls, MapControlsContext, type MapControlsProps, type MapControlsState, type MapInsets, MapMenu, MapMenuDivider, type MapMenuDividerProps, MapMenuFooter, type MapMenuFooterProps, MapMenuItem, type MapMenuItemProps, type MapMenuProps, MapMenuTitle, type MapMenuTitleProps, type MapProps, type MenuItem, MiniAppSDK, MockLocationContext, type MockLocationContextType, type NetworkMethodType, type POI, PullToRefresh, type PullToRefreshIndicatorState, type PullToRefreshProps, QRScanner, type QRScannerProps, RouteLayer, type RouteLayerProps, RouteRequest, RouteResponse, RouteStep, type SDKEvent, SDKMapProvider, SDKProvider, type SDKProviderProps, type ScrollConfig, type StreamAccelerometerData, type StreamHeadingData, type StreamLocationData, type StreamUpdatePayload, type SwipeAxisPriority, SwipeCarousel, type SwipeCarouselItem, type SwipeCarouselProps, type SwipeCarouselVerticalDragConfig, UIEvent, type UseJourneyOptions, type UseJourneyResult, type UserLocationState, type WsConnectionStatus, type WsMessage, type WsServiceClient, createApiService, createWsService, sdk as default, renderMap, sdk, useIsMocked, useJourney, useLiveRouting, useMapControls, useMockLocation, useRoute, useTrimmedRoute, useUserLocation };
|
|
1888
|
+
export { type ApiServiceClient, type BridgeMessageType, BridgeMocker, type BridgeMockerProps, type BroadcastWsServiceClient, type CenterCallbackParams, type CreateApiServiceOptions, type CreateBroadcastWsServiceOptions, type CreateChannelWsServiceOptions, type CreateWsServiceOptions, type CustomControl, DebugConsole, type DebugConsoleProps, type DeclarativeJourneyOptions, type DrawerState, type EtaData, type FidelityTransactionTypeType, type FlyToParams, GeolocationEvent, GlobalEvent, type HapticStyleType, type IAchievement, type IBridgeEnvelope, type IContextState, type IEdgeInsets, type IFidelityBalance, type IFidelityHistoryParams, type IFidelityTransaction, type IGenerateQrCodeOptions, type IInitializationOptions, type IInitializationResponse, type ILocationData, type INetworkOptions, type INetworkResponse, type IPaymentRequest, type IPickImageResult, type ISaveImageResult, type IUserProfile, type LiveRoutingOptions, type LiveRoutingResult, type LocationStreamConfig, Map, MapControls, MapControlsContext, type MapControlsProps, type MapControlsState, type MapInsets, MapMenu, MapMenuDivider, type MapMenuDividerProps, MapMenuFooter, type MapMenuFooterProps, MapMenuItem, type MapMenuItemProps, type MapMenuProps, MapMenuTitle, type MapMenuTitleProps, type MapProps, type MenuItem, MiniAppSDK, MockLocationContext, type MockLocationContextType, type NetworkMethodType, type POI, PullToRefresh, type PullToRefreshIndicatorState, type PullToRefreshProps, QRScanner, type QRScannerProps, RouteLayer, type RouteLayerProps, RouteRequest, RouteResponse, RouteStep, type SDKEvent, SDKMapProvider, SDKProvider, type SDKProviderProps, type ScrollConfig, type StreamAccelerometerData, type StreamHeadingData, type StreamLocationData, type StreamUpdatePayload, type SwipeAxisPriority, SwipeCarousel, type SwipeCarouselItem, type SwipeCarouselProps, type SwipeCarouselVerticalDragConfig, UIEvent, type UseJourneyOptions, type UseJourneyResult, type UserLocationState, type WsConnectionStatus, type WsMessage, type WsServiceClient, createApiService, createWsService, sdk as default, renderMap, sdk, useIsMocked, useJourney, useLiveRouting, useMapControls, useMockLocation, useRoute, useTapAction, useTrimmedRoute, useUserLocation };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { ReactNode } from 'react';
|
|
2
|
+
import React__default, { ReactNode, TouchEvent } from 'react';
|
|
3
3
|
import { R as RouteResponse, a as RouteStep, b as RouteRequest, c as RoutingBackendConfig } from './index-B9dDciJq.js';
|
|
4
4
|
export { C as ClearRouteRequest, D as DrawRouteRequest, h as handleClearRoute, d as handleDrawRoute, e as handleRouteRequest } from './index-B9dDciJq.js';
|
|
5
5
|
import { ViewState, StyleSpecification, ImmutableLike } from '@vis.gl/react-maplibre';
|
|
@@ -211,6 +211,37 @@ interface IFidelityTransaction {
|
|
|
211
211
|
/** Type of transaction */
|
|
212
212
|
type: FidelityTransactionTypeType;
|
|
213
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Achievement Types
|
|
216
|
+
*/
|
|
217
|
+
/**
|
|
218
|
+
* A player's progress towards a single named Achievement. The Hub tracks a
|
|
219
|
+
* raw in-app action count per Achievement `slug` (reported server-to-server
|
|
220
|
+
* by each mini-app's own backend — never by this SDK, see `sdk.achievement`/
|
|
221
|
+
* `sdk.achievements` doc comments in `sdk.ts`) and auto-credits UP+XP once
|
|
222
|
+
* `playerActionCount` reaches `totalActionCount`. This is a read-only view
|
|
223
|
+
* for rendering progress (e.g. a progress bar) — there is no "claim" step.
|
|
224
|
+
*/
|
|
225
|
+
interface IAchievement {
|
|
226
|
+
/** Unique slug identifying the Achievement (e.g. "explore-5-pois"). */
|
|
227
|
+
slug: string;
|
|
228
|
+
/** Display title. */
|
|
229
|
+
title: string;
|
|
230
|
+
/** Display description. */
|
|
231
|
+
description: string;
|
|
232
|
+
/** The player's current raw in-app action count towards this Achievement. */
|
|
233
|
+
playerActionCount: number;
|
|
234
|
+
/** The action count required to complete this Achievement. */
|
|
235
|
+
totalActionCount: number;
|
|
236
|
+
/** UP points credited automatically once completed. */
|
|
237
|
+
upReward: number;
|
|
238
|
+
/** XP credited automatically once completed. */
|
|
239
|
+
xpReward: number;
|
|
240
|
+
/** Whether `playerActionCount` has reached `totalActionCount`. */
|
|
241
|
+
completed: boolean;
|
|
242
|
+
/** Optional illustration/icon URL. */
|
|
243
|
+
imageUrl?: string;
|
|
244
|
+
}
|
|
214
245
|
/**
|
|
215
246
|
* The initialization options required to set up the Mini-App SDK.
|
|
216
247
|
*/
|
|
@@ -553,6 +584,16 @@ type BridgeMessageType = {
|
|
|
553
584
|
type: "GET_FIDELITY_HISTORY";
|
|
554
585
|
payload: IFidelityHistoryParams;
|
|
555
586
|
callbackId: string;
|
|
587
|
+
} | {
|
|
588
|
+
type: "GET_ACHIEVEMENT";
|
|
589
|
+
payload: {
|
|
590
|
+
slug: string;
|
|
591
|
+
};
|
|
592
|
+
callbackId: string;
|
|
593
|
+
} | {
|
|
594
|
+
type: "GET_ACHIEVEMENTS";
|
|
595
|
+
payload?: unknown;
|
|
596
|
+
callbackId: string;
|
|
556
597
|
} | {
|
|
557
598
|
type: "EXIT";
|
|
558
599
|
payload?: unknown;
|
|
@@ -1259,6 +1300,12 @@ interface SwipeCarouselProps {
|
|
|
1259
1300
|
}
|
|
1260
1301
|
declare const SwipeCarousel: ({ items, activeId, onActiveChange, peek, gap, className, itemClassName, axisPriority, verticalDrag, overscan, visibleOverscan, }: SwipeCarouselProps) => React.JSX.Element;
|
|
1261
1302
|
|
|
1303
|
+
declare const useTapAction: (action: () => void) => {
|
|
1304
|
+
onClick: () => void;
|
|
1305
|
+
onTouchEnd: (e: TouchEvent<HTMLElement>) => void;
|
|
1306
|
+
onTouchStart: (e: TouchEvent<HTMLElement>) => void;
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1262
1309
|
declare class MiniAppSDK {
|
|
1263
1310
|
/**
|
|
1264
1311
|
* Map services.
|
|
@@ -1565,6 +1612,19 @@ declare class MiniAppSDK {
|
|
|
1565
1612
|
* Returns `null` before the first successful `initialize()`/context push.
|
|
1566
1613
|
*/
|
|
1567
1614
|
getEnv<T extends Record<string, unknown> = Record<string, unknown>>(): T | null;
|
|
1615
|
+
/**
|
|
1616
|
+
* Fetches a single Achievement's current progress by slug — read-only, for
|
|
1617
|
+
* rendering things like a progress bar. Progress is reported server-side
|
|
1618
|
+
* by the mini-app's own backend calling the Hub's M2M endpoint directly;
|
|
1619
|
+
* there is no corresponding "report progress" method on this SDK.
|
|
1620
|
+
* @param slug Unique slug identifying the Achievement.
|
|
1621
|
+
*/
|
|
1622
|
+
achievement(slug: string): Promise<IAchievement>;
|
|
1623
|
+
/**
|
|
1624
|
+
* Fetches every Achievement (with current progress) visible to this
|
|
1625
|
+
* mini-app — read-only, same boundary as {@link MiniAppSDK.achievement}.
|
|
1626
|
+
*/
|
|
1627
|
+
achievements(): Promise<IAchievement[]>;
|
|
1568
1628
|
/**
|
|
1569
1629
|
* Registers a callback for a specific event from the native shell.
|
|
1570
1630
|
* @param event The name of the event to listen for.
|
|
@@ -1825,4 +1885,4 @@ interface BroadcastWsServiceClient<TMessage extends WsMessage = WsMessage> {
|
|
|
1825
1885
|
declare function createWsService<TMessage extends WsMessage = WsMessage>(options: CreateChannelWsServiceOptions<TMessage>): WsServiceClient<TMessage>;
|
|
1826
1886
|
declare function createWsService<TMessage extends WsMessage = WsMessage>(options: CreateBroadcastWsServiceOptions<TMessage>): BroadcastWsServiceClient<TMessage>;
|
|
1827
1887
|
|
|
1828
|
-
export { type ApiServiceClient, type BridgeMessageType, BridgeMocker, type BridgeMockerProps, type BroadcastWsServiceClient, type CenterCallbackParams, type CreateApiServiceOptions, type CreateBroadcastWsServiceOptions, type CreateChannelWsServiceOptions, type CreateWsServiceOptions, type CustomControl, DebugConsole, type DebugConsoleProps, type DeclarativeJourneyOptions, type DrawerState, type EtaData, type FidelityTransactionTypeType, type FlyToParams, GeolocationEvent, GlobalEvent, type HapticStyleType, type IBridgeEnvelope, type IContextState, type IEdgeInsets, type IFidelityBalance, type IFidelityHistoryParams, type IFidelityTransaction, type IGenerateQrCodeOptions, type IInitializationOptions, type IInitializationResponse, type ILocationData, type INetworkOptions, type INetworkResponse, type IPaymentRequest, type IPickImageResult, type ISaveImageResult, type IUserProfile, type LiveRoutingOptions, type LiveRoutingResult, type LocationStreamConfig, Map, MapControls, MapControlsContext, type MapControlsProps, type MapControlsState, type MapInsets, MapMenu, MapMenuDivider, type MapMenuDividerProps, MapMenuFooter, type MapMenuFooterProps, MapMenuItem, type MapMenuItemProps, type MapMenuProps, MapMenuTitle, type MapMenuTitleProps, type MapProps, type MenuItem, MiniAppSDK, MockLocationContext, type MockLocationContextType, type NetworkMethodType, type POI, PullToRefresh, type PullToRefreshIndicatorState, type PullToRefreshProps, QRScanner, type QRScannerProps, RouteLayer, type RouteLayerProps, RouteRequest, RouteResponse, RouteStep, type SDKEvent, SDKMapProvider, SDKProvider, type SDKProviderProps, type ScrollConfig, type StreamAccelerometerData, type StreamHeadingData, type StreamLocationData, type StreamUpdatePayload, type SwipeAxisPriority, SwipeCarousel, type SwipeCarouselItem, type SwipeCarouselProps, type SwipeCarouselVerticalDragConfig, UIEvent, type UseJourneyOptions, type UseJourneyResult, type UserLocationState, type WsConnectionStatus, type WsMessage, type WsServiceClient, createApiService, createWsService, sdk as default, renderMap, sdk, useIsMocked, useJourney, useLiveRouting, useMapControls, useMockLocation, useRoute, useTrimmedRoute, useUserLocation };
|
|
1888
|
+
export { type ApiServiceClient, type BridgeMessageType, BridgeMocker, type BridgeMockerProps, type BroadcastWsServiceClient, type CenterCallbackParams, type CreateApiServiceOptions, type CreateBroadcastWsServiceOptions, type CreateChannelWsServiceOptions, type CreateWsServiceOptions, type CustomControl, DebugConsole, type DebugConsoleProps, type DeclarativeJourneyOptions, type DrawerState, type EtaData, type FidelityTransactionTypeType, type FlyToParams, GeolocationEvent, GlobalEvent, type HapticStyleType, type IAchievement, type IBridgeEnvelope, type IContextState, type IEdgeInsets, type IFidelityBalance, type IFidelityHistoryParams, type IFidelityTransaction, type IGenerateQrCodeOptions, type IInitializationOptions, type IInitializationResponse, type ILocationData, type INetworkOptions, type INetworkResponse, type IPaymentRequest, type IPickImageResult, type ISaveImageResult, type IUserProfile, type LiveRoutingOptions, type LiveRoutingResult, type LocationStreamConfig, Map, MapControls, MapControlsContext, type MapControlsProps, type MapControlsState, type MapInsets, MapMenu, MapMenuDivider, type MapMenuDividerProps, MapMenuFooter, type MapMenuFooterProps, MapMenuItem, type MapMenuItemProps, type MapMenuProps, MapMenuTitle, type MapMenuTitleProps, type MapProps, type MenuItem, MiniAppSDK, MockLocationContext, type MockLocationContextType, type NetworkMethodType, type POI, PullToRefresh, type PullToRefreshIndicatorState, type PullToRefreshProps, QRScanner, type QRScannerProps, RouteLayer, type RouteLayerProps, RouteRequest, RouteResponse, RouteStep, type SDKEvent, SDKMapProvider, SDKProvider, type SDKProviderProps, type ScrollConfig, type StreamAccelerometerData, type StreamHeadingData, type StreamLocationData, type StreamUpdatePayload, type SwipeAxisPriority, SwipeCarousel, type SwipeCarouselItem, type SwipeCarouselProps, type SwipeCarouselVerticalDragConfig, UIEvent, type UseJourneyOptions, type UseJourneyResult, type UserLocationState, type WsConnectionStatus, type WsMessage, type WsServiceClient, createApiService, createWsService, sdk as default, renderMap, sdk, useIsMocked, useJourney, useLiveRouting, useMapControls, useMockLocation, useRoute, useTapAction, useTrimmedRoute, useUserLocation };
|