diff options
| author | rxliuli <rxliuli@gmail.com> | 2025-11-04 05:03:50 +0800 |
|---|---|---|
| committer | rxliuli <rxliuli@gmail.com> | 2025-11-04 05:03:50 +0800 |
| commit | bce557cc2dc767628bed6aac87301a1be7c5431b (patch) | |
| tree | b51a051228d01fe3306cd7626d4a96768aadb944 /src/jet/intents/static-message-pages | |
init commit
Diffstat (limited to 'src/jet/intents/static-message-pages')
4 files changed, 180 insertions, 0 deletions
diff --git a/src/jet/intents/static-message-pages/carrier-page-intent-controller.ts b/src/jet/intents/static-message-pages/carrier-page-intent-controller.ts new file mode 100644 index 0000000..a1b049c --- /dev/null +++ b/src/jet/intents/static-message-pages/carrier-page-intent-controller.ts @@ -0,0 +1,41 @@ +import type { IntentController } from '@jet/environment/dispatching'; +import type { RouteProvider } from '@jet/environment/routing'; +import type { AppStoreObjectGraph } from '@jet-app/app-store/foundation/runtime/app-store-object-graph'; +import { withActiveIntent } from '@jet-app/app-store/foundation/dependencies/active-intent'; +import { generateRoutes } from '@jet-app/app-store/common/util/generate-routes'; +import { injectWebNavigation } from '@jet-app/app-store/common/web-navigation/inject-web-navigation'; + +import { StaticMessagePage } from '~/jet/models/static-message-page'; + +const { routes, makeCanonicalUrl } = generateRoutes( + (opts) => ({ + ...opts, + $kind: 'CarrierPageIntent', + }), + '/carrier', +); + +export const CarrierPageIntentController: IntentController<any> & + RouteProvider = { + $intentKind: 'CarrierPageIntent', + + routes, + + async perform(intent, objectGraphWithoutActiveIntent: AppStoreObjectGraph) { + return await withActiveIntent( + objectGraphWithoutActiveIntent, + intent, + async (objectGraph) => { + const page = new StaticMessagePage({ + titleLocKey: 'ASE.Web.AppStore.Carrier.Title', + contentType: 'carrier', + }); + + page.canonicalURL = makeCanonicalUrl(objectGraph, intent); + + injectWebNavigation(objectGraph, page, intent.platform); + return page; + }, + ); + }, +}; diff --git a/src/jet/intents/static-message-pages/contingent-price-page-intent-controller.ts b/src/jet/intents/static-message-pages/contingent-price-page-intent-controller.ts new file mode 100644 index 0000000..ba2babd --- /dev/null +++ b/src/jet/intents/static-message-pages/contingent-price-page-intent-controller.ts @@ -0,0 +1,49 @@ +import type { IntentController } from '@jet/environment/dispatching'; +import type { RouteProvider } from '@jet/environment/routing'; +import type { AppStoreObjectGraph } from '@jet-app/app-store/foundation/runtime/app-store-object-graph'; +import { withActiveIntent } from '@jet-app/app-store/foundation/dependencies/active-intent'; +import { generateRoutes } from '@jet-app/app-store/common/util/generate-routes'; +import { injectWebNavigation } from '@jet-app/app-store/common/web-navigation/inject-web-navigation'; + +import { StaticMessagePage } from '~/jet/models/static-message-page'; + +const { routes, makeCanonicalUrl } = generateRoutes( + (opts) => ({ + ...opts, + $kind: 'ContingentPriceIntent', + }), + '/contingent-price/{offerId}', + [], + { + extraRules: [ + { + regex: [/(?:\/[a-z]{2})?\/contingent-price/], + }, + ], + }, +); + +export const ContingentPricingIntentController: IntentController<any> & + RouteProvider = { + $intentKind: 'ContingentPriceIntent', + + routes, + + async perform(intent, objectGraphWithoutActiveIntent: AppStoreObjectGraph) { + return await withActiveIntent( + objectGraphWithoutActiveIntent, + intent, + async (objectGraph) => { + const page = new StaticMessagePage({ + titleLocKey: 'ASE.Web.AppStore.WinBack.Title', + contentType: 'contingent-price', + }); + + page.canonicalURL = makeCanonicalUrl(objectGraph, intent); + + injectWebNavigation(objectGraph, page, intent.platform); + return page; + }, + ); + }, +}; diff --git a/src/jet/intents/static-message-pages/invoice-page-intent-controller.ts b/src/jet/intents/static-message-pages/invoice-page-intent-controller.ts new file mode 100644 index 0000000..caa02f4 --- /dev/null +++ b/src/jet/intents/static-message-pages/invoice-page-intent-controller.ts @@ -0,0 +1,41 @@ +import type { IntentController } from '@jet/environment/dispatching'; +import type { RouteProvider } from '@jet/environment/routing'; +import type { AppStoreObjectGraph } from '@jet-app/app-store/foundation/runtime/app-store-object-graph'; +import { withActiveIntent } from '@jet-app/app-store/foundation/dependencies/active-intent'; +import { generateRoutes } from '@jet-app/app-store/common/util/generate-routes'; +import { injectWebNavigation } from '@jet-app/app-store/common/web-navigation/inject-web-navigation'; + +import { StaticMessagePage } from '~/jet/models/static-message-page'; + +const { routes, makeCanonicalUrl } = generateRoutes( + (opts) => ({ + ...opts, + $kind: 'InvoicePageIntent', + }), + '/invoice', +); + +export const InvoicePageIntentController: IntentController<any> & + RouteProvider = { + $intentKind: 'InvoicePageIntent', + + routes, + + async perform(intent, objectGraphWithoutActiveIntent: AppStoreObjectGraph) { + return await withActiveIntent( + objectGraphWithoutActiveIntent, + intent, + async (objectGraph) => { + const page = new StaticMessagePage({ + titleLocKey: 'ASE.Web.AppStore.Invoice.Title', + contentType: 'invoice', + }); + + page.canonicalURL = makeCanonicalUrl(objectGraph, intent); + + injectWebNavigation(objectGraph, page, intent.platform); + return page; + }, + ); + }, +}; diff --git a/src/jet/intents/static-message-pages/win-back-page-intent-controller.ts b/src/jet/intents/static-message-pages/win-back-page-intent-controller.ts new file mode 100644 index 0000000..2b78ba0 --- /dev/null +++ b/src/jet/intents/static-message-pages/win-back-page-intent-controller.ts @@ -0,0 +1,49 @@ +import type { IntentController } from '@jet/environment/dispatching'; +import type { RouteProvider } from '@jet/environment/routing'; +import type { AppStoreObjectGraph } from '@jet-app/app-store/foundation/runtime/app-store-object-graph'; +import { withActiveIntent } from '@jet-app/app-store/foundation/dependencies/active-intent'; +import { generateRoutes } from '@jet-app/app-store/common/util/generate-routes'; +import { injectWebNavigation } from '@jet-app/app-store/common/web-navigation/inject-web-navigation'; + +import { StaticMessagePage } from '~/jet/models/static-message-page'; + +const { routes, makeCanonicalUrl } = generateRoutes( + (opts) => ({ + ...opts, + $kind: 'WinBackPageIntent', + }), + '/win-back/{offerId}', + [], + { + extraRules: [ + { + regex: [/(?:\/[a-z]{2})?\/win-back/], + }, + ], + }, +); + +export const WinBackPageIntentController: IntentController<any> & + RouteProvider = { + $intentKind: 'WinBackPageIntent', + + routes, + + async perform(intent, objectGraphWithoutActiveIntent: AppStoreObjectGraph) { + return await withActiveIntent( + objectGraphWithoutActiveIntent, + intent, + async (objectGraph) => { + const page = new StaticMessagePage({ + titleLocKey: 'ASE.Web.AppStore.WinBack.Title', + contentType: 'win-back', + }); + + page.canonicalURL = makeCanonicalUrl(objectGraph, intent); + + injectWebNavigation(objectGraph, page, intent.platform); + return page; + }, + ); + }, +}; |
