@shopify/ui-extensions 2026.10.0-rc.2 → 2026.10.0-rc.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/build/cjs/surfaces/point-of-sale/events.js +48 -0
- package/build/cjs/surfaces/point-of-sale/types/storage.js +11 -0
- package/build/cjs/surfaces/point-of-sale.js +1 -0
- package/build/esm/surfaces/point-of-sale/events.mjs +48 -1
- package/build/esm/surfaces/point-of-sale/types/storage.mjs +11 -0
- package/build/esm/surfaces/point-of-sale.mjs +1 -1
- package/build/esnext/surfaces/point-of-sale/events.esnext +48 -1
- package/build/esnext/surfaces/point-of-sale/types/storage.esnext +11 -0
- package/build/esnext/surfaces/point-of-sale.esnext +1 -1
- package/build/ts/surfaces/point-of-sale/api.d.ts +1 -1
- package/build/ts/surfaces/point-of-sale/api.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/events.d.ts +64 -0
- package/build/ts/surfaces/point-of-sale/events.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/globals.d.ts +8 -1
- package/build/ts/surfaces/point-of-sale/globals.d.ts.map +1 -1
- package/build/ts/surfaces/point-of-sale/types/storage.d.ts +40 -0
- package/build/ts/surfaces/point-of-sale/types/storage.d.ts.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/surfaces/point-of-sale/api.ts +2 -1
- package/src/surfaces/point-of-sale/events.ts +76 -0
- package/src/surfaces/point-of-sale/globals.ts +16 -1
- package/src/surfaces/point-of-sale/types/storage.ts +47 -0
|
@@ -14,6 +14,16 @@ const POS_EVENT_NAMES = {
|
|
|
14
14
|
CASH_TRACKING_SESSION_COMPLETE: 'cashtrackingsessioncomplete'
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Canonical workflow-name constants for POS host interceptions. Prefer these
|
|
19
|
+
* over string literals when calling `shopify.intercept`.
|
|
20
|
+
*
|
|
21
|
+
* @private
|
|
22
|
+
*/
|
|
23
|
+
const POS_INTERCEPT_NAMES = {
|
|
24
|
+
BEFORE_CHECKOUT: 'beforecheckout'
|
|
25
|
+
};
|
|
26
|
+
|
|
17
27
|
/**
|
|
18
28
|
* Maps Shopify POS event names to their corresponding payload types.
|
|
19
29
|
*
|
|
@@ -23,4 +33,42 @@ const POS_EVENT_NAMES = {
|
|
|
23
33
|
* @publicDocs
|
|
24
34
|
*/
|
|
25
35
|
|
|
36
|
+
/**
|
|
37
|
+
* Maps POS interceptable workflow names to their corresponding `Event` types.
|
|
38
|
+
*
|
|
39
|
+
* Used as the generic type parameter for `shopify.intercept`.
|
|
40
|
+
*
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Dispatched when staff attempts to leave the active cart for checkout.
|
|
46
|
+
*
|
|
47
|
+
* @private
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/** @private */
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The result an interceptor returns. An empty `operations` list allows the
|
|
54
|
+
* workflow; an `ERROR` validation blocks it.
|
|
55
|
+
*
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* A single host operation produced by an interceptor.
|
|
61
|
+
*
|
|
62
|
+
* @private
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
/** @private */
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Adds a validation to the workflow being intercepted.
|
|
69
|
+
*
|
|
70
|
+
* @private
|
|
71
|
+
*/
|
|
72
|
+
|
|
26
73
|
exports.POS_EVENT_NAMES = POS_EVENT_NAMES;
|
|
74
|
+
exports.POS_INTERCEPT_NAMES = POS_INTERCEPT_NAMES;
|
|
@@ -17,4 +17,15 @@ class StorageError extends Error {
|
|
|
17
17
|
* @publicDocs
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Provides reactive, subscribable access to individual storage keys.
|
|
22
|
+
*
|
|
23
|
+
* Each property is a `ReadonlySignalLike` that reflects the current value of the
|
|
24
|
+
* corresponding storage key. Values are `undefined` when the key does not exist
|
|
25
|
+
* or is being loaded asynchronously.
|
|
26
|
+
*
|
|
27
|
+
* Mutations are performed through the existing `Storage` methods (`set`,
|
|
28
|
+
* `delete`, `clear`, etc.) — `SubscribableStorage` is read-only and reactive.
|
|
29
|
+
*/
|
|
30
|
+
|
|
20
31
|
exports.StorageError = StorageError;
|
|
@@ -10,6 +10,16 @@ const POS_EVENT_NAMES = {
|
|
|
10
10
|
CASH_TRACKING_SESSION_COMPLETE: 'cashtrackingsessioncomplete'
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Canonical workflow-name constants for POS host interceptions. Prefer these
|
|
15
|
+
* over string literals when calling `shopify.intercept`.
|
|
16
|
+
*
|
|
17
|
+
* @private
|
|
18
|
+
*/
|
|
19
|
+
const POS_INTERCEPT_NAMES = {
|
|
20
|
+
BEFORE_CHECKOUT: 'beforecheckout'
|
|
21
|
+
};
|
|
22
|
+
|
|
13
23
|
/**
|
|
14
24
|
* Maps Shopify POS event names to their corresponding payload types.
|
|
15
25
|
*
|
|
@@ -19,4 +29,41 @@ const POS_EVENT_NAMES = {
|
|
|
19
29
|
* @publicDocs
|
|
20
30
|
*/
|
|
21
31
|
|
|
22
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Maps POS interceptable workflow names to their corresponding `Event` types.
|
|
34
|
+
*
|
|
35
|
+
* Used as the generic type parameter for `shopify.intercept`.
|
|
36
|
+
*
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Dispatched when staff attempts to leave the active cart for checkout.
|
|
42
|
+
*
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/** @private */
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The result an interceptor returns. An empty `operations` list allows the
|
|
50
|
+
* workflow; an `ERROR` validation blocks it.
|
|
51
|
+
*
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A single host operation produced by an interceptor.
|
|
57
|
+
*
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/** @private */
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Adds a validation to the workflow being intercepted.
|
|
65
|
+
*
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
export { POS_EVENT_NAMES, POS_INTERCEPT_NAMES };
|
|
@@ -13,4 +13,15 @@ class StorageError extends Error {
|
|
|
13
13
|
* @publicDocs
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Provides reactive, subscribable access to individual storage keys.
|
|
18
|
+
*
|
|
19
|
+
* Each property is a `ReadonlySignalLike` that reflects the current value of the
|
|
20
|
+
* corresponding storage key. Values are `undefined` when the key does not exist
|
|
21
|
+
* or is being loaded asynchronously.
|
|
22
|
+
*
|
|
23
|
+
* Mutations are performed through the existing `Storage` methods (`set`,
|
|
24
|
+
* `delete`, `clear`, etc.) — `SubscribableStorage` is read-only and reactive.
|
|
25
|
+
*/
|
|
26
|
+
|
|
16
27
|
export { StorageError };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { POS_EVENT_NAMES } from './point-of-sale/events.mjs';
|
|
1
|
+
export { POS_EVENT_NAMES, POS_INTERCEPT_NAMES } from './point-of-sale/events.mjs';
|
|
2
2
|
export { StorageError } from './point-of-sale/types/storage.mjs';
|
|
@@ -10,6 +10,16 @@ const POS_EVENT_NAMES = {
|
|
|
10
10
|
CASH_TRACKING_SESSION_COMPLETE: 'cashtrackingsessioncomplete'
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Canonical workflow-name constants for POS host interceptions. Prefer these
|
|
15
|
+
* over string literals when calling `shopify.intercept`.
|
|
16
|
+
*
|
|
17
|
+
* @private
|
|
18
|
+
*/
|
|
19
|
+
const POS_INTERCEPT_NAMES = {
|
|
20
|
+
BEFORE_CHECKOUT: 'beforecheckout'
|
|
21
|
+
};
|
|
22
|
+
|
|
13
23
|
/**
|
|
14
24
|
* Maps Shopify POS event names to their corresponding payload types.
|
|
15
25
|
*
|
|
@@ -19,4 +29,41 @@ const POS_EVENT_NAMES = {
|
|
|
19
29
|
* @publicDocs
|
|
20
30
|
*/
|
|
21
31
|
|
|
22
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Maps POS interceptable workflow names to their corresponding `Event` types.
|
|
34
|
+
*
|
|
35
|
+
* Used as the generic type parameter for `shopify.intercept`.
|
|
36
|
+
*
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Dispatched when staff attempts to leave the active cart for checkout.
|
|
42
|
+
*
|
|
43
|
+
* @private
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/** @private */
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The result an interceptor returns. An empty `operations` list allows the
|
|
50
|
+
* workflow; an `ERROR` validation blocks it.
|
|
51
|
+
*
|
|
52
|
+
* @private
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A single host operation produced by an interceptor.
|
|
57
|
+
*
|
|
58
|
+
* @private
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/** @private */
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Adds a validation to the workflow being intercepted.
|
|
65
|
+
*
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
export { POS_EVENT_NAMES, POS_INTERCEPT_NAMES };
|
|
@@ -13,4 +13,15 @@ class StorageError extends Error {
|
|
|
13
13
|
* @publicDocs
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Provides reactive, subscribable access to individual storage keys.
|
|
18
|
+
*
|
|
19
|
+
* Each property is a `ReadonlySignalLike` that reflects the current value of the
|
|
20
|
+
* corresponding storage key. Values are `undefined` when the key does not exist
|
|
21
|
+
* or is being loaded asynchronously.
|
|
22
|
+
*
|
|
23
|
+
* Mutations are performed through the existing `Storage` methods (`set`,
|
|
24
|
+
* `delete`, `clear`, etc.) — `SubscribableStorage` is read-only and reactive.
|
|
25
|
+
*/
|
|
26
|
+
|
|
16
27
|
export { StorageError };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { POS_EVENT_NAMES } from './point-of-sale/events.esnext';
|
|
1
|
+
export { POS_EVENT_NAMES, POS_INTERCEPT_NAMES } from './point-of-sale/events.esnext';
|
|
2
2
|
export { StorageError } from './point-of-sale/types/storage.esnext';
|
|
@@ -34,7 +34,7 @@ export type { PaginatedResult } from './types/paginated-result';
|
|
|
34
34
|
export type { Product, ProductVariant, ProductVariantOption, ProductVariantInventoryPolicy, ProductOption, } from './types/product';
|
|
35
35
|
export type { CountryCode } from './types/country-code';
|
|
36
36
|
export type { Session, StaffMember } from './types/session';
|
|
37
|
-
export type { Storage } from './types/storage';
|
|
37
|
+
export type { Storage, SubscribableStorage } from './types/storage';
|
|
38
38
|
export { StorageError } from './types/storage';
|
|
39
39
|
export type { PinPadApiContent, PinPadApi } from './api/pin-pad-api';
|
|
40
40
|
export type { PinPadOptions, PinPadResult, PinLength, PinPadActionType, PinValidationResult, } from './types/pin-pad';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/surfaces/point-of-sale/api.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,OAAO,EACP,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EAAC,eAAe,EAAC,MAAM,6CAA6C,CAAC;AAEjF,YAAY,EA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,EAAC,MAAM,0BAA0B,CAAC;AAE9D,YAAY,EACV,OAAO,EACP,cAAc,EACd,oBAAoB,EACpB,6BAA6B,EAC7B,aAAa,GACd,MAAM,iBAAiB,CAAC;AAEzB,YAAY,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAEtD,YAAY,EAAC,OAAO,EAAE,WAAW,EAAC,MAAM,iBAAiB,CAAC;AAC1D,YAAY,EAAC,OAAO,EAAE,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C,YAAY,EAAC,gBAAgB,EAAE,SAAS,EAAC,MAAM,mBAAmB,CAAC;AACnE,YAAY,EACV,aAAa,EACb,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TransactionCompleteEvent } from './events/transaction-complete-event';
|
|
2
2
|
import type { CashTrackingSessionStartEvent, CashTrackingSessionCompleteEvent } from './events/cash-tracking-session-events';
|
|
3
|
+
import type { Cart } from './types/cart';
|
|
3
4
|
/**
|
|
4
5
|
* Canonical event-name constants for POS host events. Prefer these over string
|
|
5
6
|
* literals when calling `shopify.addEventListener` / `removeEventListener`.
|
|
@@ -11,6 +12,15 @@ export declare const POS_EVENT_NAMES: {
|
|
|
11
12
|
readonly CASH_TRACKING_SESSION_START: "cashtrackingsessionstart";
|
|
12
13
|
readonly CASH_TRACKING_SESSION_COMPLETE: "cashtrackingsessioncomplete";
|
|
13
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* Canonical workflow-name constants for POS host interceptions. Prefer these
|
|
17
|
+
* over string literals when calling `shopify.intercept`.
|
|
18
|
+
*
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
export declare const POS_INTERCEPT_NAMES: {
|
|
22
|
+
readonly BEFORE_CHECKOUT: "beforecheckout";
|
|
23
|
+
};
|
|
14
24
|
/**
|
|
15
25
|
* Maps Shopify POS event names to their corresponding payload types.
|
|
16
26
|
*
|
|
@@ -30,5 +40,59 @@ export interface ShopifyEventMap {
|
|
|
30
40
|
/** Dispatched when a cash tracking session closes after reconciliation. */
|
|
31
41
|
[POS_EVENT_NAMES.CASH_TRACKING_SESSION_COMPLETE]: CashTrackingSessionCompleteEvent;
|
|
32
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Maps POS interceptable workflow names to their corresponding `Event` types.
|
|
45
|
+
*
|
|
46
|
+
* Used as the generic type parameter for `shopify.intercept`.
|
|
47
|
+
*
|
|
48
|
+
* @private
|
|
49
|
+
*/
|
|
50
|
+
export interface ShopifyInterceptMap {
|
|
51
|
+
[POS_INTERCEPT_NAMES.BEFORE_CHECKOUT]: BeforeCheckoutEvent;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Dispatched when staff attempts to leave the active cart for checkout.
|
|
55
|
+
*
|
|
56
|
+
* @private
|
|
57
|
+
*/
|
|
58
|
+
export interface BeforeCheckoutEvent extends Event {
|
|
59
|
+
readonly type: typeof POS_INTERCEPT_NAMES.BEFORE_CHECKOUT;
|
|
60
|
+
/** The POS cart at the point checkout was requested. */
|
|
61
|
+
readonly cart: Cart;
|
|
62
|
+
}
|
|
63
|
+
/** @private */
|
|
64
|
+
export type ShopifyInterceptor<TEvent extends Event> = (event: TEvent) => InterceptResult;
|
|
65
|
+
/**
|
|
66
|
+
* The result an interceptor returns. An empty `operations` list allows the
|
|
67
|
+
* workflow; an `ERROR` validation blocks it.
|
|
68
|
+
*
|
|
69
|
+
* @private
|
|
70
|
+
*/
|
|
71
|
+
export interface InterceptResult {
|
|
72
|
+
operations: Operation[];
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* A single host operation produced by an interceptor.
|
|
76
|
+
*
|
|
77
|
+
* @private
|
|
78
|
+
*/
|
|
79
|
+
export interface Operation {
|
|
80
|
+
validationAdd?: ValidationAdd;
|
|
81
|
+
}
|
|
82
|
+
/** @private */
|
|
83
|
+
export type ValidationLevel = 'WARNING' | 'ERROR';
|
|
84
|
+
/**
|
|
85
|
+
* Adds a validation to the workflow being intercepted.
|
|
86
|
+
*
|
|
87
|
+
* @private
|
|
88
|
+
*/
|
|
89
|
+
export interface ValidationAdd {
|
|
90
|
+
/** `ERROR` blocks the workflow. `WARNING` does not. */
|
|
91
|
+
level: ValidationLevel;
|
|
92
|
+
/** Stable identifier for this validation. */
|
|
93
|
+
handle: string;
|
|
94
|
+
/** JSON-path locator for where the validation applies. */
|
|
95
|
+
target?: string;
|
|
96
|
+
}
|
|
33
97
|
export type { TransactionCompleteEvent, CashTrackingSessionStartEvent, CashTrackingSessionCompleteEvent, };
|
|
34
98
|
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../src/surfaces/point-of-sale/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,qCAAqC,CAAC;AAClF,OAAO,KAAK,EACV,6BAA6B,EAC7B,gCAAgC,EACjC,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../src/surfaces/point-of-sale/events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,qCAAqC,CAAC;AAClF,OAAO,KAAK,EACV,6BAA6B,EAC7B,gCAAgC,EACjC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,cAAc,CAAC;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,eAAe;;;;CAIlB,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;CAEtB,CAAC;AAEX;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,CAAC,eAAe,CAAC,oBAAoB,CAAC,EAAE,wBAAwB,CAAC;IACjE,qDAAqD;IACrD,CAAC,eAAe,CAAC,2BAA2B,CAAC,EAAE,6BAA6B,CAAC;IAC7E,2EAA2E;IAC3E,CAAC,eAAe,CAAC,8BAA8B,CAAC,EAAE,gCAAgC,CAAC;CACpF;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,CAAC,mBAAmB,CAAC,eAAe,CAAC,EAAE,mBAAmB,CAAC;CAC5D;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,KAAK;IAChD,QAAQ,CAAC,IAAI,EAAE,OAAO,mBAAmB,CAAC,eAAe,CAAC;IAC1D,wDAAwD;IACxD,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED,eAAe;AACf,MAAM,MAAM,kBAAkB,CAAC,MAAM,SAAS,KAAK,IAAI,CACrD,KAAK,EAAE,MAAM,KACV,eAAe,CAAC;AAErB;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,SAAS,EAAE,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACxB,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED,eAAe;AACf,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,OAAO,CAAC;AAElD;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,uDAAuD;IACvD,KAAK,EAAE,eAAe,CAAC;IAEvB,6CAA6C;IAC7C,MAAM,EAAE,MAAM,CAAC;IAEf,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,YAAY,EACV,wBAAwB,EACxB,6BAA6B,EAC7B,gCAAgC,GACjC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Navigation } from './api/navigation-api/navigation-api';
|
|
2
|
-
import type { ShopifyEventMap } from './events';
|
|
2
|
+
import type { ShopifyEventMap, ShopifyInterceptMap, ShopifyInterceptor } from './events';
|
|
3
3
|
/**
|
|
4
4
|
* The `shopify` global provides APIs that are available to all POS extensions
|
|
5
5
|
* without needing to access them through the target's `api` argument.
|
|
@@ -28,6 +28,13 @@ export interface BackgroundShopifyGlobal extends ShopifyGlobal {
|
|
|
28
28
|
* `listener` reference must match the one used to register.
|
|
29
29
|
*/
|
|
30
30
|
removeEventListener<K extends keyof ShopifyEventMap>(type: K, listener: (event: ShopifyEventMap[K]) => void): void;
|
|
31
|
+
/**
|
|
32
|
+
* Register an interceptor for a POS host workflow that can be blocked.
|
|
33
|
+
* Returns a function that unregisters the interceptor.
|
|
34
|
+
*
|
|
35
|
+
* @private
|
|
36
|
+
*/
|
|
37
|
+
intercept<K extends keyof ShopifyInterceptMap>(type: K, interceptor: ShopifyInterceptor<ShopifyInterceptMap[K]>): () => void;
|
|
31
38
|
}
|
|
32
39
|
declare global {
|
|
33
40
|
const navigation: Navigation;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../../../src/surfaces/point-of-sale/globals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,qCAAqC,CAAC;AACpE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"globals.d.ts","sourceRoot":"","sources":["../../../../src/surfaces/point-of-sale/globals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,qCAAqC,CAAC;AACpE,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,UAAU,CAAC;AAElB;;;;;GAKG;AACH,MAAM,WAAW,aAAa;CAAG;AAEjC;;;;;;;GAOG;AACH,MAAM,WAAW,uBAAwB,SAAQ,aAAa;IAC5D;;;;OAIG;IACH,gBAAgB,CAAC,CAAC,SAAS,MAAM,eAAe,EAC9C,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,GAC5C,IAAI,CAAC;IAER;;;OAGG;IACH,mBAAmB,CAAC,CAAC,SAAS,MAAM,eAAe,EACjD,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,KAAK,IAAI,GAC5C,IAAI,CAAC;IAER;;;;;OAKG;IACH,SAAS,CAAC,CAAC,SAAS,MAAM,mBAAmB,EAC3C,IAAI,EAAE,CAAC,EACP,WAAW,EAAE,kBAAkB,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,GACtD,MAAM,IAAI,CAAC;CACf;AAED,OAAO,CAAC,MAAM,CAAC;IAEb,MAAM,UAAU,EAAE,UAAU,CAAC;IAO7B,MAAM,OAAO,EAAE,aAAa,CAAC;CAC9B"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ReadonlySignalLike } from '../../../shared';
|
|
1
2
|
/**
|
|
2
3
|
* @publicDocs
|
|
3
4
|
*/
|
|
@@ -11,6 +12,32 @@ export declare class StorageError extends Error {
|
|
|
11
12
|
* @publicDocs
|
|
12
13
|
*/
|
|
13
14
|
export interface Storage<BaseStorageTypes extends Record<string, any> = Record<string, unknown>> {
|
|
15
|
+
/**
|
|
16
|
+
* Reactive access to storage values as Subscribables.
|
|
17
|
+
*
|
|
18
|
+
* Each key is exposed as a `ReadonlySignalLike<T | undefined>`, enabling cross-target
|
|
19
|
+
* reactivity. One extension target can subscribe to a key and react when
|
|
20
|
+
* another target updates it via `set()` or `delete()`.
|
|
21
|
+
*
|
|
22
|
+
* The `value` property provides synchronous, reactive access to the current stored
|
|
23
|
+
* value. It is not preloaded: storage hydrates asynchronously, so `value` is
|
|
24
|
+
* `undefined` until the key has been loaded.
|
|
25
|
+
* The `subscribe()` method registers a callback that fires whenever the value
|
|
26
|
+
* changes, including changes made by other extension targets within the same app.
|
|
27
|
+
*
|
|
28
|
+
* @example Cross-target reactivity
|
|
29
|
+
* ```typescript
|
|
30
|
+
* // In one extension target:
|
|
31
|
+
* await shopify.storage.set('syncStatus', 'complete');
|
|
32
|
+
*
|
|
33
|
+
* // In another target:
|
|
34
|
+
* const status = shopify.storage.current.syncStatus.value; // 'complete'
|
|
35
|
+
* const unsubscribe = shopify.storage.current.syncStatus.subscribe((value) => {
|
|
36
|
+
* // Reacts when another target updates this key
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
current?: SubscribableStorage<BaseStorageTypes>;
|
|
14
41
|
/**
|
|
15
42
|
* Stores a value under the specified key, overwriting any existing value. Values must be JSON-serializable and return `StorageError` when storage limits are exceeded. Commonly used for storing user preferences, caching API responses, or passing contextual data from tiles to modals.
|
|
16
43
|
*
|
|
@@ -48,4 +75,17 @@ export interface Storage<BaseStorageTypes extends Record<string, any> = Record<s
|
|
|
48
75
|
*/
|
|
49
76
|
entries<StorageTypes extends BaseStorageTypes = BaseStorageTypes, Keys extends keyof StorageTypes = keyof StorageTypes>(): Promise<[Keys, StorageTypes[Keys]][]>;
|
|
50
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Provides reactive, subscribable access to individual storage keys.
|
|
80
|
+
*
|
|
81
|
+
* Each property is a `ReadonlySignalLike` that reflects the current value of the
|
|
82
|
+
* corresponding storage key. Values are `undefined` when the key does not exist
|
|
83
|
+
* or is being loaded asynchronously.
|
|
84
|
+
*
|
|
85
|
+
* Mutations are performed through the existing `Storage` methods (`set`,
|
|
86
|
+
* `delete`, `clear`, etc.) — `SubscribableStorage` is read-only and reactive.
|
|
87
|
+
*/
|
|
88
|
+
export type SubscribableStorage<BaseStorageTypes extends Record<string, any> = Record<string, unknown>> = {
|
|
89
|
+
readonly [K in keyof BaseStorageTypes]: ReadonlySignalLike<BaseStorageTypes[K] | undefined>;
|
|
90
|
+
};
|
|
51
91
|
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../../../src/surfaces/point-of-sale/types/storage.ts"],"names":[],"m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