@juo/orion-core 0.16.0 → 0.17.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.
- package/dist/{ExtensionRoot-Cy6c9p75.js → ExtensionRoot-BifGkf1W.js} +1 -1
- package/dist/core.js +35 -2
- package/dist/flows/WorkflowService.d.ts +2 -0
- package/dist/{juo-workflow-ComG9rLp.js → juo-workflow-CtWyuHD6.js} +2 -1
- package/dist/services/subscription/adapter.d.ts +5 -1
- package/dist/services/subscription/types.d.ts +12 -0
- package/dist/web-components-editor.js +2 -2
- package/dist/web-components-runtime.js +2 -2
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
import { signal, effect, createBlockInstance } from "@juo/orion-core";
|
|
8
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-
|
|
9
|
+
import "./juo-workflow-CtWyuHD6.js";
|
|
10
10
|
class Block extends HTMLElement {
|
|
11
11
|
constructor() {
|
|
12
12
|
super();
|
package/dist/core.js
CHANGED
|
@@ -6,7 +6,7 @@ var __publicField = (obj, key, value) => {
|
|
|
6
6
|
};
|
|
7
7
|
import { c as createContext, d, w, E, u } from "./theme-state-D4n_2n_h.js";
|
|
8
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-
|
|
9
|
+
import { T as T2, W, c, b as b2, a as a2, g as g2, h as h2 } from "./juo-workflow-CtWyuHD6.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 = {
|
|
@@ -136,6 +136,8 @@ export interface WorkflowServiceDependencies {
|
|
|
136
136
|
api: WorkflowApiAdapter;
|
|
137
137
|
/** ThemeState context for resolving the started workflow */
|
|
138
138
|
themeState: ThemeState;
|
|
139
|
+
/** Shop currency code (e.g. "USD", "EUR"). Injected into actionConfig for blocks that display monetary values. */
|
|
140
|
+
shopCurrencyCode?: string;
|
|
139
141
|
}
|
|
140
142
|
export declare function createWorkflowService(deps: WorkflowServiceDependencies): {
|
|
141
143
|
state: ReadonlySignal<WorkflowState>;
|
|
@@ -147,11 +147,12 @@ function createWorkflowService(deps) {
|
|
|
147
147
|
const interaction = _state.value.currentInteraction;
|
|
148
148
|
if (!interaction)
|
|
149
149
|
return null;
|
|
150
|
+
const actionConfig = deps.shopCurrencyCode ? { ...interaction.actionConfig, currency: deps.shopCurrencyCode } : interaction.actionConfig;
|
|
150
151
|
return {
|
|
151
152
|
interactionId: interaction.interactionId,
|
|
152
153
|
stepId: interaction.stepId,
|
|
153
154
|
actionType: interaction.actionType,
|
|
154
|
-
actionConfig
|
|
155
|
+
actionConfig,
|
|
155
156
|
availableResponses: interaction.availableResponses
|
|
156
157
|
};
|
|
157
158
|
});
|
|
@@ -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
|
};
|
|
@@ -5,9 +5,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
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-
|
|
8
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-BifGkf1W.js";
|
|
9
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-
|
|
10
|
+
import { T as TranslationContext } from "./juo-workflow-CtWyuHD6.js";
|
|
11
11
|
const _InlineText = class _InlineText extends HTMLElement {
|
|
12
12
|
constructor() {
|
|
13
13
|
super();
|
|
@@ -5,8 +5,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
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-
|
|
9
|
-
import { T as TranslationContext } from "./juo-workflow-
|
|
8
|
+
import { E as ExtensionRoot, B as Block } from "./ExtensionRoot-BifGkf1W.js";
|
|
9
|
+
import { T as TranslationContext } from "./juo-workflow-CtWyuHD6.js";
|
|
10
10
|
class InlineText extends HTMLElement {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|