@widgetic/creator 0.4.33 → 0.4.34

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.
@@ -225,7 +225,6 @@
225
225
  mayUseAddressBar,
226
226
  mayShowAccountBilling,
227
227
  maySuggestWidgetName,
228
- mayNameVersionOrDocumentsInGeneration,
229
228
  mayListenToSiteEvents,
230
229
  announceToSite,
231
230
  eventIsFromCreator,
@@ -11101,15 +11100,11 @@ Requirements:
11101
11100
  const runtimeLogsForRequest = collectRuntimeLogsForCodegen(generationWidgetId);
11102
11101
  // The version the person chose to build on, when it is not the head, and the head they chose it on: the API refuses the
11103
11102
  // request, before it charges anything, when newer code was saved since (a teammate, another window).
11104
- // (Not with the token of an editor session, a partner's customer: the gateway's door for a session does not list these
11105
- // fields, nor the text documents, and refuses a request that has one of them, so they are left out of the request
11106
- // there. A Shopify store's token has no such door. See utils/generationRequestFields.ts.)
11107
- const mayNameVersionOrDocuments = mayNameVersionOrDocumentsInGeneration(authenticatedClientsToken);
11108
- const chosenBaseCommitSha =
11109
- options.compileFixOnly || !mayNameVersionOrDocuments ? null : generationBaseCommitSha(generationWidgetId);
11103
+ // Every kind of token sends them, the token of an editor session (a partner's customer) as well: the gateway's door
11104
+ // lists these fields and the text documents. See utils/generationRequestFields.ts.
11105
+ const chosenBaseCommitSha = options.compileFixOnly ? null : generationBaseCommitSha(generationWidgetId);
11110
11106
  const headTheVersionWasChosenOn = chosenBaseCommitSha ? shownHeadCommitSha(generationWidgetId) : null;
11111
11107
  const versionAndDocumentFields = generationVersionAndDocumentFields({
11112
- mayNameVersionOrDocuments,
11113
11108
  baseCommitSha: chosenBaseCommitSha,
11114
11109
  expectedHeadSha: headTheVersionWasChosenOn,
11115
11110
  textDocuments: options.forkUserMessage ? undefined : options.textDocuments,
@@ -11131,8 +11126,7 @@ Requirements:
11131
11126
  : undefined,
11132
11127
  images: imagesToSend,
11133
11128
  attachmentIds: attachmentIdsToSend,
11134
- // The text documents, the version to build on and the head it was chosen on: only the ones with something to say,
11135
- // and none with an editor session's token (see above)
11129
+ // The text documents, the version to build on and the head it was chosen on: only the ones with something to say
11136
11130
  ...versionAndDocumentFields,
11137
11131
  runtimeLogs: runtimeLogsForRequest,
11138
11132
  compileFixOnly: options.compileFixOnly === true,
@@ -28,6 +28,6 @@ interface Props {
28
28
  language?: string;
29
29
  languageLocked?: boolean;
30
30
  }
31
- declare const BrandKitPanel: import("svelte").Component<Props, {}, "sub" | "title" | "brandKitEnabled" | "librariesEnabled" | "primary" | "secondary" | "fonts" | "libraries" | "libraryGitUrl" | "libraryFileName" | "libraryUploads" | "fontUploads" | "language">;
31
+ declare const BrandKitPanel: import("svelte").Component<Props, {}, "brandKitEnabled" | "librariesEnabled" | "primary" | "secondary" | "title" | "sub" | "fonts" | "libraries" | "libraryGitUrl" | "libraryFileName" | "libraryUploads" | "fontUploads" | "language">;
32
32
  type BrandKitPanel = ReturnType<typeof BrandKitPanel>;
33
33
  export default BrandKitPanel;
@@ -10,6 +10,6 @@ interface Props {
10
10
  urlPlaceholder?: string;
11
11
  accept?: string;
12
12
  }
13
- declare const FileUrlSourceControl: import("svelte").Component<Props, {}, "url" | "fileName" | "fileContent" | "fileEncoding">;
13
+ declare const FileUrlSourceControl: import("svelte").Component<Props, {}, "fileName" | "fileContent" | "fileEncoding" | "url">;
14
14
  type FileUrlSourceControl = ReturnType<typeof FileUrlSourceControl>;
15
15
  export default FileUrlSourceControl;
@@ -100,7 +100,7 @@ declare const WidgetDetails: $$__sveltets_2_IsomorphicComponent<{
100
100
  /** Stacking order when multiple Widget Details panels are open. */ panelZIndex?: number;
101
101
  /** Cascade offset index (0 = centered, 1+ = shifted down-right). */ panelCascadeIndex?: number;
102
102
  /** False when another panel has keyboard/chat focus. */ isFocusedPanel?: boolean;
103
- currentStep?: "embed" | "create" | "edit";
103
+ currentStep?: "create" | "edit" | "embed";
104
104
  /**
105
105
  * Canvas Creator is code-only (chat + preview). Edit/Embed header steps stay
106
106
  * off until composition editing lives on /composition. Keep the Edit/Embed
@@ -100,27 +100,6 @@ export declare function mayShowAccountBilling(): boolean;
100
100
  * partner's page the creator does not ask, and the widget keeps the name of its draft.
101
101
  */
102
102
  export declare function maySuggestWidgetName(): boolean;
103
- /**
104
- * What the token of an editor session starts with: the credential a partner mints for one of its customers' browsers (the
105
- * gateway's `EDITOR_SESSION_TOKEN_PREFIX`, and the way it tells a session from any other token as well).
106
- */
107
- export declare const EDITOR_SESSION_TOKEN_PREFIX = "wgt_ses_";
108
- /** Whether the token is an editor session's. A Shopify store's session token, a person's login and an API key are not. */
109
- export declare function isEditorSessionToken(token: string | null | undefined): boolean;
110
- /**
111
- * Whether a generation request (`POST /agent/code/generate`) may name the older version to build on (`baseCommitSha`), the
112
- * head the person chose it on (`expectedHeadSha`), and the words of the text documents attached to the message
113
- * (`textDocuments`). None of the three is on the gateway's allow-list for an editor session (what a partner's customer
114
- * works with): its door refuses a request that has a field it does not list, whatever the field's value (even
115
- * `baseCommitSha: null`), so one that carried any of them would be refused whole and the visitor could not generate at all.
116
- * With a session's token the creator leaves the three out, and the AI builds on the latest code from the message alone, as it
117
- * did before the API client knew the fields (it dropped them without a word).
118
- *
119
- * It is the token that decides, not partner mode: a Shopify store's page is in partner mode too (the page handed the creator a
120
- * token), but its token is a Shopify session, which has no such door, and the team of a store is exactly who the head check
121
- * protects. `utils/generationRequestFields.ts` is where the request is built from the answer.
122
- */
123
- export declare function mayNameVersionOrDocumentsInGeneration(token: string | null | undefined): boolean;
124
103
  /** Whether the creator may take part in the page-wide `widgetic:*` events it exchanges with the Widgetic site's own page chrome. */
125
104
  export declare function mayListenToSiteEvents(): boolean;
126
105
  /**
@@ -108,33 +108,6 @@ export function mayShowAccountBilling() {
108
108
  export function maySuggestWidgetName() {
109
109
  return !state.partnerMode;
110
110
  }
111
- /**
112
- * What the token of an editor session starts with: the credential a partner mints for one of its customers' browsers (the
113
- * gateway's `EDITOR_SESSION_TOKEN_PREFIX`, and the way it tells a session from any other token as well).
114
- */
115
- export const EDITOR_SESSION_TOKEN_PREFIX = 'wgt_ses_';
116
- /** Whether the token is an editor session's. A Shopify store's session token, a person's login and an API key are not. */
117
- export function isEditorSessionToken(token) {
118
- if (typeof token !== 'string')
119
- return false;
120
- return token.replace(/^Bearer\s+/i, '').trim().startsWith(EDITOR_SESSION_TOKEN_PREFIX);
121
- }
122
- /**
123
- * Whether a generation request (`POST /agent/code/generate`) may name the older version to build on (`baseCommitSha`), the
124
- * head the person chose it on (`expectedHeadSha`), and the words of the text documents attached to the message
125
- * (`textDocuments`). None of the three is on the gateway's allow-list for an editor session (what a partner's customer
126
- * works with): its door refuses a request that has a field it does not list, whatever the field's value (even
127
- * `baseCommitSha: null`), so one that carried any of them would be refused whole and the visitor could not generate at all.
128
- * With a session's token the creator leaves the three out, and the AI builds on the latest code from the message alone, as it
129
- * did before the API client knew the fields (it dropped them without a word).
130
- *
131
- * It is the token that decides, not partner mode: a Shopify store's page is in partner mode too (the page handed the creator a
132
- * token), but its token is a Shopify session, which has no such door, and the team of a store is exactly who the head check
133
- * protects. `utils/generationRequestFields.ts` is where the request is built from the answer.
134
- */
135
- export function mayNameVersionOrDocumentsInGeneration(token) {
136
- return !isEditorSessionToken(token);
137
- }
138
111
  /** Whether the creator may take part in the page-wide `widgetic:*` events it exchanges with the Widgetic site's own page chrome. */
139
112
  export function mayListenToSiteEvents() {
140
113
  return !state.partnerMode;
@@ -588,7 +588,6 @@ export declare const CREATOR_CATALOGS: {
588
588
  readonly 'chat.messages.restore': "Restore Checkpoint";
589
589
  readonly 'chat.messages.restoreTitle': "Restore widget code to this prompt's commit";
590
590
  readonly 'chat.messages.alreadyHead': "This checkpoint is already HEAD";
591
- readonly 'chat.messages.showSuggestions': "Show suggestions";
592
591
  readonly 'chat.messages.version': "Version {number}";
593
592
  readonly 'chat.messages.restoredFrom': "Restored from {label}";
594
593
  readonly 'chat.messages.previousVersion': "a previous version";
@@ -699,7 +698,6 @@ export declare const CREATOR_CATALOGS: {
699
698
  readonly 'canvas.state.loading': "Loading canvas\u2026";
700
699
  readonly 'canvas.state.initFailed': "Canvas failed to initialize.";
701
700
  readonly 'canvas.error.imageFromUrl': "Failed to load image from URL. Make sure the URL is correct and allows cross-origin requests.";
702
- readonly 'canvas.defaults.text': "Hello World!";
703
701
  readonly 'canvas.defaults.textBox': "Type here";
704
702
  readonly 'canvas.defaults.frameLabel': "Frame";
705
703
  readonly 'canvas.defaults.untitledFrame': "Untitled Frame";
@@ -818,6 +816,7 @@ export declare const CREATOR_CATALOGS: {
818
816
  readonly 'canvas.zoom.gridLabel': "Toggle grid";
819
817
  readonly 'canvas.zoom.panTitle': "Hand / Pan [H]";
820
818
  readonly 'canvas.zoom.panLabel': "Hand / pan tool";
819
+ readonly 'canvas.zoom.panBanner': "Dragging the canvas";
821
820
  readonly 'canvas.zoom.outTitle': "Zoom Out [Ctrl/Cmd] + [\u2212]";
822
821
  readonly 'canvas.zoom.outLabel': "Zoom out";
823
822
  readonly 'canvas.zoom.inTitle': "Zoom In [Ctrl/Cmd] + [+]";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The three fields of a generation request (`POST /agent/code/generate`) that a request carries only when there is something
3
- * to say, and that an editor session (a partner's customer) may not carry at all.
3
+ * to say.
4
4
  *
5
5
  * - `baseCommitSha`: the older version the person chose to build on, when it is not the head of the code.
6
6
  * - `expectedHeadSha`: the head they chose that version on, so the API can refuse the request, before it charges anything,
@@ -10,21 +10,20 @@
10
10
  * Two things about how they travel, which the generated API client made visible when it was regenerated (1.0.46):
11
11
  *
12
12
  * 1. A field that is there with `null` is a field. The client writes `baseCommitSha: null` into the body when it is given
13
- * `null`, and the gateway's door for an editor session refuses a body with a field it does not list, whatever the value. So
14
- * a field with nothing to say is left out, not sent empty.
15
- * 2. The gateway's list of what an editor session may send in a generation does not have these three (the list is what the
16
- * generation reads for a visitor: the request is refused whole, `403 EDITOR_SESSION_FIELD_NOT_ALLOWED`, and the visitor
17
- * cannot generate at all). The client of the modules until now (1.0.29) did not know the three fields and dropped them
18
- * without a word, so with a session's token the AI has always built on the latest code from the message alone. It still
19
- * does; the creator now says so by leaving them out (`mayNameVersionOrDocumentsInGeneration(token)` of
20
- * `host/creatorHost.ts` is the question; a Shopify store's token is not a session's, has no such door, and so names them).
13
+ * `null`, so a field with nothing to say is left out, not sent empty. (The gateway's door for an editor session judges the
14
+ * names of the body's keys and not their values, so a `null` would be a field there too; and the request stays as small as
15
+ * it was for the clients that did not know the field.)
16
+ * 2. Every kind of token sends them: a person's login, a Shopify store's session and, since 0.4.34, the token of an editor
17
+ * session (a partner's customer). Until then the gateway's list of what an editor session may send in a generation did not
18
+ * have the three, the whole request was refused (`403 EDITOR_SESSION_FIELD_NOT_ALLOWED`), and the creator left them out
19
+ * for a session's token, so a partner's customer built on the latest code from the message alone. The list has them now
20
+ * (`CREATOR_FIELDS.codeGenerate` of the gateway's `editorSessionSurfaces.ts`), which is why this creator needs a gateway
21
+ * that has them, and why the gateway is released before it.
21
22
  *
22
23
  * It is plain TypeScript with no Svelte in it, so a test can hold it to both.
23
24
  */
24
25
  /** What the creator knows when it builds a generation request. */
25
26
  export interface GenerationVersionAndDocumentInput<TextDocument> {
26
- /** `mayNameVersionOrDocumentsInGeneration(token)`: false for the token of an editor session. */
27
- mayNameVersionOrDocuments: boolean;
28
27
  /** The version the person chose to build on, when it is not the head; null or undefined when they build on the head. */
29
28
  baseCommitSha: string | null | undefined;
30
29
  /** The head they chose that version on; null or undefined when the creator knows no head it could name. */
@@ -39,7 +38,7 @@ export interface GenerationVersionAndDocumentFields<TextDocument> {
39
38
  textDocuments?: TextDocument[];
40
39
  }
41
40
  /**
42
- * The fields to add to a generation request: none for an editor session, and for any other token only the ones that have
43
- * something to say. The head to compare with goes only with a chosen version (it is the head that version was chosen on).
41
+ * The fields to add to a generation request: only the ones that have something to say. The head to compare with goes only
42
+ * with a chosen version (it is the head that version was chosen on).
44
43
  */
45
44
  export declare function generationVersionAndDocumentFields<TextDocument>(input: GenerationVersionAndDocumentInput<TextDocument>): GenerationVersionAndDocumentFields<TextDocument>;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * The three fields of a generation request (`POST /agent/code/generate`) that a request carries only when there is something
3
- * to say, and that an editor session (a partner's customer) may not carry at all.
3
+ * to say.
4
4
  *
5
5
  * - `baseCommitSha`: the older version the person chose to build on, when it is not the head of the code.
6
6
  * - `expectedHeadSha`: the head they chose that version on, so the API can refuse the request, before it charges anything,
@@ -10,25 +10,24 @@
10
10
  * Two things about how they travel, which the generated API client made visible when it was regenerated (1.0.46):
11
11
  *
12
12
  * 1. A field that is there with `null` is a field. The client writes `baseCommitSha: null` into the body when it is given
13
- * `null`, and the gateway's door for an editor session refuses a body with a field it does not list, whatever the value. So
14
- * a field with nothing to say is left out, not sent empty.
15
- * 2. The gateway's list of what an editor session may send in a generation does not have these three (the list is what the
16
- * generation reads for a visitor: the request is refused whole, `403 EDITOR_SESSION_FIELD_NOT_ALLOWED`, and the visitor
17
- * cannot generate at all). The client of the modules until now (1.0.29) did not know the three fields and dropped them
18
- * without a word, so with a session's token the AI has always built on the latest code from the message alone. It still
19
- * does; the creator now says so by leaving them out (`mayNameVersionOrDocumentsInGeneration(token)` of
20
- * `host/creatorHost.ts` is the question; a Shopify store's token is not a session's, has no such door, and so names them).
13
+ * `null`, so a field with nothing to say is left out, not sent empty. (The gateway's door for an editor session judges the
14
+ * names of the body's keys and not their values, so a `null` would be a field there too; and the request stays as small as
15
+ * it was for the clients that did not know the field.)
16
+ * 2. Every kind of token sends them: a person's login, a Shopify store's session and, since 0.4.34, the token of an editor
17
+ * session (a partner's customer). Until then the gateway's list of what an editor session may send in a generation did not
18
+ * have the three, the whole request was refused (`403 EDITOR_SESSION_FIELD_NOT_ALLOWED`), and the creator left them out
19
+ * for a session's token, so a partner's customer built on the latest code from the message alone. The list has them now
20
+ * (`CREATOR_FIELDS.codeGenerate` of the gateway's `editorSessionSurfaces.ts`), which is why this creator needs a gateway
21
+ * that has them, and why the gateway is released before it.
21
22
  *
22
23
  * It is plain TypeScript with no Svelte in it, so a test can hold it to both.
23
24
  */
24
25
  /**
25
- * The fields to add to a generation request: none for an editor session, and for any other token only the ones that have
26
- * something to say. The head to compare with goes only with a chosen version (it is the head that version was chosen on).
26
+ * The fields to add to a generation request: only the ones that have something to say. The head to compare with goes only
27
+ * with a chosen version (it is the head that version was chosen on).
27
28
  */
28
29
  export function generationVersionAndDocumentFields(input) {
29
30
  const fields = {};
30
- if (!input.mayNameVersionOrDocuments)
31
- return fields;
32
31
  if (input.baseCommitSha) {
33
32
  fields.baseCommitSha = input.baseCommitSha;
34
33
  if (input.expectedHeadSha)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@widgetic/creator",
3
- "version": "0.4.33",
3
+ "version": "0.4.34",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "type": "module",
6
6
  "peerDependencies": {