@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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { getCurrentSiteCloudId, getCurrentSiteCloudIdSync } from '../../services/current-site-cloud-id';
|
|
4
|
+
import { getProviderPctMap, getProviderPctMapSync, SOCIAL_PROOF_TRAIT_NAME } from '../../services/personalization';
|
|
4
5
|
var NOT_ENABLED_RESULT = {
|
|
5
6
|
connectedPct: undefined,
|
|
6
7
|
isEnabled: false,
|
|
@@ -8,46 +9,61 @@ var NOT_ENABLED_RESULT = {
|
|
|
8
9
|
};
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* Cache-first social proof hook.
|
|
13
|
+
*
|
|
14
|
+
* On mount:
|
|
15
|
+
* 1. Reads localStorage synchronously via `getProviderPctMapSync`.
|
|
16
|
+
* - If data exists (warm cache): sets `providerPctMap` immediately, `isLoading = false`.
|
|
17
|
+
* - If no data (cold cache): leaves `providerPctMap` undefined, `isLoading = false`.
|
|
18
|
+
* 2. Always kicks off an async fetch (fire-and-forget) via `getProviderPctMap` to populate
|
|
19
|
+
* localStorage for next page load. Does NOT update state with the async result.
|
|
20
|
+
*
|
|
21
|
+
* This means:
|
|
22
|
+
* - First page visit (cold): no social proof rendered, no experiment exposure fired.
|
|
23
|
+
* Background fetch populates localStorage for next time.
|
|
24
|
+
* - Second page visit (warm): social proof renders immediately from localStorage.
|
|
25
|
+
* Background refresh keeps localStorage fresh.
|
|
26
|
+
*
|
|
27
|
+
* Callers decide separately (e.g. via Statsig experiment) whether to surface the data.
|
|
14
28
|
*/
|
|
15
|
-
var useSocialProof = function useSocialProof(
|
|
16
|
-
var isKillswitchOn = arguments.length >
|
|
29
|
+
var useSocialProof = function useSocialProof(extensionKey) {
|
|
30
|
+
var isKillswitchOn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
31
|
+
var baseUriWithNoTrailingSlash = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
17
32
|
var isEnabled = isKillswitchOn;
|
|
18
|
-
var _useState = useState(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
33
|
+
var _useState = useState(function () {
|
|
34
|
+
if (!isEnabled) {
|
|
35
|
+
return {
|
|
36
|
+
cloudId: undefined,
|
|
37
|
+
providerPctMap: null
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
var cloudId = getCurrentSiteCloudIdSync(baseUriWithNoTrailingSlash);
|
|
41
|
+
return {
|
|
42
|
+
cloudId: cloudId,
|
|
43
|
+
providerPctMap: getProviderPctMapSync(cloudId, SOCIAL_PROOF_TRAIT_NAME)
|
|
44
|
+
};
|
|
45
|
+
}),
|
|
46
|
+
_useState2 = _slicedToArray(_useState, 1),
|
|
47
|
+
snapshot = _useState2[0];
|
|
48
|
+
|
|
49
|
+
// Fire-and-forget: warm caches for future mounts only. Never update this mount's treatment UI.
|
|
26
50
|
useEffect(function () {
|
|
27
51
|
if (!isEnabled) {
|
|
28
52
|
return;
|
|
29
53
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
getProviderPctMap(traitName).then(function (pctMap) {
|
|
33
|
-
if (!cancelled) {
|
|
34
|
-
setProviderPctMap(pctMap);
|
|
35
|
-
setIsPersonalizationLoading(false);
|
|
36
|
-
}
|
|
54
|
+
void getCurrentSiteCloudId(baseUriWithNoTrailingSlash).then(function (cloudId) {
|
|
55
|
+
void getProviderPctMap(cloudId, SOCIAL_PROOF_TRAIT_NAME);
|
|
37
56
|
});
|
|
38
|
-
|
|
39
|
-
cancelled = true;
|
|
40
|
-
};
|
|
41
|
-
}, [isEnabled, traitName]);
|
|
57
|
+
}, [baseUriWithNoTrailingSlash, isEnabled]);
|
|
42
58
|
return useMemo(function () {
|
|
43
59
|
if (!isEnabled) {
|
|
44
60
|
return NOT_ENABLED_RESULT;
|
|
45
61
|
}
|
|
46
62
|
return {
|
|
47
|
-
connectedPct: extensionKey && providerPctMap ? providerPctMap[extensionKey] : undefined,
|
|
48
|
-
isEnabled:
|
|
49
|
-
isLoading:
|
|
63
|
+
connectedPct: extensionKey && snapshot.providerPctMap ? snapshot.providerPctMap[extensionKey] : undefined,
|
|
64
|
+
isEnabled: Boolean(snapshot.cloudId && snapshot.providerPctMap),
|
|
65
|
+
isLoading: false // sync read is instant; never in "loading" state
|
|
50
66
|
};
|
|
51
|
-
}, [extensionKey, isEnabled,
|
|
67
|
+
}, [extensionKey, isEnabled, snapshot]);
|
|
52
68
|
};
|
|
53
69
|
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
|
+
var 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
|
+
var useSocialProofExperiment = function useSocialProofExperiment(extensionKey) {
|
|
22
|
+
var baseUriWithNoTrailingSlash = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
23
|
+
var _useSocialProof = useSocialProof(extensionKey, true, baseUriWithNoTrailingSlash),
|
|
24
|
+
connectedPct = _useSocialProof.connectedPct,
|
|
25
|
+
isEnabled = _useSocialProof.isEnabled,
|
|
26
|
+
isLoading = _useSocialProof.isLoading;
|
|
27
|
+
return useMemo(function () {
|
|
28
|
+
var hasSocialProofData = connectedPct !== undefined;
|
|
29
|
+
|
|
30
|
+
// Only fire exposure when data has loaded (prevents exposure inflation)
|
|
31
|
+
var isTreatment = isEnabled && !isLoading && hasSocialProofData ? editorExperiment('social_proof_3p_unauth_block_exp', true) : false;
|
|
32
|
+
var tier = connectedPct !== undefined && connectedPct >= TIER_THRESHOLD ? 'not-low' : 'low';
|
|
33
|
+
return {
|
|
34
|
+
isTreatment: isTreatment,
|
|
35
|
+
tier: tier,
|
|
36
|
+
connectedPct: connectedPct,
|
|
37
|
+
isLoading: isLoading
|
|
38
|
+
};
|
|
39
|
+
}, [isEnabled, isLoading, connectedPct]);
|
|
40
|
+
};
|
|
41
|
+
export default useSocialProofExperiment;
|
|
@@ -5,32 +5,38 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
5
5
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
6
|
import { StorageClient } from '@atlaskit/frontend-utilities/storage-client';
|
|
7
7
|
import { request } from '@atlaskit/linking-common';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* stores rows as `<clientKey>_<itemKey>` with `clientKey === '@atlaskit/smart-card'` and
|
|
12
|
-
* `itemKey === 'site-cloud-id:v1'` (no further scope segments; unlike `pct-map:v1:`, this is a single fixed row).
|
|
13
|
-
*/
|
|
14
|
-
var SMART_CARD_STORAGE_SCOPE = '@atlaskit/smart-card';
|
|
15
|
-
export var CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY = 'site-cloud-id:v1';
|
|
8
|
+
var SMART_CARD_STORAGE_SCOPE = 'smart-card-social-proof';
|
|
9
|
+
export var CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY_PREFIX = 'site-cloud-id:v1:';
|
|
10
|
+
export var CURRENT_SITE_CLOUD_ID_TTL_MS = 24 * 60 * 60 * 1000;
|
|
16
11
|
var smartCardStorage = new StorageClient(SMART_CARD_STORAGE_SCOPE);
|
|
12
|
+
function normalizeBaseUri() {
|
|
13
|
+
var baseUriWithNoTrailingSlash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
14
|
+
return baseUriWithNoTrailingSlash.replace(/\/$/, '');
|
|
15
|
+
}
|
|
16
|
+
function cloudIdStorageItemKey() {
|
|
17
|
+
var baseUriWithNoTrailingSlash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
18
|
+
return "".concat(CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY_PREFIX).concat(encodeURIComponent(normalizeBaseUri(baseUriWithNoTrailingSlash)));
|
|
19
|
+
}
|
|
17
20
|
|
|
18
21
|
/** Keys written by this service in localStorage when using {@link smartCardStorage}. */
|
|
19
|
-
export var
|
|
22
|
+
export var getCurrentSiteCloudIdLocalStorageKey = function getCurrentSiteCloudIdLocalStorageKey() {
|
|
23
|
+
var baseUriWithNoTrailingSlash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
24
|
+
return "".concat(SMART_CARD_STORAGE_SCOPE, "_").concat(cloudIdStorageItemKey(baseUriWithNoTrailingSlash));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** Backwards-compatible default-scope key for existing tests and external assertions. */
|
|
28
|
+
export var CURRENT_SITE_CLOUD_ID_LOCAL_STORAGE_KEY = getCurrentSiteCloudIdLocalStorageKey();
|
|
20
29
|
export var CurrentSiteCloudIdService = /*#__PURE__*/function () {
|
|
21
30
|
function CurrentSiteCloudIdService() {
|
|
22
31
|
_classCallCheck(this, CurrentSiteCloudIdService);
|
|
23
|
-
|
|
24
|
-
* Holds the shared tenant_info work: one in-flight fetch, then (on success) a settled promise for the session cloud
|
|
25
|
-
* id so later callers never trigger another `tenant_info` in the same page lifetime (until {@link clearCache}).
|
|
26
|
-
*/
|
|
27
|
-
_defineProperty(this, "tenantInfoInflightPromise", null);
|
|
32
|
+
_defineProperty(this, "tenantInfoInflightPromises", new Map());
|
|
28
33
|
}
|
|
29
34
|
return _createClass(CurrentSiteCloudIdService, [{
|
|
30
35
|
key: "readStoredCloudId",
|
|
31
36
|
value: function readStoredCloudId() {
|
|
37
|
+
var baseUriWithNoTrailingSlash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
32
38
|
try {
|
|
33
|
-
var cloudId = smartCardStorage.getItem(
|
|
39
|
+
var cloudId = smartCardStorage.getItem(cloudIdStorageItemKey(baseUriWithNoTrailingSlash));
|
|
34
40
|
if (typeof cloudId !== 'string' || !cloudId || cloudId === 'undefined') {
|
|
35
41
|
return undefined;
|
|
36
42
|
}
|
|
@@ -41,12 +47,12 @@ export var CurrentSiteCloudIdService = /*#__PURE__*/function () {
|
|
|
41
47
|
}
|
|
42
48
|
}, {
|
|
43
49
|
key: "writeStoredCloudId",
|
|
44
|
-
value: function writeStoredCloudId(cloudId) {
|
|
50
|
+
value: function writeStoredCloudId(baseUriWithNoTrailingSlash, cloudId) {
|
|
45
51
|
if (!cloudId) {
|
|
46
52
|
return;
|
|
47
53
|
}
|
|
48
54
|
try {
|
|
49
|
-
smartCardStorage.setItemWithExpiry(
|
|
55
|
+
smartCardStorage.setItemWithExpiry(cloudIdStorageItemKey(baseUriWithNoTrailingSlash), cloudId, CURRENT_SITE_CLOUD_ID_TTL_MS);
|
|
50
56
|
} catch (_unused2) {
|
|
51
57
|
// Quota, private-mode, SSR, etc. — same intent as personalization-service.
|
|
52
58
|
}
|
|
@@ -55,67 +61,62 @@ export var CurrentSiteCloudIdService = /*#__PURE__*/function () {
|
|
|
55
61
|
key: "ensureTenantInfoInflightStarted",
|
|
56
62
|
value: function ensureTenantInfoInflightStarted(baseUriWithNoTrailingSlash) {
|
|
57
63
|
var _this = this;
|
|
58
|
-
|
|
59
|
-
|
|
64
|
+
var baseUri = normalizeBaseUri(baseUriWithNoTrailingSlash);
|
|
65
|
+
var existing = this.tenantInfoInflightPromises.get(baseUri);
|
|
66
|
+
if (existing) {
|
|
67
|
+
return existing;
|
|
60
68
|
}
|
|
61
|
-
|
|
69
|
+
var promise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
62
70
|
var response, cloudId;
|
|
63
71
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
64
72
|
while (1) switch (_context.prev = _context.next) {
|
|
65
73
|
case 0:
|
|
66
74
|
_context.prev = 0;
|
|
67
75
|
_context.next = 3;
|
|
68
|
-
return request('get',
|
|
76
|
+
return request('get', "".concat(baseUri, "/_edge/tenant_info"));
|
|
69
77
|
case 3:
|
|
70
78
|
response = _context.sent;
|
|
71
79
|
cloudId = response === null || response === void 0 ? void 0 : response.cloudId;
|
|
72
80
|
if (cloudId) {
|
|
73
|
-
_this.writeStoredCloudId(cloudId);
|
|
81
|
+
_this.writeStoredCloudId(baseUri, cloudId);
|
|
74
82
|
}
|
|
75
|
-
return _context.abrupt("return", cloudId ? cloudId : _this.readStoredCloudId());
|
|
83
|
+
return _context.abrupt("return", cloudId ? cloudId : _this.readStoredCloudId(baseUri));
|
|
76
84
|
case 9:
|
|
77
85
|
_context.prev = 9;
|
|
78
86
|
_context.t0 = _context["catch"](0);
|
|
79
|
-
_this.
|
|
80
|
-
|
|
81
|
-
|
|
87
|
+
return _context.abrupt("return", _this.readStoredCloudId(baseUri));
|
|
88
|
+
case 12:
|
|
89
|
+
_context.prev = 12;
|
|
90
|
+
_this.tenantInfoInflightPromises.delete(baseUri);
|
|
91
|
+
return _context.finish(12);
|
|
92
|
+
case 15:
|
|
82
93
|
case "end":
|
|
83
94
|
return _context.stop();
|
|
84
95
|
}
|
|
85
|
-
}, _callee, null, [[0, 9]]);
|
|
96
|
+
}, _callee, null, [[0, 9, 12, 15]]);
|
|
86
97
|
}))();
|
|
98
|
+
this.tenantInfoInflightPromises.set(baseUri, promise);
|
|
99
|
+
return promise;
|
|
87
100
|
}
|
|
88
101
|
|
|
89
|
-
/**
|
|
90
|
-
* Returns the currently cached cloud id synchronously and starts a background refresh.
|
|
91
|
-
* The refresh result is persisted for future calls but is not awaited by this call.
|
|
92
|
-
*/
|
|
102
|
+
/** Pure synchronous read scoped to the given base URI. */
|
|
93
103
|
}, {
|
|
94
|
-
key: "
|
|
95
|
-
value: function
|
|
96
|
-
|
|
97
|
-
return this.readStoredCloudId();
|
|
104
|
+
key: "getStoredCloudId",
|
|
105
|
+
value: function getStoredCloudId() {
|
|
106
|
+
var baseUriWithNoTrailingSlash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
107
|
+
return this.readStoredCloudId(baseUriWithNoTrailingSlash);
|
|
98
108
|
}
|
|
99
109
|
|
|
100
110
|
/** Writes tenant cloud id for tests or callers that intentionally warm storage before edge resolves. */
|
|
101
111
|
}, {
|
|
102
112
|
key: "persistStoredCloudId",
|
|
103
113
|
value: function persistStoredCloudId(cloudId) {
|
|
104
|
-
|
|
114
|
+
var baseUriWithNoTrailingSlash = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
115
|
+
this.writeStoredCloudId(baseUriWithNoTrailingSlash, cloudId);
|
|
105
116
|
}
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* When local storage already has a tenant cloud id, it is returned immediately; a background tenant_info refresh
|
|
109
|
-
* is still kicked off unless one is already in flight.
|
|
110
|
-
*
|
|
111
|
-
* Without storage, this awaits the deduped in-flight tenant_info (first concurrent caller chooses the URL;
|
|
112
|
-
* all share one promise regardless of subsequent `baseUriWithNoTrailingSlash`).
|
|
113
|
-
*
|
|
114
|
-
* On network success with no cloud id, or on failure: falls back via {@link readStoredCloudId}.
|
|
115
|
-
*/
|
|
116
117
|
}, {
|
|
117
118
|
key: "get",
|
|
118
|
-
value:
|
|
119
|
+
value: function () {
|
|
119
120
|
var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
120
121
|
var baseUriWithNoTrailingSlash,
|
|
121
122
|
fromStorage,
|
|
@@ -124,16 +125,15 @@ export var CurrentSiteCloudIdService = /*#__PURE__*/function () {
|
|
|
124
125
|
while (1) switch (_context2.prev = _context2.next) {
|
|
125
126
|
case 0:
|
|
126
127
|
baseUriWithNoTrailingSlash = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : '';
|
|
127
|
-
fromStorage = this.readStoredCloudId();
|
|
128
|
-
this.ensureTenantInfoInflightStarted(baseUriWithNoTrailingSlash);
|
|
128
|
+
fromStorage = this.readStoredCloudId(baseUriWithNoTrailingSlash);
|
|
129
129
|
if (!fromStorage) {
|
|
130
|
-
_context2.next =
|
|
130
|
+
_context2.next = 4;
|
|
131
131
|
break;
|
|
132
132
|
}
|
|
133
133
|
return _context2.abrupt("return", fromStorage);
|
|
134
|
+
case 4:
|
|
135
|
+
return _context2.abrupt("return", this.ensureTenantInfoInflightStarted(baseUriWithNoTrailingSlash));
|
|
134
136
|
case 5:
|
|
135
|
-
return _context2.abrupt("return", this.tenantInfoInflightPromise);
|
|
136
|
-
case 6:
|
|
137
137
|
case "end":
|
|
138
138
|
return _context2.stop();
|
|
139
139
|
}
|
|
@@ -143,33 +143,20 @@ export var CurrentSiteCloudIdService = /*#__PURE__*/function () {
|
|
|
143
143
|
return _get.apply(this, arguments);
|
|
144
144
|
}
|
|
145
145
|
return get;
|
|
146
|
-
}() /** Clears session pin and persisted storage so the next {@link get} is a fresh tenant_info fetch. */
|
|
146
|
+
}() /** Clears session pin and persisted storage so the next {@link get} is a fresh tenant_info fetch. */
|
|
147
147
|
}, {
|
|
148
148
|
key: "clearCache",
|
|
149
149
|
value: function clearCache() {
|
|
150
|
-
this.
|
|
151
|
-
smartCardStorage.removeItem(CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY);
|
|
150
|
+
this.tenantInfoInflightPromises.clear();
|
|
152
151
|
}
|
|
153
152
|
}]);
|
|
154
153
|
}();
|
|
155
154
|
export var currentSiteCloudIdService = new CurrentSiteCloudIdService();
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
* `tenant_info` request and persists the result for subsequent cached reads.
|
|
161
|
-
*/
|
|
155
|
+
export function getCurrentSiteCloudIdSync() {
|
|
156
|
+
var baseUriWithNoTrailingSlash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
157
|
+
return currentSiteCloudIdService.getStoredCloudId(baseUriWithNoTrailingSlash);
|
|
158
|
+
}
|
|
162
159
|
export var getCurrentSiteCloudId = function getCurrentSiteCloudId() {
|
|
163
160
|
var baseUriWithNoTrailingSlash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
164
161
|
return currentSiteCloudIdService.get(baseUriWithNoTrailingSlash);
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
/**
|
|
168
|
-
* Reads the current site cloud id from browser storage (the `site-cloud-id:v1` row) via the
|
|
169
|
-
* module-level {@link currentSiteCloudIdService} singleton, without awaiting network work.
|
|
170
|
-
* Calling this also starts the shared `tenant_info` refresh in the background when one is not
|
|
171
|
-
* already running, so a later call can observe a refreshed value when available.
|
|
172
|
-
*/
|
|
173
|
-
export function getCachedCurrentSiteCloudIdAndRefresh() {
|
|
174
|
-
return currentSiteCloudIdService.getCachedCloudIdAndRefresh();
|
|
175
|
-
}
|
|
162
|
+
};
|
|
@@ -6,21 +6,19 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
6
6
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
import { StorageClient } from '@atlaskit/frontend-utilities/storage-client';
|
|
9
|
-
import { getCurrentSiteCloudId,
|
|
9
|
+
import { getCurrentSiteCloudId, getCurrentSiteCloudIdSync } from '../current-site-cloud-id';
|
|
10
10
|
var BASE_URL = '/gateway/api/tap-delivery/api/v3/personalization';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Logical key shape: `@atlaskit/smart-card:<feature>:<schema-version>:<scope>` (see smart-card
|
|
14
|
-
* storage conventions). {@link StorageClient} narrows the localStorage key to
|
|
15
|
-
* `<clientKey>_<itemKey>` with `clientKey === '@atlaskit/smart-card'` and
|
|
16
|
-
* `itemKey === 'pct-map:v1:<cloudId>:<traitName>'` (scope segments URI-encoded).
|
|
17
|
-
*/
|
|
18
|
-
export var PERSONALIZATION_STORAGE_SCOPE = '@atlaskit/smart-card';
|
|
11
|
+
export var PERSONALIZATION_STORAGE_SCOPE = 'smart-card-social-proof';
|
|
19
12
|
export var PERSONALIZATION_STORAGE_ITEM_KEY_PREFIX = 'pct-map:v1:';
|
|
13
|
+
export var PERSONALIZATION_PROVIDER_PCT_TTL_MS = 24 * 60 * 60 * 1000;
|
|
14
|
+
export var SOCIAL_PROOF_TRAIT_NAME = 'sl_3p_connected_providers_site_pct';
|
|
20
15
|
var smartCardStorage = new StorageClient(PERSONALIZATION_STORAGE_SCOPE);
|
|
21
16
|
|
|
22
17
|
/** Keys written by this service in localStorage when using {@link smartCardStorage}. */
|
|
23
18
|
var LOCAL_STORAGE_ROW_KEY_PREFIX = "".concat(PERSONALIZATION_STORAGE_SCOPE, "_").concat(PERSONALIZATION_STORAGE_ITEM_KEY_PREFIX);
|
|
19
|
+
function scopedCacheKey(cloudId, traitName) {
|
|
20
|
+
return "".concat(cloudId, ":").concat(traitName);
|
|
21
|
+
}
|
|
24
22
|
function pctMapStorageItemKey(cloudId, traitName) {
|
|
25
23
|
return "".concat(PERSONALIZATION_STORAGE_ITEM_KEY_PREFIX).concat(encodeURIComponent(cloudId), ":").concat(encodeURIComponent(traitName));
|
|
26
24
|
}
|
|
@@ -72,53 +70,46 @@ export var PersonalizationService = /*#__PURE__*/function () {
|
|
|
72
70
|
_defineProperty(this, "cache", new Map());
|
|
73
71
|
}
|
|
74
72
|
return _createClass(PersonalizationService, [{
|
|
75
|
-
key: "
|
|
76
|
-
value:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
var cloudId = getCachedCurrentSiteCloudIdAndRefresh();
|
|
83
|
-
var fromStorage = cloudId && this.readStoredProviderPctMap(cloudId, traitName) || null;
|
|
84
|
-
void this.getProviderPctMap(traitName);
|
|
85
|
-
return fromStorage;
|
|
73
|
+
key: "getProviderPctMapSync",
|
|
74
|
+
value: /** Pure synchronous read for an explicit cloud id / trait pair. */
|
|
75
|
+
function getProviderPctMapSync(cloudId, traitName) {
|
|
76
|
+
if (!cloudId) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
return this.readStoredProviderPctMap(cloudId, traitName);
|
|
86
80
|
}
|
|
87
81
|
}, {
|
|
88
82
|
key: "getProviderPctMap",
|
|
89
83
|
value: function () {
|
|
90
|
-
var _getProviderPctMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(traitName) {
|
|
84
|
+
var _getProviderPctMap = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(cloudId, traitName) {
|
|
91
85
|
var _this = this;
|
|
92
|
-
var cachedPromise, promise;
|
|
86
|
+
var cacheKey, cachedPromise, promise, retryablePromise;
|
|
93
87
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
94
88
|
while (1) switch (_context2.prev = _context2.next) {
|
|
95
89
|
case 0:
|
|
96
|
-
|
|
90
|
+
if (cloudId) {
|
|
91
|
+
_context2.next = 2;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
return _context2.abrupt("return", undefined);
|
|
95
|
+
case 2:
|
|
96
|
+
cacheKey = scopedCacheKey(cloudId, traitName);
|
|
97
|
+
cachedPromise = this.cache.get(cacheKey);
|
|
97
98
|
if (!cachedPromise) {
|
|
98
|
-
_context2.next =
|
|
99
|
+
_context2.next = 6;
|
|
99
100
|
break;
|
|
100
101
|
}
|
|
101
102
|
return _context2.abrupt("return", cachedPromise);
|
|
102
|
-
case
|
|
103
|
+
case 6:
|
|
103
104
|
promise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
104
|
-
var
|
|
105
|
+
var traits, trait, mapped;
|
|
105
106
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
106
107
|
while (1) switch (_context.prev = _context.next) {
|
|
107
108
|
case 0:
|
|
108
109
|
_context.prev = 0;
|
|
109
110
|
_context.next = 3;
|
|
110
|
-
return getCurrentSiteCloudId();
|
|
111
|
-
case 3:
|
|
112
|
-
cloudId = _context.sent;
|
|
113
|
-
if (cloudId) {
|
|
114
|
-
_context.next = 6;
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
return _context.abrupt("return", undefined);
|
|
118
|
-
case 6:
|
|
119
|
-
_context.next = 8;
|
|
120
111
|
return fetchSiteTraits(cloudId);
|
|
121
|
-
case
|
|
112
|
+
case 3:
|
|
122
113
|
traits = _context.sent;
|
|
123
114
|
trait = traits.find(function (t) {
|
|
124
115
|
return t.name === traitName;
|
|
@@ -128,25 +119,28 @@ export var PersonalizationService = /*#__PURE__*/function () {
|
|
|
128
119
|
_this.writeStoredProviderPctMap(cloudId, traitName, mapped);
|
|
129
120
|
}
|
|
130
121
|
return _context.abrupt("return", mapped);
|
|
131
|
-
case
|
|
132
|
-
_context.prev =
|
|
122
|
+
case 10:
|
|
123
|
+
_context.prev = 10;
|
|
133
124
|
_context.t0 = _context["catch"](0);
|
|
134
125
|
return _context.abrupt("return", undefined);
|
|
135
|
-
case
|
|
126
|
+
case 13:
|
|
136
127
|
case "end":
|
|
137
128
|
return _context.stop();
|
|
138
129
|
}
|
|
139
|
-
}, _callee, null, [[0,
|
|
130
|
+
}, _callee, null, [[0, 10]]);
|
|
140
131
|
}))();
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
132
|
+
retryablePromise = promise.finally(function () {
|
|
133
|
+
_this.cache.delete(cacheKey);
|
|
134
|
+
});
|
|
135
|
+
this.cache.set(cacheKey, retryablePromise);
|
|
136
|
+
return _context2.abrupt("return", retryablePromise);
|
|
137
|
+
case 10:
|
|
144
138
|
case "end":
|
|
145
139
|
return _context2.stop();
|
|
146
140
|
}
|
|
147
141
|
}, _callee2, this);
|
|
148
142
|
}));
|
|
149
|
-
function getProviderPctMap(_x2) {
|
|
143
|
+
function getProviderPctMap(_x2, _x3) {
|
|
150
144
|
return _getProviderPctMap.apply(this, arguments);
|
|
151
145
|
}
|
|
152
146
|
return getProviderPctMap;
|
|
@@ -168,7 +162,7 @@ export var PersonalizationService = /*#__PURE__*/function () {
|
|
|
168
162
|
key: "writeStoredProviderPctMap",
|
|
169
163
|
value: function writeStoredProviderPctMap(cloudId, traitName, map) {
|
|
170
164
|
try {
|
|
171
|
-
smartCardStorage.setItemWithExpiry(pctMapStorageItemKey(cloudId, traitName), map);
|
|
165
|
+
smartCardStorage.setItemWithExpiry(pctMapStorageItemKey(cloudId, traitName), map, PERSONALIZATION_PROVIDER_PCT_TTL_MS);
|
|
172
166
|
} catch (_unused3) {
|
|
173
167
|
// Quota, private-mode, etc.
|
|
174
168
|
}
|
|
@@ -237,22 +231,25 @@ export var PersonalizationService = /*#__PURE__*/function () {
|
|
|
237
231
|
}]);
|
|
238
232
|
}();
|
|
239
233
|
export var personalizationService = new PersonalizationService();
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
* Resolves the provider percentage map for a TAP Delivery trait through the module-level
|
|
243
|
-
* {@link personalizationService}. Work is deduped per trait name for the page lifetime, and a
|
|
244
|
-
* successful response is persisted by cloud id and trait name for later cached reads.
|
|
245
|
-
*/
|
|
246
|
-
export var getProviderPctMap = function getProviderPctMap(traitName) {
|
|
247
|
-
return personalizationService.getProviderPctMap(traitName);
|
|
234
|
+
export var getProviderPctMap = function getProviderPctMap(cloudId, traitName) {
|
|
235
|
+
return personalizationService.getProviderPctMap(cloudId, traitName);
|
|
248
236
|
};
|
|
237
|
+
export function getProviderPctMapSync(cloudId, traitName) {
|
|
238
|
+
return personalizationService.getProviderPctMapSync(cloudId, traitName);
|
|
239
|
+
}
|
|
249
240
|
|
|
250
241
|
/**
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
*
|
|
254
|
-
*
|
|
242
|
+
* Backwards-compatible cache-first helper for inline-card social proof callers.
|
|
243
|
+
*
|
|
244
|
+
* Reads the persisted provider percentage map synchronously using the current site cloud id, then
|
|
245
|
+
* starts a background refresh for subsequent mounts. The async result intentionally does not affect
|
|
246
|
+
* the current call site, matching the warm-cache-only rendering contract.
|
|
255
247
|
*/
|
|
256
248
|
export function getCachedProviderPctMapAndRefresh(traitName) {
|
|
257
|
-
|
|
249
|
+
var cloudId = getCurrentSiteCloudIdSync();
|
|
250
|
+
var providerPctMap = getProviderPctMapSync(cloudId, traitName);
|
|
251
|
+
void getCurrentSiteCloudId().then(function (resolvedCloudId) {
|
|
252
|
+
void getProviderPctMap(resolvedCloudId, traitName);
|
|
253
|
+
});
|
|
254
|
+
return providerPctMap;
|
|
258
255
|
}
|
|
@@ -4,7 +4,7 @@ export var ANALYTICS_CHANNEL = 'media';
|
|
|
4
4
|
export var context = {
|
|
5
5
|
componentName: 'smart-cards',
|
|
6
6
|
packageName: "@atlaskit/smart-card" || '',
|
|
7
|
-
packageVersion: "44.
|
|
7
|
+
packageVersion: "44.7.0" || ''
|
|
8
8
|
};
|
|
9
9
|
export var TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
10
10
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -6,10 +6,10 @@ import * as React from 'react';
|
|
|
6
6
|
import { ax, ix } from "@compiled/react/runtime";
|
|
7
7
|
import { useEffect, useMemo, useState } from 'react';
|
|
8
8
|
import { browser } from '@atlaskit/linking-common/user-agent';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
9
|
import { ActionName, CardDisplay, ElementName, SmartLinkPosition } from '../../../constants';
|
|
11
10
|
import extractRovoChatAction from '../../../extractors/flexible/actions/extract-rovo-chat-action';
|
|
12
11
|
import { getExtensionKey } from '../../../state/helpers';
|
|
12
|
+
import useBlockCardRovoActionExperiment from '../../../state/hooks/use-block-card-rovo-action-experiment';
|
|
13
13
|
import useRovoConfig from '../../../state/hooks/use-rovo-config';
|
|
14
14
|
import FlexibleCard from '../../FlexibleCard';
|
|
15
15
|
import { RovoChatPromptKey } from '../../FlexibleCard/components/actions/rovo-chat-action';
|
|
@@ -42,10 +42,12 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
42
42
|
isPreviewBlockErrored = _useState2[0],
|
|
43
43
|
setIsPreviewBlockErrored = _useState2[1];
|
|
44
44
|
var extensionKey = getExtensionKey(cardState.details);
|
|
45
|
-
var
|
|
45
|
+
var _useBlockCardRovoActi = useBlockCardRovoActionExperiment(url, actionOptions),
|
|
46
|
+
is3PRovoBlockExperimentEnabled = _useBlockCardRovoActi.isEnabled;
|
|
47
|
+
var rovoConfig = is3PRovoBlockExperimentEnabled ?
|
|
46
48
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
47
49
|
useRovoConfig() : undefined;
|
|
48
|
-
var showRovoResolvedView =
|
|
50
|
+
var showRovoResolvedView = is3PRovoBlockExperimentEnabled ?
|
|
49
51
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
50
52
|
useMemo(function () {
|
|
51
53
|
return (cardState === null || cardState === void 0 ? void 0 : cardState.status) === 'resolved' && cardState.details && extractRovoChatAction({
|
|
@@ -69,7 +71,7 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
69
71
|
topMetadata = _getSimulatedBetterMe.topMetadata,
|
|
70
72
|
bottomMetadata = _getSimulatedBetterMe.bottomMetadata;
|
|
71
73
|
var prompts = useMemo(function () {
|
|
72
|
-
if (
|
|
74
|
+
if (is3PRovoBlockExperimentEnabled) {
|
|
73
75
|
var _cardState$details;
|
|
74
76
|
var defaultPrompts = [RovoChatPromptKey.KEY_HIGHLIGHTS];
|
|
75
77
|
var linkType = (_cardState$details = cardState.details) === null || _cardState$details === void 0 || (_cardState$details = _cardState$details.data) === null || _cardState$details === void 0 ? void 0 : _cardState$details['@type'];
|
|
@@ -85,23 +87,20 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
85
87
|
return [RovoChatPromptKey.SUMMARIZE_LINK].concat(defaultPrompts);
|
|
86
88
|
}
|
|
87
89
|
return [];
|
|
88
|
-
}, [cardState === null || cardState === void 0 || (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data, extensionKey]);
|
|
90
|
+
}, [cardState === null || cardState === void 0 || (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data, extensionKey, is3PRovoBlockExperimentEnabled]);
|
|
89
91
|
var footerActions = useMemo(function () {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}];
|
|
103
|
-
}
|
|
104
|
-
return [{
|
|
92
|
+
return showRovoResolvedView && is3PRovoBlockExperimentEnabled ? [{
|
|
93
|
+
name: ActionName.RovoChatAction,
|
|
94
|
+
prompts: prompts,
|
|
95
|
+
iconSize: 'small',
|
|
96
|
+
cardAppearance: CardDisplay.Block
|
|
97
|
+
}, {
|
|
98
|
+
name: ActionName.FollowAction,
|
|
99
|
+
iconSize: 'small'
|
|
100
|
+
}, {
|
|
101
|
+
name: ActionName.DownloadAction,
|
|
102
|
+
iconSize: 'small'
|
|
103
|
+
}] : [{
|
|
105
104
|
name: ActionName.FollowAction,
|
|
106
105
|
hideIcon: true
|
|
107
106
|
}, {
|
|
@@ -111,7 +110,7 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
111
110
|
name: ActionName.DownloadAction,
|
|
112
111
|
hideIcon: true
|
|
113
112
|
}];
|
|
114
|
-
}, [showRovoResolvedView, prompts]);
|
|
113
|
+
}, [showRovoResolvedView, prompts, is3PRovoBlockExperimentEnabled]);
|
|
115
114
|
var uiOptions = FlexibleCardUiOptions;
|
|
116
115
|
uiOptions.enableSnippetRenderer = true;
|
|
117
116
|
uiOptions.hideLoadingSkeleton = hideIconLoadingSkeleton;
|