@shopify/app-bridge-types 0.0.1
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 +15 -0
- package/index.d.ts +9 -0
- package/index.js +0 -0
- package/index.mjs +0 -0
- package/internal.d.ts +72 -0
- package/package.json +28 -0
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# `@shopify/app-bridge-types`
|
|
2
|
+
|
|
3
|
+
**[Join our team and work on libraries like this one.](https://www.shopify.ca/careers)**
|
|
4
|
+
|
|
5
|
+
[](LICENSE.md)
|
|
6
|
+
|
|
7
|
+
This is a companion library with TypeScript types for [Shopify App Bridge](https://shopify.dev/docs/api/app-bridge).
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
You can install Shopify App Bridge Types by using [Yarn](https://yarnpkg.com):
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
yarn add --dev @shopify/app-bridge-types
|
|
15
|
+
```
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
File without changes
|
package/index.mjs
ADDED
|
File without changes
|
package/internal.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
declare interface AppBridgeConfig {
|
|
2
|
+
host: string;
|
|
3
|
+
apiKey: string;
|
|
4
|
+
shop: string;
|
|
5
|
+
locale: string;
|
|
6
|
+
disabledFeatures?: [string];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare interface Button {
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare interface ButtonGroup {
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
buttons: Button[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
declare interface Environment {
|
|
23
|
+
mobile: boolean;
|
|
24
|
+
embedded: boolean;
|
|
25
|
+
pos: boolean;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export declare interface ShopifyGlobal {
|
|
29
|
+
config: AppBridgeConfig;
|
|
30
|
+
origin: string;
|
|
31
|
+
ready: Promise<void>;
|
|
32
|
+
environment: Environment;
|
|
33
|
+
loading(isLoading?: boolean): void;
|
|
34
|
+
idToken(): Promise<string>;
|
|
35
|
+
user(): Promise<User>;
|
|
36
|
+
titleBar: {
|
|
37
|
+
setState(state?: TitleBarState): void;
|
|
38
|
+
};
|
|
39
|
+
toast: {
|
|
40
|
+
show(message: string, opts?: Partial<ToastOptions>): string;
|
|
41
|
+
hide(id: string): void;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
declare interface TitleBarState {
|
|
46
|
+
title?: string;
|
|
47
|
+
buttons?: {
|
|
48
|
+
primary?: Button;
|
|
49
|
+
secondary?: (Button | ButtonGroup)[];
|
|
50
|
+
};
|
|
51
|
+
breadcrumbs?: Button;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare interface ToastOptions {
|
|
55
|
+
duration: number;
|
|
56
|
+
isError: boolean;
|
|
57
|
+
action: string;
|
|
58
|
+
onAction: () => void;
|
|
59
|
+
onDismiss: () => void;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
declare interface User {
|
|
63
|
+
id: string;
|
|
64
|
+
name: string;
|
|
65
|
+
firstName?: string;
|
|
66
|
+
lastName?: string;
|
|
67
|
+
email: string;
|
|
68
|
+
accountAccess: string;
|
|
69
|
+
accountType: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { }
|
package/package.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shopify/app-bridge-types",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Companion types library for the Shopify App Bridge script",
|
|
5
|
+
"license": "ISC",
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"module": "./index.mjs",
|
|
8
|
+
"types": "./index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
"types": "./index.d.ts",
|
|
11
|
+
"module": "./index.mjs",
|
|
12
|
+
"import": "./index.mjs",
|
|
13
|
+
"default": "./index.js"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "cjyes && yarn types",
|
|
17
|
+
"types": "cp ../../dist/app-bridge.d.ts ./internal.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"cjyes": "^0.3.1"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"index.d.ts",
|
|
24
|
+
"internal.d.ts",
|
|
25
|
+
"index.mjs",
|
|
26
|
+
"index.js"
|
|
27
|
+
]
|
|
28
|
+
}
|