@capillarytech/blaze-ui 5.0.9 → 5.0.10

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 (39) hide show
  1. package/.npmrc +2 -0
  2. package/CapCondition/messages.d.ts +85 -0
  3. package/CapCondition/messages.d.ts.map +1 -0
  4. package/CapConditionPreview/MIGRATION_ANALYSIS.md +70 -0
  5. package/CapConditionPreview/README.md +40 -0
  6. package/CapConditionPreview/constants.d.ts +24 -0
  7. package/CapConditionPreview/constants.d.ts.map +1 -0
  8. package/CapConditionPreview/index.d.ts +7 -0
  9. package/CapConditionPreview/index.d.ts.map +1 -0
  10. package/CapConditionPreview/index.js +132 -184
  11. package/CapConditionPreview/index.js.map +1 -1
  12. package/CapConditionPreview/tests/USE_CASES_CapConditionPreview.md +65 -0
  13. package/CapConditionPreview/types.d.ts +82 -0
  14. package/CapConditionPreview/types.d.ts.map +1 -0
  15. package/CapNavigation/index.js +24081 -45909
  16. package/CapNavigation/index.js.map +1 -1
  17. package/CapTopBar/index.js +28663 -44982
  18. package/CapTopBar/index.js.map +1 -1
  19. package/index.d.ts +2 -2
  20. package/index.d.ts.map +1 -1
  21. package/index.js +721 -1042
  22. package/index.js.map +1 -1
  23. package/package.json +1 -1
  24. package/.DS_Store +0 -0
  25. package/CapTopBar/CapOrgSelect.d.ts +0 -12
  26. package/CapTopBar/CapOrgSelect.d.ts.map +0 -1
  27. package/CapTopBar/CapOrgSelectUtils.d.ts +0 -38
  28. package/CapTopBar/CapOrgSelectUtils.d.ts.map +0 -1
  29. package/CapTopBar/README.md +0 -146
  30. package/CapTopBar/constants.d.ts +0 -2
  31. package/CapTopBar/constants.d.ts.map +0 -1
  32. package/CapTopBar/index.d.ts +0 -11
  33. package/CapTopBar/index.d.ts.map +0 -1
  34. package/CapTopBar/themeConfig.d.ts +0 -6
  35. package/CapTopBar/themeConfig.d.ts.map +0 -1
  36. package/CapTopBar/types.d.ts +0 -106
  37. package/CapTopBar/types.d.ts.map +0 -1
  38. package/CapTopBar/utils.d.ts +0 -8
  39. package/CapTopBar/utils.d.ts.map +0 -1
@@ -0,0 +1,65 @@
1
+ # Test Cases: CapConditionPreview (Antd v3→v6)
2
+
3
+ **Component:** CapConditionPreview
4
+ **Complexity:** medium (≤20 test cases)
5
+ **Source:** blaze-ui/components/CapConditionPreview/
6
+
7
+ ---
8
+
9
+ ## Google Sheets
10
+
11
+ **Spreadsheet ID:** `1Xt8l8Q6Hw0cUYV65SlGvGcPnOtzprr0fukDR9UWJ3kg`
12
+ **Tab:** CapConditionPreview
13
+
14
+ ### Steps (run in your environment)
15
+
16
+ 1. Check connection: `COMPOSIO_CHECK_ACTIVE_CONNECTION` toolkit="googlesheets"
17
+ 2. Create tab: `GOOGLESHEETS_ADD_SHEET` with title `CapConditionPreview`, gridProperties `{ "rowCount": 100, "columnCount": 7 }`
18
+ 3. Write data: `GOOGLESHEETS_VALUES_UPDATE` with range `CapConditionPreview!A1` and the values table below.
19
+
20
+ ---
21
+
22
+ ## Use cases table (for Storybook + migration validation)
23
+
24
+ | ID | Use Case | Props/Config | Expected Visual/Behavior | Priority | Storybook Story | Notes |
25
+ |----|----------|--------------|---------------------------|----------|-----------------|--------|
26
+ | UC-001 | All data type and operator variants | type: NUMBER \| STRING \| LIST \| MULTI_SELECT \| STRING_LIST \| ENTRY_TRIGGER_EVENT_ATTRIBUTE \| DATE; operator: EQ, GT, LT, GTE, LTE, IN_RANGE, NEQ, IN, NOT_IN, IS_EXACT_DATE, IS_BEFORE_DATE, IS_AFTER_DATE, IS_INBETWEEN_DATES, IS_BEFORE_DAYS, IS_AFTER_DAYS; operand/listData/dateTypeData as needed | Correct label and value for each type and operator (e.g. "greater than" + "42" for NUMBER+GT; "Include whose … is on 1/15/2024" for DATE SINGLE) | P0 | TypeAndOperatorVariants | Grouped all type + operator combos into one test |
27
+ | UC-002 | Include vs Exclude and hideNumberAndProductFields | isExcluded: true \| false; hideNumberAndProductFields: true \| false | "Exclude" vs "Include"; when hideNumberAndProductFields true, operand/operator block hidden for STRING/NUMBER/etc., condition name and "whose" still visible | P0 | VisualStates | Default, excluded, and journey/store profile modes |
28
+ | UC-003 | Store upload states (STORE_FILTER) | additionalFields.STORE_FILTER with storeSource: UPLOAD; storeUploadIsInProgress \| isStoreUploadFailed \| isStoreUploadInvalid \| success (operand count) | Progress icon + "Upload in progress"; error icon + "Upload failed" or "Invalid file uploaded"; or "N Stores" when success | P0 | StoreUploadStates | Grouped in progress / failed / invalid / success |
29
+ | UC-004 | ViewMoreLink and SKU download interactions | ViewMoreLink with onClick; setPopoverVisible, onClickConfigure, blockId; MULTI_SELECT + listData (SKU) for download link | Click View more → setPopoverVisible(false) and onClickConfigure(blockId); click "uploaded" → CSV download with SKU list and skuFileName | P0 | Interactions | All interactive handlers in one test |
30
+ | UC-005 | Content: normal, empty, long | operand/listData: normal values; empty listData or []; long operand string; additionalFields: {} vs multiple entries | Renders without crash; empty list shows attachment icon or empty state; long text truncates or wraps; multiple additional conditions show "and" + lineItemMsg | P1 | ContentVariants | Normal, empty, long, multiple conditions |
31
+ | UC-006 | Styling (className) | className: "custom-class" | Root has class "custom-class" and "cap-condition-wrapper"; layout and styled labels (pill background) unchanged | P1 | Styling | className only; no style prop on component |
32
+ | UC-007 | Additional fields (EXTENDED_FIELD, CUSTOM_FIELD, STORE_FILTER, multiple) | additionalFields: EXTENDED_FIELD, CUSTOM_FIELD, STORE_FILTER; expression with operator/operand; multiple keys | Correct description, operator label, and OperandValues for each; "only for lineitems with" and "and" between items when multiple | P0 | AdditionalFields | Grouped all additional field variants |
33
+ | UC-008 | DATE_TYPE sub-variants (RANGE, SINGLE, DAYS_AFTER, DAYS_BEFORE) | type: DATE; dateTypeData: RANGE (startDate, endDate), SINGLE (date or contextData.profileName), DAYS_AFTER/DAYS_BEFORE (days, contextData) | RANGE: "between" + two formatted dates; SINGLE: date or "End date of {profileName} event date attribute"; DAYS_AFTER/BEFORE: "{days} days after/before" + End date of profile | P0 | DateTypeVariants | Grouped RANGE, SINGLE, DAYS_AFTER, DAYS_BEFORE |
34
+ | UC-009 | DATE_TYPE edge cases | dateTypeData: null, undefined; dateType: null, "", "INVALID_TYPE"; startDate/endDate/date: null, undefined, "", invalid string | No date content rendered when null/undefined/invalid; no crash; empty dates show "and" only where applicable | P1 | DateTypeEdgeCases | Production-safe null/undefined/invalid handling |
35
+ | UC-010 | STRING_LIST single vs multiple | type: STRING_LIST; operand: [single] vs [v1, v2, …] | Single: "value1" only; multiple: "value1 +N more" with correct count | P1 | StringListContent | Grouped single and multiple values |
36
+ | UC-011 | MULTI_SELECT: SKU (download) vs non-SKU vs store upload | type: MULTI_SELECT; listData; additionalFields SKU vs none vs STORE_FILTER with UPLOAD | SKU: TruncateList + "uploaded" download link; non-SKU: TruncateList only; store upload: StoreUploadMsg + View more | P0 | MultiSelectVariants | SKU download, list-only, store upload |
37
+ | UC-012 | Entry trigger event attribute | type: ENTRY_TRIGGER_EVENT_ATTRIBUTE; entryTriggerEventAttribute: string; operator | Shows operator label and "Entry trigger event attribute" + attribute name (e.g. "fact1") | P1 | EntryTriggerAttribute | Single test for entry trigger block |
38
+ | UC-013 | Event handlers and callbacks | ViewMoreLink onClick, setPopoverVisible, onClickConfigure; download (setAttribute href/download) | All callbacks invoked with correct args; download link gets correct data URI and filename | P1 | EventHandlers | Grouped all handlers; no mock of Cap components |
39
+ | UC-014 | OperandsMapping labels (i18n) | All operator keys: equalMsg, greaterThanMsg, lessThanMsg, greaterThanOrEqualMsg, lessThanorEqualMsg, inRangeMsg, notEqualMsg, inMsg, notInMsg, date msgs | Correct translated label for each operator in UI | P1 | OperandsMapping | Grouped all operator label props |
40
+ | UC-015 | Empty or missing operand / listData | operand: null, undefined, ""; listData: null, []; type NUMBER/STRING/LIST/MULTI_SELECT | No crash; missing values render empty or fallback (e.g. attachment icon for MULTI_SELECT with no listData) | P1 | EmptyOperand | Edge case for missing data |
41
+ | UC-016 | DATE_TYPE_SINGLE with contextData vs raw date | dateTypeData: SINGLE with date only vs contextData only vs both (contextData takes precedence) | Raw date: formatted date; contextData: "End date of {profileName} event date attribute"; both: contextData branch shown | P1 | DateSingleContext | Precedence and profile name display |
42
+ | UC-017 | Format date for preview (YYYY-MM-DD, ISO, invalid) | dateTypeData with date: "2024-01-15", "2024-01-15T00:00:00.000Z", "invalid" | YYYY-MM-DD and ISO format as en-US locale; invalid returns empty string, no broken UI | P1 | FormatDateForPreview | Timezone-safe and invalid handling |
43
+ | UC-018 | Migration parity (v3 → v6) | Same props as v3 usage; FormattedMessage (react-intl); no antd in component | Same copy and structure as v3; FormattedMessage resolves; no antd dependency in CapConditionPreview | P0 | MigrationParity | i18n and structure parity |
44
+ | UC-019 | Default and optional props | listData=null, hideNumberAndProductFields=false; omit optional msg props (use defaults from LocaleHoc) | Sensible defaults; no crash when optional props omitted; LocaleHoc provides messages | P2 | DefaultProps | Grouped default/optional behavior |
45
+ | UC-020 | Multiple additional conditions (and + lineItemMsg) | additionalFields with 2+ entries (e.g. EXTENDED_FIELD + CUSTOM_FIELD) | First condition without "and"; subsequent with "and" + lineItemMsg; each shows description + operator + OperandValues | P1 | MultipleAdditionalConditions | And/lineItemMsg grouping |
46
+
47
+ ---
48
+
49
+ ## Requirements checklist
50
+
51
+ - Stay within strict limit for complexity level: **medium ≤20** (20 rows).
52
+ - Group similar scenarios aggressively (types, operators, store states, date variants, events).
53
+ - Each test is manually verifiable in Storybook and with RTL.
54
+ - Focus on real-world usage (conditions, store filter, SKU, dates).
55
+ - Prioritize P0/P1 over P2.
56
+ - Grouping rationale noted in Notes column.
57
+
58
+ ---
59
+
60
+ ## Testing notes (Do / Don't)
61
+
62
+ - **Do:** Use React Testing Library with Jest; prefer `data-testid` for querying; clear mocks between tests if applicable.
63
+ - **Don't:** Mock Cap UI Library components unless instructed; avoid over-reliance on getByRole; don’t write overly complex tests.
64
+
65
+ **If approaching limit, merge more test cases. Quality > quantity.**
@@ -0,0 +1,82 @@
1
+ import type { ReactNode } from 'react';
2
+ /** Context data for date conditions (e.g. profile name) */
3
+ export interface DateTypeContextData {
4
+ profileName?: string;
5
+ }
6
+ /** Shape of dateTypeData prop for DATE type conditions */
7
+ export interface DateTypeData {
8
+ dateType?: 'RANGE' | 'SINGLE' | 'DAYS_AFTER' | 'DAYS_BEFORE';
9
+ startDate?: string | null;
10
+ endDate?: string | null;
11
+ date?: string | null;
12
+ days?: number;
13
+ contextData?: DateTypeContextData | null;
14
+ }
15
+ /** Expression inside additionalFields entries */
16
+ export interface LinkedConditionExpression {
17
+ operator?: string;
18
+ operand?: string[];
19
+ storeSource?: string;
20
+ isStoreUploadFailed?: boolean;
21
+ isStoreUploadInvalid?: boolean;
22
+ storeUploadIsInProgress?: boolean;
23
+ }
24
+ /** Single entry in additionalFields */
25
+ export interface AdditionalFieldEntry {
26
+ description?: string;
27
+ factId?: string;
28
+ expression?: LinkedConditionExpression;
29
+ }
30
+ /** DstData passed to component (e.g. couponSeriesNames fallback) */
31
+ export interface DstData {
32
+ couponSeriesNames?: string[];
33
+ }
34
+ /** View more link component props */
35
+ export interface ViewMoreLinkProps {
36
+ onClick: () => void;
37
+ children: ReactNode;
38
+ }
39
+ export interface CapConditionPreviewProps {
40
+ className?: string;
41
+ type?: string;
42
+ operand?: number | string | string[];
43
+ operator?: string;
44
+ dstData?: DstData;
45
+ listData?: string[] | null;
46
+ additionalFields?: Record<string, AdditionalFieldEntry>;
47
+ isExcluded?: boolean;
48
+ conditionName?: string;
49
+ /** Message strings (typically from translations) */
50
+ excludeMsg?: string;
51
+ includeMsg?: string;
52
+ whoseMsg?: string;
53
+ isMsg?: string;
54
+ andMsg?: string;
55
+ equalMsg?: string;
56
+ greaterThanMsg?: string;
57
+ lessThanMsg?: string;
58
+ greaterThanOrEqualMsg?: string;
59
+ lessThanorEqualMsg?: string;
60
+ inRangeMsg?: string;
61
+ notEqualMsg?: string;
62
+ lineItemMsg?: string;
63
+ addedSKUsMsg?: string;
64
+ skuFileName?: string;
65
+ uploadedMsg?: string;
66
+ inMsg?: string;
67
+ notInMsg?: string;
68
+ /** When true, hides operand/operator block (e.g. for Store profile, Custom fields in journey) */
69
+ hideNumberAndProductFields?: boolean;
70
+ viewMoreMsg?: string;
71
+ storesMsg?: string;
72
+ uploadInProgressMsg?: string;
73
+ ViewMoreLink?: React.ComponentType<ViewMoreLinkProps>;
74
+ onClickConfigure?: (blockId: string) => void;
75
+ blockId?: string;
76
+ setPopoverVisible?: (visible: boolean) => void;
77
+ uploadFailedErrorMsg?: string;
78
+ uploadInvalidErrorMsg?: string;
79
+ entryTriggerEventAttribute?: string;
80
+ dateTypeData?: DateTypeData | null;
81
+ }
82
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../components/CapConditionPreview/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,2DAA2D;AAC3D,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,0DAA0D;AAC1D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,YAAY,GAAG,aAAa,CAAC;IAC7D,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;CAC1C;AAED,iDAAiD;AACjD,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,oBAAoB,CAAC,EAA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