@shopify/app-bridge-types 0.0.3 → 0.0.4

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 CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.0.3] - 2023-07-27
9
+
10
+ ### Changed
11
+
12
+ - Correct `resourcePicker()` return value and TS types to return the Array of selected entities directly. For the time being, the Array has a `.selection` property for backwards compatibility with the interface we launched with. ([#131](https://github.com/Shopify/app-bridge-next/pull/131))
13
+
8
14
  ## [0.0.2] - 2023-07-19
9
15
 
10
16
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopify/app-bridge-types",
3
- "version": "0.0.3",
3
+ "version": "0.0.4",
4
4
  "description": "Companion types library for the Shopify App Bridge script",
5
5
  "license": "ISC",
6
6
  "main": "./index.js",
package/shopify.ts CHANGED
@@ -2,11 +2,11 @@ export interface AppBridgeAttributes {
2
2
  }
3
3
 
4
4
  interface AppBridgeConfig {
5
- host: string;
5
+ host?: string;
6
6
  apiKey: string;
7
7
  shop: string;
8
8
  locale: string;
9
- disabledFeatures?: [string];
9
+ disabledFeatures?: string[];
10
10
  }
11
11
 
12
12
  export interface AppBridgeElements {
@@ -17,6 +17,7 @@ export interface AppBridgeElements {
17
17
  title?: string;
18
18
  children?: any;
19
19
  };
20
+ 'ui-modal': UIModalAttributes;
20
21
  }
21
22
 
22
23
  export type AugmentedElement<T extends keyof AugmentedElements> = AugmentedElements[T];
@@ -205,6 +206,10 @@ interface RuleSet {
205
206
  rules: CollectionRule[];
206
207
  }
207
208
 
209
+ interface ScannerPayload {
210
+ data: string;
211
+ }
212
+
208
213
  type SelectPayload<Type extends keyof ResourceTypes> = WithSelection<ResourceSelection<Type>[]>;
209
214
 
210
215
  export interface ShopifyGlobal {
@@ -220,6 +225,14 @@ export interface ShopifyGlobal {
220
225
  hide(id: string): void;
221
226
  };
222
227
  resourcePicker<Options extends ResourcePickerOptions>(options: Options): Promise<SelectPayload<Options['type']> | undefined>;
228
+ scanner: {
229
+ capture(): Promise<ScannerPayload>;
230
+ };
231
+ modal: {
232
+ show(id: string): Promise<void>;
233
+ hide(id: string): Promise<void>;
234
+ toggle(id: string): Promise<void>;
235
+ };
223
236
  }
224
237
 
225
238
  interface ToastOptions {
@@ -230,6 +243,12 @@ interface ToastOptions {
230
243
  onDismiss: () => void;
231
244
  }
232
245
 
246
+ interface UIModalAttributes {
247
+ id?: string;
248
+ variant?: Variant;
249
+ children?: any;
250
+ }
251
+
233
252
  interface User {
234
253
  id: string;
235
254
  name: string;
@@ -240,6 +259,8 @@ interface User {
240
259
  accountType: string;
241
260
  }
242
261
 
262
+ type Variant = 'small' | 'base' | 'large' | 'max';
263
+
243
264
  enum WeightUnit {
244
265
  Kilograms = "KILOGRAMS",
245
266
  Grams = "GRAMS",