@shopify/cli-kit 3.47.4 → 3.48.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.
Files changed (138) hide show
  1. package/assets/cli-ruby/lib/project_types/extension/messages/messages.rb +18 -1
  2. package/assets/cli-ruby/lib/shopify_cli/constants.rb +1 -0
  3. package/assets/cli-ruby/lib/shopify_cli/environment.rb +7 -0
  4. package/assets/cli-ruby/lib/shopify_cli/theme/extension/dev_server.rb +8 -2
  5. package/dist/private/node/ui/alert.js +3 -1
  6. package/dist/private/node/ui/alert.js.map +1 -1
  7. package/dist/private/node/ui/components/Alert.d.ts +1 -1
  8. package/dist/private/node/ui/components/Alert.js.map +1 -1
  9. package/dist/private/node/ui/components/AutocompletePrompt.d.ts +7 -2
  10. package/dist/private/node/ui/components/AutocompletePrompt.js +28 -91
  11. package/dist/private/node/ui/components/AutocompletePrompt.js.map +1 -1
  12. package/dist/private/node/ui/components/AutocompletePrompt.test.js +317 -257
  13. package/dist/private/node/ui/components/AutocompletePrompt.test.js.map +1 -1
  14. package/dist/private/node/ui/components/ConcurrentOutput.d.ts +1 -0
  15. package/dist/private/node/ui/components/ConcurrentOutput.js +59 -32
  16. package/dist/private/node/ui/components/ConcurrentOutput.js.map +1 -1
  17. package/dist/private/node/ui/components/ConcurrentOutput.test.js +62 -22
  18. package/dist/private/node/ui/components/ConcurrentOutput.test.js.map +1 -1
  19. package/dist/private/node/ui/components/DangerousConfirmationPrompt.d.ts +12 -0
  20. package/dist/private/node/ui/components/DangerousConfirmationPrompt.js +77 -0
  21. package/dist/private/node/ui/components/DangerousConfirmationPrompt.js.map +1 -0
  22. package/dist/private/node/ui/components/DangerousConfirmationPrompt.test.js +101 -0
  23. package/dist/private/node/ui/components/DangerousConfirmationPrompt.test.js.map +1 -0
  24. package/dist/private/node/ui/components/List.d.ts +1 -0
  25. package/dist/private/node/ui/components/List.js +2 -2
  26. package/dist/private/node/ui/components/List.js.map +1 -1
  27. package/dist/private/node/ui/components/{GitDiff.d.ts → Prompts/GitDiff.d.ts} +4 -2
  28. package/dist/private/node/ui/components/{GitDiff.js → Prompts/GitDiff.js} +3 -2
  29. package/dist/private/node/ui/components/Prompts/GitDiff.js.map +1 -0
  30. package/dist/private/node/ui/components/Prompts/GitDiff.test.d.ts +1 -0
  31. package/dist/private/node/ui/components/{GitDiff.test.js → Prompts/GitDiff.test.js} +50 -28
  32. package/dist/private/node/ui/components/Prompts/GitDiff.test.js.map +1 -0
  33. package/dist/private/node/ui/components/Prompts/InfoMessage.d.ts +14 -0
  34. package/dist/private/node/ui/components/Prompts/InfoMessage.js +11 -0
  35. package/dist/private/node/ui/components/Prompts/InfoMessage.js.map +1 -0
  36. package/dist/private/node/ui/components/Prompts/InfoMessage.test.d.ts +1 -0
  37. package/dist/private/node/ui/components/Prompts/InfoMessage.test.js +21 -0
  38. package/dist/private/node/ui/components/Prompts/InfoMessage.test.js.map +1 -0
  39. package/dist/private/node/ui/components/Prompts/InfoTable.d.ts +1 -0
  40. package/dist/private/node/ui/components/Prompts/InfoTable.js +11 -7
  41. package/dist/private/node/ui/components/Prompts/InfoTable.js.map +1 -1
  42. package/dist/private/node/ui/components/Prompts/InfoTable.test.js +6 -4
  43. package/dist/private/node/ui/components/Prompts/InfoTable.test.js.map +1 -1
  44. package/dist/private/node/ui/components/Prompts/PromptLayout.d.ts +21 -0
  45. package/dist/private/node/ui/components/Prompts/PromptLayout.js +73 -0
  46. package/dist/private/node/ui/components/Prompts/PromptLayout.js.map +1 -0
  47. package/dist/private/node/ui/components/Prompts/PromptLayout.test.d.ts +1 -0
  48. package/dist/private/node/ui/components/Prompts/PromptLayout.test.js +129 -0
  49. package/dist/private/node/ui/components/Prompts/PromptLayout.test.js.map +1 -0
  50. package/dist/private/node/ui/components/Scrollbar.d.ts +10 -0
  51. package/dist/private/node/ui/components/Scrollbar.js +44 -0
  52. package/dist/private/node/ui/components/Scrollbar.js.map +1 -0
  53. package/dist/private/node/ui/components/Scrollbar.test.d.ts +1 -0
  54. package/dist/private/node/ui/components/Scrollbar.test.js +96 -0
  55. package/dist/private/node/ui/components/Scrollbar.test.js.map +1 -0
  56. package/dist/private/node/ui/components/SelectInput.d.ts +3 -6
  57. package/dist/private/node/ui/components/SelectInput.js +57 -41
  58. package/dist/private/node/ui/components/SelectInput.js.map +1 -1
  59. package/dist/private/node/ui/components/SelectInput.test.js +120 -192
  60. package/dist/private/node/ui/components/SelectInput.test.js.map +1 -1
  61. package/dist/private/node/ui/components/SelectPrompt.d.ts +7 -6
  62. package/dist/private/node/ui/components/SelectPrompt.js +11 -68
  63. package/dist/private/node/ui/components/SelectPrompt.js.map +1 -1
  64. package/dist/private/node/ui/components/SelectPrompt.test.js +135 -65
  65. package/dist/private/node/ui/components/SelectPrompt.test.js.map +1 -1
  66. package/dist/private/node/ui/components/Table/Row.js +2 -1
  67. package/dist/private/node/ui/components/Table/Row.js.map +1 -1
  68. package/dist/private/node/ui/components/Table/Table.js +2 -1
  69. package/dist/private/node/ui/components/Table/Table.js.map +1 -1
  70. package/dist/private/node/ui/components/Tasks.js +1 -8
  71. package/dist/private/node/ui/components/Tasks.js.map +1 -1
  72. package/dist/private/node/ui/components/TextInput.d.ts +1 -0
  73. package/dist/private/node/ui/components/TextInput.js +10 -4
  74. package/dist/private/node/ui/components/TextInput.js.map +1 -1
  75. package/dist/private/node/ui/components/TextInput.test.js +27 -18
  76. package/dist/private/node/ui/components/TextInput.test.js.map +1 -1
  77. package/dist/private/node/ui/components/TextPrompt.d.ts +2 -3
  78. package/dist/private/node/ui/components/TextPrompt.js +18 -16
  79. package/dist/private/node/ui/components/TextPrompt.js.map +1 -1
  80. package/dist/private/node/ui/components/TextPrompt.test.js +25 -11
  81. package/dist/private/node/ui/components/TextPrompt.test.js.map +1 -1
  82. package/dist/private/node/ui/hooks/use-prompt.d.ts +18 -0
  83. package/dist/private/node/ui/hooks/use-prompt.js +20 -0
  84. package/dist/private/node/ui/hooks/use-prompt.js.map +1 -0
  85. package/dist/private/node/ui/hooks/use-select-state.d.ts +4 -4
  86. package/dist/private/node/ui/hooks/use-select-state.js +9 -9
  87. package/dist/private/node/ui/hooks/use-select-state.js.map +1 -1
  88. package/dist/public/common/object.d.ts +16 -0
  89. package/dist/public/common/object.js +26 -0
  90. package/dist/public/common/object.js.map +1 -1
  91. package/dist/public/common/string.d.ts +16 -0
  92. package/dist/public/common/string.js +30 -0
  93. package/dist/public/common/string.js.map +1 -1
  94. package/dist/public/common/version.d.ts +1 -1
  95. package/dist/public/common/version.js +1 -1
  96. package/dist/public/common/version.js.map +1 -1
  97. package/dist/public/node/analytics.js +3 -1
  98. package/dist/public/node/analytics.js.map +1 -1
  99. package/dist/public/node/base-command.d.ts +1 -0
  100. package/dist/public/node/base-command.js +21 -1
  101. package/dist/public/node/base-command.js.map +1 -1
  102. package/dist/public/node/figures.d.ts +2 -0
  103. package/dist/public/node/figures.js +3 -0
  104. package/dist/public/node/figures.js.map +1 -0
  105. package/dist/public/node/metadata.d.ts +2 -1
  106. package/dist/public/node/metadata.js +5 -2
  107. package/dist/public/node/metadata.js.map +1 -1
  108. package/dist/public/node/monorail.d.ts +22 -1
  109. package/dist/public/node/monorail.js +1 -1
  110. package/dist/public/node/monorail.js.map +1 -1
  111. package/dist/public/node/output.d.ts +1 -1
  112. package/dist/public/node/output.js +1 -1
  113. package/dist/public/node/output.js.map +1 -1
  114. package/dist/public/node/ruby.d.ts +1 -0
  115. package/dist/public/node/ruby.js +1 -0
  116. package/dist/public/node/ruby.js.map +1 -1
  117. package/dist/public/node/system.js +2 -2
  118. package/dist/public/node/system.js.map +1 -1
  119. package/dist/public/node/themes/models/theme.d.ts +2 -1
  120. package/dist/public/node/themes/models/theme.js +2 -1
  121. package/dist/public/node/themes/models/theme.js.map +1 -1
  122. package/dist/public/node/themes/theme-urls.d.ts +1 -0
  123. package/dist/public/node/themes/theme-urls.js +4 -0
  124. package/dist/public/node/themes/theme-urls.js.map +1 -1
  125. package/dist/public/node/themes/themes-api.d.ts +9 -1
  126. package/dist/public/node/themes/themes-api.js +14 -3
  127. package/dist/public/node/themes/themes-api.js.map +1 -1
  128. package/dist/public/node/toml.d.ts +3 -2
  129. package/dist/public/node/toml.js +5 -2
  130. package/dist/public/node/toml.js.map +1 -1
  131. package/dist/public/node/ui.d.ts +82 -27
  132. package/dist/public/node/ui.js +97 -32
  133. package/dist/public/node/ui.js.map +1 -1
  134. package/dist/tsconfig.tsbuildinfo +1 -1
  135. package/package.json +14 -14
  136. package/dist/private/node/ui/components/GitDiff.js.map +0 -1
  137. package/dist/private/node/ui/components/GitDiff.test.js.map +0 -1
  138. /package/dist/private/node/ui/components/{GitDiff.test.d.ts → DangerousConfirmationPrompt.test.d.ts} +0 -0
@@ -6,11 +6,13 @@ import { CustomSection } from '../../private/node/ui/components/Alert.js';
6
6
  import ScalarDict from '../../private/node/ui/components/Table/ScalarDict.js';
7
7
  import { TableColumn, TableProps } from '../../private/node/ui/components/Table/Table.js';
8
8
  import { InlineToken, LinkToken, ListToken, TokenItem } from '../../private/node/ui/components/TokenizedText.js';
9
+ import { DangerousConfirmationPromptProps } from '../../private/node/ui/components/DangerousConfirmationPrompt.js';
9
10
  import { SelectPromptProps } from '../../private/node/ui/components/SelectPrompt.js';
10
11
  import { Task } from '../../private/node/ui/components/Tasks.js';
11
12
  import { TextPromptProps } from '../../private/node/ui/components/TextPrompt.js';
12
13
  import { AutocompletePromptProps } from '../../private/node/ui/components/AutocompletePrompt.js';
13
14
  import { InfoTableSection } from '../../private/node/ui/components/Prompts/InfoTable.js';
15
+ import { InfoMessageProps } from '../../private/node/ui/components/Prompts/InfoMessage.js';
14
16
  import { Key as InkKey, RenderOptions } from 'ink';
15
17
  type PartialBy<T, TKey extends keyof T> = Omit<T, TKey> & Partial<Pick<T, TKey>>;
16
18
  export interface RenderConcurrentOptions extends PartialBy<ConcurrentOutputProps, 'abortSignal'> {
@@ -19,12 +21,12 @@ export interface RenderConcurrentOptions extends PartialBy<ConcurrentOutputProps
19
21
  /**
20
22
  * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.
21
23
  * @example
22
- * 0000-00-00 00:00:00 │ backend │ first backend message
23
- * 0000-00-00 00:00:00 │ backend │ second backend message
24
- * 0000-00-00 00:00:00 │ backend │ third backend message
25
- * 0000-00-00 00:00:00 │ frontend │ first frontend message
26
- * 0000-00-00 00:00:00 │ frontend │ second frontend message
27
- * 0000-00-00 00:00:00 │ frontend │ third frontend message
24
+ * 00:00:00 │ backend │ first backend message
25
+ * 00:00:00 │ backend │ second backend message
26
+ * 00:00:00 │ backend │ third backend message
27
+ * 00:00:00 │ frontend │ first frontend message
28
+ * 00:00:00 │ frontend │ second frontend message
29
+ * 00:00:00 │ frontend │ third frontend message
28
30
  *
29
31
  * › Press p │ preview in your browser
30
32
  * › Press q │ quit.
@@ -132,6 +134,20 @@ export declare function renderSuccess(options: RenderAlertOptions): string | und
132
134
  *
133
135
  */
134
136
  export declare function renderWarning(options: RenderAlertOptions): string | undefined;
137
+ /**
138
+ * Renders an error banner to the console.
139
+ * @example
140
+ * ╭─ error ──────────────────────────────────────────────────╮
141
+ * │ │
142
+ * │ Version couldn't be released. │
143
+ * │ │
144
+ * │ This version needs to be submitted for review and │
145
+ * │ approved by Shopify before it can be released. │
146
+ * │ │
147
+ * ╰──────────────────────────────────────────────────────────╯
148
+ *
149
+ */
150
+ export declare function renderError(options: RenderAlertOptions): string | undefined;
135
151
  interface RenderFatalErrorOptions {
136
152
  renderOptions?: RenderOptions;
137
153
  }
@@ -185,32 +201,34 @@ export interface RenderSelectPromptOptions<T> extends Omit<SelectPromptProps<T>,
185
201
  * @example
186
202
  * ? Associate your project with the org Castile Ventures?
187
203
  *
188
- * Add: • new-ext
189
- *
190
- * Remove: • integrated-demand-ext
191
- * • order-discount
204
+ *Add
205
+ * ┃ • new-ext
206
+ *
207
+ * ┃ Remove
208
+ * ┃ • integrated-demand-ext
209
+ * ┃ • order-discount
192
210
  *
193
211
  * Automations
194
- * > (a) fifth
195
- * (2) sixth
212
+ * > fifth
213
+ * sixth
196
214
  *
197
215
  * Merchant Admin
198
- * (3) eighth
199
- * (4) ninth
216
+ * eighth
217
+ * ninth
200
218
  *
201
219
  * Other
202
- * (f) first
203
- * (s) second
204
- * (7) third (limit reached)
205
- * (8) fourth
206
- * (9) seventh
207
- * (10) tenth
220
+ * first
221
+ * second
222
+ * third (limit reached)
223
+ * fourth
224
+ * seventh
225
+ * tenth
208
226
  *
209
- * Press ↑↓ arrows to select, enter to confirm
227
+ * Press ↑↓ arrows to select, enter to confirm.
210
228
  *
211
229
  */
212
230
  export declare function renderSelectPrompt<T>({ renderOptions, isConfirmationPrompt, ...props }: RenderSelectPromptOptions<T>): Promise<T>;
213
- export interface RenderConfirmationPromptOptions extends Pick<SelectPromptProps<boolean>, 'message' | 'infoTable' | 'gitDiff' | 'abortSignal'> {
231
+ export interface RenderConfirmationPromptOptions extends Pick<SelectPromptProps<boolean>, 'message' | 'infoTable' | 'infoMessage' | 'gitDiff' | 'abortSignal'> {
214
232
  confirmationMessage?: string;
215
233
  cancellationMessage?: string;
216
234
  renderOptions?: RenderOptions;
@@ -221,16 +239,21 @@ export interface RenderConfirmationPromptOptions extends Pick<SelectPromptProps<
221
239
  * @example
222
240
  * ? Delete the following themes from the store?
223
241
  *
224
- * first theme (#1)
225
- * • second theme (#2)
242
+ * ┃ Info message title
243
+ *
244
+ * ┃ Info message body
245
+ * ┃
246
+ * ┃ • first theme (#1)
247
+ * ┃ • second theme (#2)
226
248
  *
227
249
  * > (y) Yes, confirm changes
228
250
  * (n) Cancel
229
251
  *
230
- * Press ↑↓ arrows to select, enter or a shortcut to confirm
252
+ * Press ↑↓ arrows to select, enter or a shortcut to
253
+ * confirm.
231
254
  *
232
255
  */
233
- export declare function renderConfirmationPrompt({ message, infoTable, gitDiff, confirmationMessage, cancellationMessage, renderOptions, defaultValue, abortSignal, }: RenderConfirmationPromptOptions): Promise<boolean>;
256
+ export declare function renderConfirmationPrompt({ message, infoTable, gitDiff, confirmationMessage, cancellationMessage, renderOptions, defaultValue, abortSignal, infoMessage, }: RenderConfirmationPromptOptions): Promise<boolean>;
234
257
  export interface RenderAutocompleteOptions<T> extends PartialBy<Omit<AutocompletePromptProps<T>, 'onSubmit'>, 'search'> {
235
258
  renderOptions?: RenderOptions;
236
259
  }
@@ -239,6 +262,10 @@ export interface RenderAutocompleteOptions<T> extends PartialBy<Omit<Autocomplet
239
262
  * @example
240
263
  * ? Select a template: Type to search...
241
264
  *
265
+ * ┃ Info message title
266
+ * ┃
267
+ * ┃ Info message body
268
+ *
242
269
  * > first
243
270
  * second
244
271
  * third
@@ -265,7 +292,7 @@ export interface RenderAutocompleteOptions<T> extends PartialBy<Omit<Autocomplet
265
292
  * twenty-fourth
266
293
  * twenty-fifth
267
294
  *
268
- * Press ↑↓ arrows to select, enter to confirm
295
+ * Press ↑↓ arrows to select, enter to confirm.
269
296
  *
270
297
  */
271
298
  export declare function renderAutocompletePrompt<T>({ renderOptions, ...props }: RenderAutocompleteOptions<T>): Promise<T>;
@@ -304,6 +331,33 @@ export interface RenderTextPromptOptions extends Omit<TextPromptProps, 'onSubmit
304
331
  *
305
332
  */
306
333
  export declare function renderTextPrompt({ renderOptions, ...props }: RenderTextPromptOptions): Promise<string>;
334
+ export interface RenderDangerousConfirmationPromptOptions extends Omit<DangerousConfirmationPromptProps, 'onSubmit'> {
335
+ renderOptions?: RenderOptions;
336
+ }
337
+ /**
338
+ * Renders a dangerous confirmation prompt to the console, forcing the user to
339
+ * type a confirmation string to proceed.
340
+ * @example
341
+ * ? Release a new version of nightly-app-2023-06-19?
342
+ *
343
+ * ┃ Includes:
344
+ * ┃ + web-px (new)
345
+ * ┃ + sub-ui-ext
346
+ * ┃ + theme-app-ext
347
+ * ┃ + paymentify (from Partner Dashboard)
348
+ * ┃
349
+ * ┃ Removes:
350
+ * ┃ - prod-discount-fun
351
+ * ┃
352
+ * ┃ This can permanently delete app user data.
353
+ *
354
+ * Type nightly-app-2023-06-19 to confirm, or press Escape
355
+ * to cancel.
356
+ * > █
357
+ * ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
358
+ *
359
+ */
360
+ export declare function renderDangerousConfirmationPrompt({ renderOptions, ...props }: RenderDangerousConfirmationPromptOptions): Promise<boolean>;
307
361
  interface RenderTextOptions {
308
362
  text: string;
309
363
  logLevel?: LogLevel;
@@ -319,4 +373,5 @@ export declare function renderText({ text, logLevel, logger }: RenderTextOptions
319
373
  /** Waits for any key to be pressed except Ctrl+C which will terminate the process. */
320
374
  export declare const keypress: () => Promise<unknown>;
321
375
  export type Key = InkKey;
376
+ export type InfoMessage = InfoMessageProps['message'];
322
377
  export { Task, TokenItem, InlineToken, LinkToken, TableColumn, InfoTableSection, ListToken };
@@ -10,6 +10,7 @@ import { alert } from '../../private/node/ui/alert.js';
10
10
  import { FatalError } from '../../private/node/ui/components/FatalError.js';
11
11
  import { Table } from '../../private/node/ui/components/Table/Table.js';
12
12
  import { tokenItemToString, } from '../../private/node/ui/components/TokenizedText.js';
13
+ import { DangerousConfirmationPrompt, } from '../../private/node/ui/components/DangerousConfirmationPrompt.js';
13
14
  import { SelectPrompt } from '../../private/node/ui/components/SelectPrompt.js';
14
15
  import { Tasks } from '../../private/node/ui/components/Tasks.js';
15
16
  import { TextPrompt } from '../../private/node/ui/components/TextPrompt.js';
@@ -19,12 +20,12 @@ import React from 'react';
19
20
  /**
20
21
  * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.
21
22
  * @example
22
- * 0000-00-00 00:00:00 │ backend │ first backend message
23
- * 0000-00-00 00:00:00 │ backend │ second backend message
24
- * 0000-00-00 00:00:00 │ backend │ third backend message
25
- * 0000-00-00 00:00:00 │ frontend │ first frontend message
26
- * 0000-00-00 00:00:00 │ frontend │ second frontend message
27
- * 0000-00-00 00:00:00 │ frontend │ third frontend message
23
+ * 00:00:00 │ backend │ first backend message
24
+ * 00:00:00 │ backend │ second backend message
25
+ * 00:00:00 │ backend │ third backend message
26
+ * 00:00:00 │ frontend │ first frontend message
27
+ * 00:00:00 │ frontend │ second frontend message
28
+ * 00:00:00 │ frontend │ third frontend message
28
29
  *
29
30
  * › Press p │ preview in your browser
30
31
  * › Press q │ quit.
@@ -149,6 +150,22 @@ export function renderSuccess(options) {
149
150
  export function renderWarning(options) {
150
151
  return alert({ ...options, type: 'warning' });
151
152
  }
153
+ /**
154
+ * Renders an error banner to the console.
155
+ * @example
156
+ * ╭─ error ──────────────────────────────────────────────────╮
157
+ * │ │
158
+ * │ Version couldn't be released. │
159
+ * │ │
160
+ * │ This version needs to be submitted for review and │
161
+ * │ approved by Shopify before it can be released. │
162
+ * │ │
163
+ * ╰──────────────────────────────────────────────────────────╯
164
+ *
165
+ */
166
+ export function renderError(options) {
167
+ return alert({ ...options, type: 'error' });
168
+ }
152
169
  /**
153
170
  * Renders a Fatal error to the console inside a banner.
154
171
  * @example Basic
@@ -202,28 +219,30 @@ export function renderFatalError(error, { renderOptions } = {}) {
202
219
  * @example
203
220
  * ? Associate your project with the org Castile Ventures?
204
221
  *
205
- * Add: • new-ext
206
- *
207
- * Remove: • integrated-demand-ext
208
- * • order-discount
222
+ *Add
223
+ * ┃ • new-ext
224
+ *
225
+ * ┃ Remove
226
+ * ┃ • integrated-demand-ext
227
+ * ┃ • order-discount
209
228
  *
210
229
  * Automations
211
- * > (a) fifth
212
- * (2) sixth
230
+ * > fifth
231
+ * sixth
213
232
  *
214
233
  * Merchant Admin
215
- * (3) eighth
216
- * (4) ninth
234
+ * eighth
235
+ * ninth
217
236
  *
218
237
  * Other
219
- * (f) first
220
- * (s) second
221
- * (7) third (limit reached)
222
- * (8) fourth
223
- * (9) seventh
224
- * (10) tenth
238
+ * first
239
+ * second
240
+ * third (limit reached)
241
+ * fourth
242
+ * seventh
243
+ * tenth
225
244
  *
226
- * Press ↑↓ arrows to select, enter to confirm
245
+ * Press ↑↓ arrows to select, enter to confirm.
227
246
  *
228
247
  */
229
248
  export async function renderSelectPrompt({ renderOptions, isConfirmationPrompt, ...props }) {
@@ -246,16 +265,21 @@ export async function renderSelectPrompt({ renderOptions, isConfirmationPrompt,
246
265
  * @example
247
266
  * ? Delete the following themes from the store?
248
267
  *
249
- * first theme (#1)
250
- * • second theme (#2)
268
+ * ┃ Info message title
269
+ *
270
+ * ┃ Info message body
271
+ * ┃
272
+ * ┃ • first theme (#1)
273
+ * ┃ • second theme (#2)
251
274
  *
252
275
  * > (y) Yes, confirm changes
253
276
  * (n) Cancel
254
277
  *
255
- * Press ↑↓ arrows to select, enter or a shortcut to confirm
278
+ * Press ↑↓ arrows to select, enter or a shortcut to
279
+ * confirm.
256
280
  *
257
281
  */
258
- export async function renderConfirmationPrompt({ message, infoTable, gitDiff, confirmationMessage = 'Yes, confirm', cancellationMessage = 'No, cancel', renderOptions, defaultValue = true, abortSignal, }) {
282
+ export async function renderConfirmationPrompt({ message, infoTable, gitDiff, confirmationMessage = 'Yes, confirm', cancellationMessage = 'No, cancel', renderOptions, defaultValue = true, abortSignal, infoMessage, }) {
259
283
  // eslint-disable-next-line prefer-rest-params
260
284
  recordUIEvent({ type: 'confirmationPrompt', properties: arguments[0] });
261
285
  const choices = [
@@ -275,11 +299,11 @@ export async function renderConfirmationPrompt({ message, infoTable, gitDiff, co
275
299
  message,
276
300
  infoTable,
277
301
  gitDiff,
278
- submitWithShortcuts: true,
279
302
  renderOptions,
280
303
  defaultValue,
281
304
  isConfirmationPrompt: true,
282
305
  abortSignal,
306
+ infoMessage,
283
307
  });
284
308
  }
285
309
  /**
@@ -287,6 +311,10 @@ export async function renderConfirmationPrompt({ message, infoTable, gitDiff, co
287
311
  * @example
288
312
  * ? Select a template: Type to search...
289
313
  *
314
+ * ┃ Info message title
315
+ * ┃
316
+ * ┃ Info message body
317
+ *
290
318
  * > first
291
319
  * second
292
320
  * third
@@ -313,7 +341,7 @@ export async function renderConfirmationPrompt({ message, infoTable, gitDiff, co
313
341
  * twenty-fourth
314
342
  * twenty-fifth
315
343
  *
316
- * Press ↑↓ arrows to select, enter to confirm
344
+ * Press ↑↓ arrows to select, enter to confirm.
317
345
  *
318
346
  */
319
347
  export async function renderAutocompletePrompt({ renderOptions, ...props }) {
@@ -322,8 +350,11 @@ export async function renderAutocompletePrompt({ renderOptions, ...props }) {
322
350
  recordUIEvent({ type: 'autocompletePrompt', properties: arguments[0] });
323
351
  const newProps = {
324
352
  search(term) {
353
+ const lowerTerm = term.toLowerCase();
325
354
  return Promise.resolve({
326
- data: props.choices.filter((item) => item.label.toLowerCase().includes(term.toLowerCase())),
355
+ data: props.choices.filter((item) => {
356
+ return (item.label.toLowerCase().includes(lowerTerm) || (item.group && item.group.toLowerCase().includes(lowerTerm)));
357
+ }),
327
358
  });
328
359
  },
329
360
  ...props,
@@ -372,10 +403,7 @@ export async function renderTasks(tasks, { renderOptions } = {}) {
372
403
  });
373
404
  // eslint-disable-next-line max-params
374
405
  return new Promise((resolve, reject) => {
375
- render(React.createElement(Tasks, { tasks: tasks, onComplete: resolve }), {
376
- ...renderOptions,
377
- exitOnCtrlC: false,
378
- })
406
+ render(React.createElement(Tasks, { tasks: tasks, onComplete: resolve }), renderOptions)
379
407
  .then(() => resetRecordedSleep())
380
408
  .catch(reject);
381
409
  });
@@ -402,6 +430,43 @@ export async function renderTextPrompt({ renderOptions, ...props }) {
402
430
  .finally(resetRecordedSleep);
403
431
  });
404
432
  }
433
+ /**
434
+ * Renders a dangerous confirmation prompt to the console, forcing the user to
435
+ * type a confirmation string to proceed.
436
+ * @example
437
+ * ? Release a new version of nightly-app-2023-06-19?
438
+ *
439
+ * ┃ Includes:
440
+ * ┃ + web-px (new)
441
+ * ┃ + sub-ui-ext
442
+ * ┃ + theme-app-ext
443
+ * ┃ + paymentify (from Partner Dashboard)
444
+ * ┃
445
+ * ┃ Removes:
446
+ * ┃ - prod-discount-fun
447
+ * ┃
448
+ * ┃ This can permanently delete app user data.
449
+ *
450
+ * Type nightly-app-2023-06-19 to confirm, or press Escape
451
+ * to cancel.
452
+ * > █
453
+ * ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
454
+ *
455
+ */
456
+ export async function renderDangerousConfirmationPrompt({ renderOptions, ...props }) {
457
+ throwInNonTTY({ message: props.message, stdin: renderOptions?.stdin });
458
+ // eslint-disable-next-line prefer-rest-params
459
+ recordUIEvent({ type: 'dangerousConfirmationPrompt', properties: arguments[0] });
460
+ // eslint-disable-next-line max-params
461
+ return new Promise((resolve, reject) => {
462
+ render(React.createElement(DangerousConfirmationPrompt, { ...props, onSubmit: (value) => resolve(value) }), {
463
+ ...renderOptions,
464
+ exitOnCtrlC: false,
465
+ })
466
+ .catch(reject)
467
+ .finally(resetRecordedSleep);
468
+ });
469
+ }
405
470
  /** Renders a text string to the console.
406
471
  * Using this function makes sure that correct spacing is applied among the various components.
407
472
  * @example
@@ -1 +1 @@
1
- {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/public/node/ui.tsx"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,EAAC,UAAU,EAAE,gBAAgB,EAAuB,cAAc,EAAC,MAAM,YAAY,CAAA;AAC5F,OAAO,EACL,UAAU,EACV,YAAY,EACZ,UAAU,EAGV,aAAa,EACb,WAAW,EACX,WAAW,EACX,sBAAsB,GACvB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAC,uBAAuB,EAAC,MAAM,aAAa,CAAA;AACnD,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAC,gBAAgB,EAAwB,MAAM,sDAAsD,CAAA;AAC5G,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,0BAA0B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K,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;YAEhC,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE;gBAClC,WAAW,CAAC,wCAAwC,CAAC,CAAA;gBACrD,MAAM,CAAC,IAAI,gBAAgB,EAAE,CAAC,CAAA;aAC/B;YACD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QAC3B,CAAC,CAAA;QAED,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,CAAA;QACtB,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAA;QAC9B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAOD,SAAS,aAAa,CAAC,EAAC,OAAO,EAAE,KAAK,GAAG,SAAS,EAAuB;IACvE,IAAI,KAAK,IAAI,uBAAuB,EAAE;QAAE,OAAM;IAE9C,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAA;IAC7C,MAAM,YAAY,GAAG;;EAErB,aAAa,CAAA,GAAG,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK;;2IAEqF,CAAA;IACzI,MAAM,IAAI,UAAU,CAClB,YAAY,EACZ,mIAAmI,CACpI,CAAA;AACH,CAAC","sourcesContent":["/* eslint-disable tsdoc/syntax */\nimport {AbortError, AbortSilentError, FatalError as Fatal, FatalErrorType} from './error.js'\nimport {\n collectLog,\n consoleError,\n consoleLog,\n Logger,\n LogLevel,\n outputContent,\n outputDebug,\n outputToken,\n outputWhereAppropriate,\n} from './output.js'\nimport {isUnitTest} from './context/local.js'\nimport {terminalSupportsRawMode} from './system.js'\nimport {AbortController} from './abort.js'\nimport {ConcurrentOutput, ConcurrentOutputProps} from '../../private/node/ui/components/ConcurrentOutput.js'\nimport {render, renderOnce} from '../../private/node/ui.js'\nimport {alert, AlertOptions} from '../../private/node/ui/alert.js'\nimport {CustomSection} from '../../private/node/ui/components/Alert.js'\nimport {FatalError} from '../../private/node/ui/components/FatalError.js'\nimport ScalarDict from '../../private/node/ui/components/Table/ScalarDict.js'\nimport {Table, TableColumn, TableProps} from '../../private/node/ui/components/Table/Table.js'\nimport {\n tokenItemToString,\n InlineToken,\n LinkToken,\n ListToken,\n TokenItem,\n} from '../../private/node/ui/components/TokenizedText.js'\nimport {SelectPrompt, SelectPromptProps} from '../../private/node/ui/components/SelectPrompt.js'\nimport {Tasks, Task} from '../../private/node/ui/components/Tasks.js'\nimport {TextPrompt, TextPromptProps} from '../../private/node/ui/components/TextPrompt.js'\nimport {AutocompletePromptProps, AutocompletePrompt} from '../../private/node/ui/components/AutocompletePrompt.js'\nimport {InfoTableSection} from '../../private/node/ui/components/Prompts/InfoTable.js'\nimport {recordUIEvent, resetRecordedSleep} from '../../private/node/demo-recorder.js'\nimport React from 'react'\nimport {Key as InkKey, RenderOptions} from 'ink'\n\ntype PartialBy<T, TKey extends keyof T> = Omit<T, TKey> & Partial<Pick<T, TKey>>\n\nexport interface RenderConcurrentOptions extends PartialBy<ConcurrentOutputProps, 'abortSignal'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.\n * @example\n * 0000-00-00 00:00:00 │ backend │ first backend message\n * 0000-00-00 00:00:00 │ backend │ second backend message\n * 0000-00-00 00:00:00 │ backend │ third backend message\n * 0000-00-00 00:00:00 │ frontend │ first frontend message\n * 0000-00-00 00:00:00 │ frontend │ second frontend message\n * 0000-00-00 00:00:00 │ frontend │ third frontend message\n *\n * › Press p │ preview in your browser\n * › Press q │ quit.\n *\n * Preview URL: https://shopify.com\n *\n */\nexport async function renderConcurrent({renderOptions, ...props}: RenderConcurrentOptions) {\n const abortSignal = props.abortSignal ?? new AbortController().signal\n\n if (terminalSupportsRawMode(renderOptions?.stdin)) {\n return render(<ConcurrentOutput {...props} abortSignal={abortSignal} />, {\n ...renderOptions,\n exitOnCtrlC: typeof props.onInput === 'undefined',\n })\n } else {\n return Promise.all(\n props.processes.map(async (concurrentProcess) => {\n await concurrentProcess.action(process.stdout, process.stderr, abortSignal)\n }),\n )\n }\n}\n\nexport type AlertCustomSection = CustomSection\nexport type RenderAlertOptions = Omit<AlertOptions, 'type'>\n\n/**\n * Renders an information banner to the console.\n * @example Basic\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ CLI update available. │\n * │ │\n * │ Run `npm run shopify upgrade`. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ my-app initialized and ready to build. │\n * │ │\n * │ Next steps │\n * │ • Run `cd verification-app` │\n * │ • To preview your project, run `npm app dev` │\n * │ • To add extensions, run `npm generate extension` │\n * │ │\n * │ Reference │\n * │ • Run `npm shopify help` │\n * │ • Dev docs [1] │\n * │ │\n * │ Custom section │\n * │ • Item 1 [2] │\n * │ • Item 2 │\n * │ • Item 3 [3] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://shopify.dev\n * [2] https://www.google.com/search?q=jh56t9l34kpo35tw8s28hn7s\n * 9s2xvzla01d8cn6j7yq&rlz=1C1GCEU_enUS832US832&oq=jh56t9l34kpo\n * 35tw8s28hn7s9s2xvzla01d8cn6j7yq&aqs=chrome.0.35i39l2j0l4j46j\n * 69i60.2711j0j7&sourceid=chrome&ie=UTF-8\n * [3] https://shopify.com\n *\n */\nexport function renderInfo(options: RenderAlertOptions) {\n return alert({...options, type: 'info'})\n}\n\n/**\n * Renders a success banner to the console.\n * @example Basic\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ CLI updated. │\n * │ │\n * │ You are now running version 3.47. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Deployment successful. │\n * │ │\n * │ Your extensions have been uploaded to your Shopify │\n * │ Partners Dashboard. │\n * │ │\n * │ Next steps │\n * │ • See your deployment and set it live [1] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://partners.shopify.com/1797046/apps/4523695/deploy\n * ments\n *\n */\nexport function renderSuccess(options: RenderAlertOptions) {\n return alert({...options, type: 'success'})\n}\n\n/**\n * Renders a warning banner to the console.\n * @example Basic\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ You have reached your limit of checkout extensions for │\n * │ this app. │\n * │ │\n * │ You can free up space for a new one by deleting an │\n * │ existing one. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Required access scope update. │\n * │ │\n * │ The deadline for re-selecting your app scopes is May │\n * │ 1, 2022. │\n * │ │\n * │ Reference │\n * │ • Dev docs [1] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://shopify.dev/app/scopes\n *\n */\nexport function renderWarning(options: RenderAlertOptions) {\n return alert({...options, type: 'warning'})\n}\n\ninterface RenderFatalErrorOptions {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a Fatal error to the console inside a banner.\n * @example Basic\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Something went wrong. │\n * │ │\n * │ To investigate the issue, examine this stack trace: │\n * │ at _compile (internal/modules/cjs/loader.js:1137) │\n * │ at js (internal/modules/cjs/loader.js:1157) │\n * │ at load (internal/modules/cjs/loader.js:985) │\n * │ at _load (internal/modules/cjs/loader.js:878) │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ No Organization found │\n * │ │\n * │ Next steps │\n * │ • Have you created a Shopify Partners organization │\n * │ [1]? │\n * │ • Have you confirmed your accounts from the emails │\n * │ you received? │\n * │ • Need to connect to a different App or │\n * │ organization? Run the command again with `--reset` │\n * │ │\n * │ amortizable-marketplace-ext │\n * │ • Some other error │\n * │ Validation errors │\n * │ • Missing expected key(s). │\n * │ │\n * │ amortizable-marketplace-ext-2 │\n * │ • Something was not found │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://partners.shopify.com/signup\n *\n */\n// eslint-disable-next-line max-params\nexport function renderFatalError(error: Fatal, {renderOptions}: RenderFatalErrorOptions = {}) {\n recordUIEvent({\n type: 'fatalError',\n properties: {...error, errorType: error.type === FatalErrorType.Bug ? 'bug' : 'abort'},\n })\n\n return renderOnce(<FatalError error={error} />, {logLevel: 'error', logger: consoleError, renderOptions})\n}\n\nexport interface RenderSelectPromptOptions<T> extends Omit<SelectPromptProps<T>, 'onSubmit'> {\n isConfirmationPrompt?: boolean\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a select prompt to the console.\n * @example\n * ? Associate your project with the org Castile Ventures?\n *\n * Add: • new-ext\n *\n * Remove: • integrated-demand-ext\n * • order-discount\n *\n * Automations\n * > (a) fifth\n * (2) sixth\n *\n * Merchant Admin\n * (3) eighth\n * (4) ninth\n *\n * Other\n * (f) first\n * (s) second\n * (7) third (limit reached)\n * (8) fourth\n * (9) seventh\n * (10) tenth\n *\n * Press ↑↓ arrows to select, enter to confirm\n *\n */\nexport async function renderSelectPrompt<T>({\n renderOptions,\n isConfirmationPrompt,\n ...props\n}: RenderSelectPromptOptions<T>): Promise<T> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin})\n\n if (!isConfirmationPrompt) {\n recordUIEvent({type: 'selectPrompt', properties: {renderOptions, ...props}})\n }\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<SelectPrompt {...props} onSubmit={(value: T) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .catch(reject)\n .finally(resetRecordedSleep)\n })\n}\n\nexport interface RenderConfirmationPromptOptions\n extends Pick<SelectPromptProps<boolean>, 'message' | 'infoTable' | 'gitDiff' | 'abortSignal'> {\n confirmationMessage?: string\n cancellationMessage?: string\n renderOptions?: RenderOptions\n defaultValue?: boolean\n}\n\n/**\n * Renders a confirmation prompt to the console.\n * @example\n * ? Delete the following themes from the store?\n *\n * • first theme (#1)\n * • second theme (#2)\n *\n * > (y) Yes, confirm changes\n * (n) Cancel\n *\n * Press ↑↓ arrows to select, enter or a shortcut to confirm\n *\n */\nexport async function renderConfirmationPrompt({\n message,\n infoTable,\n gitDiff,\n confirmationMessage = 'Yes, confirm',\n cancellationMessage = 'No, cancel',\n renderOptions,\n defaultValue = true,\n abortSignal,\n}: RenderConfirmationPromptOptions): Promise<boolean> {\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'confirmationPrompt', properties: arguments[0]})\n\n const choices = [\n {\n label: confirmationMessage,\n value: true,\n key: 'y',\n },\n {\n label: cancellationMessage,\n value: false,\n key: 'n',\n },\n ]\n\n return renderSelectPrompt({\n choices,\n message,\n infoTable,\n gitDiff,\n submitWithShortcuts: true,\n renderOptions,\n defaultValue,\n isConfirmationPrompt: true,\n abortSignal,\n })\n}\n\nexport interface RenderAutocompleteOptions<T>\n extends PartialBy<Omit<AutocompletePromptProps<T>, 'onSubmit'>, 'search'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders an autocomplete prompt to the console.\n * @example\n * ? Select a template: Type to search...\n *\n * > first\n * second\n * third\n * fourth\n * fifth\n * sixth\n * seventh\n * eighth\n * ninth\n * tenth\n * eleventh\n * twelfth\n * thirteenth\n * fourteenth\n * fifteenth\n * sixteenth\n * seventeenth\n * eighteenth\n * nineteenth (disabled)\n * twentieth\n * twenty-first\n * twenty-second\n * twenty-third\n * twenty-fourth\n * twenty-fifth\n *\n * Press ↑↓ arrows to select, enter to confirm\n *\n */\nexport async function renderAutocompletePrompt<T>({renderOptions, ...props}: RenderAutocompleteOptions<T>): Promise<T> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin})\n\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'autocompletePrompt', properties: arguments[0]})\n\n const newProps = {\n search(term: string) {\n return Promise.resolve({\n data: props.choices.filter((item) => item.label.toLowerCase().includes(term.toLowerCase())),\n })\n },\n ...props,\n }\n\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<AutocompletePrompt {...newProps} onSubmit={(value: T) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .catch(reject)\n .finally(resetRecordedSleep)\n })\n}\n\ninterface RenderTableOptions<T extends ScalarDict> extends TableProps<T> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a table to the console.\n * @example\n * ID Name email\n * ── ────────── ─────────────\n * 1 John Doe jon@doe.com\n * 2 Jane Doe jane@doe.com\n * 3 John Smith jon@smith.com\n */\nexport function renderTable<T extends ScalarDict>({renderOptions, ...props}: RenderTableOptions<T>) {\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'table', properties: arguments[0]})\n\n return renderOnce(<Table {...props} />, {renderOptions})\n}\n\ninterface RenderTasksOptions {\n renderOptions?: RenderOptions\n}\n\n/**\n * Runs async tasks and displays their progress to the console.\n * @example\n * ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n * Installing dependencies ...\n */\n// eslint-disable-next-line max-params\nexport async function renderTasks<TContext>(tasks: Task<TContext>[], {renderOptions}: RenderTasksOptions = {}) {\n recordUIEvent({\n type: 'taskbar',\n properties: {\n // Rather than timing exactly, pretend each step takes 2 seconds. This\n // should be easy to tweak manually.\n steps: tasks.map((task) => {\n return {title: task.title, duration: 2}\n }),\n },\n })\n\n // eslint-disable-next-line max-params\n return new Promise<TContext>((resolve, reject) => {\n render(<Tasks tasks={tasks} onComplete={resolve} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .then(() => resetRecordedSleep())\n .catch(reject)\n })\n}\n\nexport interface RenderTextPromptOptions extends Omit<TextPromptProps, 'onSubmit'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a text prompt to the console.\n * @example\n * ? App project name (can be changed later):\n * > expansive commerce app\n * ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n *\n */\nexport async function renderTextPrompt({renderOptions, ...props}: RenderTextPromptOptions): Promise<string> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin})\n\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'textPrompt', properties: arguments[0]})\n\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<TextPrompt {...props} onSubmit={(value: string) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .catch(reject)\n .finally(resetRecordedSleep)\n })\n}\n\ninterface RenderTextOptions {\n text: string\n logLevel?: LogLevel\n logger?: Logger\n}\n\n/** Renders a text string to the console.\n * Using this function makes sure that correct spacing is applied among the various components.\n * @example\n * Hello world!\n *\n */\nexport function renderText({text, logLevel = 'info', logger = consoleLog}: RenderTextOptions) {\n let textWithLineReturn = text\n if (!text.endsWith('\\n')) textWithLineReturn += '\\n'\n\n if (isUnitTest()) collectLog(logLevel, textWithLineReturn)\n outputWhereAppropriate(logLevel, logger, textWithLineReturn)\n return textWithLineReturn\n}\n\n/** Waits for any key to be pressed except Ctrl+C which will terminate the process. */\nexport const keypress = async () => {\n throwInNonTTY({message: 'Press any key'})\n\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n const handler = (buffer: Buffer) => {\n process.stdin.setRawMode(false)\n process.stdin.pause()\n\n const bytes = Array.from(buffer)\n\n if (bytes.length && bytes[0] === 3) {\n outputDebug('Canceled keypress, User pressed CTRL+C')\n reject(new AbortSilentError())\n }\n process.nextTick(resolve)\n }\n\n process.stdin.resume()\n process.stdin.setRawMode(true)\n process.stdin.once('data', handler)\n })\n}\n\ninterface ThrowInNonTTYOptions {\n message: TokenItem\n stdin?: NodeJS.ReadStream\n}\n\nfunction throwInNonTTY({message, stdin = undefined}: ThrowInNonTTYOptions) {\n if (stdin || terminalSupportsRawMode()) return\n\n const promptText = tokenItemToString(message)\n const errorMessage = `Failed to prompt:\n\n${outputContent`${outputToken.cyan(promptText)}`.value}\n\nThis usually happens when running a command non-interactively, for example in a CI environment, or when piping input from another process.`\n throw new AbortError(\n errorMessage,\n 'To resolve this, specify the option in the command, or run the command in an interactive environment such as your local terminal.',\n )\n}\n\nexport type Key = InkKey\nexport {Task, TokenItem, InlineToken, LinkToken, TableColumn, InfoTableSection, ListToken}\n"]}
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/public/node/ui.tsx"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,OAAO,EAAC,UAAU,EAAE,gBAAgB,EAAuB,cAAc,EAAC,MAAM,YAAY,CAAA;AAC5F,OAAO,EACL,UAAU,EACV,YAAY,EACZ,UAAU,EAGV,aAAa,EACb,WAAW,EACX,WAAW,EACX,sBAAsB,GACvB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAC,uBAAuB,EAAC,MAAM,aAAa,CAAA;AACnD,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAA;AAC1C,OAAO,EAAC,gBAAgB,EAAwB,MAAM,sDAAsD,CAAA;AAC5G,OAAO,EAAC,MAAM,EAAE,UAAU,EAAC,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAC,KAAK,EAAe,MAAM,gCAAgC,CAAA;AAElE,OAAO,EAAC,UAAU,EAAC,MAAM,gDAAgD,CAAA;AAEzE,OAAO,EAAC,KAAK,EAA0B,MAAM,iDAAiD,CAAA;AAC9F,OAAO,EACL,iBAAiB,GAKlB,MAAM,mDAAmD,CAAA;AAC1D,OAAO,EACL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I,CAAC,CAAA;QAC9B,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACrC,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAOD,SAAS,aAAa,CAAC,EAAC,OAAO,EAAE,KAAK,GAAG,SAAS,EAAuB;IACvE,IAAI,KAAK,IAAI,uBAAuB,EAAE;QAAE,OAAM;IAE9C,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAA;IAC7C,MAAM,YAAY,GAAG;;EAErB,aAAa,CAAA,GAAG,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK;;2IAEqF,CAAA;IACzI,MAAM,IAAI,UAAU,CAClB,YAAY,EACZ,mIAAmI,CACpI,CAAA;AACH,CAAC","sourcesContent":["/* eslint-disable tsdoc/syntax */\nimport {AbortError, AbortSilentError, FatalError as Fatal, FatalErrorType} from './error.js'\nimport {\n collectLog,\n consoleError,\n consoleLog,\n Logger,\n LogLevel,\n outputContent,\n outputDebug,\n outputToken,\n outputWhereAppropriate,\n} from './output.js'\nimport {isUnitTest} from './context/local.js'\nimport {terminalSupportsRawMode} from './system.js'\nimport {AbortController} from './abort.js'\nimport {ConcurrentOutput, ConcurrentOutputProps} from '../../private/node/ui/components/ConcurrentOutput.js'\nimport {render, renderOnce} from '../../private/node/ui.js'\nimport {alert, AlertOptions} from '../../private/node/ui/alert.js'\nimport {CustomSection} from '../../private/node/ui/components/Alert.js'\nimport {FatalError} from '../../private/node/ui/components/FatalError.js'\nimport ScalarDict from '../../private/node/ui/components/Table/ScalarDict.js'\nimport {Table, TableColumn, TableProps} from '../../private/node/ui/components/Table/Table.js'\nimport {\n tokenItemToString,\n InlineToken,\n LinkToken,\n ListToken,\n TokenItem,\n} from '../../private/node/ui/components/TokenizedText.js'\nimport {\n DangerousConfirmationPrompt,\n DangerousConfirmationPromptProps,\n} from '../../private/node/ui/components/DangerousConfirmationPrompt.js'\nimport {SelectPrompt, SelectPromptProps} from '../../private/node/ui/components/SelectPrompt.js'\nimport {Tasks, Task} from '../../private/node/ui/components/Tasks.js'\nimport {TextPrompt, TextPromptProps} from '../../private/node/ui/components/TextPrompt.js'\nimport {AutocompletePromptProps, AutocompletePrompt} from '../../private/node/ui/components/AutocompletePrompt.js'\nimport {InfoTableSection} from '../../private/node/ui/components/Prompts/InfoTable.js'\nimport {recordUIEvent, resetRecordedSleep} from '../../private/node/demo-recorder.js'\nimport {InfoMessageProps} from '../../private/node/ui/components/Prompts/InfoMessage.js'\nimport React from 'react'\nimport {Key as InkKey, RenderOptions} from 'ink'\n\ntype PartialBy<T, TKey extends keyof T> = Omit<T, TKey> & Partial<Pick<T, TKey>>\n\nexport interface RenderConcurrentOptions extends PartialBy<ConcurrentOutputProps, 'abortSignal'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders output from concurrent processes to the terminal with {@link ConcurrentOutput}.\n * @example\n * 00:00:00 │ backend │ first backend message\n * 00:00:00 │ backend │ second backend message\n * 00:00:00 │ backend │ third backend message\n * 00:00:00 │ frontend │ first frontend message\n * 00:00:00 │ frontend │ second frontend message\n * 00:00:00 │ frontend │ third frontend message\n *\n * › Press p │ preview in your browser\n * › Press q │ quit.\n *\n * Preview URL: https://shopify.com\n *\n */\nexport async function renderConcurrent({renderOptions, ...props}: RenderConcurrentOptions) {\n const abortSignal = props.abortSignal ?? new AbortController().signal\n\n if (terminalSupportsRawMode(renderOptions?.stdin)) {\n return render(<ConcurrentOutput {...props} abortSignal={abortSignal} />, {\n ...renderOptions,\n exitOnCtrlC: typeof props.onInput === 'undefined',\n })\n } else {\n return Promise.all(\n props.processes.map(async (concurrentProcess) => {\n await concurrentProcess.action(process.stdout, process.stderr, abortSignal)\n }),\n )\n }\n}\n\nexport type AlertCustomSection = CustomSection\nexport type RenderAlertOptions = Omit<AlertOptions, 'type'>\n\n/**\n * Renders an information banner to the console.\n * @example Basic\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ CLI update available. │\n * │ │\n * │ Run `npm run shopify upgrade`. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ info ───────────────────────────────────────────────────╮\n * │ │\n * │ my-app initialized and ready to build. │\n * │ │\n * │ Next steps │\n * │ • Run `cd verification-app` │\n * │ • To preview your project, run `npm app dev` │\n * │ • To add extensions, run `npm generate extension` │\n * │ │\n * │ Reference │\n * │ • Run `npm shopify help` │\n * │ • Dev docs [1] │\n * │ │\n * │ Custom section │\n * │ • Item 1 [2] │\n * │ • Item 2 │\n * │ • Item 3 [3] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://shopify.dev\n * [2] https://www.google.com/search?q=jh56t9l34kpo35tw8s28hn7s\n * 9s2xvzla01d8cn6j7yq&rlz=1C1GCEU_enUS832US832&oq=jh56t9l34kpo\n * 35tw8s28hn7s9s2xvzla01d8cn6j7yq&aqs=chrome.0.35i39l2j0l4j46j\n * 69i60.2711j0j7&sourceid=chrome&ie=UTF-8\n * [3] https://shopify.com\n *\n */\nexport function renderInfo(options: RenderAlertOptions) {\n return alert({...options, type: 'info'})\n}\n\n/**\n * Renders a success banner to the console.\n * @example Basic\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ CLI updated. │\n * │ │\n * │ You are now running version 3.47. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ success ────────────────────────────────────────────────╮\n * │ │\n * │ Deployment successful. │\n * │ │\n * │ Your extensions have been uploaded to your Shopify │\n * │ Partners Dashboard. │\n * │ │\n * │ Next steps │\n * │ • See your deployment and set it live [1] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://partners.shopify.com/1797046/apps/4523695/deploy\n * ments\n *\n */\nexport function renderSuccess(options: RenderAlertOptions) {\n return alert({...options, type: 'success'})\n}\n\n/**\n * Renders a warning banner to the console.\n * @example Basic\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ You have reached your limit of checkout extensions for │\n * │ this app. │\n * │ │\n * │ You can free up space for a new one by deleting an │\n * │ existing one. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ warning ────────────────────────────────────────────────╮\n * │ │\n * │ Required access scope update. │\n * │ │\n * │ The deadline for re-selecting your app scopes is May │\n * │ 1, 2022. │\n * │ │\n * │ Reference │\n * │ • Dev docs [1] │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://shopify.dev/app/scopes\n *\n */\nexport function renderWarning(options: RenderAlertOptions) {\n return alert({...options, type: 'warning'})\n}\n\n/**\n * Renders an error banner to the console.\n * @example\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Version couldn't be released. │\n * │ │\n * │ This version needs to be submitted for review and │\n * │ approved by Shopify before it can be released. │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n */\nexport function renderError(options: RenderAlertOptions) {\n return alert({...options, type: 'error'})\n}\n\ninterface RenderFatalErrorOptions {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a Fatal error to the console inside a banner.\n * @example Basic\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ Something went wrong. │\n * │ │\n * │ To investigate the issue, examine this stack trace: │\n * │ at _compile (internal/modules/cjs/loader.js:1137) │\n * │ at js (internal/modules/cjs/loader.js:1157) │\n * │ at load (internal/modules/cjs/loader.js:985) │\n * │ at _load (internal/modules/cjs/loader.js:878) │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n *\n * @example Complete\n * ╭─ error ──────────────────────────────────────────────────╮\n * │ │\n * │ No Organization found │\n * │ │\n * │ Next steps │\n * │ • Have you created a Shopify Partners organization │\n * │ [1]? │\n * │ • Have you confirmed your accounts from the emails │\n * │ you received? │\n * │ • Need to connect to a different App or │\n * │ organization? Run the command again with `--reset` │\n * │ │\n * │ amortizable-marketplace-ext │\n * │ • Some other error │\n * │ Validation errors │\n * │ • Missing expected key(s). │\n * │ │\n * │ amortizable-marketplace-ext-2 │\n * │ • Something was not found │\n * │ │\n * ╰──────────────────────────────────────────────────────────╯\n * [1] https://partners.shopify.com/signup\n *\n */\n// eslint-disable-next-line max-params\nexport function renderFatalError(error: Fatal, {renderOptions}: RenderFatalErrorOptions = {}) {\n recordUIEvent({\n type: 'fatalError',\n properties: {...error, errorType: error.type === FatalErrorType.Bug ? 'bug' : 'abort'},\n })\n\n return renderOnce(<FatalError error={error} />, {logLevel: 'error', logger: consoleError, renderOptions})\n}\n\nexport interface RenderSelectPromptOptions<T> extends Omit<SelectPromptProps<T>, 'onSubmit'> {\n isConfirmationPrompt?: boolean\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a select prompt to the console.\n * @example\n * ? Associate your project with the org Castile Ventures?\n *\n * ┃ Add\n * ┃ • new-ext\n * ┃\n * ┃ Remove\n * ┃ • integrated-demand-ext\n * ┃ • order-discount\n *\n * Automations\n * > fifth\n * sixth\n *\n * Merchant Admin\n * eighth\n * ninth\n *\n * Other\n * first\n * second\n * third (limit reached)\n * fourth\n * seventh\n * tenth\n *\n * Press ↑↓ arrows to select, enter to confirm.\n *\n */\nexport async function renderSelectPrompt<T>({\n renderOptions,\n isConfirmationPrompt,\n ...props\n}: RenderSelectPromptOptions<T>): Promise<T> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin})\n\n if (!isConfirmationPrompt) {\n recordUIEvent({type: 'selectPrompt', properties: {renderOptions, ...props}})\n }\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<SelectPrompt {...props} onSubmit={(value: T) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .catch(reject)\n .finally(resetRecordedSleep)\n })\n}\n\nexport interface RenderConfirmationPromptOptions\n extends Pick<SelectPromptProps<boolean>, 'message' | 'infoTable' | 'infoMessage' | 'gitDiff' | 'abortSignal'> {\n confirmationMessage?: string\n cancellationMessage?: string\n renderOptions?: RenderOptions\n defaultValue?: boolean\n}\n\n/**\n * Renders a confirmation prompt to the console.\n * @example\n * ? Delete the following themes from the store?\n *\n * ┃ Info message title\n * ┃\n * ┃ Info message body\n * ┃\n * ┃ • first theme (#1)\n * ┃ • second theme (#2)\n *\n * > (y) Yes, confirm changes\n * (n) Cancel\n *\n * Press ↑↓ arrows to select, enter or a shortcut to\n * confirm.\n *\n */\nexport async function renderConfirmationPrompt({\n message,\n infoTable,\n gitDiff,\n confirmationMessage = 'Yes, confirm',\n cancellationMessage = 'No, cancel',\n renderOptions,\n defaultValue = true,\n abortSignal,\n infoMessage,\n}: RenderConfirmationPromptOptions): Promise<boolean> {\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'confirmationPrompt', properties: arguments[0]})\n\n const choices = [\n {\n label: confirmationMessage,\n value: true,\n key: 'y',\n },\n {\n label: cancellationMessage,\n value: false,\n key: 'n',\n },\n ]\n\n return renderSelectPrompt({\n choices,\n message,\n infoTable,\n gitDiff,\n renderOptions,\n defaultValue,\n isConfirmationPrompt: true,\n abortSignal,\n infoMessage,\n })\n}\n\nexport interface RenderAutocompleteOptions<T>\n extends PartialBy<Omit<AutocompletePromptProps<T>, 'onSubmit'>, 'search'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders an autocomplete prompt to the console.\n * @example\n * ? Select a template: Type to search...\n *\n * ┃ Info message title\n * ┃\n * ┃ Info message body\n *\n * > first\n * second\n * third\n * fourth\n * fifth\n * sixth\n * seventh\n * eighth\n * ninth\n * tenth\n * eleventh\n * twelfth\n * thirteenth\n * fourteenth\n * fifteenth\n * sixteenth\n * seventeenth\n * eighteenth\n * nineteenth (disabled)\n * twentieth\n * twenty-first\n * twenty-second\n * twenty-third\n * twenty-fourth\n * twenty-fifth\n *\n * Press ↑↓ arrows to select, enter to confirm.\n *\n */\nexport async function renderAutocompletePrompt<T>({renderOptions, ...props}: RenderAutocompleteOptions<T>): Promise<T> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin})\n\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'autocompletePrompt', properties: arguments[0]})\n\n const newProps = {\n search(term: string) {\n const lowerTerm = term.toLowerCase()\n return Promise.resolve({\n data: props.choices.filter((item) => {\n return (\n item.label.toLowerCase().includes(lowerTerm) || (item.group && item.group.toLowerCase().includes(lowerTerm))\n )\n }),\n })\n },\n ...props,\n }\n\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<AutocompletePrompt {...newProps} onSubmit={(value: T) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .catch(reject)\n .finally(resetRecordedSleep)\n })\n}\n\ninterface RenderTableOptions<T extends ScalarDict> extends TableProps<T> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a table to the console.\n * @example\n * ID Name email\n * ── ────────── ─────────────\n * 1 John Doe jon@doe.com\n * 2 Jane Doe jane@doe.com\n * 3 John Smith jon@smith.com\n */\nexport function renderTable<T extends ScalarDict>({renderOptions, ...props}: RenderTableOptions<T>) {\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'table', properties: arguments[0]})\n\n return renderOnce(<Table {...props} />, {renderOptions})\n}\n\ninterface RenderTasksOptions {\n renderOptions?: RenderOptions\n}\n\n/**\n * Runs async tasks and displays their progress to the console.\n * @example\n * ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\n * Installing dependencies ...\n */\n// eslint-disable-next-line max-params\nexport async function renderTasks<TContext>(tasks: Task<TContext>[], {renderOptions}: RenderTasksOptions = {}) {\n recordUIEvent({\n type: 'taskbar',\n properties: {\n // Rather than timing exactly, pretend each step takes 2 seconds. This\n // should be easy to tweak manually.\n steps: tasks.map((task) => {\n return {title: task.title, duration: 2}\n }),\n },\n })\n\n // eslint-disable-next-line max-params\n return new Promise<TContext>((resolve, reject) => {\n render(<Tasks tasks={tasks} onComplete={resolve} />, renderOptions)\n .then(() => resetRecordedSleep())\n .catch(reject)\n })\n}\n\nexport interface RenderTextPromptOptions extends Omit<TextPromptProps, 'onSubmit'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a text prompt to the console.\n * @example\n * ? App project name (can be changed later):\n * > expansive commerce app\n * ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n *\n */\nexport async function renderTextPrompt({renderOptions, ...props}: RenderTextPromptOptions): Promise<string> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin})\n\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'textPrompt', properties: arguments[0]})\n\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<TextPrompt {...props} onSubmit={(value: string) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .catch(reject)\n .finally(resetRecordedSleep)\n })\n}\n\nexport interface RenderDangerousConfirmationPromptOptions extends Omit<DangerousConfirmationPromptProps, 'onSubmit'> {\n renderOptions?: RenderOptions\n}\n\n/**\n * Renders a dangerous confirmation prompt to the console, forcing the user to\n * type a confirmation string to proceed.\n * @example\n * ? Release a new version of nightly-app-2023-06-19?\n *\n * ┃ Includes:\n * ┃ + web-px (new)\n * ┃ + sub-ui-ext\n * ┃ + theme-app-ext\n * ┃ + paymentify (from Partner Dashboard)\n * ┃\n * ┃ Removes:\n * ┃ - prod-discount-fun\n * ┃\n * ┃ This can permanently delete app user data.\n *\n * Type nightly-app-2023-06-19 to confirm, or press Escape\n * to cancel.\n * > █\n * ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n *\n */\nexport async function renderDangerousConfirmationPrompt({\n renderOptions,\n ...props\n}: RenderDangerousConfirmationPromptOptions): Promise<boolean> {\n throwInNonTTY({message: props.message, stdin: renderOptions?.stdin})\n\n // eslint-disable-next-line prefer-rest-params\n recordUIEvent({type: 'dangerousConfirmationPrompt', properties: arguments[0]})\n\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n render(<DangerousConfirmationPrompt {...props} onSubmit={(value: boolean) => resolve(value)} />, {\n ...renderOptions,\n exitOnCtrlC: false,\n })\n .catch(reject)\n .finally(resetRecordedSleep)\n })\n}\n\ninterface RenderTextOptions {\n text: string\n logLevel?: LogLevel\n logger?: Logger\n}\n\n/** Renders a text string to the console.\n * Using this function makes sure that correct spacing is applied among the various components.\n * @example\n * Hello world!\n *\n */\nexport function renderText({text, logLevel = 'info', logger = consoleLog}: RenderTextOptions) {\n let textWithLineReturn = text\n if (!text.endsWith('\\n')) textWithLineReturn += '\\n'\n\n if (isUnitTest()) collectLog(logLevel, textWithLineReturn)\n outputWhereAppropriate(logLevel, logger, textWithLineReturn)\n return textWithLineReturn\n}\n\n/** Waits for any key to be pressed except Ctrl+C which will terminate the process. */\nexport const keypress = async () => {\n throwInNonTTY({message: 'Press any key'})\n\n // eslint-disable-next-line max-params\n return new Promise((resolve, reject) => {\n const handler = (buffer: Buffer) => {\n process.stdin.setRawMode(false)\n process.stdin.pause()\n\n const bytes = Array.from(buffer)\n\n if (bytes.length && bytes[0] === 3) {\n outputDebug('Canceled keypress, User pressed CTRL+C')\n reject(new AbortSilentError())\n }\n process.nextTick(resolve)\n }\n\n process.stdin.resume()\n process.stdin.setRawMode(true)\n process.stdin.once('data', handler)\n })\n}\n\ninterface ThrowInNonTTYOptions {\n message: TokenItem\n stdin?: NodeJS.ReadStream\n}\n\nfunction throwInNonTTY({message, stdin = undefined}: ThrowInNonTTYOptions) {\n if (stdin || terminalSupportsRawMode()) return\n\n const promptText = tokenItemToString(message)\n const errorMessage = `Failed to prompt:\n\n${outputContent`${outputToken.cyan(promptText)}`.value}\n\nThis usually happens when running a command non-interactively, for example in a CI environment, or when piping input from another process.`\n throw new AbortError(\n errorMessage,\n 'To resolve this, specify the option in the command, or run the command in an interactive environment such as your local terminal.',\n )\n}\n\nexport type Key = InkKey\nexport type InfoMessage = InfoMessageProps['message']\nexport {Task, TokenItem, InlineToken, LinkToken, TableColumn, InfoTableSection, ListToken}\n"]}