@atlaskit/smart-card 44.6.1 → 44.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +25 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/block-card/block-card-social-proof-cold-cache--default.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/block-card/block-card-social-proof-message-low-tier--default.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/block-card/block-card-social-proof-message-not-low-tier--default.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-override-css--default--dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-override-css--default--dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/cjs/extractors/flexible/actions/extract-rovo-chat-action.js +3 -1
- package/dist/cjs/messages.js +12 -1
- package/dist/cjs/state/hooks/use-block-card-rovo-action-experiment/index.js +69 -0
- package/dist/cjs/state/hooks/use-current-site-cloud-id/index.js +0 -30
- package/dist/cjs/state/hooks/use-incoming-outgoing-links/index.js +3 -3
- package/dist/cjs/state/hooks/use-rovo-chat/constants.js +7 -0
- package/dist/cjs/state/hooks/use-rovo-chat/index.js +2 -2
- package/dist/cjs/state/hooks/use-social-proof/index.js +44 -28
- package/dist/cjs/state/hooks/use-social-proof-experiment/index.js +48 -0
- package/dist/cjs/state/services/current-site-cloud-id/index.js +61 -74
- package/dist/cjs/state/services/personalization/index.js +59 -60
- package/dist/cjs/utils/analytics/analytics.js +1 -1
- package/dist/cjs/view/BlockCard/views/ResolvedView.js +20 -21
- package/dist/cjs/view/BlockCard/views/SocialProofMessage.js +36 -0
- package/dist/cjs/view/BlockCard/views/UnauthorisedView.js +85 -20
- package/dist/cjs/view/FlexibleCard/components/actions/action/action-button/index.js +3 -2
- package/dist/cjs/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/actions/automation-action/index.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/actions/copy-link-action/index.js +3 -1
- package/dist/cjs/view/FlexibleCard/components/actions/preview-action/index.js +5 -3
- package/dist/cjs/view/FlexibleCard/components/actions/rovo-chat-action/index.js +4 -3
- package/dist/cjs/view/FlexibleCard/components/blocks/action-group/index.js +14 -10
- package/dist/cjs/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +10 -9
- package/dist/cjs/view/FlexibleCard/components/blocks/preview-block/resolved/index.js +20 -1
- package/dist/cjs/view/FlexibleCard/components/blocks/utils.js +4 -2
- package/dist/cjs/view/FlexibleCard/components/elements/common/base-badge-element/index.js +3 -2
- package/dist/cjs/view/LinkUrl/index.js +1 -1
- package/dist/es2019/__tests__/vr-tests/__snapshots__/block-card/block-card-social-proof-cold-cache--default.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/block-card/block-card-social-proof-message-low-tier--default.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/block-card/block-card-social-proof-message-not-low-tier--default.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-override-css--default--dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-override-css--default--dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/es2019/extractors/flexible/actions/extract-rovo-chat-action.js +3 -1
- package/dist/es2019/messages.js +12 -1
- package/dist/es2019/state/hooks/use-block-card-rovo-action-experiment/index.js +64 -0
- package/dist/es2019/state/hooks/use-current-site-cloud-id/index.js +0 -1
- package/dist/es2019/state/hooks/use-incoming-outgoing-links/index.js +2 -2
- package/dist/es2019/state/hooks/use-rovo-chat/constants.js +1 -0
- package/dist/es2019/state/hooks/use-rovo-chat/index.js +2 -2
- package/dist/es2019/state/hooks/use-social-proof/index.js +41 -22
- package/dist/es2019/state/hooks/use-social-proof-experiment/index.js +41 -0
- package/dist/es2019/state/services/current-site-cloud-id/index.js +43 -67
- package/dist/es2019/state/services/personalization/index.js +40 -39
- package/dist/es2019/utils/analytics/analytics.js +1 -1
- package/dist/es2019/view/BlockCard/views/ResolvedView.js +29 -31
- package/dist/es2019/view/BlockCard/views/SocialProofMessage.js +27 -0
- package/dist/es2019/view/BlockCard/views/UnauthorisedView.js +83 -15
- package/dist/es2019/view/FlexibleCard/components/actions/action/action-button/index.js +3 -2
- package/dist/es2019/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +3 -1
- package/dist/es2019/view/FlexibleCard/components/actions/automation-action/index.js +3 -1
- package/dist/es2019/view/FlexibleCard/components/actions/copy-link-action/index.js +3 -1
- package/dist/es2019/view/FlexibleCard/components/actions/preview-action/index.js +5 -3
- package/dist/es2019/view/FlexibleCard/components/actions/rovo-chat-action/index.js +4 -3
- package/dist/es2019/view/FlexibleCard/components/blocks/action-group/index.js +14 -9
- package/dist/es2019/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +10 -9
- package/dist/es2019/view/FlexibleCard/components/blocks/preview-block/resolved/index.js +23 -1
- package/dist/es2019/view/FlexibleCard/components/blocks/utils.js +4 -3
- package/dist/es2019/view/FlexibleCard/components/elements/common/base-badge-element/index.js +3 -2
- package/dist/es2019/view/LinkUrl/index.js +1 -1
- package/dist/esm/__tests__/vr-tests/__snapshots__/block-card/block-card-social-proof-cold-cache--default.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/block-card/block-card-social-proof-message-low-tier--default.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/block-card/block-card-social-proof-message-not-low-tier--default.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-override-css--default--dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-override-css--default--dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-false-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-false.png +3 -0
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-true-dfo-fix-preview-dynamic-style-true.png +3 -0
- package/dist/esm/extractors/flexible/actions/extract-rovo-chat-action.js +3 -1
- package/dist/esm/messages.js +12 -1
- package/dist/esm/state/hooks/use-block-card-rovo-action-experiment/index.js +62 -0
- package/dist/esm/state/hooks/use-current-site-cloud-id/index.js +0 -1
- package/dist/esm/state/hooks/use-incoming-outgoing-links/index.js +2 -2
- package/dist/esm/state/hooks/use-rovo-chat/constants.js +1 -0
- package/dist/esm/state/hooks/use-rovo-chat/index.js +2 -2
- package/dist/esm/state/hooks/use-social-proof/index.js +45 -29
- package/dist/esm/state/hooks/use-social-proof-experiment/index.js +41 -0
- package/dist/esm/state/services/current-site-cloud-id/index.js +59 -72
- package/dist/esm/state/services/personalization/index.js +56 -59
- package/dist/esm/utils/analytics/analytics.js +1 -1
- package/dist/esm/view/BlockCard/views/ResolvedView.js +20 -21
- package/dist/esm/view/BlockCard/views/SocialProofMessage.js +29 -0
- package/dist/esm/view/BlockCard/views/UnauthorisedView.js +85 -20
- package/dist/esm/view/FlexibleCard/components/actions/action/action-button/index.js +3 -2
- package/dist/esm/view/FlexibleCard/components/actions/ai-summary-action/ai-summarise-action.js +3 -1
- package/dist/esm/view/FlexibleCard/components/actions/automation-action/index.js +3 -1
- package/dist/esm/view/FlexibleCard/components/actions/copy-link-action/index.js +3 -1
- package/dist/esm/view/FlexibleCard/components/actions/preview-action/index.js +5 -3
- package/dist/esm/view/FlexibleCard/components/actions/rovo-chat-action/index.js +4 -3
- package/dist/esm/view/FlexibleCard/components/blocks/action-group/index.js +14 -10
- package/dist/esm/view/FlexibleCard/components/blocks/footer-block/resolved/index.js +10 -9
- package/dist/esm/view/FlexibleCard/components/blocks/preview-block/resolved/index.js +20 -1
- package/dist/esm/view/FlexibleCard/components/blocks/utils.js +4 -2
- package/dist/esm/view/FlexibleCard/components/elements/common/base-badge-element/index.js +3 -2
- package/dist/esm/view/LinkUrl/index.js +1 -1
- package/dist/types/messages.d.ts +1 -1
- package/dist/types/state/hooks/use-block-card-rovo-action-experiment/index.d.ts +27 -0
- package/dist/types/state/hooks/use-current-site-cloud-id/index.d.ts +0 -1
- package/dist/types/state/hooks/use-rovo-chat/constants.d.ts +2 -0
- package/dist/types/state/hooks/use-social-proof/index.d.ts +17 -4
- package/dist/types/state/hooks/use-social-proof-experiment/index.d.ts +39 -0
- package/dist/types/state/services/current-site-cloud-id/index.d.ts +9 -33
- package/dist/types/state/services/personalization/index.d.ts +14 -24
- package/dist/types/view/BlockCard/views/SocialProofMessage.d.ts +14 -0
- package/dist/types/view/FlexibleCard/components/blocks/utils.d.ts +2 -1
- package/dist/types-ts4.5/messages.d.ts +1 -1
- package/dist/types-ts4.5/state/hooks/use-block-card-rovo-action-experiment/index.d.ts +27 -0
- package/dist/types-ts4.5/state/hooks/use-current-site-cloud-id/index.d.ts +0 -1
- package/dist/types-ts4.5/state/hooks/use-rovo-chat/constants.d.ts +2 -0
- package/dist/types-ts4.5/state/hooks/use-social-proof/index.d.ts +17 -4
- package/dist/types-ts4.5/state/hooks/use-social-proof-experiment/index.d.ts +39 -0
- package/dist/types-ts4.5/state/services/current-site-cloud-id/index.d.ts +9 -33
- package/dist/types-ts4.5/state/services/personalization/index.d.ts +14 -24
- package/dist/types-ts4.5/view/BlockCard/views/SocialProofMessage.d.ts +14 -0
- package/dist/types-ts4.5/view/FlexibleCard/components/blocks/utils.d.ts +2 -1
- package/package.json +11 -2
- package/smart-card.docs.tsx +2 -2
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-false.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-true.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-false.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-true.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-false.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-true.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-override-css--default.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-false.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-true.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-false.png +0 -3
- package/dist/cjs/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-true.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-false.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-true.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-false.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-true.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-false.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-true.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-override-css--default.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-false.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-true.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-false.png +0 -3
- package/dist/es2019/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-true.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-false.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-large--default--navx-1895-new-logo-design-true.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-false.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-medium--default--navx-1895-new-logo-design-true.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-false.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-mixed-padding--default--navx-1895-new-logo-design-true.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-override-css--default.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-false.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-small--default--navx-1895-new-logo-design-true.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-false.png +0 -3
- package/dist/esm/__tests__/vr-tests/__snapshots__/flexible-card/flexible-ui-block-preview-xlarge--default--navx-1895-new-logo-design-true.png +0 -3
|
@@ -3,6 +3,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
3
3
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
4
4
|
import { ActionName } from '../../../constants';
|
|
5
5
|
import { getDefinitionId, getExtensionKey, getResourceType } from '../../../state/helpers';
|
|
6
|
+
import { isBlockCardRovoActionExperimentEnabled } from '../../../state/hooks/use-block-card-rovo-action-experiment';
|
|
6
7
|
import { canShowAction } from '../../../utils/actions/can-show-action';
|
|
7
8
|
import { getIsRovoChatEnabled } from '../../../utils/rovo';
|
|
8
9
|
import { CardAction } from '../../../view/Card/types';
|
|
@@ -26,9 +27,10 @@ const extractRovoChatAction = ({
|
|
|
26
27
|
}
|
|
27
28
|
const extensionKey = getExtensionKey(response);
|
|
28
29
|
const isGoogleProvider = extensionKey === 'google-object-provider';
|
|
30
|
+
const is3PBlockExperimentEnabled = isBlockCardRovoActionExperimentEnabled(product);
|
|
29
31
|
const is3PAuthRovoActionEnabled = isGoogleProvider && fg('platform_sl_3p_auth_rovo_action_kill_switch');
|
|
30
32
|
const is3PInlinePostAuthActionsEnabled = extensionKey !== undefined && ELIGIBLE_EXTENSION_KEYS.has(extensionKey) && fg('rovogrowth-640-inline-action-nudge-fg') && expValEqualsNoExposure('rovogrowth-640-inline-action-nudge-exp', 'isEnabled', true);
|
|
31
|
-
const is3PBlockPostAuthActionsEnabled = extensionKey !== undefined && ELIGIBLE_EXTENSION_KEYS.has(extensionKey) &&
|
|
33
|
+
const is3PBlockPostAuthActionsEnabled = extensionKey !== undefined && ELIGIBLE_EXTENSION_KEYS.has(extensionKey) && is3PBlockExperimentEnabled;
|
|
32
34
|
const isSupportedFeature = is3PInlinePostAuthActionsEnabled || is3PAuthRovoActionEnabled || is3PBlockPostAuthActionsEnabled;
|
|
33
35
|
const isOptIn = (actionOptions === null || actionOptions === void 0 ? void 0 : (_actionOptions$rovoCh = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh === void 0 ? void 0 : _actionOptions$rovoCh.optIn) === true;
|
|
34
36
|
const url = extractSmartLinkUrl(response);
|
package/dist/es2019/messages.js
CHANGED
|
@@ -988,7 +988,7 @@ export const messages = defineMessages({
|
|
|
988
988
|
},
|
|
989
989
|
rovo_prompt_message_highlight_relevant_content: {
|
|
990
990
|
id: 'fabric.linking.rovo_prompt_message_highlight_relevant_content.non-final',
|
|
991
|
-
defaultMessage:
|
|
991
|
+
defaultMessage: "<p>Based on this linked item (<a>{url}</a>) and the {context} I'm currently viewing, highlight the parts of the linked content that are most relevant to this work. Explain briefly why each part is relevant.</p>",
|
|
992
992
|
description: 'The prompt message to send to Rovo Chat. {context} refers to the content the user triggered from, e.g. Confluence page or Jira work item. {url} refers to Smart Link that the user triggers this action from. (Please make sure all html tags remain the same.)'
|
|
993
993
|
},
|
|
994
994
|
rovo_prompt_button_identify_key_trends: {
|
|
@@ -1050,5 +1050,16 @@ export const messages = defineMessages({
|
|
|
1050
1050
|
id: 'fabric.linking.rovo_prompt_button_show_me_whats_relevant.non-final',
|
|
1051
1051
|
defaultMessage: `Show me what's relevant`,
|
|
1052
1052
|
description: 'The name of the action to send prompt message to Rovo Chat in relation to current Smart Link'
|
|
1053
|
+
},
|
|
1054
|
+
// TODO: remove when social-proof-3p-unauth-block-fg is cleaned up
|
|
1055
|
+
pre_auth_block_social_proof_not_low: {
|
|
1056
|
+
id: 'fabric.linking.pre_auth_block_social_proof_not_low',
|
|
1057
|
+
defaultMessage: '<b>{percentage}%</b> of your team is previewing <b>{provider}</b>.',
|
|
1058
|
+
description: 'Social proof message shown on unauthorized 3P block cards when 30% or more of the tenant has connected the provider. {percentage} is a number, {provider} is the 3P app name (e.g. OneDrive).'
|
|
1059
|
+
},
|
|
1060
|
+
pre_auth_block_social_proof_low: {
|
|
1061
|
+
id: 'fabric.linking.pre_auth_block_social_proof_low',
|
|
1062
|
+
defaultMessage: 'Your team is previewing <b>{provider}</b>.',
|
|
1063
|
+
description: 'Social proof message shown on unauthorized 3P block cards when less than 30% of the tenant has connected the provider. {provider} is the 3P app name (e.g. OneDrive).'
|
|
1053
1064
|
}
|
|
1054
1065
|
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
5
|
+
import { getIsRovoChatEnabled } from '../../../utils/rovo';
|
|
6
|
+
import { getExtensionKey } from '../../helpers';
|
|
7
|
+
import { useSmartCardState } from '../../store';
|
|
8
|
+
import { JIRA_PRODUCTS } from '../use-rovo-chat/constants';
|
|
9
|
+
import useRovoConfig from '../use-rovo-config';
|
|
10
|
+
const ELIGIBLE_EXTENSION_KEYS = new Set(['slack-object-provider', 'google-object-provider', 'onedrive-object-provider', 'github-object-provider', 'ms-teams-object-provider', 'gitlab-object-provider', 'salesforce-object-provider']);
|
|
11
|
+
const NOT_ENABLED_RESULT = {
|
|
12
|
+
isEnabled: false
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Returns whether the platform_sl_3p_auth_rovo_block_card_jira or platform_sl_3p_auth_rovo_block_card_confluence experiment
|
|
17
|
+
* is enabled for the current user and link context.
|
|
18
|
+
*
|
|
19
|
+
* All eligibility criteria are consolidated here:
|
|
20
|
+
* 1. Rovo chat must be enabled for the tenant.
|
|
21
|
+
* 2. The consumer must have opted in via actionOptions.rovoChatAction.optIn.
|
|
22
|
+
* 3. The link must support the RovoActions feature.
|
|
23
|
+
* 4. The extension key must be one of the supported options.
|
|
24
|
+
* 5. The experiment value must be true (via tmp-editor-statsig).
|
|
25
|
+
*
|
|
26
|
+
* The extension key is derived from the card store via the resolved URL,
|
|
27
|
+
* so callers don't need to thread it as a prop.
|
|
28
|
+
*/
|
|
29
|
+
const useBlockCardRovoActionExperiment = (url, actionOptions) => {
|
|
30
|
+
var _actionOptions$rovoCh, _actionOptions$rovoCh2;
|
|
31
|
+
const {
|
|
32
|
+
rovoOptions: rovoConfig,
|
|
33
|
+
product
|
|
34
|
+
} = useRovoConfig();
|
|
35
|
+
const isRovoChatEnabled = getIsRovoChatEnabled(rovoConfig);
|
|
36
|
+
const cardState = useSmartCardState(url !== null && url !== void 0 ? url : '');
|
|
37
|
+
const extensionKey = getExtensionKey(cardState.details);
|
|
38
|
+
const isRovoChatActionOptedIn = (_actionOptions$rovoCh = actionOptions === null || actionOptions === void 0 ? void 0 : (_actionOptions$rovoCh2 = actionOptions.rovoChatAction) === null || _actionOptions$rovoCh2 === void 0 ? void 0 : _actionOptions$rovoCh2.optIn) !== null && _actionOptions$rovoCh !== void 0 ? _actionOptions$rovoCh : false;
|
|
39
|
+
return useMemo(() => {
|
|
40
|
+
if (!isRovoChatEnabled || !url || !isRovoChatActionOptedIn) {
|
|
41
|
+
return NOT_ENABLED_RESULT;
|
|
42
|
+
}
|
|
43
|
+
if (extensionKey && !ELIGIBLE_EXTENSION_KEYS.has(extensionKey)) {
|
|
44
|
+
return NOT_ENABLED_RESULT;
|
|
45
|
+
}
|
|
46
|
+
const isJiraEnabled = !!product && JIRA_PRODUCTS.includes(product) && fg('platform_sl_3p_auth_rovo_block_jira_kill_switch') && expValEquals('platform_sl_3p_auth_rovo_block_card_jira', 'isEnabled', true);
|
|
47
|
+
const isConfluenceEnabled = !!product && product === 'CONFLUENCE' && fg('platform_sl_3p_auth_rovo_block_card_kill_switch') && expValEquals('platform_sl_3p_auth_rovo_block_card_confluence', 'isEnabled', true);
|
|
48
|
+
return {
|
|
49
|
+
isEnabled: isJiraEnabled || isConfluenceEnabled
|
|
50
|
+
};
|
|
51
|
+
}, [isRovoChatEnabled, extensionKey, url, isRovoChatActionOptedIn, product]);
|
|
52
|
+
};
|
|
53
|
+
export const isBlockCardRovoActionExperimentEnabled = product => {
|
|
54
|
+
const isJiraEnabled = !!product && JIRA_PRODUCTS.includes(product) && fg('platform_sl_3p_auth_rovo_block_jira_kill_switch') && expValEqualsNoExposure('platform_sl_3p_auth_rovo_block_card_jira', 'isEnabled', true);
|
|
55
|
+
const isConfluenceEnabled = !!product && product === 'CONFLUENCE' && fg('platform_sl_3p_auth_rovo_block_card_kill_switch') && expValEqualsNoExposure('platform_sl_3p_auth_rovo_block_card_confluence', 'isEnabled', true);
|
|
56
|
+
return isJiraEnabled || isConfluenceEnabled;
|
|
57
|
+
};
|
|
58
|
+
export const useBlockCardRovoActionExperimentNoExposure = () => {
|
|
59
|
+
const {
|
|
60
|
+
product
|
|
61
|
+
} = useRovoConfig();
|
|
62
|
+
return isBlockCardRovoActionExperimentEnabled(product);
|
|
63
|
+
};
|
|
64
|
+
export default useBlockCardRovoActionExperiment;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
import { getCurrentSiteCloudId } from '../../services/current-site-cloud-id';
|
|
3
|
-
export { CURRENT_SITE_CLOUD_ID_LOCAL_STORAGE_KEY, CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY, currentSiteCloudIdService, getCurrentSiteCloudId, getCachedCurrentSiteCloudIdAndRefresh } from '../../services/current-site-cloud-id';
|
|
4
3
|
const useCurrentSiteCloudId = () => {
|
|
5
4
|
const [cloudId, setCloudId] = useState(undefined);
|
|
6
5
|
const [isLoading, setIsLoading] = useState(true);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCallback, useMemo } from 'react';
|
|
2
2
|
import { request } from '@atlaskit/linking-common';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
-
import { getCurrentSiteCloudId } from '
|
|
4
|
+
import { getCurrentSiteCloudId } from '../../services/current-site-cloud-id';
|
|
5
5
|
import { queryIncomingOutgoingLinks as queryIncomingOutgoingAris } from './query';
|
|
6
6
|
/**
|
|
7
7
|
* @param baseUriWithNoTrailingSlash base url which will then be appended with /gateway/api/graphql to make requests to AGG
|
|
@@ -33,7 +33,7 @@ const useIncomingOutgoingAri = (baseUriWithNoTrailingSlash = '') => {
|
|
|
33
33
|
if (match && match[2]) {
|
|
34
34
|
return match[2]; // Return the cloud_id (siteId)
|
|
35
35
|
}
|
|
36
|
-
return fg('
|
|
36
|
+
return fg('platform_sl_incoming_outgoing_tenant_info_killswitch') ? await getCurrentSiteCloudId(baseUriWithNoTrailingSlash) : await getCurrentSiteId();
|
|
37
37
|
}, [getCurrentSiteId, baseUriWithNoTrailingSlash]);
|
|
38
38
|
const getIncomingOutgoingAris = useCallback(
|
|
39
39
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const JIRA_PRODUCTS = ['JSM', 'JWM', 'JSW', 'JPD'];
|
|
@@ -3,6 +3,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
3
3
|
import { useRovoPostMessageToPubsub } from '@atlaskit/rovo-triggers/post-message-to-pubsub';
|
|
4
4
|
import { getIsRovoChatEnabled } from '../../../utils/rovo';
|
|
5
5
|
import useRovoConfig from '../use-rovo-config';
|
|
6
|
+
import { JIRA_PRODUCTS } from './constants';
|
|
6
7
|
const SMART_LINK_TO_ROVO_SOURCE = 'smart-link';
|
|
7
8
|
const useRovoChat = () => {
|
|
8
9
|
const {
|
|
@@ -15,7 +16,6 @@ const useRovoChat = () => {
|
|
|
15
16
|
const isRovoChatEnabled = getIsRovoChatEnabled(config);
|
|
16
17
|
const sendPromptMessage = useCallback(data => {
|
|
17
18
|
var _window$parent;
|
|
18
|
-
const jiraProducts = ['JSM', 'JWM', 'JSW', 'JPD'];
|
|
19
19
|
publishWithPostMessage({
|
|
20
20
|
targetWindow: (_window$parent = window.parent) !== null && _window$parent !== void 0 ? _window$parent : window,
|
|
21
21
|
payload: {
|
|
@@ -27,7 +27,7 @@ const useRovoChat = () => {
|
|
|
27
27
|
agentId: undefined
|
|
28
28
|
},
|
|
29
29
|
openChat: true,
|
|
30
|
-
openChatMode: product &&
|
|
30
|
+
openChatMode: product && JIRA_PRODUCTS.includes(product) && fg('platform_sl_3p_auth_rovo_block_jira_kill_switch') || fg('rovogrowth-640-inline-action-nudge-fg') ? 'mini-modal' : 'sidebar'
|
|
31
31
|
},
|
|
32
32
|
onAcknowledgeTimeout: () => {
|
|
33
33
|
// NAVX-3599: Add analytics event
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useEffect, useMemo, useState } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { getCurrentSiteCloudId, getCurrentSiteCloudIdSync } from '../../services/current-site-cloud-id';
|
|
3
|
+
import { getProviderPctMap, getProviderPctMapSync, SOCIAL_PROOF_TRAIT_NAME } from '../../services/personalization';
|
|
3
4
|
const NOT_ENABLED_RESULT = {
|
|
4
5
|
connectedPct: undefined,
|
|
5
6
|
isEnabled: false,
|
|
@@ -7,39 +8,57 @@ const NOT_ENABLED_RESULT = {
|
|
|
7
8
|
};
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* Cache-first social proof hook.
|
|
12
|
+
*
|
|
13
|
+
* On mount:
|
|
14
|
+
* 1. Reads localStorage synchronously via `getProviderPctMapSync`.
|
|
15
|
+
* - If data exists (warm cache): sets `providerPctMap` immediately, `isLoading = false`.
|
|
16
|
+
* - If no data (cold cache): leaves `providerPctMap` undefined, `isLoading = false`.
|
|
17
|
+
* 2. Always kicks off an async fetch (fire-and-forget) via `getProviderPctMap` to populate
|
|
18
|
+
* localStorage for next page load. Does NOT update state with the async result.
|
|
19
|
+
*
|
|
20
|
+
* This means:
|
|
21
|
+
* - First page visit (cold): no social proof rendered, no experiment exposure fired.
|
|
22
|
+
* Background fetch populates localStorage for next time.
|
|
23
|
+
* - Second page visit (warm): social proof renders immediately from localStorage.
|
|
24
|
+
* Background refresh keeps localStorage fresh.
|
|
25
|
+
*
|
|
26
|
+
* Callers decide separately (e.g. via Statsig experiment) whether to surface the data.
|
|
13
27
|
*/
|
|
14
|
-
const useSocialProof = (
|
|
28
|
+
const useSocialProof = (extensionKey, isKillswitchOn = false, baseUriWithNoTrailingSlash = '') => {
|
|
15
29
|
const isEnabled = isKillswitchOn;
|
|
16
|
-
const [
|
|
17
|
-
|
|
30
|
+
const [snapshot] = useState(() => {
|
|
31
|
+
if (!isEnabled) {
|
|
32
|
+
return {
|
|
33
|
+
cloudId: undefined,
|
|
34
|
+
providerPctMap: null
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const cloudId = getCurrentSiteCloudIdSync(baseUriWithNoTrailingSlash);
|
|
38
|
+
return {
|
|
39
|
+
cloudId,
|
|
40
|
+
providerPctMap: getProviderPctMapSync(cloudId, SOCIAL_PROOF_TRAIT_NAME)
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// Fire-and-forget: warm caches for future mounts only. Never update this mount's treatment UI.
|
|
18
45
|
useEffect(() => {
|
|
19
46
|
if (!isEnabled) {
|
|
20
47
|
return;
|
|
21
48
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
getProviderPctMap(traitName).then(pctMap => {
|
|
25
|
-
if (!cancelled) {
|
|
26
|
-
setProviderPctMap(pctMap);
|
|
27
|
-
setIsPersonalizationLoading(false);
|
|
28
|
-
}
|
|
49
|
+
void getCurrentSiteCloudId(baseUriWithNoTrailingSlash).then(cloudId => {
|
|
50
|
+
void getProviderPctMap(cloudId, SOCIAL_PROOF_TRAIT_NAME);
|
|
29
51
|
});
|
|
30
|
-
|
|
31
|
-
cancelled = true;
|
|
32
|
-
};
|
|
33
|
-
}, [isEnabled, traitName]);
|
|
52
|
+
}, [baseUriWithNoTrailingSlash, isEnabled]);
|
|
34
53
|
return useMemo(() => {
|
|
35
54
|
if (!isEnabled) {
|
|
36
55
|
return NOT_ENABLED_RESULT;
|
|
37
56
|
}
|
|
38
57
|
return {
|
|
39
|
-
connectedPct: extensionKey && providerPctMap ? providerPctMap[extensionKey] : undefined,
|
|
40
|
-
isEnabled,
|
|
41
|
-
isLoading:
|
|
58
|
+
connectedPct: extensionKey && snapshot.providerPctMap ? snapshot.providerPctMap[extensionKey] : undefined,
|
|
59
|
+
isEnabled: Boolean(snapshot.cloudId && snapshot.providerPctMap),
|
|
60
|
+
isLoading: false // sync read is instant; never in "loading" state
|
|
42
61
|
};
|
|
43
|
-
}, [extensionKey, isEnabled,
|
|
62
|
+
}, [extensionKey, isEnabled, snapshot]);
|
|
44
63
|
};
|
|
45
64
|
export default useSocialProof;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
|
+
import useSocialProof from '../use-social-proof';
|
|
4
|
+
const TIER_THRESHOLD = 30;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Returns enrollment and treatment state for the social proof unauth block card experiment.
|
|
8
|
+
*
|
|
9
|
+
* Delegates data-fetching to `useSocialProof` (Sasha's shared service layer),
|
|
10
|
+
* which handles cloudId resolution, TAP trait fetch, localStorage caching,
|
|
11
|
+
* request deduping, and sync reads.
|
|
12
|
+
*
|
|
13
|
+
* This hook adds the experiment/cohort layer on top:
|
|
14
|
+
* - Only fires exposure (via editorExperiment) when data has loaded.
|
|
15
|
+
* - Derives `tier` and `isTreatment` for rendering decisions.
|
|
16
|
+
*
|
|
17
|
+
* Expected to be called only inside the fg-enabled branch (via componentWithFG).
|
|
18
|
+
*
|
|
19
|
+
* @param extensionKey - The extensionKey of the current 3P provider (e.g. 'google-object-provider').
|
|
20
|
+
*/
|
|
21
|
+
const useSocialProofExperiment = (extensionKey, baseUriWithNoTrailingSlash = '') => {
|
|
22
|
+
const {
|
|
23
|
+
connectedPct,
|
|
24
|
+
isEnabled,
|
|
25
|
+
isLoading
|
|
26
|
+
} = useSocialProof(extensionKey, true, baseUriWithNoTrailingSlash);
|
|
27
|
+
return useMemo(() => {
|
|
28
|
+
const hasSocialProofData = connectedPct !== undefined;
|
|
29
|
+
|
|
30
|
+
// Only fire exposure when data has loaded (prevents exposure inflation)
|
|
31
|
+
const isTreatment = isEnabled && !isLoading && hasSocialProofData ? editorExperiment('social_proof_3p_unauth_block_exp', true) : false;
|
|
32
|
+
const tier = connectedPct !== undefined && connectedPct >= TIER_THRESHOLD ? 'not-low' : 'low';
|
|
33
|
+
return {
|
|
34
|
+
isTreatment,
|
|
35
|
+
tier,
|
|
36
|
+
connectedPct,
|
|
37
|
+
isLoading
|
|
38
|
+
};
|
|
39
|
+
}, [isEnabled, isLoading, connectedPct]);
|
|
40
|
+
};
|
|
41
|
+
export default useSocialProofExperiment;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { StorageClient } from '@atlaskit/frontend-utilities/storage-client';
|
|
3
3
|
import { request } from '@atlaskit/linking-common';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* stores rows as `<clientKey>_<itemKey>` with `clientKey === '@atlaskit/smart-card'` and
|
|
8
|
-
* `itemKey === 'site-cloud-id:v1'` (no further scope segments; unlike `pct-map:v1:`, this is a single fixed row).
|
|
9
|
-
*/
|
|
10
|
-
const SMART_CARD_STORAGE_SCOPE = '@atlaskit/smart-card';
|
|
11
|
-
export const CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY = 'site-cloud-id:v1';
|
|
4
|
+
const SMART_CARD_STORAGE_SCOPE = 'smart-card-social-proof';
|
|
5
|
+
export const CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY_PREFIX = 'site-cloud-id:v1:';
|
|
6
|
+
export const CURRENT_SITE_CLOUD_ID_TTL_MS = 24 * 60 * 60 * 1000;
|
|
12
7
|
const smartCardStorage = new StorageClient(SMART_CARD_STORAGE_SCOPE);
|
|
8
|
+
function normalizeBaseUri(baseUriWithNoTrailingSlash = '') {
|
|
9
|
+
return baseUriWithNoTrailingSlash.replace(/\/$/, '');
|
|
10
|
+
}
|
|
11
|
+
function cloudIdStorageItemKey(baseUriWithNoTrailingSlash = '') {
|
|
12
|
+
return `${CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY_PREFIX}${encodeURIComponent(normalizeBaseUri(baseUriWithNoTrailingSlash))}`;
|
|
13
|
+
}
|
|
13
14
|
|
|
14
15
|
/** Keys written by this service in localStorage when using {@link smartCardStorage}. */
|
|
15
|
-
export const
|
|
16
|
+
export const getCurrentSiteCloudIdLocalStorageKey = (baseUriWithNoTrailingSlash = '') => `${SMART_CARD_STORAGE_SCOPE}_${cloudIdStorageItemKey(baseUriWithNoTrailingSlash)}`;
|
|
17
|
+
|
|
18
|
+
/** Backwards-compatible default-scope key for existing tests and external assertions. */
|
|
19
|
+
export const CURRENT_SITE_CLOUD_ID_LOCAL_STORAGE_KEY = getCurrentSiteCloudIdLocalStorageKey();
|
|
16
20
|
export class CurrentSiteCloudIdService {
|
|
17
21
|
constructor() {
|
|
18
|
-
|
|
19
|
-
* Holds the shared tenant_info work: one in-flight fetch, then (on success) a settled promise for the session cloud
|
|
20
|
-
* id so later callers never trigger another `tenant_info` in the same page lifetime (until {@link clearCache}).
|
|
21
|
-
*/
|
|
22
|
-
_defineProperty(this, "tenantInfoInflightPromise", null);
|
|
22
|
+
_defineProperty(this, "tenantInfoInflightPromises", new Map());
|
|
23
23
|
}
|
|
24
|
-
readStoredCloudId() {
|
|
24
|
+
readStoredCloudId(baseUriWithNoTrailingSlash = '') {
|
|
25
25
|
try {
|
|
26
|
-
const cloudId = smartCardStorage.getItem(
|
|
26
|
+
const cloudId = smartCardStorage.getItem(cloudIdStorageItemKey(baseUriWithNoTrailingSlash));
|
|
27
27
|
if (typeof cloudId !== 'string' || !cloudId || cloudId === 'undefined') {
|
|
28
28
|
return undefined;
|
|
29
29
|
}
|
|
@@ -32,87 +32,63 @@ export class CurrentSiteCloudIdService {
|
|
|
32
32
|
return undefined;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
writeStoredCloudId(cloudId) {
|
|
35
|
+
writeStoredCloudId(baseUriWithNoTrailingSlash, cloudId) {
|
|
36
36
|
if (!cloudId) {
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
try {
|
|
40
|
-
smartCardStorage.setItemWithExpiry(
|
|
40
|
+
smartCardStorage.setItemWithExpiry(cloudIdStorageItemKey(baseUriWithNoTrailingSlash), cloudId, CURRENT_SITE_CLOUD_ID_TTL_MS);
|
|
41
41
|
} catch {
|
|
42
42
|
// Quota, private-mode, SSR, etc. — same intent as personalization-service.
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
ensureTenantInfoInflightStarted(baseUriWithNoTrailingSlash) {
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
const baseUri = normalizeBaseUri(baseUriWithNoTrailingSlash);
|
|
47
|
+
const existing = this.tenantInfoInflightPromises.get(baseUri);
|
|
48
|
+
if (existing) {
|
|
49
|
+
return existing;
|
|
48
50
|
}
|
|
49
|
-
|
|
51
|
+
const promise = (async () => {
|
|
50
52
|
try {
|
|
51
|
-
const response = await request('get',
|
|
53
|
+
const response = await request('get', `${baseUri}/_edge/tenant_info`);
|
|
52
54
|
const cloudId = response === null || response === void 0 ? void 0 : response.cloudId;
|
|
53
55
|
if (cloudId) {
|
|
54
|
-
this.writeStoredCloudId(cloudId);
|
|
56
|
+
this.writeStoredCloudId(baseUri, cloudId);
|
|
55
57
|
}
|
|
56
|
-
return cloudId ? cloudId : this.readStoredCloudId();
|
|
58
|
+
return cloudId ? cloudId : this.readStoredCloudId(baseUri);
|
|
57
59
|
} catch {
|
|
58
|
-
this.
|
|
59
|
-
|
|
60
|
+
return this.readStoredCloudId(baseUri);
|
|
61
|
+
} finally {
|
|
62
|
+
this.tenantInfoInflightPromises.delete(baseUri);
|
|
60
63
|
}
|
|
61
64
|
})();
|
|
65
|
+
this.tenantInfoInflightPromises.set(baseUri, promise);
|
|
66
|
+
return promise;
|
|
62
67
|
}
|
|
63
68
|
|
|
64
|
-
/**
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
*/
|
|
68
|
-
getCachedCloudIdAndRefresh() {
|
|
69
|
-
this.ensureTenantInfoInflightStarted('');
|
|
70
|
-
return this.readStoredCloudId();
|
|
69
|
+
/** Pure synchronous read scoped to the given base URI. */
|
|
70
|
+
getStoredCloudId(baseUriWithNoTrailingSlash = '') {
|
|
71
|
+
return this.readStoredCloudId(baseUriWithNoTrailingSlash);
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
/** Writes tenant cloud id for tests or callers that intentionally warm storage before edge resolves. */
|
|
74
|
-
persistStoredCloudId(cloudId) {
|
|
75
|
-
this.writeStoredCloudId(cloudId);
|
|
75
|
+
persistStoredCloudId(cloudId, baseUriWithNoTrailingSlash = '') {
|
|
76
|
+
this.writeStoredCloudId(baseUriWithNoTrailingSlash, cloudId);
|
|
76
77
|
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* When local storage already has a tenant cloud id, it is returned immediately; a background tenant_info refresh
|
|
80
|
-
* is still kicked off unless one is already in flight.
|
|
81
|
-
*
|
|
82
|
-
* Without storage, this awaits the deduped in-flight tenant_info (first concurrent caller chooses the URL;
|
|
83
|
-
* all share one promise regardless of subsequent `baseUriWithNoTrailingSlash`).
|
|
84
|
-
*
|
|
85
|
-
* On network success with no cloud id, or on failure: falls back via {@link readStoredCloudId}.
|
|
86
|
-
*/
|
|
87
78
|
async get(baseUriWithNoTrailingSlash = '') {
|
|
88
|
-
const fromStorage = this.readStoredCloudId();
|
|
89
|
-
this.ensureTenantInfoInflightStarted(baseUriWithNoTrailingSlash);
|
|
79
|
+
const fromStorage = this.readStoredCloudId(baseUriWithNoTrailingSlash);
|
|
90
80
|
if (fromStorage) {
|
|
91
81
|
return fromStorage;
|
|
92
82
|
}
|
|
93
|
-
return this.
|
|
83
|
+
return this.ensureTenantInfoInflightStarted(baseUriWithNoTrailingSlash);
|
|
94
84
|
}
|
|
95
85
|
/** Clears session pin and persisted storage so the next {@link get} is a fresh tenant_info fetch. */
|
|
96
86
|
clearCache() {
|
|
97
|
-
this.
|
|
98
|
-
smartCardStorage.removeItem(CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY);
|
|
87
|
+
this.tenantInfoInflightPromises.clear();
|
|
99
88
|
}
|
|
100
89
|
}
|
|
101
90
|
export const currentSiteCloudIdService = new CurrentSiteCloudIdService();
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
* `tenant_info` request and persists the result for subsequent cached reads.
|
|
107
|
-
*/
|
|
108
|
-
export const getCurrentSiteCloudId = (baseUriWithNoTrailingSlash = '') => currentSiteCloudIdService.get(baseUriWithNoTrailingSlash);
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Reads the current site cloud id from browser storage (the `site-cloud-id:v1` row) via the
|
|
112
|
-
* module-level {@link currentSiteCloudIdService} singleton, without awaiting network work.
|
|
113
|
-
* Calling this also starts the shared `tenant_info` refresh in the background when one is not
|
|
114
|
-
* already running, so a later call can observe a refreshed value when available.
|
|
115
|
-
*/
|
|
116
|
-
export function getCachedCurrentSiteCloudIdAndRefresh() {
|
|
117
|
-
return currentSiteCloudIdService.getCachedCloudIdAndRefresh();
|
|
118
|
-
}
|
|
91
|
+
export function getCurrentSiteCloudIdSync(baseUriWithNoTrailingSlash = '') {
|
|
92
|
+
return currentSiteCloudIdService.getStoredCloudId(baseUriWithNoTrailingSlash);
|
|
93
|
+
}
|
|
94
|
+
export const getCurrentSiteCloudId = (baseUriWithNoTrailingSlash = '') => currentSiteCloudIdService.get(baseUriWithNoTrailingSlash);
|