@inappstory/game-center-api 1.2.3 → 1.3.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 CHANGED
@@ -99,3 +99,21 @@ import GameCenterApi from "@inappstory/game-center-api";
99
99
 
100
100
  const closeGame = () => GameCenterApi.closeGameReader();
101
101
  ```
102
+
103
+ ## Get Application version
104
+
105
+ ```ts
106
+ import GameCenterApi from "@inappstory/game-center-api";
107
+
108
+ // 1.2.3
109
+ const version: string | null = GameCenterApi.getApplicationVersion();
110
+ ```
111
+
112
+ ## Get Application build version
113
+
114
+ ```ts
115
+ import GameCenterApi from "@inappstory/game-center-api";
116
+
117
+ // 300
118
+ const version: number | null = GameCenterApi.getApplicationBuildVersion();
119
+ ```
package/lib/index.d.ts CHANGED
@@ -6,7 +6,7 @@ import { gameLocalData } from "./localData";
6
6
  import { closeGameReader, createSdkApi, reloadGameReader } from "./sdkApi";
7
7
  import { gameLoadedSdkCallback, gameLoadFailedSdkCallback, gameShouldForegroundCallback, gameOnForeground } from "./sdkApi/initGame";
8
8
  import { openUrl } from "./sdkApi/openUrl";
9
- import { share } from "./sdkApi/share";
9
+ import { shareText, shareUrl, shareFiles } from "./sdkApi/share";
10
10
  import { vibrate } from "./sdkApi/vibrate";
11
11
  import { ScreenOrientation, Placeholder, PlaceholderType, GameLaunchConfig } from "./gameLaunchConfig.h";
12
12
  import { fetchLocalFile } from "./sdkApi/fetchLocalFile";
@@ -16,14 +16,13 @@ import { ResourceManager } from "./ResourceManager";
16
16
  import { hasFilePickerApi, openFilePicker } from "./sdkApi/filePicker";
17
17
  import { FilePickerResultType, isFilePickerResultFileList, isFilePickerResultLocalFileList, isLocalFile } from "./sdkApi/filePicker.h";
18
18
  export type { OpenFilePickerProps, SDKFileResponse, LocalFile, LocalFileList, FilePickerResultPayload, FilePickerResult } from "./sdkApi/filePicker.h";
19
- export type { ShareData as SDKShareData } from "./sdkApi/share";
20
19
  export type { PrimaryFontVariants as SDKPrimaryFontVariants, SecondaryFontVariants as SDKSecondaryFontVariants } from "./gameResources";
21
20
  export type { OpenUrlOptions as SDKOpenUrlOptions } from "./sdkApi/openUrl.h";
22
21
  export type { RequestInfo as APIRequestInfo, Response as APIResponse } from "./iasApi";
23
22
  export type { Placeholder, GameLaunchConfig };
24
23
  export type { ProjectFontFamily } from "./gameResources";
25
24
  export type { ResourceInterface } from "./ResourceManager";
26
- export { createSdkApi, closeGameReader, gameLoadedSdkCallback, gameLoadFailedSdkCallback, gameLaunchConfig, isIos, isWeb, isAndroid, isDev, getSdkVersion, getSemverSdkVersion, gameLocalData, sendIasApiRequest, openUrl, share, vibrate, getDynamicResourceAsset, getDynamicResourceFont, getProjectFontFamilyStylesheet, getIsDemoMode, getSessionId, getApiBaseUrl, ScreenOrientation, PlaceholderType, fetchLocalFile, openStory, ResourceManager, dynamicResourceAssets, dynamicResourceFonts, staticResourcesImagePlaceholders, StaticResourceList, eventGame, reloadGameReader, openFilePicker, FilePickerResultType, isFilePickerResultFileList, isFilePickerResultLocalFileList, isLocalFile, hasFilePickerApi, gameShouldForegroundCallback, gameOnForeground, getApplicationVersion, getApplicationBuildVersion, };
25
+ export { createSdkApi, closeGameReader, gameLoadedSdkCallback, gameLoadFailedSdkCallback, gameLaunchConfig, isIos, isWeb, isAndroid, isDev, getSdkVersion, getSemverSdkVersion, gameLocalData, sendIasApiRequest, openUrl, shareText, shareUrl, shareFiles, vibrate, getDynamicResourceAsset, getDynamicResourceFont, getProjectFontFamilyStylesheet, getIsDemoMode, getSessionId, getApiBaseUrl, ScreenOrientation, PlaceholderType, fetchLocalFile, openStory, ResourceManager, dynamicResourceAssets, dynamicResourceFonts, staticResourcesImagePlaceholders, StaticResourceList, eventGame, reloadGameReader, openFilePicker, FilePickerResultType, isFilePickerResultFileList, isFilePickerResultLocalFileList, isLocalFile, hasFilePickerApi, gameShouldForegroundCallback, gameOnForeground, getApplicationVersion, getApplicationBuildVersion, };
27
26
  declare const GameCenterApi: {
28
27
  createSdkApi: ({ mounted, beforeUnmount: beforeUnmountCb, onSdkCloseGameReaderIntent, onPause, onResume, onBackGesture, onAudioFocusChange, filterPlaceholders, gameShouldForeground, }: Partial<{
29
28
  mounted: () => void;
@@ -49,16 +48,13 @@ declare const GameCenterApi: {
49
48
  gameLocalData: import("./localData").LocalDataMap<string, any>;
50
49
  sendIasApiRequest: typeof sendIasApiRequest;
51
50
  openUrl: ({ url, closeGameReader }: import("./sdkApi/openUrl.h").OpenUrlOptions) => void;
52
- share: (config: Partial<{
53
- title: string | null;
54
- text: string | null;
55
- url: string | null;
56
- files: ({
57
- file: string;
58
- name: string;
59
- type: string;
60
- } | null)[];
61
- }>) => Promise<boolean>;
51
+ shareText: (text: string) => Promise<boolean>;
52
+ shareUrl: (url: string) => Promise<boolean>;
53
+ shareFiles: (files: {
54
+ file: string;
55
+ name: string;
56
+ type: string;
57
+ }[]) => Promise<boolean>;
62
58
  vibrate: (duration: number | number[] | null, fallbackStyle?: "impactLight" | "impactMedium" | "impactHeavy" | "selection" | "notificationSuccess" | "notificationWarning" | "notificationError" | undefined) => void;
63
59
  getDynamicResourceAsset: (key: string, defaultValue: any) => any;
64
60
  getDynamicResourceFont: (key: import("./gameResources").PrimaryFontVariants | import("./gameResources").SecondaryFontVariants) => string | null;
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = exports.getApplicationBuildVersion = exports.getApplicationVersion = exports.gameOnForeground = exports.gameShouldForegroundCallback = exports.hasFilePickerApi = exports.isLocalFile = exports.isFilePickerResultLocalFileList = exports.isFilePickerResultFileList = exports.FilePickerResultType = exports.openFilePicker = exports.reloadGameReader = exports.eventGame = exports.StaticResourceList = exports.staticResourcesImagePlaceholders = exports.dynamicResourceFonts = exports.dynamicResourceAssets = exports.ResourceManager = exports.openStory = exports.fetchLocalFile = exports.PlaceholderType = exports.ScreenOrientation = exports.getApiBaseUrl = exports.getSessionId = exports.getIsDemoMode = exports.getProjectFontFamilyStylesheet = exports.getDynamicResourceFont = exports.getDynamicResourceAsset = exports.vibrate = exports.share = exports.openUrl = exports.sendIasApiRequest = exports.gameLocalData = exports.getSemverSdkVersion = exports.getSdkVersion = exports.isDev = exports.isAndroid = exports.isWeb = exports.isIos = exports.gameLaunchConfig = exports.gameLoadFailedSdkCallback = exports.gameLoadedSdkCallback = exports.closeGameReader = exports.createSdkApi = void 0;
3
+ exports.default = exports.getApplicationBuildVersion = exports.getApplicationVersion = exports.gameOnForeground = exports.gameShouldForegroundCallback = exports.hasFilePickerApi = exports.isLocalFile = exports.isFilePickerResultLocalFileList = exports.isFilePickerResultFileList = exports.FilePickerResultType = exports.openFilePicker = exports.reloadGameReader = exports.eventGame = exports.StaticResourceList = exports.staticResourcesImagePlaceholders = exports.dynamicResourceFonts = exports.dynamicResourceAssets = exports.ResourceManager = exports.openStory = exports.fetchLocalFile = exports.PlaceholderType = exports.ScreenOrientation = exports.getApiBaseUrl = exports.getSessionId = exports.getIsDemoMode = exports.getProjectFontFamilyStylesheet = exports.getDynamicResourceFont = exports.getDynamicResourceAsset = exports.vibrate = exports.shareFiles = exports.shareUrl = exports.shareText = exports.openUrl = exports.sendIasApiRequest = exports.gameLocalData = exports.getSemverSdkVersion = exports.getSdkVersion = exports.isDev = exports.isAndroid = exports.isWeb = exports.isIos = exports.gameLaunchConfig = exports.gameLoadFailedSdkCallback = exports.gameLoadedSdkCallback = exports.closeGameReader = exports.createSdkApi = void 0;
4
4
  const env_1 = require("./env");
5
5
  Object.defineProperty(exports, "getApplicationBuildVersion", { enumerable: true, get: function () { return env_1.getApplicationBuildVersion; } });
6
6
  Object.defineProperty(exports, "getApplicationVersion", { enumerable: true, get: function () { return env_1.getApplicationVersion; } });
@@ -39,7 +39,9 @@ Object.defineProperty(exports, "gameOnForeground", { enumerable: true, get: func
39
39
  const openUrl_1 = require("./sdkApi/openUrl");
40
40
  Object.defineProperty(exports, "openUrl", { enumerable: true, get: function () { return openUrl_1.openUrl; } });
41
41
  const share_1 = require("./sdkApi/share");
42
- Object.defineProperty(exports, "share", { enumerable: true, get: function () { return share_1.share; } });
42
+ Object.defineProperty(exports, "shareText", { enumerable: true, get: function () { return share_1.shareText; } });
43
+ Object.defineProperty(exports, "shareUrl", { enumerable: true, get: function () { return share_1.shareUrl; } });
44
+ Object.defineProperty(exports, "shareFiles", { enumerable: true, get: function () { return share_1.shareFiles; } });
43
45
  const vibrate_1 = require("./sdkApi/vibrate");
44
46
  Object.defineProperty(exports, "vibrate", { enumerable: true, get: function () { return vibrate_1.vibrate; } });
45
47
  const gameLaunchConfig_h_1 = require("./gameLaunchConfig.h");
@@ -76,7 +78,9 @@ const GameCenterApi = {
76
78
  gameLocalData: localData_1.gameLocalData,
77
79
  sendIasApiRequest: iasApi_1.sendIasApiRequest,
78
80
  openUrl: openUrl_1.openUrl,
79
- share: share_1.share,
81
+ shareText: share_1.shareText,
82
+ shareUrl: share_1.shareUrl,
83
+ shareFiles: share_1.shareFiles,
80
84
  vibrate: vibrate_1.vibrate,
81
85
  getDynamicResourceAsset: gameResources_1.getDynamicResourceAsset,
82
86
  getDynamicResourceFont: gameResources_1.getDynamicResourceFont,
@@ -1,16 +1,12 @@
1
- export type ShareData = Partial<{
2
- title: string | null;
3
- text: string | null;
4
- url: string | null;
5
- files: Array<{
6
- file: string;
7
- name: string;
8
- type: string;
9
- } | null>;
10
- }>;
11
1
  declare global {
12
2
  interface Window {
13
3
  share_complete: (requestId: string, isSuccess: boolean) => void;
14
4
  }
15
5
  }
16
- export declare const share: (config: ShareData) => Promise<boolean>;
6
+ export declare const shareText: (text: string) => Promise<boolean>;
7
+ export declare const shareUrl: (url: string) => Promise<boolean>;
8
+ export declare const shareFiles: (files: Array<{
9
+ file: string;
10
+ name: string;
11
+ type: string;
12
+ }>) => Promise<boolean>;
@@ -1,11 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.share = void 0;
3
+ exports.shareFiles = exports.shareUrl = exports.shareText = void 0;
4
4
  const uuid_1 = require("uuid");
5
5
  const asyncQueue_1 = require("../asyncQueue");
6
6
  const env_1 = require("../env");
7
7
  const Source_1 = require("./web/Source");
8
- const share = async (config) => {
8
+ const shareText = (text) => share({ text });
9
+ exports.shareText = shareText;
10
+ const shareUrl = (url) => share({ url });
11
+ exports.shareUrl = shareUrl;
12
+ const shareFiles = (files) => share({ files });
13
+ exports.shareFiles = shareFiles;
14
+ const share = (config) => {
9
15
  return new Promise((resolve, reject) => {
10
16
  const id = (0, uuid_1.v4)();
11
17
  asyncQueue_1.asyncQueue.set(id, (plainData) => {
@@ -35,7 +41,6 @@ const share = async (config) => {
35
41
  }
36
42
  });
37
43
  };
38
- exports.share = share;
39
44
  window.share_complete = function (requestId, isSuccess) {
40
45
  try {
41
46
  if (asyncQueue_1.asyncQueue.has(requestId)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inappstory/game-center-api",
3
- "version": "1.2.3",
3
+ "version": "1.3.0",
4
4
  "description": "",
5
5
  "dependencies": {
6
6
  "semver": "^7.3.8",