This commit is contained in:
eskimo
2025-04-13 18:12:59 -04:00
parent 1cfde91b76
commit 9e726d0626
7 changed files with 3834 additions and 40 deletions

View File

@@ -1,3 +1,4 @@
export interface PromoCodePlugin {
echo(options: { value: string }): Promise<{ value: string }>;
}
launchPromoCodeRedemptionFlow(): Promise<{ success: boolean; message?: string }>;
isPromoCodeSupported(): Promise<{ supported: boolean }>;
}

View File

@@ -1,10 +1,9 @@
import { registerPlugin } from '@capacitor/core';
import type { PromoCodePlugin } from './definitions';
const PromoCode = registerPlugin<PromoCodePlugin>('PromoCode', {
web: () => import('./web').then((m) => new m.PromoCodeWeb()),
web: () => import('./web').then(m => new m.PromoCodeWeb()),
});
export * from './definitions';
export { PromoCode };
export { PromoCode };

View File

@@ -3,8 +3,16 @@ import { WebPlugin } from '@capacitor/core';
import type { PromoCodePlugin } from './definitions';
export class PromoCodeWeb extends WebPlugin implements PromoCodePlugin {
async echo(options: { value: string }): Promise<{ value: string }> {
console.log('ECHO', options);
return options;
async launchPromoCodeRedemptionFlow(): Promise<{ success: boolean; message?: string }> {
return {
success: false,
message: 'Promo code redemption is not supported on web',
};
}
}
async isPromoCodeSupported(): Promise<{ supported: boolean }> {
return {
supported: false,
};
}
}