@combeenation/custom-code-sdk 0.0.1-alpha3 → 0.0.1-alpha4

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/index.d.ts CHANGED
@@ -3,7 +3,6 @@ import { z } from 'zod';
3
3
  export declare class Button {
4
4
  #private;
5
5
  readonly id: CtrlId;
6
- readonly sdkBridgeVersion = "v1";
7
6
  constructor(id: CtrlId);
8
7
  onRendered(callback: OnRenderedCallback<HTMLButtonElement>): CallbackUnsubscribeOption;
9
8
  onClick(callback: OnClickCallback): CallbackUnsubscribeOption;
@@ -15,19 +14,10 @@ declare type CallbackUnsubscribeOption = {
15
14
  unsubscribe: () => void;
16
15
  };
17
16
 
18
- /**
19
- * Why we need this?
20
- *
21
- * Our custom code SDK is using the `ConfiguratorClient` as its main gateway to communicate with cmps. It comes with the
22
- * `ConfiguratorClient` built in and only knows about the API of the version is was built with.
23
- *
24
- * Therefore, we'll always have to support older versions of the public API for custom code as well at "system runtime".
25
- *
26
- * Custom code shall always access the `ConfiguratorClient` via some well defined "gateway fn" like
27
- * `window.Cbn.getCustomCodeSdkBridge().createCfgrClient` which is responsible for returning the correct versioned API
28
- * e.g. by "hotpatching" the returned runtime object based on the requested version.
29
- */
17
+ declare type CfgrClient = NonNullable<typeof client>;
18
+
30
19
  declare interface CfgrClientApi_v1 {
20
+ finishConfiguration: (input?: string) => Promise<FinishResult>;
31
21
  onAnyCmpValueChanged<TInput extends ValueComponent_2>(listener: CmpValuesChangedListener<TInput['name']>, components: TInput[], lazy?: boolean): Promise<void>;
32
22
  getCmpValue<T extends CmpValue_2>(cmpName: CmpName_2): Promise<T | undefined>;
33
23
  onCmpValueChanged<TValue extends CmpValue_2>(cmpName: CmpName_2, listener: CmpValueChangedListener_2<TValue>, condition?: CmpValueChangedCondition_2<TValue>, callImmediately?: boolean): Promise<void>;
@@ -36,7 +26,6 @@ declare interface CfgrClientApi_v1 {
36
26
  export declare class Checkbox {
37
27
  #private;
38
28
  readonly id: CtrlId;
39
- readonly sdkBridgeVersion = "v1";
40
29
  constructor(id: CtrlId);
41
30
  onRendered(callback: OnRenderedCallback<HTMLLabelElement>): CallbackUnsubscribeOption;
42
31
  setVisible(visible: boolean): Promise<void>;
@@ -79,7 +68,6 @@ declare interface CmpValuesChangedListener<TName extends string = string> {
79
68
  export declare class Collapsible {
80
69
  #private;
81
70
  readonly id: CtrlId;
82
- readonly sdkBridgeVersion = "v1";
83
71
  constructor(id: CtrlId);
84
72
  onRendered(callback: OnRenderedCallback<HTMLDivElement>): CallbackUnsubscribeOption;
85
73
  setVisible(visible: boolean): Promise<void>;
@@ -90,10 +78,28 @@ declare type CtrlId = z.infer<typeof ZCtrlId>;
90
78
  export declare class CustomControl {
91
79
  #private;
92
80
  readonly id: CtrlId;
93
- readonly sdkBridgeVersion = "v1";
94
81
  constructor(id: CtrlId);
82
+ /**
83
+ * Things to mention when writing docs:
84
+ * - Given `el` is only disconnected when ctrl is hidden
85
+ * -> Event listener on that element shall only be installed once in custom code
86
+ * Explicitly mention that this is only the case for `customCtrl.renderFn` and not for `otherCtrls.onRendered`.
87
+ * - Assigning a new fn does not trigger a re-render
88
+ * - Explain, when this fn is being called (automatically on show, manually on `.render()`)
89
+ * - Explain, why this should be used instead of a pattern like the following:
90
+ * ```ts
91
+ * const el = myCtrl.getElement();
92
+ * el.innerHTML = '...';
93
+ * ```
94
+ * - Explain difference to `onRendered` (see comments on `useCustomCodeSdkBridgeStoreBase`)
95
+ * - ...
96
+ */
95
97
  set renderFn(callback: CustomCtrlRenderFn);
96
- render(): Promise<void>;
98
+ /**
99
+ * @param renderFn Convenience param which allows setting the `renderFn` and triggering a render in one call.
100
+ * The `renderFn` will be permanently installed and will override any existing `renderFn`.
101
+ */
102
+ render(renderFn?: CustomCtrlRenderFn): Promise<void>;
97
103
  getElement(): HTMLElement | undefined;
98
104
  setVisible(visible: boolean): Promise<void>;
99
105
  }
@@ -103,24 +109,39 @@ declare type CustomCtrlRenderFn = (element: HTMLDivElement, rawHtml: string | un
103
109
  export declare class Dataview {
104
110
  #private;
105
111
  readonly id: CtrlId;
106
- readonly sdkBridgeVersion = "v1";
107
112
  constructor(id: CtrlId);
108
113
  onRendered(callback: OnRenderedCallback<HTMLDivElement>): CallbackUnsubscribeOption;
109
114
  setVisible(visible: boolean): Promise<void>;
110
115
  }
111
116
 
117
+ export declare const finishConfiguration: CfgrClient['finishConfiguration'];
118
+
119
+ /**
120
+ * Why we need this?
121
+ *
122
+ * Our custom code SDK is using the `ConfiguratorClient` as its main gateway to communicate with cmps. It comes with the
123
+ * `ConfiguratorClient` built in and only knows about the API of the version is was built with.
124
+ *
125
+ * Therefore, we'll always have to support older versions of the public API for custom code as well at "system runtime".
126
+ *
127
+ * Custom code shall always access the `ConfiguratorClient` via some well defined "gateway fn" like
128
+ * `window.Cbn.getCustomCodeSdkBridge().createCfgrClient` which is responsible for returning the correct versioned API
129
+ * e.g. by "hotpatching" the returned runtime object based on the requested version.
130
+ */
131
+ declare type FinishResult = {
132
+ newEditCfgnUrl: string;
133
+ actionResults: {};
134
+ };
135
+
112
136
  export declare class Input {
113
137
  #private;
114
138
  readonly id: CtrlId;
115
- readonly sdkBridgeVersion = "v1";
116
139
  constructor(id: CtrlId);
117
140
  onRendered(callback: OnRenderedCallback<HTMLDivElement>): CallbackUnsubscribeOption;
118
141
  setVisible(visible: boolean): Promise<void>;
119
142
  }
120
143
 
121
- declare type OnAnyCmpValueChanged = NonNullable<typeof client>['onAnyCmpValueChanged'];
122
-
123
- export declare const onAnyCmpValueChanged: OnAnyCmpValueChanged;
144
+ export declare const onAnyCmpValueChanged: CfgrClient['onAnyCmpValueChanged'];
124
145
 
125
146
  declare type OnClickCallback = () => void;
126
147
 
@@ -129,7 +150,6 @@ declare type OnRenderedCallback<T extends HTMLElement = HTMLElement> = (element:
129
150
  export declare class Panel {
130
151
  #private;
131
152
  readonly id: CtrlId;
132
- readonly sdkBridgeVersion = "v1";
133
153
  constructor(id: CtrlId);
134
154
  onRendered(callback: OnRenderedCallback<HTMLDivElement>): CallbackUnsubscribeOption;
135
155
  setVisible(visible: boolean): Promise<void>;
@@ -138,7 +158,6 @@ export declare class Panel {
138
158
  declare class Text_2 {
139
159
  #private;
140
160
  readonly id: CtrlId;
141
- readonly sdkBridgeVersion = "v1";
142
161
  constructor(id: CtrlId);
143
162
  onRendered(callback: OnRenderedCallback<HTMLSpanElement>): CallbackUnsubscribeOption;
144
163
  setVisible(visible: boolean): Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@combeenation/custom-code-sdk",
3
- "version": "0.0.1-alpha3",
3
+ "version": "0.0.1-alpha4",
4
4
  "description": "Combeenation custom code SDK package",
5
5
  "keywords": [],
6
6
  "homepage": "",