@abtnode/ux 1.16.27-beta-725ce3a6 → 1.16.27-beta-d1555a79
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/lib/actions.js +39 -56
- package/lib/analytics/card.js +62 -41
- package/lib/analytics/chart.js +40 -53
- package/lib/analytics/cpu.js +20 -28
- package/lib/analytics/disk.js +40 -52
- package/lib/analytics/memory.js +28 -37
- package/lib/analytics/runtime.js +40 -52
- package/lib/analytics/traffic.js +87 -98
- package/lib/blocklet/access/config-access.js +109 -106
- package/lib/blocklet/access/index.js +96 -102
- package/lib/blocklet/actions.js +312 -332
- package/lib/blocklet/add-cert.js +57 -73
- package/lib/blocklet/agreement-app.js +13 -23
- package/lib/blocklet/agreement.js +126 -58
- package/lib/blocklet/app-avatar.js +19 -35
- package/lib/blocklet/audit-logs.js +139 -98
- package/lib/blocklet/authentication/common-settings.js +88 -104
- package/lib/blocklet/authentication/federated/federated-detail-dialog.js +57 -66
- package/lib/blocklet/authentication/federated/federated-invite-dialog.js +29 -39
- package/lib/blocklet/authentication/federated/federated-join-dialog.js +36 -45
- package/lib/blocklet/authentication/federated/federated-site-list.js +73 -87
- package/lib/blocklet/authentication/federated/index.js +35 -48
- package/lib/blocklet/authentication/index.js +27 -34
- package/lib/blocklet/authentication/oauth/apple.js +125 -152
- package/lib/blocklet/authentication/oauth/auth0.js +93 -114
- package/lib/blocklet/authentication/oauth/drag-item.js +49 -57
- package/lib/blocklet/authentication/oauth/github.js +78 -96
- package/lib/blocklet/authentication/oauth/google.js +78 -96
- package/lib/blocklet/authentication/oauth/index.js +47 -61
- package/lib/blocklet/blocklet-source.js +23 -32
- package/lib/blocklet/bundle-avatar.js +26 -42
- package/{es/blocklet/component → lib/blocklet/component/add-component}/add-component-core.js +161 -237
- package/{es/blocklet/component → lib/blocklet/component/add-component}/add-component-dialog.js +2 -2
- package/lib/blocklet/component/add-component/step-connect.js +215 -0
- package/lib/blocklet/component/button.js +9 -20
- package/lib/blocklet/component/component-cell.js +141 -137
- package/lib/blocklet/component/component-info-dialog.js +94 -90
- package/lib/blocklet/component/configuration.js +56 -58
- package/lib/blocklet/component/delete.js +56 -66
- package/lib/blocklet/component/did-space/connect-to.js +100 -108
- package/lib/blocklet/component/did-space/connected.js +14 -21
- package/lib/blocklet/component/did-space/delete.js +31 -39
- package/lib/blocklet/component/did-space/disconnect.js +58 -69
- package/lib/blocklet/component/did-space/index.js +40 -47
- package/lib/blocklet/component/did-space/item.js +113 -78
- package/lib/blocklet/component/domain-list.js +211 -230
- package/lib/blocklet/component/environment.js +137 -92
- package/lib/blocklet/component/index.js +230 -222
- package/lib/blocklet/component/line.js +10 -18
- package/lib/blocklet/component/navigation/locale-tabs.js +64 -76
- package/lib/blocklet/component/navigation/navigation-actions.js +43 -51
- package/lib/blocklet/component/navigation/navigation-dialog.js +263 -299
- package/lib/blocklet/component/navigation/navigation-preview.js +44 -48
- package/lib/blocklet/component/navigation/simple-select.js +54 -70
- package/lib/blocklet/component/optional-component-cell.js +91 -55
- package/lib/blocklet/component/related-components-dialog.js +40 -50
- package/lib/blocklet/component/select-store.js +70 -74
- package/lib/blocklet/component/selected/index.js +72 -26
- package/lib/blocklet/component/setting.js +48 -62
- package/lib/blocklet/component/shorten-label.js +34 -0
- package/lib/blocklet/component/sortable-tree.js +49 -63
- package/lib/blocklet/component/space-connector.js +64 -78
- package/lib/blocklet/component/space-selector.js +65 -71
- package/lib/blocklet/component/start.js +42 -49
- package/lib/blocklet/component/step-actions.js +72 -37
- package/lib/blocklet/component/store-blocklet-list.js +93 -103
- package/lib/blocklet/component/switch-control.js +36 -42
- package/lib/blocklet/config-navigation.js +106 -134
- package/lib/blocklet/configuration.js +188 -171
- package/lib/blocklet/disk-info.js +26 -44
- package/lib/blocklet/icons.js +21 -28
- package/lib/blocklet/install-from-url.js +93 -107
- package/lib/blocklet/log.js +27 -43
- package/lib/blocklet/logo-uploader.js +76 -58
- package/lib/blocklet/migration.js +40 -50
- package/lib/blocklet/mode.js +12 -28
- package/lib/blocklet/notification/email.js +154 -186
- package/lib/blocklet/notification/index.js +20 -27
- package/lib/blocklet/overview.js +59 -60
- package/lib/blocklet/page-group.js +12 -28
- package/lib/blocklet/preferences/app-sk.js +54 -57
- package/lib/blocklet/preferences/index.js +100 -111
- package/lib/blocklet/publish/connect-store-button.js +112 -0
- package/lib/blocklet/publish/connect-store-list.js +51 -56
- package/lib/blocklet/publish/create-release.js +512 -392
- package/lib/blocklet/publish/index.js +42 -46
- package/lib/blocklet/publish/project-list.js +127 -105
- package/lib/blocklet/publish/release-list.js +98 -97
- package/lib/blocklet/publish/resource.js +186 -157
- package/lib/blocklet/publish/select-components.js +73 -68
- package/lib/blocklet/publish/tree.js +141 -109
- package/lib/blocklet/publish/wait-connect.js +64 -0
- package/lib/blocklet/purchase/common.js +37 -45
- package/lib/blocklet/purchase/component-purchase.js +74 -91
- package/lib/blocklet/purchase/index.js +3 -12
- package/lib/blocklet/resource-type.js +19 -36
- package/lib/blocklet/router/action/add-domain-alias.js +56 -67
- package/lib/blocklet/router/action/add-rule.js +63 -73
- package/lib/blocklet/router/action/config-routing-rule.js +84 -93
- package/lib/blocklet/router/action/delete-domain-alias.js +27 -34
- package/lib/blocklet/router/action/delete-rule.js +31 -39
- package/lib/blocklet/router/action/update-rule.js +66 -76
- package/lib/blocklet/router/add-domain.js +113 -131
- package/lib/blocklet/router/dns-tip.js +40 -57
- package/lib/blocklet/router/domain-actions.js +52 -67
- package/lib/blocklet/router/domain-status.js +27 -35
- package/lib/blocklet/router/rule-actions.js +45 -60
- package/lib/blocklet/router/rule-list.js +83 -92
- package/lib/blocklet/router/util.js +30 -46
- package/lib/blocklet/runtime-info.js +30 -48
- package/lib/blocklet/status.js +37 -52
- package/lib/blocklet/storage/action.js +59 -76
- package/lib/blocklet/storage/auto-backup.js +23 -31
- package/lib/blocklet/storage/auto-check-update.js +28 -42
- package/lib/blocklet/storage/backups.js +50 -60
- package/lib/blocklet/storage/connect-to.js +100 -106
- package/lib/blocklet/storage/connected.js +35 -40
- package/lib/blocklet/storage/delete.js +34 -42
- package/lib/blocklet/storage/disconnect.js +65 -76
- package/lib/blocklet/storage/index.js +9 -16
- package/lib/blocklet/storage/item.js +193 -153
- package/lib/blocklet/storage/preview-nft.js +74 -87
- package/lib/blocklet/transfer-owner.js +70 -74
- package/lib/blocklet/types.js +12 -18
- package/lib/blocklet/util.js +38 -55
- package/lib/blocklet/version.js +59 -69
- package/lib/card-selector.js +63 -39
- package/lib/certificate.js +35 -43
- package/lib/chain.js +3 -10
- package/lib/clear-cache.js +28 -44
- package/lib/click-to-copy.js +15 -31
- package/lib/confirm.js +72 -84
- package/lib/contexts/audit-log.js +30 -41
- package/lib/contexts/blocklet-storage.js +56 -65
- package/lib/contexts/blocklet.js +5 -13
- package/lib/contexts/config-space.js +34 -42
- package/lib/contexts/deleting-blocklets.js +18 -26
- package/lib/contexts/domain.js +20 -30
- package/lib/contexts/node.js +8 -20
- package/lib/contexts/session.js +5 -17
- package/lib/contexts/team.js +5 -13
- package/lib/delete-confirm.js +53 -60
- package/lib/did-address.js +24 -39
- package/lib/dot.js +9 -12
- package/lib/empty-spinner.js +15 -31
- package/lib/exchange-passport.js +30 -42
- package/lib/form/form-autocomplete-input.js +101 -117
- package/lib/form/form-select-input.js +69 -87
- package/lib/form/form-text-input.js +59 -75
- package/lib/form/form-wrapper.js +88 -12
- package/lib/form/input-triggers.js +39 -47
- package/lib/form/required.js +8 -12
- package/lib/hooks/blocklet.js +83 -106
- package/lib/hooks/confirm.js +31 -47
- package/lib/hooks/mobile-width.js +5 -12
- package/lib/hooks/url-evaluation.js +37 -50
- package/lib/hooks/use-app-logo.js +17 -27
- package/lib/hooks/use-auto-backup.js +15 -25
- package/lib/hooks/use-auto-check-update.js +15 -25
- package/lib/hooks/use-backup-progress.js +19 -30
- package/lib/hooks/use-backups.js +22 -30
- package/lib/hooks/use-blocklet-info-for-connect-did-spaces.js +17 -26
- package/lib/hooks/use-bundle-logo.js +13 -22
- package/lib/hooks/use-check-update-by-url.js +12 -20
- package/lib/hooks/use-components-by-blocklet-meta-url.js +11 -17
- package/lib/hooks/use-event-listen.js +4 -10
- package/lib/hooks/use-install-component-by-url.js +20 -29
- package/lib/hooks/use-mobile.js +9 -16
- package/lib/hooks/use-navigation.js +66 -74
- package/lib/hooks/use-passport-id.js +1 -7
- package/lib/hooks/use-snackbar.js +2 -8
- package/lib/hooks/use-space-gateways.js +21 -29
- package/lib/hooks/use-storage-endpoint.js +8 -13
- package/lib/hooks/use-subscription.js +8 -14
- package/lib/hooks/use-width.js +5 -12
- package/lib/images.js +31 -34
- package/lib/index.js +3 -20
- package/lib/invitation/invitation-app.js +42 -35
- package/lib/invitation/invitation-login.js +51 -29
- package/lib/invitation/invitation-passport.js +76 -48
- package/lib/invitation/invitation-receive.js +81 -66
- package/lib/invitation/invitation-success.js +51 -41
- package/lib/invitation/invitation-user.js +48 -38
- package/lib/invitation/invitation.js +69 -63
- package/lib/issue-passport.js +64 -53
- package/lib/launch-blocklet/content-layout.js +54 -29
- package/lib/launch-blocklet/page-header.js +29 -24
- package/lib/layout/addon.js +72 -56
- package/lib/layout/feedback.js +25 -25
- package/lib/locales/ar.js +7 -10
- package/lib/locales/de.js +8 -11
- package/lib/locales/en.js +4 -7
- package/lib/locales/es.js +7 -10
- package/lib/locales/fr.js +7 -10
- package/lib/locales/hi.js +7 -10
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +7 -10
- package/lib/locales/index.js +19 -27
- package/lib/locales/ja.js +7 -10
- package/lib/locales/ko.js +7 -10
- package/lib/locales/pt.js +7 -10
- package/lib/locales/ru.js +6 -9
- package/lib/locales/th.js +6 -9
- package/lib/locales/vi.js +7 -10
- package/lib/locales/zh-tw.js +6 -9
- package/lib/locales/zh.js +6 -9
- package/lib/logs/clock.js +7 -14
- package/lib/logs/download.js +45 -53
- package/lib/logs/log-terminal.js +145 -84
- package/lib/lost-passport.js +226 -110
- package/lib/nav-logo.js +157 -60
- package/lib/notifications/addon.js +34 -43
- package/lib/notifications/default-icon-variants.js +23 -31
- package/lib/notifications/list.js +122 -89
- package/lib/notifications/notification.js +64 -56
- package/lib/notifications/page.js +151 -104
- package/lib/notifications/tag.js +12 -28
- package/lib/passport-tag.js +31 -32
- package/lib/permission.js +19 -32
- package/lib/relative-time.js +25 -39
- package/lib/result-message.js +11 -13
- package/lib/schema-form/color-input.js +24 -32
- package/lib/schema-form/common-prop-types.js +10 -17
- package/lib/schema-form/index.js +75 -89
- package/lib/schema-form/passport-input.js +28 -42
- package/lib/schema-form/text-input.js +20 -35
- package/lib/store/add.js +50 -58
- package/lib/store/connect-actions.js +46 -54
- package/lib/store/delete.js +35 -43
- package/lib/store/item.js +124 -136
- package/lib/subscription/blocklet.js +76 -90
- package/lib/subscription/chip-label.js +15 -23
- package/lib/subscription/server.js +83 -96
- package/lib/table-icons.js +33 -40
- package/lib/table.js +52 -12
- package/lib/tag.js +14 -30
- package/lib/team/members/actions.js +68 -82
- package/lib/team/members/connections.js +11 -19
- package/lib/team/members/index.js +287 -192
- package/lib/team/members/invitations.js +45 -55
- package/lib/team/members/invite-member.js +69 -76
- package/lib/team/members/issue-passport.js +54 -62
- package/lib/team/members/member.js +154 -142
- package/lib/team/members/passport-issuances.js +65 -61
- package/lib/team/members/passport-item.js +63 -55
- package/lib/team/members/passports.js +110 -115
- package/lib/team/members/toggle-user-approval.js +34 -42
- package/lib/team/members/transfer-node.js +78 -85
- package/lib/team/members/util.js +6 -12
- package/lib/team/passports/color.js +53 -61
- package/lib/team/passports/detail.js +136 -97
- package/lib/team/passports/index.js +117 -98
- package/lib/team/passports/mutate-role.js +50 -58
- package/lib/team/passports/trusted-factories.js +88 -93
- package/lib/team/passports/trusted-factory.js +99 -100
- package/lib/team/passports/trusted-issuer.js +92 -96
- package/lib/team/passports/trusted-issuers.js +88 -93
- package/lib/team/search-input.js +45 -36
- package/lib/team/styles/dialog.js +71 -11
- package/lib/team/styles/list-header.js +30 -11
- package/lib/util/api.js +5 -18
- package/lib/util/constants.js +3 -10
- package/lib/util/index.js +215 -324
- package/lib/util/join-url-keep-search.js +3 -10
- package/lib/util/mode.js +1 -7
- package/lib/util/parse-progress.js +1 -7
- package/lib/util/space-gateway.js +16 -23
- package/lib/util/spaces.js +48 -72
- package/lib/util/storage-ttl.js +4 -15
- package/lib/who-can-access/config.js +11 -18
- package/lib/wrap-locale.js +11 -18
- package/package.json +20 -100
- package/es/actions.js +0 -100
- package/es/analytics/card.js +0 -91
- package/es/analytics/chart.js +0 -95
- package/es/analytics/cpu.js +0 -36
- package/es/analytics/disk.js +0 -107
- package/es/analytics/memory.js +0 -70
- package/es/analytics/runtime.js +0 -174
- package/es/analytics/traffic.js +0 -257
- package/es/blocklet/access/config-access.js +0 -305
- package/es/blocklet/access/index.js +0 -215
- package/es/blocklet/actions.js +0 -536
- package/es/blocklet/add-cert.js +0 -193
- package/es/blocklet/agreement-app.js +0 -21
- package/es/blocklet/agreement.js +0 -214
- package/es/blocklet/app-avatar.js +0 -45
- package/es/blocklet/audit-logs.js +0 -275
- package/es/blocklet/authentication/common-settings.js +0 -133
- package/es/blocklet/authentication/federated/federated-detail-dialog.js +0 -193
- package/es/blocklet/authentication/federated/federated-invite-dialog.js +0 -82
- package/es/blocklet/authentication/federated/federated-join-dialog.js +0 -110
- package/es/blocklet/authentication/federated/federated-site-list.js +0 -319
- package/es/blocklet/authentication/federated/index.js +0 -79
- package/es/blocklet/authentication/index.js +0 -68
- package/es/blocklet/authentication/oauth/apple.js +0 -222
- package/es/blocklet/authentication/oauth/auth0.js +0 -170
- package/es/blocklet/authentication/oauth/drag-item.js +0 -177
- package/es/blocklet/authentication/oauth/github.js +0 -146
- package/es/blocklet/authentication/oauth/google.js +0 -145
- package/es/blocklet/authentication/oauth/index.js +0 -122
- package/es/blocklet/blocklet-source.js +0 -47
- package/es/blocklet/bundle-avatar.js +0 -64
- package/es/blocklet/component/button.js +0 -12
- package/es/blocklet/component/component-cell.js +0 -339
- package/es/blocklet/component/component-info-dialog.js +0 -257
- package/es/blocklet/component/configuration.js +0 -122
- package/es/blocklet/component/delete.js +0 -132
- package/es/blocklet/component/did-space/connect-to.js +0 -351
- package/es/blocklet/component/did-space/connected.js +0 -41
- package/es/blocklet/component/did-space/delete.js +0 -102
- package/es/blocklet/component/did-space/disconnect.js +0 -228
- package/es/blocklet/component/did-space/index.js +0 -74
- package/es/blocklet/component/did-space/item.js +0 -230
- package/es/blocklet/component/domain-list.js +0 -519
- package/es/blocklet/component/environment.js +0 -364
- package/es/blocklet/component/index.js +0 -545
- package/es/blocklet/component/line.js +0 -24
- package/es/blocklet/component/navigation/locale-tabs.js +0 -227
- package/es/blocklet/component/navigation/navigation-actions.js +0 -111
- package/es/blocklet/component/navigation/navigation-dialog.js +0 -608
- package/es/blocklet/component/navigation/navigation-preview.js +0 -108
- package/es/blocklet/component/navigation/simple-select.js +0 -123
- package/es/blocklet/component/optional-component-cell.js +0 -140
- package/es/blocklet/component/related-components-dialog.js +0 -194
- package/es/blocklet/component/select-store.js +0 -170
- package/es/blocklet/component/selected/index.js +0 -93
- package/es/blocklet/component/setting.js +0 -109
- package/es/blocklet/component/sortable-tree.js +0 -125
- package/es/blocklet/component/space-connector.js +0 -197
- package/es/blocklet/component/space-selector.js +0 -177
- package/es/blocklet/component/start.js +0 -101
- package/es/blocklet/component/step-actions.js +0 -98
- package/es/blocklet/component/store-blocklet-list.js +0 -227
- package/es/blocklet/component/switch-control.js +0 -57
- package/es/blocklet/config-navigation.js +0 -354
- package/es/blocklet/configuration.js +0 -589
- package/es/blocklet/disk-info.js +0 -74
- package/es/blocklet/icons.js +0 -22
- package/es/blocklet/install-from-url.js +0 -335
- package/es/blocklet/log.js +0 -90
- package/es/blocklet/logo-uploader.js +0 -133
- package/es/blocklet/migration.js +0 -148
- package/es/blocklet/mode.js +0 -19
- package/es/blocklet/notification/email.js +0 -342
- package/es/blocklet/notification/index.js +0 -48
- package/es/blocklet/overview.js +0 -158
- package/es/blocklet/page-group.js +0 -19
- package/es/blocklet/preferences/app-sk.js +0 -141
- package/es/blocklet/preferences/index.js +0 -304
- package/es/blocklet/publish/connect-store-list.js +0 -97
- package/es/blocklet/publish/create-release.js +0 -1059
- package/es/blocklet/publish/index.js +0 -69
- package/es/blocklet/publish/project-list.js +0 -399
- package/es/blocklet/publish/release-list.js +0 -351
- package/es/blocklet/publish/resource.js +0 -235
- package/es/blocklet/publish/select-components.js +0 -180
- package/es/blocklet/publish/tree.js +0 -237
- package/es/blocklet/purchase/common.js +0 -93
- package/es/blocklet/purchase/component-purchase.js +0 -235
- package/es/blocklet/purchase/index.js +0 -4
- package/es/blocklet/resource-type.js +0 -34
- package/es/blocklet/router/action/add-domain-alias.js +0 -172
- package/es/blocklet/router/action/add-rule.js +0 -223
- package/es/blocklet/router/action/config-routing-rule.js +0 -283
- package/es/blocklet/router/action/delete-domain-alias.js +0 -97
- package/es/blocklet/router/action/delete-rule.js +0 -106
- package/es/blocklet/router/action/update-rule.js +0 -221
- package/es/blocklet/router/add-domain.js +0 -307
- package/es/blocklet/router/dns-tip.js +0 -103
- package/es/blocklet/router/domain-actions.js +0 -64
- package/es/blocklet/router/domain-status.js +0 -87
- package/es/blocklet/router/rule-actions.js +0 -65
- package/es/blocklet/router/rule-list.js +0 -203
- package/es/blocklet/router/util.js +0 -148
- package/es/blocklet/runtime-info.js +0 -67
- package/es/blocklet/status.js +0 -106
- package/es/blocklet/storage/action.js +0 -149
- package/es/blocklet/storage/auto-backup.js +0 -55
- package/es/blocklet/storage/auto-check-update.js +0 -69
- package/es/blocklet/storage/backups.js +0 -212
- package/es/blocklet/storage/connect-to.js +0 -353
- package/es/blocklet/storage/connected.js +0 -112
- package/es/blocklet/storage/delete.js +0 -112
- package/es/blocklet/storage/disconnect.js +0 -241
- package/es/blocklet/storage/index.js +0 -16
- package/es/blocklet/storage/item.js +0 -544
- package/es/blocklet/storage/preview-nft.js +0 -283
- package/es/blocklet/transfer-owner.js +0 -199
- package/es/blocklet/types.js +0 -18
- package/es/blocklet/util.js +0 -151
- package/es/blocklet/version.js +0 -139
- package/es/card-selector.js +0 -134
- package/es/certificate.js +0 -102
- package/es/chain.js +0 -13
- package/es/clear-cache.js +0 -77
- package/es/click-to-copy.js +0 -22
- package/es/confirm.js +0 -162
- package/es/contexts/audit-log.js +0 -152
- package/es/contexts/blocklet-storage.js +0 -247
- package/es/contexts/blocklet.js +0 -10
- package/es/contexts/config-space.js +0 -160
- package/es/contexts/deleting-blocklets.js +0 -70
- package/es/contexts/domain.js +0 -75
- package/es/contexts/node.js +0 -17
- package/es/contexts/session.js +0 -8
- package/es/contexts/team.js +0 -10
- package/es/delete-confirm.js +0 -120
- package/es/did-address.js +0 -46
- package/es/dot.js +0 -14
- package/es/empty-spinner.js +0 -24
- package/es/exchange-passport.js +0 -93
- package/es/form/form-autocomplete-input.js +0 -283
- package/es/form/form-select-input.js +0 -188
- package/es/form/form-text-input.js +0 -176
- package/es/form/form-wrapper.js +0 -88
- package/es/form/input-triggers.js +0 -96
- package/es/form/required.js +0 -8
- package/es/hooks/blocklet.js +0 -317
- package/es/hooks/confirm.js +0 -98
- package/es/hooks/mobile-width.js +0 -11
- package/es/hooks/url-evaluation.js +0 -155
- package/es/hooks/use-app-logo.js +0 -32
- package/es/hooks/use-auto-backup.js +0 -33
- package/es/hooks/use-auto-check-update.js +0 -33
- package/es/hooks/use-backup-progress.js +0 -65
- package/es/hooks/use-backups.js +0 -61
- package/es/hooks/use-blocklet-info-for-connect-did-spaces.js +0 -55
- package/es/hooks/use-bundle-logo.js +0 -27
- package/es/hooks/use-check-update-by-url.js +0 -28
- package/es/hooks/use-components-by-blocklet-meta-url.js +0 -36
- package/es/hooks/use-event-listen.js +0 -11
- package/es/hooks/use-install-component-by-url.js +0 -65
- package/es/hooks/use-mobile.js +0 -17
- package/es/hooks/use-navigation.js +0 -331
- package/es/hooks/use-passport-id.js +0 -18
- package/es/hooks/use-snackbar.js +0 -2
- package/es/hooks/use-space-gateways.js +0 -66
- package/es/hooks/use-storage-endpoint.js +0 -23
- package/es/hooks/use-subscription.js +0 -22
- package/es/hooks/use-width.js +0 -12
- package/es/icons/empty-space-nft.svg +0 -59
- package/es/icons/empty-spaces-nft.svg +0 -58
- package/es/icons/long-arrow.svg +0 -5
- package/es/icons/space-connected.svg +0 -3
- package/es/icons/space-disconnect.svg +0 -3
- package/es/images.js +0 -48
- package/es/index.js +0 -3
- package/es/invitation/invitation-app.js +0 -57
- package/es/invitation/invitation-login.js +0 -68
- package/es/invitation/invitation-passport.js +0 -144
- package/es/invitation/invitation-receive.js +0 -170
- package/es/invitation/invitation-success.js +0 -92
- package/es/invitation/invitation-user.js +0 -89
- package/es/invitation/invitation.js +0 -103
- package/es/issue-passport.js +0 -151
- package/es/launch-blocklet/content-layout.js +0 -58
- package/es/launch-blocklet/page-header.js +0 -42
- package/es/layout/addon.js +0 -119
- package/es/layout/feedback.js +0 -58
- package/es/locales/ar.js +0 -1824
- package/es/locales/de.js +0 -1824
- package/es/locales/en.js +0 -1814
- package/es/locales/es.js +0 -1824
- package/es/locales/fr.js +0 -1824
- package/es/locales/hi.js +0 -1824
- package/es/locales/i18n.db +0 -0
- package/es/locales/id.js +0 -1824
- package/es/locales/index.js +0 -20
- package/es/locales/ja.js +0 -1824
- package/es/locales/ko.js +0 -1824
- package/es/locales/pt.js +0 -1824
- package/es/locales/ru.js +0 -1824
- package/es/locales/th.js +0 -1824
- package/es/locales/vi.js +0 -1824
- package/es/locales/zh-tw.js +0 -1824
- package/es/locales/zh.js +0 -1831
- package/es/logs/clock.js +0 -11
- package/es/logs/download.js +0 -132
- package/es/logs/log-terminal.js +0 -253
- package/es/lost-passport.js +0 -501
- package/es/nav-logo.js +0 -217
- package/es/notifications/addon.js +0 -90
- package/es/notifications/default-icon-variants.js +0 -53
- package/es/notifications/list.js +0 -272
- package/es/notifications/notification.js +0 -147
- package/es/notifications/page.js +0 -314
- package/es/notifications/tag.js +0 -28
- package/es/passport-tag.js +0 -42
- package/es/permission.js +0 -57
- package/es/relative-time.js +0 -56
- package/es/result-message.js +0 -11
- package/es/schema-form/color-input.js +0 -97
- package/es/schema-form/common-prop-types.js +0 -13
- package/es/schema-form/index.js +0 -222
- package/es/schema-form/passport-input.js +0 -54
- package/es/schema-form/text-input.js +0 -57
- package/es/store/add.js +0 -178
- package/es/store/connect-actions.js +0 -139
- package/es/store/delete.js +0 -112
- package/es/store/item.js +0 -347
- package/es/subscription/blocklet.js +0 -175
- package/es/subscription/chip-label.js +0 -40
- package/es/subscription/server.js +0 -189
- package/es/table-icons.js +0 -34
- package/es/table.js +0 -52
- package/es/tag.js +0 -21
- package/es/team/members/actions.js +0 -143
- package/es/team/members/connections.js +0 -28
- package/es/team/members/index.js +0 -746
- package/es/team/members/invitations.js +0 -187
- package/es/team/members/invite-member.js +0 -206
- package/es/team/members/issue-passport.js +0 -150
- package/es/team/members/member.js +0 -394
- package/es/team/members/passport-issuances.js +0 -154
- package/es/team/members/passport-item.js +0 -103
- package/es/team/members/passports.js +0 -308
- package/es/team/members/toggle-user-approval.js +0 -123
- package/es/team/members/transfer-node.js +0 -255
- package/es/team/members/util.js +0 -14
- package/es/team/passports/color.js +0 -125
- package/es/team/passports/detail.js +0 -310
- package/es/team/passports/index.js +0 -289
- package/es/team/passports/mutate-role.js +0 -196
- package/es/team/passports/trusted-factories.js +0 -220
- package/es/team/passports/trusted-factory.js +0 -341
- package/es/team/passports/trusted-issuer.js +0 -293
- package/es/team/passports/trusted-issuers.js +0 -225
- package/es/team/search-input.js +0 -46
- package/es/team/styles/dialog.js +0 -72
- package/es/team/styles/list-header.js +0 -31
- package/es/util/api.js +0 -6
- package/es/util/constants.js +0 -3
- package/es/util/index.js +0 -691
- package/es/util/join-url-keep-search.js +0 -15
- package/es/util/mode.js +0 -4
- package/es/util/parse-progress.js +0 -10
- package/es/util/space-gateway.js +0 -51
- package/es/util/spaces.js +0 -235
- package/es/util/storage-ttl.js +0 -78
- package/es/who-can-access/config.js +0 -38
- package/es/wrap-locale.js +0 -15
- package/lib/blocklet/component/add-component-button.js +0 -57
- package/lib/blocklet/component/add-component-core.js +0 -1188
- package/lib/blocklet/component/add-component-dialog.js +0 -85
- /package/{es/blocklet/component → lib/blocklet/component/add-component}/add-component-button.js +0 -0
package/lib/util/index.js
CHANGED
|
@@ -1,92 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
exports.getAccessibleUrl = void 0;
|
|
25
|
-
exports.getAsset = getAsset;
|
|
26
|
-
exports.getBlockletLogoUrl = void 0;
|
|
27
|
-
exports.getBlockletMetaUrl = getBlockletMetaUrl;
|
|
28
|
-
exports.getBlockletUrl = getBlockletUrl;
|
|
29
|
-
exports.getBlockletUrlParams = void 0;
|
|
30
|
-
exports.getBlockletUrls = getBlockletUrls;
|
|
31
|
-
exports.getExplorerLink = getExplorerLink;
|
|
32
|
-
exports.getTransferAppLink = exports.getSystemDomains = exports.getSubscriptionUrlV2 = exports.getSubscriptionURL = exports.getStoreList = exports.getPathPrefix = exports.getManageSubscriptionURL = exports.getLogoHash = exports.getIssuePassportLink = exports.getInviteLink = void 0;
|
|
33
|
-
exports.getWebWalletUrl = getWebWalletUrl;
|
|
34
|
-
exports.isNewStoreUrl = exports.isInstalling = exports.isDownloading = exports.isChrome = exports.isCertificateMatch = exports.isBlockletDev = exports.hasRequiredSteps = void 0;
|
|
35
|
-
exports.isProtectedRole = isProtectedRole;
|
|
36
|
-
exports.isUrlAccessible = exports.isSafari = exports.isRunning = void 0;
|
|
37
|
-
exports.isValidClusterSize = isValidClusterSize;
|
|
38
|
-
exports.parseQuery = exports.nanoid = void 0;
|
|
39
|
-
exports.patchJsxToLocale = patchJsxToLocale;
|
|
40
|
-
exports.shouldCheckDomainStatus = void 0;
|
|
41
|
-
exports.sleep = sleep;
|
|
42
|
-
exports.validateDomain = exports.toSlotDomain = exports.stringSortHandlerAsc = exports.sortDomains = void 0;
|
|
43
|
-
var _constant = require("@abtnode/constant");
|
|
44
|
-
var _filesize2 = require("filesize");
|
|
45
|
-
var _humanizeUrl = _interopRequireDefault(require("humanize-url"));
|
|
46
|
-
var _isUrl = _interopRequireDefault(require("is-url"));
|
|
47
|
-
var _get = _interopRequireDefault(require("lodash/get"));
|
|
48
|
-
var _trimEnd = _interopRequireDefault(require("lodash/trimEnd"));
|
|
49
|
-
var _querystring = _interopRequireDefault(require("querystring"));
|
|
50
|
-
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
51
|
-
var _axios = _interopRequireDefault(require("@abtnode/util/lib/axios"));
|
|
52
|
-
var _dayjs = _interopRequireDefault(require("@abtnode/util/lib/dayjs"));
|
|
53
|
-
var _tryWithTimeout = _interopRequireDefault(require("@abtnode/util/lib/try-with-timeout"));
|
|
54
|
-
var _formatError = _interopRequireDefault(require("@abtnode/util/lib/format-error"));
|
|
55
|
-
var _normalizePathPrefix = _interopRequireDefault(require("@abtnode/util/lib/normalize-path-prefix"));
|
|
56
|
-
var _urlEvaluation = require("@abtnode/util/lib/url-evaluation");
|
|
57
|
-
var _checkAccessibleBrowser = _interopRequireDefault(require("@abtnode/util/lib/url-evaluation/check-accessible-browser"));
|
|
58
|
-
var _constant2 = require("@blocklet/constant");
|
|
59
|
-
var _urlPathFriendly = _interopRequireDefault(require("@blocklet/meta/lib/url-path-friendly"));
|
|
60
|
-
var _window$env;
|
|
61
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
62
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
63
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
64
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
65
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
66
|
-
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /* eslint-disable max-len */ /* eslint-disable implicit-arrow-linebreak */ /* eslint-disable import/prefer-default-export */
|
|
67
|
-
function filesize(size) {
|
|
68
|
-
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
69
|
-
return (0, _filesize2.filesize)(size, _objectSpread({
|
|
1
|
+
/* eslint-disable max-len */
|
|
2
|
+
/* eslint-disable implicit-arrow-linebreak */
|
|
3
|
+
/* eslint-disable import/prefer-default-export */
|
|
4
|
+
import { BLOCKLET_STORE_API_PREFIX, DEFAULT_DID_DOMAIN, DEFAULT_IP_DOMAIN_SUFFIX, DEFAULT_SLP_DOMAIN, DOMAIN_FOR_DEFAULT_SITE, DOMAIN_FOR_INTERNAL_SITE, DOMAIN_FOR_IP_SITE, DOMAIN_FOR_IP_SITE_REGEXP, IP, ROLES, SLOT_FOR_IP_DNS_SITE, WEB_WALLET_URL, WELLKNOWN_PATH_PREFIX, WELLKNOWN_PING_PREFIX, WELLKNOWN_SERVICE_PATH_PREFIX, WELLKNOWN_BLOCKLET_HEALTH_PATH } from '@abtnode/constant';
|
|
5
|
+
import { filesize as _filesize } from 'filesize';
|
|
6
|
+
import humanizeUrl from 'humanize-url';
|
|
7
|
+
import isUrl from 'is-url';
|
|
8
|
+
import get from 'lodash/get';
|
|
9
|
+
import trimEnd from 'lodash/trimEnd';
|
|
10
|
+
import qs from 'querystring';
|
|
11
|
+
import joinUrl from 'url-join';
|
|
12
|
+
import axios from '@abtnode/util/lib/axios';
|
|
13
|
+
import dayjs from '@abtnode/util/lib/dayjs';
|
|
14
|
+
import tryWithTimeout from '@abtnode/util/lib/try-with-timeout';
|
|
15
|
+
import formatError from '@abtnode/util/lib/format-error';
|
|
16
|
+
import normalizePathPrefix from '@abtnode/util/lib/normalize-path-prefix';
|
|
17
|
+
import { evaluateURLs } from '@abtnode/util/lib/url-evaluation';
|
|
18
|
+
import checkAccessible from '@abtnode/util/lib/url-evaluation/check-accessible-browser';
|
|
19
|
+
import { BLOCKLET_MODES } from '@blocklet/constant';
|
|
20
|
+
import urlPathFriendly from '@blocklet/meta/lib/url-path-friendly';
|
|
21
|
+
export { formatError };
|
|
22
|
+
export function filesize(size, options = {}) {
|
|
23
|
+
return _filesize(size, {
|
|
70
24
|
base: 2,
|
|
71
|
-
round: 2
|
|
72
|
-
|
|
25
|
+
round: 2,
|
|
26
|
+
...options
|
|
27
|
+
});
|
|
73
28
|
}
|
|
74
|
-
function sleep(t) {
|
|
29
|
+
export function sleep(t) {
|
|
75
30
|
// eslint-disable-next-line no-promise-executor-return
|
|
76
31
|
return new Promise(resolve => setTimeout(resolve, t));
|
|
77
32
|
}
|
|
78
|
-
const validateDomain =
|
|
79
|
-
let locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en';
|
|
33
|
+
export const validateDomain = (domain, locale = 'en') => {
|
|
80
34
|
if (!domain) {
|
|
81
35
|
return {
|
|
82
36
|
en: 'Site domain cannot be empty',
|
|
83
37
|
zh: '站点域名不能为空'
|
|
84
38
|
}[locale];
|
|
85
39
|
}
|
|
86
|
-
if (domain.endsWith(
|
|
40
|
+
if (domain.endsWith(DEFAULT_IP_DOMAIN_SUFFIX)) {
|
|
87
41
|
return {
|
|
88
|
-
en:
|
|
89
|
-
zh:
|
|
42
|
+
en: `Site domain cannot include ${DEFAULT_IP_DOMAIN_SUFFIX}`,
|
|
43
|
+
zh: `站点域名不能包含 ${DEFAULT_IP_DOMAIN_SUFFIX}`
|
|
90
44
|
}[locale];
|
|
91
45
|
}
|
|
92
46
|
return null;
|
|
@@ -97,18 +51,16 @@ const validateDomain = exports.validateDomain = function validateDomain(domain)
|
|
|
97
51
|
* auto fix http/https, port, query
|
|
98
52
|
* docker friendly
|
|
99
53
|
*/
|
|
100
|
-
function getAccessUrl(hostname) {
|
|
101
|
-
let path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
102
|
-
let params = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
54
|
+
export function getAccessUrl(hostname, path = '', params = undefined) {
|
|
103
55
|
if (!hostname) {
|
|
104
56
|
return '';
|
|
105
57
|
}
|
|
106
58
|
let port = '';
|
|
107
59
|
const browserPort = Number(window.location.port);
|
|
108
60
|
if (process.env.NODE_ENV !== 'development' && browserPort && ![80, 443].includes(browserPort)) {
|
|
109
|
-
port =
|
|
61
|
+
port = `:${browserPort}`;
|
|
110
62
|
}
|
|
111
|
-
const urlObj = new URL(
|
|
63
|
+
const urlObj = new URL(`${window.location.protocol}//${hostname}${port}`);
|
|
112
64
|
urlObj.pathname = path;
|
|
113
65
|
const url = urlObj.href.replace(/\/$/, '');
|
|
114
66
|
if (!params || !Object.keys(params)) {
|
|
@@ -118,15 +70,14 @@ function getAccessUrl(hostname) {
|
|
|
118
70
|
Object.keys(params).forEach(key => {
|
|
119
71
|
searchParams.append(key, params[key]);
|
|
120
72
|
});
|
|
121
|
-
return
|
|
73
|
+
return `${url}${urlObj.pathname === '/' ? '/' : ''}?${searchParams.toString()}`;
|
|
122
74
|
}
|
|
123
|
-
function getBlockletUrl(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
75
|
+
export function getBlockletUrl({
|
|
76
|
+
blocklet,
|
|
77
|
+
domain: inputDomain,
|
|
78
|
+
mountPoint: inputMountPoint,
|
|
79
|
+
params
|
|
80
|
+
} = {}) {
|
|
130
81
|
const {
|
|
131
82
|
site
|
|
132
83
|
} = blocklet;
|
|
@@ -139,17 +90,16 @@ function getBlockletUrl() {
|
|
|
139
90
|
}
|
|
140
91
|
let mountPoint = inputMountPoint;
|
|
141
92
|
if (!mountPoint) {
|
|
142
|
-
const rule = site.rules.filter(x => !x.from.pathPrefix.startsWith(
|
|
93
|
+
const rule = site.rules.filter(x => !x.from.pathPrefix.startsWith(WELLKNOWN_PATH_PREFIX))[0];
|
|
143
94
|
mountPoint = rule ? rule.from.pathPrefix : '/';
|
|
144
95
|
}
|
|
145
96
|
return getAccessUrl(domain.value, mountPoint, params);
|
|
146
97
|
}
|
|
147
|
-
function getBlockletUrls(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
98
|
+
export function getBlockletUrls({
|
|
99
|
+
blocklet,
|
|
100
|
+
mountPoint: inputMountPoint,
|
|
101
|
+
params
|
|
102
|
+
} = {}) {
|
|
153
103
|
const {
|
|
154
104
|
site
|
|
155
105
|
} = blocklet;
|
|
@@ -162,55 +112,50 @@ function getBlockletUrls() {
|
|
|
162
112
|
}
|
|
163
113
|
let mountPoint = inputMountPoint;
|
|
164
114
|
if (!mountPoint) {
|
|
165
|
-
|
|
166
|
-
const rules = site.rules.filter(x => !x.from.pathPrefix.startsWith(_constant.WELLKNOWN_PATH_PREFIX));
|
|
115
|
+
const rules = site.rules.filter(x => !x.from.pathPrefix.startsWith(WELLKNOWN_PATH_PREFIX));
|
|
167
116
|
let rule = rules[0];
|
|
168
|
-
if (
|
|
169
|
-
const rootRule = rules.find(x =>
|
|
170
|
-
var _x$from;
|
|
171
|
-
return ((_x$from = x.from) === null || _x$from === void 0 ? void 0 : _x$from.pathPrefix) === '/';
|
|
172
|
-
});
|
|
117
|
+
if (rule?.from?.pathPrefix !== '/') {
|
|
118
|
+
const rootRule = rules.find(x => x.from?.pathPrefix === '/');
|
|
173
119
|
if (rootRule) {
|
|
174
120
|
rule = rootRule;
|
|
175
121
|
}
|
|
176
122
|
}
|
|
177
|
-
mountPoint = (
|
|
123
|
+
mountPoint = normalizePathPrefix(rule?.from?.pathPrefix || '/');
|
|
178
124
|
}
|
|
179
125
|
return domains.map(domain => getAccessUrl(domain.value, mountPoint, params));
|
|
180
126
|
}
|
|
181
|
-
function getExplorerLink(chainHost, did, type) {
|
|
127
|
+
export function getExplorerLink(chainHost, did, type) {
|
|
182
128
|
if (!chainHost) return undefined;
|
|
183
129
|
try {
|
|
184
130
|
const chainUrl = new URL(chainHost);
|
|
185
131
|
switch (type) {
|
|
186
132
|
case 'asset':
|
|
187
|
-
chainUrl.pathname =
|
|
133
|
+
chainUrl.pathname = `/explorer/assets/${did}`;
|
|
188
134
|
break;
|
|
189
135
|
case 'account':
|
|
190
|
-
chainUrl.pathname =
|
|
136
|
+
chainUrl.pathname = `/explorer/accounts/${did}`;
|
|
191
137
|
break;
|
|
192
138
|
case 'tx':
|
|
193
|
-
chainUrl.pathname =
|
|
139
|
+
chainUrl.pathname = `/explorer/txs/${did}`;
|
|
194
140
|
break;
|
|
195
141
|
case 'token':
|
|
196
|
-
chainUrl.pathname =
|
|
142
|
+
chainUrl.pathname = `/explorer/tokens/${did}`;
|
|
197
143
|
break;
|
|
198
144
|
case 'factory':
|
|
199
|
-
chainUrl.pathname =
|
|
145
|
+
chainUrl.pathname = `/explorer/factories/${did}`;
|
|
200
146
|
break;
|
|
201
147
|
case 'bridge':
|
|
202
|
-
chainUrl.pathname =
|
|
148
|
+
chainUrl.pathname = `/explorer/bridges/${did}`;
|
|
203
149
|
break;
|
|
204
150
|
default:
|
|
205
151
|
chainUrl.pathname = '/';
|
|
206
152
|
}
|
|
207
153
|
return chainUrl.href;
|
|
208
|
-
} catch
|
|
154
|
+
} catch {
|
|
209
155
|
return undefined;
|
|
210
156
|
}
|
|
211
157
|
}
|
|
212
|
-
function patchJsxToLocale(rawStr) {
|
|
213
|
-
let replaceMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
158
|
+
export function patchJsxToLocale(rawStr, replaceMap = {}) {
|
|
214
159
|
return rawStr.split(/{{|}}/).map(item => {
|
|
215
160
|
if (replaceMap[item]) {
|
|
216
161
|
if (replaceMap[item] instanceof Function) {
|
|
@@ -221,45 +166,35 @@ function patchJsxToLocale(rawStr) {
|
|
|
221
166
|
return item;
|
|
222
167
|
}).filter(Boolean);
|
|
223
168
|
}
|
|
224
|
-
const formatLocale =
|
|
225
|
-
let locale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'en';
|
|
169
|
+
export const formatLocale = (locale = 'en') => {
|
|
226
170
|
if (locale === 'tw') {
|
|
227
171
|
return 'zh';
|
|
228
172
|
}
|
|
229
173
|
return locale;
|
|
230
174
|
};
|
|
231
|
-
function formatToDate(date) {
|
|
232
|
-
let locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en';
|
|
175
|
+
export function formatToDate(date, locale = 'en') {
|
|
233
176
|
if (!date) {
|
|
234
177
|
return '-';
|
|
235
178
|
}
|
|
236
|
-
return (
|
|
179
|
+
return dayjs(date).locale(formatLocale(locale)).format('ll');
|
|
237
180
|
}
|
|
238
|
-
function formatToDatetime(date) {
|
|
239
|
-
let locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en';
|
|
181
|
+
export function formatToDatetime(date, locale = 'en') {
|
|
240
182
|
if (!date) {
|
|
241
183
|
return '-';
|
|
242
184
|
}
|
|
243
|
-
return (
|
|
185
|
+
return dayjs(date).locale(formatLocale(locale)).format('lll');
|
|
244
186
|
}
|
|
245
|
-
function formatTime(date) {
|
|
246
|
-
let format = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'lll';
|
|
247
|
-
let locale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'en';
|
|
187
|
+
export function formatTime(date, format = 'lll', locale = 'en') {
|
|
248
188
|
if (!date) {
|
|
249
189
|
return '-';
|
|
250
190
|
}
|
|
251
|
-
return (
|
|
191
|
+
return dayjs(date).locale(formatLocale(locale)).format(format);
|
|
252
192
|
}
|
|
253
|
-
function formatDateTime(date) {
|
|
254
|
-
|
|
255
|
-
return (0, _dayjs.default)(date).locale(formatLocale(locale)).format('YYYY-MM-DD HH:mm');
|
|
193
|
+
export function formatDateTime(date, locale = 'en') {
|
|
194
|
+
return dayjs(date).locale(formatLocale(locale)).format('YYYY-MM-DD HH:mm');
|
|
256
195
|
}
|
|
257
|
-
const formatPrettyMsLocale = locale => locale === 'zh' ? 'zh_CN' : 'en_US';
|
|
258
|
-
|
|
259
|
-
const parseQuery = str => str.replace(/^\?/, '').split('&').map(x => x.split('=')).filter(_ref => {
|
|
260
|
-
let [key] = _ref;
|
|
261
|
-
return !!key;
|
|
262
|
-
}).reduce((memo, x) => {
|
|
196
|
+
export const formatPrettyMsLocale = locale => locale === 'zh' ? 'zh_CN' : 'en_US';
|
|
197
|
+
export const parseQuery = str => str.replace(/^\?/, '').split('&').map(x => x.split('=')).filter(([key]) => !!key).reduce((memo, x) => {
|
|
263
198
|
const key = x[0];
|
|
264
199
|
const value = decodeURIComponent(x[1]) || true;
|
|
265
200
|
memo[key] = value;
|
|
@@ -267,23 +202,18 @@ const parseQuery = str => str.replace(/^\?/, '').split('&').map(x => x.split('='
|
|
|
267
202
|
}, {});
|
|
268
203
|
|
|
269
204
|
// Append any query string url to api requests
|
|
270
|
-
|
|
271
|
-
const appendParams = exports.appendParams = function appendParams(url) {
|
|
272
|
-
let extraParams = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
205
|
+
export const appendParams = (url, extraParams = {}) => {
|
|
273
206
|
const [pathname, query = ''] = url.split('?');
|
|
274
207
|
const oldParams = parseQuery(query);
|
|
275
208
|
const params = Object.assign({}, oldParams, extraParams);
|
|
276
|
-
return
|
|
209
|
+
return `${pathname}?${qs.stringify(params)}`;
|
|
277
210
|
};
|
|
278
|
-
const isInstalling = status => ['waiting', 'downloading', 'installing', 'upgrading'].includes(status);
|
|
279
|
-
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
const isRunning = status => status === 'running';
|
|
283
|
-
exports.isRunning = isRunning;
|
|
284
|
-
const checkInputByType = (type, value) => {
|
|
211
|
+
export const isInstalling = status => ['waiting', 'downloading', 'installing', 'upgrading'].includes(status);
|
|
212
|
+
export const isDownloading = status => ['waiting', 'downloading'].includes(status);
|
|
213
|
+
export const isRunning = status => status === 'running';
|
|
214
|
+
export const checkInputByType = (type, value) => {
|
|
285
215
|
const typesMap = {
|
|
286
|
-
url:
|
|
216
|
+
url: isUrl
|
|
287
217
|
};
|
|
288
218
|
if (!type) {
|
|
289
219
|
return true;
|
|
@@ -293,10 +223,8 @@ const checkInputByType = (type, value) => {
|
|
|
293
223
|
}
|
|
294
224
|
return false;
|
|
295
225
|
};
|
|
296
|
-
|
|
297
|
-
const
|
|
298
|
-
exports.formatUrl = formatUrl;
|
|
299
|
-
const formatPerson = person => {
|
|
226
|
+
export const formatUrl = url => humanizeUrl(url.split('?').shift());
|
|
227
|
+
export const formatPerson = person => {
|
|
300
228
|
if (!person) {
|
|
301
229
|
return '-';
|
|
302
230
|
}
|
|
@@ -305,22 +233,20 @@ const formatPerson = person => {
|
|
|
305
233
|
}
|
|
306
234
|
const name = person.name || '';
|
|
307
235
|
const u = person.url || person.web;
|
|
308
|
-
const url = u ?
|
|
236
|
+
const url = u ? ` (${u})` : '';
|
|
309
237
|
const e = person.email || person.mail;
|
|
310
|
-
const email = e ?
|
|
238
|
+
const email = e ? ` <${e}>` : '';
|
|
311
239
|
return name + email + url;
|
|
312
240
|
};
|
|
313
|
-
|
|
314
|
-
const shouldCheckDomainStatus = domain => domain &&
|
|
241
|
+
export const shouldCheckDomainStatus = domain => domain &&
|
|
315
242
|
// eslint-disable-line
|
|
316
|
-
![
|
|
317
|
-
|
|
318
|
-
const checkIsWildcardDomain = url => {
|
|
243
|
+
![DOMAIN_FOR_IP_SITE, DOMAIN_FOR_IP_SITE_REGEXP, DOMAIN_FOR_DEFAULT_SITE, DOMAIN_FOR_INTERNAL_SITE].includes(domain);
|
|
244
|
+
export const checkIsWildcardDomain = url => {
|
|
319
245
|
try {
|
|
320
246
|
if (!url) {
|
|
321
247
|
return false;
|
|
322
248
|
}
|
|
323
|
-
const tempUrl = url.startsWith('http') ? url :
|
|
249
|
+
const tempUrl = url.startsWith('http') ? url : `http://${url}`;
|
|
324
250
|
const urlObj = new window.URL(tempUrl);
|
|
325
251
|
return decodeURIComponent(urlObj.host).split('.').some(x => x === '*');
|
|
326
252
|
} catch (error) {
|
|
@@ -328,10 +254,7 @@ const checkIsWildcardDomain = url => {
|
|
|
328
254
|
return false;
|
|
329
255
|
}
|
|
330
256
|
};
|
|
331
|
-
|
|
332
|
-
const stringSortHandlerAsc = exports.stringSortHandlerAsc = function stringSortHandlerAsc() {
|
|
333
|
-
let strA = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
334
|
-
let strB = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
257
|
+
export const stringSortHandlerAsc = (strA = '', strB = '') => {
|
|
335
258
|
if (strA > strB) {
|
|
336
259
|
return 1;
|
|
337
260
|
}
|
|
@@ -340,63 +263,55 @@ const stringSortHandlerAsc = exports.stringSortHandlerAsc = function stringSortH
|
|
|
340
263
|
}
|
|
341
264
|
return 0;
|
|
342
265
|
};
|
|
343
|
-
const getInviteLink =
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
} = _ref2;
|
|
266
|
+
export const getInviteLink = ({
|
|
267
|
+
inviteId,
|
|
268
|
+
endpoint
|
|
269
|
+
}) => {
|
|
348
270
|
if (!endpoint) {
|
|
349
271
|
return '';
|
|
350
272
|
}
|
|
351
273
|
const u = new URL(endpoint);
|
|
352
|
-
u.pathname = (
|
|
274
|
+
u.pathname = joinUrl(u.pathname, WELLKNOWN_SERVICE_PATH_PREFIX, 'invite');
|
|
353
275
|
u.searchParams.set('inviteId', inviteId);
|
|
354
276
|
return u.href;
|
|
355
277
|
};
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
endpoint
|
|
361
|
-
} = _ref3;
|
|
278
|
+
export const getTransferAppLink = ({
|
|
279
|
+
transferId,
|
|
280
|
+
endpoint
|
|
281
|
+
}) => {
|
|
362
282
|
if (!endpoint) {
|
|
363
283
|
return '';
|
|
364
284
|
}
|
|
365
285
|
const u = new URL(endpoint);
|
|
366
|
-
u.pathname = (
|
|
286
|
+
u.pathname = joinUrl(u.pathname, WELLKNOWN_SERVICE_PATH_PREFIX, 'transfer');
|
|
367
287
|
u.searchParams.set('transferId', transferId);
|
|
368
288
|
return u.href;
|
|
369
289
|
};
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
endpoint
|
|
375
|
-
} = _ref4;
|
|
290
|
+
export const getIssuePassportLink = ({
|
|
291
|
+
id,
|
|
292
|
+
endpoint
|
|
293
|
+
}) => {
|
|
376
294
|
if (!endpoint) {
|
|
377
295
|
return '';
|
|
378
296
|
}
|
|
379
297
|
const u = new URL(endpoint);
|
|
380
|
-
u.pathname = (
|
|
298
|
+
u.pathname = joinUrl(u.pathname, WELLKNOWN_SERVICE_PATH_PREFIX, 'issue-passport');
|
|
381
299
|
u.searchParams.set('id', id);
|
|
382
300
|
return u.href;
|
|
383
301
|
};
|
|
384
|
-
|
|
385
|
-
const formatRegistryScreenshotPath = (did, asset) => {
|
|
302
|
+
export const formatRegistryScreenshotPath = (did, asset) => {
|
|
386
303
|
if (asset.startsWith('/assets')) {
|
|
387
304
|
return asset;
|
|
388
305
|
}
|
|
389
|
-
return
|
|
306
|
+
return `/assets/${did}/screenshots/${asset}`;
|
|
390
307
|
};
|
|
391
|
-
|
|
392
|
-
const formatRegistryLogoPath = (did, asset) => {
|
|
308
|
+
export const formatRegistryLogoPath = (did, asset) => {
|
|
393
309
|
if (asset.startsWith('/assets')) {
|
|
394
310
|
return asset;
|
|
395
311
|
}
|
|
396
|
-
return
|
|
312
|
+
return `/assets/${did}/${asset}`;
|
|
397
313
|
};
|
|
398
|
-
|
|
399
|
-
function getWebWalletUrl(info) {
|
|
314
|
+
export function getWebWalletUrl(info) {
|
|
400
315
|
try {
|
|
401
316
|
const url = window.localStorage.getItem('wallet_url');
|
|
402
317
|
if (url) {
|
|
@@ -405,9 +320,9 @@ function getWebWalletUrl(info) {
|
|
|
405
320
|
} catch (err) {
|
|
406
321
|
// Do nothing
|
|
407
322
|
}
|
|
408
|
-
return info && info.webWalletUrl ? info.webWalletUrl :
|
|
323
|
+
return info && info.webWalletUrl ? info.webWalletUrl : WEB_WALLET_URL;
|
|
409
324
|
}
|
|
410
|
-
function isValidClusterSize(data) {
|
|
325
|
+
export function isValidClusterSize(data) {
|
|
411
326
|
const {
|
|
412
327
|
value,
|
|
413
328
|
cpuCores
|
|
@@ -423,72 +338,64 @@ function isValidClusterSize(data) {
|
|
|
423
338
|
return 'Cluster size should be integer';
|
|
424
339
|
}
|
|
425
340
|
if (v <= 0 || v > cpuCores) {
|
|
426
|
-
return
|
|
341
|
+
return `Cluster size should between 1 to ${cpuCores}`;
|
|
427
342
|
}
|
|
428
343
|
return '';
|
|
429
344
|
}
|
|
430
|
-
function isProtectedRole(role) {
|
|
431
|
-
return Object.values(
|
|
345
|
+
export function isProtectedRole(role) {
|
|
346
|
+
return Object.values(ROLES).includes(role);
|
|
432
347
|
}
|
|
433
|
-
function formatFactoryPrice(blocklet) {
|
|
434
|
-
|
|
435
|
-
if (!(blocklet !== null && blocklet !== void 0 && blocklet.payment)) {
|
|
348
|
+
export function formatFactoryPrice(blocklet) {
|
|
349
|
+
if (!blocklet?.payment) {
|
|
436
350
|
return [];
|
|
437
351
|
}
|
|
438
|
-
const list = (
|
|
352
|
+
const list = (blocklet.payment?.price || []).map(item => ({
|
|
439
353
|
name: item.symbol,
|
|
440
354
|
value: item.value
|
|
441
355
|
}));
|
|
442
356
|
return list;
|
|
443
357
|
}
|
|
444
|
-
const getBlockletLogoUrl =
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
} = _ref5;
|
|
358
|
+
export const getBlockletLogoUrl = ({
|
|
359
|
+
did,
|
|
360
|
+
baseUrl,
|
|
361
|
+
logoPath
|
|
362
|
+
}) => {
|
|
450
363
|
if (logoPath && logoPath.startsWith('http')) {
|
|
451
364
|
return logoPath;
|
|
452
365
|
}
|
|
453
366
|
if (baseUrl.startsWith('http') && logoPath) {
|
|
454
|
-
return (
|
|
367
|
+
return joinUrl(baseUrl, formatRegistryLogoPath(did, logoPath));
|
|
455
368
|
}
|
|
456
369
|
const prefix = window.env.apiPrefix || '/';
|
|
457
370
|
let apiPrefix = prefix.replace(/^\/+/, '').replace(/\/+$/, '');
|
|
458
371
|
if (apiPrefix) {
|
|
459
|
-
apiPrefix =
|
|
372
|
+
apiPrefix = `/${apiPrefix}`;
|
|
460
373
|
}
|
|
461
|
-
return (
|
|
374
|
+
return joinUrl(apiPrefix, `/blocklet/logo/${did}`);
|
|
462
375
|
};
|
|
463
|
-
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
const isUrlAccessible = url => (0, _checkAccessibleBrowser.default)((0, _urlJoin.default)(new URL(url).origin, _constant.WELLKNOWN_PING_PREFIX));
|
|
467
|
-
exports.isUrlAccessible = isUrlAccessible;
|
|
468
|
-
const checkBlockletAccessible = async function checkBlockletAccessible(url) {
|
|
469
|
-
let timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 5000;
|
|
376
|
+
export const getPathPrefix = () => window.env && window.env.apiPrefix ? window.env.apiPrefix : '/';
|
|
377
|
+
export const isUrlAccessible = url => checkAccessible(joinUrl(new URL(url).origin, WELLKNOWN_PING_PREFIX));
|
|
378
|
+
const checkBlockletAccessible = async (url, timeout = 5000) => {
|
|
470
379
|
try {
|
|
471
|
-
var _response$data;
|
|
472
380
|
const urlObj = new URL(url);
|
|
473
381
|
urlObj.protocol = 'https';
|
|
474
|
-
urlObj.pathname = (
|
|
475
|
-
const response = await
|
|
382
|
+
urlObj.pathname = joinUrl(WELLKNOWN_BLOCKLET_HEALTH_PATH);
|
|
383
|
+
const response = await axios.get(urlObj.toString(), {
|
|
476
384
|
timeout,
|
|
477
385
|
validateStatus: status => {
|
|
478
386
|
return status >= 200 && status < 400 || status === 503; // 503 是 not running, 可以访问 blocklet service
|
|
479
387
|
}
|
|
480
388
|
});
|
|
481
|
-
return !!
|
|
389
|
+
return !!response?.data?.message;
|
|
482
390
|
} catch (error) {
|
|
483
391
|
console.error(error);
|
|
484
392
|
return false;
|
|
485
393
|
}
|
|
486
394
|
};
|
|
487
|
-
const waitingForAccessible = async
|
|
488
|
-
let timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 30 * 1000;
|
|
395
|
+
const waitingForAccessible = async (urls, timeout = 30 * 1000) => {
|
|
489
396
|
const tasks = await urls.map(async url => {
|
|
490
397
|
try {
|
|
491
|
-
await (
|
|
398
|
+
await tryWithTimeout(async () => {
|
|
492
399
|
let accessible = false;
|
|
493
400
|
do {
|
|
494
401
|
/* eslint-disable no-await-in-loop */
|
|
@@ -502,10 +409,10 @@ const waitingForAccessible = async function waitingForAccessible(urls) {
|
|
|
502
409
|
});
|
|
503
410
|
await Promise.all(tasks);
|
|
504
411
|
};
|
|
505
|
-
const getAccessibleUrl = async urls => {
|
|
412
|
+
export const getAccessibleUrl = async urls => {
|
|
506
413
|
try {
|
|
507
414
|
await waitingForAccessible(urls);
|
|
508
|
-
const res = await
|
|
415
|
+
const res = await evaluateURLs(urls, {
|
|
509
416
|
checkAccessible: checkBlockletAccessible
|
|
510
417
|
});
|
|
511
418
|
return res[0].url;
|
|
@@ -521,14 +428,11 @@ const getAccessibleUrl = async urls => {
|
|
|
521
428
|
* @param {object[]} matchedSites - 通过 certificate#matchedSites 获取到的一组 site
|
|
522
429
|
* @returns {boolean} - 匹配则返回 true
|
|
523
430
|
*/
|
|
524
|
-
|
|
525
|
-
const isCertificateMatch = exports.isCertificateMatch = function isCertificateMatch() {
|
|
526
|
-
let blockletUrls = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
527
|
-
let matchedSites = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
431
|
+
export const isCertificateMatch = (blockletUrls = [], matchedSites = []) => {
|
|
528
432
|
try {
|
|
529
433
|
return matchedSites.map(item => item.domain).some(domain => {
|
|
530
434
|
return blockletUrls.some(u => {
|
|
531
|
-
const url = new window.URL(u.startsWith('http') ? u :
|
|
435
|
+
const url = new window.URL(u.startsWith('http') ? u : `http://${u}`);
|
|
532
436
|
return url.hostname === domain;
|
|
533
437
|
});
|
|
534
438
|
});
|
|
@@ -537,7 +441,7 @@ const isCertificateMatch = exports.isCertificateMatch = function isCertificateMa
|
|
|
537
441
|
return false;
|
|
538
442
|
}
|
|
539
443
|
};
|
|
540
|
-
const getBlockletUrlParams = (blocklet, locale) => (blocklet || {}).status === 'running' ? {
|
|
444
|
+
export const getBlockletUrlParams = (blocklet, locale) => (blocklet || {}).status === 'running' ? {
|
|
541
445
|
locale
|
|
542
446
|
} : {
|
|
543
447
|
locale,
|
|
@@ -552,13 +456,10 @@ const getBlockletUrlParams = (blocklet, locale) => (blocklet || {}).status === '
|
|
|
552
456
|
* @param {String} ua userAgent 字符串
|
|
553
457
|
* @returns bool
|
|
554
458
|
*/
|
|
555
|
-
|
|
556
|
-
const isSafari = exports.isSafari = function isSafari() {
|
|
557
|
-
let ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.navigator.userAgent;
|
|
459
|
+
export const isSafari = (ua = window.navigator.userAgent) => {
|
|
558
460
|
return ua.includes('iPhone') || ua.includes('Safari') && !ua.includes('Chrome');
|
|
559
461
|
};
|
|
560
|
-
const isChrome =
|
|
561
|
-
let ua = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window.navigator.userAgent;
|
|
462
|
+
export const isChrome = (ua = window.navigator.userAgent) => {
|
|
562
463
|
return ua.includes('Chrome');
|
|
563
464
|
};
|
|
564
465
|
|
|
@@ -568,7 +469,7 @@ const isChrome = exports.isChrome = function isChrome() {
|
|
|
568
469
|
* @param {string} url
|
|
569
470
|
* @return {string}
|
|
570
471
|
*/
|
|
571
|
-
function deepDecodeURIComponent(url) {
|
|
472
|
+
export function deepDecodeURIComponent(url) {
|
|
572
473
|
let lastDecodeUrl = decodeURIComponent(url);
|
|
573
474
|
while (lastDecodeUrl !== decodeURIComponent(lastDecodeUrl)) {
|
|
574
475
|
lastDecodeUrl = decodeURIComponent(lastDecodeUrl);
|
|
@@ -586,23 +487,36 @@ function deepDecodeURIComponent(url) {
|
|
|
586
487
|
* token: string;
|
|
587
488
|
* }}
|
|
588
489
|
*/
|
|
589
|
-
function extractStatusUrlFromNextWorkflow(nextWorkflow) {
|
|
490
|
+
export function extractStatusUrlFromNextWorkflow(nextWorkflow) {
|
|
590
491
|
const nextWorkflowURL = new URL(deepDecodeURIComponent(nextWorkflow)).searchParams.get('url');
|
|
591
492
|
return {
|
|
592
493
|
statusUrl: nextWorkflowURL.replace('/auth?', '/status?'),
|
|
593
494
|
token: new URL(nextWorkflowURL).searchParams.get('_t_')
|
|
594
495
|
};
|
|
595
496
|
}
|
|
596
|
-
function getBlockletMetaUrl(storeUrl, did, dist) {
|
|
497
|
+
export function getBlockletMetaUrl(storeUrl, did, dist) {
|
|
597
498
|
let origin = storeUrl;
|
|
598
|
-
if (!origin && dist
|
|
499
|
+
if (!origin && dist?.tarball) {
|
|
599
500
|
origin = new URL(dist.tarball).origin;
|
|
600
501
|
}
|
|
601
|
-
return (
|
|
502
|
+
return joinUrl(origin, BLOCKLET_STORE_API_PREFIX, `/blocklets/${did}/blocklet.json`);
|
|
602
503
|
}
|
|
603
|
-
async function getAsset(chainHost, address) {
|
|
604
|
-
const result = await
|
|
605
|
-
query:
|
|
504
|
+
export async function getAsset(chainHost, address) {
|
|
505
|
+
const result = await axios.post(joinUrl(chainHost, '/api/gql/'), JSON.stringify({
|
|
506
|
+
query: `{
|
|
507
|
+
getAssetState(address: "${address}") {
|
|
508
|
+
state {
|
|
509
|
+
address
|
|
510
|
+
data {
|
|
511
|
+
typeUrl
|
|
512
|
+
value
|
|
513
|
+
}
|
|
514
|
+
issuer
|
|
515
|
+
owner
|
|
516
|
+
parent
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}`
|
|
606
520
|
}), {
|
|
607
521
|
headers: {
|
|
608
522
|
'Content-Type': 'application/json',
|
|
@@ -610,7 +524,7 @@ async function getAsset(chainHost, address) {
|
|
|
610
524
|
},
|
|
611
525
|
timeout: 60 * 1000
|
|
612
526
|
});
|
|
613
|
-
const state = (
|
|
527
|
+
const state = get(result.data, 'data.getAssetState.state');
|
|
614
528
|
if (state && state.data.typeUrl === 'json') {
|
|
615
529
|
state.data.value = JSON.parse(state.data.value);
|
|
616
530
|
}
|
|
@@ -626,22 +540,22 @@ async function getAsset(chainHost, address) {
|
|
|
626
540
|
* decoded: string;
|
|
627
541
|
* })} - 返回判断是否是新的url和解码后的url
|
|
628
542
|
*/
|
|
629
|
-
const isNewStoreUrl = (url, storeList) => {
|
|
543
|
+
export const isNewStoreUrl = (url, storeList) => {
|
|
630
544
|
if (typeof url === 'string') {
|
|
631
|
-
let decoded = decodeURIComponent(url
|
|
545
|
+
let decoded = decodeURIComponent(url?.trim());
|
|
632
546
|
const regex = /^https?:\/\//;
|
|
633
547
|
if (!regex.test(decoded)) {
|
|
634
|
-
decoded =
|
|
548
|
+
decoded = `https://${decoded}`;
|
|
635
549
|
}
|
|
636
|
-
decoded = (
|
|
550
|
+
decoded = trimEnd(decoded, '/');
|
|
637
551
|
|
|
638
552
|
// validate
|
|
639
553
|
try {
|
|
640
554
|
new URL(decoded); // eslint-disable-line no-new
|
|
641
|
-
} catch
|
|
555
|
+
} catch {
|
|
642
556
|
throw new Error('Invalid Blocklet Store URL');
|
|
643
557
|
}
|
|
644
|
-
if (storeList
|
|
558
|
+
if (storeList?.some(item => [url, decoded].includes(item.url))) {
|
|
645
559
|
return {
|
|
646
560
|
isNew: false,
|
|
647
561
|
decoded
|
|
@@ -657,44 +571,38 @@ const isNewStoreUrl = (url, storeList) => {
|
|
|
657
571
|
decoded: ''
|
|
658
572
|
};
|
|
659
573
|
};
|
|
660
|
-
|
|
661
|
-
const
|
|
662
|
-
|
|
663
|
-
const
|
|
664
|
-
|
|
665
|
-
const toSlotDomain = domain => {
|
|
666
|
-
if (domain.endsWith(_constant.DEFAULT_IP_DOMAIN_SUFFIX)) {
|
|
574
|
+
export const isBlockletDev = blocklet => blocklet.mode === BLOCKLET_MODES.DEVELOPMENT;
|
|
575
|
+
export const APP_PREFIX = window.env?.groupPathPrefix || '/';
|
|
576
|
+
export const BlockletAdminRoles = [ROLES.ADMIN, ROLES.OWNER];
|
|
577
|
+
export const toSlotDomain = domain => {
|
|
578
|
+
if (domain.endsWith(DEFAULT_IP_DOMAIN_SUFFIX)) {
|
|
667
579
|
const subDomain = domain.split('.').shift();
|
|
668
|
-
const matches = subDomain.match(
|
|
580
|
+
const matches = subDomain.match(IP);
|
|
669
581
|
if (matches) {
|
|
670
|
-
return domain.replace(matches[0].slice(1),
|
|
582
|
+
return domain.replace(matches[0].slice(1), SLOT_FOR_IP_DNS_SITE);
|
|
671
583
|
}
|
|
672
584
|
}
|
|
673
585
|
return domain;
|
|
674
586
|
};
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
} = _ref6;
|
|
683
|
-
const teamDid = fromBlocklet ? blocklet === null || blocklet === void 0 || (_blocklet$meta = blocklet.meta) === null || _blocklet$meta === void 0 ? void 0 : _blocklet$meta.did : nodeInfo === null || nodeInfo === void 0 ? void 0 : nodeInfo.did;
|
|
684
|
-
const storeList = fromBlocklet ? (blocklet === null || blocklet === void 0 || (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.storeList) || [] : (nodeInfo === null || nodeInfo === void 0 ? void 0 : nodeInfo.blockletRegistryList) || [];
|
|
587
|
+
export const getStoreList = ({
|
|
588
|
+
fromBlocklet,
|
|
589
|
+
nodeInfo,
|
|
590
|
+
blocklet
|
|
591
|
+
}) => {
|
|
592
|
+
const teamDid = fromBlocklet ? blocklet?.meta?.did : nodeInfo?.did;
|
|
593
|
+
const storeList = fromBlocklet ? blocklet?.settings?.storeList || [] : nodeInfo?.blockletRegistryList || [];
|
|
685
594
|
return {
|
|
686
595
|
teamDid,
|
|
687
596
|
storeList
|
|
688
597
|
};
|
|
689
598
|
};
|
|
690
|
-
exports.getStoreList = getStoreList;
|
|
691
599
|
const isDidDomainOrIpEchoDomain = domain => {
|
|
692
600
|
if (!domain) {
|
|
693
601
|
return false;
|
|
694
602
|
}
|
|
695
|
-
return domain.endsWith(
|
|
603
|
+
return domain.endsWith(DEFAULT_DID_DOMAIN) || domain.endsWith(DEFAULT_IP_DOMAIN_SUFFIX) || domain.endsWith(DEFAULT_SLP_DOMAIN);
|
|
696
604
|
};
|
|
697
|
-
const sortDomains = domains => {
|
|
605
|
+
export const sortDomains = domains => {
|
|
698
606
|
return (domains || []).sort((x, y) => {
|
|
699
607
|
if (isDidDomainOrIpEchoDomain(x.value) && isDidDomainOrIpEchoDomain(y.value)) {
|
|
700
608
|
return 0;
|
|
@@ -708,93 +616,76 @@ const sortDomains = domains => {
|
|
|
708
616
|
return 1;
|
|
709
617
|
});
|
|
710
618
|
};
|
|
711
|
-
|
|
712
|
-
const formatMountPoint = value => (0, _normalizePathPrefix.default)((0, _urlPathFriendly.default)(value));
|
|
713
|
-
exports.formatMountPoint = formatMountPoint;
|
|
619
|
+
export const formatMountPoint = value => normalizePathPrefix(urlPathFriendly(value));
|
|
714
620
|
const getLauncherBaseURL = async launcherUrl => {
|
|
715
621
|
if (!launcherUrl) {
|
|
716
622
|
return '';
|
|
717
623
|
}
|
|
718
624
|
let baseUrl = launcherUrl;
|
|
719
625
|
try {
|
|
720
|
-
var _appMeta$componentMou;
|
|
721
626
|
const {
|
|
722
627
|
data: appMeta
|
|
723
|
-
} = await
|
|
628
|
+
} = await axios.get(joinUrl(launcherUrl, '__blocklet__.js?type=json'), {
|
|
724
629
|
timeout: 5000
|
|
725
630
|
});
|
|
726
|
-
const mountPoint =
|
|
631
|
+
const mountPoint = appMeta.componentMountPoints?.find(item => item.did === 'z8iZkFBbrVQxZHvcWWB3Sa2TrfGmSeFz9MSU7');
|
|
727
632
|
const launcherUrlObj = new URL(launcherUrl);
|
|
728
|
-
baseUrl = (
|
|
633
|
+
baseUrl = joinUrl(launcherUrlObj.origin, mountPoint?.mountPoint);
|
|
729
634
|
} catch (error) {
|
|
730
635
|
console.error(error);
|
|
731
636
|
}
|
|
732
637
|
return baseUrl;
|
|
733
638
|
};
|
|
734
|
-
const getSubscriptionURL = async
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
} = _ref7;
|
|
639
|
+
export const getSubscriptionURL = async ({
|
|
640
|
+
launcherUrl = '',
|
|
641
|
+
nftId = '',
|
|
642
|
+
locale = 'en'
|
|
643
|
+
}) => {
|
|
740
644
|
if (!launcherUrl) {
|
|
741
645
|
return '';
|
|
742
646
|
}
|
|
743
|
-
let baseUrl = (
|
|
647
|
+
let baseUrl = joinUrl(launcherUrl, '/instances');
|
|
744
648
|
try {
|
|
745
|
-
var _appMeta$componentMou2;
|
|
746
649
|
const {
|
|
747
650
|
data: appMeta
|
|
748
|
-
} = await
|
|
651
|
+
} = await axios.get(joinUrl(launcherUrl, '__blocklet__.js?type=json'), {
|
|
749
652
|
timeout: 5000
|
|
750
653
|
});
|
|
751
|
-
const mountPoint =
|
|
654
|
+
const mountPoint = appMeta.componentMountPoints?.find(item => item.did === 'z8iZy4P83i6AgnNdNUexsh2kBcsDHoqcwPavn');
|
|
752
655
|
const launcherUrlObj = new URL(launcherUrl);
|
|
753
|
-
baseUrl = (
|
|
656
|
+
baseUrl = joinUrl(launcherUrlObj.origin, mountPoint?.mountPoint, '/nfts');
|
|
754
657
|
} catch (error) {
|
|
755
658
|
console.error(error);
|
|
756
659
|
}
|
|
757
|
-
return (
|
|
660
|
+
return joinUrl(baseUrl, `/${nftId}/subscription?locale=${locale}&return-url=${encodeURIComponent(window.location.href)}`);
|
|
758
661
|
};
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
locale = 'en'
|
|
766
|
-
} = _ref8;
|
|
662
|
+
export const getSubscriptionUrlV2 = async ({
|
|
663
|
+
launcherUrl = '',
|
|
664
|
+
launcherSessionId = '',
|
|
665
|
+
nftDid,
|
|
666
|
+
locale = 'en'
|
|
667
|
+
}) => {
|
|
767
668
|
if (!launcherUrl) {
|
|
768
669
|
return '';
|
|
769
670
|
}
|
|
770
671
|
const baseUrl = await getLauncherBaseURL(launcherUrl);
|
|
771
|
-
return (
|
|
672
|
+
return joinUrl(baseUrl, `/embed/subscription?launcherSessionId=${launcherSessionId}&nftDid=${nftDid}&locale=${locale}`); // nftDid 是兼容字段
|
|
772
673
|
};
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
locale = 'en'
|
|
779
|
-
} = _ref9;
|
|
674
|
+
export const getManageSubscriptionURL = async ({
|
|
675
|
+
launcherUrl = '',
|
|
676
|
+
launcherSessionId = '',
|
|
677
|
+
locale = 'en'
|
|
678
|
+
}) => {
|
|
780
679
|
if (!launcherUrl) {
|
|
781
680
|
return '';
|
|
782
681
|
}
|
|
783
682
|
const baseUrl = await getLauncherBaseURL(launcherUrl);
|
|
784
|
-
return (
|
|
683
|
+
return joinUrl(baseUrl, `/embed/manage-subscription?launcherSessionId=${launcherSessionId}&locale=${locale}`);
|
|
785
684
|
};
|
|
786
|
-
|
|
787
|
-
const
|
|
788
|
-
|
|
789
|
-
return [...Array(length)].map(() => Math.random().toString(36)[2]).join('');
|
|
790
|
-
};
|
|
791
|
-
const getSystemDomains = domains => domains.filter(x => x.isProtected);
|
|
792
|
-
exports.getSystemDomains = getSystemDomains;
|
|
793
|
-
const getLogoHash = logo => encodeURIComponent((logo || '').split('/').slice(-1)[0].slice(0, 7));
|
|
794
|
-
exports.getLogoHash = getLogoHash;
|
|
685
|
+
export const nanoid = (length = 16) => [...Array(length)].map(() => Math.random().toString(36)[2]).join('');
|
|
686
|
+
export const getSystemDomains = domains => domains.filter(x => x.isProtected);
|
|
687
|
+
export const getLogoHash = logo => encodeURIComponent((logo || '').split('/').slice(-1)[0].slice(0, 7));
|
|
795
688
|
const hasRequiredEnvironments = meta => (meta.environments || []).some(x => x.required);
|
|
796
|
-
const hasRequiredSteps = meta => {
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
};
|
|
800
|
-
exports.hasRequiredSteps = hasRequiredSteps;
|
|
689
|
+
export const hasRequiredSteps = meta => {
|
|
690
|
+
return !!meta.requirements?.fuels?.length || hasRequiredEnvironments(meta);
|
|
691
|
+
};
|