@shopify/app-bridge-types 0.0.15 → 0.0.16
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/CHANGELOG.md +6 -0
- package/dist/shopify.ts +160 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.0.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#195](https://github.com/Shopify/extensibility/pull/195) [`934d5c06c26f5b822a72be983c219c9f65fabcf2`](https://github.com/Shopify/extensibility/commit/934d5c06c26f5b822a72be983c219c9f65fabcf2) Thanks [@charlesdobson](https://github.com/charlesdobson)! - sync picker types with host and add types to package
|
|
8
|
+
|
|
3
9
|
## 0.0.15
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/shopify.ts
CHANGED
|
@@ -133,6 +133,12 @@ export interface AugmentedElements {
|
|
|
133
133
|
a: MenuItemProperties;
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
interface Badge {
|
|
137
|
+
content: string;
|
|
138
|
+
tone?: Tone;
|
|
139
|
+
progress?: Progress;
|
|
140
|
+
}
|
|
141
|
+
|
|
136
142
|
interface BaseElementAttributes {
|
|
137
143
|
id?: string;
|
|
138
144
|
name?: string;
|
|
@@ -271,6 +277,8 @@ interface CustomSale {
|
|
|
271
277
|
taxable: boolean;
|
|
272
278
|
}
|
|
273
279
|
|
|
280
|
+
type DataPoint = string | number | undefined;
|
|
281
|
+
|
|
274
282
|
interface DebugOptions {
|
|
275
283
|
/**
|
|
276
284
|
* Enables or disables the logging of web performance metrics (Web Vitals) in the browser's console.
|
|
@@ -370,6 +378,20 @@ enum FulfillmentServiceType {
|
|
|
370
378
|
ThirdParty = "THIRD_PARTY"
|
|
371
379
|
}
|
|
372
380
|
|
|
381
|
+
interface Header {
|
|
382
|
+
/**
|
|
383
|
+
* The content to display in the table column header.
|
|
384
|
+
*/
|
|
385
|
+
content?: string;
|
|
386
|
+
/**
|
|
387
|
+
* The type of data to display in the column. The type is used to format the data in the column.
|
|
388
|
+
* If the type is 'number', the data in the column will be right-aligned, this should be used when referencing currency or numeric values.
|
|
389
|
+
* If the type is 'string', the data in the column will be left-aligned.
|
|
390
|
+
* @defaultValue 'string'
|
|
391
|
+
*/
|
|
392
|
+
type?: 'string' | 'number';
|
|
393
|
+
}
|
|
394
|
+
|
|
373
395
|
/**
|
|
374
396
|
* Asynchronously returns an ID token.
|
|
375
397
|
* @returns A Promise that resolves to an ID token.
|
|
@@ -535,6 +557,61 @@ interface _ModalApi {
|
|
|
535
557
|
|
|
536
558
|
type Money = string;
|
|
537
559
|
|
|
560
|
+
type PickerApi = (options: PickerOptions) => Promise<{
|
|
561
|
+
selected: Promise<string[] | undefined>;
|
|
562
|
+
}>;
|
|
563
|
+
|
|
564
|
+
interface PickerItem {
|
|
565
|
+
id: string;
|
|
566
|
+
/**
|
|
567
|
+
* The primary content to display in the first column of the row.
|
|
568
|
+
*/
|
|
569
|
+
heading: string;
|
|
570
|
+
/**
|
|
571
|
+
* The additional content to display in the second and third columns of the row, if provided.
|
|
572
|
+
*/
|
|
573
|
+
data?: DataPoint[];
|
|
574
|
+
/**
|
|
575
|
+
* Whether the item is disabled or not. If the item is disabled, it cannot be selected.
|
|
576
|
+
* @defaultValue false
|
|
577
|
+
*/
|
|
578
|
+
disabled?: boolean;
|
|
579
|
+
/**
|
|
580
|
+
* Whether the item is selected or not when the picker is opened. The user may deselect the item if it is preselected.
|
|
581
|
+
*/
|
|
582
|
+
selected?: boolean;
|
|
583
|
+
/**
|
|
584
|
+
* The badges to display in the first column of the row. These are used to display additional information about the item, such as progress of an action or tone indicating the status of that item.
|
|
585
|
+
*/
|
|
586
|
+
badges?: Badge[];
|
|
587
|
+
/**
|
|
588
|
+
* The thumbnail to display at the start of the row. This is used to display an image or icon for the item.
|
|
589
|
+
*/
|
|
590
|
+
thumbnail?: {
|
|
591
|
+
url: string;
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
interface PickerOptions {
|
|
596
|
+
/**
|
|
597
|
+
* The heading of the picker. This is displayed in the title of the picker modal.
|
|
598
|
+
*/
|
|
599
|
+
heading: string;
|
|
600
|
+
/**
|
|
601
|
+
* Whether to allow selecting multiple items of a specific type or not. If a number is provided, then limit the selections to a maximum of that number of items.
|
|
602
|
+
* @defaultValue false
|
|
603
|
+
*/
|
|
604
|
+
multiple?: boolean | number;
|
|
605
|
+
/**
|
|
606
|
+
* The data headers for the picker. These are used to display the table headers in the picker modal.
|
|
607
|
+
*/
|
|
608
|
+
headers?: Header[];
|
|
609
|
+
/**
|
|
610
|
+
* The items to display in the picker. These are used to display the rows in the picker modal.
|
|
611
|
+
*/
|
|
612
|
+
items: PickerItem[];
|
|
613
|
+
}
|
|
614
|
+
|
|
538
615
|
interface PosApi {
|
|
539
616
|
cart: PosCart;
|
|
540
617
|
close: PosClose;
|
|
@@ -749,6 +826,8 @@ enum ProductVariantInventoryPolicy {
|
|
|
749
826
|
Continue = "CONTINUE"
|
|
750
827
|
}
|
|
751
828
|
|
|
829
|
+
type Progress = 'incomplete' | 'partiallyComplete' | 'complete';
|
|
830
|
+
|
|
752
831
|
interface Resource {
|
|
753
832
|
/** in GraphQL id format, ie 'gid://shopify/Product/1' */
|
|
754
833
|
id: string;
|
|
@@ -835,6 +914,55 @@ interface ScannerPayload {
|
|
|
835
914
|
data: string;
|
|
836
915
|
}
|
|
837
916
|
|
|
917
|
+
/**
|
|
918
|
+
* `Scope` represents an [access scope](https://shopify.dev/docs/api/usage/access-scopes) handle, like "`write_products`" or "`read_orders`"
|
|
919
|
+
*/
|
|
920
|
+
type Scope = string;
|
|
921
|
+
|
|
922
|
+
/**
|
|
923
|
+
* The Scopes API enables embedded apps and extensions to request merchant consent for access scopes.
|
|
924
|
+
*/
|
|
925
|
+
interface Scopes {
|
|
926
|
+
/**
|
|
927
|
+
* Queries Shopify for the scopes for this app on this shop
|
|
928
|
+
*/
|
|
929
|
+
query: () => Promise<ScopesDetail>;
|
|
930
|
+
/**
|
|
931
|
+
* Requests the merchant to grant the provided scopes for this app on this shop
|
|
932
|
+
*
|
|
933
|
+
* This will open a [permission grant modal](/docs/apps/build/authentication-authorization/app-installation/manage-access-scopes#request-access-scopes-using-the-app-bridge-api-for-embedded-apps) for the merchant to accept or decline the scopes.
|
|
934
|
+
*/
|
|
935
|
+
request: (scopes: Scope[]) => Promise<ScopesRequestResponse>;
|
|
936
|
+
/**
|
|
937
|
+
* Revokes the provided scopes from this app on this shop
|
|
938
|
+
*/
|
|
939
|
+
revoke: (scopes: Scope[]) => Promise<ScopesRevokeResponse>;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
interface ScopesDetail {
|
|
943
|
+
/**
|
|
944
|
+
* The scopes that have been granted on the shop for this app
|
|
945
|
+
*/
|
|
946
|
+
granted: Scope[];
|
|
947
|
+
/**
|
|
948
|
+
* The required scopes that the app has declared in its configuration
|
|
949
|
+
*/
|
|
950
|
+
required: Scope[];
|
|
951
|
+
/**
|
|
952
|
+
* The optional scopes that the app has declared in its configuration
|
|
953
|
+
*/
|
|
954
|
+
optional: Scope[];
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
interface ScopesRequestResponse {
|
|
958
|
+
result: UserResult;
|
|
959
|
+
detail: ScopesDetail;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
interface ScopesRevokeResponse {
|
|
963
|
+
detail: ScopesDetail;
|
|
964
|
+
}
|
|
965
|
+
|
|
838
966
|
type SelectPayload<Type extends keyof ResourceTypes> = WithSelection<ResourceSelection<Type>[]>;
|
|
839
967
|
|
|
840
968
|
export interface ShopifyGlobal {
|
|
@@ -852,8 +980,18 @@ export interface ShopifyGlobal {
|
|
|
852
980
|
saveBar: SaveBarApi;
|
|
853
981
|
pos: PosApi;
|
|
854
982
|
intents: IntentsApi;
|
|
983
|
+
webVitals: WebVitalsApi;
|
|
984
|
+
support: SupportApi;
|
|
985
|
+
scopes: Scopes;
|
|
986
|
+
picker: PickerApi;
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
interface SupportApi {
|
|
990
|
+
registerHandler?: (callback: SupportCallback | null) => Promise<void>;
|
|
855
991
|
}
|
|
856
992
|
|
|
993
|
+
type SupportCallback = () => void | Promise<void>;
|
|
994
|
+
|
|
857
995
|
/**
|
|
858
996
|
* The Toast API provides methods to display Toast notifications in the Shopify admin.
|
|
859
997
|
*/
|
|
@@ -904,6 +1042,8 @@ interface ToastOptions {
|
|
|
904
1042
|
|
|
905
1043
|
type ToastShow = (message: string, opts?: ToastOptions) => string;
|
|
906
1044
|
|
|
1045
|
+
type Tone = 'info' | 'success' | 'warning' | 'critical';
|
|
1046
|
+
|
|
907
1047
|
export interface UIModalAttributes extends _UIModalAttributes {
|
|
908
1048
|
children?: any;
|
|
909
1049
|
}
|
|
@@ -1140,8 +1280,28 @@ interface User extends PrivilegedAdminUser, AdminUser, POSUser {
|
|
|
1140
1280
|
|
|
1141
1281
|
type UserApi = () => Promise<User>;
|
|
1142
1282
|
|
|
1283
|
+
/**
|
|
1284
|
+
* `UserResult` represents the results of a user responding to a scopes request, i.e. a merchant user’s action taken when presented with a grant modal.
|
|
1285
|
+
*/
|
|
1286
|
+
type UserResult = 'granted-all' | 'declined-all';
|
|
1287
|
+
|
|
1143
1288
|
type Variant = 'small' | 'base' | 'large' | 'max';
|
|
1144
1289
|
|
|
1290
|
+
interface WebVitalsApi {
|
|
1291
|
+
onReport?: (callback: WebVitalsCallback | null) => Promise<void>;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
type WebVitalsCallback = (metrics: WebVitalsMetric) => void | Promise<void>;
|
|
1295
|
+
|
|
1296
|
+
/**
|
|
1297
|
+
* WebVitals API
|
|
1298
|
+
*/
|
|
1299
|
+
interface WebVitalsMetric {
|
|
1300
|
+
id: string;
|
|
1301
|
+
name: string;
|
|
1302
|
+
value: number;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1145
1305
|
enum WeightUnit {
|
|
1146
1306
|
Kilograms = "KILOGRAMS",
|
|
1147
1307
|
Grams = "GRAMS",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopify/app-bridge-types",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"description": "Companion types library for the Shopify App Bridge script",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"cjyes": "^0.3.1",
|
|
22
|
-
"app-bridge-next": "0.
|
|
22
|
+
"app-bridge-next": "0.4.1"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"dist",
|