@juo/orion-core 0.15.0 → 0.17.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.
@@ -5,8 +5,8 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  import { signal, effect, createBlockInstance } from "@juo/orion-core";
8
- import { d, j as withWrapper, t as subscribeContext, T as ThemeStateContext, E, v as n } from "./theme-state-CVjQY7tL.js";
9
- import "./juo-workflow-CtdYqg0V.js";
8
+ import { d, j as withWrapper, t as subscribeContext, T as ThemeStateContext, E, v as n } from "./theme-state-D4n_2n_h.js";
9
+ import "./juo-workflow-ComG9rLp.js";
10
10
  class Block extends HTMLElement {
11
11
  constructor() {
12
12
  super();
@@ -2,7 +2,7 @@ function isEditorMessage(message) {
2
2
  return message.type === "PROVIDE_THEME_STATE" || message.type === "PROVIDE_TRANSLATION_OVERRIDES" || message.type === "SELECT_BLOCK" || message.type === "UPDATE_BLOCK_PROPS" || message.type === "ADD_BLOCK" || message.type === "REMOVE_BLOCK" || message.type === "MOVE_BLOCK" || message.type === "SET_BLOCK_PRESET" || message.type === "SET_LOCALE" || message.type === "SET_GLOBAL_STYLES" || message.type === "PROVIDE_GLOBAL_STYLES" || message.type === "SCROLL_SYNC" || message.type === "REQUEST_CONTENT_HEIGHT";
3
3
  }
4
4
  function isIframeMessage(message) {
5
- return message.type === "SELECT_BLOCK" || message.type === "IFRAME_READY" || message.type === "REGISTER_BLOCKS" || message.type === "REGISTER_ROUTES" || message.type === "REMOVE_BLOCK" || message.type === "UPDATE_BLOCK_PROPS" || message.type === "REQUEST_THEME_STATE" || message.type === "REQUEST_TRANSLATION_OVERRIDES" || message.type === "UPDATE_BLOCK_TRANSLATION" || message.type === "FOCUS_INLINE_TEXT" || message.type === "REQUEST_GLOBAL_STYLES" || message.type === "REPORT_CONTENT_HEIGHT" || message.type === "SCROLL_SYNC";
5
+ return message.type === "SELECT_BLOCK" || message.type === "IFRAME_READY" || message.type === "REGISTER_BLOCKS" || message.type === "REGISTER_ROUTES" || message.type === "REMOVE_BLOCK" || message.type === "UPDATE_BLOCK_PROPS" || message.type === "REQUEST_THEME_STATE" || message.type === "REQUEST_TRANSLATION_OVERRIDES" || message.type === "UPDATE_BLOCK_TRANSLATION" || message.type === "FOCUS_INLINE_TEXT" || message.type === "REQUEST_GLOBAL_STYLES" || message.type === "PROVIDE_INITIAL_GLOBAL_STYLES" || message.type === "REPORT_CONTENT_HEIGHT" || message.type === "SCROLL_SYNC";
6
6
  }
7
7
  function createProvideThemeStateMessage(payload) {
8
8
  return {
@@ -146,6 +146,13 @@ function createProvideGlobalStylesMessage(payload) {
146
146
  timestamp: Date.now()
147
147
  };
148
148
  }
149
+ function createProvideInitialGlobalStylesMessage(payload) {
150
+ return {
151
+ type: "PROVIDE_INITIAL_GLOBAL_STYLES",
152
+ payload,
153
+ timestamp: Date.now()
154
+ };
155
+ }
149
156
  function createScrollSyncMessage(payload) {
150
157
  return {
151
158
  type: "SCROLL_SYNC",
@@ -472,7 +479,8 @@ export {
472
479
  createSetGlobalStylesMessage as s,
473
480
  createRequestGlobalStylesMessage as t,
474
481
  createProvideGlobalStylesMessage as u,
475
- createScrollSyncMessage as v,
476
- createReportContentHeightMessage as w,
477
- getEditorBridge as x
482
+ createProvideInitialGlobalStylesMessage as v,
483
+ createScrollSyncMessage as w,
484
+ createReportContentHeightMessage as x,
485
+ getEditorBridge as y
478
486
  };
package/dist/core.js CHANGED
@@ -4,9 +4,9 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { c as createContext, d, w, E, u } from "./theme-state-CVjQY7tL.js";
8
- import { B, n, C, D, S, T, a, b, e, f, k, l, g, h, i, m, p, o, q, r, s, t, v, j } from "./theme-state-CVjQY7tL.js";
9
- import { T as T2, W, c, b as b2, a as a2, g as g2, h as h2 } from "./juo-workflow-CtdYqg0V.js";
7
+ import { c as createContext, d, w, E, u } from "./theme-state-D4n_2n_h.js";
8
+ import { B, n, C, D, S, T, a, b, e, f, k, l, g, h, i, m, p, o, q, r, s, t, v, j } from "./theme-state-D4n_2n_h.js";
9
+ import { T as T2, W, c, b as b2, a as a2, g as g2, h as h2 } from "./juo-workflow-ComG9rLp.js";
10
10
  function createState() {
11
11
  const discountCode = d(null);
12
12
  const products = d([]);
@@ -792,6 +792,37 @@ function createMockSubscriptionAdapter() {
792
792
  discounts: subscription.discounts.map((discount) => ({ ...discount }))
793
793
  }
794
794
  };
795
+ },
796
+ async getAvailablePlans() {
797
+ await new Promise((resolve) => setTimeout(resolve, 300));
798
+ return {
799
+ _tag: "Success",
800
+ data: [
801
+ {
802
+ id: "plan_1",
803
+ name: "Monthly",
804
+ billingPolicy: { intervalCount: 1, interval: "MONTH" },
805
+ deliveryPolicy: { intervalCount: 1, interval: "MONTH" }
806
+ },
807
+ {
808
+ id: "plan_2",
809
+ name: "Every 2 months",
810
+ billingPolicy: { intervalCount: 2, interval: "MONTH" },
811
+ deliveryPolicy: { intervalCount: 2, interval: "MONTH" }
812
+ },
813
+ {
814
+ id: "plan_3",
815
+ name: "Every 3 months",
816
+ billingPolicy: { intervalCount: 3, interval: "MONTH" },
817
+ deliveryPolicy: { intervalCount: 3, interval: "MONTH" }
818
+ }
819
+ ]
820
+ };
821
+ },
822
+ async getDefaultSubscriptionId() {
823
+ var _a;
824
+ await new Promise((resolve) => setTimeout(resolve, 300));
825
+ return { _tag: "Success", data: ((_a = mockSubscriptions[0]) == null ? void 0 : _a.id) ?? null };
795
826
  }
796
827
  };
797
828
  }
@@ -828,7 +859,9 @@ function createSubscriptionService(adapter) {
828
859
  resume: (subscriptionId) => adapter.resume({ subscriptionId }),
829
860
  pause: (subscriptionId) => adapter.pause({ subscriptionId }),
830
861
  reactivate: (subscriptionId) => adapter.reactivate({ subscriptionId }),
831
- cancel: (subscriptionId, reason) => adapter.cancel({ subscriptionId, reason })
862
+ cancel: (subscriptionId, reason) => adapter.cancel({ subscriptionId, reason }),
863
+ getAvailablePlans: (subscriptionId) => adapter.getAvailablePlans({ subscriptionId }),
864
+ getDefaultSubscriptionId: () => adapter.getDefaultSubscriptionId()
832
865
  };
833
866
  }
834
867
  const MOCK_FLOWS = {
@@ -1,6 +1,6 @@
1
1
  import { Block, BlockPresets } from '../block';
2
2
  import { GlobalStyles, ThemeSurface, TranslationOverride } from '../theme-state';
3
- export type MessageType = "PROVIDE_THEME_STATE" | "SELECT_BLOCK" | "UPDATE_BLOCK_PROPS" | "ADD_BLOCK" | "REMOVE_BLOCK" | "MOVE_BLOCK" | "IFRAME_READY" | "REGISTER_BLOCKS" | "REGISTER_ROUTES" | "SET_BLOCK_PRESET" | "SET_LOCALE" | "REQUEST_THEME_STATE" | "REQUEST_TRANSLATION_OVERRIDES" | "PROVIDE_TRANSLATION_OVERRIDES" | "UPDATE_BLOCK_TRANSLATION" | "FOCUS_INLINE_TEXT" | "SET_GLOBAL_STYLES" | "REQUEST_GLOBAL_STYLES" | "PROVIDE_GLOBAL_STYLES" | "SCROLL_SYNC" | "REPORT_CONTENT_HEIGHT" | "REQUEST_CONTENT_HEIGHT";
3
+ export type MessageType = "PROVIDE_THEME_STATE" | "SELECT_BLOCK" | "UPDATE_BLOCK_PROPS" | "ADD_BLOCK" | "REMOVE_BLOCK" | "MOVE_BLOCK" | "IFRAME_READY" | "REGISTER_BLOCKS" | "REGISTER_ROUTES" | "SET_BLOCK_PRESET" | "SET_LOCALE" | "REQUEST_THEME_STATE" | "REQUEST_TRANSLATION_OVERRIDES" | "PROVIDE_TRANSLATION_OVERRIDES" | "UPDATE_BLOCK_TRANSLATION" | "FOCUS_INLINE_TEXT" | "SET_GLOBAL_STYLES" | "REQUEST_GLOBAL_STYLES" | "PROVIDE_GLOBAL_STYLES" | "PROVIDE_INITIAL_GLOBAL_STYLES" | "SCROLL_SYNC" | "REPORT_CONTENT_HEIGHT" | "REQUEST_CONTENT_HEIGHT";
4
4
  export interface BaseMessage {
5
5
  type: MessageType;
6
6
  timestamp: number;
@@ -170,8 +170,14 @@ export interface ProvideGlobalStylesMessage extends BaseMessage {
170
170
  styles: GlobalStyles;
171
171
  };
172
172
  }
173
+ export interface ProvideInitialGlobalStylesMessage extends BaseMessage {
174
+ type: "PROVIDE_INITIAL_GLOBAL_STYLES";
175
+ payload: {
176
+ styles: GlobalStyles;
177
+ };
178
+ }
173
179
  export type EditorMessage = ProvideThemeStateMessage | ProvideTranslationOverridesMessage | SelectBlockMessage | UpdateBlockPropsMessage | AddBlockMessage | RemoveBlockMessage | MoveBlockMessage | SetBlockPresetMessage | SetLocaleMessage | SetGlobalStylesMessage | ProvideGlobalStylesMessage | ScrollSyncMessage | RequestContentHeightMessage;
174
- export type IframeMessage = SelectBlockMessage | IframeReadyMessage | RegisterBlocksMessage | RegisterRoutesMessage | RemoveBlockMessage | UpdateBlockPropsMessage | RequestThemeStateMessage | RequestTranslationOverridesMessage | UpdateBlockTranslationMessage | FocusInlineTextMessage | RequestGlobalStylesMessage | ReportContentHeightMessage | ScrollSyncMessage;
180
+ export type IframeMessage = SelectBlockMessage | IframeReadyMessage | RegisterBlocksMessage | RegisterRoutesMessage | RemoveBlockMessage | UpdateBlockPropsMessage | RequestThemeStateMessage | RequestTranslationOverridesMessage | UpdateBlockTranslationMessage | FocusInlineTextMessage | RequestGlobalStylesMessage | ProvideInitialGlobalStylesMessage | ReportContentHeightMessage | ScrollSyncMessage;
175
181
  export type AnyMessage = EditorMessage | IframeMessage;
176
182
  export declare function isEditorMessage(message: AnyMessage): message is EditorMessage;
177
183
  export declare function isIframeMessage(message: AnyMessage): message is IframeMessage;
@@ -209,5 +215,6 @@ export interface RequestContentHeightMessage extends BaseMessage {
209
215
  payload: Record<string, never>;
210
216
  }
211
217
  export declare function createProvideGlobalStylesMessage(payload: ProvideGlobalStylesMessage["payload"]): ProvideGlobalStylesMessage;
218
+ export declare function createProvideInitialGlobalStylesMessage(payload: ProvideInitialGlobalStylesMessage["payload"]): ProvideInitialGlobalStylesMessage;
212
219
  export declare function createScrollSyncMessage(payload: ScrollSyncMessage["payload"]): ScrollSyncMessage;
213
220
  export declare function createReportContentHeightMessage(payload: ReportContentHeightMessage["payload"]): ReportContentHeightMessage;
package/dist/editor.js CHANGED
@@ -5,9 +5,9 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  import { getDefinedBlocks, onRegisterBlock } from "@juo/orion-core";
8
- import { c as createEditorBridge, d as createRemoveBlockMessage, e as createRegisterBlocksMessage, f as createRegisterRoutesMessage } from "./bridge-DjBr4DlY.js";
9
- import { o, a, p, u, h, l, w, t, j, k, v, m, q, s, r, n, b, x, i, g } from "./bridge-DjBr4DlY.js";
10
- import { e as createBlockInstanceFromObject, m as indexOverrides } from "./theme-state-CVjQY7tL.js";
8
+ import { c as createEditorBridge, d as createRemoveBlockMessage, e as createRegisterBlocksMessage, f as createRegisterRoutesMessage } from "./bridge-D-0V6_BT.js";
9
+ import { o, a, p, u, v, h, l, x, t, j, k, w, m, q, s, r, n, b, y, i, g } from "./bridge-D-0V6_BT.js";
10
+ import { e as createBlockInstanceFromObject, m as indexOverrides } from "./theme-state-D4n_2n_h.js";
11
11
  function createEditorHandler(options) {
12
12
  const { themeState, onBlockSelection } = options;
13
13
  const blockSurfaceIndex = /* @__PURE__ */ new Map();
@@ -669,23 +669,24 @@ export {
669
669
  a as createFocusInlineTextMessage,
670
670
  p as createMoveBlockMessage,
671
671
  u as createProvideGlobalStylesMessage,
672
+ v as createProvideInitialGlobalStylesMessage,
672
673
  h as createProvideThemeStateMessage,
673
674
  l as createProvideTranslationOverridesMessage,
674
675
  createRegisterBlocksMessage,
675
676
  createRegisterRoutesMessage,
676
677
  createRemoveBlockMessage,
677
- w as createReportContentHeightMessage,
678
+ x as createReportContentHeightMessage,
678
679
  t as createRequestGlobalStylesMessage,
679
680
  j as createRequestThemeStateMessage,
680
681
  k as createRequestTranslationOverridesMessage,
681
- v as createScrollSyncMessage,
682
+ w as createScrollSyncMessage,
682
683
  m as createSelectBlockMessage,
683
684
  q as createSetBlockPresetMessage,
684
685
  s as createSetGlobalStylesMessage,
685
686
  r as createSetLocaleMessage,
686
687
  n as createUpdateBlockPropsMessage,
687
688
  b as createUpdateBlockTranslationMessage,
688
- x as getEditorBridge,
689
+ y as getEditorBridge,
689
690
  i as isEditorMessage,
690
691
  g as isIframeMessage,
691
692
  setupEditorMode
@@ -4,8 +4,8 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { c as createContext, d, E, i as getDefinedBlocks, a as createBlockInstance, w, r as registerBlock, g as defineBlock, t as subscribeContext } from "./theme-state-CVjQY7tL.js";
8
- import { c as createEditorBridge } from "./bridge-DjBr4DlY.js";
7
+ import { c as createContext, d, E, i as getDefinedBlocks, a as createBlockInstance, w, r as registerBlock, g as defineBlock, t as subscribeContext } from "./theme-state-D4n_2n_h.js";
8
+ import { c as createEditorBridge } from "./bridge-D-0V6_BT.js";
9
9
  const TranslationContext = createContext("translation");
10
10
  function toStringRecord(input) {
11
11
  if (input == null)
package/dist/preact.js CHANGED
@@ -9,7 +9,7 @@ import { useState, useRef, useEffect, useContext as useContext$1, useMemo } from
9
9
  import { g as getSignalValue, s as setSignalValue, w as wrapContext, c as createSlotChildren } from "./block-DPjf_G7G.js";
10
10
  import { t } from "./block-DPjf_G7G.js";
11
11
  import { createContext, h, render } from "preact";
12
- import { c as createEditorBridge } from "./bridge-DjBr4DlY.js";
12
+ import { c as createEditorBridge } from "./bridge-D-0V6_BT.js";
13
13
  function toState(signal) {
14
14
  const [value, setValue] = useState(() => getSignalValue(signal));
15
15
  const disposeRef = useRef(null);
package/dist/react.js CHANGED
@@ -9,7 +9,7 @@ import React, { useSyncExternalStore, createContext, useState, useContext as use
9
9
  import { g as getSignalValue, s as setSignalValue, w as wrapContext, c as createSlotChildren } from "./block-DPjf_G7G.js";
10
10
  import { t } from "./block-DPjf_G7G.js";
11
11
  import { createRoot } from "react-dom/client";
12
- import { c as createEditorBridge } from "./bridge-DjBr4DlY.js";
12
+ import { c as createEditorBridge } from "./bridge-D-0V6_BT.js";
13
13
  function toState(signal) {
14
14
  const subscribe = (callback) => {
15
15
  const dispose = effect(() => {
@@ -1,4 +1,4 @@
1
- import { Subscription, SearchOptions, PostableSubscriptionItem } from './types';
1
+ import { Subscription, SellingPlan, SearchOptions, PostableSubscriptionItem } from './types';
2
2
  import { Result, PaginatedList } from '../../utils';
3
3
  /**
4
4
  * Adapter interface for subscription.
@@ -40,5 +40,9 @@ export interface SubscriptionAdapter {
40
40
  subscriptionId: string;
41
41
  reason?: string;
42
42
  }): Promise<Result<Subscription>>;
43
+ getAvailablePlans(params: {
44
+ subscriptionId: string;
45
+ }): Promise<Result<SellingPlan[]>>;
46
+ getDefaultSubscriptionId(): Promise<Result<string | null>>;
43
47
  }
44
48
  export declare function createMockSubscriptionAdapter(): SubscriptionAdapter;
@@ -29,6 +29,16 @@ export interface Subscription {
29
29
  updatedAt: string;
30
30
  customerId: string;
31
31
  }
32
+ export interface SellingPlanInterval {
33
+ intervalCount: number;
34
+ interval: string;
35
+ }
36
+ export interface SellingPlan {
37
+ id: string;
38
+ name: string;
39
+ billingPolicy: SellingPlanInterval;
40
+ deliveryPolicy: SellingPlanInterval;
41
+ }
32
42
  export interface SubscriptionFilter {
33
43
  id?: string;
34
44
  serial?: string;
@@ -60,4 +70,6 @@ export type SubscriptionService = {
60
70
  pause(subscriptionId: string): Promise<Result<Subscription>>;
61
71
  reactivate(subscriptionId: string): Promise<Result<Subscription>>;
62
72
  cancel(subscriptionId: string, reason?: string): Promise<Result<Subscription>>;
73
+ getAvailablePlans(subscriptionId: string): Promise<Result<SellingPlan[]>>;
74
+ getDefaultSubscriptionId(): Promise<Result<string | null>>;
63
75
  };
@@ -737,7 +737,7 @@ const DEFAULT_GLOBAL_STYLES = {
737
737
  colors: {
738
738
  accent: "#000000",
739
739
  secondary: "#000000",
740
- tint: "#FFFFFF",
740
+ tint: "#111111",
741
741
  callout: "#F5F5F5",
742
742
  success: "#287a25",
743
743
  error: "#a93c3c",
package/dist/vue.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { toValue, watchEffect, customRef, defineComponent, ref, getCurrentInstance, onMounted, provide, h, renderSlot, inject, computed, createApp, useHost, defineCustomElement } from "vue";
2
2
  import { signal, effect, injectContext, provideContext, createCeRenderer } from "@juo/orion-core";
3
- import { c as createEditorBridge } from "./bridge-DjBr4DlY.js";
3
+ import { c as createEditorBridge } from "./bridge-D-0V6_BT.js";
4
4
  const signalsMap = /* @__PURE__ */ new WeakMap();
5
5
  function toSignal(ref2) {
6
6
  if (!signalsMap.has(ref2)) {
@@ -4,10 +4,10 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { p as injectContext, E, x as ContextRoot } from "./theme-state-CVjQY7tL.js";
8
- import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-B3VZYOFl.js";
9
- import { c as createEditorBridge, a as createFocusInlineTextMessage, b as createUpdateBlockTranslationMessage } from "./bridge-DjBr4DlY.js";
10
- import { T as TranslationContext } from "./juo-workflow-CtdYqg0V.js";
7
+ import { p as injectContext, E, x as ContextRoot } from "./theme-state-D4n_2n_h.js";
8
+ import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-Cy6c9p75.js";
9
+ import { c as createEditorBridge, a as createFocusInlineTextMessage, b as createUpdateBlockTranslationMessage } from "./bridge-D-0V6_BT.js";
10
+ import { T as TranslationContext } from "./juo-workflow-ComG9rLp.js";
11
11
  const _InlineText = class _InlineText extends HTMLElement {
12
12
  constructor() {
13
13
  super();
@@ -4,9 +4,9 @@ var __publicField = (obj, key, value) => {
4
4
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  return value;
6
6
  };
7
- import { p as injectContext, E, x as ContextRoot } from "./theme-state-CVjQY7tL.js";
8
- import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-B3VZYOFl.js";
9
- import { T as TranslationContext } from "./juo-workflow-CtdYqg0V.js";
7
+ import { p as injectContext, E, x as ContextRoot } from "./theme-state-D4n_2n_h.js";
8
+ import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-Cy6c9p75.js";
9
+ import { T as TranslationContext } from "./juo-workflow-ComG9rLp.js";
10
10
  class InlineText extends HTMLElement {
11
11
  constructor() {
12
12
  super(...arguments);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@juo/orion-core",
3
3
  "private": false,
4
- "version": "0.15.0",
4
+ "version": "0.17.0",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"