1.0.13
⚠ This may only be useful when connecting to users' remote-storage instances through a non-null remoteStorage
constructor parameter.
List of lucchetto providing servers for production: these are shown as options in the
RS widget dropdown,
when the Lucchetto
class is constructed with !isTest
:
@rs.overhide.io
⚠ This may only be useful when connecting to users' remote-storage instances through a non-null remoteStorage
constructor parameter.
List of lucchetto providing servers for testnets: these are shown as options in the
RS widget dropdown,
when the Lucchetto
class is constructed with isTest
:
@test.rs.overhide.io
@localhost:8000
This class provides utility functions to fetch in-app purchase data from the app-developer's RS (+Lucchetto) connection. The in-app purchase data must first be onboarded onto a Lucchetto extended RS server.
A typical usage of this class with pay2my.app widgets might look like:
var lucchetto = new Lucchetto({
overhideIsTest: true,
pay2myAppHub: document.getElementById('hub-id-in-dom'),
overhideApiKey: '0x42..cb'});
...
window.addEventListener('pay2myapp-appsell-sku-clicked', async (e) => {
...
const result = await lucchetto.getSku(`https://test.rs.overhide.io`, e.detail);
console.log(`got SKU results`, { sku: e.detail.sku , result });
...
}, false);
⚠ In the context of being connected to your users' remote-storage instances through a non-null remoteStorage
constructor (first) parameter:
Reacts to remotestorage.js onConnected
events to
parse metadata out of newly available RS tokens.
If the connected RS server is Lucchetto extended, the token will provide metadata useful to pay2my.app in-app purchase widgets — making for a nicer end-user experience.
This class enriches the dropdown of the RS widget, if any, embedded in
the DOM. The enrichment provides server hints as per LUCCHETTO_PROVIDERS
and LUCCHETTO_PROVIDERS_4_TEST
.
A typical usage of this class along with remotestorage.js and pay2my.app widgets might look like:
var rsClient = new RemoteStorage();
var lucchetto = new Lucchetto({
remoteStorage: rsClient,
overhideIsTest: true,
pay2myAppHub: document.getElementById('hub-id-in-dom'),
overhideApiKey: '0x42..cb'});
...
window.addEventListener('pay2myapp-appsell-sku-clicked', async (e) => {
...
const result = await lucchetto.getSku(`https://test.rs.overhide.io`, e.detail);
console.log(`got SKU results`, { sku: e.detail.sku , result });
...
}, false);
(Object
= {remoteStorage:null,overhideIsTest:false,pay2myAppHub:null,overhideApiKey:null}
)
the construction options
Name | Description |
---|---|
options.remoteStorage Object
|
the RS instance available from client. This is an RS instance connected to the the client-user's data. Set this to
null
if you're using
lucchetto
outside of a
remote-storage
app, just for the
getSku(..)
endpoint.
|
options.overhideIsTest bool
|
flag whether this is all working against testnets or mainnets/prod servers. |
options.pay2myAppHub Object
|
pay2my.app hub
to instrument with credentials coming out of the remoteStorage instance.
If user connects with a
Lucchetto extended
remoteStorage
, this hub will be instrumented. Otherwise the hub will need to ask for credentials on in-app purchase use.
|
options.overhideApiKey Object
|
the API key to use,
get an API key
for the right network, either testnet or mainnet. If the
remoteStorage
instance is provided and is a
Lucchetto extended
RS server, you may leave this as
null
: a
Lucchetto
extended RS server will provide a user-specific token to use with
getSku(..)
overhide
connections. *
|
⚠ This may only be useful when connecting to users' remote-storage instances through a non-null remoteStorage
constructor parameter.
Get all metadata from the token
any
:
the metadata object, it may include:
⚠ This may only be useful when connecting to users' remote-storage instances through a non-null remoteStorage
constructor parameter.
string
:
the user address last seen upon last connection
string
:
the lucchetto namespace: under which lucchetto in-app purchase SKU data is stored.
⚠ This may only be useful when connecting to users' remote-storage instances through a non-null remoteStorage
constructor parameter.
Retrieve a remotestorage path to in-app purchase SKUs.
A helper to derive the path on the Lucchetto extended RS server.
This is the path off of the developer's account and getNamespace()
namespace .
(any)
tag must be a a string comprised of 2 to 20 numbers, lower case letters, hypens, and periods
(any)
must be in US dollars, optionally with a period and cents: 0 or 50 cents and up
(any)
must be a whole number
string
:
Retrieve data for a SKU.
The IAP SKU data (sku
, price
, within
) must first be onboarded onto a Lucchetto
extended RS server.
(string)
the URL to your, the developer's,
Lucchetto
extended RS server that contains your IAP SKU definitions.
(any)
the
detail
object from the
pay2myapp-appsell-sku-clicked
event, see
https://www.npmjs.com/package/pay2my.app
string
:
the data payload for the SKU