@shopify/app-bridge-types 0.0.7 → 0.0.9
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/index.d.ts +4 -0
- package/package.json +1 -1
- package/shopify.ts +33 -3
package/index.d.ts
CHANGED
|
@@ -6,9 +6,11 @@ import type {
|
|
|
6
6
|
UIModalElement as BaseUIModalElement,
|
|
7
7
|
UINavMenuElement as BaseUINavMenuElement,
|
|
8
8
|
UITitleBarElement as BaseUITitleBarElement,
|
|
9
|
+
UISaveBarElement as BaseUISaveBarElement,
|
|
9
10
|
UIModalAttributes,
|
|
10
11
|
UINavMenuAttributes,
|
|
11
12
|
UITitleBarAttributes,
|
|
13
|
+
UISaveBarAttributes,
|
|
12
14
|
} from './shopify';
|
|
13
15
|
|
|
14
16
|
export {
|
|
@@ -16,6 +18,7 @@ export {
|
|
|
16
18
|
UIModalAttributes,
|
|
17
19
|
UINavMenuAttributes,
|
|
18
20
|
UITitleBarAttributes,
|
|
21
|
+
UISaveBarAttributes,
|
|
19
22
|
};
|
|
20
23
|
|
|
21
24
|
declare global {
|
|
@@ -28,6 +31,7 @@ declare global {
|
|
|
28
31
|
interface UIModalElement extends BaseUIModalElement {}
|
|
29
32
|
interface UINavMenuElement extends BaseUINavMenuElement {}
|
|
30
33
|
interface UITitleBarElement extends BaseUITitleBarElement {}
|
|
34
|
+
interface UISaveBarElement extends BaseUISaveBarElement {}
|
|
31
35
|
|
|
32
36
|
// Install property augmentations onto ReactElement prop definitions
|
|
33
37
|
namespace React {
|
package/package.json
CHANGED
package/shopify.ts
CHANGED
|
@@ -30,6 +30,7 @@ interface AppBridgeConfig {
|
|
|
30
30
|
export interface AppBridgeElements {
|
|
31
31
|
'ui-modal': UIModalAttributes;
|
|
32
32
|
'ui-nav-menu': UINavMenuAttributes;
|
|
33
|
+
'ui-save-bar': UISaveBarAttributes;
|
|
33
34
|
'ui-title-bar': UITitleBarAttributes;
|
|
34
35
|
}
|
|
35
36
|
|
|
@@ -50,11 +51,14 @@ interface Cart {
|
|
|
50
51
|
grandTotal: string;
|
|
51
52
|
note?: string;
|
|
52
53
|
cartDiscount?: Discount;
|
|
54
|
+
cartDiscounts: Discount[];
|
|
53
55
|
customer?: Customer;
|
|
54
56
|
lineItems: LineItem[];
|
|
55
57
|
properties: Record<string, string>;
|
|
56
58
|
}
|
|
57
59
|
|
|
60
|
+
type CartDiscountType = 'Percentage' | 'FixedAmount';
|
|
61
|
+
|
|
58
62
|
type CartSubscriber = (cart: Cart) => void;
|
|
59
63
|
|
|
60
64
|
interface Collection extends Resource {
|
|
@@ -114,7 +118,7 @@ interface Device {
|
|
|
114
118
|
interface Discount {
|
|
115
119
|
amount: number;
|
|
116
120
|
title?: string;
|
|
117
|
-
type?:
|
|
121
|
+
type?: CartDiscountType;
|
|
118
122
|
}
|
|
119
123
|
|
|
120
124
|
interface Environment {
|
|
@@ -154,7 +158,7 @@ interface LineItem {
|
|
|
154
158
|
|
|
155
159
|
interface LineItemDiscount {
|
|
156
160
|
title: string;
|
|
157
|
-
type:
|
|
161
|
+
type: CartDiscountType;
|
|
158
162
|
amount: string;
|
|
159
163
|
}
|
|
160
164
|
|
|
@@ -191,7 +195,9 @@ interface Pos {
|
|
|
191
195
|
addAddress(address: Address): Promise<void>;
|
|
192
196
|
updateAddress(index: number, address: Address): Promise<void>;
|
|
193
197
|
applyCartDiscount(discount: Discount): Promise<void>;
|
|
198
|
+
applyCartCodeDiscount(code: string): Promise<void>;
|
|
194
199
|
removeCartDiscount(): Promise<void>;
|
|
200
|
+
removeAllDiscounts(disableAutomaticDiscounts: boolean): Promise<void>;
|
|
195
201
|
addCartProperties(properties: Record<string, string>): Promise<void>;
|
|
196
202
|
removeCartProperties(properties: string[]): Promise<void>;
|
|
197
203
|
clear(): Promise<void>;
|
|
@@ -347,6 +353,11 @@ export interface ShopifyGlobal {
|
|
|
347
353
|
hide(id: string): Promise<void>;
|
|
348
354
|
toggle(id: string): Promise<void>;
|
|
349
355
|
};
|
|
356
|
+
saveBar: {
|
|
357
|
+
show(id: string): Promise<void>;
|
|
358
|
+
hide(id: string): Promise<void>;
|
|
359
|
+
toggle(id: string): Promise<void>;
|
|
360
|
+
};
|
|
350
361
|
pos: Pos;
|
|
351
362
|
}
|
|
352
363
|
|
|
@@ -361,12 +372,15 @@ interface ToastOptions {
|
|
|
361
372
|
export interface UIModalAttributes {
|
|
362
373
|
id?: string;
|
|
363
374
|
variant?: Variant;
|
|
375
|
+
src?: string;
|
|
364
376
|
children?: any;
|
|
365
377
|
}
|
|
366
378
|
|
|
367
379
|
interface UIModalElement_2 extends Omit<HTMLElement, 'addEventListener' | 'removeEventListener'> {
|
|
368
380
|
variant: Variant;
|
|
369
|
-
content
|
|
381
|
+
content?: HTMLElement;
|
|
382
|
+
src?: string;
|
|
383
|
+
readonly contentWindow?: Window | null;
|
|
370
384
|
show(): Promise<void>;
|
|
371
385
|
hide(): Promise<void>;
|
|
372
386
|
toggle(): Promise<void>;
|
|
@@ -383,6 +397,22 @@ interface UINavMenuElement_2 extends HTMLElement {
|
|
|
383
397
|
}
|
|
384
398
|
export type { UINavMenuElement_2 as UINavMenuElement }
|
|
385
399
|
|
|
400
|
+
export interface UISaveBarAttributes {
|
|
401
|
+
id?: string;
|
|
402
|
+
discardConfirmation?: boolean;
|
|
403
|
+
children?: any;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
interface UISaveBarElement_2 extends Omit<HTMLElement, 'addEventListener' | 'removeEventListener'> {
|
|
407
|
+
discardConfirmation?: boolean;
|
|
408
|
+
show(): Promise<void>;
|
|
409
|
+
hide(): Promise<void>;
|
|
410
|
+
toggle(): Promise<void>;
|
|
411
|
+
addEventListener(type: 'show' | 'hide', listener: EventListenerOrEventListenerObject): void;
|
|
412
|
+
removeEventListener(type: 'show' | 'hide', listener: EventListenerOrEventListenerObject): void;
|
|
413
|
+
}
|
|
414
|
+
export type { UISaveBarElement_2 as UISaveBarElement }
|
|
415
|
+
|
|
386
416
|
export interface UITitleBarAttributes {
|
|
387
417
|
title?: string;
|
|
388
418
|
children?: any;
|