@juo/blocks 1.11.0-alpha.0 → 1.11.0
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/dist/{ExtensionRoot-C7tcvV-n.js → ExtensionRoot-9XfhG8YM.js} +1 -3
- package/dist/block.d.ts.map +1 -1
- package/dist/core.js +319 -1010
- package/dist/editor/handler.d.ts +1 -1
- package/dist/editor/handler.d.ts.map +1 -1
- package/dist/editor.js +1 -3
- package/dist/juo-workflow-CkyZRq60.js +1667 -0
- package/dist/services/customer/customerService.d.ts +2 -3
- package/dist/services/customer/customerService.d.ts.map +1 -1
- package/dist/services/customer/index.d.ts +0 -1
- package/dist/services/customer/index.d.ts.map +1 -1
- package/dist/services/customer/types.d.ts +1 -4
- package/dist/services/customer/types.d.ts.map +1 -1
- package/dist/services/index.d.ts +0 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/login/index.d.ts +1 -3
- package/dist/services/login/index.d.ts.map +1 -1
- package/dist/services/login/loginService.d.ts +2 -6
- package/dist/services/login/loginService.d.ts.map +1 -1
- package/dist/services/product/adapter.d.ts +1 -4
- package/dist/services/product/adapter.d.ts.map +1 -1
- package/dist/services/product/index.d.ts +1 -1
- package/dist/services/product/index.d.ts.map +1 -1
- package/dist/services/product/types.d.ts +0 -2
- package/dist/services/product/types.d.ts.map +1 -1
- package/dist/services/subscription/adapter.d.ts +2 -12
- package/dist/services/subscription/adapter.d.ts.map +1 -1
- package/dist/services/subscription/index.d.ts +1 -1
- package/dist/services/subscription/index.d.ts.map +1 -1
- package/dist/services/subscription/subscriptionService.d.ts +6 -1
- package/dist/services/subscription/subscriptionService.d.ts.map +1 -1
- package/dist/services/subscription/types.d.ts +16 -25
- package/dist/services/subscription/types.d.ts.map +1 -1
- package/dist/utils/editor.d.ts +18 -0
- package/dist/utils/editor.d.ts.map +1 -0
- package/dist/utils/editor.test.d.ts +2 -0
- package/dist/utils/editor.test.d.ts.map +1 -0
- package/dist/utils/index.d.ts +1 -6
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/vue/block.d.ts +2 -2
- package/dist/vue/block.d.ts.map +1 -1
- package/dist/vue.js +3 -4
- package/dist/web-components-editor.js +2 -3
- package/dist/web-components-runtime.js +2 -3
- package/package.json +1 -1
- package/dist/block-WoHZvF51.js +0 -858
- package/dist/juo-workflow-DRauDEnU.js +0 -617
- package/dist/services/customer/adapter.d.ts +0 -8
- package/dist/services/customer/adapter.d.ts.map +0 -1
- package/dist/services/login/adapter.d.ts +0 -32
- package/dist/services/login/adapter.d.ts.map +0 -1
- package/dist/services/order/adapter.d.ts +0 -9
- package/dist/services/order/adapter.d.ts.map +0 -1
- package/dist/services/order/index.d.ts +0 -5
- package/dist/services/order/index.d.ts.map +0 -1
- package/dist/services/order/orderService.d.ts +0 -7
- package/dist/services/order/orderService.d.ts.map +0 -1
- package/dist/services/order/types.d.ts +0 -21
- package/dist/services/order/types.d.ts.map +0 -1
- package/dist/services/schedules/adapter.d.ts +0 -22
- package/dist/services/schedules/adapter.d.ts.map +0 -1
- package/dist/services/schedules/index.d.ts +0 -5
- package/dist/services/schedules/index.d.ts.map +0 -1
- package/dist/services/schedules/schedulesService.d.ts +0 -10
- package/dist/services/schedules/schedulesService.d.ts.map +0 -1
- package/dist/services/schedules/types.d.ts +0 -47
- package/dist/services/schedules/types.d.ts.map +0 -1
- package/dist/theme-state-CzXQGOTk.js +0 -202
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ContextType } from '../../context';
|
|
2
2
|
import { CustomerService } from './types';
|
|
3
3
|
type CreateCustomerServiceOptions = {
|
|
4
|
-
adapter: CustomerAdapter;
|
|
5
4
|
/**
|
|
6
5
|
* Absolute storefront URL for account / orders (Header `<a href>` + `target="_parent"`).
|
|
7
6
|
* Called once when the service is created; hosts that need reactivity (portal) update
|
|
@@ -9,7 +8,7 @@ type CreateCustomerServiceOptions = {
|
|
|
9
8
|
*/
|
|
10
9
|
getAccountOrdersUrl: () => string;
|
|
11
10
|
};
|
|
12
|
-
export declare function createCustomerService(options: CreateCustomerServiceOptions):
|
|
11
|
+
export declare function createCustomerService(options: CreateCustomerServiceOptions): ContextType<typeof CustomerServiceContext>;
|
|
13
12
|
export declare const CustomerServiceContext: {
|
|
14
13
|
__context__: CustomerService;
|
|
15
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customerService.d.ts","sourceRoot":"","sources":["../../../src/services/customer/customerService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"customerService.d.ts","sourceRoot":"","sources":["../../../src/services/customer/customerService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,SAAS,CAAC;AAEzD,KAAK,4BAA4B,GAAG;IAClC;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,MAAM,CAAC;CACnC,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,4BAA4B,GACpC,WAAW,CAAC,OAAO,sBAAsB,CAAC,CAU5C;AAED,eAAO,MAAM,sBAAsB;;CACkB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export { type CustomerService, type Customer } from './types';
|
|
2
2
|
export { createCustomerService, CustomerServiceContext, } from './customerService';
|
|
3
|
-
export { type CustomerAdapter, createMockCustomerAdapter, createApiCustomerAdapter, } from './adapter';
|
|
4
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/customer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/customer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { Signal } from '@preact/signals-core';
|
|
2
|
-
import { Result } from '../../utils';
|
|
3
2
|
/** Signed-in customer identity for blocks such as Header (name / email display). */
|
|
4
3
|
export type Customer = {
|
|
5
4
|
id: string;
|
|
6
5
|
name: string;
|
|
7
|
-
email
|
|
8
|
-
metadata?: Record<string, unknown>;
|
|
6
|
+
email: string;
|
|
9
7
|
};
|
|
10
8
|
export type CustomerService = {
|
|
11
9
|
current: Signal<Customer | null>;
|
|
12
|
-
getCurrent(): Promise<Result<Customer | null>>;
|
|
13
10
|
accountOrdersUrl: Signal<string>;
|
|
14
11
|
};
|
|
15
12
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/customer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/customer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEnD,oFAAoF;AACpF,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IACjC,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;CAClC,CAAC"}
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC"}
|
|
@@ -13,13 +13,11 @@ type LoginService = {
|
|
|
13
13
|
};
|
|
14
14
|
isAuthenticated: Signal<boolean>;
|
|
15
15
|
getToken(): Promise<string | null>;
|
|
16
|
-
getAuthHeaders(): Promise<Record<string, string>>;
|
|
17
16
|
handleQueryParams(query: URLSearchParams): Promise<Result<void, ErrorDetails>>;
|
|
18
17
|
logout(): Promise<Result>;
|
|
19
18
|
};
|
|
20
19
|
export declare const LoginServiceContext: {
|
|
21
20
|
__context__: LoginService;
|
|
22
21
|
};
|
|
23
|
-
export { loginService,
|
|
24
|
-
export { type LoginAdapter, type AuthTokens, createApiLoginAdapter, createMockLoginAdapter, } from './adapter';
|
|
22
|
+
export { loginService, type LoginServiceDependencies, type ErrorFormatter, AuthenticationError, AuthenticationErrorReason, } from './loginService';
|
|
25
23
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/login/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C,OAAO,EAAE,MAAM,EAAE,KAAK,YAAY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AE;QACN,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;QAC5E,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;KAC3D,CAAC;IAEF,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAEjC,QAAQ,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAEnC,iBAAiB,CACf,KAAK,EAAE,eAAe,GACrB,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;IAEvC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,mBAAmB;;CACe,CAAC;AAEhD,OAAO,EACL,YAAY,EACZ,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Signal } from '@preact/signals-core';
|
|
2
|
-
import { LoginAdapter } from './adapter';
|
|
3
2
|
export declare enum AuthenticationErrorReason {
|
|
4
3
|
Expired = "expired",
|
|
5
4
|
IncorrectCode = "wrong-code",
|
|
@@ -29,15 +28,14 @@ export type ErrorFormatter = (error: unknown | AuthenticationError) => {
|
|
|
29
28
|
message: string;
|
|
30
29
|
};
|
|
31
30
|
export interface LoginServiceDependencies {
|
|
32
|
-
|
|
31
|
+
apiUrl: string;
|
|
33
32
|
formatError: ErrorFormatter;
|
|
34
33
|
router: RouterService;
|
|
35
34
|
shop: ShopService;
|
|
36
35
|
onLoginSuccess?: () => Promise<void>;
|
|
37
36
|
}
|
|
38
37
|
/**
|
|
39
|
-
* @deprecated Use `createLoginService` instead
|
|
40
|
-
* Constructs a real API adapter from `shop.rootUrl` for backward compatibility.
|
|
38
|
+
* @deprecated Use `createLoginService` instead
|
|
41
39
|
*/
|
|
42
40
|
export declare function loginService(deps: {
|
|
43
41
|
formatError: ErrorFormatter;
|
|
@@ -61,7 +59,6 @@ export declare function loginService(deps: {
|
|
|
61
59
|
};
|
|
62
60
|
isAuthenticated: Signal<boolean>;
|
|
63
61
|
getToken(): Promise<string | null>;
|
|
64
|
-
getAuthHeaders(): Promise<Record<string, string>>;
|
|
65
62
|
handleQueryParams(query: URLSearchParams): Promise<import('../../utils').Result<void, import('../../utils').ErrorDetails>>;
|
|
66
63
|
logout(): Promise<import('../../utils').Result>;
|
|
67
64
|
};
|
|
@@ -78,7 +75,6 @@ export declare function createLoginService(init: LoginServiceDependencies): {
|
|
|
78
75
|
};
|
|
79
76
|
isAuthenticated: Signal<boolean>;
|
|
80
77
|
getToken(): Promise<string | null>;
|
|
81
|
-
getAuthHeaders(): Promise<Record<string, string>>;
|
|
82
78
|
handleQueryParams(query: URLSearchParams): Promise<import('../../utils').Result<void, import('../../utils').ErrorDetails>>;
|
|
83
79
|
logout(): Promise<import('../../utils').Result>;
|
|
84
80
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loginService.d.ts","sourceRoot":"","sources":["../../../src/services/login/loginService.ts"],"names":[],"mappings":"AAEA,OAAO,EAA4B,MAAM,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"loginService.d.ts","sourceRoot":"","sources":["../../../src/services/login/loginService.ts"],"names":[],"mappings":"AAEA,OAAO,EAA4B,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAMxE,oBAAY,yBAAyB;IACnC,OAAO,YAAY;IACnB,aAAa,eAAe;IAC5B,YAAY,mBAAmB;IAC/B,OAAO,aAAa;IACpB,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,MAAM,EAAE,yBAAyB,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC,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
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PaginatedList } from '../../utils';
|
|
2
2
|
import { Product, WithVariants } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Adapter interface for product operations.
|
|
@@ -17,7 +17,4 @@ export interface ProductAdapter {
|
|
|
17
17
|
}): Promise<PaginatedList<WithVariants<Product>>>;
|
|
18
18
|
}
|
|
19
19
|
export declare function createMockProductAdapter(): ProductAdapter;
|
|
20
|
-
export declare function createApiProductAdapter(fetcher: ApiFetcher, opts?: {
|
|
21
|
-
currencyCode: string;
|
|
22
|
-
}): ProductAdapter;
|
|
23
20
|
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/services/product/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/services/product/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAkB,YAAY,EAAE,MAAM,SAAS,CAAC;AAErE;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;IAE3D,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;IAEzE,MAAM,CAAC,IAAI,CAAC,EAAE;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,GAAG;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC;KACrD,GAAG,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CACnD;AAED,wBAAgB,wBAAwB,IAAI,cAAc,CAsMzD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { ProductAdapter } from './adapter';
|
|
2
|
-
export { createMockProductAdapter
|
|
2
|
+
export { createMockProductAdapter } from './adapter';
|
|
3
3
|
export { createProductService, ProductServiceContext } from './productService';
|
|
4
4
|
export * from './types';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/product/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/product/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE/E,cAAc,SAAS,CAAC"}
|
|
@@ -7,7 +7,6 @@ export interface Product {
|
|
|
7
7
|
collections: {
|
|
8
8
|
handle: string;
|
|
9
9
|
}[];
|
|
10
|
-
metadata?: Record<string, unknown>;
|
|
11
10
|
}
|
|
12
11
|
export interface PurchaseOption {
|
|
13
12
|
name: string;
|
|
@@ -24,7 +23,6 @@ export interface ProductVariant {
|
|
|
24
23
|
price: PriceWithCurrency;
|
|
25
24
|
subscriptionPrice?: PriceWithCurrency;
|
|
26
25
|
purchaseOptions?: PurchaseOption[];
|
|
27
|
-
metadata?: Record<string, unknown>;
|
|
28
26
|
}
|
|
29
27
|
export type WithVariants<T> = T & {
|
|
30
28
|
variants: PaginatedList<ProductVariant>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/product/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE3E,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,KAAK,GAAG,IAAI,CAAC;IAC5B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,WAAW,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/product/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE3E,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,KAAK,GAAG,IAAI,CAAC;IAC5B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,WAAW,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACnC;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CACvD;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,KAAK,EAAE,iBAAiB,CAAC;IACzB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;IACtC,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;CACpC;AAED,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG;IAChC,QAAQ,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CACzC,CAAC;AAEF,MAAM,MAAM,cAAc,CACxB,CAAC,SAAS,YAAY,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,OAAO,CAAC,IACrD;IACF,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACvC,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACrD,MAAM,CAAC,IAAI,CAAC,EAAE;QACZ,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,UAAU,CAAC,EAAE;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,GAAG;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC;KACrD,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SearchOptions, PostableSubscriptionItem, Subscription, SellingPlan, UpsellProduct } from './types';
|
|
1
|
+
import { Subscription, SellingPlan, SearchOptions, PostableSubscriptionItem } from './types';
|
|
3
2
|
import { ApplyDiscountError, DiscountRejectionReason, RemoveDiscountError } from './discountErrors';
|
|
3
|
+
import { Result, PaginatedList } from '../../utils';
|
|
4
4
|
/**
|
|
5
5
|
* Adapter interface for subscription.
|
|
6
6
|
* Implementations should handle API calls, error handling, and data transformation.
|
|
@@ -45,15 +45,6 @@ export interface SubscriptionAdapter {
|
|
|
45
45
|
subscriptionId: string;
|
|
46
46
|
}): Promise<Result<SellingPlan[]>>;
|
|
47
47
|
getDefaultSubscriptionId(): Promise<Result<string | null>>;
|
|
48
|
-
getUpsellProducts?(params: {
|
|
49
|
-
subscriptionId: string;
|
|
50
|
-
}): Promise<Result<UpsellProduct[]>>;
|
|
51
|
-
addUpsellProduct?(params: {
|
|
52
|
-
subscriptionId: string;
|
|
53
|
-
variantId: string;
|
|
54
|
-
quantity: number;
|
|
55
|
-
oneTime?: boolean;
|
|
56
|
-
}): Promise<Result>;
|
|
57
48
|
}
|
|
58
49
|
export interface MockSubscriptionAdapterOptions {
|
|
59
50
|
addDiscountBehavior?: {
|
|
@@ -73,5 +64,4 @@ export interface MockSubscriptionAdapterOptions {
|
|
|
73
64
|
};
|
|
74
65
|
}
|
|
75
66
|
export declare function createMockSubscriptionAdapter(options?: MockSubscriptionAdapterOptions): SubscriptionAdapter;
|
|
76
|
-
export declare function createApiSubscriptionAdapter(fetcher: ApiFetcher): SubscriptionAdapter;
|
|
77
67
|
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/services/subscription/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/services/subscription/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,aAAa,EACb,wBAAwB,EACzB,MAAM,SAAS,CAAC;AACjB,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACvB,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAE9E,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC;IAE1D,OAAO,CAAC,MAAM,EAAE;QACd,cAAc,EAAE,MAAM,CAAC;QACvB,IAAI,EAAE,wBAAwB,CAAC;KAChC,GAAG,OAA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,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAEtF,wBAAwB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;CAC5D;AAED,MAAM,WAAW,8BAA8B;IAC7C,mBAAmB,CAAC,EAChB;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,GACnB;QAAE,IAAI,EAAE,UAAU,CAAC;QAAC,MAAM,EAAE,uBAAuB,CAAA;KAAE,GACrD;QACE,IAAI,EAAE,OAAO,CAAC;QACd,KAAK,EAAE,SAAS,GAAG,SAAS,GAAG,wBAAwB,CAAC;KACzD,CAAC;IACN,sBAAsB,CAAC,EACnB;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,GACnB;QACE,IAAI,EAAE,OAAO,CAAC;QACd,KAAK,EACD,SAAS,GACT,SAAS,GACT,wBAAwB,GACxB,oBAAoB,CAAC;KAC1B,CAAC;CACP;AAED,wBAAgB,6BAA6B,CAC3C,OAAO,GAAE,8BAAmC,GAC3C,mBAAmB,CAuSrB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { SubscriptionAdapter, MockSubscriptionAdapterOptions } from './adapter';
|
|
2
|
-
export { createMockSubscriptionAdapter
|
|
2
|
+
export { createMockSubscriptionAdapter } from './adapter';
|
|
3
3
|
export { createSubscriptionService, SubscriptionServiceContext } from './subscriptionService';
|
|
4
4
|
export * from './types';
|
|
5
5
|
export * from './discountErrors';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/subscription/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AACrF,OAAO,EAAE,6BAA6B,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/subscription/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,WAAW,CAAC;AACrF,OAAO,EAAE,6BAA6B,EAAE,MAAM,WAAW,CAAC;AAE1D,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAE9F,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { ContextType } from '../../context';
|
|
1
2
|
import { SubscriptionAdapter } from './adapter';
|
|
2
3
|
import { SubscriptionService } from './types';
|
|
3
4
|
export declare const SubscriptionServiceContext: {
|
|
4
5
|
__context__: SubscriptionService;
|
|
5
6
|
};
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Creates a subscription service that uses the provided adapter for data operations.
|
|
9
|
+
* The adapter pattern decouples the service from specific SDK implementations.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createSubscriptionService(adapter: SubscriptionAdapter): ContextType<typeof SubscriptionServiceContext>;
|
|
7
12
|
//# sourceMappingURL=subscriptionService.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptionService.d.ts","sourceRoot":"","sources":["../../../src/services/subscription/subscriptionService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"subscriptionService.d.ts","sourceRoot":"","sources":["../../../src/services/subscription/subscriptionService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAiB,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,KAAK,EAGV,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,0BAA0B;;CACsB,CAAC;AAqC9D;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,mBAAmB,GAC3B,WAAW,CAAC,OAAO,0BAA0B,CAAC,CAmGhD"}
|
|
@@ -8,8 +8,6 @@ export interface SubscriptionItem {
|
|
|
8
8
|
quantity: number;
|
|
9
9
|
price: PriceWithCurrency;
|
|
10
10
|
nextDeliveryDate?: Date | null;
|
|
11
|
-
billingPolicy?: SellingPlanInterval | null;
|
|
12
|
-
deliveryPolicy?: SellingPlanInterval | null;
|
|
13
11
|
}
|
|
14
12
|
export interface PostableSubscriptionItem {
|
|
15
13
|
variantId: string;
|
|
@@ -61,17 +59,15 @@ export interface SearchOptions {
|
|
|
61
59
|
after: string;
|
|
62
60
|
};
|
|
63
61
|
}
|
|
64
|
-
export interface UpsellProduct {
|
|
65
|
-
id: string;
|
|
66
|
-
variantId: string;
|
|
67
|
-
title: string;
|
|
68
|
-
imageUrl?: string;
|
|
69
|
-
price: PriceWithCurrency;
|
|
70
|
-
description?: string;
|
|
71
|
-
}
|
|
72
62
|
export type SubscriptionService = {
|
|
63
|
+
search(options?: SearchOptions): Promise<Result<PaginatedList<Subscription>>>;
|
|
64
|
+
getById(id: string): Promise<Result<Subscription | null>>;
|
|
65
|
+
getCurrentSubscriptionId(): string | null;
|
|
66
|
+
/**
|
|
67
|
+
* Subscription the host treats as in focus (e.g. detail page), or `null`. Preact `Signal`;
|
|
68
|
+
* the service factory creates it; hosts sync route or other context by assigning `current.value`.
|
|
69
|
+
*/
|
|
73
70
|
current: Signal<Subscription | null>;
|
|
74
|
-
hasPendingBilling: Signal<boolean>;
|
|
75
71
|
/**
|
|
76
72
|
* Monotonically-increasing counter that bumps after every successful
|
|
77
73
|
* `addDiscount`/`removeDiscount`. Consumers (e.g. the customer portal page)
|
|
@@ -79,28 +75,23 @@ export type SubscriptionService = {
|
|
|
79
75
|
* subscription's discounts.
|
|
80
76
|
*/
|
|
81
77
|
discountsChangedAt: ReadonlySignal<number>;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}): Promise<Result<UpsellProduct[]>>;
|
|
78
|
+
/**
|
|
79
|
+
* Monotonically-increasing counter that bumps after every successful
|
|
80
|
+
* `addItem`/`removeItem`. Consumers (e.g. the customer portal page) can watch
|
|
81
|
+
* this signal to re-fetch any non-blocks state that depends on the
|
|
82
|
+
* subscription's line items.
|
|
83
|
+
*/
|
|
84
|
+
itemsChangedAt: ReadonlySignal<number>;
|
|
90
85
|
addItem(subscriptionId: string, item: PostableSubscriptionItem): Promise<Result>;
|
|
91
86
|
removeItem(subscriptionId: string, itemId: string): Promise<Result>;
|
|
92
87
|
addDiscount(code: string, subscriptionId?: string): Promise<Result<void, ApplyDiscountError>>;
|
|
93
88
|
removeDiscount(discountId: string, subscriptionId?: string): Promise<Result<void, RemoveDiscountError>>;
|
|
94
|
-
addUpsellProduct(params: {
|
|
95
|
-
subscriptionId: string;
|
|
96
|
-
variantId: string;
|
|
97
|
-
quantity: number;
|
|
98
|
-
oneTime?: boolean;
|
|
99
|
-
}): Promise<Result>;
|
|
100
89
|
reschedule(subscriptionId: string, newDate: string): Promise<Result<Subscription>>;
|
|
101
90
|
resume(subscriptionId: string): Promise<Result<Subscription>>;
|
|
102
91
|
pause(subscriptionId: string): Promise<Result<Subscription>>;
|
|
103
92
|
reactivate(subscriptionId: string): Promise<Result<Subscription>>;
|
|
104
93
|
cancel(subscriptionId: string, reason?: string): Promise<Result<Subscription>>;
|
|
94
|
+
getAvailablePlans(subscriptionId: string): Promise<Result<SellingPlan[]>>;
|
|
95
|
+
getDefaultSubscriptionId(): Promise<Result<string | null>>;
|
|
105
96
|
};
|
|
106
97
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/subscription/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAA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,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC;IAC/E,iBAAiB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;IAC1E,wBAAwB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;CAC5D,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detects whether a block is rendering inside an **editor preview** (the
|
|
3
|
+
* blocks visual editor or the Shopify theme editor) rather than the live
|
|
4
|
+
* storefront.
|
|
5
|
+
*
|
|
6
|
+
* Both editors load the customer portal in an iframe whose URL carries
|
|
7
|
+
* `?editor=true` (blocks editor: `blocks/editor/src/pages/Editor.vue`; theme
|
|
8
|
+
* editor: same param), and the param is persisted across client-side
|
|
9
|
+
* navigation and SSR redirects (`BlocksInitializer.vue`,
|
|
10
|
+
* `customer-portal/server.ts`).
|
|
11
|
+
*
|
|
12
|
+
* Prefer this over an iframe-topology check (`window.parent !== window`):
|
|
13
|
+
* that also fires for any non-editor embedding (app embeds, third-party
|
|
14
|
+
* wrappers), which would wrongly suppress storefront behavior. The explicit
|
|
15
|
+
* `?editor=true` signal only appears when an editor intends a preview.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isEditorPreview(): boolean;
|
|
18
|
+
//# sourceMappingURL=editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../src/utils/editor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,IAAI,OAAO,CAGzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor.test.d.ts","sourceRoot":"","sources":["../../src/utils/editor.test.ts"],"names":[],"mappings":""}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -29,10 +29,5 @@ export type PriceWithCurrency = {
|
|
|
29
29
|
amount: string;
|
|
30
30
|
currencyCode: string;
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
* Thin fetch wrapper provided by themes.
|
|
34
|
-
* Handles auth headers, base URL, and shop domain injection.
|
|
35
|
-
* Path should start with `/` (e.g. `/customer/v1/subscriptions`).
|
|
36
|
-
*/
|
|
37
|
-
export type ApiFetcher = (path: string, init?: RequestInit) => Promise<Response>;
|
|
32
|
+
export * from './editor';
|
|
38
33
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,OAAO,IAAI;IACjC,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,OAAO,CAAC,CAAC,GAAG,IAAI,IAAI;IAC9B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,CAAC,CAAC;CACT,CAAC;AAEF,MAAM,MAAM,MAAM,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAEpE,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,MAAM,YAAY,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,KAAK,GAAG;IAClB,GAAG,E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C;CACtB,CAAC;AAEF,cAAc,UAAU,CAAC"}
|
package/dist/vue/block.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { App, Component } from 'vue';
|
|
2
|
-
import { BlockInstance } from '../main.ts';
|
|
3
|
-
export { hasRenderedContent }
|
|
2
|
+
import { BlockInstance, hasRenderedContent } from '../main.ts';
|
|
3
|
+
export { hasRenderedContent };
|
|
4
4
|
export declare function createVueRenderer(component: Component, options?: {
|
|
5
5
|
hostApp?: App;
|
|
6
6
|
}): (block: BlockInstance) => HTMLElement;
|
package/dist/vue/block.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/vue/block.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EAGR,SAAS,EAUV,MAAM,KAAK,CAAC;AACb,OAAO,
|
|
1
|
+
{"version":3,"file":"block.d.ts","sourceRoot":"","sources":["../../src/vue/block.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,GAAG,EAGR,SAAS,EAUV,MAAM,KAAK,CAAC;AACb,OAAO,EAEL,aAAa,EAEb,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,kBAAkB,EAAE,CAAC;AA2B9B,wBAAgB,iBAAiB,CAC/B,SAAS,EAAE,SAAS,EACpB,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,GAAG,CAAA;CAAE,WAuCZ,aAAa,iBA6D7B;AAED,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,SAAS,EACpB,EAAE,UAAiB,EAAE,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,yCAoCrD"}
|
package/dist/vue.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { customRef, toValue, watchEffect, defineComponent, ref, getCurrentInstance, onMounted, provide, h, renderSlot, inject, computed, useHost, defineCustomElement, triggerRef, render, shallowRef } from "vue";
|
|
2
|
-
import { effect, signal, injectContext, provideContext, createCeRenderer } from "@juo/blocks";
|
|
3
|
-
import {
|
|
4
|
-
import { n } from "./block-WoHZvF51.js";
|
|
2
|
+
import { effect, signal, injectContext, provideContext, createCeRenderer, attachEmptyTracking } from "@juo/blocks";
|
|
3
|
+
import { hasRenderedContent } from "@juo/blocks";
|
|
5
4
|
import { c as createRegisterBlockTranslationKeysMessage, a as createEditorBridge } from "./bridge-w5KQ-czl.js";
|
|
6
5
|
const signalsMap = /* @__PURE__ */ new WeakMap();
|
|
7
6
|
function toSignal(ref2) {
|
|
@@ -291,7 +290,7 @@ export {
|
|
|
291
290
|
ContextProvider,
|
|
292
291
|
createVueCeRenderer,
|
|
293
292
|
createVueRenderer,
|
|
294
|
-
|
|
293
|
+
hasRenderedContent,
|
|
295
294
|
toRef,
|
|
296
295
|
toSignal,
|
|
297
296
|
useBlockId,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import {
|
|
5
|
-
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-
|
|
4
|
+
import { z as injectContext, E, b as TranslationContext, M as ContextRoot } from "./juo-workflow-CkyZRq60.js";
|
|
5
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-9XfhG8YM.js";
|
|
6
6
|
import { a as createEditorBridge, b as createFocusInlineTextMessage, d as createUpdateBlockTranslationMessage } from "./bridge-w5KQ-czl.js";
|
|
7
|
-
import { T as TranslationContext } from "./juo-workflow-DRauDEnU.js";
|
|
8
7
|
const _InlineText = class _InlineText extends HTMLElement {
|
|
9
8
|
constructor() {
|
|
10
9
|
super();
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import {
|
|
5
|
-
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-
|
|
6
|
-
import { T as TranslationContext } from "./juo-workflow-DRauDEnU.js";
|
|
4
|
+
import { z as injectContext, b as TranslationContext, E, M as ContextRoot } from "./juo-workflow-CkyZRq60.js";
|
|
5
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-9XfhG8YM.js";
|
|
7
6
|
class InlineText extends HTMLElement {
|
|
8
7
|
constructor() {
|
|
9
8
|
super(...arguments);
|