@shopify/app-bridge-types 0.0.2 → 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 +6 -0
- package/package.json +1 -1
- package/shopify.ts +40 -8
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
package/shopify.ts
CHANGED
|
@@ -2,11 +2,11 @@ export interface AppBridgeAttributes {
|
|
|
2
2
|
}
|
|
3
3
|
|
|
4
4
|
interface AppBridgeConfig {
|
|
5
|
-
host
|
|
5
|
+
host?: string;
|
|
6
6
|
apiKey: string;
|
|
7
7
|
shop: string;
|
|
8
8
|
locale: string;
|
|
9
|
-
disabledFeatures?: [
|
|
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];
|
|
@@ -90,7 +91,7 @@ interface Image_2 {
|
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
export interface MenuItemProperties {
|
|
93
|
-
variant?: 'primary' | undefined;
|
|
94
|
+
variant?: 'primary' | 'breadcrumb' | null | undefined;
|
|
94
95
|
}
|
|
95
96
|
|
|
96
97
|
type Money = string;
|
|
@@ -192,18 +193,25 @@ interface ResourcePickerOptions {
|
|
|
192
193
|
};
|
|
193
194
|
}
|
|
194
195
|
|
|
195
|
-
type ResourceSelection
|
|
196
|
+
type ResourceSelection<Type extends keyof ResourceTypes> = ResourceTypes[Type];
|
|
197
|
+
|
|
198
|
+
type ResourceTypes = {
|
|
199
|
+
product: Product;
|
|
200
|
+
variant: ProductVariant;
|
|
201
|
+
collection: Collection;
|
|
202
|
+
};
|
|
196
203
|
|
|
197
204
|
interface RuleSet {
|
|
198
205
|
appliedDisjunctively: boolean;
|
|
199
206
|
rules: CollectionRule[];
|
|
200
207
|
}
|
|
201
208
|
|
|
202
|
-
interface
|
|
203
|
-
|
|
204
|
-
selection: ResourceSelection[];
|
|
209
|
+
interface ScannerPayload {
|
|
210
|
+
data: string;
|
|
205
211
|
}
|
|
206
212
|
|
|
213
|
+
type SelectPayload<Type extends keyof ResourceTypes> = WithSelection<ResourceSelection<Type>[]>;
|
|
214
|
+
|
|
207
215
|
export interface ShopifyGlobal {
|
|
208
216
|
config: AppBridgeConfig;
|
|
209
217
|
origin: string;
|
|
@@ -216,7 +224,15 @@ export interface ShopifyGlobal {
|
|
|
216
224
|
show(message: string, opts?: Partial<ToastOptions>): string;
|
|
217
225
|
hide(id: string): void;
|
|
218
226
|
};
|
|
219
|
-
resourcePicker(options
|
|
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
|
+
};
|
|
220
236
|
}
|
|
221
237
|
|
|
222
238
|
interface ToastOptions {
|
|
@@ -227,6 +243,12 @@ interface ToastOptions {
|
|
|
227
243
|
onDismiss: () => void;
|
|
228
244
|
}
|
|
229
245
|
|
|
246
|
+
interface UIModalAttributes {
|
|
247
|
+
id?: string;
|
|
248
|
+
variant?: Variant;
|
|
249
|
+
children?: any;
|
|
250
|
+
}
|
|
251
|
+
|
|
230
252
|
interface User {
|
|
231
253
|
id: string;
|
|
232
254
|
name: string;
|
|
@@ -237,6 +259,8 @@ interface User {
|
|
|
237
259
|
accountType: string;
|
|
238
260
|
}
|
|
239
261
|
|
|
262
|
+
type Variant = 'small' | 'base' | 'large' | 'max';
|
|
263
|
+
|
|
240
264
|
enum WeightUnit {
|
|
241
265
|
Kilograms = "KILOGRAMS",
|
|
242
266
|
Grams = "GRAMS",
|
|
@@ -244,4 +268,12 @@ enum WeightUnit {
|
|
|
244
268
|
Ounces = "OUNCES"
|
|
245
269
|
}
|
|
246
270
|
|
|
271
|
+
type WithSelection<T> = T & {
|
|
272
|
+
/**
|
|
273
|
+
* @private
|
|
274
|
+
* @deprecated
|
|
275
|
+
*/
|
|
276
|
+
selection: T;
|
|
277
|
+
};
|
|
278
|
+
|
|
247
279
|
export { }
|