Skip to content

Commit

Permalink
Purge fund
Browse files Browse the repository at this point in the history
  • Loading branch information
rosano committed Sep 1, 2023
1 parent 204a249 commit 553c21d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 168 deletions.
5 changes: 0 additions & 5 deletions .env-sample
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ OLSK_VERSION_LIMIT=50
KVC_TEMPLATE_NORMALIZE_URL=https://cdn.jsdelivr.net/npm/normalize.css/normalize.css
KVC_TEMPLATE_DECOR_URL=https://cdn.jsdelivr.net/gh/olsk/OLSKDecor/ui-style.css

OLSK_FUND_FORM_URL=https://fund.rosano.ca
OLSK_FUND_API_URL=https://fund.rosano.ca/api/grant
OLSK_FUND_PRICING_STRING="0:10 10,100 50,500 250"
OLSK_FUND_DOCUMENT_LIMIT=100

OLSK_LAYOUT_TOUCH_ICON_URL=https://static.rosano.ca/wikiavec/touch.png

ROCO_SHARED_PROJECT_ID=RP_003
Expand Down
2 changes: 0 additions & 2 deletions os-app/open-guide/text-en.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,6 @@ After setting up a custom domain, designate any note as the home page with the `
| `KVCWriteLauncherItemConfigureCustomTemplateText` | Launcher |
| `KVCWriteLauncherItemRemoveCustomTemplateText` | Launcher |
| `OLSKRemoteStorageLauncherItemCopyLoginLinkText` | Launcher |
| `OLSKFundLauncherItemEnterClueText` | Launcher |
| `OLSKFundLauncherItemClearClueText` | Launcher |
| `OLSKRemoteStorageLauncherItemDebugFlushDataText` | Launcher |

# Add to Home screen on mobile and tablet devices
Expand Down
130 changes: 8 additions & 122 deletions os-app/open-write/main.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import RemoteStorage from 'remotestoragejs';
import KVCTemplate from '../_shared/KVCTemplate/main.js';
import OLSKString from 'OLSKString';
import OLSKLanguageSwitcher from 'OLSKLanguageSwitcher';
import OLSKFund from 'OLSKFund';
import OLSKVersion from 'OLSKVersion';
import OLSKLocalStorage from 'OLSKLocalStorage';
import OLSKPact from 'OLSKPact';
Expand Down Expand Up @@ -271,17 +270,6 @@ const mod = {
},
},
{
LCHRecipeName: 'FakeFundDocumentLimit',
LCHRecipeCallback: async function FakeFundDocumentLimit () {
await Promise.all(Array.from(Array(mod._ValueDocumentRemainder)).map(function (e) {
return mod._ValueZDRWrap.App.KVCNote.KVCNoteCreate({
KVCNoteBody: Math.random().toString(),
});
}));
return mod.SetupCatalog();
},
}, {
LCHRecipeName: 'KVCWriteLauncherItemDebug_PromptFakeImportPlain',
LCHRecipeCallback: function KVCWriteLauncherItemDebug_PromptFakeImportPlain () {
return mod.ControlNotesImportTXT([Object.assign(new File([], Math.random().toString()), {
Expand Down Expand Up @@ -327,16 +315,6 @@ const mod = {
}));
}
outputData.push(...OLSKFund.OLSKFundRecipes({
OLSKLocalized,
ParamConnected: !!mod._ValueCloudIdentity,
ParamAuthorized: !!mod._ValueFundClue,
OLSKFundDispatchGrant: mod.OLSKFundDispatchGrant,
OLSKFundDispatchPersist: mod.OLSKFundDispatchPersist,
ParamMod: mod,
ParamSpecUI: OLSK_SPEC_UI(),
}));
outputData.push(...OLSKServiceWorker.OLSKServiceWorkerRecipes(window, mod.DataNavigator(), OLSKLocalized, OLSK_SPEC_UI()));
if (mod._KVCWriteDetail) {
Expand All @@ -360,16 +338,6 @@ const mod = {
return `${ OLSKTransport.OLSKTransportExportBasename() }.zip`;
},
DataIsEligible (inputData = {}) {
return OLSKFund.OLSKFundIsEligible(Object.assign({
ParamMinimumTier: 1,
ParamCurrentProject: 'ROCO_SHARED_PROJECT_ID_SWAP_TOKEN',
ParamBundleProjects: ['FakeBundleProject'],
ParamGrantTier: OLSKFund.OLSKFundTier('OLSK_FUND_PRICING_STRING_SWAP_TOKEN', mod._ValueOLSKFundGrant),
ParamGrantProject: mod._ValueOLSKFundGrant ? mod._ValueOLSKFundGrant.OLSKPactGrantProject : '',
}, inputData));
},
DataIsMobile () {
return window.innerWidth <= 760;
},
Expand Down Expand Up @@ -451,10 +419,6 @@ const mod = {
},
async ControlNoteCreate(inputData) {
if (mod._ValueDocumentRemainder < 1 && !mod.DataIsEligible()) {
return mod.OLSKFundDocumentGate();
}
mod.ControlNoteActivate(mod._OLSKCatalog.modPublic.OLSKCatalogInsert(await mod._ValueZDRWrap.App.KVCNote.KVCNoteCreate(typeof inputData === 'object' ? inputData : {
KVCNoteBody: typeof inputData === 'string' ? inputData : '',
})));
Expand Down Expand Up @@ -723,10 +687,6 @@ const mod = {
mod.ControlNoteCreate(inputData + '\n\n');
},
OLSKCatalogDispatchQuantity (inputData) {
mod.OLSKFundDocumentRemainder && mod.OLSKFundDocumentRemainder(inputData);
},
OLSKAppToolbarDispatchApropos () {
mod._OLSKModalView.modPublic.OLSKModalViewShow();
},
Expand Down Expand Up @@ -970,34 +930,6 @@ const mod = {
mod._ValueZDRWrap.ZDRStorageClient().stopSync();
},
OLSKFundSetupDispatchClue () {
return mod.DataSetting('KVCSettingFundClue') || null;
},
_OLSKFundSetupDispatchUpdate (inputData) {
mod[inputData] = mod[inputData]; // #purge-svelte-force-update
},
OLSKFundDispatchPersist (inputData) {
mod._ValueFundClue = inputData; // #hotfix-missing-persist
if (!inputData) {
return mod._ValueZDRWrap.App.KVCSetting.ZDRModelDeleteObject({
KVCSettingKey: 'KVCSettingFundClue',
});
}
return mod.ValueSetting('KVCSettingFundClue', inputData).then(function () {
if (OLSK_SPEC_UI()) {
return;
}
setTimeout(function () {
window.location.reload();
}, mod._ValueZDRWrap.ZDRStorageProtocol === zerodatawrap.ZDRProtocolFission() ? 1000 : 0); // #hotfix-fission-delay
});
},
// REACT
ReactIsLoading (inputData) {
Expand Down Expand Up @@ -1025,7 +957,7 @@ const mod = {
mod.SetupValueVersionsMap();
mod.SetupFund();
mod.SetupCleanup();
mod.ReactIsLoading(mod._ValueIsLoading = false);
Expand Down Expand Up @@ -1090,7 +1022,7 @@ const mod = {
};
if (!(await mod._ValueZDRWrap.App.KVCNote.KVCNoteList()).map(mod._OLSKCatalog.modPublic.OLSKCatalogInsert).length) {
mod.OLSKCatalogDispatchQuantity(0);
// mod.OLSKCatalogDispatchQuantity(0);
}
},
Expand All @@ -1104,50 +1036,12 @@ const mod = {
mod._ValueVersionMap = OLSKLocalStorage.OLKSLocalStorageGet(window.localStorage, 'KVC_VERSION_MAP') || {};
},
async SetupFund () {
OLSKFund.OLSKFundSetup({
ParamMod: mod,
OLSKLocalized,
ParamFormURL: 'OLSK_FUND_FORM_URL_SWAP_TOKEN',
ParamProject: 'ROCO_SHARED_PROJECT_ID_SWAP_TOKEN',
ParamSpecUI: OLSK_SPEC_UI(),
ParamDocumentLimit: parseInt('OLSK_FUND_DOCUMENT_LIMIT_SWAP_TOKEN'),
});
mod.OLSKFundDocumentRemainder(mod._OLSKCatalog.modPublic._OLSKCatalogDataItemsAll().length);
SetupCleanup() {
window.localStorage.removeItem('OLSK_FUND_GRANT_DATA');
await OLSKFund.OLSKFundSetupPostPay(mod);
if (!mod._ValueCloudIdentity) {
return;
}
if (!mod._ValueFundClue) {
return;
}
const item = {
OLSK_CRYPTO_PAIR_RECEIVER_PRIVATE: `OLSK_CRYPTO_PAIR_RECEIVER_PRIVATE_SWAP_TOKEN${ '' }`, // #purge
OLSK_CRYPTO_PAIR_SENDER_PUBLIC: 'OLSK_CRYPTO_PAIR_SENDER_PUBLIC_SWAP_TOKEN',
OLSK_FUND_API_URL: 'OLSK_FUND_API_URL_SWAP_TOKEN',
ParamBody: {
OLSKPactAuthType: mod._ValueZDRWrap.ZDRStorageProtocol === zerodatawrap.ZDRProtocolRemoteStorage() ? OLSKPact.OLSKPactAuthTypeRemoteStorage() : OLSKPact.OLSKPactAuthTypeFission(),
OLSKPactAuthIdentity: mod._ValueCloudIdentity,
OLSKPactAuthProof: mod._ValueCloudToken,
OLSKPactAuthMetadata: {
OLSKPactAuthMetadataModuleName: 'wikiavec',
OLSKPactAuthMetadataFolderPath: KVCNote.KVCNoteDirectory() + '/',
},
OLSKPactPayIdentity: mod._ValueCloudIdentity,
OLSKPactPayClue: mod._ValueFundClue,
},
OLSKLocalized,
OLSKFundDispatchProgress: mod.OLSKFundDispatchProgress,
OLSKFundDispatchFail: mod.OLSKFundDispatchFail,
OLSKFundDispatchGrant: mod.OLSKFundDispatchGrant,
};
return OLSKFund.OLSKFundSetupGrant(item);
return mod._ValueSettingsAll.KVCSettingFundClue && mod._ValueZDRWrap.App.KVCSetting.ZDRModelDeleteObject({
KVCSettingKey: 'KVCSettingFundClue',
});
},
// LIFECYCLE
Expand Down Expand Up @@ -1201,7 +1095,6 @@ import OLSKUIAssets from 'OLSKUIAssets';
OLSKCatalogDispatchArchivedHide={ mod.OLSKCatalogDispatchArchivedHide }
OLSKCatalogDispatchArchivedShow={ mod.OLSKCatalogDispatchArchivedShow }
OLSKCatalogDispatchFilterSubmit={ mod.OLSKCatalogDispatchFilterSubmit }
OLSKCatalogDispatchQuantity={ mod.OLSKCatalogDispatchQuantity }

let:OLSKCollectionItem
>
Expand Down Expand Up @@ -1296,13 +1189,10 @@ import OLSKUIAssets from 'OLSKUIAssets';
OLSKAppToolbarDispatchApropos={ mod.OLSKAppToolbarDispatchApropos }
OLSKAppToolbarDispatchTongue={ mod.OLSKAppToolbarDispatchTongue }
OLSKAppToolbarGuideURL={ window.OLSKCanonical('KVCGuideRoute') }
OLSKAppToolbarFundShowProgress={ mod._ValueOLSKFundProgress }
OLSKAppToolbarFundLimitText={ mod._ValueDocumentRemainder }
OLSKAppToolbarErrorText={ mod._OLSKAppToolbarErrorText }
OLSKAppToolbarCloudConnected={ !!mod._ValueCloudIdentity }
OLSKAppToolbarCloudOffline={ mod._ValueCloudIsOffline }
OLSKAppToolbarCloudError={ !!mod._ValueCloudErrorText }
OLSKAppToolbarDispatchFund={ mod._ValueOLSKFundGrant || OLSKFund.OLSKFundResponseIsPresent() ? null : mod.OLSKAppToolbarDispatchFund }
OLSKAppToolbarDispatchCloud={ mod.OLSKAppToolbarDispatchCloud }
OLSKAppToolbarDispatchLauncher={ mod.OLSKAppToolbarDispatchLauncher }
/>
Expand All @@ -1316,13 +1206,9 @@ import OLSKUIAssets from 'OLSKUIAssets';

</div>

{#if !!mod._ValueCloudIdentity }
<OLSKWebView OLSKModalViewTitleText={ OLSKLocalized('OLSKFundWebViewTitleText') } OLSKWebViewURL={ mod._ValueFundURL } bind:this={ mod._OLSKWebView } DEBUG_OLSKWebViewDataSource={ OLSK_SPEC_UI() } />
{/if}

<OLSKModalView OLSKModalViewTitleText={ OLSKLocalized('OLSKAproposHeadingText') } bind:this={ mod._OLSKModalView } OLSKModalViewIsCapped={ true }>
<OLSKApropos
OLSKAproposFeedbackValue={ `javascript:window.location.href = window.atob('${ window.btoa(OLSKString.OLSKStringFormatted(window.atob('OLSK_APROPOS_FEEDBACK_EMAIL_SWAP_TOKEN'), 'ROCO_SHARED_PROJECT_ID_SWAP_TOKEN' + (mod._ValueFundClue ? '+' + mod._ValueFundClue : ''))) }')` }
OLSKAproposFeedbackValue={ `javascript:window.location.href = window.atob('${ window.btoa(OLSKString.OLSKStringFormatted(window.atob('OLSK_APROPOS_FEEDBACK_EMAIL_SWAP_TOKEN'), 'ROCO_SHARED_PROJECT_ID_SWAP_TOKEN')) }')` }
/>
</OLSKModalView>

Expand Down
33 changes: 0 additions & 33 deletions os-app/open-write/ui-test-fund.js

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

"OLSKPithApp": "olsk/OLSKPithApp",
"OLSKCatalog": "olsk/OLSKCatalog",
"marked": "latest",
"marked": "5.x",
"escape-string-regexp": "4.x",
"OLSKVersion": "olsk/OLSKVersion",
"OLSKLocalStorage": "olsk/OLSKLocalStorage",
Expand Down
5 changes: 0 additions & 5 deletions rollup-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ export default require('OLSKRollupScaffold').OLSKRollupScaffoldScanStart(__dirna
KVC_TEMPLATE_NORMALIZE_URL_SWAP_TOKEN: process.env.KVC_TEMPLATE_NORMALIZE_URL,
KVC_TEMPLATE_DECOR_URL_SWAP_TOKEN: process.env.KVC_TEMPLATE_DECOR_URL,

OLSK_FUND_API_URL_SWAP_TOKEN: process.env.OLSK_FUND_API_URL,
OLSK_FUND_FORM_URL_SWAP_TOKEN: process.env.OLSK_FUND_FORM_URL,
OLSK_FUND_PRICING_STRING_SWAP_TOKEN: process.env.OLSK_FUND_PRICING_STRING,
OLSK_FUND_DOCUMENT_LIMIT_SWAP_TOKEN: process.env.OLSK_FUND_DOCUMENT_LIMIT,

OLSK_CRYPTO_PAIR_RECEIVER_PRIVATE_SWAP_TOKEN: process.env.OLSK_CRYPTO_PAIR_RECEIVER_PRIVATE,
OLSK_CRYPTO_PAIR_SENDER_PUBLIC_SWAP_TOKEN: process.env.OLSK_CRYPTO_PAIR_SENDER_PUBLIC,

Expand Down

0 comments on commit 553c21d

Please sign in to comment.