@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
|
@@ -4,9 +4,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.currentSiteCloudIdService = exports.CurrentSiteCloudIdService = exports.
|
|
8
|
-
exports.
|
|
9
|
-
exports.getCurrentSiteCloudId = void 0;
|
|
7
|
+
exports.getCurrentSiteCloudIdLocalStorageKey = exports.getCurrentSiteCloudId = exports.currentSiteCloudIdService = exports.CurrentSiteCloudIdService = exports.CURRENT_SITE_CLOUD_ID_TTL_MS = exports.CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY_PREFIX = exports.CURRENT_SITE_CLOUD_ID_LOCAL_STORAGE_KEY = void 0;
|
|
8
|
+
exports.getCurrentSiteCloudIdSync = getCurrentSiteCloudIdSync;
|
|
10
9
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
11
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
@@ -14,31 +13,38 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
|
|
|
14
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
14
|
var _storageClient = require("@atlaskit/frontend-utilities/storage-client");
|
|
16
15
|
var _linkingCommon = require("@atlaskit/linking-common");
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* `itemKey === 'site-cloud-id:v1'` (no further scope segments; unlike `pct-map:v1:`, this is a single fixed row).
|
|
21
|
-
*/
|
|
22
|
-
var SMART_CARD_STORAGE_SCOPE = '@atlaskit/smart-card';
|
|
23
|
-
var CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY = exports.CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY = 'site-cloud-id:v1';
|
|
16
|
+
var SMART_CARD_STORAGE_SCOPE = 'smart-card-social-proof';
|
|
17
|
+
var CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY_PREFIX = exports.CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY_PREFIX = 'site-cloud-id:v1:';
|
|
18
|
+
var CURRENT_SITE_CLOUD_ID_TTL_MS = exports.CURRENT_SITE_CLOUD_ID_TTL_MS = 24 * 60 * 60 * 1000;
|
|
24
19
|
var smartCardStorage = new _storageClient.StorageClient(SMART_CARD_STORAGE_SCOPE);
|
|
20
|
+
function normalizeBaseUri() {
|
|
21
|
+
var baseUriWithNoTrailingSlash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
22
|
+
return baseUriWithNoTrailingSlash.replace(/\/$/, '');
|
|
23
|
+
}
|
|
24
|
+
function cloudIdStorageItemKey() {
|
|
25
|
+
var baseUriWithNoTrailingSlash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
26
|
+
return "".concat(CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY_PREFIX).concat(encodeURIComponent(normalizeBaseUri(baseUriWithNoTrailingSlash)));
|
|
27
|
+
}
|
|
25
28
|
|
|
26
29
|
/** Keys written by this service in localStorage when using {@link smartCardStorage}. */
|
|
27
|
-
var
|
|
30
|
+
var getCurrentSiteCloudIdLocalStorageKey = exports.getCurrentSiteCloudIdLocalStorageKey = function getCurrentSiteCloudIdLocalStorageKey() {
|
|
31
|
+
var baseUriWithNoTrailingSlash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
32
|
+
return "".concat(SMART_CARD_STORAGE_SCOPE, "_").concat(cloudIdStorageItemKey(baseUriWithNoTrailingSlash));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** Backwards-compatible default-scope key for existing tests and external assertions. */
|
|
36
|
+
var CURRENT_SITE_CLOUD_ID_LOCAL_STORAGE_KEY = exports.CURRENT_SITE_CLOUD_ID_LOCAL_STORAGE_KEY = getCurrentSiteCloudIdLocalStorageKey();
|
|
28
37
|
var CurrentSiteCloudIdService = exports.CurrentSiteCloudIdService = /*#__PURE__*/function () {
|
|
29
38
|
function CurrentSiteCloudIdService() {
|
|
30
39
|
(0, _classCallCheck2.default)(this, CurrentSiteCloudIdService);
|
|
31
|
-
|
|
32
|
-
* Holds the shared tenant_info work: one in-flight fetch, then (on success) a settled promise for the session cloud
|
|
33
|
-
* id so later callers never trigger another `tenant_info` in the same page lifetime (until {@link clearCache}).
|
|
34
|
-
*/
|
|
35
|
-
(0, _defineProperty2.default)(this, "tenantInfoInflightPromise", null);
|
|
40
|
+
(0, _defineProperty2.default)(this, "tenantInfoInflightPromises", new Map());
|
|
36
41
|
}
|
|
37
42
|
return (0, _createClass2.default)(CurrentSiteCloudIdService, [{
|
|
38
43
|
key: "readStoredCloudId",
|
|
39
44
|
value: function readStoredCloudId() {
|
|
45
|
+
var baseUriWithNoTrailingSlash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
40
46
|
try {
|
|
41
|
-
var cloudId = smartCardStorage.getItem(
|
|
47
|
+
var cloudId = smartCardStorage.getItem(cloudIdStorageItemKey(baseUriWithNoTrailingSlash));
|
|
42
48
|
if (typeof cloudId !== 'string' || !cloudId || cloudId === 'undefined') {
|
|
43
49
|
return undefined;
|
|
44
50
|
}
|
|
@@ -49,12 +55,12 @@ var CurrentSiteCloudIdService = exports.CurrentSiteCloudIdService = /*#__PURE__*
|
|
|
49
55
|
}
|
|
50
56
|
}, {
|
|
51
57
|
key: "writeStoredCloudId",
|
|
52
|
-
value: function writeStoredCloudId(cloudId) {
|
|
58
|
+
value: function writeStoredCloudId(baseUriWithNoTrailingSlash, cloudId) {
|
|
53
59
|
if (!cloudId) {
|
|
54
60
|
return;
|
|
55
61
|
}
|
|
56
62
|
try {
|
|
57
|
-
smartCardStorage.setItemWithExpiry(
|
|
63
|
+
smartCardStorage.setItemWithExpiry(cloudIdStorageItemKey(baseUriWithNoTrailingSlash), cloudId, CURRENT_SITE_CLOUD_ID_TTL_MS);
|
|
58
64
|
} catch (_unused2) {
|
|
59
65
|
// Quota, private-mode, SSR, etc. — same intent as personalization-service.
|
|
60
66
|
}
|
|
@@ -63,67 +69,62 @@ var CurrentSiteCloudIdService = exports.CurrentSiteCloudIdService = /*#__PURE__*
|
|
|
63
69
|
key: "ensureTenantInfoInflightStarted",
|
|
64
70
|
value: function ensureTenantInfoInflightStarted(baseUriWithNoTrailingSlash) {
|
|
65
71
|
var _this = this;
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
var baseUri = normalizeBaseUri(baseUriWithNoTrailingSlash);
|
|
73
|
+
var existing = this.tenantInfoInflightPromises.get(baseUri);
|
|
74
|
+
if (existing) {
|
|
75
|
+
return existing;
|
|
68
76
|
}
|
|
69
|
-
|
|
77
|
+
var promise = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
70
78
|
var response, cloudId;
|
|
71
79
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
72
80
|
while (1) switch (_context.prev = _context.next) {
|
|
73
81
|
case 0:
|
|
74
82
|
_context.prev = 0;
|
|
75
83
|
_context.next = 3;
|
|
76
|
-
return (0, _linkingCommon.request)('get',
|
|
84
|
+
return (0, _linkingCommon.request)('get', "".concat(baseUri, "/_edge/tenant_info"));
|
|
77
85
|
case 3:
|
|
78
86
|
response = _context.sent;
|
|
79
87
|
cloudId = response === null || response === void 0 ? void 0 : response.cloudId;
|
|
80
88
|
if (cloudId) {
|
|
81
|
-
_this.writeStoredCloudId(cloudId);
|
|
89
|
+
_this.writeStoredCloudId(baseUri, cloudId);
|
|
82
90
|
}
|
|
83
|
-
return _context.abrupt("return", cloudId ? cloudId : _this.readStoredCloudId());
|
|
91
|
+
return _context.abrupt("return", cloudId ? cloudId : _this.readStoredCloudId(baseUri));
|
|
84
92
|
case 9:
|
|
85
93
|
_context.prev = 9;
|
|
86
94
|
_context.t0 = _context["catch"](0);
|
|
87
|
-
_this.
|
|
88
|
-
|
|
89
|
-
|
|
95
|
+
return _context.abrupt("return", _this.readStoredCloudId(baseUri));
|
|
96
|
+
case 12:
|
|
97
|
+
_context.prev = 12;
|
|
98
|
+
_this.tenantInfoInflightPromises.delete(baseUri);
|
|
99
|
+
return _context.finish(12);
|
|
100
|
+
case 15:
|
|
90
101
|
case "end":
|
|
91
102
|
return _context.stop();
|
|
92
103
|
}
|
|
93
|
-
}, _callee, null, [[0, 9]]);
|
|
104
|
+
}, _callee, null, [[0, 9, 12, 15]]);
|
|
94
105
|
}))();
|
|
106
|
+
this.tenantInfoInflightPromises.set(baseUri, promise);
|
|
107
|
+
return promise;
|
|
95
108
|
}
|
|
96
109
|
|
|
97
|
-
/**
|
|
98
|
-
* Returns the currently cached cloud id synchronously and starts a background refresh.
|
|
99
|
-
* The refresh result is persisted for future calls but is not awaited by this call.
|
|
100
|
-
*/
|
|
110
|
+
/** Pure synchronous read scoped to the given base URI. */
|
|
101
111
|
}, {
|
|
102
|
-
key: "
|
|
103
|
-
value: function
|
|
104
|
-
|
|
105
|
-
return this.readStoredCloudId();
|
|
112
|
+
key: "getStoredCloudId",
|
|
113
|
+
value: function getStoredCloudId() {
|
|
114
|
+
var baseUriWithNoTrailingSlash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
115
|
+
return this.readStoredCloudId(baseUriWithNoTrailingSlash);
|
|
106
116
|
}
|
|
107
117
|
|
|
108
118
|
/** Writes tenant cloud id for tests or callers that intentionally warm storage before edge resolves. */
|
|
109
119
|
}, {
|
|
110
120
|
key: "persistStoredCloudId",
|
|
111
121
|
value: function persistStoredCloudId(cloudId) {
|
|
112
|
-
|
|
122
|
+
var baseUriWithNoTrailingSlash = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
123
|
+
this.writeStoredCloudId(baseUriWithNoTrailingSlash, cloudId);
|
|
113
124
|
}
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* When local storage already has a tenant cloud id, it is returned immediately; a background tenant_info refresh
|
|
117
|
-
* is still kicked off unless one is already in flight.
|
|
118
|
-
*
|
|
119
|
-
* Without storage, this awaits the deduped in-flight tenant_info (first concurrent caller chooses the URL;
|
|
120
|
-
* all share one promise regardless of subsequent `baseUriWithNoTrailingSlash`).
|
|
121
|
-
*
|
|
122
|
-
* On network success with no cloud id, or on failure: falls back via {@link readStoredCloudId}.
|
|
123
|
-
*/
|
|
124
125
|
}, {
|
|
125
126
|
key: "get",
|
|
126
|
-
value:
|
|
127
|
+
value: function () {
|
|
127
128
|
var _get = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
128
129
|
var baseUriWithNoTrailingSlash,
|
|
129
130
|
fromStorage,
|
|
@@ -132,16 +133,15 @@ var CurrentSiteCloudIdService = exports.CurrentSiteCloudIdService = /*#__PURE__*
|
|
|
132
133
|
while (1) switch (_context2.prev = _context2.next) {
|
|
133
134
|
case 0:
|
|
134
135
|
baseUriWithNoTrailingSlash = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : '';
|
|
135
|
-
fromStorage = this.readStoredCloudId();
|
|
136
|
-
this.ensureTenantInfoInflightStarted(baseUriWithNoTrailingSlash);
|
|
136
|
+
fromStorage = this.readStoredCloudId(baseUriWithNoTrailingSlash);
|
|
137
137
|
if (!fromStorage) {
|
|
138
|
-
_context2.next =
|
|
138
|
+
_context2.next = 4;
|
|
139
139
|
break;
|
|
140
140
|
}
|
|
141
141
|
return _context2.abrupt("return", fromStorage);
|
|
142
|
+
case 4:
|
|
143
|
+
return _context2.abrupt("return", this.ensureTenantInfoInflightStarted(baseUriWithNoTrailingSlash));
|
|
142
144
|
case 5:
|
|
143
|
-
return _context2.abrupt("return", this.tenantInfoInflightPromise);
|
|
144
|
-
case 6:
|
|
145
145
|
case "end":
|
|
146
146
|
return _context2.stop();
|
|
147
147
|
}
|
|
@@ -151,33 +151,20 @@ var CurrentSiteCloudIdService = exports.CurrentSiteCloudIdService = /*#__PURE__*
|
|
|
151
151
|
return _get.apply(this, arguments);
|
|
152
152
|
}
|
|
153
153
|
return get;
|
|
154
|
-
}() /** Clears session pin and persisted storage so the next {@link get} is a fresh tenant_info fetch. */
|
|
154
|
+
}() /** Clears session pin and persisted storage so the next {@link get} is a fresh tenant_info fetch. */
|
|
155
155
|
}, {
|
|
156
156
|
key: "clearCache",
|
|
157
157
|
value: function clearCache() {
|
|
158
|
-
this.
|
|
159
|
-
smartCardStorage.removeItem(CURRENT_SITE_CLOUD_ID_STORAGE_ITEM_KEY);
|
|
158
|
+
this.tenantInfoInflightPromises.clear();
|
|
160
159
|
}
|
|
161
160
|
}]);
|
|
162
161
|
}();
|
|
163
162
|
var currentSiteCloudIdService = exports.currentSiteCloudIdService = new CurrentSiteCloudIdService();
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
* `tenant_info` request and persists the result for subsequent cached reads.
|
|
169
|
-
*/
|
|
163
|
+
function getCurrentSiteCloudIdSync() {
|
|
164
|
+
var baseUriWithNoTrailingSlash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
165
|
+
return currentSiteCloudIdService.getStoredCloudId(baseUriWithNoTrailingSlash);
|
|
166
|
+
}
|
|
170
167
|
var getCurrentSiteCloudId = exports.getCurrentSiteCloudId = function getCurrentSiteCloudId() {
|
|
171
168
|
var baseUriWithNoTrailingSlash = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
172
169
|
return currentSiteCloudIdService.get(baseUriWithNoTrailingSlash);
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Reads the current site cloud id from browser storage (the `site-cloud-id:v1` row) via the
|
|
177
|
-
* module-level {@link currentSiteCloudIdService} singleton, without awaiting network work.
|
|
178
|
-
* Calling this also starts the shared `tenant_info` refresh in the background when one is not
|
|
179
|
-
* already running, so a later call can observe a refreshed value when available.
|
|
180
|
-
*/
|
|
181
|
-
function getCachedCurrentSiteCloudIdAndRefresh() {
|
|
182
|
-
return currentSiteCloudIdService.getCachedCloudIdAndRefresh();
|
|
183
|
-
}
|
|
170
|
+
};
|
|
@@ -4,9 +4,11 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.PersonalizationService = exports.PERSONALIZATION_STORAGE_SCOPE = exports.PERSONALIZATION_STORAGE_ITEM_KEY_PREFIX = void 0;
|
|
7
|
+
exports.SOCIAL_PROOF_TRAIT_NAME = exports.PersonalizationService = exports.PERSONALIZATION_STORAGE_SCOPE = exports.PERSONALIZATION_STORAGE_ITEM_KEY_PREFIX = exports.PERSONALIZATION_PROVIDER_PCT_TTL_MS = void 0;
|
|
8
8
|
exports.getCachedProviderPctMapAndRefresh = getCachedProviderPctMapAndRefresh;
|
|
9
|
-
exports.
|
|
9
|
+
exports.getProviderPctMap = void 0;
|
|
10
|
+
exports.getProviderPctMapSync = getProviderPctMapSync;
|
|
11
|
+
exports.personalizationService = void 0;
|
|
10
12
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
13
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
14
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
@@ -17,19 +19,17 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
17
19
|
var _storageClient = require("@atlaskit/frontend-utilities/storage-client");
|
|
18
20
|
var _currentSiteCloudId = require("../current-site-cloud-id");
|
|
19
21
|
var BASE_URL = '/gateway/api/tap-delivery/api/v3/personalization';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Logical key shape: `@atlaskit/smart-card:<feature>:<schema-version>:<scope>` (see smart-card
|
|
23
|
-
* storage conventions). {@link StorageClient} narrows the localStorage key to
|
|
24
|
-
* `<clientKey>_<itemKey>` with `clientKey === '@atlaskit/smart-card'` and
|
|
25
|
-
* `itemKey === 'pct-map:v1:<cloudId>:<traitName>'` (scope segments URI-encoded).
|
|
26
|
-
*/
|
|
27
|
-
var PERSONALIZATION_STORAGE_SCOPE = exports.PERSONALIZATION_STORAGE_SCOPE = '@atlaskit/smart-card';
|
|
22
|
+
var PERSONALIZATION_STORAGE_SCOPE = exports.PERSONALIZATION_STORAGE_SCOPE = 'smart-card-social-proof';
|
|
28
23
|
var PERSONALIZATION_STORAGE_ITEM_KEY_PREFIX = exports.PERSONALIZATION_STORAGE_ITEM_KEY_PREFIX = 'pct-map:v1:';
|
|
24
|
+
var PERSONALIZATION_PROVIDER_PCT_TTL_MS = exports.PERSONALIZATION_PROVIDER_PCT_TTL_MS = 24 * 60 * 60 * 1000;
|
|
25
|
+
var SOCIAL_PROOF_TRAIT_NAME = exports.SOCIAL_PROOF_TRAIT_NAME = 'sl_3p_connected_providers_site_pct';
|
|
29
26
|
var smartCardStorage = new _storageClient.StorageClient(PERSONALIZATION_STORAGE_SCOPE);
|
|
30
27
|
|
|
31
28
|
/** Keys written by this service in localStorage when using {@link smartCardStorage}. */
|
|
32
29
|
var LOCAL_STORAGE_ROW_KEY_PREFIX = "".concat(PERSONALIZATION_STORAGE_SCOPE, "_").concat(PERSONALIZATION_STORAGE_ITEM_KEY_PREFIX);
|
|
30
|
+
function scopedCacheKey(cloudId, traitName) {
|
|
31
|
+
return "".concat(cloudId, ":").concat(traitName);
|
|
32
|
+
}
|
|
33
33
|
function pctMapStorageItemKey(cloudId, traitName) {
|
|
34
34
|
return "".concat(PERSONALIZATION_STORAGE_ITEM_KEY_PREFIX).concat(encodeURIComponent(cloudId), ":").concat(encodeURIComponent(traitName));
|
|
35
35
|
}
|
|
@@ -81,53 +81,46 @@ var PersonalizationService = exports.PersonalizationService = /*#__PURE__*/funct
|
|
|
81
81
|
(0, _defineProperty2.default)(this, "cache", new Map());
|
|
82
82
|
}
|
|
83
83
|
return (0, _createClass2.default)(PersonalizationService, [{
|
|
84
|
-
key: "
|
|
85
|
-
value:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
var cloudId = (0, _currentSiteCloudId.getCachedCurrentSiteCloudIdAndRefresh)();
|
|
92
|
-
var fromStorage = cloudId && this.readStoredProviderPctMap(cloudId, traitName) || null;
|
|
93
|
-
void this.getProviderPctMap(traitName);
|
|
94
|
-
return fromStorage;
|
|
84
|
+
key: "getProviderPctMapSync",
|
|
85
|
+
value: /** Pure synchronous read for an explicit cloud id / trait pair. */
|
|
86
|
+
function getProviderPctMapSync(cloudId, traitName) {
|
|
87
|
+
if (!cloudId) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
return this.readStoredProviderPctMap(cloudId, traitName);
|
|
95
91
|
}
|
|
96
92
|
}, {
|
|
97
93
|
key: "getProviderPctMap",
|
|
98
94
|
value: function () {
|
|
99
|
-
var _getProviderPctMap = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(traitName) {
|
|
95
|
+
var _getProviderPctMap = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(cloudId, traitName) {
|
|
100
96
|
var _this = this;
|
|
101
|
-
var cachedPromise, promise;
|
|
97
|
+
var cacheKey, cachedPromise, promise, retryablePromise;
|
|
102
98
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
103
99
|
while (1) switch (_context2.prev = _context2.next) {
|
|
104
100
|
case 0:
|
|
105
|
-
|
|
101
|
+
if (cloudId) {
|
|
102
|
+
_context2.next = 2;
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
return _context2.abrupt("return", undefined);
|
|
106
|
+
case 2:
|
|
107
|
+
cacheKey = scopedCacheKey(cloudId, traitName);
|
|
108
|
+
cachedPromise = this.cache.get(cacheKey);
|
|
106
109
|
if (!cachedPromise) {
|
|
107
|
-
_context2.next =
|
|
110
|
+
_context2.next = 6;
|
|
108
111
|
break;
|
|
109
112
|
}
|
|
110
113
|
return _context2.abrupt("return", cachedPromise);
|
|
111
|
-
case
|
|
114
|
+
case 6:
|
|
112
115
|
promise = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
113
|
-
var
|
|
116
|
+
var traits, trait, mapped;
|
|
114
117
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
115
118
|
while (1) switch (_context.prev = _context.next) {
|
|
116
119
|
case 0:
|
|
117
120
|
_context.prev = 0;
|
|
118
121
|
_context.next = 3;
|
|
119
|
-
return (0, _currentSiteCloudId.getCurrentSiteCloudId)();
|
|
120
|
-
case 3:
|
|
121
|
-
cloudId = _context.sent;
|
|
122
|
-
if (cloudId) {
|
|
123
|
-
_context.next = 6;
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
return _context.abrupt("return", undefined);
|
|
127
|
-
case 6:
|
|
128
|
-
_context.next = 8;
|
|
129
122
|
return fetchSiteTraits(cloudId);
|
|
130
|
-
case
|
|
123
|
+
case 3:
|
|
131
124
|
traits = _context.sent;
|
|
132
125
|
trait = traits.find(function (t) {
|
|
133
126
|
return t.name === traitName;
|
|
@@ -137,25 +130,28 @@ var PersonalizationService = exports.PersonalizationService = /*#__PURE__*/funct
|
|
|
137
130
|
_this.writeStoredProviderPctMap(cloudId, traitName, mapped);
|
|
138
131
|
}
|
|
139
132
|
return _context.abrupt("return", mapped);
|
|
140
|
-
case
|
|
141
|
-
_context.prev =
|
|
133
|
+
case 10:
|
|
134
|
+
_context.prev = 10;
|
|
142
135
|
_context.t0 = _context["catch"](0);
|
|
143
136
|
return _context.abrupt("return", undefined);
|
|
144
|
-
case
|
|
137
|
+
case 13:
|
|
145
138
|
case "end":
|
|
146
139
|
return _context.stop();
|
|
147
140
|
}
|
|
148
|
-
}, _callee, null, [[0,
|
|
141
|
+
}, _callee, null, [[0, 10]]);
|
|
149
142
|
}))();
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
143
|
+
retryablePromise = promise.finally(function () {
|
|
144
|
+
_this.cache.delete(cacheKey);
|
|
145
|
+
});
|
|
146
|
+
this.cache.set(cacheKey, retryablePromise);
|
|
147
|
+
return _context2.abrupt("return", retryablePromise);
|
|
148
|
+
case 10:
|
|
153
149
|
case "end":
|
|
154
150
|
return _context2.stop();
|
|
155
151
|
}
|
|
156
152
|
}, _callee2, this);
|
|
157
153
|
}));
|
|
158
|
-
function getProviderPctMap(_x2) {
|
|
154
|
+
function getProviderPctMap(_x2, _x3) {
|
|
159
155
|
return _getProviderPctMap.apply(this, arguments);
|
|
160
156
|
}
|
|
161
157
|
return getProviderPctMap;
|
|
@@ -177,7 +173,7 @@ var PersonalizationService = exports.PersonalizationService = /*#__PURE__*/funct
|
|
|
177
173
|
key: "writeStoredProviderPctMap",
|
|
178
174
|
value: function writeStoredProviderPctMap(cloudId, traitName, map) {
|
|
179
175
|
try {
|
|
180
|
-
smartCardStorage.setItemWithExpiry(pctMapStorageItemKey(cloudId, traitName), map);
|
|
176
|
+
smartCardStorage.setItemWithExpiry(pctMapStorageItemKey(cloudId, traitName), map, PERSONALIZATION_PROVIDER_PCT_TTL_MS);
|
|
181
177
|
} catch (_unused3) {
|
|
182
178
|
// Quota, private-mode, etc.
|
|
183
179
|
}
|
|
@@ -246,22 +242,25 @@ var PersonalizationService = exports.PersonalizationService = /*#__PURE__*/funct
|
|
|
246
242
|
}]);
|
|
247
243
|
}();
|
|
248
244
|
var personalizationService = exports.personalizationService = new PersonalizationService();
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
* Resolves the provider percentage map for a TAP Delivery trait through the module-level
|
|
252
|
-
* {@link personalizationService}. Work is deduped per trait name for the page lifetime, and a
|
|
253
|
-
* successful response is persisted by cloud id and trait name for later cached reads.
|
|
254
|
-
*/
|
|
255
|
-
var getProviderPctMap = exports.getProviderPctMap = function getProviderPctMap(traitName) {
|
|
256
|
-
return personalizationService.getProviderPctMap(traitName);
|
|
245
|
+
var getProviderPctMap = exports.getProviderPctMap = function getProviderPctMap(cloudId, traitName) {
|
|
246
|
+
return personalizationService.getProviderPctMap(cloudId, traitName);
|
|
257
247
|
};
|
|
248
|
+
function getProviderPctMapSync(cloudId, traitName) {
|
|
249
|
+
return personalizationService.getProviderPctMapSync(cloudId, traitName);
|
|
250
|
+
}
|
|
258
251
|
|
|
259
252
|
/**
|
|
260
|
-
*
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
253
|
+
* Backwards-compatible cache-first helper for inline-card social proof callers.
|
|
254
|
+
*
|
|
255
|
+
* Reads the persisted provider percentage map synchronously using the current site cloud id, then
|
|
256
|
+
* starts a background refresh for subsequent mounts. The async result intentionally does not affect
|
|
257
|
+
* the current call site, matching the warm-cache-only rendering contract.
|
|
264
258
|
*/
|
|
265
259
|
function getCachedProviderPctMapAndRefresh(traitName) {
|
|
266
|
-
|
|
260
|
+
var cloudId = (0, _currentSiteCloudId.getCurrentSiteCloudIdSync)();
|
|
261
|
+
var providerPctMap = getProviderPctMapSync(cloudId, traitName);
|
|
262
|
+
void (0, _currentSiteCloudId.getCurrentSiteCloudId)().then(function (resolvedCloudId) {
|
|
263
|
+
void getProviderPctMap(resolvedCloudId, traitName);
|
|
264
|
+
});
|
|
265
|
+
return providerPctMap;
|
|
267
266
|
}
|
|
@@ -11,7 +11,7 @@ var ANALYTICS_CHANNEL = exports.ANALYTICS_CHANNEL = 'media';
|
|
|
11
11
|
var context = exports.context = {
|
|
12
12
|
componentName: 'smart-cards',
|
|
13
13
|
packageName: "@atlaskit/smart-card" || '',
|
|
14
|
-
packageVersion: "44.
|
|
14
|
+
packageVersion: "44.7.0" || ''
|
|
15
15
|
};
|
|
16
16
|
var TrackQuickActionType = exports.TrackQuickActionType = /*#__PURE__*/function (TrackQuickActionType) {
|
|
17
17
|
TrackQuickActionType["StatusUpdate"] = "StatusUpdate";
|
|
@@ -14,10 +14,10 @@ var _runtime = require("@compiled/react/runtime");
|
|
|
14
14
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
15
15
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
16
16
|
var _userAgent = require("@atlaskit/linking-common/user-agent");
|
|
17
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
17
|
var _constants = require("../../../constants");
|
|
19
18
|
var _extractRovoChatAction = _interopRequireDefault(require("../../../extractors/flexible/actions/extract-rovo-chat-action"));
|
|
20
19
|
var _helpers = require("../../../state/helpers");
|
|
20
|
+
var _useBlockCardRovoActionExperiment = _interopRequireDefault(require("../../../state/hooks/use-block-card-rovo-action-experiment"));
|
|
21
21
|
var _useRovoConfig = _interopRequireDefault(require("../../../state/hooks/use-rovo-config"));
|
|
22
22
|
var _FlexibleCard = _interopRequireDefault(require("../../FlexibleCard"));
|
|
23
23
|
var _rovoChatAction = require("../../FlexibleCard/components/actions/rovo-chat-action");
|
|
@@ -51,10 +51,12 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
51
51
|
isPreviewBlockErrored = _useState2[0],
|
|
52
52
|
setIsPreviewBlockErrored = _useState2[1];
|
|
53
53
|
var extensionKey = (0, _helpers.getExtensionKey)(cardState.details);
|
|
54
|
-
var
|
|
54
|
+
var _useBlockCardRovoActi = (0, _useBlockCardRovoActionExperiment.default)(url, actionOptions),
|
|
55
|
+
is3PRovoBlockExperimentEnabled = _useBlockCardRovoActi.isEnabled;
|
|
56
|
+
var rovoConfig = is3PRovoBlockExperimentEnabled ?
|
|
55
57
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
56
58
|
(0, _useRovoConfig.default)() : undefined;
|
|
57
|
-
var showRovoResolvedView =
|
|
59
|
+
var showRovoResolvedView = is3PRovoBlockExperimentEnabled ?
|
|
58
60
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
59
61
|
(0, _react.useMemo)(function () {
|
|
60
62
|
return (cardState === null || cardState === void 0 ? void 0 : cardState.status) === 'resolved' && cardState.details && (0, _extractRovoChatAction.default)({
|
|
@@ -78,7 +80,7 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
78
80
|
topMetadata = _getSimulatedBetterMe.topMetadata,
|
|
79
81
|
bottomMetadata = _getSimulatedBetterMe.bottomMetadata;
|
|
80
82
|
var prompts = (0, _react.useMemo)(function () {
|
|
81
|
-
if (
|
|
83
|
+
if (is3PRovoBlockExperimentEnabled) {
|
|
82
84
|
var _cardState$details;
|
|
83
85
|
var defaultPrompts = [_rovoChatAction.RovoChatPromptKey.KEY_HIGHLIGHTS];
|
|
84
86
|
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'];
|
|
@@ -94,23 +96,20 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
94
96
|
return [_rovoChatAction.RovoChatPromptKey.SUMMARIZE_LINK].concat(defaultPrompts);
|
|
95
97
|
}
|
|
96
98
|
return [];
|
|
97
|
-
}, [cardState === null || cardState === void 0 || (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data, extensionKey]);
|
|
99
|
+
}, [cardState === null || cardState === void 0 || (_cardState$details2 = cardState.details) === null || _cardState$details2 === void 0 ? void 0 : _cardState$details2.data, extensionKey, is3PRovoBlockExperimentEnabled]);
|
|
98
100
|
var footerActions = (0, _react.useMemo)(function () {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}];
|
|
112
|
-
}
|
|
113
|
-
return [{
|
|
101
|
+
return showRovoResolvedView && is3PRovoBlockExperimentEnabled ? [{
|
|
102
|
+
name: _constants.ActionName.RovoChatAction,
|
|
103
|
+
prompts: prompts,
|
|
104
|
+
iconSize: 'small',
|
|
105
|
+
cardAppearance: _constants.CardDisplay.Block
|
|
106
|
+
}, {
|
|
107
|
+
name: _constants.ActionName.FollowAction,
|
|
108
|
+
iconSize: 'small'
|
|
109
|
+
}, {
|
|
110
|
+
name: _constants.ActionName.DownloadAction,
|
|
111
|
+
iconSize: 'small'
|
|
112
|
+
}] : [{
|
|
114
113
|
name: _constants.ActionName.FollowAction,
|
|
115
114
|
hideIcon: true
|
|
116
115
|
}, {
|
|
@@ -120,7 +119,7 @@ var ResolvedView = function ResolvedView(_ref) {
|
|
|
120
119
|
name: _constants.ActionName.DownloadAction,
|
|
121
120
|
hideIcon: true
|
|
122
121
|
}];
|
|
123
|
-
}, [showRovoResolvedView, prompts]);
|
|
122
|
+
}, [showRovoResolvedView, prompts, is3PRovoBlockExperimentEnabled]);
|
|
124
123
|
var uiOptions = _utils.FlexibleCardUiOptions;
|
|
125
124
|
uiOptions.enableSnippetRenderer = true;
|
|
126
125
|
uiOptions.hideLoadingSkeleton = hideIconLoadingSkeleton;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _reactIntl = require("react-intl");
|
|
11
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
12
|
+
var _messages = require("../../../messages");
|
|
13
|
+
// TODO: remove when social-proof-3p-unauth-block-fg is cleaned up
|
|
14
|
+
var SocialProofMessage = function SocialProofMessage(_ref) {
|
|
15
|
+
var tier = _ref.tier,
|
|
16
|
+
connectedPct = _ref.connectedPct,
|
|
17
|
+
providerName = _ref.providerName,
|
|
18
|
+
_ref$testId = _ref.testId,
|
|
19
|
+
testId = _ref$testId === void 0 ? 'smart-block-social-proof-message' : _ref$testId;
|
|
20
|
+
var message = tier === 'not-low' ? _messages.messages.pre_auth_block_social_proof_not_low : _messages.messages.pre_auth_block_social_proof_low;
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
22
|
+
testId: testId
|
|
23
|
+
}, /*#__PURE__*/_react.default.createElement(_reactIntl.FormattedMessage, (0, _extends2.default)({}, message, {
|
|
24
|
+
values: {
|
|
25
|
+
percentage: connectedPct !== null && connectedPct !== void 0 ? connectedPct : 0,
|
|
26
|
+
provider: providerName,
|
|
27
|
+
b: function b(chunks) {
|
|
28
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Text, {
|
|
29
|
+
as: "strong",
|
|
30
|
+
weight: "bold"
|
|
31
|
+
}, chunks);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
})));
|
|
35
|
+
};
|
|
36
|
+
var _default = exports.default = SocialProofMessage;
|