@juo/blocks 1.11.0 → 1.12.0-alpha.1

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.
Files changed (115) hide show
  1. package/dist/{ExtensionRoot-9XfhG8YM.js → ExtensionRoot-Z2DlF9X6.js} +14 -3
  2. package/dist/block-Bh3z0B3y.js +971 -0
  3. package/dist/block.d.ts +50 -0
  4. package/dist/block.d.ts.map +1 -1
  5. package/dist/block.devtools.test.d.ts +2 -0
  6. package/dist/block.devtools.test.d.ts.map +1 -0
  7. package/dist/context.d.ts.map +1 -1
  8. package/dist/context.devtools.test.d.ts +2 -0
  9. package/dist/context.devtools.test.d.ts.map +1 -0
  10. package/dist/core.js +1677 -330
  11. package/dist/editor/components.d.ts.map +1 -1
  12. package/dist/editor/main.d.ts +4 -0
  13. package/dist/editor/main.d.ts.map +1 -1
  14. package/dist/editor/main.test.d.ts +2 -0
  15. package/dist/editor/main.test.d.ts.map +1 -0
  16. package/dist/editor.js +19 -2
  17. package/dist/{juo-workflow-CkyZRq60.js → juo-workflow-D3c29mxb.js} +52 -871
  18. package/dist/main.d.ts +2 -1
  19. package/dist/main.d.ts.map +1 -1
  20. package/dist/overlay-wrapper.d.ts +68 -0
  21. package/dist/overlay-wrapper.d.ts.map +1 -0
  22. package/dist/registry.devtools.test.d.ts +2 -0
  23. package/dist/registry.devtools.test.d.ts.map +1 -0
  24. package/dist/services/customer/adapter.d.ts +8 -0
  25. package/dist/services/customer/adapter.d.ts.map +1 -0
  26. package/dist/services/customer/customerService.d.ts +3 -2
  27. package/dist/services/customer/customerService.d.ts.map +1 -1
  28. package/dist/services/customer/index.d.ts +1 -0
  29. package/dist/services/customer/index.d.ts.map +1 -1
  30. package/dist/services/customer/types.d.ts +4 -1
  31. package/dist/services/customer/types.d.ts.map +1 -1
  32. package/dist/services/index.d.ts +3 -0
  33. package/dist/services/index.d.ts.map +1 -1
  34. package/dist/services/login/adapter.d.ts +32 -0
  35. package/dist/services/login/adapter.d.ts.map +1 -0
  36. package/dist/services/login/index.d.ts +3 -1
  37. package/dist/services/login/index.d.ts.map +1 -1
  38. package/dist/services/login/loginService.d.ts +6 -2
  39. package/dist/services/login/loginService.d.ts.map +1 -1
  40. package/dist/services/order/adapter.d.ts +9 -0
  41. package/dist/services/order/adapter.d.ts.map +1 -0
  42. package/dist/services/order/index.d.ts +5 -0
  43. package/dist/services/order/index.d.ts.map +1 -0
  44. package/dist/services/order/orderService.d.ts +7 -0
  45. package/dist/services/order/orderService.d.ts.map +1 -0
  46. package/dist/services/order/types.d.ts +21 -0
  47. package/dist/services/order/types.d.ts.map +1 -0
  48. package/dist/services/orders/adapter.d.ts +2 -1
  49. package/dist/services/orders/adapter.d.ts.map +1 -1
  50. package/dist/services/orders/types.d.ts +8 -0
  51. package/dist/services/orders/types.d.ts.map +1 -1
  52. package/dist/services/product/adapter.d.ts +27 -2
  53. package/dist/services/product/adapter.d.ts.map +1 -1
  54. package/dist/services/product/adapter.test.d.ts +2 -0
  55. package/dist/services/product/adapter.test.d.ts.map +1 -0
  56. package/dist/services/product/index.d.ts +1 -1
  57. package/dist/services/product/index.d.ts.map +1 -1
  58. package/dist/services/product/productService.d.ts.map +1 -1
  59. package/dist/services/product/types.d.ts +68 -0
  60. package/dist/services/product/types.d.ts.map +1 -1
  61. package/dist/services/schedules/adapter.d.ts +25 -0
  62. package/dist/services/schedules/adapter.d.ts.map +1 -0
  63. package/dist/services/schedules/adapter.test.d.ts +2 -0
  64. package/dist/services/schedules/adapter.test.d.ts.map +1 -0
  65. package/dist/services/schedules/index.d.ts +5 -0
  66. package/dist/services/schedules/index.d.ts.map +1 -0
  67. package/dist/services/schedules/schedulesService.d.ts +11 -0
  68. package/dist/services/schedules/schedulesService.d.ts.map +1 -0
  69. package/dist/services/schedules/schedulesService.test.d.ts +2 -0
  70. package/dist/services/schedules/schedulesService.test.d.ts.map +1 -0
  71. package/dist/services/schedules/types.d.ts +101 -0
  72. package/dist/services/schedules/types.d.ts.map +1 -0
  73. package/dist/services/settings/index.d.ts +3 -0
  74. package/dist/services/settings/index.d.ts.map +1 -0
  75. package/dist/services/settings/settingsService.d.ts +7 -0
  76. package/dist/services/settings/settingsService.d.ts.map +1 -0
  77. package/dist/services/settings/settingsService.test.d.ts +2 -0
  78. package/dist/services/settings/settingsService.test.d.ts.map +1 -0
  79. package/dist/services/settings/types.d.ts +35 -0
  80. package/dist/services/settings/types.d.ts.map +1 -0
  81. package/dist/services/shop/index.d.ts +3 -0
  82. package/dist/services/shop/index.d.ts.map +1 -0
  83. package/dist/services/shop/shopService.d.ts +12 -0
  84. package/dist/services/shop/shopService.d.ts.map +1 -0
  85. package/dist/services/shop/shopService.test.d.ts +2 -0
  86. package/dist/services/shop/shopService.test.d.ts.map +1 -0
  87. package/dist/services/shop/types.d.ts +7 -0
  88. package/dist/services/shop/types.d.ts.map +1 -0
  89. package/dist/services/subscription/adapter.d.ts +40 -2
  90. package/dist/services/subscription/adapter.d.ts.map +1 -1
  91. package/dist/services/subscription/adapter.test.d.ts +2 -0
  92. package/dist/services/subscription/adapter.test.d.ts.map +1 -0
  93. package/dist/services/subscription/index.d.ts +1 -1
  94. package/dist/services/subscription/index.d.ts.map +1 -1
  95. package/dist/services/subscription/subscriptionService.d.ts +1 -6
  96. package/dist/services/subscription/subscriptionService.d.ts.map +1 -1
  97. package/dist/services/subscription/types.d.ts +186 -9
  98. package/dist/services/subscription/types.d.ts.map +1 -1
  99. package/dist/services/subscription/types.test.d.ts +2 -0
  100. package/dist/services/subscription/types.test.d.ts.map +1 -0
  101. package/dist/theme-state.d.ts +2 -1
  102. package/dist/theme-state.d.ts.map +1 -1
  103. package/dist/theme-state.params.test.d.ts +2 -0
  104. package/dist/theme-state.params.test.d.ts.map +1 -0
  105. package/dist/theme-state.translations.test.d.ts +2 -0
  106. package/dist/theme-state.translations.test.d.ts.map +1 -0
  107. package/dist/utils/index.d.ts +6 -0
  108. package/dist/utils/index.d.ts.map +1 -1
  109. package/dist/vue/block.d.ts.map +1 -1
  110. package/dist/vue.js +23 -3
  111. package/dist/web-components/ExtensionRoot.d.ts +1 -0
  112. package/dist/web-components/ExtensionRoot.d.ts.map +1 -1
  113. package/dist/web-components-editor.js +3 -2
  114. package/dist/web-components-runtime.js +3 -2
  115. package/package.json +3 -2
package/dist/main.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  export type { Block, BlockInstance, BlockDefinition, BlockLocaleFile, BlockRenderer, BlockPreset, BlockPresets, } from './block';
2
- export { attachEmptyTracking, backfillInstanceDefaults, createBlockInstance, createBlockInstanceFromJSON, createBlockInstanceFromObject, createCeRenderer, defineBlock, defineBlockRuntime, getDefinedBlocks, hasRenderedContent, isStubDefinition, withWrapper, registerBlock, SelectedBlockContext, createSelectedBlock, BlockWrapperEvent, serializeBlocks, onRegisterBlock, } from './block';
2
+ export { attachEmptyTracking, backfillInstanceDefaults, createBlockInstance, createBlockInstanceFromJSON, createBlockInstanceFromObject, createCeRenderer, defineBlock, defineBlockRuntime, getDefinedBlocks, hasRenderedContent, isStubDefinition, withWrapper, registerBlock, SelectedBlockContext, createSelectedBlock, BlockWrapperEvent, serializeBlocks, onRegisterBlock, getDevtoolsBlockState, setDevtoolsBlockProp, __recordDevtoolsInstance, __recordDevtoolsPropSetter, } from './block';
3
3
  export { ThemeStateContext, createThemeState, indexOverrides, type TranslationCatalogs, type TranslationMode, type TranslationScope, type TranslationOverride, type ThemeLocaleState, type ThemeState, type ThemeSurface, type ThemeSurfaceState, type GlobalStyles, type GlobalStyleColors, type ThemeType, DEFAULT_GLOBAL_STYLES, } from './theme-state';
4
4
  export { TranslationContext, createTranslationService, type TranslationServiceOptions, type TranslationService, } from './translation';
5
5
  export { ContextRequestEvent, ContextProvideEvent, type ContextCallback, createContext, injectContext, provideContext, subscribeContext, type ContextType, type UnknownContext, } from './context';
6
6
  export { StateContext, createState } from './state';
7
+ export { defineOverlayWrapper, type OverlayLayout } from './overlay-wrapper';
7
8
  export { waitForDevBlocksUrl, loadBlockRegistry } from './registry';
8
9
  export * from './utils';
9
10
  export * from './services';
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,KAAK,EACL,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,WAAW,EACX,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,2BAA2B,EAC3B,6BAA6B,EAC7B,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,eAAe,EACpB,aAAa,EACb,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEpD,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpE,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,MAAM,EACN,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,GACV,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,KAAK,EACL,aAAa,EACb,eAAe,EACf,eAAe,EACf,aAAa,EACb,WAAW,EACX,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,2BAA2B,EAC3B,6BAA6B,EAC7B,gBAAgB,EAChB,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACd,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,eAAe,EACpB,aAAa,EACb,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,KAAK,WAAW,EAChB,KAAK,cAAc,GACpB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAE7E,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEpE,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AAExB,OAAO,EACL,MAAM,EACN,MAAM,EACN,MAAM,EACN,QAAQ,EACR,SAAS,GACV,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { BlockDefinition } from './block';
2
+ /**
3
+ * Layout chrome for an overlay surface. The host (`OverlayHost.vue`) reads this
4
+ * value off the wrapper block's `props.layout` and picks `UiSidebarShell` or
5
+ * `UiModalShell` accordingly — same data-driven pattern `WorkflowOverlay.vue`
6
+ * uses for workflow flow root blocks.
7
+ */
8
+ export type OverlayLayout = "modal" | "sidebar";
9
+ /**
10
+ * Defines a wrapper block for an overlay surface.
11
+ *
12
+ * The overlay surface is rendered by `<juo-extension-root surface="overlay"
13
+ * name="content">`, which reads `blocks[0].slots.content`. That means the
14
+ * surface root must be a *parent* block with a populated `content` slot —
15
+ * resolving an overlay leaf block directly leaves the surface root with
16
+ * empty slots and `juo-extension-root` renders nothing.
17
+ *
18
+ * `defineOverlayWrapper` produces such a parent: a no-render block whose
19
+ * `initialValue` puts a single instance of the `content` block into its
20
+ * `content` slot, mirroring the page-surface pattern (`MainPage.slots.*`).
21
+ *
22
+ * The `layout` opt is forwarded onto the wrapper's `props.layout` and is
23
+ * read by `OverlayHost.vue` to pick the chrome (sidebar vs modal) — same
24
+ * convention `WorkflowOverlay.vue` uses for flow root blocks. Defaults to
25
+ * `"sidebar"` to preserve behavior for callers that omit it.
26
+ *
27
+ * The `canAbort` opt is forwarded onto the wrapper's `props.canAbort` and is
28
+ * read by `OverlayHost.vue` to (a) drive `<UiModalContent :show-close>` so the
29
+ * corner X is present in modal chrome, and (b) gate `handleClose` so backdrop
30
+ * click, Esc, and the chrome X uniformly respect non-dismissable overlays.
31
+ * Defaults to `true`. Same gate `WorkflowOverlay.handleClose` uses.
32
+ *
33
+ * Usage:
34
+ *
35
+ * ```ts
36
+ * const MyFeatureBlock = defineBlock("my_feature", { ...leaf renderer... });
37
+ * const MyFeatureOverlayBlock = defineOverlayWrapper({
38
+ * name: "my_feature_overlay",
39
+ * content: "my_feature",
40
+ * layout: "modal",
41
+ * });
42
+ * registerBlock(MyFeatureBlock);
43
+ * registerBlock(MyFeatureOverlayBlock);
44
+ * ```
45
+ *
46
+ * Then callers open the overlay via:
47
+ *
48
+ * ```ts
49
+ * themeState.$.resolve("overlay", "my_feature_overlay");
50
+ * ```
51
+ *
52
+ * The wrapper's `renderer` is a no-op because `<juo-extension-root>` only
53
+ * reads its slot — the wrapper itself is never rendered as a block.
54
+ *
55
+ * Open-time params: callers may pass JSON-safe params as the 3rd arg to
56
+ * `themeState.resolve("overlay", name, params)`. They are merged onto the
57
+ * wrapper's `content` block instance props (see `theme-state.ts` `resolve`),
58
+ * so the content leaf can read per-open data (e.g. the generic Confirmation
59
+ * block's `action`/`title`/`message`). Never pass callbacks — props cross the
60
+ * render boundary and must stay JSON-safe.
61
+ */
62
+ export declare function defineOverlayWrapper(opts: {
63
+ name: string;
64
+ content: string;
65
+ layout?: OverlayLayout;
66
+ canAbort?: boolean;
67
+ }): BlockDefinition;
68
+ //# sourceMappingURL=overlay-wrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"overlay-wrapper.d.ts","sourceRoot":"","sources":["../src/overlay-wrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,SAAS,CAAC;AAEjB;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;AAyChD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,eAAe,CAclB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=registry.devtools.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.devtools.test.d.ts","sourceRoot":"","sources":["../src/registry.devtools.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,8 @@
1
+ import { Customer } from './types';
2
+ import { ApiFetcher, Result } from '../../utils';
3
+ export interface CustomerAdapter {
4
+ getCurrent(): Promise<Result<Customer | null>>;
5
+ }
6
+ export declare function createMockCustomerAdapter(): CustomerAdapter;
7
+ export declare function createApiCustomerAdapter(fetcher: ApiFetcher): CustomerAdapter;
8
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/services/customer/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,WAAW,eAAe;IAC9B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC;CAChD;AAED,wBAAgB,yBAAyB,IAAI,eAAe,CAO3D;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,UAAU,GAAG,eAAe,CAyB7E"}
@@ -1,6 +1,7 @@
1
- import { ContextType } from '../../context';
1
+ import { CustomerAdapter } from './adapter';
2
2
  import { CustomerService } from './types';
3
3
  type CreateCustomerServiceOptions = {
4
+ adapter: CustomerAdapter;
4
5
  /**
5
6
  * Absolute storefront URL for account / orders (Header `<a href>` + `target="_parent"`).
6
7
  * Called once when the service is created; hosts that need reactivity (portal) update
@@ -8,7 +9,7 @@ type CreateCustomerServiceOptions = {
8
9
  */
9
10
  getAccountOrdersUrl: () => string;
10
11
  };
11
- export declare function createCustomerService(options: CreateCustomerServiceOptions): ContextType<typeof CustomerServiceContext>;
12
+ export declare function createCustomerService(options: CreateCustomerServiceOptions): CustomerService;
12
13
  export declare const CustomerServiceContext: {
13
14
  __context__: CustomerService;
14
15
  };
@@ -1 +1 @@
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
+ {"version":3,"file":"customerService.d.ts","sourceRoot":"","sources":["../../../src/services/customer/customerService.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAY,eAAe,EAAE,MAAM,SAAS,CAAC;AAEzD,KAAK,4BAA4B,GAAG;IAClC,OAAO,EAAE,eAAe,CAAC;IACzB;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,MAAM,CAAC;CACnC,CAAC;AAEF,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,4BAA4B,GACpC,eAAe,CAajB;AAED,eAAO,MAAM,sBAAsB;;CACkB,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export { type CustomerService, type Customer } from './types';
2
2
  export { createCustomerService, CustomerServiceContext, } from './customerService';
3
+ export { type CustomerAdapter, createMockCustomerAdapter, createApiCustomerAdapter, } from './adapter';
3
4
  //# 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;AAC3B,OAAO,EACL,KAAK,eAAe,EACpB,yBAAyB,EACzB,wBAAwB,GACzB,MAAM,WAAW,CAAC"}
@@ -1,12 +1,15 @@
1
1
  import { Signal } from '@preact/signals-core';
2
+ import { Result } from '../../utils';
2
3
  /** Signed-in customer identity for blocks such as Header (name / email display). */
3
4
  export type Customer = {
4
5
  id: string;
5
6
  name: string;
6
- email: string;
7
+ email?: string;
8
+ metadata?: Record<string, unknown>;
7
9
  };
8
10
  export type CustomerService = {
9
11
  current: Signal<Customer | null>;
12
+ getCurrent(): Promise<Result<Customer | null>>;
10
13
  accountOrdersUrl: Signal<string>;
11
14
  };
12
15
  //# 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;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"}
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;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,oFAAoF;AACpF,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IACjC,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC;IAC/C,gBAAgB,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;CAClC,CAAC"}
@@ -3,5 +3,8 @@ export * from './login';
3
3
  export * from './orders';
4
4
  export * from './product';
5
5
  export * from './router';
6
+ export * from './schedules';
7
+ export * from './settings';
8
+ export * from './shop';
6
9
  export * from './subscription';
7
10
  //# sourceMappingURL=index.d.ts.map
@@ -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,gBAAgB,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,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { ApiFetcher, Result } from '../../utils';
2
+ export type AuthTokens = {
3
+ access_token: string;
4
+ refresh_token: string;
5
+ expires_in: number;
6
+ };
7
+ export interface LoginAdapter {
8
+ passwordlessStart(params: {
9
+ email: string;
10
+ lang: string;
11
+ }): Promise<Result<void>>;
12
+ authenticate(params: {
13
+ email: string;
14
+ code: string;
15
+ } | {
16
+ code: string;
17
+ } | {
18
+ refreshToken: string;
19
+ }): Promise<Result<AuthTokens>>;
20
+ getAuthorizeUrl(params: {
21
+ connection: "facebook" | "google-oauth2";
22
+ state: string;
23
+ shop: string;
24
+ appUrl: string;
25
+ }): string;
26
+ }
27
+ export declare function createMockLoginAdapter(): LoginAdapter;
28
+ export declare function createApiLoginAdapter(fetcher: ApiFetcher, opts: {
29
+ shopDomain: string;
30
+ appUrl: string;
31
+ }): LoginAdapter;
32
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/services/login/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGtD,MAAM,MAAM,UAAU,GAAG;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,iBAAiB,CAAC,MAAM,EAAE;QACxB,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAE1B,YAAY,CACV,MAAM,EACF;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAC/B;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAChB;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,GAC3B,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IAE/B,eAAe,CAAC,MAAM,EAAE;QACtB,UAAU,EAAE,UAAU,GAAG,eAAe,CAAC;QACzC,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,MAAM,CAAC;CACZ;AAED,wBAAgB,sBAAsB,IAAI,YAAY,CAuBrD;AAED,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,UAAU,EACnB,IAAI,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC3C,YAAY,CAoHd"}
@@ -13,11 +13,13 @@ type LoginService = {
13
13
  };
14
14
  isAuthenticated: Signal<boolean>;
15
15
  getToken(): Promise<string | null>;
16
+ getAuthHeaders(): Promise<Record<string, string>>;
16
17
  handleQueryParams(query: URLSearchParams): Promise<Result<void, ErrorDetails>>;
17
18
  logout(): Promise<Result>;
18
19
  };
19
20
  export declare const LoginServiceContext: {
20
21
  __context__: LoginService;
21
22
  };
22
- export { loginService, type LoginServiceDependencies, type ErrorFormatter, AuthenticationError, AuthenticationErrorReason, } from './loginService';
23
+ export { loginService, createLoginService, type LoginServiceDependencies, type ErrorFormatter, AuthenticationError, AuthenticationErrorReason, } from './loginService';
24
+ export { type LoginAdapter, type AuthTokens, createApiLoginAdapter, createMockLoginAdapter, } from './adapter';
23
25
  //# 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,EAAE,MAAM,aAAa,CAAC;AAExD,KAAK,YAAY,GAAG;IAClB,YAAY,EAAE;QACZ,KAAK,EAAE;YACL,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;YAC1D,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC;SAC1E,CAAC;KACH,CAAC;IAEF,MAAM,EAAE;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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services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C;AAExB,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,WAAW,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { Signal } from '@preact/signals-core';
2
+ import { LoginAdapter } from './adapter';
2
3
  export declare enum AuthenticationErrorReason {
3
4
  Expired = "expired",
4
5
  IncorrectCode = "wrong-code",
@@ -28,14 +29,15 @@ export type ErrorFormatter = (error: unknown | AuthenticationError) => {
28
29
  message: string;
29
30
  };
30
31
  export interface LoginServiceDependencies {
31
- apiUrl: string;
32
+ adapter: LoginAdapter;
32
33
  formatError: ErrorFormatter;
33
34
  router: RouterService;
34
35
  shop: ShopService;
35
36
  onLoginSuccess?: () => Promise<void>;
36
37
  }
37
38
  /**
38
- * @deprecated Use `createLoginService` instead
39
+ * @deprecated Use `createLoginService` instead.
40
+ * Constructs a real API adapter from `shop.rootUrl` for backward compatibility.
39
41
  */
40
42
  export declare function loginService(deps: {
41
43
  formatError: ErrorFormatter;
@@ -59,6 +61,7 @@ export declare function loginService(deps: {
59
61
  };
60
62
  isAuthenticated: Signal<boolean>;
61
63
  getToken(): Promise<string | null>;
64
+ getAuthHeaders(): Promise<Record<string, string>>;
62
65
  handleQueryParams(query: URLSearchParams): Promise<import('../../utils').Result<void, import('../../utils').ErrorDetails>>;
63
66
  logout(): Promise<import('../../utils').Result>;
64
67
  };
@@ -75,6 +78,7 @@ export declare function createLoginService(init: LoginServiceDependencies): {
75
78
  };
76
79
  isAuthenticated: Signal<boolean>;
77
80
  getToken(): Promise<string | null>;
81
+ getAuthHeaders(): Promise<Record<string, string>>;
78
82
  handleQueryParams(query: URLSearchParams): Promise<import('../../utils').Result<void, import('../../utils').ErrorDetails>>;
79
83
  logout(): Promise<import('../../utils').Result>;
80
84
  };
@@ -1 +1 @@
1
- {"version":3,"file":"loginService.d.ts","sourceRoot":"","sources":["../../../src/services/login/loginService.ts"],"names":[],"mappings":"AAEA,OAAO,EAA4B,MAAM,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rE,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,YAAY,CAAC;IACtB,WAAW,EAAE,cAAc,CAAC;IAC5B,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,EAAE,WAAW,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE;IACjC,WAAW,EAAE,cAAc,CAAC;IAC5B,SAAS,EAAE,MAAM,MAAM,CAAC;IACxB,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;;;;;;;;;;;;;;;;EAmBA;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,wBAAwB;;;;;;;;;;;;;;;;EAmNhE"}
@@ -0,0 +1,9 @@
1
+ import { Order } from './types';
2
+ import { ApiFetcher, Result } from '../../utils';
3
+ export interface OrderAdapter {
4
+ getHistory(): Promise<Result<Order[]>>;
5
+ getById(id: string): Promise<Result<Order | null>>;
6
+ }
7
+ export declare function createMockOrderAdapter(): OrderAdapter;
8
+ export declare function createApiOrderAdapter(fetcher: ApiFetcher): OrderAdapter;
9
+ //# sourceMappingURL=adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/services/order/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAa,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,WAAW,YAAY;IAC3B,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACvC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;CACpD;AA+BD,wBAAgB,sBAAsB,IAAI,YAAY,CAiCrD;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,UAAU,GAAG,YAAY,CA2BvE"}
@@ -0,0 +1,5 @@
1
+ export type { OrderAdapter } from './adapter';
2
+ export { createMockOrderAdapter, createApiOrderAdapter } from './adapter';
3
+ export { createOrderService, OrderServiceContext } from './orderService';
4
+ export * from './types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/order/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACzE,cAAc,SAAS,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { OrderAdapter } from './adapter';
2
+ import { OrderService } from './types';
3
+ export declare const OrderServiceContext: {
4
+ __context__: OrderService;
5
+ };
6
+ export declare function createOrderService(adapter: OrderAdapter): OrderService;
7
+ //# sourceMappingURL=orderService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orderService.d.ts","sourceRoot":"","sources":["../../../src/services/order/orderService.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,mBAAmB;;CAAgD,CAAC;AAEjF,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,YAAY,GAAG,YAAY,CAKtE"}
@@ -0,0 +1,21 @@
1
+ import { Result } from '../../utils';
2
+ export interface OrderItem {
3
+ id: string;
4
+ productId: string;
5
+ variantId: string;
6
+ quantity: number;
7
+ metadata?: Record<string, unknown>;
8
+ }
9
+ export interface Order {
10
+ id: string;
11
+ customerId: string;
12
+ items: OrderItem[];
13
+ deliveryDate: string | null;
14
+ status: "pending" | "confirmed" | "delivered" | "skipped";
15
+ metadata?: Record<string, unknown>;
16
+ }
17
+ export type OrderService = {
18
+ getHistory(): Promise<Result<Order[]>>;
19
+ getById(id: string): Promise<Result<Order | null>>;
20
+ };
21
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/order/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,WAAW,GAAG,SAAS,CAAC;IAC1D,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IACvC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC;CACpD,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { OrdersAdapter } from './types';
2
2
  /**
3
- * Returns an empty `OrdersAdapter` shape. Hosts override the methods to seed real fixtures.
3
+ * Returns a mock `OrdersAdapter` with sample orders including customAttributes.
4
+ * Hosts can override the methods to seed real fixtures.
4
5
  * Used as a starting point by storybook helpers (`createMockOrdersService`) and theme preview.
5
6
  */
6
7
  export declare function createMockOrdersAdapter(): OrdersAdapter;
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/services/orders/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,aAAa,CAcvD"}
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../src/services/orders/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,aAAa,EAAE,MAAM,SAAS,CAAC;AAEpD;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,aAAa,CA6DvD"}
@@ -4,6 +4,10 @@ export interface OrderLine {
4
4
  title: string;
5
5
  quantity: number;
6
6
  variantImage: Image | null;
7
+ customAttributes?: Array<{
8
+ key: string;
9
+ value: string;
10
+ }>;
7
11
  }
8
12
  export interface Order {
9
13
  /** Numeric Shopify order id (the trailing segment of the order GID). The block prepends `#` for display. */
@@ -17,6 +21,10 @@ export interface Order {
17
21
  /** Raw Shopify fulfillment-status token (e.g. `FULFILLED`, `PARTIALLY_FULFILLED`); the block humanizes it for display. `null` = unknown. */
18
22
  fulfillmentStatus: string | null;
19
23
  lines: OrderLine[];
24
+ customAttributes?: Array<{
25
+ key: string;
26
+ value: string;
27
+ }>;
20
28
  }
21
29
  export interface GetOrdersParams {
22
30
  limit?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/services/orders/types.ts"],"names":[],"mappings":"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AAM,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;CACpE;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,CACP,MAAM,CAAC,EAAE,eAAe,GACvB,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;CAC1C"}
@@ -1,5 +1,5 @@
1
- import { PaginatedList } from '../../utils';
2
- import { Product, WithVariants } from './types';
1
+ import { ApiFetcher, PaginatedList } from '../../utils';
2
+ import { AvailableProduct, Box, Product, WithVariants } from './types';
3
3
  /**
4
4
  * Adapter interface for product operations.
5
5
  * Implementations should handle API calls, error handling, and data transformation.
@@ -15,6 +15,31 @@ export interface ProductAdapter {
15
15
  after: string;
16
16
  };
17
17
  }): Promise<PaginatedList<WithVariants<Product>>>;
18
+ getProductsByIds(params: {
19
+ ids: string[];
20
+ }): Promise<Product[]>;
21
+ getBoxVariants(params: {
22
+ ids: string[];
23
+ subscriptionId: string;
24
+ }): Promise<AvailableProduct[]>;
25
+ getAvailableProducts(params: {
26
+ subscriptionId: string;
27
+ lineId: string;
28
+ q?: string;
29
+ mode?: "same-product" | "other-products";
30
+ action: "swap" | "add";
31
+ pagination?: {
32
+ before: string;
33
+ } | {
34
+ after: string;
35
+ };
36
+ }): Promise<AvailableProduct[]>;
37
+ getBox(params: {
38
+ id: string;
39
+ }): Promise<Box | null>;
18
40
  }
19
41
  export declare function createMockProductAdapter(): ProductAdapter;
42
+ export declare function createApiProductAdapter(fetcher: ApiFetcher, opts?: {
43
+ currencyCode: string;
44
+ }): ProductAdapter;
20
45
  //# 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,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,OAAO,EAAkB,YAAY,EAAE,MAAM,S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D,GAAG,OAAO,CAAC,aAAa,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAElD,gBAAgB,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAEhE,cAAc,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,EAAE,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAE/F,oBAAoB,CAAC,MAAM,EAAE;QAC3B,cAAc,EAAE,MAAM,CAAC;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,IAAI,CAAC,EAAE,cAAc,GAAG,gBAAgB,CAAC;QACzC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;QACvB,UAAU,CAAC,EAAE;YAAE,MAAM,EAAE,MAAM,CAAA;SAAE,GAAG;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAC;KACrD,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAEhC,MAAM,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;CACrD;AAED,wBAAgB,wBAAwB,IAAI,cAAc,CAkNzD;AAoED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,UAAU,EACnB,IAAI,GAAE;IAAE,YAAY,EAAE,MAAM,CAAA;CAA4B,GACvD,cAAc,CA4JhB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=adapter.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter.test.d.ts","sourceRoot":"","sources":["../../../src/services/product/adapter.test.ts"],"names":[],"mappings":""}
@@ -1,5 +1,5 @@
1
1
  export type { ProductAdapter } from './adapter';
2
- export { createMockProductAdapter } from './adapter';
2
+ export { createMockProductAdapter, createApiProductAdapter } 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,MAAM,WAAW,CAAC;AAErD,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE/E,cAAc,SAAS,CAAC"}
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,uBAAuB,EAAE,MAAM,WAAW,CAAC;AAE9E,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAE/E,cAAc,SAAS,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"productService.d.ts","sourceRoot":"","sources":["../../../src/services/product/productService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,qBAAqB;;CACiB,CAAC;AAGpD;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,cAAc,GACtB,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAiB3C"}
1
+ {"version":3,"file":"productService.d.ts","sourceRoot":"","sources":["../../../src/services/product/productService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAiB,MAAM,eAAe,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,qBAAqB;;CACiB,CAAC;AAGpD;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,cAAc,GACtB,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAsB3C"}
@@ -1,4 +1,33 @@
1
1
  import { Image, PaginatedList, PriceWithCurrency } from '../../utils';
2
+ export interface AvailableProductVariant {
3
+ id: string;
4
+ availableForSale: boolean;
5
+ title: string;
6
+ currentPrice: {
7
+ amount: number;
8
+ currencyCode: string;
9
+ };
10
+ basePrice: {
11
+ amount: number;
12
+ currencyCode: string;
13
+ };
14
+ image?: {
15
+ url: string;
16
+ altText?: string;
17
+ };
18
+ recurring?: boolean;
19
+ }
20
+ export interface AvailableProduct {
21
+ id: string;
22
+ title: string;
23
+ description: string;
24
+ featuredImage?: {
25
+ url: string;
26
+ altText?: string;
27
+ };
28
+ hasOnlyDefaultVariant: boolean;
29
+ variants: AvailableProductVariant[];
30
+ }
2
31
  export interface Product {
3
32
  id: string;
4
33
  title: string;
@@ -7,6 +36,7 @@ export interface Product {
7
36
  collections: {
8
37
  handle: string;
9
38
  }[];
39
+ metadata?: Record<string, unknown>;
10
40
  }
11
41
  export interface PurchaseOption {
12
42
  name: string;
@@ -23,10 +53,33 @@ export interface ProductVariant {
23
53
  price: PriceWithCurrency;
24
54
  subscriptionPrice?: PriceWithCurrency;
25
55
  purchaseOptions?: PurchaseOption[];
56
+ metadata?: Record<string, unknown>;
26
57
  }
27
58
  export type WithVariants<T> = T & {
28
59
  variants: PaginatedList<ProductVariant>;
29
60
  };
61
+ export interface BoxTier {
62
+ value: number;
63
+ threshold: number;
64
+ }
65
+ export interface BoxVariantGroup {
66
+ id: string;
67
+ variants: {
68
+ id: string;
69
+ }[];
70
+ }
71
+ export interface Box {
72
+ id: string;
73
+ title: string;
74
+ minProductsCount: number;
75
+ parentProduct: string;
76
+ tiers: BoxTier[];
77
+ variants: BoxVariantGroup[];
78
+ freeVariants: BoxVariantGroup[];
79
+ thresholdType: "LINES_COUNT" | "CART_TOTAL";
80
+ type: "FIXED_AMOUNT" | "PERCENTAGE" | "PRICE";
81
+ restrictQuantityToTiers: boolean;
82
+ }
30
83
  export type ProductService<T extends WithVariants<Product> = WithVariants<Product>> = {
31
84
  getById(id: string): Promise<T | null>;
32
85
  getByVariantId(variantId: string): Promise<T | null>;
@@ -38,5 +91,20 @@ export type ProductService<T extends WithVariants<Product> = WithVariants<Produc
38
91
  after: string;
39
92
  };
40
93
  }): Promise<PaginatedList<T>>;
94
+ getProductsByIds(ids: string[]): Promise<Product[]>;
95
+ getBoxVariants(ids: string[], subscriptionId: string): Promise<AvailableProduct[]>;
96
+ getAvailableProducts(params: {
97
+ subscriptionId: string;
98
+ lineId: string;
99
+ q?: string;
100
+ mode?: "same-product" | "other-products";
101
+ action: "swap" | "add";
102
+ pagination?: {
103
+ before: string;
104
+ } | {
105
+ after: string;
106
+ };
107
+ }): Promise<AvailableProduct[]>;
108
+ getBox(id: string): Promise<Box | null>;
41
109
  };
42
110
  //# sourceMappingURL=types.d.ts.map
@@ -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;CACnC;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,iBAAiB,CAAC;IAC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