@wix/bex-core 2.327.0 → 2.329.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 (184) hide show
  1. package/dist/cjs/assets/locale/messages_ar.json +12 -0
  2. package/dist/cjs/assets/locale/messages_bg.json +12 -0
  3. package/dist/cjs/assets/locale/messages_ca.json +12 -0
  4. package/dist/cjs/assets/locale/messages_cs.json +12 -0
  5. package/dist/cjs/assets/locale/messages_da.json +17 -5
  6. package/dist/cjs/assets/locale/messages_de.json +12 -0
  7. package/dist/cjs/assets/locale/messages_el.json +12 -0
  8. package/dist/cjs/assets/locale/messages_en.json +12 -0
  9. package/dist/cjs/assets/locale/messages_es.json +16 -4
  10. package/dist/cjs/assets/locale/messages_fi.json +12 -0
  11. package/dist/cjs/assets/locale/messages_fr.json +12 -0
  12. package/dist/cjs/assets/locale/messages_he.json +12 -0
  13. package/dist/cjs/assets/locale/messages_hi.json +17 -5
  14. package/dist/cjs/assets/locale/messages_hu.json +12 -0
  15. package/dist/cjs/assets/locale/messages_id.json +17 -5
  16. package/dist/cjs/assets/locale/messages_it.json +17 -5
  17. package/dist/cjs/assets/locale/messages_ja.json +12 -0
  18. package/dist/cjs/assets/locale/messages_ko.json +17 -5
  19. package/dist/cjs/assets/locale/messages_lt.json +12 -0
  20. package/dist/cjs/assets/locale/messages_ms.json +12 -0
  21. package/dist/cjs/assets/locale/messages_nl.json +16 -4
  22. package/dist/cjs/assets/locale/messages_no.json +12 -0
  23. package/dist/cjs/assets/locale/messages_pl.json +12 -0
  24. package/dist/cjs/assets/locale/messages_pt.json +16 -4
  25. package/dist/cjs/assets/locale/messages_ro.json +12 -0
  26. package/dist/cjs/assets/locale/messages_ru.json +12 -0
  27. package/dist/cjs/assets/locale/messages_sk.json +12 -0
  28. package/dist/cjs/assets/locale/messages_sl.json +12 -0
  29. package/dist/cjs/assets/locale/messages_sv.json +17 -5
  30. package/dist/cjs/assets/locale/messages_th.json +17 -5
  31. package/dist/cjs/assets/locale/messages_tl.json +12 -0
  32. package/dist/cjs/assets/locale/messages_tr.json +17 -5
  33. package/dist/cjs/assets/locale/messages_uk.json +12 -0
  34. package/dist/cjs/assets/locale/messages_vi.json +17 -5
  35. package/dist/cjs/assets/locale/messages_zh.json +12 -0
  36. package/dist/cjs/assets/locale/version_file +1 -1
  37. package/dist/cjs/assets/visual-e2e-locale/messages_visuale2e.json +4 -1
  38. package/dist/cjs/hooks/useImport.js +7 -5
  39. package/dist/cjs/hooks/useImport.js.map +1 -1
  40. package/dist/cjs/hooks/useImportConfig.js.map +1 -1
  41. package/dist/cjs/services/translations.js.map +1 -1
  42. package/dist/cjs/state/ImportState/ImportState.js +363 -109
  43. package/dist/cjs/state/ImportState/ImportState.js.map +1 -1
  44. package/dist/cjs/state/ImportState/__tests__/ImportState.engine.spec.js +536 -0
  45. package/dist/cjs/state/ImportState/__tests__/ImportState.engine.spec.js.map +1 -0
  46. package/dist/cjs/state/ImportState/__tests__/hubJobClient.spec.js +209 -0
  47. package/dist/cjs/state/ImportState/__tests__/hubJobClient.spec.js.map +1 -0
  48. package/dist/cjs/state/ImportState/__tests__/importJobPoller.spec.js +86 -0
  49. package/dist/cjs/state/ImportState/__tests__/importJobPoller.spec.js.map +1 -0
  50. package/dist/cjs/state/ImportState/__tests__/parseCsv.spec.js +52 -0
  51. package/dist/cjs/state/ImportState/__tests__/parseCsv.spec.js.map +1 -0
  52. package/dist/cjs/state/ImportState/__tests__/rewriteCsv.spec.js +81 -0
  53. package/dist/cjs/state/ImportState/__tests__/rewriteCsv.spec.js.map +1 -0
  54. package/dist/cjs/state/ImportState/fieldEdit.js +46 -0
  55. package/dist/cjs/state/ImportState/fieldEdit.js.map +1 -0
  56. package/dist/cjs/state/ImportState/hubJobClient.js +101 -0
  57. package/dist/cjs/state/ImportState/hubJobClient.js.map +1 -0
  58. package/dist/cjs/state/ImportState/importJobPoller.js +44 -0
  59. package/dist/cjs/state/ImportState/importJobPoller.js.map +1 -0
  60. package/dist/cjs/state/ImportState/index.js +12 -0
  61. package/dist/cjs/state/ImportState/index.js.map +1 -1
  62. package/dist/cjs/state/ImportState/parseCsv.js +39 -10
  63. package/dist/cjs/state/ImportState/parseCsv.js.map +1 -1
  64. package/dist/cjs/state/ImportState/rewriteCsv.js +46 -0
  65. package/dist/cjs/state/ImportState/rewriteCsv.js.map +1 -0
  66. package/dist/cjs/testkit/WixPatternsContainer.driver.js +4 -1
  67. package/dist/cjs/testkit/WixPatternsContainer.driver.js.map +1 -1
  68. package/dist/cjs/testkit/client.js +6 -0
  69. package/dist/cjs/testkit/client.js.map +1 -1
  70. package/dist/cjs/testkit/hubJobImportMocks.js +166 -0
  71. package/dist/cjs/testkit/hubJobImportMocks.js.map +1 -0
  72. package/dist/cjs/testkit/index.js +6 -0
  73. package/dist/cjs/testkit/index.js.map +1 -1
  74. package/dist/esm/assets/locale/messages_ar.json +12 -0
  75. package/dist/esm/assets/locale/messages_bg.json +12 -0
  76. package/dist/esm/assets/locale/messages_ca.json +12 -0
  77. package/dist/esm/assets/locale/messages_cs.json +12 -0
  78. package/dist/esm/assets/locale/messages_da.json +17 -5
  79. package/dist/esm/assets/locale/messages_de.json +12 -0
  80. package/dist/esm/assets/locale/messages_el.json +12 -0
  81. package/dist/esm/assets/locale/messages_en.json +12 -0
  82. package/dist/esm/assets/locale/messages_es.json +16 -4
  83. package/dist/esm/assets/locale/messages_fi.json +12 -0
  84. package/dist/esm/assets/locale/messages_fr.json +12 -0
  85. package/dist/esm/assets/locale/messages_he.json +12 -0
  86. package/dist/esm/assets/locale/messages_hi.json +17 -5
  87. package/dist/esm/assets/locale/messages_hu.json +12 -0
  88. package/dist/esm/assets/locale/messages_id.json +17 -5
  89. package/dist/esm/assets/locale/messages_it.json +17 -5
  90. package/dist/esm/assets/locale/messages_ja.json +12 -0
  91. package/dist/esm/assets/locale/messages_ko.json +17 -5
  92. package/dist/esm/assets/locale/messages_lt.json +12 -0
  93. package/dist/esm/assets/locale/messages_ms.json +12 -0
  94. package/dist/esm/assets/locale/messages_nl.json +16 -4
  95. package/dist/esm/assets/locale/messages_no.json +12 -0
  96. package/dist/esm/assets/locale/messages_pl.json +12 -0
  97. package/dist/esm/assets/locale/messages_pt.json +16 -4
  98. package/dist/esm/assets/locale/messages_ro.json +12 -0
  99. package/dist/esm/assets/locale/messages_ru.json +12 -0
  100. package/dist/esm/assets/locale/messages_sk.json +12 -0
  101. package/dist/esm/assets/locale/messages_sl.json +12 -0
  102. package/dist/esm/assets/locale/messages_sv.json +17 -5
  103. package/dist/esm/assets/locale/messages_th.json +17 -5
  104. package/dist/esm/assets/locale/messages_tl.json +12 -0
  105. package/dist/esm/assets/locale/messages_tr.json +17 -5
  106. package/dist/esm/assets/locale/messages_uk.json +12 -0
  107. package/dist/esm/assets/locale/messages_vi.json +17 -5
  108. package/dist/esm/assets/locale/messages_zh.json +12 -0
  109. package/dist/esm/assets/locale/version_file +1 -1
  110. package/dist/esm/assets/visual-e2e-locale/messages_visuale2e.json +4 -1
  111. package/dist/esm/hooks/useImport.js +5 -4
  112. package/dist/esm/hooks/useImport.js.map +1 -1
  113. package/dist/esm/hooks/useImportConfig.js.map +1 -1
  114. package/dist/esm/state/ImportState/ImportState.js +293 -101
  115. package/dist/esm/state/ImportState/ImportState.js.map +1 -1
  116. package/dist/esm/state/ImportState/__tests__/ImportState.engine.spec.js +385 -0
  117. package/dist/esm/state/ImportState/__tests__/ImportState.engine.spec.js.map +1 -0
  118. package/dist/esm/state/ImportState/__tests__/hubJobClient.spec.js +139 -0
  119. package/dist/esm/state/ImportState/__tests__/hubJobClient.spec.js.map +1 -0
  120. package/dist/esm/state/ImportState/__tests__/importJobPoller.spec.js +62 -0
  121. package/dist/esm/state/ImportState/__tests__/importJobPoller.spec.js.map +1 -0
  122. package/dist/esm/state/ImportState/__tests__/parseCsv.spec.js +59 -0
  123. package/dist/esm/state/ImportState/__tests__/parseCsv.spec.js.map +1 -0
  124. package/dist/esm/state/ImportState/__tests__/rewriteCsv.spec.js +68 -0
  125. package/dist/esm/state/ImportState/__tests__/rewriteCsv.spec.js.map +1 -0
  126. package/dist/esm/state/ImportState/fieldEdit.js +33 -0
  127. package/dist/esm/state/ImportState/fieldEdit.js.map +1 -0
  128. package/dist/esm/state/ImportState/hubJobClient.js +43 -0
  129. package/dist/esm/state/ImportState/hubJobClient.js.map +1 -0
  130. package/dist/esm/state/ImportState/importJobPoller.js +34 -0
  131. package/dist/esm/state/ImportState/importJobPoller.js.map +1 -0
  132. package/dist/esm/state/ImportState/index.js +2 -0
  133. package/dist/esm/state/ImportState/index.js.map +1 -1
  134. package/dist/esm/state/ImportState/parseCsv.js +34 -10
  135. package/dist/esm/state/ImportState/parseCsv.js.map +1 -1
  136. package/dist/esm/state/ImportState/rewriteCsv.js +39 -0
  137. package/dist/esm/state/ImportState/rewriteCsv.js.map +1 -0
  138. package/dist/esm/testkit/WixPatternsContainer.driver.js +4 -1
  139. package/dist/esm/testkit/WixPatternsContainer.driver.js.map +1 -1
  140. package/dist/esm/testkit/client.js +1 -0
  141. package/dist/esm/testkit/client.js.map +1 -1
  142. package/dist/esm/testkit/hubJobImportMocks.js +173 -0
  143. package/dist/esm/testkit/hubJobImportMocks.js.map +1 -0
  144. package/dist/esm/testkit/index.js +1 -0
  145. package/dist/esm/testkit/index.js.map +1 -1
  146. package/dist/types/hooks/useImport.d.ts +5 -3
  147. package/dist/types/hooks/useImport.d.ts.map +1 -1
  148. package/dist/types/hooks/useImportConfig.d.ts +2 -3
  149. package/dist/types/hooks/useImportConfig.d.ts.map +1 -1
  150. package/dist/types/services/translations.d.ts +1 -1
  151. package/dist/types/services/translations.d.ts.map +1 -1
  152. package/dist/types/state/ImportState/ImportState.d.ts +118 -20
  153. package/dist/types/state/ImportState/ImportState.d.ts.map +1 -1
  154. package/dist/types/state/ImportState/__tests__/ImportState.engine.spec.d.ts +2 -0
  155. package/dist/types/state/ImportState/__tests__/ImportState.engine.spec.d.ts.map +1 -0
  156. package/dist/types/state/ImportState/__tests__/hubJobClient.spec.d.ts +2 -0
  157. package/dist/types/state/ImportState/__tests__/hubJobClient.spec.d.ts.map +1 -0
  158. package/dist/types/state/ImportState/__tests__/importJobPoller.spec.d.ts +2 -0
  159. package/dist/types/state/ImportState/__tests__/importJobPoller.spec.d.ts.map +1 -0
  160. package/dist/types/state/ImportState/__tests__/parseCsv.spec.d.ts +2 -0
  161. package/dist/types/state/ImportState/__tests__/parseCsv.spec.d.ts.map +1 -0
  162. package/dist/types/state/ImportState/__tests__/rewriteCsv.spec.d.ts +2 -0
  163. package/dist/types/state/ImportState/__tests__/rewriteCsv.spec.d.ts.map +1 -0
  164. package/dist/types/state/ImportState/fieldEdit.d.ts +10 -0
  165. package/dist/types/state/ImportState/fieldEdit.d.ts.map +1 -0
  166. package/dist/types/state/ImportState/hubJobClient.d.ts +47 -0
  167. package/dist/types/state/ImportState/hubJobClient.d.ts.map +1 -0
  168. package/dist/types/state/ImportState/importJobPoller.d.ts +20 -0
  169. package/dist/types/state/ImportState/importJobPoller.d.ts.map +1 -0
  170. package/dist/types/state/ImportState/index.d.ts +2 -0
  171. package/dist/types/state/ImportState/index.d.ts.map +1 -1
  172. package/dist/types/state/ImportState/parseCsv.d.ts +7 -0
  173. package/dist/types/state/ImportState/parseCsv.d.ts.map +1 -1
  174. package/dist/types/state/ImportState/rewriteCsv.d.ts +25 -0
  175. package/dist/types/state/ImportState/rewriteCsv.d.ts.map +1 -0
  176. package/dist/types/testkit/WixPatternsContainer.driver.d.ts +22 -0
  177. package/dist/types/testkit/WixPatternsContainer.driver.d.ts.map +1 -1
  178. package/dist/types/testkit/client.d.ts +1 -0
  179. package/dist/types/testkit/client.d.ts.map +1 -1
  180. package/dist/types/testkit/hubJobImportMocks.d.ts +40 -0
  181. package/dist/types/testkit/hubJobImportMocks.d.ts.map +1 -0
  182. package/dist/types/testkit/index.d.ts +1 -0
  183. package/dist/types/testkit/index.d.ts.map +1 -1
  184. package/package.json +4 -4
@@ -1,36 +1,76 @@
1
1
  import { ShowToast, TaskStatus, PatternsErrorHandler } from '../../model';
2
+ import type { HttpClient } from '../../model/httpClient';
2
3
  import { Translate } from '../../services';
3
4
  import { ModalState } from '../ModalState';
4
5
  import { ConditionalModalState } from '../ConditionalModalState';
5
6
  import { CreateExportAsyncJobRequest } from '@wix/bex-utils/@wix/ambassador-fedinfra-exportservice-v1-export-async-job/types';
7
+ import { WritePolicy } from '@wix/bex-utils/@wix/ambassador-hub-v1-job/types';
6
8
  import { type DetectColumnType, type NewFieldType } from './detectFieldType';
9
+ import type { FieldSpec, NonReferenceField } from '../../types/Field';
7
10
  export interface ImportCollection {
8
11
  clearResultAndMoveToStart(params?: {
9
12
  force?: boolean;
10
13
  }): void;
11
14
  }
12
- export interface BulkUploadError {
13
- rowIndex: number;
14
- message?: string;
15
- code?: string;
16
- }
17
- export interface BulkUploadResults {
15
+ /** Outcome of a server-side import job, derived from the job's progress. */
16
+ export interface ImportResult {
18
17
  succeeded: number;
19
18
  failed: number;
20
- errors: BulkUploadError[];
21
- insertedIds?: string[];
22
19
  }
23
- export type BulkUploadItemsFn = (items: Record<string, unknown>[]) => Promise<BulkUploadResults>;
24
20
  export interface BackupResult {
21
+ /**
22
+ * Reverts the collection to its pre-import state. Called only when the user
23
+ * cancels mid-import (matching the previous client-side behavior); a job
24
+ * failure leaves partial rows in place and offers "Try again".
25
+ *
26
+ * Must fully revert to the snapshot taken before the import — including rows
27
+ * the import overwrote in place. The default `writePolicy` is upsert (OVERWRITE
28
+ * by `_id`), so it is NOT enough to delete newly-inserted ids; previously
29
+ * existing rows may have been overwritten and must be restored to their prior
30
+ * values.
31
+ */
25
32
  restore(signal: AbortSignal): Promise<void>;
26
33
  }
34
+ /**
35
+ * Optional snapshot taken before the import runs, returning a `restore` used to
36
+ * undo the import on cancel. See {@link BackupResult.restore} for the revert
37
+ * contract under upsert.
38
+ */
27
39
  export type BackupFn = (signal: AbortSignal) => Promise<BackupResult | void>;
28
40
  export type DownloadCsvFn = (content: string, fileName: string) => void;
41
+ /**
42
+ * Consumer hook for resolving a failed import job's message. An import runs
43
+ * server-side, so a failure arrives on a 200 (the poll succeeds; the job
44
+ * doesn't) with no HTTP error to carry the application error. Cairo hands the
45
+ * consumer `run` — an operation that rejects with a synthetic, HTTP-error-shaped
46
+ * error carrying the job's application error — and the consumer wraps it with
47
+ * their own `withErrorHandler` + error-code map (their codes, their
48
+ * translations), keeping the map coupled to the `withErrorHandler` call as
49
+ * everywhere else (e.g. `fetchData`). The map is keyed by application-error code
50
+ * (the v2 errorHandler shape, like `getExportAsyncJobErrors`):
51
+ *
52
+ * onJobError: (run) =>
53
+ * errorHandler.withErrorHandler(run, {
54
+ * [jobErrorCode]: (error) => ({ message: translate(...) }),
55
+ * })
56
+ *
57
+ * `withErrorHandler` attaches the map to the error object and re-rejects it, so
58
+ * the progress step resolves a consumer-specific message via `getResolvedError`.
59
+ * When omitted, the error still surfaces but resolves to the generic message.
60
+ */
61
+ export type OnImportJobError = (run: () => Promise<unknown>) => Promise<unknown>;
29
62
  export type ImportField = NonNullable<CreateExportAsyncJobRequest['fields']>[number];
63
+ export { WritePolicy } from '@wix/bex-utils/@wix/ambassador-hub-v1-job/types';
64
+ export interface NewFieldConfig {
65
+ validation?: NonReferenceField['validation'];
66
+ isPii?: boolean;
67
+ helpText?: string;
68
+ }
30
69
  export interface NewFieldDefinition {
31
70
  key: string;
32
71
  type: NewFieldType;
33
72
  displayName: string;
73
+ config?: NewFieldConfig;
34
74
  }
35
75
  /**
36
76
  * Consumer-supplied callback that adds the given new fields to the collection
@@ -44,7 +84,11 @@ export type UpdateSchemaFn = (fields: NewFieldDefinition[]) => Promise<void>;
44
84
  /**
45
85
  * How a CSV column is mapped:
46
86
  * - `existing` — into an existing collection field by id
47
- * - `new` — into a new field created during import (always text for now)
87
+ * - `new` — into a new field created during import. `fieldType` is the detected
88
+ * type, or the type the user picked in the field editor. `displayName` and
89
+ * `config` are present only once the user edited the pending field via the
90
+ * "Edit field" editor — `displayName` overrides the header-derived name and
91
+ * `config` carries the per-type configuration.
48
92
  * - `null` — don't import (skip)
49
93
  */
50
94
  export type ColumnMapping = {
@@ -53,10 +97,15 @@ export type ColumnMapping = {
53
97
  } | {
54
98
  kind: 'new';
55
99
  fieldType: NewFieldType;
100
+ displayName?: string;
101
+ config?: NewFieldConfig;
56
102
  } | null;
57
103
  export interface ImportStateProps {
58
104
  fields: CreateExportAsyncJobRequest['fields'];
59
- bulkUploadItems: BulkUploadItemsFn;
105
+ /** Wix httpClient used to drive the Hub Job (data-movement) API. */
106
+ httpClient: HttpClient;
107
+ /** Destination data collection the import writes into. */
108
+ collectionId: string;
60
109
  backup?: BackupFn;
61
110
  updateSchema?: UpdateSchemaFn;
62
111
  /**
@@ -73,12 +122,13 @@ export interface ImportStateProps {
73
122
  errorHandler: PatternsErrorHandler;
74
123
  showToast?: ShowToast;
75
124
  downloadCsv?: DownloadCsvFn;
76
- batchSize?: number;
125
+ /** See {@link OnImportJobError}. */
126
+ onJobError?: OnImportJobError;
77
127
  }
78
128
  export type ImportStep = 'upload' | 'configuration' | 'progress';
79
129
  export declare class ImportState {
80
130
  readonly fields: ImportField[];
81
- readonly bulkUploadItems: BulkUploadItemsFn;
131
+ readonly collectionId: string;
82
132
  readonly backup?: BackupFn;
83
133
  readonly updateSchema?: UpdateSchemaFn;
84
134
  readonly collection: ImportCollection;
@@ -87,26 +137,29 @@ export declare class ImportState {
87
137
  readonly errorHandler: PatternsErrorHandler;
88
138
  readonly showToast?: ShowToast;
89
139
  readonly downloadCsv?: DownloadCsvFn;
90
- readonly batchSize: number;
140
+ readonly onJobError?: OnImportJobError;
141
+ private readonly hubJobClient;
91
142
  private readonly _detectColumnType;
92
143
  readonly discardChangesModal: ConditionalModalState<"close" | "goBack">;
93
144
  currentStep: ImportStep;
94
- importStatus: TaskStatus<BulkUploadResults, unknown>;
145
+ importStatus: TaskStatus<ImportResult, unknown>;
95
146
  fileName: string;
96
147
  csvHeaders: string[];
97
148
  csvRows: string[][];
98
149
  mappingByHeader: Record<string, ColumnMapping>;
150
+ writePolicy: WritePolicy;
99
151
  processedCount: number;
100
152
  totalCount: number;
101
- result: BulkUploadResults;
153
+ result: ImportResult;
102
154
  isBackingUp: boolean;
103
155
  isRestoring: boolean;
104
156
  private restoreFn;
105
157
  private _cancelled;
106
158
  private _abortController;
107
- private _failedRowIndices;
159
+ private _jobId;
160
+ private _editingHeader;
108
161
  constructor(props: ImportStateProps);
109
- init(): () => undefined;
162
+ init(): () => void;
110
163
  get hasParsedRows(): boolean;
111
164
  get hasMappings(): boolean;
112
165
  /**
@@ -118,6 +171,14 @@ export declare class ImportState {
118
171
  */
119
172
  get hasNoMappedData(): boolean;
120
173
  get selectedFieldIds(): Set<string>;
174
+ /**
175
+ * The CSV header currently mapped to the collection's `_id` field, or `null`
176
+ * when no column targets it. Drives both the "When items share the same ID"
177
+ * control (only shown on this row) and whether `writePolicy` is sent at all —
178
+ * with no `_id` mapped, every row is a fresh insert and collisions can't occur.
179
+ */
180
+ get idMappedHeader(): string | null;
181
+ setWritePolicy(policy: WritePolicy): void;
121
182
  /**
122
183
  * Whether columns may be mapped to a brand-new field created during import.
123
184
  * Driven purely by the presence of the `updateSchema` callback — providing the
@@ -141,10 +202,48 @@ export declare class ImportState {
141
202
  private _rejectFile;
142
203
  private _showFileReadErrorToast;
143
204
  private _showPartialSuccessToast;
205
+ /**
206
+ * Builds a plain, re-importable CSV of the rows the server rejected — the
207
+ * original headers plus just the failed rows — and hands it to `downloadCsv`.
208
+ * The failed rows come from the job's movement logs (which row failed), mapped
209
+ * back to the parsed `csvRows` we still hold in memory.
210
+ */
144
211
  private _downloadFailedRows;
212
+ private _fetchFailedRowIndices;
145
213
  setMapping(header: string, fieldId: string | null): void;
146
214
  setNewFieldMapping(header: string): void;
147
- private _uploadBatches;
215
+ /**
216
+ * Persists the result of the "Edit field" editor for a column's pending new
217
+ * field: the (possibly overridden) type, an optional display-name override,
218
+ * and the per-type configuration. No-op if the column isn't currently mapped
219
+ * to a new field.
220
+ */
221
+ setNewFieldConfig(header: string, edit: {
222
+ fieldType: NewFieldType;
223
+ displayName?: string;
224
+ config?: NewFieldConfig;
225
+ }): void;
226
+ /**
227
+ * Marks which column's pending new field the field editor is currently
228
+ * editing, so a later `applyFieldEdit` (the editor's `onSubmit`) knows where to
229
+ * write the result.
230
+ */
231
+ beginFieldEdit(header: string): void;
232
+ /**
233
+ * `onSubmit` handler for the field editor: maps the edited field spec into the
234
+ * column being edited (set via `beginFieldEdit`). No-op if nothing is being
235
+ * edited.
236
+ */
237
+ applyFieldEdit(field: FieldSpec): void;
238
+ /**
239
+ * Runs the server-side import: align the CSV to the resolved field keys,
240
+ * upload it, submit a data-movement job, then poll until terminal. Throws on
241
+ * a failed job so `startImport` surfaces the error state; partial success is
242
+ * reported via `result.failed` and the partial toast.
243
+ */
244
+ private _runImportJob;
245
+ private _destination;
246
+ private _applyJobProgress;
148
247
  private _runBackup;
149
248
  private _lingerOnCompletion;
150
249
  /**
@@ -155,7 +254,6 @@ export declare class ImportState {
155
254
  * `updateSchema` may throw — `startImport` surfaces that as the error state.
156
255
  */
157
256
  private _resolveFieldMapping;
158
- private _createRowsBatches;
159
257
  startImport(): Promise<void>;
160
258
  }
161
259
  //# sourceMappingURL=ImportState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ImportState.d.ts","sourceRoot":"","sources":["../../../../src/state/ImportState/ImportState.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,SAAS,EACT,UAAU,EACV,oBAAoB,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAAoB,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,iFAAiF,CAAC;AAE9H,OAAO,EAGL,KAAK,gBAAgB,EACrB,KAAK,YAAY,EAClB,MAA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AI,EAAE,IAAI,GAAG,IAAI;YA4BxB,cAAc;IAS5B,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,WAAW;IAcnB,OAAO,CAAC,uBAAuB;IAY/B,OAAO,CAAC,wBAAwB;IAehC;;;;;OAKG;YACW,mBAAmB;YAoCnB,sBAAsB;IAgCpC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAOjD,kBAAkB,CAAC,MAAM,EAAE,MAAM;IAUjC;;;;;OAKG;IACH,iBAAiB,CACf,MAAM,EAAE,MAAM,EACd,IAAI,EAAE;QACJ,SAAS,EAAE,YAAY,CAAC;QACxB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,cAAc,CAAC;KACzB;IAiBH;;;;OAIG;IACH,cAAc,CAAC,MAAM,EAAE,MAAM;IAI7B;;;;OAIG;IACH,cAAc,CAAC,KAAK,EAAE,SAAS;IAO/B;;;;;OAKG;YACW,aAAa;IAkF3B,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,iBAAiB;YAcX,UAAU;IAkCxB,OAAO,CAAC,mBAAmB;IAM3B;;;;;;OAMG;YACW,oBAAoB;IAoD5B,WAAW;CAwGlB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ImportState.engine.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ImportState.engine.spec.d.ts","sourceRoot":"","sources":["../../../../../src/state/ImportState/__tests__/ImportState.engine.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=hubJobClient.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hubJobClient.spec.d.ts","sourceRoot":"","sources":["../../../../../src/state/ImportState/__tests__/hubJobClient.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=importJobPoller.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importJobPoller.spec.d.ts","sourceRoot":"","sources":["../../../../../src/state/ImportState/__tests__/importJobPoller.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=parseCsv.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseCsv.spec.d.ts","sourceRoot":"","sources":["../../../../../src/state/ImportState/__tests__/parseCsv.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=rewriteCsv.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rewriteCsv.spec.d.ts","sourceRoot":"","sources":["../../../../../src/state/ImportState/__tests__/rewriteCsv.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { FieldSpec, PatternsFieldType } from '../../types/Field';
2
+ import type { NewFieldType } from './detectFieldType';
3
+ import type { NewFieldConfig } from './ImportState';
4
+ export declare const toNewFieldType: (type: PatternsFieldType) => NewFieldType;
5
+ export declare function toFieldEdit(field: FieldSpec): {
6
+ fieldType: NewFieldType;
7
+ displayName: string;
8
+ config?: NewFieldConfig;
9
+ };
10
+ //# sourceMappingURL=fieldEdit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldEdit.d.ts","sourceRoot":"","sources":["../../../../src/state/ImportState/fieldEdit.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAsBpD,eAAO,MAAM,cAAc,SAAU,iBAAiB,KAAG,YACb,CAAC;AAI7C,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,GAAG;IAC7C,SAAS,EAAE,YAAY,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB,CAWA"}
@@ -0,0 +1,47 @@
1
+ import { FileFormat, type Destination, type DataMovementJob, type ListMovementLogsResponse, type Transformation, type CursorPaging } from '@wix/bex-utils/@wix/ambassador-hub-v1-job/types';
2
+ import type { PatternsErrorHandler } from '../../model';
3
+ import type { HttpClient } from '../../model/httpClient';
4
+ export interface HubJobClientDeps {
5
+ httpClient: HttpClient;
6
+ errorHandler: PatternsErrorHandler;
7
+ }
8
+ export interface SubmitImportJobParams {
9
+ /** File id returned by `uploadFile`. */
10
+ fileId: string;
11
+ /**
12
+ * Where the job writes. A union (`wixDataCollection`, `storesCatalogProducts`,
13
+ * …) so platformized services pass their own variant — the client stays
14
+ * neutral to that choice (see plan O6).
15
+ */
16
+ destination: Destination;
17
+ /** Job name (the original file name). */
18
+ name?: string;
19
+ /** Source file format. Defaults to CSV. */
20
+ fileFormat?: FileFormat;
21
+ transformations?: Transformation[];
22
+ }
23
+ /**
24
+ * Thin wrapper over the Hub Job (data-movement) API used by the server-side
25
+ * import. Each call goes through `errorHandler.withErrorHandler` and the
26
+ * container's `httpClient`, mirroring `ExportState`.
27
+ *
28
+ * Holds no observable state — it's a standalone unit consumed by `ImportState`.
29
+ */
30
+ export interface HubJobClient {
31
+ /**
32
+ * Reserves an upload URL, PUTs the file, and returns its `fileId`.
33
+ * Cancellation is handled at the job level via `terminateJob`, not by
34
+ * aborting this upload.
35
+ */
36
+ uploadFile(file: File): Promise<string>;
37
+ /** Submits an import job from an uploaded file; returns the `jobId`. */
38
+ submitImportJob(params: SubmitImportJobParams): Promise<string>;
39
+ /** Fetches a job's current state (status + progress) for polling. */
40
+ getJob(jobId: string): Promise<DataMovementJob>;
41
+ /** Requests termination of a running job. Does not roll back written rows. */
42
+ terminateJob(jobId: string): Promise<void>;
43
+ /** Lists per-row movement logs (source of the failed-rows report). */
44
+ listMovementLogs(jobId: string, paging?: CursorPaging): Promise<ListMovementLogsResponse>;
45
+ }
46
+ export declare function createHubJobClient({ httpClient, errorHandler, }: HubJobClientDeps): HubJobClient;
47
+ //# sourceMappingURL=hubJobClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hubJobClient.d.ts","sourceRoot":"","sources":["../../../../src/state/ImportState/hubJobClient.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,UAAU,EACV,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,iDAAiD,CAAC;AACzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,UAAU,CAAC;IACvB,YAAY,EAAE,oBAAoB,CAAC;CACpC;AAED,MAAM,WAAW,qBAAqB;IACpC,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,WAAW,EAAE,WAAW,CAAC;IACzB,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,eAAe,CAAC,EAAE,cAAc,EAAE,CAAC;CACpC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,wEAAwE;IACxE,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAChE,qEAAqE;IACrE,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAChD,8EAA8E;IAC9E,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,sEAAsE;IACtE,gBAAgB,CACd,KAAK,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,YAAY,GACpB,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACtC;AAED,wBAAgB,kBAAkB,CAAC,EACjC,UAAU,EACV,YAAY,GACb,EAAE,gBAAgB,GAAG,YAAY,CA0FjC"}
@@ -0,0 +1,20 @@
1
+ import { JobStatus, type DataMovementJob } from '@wix/bex-utils/@wix/ambassador-hub-v1-job/types';
2
+ export declare const JOB_POLL_INTERVAL_MS = 2000;
3
+ /** A job is terminal once it has succeeded, partially succeeded, or failed. */
4
+ export declare function isTerminalJobStatus(status?: JobStatus): boolean;
5
+ export interface PollImportJobOptions {
6
+ intervalMs?: number;
7
+ /** Called with every fetched job, including the terminal one. */
8
+ onProgress?: (job: DataMovementJob) => void;
9
+ /** Polling stops and resolves `null` as soon as this returns true. */
10
+ isCancelled?: () => boolean;
11
+ /** Overridable wait between polls (tests inject a controllable timer). */
12
+ wait?: (ms: number) => Promise<void>;
13
+ }
14
+ /**
15
+ * Polls a data-movement job until it reaches a terminal status, then resolves
16
+ * with the terminal job. Resolves `null` if cancelled mid-poll. Pure async unit
17
+ * (no MobX) so `ImportState` stays thin and this is testable on its own.
18
+ */
19
+ export declare function pollImportJob(getJob: (jobId: string) => Promise<DataMovementJob>, jobId: string, options?: PollImportJobOptions): Promise<DataMovementJob | null>;
20
+ //# sourceMappingURL=importJobPoller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"importJobPoller.d.ts","sourceRoot":"","sources":["../../../../src/state/ImportState/importJobPoller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,KAAK,eAAe,EACrB,MAAM,iDAAiD,CAAC;AAEzD,eAAO,MAAM,oBAAoB,OAAO,CAAC;AAEzC,+EAA+E;AAC/E,wBAAgB,mBAAmB,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,OAAO,CAM/D;AAED,MAAM,WAAW,oBAAoB;IACnC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5C,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC;IAC5B,0EAA0E;IAC1E,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACtC;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,EACnD,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CA0BjC"}
@@ -1,4 +1,6 @@
1
1
  export * from './ImportState';
2
2
  export * from './parseCsv';
3
+ export * from './rewriteCsv';
3
4
  export * from './detectFieldType';
5
+ export * from './hubJobClient';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/state/ImportState/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/state/ImportState/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC"}
@@ -6,5 +6,12 @@ export interface ParseCsvError {
6
6
  code: 'PARSE_ERROR';
7
7
  }
8
8
  export declare function parseCsv(content: string): ParseCsvResult | ParseCsvError;
9
+ /**
10
+ * Parses only the header row plus up to `maxRows` data rows — enough to drive
11
+ * the mapping UI and column type detection without reading the whole file
12
+ * (plan D1). Uses papaparse `preview` so parsing stops early instead of
13
+ * parsing everything and slicing.
14
+ */
15
+ export declare function parseCsvSample(content: string, maxRows: number): ParseCsvResult | ParseCsvError;
9
16
  export declare function unparseCsv(headers: string[], rows: string[][]): string;
10
17
  //# sourceMappingURL=parseCsv.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"parseCsv.d.ts","sourceRoot":"","sources":["../../../../src/state/ImportState/parseCsv.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,aAAa,CAAC;CACrB;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,aAAa,CAsBxE;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,CAEtE"}
1
+ {"version":3,"file":"parseCsv.d.ts","sourceRoot":"","sources":["../../../../src/state/ImportState/parseCsv.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,aAAa,CAAC;CACrB;AA2CD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,GAAG,aAAa,CAExE;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,cAAc,GAAG,aAAa,CAGhC;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,CAEtE"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Rewrites a CSV so its header row matches the destination field keys and the
3
+ * columns the user chose to skip are dropped.
4
+ *
5
+ * The data-hub import maps columns to fields strictly by `header == field-key`
6
+ * (there is no server-side column mapping), so the chosen mapping has to be
7
+ * applied to the file itself before upload — see plan O1.
8
+ *
9
+ * `resolvedMapping` maps each *original* CSV header to its destination field
10
+ * key, or `null`/absent to skip that column — exactly what
11
+ * `ImportState._resolveFieldMapping` produces. Columns are kept in their
12
+ * original order (order is irrelevant to the server, which maps by header name,
13
+ * but it keeps the output readable).
14
+ *
15
+ * NOTE: this reads the whole file into memory. For very large files a streaming
16
+ * rewrite (papaparse `step`) would avoid that — deferred until it's a problem.
17
+ */
18
+ export declare function rewriteCsvForImport(content: string, resolvedMapping: Record<string, string | null>): string;
19
+ /**
20
+ * Same rewrite as {@link rewriteCsvForImport} but from already-parsed rows —
21
+ * used by `ImportState`, which holds the parsed CSV in memory and doesn't need
22
+ * to re-parse.
23
+ */
24
+ export declare function rewriteParsedCsvForImport(headers: string[], rows: string[][], resolvedMapping: Record<string, string | null>): string;
25
+ //# sourceMappingURL=rewriteCsv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rewriteCsv.d.ts","sourceRoot":"","sources":["../../../../src/state/ImportState/rewriteCsv.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GAC7C,MAAM,CAWR;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,MAAM,EAAE,EACjB,IAAI,EAAE,MAAM,EAAE,EAAE,EAChB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,GAC7C,MAAM,CASR"}
@@ -98,6 +98,28 @@ export declare class WixPatternsContainerDriver {
98
98
  jobCreated: (job: import("@wix/bex-utils/@wix/ambassador-fedinfra-exportservice-v1-export-async-job/build/cjs/types.impl").ExportAsyncJob) => void | Promise<void>;
99
99
  }>;
100
100
  };
101
+ readonly hubJobImportMocks: {
102
+ state: {
103
+ outcome: import("./hubJobImportMocks").ImportJobOutcome;
104
+ succeeded: number;
105
+ failed: number;
106
+ inProgressPolls: number;
107
+ failedRowIndices: number[];
108
+ uploadedBody: unknown;
109
+ submittedRequest: import("@wix/bex-utils/@wix/ambassador-hub-v1-job/cjs/build/types.impl").SubmitJobRequest | undefined;
110
+ submittedJobId: string | undefined;
111
+ terminatedJobIds: string[];
112
+ };
113
+ setOutcome(outcome: import("./hubJobImportMocks").ImportJobOutcome, counts?: {
114
+ succeeded?: number | undefined;
115
+ failed?: number | undefined;
116
+ }): void;
117
+ setInProgressPolls(n: number): void;
118
+ setFailedRowIndices(indices: number[]): void;
119
+ getUploadedCsv(): Promise<string>;
120
+ reset(): void;
121
+ mocks: AnyScenario[];
122
+ };
101
123
  constructor(overrides?: WixPatternsContainerDriverOverrides);
102
124
  get errorMonitor(): import("@wix/error-monitor").ErrorMonitor;
103
125
  get errorHandler(): import("../model").PatternsErrorHandler;
@@ -1 +1 @@
1
- {"version":3,"file":"WixPatternsContainer.driver.d.ts","sourceRoot":"","sources":["../../../src/testkit/WixPatternsContainer.driver.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAuB,OAAO,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EACL,+BAA+B,EAC/B,WAAW,EAEZ,MAAM,uCAAuC,CAAC;AAM/C,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAE3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAEL,WAAW,EACX,YAAY,EACb,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,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C,WAAW,EAAE,YAAY,EAAE,CAAM;IAC1C,QAAQ,CAAC,oBAAoB,gHAAmC;IAEhE,IAAI,gBAAgB,qGAInB;IAED,QAAQ,CAAC,0BAA0B,+GAAkC;IAErE,QAAQ,CAAC,kBAAkB;;;;;;;;;;;MAAC;IAE5B,QAAQ,CAAC,iBAAiB;;;;;;;;;;;;;;;;;;;;;MAAC;gBAGzB,SAAS,GAAE,mCAGV;IA+PH,IAAI,YAAY,8CAEf;IAED,IAAI,YAAY,4CAEf;IAED,IAAI,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,GAAG;QAAE,CAAC,EAAE,SAAS,CAAA;KAAE,CAE9D;IAED,IAAI,WAAW,mCAEd;IAED,IAAI,WAAW,sCAEd;IAED,IAAI,aAAa,wCAEhB;IAED,IAAI,gBAAgB,iCAEnB;IAED,IAAI,eAAe;;4EAElB;IAED,cAAc,CAAC,YAAY,EAAE,eAAe;CAO7C"}
@@ -2,5 +2,6 @@ export * from './product';
2
2
  export * from './productFilters';
3
3
  export * from './createProductsBackend';
4
4
  export * from './exportServiceMocks';
5
+ export * from './hubJobImportMocks';
5
6
  export * from './appSettingsMocks';
6
7
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/testkit/client.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/testkit/client.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { type SubmitJobRequest } from '@wix/bex-utils/@wix/ambassador-hub-v1-job/types';
2
+ export type ImportJobOutcome = 'completed' | 'partial' | 'failed';
3
+ /**
4
+ * Test mocks for the data-hub Hub Job import lifecycle, mirroring
5
+ * `exportServiceMocks`. Auto-included in the test container's httpClient
6
+ * scenarios so every import test drives a fake server. Behavior is controllable
7
+ * per test via `setOutcome` / `setInProgressPolls`, and the uploaded (aligned)
8
+ * CSV + the submitted job request are captured for assertions.
9
+ */
10
+ export declare function hubJobImportMocks(whenRequest: typeof import('@wix/http-client-testkit/client').whenRequest, when: typeof import('@wix/http-client-testkit/client').when): {
11
+ state: {
12
+ outcome: ImportJobOutcome;
13
+ succeeded: number;
14
+ failed: number;
15
+ /** number of IN_PROGRESS polls before the job goes terminal */
16
+ inProgressPolls: number;
17
+ /** csvRows indices reported as failed via movement logs */
18
+ failedRowIndices: number[];
19
+ /** the raw body PUT to the signed upload URL (the aligned CSV File) */
20
+ uploadedBody: unknown;
21
+ /** the SubmitJobRequest payload */
22
+ submittedRequest: SubmitJobRequest | undefined;
23
+ submittedJobId: string | undefined;
24
+ terminatedJobIds: string[];
25
+ };
26
+ /** Set the job's terminal outcome and its success/failure counts. */
27
+ setOutcome(outcome: ImportJobOutcome, counts?: {
28
+ succeeded?: number;
29
+ failed?: number;
30
+ }): void;
31
+ /** Make the job report IN_PROGRESS for `n` polls before going terminal. */
32
+ setInProgressPolls(n: number): void;
33
+ /** Row indices `listMovementLogs` reports as failed (sourceItemId). */
34
+ setFailedRowIndices(indices: number[]): void;
35
+ /** The aligned CSV uploaded to the signed URL, as text. */
36
+ getUploadedCsv(): Promise<string>;
37
+ reset(): void;
38
+ mocks: import("@wix/http-client-testkit").AnyScenario[];
39
+ };
40
+ //# sourceMappingURL=hubJobImportMocks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hubJobImportMocks.d.ts","sourceRoot":"","sources":["../../../src/testkit/hubJobImportMocks.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,iDAAiD,CAAC;AAOzD,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;AAElE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,WAAW,EAAE,cAAc,iCAAiC,EAAE,WAAW,EACzE,IAAI,EAAE,cAAc,iCAAiC,EAAE,IAAI;;;;;QAMzD,+DAA+D;;QAE/D,2DAA2D;;QAE3D,uEAAuE;;QAEvE,mCAAmC;;;;;IAkCnC,qEAAqE;wBAE1D,gBAAgB,WACjB;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;IAOjD,2EAA2E;0BACrD,MAAM;IAI5B,uEAAuE;iCAC1C,MAAM,EAAE;IAIrC,2DAA2D;sBACnC,QAAQ,MAAM,CAAC;;;EAkH1C"}
@@ -2,6 +2,7 @@ export * from './product';
2
2
  export * from './productFilters';
3
3
  export * from './createProductsBackend';
4
4
  export * from './exportServiceMocks';
5
+ export * from './hubJobImportMocks';
5
6
  export * from '../test-utils/flush';
6
7
  export * from './folder';
7
8
  export * from './createFoldersBackend';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testkit/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testkit/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/bex-core",
3
- "version": "2.327.0",
3
+ "version": "2.329.0",
4
4
  "license": "UNLICENSED",
5
5
  "author": {
6
6
  "name": "Kobi",
@@ -41,7 +41,7 @@
41
41
  "exports"
42
42
  ],
43
43
  "dependencies": {
44
- "@wix/bex-utils": "2.114.0",
44
+ "@wix/bex-utils": "2.116.0",
45
45
  "chance": "^1.0.0",
46
46
  "events": "^3.0.0",
47
47
  "formstate": "^2.1.0",
@@ -63,7 +63,7 @@
63
63
  "@types/react": "^16.0.0",
64
64
  "@wix/auto-crud": "^1.0.108",
65
65
  "@wix/babel-cli": "^1.11.0",
66
- "@wix/cairo-integration-utils": "1.89.0",
66
+ "@wix/cairo-integration-utils": "1.91.0",
67
67
  "@wix/eslint-config-yoshi": "^6.74.0",
68
68
  "@wix/fe-essentials": "^1.233.0",
69
69
  "@wix/fe-essentials-standalone": "^1.374.0",
@@ -169,5 +169,5 @@
169
169
  "wallaby": {
170
170
  "autoDetect": true
171
171
  },
172
- "falconPackageHash": "6c5687da76f292d8e76a0834ce75a642941a5cb2f9e442bd777403e2"
172
+ "falconPackageHash": "d428f5a4c8efbdb75f2a8e25f4a87003b8afaa3a9a6e8ea5338fd056"
173
173
  }