@chipmobilesdk/rn-notification 0.6.0 → 0.7.0
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 +111 -0
- package/README.md +8 -6
- package/lib/commonjs/advanced.js +139 -0
- package/lib/commonjs/advanced.js.map +1 -0
- package/lib/commonjs/channel/migrate.js +246 -0
- package/lib/commonjs/channel/migrate.js.map +1 -0
- package/lib/commonjs/channel/tone-map.js +120 -0
- package/lib/commonjs/channel/tone-map.js.map +1 -0
- package/lib/commonjs/channel/validate-tone.js +61 -0
- package/lib/commonjs/channel/validate-tone.js.map +1 -0
- package/lib/commonjs/contract/channel.js +52 -0
- package/lib/commonjs/contract/channel.js.map +1 -0
- package/lib/commonjs/contract/diagnostics.js +25 -0
- package/lib/commonjs/contract/diagnostics.js.map +1 -0
- package/lib/commonjs/contract/errors.js +126 -0
- package/lib/commonjs/contract/errors.js.map +1 -0
- package/lib/commonjs/contract/hash.js +35 -0
- package/lib/commonjs/contract/hash.js.map +1 -0
- package/lib/commonjs/contract/index.js +94 -0
- package/lib/commonjs/contract/index.js.map +1 -0
- package/lib/commonjs/contract/interaction.js +37 -0
- package/lib/commonjs/contract/interaction.js.map +1 -0
- package/lib/commonjs/contract/notification.js +42 -0
- package/lib/commonjs/contract/notification.js.map +1 -0
- package/lib/commonjs/contract/permission.js +2 -0
- package/lib/commonjs/contract/permission.js.map +1 -0
- package/lib/commonjs/contract/reconcile.js +6 -0
- package/lib/commonjs/contract/reconcile.js.map +1 -0
- package/lib/commonjs/contract/recurrence.js +53 -0
- package/lib/commonjs/contract/recurrence.js.map +1 -0
- package/lib/commonjs/diagnostics/burst.js +89 -0
- package/lib/commonjs/diagnostics/burst.js.map +1 -0
- package/lib/commonjs/diagnostics/events.js +63 -0
- package/lib/commonjs/diagnostics/events.js.map +1 -0
- package/lib/commonjs/diagnostics/redact.js +48 -0
- package/lib/commonjs/diagnostics/redact.js.map +1 -0
- package/lib/commonjs/diagnostics/snapshot.js +68 -0
- package/lib/commonjs/diagnostics/snapshot.js.map +1 -0
- package/lib/commonjs/engine/adapter.js +6 -0
- package/lib/commonjs/engine/adapter.js.map +1 -0
- package/lib/commonjs/engine/codec.js +84 -0
- package/lib/commonjs/engine/codec.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/events.js +148 -0
- package/lib/commonjs/engine/notify-kit/events.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/module.js +119 -0
- package/lib/commonjs/engine/notify-kit/module.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/platform/android.js +159 -0
- package/lib/commonjs/engine/notify-kit/platform/android.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/platform/index.js +57 -0
- package/lib/commonjs/engine/notify-kit/platform/index.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/platform/ios.js +54 -0
- package/lib/commonjs/engine/notify-kit/platform/ios.js.map +1 -0
- package/lib/commonjs/engine/notify-kit/platform/types.js +6 -0
- package/lib/commonjs/engine/notify-kit/platform/types.js.map +1 -0
- package/lib/commonjs/engine/notify-kit-engine.js +260 -0
- package/lib/commonjs/engine/notify-kit-engine.js.map +1 -0
- package/lib/commonjs/index.js +367 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/initialize.js +187 -0
- package/lib/commonjs/initialize.js.map +1 -0
- package/lib/commonjs/interaction/index.js +120 -0
- package/lib/commonjs/interaction/index.js.map +1 -0
- package/lib/commonjs/maintenance/cycle.js +108 -0
- package/lib/commonjs/maintenance/cycle.js.map +1 -0
- package/lib/commonjs/maintenance/permission-refresh.js +39 -0
- package/lib/commonjs/maintenance/permission-refresh.js.map +1 -0
- package/lib/commonjs/maintenance/reanchor.js +99 -0
- package/lib/commonjs/maintenance/reanchor.js.map +1 -0
- package/lib/commonjs/maintenance/toggle.js +50 -0
- package/lib/commonjs/maintenance/toggle.js.map +1 -0
- package/lib/commonjs/maintenance/verify.js +70 -0
- package/lib/commonjs/maintenance/verify.js.map +1 -0
- package/lib/commonjs/maintenance/window-refresh.js +53 -0
- package/lib/commonjs/maintenance/window-refresh.js.map +1 -0
- package/lib/commonjs/notifications.js +161 -0
- package/lib/commonjs/notifications.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/permission/index.js +182 -0
- package/lib/commonjs/permission/index.js.map +1 -0
- package/lib/commonjs/permission/state.js +92 -0
- package/lib/commonjs/permission/state.js.map +1 -0
- package/lib/commonjs/push/envelope.js +141 -0
- package/lib/commonjs/push/envelope.js.map +1 -0
- package/lib/commonjs/push/fcm-provider.js +122 -0
- package/lib/commonjs/push/fcm-provider.js.map +1 -0
- package/lib/commonjs/push/gate.js +162 -0
- package/lib/commonjs/push/gate.js.map +1 -0
- package/lib/commonjs/push/index.js +47 -0
- package/lib/commonjs/push/index.js.map +1 -0
- package/lib/commonjs/push/instructions.js +101 -0
- package/lib/commonjs/push/instructions.js.map +1 -0
- package/lib/commonjs/push/provider-adapter.js +6 -0
- package/lib/commonjs/push/provider-adapter.js.map +1 -0
- package/lib/commonjs/push/signout.js +55 -0
- package/lib/commonjs/push/signout.js.map +1 -0
- package/lib/commonjs/reconcile/chunk.js +49 -0
- package/lib/commonjs/reconcile/chunk.js.map +1 -0
- package/lib/commonjs/reconcile/diff.js +105 -0
- package/lib/commonjs/reconcile/diff.js.map +1 -0
- package/lib/commonjs/reconcile/duplicates.js +60 -0
- package/lib/commonjs/reconcile/duplicates.js.map +1 -0
- package/lib/commonjs/reconcile/index.js +164 -0
- package/lib/commonjs/reconcile/index.js.map +1 -0
- package/lib/commonjs/reconcile/truncate.js +50 -0
- package/lib/commonjs/reconcile/truncate.js.map +1 -0
- package/lib/commonjs/recurrence/clock-guard.js +65 -0
- package/lib/commonjs/recurrence/clock-guard.js.map +1 -0
- package/lib/commonjs/recurrence/expand.js +254 -0
- package/lib/commonjs/recurrence/expand.js.map +1 -0
- package/lib/commonjs/recurrence/index.js +212 -0
- package/lib/commonjs/recurrence/index.js.map +1 -0
- package/lib/commonjs/repeat/expiry.js +41 -0
- package/lib/commonjs/repeat/expiry.js.map +1 -0
- package/lib/commonjs/repeat/index.js +100 -0
- package/lib/commonjs/repeat/index.js.map +1 -0
- package/lib/commonjs/repeat/marker.js +58 -0
- package/lib/commonjs/repeat/marker.js.map +1 -0
- package/lib/commonjs/repeat/place.js +83 -0
- package/lib/commonjs/repeat/place.js.map +1 -0
- package/lib/commonjs/schedule/anchor.js +243 -0
- package/lib/commonjs/schedule/anchor.js.map +1 -0
- package/lib/commonjs/schedule/index.js +142 -0
- package/lib/commonjs/schedule/index.js.map +1 -0
- package/lib/commonjs/schedule/partition.js +59 -0
- package/lib/commonjs/schedule/partition.js.map +1 -0
- package/lib/commonjs/schedule/resolve-moment.js +72 -0
- package/lib/commonjs/schedule/resolve-moment.js.map +1 -0
- package/lib/commonjs/schedule/validate-content.js +101 -0
- package/lib/commonjs/schedule/validate-content.js.map +1 -0
- package/lib/commonjs/schedule/validate-identifier.js +126 -0
- package/lib/commonjs/schedule/validate-identifier.js.map +1 -0
- package/lib/commonjs/schedule/writer.js +44 -0
- package/lib/commonjs/schedule/writer.js.map +1 -0
- package/lib/commonjs/state/caps.js +101 -0
- package/lib/commonjs/state/caps.js.map +1 -0
- package/lib/commonjs/state/dedup-ledger.js +39 -0
- package/lib/commonjs/state/dedup-ledger.js.map +1 -0
- package/lib/commonjs/state/interaction-buffer.js +98 -0
- package/lib/commonjs/state/interaction-buffer.js.map +1 -0
- package/lib/commonjs/state/mmkv-store.js +75 -0
- package/lib/commonjs/state/mmkv-store.js.map +1 -0
- package/lib/commonjs/state/permission-history.js +64 -0
- package/lib/commonjs/state/permission-history.js.map +1 -0
- package/lib/commonjs/state/record.js +269 -0
- package/lib/commonjs/state/record.js.map +1 -0
- package/lib/commonjs/state/reset.js +37 -0
- package/lib/commonjs/state/reset.js.map +1 -0
- package/lib/commonjs/state/series-ledger.js +71 -0
- package/lib/commonjs/state/series-ledger.js.map +1 -0
- package/lib/commonjs/state/store.js +39 -0
- package/lib/commonjs/state/store.js.map +1 -0
- package/lib/commonjs/testing/conformance/index.js +218 -0
- package/lib/commonjs/testing/conformance/index.js.map +1 -0
- package/lib/commonjs/testing/fake-engine.js +338 -0
- package/lib/commonjs/testing/fake-engine.js.map +1 -0
- package/lib/commonjs/testing/fake-provider.js +93 -0
- package/lib/commonjs/testing/fake-provider.js.map +1 -0
- package/lib/commonjs/testing/faults.js +59 -0
- package/lib/commonjs/testing/faults.js.map +1 -0
- package/lib/commonjs/testing/index.js +54 -0
- package/lib/commonjs/testing/index.js.map +1 -0
- package/lib/commonjs/testing/measure.js +298 -0
- package/lib/commonjs/testing/measure.js.map +1 -0
- package/lib/module/advanced.js +29 -0
- package/lib/module/advanced.js.map +1 -0
- package/lib/module/channel/migrate.js +242 -0
- package/lib/module/channel/migrate.js.map +1 -0
- package/lib/module/channel/tone-map.js +112 -0
- package/lib/module/channel/tone-map.js.map +1 -0
- package/lib/module/channel/validate-tone.js +57 -0
- package/lib/module/channel/validate-tone.js.map +1 -0
- package/lib/module/contract/channel.js +48 -0
- package/lib/module/contract/channel.js.map +1 -0
- package/lib/module/contract/diagnostics.js +21 -0
- package/lib/module/contract/diagnostics.js.map +1 -0
- package/lib/module/contract/errors.js +119 -0
- package/lib/module/contract/errors.js.map +1 -0
- package/lib/module/contract/hash.js +29 -0
- package/lib/module/contract/hash.js.map +1 -0
- package/lib/module/contract/index.js +13 -0
- package/lib/module/contract/index.js.map +1 -0
- package/lib/module/contract/interaction.js +33 -0
- package/lib/module/contract/interaction.js.map +1 -0
- package/lib/module/contract/notification.js +38 -0
- package/lib/module/contract/notification.js.map +1 -0
- package/lib/module/contract/permission.js +2 -0
- package/lib/module/contract/permission.js.map +1 -0
- package/lib/module/contract/reconcile.js +4 -0
- package/lib/module/contract/reconcile.js.map +1 -0
- package/lib/module/contract/recurrence.js +49 -0
- package/lib/module/contract/recurrence.js.map +1 -0
- package/lib/module/diagnostics/burst.js +85 -0
- package/lib/module/diagnostics/burst.js.map +1 -0
- package/lib/module/diagnostics/events.js +58 -0
- package/lib/module/diagnostics/events.js.map +1 -0
- package/lib/module/diagnostics/redact.js +44 -0
- package/lib/module/diagnostics/redact.js.map +1 -0
- package/lib/module/diagnostics/snapshot.js +64 -0
- package/lib/module/diagnostics/snapshot.js.map +1 -0
- package/lib/module/engine/adapter.js +4 -0
- package/lib/module/engine/adapter.js.map +1 -0
- package/lib/module/engine/codec.js +79 -0
- package/lib/module/engine/codec.js.map +1 -0
- package/lib/module/engine/notify-kit/events.js +139 -0
- package/lib/module/engine/notify-kit/events.js.map +1 -0
- package/lib/module/engine/notify-kit/module.js +113 -0
- package/lib/module/engine/notify-kit/module.js.map +1 -0
- package/lib/module/engine/notify-kit/platform/android.js +155 -0
- package/lib/module/engine/notify-kit/platform/android.js.map +1 -0
- package/lib/module/engine/notify-kit/platform/index.js +51 -0
- package/lib/module/engine/notify-kit/platform/index.js.map +1 -0
- package/lib/module/engine/notify-kit/platform/ios.js +49 -0
- package/lib/module/engine/notify-kit/platform/ios.js.map +1 -0
- package/lib/module/engine/notify-kit/platform/types.js +4 -0
- package/lib/module/engine/notify-kit/platform/types.js.map +1 -0
- package/lib/module/engine/notify-kit-engine.js +257 -0
- package/lib/module/engine/notify-kit-engine.js.map +1 -0
- package/lib/module/index.js +98 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/initialize.js +182 -0
- package/lib/module/initialize.js.map +1 -0
- package/lib/module/interaction/index.js +116 -0
- package/lib/module/interaction/index.js.map +1 -0
- package/lib/module/maintenance/cycle.js +102 -0
- package/lib/module/maintenance/cycle.js.map +1 -0
- package/lib/module/maintenance/permission-refresh.js +34 -0
- package/lib/module/maintenance/permission-refresh.js.map +1 -0
- package/lib/module/maintenance/reanchor.js +94 -0
- package/lib/module/maintenance/reanchor.js.map +1 -0
- package/lib/module/maintenance/toggle.js +45 -0
- package/lib/module/maintenance/toggle.js.map +1 -0
- package/lib/module/maintenance/verify.js +65 -0
- package/lib/module/maintenance/verify.js.map +1 -0
- package/lib/module/maintenance/window-refresh.js +48 -0
- package/lib/module/maintenance/window-refresh.js.map +1 -0
- package/lib/module/notifications.js +157 -0
- package/lib/module/notifications.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/permission/index.js +178 -0
- package/lib/module/permission/index.js.map +1 -0
- package/lib/module/permission/state.js +83 -0
- package/lib/module/permission/state.js.map +1 -0
- package/lib/module/push/envelope.js +137 -0
- package/lib/module/push/envelope.js.map +1 -0
- package/lib/module/push/fcm-provider.js +119 -0
- package/lib/module/push/fcm-provider.js.map +1 -0
- package/lib/module/push/gate.js +158 -0
- package/lib/module/push/gate.js.map +1 -0
- package/lib/module/push/index.js +16 -0
- package/lib/module/push/index.js.map +1 -0
- package/lib/module/push/instructions.js +97 -0
- package/lib/module/push/instructions.js.map +1 -0
- package/lib/module/push/provider-adapter.js +4 -0
- package/lib/module/push/provider-adapter.js.map +1 -0
- package/lib/module/push/signout.js +51 -0
- package/lib/module/push/signout.js.map +1 -0
- package/lib/module/reconcile/chunk.js +43 -0
- package/lib/module/reconcile/chunk.js.map +1 -0
- package/lib/module/reconcile/diff.js +101 -0
- package/lib/module/reconcile/diff.js.map +1 -0
- package/lib/module/reconcile/duplicates.js +56 -0
- package/lib/module/reconcile/duplicates.js.map +1 -0
- package/lib/module/reconcile/index.js +161 -0
- package/lib/module/reconcile/index.js.map +1 -0
- package/lib/module/reconcile/truncate.js +46 -0
- package/lib/module/reconcile/truncate.js.map +1 -0
- package/lib/module/recurrence/clock-guard.js +60 -0
- package/lib/module/recurrence/clock-guard.js.map +1 -0
- package/lib/module/recurrence/expand.js +248 -0
- package/lib/module/recurrence/expand.js.map +1 -0
- package/lib/module/recurrence/index.js +208 -0
- package/lib/module/recurrence/index.js.map +1 -0
- package/lib/module/repeat/expiry.js +37 -0
- package/lib/module/repeat/expiry.js.map +1 -0
- package/lib/module/repeat/index.js +67 -0
- package/lib/module/repeat/index.js.map +1 -0
- package/lib/module/repeat/marker.js +51 -0
- package/lib/module/repeat/marker.js.map +1 -0
- package/lib/module/repeat/place.js +79 -0
- package/lib/module/repeat/place.js.map +1 -0
- package/lib/module/schedule/anchor.js +234 -0
- package/lib/module/schedule/anchor.js.map +1 -0
- package/lib/module/schedule/index.js +137 -0
- package/lib/module/schedule/index.js.map +1 -0
- package/lib/module/schedule/partition.js +53 -0
- package/lib/module/schedule/partition.js.map +1 -0
- package/lib/module/schedule/resolve-moment.js +66 -0
- package/lib/module/schedule/resolve-moment.js.map +1 -0
- package/lib/module/schedule/validate-content.js +95 -0
- package/lib/module/schedule/validate-content.js.map +1 -0
- package/lib/module/schedule/validate-identifier.js +119 -0
- package/lib/module/schedule/validate-identifier.js.map +1 -0
- package/lib/module/schedule/writer.js +40 -0
- package/lib/module/schedule/writer.js.map +1 -0
- package/lib/module/state/caps.js +96 -0
- package/lib/module/state/caps.js.map +1 -0
- package/lib/module/state/dedup-ledger.js +34 -0
- package/lib/module/state/dedup-ledger.js.map +1 -0
- package/lib/module/state/interaction-buffer.js +92 -0
- package/lib/module/state/interaction-buffer.js.map +1 -0
- package/lib/module/state/mmkv-store.js +71 -0
- package/lib/module/state/mmkv-store.js.map +1 -0
- package/lib/module/state/permission-history.js +56 -0
- package/lib/module/state/permission-history.js.map +1 -0
- package/lib/module/state/record.js +264 -0
- package/lib/module/state/record.js.map +1 -0
- package/lib/module/state/reset.js +32 -0
- package/lib/module/state/reset.js.map +1 -0
- package/lib/module/state/series-ledger.js +62 -0
- package/lib/module/state/series-ledger.js.map +1 -0
- package/lib/module/state/store.js +35 -0
- package/lib/module/state/store.js.map +1 -0
- package/lib/module/testing/conformance/index.js +214 -0
- package/lib/module/testing/conformance/index.js.map +1 -0
- package/lib/module/testing/fake-engine.js +335 -0
- package/lib/module/testing/fake-engine.js.map +1 -0
- package/lib/module/testing/fake-provider.js +89 -0
- package/lib/module/testing/fake-provider.js.map +1 -0
- package/lib/module/testing/faults.js +55 -0
- package/lib/module/testing/faults.js.map +1 -0
- package/lib/module/testing/index.js +19 -0
- package/lib/module/testing/index.js.map +1 -0
- package/lib/module/testing/measure.js +294 -0
- package/lib/module/testing/measure.js.map +1 -0
- package/lib/typescript/commonjs/advanced.d.ts +36 -0
- package/lib/typescript/commonjs/advanced.d.ts.map +1 -0
- package/lib/typescript/commonjs/channel/migrate.d.ts +38 -0
- package/lib/typescript/commonjs/channel/migrate.d.ts.map +1 -0
- package/lib/typescript/commonjs/channel/tone-map.d.ts +34 -0
- package/lib/typescript/commonjs/channel/tone-map.d.ts.map +1 -0
- package/lib/typescript/commonjs/channel/validate-tone.d.ts +23 -0
- package/lib/typescript/commonjs/channel/validate-tone.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/channel.d.ts +185 -0
- package/lib/typescript/commonjs/contract/channel.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/diagnostics.d.ts +92 -0
- package/lib/typescript/commonjs/contract/diagnostics.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/errors.d.ts +91 -0
- package/lib/typescript/commonjs/contract/errors.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/hash.d.ts +14 -0
- package/lib/typescript/commonjs/contract/hash.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/index.d.ts +10 -0
- package/lib/typescript/commonjs/contract/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/interaction.d.ts +53 -0
- package/lib/typescript/commonjs/contract/interaction.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/notification.d.ts +110 -0
- package/lib/typescript/commonjs/contract/notification.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/permission.d.ts +49 -0
- package/lib/typescript/commonjs/contract/permission.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/reconcile.d.ts +82 -0
- package/lib/typescript/commonjs/contract/reconcile.d.ts.map +1 -0
- package/lib/typescript/commonjs/contract/recurrence.d.ts +118 -0
- package/lib/typescript/commonjs/contract/recurrence.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/burst.d.ts +39 -0
- package/lib/typescript/commonjs/diagnostics/burst.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/events.d.ts +28 -0
- package/lib/typescript/commonjs/diagnostics/events.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/redact.d.ts +22 -0
- package/lib/typescript/commonjs/diagnostics/redact.d.ts.map +1 -0
- package/lib/typescript/commonjs/diagnostics/snapshot.d.ts +40 -0
- package/lib/typescript/commonjs/diagnostics/snapshot.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/adapter.d.ts +172 -0
- package/lib/typescript/commonjs/engine/adapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/codec.d.ts +20 -0
- package/lib/typescript/commonjs/engine/codec.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/events.d.ts +37 -0
- package/lib/typescript/commonjs/engine/notify-kit/events.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/module.d.ts +103 -0
- package/lib/typescript/commonjs/engine/notify-kit/module.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/android.d.ts +3 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/android.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/index.d.ts +12 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/ios.d.ts +3 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/ios.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/types.d.ts +33 -0
- package/lib/typescript/commonjs/engine/notify-kit/platform/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/engine/notify-kit-engine.d.ts +25 -0
- package/lib/typescript/commonjs/engine/notify-kit-engine.d.ts.map +1 -0
- package/lib/typescript/commonjs/index.d.ts +106 -0
- package/lib/typescript/commonjs/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/initialize.d.ts +74 -0
- package/lib/typescript/commonjs/initialize.d.ts.map +1 -0
- package/lib/typescript/commonjs/interaction/index.d.ts +53 -0
- package/lib/typescript/commonjs/interaction/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/cycle.d.ts +77 -0
- package/lib/typescript/commonjs/maintenance/cycle.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/permission-refresh.d.ts +19 -0
- package/lib/typescript/commonjs/maintenance/permission-refresh.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/reanchor.d.ts +26 -0
- package/lib/typescript/commonjs/maintenance/reanchor.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/toggle.d.ts +35 -0
- package/lib/typescript/commonjs/maintenance/toggle.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/verify.d.ts +32 -0
- package/lib/typescript/commonjs/maintenance/verify.d.ts.map +1 -0
- package/lib/typescript/commonjs/maintenance/window-refresh.d.ts +29 -0
- package/lib/typescript/commonjs/maintenance/window-refresh.d.ts.map +1 -0
- package/lib/typescript/commonjs/notifications.d.ts +78 -0
- package/lib/typescript/commonjs/notifications.d.ts.map +1 -0
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/permission/index.d.ts +57 -0
- package/lib/typescript/commonjs/permission/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/permission/state.d.ts +41 -0
- package/lib/typescript/commonjs/permission/state.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/envelope.d.ts +33 -0
- package/lib/typescript/commonjs/push/envelope.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/fcm-provider.d.ts +43 -0
- package/lib/typescript/commonjs/push/fcm-provider.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/gate.d.ts +57 -0
- package/lib/typescript/commonjs/push/gate.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/index.d.ts +19 -0
- package/lib/typescript/commonjs/push/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/instructions.d.ts +45 -0
- package/lib/typescript/commonjs/push/instructions.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/provider-adapter.d.ts +50 -0
- package/lib/typescript/commonjs/push/provider-adapter.d.ts.map +1 -0
- package/lib/typescript/commonjs/push/signout.d.ts +33 -0
- package/lib/typescript/commonjs/push/signout.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/chunk.d.ts +24 -0
- package/lib/typescript/commonjs/reconcile/chunk.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/diff.d.ts +54 -0
- package/lib/typescript/commonjs/reconcile/diff.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/duplicates.d.ts +32 -0
- package/lib/typescript/commonjs/reconcile/duplicates.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/index.d.ts +35 -0
- package/lib/typescript/commonjs/reconcile/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/reconcile/truncate.d.ts +26 -0
- package/lib/typescript/commonjs/reconcile/truncate.d.ts.map +1 -0
- package/lib/typescript/commonjs/recurrence/clock-guard.d.ts +37 -0
- package/lib/typescript/commonjs/recurrence/clock-guard.d.ts.map +1 -0
- package/lib/typescript/commonjs/recurrence/expand.d.ts +75 -0
- package/lib/typescript/commonjs/recurrence/expand.d.ts.map +1 -0
- package/lib/typescript/commonjs/recurrence/index.d.ts +40 -0
- package/lib/typescript/commonjs/recurrence/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/repeat/expiry.d.ts +23 -0
- package/lib/typescript/commonjs/repeat/expiry.d.ts.map +1 -0
- package/lib/typescript/commonjs/repeat/index.d.ts +49 -0
- package/lib/typescript/commonjs/repeat/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/repeat/marker.d.ts +36 -0
- package/lib/typescript/commonjs/repeat/marker.d.ts.map +1 -0
- package/lib/typescript/commonjs/repeat/place.d.ts +39 -0
- package/lib/typescript/commonjs/repeat/place.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/anchor.d.ts +118 -0
- package/lib/typescript/commonjs/schedule/anchor.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/index.d.ts +40 -0
- package/lib/typescript/commonjs/schedule/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/partition.d.ts +29 -0
- package/lib/typescript/commonjs/schedule/partition.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/resolve-moment.d.ts +35 -0
- package/lib/typescript/commonjs/schedule/resolve-moment.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/validate-content.d.ts +42 -0
- package/lib/typescript/commonjs/schedule/validate-content.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/validate-identifier.d.ts +30 -0
- package/lib/typescript/commonjs/schedule/validate-identifier.d.ts.map +1 -0
- package/lib/typescript/commonjs/schedule/writer.d.ts +36 -0
- package/lib/typescript/commonjs/schedule/writer.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/caps.d.ts +51 -0
- package/lib/typescript/commonjs/state/caps.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/dedup-ledger.d.ts +21 -0
- package/lib/typescript/commonjs/state/dedup-ledger.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/interaction-buffer.d.ts +30 -0
- package/lib/typescript/commonjs/state/interaction-buffer.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/mmkv-store.d.ts +33 -0
- package/lib/typescript/commonjs/state/mmkv-store.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/permission-history.d.ts +20 -0
- package/lib/typescript/commonjs/state/permission-history.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/record.d.ts +134 -0
- package/lib/typescript/commonjs/state/record.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/reset.d.ts +22 -0
- package/lib/typescript/commonjs/state/reset.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/series-ledger.d.ts +47 -0
- package/lib/typescript/commonjs/state/series-ledger.d.ts.map +1 -0
- package/lib/typescript/commonjs/state/store.d.ts +20 -0
- package/lib/typescript/commonjs/state/store.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/conformance/index.d.ts +32 -0
- package/lib/typescript/commonjs/testing/conformance/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/fake-engine.d.ts +91 -0
- package/lib/typescript/commonjs/testing/fake-engine.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/fake-provider.d.ts +35 -0
- package/lib/typescript/commonjs/testing/fake-provider.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/faults.d.ts +38 -0
- package/lib/typescript/commonjs/testing/faults.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/index.d.ts +22 -0
- package/lib/typescript/commonjs/testing/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/testing/measure.d.ts +59 -0
- package/lib/typescript/commonjs/testing/measure.d.ts.map +1 -0
- package/lib/typescript/module/advanced.d.ts +36 -0
- package/lib/typescript/module/advanced.d.ts.map +1 -0
- package/lib/typescript/module/channel/migrate.d.ts +38 -0
- package/lib/typescript/module/channel/migrate.d.ts.map +1 -0
- package/lib/typescript/module/channel/tone-map.d.ts +34 -0
- package/lib/typescript/module/channel/tone-map.d.ts.map +1 -0
- package/lib/typescript/module/channel/validate-tone.d.ts +23 -0
- package/lib/typescript/module/channel/validate-tone.d.ts.map +1 -0
- package/lib/typescript/module/contract/channel.d.ts +185 -0
- package/lib/typescript/module/contract/channel.d.ts.map +1 -0
- package/lib/typescript/module/contract/diagnostics.d.ts +92 -0
- package/lib/typescript/module/contract/diagnostics.d.ts.map +1 -0
- package/lib/typescript/module/contract/errors.d.ts +91 -0
- package/lib/typescript/module/contract/errors.d.ts.map +1 -0
- package/lib/typescript/module/contract/hash.d.ts +14 -0
- package/lib/typescript/module/contract/hash.d.ts.map +1 -0
- package/lib/typescript/module/contract/index.d.ts +10 -0
- package/lib/typescript/module/contract/index.d.ts.map +1 -0
- package/lib/typescript/module/contract/interaction.d.ts +53 -0
- package/lib/typescript/module/contract/interaction.d.ts.map +1 -0
- package/lib/typescript/module/contract/notification.d.ts +110 -0
- package/lib/typescript/module/contract/notification.d.ts.map +1 -0
- package/lib/typescript/module/contract/permission.d.ts +49 -0
- package/lib/typescript/module/contract/permission.d.ts.map +1 -0
- package/lib/typescript/module/contract/reconcile.d.ts +82 -0
- package/lib/typescript/module/contract/reconcile.d.ts.map +1 -0
- package/lib/typescript/module/contract/recurrence.d.ts +118 -0
- package/lib/typescript/module/contract/recurrence.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/burst.d.ts +39 -0
- package/lib/typescript/module/diagnostics/burst.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/events.d.ts +28 -0
- package/lib/typescript/module/diagnostics/events.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/redact.d.ts +22 -0
- package/lib/typescript/module/diagnostics/redact.d.ts.map +1 -0
- package/lib/typescript/module/diagnostics/snapshot.d.ts +40 -0
- package/lib/typescript/module/diagnostics/snapshot.d.ts.map +1 -0
- package/lib/typescript/module/engine/adapter.d.ts +172 -0
- package/lib/typescript/module/engine/adapter.d.ts.map +1 -0
- package/lib/typescript/module/engine/codec.d.ts +20 -0
- package/lib/typescript/module/engine/codec.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/events.d.ts +37 -0
- package/lib/typescript/module/engine/notify-kit/events.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/module.d.ts +103 -0
- package/lib/typescript/module/engine/notify-kit/module.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/platform/android.d.ts +3 -0
- package/lib/typescript/module/engine/notify-kit/platform/android.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/platform/index.d.ts +12 -0
- package/lib/typescript/module/engine/notify-kit/platform/index.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/platform/ios.d.ts +3 -0
- package/lib/typescript/module/engine/notify-kit/platform/ios.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit/platform/types.d.ts +33 -0
- package/lib/typescript/module/engine/notify-kit/platform/types.d.ts.map +1 -0
- package/lib/typescript/module/engine/notify-kit-engine.d.ts +25 -0
- package/lib/typescript/module/engine/notify-kit-engine.d.ts.map +1 -0
- package/lib/typescript/module/index.d.ts +106 -0
- package/lib/typescript/module/index.d.ts.map +1 -0
- package/lib/typescript/module/initialize.d.ts +74 -0
- package/lib/typescript/module/initialize.d.ts.map +1 -0
- package/lib/typescript/module/interaction/index.d.ts +53 -0
- package/lib/typescript/module/interaction/index.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/cycle.d.ts +77 -0
- package/lib/typescript/module/maintenance/cycle.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/permission-refresh.d.ts +19 -0
- package/lib/typescript/module/maintenance/permission-refresh.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/reanchor.d.ts +26 -0
- package/lib/typescript/module/maintenance/reanchor.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/toggle.d.ts +35 -0
- package/lib/typescript/module/maintenance/toggle.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/verify.d.ts +32 -0
- package/lib/typescript/module/maintenance/verify.d.ts.map +1 -0
- package/lib/typescript/module/maintenance/window-refresh.d.ts +29 -0
- package/lib/typescript/module/maintenance/window-refresh.d.ts.map +1 -0
- package/lib/typescript/module/notifications.d.ts +78 -0
- package/lib/typescript/module/notifications.d.ts.map +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/permission/index.d.ts +57 -0
- package/lib/typescript/module/permission/index.d.ts.map +1 -0
- package/lib/typescript/module/permission/state.d.ts +41 -0
- package/lib/typescript/module/permission/state.d.ts.map +1 -0
- package/lib/typescript/module/push/envelope.d.ts +33 -0
- package/lib/typescript/module/push/envelope.d.ts.map +1 -0
- package/lib/typescript/module/push/fcm-provider.d.ts +43 -0
- package/lib/typescript/module/push/fcm-provider.d.ts.map +1 -0
- package/lib/typescript/module/push/gate.d.ts +57 -0
- package/lib/typescript/module/push/gate.d.ts.map +1 -0
- package/lib/typescript/module/push/index.d.ts +19 -0
- package/lib/typescript/module/push/index.d.ts.map +1 -0
- package/lib/typescript/module/push/instructions.d.ts +45 -0
- package/lib/typescript/module/push/instructions.d.ts.map +1 -0
- package/lib/typescript/module/push/provider-adapter.d.ts +50 -0
- package/lib/typescript/module/push/provider-adapter.d.ts.map +1 -0
- package/lib/typescript/module/push/signout.d.ts +33 -0
- package/lib/typescript/module/push/signout.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/chunk.d.ts +24 -0
- package/lib/typescript/module/reconcile/chunk.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/diff.d.ts +54 -0
- package/lib/typescript/module/reconcile/diff.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/duplicates.d.ts +32 -0
- package/lib/typescript/module/reconcile/duplicates.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/index.d.ts +35 -0
- package/lib/typescript/module/reconcile/index.d.ts.map +1 -0
- package/lib/typescript/module/reconcile/truncate.d.ts +26 -0
- package/lib/typescript/module/reconcile/truncate.d.ts.map +1 -0
- package/lib/typescript/module/recurrence/clock-guard.d.ts +37 -0
- package/lib/typescript/module/recurrence/clock-guard.d.ts.map +1 -0
- package/lib/typescript/module/recurrence/expand.d.ts +75 -0
- package/lib/typescript/module/recurrence/expand.d.ts.map +1 -0
- package/lib/typescript/module/recurrence/index.d.ts +40 -0
- package/lib/typescript/module/recurrence/index.d.ts.map +1 -0
- package/lib/typescript/module/repeat/expiry.d.ts +23 -0
- package/lib/typescript/module/repeat/expiry.d.ts.map +1 -0
- package/lib/typescript/module/repeat/index.d.ts +49 -0
- package/lib/typescript/module/repeat/index.d.ts.map +1 -0
- package/lib/typescript/module/repeat/marker.d.ts +36 -0
- package/lib/typescript/module/repeat/marker.d.ts.map +1 -0
- package/lib/typescript/module/repeat/place.d.ts +39 -0
- package/lib/typescript/module/repeat/place.d.ts.map +1 -0
- package/lib/typescript/module/schedule/anchor.d.ts +118 -0
- package/lib/typescript/module/schedule/anchor.d.ts.map +1 -0
- package/lib/typescript/module/schedule/index.d.ts +40 -0
- package/lib/typescript/module/schedule/index.d.ts.map +1 -0
- package/lib/typescript/module/schedule/partition.d.ts +29 -0
- package/lib/typescript/module/schedule/partition.d.ts.map +1 -0
- package/lib/typescript/module/schedule/resolve-moment.d.ts +35 -0
- package/lib/typescript/module/schedule/resolve-moment.d.ts.map +1 -0
- package/lib/typescript/module/schedule/validate-content.d.ts +42 -0
- package/lib/typescript/module/schedule/validate-content.d.ts.map +1 -0
- package/lib/typescript/module/schedule/validate-identifier.d.ts +30 -0
- package/lib/typescript/module/schedule/validate-identifier.d.ts.map +1 -0
- package/lib/typescript/module/schedule/writer.d.ts +36 -0
- package/lib/typescript/module/schedule/writer.d.ts.map +1 -0
- package/lib/typescript/module/state/caps.d.ts +51 -0
- package/lib/typescript/module/state/caps.d.ts.map +1 -0
- package/lib/typescript/module/state/dedup-ledger.d.ts +21 -0
- package/lib/typescript/module/state/dedup-ledger.d.ts.map +1 -0
- package/lib/typescript/module/state/interaction-buffer.d.ts +30 -0
- package/lib/typescript/module/state/interaction-buffer.d.ts.map +1 -0
- package/lib/typescript/module/state/mmkv-store.d.ts +33 -0
- package/lib/typescript/module/state/mmkv-store.d.ts.map +1 -0
- package/lib/typescript/module/state/permission-history.d.ts +20 -0
- package/lib/typescript/module/state/permission-history.d.ts.map +1 -0
- package/lib/typescript/module/state/record.d.ts +134 -0
- package/lib/typescript/module/state/record.d.ts.map +1 -0
- package/lib/typescript/module/state/reset.d.ts +22 -0
- package/lib/typescript/module/state/reset.d.ts.map +1 -0
- package/lib/typescript/module/state/series-ledger.d.ts +47 -0
- package/lib/typescript/module/state/series-ledger.d.ts.map +1 -0
- package/lib/typescript/module/state/store.d.ts +20 -0
- package/lib/typescript/module/state/store.d.ts.map +1 -0
- package/lib/typescript/module/testing/conformance/index.d.ts +32 -0
- package/lib/typescript/module/testing/conformance/index.d.ts.map +1 -0
- package/lib/typescript/module/testing/fake-engine.d.ts +91 -0
- package/lib/typescript/module/testing/fake-engine.d.ts.map +1 -0
- package/lib/typescript/module/testing/fake-provider.d.ts +35 -0
- package/lib/typescript/module/testing/fake-provider.d.ts.map +1 -0
- package/lib/typescript/module/testing/faults.d.ts +38 -0
- package/lib/typescript/module/testing/faults.d.ts.map +1 -0
- package/lib/typescript/module/testing/index.d.ts +22 -0
- package/lib/typescript/module/testing/index.d.ts.map +1 -0
- package/lib/typescript/module/testing/measure.d.ts +59 -0
- package/lib/typescript/module/testing/measure.d.ts.map +1 -0
- package/package.json +72 -26
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Reading what the engine hands back: pending entries, interactions, deliveries
|
|
5
|
+
* and authorization values, turned into the package's own shapes.
|
|
6
|
+
*
|
|
7
|
+
* Pure functions of the raw value and a clock, so they are testable without an
|
|
8
|
+
* engine and shared by the foreground, background and cold-start paths.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { isRepeatStopId } from "../../repeat/marker.js";
|
|
12
|
+
import { unpackData } from "../codec.js";
|
|
13
|
+
import { EVENT_TYPE_ACTION_PRESS, EVENT_TYPE_DELIVERED, EVENT_TYPE_DISMISSED, EVENT_TYPE_PRESS } from "./module.js";
|
|
14
|
+
const bag = value => value ?? {};
|
|
15
|
+
const dataOf = notification => notification.data ?? {};
|
|
16
|
+
|
|
17
|
+
/** Reads a stop marker back out of a pending entry's data bag, if it is one. */
|
|
18
|
+
export function unpackRepeatStop(id, data) {
|
|
19
|
+
if (!isRepeatStopId(id)) return undefined;
|
|
20
|
+
const targetId = data.__cms_stop_target;
|
|
21
|
+
const dueAt = Number.parseInt(data.__cms_stop_due ?? '', 10);
|
|
22
|
+
if (typeof targetId !== 'string' || !Number.isFinite(dueAt)) return undefined;
|
|
23
|
+
return {
|
|
24
|
+
markerId: id,
|
|
25
|
+
targetId,
|
|
26
|
+
dueAt
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function unpackEntry(raw, now) {
|
|
30
|
+
const notification = bag(raw.notification);
|
|
31
|
+
const trigger = bag(raw.trigger);
|
|
32
|
+
const id = notification.id;
|
|
33
|
+
if (typeof id !== 'string') return undefined;
|
|
34
|
+
return {
|
|
35
|
+
id,
|
|
36
|
+
resolvedAt: typeof trigger.timestamp === 'number' ? trigger.timestamp : now(),
|
|
37
|
+
content: {
|
|
38
|
+
title: typeof notification.title === 'string' ? notification.title : '',
|
|
39
|
+
body: typeof notification.body === 'string' ? notification.body : '',
|
|
40
|
+
subtitle: typeof notification.subtitle === 'string' ? notification.subtitle : undefined
|
|
41
|
+
},
|
|
42
|
+
...unpackData(dataOf(notification))
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Every stop marker among the engine's pending triggers. */
|
|
47
|
+
export function unpackRepeatStops(raw) {
|
|
48
|
+
const stops = [];
|
|
49
|
+
for (const entry of raw) {
|
|
50
|
+
const notification = bag(entry.notification);
|
|
51
|
+
const id = notification.id;
|
|
52
|
+
if (typeof id !== 'string') continue;
|
|
53
|
+
const stop = unpackRepeatStop(id, dataOf(notification));
|
|
54
|
+
if (stop !== undefined) stops.push(stop);
|
|
55
|
+
}
|
|
56
|
+
return stops;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* An interaction, or undefined for anything that is not one.
|
|
61
|
+
*
|
|
62
|
+
* Only a dismissal or a press is an interaction. Everything else the engine
|
|
63
|
+
* emits on this channel — delivery, trigger creation, channel blocking — is not,
|
|
64
|
+
* and reporting it as one would cancel a notification the user never touched.
|
|
65
|
+
*/
|
|
66
|
+
export function toInteraction(raw, now) {
|
|
67
|
+
const eventType = raw.type;
|
|
68
|
+
if (eventType !== EVENT_TYPE_DISMISSED && eventType !== EVENT_TYPE_PRESS && eventType !== EVENT_TYPE_ACTION_PRESS) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
const detail = bag(raw.detail);
|
|
72
|
+
const notification = bag(detail.notification);
|
|
73
|
+
const pressAction = bag(detail.pressAction);
|
|
74
|
+
const id = notification.id;
|
|
75
|
+
if (typeof id !== 'string') return undefined;
|
|
76
|
+
const data = dataOf(notification);
|
|
77
|
+
const actionId = typeof pressAction.id === 'string' ? pressAction.id : undefined;
|
|
78
|
+
// `default` is the engine's own press-action id for tapping the body, so it is
|
|
79
|
+
// a tap rather than a named action.
|
|
80
|
+
const isNamedAction = actionId !== undefined && actionId !== 'default';
|
|
81
|
+
let kind;
|
|
82
|
+
if (eventType === EVENT_TYPE_DISMISSED) {
|
|
83
|
+
kind = 'dismiss';
|
|
84
|
+
} else if (isNamedAction) {
|
|
85
|
+
kind = 'action';
|
|
86
|
+
} else {
|
|
87
|
+
kind = 'tap';
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
kind,
|
|
91
|
+
notificationId: id,
|
|
92
|
+
actionId: isNamedAction ? actionId : undefined,
|
|
93
|
+
inputText: typeof detail.input === 'string' ? detail.input : undefined,
|
|
94
|
+
// The one decoder for the data bag, so routing is parsed the same way here
|
|
95
|
+
// and when reading the pending set back (NOT-18).
|
|
96
|
+
routing: unpackData(data).routing,
|
|
97
|
+
ownerTag: data.__cms_owner,
|
|
98
|
+
occurredAt: now(),
|
|
99
|
+
appState: 'foreground',
|
|
100
|
+
wasBuffered: false
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/** A delivery, or undefined for anything that is not one. */
|
|
105
|
+
export function toDelivery(raw, now) {
|
|
106
|
+
if (raw.type !== EVENT_TYPE_DELIVERED) return undefined;
|
|
107
|
+
const notification = bag(bag(raw.detail).notification);
|
|
108
|
+
const id = notification.id;
|
|
109
|
+
if (typeof id !== 'string') return undefined;
|
|
110
|
+
return {
|
|
111
|
+
notificationId: id,
|
|
112
|
+
occurredAt: now(),
|
|
113
|
+
repeatStop: unpackRepeatStop(id, dataOf(notification))
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Maps engine authorization values onto our six-state model.
|
|
119
|
+
*
|
|
120
|
+
* `notAsked` and `denied` must stay distinguishable — being able to read state
|
|
121
|
+
* without prompting is worthless if the two collapse. `provisional` is its own
|
|
122
|
+
* state on both edges, never folded into granted or denied.
|
|
123
|
+
*/
|
|
124
|
+
export function toPermissionState(raw) {
|
|
125
|
+
switch (raw) {
|
|
126
|
+
case 1:
|
|
127
|
+
case 'authorized':
|
|
128
|
+
return 'granted';
|
|
129
|
+
case 2:
|
|
130
|
+
case 'provisional':
|
|
131
|
+
return 'provisional';
|
|
132
|
+
case 0:
|
|
133
|
+
case 'denied':
|
|
134
|
+
return 'denied';
|
|
135
|
+
default:
|
|
136
|
+
return 'notAsked';
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isRepeatStopId","unpackData","EVENT_TYPE_ACTION_PRESS","EVENT_TYPE_DELIVERED","EVENT_TYPE_DISMISSED","EVENT_TYPE_PRESS","bag","value","dataOf","notification","data","unpackRepeatStop","id","undefined","targetId","__cms_stop_target","dueAt","Number","parseInt","__cms_stop_due","isFinite","markerId","unpackEntry","raw","now","trigger","resolvedAt","timestamp","content","title","body","subtitle","unpackRepeatStops","stops","entry","stop","push","toInteraction","eventType","type","detail","pressAction","actionId","isNamedAction","kind","notificationId","inputText","input","routing","ownerTag","__cms_owner","occurredAt","appState","wasBuffered","toDelivery","repeatStop","toPermissionState"],"sourceRoot":"../../../../src","sources":["engine/notify-kit/events.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,cAAc,QAAQ,wBAAqB;AAEpD,SAASC,UAAU,QAAQ,aAAU;AACrC,SACCC,uBAAuB,EACvBC,oBAAoB,EACpBC,oBAAoB,EACpBC,gBAAgB,QACV,aAAU;AAIjB,MAAMC,GAAG,GAAIC,KAAc,IAAWA,KAAK,IAAI,CAAC,CAAS;AACzD,MAAMC,MAAM,GAAIC,YAAi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CAAC;IACjB+B,UAAU,EAAE5C,gBAAgB,CAACC,EAAE,EAAEJ,MAAM,CAACC,YAAY,CAAC;EACtD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS+C,iBAAiBA,CAACjC,GAAY,EAAmB;EAChE,QAAQA,GAAG;IACV,KAAK,CAAC;IACN,KAAK,YAAY;MAChB,OAAO,SAAS;IACjB,KAAK,CAAC;IACN,KAAK,aAAa;MACjB,OAAO,aAAa;IACrB,KAAK,CAAC;IACN,KAAK,QAAQ;MACZ,OAAO,QAAQ;IAChB;MACC,OAAO,UAAU;EACnB;AACD","ignoreList":[]}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The slice of `react-native-notify-kit` this package uses, and how it is loaded.
|
|
5
|
+
*
|
|
6
|
+
* Every import of the engine is confined to this file. The module is required
|
|
7
|
+
* lazily so the package loads in Jest and in any environment without the native
|
|
8
|
+
* module; an absent engine is reported through the normal diagnostic path
|
|
9
|
+
* rather than crashing at import time.
|
|
10
|
+
*/
|
|
11
|
+
import { lazyPeer } from '@chipmobilesdk/rn-core';
|
|
12
|
+
import { DIAGNOSTIC_CODES, NotificationError } from "../../contract/errors.js";
|
|
13
|
+
|
|
14
|
+
/** Both platforms bound background execution for a silent payload or background action. */
|
|
15
|
+
export const BACKGROUND_WINDOW_MS = 30_000;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The engine's own enum values, mirrored as literals.
|
|
19
|
+
*
|
|
20
|
+
* These are **numeric** enums in the engine's type definitions, and its native
|
|
21
|
+
* validator rejects the string names — `importance: 'default'` fails with
|
|
22
|
+
* "expected a valid Importance". Mirroring them here rather than importing the
|
|
23
|
+
* enums keeps the engine out of the module graph, which is what lets the
|
|
24
|
+
* package load without the native module present.
|
|
25
|
+
*
|
|
26
|
+
* The package's own `ResolvedTone` deliberately stays platform-neutral strings;
|
|
27
|
+
* translating to the engine's representation is this adapter's job and nobody
|
|
28
|
+
* else's.
|
|
29
|
+
*/
|
|
30
|
+
export const ANDROID_IMPORTANCE = {
|
|
31
|
+
none: 0,
|
|
32
|
+
min: 1,
|
|
33
|
+
low: 2,
|
|
34
|
+
default: 3,
|
|
35
|
+
high: 4
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** `TriggerType.TIMESTAMP`. */
|
|
39
|
+
export const TRIGGER_TYPE_TIMESTAMP = 0;
|
|
40
|
+
|
|
41
|
+
/** `AlarmType.SET_EXACT_AND_ALLOW_WHILE_IDLE` — exact delivery, survives Doze. */
|
|
42
|
+
export const ALARM_TYPE_EXACT_AND_ALLOW_WHILE_IDLE = 3;
|
|
43
|
+
|
|
44
|
+
/** `AlarmType.SET_AND_ALLOW_WHILE_IDLE` — the approximate degradation of the above. */
|
|
45
|
+
export const ALARM_TYPE_INEXACT_AND_ALLOW_WHILE_IDLE = 1;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* `EventType` values that represent a real user interaction.
|
|
49
|
+
*
|
|
50
|
+
* The engine emits far more than interactions on this channel — `DELIVERED`,
|
|
51
|
+
* `TRIGGER_NOTIFICATION_CREATED`, `CHANNEL_BLOCKED` and others all arrive here.
|
|
52
|
+
* Treating anything that is not a dismissal as a press would report a
|
|
53
|
+
* notification *arriving* while the app is open as the user having tapped it,
|
|
54
|
+
* and the interaction path cancels on tap — so the notification would vanish
|
|
55
|
+
* from the tray in front of the user, unread.
|
|
56
|
+
*/
|
|
57
|
+
export const EVENT_TYPE_DISMISSED = 0;
|
|
58
|
+
export const EVENT_TYPE_PRESS = 1;
|
|
59
|
+
export const EVENT_TYPE_ACTION_PRESS = 2;
|
|
60
|
+
|
|
61
|
+
/** `EventType.DELIVERED` — an arrival, which is emphatically not an interaction. */
|
|
62
|
+
export const EVENT_TYPE_DELIVERED = 3;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* `AndroidCategory.ALARM`, the engine's marking for a time-sensitive alert.
|
|
66
|
+
*
|
|
67
|
+
* A per-notification property, not channel configuration — which is why
|
|
68
|
+
* declaring `timeSensitive` on an existing tone never obliges a version bump.
|
|
69
|
+
*/
|
|
70
|
+
export const ANDROID_CATEGORY_ALARM = 'alarm';
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The channel stop markers are posted on.
|
|
74
|
+
*
|
|
75
|
+
* A marker exists to be delivered and immediately removed, so it is given the
|
|
76
|
+
* quietest configuration the platform offers: minimum importance, no sound, no
|
|
77
|
+
* vibration. Its version is fixed because nothing about it is consumer-declared,
|
|
78
|
+
* so it never migrates.
|
|
79
|
+
*/
|
|
80
|
+
export const MARKER_CHANNEL_ID = 'cms.internal.stop.v1';
|
|
81
|
+
|
|
82
|
+
/** Minimal shape used from the engine, so its full surface never leaks into typing. */
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Drops keys whose value is `undefined`.
|
|
86
|
+
*
|
|
87
|
+
* The engine validates its arguments by key presence, not by value: passing
|
|
88
|
+
* `{ groupId: undefined }` fails with "expected a string value", while omitting
|
|
89
|
+
* the key entirely is accepted. JavaScript treats the two as interchangeable
|
|
90
|
+
* almost everywhere, which is exactly why this is easy to get wrong — and why
|
|
91
|
+
* it only surfaces on a real device, where the native validator runs.
|
|
92
|
+
*/
|
|
93
|
+
export function compact(value) {
|
|
94
|
+
const output = {};
|
|
95
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
96
|
+
if (entry !== undefined) output[key] = entry;
|
|
97
|
+
}
|
|
98
|
+
return output;
|
|
99
|
+
}
|
|
100
|
+
const notifyKit = lazyPeer('react-native-notify-kit', () => {
|
|
101
|
+
// Inside `try`, so Metro bundles an app that leaves this optional peer out.
|
|
102
|
+
try {
|
|
103
|
+
return require('react-native-notify-kit');
|
|
104
|
+
} catch (cause) {
|
|
105
|
+
throw cause;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
export function loadEngine() {
|
|
109
|
+
return notifyKit.require((_peer, cause) => new NotificationError(DIAGNOSTIC_CODES.PUSH_UNAVAILABLE, 'react-native-notify-kit is not installed or its native module is not linked. Install it as a peer dependency and rebuild the app.', {
|
|
110
|
+
reason: cause instanceof Error ? cause.name : 'unknown'
|
|
111
|
+
})).default;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["lazyPeer","DIAGNOSTIC_CODES","NotificationError","BACKGROUND_WINDOW_MS","ANDROID_IMPORTANCE","none","min","low","default","high","TRIGGER_TYPE_TIMESTAMP","ALARM_TYPE_EXACT_AND_ALLOW_WHILE_IDLE","ALARM_TYPE_INEXACT_AND_ALLOW_WHILE_IDLE","EVENT_TYPE_DISMISSED","EVENT_TYPE_PRESS","EVENT_TYPE_ACTION_PRESS","EVENT_TYPE_DELIVERED","ANDROID_CATEGORY_ALARM","MARKER_CHANNEL_ID","compact","value","output","key","entry","Object","entries","undefined","notifyKit","require","cause","loadEngine","_peer","PUSH_UNAVAILABLE","reason","Error","name"],"sourceRoot":"../../../../src","sources":["engine/notify-kit/module.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,wBAAwB;AAEjD,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,0BAAuB;;AAE3E;AACA,OAAO,MAAMC,oBAAoB,GAAG,MAAM;;AAE1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,kBAAkB,GAAG;EACjCC,IAAI,EAAE,CAAC;EACPC,GAAG,EAAE,CAAC;EACNC,GAAG,EAAE,CAAC;EACNC,OAAO,EAAE,CAAC;EACVC,IAAI,EAAE;AACP,CAAU;;AAEV;AACA,OAAO,MAAMC,sBAAsB,GAAG,CAAC;;AAEvC;AACA,OAAO,MAAMC,qCAAqC,GAAG,CAAC;;AAEtD;AACA,OAAO,MAAMC,uCAAuC,G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
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Android: channels, exact alarms, battery optimisation, looping alerts.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { toPermissionState } from "../events.js";
|
|
8
|
+
import { ANDROID_IMPORTANCE, BACKGROUND_WINDOW_MS, MARKER_CHANNEL_ID, compact } from "../module.js";
|
|
9
|
+
/** Android has no hard pending ceiling like iOS; this bound keeps behavior predictable. */
|
|
10
|
+
const ANDROID_PENDING_BUDGET = 500;
|
|
11
|
+
/** Android 13: the first version with a runtime display permission. */
|
|
12
|
+
const DISPLAY_PERMISSION_API = 33;
|
|
13
|
+
/** Android 12: the first version that gates exact alarms. */
|
|
14
|
+
const EXACT_ALARM_API = 31;
|
|
15
|
+
export function createAndroidPlatform({
|
|
16
|
+
engine,
|
|
17
|
+
apiLevel
|
|
18
|
+
}) {
|
|
19
|
+
let markerChannelReady = false;
|
|
20
|
+
/** The declared channels for the duration of one `withChannelSnapshot` (NOT-08). */
|
|
21
|
+
let channelSnapshot;
|
|
22
|
+
const declaredChannels = async () => channelSnapshot ?? engine().getChannels();
|
|
23
|
+
// An unknown API level is treated as current: gating is the safe assumption.
|
|
24
|
+
const atLeast = level => (apiLevel() ?? Number.POSITIVE_INFINITY) >= level;
|
|
25
|
+
return {
|
|
26
|
+
capabilities: () => ({
|
|
27
|
+
pendingCeiling: ANDROID_PENDING_BUDGET,
|
|
28
|
+
supportsExactAlarms: true,
|
|
29
|
+
supportsChannels: true,
|
|
30
|
+
supportsTextInputActions: true,
|
|
31
|
+
supportsDoNotDisturbBypass: true,
|
|
32
|
+
supportsRepeatingAlert: true,
|
|
33
|
+
backgroundWindowMs: BACKGROUND_WINDOW_MS
|
|
34
|
+
}),
|
|
35
|
+
/**
|
|
36
|
+
* Lazily rather than at initialization, so an app that never declares a
|
|
37
|
+
* repeating tone never grows an extra entry in the user's notification
|
|
38
|
+
* settings for a feature it does not use.
|
|
39
|
+
*/
|
|
40
|
+
async ensureMarkerChannel() {
|
|
41
|
+
if (markerChannelReady) return;
|
|
42
|
+
await engine().createChannel({
|
|
43
|
+
id: MARKER_CHANNEL_ID,
|
|
44
|
+
name: 'Background maintenance',
|
|
45
|
+
description: 'Used briefly to end a repeating alert. Notifications here are removed immediately.',
|
|
46
|
+
importance: ANDROID_IMPORTANCE.min,
|
|
47
|
+
vibration: false,
|
|
48
|
+
badge: false
|
|
49
|
+
});
|
|
50
|
+
markerChannelReady = true;
|
|
51
|
+
},
|
|
52
|
+
async withChannelSnapshot(work) {
|
|
53
|
+
if (channelSnapshot !== undefined) {
|
|
54
|
+
return work();
|
|
55
|
+
}
|
|
56
|
+
channelSnapshot = await engine().getChannels();
|
|
57
|
+
try {
|
|
58
|
+
return await work();
|
|
59
|
+
} finally {
|
|
60
|
+
channelSnapshot = undefined;
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
async declareTone(tone) {
|
|
64
|
+
const existing = await declaredChannels();
|
|
65
|
+
const held = existing.find(channel => channel.id === tone.android.channelId);
|
|
66
|
+
const remember = () => {
|
|
67
|
+
channelSnapshot = channelSnapshot?.filter(channel => channel.id !== tone.android.channelId).concat({
|
|
68
|
+
id: tone.android.channelId,
|
|
69
|
+
name: tone.android.name,
|
|
70
|
+
description: tone.android.description
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
const payload = compact({
|
|
74
|
+
id: tone.android.channelId,
|
|
75
|
+
// The consumer's declared label, not the tone identifier. Passing the
|
|
76
|
+
// identifier here is what put a technical string in front of users on
|
|
77
|
+
// the one screen these labels exist to serve.
|
|
78
|
+
name: tone.android.name,
|
|
79
|
+
description: tone.android.description,
|
|
80
|
+
importance: ANDROID_IMPORTANCE[tone.android.importance],
|
|
81
|
+
sound: tone.android.sound,
|
|
82
|
+
vibration: tone.android.vibration,
|
|
83
|
+
badge: tone.android.badge,
|
|
84
|
+
bypassDnd: tone.android.bypassDnd,
|
|
85
|
+
groupId: tone.android.groupId
|
|
86
|
+
});
|
|
87
|
+
if (held === undefined) {
|
|
88
|
+
await engine().createChannel(payload);
|
|
89
|
+
remember();
|
|
90
|
+
return 'created';
|
|
91
|
+
}
|
|
92
|
+
if (held.name === tone.android.name && held.description === tone.android.description) {
|
|
93
|
+
// Nothing to say to the platform. Skipping the call is what keeps an
|
|
94
|
+
// unchanged configuration genuinely free, which reconciliation
|
|
95
|
+
// idempotence depends on.
|
|
96
|
+
return 'unchanged';
|
|
97
|
+
}
|
|
98
|
+
// Android accepts a re-declaration of an existing channel and applies only
|
|
99
|
+
// the name and description, ignoring importance, sound, vibration and DND
|
|
100
|
+
// — because those belong to the user once the channel exists. That refusal
|
|
101
|
+
// is the guarantee: the platform declines to overwrite the user's settings.
|
|
102
|
+
await engine().createChannel(payload);
|
|
103
|
+
remember();
|
|
104
|
+
return 'labelsRefreshed';
|
|
105
|
+
},
|
|
106
|
+
async retireTone(channelId) {
|
|
107
|
+
const existing = await declaredChannels();
|
|
108
|
+
if (!existing.some(channel => channel.id === channelId)) return false;
|
|
109
|
+
await engine().deleteChannel(channelId);
|
|
110
|
+
channelSnapshot = channelSnapshot?.filter(channel => channel.id !== channelId);
|
|
111
|
+
return true;
|
|
112
|
+
},
|
|
113
|
+
async declareGroups(groups) {
|
|
114
|
+
for (const group of groups) {
|
|
115
|
+
await engine().createChannelGroup(compact({
|
|
116
|
+
id: group.id,
|
|
117
|
+
name: group.name,
|
|
118
|
+
description: group.description
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
async listDeclaredChannels() {
|
|
123
|
+
return (await declaredChannels()).map(channel => channel.id);
|
|
124
|
+
},
|
|
125
|
+
permissionFrom(kind, settings) {
|
|
126
|
+
if (kind === 'display') {
|
|
127
|
+
// Android below 13 has no runtime display permission at all.
|
|
128
|
+
return atLeast(DISPLAY_PERMISSION_API) ? toPermissionState(settings.authorizationStatus) : 'notRequired';
|
|
129
|
+
}
|
|
130
|
+
// Before Android 12 the concept does not apply: "not required", not "denied".
|
|
131
|
+
if (!atLeast(EXACT_ALARM_API)) {
|
|
132
|
+
return 'notRequired';
|
|
133
|
+
}
|
|
134
|
+
const android = settings.android ?? {};
|
|
135
|
+
return android.alarm === 1 ? 'granted' : 'denied';
|
|
136
|
+
},
|
|
137
|
+
gatesExactAlarms: () => atLeast(EXACT_ALARM_API),
|
|
138
|
+
async restrictions(now) {
|
|
139
|
+
let batteryOptimization = 'unknown';
|
|
140
|
+
try {
|
|
141
|
+
batteryOptimization = (await engine().isBatteryOptimizationEnabled()) ? 'restricted' : 'unrestricted';
|
|
142
|
+
} catch {
|
|
143
|
+
batteryOptimization = 'unknown';
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
batteryOptimization,
|
|
147
|
+
// No standard API exposes vendor auto-start policy, and guessing would
|
|
148
|
+
// be worse than admitting it. `unknown` is a first-class answer here.
|
|
149
|
+
autoStart: 'unknown',
|
|
150
|
+
readAt: now()
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["toPermissionState","ANDROID_IMPORTANCE","BACKGROUND_WINDOW_MS","MARKER_CHANNEL_ID","compact","ANDROID_PENDING_BUDGET","DISPLAY_PERMISSION_API","EXACT_ALARM_API","createAndroidPlatform","engine","apiLevel","markerChannelReady","channelSnapshot","declaredChannels","getChannels","atLeast","level","Number","POSITIVE_INFINITY","capabilities","pendingCeiling","supportsExactAlarms","supportsChannels","supportsTextInputActions","supportsDoNotDisturbBypass","supportsRepeatingAlert","backgroundWindowMs","ensureMarkerChannel","createChannel","id","name","description","importance","min","vibration","badge","withChannelSnapshot","work","undefined","declareTone","tone","existing","held","find","channel","android","channelId","remember","filter","concat","payload","sound","bypassDnd","groupId","retireTone","some","deleteChannel","declareGroups","groups","group","createChannelGroup","listDeclaredChannels","map","permissionFrom","kind","settings","authorizationStatus","alarm","gatesExactAlarms","restrictions","now","batteryOptimization","isBatteryOptimizationEnabled","autoStart","readAt"],"sourceRoot":"../../../../../src","sources":["engine/notify-kit/platform/android.ts"],"mappings":";;AAAA;AACA;AACA;;AAEA,SAASA,iBAAiB,QAAQ,cAAW;AAC7C,SAASC,kBAAkB,EAAEC,oBAAoB,EAAEC,iBAAiB,EAAEC,OAAO,QAAQ,cAAW;AAGhG;AACA,MAAMC,sBAAsB,GAAG,GAAG;AAClC;AACA,MAAMC,sBAAsB,GAAG,EAAE;AACjC;AACA,MAAMC,eAAe,GAAG,EAAE;AAI1B,OAAO,SAASC,qBAAqBA,CAAC;EAAEC,MAAM;EAAEC;AAA0B,CAAC,EAAqB;EAC/F,IAAIC,kBAAkB,GAAG,KAAK;EAC9B;EACA,IAAIC,eAA8C;EAClD,MAAMC,gBAAgB,GAAG,MAAAA,CAAA,KACxBD,eAAe,IAAIH,MAAM,CAAC,CAAC,CAACK,WAAW,CAAC,CAAC;EAC1C;EACA,MAAMC,OAAO,GAAIC,KAAa,IAAc,CAACN,QAAQ,CAAC,CAAC,IAAIO,MAAM,CAACC,iBAAiB,KAAKF,KAAK;EAE7F,OAAO;IACNG,YAAY,EAAEA,CAAA,MAAO;MACpBC,cAAc,EAAEf,sBAAsB;MACtCgB,mBAAmB,EAAE,IAAI;MACzBC,gBAAgB,EAAE,IAAI;MACtBC,wBAAwB,EAAE,IAAI;MAC9BC,0BAA0B,EAAE,IAAI;MAChCC,sBAAsB,EAAE,IAAI;MAC5BC,kBAAkB,EAAExB;IACrB,CAAC,CAAC;IAEF;AACF;AACA;AACA;AACA;IACE,MAAMyB,mBAAmBA,CAAA,EAAG;MAC3B,IAAIhB,kBAAkB,EAAE;MACxB,MAAMF,MAAM,CAAC,CAAC,CAACmB,aAAa,CAAC;QAC5BC,EAAE,EAAE1B,iBAAiB;QACrB2B,IAAI,EAAE,wBAAwB;QAC9BC,WAAW,EACV,oFAAoF;QACrFC,UAAU,EAAE/B,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E,SAAS;QACpBC,MAAM,EAAEJ,GAAG,CAAC;MACb,CAAC;IACF;EACD,CAAC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The one place this package asks which platform it is on (IOS-08).
|
|
5
|
+
*
|
|
6
|
+
* rn-core's `currentPlatform()` decides the OS; the Android API level is read
|
|
7
|
+
* from React Native lazily, when asked, so the module loads without it.
|
|
8
|
+
*/
|
|
9
|
+
import { currentPlatform, lazyPeer } from '@chipmobilesdk/rn-core';
|
|
10
|
+
import { createAndroidPlatform } from "./android.js";
|
|
11
|
+
import { createIosPlatform } from "./ios.js";
|
|
12
|
+
const reactNative = lazyPeer('react-native', () => {
|
|
13
|
+
try {
|
|
14
|
+
return require('react-native');
|
|
15
|
+
} catch (cause) {
|
|
16
|
+
throw cause;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
/** The running OS and, on Android, its API level. */
|
|
21
|
+
export function detectPlatform() {
|
|
22
|
+
const os = currentPlatform();
|
|
23
|
+
if (os !== 'android') {
|
|
24
|
+
return {
|
|
25
|
+
os: os === 'ios' ? 'ios' : 'other'
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const result = reactNative.get();
|
|
29
|
+
const version = result.ok ? result.module.Platform?.Version : undefined;
|
|
30
|
+
return {
|
|
31
|
+
os,
|
|
32
|
+
apiLevel: typeof version === 'number' ? version : undefined
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The strategy for `platform`, or for the running one. Only Android gets the
|
|
38
|
+
* Android strategy; anywhere else nothing channel- or alarm-specific is called.
|
|
39
|
+
*/
|
|
40
|
+
export function createNotifyKitPlatform(engine, platform) {
|
|
41
|
+
const os = platform?.os ?? detectPlatform().os;
|
|
42
|
+
if (os !== 'android') {
|
|
43
|
+
return createIosPlatform();
|
|
44
|
+
}
|
|
45
|
+
return createAndroidPlatform({
|
|
46
|
+
engine,
|
|
47
|
+
// Read when asked rather than once, so it follows the device (and a test).
|
|
48
|
+
apiLevel: () => platform ? platform.apiLevel : detectPlatform().apiLevel
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["currentPlatform","lazyPeer","createAndroidPlatform","createIosPlatform","reactNative","require","cause","detectPlatform","os","result","get","version","ok","module","Platform","Version","undefined","apiLevel","createNotifyKitPlatform","engine","platform"],"sourceRoot":"../../../../../src","sources":["engine/notify-kit/platform/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,eAAe,EAAEC,QAAQ,QAAQ,wBAAwB;AAIlE,SAASC,qBAAqB,QAAQ,cAAW;AACjD,SAASC,iBAAiB,QAAQ,UAAO;AAOzC,MAAMC,WAAW,GAAGH,QAAQ,CAAmB,cAAc,EAAE,MAAM;EACpE,IAAI;IACH,OAAOI,OAAO,CAAC,cAAc,CAAC;EAC/B,CAAC,CAAC,OAAOC,KAAK,EAAE;IACf,MAAMA,KAAK;EACZ;AACD,CAAC,CAAC;;AAEF;AACA,OAAO,SAASC,cAAcA,CAAA,EAAiB;EAC9C,MAAMC,EAAE,GAAGR,eAAe,CAAC,CAAC;EAC5B,IAAIQ,EAAE,KAAK,SAAS,EAAE;IACrB,OAAO;MAAEA,EAAE,EAAEA,EAAE,KAAK,KAAK,GAAG,KAAK,GAAG;IAAQ,CAAC;EAC9C;EACA,MAAMC,MAAM,GAAGL,WAAW,CAACM,GAAG,CAAC,CAAC;EAChC,MAAMC,OAAO,GAAGF,MAAM,CAACG,EAAE,GAAGH,MAAM,CAACI,MAAM,CAACC,QAAQ,EAAEC,OAAO,GAAGC,SAAS;EACvE,OAAO;IAAER,EAAE;IAAES,QAAQ,EAAE,OAAON,OAAO,KAAK,QAAQ,GAAGA,OAAO,GAAGK;EAAU,CAAC;AAC3E;;AAEA;AACA;AACA;AACA;AACA,OAAO,SAASE,uBAAuBA,CACtCC,MAA6B,EAC7BC,QAAuB,EACH;EACpB,MAAMZ,EAAE,GAAGY,QAAQ,EAAEZ,EAAE,IAAID,cAAc,CAAC,CAAC,CAACC,EAAE;EAC9C,IAAIA,EAAE,KAAK,SAAS,EAAE;IACrB,OAAOL,iBAAiB,CAAC,CAAC;EAC3B;EACA,OAAOD,qBAAqB,CAAC;IAC5BiB,MAAM;IACN;IACAF,QAAQ,EAAEA,CAAA,KAAOG,QAAQ,GAAGA,QAAQ,CAACH,QAAQ,GAAGV,cAAc,CAAC,CAAC,CAACU;EAClE,CAAC,CAAC;AACH","ignoreList":[]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* iOS: no channels, no exact-alarm gate, a hard ceiling of 64 pending
|
|
5
|
+
* notifications. Categories are declared per request rather than up front.
|
|
6
|
+
*/
|
|
7
|
+
import { toPermissionState } from "../events.js";
|
|
8
|
+
import { BACKGROUND_WINDOW_MS } from "../module.js";
|
|
9
|
+
/**
|
|
10
|
+
* iOS keeps only the 64 soonest pending notifications and silently discards the
|
|
11
|
+
* rest. This number is the entire reason truncation must be computed and
|
|
12
|
+
* reported by the package rather than left to the platform.
|
|
13
|
+
*/
|
|
14
|
+
const IOS_PENDING_CEILING = 64;
|
|
15
|
+
export function createIosPlatform() {
|
|
16
|
+
return {
|
|
17
|
+
capabilities: () => ({
|
|
18
|
+
pendingCeiling: IOS_PENDING_CEILING,
|
|
19
|
+
supportsExactAlarms: false,
|
|
20
|
+
supportsChannels: false,
|
|
21
|
+
supportsTextInputActions: true,
|
|
22
|
+
supportsDoNotDisturbBypass: false,
|
|
23
|
+
// iOS exposes no looping-sound API. The one alert level that overrides the
|
|
24
|
+
// mute switch is entitlement-gated by Apple, and does not loop either — so
|
|
25
|
+
// there is nothing to partially support, and a partial emulation would be
|
|
26
|
+
// worse than an honest refusal.
|
|
27
|
+
supportsRepeatingAlert: false,
|
|
28
|
+
backgroundWindowMs: BACKGROUND_WINDOW_MS
|
|
29
|
+
}),
|
|
30
|
+
// No marker is ever placed where alerts cannot repeat.
|
|
31
|
+
async ensureMarkerChannel() {},
|
|
32
|
+
withChannelSnapshot: work => work(),
|
|
33
|
+
// Categories are declared at request time rather than up front.
|
|
34
|
+
declareTone: async () => 'unchanged',
|
|
35
|
+
retireTone: async () => false,
|
|
36
|
+
async declareGroups() {},
|
|
37
|
+
listDeclaredChannels: async () => [],
|
|
38
|
+
permissionFrom: (kind, settings) =>
|
|
39
|
+
// Exact alarms are an Android concept: "not required", not "denied".
|
|
40
|
+
kind === 'display' ? toPermissionState(settings.authorizationStatus) : 'notRequired',
|
|
41
|
+
gatesExactAlarms: () => false,
|
|
42
|
+
restrictions: async now => ({
|
|
43
|
+
batteryOptimization: 'unrestricted',
|
|
44
|
+
autoStart: 'unrestricted',
|
|
45
|
+
readAt: now()
|
|
46
|
+
})
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=ios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["toPermissionState","BACKGROUND_WINDOW_MS","IOS_PENDING_CEILING","createIosPlatform","capabilities","pendingCeiling","supportsExactAlarms","supportsChannels","supportsTextInputActions","supportsDoNotDisturbBypass","supportsRepeatingAlert","backgroundWindowMs","ensureMarkerChannel","withChannelSnapshot","work","declareTone","retireTone","declareGroups","listDeclaredChannels","permissionFrom","kind","settings","authorizationStatus","gatesExactAlarms","restrictions","now","batteryOptimization","autoStart","readAt"],"sourceRoot":"../../../../../src","sources":["engine/notify-kit/platform/ios.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA,SAASA,iBAAiB,QAAQ,cAAW;AAC7C,SAASC,oBAAoB,QAAQ,cAAW;AAGhD;AACA;AACA;AACA;AACA;AACA,MAAMC,mBAAmB,GAAG,EAAE;AAE9B,OAAO,SAASC,iBAAiBA,CAAA,EAAsB;EACtD,OAAO;IACNC,YAAY,EAAEA,CAAA,MAAO;MACpBC,cAAc,EAAEH,mBAAmB;MACnCI,mBAAmB,EAAE,KAAK;MAC1BC,gBAAgB,EAAE,KAAK;MACvBC,wBAAwB,EAAE,IAAI;MAC9BC,0BAA0B,EAAE,KAAK;MACjC;MACA;MACA;MACA;MACAC,sBAAsB,EAAE,KAAK;MAC7BC,kBAAkB,EAAEV;IACrB,CAAC,CAAC;IAEF;IACA,MAAMW,mBAAmBA,CAAA,EAAG,CAAC,CAAC;IAE9BC,mBAAmB,EAAEC,IAAI,IAAIA,IAAI,CAAC,CAAC;IACnC;IACAC,WAAW,EAAE,MAAAA,CAAA,KAAY,WAAW;IACpCC,UAAU,EAAE,MAAAA,CAAA,KAAY,KAAK;IAC7B,MAAMC,aAAaA,CAAA,EAAG,CAAC,CAAC;IACxBC,oBAAoB,EAAE,MAAAA,CAAA,KAAY,EAAE;IAEpCC,cAAc,EAAEA,CAACC,IAAI,EAAEC,QAAQ;IAC9B;IACAD,IAAI,KAAK,SAAS,GAAGpB,iBAAiB,CAACqB,QAAQ,CAACC,mBAAmB,CAAC,GAAG,aAAa;IAErFC,gBAAgB,EAAEA,CAAA,KAAM,KAAK;IAE7BC,YAAY,EAAE,MAAMC,GAAG,KAAK;MAC3BC,mBAAmB,EAAE,cAAc;MACnCC,SAAS,EAAE,cAAc;MACzBC,MAAM,EAAEH,GAAG,CAAC;IACb,CAAC;EACF,CAAC;AACF","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../../src","sources":["engine/notify-kit/platform/types.ts"],"mappings":"","ignoreList":[]}
|